@jingyi0605/codingns 0.1.0 → 0.1.2

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 (241) hide show
  1. package/README.md +14 -0
  2. package/dist/public/assets/TerminalPage-Dr7knYq2.js +55 -0
  3. package/dist/public/assets/index-BpUi6zoT.js +108 -0
  4. package/dist/public/assets/index-NMtdQNda.css +1 -0
  5. package/dist/public/index.html +2 -2
  6. package/dist/server/config/env.js +72 -7
  7. package/dist/server/config/env.js.map +1 -1
  8. package/dist/server/config/opencode-base-url-resolver.d.ts +13 -8
  9. package/dist/server/config/opencode-base-url-resolver.js +117 -147
  10. package/dist/server/config/opencode-base-url-resolver.js.map +1 -1
  11. package/dist/server/config/opencode-system-probe-helper-client.d.ts +18 -0
  12. package/dist/server/config/opencode-system-probe-helper-client.js +127 -0
  13. package/dist/server/config/opencode-system-probe-helper-client.js.map +1 -0
  14. package/dist/server/config/opencode-system-probe-helper-process.d.ts +1 -0
  15. package/dist/server/config/opencode-system-probe-helper-process.js +208 -0
  16. package/dist/server/config/opencode-system-probe-helper-process.js.map +1 -0
  17. package/dist/server/modules/git/git-command-helper-client.d.ts +25 -0
  18. package/dist/server/modules/git/git-command-helper-client.js +143 -0
  19. package/dist/server/modules/git/git-command-helper-client.js.map +1 -0
  20. package/dist/server/modules/git/git-command-helper-process.d.ts +1 -0
  21. package/dist/server/modules/git/git-command-helper-process.js +237 -0
  22. package/dist/server/modules/git/git-command-helper-process.js.map +1 -0
  23. package/dist/server/modules/git/git-command-runner.d.ts +8 -0
  24. package/dist/server/modules/git/git-command-runner.js +77 -6
  25. package/dist/server/modules/git/git-command-runner.js.map +1 -1
  26. package/dist/server/modules/git/git-controller.d.ts +4 -0
  27. package/dist/server/modules/git/git-controller.js +4 -1
  28. package/dist/server/modules/git/git-controller.js.map +1 -1
  29. package/dist/server/modules/git/git-read-service.d.ts +2 -1
  30. package/dist/server/modules/git/git-read-service.js +30 -0
  31. package/dist/server/modules/git/git-read-service.js.map +1 -1
  32. package/dist/server/modules/git/git-write-service.d.ts +1 -1
  33. package/dist/server/modules/git/git-write-service.js +8 -7
  34. package/dist/server/modules/git/git-write-service.js.map +1 -1
  35. package/dist/server/modules/git/types.d.ts +5 -0
  36. package/dist/server/modules/preferences/common.d.ts +2 -0
  37. package/dist/server/modules/preferences/common.js +13 -0
  38. package/dist/server/modules/preferences/common.js.map +1 -0
  39. package/dist/server/modules/preferences/profile-controller.d.ts +11 -0
  40. package/dist/server/modules/preferences/profile-controller.js +14 -0
  41. package/dist/server/modules/preferences/profile-controller.js.map +1 -0
  42. package/dist/server/modules/preferences/profile-service.d.ts +17 -0
  43. package/dist/server/modules/preferences/profile-service.js +213 -0
  44. package/dist/server/modules/preferences/profile-service.js.map +1 -0
  45. package/dist/server/modules/preferences/quick-phrase-controller.js +2 -12
  46. package/dist/server/modules/preferences/quick-phrase-controller.js.map +1 -1
  47. package/dist/server/modules/provider/codex-model-options.js +26 -165
  48. package/dist/server/modules/provider/codex-model-options.js.map +1 -1
  49. package/dist/server/modules/provider/opencode-model-options.js +6 -71
  50. package/dist/server/modules/provider/opencode-model-options.js.map +1 -1
  51. package/dist/server/modules/provider/provider-controller.d.ts +2 -0
  52. package/dist/server/modules/provider/provider-controller.js +21 -1
  53. package/dist/server/modules/provider/provider-controller.js.map +1 -1
  54. package/dist/server/modules/provider/provider-discovery-helper-client.d.ts +25 -0
  55. package/dist/server/modules/provider/provider-discovery-helper-client.js +114 -0
  56. package/dist/server/modules/provider/provider-discovery-helper-client.js.map +1 -0
  57. package/dist/server/modules/provider/provider-discovery-helper-process.d.ts +1 -0
  58. package/dist/server/modules/provider/provider-discovery-helper-process.js +296 -0
  59. package/dist/server/modules/provider/provider-discovery-helper-process.js.map +1 -0
  60. package/dist/server/modules/sessions/claude-runtime-helper-client.d.ts +28 -0
  61. package/dist/server/modules/sessions/claude-runtime-helper-client.js +221 -0
  62. package/dist/server/modules/sessions/claude-runtime-helper-client.js.map +1 -0
  63. package/dist/server/modules/sessions/claude-runtime-helper-process.d.ts +1 -0
  64. package/dist/server/modules/sessions/claude-runtime-helper-process.js +146 -0
  65. package/dist/server/modules/sessions/claude-runtime-helper-process.js.map +1 -0
  66. package/dist/server/modules/sessions/codex-app-server-helper-client.d.ts +16 -0
  67. package/dist/server/modules/sessions/codex-app-server-helper-client.js +237 -0
  68. package/dist/server/modules/sessions/codex-app-server-helper-client.js.map +1 -0
  69. package/dist/server/modules/sessions/codex-app-server-helper-process.d.ts +1 -0
  70. package/dist/server/modules/sessions/codex-app-server-helper-process.js +484 -0
  71. package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -0
  72. package/dist/server/modules/sessions/session-activity-authority-service.d.ts +52 -0
  73. package/dist/server/modules/sessions/session-activity-authority-service.js +377 -0
  74. package/dist/server/modules/sessions/session-activity-authority-service.js.map +1 -0
  75. package/dist/server/modules/sessions/session-activity-inspector.js +80 -40
  76. package/dist/server/modules/sessions/session-activity-inspector.js.map +1 -1
  77. package/dist/server/modules/sessions/session-controller.d.ts +15 -1
  78. package/dist/server/modules/sessions/session-controller.js +14 -1
  79. package/dist/server/modules/sessions/session-controller.js.map +1 -1
  80. package/dist/server/modules/sessions/session-history-service.d.ts +8 -3
  81. package/dist/server/modules/sessions/session-history-service.js +303 -64
  82. package/dist/server/modules/sessions/session-history-service.js.map +1 -1
  83. package/dist/server/modules/sessions/session-live-runtime-service.d.ts +40 -4
  84. package/dist/server/modules/sessions/session-live-runtime-service.js +334 -44
  85. package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
  86. package/dist/server/modules/sessions/session-permission-request-service.d.ts +175 -0
  87. package/dist/server/modules/sessions/session-permission-request-service.js +1615 -0
  88. package/dist/server/modules/sessions/session-permission-request-service.js.map +1 -0
  89. package/dist/server/modules/sessions/session-provider-error-mapper.js +14 -0
  90. package/dist/server/modules/sessions/session-provider-error-mapper.js.map +1 -1
  91. package/dist/server/modules/terminal/command-template-service.d.ts +2 -2
  92. package/dist/server/modules/terminal/command-template-service.js +3 -3
  93. package/dist/server/modules/terminal/command-template-service.js.map +1 -1
  94. package/dist/server/modules/terminal/runtime/adapters/conpty-control-helper-client.d.ts +24 -0
  95. package/dist/server/modules/terminal/runtime/adapters/conpty-control-helper-client.js +104 -0
  96. package/dist/server/modules/terminal/runtime/adapters/conpty-control-helper-client.js.map +1 -0
  97. package/dist/server/modules/terminal/runtime/adapters/conpty-control-helper-process.d.ts +1 -0
  98. package/dist/server/modules/terminal/runtime/adapters/conpty-control-helper-process.js +96 -0
  99. package/dist/server/modules/terminal/runtime/adapters/conpty-control-helper-process.js.map +1 -0
  100. package/dist/server/modules/terminal/runtime/adapters/conpty-runtime-adapter.d.ts +37 -0
  101. package/dist/server/modules/terminal/runtime/adapters/conpty-runtime-adapter.js +123 -0
  102. package/dist/server/modules/terminal/runtime/adapters/conpty-runtime-adapter.js.map +1 -0
  103. package/dist/server/modules/terminal/runtime/adapters/embedded-pty-runtime-adapter.d.ts +12 -5
  104. package/dist/server/modules/terminal/runtime/adapters/embedded-pty-runtime-adapter.js +44 -4
  105. package/dist/server/modules/terminal/runtime/adapters/embedded-pty-runtime-adapter.js.map +1 -1
  106. package/dist/server/modules/terminal/runtime/adapters/tmux-helper-client.d.ts +14 -0
  107. package/dist/server/modules/terminal/runtime/adapters/tmux-helper-client.js +105 -0
  108. package/dist/server/modules/terminal/runtime/adapters/tmux-helper-client.js.map +1 -0
  109. package/dist/server/modules/terminal/runtime/adapters/tmux-helper-process.d.ts +1 -0
  110. package/dist/server/modules/terminal/runtime/adapters/tmux-helper-process.js +67 -0
  111. package/dist/server/modules/terminal/runtime/adapters/tmux-helper-process.js.map +1 -0
  112. package/dist/server/modules/terminal/runtime/adapters/tmux-runtime-adapter.d.ts +8 -12
  113. package/dist/server/modules/terminal/runtime/adapters/tmux-runtime-adapter.js +112 -21
  114. package/dist/server/modules/terminal/runtime/adapters/tmux-runtime-adapter.js.map +1 -1
  115. package/dist/server/modules/terminal/runtime/conpty-runtime-shared.d.ts +25 -0
  116. package/dist/server/modules/terminal/runtime/conpty-runtime-shared.js +124 -0
  117. package/dist/server/modules/terminal/runtime/conpty-runtime-shared.js.map +1 -0
  118. package/dist/server/modules/terminal/runtime/conpty-session-agent-process.d.ts +1 -0
  119. package/dist/server/modules/terminal/runtime/conpty-session-agent-process.js +205 -0
  120. package/dist/server/modules/terminal/runtime/conpty-session-agent-process.js.map +1 -0
  121. package/dist/server/modules/terminal/runtime/conpty-session-attach-client.d.ts +1 -0
  122. package/dist/server/modules/terminal/runtime/conpty-session-attach-client.js +108 -0
  123. package/dist/server/modules/terminal/runtime/conpty-session-attach-client.js.map +1 -0
  124. package/dist/server/modules/terminal/runtime/conpty-session-control-client.d.ts +1 -0
  125. package/dist/server/modules/terminal/runtime/conpty-session-control-client.js +90 -0
  126. package/dist/server/modules/terminal/runtime/conpty-session-control-client.js.map +1 -0
  127. package/dist/server/modules/terminal/runtime/pty-broker-agent-process.d.ts +1 -0
  128. package/dist/server/modules/terminal/runtime/pty-broker-agent-process.js +179 -0
  129. package/dist/server/modules/terminal/runtime/pty-broker-agent-process.js.map +1 -0
  130. package/dist/server/modules/terminal/runtime/pty-broker-client.d.ts +29 -0
  131. package/dist/server/modules/terminal/runtime/pty-broker-client.js +169 -0
  132. package/dist/server/modules/terminal/runtime/pty-broker-client.js.map +1 -0
  133. package/dist/server/modules/terminal/runtime/pty-broker-shared.d.ts +22 -0
  134. package/dist/server/modules/terminal/runtime/pty-broker-shared.js +123 -0
  135. package/dist/server/modules/terminal/runtime/pty-broker-shared.js.map +1 -0
  136. package/dist/server/modules/terminal/runtime/pty-host-attachment-manager.d.ts +1 -0
  137. package/dist/server/modules/terminal/runtime/pty-host-attachment-manager.js +11 -1
  138. package/dist/server/modules/terminal/runtime/pty-host-attachment-manager.js.map +1 -1
  139. package/dist/server/modules/terminal/runtime/terminal-log-file-store.d.ts +1 -0
  140. package/dist/server/modules/terminal/runtime/terminal-log-file-store.js +7 -1
  141. package/dist/server/modules/terminal/runtime/terminal-log-file-store.js.map +1 -1
  142. package/dist/server/modules/terminal/runtime/terminal-log-spooler.js +3 -2
  143. package/dist/server/modules/terminal/runtime/terminal-log-spooler.js.map +1 -1
  144. package/dist/server/modules/terminal/runtime/terminal-runtime-adapter.d.ts +5 -3
  145. package/dist/server/modules/terminal/runtime/terminal-runtime-manager.d.ts +11 -5
  146. package/dist/server/modules/terminal/runtime/terminal-runtime-manager.js +110 -13
  147. package/dist/server/modules/terminal/runtime/terminal-runtime-manager.js.map +1 -1
  148. package/dist/server/modules/terminal/terminal-controller.js +7 -7
  149. package/dist/server/modules/terminal/terminal-controller.js.map +1 -1
  150. package/dist/server/modules/terminal/terminal-service.d.ts +30 -14
  151. package/dist/server/modules/terminal/terminal-service.js +260 -51
  152. package/dist/server/modules/terminal/terminal-service.js.map +1 -1
  153. package/dist/server/modules/terminal/terminal-shell.d.ts +4 -0
  154. package/dist/server/modules/terminal/terminal-shell.js +165 -18
  155. package/dist/server/modules/terminal/terminal-shell.js.map +1 -1
  156. package/dist/server/modules/workbench/workspace-file-watcher.d.ts +30 -0
  157. package/dist/server/modules/workbench/workspace-file-watcher.js +137 -0
  158. package/dist/server/modules/workbench/workspace-file-watcher.js.map +1 -0
  159. package/dist/server/modules/workbench/workspace-panel-snapshot-service.js +43 -7
  160. package/dist/server/modules/workbench/workspace-panel-snapshot-service.js.map +1 -1
  161. package/dist/server/routes/git.js +1 -0
  162. package/dist/server/routes/git.js.map +1 -1
  163. package/dist/server/routes/preferences.d.ts +2 -1
  164. package/dist/server/routes/preferences.js +3 -1
  165. package/dist/server/routes/preferences.js.map +1 -1
  166. package/dist/server/routes/sessions.js +2 -0
  167. package/dist/server/routes/sessions.js.map +1 -1
  168. package/dist/server/server/create-server.d.ts +4 -0
  169. package/dist/server/server/create-server.js +22 -5
  170. package/dist/server/server/create-server.js.map +1 -1
  171. package/dist/server/shared/utils/command-launch.d.ts +6 -0
  172. package/dist/server/shared/utils/command-launch.js +39 -0
  173. package/dist/server/shared/utils/command-launch.js.map +1 -0
  174. package/dist/server/shared/utils/perf-log.d.ts +1 -0
  175. package/dist/server/shared/utils/perf-log.js +8 -2
  176. package/dist/server/shared/utils/perf-log.js.map +1 -1
  177. package/dist/server/shared/utils/permission-debug-log.d.ts +2 -0
  178. package/dist/server/shared/utils/permission-debug-log.js +40 -0
  179. package/dist/server/shared/utils/permission-debug-log.js.map +1 -0
  180. package/dist/server/shared/utils/terminal-debug-log.d.ts +4 -0
  181. package/dist/server/shared/utils/terminal-debug-log.js +71 -0
  182. package/dist/server/shared/utils/terminal-debug-log.js.map +1 -0
  183. package/dist/server/storage/repositories/user-preference-profile-repository.d.ts +8 -0
  184. package/dist/server/storage/repositories/user-preference-profile-repository.js +46 -0
  185. package/dist/server/storage/repositories/user-preference-profile-repository.js.map +1 -0
  186. package/dist/server/storage/sqlite/schema.sql +13 -0
  187. package/dist/server/types/domain.d.ts +28 -1
  188. package/dist/server/ws/terminal-ws-hub.d.ts +2 -0
  189. package/dist/server/ws/terminal-ws-hub.js +42 -5
  190. package/dist/server/ws/terminal-ws-hub.js.map +1 -1
  191. package/dist/server/ws/workbench-ws-hub.d.ts +9 -1
  192. package/dist/server/ws/workbench-ws-hub.js +132 -21
  193. package/dist/server/ws/workbench-ws-hub.js.map +1 -1
  194. package/dist/server/ws/ws-server.d.ts +22 -1
  195. package/dist/server/ws/ws-server.js +134 -46
  196. package/dist/server/ws/ws-server.js.map +1 -1
  197. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.d.ts +4 -1
  198. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js +107 -6
  199. package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js.map +1 -1
  200. package/node_modules/@codingns/session-sync-core/dist/patch-builder.d.ts +30 -0
  201. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js +103 -0
  202. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js.map +1 -0
  203. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +1 -1
  204. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +38 -6
  205. package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -1
  206. package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +1 -1
  207. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +1 -1
  208. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
  209. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.d.ts +1 -0
  210. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js +8 -0
  211. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js.map +1 -0
  212. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js +87 -7
  213. package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js.map +1 -1
  214. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.d.ts +1 -1
  215. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +8 -4
  216. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -1
  217. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.d.ts +1 -0
  218. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js +5 -0
  219. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js.map +1 -1
  220. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.d.ts +5 -0
  221. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js +114 -6
  222. package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js.map +1 -1
  223. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +23 -0
  224. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +721 -18
  225. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
  226. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.d.ts +3 -0
  227. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js +106 -23
  228. package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js.map +1 -1
  229. package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.d.ts +1 -0
  230. package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js +3 -0
  231. package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js.map +1 -1
  232. package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +1 -0
  233. package/node_modules/@codingns/session-sync-core/dist/services.d.ts +1 -1
  234. package/node_modules/@codingns/session-sync-core/dist/services.js +2 -2
  235. package/node_modules/@codingns/session-sync-core/dist/services.js.map +1 -1
  236. package/node_modules/@codingns/session-sync-core/dist/types.d.ts +1 -1
  237. package/package.json +6 -2
  238. package/scripts/postinstall.mjs +218 -0
  239. package/dist/public/assets/TerminalPage-Dj_VDew3.js +0 -54
  240. package/dist/public/assets/index-C1GZV2wq.js +0 -106
  241. package/dist/public/assets/index-DU7f8NaZ.css +0 -1
@@ -1,106 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPage-Dj_VDew3.js","assets/TerminalPage-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
2
- var C0=Object.defineProperty;var j0=(e,t,n)=>t in e?C0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ze=(e,t,n)=>j0(e,typeof t!="symbol"?t+"":t,n);function ob(e,t){for(var n=0;n<t.length;n++){const s=t[n];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in e)){const c=Object.getOwnPropertyDescriptor(s,o);c&&Object.defineProperty(e,o,c.get?c:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const l of c.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function To(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bd={exports:{}},Ka={},xd={exports:{}},kt={};/**
3
- * @license React
4
- * react.production.min.js
5
- *
6
- * Copyright (c) Facebook, Inc. and its affiliates.
7
- *
8
- * This source code is licensed under the MIT license found in the
9
- * LICENSE file in the root directory of this source tree.
10
- */var jg;function N0(){if(jg)return kt;jg=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),l=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.iterator;function b($){return $===null||typeof $!="object"?null:($=g&&$[g]||$["@@iterator"],typeof $=="function"?$:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,S={};function j($,se,P){this.props=$,this.context=se,this.refs=S,this.updater=P||x}j.prototype.isReactComponent={},j.prototype.setState=function($,se){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,se,"setState")},j.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function M(){}M.prototype=j.prototype;function A($,se,P){this.props=$,this.context=se,this.refs=S,this.updater=P||x}var E=A.prototype=new M;E.constructor=A,C(E,j.prototype),E.isPureReactComponent=!0;var Z=Array.isArray,Y=Object.prototype.hasOwnProperty,B={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function _($,se,P){var be,ke={},ve=null,Ae=null;if(se!=null)for(be in se.ref!==void 0&&(Ae=se.ref),se.key!==void 0&&(ve=""+se.key),se)Y.call(se,be)&&!I.hasOwnProperty(be)&&(ke[be]=se[be]);var Be=arguments.length-2;if(Be===1)ke.children=P;else if(1<Be){for(var qe=Array(Be),nt=0;nt<Be;nt++)qe[nt]=arguments[nt+2];ke.children=qe}if($&&$.defaultProps)for(be in Be=$.defaultProps,Be)ke[be]===void 0&&(ke[be]=Be[be]);return{$$typeof:e,type:$,key:ve,ref:Ae,props:ke,_owner:B.current}}function F($,se){return{$$typeof:e,type:$.type,key:se,ref:$.ref,props:$.props,_owner:$._owner}}function R($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function W($){var se={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(P){return se[P]})}var J=/\/+/g;function re($,se){return typeof $=="object"&&$!==null&&$.key!=null?W(""+$.key):se.toString(36)}function le($,se,P,be,ke){var ve=typeof $;(ve==="undefined"||ve==="boolean")&&($=null);var Ae=!1;if($===null)Ae=!0;else switch(ve){case"string":case"number":Ae=!0;break;case"object":switch($.$$typeof){case e:case t:Ae=!0}}if(Ae)return Ae=$,ke=ke(Ae),$=be===""?"."+re(Ae,0):be,Z(ke)?(P="",$!=null&&(P=$.replace(J,"$&/")+"/"),le(ke,se,P,"",function(nt){return nt})):ke!=null&&(R(ke)&&(ke=F(ke,P+(!ke.key||Ae&&Ae.key===ke.key?"":(""+ke.key).replace(J,"$&/")+"/")+$)),se.push(ke)),1;if(Ae=0,be=be===""?".":be+":",Z($))for(var Be=0;Be<$.length;Be++){ve=$[Be];var qe=be+re(ve,Be);Ae+=le(ve,se,P,qe,ke)}else if(qe=b($),typeof qe=="function")for($=qe.call($),Be=0;!(ve=$.next()).done;)ve=ve.value,qe=be+re(ve,Be++),Ae+=le(ve,se,P,qe,ke);else if(ve==="object")throw se=String($),Error("Objects are not valid as a React child (found: "+(se==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":se)+"). If you meant to render a collection of children, use an array instead.");return Ae}function ie($,se,P){if($==null)return $;var be=[],ke=0;return le($,be,"","",function(ve){return se.call(P,ve,ke++)}),be}function xe($){if($._status===-1){var se=$._result;se=se(),se.then(function(P){($._status===0||$._status===-1)&&($._status=1,$._result=P)},function(P){($._status===0||$._status===-1)&&($._status=2,$._result=P)}),$._status===-1&&($._status=0,$._result=se)}if($._status===1)return $._result.default;throw $._result}var q={current:null},K={transition:null},me={ReactCurrentDispatcher:q,ReactCurrentBatchConfig:K,ReactCurrentOwner:B};function L(){throw Error("act(...) is not supported in production builds of React.")}return kt.Children={map:ie,forEach:function($,se,P){ie($,function(){se.apply(this,arguments)},P)},count:function($){var se=0;return ie($,function(){se++}),se},toArray:function($){return ie($,function(se){return se})||[]},only:function($){if(!R($))throw Error("React.Children.only expected to receive a single React element child.");return $}},kt.Component=j,kt.Fragment=n,kt.Profiler=o,kt.PureComponent=A,kt.StrictMode=s,kt.Suspense=p,kt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=me,kt.act=L,kt.cloneElement=function($,se,P){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var be=C({},$.props),ke=$.key,ve=$.ref,Ae=$._owner;if(se!=null){if(se.ref!==void 0&&(ve=se.ref,Ae=B.current),se.key!==void 0&&(ke=""+se.key),$.type&&$.type.defaultProps)var Be=$.type.defaultProps;for(qe in se)Y.call(se,qe)&&!I.hasOwnProperty(qe)&&(be[qe]=se[qe]===void 0&&Be!==void 0?Be[qe]:se[qe])}var qe=arguments.length-2;if(qe===1)be.children=P;else if(1<qe){Be=Array(qe);for(var nt=0;nt<qe;nt++)Be[nt]=arguments[nt+2];be.children=Be}return{$$typeof:e,type:$.type,key:ke,ref:ve,props:be,_owner:Ae}},kt.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:c,_context:$},$.Consumer=$},kt.createElement=_,kt.createFactory=function($){var se=_.bind(null,$);return se.type=$,se},kt.createRef=function(){return{current:null}},kt.forwardRef=function($){return{$$typeof:d,render:$}},kt.isValidElement=R,kt.lazy=function($){return{$$typeof:y,_payload:{_status:-1,_result:$},_init:xe}},kt.memo=function($,se){return{$$typeof:m,type:$,compare:se===void 0?null:se}},kt.startTransition=function($){var se=K.transition;K.transition={};try{$()}finally{K.transition=se}},kt.unstable_act=L,kt.useCallback=function($,se){return q.current.useCallback($,se)},kt.useContext=function($){return q.current.useContext($)},kt.useDebugValue=function(){},kt.useDeferredValue=function($){return q.current.useDeferredValue($)},kt.useEffect=function($,se){return q.current.useEffect($,se)},kt.useId=function(){return q.current.useId()},kt.useImperativeHandle=function($,se,P){return q.current.useImperativeHandle($,se,P)},kt.useInsertionEffect=function($,se){return q.current.useInsertionEffect($,se)},kt.useLayoutEffect=function($,se){return q.current.useLayoutEffect($,se)},kt.useMemo=function($,se){return q.current.useMemo($,se)},kt.useReducer=function($,se,P){return q.current.useReducer($,se,P)},kt.useRef=function($){return q.current.useRef($)},kt.useState=function($){return q.current.useState($)},kt.useSyncExternalStore=function($,se,P){return q.current.useSyncExternalStore($,se,P)},kt.useTransition=function(){return q.current.useTransition()},kt.version="18.3.1",kt}var Ng;function lf(){return Ng||(Ng=1,xd.exports=N0()),xd.exports}/**
11
- * @license React
12
- * react-jsx-runtime.production.min.js
13
- *
14
- * Copyright (c) Facebook, Inc. and its affiliates.
15
- *
16
- * This source code is licensed under the MIT license found in the
17
- * LICENSE file in the root directory of this source tree.
18
- */var Tg;function T0(){if(Tg)return Ka;Tg=1;var e=lf(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),s=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(d,p,m){var y,g={},b=null,x=null;m!==void 0&&(b=""+m),p.key!==void 0&&(b=""+p.key),p.ref!==void 0&&(x=p.ref);for(y in p)s.call(p,y)&&!c.hasOwnProperty(y)&&(g[y]=p[y]);if(d&&d.defaultProps)for(y in p=d.defaultProps,p)g[y]===void 0&&(g[y]=p[y]);return{$$typeof:t,type:d,key:b,ref:x,props:g,_owner:o.current}}return Ka.Fragment=n,Ka.jsx=l,Ka.jsxs=l,Ka}var Pg;function P0(){return Pg||(Pg=1,bd.exports=T0()),bd.exports}var i=P0(),Ul={},kd={exports:{}},nr={},Sd={exports:{}},Cd={};/**
19
- * @license React
20
- * scheduler.production.min.js
21
- *
22
- * Copyright (c) Facebook, Inc. and its affiliates.
23
- *
24
- * This source code is licensed under the MIT license found in the
25
- * LICENSE file in the root directory of this source tree.
26
- */var Eg;function E0(){return Eg||(Eg=1,(function(e){function t(K,me){var L=K.length;K.push(me);e:for(;0<L;){var $=L-1>>>1,se=K[$];if(0<o(se,me))K[$]=me,K[L]=se,L=$;else break e}}function n(K){return K.length===0?null:K[0]}function s(K){if(K.length===0)return null;var me=K[0],L=K.pop();if(L!==me){K[0]=L;e:for(var $=0,se=K.length,P=se>>>1;$<P;){var be=2*($+1)-1,ke=K[be],ve=be+1,Ae=K[ve];if(0>o(ke,L))ve<se&&0>o(Ae,ke)?(K[$]=Ae,K[ve]=L,$=ve):(K[$]=ke,K[be]=L,$=be);else if(ve<se&&0>o(Ae,L))K[$]=Ae,K[ve]=L,$=ve;else break e}}return me}function o(K,me){var L=K.sortIndex-me.sortIndex;return L!==0?L:K.id-me.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var l=Date,d=l.now();e.unstable_now=function(){return l.now()-d}}var p=[],m=[],y=1,g=null,b=3,x=!1,C=!1,S=!1,j=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,A=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function E(K){for(var me=n(m);me!==null;){if(me.callback===null)s(m);else if(me.startTime<=K)s(m),me.sortIndex=me.expirationTime,t(p,me);else break;me=n(m)}}function Z(K){if(S=!1,E(K),!C)if(n(p)!==null)C=!0,xe(Y);else{var me=n(m);me!==null&&q(Z,me.startTime-K)}}function Y(K,me){C=!1,S&&(S=!1,M(_),_=-1),x=!0;var L=b;try{for(E(me),g=n(p);g!==null&&(!(g.expirationTime>me)||K&&!W());){var $=g.callback;if(typeof $=="function"){g.callback=null,b=g.priorityLevel;var se=$(g.expirationTime<=me);me=e.unstable_now(),typeof se=="function"?g.callback=se:g===n(p)&&s(p),E(me)}else s(p);g=n(p)}if(g!==null)var P=!0;else{var be=n(m);be!==null&&q(Z,be.startTime-me),P=!1}return P}finally{g=null,b=L,x=!1}}var B=!1,I=null,_=-1,F=5,R=-1;function W(){return!(e.unstable_now()-R<F)}function J(){if(I!==null){var K=e.unstable_now();R=K;var me=!0;try{me=I(!0,K)}finally{me?re():(B=!1,I=null)}}else B=!1}var re;if(typeof A=="function")re=function(){A(J)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,ie=le.port2;le.port1.onmessage=J,re=function(){ie.postMessage(null)}}else re=function(){j(J,0)};function xe(K){I=K,B||(B=!0,re())}function q(K,me){_=j(function(){K(e.unstable_now())},me)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(K){K.callback=null},e.unstable_continueExecution=function(){C||x||(C=!0,xe(Y))},e.unstable_forceFrameRate=function(K){0>K||125<K?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<K?Math.floor(1e3/K):5},e.unstable_getCurrentPriorityLevel=function(){return b},e.unstable_getFirstCallbackNode=function(){return n(p)},e.unstable_next=function(K){switch(b){case 1:case 2:case 3:var me=3;break;default:me=b}var L=b;b=me;try{return K()}finally{b=L}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(K,me){switch(K){case 1:case 2:case 3:case 4:case 5:break;default:K=3}var L=b;b=K;try{return me()}finally{b=L}},e.unstable_scheduleCallback=function(K,me,L){var $=e.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?$+L:$):L=$,K){case 1:var se=-1;break;case 2:se=250;break;case 5:se=1073741823;break;case 4:se=1e4;break;default:se=5e3}return se=L+se,K={id:y++,callback:me,priorityLevel:K,startTime:L,expirationTime:se,sortIndex:-1},L>$?(K.sortIndex=L,t(m,K),n(p)===null&&K===n(m)&&(S?(M(_),_=-1):S=!0,q(Z,L-$))):(K.sortIndex=se,t(p,K),C||x||(C=!0,xe(Y))),K},e.unstable_shouldYield=W,e.unstable_wrapCallback=function(K){var me=b;return function(){var L=b;b=me;try{return K.apply(this,arguments)}finally{b=L}}}})(Cd)),Cd}var Rg;function R0(){return Rg||(Rg=1,Sd.exports=E0()),Sd.exports}/**
27
- * @license React
28
- * react-dom.production.min.js
29
- *
30
- * Copyright (c) Facebook, Inc. and its affiliates.
31
- *
32
- * This source code is licensed under the MIT license found in the
33
- * LICENSE file in the root directory of this source tree.
34
- */var Mg;function M0(){if(Mg)return nr;Mg=1;var e=lf(),t=R0();function n(r){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+r,u=1;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u]);return"Minified React error #"+r+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=new Set,o={};function c(r,a){l(r,a),l(r+"Capture",a)}function l(r,a){for(o[r]=a,r=0;r<a.length;r++)s.add(a[r])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,y={},g={};function b(r){return p.call(g,r)?!0:p.call(y,r)?!1:m.test(r)?g[r]=!0:(y[r]=!0,!1)}function x(r,a,u,f){if(u!==null&&u.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return f?!1:u!==null?!u.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function C(r,a,u,f){if(a===null||typeof a>"u"||x(r,a,u,f))return!0;if(f)return!1;if(u!==null)switch(u.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function S(r,a,u,f,v,k,N){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=f,this.attributeNamespace=v,this.mustUseProperty=u,this.propertyName=r,this.type=a,this.sanitizeURL=k,this.removeEmptyString=N}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){j[r]=new S(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var a=r[0];j[a]=new S(a,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){j[r]=new S(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){j[r]=new S(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){j[r]=new S(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){j[r]=new S(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){j[r]=new S(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){j[r]=new S(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){j[r]=new S(r,5,!1,r.toLowerCase(),null,!1,!1)});var M=/[\-:]([a-z])/g;function A(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var a=r.replace(M,A);j[a]=new S(a,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var a=r.replace(M,A);j[a]=new S(a,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var a=r.replace(M,A);j[a]=new S(a,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){j[r]=new S(r,1,!1,r.toLowerCase(),null,!1,!1)}),j.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){j[r]=new S(r,1,!1,r.toLowerCase(),null,!0,!0)});function E(r,a,u,f){var v=j.hasOwnProperty(a)?j[a]:null;(v!==null?v.type!==0:f||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(C(a,u,v,f)&&(u=null),f||v===null?b(a)&&(u===null?r.removeAttribute(a):r.setAttribute(a,""+u)):v.mustUseProperty?r[v.propertyName]=u===null?v.type===3?!1:"":u:(a=v.attributeName,f=v.attributeNamespace,u===null?r.removeAttribute(a):(v=v.type,u=v===3||v===4&&u===!0?"":""+u,f?r.setAttributeNS(f,a,u):r.setAttribute(a,u))))}var Z=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Y=Symbol.for("react.element"),B=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),R=Symbol.for("react.provider"),W=Symbol.for("react.context"),J=Symbol.for("react.forward_ref"),re=Symbol.for("react.suspense"),le=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),xe=Symbol.for("react.lazy"),q=Symbol.for("react.offscreen"),K=Symbol.iterator;function me(r){return r===null||typeof r!="object"?null:(r=K&&r[K]||r["@@iterator"],typeof r=="function"?r:null)}var L=Object.assign,$;function se(r){if($===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);$=a&&a[1]||""}return`
35
- `+$+r}var P=!1;function be(r,a){if(!r||P)return"";P=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(ue){var f=ue}Reflect.construct(r,[],a)}else{try{a.call()}catch(ue){f=ue}r.call(a.prototype)}else{try{throw Error()}catch(ue){f=ue}r()}}catch(ue){if(ue&&f&&typeof ue.stack=="string"){for(var v=ue.stack.split(`
36
- `),k=f.stack.split(`
37
- `),N=v.length-1,z=k.length-1;1<=N&&0<=z&&v[N]!==k[z];)z--;for(;1<=N&&0<=z;N--,z--)if(v[N]!==k[z]){if(N!==1||z!==1)do if(N--,z--,0>z||v[N]!==k[z]){var V=`
38
- `+v[N].replace(" at new "," at ");return r.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",r.displayName)),V}while(1<=N&&0<=z);break}}}finally{P=!1,Error.prepareStackTrace=u}return(r=r?r.displayName||r.name:"")?se(r):""}function ke(r){switch(r.tag){case 5:return se(r.type);case 16:return se("Lazy");case 13:return se("Suspense");case 19:return se("SuspenseList");case 0:case 2:case 15:return r=be(r.type,!1),r;case 11:return r=be(r.type.render,!1),r;case 1:return r=be(r.type,!0),r;default:return""}}function ve(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case I:return"Fragment";case B:return"Portal";case F:return"Profiler";case _:return"StrictMode";case re:return"Suspense";case le:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case W:return(r.displayName||"Context")+".Consumer";case R:return(r._context.displayName||"Context")+".Provider";case J:var a=r.render;return r=r.displayName,r||(r=a.displayName||a.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case ie:return a=r.displayName||null,a!==null?a:ve(r.type)||"Memo";case xe:a=r._payload,r=r._init;try{return ve(r(a))}catch{}}return null}function Ae(r){var a=r.type;switch(r.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=a.render,r=r.displayName||r.name||"",a.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ve(a);case 8:return a===_?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function Be(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function qe(r){var a=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function nt(r){var a=qe(r)?"checked":"value",u=Object.getOwnPropertyDescriptor(r.constructor.prototype,a),f=""+r[a];if(!r.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var v=u.get,k=u.set;return Object.defineProperty(r,a,{configurable:!0,get:function(){return v.call(this)},set:function(N){f=""+N,k.call(this,N)}}),Object.defineProperty(r,a,{enumerable:u.enumerable}),{getValue:function(){return f},setValue:function(N){f=""+N},stopTracking:function(){r._valueTracker=null,delete r[a]}}}}function wt(r){r._valueTracker||(r._valueTracker=nt(r))}function ze(r){if(!r)return!1;var a=r._valueTracker;if(!a)return!0;var u=a.getValue(),f="";return r&&(f=qe(r)?r.checked?"true":"false":r.value),r=f,r!==u?(a.setValue(r),!0):!1}function Ot(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Je(r,a){var u=a.checked;return L({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??r._wrapperState.initialChecked})}function _t(r,a){var u=a.defaultValue==null?"":a.defaultValue,f=a.checked!=null?a.checked:a.defaultChecked;u=Be(a.value!=null?a.value:u),r._wrapperState={initialChecked:f,initialValue:u,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function bt(r,a){a=a.checked,a!=null&&E(r,"checked",a,!1)}function et(r,a){bt(r,a);var u=Be(a.value),f=a.type;if(u!=null)f==="number"?(u===0&&r.value===""||r.value!=u)&&(r.value=""+u):r.value!==""+u&&(r.value=""+u);else if(f==="submit"||f==="reset"){r.removeAttribute("value");return}a.hasOwnProperty("value")?Nt(r,a.type,u):a.hasOwnProperty("defaultValue")&&Nt(r,a.type,Be(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(r.defaultChecked=!!a.defaultChecked)}function pt(r,a,u){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var f=a.type;if(!(f!=="submit"&&f!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+r._wrapperState.initialValue,u||a===r.value||(r.value=a),r.defaultValue=a}u=r.name,u!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,u!==""&&(r.name=u)}function Nt(r,a,u){(a!=="number"||Ot(r.ownerDocument)!==r)&&(u==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+u&&(r.defaultValue=""+u))}var Bt=Array.isArray;function Rt(r,a,u,f){if(r=r.options,a){a={};for(var v=0;v<u.length;v++)a["$"+u[v]]=!0;for(u=0;u<r.length;u++)v=a.hasOwnProperty("$"+r[u].value),r[u].selected!==v&&(r[u].selected=v),v&&f&&(r[u].defaultSelected=!0)}else{for(u=""+Be(u),a=null,v=0;v<r.length;v++){if(r[v].value===u){r[v].selected=!0,f&&(r[v].defaultSelected=!0);return}a!==null||r[v].disabled||(a=r[v])}a!==null&&(a.selected=!0)}}function ne(r,a){if(a.dangerouslySetInnerHTML!=null)throw Error(n(91));return L({},a,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function He(r,a){var u=a.value;if(u==null){if(u=a.children,a=a.defaultValue,u!=null){if(a!=null)throw Error(n(92));if(Bt(u)){if(1<u.length)throw Error(n(93));u=u[0]}a=u}a==null&&(a=""),u=a}r._wrapperState={initialValue:Be(u)}}function tt(r,a){var u=Be(a.value),f=Be(a.defaultValue);u!=null&&(u=""+u,u!==r.value&&(r.value=u),a.defaultValue==null&&r.defaultValue!==u&&(r.defaultValue=u)),f!=null&&(r.defaultValue=""+f)}function Tt(r){var a=r.textContent;a===r._wrapperState.initialValue&&a!==""&&a!==null&&(r.value=a)}function ce(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Se(r,a){return r==null||r==="http://www.w3.org/1999/xhtml"?ce(a):r==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var Le,de=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,u,f,v){MSApp.execUnsafeLocalFunction(function(){return r(a,u,f,v)})}:r})(function(r,a){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=a;else{for(Le=Le||document.createElement("div"),Le.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=Le.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;a.firstChild;)r.appendChild(a.firstChild)}});function Ne(r,a){if(a){var u=r.firstChild;if(u&&u===r.lastChild&&u.nodeType===3){u.nodeValue=a;return}}r.textContent=a}var ut={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Wt=["Webkit","ms","Moz","O"];Object.keys(ut).forEach(function(r){Wt.forEach(function(a){a=a+r.charAt(0).toUpperCase()+r.substring(1),ut[a]=ut[r]})});function dt(r,a,u){return a==null||typeof a=="boolean"||a===""?"":u||typeof a!="number"||a===0||ut.hasOwnProperty(r)&&ut[r]?(""+a).trim():a+"px"}function xt(r,a){r=r.style;for(var u in a)if(a.hasOwnProperty(u)){var f=u.indexOf("--")===0,v=dt(u,a[u],f);u==="float"&&(u="cssFloat"),f?r.setProperty(u,v):r[u]=v}}var mt=L({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ct(r,a){if(a){if(mt[r]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(n(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(n(61))}if(a.style!=null&&typeof a.style!="object")throw Error(n(62))}}function Ht(r,a){if(r.indexOf("-")===-1)return typeof a.is=="string";switch(r){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var St=null;function Pt(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Ft=null,At=null,Yt=null;function Gt(r){if(r=La(r)){if(typeof Ft!="function")throw Error(n(280));var a=r.stateNode;a&&(a=tl(a),Ft(r.stateNode,r.type,a))}}function nn(r){At?Yt?Yt.push(r):Yt=[r]:At=r}function vn(){if(At){var r=At,a=Yt;if(Yt=At=null,Gt(r),a)for(r=0;r<a.length;r++)Gt(a[r])}}function Pn(r,a){return r(a)}function pn(){}var an=!1;function An(r,a,u){if(an)return r(a,u);an=!0;try{return Pn(r,a,u)}finally{an=!1,(At!==null||Yt!==null)&&(pn(),vn())}}function D(r,a){var u=r.stateNode;if(u===null)return null;var f=tl(u);if(f===null)return null;u=f[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(r=r.type,f=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!f;break e;default:r=!1}if(r)return null;if(u&&typeof u!="function")throw Error(n(231,a,typeof u));return u}var T=!1;if(d)try{var O={};Object.defineProperty(O,"passive",{get:function(){T=!0}}),window.addEventListener("test",O,O),window.removeEventListener("test",O,O)}catch{T=!1}function H(r,a,u,f,v,k,N,z,V){var ue=Array.prototype.slice.call(arguments,3);try{a.apply(u,ue)}catch(je){this.onError(je)}}var oe=!1,ye=null,Re=!1,Ge=null,Ie={onError:function(r){oe=!0,ye=r}};function Oe(r,a,u,f,v,k,N,z,V){oe=!1,ye=null,H.apply(Ie,arguments)}function Me(r,a,u,f,v,k,N,z,V){if(Oe.apply(this,arguments),oe){if(oe){var ue=ye;oe=!1,ye=null}else throw Error(n(198));Re||(Re=!0,Ge=ue)}}function U(r){var a=r,u=r;if(r.alternate)for(;a.return;)a=a.return;else{r=a;do a=r,(a.flags&4098)!==0&&(u=a.return),r=a.return;while(r)}return a.tag===3?u:null}function fe(r){if(r.tag===13){var a=r.memoizedState;if(a===null&&(r=r.alternate,r!==null&&(a=r.memoizedState)),a!==null)return a.dehydrated}return null}function ee(r){if(U(r)!==r)throw Error(n(188))}function _e(r){var a=r.alternate;if(!a){if(a=U(r),a===null)throw Error(n(188));return a!==r?null:r}for(var u=r,f=a;;){var v=u.return;if(v===null)break;var k=v.alternate;if(k===null){if(f=v.return,f!==null){u=f;continue}break}if(v.child===k.child){for(k=v.child;k;){if(k===u)return ee(v),r;if(k===f)return ee(v),a;k=k.sibling}throw Error(n(188))}if(u.return!==f.return)u=v,f=k;else{for(var N=!1,z=v.child;z;){if(z===u){N=!0,u=v,f=k;break}if(z===f){N=!0,f=v,u=k;break}z=z.sibling}if(!N){for(z=k.child;z;){if(z===u){N=!0,u=k,f=v;break}if(z===f){N=!0,f=k,u=v;break}z=z.sibling}if(!N)throw Error(n(189))}}if(u.alternate!==f)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?r:a}function De(r){return r=_e(r),r!==null?Ue(r):null}function Ue(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var a=Ue(r);if(a!==null)return a;r=r.sibling}return null}var ot=t.unstable_scheduleCallback,un=t.unstable_cancelCallback,Ln=t.unstable_shouldYield,on=t.unstable_requestPaint,vt=t.unstable_now,kr=t.unstable_getCurrentPriorityLevel,Kn=t.unstable_ImmediatePriority,Qn=t.unstable_UserBlockingPriority,Yn=t.unstable_NormalPriority,Q=t.unstable_LowPriority,we=t.unstable_IdlePriority,pe=null,at=null;function ht(r){if(at&&typeof at.onCommitFiberRoot=="function")try{at.onCommitFiberRoot(pe,r,void 0,(r.current.flags&128)===128)}catch{}}var Fe=Math.clz32?Math.clz32:cr,$t=Math.log,Ut=Math.LN2;function cr(r){return r>>>=0,r===0?32:31-($t(r)/Ut|0)|0}var dn=64,Vi=4194304;function qi(r){switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function Gi(r,a){var u=r.pendingLanes;if(u===0)return 0;var f=0,v=r.suspendedLanes,k=r.pingedLanes,N=u&268435455;if(N!==0){var z=N&~v;z!==0?f=qi(z):(k&=N,k!==0&&(f=qi(k)))}else N=u&~v,N!==0?f=qi(N):k!==0&&(f=qi(k));if(f===0)return 0;if(a!==0&&a!==f&&(a&v)===0&&(v=f&-f,k=a&-a,v>=k||v===16&&(k&4194240)!==0))return a;if((f&4)!==0&&(f|=u&16),a=r.entangledLanes,a!==0)for(r=r.entanglements,a&=f;0<a;)u=31-Fe(a),v=1<<u,f|=r[u],a&=~v;return f}function js(r,a){switch(r){case 1:case 2:case 4:return a+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Vc(r,a){for(var u=r.suspendedLanes,f=r.pingedLanes,v=r.expirationTimes,k=r.pendingLanes;0<k;){var N=31-Fe(k),z=1<<N,V=v[N];V===-1?((z&u)===0||(z&f)!==0)&&(v[N]=js(z,a)):V<=a&&(r.expiredLanes|=z),k&=~z}}function Ns(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function Oo(){var r=dn;return dn<<=1,(dn&4194240)===0&&(dn=64),r}function ya(r){for(var a=[],u=0;31>u;u++)a.push(r);return a}function vi(r,a,u){r.pendingLanes|=a,a!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,a=31-Fe(a),r[a]=u}function Bo(r,a){var u=r.pendingLanes&~a;r.pendingLanes=a,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=a,r.mutableReadLanes&=a,r.entangledLanes&=a,a=r.entanglements;var f=r.eventTimes;for(r=r.expirationTimes;0<u;){var v=31-Fe(u),k=1<<v;a[v]=0,f[v]=-1,r[v]=-1,u&=~k}}function Ts(r,a){var u=r.entangledLanes|=a;for(r=r.entanglements;u;){var f=31-Fe(u),v=1<<f;v&a|r[f]&a&&(r[f]|=a),u&=~v}}var It=0;function va(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var G,he,Ke,ft,Vt,Un=!1,Sr=[],Cr=null,ur=null,yt=null,hn=new Map,Or=new Map,jr=[],Uo="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function wa(r,a){switch(r){case"focusin":case"focusout":Cr=null;break;case"dragenter":case"dragleave":ur=null;break;case"mouseover":case"mouseout":yt=null;break;case"pointerover":case"pointerout":hn.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Or.delete(a.pointerId)}}function Ki(r,a,u,f,v,k){return r===null||r.nativeEvent!==k?(r={blockedOn:a,domEventName:u,eventSystemFlags:f,nativeEvent:k,targetContainers:[v]},a!==null&&(a=La(a),a!==null&&he(a)),r):(r.eventSystemFlags|=f,a=r.targetContainers,v!==null&&a.indexOf(v)===-1&&a.push(v),r)}function GS(r,a,u,f,v){switch(a){case"focusin":return Cr=Ki(Cr,r,a,u,f,v),!0;case"dragenter":return ur=Ki(ur,r,a,u,f,v),!0;case"mouseover":return yt=Ki(yt,r,a,u,f,v),!0;case"pointerover":var k=v.pointerId;return hn.set(k,Ki(hn.get(k)||null,r,a,u,f,v)),!0;case"gotpointercapture":return k=v.pointerId,Or.set(k,Ki(Or.get(k)||null,r,a,u,f,v)),!0}return!1}function cp(r){var a=Qi(r.target);if(a!==null){var u=U(a);if(u!==null){if(a=u.tag,a===13){if(a=fe(u),a!==null){r.blockedOn=a,Vt(r.priority,function(){Ke(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){r.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}r.blockedOn=null}function zo(r){if(r.blockedOn!==null)return!1;for(var a=r.targetContainers;0<a.length;){var u=Gc(r.domEventName,r.eventSystemFlags,a[0],r.nativeEvent);if(u===null){u=r.nativeEvent;var f=new u.constructor(u.type,u);St=f,u.target.dispatchEvent(f),St=null}else return a=La(u),a!==null&&he(a),r.blockedOn=u,!1;a.shift()}return!0}function up(r,a,u){zo(r)&&u.delete(a)}function KS(){Un=!1,Cr!==null&&zo(Cr)&&(Cr=null),ur!==null&&zo(ur)&&(ur=null),yt!==null&&zo(yt)&&(yt=null),hn.forEach(up),Or.forEach(up)}function ba(r,a){r.blockedOn===a&&(r.blockedOn=null,Un||(Un=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,KS)))}function xa(r){function a(v){return ba(v,r)}if(0<Sr.length){ba(Sr[0],r);for(var u=1;u<Sr.length;u++){var f=Sr[u];f.blockedOn===r&&(f.blockedOn=null)}}for(Cr!==null&&ba(Cr,r),ur!==null&&ba(ur,r),yt!==null&&ba(yt,r),hn.forEach(a),Or.forEach(a),u=0;u<jr.length;u++)f=jr[u],f.blockedOn===r&&(f.blockedOn=null);for(;0<jr.length&&(u=jr[0],u.blockedOn===null);)cp(u),u.blockedOn===null&&jr.shift()}var Ps=Z.ReactCurrentBatchConfig,Wo=!0;function QS(r,a,u,f){var v=It,k=Ps.transition;Ps.transition=null;try{It=1,qc(r,a,u,f)}finally{It=v,Ps.transition=k}}function YS(r,a,u,f){var v=It,k=Ps.transition;Ps.transition=null;try{It=4,qc(r,a,u,f)}finally{It=v,Ps.transition=k}}function qc(r,a,u,f){if(Wo){var v=Gc(r,a,u,f);if(v===null)uu(r,a,f,Ho,u),wa(r,f);else if(GS(v,r,a,u,f))f.stopPropagation();else if(wa(r,f),a&4&&-1<Uo.indexOf(r)){for(;v!==null;){var k=La(v);if(k!==null&&G(k),k=Gc(r,a,u,f),k===null&&uu(r,a,f,Ho,u),k===v)break;v=k}v!==null&&f.stopPropagation()}else uu(r,a,f,null,u)}}var Ho=null;function Gc(r,a,u,f){if(Ho=null,r=Pt(f),r=Qi(r),r!==null)if(a=U(r),a===null)r=null;else if(u=a.tag,u===13){if(r=fe(a),r!==null)return r;r=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;r=null}else a!==r&&(r=null);return Ho=r,null}function dp(r){switch(r){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(kr()){case Kn:return 1;case Qn:return 4;case Yn:case Q:return 16;case we:return 536870912;default:return 16}default:return 16}}var wi=null,Kc=null,$o=null;function hp(){if($o)return $o;var r,a=Kc,u=a.length,f,v="value"in wi?wi.value:wi.textContent,k=v.length;for(r=0;r<u&&a[r]===v[r];r++);var N=u-r;for(f=1;f<=N&&a[u-f]===v[k-f];f++);return $o=v.slice(r,1<f?1-f:void 0)}function Vo(r){var a=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&a===13&&(r=13)):r=a,r===10&&(r=13),32<=r||r===13?r:0}function qo(){return!0}function fp(){return!1}function dr(r){function a(u,f,v,k,N){this._reactName=u,this._targetInst=v,this.type=f,this.nativeEvent=k,this.target=N,this.currentTarget=null;for(var z in r)r.hasOwnProperty(z)&&(u=r[z],this[z]=u?u(k):k[z]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?qo:fp,this.isPropagationStopped=fp,this}return L(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=qo)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=qo)},persist:function(){},isPersistent:qo}),a}var Es={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Qc=dr(Es),ka=L({},Es,{view:0,detail:0}),XS=dr(ka),Yc,Xc,Sa,Go=L({},ka,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zc,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Sa&&(Sa&&r.type==="mousemove"?(Yc=r.screenX-Sa.screenX,Xc=r.screenY-Sa.screenY):Xc=Yc=0,Sa=r),Yc)},movementY:function(r){return"movementY"in r?r.movementY:Xc}}),pp=dr(Go),JS=L({},Go,{dataTransfer:0}),ZS=dr(JS),eC=L({},ka,{relatedTarget:0}),Jc=dr(eC),tC=L({},Es,{animationName:0,elapsedTime:0,pseudoElement:0}),nC=dr(tC),rC=L({},Es,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),iC=dr(rC),sC=L({},Es,{data:0}),mp=dr(sC),aC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},oC={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},lC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function cC(r){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(r):(r=lC[r])?!!a[r]:!1}function Zc(){return cC}var uC=L({},ka,{key:function(r){if(r.key){var a=aC[r.key]||r.key;if(a!=="Unidentified")return a}return r.type==="keypress"?(r=Vo(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?oC[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zc,charCode:function(r){return r.type==="keypress"?Vo(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?Vo(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),dC=dr(uC),hC=L({},Go,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),gp=dr(hC),fC=L({},ka,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zc}),pC=dr(fC),mC=L({},Es,{propertyName:0,elapsedTime:0,pseudoElement:0}),gC=dr(mC),yC=L({},Go,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),vC=dr(yC),wC=[9,13,27,32],eu=d&&"CompositionEvent"in window,Ca=null;d&&"documentMode"in document&&(Ca=document.documentMode);var bC=d&&"TextEvent"in window&&!Ca,yp=d&&(!eu||Ca&&8<Ca&&11>=Ca),vp=" ",wp=!1;function bp(r,a){switch(r){case"keyup":return wC.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xp(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Rs=!1;function xC(r,a){switch(r){case"compositionend":return xp(a);case"keypress":return a.which!==32?null:(wp=!0,vp);case"textInput":return r=a.data,r===vp&&wp?null:r;default:return null}}function kC(r,a){if(Rs)return r==="compositionend"||!eu&&bp(r,a)?(r=hp(),$o=Kc=wi=null,Rs=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return yp&&a.locale!=="ko"?null:a.data;default:return null}}var SC={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function kp(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a==="input"?!!SC[r.type]:a==="textarea"}function Sp(r,a,u,f){nn(f),a=Jo(a,"onChange"),0<a.length&&(u=new Qc("onChange","change",null,u,f),r.push({event:u,listeners:a}))}var ja=null,Na=null;function CC(r){zp(r,0)}function Ko(r){var a=Ds(r);if(ze(a))return r}function jC(r,a){if(r==="change")return a}var Cp=!1;if(d){var tu;if(d){var nu="oninput"in document;if(!nu){var jp=document.createElement("div");jp.setAttribute("oninput","return;"),nu=typeof jp.oninput=="function"}tu=nu}else tu=!1;Cp=tu&&(!document.documentMode||9<document.documentMode)}function Np(){ja&&(ja.detachEvent("onpropertychange",Tp),Na=ja=null)}function Tp(r){if(r.propertyName==="value"&&Ko(Na)){var a=[];Sp(a,Na,r,Pt(r)),An(CC,a)}}function NC(r,a,u){r==="focusin"?(Np(),ja=a,Na=u,ja.attachEvent("onpropertychange",Tp)):r==="focusout"&&Np()}function TC(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Ko(Na)}function PC(r,a){if(r==="click")return Ko(a)}function EC(r,a){if(r==="input"||r==="change")return Ko(a)}function RC(r,a){return r===a&&(r!==0||1/r===1/a)||r!==r&&a!==a}var Br=typeof Object.is=="function"?Object.is:RC;function Ta(r,a){if(Br(r,a))return!0;if(typeof r!="object"||r===null||typeof a!="object"||a===null)return!1;var u=Object.keys(r),f=Object.keys(a);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var v=u[f];if(!p.call(a,v)||!Br(r[v],a[v]))return!1}return!0}function Pp(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Ep(r,a){var u=Pp(r);r=0;for(var f;u;){if(u.nodeType===3){if(f=r+u.textContent.length,r<=a&&f>=a)return{node:u,offset:a-r};r=f}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Pp(u)}}function Rp(r,a){return r&&a?r===a?!0:r&&r.nodeType===3?!1:a&&a.nodeType===3?Rp(r,a.parentNode):"contains"in r?r.contains(a):r.compareDocumentPosition?!!(r.compareDocumentPosition(a)&16):!1:!1}function Mp(){for(var r=window,a=Ot();a instanceof r.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)r=a.contentWindow;else break;a=Ot(r.document)}return a}function ru(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a&&(a==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||a==="textarea"||r.contentEditable==="true")}function MC(r){var a=Mp(),u=r.focusedElem,f=r.selectionRange;if(a!==u&&u&&u.ownerDocument&&Rp(u.ownerDocument.documentElement,u)){if(f!==null&&ru(u)){if(a=f.start,r=f.end,r===void 0&&(r=a),"selectionStart"in u)u.selectionStart=a,u.selectionEnd=Math.min(r,u.value.length);else if(r=(a=u.ownerDocument||document)&&a.defaultView||window,r.getSelection){r=r.getSelection();var v=u.textContent.length,k=Math.min(f.start,v);f=f.end===void 0?k:Math.min(f.end,v),!r.extend&&k>f&&(v=f,f=k,k=v),v=Ep(u,k);var N=Ep(u,f);v&&N&&(r.rangeCount!==1||r.anchorNode!==v.node||r.anchorOffset!==v.offset||r.focusNode!==N.node||r.focusOffset!==N.offset)&&(a=a.createRange(),a.setStart(v.node,v.offset),r.removeAllRanges(),k>f?(r.addRange(a),r.extend(N.node,N.offset)):(a.setEnd(N.node,N.offset),r.addRange(a)))}}for(a=[],r=u;r=r.parentNode;)r.nodeType===1&&a.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<a.length;u++)r=a[u],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var AC=d&&"documentMode"in document&&11>=document.documentMode,Ms=null,iu=null,Pa=null,su=!1;function Ap(r,a,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;su||Ms==null||Ms!==Ot(f)||(f=Ms,"selectionStart"in f&&ru(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Pa&&Ta(Pa,f)||(Pa=f,f=Jo(iu,"onSelect"),0<f.length&&(a=new Qc("onSelect","select",null,a,u),r.push({event:a,listeners:f}),a.target=Ms)))}function Qo(r,a){var u={};return u[r.toLowerCase()]=a.toLowerCase(),u["Webkit"+r]="webkit"+a,u["Moz"+r]="moz"+a,u}var As={animationend:Qo("Animation","AnimationEnd"),animationiteration:Qo("Animation","AnimationIteration"),animationstart:Qo("Animation","AnimationStart"),transitionend:Qo("Transition","TransitionEnd")},au={},Lp={};d&&(Lp=document.createElement("div").style,"AnimationEvent"in window||(delete As.animationend.animation,delete As.animationiteration.animation,delete As.animationstart.animation),"TransitionEvent"in window||delete As.transitionend.transition);function Yo(r){if(au[r])return au[r];if(!As[r])return r;var a=As[r],u;for(u in a)if(a.hasOwnProperty(u)&&u in Lp)return au[r]=a[u];return r}var Ip=Yo("animationend"),Dp=Yo("animationiteration"),_p=Yo("animationstart"),Fp=Yo("transitionend"),Op=new Map,Bp="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function bi(r,a){Op.set(r,a),c(a,[r])}for(var ou=0;ou<Bp.length;ou++){var lu=Bp[ou],LC=lu.toLowerCase(),IC=lu[0].toUpperCase()+lu.slice(1);bi(LC,"on"+IC)}bi(Ip,"onAnimationEnd"),bi(Dp,"onAnimationIteration"),bi(_p,"onAnimationStart"),bi("dblclick","onDoubleClick"),bi("focusin","onFocus"),bi("focusout","onBlur"),bi(Fp,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ea="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),DC=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ea));function Up(r,a,u){var f=r.type||"unknown-event";r.currentTarget=u,Me(f,a,void 0,r),r.currentTarget=null}function zp(r,a){a=(a&4)!==0;for(var u=0;u<r.length;u++){var f=r[u],v=f.event;f=f.listeners;e:{var k=void 0;if(a)for(var N=f.length-1;0<=N;N--){var z=f[N],V=z.instance,ue=z.currentTarget;if(z=z.listener,V!==k&&v.isPropagationStopped())break e;Up(v,z,ue),k=V}else for(N=0;N<f.length;N++){if(z=f[N],V=z.instance,ue=z.currentTarget,z=z.listener,V!==k&&v.isPropagationStopped())break e;Up(v,z,ue),k=V}}}if(Re)throw r=Ge,Re=!1,Ge=null,r}function Xt(r,a){var u=a[gu];u===void 0&&(u=a[gu]=new Set);var f=r+"__bubble";u.has(f)||(Wp(a,r,2,!1),u.add(f))}function cu(r,a,u){var f=0;a&&(f|=4),Wp(u,r,f,a)}var Xo="_reactListening"+Math.random().toString(36).slice(2);function Ra(r){if(!r[Xo]){r[Xo]=!0,s.forEach(function(u){u!=="selectionchange"&&(DC.has(u)||cu(u,!1,r),cu(u,!0,r))});var a=r.nodeType===9?r:r.ownerDocument;a===null||a[Xo]||(a[Xo]=!0,cu("selectionchange",!1,a))}}function Wp(r,a,u,f){switch(dp(a)){case 1:var v=QS;break;case 4:v=YS;break;default:v=qc}u=v.bind(null,a,u,r),v=void 0,!T||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(v=!0),f?v!==void 0?r.addEventListener(a,u,{capture:!0,passive:v}):r.addEventListener(a,u,!0):v!==void 0?r.addEventListener(a,u,{passive:v}):r.addEventListener(a,u,!1)}function uu(r,a,u,f,v){var k=f;if((a&1)===0&&(a&2)===0&&f!==null)e:for(;;){if(f===null)return;var N=f.tag;if(N===3||N===4){var z=f.stateNode.containerInfo;if(z===v||z.nodeType===8&&z.parentNode===v)break;if(N===4)for(N=f.return;N!==null;){var V=N.tag;if((V===3||V===4)&&(V=N.stateNode.containerInfo,V===v||V.nodeType===8&&V.parentNode===v))return;N=N.return}for(;z!==null;){if(N=Qi(z),N===null)return;if(V=N.tag,V===5||V===6){f=k=N;continue e}z=z.parentNode}}f=f.return}An(function(){var ue=k,je=Pt(u),Te=[];e:{var Ce=Op.get(r);if(Ce!==void 0){var We=Qc,Ve=r;switch(r){case"keypress":if(Vo(u)===0)break e;case"keydown":case"keyup":We=dC;break;case"focusin":Ve="focus",We=Jc;break;case"focusout":Ve="blur",We=Jc;break;case"beforeblur":case"afterblur":We=Jc;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":We=pp;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":We=ZS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":We=pC;break;case Ip:case Dp:case _p:We=nC;break;case Fp:We=gC;break;case"scroll":We=XS;break;case"wheel":We=vC;break;case"copy":case"cut":case"paste":We=iC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":We=gp}var Qe=(a&4)!==0,fn=!Qe&&r==="scroll",te=Qe?Ce!==null?Ce+"Capture":null:Ce;Qe=[];for(var X=ue,ae;X!==null;){ae=X;var Ee=ae.stateNode;if(ae.tag===5&&Ee!==null&&(ae=Ee,te!==null&&(Ee=D(X,te),Ee!=null&&Qe.push(Ma(X,Ee,ae)))),fn)break;X=X.return}0<Qe.length&&(Ce=new We(Ce,Ve,null,u,je),Te.push({event:Ce,listeners:Qe}))}}if((a&7)===0){e:{if(Ce=r==="mouseover"||r==="pointerover",We=r==="mouseout"||r==="pointerout",Ce&&u!==St&&(Ve=u.relatedTarget||u.fromElement)&&(Qi(Ve)||Ve[oi]))break e;if((We||Ce)&&(Ce=je.window===je?je:(Ce=je.ownerDocument)?Ce.defaultView||Ce.parentWindow:window,We?(Ve=u.relatedTarget||u.toElement,We=ue,Ve=Ve?Qi(Ve):null,Ve!==null&&(fn=U(Ve),Ve!==fn||Ve.tag!==5&&Ve.tag!==6)&&(Ve=null)):(We=null,Ve=ue),We!==Ve)){if(Qe=pp,Ee="onMouseLeave",te="onMouseEnter",X="mouse",(r==="pointerout"||r==="pointerover")&&(Qe=gp,Ee="onPointerLeave",te="onPointerEnter",X="pointer"),fn=We==null?Ce:Ds(We),ae=Ve==null?Ce:Ds(Ve),Ce=new Qe(Ee,X+"leave",We,u,je),Ce.target=fn,Ce.relatedTarget=ae,Ee=null,Qi(je)===ue&&(Qe=new Qe(te,X+"enter",Ve,u,je),Qe.target=ae,Qe.relatedTarget=fn,Ee=Qe),fn=Ee,We&&Ve)t:{for(Qe=We,te=Ve,X=0,ae=Qe;ae;ae=Ls(ae))X++;for(ae=0,Ee=te;Ee;Ee=Ls(Ee))ae++;for(;0<X-ae;)Qe=Ls(Qe),X--;for(;0<ae-X;)te=Ls(te),ae--;for(;X--;){if(Qe===te||te!==null&&Qe===te.alternate)break t;Qe=Ls(Qe),te=Ls(te)}Qe=null}else Qe=null;We!==null&&Hp(Te,Ce,We,Qe,!1),Ve!==null&&fn!==null&&Hp(Te,fn,Ve,Qe,!0)}}e:{if(Ce=ue?Ds(ue):window,We=Ce.nodeName&&Ce.nodeName.toLowerCase(),We==="select"||We==="input"&&Ce.type==="file")var Ye=jC;else if(kp(Ce))if(Cp)Ye=EC;else{Ye=TC;var rt=NC}else(We=Ce.nodeName)&&We.toLowerCase()==="input"&&(Ce.type==="checkbox"||Ce.type==="radio")&&(Ye=PC);if(Ye&&(Ye=Ye(r,ue))){Sp(Te,Ye,u,je);break e}rt&&rt(r,Ce,ue),r==="focusout"&&(rt=Ce._wrapperState)&&rt.controlled&&Ce.type==="number"&&Nt(Ce,"number",Ce.value)}switch(rt=ue?Ds(ue):window,r){case"focusin":(kp(rt)||rt.contentEditable==="true")&&(Ms=rt,iu=ue,Pa=null);break;case"focusout":Pa=iu=Ms=null;break;case"mousedown":su=!0;break;case"contextmenu":case"mouseup":case"dragend":su=!1,Ap(Te,u,je);break;case"selectionchange":if(AC)break;case"keydown":case"keyup":Ap(Te,u,je)}var it;if(eu)e:{switch(r){case"compositionstart":var lt="onCompositionStart";break e;case"compositionend":lt="onCompositionEnd";break e;case"compositionupdate":lt="onCompositionUpdate";break e}lt=void 0}else Rs?bp(r,u)&&(lt="onCompositionEnd"):r==="keydown"&&u.keyCode===229&&(lt="onCompositionStart");lt&&(yp&&u.locale!=="ko"&&(Rs||lt!=="onCompositionStart"?lt==="onCompositionEnd"&&Rs&&(it=hp()):(wi=je,Kc="value"in wi?wi.value:wi.textContent,Rs=!0)),rt=Jo(ue,lt),0<rt.length&&(lt=new mp(lt,r,null,u,je),Te.push({event:lt,listeners:rt}),it?lt.data=it:(it=xp(u),it!==null&&(lt.data=it)))),(it=bC?xC(r,u):kC(r,u))&&(ue=Jo(ue,"onBeforeInput"),0<ue.length&&(je=new mp("onBeforeInput","beforeinput",null,u,je),Te.push({event:je,listeners:ue}),je.data=it))}zp(Te,a)})}function Ma(r,a,u){return{instance:r,listener:a,currentTarget:u}}function Jo(r,a){for(var u=a+"Capture",f=[];r!==null;){var v=r,k=v.stateNode;v.tag===5&&k!==null&&(v=k,k=D(r,u),k!=null&&f.unshift(Ma(r,k,v)),k=D(r,a),k!=null&&f.push(Ma(r,k,v))),r=r.return}return f}function Ls(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function Hp(r,a,u,f,v){for(var k=a._reactName,N=[];u!==null&&u!==f;){var z=u,V=z.alternate,ue=z.stateNode;if(V!==null&&V===f)break;z.tag===5&&ue!==null&&(z=ue,v?(V=D(u,k),V!=null&&N.unshift(Ma(u,V,z))):v||(V=D(u,k),V!=null&&N.push(Ma(u,V,z)))),u=u.return}N.length!==0&&r.push({event:a,listeners:N})}var _C=/\r\n?/g,FC=/\u0000|\uFFFD/g;function $p(r){return(typeof r=="string"?r:""+r).replace(_C,`
39
- `).replace(FC,"")}function Zo(r,a,u){if(a=$p(a),$p(r)!==a&&u)throw Error(n(425))}function el(){}var du=null,hu=null;function fu(r,a){return r==="textarea"||r==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var pu=typeof setTimeout=="function"?setTimeout:void 0,OC=typeof clearTimeout=="function"?clearTimeout:void 0,Vp=typeof Promise=="function"?Promise:void 0,BC=typeof queueMicrotask=="function"?queueMicrotask:typeof Vp<"u"?function(r){return Vp.resolve(null).then(r).catch(UC)}:pu;function UC(r){setTimeout(function(){throw r})}function mu(r,a){var u=a,f=0;do{var v=u.nextSibling;if(r.removeChild(u),v&&v.nodeType===8)if(u=v.data,u==="/$"){if(f===0){r.removeChild(v),xa(a);return}f--}else u!=="$"&&u!=="$?"&&u!=="$!"||f++;u=v}while(u);xa(a)}function xi(r){for(;r!=null;r=r.nextSibling){var a=r.nodeType;if(a===1||a===3)break;if(a===8){if(a=r.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return r}function qp(r){r=r.previousSibling;for(var a=0;r;){if(r.nodeType===8){var u=r.data;if(u==="$"||u==="$!"||u==="$?"){if(a===0)return r;a--}else u==="/$"&&a++}r=r.previousSibling}return null}var Is=Math.random().toString(36).slice(2),Yr="__reactFiber$"+Is,Aa="__reactProps$"+Is,oi="__reactContainer$"+Is,gu="__reactEvents$"+Is,zC="__reactListeners$"+Is,WC="__reactHandles$"+Is;function Qi(r){var a=r[Yr];if(a)return a;for(var u=r.parentNode;u;){if(a=u[oi]||u[Yr]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(r=qp(r);r!==null;){if(u=r[Yr])return u;r=qp(r)}return a}r=u,u=r.parentNode}return null}function La(r){return r=r[Yr]||r[oi],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function Ds(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function tl(r){return r[Aa]||null}var yu=[],_s=-1;function ki(r){return{current:r}}function Jt(r){0>_s||(r.current=yu[_s],yu[_s]=null,_s--)}function Kt(r,a){_s++,yu[_s]=r.current,r.current=a}var Si={},In=ki(Si),Xn=ki(!1),Yi=Si;function Fs(r,a){var u=r.type.contextTypes;if(!u)return Si;var f=r.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===a)return f.__reactInternalMemoizedMaskedChildContext;var v={},k;for(k in u)v[k]=a[k];return f&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=a,r.__reactInternalMemoizedMaskedChildContext=v),v}function Jn(r){return r=r.childContextTypes,r!=null}function nl(){Jt(Xn),Jt(In)}function Gp(r,a,u){if(In.current!==Si)throw Error(n(168));Kt(In,a),Kt(Xn,u)}function Kp(r,a,u){var f=r.stateNode;if(a=a.childContextTypes,typeof f.getChildContext!="function")return u;f=f.getChildContext();for(var v in f)if(!(v in a))throw Error(n(108,Ae(r)||"Unknown",v));return L({},u,f)}function rl(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Si,Yi=In.current,Kt(In,r),Kt(Xn,Xn.current),!0}function Qp(r,a,u){var f=r.stateNode;if(!f)throw Error(n(169));u?(r=Kp(r,a,Yi),f.__reactInternalMemoizedMergedChildContext=r,Jt(Xn),Jt(In),Kt(In,r)):Jt(Xn),Kt(Xn,u)}var li=null,il=!1,vu=!1;function Yp(r){li===null?li=[r]:li.push(r)}function HC(r){il=!0,Yp(r)}function Ci(){if(!vu&&li!==null){vu=!0;var r=0,a=It;try{var u=li;for(It=1;r<u.length;r++){var f=u[r];do f=f(!0);while(f!==null)}li=null,il=!1}catch(v){throw li!==null&&(li=li.slice(r+1)),ot(Kn,Ci),v}finally{It=a,vu=!1}}return null}var Os=[],Bs=0,sl=null,al=0,Nr=[],Tr=0,Xi=null,ci=1,ui="";function Ji(r,a){Os[Bs++]=al,Os[Bs++]=sl,sl=r,al=a}function Xp(r,a,u){Nr[Tr++]=ci,Nr[Tr++]=ui,Nr[Tr++]=Xi,Xi=r;var f=ci;r=ui;var v=32-Fe(f)-1;f&=~(1<<v),u+=1;var k=32-Fe(a)+v;if(30<k){var N=v-v%5;k=(f&(1<<N)-1).toString(32),f>>=N,v-=N,ci=1<<32-Fe(a)+v|u<<v|f,ui=k+r}else ci=1<<k|u<<v|f,ui=r}function wu(r){r.return!==null&&(Ji(r,1),Xp(r,1,0))}function bu(r){for(;r===sl;)sl=Os[--Bs],Os[Bs]=null,al=Os[--Bs],Os[Bs]=null;for(;r===Xi;)Xi=Nr[--Tr],Nr[Tr]=null,ui=Nr[--Tr],Nr[Tr]=null,ci=Nr[--Tr],Nr[Tr]=null}var hr=null,fr=null,Zt=!1,Ur=null;function Jp(r,a){var u=Mr(5,null,null,0);u.elementType="DELETED",u.stateNode=a,u.return=r,a=r.deletions,a===null?(r.deletions=[u],r.flags|=16):a.push(u)}function Zp(r,a){switch(r.tag){case 5:var u=r.type;return a=a.nodeType!==1||u.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(r.stateNode=a,hr=r,fr=xi(a.firstChild),!0):!1;case 6:return a=r.pendingProps===""||a.nodeType!==3?null:a,a!==null?(r.stateNode=a,hr=r,fr=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(u=Xi!==null?{id:ci,overflow:ui}:null,r.memoizedState={dehydrated:a,treeContext:u,retryLane:1073741824},u=Mr(18,null,null,0),u.stateNode=a,u.return=r,r.child=u,hr=r,fr=null,!0):!1;default:return!1}}function xu(r){return(r.mode&1)!==0&&(r.flags&128)===0}function ku(r){if(Zt){var a=fr;if(a){var u=a;if(!Zp(r,a)){if(xu(r))throw Error(n(418));a=xi(u.nextSibling);var f=hr;a&&Zp(r,a)?Jp(f,u):(r.flags=r.flags&-4097|2,Zt=!1,hr=r)}}else{if(xu(r))throw Error(n(418));r.flags=r.flags&-4097|2,Zt=!1,hr=r}}}function em(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;hr=r}function ol(r){if(r!==hr)return!1;if(!Zt)return em(r),Zt=!0,!1;var a;if((a=r.tag!==3)&&!(a=r.tag!==5)&&(a=r.type,a=a!=="head"&&a!=="body"&&!fu(r.type,r.memoizedProps)),a&&(a=fr)){if(xu(r))throw tm(),Error(n(418));for(;a;)Jp(r,a),a=xi(a.nextSibling)}if(em(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,a=0;r;){if(r.nodeType===8){var u=r.data;if(u==="/$"){if(a===0){fr=xi(r.nextSibling);break e}a--}else u!=="$"&&u!=="$!"&&u!=="$?"||a++}r=r.nextSibling}fr=null}}else fr=hr?xi(r.stateNode.nextSibling):null;return!0}function tm(){for(var r=fr;r;)r=xi(r.nextSibling)}function Us(){fr=hr=null,Zt=!1}function Su(r){Ur===null?Ur=[r]:Ur.push(r)}var $C=Z.ReactCurrentBatchConfig;function Ia(r,a,u){if(r=u.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(n(309));var f=u.stateNode}if(!f)throw Error(n(147,r));var v=f,k=""+r;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===k?a.ref:(a=function(N){var z=v.refs;N===null?delete z[k]:z[k]=N},a._stringRef=k,a)}if(typeof r!="string")throw Error(n(284));if(!u._owner)throw Error(n(290,r))}return r}function ll(r,a){throw r=Object.prototype.toString.call(a),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":r))}function nm(r){var a=r._init;return a(r._payload)}function rm(r){function a(te,X){if(r){var ae=te.deletions;ae===null?(te.deletions=[X],te.flags|=16):ae.push(X)}}function u(te,X){if(!r)return null;for(;X!==null;)a(te,X),X=X.sibling;return null}function f(te,X){for(te=new Map;X!==null;)X.key!==null?te.set(X.key,X):te.set(X.index,X),X=X.sibling;return te}function v(te,X){return te=Ai(te,X),te.index=0,te.sibling=null,te}function k(te,X,ae){return te.index=ae,r?(ae=te.alternate,ae!==null?(ae=ae.index,ae<X?(te.flags|=2,X):ae):(te.flags|=2,X)):(te.flags|=1048576,X)}function N(te){return r&&te.alternate===null&&(te.flags|=2),te}function z(te,X,ae,Ee){return X===null||X.tag!==6?(X=pd(ae,te.mode,Ee),X.return=te,X):(X=v(X,ae),X.return=te,X)}function V(te,X,ae,Ee){var Ye=ae.type;return Ye===I?je(te,X,ae.props.children,Ee,ae.key):X!==null&&(X.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===xe&&nm(Ye)===X.type)?(Ee=v(X,ae.props),Ee.ref=Ia(te,X,ae),Ee.return=te,Ee):(Ee=Al(ae.type,ae.key,ae.props,null,te.mode,Ee),Ee.ref=Ia(te,X,ae),Ee.return=te,Ee)}function ue(te,X,ae,Ee){return X===null||X.tag!==4||X.stateNode.containerInfo!==ae.containerInfo||X.stateNode.implementation!==ae.implementation?(X=md(ae,te.mode,Ee),X.return=te,X):(X=v(X,ae.children||[]),X.return=te,X)}function je(te,X,ae,Ee,Ye){return X===null||X.tag!==7?(X=as(ae,te.mode,Ee,Ye),X.return=te,X):(X=v(X,ae),X.return=te,X)}function Te(te,X,ae){if(typeof X=="string"&&X!==""||typeof X=="number")return X=pd(""+X,te.mode,ae),X.return=te,X;if(typeof X=="object"&&X!==null){switch(X.$$typeof){case Y:return ae=Al(X.type,X.key,X.props,null,te.mode,ae),ae.ref=Ia(te,null,X),ae.return=te,ae;case B:return X=md(X,te.mode,ae),X.return=te,X;case xe:var Ee=X._init;return Te(te,Ee(X._payload),ae)}if(Bt(X)||me(X))return X=as(X,te.mode,ae,null),X.return=te,X;ll(te,X)}return null}function Ce(te,X,ae,Ee){var Ye=X!==null?X.key:null;if(typeof ae=="string"&&ae!==""||typeof ae=="number")return Ye!==null?null:z(te,X,""+ae,Ee);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case Y:return ae.key===Ye?V(te,X,ae,Ee):null;case B:return ae.key===Ye?ue(te,X,ae,Ee):null;case xe:return Ye=ae._init,Ce(te,X,Ye(ae._payload),Ee)}if(Bt(ae)||me(ae))return Ye!==null?null:je(te,X,ae,Ee,null);ll(te,ae)}return null}function We(te,X,ae,Ee,Ye){if(typeof Ee=="string"&&Ee!==""||typeof Ee=="number")return te=te.get(ae)||null,z(X,te,""+Ee,Ye);if(typeof Ee=="object"&&Ee!==null){switch(Ee.$$typeof){case Y:return te=te.get(Ee.key===null?ae:Ee.key)||null,V(X,te,Ee,Ye);case B:return te=te.get(Ee.key===null?ae:Ee.key)||null,ue(X,te,Ee,Ye);case xe:var rt=Ee._init;return We(te,X,ae,rt(Ee._payload),Ye)}if(Bt(Ee)||me(Ee))return te=te.get(ae)||null,je(X,te,Ee,Ye,null);ll(X,Ee)}return null}function Ve(te,X,ae,Ee){for(var Ye=null,rt=null,it=X,lt=X=0,Tn=null;it!==null&&lt<ae.length;lt++){it.index>lt?(Tn=it,it=null):Tn=it.sibling;var Dt=Ce(te,it,ae[lt],Ee);if(Dt===null){it===null&&(it=Tn);break}r&&it&&Dt.alternate===null&&a(te,it),X=k(Dt,X,lt),rt===null?Ye=Dt:rt.sibling=Dt,rt=Dt,it=Tn}if(lt===ae.length)return u(te,it),Zt&&Ji(te,lt),Ye;if(it===null){for(;lt<ae.length;lt++)it=Te(te,ae[lt],Ee),it!==null&&(X=k(it,X,lt),rt===null?Ye=it:rt.sibling=it,rt=it);return Zt&&Ji(te,lt),Ye}for(it=f(te,it);lt<ae.length;lt++)Tn=We(it,te,lt,ae[lt],Ee),Tn!==null&&(r&&Tn.alternate!==null&&it.delete(Tn.key===null?lt:Tn.key),X=k(Tn,X,lt),rt===null?Ye=Tn:rt.sibling=Tn,rt=Tn);return r&&it.forEach(function(Li){return a(te,Li)}),Zt&&Ji(te,lt),Ye}function Qe(te,X,ae,Ee){var Ye=me(ae);if(typeof Ye!="function")throw Error(n(150));if(ae=Ye.call(ae),ae==null)throw Error(n(151));for(var rt=Ye=null,it=X,lt=X=0,Tn=null,Dt=ae.next();it!==null&&!Dt.done;lt++,Dt=ae.next()){it.index>lt?(Tn=it,it=null):Tn=it.sibling;var Li=Ce(te,it,Dt.value,Ee);if(Li===null){it===null&&(it=Tn);break}r&&it&&Li.alternate===null&&a(te,it),X=k(Li,X,lt),rt===null?Ye=Li:rt.sibling=Li,rt=Li,it=Tn}if(Dt.done)return u(te,it),Zt&&Ji(te,lt),Ye;if(it===null){for(;!Dt.done;lt++,Dt=ae.next())Dt=Te(te,Dt.value,Ee),Dt!==null&&(X=k(Dt,X,lt),rt===null?Ye=Dt:rt.sibling=Dt,rt=Dt);return Zt&&Ji(te,lt),Ye}for(it=f(te,it);!Dt.done;lt++,Dt=ae.next())Dt=We(it,te,lt,Dt.value,Ee),Dt!==null&&(r&&Dt.alternate!==null&&it.delete(Dt.key===null?lt:Dt.key),X=k(Dt,X,lt),rt===null?Ye=Dt:rt.sibling=Dt,rt=Dt);return r&&it.forEach(function(S0){return a(te,S0)}),Zt&&Ji(te,lt),Ye}function fn(te,X,ae,Ee){if(typeof ae=="object"&&ae!==null&&ae.type===I&&ae.key===null&&(ae=ae.props.children),typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case Y:e:{for(var Ye=ae.key,rt=X;rt!==null;){if(rt.key===Ye){if(Ye=ae.type,Ye===I){if(rt.tag===7){u(te,rt.sibling),X=v(rt,ae.props.children),X.return=te,te=X;break e}}else if(rt.elementType===Ye||typeof Ye=="object"&&Ye!==null&&Ye.$$typeof===xe&&nm(Ye)===rt.type){u(te,rt.sibling),X=v(rt,ae.props),X.ref=Ia(te,rt,ae),X.return=te,te=X;break e}u(te,rt);break}else a(te,rt);rt=rt.sibling}ae.type===I?(X=as(ae.props.children,te.mode,Ee,ae.key),X.return=te,te=X):(Ee=Al(ae.type,ae.key,ae.props,null,te.mode,Ee),Ee.ref=Ia(te,X,ae),Ee.return=te,te=Ee)}return N(te);case B:e:{for(rt=ae.key;X!==null;){if(X.key===rt)if(X.tag===4&&X.stateNode.containerInfo===ae.containerInfo&&X.stateNode.implementation===ae.implementation){u(te,X.sibling),X=v(X,ae.children||[]),X.return=te,te=X;break e}else{u(te,X);break}else a(te,X);X=X.sibling}X=md(ae,te.mode,Ee),X.return=te,te=X}return N(te);case xe:return rt=ae._init,fn(te,X,rt(ae._payload),Ee)}if(Bt(ae))return Ve(te,X,ae,Ee);if(me(ae))return Qe(te,X,ae,Ee);ll(te,ae)}return typeof ae=="string"&&ae!==""||typeof ae=="number"?(ae=""+ae,X!==null&&X.tag===6?(u(te,X.sibling),X=v(X,ae),X.return=te,te=X):(u(te,X),X=pd(ae,te.mode,Ee),X.return=te,te=X),N(te)):u(te,X)}return fn}var zs=rm(!0),im=rm(!1),cl=ki(null),ul=null,Ws=null,Cu=null;function ju(){Cu=Ws=ul=null}function Nu(r){var a=cl.current;Jt(cl),r._currentValue=a}function Tu(r,a,u){for(;r!==null;){var f=r.alternate;if((r.childLanes&a)!==a?(r.childLanes|=a,f!==null&&(f.childLanes|=a)):f!==null&&(f.childLanes&a)!==a&&(f.childLanes|=a),r===u)break;r=r.return}}function Hs(r,a){ul=r,Cu=Ws=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&a)!==0&&(Zn=!0),r.firstContext=null)}function Pr(r){var a=r._currentValue;if(Cu!==r)if(r={context:r,memoizedValue:a,next:null},Ws===null){if(ul===null)throw Error(n(308));Ws=r,ul.dependencies={lanes:0,firstContext:r}}else Ws=Ws.next=r;return a}var Zi=null;function Pu(r){Zi===null?Zi=[r]:Zi.push(r)}function sm(r,a,u,f){var v=a.interleaved;return v===null?(u.next=u,Pu(a)):(u.next=v.next,v.next=u),a.interleaved=u,di(r,f)}function di(r,a){r.lanes|=a;var u=r.alternate;for(u!==null&&(u.lanes|=a),u=r,r=r.return;r!==null;)r.childLanes|=a,u=r.alternate,u!==null&&(u.childLanes|=a),u=r,r=r.return;return u.tag===3?u.stateNode:null}var ji=!1;function Eu(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function am(r,a){r=r.updateQueue,a.updateQueue===r&&(a.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function hi(r,a){return{eventTime:r,lane:a,tag:0,payload:null,callback:null,next:null}}function Ni(r,a,u){var f=r.updateQueue;if(f===null)return null;if(f=f.shared,(Lt&2)!==0){var v=f.pending;return v===null?a.next=a:(a.next=v.next,v.next=a),f.pending=a,di(r,u)}return v=f.interleaved,v===null?(a.next=a,Pu(f)):(a.next=v.next,v.next=a),f.interleaved=a,di(r,u)}function dl(r,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194240)!==0)){var f=a.lanes;f&=r.pendingLanes,u|=f,a.lanes=u,Ts(r,u)}}function om(r,a){var u=r.updateQueue,f=r.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var v=null,k=null;if(u=u.firstBaseUpdate,u!==null){do{var N={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};k===null?v=k=N:k=k.next=N,u=u.next}while(u!==null);k===null?v=k=a:k=k.next=a}else v=k=a;u={baseState:f.baseState,firstBaseUpdate:v,lastBaseUpdate:k,shared:f.shared,effects:f.effects},r.updateQueue=u;return}r=u.lastBaseUpdate,r===null?u.firstBaseUpdate=a:r.next=a,u.lastBaseUpdate=a}function hl(r,a,u,f){var v=r.updateQueue;ji=!1;var k=v.firstBaseUpdate,N=v.lastBaseUpdate,z=v.shared.pending;if(z!==null){v.shared.pending=null;var V=z,ue=V.next;V.next=null,N===null?k=ue:N.next=ue,N=V;var je=r.alternate;je!==null&&(je=je.updateQueue,z=je.lastBaseUpdate,z!==N&&(z===null?je.firstBaseUpdate=ue:z.next=ue,je.lastBaseUpdate=V))}if(k!==null){var Te=v.baseState;N=0,je=ue=V=null,z=k;do{var Ce=z.lane,We=z.eventTime;if((f&Ce)===Ce){je!==null&&(je=je.next={eventTime:We,lane:0,tag:z.tag,payload:z.payload,callback:z.callback,next:null});e:{var Ve=r,Qe=z;switch(Ce=a,We=u,Qe.tag){case 1:if(Ve=Qe.payload,typeof Ve=="function"){Te=Ve.call(We,Te,Ce);break e}Te=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=Qe.payload,Ce=typeof Ve=="function"?Ve.call(We,Te,Ce):Ve,Ce==null)break e;Te=L({},Te,Ce);break e;case 2:ji=!0}}z.callback!==null&&z.lane!==0&&(r.flags|=64,Ce=v.effects,Ce===null?v.effects=[z]:Ce.push(z))}else We={eventTime:We,lane:Ce,tag:z.tag,payload:z.payload,callback:z.callback,next:null},je===null?(ue=je=We,V=Te):je=je.next=We,N|=Ce;if(z=z.next,z===null){if(z=v.shared.pending,z===null)break;Ce=z,z=Ce.next,Ce.next=null,v.lastBaseUpdate=Ce,v.shared.pending=null}}while(!0);if(je===null&&(V=Te),v.baseState=V,v.firstBaseUpdate=ue,v.lastBaseUpdate=je,a=v.shared.interleaved,a!==null){v=a;do N|=v.lane,v=v.next;while(v!==a)}else k===null&&(v.shared.lanes=0);ns|=N,r.lanes=N,r.memoizedState=Te}}function lm(r,a,u){if(r=a.effects,a.effects=null,r!==null)for(a=0;a<r.length;a++){var f=r[a],v=f.callback;if(v!==null){if(f.callback=null,f=u,typeof v!="function")throw Error(n(191,v));v.call(f)}}}var Da={},Xr=ki(Da),_a=ki(Da),Fa=ki(Da);function es(r){if(r===Da)throw Error(n(174));return r}function Ru(r,a){switch(Kt(Fa,a),Kt(_a,r),Kt(Xr,Da),r=a.nodeType,r){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:Se(null,"");break;default:r=r===8?a.parentNode:a,a=r.namespaceURI||null,r=r.tagName,a=Se(a,r)}Jt(Xr),Kt(Xr,a)}function $s(){Jt(Xr),Jt(_a),Jt(Fa)}function cm(r){es(Fa.current);var a=es(Xr.current),u=Se(a,r.type);a!==u&&(Kt(_a,r),Kt(Xr,u))}function Mu(r){_a.current===r&&(Jt(Xr),Jt(_a))}var rn=ki(0);function fl(r){for(var a=r;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Au=[];function Lu(){for(var r=0;r<Au.length;r++)Au[r]._workInProgressVersionPrimary=null;Au.length=0}var pl=Z.ReactCurrentDispatcher,Iu=Z.ReactCurrentBatchConfig,ts=0,sn=null,wn=null,jn=null,ml=!1,Oa=!1,Ba=0,VC=0;function Dn(){throw Error(n(321))}function Du(r,a){if(a===null)return!1;for(var u=0;u<a.length&&u<r.length;u++)if(!Br(r[u],a[u]))return!1;return!0}function _u(r,a,u,f,v,k){if(ts=k,sn=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,pl.current=r===null||r.memoizedState===null?QC:YC,r=u(f,v),Oa){k=0;do{if(Oa=!1,Ba=0,25<=k)throw Error(n(301));k+=1,jn=wn=null,a.updateQueue=null,pl.current=XC,r=u(f,v)}while(Oa)}if(pl.current=vl,a=wn!==null&&wn.next!==null,ts=0,jn=wn=sn=null,ml=!1,a)throw Error(n(300));return r}function Fu(){var r=Ba!==0;return Ba=0,r}function Jr(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jn===null?sn.memoizedState=jn=r:jn=jn.next=r,jn}function Er(){if(wn===null){var r=sn.alternate;r=r!==null?r.memoizedState:null}else r=wn.next;var a=jn===null?sn.memoizedState:jn.next;if(a!==null)jn=a,wn=r;else{if(r===null)throw Error(n(310));wn=r,r={memoizedState:wn.memoizedState,baseState:wn.baseState,baseQueue:wn.baseQueue,queue:wn.queue,next:null},jn===null?sn.memoizedState=jn=r:jn=jn.next=r}return jn}function Ua(r,a){return typeof a=="function"?a(r):a}function Ou(r){var a=Er(),u=a.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var f=wn,v=f.baseQueue,k=u.pending;if(k!==null){if(v!==null){var N=v.next;v.next=k.next,k.next=N}f.baseQueue=v=k,u.pending=null}if(v!==null){k=v.next,f=f.baseState;var z=N=null,V=null,ue=k;do{var je=ue.lane;if((ts&je)===je)V!==null&&(V=V.next={lane:0,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null}),f=ue.hasEagerState?ue.eagerState:r(f,ue.action);else{var Te={lane:je,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null};V===null?(z=V=Te,N=f):V=V.next=Te,sn.lanes|=je,ns|=je}ue=ue.next}while(ue!==null&&ue!==k);V===null?N=f:V.next=z,Br(f,a.memoizedState)||(Zn=!0),a.memoizedState=f,a.baseState=N,a.baseQueue=V,u.lastRenderedState=f}if(r=u.interleaved,r!==null){v=r;do k=v.lane,sn.lanes|=k,ns|=k,v=v.next;while(v!==r)}else v===null&&(u.lanes=0);return[a.memoizedState,u.dispatch]}function Bu(r){var a=Er(),u=a.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=r;var f=u.dispatch,v=u.pending,k=a.memoizedState;if(v!==null){u.pending=null;var N=v=v.next;do k=r(k,N.action),N=N.next;while(N!==v);Br(k,a.memoizedState)||(Zn=!0),a.memoizedState=k,a.baseQueue===null&&(a.baseState=k),u.lastRenderedState=k}return[k,f]}function um(){}function dm(r,a){var u=sn,f=Er(),v=a(),k=!Br(f.memoizedState,v);if(k&&(f.memoizedState=v,Zn=!0),f=f.queue,Uu(pm.bind(null,u,f,r),[r]),f.getSnapshot!==a||k||jn!==null&&jn.memoizedState.tag&1){if(u.flags|=2048,za(9,fm.bind(null,u,f,v,a),void 0,null),Nn===null)throw Error(n(349));(ts&30)!==0||hm(u,a,v)}return v}function hm(r,a,u){r.flags|=16384,r={getSnapshot:a,value:u},a=sn.updateQueue,a===null?(a={lastEffect:null,stores:null},sn.updateQueue=a,a.stores=[r]):(u=a.stores,u===null?a.stores=[r]:u.push(r))}function fm(r,a,u,f){a.value=u,a.getSnapshot=f,mm(a)&&gm(r)}function pm(r,a,u){return u(function(){mm(a)&&gm(r)})}function mm(r){var a=r.getSnapshot;r=r.value;try{var u=a();return!Br(r,u)}catch{return!0}}function gm(r){var a=di(r,1);a!==null&&$r(a,r,1,-1)}function ym(r){var a=Jr();return typeof r=="function"&&(r=r()),a.memoizedState=a.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Ua,lastRenderedState:r},a.queue=r,r=r.dispatch=KC.bind(null,sn,r),[a.memoizedState,r]}function za(r,a,u,f){return r={tag:r,create:a,destroy:u,deps:f,next:null},a=sn.updateQueue,a===null?(a={lastEffect:null,stores:null},sn.updateQueue=a,a.lastEffect=r.next=r):(u=a.lastEffect,u===null?a.lastEffect=r.next=r:(f=u.next,u.next=r,r.next=f,a.lastEffect=r)),r}function vm(){return Er().memoizedState}function gl(r,a,u,f){var v=Jr();sn.flags|=r,v.memoizedState=za(1|a,u,void 0,f===void 0?null:f)}function yl(r,a,u,f){var v=Er();f=f===void 0?null:f;var k=void 0;if(wn!==null){var N=wn.memoizedState;if(k=N.destroy,f!==null&&Du(f,N.deps)){v.memoizedState=za(a,u,k,f);return}}sn.flags|=r,v.memoizedState=za(1|a,u,k,f)}function wm(r,a){return gl(8390656,8,r,a)}function Uu(r,a){return yl(2048,8,r,a)}function bm(r,a){return yl(4,2,r,a)}function xm(r,a){return yl(4,4,r,a)}function km(r,a){if(typeof a=="function")return r=r(),a(r),function(){a(null)};if(a!=null)return r=r(),a.current=r,function(){a.current=null}}function Sm(r,a,u){return u=u!=null?u.concat([r]):null,yl(4,4,km.bind(null,a,r),u)}function zu(){}function Cm(r,a){var u=Er();a=a===void 0?null:a;var f=u.memoizedState;return f!==null&&a!==null&&Du(a,f[1])?f[0]:(u.memoizedState=[r,a],r)}function jm(r,a){var u=Er();a=a===void 0?null:a;var f=u.memoizedState;return f!==null&&a!==null&&Du(a,f[1])?f[0]:(r=r(),u.memoizedState=[r,a],r)}function Nm(r,a,u){return(ts&21)===0?(r.baseState&&(r.baseState=!1,Zn=!0),r.memoizedState=u):(Br(u,a)||(u=Oo(),sn.lanes|=u,ns|=u,r.baseState=!0),a)}function qC(r,a){var u=It;It=u!==0&&4>u?u:4,r(!0);var f=Iu.transition;Iu.transition={};try{r(!1),a()}finally{It=u,Iu.transition=f}}function Tm(){return Er().memoizedState}function GC(r,a,u){var f=Ri(r);if(u={lane:f,action:u,hasEagerState:!1,eagerState:null,next:null},Pm(r))Em(a,u);else if(u=sm(r,a,u,f),u!==null){var v=Wn();$r(u,r,f,v),Rm(u,a,f)}}function KC(r,a,u){var f=Ri(r),v={lane:f,action:u,hasEagerState:!1,eagerState:null,next:null};if(Pm(r))Em(a,v);else{var k=r.alternate;if(r.lanes===0&&(k===null||k.lanes===0)&&(k=a.lastRenderedReducer,k!==null))try{var N=a.lastRenderedState,z=k(N,u);if(v.hasEagerState=!0,v.eagerState=z,Br(z,N)){var V=a.interleaved;V===null?(v.next=v,Pu(a)):(v.next=V.next,V.next=v),a.interleaved=v;return}}catch{}finally{}u=sm(r,a,v,f),u!==null&&(v=Wn(),$r(u,r,f,v),Rm(u,a,f))}}function Pm(r){var a=r.alternate;return r===sn||a!==null&&a===sn}function Em(r,a){Oa=ml=!0;var u=r.pending;u===null?a.next=a:(a.next=u.next,u.next=a),r.pending=a}function Rm(r,a,u){if((u&4194240)!==0){var f=a.lanes;f&=r.pendingLanes,u|=f,a.lanes=u,Ts(r,u)}}var vl={readContext:Pr,useCallback:Dn,useContext:Dn,useEffect:Dn,useImperativeHandle:Dn,useInsertionEffect:Dn,useLayoutEffect:Dn,useMemo:Dn,useReducer:Dn,useRef:Dn,useState:Dn,useDebugValue:Dn,useDeferredValue:Dn,useTransition:Dn,useMutableSource:Dn,useSyncExternalStore:Dn,useId:Dn,unstable_isNewReconciler:!1},QC={readContext:Pr,useCallback:function(r,a){return Jr().memoizedState=[r,a===void 0?null:a],r},useContext:Pr,useEffect:wm,useImperativeHandle:function(r,a,u){return u=u!=null?u.concat([r]):null,gl(4194308,4,km.bind(null,a,r),u)},useLayoutEffect:function(r,a){return gl(4194308,4,r,a)},useInsertionEffect:function(r,a){return gl(4,2,r,a)},useMemo:function(r,a){var u=Jr();return a=a===void 0?null:a,r=r(),u.memoizedState=[r,a],r},useReducer:function(r,a,u){var f=Jr();return a=u!==void 0?u(a):a,f.memoizedState=f.baseState=a,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:a},f.queue=r,r=r.dispatch=GC.bind(null,sn,r),[f.memoizedState,r]},useRef:function(r){var a=Jr();return r={current:r},a.memoizedState=r},useState:ym,useDebugValue:zu,useDeferredValue:function(r){return Jr().memoizedState=r},useTransition:function(){var r=ym(!1),a=r[0];return r=qC.bind(null,r[1]),Jr().memoizedState=r,[a,r]},useMutableSource:function(){},useSyncExternalStore:function(r,a,u){var f=sn,v=Jr();if(Zt){if(u===void 0)throw Error(n(407));u=u()}else{if(u=a(),Nn===null)throw Error(n(349));(ts&30)!==0||hm(f,a,u)}v.memoizedState=u;var k={value:u,getSnapshot:a};return v.queue=k,wm(pm.bind(null,f,k,r),[r]),f.flags|=2048,za(9,fm.bind(null,f,k,u,a),void 0,null),u},useId:function(){var r=Jr(),a=Nn.identifierPrefix;if(Zt){var u=ui,f=ci;u=(f&~(1<<32-Fe(f)-1)).toString(32)+u,a=":"+a+"R"+u,u=Ba++,0<u&&(a+="H"+u.toString(32)),a+=":"}else u=VC++,a=":"+a+"r"+u.toString(32)+":";return r.memoizedState=a},unstable_isNewReconciler:!1},YC={readContext:Pr,useCallback:Cm,useContext:Pr,useEffect:Uu,useImperativeHandle:Sm,useInsertionEffect:bm,useLayoutEffect:xm,useMemo:jm,useReducer:Ou,useRef:vm,useState:function(){return Ou(Ua)},useDebugValue:zu,useDeferredValue:function(r){var a=Er();return Nm(a,wn.memoizedState,r)},useTransition:function(){var r=Ou(Ua)[0],a=Er().memoizedState;return[r,a]},useMutableSource:um,useSyncExternalStore:dm,useId:Tm,unstable_isNewReconciler:!1},XC={readContext:Pr,useCallback:Cm,useContext:Pr,useEffect:Uu,useImperativeHandle:Sm,useInsertionEffect:bm,useLayoutEffect:xm,useMemo:jm,useReducer:Bu,useRef:vm,useState:function(){return Bu(Ua)},useDebugValue:zu,useDeferredValue:function(r){var a=Er();return wn===null?a.memoizedState=r:Nm(a,wn.memoizedState,r)},useTransition:function(){var r=Bu(Ua)[0],a=Er().memoizedState;return[r,a]},useMutableSource:um,useSyncExternalStore:dm,useId:Tm,unstable_isNewReconciler:!1};function zr(r,a){if(r&&r.defaultProps){a=L({},a),r=r.defaultProps;for(var u in r)a[u]===void 0&&(a[u]=r[u]);return a}return a}function Wu(r,a,u,f){a=r.memoizedState,u=u(f,a),u=u==null?a:L({},a,u),r.memoizedState=u,r.lanes===0&&(r.updateQueue.baseState=u)}var wl={isMounted:function(r){return(r=r._reactInternals)?U(r)===r:!1},enqueueSetState:function(r,a,u){r=r._reactInternals;var f=Wn(),v=Ri(r),k=hi(f,v);k.payload=a,u!=null&&(k.callback=u),a=Ni(r,k,v),a!==null&&($r(a,r,v,f),dl(a,r,v))},enqueueReplaceState:function(r,a,u){r=r._reactInternals;var f=Wn(),v=Ri(r),k=hi(f,v);k.tag=1,k.payload=a,u!=null&&(k.callback=u),a=Ni(r,k,v),a!==null&&($r(a,r,v,f),dl(a,r,v))},enqueueForceUpdate:function(r,a){r=r._reactInternals;var u=Wn(),f=Ri(r),v=hi(u,f);v.tag=2,a!=null&&(v.callback=a),a=Ni(r,v,f),a!==null&&($r(a,r,f,u),dl(a,r,f))}};function Mm(r,a,u,f,v,k,N){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(f,k,N):a.prototype&&a.prototype.isPureReactComponent?!Ta(u,f)||!Ta(v,k):!0}function Am(r,a,u){var f=!1,v=Si,k=a.contextType;return typeof k=="object"&&k!==null?k=Pr(k):(v=Jn(a)?Yi:In.current,f=a.contextTypes,k=(f=f!=null)?Fs(r,v):Si),a=new a(u,k),r.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=wl,r.stateNode=a,a._reactInternals=r,f&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=v,r.__reactInternalMemoizedMaskedChildContext=k),a}function Lm(r,a,u,f){r=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,f),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,f),a.state!==r&&wl.enqueueReplaceState(a,a.state,null)}function Hu(r,a,u,f){var v=r.stateNode;v.props=u,v.state=r.memoizedState,v.refs={},Eu(r);var k=a.contextType;typeof k=="object"&&k!==null?v.context=Pr(k):(k=Jn(a)?Yi:In.current,v.context=Fs(r,k)),v.state=r.memoizedState,k=a.getDerivedStateFromProps,typeof k=="function"&&(Wu(r,a,k,u),v.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(a=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),a!==v.state&&wl.enqueueReplaceState(v,v.state,null),hl(r,u,v,f),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308)}function Vs(r,a){try{var u="",f=a;do u+=ke(f),f=f.return;while(f);var v=u}catch(k){v=`
40
- Error generating stack: `+k.message+`
41
- `+k.stack}return{value:r,source:a,stack:v,digest:null}}function $u(r,a,u){return{value:r,source:null,stack:u??null,digest:a??null}}function Vu(r,a){try{console.error(a.value)}catch(u){setTimeout(function(){throw u})}}var JC=typeof WeakMap=="function"?WeakMap:Map;function Im(r,a,u){u=hi(-1,u),u.tag=3,u.payload={element:null};var f=a.value;return u.callback=function(){Nl||(Nl=!0,ad=f),Vu(r,a)},u}function Dm(r,a,u){u=hi(-1,u),u.tag=3;var f=r.type.getDerivedStateFromError;if(typeof f=="function"){var v=a.value;u.payload=function(){return f(v)},u.callback=function(){Vu(r,a)}}var k=r.stateNode;return k!==null&&typeof k.componentDidCatch=="function"&&(u.callback=function(){Vu(r,a),typeof f!="function"&&(Pi===null?Pi=new Set([this]):Pi.add(this));var N=a.stack;this.componentDidCatch(a.value,{componentStack:N!==null?N:""})}),u}function _m(r,a,u){var f=r.pingCache;if(f===null){f=r.pingCache=new JC;var v=new Set;f.set(a,v)}else v=f.get(a),v===void 0&&(v=new Set,f.set(a,v));v.has(u)||(v.add(u),r=h0.bind(null,r,a,u),a.then(r,r))}function Fm(r){do{var a;if((a=r.tag===13)&&(a=r.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return r;r=r.return}while(r!==null);return null}function Om(r,a,u,f,v){return(r.mode&1)===0?(r===a?r.flags|=65536:(r.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(a=hi(-1,1),a.tag=2,Ni(u,a,1))),u.lanes|=1),r):(r.flags|=65536,r.lanes=v,r)}var ZC=Z.ReactCurrentOwner,Zn=!1;function zn(r,a,u,f){a.child=r===null?im(a,null,u,f):zs(a,r.child,u,f)}function Bm(r,a,u,f,v){u=u.render;var k=a.ref;return Hs(a,v),f=_u(r,a,u,f,k,v),u=Fu(),r!==null&&!Zn?(a.updateQueue=r.updateQueue,a.flags&=-2053,r.lanes&=~v,fi(r,a,v)):(Zt&&u&&wu(a),a.flags|=1,zn(r,a,f,v),a.child)}function Um(r,a,u,f,v){if(r===null){var k=u.type;return typeof k=="function"&&!fd(k)&&k.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(a.tag=15,a.type=k,zm(r,a,k,f,v)):(r=Al(u.type,null,f,a,a.mode,v),r.ref=a.ref,r.return=a,a.child=r)}if(k=r.child,(r.lanes&v)===0){var N=k.memoizedProps;if(u=u.compare,u=u!==null?u:Ta,u(N,f)&&r.ref===a.ref)return fi(r,a,v)}return a.flags|=1,r=Ai(k,f),r.ref=a.ref,r.return=a,a.child=r}function zm(r,a,u,f,v){if(r!==null){var k=r.memoizedProps;if(Ta(k,f)&&r.ref===a.ref)if(Zn=!1,a.pendingProps=f=k,(r.lanes&v)!==0)(r.flags&131072)!==0&&(Zn=!0);else return a.lanes=r.lanes,fi(r,a,v)}return qu(r,a,u,f,v)}function Wm(r,a,u){var f=a.pendingProps,v=f.children,k=r!==null?r.memoizedState:null;if(f.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},Kt(Gs,pr),pr|=u;else{if((u&1073741824)===0)return r=k!==null?k.baseLanes|u:u,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:r,cachePool:null,transitions:null},a.updateQueue=null,Kt(Gs,pr),pr|=r,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=k!==null?k.baseLanes:u,Kt(Gs,pr),pr|=f}else k!==null?(f=k.baseLanes|u,a.memoizedState=null):f=u,Kt(Gs,pr),pr|=f;return zn(r,a,v,u),a.child}function Hm(r,a){var u=a.ref;(r===null&&u!==null||r!==null&&r.ref!==u)&&(a.flags|=512,a.flags|=2097152)}function qu(r,a,u,f,v){var k=Jn(u)?Yi:In.current;return k=Fs(a,k),Hs(a,v),u=_u(r,a,u,f,k,v),f=Fu(),r!==null&&!Zn?(a.updateQueue=r.updateQueue,a.flags&=-2053,r.lanes&=~v,fi(r,a,v)):(Zt&&f&&wu(a),a.flags|=1,zn(r,a,u,v),a.child)}function $m(r,a,u,f,v){if(Jn(u)){var k=!0;rl(a)}else k=!1;if(Hs(a,v),a.stateNode===null)xl(r,a),Am(a,u,f),Hu(a,u,f,v),f=!0;else if(r===null){var N=a.stateNode,z=a.memoizedProps;N.props=z;var V=N.context,ue=u.contextType;typeof ue=="object"&&ue!==null?ue=Pr(ue):(ue=Jn(u)?Yi:In.current,ue=Fs(a,ue));var je=u.getDerivedStateFromProps,Te=typeof je=="function"||typeof N.getSnapshotBeforeUpdate=="function";Te||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(z!==f||V!==ue)&&Lm(a,N,f,ue),ji=!1;var Ce=a.memoizedState;N.state=Ce,hl(a,f,N,v),V=a.memoizedState,z!==f||Ce!==V||Xn.current||ji?(typeof je=="function"&&(Wu(a,u,je,f),V=a.memoizedState),(z=ji||Mm(a,u,z,f,Ce,V,ue))?(Te||typeof N.UNSAFE_componentWillMount!="function"&&typeof N.componentWillMount!="function"||(typeof N.componentWillMount=="function"&&N.componentWillMount(),typeof N.UNSAFE_componentWillMount=="function"&&N.UNSAFE_componentWillMount()),typeof N.componentDidMount=="function"&&(a.flags|=4194308)):(typeof N.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=f,a.memoizedState=V),N.props=f,N.state=V,N.context=ue,f=z):(typeof N.componentDidMount=="function"&&(a.flags|=4194308),f=!1)}else{N=a.stateNode,am(r,a),z=a.memoizedProps,ue=a.type===a.elementType?z:zr(a.type,z),N.props=ue,Te=a.pendingProps,Ce=N.context,V=u.contextType,typeof V=="object"&&V!==null?V=Pr(V):(V=Jn(u)?Yi:In.current,V=Fs(a,V));var We=u.getDerivedStateFromProps;(je=typeof We=="function"||typeof N.getSnapshotBeforeUpdate=="function")||typeof N.UNSAFE_componentWillReceiveProps!="function"&&typeof N.componentWillReceiveProps!="function"||(z!==Te||Ce!==V)&&Lm(a,N,f,V),ji=!1,Ce=a.memoizedState,N.state=Ce,hl(a,f,N,v);var Ve=a.memoizedState;z!==Te||Ce!==Ve||Xn.current||ji?(typeof We=="function"&&(Wu(a,u,We,f),Ve=a.memoizedState),(ue=ji||Mm(a,u,ue,f,Ce,Ve,V)||!1)?(je||typeof N.UNSAFE_componentWillUpdate!="function"&&typeof N.componentWillUpdate!="function"||(typeof N.componentWillUpdate=="function"&&N.componentWillUpdate(f,Ve,V),typeof N.UNSAFE_componentWillUpdate=="function"&&N.UNSAFE_componentWillUpdate(f,Ve,V)),typeof N.componentDidUpdate=="function"&&(a.flags|=4),typeof N.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof N.componentDidUpdate!="function"||z===r.memoizedProps&&Ce===r.memoizedState||(a.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||z===r.memoizedProps&&Ce===r.memoizedState||(a.flags|=1024),a.memoizedProps=f,a.memoizedState=Ve),N.props=f,N.state=Ve,N.context=V,f=ue):(typeof N.componentDidUpdate!="function"||z===r.memoizedProps&&Ce===r.memoizedState||(a.flags|=4),typeof N.getSnapshotBeforeUpdate!="function"||z===r.memoizedProps&&Ce===r.memoizedState||(a.flags|=1024),f=!1)}return Gu(r,a,u,f,k,v)}function Gu(r,a,u,f,v,k){Hm(r,a);var N=(a.flags&128)!==0;if(!f&&!N)return v&&Qp(a,u,!1),fi(r,a,k);f=a.stateNode,ZC.current=a;var z=N&&typeof u.getDerivedStateFromError!="function"?null:f.render();return a.flags|=1,r!==null&&N?(a.child=zs(a,r.child,null,k),a.child=zs(a,null,z,k)):zn(r,a,z,k),a.memoizedState=f.state,v&&Qp(a,u,!0),a.child}function Vm(r){var a=r.stateNode;a.pendingContext?Gp(r,a.pendingContext,a.pendingContext!==a.context):a.context&&Gp(r,a.context,!1),Ru(r,a.containerInfo)}function qm(r,a,u,f,v){return Us(),Su(v),a.flags|=256,zn(r,a,u,f),a.child}var Ku={dehydrated:null,treeContext:null,retryLane:0};function Qu(r){return{baseLanes:r,cachePool:null,transitions:null}}function Gm(r,a,u){var f=a.pendingProps,v=rn.current,k=!1,N=(a.flags&128)!==0,z;if((z=N)||(z=r!==null&&r.memoizedState===null?!1:(v&2)!==0),z?(k=!0,a.flags&=-129):(r===null||r.memoizedState!==null)&&(v|=1),Kt(rn,v&1),r===null)return ku(a),r=a.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((a.mode&1)===0?a.lanes=1:r.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(N=f.children,r=f.fallback,k?(f=a.mode,k=a.child,N={mode:"hidden",children:N},(f&1)===0&&k!==null?(k.childLanes=0,k.pendingProps=N):k=Ll(N,f,0,null),r=as(r,f,u,null),k.return=a,r.return=a,k.sibling=r,a.child=k,a.child.memoizedState=Qu(u),a.memoizedState=Ku,r):Yu(a,N));if(v=r.memoizedState,v!==null&&(z=v.dehydrated,z!==null))return e0(r,a,N,f,z,v,u);if(k){k=f.fallback,N=a.mode,v=r.child,z=v.sibling;var V={mode:"hidden",children:f.children};return(N&1)===0&&a.child!==v?(f=a.child,f.childLanes=0,f.pendingProps=V,a.deletions=null):(f=Ai(v,V),f.subtreeFlags=v.subtreeFlags&14680064),z!==null?k=Ai(z,k):(k=as(k,N,u,null),k.flags|=2),k.return=a,f.return=a,f.sibling=k,a.child=f,f=k,k=a.child,N=r.child.memoizedState,N=N===null?Qu(u):{baseLanes:N.baseLanes|u,cachePool:null,transitions:N.transitions},k.memoizedState=N,k.childLanes=r.childLanes&~u,a.memoizedState=Ku,f}return k=r.child,r=k.sibling,f=Ai(k,{mode:"visible",children:f.children}),(a.mode&1)===0&&(f.lanes=u),f.return=a,f.sibling=null,r!==null&&(u=a.deletions,u===null?(a.deletions=[r],a.flags|=16):u.push(r)),a.child=f,a.memoizedState=null,f}function Yu(r,a){return a=Ll({mode:"visible",children:a},r.mode,0,null),a.return=r,r.child=a}function bl(r,a,u,f){return f!==null&&Su(f),zs(a,r.child,null,u),r=Yu(a,a.pendingProps.children),r.flags|=2,a.memoizedState=null,r}function e0(r,a,u,f,v,k,N){if(u)return a.flags&256?(a.flags&=-257,f=$u(Error(n(422))),bl(r,a,N,f)):a.memoizedState!==null?(a.child=r.child,a.flags|=128,null):(k=f.fallback,v=a.mode,f=Ll({mode:"visible",children:f.children},v,0,null),k=as(k,v,N,null),k.flags|=2,f.return=a,k.return=a,f.sibling=k,a.child=f,(a.mode&1)!==0&&zs(a,r.child,null,N),a.child.memoizedState=Qu(N),a.memoizedState=Ku,k);if((a.mode&1)===0)return bl(r,a,N,null);if(v.data==="$!"){if(f=v.nextSibling&&v.nextSibling.dataset,f)var z=f.dgst;return f=z,k=Error(n(419)),f=$u(k,f,void 0),bl(r,a,N,f)}if(z=(N&r.childLanes)!==0,Zn||z){if(f=Nn,f!==null){switch(N&-N){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(f.suspendedLanes|N))!==0?0:v,v!==0&&v!==k.retryLane&&(k.retryLane=v,di(r,v),$r(f,r,v,-1))}return hd(),f=$u(Error(n(421))),bl(r,a,N,f)}return v.data==="$?"?(a.flags|=128,a.child=r.child,a=f0.bind(null,r),v._reactRetry=a,null):(r=k.treeContext,fr=xi(v.nextSibling),hr=a,Zt=!0,Ur=null,r!==null&&(Nr[Tr++]=ci,Nr[Tr++]=ui,Nr[Tr++]=Xi,ci=r.id,ui=r.overflow,Xi=a),a=Yu(a,f.children),a.flags|=4096,a)}function Km(r,a,u){r.lanes|=a;var f=r.alternate;f!==null&&(f.lanes|=a),Tu(r.return,a,u)}function Xu(r,a,u,f,v){var k=r.memoizedState;k===null?r.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:v}:(k.isBackwards=a,k.rendering=null,k.renderingStartTime=0,k.last=f,k.tail=u,k.tailMode=v)}function Qm(r,a,u){var f=a.pendingProps,v=f.revealOrder,k=f.tail;if(zn(r,a,f.children,u),f=rn.current,(f&2)!==0)f=f&1|2,a.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=a.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Km(r,u,a);else if(r.tag===19)Km(r,u,a);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===a)break e;for(;r.sibling===null;){if(r.return===null||r.return===a)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}f&=1}if(Kt(rn,f),(a.mode&1)===0)a.memoizedState=null;else switch(v){case"forwards":for(u=a.child,v=null;u!==null;)r=u.alternate,r!==null&&fl(r)===null&&(v=u),u=u.sibling;u=v,u===null?(v=a.child,a.child=null):(v=u.sibling,u.sibling=null),Xu(a,!1,v,u,k);break;case"backwards":for(u=null,v=a.child,a.child=null;v!==null;){if(r=v.alternate,r!==null&&fl(r)===null){a.child=v;break}r=v.sibling,v.sibling=u,u=v,v=r}Xu(a,!0,u,null,k);break;case"together":Xu(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function xl(r,a){(a.mode&1)===0&&r!==null&&(r.alternate=null,a.alternate=null,a.flags|=2)}function fi(r,a,u){if(r!==null&&(a.dependencies=r.dependencies),ns|=a.lanes,(u&a.childLanes)===0)return null;if(r!==null&&a.child!==r.child)throw Error(n(153));if(a.child!==null){for(r=a.child,u=Ai(r,r.pendingProps),a.child=u,u.return=a;r.sibling!==null;)r=r.sibling,u=u.sibling=Ai(r,r.pendingProps),u.return=a;u.sibling=null}return a.child}function t0(r,a,u){switch(a.tag){case 3:Vm(a),Us();break;case 5:cm(a);break;case 1:Jn(a.type)&&rl(a);break;case 4:Ru(a,a.stateNode.containerInfo);break;case 10:var f=a.type._context,v=a.memoizedProps.value;Kt(cl,f._currentValue),f._currentValue=v;break;case 13:if(f=a.memoizedState,f!==null)return f.dehydrated!==null?(Kt(rn,rn.current&1),a.flags|=128,null):(u&a.child.childLanes)!==0?Gm(r,a,u):(Kt(rn,rn.current&1),r=fi(r,a,u),r!==null?r.sibling:null);Kt(rn,rn.current&1);break;case 19:if(f=(u&a.childLanes)!==0,(r.flags&128)!==0){if(f)return Qm(r,a,u);a.flags|=128}if(v=a.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),Kt(rn,rn.current),f)break;return null;case 22:case 23:return a.lanes=0,Wm(r,a,u)}return fi(r,a,u)}var Ym,Ju,Xm,Jm;Ym=function(r,a){for(var u=a.child;u!==null;){if(u.tag===5||u.tag===6)r.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===a)break;for(;u.sibling===null;){if(u.return===null||u.return===a)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},Ju=function(){},Xm=function(r,a,u,f){var v=r.memoizedProps;if(v!==f){r=a.stateNode,es(Xr.current);var k=null;switch(u){case"input":v=Je(r,v),f=Je(r,f),k=[];break;case"select":v=L({},v,{value:void 0}),f=L({},f,{value:void 0}),k=[];break;case"textarea":v=ne(r,v),f=ne(r,f),k=[];break;default:typeof v.onClick!="function"&&typeof f.onClick=="function"&&(r.onclick=el)}ct(u,f);var N;u=null;for(ue in v)if(!f.hasOwnProperty(ue)&&v.hasOwnProperty(ue)&&v[ue]!=null)if(ue==="style"){var z=v[ue];for(N in z)z.hasOwnProperty(N)&&(u||(u={}),u[N]="")}else ue!=="dangerouslySetInnerHTML"&&ue!=="children"&&ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&ue!=="autoFocus"&&(o.hasOwnProperty(ue)?k||(k=[]):(k=k||[]).push(ue,null));for(ue in f){var V=f[ue];if(z=v!=null?v[ue]:void 0,f.hasOwnProperty(ue)&&V!==z&&(V!=null||z!=null))if(ue==="style")if(z){for(N in z)!z.hasOwnProperty(N)||V&&V.hasOwnProperty(N)||(u||(u={}),u[N]="");for(N in V)V.hasOwnProperty(N)&&z[N]!==V[N]&&(u||(u={}),u[N]=V[N])}else u||(k||(k=[]),k.push(ue,u)),u=V;else ue==="dangerouslySetInnerHTML"?(V=V?V.__html:void 0,z=z?z.__html:void 0,V!=null&&z!==V&&(k=k||[]).push(ue,V)):ue==="children"?typeof V!="string"&&typeof V!="number"||(k=k||[]).push(ue,""+V):ue!=="suppressContentEditableWarning"&&ue!=="suppressHydrationWarning"&&(o.hasOwnProperty(ue)?(V!=null&&ue==="onScroll"&&Xt("scroll",r),k||z===V||(k=[])):(k=k||[]).push(ue,V))}u&&(k=k||[]).push("style",u);var ue=k;(a.updateQueue=ue)&&(a.flags|=4)}},Jm=function(r,a,u,f){u!==f&&(a.flags|=4)};function Wa(r,a){if(!Zt)switch(r.tailMode){case"hidden":a=r.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?r.tail=null:u.sibling=null;break;case"collapsed":u=r.tail;for(var f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?a||r.tail===null?r.tail=null:r.tail.sibling=null:f.sibling=null}}function _n(r){var a=r.alternate!==null&&r.alternate.child===r.child,u=0,f=0;if(a)for(var v=r.child;v!==null;)u|=v.lanes|v.childLanes,f|=v.subtreeFlags&14680064,f|=v.flags&14680064,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)u|=v.lanes|v.childLanes,f|=v.subtreeFlags,f|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=f,r.childLanes=u,a}function n0(r,a,u){var f=a.pendingProps;switch(bu(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _n(a),null;case 1:return Jn(a.type)&&nl(),_n(a),null;case 3:return f=a.stateNode,$s(),Jt(Xn),Jt(In),Lu(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(r===null||r.child===null)&&(ol(a)?a.flags|=4:r===null||r.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Ur!==null&&(cd(Ur),Ur=null))),Ju(r,a),_n(a),null;case 5:Mu(a);var v=es(Fa.current);if(u=a.type,r!==null&&a.stateNode!=null)Xm(r,a,u,f,v),r.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!f){if(a.stateNode===null)throw Error(n(166));return _n(a),null}if(r=es(Xr.current),ol(a)){f=a.stateNode,u=a.type;var k=a.memoizedProps;switch(f[Yr]=a,f[Aa]=k,r=(a.mode&1)!==0,u){case"dialog":Xt("cancel",f),Xt("close",f);break;case"iframe":case"object":case"embed":Xt("load",f);break;case"video":case"audio":for(v=0;v<Ea.length;v++)Xt(Ea[v],f);break;case"source":Xt("error",f);break;case"img":case"image":case"link":Xt("error",f),Xt("load",f);break;case"details":Xt("toggle",f);break;case"input":_t(f,k),Xt("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!k.multiple},Xt("invalid",f);break;case"textarea":He(f,k),Xt("invalid",f)}ct(u,k),v=null;for(var N in k)if(k.hasOwnProperty(N)){var z=k[N];N==="children"?typeof z=="string"?f.textContent!==z&&(k.suppressHydrationWarning!==!0&&Zo(f.textContent,z,r),v=["children",z]):typeof z=="number"&&f.textContent!==""+z&&(k.suppressHydrationWarning!==!0&&Zo(f.textContent,z,r),v=["children",""+z]):o.hasOwnProperty(N)&&z!=null&&N==="onScroll"&&Xt("scroll",f)}switch(u){case"input":wt(f),pt(f,k,!0);break;case"textarea":wt(f),Tt(f);break;case"select":case"option":break;default:typeof k.onClick=="function"&&(f.onclick=el)}f=v,a.updateQueue=f,f!==null&&(a.flags|=4)}else{N=v.nodeType===9?v:v.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=ce(u)),r==="http://www.w3.org/1999/xhtml"?u==="script"?(r=N.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof f.is=="string"?r=N.createElement(u,{is:f.is}):(r=N.createElement(u),u==="select"&&(N=r,f.multiple?N.multiple=!0:f.size&&(N.size=f.size))):r=N.createElementNS(r,u),r[Yr]=a,r[Aa]=f,Ym(r,a,!1,!1),a.stateNode=r;e:{switch(N=Ht(u,f),u){case"dialog":Xt("cancel",r),Xt("close",r),v=f;break;case"iframe":case"object":case"embed":Xt("load",r),v=f;break;case"video":case"audio":for(v=0;v<Ea.length;v++)Xt(Ea[v],r);v=f;break;case"source":Xt("error",r),v=f;break;case"img":case"image":case"link":Xt("error",r),Xt("load",r),v=f;break;case"details":Xt("toggle",r),v=f;break;case"input":_t(r,f),v=Je(r,f),Xt("invalid",r);break;case"option":v=f;break;case"select":r._wrapperState={wasMultiple:!!f.multiple},v=L({},f,{value:void 0}),Xt("invalid",r);break;case"textarea":He(r,f),v=ne(r,f),Xt("invalid",r);break;default:v=f}ct(u,v),z=v;for(k in z)if(z.hasOwnProperty(k)){var V=z[k];k==="style"?xt(r,V):k==="dangerouslySetInnerHTML"?(V=V?V.__html:void 0,V!=null&&de(r,V)):k==="children"?typeof V=="string"?(u!=="textarea"||V!=="")&&Ne(r,V):typeof V=="number"&&Ne(r,""+V):k!=="suppressContentEditableWarning"&&k!=="suppressHydrationWarning"&&k!=="autoFocus"&&(o.hasOwnProperty(k)?V!=null&&k==="onScroll"&&Xt("scroll",r):V!=null&&E(r,k,V,N))}switch(u){case"input":wt(r),pt(r,f,!1);break;case"textarea":wt(r),Tt(r);break;case"option":f.value!=null&&r.setAttribute("value",""+Be(f.value));break;case"select":r.multiple=!!f.multiple,k=f.value,k!=null?Rt(r,!!f.multiple,k,!1):f.defaultValue!=null&&Rt(r,!!f.multiple,f.defaultValue,!0);break;default:typeof v.onClick=="function"&&(r.onclick=el)}switch(u){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}}f&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return _n(a),null;case 6:if(r&&a.stateNode!=null)Jm(r,a,r.memoizedProps,f);else{if(typeof f!="string"&&a.stateNode===null)throw Error(n(166));if(u=es(Fa.current),es(Xr.current),ol(a)){if(f=a.stateNode,u=a.memoizedProps,f[Yr]=a,(k=f.nodeValue!==u)&&(r=hr,r!==null))switch(r.tag){case 3:Zo(f.nodeValue,u,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&Zo(f.nodeValue,u,(r.mode&1)!==0)}k&&(a.flags|=4)}else f=(u.nodeType===9?u:u.ownerDocument).createTextNode(f),f[Yr]=a,a.stateNode=f}return _n(a),null;case 13:if(Jt(rn),f=a.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(Zt&&fr!==null&&(a.mode&1)!==0&&(a.flags&128)===0)tm(),Us(),a.flags|=98560,k=!1;else if(k=ol(a),f!==null&&f.dehydrated!==null){if(r===null){if(!k)throw Error(n(318));if(k=a.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(n(317));k[Yr]=a}else Us(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;_n(a),k=!1}else Ur!==null&&(cd(Ur),Ur=null),k=!0;if(!k)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=u,a):(f=f!==null,f!==(r!==null&&r.memoizedState!==null)&&f&&(a.child.flags|=8192,(a.mode&1)!==0&&(r===null||(rn.current&1)!==0?bn===0&&(bn=3):hd())),a.updateQueue!==null&&(a.flags|=4),_n(a),null);case 4:return $s(),Ju(r,a),r===null&&Ra(a.stateNode.containerInfo),_n(a),null;case 10:return Nu(a.type._context),_n(a),null;case 17:return Jn(a.type)&&nl(),_n(a),null;case 19:if(Jt(rn),k=a.memoizedState,k===null)return _n(a),null;if(f=(a.flags&128)!==0,N=k.rendering,N===null)if(f)Wa(k,!1);else{if(bn!==0||r!==null&&(r.flags&128)!==0)for(r=a.child;r!==null;){if(N=fl(r),N!==null){for(a.flags|=128,Wa(k,!1),f=N.updateQueue,f!==null&&(a.updateQueue=f,a.flags|=4),a.subtreeFlags=0,f=u,u=a.child;u!==null;)k=u,r=f,k.flags&=14680066,N=k.alternate,N===null?(k.childLanes=0,k.lanes=r,k.child=null,k.subtreeFlags=0,k.memoizedProps=null,k.memoizedState=null,k.updateQueue=null,k.dependencies=null,k.stateNode=null):(k.childLanes=N.childLanes,k.lanes=N.lanes,k.child=N.child,k.subtreeFlags=0,k.deletions=null,k.memoizedProps=N.memoizedProps,k.memoizedState=N.memoizedState,k.updateQueue=N.updateQueue,k.type=N.type,r=N.dependencies,k.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),u=u.sibling;return Kt(rn,rn.current&1|2),a.child}r=r.sibling}k.tail!==null&&vt()>Ks&&(a.flags|=128,f=!0,Wa(k,!1),a.lanes=4194304)}else{if(!f)if(r=fl(N),r!==null){if(a.flags|=128,f=!0,u=r.updateQueue,u!==null&&(a.updateQueue=u,a.flags|=4),Wa(k,!0),k.tail===null&&k.tailMode==="hidden"&&!N.alternate&&!Zt)return _n(a),null}else 2*vt()-k.renderingStartTime>Ks&&u!==1073741824&&(a.flags|=128,f=!0,Wa(k,!1),a.lanes=4194304);k.isBackwards?(N.sibling=a.child,a.child=N):(u=k.last,u!==null?u.sibling=N:a.child=N,k.last=N)}return k.tail!==null?(a=k.tail,k.rendering=a,k.tail=a.sibling,k.renderingStartTime=vt(),a.sibling=null,u=rn.current,Kt(rn,f?u&1|2:u&1),a):(_n(a),null);case 22:case 23:return dd(),f=a.memoizedState!==null,r!==null&&r.memoizedState!==null!==f&&(a.flags|=8192),f&&(a.mode&1)!==0?(pr&1073741824)!==0&&(_n(a),a.subtreeFlags&6&&(a.flags|=8192)):_n(a),null;case 24:return null;case 25:return null}throw Error(n(156,a.tag))}function r0(r,a){switch(bu(a),a.tag){case 1:return Jn(a.type)&&nl(),r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 3:return $s(),Jt(Xn),Jt(In),Lu(),r=a.flags,(r&65536)!==0&&(r&128)===0?(a.flags=r&-65537|128,a):null;case 5:return Mu(a),null;case 13:if(Jt(rn),r=a.memoizedState,r!==null&&r.dehydrated!==null){if(a.alternate===null)throw Error(n(340));Us()}return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 19:return Jt(rn),null;case 4:return $s(),null;case 10:return Nu(a.type._context),null;case 22:case 23:return dd(),null;case 24:return null;default:return null}}var kl=!1,Fn=!1,i0=typeof WeakSet=="function"?WeakSet:Set,$e=null;function qs(r,a){var u=r.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(f){ln(r,a,f)}else u.current=null}function Zu(r,a,u){try{u()}catch(f){ln(r,a,f)}}var Zm=!1;function s0(r,a){if(du=Wo,r=Mp(),ru(r)){if("selectionStart"in r)var u={start:r.selectionStart,end:r.selectionEnd};else e:{u=(u=r.ownerDocument)&&u.defaultView||window;var f=u.getSelection&&u.getSelection();if(f&&f.rangeCount!==0){u=f.anchorNode;var v=f.anchorOffset,k=f.focusNode;f=f.focusOffset;try{u.nodeType,k.nodeType}catch{u=null;break e}var N=0,z=-1,V=-1,ue=0,je=0,Te=r,Ce=null;t:for(;;){for(var We;Te!==u||v!==0&&Te.nodeType!==3||(z=N+v),Te!==k||f!==0&&Te.nodeType!==3||(V=N+f),Te.nodeType===3&&(N+=Te.nodeValue.length),(We=Te.firstChild)!==null;)Ce=Te,Te=We;for(;;){if(Te===r)break t;if(Ce===u&&++ue===v&&(z=N),Ce===k&&++je===f&&(V=N),(We=Te.nextSibling)!==null)break;Te=Ce,Ce=Te.parentNode}Te=We}u=z===-1||V===-1?null:{start:z,end:V}}else u=null}u=u||{start:0,end:0}}else u=null;for(hu={focusedElem:r,selectionRange:u},Wo=!1,$e=a;$e!==null;)if(a=$e,r=a.child,(a.subtreeFlags&1028)!==0&&r!==null)r.return=a,$e=r;else for(;$e!==null;){a=$e;try{var Ve=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(Ve!==null){var Qe=Ve.memoizedProps,fn=Ve.memoizedState,te=a.stateNode,X=te.getSnapshotBeforeUpdate(a.elementType===a.type?Qe:zr(a.type,Qe),fn);te.__reactInternalSnapshotBeforeUpdate=X}break;case 3:var ae=a.stateNode.containerInfo;ae.nodeType===1?ae.textContent="":ae.nodeType===9&&ae.documentElement&&ae.removeChild(ae.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Ee){ln(a,a.return,Ee)}if(r=a.sibling,r!==null){r.return=a.return,$e=r;break}$e=a.return}return Ve=Zm,Zm=!1,Ve}function Ha(r,a,u){var f=a.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&r)===r){var k=v.destroy;v.destroy=void 0,k!==void 0&&Zu(a,u,k)}v=v.next}while(v!==f)}}function Sl(r,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var u=a=a.next;do{if((u.tag&r)===r){var f=u.create;u.destroy=f()}u=u.next}while(u!==a)}}function ed(r){var a=r.ref;if(a!==null){var u=r.stateNode;switch(r.tag){case 5:r=u;break;default:r=u}typeof a=="function"?a(r):a.current=r}}function eg(r){var a=r.alternate;a!==null&&(r.alternate=null,eg(a)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(a=r.stateNode,a!==null&&(delete a[Yr],delete a[Aa],delete a[gu],delete a[zC],delete a[WC])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function tg(r){return r.tag===5||r.tag===3||r.tag===4}function ng(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||tg(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function td(r,a,u){var f=r.tag;if(f===5||f===6)r=r.stateNode,a?u.nodeType===8?u.parentNode.insertBefore(r,a):u.insertBefore(r,a):(u.nodeType===8?(a=u.parentNode,a.insertBefore(r,u)):(a=u,a.appendChild(r)),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=el));else if(f!==4&&(r=r.child,r!==null))for(td(r,a,u),r=r.sibling;r!==null;)td(r,a,u),r=r.sibling}function nd(r,a,u){var f=r.tag;if(f===5||f===6)r=r.stateNode,a?u.insertBefore(r,a):u.appendChild(r);else if(f!==4&&(r=r.child,r!==null))for(nd(r,a,u),r=r.sibling;r!==null;)nd(r,a,u),r=r.sibling}var En=null,Wr=!1;function Ti(r,a,u){for(u=u.child;u!==null;)rg(r,a,u),u=u.sibling}function rg(r,a,u){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(pe,u)}catch{}switch(u.tag){case 5:Fn||qs(u,a);case 6:var f=En,v=Wr;En=null,Ti(r,a,u),En=f,Wr=v,En!==null&&(Wr?(r=En,u=u.stateNode,r.nodeType===8?r.parentNode.removeChild(u):r.removeChild(u)):En.removeChild(u.stateNode));break;case 18:En!==null&&(Wr?(r=En,u=u.stateNode,r.nodeType===8?mu(r.parentNode,u):r.nodeType===1&&mu(r,u),xa(r)):mu(En,u.stateNode));break;case 4:f=En,v=Wr,En=u.stateNode.containerInfo,Wr=!0,Ti(r,a,u),En=f,Wr=v;break;case 0:case 11:case 14:case 15:if(!Fn&&(f=u.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){v=f=f.next;do{var k=v,N=k.destroy;k=k.tag,N!==void 0&&((k&2)!==0||(k&4)!==0)&&Zu(u,a,N),v=v.next}while(v!==f)}Ti(r,a,u);break;case 1:if(!Fn&&(qs(u,a),f=u.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=u.memoizedProps,f.state=u.memoizedState,f.componentWillUnmount()}catch(z){ln(u,a,z)}Ti(r,a,u);break;case 21:Ti(r,a,u);break;case 22:u.mode&1?(Fn=(f=Fn)||u.memoizedState!==null,Ti(r,a,u),Fn=f):Ti(r,a,u);break;default:Ti(r,a,u)}}function ig(r){var a=r.updateQueue;if(a!==null){r.updateQueue=null;var u=r.stateNode;u===null&&(u=r.stateNode=new i0),a.forEach(function(f){var v=p0.bind(null,r,f);u.has(f)||(u.add(f),f.then(v,v))})}}function Hr(r,a){var u=a.deletions;if(u!==null)for(var f=0;f<u.length;f++){var v=u[f];try{var k=r,N=a,z=N;e:for(;z!==null;){switch(z.tag){case 5:En=z.stateNode,Wr=!1;break e;case 3:En=z.stateNode.containerInfo,Wr=!0;break e;case 4:En=z.stateNode.containerInfo,Wr=!0;break e}z=z.return}if(En===null)throw Error(n(160));rg(k,N,v),En=null,Wr=!1;var V=v.alternate;V!==null&&(V.return=null),v.return=null}catch(ue){ln(v,a,ue)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)sg(a,r),a=a.sibling}function sg(r,a){var u=r.alternate,f=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Hr(a,r),Zr(r),f&4){try{Ha(3,r,r.return),Sl(3,r)}catch(Qe){ln(r,r.return,Qe)}try{Ha(5,r,r.return)}catch(Qe){ln(r,r.return,Qe)}}break;case 1:Hr(a,r),Zr(r),f&512&&u!==null&&qs(u,u.return);break;case 5:if(Hr(a,r),Zr(r),f&512&&u!==null&&qs(u,u.return),r.flags&32){var v=r.stateNode;try{Ne(v,"")}catch(Qe){ln(r,r.return,Qe)}}if(f&4&&(v=r.stateNode,v!=null)){var k=r.memoizedProps,N=u!==null?u.memoizedProps:k,z=r.type,V=r.updateQueue;if(r.updateQueue=null,V!==null)try{z==="input"&&k.type==="radio"&&k.name!=null&&bt(v,k),Ht(z,N);var ue=Ht(z,k);for(N=0;N<V.length;N+=2){var je=V[N],Te=V[N+1];je==="style"?xt(v,Te):je==="dangerouslySetInnerHTML"?de(v,Te):je==="children"?Ne(v,Te):E(v,je,Te,ue)}switch(z){case"input":et(v,k);break;case"textarea":tt(v,k);break;case"select":var Ce=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!k.multiple;var We=k.value;We!=null?Rt(v,!!k.multiple,We,!1):Ce!==!!k.multiple&&(k.defaultValue!=null?Rt(v,!!k.multiple,k.defaultValue,!0):Rt(v,!!k.multiple,k.multiple?[]:"",!1))}v[Aa]=k}catch(Qe){ln(r,r.return,Qe)}}break;case 6:if(Hr(a,r),Zr(r),f&4){if(r.stateNode===null)throw Error(n(162));v=r.stateNode,k=r.memoizedProps;try{v.nodeValue=k}catch(Qe){ln(r,r.return,Qe)}}break;case 3:if(Hr(a,r),Zr(r),f&4&&u!==null&&u.memoizedState.isDehydrated)try{xa(a.containerInfo)}catch(Qe){ln(r,r.return,Qe)}break;case 4:Hr(a,r),Zr(r);break;case 13:Hr(a,r),Zr(r),v=r.child,v.flags&8192&&(k=v.memoizedState!==null,v.stateNode.isHidden=k,!k||v.alternate!==null&&v.alternate.memoizedState!==null||(sd=vt())),f&4&&ig(r);break;case 22:if(je=u!==null&&u.memoizedState!==null,r.mode&1?(Fn=(ue=Fn)||je,Hr(a,r),Fn=ue):Hr(a,r),Zr(r),f&8192){if(ue=r.memoizedState!==null,(r.stateNode.isHidden=ue)&&!je&&(r.mode&1)!==0)for($e=r,je=r.child;je!==null;){for(Te=$e=je;$e!==null;){switch(Ce=$e,We=Ce.child,Ce.tag){case 0:case 11:case 14:case 15:Ha(4,Ce,Ce.return);break;case 1:qs(Ce,Ce.return);var Ve=Ce.stateNode;if(typeof Ve.componentWillUnmount=="function"){f=Ce,u=Ce.return;try{a=f,Ve.props=a.memoizedProps,Ve.state=a.memoizedState,Ve.componentWillUnmount()}catch(Qe){ln(f,u,Qe)}}break;case 5:qs(Ce,Ce.return);break;case 22:if(Ce.memoizedState!==null){lg(Te);continue}}We!==null?(We.return=Ce,$e=We):lg(Te)}je=je.sibling}e:for(je=null,Te=r;;){if(Te.tag===5){if(je===null){je=Te;try{v=Te.stateNode,ue?(k=v.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none"):(z=Te.stateNode,V=Te.memoizedProps.style,N=V!=null&&V.hasOwnProperty("display")?V.display:null,z.style.display=dt("display",N))}catch(Qe){ln(r,r.return,Qe)}}}else if(Te.tag===6){if(je===null)try{Te.stateNode.nodeValue=ue?"":Te.memoizedProps}catch(Qe){ln(r,r.return,Qe)}}else if((Te.tag!==22&&Te.tag!==23||Te.memoizedState===null||Te===r)&&Te.child!==null){Te.child.return=Te,Te=Te.child;continue}if(Te===r)break e;for(;Te.sibling===null;){if(Te.return===null||Te.return===r)break e;je===Te&&(je=null),Te=Te.return}je===Te&&(je=null),Te.sibling.return=Te.return,Te=Te.sibling}}break;case 19:Hr(a,r),Zr(r),f&4&&ig(r);break;case 21:break;default:Hr(a,r),Zr(r)}}function Zr(r){var a=r.flags;if(a&2){try{e:{for(var u=r.return;u!==null;){if(tg(u)){var f=u;break e}u=u.return}throw Error(n(160))}switch(f.tag){case 5:var v=f.stateNode;f.flags&32&&(Ne(v,""),f.flags&=-33);var k=ng(r);nd(r,k,v);break;case 3:case 4:var N=f.stateNode.containerInfo,z=ng(r);td(r,z,N);break;default:throw Error(n(161))}}catch(V){ln(r,r.return,V)}r.flags&=-3}a&4096&&(r.flags&=-4097)}function a0(r,a,u){$e=r,ag(r)}function ag(r,a,u){for(var f=(r.mode&1)!==0;$e!==null;){var v=$e,k=v.child;if(v.tag===22&&f){var N=v.memoizedState!==null||kl;if(!N){var z=v.alternate,V=z!==null&&z.memoizedState!==null||Fn;z=kl;var ue=Fn;if(kl=N,(Fn=V)&&!ue)for($e=v;$e!==null;)N=$e,V=N.child,N.tag===22&&N.memoizedState!==null?cg(v):V!==null?(V.return=N,$e=V):cg(v);for(;k!==null;)$e=k,ag(k),k=k.sibling;$e=v,kl=z,Fn=ue}og(r)}else(v.subtreeFlags&8772)!==0&&k!==null?(k.return=v,$e=k):og(r)}}function og(r){for(;$e!==null;){var a=$e;if((a.flags&8772)!==0){var u=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:Fn||Sl(5,a);break;case 1:var f=a.stateNode;if(a.flags&4&&!Fn)if(u===null)f.componentDidMount();else{var v=a.elementType===a.type?u.memoizedProps:zr(a.type,u.memoizedProps);f.componentDidUpdate(v,u.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var k=a.updateQueue;k!==null&&lm(a,k,f);break;case 3:var N=a.updateQueue;if(N!==null){if(u=null,a.child!==null)switch(a.child.tag){case 5:u=a.child.stateNode;break;case 1:u=a.child.stateNode}lm(a,N,u)}break;case 5:var z=a.stateNode;if(u===null&&a.flags&4){u=z;var V=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":V.autoFocus&&u.focus();break;case"img":V.src&&(u.src=V.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var ue=a.alternate;if(ue!==null){var je=ue.memoizedState;if(je!==null){var Te=je.dehydrated;Te!==null&&xa(Te)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}Fn||a.flags&512&&ed(a)}catch(Ce){ln(a,a.return,Ce)}}if(a===r){$e=null;break}if(u=a.sibling,u!==null){u.return=a.return,$e=u;break}$e=a.return}}function lg(r){for(;$e!==null;){var a=$e;if(a===r){$e=null;break}var u=a.sibling;if(u!==null){u.return=a.return,$e=u;break}$e=a.return}}function cg(r){for(;$e!==null;){var a=$e;try{switch(a.tag){case 0:case 11:case 15:var u=a.return;try{Sl(4,a)}catch(V){ln(a,u,V)}break;case 1:var f=a.stateNode;if(typeof f.componentDidMount=="function"){var v=a.return;try{f.componentDidMount()}catch(V){ln(a,v,V)}}var k=a.return;try{ed(a)}catch(V){ln(a,k,V)}break;case 5:var N=a.return;try{ed(a)}catch(V){ln(a,N,V)}}}catch(V){ln(a,a.return,V)}if(a===r){$e=null;break}var z=a.sibling;if(z!==null){z.return=a.return,$e=z;break}$e=a.return}}var o0=Math.ceil,Cl=Z.ReactCurrentDispatcher,rd=Z.ReactCurrentOwner,Rr=Z.ReactCurrentBatchConfig,Lt=0,Nn=null,mn=null,Rn=0,pr=0,Gs=ki(0),bn=0,$a=null,ns=0,jl=0,id=0,Va=null,er=null,sd=0,Ks=1/0,pi=null,Nl=!1,ad=null,Pi=null,Tl=!1,Ei=null,Pl=0,qa=0,od=null,El=-1,Rl=0;function Wn(){return(Lt&6)!==0?vt():El!==-1?El:El=vt()}function Ri(r){return(r.mode&1)===0?1:(Lt&2)!==0&&Rn!==0?Rn&-Rn:$C.transition!==null?(Rl===0&&(Rl=Oo()),Rl):(r=It,r!==0||(r=window.event,r=r===void 0?16:dp(r.type)),r)}function $r(r,a,u,f){if(50<qa)throw qa=0,od=null,Error(n(185));vi(r,u,f),((Lt&2)===0||r!==Nn)&&(r===Nn&&((Lt&2)===0&&(jl|=u),bn===4&&Mi(r,Rn)),tr(r,f),u===1&&Lt===0&&(a.mode&1)===0&&(Ks=vt()+500,il&&Ci()))}function tr(r,a){var u=r.callbackNode;Vc(r,a);var f=Gi(r,r===Nn?Rn:0);if(f===0)u!==null&&un(u),r.callbackNode=null,r.callbackPriority=0;else if(a=f&-f,r.callbackPriority!==a){if(u!=null&&un(u),a===1)r.tag===0?HC(dg.bind(null,r)):Yp(dg.bind(null,r)),BC(function(){(Lt&6)===0&&Ci()}),u=null;else{switch(va(f)){case 1:u=Kn;break;case 4:u=Qn;break;case 16:u=Yn;break;case 536870912:u=we;break;default:u=Yn}u=wg(u,ug.bind(null,r))}r.callbackPriority=a,r.callbackNode=u}}function ug(r,a){if(El=-1,Rl=0,(Lt&6)!==0)throw Error(n(327));var u=r.callbackNode;if(Qs()&&r.callbackNode!==u)return null;var f=Gi(r,r===Nn?Rn:0);if(f===0)return null;if((f&30)!==0||(f&r.expiredLanes)!==0||a)a=Ml(r,f);else{a=f;var v=Lt;Lt|=2;var k=fg();(Nn!==r||Rn!==a)&&(pi=null,Ks=vt()+500,is(r,a));do try{u0();break}catch(z){hg(r,z)}while(!0);ju(),Cl.current=k,Lt=v,mn!==null?a=0:(Nn=null,Rn=0,a=bn)}if(a!==0){if(a===2&&(v=Ns(r),v!==0&&(f=v,a=ld(r,v))),a===1)throw u=$a,is(r,0),Mi(r,f),tr(r,vt()),u;if(a===6)Mi(r,f);else{if(v=r.current.alternate,(f&30)===0&&!l0(v)&&(a=Ml(r,f),a===2&&(k=Ns(r),k!==0&&(f=k,a=ld(r,k))),a===1))throw u=$a,is(r,0),Mi(r,f),tr(r,vt()),u;switch(r.finishedWork=v,r.finishedLanes=f,a){case 0:case 1:throw Error(n(345));case 2:ss(r,er,pi);break;case 3:if(Mi(r,f),(f&130023424)===f&&(a=sd+500-vt(),10<a)){if(Gi(r,0)!==0)break;if(v=r.suspendedLanes,(v&f)!==f){Wn(),r.pingedLanes|=r.suspendedLanes&v;break}r.timeoutHandle=pu(ss.bind(null,r,er,pi),a);break}ss(r,er,pi);break;case 4:if(Mi(r,f),(f&4194240)===f)break;for(a=r.eventTimes,v=-1;0<f;){var N=31-Fe(f);k=1<<N,N=a[N],N>v&&(v=N),f&=~k}if(f=v,f=vt()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*o0(f/1960))-f,10<f){r.timeoutHandle=pu(ss.bind(null,r,er,pi),f);break}ss(r,er,pi);break;case 5:ss(r,er,pi);break;default:throw Error(n(329))}}}return tr(r,vt()),r.callbackNode===u?ug.bind(null,r):null}function ld(r,a){var u=Va;return r.current.memoizedState.isDehydrated&&(is(r,a).flags|=256),r=Ml(r,a),r!==2&&(a=er,er=u,a!==null&&cd(a)),r}function cd(r){er===null?er=r:er.push.apply(er,r)}function l0(r){for(var a=r;;){if(a.flags&16384){var u=a.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var f=0;f<u.length;f++){var v=u[f],k=v.getSnapshot;v=v.value;try{if(!Br(k(),v))return!1}catch{return!1}}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Mi(r,a){for(a&=~id,a&=~jl,r.suspendedLanes|=a,r.pingedLanes&=~a,r=r.expirationTimes;0<a;){var u=31-Fe(a),f=1<<u;r[u]=-1,a&=~f}}function dg(r){if((Lt&6)!==0)throw Error(n(327));Qs();var a=Gi(r,0);if((a&1)===0)return tr(r,vt()),null;var u=Ml(r,a);if(r.tag!==0&&u===2){var f=Ns(r);f!==0&&(a=f,u=ld(r,f))}if(u===1)throw u=$a,is(r,0),Mi(r,a),tr(r,vt()),u;if(u===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=a,ss(r,er,pi),tr(r,vt()),null}function ud(r,a){var u=Lt;Lt|=1;try{return r(a)}finally{Lt=u,Lt===0&&(Ks=vt()+500,il&&Ci())}}function rs(r){Ei!==null&&Ei.tag===0&&(Lt&6)===0&&Qs();var a=Lt;Lt|=1;var u=Rr.transition,f=It;try{if(Rr.transition=null,It=1,r)return r()}finally{It=f,Rr.transition=u,Lt=a,(Lt&6)===0&&Ci()}}function dd(){pr=Gs.current,Jt(Gs)}function is(r,a){r.finishedWork=null,r.finishedLanes=0;var u=r.timeoutHandle;if(u!==-1&&(r.timeoutHandle=-1,OC(u)),mn!==null)for(u=mn.return;u!==null;){var f=u;switch(bu(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&nl();break;case 3:$s(),Jt(Xn),Jt(In),Lu();break;case 5:Mu(f);break;case 4:$s();break;case 13:Jt(rn);break;case 19:Jt(rn);break;case 10:Nu(f.type._context);break;case 22:case 23:dd()}u=u.return}if(Nn=r,mn=r=Ai(r.current,null),Rn=pr=a,bn=0,$a=null,id=jl=ns=0,er=Va=null,Zi!==null){for(a=0;a<Zi.length;a++)if(u=Zi[a],f=u.interleaved,f!==null){u.interleaved=null;var v=f.next,k=u.pending;if(k!==null){var N=k.next;k.next=v,f.next=N}u.pending=f}Zi=null}return r}function hg(r,a){do{var u=mn;try{if(ju(),pl.current=vl,ml){for(var f=sn.memoizedState;f!==null;){var v=f.queue;v!==null&&(v.pending=null),f=f.next}ml=!1}if(ts=0,jn=wn=sn=null,Oa=!1,Ba=0,rd.current=null,u===null||u.return===null){bn=1,$a=a,mn=null;break}e:{var k=r,N=u.return,z=u,V=a;if(a=Rn,z.flags|=32768,V!==null&&typeof V=="object"&&typeof V.then=="function"){var ue=V,je=z,Te=je.tag;if((je.mode&1)===0&&(Te===0||Te===11||Te===15)){var Ce=je.alternate;Ce?(je.updateQueue=Ce.updateQueue,je.memoizedState=Ce.memoizedState,je.lanes=Ce.lanes):(je.updateQueue=null,je.memoizedState=null)}var We=Fm(N);if(We!==null){We.flags&=-257,Om(We,N,z,k,a),We.mode&1&&_m(k,ue,a),a=We,V=ue;var Ve=a.updateQueue;if(Ve===null){var Qe=new Set;Qe.add(V),a.updateQueue=Qe}else Ve.add(V);break e}else{if((a&1)===0){_m(k,ue,a),hd();break e}V=Error(n(426))}}else if(Zt&&z.mode&1){var fn=Fm(N);if(fn!==null){(fn.flags&65536)===0&&(fn.flags|=256),Om(fn,N,z,k,a),Su(Vs(V,z));break e}}k=V=Vs(V,z),bn!==4&&(bn=2),Va===null?Va=[k]:Va.push(k),k=N;do{switch(k.tag){case 3:k.flags|=65536,a&=-a,k.lanes|=a;var te=Im(k,V,a);om(k,te);break e;case 1:z=V;var X=k.type,ae=k.stateNode;if((k.flags&128)===0&&(typeof X.getDerivedStateFromError=="function"||ae!==null&&typeof ae.componentDidCatch=="function"&&(Pi===null||!Pi.has(ae)))){k.flags|=65536,a&=-a,k.lanes|=a;var Ee=Dm(k,z,a);om(k,Ee);break e}}k=k.return}while(k!==null)}mg(u)}catch(Ye){a=Ye,mn===u&&u!==null&&(mn=u=u.return);continue}break}while(!0)}function fg(){var r=Cl.current;return Cl.current=vl,r===null?vl:r}function hd(){(bn===0||bn===3||bn===2)&&(bn=4),Nn===null||(ns&268435455)===0&&(jl&268435455)===0||Mi(Nn,Rn)}function Ml(r,a){var u=Lt;Lt|=2;var f=fg();(Nn!==r||Rn!==a)&&(pi=null,is(r,a));do try{c0();break}catch(v){hg(r,v)}while(!0);if(ju(),Lt=u,Cl.current=f,mn!==null)throw Error(n(261));return Nn=null,Rn=0,bn}function c0(){for(;mn!==null;)pg(mn)}function u0(){for(;mn!==null&&!Ln();)pg(mn)}function pg(r){var a=vg(r.alternate,r,pr);r.memoizedProps=r.pendingProps,a===null?mg(r):mn=a,rd.current=null}function mg(r){var a=r;do{var u=a.alternate;if(r=a.return,(a.flags&32768)===0){if(u=n0(u,a,pr),u!==null){mn=u;return}}else{if(u=r0(u,a),u!==null){u.flags&=32767,mn=u;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{bn=6,mn=null;return}}if(a=a.sibling,a!==null){mn=a;return}mn=a=r}while(a!==null);bn===0&&(bn=5)}function ss(r,a,u){var f=It,v=Rr.transition;try{Rr.transition=null,It=1,d0(r,a,u,f)}finally{Rr.transition=v,It=f}return null}function d0(r,a,u,f){do Qs();while(Ei!==null);if((Lt&6)!==0)throw Error(n(327));u=r.finishedWork;var v=r.finishedLanes;if(u===null)return null;if(r.finishedWork=null,r.finishedLanes=0,u===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var k=u.lanes|u.childLanes;if(Bo(r,k),r===Nn&&(mn=Nn=null,Rn=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||Tl||(Tl=!0,wg(Yn,function(){return Qs(),null})),k=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||k){k=Rr.transition,Rr.transition=null;var N=It;It=1;var z=Lt;Lt|=4,rd.current=null,s0(r,u),sg(u,r),MC(hu),Wo=!!du,hu=du=null,r.current=u,a0(u),on(),Lt=z,It=N,Rr.transition=k}else r.current=u;if(Tl&&(Tl=!1,Ei=r,Pl=v),k=r.pendingLanes,k===0&&(Pi=null),ht(u.stateNode),tr(r,vt()),a!==null)for(f=r.onRecoverableError,u=0;u<a.length;u++)v=a[u],f(v.value,{componentStack:v.stack,digest:v.digest});if(Nl)throw Nl=!1,r=ad,ad=null,r;return(Pl&1)!==0&&r.tag!==0&&Qs(),k=r.pendingLanes,(k&1)!==0?r===od?qa++:(qa=0,od=r):qa=0,Ci(),null}function Qs(){if(Ei!==null){var r=va(Pl),a=Rr.transition,u=It;try{if(Rr.transition=null,It=16>r?16:r,Ei===null)var f=!1;else{if(r=Ei,Ei=null,Pl=0,(Lt&6)!==0)throw Error(n(331));var v=Lt;for(Lt|=4,$e=r.current;$e!==null;){var k=$e,N=k.child;if(($e.flags&16)!==0){var z=k.deletions;if(z!==null){for(var V=0;V<z.length;V++){var ue=z[V];for($e=ue;$e!==null;){var je=$e;switch(je.tag){case 0:case 11:case 15:Ha(8,je,k)}var Te=je.child;if(Te!==null)Te.return=je,$e=Te;else for(;$e!==null;){je=$e;var Ce=je.sibling,We=je.return;if(eg(je),je===ue){$e=null;break}if(Ce!==null){Ce.return=We,$e=Ce;break}$e=We}}}var Ve=k.alternate;if(Ve!==null){var Qe=Ve.child;if(Qe!==null){Ve.child=null;do{var fn=Qe.sibling;Qe.sibling=null,Qe=fn}while(Qe!==null)}}$e=k}}if((k.subtreeFlags&2064)!==0&&N!==null)N.return=k,$e=N;else e:for(;$e!==null;){if(k=$e,(k.flags&2048)!==0)switch(k.tag){case 0:case 11:case 15:Ha(9,k,k.return)}var te=k.sibling;if(te!==null){te.return=k.return,$e=te;break e}$e=k.return}}var X=r.current;for($e=X;$e!==null;){N=$e;var ae=N.child;if((N.subtreeFlags&2064)!==0&&ae!==null)ae.return=N,$e=ae;else e:for(N=X;$e!==null;){if(z=$e,(z.flags&2048)!==0)try{switch(z.tag){case 0:case 11:case 15:Sl(9,z)}}catch(Ye){ln(z,z.return,Ye)}if(z===N){$e=null;break e}var Ee=z.sibling;if(Ee!==null){Ee.return=z.return,$e=Ee;break e}$e=z.return}}if(Lt=v,Ci(),at&&typeof at.onPostCommitFiberRoot=="function")try{at.onPostCommitFiberRoot(pe,r)}catch{}f=!0}return f}finally{It=u,Rr.transition=a}}return!1}function gg(r,a,u){a=Vs(u,a),a=Im(r,a,1),r=Ni(r,a,1),a=Wn(),r!==null&&(vi(r,1,a),tr(r,a))}function ln(r,a,u){if(r.tag===3)gg(r,r,u);else for(;a!==null;){if(a.tag===3){gg(a,r,u);break}else if(a.tag===1){var f=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Pi===null||!Pi.has(f))){r=Vs(u,r),r=Dm(a,r,1),a=Ni(a,r,1),r=Wn(),a!==null&&(vi(a,1,r),tr(a,r));break}}a=a.return}}function h0(r,a,u){var f=r.pingCache;f!==null&&f.delete(a),a=Wn(),r.pingedLanes|=r.suspendedLanes&u,Nn===r&&(Rn&u)===u&&(bn===4||bn===3&&(Rn&130023424)===Rn&&500>vt()-sd?is(r,0):id|=u),tr(r,a)}function yg(r,a){a===0&&((r.mode&1)===0?a=1:(a=Vi,Vi<<=1,(Vi&130023424)===0&&(Vi=4194304)));var u=Wn();r=di(r,a),r!==null&&(vi(r,a,u),tr(r,u))}function f0(r){var a=r.memoizedState,u=0;a!==null&&(u=a.retryLane),yg(r,u)}function p0(r,a){var u=0;switch(r.tag){case 13:var f=r.stateNode,v=r.memoizedState;v!==null&&(u=v.retryLane);break;case 19:f=r.stateNode;break;default:throw Error(n(314))}f!==null&&f.delete(a),yg(r,u)}var vg;vg=function(r,a,u){if(r!==null)if(r.memoizedProps!==a.pendingProps||Xn.current)Zn=!0;else{if((r.lanes&u)===0&&(a.flags&128)===0)return Zn=!1,t0(r,a,u);Zn=(r.flags&131072)!==0}else Zn=!1,Zt&&(a.flags&1048576)!==0&&Xp(a,al,a.index);switch(a.lanes=0,a.tag){case 2:var f=a.type;xl(r,a),r=a.pendingProps;var v=Fs(a,In.current);Hs(a,u),v=_u(null,a,f,r,v,u);var k=Fu();return a.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,Jn(f)?(k=!0,rl(a)):k=!1,a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Eu(a),v.updater=wl,a.stateNode=v,v._reactInternals=a,Hu(a,f,r,u),a=Gu(null,a,f,!0,k,u)):(a.tag=0,Zt&&k&&wu(a),zn(null,a,v,u),a=a.child),a;case 16:f=a.elementType;e:{switch(xl(r,a),r=a.pendingProps,v=f._init,f=v(f._payload),a.type=f,v=a.tag=g0(f),r=zr(f,r),v){case 0:a=qu(null,a,f,r,u);break e;case 1:a=$m(null,a,f,r,u);break e;case 11:a=Bm(null,a,f,r,u);break e;case 14:a=Um(null,a,f,zr(f.type,r),u);break e}throw Error(n(306,f,""))}return a;case 0:return f=a.type,v=a.pendingProps,v=a.elementType===f?v:zr(f,v),qu(r,a,f,v,u);case 1:return f=a.type,v=a.pendingProps,v=a.elementType===f?v:zr(f,v),$m(r,a,f,v,u);case 3:e:{if(Vm(a),r===null)throw Error(n(387));f=a.pendingProps,k=a.memoizedState,v=k.element,am(r,a),hl(a,f,null,u);var N=a.memoizedState;if(f=N.element,k.isDehydrated)if(k={element:f,isDehydrated:!1,cache:N.cache,pendingSuspenseBoundaries:N.pendingSuspenseBoundaries,transitions:N.transitions},a.updateQueue.baseState=k,a.memoizedState=k,a.flags&256){v=Vs(Error(n(423)),a),a=qm(r,a,f,u,v);break e}else if(f!==v){v=Vs(Error(n(424)),a),a=qm(r,a,f,u,v);break e}else for(fr=xi(a.stateNode.containerInfo.firstChild),hr=a,Zt=!0,Ur=null,u=im(a,null,f,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Us(),f===v){a=fi(r,a,u);break e}zn(r,a,f,u)}a=a.child}return a;case 5:return cm(a),r===null&&ku(a),f=a.type,v=a.pendingProps,k=r!==null?r.memoizedProps:null,N=v.children,fu(f,v)?N=null:k!==null&&fu(f,k)&&(a.flags|=32),Hm(r,a),zn(r,a,N,u),a.child;case 6:return r===null&&ku(a),null;case 13:return Gm(r,a,u);case 4:return Ru(a,a.stateNode.containerInfo),f=a.pendingProps,r===null?a.child=zs(a,null,f,u):zn(r,a,f,u),a.child;case 11:return f=a.type,v=a.pendingProps,v=a.elementType===f?v:zr(f,v),Bm(r,a,f,v,u);case 7:return zn(r,a,a.pendingProps,u),a.child;case 8:return zn(r,a,a.pendingProps.children,u),a.child;case 12:return zn(r,a,a.pendingProps.children,u),a.child;case 10:e:{if(f=a.type._context,v=a.pendingProps,k=a.memoizedProps,N=v.value,Kt(cl,f._currentValue),f._currentValue=N,k!==null)if(Br(k.value,N)){if(k.children===v.children&&!Xn.current){a=fi(r,a,u);break e}}else for(k=a.child,k!==null&&(k.return=a);k!==null;){var z=k.dependencies;if(z!==null){N=k.child;for(var V=z.firstContext;V!==null;){if(V.context===f){if(k.tag===1){V=hi(-1,u&-u),V.tag=2;var ue=k.updateQueue;if(ue!==null){ue=ue.shared;var je=ue.pending;je===null?V.next=V:(V.next=je.next,je.next=V),ue.pending=V}}k.lanes|=u,V=k.alternate,V!==null&&(V.lanes|=u),Tu(k.return,u,a),z.lanes|=u;break}V=V.next}}else if(k.tag===10)N=k.type===a.type?null:k.child;else if(k.tag===18){if(N=k.return,N===null)throw Error(n(341));N.lanes|=u,z=N.alternate,z!==null&&(z.lanes|=u),Tu(N,u,a),N=k.sibling}else N=k.child;if(N!==null)N.return=k;else for(N=k;N!==null;){if(N===a){N=null;break}if(k=N.sibling,k!==null){k.return=N.return,N=k;break}N=N.return}k=N}zn(r,a,v.children,u),a=a.child}return a;case 9:return v=a.type,f=a.pendingProps.children,Hs(a,u),v=Pr(v),f=f(v),a.flags|=1,zn(r,a,f,u),a.child;case 14:return f=a.type,v=zr(f,a.pendingProps),v=zr(f.type,v),Um(r,a,f,v,u);case 15:return zm(r,a,a.type,a.pendingProps,u);case 17:return f=a.type,v=a.pendingProps,v=a.elementType===f?v:zr(f,v),xl(r,a),a.tag=1,Jn(f)?(r=!0,rl(a)):r=!1,Hs(a,u),Am(a,f,v),Hu(a,f,v,u),Gu(null,a,f,!0,r,u);case 19:return Qm(r,a,u);case 22:return Wm(r,a,u)}throw Error(n(156,a.tag))};function wg(r,a){return ot(r,a)}function m0(r,a,u,f){this.tag=r,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mr(r,a,u,f){return new m0(r,a,u,f)}function fd(r){return r=r.prototype,!(!r||!r.isReactComponent)}function g0(r){if(typeof r=="function")return fd(r)?1:0;if(r!=null){if(r=r.$$typeof,r===J)return 11;if(r===ie)return 14}return 2}function Ai(r,a){var u=r.alternate;return u===null?(u=Mr(r.tag,a,r.key,r.mode),u.elementType=r.elementType,u.type=r.type,u.stateNode=r.stateNode,u.alternate=r,r.alternate=u):(u.pendingProps=a,u.type=r.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=r.flags&14680064,u.childLanes=r.childLanes,u.lanes=r.lanes,u.child=r.child,u.memoizedProps=r.memoizedProps,u.memoizedState=r.memoizedState,u.updateQueue=r.updateQueue,a=r.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=r.sibling,u.index=r.index,u.ref=r.ref,u}function Al(r,a,u,f,v,k){var N=2;if(f=r,typeof r=="function")fd(r)&&(N=1);else if(typeof r=="string")N=5;else e:switch(r){case I:return as(u.children,v,k,a);case _:N=8,v|=8;break;case F:return r=Mr(12,u,a,v|2),r.elementType=F,r.lanes=k,r;case re:return r=Mr(13,u,a,v),r.elementType=re,r.lanes=k,r;case le:return r=Mr(19,u,a,v),r.elementType=le,r.lanes=k,r;case q:return Ll(u,v,k,a);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case R:N=10;break e;case W:N=9;break e;case J:N=11;break e;case ie:N=14;break e;case xe:N=16,f=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return a=Mr(N,u,a,v),a.elementType=r,a.type=f,a.lanes=k,a}function as(r,a,u,f){return r=Mr(7,r,f,a),r.lanes=u,r}function Ll(r,a,u,f){return r=Mr(22,r,f,a),r.elementType=q,r.lanes=u,r.stateNode={isHidden:!1},r}function pd(r,a,u){return r=Mr(6,r,null,a),r.lanes=u,r}function md(r,a,u){return a=Mr(4,r.children!==null?r.children:[],r.key,a),a.lanes=u,a.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},a}function y0(r,a,u,f,v){this.tag=a,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ya(0),this.expirationTimes=ya(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ya(0),this.identifierPrefix=f,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function gd(r,a,u,f,v,k,N,z,V){return r=new y0(r,a,u,z,V),a===1?(a=1,k===!0&&(a|=8)):a=0,k=Mr(3,null,null,a),r.current=k,k.stateNode=r,k.memoizedState={element:f,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},Eu(k),r}function v0(r,a,u){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:B,key:f==null?null:""+f,children:r,containerInfo:a,implementation:u}}function bg(r){if(!r)return Si;r=r._reactInternals;e:{if(U(r)!==r||r.tag!==1)throw Error(n(170));var a=r;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(Jn(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(n(171))}if(r.tag===1){var u=r.type;if(Jn(u))return Kp(r,u,a)}return a}function xg(r,a,u,f,v,k,N,z,V){return r=gd(u,f,!0,r,v,k,N,z,V),r.context=bg(null),u=r.current,f=Wn(),v=Ri(u),k=hi(f,v),k.callback=a??null,Ni(u,k,v),r.current.lanes=v,vi(r,v,f),tr(r,f),r}function Il(r,a,u,f){var v=a.current,k=Wn(),N=Ri(v);return u=bg(u),a.context===null?a.context=u:a.pendingContext=u,a=hi(k,N),a.payload={element:r},f=f===void 0?null:f,f!==null&&(a.callback=f),r=Ni(v,a,N),r!==null&&($r(r,v,N,k),dl(r,v,N)),N}function Dl(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function kg(r,a){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var u=r.retryLane;r.retryLane=u!==0&&u<a?u:a}}function yd(r,a){kg(r,a),(r=r.alternate)&&kg(r,a)}function w0(){return null}var Sg=typeof reportError=="function"?reportError:function(r){console.error(r)};function vd(r){this._internalRoot=r}_l.prototype.render=vd.prototype.render=function(r){var a=this._internalRoot;if(a===null)throw Error(n(409));Il(r,a,null,null)},_l.prototype.unmount=vd.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var a=r.containerInfo;rs(function(){Il(null,r,null,null)}),a[oi]=null}};function _l(r){this._internalRoot=r}_l.prototype.unstable_scheduleHydration=function(r){if(r){var a=ft();r={blockedOn:null,target:r,priority:a};for(var u=0;u<jr.length&&a!==0&&a<jr[u].priority;u++);jr.splice(u,0,r),u===0&&cp(r)}};function wd(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Fl(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function Cg(){}function b0(r,a,u,f,v){if(v){if(typeof f=="function"){var k=f;f=function(){var ue=Dl(N);k.call(ue)}}var N=xg(a,f,r,0,null,!1,!1,"",Cg);return r._reactRootContainer=N,r[oi]=N.current,Ra(r.nodeType===8?r.parentNode:r),rs(),N}for(;v=r.lastChild;)r.removeChild(v);if(typeof f=="function"){var z=f;f=function(){var ue=Dl(V);z.call(ue)}}var V=gd(r,0,!1,null,null,!1,!1,"",Cg);return r._reactRootContainer=V,r[oi]=V.current,Ra(r.nodeType===8?r.parentNode:r),rs(function(){Il(a,V,u,f)}),V}function Ol(r,a,u,f,v){var k=u._reactRootContainer;if(k){var N=k;if(typeof v=="function"){var z=v;v=function(){var V=Dl(N);z.call(V)}}Il(a,N,r,v)}else N=b0(u,a,r,v,f);return Dl(N)}G=function(r){switch(r.tag){case 3:var a=r.stateNode;if(a.current.memoizedState.isDehydrated){var u=qi(a.pendingLanes);u!==0&&(Ts(a,u|1),tr(a,vt()),(Lt&6)===0&&(Ks=vt()+500,Ci()))}break;case 13:rs(function(){var f=di(r,1);if(f!==null){var v=Wn();$r(f,r,1,v)}}),yd(r,1)}},he=function(r){if(r.tag===13){var a=di(r,134217728);if(a!==null){var u=Wn();$r(a,r,134217728,u)}yd(r,134217728)}},Ke=function(r){if(r.tag===13){var a=Ri(r),u=di(r,a);if(u!==null){var f=Wn();$r(u,r,a,f)}yd(r,a)}},ft=function(){return It},Vt=function(r,a){var u=It;try{return It=r,a()}finally{It=u}},Ft=function(r,a,u){switch(a){case"input":if(et(r,u),a=u.name,u.type==="radio"&&a!=null){for(u=r;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<u.length;a++){var f=u[a];if(f!==r&&f.form===r.form){var v=tl(f);if(!v)throw Error(n(90));ze(f),et(f,v)}}}break;case"textarea":tt(r,u);break;case"select":a=u.value,a!=null&&Rt(r,!!u.multiple,a,!1)}},Pn=ud,pn=rs;var x0={usingClientEntryPoint:!1,Events:[La,Ds,tl,nn,vn,ud]},Ga={findFiberByHostInstance:Qi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},k0={bundleType:Ga.bundleType,version:Ga.version,rendererPackageName:Ga.rendererPackageName,rendererConfig:Ga.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Z.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=De(r),r===null?null:r.stateNode},findFiberByHostInstance:Ga.findFiberByHostInstance||w0,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bl.isDisabled&&Bl.supportsFiber)try{pe=Bl.inject(k0),at=Bl}catch{}}return nr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=x0,nr.createPortal=function(r,a){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!wd(a))throw Error(n(200));return v0(r,a,null,u)},nr.createRoot=function(r,a){if(!wd(r))throw Error(n(299));var u=!1,f="",v=Sg;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onRecoverableError!==void 0&&(v=a.onRecoverableError)),a=gd(r,1,!1,null,null,u,!1,f,v),r[oi]=a.current,Ra(r.nodeType===8?r.parentNode:r),new vd(a)},nr.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var a=r._reactInternals;if(a===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=De(a),r=r===null?null:r.stateNode,r},nr.flushSync=function(r){return rs(r)},nr.hydrate=function(r,a,u){if(!Fl(a))throw Error(n(200));return Ol(null,r,a,!0,u)},nr.hydrateRoot=function(r,a,u){if(!wd(r))throw Error(n(405));var f=u!=null&&u.hydratedSources||null,v=!1,k="",N=Sg;if(u!=null&&(u.unstable_strictMode===!0&&(v=!0),u.identifierPrefix!==void 0&&(k=u.identifierPrefix),u.onRecoverableError!==void 0&&(N=u.onRecoverableError)),a=xg(a,null,r,1,u??null,v,!1,k,N),r[oi]=a.current,Ra(r),f)for(r=0;r<f.length;r++)u=f[r],v=u._getVersion,v=v(u._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[u,v]:a.mutableSourceEagerHydrationData.push(u,v);return new _l(a)},nr.render=function(r,a,u){if(!Fl(a))throw Error(n(200));return Ol(null,r,a,!1,u)},nr.unmountComponentAtNode=function(r){if(!Fl(r))throw Error(n(40));return r._reactRootContainer?(rs(function(){Ol(null,null,r,!1,function(){r._reactRootContainer=null,r[oi]=null})}),!0):!1},nr.unstable_batchedUpdates=ud,nr.unstable_renderSubtreeIntoContainer=function(r,a,u,f){if(!Fl(u))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return Ol(r,a,u,!1,f)},nr.version="18.3.1-next-f1338f8080-20240426",nr}var Ag;function lb(){if(Ag)return kd.exports;Ag=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),kd.exports=M0(),kd.exports}var Lg;function A0(){if(Lg)return Ul;Lg=1;var e=lb();return Ul.createRoot=e.createRoot,Ul.hydrateRoot=e.hydrateRoot,Ul}var L0=A0();const I0=To(L0);var w=lf();const D0=To(w),_0=ob({__proto__:null,default:D0},[w]);function cb(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function ub(){var c,l;if(typeof navigator>"u")return"unknown";const e=navigator.userAgent.toLowerCase(),t=navigator.userAgentData,n=((c=t==null?void 0:t.platform)==null?void 0:c.toLowerCase())??((l=navigator.platform)==null?void 0:l.toLowerCase())??"",s=`${n} ${e}`,o=n.includes("mac")&&navigator.maxTouchPoints>1;return s.includes("android")?"android":s.includes("iphone")||s.includes("ipad")||s.includes("ipod")||o?"ios":s.includes("mac")?"macos":s.includes("win")?"windows":s.includes("linux")?"linux":"unknown"}function F0(e){var t;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:typeof window<"u"&&Number.isFinite(window.innerWidth)&&window.innerWidth>0?window.innerWidth:typeof document<"u"&&Number.isFinite((t=document.documentElement)==null?void 0:t.clientWidth)&&document.documentElement.clientWidth>0?document.documentElement.clientWidth:1280}function O0(e){const t=F0(e);return t<768?"compact":t<1024?"medium":"expanded"}function B0(e){const t=ub();return e==="desktop"?{osFamily:t,windowControlsStyle:t==="macos"?"traffic-lights":t==="windows"?"windows":"none",prefersDesktopChrome:!0,prefersOverlayTitlebar:t==="macos",prefersSystemFontStack:!0}:{osFamily:t,windowControlsStyle:"none",prefersDesktopChrome:!1,prefersOverlayTitlebar:!1,prefersSystemFontStack:!0}}function vr(e){return{ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:e}}async function Vr(e,t){return db(e,t)}async function db(e,t){if(!cb())return vr("当前运行环境不支持桌面壳能力。");try{return{ok:!0,value:await window.__TAURI_INTERNALS__.invoke(e,t)}}catch(n){return{ok:!1,errorCode:"SHELL_BRIDGE_ERROR",detail:n instanceof Error?n.message:"桌面壳调用失败。"}}}function U0(e){switch(e){case"selection":return 10;case"action":return[12];case"gesture":return[10,18,10];case"success":return[16,30,20];case"warning":return[20,36,18];case"error":return[24,40,24,40,20];default:return 10}}function hb(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}async function fb(e){if(hb())try{navigator.vibrate(U0(e))}catch{return}}async function pb(e,t){if(typeof window>"u"||typeof Notification>"u")return vr("当前环境不支持系统通知。");try{if(Notification.permission==="default"&&await Notification.requestPermission()!=="granted"||Notification.permission!=="granted")return vr("系统通知权限未授予。");const n=new Notification(e,{body:t});return n.onerror=()=>{},{ok:!0}}catch(n){return{ok:!1,errorCode:"NOTIFICATION_FAILED",detail:n instanceof Error?n.message:"系统通知发送失败。"}}}class z0{constructor(){Ze(this,"supported",!1)}openExternal(t){return typeof window>"u"?Promise.resolve(vr("当前环境无法打开外部链接。")):(window.open(t,"_blank","noopener,noreferrer"),Promise.resolve({ok:!0}))}showNotification(t,n){return pb(t,n)}writeClipboardText(){return Promise.resolve(vr("当前不是桌面端运行环境。"))}setWindowState(){return Promise.resolve(vr("当前不是桌面端运行环境。"))}readDesktopConfig(){return Promise.resolve(vr("当前不是桌面端运行环境。"))}writeDesktopConfig(){return Promise.resolve(vr("当前不是桌面端运行环境。"))}getRuntimeInfo(){return Promise.resolve(vr("当前不是桌面端运行环境。"))}checkForUpdate(){return Promise.resolve(vr("当前不是桌面端运行环境。"))}installUpdate(){return Promise.resolve({ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前不是桌面端运行环境。"})}rollbackToPreviousVersion(){return Promise.resolve(vr("当前不是桌面端运行环境。"))}pickDirectory(){return Promise.resolve(vr("当前不是桌面端运行环境。"))}}class W0{constructor(){Ze(this,"supported",hb())}trigger(t){return fb(t)}}class H0{constructor(){Ze(this,"supported",!0)}openExternal(t){return Vr("open_external",{url:t})}async showNotification(t,n){const s=await pb(t,n);return s.ok?s:Vr("show_notification",{title:t,body:n})}writeClipboardText(t){return Vr("copy_text",{text:t})}setWindowState(t){return Vr("set_window_state",{state:t})}readDesktopConfig(){return Vr("read_desktop_config")}writeDesktopConfig(t){return Vr("write_desktop_config",{patch:t})}getRuntimeInfo(){return Vr("get_runtime_info")}checkForUpdate(t){return Vr("check_for_update",{channel:t})}async installUpdate(t){const n=await Vr("install_update",{manifest:t});return n.ok?n.value??{ok:!0}:{ok:!1,errorCode:n.errorCode,detail:n.detail}}rollbackToPreviousVersion(){return Vr("rollback_to_previous_version")}pickDirectory(){return Vr("pick_directory")}}class $0{constructor(){Ze(this,"supported",!0)}async trigger(t){(await db("perform_haptic_feedback",{kind:t})).ok||await fb(t)}}function mb(){if(!cb())return"web";const e=ub();return e==="ios"?"ios":e==="android"?"android":"desktop"}function si(e={}){const t=mb(),n=O0(e.viewportWidth),s=t==="ios"||t==="android";return{platform:t,isDesktop:t==="desktop",isWeb:t==="web",isMobile:s||n!=="expanded",isNativeMobile:s,viewportClass:n,ui:B0(t),bridge:t==="desktop"?new H0:new z0,haptics:s?new $0:new W0}}function V0(e){return e==="http:"||e==="https:"}function mi(e){const t=e.trim();if(!t)throw new Error("EMPTY_SERVER_URL");const n=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(t)?t:`http://${t}`,s=new URL(n);if(!V0(s.protocol))throw new Error("INVALID_SERVER_PROTOCOL");s.hash="",s.search="";const o=s.pathname.replace(/\/+$/,"");return`${s.origin}${o==="/"?"":o}`}const Nh="codingns.client.runtime-config";function cf(e){return e==="desktop"||e==="ios"||e==="android"}function gb(e){return e==="en"||e==="en-US"?"en-US":"zh-CN"}function q0(){return typeof navigator>"u"?"zh-CN":gb(navigator.language)}function G0(e){return e==="acceptEdits"||e==="bypassPermissions"?e:"default"}function yb(){return typeof window<"u"&&typeof window.localStorage<"u"}function K0(){if(!yb())return null;const e=window.localStorage.getItem(Nh);if(!e)return null;try{return JSON.parse(e)}catch{return window.localStorage.removeItem(Nh),null}}function vb(e){yb()&&window.localStorage.setItem(Nh,JSON.stringify(e))}function Q0(){var e;return typeof window>"u"||!((e=window.location)!=null&&e.origin)?null:window.location.origin}function Y0(e){if(!e)return null;try{return mi(e)}catch{return null}}function uf(e){if(e==="web"){const t=Y0(Q0());if(t)return t}return mi("http://127.0.0.1:3002")}function X0(e){return{platform:e,hostBaseUrl:uf(e),releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:q0(),defaultPermissionMode:"default"}}function Th(e,t){if(!t)return e;const n=t.platform??e.platform;return{...e,...t,hostBaseUrl:cf(n)?t.hostBaseUrl?mi(t.hostBaseUrl):e.hostBaseUrl:uf(n),platform:n,releaseChannel:t.releaseChannel??e.releaseChannel,autoReconnect:t.autoReconnect??e.autoReconnect,autoCheckUpdate:t.autoCheckUpdate??e.autoCheckUpdate,language:gb(t.language??e.language),defaultPermissionMode:G0(t.defaultPermissionMode??e.defaultPermissionMode)}}async function J0(){const e=si(),t=X0(e.platform),n=K0();let s=null;if(e.isDesktop){const c=await e.bridge.readDesktopConfig();c.ok&&c.value&&(s=c.value)}const o=Th(Th(t,n),s);return vb(o),o}async function Z0(e,t){const n=Th(e,t);vb(n);const s=si();return s.isDesktop&&await s.bridge.writeDesktopConfig(n),n}function e1(){const e=mb();return{platform:e,hostBaseUrl:uf(e),releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:"zh-CN",defaultPermissionMode:"default"}}class t1{constructor(){Ze(this,"state",e1());Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state)}hydrate(t){this.state=t,this.emit()}async initialize(){const t=await J0();return this.hydrate(t),t}async update(t){const n=await Z0(this.state,t);return this.hydrate(n),n}emit(){for(const t of this.listeners)t()}}const cn=new t1;function Rc(e){return w.useSyncExternalStore(cn.subscribe,()=>e(cn.getState()))}async function n1(){const e=si();return await cn.initialize(),{platform:e.platform}}var qn=lb();const r1=To(qn),i1=ob({__proto__:null,default:r1},[qn]);/**
42
- * @remix-run/router v1.23.2
43
- *
44
- * Copyright (c) Remix Software Inc.
45
- *
46
- * This source code is licensed under the MIT license found in the
47
- * LICENSE.md file in the root directory of this source tree.
48
- *
49
- * @license MIT
50
- */function tn(){return tn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},tn.apply(this,arguments)}var yn;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(yn||(yn={}));const Ig="popstate";function s1(e){e===void 0&&(e={});function t(s,o){let{pathname:c,search:l,hash:d}=s.location;return wo("",{pathname:c,search:l,hash:d},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(s,o){return typeof o=="string"?o:Po(o)}return o1(t,n,null,e)}function Et(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function vs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function a1(){return Math.random().toString(36).substr(2,8)}function Dg(e,t){return{usr:e.state,key:e.key,idx:t}}function wo(e,t,n,s){return n===void 0&&(n=null),tn({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Wi(t):t,{state:n,key:t&&t.key||s||a1()})}function Po(e){let{pathname:t="/",search:n="",hash:s=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function Wi(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function o1(e,t,n,s){s===void 0&&(s={});let{window:o=document.defaultView,v5Compat:c=!1}=s,l=o.history,d=yn.Pop,p=null,m=y();m==null&&(m=0,l.replaceState(tn({},l.state,{idx:m}),""));function y(){return(l.state||{idx:null}).idx}function g(){d=yn.Pop;let j=y(),M=j==null?null:j-m;m=j,p&&p({action:d,location:S.location,delta:M})}function b(j,M){d=yn.Push;let A=wo(S.location,j,M);m=y()+1;let E=Dg(A,m),Z=S.createHref(A);try{l.pushState(E,"",Z)}catch(Y){if(Y instanceof DOMException&&Y.name==="DataCloneError")throw Y;o.location.assign(Z)}c&&p&&p({action:d,location:S.location,delta:1})}function x(j,M){d=yn.Replace;let A=wo(S.location,j,M);m=y();let E=Dg(A,m),Z=S.createHref(A);l.replaceState(E,"",Z),c&&p&&p({action:d,location:S.location,delta:0})}function C(j){let M=o.location.origin!=="null"?o.location.origin:o.location.href,A=typeof j=="string"?j:Po(j);return A=A.replace(/ $/,"%20"),Et(M,"No window.location.(origin|href) available to create URL for href: "+A),new URL(A,M)}let S={get action(){return d},get location(){return e(o,l)},listen(j){if(p)throw new Error("A history only accepts one active listener");return o.addEventListener(Ig,g),p=j,()=>{o.removeEventListener(Ig,g),p=null}},createHref(j){return t(o,j)},createURL:C,encodeLocation(j){let M=C(j);return{pathname:M.pathname,search:M.search,hash:M.hash}},push:b,replace:x,go(j){return l.go(j)}};return S}var zt;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(zt||(zt={}));const l1=new Set(["lazy","caseSensitive","path","id","index","children"]);function c1(e){return e.index===!0}function mc(e,t,n,s){return n===void 0&&(n=[]),s===void 0&&(s={}),e.map((o,c)=>{let l=[...n,String(c)],d=typeof o.id=="string"?o.id:l.join("-");if(Et(o.index!==!0||!o.children,"Cannot specify children on an index route"),Et(!s[d],'Found a route id collision on id "'+d+`". Route id's must be globally unique within Data Router usages`),c1(o)){let p=tn({},o,t(o),{id:d});return s[d]=p,p}else{let p=tn({},o,t(o),{id:d,children:void 0});return s[d]=p,o.children&&(p.children=mc(o.children,t,l,s)),p}})}function fs(e,t,n){return n===void 0&&(n="/"),ac(e,t,n,!1)}function ac(e,t,n,s){let o=typeof t=="string"?Wi(t):t,c=Eo(o.pathname||"/",n);if(c==null)return null;let l=wb(e);d1(l);let d=null;for(let p=0;d==null&&p<l.length;++p){let m=k1(c);d=b1(l[p],m,s)}return d}function u1(e,t){let{route:n,pathname:s,params:o}=e;return{id:n.id,pathname:s,params:o,data:t[n.id],handle:n.handle}}function wb(e,t,n,s){t===void 0&&(t=[]),n===void 0&&(n=[]),s===void 0&&(s="");let o=(c,l,d)=>{let p={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:l,route:c};p.relativePath.startsWith("/")&&(Et(p.relativePath.startsWith(s),'Absolute route path "'+p.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),p.relativePath=p.relativePath.slice(s.length));let m=zi([s,p.relativePath]),y=n.concat(p);c.children&&c.children.length>0&&(Et(c.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+m+'".')),wb(c.children,t,y,m)),!(c.path==null&&!c.index)&&t.push({path:m,score:v1(m,c.index),routesMeta:y})};return e.forEach((c,l)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))o(c,l);else for(let p of bb(c.path))o(c,l,p)}),t}function bb(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,o=n.endsWith("?"),c=n.replace(/\?$/,"");if(s.length===0)return o?[c,""]:[c];let l=bb(s.join("/")),d=[];return d.push(...l.map(p=>p===""?c:[c,p].join("/"))),o&&d.push(...l),d.map(p=>e.startsWith("/")&&p===""?"/":p)}function d1(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:w1(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const h1=/^:[\w-]+$/,f1=3,p1=2,m1=1,g1=10,y1=-2,_g=e=>e==="*";function v1(e,t){let n=e.split("/"),s=n.length;return n.some(_g)&&(s+=y1),t&&(s+=p1),n.filter(o=>!_g(o)).reduce((o,c)=>o+(h1.test(c)?f1:c===""?m1:g1),s)}function w1(e,t){return e.length===t.length&&e.slice(0,-1).every((s,o)=>s===t[o])?e[e.length-1]-t[t.length-1]:0}function b1(e,t,n){n===void 0&&(n=!1);let{routesMeta:s}=e,o={},c="/",l=[];for(let d=0;d<s.length;++d){let p=s[d],m=d===s.length-1,y=c==="/"?t:t.slice(c.length)||"/",g=kn({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},y),b=p.route;if(!g&&m&&n&&!s[s.length-1].route.index&&(g=kn({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},y)),!g)return null;Object.assign(o,g.params),l.push({params:o,pathname:zi([c,g.pathname]),pathnameBase:N1(zi([c,g.pathnameBase])),route:b}),g.pathnameBase!=="/"&&(c=zi([c,g.pathnameBase]))}return l}function kn(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,s]=x1(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let c=o[0],l=c.replace(/(.)\/+$/,"$1"),d=o.slice(1);return{params:s.reduce((m,y,g)=>{let{paramName:b,isOptional:x}=y;if(b==="*"){let S=d[g]||"";l=c.slice(0,c.length-S.length).replace(/(.)\/+$/,"$1")}const C=d[g];return x&&!C?m[b]=void 0:m[b]=(C||"").replace(/%2F/g,"/"),m},{}),pathname:c,pathnameBase:l,pattern:e}}function x1(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),vs(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 s=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,d,p)=>(s.push({paramName:d,isOptional:p!=null}),p?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),s]}function k1(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return vs(!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 Eo(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}const S1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,C1=e=>S1.test(e);function j1(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:o=""}=typeof e=="string"?Wi(e):e,c;if(n)if(C1(n))c=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),vs(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?c=Fg(n.substring(1),"/"):c=Fg(n,t)}else c=t;return{pathname:c,search:T1(s),hash:P1(o)}}function Fg(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function jd(e,t,n,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function xb(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function df(e,t){let n=xb(e);return t?n.map((s,o)=>o===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function hf(e,t,n,s){s===void 0&&(s=!1);let o;typeof e=="string"?o=Wi(e):(o=tn({},e),Et(!o.pathname||!o.pathname.includes("?"),jd("?","pathname","search",o)),Et(!o.pathname||!o.pathname.includes("#"),jd("#","pathname","hash",o)),Et(!o.search||!o.search.includes("#"),jd("#","search","hash",o)));let c=e===""||o.pathname==="",l=c?"/":o.pathname,d;if(l==null)d=n;else{let g=t.length-1;if(!s&&l.startsWith("..")){let b=l.split("/");for(;b[0]==="..";)b.shift(),g-=1;o.pathname=b.join("/")}d=g>=0?t[g]:"/"}let p=j1(o,d),m=l&&l!=="/"&&l.endsWith("/"),y=(c||l===".")&&n.endsWith("/");return!p.pathname.endsWith("/")&&(m||y)&&(p.pathname+="/"),p}const zi=e=>e.join("/").replace(/\/\/+/g,"/"),N1=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),T1=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,P1=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class gc{constructor(t,n,s,o){o===void 0&&(o=!1),this.status=t,this.statusText=n||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}}function bo(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const kb=["post","put","patch","delete"],E1=new Set(kb),R1=["get",...kb],M1=new Set(R1),A1=new Set([301,302,303,307,308]),L1=new Set([307,308]),Nd={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},I1={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Qa={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},ff=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,D1=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Sb="remix-router-transitions";function _1(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",s=!n;Et(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let o;if(e.mapRouteProperties)o=e.mapRouteProperties;else if(e.detectErrorBoundary){let T=e.detectErrorBoundary;o=O=>({hasErrorBoundary:T(O)})}else o=D1;let c={},l=mc(e.routes,o,void 0,c),d,p=e.basename||"/",m=e.dataStrategy||U1,y=e.patchRoutesOnNavigation,g=tn({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),b=null,x=new Set,C=null,S=null,j=null,M=e.hydrationData!=null,A=fs(l,e.history.location,p),E=!1,Z=null;if(A==null&&!y){let T=ir(404,{pathname:e.history.location.pathname}),{matches:O,route:H}=Kg(l);A=O,Z={[H.id]:T}}A&&!e.hydrationData&&pn(A,l,e.history.location.pathname).active&&(A=null);let Y;if(A)if(A.some(T=>T.route.lazy))Y=!1;else if(!A.some(T=>T.route.loader))Y=!0;else if(g.v7_partialHydration){let T=e.hydrationData?e.hydrationData.loaderData:null,O=e.hydrationData?e.hydrationData.errors:null;if(O){let H=A.findIndex(oe=>O[oe.route.id]!==void 0);Y=A.slice(0,H+1).every(oe=>!Eh(oe.route,T,O))}else Y=A.every(H=>!Eh(H.route,T,O))}else Y=e.hydrationData!=null;else if(Y=!1,A=[],g.v7_partialHydration){let T=pn(null,l,e.history.location.pathname);T.active&&T.matches&&(E=!0,A=T.matches)}let B,I={historyAction:e.history.action,location:e.history.location,matches:A,initialized:Y,navigation:Nd,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||Z,fetchers:new Map,blockers:new Map},_=yn.Pop,F=!1,R,W=!1,J=new Map,re=null,le=!1,ie=!1,xe=[],q=new Set,K=new Map,me=0,L=-1,$=new Map,se=new Set,P=new Map,be=new Map,ke=new Set,ve=new Map,Ae=new Map,Be;function qe(){if(b=e.history.listen(T=>{let{action:O,location:H,delta:oe}=T;if(Be){Be(),Be=void 0;return}vs(Ae.size===0||oe!=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 ye=Ft({currentLocation:I.location,nextLocation:H,historyAction:O});if(ye&&oe!=null){let Re=new Promise(Ge=>{Be=Ge});e.history.go(oe*-1),Pt(ye,{state:"blocked",location:H,proceed(){Pt(ye,{state:"proceeding",proceed:void 0,reset:void 0,location:H}),Re.then(()=>e.history.go(oe))},reset(){let Ge=new Map(I.blockers);Ge.set(ye,Qa),ze({blockers:Ge})}});return}return bt(O,H)}),n){ej(t,J);let T=()=>tj(t,J);t.addEventListener("pagehide",T),re=()=>t.removeEventListener("pagehide",T)}return I.initialized||bt(yn.Pop,I.location,{initialHydration:!0}),B}function nt(){b&&b(),re&&re(),x.clear(),R&&R.abort(),I.fetchers.forEach((T,O)=>ut(O)),I.blockers.forEach((T,O)=>St(O))}function wt(T){return x.add(T),()=>x.delete(T)}function ze(T,O){O===void 0&&(O={}),I=tn({},I,T);let H=[],oe=[];g.v7_fetcherPersist&&I.fetchers.forEach((ye,Re)=>{ye.state==="idle"&&(ke.has(Re)?oe.push(Re):H.push(Re))}),ke.forEach(ye=>{!I.fetchers.has(ye)&&!K.has(ye)&&oe.push(ye)}),[...x].forEach(ye=>ye(I,{deletedFetchers:oe,viewTransitionOpts:O.viewTransitionOpts,flushSync:O.flushSync===!0})),g.v7_fetcherPersist?(H.forEach(ye=>I.fetchers.delete(ye)),oe.forEach(ye=>ut(ye))):oe.forEach(ye=>ke.delete(ye))}function Ot(T,O,H){var oe,ye;let{flushSync:Re}=H===void 0?{}:H,Ge=I.actionData!=null&&I.navigation.formMethod!=null&&Gr(I.navigation.formMethod)&&I.navigation.state==="loading"&&((oe=T.state)==null?void 0:oe._isRedirect)!==!0,Ie;O.actionData?Object.keys(O.actionData).length>0?Ie=O.actionData:Ie=null:Ge?Ie=I.actionData:Ie=null;let Oe=O.loaderData?qg(I.loaderData,O.loaderData,O.matches||[],O.errors):I.loaderData,Me=I.blockers;Me.size>0&&(Me=new Map(Me),Me.forEach((ee,_e)=>Me.set(_e,Qa)));let U=F===!0||I.navigation.formMethod!=null&&Gr(I.navigation.formMethod)&&((ye=T.state)==null?void 0:ye._isRedirect)!==!0;d&&(l=d,d=void 0),le||_===yn.Pop||(_===yn.Push?e.history.push(T,T.state):_===yn.Replace&&e.history.replace(T,T.state));let fe;if(_===yn.Pop){let ee=J.get(I.location.pathname);ee&&ee.has(T.pathname)?fe={currentLocation:I.location,nextLocation:T}:J.has(T.pathname)&&(fe={currentLocation:T,nextLocation:I.location})}else if(W){let ee=J.get(I.location.pathname);ee?ee.add(T.pathname):(ee=new Set([T.pathname]),J.set(I.location.pathname,ee)),fe={currentLocation:I.location,nextLocation:T}}ze(tn({},O,{actionData:Ie,loaderData:Oe,historyAction:_,location:T,initialized:!0,navigation:Nd,revalidation:"idle",restoreScrollPosition:Pn(T,O.matches||I.matches),preventScrollReset:U,blockers:Me}),{viewTransitionOpts:fe,flushSync:Re===!0}),_=yn.Pop,F=!1,W=!1,le=!1,ie=!1,xe=[]}async function Je(T,O){if(typeof T=="number"){e.history.go(T);return}let H=Ph(I.location,I.matches,p,g.v7_prependBasename,T,g.v7_relativeSplatPath,O==null?void 0:O.fromRouteId,O==null?void 0:O.relative),{path:oe,submission:ye,error:Re}=Og(g.v7_normalizeFormMethod,!1,H,O),Ge=I.location,Ie=wo(I.location,oe,O&&O.state);Ie=tn({},Ie,e.history.encodeLocation(Ie));let Oe=O&&O.replace!=null?O.replace:void 0,Me=yn.Push;Oe===!0?Me=yn.Replace:Oe===!1||ye!=null&&Gr(ye.formMethod)&&ye.formAction===I.location.pathname+I.location.search&&(Me=yn.Replace);let U=O&&"preventScrollReset"in O?O.preventScrollReset===!0:void 0,fe=(O&&O.flushSync)===!0,ee=Ft({currentLocation:Ge,nextLocation:Ie,historyAction:Me});if(ee){Pt(ee,{state:"blocked",location:Ie,proceed(){Pt(ee,{state:"proceeding",proceed:void 0,reset:void 0,location:Ie}),Je(T,O)},reset(){let _e=new Map(I.blockers);_e.set(ee,Qa),ze({blockers:_e})}});return}return await bt(Me,Ie,{submission:ye,pendingError:Re,preventScrollReset:U,replace:O&&O.replace,enableViewTransition:O&&O.viewTransition,flushSync:fe})}function _t(){if(Se(),ze({revalidation:"loading"}),I.navigation.state!=="submitting"){if(I.navigation.state==="idle"){bt(I.historyAction,I.location,{startUninterruptedRevalidation:!0});return}bt(_||I.historyAction,I.navigation.location,{overrideNavigation:I.navigation,enableViewTransition:W===!0})}}async function bt(T,O,H){R&&R.abort(),R=null,_=T,le=(H&&H.startUninterruptedRevalidation)===!0,vn(I.location,I.matches),F=(H&&H.preventScrollReset)===!0,W=(H&&H.enableViewTransition)===!0;let oe=d||l,ye=H&&H.overrideNavigation,Re=H!=null&&H.initialHydration&&I.matches&&I.matches.length>0&&!E?I.matches:fs(oe,O,p),Ge=(H&&H.flushSync)===!0;if(Re&&I.initialized&&!ie&&q1(I.location,O)&&!(H&&H.submission&&Gr(H.submission.formMethod))){Ot(O,{matches:Re},{flushSync:Ge});return}let Ie=pn(Re,oe,O.pathname);if(Ie.active&&Ie.matches&&(Re=Ie.matches),!Re){let{error:De,notFoundMatches:Ue,route:ot}=At(O.pathname);Ot(O,{matches:Ue,loaderData:{},errors:{[ot.id]:De}},{flushSync:Ge});return}R=new AbortController;let Oe=Ys(e.history,O,R.signal,H&&H.submission),Me;if(H&&H.pendingError)Me=[ps(Re).route.id,{type:zt.error,error:H.pendingError}];else if(H&&H.submission&&Gr(H.submission.formMethod)){let De=await et(Oe,O,H.submission,Re,Ie.active,{replace:H.replace,flushSync:Ge});if(De.shortCircuited)return;if(De.pendingActionResult){let[Ue,ot]=De.pendingActionResult;if(wr(ot)&&bo(ot.error)&&ot.error.status===404){R=null,Ot(O,{matches:De.matches,loaderData:{},errors:{[Ue]:ot.error}});return}}Re=De.matches||Re,Me=De.pendingActionResult,ye=Td(O,H.submission),Ge=!1,Ie.active=!1,Oe=Ys(e.history,Oe.url,Oe.signal)}let{shortCircuited:U,matches:fe,loaderData:ee,errors:_e}=await pt(Oe,O,Re,Ie.active,ye,H&&H.submission,H&&H.fetcherSubmission,H&&H.replace,H&&H.initialHydration===!0,Ge,Me);U||(R=null,Ot(O,tn({matches:fe||Re},Gg(Me),{loaderData:ee,errors:_e})))}async function et(T,O,H,oe,ye,Re){Re===void 0&&(Re={}),Se();let Ge=J1(O,H);if(ze({navigation:Ge},{flushSync:Re.flushSync===!0}),ye){let Me=await an(oe,O.pathname,T.signal);if(Me.type==="aborted")return{shortCircuited:!0};if(Me.type==="error"){let U=ps(Me.partialMatches).route.id;return{matches:Me.partialMatches,pendingActionResult:[U,{type:zt.error,error:Me.error}]}}else if(Me.matches)oe=Me.matches;else{let{notFoundMatches:U,error:fe,route:ee}=At(O.pathname);return{matches:U,pendingActionResult:[ee.id,{type:zt.error,error:fe}]}}}let Ie,Oe=so(oe,O);if(!Oe.route.action&&!Oe.route.lazy)Ie={type:zt.error,error:ir(405,{method:T.method,pathname:O.pathname,routeId:Oe.route.id})};else if(Ie=(await Tt("action",I,T,[Oe],oe,null))[Oe.route.id],T.signal.aborted)return{shortCircuited:!0};if(gs(Ie)){let Me;return Re&&Re.replace!=null?Me=Re.replace:Me=Hg(Ie.response.headers.get("Location"),new URL(T.url),p,e.history)===I.location.pathname+I.location.search,await tt(T,Ie,!0,{submission:H,replace:Me}),{shortCircuited:!0}}if(Bi(Ie))throw ir(400,{type:"defer-action"});if(wr(Ie)){let Me=ps(oe,Oe.route.id);return(Re&&Re.replace)!==!0&&(_=yn.Push),{matches:oe,pendingActionResult:[Me.route.id,Ie]}}return{matches:oe,pendingActionResult:[Oe.route.id,Ie]}}async function pt(T,O,H,oe,ye,Re,Ge,Ie,Oe,Me,U){let fe=ye||Td(O,Re),ee=Re||Ge||Yg(fe),_e=!le&&(!g.v7_partialHydration||!Oe);if(oe){if(_e){let pe=Nt(U);ze(tn({navigation:fe},pe!==void 0?{actionData:pe}:{}),{flushSync:Me})}let we=await an(H,O.pathname,T.signal);if(we.type==="aborted")return{shortCircuited:!0};if(we.type==="error"){let pe=ps(we.partialMatches).route.id;return{matches:we.partialMatches,loaderData:{},errors:{[pe]:we.error}}}else if(we.matches)H=we.matches;else{let{error:pe,notFoundMatches:at,route:ht}=At(O.pathname);return{matches:at,loaderData:{},errors:{[ht.id]:pe}}}}let De=d||l,[Ue,ot]=Ug(e.history,I,H,ee,O,g.v7_partialHydration&&Oe===!0,g.v7_skipActionErrorRevalidation,ie,xe,q,ke,P,se,De,p,U);if(Yt(we=>!(H&&H.some(pe=>pe.route.id===we))||Ue&&Ue.some(pe=>pe.route.id===we)),L=++me,Ue.length===0&&ot.length===0){let we=mt();return Ot(O,tn({matches:H,loaderData:{},errors:U&&wr(U[1])?{[U[0]]:U[1].error}:null},Gg(U),we?{fetchers:new Map(I.fetchers)}:{}),{flushSync:Me}),{shortCircuited:!0}}if(_e){let we={};if(!oe){we.navigation=fe;let pe=Nt(U);pe!==void 0&&(we.actionData=pe)}ot.length>0&&(we.fetchers=Bt(ot)),ze(we,{flushSync:Me})}ot.forEach(we=>{dt(we.key),we.controller&&K.set(we.key,we.controller)});let un=()=>ot.forEach(we=>dt(we.key));R&&R.signal.addEventListener("abort",un);let{loaderResults:Ln,fetcherResults:on}=await ce(I,H,Ue,ot,T);if(T.signal.aborted)return{shortCircuited:!0};R&&R.signal.removeEventListener("abort",un),ot.forEach(we=>K.delete(we.key));let vt=zl(Ln);if(vt)return await tt(T,vt.result,!0,{replace:Ie}),{shortCircuited:!0};if(vt=zl(on),vt)return se.add(vt.key),await tt(T,vt.result,!0,{replace:Ie}),{shortCircuited:!0};let{loaderData:kr,errors:Kn}=Vg(I,H,Ln,U,ot,on,ve);ve.forEach((we,pe)=>{we.subscribe(at=>{(at||we.done)&&ve.delete(pe)})}),g.v7_partialHydration&&Oe&&I.errors&&(Kn=tn({},I.errors,Kn));let Qn=mt(),Yn=ct(L),Q=Qn||Yn||ot.length>0;return tn({matches:H,loaderData:kr,errors:Kn},Q?{fetchers:new Map(I.fetchers)}:{})}function Nt(T){if(T&&!wr(T[1]))return{[T[0]]:T[1].data};if(I.actionData)return Object.keys(I.actionData).length===0?null:I.actionData}function Bt(T){return T.forEach(O=>{let H=I.fetchers.get(O.key),oe=Ya(void 0,H?H.data:void 0);I.fetchers.set(O.key,oe)}),new Map(I.fetchers)}function Rt(T,O,H,oe){if(s)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.");dt(T);let ye=(oe&&oe.flushSync)===!0,Re=d||l,Ge=Ph(I.location,I.matches,p,g.v7_prependBasename,H,g.v7_relativeSplatPath,O,oe==null?void 0:oe.relative),Ie=fs(Re,Ge,p),Oe=pn(Ie,Re,Ge);if(Oe.active&&Oe.matches&&(Ie=Oe.matches),!Ie){de(T,O,ir(404,{pathname:Ge}),{flushSync:ye});return}let{path:Me,submission:U,error:fe}=Og(g.v7_normalizeFormMethod,!0,Ge,oe);if(fe){de(T,O,fe,{flushSync:ye});return}let ee=so(Ie,Me),_e=(oe&&oe.preventScrollReset)===!0;if(U&&Gr(U.formMethod)){ne(T,O,Me,ee,Ie,Oe.active,ye,_e,U);return}P.set(T,{routeId:O,path:Me}),He(T,O,Me,ee,Ie,Oe.active,ye,_e,U)}async function ne(T,O,H,oe,ye,Re,Ge,Ie,Oe){Se(),P.delete(T);function Me(Fe){if(!Fe.route.action&&!Fe.route.lazy){let $t=ir(405,{method:Oe.formMethod,pathname:H,routeId:O});return de(T,O,$t,{flushSync:Ge}),!0}return!1}if(!Re&&Me(oe))return;let U=I.fetchers.get(T);Le(T,Z1(Oe,U),{flushSync:Ge});let fe=new AbortController,ee=Ys(e.history,H,fe.signal,Oe);if(Re){let Fe=await an(ye,new URL(ee.url).pathname,ee.signal,T);if(Fe.type==="aborted")return;if(Fe.type==="error"){de(T,O,Fe.error,{flushSync:Ge});return}else if(Fe.matches){if(ye=Fe.matches,oe=so(ye,H),Me(oe))return}else{de(T,O,ir(404,{pathname:H}),{flushSync:Ge});return}}K.set(T,fe);let _e=me,Ue=(await Tt("action",I,ee,[oe],ye,T))[oe.route.id];if(ee.signal.aborted){K.get(T)===fe&&K.delete(T);return}if(g.v7_fetcherPersist&&ke.has(T)){if(gs(Ue)||wr(Ue)){Le(T,_i(void 0));return}}else{if(gs(Ue))if(K.delete(T),L>_e){Le(T,_i(void 0));return}else return se.add(T),Le(T,Ya(Oe)),tt(ee,Ue,!1,{fetcherSubmission:Oe,preventScrollReset:Ie});if(wr(Ue)){de(T,O,Ue.error);return}}if(Bi(Ue))throw ir(400,{type:"defer-action"});let ot=I.navigation.location||I.location,un=Ys(e.history,ot,fe.signal),Ln=d||l,on=I.navigation.state!=="idle"?fs(Ln,I.navigation.location,p):I.matches;Et(on,"Didn't find any matches after fetcher action");let vt=++me;$.set(T,vt);let kr=Ya(Oe,Ue.data);I.fetchers.set(T,kr);let[Kn,Qn]=Ug(e.history,I,on,Oe,ot,!1,g.v7_skipActionErrorRevalidation,ie,xe,q,ke,P,se,Ln,p,[oe.route.id,Ue]);Qn.filter(Fe=>Fe.key!==T).forEach(Fe=>{let $t=Fe.key,Ut=I.fetchers.get($t),cr=Ya(void 0,Ut?Ut.data:void 0);I.fetchers.set($t,cr),dt($t),Fe.controller&&K.set($t,Fe.controller)}),ze({fetchers:new Map(I.fetchers)});let Yn=()=>Qn.forEach(Fe=>dt(Fe.key));fe.signal.addEventListener("abort",Yn);let{loaderResults:Q,fetcherResults:we}=await ce(I,on,Kn,Qn,un);if(fe.signal.aborted)return;fe.signal.removeEventListener("abort",Yn),$.delete(T),K.delete(T),Qn.forEach(Fe=>K.delete(Fe.key));let pe=zl(Q);if(pe)return tt(un,pe.result,!1,{preventScrollReset:Ie});if(pe=zl(we),pe)return se.add(pe.key),tt(un,pe.result,!1,{preventScrollReset:Ie});let{loaderData:at,errors:ht}=Vg(I,on,Q,void 0,Qn,we,ve);if(I.fetchers.has(T)){let Fe=_i(Ue.data);I.fetchers.set(T,Fe)}ct(vt),I.navigation.state==="loading"&&vt>L?(Et(_,"Expected pending action"),R&&R.abort(),Ot(I.navigation.location,{matches:on,loaderData:at,errors:ht,fetchers:new Map(I.fetchers)})):(ze({errors:ht,loaderData:qg(I.loaderData,at,on,ht),fetchers:new Map(I.fetchers)}),ie=!1)}async function He(T,O,H,oe,ye,Re,Ge,Ie,Oe){let Me=I.fetchers.get(T);Le(T,Ya(Oe,Me?Me.data:void 0),{flushSync:Ge});let U=new AbortController,fe=Ys(e.history,H,U.signal);if(Re){let Ue=await an(ye,new URL(fe.url).pathname,fe.signal,T);if(Ue.type==="aborted")return;if(Ue.type==="error"){de(T,O,Ue.error,{flushSync:Ge});return}else if(Ue.matches)ye=Ue.matches,oe=so(ye,H);else{de(T,O,ir(404,{pathname:H}),{flushSync:Ge});return}}K.set(T,U);let ee=me,De=(await Tt("loader",I,fe,[oe],ye,T))[oe.route.id];if(Bi(De)&&(De=await pf(De,fe.signal,!0)||De),K.get(T)===U&&K.delete(T),!fe.signal.aborted){if(ke.has(T)){Le(T,_i(void 0));return}if(gs(De))if(L>ee){Le(T,_i(void 0));return}else{se.add(T),await tt(fe,De,!1,{preventScrollReset:Ie});return}if(wr(De)){de(T,O,De.error);return}Et(!Bi(De),"Unhandled fetcher deferred data"),Le(T,_i(De.data))}}async function tt(T,O,H,oe){let{submission:ye,fetcherSubmission:Re,preventScrollReset:Ge,replace:Ie}=oe===void 0?{}:oe;O.response.headers.has("X-Remix-Revalidate")&&(ie=!0);let Oe=O.response.headers.get("Location");Et(Oe,"Expected a Location header on the redirect Response"),Oe=Hg(Oe,new URL(T.url),p,e.history);let Me=wo(I.location,Oe,{_isRedirect:!0});if(n){let Ue=!1;if(O.response.headers.has("X-Remix-Reload-Document"))Ue=!0;else if(ff.test(Oe)){const ot=e.history.createURL(Oe);Ue=ot.origin!==t.location.origin||Eo(ot.pathname,p)==null}if(Ue){Ie?t.location.replace(Oe):t.location.assign(Oe);return}}R=null;let U=Ie===!0||O.response.headers.has("X-Remix-Replace")?yn.Replace:yn.Push,{formMethod:fe,formAction:ee,formEncType:_e}=I.navigation;!ye&&!Re&&fe&&ee&&_e&&(ye=Yg(I.navigation));let De=ye||Re;if(L1.has(O.response.status)&&De&&Gr(De.formMethod))await bt(U,Me,{submission:tn({},De,{formAction:Oe}),preventScrollReset:Ge||F,enableViewTransition:H?W:void 0});else{let Ue=Td(Me,ye);await bt(U,Me,{overrideNavigation:Ue,fetcherSubmission:Re,preventScrollReset:Ge||F,enableViewTransition:H?W:void 0})}}async function Tt(T,O,H,oe,ye,Re){let Ge,Ie={};try{Ge=await z1(m,T,O,H,oe,ye,Re,c,o)}catch(Oe){return oe.forEach(Me=>{Ie[Me.route.id]={type:zt.error,error:Oe}}),Ie}for(let[Oe,Me]of Object.entries(Ge))if(G1(Me)){let U=Me.result;Ie[Oe]={type:zt.redirect,response:$1(U,H,Oe,ye,p,g.v7_relativeSplatPath)}}else Ie[Oe]=await H1(Me);return Ie}async function ce(T,O,H,oe,ye){let Re=T.matches,Ge=Tt("loader",T,ye,H,O,null),Ie=Promise.all(oe.map(async U=>{if(U.matches&&U.match&&U.controller){let ee=(await Tt("loader",T,Ys(e.history,U.path,U.controller.signal),[U.match],U.matches,U.key))[U.match.route.id];return{[U.key]:ee}}else return Promise.resolve({[U.key]:{type:zt.error,error:ir(404,{pathname:U.path})}})})),Oe=await Ge,Me=(await Ie).reduce((U,fe)=>Object.assign(U,fe),{});return await Promise.all([Y1(O,Oe,ye.signal,Re,T.loaderData),X1(O,Me,oe)]),{loaderResults:Oe,fetcherResults:Me}}function Se(){ie=!0,xe.push(...Yt()),P.forEach((T,O)=>{K.has(O)&&q.add(O),dt(O)})}function Le(T,O,H){H===void 0&&(H={}),I.fetchers.set(T,O),ze({fetchers:new Map(I.fetchers)},{flushSync:(H&&H.flushSync)===!0})}function de(T,O,H,oe){oe===void 0&&(oe={});let ye=ps(I.matches,O);ut(T),ze({errors:{[ye.route.id]:H},fetchers:new Map(I.fetchers)},{flushSync:(oe&&oe.flushSync)===!0})}function Ne(T){return be.set(T,(be.get(T)||0)+1),ke.has(T)&&ke.delete(T),I.fetchers.get(T)||I1}function ut(T){let O=I.fetchers.get(T);K.has(T)&&!(O&&O.state==="loading"&&$.has(T))&&dt(T),P.delete(T),$.delete(T),se.delete(T),g.v7_fetcherPersist&&ke.delete(T),q.delete(T),I.fetchers.delete(T)}function Wt(T){let O=(be.get(T)||0)-1;O<=0?(be.delete(T),ke.add(T),g.v7_fetcherPersist||ut(T)):be.set(T,O),ze({fetchers:new Map(I.fetchers)})}function dt(T){let O=K.get(T);O&&(O.abort(),K.delete(T))}function xt(T){for(let O of T){let H=Ne(O),oe=_i(H.data);I.fetchers.set(O,oe)}}function mt(){let T=[],O=!1;for(let H of se){let oe=I.fetchers.get(H);Et(oe,"Expected fetcher: "+H),oe.state==="loading"&&(se.delete(H),T.push(H),O=!0)}return xt(T),O}function ct(T){let O=[];for(let[H,oe]of $)if(oe<T){let ye=I.fetchers.get(H);Et(ye,"Expected fetcher: "+H),ye.state==="loading"&&(dt(H),$.delete(H),O.push(H))}return xt(O),O.length>0}function Ht(T,O){let H=I.blockers.get(T)||Qa;return Ae.get(T)!==O&&Ae.set(T,O),H}function St(T){I.blockers.delete(T),Ae.delete(T)}function Pt(T,O){let H=I.blockers.get(T)||Qa;Et(H.state==="unblocked"&&O.state==="blocked"||H.state==="blocked"&&O.state==="blocked"||H.state==="blocked"&&O.state==="proceeding"||H.state==="blocked"&&O.state==="unblocked"||H.state==="proceeding"&&O.state==="unblocked","Invalid blocker state transition: "+H.state+" -> "+O.state);let oe=new Map(I.blockers);oe.set(T,O),ze({blockers:oe})}function Ft(T){let{currentLocation:O,nextLocation:H,historyAction:oe}=T;if(Ae.size===0)return;Ae.size>1&&vs(!1,"A router only supports one blocker at a time");let ye=Array.from(Ae.entries()),[Re,Ge]=ye[ye.length-1],Ie=I.blockers.get(Re);if(!(Ie&&Ie.state==="proceeding")&&Ge({currentLocation:O,nextLocation:H,historyAction:oe}))return Re}function At(T){let O=ir(404,{pathname:T}),H=d||l,{matches:oe,route:ye}=Kg(H);return Yt(),{notFoundMatches:oe,route:ye,error:O}}function Yt(T){let O=[];return ve.forEach((H,oe)=>{(!T||T(oe))&&(H.cancel(),O.push(oe),ve.delete(oe))}),O}function Gt(T,O,H){if(C=T,j=O,S=H||null,!M&&I.navigation===Nd){M=!0;let oe=Pn(I.location,I.matches);oe!=null&&ze({restoreScrollPosition:oe})}return()=>{C=null,j=null,S=null}}function nn(T,O){return S&&S(T,O.map(oe=>u1(oe,I.loaderData)))||T.key}function vn(T,O){if(C&&j){let H=nn(T,O);C[H]=j()}}function Pn(T,O){if(C){let H=nn(T,O),oe=C[H];if(typeof oe=="number")return oe}return null}function pn(T,O,H){if(y)if(T){if(Object.keys(T[0].params).length>0)return{active:!0,matches:ac(O,H,p,!0)}}else return{active:!0,matches:ac(O,H,p,!0)||[]};return{active:!1,matches:null}}async function an(T,O,H,oe){if(!y)return{type:"success",matches:T};let ye=T;for(;;){let Re=d==null,Ge=d||l,Ie=c;try{await y({signal:H,path:O,matches:ye,fetcherKey:oe,patch:(U,fe)=>{H.aborted||Wg(U,fe,Ge,Ie,o)}})}catch(U){return{type:"error",error:U,partialMatches:ye}}finally{Re&&!H.aborted&&(l=[...l])}if(H.aborted)return{type:"aborted"};let Oe=fs(Ge,O,p);if(Oe)return{type:"success",matches:Oe};let Me=ac(Ge,O,p,!0);if(!Me||ye.length===Me.length&&ye.every((U,fe)=>U.route.id===Me[fe].route.id))return{type:"success",matches:null};ye=Me}}function An(T){c={},d=mc(T,o,void 0,c)}function D(T,O){let H=d==null;Wg(T,O,d||l,c,o),H&&(l=[...l],ze({}))}return B={get basename(){return p},get future(){return g},get state(){return I},get routes(){return l},get window(){return t},initialize:qe,subscribe:wt,enableScrollRestoration:Gt,navigate:Je,fetch:Rt,revalidate:_t,createHref:T=>e.history.createHref(T),encodeLocation:T=>e.history.encodeLocation(T),getFetcher:Ne,deleteFetcher:Wt,dispose:nt,getBlocker:Ht,deleteBlocker:St,patchRoutes:D,_internalFetchControllers:K,_internalActiveDeferreds:ve,_internalSetRoutes:An},B}function F1(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Ph(e,t,n,s,o,c,l,d){let p,m;if(l){p=[];for(let g of t)if(p.push(g),g.route.id===l){m=g;break}}else p=t,m=t[t.length-1];let y=hf(o||".",df(p,c),Eo(e.pathname,n)||e.pathname,d==="path");if(o==null&&(y.search=e.search,y.hash=e.hash),(o==null||o===""||o===".")&&m){let g=mf(y.search);if(m.route.index&&!g)y.search=y.search?y.search.replace(/^\?/,"?index&"):"?index";else if(!m.route.index&&g){let b=new URLSearchParams(y.search),x=b.getAll("index");b.delete("index"),x.filter(S=>S).forEach(S=>b.append("index",S));let C=b.toString();y.search=C?"?"+C:""}}return s&&n!=="/"&&(y.pathname=y.pathname==="/"?n:zi([n,y.pathname])),Po(y)}function Og(e,t,n,s){if(!s||!F1(s))return{path:n};if(s.formMethod&&!Q1(s.formMethod))return{path:n,error:ir(405,{method:s.formMethod})};let o=()=>({path:n,error:ir(400,{type:"invalid-body"})}),c=s.formMethod||"get",l=e?c.toUpperCase():c.toLowerCase(),d=Nb(n);if(s.body!==void 0){if(s.formEncType==="text/plain"){if(!Gr(l))return o();let b=typeof s.body=="string"?s.body:s.body instanceof FormData||s.body instanceof URLSearchParams?Array.from(s.body.entries()).reduce((x,C)=>{let[S,j]=C;return""+x+S+"="+j+`
51
- `},""):String(s.body);return{path:n,submission:{formMethod:l,formAction:d,formEncType:s.formEncType,formData:void 0,json:void 0,text:b}}}else if(s.formEncType==="application/json"){if(!Gr(l))return o();try{let b=typeof s.body=="string"?JSON.parse(s.body):s.body;return{path:n,submission:{formMethod:l,formAction:d,formEncType:s.formEncType,formData:void 0,json:b,text:void 0}}}catch{return o()}}}Et(typeof FormData=="function","FormData is not available in this environment");let p,m;if(s.formData)p=Rh(s.formData),m=s.formData;else if(s.body instanceof FormData)p=Rh(s.body),m=s.body;else if(s.body instanceof URLSearchParams)p=s.body,m=$g(p);else if(s.body==null)p=new URLSearchParams,m=new FormData;else try{p=new URLSearchParams(s.body),m=$g(p)}catch{return o()}let y={formMethod:l,formAction:d,formEncType:s&&s.formEncType||"application/x-www-form-urlencoded",formData:m,json:void 0,text:void 0};if(Gr(y.formMethod))return{path:n,submission:y};let g=Wi(n);return t&&g.search&&mf(g.search)&&p.append("index",""),g.search="?"+p,{path:Po(g),submission:y}}function Bg(e,t,n){n===void 0&&(n=!1);let s=e.findIndex(o=>o.route.id===t);return s>=0?e.slice(0,n?s+1:s):e}function Ug(e,t,n,s,o,c,l,d,p,m,y,g,b,x,C,S){let j=S?wr(S[1])?S[1].error:S[1].data:void 0,M=e.createURL(t.location),A=e.createURL(o),E=n;c&&t.errors?E=Bg(n,Object.keys(t.errors)[0],!0):S&&wr(S[1])&&(E=Bg(n,S[0]));let Z=S?S[1].statusCode:void 0,Y=l&&Z&&Z>=400,B=E.filter((_,F)=>{let{route:R}=_;if(R.lazy)return!0;if(R.loader==null)return!1;if(c)return Eh(R,t.loaderData,t.errors);if(O1(t.loaderData,t.matches[F],_)||p.some(re=>re===_.route.id))return!0;let W=t.matches[F],J=_;return zg(_,tn({currentUrl:M,currentParams:W.params,nextUrl:A,nextParams:J.params},s,{actionResult:j,actionStatus:Z,defaultShouldRevalidate:Y?!1:d||M.pathname+M.search===A.pathname+A.search||M.search!==A.search||Cb(W,J)}))}),I=[];return g.forEach((_,F)=>{if(c||!n.some(le=>le.route.id===_.routeId)||y.has(F))return;let R=fs(x,_.path,C);if(!R){I.push({key:F,routeId:_.routeId,path:_.path,matches:null,match:null,controller:null});return}let W=t.fetchers.get(F),J=so(R,_.path),re=!1;b.has(F)?re=!1:m.has(F)?(m.delete(F),re=!0):W&&W.state!=="idle"&&W.data===void 0?re=d:re=zg(J,tn({currentUrl:M,currentParams:t.matches[t.matches.length-1].params,nextUrl:A,nextParams:n[n.length-1].params},s,{actionResult:j,actionStatus:Z,defaultShouldRevalidate:Y?!1:d})),re&&I.push({key:F,routeId:_.routeId,path:_.path,matches:R,match:J,controller:new AbortController})}),[B,I]}function Eh(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let s=t!=null&&t[e.id]!==void 0,o=n!=null&&n[e.id]!==void 0;return!s&&o?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!s&&!o}function O1(e,t,n){let s=!t||n.route.id!==t.route.id,o=e[n.route.id]===void 0;return s||o}function Cb(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function zg(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Wg(e,t,n,s,o){var c;let l;if(e){let m=s[e];Et(m,"No route found to patch children into: routeId = "+e),m.children||(m.children=[]),l=m.children}else l=n;let d=t.filter(m=>!l.some(y=>jb(m,y))),p=mc(d,o,[e||"_","patch",String(((c=l)==null?void 0:c.length)||"0")],s);l.push(...p)}function jb(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((n,s)=>{var o;return(o=t.children)==null?void 0:o.some(c=>jb(n,c))}):!1}async function B1(e,t,n){if(!e.lazy)return;let s=await e.lazy();if(!e.lazy)return;let o=n[e.id];Et(o,"No route found in manifest");let c={};for(let l in s){let p=o[l]!==void 0&&l!=="hasErrorBoundary";vs(!p,'Route "'+o.id+'" has a static property "'+l+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+l+'" will be ignored.')),!p&&!l1.has(l)&&(c[l]=s[l])}Object.assign(o,c),Object.assign(o,tn({},t(o),{lazy:void 0}))}async function U1(e){let{matches:t}=e,n=t.filter(o=>o.shouldLoad);return(await Promise.all(n.map(o=>o.resolve()))).reduce((o,c,l)=>Object.assign(o,{[n[l].route.id]:c}),{})}async function z1(e,t,n,s,o,c,l,d,p,m){let y=c.map(x=>x.route.lazy?B1(x.route,p,d):void 0),g=c.map((x,C)=>{let S=y[C],j=o.some(A=>A.route.id===x.route.id);return tn({},x,{shouldLoad:j,resolve:async A=>(A&&s.method==="GET"&&(x.route.lazy||x.route.loader)&&(j=!0),j?W1(t,s,x,S,A,m):Promise.resolve({type:zt.data,result:void 0}))})}),b=await e({matches:g,request:s,params:c[0].params,fetcherKey:l,context:m});try{await Promise.all(y)}catch{}return b}async function W1(e,t,n,s,o,c){let l,d,p=m=>{let y,g=new Promise((C,S)=>y=S);d=()=>y(),t.signal.addEventListener("abort",d);let b=C=>typeof m!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):m({request:t,params:n.params,context:c},...C!==void 0?[C]:[]),x=(async()=>{try{return{type:"data",result:await(o?o(S=>b(S)):b())}}catch(C){return{type:"error",result:C}}})();return Promise.race([x,g])};try{let m=n.route[e];if(s)if(m){let y,[g]=await Promise.all([p(m).catch(b=>{y=b}),s]);if(y!==void 0)throw y;l=g}else if(await s,m=n.route[e],m)l=await p(m);else if(e==="action"){let y=new URL(t.url),g=y.pathname+y.search;throw ir(405,{method:t.method,pathname:g,routeId:n.route.id})}else return{type:zt.data,result:void 0};else if(m)l=await p(m);else{let y=new URL(t.url),g=y.pathname+y.search;throw ir(404,{pathname:g})}Et(l.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(m){return{type:zt.error,result:m}}finally{d&&t.signal.removeEventListener("abort",d)}return l}async function H1(e){let{result:t,type:n}=e;if(Tb(t)){let g;try{let b=t.headers.get("Content-Type");b&&/\bapplication\/json\b/.test(b)?t.body==null?g=null:g=await t.json():g=await t.text()}catch(b){return{type:zt.error,error:b}}return n===zt.error?{type:zt.error,error:new gc(t.status,t.statusText,g),statusCode:t.status,headers:t.headers}:{type:zt.data,data:g,statusCode:t.status,headers:t.headers}}if(n===zt.error){if(Qg(t)){var s,o;if(t.data instanceof Error){var c,l;return{type:zt.error,error:t.data,statusCode:(c=t.init)==null?void 0:c.status,headers:(l=t.init)!=null&&l.headers?new Headers(t.init.headers):void 0}}return{type:zt.error,error:new gc(((s=t.init)==null?void 0:s.status)||500,void 0,t.data),statusCode:bo(t)?t.status:void 0,headers:(o=t.init)!=null&&o.headers?new Headers(t.init.headers):void 0}}return{type:zt.error,error:t,statusCode:bo(t)?t.status:void 0}}if(K1(t)){var d,p;return{type:zt.deferred,deferredData:t,statusCode:(d=t.init)==null?void 0:d.status,headers:((p=t.init)==null?void 0:p.headers)&&new Headers(t.init.headers)}}if(Qg(t)){var m,y;return{type:zt.data,data:t.data,statusCode:(m=t.init)==null?void 0:m.status,headers:(y=t.init)!=null&&y.headers?new Headers(t.init.headers):void 0}}return{type:zt.data,data:t}}function $1(e,t,n,s,o,c){let l=e.headers.get("Location");if(Et(l,"Redirects returned/thrown from loaders/actions must have a Location header"),!ff.test(l)){let d=s.slice(0,s.findIndex(p=>p.route.id===n)+1);l=Ph(new URL(t.url),d,o,!0,l,c),e.headers.set("Location",l)}return e}function Hg(e,t,n,s){let o=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(ff.test(e)){let c=e,l=c.startsWith("//")?new URL(t.protocol+c):new URL(c);if(o.includes(l.protocol))throw new Error("Invalid redirect location");let d=Eo(l.pathname,n)!=null;if(l.origin===t.origin&&d)return l.pathname+l.search+l.hash}try{let c=s.createURL(e);if(o.includes(c.protocol))throw new Error("Invalid redirect location")}catch{}return e}function Ys(e,t,n,s){let o=e.createURL(Nb(t)).toString(),c={signal:n};if(s&&Gr(s.formMethod)){let{formMethod:l,formEncType:d}=s;c.method=l.toUpperCase(),d==="application/json"?(c.headers=new Headers({"Content-Type":d}),c.body=JSON.stringify(s.json)):d==="text/plain"?c.body=s.text:d==="application/x-www-form-urlencoded"&&s.formData?c.body=Rh(s.formData):c.body=s.formData}return new Request(o,c)}function Rh(e){let t=new URLSearchParams;for(let[n,s]of e.entries())t.append(n,typeof s=="string"?s:s.name);return t}function $g(e){let t=new FormData;for(let[n,s]of e.entries())t.append(n,s);return t}function V1(e,t,n,s,o){let c={},l=null,d,p=!1,m={},y=n&&wr(n[1])?n[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let b=g.route.id,x=t[b];if(Et(!gs(x),"Cannot handle redirect results in processLoaderData"),wr(x)){let C=x.error;y!==void 0&&(C=y,y=void 0),l=l||{};{let S=ps(e,b);l[S.route.id]==null&&(l[S.route.id]=C)}c[b]=void 0,p||(p=!0,d=bo(x.error)?x.error.status:500),x.headers&&(m[b]=x.headers)}else Bi(x)?(s.set(b,x.deferredData),c[b]=x.deferredData.data,x.statusCode!=null&&x.statusCode!==200&&!p&&(d=x.statusCode),x.headers&&(m[b]=x.headers)):(c[b]=x.data,x.statusCode&&x.statusCode!==200&&!p&&(d=x.statusCode),x.headers&&(m[b]=x.headers))}),y!==void 0&&n&&(l={[n[0]]:y},c[n[0]]=void 0),{loaderData:c,errors:l,statusCode:d||200,loaderHeaders:m}}function Vg(e,t,n,s,o,c,l){let{loaderData:d,errors:p}=V1(t,n,s,l);return o.forEach(m=>{let{key:y,match:g,controller:b}=m,x=c[y];if(Et(x,"Did not find corresponding fetcher result"),!(b&&b.signal.aborted))if(wr(x)){let C=ps(e.matches,g==null?void 0:g.route.id);p&&p[C.route.id]||(p=tn({},p,{[C.route.id]:x.error})),e.fetchers.delete(y)}else if(gs(x))Et(!1,"Unhandled fetcher revalidation redirect");else if(Bi(x))Et(!1,"Unhandled fetcher deferred data");else{let C=_i(x.data);e.fetchers.set(y,C)}}),{loaderData:d,errors:p}}function qg(e,t,n,s){let o=tn({},t);for(let c of n){let l=c.route.id;if(t.hasOwnProperty(l)?t[l]!==void 0&&(o[l]=t[l]):e[l]!==void 0&&c.route.loader&&(o[l]=e[l]),s&&s.hasOwnProperty(l))break}return o}function Gg(e){return e?wr(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function ps(e,t){return(t?e.slice(0,e.findIndex(s=>s.route.id===t)+1):[...e]).reverse().find(s=>s.route.hasErrorBoundary===!0)||e[0]}function Kg(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function ir(e,t){let{pathname:n,routeId:s,method:o,type:c,message:l}=t===void 0?{}:t,d="Unknown Server Error",p="Unknown @remix-run/router error";return e===400?(d="Bad Request",o&&n&&s?p="You made a "+o+' request to "'+n+'" but '+('did not provide a `loader` for route "'+s+'", ')+"so there is no way to handle the request.":c==="defer-action"?p="defer() is not supported in actions":c==="invalid-body"&&(p="Unable to encode submission body")):e===403?(d="Forbidden",p='Route "'+s+'" does not match URL "'+n+'"'):e===404?(d="Not Found",p='No route matches URL "'+n+'"'):e===405&&(d="Method Not Allowed",o&&n&&s?p="You made a "+o.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+s+'", ')+"so there is no way to handle the request.":o&&(p='Invalid request method "'+o.toUpperCase()+'"')),new gc(e||500,d,new Error(p),!0)}function zl(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[s,o]=t[n];if(gs(o))return{key:s,result:o}}}function Nb(e){let t=typeof e=="string"?Wi(e):e;return Po(tn({},t,{hash:""}))}function q1(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function G1(e){return Tb(e.result)&&A1.has(e.result.status)}function Bi(e){return e.type===zt.deferred}function wr(e){return e.type===zt.error}function gs(e){return(e&&e.type)===zt.redirect}function Qg(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function K1(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 Tb(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function Q1(e){return M1.has(e.toLowerCase())}function Gr(e){return E1.has(e.toLowerCase())}async function Y1(e,t,n,s,o){let c=Object.entries(t);for(let l=0;l<c.length;l++){let[d,p]=c[l],m=e.find(b=>(b==null?void 0:b.route.id)===d);if(!m)continue;let y=s.find(b=>b.route.id===m.route.id),g=y!=null&&!Cb(y,m)&&(o&&o[m.route.id])!==void 0;Bi(p)&&g&&await pf(p,n,!1).then(b=>{b&&(t[d]=b)})}}async function X1(e,t,n){for(let s=0;s<n.length;s++){let{key:o,routeId:c,controller:l}=n[s],d=t[o];e.find(m=>(m==null?void 0:m.route.id)===c)&&Bi(d)&&(Et(l,"Expected an AbortController for revalidating fetcher deferred result"),await pf(d,l.signal,!0).then(m=>{m&&(t[o]=m)}))}}async function pf(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:zt.data,data:e.deferredData.unwrappedData}}catch(o){return{type:zt.error,error:o}}return{type:zt.data,data:e.deferredData.data}}}function mf(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function so(e,t){let n=typeof t=="string"?Wi(t).search:t.search;if(e[e.length-1].route.index&&mf(n||""))return e[e.length-1];let s=xb(e);return s[s.length-1]}function Yg(e){let{formMethod:t,formAction:n,formEncType:s,text:o,formData:c,json:l}=e;if(!(!t||!n||!s)){if(o!=null)return{formMethod:t,formAction:n,formEncType:s,formData:void 0,json:void 0,text:o};if(c!=null)return{formMethod:t,formAction:n,formEncType:s,formData:c,json:void 0,text:void 0};if(l!==void 0)return{formMethod:t,formAction:n,formEncType:s,formData:void 0,json:l,text:void 0}}}function Td(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 J1(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 Ya(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 Z1(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 _i(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 ej(e,t){try{let n=e.sessionStorage.getItem(Sb);if(n){let s=JSON.parse(n);for(let[o,c]of Object.entries(s||{}))c&&Array.isArray(c)&&t.set(o,new Set(c||[]))}}catch{}}function tj(e,t){if(t.size>0){let n={};for(let[s,o]of t)n[s]=[...o];try{e.sessionStorage.setItem(Sb,JSON.stringify(n))}catch(s){vs(!1,"Failed to save applied view transitions in sessionStorage ("+s+").")}}}/**
52
- * React Router v6.30.3
53
- *
54
- * Copyright (c) Remix Software Inc.
55
- *
56
- * This source code is licensed under the MIT license found in the
57
- * LICENSE.md file in the root directory of this source tree.
58
- *
59
- * @license MIT
60
- */function yc(){return yc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},yc.apply(this,arguments)}const Mc=w.createContext(null),Pb=w.createContext(null),Ro=w.createContext(null),gf=w.createContext(null),gi=w.createContext({outlet:null,matches:[],isDataRoute:!1}),Eb=w.createContext(null);function Mo(){return w.useContext(gf)!=null}function Qr(){return Mo()||Et(!1),w.useContext(gf).location}function Rb(e){w.useContext(Ro).static||w.useLayoutEffect(e)}function Mn(){let{isDataRoute:e}=w.useContext(gi);return e?mj():nj()}function nj(){Mo()||Et(!1);let e=w.useContext(Mc),{basename:t,future:n,navigator:s}=w.useContext(Ro),{matches:o}=w.useContext(gi),{pathname:c}=Qr(),l=JSON.stringify(df(o,n.v7_relativeSplatPath)),d=w.useRef(!1);return Rb(()=>{d.current=!0}),w.useCallback(function(m,y){if(y===void 0&&(y={}),!d.current)return;if(typeof m=="number"){s.go(m);return}let g=hf(m,JSON.parse(l),c,y.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:zi([t,g.pathname])),(y.replace?s.replace:s.push)(g,y.state,y)},[t,s,l,c,e])}const rj=w.createContext(null);function ij(e){let t=w.useContext(gi).outlet;return t&&w.createElement(rj.Provider,{value:e},t)}function yf(){let{matches:e}=w.useContext(gi),t=e[e.length-1];return t?t.params:{}}function sj(e,t,n,s){Mo()||Et(!1);let{navigator:o}=w.useContext(Ro),{matches:c}=w.useContext(gi),l=c[c.length-1],d=l?l.params:{};l&&l.pathname;let p=l?l.pathnameBase:"/";l&&l.route;let m=Qr(),y;y=m;let g=y.pathname||"/",b=g;if(p!=="/"){let S=p.replace(/^\//,"").split("/");b="/"+g.replace(/^\//,"").split("/").slice(S.length).join("/")}let x=fs(e,{pathname:b});return uj(x&&x.map(S=>Object.assign({},S,{params:Object.assign({},d,S.params),pathname:zi([p,o.encodeLocation?o.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?p:zi([p,o.encodeLocation?o.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),c,n,s)}function aj(){let e=pj(),t=bo(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),n?w.createElement("pre",{style:o},n):null,null)}const oj=w.createElement(aj,null);class lj extends w.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,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?w.createElement(gi.Provider,{value:this.props.routeContext},w.createElement(Eb.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function cj(e){let{routeContext:t,match:n,children:s}=e,o=w.useContext(Mc);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),w.createElement(gi.Provider,{value:t},s)}function uj(e,t,n,s){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),s===void 0&&(s=null),e==null){var c;if(!n)return null;if(n.errors)e=n.matches;else if((c=s)!=null&&c.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,d=(o=n)==null?void 0:o.errors;if(d!=null){let y=l.findIndex(g=>g.route.id&&(d==null?void 0:d[g.route.id])!==void 0);y>=0||Et(!1),l=l.slice(0,Math.min(l.length,y+1))}let p=!1,m=-1;if(n&&s&&s.v7_partialHydration)for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(m=y),g.route.id){let{loaderData:b,errors:x}=n,C=g.route.loader&&b[g.route.id]===void 0&&(!x||x[g.route.id]===void 0);if(g.route.lazy||C){p=!0,m>=0?l=l.slice(0,m+1):l=[l[0]];break}}}return l.reduceRight((y,g,b)=>{let x,C=!1,S=null,j=null;n&&(x=d&&g.route.id?d[g.route.id]:void 0,S=g.route.errorElement||oj,p&&(m<0&&b===0?(gj("route-fallback"),C=!0,j=null):m===b&&(C=!0,j=g.route.hydrateFallbackElement||null)));let M=t.concat(l.slice(0,b+1)),A=()=>{let E;return x?E=S:C?E=j:g.route.Component?E=w.createElement(g.route.Component,null):g.route.element?E=g.route.element:E=y,w.createElement(cj,{match:g,routeContext:{outlet:y,matches:M,isDataRoute:n!=null},children:E})};return n&&(g.route.ErrorBoundary||g.route.errorElement||b===0)?w.createElement(lj,{location:n.location,revalidation:n.revalidation,component:S,error:x,children:A(),routeContext:{outlet:null,matches:M,isDataRoute:!0}}):A()},null)}var Mb=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(Mb||{}),Ab=(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})(Ab||{});function dj(e){let t=w.useContext(Mc);return t||Et(!1),t}function hj(e){let t=w.useContext(Pb);return t||Et(!1),t}function fj(e){let t=w.useContext(gi);return t||Et(!1),t}function Lb(e){let t=fj(),n=t.matches[t.matches.length-1];return n.route.id||Et(!1),n.route.id}function pj(){var e;let t=w.useContext(Eb),n=hj(Ab.UseRouteError),s=Lb();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function mj(){let{router:e}=dj(Mb.UseNavigateStable),t=Lb(),n=w.useRef(!1);return Rb(()=>{n.current=!0}),w.useCallback(function(o,c){c===void 0&&(c={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,yc({fromRouteId:t},c)))},[e,t])}const Xg={};function gj(e,t,n){Xg[e]||(Xg[e]=!0)}function yj(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 Ao(e){let{to:t,replace:n,state:s,relative:o}=e;Mo()||Et(!1);let{future:c,static:l}=w.useContext(Ro),{matches:d}=w.useContext(gi),{pathname:p}=Qr(),m=Mn(),y=hf(t,df(d,c.v7_relativeSplatPath),p,o==="path"),g=JSON.stringify(y);return w.useEffect(()=>m(JSON.parse(g),{replace:n,state:s,relative:o}),[m,g,o,n,s]),null}function Mh(e){return ij(e.context)}function vj(e){let{basename:t="/",children:n=null,location:s,navigationType:o=yn.Pop,navigator:c,static:l=!1,future:d}=e;Mo()&&Et(!1);let p=t.replace(/^\/*/,"/"),m=w.useMemo(()=>({basename:p,navigator:c,static:l,future:yc({v7_relativeSplatPath:!1},d)}),[p,d,c,l]);typeof s=="string"&&(s=Wi(s));let{pathname:y="/",search:g="",hash:b="",state:x=null,key:C="default"}=s,S=w.useMemo(()=>{let j=Eo(y,p);return j==null?null:{location:{pathname:j,search:g,hash:b,state:x,key:C},navigationType:o}},[p,y,g,b,x,C,o]);return S==null?null:w.createElement(Ro.Provider,{value:m},w.createElement(gf.Provider,{children:n,value:S}))}new Promise(()=>{});function wj(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:w.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:w.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:w.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
61
- * React Router DOM v6.30.3
62
- *
63
- * Copyright (c) Remix Software Inc.
64
- *
65
- * This source code is licensed under the MIT license found in the
66
- * LICENSE.md file in the root directory of this source tree.
67
- *
68
- * @license MIT
69
- */function vc(){return vc=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},vc.apply(this,arguments)}function Ah(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(o=>[n,o]):[[n,s]])},[]))}function bj(e,t){let n=Ah(e);return t&&t.forEach((s,o)=>{n.has(o)||t.getAll(o).forEach(c=>{n.append(o,c)})}),n}const xj="6";try{window.__reactRouterVersion=xj}catch{}function kj(e,t){return _1({basename:void 0,future:vc({},void 0,{v7_prependBasename:!0}),history:s1({window:void 0}),hydrationData:Sj(),routes:e,mapRouteProperties:wj,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function Sj(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=vc({},t,{errors:Cj(t.errors)})),t}function Cj(e){if(!e)return null;let t=Object.entries(e),n={};for(let[s,o]of t)if(o&&o.__type==="RouteErrorResponse")n[s]=new gc(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let c=window[o.__subType];if(typeof c=="function")try{let l=new c(o.message);l.stack="",n[s]=l}catch{}}if(n[s]==null){let c=new Error(o.message);c.stack="",n[s]=c}}else n[s]=o;return n}const jj=w.createContext({isTransitioning:!1}),Nj=w.createContext(new Map),Tj="startTransition",Jg=_0[Tj],Pj="flushSync",Zg=i1[Pj];function Ej(e){Jg?Jg(e):e()}function Xa(e){Zg?Zg(e):e()}class Rj{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=s=>{this.status==="pending"&&(this.status="resolved",t(s))},this.reject=s=>{this.status==="pending"&&(this.status="rejected",n(s))}})}}function Mj(e){let{fallbackElement:t,router:n,future:s}=e,[o,c]=w.useState(n.state),[l,d]=w.useState(),[p,m]=w.useState({isTransitioning:!1}),[y,g]=w.useState(),[b,x]=w.useState(),[C,S]=w.useState(),j=w.useRef(new Map),{v7_startTransition:M}=s||{},A=w.useCallback(_=>{M?Ej(_):_()},[M]),E=w.useCallback((_,F)=>{let{deletedFetchers:R,flushSync:W,viewTransitionOpts:J}=F;_.fetchers.forEach((le,ie)=>{le.data!==void 0&&j.current.set(ie,le.data)}),R.forEach(le=>j.current.delete(le));let re=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!J||re){W?Xa(()=>c(_)):A(()=>c(_));return}if(W){Xa(()=>{b&&(y&&y.resolve(),b.skipTransition()),m({isTransitioning:!0,flushSync:!0,currentLocation:J.currentLocation,nextLocation:J.nextLocation})});let le=n.window.document.startViewTransition(()=>{Xa(()=>c(_))});le.finished.finally(()=>{Xa(()=>{g(void 0),x(void 0),d(void 0),m({isTransitioning:!1})})}),Xa(()=>x(le));return}b?(y&&y.resolve(),b.skipTransition(),S({state:_,currentLocation:J.currentLocation,nextLocation:J.nextLocation})):(d(_),m({isTransitioning:!0,flushSync:!1,currentLocation:J.currentLocation,nextLocation:J.nextLocation}))},[n.window,b,y,j,A]);w.useLayoutEffect(()=>n.subscribe(E),[n,E]),w.useEffect(()=>{p.isTransitioning&&!p.flushSync&&g(new Rj)},[p]),w.useEffect(()=>{if(y&&l&&n.window){let _=l,F=y.promise,R=n.window.document.startViewTransition(async()=>{A(()=>c(_)),await F});R.finished.finally(()=>{g(void 0),x(void 0),d(void 0),m({isTransitioning:!1})}),x(R)}},[A,l,y,n.window]),w.useEffect(()=>{y&&l&&o.location.key===l.location.key&&y.resolve()},[y,b,o.location,l]),w.useEffect(()=>{!p.isTransitioning&&C&&(d(C.state),m({isTransitioning:!0,flushSync:!1,currentLocation:C.currentLocation,nextLocation:C.nextLocation}),S(void 0))},[p.isTransitioning,C]),w.useEffect(()=>{},[]);let Z=w.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:_=>n.navigate(_),push:(_,F,R)=>n.navigate(_,{state:F,preventScrollReset:R==null?void 0:R.preventScrollReset}),replace:(_,F,R)=>n.navigate(_,{replace:!0,state:F,preventScrollReset:R==null?void 0:R.preventScrollReset})}),[n]),Y=n.basename||"/",B=w.useMemo(()=>({router:n,navigator:Z,static:!1,basename:Y}),[n,Z,Y]),I=w.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return w.useEffect(()=>yj(s,n.future),[s,n.future]),w.createElement(w.Fragment,null,w.createElement(Mc.Provider,{value:B},w.createElement(Pb.Provider,{value:o},w.createElement(Nj.Provider,{value:j.current},w.createElement(jj.Provider,{value:p},w.createElement(vj,{basename:Y,location:o.location,navigationType:o.historyAction,navigator:Z,future:I},o.initialized||n.future.v7_partialHydration?w.createElement(Aj,{routes:n.routes,future:n.future,state:o}):t))))),null)}const Aj=w.memo(Lj);function Lj(e){let{routes:t,future:n,state:s}=e;return sj(t,void 0,s,n)}var ey;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ey||(ey={}));var ty;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ty||(ty={}));function Ij(e){let t=w.useRef(Ah(e)),n=w.useRef(!1),s=Qr(),o=w.useMemo(()=>bj(s.search,n.current?null:t.current),[s.search]),c=Mn(),l=w.useCallback((d,p)=>{const m=Ah(typeof d=="function"?d(o):d);n.current=!0,c("?"+m,p)},[c,o]);return[o,l]}const Ib=w.createContext(null);function Dj(e){if(typeof document>"u")return;const{documentElement:t,body:n}=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),n&&(n.dataset.runtimePlatform=e.platform,n.dataset.osFamily=e.ui.osFamily,n.dataset.windowControls=e.ui.windowControlsStyle,n.dataset.viewportClass=e.viewportClass,n.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar))}function _j(){if(!(typeof window>"u"))return window.innerWidth}function Fj({children:e}){const[t,n]=w.useState(()=>_j()),s=w.useMemo(()=>si({viewportWidth:t}),[t]);return w.useEffect(()=>{if(typeof window>"u")return;function o(){n(window.innerWidth)}return o(),window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}},[]),w.useEffect(()=>{Dj(s)},[s]),i.jsx(Ib.Provider,{value:s,children:e})}function ar(){return w.useContext(Ib)??si()}const Oj={common:{appName:"CodingNS",loading:"Loading...",retry:"Retry",back:"Back",save:"Save",logout:"Log out",unknown:"Unknown session",close:"Close",cancel:"Cancel",language:"Language"},auth:{loginTitle:"Resume your coding session",loginSubtitle:"INITIALIZING DEVELOPMENT ENVIRONMENT...",serverPreset:"Server Preset",serverCustomOption:"Use custom server",serverAddress:"Server Address",serverPlaceholder:"For example: http://127.0.0.1:3002",serverHint:"Login, realtime messages, and terminals all connect through this host. Point the client at the Host API endpoint such as http://127.0.0.1:3002; frontend dev ports like 4174 or 5173 are not meant for packaged clients and only work for temporary debugging when proxying and CORS are configured correctly.",serverInvalid:"Invalid server address. Check it and try again.",serverCurrent:"Current Server",bootstrapTitle:"Complete the first-time bootstrap",bootstrapSubtitle:"This Host does not have an admin account yet. Create the minimal login entry first.",username:"Username",password:"Password",rememberPassword:"Remember Password",confirmPassword:"Confirm Password",submitLogin:"Enter Workspace",submitBootstrap:"Create Admin Account",bootstrapSuccess:"Bootstrap completed. You can log in now.",bootstrapMismatch:"The two passwords do not match.",authUnavailable:"Host is unreachable right now. Check the server and try again.",logoutSuccess:"The current login state has been cleared.",serverSettings:"Server Settings",serverSettingsTitle:"Server Configuration",saveServerSettings:"Save Settings"},settings:{title:"Settings",appearance:"Appearance",appearanceSectionSummary:"Language, theme, and interface colors",language:"Language",languageDescription:"Choose the display language used by the interface.",theme:"Theme",themeDescription:"Choose the color theme that fits the way you work.",serverConnection:"Server Connection",serverConnectionSectionSummary:"Server address and reconnection behavior",securityPrivacy:"Security & Privacy",securityPrivacySectionSummary:"Session permissions, risk boundaries, and default approval policy",softwareUpdate:"Software Update",softwareUpdateSectionSummary:"Server and client versions",serverAddress:"Server Address",serverDescription:"Login, API requests, and realtime connections all use this Host entry, while the frontend UI is bundled inside the client itself.",releaseChannel:"Release Channel",releaseChannelDescription:"Stable or beta",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"Auto Reconnect",autoReconnectDescription:"Retry HTTP and WebSocket links automatically when Host is briefly unavailable.",autoCheckUpdate:"Auto Check Client Updates",autoCheckUpdateDescription:"Clients only",defaultPermissionMode:"Default Session Permissions",defaultPermissionModeDescription:"Controls the default tool permissions for new and resumed sessions. Full access disables approval prompts and should only be used for trusted projects and environments.",permissionModeDefault:"Follow CLI defaults",permissionModeAcceptEdits:"Allow workspace edits without asking",permissionModeBypassPermissions:"Full access without asking",enabled:"Enabled",disabled:"Disabled",serverUpdate:"Server Update",serverUpdateDescription:"",clientUpdate:"Client Update",clientUpdateDescription:"",serverCurrentVersion:"Server Current Version",serverTargetVersion:"Server Target Version",serverPackageName:"npm Package",serverUpdateCommand:"Upgrade Command",serverCheckNow:"Check Server",serverOpenPage:"Open npm",serverLatestUnknown:"Unavailable",serverUpdateReady:"New version found",serverUpToDate:"Up to date",serverCheckFailed:"Check failed",serverOpenPageFailed:"Failed to open page",releaseCurrentVersion:"Current Version",releaseTargetVersion:"Target Version",releaseTargetTag:"Target Tag",releasePublishedAt:"Published At",releaseUnknownVersion:"Unknown",releaseNotes:"What's New",releaseNotesEmpty:"No details",releaseCheckNow:"Check Client",releaseInstallNow:"Install",releaseOpenPage:"Open Release",releaseRollback:"Rollback",releaseUpdateReady:"New version found",releaseUpToDate:"Up to date",releaseCheckFailed:"Check failed",releaseInstallerMissing:"A new version is available, but this release does not include a supported installer yet.",releaseSignatureMissing:"A new version is available, but this release does not provide checksum information yet.",releaseInstallStarted:"Install started",releaseInstallFailed:"Install failed",releasePageOpenFailed:"Failed to open page",releaseRollbackStarted:"Rollback started",releaseRollbackFailed:"Rollback failed",clientUpdateUnsupported:"Install updates are not supported here",logout:"Log out"},home:{title:"Continue from a session, not from a backend table",subtitle:"Pick a workspace and session here first. The real work starts in the next step.",terminalsEntry:"Open Terminal",workspaceSection:"Workspaces",sessionSection:"Recent Sessions",emptyWorkspaces:"No workspace has been imported yet. Import one on the Host side first, and the entry will appear here.",emptySessions:"There is no session to continue in the current workspace yet.",noActivity:"No activity yet"},terminal:{title:"Terminal",heroTitle:"Keep the real PTY on Host, keep the control surface in the workspace",heroSubtitle:"This page does not fake output and does not mix terminal with process management. It only consumes the real terminal stream managed by Host.",workspaceSection:"Workspace & Terminal",workspaceField:"Current Workspace",shellField:"Shell for New Terminal",runtimeField:"Runtime",runtimeAutoOption:"Auto",runtimeAutoShortLabel:"auto",runtimeAutoDescription:"Use the Host default policy for this terminal runtime.",runtimeTmuxDescription:"Use a persistent external session, ideal for development terminals that should stay alive.",runtimeEmbeddedDescription:"Managed directly by the current Host and useful as the lightweight fallback.",runtimeMissingDialogTitle:"tmux is not installed on this system",runtimeMissingDialogDescription:"The tmux runtime cannot create a persistent terminal right now. Install tmux first, or temporarily switch to embedded-pty to continue.",runtimeMissingInstallDescription:"Installing tmux is recommended if you want terminals to survive Host restarts.",runtimeMissingInstallMacArm:"macOS (Apple Silicon / Homebrew): arch -arm64 brew install tmux",runtimeMissingInstallMacIntel:"macOS (Intel Mac / Homebrew): brew install tmux",runtimeMissingInstallDebian:"Ubuntu / Debian: sudo apt install tmux",runtimeMissingInstallFedora:"Fedora: sudo dnf install tmux",runtimeMissingFallbackDescription:"If you switch to embedded-pty now, the terminal can still start, but it will not stay as an external persistent session.",runtimeMissingKeepAction:"Not now",runtimeMissingFallbackAction:"Switch to embedded-pty",runtimeMissingFallbackPending:"Switching...",shellUnavailable:"Unavailable",workspaceLoadFailed:"The workspace or terminal list is not available right now.",terminalSection:"Terminal Instances",templateSection:"Command Templates",stageEmptyTitle:"No terminal selected yet",stageEmptySubtitle:"Create a terminal first, or run a command template.",emptyTerminals:"There is no terminal instance in the current workspace yet.",emptyTemplates:"There is no command template in the current workspace yet.",createButton:"Create Terminal",creating:"Creating terminal...",creationPendingDescription:"Host is starting the real PTY. This pane will take over as soon as the stream is ready.",defaultTerminalName:"Workspace Terminal",created:"The terminal has been created and connected to Host.",createFailed:"Failed to create terminal.",closeButton:"Close Terminal",closing:"Closing terminal...",closed:"The terminal close request has been submitted.",closeCompleted:"Terminal closed.",closePendingDescription:"The close request has been sent to Host. The page stays responsive and keeps syncing the final result in the background.",closeSyncDelayed:"Host is still finishing the close in the background. The list will keep syncing on the next refresh.",closeFailed:"Failed to close terminal.",inputLabel:"Send command to current terminal",inputPlaceholder:"For example: npm test",sendButton:"Send to Terminal",inputFailed:"Failed to send terminal input.",outputEmpty:"The terminal is connected, but there is no output yet.",outputTruncated:"Some output exceeded the cache window while disconnected. Only the retained part has been restored.",connectedHint:"Current output is coming from the real PTY stream on Host.",moreActions:"Terminal Actions",duplicateAction:"Duplicate Tab",duplicateSuccess:"A new terminal tab has been created with the same setup.",duplicateFailed:"Failed to duplicate the terminal tab.",disconnectAction:"Disconnect",disconnected:"Terminal connection has been disconnected.",reconnectAction:"Reconnect",reconnectRequested:"Reconnect request sent.",deleteAction:"Delete",deleting:"Deleting terminal...",deleted:"Terminal record deleted.",deletePendingDescription:"The delete request has been sent to Host. The page stays responsive and keeps syncing the list in the background.",deleteSyncDelayed:"Host is still finishing the delete in the background. The list will keep syncing on the next refresh.",deleteFailed:"Failed to delete the terminal record.",closePendingBadge:"Closing",deletePendingBadge:"Deleting",pinAction:"Pin",unpinAction:"Unpin",zoomLabel:"Terminal Zoom",zoomInAction:"Zoom in terminal display",zoomOutAction:"Zoom out terminal display",zoomResetAction:"Reset terminal zoom",toolbarToggleAction:"Open terminal toolbar",mobileSwipeHint:"Swipe left or right to switch terminals",mobileSwipePosition:"{current} / {total}",mobileDrawerAction:"Open quick terminal list",mobileDrawerTitle:"Quick Terminals",mobileDrawerDescription:"Swipe right to reveal the list, then tap to jump to another terminal.",mobilePinnedSectionTitle:"Pinned Terminals",mobileDrawerEmptyTitle:"No terminals yet",mobileDrawerEmptyDescription:"Create one first and the quick switcher will appear here.",mobileCreateSheetTitle:"Create Terminal",mobileCreateShellLabel:"Terminal Type",mobileCreateShellDescription:"Pick the shell for this terminal instead of squeezing desktop dropdowns onto mobile.",mobileCreateRuntimeLabel:"Session Type",mobileCreateRuntimeDescription:"Choose whether this terminal should stay persistent or only live in the current runtime.",mobileCreateLoadingShells:"Loading available terminal types for this system...",mobileCreateConfirm:"Create this terminal",mobileRuntimePersistentTitle:"tmux (persistent)",mobileRuntimePersistentDescription:"Best for development terminals that should stay alive longer.",mobileRuntimeSessionTitle:"runtime (current session)",mobileRuntimeSessionDescription:"Managed directly by the current Host. Lighter, but not an external persistent session.",mobileWorkspaceSwitcherPlaceholder:"Choose Workspace",mobileEmptyTitle:"No terminal content yet",mobileEmptyDescription:"Create a terminal first, or swipe right to open the quick list and switch to an existing one.",layoutLabel:"Layout",layoutSingleAction:"Single pane",layoutVerticalAction:"Split left and right",layoutHorizontalAction:"Split top and bottom",saveLogAction:"Save Log",saveLogSuccess:"The terminal log has been saved.",saveLogFailed:"Failed to save the terminal log.",logEmpty:"There is no terminal log to save yet.",bindToPaneAction:"Bind to current pane",bindToPrimaryPaneAction:"Bind to main pane",bindToSecondaryPaneAction:"Bind to side pane",panePrimary:"Main Pane",paneSecondary:"Side Pane",splitEmptySubtitle:"Pick a tab or create a terminal first, then bind it to this pane.",statusBadge:{creating:"starting",running:"running",closed:"closed",error:"error"},recoveryComplete:"Recovered to the terminal from before refresh. Key cached output has been restored.",recoveryTruncated:"Recovered to the previous terminal, but some disconnected output exceeded the cache window.",recoveryIdleClosed:"The previous terminal was auto-closed by Host after being idle too long. You are seeing the output kept before close.",reconnect:"Reconnect",liveConnected:"Live stream connected",templateName:"Template Name",templateCommand:"Main Command",templateArgs:"Arguments (space separated)",templateCreateButton:"Save Template",templateCreated:"The command template has been saved.",templateCreateFailed:"Failed to save the command template.",templateRunSent:"The command template has been sent to the current terminal.",templateRunCreatedTerminal:"The command template started in a new terminal.",templateRunFailed:"Failed to run the command template.",connection:{connected:"Connected",reconnecting:"Reconnecting",reconnect_failed:"Reconnect failed",closed:"Closed"}},conversation:{titleFallback:"Continue Conversation",historyLoading:"Loading message history from Host...",historyLoadingOlder:"Loading older messages...",historyLoadFailed:"Message history is not available right now. Try again later.",timelineEmpty:"There are no messages in this session yet. Your first message will go straight into the Host chain.",rawRefLabel:"Source",copyAction:"Copy",copyContentSuccess:"Content copied.",copyContentFailed:"Failed to copy the content.",loadMore:"Load More",composerPlaceholder:"State the next step clearly. Let the rest continue inside this session.",sendButton:"Send Message",queueTitle:"Queued Messages",queueDescription:"After the current run finishes, these messages will be processed automatically in order.",queueOrderPrefix:"Queue Position",queueStatusQueued:"Queued",queueStatusFailed:"Dispatch Failed",queueDelete:"Delete",queueDeleting:"Deleting",queueImageOnly:"Image attachments only",sendGuidanceButton:"Add Guidance",queueGuidanceButton:"Queue Guidance",queueSteer:"Steer",queueSteering:"Steering",resendButton:"Resend",quickPhraseTrigger:"Quick Phrases",quickPhraseModalTitle:"Quick Phrases",quickPhraseModalDescription:"Keep the prompts you reuse often in one place and drop them straight into the current composer.",quickPhraseCreateLabel:"New Phrase",quickPhraseOpenCreateAction:"Add Phrase",quickPhraseCreateModalTitle:"Create Quick Phrase",quickPhraseCreateModalDescription:"Save a reusable prompt on its own so it is ready across devices whenever you need it.",quickPhraseCreatePlaceholder:"Write a phrase you want to reuse later.",quickPhraseCreateAction:"Add Phrase",quickPhraseListLabel:"Quick phrase list",quickPhraseEmpty:"There are no quick phrases yet. Add the first one you actually reuse.",quickPhraseOrderLabel:"Item {index}",quickPhraseMoveUp:"Move phrase up",quickPhraseMoveDown:"Move phrase down",quickPhraseDelete:"Delete phrase",quickPhraseSaveFailed:"Failed to save quick phrases. Try again later.",sendingState:"Sending",sentState:"Synced",failedState:"Send failed",contextUsageTitle:"Context Usage",contextUsageUnavailable:"Context usage is not available yet",contextUsageEstimated:"Window is estimated",contextUsageCachedTokens:"{count} cached",contextUsageSourceProviderLog:"window from provider log",contextUsageSourceProviderRuntime:"window from provider runtime",contextUsageSourceProviderConfig:"window from provider config",contextUsageSourceModelMap:"window from model map",headerWorkspace:"Workspace",headerProvider:"Provider",headerCapability:"Capability Summary",connectionConnected:"Connected",connectionReconnecting:"Reconnecting",connectionReconnectFailed:"Reconnect failed",connectionClosed:"Connection closed",runtimeErrorTitle:"Session run failed",reconnectExplain:"The realtime link is broken. The system is replaying missing messages.",reconnectFailedExplain:"Automatic recovery failed. Retry manually, or reopen the session later.",capabilityDenied:"This action is not supported in the current session.",capabilitySendDisabled:"The current provider does not support sending new messages.",capabilityAttachmentDisabled:"This session does not support attachment input yet.",capabilityInterruptDisabled:"This session does not support interruption.",sidebarTitle:"Current Session Context",sidebarSubtitle:"This sidebar only keeps the minimum capability summary. It does not turn the page into an admin console.",reconnectButton:"Restore Realtime Sync",headerResumedAt:"Last Resumed",headerLastSyncAt:"Last Synced",historyPages:"History Pages",syncStatusIdle:"Sync Idle",syncStatusSyncing:"Syncing",syncStatusError:"Sync Error",capabilityResume:"Resumable",capabilitySend:"Send Enabled",capabilityInterrupt:"Interrupt Enabled",capabilityTools:"Tool Calls",attachmentsLabel:"Attachments",filePanelTitle:"File Manager",filePanelSubtitle:"File capabilities here only serve the current session. This is not a heavy IDE shell.",filePanelNoWorkspace:"There is no selected workspace yet. Browsing or attaching files is unavailable.",filePanelRefresh:"Refresh",filePanelCopyPath:"Copy Path",filePanelCopyAbsolutePath:"Copy Absolute Path",filePanelCopyRelativePath:"Copy Relative Path",filePanelCopyAbsolutePathSuccess:"Absolute path copied.",filePanelCopyRelativePathSuccess:"Relative path copied.",filePanelCopyPathFailed:"Failed to copy the path.",filePanelActionsMenu:"File Actions",filePanelSearchPlaceholder:"Enter a file name or path fragment",filePanelSearchButton:"Search",filePanelShowSearch:"Open Search",filePanelHideSearch:"Hide Search",filePanelSearchEmpty:"No matching files found.",filePanelSearchResults:"Search Results",filePanelSearchFailed:"File search failed. Try again later.",filePanelBrowse:"Workspace Files",filePanelCollapseCurrent:"Collapse Current",filePanelCollapseAll:"Collapse All",filePanelBackDirectory:"Go to Parent",filePanelEmptyDirectory:"There are no files to show in this directory.",filePanelRecentTitle:"Recently Opened",filePanelEmptyRecent:"There is no recently opened file yet.",filePanelContextTitle:"Attached Files",filePanelEmptyContexts:"No file is attached to the current session yet.",filePanelEditorTitle:"Preview & Editor",filePanelEditorPlaceholder:"This is a lightweight text editor, not a full IDE.",filePanelSelectHint:"Pick a file first from browse, search, or recent items.",filePanelUnsupported:"This file cannot be edited directly in the sidebar right now.",filePanelAttach:"Attach to Session",filePanelAttached:"Attached",filePanelDetach:"Detach",filePanelSave:"Save",filePanelSaving:"Saving...",filePanelLoadFailed:"Failed to load the file panel.",filePanelOpenFailed:"Failed to open the file.",filePanelSaveSuccess:"File saved.",filePanelSaveFailed:"Failed to save the file.",fileViewerHint:"Opened in {language} mode. Preview and save after editing are supported.",fileViewerModeLabel:"File View Mode",fileViewerPreview:"Preview",fileViewerCode:"Code",fileViewerEdit:"Edit",fileViewerPlainText:"Plain Text",filePanelAttachSuccess:"The file has been attached to the current session.",filePanelAttachFailed:"Failed to attach the file.",filePanelDetachSuccess:"The file has been detached from the current session.",filePanelDetachFailed:"Failed to detach the file.",filePanelNewFile:"New File",filePanelNewDirectory:"New Directory",filePanelUpload:"Upload File",filePanelDownload:"Download File",filePanelUploadSuccess:"{name} uploaded.",filePanelUploadFailed:"Failed to upload the file.",filePanelDownloadSuccess:"Started downloading {name}.",filePanelDownloadFailed:"Failed to download the file.",filePanelDelete:"Delete",filePanelRenameMove:"Rename / Move",filePanelMutateFailed:"File operation failed. Check the path and current state.",filePanelCreateFilePrompt:"Enter the relative path of the file to create",filePanelCreateDirectoryPrompt:"Enter the relative path of the directory to create",filePanelDeleteConfirm:"Delete this file? {path}",filePanelRenameMovePrompt:"Enter the new relative path",unavailableAction:"Unavailable",roleUser:"User",roleAssistant:"Assistant",roleTool:"Tool",roleSystem:"System"},git:{title:"Git Context",subtitle:"This is the session-side support area. It only handles Git facts inside the current workspace.",loading:"Loading Git context for the current workspace...",refresh:"Refresh",panelLoadFailed:"Git context is not available right now.",ahead:"Ahead",behind:"Behind",dirty:"Dirty",clean:"Clean",changeCount:"{count} changed files in the current workspace",noChanges:"There are no pending changes right now.",changesTitle:"Current Changes",rulesFirstHint:"Rules come first. Drafts must not bypass validation.",stage:"Stage",unstage:"Unstage",stageFailed:"Stage operation failed.",diffTitle:"Diff Preview",diffLoadFailed:"Diff content is not available right now.",binaryDiff:"This file is a binary change. The sidebar does not render its content directly.",stagedDiff:"Staged diff",worktreeDiff:"Working tree diff",emptyDiff:"There is no text diff to display right now.",diffTruncated:"The diff is too long and has been truncated for safety.",commitTitle:"Commit Draft",defaultRuleName:"Default Commit Rule",language:"Language",maxLength:"Max Length",bodyRequired:"Body Required",bodyOptional:"Body Optional",issueRequired:"Issue Required",issueOptional:"Issue Optional",commitSubject:"Commit Subject",commitSubjectPlaceholder:"Enter the commit message here",commitBody:"Commit Body",commitBodyPlaceholder:"Explain the change clearly. Do not write empty words.",commitFooter:"Commit Footer",commitFooterPlaceholder:"For example: Refs: #123",generateDraft:"AI Draft",validate:"Validate Draft",commit:"Commit",draftFailed:"Failed to generate the commit draft.",validateFailed:"Commit rule validation failed.",commitFailed:"Commit failed.",commitSuccess:"The commit has been written to the current repository.",validationPassed:"Rule validation passed. You can continue to commit.",validationFailed:"Rule validation failed. Fix the issues below first.",branchTitle:"Branch",branchPlaceholder:"Enter the branch name to switch to or create",switchBranch:"Switch",createBranch:"Create",branchFailed:"Branch operation failed.",historyTitle:"Recent History",historyHint:"Only keep the latest few entries here. This is not a graphical history tree.",noHistory:"There is no commit history to show right now.",remoteTitle:"Remote Sync",remoteReady:"A remote is configured for the current repository.",remoteMissing:"The current repository has no remote configured yet.",fetch:"Fetch",pull:"Pull",push:"Push",publish:"Publish",remoteFailed:"Remote sync failed.",errors:{unauthorized:"The current login is no longer valid. Log in again and retry.",workspaceNotFound:"The workspace bound to the current session does not exist. Check whether it is still available.",invalidWorkspace:"The current workspace config is invalid. The Git sidebar must not operate outside the repo root.",notGitRepository:"The current workspace is not a Git repository. The Git sidebar will not fake a state.",repoNotFound:"No usable Git repository root was found for the current workspace.",pathOutOfWorkspace:"The Git target is outside the current workspace repository boundary. The operation was blocked.",invalidTarget:"The Git target path is invalid. Refresh the sidebar and try again.",notStaged:"The target file is not staged yet. Check the current change state first.",emptyStagedChanges:"The staging area is empty. Stage the changes before committing.",branchConflict:"The current branch has conflicts or is not a fast-forward update. Sync and resolve differences first.",branchNotFound:"The target branch does not exist. Check the branch name first.",remoteNotFound:"The current repository does not have a usable origin remote yet.",remoteAuthFailed:"Remote repository authentication failed. Check the current credentials first.",pushFailed:"Push failed. Check remote state and local commits first.",pullFailed:"Pull failed. Check the remote branch state first.",remoteFailed:"Remote sync failed. Check Git output and network state.",commitValidationFailed:"The commit draft has not passed validation yet. Fix validation issues first.",commandTimeout:"The Git operation timed out. Check repository state and network conditions."}},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"Theme"},locale:{zhCN:"Simplified Chinese",enUS:"English"}},Bj={common:{appName:"CodingNS",loading:"正在准备会话工作区…",retry:"重新尝试",back:"返回",save:"保存",close:"关闭",cancel:"取消",logout:"退出登录",unknown:"未命名会话"},auth:{loginTitle:"继续你的编码会话",loginSubtitle:"INITIALIZING DEVELOPMENT ENVIRONMENT...",serverPreset:"服务器列表",serverCustomOption:"使用自定义服务器",serverAddress:"服务器地址",serverPlaceholder:"例如:http://127.0.0.1:3002",serverHint:"登录、实时消息和终端都会连接到这里。客户端应填写 Host API 地址,例如 http://127.0.0.1:3002;4174、5173 这类前端开发端口不是给正式客户端直接连接的,只有代理和跨域都配好时才适合临时调试。",serverInvalid:"服务器地址无效,请检查后再试。",serverCurrent:"当前服务器",bootstrapTitle:"先完成首次初始化",bootstrapSubtitle:"这个 Host 还没有管理员账号,先创建一个最小登录入口。",username:"用户名",password:"密码",rememberPassword:"保存密码",confirmPassword:"确认密码",submitLogin:"进入工作台",submitBootstrap:"创建管理员账号",bootstrapSuccess:"初始化完成,现在可以登录了。",bootstrapMismatch:"两次输入的密码不一致。",authUnavailable:"暂时连不上 Host,请确认服务可访问。",logoutSuccess:"当前登录态已经清空。",serverSettings:"服务器设置",serverSettingsTitle:"服务器配置",saveServerSettings:"保存设置"},settings:{title:"设置",appearance:"外观",appearanceSectionSummary:"语言、主题与界面配色",language:"语言",languageDescription:"选择界面显示语言,切换后立即应用到当前页面。",theme:"主题",themeDescription:"选择适合你的界面配色方案",serverConnection:"服务器连接",serverConnectionSectionSummary:"服务器地址与连接恢复策略",securityPrivacy:"安全与隐私",securityPrivacySectionSummary:"会话权限、风险边界与默认授权策略",softwareUpdate:"软件更新",softwareUpdateSectionSummary:"服务端和客户端版本",serverAddress:"服务器地址",serverDescription:"客户端的登录、接口请求和实时连接都通过这个 Host 入口工作;前端界面资源由应用自身携带。",releaseChannel:"发布通道",releaseChannelDescription:"稳定版或测试版",releaseStable:"稳定版",releaseBeta:"测试版",autoReconnect:"自动重连",autoReconnectDescription:"当 Host 短暂不可达时,自动尝试恢复 HTTP 和 WebSocket 链路。",autoCheckUpdate:"自动检查客户端更新",autoCheckUpdateDescription:"仅客户端",defaultPermissionMode:"默认会话权限",defaultPermissionModeDescription:"控制新建和继续会话时默认使用的工具权限。完整权限会关闭询问,只适合你已经信任当前项目和运行环境时使用。",permissionModeDefault:"跟随 CLI 默认策略",permissionModeAcceptEdits:"允许编辑工作区,不询问",permissionModeBypassPermissions:"完整权限,不询问",enabled:"已启用",disabled:"已关闭",serverUpdate:"服务端更新",serverUpdateDescription:"",clientUpdate:"客户端更新",clientUpdateDescription:"",serverCurrentVersion:"服务端当前版本",serverTargetVersion:"服务端目标版本",serverPackageName:"npm 包名",serverUpdateCommand:"升级命令",serverCheckNow:"检查服务端",serverOpenPage:"打开 npm",serverLatestUnknown:"暂未获取",serverUpdateReady:"发现新版本",serverUpToDate:"已是最新版本",serverCheckFailed:"检查失败",serverOpenPageFailed:"打开页面失败",releaseCurrentVersion:"当前版本",releaseTargetVersion:"目标版本",releaseTargetTag:"目标 Tag",releasePublishedAt:"发布时间",releaseUnknownVersion:"未知",releaseNotes:"更新内容",releaseNotesEmpty:"暂无更新内容",releaseCheckNow:"检查客户端",releaseInstallNow:"安装更新",releaseOpenPage:"打开发布页",releaseRollback:"回退版本",releaseUpdateReady:"发现新版本",releaseUpToDate:"已是最新版本",releaseCheckFailed:"检查失败",releaseInstallerMissing:"有新版本,暂无安装包",releaseSignatureMissing:"有新版本,缺少校验信息",releaseInstallStarted:"安装已开始",releaseInstallFailed:"安装失败",releasePageOpenFailed:"打开页面失败",releaseRollbackStarted:"已开始回退",releaseRollbackFailed:"回退失败",clientUpdateUnsupported:"当前不支持安装更新",logout:"退出登录"},home:{title:"从一条会话继续,而不是从后台表格开始",subtitle:"这里先挑一个工作区和会话,真正的工作区在下一步。",terminalsEntry:"进入终端页",workspaceSection:"工作区",sessionSection:"最近会话",emptyWorkspaces:"还没有导入工作区。先在 Host 侧导入后,这里会出现入口。",emptySessions:"当前工作区还没有可继续的会话。",noActivity:"暂时还没有活动"},terminal:{title:"终端",heroTitle:"把真实 PTY 留在 Host,把操作入口留在工作台",heroSubtitle:"这里不伪造输出,不把终端和进程搅在一起,只消费 Host 统一托管的真实终端流。",workspaceSection:"工作区与终端",workspaceField:"当前工作区",shellField:"新终端使用的 Shell",runtimeField:"Runtime",runtimeAutoOption:"自动选择",runtimeAutoShortLabel:"auto",runtimeAutoDescription:"按 Host 默认策略选择当前终端 runtime。",runtimeTmuxDescription:"持久化外部会话,适合需要后台常驻的开发终端。",runtimeEmbeddedDescription:"由当前 Host 直接托管,适合作为轻量回退方案。",runtimeMissingDialogTitle:"当前系统没有安装 tmux",runtimeMissingDialogDescription:"tmux runtime 无法继续创建持久化终端。你可以先安装 tmux,或者临时切换到 embedded-pty 继续。",runtimeMissingInstallDescription:"建议优先安装 tmux,这样终端才能在 Host 重启后继续保留。",runtimeMissingInstallMacArm:"macOS(Apple Silicon / Homebrew):arch -arm64 brew install tmux",runtimeMissingInstallMacIntel:"macOS(Intel Mac / Homebrew):brew install tmux",runtimeMissingInstallDebian:"Ubuntu / Debian:sudo apt install tmux",runtimeMissingInstallFedora:"Fedora:sudo dnf install tmux",runtimeMissingFallbackDescription:"如果现在先切到 embedded-pty,本次终端可以继续创建,但它不会作为外部持久会话保留。",runtimeMissingKeepAction:"先不切换",runtimeMissingFallbackAction:"切换到 embedded-pty 并继续",runtimeMissingFallbackPending:"正在切换…",shellUnavailable:"当前不可用",workspaceLoadFailed:"工作区或终端列表暂时没有拉回来。",terminalSection:"终端实例",templateSection:"命令模板",stageEmptyTitle:"还没有选中终端",stageEmptySubtitle:"先创建一个终端,或者运行一个命令模板。",emptyTerminals:"当前工作区还没有终端实例。",emptyTemplates:"当前工作区还没有命令模板。",createButton:"新建终端",creating:"正在创建终端…",creationPendingDescription:"Host 正在启动真实 PTY,连上以后这个窗口会立刻接管显示。",defaultTerminalName:"工作终端",created:"终端已经创建并接入 Host。",createFailed:"终端创建失败。",closeButton:"关闭终端",closing:"正在关闭终端…",closed:"终端关闭请求已经提交。",closeCompleted:"终端已关闭。",closePendingDescription:"关闭请求已经发给 Host,前台不会阻塞,系统会继续同步最终结果。",closeSyncDelayed:"Host 还在后台处理关闭,列表会在后续刷新时继续同步。",closeFailed:"终端关闭失败。",inputLabel:"向当前终端发送命令",inputPlaceholder:"例如:pnpm test",sendButton:"发送到终端",inputFailed:"终端输入发送失败。",outputEmpty:"终端已经连上,但暂时还没有输出。",outputTruncated:"断线期间有一段输出超出缓存窗口,当前只补回了仍保留的部分。",connectedHint:"当前输出来自 Host 真实 PTY 流。",moreActions:"终端操作",duplicateAction:"复制标签",duplicateSuccess:"已按当前终端配置新建一个标签。",duplicateFailed:"复制终端标签失败。",disconnectAction:"断开",disconnected:"终端连接已断开。",reconnectAction:"重连",reconnectRequested:"终端重连请求已发出。",deleteAction:"删除",deleting:"正在删除终端…",deleted:"终端记录已删除。",deletePendingDescription:"删除请求已经发给 Host,前台不会阻塞,系统会在后台继续同步列表。",deleteSyncDelayed:"Host 还在后台处理删除,列表会在后续刷新时继续同步。",deleteFailed:"终端记录删除失败。",closePendingBadge:"关闭中",deletePendingBadge:"删除中",pinAction:"固定",unpinAction:"取消固定",zoomLabel:"终端缩放",zoomInAction:"放大终端显示",zoomOutAction:"缩小终端显示",zoomResetAction:"恢复默认缩放",toolbarToggleAction:"展开终端工具栏",mobileSwipeHint:"左右滑动切换终端",mobileSwipePosition:"{current} / {total}",mobileDrawerAction:"打开快捷终端列表",mobileDrawerTitle:"快捷终端",mobileDrawerDescription:"右滑呼出列表,点一下就切到别的终端。",mobilePinnedSectionTitle:"已固定终端",mobileDrawerEmptyTitle:"当前还没有终端",mobileDrawerEmptyDescription:"先新建一个终端,这里才会出现可切换的列表。",mobileCreateSheetTitle:"新建终端",mobileCreateShellLabel:"终端类型",mobileCreateShellDescription:"先选这次要开的 Shell,别把桌面端那套下拉框搬到手机上。",mobileCreateRuntimeLabel:"会话方式",mobileCreateRuntimeDescription:"再决定它是持久保留,还是只作为当前 runtime 会话。",mobileCreateLoadingShells:"正在读取当前系统可用的终端类型…",mobileCreateConfirm:"创建这个终端",mobileRuntimePersistentTitle:"tmux(持久会话)",mobileRuntimePersistentDescription:"适合需要一直挂着的开发终端,Host 重启后也能尽量保留。",mobileRuntimeSessionTitle:"runtime(当前会话)",mobileRuntimeSessionDescription:"直接由当前 Host 托管,创建更轻,但不会保留成外部持久会话。",mobileWorkspaceSwitcherPlaceholder:"选择项目",mobileEmptyTitle:"这里还没有终端内容",mobileEmptyDescription:"先新建一个终端,或者右滑呼出快捷列表,切到当前工作区已有的终端。",layoutLabel:"分栏布局",layoutSingleAction:"单栏显示",layoutVerticalAction:"左右分栏",layoutHorizontalAction:"上下分栏",saveLogAction:"保存日志",saveLogSuccess:"终端日志已保存。",saveLogFailed:"终端日志保存失败。",logEmpty:"当前终端还没有可保存的日志内容。",bindToPaneAction:"绑定到当前分栏",bindToPrimaryPaneAction:"绑定到主分栏",bindToSecondaryPaneAction:"绑定到副分栏",panePrimary:"主分栏",paneSecondary:"副分栏",splitEmptySubtitle:"先点一个标签,或者新建一个终端,把它绑定到当前分栏。",statusBadge:{creating:"启动中",running:"运行中",closed:"已关闭",error:"异常"},recoveryComplete:"已回到刷新前的终端,缓存内的关键输出已经补回。",recoveryTruncated:"已恢复到上一个终端,但断线期间的部分输出已经超出缓存窗口。",recoveryIdleClosed:"上一个终端已因空闲超时被 Host 自动关闭,你现在看到的是关闭前保留的输出。",reconnect:"手动重连",liveConnected:"实时流已接入",templateName:"模板名称",templateCommand:"主命令",templateArgs:"参数(空格分隔)",templateCreateButton:"保存模板",templateCreated:"命令模板已经保存。",templateCreateFailed:"命令模板保存失败。",templateRunSent:"命令模板已经发送到当前终端。",templateRunCreatedTerminal:"命令模板已在新终端中启动。",templateRunFailed:"命令模板执行失败。",connection:{connected:"已连接",reconnecting:"正在重连",reconnect_failed:"重连失败",closed:"已关闭"}},conversation:{titleFallback:"继续对话",historyLoading:"正在从 Host 拉取消息历史…",historyLoadingOlder:"正在加载更早的消息…",historyLoadFailed:"历史消息暂时没有拉回来,可以稍后再试。",timelineEmpty:"这条会话还没有消息。你发出的第一句话会直接进入 Host 链路。",rawRefLabel:"来源",copyAction:"复制",copyContentSuccess:"内容已复制。",copyContentFailed:"内容复制失败。",loadMore:"加载更多消息",composerPlaceholder:"把下一步交代清楚,剩下的交给这条会话继续跑。",sendButton:"发送消息",queueTitle:"待发队列",queueDescription:"当前这轮结束后,队列里的消息会按顺序自动继续处理。",queueOrderPrefix:"队列序号",queueStatusQueued:"等待中",queueStatusFailed:"发送失败",queueDelete:"删除",queueDeleting:"删除中",queueImageOnly:"仅图片附件",sendGuidanceButton:"追加引导",queueGuidanceButton:"加入队列",queueSteer:"引导",queueSteering:"引导中",resendButton:"重试发送",quickPhraseTrigger:"快捷短语",quickPhraseModalTitle:"快捷短语",quickPhraseModalDescription:"这里集中管理你常用的会话指令,点一下就能直接填回当前输入框。",quickPhraseCreateLabel:"新增短语",quickPhraseOpenCreateAction:"新增短语",quickPhraseCreateModalTitle:"新增快捷短语",quickPhraseCreateModalDescription:"把常用指令单独存起来,后面在任何设备上都能直接复用。",quickPhraseCreatePlaceholder:"输入一条常用短语,保存后下次可以直接复用。",quickPhraseCreateAction:"添加短语",quickPhraseListLabel:"快捷短语列表",quickPhraseEmpty:"还没有可用的快捷短语,先加一条最常用的。",quickPhraseOrderLabel:"第 {index} 条",quickPhraseMoveUp:"上移短语",quickPhraseMoveDown:"下移短语",quickPhraseDelete:"删除短语",quickPhraseSaveFailed:"快捷短语保存失败,请稍后再试。",sendingState:"发送中",sentState:"已同步",failedState:"发送失败",contextUsageTitle:"当前上下文占用",contextUsageUnavailable:"当前上下文占用暂时不可用",contextUsageEstimated:"上限为估算值",contextUsageCachedTokens:"缓存命中 {count}",contextUsageSourceProviderLog:"上限来自 provider 运行日志",contextUsageSourceProviderRuntime:"上限来自 provider runtime",contextUsageSourceProviderConfig:"上限来自 provider 配置",contextUsageSourceModelMap:"上限来自模型映射",headerWorkspace:"工作区",headerProvider:"Provider",headerCapability:"能力摘要",connectionConnected:"已连接",connectionReconnecting:"正在重连",connectionReconnectFailed:"重连失败",connectionClosed:"连接已关闭",runtimeErrorTitle:"会话运行失败",reconnectExplain:"实时链路断开了,系统正在补回缺失消息。",reconnectFailedExplain:"自动恢复没有成功。你可以手动重试,或者稍后重新进入会话。",capabilityDenied:"当前会话不支持这个动作",capabilitySendDisabled:"当前 provider 不支持发送新消息",capabilityAttachmentDisabled:"当前会话还不支持附件输入",capabilityInterruptDisabled:"当前会话不支持中断运行",sidebarTitle:"当前会话上下文",sidebarSubtitle:"这里只保留最小能力摘要,不把页面做成后台控制台。",reconnectButton:"手动恢复实时同步",headerResumedAt:"最近续接",headerLastSyncAt:"最近同步",historyPages:"历史分页",syncStatusIdle:"同步空闲",syncStatusSyncing:"同步中",syncStatusError:"同步异常",capabilityResume:"可续接",capabilitySend:"可发送",capabilityInterrupt:"可中断",capabilityTools:"工具调用",attachmentsLabel:"附件",filePanelTitle:"文件管理",filePanelSubtitle:"这里的文件能力只服务当前会话,不把页面拉成重型 IDE。",filePanelNoWorkspace:"当前还没有选中项目,暂时不能浏览或挂载文件。",filePanelRefresh:"刷新",filePanelCopyPath:"复制路径",filePanelCopyAbsolutePath:"复制绝对路径",filePanelCopyRelativePath:"复制相对路径",filePanelCopyAbsolutePathSuccess:"绝对路径已复制。",filePanelCopyRelativePathSuccess:"相对路径已复制。",filePanelCopyPathFailed:"路径复制失败。",filePanelActionsMenu:"文件操作",filePanelSearchPlaceholder:"输入文件名或路径片段",filePanelSearchButton:"搜索",filePanelShowSearch:"打开搜索",filePanelHideSearch:"收起搜索",filePanelSearchEmpty:"没有找到匹配的文件。",filePanelSearchResults:"搜索结果",filePanelSearchFailed:"文件搜索失败,请稍后再试。",filePanelBrowse:"工作区文件",filePanelCollapseCurrent:"折叠当前选中",filePanelCollapseAll:"全部折叠",filePanelBackDirectory:"返回上级",filePanelEmptyDirectory:"这个目录里暂时没有可显示的文件。",filePanelRecentTitle:"最近打开",filePanelEmptyRecent:"最近还没有打开记录。",filePanelContextTitle:"已挂载文件",filePanelEmptyContexts:"当前会话还没有挂载文件管理。",filePanelEditorTitle:"预览与编辑",filePanelEditorPlaceholder:"这里只做轻量文本编辑,不在这里做完整 IDE。",filePanelSelectHint:"先从目录、搜索或最近打开里选一个文件。",filePanelUnsupported:"这个文件当前不能在侧栏里直接编辑。",filePanelAttach:"挂到会话",filePanelAttached:"已挂载",filePanelDetach:"解绑",filePanelSave:"保存",filePanelSaving:"保存中",filePanelLoadFailed:"文件管理面板加载失败。",filePanelOpenFailed:"文件打开失败。",filePanelSaveSuccess:"文件已经保存。",filePanelSaveFailed:"文件保存失败。",fileViewerHint:"当前以 {language} 模式打开,支持预览与编辑保存。",fileViewerModeLabel:"文件查看模式",fileViewerPreview:"预览",fileViewerCode:"代码",fileViewerEdit:"编辑",fileViewerPlainText:"纯文本",filePanelAttachSuccess:"文件已经挂到当前会话。",filePanelAttachFailed:"文件挂载失败。",filePanelDetachSuccess:"文件已经从当前会话解绑。",filePanelDetachFailed:"文件解绑失败。",filePanelNewFile:"新建文件",filePanelNewDirectory:"新建目录",filePanelUpload:"上传文件",filePanelDownload:"下载文件",filePanelUploadSuccess:"已上传 {name}。",filePanelUploadFailed:"文件上传失败。",filePanelDownloadSuccess:"已开始下载 {name}。",filePanelDownloadFailed:"文件下载失败。",filePanelDelete:"删除",filePanelRenameMove:"重命名/移动",filePanelMutateFailed:"文件操作失败,请检查路径和当前状态。",filePanelCreateFilePrompt:"输入要创建的相对文件路径",filePanelCreateDirectoryPrompt:"输入要创建的相对目录路径",filePanelDeleteConfirm:"确认删除这个文件吗?{path}",filePanelRenameMovePrompt:"输入新的相对路径",unavailableAction:"当前不可用",roleUser:"你",roleAssistant:"助手",roleTool:"工具",roleSystem:"系统"},git:{title:"Git 上下文",subtitle:"这里是会话侧边的辅助区,只处理当前工作区里的 Git 事实。",loading:"正在读取当前工作区的 Git 上下文。",refresh:"刷新",panelLoadFailed:"Git 上下文暂时没有加载出来。",ahead:"领先",behind:"落后",dirty:"有改动",clean:"已干净",changeCount:"当前有 {count} 个变更文件",noChanges:"当前没有待处理改动。",changesTitle:"当前变更",rulesFirstHint:"规则先于生成,草稿不能绕过校验。",stage:"暂存",unstage:"取消暂存",stageFailed:"暂存操作失败。",diffTitle:"差异预览",diffLoadFailed:"差异内容暂时没有拉回来。",binaryDiff:"这个文件是二进制改动,侧栏不直接展示内容。",stagedDiff:"暂存区 diff",worktreeDiff:"工作区 diff",emptyDiff:"当前没有可展示的文本差异。",diffTruncated:"差异内容过长,已经做了截断保护。",commitTitle:"提交草稿",defaultRuleName:"默认提交规则",language:"语言",maxLength:"长度",bodyRequired:"正文必填",bodyOptional:"正文可选",issueRequired:"Issue 必填",issueOptional:"Issue 可选",commitSubject:"提交标题",commitSubjectPlaceholder:"在这里输入提交信息",commitBody:"提交正文",commitBodyPlaceholder:"把这次改动说清楚,别写空话。",commitFooter:"提交脚注",commitFooterPlaceholder:"例如:Refs: #123",generateDraft:"AI 起草",validate:"校验草稿",commit:"执行提交",draftFailed:"提交草稿生成失败。",validateFailed:"提交规则校验失败。",commitFailed:"提交失败。",commitSuccess:"提交已经写入当前仓库。",validationPassed:"规则校验通过,可以继续提交。",validationFailed:"规则校验没有通过,先把下面的问题修掉。",branchTitle:"分支",branchPlaceholder:"输入要切换或创建的分支名",switchBranch:"切换",createBranch:"新建",branchFailed:"分支操作失败。",historyTitle:"最近历史",historyHint:"只放最近几条,不做图形历史树。",noHistory:"当前没有可展示的提交历史。",remoteTitle:"远程同步",remoteReady:"当前仓库已配置远程。",remoteMissing:"当前仓库还没有远程。",fetch:"Fetch",pull:"Pull",push:"Push",publish:"Publish",remoteFailed:"远程同步失败。",errors:{unauthorized:"当前登录态已经失效,请重新登录后再试。",workspaceNotFound:"当前会话绑定的工作区不存在,先确认工作区是否还可用。",invalidWorkspace:"当前工作区配置无效,Git 侧栏不能脱离仓库根目录执行。",notGitRepository:"当前工作区不是 Git 仓库,Git 侧栏不会伪造状态。",repoNotFound:"当前工作区找不到可用的 Git 仓库根目录。",pathOutOfWorkspace:"Git 目标超出了当前工作区仓库边界,操作已被拦截。",invalidTarget:"Git 目标路径无效,请先刷新侧栏后重试。",notStaged:"目标文件还不在暂存区里,先确认当前变更状态。",emptyStagedChanges:"暂存区为空,先把要提交的改动放进暂存区。",branchConflict:"当前分支存在冲突或不是快进更新,先同步并处理差异。",branchNotFound:"目标分支不存在,先确认分支名是否正确。",remoteNotFound:"当前仓库还没有可用的 origin 远程,先配置远程再同步。",remoteAuthFailed:"远程仓库认证失败,请先确认当前仓库凭据可用。",pushFailed:"推送失败,请先检查远程状态和本地提交。",pullFailed:"拉取失败,请先确认远程分支状态。",remoteFailed:"远程同步失败,请检查 Git 输出和网络状态。",commitValidationFailed:"提交草稿还没通过规则校验,先把校验问题修掉。",commandTimeout:"Git 操作超时了,先确认仓库状态和网络环境。"}}},Uj=[{id:"zh-CN",labelKey:"locale.zhCN"},{id:"en-US",labelKey:"locale.enUS"}];function vf({variant:e="default",className:t}){const n=Rc(o=>o.language);function s(o){o!==n&&cn.update({language:o})}return i.jsxs("label",{className:`language-switcher language-switcher-${e}${t?` ${t}`:""}`,children:[i.jsx("span",{className:"language-switcher-label",children:h("common.language")}),i.jsx("div",{className:"language-switcher-options",role:"group","aria-label":h("common.language"),children:Uj.map(o=>i.jsx("button",{type:"button",className:`language-switcher-option${n===o.id?" active":""}`,"aria-pressed":n===o.id,onClick:()=>s(o.id),children:h(o.labelKey)},o.id))})]})}const zj={common:{close:"关闭",cancel:"取消",logout:"退出登录",language:"语言"},locale:{zhCN:"简体中文",enUS:"English"},settings:{title:"设置",appearance:"外观",language:"语言",languageDescription:"选择界面显示语言,切换后立即应用到当前页面。",theme:"主题",themeDescription:"选择适合你的界面配色方案",connection:"连接与更新",serverAddress:"服务地址",serverDescription:"桌面端和 H5 都通过这个 Host 入口工作。",releaseChannel:"发布通道",releaseChannelDescription:"稳定版或测试版",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"自动重连",autoReconnectDescription:"当 Host 短暂不可达时,自动尝试恢复 HTTP 和 WebSocket 链路。",autoCheckUpdate:"自动检查客户端更新",autoCheckUpdateDescription:"仅客户端",enabled:"已启用",disabled:"已关闭",serverUpdate:"服务端更新",serverUpdateDescription:"",clientUpdate:"客户端更新",clientUpdateDescription:"",serverCurrentVersion:"服务端当前版本",serverTargetVersion:"服务端目标版本",serverPackageName:"npm 包名",serverUpdateCommand:"升级命令",serverCheckNow:"检查服务端",serverOpenPage:"打开 npm",serverLatestUnknown:"暂未获取",serverUpdateReady:"发现新版本",serverUpToDate:"已是最新版本",serverCheckFailed:"检查失败",serverOpenPageFailed:"打开页面失败",runtimePlatform:"当前运行平台",runtimePlatformDescription:"用来确认现在是 Web/H5、Desktop、iOS 还是 Android 运行环境。",platformDesktop:"Desktop",platformWeb:"Web",platformIos:"iOS",platformAndroid:"Android",releaseDesktopOnly:"当前是 Web/H5 运行环境,不支持桌面更新。",releaseCurrentVersion:"当前版本",releaseTargetVersion:"目标版本",releaseUnknownVersion:"未知",releaseNotes:"更新内容",releaseNotesEmpty:"暂无更新内容",releaseCheckNow:"检查客户端",releaseInstallNow:"安装更新",releaseRollback:"回退版本",releaseUpdateReady:"发现新版本",releaseUpToDate:"已是最新版本",releaseCheckFailed:"检查失败",releaseInstallStarted:"安装已开始",releaseInstallFailed:"安装失败",releaseRollbackStarted:"已开始回退",releaseRollbackFailed:"回退失败",clientUpdateUnsupported:"当前不支持安装更新",account:"账号",logout:"退出登录",logoutDescription:"退出当前账号并返回登录页面"},shell:{title:"工作台",subtitle:"管理代码项目里的 AI 会话",mobileWorkspacesEntry:"工作区",mobileTerminalsEntry:"终端",mobileSessionsEntry:"对话",mobileToolsEntry:"工具",mobileSettingsEntry:"设置",mobileNavigationAction:"打开工作台菜单",mobileSearchAction:"打开搜索",mobileAuxiliaryAction:"打开工具面板",mobileRevealNavigationAction:"显示主导航",mobileHideNavigationAction:"收起主导航",mobileConversationPreviewTitle:"快速预览",mobileConversationCurrentWorkspaceSection:"当前工作区",mobileConversationCollapsePreviewAction:"收起预览",mobileConversationRestorePreviewAction:"恢复会话预览",iosMoreAction:"更多操作",androidMoreAction:"更多操作",conversationEntry:"对话",terminalsEntry:"终端",searchEntry:"搜索",searchModalTitle:"搜索",searchModalDescription:"支持搜会话标题,或在当前工作区里搜代码文件。",searchModeLabel:"搜索模式",searchModeSessions:"会话",searchModeCode:"代码",searchKeywordLabel:"关键词",searchWorkspaceLabel:"工作区",searchSessionPlaceholder:"输入会话名称、工作区或 provider",searchCodePlaceholder:"输入文件名或路径片段",searchSessionHint:"输入关键词后,这里会立即列出匹配的会话。",searchCodeHint:"选一个工作区,然后搜文件名或路径。",searchSessionEmpty:"没找到匹配的会话。",searchCodeEmpty:"没找到匹配的文件。",searchCodeFailed:"代码搜索失败,请稍后重试。",searchSubmit:"开始搜索",filesEntry:"文件管理",gitEntry:"GIT管理",terminalManagerEntry:"进程管理",workspaceSectionTitle:"工作区",goBack:"后退",goForward:"前进",workspaceCount:"项目",sessionCount:"会话",manageWorkspaceAction:"管理项目",manageWorkspaceTitle:"管理项目",manageWorkspaceDescription:"默认只列出当前已加载的项目,展开后可以查看路径、Git 摘要、代码类型组成,也可以从当前工作台列表里移除。",manageWorkspaceEmpty:"当前没有可管理的项目。",manageWorkspaceLoading:"正在读取项目详情...",manageWorkspaceLoadFailed:"项目详情加载失败",manageWorkspacePathLabel:"路径",manageWorkspaceGitCommitCount:"Git 提交版本数",manageWorkspaceGitInfoLabel:"Git 仓库信息",manageWorkspaceRepoRoot:"仓库根目录",manageWorkspaceCurrentBranch:"当前分支",manageWorkspaceRemoteLabel:"远程",manageWorkspaceNoRemote:"未配置远程",manageWorkspaceNotGit:"当前项目不是 Git 仓库。",manageWorkspaceCodeCompositionLabel:"代码类型组成",manageWorkspaceCodeCompositionFiles:"文件",manageWorkspaceCodeCompositionOther:"其他",manageWorkspaceNoCodeComposition:"暂时没有识别到可统计的代码文件。",manageWorkspaceCodeTruncated:"文件过多,只统计了前 {count} 个可识别文件。",manageWorkspaceRemoveAction:"移除项目",manageWorkspaceRemoving:"移除中...",manageWorkspaceRemoveSuccess:"项目已从当前工作台移除",manageWorkspaceRemoveFailed:"移除项目失败",manageWorkspaceRemoveConfirmTitle:"确认移除项目",manageWorkspaceRemoveConfirmDescription:"这只会把项目从当前工作台列表移除,不会删除任何磁盘数据或历史记录。后续重新加载同一路径时,旧记录会直接恢复显示。",manageWorkspaceRemoveConfirmTarget:"确定移除「{name}」吗?",manageWorkspaceRemoveConfirmAction:"确认移除",importWorkspaceTitle:"添加项目",importWorkspaceHint:"导入本地代码目录",importExpand:"展开",importCollapse:"收起",importPathLabel:"项目路径",importPathPlaceholder:"输入项目文件夹路径",importNameLabel:"项目名称",importNamePlaceholder:"可选",importSubmit:"添加项目",importSubmitting:"添加中...",importChooseFolder:"选择文件夹",importPickFolderFailed:"打开文件夹选择器失败",importDesktopDropHint:"支持把本地项目文件夹直接拖到这个区域",importHint:"输入本地代码目录后就能开始工作",importServerDirectoryHint:"浏览并选择运行服务器上的项目目录",importBrowserTitle:"选择服务器目录",importBrowserDescription:"这里浏览的是项目运行所在服务器上的目录,不是当前设备的本地目录。",importBrowserCurrentPath:"当前目录",importBrowserRoots:"根目录",importBrowserOpenParent:"返回上一级",importBrowserOpenPath:"打开路径",importBrowserCreateDirectory:"新建文件夹",importBrowserCreateDirectoryTitle:"新建文件夹",importBrowserCreateDirectoryDescription:"只在当前服务器目录下新建一层子文件夹,不接受带路径的输入。",importBrowserCreateDirectoryLabel:"文件夹名称",importBrowserCreateDirectoryPlaceholder:"输入新文件夹名称",importBrowserCreateDirectorySuccess:"文件夹已创建",importBrowserCreateDirectoryFailed:"新建文件夹失败",importBrowserCreateDirectorySubmit:"确认新建",importBrowserCreatingDirectory:"新建中...",importBrowserEmpty:"当前目录下没有可选的子目录",importBrowserBrowseFailed:"加载服务器目录失败",importBrowserSubmit:"导入当前目录",importPathRequired:"请输入项目路径",importSuccess:"项目已添加",importFailed:"添加失败",cloneWorkspaceTitle:"Clone项目",cloneWorkspaceHint:"从 Git 仓库拉取代码到服务端目录,完成后直接加入项目列表。",cloneSubmit:"Clone项目",cloneSubmitting:"Clone 中...",cloneRepositoryLabel:"Git 仓库地址",cloneRepositoryPlaceholder:"例如:https://github.com/org/repo.git",cloneParentPathLabel:"目标父目录",cloneParentPathPlaceholder:"选择后端服务上已存在的目录",cloneDirectoryNameLabel:"新项目目录名",cloneDirectoryNamePlaceholder:"留空时默认使用仓库名",clonePickDirectory:"选择目录",cloneAuthModeLabel:"认证方式",cloneAuthModeNone:"无认证",cloneAuthModeBasic:"用户名 + 密码",cloneAuthModeToken:"Token",cloneUsernameLabel:"用户名",cloneUsernamePlaceholder:"输入 Git 用户名",clonePasswordLabel:"密码",clonePasswordPlaceholder:"输入 Git 密码",cloneTokenLabel:"Token",cloneTokenPlaceholder:"输入 access token",cloneTokenUsernamePlaceholder:"可选,留空时默认使用 git",cloneRepoRequired:"请输入 Git 仓库地址",clonePathRequired:"请选择目标父目录",cloneSuccess:"项目已成功 Clone",cloneFailed:"Clone 失败",cloneHint:"目标父目录必须已经存在,Clone 时会在这个目录下新建仓库文件夹。",cloneBrowserTitle:"选择 Clone 目标父目录",cloneBrowserDescription:"这里选的是服务端已存在的父目录,Clone 时会在其下新建一个项目文件夹。",cloneBrowserSubmit:"使用当前目录",refreshNavigation:"刷新",desktopChromeLabel:"桌面工作台",windowMinimize:"最小化窗口",windowMaximize:"最大化或还原窗口",windowClose:"关闭窗口",contextOpenSession:"打开会话",navigationLoadFailed:"加载失败,请重试",emptyNavigationTitle:"还没有项目",emptyNavigationBody:"添加本地代码目录开始工作",emptyWorkspaceSessions:"暂无会话",favoriteSectionTitle:"收藏会话",favoriteSectionEmpty:"收藏后的会话会固定放在这里,方便你快速回到常用链路。",favoriteAction:"收藏会话",unfavoriteAction:"取消收藏",favoriteAdded:"会话已加入收藏",favoriteRemoved:"会话已取消收藏",favoriteToggleFailed:"收藏状态更新失败",sessionMoreAction:"更多操作",sessionStateInferred:"推断",renameAction:"重命名",renameSuccess:"会话名称已更新",renameFailed:"会话重命名失败",renameModalTitle:"重命名会话",renameModalDescription:"改成你自己能一眼认出来的名字,只改标题,不改消息内容。",renameInputLabel:"会话名称",renameInputPlaceholder:"输入新的会话名称",renamingSession:"保存中...",archiveFolderLabel:"归档会话",archiveFolderAction:"打开归档文件夹",archiveAction:"归档会话",archiveCurrentSessionAction:"归档当前会话",archiveAdded:"会话已归档",archiveConfirmTitle:"确认归档会话",archiveConfirmDescription:"归档后,这条会话会从当前工作区主列表里隐藏,你仍然可以在归档区恢复它。",unarchiveAction:"取消归档",archiveRestored:"会话已恢复到主列表",archiveModalTitle:"归档会话",archiveModalDescription:"这里列出当前项目暂时隐藏的会话,需要时可以恢复到主列表。",archiveEmpty:"这个项目还没有归档会话。",subagentBadge:"子代理",subagentExpand:"展开子代理列表",subagentCollapse:"收起子代理列表",subagentExpandMore:"展开更多子代理",favoriteExpandMore:"显示更多收藏",sessionExpandMore:"显示更多会话",archiveExpandMore:"查看更多归档会话",workspaceCollapse:"收起项目",workspaceExpand:"展开项目",switchWorkspace:"切换到此项目",workspaceHomeSwitcherLabel:"切换工作区",workspaceHomeSwitcherTitle:"工作区",workspaceHomeStatusSectionTitle:"当前工作区",workspaceHomeViewAllAction:"查看全部会话",workspaceHomeMetricActive:"活动",workspaceHomeMetricUnread:"待看",workspaceHomeMetricTerminal:"终端",workspaceHomeMetricChanges:"变更",workspaceHomeActiveSessionsSectionTitle:"活动会话",workspaceHomeQuickLaunchStatusLabel:"快捷启动进程",workspaceHomeQuickLaunchRunning:"运行中",workspaceHomeQuickLaunchStopped:"未运行",workspaceHomeWaitingInputLabel:"等待输入",workspaceOverviewTitle:"把项目入口放到看得见的地方",workspaceOverviewBody:"先选项目,再决定是继续已有会话,还是开一条新的工作链路。",workspaceListBody:"这里保留当前工作台里的全部项目,并把高频操作直接放到首页。",workspaceDetailTitle:"项目详情",workspaceDetailSummaryTitle:"项目概览",workspaceDetailSummaryBody:"先看当前项目路径、Git 摘要和代码规模,再决定下一步去哪做事。",workspaceDetailMissingTitle:"没找到这个项目",workspaceDetailMissingBody:"这个项目可能已经被移除,或者当前快照还没加载到它。",workspaceSessionListBody:"项目里的会话、收藏和归档操作都收在这里,不再让你先去翻侧栏。",recentSessionsSectionTitle:"最近会话",recentSessionsSectionBody:"先回到最近在做的事情,别让手机端还要你猜入口。",currentWorkspaceSectionTitle:"当前项目会话",currentWorkspaceSectionBody:"当前项目下的会话都集中在这里,方便继续刚才的上下文。",sessionIndexTitle:"会话入口单独成页",sessionIndexBody:"最近、收藏、当前项目三块分开看,手机上找会话别再靠侧栏折叠。",toolsMoreAction:"更多",toolsSwipeHint:"左右滑动切换文件管理和 Git 管理",toolsSwipePosition:"{current} / {total}",toolFilesBody:"查看项目文件、变更文件和代码上下文,不再靠桌面右栏概念。",toolGitBody:"把当前项目的 Git 状态、提交和分支操作收进一个明确入口。",toolTerminalsBody:"进入终端主页面,处理输入密集和滚动密集的操作。",toolProcessesBody:"查看当前项目的终端模板、运行状态和进程入口。",toolsWorkspaceRequiredBody:"先选一个项目,再打开对应的工具页。",createSession:"新建会话",createSessionModalTitle:"选择新会话类型",createSessionModalDescription:"先选会话类型,再启动真正的会话进程。",createSessionWorkspaceLabel:"选择工作区",createSessionProviderLabel:"选择供应商",createSessionTarget:"当前项目",providerClaudeCode:"Claude Code",providerCodexDescription:"创建 Codex 会话,适合继续当前默认工作流。",providerClaudeDescription:"创建 Claude Code 会话,适合切换另一条会话链路。",providerOpenCodeDescription:"创建 OpenCode 会话,适合通过 OpenCode server 延续当前上下文。",providerOptionHint:"选择后会立即创建会话",startClaude:"Claude",startCodex:"Codex",startingSession:"创建中...",startClaudeSuccess:"Claude 会话已创建",startCodexSuccess:"Codex 会话已创建",startSessionFailed:"创建失败",auxiliaryTitle:"信息",auxiliarySubtitle:"文件与 Git 状态",expandAuxiliary:"展开",collapseAuxiliary:"收起",auxiliaryEmptyTitle:"选择一个会话",auxiliaryEmptyBody:"会话文件和 Git 信息将显示在这里",batchSelectSessions:"批量选择会话",batchSelectionMode:"批量选择",selectAllSessions:"全选",clearSelectedSessions:"清空选择",batchArchiveAction:"归档已选",batchArchiving:"归档中...",batchArchiveSuccess:"已归档选中的会话",batchArchivePartialFailed:"部分会话归档失败,请重试",batchArchiveFailed:"批量归档失败",hideSessionSidebar:"隐藏会话列表",showSessionSidebar:"显示会话列表",hideInfoSidebar:"隐藏信息栏",showInfoSidebar:"显示信息栏",centerTabsLabel:"中间区域标签",infoTabsLabel:"信息栏标签",leftResizerLabel:"调整左侧宽度",rightResizerLabel:"调整右侧宽度",filesPanelEmpty:"先导入或选中一个项目,文件管理才能显示。",gitPanelEmpty:"先导入或选中一个工作区,Git 信息才能显示。",infoPanelDeferred:"左侧会话列表优先加载,右侧附属面板稍后再挂载。"},workbench:{emptyEyebrow:"开始",emptyTitle:"先选一个会话",emptyBody:"从左侧继续之前的内容,或新建一个会话。",emptyResumeTitle:"继续",emptyResumeBody:"回到上次停下的地方。",emptyNewTitle:"新建",emptyNewBody:"把新问题放进新会话。",emptyCompanionTitle:"查看辅助信息",emptyCompanionBody:"需要文件、Git 或终端时,再看右侧。",emptyTip:"准备好后,从左侧选一个会话开始。"},conversation:{resendButton:"重发",historyLoading:"加载中...",historyLoadingOlder:"加载更早的消息...",historyLoadFailed:"加载失败",timelineEmpty:"开始对话",composerPlaceholder:"把下一步交代清楚,剩下的交给这条会话继续跑。",sendButton:"发送消息",attachFiles:"附加文件",pasteImagesHint:"支持直接粘贴图片",attachmentImageOnly:"目前只支持图片附件",attachmentReadFailed:"图片读取失败,请重试",attachmentPreviewAlt:"已选图片预览",attachmentPreviewOpen:"点击查看大图",attachmentPreviewClose:"关闭图片预览",attachmentPreviewLoading:"图片加载中",attachmentPreviewUnavailable:"图片暂时不可预览",imageAttachmentLabel:"图片附件",imagePreviewTitle:"图片预览",imagePreviewHint:"点击遮罩或按 Esc 可以关闭预览",removeAttachment:"移除附件",modelSelectorLabel:"选择模型",modelUseCliDefault:"默认",modelUseCodexConfig:"跟随当前 Codex 配置",modelUseOpenCodeConfig:"跟随当前 OpenCode 配置",reasoningSelectorLabel:"选择推理强度",reasoningLow:"低",reasoningMedium:"中",reasoningHigh:"高",reasoningMaximum:"极高",slashMenu:"命令",slashMenuTitle:"快捷命令",slashCommandPlan:"先让对方给出执行路线",slashCommandReview:"直接进入代码审查模式",slashCommandExplain:"要求用更清楚的方式解释",toolInputLabel:"输入",toolResultLabel:"结果",toolResultEmpty:"暂无输出",toolPreviewCommand:"命令",toolPreviewTerminal:"终端",toolStatusRunning:"运行中",toolStatusFailed:"已失败",toolStatusCompleted:"已完成",applyPatchEditedLabel:"已编辑",applyPatchAddedLabel:"已新增",applyPatchDeletedLabel:"已删除",applyPatchDialogTitle:"Patch 变更预览",applyPatchDialogDescription:"这里按文件显示 apply_patch 将要执行的变更。",applyPatchOpenDiff:"查看 diff",applyPatchAddedStat:"新增",applyPatchRemovedStat:"减少",applyPatchEmpty:"这个 patch 暂时没有可展示的文件变更。",titleFallback:"继续对话",draftTitleCodex:"New Codex session",draftTitleClaude:"New Claude Code session",draftTitleOpenCode:"New OpenCode session",headerWorkspace:"工作区",headerWorkspaceUnknown:"未知工作区",headerProvider:"Provider",headerConnection:"连接",headerRuntime:"运行态",providerCodex:"Codex",providerClaude:"Claude",providerOpenCode:"OpenCode",capabilitySend:"可发送",queueTitle:"待发队列",queueDescription:"当前运行结束后,会按顺序自动继续处理下面的消息。",queueOrderPrefix:"等待顺序",queueStatusQueued:"等待中",queueStatusFailed:"续跑失败",queueDelete:"删除",queueDeleting:"删除中",queueImageOnly:"只包含图片附件",sendGuidanceButton:"追加指导",queueGuidanceButton:"加入队列",capabilityDenied:"受限",capabilitySendDisabled:"发送受限",connectionConnected:"实时已连接",connectionReconnecting:"正在重连",connectionReconnectFailed:"重连失败",connectionClosed:"连接已关闭",runtimeIdle:"空闲",runtimeStarting:"启动中",runtimeRunning:"运行中",runtimeReconnecting:"恢复中",runtimeCompleted:"已完成",runtimeInterrupted:"已中断",runtimeFailed:"失败",rulesMessageTitle:"规则信息",rulesMessageHint:"这是一段会话启动规则,默认折叠显示,需要时再展开查看。",rulesMessageExpand:"展开规则",rulesMessageCollapse:"收起规则",thinkingLabel:"思考中",filePanelWorkspaceTab:"工作区",filePanelSessionTab:"本次会话",filePanelSessionViewLabel:"本次会话视图",filePanelSessionTreeView:"树状",filePanelSessionListView:"列表",filePanelSessionLoading:"正在整理本次会话修改的文件...",filePanelSessionEmpty:"这条会话还没识别到可暂存的修改文件。",filePanelSessionNoSession:"当前只选中了项目,还没选中会话,无法查看“本次会话”文件。",filePanelSessionStageAll:"全部暂存",filePanelSessionStageSuccess:"已把本次会话的修改加入暂存区。",filePanelSessionLoadFailed:"本次会话修改文件加载失败。",filePanelSessionSummary:"已识别文件",filePanelSessionUnstagedSummary:"未暂存",filePanelSessionDeleted:"已删除"},git:{recentVersionsTitle:"最近版本",stagedChangesTitle:"暂存的更改",expandRecentVersions:"展开最近版本",collapseRecentVersions:"折叠最近版本",stagedLabel:"暂存区",workingTreeLabel:"工作区",changeTreeHint:"按目录层级展示当前变更",discard:"放弃改动",discardFailed:"放弃改动失败",operationMenu:"操作菜单",currentBranch:"当前分支",resizePanels:"调整文件区和最近版本高度",switchBranchTo:"切换到",undoLastCommit:"撤销上次提交",undoLastCommitFailed:"撤销上次提交失败",undoLastCommitSuccess:"已撤销上次提交",historyKindLocal:"本地",historyKindRemote:"远程",historyKindShared:"已同步",pushNow:"推送",commitNow:"提交",refreshNow:"刷新",stageAll:"暂存全部",unstageAll:"取消暂存全部",discardAll:"放弃全部改动",selectedFiles:"已选文件",clearSelection:"清空选中",selectFile:"选中文件",discardConfirm:"确认放弃这些改动吗?{path}",historyItemMenu:"版本操作",copyCommitHash:"复制 Commit Hash",copyCommitHashSuccess:"Commit Hash 已复制。",copyCommitSubject:"复制提交标题",copyCommitSubjectSuccess:"提交标题已复制。"},terminalManager:{workspaceField:"当前工作区",refresh:"刷新列表",loadFailed:"终端管理面板加载失败",shellLoadFailed:"终端 Shell 列表加载失败",emptyWorkspaceBody:"还没有可用工作区。",noCurrentWorkspaceBody:"先选中一条会话,进程管理才能绑定对应的工作区。",emptyTerminalBody:"当前工作区还没有终端实例。",emptyTemplateBody:"还没有快捷启动项,可以先保存一条命令或脚本。",shellField:"新终端 Shell",shellUnavailable:"当前不可用",cwdField:"启动目录",cwdLabel:"目录",cwdPlaceholder:"留空时默认使用工作区根目录",modeField:"启动方式",commandMode:"命令",scriptMode:"脚本",quickLaunchTitle:"快捷启动",quickLaunchDescription:"先保存启动方式,需要时一键拉起到新终端。",desktopPanelDescription:"默认只看启动决策所需的信息,路径和命令行收进详情层。",runningCountLabel:"运行中",portWatchCountLabel:"已监控端口",terminalCountLabel:"终端数",templateSectionTitle:"启动项",templateSectionDescription:"右侧优先显示启动项的端口状态,看清楚是否已被占用。",openCreateModalAction:"添加快捷启动项",createModalTitle:"添加快捷启动项",createModalDescription:"在这里保存命令或脚本,可以附带端口,后面就能一键启动并判断是否在跑。",terminalSectionTitle:"终端实例",terminalSectionDescription:"这里显示当前工作区由 CodingNS 托管的终端。",closeAction:"关闭终端",closing:"关闭中...",closeSuccess:"终端关闭请求已提交。",closeFailed:"终端关闭失败",createTerminalAction:"新建空终端",creatingTerminal:"创建中...",createTerminalSuccess:"新终端已创建。",createTerminalFailed:"新终端创建失败",defaultTerminalName:"工作终端",templateNameField:"名称",templateNamePlaceholder:"留空时会自动生成",commandField:"启动命令",commandPlaceholder:"例如:npm",scriptPathField:"脚本路径",scriptPathPlaceholder:"例如:scripts/dev.ps1 或 scripts/dev.sh",argsField:"参数",argsPlaceholder:"例如:run dev 或 --watch",portField:"监听端口",portLabel:"端口",portPlaceholder:"例如:3000",invalidPort:"端口必须是 1 到 65535 的整数",saveLaunchAction:"保存为快速启动",templateSaving:"保存中...",templateSaveSuccess:"快捷启动项已保存。",templateSaveFailed:"快捷启动项保存失败",runTemplateAction:"启动到新终端",runningTemplate:"启动中...",templateRunSuccess:"快捷启动已发送到新终端。",templateRunFailed:"快捷启动执行失败",showDetailsAction:"显示详细信息",hideDetailsAction:"隐藏详细信息",detailsSectionTitle:"启动项详情",commandPreviewLabel:"启动命令",processIdLabel:"进程 ID",processCommandLabel:"进程命令行",stopProcessAction:"结束进程",stoppingProcess:"结束中...",stopProcessSuccess:"监听进程已结束。",stopProcessFailed:"监听进程结束失败",defaultCommandName:"新启动命令",defaultScriptName:"新启动脚本",lastActiveAt:"最近活跃",updatedAt:"最后更新",processCommandFallback:"这个进程没有暴露命令行",portUnset:"未配置端口",portUnsetDescription:"没有端口时,只能启动,不能自动判断服务是否在跑。",portOccupied:"进程已启动",portAvailable:"端口暂未被占用",portAvailableDescription:"这个启动项对应的端口目前还没有监听进程。",statusRunning:"运行中",statusStopped:"未运行",exitCode:"Exit Code",runningValue:"运行中"},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"主题"}},Wj={common:{close:"Close",cancel:"Cancel",logout:"Log out",language:"Language"},locale:{zhCN:"Simplified Chinese",enUS:"English"},settings:{title:"Settings",appearance:"Appearance",language:"Language",languageDescription:"Choose the display language used by the interface. The page updates immediately.",theme:"Theme",themeDescription:"Choose the color theme that fits the way you work.",connection:"Connection & Updates",serverAddress:"Server Address",serverDescription:"Desktop and H5 both work through this host entry.",releaseChannel:"Release Channel",releaseChannelDescription:"Stable or beta",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"Auto Reconnect",autoReconnectDescription:"Retry HTTP and WebSocket links automatically when Host is briefly unavailable.",autoCheckUpdate:"Auto Check Client Updates",autoCheckUpdateDescription:"Clients only",enabled:"Enabled",disabled:"Disabled",serverUpdate:"Server Update",serverUpdateDescription:"",clientUpdate:"Client Update",clientUpdateDescription:"",serverCurrentVersion:"Server Current Version",serverTargetVersion:"Server Target Version",serverPackageName:"npm Package",serverUpdateCommand:"Upgrade Command",serverCheckNow:"Check Server",serverOpenPage:"Open npm",serverLatestUnknown:"Unavailable",serverUpdateReady:"New version found",serverUpToDate:"Up to date",serverCheckFailed:"Check failed",serverOpenPageFailed:"Failed to open page",runtimePlatform:"Runtime Platform",runtimePlatformDescription:"Shows whether the app is running in Web/H5, Desktop, iOS, or Android.",platformDesktop:"Desktop",platformWeb:"Web",platformIos:"iOS",platformAndroid:"Android",releaseDesktopOnly:"Desktop updates are not available in the current Web/H5 runtime.",releaseCurrentVersion:"Current Version",releaseTargetVersion:"Target Version",releaseUnknownVersion:"Unknown",releaseNotes:"What's New",releaseNotesEmpty:"No details",releaseCheckNow:"Check Client",releaseInstallNow:"Install",releaseRollback:"Rollback",releaseUpdateReady:"New version found",releaseUpToDate:"Up to date",releaseCheckFailed:"Check failed",releaseInstallStarted:"Install started",releaseInstallFailed:"Install failed",releaseRollbackStarted:"Rollback started",releaseRollbackFailed:"Rollback failed",clientUpdateUnsupported:"Install updates are not supported here",account:"Account",logout:"Log out",logoutDescription:"Sign out of the current account and return to the login page."},shell:{title:"Workbench",subtitle:"Manage AI sessions inside code projects",mobileWorkspacesEntry:"Workspaces",mobileTerminalsEntry:"Terminal",mobileSessionsEntry:"Conversation",mobileToolsEntry:"Tools",mobileSettingsEntry:"Settings",mobileNavigationAction:"Open workbench menu",mobileSearchAction:"Open search",mobileAuxiliaryAction:"Open tools panel",mobileRevealNavigationAction:"Show primary navigation",mobileHideNavigationAction:"Hide primary navigation",mobileConversationPreviewTitle:"Quick Preview",mobileConversationCurrentWorkspaceSection:"Current Workspace",mobileConversationCollapsePreviewAction:"Hide Preview",mobileConversationRestorePreviewAction:"Restore Session Preview",iosMoreAction:"More actions",androidMoreAction:"More actions",conversationEntry:"Conversation",terminalsEntry:"Terminal",searchEntry:"Search",searchModalTitle:"Search",searchModalDescription:"Search sessions by title, or search code files inside the selected workspace.",searchModeLabel:"Search mode",searchModeSessions:"Sessions",searchModeCode:"Code",searchKeywordLabel:"Keyword",searchWorkspaceLabel:"Workspace",searchSessionPlaceholder:"Search by session title, workspace, or provider",searchCodePlaceholder:"Search by file name or path fragment",searchSessionHint:"Type a keyword to instantly filter matching sessions.",searchCodeHint:"Pick a workspace, then search by file name or path.",searchSessionEmpty:"No matching sessions found.",searchCodeEmpty:"No matching files found.",searchCodeFailed:"Code search failed. Please try again later.",searchSubmit:"Search",filesEntry:"Files",gitEntry:"Git",terminalManagerEntry:"Process Manager",workspaceSectionTitle:"Workspaces",goBack:"Back",goForward:"Forward",workspaceCount:"Projects",sessionCount:"Sessions",manageWorkspaceAction:"Manage Projects",manageWorkspaceTitle:"Manage Projects",manageWorkspaceDescription:"The list starts with the currently loaded projects. Expand one to inspect its path, Git summary, and code composition, or remove it from the current workbench list.",manageWorkspaceEmpty:"There are no projects to manage right now.",manageWorkspaceLoading:"Loading project details...",manageWorkspaceLoadFailed:"Failed to load project details.",manageWorkspacePathLabel:"Path",manageWorkspaceGitCommitCount:"Git Commit Count",manageWorkspaceGitInfoLabel:"Git Repository Info",manageWorkspaceRepoRoot:"Repository Root",manageWorkspaceCurrentBranch:"Current Branch",manageWorkspaceRemoteLabel:"Remote",manageWorkspaceNoRemote:"No remote configured",manageWorkspaceNotGit:"This project is not a Git repository.",manageWorkspaceCodeCompositionLabel:"Code Composition",manageWorkspaceCodeCompositionFiles:"files",manageWorkspaceCodeCompositionOther:"Other",manageWorkspaceNoCodeComposition:"No recognizable code files were found for composition stats.",manageWorkspaceCodeTruncated:"The project is large, so only the first {count} recognizable files were counted.",manageWorkspaceRemoveAction:"Remove Project",manageWorkspaceRemoving:"Removing...",manageWorkspaceRemoveSuccess:"Project removed from the current workbench list",manageWorkspaceRemoveFailed:"Failed to remove the project",manageWorkspaceRemoveConfirmTitle:"Confirm Project Removal",manageWorkspaceRemoveConfirmDescription:"This only removes the project from the current workbench list. It does not delete any files on disk or historical records. If you load the same path again later, the old records will appear again.",manageWorkspaceRemoveConfirmTarget:'Remove "{name}" from the current workbench?',manageWorkspaceRemoveConfirmAction:"Remove Project",importWorkspaceTitle:"Add Project",importWorkspaceHint:"Import a local code directory",importExpand:"Expand",importCollapse:"Collapse",importPathLabel:"Project Path",importPathPlaceholder:"Enter the project folder path",importNameLabel:"Project Name",importNamePlaceholder:"Optional",importSubmit:"Add Project",importSubmitting:"Adding...",importChooseFolder:"Choose Folder",importPickFolderFailed:"Failed to open the folder picker",importDesktopDropHint:"You can drag a local project folder directly into this area",importHint:"Enter a local code directory and start working",importServerDirectoryHint:"Browse and select the project directory on the server",importBrowserTitle:"Select Server Directory",importBrowserDescription:"You are browsing directories on the server, not on the current device.",importBrowserCurrentPath:"Current Path",importBrowserRoots:"Root Directories",importBrowserOpenParent:"Go Up",importBrowserOpenPath:"Open Path",importBrowserCreateDirectory:"New Folder",importBrowserCreateDirectoryTitle:"New Folder",importBrowserCreateDirectoryDescription:"Create a single child folder in the current server path. Path separators are not accepted.",importBrowserCreateDirectoryLabel:"Folder Name",importBrowserCreateDirectoryPlaceholder:"Enter the new folder name",importBrowserCreateDirectorySuccess:"Folder created",importBrowserCreateDirectoryFailed:"Failed to create folder",importBrowserCreateDirectorySubmit:"Create Folder",importBrowserCreatingDirectory:"Creating...",importBrowserEmpty:"No subdirectory is available in the current path",importBrowserBrowseFailed:"Failed to load server directories",importBrowserSubmit:"Import Current Directory",importPathRequired:"Enter the project path",importSuccess:"Project added",importFailed:"Failed to add project",cloneWorkspaceTitle:"Clone Project",cloneWorkspaceHint:"Clone a Git repository into a server directory and add it to the project list.",cloneSubmit:"Clone Project",cloneSubmitting:"Cloning...",cloneRepositoryLabel:"Git Repository URL",cloneRepositoryPlaceholder:"For example: https://github.com/org/repo.git",cloneParentPathLabel:"Target Parent Directory",cloneParentPathPlaceholder:"Choose an existing directory on the backend server",cloneDirectoryNameLabel:"New Project Directory Name",cloneDirectoryNamePlaceholder:"Defaults to the repository name when left empty",clonePickDirectory:"Choose Directory",cloneAuthModeLabel:"Authentication",cloneAuthModeNone:"No Authentication",cloneAuthModeBasic:"Username + Password",cloneAuthModeToken:"Token",cloneUsernameLabel:"Username",cloneUsernamePlaceholder:"Enter Git username",clonePasswordLabel:"Password",clonePasswordPlaceholder:"Enter Git password",cloneTokenLabel:"Token",cloneTokenPlaceholder:"Enter access token",cloneTokenUsernamePlaceholder:"Optional, defaults to git when left empty",cloneRepoRequired:"Enter the Git repository URL",clonePathRequired:"Select the target parent directory",cloneSuccess:"Project cloned successfully",cloneFailed:"Clone failed",cloneHint:"The target parent directory must already exist. Clone creates a new repository folder under it.",cloneBrowserTitle:"Select Clone Parent Directory",cloneBrowserDescription:"Choose an existing server-side parent directory. Clone will create a new project folder under it.",cloneBrowserSubmit:"Use Current Directory",refreshNavigation:"Refresh",desktopChromeLabel:"Desktop Workbench",windowMinimize:"Minimize Window",windowMaximize:"Maximize or Restore Window",windowClose:"Close Window",contextOpenSession:"Open Session",navigationLoadFailed:"Load failed. Retry.",emptyNavigationTitle:"No project yet",emptyNavigationBody:"Add a local code directory to start working",emptyWorkspaceSessions:"No sessions",favoriteSectionTitle:"Pinned Sessions",favoriteSectionEmpty:"Pinned sessions stay here for quick access.",favoriteAction:"Pin Session",unfavoriteAction:"Unpin",favoriteAdded:"Session pinned",favoriteRemoved:"Session unpinned",favoriteToggleFailed:"Failed to update pinned state",sessionMoreAction:"More Actions",sessionStateInferred:"Inferred",renameAction:"Rename",renameSuccess:"Session name updated",renameFailed:"Failed to rename session",renameModalTitle:"Rename Session",renameModalDescription:"Use a name you can recognize at a glance. This changes only the title, not the content.",renameInputLabel:"Session Name",renameInputPlaceholder:"Enter a new session name",renamingSession:"Saving...",archiveFolderLabel:"Archived Sessions",archiveFolderAction:"Open Archive Folder",archiveAction:"Archive Session",archiveCurrentSessionAction:"Archive Current Session",archiveAdded:"Session archived",archiveConfirmTitle:"Archive This Session",archiveConfirmDescription:"After archiving, this session will be hidden from the main list for the current workspace, and you can still restore it from archive.",unarchiveAction:"Restore from Archive",archiveRestored:"Session restored to the main list",archiveModalTitle:"Archived Sessions",archiveModalDescription:"This list shows sessions temporarily hidden in the current project. Restore them when needed.",archiveEmpty:"There are no archived sessions in this project yet.",subagentBadge:"Sub-agent",subagentExpand:"Expand Sub-agent List",subagentCollapse:"Collapse Sub-agent List",subagentExpandMore:"Show More Sub-agents",favoriteExpandMore:"Show More Pinned",sessionExpandMore:"Show More Sessions",archiveExpandMore:"Show More Archived Sessions",workspaceCollapse:"Collapse Project",workspaceExpand:"Expand Project",switchWorkspace:"Switch to Project",workspaceHomeSwitcherLabel:"Switch Workspace",workspaceHomeSwitcherTitle:"Workspace",workspaceHomeStatusSectionTitle:"Current Workspace",workspaceHomeViewAllAction:"View All Sessions",workspaceHomeMetricActive:"Active",workspaceHomeMetricUnread:"Review",workspaceHomeMetricTerminal:"Terminals",workspaceHomeMetricChanges:"Changes",workspaceHomeActiveSessionsSectionTitle:"Active Sessions",workspaceHomeQuickLaunchStatusLabel:"Quick Launch Process",workspaceHomeQuickLaunchRunning:"Running",workspaceHomeQuickLaunchStopped:"Stopped",workspaceHomeWaitingInputLabel:"Waiting Input",workspaceOverviewTitle:"Put project entry points where you can actually see them",workspaceOverviewBody:"Choose a project first, then decide whether to continue or start a new session.",workspaceListBody:"Keep every loaded project here and surface the frequent actions on the page.",workspaceDetailTitle:"Project Details",workspaceDetailSummaryTitle:"Project Overview",workspaceDetailSummaryBody:"See the path, Git summary, and code footprint first, then jump into the right tool.",workspaceDetailMissingTitle:"Project not found",workspaceDetailMissingBody:"This project may have been removed, or the current snapshot has not loaded it yet.",workspaceSessionListBody:"Project sessions, favorites, and archive actions live here instead of hiding in a sidebar.",recentSessionsSectionTitle:"Recent Sessions",recentSessionsSectionBody:"Jump back into the work you touched most recently.",currentWorkspaceSectionTitle:"Current Project Sessions",currentWorkspaceSectionBody:"Keep the sessions for the current project together so the context stays obvious.",sessionIndexTitle:"Sessions deserve their own page",sessionIndexBody:"Recent, favorites, and current-project sessions are split into clear sections for mobile.",toolsMoreAction:"More",toolsSwipeHint:"Swipe left or right to switch between files and Git",toolsSwipePosition:"{current} / {total}",toolFilesBody:"Browse project files, changed files, and code context without relying on a desktop sidebar.",toolGitBody:"Open a clear Git entry for status, commits, and branches in the current project.",toolTerminalsBody:"Open the full terminal page for input-heavy and scroll-heavy tasks.",toolProcessesBody:"Review terminal templates, runtime status, and process entry points for the current project.",toolsWorkspaceRequiredBody:"Pick a project before opening this tool page.",createSession:"New Session",createSessionModalTitle:"Choose Session Type",createSessionModalDescription:"Pick the session type first, then start the actual session process.",createSessionWorkspaceLabel:"Choose Workspace",createSessionProviderLabel:"Choose Provider",createSessionTarget:"Current Project",providerClaudeCode:"Claude Code",providerCodexDescription:"Create a Codex session for the current default workflow.",providerClaudeDescription:"Create a Claude Code session when you want to switch to another conversation chain.",providerOpenCodeDescription:"Create an OpenCode session to continue context via the OpenCode service.",providerOptionHint:"A session is created immediately after selection",startClaude:"Claude",startCodex:"Codex",startingSession:"Creating...",startClaudeSuccess:"Claude session created",startCodexSuccess:"Codex session created",startSessionFailed:"Failed to create session",auxiliaryTitle:"Info",auxiliarySubtitle:"Files and Git status",expandAuxiliary:"Expand",collapseAuxiliary:"Collapse",auxiliaryEmptyTitle:"Select a session",auxiliaryEmptyBody:"Session files and Git info will appear here",batchSelectSessions:"Select Sessions in Bulk",batchSelectionMode:"Batch Selection",selectAllSessions:"Select All",clearSelectedSessions:"Clear Selection",batchArchiveAction:"Archive Selected",batchArchiving:"Archiving...",batchArchiveSuccess:"Selected sessions archived",batchArchivePartialFailed:"Some sessions failed to archive. Retry.",batchArchiveFailed:"Batch archive failed",hideSessionSidebar:"Hide Session List",showSessionSidebar:"Show Session List",hideInfoSidebar:"Hide Info Sidebar",showInfoSidebar:"Show Info Sidebar",centerTabsLabel:"Center Area Tabs",infoTabsLabel:"Info Sidebar Tabs",leftResizerLabel:"Resize Left Sidebar",rightResizerLabel:"Resize Right Sidebar",filesPanelEmpty:"Import or select a workspace first to use file management.",gitPanelEmpty:"Import or select a workspace first to view Git info.",infoPanelDeferred:"The left session list loads first. The right auxiliary panel mounts slightly later."},workbench:{emptyEyebrow:"Start",emptyTitle:"Choose a session first",emptyBody:"Continue from the left, or create a new session.",emptyResumeTitle:"Continue",emptyResumeBody:"Go back to where you stopped.",emptyNewTitle:"New session",emptyNewBody:"Put a new question into a clean session.",emptyCompanionTitle:"Side details",emptyCompanionBody:"Open files, Git, or terminal on the right when needed.",emptyTip:"When you are ready, pick a session from the left."},conversation:{resendButton:"Resend",historyLoading:"Loading...",historyLoadingOlder:"Loading older messages...",historyLoadFailed:"Load failed",timelineEmpty:"Start Conversation",composerPlaceholder:"State the next step clearly. Let the session continue from there.",sendButton:"Send Message",attachFiles:"Attach File",pasteImagesHint:"Supports pasting images directly",attachmentImageOnly:"Only image attachments are supported right now",attachmentReadFailed:"Failed to read image. Retry.",attachmentPreviewAlt:"Selected image preview",attachmentPreviewOpen:"Click to view full image",attachmentPreviewClose:"Close image preview",attachmentPreviewLoading:"Loading image...",attachmentPreviewUnavailable:"Image preview unavailable",imageAttachmentLabel:"Image Attachment",imagePreviewTitle:"Image Preview",imagePreviewHint:"Click the backdrop or press Esc to close the preview",removeAttachment:"Remove Attachment",modelSelectorLabel:"Model",modelUseCliDefault:"Default",modelUseCodexConfig:"Follow current Codex config",modelUseOpenCodeConfig:"Follow current OpenCode config",reasoningSelectorLabel:"Reasoning Effort",reasoningLow:"Low",reasoningMedium:"Medium",reasoningHigh:"High",reasoningMaximum:"Maximum",slashMenu:"Commands",slashMenuTitle:"Quick Commands",slashCommandPlan:"Ask for an execution plan first",slashCommandReview:"Switch directly to code review mode",slashCommandExplain:"Ask for a clearer explanation",toolInputLabel:"Input",toolResultLabel:"Result",toolResultEmpty:"No output yet",toolPreviewCommand:"Command",toolPreviewTerminal:"Terminal",toolStatusRunning:"Running",toolStatusFailed:"Failed",toolStatusCompleted:"Completed",applyPatchEditedLabel:"Edited",applyPatchAddedLabel:"Added",applyPatchDeletedLabel:"Deleted",applyPatchDialogTitle:"Patch Change Preview",applyPatchDialogDescription:"This shows the file-level changes that apply_patch is about to perform.",applyPatchOpenDiff:"View Diff",applyPatchAddedStat:"Added",applyPatchRemovedStat:"Removed",applyPatchEmpty:"This patch does not contain any file change that can be displayed right now.",titleFallback:"Continue Conversation",draftTitleCodex:"New Codex session",draftTitleClaude:"New Claude Code session",draftTitleOpenCode:"New OpenCode session",headerWorkspace:"Workspace",headerWorkspaceUnknown:"Unknown Workspace",headerProvider:"Provider",headerConnection:"Connection",headerRuntime:"Runtime",providerCodex:"Codex",providerClaude:"Claude",providerOpenCode:"OpenCode",capabilitySend:"Send Enabled",queueTitle:"Queued Messages",queueDescription:"After the current run finishes, these messages will be processed automatically in order.",queueOrderPrefix:"Queue Position",queueStatusQueued:"Queued",queueStatusFailed:"Dispatch Failed",queueDelete:"Delete",queueDeleting:"Deleting",queueImageOnly:"Image attachments only",sendGuidanceButton:"Add Guidance",queueGuidanceButton:"Queue Guidance",capabilityDenied:"Restricted",capabilitySendDisabled:"Sending disabled",connectionConnected:"Realtime connected",connectionReconnecting:"Reconnecting",connectionReconnectFailed:"Reconnect failed",connectionClosed:"Connection closed",runtimeIdle:"Idle",runtimeStarting:"Starting",runtimeRunning:"Running",runtimeReconnecting:"Recovering",runtimeCompleted:"Completed",runtimeInterrupted:"Interrupted",runtimeFailed:"Failed",rulesMessageTitle:"Rules",rulesMessageHint:"This is the startup rule block for the session. It is collapsed by default and can be expanded when needed.",rulesMessageExpand:"Expand Rules",rulesMessageCollapse:"Collapse Rules",thinkingLabel:"Thinking",filePanelWorkspaceTab:"Workspace",filePanelSessionTab:"Session",filePanelSessionViewLabel:"Session File View",filePanelSessionTreeView:"Tree",filePanelSessionListView:"List",filePanelSessionLoading:"Collecting files changed in this session...",filePanelSessionEmpty:"No cacheable changed files have been detected in this session yet.",filePanelSessionNoSession:"Only the workspace is selected right now. Pick a session before viewing session-scoped files.",filePanelSessionStageAll:"Stage All",filePanelSessionStageSuccess:"Changes from this session have been added to the staging area.",filePanelSessionLoadFailed:"Failed to load changed files for this session.",filePanelSessionSummary:"Detected Files",filePanelSessionUnstagedSummary:"Unstaged",filePanelSessionDeleted:"Deleted"},git:{recentVersionsTitle:"Recent Versions",stagedChangesTitle:"Staged Changes",expandRecentVersions:"Expand Recent Versions",collapseRecentVersions:"Collapse Recent Versions",stagedLabel:"Staged",workingTreeLabel:"Working Tree",changeTreeHint:"Show current changes by directory hierarchy",discard:"Discard Changes",discardFailed:"Failed to discard changes",operationMenu:"Actions",currentBranch:"Current Branch",resizePanels:"Resize file and recent-version panels",switchBranchTo:"Switch To",undoLastCommit:"Undo Last Commit",undoLastCommitFailed:"Failed to undo last commit",undoLastCommitSuccess:"Last commit undone",historyKindLocal:"Local",historyKindRemote:"Remote",historyKindShared:"Synced",pushNow:"Push",commitNow:"Commit",refreshNow:"Refresh",stageAll:"Stage All",unstageAll:"Unstage All",discardAll:"Discard All Changes",selectedFiles:"Selected Files",clearSelection:"Clear Selection",selectFile:"Select File",discardConfirm:"Discard these changes? {path}",historyItemMenu:"Commit Actions",copyCommitHash:"Copy Commit Hash",copyCommitHashSuccess:"Commit hash copied.",copyCommitSubject:"Copy Commit Title",copyCommitSubjectSuccess:"Commit title copied."},terminalManager:{workspaceField:"Current Workspace",refresh:"Refresh List",loadFailed:"Failed to load the terminal management panel",shellLoadFailed:"Failed to load the terminal shell list",emptyWorkspaceBody:"There is no available workspace yet.",noCurrentWorkspaceBody:"Select a session first so process management can bind to its workspace.",emptyTerminalBody:"There is no terminal instance in the current workspace yet.",emptyTemplateBody:"There is no quick launch item yet. Save a command or script first.",shellField:"Shell for New Terminal",shellUnavailable:"Unavailable",cwdField:"Startup Directory",cwdLabel:"Directory",cwdPlaceholder:"Defaults to the workspace root when left empty",modeField:"Launch Mode",commandMode:"Command",scriptMode:"Script",quickLaunchTitle:"Quick Launch",quickLaunchDescription:"Save a launch preset here so you can start it in a new terminal with one click later.",desktopPanelDescription:"Keep the default view focused on launch decisions, while paths and command lines stay inside the details layer.",runningCountLabel:"Running",portWatchCountLabel:"Watched Ports",terminalCountLabel:"Terminals",templateSectionTitle:"Launch Items",templateSectionDescription:"The right side prioritizes the port status of launch items so you can see whether a service is already in use.",openCreateModalAction:"Add Quick Launch Item",createModalTitle:"Add Quick Launch Item",createModalDescription:"Save a command or script here. You can attach a port and then start it with one click while checking whether it is already running.",terminalSectionTitle:"Terminal Instances",terminalSectionDescription:"This area shows terminals currently managed by CodingNS for the workspace.",closeAction:"Close Terminal",closing:"Closing...",closeSuccess:"Terminal close request submitted.",closeFailed:"Failed to close terminal",createTerminalAction:"New Empty Terminal",creatingTerminal:"Creating...",createTerminalSuccess:"New terminal created.",createTerminalFailed:"Failed to create a new terminal",defaultTerminalName:"Workspace Terminal",templateNameField:"Name",templateNamePlaceholder:"Generated automatically when left empty",commandField:"Launch Command",commandPlaceholder:"For example: npm",scriptPathField:"Script Path",scriptPathPlaceholder:"For example: scripts/dev.ps1 or scripts/dev.sh",argsField:"Arguments",argsPlaceholder:"For example: run dev or --watch",portField:"Listening Port",portLabel:"Port",portPlaceholder:"For example: 3000",invalidPort:"Port must be an integer between 1 and 65535",saveLaunchAction:"Save as Quick Launch",templateSaving:"Saving...",templateSaveSuccess:"Quick launch item saved.",templateSaveFailed:"Failed to save quick launch item",runTemplateAction:"Run in New Terminal",runningTemplate:"Starting...",templateRunSuccess:"Quick launch item sent to a new terminal.",templateRunFailed:"Failed to run quick launch item",showDetailsAction:"Show details",hideDetailsAction:"Hide details",detailsSectionTitle:"Launch item details",commandPreviewLabel:"Launch Command",processIdLabel:"Process ID",processCommandLabel:"Process Command Line",stopProcessAction:"Stop Process",stoppingProcess:"Stopping...",stopProcessSuccess:"The listening process has been stopped.",stopProcessFailed:"Failed to stop the listening process",defaultCommandName:"New Launch Command",defaultScriptName:"New Launch Script",lastActiveAt:"Last Active",updatedAt:"Updated At",processCommandFallback:"This process did not expose its command line",portUnset:"Port Not Configured",portUnsetDescription:"Without a port, the item can only be started. The system cannot determine automatically whether the service is running.",portOccupied:"Process Started",portAvailable:"Port Available",portAvailableDescription:"There is currently no listening process on the port used by this launch item.",statusRunning:"Running",statusStopped:"Stopped",exitCode:"Exit Code",runningValue:"Running"},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"Theme"}},Db={"zh-CN":Bj,"en-US":Oj},_b={"zh-CN":zj,"en-US":Wj};function wc(e,t){const n=e.split(".");let s=t;for(const o of n){if(!s||typeof s=="string")return e;const c=s[o];if(c==null)return e;s=c}return typeof s=="string"?s:e}function Hj(){return cn.getState().language??"zh-CN"}function h(e,t){const s=Hj()==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const o of s){const c=wc(e,_b[o]);if(c!==e)return Pd(c,t);const l=wc(e,Db[o]);if(l!==e)return Pd(l,t)}return Pd(e,t)}function Pd(e,t){return t?e.replace(/\{([^}]+)\}/g,(n,s)=>{const o=t[s];return o==null?n:String(o)}):e}function $j({children:e,language:t}){return w.useEffect(()=>{document.documentElement.setAttribute("lang",t)},[t]),e}function Vj(){const e=Rc(t=>t.language);return t=>{const n=e==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const s of n){const o=wc(t,_b[s]);if(o!==t)return o;const c=wc(t,Db[s]);if(c!==t)return c}return t}}const Ac=[{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"}],Lc="codingns-theme";function Fb(e){return h(e.labelKey)}function qj(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Gj(){if(typeof window>"u")return null;const e=localStorage.getItem(Lc);return e&&Ac.some(t=>t.id===e)?e:null}function Ob(){return Gj()??qj()}function Bb(e){typeof window>"u"||(document.documentElement.setAttribute("data-theme",e),localStorage.setItem(Lc,e))}function Kj(e){const t=n=>{n.key===Lc&&e()};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)}function Qj(){if(typeof window>"u")return"light";const e=document.documentElement.getAttribute("data-theme");return e&&Ac.some(t=>t.id===e)?e:Ob()}function Ub(){return{theme:w.useSyncExternalStore(Kj,Qj,()=>"light"),setTheme:t=>{Bb(t),window.dispatchEvent(new StorageEvent("storage",{key:Lc}))}}}function Yj(){Bb(Ob())}function Xj({children:e}){return w.useEffect(()=>{Yj()},[]),i.jsx(i.Fragment,{children:e})}const Jj={showToast:()=>"",dismissToast:()=>{}},zb=w.createContext(Jj);function Zj(){return`toast-${Math.random().toString(36).slice(2,10)}`}function eN({toast:e,onDismiss:t}){const{id:n,title:s,description:o,tone:c,durationMs:l,action:d}=e;return w.useEffect(()=>{if(l===null)return;const p=window.setTimeout(()=>{t(n)},l);return()=>{window.clearTimeout(p)}},[l,n,t,s,o,c]),i.jsxs("article",{className:"toast-card","data-tone":c,role:c==="error"?"alert":"status",children:[i.jsxs("div",{className:"toast-body",children:[i.jsx("strong",{className:"toast-title",children:s}),o?i.jsx("p",{className:"toast-description",children:o}):null]}),i.jsxs("div",{className:"toast-actions",children:[d?i.jsx("button",{className:"toast-action",type:"button",onClick:()=>{d.onClick(),t(n)},children:d.label}):null,i.jsx("button",{className:"toast-dismiss",type:"button","aria-label":"关闭通知",onClick:()=>t(n),children:"x"})]})]})}function tN({children:e}){const[t,n]=w.useState([]),s=w.useCallback(l=>{n(d=>d.filter(p=>p.id!==l))},[]),o=w.useCallback(l=>{const d=l.id??Zj(),p={id:d,title:l.title,description:l.description,tone:l.tone??"info",durationMs:l.durationMs===void 0?4200:l.durationMs,action:l.action};return n(m=>{const y=m.findIndex(b=>b.id===d);if(y===-1)return[...m,p];const g=[...m];return g[y]=p,g}),d},[]),c=w.useMemo(()=>({showToast:o,dismissToast:s}),[s,o]);return i.jsxs(zb.Provider,{value:c,children:[e,i.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(l=>i.jsx(eN,{toast:l,onDismiss:s},l.id))})]})}function Gn(){return w.useContext(zb)}const nN="modulepreload",rN=function(e){return"/"+e},ny={},Ic=function(t,n,s){let o=Promise.resolve();if(n&&n.length>0){let l=function(m){return Promise.all(m.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));o=l(n.map(m=>{if(m=rN(m),m in ny)return;ny[m]=!0;const y=m.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const b=document.createElement("link");if(b.rel=y?"stylesheet":nN,y||(b.as="script"),b.crossOrigin="",b.href=m,p&&b.setAttribute("nonce",p),document.head.appendChild(b),y)return new Promise((x,C)=>{b.addEventListener("load",x),b.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${m}`)))})}))}function c(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return o.then(l=>{for(const d of l||[])d.status==="rejected"&&c(d.reason);return t().catch(c)})},Wb="codingns.server.base-url.history",Hb=6,$b="__custom__";function Vb(){return typeof window<"u"&&typeof window.localStorage<"u"}function iN(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function qb(e){if(!e)return null;try{return mi(e)}catch{return null}}function sN(){if(!Vb())return[];const e=window.localStorage.getItem(Wb);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(n=>typeof n=="string"?qb(n):null).filter(n=>!!n):[]}catch{return[]}}function aN(e){const t=new Set,n=[];for(const s of e)!s||t.has(s)||(t.add(s),n.push(s));return n}function oN(e){const t=sN();return aN([e,...t,qb(iN())]).slice(0,Hb)}function lN(e){Vb()&&window.localStorage.setItem(Wb,JSON.stringify(e.slice(0,Hb)))}class cN{constructor(){Ze(this,"state",this.createState(cn.getState().hostBaseUrl));Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);cn.subscribe(()=>{const t=this.createState(cn.getState().hostBaseUrl);t.baseUrl===this.state.baseUrl&&t.options.length===this.state.options.length&&t.options.every((n,s)=>n===this.state.options[s])||(this.state=t,this.emit())})}setBaseUrl(t){const n=mi(t),s=n!==cn.getState().hostBaseUrl;return this.state=this.createState(n),this.emit(),cn.update({hostBaseUrl:n}),s}reset(){this.state=this.createState(cn.getState().hostBaseUrl),this.emit()}createState(t){const n=oN(t);return lN(n),{baseUrl:t,options:n}}emit(){for(const t of this.listeners)t()}}const bc=new cN;function xc(e){return w.useSyncExternalStore(bc.subscribe,()=>e(bc.getState()))}function uN(e,t){return t.includes(e)?e:$b}function dN(){return $b}function hN(e){return e.endsWith("/")?e:`${e}/`}function fN(e){return e.replace(/^\/+/,"")}function xo(){return cn.getState().hostBaseUrl}function Gb(e,t=xo()){return new URL(fN(e),hN(t)).toString()}function Kb(e,t=xo()){const n=new URL(Gb(e,t));return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.toString()}class Hn extends Error{constructor(n,s){super(s.detail);Ze(this,"status");Ze(this,"errorCode");Ze(this,"field");this.name="ApiError",this.status=n,this.errorCode=s.error_code,this.field=s.field}}class pN{async request(t,n={}){const s=await this.performRequest(t,n);if(s.status===204||s.status===205)return;const o=await s.text();if(o)return JSON.parse(o)}async requestBlob(t,n={}){return(await this.performRequest(t,n)).blob()}async performRequest(t,n){var d;const s=new Headers(n.headers),o=n.body!==void 0&&n.body!==null,c=Gb(t,n.baseUrl??xo());if(o&&!s.has("Content-Type")&&s.set("Content-Type","application/json"),!n.skipAuth){const p=(d=Sn.getState().session)==null?void 0:d.accessToken;if(!p)throw Sn.clear(),new Hn(401,{detail:"当前没有可用的登录态",error_code:"UNAUTHORIZED"});s.set("Authorization",`Bearer ${p}`)}let l;try{l=await fetch(c,{...n,headers:s})}catch(p){const m=p instanceof Error?p.message:"未知网络错误";throw new Hn(0,{detail:`请求 ${c} 失败:${m}`,error_code:"NETWORK_ERROR"})}if(!l.ok){const p=await mN(l);if(Qb(l.status,p.error_code)&&!n.skipAuth&&!n.retryAfterRefresh){const m=await Sn.refresh();if(m.status==="refreshed")return this.performRequest(t,{...n,retryAfterRefresh:!0});throw m.status==="invalid"?new Hn(401,{detail:"登录态已经失效,请重新登录",error_code:"UNAUTHORIZED"}):new Hn(0,{detail:"登录态暂时无法恢复,请稍后重试",error_code:"AUTH_REFRESH_UNAVAILABLE"})}throw!n.skipAuth&&gN(l.status,p.error_code)&&Sn.clear(),new Hn(l.status,p)}return l}}const Xe=new pN;async function mN(e){const t=await e.text();if(!t)return ry(e.status);try{const n=JSON.parse(t);if(typeof n.detail=="string"&&typeof n.error_code=="string")return{detail:n.detail,error_code:n.error_code,field:typeof n.field=="string"?n.field:void 0,timestamp:typeof n.timestamp=="string"?n.timestamp:void 0}}catch{}return ry(e.status,t)}function ry(e,t){return{detail:(t==null?void 0:t.trim())||`请求失败(HTTP ${e})`,error_code:e===401?"UNAUTHORIZED":"HTTP_ERROR"}}function Qb(e,t){return e!==401?!1:t==="UNAUTHORIZED"||t==="TOKEN_EXPIRED"||t==="TOKEN_INVALID"}function gN(e,t){return e===403&&t==="BOOTSTRAP_REQUIRED"?!0:Qb(e,t)}function yN(e){return Xe.request("/api/public/bootstrap-status",{baseUrl:e,skipAuth:!0})}function vN(e,t){return Xe.request("/api/public/setup",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function wN(e,t){return Xe.request("/api/auth/login",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function bN(e,t){return Xe.request("/api/auth/refresh",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}const Ja="codingns.auth.session";class xN{constructor(){Ze(this,"state",{status:"anonymous",session:this.readSession()});Ze(this,"listeners",new Set);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);this.state.session&&(this.state={status:"authenticated",session:this.state.session})}async login(t,n,s){const o=await wN({username:t,password:n},s);return this.setSession(o),o}async bootstrap(t,n,s){await vN({username:t,password:n},s)}hydrate(t){if(!t){this.clear();return}this.setSession(t)}async refresh(){const t=this.state.session,n=t==null?void 0:t.refreshToken;if(!n)return this.clear(),{status:"invalid",session:null};this.state={...this.state,status:"refreshing"},this.emit();try{const s=await bN({refreshToken:n});return this.setSession(s),{status:"refreshed",session:s}}catch(s){return SN(s)?(this.clear(),{status:"invalid",session:null}):(this.state={status:t?"authenticated":"anonymous",session:t},this.emit(),{status:"deferred",session:t,error:s})}}clear(){this.state={status:"anonymous",session:null},window.localStorage.removeItem(Ja),this.emit()}setSession(t){this.state={status:"authenticated",session:t};const n={serverBaseUrl:xo(),session:t};window.localStorage.setItem(Ja,JSON.stringify(n)),this.emit()}readSession(){const t=window.localStorage.getItem(Ja);if(!t)return null;try{const n=JSON.parse(t),s=xo();return kN(n)?(n.serverBaseUrl&&n.serverBaseUrl!==s,n.session):Xb(n)?n:(window.localStorage.removeItem(Ja),null)}catch{return window.localStorage.removeItem(Ja),null}}emit(){for(const t of this.listeners)t()}}const Sn=new xN;function Yb(e){return w.useSyncExternalStore(Sn.subscribe,()=>e(Sn.getState()))}function kN(e){return typeof e!="object"||e===null?!1:"session"in e&&Xb(e.session)}function Xb(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.accessToken=="string"&&typeof t.refreshToken=="string"&&typeof t.expiresIn=="number"&&typeof t.user=="object"&&t.user!==null}function SN(e){return e instanceof Hn?e.status===401?!0:e.status===403&&e.errorCode==="BOOTSTRAP_REQUIRED":!1}const Jb={login(e,t,n){return Sn.login(e,t,n)},bootstrap(e,t,n){return Sn.bootstrap(e,t,n)},refresh(){return Sn.refresh()},logout(){Sn.clear()}};function CN(){const e=Mn(),t=xc(S=>S.baseUrl),[n,s]=w.useState("admin"),[o,c]=w.useState(""),[l,d]=w.useState(""),[p,m]=w.useState(null),[y,g]=w.useState("error"),[b,x]=w.useState(!1);async function C(S){if(S.preventDefault(),o!==l){g("error"),m(h("auth.bootstrapMismatch"));return}x(!0),m(null);try{await Jb.bootstrap(n,o),g("success"),m(h("auth.bootstrapSuccess")),window.setTimeout(()=>e("/login",{replace:!0}),500)}catch(j){g("error"),j instanceof Hn?m(j.message):m(h("auth.authUnavailable"))}finally{x(!1)}}return i.jsx("main",{className:"page-center app-shell",children:i.jsxs("section",{className:"auth-card surface-card",children:[i.jsx("h1",{children:h("auth.bootstrapTitle")}),i.jsx("p",{className:"status-text",children:h("auth.bootstrapSubtitle")}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("auth.serverCurrent")}),i.jsx("span",{className:"auth-server-value",children:t})]}),i.jsxs("form",{className:"auth-form",onSubmit:C,children:[i.jsxs("label",{className:"field-group",children:[i.jsx("span",{children:h("auth.username")}),i.jsx("input",{value:n,onChange:S=>s(S.target.value)})]}),i.jsxs("label",{className:"field-group",children:[i.jsx("span",{children:h("auth.password")}),i.jsx("input",{type:"password",value:o,onChange:S=>c(S.target.value)})]}),i.jsxs("label",{className:"field-group",children:[i.jsx("span",{children:h("auth.confirmPassword")}),i.jsx("input",{type:"password",value:l,onChange:S=>d(S.target.value)})]}),p?i.jsx("p",{className:"status-text","data-tone":y,children:p}):null,i.jsx("button",{className:"primary-button",type:"submit",disabled:b,children:h(b?"common.loading":"auth.submitBootstrap")})]})]})})}async function jN(e){try{return{...await yN(e),reachable:!0}}catch{return{initialized:!1,reachable:!1}}}const ia="codingns.auth.remembered-login";function wf(){return typeof window<"u"&&typeof window.localStorage<"u"}function NN(e){return e.isNativeMobile?!0:e.isDesktop?e.ui.osFamily==="windows"||e.ui.osFamily==="macos":!1}function TN(){if(!wf())return null;const e=window.localStorage.getItem(ia);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.username!="string"||typeof t.password!="string"||typeof t.serverBaseUrl!="string")return window.localStorage.removeItem(ia),null;const n=t.username.trim(),s=t.password,o=mi(t.serverBaseUrl);return!n||!s?(window.localStorage.removeItem(ia),null):{username:n,password:s,serverBaseUrl:o}}catch{return window.localStorage.removeItem(ia),null}}function PN(e){if(!wf())return;const t={username:e.username.trim(),password:e.password,serverBaseUrl:mi(e.serverBaseUrl)};window.localStorage.setItem(ia,JSON.stringify(t))}function EN(){wf()&&window.localStorage.removeItem(ia)}function RN({isOpen:e,onClose:t,onSave:n,theme:s="dark"}){const o=xc(A=>A.baseUrl),c=xc(A=>A.options),l=dN(),[d,p]=w.useState(o),[m,y]=w.useState(null),g=w.useMemo(()=>{try{return mi(d)}catch{return null}},[d]),b=uN(g??d,c),x="server-settings-preset",C="server-settings-address";if(w.useEffect(()=>{e&&(p(o),y(null))},[e,o]),!e)return null;function S(){if(!g){y(h("auth.serverInvalid"));return}bc.setBaseUrl(g),n==null||n(g),t()}function j(A){A.target===A.currentTarget&&t()}function M(){g&&p(g)}return i.jsx("div",{className:"server-settings-modal-backdrop","data-theme":s,onClick:j,role:"dialog","aria-modal":"true","aria-labelledby":"server-settings-title",children:i.jsxs("div",{className:"server-settings-modal",children:[i.jsxs("div",{className:"server-settings-modal-header",children:[i.jsx("div",{className:"cyber-header-line"}),i.jsxs("h2",{id:"server-settings-title",className:"cyber-title",children:[i.jsx("span",{className:"cyber-title-icon",children:"◈"}),h("auth.serverSettingsTitle")]}),i.jsx("div",{className:"cyber-header-line"}),i.jsx("button",{className:"server-settings-close",onClick:t,"aria-label":h("common.close"),children:"×"})]}),i.jsxs("div",{className:"server-settings-modal-content",children:[i.jsxs("label",{className:"field-group cyber-field",htmlFor:x,children:[i.jsx("span",{className:"cyber-label",children:h("auth.serverPreset")}),i.jsxs("div",{className:"cyber-select-wrapper",children:[i.jsxs("select",{id:x,"aria-label":h("auth.serverPreset"),className:"cyber-select",value:b,onChange:A=>{const E=A.target.value;E!==l&&(p(E),y(null))},children:[c.map(A=>i.jsx("option",{value:A,children:A},A)),i.jsx("option",{value:l,children:h("auth.serverCustomOption")})]}),i.jsx("span",{className:"cyber-select-arrow",children:"▼"})]})]}),i.jsxs("label",{className:"field-group cyber-field",htmlFor:C,children:[i.jsx("span",{className:"cyber-label",children:h("auth.serverAddress")}),i.jsxs("div",{className:"cyber-input-wrapper",children:[i.jsx("input",{id:C,"aria-label":h("auth.serverAddress"),className:"cyber-input",value:d,placeholder:h("auth.serverPlaceholder"),onBlur:M,onChange:A=>{p(A.target.value),y(null)}}),i.jsx("div",{className:"cyber-input-glow"})]})]}),i.jsxs("p",{className:"cyber-hint",children:[i.jsx("span",{className:"cyber-hint-icon",children:"ℹ"}),h("auth.serverHint")]}),m?i.jsxs("p",{className:"cyber-status","data-tone":"error",children:[i.jsx("span",{className:"cyber-status-icon",children:"⚠"}),m]}):null]}),i.jsxs("div",{className:"server-settings-modal-footer",children:[i.jsx("button",{className:"cyber-button cyber-button-secondary",onClick:t,children:h("common.cancel")}),i.jsxs("button",{className:"cyber-button cyber-button-primary",onClick:S,children:[i.jsx("span",{className:"cyber-button-glow"}),i.jsx("span",{className:"cyber-button-text",children:h("auth.saveServerSettings")})]})]})]})})}function MN(){const e=w.useRef(null);return w.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");if(!n)return;let s;const o=()=>{l(),d()};let c=[];const l=()=>{t.width=window.innerWidth,t.height=window.innerHeight},d=()=>{c=[];const m=Math.min(50,Math.floor(t.width*t.height/25e3));for(let y=0;y<m;y++)c.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})},p=()=>{n.clearRect(0,0,t.width,t.height),c.forEach((m,y)=>{m.x+=m.vx,m.y+=m.vy,m.x<0&&(m.x=t.width),m.x>t.width&&(m.x=0),m.y<0&&(m.y=t.height),m.y>t.height&&(m.y=0),n.beginPath(),n.arc(m.x,m.y,m.size,0,Math.PI*2),n.fillStyle=`rgba(10, 132, 255, ${m.opacity})`,n.fill(),c.slice(y+1).forEach(g=>{const b=m.x-g.x,x=m.y-g.y,C=Math.sqrt(b*b+x*x);C<150&&(n.beginPath(),n.moveTo(m.x,m.y),n.lineTo(g.x,g.y),n.strokeStyle=`rgba(10, 132, 255, ${.1*(1-C/150)})`,n.stroke())})}),s=requestAnimationFrame(p)};return l(),d(),p(),window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o),cancelAnimationFrame(s)}},[]),i.jsx("canvas",{ref:e,className:"particle-canvas"})}function AN({text:e}){return i.jsx("span",{className:"glitch-text","data-text":e,children:e})}function LN({text:e}){const[t,n]=w.useState(""),[s,o]=w.useState(!0);return w.useEffect(()=>{let c=0,l=null;const d=setInterval(()=>{c<=e.length?(n(e.slice(0,c)),c++):(clearInterval(d),l=window.setTimeout(()=>o(!1),1e3))},50);return()=>{clearInterval(d),l!==null&&window.clearTimeout(l)}},[e]),i.jsxs("span",{className:"typewriter-text",children:[t,s&&i.jsx("span",{className:"typewriter-cursor",children:"_"})]})}function IN(){const e=Mn(),t=Vj(),[n]=Ij(),s=ar(),o=cf(s.platform),c=w.useMemo(()=>NN(s),[s]),l=w.useMemo(()=>c?TN():null,[c]),d=(l==null?void 0:l.serverBaseUrl)??null,[p,m]=w.useState(()=>(l==null?void 0:l.username)??"admin"),[y,g]=w.useState(()=>(l==null?void 0:l.password)??""),[b,x]=w.useState(()=>!!l),C=xc(q=>q.baseUrl),[S,j]=w.useState(C),[M,A]=w.useState(null),[E,Z]=w.useState(!1),[Y,B]=w.useState(!1),[I,_]=w.useState(null),F=Yb(q=>q.session),R=w.useMemo(()=>n.get("returnTo")??"/",[n]),{theme:W}=Ub(),J=w.useMemo(()=>W==="light"?"light":"dark",[W]);w.useEffect(()=>{!c||!d||d===C||(bc.setBaseUrl(d),j(d))},[C,c,d]),w.useEffect(()=>{if(F){e(R,{replace:!0});return}if(!S)return;let q=!1;return jN(S).then(K=>{!q&&K.reachable&&!K.initialized&&e("/bootstrap",{replace:!0})}).catch(()=>{q||A(t("auth.authUnavailable"))}),()=>{q=!0}},[F,e,S,R,t]);async function re(q){q.preventDefault(),Z(!0),A(null),j(C),c&&!b&&EN();try{await Jb.login(p,y,C),c&&b&&PN({username:p,password:y,serverBaseUrl:C}),e(R,{replace:!0})}catch(K){if(K instanceof Hn){if(K.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}A(K.message)}else A(t("auth.authUnavailable"))}finally{Z(!1)}}function le(q){j(q),A(null)}const ie="login-username",xe="login-password";return i.jsxs("main",{className:"cyber-login-page","data-theme":J,children:[i.jsxs("div",{className:"cyber-bg",children:[i.jsx("div",{className:"cyber-grid"}),i.jsx("div",{className:"cyber-glow cyber-glow-1"}),i.jsx("div",{className:"cyber-glow cyber-glow-2"}),i.jsx(MN,{})]}),i.jsx("div",{className:"scanlines"}),i.jsxs("div",{className:"cyber-login-container",children:[i.jsx("div",{className:"cyber-login-toolbar",children:i.jsx(vf,{variant:"compact"})}),i.jsxs("div",{className:"cyber-brand",children:[i.jsx("div",{className:"cyber-logo",children:i.jsx("img",{src:"/logo.png",alt:"CodingNS",className:"cyber-logo-svg"})}),i.jsx("h1",{className:"cyber-brand-title",children:i.jsx(AN,{text:"CodingNS"})}),i.jsx("p",{className:"cyber-brand-subtitle",children:i.jsx(LN,{text:t("auth.loginSubtitle")})})]}),i.jsxs("div",{className:"cyber-card",children:[i.jsx("div",{className:"cyber-corner corner-tl"}),i.jsx("div",{className:"cyber-corner corner-tr"}),i.jsx("div",{className:"cyber-corner corner-bl"}),i.jsx("div",{className:"cyber-corner corner-br"}),i.jsxs("div",{className:"cyber-card-header",children:[i.jsx("div",{className:"cyber-line"}),i.jsx("span",{className:"cyber-card-label",children:t("auth.loginTitle").toUpperCase()}),i.jsx("div",{className:"cyber-line"})]}),i.jsxs("form",{className:"cyber-form",onSubmit:re,children:[i.jsxs("div",{className:`cyber-field ${I==="username"?"focused":""}`,children:[i.jsx("div",{className:"cyber-field-border",children:i.jsx("div",{className:"cyber-field-border-glow"})}),i.jsxs("label",{className:"cyber-field-label",htmlFor:ie,children:[i.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),i.jsx("input",{id:ie,"aria-label":t("auth.username"),className:"cyber-input",value:p,onChange:q=>m(q.target.value),onFocus:()=>_("username"),onBlur:()=>_(null),autoComplete:"username"})]}),i.jsxs("div",{className:`cyber-field ${I==="password"?"focused":""}`,children:[i.jsx("div",{className:"cyber-field-border",children:i.jsx("div",{className:"cyber-field-border-glow"})}),i.jsxs("label",{className:"cyber-field-label",htmlFor:xe,children:[i.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),i.jsx("input",{id:xe,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:y,onChange:q=>g(q.target.value),onFocus:()=>_("password"),onBlur:()=>_(null),autoComplete:"current-password"})]}),c?i.jsxs("label",{className:"cyber-remember-toggle",children:[i.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:b,onChange:q=>x(q.target.checked)}),i.jsx("span",{children:t("auth.rememberPassword")})]}):null,M?i.jsxs("div",{className:"cyber-status","data-tone":"error",children:[i.jsx("span",{className:"cyber-status-icon",children:"⚠"}),i.jsx("span",{children:M})]}):null,i.jsxs("button",{className:`cyber-submit ${E?"loading":""}`,type:"submit",disabled:E,children:[i.jsx("span",{className:"cyber-submit-glow"}),i.jsx("span",{className:"cyber-submit-border"}),i.jsx("span",{className:"cyber-submit-text",children:E?i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"cyber-spinner"}),t("common.loading")]}):i.jsxs(i.Fragment,{children:[i.jsx("span",{className:"cyber-submit-icon",children:"➤"}),t("auth.submitLogin")]})})]})]}),o?i.jsxs("div",{className:"cyber-footer",children:[i.jsxs("div",{className:"cyber-divider",children:[i.jsx("span",{className:"cyber-divider-line"}),i.jsx("span",{className:"cyber-divider-text",children:"//"}),i.jsx("span",{className:"cyber-divider-line"})]}),i.jsxs("button",{className:"cyber-server-btn",onClick:()=>B(!0),type:"button",children:[i.jsx("span",{className:"cyber-server-icon",children:"⚙"}),i.jsx("span",{className:"cyber-server-text",children:t("auth.serverSettings")}),i.jsx("span",{className:"cyber-server-current",children:C})]})]}):null]}),i.jsxs("div",{className:"cyber-version",children:[i.jsx("span",{className:"cyber-version-text",children:"v1.0.0"}),i.jsx("span",{className:"cyber-version-divider",children:"|"}),i.jsx("span",{className:"cyber-version-text",children:"SYSTEM READY"})]})]}),o?i.jsx(RN,{isOpen:Y,onClose:()=>B(!1),onSave:le,theme:J}):null]})}function Fr(){return ar().haptics}function DN(){return Xe.request("/api/workspaces")}async function _N(){try{return await Xe.request("/api/workbench")}catch(e){if(!(e instanceof Hn)||e.status!==404)throw e;const t=await DN();return{items:await Promise.all(t.items.map(async s=>({workspace:s,sessions:(await UN(s.id)).items})))}}}function FN(e){return Xe.request("/api/workspaces/import",{method:"POST",body:JSON.stringify(e)})}function ON(e){return Xe.request("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})}function Zb(e){return Xe.request(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})}function ex(e){const t=new URLSearchParams;return e!=null&&e.trim()&&t.set("path",e.trim()),Xe.request(`/api/workspaces/browse${t.size>0?`?${t.toString()}`:""}`)}function BN(e){return Xe.request("/api/workspaces/directories",{method:"POST",body:JSON.stringify(e)})}function UN(e){return Xe.request(`/api/sessions?workspaceId=${encodeURIComponent(e)}`)}function zN(e){return Xe.request(`/api/sessions/${encodeURIComponent(e)}`)}function WN(e){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/changed-files`)}function HN(e){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/seen`,{method:"POST"})}function tx(e,t){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/title`,{method:"PATCH",body:JSON.stringify({title:t})})}function nx(e,t){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"PATCH",body:JSON.stringify({archived:t})})}function $N(e,t){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/favorite`,{method:"PATCH",body:JSON.stringify({favorite:t})})}function VN(e){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/capabilities`)}function qN(){return Xe.request("/api/preferences/quick-phrases")}function GN(e){return Xe.request("/api/preferences/quick-phrases",{method:"PUT",body:JSON.stringify({items:e})})}function KN(e,t){const n=new URLSearchParams;return t!=null&&t.trim()&&n.set("workspaceId",t.trim()),Xe.request(`/api/providers/${encodeURIComponent(e)}/capabilities${n.size>0?`?${n.toString()}`:""}`)}function iy(e,t,n,s="forward"){const o=new URLSearchParams;return t&&o.set("cursor",t),o.set("limit",String(n)),o.set("direction",s),Xe.request(`/api/sessions/${encodeURIComponent(e)}/messages?${o.toString()}`)}function QN(e,t){return Xe.requestBlob(`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content`)}function YN(e,t){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:JSON.stringify(t)})}function XN(e){return Xe.request("/api/sessions/start-live",{method:"POST",body:JSON.stringify(e)})}function JN(e,t){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/messages/live`,{method:"POST",body:JSON.stringify(t)})}function ZN(e){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/queue`)}function eT(e,t){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/queue`,{method:"POST",body:JSON.stringify(t)})}function tT(e,t){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}`,{method:"DELETE"})}function nT(e,t){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}/steer`,{method:"POST"})}function sy(e){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/runtime`)}function rT(e){return Xe.request(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:"POST"})}function rx({connectionState:e,onReconnect:t}){const{showToast:n,dismissToast:s}=Gn();return w.useEffect(()=>{if(e==="connected"||e==="closed"){s("conversation-connection-state");return}if(e==="reconnect_failed"){n({id:"conversation-connection-state",title:h("conversation.connectionReconnectFailed"),description:h("conversation.reconnectFailedExplain"),tone:"warning",durationMs:null,action:{label:h("conversation.reconnectButton"),onClick:t}});return}n({id:"conversation-connection-state",title:h("conversation.connectionReconnecting"),description:h("conversation.reconnectExplain"),tone:"info",durationMs:3200})},[e,s,t,n]),null}function Ed(e,t){if(!e)return{allowed:!1,hidden:!1,reason:h("conversation.capabilityDenied")};switch(t){case"send_message":return e.canSendMessage===!1?{allowed:!1,hidden:!1,reason:h("conversation.capabilitySendDisabled")}:{allowed:!0,hidden:!1,reason:null};case"attachments":return e.supportsAttachments?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:h("conversation.capabilityAttachmentDisabled")};case"interrupt":return e.supportsInterrupt?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:h("conversation.capabilityInterruptDisabled")};default:return{allowed:!1,hidden:!1,reason:h("conversation.capabilityDenied")}}}const iT=new Set(["low","medium","high","xhigh"]),sT={"claude-code":{displayNameKey:"conversation.providerClaude",draftTitleKey:"conversation.draftTitleClaude",defaultModelLabelKey:"conversation.modelUseCliDefault",defaultRunInputMode:"streaming_guidance",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,iconVariant:"claude",supportsSlashMenuByDefault:!0,foldRulesMessagesByDefault:!1},codex:{displayNameKey:"conversation.providerCodex",draftTitleKey:"conversation.draftTitleCodex",defaultModelLabelKey:"conversation.modelUseCliDefault",defaultRunInputMode:"none",reasoningLevelPersists:!0,defaultReasoningLevel:null,iconVariant:"codex",supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!0},opencode:{displayNameKey:"conversation.providerOpenCode",draftTitleKey:"conversation.draftTitleOpenCode",defaultModelLabelKey:"conversation.modelUseCliDefault",defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,iconVariant:"generic",supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!1}};function Ss(e){return e?sT[e]??null:null}function aT(e){return[{id:"provider-default",name:h(e),usesProviderDefault:!0}]}function oT(e){const t=Ss(e);return aT((t==null?void 0:t.defaultModelLabelKey)??"conversation.modelUseCliDefault")}function lT(e){return!!e}function cT(e){const t=Ss(e);return h((t==null?void 0:t.draftTitleKey)??"conversation.draftTitleCodex")}function uT(e){const t=Ss(e);return{provider:e,canStartSession:!0,canResumeSession:!0,canSendMessage:!0,inRunInputMode:(t==null?void 0:t.defaultRunInputMode)??"none",supportsSubagents:!1,supportsInterrupt:!1,supportsStructuredToolCalls:!0,supportsTokenUsage:!0,supportsAttachments:!0,supportsPermissionPrompt:!0,supportsCheckpoint:!1,modelOptions:oT(e),defaultReasoningLevel:t==null?void 0:t.defaultReasoningLevel,limitations:[]}}function dT(e){return(e==null?void 0:e.provider)??"claude-code"}function hT(e){var n;if((e==null?void 0:e.supportsSlashMenu)!==void 0)return e.supportsSlashMenu;const t=(e==null?void 0:e.provider)??null;return((n=Ss(t))==null?void 0:n.supportsSlashMenuByDefault)??!1}function fT(e){var t;return(e==null?void 0:e.supportsReasoningSelector)!==void 0?e.supportsReasoningSelector:!!((t=e==null?void 0:e.modelOptions)!=null&&t.some(n=>{var s;return((s=n.supportedReasoningEfforts)==null?void 0:s.some(o=>iT.has(o)))??!1}))}function pT(e,t){if((e==null?void 0:e.supportsQueueWhileRunning)!==void 0)return e.supportsQueueWhileRunning;const n=(e==null?void 0:e.inRunInputMode)??"none";return n==="queued_guidance"||n==="none"||n==="streaming_guidance"&&t===!1}function ix(e){return(e==null?void 0:e.supportsRunSteering)!==void 0?e.supportsRunSteering:(e==null?void 0:e.inRunInputMode)==="streaming_guidance"}function mT(e){const t=Ss(e);return(t==null?void 0:t.reasoningLevelPersists)??!1}function gT(e){var t;return((t=Ss(e))==null?void 0:t.iconVariant)??"generic"}function yT(e,t){var s;return((s=Ss(t??null))==null?void 0:s.foldRulesMessagesByDefault)??!1}function vT(){return i.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:i.jsx("path",{d:"M7 7L17 17M17 7L7 17",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.8"})})}function _r({open:e,title:t,description:n,className:s,onClose:o,children:c}){return w.useEffect(()=>{if(!e)return;function l(d){d.key==="Escape"&&o()}return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[o,e]),!e||typeof document>"u"?null:qn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:o}),i.jsxs("section",{className:`workbench-modal-card surface-card${s?` ${s}`:""}`,role:"dialog","aria-modal":"true","aria-label":t,children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:t}),i.jsx("p",{children:n})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:o,children:i.jsx(vT,{})})]}),i.jsx("div",{className:"workbench-modal-body",children:c})]})]}),document.body)}const wT="codingns.conversation.composer-draft:",bT=1,xT=[{id:"builtin-stage-and-summarize",text:"请将本次会话变更的所有代码提交到git暂存区,然后总结一条中文的提交信息"},{id:"builtin-review-module",text:"分析本项目 模块的代码实现,并分析存在的问题"},{id:"builtin-group-commits",text:"分析当前项目中的未提交文件,按照功能模块进行分类提交,提交信息格式请参考我最近的提交记录"}];function bf(){return typeof window<"u"&&typeof window.localStorage<"u"}function kT(e){if(!e||typeof e!="object")return null;const t="id"in e?e.id:null,n="fileName"in e?e.fileName:null,s="mimeType"in e?e.mimeType:null,o="fileSize"in e?e.fileSize:null,c="lastModified"in e?e.lastModified:null,l="contentBase64"in e?e.contentBase64:null;if(typeof t!="string"||typeof n!="string"||typeof s!="string"||typeof o!="number"||typeof c!="number"||typeof l!="string")return null;const d=t.trim(),p=n.trim(),m=s.trim(),y=l.trim();return!d||!p||!m||o<0||c<0||!y?null:{id:d,fileName:p,mimeType:m,fileSize:o,lastModified:c,contentBase64:y}}function ST(e){if(!e||typeof e!="object")return null;const t="content"in e?e.content:null,n="attachments"in e?e.attachments:null;if(typeof t!="string"||!Array.isArray(n))return null;const s=n.map(o=>kT(o)).filter(o=>o!==null);return s.length!==n.length||t.length===0&&s.length===0?null:{content:t,attachments:s}}function uo(e){return`${wT}${e}`}function CT(e){var t,n;return{id:((n=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:n.call(t))??`phrase-${Date.now()}-${Math.random().toString(16).slice(2)}`,text:e.trim()}}function jT(e){if(!bf())return null;const t=e.trim();if(!t)return null;const n=window.localStorage.getItem(uo(t));if(!n)return null;try{const s=JSON.parse(n),o=s&&typeof s=="object"&&"draft"in s&&s.draft&&typeof s.draft=="object"?s.draft:s,c=ST(o);return c||(window.localStorage.removeItem(uo(t)),null)}catch{return window.localStorage.removeItem(uo(t)),null}}function NT(e,t){if(!bf())return!1;const n=e.trim();if(!n)return!1;if(t.content.length===0&&t.attachments.length===0)return sx(n),!0;try{return window.localStorage.setItem(uo(n),JSON.stringify({schemaVersion:bT,draft:t})),!0}catch{return!1}}function sx(e){if(!bf())return;const t=e.trim();t&&window.localStorage.removeItem(uo(t))}const TT="provider-default",PT="provider-default",ET="provider-default",ay="workbench:focus-composer",RT="provider-default";function MT(){return[{id:TT,name:h("conversation.modelUseCliDefault"),provider:"claude-code",usesProviderDefault:!0}]}function AT(){return[{id:PT,name:h("conversation.modelUseCliDefault"),provider:"codex",usesProviderDefault:!0}]}function LT(){return[{id:ET,name:h("conversation.modelUseCliDefault"),provider:"opencode",usesProviderDefault:!0}]}function IT(e){return e==="claude-code"?MT():e==="opencode"?LT():AT()}function Rd(e){return`composer-selected-model:${e}`}function Wl(e){return`composer-reasoning-level:${e}`}function DT(e){return e.usesProviderDefault===!0||e.id===RT}function _T(){var e,t;return((t=(e=globalThis.crypto)==null?void 0:e.randomUUID)==null?void 0:t.call(e))??`${Date.now()}-${Math.random().toString(16).slice(2)}`}function FT(e,t,n,s){const o=globalThis.atob(n),c=Uint8Array.from(o,l=>l.charCodeAt(0));return new File([c],e,{type:t,lastModified:s})}function OT(e){const t=FT(e.fileName,e.mimeType,e.contentBase64,e.lastModified);return{id:e.id,file:t,previewUrl:URL.createObjectURL(t)}}function BT(e,t){return{id:t,kind:"image",fileName:e.name,mimeType:e.type||"image/png",fileSize:e.size}}function oy(e){return new Promise((t,n)=>{const s=new FileReader;s.onerror=()=>{n(s.error??new Error("FILE_READ_FAILED"))},s.onload=()=>{const o=typeof s.result=="string"?s.result:"",c=o.includes(",")?o.split(",").at(-1)??"":o;t(c)},s.readAsDataURL(e)})}function UT(e){e.forEach(t=>{URL.revokeObjectURL(t.previewUrl)})}function zT(e){const t=[];let n=0;for(const s of e){if(s.type.startsWith("image/")){t.push(s);continue}n+=1}return{accepted:t,rejectedCount:n}}function WT(e,t){const n=new Set(e.map(o=>`${o.file.name}:${o.file.size}:${o.file.lastModified}`)),s=[...e];return t.forEach(o=>{const c=`${o.name}:${o.size}:${o.lastModified}`;n.has(c)||(n.add(c),s.push({id:_T(),file:o,previewUrl:URL.createObjectURL(o)}))}),s}function ax({capabilities:e,draftStorageId:t,hasActiveRun:n=null,canInterrupt:s=null,contextUsage:o=null,hasPendingQueuedMessages:c=!1,isSubmitting:l,isRunning:d=!1,onInterrupt:p,onQueueSend:m,onSend:y}){const[g,b]=w.useState(""),[x,C]=w.useState(""),[S,j]=w.useState("medium"),[M,A]=w.useState([]),[E,Z]=w.useState(xT),[Y,B]=w.useState(!1),[I,_]=w.useState(!1),[F,R]=w.useState(""),[W,J]=w.useState(!1),[re,le]=w.useState(!1),[ie,xe]=w.useState(!1),[q,K]=w.useState(!1),me=w.useRef(null),L=w.useRef(!1),$=w.useRef(new Set),se=w.useRef(new Map),P=w.useRef(0),{showToast:be}=Gn(),ke=Fr(),ve=dT(e),Ae=w.useMemo(()=>Ed(e,"send_message"),[e]),Be=w.useMemo(()=>Ed(e,"interrupt"),[e]),qe=w.useMemo(()=>Ed(e,"attachments"),[e]),nt=w.useMemo(()=>{var T;const D=(T=e==null?void 0:e.modelOptions)==null?void 0:T.map(O=>{var H;return{...O,provider:ve,supportedReasoningEfforts:(H=O.supportedReasoningEfforts)==null?void 0:H.filter(oe=>oe==="low"||oe==="medium"||oe==="high"||oe==="xhigh")}});return D!=null&&D.length?D:IT(ve)},[e==null?void 0:e.modelOptions,ve]),wt=w.useMemo(()=>nt.find(D=>D.id===x)??null,[nt,x]),ze=fT(e),Ot=hT(e),Je=w.useMemo(()=>[{value:"low",label:h("conversation.reasoningLow")},{value:"medium",label:h("conversation.reasoningMedium")},{value:"high",label:h("conversation.reasoningHigh")},{value:"xhigh",label:h("conversation.reasoningMaximum")}],[]),_t=w.useMemo(()=>{if(!ze)return[];const D=wt==null?void 0:wt.supportedReasoningEfforts;return!D||D.length===0?Je:Je.filter(T=>D.includes(T.value))},[ze,Je,wt==null?void 0:wt.supportedReasoningEfforts]),bt=w.useMemo(()=>nt.map(D=>({value:D.id,label:DT(D)?h("conversation.modelUseCliDefault"):D.name})),[nt]),et=w.useMemo(()=>_t.map(D=>({value:D.value,label:D.label})),[_t]),pt=w.useMemo(()=>[{command:"/plan",label:h("conversation.slashCommandPlan")},{command:"/review",label:h("conversation.slashCommandReview")},{command:"/explain",label:h("conversation.slashCommandExplain")}],[]),Nt=(e==null?void 0:e.inRunInputMode)??"none",Bt=n??null,Rt=d&&Nt==="streaming_guidance"&&Bt===!1&&!ix(e),ne=d&&Nt==="streaming_guidance"&&!Rt,He=d&&typeof m=="function"&&pT(e,Bt),tt=d&&!ne&&!He,Tt=g.trim().length>0||M.length>0,ce=s??Be.allowed,Le=d&&ce&&!!p&&!ie&&!Tt&&!q&&!l,de=!Le&&!Tt&&(q||l||d||!d&&c),Ne=h(q||l||c?"conversation.sendingState":"conversation.runtimeRunning"),ut=h(d?He?"conversation.queueGuidanceButton":ne?"conversation.sendGuidanceButton":"conversation.sendButton":"conversation.sendButton"),Wt=w.useCallback(D=>{C(D),localStorage.setItem(Rd(ve),D)},[ve]),dt=w.useCallback(D=>{j(D),localStorage.setItem(Wl(ve),D)},[ve]),xt=w.useCallback(D=>{$.current.forEach(T=>{URL.revokeObjectURL(T)}),$.current.clear(),D.forEach(T=>{$.current.add(T.previewUrl)}),A(D)},[]),mt=w.useCallback(D=>{const{accepted:T,rejectedCount:O}=zT(D);O>0&&be({title:h("conversation.attachmentImageOnly"),tone:"error"}),T.length!==0&&A(H=>{const oe=WT(H,T);return oe.forEach(ye=>{$.current.add(ye.previewUrl)}),oe})},[be]),ct=w.useCallback(D=>{se.current.delete(D),A(T=>{const O=T.find(H=>H.id===D);return O&&($.current.delete(O.previewUrl),URL.revokeObjectURL(O.previewUrl)),T.filter(H=>H.id!==D)})},[]),Ht=w.useCallback(()=>{le(D=>!D)},[]),St=w.useCallback(D=>{var T;b(O=>O.trimStart().startsWith(D)?O:O.trim()?`${D} ${O.trim()}`:`${D} `),le(!1),(T=me.current)==null||T.focus()},[]),Pt=w.useCallback(async D=>{const T=E;P.current+=1,Z(D),J(!0);try{const O=await GN(D.map(H=>({id:H.id,text:H.text})));return Z(O.items.map(H=>({id:H.id,text:H.text}))),!0}catch(O){return Z(T),be({title:O instanceof Error?O.message:h("conversation.quickPhraseSaveFailed"),tone:"error"}),!1}finally{J(!1)}},[E,be]),Ft=w.useCallback(async()=>{const D=F.trim();!D||!await Pt([...E,CT(D)])||(R(""),_(!1))},[Pt,F,E]),At=w.useCallback(D=>{Pt(E.filter(T=>T.id!==D))},[Pt,E]),Yt=w.useCallback((D,T)=>{const O=E.findIndex(Re=>Re.id===D);if(O<0)return;const H=O+T;if(H<0||H>=E.length)return;const oe=[...E],[ye]=oe.splice(O,1);oe.splice(H,0,ye),Pt(oe)},[Pt,E]),Gt=w.useCallback(D=>{var T;b(D),B(!1),(T=me.current)==null||T.focus()},[]),nn=w.useCallback(D=>{const T=D?jT(D):null,O=(T==null?void 0:T.attachments.map(H=>OT(H)))??[];se.current=new Map(((T==null?void 0:T.attachments)??[]).map(H=>[H.id,H])),xt(O),b((T==null?void 0:T.content)??""),le(!1)},[xt]);w.useEffect(()=>{if(!nt.length)return;const D=localStorage.getItem(Rd(ve));if(D&&nt.some(O=>O.id===D)){x!==D&&C(D);return}if(nt.some(O=>O.id===x))return;const T=nt[0].id;C(T),localStorage.setItem(Rd(ve),T)},[nt,ve,x]),w.useEffect(()=>{if(!mT(ve)||_t.length===0)return;const D=localStorage.getItem(Wl(ve));if(D&&_t.some(H=>H.value===D)){S!==D&&j(D);return}const T=e==null?void 0:e.defaultReasoningLevel;if(T&&_t.some(H=>H.value===T)){S!==T&&j(T),localStorage.setItem(Wl(ve),T);return}if(_t.some(H=>H.value===S))return;const O=_t[0].value;j(O),localStorage.setItem(Wl(ve),O)},[_t,e==null?void 0:e.defaultReasoningLevel,ve,S]),w.useEffect(()=>{let D=!1;const T=P.current;return qN().then(O=>{D||P.current!==T||Z(O.items.map(H=>({id:H.id,text:H.text})))}).catch(()=>{}),()=>{D=!0}},[]),w.useEffect(()=>{nn(t)},[t,nn]),w.useEffect(()=>{if(!t)return;const D=t,T=new Set(M.map(oe=>oe.id));se.current.forEach((oe,ye)=>{T.has(ye)||se.current.delete(ye)});let O=!1;async function H(){if(g.length===0&&M.length===0){sx(D);return}const oe=await Promise.all(M.map(async ye=>{const Re=se.current.get(ye.id);return Re&&Re.fileName===ye.file.name&&Re.fileSize===ye.file.size&&Re.lastModified===ye.file.lastModified&&Re.mimeType===(ye.file.type||"image/png")?Re:{id:ye.id,fileName:ye.file.name,mimeType:ye.file.type||"image/png",fileSize:ye.file.size,lastModified:ye.file.lastModified,contentBase64:await oy(ye.file)}}));O||(se.current=new Map(oe.map(ye=>[ye.id,ye])),NT(D,{content:g,attachments:oe}))}return H(),()=>{O=!0}},[M,g,t]),w.useEffect(()=>{const D=me.current;D&&(D.style.height="0px",D.style.height=`${Math.min(D.scrollHeight,120)}px`)},[g]),w.useEffect(()=>{qe.allowed||(se.current.clear(),xt([]))},[qe.allowed]),w.useEffect(()=>()=>{$.current.forEach(D=>{URL.revokeObjectURL(D)}),$.current.clear()},[]),w.useEffect(()=>{function D(){var T;(T=me.current)==null||T.focus()}return window.addEventListener(ay,D),()=>{window.removeEventListener(ay,D)}},[]);async function vn(D){if(L.current)return;const T=g.trim(),O=M;if(T.length===0&&O.length===0||!Ae.allowed||tt){be({title:tt?h("conversation.runtimeRunning"):Ae.reason??h("conversation.capabilityDenied"),tone:"error"});return}L.current=!0,ke.trigger(D==="queue"?"selection":"action"),K(!0),b(""),A([]),B(!1),_(!1),le(!1);try{const H=await Promise.all(O.map(async Re=>({fileName:Re.file.name,mimeType:Re.file.type||"image/png",fileSize:Re.file.size,contentBase64:await oy(Re.file)}))),oe=O.map(Re=>BT(Re.file,Re.id));await(D==="queue"&&m?m:y)(T,{model:wt!=null&&wt.usesProviderDefault?void 0:x||void 0,reasoningLevel:ze&&_t.length>0?S:void 0,attachments:H,attachmentMeta:oe}),UT(O),O.forEach(Re=>{$.current.delete(Re.previewUrl)})}catch(H){b(T),A(O),be({title:H instanceof Error&&H.message==="FILE_READ_FAILED"?h("conversation.attachmentReadFailed"):H instanceof Error?H.message:h("conversation.capabilityDenied"),tone:"error"})}finally{K(!1),L.current=!1}}async function Pn(D){D.preventDefault(),await vn(He?"queue":"send")}async function pn(){if(!(!ce||!p||ie))try{xe(!0),ke.trigger("action"),await p()}catch(D){be({title:D instanceof Error?D.message:h("conversation.capabilityInterruptDisabled"),tone:"error"})}finally{xe(!1)}}const an=q||l||tt||!Ae.allowed||!Tt,An=g.length===0&&!tt;return i.jsxs("section",{className:"composer-panel",children:[i.jsx("form",{className:"composer-form",onSubmit:Pn,children:i.jsxs("div",{className:"composer-input-container",children:[M.length>0?i.jsx("div",{className:"composer-attachments",children:M.map(D=>i.jsxs("div",{className:"composer-attachment-card",children:[i.jsx("img",{src:D.previewUrl,alt:h("conversation.attachmentPreviewAlt"),className:"composer-attachment-preview"}),i.jsxs("div",{className:"composer-attachment-meta",children:[i.jsx("span",{className:"attachment-name",title:D.file.name,children:D.file.name}),i.jsxs("span",{className:"attachment-size",children:[(D.file.size/1024).toFixed(1)," KB"]})]}),i.jsx("button",{type:"button",className:"attachment-remove",onClick:()=>ct(D.id),"aria-label":h("conversation.removeAttachment"),children:i.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},D.id))}):null,i.jsxs("div",{className:"composer-input-wrapper",children:[i.jsx("textarea",{ref:me,className:"composer-input",value:g,placeholder:h("conversation.composerPlaceholder"),readOnly:tt,"aria-readonly":tt,onChange:D=>b(D.target.value),rows:1,onFocus:()=>le(!1),onPaste:D=>{if(tt||!qe.allowed)return;const T=Array.from(D.clipboardData.items).filter(O=>O.kind==="file").map(O=>O.getAsFile()).filter(O=>!!O);T.length!==0&&(D.preventDefault(),mt(T))},onKeyDown:D=>{D.key==="Escape"&&le(!1),D.key==="Enter"&&!D.shiftKey&&(D.preventDefault(),an||Pn(D))}}),An?i.jsx("button",{type:"button",className:"composer-quick-phrase-trigger","aria-label":h("conversation.quickPhraseTrigger"),title:h("conversation.quickPhraseTrigger"),onClick:()=>{B(!0),le(!1)},children:i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M7 8h10"}),i.jsx("path",{d:"M7 12h8"}),i.jsx("path",{d:"M7 16h5"}),i.jsx("path",{d:"M5 5h14v14H9l-4 4V5z"})]})}):null]}),re?i.jsx("div",{className:"composer-slash-menu",role:"menu","aria-label":h("conversation.slashMenuTitle"),children:pt.map(D=>i.jsxs("button",{type:"button",className:"composer-slash-item",onClick:()=>St(D.command),children:[i.jsx("span",{className:"composer-slash-command",children:D.command}),i.jsx("span",{className:"composer-slash-label",children:D.label})]},D.command))}):null,i.jsxs("div",{className:"composer-controls",children:[i.jsxs("div",{className:"composer-controls-left",children:[i.jsx("div",{className:"composer-provider-logo",children:HT(ve)}),i.jsx(ly,{ariaLabel:h("conversation.modelSelectorLabel"),value:x,options:bt,onChange:Wt}),ze&&_t.length>0?i.jsx(ly,{ariaLabel:h("conversation.reasoningSelectorLabel"),value:S,options:et,onChange:D=>dt(D),compact:!0}):null,Ot?i.jsxs("button",{type:"button",className:"composer-slash-btn",onClick:Ht,title:h("conversation.slashMenu"),children:[i.jsx("span",{className:"slash-icon",children:"/"}),i.jsx("span",{children:h("conversation.slashMenu")})]}):null,i.jsx($T,{contextUsage:o})]}),de?i.jsx("div",{className:"composer-send-group",children:i.jsx("button",{className:"composer-send composer-send-busy",type:"button",disabled:!0,"aria-label":Ne,title:Ne,children:i.jsxs("svg",{className:"composer-send-spinner",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[i.jsx("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeOpacity:"0.28",strokeWidth:"2.5"}),i.jsx("path",{d:"M20 12a8 8 0 0 0-8-8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]})})}):i.jsx("div",{className:"composer-send-group",children:Le?i.jsx("button",{className:"composer-send composer-send-busy",type:"button",onClick:()=>{pn()},"aria-label":h("conversation.capabilityInterrupt"),title:h("conversation.capabilityInterrupt"),children:i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:i.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})}):i.jsx("button",{className:"composer-send",type:"submit",disabled:an,"aria-label":ut,title:ut,children:i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[i.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),i.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})})]})]})}),i.jsx(_r,{open:Y,title:h("conversation.quickPhraseModalTitle"),description:h("conversation.quickPhraseModalDescription"),className:"composer-quick-phrase-modal",onClose:()=>{B(!1),_(!1)},children:i.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[i.jsxs("div",{className:"composer-quick-phrase-toolbar",children:[i.jsx("div",{className:"composer-quick-phrase-toolbar-copy",children:i.jsx("span",{children:h("conversation.quickPhraseListLabel")})}),i.jsx("button",{type:"button",className:"primary-button",disabled:W,onClick:()=>_(!0),children:h("conversation.quickPhraseOpenCreateAction")})]}),i.jsx("div",{className:"composer-quick-phrase-list",role:"list","aria-label":h("conversation.quickPhraseListLabel"),children:E.length===0?i.jsx("div",{className:"composer-quick-phrase-empty",children:h("conversation.quickPhraseEmpty")}):E.map((D,T)=>i.jsxs("div",{className:"composer-quick-phrase-item",role:"listitem",children:[i.jsxs("button",{type:"button",className:"composer-quick-phrase-select",onClick:()=>Gt(D.text),children:[i.jsx("span",{className:"composer-quick-phrase-order",children:h("conversation.quickPhraseOrderLabel",{index:T+1})}),i.jsx("span",{className:"composer-quick-phrase-text",children:D.text})]}),i.jsxs("div",{className:"composer-quick-phrase-actions",children:[i.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:W||T===0,"aria-label":h("conversation.quickPhraseMoveUp"),title:h("conversation.quickPhraseMoveUp"),onClick:()=>Yt(D.id,-1),children:"↑"}),i.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:W||T===E.length-1,"aria-label":h("conversation.quickPhraseMoveDown"),title:h("conversation.quickPhraseMoveDown"),onClick:()=>Yt(D.id,1),children:"↓"}),i.jsx("button",{type:"button",className:"composer-quick-phrase-action is-danger",disabled:W,"aria-label":h("conversation.quickPhraseDelete"),title:h("conversation.quickPhraseDelete"),onClick:()=>At(D.id),children:"×"})]})]},D.id))})]})}),i.jsx(_r,{open:I,title:h("conversation.quickPhraseCreateModalTitle"),description:h("conversation.quickPhraseCreateModalDescription"),className:"composer-quick-phrase-create-modal",onClose:()=>_(!1),children:i.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("conversation.quickPhraseCreateLabel")}),i.jsx("textarea",{className:"composer-quick-phrase-textarea",value:F,placeholder:h("conversation.quickPhraseCreatePlaceholder"),rows:4,onChange:D=>R(D.target.value)})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>_(!1),children:h("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:W||F.trim().length===0,onClick:()=>{Ft()},children:h("conversation.quickPhraseCreateAction")})]})]})})]})}function HT(e){return gT(e)==="codex"?i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),i.jsx("path",{d:"M8 12h8M12 8v8"})]}):i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("circle",{cx:"12",cy:"12",r:"9"}),i.jsx("path",{d:"M12 8v8M8 12h8"})]})}function ly({ariaLabel:e,value:t,options:n,onChange:s,compact:o=!1}){const[c,l]=w.useState(!1),d=w.useRef(null),p=w.useRef(null),m=w.useRef(null),[y,g]=w.useState(null),b=w.useId(),x=n.find(S=>S.value===t)??n[0]??null,C=w.useCallback(()=>{const S=p.current;if(!S||typeof window>"u")return;const j=S.getBoundingClientRect(),M=window.innerWidth,A=window.innerHeight,E=12,Z=10,Y=Math.max(160,M-E*2),B=o?140:220,I=Math.min(Y,Math.max(j.width,B)),_=Math.min(Math.max(E,j.left),Math.max(E,M-I-E)),F=j.top-E,R=A-j.bottom-E,W=F>=180||F>=R;g({position:"fixed",left:_,width:I,maxWidth:Y,top:W?void 0:j.bottom+Z,bottom:W?A-j.top+Z:void 0})},[o]);return w.useEffect(()=>{if(!c)return;function S(M){var E,Z;const A=M.target;!((E=d.current)!=null&&E.contains(A))&&!((Z=m.current)!=null&&Z.contains(A))&&l(!1)}function j(M){M.key==="Escape"&&l(!1)}return window.addEventListener("pointerdown",S),window.addEventListener("keydown",j),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),C(),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",j),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[c,C]),x?i.jsxs("div",{ref:d,className:`composer-mac-select ${o?"is-compact":""}`,"data-open":c?"true":"false",children:[i.jsxs("button",{ref:p,type:"button",className:"composer-mac-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":c,"aria-controls":b,onClick:()=>l(S=>!S),children:[i.jsx("span",{className:"composer-mac-select-label",children:x.label}),i.jsx("svg",{className:"composer-mac-select-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"6 14 12 8 18 14"})})]}),c&&y&&typeof document<"u"?qn.createPortal(i.jsx("div",{ref:m,className:"composer-mac-select-popover",style:y,role:"presentation",children:i.jsx("div",{id:b,className:"composer-mac-select-list",role:"listbox","aria-label":e,children:n.map(S=>{const j=S.value===t;return i.jsxs("button",{type:"button",role:"option","aria-selected":j,className:`composer-mac-select-option ${j?"is-selected":""}`,onClick:()=>{s(S.value),l(!1)},children:[i.jsx("span",{className:"composer-mac-select-option-check","aria-hidden":"true",children:j?"✓":""}),i.jsx("span",{className:"composer-mac-select-option-label",children:S.label})]},S.value)})})}),document.body):null]}):null}function $T({contextUsage:e}){const[t,n]=w.useState(!1),s=w.useRef(null),o=w.useRef(null),[c,l]=w.useState(null),d=w.useId(),p=e?Math.round(e.usageRatio*100):null,m=e?Math.max(0,Math.min(e.usageRatio,1)):0,y=VT(m),g=e?qT(e.contextWindowSource):null,b=e?`${h("conversation.contextUsageTitle")} ${p}%`:h("conversation.contextUsageUnavailable"),x=w.useCallback(()=>{const C=s.current;if(!C||typeof window>"u")return;const S=C.getBoundingClientRect(),j=window.innerWidth,M=window.innerHeight,A=12,E=10,Z=Math.min(240,Math.max(188,j-A*2)),Y=Math.min(Math.max(A,S.left+S.width/2-Z/2),Math.max(A,j-Z-A)),B=S.top-A,I=M-S.bottom-A,_=B>=140||B>=I;l({position:"fixed",left:Y,width:Z,maxWidth:j-A*2,top:_?void 0:S.bottom+E,bottom:_?M-S.top+E:void 0})},[]);return w.useEffect(()=>{if(!t)return;function C(j){var A,E;const M=j.target;!((A=s.current)!=null&&A.contains(M))&&!((E=o.current)!=null&&E.contains(M))&&n(!1)}function S(j){j.key==="Escape"&&n(!1)}return window.addEventListener("pointerdown",C),window.addEventListener("keydown",S),window.addEventListener("resize",x),window.addEventListener("scroll",x,!0),x(),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",S),window.removeEventListener("resize",x),window.removeEventListener("scroll",x,!0)}},[t,x]),i.jsxs(i.Fragment,{children:[i.jsx("button",{ref:s,type:"button",className:`composer-context-ring ${y}`,style:{"--context-usage-progress":`${m}`},"aria-label":b,"aria-expanded":t,"aria-describedby":t?d:void 0,onClick:()=>n(C=>!C),onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),children:i.jsx("span",{className:"composer-context-ring-value",children:p===null?"--":i.jsxs(i.Fragment,{children:[i.jsx("span",{children:p}),i.jsx("span",{className:"composer-context-ring-suffix",children:"%"})]})})}),t&&c&&typeof document<"u"?qn.createPortal(i.jsx("div",{ref:o,id:d,className:"composer-context-tooltip",style:c,role:"tooltip",children:e?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"composer-context-tooltip-title",children:h("conversation.contextUsageTitle")}),i.jsxs("div",{className:"composer-context-tooltip-line",children:[p,"% · ",Md(e.promptTokens)," /"," ",Md(e.contextWindow)," tokens"]}),e.cachedInputTokens>0?i.jsx("div",{className:"composer-context-tooltip-line",children:h("conversation.contextUsageCachedTokens").replace("{count}",Md(e.cachedInputTokens))}):null,g?i.jsx("div",{className:"composer-context-tooltip-meta",children:g}):null,e.isEstimated?i.jsx("div",{className:"composer-context-tooltip-meta",children:h("conversation.contextUsageEstimated")}):null]}):i.jsx("div",{className:"composer-context-tooltip-line",children:h("conversation.contextUsageUnavailable")})}),document.body):null]})}function VT(e){return e>=.95?"is-critical":e>=.8?"is-warning":"is-normal"}function qT(e){switch(e){case"provider-log":return h("conversation.contextUsageSourceProviderLog");case"provider-runtime":return h("conversation.contextUsageSourceProviderRuntime");case"provider-config":return h("conversation.contextUsageSourceProviderConfig");case"model-map":return h("conversation.contextUsageSourceModelMap");default:return""}}function Md(e){return new Intl.NumberFormat().format(e)}function GT(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const KT=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QT=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,YT={};function cy(e,t){return(YT.jsx?QT:KT).test(e)}const XT=/[ \t\n\f\r]/g;function JT(e){return typeof e=="object"?e.type==="text"?uy(e.value):!1:uy(e)}function uy(e){return e.replace(XT,"")===""}class Lo{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}Lo.prototype.normal={};Lo.prototype.property={};Lo.prototype.space=void 0;function ox(e,t){const n={},s={};for(const o of e)Object.assign(n,o.property),Object.assign(s,o.normal);return new Lo(n,s,t)}function Lh(e){return e.toLowerCase()}class or{constructor(t,n){this.attribute=n,this.property=t}}or.prototype.attribute="";or.prototype.booleanish=!1;or.prototype.boolean=!1;or.prototype.commaOrSpaceSeparated=!1;or.prototype.commaSeparated=!1;or.prototype.defined=!1;or.prototype.mustUseProperty=!1;or.prototype.number=!1;or.prototype.overloadedBoolean=!1;or.prototype.property="";or.prototype.spaceSeparated=!1;or.prototype.space=void 0;let ZT=0;const gt=Cs(),gn=Cs(),Ih=Cs(),Pe=Cs(),Qt=Cs(),oa=Cs(),gr=Cs();function Cs(){return 2**++ZT}const Dh=Object.freeze(Object.defineProperty({__proto__:null,boolean:gt,booleanish:gn,commaOrSpaceSeparated:gr,commaSeparated:oa,number:Pe,overloadedBoolean:Ih,spaceSeparated:Qt},Symbol.toStringTag,{value:"Module"})),Ad=Object.keys(Dh);class xf extends or{constructor(t,n,s,o){let c=-1;if(super(t,n),dy(this,"space",o),typeof s=="number")for(;++c<Ad.length;){const l=Ad[c];dy(this,Ad[c],(s&Dh[l])===Dh[l])}}}xf.prototype.defined=!0;function dy(e,t,n){n&&(e[t]=n)}function da(e){const t={},n={};for(const[s,o]of Object.entries(e.properties)){const c=new xf(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(c.mustUseProperty=!0),t[s]=c,n[Lh(s)]=s,n[Lh(c.attribute)]=s}return new Lo(t,n,e.space)}const lx=da({properties:{ariaActiveDescendant:null,ariaAtomic:gn,ariaAutoComplete:null,ariaBusy:gn,ariaChecked:gn,ariaColCount:Pe,ariaColIndex:Pe,ariaColSpan:Pe,ariaControls:Qt,ariaCurrent:null,ariaDescribedBy:Qt,ariaDetails:null,ariaDisabled:gn,ariaDropEffect:Qt,ariaErrorMessage:null,ariaExpanded:gn,ariaFlowTo:Qt,ariaGrabbed:gn,ariaHasPopup:null,ariaHidden:gn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Qt,ariaLevel:Pe,ariaLive:null,ariaModal:gn,ariaMultiLine:gn,ariaMultiSelectable:gn,ariaOrientation:null,ariaOwns:Qt,ariaPlaceholder:null,ariaPosInSet:Pe,ariaPressed:gn,ariaReadOnly:gn,ariaRelevant:null,ariaRequired:gn,ariaRoleDescription:Qt,ariaRowCount:Pe,ariaRowIndex:Pe,ariaRowSpan:Pe,ariaSelected:gn,ariaSetSize:Pe,ariaSort:null,ariaValueMax:Pe,ariaValueMin:Pe,ariaValueNow:Pe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function cx(e,t){return t in e?e[t]:t}function ux(e,t){return cx(e,t.toLowerCase())}const eP=da({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:oa,acceptCharset:Qt,accessKey:Qt,action:null,allow:null,allowFullScreen:gt,allowPaymentRequest:gt,allowUserMedia:gt,alt:null,as:null,async:gt,autoCapitalize:null,autoComplete:Qt,autoFocus:gt,autoPlay:gt,blocking:Qt,capture:null,charSet:null,checked:gt,cite:null,className:Qt,cols:Pe,colSpan:null,content:null,contentEditable:gn,controls:gt,controlsList:Qt,coords:Pe|oa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:gt,defer:gt,dir:null,dirName:null,disabled:gt,download:Ih,draggable:gn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:gt,formTarget:null,headers:Qt,height:Pe,hidden:Ih,high:Pe,href:null,hrefLang:null,htmlFor:Qt,httpEquiv:Qt,id:null,imageSizes:null,imageSrcSet:null,inert:gt,inputMode:null,integrity:null,is:null,isMap:gt,itemId:null,itemProp:Qt,itemRef:Qt,itemScope:gt,itemType:Qt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:gt,low:Pe,manifest:null,max:null,maxLength:Pe,media:null,method:null,min:null,minLength:Pe,multiple:gt,muted:gt,name:null,nonce:null,noModule:gt,noValidate:gt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:gt,optimum:Pe,pattern:null,ping:Qt,placeholder:null,playsInline:gt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:gt,referrerPolicy:null,rel:Qt,required:gt,reversed:gt,rows:Pe,rowSpan:Pe,sandbox:Qt,scope:null,scoped:gt,seamless:gt,selected:gt,shadowRootClonable:gt,shadowRootDelegatesFocus:gt,shadowRootMode:null,shape:null,size:Pe,sizes:null,slot:null,span:Pe,spellCheck:gn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Pe,step:null,style:null,tabIndex:Pe,target:null,title:null,translate:null,type:null,typeMustMatch:gt,useMap:null,value:gn,width:Pe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Qt,axis:null,background:null,bgColor:null,border:Pe,borderColor:null,bottomMargin:Pe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:gt,declare:gt,event:null,face:null,frame:null,frameBorder:null,hSpace:Pe,leftMargin:Pe,link:null,longDesc:null,lowSrc:null,marginHeight:Pe,marginWidth:Pe,noResize:gt,noHref:gt,noShade:gt,noWrap:gt,object:null,profile:null,prompt:null,rev:null,rightMargin:Pe,rules:null,scheme:null,scrolling:gn,standby:null,summary:null,text:null,topMargin:Pe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Pe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:gt,disableRemotePlayback:gt,prefix:null,property:null,results:Pe,security:null,unselectable:null},space:"html",transform:ux}),tP=da({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:gr,accentHeight:Pe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Pe,amplitude:Pe,arabicForm:null,ascent:Pe,attributeName:null,attributeType:null,azimuth:Pe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Pe,by:null,calcMode:null,capHeight:Pe,className:Qt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Pe,diffuseConstant:Pe,direction:null,display:null,dur:null,divisor:Pe,dominantBaseline:null,download:gt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Pe,enableBackground:null,end:null,event:null,exponent:Pe,externalResourcesRequired:null,fill:null,fillOpacity:Pe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:oa,g2:oa,glyphName:oa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Pe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Pe,horizOriginX:Pe,horizOriginY:Pe,id:null,ideographic:Pe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Pe,k:Pe,k1:Pe,k2:Pe,k3:Pe,k4:Pe,kernelMatrix:gr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Pe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Pe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Pe,overlineThickness:Pe,paintOrder:null,panose1:null,path:null,pathLength:Pe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Qt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Pe,pointsAtY:Pe,pointsAtZ:Pe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:gr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:gr,rev:gr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:gr,requiredFeatures:gr,requiredFonts:gr,requiredFormats:gr,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Pe,specularExponent:Pe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Pe,strikethroughThickness:Pe,string:null,stroke:null,strokeDashArray:gr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Pe,strokeOpacity:Pe,strokeWidth:null,style:null,surfaceScale:Pe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:gr,tabIndex:Pe,tableValues:null,target:null,targetX:Pe,targetY:Pe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:gr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Pe,underlineThickness:Pe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Pe,values:null,vAlphabetic:Pe,vMathematical:Pe,vectorEffect:null,vHanging:Pe,vIdeographic:Pe,version:null,vertAdvY:Pe,vertOriginX:Pe,vertOriginY:Pe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Pe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:cx}),dx=da({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),hx=da({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ux}),fx=da({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),nP={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},rP=/[A-Z]/g,hy=/-[a-z]/g,iP=/^data[-\w.:]+$/i;function sP(e,t){const n=Lh(t);let s=t,o=or;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&iP.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(hy,oP);s="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!hy.test(c)){let l=c.replace(rP,aP);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}o=xf}return new o(s,t)}function aP(e){return"-"+e.toLowerCase()}function oP(e){return e.charAt(1).toUpperCase()}const lP=ox([lx,eP,dx,hx,fx],"html"),kf=ox([lx,tP,dx,hx,fx],"svg");function cP(e){return e.join(" ").trim()}var Xs={},Ld,fy;function uP(){if(fy)return Ld;fy=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,d=/^\s+|\s+$/g,p=`
70
- `,m="/",y="*",g="",b="comment",x="declaration";function C(j,M){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];M=M||{};var A=1,E=1;function Z(le){var ie=le.match(t);ie&&(A+=ie.length);var xe=le.lastIndexOf(p);E=~xe?le.length-xe:E+le.length}function Y(){var le={line:A,column:E};return function(ie){return ie.position=new B(le),F(),ie}}function B(le){this.start=le,this.end={line:A,column:E},this.source=M.source}B.prototype.content=j;function I(le){var ie=new Error(M.source+":"+A+":"+E+": "+le);if(ie.reason=le,ie.filename=M.source,ie.line=A,ie.column=E,ie.source=j,!M.silent)throw ie}function _(le){var ie=le.exec(j);if(ie){var xe=ie[0];return Z(xe),j=j.slice(xe.length),ie}}function F(){_(n)}function R(le){var ie;for(le=le||[];ie=W();)ie!==!1&&le.push(ie);return le}function W(){var le=Y();if(!(m!=j.charAt(0)||y!=j.charAt(1))){for(var ie=2;g!=j.charAt(ie)&&(y!=j.charAt(ie)||m!=j.charAt(ie+1));)++ie;if(ie+=2,g===j.charAt(ie-1))return I("End of comment missing");var xe=j.slice(2,ie-2);return E+=2,Z(xe),j=j.slice(ie),E+=2,le({type:b,comment:xe})}}function J(){var le=Y(),ie=_(s);if(ie){if(W(),!_(o))return I("property missing ':'");var xe=_(c),q=le({type:x,property:S(ie[0].replace(e,g)),value:xe?S(xe[0].replace(e,g)):g});return _(l),q}}function re(){var le=[];R(le);for(var ie;ie=J();)ie!==!1&&(le.push(ie),R(le));return le}return F(),re()}function S(j){return j?j.replace(d,g):g}return Ld=C,Ld}var py;function dP(){if(py)return Xs;py=1;var e=Xs&&Xs.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Xs,"__esModule",{value:!0}),Xs.default=n;const t=e(uP());function n(s,o){let c=null;if(!s||typeof s!="string")return c;const l=(0,t.default)(s),d=typeof o=="function";return l.forEach(p=>{if(p.type!=="declaration")return;const{property:m,value:y}=p;d?o(m,y,p):y&&(c=c||{},c[m]=y)}),c}return Xs}var Za={},my;function hP(){if(my)return Za;my=1,Object.defineProperty(Za,"__esModule",{value:!0}),Za.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,s=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,c=function(m){return!m||n.test(m)||e.test(m)},l=function(m,y){return y.toUpperCase()},d=function(m,y){return"".concat(y,"-")},p=function(m,y){return y===void 0&&(y={}),c(m)?m:(m=m.toLowerCase(),y.reactCompat?m=m.replace(o,d):m=m.replace(s,d),m.replace(t,l))};return Za.camelCase=p,Za}var eo,gy;function fP(){if(gy)return eo;gy=1;var e=eo&&eo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(dP()),n=hP();function s(o,c){var l={};return!o||typeof o!="string"||(0,t.default)(o,function(d,p){d&&p&&(l[(0,n.camelCase)(d,c)]=p)}),l}return s.default=s,eo=s,eo}var pP=fP();const mP=To(pP),px=mx("end"),Sf=mx("start");function mx(e){return t;function t(n){const s=n&&n.position&&n.position[e]||{};if(typeof s.line=="number"&&s.line>0&&typeof s.column=="number"&&s.column>0)return{line:s.line,column:s.column,offset:typeof s.offset=="number"&&s.offset>-1?s.offset:void 0}}}function gP(e){const t=Sf(e),n=px(e);if(t&&n)return{start:t,end:n}}function ho(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?yy(e.position):"start"in e||"end"in e?yy(e):"line"in e||"column"in e?_h(e):""}function _h(e){return vy(e&&e.line)+":"+vy(e&&e.column)}function yy(e){return _h(e&&e.start)+"-"+_h(e&&e.end)}function vy(e){return e&&typeof e=="number"?e:1}class Bn extends Error{constructor(t,n,s){super(),typeof n=="string"&&(s=n,n=void 0);let o="",c={},l=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?o=t:!c.cause&&t&&(l=!0,o=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof s=="string"){const p=s.indexOf(":");p===-1?c.ruleId=s:(c.source=s.slice(0,p),c.ruleId=s.slice(p+1))}if(!c.place&&c.ancestors&&c.ancestors){const p=c.ancestors[c.ancestors.length-1];p&&(c.place=p.position)}const d=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=d?d.line:void 0,this.name=ho(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=l&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Bn.prototype.file="";Bn.prototype.name="";Bn.prototype.reason="";Bn.prototype.message="";Bn.prototype.stack="";Bn.prototype.column=void 0;Bn.prototype.line=void 0;Bn.prototype.ancestors=void 0;Bn.prototype.cause=void 0;Bn.prototype.fatal=void 0;Bn.prototype.place=void 0;Bn.prototype.ruleId=void 0;Bn.prototype.source=void 0;const Cf={}.hasOwnProperty,yP=new Map,vP=/[A-Z]/g,wP=new Set(["table","tbody","thead","tfoot","tr"]),bP=new Set(["td","th"]),gx="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function xP(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let s;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");s=EP(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");s=PP(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:s,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?kf:lP,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=yx(o,e,void 0);return c&&typeof c!="string"?c:o.create(e,o.Fragment,{children:c||void 0},void 0)}function yx(e,t,n){if(t.type==="element")return kP(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return SP(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return jP(e,t,n);if(t.type==="mdxjsEsm")return CP(e,t);if(t.type==="root")return NP(e,t,n);if(t.type==="text")return TP(e,t)}function kP(e,t,n){const s=e.schema;let o=s;t.tagName.toLowerCase()==="svg"&&s.space==="html"&&(o=kf,e.schema=o),e.ancestors.push(t);const c=wx(e,t.tagName,!1),l=RP(e,t);let d=Nf(e,t);return wP.has(t.tagName)&&(d=d.filter(function(p){return typeof p=="string"?!JT(p):!0})),vx(e,l,c,t),jf(l,d),e.ancestors.pop(),e.schema=s,e.create(t,c,l,n)}function SP(e,t){if(t.data&&t.data.estree&&e.evaluater){const s=t.data.estree.body[0];return s.type,e.evaluater.evaluateExpression(s.expression)}ko(e,t.position)}function CP(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);ko(e,t.position)}function jP(e,t,n){const s=e.schema;let o=s;t.name==="svg"&&s.space==="html"&&(o=kf,e.schema=o),e.ancestors.push(t);const c=t.name===null?e.Fragment:wx(e,t.name,!0),l=MP(e,t),d=Nf(e,t);return vx(e,l,c,t),jf(l,d),e.ancestors.pop(),e.schema=s,e.create(t,c,l,n)}function NP(e,t,n){const s={};return jf(s,Nf(e,t)),e.create(t,e.Fragment,s,n)}function TP(e,t){return t.value}function vx(e,t,n,s){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=s)}function jf(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function PP(e,t,n){return s;function s(o,c,l,d){const m=Array.isArray(l.children)?n:t;return d?m(c,l,d):m(c,l)}}function EP(e,t){return n;function n(s,o,c,l){const d=Array.isArray(c.children),p=Sf(s);return t(o,c,l,d,{columnNumber:p?p.column-1:void 0,fileName:e,lineNumber:p?p.line:void 0},void 0)}}function RP(e,t){const n={};let s,o;for(o in t.properties)if(o!=="children"&&Cf.call(t.properties,o)){const c=AP(e,o,t.properties[o]);if(c){const[l,d]=c;e.tableCellAlignToStyle&&l==="align"&&typeof d=="string"&&bP.has(t.tagName)?s=d:n[l]=d}}if(s){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=s}return n}function MP(e,t){const n={};for(const s of t.attributes)if(s.type==="mdxJsxExpressionAttribute")if(s.data&&s.data.estree&&e.evaluater){const c=s.data.estree.body[0];c.type;const l=c.expression;l.type;const d=l.properties[0];d.type,Object.assign(n,e.evaluater.evaluateExpression(d.argument))}else ko(e,t.position);else{const o=s.name;let c;if(s.value&&typeof s.value=="object")if(s.value.data&&s.value.data.estree&&e.evaluater){const d=s.value.data.estree.body[0];d.type,c=e.evaluater.evaluateExpression(d.expression)}else ko(e,t.position);else c=s.value===null?!0:s.value;n[o]=c}return n}function Nf(e,t){const n=[];let s=-1;const o=e.passKeys?new Map:yP;for(;++s<t.children.length;){const c=t.children[s];let l;if(e.passKeys){const p=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(p){const m=o.get(p)||0;l=p+"-"+m,o.set(p,m+1)}}const d=yx(e,c,l);d!==void 0&&n.push(d)}return n}function AP(e,t,n){const s=sP(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=s.commaSeparated?GT(n):cP(n)),s.property==="style"){let o=typeof n=="object"?n:LP(e,String(n));return e.stylePropertyNameCase==="css"&&(o=IP(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&s.space?nP[s.property]||s.property:s.attribute,n]}}function LP(e,t){try{return mP(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const s=n,o=new Bn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=gx+"#cannot-parse-style-attribute",o}}function wx(e,t,n){let s;if(!n)s={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let c=-1,l;for(;++c<o.length;){const d=cy(o[c])?{type:"Identifier",name:o[c]}:{type:"Literal",value:o[c]};l=l?{type:"MemberExpression",object:l,property:d,computed:!!(c&&d.type==="Literal"),optional:!1}:d}s=l}else s=cy(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(s.type==="Literal"){const o=s.value;return Cf.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(s);ko(e)}function ko(e,t){const n=new Bn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=gx+"#cannot-handle-mdx-estrees-without-createevaluater",n}function IP(e){const t={};let n;for(n in e)Cf.call(e,n)&&(t[DP(n)]=e[n]);return t}function DP(e){let t=e.replace(vP,_P);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function _P(e){return"-"+e.toLowerCase()}const Id={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},FP={};function Tf(e,t){const n=FP,s=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return bx(e,s,o)}function bx(e,t,n){if(OP(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return wy(e.children,t,n)}return Array.isArray(e)?wy(e,t,n):""}function wy(e,t,n){const s=[];let o=-1;for(;++o<e.length;)s[o]=bx(e[o],t,n);return s.join("")}function OP(e){return!!(e&&typeof e=="object")}const by=document.createElement("i");function Pf(e){const t="&"+e+";";by.innerHTML=t;const n=by.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function xr(e,t,n,s){const o=e.length;let c=0,l;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,s.length<1e4)l=Array.from(s),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);c<s.length;)l=s.slice(c,c+1e4),l.unshift(t,0),e.splice(...l),c+=1e4,t+=1e4}function Dr(e,t){return e.length>0?(xr(e,e.length,0,t),e):t}const xy={}.hasOwnProperty;function xx(e){const t={};let n=-1;for(;++n<e.length;)BP(t,e[n]);return t}function BP(e,t){let n;for(n in t){const o=(xy.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let l;if(c)for(l in c){xy.call(o,l)||(o[l]=[]);const d=c[l];UP(o[l],Array.isArray(d)?d:d?[d]:[])}}}function UP(e,t){let n=-1;const s=[];for(;++n<t.length;)(t[n].add==="after"?e:s).push(t[n]);xr(e,0,0,s)}function kx(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Kr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const $n=Hi(/[A-Za-z]/),On=Hi(/[\dA-Za-z]/),zP=Hi(/[#-'*+\--9=?A-Z^-~]/);function kc(e){return e!==null&&(e<32||e===127)}const Fh=Hi(/\d/),WP=Hi(/[\dA-Fa-f]/),HP=Hi(/[!-/:-@[-`{-~]/);function st(e){return e!==null&&e<-2}function qt(e){return e!==null&&(e<0||e===32)}function jt(e){return e===-2||e===-1||e===32}const Dc=Hi(new RegExp("\\p{P}|\\p{S}","u")),ws=Hi(/\s/);function Hi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ha(e){const t=[];let n=-1,s=0,o=0;for(;++n<e.length;){const c=e.charCodeAt(n);let l="";if(c===37&&On(e.charCodeAt(n+1))&&On(e.charCodeAt(n+2)))o=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(l=String.fromCharCode(c));else if(c>55295&&c<57344){const d=e.charCodeAt(n+1);c<56320&&d>56319&&d<57344?(l=String.fromCharCode(c,d),o=1):l="�"}else l=String.fromCharCode(c);l&&(t.push(e.slice(s,n),encodeURIComponent(l)),s=n+o+1,l=""),o&&(n+=o,o=0)}return t.join("")+e.slice(s)}function Mt(e,t,n,s){const o=s?s-1:Number.POSITIVE_INFINITY;let c=0;return l;function l(p){return jt(p)?(e.enter(n),d(p)):t(p)}function d(p){return jt(p)&&c++<o?(e.consume(p),d):(e.exit(n),t(p))}}const $P={tokenize:VP};function VP(e){const t=e.attempt(this.parser.constructs.contentInitial,s,o);let n;return t;function s(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Mt(e,t,"linePrefix")}function o(d){return e.enter("paragraph"),c(d)}function c(d){const p=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=p),n=p,l(d)}function l(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return st(d)?(e.consume(d),e.exit("chunkText"),c):(e.consume(d),l)}}const qP={tokenize:GP},ky={tokenize:KP};function GP(e){const t=this,n=[];let s=0,o,c,l;return d;function d(E){if(s<n.length){const Z=n[s];return t.containerState=Z[1],e.attempt(Z[0].continuation,p,m)(E)}return m(E)}function p(E){if(s++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&A();const Z=t.events.length;let Y=Z,B;for(;Y--;)if(t.events[Y][0]==="exit"&&t.events[Y][1].type==="chunkFlow"){B=t.events[Y][1].end;break}M(s);let I=Z;for(;I<t.events.length;)t.events[I][1].end={...B},I++;return xr(t.events,Y+1,0,t.events.slice(Z)),t.events.length=I,m(E)}return d(E)}function m(E){if(s===n.length){if(!o)return b(E);if(o.currentConstruct&&o.currentConstruct.concrete)return C(E);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ky,y,g)(E)}function y(E){return o&&A(),M(s),b(E)}function g(E){return t.parser.lazy[t.now().line]=s!==n.length,l=t.now().offset,C(E)}function b(E){return t.containerState={},e.attempt(ky,x,C)(E)}function x(E){return s++,n.push([t.currentConstruct,t.containerState]),b(E)}function C(E){if(E===null){o&&A(),M(0),e.consume(E);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:c}),S(E)}function S(E){if(E===null){j(e.exit("chunkFlow"),!0),M(0),e.consume(E);return}return st(E)?(e.consume(E),j(e.exit("chunkFlow")),s=0,t.interrupt=void 0,d):(e.consume(E),S)}function j(E,Z){const Y=t.sliceStream(E);if(Z&&Y.push(null),E.previous=c,c&&(c.next=E),c=E,o.defineSkip(E.start),o.write(Y),t.parser.lazy[E.start.line]){let B=o.events.length;for(;B--;)if(o.events[B][1].start.offset<l&&(!o.events[B][1].end||o.events[B][1].end.offset>l))return;const I=t.events.length;let _=I,F,R;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){if(F){R=t.events[_][1].end;break}F=!0}for(M(s),B=I;B<t.events.length;)t.events[B][1].end={...R},B++;xr(t.events,_+1,0,t.events.slice(I)),t.events.length=B}}function M(E){let Z=n.length;for(;Z-- >E;){const Y=n[Z];t.containerState=Y[1],Y[0].exit.call(t,e)}n.length=E}function A(){o.write([null]),c=void 0,o=void 0,t.containerState._closeFlow=void 0}}function KP(e,t,n){return Mt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ca(e){if(e===null||qt(e)||ws(e))return 1;if(Dc(e))return 2}function _c(e,t,n){const s=[];let o=-1;for(;++o<e.length;){const c=e[o].resolveAll;c&&!s.includes(c)&&(t=c(t,n),s.push(c))}return t}const Oh={name:"attention",resolveAll:QP,tokenize:YP};function QP(e,t){let n=-1,s,o,c,l,d,p,m,y;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(s=n;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;p=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[s][1].end},b={...e[n][1].start};Sy(g,-p),Sy(b,p),l={type:p>1?"strongSequence":"emphasisSequence",start:g,end:{...e[s][1].end}},d={type:p>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:b},c={type:p>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},o={type:p>1?"strong":"emphasis",start:{...l.start},end:{...d.end}},e[s][1].end={...l.start},e[n][1].start={...d.end},m=[],e[s][1].end.offset-e[s][1].start.offset&&(m=Dr(m,[["enter",e[s][1],t],["exit",e[s][1],t]])),m=Dr(m,[["enter",o,t],["enter",l,t],["exit",l,t],["enter",c,t]]),m=Dr(m,_c(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),m=Dr(m,[["exit",c,t],["enter",d,t],["exit",d,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(y=2,m=Dr(m,[["enter",e[n][1],t],["exit",e[n][1],t]])):y=0,xr(e,s-1,n-s+3,m),n=s+m.length-y-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function YP(e,t){const n=this.parser.constructs.attentionMarkers.null,s=this.previous,o=ca(s);let c;return l;function l(p){return c=p,e.enter("attentionSequence"),d(p)}function d(p){if(p===c)return e.consume(p),d;const m=e.exit("attentionSequence"),y=ca(p),g=!y||y===2&&o||n.includes(p),b=!o||o===2&&y||n.includes(s);return m._open=!!(c===42?g:g&&(o||!b)),m._close=!!(c===42?b:b&&(y||!g)),t(p)}}function Sy(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const XP={name:"autolink",tokenize:JP};function JP(e,t,n){let s=0;return o;function o(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(x){return $n(x)?(e.consume(x),l):x===64?n(x):m(x)}function l(x){return x===43||x===45||x===46||On(x)?(s=1,d(x)):m(x)}function d(x){return x===58?(e.consume(x),s=0,p):(x===43||x===45||x===46||On(x))&&s++<32?(e.consume(x),d):(s=0,m(x))}function p(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):x===null||x===32||x===60||kc(x)?n(x):(e.consume(x),p)}function m(x){return x===64?(e.consume(x),y):zP(x)?(e.consume(x),m):n(x)}function y(x){return On(x)?g(x):n(x)}function g(x){return x===46?(e.consume(x),s=0,y):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):b(x)}function b(x){if((x===45||On(x))&&s++<63){const C=x===45?b:g;return e.consume(x),C}return n(x)}}const Io={partial:!0,tokenize:ZP};function ZP(e,t,n){return s;function s(c){return jt(c)?Mt(e,o,"linePrefix")(c):o(c)}function o(c){return c===null||st(c)?t(c):n(c)}}const Sx={continuation:{tokenize:tE},exit:nE,name:"blockQuote",tokenize:eE};function eE(e,t,n){const s=this;return o;function o(l){if(l===62){const d=s.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),c}return n(l)}function c(l){return jt(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function tE(e,t,n){const s=this;return o;function o(l){return jt(l)?Mt(e,c,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):c(l)}function c(l){return e.attempt(Sx,t,n)(l)}}function nE(e){e.exit("blockQuote")}const Cx={name:"characterEscape",tokenize:rE};function rE(e,t,n){return s;function s(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),o}function o(c){return HP(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const jx={name:"characterReference",tokenize:iE};function iE(e,t,n){const s=this;let o=0,c,l;return d;function d(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),p}function p(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),m):(e.enter("characterReferenceValue"),c=31,l=On,y(g))}function m(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,l=WP,y):(e.enter("characterReferenceValue"),c=7,l=Fh,y(g))}function y(g){if(g===59&&o){const b=e.exit("characterReferenceValue");return l===On&&!Pf(s.sliceSerialize(b))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(g)&&o++<c?(e.consume(g),y):n(g)}}const Cy={partial:!0,tokenize:aE},jy={concrete:!0,name:"codeFenced",tokenize:sE};function sE(e,t,n){const s=this,o={partial:!0,tokenize:Y};let c=0,l=0,d;return p;function p(B){return m(B)}function m(B){const I=s.events[s.events.length-1];return c=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,d=B,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(B)}function y(B){return B===d?(l++,e.consume(B),y):l<3?n(B):(e.exit("codeFencedFenceSequence"),jt(B)?Mt(e,g,"whitespace")(B):g(B))}function g(B){return B===null||st(B)?(e.exit("codeFencedFence"),s.interrupt?t(B):e.check(Cy,S,Z)(B)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),b(B))}function b(B){return B===null||st(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(B)):jt(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Mt(e,x,"whitespace")(B)):B===96&&B===d?n(B):(e.consume(B),b)}function x(B){return B===null||st(B)?g(B):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),C(B))}function C(B){return B===null||st(B)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(B)):B===96&&B===d?n(B):(e.consume(B),C)}function S(B){return e.attempt(o,Z,j)(B)}function j(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),M}function M(B){return c>0&&jt(B)?Mt(e,A,"linePrefix",c+1)(B):A(B)}function A(B){return B===null||st(B)?e.check(Cy,S,Z)(B):(e.enter("codeFlowValue"),E(B))}function E(B){return B===null||st(B)?(e.exit("codeFlowValue"),A(B)):(e.consume(B),E)}function Z(B){return e.exit("codeFenced"),t(B)}function Y(B,I,_){let F=0;return R;function R(ie){return B.enter("lineEnding"),B.consume(ie),B.exit("lineEnding"),W}function W(ie){return B.enter("codeFencedFence"),jt(ie)?Mt(B,J,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ie):J(ie)}function J(ie){return ie===d?(B.enter("codeFencedFenceSequence"),re(ie)):_(ie)}function re(ie){return ie===d?(F++,B.consume(ie),re):F>=l?(B.exit("codeFencedFenceSequence"),jt(ie)?Mt(B,le,"whitespace")(ie):le(ie)):_(ie)}function le(ie){return ie===null||st(ie)?(B.exit("codeFencedFence"),I(ie)):_(ie)}}}function aE(e,t,n){const s=this;return o;function o(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),c)}function c(l){return s.parser.lazy[s.now().line]?n(l):t(l)}}const Dd={name:"codeIndented",tokenize:lE},oE={partial:!0,tokenize:cE};function lE(e,t,n){const s=this;return o;function o(m){return e.enter("codeIndented"),Mt(e,c,"linePrefix",5)(m)}function c(m){const y=s.events[s.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?l(m):n(m)}function l(m){return m===null?p(m):st(m)?e.attempt(oE,l,p)(m):(e.enter("codeFlowValue"),d(m))}function d(m){return m===null||st(m)?(e.exit("codeFlowValue"),l(m)):(e.consume(m),d)}function p(m){return e.exit("codeIndented"),t(m)}}function cE(e,t,n){const s=this;return o;function o(l){return s.parser.lazy[s.now().line]?n(l):st(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):Mt(e,c,"linePrefix",5)(l)}function c(l){const d=s.events[s.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(l):st(l)?o(l):n(l)}}const uE={name:"codeText",previous:hE,resolve:dE,tokenize:fE};function dE(e){let t=e.length-4,n=3,s,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(s=n;++s<t;)if(e[s][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(s=n-1,t++;++s<=t;)o===void 0?s!==t&&e[s][1].type!=="lineEnding"&&(o=s):(s===t||e[s][1].type==="lineEnding")&&(e[o][1].type="codeTextData",s!==o+2&&(e[o][1].end=e[s-1][1].end,e.splice(o+2,s-o-2),t-=s-o-2,s=o+2),o=void 0);return e}function hE(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function fE(e,t,n){let s=0,o,c;return l;function l(g){return e.enter("codeText"),e.enter("codeTextSequence"),d(g)}function d(g){return g===96?(e.consume(g),s++,d):(e.exit("codeTextSequence"),p(g))}function p(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),p):g===96?(c=e.enter("codeTextSequence"),o=0,y(g)):st(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),p):(e.enter("codeTextData"),m(g))}function m(g){return g===null||g===32||g===96||st(g)?(e.exit("codeTextData"),p(g)):(e.consume(g),m)}function y(g){return g===96?(e.consume(g),o++,y):o===s?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(c.type="codeTextData",m(g))}}class pE{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const s=n??Number.POSITIVE_INFINITY;return s<this.left.length?this.left.slice(t,s):t>this.left.length?this.right.slice(this.right.length-s+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-s+this.left.length).reverse())}splice(t,n,s){const o=n||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return s&&to(this.left,s),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),to(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),to(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);to(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);to(this.left,n.reverse())}}}function to(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Nx(e){const t={};let n=-1,s,o,c,l,d,p,m;const y=new pE(e);for(;++n<y.length;){for(;n in t;)n=t[n];if(s=y.get(n),n&&s[1].type==="chunkFlow"&&y.get(n-1)[1].type==="listItemPrefix"&&(p=s[1]._tokenizer.events,c=0,c<p.length&&p[c][1].type==="lineEndingBlank"&&(c+=2),c<p.length&&p[c][1].type==="content"))for(;++c<p.length&&p[c][1].type!=="content";)p[c][1].type==="chunkText"&&(p[c][1]._isInFirstContentOfListItem=!0,c++);if(s[0]==="enter")s[1].contentType&&(Object.assign(t,mE(y,n)),n=t[n],m=!0);else if(s[1]._container){for(c=n,o=void 0;c--;)if(l=y.get(c),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(o&&(y.get(o)[1].type="lineEndingBlank"),l[1].type="lineEnding",o=c);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;o&&(s[1].end={...y.get(o)[1].start},d=y.slice(o,n),d.unshift(s),y.splice(o,n-o+1,d))}}return xr(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!m}function mE(e,t){const n=e.get(t)[1],s=e.get(t)[2];let o=t-1;const c=[];let l=n._tokenizer;l||(l=s.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const d=l.events,p=[],m={};let y,g,b=-1,x=n,C=0,S=0;const j=[S];for(;x;){for(;e.get(++o)[1]!==x;);c.push(o),x._tokenizer||(y=s.sliceStream(x),x.next||y.push(null),g&&l.defineSkip(x.start),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(y),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=n;++b<d.length;)d[b][0]==="exit"&&d[b-1][0]==="enter"&&d[b][1].type===d[b-1][1].type&&d[b][1].start.line!==d[b][1].end.line&&(S=b+1,j.push(S),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(l.events=[],x?(x._tokenizer=void 0,x.previous=void 0):j.pop(),b=j.length;b--;){const M=d.slice(j[b],j[b+1]),A=c.pop();p.push([A,A+M.length-1]),e.splice(A,2,M)}for(p.reverse(),b=-1;++b<p.length;)m[C+p[b][0]]=C+p[b][1],C+=p[b][1]-p[b][0]-1;return m}const gE={resolve:vE,tokenize:wE},yE={partial:!0,tokenize:bE};function vE(e){return Nx(e),e}function wE(e,t){let n;return s;function s(d){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(d)}function o(d){return d===null?c(d):st(d)?e.check(yE,l,c)(d):(e.consume(d),o)}function c(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function l(d){return e.consume(d),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function bE(e,t,n){const s=this;return o;function o(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Mt(e,c,"linePrefix")}function c(l){if(l===null||st(l))return n(l);const d=s.events[s.events.length-1];return!s.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(l):e.interrupt(s.parser.constructs.flow,n,t)(l)}}function Tx(e,t,n,s,o,c,l,d,p){const m=p||Number.POSITIVE_INFINITY;let y=0;return g;function g(M){return M===60?(e.enter(s),e.enter(o),e.enter(c),e.consume(M),e.exit(c),b):M===null||M===32||M===41||kc(M)?n(M):(e.enter(s),e.enter(l),e.enter(d),e.enter("chunkString",{contentType:"string"}),S(M))}function b(M){return M===62?(e.enter(c),e.consume(M),e.exit(c),e.exit(o),e.exit(s),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),x(M))}function x(M){return M===62?(e.exit("chunkString"),e.exit(d),b(M)):M===null||M===60||st(M)?n(M):(e.consume(M),M===92?C:x)}function C(M){return M===60||M===62||M===92?(e.consume(M),x):x(M)}function S(M){return!y&&(M===null||M===41||qt(M))?(e.exit("chunkString"),e.exit(d),e.exit(l),e.exit(s),t(M)):y<m&&M===40?(e.consume(M),y++,S):M===41?(e.consume(M),y--,S):M===null||M===32||M===40||kc(M)?n(M):(e.consume(M),M===92?j:S)}function j(M){return M===40||M===41||M===92?(e.consume(M),S):S(M)}}function Px(e,t,n,s,o,c){const l=this;let d=0,p;return m;function m(x){return e.enter(s),e.enter(o),e.consume(x),e.exit(o),e.enter(c),y}function y(x){return d>999||x===null||x===91||x===93&&!p||x===94&&!d&&"_hiddenFootnoteSupport"in l.parser.constructs?n(x):x===93?(e.exit(c),e.enter(o),e.consume(x),e.exit(o),e.exit(s),t):st(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||st(x)||d++>999?(e.exit("chunkString"),y(x)):(e.consume(x),p||(p=!jt(x)),x===92?b:g)}function b(x){return x===91||x===92||x===93?(e.consume(x),d++,g):g(x)}}function Ex(e,t,n,s,o,c){let l;return d;function d(b){return b===34||b===39||b===40?(e.enter(s),e.enter(o),e.consume(b),e.exit(o),l=b===40?41:b,p):n(b)}function p(b){return b===l?(e.enter(o),e.consume(b),e.exit(o),e.exit(s),t):(e.enter(c),m(b))}function m(b){return b===l?(e.exit(c),p(l)):b===null?n(b):st(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),Mt(e,m,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(b))}function y(b){return b===l||b===null||st(b)?(e.exit("chunkString"),m(b)):(e.consume(b),b===92?g:y)}function g(b){return b===l||b===92?(e.consume(b),y):y(b)}}function fo(e,t){let n;return s;function s(o){return st(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,s):jt(o)?Mt(e,s,n?"linePrefix":"lineSuffix")(o):t(o)}}const xE={name:"definition",tokenize:SE},kE={partial:!0,tokenize:CE};function SE(e,t,n){const s=this;let o;return c;function c(x){return e.enter("definition"),l(x)}function l(x){return Px.call(s,e,d,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function d(x){return o=Kr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),p):n(x)}function p(x){return qt(x)?fo(e,m)(x):m(x)}function m(x){return Tx(e,y,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function y(x){return e.attempt(kE,g,g)(x)}function g(x){return jt(x)?Mt(e,b,"whitespace")(x):b(x)}function b(x){return x===null||st(x)?(e.exit("definition"),s.parser.defined.push(o),t(x)):n(x)}}function CE(e,t,n){return s;function s(d){return qt(d)?fo(e,o)(d):n(d)}function o(d){return Ex(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function c(d){return jt(d)?Mt(e,l,"whitespace")(d):l(d)}function l(d){return d===null||st(d)?t(d):n(d)}}const jE={name:"hardBreakEscape",tokenize:NE};function NE(e,t,n){return s;function s(c){return e.enter("hardBreakEscape"),e.consume(c),o}function o(c){return st(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const TE={name:"headingAtx",resolve:PE,tokenize:EE};function PE(e,t){let n=e.length-2,s=3,o,c;return e[s][1].type==="whitespace"&&(s+=2),n-2>s&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(s===n-1||n-4>s&&e[n-2][1].type==="whitespace")&&(n-=s+1===n?2:4),n>s&&(o={type:"atxHeadingText",start:e[s][1].start,end:e[n][1].end},c={type:"chunkText",start:e[s][1].start,end:e[n][1].end,contentType:"text"},xr(e,s,n-s+1,[["enter",o,t],["enter",c,t],["exit",c,t],["exit",o,t]])),e}function EE(e,t,n){let s=0;return o;function o(y){return e.enter("atxHeading"),c(y)}function c(y){return e.enter("atxHeadingSequence"),l(y)}function l(y){return y===35&&s++<6?(e.consume(y),l):y===null||qt(y)?(e.exit("atxHeadingSequence"),d(y)):n(y)}function d(y){return y===35?(e.enter("atxHeadingSequence"),p(y)):y===null||st(y)?(e.exit("atxHeading"),t(y)):jt(y)?Mt(e,d,"whitespace")(y):(e.enter("atxHeadingText"),m(y))}function p(y){return y===35?(e.consume(y),p):(e.exit("atxHeadingSequence"),d(y))}function m(y){return y===null||y===35||qt(y)?(e.exit("atxHeadingText"),d(y)):(e.consume(y),m)}}const RE=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ny=["pre","script","style","textarea"],ME={concrete:!0,name:"htmlFlow",resolveTo:IE,tokenize:DE},AE={partial:!0,tokenize:FE},LE={partial:!0,tokenize:_E};function IE(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function DE(e,t,n){const s=this;let o,c,l,d,p;return m;function m(P){return y(P)}function y(P){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(P),g}function g(P){return P===33?(e.consume(P),b):P===47?(e.consume(P),c=!0,S):P===63?(e.consume(P),o=3,s.interrupt?t:L):$n(P)?(e.consume(P),l=String.fromCharCode(P),j):n(P)}function b(P){return P===45?(e.consume(P),o=2,x):P===91?(e.consume(P),o=5,d=0,C):$n(P)?(e.consume(P),o=4,s.interrupt?t:L):n(P)}function x(P){return P===45?(e.consume(P),s.interrupt?t:L):n(P)}function C(P){const be="CDATA[";return P===be.charCodeAt(d++)?(e.consume(P),d===be.length?s.interrupt?t:J:C):n(P)}function S(P){return $n(P)?(e.consume(P),l=String.fromCharCode(P),j):n(P)}function j(P){if(P===null||P===47||P===62||qt(P)){const be=P===47,ke=l.toLowerCase();return!be&&!c&&Ny.includes(ke)?(o=1,s.interrupt?t(P):J(P)):RE.includes(l.toLowerCase())?(o=6,be?(e.consume(P),M):s.interrupt?t(P):J(P)):(o=7,s.interrupt&&!s.parser.lazy[s.now().line]?n(P):c?A(P):E(P))}return P===45||On(P)?(e.consume(P),l+=String.fromCharCode(P),j):n(P)}function M(P){return P===62?(e.consume(P),s.interrupt?t:J):n(P)}function A(P){return jt(P)?(e.consume(P),A):R(P)}function E(P){return P===47?(e.consume(P),R):P===58||P===95||$n(P)?(e.consume(P),Z):jt(P)?(e.consume(P),E):R(P)}function Z(P){return P===45||P===46||P===58||P===95||On(P)?(e.consume(P),Z):Y(P)}function Y(P){return P===61?(e.consume(P),B):jt(P)?(e.consume(P),Y):E(P)}function B(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),p=P,I):jt(P)?(e.consume(P),B):_(P)}function I(P){return P===p?(e.consume(P),p=null,F):P===null||st(P)?n(P):(e.consume(P),I)}function _(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||qt(P)?Y(P):(e.consume(P),_)}function F(P){return P===47||P===62||jt(P)?E(P):n(P)}function R(P){return P===62?(e.consume(P),W):n(P)}function W(P){return P===null||st(P)?J(P):jt(P)?(e.consume(P),W):n(P)}function J(P){return P===45&&o===2?(e.consume(P),xe):P===60&&o===1?(e.consume(P),q):P===62&&o===4?(e.consume(P),$):P===63&&o===3?(e.consume(P),L):P===93&&o===5?(e.consume(P),me):st(P)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(AE,se,re)(P)):P===null||st(P)?(e.exit("htmlFlowData"),re(P)):(e.consume(P),J)}function re(P){return e.check(LE,le,se)(P)}function le(P){return e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),ie}function ie(P){return P===null||st(P)?re(P):(e.enter("htmlFlowData"),J(P))}function xe(P){return P===45?(e.consume(P),L):J(P)}function q(P){return P===47?(e.consume(P),l="",K):J(P)}function K(P){if(P===62){const be=l.toLowerCase();return Ny.includes(be)?(e.consume(P),$):J(P)}return $n(P)&&l.length<8?(e.consume(P),l+=String.fromCharCode(P),K):J(P)}function me(P){return P===93?(e.consume(P),L):J(P)}function L(P){return P===62?(e.consume(P),$):P===45&&o===2?(e.consume(P),L):J(P)}function $(P){return P===null||st(P)?(e.exit("htmlFlowData"),se(P)):(e.consume(P),$)}function se(P){return e.exit("htmlFlow"),t(P)}}function _E(e,t,n){const s=this;return o;function o(l){return st(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),c):n(l)}function c(l){return s.parser.lazy[s.now().line]?n(l):t(l)}}function FE(e,t,n){return s;function s(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Io,t,n)}}const OE={name:"htmlText",tokenize:BE};function BE(e,t,n){const s=this;let o,c,l;return d;function d(L){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(L),p}function p(L){return L===33?(e.consume(L),m):L===47?(e.consume(L),Y):L===63?(e.consume(L),E):$n(L)?(e.consume(L),_):n(L)}function m(L){return L===45?(e.consume(L),y):L===91?(e.consume(L),c=0,C):$n(L)?(e.consume(L),A):n(L)}function y(L){return L===45?(e.consume(L),x):n(L)}function g(L){return L===null?n(L):L===45?(e.consume(L),b):st(L)?(l=g,q(L)):(e.consume(L),g)}function b(L){return L===45?(e.consume(L),x):g(L)}function x(L){return L===62?xe(L):L===45?b(L):g(L)}function C(L){const $="CDATA[";return L===$.charCodeAt(c++)?(e.consume(L),c===$.length?S:C):n(L)}function S(L){return L===null?n(L):L===93?(e.consume(L),j):st(L)?(l=S,q(L)):(e.consume(L),S)}function j(L){return L===93?(e.consume(L),M):S(L)}function M(L){return L===62?xe(L):L===93?(e.consume(L),M):S(L)}function A(L){return L===null||L===62?xe(L):st(L)?(l=A,q(L)):(e.consume(L),A)}function E(L){return L===null?n(L):L===63?(e.consume(L),Z):st(L)?(l=E,q(L)):(e.consume(L),E)}function Z(L){return L===62?xe(L):E(L)}function Y(L){return $n(L)?(e.consume(L),B):n(L)}function B(L){return L===45||On(L)?(e.consume(L),B):I(L)}function I(L){return st(L)?(l=I,q(L)):jt(L)?(e.consume(L),I):xe(L)}function _(L){return L===45||On(L)?(e.consume(L),_):L===47||L===62||qt(L)?F(L):n(L)}function F(L){return L===47?(e.consume(L),xe):L===58||L===95||$n(L)?(e.consume(L),R):st(L)?(l=F,q(L)):jt(L)?(e.consume(L),F):xe(L)}function R(L){return L===45||L===46||L===58||L===95||On(L)?(e.consume(L),R):W(L)}function W(L){return L===61?(e.consume(L),J):st(L)?(l=W,q(L)):jt(L)?(e.consume(L),W):F(L)}function J(L){return L===null||L===60||L===61||L===62||L===96?n(L):L===34||L===39?(e.consume(L),o=L,re):st(L)?(l=J,q(L)):jt(L)?(e.consume(L),J):(e.consume(L),le)}function re(L){return L===o?(e.consume(L),o=void 0,ie):L===null?n(L):st(L)?(l=re,q(L)):(e.consume(L),re)}function le(L){return L===null||L===34||L===39||L===60||L===61||L===96?n(L):L===47||L===62||qt(L)?F(L):(e.consume(L),le)}function ie(L){return L===47||L===62||qt(L)?F(L):n(L)}function xe(L){return L===62?(e.consume(L),e.exit("htmlTextData"),e.exit("htmlText"),t):n(L)}function q(L){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(L),e.exit("lineEnding"),K}function K(L){return jt(L)?Mt(e,me,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(L):me(L)}function me(L){return e.enter("htmlTextData"),l(L)}}const Ef={name:"labelEnd",resolveAll:HE,resolveTo:$E,tokenize:VE},UE={tokenize:qE},zE={tokenize:GE},WE={tokenize:KE};function HE(e){let t=-1;const n=[];for(;++t<e.length;){const s=e[t][1];if(n.push(e[t]),s.type==="labelImage"||s.type==="labelLink"||s.type==="labelEnd"){const o=s.type==="labelImage"?4:2;s.type="data",t+=o}}return e.length!==n.length&&xr(e,0,e.length,n),e}function $E(e,t){let n=e.length,s=0,o,c,l,d;for(;n--;)if(o=e[n][1],c){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(c=n,o.type!=="labelLink")){s=2;break}}else o.type==="labelEnd"&&(l=n);const p={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},m={type:"label",start:{...e[c][1].start},end:{...e[l][1].end}},y={type:"labelText",start:{...e[c+s+2][1].end},end:{...e[l-2][1].start}};return d=[["enter",p,t],["enter",m,t]],d=Dr(d,e.slice(c+1,c+s+3)),d=Dr(d,[["enter",y,t]]),d=Dr(d,_c(t.parser.constructs.insideSpan.null,e.slice(c+s+4,l-3),t)),d=Dr(d,[["exit",y,t],e[l-2],e[l-1],["exit",m,t]]),d=Dr(d,e.slice(l+1)),d=Dr(d,[["exit",p,t]]),xr(e,c,e.length,d),e}function VE(e,t,n){const s=this;let o=s.events.length,c,l;for(;o--;)if((s.events[o][1].type==="labelImage"||s.events[o][1].type==="labelLink")&&!s.events[o][1]._balanced){c=s.events[o][1];break}return d;function d(b){return c?c._inactive?g(b):(l=s.parser.defined.includes(Kr(s.sliceSerialize({start:c.end,end:s.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(b),e.exit("labelMarker"),e.exit("labelEnd"),p):n(b)}function p(b){return b===40?e.attempt(UE,y,l?y:g)(b):b===91?e.attempt(zE,y,l?m:g)(b):l?y(b):g(b)}function m(b){return e.attempt(WE,y,g)(b)}function y(b){return t(b)}function g(b){return c._balanced=!0,n(b)}}function qE(e,t,n){return s;function s(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),o}function o(g){return qt(g)?fo(e,c)(g):c(g)}function c(g){return g===41?y(g):Tx(e,l,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function l(g){return qt(g)?fo(e,p)(g):y(g)}function d(g){return n(g)}function p(g){return g===34||g===39||g===40?Ex(e,m,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function m(g){return qt(g)?fo(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function GE(e,t,n){const s=this;return o;function o(d){return Px.call(s,e,c,l,"reference","referenceMarker","referenceString")(d)}function c(d){return s.parser.defined.includes(Kr(s.sliceSerialize(s.events[s.events.length-1][1]).slice(1,-1)))?t(d):n(d)}function l(d){return n(d)}}function KE(e,t,n){return s;function s(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),o}function o(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const QE={name:"labelStartImage",resolveAll:Ef.resolveAll,tokenize:YE};function YE(e,t,n){const s=this;return o;function o(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),c}function c(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),l):n(d)}function l(d){return d===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(d):t(d)}}const XE={name:"labelStartLink",resolveAll:Ef.resolveAll,tokenize:JE};function JE(e,t,n){const s=this;return o;function o(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),c}function c(l){return l===94&&"_hiddenFootnoteSupport"in s.parser.constructs?n(l):t(l)}}const _d={name:"lineEnding",tokenize:ZE};function ZE(e,t){return n;function n(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),Mt(e,t,"linePrefix")}}const oc={name:"thematicBreak",tokenize:eR};function eR(e,t,n){let s=0,o;return c;function c(m){return e.enter("thematicBreak"),l(m)}function l(m){return o=m,d(m)}function d(m){return m===o?(e.enter("thematicBreakSequence"),p(m)):s>=3&&(m===null||st(m))?(e.exit("thematicBreak"),t(m)):n(m)}function p(m){return m===o?(e.consume(m),s++,p):(e.exit("thematicBreakSequence"),jt(m)?Mt(e,d,"whitespace")(m):d(m))}}const rr={continuation:{tokenize:iR},exit:aR,name:"list",tokenize:rR},tR={partial:!0,tokenize:oR},nR={partial:!0,tokenize:sR};function rR(e,t,n){const s=this,o=s.events[s.events.length-1];let c=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,l=0;return d;function d(x){const C=s.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(C==="listUnordered"?!s.containerState.marker||x===s.containerState.marker:Fh(x)){if(s.containerState.type||(s.containerState.type=C,e.enter(C,{_container:!0})),C==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(oc,n,m)(x):m(x);if(!s.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),p(x)}return n(x)}function p(x){return Fh(x)&&++l<10?(e.consume(x),p):(!s.interrupt||l<2)&&(s.containerState.marker?x===s.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),m(x)):n(x)}function m(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),s.containerState.marker=s.containerState.marker||x,e.check(Io,s.interrupt?n:y,e.attempt(tR,b,g))}function y(x){return s.containerState.initialBlankLine=!0,c++,b(x)}function g(x){return jt(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),b):n(x)}function b(x){return s.containerState.size=c+s.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(x)}}function iR(e,t,n){const s=this;return s.containerState._closeFlow=void 0,e.check(Io,o,c);function o(d){return s.containerState.furtherBlankLines=s.containerState.furtherBlankLines||s.containerState.initialBlankLine,Mt(e,t,"listItemIndent",s.containerState.size+1)(d)}function c(d){return s.containerState.furtherBlankLines||!jt(d)?(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,l(d)):(s.containerState.furtherBlankLines=void 0,s.containerState.initialBlankLine=void 0,e.attempt(nR,t,l)(d))}function l(d){return s.containerState._closeFlow=!0,s.interrupt=void 0,Mt(e,e.attempt(rr,t,n),"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function sR(e,t,n){const s=this;return Mt(e,o,"listItemIndent",s.containerState.size+1);function o(c){const l=s.events[s.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===s.containerState.size?t(c):n(c)}}function aR(e){e.exit(this.containerState.type)}function oR(e,t,n){const s=this;return Mt(e,o,"listItemPrefixWhitespace",s.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(c){const l=s.events[s.events.length-1];return!jt(c)&&l&&l[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const Ty={name:"setextUnderline",resolveTo:lR,tokenize:cR};function lR(e,t){let n=e.length,s,o,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){s=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const l={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",c?(e.splice(o,0,["enter",l,t]),e.splice(c+1,0,["exit",e[s][1],t]),e[s][1].end={...e[c][1].end}):e[s][1]=l,e.push(["exit",l,t]),e}function cR(e,t,n){const s=this;let o;return c;function c(m){let y=s.events.length,g;for(;y--;)if(s.events[y][1].type!=="lineEnding"&&s.events[y][1].type!=="linePrefix"&&s.events[y][1].type!=="content"){g=s.events[y][1].type==="paragraph";break}return!s.parser.lazy[s.now().line]&&(s.interrupt||g)?(e.enter("setextHeadingLine"),o=m,l(m)):n(m)}function l(m){return e.enter("setextHeadingLineSequence"),d(m)}function d(m){return m===o?(e.consume(m),d):(e.exit("setextHeadingLineSequence"),jt(m)?Mt(e,p,"lineSuffix")(m):p(m))}function p(m){return m===null||st(m)?(e.exit("setextHeadingLine"),t(m)):n(m)}}const uR={tokenize:dR};function dR(e){const t=this,n=e.attempt(Io,s,e.attempt(this.parser.constructs.flowInitial,o,Mt(e,e.attempt(this.parser.constructs.flow,o,e.attempt(gE,o)),"linePrefix")));return n;function s(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const hR={resolveAll:Mx()},fR=Rx("string"),pR=Rx("text");function Rx(e){return{resolveAll:Mx(e==="text"?mR:void 0),tokenize:t};function t(n){const s=this,o=this.parser.constructs[e],c=n.attempt(o,l,d);return l;function l(y){return m(y)?c(y):d(y)}function d(y){if(y===null){n.consume(y);return}return n.enter("data"),n.consume(y),p}function p(y){return m(y)?(n.exit("data"),c(y)):(n.consume(y),p)}function m(y){if(y===null)return!0;const g=o[y];let b=-1;if(g)for(;++b<g.length;){const x=g[b];if(!x.previous||x.previous.call(s,s.previous))return!0}return!1}}}function Mx(e){return t;function t(n,s){let o=-1,c;for(;++o<=n.length;)c===void 0?n[o]&&n[o][1].type==="data"&&(c=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==c+2&&(n[c][1].end=n[o-1][1].end,n.splice(c+2,o-c-2),o=c+2),c=void 0);return e?e(n,s):n}}function mR(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const s=e[n-1][1],o=t.sliceStream(s);let c=o.length,l=-1,d=0,p;for(;c--;){const m=o[c];if(typeof m=="string"){for(l=m.length;m.charCodeAt(l-1)===32;)d++,l--;if(l)break;l=-1}else if(m===-2)p=!0,d++;else if(m!==-1){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(d=0),d){const m={type:n===e.length||p||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?l:s.start._bufferIndex+l,_index:s.start._index+c,line:s.end.line,column:s.end.column-d,offset:s.end.offset-d},end:{...s.end}};s.end={...m.start},s.start.offset===s.end.offset?Object.assign(s,m):(e.splice(n,0,["enter",m,t],["exit",m,t]),n+=2)}n++}return e}const gR={42:rr,43:rr,45:rr,48:rr,49:rr,50:rr,51:rr,52:rr,53:rr,54:rr,55:rr,56:rr,57:rr,62:Sx},yR={91:xE},vR={[-2]:Dd,[-1]:Dd,32:Dd},wR={35:TE,42:oc,45:[Ty,oc],60:ME,61:Ty,95:oc,96:jy,126:jy},bR={38:jx,92:Cx},xR={[-5]:_d,[-4]:_d,[-3]:_d,33:QE,38:jx,42:Oh,60:[XP,OE],91:XE,92:[jE,Cx],93:Ef,95:Oh,96:uE},kR={null:[Oh,hR]},SR={null:[42,95]},CR={null:[]},jR=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:SR,contentInitial:yR,disable:CR,document:gR,flow:wR,flowInitial:vR,insideSpan:kR,string:bR,text:xR},Symbol.toStringTag,{value:"Module"}));function NR(e,t,n){let s={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},c=[];let l=[],d=[];const p={attempt:I(Y),check:I(B),consume:A,enter:E,exit:Z,interrupt:I(B,{interrupt:!0})},m={code:null,containerState:{},defineSkip:S,events:[],now:C,parser:e,previous:null,sliceSerialize:b,sliceStream:x,write:g};let y=t.tokenize.call(m,p);return t.resolveAll&&c.push(t),m;function g(W){return l=Dr(l,W),j(),l[l.length-1]!==null?[]:(_(t,0),m.events=_c(c,m.events,m),m.events)}function b(W,J){return PR(x(W),J)}function x(W){return TR(l,W)}function C(){const{_bufferIndex:W,_index:J,line:re,column:le,offset:ie}=s;return{_bufferIndex:W,_index:J,line:re,column:le,offset:ie}}function S(W){o[W.line]=W.column,R()}function j(){let W;for(;s._index<l.length;){const J=l[s._index];if(typeof J=="string")for(W=s._index,s._bufferIndex<0&&(s._bufferIndex=0);s._index===W&&s._bufferIndex<J.length;)M(J.charCodeAt(s._bufferIndex));else M(J)}}function M(W){y=y(W)}function A(W){st(W)?(s.line++,s.column=1,s.offset+=W===-3?2:1,R()):W!==-1&&(s.column++,s.offset++),s._bufferIndex<0?s._index++:(s._bufferIndex++,s._bufferIndex===l[s._index].length&&(s._bufferIndex=-1,s._index++)),m.previous=W}function E(W,J){const re=J||{};return re.type=W,re.start=C(),m.events.push(["enter",re,m]),d.push(re),re}function Z(W){const J=d.pop();return J.end=C(),m.events.push(["exit",J,m]),J}function Y(W,J){_(W,J.from)}function B(W,J){J.restore()}function I(W,J){return re;function re(le,ie,xe){let q,K,me,L;return Array.isArray(le)?se(le):"tokenize"in le?se([le]):$(le);function $(ve){return Ae;function Ae(Be){const qe=Be!==null&&ve[Be],nt=Be!==null&&ve.null,wt=[...Array.isArray(qe)?qe:qe?[qe]:[],...Array.isArray(nt)?nt:nt?[nt]:[]];return se(wt)(Be)}}function se(ve){return q=ve,K=0,ve.length===0?xe:P(ve[K])}function P(ve){return Ae;function Ae(Be){return L=F(),me=ve,ve.partial||(m.currentConstruct=ve),ve.name&&m.parser.constructs.disable.null.includes(ve.name)?ke():ve.tokenize.call(J?Object.assign(Object.create(m),J):m,p,be,ke)(Be)}}function be(ve){return W(me,L),ie}function ke(ve){return L.restore(),++K<q.length?P(q[K]):xe}}}function _(W,J){W.resolveAll&&!c.includes(W)&&c.push(W),W.resolve&&xr(m.events,J,m.events.length-J,W.resolve(m.events.slice(J),m)),W.resolveTo&&(m.events=W.resolveTo(m.events,m))}function F(){const W=C(),J=m.previous,re=m.currentConstruct,le=m.events.length,ie=Array.from(d);return{from:le,restore:xe};function xe(){s=W,m.previous=J,m.currentConstruct=re,m.events.length=le,d=ie,R()}}function R(){s.line in o&&s.column<2&&(s.column=o[s.line],s.offset+=o[s.line]-1)}}function TR(e,t){const n=t.start._index,s=t.start._bufferIndex,o=t.end._index,c=t.end._bufferIndex;let l;if(n===o)l=[e[n].slice(s,c)];else{if(l=e.slice(n,o),s>-1){const d=l[0];typeof d=="string"?l[0]=d.slice(s):l.shift()}c>0&&l.push(e[o].slice(0,c))}return l}function PR(e,t){let n=-1;const s=[];let o;for(;++n<e.length;){const c=e[n];let l;if(typeof c=="string")l=c;else switch(c){case-5:{l="\r";break}case-4:{l=`
71
- `;break}case-3:{l=`\r
72
- `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&o)continue;l=" ";break}default:l=String.fromCharCode(c)}o=c===-2,s.push(l)}return s.join("")}function ER(e){const s={constructs:xx([jR,...(e||{}).extensions||[]]),content:o($P),defined:[],document:o(qP),flow:o(uR),lazy:{},string:o(fR),text:o(pR)};return s;function o(c){return l;function l(d){return NR(s,c,d)}}}function RR(e){for(;!Nx(e););return e}const Py=/[\0\t\n\r]/g;function MR(){let e=1,t="",n=!0,s;return o;function o(c,l,d){const p=[];let m,y,g,b,x;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(l||void 0).decode(c)),g=0,t="",n&&(c.charCodeAt(0)===65279&&g++,n=void 0);g<c.length;){if(Py.lastIndex=g,m=Py.exec(c),b=m&&m.index!==void 0?m.index:c.length,x=c.charCodeAt(b),!m){t=c.slice(g);break}if(x===10&&g===b&&s)p.push(-3),s=void 0;else switch(s&&(p.push(-5),s=void 0),g<b&&(p.push(c.slice(g,b)),e+=b-g),x){case 0:{p.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,p.push(-2);e++<y;)p.push(-1);break}case 10:{p.push(-4),e=1;break}default:s=!0,e=1}g=b+1}return d&&(s&&p.push(-5),t&&p.push(t),p.push(null)),p}}const AR=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function LR(e){return e.replace(AR,IR)}function IR(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),c=o===120||o===88;return kx(n.slice(c?2:1),c?16:10)}return Pf(n)||e}const Ax={}.hasOwnProperty;function DR(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),_R(n)(RR(ER(n).document().write(MR()(e,t,!0))))}function _R(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(Nt),autolinkProtocol:F,autolinkEmail:F,atxHeading:c(_t),blockQuote:c(nt),characterEscape:F,characterReference:F,codeFenced:c(wt),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:c(wt,l),codeText:c(ze,l),codeTextData:F,data:F,codeFlowValue:F,definition:c(Ot),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:c(Je),hardBreakEscape:c(bt),hardBreakTrailing:c(bt),htmlFlow:c(et,l),htmlFlowData:F,htmlText:c(et,l),htmlTextData:F,image:c(pt),label:l,link:c(Nt),listItem:c(Rt),listItemValue:b,listOrdered:c(Bt,g),listUnordered:c(Bt),paragraph:c(ne),reference:P,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:c(_t),strong:c(He),thematicBreak:c(Tt)},exit:{atxHeading:p(),atxHeadingSequence:Y,autolink:p(),autolinkEmail:qe,autolinkProtocol:Be,blockQuote:p(),characterEscapeValue:R,characterReferenceMarkerHexadecimal:ke,characterReferenceMarkerNumeric:ke,characterReferenceValue:ve,characterReference:Ae,codeFenced:p(j),codeFencedFence:S,codeFencedFenceInfo:x,codeFencedFenceMeta:C,codeFlowValue:R,codeIndented:p(M),codeText:p(ie),codeTextData:R,data:R,definition:p(),definitionDestinationString:Z,definitionLabelString:A,definitionTitleString:E,emphasis:p(),hardBreakEscape:p(J),hardBreakTrailing:p(J),htmlFlow:p(re),htmlFlowData:R,htmlText:p(le),htmlTextData:R,image:p(q),label:me,labelText:K,lineEnding:W,link:p(xe),listItem:p(),listOrdered:p(),listUnordered:p(),paragraph:p(),referenceString:be,resourceDestinationString:L,resourceTitleString:$,resource:se,setextHeading:p(_),setextHeadingLineSequence:I,setextHeadingText:B,strong:p(),thematicBreak:p()}};Lx(t,(e||{}).mdastExtensions||[]);const n={};return s;function s(ce){let Se={type:"root",children:[]};const Le={stack:[Se],tokenStack:[],config:t,enter:d,exit:m,buffer:l,resume:y,data:n},de=[];let Ne=-1;for(;++Ne<ce.length;)if(ce[Ne][1].type==="listOrdered"||ce[Ne][1].type==="listUnordered")if(ce[Ne][0]==="enter")de.push(Ne);else{const ut=de.pop();Ne=o(ce,ut,Ne)}for(Ne=-1;++Ne<ce.length;){const ut=t[ce[Ne][0]];Ax.call(ut,ce[Ne][1].type)&&ut[ce[Ne][1].type].call(Object.assign({sliceSerialize:ce[Ne][2].sliceSerialize},Le),ce[Ne][1])}if(Le.tokenStack.length>0){const ut=Le.tokenStack[Le.tokenStack.length-1];(ut[1]||Ey).call(Le,void 0,ut[0])}for(Se.position={start:Ii(ce.length>0?ce[0][1].start:{line:1,column:1,offset:0}),end:Ii(ce.length>0?ce[ce.length-2][1].end:{line:1,column:1,offset:0})},Ne=-1;++Ne<t.transforms.length;)Se=t.transforms[Ne](Se)||Se;return Se}function o(ce,Se,Le){let de=Se-1,Ne=-1,ut=!1,Wt,dt,xt,mt;for(;++de<=Le;){const ct=ce[de];switch(ct[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ct[0]==="enter"?Ne++:Ne--,mt=void 0;break}case"lineEndingBlank":{ct[0]==="enter"&&(Wt&&!mt&&!Ne&&!xt&&(xt=de),mt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:mt=void 0}if(!Ne&&ct[0]==="enter"&&ct[1].type==="listItemPrefix"||Ne===-1&&ct[0]==="exit"&&(ct[1].type==="listUnordered"||ct[1].type==="listOrdered")){if(Wt){let Ht=de;for(dt=void 0;Ht--;){const St=ce[Ht];if(St[1].type==="lineEnding"||St[1].type==="lineEndingBlank"){if(St[0]==="exit")continue;dt&&(ce[dt][1].type="lineEndingBlank",ut=!0),St[1].type="lineEnding",dt=Ht}else if(!(St[1].type==="linePrefix"||St[1].type==="blockQuotePrefix"||St[1].type==="blockQuotePrefixWhitespace"||St[1].type==="blockQuoteMarker"||St[1].type==="listItemIndent"))break}xt&&(!dt||xt<dt)&&(Wt._spread=!0),Wt.end=Object.assign({},dt?ce[dt][1].start:ct[1].end),ce.splice(dt||de,0,["exit",Wt,ct[2]]),de++,Le++}if(ct[1].type==="listItemPrefix"){const Ht={type:"listItem",_spread:!1,start:Object.assign({},ct[1].start),end:void 0};Wt=Ht,ce.splice(de,0,["enter",Ht,ct[2]]),de++,Le++,xt=void 0,mt=!0}}}return ce[Se][1]._spread=ut,Le}function c(ce,Se){return Le;function Le(de){d.call(this,ce(de),de),Se&&Se.call(this,de)}}function l(){this.stack.push({type:"fragment",children:[]})}function d(ce,Se,Le){this.stack[this.stack.length-1].children.push(ce),this.stack.push(ce),this.tokenStack.push([Se,Le||void 0]),ce.position={start:Ii(Se.start),end:void 0}}function p(ce){return Se;function Se(Le){ce&&ce.call(this,Le),m.call(this,Le)}}function m(ce,Se){const Le=this.stack.pop(),de=this.tokenStack.pop();if(de)de[0].type!==ce.type&&(Se?Se.call(this,ce,de[0]):(de[1]||Ey).call(this,ce,de[0]));else throw new Error("Cannot close `"+ce.type+"` ("+ho({start:ce.start,end:ce.end})+"): it’s not open");Le.position.end=Ii(ce.end)}function y(){return Tf(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function b(ce){if(this.data.expectingFirstListItemValue){const Se=this.stack[this.stack.length-2];Se.start=Number.parseInt(this.sliceSerialize(ce),10),this.data.expectingFirstListItemValue=void 0}}function x(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.lang=ce}function C(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.meta=ce}function S(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function j(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ce.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function M(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ce.replace(/(\r?\n|\r)$/g,"")}function A(ce){const Se=this.resume(),Le=this.stack[this.stack.length-1];Le.label=Se,Le.identifier=Kr(this.sliceSerialize(ce)).toLowerCase()}function E(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ce}function Z(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ce}function Y(ce){const Se=this.stack[this.stack.length-1];if(!Se.depth){const Le=this.sliceSerialize(ce).length;Se.depth=Le}}function B(){this.data.setextHeadingSlurpLineEnding=!0}function I(ce){const Se=this.stack[this.stack.length-1];Se.depth=this.sliceSerialize(ce).codePointAt(0)===61?1:2}function _(){this.data.setextHeadingSlurpLineEnding=void 0}function F(ce){const Le=this.stack[this.stack.length-1].children;let de=Le[Le.length-1];(!de||de.type!=="text")&&(de=tt(),de.position={start:Ii(ce.start),end:void 0},Le.push(de)),this.stack.push(de)}function R(ce){const Se=this.stack.pop();Se.value+=this.sliceSerialize(ce),Se.position.end=Ii(ce.end)}function W(ce){const Se=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Le=Se.children[Se.children.length-1];Le.position.end=Ii(ce.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Se.type)&&(F.call(this,ce),R.call(this,ce))}function J(){this.data.atHardBreak=!0}function re(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ce}function le(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ce}function ie(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.value=ce}function xe(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=Se,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function q(){const ce=this.stack[this.stack.length-1];if(this.data.inReference){const Se=this.data.referenceType||"shortcut";ce.type+="Reference",ce.referenceType=Se,delete ce.url,delete ce.title}else delete ce.identifier,delete ce.label;this.data.referenceType=void 0}function K(ce){const Se=this.sliceSerialize(ce),Le=this.stack[this.stack.length-2];Le.label=LR(Se),Le.identifier=Kr(Se).toLowerCase()}function me(){const ce=this.stack[this.stack.length-1],Se=this.resume(),Le=this.stack[this.stack.length-1];if(this.data.inReference=!0,Le.type==="link"){const de=ce.children;Le.children=de}else Le.alt=Se}function L(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.url=ce}function $(){const ce=this.resume(),Se=this.stack[this.stack.length-1];Se.title=ce}function se(){this.data.inReference=void 0}function P(){this.data.referenceType="collapsed"}function be(ce){const Se=this.resume(),Le=this.stack[this.stack.length-1];Le.label=Se,Le.identifier=Kr(this.sliceSerialize(ce)).toLowerCase(),this.data.referenceType="full"}function ke(ce){this.data.characterReferenceType=ce.type}function ve(ce){const Se=this.sliceSerialize(ce),Le=this.data.characterReferenceType;let de;Le?(de=kx(Se,Le==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):de=Pf(Se);const Ne=this.stack[this.stack.length-1];Ne.value+=de}function Ae(ce){const Se=this.stack.pop();Se.position.end=Ii(ce.end)}function Be(ce){R.call(this,ce);const Se=this.stack[this.stack.length-1];Se.url=this.sliceSerialize(ce)}function qe(ce){R.call(this,ce);const Se=this.stack[this.stack.length-1];Se.url="mailto:"+this.sliceSerialize(ce)}function nt(){return{type:"blockquote",children:[]}}function wt(){return{type:"code",lang:null,meta:null,value:""}}function ze(){return{type:"inlineCode",value:""}}function Ot(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Je(){return{type:"emphasis",children:[]}}function _t(){return{type:"heading",depth:0,children:[]}}function bt(){return{type:"break"}}function et(){return{type:"html",value:""}}function pt(){return{type:"image",title:null,url:"",alt:null}}function Nt(){return{type:"link",title:null,url:"",children:[]}}function Bt(ce){return{type:"list",ordered:ce.type==="listOrdered",start:null,spread:ce._spread,children:[]}}function Rt(ce){return{type:"listItem",spread:ce._spread,checked:null,children:[]}}function ne(){return{type:"paragraph",children:[]}}function He(){return{type:"strong",children:[]}}function tt(){return{type:"text",value:""}}function Tt(){return{type:"thematicBreak"}}}function Ii(e){return{line:e.line,column:e.column,offset:e.offset}}function Lx(e,t){let n=-1;for(;++n<t.length;){const s=t[n];Array.isArray(s)?Lx(e,s):FR(e,s)}}function FR(e,t){let n;for(n in t)if(Ax.call(t,n))switch(n){case"canContainEols":{const s=t[n];s&&e[n].push(...s);break}case"transforms":{const s=t[n];s&&e[n].push(...s);break}case"enter":case"exit":{const s=t[n];s&&Object.assign(e[n],s);break}}}function Ey(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ho({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ho({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ho({start:t.start,end:t.end})+") is still open")}function OR(e){const t=this;t.parser=n;function n(s){return DR(s,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function BR(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function UR(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
73
- `}]}function zR(e,t){const n=t.value?t.value+`
74
- `:"",s={},o=t.lang?t.lang.split(/\s+/):[];o.length>0&&(s.className=["language-"+o[0]]);let c={type:"element",tagName:"code",properties:s,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function WR(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function HR(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function $R(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",s=String(t.identifier).toUpperCase(),o=ha(s.toLowerCase()),c=e.footnoteOrder.indexOf(s);let l,d=e.footnoteCounts.get(s);d===void 0?(d=0,e.footnoteOrder.push(s),l=e.footnoteOrder.length):l=c+1,d+=1,e.footnoteCounts.set(s,d);const p={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+o,id:n+"fnref-"+o+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,p);const m={type:"element",tagName:"sup",properties:{},children:[p]};return e.patch(t,m),e.applyData(t,m)}function VR(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qR(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function Ix(e,t){const n=t.referenceType;let s="]";if(n==="collapsed"?s+="[]":n==="full"&&(s+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+s}];const o=e.all(t),c=o[0];c&&c.type==="text"?c.value="["+c.value:o.unshift({type:"text",value:"["});const l=o[o.length-1];return l&&l.type==="text"?l.value+=s:o.push({type:"text",value:s}),o}function GR(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Ix(e,t);const o={src:ha(s.url||""),alt:t.alt};s.title!==null&&s.title!==void 0&&(o.title=s.title);const c={type:"element",tagName:"img",properties:o,children:[]};return e.patch(t,c),e.applyData(t,c)}function KR(e,t){const n={src:ha(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,s),e.applyData(t,s)}function QR(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const s={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,s),e.applyData(t,s)}function YR(e,t){const n=String(t.identifier).toUpperCase(),s=e.definitionById.get(n);if(!s)return Ix(e,t);const o={href:ha(s.url||"")};s.title!==null&&s.title!==void 0&&(o.title=s.title);const c={type:"element",tagName:"a",properties:o,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function XR(e,t){const n={href:ha(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const s={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function JR(e,t,n){const s=e.all(t),o=n?ZR(n):Dx(t),c={},l=[];if(typeof t.checked=="boolean"){const y=s[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},s.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let d=-1;for(;++d<s.length;){const y=s[d];(o||d!==0||y.type!=="element"||y.tagName!=="p")&&l.push({type:"text",value:`
75
- `}),y.type==="element"&&y.tagName==="p"&&!o?l.push(...y.children):l.push(y)}const p=s[s.length-1];p&&(o||p.type!=="element"||p.tagName!=="p")&&l.push({type:"text",value:`
76
- `});const m={type:"element",tagName:"li",properties:c,children:l};return e.patch(t,m),e.applyData(t,m)}function ZR(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let s=-1;for(;!t&&++s<n.length;)t=Dx(n[s])}return t}function Dx(e){const t=e.spread;return t??e.children.length>1}function eM(e,t){const n={},s=e.all(t);let o=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++o<s.length;){const l=s[o];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const c={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(s,!0)};return e.patch(t,c),e.applyData(t,c)}function tM(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nM(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function rM(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iM(e,t){const n=e.all(t),s=n.shift(),o=[];if(s){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([s],!0)};e.patch(t.children[0],l),o.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},d=Sf(t.children[1]),p=px(t.children[t.children.length-1]);d&&p&&(l.position={start:d,end:p}),o.push(l)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(o,!0)};return e.patch(t,c),e.applyData(t,c)}function sM(e,t,n){const s=n?n.children:void 0,c=(s?s.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,d=l?l.length:t.children.length;let p=-1;const m=[];for(;++p<d;){const g=t.children[p],b={},x=l?l[p]:void 0;x&&(b.align=x);let C={type:"element",tagName:c,properties:b,children:[]};g&&(C.children=e.all(g),e.patch(g,C),C=e.applyData(g,C)),m.push(C)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(m,!0)};return e.patch(t,y),e.applyData(t,y)}function aM(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Ry=9,My=32;function oM(e){const t=String(e),n=/\r?\n|\r/g;let s=n.exec(t),o=0;const c=[];for(;s;)c.push(Ay(t.slice(o,s.index),o>0,!0),s[0]),o=s.index+s[0].length,s=n.exec(t);return c.push(Ay(t.slice(o),o>0,!1)),c.join("")}function Ay(e,t,n){let s=0,o=e.length;if(t){let c=e.codePointAt(s);for(;c===Ry||c===My;)s++,c=e.codePointAt(s)}if(n){let c=e.codePointAt(o-1);for(;c===Ry||c===My;)o--,c=e.codePointAt(o-1)}return o>s?e.slice(s,o):""}function lM(e,t){const n={type:"text",value:oM(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function cM(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const uM={blockquote:BR,break:UR,code:zR,delete:WR,emphasis:HR,footnoteReference:$R,heading:VR,html:qR,imageReference:GR,image:KR,inlineCode:QR,linkReference:YR,link:XR,listItem:JR,list:eM,paragraph:tM,root:nM,strong:rM,table:iM,tableCell:aM,tableRow:sM,text:lM,thematicBreak:cM,toml:Hl,yaml:Hl,definition:Hl,footnoteDefinition:Hl};function Hl(){}const _x=-1,Fc=0,po=1,Sc=2,Rf=3,Mf=4,Af=5,Lf=6,Fx=7,Ox=8,Ly=typeof self=="object"?self:globalThis,dM=(e,t)=>{const n=(o,c)=>(e.set(c,o),o),s=o=>{if(e.has(o))return e.get(o);const[c,l]=t[o];switch(c){case Fc:case _x:return n(l,o);case po:{const d=n([],o);for(const p of l)d.push(s(p));return d}case Sc:{const d=n({},o);for(const[p,m]of l)d[s(p)]=s(m);return d}case Rf:return n(new Date(l),o);case Mf:{const{source:d,flags:p}=l;return n(new RegExp(d,p),o)}case Af:{const d=n(new Map,o);for(const[p,m]of l)d.set(s(p),s(m));return d}case Lf:{const d=n(new Set,o);for(const p of l)d.add(s(p));return d}case Fx:{const{name:d,message:p}=l;return n(new Ly[d](p),o)}case Ox:return n(BigInt(l),o);case"BigInt":return n(Object(BigInt(l)),o);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:d}=new Uint8Array(l);return n(new DataView(d),l)}}return n(new Ly[c](l),o)};return s},Iy=e=>dM(new Map,e)(0),Js="",{toString:hM}={},{keys:fM}=Object,no=e=>{const t=typeof e;if(t!=="object"||!e)return[Fc,t];const n=hM.call(e).slice(8,-1);switch(n){case"Array":return[po,Js];case"Object":return[Sc,Js];case"Date":return[Rf,Js];case"RegExp":return[Mf,Js];case"Map":return[Af,Js];case"Set":return[Lf,Js];case"DataView":return[po,n]}return n.includes("Array")?[po,n]:n.includes("Error")?[Fx,n]:[Sc,n]},$l=([e,t])=>e===Fc&&(t==="function"||t==="symbol"),pM=(e,t,n,s)=>{const o=(l,d)=>{const p=s.push(l)-1;return n.set(d,p),p},c=l=>{if(n.has(l))return n.get(l);let[d,p]=no(l);switch(d){case Fc:{let y=l;switch(p){case"bigint":d=Ox,y=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+p);y=null;break;case"undefined":return o([_x],l)}return o([d,y],l)}case po:{if(p){let b=l;return p==="DataView"?b=new Uint8Array(l.buffer):p==="ArrayBuffer"&&(b=new Uint8Array(l)),o([p,[...b]],l)}const y=[],g=o([d,y],l);for(const b of l)y.push(c(b));return g}case Sc:{if(p)switch(p){case"BigInt":return o([p,l.toString()],l);case"Boolean":case"Number":case"String":return o([p,l.valueOf()],l)}if(t&&"toJSON"in l)return c(l.toJSON());const y=[],g=o([d,y],l);for(const b of fM(l))(e||!$l(no(l[b])))&&y.push([c(b),c(l[b])]);return g}case Rf:return o([d,l.toISOString()],l);case Mf:{const{source:y,flags:g}=l;return o([d,{source:y,flags:g}],l)}case Af:{const y=[],g=o([d,y],l);for(const[b,x]of l)(e||!($l(no(b))||$l(no(x))))&&y.push([c(b),c(x)]);return g}case Lf:{const y=[],g=o([d,y],l);for(const b of l)(e||!$l(no(b)))&&y.push(c(b));return g}}const{message:m}=l;return o([d,{name:p,message:m}],l)};return c},Dy=(e,{json:t,lossy:n}={})=>{const s=[];return pM(!(t||n),!!t,new Map,s)(e),s},Cc=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Iy(Dy(e,t)):structuredClone(e):(e,t)=>Iy(Dy(e,t));function mM(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function gM(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function yM(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||mM,s=e.options.footnoteBackLabel||gM,o=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let p=-1;for(;++p<e.footnoteOrder.length;){const m=e.footnoteById.get(e.footnoteOrder[p]);if(!m)continue;const y=e.all(m),g=String(m.identifier).toUpperCase(),b=ha(g.toLowerCase());let x=0;const C=[],S=e.footnoteCounts.get(g);for(;S!==void 0&&++x<=S;){C.length>0&&C.push({type:"text",value:" "});let A=typeof n=="string"?n:n(p,x);typeof A=="string"&&(A={type:"text",value:A}),C.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+b+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof s=="string"?s:s(p,x),className:["data-footnote-backref"]},children:Array.isArray(A)?A:[A]})}const j=y[y.length-1];if(j&&j.type==="element"&&j.tagName==="p"){const A=j.children[j.children.length-1];A&&A.type==="text"?A.value+=" ":j.children.push({type:"text",value:" "}),j.children.push(...C)}else y.push(...C);const M={type:"element",tagName:"li",properties:{id:t+"fn-"+b},children:e.wrap(y,!0)};e.patch(m,M),d.push(M)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Cc(l),id:"footnote-label"},children:[{type:"text",value:o}]},{type:"text",value:`
77
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
78
- `}]}}const Oc=(function(e){if(e==null)return xM;if(typeof e=="function")return Bc(e);if(typeof e=="object")return Array.isArray(e)?vM(e):wM(e);if(typeof e=="string")return bM(e);throw new Error("Expected function, string, or object as test")});function vM(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Oc(e[n]);return Bc(s);function s(...o){let c=-1;for(;++c<t.length;)if(t[c].apply(this,o))return!0;return!1}}function wM(e){const t=e;return Bc(n);function n(s){const o=s;let c;for(c in e)if(o[c]!==t[c])return!1;return!0}}function bM(e){return Bc(t);function t(n){return n&&n.type===e}}function Bc(e){return t;function t(n,s,o){return!!(kM(n)&&e.call(this,n,typeof s=="number"?s:void 0,o||void 0))}}function xM(){return!0}function kM(e){return e!==null&&typeof e=="object"&&"type"in e}const Bx=[],SM=!0,Bh=!1,CM="skip";function Ux(e,t,n,s){let o;typeof t=="function"&&typeof n!="function"?(s=n,n=t):o=t;const c=Oc(o),l=s?-1:1;d(e,void 0,[])();function d(p,m,y){const g=p&&typeof p=="object"?p:{};if(typeof g.type=="string"){const x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(b,"name",{value:"node ("+(p.type+(x?"<"+x+">":""))+")"})}return b;function b(){let x=Bx,C,S,j;if((!t||c(p,m,y[y.length-1]||void 0))&&(x=jM(n(p,y)),x[0]===Bh))return x;if("children"in p&&p.children){const M=p;if(M.children&&x[0]!==CM)for(S=(s?M.children.length:-1)+l,j=y.concat(M);S>-1&&S<M.children.length;){const A=M.children[S];if(C=d(A,S,j)(),C[0]===Bh)return C;S=typeof C[1]=="number"?C[1]:S+l}}return x}}}function jM(e){return Array.isArray(e)?e:typeof e=="number"?[SM,e]:e==null?Bx:[e]}function If(e,t,n,s){let o,c,l;typeof t=="function"&&typeof n!="function"?(c=void 0,l=t,o=n):(c=t,l=n,o=s),Ux(e,c,d,o);function d(p,m){const y=m[m.length-1],g=y?y.children.indexOf(p):void 0;return l(p,g,y)}}const Uh={}.hasOwnProperty,NM={};function TM(e,t){const n=t||NM,s=new Map,o=new Map,c=new Map,l={...uM,...n.handlers},d={all:m,applyData:EM,definitionById:s,footnoteById:o,footnoteCounts:c,footnoteOrder:[],handlers:l,one:p,options:n,patch:PM,wrap:MM};return If(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?s:o,b=String(y.identifier).toUpperCase();g.has(b)||g.set(b,y)}}),d;function p(y,g){const b=y.type,x=d.handlers[b];if(Uh.call(d.handlers,b)&&x)return x(d,y,g);if(d.options.passThrough&&d.options.passThrough.includes(b)){if("children"in y){const{children:S,...j}=y,M=Cc(j);return M.children=d.all(y),M}return Cc(y)}return(d.options.unknownHandler||RM)(d,y,g)}function m(y){const g=[];if("children"in y){const b=y.children;let x=-1;for(;++x<b.length;){const C=d.one(b[x],y);if(C){if(x&&b[x-1].type==="break"&&(!Array.isArray(C)&&C.type==="text"&&(C.value=_y(C.value)),!Array.isArray(C)&&C.type==="element")){const S=C.children[0];S&&S.type==="text"&&(S.value=_y(S.value))}Array.isArray(C)?g.push(...C):g.push(C)}}}return g}}function PM(e,t){e.position&&(t.position=gP(e))}function EM(e,t){let n=t;if(e&&e.data){const s=e.data.hName,o=e.data.hChildren,c=e.data.hProperties;if(typeof s=="string")if(n.type==="element")n.tagName=s;else{const l="children"in n?n.children:[n];n={type:"element",tagName:s,properties:{},children:l}}n.type==="element"&&c&&Object.assign(n.properties,Cc(c)),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function RM(e,t){const n=t.data||{},s="value"in t&&!(Uh.call(n,"hProperties")||Uh.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function MM(e,t){const n=[];let s=-1;for(t&&n.push({type:"text",value:`
79
- `});++s<e.length;)s&&n.push({type:"text",value:`
80
- `}),n.push(e[s]);return t&&e.length>0&&n.push({type:"text",value:`
81
- `}),n}function _y(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Fy(e,t){const n=TM(e,t),s=n.one(e,void 0),o=yM(n),c=Array.isArray(s)?{type:"root",children:s}:s||{type:"root",children:[]};return o&&c.children.push({type:"text",value:`
82
- `},o),c}function AM(e,t){return e&&"run"in e?async function(n,s){const o=Fy(n,{file:s,...t});await e.run(o,s)}:function(n,s){return Fy(n,{file:s,...e||t})}}function Oy(e){if(e)throw e}var Fd,By;function LM(){if(By)return Fd;By=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,o=function(m){return typeof Array.isArray=="function"?Array.isArray(m):t.call(m)==="[object Array]"},c=function(m){if(!m||t.call(m)!=="[object Object]")return!1;var y=e.call(m,"constructor"),g=m.constructor&&m.constructor.prototype&&e.call(m.constructor.prototype,"isPrototypeOf");if(m.constructor&&!y&&!g)return!1;var b;for(b in m);return typeof b>"u"||e.call(m,b)},l=function(m,y){n&&y.name==="__proto__"?n(m,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):m[y.name]=y.newValue},d=function(m,y){if(y==="__proto__")if(e.call(m,y)){if(s)return s(m,y).value}else return;return m[y]};return Fd=function p(){var m,y,g,b,x,C,S=arguments[0],j=1,M=arguments.length,A=!1;for(typeof S=="boolean"&&(A=S,S=arguments[1]||{},j=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});j<M;++j)if(m=arguments[j],m!=null)for(y in m)g=d(S,y),b=d(m,y),S!==b&&(A&&b&&(c(b)||(x=o(b)))?(x?(x=!1,C=g&&o(g)?g:[]):C=g&&c(g)?g:{},l(S,{name:y,newValue:p(A,C,b)})):typeof b<"u"&&l(S,{name:y,newValue:b}));return S},Fd}var IM=LM();const Od=To(IM);function zh(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function DM(){const e=[],t={run:n,use:s};return t;function n(...o){let c=-1;const l=o.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);d(null,...o);function d(p,...m){const y=e[++c];let g=-1;if(p){l(p);return}for(;++g<o.length;)(m[g]===null||m[g]===void 0)&&(m[g]=o[g]);o=m,y?_M(y,d)(...m):l(null,...m)}}function s(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function _M(e,t){let n;return s;function s(...l){const d=e.length>l.length;let p;d&&l.push(o);try{p=e.apply(this,l)}catch(m){const y=m;if(d&&n)throw y;return o(y)}d||(p&&p.then&&typeof p.then=="function"?p.then(c,o):p instanceof Error?o(p):c(p))}function o(l,...d){n||(n=!0,t(l,...d))}function c(l){o(null,l)}}const ti={basename:FM,dirname:OM,extname:BM,join:UM,sep:"/"};function FM(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Do(e);let n=0,s=-1,o=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(c){n=o+1;break}}else s<0&&(c=!0,s=o+1);return s<0?"":e.slice(n,s)}if(t===e)return"";let l=-1,d=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(c){n=o+1;break}}else l<0&&(c=!0,l=o+1),d>-1&&(e.codePointAt(o)===t.codePointAt(d--)?d<0&&(s=o):(d=-1,s=l));return n===s?s=l:s<0&&(s=e.length),e.slice(n,s)}function OM(e){if(Do(e),e.length===0)return".";let t=-1,n=e.length,s;for(;--n;)if(e.codePointAt(n)===47){if(s){t=n;break}}else s||(s=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function BM(e){Do(e);let t=e.length,n=-1,s=0,o=-1,c=0,l;for(;t--;){const d=e.codePointAt(t);if(d===47){if(l){s=t+1;break}continue}n<0&&(l=!0,n=t+1),d===46?o<0?o=t:c!==1&&(c=1):o>-1&&(c=-1)}return o<0||n<0||c===0||c===1&&o===n-1&&o===s+1?"":e.slice(o,n)}function UM(...e){let t=-1,n;for(;++t<e.length;)Do(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":zM(n)}function zM(e){Do(e);const t=e.codePointAt(0)===47;let n=WM(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function WM(e,t){let n="",s=0,o=-1,c=0,l=-1,d,p;for(;++l<=e.length;){if(l<e.length)d=e.codePointAt(l);else{if(d===47)break;d=47}if(d===47){if(!(o===l-1||c===1))if(o!==l-1&&c===2){if(n.length<2||s!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(p=n.lastIndexOf("/"),p!==n.length-1){p<0?(n="",s=0):(n=n.slice(0,p),s=n.length-1-n.lastIndexOf("/")),o=l,c=0;continue}}else if(n.length>0){n="",s=0,o=l,c=0;continue}}t&&(n=n.length>0?n+"/..":"..",s=2)}else n.length>0?n+="/"+e.slice(o+1,l):n=e.slice(o+1,l),s=l-o-1;o=l,c=0}else d===46&&c>-1?c++:c=-1}return n}function Do(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const HM={cwd:$M};function $M(){return"/"}function Wh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function VM(e){if(typeof e=="string")e=new URL(e);else if(!Wh(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return qM(e)}function qM(e){if(e.hostname!==""){const s=new TypeError('File URL host must be "localhost" or empty on darwin');throw s.code="ERR_INVALID_FILE_URL_HOST",s}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const s=t.codePointAt(n+2);if(s===70||s===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Bd=["history","path","basename","stem","extname","dirname"];class zx{constructor(t){let n;t?Wh(t)?n={path:t}:typeof t=="string"||GM(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":HM.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let s=-1;for(;++s<Bd.length;){const c=Bd[s];c in n&&n[c]!==void 0&&n[c]!==null&&(this[c]=c==="history"?[...n[c]]:n[c])}let o;for(o in n)Bd.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?ti.basename(this.path):void 0}set basename(t){zd(t,"basename"),Ud(t,"basename"),this.path=ti.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ti.dirname(this.path):void 0}set dirname(t){Uy(this.basename,"dirname"),this.path=ti.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ti.extname(this.path):void 0}set extname(t){if(Ud(t,"extname"),Uy(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=ti.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Wh(t)&&(t=VM(t)),zd(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ti.basename(this.path,this.extname):void 0}set stem(t){zd(t,"stem"),Ud(t,"stem"),this.path=ti.join(this.dirname||"",t+(this.extname||""))}fail(t,n,s){const o=this.message(t,n,s);throw o.fatal=!0,o}info(t,n,s){const o=this.message(t,n,s);return o.fatal=void 0,o}message(t,n,s){const o=new Bn(t,n,s);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Ud(e,t){if(e&&e.includes(ti.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ti.sep+"`")}function zd(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Uy(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function GM(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const KM=(function(e){const s=this.constructor.prototype,o=s[e],c=function(){return o.apply(c,arguments)};return Object.setPrototypeOf(c,s),c}),QM={}.hasOwnProperty;class Df extends KM{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=DM()}copy(){const t=new Df;let n=-1;for(;++n<this.attachers.length;){const s=this.attachers[n];t.use(...s)}return t.data(Od(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?($d("data",this.frozen),this.namespace[t]=n,this):QM.call(this.namespace,t)&&this.namespace[t]||void 0:t?($d("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...s]=this.attachers[this.freezeIndex];if(s[0]===!1)continue;s[0]===!0&&(s[0]=void 0);const o=n.call(t,...s);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Vl(t),s=this.parser||this.Parser;return Wd("parse",s),s(String(n),n)}process(t,n){const s=this;return this.freeze(),Wd("process",this.parser||this.Parser),Hd("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(c,l){const d=Vl(t),p=s.parse(d);s.run(p,d,function(y,g,b){if(y||!g||!b)return m(y);const x=g,C=s.stringify(x,b);JM(C)?b.value=C:b.result=C,m(y,b)});function m(y,g){y||!g?l(y):c?c(g):n(void 0,g)}}}processSync(t){let n=!1,s;return this.freeze(),Wd("processSync",this.parser||this.Parser),Hd("processSync",this.compiler||this.Compiler),this.process(t,o),Wy("processSync","process",n),s;function o(c,l){n=!0,Oy(c),s=l}}run(t,n,s){zy(t),this.freeze();const o=this.transformers;return!s&&typeof n=="function"&&(s=n,n=void 0),s?c(void 0,s):new Promise(c);function c(l,d){const p=Vl(n);o.run(t,p,m);function m(y,g,b){const x=g||t;y?d(y):l?l(x):s(void 0,x,b)}}}runSync(t,n){let s=!1,o;return this.run(t,n,c),Wy("runSync","run",s),o;function c(l,d){Oy(l),o=d,s=!0}}stringify(t,n){this.freeze();const s=Vl(n),o=this.compiler||this.Compiler;return Hd("stringify",o),zy(t),o(t,s)}use(t,...n){const s=this.attachers,o=this.namespace;if($d("use",this.frozen),t!=null)if(typeof t=="function")p(t,n);else if(typeof t=="object")Array.isArray(t)?d(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function c(m){if(typeof m=="function")p(m,[]);else if(typeof m=="object")if(Array.isArray(m)){const[y,...g]=m;p(y,g)}else l(m);else throw new TypeError("Expected usable value, not `"+m+"`")}function l(m){if(!("plugins"in m)&&!("settings"in m))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(m.plugins),m.settings&&(o.settings=Od(!0,o.settings,m.settings))}function d(m){let y=-1;if(m!=null)if(Array.isArray(m))for(;++y<m.length;){const g=m[y];c(g)}else throw new TypeError("Expected a list of plugins, not `"+m+"`")}function p(m,y){let g=-1,b=-1;for(;++g<s.length;)if(s[g][0]===m){b=g;break}if(b===-1)s.push([m,...y]);else if(y.length>0){let[x,...C]=y;const S=s[b][1];zh(S)&&zh(x)&&(x=Od(!0,S,x)),s[b]=[m,x,...C]}}}}const YM=new Df().freeze();function Wd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Hd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function $d(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function zy(e){if(!zh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Wy(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Vl(e){return XM(e)?e:new zx(e)}function XM(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function JM(e){return typeof e=="string"||ZM(e)}function ZM(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const eA="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Hy=[],$y={allowDangerousHtml:!0},tA=/^(https?|ircs?|mailto|xmpp)$/i,nA=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function _f(e){const t=rA(e),n=iA(e);return sA(t.runSync(t.parse(n),n),e)}function rA(e){const t=e.rehypePlugins||Hy,n=e.remarkPlugins||Hy,s=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...$y}:$y;return YM().use(OR).use(n).use(AM,s).use(t)}function iA(e){const t=e.children||"",n=new zx;return typeof t=="string"&&(n.value=t),n}function sA(e,t){const n=t.allowedElements,s=t.allowElement,o=t.components,c=t.disallowedElements,l=t.skipHtml,d=t.unwrapDisallowed,p=t.urlTransform||aA;for(const y of nA)Object.hasOwn(t,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+eA+y.id,void 0);return If(e,m),xP(e,{Fragment:i.Fragment,components:o,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function m(y,g,b){if(y.type==="raw"&&b&&typeof g=="number")return l?b.children.splice(g,1):b.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let x;for(x in Id)if(Object.hasOwn(Id,x)&&Object.hasOwn(y.properties,x)){const C=y.properties[x],S=Id[x];(S===null||S.includes(y.tagName))&&(y.properties[x]=p(String(C||""),x,y))}}if(y.type==="element"){let x=n?!n.includes(y.tagName):c?c.includes(y.tagName):!1;if(!x&&s&&typeof g=="number"&&(x=!s(y,g,b)),x&&b&&typeof g=="number")return d&&y.children?b.children.splice(g,1,...y.children):b.children.splice(g,1),g}}}function aA(e){const t=e.indexOf(":"),n=e.indexOf("?"),s=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||s!==-1&&t>s||tA.test(e.slice(0,t))?e:""}function Vy(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,o=n.indexOf(t);for(;o!==-1;)s++,o=n.indexOf(t,o+t.length);return s}function oA(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function lA(e,t,n){const o=Oc((n||{}).ignore||[]),c=cA(t);let l=-1;for(;++l<c.length;)Ux(e,"text",d);function d(m,y){let g=-1,b;for(;++g<y.length;){const x=y[g],C=b?b.children:void 0;if(o(x,C?C.indexOf(x):void 0,b))return;b=x}if(b)return p(m,y)}function p(m,y){const g=y[y.length-1],b=c[l][0],x=c[l][1];let C=0;const j=g.children.indexOf(m);let M=!1,A=[];b.lastIndex=0;let E=b.exec(m.value);for(;E;){const Z=E.index,Y={index:E.index,input:E.input,stack:[...y,m]};let B=x(...E,Y);if(typeof B=="string"&&(B=B.length>0?{type:"text",value:B}:void 0),B===!1?b.lastIndex=Z+1:(C!==Z&&A.push({type:"text",value:m.value.slice(C,Z)}),Array.isArray(B)?A.push(...B):B&&A.push(B),C=Z+E[0].length,M=!0),!b.global)break;E=b.exec(m.value)}return M?(C<m.value.length&&A.push({type:"text",value:m.value.slice(C)}),g.children.splice(j,1,...A)):A=[m],j+A.length}}function cA(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let s=-1;for(;++s<n.length;){const o=n[s];t.push([uA(o[0]),dA(o[1])])}return t}function uA(e){return typeof e=="string"?new RegExp(oA(e),"g"):e}function dA(e){return typeof e=="function"?e:function(){return e}}const Vd="phrasing",qd=["autolink","link","image","label"];function hA(){return{transforms:[wA],enter:{literalAutolink:pA,literalAutolinkEmail:Gd,literalAutolinkHttp:Gd,literalAutolinkWww:Gd},exit:{literalAutolink:vA,literalAutolinkEmail:yA,literalAutolinkHttp:mA,literalAutolinkWww:gA}}}function fA(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Vd,notInConstruct:qd},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Vd,notInConstruct:qd},{character:":",before:"[ps]",after:"\\/",inConstruct:Vd,notInConstruct:qd}]}}function pA(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Gd(e){this.config.enter.autolinkProtocol.call(this,e)}function mA(e){this.config.exit.autolinkProtocol.call(this,e)}function gA(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function yA(e){this.config.exit.autolinkEmail.call(this,e)}function vA(e){this.exit(e)}function wA(e){lA(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,bA],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),xA]],{ignore:["link","linkReference"]})}function bA(e,t,n,s,o){let c="";if(!Wx(o)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!kA(n)))return!1;const l=SA(n+s);if(!l[0])return!1;const d={type:"link",title:null,url:c+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[d,{type:"text",value:l[1]}]:d}function xA(e,t,n,s){return!Wx(s,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function kA(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function SA(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],s=n.indexOf(")");const o=Vy(e,"(");let c=Vy(e,")");for(;s!==-1&&o>c;)e+=n.slice(0,s+1),n=n.slice(s+1),s=n.indexOf(")"),c++;return[e,n]}function Wx(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ws(n)||Dc(n))&&(!t||n!==47)}Hx.peek=AA;function CA(){this.buffer()}function jA(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function NA(){this.buffer()}function TA(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function PA(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Kr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function EA(e){this.exit(e)}function RA(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Kr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function MA(e){this.exit(e)}function AA(){return"["}function Hx(e,t,n,s){const o=n.createTracker(s);let c=o.move("[^");const l=n.enter("footnoteReference"),d=n.enter("reference");return c+=o.move(n.safe(n.associationId(e),{after:"]",before:c})),d(),l(),c+=o.move("]"),c}function LA(){return{enter:{gfmFootnoteCallString:CA,gfmFootnoteCall:jA,gfmFootnoteDefinitionLabelString:NA,gfmFootnoteDefinition:TA},exit:{gfmFootnoteCallString:PA,gfmFootnoteCall:EA,gfmFootnoteDefinitionLabelString:RA,gfmFootnoteDefinition:MA}}}function IA(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Hx},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(s,o,c,l){const d=c.createTracker(l);let p=d.move("[^");const m=c.enter("footnoteDefinition"),y=c.enter("label");return p+=d.move(c.safe(c.associationId(s),{before:p,after:"]"})),y(),p+=d.move("]:"),s.children&&s.children.length>0&&(d.shift(4),p+=d.move((t?`
83
- `:" ")+c.indentLines(c.containerFlow(s,d.current()),t?$x:DA))),m(),p}}function DA(e,t,n){return t===0?e:$x(e,t,n)}function $x(e,t,n){return(n?"":" ")+e}const _A=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Vx.peek=zA;function FA(){return{canContainEols:["delete"],enter:{strikethrough:BA},exit:{strikethrough:UA}}}function OA(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:_A}],handlers:{delete:Vx}}}function BA(e){this.enter({type:"delete",children:[]},e)}function UA(e){this.exit(e)}function Vx(e,t,n,s){const o=n.createTracker(s),c=n.enter("strikethrough");let l=o.move("~~");return l+=n.containerPhrasing(e,{...o.current(),before:l,after:"~"}),l+=o.move("~~"),c(),l}function zA(){return"~"}function WA(e){return e.length}function HA(e,t){const n=t||{},s=(n.align||[]).concat(),o=n.stringLength||WA,c=[],l=[],d=[],p=[];let m=0,y=-1;for(;++y<e.length;){const S=[],j=[];let M=-1;for(e[y].length>m&&(m=e[y].length);++M<e[y].length;){const A=$A(e[y][M]);if(n.alignDelimiters!==!1){const E=o(A);j[M]=E,(p[M]===void 0||E>p[M])&&(p[M]=E)}S.push(A)}l[y]=S,d[y]=j}let g=-1;if(typeof s=="object"&&"length"in s)for(;++g<m;)c[g]=qy(s[g]);else{const S=qy(s);for(;++g<m;)c[g]=S}g=-1;const b=[],x=[];for(;++g<m;){const S=c[g];let j="",M="";S===99?(j=":",M=":"):S===108?j=":":S===114&&(M=":");let A=n.alignDelimiters===!1?1:Math.max(1,p[g]-j.length-M.length);const E=j+"-".repeat(A)+M;n.alignDelimiters!==!1&&(A=j.length+A+M.length,A>p[g]&&(p[g]=A),x[g]=A),b[g]=E}l.splice(1,0,b),d.splice(1,0,x),y=-1;const C=[];for(;++y<l.length;){const S=l[y],j=d[y];g=-1;const M=[];for(;++g<m;){const A=S[g]||"";let E="",Z="";if(n.alignDelimiters!==!1){const Y=p[g]-(j[g]||0),B=c[g];B===114?E=" ".repeat(Y):B===99?Y%2?(E=" ".repeat(Y/2+.5),Z=" ".repeat(Y/2-.5)):(E=" ".repeat(Y/2),Z=E):Z=" ".repeat(Y)}n.delimiterStart!==!1&&!g&&M.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&A==="")&&(n.delimiterStart!==!1||g)&&M.push(" "),n.alignDelimiters!==!1&&M.push(E),M.push(A),n.alignDelimiters!==!1&&M.push(Z),n.padding!==!1&&M.push(" "),(n.delimiterEnd!==!1||g!==m-1)&&M.push("|")}C.push(n.delimiterEnd===!1?M.join("").replace(/ +$/,""):M.join(""))}return C.join(`
84
- `)}function $A(e){return e==null?"":String(e)}function qy(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function VA(e,t,n,s){const o=n.enter("blockquote"),c=n.createTracker(s);c.move("> "),c.shift(2);const l=n.indentLines(n.containerFlow(e,c.current()),qA);return o(),l}function qA(e,t,n){return">"+(n?"":" ")+e}function GA(e,t){return Gy(e,t.inConstruct,!0)&&!Gy(e,t.notInConstruct,!1)}function Gy(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let s=-1;for(;++s<t.length;)if(e.includes(t[s]))return!0;return!1}function Ky(e,t,n,s){let o=-1;for(;++o<n.unsafe.length;)if(n.unsafe[o].character===`
85
- `&&GA(n.stack,n.unsafe[o]))return/[ \t]/.test(s.before)?"":" ";return`\\
86
- `}function KA(e,t){const n=String(e);let s=n.indexOf(t),o=s,c=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;s!==-1;)s===o?++c>l&&(l=c):c=1,o=s+t.length,s=n.indexOf(t,o);return l}function QA(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function YA(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function XA(e,t,n,s){const o=YA(n),c=e.value||"",l=o==="`"?"GraveAccent":"Tilde";if(QA(e,n)){const g=n.enter("codeIndented"),b=n.indentLines(c,JA);return g(),b}const d=n.createTracker(s),p=o.repeat(Math.max(KA(c,o)+1,3)),m=n.enter("codeFenced");let y=d.move(p);if(e.lang){const g=n.enter(`codeFencedLang${l}`);y+=d.move(n.safe(e.lang,{before:y,after:" ",encode:["`"],...d.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${l}`);y+=d.move(" "),y+=d.move(n.safe(e.meta,{before:y,after:`
87
- `,encode:["`"],...d.current()})),g()}return y+=d.move(`
88
- `),c&&(y+=d.move(c+`
89
- `)),y+=d.move(p),m(),y}function JA(e,t,n){return(n?"":" ")+e}function Ff(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function ZA(e,t,n,s){const o=Ff(n),c=o==='"'?"Quote":"Apostrophe",l=n.enter("definition");let d=n.enter("label");const p=n.createTracker(s);let m=p.move("[");return m+=p.move(n.safe(n.associationId(e),{before:m,after:"]",...p.current()})),m+=p.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),m+=p.move("<"),m+=p.move(n.safe(e.url,{before:m,after:">",...p.current()})),m+=p.move(">")):(d=n.enter("destinationRaw"),m+=p.move(n.safe(e.url,{before:m,after:e.title?" ":`
90
- `,...p.current()}))),d(),e.title&&(d=n.enter(`title${c}`),m+=p.move(" "+o),m+=p.move(n.safe(e.title,{before:m,after:o,...p.current()})),m+=p.move(o),d()),l(),m}function eL(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function So(e){return"&#x"+e.toString(16).toUpperCase()+";"}function jc(e,t,n){const s=ca(e),o=ca(t);return s===void 0?o===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:s===1?o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:o===void 0?{inside:!1,outside:!1}:o===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}qx.peek=tL;function qx(e,t,n,s){const o=eL(n),c=n.enter("emphasis"),l=n.createTracker(s),d=l.move(o);let p=l.move(n.containerPhrasing(e,{after:o,before:d,...l.current()}));const m=p.charCodeAt(0),y=jc(s.before.charCodeAt(s.before.length-1),m,o);y.inside&&(p=So(m)+p.slice(1));const g=p.charCodeAt(p.length-1),b=jc(s.after.charCodeAt(0),g,o);b.inside&&(p=p.slice(0,-1)+So(g));const x=l.move(o);return c(),n.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},d+p+x}function tL(e,t,n){return n.options.emphasis||"*"}function nL(e,t){let n=!1;return If(e,function(s){if("value"in s&&/\r?\n|\r/.test(s.value)||s.type==="break")return n=!0,Bh}),!!((!e.depth||e.depth<3)&&Tf(e)&&(t.options.setext||n))}function rL(e,t,n,s){const o=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(s);if(nL(e,n)){const y=n.enter("headingSetext"),g=n.enter("phrasing"),b=n.containerPhrasing(e,{...c.current(),before:`
91
- `,after:`
92
- `});return g(),y(),b+`
93
- `+(o===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
94
- `))+1))}const l="#".repeat(o),d=n.enter("headingAtx"),p=n.enter("phrasing");c.move(l+" ");let m=n.containerPhrasing(e,{before:"# ",after:`
95
- `,...c.current()});return/^[\t ]/.test(m)&&(m=So(m.charCodeAt(0))+m.slice(1)),m=m?l+" "+m:l,n.options.closeAtx&&(m+=" "+l),p(),d(),m}Gx.peek=iL;function Gx(e){return e.value||""}function iL(){return"<"}Kx.peek=sL;function Kx(e,t,n,s){const o=Ff(n),c=o==='"'?"Quote":"Apostrophe",l=n.enter("image");let d=n.enter("label");const p=n.createTracker(s);let m=p.move("![");return m+=p.move(n.safe(e.alt,{before:m,after:"]",...p.current()})),m+=p.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=n.enter("destinationLiteral"),m+=p.move("<"),m+=p.move(n.safe(e.url,{before:m,after:">",...p.current()})),m+=p.move(">")):(d=n.enter("destinationRaw"),m+=p.move(n.safe(e.url,{before:m,after:e.title?" ":")",...p.current()}))),d(),e.title&&(d=n.enter(`title${c}`),m+=p.move(" "+o),m+=p.move(n.safe(e.title,{before:m,after:o,...p.current()})),m+=p.move(o),d()),m+=p.move(")"),l(),m}function sL(){return"!"}Qx.peek=aL;function Qx(e,t,n,s){const o=e.referenceType,c=n.enter("imageReference");let l=n.enter("label");const d=n.createTracker(s);let p=d.move("![");const m=n.safe(e.alt,{before:p,after:"]",...d.current()});p+=d.move(m+"]["),l();const y=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:p,after:"]",...d.current()});return l(),n.stack=y,c(),o==="full"||!m||m!==g?p+=d.move(g+"]"):o==="shortcut"?p=p.slice(0,-1):p+=d.move("]"),p}function aL(){return"!"}Yx.peek=oL;function Yx(e,t,n){let s=e.value||"",o="`",c=-1;for(;new RegExp("(^|[^`])"+o+"([^`]|$)").test(s);)o+="`";for(/[^ \r\n]/.test(s)&&(/^[ \r\n]/.test(s)&&/[ \r\n]$/.test(s)||/^`|`$/.test(s))&&(s=" "+s+" ");++c<n.unsafe.length;){const l=n.unsafe[c],d=n.compilePattern(l);let p;if(l.atBreak)for(;p=d.exec(s);){let m=p.index;s.charCodeAt(m)===10&&s.charCodeAt(m-1)===13&&m--,s=s.slice(0,m)+" "+s.slice(p.index+1)}}return o+s+o}function oL(){return"`"}function Xx(e,t){const n=Tf(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Jx.peek=lL;function Jx(e,t,n,s){const o=Ff(n),c=o==='"'?"Quote":"Apostrophe",l=n.createTracker(s);let d,p;if(Xx(e,n)){const y=n.stack;n.stack=[],d=n.enter("autolink");let g=l.move("<");return g+=l.move(n.containerPhrasing(e,{before:g,after:">",...l.current()})),g+=l.move(">"),d(),n.stack=y,g}d=n.enter("link"),p=n.enter("label");let m=l.move("[");return m+=l.move(n.containerPhrasing(e,{before:m,after:"](",...l.current()})),m+=l.move("]("),p(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(p=n.enter("destinationLiteral"),m+=l.move("<"),m+=l.move(n.safe(e.url,{before:m,after:">",...l.current()})),m+=l.move(">")):(p=n.enter("destinationRaw"),m+=l.move(n.safe(e.url,{before:m,after:e.title?" ":")",...l.current()}))),p(),e.title&&(p=n.enter(`title${c}`),m+=l.move(" "+o),m+=l.move(n.safe(e.title,{before:m,after:o,...l.current()})),m+=l.move(o),p()),m+=l.move(")"),d(),m}function lL(e,t,n){return Xx(e,n)?"<":"["}Zx.peek=cL;function Zx(e,t,n,s){const o=e.referenceType,c=n.enter("linkReference");let l=n.enter("label");const d=n.createTracker(s);let p=d.move("[");const m=n.containerPhrasing(e,{before:p,after:"]",...d.current()});p+=d.move(m+"]["),l();const y=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:p,after:"]",...d.current()});return l(),n.stack=y,c(),o==="full"||!m||m!==g?p+=d.move(g+"]"):o==="shortcut"?p=p.slice(0,-1):p+=d.move("]"),p}function cL(){return"["}function Of(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function uL(e){const t=Of(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function dL(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function ek(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function hL(e,t,n,s){const o=n.enter("list"),c=n.bulletCurrent;let l=e.ordered?dL(n):Of(n);const d=e.ordered?l==="."?")":".":uL(n);let p=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&y&&(!y.children||!y.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(p=!0),ek(n)===l&&y){let g=-1;for(;++g<e.children.length;){const b=e.children[g];if(b&&b.type==="listItem"&&b.children&&b.children[0]&&b.children[0].type==="thematicBreak"){p=!0;break}}}}p&&(l=d),n.bulletCurrent=l;const m=n.containerFlow(e,s);return n.bulletLastUsed=l,n.bulletCurrent=c,o(),m}function fL(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function pL(e,t,n,s){const o=fL(n);let c=n.bulletCurrent||Of(n);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let l=c.length+1;(o==="tab"||o==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const d=n.createTracker(s);d.move(c+" ".repeat(l-c.length)),d.shift(l);const p=n.enter("listItem"),m=n.indentLines(n.containerFlow(e,d.current()),y);return p(),m;function y(g,b,x){return b?(x?"":" ".repeat(l))+g:(x?c:c+" ".repeat(l-c.length))+g}}function mL(e,t,n,s){const o=n.enter("paragraph"),c=n.enter("phrasing"),l=n.containerPhrasing(e,s);return c(),o(),l}const gL=Oc(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function yL(e,t,n,s){return(e.children.some(function(l){return gL(l)})?n.containerPhrasing:n.containerFlow).call(n,e,s)}function vL(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}tk.peek=wL;function tk(e,t,n,s){const o=vL(n),c=n.enter("strong"),l=n.createTracker(s),d=l.move(o+o);let p=l.move(n.containerPhrasing(e,{after:o,before:d,...l.current()}));const m=p.charCodeAt(0),y=jc(s.before.charCodeAt(s.before.length-1),m,o);y.inside&&(p=So(m)+p.slice(1));const g=p.charCodeAt(p.length-1),b=jc(s.after.charCodeAt(0),g,o);b.inside&&(p=p.slice(0,-1)+So(g));const x=l.move(o+o);return c(),n.attentionEncodeSurroundingInfo={after:b.outside,before:y.outside},d+p+x}function wL(e,t,n){return n.options.strong||"*"}function bL(e,t,n,s){return n.safe(e.value,s)}function xL(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function kL(e,t,n){const s=(ek(n)+(n.options.ruleSpaces?" ":"")).repeat(xL(n));return n.options.ruleSpaces?s.slice(0,-1):s}const nk={blockquote:VA,break:Ky,code:XA,definition:ZA,emphasis:qx,hardBreak:Ky,heading:rL,html:Gx,image:Kx,imageReference:Qx,inlineCode:Yx,link:Jx,linkReference:Zx,list:hL,listItem:pL,paragraph:mL,root:yL,strong:tk,text:bL,thematicBreak:kL};function SL(){return{enter:{table:CL,tableData:Qy,tableHeader:Qy,tableRow:NL},exit:{codeText:TL,table:jL,tableData:Kd,tableHeader:Kd,tableRow:Kd}}}function CL(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function jL(e){this.exit(e),this.data.inTable=void 0}function NL(e){this.enter({type:"tableRow",children:[]},e)}function Kd(e){this.exit(e)}function Qy(e){this.enter({type:"tableCell",children:[]},e)}function TL(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,PL));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function PL(e,t){return t==="|"?t:e}function EL(e){const t=e||{},n=t.tableCellPadding,s=t.tablePipeAlign,o=t.stringLength,c=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
96
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:l,tableCell:p,tableRow:d}};function l(x,C,S,j){return m(y(x,S,j),x.align)}function d(x,C,S,j){const M=g(x,S,j),A=m([M]);return A.slice(0,A.indexOf(`
97
- `))}function p(x,C,S,j){const M=S.enter("tableCell"),A=S.enter("phrasing"),E=S.containerPhrasing(x,{...j,before:c,after:c});return A(),M(),E}function m(x,C){return HA(x,{align:C,alignDelimiters:s,padding:n,stringLength:o})}function y(x,C,S){const j=x.children;let M=-1;const A=[],E=C.enter("table");for(;++M<j.length;)A[M]=g(j[M],C,S);return E(),A}function g(x,C,S){const j=x.children;let M=-1;const A=[],E=C.enter("tableRow");for(;++M<j.length;)A[M]=p(j[M],x,C,S);return E(),A}function b(x,C,S){let j=nk.inlineCode(x,C,S);return S.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function RL(){return{exit:{taskListCheckValueChecked:Yy,taskListCheckValueUnchecked:Yy,paragraph:AL}}}function ML(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:LL}}}function Yy(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function AL(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const s=n.children[0];if(s&&s.type==="text"){const o=t.children;let c=-1,l;for(;++c<o.length;){const d=o[c];if(d.type==="paragraph"){l=d;break}}l===n&&(s.value=s.value.slice(1),s.value.length===0?n.children.shift():n.position&&s.position&&typeof s.position.start.offset=="number"&&(s.position.start.column++,s.position.start.offset++,n.position.start=Object.assign({},s.position.start)))}}this.exit(e)}function LL(e,t,n,s){const o=e.children[0],c=typeof e.checked=="boolean"&&o&&o.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",d=n.createTracker(s);c&&d.move(l);let p=nk.listItem(e,t,n,{...s,...d.current()});return c&&(p=p.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,m)),p;function m(y){return y+l}}function IL(){return[hA(),LA(),FA(),SL(),RL()]}function DL(e){return{extensions:[fA(),IA(e),OA(),EL(e),ML()]}}const _L={tokenize:WL,partial:!0},rk={tokenize:HL,partial:!0},ik={tokenize:$L,partial:!0},sk={tokenize:VL,partial:!0},FL={tokenize:qL,partial:!0},ak={name:"wwwAutolink",tokenize:UL,previous:lk},ok={name:"protocolAutolink",tokenize:zL,previous:ck},yi={name:"emailAutolink",tokenize:BL,previous:uk},ai={};function OL(){return{text:ai}}let os=48;for(;os<123;)ai[os]=yi,os++,os===58?os=65:os===91&&(os=97);ai[43]=yi;ai[45]=yi;ai[46]=yi;ai[95]=yi;ai[72]=[yi,ok];ai[104]=[yi,ok];ai[87]=[yi,ak];ai[119]=[yi,ak];function BL(e,t,n){const s=this;let o,c;return l;function l(g){return!Hh(g)||!uk.call(s,s.previous)||Bf(s.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(g))}function d(g){return Hh(g)?(e.consume(g),d):g===64?(e.consume(g),p):n(g)}function p(g){return g===46?e.check(FL,y,m)(g):g===45||g===95||On(g)?(c=!0,e.consume(g),p):y(g)}function m(g){return e.consume(g),o=!0,p}function y(g){return c&&o&&$n(s.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function UL(e,t,n){const s=this;return o;function o(l){return l!==87&&l!==119||!lk.call(s,s.previous)||Bf(s.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(_L,e.attempt(rk,e.attempt(ik,c),n),n)(l))}function c(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function zL(e,t,n){const s=this;let o="",c=!1;return l;function l(g){return(g===72||g===104)&&ck.call(s,s.previous)&&!Bf(s.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),o+=String.fromCodePoint(g),e.consume(g),d):n(g)}function d(g){if($n(g)&&o.length<5)return o+=String.fromCodePoint(g),e.consume(g),d;if(g===58){const b=o.toLowerCase();if(b==="http"||b==="https")return e.consume(g),p}return n(g)}function p(g){return g===47?(e.consume(g),c?m:(c=!0,p)):n(g)}function m(g){return g===null||kc(g)||qt(g)||ws(g)||Dc(g)?n(g):e.attempt(rk,e.attempt(ik,y),n)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function WL(e,t,n){let s=0;return o;function o(l){return(l===87||l===119)&&s<3?(s++,e.consume(l),o):l===46&&s===3?(e.consume(l),c):n(l)}function c(l){return l===null?n(l):t(l)}}function HL(e,t,n){let s,o,c;return l;function l(m){return m===46||m===95?e.check(sk,p,d)(m):m===null||qt(m)||ws(m)||m!==45&&Dc(m)?p(m):(c=!0,e.consume(m),l)}function d(m){return m===95?s=!0:(o=s,s=void 0),e.consume(m),l}function p(m){return o||s||!c?n(m):t(m)}}function $L(e,t){let n=0,s=0;return o;function o(l){return l===40?(n++,e.consume(l),o):l===41&&s<n?c(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(sk,t,c)(l):l===null||qt(l)||ws(l)?t(l):(e.consume(l),o)}function c(l){return l===41&&s++,e.consume(l),o}}function VL(e,t,n){return s;function s(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),s):d===38?(e.consume(d),c):d===93?(e.consume(d),o):d===60||d===null||qt(d)||ws(d)?t(d):n(d)}function o(d){return d===null||d===40||d===91||qt(d)||ws(d)?t(d):s(d)}function c(d){return $n(d)?l(d):n(d)}function l(d){return d===59?(e.consume(d),s):$n(d)?(e.consume(d),l):n(d)}}function qL(e,t,n){return s;function s(c){return e.consume(c),o}function o(c){return On(c)?n(c):t(c)}}function lk(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||qt(e)}function ck(e){return!$n(e)}function uk(e){return!(e===47||Hh(e))}function Hh(e){return e===43||e===45||e===46||e===95||On(e)}function Bf(e){let t=e.length,n=!1;for(;t--;){const s=e[t][1];if((s.type==="labelLink"||s.type==="labelImage")&&!s._balanced){n=!0;break}if(s._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const GL={tokenize:tI,partial:!0};function KL(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:JL,continuation:{tokenize:ZL},exit:eI}},text:{91:{name:"gfmFootnoteCall",tokenize:XL},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:QL,resolveTo:YL}}}}function QL(e,t,n){const s=this;let o=s.events.length;const c=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let l;for(;o--;){const p=s.events[o][1];if(p.type==="labelImage"){l=p;break}if(p.type==="gfmFootnoteCall"||p.type==="labelLink"||p.type==="label"||p.type==="image"||p.type==="link")break}return d;function d(p){if(!l||!l._balanced)return n(p);const m=Kr(s.sliceSerialize({start:l.end,end:s.now()}));return m.codePointAt(0)!==94||!c.includes(m.slice(1))?n(p):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(p),e.exit("gfmFootnoteCallLabelMarker"),t(p))}}function YL(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const s={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},o={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};o.end.column++,o.end.offset++,o.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},o.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},d=[e[n+1],e[n+2],["enter",s,t],e[n+3],e[n+4],["enter",o,t],["exit",o,t],["enter",c,t],["enter",l,t],["exit",l,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",s,t]];return e.splice(n,e.length-n+1,...d),e}function XL(e,t,n){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c=0,l;return d;function d(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),p}function p(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",m)}function m(g){if(c>999||g===93&&!l||g===null||g===91||qt(g))return n(g);if(g===93){e.exit("chunkString");const b=e.exit("gfmFootnoteCallString");return o.includes(Kr(s.sliceSerialize(b)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return qt(g)||(l=!0),c++,e.consume(g),g===92?y:m}function y(g){return g===91||g===92||g===93?(e.consume(g),c++,m):m(g)}}function JL(e,t,n){const s=this,o=s.parser.gfmFootnotes||(s.parser.gfmFootnotes=[]);let c,l=0,d;return p;function p(C){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(C),e.exit("gfmFootnoteDefinitionLabelMarker"),m}function m(C){return C===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(C),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):n(C)}function y(C){if(l>999||C===93&&!d||C===null||C===91||qt(C))return n(C);if(C===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return c=Kr(s.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(C),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),b}return qt(C)||(d=!0),l++,e.consume(C),C===92?g:y}function g(C){return C===91||C===92||C===93?(e.consume(C),l++,y):y(C)}function b(C){return C===58?(e.enter("definitionMarker"),e.consume(C),e.exit("definitionMarker"),o.includes(c)||o.push(c),Mt(e,x,"gfmFootnoteDefinitionWhitespace")):n(C)}function x(C){return t(C)}}function ZL(e,t,n){return e.check(Io,t,e.attempt(GL,t,n))}function eI(e){e.exit("gfmFootnoteDefinition")}function tI(e,t,n){const s=this;return Mt(e,o,"gfmFootnoteDefinitionIndent",5);function o(c){const l=s.events[s.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(c):n(c)}}function nI(e){let n=(e||{}).singleTilde;const s={name:"strikethrough",tokenize:c,resolveAll:o};return n==null&&(n=!0),{text:{126:s},insideSpan:{null:[s]},attentionMarkers:{null:[126]}};function o(l,d){let p=-1;for(;++p<l.length;)if(l[p][0]==="enter"&&l[p][1].type==="strikethroughSequenceTemporary"&&l[p][1]._close){let m=p;for(;m--;)if(l[m][0]==="exit"&&l[m][1].type==="strikethroughSequenceTemporary"&&l[m][1]._open&&l[p][1].end.offset-l[p][1].start.offset===l[m][1].end.offset-l[m][1].start.offset){l[p][1].type="strikethroughSequence",l[m][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},l[m][1].start),end:Object.assign({},l[p][1].end)},g={type:"strikethroughText",start:Object.assign({},l[m][1].end),end:Object.assign({},l[p][1].start)},b=[["enter",y,d],["enter",l[m][1],d],["exit",l[m][1],d],["enter",g,d]],x=d.parser.constructs.insideSpan.null;x&&xr(b,b.length,0,_c(x,l.slice(m+1,p),d)),xr(b,b.length,0,[["exit",g,d],["enter",l[p][1],d],["exit",l[p][1],d],["exit",y,d]]),xr(l,m-1,p-m+3,b),p=m+b.length-2;break}}for(p=-1;++p<l.length;)l[p][1].type==="strikethroughSequenceTemporary"&&(l[p][1].type="data");return l}function c(l,d,p){const m=this.previous,y=this.events;let g=0;return b;function b(C){return m===126&&y[y.length-1][1].type!=="characterEscape"?p(C):(l.enter("strikethroughSequenceTemporary"),x(C))}function x(C){const S=ca(m);if(C===126)return g>1?p(C):(l.consume(C),g++,x);if(g<2&&!n)return p(C);const j=l.exit("strikethroughSequenceTemporary"),M=ca(C);return j._open=!M||M===2&&!!S,j._close=!S||S===2&&!!M,d(C)}}}class rI{constructor(){this.map=[]}add(t,n,s){iI(this,t,n,s)}consume(t){if(this.map.sort(function(c,l){return c[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const s=[];for(;n>0;)n-=1,s.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];s.push(t.slice()),t.length=0;let o=s.pop();for(;o;){for(const c of o)t.push(c);o=s.pop()}this.map.length=0}}function iI(e,t,n,s){let o=0;if(!(n===0&&s.length===0)){for(;o<e.map.length;){if(e.map[o][0]===t){e.map[o][1]+=n,e.map[o][2].push(...s);return}o+=1}e.map.push([t,n,s])}}function sI(e,t){let n=!1;const s=[];for(;t<e.length;){const o=e[t];if(n){if(o[0]==="enter")o[1].type==="tableContent"&&s.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(o[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=s.length-1;s[c]=s[c]==="left"?"center":"right"}}else if(o[1].type==="tableDelimiterRow")break}else o[0]==="enter"&&o[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return s}function aI(){return{flow:{null:{name:"table",tokenize:oI,resolveAll:lI}}}}function oI(e,t,n){const s=this;let o=0,c=0,l;return d;function d(R){let W=s.events.length-1;for(;W>-1;){const le=s.events[W][1].type;if(le==="lineEnding"||le==="linePrefix")W--;else break}const J=W>-1?s.events[W][1].type:null,re=J==="tableHead"||J==="tableRow"?B:p;return re===B&&s.parser.lazy[s.now().line]?n(R):re(R)}function p(R){return e.enter("tableHead"),e.enter("tableRow"),m(R)}function m(R){return R===124||(l=!0,c+=1),y(R)}function y(R){return R===null?n(R):st(R)?c>1?(c=0,s.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),x):n(R):jt(R)?Mt(e,y,"whitespace")(R):(c+=1,l&&(l=!1,o+=1),R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),l=!0,y):(e.enter("data"),g(R)))}function g(R){return R===null||R===124||qt(R)?(e.exit("data"),y(R)):(e.consume(R),R===92?b:g)}function b(R){return R===92||R===124?(e.consume(R),g):g(R)}function x(R){return s.interrupt=!1,s.parser.lazy[s.now().line]?n(R):(e.enter("tableDelimiterRow"),l=!1,jt(R)?Mt(e,C,"linePrefix",s.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):C(R))}function C(R){return R===45||R===58?j(R):R===124?(l=!0,e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),S):Y(R)}function S(R){return jt(R)?Mt(e,j,"whitespace")(R):j(R)}function j(R){return R===58?(c+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),M):R===45?(c+=1,M(R)):R===null||st(R)?Z(R):Y(R)}function M(R){return R===45?(e.enter("tableDelimiterFiller"),A(R)):Y(R)}function A(R){return R===45?(e.consume(R),A):R===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(R),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(R))}function E(R){return jt(R)?Mt(e,Z,"whitespace")(R):Z(R)}function Z(R){return R===124?C(R):R===null||st(R)?!l||o!==c?Y(R):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(R)):Y(R)}function Y(R){return n(R)}function B(R){return e.enter("tableRow"),I(R)}function I(R){return R===124?(e.enter("tableCellDivider"),e.consume(R),e.exit("tableCellDivider"),I):R===null||st(R)?(e.exit("tableRow"),t(R)):jt(R)?Mt(e,I,"whitespace")(R):(e.enter("data"),_(R))}function _(R){return R===null||R===124||qt(R)?(e.exit("data"),I(R)):(e.consume(R),R===92?F:_)}function F(R){return R===92||R===124?(e.consume(R),_):_(R)}}function lI(e,t){let n=-1,s=!0,o=0,c=[0,0,0,0],l=[0,0,0,0],d=!1,p=0,m,y,g;const b=new rI;for(;++n<e.length;){const x=e[n],C=x[1];x[0]==="enter"?C.type==="tableHead"?(d=!1,p!==0&&(Xy(b,t,p,m,y),y=void 0,p=0),m={type:"table",start:Object.assign({},C.start),end:Object.assign({},C.end)},b.add(n,0,[["enter",m,t]])):C.type==="tableRow"||C.type==="tableDelimiterRow"?(s=!0,g=void 0,c=[0,0,0,0],l=[0,n+1,0,0],d&&(d=!1,y={type:"tableBody",start:Object.assign({},C.start),end:Object.assign({},C.end)},b.add(n,0,[["enter",y,t]])),o=C.type==="tableDelimiterRow"?2:y?3:1):o&&(C.type==="data"||C.type==="tableDelimiterMarker"||C.type==="tableDelimiterFiller")?(s=!1,l[2]===0&&(c[1]!==0&&(l[0]=l[1],g=ql(b,t,c,o,void 0,g),c=[0,0,0,0]),l[2]=n)):C.type==="tableCellDivider"&&(s?s=!1:(c[1]!==0&&(l[0]=l[1],g=ql(b,t,c,o,void 0,g)),c=l,l=[c[1],n,0,0])):C.type==="tableHead"?(d=!0,p=n):C.type==="tableRow"||C.type==="tableDelimiterRow"?(p=n,c[1]!==0?(l[0]=l[1],g=ql(b,t,c,o,n,g)):l[1]!==0&&(g=ql(b,t,l,o,n,g)),o=0):o&&(C.type==="data"||C.type==="tableDelimiterMarker"||C.type==="tableDelimiterFiller")&&(l[3]=n)}for(p!==0&&Xy(b,t,p,m,y),b.consume(t.events),n=-1;++n<t.events.length;){const x=t.events[n];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=sI(t.events,n))}return e}function ql(e,t,n,s,o,c){const l=s===1?"tableHeader":s===2?"tableDelimiter":"tableData",d="tableContent";n[0]!==0&&(c.end=Object.assign({},ra(t.events,n[0])),e.add(n[0],0,[["exit",c,t]]));const p=ra(t.events,n[1]);if(c={type:l,start:Object.assign({},p),end:Object.assign({},p)},e.add(n[1],0,[["enter",c,t]]),n[2]!==0){const m=ra(t.events,n[2]),y=ra(t.events,n[3]),g={type:d,start:Object.assign({},m),end:Object.assign({},y)};if(e.add(n[2],0,[["enter",g,t]]),s!==2){const b=t.events[n[2]],x=t.events[n[3]];if(b[1].end=Object.assign({},x[1].end),b[1].type="chunkText",b[1].contentType="text",n[3]>n[2]+1){const C=n[2]+1,S=n[3]-n[2]-1;e.add(C,S,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return o!==void 0&&(c.end=Object.assign({},ra(t.events,o)),e.add(o,0,[["exit",c,t]]),c=void 0),c}function Xy(e,t,n,s,o){const c=[],l=ra(t.events,n);o&&(o.end=Object.assign({},l),c.push(["exit",o,t])),s.end=Object.assign({},l),c.push(["exit",s,t]),e.add(n+1,0,c)}function ra(e,t){const n=e[t],s=n[0]==="enter"?"start":"end";return n[1][s]}const cI={name:"tasklistCheck",tokenize:dI};function uI(){return{text:{91:cI}}}function dI(e,t,n){const s=this;return o;function o(p){return s.previous!==null||!s._gfmTasklistFirstContentOfListItem?n(p):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),c)}function c(p){return qt(p)?(e.enter("taskListCheckValueUnchecked"),e.consume(p),e.exit("taskListCheckValueUnchecked"),l):p===88||p===120?(e.enter("taskListCheckValueChecked"),e.consume(p),e.exit("taskListCheckValueChecked"),l):n(p)}function l(p){return p===93?(e.enter("taskListCheckMarker"),e.consume(p),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):n(p)}function d(p){return st(p)?t(p):jt(p)?e.check({tokenize:hI},t,n)(p):n(p)}}function hI(e,t,n){return Mt(e,s,"whitespace");function s(o){return o===null?n(o):t(o)}}function fI(e){return xx([OL(),KL(),nI(e),aI(),uI()])}const pI={};function Uf(e){const t=this,n=e||pI,s=t.data(),o=s.micromarkExtensions||(s.micromarkExtensions=[]),c=s.fromMarkdownExtensions||(s.fromMarkdownExtensions=[]),l=s.toMarkdownExtensions||(s.toMarkdownExtensions=[]);o.push(fI(n)),c.push(IL()),l.push(DL(n))}const Jy="*** Begin Patch",Zy="*** End Patch";function mI(e){const t=e.replace(/\r\n/g,`
98
- `);if(!t.includes(Jy)||!t.includes(Zy))return null;const n=t.split(`
99
- `),s=[];let o=null,c=null;for(const l of n){if(l===Jy||l===Zy)continue;if(l.startsWith("*** Update File: ")){o=Qd("update",l.slice(17)),s.push(o),c=null;continue}if(l.startsWith("*** Add File: ")){o=Qd("add",l.slice(14)),s.push(o),c={oldLineNumber:0,newLineNumber:1};continue}if(l.startsWith("*** Delete File: ")){o=Qd("delete",l.slice(17)),s.push(o),c=null;continue}if(!o)continue;if(l.startsWith("*** Move to: ")){o.nextPath=l.slice(13),o.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l.startsWith("@@")){c=yI(l)??{oldLineNumber:0,newLineNumber:0},o.lines.push({kind:"hunk",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l==="*** End of File"){o.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(o.action==="add"&&l.startsWith("+")){o.additions+=1,o.lines.push({kind:"add",text:l,oldLineNumber:null,newLineNumber:(c==null?void 0:c.newLineNumber)??o.additions}),c&&(c.newLineNumber+=1);continue}if(!c){o.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l.startsWith("+")){o.additions+=1,o.lines.push({kind:"add",text:l,oldLineNumber:null,newLineNumber:c.newLineNumber}),c.newLineNumber+=1;continue}if(l.startsWith("-")){o.deletions+=1,o.lines.push({kind:"remove",text:l,oldLineNumber:c.oldLineNumber,newLineNumber:null}),c.oldLineNumber+=1;continue}if(l.startsWith(" ")||l.length===0){o.lines.push({kind:"context",text:l,oldLineNumber:c.oldLineNumber,newLineNumber:c.newLineNumber}),c.oldLineNumber+=1,c.newLineNumber+=1;continue}o.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null})}return s.length===0?null:{files:s,totalAdditions:s.reduce((l,d)=>l+d.additions,0),totalDeletions:s.reduce((l,d)=>l+d.deletions,0)}}function gI(e){return e.replace(/\\/g,"/").split("/").at(-1)||e}function Qd(e,t){return{path:t,nextPath:null,action:e,additions:0,deletions:0,lines:[]}}function yI(e){const t=e.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}const vI=/data:image\/([a-zA-Z0-9.+-]+);base64,([A-Za-z0-9+/=]+)/g,wI=/!\[([^\]]*)\]\((data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)\)/g,bI=/<img\b[^>]*src=["'](data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)["'][^>]*>/gi,xI=/<image\b([^>]*)>([\s\S]*?)<\/image>/gi;function Co(e){const t=kI(e);return t||dk(e)}function kI(e){const t=e.trim();if(!SI(t))return null;try{const n=JSON.parse(t),s=CI(n);return s.text||s.inlineImages.length>0?s:null}catch{return null}}function SI(e){return e.length<2?!1:e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}")}function CI(e){const t=[],n=[];return lc(e,t,n),{text:fk(t.join(`
100
-
101
- `)),inlineImages:hk(n)}}function lc(e,t,n){if(typeof e=="string"){const l=dk(e);l.text&&t.push(l.text),n.push(...l.inlineImages);return}if(e==null)return;if(Array.isArray(e)){e.forEach(l=>lc(l,t,n));return}if(typeof e!="object")return;const s=e,o=new Set,c=jI(s);c&&(n.push(c),["type","source","media_type","mime_type","mimeType","data","image_url","imageUrl","url","src","alt","name"].forEach(l=>{l in s&&o.add(l)}));for(const l of["image_url","url","src","source"]){const d=s[l];typeof d!="string"||!pk(d)||(n.push(ys(d,Ir(s.alt))),o.add(l))}for(const l of["text","message","content","output","result","summary","caption"])l in s&&(o.add(l),lc(s[l],t,n));o.size>0||Object.values(s).forEach(l=>{lc(l,t,n)})}function dk(e){const t=[];let n=e;return n=n.replace(xI,(s,o,c)=>{const l=RI(o,"name"),d=EI(c);return d!=null&&d.url&&t.push(ys(d.url,d.altText||l)),""}),n=n.replace(wI,(s,o,c)=>(t.push(ys(c,o)),"")),n=n.replace(bI,(s,o)=>(t.push(ys(o,null)),"")),n=n.replace(vI,(s,o,c)=>(t.push(ys(s,null,`image/${o}`,Nc(c))),"")),{text:fk(n),inlineImages:hk(t)}}function ys(e,t,n,s){const o=n??NI(e)??"image/png";return{url:e,mimeType:o,altText:jo(t),estimatedBytes:s??TI(e)}}function jI(e){const t=PI(e.source);if(t){const o=Ir(t.type).trim().toLowerCase(),c=tv(t.media_type??t.mime_type??t.mimeType),l=ev(t.data);if(o==="base64"&&c&&l)return ys(`data:${c};base64,${l}`,jo(Ir(t.alt)||Ir(t.name)||Ir(e.alt)||Ir(e.name)),c,Nc(l))}const n=tv(e.media_type??e.mime_type??e.mimeType),s=ev(e.data);return n&&s?ys(`data:${n};base64,${s}`,jo(Ir(e.alt)||Ir(e.name)),n,Nc(s)):null}function hk(e){const t=new Map;return e.forEach(n=>{t.has(n.url)||t.set(n.url,n)}),[...t.values()]}function fk(e){return e.replace(/\r\n/g,`
102
- `).replace(/[ \t]{2,}/g," ").replace(/[ \t]+\n/g,`
103
- `).replace(/\n{3,}/g,`
104
-
105
- `).trim()}function pk(e){return/^data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/.test(e.trim())}function NI(e){var n;const t=e.match(/^data:(image\/[a-zA-Z0-9.+-]+);base64,/i);return((n=t==null?void 0:t[1])==null?void 0:n.toLowerCase())??null}function TI(e){const t=e.match(/^data:image\/[a-zA-Z0-9.+-]+;base64,([A-Za-z0-9+/=]+)$/i);return t?Nc(t[1]):null}function Nc(e){const t=e.trim(),n=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.max(0,Math.floor(t.length*3/4)-n)}function jo(e){const t=Ir(e).trim();return t.length>0?t:null}function ev(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g,"").trim();return/^[A-Za-z0-9+/=]+$/.test(t)?t:null}function tv(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.startsWith("image/")?t:null}function Ir(e){return typeof e=="string"?e:""}function PI(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function EI(e){const t=e.trim();if(t.length===0)return null;try{const n=JSON.parse(t),s=Ir(n.image_url??n.imageUrl).trim(),o=jo(Ir(n.name)||Ir(n.alt));return{url:pk(s)?s:null,altText:o}}catch{const n=t.match(/(data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)/i);return n?{url:n[1],altText:null}:null}}function RI(e,t){const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),s=e.match(new RegExp(`${n}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|\\[([^\\]]*)\\]|([^\\s>]+))`,"i"));return jo((s==null?void 0:s[1])??(s==null?void 0:s[2])??(s==null?void 0:s[3])??(s==null?void 0:s[4])??"")}function $h(e){return e.kind==="tool_call"||e.kind==="tool_result"}function mk(e){return e.toolCall?e.toolCall:$h(e)?{callId:e.rawRef||e.id,name:"tool",input:e.kind==="tool_call"?e.content:"",output:e.kind==="tool_result"&&e.content?e.content:null,error:null,status:e.kind==="tool_call"?"running":"completed"}:null}function MI(e){return e==="shell_command"||e==="tool"?h("conversation.roleTool"):e}function AI(e){if(!e.trim())return null;try{const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function LI(e){const t=AI(e.input),n=t&&typeof t.command=="string"?t.command.trim():"";if(n)return`${h("conversation.toolPreviewCommand")}:${n}`;if(e.name==="read_thread_terminal")return h("conversation.toolPreviewTerminal");const s=e.input||e.error||e.output||h("conversation.toolResultEmpty");return s.length>60?`${s.slice(0,60)}...`:s}function II(e){const t=e.map(c=>({message:c,tool:mk(c)})).filter(c=>!!c.tool);if(t.length===0)return null;const n={...t[0].tool};let s=!1,o=!1;for(const{message:c,tool:l}of t)c.kind==="tool_call"&&(s=!0,!n.input&&l.input&&(n.input=l.input)),c.kind==="tool_result"&&(o=!0,n.output=l.output,n.error=l.error,n.status=l.status,!n.input&&l.input&&(n.input=l.input)),!n.name&&l.name&&(n.name=l.name);return{key:t.map(({message:c})=>c.id).join(":"),tool:n,hasRequest:s,hasResult:o}}function DI(e){const t=new Map;for(const n of e){const s=mk(n);if(!s)continue;const o=t.get(s.callId);if(o){o.messages.push(n);continue}t.set(s.callId,{messages:[n],firstSequence:n.sequence})}return Array.from(t.values()).sort((n,s)=>n.firstSequence-s.firstSequence).map(n=>II(n.messages)).filter(n=>!!n)}function _I(e){const t=[];for(let n=0;n<e.length;n+=1){const s=e[n];if(!$h(s)){t.push({type:"message",key:s.id,message:s});continue}const o=[s];let c=n+1;for(;c<e.length;){const d=e[c];if(!$h(d))break;o.push(d),c+=1}const l=DI(o);if(l.length===0){t.push({type:"message",key:s.id,message:s}),n=c-1;continue}l.forEach(d=>{t.push({type:"tool_group",key:d.key,group:d})}),n=c-1}return t}function FI(e,t){if(!yT(null,e))return!1;const n=t.trim();return/AGENTS\.md instructions for/i.test(n)&&/<INSTRUCTIONS>/i.test(n)&&/<\/INSTRUCTIONS>/i.test(n)}function OI(e){const t=e.split(/\r?\n/).map(n=>n.trim()).find(Boolean);return t?t.replace(/^#+\s*/,""):h("conversation.rulesMessageTitle")}function Vh(e){var t;return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(n=>Vh(n)).join(""):e&&typeof e=="object"&&"props"in e?Vh(((t=e.props)==null?void 0:t.children)??""):""}function BI(e){const t=Array.isArray(e)?e[0]:e;if(!w.isValidElement(t))return null;const n=t.props,s=typeof n.className=="string"?n.className:"",o=/language-([^\s]+)/.exec(s);return{content:Vh(n.children).replace(/\n$/,""),codeClassName:s||void 0,language:(o==null?void 0:o[1])??null}}function UI(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function zI(e,t){var n;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!UI(e))throw new Error(h("conversation.copyContentFailed"))}}function gk({language:e,codeClassName:t,content:n}){const{showToast:s}=Gn(),o=ar(),c=(e==null?void 0:e.trim().toLowerCase())??null,l=c==="text",d=c||"code";async function p(){try{await zI(n,o),s({title:h("conversation.copyContentSuccess"),tone:"success"})}catch(m){s({title:m instanceof Error?m.message:h("conversation.copyContentFailed"),tone:"error"})}}return i.jsxs("div",{className:`code-block${l?" text-code-block":""}`,children:[i.jsxs("div",{className:"code-header",children:[i.jsx("span",{className:"code-header-label",children:d}),i.jsx("button",{className:"code-copy-button",type:"button",onClick:()=>void p(),children:h("conversation.copyAction")})]}),i.jsx("pre",{className:t,children:i.jsx("code",{children:n})})]})}function qh({content:e,className:t}){return i.jsx("div",{className:t,children:i.jsx(_f,{remarkPlugins:[Uf],components:{p:({node:n,...s})=>i.jsx("p",{...s}),pre(n){const s=BI(n.children);return s?i.jsx(gk,{language:s.language,codeClassName:s.codeClassName,content:s.content}):i.jsx("pre",{children:n.children})},code(n){const s=typeof n.className=="string"?n.className:"";return i.jsx("code",{className:s||void 0,children:n.children})}},children:e})})}function nv(e,t){return!(t!=null&&t.contentBase64)||t.mimeType!==e.mimeType?null:`data:${t.mimeType};base64,${t.contentBase64}`}function Yd({sessionId:e,attachmentPayloads:t=[],attachments:n=[],inlineImages:s=[]}){return i.jsx(WI,{sessionId:e,attachments:n,attachmentPayloads:t,inlineImages:s})}function WI({sessionId:e,attachmentPayloads:t=[],attachments:n=[],inlineImages:s=[]}){const[o,c]=w.useState({}),[l,d]=w.useState(null),p=w.useMemo(()=>n.map((b,x)=>{const C=nv(b,t==null?void 0:t[x]);if(C)return{id:b.id,fileName:b.fileName,fileSize:b.fileSize,url:C,status:"ready"};const S=o[b.id];return{id:b.id,fileName:b.fileName,fileSize:b.fileSize,url:(S==null?void 0:S.url)??null,status:(S==null?void 0:S.status)??(e?"loading":"error")}}),[t,n,o,e]),m=w.useMemo(()=>s.map((b,x)=>({id:`inline-image-${x}`,fileName:b.altText||`${h("conversation.imageAttachmentLabel")} ${x+1}`,fileSize:b.estimatedBytes,url:b.url,status:"ready"})),[s]),y=w.useMemo(()=>[...m,...p],[p,m]),g=y.find(b=>b.id===l)??null;return w.useEffect(()=>{if(!l)return;function b(x){x.key==="Escape"&&d(null)}return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[l]),w.useEffect(()=>{const b=n.filter((S,j)=>!nv(S,t==null?void 0:t[j]));if(!e||b.length===0){c({});return}let x=!1;const C=[];return c(Object.fromEntries(b.map(S=>[S.id,{id:S.id,fileName:S.fileName,fileSize:S.fileSize,url:null,status:"loading"}]))),Promise.all(b.map(async S=>{try{const j=await QN(e,S.id),M=URL.createObjectURL(j);return C.push(M),{id:S.id,fileName:S.fileName,fileSize:S.fileSize,url:M,status:"ready"}}catch{return{id:S.id,fileName:S.fileName,fileSize:S.fileSize,url:null,status:"error"}}})).then(S=>{if(x){C.forEach(j=>URL.revokeObjectURL(j));return}c(Object.fromEntries(S.map(j=>[j.id,j])))}),()=>{x=!0,C.forEach(S=>URL.revokeObjectURL(S))}},[t,n,e]),y.length===0?null:i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"message-attachments",children:y.map(b=>{const x=b.status==="loading"?h("conversation.attachmentPreviewLoading"):b.status==="error"?h("conversation.attachmentPreviewUnavailable"):h("conversation.attachmentPreviewOpen");return i.jsx("button",{type:"button",className:"message-attachment-button",onClick:()=>b.url&&d(b.id),disabled:!b.url,"aria-label":`${b.fileName} - ${x}`,title:x,children:i.jsx("div",{className:"message-attachment-card",children:b.url?i.jsx("img",{className:"message-attachment-thumbnail",src:b.url,alt:b.fileName||h("conversation.attachmentPreviewAlt"),loading:"lazy"}):i.jsx("div",{className:"message-attachment-placeholder","aria-hidden":"true",children:b.status==="loading"?h("conversation.attachmentPreviewLoading"):h("conversation.attachmentPreviewUnavailable")})})},b.id)})}),g!=null&&g.url?i.jsxs("div",{className:"workbench-modal-layer message-image-modal",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("conversation.attachmentPreviewClose"),onClick:()=>d(null)}),i.jsxs("div",{className:"workbench-modal-card surface-card message-image-modal-card",children:[i.jsxs("div",{className:"workbench-modal-header message-image-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("conversation.imagePreviewTitle")}),i.jsx("p",{children:g.fileName})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("conversation.attachmentPreviewClose"),onClick:()=>d(null),children:"x"})]}),i.jsxs("div",{className:"message-image-modal-body",children:[i.jsx("div",{className:"message-image-modal-stage",children:i.jsx("img",{className:"message-image-modal-image",src:g.url,alt:g.fileName||h("conversation.attachmentPreviewAlt")})}),i.jsx("p",{className:"message-image-modal-hint",children:h("conversation.imagePreviewHint")})]})]})]}):null]})}function HI(){return i.jsx("div",{className:"timeline-skeleton","aria-hidden":"true",children:Array.from({length:5},(e,t)=>i.jsxs("article",{className:`timeline-skeleton-item ${t%2===0?"assistant":"user"}`,children:[i.jsx("div",{className:"timeline-skeleton-avatar"}),i.jsxs("div",{className:"timeline-skeleton-bubble",children:[i.jsx("span",{className:"timeline-skeleton-line long"}),i.jsx("span",{className:"timeline-skeleton-line medium"}),i.jsx("span",{className:"timeline-skeleton-line short"})]})]},t))})}function $I({tool:e,preview:t}){const[n,s]=w.useState(!1);return w.useEffect(()=>{if(!n)return;function o(c){c.key==="Escape"&&s(!1)}return window.addEventListener("keydown",o),()=>window.removeEventListener("keydown",o)},[n]),i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"tool-call-item apply-patch-item",children:t.files.map((o,c)=>i.jsxs("button",{type:"button",className:"apply-patch-summary-row",onClick:()=>s(!0),children:[i.jsx("span",{className:"apply-patch-summary-label",children:rv(o.action)}),i.jsx("span",{className:"apply-patch-summary-file",title:Xd(o),children:gI(o.nextPath??o.path)}),i.jsxs("span",{className:"apply-patch-summary-stats",children:[i.jsxs("span",{className:"apply-patch-summary-added",children:["+",o.additions]}),i.jsxs("span",{className:"apply-patch-summary-removed",children:["-",o.deletions]})]})]},iv(o,c)))}),n&&typeof document<"u"?qn.createPortal(i.jsxs("div",{className:"workbench-modal-layer apply-patch-modal",role:"dialog","aria-modal":"true",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:()=>s(!1)}),i.jsxs("div",{className:"workbench-modal-card surface-card apply-patch-modal-card",children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("conversation.applyPatchDialogTitle")}),i.jsx("p",{children:h("conversation.applyPatchDialogDescription")})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:()=>s(!1),children:"x"})]}),i.jsxs("div",{className:"apply-patch-modal-totals",children:[i.jsxs("span",{className:"apply-patch-stat-pill positive",children:[h("conversation.applyPatchAddedStat")," +",t.totalAdditions]}),i.jsxs("span",{className:"apply-patch-stat-pill negative",children:[h("conversation.applyPatchRemovedStat")," -",t.totalDeletions]})]}),i.jsxs("div",{className:"apply-patch-modal-body",children:[t.files.length===0?i.jsx("p",{className:"status-text",children:h("conversation.applyPatchEmpty")}):t.files.map((o,c)=>i.jsxs("section",{className:"apply-patch-file-panel",children:[i.jsxs("div",{className:"apply-patch-file-panel-header",children:[i.jsxs("div",{className:"apply-patch-file-panel-title",children:[i.jsx("span",{className:"apply-patch-summary-label",children:rv(o.action)}),i.jsx("strong",{children:Xd(o)})]}),i.jsxs("div",{className:"apply-patch-summary-stats",children:[i.jsxs("span",{className:"apply-patch-summary-added",children:["+",o.additions]}),i.jsxs("span",{className:"apply-patch-summary-removed",children:["-",o.deletions]})]})]}),i.jsx("div",{className:"apply-patch-diff-view",children:i.jsx("div",{className:"apply-patch-diff-scroll",children:o.lines.map((l,d)=>i.jsxs("div",{className:`apply-patch-diff-line ${qI(l.kind)}`,children:[i.jsx("span",{className:"apply-patch-line-number",children:sv(l.oldLineNumber)}),i.jsx("span",{className:"apply-patch-line-number",children:sv(l.newLineNumber)}),i.jsx("span",{className:"apply-patch-line-content",children:l.text||" "})]},`${Xd(o)}:${d}`))})})]},iv(o,c))),e.error?i.jsxs("section",{className:"apply-patch-error-panel",children:[i.jsx("div",{className:"tool-call-section-label",children:h("conversation.toolResultLabel")}),i.jsx("pre",{className:"tool-call-error",children:e.error})]}):null]})]})]}),document.body):null]})}function VI({group:e}){const[t,n]=w.useState(!1),{tool:s,hasRequest:o,hasResult:c}=e,l=MI(s.name),d=w.useMemo(()=>s.name==="apply_patch"?mI(s.input):null,[s.input,s.name]);if(d)return i.jsx($I,{tool:s,preview:d});const p=LI(s),m=!!(s.input||s.output||s.error);return i.jsxs("div",{className:`tool-call-item ${c?"tool-result":""}`,children:[i.jsxs("button",{type:"button",className:"tool-call-header",onClick:()=>m&&n(y=>!y),children:[i.jsxs("div",{className:"tool-call-info",children:[i.jsx("span",{className:"tool-call-name",children:l}),i.jsx("span",{className:"tool-call-input-preview",children:p})]}),i.jsx("div",{className:"tool-call-meta",children:m&&i.jsx("span",{className:`tool-call-toggle ${t?"expanded":""}`,children:i.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})})})]}),t&&m&&i.jsxs("div",{className:"tool-call-output",children:[o&&s.input&&i.jsxs("div",{className:"tool-call-section",children:[i.jsx("div",{className:"tool-call-section-label",children:h("conversation.toolInputLabel")}),i.jsx("pre",{children:s.input})]}),(c||s.error||s.output)&&i.jsxs("div",{className:"tool-call-section",children:[i.jsx("div",{className:"tool-call-section-label",children:h("conversation.toolResultLabel")}),i.jsx("pre",{className:s.error?"tool-call-error":void 0,children:s.error||s.output||h("conversation.toolResultEmpty")})]})]})]})}function rv(e){return h(e==="add"?"conversation.applyPatchAddedLabel":e==="delete"?"conversation.applyPatchDeletedLabel":"conversation.applyPatchEditedLabel")}function Xd(e){return e.nextPath&&e.nextPath!==e.path?`${e.path} -> ${e.nextPath}`:e.nextPath??e.path}function iv(e,t){return`${e.path}:${e.nextPath??""}:${t}`}function qI(e){return e==="add"?"is-added":e==="remove"?"is-removed":e==="hunk"?"is-hunk":e==="meta"?"is-meta":"is-context"}function sv(e){return e===null||e<=0?"":String(e)}function GI({message:e,tone:t,onRetry:n}){const[s,o]=w.useState(!1),c=OI(e.content),l=t==="user-message";return i.jsxs("article",{className:`message-item ${t} rules-message-row`,children:[i.jsxs("div",{className:"message-content-wrapper",children:[i.jsxs("div",{className:"rules-message-card",children:[i.jsxs("button",{type:"button",className:"rules-message-toggle","aria-expanded":s,onClick:()=>o(d=>!d),children:[i.jsxs("div",{className:"rules-message-heading",children:[i.jsx("span",{className:"rules-message-badge",children:h("conversation.rulesMessageTitle")}),i.jsx("span",{className:"rules-message-summary",children:c})]}),i.jsx("span",{className:"rules-message-action",children:h(s?"conversation.rulesMessageCollapse":"conversation.rulesMessageExpand")})]}),i.jsx("p",{className:"rules-message-hint",children:h("conversation.rulesMessageHint")}),s&&i.jsx("div",{className:"rules-message-body",children:i.jsx(qh,{content:e.content,className:"message-text message-content markdown-content"})})]}),e.deliveryState==="failed"&&e.clientRequestId&&i.jsx("button",{className:"retry-button",type:"button",onClick:()=>n(e.clientRequestId),children:h("conversation.resendButton")})]}),l&&i.jsx("time",{className:"message-time",dateTime:e.timestamp,children:new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})}function KI({message:e,provider:t,onRetry:n}){const s=e.role==="user",o=e.kind==="thinking",c=e.role==="assistant"&&e.kind==="text",l=FI(t,e.content),d=w.useMemo(()=>Co(e.content),[e.content]),p=d.text,m=d.inlineImages;if(l){const y=e.role==="user"?"user-message":e.role==="assistant"?"assistant-message":"system-message";return i.jsx(GI,{message:e,tone:y,onRetry:n})}return s?i.jsxs("article",{className:"message-item user-message",children:[i.jsxs("div",{className:"message-content-wrapper",children:[i.jsx(Yd,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:m}),p?i.jsx(qh,{content:p,className:"message-text message-content markdown-content"}):null,e.deliveryState==="failed"&&e.clientRequestId&&i.jsx("button",{className:"retry-button",type:"button",onClick:()=>n(e.clientRequestId),children:h("conversation.resendButton")})]}),i.jsx("time",{className:"message-time",dateTime:e.timestamp,children:new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}):c||o?i.jsxs("article",{className:"message-item assistant-message",children:[i.jsx("div",{className:"message-avatar",children:i.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("circle",{cx:"12",cy:"12",r:"10"}),i.jsx("path",{d:"M12 16v-4M12 8h.01"})]})}),i.jsxs("div",{className:"message-content-wrapper",children:[o&&i.jsx("div",{className:"tool-call-name",children:h("conversation.thinkingLabel")}),i.jsx(Yd,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:m}),p&&i.jsx(qh,{content:p,className:"message-text message-content markdown-content"})]})]}):i.jsx("article",{className:"message-item system-message",children:i.jsxs("div",{className:"message-content-wrapper",children:[i.jsx(Yd,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:m}),p?i.jsx("div",{className:"message-text message-content",children:i.jsx(gk,{language:"text",content:p})}):null]})})}function yk({sessionId:e="session",messages:t,historyState:n,loadingOlderMessages:s=!1,hasOlderMessages:o=!1,onLoadOlderMessages:c=()=>{},onRetryMessage:l,provider:d}){const{showToast:p}=Gn(),m=w.useRef(null),y=w.useRef(e),g=w.useRef(t.length),b=w.useRef(Jd(t.at(-1)??null)),x=w.useRef(!0),C=w.useRef(null),S=_I(t),j=n==="loading"&&t.length===0;w.useEffect(()=>{n==="error"&&p({title:h("conversation.historyLoadFailed"),tone:"error"})},[n,p]),w.useEffect(()=>{y.current!==e&&(y.current=e,g.current=0,b.current=null,x.current=!0,C.current=null)},[e]),w.useLayoutEffect(()=>{const A=m.current;if(!A){g.current=t.length,b.current=Jd(t.at(-1)??null);return}const E=g.current,Z=b.current,Y=Jd(t.at(-1)??null);C.current!==null&&t.length>=E?(A.scrollTop=Math.max(0,A.scrollHeight-C.current),C.current=null):x.current&&(E===0||t.length!==E||Y!==Z)&&(A.scrollTop=A.scrollHeight),g.current=t.length,b.current=Y},[t,e]);function M(){const A=m.current;if(!A)return;const E=A.scrollHeight-A.clientHeight-A.scrollTop;x.current=E<=80,A.scrollTop<=120&&o&&!s&&n==="ready"&&(C.current=A.scrollHeight-A.scrollTop,c())}return i.jsxs("section",{className:"message-timeline",children:[n==="loading"&&i.jsx("div",{className:"timeline-status",children:i.jsx("span",{className:"status-text",children:h("conversation.historyLoading")})}),i.jsxs("div",{ref:m,className:"message-list",onScroll:M,children:[j?i.jsx(HI,{}):null,s?i.jsx("div",{className:"timeline-status timeline-status-inline",children:i.jsx("span",{className:"status-text",children:h("conversation.historyLoadingOlder")})}):null,S.length===0&&n==="ready"&&i.jsx("div",{className:"timeline-empty",children:i.jsx("p",{className:"status-text",children:h("conversation.timelineEmpty")})}),S.map(A=>A.type==="tool_group"?i.jsx("article",{className:"message-item tool-message-row",children:i.jsx(VI,{group:A.group})},A.key):i.jsx(KI,{message:A.message,provider:d,onRetry:l},A.key))]})]})}function Jd(e){return e?JSON.stringify({id:e.id,content:e.content,attachments:e.attachments,timestamp:e.timestamp,deliveryState:e.deliveryState,toolCall:e.toolCall?{status:e.toolCall.status,output:e.toolCall.output,error:e.toolCall.error}:null}):null}function QI({items:e,deletingQueueItemId:t=null,steeringQueueItemId:n=null,canSteer:s=!1,onDelete:o,onSteer:c}){return e.length===0?null:i.jsxs("section",{className:"queued-message-list","aria-label":h("conversation.queueTitle"),children:[i.jsx("div",{className:"queued-message-list__header",children:i.jsx("h2",{children:`${h("conversation.queueTitle")} · ${e.length}`})}),i.jsx("div",{className:"queued-message-list__items",children:e.map((l,d)=>{const p=l.status==="queued"||l.status==="failed",m=s&&typeof c=="function"&&l.status==="queued";return i.jsxs("article",{className:"queued-message-item",children:[i.jsxs("div",{className:"queued-message-item__main",children:[i.jsx("span",{className:"queued-message-item__order","aria-hidden":"true",children:d+1}),i.jsx("p",{className:"queued-message-item__content",title:l.content||h("conversation.queueImageOnly"),children:l.content||h("conversation.queueImageOnly")}),i.jsx("span",{className:`queued-message-item__status queued-message-item__status--${l.status}`,children:l.status==="failed"?h("conversation.queueStatusFailed"):h("conversation.queueStatusQueued")}),i.jsxs("div",{className:"queued-message-item__actions",children:[m?i.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--steer",onClick:()=>void c(l.id),disabled:n===l.id,"aria-label":h("conversation.queueSteer"),title:h("conversation.queueSteer"),children:n===l.id?h("conversation.queueSteering"):h("conversation.queueSteer")}):null,p?i.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--delete",onClick:()=>void o(l.id),disabled:t===l.id,"aria-label":h("conversation.queueDelete"),title:h("conversation.queueDelete"),children:t===l.id?"…":"×"}):null]})]}),l.errorDetail?i.jsx("p",{className:"queued-message-item__error",children:l.errorDetail}):null]},l.id)})})]})}function xn(e,t,n,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?s:n==="a"?s.call(e):s?s.value:t.get(e)}function Oi(e,t,n,s,o){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var ls,Ar,Zs,Gl,cc;const sr="__TAURI_TO_IPC_KEY__";function vk(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class wk{constructor(t){ls.set(this,void 0),Ar.set(this,0),Zs.set(this,[]),Gl.set(this,void 0),Oi(this,ls,t||(()=>{})),this.id=vk(n=>{const s=n.index;if("end"in n){s==xn(this,Ar,"f")?this.cleanupCallback():Oi(this,Gl,s);return}const o=n.message;if(s==xn(this,Ar,"f")){for(xn(this,ls,"f").call(this,o),Oi(this,Ar,xn(this,Ar,"f")+1);xn(this,Ar,"f")in xn(this,Zs,"f");){const c=xn(this,Zs,"f")[xn(this,Ar,"f")];xn(this,ls,"f").call(this,c),delete xn(this,Zs,"f")[xn(this,Ar,"f")],Oi(this,Ar,xn(this,Ar,"f")+1)}xn(this,Ar,"f")===xn(this,Gl,"f")&&this.cleanupCallback()}else xn(this,Zs,"f")[s]=o})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){Oi(this,ls,t)}get onmessage(){return xn(this,ls,"f")}[(ls=new WeakMap,Ar=new WeakMap,Zs=new WeakMap,Gl=new WeakMap,sr)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[sr]()}}async function ge(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class bk{get rid(){return xn(this,cc,"f")}constructor(t){cc.set(this,void 0),Oi(this,cc,t)}async close(){return ge("plugin:resources|close",{rid:this.rid})}}cc=new WeakMap;class xk{constructor(...t){this.type="Logical",t.length===1?"Logical"in t[0]?(this.width=t[0].Logical.width,this.height=t[0].Logical.height):(this.width=t[0].width,this.height=t[0].height):(this.width=t[0],this.height=t[1])}toPhysical(t){return new mo(this.width*t,this.height*t)}[sr](){return{width:this.width,height:this.height}}toJSON(){return this[sr]()}}class mo{constructor(...t){this.type="Physical",t.length===1?"Physical"in t[0]?(this.width=t[0].Physical.width,this.height=t[0].Physical.height):(this.width=t[0].width,this.height=t[0].height):(this.width=t[0],this.height=t[1])}toLogical(t){return new xk(this.width/t,this.height/t)}[sr](){return{width:this.width,height:this.height}}toJSON(){return this[sr]()}}class ea{constructor(t){this.size=t}toLogical(t){return this.size instanceof xk?this.size:this.size.toLogical(t)}toPhysical(t){return this.size instanceof mo?this.size:this.size.toPhysical(t)}[sr](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[sr]()}}class kk{constructor(...t){this.type="Logical",t.length===1?"Logical"in t[0]?(this.x=t[0].Logical.x,this.y=t[0].Logical.y):(this.x=t[0].x,this.y=t[0].y):(this.x=t[0],this.y=t[1])}toPhysical(t){return new Fi(this.x*t,this.y*t)}[sr](){return{x:this.x,y:this.y}}toJSON(){return this[sr]()}}class Fi{constructor(...t){this.type="Physical",t.length===1?"Physical"in t[0]?(this.x=t[0].Physical.x,this.y=t[0].Physical.y):(this.x=t[0].x,this.y=t[0].y):(this.x=t[0],this.y=t[1])}toLogical(t){return new kk(this.x/t,this.y/t)}[sr](){return{x:this.x,y:this.y}}toJSON(){return this[sr]()}}class Ui{constructor(t){this.position=t}toLogical(t){return this.position instanceof kk?this.position:this.position.toLogical(t)}toPhysical(t){return this.position instanceof Fi?this.position:this.position.toPhysical(t)}[sr](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[sr]()}}var yr;(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(yr||(yr={}));async function Sk(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await ge("plugin:event|unlisten",{event:e,eventId:t})}async function Ck(e,t,n){var s;const o=typeof(n==null?void 0:n.target)=="string"?{kind:"AnyLabel",label:n.target}:(s=n==null?void 0:n.target)!==null&&s!==void 0?s:{kind:"Any"};return ge("plugin:event|listen",{event:e,target:o,handler:vk(t)}).then(c=>async()=>Sk(e,c))}async function YI(e,t,n){return Ck(e,s=>{Sk(e,s.id),t(s)},n)}async function XI(e,t){await ge("plugin:event|emit",{event:e,payload:t})}async function JI(e,t,n){await ge("plugin:event|emit_to",{target:typeof e=="string"?{kind:"AnyLabel",label:e}:e,event:t,payload:n})}class go extends bk{constructor(t){super(t)}static async new(t,n,s){return ge("plugin:image|new",{rgba:ni(t),width:n,height:s}).then(o=>new go(o))}static async fromBytes(t){return ge("plugin:image|from_bytes",{bytes:ni(t)}).then(n=>new go(n))}static async fromPath(t){return ge("plugin:image|from_path",{path:t}).then(n=>new go(n))}async rgba(){return ge("plugin:image|rgba",{rid:this.rid}).then(t=>new Uint8Array(t))}async size(){return ge("plugin:image|size",{rid:this.rid})}}function ni(e){return e==null?null:typeof e=="string"?e:e instanceof go?e.rid:e}var Gh;(function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"})(Gh||(Gh={}));class ZI{constructor(t){this._preventDefault=!1,this.event=t.event,this.id=t.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var av;(function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"})(av||(av={}));function zf(){return new jk(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function Zd(){return ge("plugin:window|get_all_windows").then(e=>e.map(t=>new jk(t,{skip:!0})))}const eh=["tauri://created","tauri://error"];class jk{constructor(t,n={}){var s;this.label=t,this.listeners=Object.create(null),n!=null&&n.skip||ge("plugin:window|create",{options:{...n,parent:typeof n.parent=="string"?n.parent:(s=n.parent)===null||s===void 0?void 0:s.label,label:t}}).then(async()=>this.emit("tauri://created")).catch(async o=>this.emit("tauri://error",o))}static async getByLabel(t){var n;return(n=(await Zd()).find(s=>s.label===t))!==null&&n!==void 0?n:null}static getCurrent(){return zf()}static async getAll(){return Zd()}static async getFocusedWindow(){for(const t of await Zd())if(await t.isFocused())return t;return null}async listen(t,n){return this._handleTauriEvent(t,n)?()=>{const s=this.listeners[t];s.splice(s.indexOf(n),1)}:Ck(t,n,{target:{kind:"Window",label:this.label}})}async once(t,n){return this._handleTauriEvent(t,n)?()=>{const s=this.listeners[t];s.splice(s.indexOf(n),1)}:YI(t,n,{target:{kind:"Window",label:this.label}})}async emit(t,n){if(eh.includes(t)){for(const s of this.listeners[t]||[])s({event:t,id:-1,payload:n});return}return XI(t,n)}async emitTo(t,n,s){if(eh.includes(n)){for(const o of this.listeners[n]||[])o({event:n,id:-1,payload:s});return}return JI(t,n,s)}_handleTauriEvent(t,n){return eh.includes(t)?(t in this.listeners?this.listeners[t].push(n):this.listeners[t]=[n],!0):!1}async scaleFactor(){return ge("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return ge("plugin:window|inner_position",{label:this.label}).then(t=>new Fi(t))}async outerPosition(){return ge("plugin:window|outer_position",{label:this.label}).then(t=>new Fi(t))}async innerSize(){return ge("plugin:window|inner_size",{label:this.label}).then(t=>new mo(t))}async outerSize(){return ge("plugin:window|outer_size",{label:this.label}).then(t=>new mo(t))}async isFullscreen(){return ge("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return ge("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return ge("plugin:window|is_maximized",{label:this.label})}async isFocused(){return ge("plugin:window|is_focused",{label:this.label})}async isDecorated(){return ge("plugin:window|is_decorated",{label:this.label})}async isResizable(){return ge("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return ge("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return ge("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return ge("plugin:window|is_closable",{label:this.label})}async isVisible(){return ge("plugin:window|is_visible",{label:this.label})}async title(){return ge("plugin:window|title",{label:this.label})}async theme(){return ge("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return ge("plugin:window|is_always_on_top",{label:this.label})}async center(){return ge("plugin:window|center",{label:this.label})}async requestUserAttention(t){let n=null;return t&&(t===Gh.Critical?n={type:"Critical"}:n={type:"Informational"}),ge("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(t){return ge("plugin:window|set_resizable",{label:this.label,value:t})}async setEnabled(t){return ge("plugin:window|set_enabled",{label:this.label,value:t})}async isEnabled(){return ge("plugin:window|is_enabled",{label:this.label})}async setMaximizable(t){return ge("plugin:window|set_maximizable",{label:this.label,value:t})}async setMinimizable(t){return ge("plugin:window|set_minimizable",{label:this.label,value:t})}async setClosable(t){return ge("plugin:window|set_closable",{label:this.label,value:t})}async setTitle(t){return ge("plugin:window|set_title",{label:this.label,value:t})}async maximize(){return ge("plugin:window|maximize",{label:this.label})}async unmaximize(){return ge("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return ge("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return ge("plugin:window|minimize",{label:this.label})}async unminimize(){return ge("plugin:window|unminimize",{label:this.label})}async show(){return ge("plugin:window|show",{label:this.label})}async hide(){return ge("plugin:window|hide",{label:this.label})}async close(){return ge("plugin:window|close",{label:this.label})}async destroy(){return ge("plugin:window|destroy",{label:this.label})}async setDecorations(t){return ge("plugin:window|set_decorations",{label:this.label,value:t})}async setShadow(t){return ge("plugin:window|set_shadow",{label:this.label,value:t})}async setEffects(t){return ge("plugin:window|set_effects",{label:this.label,value:t})}async clearEffects(){return ge("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(t){return ge("plugin:window|set_always_on_top",{label:this.label,value:t})}async setAlwaysOnBottom(t){return ge("plugin:window|set_always_on_bottom",{label:this.label,value:t})}async setContentProtected(t){return ge("plugin:window|set_content_protected",{label:this.label,value:t})}async setSize(t){return ge("plugin:window|set_size",{label:this.label,value:t instanceof ea?t:new ea(t)})}async setMinSize(t){return ge("plugin:window|set_min_size",{label:this.label,value:t instanceof ea?t:t?new ea(t):null})}async setMaxSize(t){return ge("plugin:window|set_max_size",{label:this.label,value:t instanceof ea?t:t?new ea(t):null})}async setSizeConstraints(t){function n(s){return s?{Logical:s}:null}return ge("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:n(t==null?void 0:t.minWidth),minHeight:n(t==null?void 0:t.minHeight),maxWidth:n(t==null?void 0:t.maxWidth),maxHeight:n(t==null?void 0:t.maxHeight)}})}async setPosition(t){return ge("plugin:window|set_position",{label:this.label,value:t instanceof Ui?t:new Ui(t)})}async setFullscreen(t){return ge("plugin:window|set_fullscreen",{label:this.label,value:t})}async setSimpleFullscreen(t){return ge("plugin:window|set_simple_fullscreen",{label:this.label,value:t})}async setFocus(){return ge("plugin:window|set_focus",{label:this.label})}async setFocusable(t){return ge("plugin:window|set_focusable",{label:this.label,value:t})}async setIcon(t){return ge("plugin:window|set_icon",{label:this.label,value:ni(t)})}async setSkipTaskbar(t){return ge("plugin:window|set_skip_taskbar",{label:this.label,value:t})}async setCursorGrab(t){return ge("plugin:window|set_cursor_grab",{label:this.label,value:t})}async setCursorVisible(t){return ge("plugin:window|set_cursor_visible",{label:this.label,value:t})}async setCursorIcon(t){return ge("plugin:window|set_cursor_icon",{label:this.label,value:t})}async setBackgroundColor(t){return ge("plugin:window|set_background_color",{color:t})}async setCursorPosition(t){return ge("plugin:window|set_cursor_position",{label:this.label,value:t instanceof Ui?t:new Ui(t)})}async setIgnoreCursorEvents(t){return ge("plugin:window|set_ignore_cursor_events",{label:this.label,value:t})}async startDragging(){return ge("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(t){return ge("plugin:window|start_resize_dragging",{label:this.label,value:t})}async setBadgeCount(t){return ge("plugin:window|set_badge_count",{label:this.label,value:t})}async setBadgeLabel(t){return ge("plugin:window|set_badge_label",{label:this.label,value:t})}async setOverlayIcon(t){return ge("plugin:window|set_overlay_icon",{label:this.label,value:t?ni(t):void 0})}async setProgressBar(t){return ge("plugin:window|set_progress_bar",{label:this.label,value:t})}async setVisibleOnAllWorkspaces(t){return ge("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:t})}async setTitleBarStyle(t){return ge("plugin:window|set_title_bar_style",{label:this.label,value:t})}async setTheme(t){return ge("plugin:window|set_theme",{label:this.label,value:t})}async onResized(t){return this.listen(yr.WINDOW_RESIZED,n=>{n.payload=new mo(n.payload),t(n)})}async onMoved(t){return this.listen(yr.WINDOW_MOVED,n=>{n.payload=new Fi(n.payload),t(n)})}async onCloseRequested(t){return this.listen(yr.WINDOW_CLOSE_REQUESTED,async n=>{const s=new ZI(n);await t(s),s.isPreventDefault()||await this.destroy()})}async onDragDropEvent(t){const n=await this.listen(yr.DRAG_ENTER,l=>{t({...l,payload:{type:"enter",paths:l.payload.paths,position:new Fi(l.payload.position)}})}),s=await this.listen(yr.DRAG_OVER,l=>{t({...l,payload:{type:"over",position:new Fi(l.payload.position)}})}),o=await this.listen(yr.DRAG_DROP,l=>{t({...l,payload:{type:"drop",paths:l.payload.paths,position:new Fi(l.payload.position)}})}),c=await this.listen(yr.DRAG_LEAVE,l=>{t({...l,payload:{type:"leave"}})});return()=>{n(),o(),s(),c()}}async onFocusChanged(t){const n=await this.listen(yr.WINDOW_FOCUS,o=>{t({...o,payload:!0})}),s=await this.listen(yr.WINDOW_BLUR,o=>{t({...o,payload:!1})});return()=>{n(),s()}}async onScaleChanged(t){return this.listen(yr.WINDOW_SCALE_FACTOR_CHANGED,t)}async onThemeChanged(t){return this.listen(yr.WINDOW_THEME_CHANGED,t)}}var ov;(function(e){e.Disabled="disabled",e.Throttle="throttle",e.Suspend="suspend"})(ov||(ov={}));var lv;(function(e){e.Default="default",e.FluentOverlay="fluentOverlay"})(lv||(lv={}));var cv;(function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"})(cv||(cv={}));var uv;(function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"})(uv||(uv={}));const eD=["button","a","input","textarea","select","summary","[role='button']","[role='link']","[role='tab']","[role='menuitem']","[contenteditable='true']","[data-window-drag='ignore']"].join(", ");function Wf(e){return e instanceof HTMLElement?!e.closest(eD):!0}async function Hf(){typeof window>"u"||typeof window.__TAURI_INTERNALS__>"u"||await zf().startDragging()}const dv=48;function tD(e){return typeof e=="string"?e.replace(/\s+/g," ").trim():""}function $i(e,t){const n=tD(e)||t,s=n.length>dv?n.slice(0,dv).trimEnd():n;return{fullTitle:n,displayTitle:s}}function nD(e){const t=e.trim().length;return t<=16?"xl":t<=26?"lg":t<=38?"md":"sm"}function Nk({session:e}){const t=ar(),n=w.useCallback(c=>{!t.isDesktop||t.ui.osFamily!=="macos"||c.button!==0||Wf(c.target)&&Hf()},[t.isDesktop,t.ui.osFamily]);if(!e)return i.jsx("header",{className:"conversation-header conversation-header-skeleton","aria-hidden":"true","data-window-drag-handle":"conversation-header",onMouseDownCapture:n,children:i.jsxs("div",{className:"conversation-header-main",children:[i.jsx("span",{className:"skeleton-line short"}),i.jsx("span",{className:"skeleton-line long"})]})});const s=$i(e.title,h("conversation.titleFallback")),o=nD(s.displayTitle);return i.jsx("header",{className:"conversation-header","data-window-drag-handle":"conversation-header",onMouseDownCapture:n,children:i.jsx("div",{className:"conversation-header-main",children:i.jsx("h1",{className:`conversation-title is-${o}`,title:s.fullTitle,children:s.displayTitle})})})}function qr(){return"/workspaces"}function ri(e){return`/workspaces/${encodeURIComponent(e)}`}function _o(e){return`${ri(e)}/sessions`}function Vn(e,t){return`${_o(e)}/${encodeURIComponent(t)}`}function fa(e,t){const n=`${ri(e)}/tools`;if(!t)return n;const s=new URLSearchParams({tab:t});return`${n}?${s.toString()}`}function Tk(e){return`${ri(e)}/tools/files`}function Pk(e){return`${ri(e)}/tools/git`}function Uc(e){return`${ri(e)}/tools/processes`}function sa(e){return`${ri(e)}/terminals`}function $f(e){return e.flatMap(t=>t.sessions.map(n=>({session:n,workspace:t.workspace}))).sort((t,n)=>(n.session.lastMessageAt??n.session.updatedAt).localeCompare(t.session.lastMessageAt??t.session.updatedAt))}function Ek(e){const t=new Map(e.map(o=>[o.session.sessionId,o])),n=new Map,s=[];for(const o of e){const c=iD(o,t);if(c===o.session.sessionId){s.push(o);continue}const l=n.get(c)??[];n.set(c,[...l,o])}return[...s].sort(hv).map(o=>({entry:o,children:[...n.get(o.session.sessionId)??[]].sort(hv)}))}function Rk(e,t){const n=rD(),s=new URLSearchParams({provider:t});return`${Vn(e,n)}?${s.toString()}`}function rD(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`draft-${e.randomUUID()}`:`draft-${Date.now()}-${Math.random().toString(16).slice(2)}`}function hv(e,t){return(t.session.lastMessageAt??t.session.updatedAt).localeCompare(e.session.lastMessageAt??e.session.updatedAt)}function iD(e,t){var o;let n=e;const s=new Set([e.session.sessionId]);for(;;){const c=((o=n.session.parentSessionId)==null?void 0:o.trim())||null;if(!c)return n.session.sessionId;const l=t.get(c);if(!l)return n.session.sessionId;if(s.has(l.session.sessionId))return e.session.sessionId;s.add(l.session.sessionId),n=l}}const sD="mobile.tools.last-primary-tool";function Mk(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(sD)==="git"?"git":"files"}catch{return"files"}}function Vf(e){var s;const t=[{pattern:"/workspaces/:workspaceId/tools/processes",routeKind:"processes"},{pattern:"/workspaces/:workspaceId/tools/files",routeKind:"files"},{pattern:"/workspaces/:workspaceId/tools/git",routeKind:"git"},{pattern:"/workspaces/:workspaceId/tools",routeKind:"home"}];for(const o of t){const c=kn(o.pattern,e),l=((s=c==null?void 0:c.params.workspaceId)==null?void 0:s.trim())??null;if(l)return{workspaceId:l,routeKind:o.routeKind,legacy:!1}}const n=[{pattern:"/tools/processes",routeKind:"processes"},{pattern:"/tools/files",routeKind:"files"},{pattern:"/tools/git",routeKind:"git"},{pattern:"/tools",routeKind:"home"}];for(const o of n)if(kn(o.pattern,e))return{workspaceId:null,routeKind:o.routeKind,legacy:!0};return null}function aD(e,t){const n=Vf(e);if((n==null?void 0:n.routeKind)==="git")return"git";if((n==null?void 0:n.routeKind)==="files")return"files";const s=new URLSearchParams(t).get("tab");return s==="git"?"git":s==="files"?"files":Mk()}function qf(e,t){const n=Vf(e);return n!=null&&n.workspaceId?fa(n.workspaceId,aD(e,t)):n!=null&&n.legacy?Mk()==="git"?"/tools?tab=git":"/tools?tab=files":null}function Gf({activeEntry:e,presentation:t,pathname:n,search:s,moreButtonLabel:o}){if(t==="conversation-focus"||e!=="tools")return null;const c=Vf(n);return c?c.routeKind==="processes"?{title:h("shell.terminalManagerEntry"),showBackButton:!0,showMoreButton:!1,moreButtonLabel:o}:(c.routeKind==="home"||c.routeKind==="files"||c.routeKind==="git",null):null}const oD=3e3,fv=10,pv=84,mv=.36;function Kf({enabled:e,rootRef:t,suspended:n=!1,resetKey:s}){const o=w.useRef(null),c=w.useRef(null),l=w.useRef("visible"),d=w.useRef(1),[p,m]=w.useState("visible"),[y,g]=w.useState(1);w.useEffect(()=>{l.current=p},[p]),w.useEffect(()=>{d.current=y},[y]);function b(){cs(o),o.current=window.setTimeout(()=>{m("hidden"),g(0)},oD)}function x(){m("visible"),g(1),b()}w.useEffect(()=>{if(cs(o),!e){cs(o),m("visible"),g(1);return}if(n){m("hidden"),g(0);return}return x(),()=>{cs(o)}},[e,s,n]),w.useEffect(()=>()=>{cs(o)},[]),w.useEffect(()=>{if(!e||n){c.current=null;return}const S=t.current;if(!S)return;function j(I){if(I.touches.length!==1){c.current=null;return}const _=I.touches[0],F=vv(I.target);if(!_||!F){c.current=null;return}c.current={startY:_.clientY,pointerType:"touch",initialState:l.current==="visible"?"visible":"hidden",touchId:_.identifier,dragging:!1,latestProgress:d.current},l.current==="visible"&&cs(o)}function M(I){const _=c.current;if(!_||_.pointerType!=="touch")return;const F=th(I.touches,_.touchId);if(!F)return;const R=F.clientY-_.startY,W=_.initialState==="hidden"?-R:R;W<=fv&&!_.dragging||(bv(I),_.dragging=!0,_.latestProgress=gv(_.initialState,W),m("dragging"),g(_.latestProgress))}function A(I){const _=c.current;if(!(!_||_.pointerType!=="touch"||!th(I.changedTouches,_.touchId))){if(c.current=null,!_.dragging){_.initialState==="visible"&&b();return}yv(_.initialState,_.latestProgress,x,m,g)}}function E(I){const _=c.current;if(!(!_||_.pointerType!=="touch"||!th(I.changedTouches,_.touchId))){if(c.current=null,!_.dragging){_.initialState==="visible"&&b();return}if(_.initialState==="visible"){x();return}m("hidden"),g(0)}}function Z(I){if(I.pointerType!=="touch")return;if(!vv(I.target)){c.current=null;return}if(c.current={startY:I.clientY,pointerType:"pointer",initialState:l.current==="visible"?"visible":"hidden",pointerId:I.pointerId,captureTarget:I.target instanceof Element?I.target:null,dragging:!1,latestProgress:d.current},I.target instanceof Element)try{I.target.setPointerCapture(I.pointerId)}catch{}l.current==="visible"&&cs(o)}function Y(I){const _=c.current;if(!_||_.pointerType!=="pointer")return;const F=I.clientY-_.startY,R=_.initialState==="hidden"?-F:F;R<=fv&&!_.dragging||(bv(I),_.dragging=!0,_.latestProgress=gv(_.initialState,R),m("dragging"),g(_.latestProgress))}function B(I){const _=c.current;if(!(!_||_.pointerType!=="pointer"||_.pointerId!==I.pointerId)){if(c.current=null,lD(_),!_.dragging){_.initialState==="visible"&&b();return}yv(_.initialState,_.latestProgress,x,m,g)}}return S.addEventListener("touchstart",j,{passive:!0}),S.addEventListener("pointerdown",Z,{passive:!0}),window.addEventListener("touchmove",M,{passive:!1}),window.addEventListener("touchend",A),window.addEventListener("touchcancel",E),window.addEventListener("pointermove",Y,{passive:!1}),window.addEventListener("pointerup",B),window.addEventListener("pointercancel",B),()=>{S.removeEventListener("touchstart",j),S.removeEventListener("pointerdown",Z),window.removeEventListener("touchmove",M),window.removeEventListener("touchend",A),window.removeEventListener("touchcancel",E),window.removeEventListener("pointermove",Y),window.removeEventListener("pointerup",B),window.removeEventListener("pointercancel",B)}},[e,t,n]);const C=e&&!n?y:e?0:1;return{state:n&&e?"hidden":p,progress:C,isOpen:C>.01}}function cs(e){e.current!==null&&(window.clearTimeout(e.current),e.current=null)}function gv(e,t){return wv(e==="hidden"?t/pv:1-t/pv,0,1)}function yv(e,t,n,s,o){if(e==="hidden"){if(t>=mv){n();return}s("hidden"),o(0);return}if(t<=1-mv){s("hidden"),o(0);return}n()}function lD(e){if(!(e.pointerType!=="pointer"||typeof e.pointerId!="number"||!(e.captureTarget instanceof Element)))try{e.captureTarget.hasPointerCapture(e.pointerId)&&e.captureTarget.releasePointerCapture(e.pointerId)}catch{}}function th(e,t){if(typeof t!="number")return e[0]??null;for(let n=0;n<e.length;n+=1){const s=e[n];if((s==null?void 0:s.identifier)===t)return s}return null}function vv(e){return e instanceof Element?e.closest(".composer-panel"):null}function wv(e,t,n){return Math.min(Math.max(e,t),n)}function bv(e){e.cancelable&&e.preventDefault()}function Fo({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:s}){return e==="compact"?"compact":e==="expanded"&&n&&s?"expanded":t==="tools"&&s?"medium-auxiliary":n?"medium-navigation":s?"medium-auxiliary":"compact"}function Ak(e){return e==="medium-navigation"||e==="expanded"}function Lk(e){return e==="medium-auxiliary"||e==="expanded"}function Qf({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:s,children:o,navigationPanel:c,auxiliaryPanel:l}){const d=Fo({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:s}),p=Ak(d)&&c,m=Lk(d)&&l;return i.jsxs("div",{className:"mobile-adaptive-pane-layout","data-pane-layout":d,children:[p?i.jsx("aside",{className:"workbench-nav surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-navigation",children:c}):null,i.jsx("div",{className:"mobile-adaptive-pane-main",children:o}),m?i.jsx("aside",{className:"workbench-auxiliary surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-auxiliary",children:l}):null]})}function cD({activeEntry:e,presentation:t="default",children:n,navigationPanel:s,auxiliaryPanel:o,onNavigateWorkspaces:c,onNavigateTerminals:l,onNavigateSessions:d,onNavigateTools:p,onNavigateToolFiles:m,onNavigateToolGit:y,onNavigateToolProcesses:g,onNavigateSettings:b}){const x=ar(),C=Fr(),S=Qr(),j=Mn(),M=w.useRef(null),A=t==="conversation-focus",E=Kf({enabled:A,rootRef:M,resetKey:`${S.pathname}${S.search}`}),Z=Fo({viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!o}),Y=Gf({activeEntry:e,presentation:t,pathname:S.pathname,search:S.search,moreButtonLabel:h("shell.androidMoreAction")}),B=[{key:"workspaces",label:h("shell.mobileWorkspacesEntry"),icon:i.jsx(hD,{}),onClick:c},{key:"sessions",label:h("shell.mobileSessionsEntry"),icon:i.jsx(fD,{}),onClick:d},{key:"terminals",label:h("shell.mobileTerminalsEntry"),icon:i.jsx(pD,{}),onClick:l},{key:"tools",label:h("shell.mobileToolsEntry"),icon:i.jsx(mD,{}),onClick:p},{key:"settings",label:h("shell.mobileSettingsEntry"),icon:i.jsx(gD,{}),onClick:b}],I=A?{"--mobile-conversation-tabbar-progress":E.progress.toFixed(4)}:void 0;function _(){const F=qf(S.pathname,S.search);if(!F){p();return}j(F,{replace:!0})}return i.jsxs("div",{ref:M,className:"android-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":Z,"data-tabbar-open":A?E.isOpen:!0,"data-conversation-tabbar-state":A?E.state:"default",style:I,children:[Y?i.jsxs("header",{className:"android-workbench-topbar","data-header-kind":"tools",children:[i.jsxs("div",{className:"android-workbench-topbar-leading",children:[Y.showBackButton?i.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":h("common.back"),onClick:_,children:i.jsx(uD,{})}):null,i.jsx("div",{className:"android-workbench-topbar-copy",children:i.jsx("h1",{children:Y.title})})]}),i.jsx("div",{className:"android-workbench-topbar-actions",children:Y.showMoreButton?i.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":Y.moreButtonLabel,onClick:g,children:i.jsx(dD,{})}):null})]}):null,i.jsx("div",{className:"android-workbench-content",children:i.jsx(Qf,{viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!o,navigationPanel:s,auxiliaryPanel:o,children:n})}),i.jsx("nav",{className:"android-workbench-bottom-nav","aria-label":h("shell.title"),children:B.map(F=>i.jsxs("button",{type:"button",className:"android-workbench-bottom-nav-item","data-active":F.key===e,"aria-current":F.key===e?"page":void 0,onClick:()=>{F.key!==e&&C.trigger("selection"),F.onClick()},children:[i.jsx("span",{className:"android-workbench-bottom-nav-icon","aria-hidden":"true",children:F.icon}),i.jsx("span",{className:"android-workbench-bottom-nav-label",children:F.label})]},F.key))})]})}function uD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"m15 18-6-6 6-6"}),i.jsx("path",{d:"M21 12H9"})]})}function dD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function hD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M8 13h8"})]})}function fD(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function pD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),i.jsx("path",{d:"m7.5 9 3 3-3 3"}),i.jsx("path",{d:"M12.5 15H17"})]})}function mD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M8 6V4.8A1.8 1.8 0 0 1 9.8 3h4.4A1.8 1.8 0 0 1 16 4.8V6"}),i.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M10 11.5h4"})]})}function gD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}const yD=120,ao={viewportHeight:null,keyboardInset:0,keyboardOpen:!1};function Kh(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function vD(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable||e.closest("[contenteditable='true']"))return!0;if(e instanceof HTMLTextAreaElement)return!e.readOnly&&!e.disabled;if(e instanceof HTMLInputElement){if(e.readOnly||e.disabled)return!1;const t=(e.type||"text").toLowerCase();return!["button","checkbox","color","file","hidden","image","radio","range","reset","submit"].includes(t)}return!1}function wD(){var t;if(typeof window>"u")return 0;const e=[window.innerHeight,typeof document<"u"?(t=document.documentElement)==null?void 0:t.clientHeight:0].filter(Kh);return e.length>0?Math.max(...e):0}function xv(){if(typeof window>"u")return ao;const e=window.visualViewport,t=wD(),n=(e==null?void 0:e.height)??t,s=Kh(n)?Math.round(n):null,o=Kh(e==null?void 0:e.offsetTop)?(e==null?void 0:e.offsetTop)??0:0,c=s===null?0:Math.max(0,Math.round(t-s-o));return{viewportHeight:s,keyboardInset:c,keyboardOpen:vD(typeof document<"u"?document.activeElement:null)&&c>=yD}}function nh(e,t){if(typeof document>"u")return;[document.documentElement,document.body].filter(s=>s instanceof HTMLElement).forEach(s=>{if(!e){delete s.dataset.mobileKeyboardOpen,delete s.dataset.mobileViewportBound,s.style.removeProperty("--mobile-shell-viewport-height"),s.style.removeProperty("--mobile-shell-keyboard-inset");return}s.dataset.mobileKeyboardOpen=String(t.keyboardOpen),s.dataset.mobileViewportBound="true",t.viewportHeight===null?s.style.removeProperty("--mobile-shell-viewport-height"):s.style.setProperty("--mobile-shell-viewport-height",`${t.viewportHeight}px`),s.style.setProperty("--mobile-shell-keyboard-inset",`${t.keyboardInset}px`)})}function bD(e){const[t,n]=w.useState(()=>e?xv():ao),s=w.useRef(null);return w.useEffect(()=>{if(!e){n(ao),nh(!1,ao);return}function o(){n(xv())}function c(){s.current!==null&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{s.current=null,o()},0)}o();const l=window.visualViewport;return window.addEventListener("resize",o),window.addEventListener("orientationchange",o),l==null||l.addEventListener("resize",o),l==null||l.addEventListener("scroll",o),document.addEventListener("focusin",o),document.addEventListener("focusout",c),()=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),window.removeEventListener("resize",o),window.removeEventListener("orientationchange",o),l==null||l.removeEventListener("resize",o),l==null||l.removeEventListener("scroll",o),document.removeEventListener("focusin",o),document.removeEventListener("focusout",c),nh(!1,ao)}},[e]),w.useEffect(()=>{nh(e,t)},[e,t]),t}function xD({activeEntry:e,presentation:t="default",children:n,navigationPanel:s,auxiliaryPanel:o,onNavigateWorkspaces:c,onNavigateTerminals:l,onNavigateSessions:d,onNavigateTools:p,onNavigateToolFiles:m,onNavigateToolGit:y,onNavigateToolProcesses:g,onNavigateSettings:b}){const x=ar(),C=Fr(),S=Qr(),j=Mn(),M=w.useRef(null),A=t==="conversation-focus",E=Kf({enabled:A,rootRef:M,resetKey:`${S.pathname}${S.search}`}),Z=Fo({viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!o}),Y=Gf({activeEntry:e,presentation:t,pathname:S.pathname,search:S.search,moreButtonLabel:h("shell.iosMoreAction")}),B=[{key:"workspaces",label:h("shell.mobileWorkspacesEntry"),icon:i.jsx(CD,{}),onClick:c},{key:"sessions",label:h("shell.mobileSessionsEntry"),icon:i.jsx(jD,{}),onClick:d},{key:"terminals",label:h("shell.mobileTerminalsEntry"),icon:i.jsx(ND,{}),onClick:l},{key:"tools",label:h("shell.mobileToolsEntry"),icon:i.jsx(TD,{}),onClick:p},{key:"settings",label:h("shell.mobileSettingsEntry"),icon:i.jsx(PD,{}),onClick:b}],I=A?{"--mobile-conversation-tabbar-progress":E.progress.toFixed(4)}:void 0;function _(){const F=qf(S.pathname,S.search);if(!F){p();return}j(F,{replace:!0})}return i.jsxs("div",{ref:M,className:"ios-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":Z,"data-tabbar-open":A?E.isOpen:!0,"data-conversation-tabbar-state":A?E.state:"default",style:I,children:[Y?i.jsxs("header",{className:"ios-workbench-nav","data-header-kind":"tools",children:[i.jsx("div",{className:"ios-workbench-nav-leading",children:Y.showBackButton?i.jsxs("button",{type:"button",className:"ios-workbench-back-button","aria-label":h("common.back"),onClick:_,children:[i.jsx(kD,{}),i.jsx("span",{children:h("common.back")})]}):null}),i.jsx("div",{className:"ios-workbench-nav-copy",children:i.jsx("h1",{children:Y.title})}),i.jsx("div",{className:"ios-workbench-nav-actions",children:Y.showMoreButton?i.jsx("button",{type:"button",className:"ios-workbench-icon-button","aria-label":Y.moreButtonLabel,onClick:g,children:i.jsx(SD,{})}):null})]}):null,i.jsx("div",{className:"ios-workbench-content",children:i.jsx(Qf,{viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!o,navigationPanel:s,auxiliaryPanel:o,children:n})}),i.jsx("nav",{className:"ios-workbench-tabbar","aria-label":h("shell.title"),children:B.map(F=>i.jsxs("button",{type:"button",className:"ios-workbench-tabbar-item","data-active":F.key===e,"aria-current":F.key===e?"page":void 0,onClick:()=>{F.key!==e&&C.trigger("selection"),F.onClick()},children:[i.jsx("span",{className:"ios-workbench-tabbar-icon","aria-hidden":"true",children:F.icon}),i.jsx("span",{className:"ios-workbench-tabbar-label",children:F.label})]},F.key))})]})}function kD(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:i.jsx("path",{d:"m15 18-6-6 6-6"})})}function SD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function CD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M8 13h8"})]})}function jD(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function ND(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),i.jsx("path",{d:"m7.5 9 3 3-3 3"}),i.jsx("path",{d:"M12.5 15H17"})]})}function TD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[i.jsx("path",{d:"M8 6V4.8A1.8 1.8 0 0 1 9.8 3h4.4A1.8 1.8 0 0 1 16 4.8V6"}),i.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M10 11.5h4"})]})}function PD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}function ED(e){const t=ar();return t.platform==="ios"?i.jsx(xD,{...e}):t.platform==="android"?i.jsx(cD,{...e}):i.jsx(RD,{...e})}function RD({activeEntry:e,presentation:t="default",children:n,navigationPanel:s,auxiliaryPanel:o,onNavigateWorkspaces:c,onNavigateTerminals:l,onNavigateSessions:d,onNavigateTools:p,onNavigateToolFiles:m,onNavigateToolGit:y,onNavigateToolProcesses:g,onNavigateSettings:b}){const x=ar(),C=Fr(),S=Qr(),j=Mn(),M=w.useRef(null),A=bD(x.platform==="web"),E=x.platform==="web"&&A.keyboardOpen,Z=t==="conversation-focus",Y=Kf({enabled:Z,rootRef:M,suspended:E,resetKey:`${S.pathname}${S.search}`}),B=Fo({viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!o}),I=Gf({activeEntry:e,presentation:t,pathname:S.pathname,search:S.search,moreButtonLabel:h("shell.iosMoreAction")}),_=[{key:"workspaces",label:h("shell.mobileWorkspacesEntry"),icon:i.jsx(LD,{}),onClick:c},{key:"sessions",label:h("shell.mobileSessionsEntry"),icon:i.jsx(ID,{}),onClick:d},{key:"terminals",label:h("shell.mobileTerminalsEntry"),icon:i.jsx(DD,{}),onClick:l},{key:"tools",label:h("shell.mobileToolsEntry"),icon:i.jsx(_D,{}),onClick:p},{key:"settings",label:h("shell.mobileSettingsEntry"),icon:i.jsx(FD,{}),onClick:b}],F=Z?{"--mobile-conversation-tabbar-progress":Y.progress.toFixed(4)}:void 0;function R(){const W=qf(S.pathname,S.search);if(!W){p();return}j(W,{replace:!0})}return i.jsxs("div",{ref:M,className:"mobile-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-mobile-runtime":x.platform,"data-mobile-keyboard-open":E,"data-pane-layout":B,"data-tabbar-open":E?!1:Z?Y.isOpen:!0,"data-conversation-tabbar-state":Z?Y.state:"default",style:F,children:[I?i.jsxs("header",{className:"mobile-workbench-header","data-header-kind":"tools",children:[i.jsxs("div",{className:"mobile-workbench-header-leading",children:[I.showBackButton?i.jsx("button",{type:"button",className:"mobile-workbench-header-button","aria-label":h("common.back"),onClick:R,children:i.jsx(MD,{})}):null,i.jsx("div",{className:"mobile-workbench-header-copy",children:i.jsx("h1",{children:I.title})})]}),i.jsx("div",{className:"mobile-workbench-header-actions",children:I.showMoreButton?i.jsx("button",{type:"button",className:"mobile-workbench-header-button mobile-tools-more-button","aria-label":I.moreButtonLabel,onClick:g,children:i.jsx(AD,{})}):null})]}):null,i.jsx("div",{className:"mobile-workbench-content",children:i.jsx(Qf,{viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!s,hasAuxiliaryPanel:!!o,navigationPanel:s,auxiliaryPanel:o,children:n})}),i.jsx("nav",{className:"mobile-workbench-tabbar","aria-label":h("shell.title"),hidden:E,children:_.map(W=>i.jsxs("button",{type:"button",className:"mobile-workbench-tabbar-item","data-active":W.key===e,"aria-current":W.key===e?"page":void 0,onClick:()=>{W.key!==e&&C.trigger("selection"),W.onClick()},children:[i.jsx("span",{className:"mobile-workbench-tabbar-icon","aria-hidden":"true",children:W.icon}),i.jsx("span",{className:"mobile-workbench-tabbar-label",children:W.label})]},W.key))})]})}function MD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("path",{d:"m15 18-6-6 6-6"}),i.jsx("path",{d:"M21 12H9"})]})}function AD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function LD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M8 13h8"})]})}function ID(){return i.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function DD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),i.jsx("path",{d:"m7.5 9 3 3-3 3"}),i.jsx("path",{d:"M12.5 15H17"})]})}function _D(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("path",{d:"M8 6V4.8A1.8 1.8 0 0 1 9.8 3h4.4A1.8 1.8 0 0 1 16 4.8V6"}),i.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),i.jsx("path",{d:"M3 12h18"}),i.jsx("path",{d:"M10 11.5h4"})]})}function FD(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}class Ik{constructor(t){Ze(this,"maxAttempts");Ze(this,"baseDelayMs");Ze(this,"reconnectAttempts",0);Ze(this,"reconnectTimer",null);Ze(this,"disposed",!1);this.options=t,this.maxAttempts=t.maxAttempts??4,this.baseDelayMs=t.baseDelayMs??300}start(){this.options.onReconnect(!1)}markConnected(){this.reconnectAttempts=0,this.options.onStateChange("connected")}markTransientFailure(){this.disposed||this.reconnectAttempts>0||this.options.onStateChange("reconnecting")}markDisconnected(){if(this.disposed)return;if(!cn.getState().autoReconnect){this.options.onStateChange("reconnect_failed");return}if(this.reconnectAttempts+=1,this.reconnectAttempts>this.maxAttempts){this.options.onStateChange("reconnect_failed");return}this.options.onStateChange("reconnecting");const t=this.baseDelayMs*this.reconnectAttempts;this.reconnectTimer=window.setTimeout(()=>{this.options.onReconnect(!0)},t)}reconnectNow(){this.reconnectAttempts=0,this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.options.onReconnect(!0)}close(){this.disposed=!0,this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.options.onStateChange("closed")}}class OD{constructor(t){Ze(this,"socket",null);Ze(this,"disposed",!1);Ze(this,"authRecoveryInFlight",!1);Ze(this,"pendingRefresh",!1);Ze(this,"fileTreeSubscription",null);Ze(this,"gitWorkspaceId",null);Ze(this,"terminalManagerWorkspaceId",null);Ze(this,"workspaceManagementWorkspaceId",null);Ze(this,"pendingFileTreeRefresh",null);Ze(this,"pendingGitRefreshWorkspaceId",null);Ze(this,"pendingTerminalManagerRefreshWorkspaceId",null);Ze(this,"pendingWorkspaceManagementRefreshWorkspaceId",null);Ze(this,"fileTreeListeners",new Set);Ze(this,"gitListeners",new Set);Ze(this,"terminalManagerListeners",new Set);Ze(this,"workspaceManagementListeners",new Set);Ze(this,"connectionManager");this.options=t,this.connectionManager=new Ik({onReconnect:n=>{this.connect(n)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}requestRefresh(){const t=this.socket;if(!kv(t)){this.pendingRefresh=!0;return}t.send(JSON.stringify({type:"workbench.refresh"})),this.pendingRefresh=!1}subscribeFileTree(t,n){this.fileTreeSubscription={workspaceId:t,paths:Sv(n)},this.sendWhenReady({type:"fileTree.subscribe",workspaceId:t,paths:this.fileTreeSubscription.paths})}requestFileTreeRefresh(t,n){const s=Sv(n),o={type:"fileTree.refresh",workspaceId:t,paths:s};this.sendWhenReady(o)?this.pendingFileTreeRefresh=null:this.pendingFileTreeRefresh={workspaceId:t,paths:s}}subscribeGit(t){this.gitWorkspaceId=t,this.sendWhenReady({type:"git.subscribe",workspaceId:t})}requestGitRefresh(t){this.sendWhenReady({type:"git.refresh",workspaceId:t})?this.pendingGitRefreshWorkspaceId=null:this.pendingGitRefreshWorkspaceId=t}subscribeTerminalManager(t){this.terminalManagerWorkspaceId=t,this.sendWhenReady({type:"terminalManager.subscribe",workspaceId:t})}requestTerminalManagerRefresh(t){this.sendWhenReady({type:"terminalManager.refresh",workspaceId:t})?this.pendingTerminalManagerRefreshWorkspaceId=null:this.pendingTerminalManagerRefreshWorkspaceId=t}subscribeWorkspaceManagement(t){this.workspaceManagementWorkspaceId=t,this.sendWhenReady({type:"workspaceManagement.subscribe",workspaceId:t})}requestWorkspaceManagementRefresh(t){this.sendWhenReady({type:"workspaceManagement.refresh",workspaceId:t})?this.pendingWorkspaceManagementRefreshWorkspaceId=null:this.pendingWorkspaceManagementRefreshWorkspaceId=t}addFileTreeSnapshotListener(t){return this.fileTreeListeners.add(t),()=>{this.fileTreeListeners.delete(t)}}addGitSnapshotListener(t){return this.gitListeners.add(t),()=>{this.gitListeners.delete(t)}}addTerminalManagerSnapshotListener(t){return this.terminalManagerListeners.add(t),()=>{this.terminalManagerListeners.delete(t)}}addWorkspaceManagementSnapshotListener(t){return this.workspaceManagementListeners.add(t),()=>{this.workspaceManagementListeners.delete(t)}}close(){var t;this.disposed=!0,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var c;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const n=(c=Sn.getState().session)==null?void 0:c.accessToken;if(!n){this.options.onUnauthorized();return}const s=`${Kb("/ws")}?access_token=${encodeURIComponent(n)}`,o=new WebSocket(s);this.socket=o,o.addEventListener("open",()=>{o.send(JSON.stringify({type:"workbench.subscribe"})),this.pendingRefresh&&this.requestRefresh(),this.fileTreeSubscription&&o.send(JSON.stringify({type:"fileTree.subscribe",workspaceId:this.fileTreeSubscription.workspaceId,paths:this.fileTreeSubscription.paths})),this.pendingFileTreeRefresh&&this.requestFileTreeRefresh(this.pendingFileTreeRefresh.workspaceId,this.pendingFileTreeRefresh.paths),this.gitWorkspaceId&&o.send(JSON.stringify({type:"git.subscribe",workspaceId:this.gitWorkspaceId})),this.pendingGitRefreshWorkspaceId&&this.requestGitRefresh(this.pendingGitRefreshWorkspaceId),this.terminalManagerWorkspaceId&&o.send(JSON.stringify({type:"terminalManager.subscribe",workspaceId:this.terminalManagerWorkspaceId})),this.pendingTerminalManagerRefreshWorkspaceId&&this.requestTerminalManagerRefresh(this.pendingTerminalManagerRefreshWorkspaceId),this.workspaceManagementWorkspaceId&&o.send(JSON.stringify({type:"workspaceManagement.subscribe",workspaceId:this.workspaceManagementWorkspaceId})),this.pendingWorkspaceManagementRefreshWorkspaceId&&this.requestWorkspaceManagementRefresh(this.pendingWorkspaceManagementRefreshWorkspaceId)}),o.addEventListener("message",l=>{var p,m,y,g,b,x,C,S;const d=JSON.parse(l.data);if(d.type==="system.connected"){this.connectionManager.markConnected();return}if(d.type==="session.error"){d.error_code==="UNAUTHORIZED"&&this.handleUnauthorized();return}if(d.type==="fileTree.snapshot"){(m=(p=this.options).onFileTreeSnapshot)==null||m.call(p,d.snapshot),this.fileTreeListeners.forEach(j=>j(d.snapshot));return}if(d.type==="git.snapshot"){(g=(y=this.options).onGitSnapshot)==null||g.call(y,d.snapshot),this.gitListeners.forEach(j=>j(d.snapshot));return}if(d.type==="terminalManager.snapshot"){(x=(b=this.options).onTerminalManagerSnapshot)==null||x.call(b,d.snapshot),this.terminalManagerListeners.forEach(j=>j(d.snapshot));return}if(d.type==="workspaceManagement.snapshot"){(S=(C=this.options).onWorkspaceManagementSnapshot)==null||S.call(C,d.snapshot),this.workspaceManagementListeners.forEach(j=>j(d.snapshot));return}d.type==="workbench.snapshot"&&BD(d.snapshot)&&this.options.onSnapshot(d.snapshot)}),o.addEventListener("close",()=>{this.disposed||this.socket!==o||this.connectionManager.markDisconnected()}),o.addEventListener("error",()=>{this.disposed||this.socket!==o||this.connectionManager.markTransientFailure()})}handleUnauthorized(){if(this.authRecoveryInFlight||this.disposed)return;this.authRecoveryInFlight=!0;const t=this.socket;this.socket=null,t==null||t.close(),Sn.refresh().then(n=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(n.status==="refreshed"){this.connectionManager.reconnectNow();return}if(n.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}sendWhenReady(t){const n=this.socket;return kv(n)?(n.send(JSON.stringify(t)),!0):!1}}function kv(e){const t=typeof WebSocket.OPEN=="number"?WebSocket.OPEN:1;return e!==null&&e.readyState===t}function BD(e){return typeof e!="object"||e===null?!1:Array.isArray(e.items)}function Sv(e){const t=new Set;for(const n of e??[""])t.add(n.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,""));return[...t]}var uc,dc;function Dk(e){var t;if("items"in e)e.items=(t=e.items)===null||t===void 0?void 0:t.map(n=>"rid"in n?n:Dk(n));else if("action"in e&&e.action){const n=new wk;return n.onmessage=e.action,delete e.action,{...e,handler:n}}return e}async function pa(e,t){const n=new wk;if(t&&typeof t=="object"&&("action"in t&&t.action&&(n.onmessage=t.action,delete t.action),"item"in t&&t.item&&typeof t.item=="object"&&"About"in t.item&&t.item.About&&typeof t.item.About=="object"&&"icon"in t.item.About&&t.item.About.icon&&(t.item.About.icon=ni(t.item.About.icon)),"icon"in t&&t.icon&&(t.icon=ni(t.icon)),"items"in t&&t.items)){let s=function(o){var c;return"rid"in o?[o.rid,o.kind]:("item"in o&&typeof o.item=="object"&&(!((c=o.item.About)===null||c===void 0)&&c.icon)&&(o.item.About.icon=ni(o.item.About.icon)),"icon"in o&&o.icon&&(o.icon=ni(o.icon)),"items"in o&&o.items&&(o.items=o.items.map(s)),Dk(o))};t.items=t.items.map(s)}return ge("plugin:menu|new",{kind:e,options:t,handler:n})}class ma extends bk{get id(){return xn(this,uc,"f")}get kind(){return xn(this,dc,"f")}constructor(t,n,s){super(t),uc.set(this,void 0),dc.set(this,void 0),Oi(this,uc,n),Oi(this,dc,s)}}uc=new WeakMap,dc=new WeakMap;class Yf extends ma{constructor(t,n){super(t,n,"MenuItem")}static async new(t){return pa("MenuItem",t).then(([n,s])=>new Yf(n,s))}async text(){return ge("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ge("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ge("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ge("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return ge("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}}class Xf extends ma{constructor(t,n){super(t,n,"Check")}static async new(t){return pa("Check",t).then(([n,s])=>new Xf(n,s))}async text(){return ge("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ge("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ge("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ge("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return ge("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async isChecked(){return ge("plugin:menu|is_checked",{rid:this.rid})}async setChecked(t){return ge("plugin:menu|set_checked",{rid:this.rid,checked:t})}}var Cv;(function(e){e.Add="Add",e.Advanced="Advanced",e.Bluetooth="Bluetooth",e.Bookmarks="Bookmarks",e.Caution="Caution",e.ColorPanel="ColorPanel",e.ColumnView="ColumnView",e.Computer="Computer",e.EnterFullScreen="EnterFullScreen",e.Everyone="Everyone",e.ExitFullScreen="ExitFullScreen",e.FlowView="FlowView",e.Folder="Folder",e.FolderBurnable="FolderBurnable",e.FolderSmart="FolderSmart",e.FollowLinkFreestanding="FollowLinkFreestanding",e.FontPanel="FontPanel",e.GoLeft="GoLeft",e.GoRight="GoRight",e.Home="Home",e.IChatTheater="IChatTheater",e.IconView="IconView",e.Info="Info",e.InvalidDataFreestanding="InvalidDataFreestanding",e.LeftFacingTriangle="LeftFacingTriangle",e.ListView="ListView",e.LockLocked="LockLocked",e.LockUnlocked="LockUnlocked",e.MenuMixedState="MenuMixedState",e.MenuOnState="MenuOnState",e.MobileMe="MobileMe",e.MultipleDocuments="MultipleDocuments",e.Network="Network",e.Path="Path",e.PreferencesGeneral="PreferencesGeneral",e.QuickLook="QuickLook",e.RefreshFreestanding="RefreshFreestanding",e.Refresh="Refresh",e.Remove="Remove",e.RevealFreestanding="RevealFreestanding",e.RightFacingTriangle="RightFacingTriangle",e.Share="Share",e.Slideshow="Slideshow",e.SmartBadge="SmartBadge",e.StatusAvailable="StatusAvailable",e.StatusNone="StatusNone",e.StatusPartiallyAvailable="StatusPartiallyAvailable",e.StatusUnavailable="StatusUnavailable",e.StopProgressFreestanding="StopProgressFreestanding",e.StopProgress="StopProgress",e.TrashEmpty="TrashEmpty",e.TrashFull="TrashFull",e.User="User",e.UserAccounts="UserAccounts",e.UserGroup="UserGroup",e.UserGuest="UserGuest"})(Cv||(Cv={}));class Jf extends ma{constructor(t,n){super(t,n,"Icon")}static async new(t){return pa("Icon",t).then(([n,s])=>new Jf(n,s))}async text(){return ge("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ge("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ge("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ge("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return ge("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async setIcon(t){return ge("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:ni(t)})}}class Zf extends ma{constructor(t,n){super(t,n,"Predefined")}static async new(t){return pa("Predefined",t).then(([n,s])=>new Zf(n,s))}async text(){return ge("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ge("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}}function la([e,t,n]){switch(n){case"Submenu":return new ep(e,t);case"Predefined":return new Zf(e,t);case"Check":return new Xf(e,t);case"Icon":return new Jf(e,t);case"MenuItem":default:return new Yf(e,t)}}class ep extends ma{constructor(t,n){super(t,n,"Submenu")}static async new(t){return pa("Submenu",t).then(([n,s])=>new ep(n,s))}async text(){return ge("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ge("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ge("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ge("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async append(t){return ge("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async prepend(t){return ge("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async insert(t,n){return ge("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(s=>"rid"in s?[s.rid,s.kind]:s),position:n})}async remove(t){return ge("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return ge("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(la)}async items(){return ge("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(la))}async get(t){return ge("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(n=>n?la(n):null)}async popup(t,n){var s;return ge("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(s=n==null?void 0:n.label)!==null&&s!==void 0?s:null,at:t instanceof Ui?t:t?new Ui(t):null})}async setAsWindowsMenuForNSApp(){return ge("plugin:menu|set_as_windows_menu_for_nsapp",{rid:this.rid})}async setAsHelpMenuForNSApp(){return ge("plugin:menu|set_as_help_menu_for_nsapp",{rid:this.rid})}async setIcon(t){return ge("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:ni(t)})}}class aa extends ma{constructor(t,n){super(t,n,"Menu")}static async new(t){return pa("Menu",t).then(([n,s])=>new aa(n,s))}static async default(){return ge("plugin:menu|create_default").then(([t,n])=>new aa(t,n))}async append(t){return ge("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async prepend(t){return ge("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async insert(t,n){return ge("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(s=>"rid"in s?[s.rid,s.kind]:s),position:n})}async remove(t){return ge("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return ge("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(la)}async items(){return ge("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(la))}async get(t){return ge("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(n=>n?la(n):null)}async popup(t,n){var s;return ge("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(s=n==null?void 0:n.label)!==null&&s!==void 0?s:null,at:t instanceof Ui?t:t?new Ui(t):null})}async setAsAppMenu(){return ge("plugin:menu|set_as_app_menu",{rid:this.rid}).then(t=>t?new aa(t[0],t[1]):null)}async setAsWindowMenu(t){var n;return ge("plugin:menu|set_as_window_menu",{rid:this.rid,window:(n=t==null?void 0:t.label)!==null&&n!==void 0?n:null}).then(s=>s?new aa(s[0],s[1]):null)}}async function UD(e){if(e.length===0)return;await(await aa.new({items:e.map(n=>({id:n.id,text:n.label,enabled:!n.disabled,accelerator:n.accelerator,action:()=>{n.onSelect()}}))})).popup(void 0,zf())}const oo=new Map;function _k(){return typeof window<"u"&&typeof window.sessionStorage<"u"}function jv(e,t){return!Number.isFinite(e)||Date.now()-e>t}function Cn(e,t){const n=oo.get(e);if(n&&!jv(n.savedAt,t))return n.value;if(!_k())return null;const s=window.sessionStorage.getItem(e);if(!s)return null;try{const o=JSON.parse(s);return!o||jv(o.savedAt,t)?(window.sessionStorage.removeItem(e),oo.delete(e),null):(oo.set(e,o),o.value)}catch{return window.sessionStorage.removeItem(e),oo.delete(e),null}}function br(e,t){const n={savedAt:Date.now(),value:t};if(oo.set(e,n),!!_k())try{window.sessionStorage.setItem(e,JSON.stringify(n))}catch{}}const zD="codingns.debug.perf";function WD(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(zD)==="1"}catch{return!1}}function Ct(e,t){if(!WD()||typeof performance>"u")return;const n=Math.round(performance.now());if(t&&Object.keys(t).length>0){console.info(`[perf-ui] ${e} ${n}ms`,t);return}console.info(`[perf-ui] ${e} ${n}ms`)}function HD(e,t,n,s){return Xe.request("/api/files/content",{method:"PUT",body:JSON.stringify({workspaceId:e,path:t,content:n,expectedVersion:s??void 0})})}function $D(e){return Xe.request("/api/files/ops",{method:"POST",body:JSON.stringify(e)})}function VD(e){return Xe.request("/api/files/upload",{method:"POST",body:JSON.stringify(e)})}function qD(e,t){const n=new URLSearchParams({workspaceId:e,path:t});return Xe.request(`/api/files/download?${n.toString()}`)}function Qh(e,t,n=1,s=20){const o=new URLSearchParams({workspaceId:e,keyword:t,page:String(n),pageSize:String(s)});return Xe.request(`/api/files/search?${o.toString()}`)}function Nv(e,t){const n=new URLSearchParams({workspaceId:e,path:t});return Xe.request(`/api/files/preview?${n.toString()}`)}const rh=5,ih=["#2563eb","#0891b2","#16a34a","#d97706","#dc2626","#64748b"];function Fk(e){const t=Math.round(e.ratio*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}function Ok(e,t){const n=e.reduce((d,p)=>d+p.count,0);if(n<=0)return[];const o=e.slice(0,rh).map((d,p)=>({...d,key:d.type,ratio:d.count/n,color:ih[p]??ih[0]})),c=e.slice(rh);if(c.length===0)return o;const l=c.reduce((d,p)=>d+p.count,0);return o.push({key:"other",type:t,count:l,ratio:l/n,color:ih[rh]}),o}function GD(e){if(e.length===0)return"conic-gradient(color-mix(in srgb, var(--border-primary) 78%, transparent) 0% 100%)";let t=0;return`conic-gradient(${e.map((s,o)=>{const c=t,l=o===e.length-1?1:Math.min(1,t+s.ratio);return t=l,`${s.color} ${Tv(c)} ${Tv(l)}`}).join(", ")})`}function Bk(e){return{"--workbench-manage-chart-background":GD(e)}}function Tv(e){const t=Math.round(e*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}const KD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAbGSURBVHgBzZo/bBtVHMd/ZzuJA0gYCYlsOFO7xRFDy1R3olucqd0SJtiSjiCknBckpjZjBxRn7BR3owOqs5Wp7tZKoDgSQysh4UqUOCG2eZ/3/Oznv/fObqJ+pfPZd+/ufn++vz/vnQN5FwjbGZFGQSRYUb+yIu2c2tSxIOOMqpktqKpzz9X3ioSLNZkRgUwLhA4aW9KWvPqVl6mgldmVGZSJr0BX8Pb2gIVnRUltxbiKxFOgeLJzAYL3I5BQdhaL/sN9EJ5k1dADw+1LQU1tN328kYgaIMWzDSX4s0sUHmSVwZ5JeFqIGjhZgeKpokyzdKGUGQuyWOtA03YCxlNIC98K5X3AhLgYrYB2ndLeE5l0IFvXklK4mpRsxvyuvmqrrSX71aZUjlsyM4LkpuzM7w8dHhqoAxbO+9Fm63pSwhspLTSo1dt6n830bl1SStx9fK6/Z9LmWL3B1hZ/BHUl1+pgYI9S4Eh0EEVjJ5/SwiPI7m9Nuf+02SfUZi4pO+o8ynDcKmlRqRkPlZ43xQ+q8IXpVfdIsu88vJd2ZOSD/OcJKRXmtMW//PlMyi9a0jjvH5NZCDStEDydCjSlfvm9pa/hd24poc+zf/zH8PUjsCT57wOp/FjpqtQ9pakjR+KJo60Fbdnl3dMubSw4vrc2J/msSXLlF4ZCg+M4zzjGEzM39888aAWVFpYlZN+fRnfEE1iMh8JtVygsDWWefTOvhYMiCLX+8L8h4QHnVx+cas/klgLZvpb0eDrp9d/trjr609P6brbhgesPDXXA5kpS7t0ywYwVi4fERD8noJ1WfIDzBDYeRRw8GscL1gP5iCv0g7FsqAIX4UH9pHeegEb44uG5EuKsT3iuPbg9J08252VPxQ3CoowFGYlgRhEMEY2eFzp3CbbEQ3j28BnXjwI0CSvnXQu6lMJrnOd67qOV6fAf2HuuLPn2l4kbRgGT9yf2OU825o11lXDw+bgenb8LV5JdjwE8s/rAxMPXj0xMkGbxBkpWX8epCRp5WvuERNAHl9qADQ+j8xz0QuGDOz3rIizXW8/wHa7bzISSKAveNCQGGoVElPU3coaTcDQKhmoL3QxEkLMna2FplzKAOCFLGf6b4x+nJQbauURnHjsWWJQg8+1nsChCsZGh2LuUwTvb11J94zfVeVtPGOOej4CuNNlJI2xa9BUeQQaD3FKG83iAdItHClcSQ4rzLJvRohGsRCowqoexyCxKbNiUqVPrnf5MhBL0VKRTv6IWZCJnZJR4bujm7eprY+GD2/M6g/hZyypgKENGspThHha2fqxdjZ4sUg8iRz16aYLXBrN5SLPLa5tBMrGCT3T7wD0GgYcM1XwU0IWsXZ80wPY7WMpVguM2g0ABvMDmZhkXZox4w3dswvQV44FFSIe4vqT46rrbzSAEru1pXF6j1L2vTND6Us10p15Zr5Ywq2OTQRwUO0UMyiCM27PYDDKYLomRoy2VNq+n9HGfbGbvyzM9FWgd+4zMfWY4iaV1v6+assHCZNOl7XcKnUC0bUQ9osrq3qnTevgUTtZYUz4ecGEDDwtjaTYER8jsx0YAO5Gxc2EfyyP83lqq27b4Fc6gqhRolEXSe1FDrRBUZioslrYpkD3WthzHSyg0WNCIkVFeoNWw3S7UsQsAHqiobvQTgrgSNbL80gizdmU4EyEswsNzPMQxV3hqiO1oR3kDoyD87tOm57QStKusUNiUcigRXSlZQRchZW2qpc0Sdg5AbQDuw3XboDIQcwGAUm7uh3LWEPvPx88zRiNgWd5OaBr3o+oBrmeaCJhdDeZ7BB83kbETdjZ3bmzryii6eaDCR8c0PzUk/wOdTX7SFU//bEmg5EYoUiOCvv5H5NXbnuDffpHUGYoxLJN892uvarsgXXIPa/14SJTU+pBepXOWVf5W88yFI58VOWqBW9DAYNM3KQMRE0x4gO2JYmLZrtD1ItLTC3ooK2rKasdvzAIVwNp2PfTqpwmdWZY+CswMKzDeYZp579acNgDjodSLv+IK31JvcT4o218jlhYbM78LcJcUR8EG8xSWrynLL7sHZl7cnQQUoYKvLJn0eVwnHTenCVgxSSbwWNwF4cmm+owsbpeLxLqEC+WhoyPHhosl4Y3hewN4Pyw8mNzfhiehxFgzvRgg/IfhuLPRDXr4ljfwe5f/nkxz/m6HDWMR4zWrPBHPFx+zQ7/BX/d5zRrvRfeFU0pbfVcJHvpeMcVfDfAGby8TG/LO0BFc0vftiwtfzPBnD02rvFnZnrrwVUR3wvEFt5heARddZVDE/uXGjRdt4bru4UWODcfT5WmFdvE/Jeqz44iuBr4AAAAASUVORK5CYII=",QD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAF+0lEQVRYha2XbXBUZxXHf+e5u4SkCZjg0NIWnQLJLgRF5UWnL75MP9gMjqPT2eyC0qlMiYxOUAR206LOyhiSTVscp52O0xamWgu7WTp0qLUz6kht6Qed1L7M5GUTsAoDTRSIJJos2b33+GFfWMJuNqmcT/c595z/+d3nOc+9zxXKWE9Li7tm0fjyqmT6H0t/Fp8sFz9XM+UCauouH8Rx+ifmWWdP7Q0sLRbT98g3lySC/mcSQd+GGwrQt2vzx1G2ZEa6KJ3S1mJxlpOKIDyEmEM3FGCk5vw5YCw3FmFbb9hXfV2gcm/26vINBfhS+LU0qgcKXB9xT1hbr6kdDhtgcYaDxHSNwVBg92Ao0DMY8n97zgAAZnK8U2AoX1D0++rzWfkC44k6wAVghP7C3EQo8Iiijyq61oEDiV2bPjojwKk234pEsPnh/lDgzpyv/olXrwi6qyDsjsQy2ZQXmJdefPWWvp0v3uZ/CLQ9NxZINpxJj84IYDvmOUT2G/T1DD0CUB/pflnhd1eT5Mcnwl90Adi23JzPl9TbAEN7fF9AeapQW5AOicftGQFEOJ+9tEDbB9v8x99r21wLYBlnJ5AGUKhfklz8QEbY3J71nVnZceziUPAbtzvGxAB3wdPH6yPRx6cXvw4gbbm/B5zIO5SvVKjdMxAMrKvviPcpHMyLqvyoN+ybh7AUwIi+M9TaVOGI/SJwc4Fsf6rS2SqgxQBkukPDYTM40RdCZB/Z5gKmEGmzjStq2alBoDqbvF2hEWgF9oEuAvlugdx/Deaz9ZEjvcWKFwXIWaLNv14cDqmwugDvFRVOi8qOrOMdhT6BzQhvoNxzjbjItxo6o8+VqjEjAMBQa1OFXbXwh4KGuLqmDleXToHzwG1FpLs9kah/uvf98IPz08nkSuZbp+vDL4zNCJAHaQt82lH9JfCJ2cQrTFjq8hiZGrfVtQGcDQhrFNYAywELuFw15SwRgN6dvrrahcnkreGXJ0pCtDZVOFULwsCerEBJExhVGAY8FH/Z2cBvPJHY1ySx13cbaXMaqACSwCVRLqlhVNBRVTOm4lxCOSdqPkB0FdA2m5kosGGEHpC3UP2z6uRJb9fx8SwsJEL+nwBNwEKgWqBSoXaORQqtH+VNhDdErJMNnYf/ViqwbBNO3lRbVZFSS9yyIG1jucRuVuGnM6TZZL4d/wS9KEgawIH/gF5EzAWBvzecto9KPG7PqgkBTu0NLHVs7VBlcxnwS8ALgtyp6Kco3S9/OF850lQWYCD41RpMZUiUH5BZmgkRDqmyVaCqeJYeS1dqwJq4UoG56S5w7hb4PMp6YH426LJR1+qSAOrzWYPLZCvIPuAWAIHXxGGXY3geWAV6DOTrJRR+r5q8P9dskNtJ1etBVl4R19FPdh4eLQowEPR5RKxfgebOeGMqGvLMX/V0YrK/W+B+4ATCYZRnEJ5E+Q5gFM4AFwQ+I8hbLks2Ltt/ZKTUg163Rwfamrcj5q/54spvLZes9nZ2/yIx0b8jW/wCLmeLOLoCAEdeAjmYnaWPGXga9Jiia1O28+bAbt8dswJQEFF5IrO2chGVBzxdsY0r2qNnBx5uvkuELkAFedDTHj+nIl4AIzJsjL2XTAOisB+XtqryKLBcLHNyKLSpsSyAgKrKJoRtbksaPV3R5yFz7BaHOOBGOdAQib6SRV4L4KQZqe+I/wvYmZWqE1ue8nbFggjbgDoH/VOxY3vZXdDT0uKuqR37I+jdIH9JV9r3NIbjU717fLe4jPkASDVEYhW5730i2PwqIvdlZkK3eCPdv06E/GuAbmCBJxJbUnIGill13b8fyxRnRG070BiOTwG4MeuyszBSeNiw3KZFYDTzdPLzU7u3LPZEYu+qTq5Tlev+K2YESAQD94rKjqzgl72Pxd/P3VNLsgAyXJizoj161kG3Z4d1aZP6HIC36/i4tyt6dE4AasQNDIhxNnoisXevvZndJcLw9DxvpLsb5XGE9yzD2ZlqzPpVPN0SIf854FaUZz1dsW0fVqdsD5Q05Qhgg7z+oTX+Xyv2pzNX+x+eTlGviPgh3AAAAABJRU5ErkJggg==",YD="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAABzUlEQVR4AeycQQrCQBAEF1+g6J/0o5LPCXmCnnNx0E2nNqGEPciw024VffV0PZ/fHo7BqflBCSgAxd+aAhQAE4DjbYACYAJwvA1QAEwAjrcBCgAIDBRpA2AZClAATACOtwEKgAnA8TZAATABOD7egNc8tz2ftJ+4gPQD9r5fAbDBDQXALx00XgGwGAUoACYAx9sABcAE4HgboACYABxvAxSwJHC7XFryLNP4bzYg7KBar4CKUHiugDDgar0CKkLhuQLCgKv1CqgIhecKCAOu1iugIhSeKyAMuFqvgIpQeK6AMOBq/XAC7o9H6z5fdlRAtp4PJ2BrAHSeAmADClAATACOtwEKgAnA8TZAATABON4GKAAmAMev2AD4JTuNVwAsTgEKgAnA8TZAATABON4GKAAmAMfbAAXABOB4G9ApoPe6AnoJdt5XQCfA3uvDCXhOU0ueXmBr3x9OwNoPHH2fAmBDClAATACOtwEKgAnA8TZAAX8QONAVGwDLVIACYAJwfLwByf/+2WJ32k9cQPoBe9+vANigAhQAE4DjbYACYAJw/A8NgH/pQeMVAItVgAJgAnC8DVAATACOtwEKgAnA8TZAATABON4GFALS4w8AAAD//x7wkLQAAAAGSURBVAMAKj5LkLSa6SQAAAAASUVORK5CYII=",XD=[{provider:"codex"},{provider:"claude-code"},{provider:"opencode"}];function Uk({disabled:e=!1,pendingProvider:t=null,onSelect:n}){const s=Fr();return i.jsx("div",{className:"session-provider-grid",children:XD.map(o=>{const c=JD(o.provider),l=t===o.provider;return i.jsxs("button",{type:"button",className:"session-provider-card","data-provider":o.provider,"data-pending":l?"true":"false","aria-label":c,disabled:e,onClick:()=>{s.trigger("action"),n(o.provider)},children:[i.jsx("span",{className:"session-provider-card-icon","aria-hidden":"true",children:i.jsx("img",{src:ZD(o.provider),alt:"",loading:"lazy"})}),i.jsxs("span",{className:"session-provider-card-copy",children:[i.jsx("strong",{children:c}),l?i.jsx("span",{className:"session-provider-card-status",children:h("shell.startingSession")}):null]})]},o.provider)})})}function JD(e){return h(e==="codex"?"conversation.providerCodex":e==="claude-code"?"shell.providerClaudeCode":"conversation.providerOpenCode")}function ZD(e){return e==="codex"?KD:e==="claude-code"?QD:YD}const Kl={repositoryUrl:"",parentPath:"",directoryName:"",name:"",authMode:"none",username:"",password:"",token:""};function zk({open:e,onClose:t,onCloned:n}){const{showToast:s}=Gn(),[o,c]=w.useState(!1),[l,d]=w.useState(Kl),[p,m]=w.useState(!1),[y,g]=w.useState(!1),[b,x]=w.useState(null),[C,S]=w.useState(""),[j,M]=w.useState(""),[A,E]=w.useState(null),[Z,Y]=w.useState([]),[B,I]=w.useState([]),_=o||y;w.useEffect(()=>{!e&&!o&&(d(Kl),m(!1),x(null))},[o,e]);const F=w.useCallback(async xe=>{g(!0),x(null);try{const q=await ex(xe);S(q.currentPath),M(q.currentPath),E(q.parentPath),Y(q.roots),I(q.items),d(K=>({...K,parentPath:q.currentPath}))}catch(q){S(""),E(null),I([]),x(q instanceof Error?q.message:h("shell.importBrowserBrowseFailed"))}finally{g(!1)}},[]);function R(){o||(m(!1),x(null),d(Kl),t())}function W(){m(!0),F(l.parentPath||void 0)}function J(){o||(m(!1),x(null))}async function re(xe){xe.preventDefault(),await F(j)}function le(){d(xe=>({...xe,parentPath:C})),m(!1),x(null)}async function ie(xe){xe.preventDefault();const q=l.repositoryUrl.trim(),K=l.parentPath.trim();if(!q){s({title:h("shell.cloneRepoRequired"),tone:"error"});return}if(!K){s({title:h("shell.clonePathRequired"),tone:"error"});return}c(!0);try{const me=await ON({repositoryUrl:q,parentPath:K,directoryName:l.directoryName.trim()||void 0,name:l.name.trim()||void 0,auth:l.authMode==="none"?{mode:"none"}:l.authMode==="basic"?{mode:"basic",username:l.username.trim(),password:l.password}:{mode:"token",username:l.username.trim()||void 0,token:l.token}});await(n==null?void 0:n(me)),d(Kl),m(!1),s({title:h("shell.cloneSuccess"),description:me.path,tone:"success"}),t()}catch(me){s({title:me instanceof Error?me.message:h("shell.cloneFailed"),tone:"error"})}finally{c(!1)}}return i.jsxs(i.Fragment,{children:[i.jsx(_r,{open:e,title:h("shell.cloneWorkspaceTitle"),description:h("shell.cloneWorkspaceHint"),onClose:R,children:i.jsxs("form",{className:"workbench-clone-form",onSubmit:xe=>void ie(xe),children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneRepositoryLabel")}),i.jsx("input",{type:"text",value:l.repositoryUrl,placeholder:h("shell.cloneRepositoryPlaceholder"),onChange:xe=>d(q=>({...q,repositoryUrl:xe.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneParentPathLabel")}),i.jsxs("div",{className:"workbench-modal-inline-field",children:[i.jsx("input",{type:"text",value:l.parentPath,placeholder:h("shell.cloneParentPathPlaceholder"),onChange:xe=>d(q=>({...q,parentPath:xe.target.value}))}),i.jsx("button",{type:"button",className:"secondary-button",disabled:o,onClick:W,children:h("shell.clonePickDirectory")})]})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneDirectoryNameLabel")}),i.jsx("input",{type:"text",value:l.directoryName,placeholder:h("shell.cloneDirectoryNamePlaceholder"),onChange:xe=>d(q=>({...q,directoryName:xe.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.importNameLabel")}),i.jsx("input",{type:"text",value:l.name,placeholder:h("shell.importNamePlaceholder"),onChange:xe=>d(q=>({...q,name:xe.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneAuthModeLabel")}),i.jsxs("select",{value:l.authMode,onChange:xe=>d(q=>({...q,authMode:xe.target.value})),children:[i.jsx("option",{value:"none",children:h("shell.cloneAuthModeNone")}),i.jsx("option",{value:"basic",children:h("shell.cloneAuthModeBasic")}),i.jsx("option",{value:"token",children:h("shell.cloneAuthModeToken")})]})]}),l.authMode==="basic"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneUsernameLabel")}),i.jsx("input",{type:"text",value:l.username,placeholder:h("shell.cloneUsernamePlaceholder"),autoComplete:"username",onChange:xe=>d(q=>({...q,username:xe.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.clonePasswordLabel")}),i.jsx("input",{type:"password",value:l.password,placeholder:h("shell.clonePasswordPlaceholder"),autoComplete:"current-password",onChange:xe=>d(q=>({...q,password:xe.target.value}))})]})]}):null,l.authMode==="token"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneUsernameLabel")}),i.jsx("input",{type:"text",value:l.username,placeholder:h("shell.cloneTokenUsernamePlaceholder"),onChange:xe=>d(q=>({...q,username:xe.target.value}))})]}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.cloneTokenLabel")}),i.jsx("input",{type:"password",value:l.token,placeholder:h("shell.cloneTokenPlaceholder"),onChange:xe=>d(q=>({...q,token:xe.target.value}))})]})]}):null,i.jsx("p",{className:"workbench-import-hint",children:h("shell.cloneHint")}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:o,onClick:R,children:h("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:o,children:h(o?"shell.cloneSubmitting":"shell.cloneSubmit")})]})]})}),i.jsxs(_r,{open:e&&p,title:h("shell.cloneBrowserTitle"),description:h("shell.cloneBrowserDescription"),onClose:J,children:[i.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:re,children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.importBrowserCurrentPath")}),i.jsx("input",{type:"text",value:j,placeholder:h("shell.importPathPlaceholder"),onChange:xe=>M(xe.target.value)})]}),i.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:_||!A,onClick:()=>{A&&F(A)},children:h("shell.importBrowserOpenParent")}),i.jsx("button",{type:"submit",className:"secondary-button",disabled:_,children:h("shell.importBrowserOpenPath")})]})]}),i.jsxs("section",{className:"workbench-directory-browser-panel",children:[i.jsxs("div",{className:"workbench-directory-browser-section",children:[i.jsx("span",{className:"workbench-directory-browser-section-title",children:h("shell.importBrowserRoots")}),i.jsx("div",{className:"workbench-directory-browser-root-list",children:Z.map(xe=>i.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:_,onClick:()=>{F(xe.path)},children:xe.name},xe.path))})]}),i.jsx("div",{className:"workbench-directory-browser-current-path",children:C}),b?i.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:b}):null,y?i.jsx("p",{className:"workbench-directory-browser-status status-text",children:h("common.loading")}):B.length>0?i.jsx("div",{className:"workbench-directory-browser-list",children:B.map(xe=>i.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:_,onClick:()=>{F(xe.path)},children:[i.jsx("span",{className:"workbench-directory-browser-item-name",children:xe.name}),i.jsx("span",{className:"workbench-directory-browser-item-path",children:xe.path})]},xe.path))}):i.jsx("p",{className:"workbench-directory-browser-status status-text",children:h("shell.importBrowserEmpty")})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:o,onClick:J,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:_||!C,onClick:le,children:h("shell.cloneBrowserSubmit")})]})]})]})}function Wk({open:e,onClose:t,onImported:n}){const{showToast:s}=Gn(),[o,c]=w.useState(!1),[l,d]=w.useState(!1),[p,m]=w.useState(!1),[y,g]=w.useState(null),[b,x]=w.useState(""),[C,S]=w.useState(""),[j,M]=w.useState(null),[A,E]=w.useState([]),[Z,Y]=w.useState([]),[B,I]=w.useState(!1),[_,F]=w.useState(""),R=o||l||p,W=w.useCallback(async K=>{c(!0),g(null);try{const me=await ex(K);x(me.currentPath),S(me.currentPath),M(me.parentPath),E(me.roots),Y(me.items)}catch(me){x(""),M(null),Y([]),g(me instanceof Error?me.message:h("shell.importBrowserBrowseFailed"))}finally{c(!1)}},[]);w.useEffect(()=>{if(!e){I(!1),F(""),g(null);return}W(b||void 0)},[W,e]);function J(){R||(I(!1),F(""),t())}async function re(K){K.preventDefault(),await W(C)}function le(){!b||R||(F(""),I(!0))}function ie(){l||(I(!1),F(""))}async function xe(K){K==null||K.preventDefault();const me=_.trim();if(!(!b||!me||R)){d(!0),g(null);try{const L=await BN({parentPath:b,directoryName:me});s({title:h("shell.importBrowserCreateDirectorySuccess"),description:L.path,tone:"success"}),I(!1),F(""),await W(L.path)}catch(L){const $=L instanceof Error?L.message:h("shell.importBrowserCreateDirectoryFailed");g($),s({title:$,tone:"error"})}finally{d(!1)}}}async function q(){const K=b.trim();if(!(!K||R)){m(!0);try{const me=await FN({path:K});await(n==null?void 0:n(me)),s({title:h("shell.importSuccess"),description:me.path,tone:"success"}),t()}catch(me){s({title:me instanceof Error?me.message:h("shell.importFailed"),tone:"error"})}finally{m(!1)}}}return i.jsxs(i.Fragment,{children:[i.jsxs(_r,{open:e,title:h("shell.importBrowserTitle"),description:h("shell.importBrowserDescription"),onClose:J,children:[i.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:re,children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.importBrowserCurrentPath")}),i.jsx("input",{type:"text",value:C,placeholder:h("shell.importPathPlaceholder"),onChange:K=>S(K.target.value)})]}),i.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:R||!j,onClick:()=>{j&&W(j)},children:h("shell.importBrowserOpenParent")}),i.jsx("button",{type:"submit",className:"secondary-button",disabled:R,children:h("shell.importBrowserOpenPath")}),i.jsx("button",{type:"button",className:"secondary-button",disabled:R||!b,onClick:le,children:h("shell.importBrowserCreateDirectory")})]})]}),i.jsxs("section",{className:"workbench-directory-browser-panel",children:[i.jsxs("div",{className:"workbench-directory-browser-section",children:[i.jsx("span",{className:"workbench-directory-browser-section-title",children:h("shell.importBrowserRoots")}),i.jsx("div",{className:"workbench-directory-browser-root-list",children:A.map(K=>i.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:R,onClick:()=>{W(K.path)},children:K.name},K.path))})]}),i.jsx("div",{className:"workbench-directory-browser-current-path",children:b}),y?i.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:y}):null,o?i.jsx("p",{className:"workbench-directory-browser-status status-text",children:h("common.loading")}):Z.length>0?i.jsx("div",{className:"workbench-directory-browser-list",children:Z.map(K=>i.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:R,onClick:()=>{W(K.path)},children:[i.jsx("span",{className:"workbench-directory-browser-item-name",children:K.name}),i.jsx("span",{className:"workbench-directory-browser-item-path",children:K.path})]},K.path))}):i.jsx("p",{className:"workbench-directory-browser-status status-text",children:h("shell.importBrowserEmpty")})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:R,onClick:J,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"primary-button",disabled:R||!b,onClick:()=>{q()},children:h(p?"shell.importSubmitting":"shell.importBrowserSubmit")})]})]}),i.jsx(_r,{open:e&&B,title:h("shell.importBrowserCreateDirectoryTitle"),description:h("shell.importBrowserCreateDirectoryDescription"),onClose:ie,children:i.jsxs("form",{className:"workbench-rename-form",onSubmit:K=>void xe(K),children:[i.jsx("div",{className:"workbench-directory-browser-current-path",children:b}),i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.importBrowserCreateDirectoryLabel")}),i.jsx("input",{type:"text",value:_,placeholder:h("shell.importBrowserCreateDirectoryPlaceholder"),autoFocus:!0,onChange:K=>F(K.target.value)})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:l,onClick:ie,children:h("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:l||!_.trim(),children:h(l?"shell.importBrowserCreatingDirectory":"shell.importBrowserCreateDirectorySubmit")})]})]})})]})}const Pv="workbench.left.width",Ev="workbench.right.width",Rv="workbench.left.collapsed",Mv="workbench.right.collapsed",sh="workbench.last.session.path",Av="workbench.workspace.collapsed.ids",ah="workbench.workspace.selected.id",Hk="workbench.navigation.snapshot",e2=280,t2=320,Ql=208,Lv=520,Iv=560,n2=200,oh=20,Yl=40,Xl=5,r2=1800*1e3,Dv=60*1e3,i2="workbench:focus-composer";function _v(e,t){var l,d;const n=["/workspaces/:workspaceId","/workspaces/:workspaceId/sessions","/workspaces/:workspaceId/sessions/:sessionId","/workspaces/:workspaceId/tools","/workspaces/:workspaceId/tools/files","/workspaces/:workspaceId/tools/git","/workspaces/:workspaceId/tools/processes","/workspaces/:workspaceId/terminals"];for(const p of n){const m=kn(p,e),y=(l=m==null?void 0:m.params.workspaceId)==null?void 0:l.trim();if(y)return y}const s=yo(e),o=(s==null?void 0:s.sessionId)??null;return!o||!nS(o)?null:((d=new URLSearchParams(t).get("workspaceId"))==null?void 0:d.trim())||null}function s2(e){return e.startsWith("/sessions")||e.startsWith("/terminals")||e.startsWith("/tools")}function a2(e){return e==="mobile"?qr():"/landing"}function yo(e){var c,l,d;const t=kn("/workspaces/:workspaceId/sessions/:sessionId",e),n=(c=t==null?void 0:t.params.sessionId)==null?void 0:c.trim();if(n)return{sessionId:n,workspaceId:((l=t==null?void 0:t.params.workspaceId)==null?void 0:l.trim())??null};const s=kn("/sessions/:sessionId",e),o=(d=s==null?void 0:s.params.sessionId)==null?void 0:d.trim();return o?{sessionId:o,workspaceId:null}:null}function o2(e){return!!(kn("/sessions",e)||kn("/workspaces/:workspaceId/sessions",e))}function Fv(e){return!!yo(e)}function l2(e){return!!(kn("/tools",e)||kn("/tools/files",e)||kn("/tools/git",e)||kn("/tools/processes",e)||kn("/workspaces/:workspaceId/tools",e)||kn("/workspaces/:workspaceId/tools/files",e)||kn("/workspaces/:workspaceId/tools/git",e)||kn("/workspaces/:workspaceId/tools/processes",e))}function Ov(e){return!!(kn("/terminals",e)||kn("/workspaces/:workspaceId/terminals",e))}const c2=w.lazy(async()=>({default:(await Ic(()=>Promise.resolve().then(()=>MO),void 0)).FileContextPanel})),u2=w.lazy(async()=>({default:(await Ic(()=>Promise.resolve().then(()=>OO),void 0)).GitSidebar})),d2=w.lazy(async()=>({default:(await Ic(()=>Promise.resolve().then(()=>yF),void 0)).TerminalManagerPanel}));function h2(e){return!!(e!=null&&e.session)}function ms(e){return Array.isArray(e==null?void 0:e.children)?e.children:[]}function ro(e){return Array.isArray(e==null?void 0:e.visibleSessionTree)?e.visibleSessionTree.filter(h2):[]}const $k=w.createContext(null);function Tc(e,t){return(t.lastMessageAt??t.updatedAt).localeCompare(e.lastMessageAt??e.updatedAt)}function Yh(e){return e.isSubagent===!0}function io(e){return e.isArchived===!0}function Xh(e){var t;return((t=e.parentSessionId)==null?void 0:t.trim())||null}function f2(e,t){let n=e;const s=new Set([e.sessionId]);for(;;){const o=Xh(n);if(!o)return n.sessionId;const c=t.get(o);if(!c)return n.sessionId;if(s.has(c.sessionId))return e.sessionId;s.add(c.sessionId),n=c}}function Vk(e){const t=new Map(e.map(o=>[o.sessionId,o])),n=new Map,s=[];for(const o of e){const c=f2(o,t);if(c===o.sessionId){s.push(o);continue}const l=n.get(c)??[];n.set(c,[...l,o])}return[...s].sort(Tc).map(o=>({session:o,children:[...n.get(o.sessionId)??[]].sort(Tc)}))}function p2(e){return e.flatMap(t=>[t.session,...ms(t)])}function lh(e,t,n,s=-1){if(e<=0)return 0;const o=s>=0?Math.max(t,s+1):t;return Math.min(e,Math.max(n??0,o))}function Bv(e,t){const n=Object.keys(e),s=Object.keys(t);return n.length!==s.length?!1:n.every(o=>e[o]===t[o])}function m2(e){const t=e.lastMessageAt??e.updatedAt;return t?new Date(t).toLocaleDateString():""}function zc(e,t="compact"){return h(e==="codex"?"conversation.providerCodex":e==="claude-code"?t==="full"?"shell.providerClaudeCode":"conversation.providerClaude":e==="opencode"?"conversation.providerOpenCode":t==="full"?"shell.providerClaudeCode":"conversation.providerClaude")}const g2={position:"relative",zIndex:0},y2={zIndex:1};function qk(e,t,n){const s=[];n&&s.push(t.name);const o=m2(e);return o&&s.push(o),s.join(" · ")||t.name}function Uv(e,t){return t!=null&&t.hasSubagents?e.activityState==="running"||t.isActive?"session-state-indicator is-subagent-running":"session-state-indicator is-subagent":e.activityState==="running"?e.activitySource==="inferred"?"session-state-indicator is-running-inferred":"session-state-indicator is-running":e.activityState==="completed_unread"?"session-state-indicator is-unread":"session-state-indicator is-idle"}function zv(e,t){try{const n=window.localStorage.getItem(e),s=n?Number(n):Number.NaN;return Number.isFinite(s)?s:t}catch{return t}}function Wv(e,t){try{const n=window.localStorage.getItem(e);return n===null?t:n==="true"}catch{return t}}function v2(e){try{const t=window.localStorage.getItem(e);if(!t)return[];const n=JSON.parse(t);if(!Array.isArray(n))return[];const s=[];for(const o of n)typeof o=="string"&&!s.includes(o)&&s.push(o);return s}catch{return[]}}function w2(e){var t;try{const n=(t=window.localStorage.getItem(e))==null?void 0:t.trim();return n||null}catch{return null}}function us(e,t){try{window.localStorage.setItem(e,t)}catch{}}function b2(e){try{window.localStorage.removeItem(e)}catch{}}function Jl(e,t,n){return Math.max(t,Math.min(n,e))}function x2(e){return e instanceof HTMLElement?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||!!e.closest("[contenteditable='true']"):!1}function k2(){typeof window>"u"||window.dispatchEvent(new CustomEvent(i2))}function Hv(e){return!e||!Array.isArray(e.items)?[]:e.items.map(t=>({workspace:t.workspace,sessions:[...t.sessions].sort(Tc)}))}function S2(){return Cn(Hk,r2)}function C2(e,t){let n=!1;const s=e.map(o=>{if(o.workspace.id!==t.workspaceId)return o;const c=o.sessions.findIndex(d=>d.sessionId===t.sessionId),l=c>=0?o.sessions.map((d,p)=>p===c?t:d):[t,...o.sessions];return n=!0,{...o,sessions:[...l].sort(Tc)}});return n?s:e}function j2(e,t,n){let s=!1;const o=e.map(c=>{let l=!1;const d=c.sessions.map(p=>p.sessionId!==t?p:(s=!0,l=!0,{...p,lastSeenAt:p.lastSeenAt&&p.lastSeenAt>n?p.lastSeenAt:n,activityState:p.activityState==="completed_unread"?"idle":p.activityState}));return l?{...c,sessions:d}:c});return s?o:e}function $v(e,t,n){let s=!1;const o=e.map(c=>{let l=!1;const d=c.sessions.map(p=>p.sessionId!==t||p.isArchived===n?p:(s=!0,l=!0,{...p,isArchived:n}));return l?{...c,sessions:d}:c});return s?o:e}function Vv(e,t,n){let s=!1;const o=e.map(c=>{let l=!1;const d=c.sessions.map(p=>p.sessionId!==t||p.isFavorite===!0===n?p:(s=!0,l=!0,{...p,isFavorite:n}));return l?{...c,sessions:d}:c});return s?o:e}function Jh(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function Gk(e,t){const n=e.filter(s=>t.has(s));return n.length===e.length?e:n}function Zh(e){return`workspace-management.summary.${e}`}function Kk(e){return`git-sidebar.snapshot.${e}`}function Qk(e,t){const n=e.repoRoot??null;return{workspaceId:e.id,name:e.name,path:e.path,git:{isRepository:!!n,repoRoot:n,currentBranch:null,commitCount:null,remotes:[],error:null},codeComposition:{scannedFileCount:0,truncated:!1,items:[],error:null}}}function Yk(e,t){const n=e.git.repoRoot??t.repoRoot??null;return{...e,workspaceId:t.id,name:t.name,path:t.path,git:{...e.git,isRepository:e.git.isRepository||!!n,repoRoot:n}}}function Xk(e,t){var o,c,l;const n=((o=t.status)==null?void 0:o.snapshot.repoRoot)??e.git.repoRoot,s=((c=t.status)==null?void 0:c.snapshot.branch)??((l=t.branches)==null?void 0:l.currentBranch)??e.git.currentBranch??null;return{...e,git:{...e.git,isRepository:e.git.isRepository||!!n,repoRoot:n,currentBranch:s,error:null}}}function Jk({count:e,className:t="workbench-skeleton-lines"}){return i.jsx("div",{className:t,"aria-hidden":"true",children:Array.from({length:e},(n,s)=>i.jsx("span",{className:"skeleton-line"},s))})}function N2(){return i.jsx("div",{className:"workbench-nav-loading","aria-hidden":"true",children:Array.from({length:3},(e,t)=>i.jsxs("section",{className:"workbench-skeleton-card",children:[i.jsxs("div",{className:"workbench-skeleton-heading",children:[i.jsx("span",{className:"skeleton-line short"}),i.jsx("span",{className:"skeleton-line tiny"})]}),i.jsx("div",{className:"workbench-skeleton-list",children:Array.from({length:3},(n,s)=>i.jsxs("div",{className:"workbench-skeleton-session",children:[i.jsx("span",{className:"workbench-skeleton-dot"}),i.jsx(Jk,{count:2,className:"workbench-skeleton-lines compact"})]},s))})]},t))})}function Zl(){return i.jsx("section",{className:"workbench-info-skeleton","aria-hidden":"true",children:Array.from({length:4},(e,t)=>i.jsxs("article",{className:"workbench-info-skeleton-card",children:[i.jsx("span",{className:"skeleton-line short"}),i.jsx(Jk,{count:3})]},t))})}function T2({side:e,collapsed:t}){const n=e==="left"?8.5:15.5,s=e==="left"?t?"12 9 15 12 12 15":"15 9 12 12 15 15":t?"12 9 9 12 12 15":"9 9 12 12 9 15";return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("line",{x1:n,y1:"4",x2:n,y2:"20"}),i.jsx("polyline",{points:s})]})}function qv({ariaLabel:e,side:t,collapsed:n,className:s="panel-icon-button",onClick:o}){return i.jsx("button",{className:s,type:"button","aria-label":e,title:e,onClick:o,children:i.jsx(T2,{side:t,collapsed:n})})}function Gv({expanded:e}){return i.jsx("svg",{className:e?"workbench-chevron":"workbench-chevron collapsed",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})}function P2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),i.jsx("polyline",{points:"7 10 12 15 17 10"}),i.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function E2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"}),i.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),i.jsx("line",{x1:"8",y1:"14",x2:"12",y2:"14"}),i.jsx("circle",{cx:"17.5",cy:"15.5",r:"2.5"})]})}function R2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),i.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function M2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("circle",{cx:"11",cy:"11",r:"7"}),i.jsx("line",{x1:"20",y1:"20",x2:"16.65",y2:"16.65"})]})}function A2(){return i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:i.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function L2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("path",{d:"M7 9l3 3-3 3"}),i.jsx("path",{d:"M13 15h4"})]})}function Zk(){return i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"15 18 9 12 15 6"})})}function tp(){return i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("polyline",{points:"9 18 15 12 9 6"})})}function eS(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),i.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),i.jsx("polyline",{points:"14 9 11 12 14 15"})]})}function I2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("circle",{cx:"18",cy:"6",r:"3"}),i.jsx("circle",{cx:"6",cy:"6",r:"3"}),i.jsx("circle",{cx:"18",cy:"18",r:"3"}),i.jsx("path",{d:"M6 9v6a3 3 0 0 0 3 3h3"}),i.jsx("line",{x1:"18",y1:"9",x2:"18",y2:"15"})]})}function D2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("circle",{cx:"12",cy:"12",r:"3"}),i.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}function _2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("rect",{x:"4",y:"5",width:"6",height:"6",rx:"1.5"}),i.jsx("rect",{x:"14",y:"5",width:"6",height:"6",rx:"1.5"}),i.jsx("rect",{x:"4",y:"13",width:"6",height:"6",rx:"1.5"}),i.jsx("path",{d:"M14 16l2 2 4-4"})]})}function F2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("rect",{x:"4",y:"6",width:"10",height:"12",rx:"2"}),i.jsx("path",{d:"M10 12h8"}),i.jsx("path",{d:"M15 8l4 4-4 4"})]})}function O2({selected:e}){return e?i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"}),i.jsx("path",{d:"M8 12.5l2.8 2.8L16.5 9.5"})]}):i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:i.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"})})}function tS({active:e}){return e?i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.5",children:i.jsx("polygon",{points:"12 3 15 9 22 10 17 15 18 22 12 18 6 22 7 15 2 10 9 9"})}):i.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:i.jsx("polygon",{points:"12 3 15 9 22 10 17 15 18 22 12 18 6 22 7 15 2 10 9 9"})})}function B2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M3 7h18"}),i.jsx("path",{d:"M5 7l1 12h12l1-12"}),i.jsx("path",{d:"M9 11h6"}),i.jsx("path",{d:"M8 4h8l1 3H7l1-3z"})]})}function U2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M12 20h9"}),i.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]})}function z2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),i.jsx("path",{d:"M9 13h6"})]})}function W2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[i.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"}),i.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"})]})}function H2(){return i.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[i.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function $2({open:e,mode:t,keyword:n,codeWorkspaceId:s,codeResults:o,codeLoading:c,codeError:l,workspaceOptions:d,sessionResults:p,onClose:m,onModeChange:y,onKeywordChange:g,onCodeWorkspaceChange:b,onCodeSearch:x,onOpenSession:C}){const S=n.trim().length>0&&s.trim().length>0;return i.jsx(_r,{open:e,title:h("shell.searchModalTitle"),description:h("shell.searchModalDescription"),onClose:m,children:i.jsxs("div",{className:"workbench-search-modal",children:[i.jsxs("div",{className:"workbench-search-mode-switch",role:"tablist","aria-label":h("shell.searchModeLabel"),children:[i.jsx("button",{type:"button",className:t==="sessions"?"workbench-search-mode-button active":"workbench-search-mode-button",role:"tab","aria-selected":t==="sessions",onClick:()=>y("sessions"),children:h("shell.searchModeSessions")}),i.jsx("button",{type:"button",className:t==="code"?"workbench-search-mode-button active":"workbench-search-mode-button",role:"tab","aria-selected":t==="code",onClick:()=>y("code"),children:h("shell.searchModeCode")})]}),t==="sessions"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.searchKeywordLabel")}),i.jsx("input",{type:"text",value:n,placeholder:h("shell.searchSessionPlaceholder"),autoFocus:!0,onChange:j=>g(j.target.value)})]}),i.jsx("div",{className:"workbench-search-results",children:n.trim().length===0?i.jsx("p",{className:"workbench-search-empty",children:h("shell.searchSessionHint")}):p.length>0?p.map(j=>{const M=$i(j.session.title,h("common.unknown"));return i.jsxs("button",{type:"button",className:"workbench-search-result-item",onClick:()=>C(j.session.sessionId),children:[i.jsx("span",{className:"workbench-search-result-title",title:M.fullTitle,children:M.displayTitle}),i.jsxs("span",{className:"workbench-search-result-meta",children:[j.workspace.name," · ",zc(j.session.provider,"full")]})]},j.session.sessionId)}):i.jsx("p",{className:"workbench-search-empty",children:h("shell.searchSessionEmpty")})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.searchWorkspaceLabel")}),i.jsx("select",{value:s,onChange:j=>b(j.target.value),children:d.map(j=>i.jsx("option",{value:j.id,children:j.name},j.id))})]}),i.jsxs("form",{className:"workbench-search-code-form",onSubmit:j=>{j.preventDefault(),x()},children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.searchKeywordLabel")}),i.jsx("input",{type:"text",value:n,placeholder:h("shell.searchCodePlaceholder"),autoFocus:!0,onChange:j=>g(j.target.value)})]}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!S||c,children:h(c?"common.loading":"shell.searchSubmit")})]}),i.jsxs("div",{className:"workbench-search-results",children:[l?i.jsx("p",{className:"status-text","data-tone":"error",children:l}):null,!l&&n.trim().length===0?i.jsx("p",{className:"workbench-search-empty",children:h("shell.searchCodeHint")}):null,!l&&n.trim().length>0&&!c&&o.length===0?i.jsx("p",{className:"workbench-search-empty",children:h("shell.searchCodeEmpty")}):null,o.map(j=>i.jsxs("div",{className:"workbench-search-result-item static",children:[i.jsx("span",{className:"workbench-search-result-title",children:j.name}),i.jsx("span",{className:"workbench-search-result-meta",children:j.path})]},`${j.path}-${j.kind}`))]})]})]})})}function ec({menuKey:e,session:t,workspace:n,isActive:s,isFavorite:o,menuOpen:c,showWorkspaceName:l,depth:d=0,showActions:p=!0,hasSubagents:m=!1,subagentListExpanded:y=!1,selectionMode:g=!1,selected:b=!1,onToggleSelect:x,onToggleSubagents:C,onOpen:S,onRename:j,onToggleMenu:M,onToggleFavorite:A,onArchive:E,onCloseMenu:Z,onContextMenu:Y}){var J;const B=((J=t.subagentLabel)==null?void 0:J.trim())||(Yh(t)?h("shell.subagentBadge"):null),I=$i(t.title,h("common.unknown")),_=w.useRef(null),[F,R]=w.useState(null);w.useLayoutEffect(()=>{if(!c){R(null);return}const re=()=>{const le=_.current;if(!le)return;const ie=le.getBoundingClientRect();R({top:`${ie.bottom}px`,left:`${ie.right}px`})};return re(),window.addEventListener("resize",re),window.addEventListener("scroll",re,!0),()=>{window.removeEventListener("resize",re),window.removeEventListener("scroll",re,!0)}},[c]);const W=c&&typeof document<"u"&&F?qn.createPortal(i.jsxs("div",{className:"workbench-session-menu","data-menu-key":e,onClick:re=>re.stopPropagation(),style:F,children:[i.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{j(),Z()},children:[i.jsx(U2,{}),i.jsx("span",{children:h("shell.renameAction")})]}),i.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{A(),Z()},children:[i.jsx(tS,{active:o}),i.jsx("span",{children:h(o?"shell.unfavoriteAction":"shell.favoriteAction")})]}),i.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{E(),Z()},children:[i.jsx(B2,{}),i.jsx("span",{children:h("shell.archiveAction")})]})]}),document.body):null;return i.jsxs("article",{className:"workbench-session-card","data-active":s,"data-depth":d,"data-subagent":Yh(t),"data-has-subagents":m,"data-selecting":g,"data-selected":b,onContextMenu:re=>{g||!Y||(re.preventDefault(),Y())},children:[i.jsxs("div",{className:"workbench-session-main",children:[g?i.jsx("span",{className:"workbench-session-selection-indicator","data-selected":b,"aria-hidden":"true",children:i.jsx(O2,{selected:b})}):m?i.jsxs("button",{type:"button",className:"workbench-session-subagent-toggle",style:y2,"aria-label":h(y?"shell.subagentCollapse":"shell.subagentExpand"),title:h(y?"shell.subagentCollapse":"shell.subagentExpand"),"aria-expanded":y,onClick:re=>{re.stopPropagation(),C==null||C()},children:[i.jsx("span",{className:Uv(t,{hasSubagents:!0,isActive:s}),"data-activity-source":t.activitySource,"aria-hidden":"true"}),i.jsx("span",{className:"workbench-session-subagent-toggle-icon","aria-hidden":"true",children:y?i.jsx(W2,{}):i.jsx(tp,{})})]}):i.jsx("span",{className:Uv(t,{isActive:s}),"data-activity-source":t.activitySource,"aria-hidden":"true"}),i.jsx("button",{type:"button",className:"workbench-session-link",style:m?g2:void 0,"data-active":s,"aria-pressed":g?b:void 0,onClick:g?x:S,children:i.jsxs("div",{className:"workbench-session-link-copy",children:[i.jsxs("div",{className:"session-title-row",children:[i.jsx("span",{className:"session-title",title:I.fullTitle,children:I.displayTitle}),B?i.jsx("span",{className:"session-subagent-badge",children:B}):null]}),i.jsxs("div",{className:"session-meta-row",children:[i.jsx("span",{className:"session-meta",children:qk(t,n,l)}),i.jsx("span",{className:`session-provider-badge ${t.provider}`,children:zc(t.provider)})]})]})})]}),p&&!g?i.jsx("div",{className:"workbench-session-actions","data-open":c,children:i.jsx("button",{ref:_,type:"button",className:"workbench-session-menu-trigger","data-open":c,"aria-label":h("shell.sessionMoreAction"),title:h("shell.sessionMoreAction"),"aria-expanded":c,onClick:re=>{re.stopPropagation(),M()},children:i.jsx(H2,{})})}):null,W]})}function Kv({workspaceGroups:e,favoriteSessions:t,favoriteSessionIds:n,activeWorkspaceId:s,isConversationActive:o,isTerminalActive:c,isSearchOpen:l,navigationLoading:d,navigationError:p,activeSessionId:m,onRefreshNavigation:y,onSessionUpdated:g,onNavigateConversation:b,onNavigateTerminals:x,onOpenSearch:C,onOpenSettings:S,onSelectWorkspace:j,onToggleWorkspaceCollapse:M,subscribeGitSnapshot:A,requestGitRefresh:E,subscribeWorkspaceManagementSnapshot:Z,requestWorkspaceManagementRefresh:Y,onToggleFavoriteSession:B,onArchiveSession:I,onUnarchiveSession:_,workspaceManagementStateById:F,setWorkspaceManagementStateById:R,onClose:W,onToggleCollapse:J}){var Yn;const re=Mn(),le=ar(),{showToast:ie}=Gn(),xe=w.useCallback(Q=>{!le.isDesktop||le.ui.osFamily!=="macos"||Q.button!==0||Wf(Q.target)&&Hf()},[le.isDesktop,le.ui.osFamily]),[q,K]=w.useState(!1),[me,L]=w.useState(!1),[$,se]=w.useState(!1),[P,be]=w.useState([]),[ke,ve]=w.useState(null),[Ae,Be]=w.useState(null),[qe,nt]=w.useState(null),[wt,ze]=w.useState(null),[Ot,Je]=w.useState(null),[_t,bt]=w.useState(null),[et,pt]=w.useState(null),[Nt,Bt]=w.useState(oh),[Rt,ne]=w.useState({}),[He,tt]=w.useState({}),[Tt,ce]=w.useState([]),[Se,Le]=w.useState(null),[de,Ne]=w.useState(""),[ut,Wt]=w.useState(null),[dt,xt]=w.useState(null),[mt,ct]=w.useState([]),[Ht,St]=w.useState(!1),Pt=((Yn=e.find(Q=>Q.workspace.id===Ot))==null?void 0:Yn.workspace)??null,Ft=e.find(Q=>Q.workspace.id===_t)??null,At=e.find(Q=>Q.workspace.id===dt)??null,Yt=w.useMemo(()=>At?p2(ro(At)):[],[At]),Gt=w.useMemo(()=>Yt.map(Q=>Q.sessionId),[Yt]),nn=w.useMemo(()=>new Set(Gt),[Gt]),vn=w.useMemo(()=>new Set(mt),[mt]),Pn=Gt.length>0&&mt.length===Gt.length;w.useEffect(()=>{R(Q=>{const we=new Set(e.map(Fe=>Fe.workspace.id)),pe={};Object.entries(Q).forEach(([Fe,$t])=>{we.has(Fe)&&(pe[Fe]=$t)}),e.forEach(Fe=>{const $t=Cn(Zh(Fe.workspace.id),Dv),Ut=Cn(Kk(Fe.workspace.id),Dv),cr=pe[Fe.workspace.id];let dn=Yk((cr==null?void 0:cr.detail)??$t??Qk(Fe.workspace),Fe.workspace);(Ut!=null&&Ut.status||Ut!=null&&Ut.branches)&&(dn=Xk(dn,{workspaceId:Fe.workspace.id,status:Ut.status??null,branches:Ut.branches??null})),pe[Fe.workspace.id]={detail:dn,loading:!1,error:null}});const at=Object.keys(Q),ht=Object.keys(pe);return at.length===ht.length&&ht.every(Fe=>Q[Fe]===pe[Fe])?Q:pe})},[e]);const pn=w.useCallback(async Q=>{await y(),await le.bridge.showNotification(h("shell.importSuccess"),Q.path)},[y,le.bridge]),an=w.useCallback(async Q=>{await y(),await le.bridge.showNotification(h("shell.cloneSuccess"),Q.path)},[y,le.bridge]);function An(Q){if(P.includes(Q)){be(pe=>pe.filter(at=>at!==Q));return}be(pe=>[...pe,Q]),A(Q),E(Q),Z(Q),Y(Q)}async function D(){if(!(!ke||Ae)){Be(ke.id);try{await Zb(ke.id),be(Q=>Q.filter(we=>we!==ke.id)),R(Q=>{const we={...Q};return delete we[ke.id],we}),ve(null),await y(),ie({title:h("shell.manageWorkspaceRemoveSuccess"),tone:"success"})}catch(Q){ie({title:Q instanceof Error?Q.message:h("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{Be(null)}}}w.useEffect(()=>{if(!et)return;function Q(we){const pe=we.target;pe instanceof HTMLElement&&(pe.closest(".workbench-session-actions")||pe.closest(".workbench-session-menu"))||pt(null)}return window.addEventListener("pointerdown",Q),()=>{window.removeEventListener("pointerdown",Q)}},[et]),w.useEffect(()=>{if(!dt){mt.length>0&&ct([]);return}if(!At){xt(null),ct([]);return}ct(Q=>Gk(Q,nn))},[At,nn,dt,mt.length]),w.useEffect(()=>{dt&&Gt.length===0&&(xt(null),ct([]))},[Gt.length,dt]),w.useEffect(()=>{const Q=new Set(e.map(we=>we.workspace.id));be(we=>we.filter(pe=>Q.has(pe))),ve(we=>we&&Q.has(we.id)?we:null)},[e]),w.useEffect(()=>{const Q=t.findIndex(we=>we.session.sessionId===m);Bt(we=>{const pe=lh(t.length,oh,we,Q);return pe===we?we:pe})},[m,t]),w.useEffect(()=>{ne(Q=>{const we={};for(const pe of e){const at=ro(pe),ht=at.findIndex(Fe=>Fe.session.sessionId===m||ms(Fe).some($t=>$t.sessionId===m));we[pe.workspace.id]=lh(at.length,Yl,Q[pe.workspace.id],ht)}return Bv(Q,we)?Q:we})},[m,e]),w.useEffect(()=>{tt(Q=>{const we={};for(const pe of e)for(const at of ro(pe)){const ht=ms(at);if(ht.length===0)continue;const Fe=ht.findIndex($t=>$t.sessionId===m);we[at.session.sessionId]=lh(ht.length,Xl,Q[at.session.sessionId],Fe)}return Bv(Q,we)?Q:we})},[m,e]),w.useEffect(()=>{if(!m)return;const Q=e.flatMap(we=>ro(we).filter(pe=>ms(pe).some(at=>at.sessionId===m)).map(pe=>pe.session.sessionId));Q.length!==0&&ce(we=>{const pe=new Set(we);let at=!1;for(const ht of Q)pe.has(ht)||(pe.add(ht),at=!0);return at?Array.from(pe):we})},[m,e]);function T(){K(!0)}function O(){L(!0)}function H(Q){return He[Q]??Xl}function oe(Q){return Tt.includes(Q)}function ye(Q){return Rt[Q]??Yl}function Re(){Bt(Q=>Math.min(t.length,Q+oh))}function Ge(Q,we){ne(pe=>({...pe,[Q]:Math.min(we,(pe[Q]??Yl)+Yl)}))}function Ie(Q){tt(we=>({...we,[Q]:(we[Q]??Xl)+Xl}))}function Oe(Q){ce(we=>we.includes(Q)?we.filter(pe=>pe!==Q):[...we,Q])}function Me(Q){for(const we of e){const pe=Vk(we.visibleSessions).find(at=>at.session.sessionId===Q);if(pe)return ms(pe)}return[]}function U(Q){pt(null),xt(Q),ct([])}function fe(){xt(null),ct([])}function ee(Q){ct(we=>Jh(we,Q))}function _e(){ct(Q=>Q.length===Gt.length?[]:Gt)}async function De(Q,we){nt(Q),ze(we);try{Je(null),re(Rk(Q,we)),W==null||W()}catch(pe){ie({title:pe instanceof Error?pe.message:h("shell.startSessionFailed"),tone:"error"})}finally{nt(null),ze(null)}}async function Ue(Q){const we=n.has(Q);pt(null);try{await B(Q),ie({title:h(we?"shell.favoriteRemoved":"shell.favoriteAdded"),tone:"success"})}catch(pe){ie({title:pe instanceof Error?pe.message:h("shell.favoriteToggleFailed"),tone:"error"})}}async function ot(Q){pt(null);try{await I(Q),ie({title:h("shell.archiveAdded"),tone:"success"})}catch(we){ie({title:we instanceof Error?we.message:h("shell.navigationLoadFailed"),tone:"error"})}}async function un(){if(!(mt.length===0||Ht)){pt(null),St(!0);try{const Q=[...mt],we=await Promise.allSettled(Q.map(async ht=>({sessionId:ht,session:await nx(ht,!0)}))),pe=[];let at=0;for(const ht of we){if(ht.status==="fulfilled"){pe.push(ht.value.sessionId),g(ht.value.session);continue}at+=1}pe.length>0&&(await y(),ct(ht=>ht.filter(Fe=>!pe.includes(Fe)))),at>0?ie({title:pe.length>0?h("shell.batchArchivePartialFailed"):h("shell.batchArchiveFailed"),tone:"error"}):ie({title:h("shell.batchArchiveSuccess"),tone:"success"})}catch(Q){ie({title:Q instanceof Error?Q.message:h("shell.batchArchiveFailed"),tone:"error"})}finally{St(!1)}}}async function Ln(Q){pt(null);try{await _(Q),ie({title:h("shell.archiveRestored"),tone:"success"})}catch(we){ie({title:we instanceof Error?we.message:h("shell.navigationLoadFailed"),tone:"error"})}}function on(Q,we){pt(null),Le({session:Q,workspace:we}),Ne(Q.title)}async function vt(Q){if(Q.preventDefault(),!Se)return;const we=de.trim();if(we){Wt(Se.session.sessionId);try{const pe=await tx(Se.session.sessionId,we);g(pe),Le(null),Ne(""),ie({title:h("shell.renameSuccess"),tone:"success"})}catch(pe){ie({title:pe instanceof Error?pe.message:h("shell.renameFailed"),tone:"error"})}finally{Wt(null)}}}async function kr(Q){if(!le.isDesktop)return;const we=n.has(Q.session.sessionId);await UD([{id:`open-${Q.session.sessionId}`,label:h("shell.contextOpenSession"),onSelect:()=>{re(Vn(Q.workspace.id,Q.session.sessionId)),W==null||W()}},{id:`rename-${Q.session.sessionId}`,label:h("shell.renameAction"),onSelect:()=>on(Q.session,Q.workspace)},{id:`favorite-${Q.session.sessionId}`,label:h(we?"shell.unfavoriteAction":"shell.favoriteAction"),onSelect:()=>Ue(Q.session.sessionId)},{id:`archive-${Q.session.sessionId}`,label:h("shell.archiveAction"),onSelect:()=>{ot(Q.session.sessionId)}}])}const Kn=t.slice(0,Nt),Qn=Kn.length<t.length;return i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"workbench-nav-header","data-window-drag-handle":"workbench-nav-header",onMouseDownCapture:xe,children:i.jsxs("div",{className:"workbench-nav-toolbar",children:[J?i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.hideSessionSidebar"),title:h("shell.hideSessionSidebar"),onClick:J,children:i.jsx(eS,{})}):null,i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.goBack"),title:h("shell.goBack"),onClick:()=>re(-1),children:i.jsx(Zk,{})}),i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.goForward"),title:h("shell.goForward"),onClick:()=>re(1),children:i.jsx(tp,{})})]})}),i.jsxs("div",{className:"workbench-nav-body",children:[i.jsxs("div",{className:"workbench-nav-segment",role:"tablist","aria-label":h("shell.centerTabsLabel"),children:[i.jsxs("button",{type:"button",className:o?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":o,onClick:b,children:[i.jsx(A2,{}),h("shell.conversationEntry")]}),i.jsxs("button",{type:"button",className:c?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":c,onClick:x,children:[i.jsx(L2,{}),h("shell.terminalsEntry")]}),i.jsxs("button",{type:"button",className:"workbench-nav-segment-button","data-open":l,"aria-haspopup":"dialog","aria-expanded":l,onClick:C,children:[i.jsx(M2,{}),i.jsx("span",{children:h("shell.searchEntry")})]})]}),p?i.jsx("div",{className:"workbench-status-row",children:i.jsx("p",{className:"status-text","data-tone":"error",children:p})}):null,t.length>0?i.jsxs("section",{className:"workbench-section-block",children:[i.jsxs("div",{className:"workbench-section-heading",children:[i.jsxs("div",{className:"workbench-section-heading-main",children:[i.jsx(tS,{active:!0}),i.jsx("span",{children:h("shell.favoriteSectionTitle")})]}),i.jsx("span",{className:"workbench-section-counter",children:t.length})]}),i.jsxs("div",{className:"workbench-session-list",children:[Kn.map(Q=>{const we=Me(Q.session.sessionId),pe=oe(Q.session.sessionId),at=pe?we.slice(0,H(Q.session.sessionId)):[],ht=pe&&at.length<we.length;return i.jsxs("div",{className:"workbench-session-tree-node",children:[i.jsx(ec,{menuKey:`favorite:${Q.session.sessionId}`,session:Q.session,workspace:Q.workspace,isActive:Q.session.sessionId===m,isFavorite:n.has(Q.session.sessionId),menuOpen:et===`favorite:${Q.session.sessionId}`,showWorkspaceName:!0,hasSubagents:we.length>0,subagentListExpanded:pe,onToggleSubagents:()=>Oe(Q.session.sessionId),onOpen:()=>{re(Vn(Q.workspace.id,Q.session.sessionId)),W==null||W()},onRename:()=>on(Q.session,Q.workspace),onToggleMenu:()=>pt(Fe=>Fe===`favorite:${Q.session.sessionId}`?null:`favorite:${Q.session.sessionId}`),onToggleFavorite:()=>Ue(Q.session.sessionId),onArchive:()=>ot(Q.session.sessionId),onCloseMenu:()=>pt(null),onContextMenu:le.isDesktop?()=>{kr(Q)}:void 0}),we.length>0&&pe?i.jsxs("div",{className:"workbench-subsession-list",children:[at.map(Fe=>i.jsx(ec,{menuKey:`favorite:${Fe.sessionId}`,session:Fe,workspace:Q.workspace,isActive:Fe.sessionId===m,isFavorite:!1,menuOpen:!1,showWorkspaceName:!0,depth:1,showActions:!1,onOpen:()=>{re(Vn(Q.workspace.id,Fe.sessionId)),W==null||W()},onRename:()=>{},onToggleMenu:()=>{},onToggleFavorite:()=>{},onArchive:()=>{},onCloseMenu:()=>{},onContextMenu:le.isDesktop?()=>{kr({session:Fe,workspace:Q.workspace})}:void 0},Fe.sessionId)),ht?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Ie(Q.session.sessionId),children:h("shell.subagentExpandMore")}):null]}):null]},Q.session.sessionId)}),Qn?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:Re,children:h("shell.favoriteExpandMore")}):null]})]}):null,d&&e.length===0?i.jsx(N2,{}):null,!d&&!p&&e.length===0?i.jsx("div",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("shell.emptyNavigationBody")})}):null,i.jsxs("section",{className:"workbench-section-block workbench-workspace-section",children:[i.jsxs("div",{className:"workbench-section-heading",children:[i.jsx("div",{className:"workbench-section-heading-main",children:i.jsx("span",{children:h("shell.workspaceSectionTitle")})}),i.jsxs("div",{className:"workbench-section-actions",children:[i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.manageWorkspaceAction"),title:h("shell.manageWorkspaceAction"),onClick:()=>se(!0),children:i.jsx(E2,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.importWorkspaceTitle"),title:h("shell.importWorkspaceTitle"),onClick:T,children:i.jsx(P2,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.cloneWorkspaceTitle"),title:h("shell.cloneWorkspaceTitle"),onClick:O,children:i.jsx(I2,{})})]})]}),e.map(Q=>{const we=ro(Q);return i.jsxs("section",{className:"workbench-workspace-group","data-batch-active":dt===Q.workspace.id,children:[i.jsxs("div",{className:"workbench-workspace-header minimal",children:[i.jsxs("button",{type:"button",className:"workbench-workspace-toggle","aria-label":Q.isCollapsed?h("shell.workspaceExpand"):h("shell.workspaceCollapse"),onClick:()=>M(Q.workspace.id),children:[i.jsx(Gv,{expanded:!Q.isCollapsed}),i.jsx("strong",{children:Q.workspace.name})]}),dt===Q.workspace.id?i.jsxs("div",{className:"workbench-workspace-batch-toolbar",children:[i.jsx("span",{className:"workbench-workspace-batch-label",children:h("shell.batchSelectionMode")}),i.jsxs("span",{className:"workbench-workspace-batch-counter",children:[mt.length,"/",Gt.length]}),i.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:_e,children:h(Pn?"shell.clearSelectedSessions":"shell.selectAllSessions")}),i.jsx("button",{type:"button",className:"workbench-workspace-batch-action primary",disabled:mt.length===0||Ht,onClick:()=>{un()},children:h(Ht?"shell.batchArchiving":"shell.batchArchiveAction")}),i.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:fe,children:h("common.cancel")})]}):i.jsxs("div",{className:"workbench-workspace-actions",children:[i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.switchWorkspace"),title:h("shell.switchWorkspace"),"aria-pressed":s===Q.workspace.id,onClick:()=>{j(Q.workspace.id),W==null||W()},children:i.jsx(F2,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":h("shell.batchSelectSessions"),title:h("shell.batchSelectSessions"),onClick:()=>U(Q.workspace.id),children:i.jsx(_2,{})}),i.jsx("button",{type:"button",className:"workbench-workspace-icon-button workbench-workspace-create","aria-label":h("shell.createSession"),title:h("shell.createSession"),onClick:()=>Je(Q.workspace.id),children:i.jsx(R2,{})})]})]}),Q.isCollapsed?null:i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"workbench-session-list",children:[we.length===0?i.jsx("p",{className:"workbench-session-empty",children:h("shell.emptyWorkspaceSessions")}):we.slice(0,ye(Q.workspace.id)).map(pe=>{const at=ms(pe),ht=oe(pe.session.sessionId),Fe=ht?at.slice(0,H(pe.session.sessionId)):[],$t=ht&&Fe.length<at.length;return i.jsxs("div",{className:"workbench-session-tree-node",children:[i.jsx(ec,{menuKey:`workspace:${Q.workspace.id}:${pe.session.sessionId}`,session:pe.session,workspace:Q.workspace,isActive:pe.session.sessionId===m,isFavorite:n.has(pe.session.sessionId),menuOpen:et===`workspace:${Q.workspace.id}:${pe.session.sessionId}`,showWorkspaceName:!1,hasSubagents:at.length>0,subagentListExpanded:ht,selectionMode:dt===Q.workspace.id,selected:vn.has(pe.session.sessionId),onToggleSelect:()=>ee(pe.session.sessionId),onToggleSubagents:()=>Oe(pe.session.sessionId),onOpen:()=>{re(Vn(Q.workspace.id,pe.session.sessionId)),W==null||W()},onRename:()=>on(pe.session,Q.workspace),onToggleMenu:()=>pt(Ut=>Ut===`workspace:${Q.workspace.id}:${pe.session.sessionId}`?null:`workspace:${Q.workspace.id}:${pe.session.sessionId}`),onToggleFavorite:()=>Ue(pe.session.sessionId),onArchive:()=>ot(pe.session.sessionId),onCloseMenu:()=>pt(null),onContextMenu:le.isDesktop?()=>{kr({session:pe.session,workspace:Q.workspace})}:void 0}),at.length>0&&ht?i.jsxs("div",{className:"workbench-subsession-list",children:[Fe.map(Ut=>i.jsx(ec,{menuKey:`workspace:${Q.workspace.id}:${Ut.sessionId}`,session:Ut,workspace:Q.workspace,isActive:Ut.sessionId===m,isFavorite:!1,menuOpen:!1,showWorkspaceName:!1,depth:1,showActions:!1,selectionMode:dt===Q.workspace.id,selected:vn.has(Ut.sessionId),onToggleSelect:()=>ee(Ut.sessionId),onOpen:()=>{re(Vn(Q.workspace.id,Ut.sessionId)),W==null||W()},onRename:()=>{},onToggleMenu:()=>{},onToggleFavorite:()=>{},onArchive:()=>{},onCloseMenu:()=>{},onContextMenu:le.isDesktop?()=>{kr({session:Ut,workspace:Q.workspace})}:void 0},Ut.sessionId)),$t?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Ie(pe.session.sessionId),children:h("shell.subagentExpandMore")}):null]}):null]},pe.session.sessionId)}),we.length>ye(Q.workspace.id)?i.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Ge(Q.workspace.id,we.length),children:h("shell.sessionExpandMore")}):null]}),i.jsxs("button",{type:"button",className:"workbench-archive-folder",onClick:()=>bt(Q.workspace.id),children:[i.jsxs("span",{className:"workbench-archive-folder-main",children:[i.jsx(z2,{}),i.jsx("span",{children:h("shell.archiveFolderLabel")})]}),i.jsx("span",{className:"workbench-section-counter",children:Q.archivedSessions.length})]})]})]},Q.workspace.id)})]})]}),i.jsx("div",{className:"workbench-nav-footer minimal",children:i.jsxs("button",{className:"settings-entry-button workbench-nav-settings-button",type:"button",onClick:S,title:h("settings.title"),children:[i.jsx(D2,{}),i.jsx("span",{className:"settings-entry-label",children:h("settings.title")})]})}),i.jsx(_r,{open:$,title:h("shell.manageWorkspaceTitle"),description:h("shell.manageWorkspaceDescription"),onClose:()=>{Ae||se(!1)},children:e.length>0?i.jsx("div",{className:"workbench-manage-list",children:e.map(Q=>{var cr;const we=P.includes(Q.workspace.id),pe=F[Q.workspace.id]??{detail:null,loading:!1,error:null},at=Ae===Q.workspace.id,ht=(cr=pe.detail)!=null&&cr.git.remotes.length?pe.detail.git.remotes.map(dn=>`${dn.name}: ${dn.url}`).join(" · "):h("shell.manageWorkspaceNoRemote"),Fe=Q.visibleSessions.length+Q.archivedSessions.length,$t=pe.detail?Ok(pe.detail.codeComposition.items,h("shell.manageWorkspaceCodeCompositionOther")):[],Ut=$t.length>0?Bk($t):void 0;return i.jsxs("article",{className:"workbench-manage-item",children:[i.jsxs("button",{type:"button",className:"workbench-manage-item-toggle","aria-expanded":we,onClick:()=>An(Q.workspace.id),children:[i.jsxs("span",{className:"workbench-manage-item-heading",children:[i.jsx(Gv,{expanded:we}),i.jsx("strong",{children:Q.workspace.name})]}),i.jsx("span",{className:"workbench-section-counter",children:Fe})]}),we?i.jsxs("div",{className:"workbench-manage-item-body",children:[i.jsxs("div",{className:"workbench-manage-detail-block",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspacePathLabel")}),i.jsx("p",{className:"workbench-manage-detail-value",children:Q.workspace.path})]}),pe.loading&&pe.detail===null?i.jsx("p",{className:"workbench-manage-status status-text",children:h("shell.manageWorkspaceLoading")}):null,pe.error?i.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:pe.error}):null,pe.detail?i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"workbench-manage-detail-block",children:i.jsxs("div",{className:"workbench-manage-detail-header",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspaceGitCommitCount")}),i.jsx("strong",{className:"workbench-manage-detail-accent",children:pe.detail.git.commitCount??"--"})]})}),i.jsxs("div",{className:"workbench-manage-detail-block",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspaceGitInfoLabel")}),pe.detail.git.isRepository?i.jsxs("div",{className:"workbench-manage-kv-list",children:[i.jsxs("div",{className:"workbench-manage-kv-item",children:[i.jsx("span",{children:h("shell.manageWorkspaceRepoRoot")}),i.jsx("span",{children:pe.detail.git.repoRoot??"--"})]}),i.jsxs("div",{className:"workbench-manage-kv-item",children:[i.jsx("span",{children:h("shell.manageWorkspaceCurrentBranch")}),i.jsx("span",{children:pe.detail.git.currentBranch??"--"})]}),i.jsxs("div",{className:"workbench-manage-kv-item",children:[i.jsx("span",{children:h("shell.manageWorkspaceRemoteLabel")}),i.jsx("span",{children:ht})]})]}):i.jsx("p",{className:"workbench-section-empty",children:pe.detail.git.error??h("shell.manageWorkspaceNotGit")})]}),i.jsxs("div",{className:"workbench-manage-detail-block",children:[i.jsx("span",{className:"workbench-manage-detail-label",children:h("shell.manageWorkspaceCodeCompositionLabel")}),$t.length>0?i.jsxs("div",{className:"workbench-manage-type-chart",children:[i.jsxs("div",{className:"workbench-manage-type-chart-ring",style:Ut,"aria-hidden":"true",children:[i.jsx("strong",{className:"workbench-manage-type-chart-total",children:pe.detail.codeComposition.scannedFileCount}),i.jsx("span",{className:"workbench-manage-type-chart-caption",children:h("shell.manageWorkspaceCodeCompositionFiles")})]}),i.jsx("div",{className:"workbench-manage-type-list",children:$t.map(dn=>i.jsxs("div",{className:"workbench-manage-type-item",children:[i.jsxs("span",{className:"workbench-manage-type-meta",children:[i.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:dn.color},"aria-hidden":"true"}),i.jsx("span",{className:"workbench-manage-type-name",children:dn.type})]}),i.jsxs("span",{children:[dn.count," · ",Fk(dn)]})]},dn.key))})]}):i.jsx("p",{className:"workbench-section-empty",children:pe.detail.codeComposition.error??h("shell.manageWorkspaceNoCodeComposition")}),pe.detail.codeComposition.truncated?i.jsx("p",{className:"workbench-manage-hint",children:h("shell.manageWorkspaceCodeTruncated",{count:pe.detail.codeComposition.scannedFileCount})}):null]})]}):null,i.jsx("div",{className:"workbench-modal-actions",children:i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!Ae,onClick:()=>ve(Q.workspace),children:h(at?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})})]}):null]},Q.workspace.id)})}):i.jsx("p",{className:"workbench-section-empty",children:h("shell.manageWorkspaceEmpty")})}),i.jsxs(_r,{open:ke!==null,title:h("shell.manageWorkspaceRemoveConfirmTitle"),description:h("shell.manageWorkspaceRemoveConfirmDescription"),onClose:()=>{Ae||ve(null)},children:[i.jsx("p",{className:"workbench-section-empty",children:ke?h("shell.manageWorkspaceRemoveConfirmTarget",{name:ke.name}):""}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:!!Ae,onClick:()=>ve(null),children:h("common.cancel")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!Ae,onClick:()=>{D()},children:h(Ae?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveConfirmAction")})]})]}),i.jsx(zk,{open:me,onClose:()=>L(!1),onCloned:an}),i.jsx(Wk,{open:q,onClose:()=>K(!1),onImported:pn}),i.jsx(_r,{open:Pt!==null,title:h("shell.createSessionModalTitle"),className:"workbench-create-session-modal",description:Pt?`${h("shell.createSessionTarget")} · ${Pt.name}`:h("shell.createSessionModalDescription"),onClose:()=>Je(null),children:i.jsx(Uk,{disabled:!!qe,pendingProvider:qe===(Pt==null?void 0:Pt.id)?wt??null:null,onSelect:Q=>{Pt&&De(Pt.id,Q)}})}),i.jsx(_r,{open:Ft!==null,title:h("shell.archiveModalTitle"),description:Ft?`${Ft.workspace.name} · ${h("shell.archiveModalDescription")}`:h("shell.archiveModalDescription"),onClose:()=>bt(null),children:Ft&&Ft.archivedSessions.length>0?i.jsx("div",{className:"workbench-archive-list",children:Ft.archivedSessions.map(Q=>{const we=$i(Q.title,h("common.unknown"));return i.jsxs("article",{className:"workbench-archive-item",children:[i.jsxs("div",{className:"workbench-archive-item-main",children:[i.jsx("strong",{title:we.fullTitle,children:we.displayTitle}),i.jsxs("p",{children:[qk(Q,Ft.workspace,!1)," ·"," ",zc(Q.provider)]})]}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Ln(Q.sessionId),children:h("shell.unarchiveAction")})]},Q.sessionId)})}):i.jsx("p",{className:"workbench-section-empty",children:h("shell.archiveEmpty")})}),i.jsx(_r,{open:Se!==null,title:h("shell.renameModalTitle"),description:h("shell.renameModalDescription"),onClose:()=>{ut||(Le(null),Ne(""))},children:i.jsxs("form",{className:"workbench-rename-form",onSubmit:vt,children:[i.jsxs("label",{className:"workbench-modal-field",children:[i.jsx("span",{children:h("shell.renameInputLabel")}),i.jsx("input",{type:"text",value:de,placeholder:h("shell.renameInputPlaceholder"),maxLength:120,autoFocus:!0,onChange:Q=>Ne(Q.target.value)})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:!!ut,onClick:()=>{Le(null),Ne("")},children:h("common.cancel")}),i.jsx("button",{type:"submit",className:"primary-button",disabled:!de.trim()||ut===(Se==null?void 0:Se.session.sessionId),children:ut===(Se==null?void 0:Se.session.sessionId)?h("shell.renamingSession"):h("common.save")})]})]})})]})}function Qv({panelReady:e,activeTab:t,onTabChange:n,onToggleCollapse:s,currentSessionId:o,activeWorkspaceId:c,navigationGroups:l}){var y;const d=c??((y=l[0])==null?void 0:y.workspace.id)??null,p=ar(),m=w.useCallback(g=>{!p.isDesktop||p.ui.osFamily!=="macos"||g.button!==0||Wf(g.target)&&Hf()},[p.isDesktop,p.ui.osFamily]);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"workbench-auxiliary-header","data-window-drag-handle":"workbench-auxiliary-header",onMouseDownCapture:m,children:[s?i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":h("shell.hideInfoSidebar"),title:h("shell.hideInfoSidebar"),onClick:s,children:i.jsx(eS,{})}):null,i.jsxs("div",{className:"workbench-info-tabs",role:"tablist","aria-label":h("shell.infoTabsLabel"),children:[i.jsx("button",{className:t==="files"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="files",onClick:()=>n("files"),children:h("shell.filesEntry")}),i.jsx("button",{className:t==="git"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="git",onClick:()=>n("git"),children:h("shell.gitEntry")}),i.jsx("button",{className:t==="terminals"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="terminals",onClick:()=>n("terminals"),children:h("shell.terminalManagerEntry")})]})]}),i.jsxs("div",{className:"workbench-auxiliary-body",children:[e?null:i.jsx(Zl,{}),e&&t==="files"?c?i.jsx(w.Suspense,{fallback:i.jsx(Zl,{}),children:i.jsx(c2,{sessionId:o,workspaceId:c})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("shell.filesPanelEmpty")})}):null,e&&t==="git"?d?i.jsx(w.Suspense,{fallback:i.jsx(Zl,{}),children:i.jsx(u2,{workspaceId:d})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("shell.gitPanelEmpty")})}):null,e&&t==="terminals"?i.jsx(w.Suspense,{fallback:i.jsx(Zl,{}),children:i.jsx(d2,{currentWorkspaceId:c,navigationGroups:l})}):null]})]})}function V2({shellMode:e="desktop"}){var Ts,It,va;const t=Qr(),n=Mn(),s=ar(),{showToast:o}=Gn(),c=w.useRef(S2()),l=w.useRef(0),d=w.useRef((((It=(Ts=c.current)==null?void 0:Ts.items)==null?void 0:It.length)??0)>0),p=w.useRef(!1),m=w.useRef(null),y=w.useRef(null),g=w.useRef(null),b=w.useRef(new Set),x=w.useRef(new Set),C=w.useRef(new Set),S=w.useRef(new Set),j=w.useRef(null),M=w.useRef(null),A=w.useRef(null),E=w.useRef(null),Z=w.useRef(null),Y=w.useRef(null),B=w.useRef(null),I=w.useRef(null),_=w.useRef(o),[F,R]=w.useState(()=>Hv(c.current)),[W,J]=w.useState(()=>{var G,he;return(((he=(G=c.current)==null?void 0:G.items)==null?void 0:he.length)??0)===0}),[re,le]=w.useState(null),[ie,xe]=w.useState(()=>Jl(zv(Pv,e2),Ql,Lv)),[q,K]=w.useState(()=>Jl(zv(Ev,t2),Ql,Iv)),[me,L]=w.useState(()=>Wv(Rv,!1)),[$,se]=w.useState(()=>Wv(Mv,!1)),[P,be]=w.useState(()=>v2(Av)),[ke,ve]=w.useState(()=>w2(ah)),[Ae,Be]=w.useState(!1),[qe,nt]=w.useState("files"),[wt,ze]=w.useState(!1),[Ot,Je]=w.useState(!1),[_t,bt]=w.useState({}),[et,pt]=w.useState(!1),[Nt,Bt]=w.useState("sessions"),[Rt,ne]=w.useState(""),[He,tt]=w.useState(""),[Tt,ce]=w.useState(!1),[Se,Le]=w.useState(null),[de,Ne]=w.useState([]),[ut,Wt]=w.useState({});w.useEffect(()=>{_.current=o},[o]),w.useEffect(()=>{Ct("workbench.layout_mounted",{path:t.pathname,search:t.search})},[t.pathname,t.search]),w.useEffect(()=>{var G,he;Ct("workbench.cached_snapshot_loaded",{cached:!!c.current,workspaceCount:((G=c.current)==null?void 0:G.items.length)??0,sessionCount:((he=c.current)==null?void 0:he.items.reduce((Ke,ft)=>Ke+ft.sessions.length,0))??0})},[]);function dt(G){var he;!G||!Array.isArray(G.items)||(Ct("workbench.apply_snapshot",{workspaceCount:G.items.length,sessionCount:G.items.reduce((Ke,ft)=>Ke+ft.sessions.length,0),currentSessionId:((he=yo(t.pathname))==null?void 0:he.sessionId)??null}),br(Hk,G),R(Hv(G)),le(null))}const xt=w.useCallback(async()=>{const G=l.current+1;l.current=G,J(he=>he||!d.current),Ct("workbench.refresh_navigation.start",{requestId:G,hasNavigationData:d.current});try{const he=await _N();if(G!==l.current){Ct("workbench.refresh_navigation.stale",{requestId:G});return}dt(he)}catch(he){if(G!==l.current)return;le(he instanceof Error?he.message:h("shell.navigationLoadFailed")),_.current({title:he instanceof Error?he.message:h("shell.navigationLoadFailed"),tone:"error"})}finally{Ct("workbench.refresh_navigation.end",{requestId:G,success:G===l.current}),G===l.current&&J(!1)}},[]),mt=w.useCallback(G=>{R(he=>C2(he,G))},[]),ct=w.useCallback(()=>{var G;(G=g.current)==null||G.requestRefresh()},[]),Ht=w.useCallback((G,he)=>{var Ke;j.current={workspaceId:G,paths:he},(Ke=g.current)==null||Ke.subscribeFileTree(G,he)},[]),St=w.useCallback((G,he)=>{var Ke;M.current={workspaceId:G,paths:he},(Ke=g.current)==null||Ke.requestFileTreeRefresh(G,he)},[]),Pt=w.useCallback(G=>(b.current.add(G),()=>{b.current.delete(G)}),[]),Ft=w.useCallback(G=>{var he;A.current=G,(he=g.current)==null||he.subscribeGit(G)},[]),At=w.useCallback(G=>{var he;E.current=G,(he=g.current)==null||he.requestGitRefresh(G)},[]),Yt=w.useCallback(G=>(x.current.add(G),()=>{x.current.delete(G)}),[]),Gt=w.useCallback(G=>{var he;Z.current=G,(he=g.current)==null||he.subscribeWorkspaceManagement(G)},[]),nn=w.useCallback(G=>{var he;Y.current=G,Wt(Ke=>{var ft;return{...Ke,[G]:{detail:((ft=Ke[G])==null?void 0:ft.detail)??null,loading:!0,error:null}}}),(he=g.current)==null||he.requestWorkspaceManagementRefresh(G)},[]),vn=w.useCallback(G=>(C.current.add(G),()=>{C.current.delete(G)}),[]),Pn=w.useCallback(G=>{var he;B.current=G,(he=g.current)==null||he.subscribeTerminalManager(G)},[]),pn=w.useCallback(G=>{var he;I.current=G,(he=g.current)==null||he.requestTerminalManagerRefresh(G)},[]),an=w.useCallback(G=>(S.current.add(G),()=>{S.current.delete(G)}),[]),An=w.useCallback((G,he)=>{R(Ke=>j2(Ke,G,he??new Date().toISOString()))},[]),D=w.useCallback(async(G,he)=>{R(Ke=>$v(Ke,G,he));try{const Ke=await nx(G,he);mt(Ke),ct()}catch(Ke){throw R(ft=>$v(ft,G,!he)),Ke}},[ct,mt]),T=w.useCallback((G,he)=>{Ct("workbench.set_session_workspace",{sessionId:G,workspaceId:he}),bt(Ke=>{if(!he){if(!(G in Ke))return Ke;const ft={...Ke};return delete ft[G],ft}return Ke[G]===he?Ke:{...Ke,[G]:he}})},[]);w.useEffect(()=>{d.current=F.length>0},[F]),w.useEffect(()=>{Ct("workbench.navigation_state",{navigationLoading:W,workspaceCount:F.length,sessionCount:F.reduce((G,he)=>G+he.sessions.length,0)})},[F,W]),w.useEffect(()=>{y.current!==null&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>{var yt;y.current=null,!(p.current||d.current)&&(Ct("workbench.refresh_navigation.ws_fallback_triggered"),(yt=g.current)==null||yt.requestRefresh())},1200);const G=new OD({onConnectionChange:yt=>{yt==="reconnect_failed"&&!d.current&&(le(h("shell.navigationLoadFailed")),_.current({id:"workbench-navigation-connection",title:h("shell.navigationLoadFailed"),tone:"warning",durationMs:3600}))},onSnapshot:yt=>{p.current=!0,Ct("workbench.ws_snapshot_received",{workspaceCount:yt.items.length,sessionCount:yt.items.reduce((hn,Or)=>hn+Or.sessions.length,0)}),y.current!==null&&(window.clearTimeout(y.current),y.current=null),dt(yt),J(!1)},onFileTreeSnapshot:yt=>{b.current.forEach(hn=>hn(yt))},onGitSnapshot:yt=>{br(Kk(yt.workspaceId),{status:yt.status,history:yt.history,historyTotalCount:yt.historyTotalCount,historyNextCursor:yt.historyNextCursor,branches:yt.branches}),Wt(hn=>{var wa;const Or=((wa=F.find(Ki=>Ki.workspace.id===yt.workspaceId))==null?void 0:wa.workspace)??null;if(!Or)return hn;const jr=hn[yt.workspaceId],Uo=Xk(Yk((jr==null?void 0:jr.detail)??Qk(Or),Or),yt);return br(Zh(yt.workspaceId),Uo),{...hn,[yt.workspaceId]:{detail:Uo,loading:!1,error:null}}}),x.current.forEach(hn=>hn(yt))},onWorkspaceManagementSnapshot:yt=>{br(Zh(yt.workspaceId),yt),Wt(hn=>({...hn,[yt.workspaceId]:{detail:yt,loading:!1,error:null}})),C.current.forEach(hn=>hn(yt))},onTerminalManagerSnapshot:yt=>{S.current.forEach(hn=>hn(yt))},onUnauthorized:()=>{Sn.clear(),n("/login",{replace:!0})}});g.current=G;const he=j.current,Ke=M.current,ft=A.current,Vt=E.current,Un=Z.current,Sr=Y.current,Cr=B.current,ur=I.current;return he&&G.subscribeFileTree(he.workspaceId,he.paths),ft&&G.subscribeGit(ft),Un&&G.subscribeWorkspaceManagement(Un),Cr&&G.subscribeTerminalManager(Cr),Ke&&G.requestFileTreeRefresh(Ke.workspaceId,Ke.paths),Vt&&G.requestGitRefresh(Vt),Sr&&G.requestWorkspaceManagementRefresh(Sr),ur&&G.requestTerminalManagerRefresh(ur),G.start(),()=>{y.current!==null&&(window.clearTimeout(y.current),y.current=null),g.current===G&&(g.current=null),G.close()}},[n]),w.useEffect(()=>{us(Pv,String(ie))},[ie]),w.useEffect(()=>{us(Ev,String(q))},[q]),w.useEffect(()=>{us(Rv,String(me))},[me]),w.useEffect(()=>{us(Mv,String($))},[$]),w.useEffect(()=>{us(Av,JSON.stringify(P))},[P]),w.useEffect(()=>{if(!ke){b2(ah);return}us(ah,ke)},[ke]),w.useEffect(()=>{if(Ae||$)return;const G=window.setTimeout(()=>{Be(!0)},n2);return()=>{window.clearTimeout(G)}},[Ae,$]);const O=yo(t.pathname),H=(O==null?void 0:O.sessionId)??null,oe=H?nS(H):!1,ye=w.useMemo(()=>$f(F),[F]),Re=w.useMemo(()=>new Set(P),[P]),Ge=w.useMemo(()=>ye.filter(G=>G.session.isFavorite===!0).map(G=>G.session.sessionId),[ye]),Ie=w.useMemo(()=>new Set(Ge),[Ge]);w.useEffect(()=>{if(W&&F.length===0)return;const G=new Set(F.map(he=>he.workspace.id));be(he=>Gk(he,G)),ve(he=>he&&G.has(he)?he:null)},[F,W]);const Oe=ye.find(G=>G.session.sessionId===H)??null,Me=(Oe==null?void 0:Oe.workspace.id)??(H?_t[H]??null:null),U=_v(t.pathname,t.search),fe=Me??U??ke??null,ee=fe??((va=F[0])==null?void 0:va.workspace.id)??null;w.useEffect(()=>{Me&&ve(G=>G===Me?G:Me)},[Me]),w.useEffect(()=>{Ct("workbench.current_workspace_resolved",{currentSessionId:H,sessionWorkspaceId:Me,routeWorkspaceId:U,currentWorkspaceId:ee,source:Me?Oe?"navigation":"sessionWorkspaceMap":U?"route":ke?"workspaceSelection":"navigationFallback"})},[Oe,H,ee,U,ke,Me]),w.useEffect(()=>{Ct("workbench.info_panel_state",{infoPanelReady:Ae,rightCollapsed:$,currentWorkspaceId:ee,sessionWorkspaceId:Me,currentSessionId:H})},[H,ee,Ae,$,Me]);const _e=Ov(t.pathname)?"terminals":"conversation",De=e==="mobile",Ue=a2(e),ot=w.useMemo(()=>F.map(G=>({workspace:G.workspace,visibleSessions:G.sessions.filter(he=>!io(he)),archivedSessions:G.sessions.filter(he=>io(he)&&!Xh(he)),visibleSessionTree:Vk(G.sessions.filter(he=>{if(io(he))return!1;const Ke=Xh(he);if(!Ke)return!0;const ft=G.sessions.find(Vt=>Vt.sessionId===Ke);return!ft||!io(ft)})).filter(he=>!Ie.has(he.session.sessionId)&&!ms(he).some(Ke=>Ie.has(Ke.sessionId))),isCollapsed:Re.has(G.workspace.id)})),[Re,Ie,F]),un=w.useMemo(()=>ye.filter(G=>Ie.has(G.session.sessionId)&&!io(G.session)&&!Yh(G.session)),[Ie,ye]),Ln=t.pathname.startsWith("/settings")?"settings":Ov(t.pathname)?"terminals":l2(t.pathname)?"tools":o2(t.pathname)||Fv(t.pathname)?"sessions":"workspaces",on=De&&Ln==="sessions"&&Fv(t.pathname),vt=Fo({viewportClass:s.viewportClass,activeEntry:Ln,hasNavigationPanel:De,hasAuxiliaryPanel:De}),kr=De&&Ak(vt),Kn=De&&Lk(vt),Qn=w.useMemo(()=>F.map(G=>G.workspace),[F]),Yn=w.useMemo(()=>{const G=Rt.trim().toLowerCase();return G?ye.filter(he=>{const Ke=(he.session.title||"").toLowerCase(),ft=he.workspace.name.toLowerCase(),Vt=zc(he.session.provider,"full").toLowerCase();return Ke.includes(G)||ft.includes(G)||Vt.includes(G)}):[]},[ye,Rt]);w.useEffect(()=>{var he;const G=ee??((he=F[0])==null?void 0:he.workspace.id)??"";G&&tt(Ke=>Ke&&F.some(Vt=>Vt.workspace.id===Ke)?Ke:G)},[ee,F]),w.useEffect(()=>{H&&!oe&&us(sh,`${t.pathname}${t.search}`)},[H,oe,t.pathname,t.search]),w.useEffect(()=>{if(H&&oe){m.current=`${t.pathname}${t.search}`;return}H&&!oe&&(m.current=null)},[H,oe,t.pathname,t.search]),w.useEffect(()=>{De||(ze(!1),Je(!1))},[De]),w.useEffect(()=>{!De||W||!s2(t.pathname)||fe||(ze(!1),Je(!1),n(Ue,{replace:!0}))},[fe,De,t.pathname,n,W,Ue]);function Q(){if(De){ze(!0);return}L(!1)}function we(){if(ht(),De){Je(!0);return}se(!1)}function pe(){if(De){ze(G=>!G);return}L(G=>!G)}function at(){if(ht(),De){Je(G=>!G);return}se(G=>!G)}function ht(){Be(!0)}function Fe(G){ve(G),ht(),H&&Me!==G&&n(Ue)}const $t=w.useCallback(async G=>{var ft;const he=((ft=ye.find(Vt=>Vt.session.sessionId===G))==null?void 0:ft.session)??null,Ke=(he==null?void 0:he.isFavorite)!==!0;R(Vt=>Vv(Vt,G,Ke));try{const Vt=await $N(G,Ke);mt(Vt),ct()}catch(Vt){throw R(Un=>Vv(Un,G,!Ke)),Vt}},[ye,ct,mt]),Ut=w.useCallback((G,he)=>{n(Rk(G,he))},[n]),cr=w.useCallback(async(G,he)=>{const Ke=await tx(G,he.trim());return mt(Ke),Ke},[mt]);function dn(G){pt(!0)}function Vi(){pt(!1),Bt("sessions"),ne(""),Le(null),Ne([]),ce(!1)}async function qi(){const G=Rt.trim();if(!G||!He.trim()){Ne([]),Le(null);return}ce(!0),Le(null);try{const he=await Qh(He,G);Ne(he.items)}catch(he){Ne([]),Le(he instanceof Error?he.message:h("shell.searchCodeFailed"))}finally{ce(!1)}}function Gi(G,he){const Ke=G==="left"?ie:q;function ft(Un){const Sr=Un.clientX-he;if(G==="left"){xe(Jl(Ke+Sr,Ql,Lv));return}K(Jl(Ke-Sr,Ql,Iv))}function Vt(){document.removeEventListener("mousemove",ft),document.removeEventListener("mouseup",Vt)}document.addEventListener("mousemove",ft),document.addEventListener("mouseup",Vt)}function js(){if(Ns())return;if(ye.length===0){n(Ue);return}const G=Vn(ye[0].workspace.id,ye[0].session.sessionId);n(G)}function Vc(){if(!Ns(ee)){if(ee){n(_o(ee));return}n(Ue)}}function Ns(G){if(H)return G&&Me&&Me!==G?!1:(n(`${t.pathname}${t.search}`),!0);if(m.current){if(G){const[Ke,ft=""]=m.current.split("?"),Vt=_v(Ke??m.current,ft?`?${ft}`:"");if(Vt&&Vt!==G)return!1}return n(m.current),!0}const he=typeof window>"u"?null:window.localStorage.getItem(sh);if(he){const Ke=he.split("?")[0]??he,ft=yo(Ke);if(ft){const Vt=ft.sessionId,Un=ye.find(ur=>ur.session.sessionId===Vt)??null,Sr=ft.workspaceId??(Un==null?void 0:Un.workspace.id)??null;if(Un!==null&&(!G||Sr===G))return n(he),!0}window.localStorage.removeItem(sh)}return!1}w.useEffect(()=>{if(typeof window>"u")return;function G(he){if(!(he.metaKey||he.ctrlKey)){he.key==="Escape"&&(ze(!1),Je(!1));return}if(x2(he.target))return;const ft=he.key.toLowerCase();if(!he.shiftKey&&ft==="b"){he.preventDefault(),pe();return}if(he.shiftKey&&ft==="i"){he.preventDefault(),at();return}if(!he.shiftKey&&ft===","){he.preventDefault(),n("/settings");return}if(!he.shiftKey&&ft==="1"){he.preventDefault(),js();return}if(!he.shiftKey&&ft==="2"){he.preventDefault(),n(ee?sa(ee):qr());return}if(!he.shiftKey&&ft==="k"){he.preventDefault(),k2();return}he.shiftKey&&ft==="r"&&(he.preventDefault(),xt())}return window.addEventListener("keydown",G),()=>{window.removeEventListener("keydown",G)}},[n,xt,De,js]);const Oo=w.useMemo(()=>({shellMode:e,navigationGroups:F,navigationLoading:W,navigationError:re,currentWorkspaceId:ee,currentSessionId:H,favoriteSessionIds:Ge,favoriteSessions:un,refreshNavigation:xt,requestNavigationRefresh:ct,subscribeFileTree:Ht,requestFileTreeRefresh:St,addFileTreeSnapshotListener:Pt,subscribeGitSnapshot:Ft,requestGitRefresh:At,addGitSnapshotListener:Yt,subscribeWorkspaceManagementSnapshot:Gt,requestWorkspaceManagementRefresh:nn,addWorkspaceManagementSnapshotListener:vn,workspaceManagementStateById:ut,subscribeTerminalManagerSnapshot:Pn,requestTerminalManagerRefresh:pn,addTerminalManagerSnapshotListener:an,selectWorkspace:Fe,toggleFavoriteSession:$t,archiveSession:G=>D(G,!0),unarchiveSession:G=>D(G,!1),renameSession:cr,startDraftSession:Ut,markNavigationSessionSeen:An,upsertNavigationSession:mt,setSessionWorkspace:T}),[Pt,Yt,vn,an,D,H,ee,Ge,un,Fe,An,re,F,W,St,At,nn,xt,ct,pn,cr,ut,e,Ut,T,Ht,Ft,Gt,Pn,$t,mt]),ya={"--workbench-left-width":`${ie}px`,"--workbench-left-current-width":me?"0px":`${ie}px`,"--workbench-right-width":`${q}px`,"--workbench-right-current-width":$?"0px":`${q}px`},vi=De?i.jsx(Kv,{workspaceGroups:ot,favoriteSessions:un,favoriteSessionIds:Ie,activeWorkspaceId:ee,isConversationActive:_e==="conversation",isTerminalActive:_e==="terminals",isSearchOpen:et,navigationLoading:W,navigationError:re,activeSessionId:H,onRefreshNavigation:xt,onSessionUpdated:mt,onNavigateConversation:js,onNavigateTerminals:()=>{ze(!1),n(ee?sa(ee):qr())},onOpenSearch:()=>{ze(!1),dn()},onOpenSettings:()=>{ze(!1),n("/settings")},onSelectWorkspace:Fe,onToggleWorkspaceCollapse:G=>be(he=>Jh(he,G)),subscribeGitSnapshot:Ft,requestGitRefresh:At,subscribeWorkspaceManagementSnapshot:Gt,requestWorkspaceManagementRefresh:nn,onToggleFavoriteSession:$t,onArchiveSession:G=>D(G,!0),onUnarchiveSession:G=>D(G,!1),workspaceManagementStateById:ut,setWorkspaceManagementStateById:Wt,onClose:()=>ze(!1)}):null,Bo=De?i.jsx(Qv,{panelReady:Ae,activeTab:qe,onTabChange:G=>{ht(),nt(G)},currentSessionId:oe?null:H,activeWorkspaceId:ee,navigationGroups:F}):null;return i.jsxs($k.Provider,{value:Oo,children:[De?i.jsx(i.Fragment,{children:i.jsx(ED,{activeEntry:Ln,presentation:on?"conversation-focus":"default",navigationPanel:vi,auxiliaryPanel:Bo,onOpenNavigation:()=>{Je(!1),ze(!0)},onOpenSearch:()=>{ze(!1),Je(!1),dn()},onOpenAuxiliary:()=>{ht(),ze(!1),Je(!0)},onNavigateWorkspaces:()=>{ze(!1),Je(!1),n(qr())},onNavigateTerminals:()=>{ze(!1),Je(!1),n(ee?sa(ee):qr())},onNavigateSessions:()=>{ze(!1),Je(!1),Vc()},onNavigateTools:()=>{ze(!1),Je(!1),n(ee?fa(ee):qr())},onNavigateToolFiles:()=>{ze(!1),Je(!1),n(ee?Tk(ee):qr())},onNavigateToolGit:()=>{ze(!1),Je(!1),n(ee?Pk(ee):qr())},onNavigateToolProcesses:()=>{ze(!1),Je(!1),n(ee?Uc(ee):qr())},onNavigateSettings:()=>{ze(!1),Je(!1),n("/settings")},children:i.jsx(Mh,{})})}):i.jsx("div",{className:"workbench-shell",style:ya,"data-nav-loading":W,"data-left-collapsed":me,"data-right-collapsed":$,"data-info-ready":Ae,"data-runtime-platform":s.platform,"data-os-family":s.ui.osFamily,"data-overlay-titlebar":s.ui.prefersOverlayTitlebar,children:i.jsxs("div",{className:"workbench-body-shell",children:[i.jsx("aside",{className:"workbench-nav surface-card","data-collapsed":me,children:i.jsx(Kv,{workspaceGroups:ot,favoriteSessions:un,favoriteSessionIds:Ie,activeWorkspaceId:ee,isConversationActive:_e==="conversation",isTerminalActive:_e==="terminals",isSearchOpen:et,navigationLoading:W,navigationError:re,activeSessionId:H,onRefreshNavigation:xt,onSessionUpdated:mt,onNavigateConversation:js,onNavigateTerminals:()=>n(ee?sa(ee):qr()),onOpenSearch:()=>dn(),onOpenSettings:()=>n("/settings"),onSelectWorkspace:Fe,onToggleWorkspaceCollapse:G=>be(he=>Jh(he,G)),subscribeGitSnapshot:Ft,requestGitRefresh:At,subscribeWorkspaceManagementSnapshot:Gt,requestWorkspaceManagementRefresh:nn,onToggleFavoriteSession:$t,onArchiveSession:G=>D(G,!0),onUnarchiveSession:G=>D(G,!1),workspaceManagementStateById:ut,setWorkspaceManagementStateById:Wt,onToggleCollapse:()=>L(!0)})}),i.jsx("div",{className:"workbench-side-resizer","data-side":"left","data-collapsed":me,role:"separator","aria-label":h("shell.leftResizerLabel"),onMouseDown:me?void 0:G=>Gi("left",G.clientX)}),i.jsxs("div",{className:"workbench-main-shell",children:[i.jsxs("div",{className:"workbench-collapsed-rail","aria-hidden":!me&&!$,children:[i.jsxs("div",{className:"workbench-collapsed-controls left","data-visible":me,children:[i.jsx(qv,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:h("shell.showSessionSidebar"),side:"left",collapsed:!0,onClick:Q}),i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button workbench-collapsed-button","aria-label":h("shell.goBack"),title:h("shell.goBack"),onClick:()=>n(-1),children:i.jsx(Zk,{})}),i.jsx("button",{type:"button",className:"workbench-nav-toolbar-button workbench-collapsed-button","aria-label":h("shell.goForward"),title:h("shell.goForward"),onClick:()=>n(1),children:i.jsx(tp,{})})]}),i.jsx("div",{className:"workbench-collapsed-controls right","data-visible":$,children:i.jsx(qv,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:h("shell.showInfoSidebar"),side:"right",collapsed:!0,onClick:we})})]}),i.jsx(Mh,{})]}),i.jsx("div",{className:"workbench-side-resizer","data-side":"right","data-collapsed":$,role:"separator","aria-label":h("shell.rightResizerLabel"),onMouseDown:$?void 0:G=>Gi("right",G.clientX)}),i.jsx("aside",{className:"workbench-auxiliary surface-card","data-collapsed":$,children:i.jsx(Qv,{panelReady:Ae,activeTab:qe,onTabChange:G=>{ht(),nt(G)},onToggleCollapse:()=>se(!0),currentSessionId:oe?null:H,activeWorkspaceId:ee,navigationGroups:F})})]})}),i.jsx($2,{open:et,mode:Nt,keyword:Rt,codeWorkspaceId:He,codeResults:de,codeLoading:Tt,codeError:Se,workspaceOptions:Qn,sessionResults:Yn,onClose:Vi,onModeChange:G=>{Bt(G),Le(null),Ne([])},onKeywordChange:G=>{ne(G),Nt==="code"&&!G.trim()&&(Ne([]),Le(null))},onCodeWorkspaceChange:G=>tt(G),onCodeSearch:()=>{qi()},onOpenSession:G=>{Vi();const he=ye.find(Ke=>Ke.session.sessionId===G)??null;n(he?Vn(he.workspace.id,G):qr())}}),De?i.jsxs(i.Fragment,{children:[kr?null:i.jsx(Yv,{isOpen:wt,side:"left",onClose:()=>ze(!1),children:vi}),Kn?null:i.jsx(Yv,{isOpen:Ot,side:"right",onClose:()=>Je(!1),children:Bo})]}):null]})}function Yv({isOpen:e,side:t,onClose:n,children:s,className:o,overlayClassName:c}){if(!e)return null;const l=i.jsxs(i.Fragment,{children:[i.jsx("div",{className:["mobile-nav-overlay","open",c].filter(Boolean).join(" "),onClick:n,role:"button",tabIndex:0,"aria-label":h("common.back"),onKeyDown:d=>{d.key==="Escape"&&n()}}),i.jsx("div",{className:["mobile-nav-drawer",t,"open",o].filter(Boolean).join(" "),children:s})]});return typeof document>"u"?l:qn.createPortal(l,document.body)}function lr(){return w.useContext($k)??{navigationGroups:[],navigationLoading:!1,navigationError:null,shellMode:"desktop",currentWorkspaceId:null,currentSessionId:null,favoriteSessionIds:[],favoriteSessions:[],refreshNavigation:async()=>{},requestNavigationRefresh:()=>{},subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{},subscribeWorkspaceManagementSnapshot:()=>{},requestWorkspaceManagementRefresh:()=>{},addWorkspaceManagementSnapshotListener:()=>()=>{},workspaceManagementStateById:{},subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{},selectWorkspace:()=>{},toggleFavoriteSession:async()=>{},archiveSession:async()=>{},unarchiveSession:async()=>{},renameSession:async()=>{throw new Error("workbench shell unavailable")},startDraftSession:()=>{},setSessionWorkspace:()=>{},upsertNavigationSession:()=>{},markNavigationSessionSeen:()=>{}}}function nS(e){return e.startsWith("draft-")}class q2{constructor(t){Ze(this,"socket",null);Ze(this,"disposed",!1);Ze(this,"authRecoveryInFlight",!1);Ze(this,"latestCursor");Ze(this,"connectionManager");this.options=t,this.latestCursor=t.cursor,this.connectionManager=new Ik({onReconnect:n=>{this.connect(n)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}updateCursor(t){this.latestCursor=t}reconnectNow(){this.connectionManager.reconnectNow()}close(){var t;this.disposed=!0,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var c;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const n=(c=Sn.getState().session)==null?void 0:c.accessToken;if(!n){this.options.onUnauthorized();return}const s=`${Kb("/ws")}?access_token=${encodeURIComponent(n)}`,o=new WebSocket(s);this.socket=o,o.addEventListener("open",()=>{o.send(JSON.stringify({type:"session.subscribe",sessionId:this.options.sessionId,cursor:this.latestCursor,limit:this.options.limit}))}),o.addEventListener("message",l=>{const d=JSON.parse(l.data);if(d.type==="system.connected"){this.connectionManager.markConnected();return}if(d.type==="session.subscribed"){this.options.onSubscribed();return}if(d.type==="session.error"){if(d.error_code==="UNAUTHORIZED"){this.handleUnauthorized();return}this.options.onError(d);return}if(d.type==="session.runtime_status"){this.options.onRuntimeStatus(d);return}if(d.type==="session.runtime_message"){this.options.onRuntimeMessage(d);return}if(d.type==="session.runtime_error"){this.options.onRuntimeError(d);return}if(d.type==="session.interrupted"){this.options.onInterrupted(d);return}this.latestCursor=d.cursor,this.options.onEnvelope(d)}),o.addEventListener("close",()=>{this.disposed||this.socket!==o||this.connectionManager.markDisconnected()}),o.addEventListener("error",()=>{this.disposed||this.socket!==o||this.connectionManager.markTransientFailure()})}handleUnauthorized(){if(this.authRecoveryInFlight||this.disposed)return;this.authRecoveryInFlight=!0;const t=this.socket;this.socket=null,t==null||t.close(),Sn.refresh().then(n=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(n.status==="refreshed"){this.connectionManager.reconnectNow();return}if(n.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}}function Xv(e){return{session:(e==null?void 0:e.session)??null,capabilities:(e==null?void 0:e.capabilities)??null,runtimeHasActiveRun:(e==null?void 0:e.runtimeHasActiveRun)??null,runtimeCanInterrupt:(e==null?void 0:e.runtimeCanInterrupt)??null,contextUsage:(e==null?void 0:e.contextUsage)??null,messages:(e==null?void 0:e.messages)??[],queuedMessages:(e==null?void 0:e.queuedMessages)??[],historyState:"idle",loadingOlderMessages:!1,olderCursor:null,hasOlderMessages:!1,connectionState:"closed",lastCursor:null,pagesLoaded:0,errorCode:null,errorDetail:null}}function rS(e,t,n="sent",s=null){const o=t.kind??(t.role==="tool"?"tool_result":"text"),c=t.toolCall??(o==="tool_call"||o==="tool_result"?{callId:t.rawRef||t.messageId,name:"tool",input:o==="tool_call"?t.content:"",output:o==="tool_result"&&t.content?t.content:null,error:null,status:o==="tool_call"?"running":"completed"}:null);return{id:t.messageId,sessionId:e,role:t.role,kind:o,content:t.content,toolCall:c,attachments:t.attachments??[],attachmentPayloads:null,timestamp:t.timestamp,sequence:t.sequence,rawRef:t.rawRef,deliveryState:n,clientRequestId:s}}function iS(e,t,n,s=[],o=[]){return{id:`pending-${n}`,sessionId:e,role:"user",kind:"text",content:t,toolCall:null,attachments:s,attachmentPayloads:o,timestamp:new Date().toISOString(),sequence:Number.MAX_SAFE_INTEGER,rawRef:`pending://${n}`,deliveryState:"sending",clientRequestId:n}}function ds(e,t,n){const s=new Map;for(const o of e)s.set(o.id,o);for(const o of n){const c=rS(t,o),l=l_(s,c);if(l&&l!==c.id)continue;const d=o_(s,c);d&&d!==c.id&&s.delete(d);const p=s.get(o.messageId)??null;s.set(o.messageId,p?Y2(p,c):c)}return sS(Array.from(s.values()))}function Jv(e,t,n,s){const o=s===null?null:e.find(p=>p.clientRequestId===s)??null,c=e.filter(p=>p.clientRequestId!==s),l=rS(t,n,"sent",s),d=Q2(l,o);return sS([...c.filter(p=>p.id!==d.id),d])}function ef(e,t){return e.map(n=>n.clientRequestId===t?{...n,deliveryState:"failed"}:n)}function G2(e){const t=[];for(const n of e){const s=t.at(-1);if(!s||!J2(s,n)){t.push(n);continue}t[t.length-1]=t_(s,n)}return t}function K2(e){const t=[];let n=null,s=!1;for(const o of e)if(!Z2(n,o,s)){if(t.push(o),tf(o)){n=o,s=!1;continue}n&&e_(o)&&(s=!0)}return t}function sS(e){const t=[...e].sort((n,s)=>n.sequence!==s.sequence?n.sequence-s.sequence:n.timestamp.localeCompare(s.timestamp));return K2(G2(t))}function Q2(e,t){if(!t||!X2(t,e))return e;const n=e.attachments??[];return{...e,sequence:t.sequence,timestamp:t.timestamp,attachments:n.length>0?n:t.attachments??[],attachmentPayloads:t.attachmentPayloads??null}}function Y2(e,t){if(e.id!==t.id)return t;if(e.role!==t.role||e.kind!==t.kind||e.rawRef!==t.rawRef)return tw(e,t);const n=n_(e.toolCall,t.toolCall),s=i_(e.content,t.content,e.timestamp,t.timestamp),o=s_(e.attachments,t.attachments);return{...tw(e,t),content:s,toolCall:n,attachments:o,attachmentPayloads:e.attachmentPayloads??t.attachmentPayloads??null,timestamp:e.timestamp.localeCompare(t.timestamp)>=0?e.timestamp:t.timestamp,sequence:Math.max(e.sequence,t.sequence)}}function X2(e,t){return Wc(e)&&t.role==="user"&&t.kind==="text"&&e.sequence>t.sequence}function J2(e,t){if(e.deliveryState!=="sent"||t.deliveryState!=="sent"||!e.rawRef.startsWith("codex://")||!t.rawRef.startsWith("codex://")||e.role!==t.role||e.kind!==t.kind||e.toolCall!==null||t.toolCall!==null||e.kind!=="text"&&e.kind!=="thinking")return!1;const n=Co(e.content),s=Co(t.content);return c_(e.timestamp,t.timestamp)&&ii(n.text)===ii(s.text)&&a_(n.inlineImages,s.inlineImages)}function Z2(e,t,n){return!e||n||!tf(e)||!tf(t)?!1:u_(e.timestamp,t.timestamp,120*1e3)&&ii(e.content)===ii(t.content)}function tf(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="user"&&e.kind==="text"}function e_(e){return e.rawRef.startsWith("opencode://")&&e.role==="assistant"&&e.kind==="text"}function t_(e,t){var p,m;const n=((p=e.attachments)==null?void 0:p.length)??0,s=((m=t.attachments)==null?void 0:m.length)??0;if(n!==s)return n>s?e:t;const o=Co(e.content).inlineImages.length,c=Co(t.content).inlineImages.length;if(o!==c)return o>c?e:t;const l=e.content!==ii(e.content),d=t.content!==ii(t.content);return l!==d?l?t:e:t}function n_(e,t){return e?t?{...r_(e,t),input:aS(e.input,t.input),output:ew(e.output,t.output),error:ew(e.error,t.error)}:e:t}function r_(e,t){const n=Zv(e.status),s=Zv(t.status);return s!==n?s>n?t:e:t}function Zv(e){return e==="running"?0:1}function i_(e,t,n,s){const o=ii(e),c=ii(t);return o===c?e.length>=t.length?e:t:o.length>c.length&&o.includes(c)?e:c.length>o.length&&c.includes(o)||s.localeCompare(n)>=0?t:e}function s_(e,t){const n=(e==null?void 0:e.length)??0,s=(t==null?void 0:t.length)??0;return s!==n?s>n?t:e:t??e}function aS(e,t){return t.length>e.length?t:e}function ew(e,t){return e===null?t:t===null?e:aS(e,t)}function tw(e,t){return t.timestamp!==e.timestamp?t.timestamp.localeCompare(e.timestamp)>=0?t:e:t.sequence!==e.sequence?t.sequence>=e.sequence?t:e:t}function ii(e){return e.replace(/\r\n/g,`
106
- `).trimEnd()}function a_(e,t){return e.length===0||t.length===0?!0:e.length!==t.length?!1:e.every((n,s)=>{var o;return n.url===((o=t[s])==null?void 0:o.url)})}function o_(e,t){return lS(t)?oS(e,t,"optimistic"):null}function l_(e,t){return Wc(t)?oS(e,t,"authoritative"):null}function oS(e,t,n){const s=ua(t.timestamp),o=ii(t.content);let c=null,l=Number.POSITIVE_INFINITY;for(const[d,p]of e.entries()){if(!(n==="optimistic"?Wc(p):lS(p))||ii(p.content)!==o)continue;const y=ua(p.timestamp),g=Math.abs(y-s);g>300*1e3||g<l&&(c=d,l=g)}return c}function Wc(e){return e.role!=="user"||e.kind!=="text"||e.deliveryState==="failed"?!1:e.rawRef.startsWith("pending://")||e.rawRef.startsWith("synthetic://")||e.rawRef.includes("#synthetic")}function lS(e){return e.role==="user"&&e.kind==="text"&&!Wc(e)}function ua(e){const t=Date.parse(e);return Number.isFinite(t)?t:0}function c_(e,t){return Math.abs(ua(e)-ua(t))<=1e3}function u_(e,t,n){return Math.abs(ua(e)-ua(t))<=n}const lo=30,cS=40,nw=300*1e3,d_=600,h_=5e3,f_=1e4;function rw(){const e=cn.getState().defaultPermissionMode;return e==="default"?null:e}class p_{constructor(t,n={}){Ze(this,"state");Ze(this,"listeners",new Set);Ze(this,"realtimeClient",null);Ze(this,"historyBootstrapReadyTimer",null);Ze(this,"markSeenTimer",null);Ze(this,"markSeenInFlight",!1);Ze(this,"lastMarkSeenRequestAt",0);Ze(this,"seenWatermark",null);Ze(this,"runtimeRefreshTimer",null);Ze(this,"runtimeRefreshMode",null);Ze(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));Ze(this,"getState",()=>this.state);this.sessionId=t,this.options=n;const s=Cn(uh(t),nw),o=tc(n.initialSession??null,(s==null?void 0:s.session)??null),c=ds((s==null?void 0:s.messages)??[],this.sessionId,n.bootstrapMessages??[]);this.state=Xv({session:o,capabilities:(s==null?void 0:s.capabilities)??null,runtimeHasActiveRun:(s==null?void 0:s.runtimeHasActiveRun)??null,runtimeCanInterrupt:(s==null?void 0:s.runtimeCanInterrupt)??null,contextUsage:(s==null?void 0:s.contextUsage)??null,messages:c,queuedMessages:(s==null?void 0:s.queuedMessages)??[]}),this.seenWatermark=(o==null?void 0:o.lastSeenAt)??null}async initialize(){const t=this.options.bootstrapMessages??[],n=ds(this.state.messages,this.sessionId,t),s=n.length>0;this.patch({messages:n,historyState:m_(this.state.session,n.length),loadingOlderMessages:!1,olderCursor:null,hasOlderMessages:ta(this.state.session,n.length),pagesLoaded:s?Math.max(this.state.pagesLoaded,1):0,errorCode:null,errorDetail:null}),this.shouldRefreshSessionDetail()&&this.refreshSessionMetadata(),this.shouldRefreshRuntimeSnapshot()&&this.refreshRuntimeSnapshot("bootstrap"),this.refreshQueue();try{this.startRealtime(),s?this.scheduleMarkSeen():this.state.historyState==="loading"&&this.scheduleHistoryBootstrapReady()}catch(o){this.handleError(o)}}async reload(){var n,s;this.clearHistoryBootstrapReadyTimer(),(n=this.realtimeClient)==null||n.close(),this.realtimeClient=null;const t=Cn(uh(this.sessionId),nw);this.state=Xv({session:tc(this.options.initialSession??null,(t==null?void 0:t.session)??null),capabilities:(t==null?void 0:t.capabilities)??null,runtimeHasActiveRun:(t==null?void 0:t.runtimeHasActiveRun)??null,runtimeCanInterrupt:(t==null?void 0:t.runtimeCanInterrupt)??null,contextUsage:(t==null?void 0:t.contextUsage)??null,messages:ds((t==null?void 0:t.messages)??[],this.sessionId,this.options.bootstrapMessages??[]),queuedMessages:(t==null?void 0:t.queuedMessages)??[]}),this.seenWatermark=((s=this.state.session)==null?void 0:s.lastSeenAt)??null,this.emit(),await this.initialize()}applyNavigationSession(t){if(!t||t.sessionId!==this.sessionId)return;const n=tc(this.state.session,t);n!==this.state.session&&this.patch({session:n,hasOlderMessages:ta(n,this.state.messages.length)})}async sendMessage(t,n){const s=lw(),o=iS(this.sessionId,t,s,(n==null?void 0:n.attachmentMeta)??[],(n==null?void 0:n.attachments)??[]);this.patch({messages:[...this.state.messages,o],session:Lr(this.state.session,"running"),runtimeHasActiveRun:cw(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:uw(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt});try{const c=await this.sendMessageWithFallback(t,s,n);this.patch({messages:Jv(this.state.messages,this.sessionId,c.message,s)})}catch(c){throw this.patch({messages:ef(this.state.messages,s),session:Lr(this.state.session,"failed"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1}),c}}async retryMessage(t){const n=this.state.messages.find(s=>s.clientRequestId===t);if(n){this.patch({messages:this.state.messages.map(s=>s.clientRequestId===t?{...s,deliveryState:"sending"}:s),runtimeHasActiveRun:cw(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:uw(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt});try{const s=await this.sendMessageWithFallback(n.content,t,{attachments:n.attachmentPayloads??[],attachmentMeta:n.attachments});this.patch({messages:Jv(this.state.messages,this.sessionId,s.message,t)})}catch(s){throw this.patch({messages:ef(this.state.messages,t),session:Lr(this.state.session,"failed")}),s}}}async enqueueMessage(t,n){const s=lw();try{const o=await eT(this.sessionId,{content:t,clientRequestId:s,model:(n==null?void 0:n.model)??null,reasoningLevel:(n==null?void 0:n.reasoningLevel)??null,permissionMode:rw(),attachments:(n==null?void 0:n.attachments)??[]});this.patch({queuedMessages:y_(this.state.queuedMessages,o)}),await this.refreshQueue()}catch(o){throw o}}async deleteQueuedMessage(t){await tT(this.sessionId,t),await this.refreshQueue()}async steerQueuedMessage(t){await nT(this.sessionId,t),await this.refreshRuntimeSnapshot("queue_steer")}async interrupt(){await rT(this.sessionId),this.patch({session:Lr(this.state.session,"interrupted"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:null,errorDetail:null})}reconnect(){var t;(t=this.realtimeClient)==null||t.reconnectNow()}async loadOlderMessages(){if(!(this.state.historyState!=="ready"||this.state.loadingOlderMessages||!this.state.olderCursor&&!this.state.hasOlderMessages)){this.patch({loadingOlderMessages:!0,errorCode:null,errorDetail:null});try{const t=!this.state.olderCursor,n=await iy(this.sessionId,t?null:this.state.olderCursor,t?Math.min(100,Math.max(lo,this.state.messages.length+lo)):lo,"backward"),s=ds(this.state.messages,this.sessionId,n.messages);this.patch({messages:s,loadingOlderMessages:!1,olderCursor:n.nextCursor,hasOlderMessages:!!n.nextCursor,pagesLoaded:this.state.pagesLoaded+1})}catch(t){const n=t instanceof Error?t.message:"unknown";this.patch({loadingOlderMessages:!1,errorCode:"HISTORY_LOAD_MORE_FAILED",errorDetail:n})}}}destroy(){var t;this.clearHistoryBootstrapReadyTimer(),(t=this.realtimeClient)==null||t.close(),this.realtimeClient=null,this.markSeenTimer!==null&&(window.clearTimeout(this.markSeenTimer),this.markSeenTimer=null),this.runtimeRefreshTimer!==null&&(window.clearTimeout(this.runtimeRefreshTimer),this.runtimeRefreshTimer=null),this.runtimeRefreshMode=null}async loadLatestHistory(){const t=await iy(this.sessionId,null,lo,"backward"),n=ds(this.state.messages,this.sessionId,t.messages);this.patch({messages:n,historyState:"ready",loadingOlderMessages:!1,olderCursor:t.nextCursor,hasOlderMessages:!!t.nextCursor,lastCursor:t.cursor,pagesLoaded:t.messages.length>0?1:0,errorCode:null,errorDetail:null})}startRealtime(){var n;if(!((n=Sn.getState().session)==null?void 0:n.accessToken)){Sn.clear();return}this.realtimeClient=new q2({sessionId:this.sessionId,cursor:this.state.lastCursor,limit:cS,onSubscribed:()=>{this.patch({connectionState:"connected",historyState:this.state.historyState==="loading"&&np(this.state.session)===0?"ready":this.state.historyState,hasOlderMessages:ta(this.state.session,this.state.messages.length)}),this.scheduleHistoryBootstrapReady()},onConnectionChange:s=>{var c;const o=this.state.connectionState;if(this.patch({connectionState:s,session:s==="reconnecting"&&na((c=this.state.session)==null?void 0:c.runningState)?Lr(this.state.session,"reconnecting"):this.state.session}),s==="connected"){this.clearRuntimeRefreshTimer("poll"),o!=="closed"&&o!=="connected"&&this.patch({errorCode:null,errorDetail:null});return}this.scheduleRuntimeRefresh("poll","connection_state_change")},onEnvelope:s=>{var c,l;this.clearHistoryBootstrapReadyTimer();const o=ds(this.state.messages,this.sessionId,s.messages);this.patch({messages:o,lastCursor:s.cursor,historyState:"ready",hasOlderMessages:ta(this.state.session,o.length),pagesLoaded:s.type==="session.backfill"?Math.max(this.state.pagesLoaded,o.length>0?1:0):this.state.pagesLoaded,session:Lr(this.state.session,aw(s.type,(c=this.state.session)==null?void 0:c.runningState))}),(l=this.realtimeClient)==null||l.updateCursor(s.cursor),this.scheduleMarkSeen(),this.state.queuedMessages.length>0&&this.refreshQueue()},onRuntimeMessage:s=>{this.handleRuntimeMessage(s)},onRuntimeStatus:s=>{this.handleRuntimeStatus(s)},onRuntimeError:s=>{this.handleRuntimeError(s)},onInterrupted:s=>{this.handleInterrupted(s)},onError:s=>{this.patch({errorCode:s.error_code,errorDetail:s.detail})},onUnauthorized:()=>{Sn.clear()}}),this.realtimeClient.start()}patch(t){let n=t;Object.prototype.hasOwnProperty.call(t,"session")&&(this.syncSeenWatermark(t.session??null),n={...t,session:this.applySeenWatermark(t.session??null)}),this.state={...this.state,...n},(Object.prototype.hasOwnProperty.call(n,"session")||Object.prototype.hasOwnProperty.call(n,"capabilities")||Object.prototype.hasOwnProperty.call(n,"contextUsage")||Object.prototype.hasOwnProperty.call(n,"messages")||Object.prototype.hasOwnProperty.call(n,"queuedMessages"))&&this.persistSnapshot(),this.emit()}handleError(t){this.clearHistoryBootstrapReadyTimer();const n=t instanceof Error?t.message:"unknown";this.patch({historyState:"error",errorCode:"RUNTIME_INIT_FAILED",errorDetail:n})}scheduleMarkSeen(){if(this.markSeenTimer!==null)return;const t=this.getTargetSeenAt();if(this.markSeenInFlight||t===null)return;const n=this.getMarkSeenThrottleDelayMs(),s=Math.max(d_,n);this.markSeenTimer=window.setTimeout(()=>{this.markSeenTimer=null;const o=this.getTargetSeenAt();o!==null&&(Ct("session_seen.start",{sessionId:this.sessionId,targetSeenAt:o,seenWatermark:this.seenWatermark}),this.markSeenInFlight=!0,this.lastMarkSeenRequestAt=Date.now(),HN(this.sessionId).then(()=>{var c,l;this.bumpSeenWatermark(o),this.patch({session:iw(this.state.session,o)}),(l=(c=this.options).onSeen)==null||l.call(c,this.sessionId,o),Ct("session_seen.end",{sessionId:this.sessionId,seenWatermark:this.seenWatermark})}).catch(()=>{Ct("session_seen.error",{sessionId:this.sessionId,targetSeenAt:o})}).finally(()=>{this.markSeenInFlight=!1,this.shouldMarkSeen()&&this.scheduleMarkSeen()}))},s)}clearRuntimeRefreshTimer(t){this.runtimeRefreshTimer!==null&&(t&&this.runtimeRefreshMode!==t||(window.clearTimeout(this.runtimeRefreshTimer),this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null))}scheduleHistoryBootstrapReady(){if(this.state.historyState!=="loading"){this.clearHistoryBootstrapReadyTimer();return}this.historyBootstrapReadyTimer===null&&(this.historyBootstrapReadyTimer=window.setTimeout(()=>{this.historyBootstrapReadyTimer=null,this.state.historyState==="loading"&&this.patch({historyState:"ready",hasOlderMessages:ta(this.state.session,this.state.messages.length),pagesLoaded:this.state.messages.length>0?Math.max(this.state.pagesLoaded,1):0})},500))}clearHistoryBootstrapReadyTimer(){this.historyBootstrapReadyTimer!==null&&(window.clearTimeout(this.historyBootstrapReadyTimer),this.historyBootstrapReadyTimer=null)}scheduleRuntimeRefresh(t,n){var s,o;if(!na((s=this.state.session)==null?void 0:s.runningState)){this.clearRuntimeRefreshTimer();return}t==="poll"&&this.state.connectionState==="connected"||(this.clearRuntimeRefreshTimer(),this.runtimeRefreshMode=t,Ct("session_runtime.refresh.schedule",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((o=this.state.session)==null?void 0:o.runningState)??null}),this.runtimeRefreshTimer=window.setTimeout(()=>{const c=this.runtimeRefreshMode??t;this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null,this.refreshRuntimeState(c,n)},t==="poll"?f_:1200))}async refreshRuntimeState(t,n){var s,o,c,l,d;Ct("session_runtime.refresh.start",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((s=this.state.session)==null?void 0:s.runningState)??null});try{const p=await sy(this.sessionId),m=ow(p);this.patch({session:Lr(this.state.session,p.runningState),runtimeHasActiveRun:p.hasActiveRun,runtimeCanInterrupt:p.canInterrupt,contextUsage:p.contextUsage,errorCode:m.errorCode,errorDetail:m.errorDetail}),await this.refreshQueue(),this.state.connectionState!=="connected"&&await this.loadLatestHistory().catch(()=>{});const y=t==="poll"&&this.state.connectionState!=="connected"&&na((o=this.state.session)==null?void 0:o.runningState);Ct("session_runtime.refresh.end",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((c=this.state.session)==null?void 0:c.runningState)??null,continuePolling:y}),y&&this.scheduleRuntimeRefresh("poll","connection_poll")}catch(p){Ct("session_runtime.refresh.error",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((l=this.state.session)==null?void 0:l.runningState)??null,message:p instanceof Error?p.message:"unknown"}),t==="poll"&&this.state.connectionState!=="connected"&&na((d=this.state.session)==null?void 0:d.runningState)&&this.scheduleRuntimeRefresh("poll","connection_poll_retry")}}async refreshSessionMetadata(){const t=[];this.state.session===null&&t.push(zN(this.sessionId).then(n=>{this.patch({session:tc(n,this.state.session)})}).catch(()=>{})),sw(this.state.capabilities)&&t.push(VN(this.sessionId).then(n=>{this.patch({capabilities:n})}).catch(()=>{})),t.length!==0&&await Promise.allSettled(t)}shouldRefreshSessionDetail(){return this.state.session===null||sw(this.state.capabilities)||this.state.session.runningState===null}shouldRefreshRuntimeSnapshot(){return this.state.contextUsage===null}async refreshRuntimeSnapshot(t){Ct("session_runtime.snapshot.start",{sessionId:this.sessionId,reason:t});try{const n=await sy(this.sessionId),s=ow(n);this.patch({session:Lr(this.state.session,n.runningState),runtimeHasActiveRun:n.hasActiveRun,runtimeCanInterrupt:n.canInterrupt,contextUsage:n.contextUsage,errorCode:s.errorCode,errorDetail:s.errorDetail}),await this.refreshQueue(),Ct("session_runtime.snapshot.end",{sessionId:this.sessionId,reason:t,hasContextUsage:n.contextUsage!==null})}catch(n){Ct("session_runtime.snapshot.error",{sessionId:this.sessionId,reason:t,message:n instanceof Error?n.message:"unknown"})}}async refreshQueue(){try{const t=await ZN(this.sessionId);this.patch({queuedMessages:t.items})}catch{return}}async sendMessageWithFallback(t,n,s){var o;try{return await JN(this.sessionId,{content:t,clientRequestId:n,model:(s==null?void 0:s.model)??null,reasoningLevel:(s==null?void 0:s.reasoningLevel)??null,permissionMode:rw(),attachments:(s==null?void 0:s.attachments)??[]})}catch(c){if(!(c instanceof Hn)||c.status!==404&&c.status!==405||(((o=s==null?void 0:s.attachments)==null?void 0:o.length)??0)>0)throw c;return YN(this.sessionId,{content:t,clientRequestId:n})}}handleRuntimeStatus(t){var s;const n=ch((s=this.state.session)==null?void 0:s.runningState,t.status);this.patch({session:Lr(this.state.session,n),runtimeHasActiveRun:na(n)?this.state.runtimeHasActiveRun??!0:!1,runtimeCanInterrupt:na(n)?this.state.runtimeCanInterrupt:!1,errorCode:null,errorDetail:n===t.status?t.detail:this.state.errorDetail}),uS(n)&&(this.clearRuntimeRefreshTimer(),this.refreshQueue(),this.refreshRuntimeSnapshot("runtime_terminal"))}handleRuntimeMessage(t){var s;this.clearHistoryBootstrapReadyTimer();const n=ds(this.state.messages,this.sessionId,[t.message]);this.patch({messages:n,historyState:"ready",hasOlderMessages:ta(this.state.session,n.length),session:Lr(this.state.session,aw("session.delta",(s=this.state.session)==null?void 0:s.runningState))}),this.scheduleMarkSeen(),this.state.queuedMessages.length>0&&this.refreshQueue()}handleRuntimeError(t){var s;const n=ch((s=this.state.session)==null?void 0:s.runningState,"failed");this.clearRuntimeRefreshTimer(),this.patch({session:Lr(this.state.session,n),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:n==="failed"?t.error_code:this.state.errorCode,errorDetail:n==="failed"?t.detail:this.state.errorDetail}),this.refreshQueue()}handleInterrupted(t){var s;const n=ch((s=this.state.session)==null?void 0:s.runningState,"interrupted");this.clearRuntimeRefreshTimer(),this.patch({session:Lr(this.state.session,n),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:n==="interrupted"?null:this.state.errorCode,errorDetail:n==="interrupted"?t.detail:this.state.errorDetail}),this.refreshQueue()}shouldMarkSeen(){return this.getTargetSeenAt()!==null}getTargetSeenAt(){const t=[...this.state.messages].reverse().find(s=>s.role!=="user");if(!t)return null;const n=this.seenWatermark;return n?t.timestamp>n?t.timestamp:null:t.timestamp}syncSeenWatermark(t){t!=null&&t.lastSeenAt&&this.bumpSeenWatermark(t.lastSeenAt)}bumpSeenWatermark(t){this.seenWatermark&&this.seenWatermark>=t||(this.seenWatermark=t)}getMarkSeenThrottleDelayMs(){return this.lastMarkSeenRequestAt<=0?0:Math.max(0,h_-(Date.now()-this.lastMarkSeenRequestAt))}applySeenWatermark(t){return!t||!this.seenWatermark?t:iw(t,this.seenWatermark)}emit(){for(const t of this.listeners)t()}persistSnapshot(){br(uh(this.sessionId),{session:this.state.session,capabilities:this.state.capabilities,runtimeHasActiveRun:this.state.runtimeHasActiveRun,runtimeCanInterrupt:this.state.runtimeCanInterrupt,contextUsage:this.state.contextUsage,messages:g_(this.state.messages),queuedMessages:this.state.queuedMessages})}}function mr(e,t){const[n,s]=w.useState(()=>t(e.getState()));return w.useEffect(()=>e.subscribe(()=>{s(t(e.getState()))}),[t,e]),n}function np(e){const t=e==null?void 0:e.messageCount;return typeof t=="number"&&Number.isFinite(t)?t:null}function m_(e,t){return t>0||np(e)===0?"ready":"loading"}function ta(e,t){const n=np(e);return n!==null?n>t:t>=cS}function Lr(e,t){return e&&{...e,runningState:t}}function iw(e,t){return!e||e.lastSeenAt&&e.lastSeenAt>=t?e:{...e,lastSeenAt:t}}function na(e){return e==="starting"||e==="running"||e==="reconnecting"}function uS(e){return e==="completed"||e==="interrupted"||e==="failed"}function sw(e){if(e===null)return!0;const t=e.modelOptions??[];return t.length===0?!0:t.every(n=>n.usesProviderDefault===!0)}function aw(e,t){return e==="session.backfill"?t??"idle":t==="completed"||t==="interrupted"||t==="failed"?t:"running"}function ch(e,t){return uS(e)?e:t}function ow(e){return e.runningState==="failed"?{errorCode:e.errorCode,errorDetail:e.errorDetail??e.detail}:e.runningState==="interrupted"?{errorCode:null,errorDetail:e.detail}:e.runningState==="completed"?{errorCode:null,errorDetail:e.detail}:{errorCode:null,errorDetail:null}}function lw(){var e,t;if(typeof((e=globalThis.crypto)==null?void 0:e.randomUUID)=="function")return globalThis.crypto.randomUUID();if(typeof((t=globalThis.crypto)==null?void 0:t.getRandomValues)=="function"){const n=new Uint8Array(16);globalThis.crypto.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128;const s=Array.from(n,o=>o.toString(16).padStart(2,"0")).join("");return`${s.slice(0,8)}-${s.slice(8,12)}-${s.slice(12,16)}-${s.slice(16,20)}-${s.slice(20)}`}return`fallback-${Date.now()}-${Math.random().toString(16).slice(2,10)}`}function cw(e,t){return e?t&&e.provider===t.provider?!!t.canSendMessage:e.provider==="codex"||e.provider==="claude-code"||e.provider==="opencode":!1}function uw(e,t){return e?t&&e.provider===t.provider?!(!t.supportsInterrupt||e.provider==="claude-code"&&e.activitySource==="inferred"):e.provider==="codex"||e.provider==="opencode"?!0:e.provider==="claude-code"&&e.activitySource!=="inferred":!1}function uh(e){return`session-runtime.snapshot.${e}`}function g_(e){return e.filter(t=>t.deliveryState==="sent").slice(-lo)}function y_(e,t){const n=e.filter(s=>s.id!==t.id);return n.push(t),n.sort((s,o)=>s.orderIndex-o.orderIndex),n}function tc(e,t){if(!e)return t;if(!t)return e;const n=Date.parse(e.updatedAt||e.lastMessageAt||e.createdAt),s=Date.parse(t.updatedAt||t.lastMessageAt||t.createdAt);return!Number.isFinite(n)||!Number.isFinite(s)?t:n>=s?e:t}function dS({children:e,className:t}){return i.jsx("div",{className:["mobile-top-header-frame",t].filter(Boolean).join(" "),children:e})}function ga({currentWorkspace:e,workspaces:t,onSelectWorkspace:n,className:s,heading:o,content:c,sheetContent:l,triggerLabel:d,triggerAriaLabel:p,onTriggerClick:m,trailing:y}){const[g,b]=w.useState(!1),x=Fr();return e?i.jsxs(i.Fragment,{children:[i.jsx(dS,{className:s,children:i.jsxs("section",{className:"mobile-workspace-home-header",children:[i.jsx("h1",{className:"mobile-workspace-switcher-heading",children:o??e.name}),i.jsxs("div",{className:"mobile-workspace-home-toolbar-top",children:[i.jsxs("button",{type:"button",className:"mobile-workspace-home-switcher","aria-label":p??h("shell.workspaceHomeSwitcherLabel"),onClick:()=>{if(m){m();return}x.trigger("selection"),b(!0)},children:[i.jsx("span",{className:"mobile-workspace-home-switcher-label",children:d??e.name}),i.jsx(b_,{})]}),i.jsx("div",{className:"mobile-workspace-home-toolbar-actions",children:y})]}),i.jsx("p",{className:"mobile-workspace-home-path",children:e.path}),c]})}),g&&!m?v_(i.jsxs(w_,{title:h("shell.workspaceHomeSwitcherTitle"),onClose:()=>b(!1),children:[i.jsx("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:t.map(C=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{C.id!==e.id&&x.trigger("selection"),n==null||n(C.id),b(!1)},children:[i.jsxs("div",{className:"mobile-workspace-home-session-main",children:[i.jsx("span",{className:"mobile-workspace-home-session-title",children:C.name}),i.jsx("span",{className:"mobile-workspace-home-session-meta",children:C.path})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:C.id===e.id?i.jsx(k_,{}):i.jsx(x_,{})})]},C.id))}),l?l(()=>b(!1)):null]})):null]}):null}function v_(e){return typeof document>"u"?null:qn.createPortal(e,document.body)}function w_({title:e,onClose:t,children:n}){return i.jsx("div",{className:"ios-action-sheet-overlay",role:"presentation",onClick:t,children:i.jsxs("div",{className:"mobile-workspace-home-sheet",role:"dialog","aria-modal":"true","aria-label":e,onClick:s=>s.stopPropagation(),children:[i.jsxs("div",{className:"mobile-workspace-home-sheet-card",children:[i.jsx("div",{className:"mobile-workspace-home-sheet-header",children:i.jsx("strong",{children:e})}),n]}),i.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:t,children:h("common.cancel")})]})})}function b_(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function x_(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function k_(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}const hS="mobile.conversation.preview.mode";function dh(){if(typeof window>"u")return"preview";try{return window.localStorage.getItem(hS)==="immersive"?"immersive":"preview"}catch{return"preview"}}function bs(e){if(!(typeof window>"u"))try{window.localStorage.setItem(hS,e)}catch{}}const S_=15e3,dw=1/3,hh=.6,hw=12,C_=60,j_=48,N_=44;function T_(){const{sessionId:e="",workspaceId:t}=yf(),n=Qr(),s=Mn(),o=w.useMemo(()=>new URLSearchParams(n.search),[n.search]),c=(t==null?void 0:t.trim())||null,l=w.useMemo(()=>M_(e,c,o),[c,o,e]),d=w.useMemo(()=>U_(e,n.state),[n.state,e]);return l?i.jsx(R_,{draft:l,navigate:s}):i.jsx(P_,{sessionId:e,bootstrapMessages:d})}function P_({sessionId:e,bootstrapMessages:t}){var Le;const{shellMode:n,navigationGroups:s,requestNavigationRefresh:o,selectWorkspace:c,setSessionWorkspace:l,markNavigationSessionSeen:d,favoriteSessions:p,archiveSession:m,unarchiveSession:y}=lr(),g=Mn(),b=w.useRef(null),x=w.useRef(null),[C,S]=w.useState(!1),[j,M]=w.useState(!1),[A,E]=w.useState(!1),[Z,Y]=w.useState(null),[B,I]=w.useState(!1),_=w.useMemo(()=>s.flatMap(de=>de.sessions).find(de=>de.sessionId===e)??null,[s,e]);(!b.current||x.current!==e)&&((Le=b.current)==null||Le.destroy(),b.current=new p_(e,{initialSession:_,bootstrapMessages:t,onSeen:(de,Ne)=>{d(de,Ne)}}),x.current=e);const F=b.current,{showToast:R,dismissToast:W}=Gn(),J=Fr(),re=w.useRef(null),le=w.useRef(null),ie=w.useRef(null),xe=w.useRef((_==null?void 0:_.runningState)??null),q=mr(F,de=>de.session),K=mr(F,de=>de.capabilities),me=mr(F,de=>de.runtimeHasActiveRun),L=mr(F,de=>de.runtimeCanInterrupt),$=mr(F,de=>de.messages),se=mr(F,de=>de.queuedMessages),P=mr(F,de=>de.contextUsage),be=mr(F,de=>de.historyState),ke=mr(F,de=>de.errorCode),ve=mr(F,de=>de.errorDetail),Ae=mr(F,de=>de.loadingOlderMessages),Be=mr(F,de=>de.hasOlderMessages),qe=mr(F,de=>de.connectionState),[nt,wt]=w.useState(null),[ze,Ot]=w.useState(null),Je=O_(q),_t=Je&&ix(K)&&(q==null?void 0:q.provider)===(K==null?void 0:K.provider),bt=se.some(de=>de.status==="queued"||de.status==="dispatching"),et=n!=="mobile",pt=gS(!et),Nt=(q==null?void 0:q.workspaceId)??(_==null?void 0:_.workspaceId)??null,Bt=w.useMemo(()=>new Set(p.map(de=>de.session.sessionId)),[p]),Rt=w.useMemo(()=>s.map(de=>de.workspace),[s]),ne=w.useMemo(()=>fS(s,(q==null?void 0:q.workspaceId)??(_==null?void 0:_.workspaceId)??null,Bt),[Bt,s,_==null?void 0:_.workspaceId,q==null?void 0:q.workspaceId]),He=w.useMemo(()=>pS(p),[p]),tt=w.useMemo(()=>Nt?s.find(de=>de.workspace.id===Nt)??null:null,[Nt,s]),Tt=w.useMemo(()=>{var de;return $i(((de=q??_)==null?void 0:de.title)??null,h("conversation.titleFallback"))},[_,q]),ce=w.useMemo(()=>(tt==null?void 0:tt.sessions.filter(de=>{var Ne;return de.isArchived===!0&&!((Ne=de.parentSessionId)!=null&&Ne.trim())}))??[],[tt]),Se=w.useRef(null);return w.useEffect(()=>{F.applyNavigationSession(_)},[_,F]),w.useEffect(()=>(F.initialize(),()=>{F.destroy()}),[F]),w.useEffect(()=>(l(e,(q==null?void 0:q.workspaceId)??null),()=>{l(e,null)}),[q==null?void 0:q.workspaceId,e,l]),w.useEffect(()=>()=>{ie.current!==null&&(window.clearTimeout(ie.current),ie.current=null)},[]),w.useEffect(()=>{if(!ke||!ve){ie.current!==null&&(window.clearTimeout(ie.current),ie.current=null),le.current=null,re.current=null,W("conversation-runtime-error");return}const de=`${ke}:${ve}`;if(!(re.current===de||le.current===de)){if(ie.current!==null&&(window.clearTimeout(ie.current),ie.current=null),E_((q==null?void 0:q.provider)??null,ke,ve)){le.current=de,ie.current=window.setTimeout(()=>{le.current=null,ie.current=null,re.current=de,R({id:"conversation-runtime-error",title:h("conversation.runtimeErrorTitle"),description:ve,tone:"error",durationMs:null})},S_);return}le.current=null,re.current=de,R({id:"conversation-runtime-error",title:h("conversation.runtimeErrorTitle"),description:ve,tone:"error",durationMs:null})}},[W,ke,ve,q==null?void 0:q.provider,R]),w.useEffect(()=>{const de=xe.current,Ne=(q==null?void 0:q.runningState)??null;(de==="starting"||de==="running"||de==="reconnecting")&&Ne==="completed"&&J.trigger("success"),xe.current=Ne},[J,q==null?void 0:q.runningState]),mS(Se,!et,e),i.jsxs(i.Fragment,{children:[i.jsxs("main",{className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!et,"data-preview-mode":et?void 0:pt.displayMode,"data-preview-dragging":et?void 0:pt.isDragging,style:et?void 0:pt.pageStyle,children:[et?i.jsx(Nk,{session:q??_}):null,et?null:i.jsx(ga,{className:"mobile-conversation-page-header",currentWorkspace:(tt==null?void 0:tt.workspace)??Rt[0]??null,workspaces:Rt,heading:Tt.fullTitle,triggerAriaLabel:pt.displayMode==="preview"?h("shell.hideSessionSidebar"):h("shell.showSessionSidebar"),onTriggerClick:()=>{pt.togglePreview()},trailing:i.jsx("span",{className:"mobile-conversation-toolbar-title",title:Tt.fullTitle,children:Tt.displayTitle})}),et?null:i.jsx(yS,{visible:pt.isVisible,widthPx:pt.previewWidthPx,isDragging:pt.isDragging,gestureHandlers:pt.railGestureHandlers,activeSessionId:e,favoriteItems:He,items:ne,workspaceSectionLabel:h("shell.mobileConversationCurrentWorkspaceSection"),archiveCurrentActionLabel:h("shell.archiveCurrentSessionAction"),archiveFolderActionLabel:h("shell.archiveFolderAction"),onArchiveActiveSession:()=>{M(!0)},onOpenArchiveFolder:()=>{E(!0)},onActivate:de=>{bs("preview"),g(Vn(de.workspace.id,de.session.sessionId))}}),i.jsx("div",{className:"mobile-conversation-stage",...et?{}:pt.mainGestureHandlers,children:i.jsxs("div",{ref:Se,className:"mobile-conversation-main",children:[i.jsx(rx,{connectionState:qe,onReconnect:()=>F.reconnect()}),i.jsx(yk,{sessionId:e,messages:$,historyState:be,loadingOlderMessages:Ae,hasOlderMessages:Be,provider:(q==null?void 0:q.provider)??null,onLoadOlderMessages:()=>{F.loadOlderMessages()},onRetryMessage:de=>{F.retryMessage(de)}}),i.jsx(QI,{items:se,deletingQueueItemId:nt,steeringQueueItemId:ze,canSteer:_t,onDelete:async de=>{wt(de);try{await F.deleteQueuedMessage(de)}finally{wt(null)}},onSteer:async de=>{Ot(de);try{await F.steerQueuedMessage(de),o()}finally{Ot(null)}}}),i.jsx(ax,{capabilities:K,draftStorageId:e,hasActiveRun:me,contextUsage:P,hasPendingQueuedMessages:bt,canInterrupt:L,isSubmitting:C,isRunning:Je,onInterrupt:async()=>{await F.interrupt(),o()},onSend:async(de,Ne)=>{S(!0);try{await F.sendMessage(de,{model:Ne==null?void 0:Ne.model,reasoningLevel:Ne==null?void 0:Ne.reasoningLevel,attachments:Ne==null?void 0:Ne.attachments,attachmentMeta:Ne==null?void 0:Ne.attachmentMeta}),o()}finally{S(!1)}},onQueueSend:async(de,Ne)=>{S(!0);try{await F.enqueueMessage(de,{model:Ne==null?void 0:Ne.model,reasoningLevel:Ne==null?void 0:Ne.reasoningLevel,attachments:Ne==null?void 0:Ne.attachments,attachmentMeta:Ne==null?void 0:Ne.attachmentMeta})}finally{S(!1)}}})]})})]}),i.jsx(__,{open:j,busy:B,onClose:()=>{B||M(!1)},onConfirm:async()=>{if(!B){I(!0);try{if(await m(e),M(!1),R({title:h("shell.archiveAdded"),tone:"success"}),Nt){c(Nt),bs("preview"),g(_o(Nt));return}g("/workspaces")}catch(de){R({title:de instanceof Error?de.message:h("shell.navigationLoadFailed"),tone:"error"})}finally{I(!1)}}}}),i.jsx(F_,{open:A,workspaceName:(tt==null?void 0:tt.workspace.name)??null,sessions:ce,restoringSessionId:Z,onClose:()=>{Z||E(!1)},onRestore:async de=>{Y(de);try{await y(de),R({title:h("shell.archiveRestored"),tone:"success"})}catch(Ne){R({title:Ne instanceof Error?Ne.message:h("shell.navigationLoadFailed"),tone:"error"})}finally{Y(null)}}})]})}function E_(e,t,n){return e!=="opencode"?!1:t==="OPENCODE_REQUEST_TIMEOUT"||t==="PROVIDER_RUNTIME_TIMEOUT"||/\bSERVER_TIMEOUT\b/i.test(n)||/timeout/i.test(n)||/超时/.test(n)}function R_({draft:e,navigate:t}){const{shellMode:n,navigationGroups:s,requestNavigationRefresh:o,selectWorkspace:c,setSessionWorkspace:l,upsertNavigationSession:d,favoriteSessions:p}=lr(),[m,y]=w.useState(!1),[g,b]=w.useState([]),x=w.useMemo(()=>uT(e.provider),[e.provider]),[C,S]=w.useState(x),j=n!=="mobile",M=gS(!j),A=w.useMemo(()=>A_(e),[e]),E=w.useMemo(()=>new Set(p.map(F=>F.session.sessionId)),[p]),Z=w.useMemo(()=>s.map(F=>F.workspace),[s]),Y=w.useMemo(()=>$i(A.title??null,h("conversation.titleFallback")),[A]),B=w.useMemo(()=>fS(s,e.workspaceId,E),[e.workspaceId,E,s]),I=w.useMemo(()=>pS(p),[p]),_=w.useRef(null);return w.useEffect(()=>(l(e.sessionId,e.workspaceId),()=>{l(e.sessionId,null)}),[e.sessionId,e.workspaceId,l]),w.useEffect(()=>{let F=!1;return S(x),KN(e.provider,e.workspaceId).then(R=>{F||S(R)}).catch(()=>{}),()=>{F=!0}},[e.provider,e.workspaceId,x]),mS(_,!j,e.sessionId),i.jsxs("main",{className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!j,"data-preview-mode":j?void 0:M.displayMode,"data-preview-dragging":j?void 0:M.isDragging,style:j?void 0:M.pageStyle,children:[j?i.jsx(Nk,{session:A}):null,j?null:i.jsx(ga,{className:"mobile-conversation-page-header",currentWorkspace:Z.find(F=>F.id===e.workspaceId)??Z[0]??null,workspaces:Z,heading:Y.fullTitle,triggerAriaLabel:M.displayMode==="preview"?h("shell.hideSessionSidebar"):h("shell.showSessionSidebar"),onTriggerClick:()=>{M.togglePreview()},trailing:i.jsx("span",{className:"mobile-conversation-toolbar-title",title:Y.fullTitle,children:Y.displayTitle})}),j?null:i.jsx(yS,{visible:M.isVisible,widthPx:M.previewWidthPx,isDragging:M.isDragging,gestureHandlers:M.railGestureHandlers,activeSessionId:e.sessionId,favoriteItems:I,items:B,workspaceSectionLabel:h("shell.mobileConversationCurrentWorkspaceSection"),onActivate:F=>{bs("preview"),t(Vn(F.workspace.id,F.session.sessionId))}}),i.jsx("div",{className:"mobile-conversation-stage",...j?{}:M.mainGestureHandlers,children:i.jsxs("div",{ref:_,className:"mobile-conversation-main",children:[i.jsx(rx,{connectionState:"closed",onReconnect:()=>{}}),i.jsx(yk,{sessionId:e.sessionId,messages:g,historyState:"ready",loadingOlderMessages:!1,hasOlderMessages:!1,provider:e.provider,onLoadOlderMessages:()=>{},onRetryMessage:()=>{}}),i.jsx(ax,{capabilities:C,draftStorageId:e.sessionId,contextUsage:null,isSubmitting:m,isRunning:!1,onSend:async(F,R)=>{const W=W_();b(J=>[...J,iS(e.sessionId,F,W,(R==null?void 0:R.attachmentMeta)??[],(R==null?void 0:R.attachments)??[])]),y(!0);try{const J=cn.getState().defaultPermissionMode,re=await XN({workspaceId:e.workspaceId,provider:e.provider,content:F,clientRequestId:W,model:(R==null?void 0:R.model)??null,reasoningLevel:(R==null?void 0:R.reasoningLevel)??null,permissionMode:J==="default"?null:J,attachments:(R==null?void 0:R.attachments)??[]});re.session&&d(re.session),l(re.sessionId,e.workspaceId),bs("preview"),t(Vn(e.workspaceId,re.sessionId),{replace:!0,state:re.message?{bootstrap:{sessionId:re.sessionId,messages:[re.message]}}:null}),o()}catch(J){throw b(re=>ef(re,W)),J}finally{y(!1)}}})]})})]})}function M_(e,t,n){var c,l;if(!B_(e))return null;const s=t??((c=n.get("workspaceId"))==null?void 0:c.trim())??null,o=((l=n.get("provider"))==null?void 0:l.trim())??null;return!s||!lT(o)?null:{sessionId:e,workspaceId:s,provider:o}}function A_(e){const t=new Date().toISOString();return{sessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,providerSessionId:`draft://${e.sessionId}`,rawStoreRef:`draft://${e.sessionId}`,parentSessionId:null,isSubagent:!1,subagentLabel:null,isArchived:!1,title:cT(e.provider),messageCount:0,lastMessageAt:null,createdAt:t,updatedAt:t,syncStatus:"idle",syncCursor:null,lastSyncAt:null,lastErrorCode:null,lastErrorDetail:null,resumedAt:null,runningState:"idle",activitySource:"none",lastEventAt:null,completedAt:null,lastSeenAt:null,activityState:"idle"}}function fS(e,t,n){if(!t)return[];const s=e.find(c=>c.workspace.id===t);return s?Ek($f([s]).filter(c=>!c.session.isArchived&&!n.has(c.session.sessionId))).flatMap(c=>[{entry:c.entry,depth:0},...c.children.map(l=>({entry:l,depth:1}))]):[]}function pS(e){return e.map(t=>({entry:t,depth:0}))}function mS(e,t,n){w.useEffect(()=>{const s=e.current;if(!t||!s){s&&s.style.removeProperty("--mobile-conversation-composer-height");return}const o=s.querySelector(".composer-panel");if(!o){s.style.removeProperty("--mobile-conversation-composer-height");return}const c=s,l=o;function d(){!e.current||!l.isConnected||c.style.setProperty("--mobile-conversation-composer-height",`${l.offsetHeight}px`)}d();const p=typeof ResizeObserver<"u"?new ResizeObserver(d):null;return p==null||p.observe(l),window.addEventListener("resize",d),()=>{p==null||p.disconnect(),window.removeEventListener("resize",d),s.style.removeProperty("--mobile-conversation-composer-height")}},[t,n,e])}function gS(e){const t=Fr(),[n,s]=w.useState(()=>e?dh():"immersive"),[o,c]=w.useState(()=>fw()),[l,d]=w.useState(()=>e&&dh()==="preview"?"default":"closed"),p=w.useRef(l),m=w.useRef(null);w.useEffect(()=>{p.current=l},[l]),w.useEffect(()=>{if(!e){m.current=null,p.current="closed",d("closed"),s("immersive");return}const _=dh();s(_),d(_==="preview"?"default":"closed")},[e]),w.useEffect(()=>{e&&bs(n)},[e,n]),w.useEffect(()=>{if(typeof window>"u")return;function _(){c(fw())}return _(),window.addEventListener("resize",_),()=>{window.removeEventListener("resize",_)}},[]);function y(_){p.current=_,d(_)}function g(_="default"){y(_),s("preview")}function b(){y("closed"),s("immersive")}function x(){y("expanded"),s("preview")}function C(){if(p.current!=="closed"){t.trigger("gesture"),b();return}t.trigger("gesture"),g()}function S(_,F){if(!e||F.touches.length!==1){m.current=null;return}if(L_(F.target)){m.current=null;return}const R=F.touches[0];if(!R){m.current=null;return}if(_==="main"){if(p.current!=="closed"||R.clientX>N_){m.current=null;return}}else if(p.current==="closed"){m.current=null;return}m.current={source:_,startX:R.clientX,startY:R.clientY,lastX:R.clientX,lastY:R.clientY,horizontalLocked:!1}}function j(_){const F=m.current,R=_.touches[0];if(!e||!F||!R)return;const W=R.clientX-F.startX,J=R.clientY-F.startY;if(F.lastX=R.clientX,F.lastY=R.clientY,!F.horizontalLocked){if(Math.abs(W)<hw&&Math.abs(J)<hw)return;if(Math.abs(W)<=Math.abs(J)){m.current=null;return}if(F.source==="main"&&W<=0){m.current=null;return}F.horizontalLocked=!0}}function M(_){var J;const F=m.current;if(m.current=null,!(F!=null&&F.horizontalLocked))return;const R=(J=_==null?void 0:_.changedTouches)==null?void 0:J[0];R&&(F.lastX=R.clientX,F.lastY=R.clientY);const W=F.lastX-F.startX;if(F.source==="main"){W>=C_&&(t.trigger("gesture"),g("default"));return}if(W<=-52){t.trigger("gesture"),b();return}W>=j_&&p.current==="default"&&(t.trigger("gesture"),x())}const A=l==="expanded"?hh:l==="default"?dw:0,E=Math.round(o*A*100)/100,Z=A===0?0:A/hh,Y={"--mobile-conversation-preview-default-width":`${Math.round(o*dw*100)/100}px`,"--mobile-conversation-preview-max-width":`${Math.round(o*hh*100)/100}px`,"--mobile-conversation-preview-width":`${E}px`,"--mobile-conversation-preview-progress":Z.toFixed(4)};return{closePreview:b,displayMode:l==="closed"?"immersive":"preview",isDragging:!1,isVisible:l!=="closed",mainGestureHandlers:{onTouchStart:_=>S("main",_),onTouchMove:j,onTouchEnd:M,onTouchCancel:M},pageStyle:Y,previewWidthPx:E,railGestureHandlers:{onTouchStart:_=>S("rail",_),onTouchMove:j,onTouchEnd:M,onTouchCancel:M},togglePreview:C}}function yS({visible:e,widthPx:t,isDragging:n,gestureHandlers:s,activeSessionId:o,favoriteItems:c,items:l,workspaceSectionLabel:d,archiveCurrentActionLabel:p,archiveFolderActionLabel:m,onArchiveActiveSession:y,onOpenArchiveFolder:g,onActivate:b}){return e?i.jsxs("aside",{className:"mobile-conversation-preview-rail surface-card","data-dragging":n,style:{width:`${t}px`,maxWidth:`${t}px`},...s,children:[i.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-list-favorites",children:[i.jsx("div",{className:"mobile-conversation-preview-group-heading",children:h("shell.favoriteSectionTitle")}),c.length>0?i.jsx("div",{className:"mobile-conversation-preview-list mobile-conversation-preview-list-static",children:c.map(x=>i.jsxs("button",{type:"button",className:"mobile-conversation-preview-item","data-active":x.entry.session.sessionId===o,onClick:()=>b(x.entry),children:[i.jsx("span",{className:pw(x.entry.session.activityState??null,x.entry.session.sessionId===o),"aria-hidden":"true"}),i.jsxs("span",{className:"mobile-conversation-preview-item-copy",children:[i.jsx("span",{className:"mobile-conversation-preview-item-title",children:x.entry.session.title||h("common.unknown")}),i.jsx("span",{className:"mobile-conversation-preview-item-meta",children:nf(x.entry.session.provider,x.entry.session.lastMessageAt??x.entry.session.updatedAt,x.entry.workspace.name)})]})]},`favorite:${x.entry.workspace.id}:${x.entry.session.sessionId}`))}):null]}),i.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-group-workspace",children:[i.jsx("div",{className:"mobile-conversation-preview-group-heading",children:d}),i.jsx("div",{className:"mobile-conversation-preview-list","data-preview-gesture":"ignore",children:l.length===0?i.jsx("p",{className:"mobile-conversation-preview-empty",children:h("shell.emptyWorkspaceSessions")}):l.map(x=>i.jsxs("button",{type:"button",className:"mobile-conversation-preview-item","data-active":x.entry.session.sessionId===o,"data-depth":x.depth,onClick:()=>b(x.entry),children:[i.jsx("span",{className:pw(x.entry.session.activityState??null,x.entry.session.sessionId===o),"aria-hidden":"true"}),i.jsxs("span",{className:"mobile-conversation-preview-item-copy",children:[i.jsx("span",{className:"mobile-conversation-preview-item-title",children:x.entry.session.title||h("common.unknown")}),i.jsx("span",{className:"mobile-conversation-preview-item-meta",children:nf(x.entry.session.provider,x.entry.session.lastMessageAt??x.entry.session.updatedAt)})]})]},`${x.entry.workspace.id}:${x.entry.session.sessionId}`))})]}),p&&y||m&&g?i.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-group-archive",children:[p&&y?i.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button",onClick:()=>{y()},children:p}):null,m&&g?i.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button",onClick:g,children:m}):null]}):null]}):null}function fw(){return typeof window>"u"?390:Math.max(window.innerWidth||390,320)}function L_(e){return e instanceof Element?!!e.closest("input, textarea, select, option, label, [contenteditable='true'], [data-preview-gesture='ignore']"):!1}function pw(e,t){return e==="running"?"mobile-conversation-preview-indicator is-running":t?"mobile-conversation-preview-indicator is-active":"mobile-conversation-preview-indicator is-idle"}function nf(e,t,n){return[n??null,I_(e),D_(t)].filter(Boolean).join(" · ")}function I_(e){return h(e==="codex"?"conversation.providerCodex":e==="opencode"?"conversation.providerOpenCode":"conversation.providerClaude")}function D_(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):h("common.unknown")}function __({open:e,busy:t,onClose:n,onConfirm:s}){return w.useEffect(()=>{if(!e)return;function o(c){c.key==="Escape"&&!t&&n()}return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o)}},[t,n,e]),!e||typeof document>"u"?null:qn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),disabled:t,onClick:n}),i.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":h("shell.archiveConfirmTitle"),children:[i.jsx("div",{className:"workbench-modal-header",children:i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("shell.archiveConfirmTitle")}),i.jsx("p",{children:h("shell.archiveConfirmDescription")})]})}),i.jsx("div",{className:"workbench-modal-body",children:i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:n,children:h("common.cancel")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:t,onClick:()=>{s()},children:h("shell.archiveAction")})]})})]})]}),document.body)}function F_({open:e,workspaceName:t,sessions:n,restoringSessionId:s,onClose:o,onRestore:c}){return w.useEffect(()=>{if(!e)return;function l(d){d.key==="Escape"&&!s&&o()}return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[o,e,s]),!e||typeof document>"u"?null:qn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),disabled:!!s,onClick:o}),i.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":h("shell.archiveModalTitle"),children:[i.jsx("div",{className:"workbench-modal-header",children:i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("shell.archiveModalTitle")}),i.jsx("p",{children:t?`${t} · ${h("shell.archiveModalDescription")}`:h("shell.archiveModalDescription")})]})}),i.jsx("div",{className:"workbench-modal-body",children:n.length>0?i.jsx("div",{className:"workbench-archive-list",children:n.map(l=>{const d=$i(l.title,h("common.unknown"));return i.jsxs("article",{className:"workbench-archive-item",children:[i.jsxs("div",{className:"workbench-archive-item-main",children:[i.jsx("strong",{title:d.fullTitle,children:d.displayTitle}),i.jsx("p",{children:nf(l.provider,l.lastMessageAt??l.updatedAt)})]}),i.jsx("button",{type:"button",className:"secondary-button",disabled:s===l.sessionId,onClick:()=>{c(l.sessionId)},children:h("shell.unarchiveAction")})]},l.sessionId)})}):i.jsx("p",{className:"workbench-section-empty",children:h("shell.archiveEmpty")})})]})]}),document.body)}function O_(e){return e?e.activityState==="running"?!0:e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting":!1}function B_(e){return e.startsWith("draft-")}function U_(e,t){if(!t||typeof t!="object")return[];const n=t.bootstrap;if(!n||typeof n!="object")return[];const s=n.sessionId,o=n.messages;return s!==e||!Array.isArray(o)?[]:o.filter(z_)}function z_(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.messageId=="string"&&typeof t.provider=="string"&&typeof t.providerSessionId=="string"&&typeof t.role=="string"&&typeof t.content=="string"&&typeof t.timestamp=="string"&&typeof t.sequence=="number"&&typeof t.rawRef=="string"}function W_(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?e.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}function rp({open:e,workspaces:t,initialWorkspaceId:n,onClose:s,onSelect:o}){const[c,l]=w.useState(""),[d,p]=w.useState(!1),m=Fr();if(w.useEffect(()=>{e&&(l(H_(t,n)),p(!1))},[n,e,t]),!e||typeof document>"u")return null;const y=t.find(g=>g.id===c)??t[0]??null;return qn.createPortal(i.jsx("div",{className:"ios-action-sheet-overlay",role:"presentation",onClick:s,children:i.jsxs("div",{className:"mobile-workspace-home-sheet",role:"dialog","aria-modal":"true","aria-label":h("shell.createSessionModalTitle"),onClick:g=>g.stopPropagation(),children:[i.jsxs("div",{className:"mobile-workspace-home-sheet-card",children:[i.jsx("div",{className:"mobile-workspace-home-sheet-header",children:i.jsx("strong",{children:h("shell.createSessionModalTitle")})}),i.jsxs("div",{className:"mobile-feature-form mobile-workspace-home-form mobile-create-session-form",children:[i.jsx("p",{className:"mobile-create-session-description",children:h("shell.createSessionModalDescription")}),i.jsxs("div",{className:"mobile-feature-field",children:[i.jsx("span",{children:h("shell.createSessionWorkspaceLabel")}),i.jsxs("button",{type:"button",className:"mobile-create-session-workspace-trigger","aria-label":`${h("shell.createSessionWorkspaceLabel")} ${(y==null?void 0:y.name)??""}`.trim(),"aria-expanded":d?"true":"false",disabled:t.length===0,onClick:()=>{m.trigger("selection"),p(g=>!g)},children:[i.jsxs("span",{className:"mobile-create-session-workspace-copy",children:[i.jsx("strong",{children:(y==null?void 0:y.name)??h("common.unknown")}),i.jsx("span",{children:(y==null?void 0:y.path)??h("common.unknown")})]}),i.jsx($_,{expanded:d})]}),d?i.jsx("div",{className:"mobile-workspace-home-group mobile-create-session-workspace-list",role:"list",children:t.map(g=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-create-session-workspace-row",onClick:()=>{g.id!==c&&m.trigger("selection"),l(g.id),p(!1)},children:[i.jsxs("span",{className:"mobile-create-session-workspace-option-copy",children:[i.jsx("strong",{children:g.name}),i.jsx("span",{children:g.path})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:g.id===c?i.jsx(q_,{}):i.jsx(V_,{})})]},g.id))}):null]}),i.jsxs("div",{className:"mobile-create-session-provider-block",children:[i.jsxs("div",{className:"mobile-create-session-provider-header",children:[i.jsx("span",{className:"mobile-create-session-provider-label",children:h("shell.createSessionProviderLabel")}),i.jsx("span",{className:"mobile-create-session-provider-hint",children:h("shell.providerOptionHint")})]}),i.jsx(Uk,{disabled:!c,onSelect:g=>{c&&o(c,g)}})]})]})]}),i.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:s,children:h("common.cancel")})]})}),document.body)}function H_(e,t){var n;return t&&e.some(s=>s.id===t)?t:((n=e[0])==null?void 0:n.id)??""}function $_({expanded:e}){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"mobile-create-session-workspace-chevron","data-expanded":e?"true":"false",children:i.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function V_(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function q_(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}const G_=420;function mw({entry:e,isFavorite:t,isActive:n=!1,depth:s=0,variant:o="default",hasSubsessions:c=!1,showActions:l=!0,onActivate:d,onToggleSubsessions:p,onToggleFavorite:m,onArchive:y,onUnarchive:g,onRename:b}){const[x,C]=w.useState(!1),S=w.useRef(null),j=w.useRef(!1),M=Fr(),{session:A,workspace:E}=e,Z=A.title??A.sessionId,Y=A.provider==="codex"?h("conversation.providerCodex"):A.provider==="opencode"?h("conversation.providerOpenCode"):h("conversation.providerClaude"),B=[Y,Q_(A.lastMessageAt??A.updatedAt??null)].filter(Boolean).join(" · ");w.useEffect(()=>()=>{I()},[]);function I(){S.current!==null&&(window.clearTimeout(S.current),S.current=null)}function _(le){!c||le.pointerType==="mouse"||(I(),S.current=window.setTimeout(()=>{j.current=!0,M.trigger("gesture"),p==null||p()},G_))}function F(){I()}function R(){if(j.current){j.current=!1;return}M.trigger("selection"),d(A.sessionId)}const W=async()=>{const le=window.prompt(h("shell.renameModalDescription"),Z);le&&(await b(A.sessionId,le.trim()),C(!1))},J=async()=>{if(A.isArchived){await g(A.sessionId),C(!1);return}await y(A.sessionId),C(!1)},re=()=>{m(A.sessionId),C(!1)};return i.jsxs("article",{className:"session-list-item","data-depth":s,"data-active":n,"data-has-subsessions":c,"data-variant":o,children:[i.jsxs("button",{type:"button",className:"session-list-link",onClick:R,onPointerDown:_,onPointerUp:F,onPointerCancel:F,onPointerLeave:F,children:[i.jsx("span",{className:K_({activityState:A.activityState??null,isActive:n,hasSubsessions:c}),"aria-hidden":"true"}),i.jsxs("div",{className:"session-list-copy",children:[i.jsx("div",{className:"session-list-title",children:Z||h("shell.searchEntry")}),i.jsx("div",{className:"session-list-meta",children:o==="mobile"?i.jsx("span",{children:B}):i.jsxs(i.Fragment,{children:[i.jsx("span",{children:E.name}),i.jsx("span",{"aria-hidden":"true",children:"·"}),i.jsx("span",{children:Y})]})})]})]}),l?i.jsxs("div",{className:"session-list-actions",children:[i.jsx("button",{type:"button",className:"ghost-button","aria-expanded":x,onClick:()=>{M.trigger("selection"),C(le=>!le)},children:h("shell.sessionMoreAction")}),x?i.jsxs("div",{className:"session-action-menu surface-card",role:"menu","aria-label":h("shell.sessionMoreAction"),children:[i.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:re,children:h(t?"shell.unfavoriteAction":"shell.favoriteAction")}),i.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void J(),children:A.isArchived?h("shell.unarchiveAction"):h("shell.archiveAction")}),i.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void W(),children:h("shell.renameAction")})]}):null]}):null]})}function K_(e){return e.hasSubsessions?e.activityState==="running"||e.isActive?"session-list-indicator is-subagent-running":"session-list-indicator is-subagent":e.activityState==="running"?"session-list-indicator is-running":"session-list-indicator is-idle"}function Q_(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):h("common.unknown")}function Y_(){const e=Mn(),{navigationGroups:t,favoriteSessionIds:n,currentWorkspaceId:s,currentSessionId:o,navigationLoading:c,selectWorkspace:l,toggleFavoriteSession:d,archiveSession:p,unarchiveSession:m,renameSession:y,startDraftSession:g}=lr(),b=t.find(F=>F.workspace.id===s)??t[0]??null,x=w.useMemo(()=>new Set(n),[n]),C=w.useMemo(()=>b?$f([b]).filter(F=>!F.session.isArchived):[],[b]),S=w.useMemo(()=>Ek(C),[C]),j=(b==null?void 0:b.workspace.id)??"",M=!!j,[A,E]=w.useState([]),[Z,Y]=w.useState(!1);w.useEffect(()=>{if(!o)return;const F=S.filter(R=>R.children.some(W=>W.session.sessionId===o)).map(R=>R.entry.session.sessionId);F.length!==0&&E(R=>{const W=new Set(R);let J=!1;for(const re of F)W.has(re)||(W.add(re),J=!0);return J?Array.from(W):R})},[o,S]);function B(F){E(R=>R.includes(F)?R.filter(W=>W!==F):[...R,F])}function I(F,R){bs("immersive"),e(Vn(F,R))}function _(F,R){Y(!1),bs("immersive"),g(F,R)}return i.jsxs("main",{className:"session-index-page mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header",children:[i.jsx(ga,{currentWorkspace:(b==null?void 0:b.workspace)??null,workspaces:t.map(F=>F.workspace),onSelectWorkspace:F=>{l(F),e(_o(F))},content:i.jsx("button",{type:"button",className:"primary-button mobile-session-index-create-button",disabled:c||!M,onClick:()=>Y(!0),children:h("shell.createSession")})}),i.jsx("div",{className:"mobile-page-top-body",children:i.jsxs("section",{className:"session-section session-section-sheet",children:[i.jsxs("header",{className:"session-section-heading",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.mobileConversationCurrentWorkspaceSection")})}),i.jsx("span",{className:"session-section-count",children:S.length})]}),S.length===0?i.jsx("p",{className:"session-section-empty",children:h(c?"shell.searchSessionHint":"shell.emptyWorkspaceSessions")}):i.jsx("div",{className:"session-current-workspace-list",children:S.map(F=>{const R=F.entry.session.sessionId,W=A.includes(R);return i.jsxs("div",{className:"session-list-tree-node",children:[i.jsx(mw,{entry:F.entry,isFavorite:x.has(R),isActive:o===R,variant:"mobile",hasSubsessions:F.children.length>0,onActivate:J=>I(F.entry.workspace.id,J),onToggleSubsessions:()=>B(R),onToggleFavorite:J=>{d(J)},onArchive:J=>p(J),onUnarchive:J=>m(J),onRename:(J,re)=>y(J,re)}),W&&F.children.length>0?i.jsx("div",{className:"session-list-children",children:F.children.map(J=>i.jsx(mw,{entry:J,isFavorite:x.has(J.session.sessionId),isActive:o===J.session.sessionId,depth:1,variant:"mobile",onActivate:re=>I(J.workspace.id,re),onToggleFavorite:re=>{d(re)},onArchive:re=>p(re),onUnarchive:re=>m(re),onRename:(re,le)=>y(re,le)},`${J.workspace.id}:${J.session.sessionId}`))}):null]},`${F.entry.workspace.id}:${R}`)})})]})}),i.jsx(rp,{open:Z,workspaces:t.map(F=>F.workspace),initialWorkspaceId:s??j,onClose:()=>Y(!1),onSelect:_})]})}function X_(){const{currentWorkspaceId:e}=lr();return e?i.jsx(Ao,{to:fa(e,"files"),replace:!0}):i.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:i.jsxs("article",{className:"mobile-feature-empty surface-card",children:[i.jsx("h1",{children:h("shell.filesEntry")}),i.jsx("p",{children:h("shell.toolsWorkspaceRequiredBody")})]})})}function J_(){const{currentWorkspaceId:e}=lr();return e?i.jsx(Ao,{to:fa(e,"git"),replace:!0}):i.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:i.jsxs("article",{className:"mobile-feature-empty surface-card",children:[i.jsx("h1",{children:h("shell.gitEntry")}),i.jsx("p",{children:h("shell.toolsWorkspaceRequiredBody")})]})})}function MB(){return Xe.request("/api/terminals/shells")}function AB(e){return Xe.request(`/api/terminals?workspaceId=${encodeURIComponent(e)}`)}function Z_(e){return Xe.request(`/api/terminals/templates/${encodeURIComponent(e)}/stop`,{method:"POST"})}function LB(e){return Xe.request("/api/terminals",{method:"POST",body:JSON.stringify(e)})}function IB(e){return Xe.request(`/api/terminals/${encodeURIComponent(e)}`,{method:"DELETE"})}function DB(e){return Xe.request(`/api/terminals/${encodeURIComponent(e)}/record`,{method:"DELETE"})}function _B(e,t={}){const n=new URLSearchParams;typeof t.beforeSeq=="number"&&n.set("beforeSeq",String(t.beforeSeq)),typeof t.limit=="number"&&n.set("limit",String(t.limit));const s=n.toString();return Xe.request(`/api/terminals/${encodeURIComponent(e)}/history${s?`?${s}`:""}`)}function eF(e){return Xe.request("/api/terminals/templates",{method:"POST",body:JSON.stringify(e)})}function gw(e,t){return Xe.request(`/api/terminals/templates/${encodeURIComponent(e)}/run`,{method:"POST",body:JSON.stringify(t)})}function tF(){return[{value:"",label:h("terminal.runtimeAutoOption"),description:h("terminal.runtimeAutoDescription")},{value:"tmux",label:"tmux",description:h("terminal.runtimeTmuxDescription")},{value:"embedded-pty",label:"embedded-pty",description:h("terminal.runtimeEmbeddedDescription")}]}function yw(e){return e||h("terminal.runtimeAutoOption")}function FB(e){return e?e==="embedded-pty"?"pty":e:h("terminal.runtimeAutoShortLabel")}function nF(e){return e instanceof Hn?e.errorCode==="RUNTIME_DEPENDENCY_MISSING"||e.message.includes("当前系统未安装 tmux"):!1}function rF({open:e,busy:t=!1,onClose:n,onConfirmFallback:s}){return w.useEffect(()=>{if(!e)return;function o(c){c.key==="Escape"&&!t&&n()}return window.addEventListener("keydown",o),()=>{window.removeEventListener("keydown",o)}},[t,n,e]),!e||typeof document>"u"?null:qn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:()=>{t||n()}}),i.jsxs("section",{className:"workbench-modal-card surface-card terminal-runtime-fallback-modal",role:"dialog","aria-modal":"true","aria-label":h("terminal.runtimeMissingDialogTitle"),children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:h("terminal.runtimeMissingDialogTitle")}),i.jsx("p",{children:h("terminal.runtimeMissingDialogDescription")})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:()=>{t||n()},children:"x"})]}),i.jsxs("div",{className:"workbench-modal-body terminal-runtime-fallback-body",children:[i.jsxs("section",{className:"terminal-runtime-fallback-section",children:[i.jsx("span",{className:"badge","data-tone":"error",children:"tmux"}),i.jsx("p",{className:"status-text",children:h("terminal.runtimeMissingInstallDescription")}),i.jsxs("ul",{className:"terminal-runtime-fallback-list",children:[i.jsx("li",{children:h("terminal.runtimeMissingInstallMacArm")}),i.jsx("li",{children:h("terminal.runtimeMissingInstallMacIntel")}),i.jsx("li",{children:h("terminal.runtimeMissingInstallDebian")}),i.jsx("li",{children:h("terminal.runtimeMissingInstallFedora")})]})]}),i.jsxs("section",{className:"terminal-runtime-fallback-section",children:[i.jsx("span",{className:"badge",children:"embedded-pty"}),i.jsx("p",{className:"status-text",children:h("terminal.runtimeMissingFallbackDescription")})]}),i.jsxs("div",{className:"workbench-modal-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:n,children:h("terminal.runtimeMissingKeepAction")}),i.jsx("button",{type:"button",className:"primary-button",disabled:t,onClick:s,children:h(t?"terminal.runtimeMissingFallbackPending":"terminal.runtimeMissingFallbackAction")})]})]})]})]}),document.body)}const vw={mode:"command",name:"",cwd:"",target:"",args:"",port:""},ww=60*1e3;function iF(e){return e?new Date(e).toLocaleString():h("common.unknown")}function sF(e){return e.split(" ").map(t=>t.trim()).filter(Boolean)}function aF(e){var t,n,s;return((t=e.find(o=>o.id==="cmd"&&o.available))==null?void 0:t.id)??((n=e.find(o=>o.available))==null?void 0:n.id)??((s=e[0])==null?void 0:s.id)??""}function oF(e){const t=e.name.trim();if(t)return t;const n=e.target.trim(),s=e.args.trim();return n?s?`${n} ${s}`:n:e.mode==="script"?h("terminalManager.defaultScriptName"):h("terminalManager.defaultCommandName")}function lF(e){const t=e.args.join(" ");return t?`${e.command} ${t}`:e.command}function cF(e){const t=e.command.toLowerCase();return t.endsWith(".ps1")||t.endsWith(".bat")||t.endsWith(".cmd")||t.endsWith(".sh")?"script":"command"}function uF(e){const t=e.trim();if(!t)return null;const n=Number(t);return Number.isInteger(n)?n:Number.NaN}function dF(e,t){return e.get(t)??null}function hF(e,t){return e.port===null?{tone:"untracked",title:h("terminalManager.portUnset"),summary:h("terminalManager.portUnsetDescription"),badgeLabel:h("terminalManager.portUnset")}:t!=null&&t.occupied?{tone:"running",title:h("terminalManager.portOccupied"),summary:t.processName||h("terminalManager.processCommandFallback"),badgeLabel:t.processId?`PID ${t.processId}`:h("terminalManager.statusRunning"),badgeTone:"success"}:{tone:"idle",title:h("terminalManager.portAvailable"),summary:h("terminalManager.portAvailableDescription"),badgeLabel:h("terminalManager.statusStopped")}}function fF({open:e,title:t,description:n,onClose:s,children:o,className:c}){return w.useEffect(()=>{if(!e)return;function l(d){d.key==="Escape"&&s()}return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[s,e]),!e||typeof document>"u"?null:qn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:s}),i.jsxs("section",{className:["workbench-modal-card","surface-card","terminal-manager-modal-card",c].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-label":t,children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:t}),i.jsx("p",{children:n})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:s,children:"x"})]}),i.jsx("div",{className:"workbench-modal-body",children:o})]})]}),document.body)}function bw({label:e,value:t,options:n,open:s,onToggle:o,onChange:c}){const l=n.find(d=>d.value===t)??n[0]??null;return i.jsxs("div",{className:"field-group terminal-manager-mobile-picker",children:[i.jsx("span",{children:e}),i.jsxs("button",{type:"button",className:"terminal-manager-mobile-picker-trigger","aria-label":`${e} ${(l==null?void 0:l.label)??""}`.trim(),"aria-expanded":s?"true":"false",onClick:o,children:[i.jsxs("span",{className:"terminal-manager-mobile-picker-copy",children:[i.jsx("strong",{children:(l==null?void 0:l.label)??h("common.unknown")}),l!=null&&l.description?i.jsx("span",{children:l.description}):null]}),i.jsx(pF,{expanded:s})]}),s?i.jsx("div",{className:"terminal-manager-mobile-picker-list",role:"listbox","aria-label":e,children:n.map(d=>{const p=d.value===t;return i.jsxs("button",{type:"button",role:"option",className:"terminal-manager-mobile-picker-option","aria-selected":p,disabled:d.disabled,onClick:()=>{c(d.value)},children:[i.jsxs("span",{className:"terminal-manager-mobile-picker-option-copy",children:[i.jsx("strong",{children:d.label}),d.description?i.jsx("span",{children:d.description}):null]}),i.jsx("span",{className:"terminal-manager-mobile-picker-option-indicator","aria-hidden":"true",children:p?i.jsx(gF,{}):i.jsx(mF,{})})]},d.value||"__empty__")})}):null]})}function pF({expanded:e}){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"terminal-manager-mobile-picker-chevron","data-expanded":e?"true":"false",children:i.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.7"})})}function mF(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function gF(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}function vS({className:e,currentWorkspaceId:t,navigationGroups:n}){var pt,Nt,Bt,Rt;const{subscribeTerminalManagerSnapshot:s,requestTerminalManagerRefresh:o,addTerminalManagerSnapshotListener:c}=lr(),l=(t==null?void 0:t.trim())||null,[d,p]=w.useState([]),[m,y]=w.useState([]),[g,b]=w.useState([]),[x,C]=w.useState([]),[S,j]=w.useState(""),[M,A]=w.useState(""),[E,Z]=w.useState(vw),[Y,B]=w.useState(!1),[I,_]=w.useState([]),[F,R]=w.useState(!1),[W,J]=w.useState(!1),[re,le]=w.useState(null),[ie,xe]=w.useState(null),[q,K]=w.useState(null),[me,L]=w.useState(!1),[$,se]=w.useState(null),{showToast:P}=Gn(),be=(e==null?void 0:e.includes("mobile-tool-process-panel"))??!1;w.useEffect(()=>{Ct("terminal_manager.props",{currentWorkspaceId:t,workspaceCount:n.length})},[t,n.length]);const ke=w.useMemo(()=>x.find(ne=>ne.id===S)??null,[S,x]),ve=w.useMemo(()=>tF(),[]),Ae=w.useMemo(()=>new Map(g.map(ne=>[ne.templateId,ne])),[g]),Be=w.useMemo(()=>g.filter(ne=>ne.occupied).length,[g]),qe=w.useMemo(()=>m.filter(ne=>ne.port!==null).length,[m]),nt=(ke==null?void 0:ke.available)===!1&&x.length>0;w.useEffect(()=>{j(ne=>x.length?ne&&x.some(He=>He.id===ne)?ne:aF(x):"")},[x]),w.useEffect(()=>{!Y||!l||x.length>0||ze(l)},[l,Y,x.length]),w.useEffect(()=>{Y||se(null)},[Y]),w.useEffect(()=>{if(!l){p([]),y([]),b([]),R(!1);return}const ne=Cn(fh(l),ww);Ct("terminal_manager.snapshot",{workspaceId:l,cached:!!ne,cachedTemplateCount:(ne==null?void 0:ne.templates.length)??0,cachedStatusCount:(ne==null?void 0:ne.templateStatuses.length)??0}),ne?(p(ne.terminals),y(ne.templates),b(ne.templateStatuses),C(ne.shellOptions??[]),R(!1)):(p([]),y([]),b([]),C([]),R(!0))},[l]),w.useEffect(()=>{if(l)return c(ne=>{ne.workspaceId===l&&(Ct("terminal_manager.snapshot_received",{workspaceId:ne.workspaceId,terminalCount:ne.terminals.length,templateCount:ne.templates.length,statusCount:ne.templateStatuses.length}),wt(ne),R(!1))})},[l,c]),w.useEffect(()=>{if(!l)return;const ne=Cn(fh(l),ww)!==null;if(s(l),ne){const He=window.setTimeout(()=>{ze(l)},1500);return()=>{window.clearTimeout(He)}}ze(l)},[l,o,s]),w.useEffect(()=>{l&&br(fh(l),{terminals:d,templates:m,templateStatuses:g,shellOptions:x})},[l,x,g,m,d]);function wt(ne){p(ne.terminals),y(ne.templates),b(ne.templateStatuses),C(ne.shellOptions??[])}function ze(ne){Ct("terminal_manager.refresh_requested",{workspaceId:ne}),o(ne)}async function Ot(ne){if(l){xe(ne);try{await Z_(ne),ze(l),P({title:h("terminalManager.stopProcessSuccess"),tone:"success"})}catch(He){P({title:He instanceof Error?He.message:h("terminalManager.stopProcessFailed"),tone:"error"})}finally{xe(null)}}}async function Je(){if(!l||!E.target.trim())return;const ne=uF(E.port);if(Number.isNaN(ne)){P({title:h("terminalManager.invalidPort"),tone:"error"});return}J(!0);try{await eF({workspaceId:l,name:oF(E),cwd:E.cwd.trim()||void 0,command:E.target.trim(),args:sF(E.args),port:ne,runtimeType:M||null}),Z(vw),A(""),B(!1),ze(l),P({title:h("terminalManager.templateSaveSuccess"),tone:"success"})}catch(He){P({title:He instanceof Error?He.message:h("terminalManager.templateSaveFailed"),tone:"error"})}finally{J(!1)}}async function _t(ne){if(!l)return;const He=ke!=null&&ke.available?ke.shell:void 0;le(ne);try{await gw(ne,{shell:He}),ze(l),P({title:h("terminalManager.templateRunSuccess"),tone:"success"})}catch(tt){if(nF(tt)){K({templateId:ne,shell:He});return}P({title:tt instanceof Error?tt.message:h("terminalManager.templateRunFailed"),tone:"error"})}finally{le(null)}}async function bt(){if(!(!l||!q)){L(!0);try{await gw(q.templateId,{shell:q.shell,runtimeType:"embedded-pty"}),K(null),ze(l),P({title:h("terminalManager.templateRunSuccess"),tone:"success"})}catch(ne){P({title:ne instanceof Error?ne.message:h("terminalManager.templateRunFailed"),tone:"error"})}finally{L(!1)}}}function et(ne){_(He=>He.includes(ne)?He.filter(tt=>tt!==ne):[...He,ne])}return n.length?l?i.jsxs("section",{className:["conversation-panel","surface-card","terminal-manager-panel",e].filter(Boolean).join(" "),children:[i.jsx(rF,{open:q!==null,busy:me,onClose:()=>{me||K(null)},onConfirmFallback:()=>{bt()}}),i.jsxs("div",{className:"terminal-manager-header terminal-manager-desktop-header",children:[i.jsxs("div",{className:"terminal-manager-panel-heading",children:[i.jsx("span",{className:"terminal-manager-panel-eyebrow",children:h("terminalManager.quickLaunchTitle")}),i.jsxs("div",{children:[i.jsx("h2",{children:h("terminalManager.templateSectionTitle")}),i.jsx("p",{className:"status-text",children:h("terminalManager.desktopPanelDescription")})]})]}),i.jsxs("div",{className:"terminal-manager-overview",children:[i.jsxs("article",{className:"terminal-manager-overview-card",children:[i.jsx("span",{children:h("terminalManager.runningCountLabel")}),i.jsx("strong",{children:Be})]}),i.jsxs("article",{className:"terminal-manager-overview-card",children:[i.jsx("span",{children:h("terminalManager.portWatchCountLabel")}),i.jsx("strong",{children:qe})]}),i.jsxs("article",{className:"terminal-manager-overview-card",children:[i.jsx("span",{children:h("terminalManager.terminalCountLabel")}),i.jsx("strong",{children:d.length})]})]}),i.jsxs("div",{className:"terminal-manager-toolbar terminal-manager-toolbar-header",children:[i.jsx("button",{className:"ghost-button",type:"button",disabled:!l||F,onClick:()=>{l&&ze(l)},children:h("terminalManager.refresh")}),i.jsx("button",{className:"primary-button",type:"button",disabled:!l,onClick:()=>{A(""),B(!0)},children:h("terminalManager.openCreateModalAction")})]})]}),i.jsxs("section",{className:"terminal-manager-section",children:[i.jsxs("div",{className:"terminal-manager-section-header",children:[i.jsxs("div",{children:[i.jsx("h3",{children:h("terminalManager.templateSectionTitle")}),i.jsx("p",{className:"status-text",children:h("terminalManager.templateSectionDescription")})]}),i.jsx("span",{className:"workbench-section-counter",children:m.length})]}),F&&!m.length?i.jsx("p",{className:"status-text",children:h("common.loading")}):null,m.length?i.jsx("div",{className:"terminal-manager-list",children:m.map(ne=>{const He=dF(Ae,ne.id),tt=hF(ne,He),Tt=I.includes(ne.id),ce=h(Tt?"terminalManager.hideDetailsAction":"terminalManager.showDetailsAction");return i.jsxs("article",{className:"terminal-manager-card terminal-manager-desktop-card","data-tone":tt.tone,"data-expanded":Tt?"true":"false",children:[i.jsxs("div",{className:"terminal-manager-card-header",children:[i.jsxs("div",{className:"terminal-manager-card-title",children:[i.jsx("span",{className:"terminal-manager-card-indicator","aria-hidden":"true"}),i.jsx("strong",{children:ne.name})]}),i.jsxs("div",{className:"terminal-manager-card-tools",children:[i.jsx("span",{className:"badge terminal-runtime-badge",children:yw(ne.runtimeType)}),i.jsx("span",{className:"badge",children:cF(ne)==="script"?h("terminalManager.scriptMode"):h("terminalManager.commandMode")}),i.jsx("button",{className:"terminal-manager-detail-toggle",type:"button","aria-label":ce,"aria-expanded":Tt,onClick:()=>{et(ne.id)},children:"i"})]})]}),i.jsxs("div",{className:"terminal-manager-status-panel",children:[i.jsxs("div",{className:"terminal-manager-status-copy",children:[i.jsx("p",{className:"terminal-manager-status-title",children:tt.title}),i.jsx("p",{className:"status-text",children:tt.summary})]}),i.jsxs("div",{className:"terminal-manager-status-badges",children:[i.jsx("span",{className:"terminal-manager-stat-pill",children:ne.port===null?h("terminalManager.portUnset"):`${h("terminalManager.portLabel")} ${ne.port}`}),i.jsx("span",{className:"badge","data-tone":tt.badgeTone,children:tt.badgeLabel})]})]}),i.jsxs("div",{className:"terminal-manager-actions",children:[He!=null&&He.occupied?i.jsx("button",{className:"secondary-button",type:"button",disabled:ie===ne.id,onClick:()=>{Ot(ne.id)},children:ie===ne.id?h("terminalManager.stoppingProcess"):h("terminalManager.stopProcessAction")}):null,i.jsx("button",{className:"secondary-button",type:"button",disabled:re===ne.id||nt,onClick:()=>{_t(ne.id)},children:re===ne.id?h("terminalManager.runningTemplate"):h("terminalManager.runTemplateAction")})]}),Tt?i.jsx("section",{className:"terminal-manager-details","aria-label":h("terminalManager.detailsSectionTitle"),children:i.jsxs("div",{className:"terminal-manager-detail-grid",children:[i.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[i.jsx("span",{children:h("terminalManager.commandPreviewLabel")}),i.jsx("strong",{children:lF(ne)})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.cwdLabel")}),i.jsx("strong",{children:ne.cwd})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminal.runtimeField")}),i.jsx("strong",{children:yw(ne.runtimeType)})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.updatedAt")}),i.jsx("strong",{children:iF(ne.updatedAt)})]}),i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.portLabel")}),i.jsx("strong",{children:ne.port===null?h("terminalManager.portUnset"):ne.port})]}),He!=null&&He.processId?i.jsxs("div",{className:"terminal-manager-detail-item",children:[i.jsx("span",{children:h("terminalManager.processIdLabel")}),i.jsx("strong",{children:He.processId})]}):null,He!=null&&He.processCommandLine?i.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[i.jsx("span",{children:h("terminalManager.processCommandLabel")}),i.jsx("strong",{children:He.processCommandLine})]}):null]})}):null]},ne.id)})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("terminalManager.emptyTemplateBody")})})]}),i.jsx(fF,{open:Y,title:h("terminalManager.createModalTitle"),description:h("terminalManager.createModalDescription"),className:be?"terminal-manager-mobile-modal":void 0,onClose:()=>{A(""),B(!1)},children:i.jsxs("section",{className:"terminal-manager-modal-form",children:[be?i.jsxs(i.Fragment,{children:[i.jsx(bw,{label:h("terminalManager.shellField"),value:S,open:$==="shell",options:x.map(ne=>({value:ne.id,label:ne.label,description:ne.available?null:ne.unavailableReason??h("terminalManager.shellUnavailable"),disabled:!ne.available})),onToggle:()=>{se(ne=>ne==="shell"?null:"shell")},onChange:ne=>{j(ne),se(null)}}),(ke==null?void 0:ke.available)===!1&&ke.unavailableReason?i.jsx("p",{className:"status-text",children:ke.unavailableReason}):null,i.jsx(bw,{label:h("terminal.runtimeField"),value:M,open:$==="runtime",options:ve.map(ne=>({value:ne.value,label:ne.label,description:ne.description})),onToggle:()=>{se(ne=>ne==="runtime"?null:"runtime")},onChange:ne=>{A(ne),se(null)}}),i.jsx("p",{className:"status-text",children:((pt=ve.find(ne=>ne.value===M))==null?void 0:pt.description)??((Nt=ve[0])==null?void 0:Nt.description)})]}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.shellField")}),i.jsx("select",{value:S,onChange:ne=>{j(ne.target.value)},children:x.map(ne=>i.jsx("option",{value:ne.id,disabled:!ne.available,children:ne.available?ne.label:`${ne.label} - ${h("terminalManager.shellUnavailable")}`},ne.id))}),(ke==null?void 0:ke.available)===!1&&ke.unavailableReason?i.jsx("p",{className:"status-text",children:ke.unavailableReason}):null]}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminal.runtimeField")}),i.jsx("select",{value:M,onChange:ne=>{A(ne.target.value)},children:ve.map(ne=>i.jsx("option",{value:ne.value,children:ne.label},ne.value||"auto"))}),i.jsx("p",{className:"status-text",children:((Bt=ve.find(ne=>ne.value===M))==null?void 0:Bt.description)??((Rt=ve[0])==null?void 0:Rt.description)})]})]}),i.jsxs("div",{className:"terminal-manager-mode-row",role:"tablist","aria-label":h("terminalManager.modeField"),children:[i.jsx("button",{type:"button",className:E.mode==="command"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{Z(ne=>({...ne,mode:"command"}))},children:h("terminalManager.commandMode")}),i.jsx("button",{type:"button",className:E.mode==="script"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{Z(ne=>({...ne,mode:"script"}))},children:h("terminalManager.scriptMode")})]}),i.jsxs("div",{className:"terminal-manager-grid",children:[i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.templateNameField")}),i.jsx("input",{value:E.name,placeholder:h("terminalManager.templateNamePlaceholder"),onChange:ne=>{Z(He=>({...He,name:ne.target.value}))}})]}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.cwdField")}),i.jsx("input",{value:E.cwd,placeholder:h("terminalManager.cwdPlaceholder"),onChange:ne=>{Z(He=>({...He,cwd:ne.target.value}))}})]})]}),i.jsxs("div",{className:"terminal-manager-grid",children:[i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:E.mode==="script"?h("terminalManager.scriptPathField"):h("terminalManager.commandField")}),i.jsx("input",{value:E.target,placeholder:E.mode==="script"?h("terminalManager.scriptPathPlaceholder"):h("terminalManager.commandPlaceholder"),onChange:ne=>{Z(He=>({...He,target:ne.target.value}))}})]}),i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.argsField")}),i.jsx("input",{value:E.args,placeholder:h("terminalManager.argsPlaceholder"),onChange:ne=>{Z(He=>({...He,args:ne.target.value}))}})]})]}),i.jsx("div",{className:"terminal-manager-grid",children:i.jsxs("div",{className:"field-group",children:[i.jsx("span",{children:h("terminalManager.portField")}),i.jsx("input",{value:E.port,placeholder:h("terminalManager.portPlaceholder"),onChange:ne=>{Z(He=>({...He,port:ne.target.value}))}})]})}),i.jsxs("div",{className:"terminal-manager-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>{A(""),B(!1)},children:h("common.close")}),i.jsx("button",{className:"primary-button",type:"button",disabled:!l||W||!E.target.trim(),onClick:()=>{Je()},children:h(W?"terminalManager.templateSaving":"terminalManager.saveLaunchAction")})]})]})})]}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("terminalManager.noCurrentWorkspaceBody")})}):i.jsx("section",{className:"workbench-empty-state minimal",children:i.jsx("p",{children:h("terminalManager.emptyWorkspaceBody")})})}function fh(e){return`terminal-manager.snapshot.${e}`}const yF=Object.freeze(Object.defineProperty({__proto__:null,TerminalManagerPanel:vS},Symbol.toStringTag,{value:"Module"}));function vF(){const{currentWorkspaceId:e,navigationGroups:t}=lr();return e?i.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root mobile-tool-panel-page mobile-tool-process-page",children:i.jsx(vS,{className:"mobile-panel-scroll-root mobile-tool-native-panel mobile-tool-process-panel",currentWorkspaceId:e,navigationGroups:t})}):i.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:i.jsxs("article",{className:"mobile-feature-empty surface-card",children:[i.jsx("h1",{children:h("shell.terminalManagerEntry")}),i.jsx("p",{children:h("shell.toolsWorkspaceRequiredBody")})]})})}const wF=new Set(["abstract","as","async","await","break","case","catch","class","const","continue","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","readonly","return","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","with","yield"]),bF=new Set(["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","False","finally","for","from","global","if","import","in","is","lambda","None","nonlocal","not","or","pass","raise","return","True","try","while","with","yield"]),xF=new Set(["case","do","done","elif","else","esac","export","fi","for","function","if","in","local","readonly","return","then","until","while"]),kF=new Set(["add","alter","and","as","asc","between","by","create","delete","desc","drop","from","group","having","insert","into","join","left","like","limit","not","null","offset","on","or","order","right","select","set","table","union","update","values","where"]),SF=new Set(["add","arg","cmd","copy","entrypoint","env","expose","from","healthcheck","label","maintainer","onbuild","run","shell","stopsignal","user","volume","workdir","as"]),CF=new Set(["trace","debug","info","warn","warning","error","fatal"]);function jF({workspaceId:e,filePath:t,open:n,onClose:s,onSaved:o}){const[c,l]=w.useState(null),[d,p]=w.useState(""),[m,y]=w.useState(!1),[g,b]=w.useState(!1),[x,C]=w.useState("preview"),{showToast:S}=Gn(),j=w.useMemo(()=>xS(t),[t]),M=j==="markdown",A=!!(c!=null&&c.supported&&c.kind==="text");if(w.useEffect(()=>{if(!n){l(null),p(""),y(!1),b(!1),C("preview");return}if(!e||!t)return;const _=e,F=t;let R=!1;async function W(){y(!0);try{const J=await Nv(_,F);R||(l(J),p(J.content??""),C((WF(F),"preview")))}catch(J){R||(S({title:xw(J,h("conversation.filePanelOpenFailed")),tone:"error"}),s())}finally{R||y(!1)}}return W(),()=>{R=!0}},[t,s,n,S,e]),w.useEffect(()=>{if(!n)return;function _(F){F.key==="Escape"&&s()}return window.addEventListener("keydown",_),()=>{window.removeEventListener("keydown",_)}},[s,n]),!n||!t||typeof document>"u")return null;const E=t,Z=e;async function Y(){if(!(!Z||!(c!=null&&c.version)||!A)){b(!0);try{await HD(Z,E,d,c.version);const _=await Nv(Z,E);l(_),p(_.content??""),await o(E),S({title:h("conversation.filePanelSaveSuccess"),tone:"success"}),C("preview")}catch(_){S({title:xw(_,h("conversation.filePanelSaveFailed")),tone:"error"})}finally{b(!1)}}}const B=(c==null?void 0:c.content)??"",I=A&&d!==B;return qn.createPortal(i.jsxs("div",{className:"workbench-modal-layer",children:[i.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":h("common.close"),onClick:s}),i.jsxs("section",{className:"workbench-modal-card surface-card file-viewer-modal",role:"dialog","aria-modal":"true","aria-label":t,children:[i.jsxs("div",{className:"workbench-modal-header",children:[i.jsxs("div",{className:"workbench-modal-title-wrap",children:[i.jsx("h2",{children:t}),i.jsx("p",{children:h("conversation.fileViewerHint").replace("{language}",rf(j))})]}),i.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":h("common.close"),onClick:s,children:i.jsx(HF,{})})]}),i.jsxs("div",{className:"file-viewer-toolbar",children:[i.jsxs("div",{className:"file-viewer-tabs",role:"tablist","aria-label":h("conversation.fileViewerModeLabel"),children:[i.jsx("button",{type:"button",className:"file-viewer-tab","data-active":x==="preview",role:"tab","aria-selected":x==="preview",onClick:()=>C("preview"),children:h(M?"conversation.fileViewerPreview":"conversation.fileViewerCode")}),i.jsx("button",{type:"button",className:"file-viewer-tab","data-active":x==="edit",role:"tab","aria-selected":x==="edit",onClick:()=>C("edit"),disabled:!A,children:h("conversation.fileViewerEdit")})]}),i.jsxs("div",{className:"file-viewer-actions",children:[i.jsx("span",{className:"file-viewer-language",children:rf(j)}),i.jsx("button",{type:"button",className:"primary-button",onClick:()=>void Y(),disabled:!I||g,children:h(g?"conversation.filePanelSaving":"conversation.filePanelSave")})]})]}),i.jsx("div",{className:"workbench-modal-body file-viewer-body",children:m?i.jsx("p",{className:"status-text",children:h("common.loading")}):(c==null?void 0:c.supported)===!1?i.jsx("p",{className:"status-text",children:c.reason??h("conversation.filePanelUnsupported")}):x==="edit"?i.jsx("textarea",{className:"file-viewer-editor","data-testid":"file-viewer-editor",value:d,onChange:_=>p(_.target.value),spellCheck:!1}):M?i.jsx(NF,{content:d}):i.jsx(wS,{content:d,language:j})})]})]}),document.body)}function NF({content:e}){return i.jsx("div",{className:"markdown-content file-viewer-markdown",children:i.jsx(_f,{remarkPlugins:[Uf],components:{code(t){const n=typeof t.className=="string"?t.className:"",s=/language-([\w-]+)/.exec(n);return s?i.jsx(wS,{content:String(t.children).replace(/\n$/,""),language:sp(s[1]??"plain")}):i.jsx("code",{className:n||void 0,children:t.children})}},children:e})})}function wS({content:e,language:t}){const n=e.split(/\r?\n/);return i.jsxs("div",{className:"file-viewer-code-block",children:[i.jsx("div",{className:"file-viewer-code-header",children:rf(t)}),i.jsx("div",{className:"file-viewer-code-body",children:n.map((s,o)=>{const c=TF(s,t);return i.jsxs("div",{className:"file-viewer-code-line",children:[i.jsx("span",{className:"file-viewer-code-gutter",children:o+1}),i.jsx("code",{className:"file-viewer-code-content",children:c.length?c.map((l,d)=>i.jsx("span",{className:`code-token ${l.kind}`,children:l.text},`${o}-${d}-${l.text}`)):i.jsx("span",{className:"code-token plain",children:" "})})]},`${o}-${s}`)})})]})}function TF(e,t){const n=sp(t);return n==="json"?PF(e):n==="yaml"?AF(e):n==="toml"?LF(e):n==="ini"?bS(e):n==="env"?IF(e):n==="properties"?DF(e):n==="conf"?_F(e):n==="editorconfig"?FF(e):n==="dockerfile"?OF(e):n==="gitignore"?BF(e):n==="log"?UF(e):n==="python"?vo(e,bF,"#"):n==="shell"?vo(e,xF,"#"):n==="sql"?MF(e):n==="html"||n==="xml"?EF(e):n==="css"?RF(e):n==="markdown"?[{text:e,kind:"plain"}]:vo(e,wF,"//")}function vo(e,t,n){const s=[];let o=0;for(;o<e.length;){const c=e.slice(o);if(c.startsWith(n)){s.push({text:c,kind:"comment"});break}const l=/^(?:'[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|`[^`\\]*(?:\\.[^`\\]*)*`)/.exec(c);if(l){s.push({text:l[0],kind:"string"}),o+=l[0].length;continue}const d=/^(?:0x[\da-fA-F]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/.exec(c);if(d){s.push({text:d[0],kind:"number"}),o+=d[0].length;continue}const p=/^[A-Za-z_][\w$-]*/.exec(c);if(p){const y=p[0],g=y.toLowerCase();y==="true"||y==="false"||g==="true"||g==="false"?s.push({text:y,kind:"boolean"}):y==="null"||y==="None"||g==="none"?s.push({text:y,kind:"null"}):t.has(y)||t.has(g)?s.push({text:y,kind:"keyword"}):s.push({text:y,kind:"plain"}),o+=y.length;continue}const m=/^(?:===|!==|==|!=|<=|>=|=>|&&|\|\||[+\-*/%=<>!?:|&^~]+)/.exec(c);if(m){s.push({text:m[0],kind:"operator"}),o+=m[0].length;continue}s.push({text:c[0]??"",kind:"plain"}),o+=1}return s}function PF(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n),o=/^"(?:[^"\\]|\\.)*"/.exec(s);if(o){const p=e.slice(n+o[0].length).trimStart()[0];t.push({text:o[0],kind:p===":"?"attr":"string"}),n+=o[0].length;continue}const c=/^(?:-?\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i.exec(s);if(c){t.push({text:c[0],kind:"number"}),n+=c[0].length;continue}const l=/^(?:true|false|null)\b/.exec(s);if(l){const p=l[0]==="null"?"null":"boolean";t.push({text:l[0],kind:p}),n+=l[0].length;continue}const d=/^(?::|,|\{|\}|\[|\])/.exec(s);if(d){t.push({text:d[0],kind:"operator"}),n+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function EF(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("<!--")){t.push({text:s,kind:"comment"});break}const o=/^(<\/?[\w:-]+)/.exec(s);if(o){t.push({text:o[0],kind:"tag"}),n+=o[0].length;continue}const c=/^([\w:-]+)(=)/.exec(s);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),n+=c[0].length;continue}const l=/^(?:'[^']*'|"[^"]*")/.exec(s);if(l){t.push({text:l[0],kind:"string"}),n+=l[0].length;continue}const d=/^(?:\/?>)/.exec(s);if(d){t.push({text:d[0],kind:"operator"}),n+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function RF(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("/*")){t.push({text:s,kind:"comment"});break}const o=/^(?:'[^']*'|"[^"]*")/.exec(s);if(o){t.push({text:o[0],kind:"string"}),n+=o[0].length;continue}const c=/^([A-Za-z-]+)(\s*:)/.exec(s);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),n+=c[0].length;continue}const l=/^(?:#(?:[\da-fA-F]{3,8})|\d+(?:\.\d+)?(?:px|rem|em|vh|vw|%)?)/.exec(s);if(l){t.push({text:l[0],kind:"number"}),n+=l[0].length;continue}const d=/^(?:@media|@supports|@import|@keyframes)\b/.exec(s);if(d){t.push({text:d[0],kind:"keyword"}),n+=d[0].length;continue}const p=/^(?:[{}:;(),.>])/.exec(s);if(p){t.push({text:p[0],kind:"operator"}),n+=p[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function MF(e){return vo(e,kF,"--")}function AF(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("#")){t.push({text:s,kind:"comment"});break}const o=/^([A-Za-z0-9_.-]+)(\s*:)/.exec(s);if(o){t.push({text:o[1]??"",kind:"attr"}),t.push({text:o[2]??"",kind:"operator"}),n+=o[0].length;continue}const c=/^(?:'[^']*'|"[^"]*")/.exec(s);if(c){t.push({text:c[0],kind:"string"}),n+=c[0].length;continue}const l=/^(?:-?\d+(?:\.\d+)?)/.exec(s);if(l){t.push({text:l[0],kind:"number"}),n+=l[0].length;continue}const d=/^(?:true|false|yes|no|null|~)\b/i.exec(s);if(d){const m=d[0].toLowerCase(),y=m==="null"||m==="~"?"null":"boolean";t.push({text:d[0],kind:y}),n+=d[0].length;continue}const p=/^(?:[-?:,[\]{}|>])/.exec(s);if(p){t.push({text:p[0],kind:"operator"}),n+=p[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function LF(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("#")){t.push({text:s,kind:"comment"});break}const o=/^(\[\[?[^\]]+\]?\])/.exec(s);if(o){t.push({text:o[0],kind:"tag"}),n+=o[0].length;continue}const c=/^([A-Za-z0-9_.-]+)(\s*=)/.exec(s);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),n+=c[0].length;continue}const l=Hc(s,{trueValues:["true"],falseValues:["false"],nullValues:[]});if(l){t.push(...l.tokens),n+=l.length;continue}const d=/^(?:[,[\]{}])/.exec(s);if(d){t.push({text:d[0],kind:"operator"}),n+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function bS(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n),o=s.trimStart();if(o.startsWith(";")||o.startsWith("#")){t.push({text:s,kind:"comment"});break}const c=/^(\[[^\]]+\])/.exec(s);if(c){t.push({text:c[0],kind:"tag"}),n+=c[0].length;continue}const l=/^([A-Za-z0-9_.-]+)(\s*[=:])/.exec(s);if(l){t.push({text:l[1]??"",kind:"attr"}),t.push({text:l[2]??"",kind:"operator"}),n+=l[0].length;continue}const d=Hc(s,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(d){t.push(...d.tokens),n+=d.length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function IF(e){if(e.trimStart().startsWith("#"))return[{text:e,kind:"comment"}];const n=/^(\s*)(export)(\s+)/.exec(e),s=n?n[0].length:0,o=[];n&&(o.push({text:n[1]??"",kind:"plain"}),o.push({text:n[2]??"",kind:"keyword"}),o.push({text:n[3]??"",kind:"plain"}));const c=e.slice(s),l=/^([A-Za-z_][A-Za-z0-9_]*)(=)/.exec(c);if(!l)return bS(e);o.push({text:l[1]??"",kind:"attr"}),o.push({text:l[2]??"",kind:"operator"});const d=c.slice(l[0].length),p=Hc(d,{trueValues:["true"],falseValues:["false"],nullValues:["null"]});return p?(o.push(...p.tokens),o):(o.push({text:d,kind:"plain"}),o)}function DF(e){return ip(e,{commentPrefixes:["#","!"],allowSection:!1,delimiters:["=",":"]})}function _F(e){return ip(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["=",":"]})}function FF(e){return ip(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["="]})}function OF(e){return vo(e,SF,"#")}function BF(e){const t=e.trimStart();if(!t)return[];if(t.startsWith("#"))return[{text:e,kind:"comment"}];if(t.startsWith("!")){const n=e.length-t.length,s=e.slice(0,n),o=t.slice(1);return[{text:s,kind:"plain"},{text:"!",kind:"operator"},{text:o,kind:"string"}]}return[{text:e,kind:"string"}]}function UF(e){const t=[];let n=0;for(;n<e.length;){const s=e.slice(n);if(s.startsWith("#")){t.push({text:s,kind:"comment"});break}const o=/^(?:\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:[.,]\d{3,6})?(?:Z|[+-]\d{2}:\d{2})?)/.exec(s);if(o){t.push({text:o[0],kind:"tag"}),n+=o[0].length;continue}const c=/^(?:\[(TRACE|DEBUG|INFO|WARN|WARNING|ERROR|FATAL)\])/.exec(s);if(c){t.push({text:s.slice(0,c[0].length),kind:"keyword"}),n+=c[0].length;continue}const l=/^[A-Za-z_][\w-]*/.exec(s);if(l){const p=l[0];CF.has(p.toLowerCase())?t.push({text:p,kind:"keyword"}):t.push({text:p,kind:"plain"}),n+=p.length;continue}const d=/^(?:\d+(?:\.\d+)?)/.exec(s);if(d){t.push({text:d[0],kind:"number"}),n+=d[0].length;continue}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function ip(e,t){const n=e.trimStart();if(t.commentPrefixes.some(p=>n.startsWith(p)))return[{text:e,kind:"comment"}];if(t.allowSection){const p=/^(\[[^\]]+\])/.exec(e);if(p)return[{text:p[0],kind:"tag"}]}const s=/^([A-Za-z0-9_.\-*?]+)(\s*(?:=|:))/.exec(e);if(!s)return[{text:e,kind:"plain"}];const o=(s[2]??"").trim();if(!t.delimiters.includes(o))return[{text:e,kind:"plain"}];const c=[{text:s[1]??"",kind:"attr"},{text:s[2]??"",kind:"operator"}],l=e.slice(s[0].length),d=zF(l);return d.length&&c.push(...d),c}function zF(e){if(!e)return[];const t=[];let n=0;for(;n<e.length;){const s=e.slice(n),o=Hc(s,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(o){t.push(...o.tokens),n+=o.length;continue}if(s.startsWith("#")||s.startsWith(";")){t.push({text:s,kind:"comment"});break}t.push({text:s[0]??"",kind:"plain"}),n+=1}return t}function Hc(e,t){const n=/^(?:'[^']*'|"[^"]*")/.exec(e);if(n)return{tokens:[{text:n[0],kind:"string"}],length:n[0].length};const s=/^(?:-?\d+(?:\.\d+)?)/.exec(e);if(s)return{tokens:[{text:s[0],kind:"number"}],length:s[0].length};const o=/^[A-Za-z0-9_.:+/-]+/.exec(e);if(!o)return null;const c=o[0],l=c.toLowerCase();return t.trueValues.includes(l)?{tokens:[{text:c,kind:"boolean"}],length:c.length}:t.falseValues.includes(l)?{tokens:[{text:c,kind:"boolean"}],length:c.length}:t.nullValues.includes(l)?{tokens:[{text:c,kind:"null"}],length:c.length}:{tokens:[{text:c,kind:"plain"}],length:c.length}}function xS(e){var s,o;if(!e)return"plain";const t=((s=e.split(/[\\/]/).pop())==null?void 0:s.toLowerCase())??"";if(t===".env"||t.startsWith(".env."))return"env";if(t===".editorconfig")return"editorconfig";if(t==="dockerfile"||t.endsWith(".dockerfile"))return"dockerfile";if(t===".gitignore")return"gitignore";switch(((o=e.split(".").pop())==null?void 0:o.toLowerCase())??""){case"md":case"markdown":return"markdown";case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"log":return"log";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"conf":return"conf";case"dockerfile":return"dockerfile";case"css":case"scss":case"less":return"css";case"html":case"htm":return"html";case"xml":case"svg":return"xml";case"py":return"python";case"sh":case"bash":case"zsh":return"shell";case"sql":return"sql";case"yml":case"yaml":return"yaml";case"rs":return"rust";case"go":return"go";case"java":return"java";case"c":case"h":case"cpp":case"cc":case"hpp":return"cpp";default:return"plain"}}function sp(e){const t=e.toLowerCase();switch(t){case"ts":case"tsx":case"typescript":return"typescript";case"js":case"jsx":case"javascript":return"javascript";case"bash":case"shell":case"sh":case"zsh":return"shell";case"md":case"markdown":return"markdown";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"env":return"env";case"conf":return"conf";case"editorconfig":return"editorconfig";case"dockerfile":return"dockerfile";case"gitignore":return"gitignore";case"log":return"log";default:return t}}function rf(e){switch(sp(e)){case"typescript":return"TypeScript";case"javascript":return"JavaScript";case"markdown":return"Markdown";case"json":return"JSON";case"properties":return"Properties";case"toml":return"TOML";case"ini":return"INI";case"env":return"ENV";case"conf":return"CONF";case"editorconfig":return"EditorConfig";case"dockerfile":return"Dockerfile";case"gitignore":return"GitIgnore";case"log":return"Log";case"css":return"CSS";case"html":return"HTML";case"xml":return"XML";case"python":return"Python";case"shell":return"Shell";case"sql":return"SQL";case"yaml":return"YAML";case"rust":return"Rust";case"go":return"Go";case"java":return"Java";case"cpp":return"C/C++";default:return h("conversation.fileViewerPlainText")}}function WF(e){return xS(e)==="markdown"}function xw(e,t){return e instanceof Hn?e.message:t}function HF(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M4.2 4.2l7.6 7.6M11.8 4.2l-7.6 7.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function xs(e){const t=e.toLowerCase();if(t===".env"||t.startsWith(".env."))return"ENV";if(t.endsWith(".d.ts"))return"DTS";switch(t.includes(".")?t.slice(t.lastIndexOf(".")+1):""){case"ts":return"TS";case"tsx":return"TSX";case"js":return"JS";case"jsx":return"JSX";case"json":return"{}";case"md":return"MD";case"css":return"CSS";case"scss":return"SASS";case"html":return"HTML";case"yml":case"yaml":return"YAML";case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return"IMG";case"txt":return"TXT";default:return"FILE"}}function ks(e){const t=e.toLowerCase();return t===".env"||t.startsWith(".env.")?"env":t.endsWith(".md")?"md":t.endsWith(".css")||t.endsWith(".scss")?"style":t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".svg")||t.endsWith(".webp")?"image":t.endsWith(".ts")||t.endsWith(".tsx")||t.endsWith(".js")||t.endsWith(".jsx")?"code":t.endsWith(".json")||t.endsWith(".yml")||t.endsWith(".yaml")?"data":"default"}function kS(e){return Xe.request(`/api/git/status?workspaceId=${encodeURIComponent(e)}`)}function SS(e,t){return Xe.request("/api/git/stage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function $F(e,t){return Xe.request("/api/git/unstage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function VF(e,t){return Xe.request("/api/git/discard",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function qF(e,t){return Xe.request("/api/git/commit/draft",{method:"POST",body:JSON.stringify({workspaceId:e,mode:t})})}function GF(e,t){return Xe.request("/api/git/commit",{method:"POST",body:JSON.stringify({workspaceId:e,draft:t})})}function KF(e){return Xe.request("/api/git/commit/undo",{method:"POST",body:JSON.stringify({workspaceId:e})})}function kw(e,t=5,n=null){const s=new URLSearchParams({workspaceId:e,limit:String(t)});return n&&s.set("cursor",n),Xe.request(`/api/git/history?${s.toString()}`)}function QF(e){return Xe.request(`/api/git/branches?workspaceId=${encodeURIComponent(e)}`)}function YF(e,t,n){return Xe.request("/api/git/branches/switch",{method:"POST",body:JSON.stringify({workspaceId:e,branchName:t,create:n})})}function Sw(e,t){return Xe.request("/api/git/remote/sync",{method:"POST",body:JSON.stringify({workspaceId:e,action:t})})}async function ph(e,t){const[n,s]=await Promise.all([kS(t),WN(e)]);return XF(n.changes,s.items)}function XF(e,t){const n=new Set(t.map(s=>hc(s.path)));return e.filter(s=>n.has(hc(s.path))||s.oldPath!==null&&n.has(hc(s.oldPath)))}function JF(e){const t=Cw("","");for(const n of e){const s=hc(n.path),o=s.split("/").filter(Boolean);let c=t;o.forEach((l,d)=>{const p=o.slice(0,d+1).join("/");if(d===o.length-1){c.children.set(`file:${p}`,{kind:"file",name:l,path:s,change:n});return}const m=`directory:${p}`,y=c.children.get(m);if(y&&y.kind==="directory"){c=y;return}const g=Cw(l,p);c.children.set(m,g),c=g})}return NS(jS([...t.children.values()]))}function CS(e,t){const n=e.oldPath?`${e.oldPath} -> ${e.path}`:e.path;return ap(e)?`${n} ${t}`:n}function ap(e){return e.status==="D"||e.stagedStatus==="D"||e.worktreeStatus==="D"}function mh(e){return e.split("/").filter(Boolean).pop()??e}function hc(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").trim()}function Cw(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function jS(e){return[...e].sort((t,n)=>t.kind!==n.kind?t.kind==="directory"?-1:1:t.name.localeCompare(n.name,"zh-CN")).map(t=>t.kind==="directory"?{kind:"directory",name:t.name,path:t.path,children:jS([...t.children.values()])}:t)}function NS(e){return e.map(t=>{var l;if(t.kind!=="directory")return t;const n=NS(t.children);let s=t.name,o=t.path,c=n;for(;c.length===1&&((l=c[0])==null?void 0:l.kind)==="directory";){const d=c[0];s=`${s}/${d.name}`,o=d.path,c=d.children}return{kind:"directory",name:s,path:o,children:c}})}const ZF=450,eO=60*1e3,jw=20,Nw=16;function tO({sessionId:e,workspaceId:t,selectedPath:n,refreshVersion:s,onCountChange:o,onSelectFile:c,onOpenFile:l}){const[d,p]=w.useState("tree"),[m,y]=w.useState([]),[g,b]=w.useState(!0),[x,C]=w.useState(!1),[S,j]=w.useState([]),M=w.useRef(null),{showToast:A}=Gn();w.useEffect(()=>{const W=Cn(nc(t,e),eO);p("tree"),y(W??[]),b(W===null),C(!1),j([]),M.current=null,o==null||o((W==null?void 0:W.length)??0)},[e,t]),w.useEffect(()=>{let W=!1;async function J(){b(!0);try{const re=await ph(e,t);W||(y(re),o==null||o(re.length),br(nc(t,e),re))}catch(re){W||(o==null||o(0),A({title:gh(re,h("conversation.filePanelSessionLoadFailed")),tone:"error"}))}finally{W||b(!1)}}return J(),()=>{W=!0}},[o,s,e,A,t]);const E=m.filter(W=>!W.staged),Z=JF(m),Y=new Set(S);async function B(){b(!0);try{const W=await ph(e,t);y(W),o==null||o(W.length),br(nc(t,e),W)}catch(W){A({title:gh(W,h("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{b(!1)}}async function I(){if(E.length!==0){C(!0);try{await SS(t,E.map(J=>J.path));const W=await ph(e,t);y(W),o==null||o(W.length),br(nc(t,e),W),A({title:h("conversation.filePanelSessionStageSuccess"),tone:"success"})}catch(W){A({title:gh(W,h("git.stageFailed")),tone:"error"})}finally{C(!1)}}}function _(W){j(J=>J.includes(W)?J.filter(re=>re!==W):[...J,W])}function F(W){const J=Date.now(),re=M.current;return M.current={filePath:W,timestamp:J},(re==null?void 0:re.filePath)===W&&J-re.timestamp<=ZF}async function R(W,J){if(J&&F(W)){await l(W),M.current=null;return}J||(M.current=null),await c(W)}return 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":h("conversation.filePanelSessionViewLabel"),children:[i.jsx("button",{className:d==="tree"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":d==="tree",onClick:()=>p("tree"),children:h("conversation.filePanelSessionTreeView")}),i.jsx("button",{className:d==="list"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":d==="list",onClick:()=>p("list"),children:h("conversation.filePanelSessionListView")})]}),i.jsxs("div",{className:"file-panel-session-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void B(),disabled:g||x,children:h("conversation.filePanelRefresh")}),i.jsx("button",{className:"primary-button",type:"button",onClick:()=>void I(),disabled:x||E.length===0,children:h("conversation.filePanelSessionStageAll")})]})]}),i.jsxs("div",{className:"file-panel-session-summary",children:[i.jsx("span",{children:`${h("conversation.filePanelSessionSummary")} ${m.length}`}),i.jsx("span",{children:`${h("conversation.filePanelSessionUnstagedSummary")} ${E.length}`})]}),i.jsx("div",{className:"file-tree",children:g?i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelSessionLoading")}):m.length===0?i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelSessionEmpty")}):d==="tree"?TS({nodes:Z,depth:0,collapsedPathSet:Y,selectedPath:n,onToggleTreePath:_,onFileClick:R}):nO({items:m,selectedPath:n,onFileClick:R})})]})}function TS({nodes:e,depth:t,collapsedPathSet:n,selectedPath:s,onToggleTreePath:o,onFileClick:c}){return e.map(l=>{if(l.kind==="directory"){const d=!n.has(l.path);return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-kind":"directory","aria-expanded":d,style:{paddingInlineStart:`${jw+t*Nw}px`},onClick:()=>o(l.path),children:[i.jsx("span",{className:"file-tree-chevron","aria-hidden":"true",children:d?"v":">"}),i.jsx("span",{className:"file-tree-label",children:l.name})]}),d?i.jsx("div",{className:"file-tree-children",children:TS({nodes:l.children,depth:t+1,collapsedPathSet:n,selectedPath:s,onToggleTreePath:o,onFileClick:c})}):null]},`session-directory:${l.path}`)}return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-session-change",type:"button","data-active":s===l.change.path,"data-kind":"file",style:{paddingInlineStart:`${jw+t*Nw}px`},onClick:()=>void c(l.change.path,!ap(l.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":ks(l.name),"aria-hidden":"true",children:xs(l.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:l.name}),i.jsx("span",{className:"file-tree-path",children:CS(l.change,h("conversation.filePanelSessionDeleted"))})]}),i.jsxs("span",{className:"file-session-item-meta",children:[i.jsx("span",{className:"file-session-badge","data-status":l.change.status,children:l.change.status}),i.jsx("span",{className:"file-session-badge subtle",children:l.change.staged?h("git.stagedLabel"):h("git.workingTreeLabel")})]})]})},`session-file:${l.path}`)})}function nO({items:e,selectedPath:t,onFileClick:n}){return e.map(s=>i.jsx("div",{className:"file-session-list-item",children:i.jsxs("button",{className:"file-session-list-button",type:"button","data-active":t===s.path,onClick:()=>void n(s.path,!ap(s)),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(mh(s.path)),"aria-hidden":"true",children:xs(mh(s.path))}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:mh(s.path)}),i.jsx("span",{className:"file-tree-path",children:CS(s,h("conversation.filePanelSessionDeleted"))})]}),i.jsxs("span",{className:"file-session-item-meta",children:[i.jsx("span",{className:"file-session-badge","data-status":s.status,children:s.status}),i.jsx("span",{className:"file-session-badge subtle",children:s.staged?h("git.stagedLabel"):h("git.workingTreeLabel")})]})]})},`session-list:${s.path}`))}function nc(e,t){return`file-panel.session-changes.${e}.${t}`}function gh(e,t){return e instanceof Hn?e.message:typeof e=="object"&&e&&"message"in e?String(e.message??t):t}const en="",rO=450,iO=300*1e3,sO=60*1e3,aO=1600,oO=20,lO=16;function PS({className:e,sessionId:t,workspaceId:n,hideHeading:s=!1}){var Me;const{navigationGroups:o,subscribeFileTree:c,requestFileTreeRefresh:l,addFileTreeSnapshotListener:d}=lr(),[p,m]=w.useState({}),[y,g]=w.useState([]),[b,x]=w.useState([]),[C,S]=w.useState(en),[j,M]=w.useState(null),[A,E]=w.useState(!1),[Z,Y]=w.useState(!1),[B,I]=w.useState(!1),[_,F]=w.useState(!1),[R,W]=w.useState(""),[J,re]=w.useState(null),[le,ie]=w.useState(!1),[xe,q]=w.useState(null),[K,me]=w.useState("workspace"),[L,$]=w.useState(0),[se,P]=w.useState(0),[be,ke]=w.useState(!1),[ve,Ae]=w.useState(!1),Be=w.useRef({}),qe=w.useRef([]),nt=w.useRef(en),wt=w.useRef(!1),ze=w.useRef(null),Ot=w.useRef(null),Je=w.useRef(null),_t=w.useRef(null),bt=w.useRef(new Map),{showToast:et}=Gn(),pt=ar(),Nt=!!(t!=null&&t.trim()),Bt=s&&pt.isMobile;w.useEffect(()=>{Ct("file_panel.props",{sessionId:t,workspaceId:n})},[t,n]),w.useEffect(()=>{nt.current=C},[C]);function Rt(U){m(fe=>{const ee=typeof U=="function"?U(fe):U;return Be.current=ee,ee})}function ne(U){g(fe=>{const ee=typeof U=="function"?U(fe):U;return qe.current=ee,ee})}w.useEffect(()=>{var De,Ue;if(ct(),!n){ct(),wt.current=!1,Be.current={},qe.current=[],nt.current=en,Rt({}),ne([]),x([]),S(en),F(!1),W(""),re(null),ie(!1),E(!1);return}wt.current=!0;const U=Cn(Ew(n),iO);Ct("file_panel.workspace_snapshot",{workspaceId:n,cached:!!U,cachedRootItems:((Ue=(De=U==null?void 0:U.treeCache)==null?void 0:De[en])==null?void 0:Ue.length)??0,cachedDirectoryCount:Object.keys((U==null?void 0:U.treeCache)??{}).length});const fe=wO((U==null?void 0:U.activeDirectoryPath)??en,(U==null?void 0:U.treeCache)??{}),ee=Pw((U==null?void 0:U.expandedDirectories)??[],fe),_e=rc((U==null?void 0:U.treeCache)??{},fe,ee);Be.current=_e,qe.current=ee,nt.current=fe,Rt(_e),ne(ee),x([]),S(fe),E(!1),Y(!1),F(!1),W(""),re(null),ie(!1),queueMicrotask(()=>{wt.current=!1})},[n]),w.useEffect(()=>{if(n)return d(U=>{U.workspaceId===n&&(Rt(fe=>({...fe,[U.path]:U.items})),U.path===en&&E(!1),x(fe=>fe.filter(ee=>ee!==U.path)),xt(U.path,U.items))})},[d,n]),w.useEffect(()=>()=>{ct()},[]),w.useEffect(()=>{n&&c(n,yh(qe.current,nt.current))},[C,y,c,n]),w.useEffect(()=>{M(null),q(null),$(0),ke(!1),Ae(!1),ze.current=null},[t]),w.useEffect(()=>{!Nt&&K==="session"&&me("workspace")},[K,Nt]),w.useEffect(()=>{if(!be&&!ve)return;function U(ee){var Ue,ot;if(!(ee.target instanceof Node))return;const _e=((Ue=Ot.current)==null?void 0:Ue.contains(ee.target))??!1,De=((ot=Je.current)==null?void 0:ot.contains(ee.target))??!1;!_e&&!De&&(ke(!1),Ae(!1))}function fe(ee){ee.key==="Escape"&&(ke(!1),Ae(!1))}return document.addEventListener("pointerdown",U),document.addEventListener("keydown",fe),()=>{document.removeEventListener("pointerdown",U),document.removeEventListener("keydown",fe)}},[be,ve]),w.useEffect(()=>{if(!n)return;const U=Pw(y,C),fe=rc(p,C,U);br(Ew(n),{treeCache:fe,expandedDirectories:U,activeDirectoryPath:C})},[C,y,p,n]),w.useEffect(()=>{if(wt.current)return;const U=rc(p,C,y);xO(p,U)||Rt(U)},[C,y,p]),w.useEffect(()=>{var De;let U=!1;const fe=(n==null?void 0:n.trim())??null;async function ee(Ue){var un,Ln;if(!fe)return;const ot=(Ue==null?void 0:Ue.silent)!==!0&&(((un=Be.current[en])==null?void 0:un.length)??0)===0;ot&&E(!0),Ct("file_panel.load_root_tree.start",{sessionId:t,workspaceId:fe,silent:(Ue==null?void 0:Ue.silent)===!0,cachedRootItems:((Ln=Be.current[en])==null?void 0:Ln.length)??0});try{const on=await Wt(en,{force:!0});U||(Ct("file_panel.load_root_tree.end",{sessionId:t,workspaceId:fe,itemCount:on.length}),Rt(vt=>({...rc(vt,nt.current,qe.current),[en]:on})))}catch(on){U||et({title:hs(on,h("conversation.filePanelLoadFailed")),tone:"error"})}finally{!U&&ot&&E(!1)}}if((((De=Be.current[en])==null?void 0:De.length)??0)>0){const Ue=window.setTimeout(()=>{fe&&(c(fe,yh(qe.current,nt.current)),ee({silent:!0}))},1500);return()=>{U=!0,window.clearTimeout(Ue)}}return ee(),()=>{U=!0}},[t,et,n]),w.useEffect(()=>{if(!n||!t){P(0);return}const U=Cn(kO(n,t),sO);Ct("file_panel.session_change_count.snapshot",{sessionId:t,workspaceId:n,cached:U!==null,cachedCount:U}),P(U??0)},[t,L,n]);const He=p[en]??[],tt=_&&J!==null,Tt=((Me=o.find(U=>U.workspace.id===n))==null?void 0:Me.workspace)??null,ce=dO(j,C),Se=!!(Tt!=null&&Tt.path&&ce!==null),Le=!!j,de=!!((j?co(j):C)&&y.length);async function Ne(U,fe=!1){if(!n)return[];if(!fe){const ee=Be.current[U];if(ee)return ee}U===en?E(!0):x(ee=>fc(ee,U));try{const ee=await Wt(U,{force:fe});return Rt(_e=>({..._e,[U]:ee})),ee}catch(ee){throw et({title:hs(ee,h("conversation.filePanelLoadFailed")),tone:"error"}),ee}finally{U===en?E(!1):x(ee=>ee.filter(_e=>_e!==U))}}async function ut(){if(!n)return;const U=bO(Be.current,C,qe.current);Ct("file_panel.refresh_tree_cache.start",{sessionId:t,workspaceId:n,targetDirectories:U});const ee=(await Promise.all(U.map(async _e=>{const De=await Wt(_e,{force:!0});return[_e,De]}))).reduce((_e,[De,Ue])=>(_e[De]=Ue,_e),{});Ct("file_panel.refresh_tree_cache.end",{sessionId:t,workspaceId:n,targetDirectories:U,directoryCount:Object.keys(ee).length}),Rt(ee)}async function Wt(U,fe){if(!n)return[];if(!(fe!=null&&fe.force)){const _e=Be.current[U];if(_e)return _e}const ee=yh(fc(qe.current,U),U||nt.current);return c(n,ee),l(n,[U]),dt(U)}function dt(U,fe=aO){const ee=Be.current[U];return ee?Promise.resolve(ee):new Promise((_e,De)=>{const Ue=window.setTimeout(()=>{mt(U,Ue),De(new Error(`FILE_TREE_SNAPSHOT_TIMEOUT:${U}`))},fe),ot=bt.current.get(U)??[];bt.current.set(U,[...ot,{resolve:_e,reject:De,timerId:Ue}])})}function xt(U,fe){const ee=bt.current.get(U)??[];ee.length!==0&&(bt.current.delete(U),ee.forEach(_e=>{window.clearTimeout(_e.timerId),_e.resolve(fe)}))}function mt(U,fe){const _e=(bt.current.get(U)??[]).filter(De=>De.timerId!==fe);if(_e.length===0){bt.current.delete(U);return}bt.current.set(U,_e)}function ct(){for(const[U,fe]of bt.current.entries())fe.forEach(ee=>{window.clearTimeout(ee.timerId),ee.reject(new Error(`FILE_TREE_ABORTED:${U}`))});bt.current.clear()}async function Ht(U,fe=!1){const ee=No(U,fe);if(!ee.length){S(en);return}ne(_e=>AS(_e,ee)),S(ee[ee.length-1]??en);for(const _e of ee)try{await Ne(_e)}catch{return}}async function St(U){M(U),S(co(U)),await Ht(U)}async function Pt(U){await St(U),q(U),ze.current=null}function Ft(U){const fe=Date.now(),ee=ze.current;return ze.current={filePath:U,timestamp:fe},(ee==null?void 0:ee.filePath)===U&&fe-ee.timestamp<=rO}function At(){ze.current=null}async function Yt(U){if(Ft(U)){await Pt(U);return}await St(U)}function Gt(){F(!1),W(""),re(null),At()}async function nn(U){if(U.kind==="directory"){Gt(),await vn(U.path);return}if(Ft(U.path)){Gt(),await Pt(U.path);return}await St(U.path)}async function vn(U){if(M(null),S(U),!qe.current.includes(U))try{await Ne(U),ne(fe=>fc(fe,U))}catch{}}async function Pn(U){if(M(null),S(U),qe.current.includes(U)){pn(U);return}await vn(U)}function pn(U){ne(fe=>fe.filter(ee=>ee!==U&&!ee.startsWith(`${U}/`))),S(co(U)),M(null)}async function an(){if(n)try{if(await ut(),j&&await Ht(j),tt&&R.trim()){const U=await Qh(n,R.trim());re(U.items)}}catch(U){et({title:hs(U,h("conversation.filePanelLoadFailed")),tone:"error"})}}async function An(U){if(U==null||U.preventDefault(),!n||!R.trim()){re(null);return}ie(!0);try{const fe=await Qh(n,R.trim());re(fe.items)}catch(fe){et({title:hs(fe,h("conversation.filePanelSearchFailed")),tone:"error"})}finally{ie(!1)}}function D(){if(_){F(!1),W(""),re(null);return}F(!0)}function T(U){Ae(!1),U()}function O(){var U;(U=_t.current)==null||U.click()}async function H(U){var Ue;const fe=((Ue=U.target.files)==null?void 0:Ue[0])??null;if(U.target.value="",!fe||!n)return;const ee=uO(fe.name);if(!ee){et({title:h("conversation.filePanelUploadFailed"),tone:"error"});return}const _e=Tw(C,j),De=cO(_e,ee);I(!0);try{const ot=await pO(fe);await VD({workspaceId:n,path:De,contentBase64:ot}),await ut(),await St(De),et({title:h("conversation.filePanelUploadSuccess",{name:ee}),tone:"success"})}catch(ot){et({title:hs(ot,h("conversation.filePanelUploadFailed")),tone:"error"})}finally{I(!1)}}async function oe(){if(!(!n||!j)){I(!0);try{const U=await qD(n,j),fe=mO(U.contentBase64);gO(U.fileName,new Blob([fe],{type:"application/octet-stream"})),et({title:h("conversation.filePanelDownloadSuccess",{name:U.fileName}),tone:"success"})}catch(U){et({title:hs(U,h("conversation.filePanelDownloadFailed")),tone:"error"})}finally{I(!1)}}}function ye(){const U=j?co(j):C;!U||!qe.current.includes(U)||pn(U)}async function Re(U){if(!n)return;const fe=Tw(C,j),ee=fe?`${fe}/`:"",_e=window.prompt(h(U==="create_file"?"conversation.filePanelCreateFilePrompt":"conversation.filePanelCreateDirectoryPrompt"),ee);if(!(_e!=null&&_e.trim()))return;const De=_e.trim();Y(!0);try{await $D({workspaceId:n,opType:U,dstPath:De,content:U==="create_file"?"":void 0}),await ut(),U==="create_directory"?(await Ht(De,!0),M(null)):await St(De)}catch(Ue){et({title:hs(Ue,h("conversation.filePanelMutateFailed")),tone:"error"})}finally{Y(!1)}}async function Ge(U){const fe=(Tt==null?void 0:Tt.path)??"";if(ce===null||!fe){ke(!1);return}try{const ee=fO(fe),_e=U==="absolute"?hO(fe,ce,ee):ES(ce,ee);await yO(_e,pt),et({title:h(U==="absolute"?"conversation.filePanelCopyAbsolutePathSuccess":"conversation.filePanelCopyRelativePathSuccess"),tone:"success"})}catch(ee){et({title:ee instanceof Error?ee.message:h("conversation.filePanelCopyPathFailed"),tone:"error"})}finally{ke(!1)}}function Ie(U,fe){return i.jsx(i.Fragment,{children:U.map(ee=>{const _e=ee.kind==="directory",De=_e&&y.includes(ee.path),Ue=_e&&b.includes(ee.path),ot=p[ee.path]??[],un=j===ee.path||j===null&&_e&&C===ee.path;return i.jsxs("div",{className:"file-tree-node",children:[i.jsxs("button",{className:"file-tree-item",type:"button","data-active":un,"data-kind":ee.kind,"aria-expanded":_e?De:void 0,style:{paddingInlineStart:`${oO+fe*lO}px`},onClick:()=>{if(_e){At(),Pn(ee.path);return}Yt(ee.path)},children:[i.jsx("span",{className:`file-tree-chevron${_e?"":" is-hidden"}`,"aria-hidden":"true",children:De?"v":">"}),_e?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(ee.name),"aria-hidden":"true",children:xs(ee.name)}),i.jsx("span",{className:"file-tree-label",children:ee.name}),Ue?i.jsx("span",{className:"file-tree-meta",children:h("common.loading")}):null]}),_e&&De?i.jsx("div",{className:"file-tree-children",children:Ue&&!ot.length?i.jsx("p",{className:"file-tree-empty",children:h("common.loading")}):ot.length?Ie(ot,fe+1):i.jsx("p",{className:"file-tree-empty",children:h("conversation.filePanelEmptyDirectory")})}):null]},`${ee.kind}-${ee.path}`)})})}function Oe(U){return i.jsx(i.Fragment,{children:U.map(fe=>{const ee=fe.kind==="directory",_e=j===fe.path;return i.jsx("div",{className:"file-tree-node",children:i.jsxs("button",{className:"file-tree-item is-search-result",type:"button","data-active":_e,"data-kind":fe.kind,onClick:()=>{nn(fe)},children:[i.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),ee?null:i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(fe.name),"aria-hidden":"true",children:xs(fe.name)}),i.jsxs("span",{className:"file-tree-label",children:[i.jsx("span",{className:"file-tree-name",children:fe.name}),i.jsx("span",{className:"file-tree-path",children:fe.path})]})]})},`search-${fe.kind}-${fe.path}`)})})}return i.jsx("section",{className:["conversation-panel","surface-card","file-panel",e].filter(Boolean).join(" "),"data-testid":"file-context-panel",children:n?i.jsxs(i.Fragment,{children:[i.jsx(jF,{workspaceId:n,filePath:xe,open:xe!==null,onClose:()=>q(null),onSaved:async U=>{await ut(),await St(U),$(fe=>fe+1)}}),s?null:i.jsx("div",{className:"file-panel-heading-row",children:i.jsx("h2",{className:"file-panel-heading",children:h("conversation.filePanelTitle")})}),i.jsxs("div",{className:"file-panel-tabs",role:"tablist","aria-label":h("conversation.filePanelTitle"),children:[i.jsx("button",{className:K==="workspace"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":K==="workspace",onClick:()=>me("workspace"),children:h("conversation.filePanelWorkspaceTab")}),i.jsxs("button",{className:K==="session"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":K==="session",onClick:()=>{Nt&&me("session")},disabled:!Nt,children:[h("conversation.filePanelSessionTab"),i.jsx("span",{className:"file-panel-tab-badge","aria-label":`${h("conversation.filePanelSessionTab")} ${se}`,children:se})]})]}),K==="workspace"?i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:_t,"data-testid":"file-panel-upload-input",type:"file",hidden:!0,onChange:U=>void H(U)}),Bt?i.jsx("div",{className:"file-panel-toolbar file-panel-toolbar-mobile","aria-label":h("conversation.filePanelTitle"),children:i.jsxs("div",{className:"file-mobile-action-shell",ref:Je,children:[i.jsxs("button",{className:"secondary-button file-mobile-action-trigger",type:"button","aria-label":h("conversation.filePanelActionsMenu"),"aria-haspopup":"menu","aria-expanded":ve,"data-active":ve,onClick:()=>{ke(!1),Ae(U=>!U)},children:[i.jsx("span",{children:h("conversation.filePanelActionsMenu")}),i.jsx(RO,{})]}),ve?i.jsxs("div",{className:"file-mobile-action-menu",role:"menu","aria-label":h("conversation.filePanelActionsMenu"),children:[i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{Ae(!1),D()},children:h(_?"conversation.filePanelHideSearch":"conversation.filePanelShowSearch")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>T(an),disabled:A||Z||le,children:h("conversation.filePanelRefresh")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{Ae(!1),ye()},disabled:!de,children:h("conversation.filePanelCollapseCurrent")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{Ae(!1),O()},disabled:Z||B,children:h("conversation.filePanelUpload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>T(oe),disabled:!Le||B,children:h("conversation.filePanelDownload")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>T(()=>Re("create_file")),disabled:Z||B,children:h("conversation.filePanelNewFile")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>T(()=>Re("create_directory")),disabled:Z||B,children:h("conversation.filePanelNewDirectory")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>T(()=>Ge("absolute")),disabled:!Se,children:h("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>T(()=>Ge("relative")),disabled:!Se,children:h("conversation.filePanelCopyRelativePath")})]}):null]})}):i.jsxs("div",{className:"file-panel-toolbar","aria-label":h("conversation.filePanelTitle"),children:[i.jsxs("div",{className:"file-toolbar-menu-shell",ref:Ot,children:[i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelCopyPath"),"aria-label":h("conversation.filePanelCopyPath"),"aria-haspopup":"menu","aria-expanded":be,"data-active":be,onClick:()=>{Ae(!1),ke(U=>!U)},disabled:!Se,children:i.jsx(jO,{})}),be?i.jsxs("div",{className:"file-toolbar-menu",role:"menu",children:[i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Ge("absolute"),children:h("conversation.filePanelCopyAbsolutePath")}),i.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Ge("relative"),children:h("conversation.filePanelCopyRelativePath")})]}):null]}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelCollapseCurrent"),"aria-label":h("conversation.filePanelCollapseCurrent"),onClick:ye,disabled:!de,children:i.jsx(SO,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelRefresh"),"aria-label":h("conversation.filePanelRefresh"),onClick:()=>void an(),disabled:A||Z||le,children:i.jsx(CO,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelSearchButton"),"aria-label":h("conversation.filePanelSearchButton"),"data-active":_,onClick:D,disabled:A,children:i.jsx(Rw,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelUpload"),"aria-label":h("conversation.filePanelUpload"),onClick:O,disabled:Z||B,children:i.jsx(TO,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelDownload"),"aria-label":h("conversation.filePanelDownload"),onClick:()=>void oe(),disabled:!Le||B,children:i.jsx(PO,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelNewFile"),"aria-label":h("conversation.filePanelNewFile"),onClick:()=>void Re("create_file"),disabled:Z||B,children:i.jsx(NO,{})}),i.jsx("button",{className:"file-toolbar-button",type:"button",title:h("conversation.filePanelNewDirectory"),"aria-label":h("conversation.filePanelNewDirectory"),onClick:()=>void Re("create_directory"),disabled:Z||B,children:i.jsx(EO,{})})]}),_?i.jsxs("form",{className:"file-toolbar-search",onSubmit:U=>void An(U),children:[i.jsx("input",{value:R,onChange:U=>W(U.target.value),placeholder:h("conversation.filePanelSearchPlaceholder")}),Bt?i.jsx("button",{className:"secondary-button file-mobile-search-submit",type:"submit","aria-label":h("conversation.filePanelSearchButton"),disabled:le,children:h("conversation.filePanelSearchButton")}):i.jsx("button",{className:"file-toolbar-button",type:"submit",title:h("conversation.filePanelSearchButton"),"aria-label":h("conversation.filePanelSearchButton"),disabled:le,children:i.jsx(Rw,{})})]}):null,i.jsx("div",{className:"file-tree","data-search-mode":tt,children:A&&He.length===0?i.jsx("p",{className:"file-tree-status status-text",children:h("common.loading")}):tt?J!=null&&J.length?Oe(J):i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelSearchEmpty")}):He.length?Ie(He,0):i.jsx("p",{className:"file-tree-status status-text",children:h("conversation.filePanelEmptyDirectory")})})]}):Nt&&t?i.jsx(tO,{sessionId:t,workspaceId:n,selectedPath:j,refreshVersion:L,onCountChange:P,onSelectFile:St,onOpenFile:Pt}):i.jsx("section",{className:"file-panel-section",children:i.jsx("p",{className:"status-text",children:h("conversation.filePanelSessionNoSession")})})]}):i.jsx("section",{className:"file-panel-section",children:i.jsx("p",{className:"status-text",children:h("conversation.filePanelNoWorkspace")})})})}function co(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):en}function No(e,t=!1){const n=e.split("/").filter(Boolean),s=t?n.length:n.length-1,o=[];for(let c=0;c<s;c+=1)o.push(n.slice(0,c+1).join("/"));return o}function Tw(e,t){return e||(t?co(t):en)}function cO(e,t){return e?`${e}/${t}`:t}function uO(e){var t;return((t=e.split(/[/\\]/).pop())==null?void 0:t.trim())??""}function dO(e,t){return e||t||null}function ES(e,t="posix"){return e?RS(e,t):"."}function hO(e,t,n){const s=RS(e,n),o=ES(t,n).replace(/^\.[/\\]?/,"");if(!o)return s;const c=MS(n),l=o.replace(/^[/\\]+/,"");return l?s.endsWith("/")||s.endsWith("\\")?`${s}${l}`:`${s}${c}${l}`:s}function fO(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.includes("\\")?"windows":"posix"}function RS(e,t){return e&&(MS(t)==="\\"?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"))}function MS(e){return e==="windows"?"\\":"/"}async function pO(e){const t=await e.arrayBuffer(),n=new Uint8Array(t),s=32768;let o="";for(let c=0;c<n.length;c+=s){const l=n.subarray(c,c+s);o+=String.fromCharCode(...l)}return btoa(o)}function mO(e){const t=atob(e),n=new Uint8Array(t.length);for(let s=0;s<t.length;s+=1)n[s]=t.charCodeAt(s);return n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}function gO(e,t){if(typeof document>"u")throw new Error(h("conversation.filePanelDownloadFailed"));const n=window.URL.createObjectURL(t),s=document.createElement("a");s.href=n,s.download=e,document.body.append(s),s.click(),s.remove(),window.URL.revokeObjectURL(n)}async function yO(e,t){var n;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!vO(e))throw new Error(h("conversation.filePanelCopyPathFailed"))}}function vO(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}function wO(e,t){return e&&No(e,!0).every(o=>o in t)?e:en}function Pw(e,t){if(!t)return[];const n=No(t,!0);return e.filter(s=>n.includes(s))}function rc(e,t,n){const s=op(t,n);return Object.entries(e).reduce((o,[c,l])=>(s.has(c)&&(o[c]=l),o),{})}function bO(e,t,n){const o=[...op(t,n)].filter(c=>c===en||c in e);return o.length?o:[en]}function op(e,t){const n=new Set([en]),s=AS(t,No(e,!0));for(const o of s){n.add(o);for(const c of No(o,!0))n.add(c)}return n}function xO(e,t){const n=Object.keys(e),s=Object.keys(t);return n.length!==s.length?!1:n.every(o=>e[o]===t[o])}function fc(e,t){return e.includes(t)?e:[...e,t]}function AS(e,t){return t.reduce((n,s)=>fc(n,s),e)}function Ew(e){return`file-panel.workspace-tree.${e}`}function kO(e,t){return`file-panel.session-change-count.${e}.${t}`}function yh(e,t){return[...op(t,e)]}function hs(e,t){return e instanceof Hn?e.message:t}function SO(){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 CO(){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 Rw(){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 jO(){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 NO(){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 TO(){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 PO(){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 EO(){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 RO(){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"})})}const MO=Object.freeze(Object.defineProperty({__proto__:null,FileContextPanel:PS},Symbol.toStringTag,{value:"Module"})),vh=56,Mw=28,wh=72,ic=8,Aw=960,Lw=60*1e3,Iw=20,Dw=9,_w=9;function LS({className:e,workspaceId:t}){const{subscribeGitSnapshot:n,requestGitRefresh:s,addGitSnapshotListener:o}=lr(),[c,l]=w.useState(null),[d,p]=w.useState([]),[m,y]=w.useState(0),[g,b]=w.useState(null),[x,C]=w.useState(!1),[S,j]=w.useState(null),[M,A]=w.useState(null),[E,Z]=w.useState(""),[Y,B]=w.useState(!1),[I,_]=w.useState(!1),[F,R]=w.useState([]),[W,J]=w.useState(!0),[re,le]=w.useState(!1),[ie,xe]=w.useState(()=>typeof window<"u"?window.innerWidth<=Aw:!1),[q,K]=w.useState([]),[me,L]=w.useState(null),[$,se]=w.useState("unstaged"),[P,be]=w.useState(null),[ke,ve]=w.useState(null),[Ae,Be]=w.useState(vh),[qe,nt]=w.useState(!1),wt=w.useRef(null),ze=w.useRef(null),Ot=w.useRef(null),{showToast:Je}=Gn();w.useEffect(()=>{Ct("git_sidebar.props",{workspaceId:t})},[t]),w.useEffect(()=>{R([]),J(!0),y(0),b(null),C(!1),A(null),Z(""),le(!1),K([]),L(null),se("unstaged"),be(null),ve(null),nt(!1),Be(vh)},[t]),w.useEffect(()=>{function D(){xe(window.innerWidth<=Aw)}return D(),window.addEventListener("resize",D),()=>{window.removeEventListener("resize",D)}},[]),w.useEffect(()=>{if(!qe)return;const D=document.body.style.cursor,T=document.body.style.userSelect;document.body.style.cursor="row-resize",document.body.style.userSelect="none";function O(oe){ut(oe.clientY)}function H(){nt(!1)}return window.addEventListener("pointermove",O),window.addEventListener("pointerup",H),()=>{document.body.style.cursor=D,document.body.style.userSelect=T,window.removeEventListener("pointermove",O),window.removeEventListener("pointerup",H)}},[qe]),w.useEffect(()=>{var O,H;if(!(t!=null&&t.trim())){l(null),p([]),y(0),b(null),j(null),B(!1);return}const D=t.trim(),T=Cn(xh(D),Lw);if(Ct("git_sidebar.snapshot",{workspaceId:D,cached:!!T,cachedHistoryCount:((O=T==null?void 0:T.history)==null?void 0:O.length)??0,cachedChangedCount:((H=T==null?void 0:T.status)==null?void 0:H.changes.length)??0}),T){bt(T),B(!1);return}l(null),p([]),y(0),b(null),j(null),B(!0)},[t]),w.useEffect(()=>{if(t!=null&&t.trim())return o(D=>{var T,O,H;D.workspaceId===t.trim()&&(Ct("git_sidebar.snapshot_received",{workspaceId:D.workspaceId,changedCount:((T=D.status)==null?void 0:T.changes.length)??0,historyCount:D.history.length,branchCount:(((O=D.branches)==null?void 0:O.local.length)??0)+(((H=D.branches)==null?void 0:H.remote.length)??0)}),bt(D),B(!1))})},[o,t]),w.useEffect(()=>{if(!(t!=null&&t.trim()))return;const D=t.trim(),T=Cn(xh(D),Lw)!==null;n(D),!T&&et()},[s,n,t]),w.useEffect(()=>{t&&br(xh(t),{status:c,history:d,historyTotalCount:m,historyNextCursor:g,branches:S})},[S,d,g,m,c,t]),w.useEffect(()=>{if(!c||!M)return;c.changes.find(T=>T.path===M)||A(null)},[M,c]),w.useEffect(()=>{DO(Ot.current)},[E]),w.useEffect(()=>{ie||(K([]),L(null),be(null),ve(null))},[ie]),w.useEffect(()=>{if(!c){K([]);return}const D=new Set(c.changes.map(T=>T.path));K(T=>T.filter(O=>D.has(O)))},[c]);function _t(){const D=ze.current;if(!D)return;D.querySelectorAll(".git-tree-shell").forEach(O=>{O.scrollTop=0})}function bt(D){l(D.status),p(Array.isArray(D.history)?D.history:[]),y(typeof D.historyTotalCount=="number"?D.historyTotalCount:0),b(typeof D.historyNextCursor=="string"?D.historyNextCursor:null),j(D.branches??null)}function et(D){t!=null&&t.trim()&&(B(!0),Ct("git_sidebar.refresh_requested",{workspaceId:t.trim(),resetTreeScroll:!1}),s(t.trim()))}async function pt(D){if(!(t!=null&&t.trim()))return;const T=t.trim();B(!0);try{const[O,H,oe]=await Promise.all([kS(T),kw(T,Iw,null),QF(T)]);bt({status:O,history:H.items,historyTotalCount:H.totalCount,historyNextCursor:H.nextCursor,branches:oe}),s(T),D!=null&&D.resetTreeScroll&&requestAnimationFrame(()=>{_t()})}catch(O){Je({title:ei(O,h("git.panelLoadFailed")),tone:"error"})}finally{B(!1)}}async function Nt(){if(!(!t||!g||x)){C(!0);try{const D=await kw(t,Iw,g);p(T=>{const O=new Set(T.map(oe=>oe.commitHash)),H=D.items.filter(oe=>!O.has(oe.commitHash));return[...T,...H]}),y(D.totalCount),b(D.nextCursor)}catch(D){Je({title:ei(D,h("git.panelLoadFailed")),tone:"error"})}finally{C(!1)}}}function Bt(D){if(!W||x||!g)return;const T=D.currentTarget;T.scrollHeight-T.scrollTop-T.clientHeight<=40&&Nt()}async function Rt(){if(t){_(!0);try{const D=await qF(t,"ai");Z(D.validation.normalizedDraft.subject||D.draft.subject)}catch(D){Je({title:ei(D,h("git.draftFailed")),tone:"error"})}finally{_(!1)}}}async function ne(D,T){if(t&&D.length){_(!0);try{const O=T?await $F(t,D):await SS(t,D);l(O),A(D[D.length-1]??null),K(H=>H.filter(oe=>!D.includes(oe))),L(null),et()}catch(O){B(!1),Je({title:ei(O,h("git.stageFailed")),tone:"error"})}finally{_(!1)}}}async function He(D){if(t&&D.length){_(!0);try{const T=await VF(t,D);l(T),D.includes(M??"")&&A(null),K(O=>O.filter(H=>!D.includes(H))),L(null),et()}catch(T){B(!1),Je({title:ei(T,h("git.discardFailed")),tone:"error"})}finally{_(!1)}}}async function tt(){if(!(!t||!E.trim())){_(!0);try{await GF(t,IO(E)),Je({title:h("git.commitSuccess"),tone:"success"}),Z(""),A(null),et()}catch(D){Je({title:ei(D,h("git.commitFailed")),tone:"error"})}finally{_(!1)}}}async function Tt(){if(t){_(!0);try{const D=await Sw(t,"push");Je({title:D.summary,tone:"success"}),et()}catch(D){Je({title:ei(D,h("git.remoteFailed")),tone:"error"})}finally{_(!1)}}}async function ce(D){if(t){_(!0);try{const T=await Sw(t,D);Je({title:T.summary,tone:"success"}),le(!1),et()}catch(T){Je({title:ei(T,h("git.remoteFailed")),tone:"error"})}finally{_(!1)}}}async function Se(){if(t){_(!0);try{const D=await KF(t);Z(D.commitSubject??""),Je({title:D.summary||h("git.undoLastCommitSuccess"),tone:"success"}),le(!1),et()}catch(D){Je({title:ei(D,h("git.undoLastCommitFailed")),tone:"error"})}finally{_(!1)}}}async function Le(D){if(t){_(!0);try{const T=await YF(t,D,!1);j(T),le(!1),et()}catch(T){Je({title:ei(T,h("git.branchFailed")),tone:"error"})}finally{_(!1)}}}function de(D){R(T=>T.includes(D)?T.filter(O=>O!==D):[...T,D])}function Ne(D){A(D),L(null),K(T=>T.includes(D)?T.filter(O=>O!==D):[...T,D])}function ut(D){const T=wt.current;if(!T||!Number.isFinite(D))return;const O=T.getBoundingClientRect(),H=O.height-ic;if(!Number.isFinite(O.top)||!Number.isFinite(O.height)||H<=0)return;const oe=(D-O.top-ic/2)/H*100;if(!Number.isFinite(oe))return;const ye=Math.max(Mw,Math.min(wh,Math.round(oe)));Be(ye)}function Wt(D){D.preventDefault(),ut(D.clientY),nt(!0)}const dt=(c==null?void 0:c.changes)??[],xt=dt.filter(D=>sf(D,"staged")),mt=dt.filter(D=>sf(D,"unstaged")),ct=zw(xt,"staged"),Ht=zw(mt,"unstaged"),St=new Set(F),Pt=new Set(q),Ft=Ww(q,dt,"staged"),At=Ww(q,dt,"unstaged"),Yt=dt.length===0&&((c==null?void 0:c.snapshot.ahead)??0)>0,Gt=xt.length>0&&E.trim().length>0,nn=(S==null?void 0:S.currentBranch)??(c==null?void 0:c.snapshot.branch)??h("common.unknown"),vn=Number.isFinite(Ae)?Ae:vh,Pn=W?`minmax(120px, ${vn}fr) ${ic}px minmax(140px, ${100-vn}fr)`:`minmax(120px, 1fr) ${ic}px auto`;w.useEffect(()=>{me==="staged"&&Ft.length===0&&L(null),me==="unstaged"&&At.length===0&&L(null)},[me,Ft.length,At.length]),w.useEffect(()=>{if(!ie)return;const D=mt.length>0?"unstaged":xt.length>0?"staged":"history";se(T=>T==="unstaged"&&mt.length>0||T==="staged"&&xt.length>0?T:D)},[ie,xt.length,mt.length]),w.useEffect(()=>{P&&(d.some(D=>D.commitHash===P)||be(null))},[d,P]),w.useEffect(()=>{ie&&$!=="history"&&re&&le(!1)},[ie,re,$]);async function pn(D,T){var O;try{if(typeof navigator>"u"||!((O=navigator.clipboard)!=null&&O.writeText))throw new Error("clipboard unavailable");await navigator.clipboard.writeText(D),Je({title:T,tone:"success"})}catch{Je({title:h("common.copyContentFailed"),tone:"error"})}}async function an(D,T){typeof window<"u"&&!window.confirm(h("git.discardConfirm",{path:T}))||await He(D)}function An(){return i.jsxs("div",{className:"git-operations-menu",children:[i.jsxs("div",{className:"git-menu-section",children:[i.jsx("span",{className:"git-menu-caption",children:h("git.currentBranch")}),i.jsx("strong",{className:"git-menu-branch",children:nn})]}),i.jsxs("div",{className:"git-menu-section",children:[i.jsx("span",{className:"git-menu-caption",children:h("git.branchTitle")}),i.jsx("div",{className:"git-menu-branch-list",children:S==null?void 0:S.local.map(D=>i.jsx("button",{className:"git-menu-item",type:"button",disabled:I||D.current,onClick:()=>void Le(D.name),children:i.jsx("span",{children:D.current?`${h("git.switchBranch")} ${D.name}`:`${h("git.switchBranchTo")} ${D.name}`})},D.name))})]}),i.jsxs("div",{className:"git-menu-section",children:[i.jsx("button",{className:"git-menu-item",type:"button",disabled:I,onClick:()=>void ce("fetch"),children:i.jsx("span",{children:h("git.fetch")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:I,onClick:()=>void ce("pull"),children:i.jsx("span",{children:h("git.pull")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:I,onClick:()=>void ce("push"),children:i.jsx("span",{children:h("git.push")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:I,onClick:()=>void Se(),children:i.jsx("span",{children:h("git.undoLastCommit")})}),i.jsx("button",{className:"git-menu-item",type:"button",disabled:I||Y,onClick:()=>void pt({resetTreeScroll:!0}),children:i.jsx("span",{children:h("git.refresh")})})]})]})}return i.jsxs("section",{className:["conversation-panel","surface-card","git-sidebar",e].filter(Boolean).join(" "),"data-testid":"git-sidebar",children:[i.jsxs("section",{className:"git-card git-scaffold-section",children:[i.jsxs("div",{className:"git-editor-row",children:[i.jsx("textarea",{ref:Ot,rows:1,value:E,onChange:D=>Z(OS(D.target.value)),onKeyDown:D=>{D.key==="Enter"&&D.preventDefault()},placeholder:h("git.commitSubjectPlaceholder")}),i.jsx("button",{className:"git-icon-button",type:"button","aria-label":h("git.generateDraft"),title:h("git.generateDraft"),onClick:()=>void Rt(),disabled:I||Y,children:i.jsx(FO,{})})]}),i.jsxs("div",{className:"git-primary-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void pt({resetTreeScroll:!0}),disabled:I||Y||!t,children:h("git.refreshNow")}),i.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(Yt){Tt();return}tt()},disabled:I||!Yt&&!Gt,children:h(Yt?"git.pushNow":"git.commitNow")})]})]}),ie?i.jsxs("div",{className:"git-mobile-sections",children:[i.jsx(bh,{title:h("git.stagedChangesTitle"),count:xt.length,expanded:$==="staged",onToggle:()=>se("staged"),children:i.jsx(Ow,{title:h("git.stagedChangesTitle"),nodes:ct,collapsedTreePathSet:St,onToggleTreePath:de,onToggleMobileSelection:Ne,selectedMobilePathSet:Pt,selectedTargets:Ft,actioning:I,variant:"staged",swipeRowState:ke,onSwipeRowChange:ve,onStageToggle:ne,onDiscardWithConfirm:an,onClearSelectedTargets:()=>K(D=>D.filter(T=>!Ft.includes(T)))})}),i.jsx(bh,{title:h("git.changesTitle"),count:mt.length,expanded:$==="unstaged",onToggle:()=>se("unstaged"),children:i.jsx(Ow,{title:h("git.changesTitle"),nodes:Ht,collapsedTreePathSet:St,onToggleTreePath:de,onToggleMobileSelection:Ne,selectedMobilePathSet:Pt,selectedTargets:At,actioning:I,variant:"unstaged",swipeRowState:ke,onSwipeRowChange:ve,onStageToggle:ne,onDiscardWithConfirm:an,onClearSelectedTargets:()=>K(D=>D.filter(T=>!At.includes(T)))})}),i.jsxs(bh,{title:h("git.recentVersionsTitle"),count:m,expanded:$==="history",onToggle:()=>se("history"),trailingContent:i.jsx("span",{className:"badge",children:nn}),headerAction:i.jsx("button",{className:"git-icon-button git-mobile-section-action",type:"button","aria-label":h("git.operationMenu"),title:h("git.operationMenu"),"aria-expanded":re,onClick:()=>{se("history"),le(D=>!D)},disabled:I,children:i.jsx(Pc,{})}),children:[re?i.jsx("div",{className:"git-mobile-operations-shell",children:An()}):null,i.jsx(AO,{history:d,historyLoadingMore:x,hasMore:!!g,actioning:I,openCommitHash:P,onToggleMenu:D=>be(T=>T===D?null:D),onCopyCommitHash:D=>void pn(D,h("git.copyCommitHashSuccess")),onCopyCommitSubject:D=>void pn(D,h("git.copyCommitSubjectSuccess")),onUndoLastCommit:()=>void Se(),onLoadMore:()=>void Nt()})]})]}):i.jsxs("div",{ref:wt,className:"git-content-split",style:{gridTemplateRows:Pn},children:[i.jsx("section",{className:"git-card git-tree-panel",children:i.jsxs("div",{ref:ze,className:"git-tree-panel-body",children:[xt.length>0?i.jsx(Fw,{title:h("git.stagedChangesTitle"),count:xt.length,nodes:ct,selectedPath:M,collapsedTreePathSet:St,onToggleTreePath:de,onSelectFile:A,onToggleMobileSelection:Ne,onStageToggle:ne,onDiscard:He,actioning:I,variant:"staged",isMobileViewport:ie,selectedMobilePathSet:Pt,selectedTargets:Ft,mobileActionMenuOpen:me==="staged",onToggleMobileActionMenu:()=>L(D=>D==="staged"?null:"staged"),onClearSelectedTargets:()=>K(D=>D.filter(T=>!Ft.includes(T)))}):null,i.jsx(Fw,{title:h("git.changesTitle"),count:mt.length,nodes:Ht,selectedPath:M,collapsedTreePathSet:St,onToggleTreePath:de,onSelectFile:A,onToggleMobileSelection:Ne,onStageToggle:ne,onDiscard:He,actioning:I,variant:"unstaged",isMobileViewport:ie,selectedMobilePathSet:Pt,selectedTargets:At,mobileActionMenuOpen:me==="unstaged",onToggleMobileActionMenu:()=>L(D=>D==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>K(D=>D.filter(T=>!At.includes(T)))})]})}),i.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":h("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":Mw,"aria-valuemax":wh,"aria-valuenow":W?vn:wh,"data-dragging":qe,onPointerDown:Wt,children:i.jsx("span",{className:"git-panel-divider-handle","aria-hidden":"true"})}),i.jsxs("section",{className:"git-card git-history-section",children:[i.jsxs("div",{className:"git-history-topbar",children:[i.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":W,"aria-label":h(W?"git.collapseRecentVersions":"git.expandRecentVersions"),onClick:()=>J(D=>!D),children:[i.jsxs("span",{className:"git-section-toggle-main",children:[i.jsx($c,{expanded:W}),i.jsx("span",{children:h("git.recentVersionsTitle")})]}),i.jsx("span",{className:"workbench-section-counter",children:m})]}),i.jsxs("div",{className:"git-history-actions",children:[i.jsx("span",{className:"badge",children:nn}),i.jsx("button",{className:"git-icon-button",type:"button","aria-label":h("git.operationMenu"),title:h("git.operationMenu"),onClick:()=>le(D=>!D),disabled:I,children:i.jsx(Pc,{})}),re?An():null]})]}),W?i.jsx("div",{className:"git-history-list",onScroll:Bt,children:d.length?i.jsxs(i.Fragment,{children:[d.map(D=>i.jsxs("article",{className:"git-history-entry","data-kind":D.commitKind,children:[i.jsx("span",{className:"git-history-marker","data-kind":D.commitKind,"aria-hidden":"true"}),i.jsxs("div",{className:"git-history-body",children:[i.jsxs("div",{className:"git-history-title-row",children:[i.jsx("strong",{title:D.subject,children:D.subject}),i.jsx("span",{className:"git-history-kind-badge","data-kind":D.commitKind,children:BS(D.commitKind)})]}),D.refs.length>0?i.jsx("div",{className:"git-history-ref-list",children:D.refs.map(T=>i.jsx("span",{className:"git-history-ref-pill","data-kind":T.kind,"data-remote-index":String(US(T.remoteName)),children:T.name},`${D.commitHash}:${T.kind}:${T.name}`))}):null,i.jsxs("div",{className:"git-history-meta",children:[i.jsx("span",{className:"git-history-hash",children:D.commitHash.slice(0,8)}),i.jsx("span",{children:D.authorName}),i.jsx("time",{dateTime:D.authoredAt,children:zS(D.authoredAt)})]})]})]},D.commitHash)),x?i.jsxs("p",{className:"git-history-loading",children:[h("git.refreshNow"),"..."]}):null]}):i.jsx("p",{className:"status-text",children:h("git.noHistory")})}):null]})]})]})}function Fw({title:e,count:t,nodes:n,selectedPath:s,collapsedTreePathSet:o,onToggleTreePath:c,onSelectFile:l,onToggleMobileSelection:d,onStageToggle:p,onDiscard:m,actioning:y,variant:g,isMobileViewport:b,selectedMobilePathSet:x,selectedTargets:C,mobileActionMenuOpen:S,onToggleMobileActionMenu:j,onClearSelectedTargets:M}){const A=lp(n),E=h(g==="staged"?"git.unstageAll":"git.stageAll");return i.jsxs("section",{className:"git-tree-group","data-variant":g,children:[i.jsxs("div",{className:"git-section-header git-tree-group-header",children:[i.jsx("h3",{children:e}),i.jsxs("div",{className:"git-tree-group-actions",children:[i.jsx("span",{className:"workbench-section-counter",children:t}),!b&&A.length>0?i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"git-icon-button",type:"button","aria-label":E,title:E,onClick:()=>void p(A,g==="staged"),disabled:y,children:i.jsx(af,{staged:g==="staged"})}),g==="unstaged"?i.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":h("git.discardAll"),title:h("git.discardAll"),onClick:()=>void m(A),disabled:y,children:i.jsx(of,{})}):null]}):null,b&&C.length>0?i.jsx("button",{className:"git-icon-button",type:"button","aria-label":h("git.operationMenu"),title:h("git.operationMenu"),onClick:j,disabled:y,children:i.jsx(Pc,{})}):null]}),b&&S?i.jsxs("div",{className:"git-selection-menu",children:[i.jsxs("div",{className:"git-menu-section",children:[i.jsx("span",{className:"git-menu-caption",children:h("git.selectedFiles")}),i.jsx("strong",{className:"git-menu-branch",children:C.length})]}),i.jsxs("div",{className:"git-menu-section",children:[i.jsx("button",{className:"git-menu-item",type:"button",disabled:y,onClick:()=>void p(C,g==="staged"),children:i.jsx("span",{children:h(g==="staged"?"git.unstage":"git.stage")})}),g==="unstaged"?i.jsx("button",{className:"git-menu-item",type:"button",disabled:y,onClick:()=>void m(C),children:i.jsx("span",{children:h("git.discard")})}):null,i.jsx("button",{className:"git-menu-item",type:"button",disabled:y,onClick:M,children:i.jsx("span",{children:h("git.clearSelection")})})]})]}):null]}),i.jsx("div",{className:"git-tree-shell",role:"tree","aria-label":e,children:n.length?DS({nodes:n,depth:0,collapsedTreePathSet:o,selectedPath:s,onToggleTreePath:c,onSelectFile:l,onToggleMobileSelection:d,onStageToggle:p,onDiscard:m,actioning:y,variant:g,isMobileViewport:b,selectedMobilePathSet:x}):i.jsx("p",{className:"git-tree-status",children:h("git.noChanges")})})]})}function bh({title:e,count:t,expanded:n,onToggle:s,trailingContent:o,headerAction:c,children:l}){return i.jsxs("section",{className:"git-mobile-section","data-expanded":n,children:[i.jsxs("div",{className:"git-mobile-section-header",children:[i.jsxs("button",{className:"git-mobile-section-toggle",type:"button","aria-expanded":n,onClick:s,children:[i.jsxs("span",{className:"git-mobile-section-toggle-main",children:[i.jsx($c,{expanded:n}),i.jsx("h3",{children:e})]}),i.jsxs("span",{className:"git-mobile-section-toggle-meta",children:[o,i.jsx("span",{className:"workbench-section-counter",children:t})]})]}),c?i.jsx("div",{className:"git-mobile-section-header-action",children:c}):null]}),n?i.jsx("div",{className:"git-mobile-section-body",children:l}):null]})}function Ow({title:e,nodes:t,collapsedTreePathSet:n,onToggleTreePath:s,onToggleMobileSelection:o,selectedMobilePathSet:c,selectedTargets:l,actioning:d,variant:p,swipeRowState:m,onSwipeRowChange:y,onStageToggle:g,onDiscardWithConfirm:b,onClearSelectedTargets:x}){return i.jsxs("div",{className:"git-mobile-record-shell",children:[l.length>0?i.jsxs("div",{className:"git-mobile-selection-toolbar",children:[i.jsxs("span",{className:"git-mobile-selection-count",children:[h("git.selectedFiles")," ",l.length]}),i.jsxs("div",{className:"git-mobile-selection-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:()=>void g(l,p==="staged"),children:h(p==="staged"?"git.unstage":"git.stage")}),p==="unstaged"?i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:d,onClick:()=>void b(l,`${l.length}`),children:h("git.discard")}):null,i.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:x,children:h("git.clearSelection")})]})]}):null,i.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":e,children:t.length?IS({nodes:t,depth:0,collapsedTreePathSet:n,onToggleTreePath:s,onToggleMobileSelection:o,selectedMobilePathSet:c,actioning:d,variant:p,swipeRowState:m,onSwipeRowChange:y,onStageToggle:g,onDiscardWithConfirm:b}):i.jsx("p",{className:"git-tree-status",children:h("git.noChanges")})})]})}function IS({nodes:e,depth:t,collapsedTreePathSet:n,onToggleTreePath:s,onToggleMobileSelection:o,selectedMobilePathSet:c,actioning:l,variant:d,swipeRowState:p,onSwipeRowChange:m,onStageToggle:y,onDiscardWithConfirm:g}){return e.map(b=>{if(b.kind==="directory"){const S=!n.has(b.path),j=lp(b.children),M=`directory:${b.path}`;return i.jsxs("div",{className:"git-mobile-record-branch",children:[i.jsx(Bw,{rowKey:M,openState:(p==null?void 0:p.path)===M?p.direction:null,onOpenStateChange:A=>m(A?{path:M,direction:A}:null),leadingAction:j.length>0?{label:h(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void y(j,d==="staged")}:null,trailingAction:d==="unstaged"&&j.length>0?{label:h("git.discard"),tone:"danger",onPress:()=>void g(j,b.path)}:null,children:i.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${Dw+t*_w}px`},onClick:()=>s(b.path),children:[i.jsxs("span",{className:"git-mobile-record-leading",children:[i.jsx("span",{className:"git-tree-chevron","data-expanded":S,children:i.jsx($c,{expanded:S})}),i.jsx("span",{className:"git-mobile-record-title",children:b.name})]}),i.jsx("span",{className:"git-mobile-record-meta",children:j.length})]})}),S?i.jsx("div",{className:"git-mobile-record-children",role:"group",children:IS({nodes:b.children,depth:t+1,collapsedTreePathSet:n,onToggleTreePath:s,onToggleMobileSelection:o,selectedMobilePathSet:c,actioning:l,variant:d,swipeRowState:p,onSwipeRowChange:m,onStageToggle:y,onDiscardWithConfirm:g})}):null]},M)}const x=`file:${b.path}`,C=c.has(b.path);return i.jsx(Bw,{rowKey:x,openState:(p==null?void 0:p.path)===x?p.direction:null,onOpenStateChange:S=>m(S?{path:x,direction:S}:null),leadingAction:{label:h(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void y([b.change.path],d==="staged")},trailingAction:d==="unstaged"?{label:h("git.discard"),tone:"danger",onPress:()=>void g([b.change.path],b.path)}:null,children:i.jsxs("div",{className:"git-mobile-record git-mobile-record-file","data-active":C,style:{paddingInlineStart:`${Dw+t*_w}px`},children:[i.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:C,"aria-label":`${h("git.selectFile")} ${b.name}`,onChange:()=>o(b.change.path)}),i.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>o(b.change.path),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(b.name),"aria-hidden":"true",children:xs(b.name)}),i.jsxs("span",{className:"git-mobile-record-copy",children:[i.jsx("span",{className:"git-mobile-record-title",children:b.name}),i.jsx("span",{className:"git-mobile-record-path",children:b.path})]}),i.jsx("span",{className:"git-status-badge","data-status":b.status,children:b.status})]})]})},x)})}function Bw({rowKey:e,openState:t,onOpenStateChange:n,leadingAction:s,trailingAction:o,children:c}){const l=Fr(),d=w.useRef(null),[p,m]=w.useState(0);w.useEffect(()=>{t||m(0)},[t,e]);const y=p!==0?p:t==="leading"?78:t==="trailing"?-78:0;function g(S){var j,M;S.button===0&&(d.current={pointerId:S.pointerId,startX:S.clientX},(M=(j=S.currentTarget).setPointerCapture)==null||M.call(j,S.pointerId))}function b(S){const j=d.current;if(!j||j.pointerId!==S.pointerId)return;const M=s?88:0,E=Math.max(-(o?88:0),Math.min(M,S.clientX-j.startX));m(E)}function x(S){var M,A;const j=d.current;if(!(!j||j.pointerId!==S.pointerId)){if((A=(M=S.currentTarget).releasePointerCapture)==null||A.call(M,S.pointerId),d.current=null,p>=44&&s){l.trigger("gesture"),n("leading"),m(0);return}if(p<=-44&&o){l.trigger("gesture"),n("trailing"),m(0);return}n(null),m(0)}}function C(S){var M,A;const j=d.current;!j||j.pointerId!==S.pointerId||((A=(M=S.currentTarget).releasePointerCapture)==null||A.call(M,S.pointerId),d.current=null,m(0))}return i.jsxs("div",{className:"git-mobile-swipe-row","data-open-state":t??"closed","data-dragging":p!==0,children:[s?i.jsx("button",{type:"button",className:"git-mobile-swipe-action leading","data-tone":s.tone,onClick:()=>{l.trigger("action"),n(null),s.onPress()},children:s.label}):null,o?i.jsx("button",{type:"button",className:"git-mobile-swipe-action trailing","data-tone":o.tone,onClick:()=>{l.trigger(o.tone==="danger"?"warning":"action"),n(null),o.onPress()},children:o.label}):null,i.jsx("div",{className:"git-mobile-swipe-content",style:{transform:`translateX(${y}px)`},onPointerDown:g,onPointerMove:b,onPointerUp:x,onPointerCancel:C,children:c})]})}function AO({history:e,historyLoadingMore:t,hasMore:n,actioning:s,openCommitHash:o,onToggleMenu:c,onCopyCommitHash:l,onCopyCommitSubject:d,onUndoLastCommit:p,onLoadMore:m}){return e.length?i.jsxs("div",{className:"git-mobile-history-list",children:[e.map((y,g)=>{const b=o===y.commitHash,x=g===0&&y.commitKind==="local";return i.jsxs("article",{className:"git-mobile-history-entry","data-kind":y.commitKind,children:[i.jsxs("div",{className:"git-mobile-history-entry-main",children:[i.jsx("span",{className:"git-history-marker","data-kind":y.commitKind,"aria-hidden":"true"}),i.jsxs("div",{className:"git-mobile-history-copy",children:[i.jsxs("div",{className:"git-history-title-row",children:[i.jsx("strong",{title:y.subject,children:y.subject}),i.jsx("span",{className:"git-history-kind-badge","data-kind":y.commitKind,children:BS(y.commitKind)})]}),y.refs.length>0?i.jsx("div",{className:"git-history-ref-list",children:y.refs.map(C=>i.jsx("span",{className:"git-history-ref-pill","data-kind":C.kind,"data-remote-index":String(US(C.remoteName)),children:C.name},`${y.commitHash}:${C.kind}:${C.name}`))}):null,i.jsxs("div",{className:"git-history-meta",children:[i.jsx("span",{className:"git-history-hash",children:y.commitHash.slice(0,8)}),i.jsx("span",{children:y.authorName}),i.jsx("time",{dateTime:y.authoredAt,children:zS(y.authoredAt)})]})]}),i.jsx("button",{type:"button",className:"git-icon-button","aria-label":h("git.historyItemMenu"),onClick:()=>c(y.commitHash),children:i.jsx(Pc,{})})]}),b?i.jsxs("div",{className:"git-mobile-history-menu",children:[i.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>l(y.commitHash),children:i.jsx("span",{children:h("git.copyCommitHash")})}),i.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>d(y.subject),children:i.jsx("span",{children:h("git.copyCommitSubject")})}),x?i.jsx("button",{type:"button",className:"git-menu-item",disabled:s,onClick:p,children:i.jsx("span",{children:h("git.undoLastCommit")})}):null]}):null]},y.commitHash)}),n?i.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:t,onClick:m,children:t?`${h("git.refreshNow")}...`:h("common.loadMore")}):null]}):i.jsx("p",{className:"git-tree-status",children:h("git.noHistory")})}function DS({nodes:e,depth:t,collapsedTreePathSet:n,selectedPath:s,onToggleTreePath:o,onSelectFile:c,onToggleMobileSelection:l,onStageToggle:d,onDiscard:p,actioning:m,variant:y,isMobileViewport:g,selectedMobilePathSet:b}){return e.map(x=>{if(x.kind==="directory"){const j=!n.has(x.path),M=lp(x.children),A=`${h(y==="staged"?"git.unstage":"git.stage")} ${x.path}`,E=`${h("git.discard")} ${x.path}`;return i.jsxs("div",{className:"git-tree-node",children:[i.jsxs("div",{className:"git-tree-row",role:"treeitem","aria-expanded":j,children:[i.jsxs("button",{className:"git-tree-trigger",type:"button",style:{paddingInlineStart:`${6+t*8}px`},onClick:()=>o(x.path),children:[i.jsx("span",{className:"git-tree-chevron","data-expanded":j,children:i.jsx($c,{expanded:j})}),i.jsx("span",{className:"git-tree-label git-tree-label-directory",children:x.name})]}),!g&&M.length>0?i.jsxs("div",{className:"git-row-actions",children:[i.jsx("button",{className:"git-icon-button",type:"button","aria-label":A,title:A,onClick:()=>void d(M,y==="staged"),disabled:m,children:i.jsx(af,{staged:y==="staged"})}),y==="unstaged"?i.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":E,title:E,onClick:()=>void p(M),disabled:m,children:i.jsx(of,{})}):null]}):null]}),j?i.jsx("div",{className:"git-tree-children",role:"group",children:DS({nodes:x.children,depth:t+1,collapsedTreePathSet:n,selectedPath:s,onToggleTreePath:o,onSelectFile:c,onToggleMobileSelection:l,onStageToggle:d,onDiscard:p,actioning:m,variant:y,isMobileViewport:g,selectedMobilePathSet:b})}):null]},`directory:${x.path}`)}const C=b.has(x.path),S=g?C:s===x.path;return g?i.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":S,"data-mobile":"true",children:[i.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:C,"aria-label":`${h("git.selectFile")} ${x.name}`,onChange:()=>l(x.change.path)}),i.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":S,"data-mobile":"true",style:{paddingInlineStart:`${18+t*8}px`},onClick:()=>l(x.change.path),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(x.name),"aria-hidden":"true",children:xs(x.name)}),i.jsx("span",{className:"git-tree-label-wrap",children:i.jsx("span",{className:"git-tree-label",children:x.name})}),i.jsx("span",{className:"git-tree-file-meta",children:i.jsx("span",{className:"git-status-badge","data-status":x.status,children:x.status})})]})]},`file:${x.path}`):i.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":S,children:[i.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":S,style:{paddingInlineStart:`${18+t*8}px`},onClick:()=>c(x.change.path),children:[i.jsx("span",{className:"git-tree-file-icon","data-kind":ks(x.name),"aria-hidden":"true",children:xs(x.name)}),i.jsx("span",{className:"git-tree-label-wrap",children:i.jsx("span",{className:"git-tree-label",children:x.name})}),i.jsx("span",{className:"git-tree-file-meta",children:i.jsx("span",{className:"git-status-badge","data-status":x.status,children:x.status})})]}),i.jsxs("div",{className:"git-row-actions",children:[i.jsx("button",{className:"git-icon-button",type:"button","aria-label":x.variant==="staged"?h("git.unstage"):h("git.stage"),title:x.variant==="staged"?h("git.unstage"):h("git.stage"),onClick:()=>void d([x.change.path],x.variant==="staged"),disabled:m,children:i.jsx(af,{staged:x.variant==="staged"})}),y==="unstaged"?i.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":h("git.discard"),title:h("git.discard"),onClick:()=>void p([x.change.path]),disabled:m,children:i.jsx(of,{})}):null]})]},`file:${x.path}`)})}function Uw(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function zw(e,t){const n=Uw("","");for(const s of e){const o=s.path.replace(/\\/g,"/"),c=o.split("/").filter(Boolean);let l=n;c.forEach((d,p)=>{const m=c.slice(0,p+1).join("/");if(p===c.length-1){l.children.set(`file:${m}`,{kind:"file",name:d,path:o,change:s,status:LO(s,t),variant:t});return}const y=`directory:${m}`,g=l.children.get(y);if(g&&g.kind==="directory"){l=g;return}const b=Uw(d,m);l.children.set(y,b),l=b})}return FS(_S([...n.children.values()]))}function _S(e){return[...e].sort((t,n)=>t.kind!==n.kind?t.kind==="directory"?-1:1:t.name.localeCompare(n.name,"zh-CN")).map(t=>t.kind==="directory"?{kind:"directory",name:t.name,path:t.path,children:_S([...t.children.values()])}:t)}function FS(e){return e.map(t=>{var l;if(t.kind!=="directory")return t;const n=FS(t.children);let s=t.name,o=t.path,c=n;for(;c.length===1&&((l=c[0])==null?void 0:l.kind)==="directory";){const d=c[0];s=`${s}/${d.name}`,o=d.path,c=d.children}return{kind:"directory",name:s,path:o,children:c}})}function Ww(e,t,n){const s=new Set(e);return t.filter(o=>sf(o,n)&&s.has(o.path)).map(o=>o.path)}function lp(e){const t=[],n=new Set;function s(o){if(o.kind==="file"){n.has(o.path)||(n.add(o.path),t.push(o.path));return}o.children.forEach(s)}return e.forEach(s),t}function sf(e,t){return t==="staged"?!!e.stagedStatus:!!e.worktreeStatus}function LO(e,t){return t==="staged"?e.stagedStatus??e.status:e.worktreeStatus??e.status}function IO(e){return{subject:OS(e).trim(),body:null,footer:null,source:"manual"}}function OS(e){return e.replace(/[\r\n]+/g," ")}function DO(e){if(!e)return;e.style.height="0px";const t=Math.min(Math.max(e.scrollHeight,34),120);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>120?"auto":"hidden"}function BS(e){switch(e){case"local":return h("git.historyKindLocal");case"remote":return h("git.historyKindRemote");default:return h("git.historyKindShared")}}function US(e){if(!e)return 0;let t=0;for(const n of e)t=t*33+n.charCodeAt(0)>>>0;return t%6}function ei(e,t){return e instanceof Hn?_O(e)??e.message:typeof e=="object"&&e&&"message"in e?e.message:t}function xh(e){return`git-sidebar.snapshot.${e}`}function _O(e){switch(e.errorCode){case"UNAUTHORIZED":return h("git.errors.unauthorized");case"WORKSPACE_NOT_FOUND":return h("git.errors.workspaceNotFound");case"INVALID_WORKSPACE":return h("git.errors.invalidWorkspace");case"NOT_GIT_REPOSITORY":return h("git.errors.notGitRepository");case"GIT_REPO_NOT_FOUND":return h("git.errors.repoNotFound");case"PATH_OUT_OF_WORKSPACE":return h("git.errors.pathOutOfWorkspace");case"INVALID_TARGET":return h("git.errors.invalidTarget");case"NOT_STAGED":return h("git.errors.notStaged");case"EMPTY_STAGED_CHANGES":return h("git.errors.emptyStagedChanges");case"BRANCH_CONFLICT":return h("git.errors.branchConflict");case"BRANCH_NOT_FOUND":return h("git.errors.branchNotFound");case"REMOTE_NOT_FOUND":return h("git.errors.remoteNotFound");case"GIT_REMOTE_AUTH_FAILED":return h("git.errors.remoteAuthFailed");case"GIT_PUSH_FAILED":return h("git.errors.pushFailed");case"GIT_PULL_FAILED":return h("git.errors.pullFailed");case"GIT_REMOTE_FAILED":return h("git.errors.remoteFailed");case"GIT_COMMAND_TIMEOUT":return h("git.errors.commandTimeout");case"GIT_DISCARD_FAILED":return h("git.discardFailed");case"GIT_UNDO_FAILED":return h("git.undoLastCommitFailed");default:return null}}function $c({expanded:e}){return i.jsx("svg",{className:"git-chevron-icon",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},"aria-hidden":"true",children:i.jsx("polyline",{points:"6 9 12 15 18 9"})})}function af({staged:e}){return e?i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:i.jsx("path",{d:"M5 12h14"})}):i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[i.jsx("path",{d:"M12 5v14"}),i.jsx("path",{d:"M5 12h14"})]})}function of(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[i.jsx("path",{d:"M10 7L6 11l4 4",strokeLinecap:"round",strokeLinejoin:"round"}),i.jsx("path",{d:"M7 11h7c3.87 0 7 3.13 7 7 0 1.9-.76 3.63-2 4.89",strokeLinecap:"round",strokeLinejoin:"round"})]})}function FO(){return i.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:i.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"})})}function Pc(){return i.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function zS(e){try{return new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(e))}catch{return e}}const OO=Object.freeze(Object.defineProperty({__proto__:null,GitSidebar:LS},Symbol.toStringTag,{value:"Module"})),WS="mobile.tools.last-primary-tool",pc=["files","git"],BO=56,UO=1.2;function Hw(e,t){return e==="git"?"git":e==="files"?"files":t}function zO(e,t,n){if(!t)return e;const s=n.x-t.x,o=n.y-t.y;if(Math.abs(s)<BO||Math.abs(s)<Math.abs(o)*UO)return e;const c=pc.indexOf(e),l=s<0?Math.min(pc.length-1,c+1):Math.max(0,c-1);return pc[l]??e}function WO(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(WS)==="git"?"git":"files"}catch{return"files"}}function HO(){var E,Z;const e=Qr(),t=Mn(),n=Fr(),{navigationGroups:s,currentWorkspaceId:o,currentSessionId:c,selectWorkspace:l}=lr(),d=((E=s.find(Y=>Y.workspace.id===o))==null?void 0:E.workspace)??((Z=s[0])==null?void 0:Z.workspace)??null,p=new URLSearchParams(e.search).get("tab"),m=w.useRef(WO()),y=Hw(p,m.current),[g,b]=w.useState(()=>{const Y=Hw(p,m.current);return{files:Y==="files",git:Y==="git"}}),x=w.useRef(null),C=w.useMemo(()=>[{key:"files",title:h("shell.filesEntry"),render:()=>i.jsx(PS,{sessionId:c,workspaceId:o,hideHeading:!0})},{key:"git",title:h("shell.gitEntry"),render:()=>i.jsx(LS,{className:"mobile-tool-native-panel mobile-tool-git-panel",workspaceId:o})}],[c,o]),S=pc.indexOf(y);w.useEffect(()=>{b(Y=>({...Y,[y]:!0}))},[y]),w.useEffect(()=>{if(m.current=y,!(typeof window>"u"))try{window.localStorage.setItem(WS,y)}catch{}},[y]),w.useEffect(()=>{if(p===y)return;const Y=new URLSearchParams(e.search);Y.set("tab",y),t({pathname:e.pathname,search:`?${Y.toString()}`},{replace:!0})},[y,e.pathname,e.search,t,p]);function j(Y,B="selection"){if(Y===y)return;n.trigger(B);const I=new URLSearchParams(e.search);I.set("tab",Y),t({pathname:e.pathname,search:`?${I.toString()}`},{replace:!0})}function M(Y){if(Y.changedTouches.length!==1){x.current=null;return}const B=Y.changedTouches[0];x.current={x:B.clientX,y:B.clientY}}function A(Y){const B=x.current;if(x.current=null,Y.changedTouches.length!==1)return;const I=Y.changedTouches[0],_=zO(y,B,{x:I.clientX,y:I.clientY});_!==y&&j(_)}return i.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root mobile-tools-workspace-page",children:d?i.jsxs(i.Fragment,{children:[i.jsx(ga,{currentWorkspace:d,workspaces:s.map(Y=>Y.workspace),onSelectWorkspace:Y=>{l(Y),t(fa(Y,y))},trailing:i.jsx("button",{type:"button",className:"secondary-button mobile-tools-more-button","aria-label":h("shell.toolsMoreAction"),title:h("shell.toolsMoreAction"),onClick:()=>{n.trigger("action"),t(Uc(d.id))},children:i.jsx($O,{})}),content:i.jsx("div",{className:"mobile-tools-switcher","aria-label":h("shell.mobileToolsEntry"),children:i.jsx("div",{className:"mobile-tools-segmented-control",role:"tablist","aria-label":h("shell.mobileToolsEntry"),children:C.map(Y=>{const B=Y.key===y;return i.jsx("button",{type:"button",role:"tab",className:"mobile-tools-segmented-button","data-active":B,"aria-selected":B,"aria-controls":`mobile-tool-panel-${Y.key}`,onClick:()=>j(Y.key,"selection"),children:Y.title},Y.key)})})})}),i.jsx("section",{className:"mobile-tools-stage","data-active-tool":y,"data-testid":"mobile-tools-stage",onTouchStart:M,onTouchEnd:A,onTouchCancel:()=>{x.current=null},children:i.jsx("div",{className:"mobile-tools-stage-viewport",children:i.jsx("div",{className:"mobile-tools-stage-track",style:{transform:`translateX(-${S*100}%)`},children:C.map(Y=>i.jsx("article",{id:`mobile-tool-panel-${Y.key}`,role:"tabpanel","aria-label":Y.title,"aria-hidden":Y.key!==y,className:"mobile-tools-stage-panel",children:i.jsx("div",{className:"mobile-tools-stage-panel-shell",children:g[Y.key]?Y.render():null})},Y.key))})})})]}):i.jsx("article",{className:"mobile-feature-empty surface-card",children:i.jsx("p",{children:h("shell.emptyNavigationBody")})})})}function $O(){return i.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[i.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),i.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function VO(e){return e.isArchived!==!0&&e.isSubagent!==!0}function HS(e){return e.activityState==="running"||e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting"}function qO(e){return e.activityState==="idle"&&HS(e)===!1}function $w(e){return e==="creating"||e==="running"}function Ec(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt}function GO(e,t){return Ec(t).localeCompare(Ec(e))}function Vw(e){return h(e==="codex"?"conversation.providerCodex":e==="opencode"?"conversation.providerOpenCode":"shell.providerClaudeCode")}function qw(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):h("common.unknown")}const sc=60*1e3;function KO(){const e=Mn(),{navigationGroups:t,currentWorkspaceId:n,refreshNavigation:s,selectWorkspace:o,startDraftSession:c,subscribeGitSnapshot:l,requestGitRefresh:d,addGitSnapshotListener:p,subscribeTerminalManagerSnapshot:m,requestTerminalManagerRefresh:y,addTerminalManagerSnapshotListener:g}=lr(),[b,x]=w.useState(null),[C,S]=w.useState(!1),[j,M]=w.useState({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null}),A=t.find(P=>P.workspace.id===n)??t[0]??null,E=(A==null?void 0:A.workspace)??null,Z=[...(A==null?void 0:A.sessions)??[]].filter(VO).sort(GO),Y=Z.filter(HS),B=Z.filter(qO),I=Z.filter(P=>P.activityState==="completed_unread"),_=Z.filter(P=>P.isFavorite===!0),F=Y.slice(0,6),R=_.slice(0,6);w.useEffect(()=>{const P=(E==null?void 0:E.id)??null;if(!P){M({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null});return}const be=Cn(kh(P),sc);M(ke=>{var ve,Ae;return{...ke,gitLoading:be===null,branch:((ve=be==null?void 0:be.status)==null?void 0:ve.snapshot.branch)??null,changedFileCount:((Ae=be==null?void 0:be.status)==null?void 0:Ae.changes.length)??null}})},[E==null?void 0:E.id]),w.useEffect(()=>{const P=(E==null?void 0:E.id)??null;if(P)return p(be=>{be.workspaceId===P&&(br(kh(P),be),M(ke=>{var ve,Ae,Be;return{...ke,gitLoading:!1,branch:((ve=be.status)==null?void 0:ve.snapshot.branch)??((Ae=be.branches)==null?void 0:Ae.currentBranch)??null,changedFileCount:((Be=be.status)==null?void 0:Be.changes.length)??null}}))})},[p,E==null?void 0:E.id]),w.useEffect(()=>{const P=(E==null?void 0:E.id)??null;if(!P){M(ke=>({...ke,gitLoading:!1,branch:null,changedFileCount:null}));return}const be=Cn(Sh(P),sc);M(ke=>({...ke,terminalLoading:be===null,activeTerminalCount:be?be.terminals.filter(ve=>$w(ve.status)).length:null,quickLaunchRunning:be?be.templateStatuses.some(ve=>ve.occupied):null}))},[E==null?void 0:E.id]),w.useEffect(()=>{const P=(E==null?void 0:E.id)??null;if(!P){M(be=>({...be,terminalLoading:!1,activeTerminalCount:null,quickLaunchRunning:null}));return}return g(be=>{be.workspaceId===P&&(br(Sh(P),{terminals:be.terminals,templates:be.templates,templateStatuses:be.templateStatuses}),M(ke=>({...ke,terminalLoading:!1,activeTerminalCount:be.terminals.filter(ve=>$w(ve.status)).length,quickLaunchRunning:be.templateStatuses.some(ve=>ve.occupied)})))})},[g,E==null?void 0:E.id]),w.useEffect(()=>{const P=(E==null?void 0:E.id)??null;if(!P)return;const be=Cn(kh(P),sc)!==null;l(P),!be&&d(P)},[E==null?void 0:E.id,d,l]),w.useEffect(()=>{const P=(E==null?void 0:E.id)??null;if(!P)return;const be=Cn(Sh(P),sc)!==null;m(P),!be&&y(P)},[E==null?void 0:E.id,y,m]);async function W(P){await s(),o(P.id),x(null),e(ri(P.id))}async function J(P){await s(),o(P.id),x(null),e(ri(P.id))}function re(){E&&(o(E.id),e(fa(E.id,"git")))}function le(){E&&(o(E.id),e(sa(E.id)))}function ie(){E&&(o(E.id),e(Uc(E.id)))}function xe(){E&&e(_o(E.id))}function q(){E&&S(!0)}function K(P,be){S(!1),c(P,be)}function me(){E&&(o(E.id),e(ri(E.id)))}function L(P){o(P)}const $=[{label:h("shell.workspaceHomeMetricActive"),value:Y.length,onClick:Z.length>0?xe:void 0},{label:h("shell.workspaceHomeMetricUnread"),value:I.length,onClick:Z.length>0?xe:void 0},{label:h("shell.workspaceHomeMetricTerminal"),value:j.terminalLoading?"…":j.activeTerminalCount??"—",onClick:E?le:void 0},{label:h("shell.workspaceHomeMetricChanges"),value:j.gitLoading?"…":j.changedFileCount??"—",onClick:E?re:void 0}],se=[{label:h("shell.workspaceHomeQuickLaunchStatusLabel"),value:j.quickLaunchRunning===null?"…":j.quickLaunchRunning?h("shell.workspaceHomeQuickLaunchRunning"):h("shell.workspaceHomeQuickLaunchStopped"),onClick:E?ie:void 0},{label:h("shell.workspaceHomeWaitingInputLabel"),value:B.length,onClick:Z.length>0?xe:void 0}];return i.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-home-page",children:[E?i.jsxs(i.Fragment,{children:[i.jsx(ga,{currentWorkspace:E,workspaces:t.map(P=>P.workspace),onSelectWorkspace:L,sheetContent:P=>i.jsxs("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:[i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{P(),x("import")},children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:h("shell.importWorkspaceTitle")}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]}),i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{P(),x("clone")},children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:h("shell.cloneWorkspaceTitle")}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]})]})}),i.jsxs("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:[i.jsx("section",{className:"mobile-workspace-home-section",children:i.jsx("div",{className:"mobile-workspace-home-metrics-card","aria-label":h("shell.workspaceHomeStatusSectionTitle"),children:i.jsx("div",{className:"mobile-workspace-home-toolbar-summary",children:$.map(P=>P.onClick?i.jsxs("button",{type:"button",className:"mobile-workspace-home-toolbar-metric",onClick:P.onClick,children:[i.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:P.value}),i.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:P.label})]},P.label):i.jsxs("div",{className:"mobile-workspace-home-toolbar-metric",role:"listitem",children:[i.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:P.value}),i.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:P.label})]},P.label))})})}),i.jsx("section",{className:"mobile-workspace-home-section",children:i.jsxs("div",{className:"mobile-workspace-home-primary-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:me,children:h("shell.workspaceDetailTitle")}),i.jsx("button",{type:"button",className:"primary-button",onClick:q,children:h("shell.createSession")})]})}),i.jsx("section",{className:"mobile-workspace-home-section",children:i.jsx("div",{className:"mobile-workspace-home-group",children:se.map(P=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:P.onClick,children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:P.label}),i.jsxs("span",{className:"mobile-workspace-home-row-trailing",children:[i.jsx("strong",{children:P.value}),i.jsx(Di,{})]})]},P.label))})}),i.jsxs("section",{className:"mobile-workspace-home-section",children:[i.jsxs("div",{className:"mobile-workspace-home-section-header",children:[i.jsx("p",{className:"mobile-workspace-home-section-title",children:h("shell.workspaceHomeActiveSessionsSectionTitle")}),E?i.jsx("button",{type:"button",className:"mobile-workspace-home-link-button",onClick:xe,children:h("shell.workspaceHomeViewAllAction")}):null]}),i.jsx("div",{className:"mobile-workspace-home-group",children:F.length===0?i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-empty-row",onClick:q,children:[i.jsxs("div",{className:"mobile-workspace-home-session-main",children:[i.jsx("span",{className:"mobile-workspace-home-session-title",children:h("shell.createSession")}),i.jsx("span",{className:"mobile-workspace-home-session-meta",children:E.name})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]}):F.map(P=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Vn(E.id,P.sessionId)),children:[i.jsxs("div",{className:"mobile-workspace-home-session-main",children:[i.jsx("span",{className:"mobile-workspace-home-session-title",children:P.title||h("common.unknown")}),i.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[Vw(P.provider)," · ",qw(Ec(P))]})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]},P.sessionId))})]}),R.length>0?i.jsxs("section",{className:"mobile-workspace-home-section",children:[i.jsx("div",{className:"mobile-workspace-home-section-header",children:i.jsx("p",{className:"mobile-workspace-home-section-title",children:h("shell.favoriteSectionTitle")})}),i.jsx("div",{className:"mobile-workspace-home-group",children:R.map(P=>i.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Vn(E.id,P.sessionId)),children:[i.jsxs("div",{className:"mobile-workspace-home-session-main",children:[i.jsx("span",{className:"mobile-workspace-home-session-title",children:P.title||h("common.unknown")}),i.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[Vw(P.provider)," · ",qw(Ec(P))]})]}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]},P.sessionId))})]}):null]})]}):i.jsx("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:i.jsxs("section",{className:"mobile-workspace-home-section mobile-workspace-home-empty",children:[i.jsx("p",{className:"mobile-workspace-home-section-title",children:h("shell.workspaceHomeSwitcherTitle")}),i.jsxs("div",{className:"mobile-workspace-home-group",children:[i.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>x("import"),children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:h("shell.importWorkspaceTitle")}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]}),i.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>x("clone"),children:[i.jsx("span",{className:"mobile-workspace-home-row-label",children:h("shell.cloneWorkspaceTitle")}),i.jsx("span",{className:"mobile-workspace-home-row-trailing",children:i.jsx(Di,{})})]})]})]})}),i.jsx(Wk,{open:b==="import",onClose:()=>x(null),onImported:W}),i.jsx(zk,{open:b==="clone",onClose:()=>x(null),onCloned:J}),i.jsx(rp,{open:C,workspaces:t.map(P=>P.workspace),initialWorkspaceId:(E==null?void 0:E.id)??n??null,onClose:()=>S(!1),onSelect:K})]})}function kh(e){return`git-sidebar.snapshot.${e}`}function Sh(e){return`terminal-manager.snapshot.${e}`}function Di(){return i.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:i.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function Gw(e){return h(e==="codex"?"conversation.providerCodex":e==="opencode"?"conversation.providerOpenCode":"conversation.providerClaude")}function QO(e){return e.isArchived!==!0&&e.isSubagent!==!0}function YO(e){return e.isArchived===!0&&e.isSubagent!==!0}function Kw(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt??""}function Qw(e,t){return Kw(t).localeCompare(Kw(e))}const Ch=60*1e3,jh=10;function XO(){var xe;const{workspaceId:e=""}=yf(),t=Mn(),{showToast:n}=Gn(),{navigationGroups:s,currentWorkspaceId:o,favoriteSessionIds:c,workspaceManagementStateById:l,selectWorkspace:d,subscribeGitSnapshot:p,requestGitRefresh:m,subscribeWorkspaceManagementSnapshot:y,requestWorkspaceManagementRefresh:g,toggleFavoriteSession:b,archiveSession:x,unarchiveSession:C,startDraftSession:S}=lr(),[j,M]=w.useState(!1),[A,E]=w.useState(!1),[Z,Y]=w.useState(jh),B=s.find(q=>q.workspace.id===e)??null,I=(B==null?void 0:B.workspace)??null,_=w.useMemo(()=>[...(B==null?void 0:B.sessions)??[]].filter(QO).sort(Qw),[B]),F=w.useMemo(()=>[...(B==null?void 0:B.sessions)??[]].filter(YO).sort(Qw),[B]);w.useEffect(()=>{e&&d(e)},[d,e]),w.useEffect(()=>{if(!e)return;p(e),y(e);const q=Cn(eB(e),Ch)!==null,K=Cn(Yw(e),Ch)!==null;q||m(e),K||g(e)},[m,g,p,y,e]),w.useEffect(()=>{Y(jh)},[e]);const R=w.useMemo(()=>{if(!e)return{loading:!1,error:null,hasMeaningfulSummary:!1,summary:null};const q=Cn(Yw(e),Ch),K=l[e]??null,me=(K==null?void 0:K.detail)??(I?tB(I,q):q??null);return{loading:(K==null?void 0:K.loading)??!1,error:(K==null?void 0:K.error)??null,hasMeaningfulSummary:nB(me),summary:me}},[I,e,l]),W=w.useMemo(()=>R.summary?Ok(R.summary.codeComposition.items,h("shell.manageWorkspaceCodeCompositionOther")):[],[R.summary]),J=w.useMemo(()=>W.length>0?Bk(W):void 0,[W]),re=w.useMemo(()=>F.slice(0,Z),[F,Z]);async function le(){if(!(!I||!(typeof window>"u"||window.confirm(h("shell.manageWorkspaceRemoveConfirmTarget",{name:I.name}))))){M(!0);try{await Zb(I.id),n({title:h("shell.manageWorkspaceRemoveSuccess"),tone:"success"}),t("/workspaces",{replace:!0})}catch(K){n({title:K instanceof Error?K.message:h("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{M(!1)}}}function ie(q,K){E(!1),S(q,K)}return I?i.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-detail-page",children:[i.jsx(ga,{currentWorkspace:I,workspaces:s.map(q=>q.workspace),heading:h("shell.workspaceDetailTitle"),triggerLabel:I.name,onSelectWorkspace:q=>{d(q),t(ri(q))},content:i.jsxs("div",{className:"mobile-workspace-detail-header-actions",children:[i.jsx("button",{type:"button",className:"primary-button",onClick:()=>E(!0),children:h("shell.createSession")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(I.id),t(Tk(I.id))},children:h("shell.filesEntry")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(I.id),t(sa(I.id))},children:h("shell.terminalsEntry")})]})}),i.jsxs("div",{className:"mobile-page-top-body mobile-workspace-detail-body",children:[i.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-detail-summary-panel",children:[i.jsxs("div",{className:"mobile-feature-section-header",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.workspaceDetailSummaryTitle")})}),o!==I.id?i.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-switch-button",onClick:()=>d(I.id),children:h("shell.switchWorkspace")}):null]}),R.loading&&R.summary===null?i.jsx("p",{children:h("common.loading")}):null,R.error?i.jsx("p",{className:"status-text","data-tone":"error",children:R.error}):null,R.summary?i.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[i.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[i.jsx("span",{children:h("shell.manageWorkspacePathLabel")}),i.jsx("strong",{title:R.summary.path,children:R.summary.path})]}),i.jsxs("div",{className:"mobile-detail-metric",children:[i.jsx("span",{children:h("shell.manageWorkspaceCurrentBranch")}),i.jsx("strong",{title:R.summary.git.currentBranch??h("common.unknown"),children:R.summary.git.currentBranch??h("common.unknown")})]}),i.jsxs("div",{className:"mobile-detail-metric",children:[i.jsx("span",{children:h("shell.manageWorkspaceGitCommitCount")}),i.jsx("strong",{children:R.hasMeaningfulSummary?R.summary.git.commitCount??0:"—"})]}),i.jsxs("div",{className:"mobile-detail-metric",children:[i.jsx("span",{children:h("shell.manageWorkspaceCodeCompositionFiles")}),i.jsx("strong",{children:R.hasMeaningfulSummary?R.summary.codeComposition.scannedFileCount:"—"})]})]}):null,i.jsxs("div",{className:"mobile-feature-inline-actions mobile-workspace-detail-summary-actions",children:[i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(I.id),t(Pk(I.id))},children:h("shell.gitEntry")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(I.id),t(Uc(I.id))},children:h("shell.terminalManagerEntry")}),i.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:j,onClick:()=>{le()},children:h(j?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})]})]}),i.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[i.jsxs("div",{className:"mobile-feature-section-header",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.manageWorkspaceCodeCompositionLabel")})}),R.summary?i.jsx("span",{className:"mobile-feature-counter",children:R.summary.codeComposition.scannedFileCount}):null]}),R.loading&&R.summary===null?i.jsx("p",{children:h("common.loading")}):null,R.summary?W.length>0?i.jsxs("div",{className:"workbench-manage-type-chart",children:[i.jsxs("div",{className:"workbench-manage-type-chart-ring",style:J,"aria-hidden":"true",children:[i.jsx("strong",{className:"workbench-manage-type-chart-total",children:R.summary.codeComposition.scannedFileCount}),i.jsx("span",{className:"workbench-manage-type-chart-caption",children:h("shell.manageWorkspaceCodeCompositionFiles")})]}),i.jsx("div",{className:"workbench-manage-type-list",children:W.map(q=>i.jsxs("div",{className:"workbench-manage-type-item",children:[i.jsxs("span",{className:"workbench-manage-type-meta",children:[i.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:q.color},"aria-hidden":"true"}),i.jsx("span",{className:"workbench-manage-type-name",children:q.type})]}),i.jsxs("span",{children:[q.count," · ",Fk(q)]})]},q.key))})]}):i.jsx("p",{children:R.summary.codeComposition.error??h("shell.manageWorkspaceNoCodeComposition")}):null,(xe=R.summary)!=null&&xe.codeComposition.truncated?i.jsx("p",{className:"mobile-workspace-composition-note",children:h("shell.manageWorkspaceCodeTruncated",{count:R.summary.codeComposition.scannedFileCount})}):null]}),i.jsxs("section",{className:"mobile-feature-section",children:[i.jsxs("div",{className:"mobile-feature-section-header",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.recentSessionsSectionTitle")})}),i.jsx("span",{className:"mobile-feature-counter",children:_.length})]}),i.jsx("div",{className:"mobile-feature-stack",children:_.length===0?i.jsx("article",{className:"mobile-feature-empty surface-card",children:i.jsx("p",{children:h("shell.emptyWorkspaceSessions")})}):_.map(q=>{const K=$i(q.title,h("common.unknown")),me=c.includes(q.sessionId);return i.jsxs("article",{className:"mobile-session-row surface-card",children:[i.jsxs("button",{type:"button",className:"mobile-session-row-primary",onClick:()=>t(Vn(I.id,q.sessionId)),children:[i.jsx("span",{className:"mobile-session-row-title",title:K.fullTitle,children:K.displayTitle}),i.jsx("span",{className:"mobile-session-row-provider",children:Gw(q.provider)})]}),i.jsxs("div",{className:"mobile-session-row-actions",children:[i.jsx("span",{className:"mobile-feature-badge mobile-session-row-count",children:q.messageCount}),i.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":h(me?"shell.unfavoriteAction":"shell.favoriteAction"),title:h(me?"shell.unfavoriteAction":"shell.favoriteAction"),onClick:()=>{b(q.sessionId)},children:i.jsx(JO,{active:me})}),i.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":h("shell.archiveAction"),title:h("shell.archiveAction"),onClick:()=>{x(q.sessionId)},children:i.jsx(ZO,{})})]})]},q.sessionId)})})]}),F.length>0?i.jsxs("section",{className:"mobile-feature-section",children:[i.jsxs("div",{className:"mobile-feature-section-header",children:[i.jsx("div",{children:i.jsx("h2",{children:h("shell.archiveModalTitle")})}),i.jsx("span",{className:"mobile-feature-counter",children:F.length})]}),i.jsx("div",{className:"mobile-feature-stack",children:re.map(q=>i.jsxs("article",{className:"mobile-session-row surface-card",children:[i.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[i.jsx("span",{className:"mobile-session-row-title",title:q.title,children:q.title}),i.jsx("span",{className:"mobile-session-row-provider",children:Gw(q.provider)})]}),i.jsx("div",{className:"mobile-session-row-actions",children:i.jsx("button",{type:"button",className:"secondary-button mobile-session-row-restore",onClick:()=>{C(q.sessionId)},children:h("shell.unarchiveAction")})})]},q.sessionId))}),re.length<F.length?i.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-expand-button",onClick:()=>{Y(q=>q+jh)},children:h("shell.archiveExpandMore")}):null]}):null]}),i.jsx(rp,{open:A,workspaces:s.map(q=>q.workspace),initialWorkspaceId:o??I.id,onClose:()=>E(!1),onSelect:ie})]}):i.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:i.jsxs("article",{className:"mobile-feature-empty surface-card",children:[i.jsx("h1",{children:h("shell.workspaceDetailMissingTitle")}),i.jsx("p",{children:h("shell.workspaceDetailMissingBody")}),i.jsx("button",{type:"button",className:"secondary-button",onClick:()=>t("/workspaces"),children:h("shell.mobileWorkspacesEntry")})]})})}function JO({active:e}){return i.jsx("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.8",children:i.jsx("path",{d:"m12 3.6 2.6 5.2 5.7.8-4.1 4 1 5.7L12 16.5 6.8 19.3l1-5.7-4.1-4 5.7-.8Z"})})}function ZO(){return i.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[i.jsx("path",{d:"M4 7.5h16"}),i.jsx("path",{d:"M6.4 7.5h11.2l-.9 10.2a2 2 0 0 1-2 1.8H9.3a2 2 0 0 1-2-1.8Z"}),i.jsx("path",{d:"M8 4.5h8a1.5 1.5 0 0 1 1.5 1.5v1.5h-11V6A1.5 1.5 0 0 1 8 4.5Z"}),i.jsx("path",{d:"M10 11.5h4"})]})}function Yw(e){return`workspace-management.summary.${e}`}function eB(e){return`git-sidebar.snapshot.${e}`}function tB(e,t){const n=(t==null?void 0:t.git.repoRoot)??e.repoRoot??null;return{workspaceId:e.id,name:e.name,path:e.path,git:{isRepository:(t==null?void 0:t.git.isRepository)??!!n,repoRoot:n,currentBranch:(t==null?void 0:t.git.currentBranch)??null,commitCount:(t==null?void 0:t.git.commitCount)??null,remotes:(t==null?void 0:t.git.remotes)??[],error:(t==null?void 0:t.git.error)??null},codeComposition:(t==null?void 0:t.codeComposition)??{scannedFileCount:0,truncated:!1,items:[],error:null}}}function nB(e){return e?e.git.isRepository||e.git.repoRoot!==null||e.git.currentBranch!==null||e.git.commitCount!==null||e.git.remotes.length>0||e.codeComposition.scannedFileCount>0||e.codeComposition.items.length>0||e.codeComposition.error!==null:!1}function rB({isDesktop:e,isWeb:t,viewportClass:n}){return e||t&&n==="expanded"?"desktop":"mobile"}function iB(){const e=ar(),t=rB(e);return i.jsx(V2,{shellMode:t})}const sB=[{titleKey:"workbench.emptyResumeTitle",bodyKey:"workbench.emptyResumeBody"},{titleKey:"workbench.emptyNewTitle",bodyKey:"workbench.emptyNewBody"},{titleKey:"workbench.emptyCompanionTitle",bodyKey:"workbench.emptyCompanionBody"}];function aB(){return i.jsx("main",{className:"workbench-page conversation-page-shell",children:i.jsx("section",{className:"workbench-center-placeholder",children:i.jsxs("div",{className:"workbench-empty-guide surface-card",children:[i.jsx("p",{className:"workbench-empty-eyebrow",children:h("workbench.emptyEyebrow")}),i.jsx("div",{className:"workbench-empty-main",children:i.jsxs("div",{className:"workbench-empty-copy",children:[i.jsx("h1",{children:h("workbench.emptyTitle")}),i.jsx("p",{className:"workbench-empty-body",children:h("workbench.emptyBody")})]})}),i.jsx("ol",{className:"workbench-empty-steps",children:sB.map((e,t)=>i.jsxs("li",{className:"workbench-empty-step",children:[i.jsx("span",{className:"workbench-empty-step-index",children:t+1}),i.jsxs("div",{className:"workbench-empty-step-copy",children:[i.jsx("h2",{children:h(e.titleKey)}),i.jsx("p",{children:h(e.bodyKey)})]})]},e.titleKey))}),i.jsx("p",{className:"workbench-empty-tip",children:h("workbench.emptyTip")})]})})})}function oB(){const{shellMode:e}=lr();return e==="mobile"?i.jsx(Ao,{to:"/workspaces",replace:!0}):i.jsx(aB,{})}async function lB(){const e=si(),t=cn.getState(),n=await e.bridge.checkForUpdate(t.releaseChannel);if(!n.ok||!n.value)throw new Error(n.detail??"更新检查失败。");return n.value}async function cB(e){return si().bridge.installUpdate(e)}async function uB(){return si().bridge.rollbackToPreviousVersion()}function $S(){const e=si(),t=e.isDesktop,[n,s]=w.useState(!1),[o,c]=w.useState(!1),[l,d]=w.useState(!1),[p,m]=w.useState(null),[y,g]=w.useState(null),[b,x]=w.useState(null),[C,S]=w.useState(!1);async function j(){var B,I;s(!0),m(null);try{const _=await lB();x(_.manifest),g(_.currentVersion),S(_.hasUpdate),m(dB(_.manifest,_.hasUpdate)),_.hasUpdate&&await e.bridge.showNotification(h("settings.releaseUpdateReady"),((B=_.manifest)==null?void 0:B.tagName)??((I=_.manifest)==null?void 0:I.version)??"-")}catch(_){m(_ instanceof Error?_.message:h("settings.releaseCheckFailed"))}finally{s(!1)}}async function M(){if(!(!(b!=null&&b.packageUrl)||!b.signature)){c(!0),m(null);try{const B=await cB(b);if(!B.ok){m(B.detail??h("settings.releaseInstallFailed"));return}m(h("settings.releaseInstallStarted")),await e.bridge.showNotification(h("settings.releaseInstallStarted"),b.version)}catch(B){m(B instanceof Error?B.message:h("settings.releaseInstallFailed"))}finally{c(!1)}}}async function A(){c(!0),m(null);try{const B=await uB();m(B.ok?h("settings.releaseRollbackStarted"):B.detail??h("settings.releaseRollbackFailed")),B.ok&&await e.bridge.showNotification(h("settings.releaseRollbackStarted"),y??h("settings.releaseUnknownVersion"))}catch(B){m(B instanceof Error?B.message:h("settings.releaseRollbackFailed"))}finally{c(!1)}}async function E(){if(b!=null&&b.htmlUrl){d(!0);try{const B=await e.bridge.openExternal(b.htmlUrl);B.ok||m(B.detail??h("settings.releasePageOpenFailed"))}catch(B){m(B instanceof Error?B.message:h("settings.releasePageOpenFailed"))}finally{d(!1)}}}const Z=!!(t&&(b!=null&&b.packageUrl)&&b.signature&&C),Y=p??(t?null:h("settings.clientUpdateUnsupported"));return i.jsxs("div",{className:"settings-release-card",children:[i.jsxs("div",{className:"settings-release-meta",children:[i.jsxs("span",{children:[h("settings.releaseCurrentVersion"),": ",y??h("settings.releaseUnknownVersion")]}),i.jsxs("span",{children:[h("settings.releaseTargetVersion"),": ",(b==null?void 0:b.version)??"-"]}),i.jsxs("span",{children:[h("settings.releaseTargetTag"),": ",(b==null?void 0:b.tagName)??"-"]}),i.jsxs("span",{children:[h("settings.releasePublishedAt"),": ",hB(b==null?void 0:b.publishedAt)]})]}),b?i.jsxs("div",{className:"settings-release-notes",children:[i.jsx("strong",{children:h("settings.releaseNotes")}),b.title&&b.title!==b.tagName?i.jsx("p",{className:"settings-release-title",children:b.title}):null,b.notes?i.jsx("div",{className:"settings-release-markdown",children:i.jsx(_f,{remarkPlugins:[Uf],children:b.notes})}):i.jsx("p",{children:h("settings.releaseNotesEmpty")})]}):null,Y?i.jsx("p",{className:"settings-release-status",children:Y}):null,i.jsxs("div",{className:"settings-release-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",disabled:!t||n||o,onClick:j,children:h(n?"common.loading":"settings.releaseCheckNow")}),i.jsx("button",{className:"primary-button",type:"button",disabled:!Z||o,onClick:M,children:h(o?"common.loading":"settings.releaseInstallNow")}),i.jsx("button",{className:"secondary-button",type:"button",disabled:!(b!=null&&b.htmlUrl)||n||o||l,onClick:E,children:h(l?"common.loading":"settings.releaseOpenPage")}),i.jsx("button",{className:"secondary-button",type:"button",disabled:!t||o,onClick:A,children:h("settings.releaseRollback")})]})]})}function dB(e,t){return t?e!=null&&e.packageUrl?e.signature?h("settings.releaseUpdateReady"):h("settings.releaseSignatureMissing"):h("settings.releaseInstallerMissing"):h("settings.releaseUpToDate")}function hB(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}async function fB(){const e=cn.getState();return Xe.request(`/api/client/service-update?channel=${encodeURIComponent(e.releaseChannel)}`)}function VS(){const e=si(),[t,n]=w.useState(!1),[s,o]=w.useState(!1),[c,l]=w.useState(null),[d,p]=w.useState(null);async function m(){n(!0),l(null);try{const g=await fB();p(g),l(pB(g)),g.hasUpdate&&await e.bridge.showNotification(h("settings.serverUpdateReady"),`${h("settings.serverTargetVersion")}: ${g.latestVersion??"-"}`)}catch(g){l(g instanceof Error?g.message:h("settings.serverCheckFailed"))}finally{n(!1)}}async function y(){if(d!=null&&d.packagePageUrl){o(!0);try{const g=await e.bridge.openExternal(d.packagePageUrl);g.ok||l(g.detail??h("settings.serverOpenPageFailed"))}catch(g){l(g instanceof Error?g.message:h("settings.serverOpenPageFailed"))}finally{o(!1)}}}return i.jsxs("div",{className:"settings-release-card",children:[i.jsxs("div",{className:"settings-release-meta",children:[i.jsxs("span",{children:[h("settings.serverCurrentVersion"),": ",(d==null?void 0:d.currentVersion)??"-"]}),i.jsxs("span",{children:[h("settings.serverTargetVersion"),": ",(d==null?void 0:d.latestVersion)??h("settings.serverLatestUnknown")]}),i.jsxs("span",{children:[h("settings.serverPackageName"),": ",(d==null?void 0:d.packageName)??"-"]})]}),d?i.jsxs("div",{className:"settings-release-notes",children:[i.jsx("strong",{children:h("settings.serverUpdateCommand")}),i.jsx("p",{className:"settings-release-command",children:d.updateCommand})]}):null,c?i.jsx("p",{className:"settings-release-status",children:c}):null,i.jsxs("div",{className:"settings-release-actions",children:[i.jsx("button",{className:"secondary-button",type:"button",disabled:t,onClick:m,children:h(t?"common.loading":"settings.serverCheckNow")}),i.jsx("button",{className:"secondary-button",type:"button",disabled:!(d!=null&&d.packagePageUrl)||t||s,onClick:y,children:h(s?"common.loading":"settings.serverOpenPage")})]})]})}function pB(e){return e.latestVersion?e.hasUpdate?h("settings.serverUpdateReady"):h("settings.serverUpToDate"):h("settings.serverLatestUnknown")}function Xw({title:e,description:t,actions:n,content:s,className:o}){return i.jsx(dS,{className:o,children:i.jsxs("section",{className:"mobile-workspace-home-header mobile-page-header",children:[i.jsx("h1",{className:"mobile-workspace-switcher-heading",children:e}),i.jsxs("div",{className:"mobile-workspace-home-toolbar-top mobile-page-header-main",children:[i.jsx("div",{className:"mobile-page-header-copy",children:i.jsx("div",{className:"mobile-workspace-home-switcher mobile-page-header-static-title",children:i.jsx("span",{className:"mobile-workspace-home-switcher-label",children:e})})}),n?i.jsx("div",{className:"mobile-workspace-home-toolbar-actions mobile-page-header-actions",children:n}):null]}),t?i.jsx("p",{className:"mobile-workspace-home-path mobile-page-header-description",children:t}):null,s?i.jsx("div",{className:"mobile-page-header-content",children:s}):null]})})}function mB(e){return e==="appearance"||e==="server-connection"||e==="security-privacy"||e==="software-update"}function Jw(e){return h(e==="en-US"?"locale.enUS":"locale.zhCN")}function Zw(e){return h(e==="beta"?"settings.releaseBeta":"settings.releaseStable")}function eb(e){switch(e){case"acceptEdits":return h("settings.permissionModeAcceptEdits");case"bypassPermissions":return h("settings.permissionModeBypassPermissions");default:return h("settings.permissionModeDefault")}}function gB(){const e=Mn(),{theme:t,setTheme:n}=Ub(),s=Rc(E=>E),o=ar(),c=cf(s.platform),l=c,[d,p]=w.useState(s.hostBaseUrl);w.useEffect(()=>{p(s.hostBaseUrl)},[s.hostBaseUrl]);function m(){Sn.clear(),e("/login",{replace:!0})}function y(E){try{return mi(E)}catch{return null}}const g=y(d),b=g!==null&&g!==s.hostBaseUrl;function x(E){E.preventDefault(),g&&cn.update({hostBaseUrl:g})}const C=[{value:"default",label:h("settings.permissionModeDefault")},{value:"acceptEdits",label:h("settings.permissionModeAcceptEdits")},{value:"bypassPermissions",label:h("settings.permissionModeBypassPermissions")}];function S(E){cn.update({releaseChannel:E==="beta"?"beta":"stable"})}function j(E){cn.update({autoReconnect:E})}function M(E){cn.update({autoCheckUpdate:E})}function A(E){cn.update({defaultPermissionMode:E==="acceptEdits"||E==="bypassPermissions"?E:"default"})}return{platform:o,theme:t,setTheme:n,runtimeConfig:s,showServerSettings:l,canConfigureServerAddress:c,hostBaseUrlDraft:d,setHostBaseUrlDraft:p,canSaveHostBaseUrl:b,permissionModeOptions:C,handleHostBaseUrlSubmit:x,handleLogout:m,updateReleaseChannel:S,updateAutoReconnect:j,updateAutoCheckUpdate:M,updateDefaultPermissionMode:A}}function tb(){const e=gB();return e.platform.isMobile?i.jsx(vB,{model:e}):i.jsx(yB,{model:e})}function yB({model:e}){const{theme:t,setTheme:n,runtimeConfig:s,showServerSettings:o,hostBaseUrlDraft:c,setHostBaseUrlDraft:l,canSaveHostBaseUrl:d,permissionModeOptions:p,platform:m,handleHostBaseUrlSubmit:y,handleLogout:g,updateReleaseChannel:b,updateAutoReconnect:x,updateAutoCheckUpdate:C,updateDefaultPermissionMode:S}=e;return i.jsx("div",{className:"settings-page",children:i.jsxs("div",{className:"settings-container",children:[i.jsx("h1",{className:"settings-title",children:h("settings.title")}),i.jsxs("section",{className:"settings-section",children:[i.jsx("h2",{className:"settings-section-title",children:h("settings.appearance")}),i.jsxs("div",{className:"settings-card",children:[i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.language")}),i.jsx("span",{className:"settings-row-description",children:h("settings.languageDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsx(vf,{})})]}),i.jsxs("div",{className:"settings-row settings-row-theme",children:[i.jsx("div",{className:"settings-row-label",children:i.jsx("span",{className:"settings-row-title",children:h("settings.theme")})}),i.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:i.jsx("div",{className:"theme-selector",children:Ac.map(j=>i.jsxs("button",{type:"button",className:`theme-card ${t===j.id?"active":""}`,"aria-pressed":t===j.id,onClick:()=>n(j.id),children:[i.jsx("span",{className:"theme-preview",style:{background:j.color}}),i.jsx("span",{className:"theme-label",children:Fb(j)}),t===j.id?i.jsx("span",{className:"theme-check",children:"✓"}):null]},j.id))})})]})]})]}),o?i.jsxs("section",{className:"settings-section",children:[i.jsx("h2",{className:"settings-section-title",children:h("settings.serverConnection")}),i.jsxs("div",{className:"settings-card",children:[i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.serverAddress")}),i.jsx("span",{className:"settings-row-description",children:h("settings.serverDescription")})]}),i.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:i.jsxs("form",{className:"settings-inline-form",onSubmit:y,children:[i.jsx("input",{"aria-label":h("settings.serverAddress"),className:"settings-text-input",value:c,onChange:j=>l(j.target.value)}),i.jsx("button",{className:"settings-button",disabled:!d,type:"submit",children:h("common.save")})]})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.autoReconnect")}),i.jsx("span",{className:"settings-row-description",children:h("settings.autoReconnectDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("label",{className:"settings-checkbox",children:[i.jsx("input",{type:"checkbox",checked:s.autoReconnect,onChange:j=>x(j.target.checked)}),i.jsx("span",{children:s.autoReconnect?h("settings.enabled"):h("settings.disabled")})]})})]})]})]}):null,i.jsxs("section",{className:"settings-section",children:[i.jsx("h2",{className:"settings-section-title",children:h("settings.securityPrivacy")}),i.jsx("div",{className:"settings-card",children:i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.defaultPermissionMode")}),i.jsx("span",{className:"settings-row-description",children:h("settings.defaultPermissionModeDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsx("select",{"aria-label":h("settings.defaultPermissionMode"),className:"settings-select",value:s.defaultPermissionMode,onChange:j=>S(j.target.value),children:p.map(j=>i.jsx("option",{value:j.value,children:j.label},j.value))})})]})})]}),i.jsxs("section",{className:"settings-section",children:[i.jsx("h2",{className:"settings-section-title",children:h("settings.softwareUpdate")}),i.jsxs("div",{className:"settings-card",children:[i.jsxs("div",{className:"settings-row",children:[i.jsxs("div",{className:"settings-row-label",children:[i.jsx("span",{className:"settings-row-title",children:h("settings.releaseChannel")}),i.jsx("span",{className:"settings-row-description",children:h("settings.releaseChannelDescription")})]}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("select",{"aria-label":h("settings.releaseChannel"),className:"settings-select",value:s.releaseChannel,onChange:j=>b(j.target.value),children:[i.jsx("option",{value:"stable",children:h("settings.releaseStable")}),i.jsx("option",{value:"beta",children:h("settings.releaseBeta")})]})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsx("div",{className:"settings-row-label",children:i.jsx("span",{className:"settings-row-title",children:h("settings.serverUpdate")})}),i.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:i.jsx(VS,{})})]}),m.isWeb?null:i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"settings-row",children:[i.jsx("div",{className:"settings-row-label",children:i.jsx("span",{className:"settings-row-title",children:h("settings.autoCheckUpdate")})}),i.jsx("div",{className:"settings-row-control",children:i.jsxs("label",{className:"settings-checkbox",children:[i.jsx("input",{type:"checkbox",checked:s.autoCheckUpdate,onChange:j=>C(j.target.checked)}),i.jsx("span",{children:s.autoCheckUpdate?h("settings.enabled"):h("settings.disabled")})]})})]}),i.jsxs("div",{className:"settings-row",children:[i.jsx("div",{className:"settings-row-label",children:i.jsx("span",{className:"settings-row-title",children:h("settings.clientUpdate")})}),i.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:i.jsx($S,{})})]})]})]})]}),i.jsxs("div",{className:"settings-footer settings-footer-with-logout",children:[i.jsx("span",{className:"settings-version",children:"CodingNS v1.0.0"}),i.jsx("button",{className:"settings-button settings-button-danger settings-button-sticky",onClick:g,type:"button",children:h("common.logout")})]})]})})}function vB({model:e}){const t=Mn(),{section:n}=yf(),s=mB(n)?n:null,o=e.showServerSettings?[{id:"appearance",title:h("settings.appearance"),description:h("settings.appearanceSectionSummary"),value:Jw(e.runtimeConfig.language),icon:i.jsx(rb,{})},{id:"server-connection",title:h("settings.serverConnection"),description:h("settings.serverConnectionSectionSummary"),value:e.runtimeConfig.hostBaseUrl,icon:i.jsx(SB,{})},{id:"security-privacy",title:h("settings.securityPrivacy"),description:h("settings.securityPrivacySectionSummary"),value:eb(e.runtimeConfig.defaultPermissionMode),icon:i.jsx(sb,{})},{id:"software-update",title:h("settings.softwareUpdate"),description:h("settings.softwareUpdateSectionSummary"),value:Zw(e.runtimeConfig.releaseChannel),icon:i.jsx(ib,{})}]:[{id:"appearance",title:h("settings.appearance"),description:h("settings.appearanceSectionSummary"),value:Jw(e.runtimeConfig.language),icon:i.jsx(rb,{})},{id:"security-privacy",title:h("settings.securityPrivacy"),description:h("settings.securityPrivacySectionSummary"),value:eb(e.runtimeConfig.defaultPermissionMode),icon:i.jsx(sb,{})},{id:"software-update",title:h("settings.softwareUpdate"),description:h("settings.softwareUpdateSectionSummary"),value:Zw(e.runtimeConfig.releaseChannel),icon:i.jsx(ib,{})}];return(s?o.find(l=>l.id===s)??null:null)?i.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[i.jsx(Xw,{title:h("settings.title")}),i.jsxs("div",{className:"settings-mobile-container",children:[s==="appearance"?i.jsx(wB,{model:e}):null,s==="server-connection"&&e.showServerSettings?i.jsx(bB,{model:e}):null,s==="security-privacy"?i.jsx(xB,{model:e}):null,s==="software-update"?i.jsx(kB,{model:e}):null]}),i.jsx(nb,{onLogout:e.handleLogout})]}):i.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[i.jsx(Xw,{title:h("settings.title")}),i.jsxs("div",{className:"settings-mobile-container",children:[i.jsx("section",{className:"settings-mobile-group-section",children:i.jsx("div",{className:"settings-mobile-card",children:o.map(l=>i.jsxs("button",{type:"button",className:"settings-mobile-nav-row",onClick:()=>t(`/settings/${l.id}`),children:[i.jsx("span",{className:"settings-mobile-nav-icon",children:l.icon}),i.jsxs("span",{className:"settings-mobile-nav-copy",children:[i.jsx("span",{className:"settings-mobile-nav-title",children:l.title}),i.jsx("span",{className:"settings-mobile-nav-description",children:l.description})]}),i.jsxs("span",{className:"settings-mobile-nav-trailing",children:[l.value?i.jsx("span",{className:"settings-mobile-nav-value",children:l.value}):null,i.jsx(CB,{})]})]},l.id))})}),i.jsx("div",{className:"settings-footer settings-footer-mobile",children:i.jsx("span",{className:"settings-version",children:"CodingNS v1.0.0"})})]}),i.jsx(nb,{onLogout:e.handleLogout})]})}function wB({model:e}){return i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.language")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.languageDescription")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsx("div",{className:"settings-mobile-row-copy",children:i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.language")})}),i.jsx(vf,{variant:"compact",className:"settings-mobile-language-switcher"})]})})]}),i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.theme")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.themeDescription")}),i.jsx("div",{className:"settings-mobile-card",children:Ac.map(t=>{const n=e.theme===t.id;return i.jsxs("button",{type:"button",className:`settings-mobile-choice-row${n?" active":""}`,"aria-pressed":n,onClick:()=>e.setTheme(t.id),children:[i.jsxs("span",{className:"settings-mobile-choice-leading",children:[i.jsx("span",{className:"settings-mobile-choice-dot",style:{background:t.color},"aria-hidden":"true"}),i.jsx("span",{className:"settings-mobile-choice-label",children:Fb(t)})]}),i.jsx("span",{className:"settings-mobile-choice-indicator","aria-hidden":"true",children:n?i.jsx(jB,{}):null})]},t.id)})})]})]})}function bB({model:e}){return i.jsxs(i.Fragment,{children:[e.canConfigureServerAddress?i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.serverAddress")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.serverDescription")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("form",{className:"settings-mobile-form-stack",onSubmit:e.handleHostBaseUrlSubmit,children:[i.jsx("input",{"aria-label":h("settings.serverAddress"),className:"settings-text-input settings-mobile-input",value:e.hostBaseUrlDraft,onChange:t=>e.setHostBaseUrlDraft(t.target.value)}),i.jsx("button",{className:"settings-mobile-primary-button",disabled:!e.canSaveHostBaseUrl,type:"submit",children:h("common.save")})]})})]}):null,i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.serverConnection")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.autoReconnect")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.autoReconnectDescription")})]}),i.jsx(qS,{checked:e.runtimeConfig.autoReconnect,label:h("settings.autoReconnect"),onChange:e.updateAutoReconnect})]})})]})]})}function xB({model:e}){return i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.securityPrivacy")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.securityPrivacySectionSummary")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.defaultPermissionMode")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.defaultPermissionModeDescription")})]}),i.jsx("select",{"aria-label":h("settings.defaultPermissionMode"),className:"settings-select settings-mobile-select",value:e.runtimeConfig.defaultPermissionMode,onChange:t=>e.updateDefaultPermissionMode(t.target.value),children:e.permissionModeOptions.map(t=>i.jsx("option",{value:t.value,children:t.label},t.value))})]})})]})}function kB({model:e}){return i.jsxs(i.Fragment,{children:[i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.softwareUpdate")}),i.jsx("p",{className:"settings-mobile-group-note",children:h("settings.softwareUpdateSectionSummary")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsxs("div",{className:"settings-mobile-row-copy",children:[i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.releaseChannel")}),i.jsx("span",{className:"settings-mobile-row-description",children:h("settings.releaseChannelDescription")})]}),i.jsxs("select",{"aria-label":h("settings.releaseChannel"),className:"settings-select settings-mobile-select",value:e.runtimeConfig.releaseChannel,onChange:t=>e.updateReleaseChannel(t.target.value),children:[i.jsx("option",{value:"stable",children:h("settings.releaseStable")}),i.jsx("option",{value:"beta",children:h("settings.releaseBeta")})]})]})})]}),i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.serverUpdate")}),i.jsx("div",{className:"settings-mobile-card settings-mobile-release-card",children:i.jsx(VS,{})})]}),e.platform.isWeb?null:i.jsxs("section",{className:"settings-mobile-group-section",children:[i.jsx("h2",{className:"settings-mobile-group-title",children:h("settings.clientUpdate")}),i.jsx("div",{className:"settings-mobile-card",children:i.jsxs("div",{className:"settings-mobile-form-row",children:[i.jsx("div",{className:"settings-mobile-row-copy",children:i.jsx("span",{className:"settings-mobile-row-title",children:h("settings.autoCheckUpdate")})}),i.jsx(qS,{checked:e.runtimeConfig.autoCheckUpdate,label:h("settings.autoCheckUpdate"),onChange:e.updateAutoCheckUpdate})]})}),i.jsx("div",{className:"settings-mobile-card settings-mobile-release-card",children:i.jsx($S,{})})]})]})}function nb({onLogout:e}){return i.jsx("div",{className:"settings-mobile-sticky-footer",children:i.jsx("button",{type:"button",className:"settings-mobile-danger-button settings-mobile-danger-button-sticky",onClick:e,children:h("common.logout")})})}function qS({checked:e,label:t,onChange:n}){return i.jsxs("label",{className:"settings-mobile-switch","aria-label":t,children:[i.jsx("input",{type:"checkbox",checked:e,onChange:s=>n(s.target.checked)}),i.jsx("span",{className:"settings-mobile-switch-track","aria-hidden":"true",children:i.jsx("span",{className:"settings-mobile-switch-thumb"})})]})}function rb(){return i.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[i.jsx("path",{d:"M10 3.5a6.5 6.5 0 1 0 6.5 6.5c0-.8-.6-1.4-1.4-1.4h-1.6A1.5 1.5 0 0 1 12 7.1V5.5c0-1.1-.9-2-2-2Z"}),i.jsx("circle",{cx:"6.6",cy:"9.2",r:".8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"8.8",cy:"6.8",r:".8",fill:"currentColor",stroke:"none"}),i.jsx("circle",{cx:"12.1",cy:"6.6",r:".8",fill:"currentColor",stroke:"none"})]})}function SB(){return i.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[i.jsx("path",{d:"M4 7.5 10 4l6 3.5v5L10 16l-6-3.5v-5Z"}),i.jsx("path",{d:"M10 9.5V16"}),i.jsx("path",{d:"M4 7.5 10 11l6-3.5"})]})}function ib(){return i.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[i.jsx("rect",{x:"3.5",y:"4",width:"13",height:"9.5",rx:"2.2"}),i.jsx("path",{d:"M7 16h6"}),i.jsx("path",{d:"M10 13.5V16"}),i.jsx("path",{d:"m8 8 2 2 3-3"})]})}function sb(){return i.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[i.jsx("path",{d:"M10 3.2 15 5v4.4c0 3-1.9 5.8-5 7.4-3.1-1.6-5-4.4-5-7.4V5l5-1.8Z"}),i.jsx("path",{d:"m8.3 9.8 1.2 1.2 2.4-2.5"})]})}function CB(){return i.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:i.jsx("path",{d:"m4 2 4 4-4 4"})})}function jB(){return i.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:i.jsx("path",{d:"m3.5 8.2 2.6 2.6 6-6"})})}function NB(){const e=Yb(n=>n.session),t=Qr();if(!e){const n=`${t.pathname}${t.search}`;return i.jsx(Ao,{to:`/login?returnTo=${encodeURIComponent(n)}`,replace:!0})}return i.jsx(Mh,{})}function ab(){const{shellMode:e}=lr();return i.jsx(Ao,{to:e==="mobile"?"/workspaces":"/landing",replace:!0})}const TB=[{path:"/bootstrap",element:i.jsx(CN,{})},{path:"/login",element:i.jsx(IN,{})},{path:"/",element:i.jsx(NB,{}),children:[{element:i.jsx(iB,{}),children:[{index:!0,element:i.jsx(ab,{})},{path:"landing",element:i.jsx(oB,{})},{path:"workspaces",element:i.jsx(KO,{})},{path:"workspaces/:workspaceId",element:i.jsx(XO,{})},{path:"workspaces/:workspaceId/sessions",element:i.jsx(Y_,{})},{path:"workspaces/:workspaceId/sessions/:sessionId",element:i.jsx(T_,{})},{path:"workspaces/:workspaceId/tools",element:i.jsx(HO,{})},{path:"workspaces/:workspaceId/tools/files",element:i.jsx(X_,{})},{path:"workspaces/:workspaceId/tools/git",element:i.jsx(J_,{})},{path:"workspaces/:workspaceId/tools/processes",element:i.jsx(vF,{})},{path:"workspaces/:workspaceId/terminals",lazy:async()=>({Component:(await Ic(()=>import("./TerminalPage-Dj_VDew3.js"),__vite__mapDeps([0,1]))).TerminalPage})},{path:"settings",element:i.jsx(tb,{})},{path:"settings/:section",element:i.jsx(tb,{})},{path:"*",element:i.jsx(ab,{})}]}]}];function PB(){return kj(TB)}function EB(){const e=Rc(n=>n.language),t=w.useMemo(()=>PB(),[]);return i.jsx(Fj,{children:i.jsx($j,{language:e,children:i.jsx(Xj,{children:i.jsx(tN,{children:i.jsx(Mj,{router:t})})})})})}n1().finally(()=>{I0.createRoot(document.getElementById("root")).render(i.jsx(EB,{}))});export{Ik as C,ga as M,rF as T,Sn as a,Fr as b,Wf as c,Mn as d,yf as e,lr as f,Kb as g,Gn as h,AB as i,Cn as j,i as k,tF as l,FB as m,yw as n,_B as o,qn as p,IB as q,w as r,Hf as s,h as t,ar as u,DB as v,br as w,LB as x,nF as y,MB as z};