@piagent/platform 1.37.1 → 1.38.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 (283) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +5 -3
  3. package/README.vi.md +2 -2
  4. package/catalog/capabilities.json +2 -2
  5. package/docs/command-reference-vietnamese.md +4 -3
  6. package/docs/distribution-standard.md +6 -6
  7. package/docs/en/maintainer-guide.md +8 -0
  8. package/docs/en/workspace-editor.md +222 -0
  9. package/docs/languages.json +13 -4
  10. package/docs/operator-manual-vietnamese.md +7 -7
  11. package/docs/publishing-for-teams.md +3 -0
  12. package/docs/release-install-policy.md +2 -2
  13. package/docs/research/ide-m0-spike.md +101 -0
  14. package/docs/team-onboarding.md +2 -2
  15. package/docs/vi/maintainer-guide.md +8 -0
  16. package/docs/vi/workspace-editor.md +217 -0
  17. package/docs-site/architecture.html +1 -1
  18. package/docs-site/benchmark.html +1 -1
  19. package/docs-site/commands.html +1 -1
  20. package/docs-site/content/en/index.html +4 -4
  21. package/docs-site/content/en/whats-new.html +23 -0
  22. package/docs-site/content/index.html +4 -4
  23. package/docs-site/content/whats-new.html +23 -0
  24. package/docs-site/context-engine.html +1 -1
  25. package/docs-site/ecosystem.html +1 -1
  26. package/docs-site/en/architecture.html +1 -1
  27. package/docs-site/en/benchmark.html +1 -1
  28. package/docs-site/en/commands.html +1 -1
  29. package/docs-site/en/context-engine.html +1 -1
  30. package/docs-site/en/ecosystem.html +1 -1
  31. package/docs-site/en/index.html +5 -5
  32. package/docs-site/en/mcp-approval.html +1 -1
  33. package/docs-site/en/mcp-auth.html +1 -1
  34. package/docs-site/en/mcp-servers.html +1 -1
  35. package/docs-site/en/mcp.html +1 -1
  36. package/docs-site/en/permissions.html +1 -1
  37. package/docs-site/en/profiles.html +1 -1
  38. package/docs-site/en/quickstart.html +1 -1
  39. package/docs-site/en/runtime.html +1 -1
  40. package/docs-site/en/scope.html +1 -1
  41. package/docs-site/en/security.html +1 -1
  42. package/docs-site/en/team.html +1 -1
  43. package/docs-site/en/whats-new.html +24 -1
  44. package/docs-site/en/windows.html +1 -1
  45. package/docs-site/en/workflows.html +1 -1
  46. package/docs-site/index.html +5 -5
  47. package/docs-site/mcp-approval.html +1 -1
  48. package/docs-site/mcp-auth.html +1 -1
  49. package/docs-site/mcp-servers.html +1 -1
  50. package/docs-site/mcp.html +1 -1
  51. package/docs-site/permissions.html +1 -1
  52. package/docs-site/profiles.html +1 -1
  53. package/docs-site/quickstart.html +1 -1
  54. package/docs-site/runtime.html +1 -1
  55. package/docs-site/scope.html +1 -1
  56. package/docs-site/security.html +1 -1
  57. package/docs-site/team.html +1 -1
  58. package/docs-site/whats-new.html +24 -1
  59. package/docs-site/windows.html +1 -1
  60. package/docs-site/workflows.html +1 -1
  61. package/evals/fixtures/piagent-webui/checkpoint-v1.invalid.json +21 -0
  62. package/evals/fixtures/piagent-webui/checkpoint-v1.valid.json +20 -0
  63. package/evals/fixtures/piagent-webui/terminal-v1.invalid.json +17 -0
  64. package/evals/fixtures/piagent-webui/terminal-v1.valid.json +16 -0
  65. package/evals/fixtures/piagent-webui/workspace-file-v1.invalid.json +24 -0
  66. package/evals/fixtures/piagent-webui/workspace-file-v1.valid.json +23 -0
  67. package/evals/fixtures/piagent-webui/workspace-paths-v1.invalid.json +24 -0
  68. package/evals/fixtures/piagent-webui/workspace-paths-v1.valid.json +24 -0
  69. package/evals/fixtures/piagent-webui/workspace-search-v1.invalid.json +26 -0
  70. package/evals/fixtures/piagent-webui/workspace-search-v1.valid.json +26 -0
  71. package/evals/fixtures/piagent-webui/workspace-tree-v1.invalid.json +28 -0
  72. package/evals/fixtures/piagent-webui/workspace-tree-v1.valid.json +27 -0
  73. package/evals/fixtures/piagent-webui/workspace-write-v1.invalid.json +19 -0
  74. package/evals/fixtures/piagent-webui/workspace-write-v1.valid.json +19 -0
  75. package/evals/long-task-soak-v1/README.md +17 -0
  76. package/evals/long-task-soak-v1/lib/session-loop.mjs +19 -3
  77. package/evals/long-task-soak-v1/scenarios/ide-editor-terminal.json +19 -0
  78. package/evals/long-task-soak-v1/surfaces/webui-gateway.mjs +17 -2
  79. package/evals/long-task-soak-v1/surfaces/workspace-actions.mjs +95 -0
  80. package/evals/private-holdout-v1/public-exposure.v2.json +2 -2
  81. package/package.json +7 -3
  82. package/packages/piagent-core/extensions/fallback-base-policy.ts +1 -1
  83. package/packages/piagent-core/extensions/guard-types.ts +3 -1
  84. package/packages/piagent-core/extensions/path-suggestions.ts +137 -0
  85. package/packages/piagent-core/extensions/piagent-guard.ts +85 -7
  86. package/packages/piagent-core/extensions/workspace-inspection.ts +145 -0
  87. package/packages/piagent-core/extensions/workspace-policy.d.ts +7 -0
  88. package/packages/piagent-core/extensions/workspace-policy.js +3 -0
  89. package/packages/piagent-core/extensions/workspace-search-index.mjs +8 -0
  90. package/packages/piagent-core/extensions/workspace-search.ts +74 -0
  91. package/packages/piagent-core/extensions/workspace-write.ts +116 -0
  92. package/packages/piagent-core/managed/background-process.mjs +9 -4
  93. package/packages/piagent-core/managed/boundary-package-proxy.mjs +21 -0
  94. package/packages/piagent-core/managed/boundary-queue.mjs +24 -0
  95. package/packages/piagent-core/managed/checkpoint-git.mjs +16 -0
  96. package/packages/piagent-core/managed/checkpoints.mjs +17 -64
  97. package/packages/piagent-core/managed/command-tools.mjs +6 -6
  98. package/packages/piagent-core/managed/continuation.mjs +3 -0
  99. package/packages/piagent-core/managed/dist/workspace/assets/adapters/backend-api/profile.json +88 -0
  100. package/packages/piagent-core/managed/dist/workspace/assets/adapters/be-readonly-fe/profile.json +130 -0
  101. package/packages/piagent-core/managed/dist/workspace/assets/adapters/data/profile.json +88 -0
  102. package/packages/piagent-core/managed/dist/workspace/assets/adapters/devops/profile.json +90 -0
  103. package/packages/piagent-core/managed/dist/workspace/assets/adapters/docs/profile.json +74 -0
  104. package/packages/piagent-core/managed/dist/workspace/assets/adapters/fullstack/profile.json +92 -0
  105. package/packages/piagent-core/managed/dist/workspace/assets/adapters/generic/profile.json +95 -0
  106. package/packages/piagent-core/managed/dist/workspace/assets/adapters/mobile/profile.json +86 -0
  107. package/packages/piagent-core/managed/dist/workspace/assets/adapters/node-typescript/profile.json +74 -0
  108. package/packages/piagent-core/managed/dist/workspace/assets/adapters/python/profile.json +75 -0
  109. package/packages/piagent-core/managed/dist/workspace/assets/adapters/web-frontend/profile.json +99 -0
  110. package/packages/piagent-core/managed/dist/workspace/assets/local-state-path-BrmghxEZ.js +284 -0
  111. package/packages/piagent-core/managed/dist/workspace/assets/packages/piagent-core/policies/base-policy.json +351 -0
  112. package/packages/piagent-core/managed/dist/workspace/manifest.json +65 -0
  113. package/packages/piagent-core/managed/dist/workspace/worker.mjs +7374 -0
  114. package/packages/piagent-core/managed/dist/workspace/workspace-search-index.mjs +1007 -0
  115. package/packages/piagent-core/managed/patch-snapshot.mjs +6 -8
  116. package/packages/piagent-core/managed/permission.mjs +29 -6
  117. package/packages/piagent-core/managed/repository-operation.mjs +2 -1
  118. package/packages/piagent-core/managed/review-snapshot-request.mjs +21 -0
  119. package/packages/piagent-core/managed/sandbox-diagnostic.mjs +2 -0
  120. package/packages/piagent-core/managed/session-mutation-observations.mjs +37 -0
  121. package/packages/piagent-core/managed/session.mjs +2 -2
  122. package/packages/piagent-core/managed/source-revert-requests.mjs +21 -0
  123. package/packages/piagent-core/managed/terminal-boundary.mjs +88 -0
  124. package/packages/piagent-core/managed/terminal-channel.mjs +66 -0
  125. package/packages/piagent-core/managed/terminal-runtime.mjs +64 -0
  126. package/packages/piagent-core/managed/terminal-seatbelt.mjs +48 -0
  127. package/packages/piagent-core/managed/terminal-worker.mjs +70 -0
  128. package/packages/piagent-core/managed/tool-boundary.mjs +45 -35
  129. package/packages/piagent-core/managed/tool-freshness.mjs +47 -0
  130. package/packages/piagent-core/managed/tool-worker.mjs +18 -3
  131. package/packages/piagent-core/managed/workspace-worker-pins.mjs +26 -0
  132. package/packages/piagent-core/package.json +1 -1
  133. package/packages/piagent-core/policies/base-policy.json +2 -1
  134. package/packages/piagent-core/runtime/checkpoints/checkpoint-authority.ts +43 -0
  135. package/packages/piagent-core/runtime/checkpoints/checkpoint-refs.mjs +51 -0
  136. package/packages/piagent-core/runtime/checkpoints/checkpoint-store.mjs +179 -0
  137. package/packages/piagent-core/runtime/checkpoints/checkpoint-worker.ts +28 -0
  138. package/packages/piagent-core/runtime/checkpoints/git-adapter.mjs +36 -0
  139. package/packages/piagent-core/runtime/checkpoints/persistent-history.mjs +96 -0
  140. package/packages/piagent-core/runtime/checkpoints/personal-git.ts +272 -0
  141. package/packages/piagent-core/runtime/checkpoints/personal-runtime.ts +158 -0
  142. package/packages/piagent-core/runtime/checkpoints/prune.mjs +29 -0
  143. package/packages/piagent-core/runtime/checkpoints/restore-preview.mjs +46 -0
  144. package/packages/piagent-core/runtime/checkpoints/turn-checkpoints.mjs +167 -0
  145. package/packages/piagent-core/runtime/hooks/session-hooks.ts +19 -16
  146. package/packages/piagent-core/runtime/hooks/session-start-hook.ts +3 -0
  147. package/packages/piagent-core/runtime/hooks/tool-call-hook.ts +2 -2
  148. package/packages/piagent-core/runtime/inspection/diff-projection.ts +2 -1
  149. package/packages/piagent-core/runtime/inspection/managed-source-revert.ts +90 -0
  150. package/packages/piagent-core/runtime/inspection/review-state-projection.ts +19 -8
  151. package/packages/piagent-core/runtime/inspection/session-diff-projection.ts +47 -0
  152. package/packages/piagent-core/runtime/inspection/session-hunk-provenance.ts +56 -0
  153. package/packages/piagent-core/runtime/inspection/session-mutation-observer.ts +125 -0
  154. package/packages/piagent-core/runtime/inspection/source-action-contract.ts +123 -0
  155. package/packages/piagent-core/runtime/inspection/source-change-projection.ts +3 -9
  156. package/packages/piagent-core/runtime/inspection/source-mutation-projection.ts +3 -41
  157. package/packages/piagent-core/runtime/inspection/source-mutation-store.ts +6 -36
  158. package/packages/piagent-core/runtime/inspection/source-revert-projection.ts +36 -30
  159. package/packages/piagent-core/runtime/inspection/text-diff.ts +5 -4
  160. package/packages/piagent-core/runtime/inspection/workspace-worker.ts +79 -0
  161. package/packages/piagent-core/runtime/policy/source-index-transaction.ts +3 -10
  162. package/packages/piagent-core/runtime/policy/source-mutation-guard-binding.ts +27 -2
  163. package/packages/piagent-core/runtime/policy/source-mutation-guard.ts +42 -12
  164. package/packages/piagent-core/runtime/policy/source-worktree-transaction.ts +10 -5
  165. package/packages/piagent-core/runtime/policy/workspace-write-authority.ts +51 -0
  166. package/packages/piagent-core/runtime/process-owner.mjs +20 -0
  167. package/packages/piagent-core/runtime/process-tree-watch.mjs +46 -0
  168. package/packages/piagent-core/runtime/quality/model-mutation-proof.ts +8 -5
  169. package/packages/piagent-core/runtime/registration/permission-commands.ts +10 -2
  170. package/packages/piagent-core/runtime/registration/task-evidence-tools.ts +1 -1
  171. package/packages/piagent-core/runtime/session/workspace-member-edits.d.mts +7 -0
  172. package/packages/piagent-core/runtime/session/workspace-member-edits.mjs +41 -0
  173. package/packages/piagent-core/security/workspace-file-reader.ts +2 -1
  174. package/packages/piagent-webui/dist/client/assets/Alert-DGWhP2MM.js +1 -0
  175. package/packages/piagent-webui/dist/client/assets/Button-QItfZUNj.js +1 -0
  176. package/packages/piagent-webui/dist/client/assets/DialogTitle-CyaFPaiW.js +3 -0
  177. package/packages/piagent-webui/dist/client/assets/MarkdownMessage-DtEwqme0.js +29 -0
  178. package/packages/piagent-webui/dist/client/assets/TerminalPanel-C3vkzjQ6.js +2 -0
  179. package/packages/piagent-webui/dist/client/assets/TerminalView-TNjhBGfa.js +9 -0
  180. package/packages/piagent-webui/dist/client/assets/TerminalView-kHJ-D0s7.css +1 -0
  181. package/packages/piagent-webui/dist/client/assets/Typography-B9om7Evq.js +1 -0
  182. package/packages/piagent-webui/dist/client/assets/WorkspaceCodeEditor-BAhYwQNM.js +2 -0
  183. package/packages/piagent-webui/dist/client/assets/WorkspaceExplorer-Coh_GWCO.js +5 -0
  184. package/packages/piagent-webui/dist/client/assets/WorkspaceQuickOpen-Bn4miZq4.js +1 -0
  185. package/packages/piagent-webui/dist/client/assets/bootstrap-CedkNtRG.js +1 -0
  186. package/packages/piagent-webui/dist/client/assets/dist-B5MCHZv5.js +9 -0
  187. package/packages/piagent-webui/dist/client/assets/dist-BM_LL1o9.js +1 -0
  188. package/packages/piagent-webui/dist/client/assets/dist-C2TMLUTo.js +23 -0
  189. package/packages/piagent-webui/dist/client/assets/dist-CqL3udNu.js +1 -0
  190. package/packages/piagent-webui/dist/client/assets/dist-D4df0jLQ.js +1 -0
  191. package/packages/piagent-webui/dist/client/assets/dist-D6i5SpQu.js +10 -0
  192. package/packages/piagent-webui/dist/client/assets/dist-DfjUS8LS.js +6 -0
  193. package/packages/piagent-webui/dist/client/assets/dist-IRUjhd1P.js +1 -0
  194. package/packages/piagent-webui/dist/client/assets/dist-sNhoSseW.js +1 -0
  195. package/packages/piagent-webui/dist/client/assets/index-Brs_HjIo.css +1 -0
  196. package/packages/piagent-webui/dist/client/assets/index-a-perpOX.js +102 -0
  197. package/packages/piagent-webui/dist/client/assets/rolldown-runtime-hePW80VL.js +1 -0
  198. package/packages/piagent-webui/dist/client/assets/tab-close-nAxrK7Lq.js +1 -0
  199. package/packages/piagent-webui/dist/client/assets/ui-preferences-BO3AV7QE.js +10 -0
  200. package/packages/piagent-webui/dist/client/assets/useId-DEefKUAT.js +124 -0
  201. package/packages/piagent-webui/dist/client/assets/workspace-api-O7auv_td.js +1 -0
  202. package/packages/piagent-webui/dist/client/index.html +10 -2
  203. package/packages/piagent-webui/extension/same-session-bridge.ts +2 -3
  204. package/packages/piagent-webui/extension/source-revert-controller.ts +14 -208
  205. package/packages/piagent-webui/gateway/checkpoint-sessions.ts +99 -0
  206. package/packages/piagent-webui/gateway/checkpoint-store.ts +6 -0
  207. package/packages/piagent-webui/gateway/company-relay.ts +5 -0
  208. package/packages/piagent-webui/gateway/company-terminal-cache.ts +54 -0
  209. package/packages/piagent-webui/gateway/company-terminal-channel.ts +117 -0
  210. package/packages/piagent-webui/gateway/company-terminal-relay.ts +75 -0
  211. package/packages/piagent-webui/gateway/gateway-protocol-service.ts +12 -0
  212. package/packages/piagent-webui/gateway/gateway-service.ts +48 -4
  213. package/packages/piagent-webui/gateway/managed-gateway.mjs +30 -3
  214. package/packages/piagent-webui/gateway/managed-projection.ts +5 -3
  215. package/packages/piagent-webui/gateway/managed-source-revert-controller.ts +45 -0
  216. package/packages/piagent-webui/gateway/managed-source-revert-sessions.ts +74 -0
  217. package/packages/piagent-webui/gateway/managed-terminal-binding.ts +30 -0
  218. package/packages/piagent-webui/gateway/managed-terminal-processes.ts +74 -0
  219. package/packages/piagent-webui/gateway/managed-terminal-sessions.ts +9 -0
  220. package/packages/piagent-webui/gateway/path-suggestions.ts +1 -124
  221. package/packages/piagent-webui/gateway/personal-terminal-binding.ts +36 -0
  222. package/packages/piagent-webui/gateway/personal-terminal-diagnostic.mjs +16 -0
  223. package/packages/piagent-webui/gateway/personal-terminal-processes.ts +119 -0
  224. package/packages/piagent-webui/gateway/personal-terminal-sessions.ts +22 -0
  225. package/packages/piagent-webui/gateway/runtime-session-controls.ts +2 -1
  226. package/packages/piagent-webui/gateway/session-catalog.ts +3 -2
  227. package/packages/piagent-webui/gateway/session-command-controller.ts +4 -4
  228. package/packages/piagent-webui/gateway/session-inspection-registry.ts +29 -5
  229. package/packages/piagent-webui/gateway/session-runtime-supervisor.ts +8 -8
  230. package/packages/piagent-webui/gateway/signed-session-journal.ts +77 -0
  231. package/packages/piagent-webui/gateway/source-revert-sessions.ts +74 -0
  232. package/packages/piagent-webui/gateway/source-revert-store.ts +47 -0
  233. package/packages/piagent-webui/gateway/terminal-command-ledger.ts +33 -0
  234. package/packages/piagent-webui/gateway/terminal-mentions.ts +29 -0
  235. package/packages/piagent-webui/gateway/terminal-output-buffer.ts +58 -0
  236. package/packages/piagent-webui/gateway/terminal-router.ts +12 -0
  237. package/packages/piagent-webui/gateway/terminal-sessions.ts +247 -0
  238. package/packages/piagent-webui/gateway/workspace-write-sessions.ts +69 -0
  239. package/packages/piagent-webui/gateway/workspace-write-store.ts +6 -0
  240. package/packages/piagent-webui/package.json +15 -2
  241. package/packages/piagent-webui/server/checkpoint-command.ts +30 -0
  242. package/packages/piagent-webui/server/checkpoint-controller.ts +87 -0
  243. package/packages/piagent-webui/server/checkpoint-routes.ts +38 -0
  244. package/packages/piagent-webui/server/control-command-digest.ts +5 -0
  245. package/packages/piagent-webui/server/core-inspection-provider.ts +16 -22
  246. package/packages/piagent-webui/server/gateway-websocket.ts +36 -8
  247. package/packages/piagent-webui/server/loopback-server.ts +9 -0
  248. package/packages/piagent-webui/server/read-model-provider.ts +3 -0
  249. package/packages/piagent-webui/server/read-only-router.ts +3 -0
  250. package/packages/piagent-webui/server/session-auth.ts +4 -1
  251. package/packages/piagent-webui/server/session-source-revert-routes.ts +54 -0
  252. package/packages/piagent-webui/server/source-projection-binding.ts +18 -0
  253. package/packages/piagent-webui/server/source-revert-controller.ts +225 -0
  254. package/packages/piagent-webui/server/terminal-command.ts +35 -0
  255. package/packages/piagent-webui/server/terminal-websocket-stream.ts +56 -0
  256. package/packages/piagent-webui/server/transcript-projection.ts +2 -1
  257. package/packages/piagent-webui/server/workspace-read-routes.ts +32 -0
  258. package/packages/piagent-webui/server/workspace-reader.ts +23 -0
  259. package/packages/piagent-webui/server/workspace-write-controller.ts +118 -0
  260. package/packages/piagent-webui/server/workspace-write-routes.ts +38 -0
  261. package/packages/piagent-webui/shared/terminal-message.ts +23 -0
  262. package/schemas/piagent-webui/catalog-v1.json +63 -0
  263. package/schemas/piagent-webui/checkpoint-v1.schema.json +466 -0
  264. package/schemas/piagent-webui/control-command-v1.schema.json +68 -3
  265. package/schemas/piagent-webui/diff-v1.schema.json +4 -0
  266. package/schemas/piagent-webui/gateway-protocol-v1.schema.json +123 -3
  267. package/schemas/piagent-webui/session-catalog-v1.schema.json +1 -1
  268. package/schemas/piagent-webui/session-command-v1.schema.json +1 -1
  269. package/schemas/piagent-webui/snapshot-v1.schema.json +2 -1
  270. package/schemas/piagent-webui/source-revert-v1.schema.json +22 -3
  271. package/schemas/piagent-webui/terminal-v1.schema.json +495 -0
  272. package/schemas/piagent-webui/workspace-file-v1.schema.json +79 -0
  273. package/schemas/piagent-webui/workspace-paths-v1.schema.json +71 -0
  274. package/schemas/piagent-webui/workspace-search-v1.schema.json +80 -0
  275. package/schemas/piagent-webui/workspace-tree-v1.schema.json +87 -0
  276. package/schemas/piagent-webui/workspace-write-v1.schema.json +276 -0
  277. package/schemas/project-profile.schema.json +8 -3
  278. package/scripts/company-terminal.mjs +16 -11
  279. package/scripts/pi-auto.sh +5 -1
  280. package/scripts/team-doctor.sh +8 -0
  281. package/packages/piagent-webui/dist/client/assets/MarkdownMessage-CfgyQQbW.js +0 -29
  282. package/packages/piagent-webui/dist/client/assets/index-HyzWKvDu.js +0 -234
  283. package/packages/piagent-webui/dist/client/assets/index-_0nGP2n3.css +0 -1
@@ -0,0 +1,102 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownMessage-DtEwqme0.js","assets/rolldown-runtime-hePW80VL.js","assets/ui-preferences-BO3AV7QE.js","assets/useId-DEefKUAT.js","assets/Typography-B9om7Evq.js","assets/WorkspaceQuickOpen-Bn4miZq4.js","assets/DialogTitle-CyaFPaiW.js","assets/Alert-DGWhP2MM.js","assets/workspace-api-O7auv_td.js","assets/bootstrap-CedkNtRG.js","assets/TerminalPanel-C3vkzjQ6.js","assets/Button-QItfZUNj.js","assets/tab-close-nAxrK7Lq.js","assets/WorkspaceExplorer-Coh_GWCO.js"])))=>i.map(i=>d[i]);
2
+ import{r as e,t}from"./rolldown-runtime-hePW80VL.js";import{A as n,B as r,C as i,D as a,E as o,F as s,H as c,M as l,N as u,O as d,P as f,S as p,X as m,Y as h,_ as g,a as _,b as v,c as y,d as b,g as x,h as S,i as C,k as w,l as T,m as E,n as D,o as O,p as k,s as A,t as j,v as M,x as N,y as P}from"./ui-preferences-BO3AV7QE.js";import{C as F,D as I,E as ee,O as te,S as L,T as ne,_ as R,a as z,b as re,c as ie,d as ae,f as oe,g as se,h as ce,i as le,k as ue,l as de,m as fe,n as pe,o as me,p as he,r as ge,s as _e,t as ve,u as ye,v as be,w as xe,y as Se}from"./DialogTitle-CyaFPaiW.js";import{A as Ce,C as we,D as B,F as Te,M as Ee,O as De,P as Oe,S as ke,T as Ae,_ as je,a as Me,b as V,c as H,d as Ne,g as Pe,h as Fe,i as Ie,j as Le,k as Re,l as ze,m as Be,n as Ve,o as He,p as Ue,r as We,t as Ge,u as U,v as Ke,w as W,x as qe,y as G}from"./useId-DEefKUAT.js";import{C as Je,D as Ye,E as Xe,_ as Ze,a as Qe,b as $e,c as et,f as tt,g as nt,h as rt,i as it,l as at,m as K,n as ot,o as st,p as ct,s as lt,t as ut,u as dt,x as ft,y as pt}from"./Alert-DGWhP2MM.js";import{n as mt,r as ht,t as q}from"./Typography-B9om7Evq.js";import{t as J}from"./Button-QItfZUNj.js";import{a as gt,i as _t,n as vt,o as yt,r as bt,s as xt,t as St}from"./bootstrap-CedkNtRG.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ct=t((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),wt=t(((e,t)=>{t.exports=Ct()})),Tt=t((e=>{var t=wt(),n=m(),r=ue();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},ee=[],te=-1;function L(e){return{current:e}}function ne(e){0>te||(e.current=ee[te],ee[te]=null,te--)}function R(e,t){te++,ee[te]=e.current,e.current=t}var z=L(null),re=L(null),ie=L(null),ae=L(null);function oe(e,t){switch(R(ie,t),R(re,e),R(z,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ne(z),R(z,e)}function se(){ne(z),ne(re),ne(ie)}function ce(e){e.memoizedState!==null&&R(ae,e);var t=z.current,n=Hd(t,e.type);t!==n&&(R(re,e),R(z,n))}function le(e){re.current===e&&(ne(z),ne(re)),ae.current===e&&(ne(ae),Qf._currentValue=I)}var de,fe;function pe(e){if(de===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);de=t&&t[1]||``,fe=-1<e.stack.indexOf(`
3
+ at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
+ `+de+e+fe}var me=!1;function he(e,t){if(!e||me)return``;me=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
+ `),l=s.split(`
6
+ `);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
7
+ `+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?pe(n):``}function ge(e,t){switch(e.tag){case 26:case 27:case 5:return pe(e.type);case 16:return pe(`Lazy`);case 13:return e.child!==t&&t!==null?pe(`Suspense Fallback`):pe(`Suspense`);case 19:return pe(`SuspenseList`);case 0:case 15:return he(e.type,!1);case 11:return he(e.type.render,!1);case 1:return he(e.type,!0);case 31:return pe(`Activity`);default:return``}}function _e(e){try{var t=``,n=null;do t+=ge(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
8
+ Error generating stack: `+e.message+`
9
+ `+e.stack}}var ve=Object.prototype.hasOwnProperty,ye=t.unstable_scheduleCallback,be=t.unstable_cancelCallback,xe=t.unstable_shouldYield,Se=t.unstable_requestPaint,Ce=t.unstable_now,we=t.unstable_getCurrentPriorityLevel,B=t.unstable_ImmediatePriority,Te=t.unstable_UserBlockingPriority,Ee=t.unstable_NormalPriority,De=t.unstable_LowPriority,Oe=t.unstable_IdlePriority,ke=t.log,Ae=t.unstable_setDisableYieldValue,je=null,Me=null;function V(e){if(typeof ke==`function`&&Ae(e),Me&&typeof Me.setStrictMode==`function`)try{Me.setStrictMode(je,e)}catch{}}var H=Math.clz32?Math.clz32:Fe,Ne=Math.log,Pe=Math.LN2;function Fe(e){return e>>>=0,e===0?32:31-(Ne(e)/Pe|0)|0}var Ie=256,Le=262144,Re=4194304;function ze(e){var t=e&42;if(t!==0)return t;switch(e&-e){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Be(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=ze(n))):i=ze(o):i=ze(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=ze(n))):i=ze(o)):i=ze(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Ve(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function He(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Ue(){var e=Re;return Re<<=1,!(Re&62914560)&&(Re=4194304),e}function We(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ge(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function U(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-H(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ke(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ke(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-H(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function W(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-H(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function qe(e,t){var n=t&-t;return n=n&42?1:G(n),(n&(e.suspendedLanes|t))===0?n:0}function G(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Je(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ye(){var e=F.p;return e===0?(e=window.event,e===void 0?32:mp(e.type)):e}function Xe(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var Ze=Math.random().toString(36).slice(2),Qe=`__reactFiber$`+Ze,$e=`__reactProps$`+Ze,et=`__reactContainer$`+Ze,tt=`__reactEvents$`+Ze,nt=`__reactListeners$`+Ze,rt=`__reactHandles$`+Ze,it=`__reactResources$`+Ze,at=`__reactMarker$`+Ze;function K(e){delete e[Qe],delete e[$e],delete e[tt],delete e[nt],delete e[rt]}function ot(e){var t=e[Qe];if(t)return t;for(var n=e.parentNode;n;){if(t=n[et]||n[Qe]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=df(e);e!==null;){if(n=e[Qe])return n;e=df(e)}return t}e=n,n=e.parentNode}return null}function st(e){if(e=e[Qe]||e[et]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function ct(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function lt(e){var t=e[it];return t||=e[it]={hoistableStyles:new Map,hoistableScripts:new Map},t}function ut(e){e[at]=!0}var dt=new Set,ft={};function pt(e,t){mt(e,t),mt(e+`Capture`,t)}function mt(e,t){for(ft[e]=t,e=0;e<t.length;e++)dt.add(t[e])}var ht=RegExp(`^[: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]*$`),q={},J={};function gt(e){return ve.call(J,e)?!0:ve.call(q,e)?!1:ht.test(e)?J[e]=!0:(q[e]=!0,!1)}function _t(e,t,n){if(gt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}}function vt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function yt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function bt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function xt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function St(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ct(e){if(!e._valueTracker){var t=xt(e)?`checked`:`value`;e._valueTracker=St(e,t,``+e[t])}}function Tt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=xt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}function Et(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var Y=/[\n"\\]/g;function X(e){return e.replace(Y,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Dt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+bt(t)):e.value!==``+bt(t)&&(e.value=``+bt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):kt(e,o,bt(n)):kt(e,o,bt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+bt(s):e.removeAttribute(`name`)}function Ot(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Ct(e);return}n=n==null?``:``+bt(n),t=t==null?n:``+bt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Ct(e)}function kt(e,t,n){t===`number`&&Et(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function At(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+bt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function jt(e,t,n){if(t!=null&&(t=``+bt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+bt(n)}function Mt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(N(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=bt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ct(e)}function Nt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Pt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Ft(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Pt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function It(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Ft(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Ft(e,o,t[o])}function Lt(e){if(e.indexOf(`-`)===-1)return!1;switch(e){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 Rt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`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`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`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`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`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`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),zt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Bt(e){return zt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function Vt(){}var Ht=null;function Ut(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Wt=null,Gt=null;function Kt(e){var t=st(e);if(t&&(e=t.stateNode)){var n=e[$e]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Dt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+X(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[$e]||null;if(!a)throw Error(i(90));Dt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Tt(r)}break a;case`textarea`:jt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&At(e,!!n.multiple,t,!1)}}}var qt=!1;function Jt(e,t,n){if(qt)return e(t,n);qt=!0;try{return e(t)}finally{if(qt=!1,(Wt!==null||Gt!==null)&&(_u(),Wt&&(t=Wt,e=Gt,Gt=Wt=null,Kt(t),e)))for(t=0;t<e.length;t++)Kt(e[t])}}function Yt(e,t){var n=e.stateNode;if(n===null)return null;var r=n[$e]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var Xt=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),Zt=!1;if(Xt)try{var Qt={};Object.defineProperty(Qt,"passive",{get:function(){Zt=!0}}),window.addEventListener(`test`,Qt,Qt),window.removeEventListener(`test`,Qt,Qt)}catch{Zt=!1}var $t=null,en=null,tn=null;function nn(){if(tn)return tn;var e,t=en,n=t.length,r,i=`value`in $t?$t.value:$t.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return tn=i.slice(e,1<r?1-r:void 0)}function rn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function an(){return!0}function on(){return!1}function sn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?an:on,this.isPropagationStopped=on,this}return f(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=an)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=an)},persist:function(){},isPersistent:an}),t}var cn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ln=sn(cn),un=f({},cn,{view:0,detail:0}),dn=sn(un),fn,pn,mn,hn=f({},un,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:En,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==mn&&(mn&&e.type===`mousemove`?(fn=e.screenX-mn.screenX,pn=e.screenY-mn.screenY):pn=fn=0,mn=e),fn)},movementY:function(e){return`movementY`in e?e.movementY:pn}}),gn=sn(hn),_n=sn(f({},hn,{dataTransfer:0})),vn=sn(f({},un,{relatedTarget:0})),yn=sn(f({},cn,{animationName:0,elapsedTime:0,pseudoElement:0})),bn=sn(f({},cn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),xn=sn(f({},cn,{data:0})),Sn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Cn={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`},wn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function Tn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=wn[e])?!!t[e]:!1}function En(){return Tn}var Dn=sn(f({},un,{key:function(e){if(e.key){var t=Sn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=rn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Cn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:En,charCode:function(e){return e.type===`keypress`?rn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?rn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),On=sn(f({},hn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),kn=sn(f({},un,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:En})),An=sn(f({},cn,{propertyName:0,elapsedTime:0,pseudoElement:0})),jn=sn(f({},hn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Mn=sn(f({},cn,{newState:0,oldState:0})),Nn=[9,13,27,32],Pn=Xt&&`CompositionEvent`in window,Fn=null;Xt&&`documentMode`in document&&(Fn=document.documentMode);var In=Xt&&`TextEvent`in window&&!Fn,Ln=Xt&&(!Pn||Fn&&8<Fn&&11>=Fn),Rn=` `,zn=!1;function Bn(e,t){switch(e){case`keyup`:return Nn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Vn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var Hn=!1;function Un(e,t){switch(e){case`compositionend`:return Vn(t);case`keypress`:return t.which===32?(zn=!0,Rn):null;case`textInput`:return e=t.data,e===Rn&&zn?null:e;default:return null}}function Wn(e,t){if(Hn)return e===`compositionend`||!Pn&&Bn(e,t)?(e=nn(),tn=en=$t=null,Hn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Ln&&t.locale!==`ko`?null:t.data;default:return null}}var Gn={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 Kn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Gn[e.type]:t===`textarea`}function qn(e,t,n,r){Wt?Gt?Gt.push(r):Gt=[r]:Wt=r,t=Td(t,`onChange`),0<t.length&&(n=new ln(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Jn=null,Yn=null;function Z(e){_d(e,0)}function Xn(e){if(Tt(ct(e)))return e}function Zn(e,t){if(e===`change`)return t}var Qn=!1;if(Xt){var $n;if(Xt){var er=`oninput`in document;if(!er){var tr=document.createElement(`div`);tr.setAttribute(`oninput`,`return;`),er=typeof tr.oninput==`function`}$n=er}else $n=!1;Qn=$n&&(!document.documentMode||9<document.documentMode)}function nr(){Jn&&(Jn.detachEvent(`onpropertychange`,rr),Yn=Jn=null)}function rr(e){if(e.propertyName===`value`&&Xn(Yn)){var t=[];qn(t,Yn,e,Ut(e)),Jt(Z,t)}}function ir(e,t,n){e===`focusin`?(nr(),Jn=t,Yn=n,Jn.attachEvent(`onpropertychange`,rr)):e===`focusout`&&nr()}function ar(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Xn(Yn)}function or(e,t){if(e===`click`)return Xn(t)}function sr(e,t){if(e===`input`||e===`change`)return Xn(t)}function cr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var lr=typeof Object.is==`function`?Object.is:cr;function ur(e,t){if(lr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!ve.call(t,i)||!lr(e[i],t[i]))return!1}return!0}function dr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fr(e,t){var n=dr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=dr(n)}}function pr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?pr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function mr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Et(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Et(e.document)}return t}function hr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var gr=Xt&&`documentMode`in document&&11>=document.documentMode,_r=null,vr=null,yr=null,br=!1;function xr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;br||_r==null||_r!==Et(r)||(r=_r,`selectionStart`in r&&hr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),yr&&ur(yr,r)||(yr=r,r=Td(vr,`onSelect`),0<r.length&&(t=new ln(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=_r)))}function Sr(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Cr={animationend:Sr(`Animation`,`AnimationEnd`),animationiteration:Sr(`Animation`,`AnimationIteration`),animationstart:Sr(`Animation`,`AnimationStart`),transitionrun:Sr(`Transition`,`TransitionRun`),transitionstart:Sr(`Transition`,`TransitionStart`),transitioncancel:Sr(`Transition`,`TransitionCancel`),transitionend:Sr(`Transition`,`TransitionEnd`)},wr={},Tr={};Xt&&(Tr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Cr.animationend.animation,delete Cr.animationiteration.animation,delete Cr.animationstart.animation),`TransitionEvent`in window||delete Cr.transitionend.transition);function Er(e){if(wr[e])return wr[e];if(!Cr[e])return e;var t=Cr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Tr)return wr[e]=t[n];return e}var Dr=Er(`animationend`),Or=Er(`animationiteration`),kr=Er(`animationstart`),Ar=Er(`transitionrun`),jr=Er(`transitionstart`),Mr=Er(`transitioncancel`),Nr=Er(`transitionend`),Pr=new Map,Fr=`abort auxClick beforeToggle 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(` `);Fr.push(`scrollEnd`);function Ir(e,t){Pr.set(e,t),pt(t,[e])}var Lr=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Rr=[],zr=0,Br=0;function Q(){for(var e=zr,t=Br=zr=0;t<e;){var n=Rr[t];Rr[t++]=null;var r=Rr[t];Rr[t++]=null;var i=Rr[t];Rr[t++]=null;var a=Rr[t];if(Rr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Wr(n,i,a)}}function Vr(e,t,n,r){Rr[zr++]=e,Rr[zr++]=t,Rr[zr++]=n,Rr[zr++]=r,Br|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Hr(e,t,n,r){return Vr(e,t,n,r),Gr(e)}function Ur(e,t){return Vr(e,null,null,t),Gr(e)}function Wr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-H(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Gr(e){if(50<cu)throw cu=0,lu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Kr={};function qr(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Jr(e,t,n,r){return new qr(e,t,n,r)}function Yr(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xr(e,t){var n=e.alternate;return n===null?(n=Jr(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Zr(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Qr(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)Yr(e)&&(s=1);else if(typeof e==`string`)s=Uf(e,n,z.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case D:return e=Jr(31,n,t,a),e.elementType=D,e.lanes=o,e;case _:return $r(n.children,a,o,t);case v:s=8,a|=24;break;case y:return e=Jr(12,n,t,a|2),e.elementType=y,e.lanes=o,e;case C:return e=Jr(13,n,t,a),e.elementType=C,e.lanes=o,e;case w:return e=Jr(19,n,t,a),e.elementType=w,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case x:s=10;break a;case b:s=9;break a;case S:s=11;break a;case T:s=14;break a;case E:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=Jr(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function $r(e,t,n,r){return e=Jr(7,e,r,t),e.lanes=n,e}function ei(e,t,n){return e=Jr(6,e,null,t),e.lanes=n,e}function ti(e){var t=Jr(18,null,null,0);return t.stateNode=e,t}function ni(e,t,n){return t=Jr(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var ri=new WeakMap;function ii(e,t){if(typeof e==`object`&&e){var n=ri.get(e);return n===void 0?(t={value:e,source:t,stack:_e(t)},ri.set(e,t),t):n}return{value:e,source:t,stack:_e(t)}}var ai=[],oi=0,si=null,ci=0,li=[],ui=0,di=null,fi=1,pi=``;function mi(e,t){ai[oi++]=ci,ai[oi++]=si,si=e,ci=t}function hi(e,t,n){li[ui++]=fi,li[ui++]=pi,li[ui++]=di,di=e;var r=fi;e=pi;var i=32-H(r)-1;r&=~(1<<i),n+=1;var a=32-H(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,fi=1<<32-H(t)+i|n<<i|r,pi=a+e}else fi=1<<a|n<<i|r,pi=e}function gi(e){e.return!==null&&(mi(e,1),hi(e,1,0))}function _i(e){for(;e===si;)si=ai[--oi],ai[oi]=null,ci=ai[--oi],ai[oi]=null;for(;e===di;)di=li[--ui],li[ui]=null,pi=li[--ui],li[ui]=null,fi=li[--ui],li[ui]=null}function vi(e,t){li[ui++]=fi,li[ui++]=pi,li[ui++]=di,fi=t.id,pi=t.overflow,di=e}var yi=null,bi=null,xi=!1,Si=null,Ci=!1,wi=Error(i(519));function Ti(e){throw ji(ii(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),wi}function Ei(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[Qe]=e,t[$e]=r,n){case`dialog`:vd(`cancel`,t),vd(`close`,t);break;case`iframe`:case`object`:case`embed`:vd(`load`,t);break;case`video`:case`audio`:for(n=0;n<hd.length;n++)vd(hd[n],t);break;case`source`:vd(`error`,t);break;case`img`:case`image`:case`link`:vd(`error`,t),vd(`load`,t);break;case`details`:vd(`toggle`,t);break;case`input`:vd(`invalid`,t),Ot(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:vd(`invalid`,t);break;case`textarea`:vd(`invalid`,t),Mt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||jd(t.textContent,n)?(r.popover!=null&&(vd(`beforetoggle`,t),vd(`toggle`,t)),r.onScroll!=null&&vd(`scroll`,t),r.onScrollEnd!=null&&vd(`scrollend`,t),r.onClick!=null&&(t.onclick=Vt),t=!0):t=!1,t||Ti(e,!0)}function Di(e){for(yi=e.return;yi;)switch(yi.tag){case 5:case 31:case 13:Ci=!1;return;case 27:case 3:Ci=!0;return;default:yi=yi.return}}function Oi(e){if(e!==yi)return!1;if(!xi)return Di(e),xi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Ud(e.type,e.memoizedProps)),n=!n),n&&bi&&Ti(e),Di(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));bi=uf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));bi=uf(e)}else t===27?(t=bi,Zd(e.type)?(e=lf,lf=null,bi=e):bi=t):bi=yi?cf(e.stateNode.nextSibling):null;return!0}function ki(){bi=yi=null,xi=!1}function Ai(){var e=Si;return e!==null&&(Jl===null?Jl=e:Jl.push.apply(Jl,e),Si=null),e}function ji(e){Si===null?Si=[e]:Si.push(e)}var Mi=L(null),Ni=null,Pi=null;function Fi(e,t,n){R(Mi,t._currentValue),t._currentValue=n}function Ii(e){e._currentValue=Mi.current,ne(Mi)}function Li(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Ri(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Li(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Li(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function zi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;lr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===ae.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[Qf]:e.push(Qf))}a=a.return}e!==null&&Ri(t,e,n,r),t.flags|=262144}function Bi(e){for(e=e.firstContext;e!==null;){if(!lr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Vi(e){Ni=e,Pi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Hi(e){return Wi(Ni,e)}function Ui(e,t){return Ni===null&&Vi(e),Wi(e,t)}function Wi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Pi===null){if(e===null)throw Error(i(308));Pi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Pi=Pi.next=t;return n}var Gi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Ki=t.unstable_scheduleCallback,qi=t.unstable_NormalPriority,Ji={$$typeof:x,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Yi(){return{controller:new Gi,data:new Map,refCount:0}}function Xi(e){e.refCount--,e.refCount===0&&Ki(qi,function(){e.controller.abort()})}var Zi=null,Qi=0,$i=0,ea=null;function ta(e,t){if(Zi===null){var n=Zi=[];Qi=0,$i=ld(),ea={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return Qi++,t.then(na,na),t}function na(){if(--Qi===0&&Zi!==null){ea!==null&&(ea.status=`fulfilled`);var e=Zi;Zi=null,$i=0,ea=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ra(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ia=P.S;P.S=function(e,t){Zl=Ce(),typeof t==`object`&&t&&typeof t.then==`function`&&ta(e,t),ia!==null&&ia(e,t)};var aa=L(null);function oa(){var e=aa.current;return e===null?Nl.pooledCache:e}function sa(e,t){t===null?R(aa,aa.current):R(aa,t.pool)}function ca(){var e=oa();return e===null?null:{parent:Ji._currentValue,pool:e}}var la=Error(i(460)),ua=Error(i(474)),da=Error(i(542)),fa={then:function(){}};function pa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ma(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Vt,Vt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,va(e),e;default:if(typeof t.status==`string`)t.then(Vt,Vt);else{if(e=Nl,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,va(e),e}throw ga=t,la}}function ha(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(ga=e,la):e}}var ga=null;function _a(){if(ga===null)throw Error(i(459));var e=ga;return ga=null,e}function va(e){if(e===la||e===da)throw Error(i(483))}var ya=null,ba=0;function xa(e){var t=ba;return ba+=1,ya===null&&(ya=[]),ma(ya,e,t)}function Sa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Ca(e,t){throw t.$$typeof===p?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function wa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Xr(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=ei(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===_?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===E&&ha(i)===t.type)?(t=a(t,n.props),Sa(t,n),t.return=e,t):(t=Qr(n.type,n.key,n.props,null,e.mode,r),Sa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ni(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=$r(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=ei(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case h:return n=Qr(t.type,t.key,t.props,null,e.mode,n),Sa(n,t),n.return=e,n;case g:return t=ni(t,e.mode,n),t.return=e,t;case E:return t=ha(t),f(e,t,n)}if(N(t)||A(t))return t=$r(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,xa(t),n);if(t.$$typeof===x)return f(e,Ui(e,t),n);Ca(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case h:return n.key===i?l(e,t,n,r):null;case g:return n.key===i?u(e,t,n,r):null;case E:return n=ha(n),p(e,t,n,r)}if(N(n)||A(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,xa(n),r);if(n.$$typeof===x)return p(e,t,Ui(e,n),r);Ca(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case h:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case g:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case E:return r=ha(r),m(e,t,n,r,i)}if(N(r)||A(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,xa(r),i);if(r.$$typeof===x)return m(e,t,n,Ui(t,r),i);Ca(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),xi&&mi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return xi&&mi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),xi&&mi(i,h),l}function y(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),xi&&mi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return xi&&mi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),xi&&mi(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===_&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case h:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===_){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===E&&ha(l)===r.type){n(e,r.sibling),c=a(r,o.props),Sa(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===_?(c=$r(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=Qr(o.type,o.key,o.props,null,e.mode,c),Sa(c,o),c.return=e,e=c)}return s(e);case g:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=ni(o,e.mode,c),c.return=e,e=c}return s(e);case E:return o=ha(o),b(e,r,o,c)}if(N(o))return v(e,r,o,c);if(A(o)){if(l=A(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,xa(o),c);if(o.$$typeof===x)return b(e,r,Ui(e,o),c);Ca(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=ei(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ba=0;var i=b(e,t,n,r);return ya=null,i}catch(t){if(t===la||t===da)throw t;var a=Jr(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var Ta=wa(!0),Ea=wa(!1),Da=!1;function Oa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ka(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Aa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ja(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ml&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Gr(e),Wr(e,null,n),t}return Vr(e,r,t,n),Gr(e)}function Ma(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,W(e,n)}}function Na(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Pa=!1;function Fa(){if(Pa){var e=ea;if(e!==null)throw e}}function Ia(e,t,n,r){Pa=!1;var i=e.updateQueue;Da=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var p=s.lane&-536870913,m=p!==s.lane;if(m?(Fl&p)===p:(r&p)===p){p!==0&&p===$i&&(Pa=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;p=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,p);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,p=typeof h==`function`?h.call(_,d,p):h,p==null)break a;d=f({},d,p);break a;case 2:Da=!0}}p=s.callback,p!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[p]:m.push(p))}else m={lane:p,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=p;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),Ul|=o,e.lanes=o,e.memoizedState=d}}function La(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Ra(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)La(n[e],t)}var za=L(null),Ba=L(0);function Va(e,t){e=Vl,R(Ba,e),R(za,t),Vl=e|t.baseLanes}function Ha(){R(Ba,Vl),R(za,za.current)}function Ua(){Vl=Ba.current,ne(za),ne(Ba)}var Wa=L(null),Ga=null;function Ka(e){var t=e.alternate;R(Za,Za.current&1),R(Wa,e),Ga===null&&(t===null||za.current!==null||t.memoizedState!==null)&&(Ga=e)}function qa(e){R(Za,Za.current),R(Wa,e),Ga===null&&(Ga=e)}function Ja(e){e.tag===22?(R(Za,Za.current),R(Wa,e),Ga===null&&(Ga=e)):Ya(e)}function Ya(){R(Za,Za.current),R(Wa,Wa.current)}function Xa(e){ne(Wa),Ga===e&&(Ga=null),ne(Za)}var Za=L(0);function Qa(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||af(n)||of(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var $a=0,eo=null,to=null,no=null,ro=!1,io=!1,ao=!1,oo=0,so=0,co=null,lo=0;function uo(){throw Error(i(321))}function fo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!lr(e[n],t[n]))return!1;return!0}function po(e,t,n,r,i,a){return $a=a,eo=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,P.H=e===null||e.memoizedState===null?As:js,ao=!1,a=n(r,i),ao=!1,io&&(a=ho(t,n,r,i)),mo(e),a}function mo(e){P.H=ks;var t=to!==null&&to.next!==null;if($a=0,no=to=eo=null,ro=!1,so=0,co=null,t)throw Error(i(300));e===null||Js||(e=e.dependencies,e!==null&&Bi(e)&&(Js=!0))}function ho(e,t,n,r){eo=e;var a=0;do{if(io&&(co=null),so=0,io=!1,25<=a)throw Error(i(301));if(a+=1,no=to=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}P.H=Ms,o=t(n,r)}while(io);return o}function go(){var e=P.H,t=e.useState()[0];return t=typeof t.then==`function`?Co(t):t,e=e.useState()[0],(to===null?null:to.memoizedState)!==e&&(eo.flags|=1024),t}function _o(){var e=oo!==0;return oo=0,e}function vo(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function yo(e){if(ro){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ro=!1}$a=0,no=to=eo=null,io=!1,so=oo=0,co=null}function bo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return no===null?eo.memoizedState=no=e:no=no.next=e,no}function xo(){if(to===null){var e=eo.alternate;e=e===null?null:e.memoizedState}else e=to.next;var t=no===null?eo.memoizedState:no.next;if(t!==null)no=t,to=e;else{if(e===null)throw eo.alternate===null?Error(i(467)):Error(i(310));to=e,e={memoizedState:to.memoizedState,baseState:to.baseState,baseQueue:to.baseQueue,queue:to.queue,next:null},no===null?eo.memoizedState=no=e:no=no.next=e}return no}function So(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Co(e){var t=so;return so+=1,co===null&&(co=[]),e=ma(co,e,t),t=eo,(no===null?t.memoizedState:no.next)===null&&(t=t.alternate,P.H=t===null||t.memoizedState===null?As:js),e}function wo(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Co(e);if(e.$$typeof===x)return Hi(e)}throw Error(i(438,String(e)))}function To(e){var t=null,n=eo.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=eo.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=So(),eo.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=O;return t.index++,n}function Eo(e,t){return typeof t==`function`?t(e):t}function Do(e){return Oo(xo(),to,e)}function Oo(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?($a&f)===f:(Fl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===$i&&(d=!0);else if(($a&p)===p){u=u.next,p===$i&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,eo.lanes|=p,Ul|=p;f=u.action,ao&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,eo.lanes|=f,Ul|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!lr(o,e.memoizedState)&&(Js=!0,d&&(n=ea,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function ko(e){var t=xo(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);lr(o,t.memoizedState)||(Js=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Ao(e,t,n){var r=eo,a=xo(),o=xi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!lr((to||a).memoizedState,n);if(s&&(a.memoizedState=n,Js=!0),a=a.queue,ts(No.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||no!==null&&no.memoizedState.tag&1){if(r.flags|=2048,Xo(9,{destroy:void 0},Mo.bind(null,r,a,n,t),null),Nl===null)throw Error(i(349));o||$a&127||jo(r,t,n)}return n}function jo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=eo.updateQueue,t===null?(t=So(),eo.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Mo(e,t,n,r){t.value=n,t.getSnapshot=r,Po(t)&&Fo(e)}function No(e,t,n){return n(function(){Po(t)&&Fo(e)})}function Po(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!lr(e,n)}catch{return!0}}function Fo(e){var t=Ur(e,2);t!==null&&fu(t,e,2)}function Io(e){var t=bo();if(typeof e==`function`){var n=e;if(e=n(),ao){V(!0);try{n()}finally{V(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:e},t}function Lo(e,t,n,r){return e.baseState=n,Oo(e,to,typeof r==`function`?r:Eo)}function Ro(e,t,n,r,a){if(Es(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};P.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,zo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function zo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=P.T,o={};P.T=o;try{var s=n(i,r),c=P.S;c!==null&&c(o,s),Bo(e,t,s)}catch(n){Ho(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),P.T=a}}else try{a=n(i,r),Bo(e,t,a)}catch(n){Ho(e,t,n)}}function Bo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Vo(e,t,n)},function(n){return Ho(e,t,n)}):Vo(e,t,n)}function Vo(e,t,n){t.status=`fulfilled`,t.value=n,Uo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,zo(e,n)))}function Ho(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,Uo(t),t=t.next;while(t!==r)}e.action=null}function Uo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Wo(e,t){return t}function Go(e,t){if(xi){var n=Nl.formState;if(n!==null){a:{var r=eo;if(xi){if(bi){b:{for(var i=bi,a=Ci;i.nodeType!==8;){if(!a){i=null;break b}if(i=cf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){bi=cf(i.nextSibling),r=i.data===`F!`;break a}}Ti(r)}r=!1}r&&(t=n[0])}}return n=bo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wo,lastRenderedState:t},n.queue=r,n=Cs.bind(null,eo,r),r.dispatch=n,r=Io(!1),a=Ts.bind(null,eo,!1,r.queue),r=bo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ro.bind(null,eo,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ko(e){return qo(xo(),to,e)}function qo(e,t,n){if(t=Oo(e,t,Wo)[0],e=Do(Eo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Co(t)}catch(e){throw e===la?da:e}else r=t;t=xo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(eo.flags|=2048,Xo(9,{destroy:void 0},Jo.bind(null,i,n),null)),[r,a,e]}function Jo(e,t){e.action=t}function Yo(e){var t=xo(),n=to;if(n!==null)return qo(t,n,e);xo(),t=t.memoizedState,n=xo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Xo(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=eo.updateQueue,t===null&&(t=So(),eo.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Zo(){return xo().memoizedState}function Qo(e,t,n,r){var i=bo();eo.flags|=e,i.memoizedState=Xo(1|t,{destroy:void 0},n,r===void 0?null:r)}function $o(e,t,n,r){var i=xo();r=r===void 0?null:r;var a=i.memoizedState.inst;to!==null&&r!==null&&fo(r,to.memoizedState.deps)?i.memoizedState=Xo(t,a,n,r):(eo.flags|=e,i.memoizedState=Xo(1|t,a,n,r))}function es(e,t){Qo(8390656,8,e,t)}function ts(e,t){$o(2048,8,e,t)}function ns(e){eo.flags|=4;var t=eo.updateQueue;if(t===null)t=So(),eo.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function rs(e){var t=xo().memoizedState;return ns({ref:t,nextImpl:e}),function(){if(Ml&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function is(e,t){return $o(4,2,e,t)}function as(e,t){return $o(4,4,e,t)}function os(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ss(e,t,n){n=n==null?null:n.concat([e]),$o(4,4,os.bind(null,t,e),n)}function cs(){}function ls(e,t){var n=xo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&fo(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function us(e,t){var n=xo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&fo(t,r[1]))return r[0];if(r=e(),ao){V(!0);try{e()}finally{V(!1)}}return n.memoizedState=[r,t],r}function ds(e,t,n){return n===void 0||$a&1073741824&&!(Fl&261930)?e.memoizedState=t:(e.memoizedState=n,e=du(),eo.lanes|=e,Ul|=e,n)}function fs(e,t,n,r){return lr(n,t)?n:za.current===null?!($a&42)||$a&1073741824&&!(Fl&261930)?(Js=!0,e.memoizedState=n):(e=du(),eo.lanes|=e,Ul|=e,t):(e=ds(e,n,r),lr(e,t)||(Js=!0),e)}function ps(e,t,n,r,i){var a=F.p;F.p=a!==0&&8>a?a:8;var o=P.T,s={};P.T=s,Ts(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?ws(e,t,ra(c,r),uu(e)):ws(e,t,r,uu(e))}catch(n){ws(e,t,{then:function(){},status:`rejected`,reason:n},uu())}finally{F.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.T=o}}function ms(){}function hs(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=gs(e).queue;ps(e,a,t,I,n===null?ms:function(){return _s(e),n(r)})}function gs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:I},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function _s(e){var t=gs(e);t.next===null&&(t=e.alternate.memoizedState),ws(e,t.next.queue,{},uu())}function vs(){return Hi(Qf)}function ys(){return xo().memoizedState}function bs(){return xo().memoizedState}function xs(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=uu();e=Aa(n);var r=ja(t,e,n);r!==null&&(fu(r,t,n),Ma(r,t,n)),t={cache:Yi()},e.payload=t;return}t=t.return}}function Ss(e,t,n){var r=uu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Es(e)?Ds(t,n):(n=Hr(e,t,n,r),n!==null&&(fu(n,e,r),Os(n,t,r)))}function Cs(e,t,n){ws(e,t,n,uu())}function ws(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Es(e))Ds(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,lr(s,o))return Vr(e,t,i,0),Nl===null&&Q(),!1}catch{}if(n=Hr(e,t,i,r),n!==null)return fu(n,e,r),Os(n,t,r),!0}return!1}function Ts(e,t,n,r){if(r={lane:2,revertLane:ld(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Es(e)){if(t)throw Error(i(479))}else t=Hr(e,n,r,2),t!==null&&fu(t,e,2)}function Es(e){var t=e.alternate;return e===eo||t!==null&&t===eo}function Ds(e,t){io=ro=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Os(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,W(e,n)}}var ks={readContext:Hi,use:wo,useCallback:uo,useContext:uo,useEffect:uo,useImperativeHandle:uo,useLayoutEffect:uo,useInsertionEffect:uo,useMemo:uo,useReducer:uo,useRef:uo,useState:uo,useDebugValue:uo,useDeferredValue:uo,useTransition:uo,useSyncExternalStore:uo,useId:uo,useHostTransitionStatus:uo,useFormState:uo,useActionState:uo,useOptimistic:uo,useMemoCache:uo,useCacheRefresh:uo};ks.useEffectEvent=uo;var As={readContext:Hi,use:wo,useCallback:function(e,t){return bo().memoizedState=[e,t===void 0?null:t],e},useContext:Hi,useEffect:es,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),Qo(4194308,4,os.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Qo(4194308,4,e,t)},useInsertionEffect:function(e,t){Qo(4,2,e,t)},useMemo:function(e,t){var n=bo();t=t===void 0?null:t;var r=e();if(ao){V(!0);try{e()}finally{V(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=bo();if(n!==void 0){var i=n(t);if(ao){V(!0);try{n(t)}finally{V(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Ss.bind(null,eo,e),[r.memoizedState,e]},useRef:function(e){var t=bo();return e={current:e},t.memoizedState=e},useState:function(e){e=Io(e);var t=e.queue,n=Cs.bind(null,eo,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:cs,useDeferredValue:function(e,t){return ds(bo(),e,t)},useTransition:function(){var e=Io(!1);return e=ps.bind(null,eo,e.queue,!0,!1),bo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=eo,a=bo();if(xi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Nl===null)throw Error(i(349));Fl&127||jo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,es(No.bind(null,r,o,e),[e]),r.flags|=2048,Xo(9,{destroy:void 0},Mo.bind(null,r,o,n,t),null),n},useId:function(){var e=bo(),t=Nl.identifierPrefix;if(xi){var n=pi,r=fi;n=(r&~(1<<32-H(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=oo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=lo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:vs,useFormState:Go,useActionState:Go,useOptimistic:function(e){var t=bo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ts.bind(null,eo,!0,n),n.dispatch=t,[e,t]},useMemoCache:To,useCacheRefresh:function(){return bo().memoizedState=xs.bind(null,eo)},useEffectEvent:function(e){var t=bo(),n={impl:e};return t.memoizedState=n,function(){if(Ml&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},js={readContext:Hi,use:wo,useCallback:ls,useContext:Hi,useEffect:ts,useImperativeHandle:ss,useInsertionEffect:is,useLayoutEffect:as,useMemo:us,useReducer:Do,useRef:Zo,useState:function(){return Do(Eo)},useDebugValue:cs,useDeferredValue:function(e,t){return fs(xo(),to.memoizedState,e,t)},useTransition:function(){var e=Do(Eo)[0],t=xo().memoizedState;return[typeof e==`boolean`?e:Co(e),t]},useSyncExternalStore:Ao,useId:ys,useHostTransitionStatus:vs,useFormState:Ko,useActionState:Ko,useOptimistic:function(e,t){return Lo(xo(),to,e,t)},useMemoCache:To,useCacheRefresh:bs};js.useEffectEvent=rs;var Ms={readContext:Hi,use:wo,useCallback:ls,useContext:Hi,useEffect:ts,useImperativeHandle:ss,useInsertionEffect:is,useLayoutEffect:as,useMemo:us,useReducer:ko,useRef:Zo,useState:function(){return ko(Eo)},useDebugValue:cs,useDeferredValue:function(e,t){var n=xo();return to===null?ds(n,e,t):fs(n,to.memoizedState,e,t)},useTransition:function(){var e=ko(Eo)[0],t=xo().memoizedState;return[typeof e==`boolean`?e:Co(e),t]},useSyncExternalStore:Ao,useId:ys,useHostTransitionStatus:vs,useFormState:Yo,useActionState:Yo,useOptimistic:function(e,t){var n=xo();return to===null?(n.baseState=e,[e,n.queue.dispatch]):Lo(n,to,e,t)},useMemoCache:To,useCacheRefresh:bs};Ms.useEffectEvent=rs;function Ns(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:f({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Ps={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=uu(),i=Aa(r);i.payload=t,n!=null&&(i.callback=n),t=ja(e,i,r),t!==null&&(fu(t,e,r),Ma(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=uu(),i=Aa(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=ja(e,i,r),t!==null&&(fu(t,e,r),Ma(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=uu(),r=Aa(n);r.tag=2,t!=null&&(r.callback=t),t=ja(e,r,n),t!==null&&(fu(t,e,n),Ma(t,e,n))}};function Fs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!ur(n,r)||!ur(i,a):!0}function Is(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Ps.enqueueReplaceState(t,t.state,null)}function Ls(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=f({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Rs(e){Lr(e)}function zs(e){console.error(e)}function Bs(e){Lr(e)}function Vs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Hs(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Us(e,t,n){return n=Aa(n),n.tag=3,n.payload={element:null},n.callback=function(){Vs(e,t)},n}function Ws(e){return e=Aa(e),e.tag=3,e}function Gs(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Hs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Hs(t,n,r),typeof i!=`function`&&(eu===null?eu=new Set([this]):eu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Ks(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&zi(t,n,a,!0),n=Wa.current,n!==null){switch(n.tag){case 31:case 13:return Ga===null?wu():n.alternate===null&&Hl===0&&(Hl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===fa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Uu(e,r,a)),!1;case 22:return n.flags|=65536,r===fa?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Uu(e,r,a)),!1}throw Error(i(435,n.tag))}return Uu(e,r,a),wu(),!1}if(xi)return t=Wa.current,t===null?(r!==wi&&(t=Error(i(423),{cause:r}),ji(ii(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=ii(r,n),a=Us(e.stateNode,r,a),Na(e,a),Hl!==4&&(Hl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==wi&&(e=Error(i(422),{cause:r}),ji(ii(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=ii(o,n),ql===null?ql=[o]:ql.push(o),Hl!==4&&(Hl=2),t===null)return!0;r=ii(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Us(n.stateNode,r,e),Na(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(eu===null||!eu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Ws(a),Gs(a,e,n,r),Na(n,a),!1}n=n.return}while(n!==null);return!1}var qs=Error(i(461)),Js=!1;function Ys(e,t,n,r){t.child=e===null?Ea(t,null,n,r):Ta(t,e.child,n,r)}function Xs(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Vi(t),r=po(e,t,n,o,a,i),s=_o(),e!==null&&!Js?(vo(e,t,i),bc(e,t,i)):(xi&&s&&gi(t),t.flags|=1,Ys(e,t,r,i),t.child)}function Zs(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Yr(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,Qs(e,t,a,r,i)):(e=Qr(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!xc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?ur:n,n(o,r)&&e.ref===t.ref)return bc(e,t,i)}return t.flags|=1,e=Xr(a,r),e.ref=t.ref,e.return=t,t.child=e}function Qs(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(ur(a,r)&&e.ref===t.ref){if(Js=!1,t.pendingProps=r=a,xc(e,i))e.flags&131072&&(Js=!0);else return t.lanes=e.lanes,bc(e,t,i)}}return oc(e,t,n,r,i)}function $s(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return tc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&sa(t,a===null?null:a.cachePool),a===null?Ha():Va(t,a),Ja(t);else return r=t.lanes=536870912,tc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&sa(t,null),Ha(),Ya(t)):(sa(t,a.cachePool),Va(t,a),Ya(t),t.memoizedState=null);return Ys(e,t,i,n),t.child}function ec(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function tc(e,t,n,r,i){var a=oa();return a=a===null?null:{parent:Ji._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&sa(t,null),Ha(),Ja(t),e!==null&&zi(e,t,r,!0),t.childLanes=i,null}function nc(e,t){return t=hc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function rc(e,t,n){return Ta(t,e.child,null,n),e=nc(t,t.pendingProps),e.flags|=2,Xa(t),t.memoizedState=null,e}function ic(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(xi){if(r.mode===`hidden`)return e=nc(t,r),t.lanes=536870912,ec(null,e);if(qa(t),(e=bi)?(e=rf(e,Ci),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:di===null?null:{id:fi,overflow:pi},retryLane:536870912,hydrationErrors:null},n=ti(e),n.return=t,t.child=n,yi=t,bi=null)):e=null,e===null)throw Ti(t);return t.lanes=536870912,null}return nc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(qa(t),a){if(t.flags&256)t.flags&=-257,t=rc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Js||zi(e,t,n,!1),a=(n&e.childLanes)!==0,Js||a){if(r=Nl,r!==null&&(s=qe(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Ur(e,s),fu(r,e,s),qs;wu(),t=rc(e,t,n)}else e=o.treeContext,bi=cf(s.nextSibling),yi=t,xi=!0,Si=null,Ci=!1,e!==null&&vi(t,e),t=nc(t,r),t.flags|=4096;return t}return e=Xr(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function ac(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function oc(e,t,n,r,i){return Vi(t),n=po(e,t,n,r,void 0,i),r=_o(),e!==null&&!Js?(vo(e,t,i),bc(e,t,i)):(xi&&r&&gi(t),t.flags|=1,Ys(e,t,n,i),t.child)}function sc(e,t,n,r,i,a){return Vi(t),t.updateQueue=null,n=ho(t,r,n,i),mo(e),r=_o(),e!==null&&!Js?(vo(e,t,a),bc(e,t,a)):(xi&&r&&gi(t),t.flags|=1,Ys(e,t,n,a),t.child)}function cc(e,t,n,r,i){if(Vi(t),t.stateNode===null){var a=Kr,o=n.contextType;typeof o==`object`&&o&&(a=Hi(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Ps,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Oa(t),o=n.contextType,a.context=typeof o==`object`&&o?Hi(o):Kr,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ns(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Ps.enqueueReplaceState(a,a.state,null),Ia(t,r,a,i),Fa(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Ls(n,s);a.props=c;var l=a.context,u=n.contextType;o=Kr,typeof u==`object`&&u&&(o=Hi(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Is(t,a,r,o),Da=!1;var f=t.memoizedState;a.state=f,Ia(t,r,a,i),Fa(),l=t.memoizedState,s||f!==l||Da?(typeof d==`function`&&(Ns(t,n,d,r),l=t.memoizedState),(c=Da||Fs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,ka(e,t),o=t.memoizedProps,u=Ls(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=Kr,typeof l==`object`&&l&&(c=Hi(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Is(t,a,r,c),Da=!1,f=t.memoizedState,a.state=f,Ia(t,r,a,i),Fa();var p=t.memoizedState;o!==d||f!==p||Da||e!==null&&e.dependencies!==null&&Bi(e.dependencies)?(typeof s==`function`&&(Ns(t,n,s,r),p=t.memoizedState),(u=Da||Fs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Bi(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,ac(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=Ta(t,e.child,null,i),t.child=Ta(t,null,n,i)):Ys(e,t,n,i),t.memoizedState=a.state,e=t.child):e=bc(e,t,i),e}function lc(e,t,n,r){return ki(),t.flags|=256,Ys(e,t,n,r),t.child}var uc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function dc(e){return{baseLanes:e,cachePool:ca()}}function fc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=$),e}function pc(e,t,n){var r=t.pendingProps,a=!1,o=!!(t.flags&128),s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:!!(Za.current&2)),s&&(a=!0,t.flags&=-129),s=!!(t.flags&32),t.flags&=-33,e===null){if(xi){if(a?Ka(t):Ya(t),(e=bi)?(e=rf(e,Ci),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:di===null?null:{id:fi,overflow:pi},retryLane:536870912,hydrationErrors:null},n=ti(e),n.return=t,t.child=n,yi=t,bi=null)):e=null,e===null)throw Ti(t);return of(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(Ya(t),a=t.mode,c=hc({mode:`hidden`,children:c},a),r=$r(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=dc(n),r.childLanes=fc(e,s,n),t.memoizedState=uc,ec(null,r)):(Ka(t),mc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(Ka(t),t.flags&=-257,t=gc(e,t,n)):t.memoizedState===null?(Ya(t),c=r.fallback,a=t.mode,r=hc({mode:`visible`,children:r.children},a),c=$r(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,Ta(t,e.child,null,n),r=t.child,r.memoizedState=dc(n),r.childLanes=fc(e,s,n),t.memoizedState=uc,t=ec(null,r)):(Ya(t),t.child=e.child,t.flags|=128,t=null);else if(Ka(t),of(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,ji({value:r,source:null,stack:null}),t=gc(e,t,n)}else if(Js||zi(e,t,n,!1),s=(n&e.childLanes)!==0,Js||s){if(s=Nl,s!==null&&(r=qe(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Ur(e,r),fu(s,e,r),qs;af(c)||wu(),t=gc(e,t,n)}else af(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,bi=cf(c.nextSibling),yi=t,xi=!0,Si=null,Ci=!1,e!==null&&vi(t,e),t=mc(t,r.children),t.flags|=4096);return t}return a?(Ya(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=Xr(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=$r(c,a,n,null),c.flags|=2):c=Xr(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ec(null,r),r=t.child,c=e.child.memoizedState,c===null?c=dc(n):(a=c.cachePool,a===null?a=ca():(l=Ji._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=fc(e,s,n),t.memoizedState=uc,ec(e.child,r)):(Ka(t),n=e.child,e=n.sibling,n=Xr(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function mc(e,t){return t=hc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function hc(e,t){return e=Jr(22,e,null,t),e.lanes=0,e}function gc(e,t,n){return Ta(t,e.child,null,n),e=mc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _c(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Li(e.return,t,n)}function vc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function yc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Za.current,s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,R(Za,o),Ys(e,t,r,n),r=xi?ci:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&_c(e,n,t);else if(e.tag===19)_c(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Qa(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),vc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Qa(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}vc(t,!0,n,null,a,r);break;case`together`:vc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function bc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ul|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(zi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Xr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Xr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function xc(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Bi(e)))}function Sc(e,t,n){switch(t.tag){case 3:oe(t,t.stateNode.containerInfo),Fi(t,Ji,e.memoizedState.cache),ki();break;case 27:case 5:ce(t);break;case 4:oe(t,t.stateNode.containerInfo);break;case 10:Fi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,qa(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Ka(t),e=bc(e,t,n),e===null?null:e.sibling):pc(e,t,n):(Ka(t),t.flags|=128,null);Ka(t);break;case 19:var i=!!(e.flags&128);if(r=(n&t.childLanes)!==0,r||=(zi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return yc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),R(Za,Za.current),r)break;return null;case 22:return t.lanes=0,$s(e,t,n,t.pendingProps);case 24:Fi(t,Ji,e.memoizedState.cache)}return bc(e,t,n)}function Cc(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Js=!0;else{if(!xc(e,n)&&!(t.flags&128))return Js=!1,Sc(e,t,n);Js=!!(e.flags&131072)}}else Js=!1,xi&&t.flags&1048576&&hi(t,ci,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=ha(t.elementType),t.type=e,typeof e==`function`)Yr(e)?(r=Ls(e,r),t.tag=1,t=cc(null,t,e,r,n)):(t.tag=0,t=oc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===S){t.tag=11,t=Xs(null,t,e,r,n);break a}if(a===T){t.tag=14,t=Zs(null,t,e,r,n);break a}}throw t=M(e)||e,Error(i(306,t,``))}}return t;case 0:return oc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Ls(r,t.pendingProps),cc(e,t,r,a,n);case 3:a:{if(oe(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,ka(e,t),Ia(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Fi(t,Ji,r),r!==o.cache&&Ri(t,[Ji],n,!0),Fa(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=lc(e,t,r,n);break a}if(r!==a){a=ii(Error(i(424)),t),ji(a),t=lc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(bi=cf(e.firstChild),yi=t,xi=!0,Si=null,Ci=!0,n=Ea(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(ki(),r===a){t=bc(e,t,n);break a}Ys(e,t,r,n)}t=t.child}return t;case 26:return ac(e,t),e===null?(n=kf(t.type,null,t.pendingProps,null))?t.memoizedState=n:xi||(n=t.type,e=t.pendingProps,r=Bd(ie.current).createElement(n),r[Qe]=t,r[$e]=e,Pd(r,n,e),ut(r),t.stateNode=r):t.memoizedState=kf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ce(t),e===null&&xi&&(r=t.stateNode=ff(t.type,t.pendingProps,ie.current),yi=t,Ci=!0,a=bi,Zd(t.type)?(lf=a,bi=cf(r.firstChild)):bi=a),Ys(e,t,t.pendingProps.children,n),ac(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&xi&&((a=r=bi)&&(r=tf(r,t.type,t.pendingProps,Ci),r===null?a=!1:(t.stateNode=r,yi=t,bi=cf(r.firstChild),Ci=!1,a=!0)),a||Ti(t)),ce(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Ud(a,o)?r=null:s!==null&&Ud(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=po(e,t,go,null,null,n),Qf._currentValue=a),ac(e,t),Ys(e,t,r,n),t.child;case 6:return e===null&&xi&&((e=n=bi)&&(n=nf(n,t.pendingProps,Ci),n===null?e=!1:(t.stateNode=n,yi=t,bi=null,e=!0)),e||Ti(t)),null;case 13:return pc(e,t,n);case 4:return oe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ta(t,null,r,n):Ys(e,t,r,n),t.child;case 11:return Xs(e,t,t.type,t.pendingProps,n);case 7:return Ys(e,t,t.pendingProps,n),t.child;case 8:return Ys(e,t,t.pendingProps.children,n),t.child;case 12:return Ys(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Fi(t,t.type,r.value),Ys(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,Vi(t),a=Hi(a),r=r(a),t.flags|=1,Ys(e,t,r,n),t.child;case 14:return Zs(e,t,t.type,t.pendingProps,n);case 15:return Qs(e,t,t.type,t.pendingProps,n);case 19:return yc(e,t,n);case 31:return ic(e,t,n);case 22:return $s(e,t,n,t.pendingProps);case 24:return Vi(t),r=Hi(Ji),e===null?(a=oa(),a===null&&(a=Nl,o=Yi(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Oa(t),Fi(t,Ji,a)):((e.lanes&n)!==0&&(ka(e,t),Ia(t,null,null,n),Fa()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Fi(t,Ji,r),r!==a.cache&&Ri(t,[Ji],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Fi(t,Ji,r))),Ys(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function wc(e){e.flags|=4}function Tc(e,t,n,r,i){if((t=!!(e.mode&32))&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(xu())e.flags|=8192;else throw ga=fa,ua}}else e.flags&=-16777217}function Ec(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Wf(t)){if(xu())e.flags|=8192;else throw ga=fa,ua}}function Dc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ue(),e.lanes|=t,Kl|=t)}function Oc(e,t){if(!xi)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function kc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Ac(e,t,n){var r=t.pendingProps;switch(_i(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kc(t),null;case 1:return kc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ii(Ji),se(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Oi(t)?wc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ai())),kc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(wc(t),o===null?(kc(t),Tc(t,a,null,r,n)):(kc(t),Ec(t,o))):o?o===e.memoizedState?(kc(t),t.flags&=-16777217):(wc(t),kc(t),Ec(t,o)):(e=e.memoizedProps,e!==r&&wc(t),kc(t),Tc(t,a,e,r,n)),null;case 27:if(le(t),n=ie.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&wc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return kc(t),null}e=z.current,Oi(t)?Ei(t,e):(e=ff(a,r,n),t.stateNode=e,wc(t))}return kc(t),null;case 5:if(le(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&wc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return kc(t),null}if(o=z.current,Oi(t))Ei(t,o);else{var s=Bd(ie.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[Qe]=t,o[$e]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(Pd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&wc(t)}}return kc(t),Tc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&wc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=ie.current,Oi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=yi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[Qe]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||jd(e.nodeValue,n)),e||Ti(t,!0)}else e=Bd(e).createTextNode(r),e[Qe]=t,t.stateNode=e}return kc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Oi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[Qe]=t}else ki(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;kc(t),e=!1}else n=Ai(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Xa(t),t):(Xa(t),null);if(t.flags&128)throw Error(i(558))}return kc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Oi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[Qe]=t}else ki(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;kc(t),a=!1}else a=Ai(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Xa(t),t):(Xa(t),null)}return Xa(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Dc(t,t.updateQueue),kc(t),null);case 4:return se(),e===null&&xd(t.stateNode.containerInfo),kc(t),null;case 10:return Ii(t.type),kc(t),null;case 19:if(ne(Za),r=t.memoizedState,r===null)return kc(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)Oc(r,!1);else{if(Hl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Qa(e),o!==null){for(t.flags|=128,Oc(r,!1),e=o.updateQueue,t.updateQueue=e,Dc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Zr(n,e),n=n.sibling;return R(Za,Za.current&1|2),xi&&mi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ce()>Ql&&(t.flags|=128,a=!0,Oc(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Qa(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Dc(t,e),Oc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!xi)return kc(t),null}else 2*Ce()-r.renderingStartTime>Ql&&n!==536870912&&(t.flags|=128,a=!0,Oc(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(kc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ce(),e.sibling=null,n=Za.current,R(Za,a?n&1|2:n&1),xi&&mi(t,r.treeForkCount),e);case 22:case 23:return Xa(t),Ua(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(kc(t),t.subtreeFlags&6&&(t.flags|=8192)):kc(t),n=t.updateQueue,n!==null&&Dc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ne(aa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ii(Ji),kc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function jc(e,t){switch(_i(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ii(Ji),se(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return le(t),null;case 31:if(t.memoizedState!==null){if(Xa(t),t.alternate===null)throw Error(i(340));ki()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Xa(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));ki()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ne(Za),null;case 4:return se(),null;case 10:return Ii(t.type),null;case 22:case 23:return Xa(t),Ua(),e!==null&&ne(aa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ii(Ji),null;case 25:return null;default:return null}}function Mc(e,t){switch(_i(t),t.tag){case 3:Ii(Ji),se();break;case 26:case 27:case 5:le(t);break;case 4:se();break;case 31:t.memoizedState!==null&&Xa(t);break;case 13:Xa(t);break;case 19:ne(Za);break;case 10:Ii(t.type);break;case 22:case 23:Xa(t),Ua(),e!==null&&ne(aa);break;case 24:Ii(Ji)}}function Nc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){Hu(t,t.return,e)}}function Pc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){Hu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Hu(t,t.return,e)}}function Fc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Ra(t,n)}catch(t){Hu(e,e.return,t)}}}function Ic(e,t,n){n.props=Ls(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Hu(e,t,n)}}function Lc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){Hu(e,t,n)}}function Rc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){Hu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){Hu(e,t,n)}else n.current=null}}function zc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){Hu(e,e.return,t)}}function Bc(e,t,n){try{var r=e.stateNode;Fd(r,e.type,n,t),r[$e]=t}catch(t){Hu(e,e.return,t)}}function Vc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Zd(e.type)||e.tag===4}function Hc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Vc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Zd(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Uc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Vt));else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Uc(e,t,n),e=e.sibling;e!==null;)Uc(e,t,n),e=e.sibling}function Wc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&Zd(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Wc(e,t,n),e=e.sibling;e!==null;)Wc(e,t,n),e=e.sibling}function Gc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Pd(t,r,n),t[Qe]=e,t[$e]=n}catch(t){Hu(e,e.return,t)}}var Kc=!1,qc=!1,Jc=!1,Yc=typeof WeakSet==`function`?WeakSet:Set,Xc=null;function Zc(e,t){if(e=e.containerInfo,Rd=sp,e=mr(e),hr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(zd={focusedElem:e,selectionRange:n},sp=!1,Xc=t;Xc!==null;)if(t=Xc,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,Xc=e;else for(;Xc!==null;){switch(t=Xc,o=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Ls(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Hu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)ef(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:ef(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,Xc=e;break}Xc=t.return}}function Qc(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:pl(e,n),r&4&&Nc(5,n);break;case 1:if(pl(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Hu(n,n.return,e)}else{var i=Ls(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Hu(n,n.return,e)}}}r&64&&Fc(n),r&512&&Lc(n,n.return);break;case 3:if(pl(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Ra(e,t)}catch(e){Hu(n,n.return,e)}}break;case 27:t===null&&r&4&&Gc(n);case 26:case 5:pl(e,n),t===null&&r&4&&zc(n),r&512&&Lc(n,n.return);break;case 12:pl(e,n);break;case 31:pl(e,n),r&4&&il(e,n);break;case 13:pl(e,n),r&4&&al(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Ku.bind(null,n),sf(e,n))));break;case 22:if(r=n.memoizedState!==null||Kc,!r){t=t!==null&&t.memoizedState!==null||qc,i=Kc;var a=qc;Kc=r,(qc=t)&&!a?hl(e,n,!!(n.subtreeFlags&8772)):pl(e,n),Kc=i,qc=a}break;case 30:break;default:pl(e,n)}}function $c(e){var t=e.alternate;t!==null&&(e.alternate=null,$c(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&K(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var el=null,tl=!1;function nl(e,t,n){for(n=n.child;n!==null;)rl(e,t,n),n=n.sibling}function rl(e,t,n){if(Me&&typeof Me.onCommitFiberUnmount==`function`)try{Me.onCommitFiberUnmount(je,n)}catch{}switch(n.tag){case 26:qc||Rc(n,t),nl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:qc||Rc(n,t);var r=el,i=tl;Zd(n.type)&&(el=n.stateNode,tl=!1),nl(e,t,n),pf(n.stateNode),el=r,tl=i;break;case 5:qc||Rc(n,t);case 6:if(r=el,i=tl,el=null,nl(e,t,n),el=r,tl=i,el!==null){if(tl)try{(el.nodeType===9?el.body:el.nodeName===`HTML`?el.ownerDocument.body:el).removeChild(n.stateNode)}catch(e){Hu(n,t,e)}else try{el.removeChild(n.stateNode)}catch(e){Hu(n,t,e)}}break;case 18:el!==null&&(tl?(e=el,Qd(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Np(e)):Qd(el,n.stateNode));break;case 4:r=el,i=tl,el=n.stateNode.containerInfo,tl=!0,nl(e,t,n),el=r,tl=i;break;case 0:case 11:case 14:case 15:Pc(2,n,t),qc||Pc(4,n,t),nl(e,t,n);break;case 1:qc||(Rc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Ic(n,t,r)),nl(e,t,n);break;case 21:nl(e,t,n);break;case 22:qc=(r=qc)||n.memoizedState!==null,nl(e,t,n),qc=r;break;default:nl(e,t,n)}}function il(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Np(e)}catch(e){Hu(t,t.return,e)}}}function al(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Np(e)}catch(e){Hu(t,t.return,e)}}function ol(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Yc),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Yc),t;default:throw Error(i(435,e.tag))}}function sl(e,t){var n=ol(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=qu.bind(null,e,t);t.then(r,r)}})}function cl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(Zd(c.type)){el=c.stateNode,tl=!1;break a}break;case 5:el=c.stateNode,tl=!1;break a;case 3:case 4:el=c.stateNode.containerInfo,tl=!0;break a}c=c.return}if(el===null)throw Error(i(160));rl(o,s,a),el=null,tl=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ul(t,e),t=t.sibling}var ll=null;function ul(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:cl(t,e),dl(e),r&4&&(Pc(3,e,e.return),Nc(3,e),Pc(5,e,e.return));break;case 1:cl(t,e),dl(e),r&512&&(qc||n===null||Rc(n,n.return)),r&64&&Kc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var a=ll;if(cl(t,e),dl(e),r&512&&(qc||n===null||Rc(n,n.return)),r&4){var o=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null){if(r===null){if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[at]||o[Qe]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Pd(o,r,n),o[Qe]=e,ut(o),r=o;break a;case`link`:var s=Vf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Vf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Pd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[Qe]=e,ut(o),r=o}e.stateNode=r}else Hf(a,e.type,e.stateNode)}else e.stateNode=If(a,r,e.memoizedProps)}else o===r?r===null&&e.stateNode!==null&&Bc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Hf(a,e.type,e.stateNode):If(a,r,e.memoizedProps))}break;case 27:cl(t,e),dl(e),r&512&&(qc||n===null||Rc(n,n.return)),n!==null&&r&4&&Bc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(cl(t,e),dl(e),r&512&&(qc||n===null||Rc(n,n.return)),e.flags&32){a=e.stateNode;try{Nt(a,``)}catch(t){Hu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Bc(e,a,n===null?a:n.memoizedProps)),r&1024&&(Jc=!0);break;case 6:if(cl(t,e),dl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Hu(e,e.return,t)}}break;case 3:if(Bf=null,a=ll,ll=gf(t.containerInfo),cl(t,e),ll=a,dl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Np(t.containerInfo)}catch(t){Hu(e,e.return,t)}Jc&&(Jc=!1,fl(e));break;case 4:r=ll,ll=gf(e.stateNode.containerInfo),cl(t,e),dl(e),ll=r;break;case 12:cl(t,e),dl(e);break;case 31:cl(t,e),dl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 13:cl(t,e),dl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Xl=Ce()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Kc,d=qc;if(Kc=u||a,qc=d||l,cl(t,e),qc=d,Kc=u,dl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||Kc||qc||ml(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){Hu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Hu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?$d(m,!0):$d(l.stateNode,!1)}catch(e){Hu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,sl(e,n))));break;case 19:cl(t,e),dl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 30:break;case 21:break;default:cl(t,e),dl(e)}}function dl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Vc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Wc(e,Hc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(Nt(o,``),n.flags&=-33),Wc(e,Hc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Uc(e,Hc(e),s);break;default:throw Error(i(161))}}catch(t){Hu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function fl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;fl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function pl(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Qc(e,t.alternate,t),t=t.sibling}function ml(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Pc(4,t,t.return),ml(t);break;case 1:Rc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Ic(t,t.return,n),ml(t);break;case 27:pf(t.stateNode);case 26:case 5:Rc(t,t.return),ml(t);break;case 22:t.memoizedState===null&&ml(t);break;case 30:ml(t);break;default:ml(t)}e=e.sibling}}function hl(e,t,n){for(n&&=!!(t.subtreeFlags&8772),t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:hl(i,a,n),Nc(4,a);break;case 1:if(hl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Hu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)La(c[i],s)}catch(e){Hu(r,r.return,e)}}n&&o&64&&Fc(a),Lc(a,a.return);break;case 27:Gc(a);case 26:case 5:hl(i,a,n),n&&r===null&&o&4&&zc(a),Lc(a,a.return);break;case 12:hl(i,a,n);break;case 31:hl(i,a,n),n&&o&4&&il(i,a);break;case 13:hl(i,a,n),n&&o&4&&al(i,a);break;case 22:a.memoizedState===null&&hl(i,a,n),Lc(a,a.return);break;case 30:break;default:hl(i,a,n)}t=t.sibling}}function gl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Xi(n))}function _l(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Xi(e))}function vl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)yl(e,t,n,r),t=t.sibling}function yl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:vl(e,t,n,r),i&2048&&Nc(9,t);break;case 1:vl(e,t,n,r);break;case 3:vl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Xi(e)));break;case 12:if(i&2048){vl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){Hu(t,t.return,e)}}else vl(e,t,n,r);break;case 31:vl(e,t,n,r);break;case 13:vl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?vl(e,t,n,r):(a._visibility|=2,bl(e,t,n,r,!!(t.subtreeFlags&10256)||!1)):a._visibility&2?vl(e,t,n,r):xl(e,t),i&2048&&gl(o,t);break;case 24:vl(e,t,n,r),i&2048&&_l(t.alternate,t);break;default:vl(e,t,n,r)}}function bl(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:bl(a,o,s,c,i),Nc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,bl(a,o,s,c,i)):u._visibility&2?bl(a,o,s,c,i):xl(a,o),i&&l&2048&&gl(o.alternate,o);break;case 24:bl(a,o,s,c,i),i&&l&2048&&_l(o.alternate,o);break;default:bl(a,o,s,c,i)}t=t.sibling}}function xl(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:xl(n,r),i&2048&&gl(r.alternate,r);break;case 24:xl(n,r),i&2048&&_l(r.alternate,r);break;default:xl(n,r)}t=t.sibling}}var Sl=8192;function Cl(e,t,n){if(e.subtreeFlags&Sl)for(e=e.child;e!==null;)wl(e,t,n),e=e.sibling}function wl(e,t,n){switch(e.tag){case 26:Cl(e,t,n),e.flags&Sl&&e.memoizedState!==null&&Gf(n,ll,e.memoizedState,e.memoizedProps);break;case 5:Cl(e,t,n);break;case 3:case 4:var r=ll;ll=gf(e.stateNode.containerInfo),Cl(e,t,n),ll=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Sl,Sl=16777216,Cl(e,t,n),Sl=r):Cl(e,t,n));break;default:Cl(e,t,n)}}function Tl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function El(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Xc=r,kl(r,e)}Tl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Dl(e),e=e.sibling}function Dl(e){switch(e.tag){case 0:case 11:case 15:El(e),e.flags&2048&&Pc(9,e,e.return);break;case 3:El(e);break;case 12:El(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ol(e)):El(e);break;default:El(e)}}function Ol(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];Xc=r,kl(r,e)}Tl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Pc(8,t,t.return),Ol(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ol(t));break;default:Ol(t)}e=e.sibling}}function kl(e,t){for(;Xc!==null;){var n=Xc;switch(n.tag){case 0:case 11:case 15:Pc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Xi(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Xc=r;else a:for(n=e;Xc!==null;){r=Xc;var i=r.sibling,a=r.return;if($c(r),r===n){Xc=null;break a}if(i!==null){i.return=a,Xc=i;break a}Xc=a}}}var Al={getCacheForType:function(e){var t=Hi(Ji),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Hi(Ji).controller.signal}},jl=typeof WeakMap==`function`?WeakMap:Map,Ml=0,Nl=null,Pl=null,Fl=0,Il=0,Ll=null,Rl=!1,zl=!1,Bl=!1,Vl=0,Hl=0,Ul=0,Wl=0,Gl=0,$=0,Kl=0,ql=null,Jl=null,Yl=!1,Xl=0,Zl=0,Ql=1/0,$l=null,eu=null,tu=0,nu=null,ru=null,iu=0,au=0,ou=null,su=null,cu=0,lu=null;function uu(){return Ml&2&&Fl!==0?Fl&-Fl:P.T===null?Ye():ld()}function du(){if($===0){if(!(Fl&536870912)||xi){var e=Le;Le<<=1,!(Le&3932160)&&(Le=262144),$=e}else $=536870912}return e=Wa.current,e!==null&&(e.flags|=32),$}function fu(e,t,n){(e===Nl&&(Il===2||Il===9)||e.cancelPendingCommit!==null)&&(yu(e,0),gu(e,Fl,$,!1)),Ge(e,n),(!(Ml&2)||e!==Nl)&&(e===Nl&&(!(Ml&2)&&(Wl|=n),Hl===4&&gu(e,Fl,$,!1)),td(e))}function pu(e,t,n){if(Ml&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||Ve(e,t),a=r?Du(e,t):Tu(e,t,!0),o=r;do{if(a===0){zl&&!r&&gu(e,t,0,!1);break}if(n=e.current.alternate,o&&!hu(n)){a=Tu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=ql;var l=c.current.memoizedState.isDehydrated;if(l&&(yu(c,s).flags|=256),s=Tu(c,s,!1),s!==2){if(Bl&&!l){c.errorRecoveryDisabledLanes|=o,Wl|=o,a=4;break a}o=Jl,Jl=a,o!==null&&(Jl===null?Jl=o:Jl.push.apply(Jl,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){yu(e,0),gu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:gu(r,t,$,!Rl);break a;case 2:Jl=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Xl+300-Ce(),10<a)){if(gu(r,t,$,!Rl),Be(r,0,!0)!==0)break a;iu=t,r.timeoutHandle=Kd(mu.bind(null,r,n,Jl,$l,Yl,t,$,Wl,Kl,Rl,o,`Throttled`,-0,0),a);break a}mu(r,n,Jl,$l,Yl,t,$,Wl,Kl,Rl,o,null,-0,0)}break}while(1);td(e)}function mu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Vt},wl(t,a,d);var m=(a&62914560)===a?Xl-Ce():(a&4194048)===a?Zl-Ce():0;if(m=qf(d,m),m!==null){iu=a,e.cancelPendingCommit=m(Pu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),gu(e,a,o,!l);return}}Pu(e,t,a,n,r,i,o,s,c)}function hu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!lr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function gu(e,t,n,r){t&=~Gl,t&=~Wl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-H(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ke(e,n,t)}function _u(){return Ml&6?!0:(nd(0,!1),!1)}function vu(){if(Pl!==null){if(Il===0)var e=Pl.return;else e=Pl,Pi=Ni=null,yo(e),ya=null,ba=0,e=Pl;for(;e!==null;)Mc(e.alternate,e),e=e.return;Pl=null}}function yu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,qd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),iu=0,vu(),Nl=e,Pl=n=Xr(e.current,null),Fl=t,Il=0,Ll=null,Rl=!1,zl=Ve(e,t),Bl=!1,Kl=$=Gl=Wl=Ul=Hl=0,Jl=ql=null,Yl=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-H(r),a=1<<i;t|=e[i],r&=~a}return Vl=t,Q(),n}function bu(e,t){eo=null,P.H=ks,t===la||t===da?(t=_a(),Il=3):t===ua?(t=_a(),Il=4):Il=t===qs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Ll=t,Pl===null&&(Hl=1,Vs(e,ii(t,e.current)))}function xu(){var e=Wa.current;return e===null?!0:(Fl&4194048)===Fl?Ga===null:(Fl&62914560)===Fl||Fl&536870912?e===Ga:!1}function Su(){var e=P.H;return P.H=ks,e===null?ks:e}function Cu(){var e=P.A;return P.A=Al,e}function wu(){Hl=4,Rl||(Fl&4194048)!==Fl&&Wa.current!==null||(zl=!0),!(Ul&134217727)&&!(Wl&134217727)||Nl===null||gu(Nl,Fl,$,!1)}function Tu(e,t,n){var r=Ml;Ml|=2;var i=Su(),a=Cu();(Nl!==e||Fl!==t)&&($l=null,yu(e,t)),t=!1;var o=Hl;a:do try{if(Il!==0&&Pl!==null){var s=Pl,c=Ll;switch(Il){case 8:vu(),o=6;break a;case 3:case 2:case 9:case 6:Wa.current===null&&(t=!0);var l=Il;if(Il=0,Ll=null,ju(e,s,c,l),n&&zl){o=0;break a}break;default:l=Il,Il=0,Ll=null,ju(e,s,c,l)}}Eu(),o=Hl;break}catch(t){bu(e,t)}while(1);return t&&e.shellSuspendCounter++,Pi=Ni=null,Ml=r,P.H=i,P.A=a,Pl===null&&(Nl=null,Fl=0,Q()),o}function Eu(){for(;Pl!==null;)ku(Pl)}function Du(e,t){var n=Ml;Ml|=2;var r=Su(),a=Cu();Nl!==e||Fl!==t?($l=null,Ql=Ce()+500,yu(e,t)):zl=Ve(e,t);a:do try{if(Il!==0&&Pl!==null){t=Pl;var o=Ll;b:switch(Il){case 1:Il=0,Ll=null,ju(e,t,o,1);break;case 2:case 9:if(pa(o)){Il=0,Ll=null,Au(t);break}t=function(){Il!==2&&Il!==9||Nl!==e||(Il=7),td(e)},o.then(t,t);break a;case 3:Il=7;break a;case 4:Il=5;break a;case 7:pa(o)?(Il=0,Ll=null,Au(t)):(Il=0,Ll=null,ju(e,t,o,7));break;case 5:var s=null;switch(Pl.tag){case 26:s=Pl.memoizedState;case 5:case 27:var c=Pl;if(s?Wf(s):c.stateNode.complete){Il=0,Ll=null;var l=c.sibling;if(l!==null)Pl=l;else{var u=c.return;u===null?Pl=null:(Pl=u,Mu(u))}break b}}Il=0,Ll=null,ju(e,t,o,5);break;case 6:Il=0,Ll=null,ju(e,t,o,6);break;case 8:vu(),Hl=6;break a;default:throw Error(i(462))}}Ou();break}catch(t){bu(e,t)}while(1);return Pi=Ni=null,P.H=r,P.A=a,Ml=n,Pl===null?(Nl=null,Fl=0,Q(),Hl):0}function Ou(){for(;Pl!==null&&!xe();)ku(Pl)}function ku(e){var t=Cc(e.alternate,e,Vl);e.memoizedProps=e.pendingProps,t===null?Mu(e):Pl=t}function Au(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=sc(n,t,t.pendingProps,t.type,void 0,Fl);break;case 11:t=sc(n,t,t.pendingProps,t.type.render,t.ref,Fl);break;case 5:yo(t);default:Mc(n,t),t=Pl=Zr(t,Vl),t=Cc(n,t,Vl)}e.memoizedProps=e.pendingProps,t===null?Mu(e):Pl=t}function ju(e,t,n,r){Pi=Ni=null,yo(t),ya=null,ba=0;var i=t.return;try{if(Ks(e,i,t,n,Fl)){Hl=1,Vs(e,ii(n,e.current)),Pl=null;return}}catch(t){if(i!==null)throw Pl=i,t;Hl=1,Vs(e,ii(n,e.current)),Pl=null;return}t.flags&32768?(xi||r===1?e=!0:zl||Fl&536870912?e=!1:(Rl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Wa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Nu(t,e)):Mu(t)}function Mu(e){var t=e;do{if(t.flags&32768){Nu(t,Rl);return}e=t.return;var n=Ac(t.alternate,t,Vl);if(n!==null){Pl=n;return}if(t=t.sibling,t!==null){Pl=t;return}Pl=t=e}while(t!==null);Hl===0&&(Hl=5)}function Nu(e,t){do{var n=jc(e.alternate,e);if(n!==null){n.flags&=32767,Pl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Pl=e;return}Pl=e=n}while(e!==null);Hl=6,Pl=null}function Pu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do zu();while(tu!==0);if(Ml&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=Br,U(e,n,o,s,c,l),e===Nl&&(Pl=Nl=null,Fl=0),ru=t,nu=e,iu=n,au=o,ou=a,su=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,Ju(Ee,function(){return Bu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=P.T,P.T=null,a=F.p,F.p=2,s=Ml,Ml|=4;try{Zc(e,t,n)}finally{Ml=s,F.p=a,P.T=r}}tu=1,Fu(),Iu(),Lu()}}function Fu(){if(tu===1){tu=0;var e=nu,t=ru,n=!!(t.flags&13878);if(t.subtreeFlags&13878||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Ml;Ml|=4;try{ul(t,e);var a=zd,o=mr(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&pr(s.ownerDocument.documentElement,s)){if(c!==null&&hr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=fr(s,h),v=fr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}sp=!!Rd,zd=Rd=null}finally{Ml=i,F.p=r,P.T=n}}e.current=t,tu=2}}function Iu(){if(tu===2){tu=0;var e=nu,t=ru,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Ml;Ml|=4;try{Qc(e,t.alternate,t)}finally{Ml=i,F.p=r,P.T=n}}tu=3}}function Lu(){if(tu===4||tu===3){tu=0,Se();var e=nu,t=ru,n=iu,r=su;t.subtreeFlags&10256||t.flags&10256?tu=5:(tu=0,ru=nu=null,Ru(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(eu=null),Je(n),t=t.stateNode,Me&&typeof Me.onCommitFiberRoot==`function`)try{Me.onCommitFiberRoot(je,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=P.T,i=F.p,F.p=2,P.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{P.T=t,F.p=i}}iu&3&&zu(),td(e),i=e.pendingLanes,n&261930&&i&42?e===lu?cu++:(cu=0,lu=e):cu=0,nd(0,!1)}}function Ru(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Xi(t)))}function zu(){return Fu(),Iu(),Lu(),Bu()}function Bu(){if(tu!==5)return!1;var e=nu,t=au;au=0;var n=Je(iu),r=P.T,a=F.p;try{F.p=32>n?32:n,P.T=null,n=ou,ou=null;var o=nu,s=iu;if(tu=0,ru=nu=null,iu=0,Ml&6)throw Error(i(331));var c=Ml;if(Ml|=4,Dl(o.current),yl(o,o.current,s,n),Ml=c,nd(0,!1),Me&&typeof Me.onPostCommitFiberRoot==`function`)try{Me.onPostCommitFiberRoot(je,o)}catch{}return!0}finally{F.p=a,P.T=r,Ru(e,t)}}function Vu(e,t,n){t=ii(n,t),t=Us(e.stateNode,t,2),e=ja(e,t,2),e!==null&&(Ge(e,2),td(e))}function Hu(e,t,n){if(e.tag===3)Vu(e,e,n);else for(;t!==null;){if(t.tag===3){Vu(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(eu===null||!eu.has(r))){e=ii(n,e),n=Ws(2),r=ja(t,n,2),r!==null&&(Gs(n,r,t,e),Ge(r,2),td(r));break}}t=t.return}}function Uu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new jl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Bl=!0,i.add(n),e=Wu.bind(null,e,t,n),t.then(e,e))}function Wu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Nl===e&&(Fl&n)===n&&(Hl===4||Hl===3&&(Fl&62914560)===Fl&&300>Ce()-Xl?!(Ml&2)&&yu(e,0):Gl|=n,Kl===Fl&&(Kl=0)),td(e)}function Gu(e,t){t===0&&(t=Ue()),e=Ur(e,t),e!==null&&(Ge(e,t),td(e))}function Ku(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Gu(e,n)}function qu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),Gu(e,n)}function Ju(e,t){return ye(e,t)}var Yu=null,Xu=null,Zu=!1,Qu=!1,$u=!1,ed=0;function td(e){e!==Xu&&e.next===null&&(Xu===null?Yu=Xu=e:Xu=Xu.next=e),Qu=!0,Zu||(Zu=!0,cd())}function nd(e,t){if(!$u&&Qu){$u=!0;do for(var n=!1,r=Yu;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-H(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,sd(r,a))}else a=Fl,a=Be(r,r===Nl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ve(r,a)||(n=!0,sd(r,a))}r=r.next}while(n);$u=!1}}function rd(){id()}function id(){Qu=Zu=!1;var e=0;ed!==0&&Gd()&&(e=ed);for(var t=Ce(),n=null,r=Yu;r!==null;){var i=r.next,a=ad(r,t);a===0?(r.next=null,n===null?Yu=i:n.next=i,i===null&&(Xu=n)):(n=r,(e!==0||a&3)&&(Qu=!0)),r=i}tu!==0&&tu!==5||nd(e,!1),ed!==0&&(ed=0)}function ad(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-H(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=He(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Nl,n=Fl,n=Be(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Il===2||Il===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&be(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ve(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&be(r),Je(n)){case 2:case 8:n=Te;break;case 32:n=Ee;break;case 268435456:n=Oe;break;default:n=Ee}return r=od.bind(null,e),n=ye(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&be(r),e.callbackPriority=2,e.callbackNode=null,2}function od(e,t){if(tu!==0&&tu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(zu()&&e.callbackNode!==n)return null;var r=Fl;return r=Be(e,e===Nl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(pu(e,r,t),ad(e,Ce()),e.callbackNode!=null&&e.callbackNode===n?od.bind(null,e):null)}function sd(e,t){if(zu())return null;pu(e,t,!0)}function cd(){Yd(function(){Ml&6?ye(B,rd):id()})}function ld(){if(ed===0){var e=$i;e===0&&(e=Ie,Ie<<=1,!(Ie&261888)&&(Ie=256)),ed=e}return ed}function ud(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Bt(``+e)}function dd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function fd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=ud((i[$e]||null).action),o=r.submitter;o&&(t=(t=o[$e]||null)?ud(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new ln(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ed!==0){var e=o?dd(i,o):new FormData(i);hs(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?dd(i,o):new FormData(i),hs(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var pd=0;pd<Fr.length;pd++){var md=Fr[pd];Ir(md.toLowerCase(),`on`+(md[0].toUpperCase()+md.slice(1)))}Ir(Dr,`onAnimationEnd`),Ir(Or,`onAnimationIteration`),Ir(kr,`onAnimationStart`),Ir(`dblclick`,`onDoubleClick`),Ir(`focusin`,`onFocus`),Ir(`focusout`,`onBlur`),Ir(Ar,`onTransitionRun`),Ir(jr,`onTransitionStart`),Ir(Mr,`onTransitionCancel`),Ir(Nr,`onTransitionEnd`),mt(`onMouseEnter`,[`mouseout`,`mouseover`]),mt(`onMouseLeave`,[`mouseout`,`mouseover`]),mt(`onPointerEnter`,[`pointerout`,`pointerover`]),mt(`onPointerLeave`,[`pointerout`,`pointerover`]),pt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),pt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),pt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),pt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),pt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),pt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var hd=`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(` `),gd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(hd));function _d(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Lr(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Lr(e)}i.currentTarget=null,a=c}}}}function vd(e,t){var n=t[tt];n===void 0&&(n=t[tt]=new Set);var r=e+`__bubble`;n.has(r)||(Sd(t,e,2,!1),n.add(r))}function yd(e,t,n){var r=0;t&&(r|=4),Sd(n,e,r,t)}var bd=`_reactListening`+Math.random().toString(36).slice(2);function xd(e){if(!e[bd]){e[bd]=!0,dt.forEach(function(t){t!==`selectionchange`&&(gd.has(t)||yd(t,!1,e),yd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[bd]||(t[bd]=!0,yd(`selectionchange`,!1,t))}}function Sd(e,t,n,r){switch(mp(t)){case 2:var i=cp;break;case 8:i=lp;break;default:i=up}n=i.bind(null,t,n,e),i=void 0,!Zt||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Cd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=ot(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}Jt(function(){var r=a,i=Ut(n),s=[];a:{var c=Pr.get(e);if(c!==void 0){var l=ln,u=e;switch(e){case`keypress`:if(rn(n)===0)break a;case`keydown`:case`keyup`:l=Dn;break;case`focusin`:u=`focus`,l=vn;break;case`focusout`:u=`blur`,l=vn;break;case`beforeblur`:case`afterblur`:l=vn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=gn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=_n;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=kn;break;case Dr:case Or:case kr:l=yn;break;case Nr:l=An;break;case`scroll`:case`scrollend`:l=dn;break;case`wheel`:l=jn;break;case`copy`:case`cut`:case`paste`:l=bn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=On;break;case`toggle`:case`beforetoggle`:l=Mn}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=Yt(m,p),g!=null&&d.push(wd(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==Ht&&(u=n.relatedTarget||n.fromElement)&&(ot(u)||u[et]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?ot(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=gn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=On,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:ct(l),h=u==null?c:ct(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,ot(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ed,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&Dd(s,c,l,d,!1),u!==null&&f!==null&&Dd(s,f,u,d,!0)}}a:{if(c=r?ct(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=Zn;else if(Kn(c)){if(Qn)v=sr;else{v=ar;var y=ir}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Lt(r.elementType)&&(v=Zn):v=or;if(v&&=v(e,r)){qn(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&kt(c,`number`,c.value)}switch(y=r?ct(r):window,e){case`focusin`:(Kn(y)||y.contentEditable===`true`)&&(_r=y,vr=r,yr=null);break;case`focusout`:yr=vr=_r=null;break;case`mousedown`:br=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:br=!1,xr(s,n,i);break;case`selectionchange`:if(gr)break;case`keydown`:case`keyup`:xr(s,n,i)}var b;if(Pn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else Hn?Bn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Ln&&n.locale!==`ko`&&(Hn||x!==`onCompositionStart`?x===`onCompositionEnd`&&Hn&&(b=nn()):($t=i,en=`value`in $t?$t.value:$t.textContent,Hn=!0)),y=Td(r,x),0<y.length&&(x=new xn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=Vn(n),b!==null&&(x.data=b)))),(b=In?Un(e,n):Wn(e,n))&&(x=Td(r,`onBeforeInput`),0<x.length&&(y=new xn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),fd(s,e,r,n,i)}_d(s,t)})}function wd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Td(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=Yt(e,n),i!=null&&r.unshift(wd(e,i,a)),i=Yt(e,t),i!=null&&r.push(wd(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ed(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Dd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=Yt(n,a),l!=null&&o.unshift(wd(n,l,c))):i||(l=Yt(n,a),l!=null&&o.push(wd(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Od=/\r\n?/g,kd=/\u0000|\uFFFD/g;function Ad(e){return(typeof e==`string`?e:``+e).replace(Od,`
10
+ `).replace(kd,``)}function jd(e,t){return t=Ad(t),Ad(e)===t}function Md(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||Nt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&Nt(e,``+r);break;case`className`:vt(e,`class`,r);break;case`tabIndex`:vt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:vt(e,n,r);break;case`style`:It(e,r,o);break;case`data`:if(t!==`object`){vt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Bt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&Md(e,t,`name`,a.name,a,null),Md(e,t,`formEncType`,a.formEncType,a,null),Md(e,t,`formMethod`,a.formMethod,a,null),Md(e,t,`formTarget`,a.formTarget,a,null)):(Md(e,t,`encType`,a.encType,a,null),Md(e,t,`method`,a.method,a,null),Md(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Bt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=Vt);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Bt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:vd(`beforetoggle`,e),vd(`toggle`,e),_t(e,`popover`,r);break;case`xlinkActuate`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:yt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:_t(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Rt.get(n)||n,_t(e,n,r))}}function Nd(e,t,n,r,a,o){switch(n){case`style`:It(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?Nt(e,r):(typeof r==`number`||typeof r==`bigint`)&&Nt(e,``+r);break;case`onScroll`:r!=null&&vd(`scroll`,e);break;case`onScrollEnd`:r!=null&&vd(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=Vt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!ft.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[$e]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):_t(e,n,r)}}}function Pd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:vd(`error`,e),vd(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,o,s,n,null)}}a&&Md(e,t,`srcSet`,n.srcSet,n,null),r&&Md(e,t,`src`,n.src,n,null);return;case`input`:vd(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Md(e,t,r,d,n,null)}}Ot(e,o,c,l,u,s,a,!1);return;case`select`:for(a in vd(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Md(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&At(e,!!r,n,!0):At(e,!!r,t,!1);return;case`textarea`:for(s in vd(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Md(e,t,s,c,n,null)}Mt(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Md(e,t,l,r,n,null)}return;case`dialog`:vd(`beforetoggle`,e),vd(`toggle`,e),vd(`cancel`,e),vd(`close`,e);break;case`iframe`:case`object`:vd(`load`,e);break;case`video`:case`audio`:for(r=0;r<hd.length;r++)vd(hd[r],e);break;case`image`:vd(`error`,e),vd(`load`,e);break;case`details`:vd(`toggle`,e);break;case`embed`:case`source`:case`link`:vd(`error`,e),vd(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Md(e,t,u,r,n,null)}return;default:if(Lt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Nd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Md(e,t,c,r,n,null))}function Fd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Md(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:o=m;break;case`name`:a=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&Md(e,t,p,m,r,f)}}Dt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Md(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Md(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?At(e,!!n,n?[]:``,!1):At(e,!!n,t,!0)):At(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Md(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Md(e,t,s,a,r,o)}jt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Md(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Md(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Md(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:Md(e,t,u,p,r,m)}return;default:if(Lt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Nd(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Nd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Md(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Md(e,t,f,p,r,m)}function Id(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Ld(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Id(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Id(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Rd=null,zd=null;function Bd(e){return e.nodeType===9?e:e.ownerDocument}function Vd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Hd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Ud(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Wd=null;function Gd(){var e=window.event;return e&&e.type===`popstate`?e!==Wd&&(Wd=e,!0):(Wd=null,!1)}var Kd=typeof setTimeout==`function`?setTimeout:void 0,qd=typeof clearTimeout==`function`?clearTimeout:void 0,Jd=typeof Promise==`function`?Promise:void 0,Yd=typeof queueMicrotask==`function`?queueMicrotask:Jd===void 0?Kd:function(e){return Jd.resolve(null).then(e).catch(Xd)};function Xd(e){setTimeout(function(){throw e})}function Zd(e){return e===`head`}function Qd(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Np(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)pf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,pf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[at]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&pf(e.ownerDocument.body)}n=i}while(n);Np(t)}function $d(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function ef(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:ef(n),K(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function tf(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[at])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=cf(e.nextSibling),e===null)break}return null}function nf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=cf(e.nextSibling),e===null))return null;return e}function rf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=cf(e.nextSibling),e===null))return null;return e}function af(e){return e.data===`$?`||e.data===`$~`}function of(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function sf(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function cf(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var lf=null;function uf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return cf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function df(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function ff(e,t,n){switch(t=Bd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function pf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);K(e)}var mf=new Map,hf=new Set;function gf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var _f=F.d;F.d={f:vf,r:yf,D:Sf,C:Cf,L:wf,m:Tf,X:Df,S:Ef,M:Of};function vf(){var e=_f.f(),t=_u();return e||t}function yf(e){var t=st(e);t!==null&&t.tag===5&&t.type===`form`?_s(t):_f.r(e)}var bf=typeof document>`u`?null:document;function xf(e,t,n){var r=bf;if(r&&typeof t==`string`&&t){var i=X(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),hf.has(i)||(hf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Pd(t,`link`,e),ut(t),r.head.appendChild(t)))}}function Sf(e){_f.D(e),xf(`dns-prefetch`,e,null)}function Cf(e,t){_f.C(e,t),xf(`preconnect`,e,t)}function wf(e,t,n){_f.L(e,t,n);var r=bf;if(r&&e&&t){var i=`link[rel="preload"][as="`+X(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+X(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+X(n.imageSizes)+`"]`)):i+=`[href="`+X(e)+`"]`;var a=i;switch(t){case`style`:a=Af(e);break;case`script`:a=Pf(e)}mf.has(a)||(e=f({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),mf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(jf(a))||t===`script`&&r.querySelector(Ff(a))||(t=r.createElement(`link`),Pd(t,`link`,e),ut(t),r.head.appendChild(t)))}}function Tf(e,t){_f.m(e,t);var n=bf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+X(r)+`"][href="`+X(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Pf(e)}if(!mf.has(a)&&(e=f({rel:`modulepreload`,href:e},t),mf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Ff(a)))return}r=n.createElement(`link`),Pd(r,`link`,e),ut(r),n.head.appendChild(r)}}}function Ef(e,t,n){_f.S(e,t,n);var r=bf;if(r&&e){var i=lt(r).hoistableStyles,a=Af(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(jf(a)))s.loading=5;else{e=f({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=mf.get(a))&&Rf(e,n);var c=o=r.createElement(`link`);ut(c),Pd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Lf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Df(e,t){_f.X(e,t);var n=bf;if(n&&e){var r=lt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=f({src:e,async:!0},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),ut(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Of(e,t){_f.M(e,t);var n=bf;if(n&&e){var r=lt(n).hoistableScripts,i=Pf(e),a=r.get(i);a||(a=n.querySelector(Ff(i)),a||(e=f({src:e,async:!0,type:`module`},t),(t=mf.get(i))&&zf(e,t),a=n.createElement(`script`),ut(a),Pd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function kf(e,t,n,r){var a=(a=ie.current)?gf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Af(n.href),n=lt(a).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Af(n.href);var o=lt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(jf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),mf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},mf.set(e,n),o||Nf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Pf(n),n=lt(a).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Af(e){return`href="`+X(e)+`"`}function jf(e){return`link[rel="stylesheet"][`+e+`]`}function Mf(e){return f({},e,{"data-precedence":e.precedence,precedence:null})}function Nf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Pd(t,`link`,n),ut(t),e.head.appendChild(t))}function Pf(e){return`[src="`+X(e)+`"]`}function Ff(e){return`script[async]`+e}function If(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+X(n.href)+`"]`);if(r)return t.instance=r,ut(r),r;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),ut(r),Pd(r,`style`,a),Lf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Af(n.href);var o=e.querySelector(jf(a));if(o)return t.state.loading|=4,t.instance=o,ut(o),o;r=Mf(n),(a=mf.get(a))&&Rf(r,a),o=(e.ownerDocument||e).createElement(`link`),ut(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Pd(o,`link`,r),t.state.loading|=4,Lf(o,n.precedence,e),t.instance=o;case`script`:return o=Pf(n.src),(a=e.querySelector(Ff(o)))?(t.instance=a,ut(a),a):(r=n,(a=mf.get(o))&&(r=f({},n),zf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),ut(a),Pd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Lf(r,n.precedence,e));return t.instance}function Lf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Rf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function zf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Bf=null;function Vf(e,t,n){if(Bf===null){var r=new Map,i=Bf=new Map;i.set(n,r)}else i=Bf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[at]||a[Qe]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Hf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Uf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Wf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Gf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Af(r.href),a=t.querySelector(jf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Jf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,ut(a);return}a=t.ownerDocument||t,r=Mf(r),(i=mf.get(i))&&Rf(r,i),a=a.createElement(`link`),ut(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Pd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Jf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Kf=0;function qf(e,t){return e.stylesheets&&e.count===0&&Xf(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Kf===0&&(Kf=62500*Ld());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Xf(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Kf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Jf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xf(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Yf=null;function Xf(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Yf=new Map,t.forEach(Zf,e),Yf=null,Jf.call(e))}function Zf(e,t){if(!(t.state.loading&4)){var n=Yf.get(e);if(n)var r=n.get(null);else{n=new Map,Yf.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Jf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var Qf={$$typeof:x,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function $f(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=We(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=We(0),this.hiddenUpdates=We(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ep(e,t,n,r,i,a,o,s,c,l,u,d){return e=new $f(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=Jr(3,null,null,t),e.current=a,a.stateNode=e,t=Yi(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Oa(a),e}function tp(e){return e?(e=Kr,e):Kr}function np(e,t,n,r,i,a){i=tp(i),r.context===null?r.context=i:r.pendingContext=i,r=Aa(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=ja(e,r,t),n!==null&&(fu(n,e,t),Ma(n,e,t))}function rp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ip(e,t){rp(e,t),(e=e.alternate)&&rp(e,t)}function ap(e){if(e.tag===13||e.tag===31){var t=Ur(e,67108864);t!==null&&fu(t,e,67108864),ip(e,67108864)}}function op(e){if(e.tag===13||e.tag===31){var t=uu();t=G(t);var n=Ur(e,t);n!==null&&fu(n,e,t),ip(e,t)}}var sp=!0;function cp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=2,up(e,t,n,r)}finally{F.p=a,P.T=i}}function lp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=8,up(e,t,n,r)}finally{F.p=a,P.T=i}}function up(e,t,n,r){if(sp){var i=dp(r);if(i===null)Cd(e,t,r,fp,n),Cp(e,r);else if(Tp(i,e,t,n,r))r.stopPropagation();else if(Cp(e,r),t&4&&-1<Sp.indexOf(e)){for(;i!==null;){var a=st(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=ze(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-H(o);s.entanglements[1]|=c,o&=~c}td(a),!(Ml&6)&&(Ql=Ce()+500,nd(0,!1))}}break;case 31:case 13:s=Ur(a,2),s!==null&&fu(s,a,2),_u(),ip(a,2)}if(a=dp(r),a===null&&Cd(e,t,r,fp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Cd(e,t,r,null,n)}}function dp(e){return e=Ut(e),pp(e)}var fp=null;function pp(e){if(fp=null,e=ot(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return fp=e,null}function mp(e){switch(e){case`beforetoggle`: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`toggle`: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 2;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`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(we()){case B:return 2;case Te:return 8;case Ee:case De:return 32;case Oe:return 268435456;default:return 32}default:return 32}}var hp=!1,gp=null,_p=null,vp=null,yp=new Map,bp=new Map,xp=[],Sp=`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`.split(` `);function Cp(e,t){switch(e){case`focusin`:case`focusout`:gp=null;break;case`dragenter`:case`dragleave`:_p=null;break;case`mouseover`:case`mouseout`:vp=null;break;case`pointerover`:case`pointerout`:yp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:bp.delete(t.pointerId)}}function wp(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=st(t),t!==null&&ap(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Tp(e,t,n,r,i){switch(t){case`focusin`:return gp=wp(gp,e,t,n,r,i),!0;case`dragenter`:return _p=wp(_p,e,t,n,r,i),!0;case`mouseover`:return vp=wp(vp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return yp.set(a,wp(yp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,bp.set(a,wp(bp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ep(e){var t=ot(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,Xe(e.priority,function(){op(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,Xe(e.priority,function(){op(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=dp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ht=r,n.target.dispatchEvent(r),Ht=null}else return t=st(n),t!==null&&ap(t),e.blockedOn=n,!1;t.shift()}return!0}function Op(e,t,n){Dp(e)&&n.delete(t)}function kp(){hp=!1,gp!==null&&Dp(gp)&&(gp=null),_p!==null&&Dp(_p)&&(_p=null),vp!==null&&Dp(vp)&&(vp=null),yp.forEach(Op),bp.forEach(Op)}function Ap(e,n){e.blockedOn===n&&(e.blockedOn=null,hp||(hp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,kp)))}var jp=null;function Mp(e){jp!==e&&(jp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){jp===e&&(jp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(pp(r||n)===null)continue;break}var a=st(n);a!==null&&(e.splice(t,3),t-=3,hs(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Np(e){function t(t){return Ap(t,e)}gp!==null&&Ap(gp,e),_p!==null&&Ap(_p,e),vp!==null&&Ap(vp,e),yp.forEach(t),bp.forEach(t);for(var n=0;n<xp.length;n++){var r=xp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<xp.length&&(n=xp[0],n.blockedOn===null);)Ep(n),n.blockedOn===null&&xp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[$e]||null;if(typeof a==`function`)o||Mp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[$e]||null)s=o.formAction;else if(pp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Mp(n)}}}function Pp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function Fp(e){this._internalRoot=e}Ip.prototype.render=Fp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;np(n,uu(),e,t,null,null)},Ip.prototype.unmount=Fp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;np(e.current,2,null,e,null,null),_u(),t[et]=null}};function Ip(e){this._internalRoot=e}Ip.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ye();e={blockedOn:null,target:e,priority:t};for(var n=0;n<xp.length&&t!==0&&t<xp[n].priority;n++);xp.splice(n,0,e),n===0&&Ep(e)}};var Lp=n.version;if(Lp!==`19.2.8`)throw Error(i(527,Lp,`19.2.8`));F.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var Rp={bundleType:0,version:`19.2.8`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.2.8`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var zp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zp.isDisabled&&zp.supportsFiber)try{je=zp.inject(Rp),Me=zp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Rs,s=zs,c=Bs;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ep(e,1,!1,null,null,n,r,null,o,s,c,Pp),e[et]=t.current,xd(e),new Fp(t)}})),Et=t(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Tt()})),Y=e(m(),1),X=a();function Dt(e={}){let{themeId:t,defaultTheme:n,defaultClassName:r=`MuiBox-root`,generateClassName:i}=e,a=o(`div`,{shouldForwardProp:e=>e!==`theme`&&e!==`sx`&&e!==`as`})(d);return Y.forwardRef(function(e,o){let s=N(n),{className:c,component:l=`div`,...u}=e;return(0,X.jsx)(a,{as:l,ref:o,className:P(c,i?i(r):r),theme:t&&s[t]||s,...u})})}var Ot=Ee();function kt(e){let{theme:t,name:n,props:r}=e;return!t||!t.components||!t.components[n]||!t.components[n].defaultProps?r:Le(t.components[n].defaultProps,r)}function At(e){let{props:t,name:n,defaultTheme:r,themeId:i}=e,a=N(r);return i&&(a=a[i]||a),kt({theme:a,name:n,props:t})}function jt(e,t,n,r,i){let[a,o]=Y.useState(()=>i&&n?n(e).matches:r?r(e).matches:t);return Ce(()=>{if(!n)return;let t=n(e),r=()=>{o(t.matches)};return r(),t.addEventListener(`change`,r),()=>{t.removeEventListener(`change`,r)}},[e,n]),a}var Mt={...Y}.useSyncExternalStore;function Nt(e,t,n,r,i){let a=Y.useCallback(()=>t,[t]),o=Y.useMemo(()=>{if(i&&n)return()=>n(e).matches;if(r!==null){let{matches:t}=r(e);return()=>t}return a},[a,e,r,i,n]),[s,c]=Y.useMemo(()=>{if(n===null)return[a,()=>()=>{}];let t=n(e);return[()=>t.matches,e=>(t.addEventListener(`change`,e),()=>{t.removeEventListener(`change`,e)})]},[a,n,e]);return Mt(c,s,o)}function Pt(e={}){let{themeId:t}=e;return function(e,n={}){let r=p();r&&t&&(r=r[t]||r);let i=typeof window<`u`&&window.matchMedia!==void 0?window.matchMedia:null,{defaultMatches:a=!1,matchMedia:o,ssrMatchMedia:s=null,noSsr:c=!1}=kt({name:`MuiUseMediaQuery`,props:n,theme:r}),l=Y.useMemo(()=>o===void 0?i===null?null:i.bind(window):o,[o,i]),u=typeof e==`function`?e(r):e;return u=u.replace(/^@media( ?)/m,``),u.includes(`print`)&&console.warn(["MUI: You have provided a `print` query to the `useMediaQuery` hook.",`Using the print media query to modify print styles can lead to unexpected results.`,"Consider using the `displayPrint` field in the `sx` prop instead.","More information about `displayPrint` on our docs: https://mui.com/system/display/#display-in-print."].join(`
11
+ `)),(Mt===void 0?jt:Nt)(u,a,l,s,c)}}Pt();var Ft=Y.createContext(null);function It(){return Y.useContext(Ft)}var Lt=typeof Symbol==`function`&&Symbol.for?Symbol.for(`mui.nested`):`__THEME_NESTED__`;function Rt(e,t){return typeof t==`function`?t(e):{...e,...t}}function zt(e){let{children:t,theme:n}=e,r=It(),i=Y.useMemo(()=>{let e=r===null?{...n}:Rt(r,n);return e!=null&&(e[Lt]=r!==null),e},[n,r]);return(0,X.jsx)(Ft.Provider,{value:i,children:t})}function Bt(e){let t=p(),n=De()||``,{modularCssLayers:r}=e,i=`mui.global, mui.components, mui.theme, mui.custom, mui.sx`;return i=!r||t!==null?``:typeof r==`string`?r.replace(/mui(?!\.)/g,i):`@layer ${i};`,Ce(()=>{let e=document.querySelector(`head`);if(!e)return;let t=e.firstChild;if(i){if(t&&t.hasAttribute?.(`data-mui-layer-order`)&&t.getAttribute(`data-mui-layer-order`)===n)return;let r=document.createElement(`style`);r.setAttribute(`data-mui-layer-order`,n),r.textContent=i,e.prepend(r)}else e.querySelector(`style[data-mui-layer-order="${n}"]`)?.remove()},[i,n]),i?(0,X.jsx)(I,{styles:i}):null}var Vt={};function Ht(e,t,n,r=!1){return Y.useMemo(()=>{let i=e&&t[e]||t;if(typeof n==`function`){let a=n(i),o=e?{...t,[e]:a}:a;return r?()=>o:o}return e?{...t,[e]:n}:{...t,...n}},[e,t,n,r])}function Ut(e){let{children:t,theme:n,themeId:r}=e,i=p(Vt),a=It()||Vt,o=Ht(r,i,n),s=Ht(r,a,n,!0),l=(r?o[r]:o).direction===`rtl`,u=Bt(o);return(0,X.jsx)(zt,{theme:s,children:(0,X.jsx)(c.Provider,{value:o,children:(0,X.jsx)(Xe,{value:l,children:(0,X.jsxs)(Re,{value:r?o[r].components:o.components,children:[u,t]})})})})}var Wt=`mode`,Gt=`color-scheme`,Kt=`data-color-scheme`;({...Y}).useSyncExternalStore;function qt(e){let{defaultMode:t=`system`,defaultLightColorScheme:n=`light`,defaultDarkColorScheme:r=`dark`,modeStorageKey:i=Wt,colorSchemeStorageKey:a=Gt,attribute:o=Kt,colorSchemeNode:s=`document.documentElement`,nonce:c}=e||{},l=``,u=o;if(o===`class`&&(u=`.%s`),o===`data`&&(u=`[data-%s]`),u.startsWith(`.`)){let e=u.substring(1);l+=`${s}.classList.remove('${e}'.replace('%s', light), '${e}'.replace('%s', dark));
12
+ ${s}.classList.add('${e}'.replace('%s', colorScheme));`}let d=u.match(/\[([^[\]]+)\]/);if(d){let[e,t]=d[1].split(`=`);t||(l+=`${s}.removeAttribute('${e}'.replace('%s', light));
13
+ ${s}.removeAttribute('${e}'.replace('%s', dark));`),l+=`
14
+ ${s}.setAttribute('${e}'.replace('%s', colorScheme), ${t?`${t}.replace('%s', colorScheme)`:`""`});`}else u!==`.%s`&&(l+=`${s}.setAttribute('${u}', colorScheme);`);return(0,X.jsx)(`script`,{suppressHydrationWarning:!0,nonce:typeof window>`u`?c:``,dangerouslySetInnerHTML:{__html:`(function() {
15
+ try {
16
+ let colorScheme = '';
17
+ const mode = localStorage.getItem('${i}') || '${t}';
18
+ const dark = localStorage.getItem('${a}-dark') || '${r}';
19
+ const light = localStorage.getItem('${a}-light') || '${n}';
20
+ if (mode === 'system') {
21
+ // handle system mode
22
+ const mql = window.matchMedia('(prefers-color-scheme: dark)');
23
+ if (mql.matches) {
24
+ colorScheme = dark
25
+ } else {
26
+ colorScheme = light
27
+ }
28
+ }
29
+ if (mode === 'light') {
30
+ colorScheme = light;
31
+ }
32
+ if (mode === 'dark') {
33
+ colorScheme = dark;
34
+ }
35
+ if (colorScheme) {
36
+ ${l}
37
+ }
38
+ } catch(e){}})();`}},`mui-color-scheme-init`)}function Jt(){}var Yt=({key:e,storageWindow:t})=>(!t&&typeof window<`u`&&(t=window),{get(n){if(typeof window>`u`)return;if(!t)return n;let r;try{r=t.localStorage.getItem(e)}catch{}return r||n},set:n=>{if(t)try{t.localStorage.setItem(e,n)}catch{}},subscribe:n=>{if(!t)return Jt;let r=t=>{let r=t.newValue;t.key===e&&n(r)};return t.addEventListener(`storage`,r),()=>{t.removeEventListener(`storage`,r)}}});function Xt(){}function Zt(e){if(typeof window<`u`&&typeof window.matchMedia==`function`&&e===`system`)return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}function Qt(e,t){if(e.mode===`light`||e.mode===`system`&&e.systemMode===`light`)return t(`light`);if(e.mode===`dark`||e.mode===`system`&&e.systemMode===`dark`)return t(`dark`)}function $t(e){return Qt(e,t=>{if(t===`light`)return e.lightColorScheme;if(t===`dark`)return e.darkColorScheme})}function en(e){let{defaultMode:t=`light`,defaultLightColorScheme:n,defaultDarkColorScheme:r,supportedColorSchemes:i=[],modeStorageKey:a=Wt,colorSchemeStorageKey:o=Gt,storageWindow:s=typeof window>`u`?void 0:window,storageManager:c=Yt,noSsr:l=!1}=e,u=i.join(`,`),d=i.length>1,f=Y.useMemo(()=>c?.({key:a,storageWindow:s}),[c,a,s]),p=Y.useMemo(()=>c?.({key:`${o}-light`,storageWindow:s}),[c,o,s]),m=Y.useMemo(()=>c?.({key:`${o}-dark`,storageWindow:s}),[c,o,s]),[h,g]=Y.useState(()=>{let e=f?.get(t)||t,i=p?.get(n)||n,a=m?.get(r)||r;return{mode:e,systemMode:Zt(e),lightColorScheme:i,darkColorScheme:a}}),[_,v]=Y.useState(l||!d);Y.useEffect(()=>{v(!0)},[]);let y=$t(h),b=Y.useCallback(e=>{g(n=>{if(e===n.mode)return n;let r=e??t;return f?.set(r),{...n,mode:r,systemMode:Zt(r)}})},[f,t]),x=Y.useCallback(e=>{e?typeof e==`string`?e&&!u.includes(e)?console.error(`\`${e}\` does not exist in \`theme.colorSchemes\`.`):g(t=>{let n={...t};return Qt(t,t=>{t===`light`&&(p?.set(e),n.lightColorScheme=e),t===`dark`&&(m?.set(e),n.darkColorScheme=e)}),n}):g(t=>{let i={...t},a=e.light===null?n:e.light,o=e.dark===null?r:e.dark;return a&&(u.includes(a)?(i.lightColorScheme=a,p?.set(a)):console.error(`\`${a}\` does not exist in \`theme.colorSchemes\`.`)),o&&(u.includes(o)?(i.darkColorScheme=o,m?.set(o)):console.error(`\`${o}\` does not exist in \`theme.colorSchemes\`.`)),i}):g(e=>(p?.set(n),m?.set(r),{...e,lightColorScheme:n,darkColorScheme:r}))},[u,p,m,n,r]),S=Y.useCallback(e=>{h.mode===`system`&&g(t=>{let n=e?.matches?`dark`:`light`;return t.systemMode===n?t:{...t,systemMode:n}})},[h.mode]),C=Y.useRef(S);return C.current=S,Y.useEffect(()=>{if(typeof window.matchMedia!=`function`||!d)return;let e=(...e)=>C.current(...e),t=window.matchMedia(`(prefers-color-scheme: dark)`);return t.addListener(e),e(t),()=>{t.removeListener(e)}},[d]),Y.useEffect(()=>{if(d){let e=f?.subscribe(e=>{(!e||[`light`,`dark`,`system`].includes(e))&&b(e||t)})||Xt,n=p?.subscribe(e=>{(!e||u.match(e))&&x({light:e})})||Xt,r=m?.subscribe(e=>{(!e||u.match(e))&&x({dark:e})})||Xt;return()=>{e(),n(),r()}}},[x,b,u,t,s,d,f,p,m]),{...h,mode:_?h.mode:void 0,systemMode:_?h.systemMode:void 0,colorScheme:_?y:void 0,setMode:b,setColorScheme:x}}var tn=`*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`;function nn(e){let{themeId:t,theme:n={},modeStorageKey:r=Wt,colorSchemeStorageKey:i=Gt,disableTransitionOnChange:a=!1,defaultColorScheme:o,resolveTheme:s}=e,c={allColorSchemes:[],colorScheme:void 0,darkColorScheme:void 0,lightColorScheme:void 0,mode:void 0,setColorScheme:()=>{},setMode:()=>{},systemMode:void 0},l=Y.createContext(void 0),u=()=>Y.useContext(l)||c,d={},f={};function p(e){let{children:c,theme:u,modeStorageKey:p=r,colorSchemeStorageKey:m=i,disableTransitionOnChange:h=a,storageManager:g,storageWindow:_=typeof window>`u`?void 0:window,documentNode:v=typeof document>`u`?void 0:document,colorSchemeNode:y=typeof document>`u`?void 0:document.documentElement,disableNestedContext:b=!1,disableStyleSheetGeneration:x=!1,defaultMode:S=`system`,forceThemeRerender:C=!1,noSsr:w}=e,T=Y.useRef(!1),E=It(),D=Y.useContext(l),O=!!D&&!b,k=Y.useMemo(()=>u||(typeof n==`function`?n():n),[u]),A=k[t],j=A||k,{colorSchemes:M=d,components:N=f,cssVarPrefix:P}=j,F=Object.keys(M).filter(e=>!!M[e]).join(`,`),I=Y.useMemo(()=>F.split(`,`),[F]),ee=typeof o==`string`?o:o.light,L=typeof o==`string`?o:o.dark,{mode:ne,setMode:R,systemMode:z,lightColorScheme:re,darkColorScheme:ie,colorScheme:ae,setColorScheme:oe}=en({supportedColorSchemes:I,defaultLightColorScheme:ee,defaultDarkColorScheme:L,modeStorageKey:p,colorSchemeStorageKey:m,defaultMode:M[ee]&&M[L]?S:M[j.defaultColorScheme]?.palette?.mode||j.palette?.mode,storageManager:g,storageWindow:_,noSsr:w}),se=ne,ce=ae;O&&(se=D.mode,ce=D.colorScheme);let le=ce||j.defaultColorScheme;j.vars&&!C&&(le=j.defaultColorScheme);let ue=Y.useMemo(()=>{let e=j.generateThemeVars?.()||j.vars,t={...j,components:N,colorSchemes:M,cssVarPrefix:P,vars:e};if(typeof t.generateSpacing==`function`&&(t.spacing=t.generateSpacing()),le){let e=M[le];e&&typeof e==`object`&&Object.keys(e).forEach(n=>{e[n]&&typeof e[n]==`object`?t[n]={...t[n],...e[n]}:t[n]=e[n]})}return s?s(t):t},[j,le,N,M,P]),de=j.colorSchemeSelector;Ce(()=>{if(ce&&y&&de&&de!==`media`){let e=de,t=de;if(e===`class`&&(t=`.%s`),e===`data`&&(t=`[data-%s]`),e?.startsWith(`data-`)&&!e.includes(`%s`)&&(t=`[${e}="%s"]`),t.startsWith(`.`))y.classList.remove(...I.map(e=>t.substring(1).replace(`%s`,e))),y.classList.add(t.substring(1).replace(`%s`,ce));else{let e=t.replace(`%s`,ce).match(/\[([^\]]+)\]/);if(e){let[t,n]=e[1].split(`=`);n||I.forEach(e=>{y.removeAttribute(t.replace(ce,e))}),y.setAttribute(t,n?n.replace(/"|'/g,``):``)}else y.setAttribute(t,ce)}}},[ce,de,y,I]),Y.useEffect(()=>{let e;if(h&&T.current&&v){let t=v.createElement(`style`);t.appendChild(v.createTextNode(tn)),v.head.appendChild(t),window.getComputedStyle(v.body),e=setTimeout(()=>{v.head.removeChild(t)},1)}return()=>{clearTimeout(e)}},[ce,h,v]),Y.useEffect(()=>(T.current=!0,()=>{T.current=!1}),[]);let fe=Y.useMemo(()=>({allColorSchemes:I,colorScheme:ce,darkColorScheme:ie,lightColorScheme:re,mode:se,setColorScheme:oe,setMode:R,systemMode:z}),[I,ce,ie,re,se,oe,R,z,ue.colorSchemeSelector]),pe=!0;(x||j.cssVariables===!1||O&&E?.cssVarPrefix===P)&&(pe=!1);let me=(0,X.jsxs)(Y.Fragment,{children:[(0,X.jsx)(Ut,{themeId:A?t:void 0,theme:ue,children:c}),pe&&(0,X.jsx)(te,{styles:ue.generateStyleSheets?.()||[]})]});return O?me:(0,X.jsx)(l.Provider,{value:fe,children:me})}let m=typeof o==`string`?o:o.light,h=typeof o==`string`?o:o.dark;return{CssVarsProvider:p,useColorScheme:u,getInitColorSchemeScript:e=>qt({colorSchemeStorageKey:i,defaultLightColorScheme:m,defaultDarkColorScheme:h,modeStorageKey:r,...e})}}var rn=i(),an=Ot(`div`,{name:`MuiStack`,slot:`Root`});function on(e){return At({props:e,name:`MuiStack`,defaultTheme:rn})}function sn(e,t){let n=Y.Children.toArray(e).filter(Boolean);return n.reduce((e,r,i)=>(e.push(r),i<n.length-1&&e.push(Y.cloneElement(t,{key:`separator-${i}`})),e),[])}var cn=e=>({row:`Left`,"row-reverse":`Right`,column:`Top`,"column-reverse":`Bottom`})[e],ln=({ownerState:e,theme:t})=>{let r={display:`flex`,flexDirection:`column`,...l({theme:t},f({values:e.direction,breakpoints:t.breakpoints.values}),e=>({flexDirection:e}))};if(e.spacing){let i=w(t),a=Object.keys(t.breakpoints.values).reduce((t,n)=>((typeof e.spacing==`object`&&e.spacing[n]!=null||typeof e.direction==`object`&&e.direction[n]!=null)&&(t[n]=!0),t),{}),o=f({values:e.direction,base:a}),c=f({values:e.spacing,base:a});typeof o==`object`&&Object.keys(o).forEach((e,t,n)=>{if(!o[e]){let r=t>0?o[n[t-1]]:`column`;o[e]=r}}),r=s(r,l({theme:t},c,(t,r)=>e.useFlexGap?{gap:n(i,t)}:{"& > :not(style):not(style)":{margin:0},"& > :not(style) ~ :not(style)":{[`margin${cn(r?o[r]:e.direction)}`]:n(i,t)}}))}return r=u(t.breakpoints,r),r};function un(e={}){let{createStyledComponent:t=an,useThemeProps:n=on,componentName:r=`MuiStack`}=e,i=()=>B({root:[`root`]},e=>M(r,e),{}),a=t(ln);return Y.forwardRef(function(e,t){let{component:r=`div`,direction:o=`column`,spacing:s=0,divider:c,children:l,className:u,useFlexGap:d=!1,...f}=n(e),p={direction:o,spacing:s,useFlexGap:d},m=i();return(0,X.jsx)(a,{as:r,ownerState:p,ref:t,className:P(m.root,u),...f,children:c?sn(l,c):l})})}var dn=typeof ee({})==`function`,fn=(e,t)=>({WebkitFontSmoothing:`antialiased`,MozOsxFontSmoothing:`grayscale`,boxSizing:`border-box`,WebkitTextSizeAdjust:`100%`,...t&&!e.vars&&{colorScheme:e.palette.mode}}),pn=e=>({color:(e.vars||e).palette.text.primary,...e.typography.body1,backgroundColor:(e.vars||e).palette.background.default,"@media print":{backgroundColor:(e.vars||e).palette.common.white}}),mn=(e,t=!1)=>{let n={};t&&e.colorSchemes&&typeof e.getColorSchemeSelector==`function`&&Object.entries(e.colorSchemes).forEach(([t,r])=>{let i=e.getColorSchemeSelector(t);i.startsWith(`@`)?n[i]={":root":{colorScheme:r.palette?.mode}}:n[i.replace(/\s*&/,``)]={colorScheme:r.palette?.mode}});let r={html:fn(e,t),"*, *::before, *::after":{boxSizing:`inherit`},"strong, b":{fontWeight:e.typography.fontWeightBold},body:{margin:0,...pn(e),"&::backdrop":{backgroundColor:(e.vars||e).palette.background.default}},...n},i=e.components?.MuiCssBaseline?.styleOverrides;return i&&(r=[r,i]),r},hn=`mui-ecs`,gn=e=>{let t=mn(e,!1),n=Array.isArray(t)?t[0]:t;return!e.vars&&n&&(n.html[`:root:has(${hn})`]={colorScheme:e.palette.mode}),e.colorSchemes&&Object.entries(e.colorSchemes).forEach(([t,r])=>{let i=e.getColorSchemeSelector(t);i.startsWith(`@`)?n[i]={[`:root:not(:has(.${hn}))`]:{colorScheme:r.palette?.mode}}:n[i.replace(/\s*&/,``)]={[`&:not(:has(.${hn}))`]:{colorScheme:r.palette?.mode}}}),t},_n=ee(dn?({theme:e,enableColorScheme:t})=>mn(e,t):({theme:e})=>gn(e));function vn(e){let{children:t,enableColorScheme:n=!1}=we({props:e,name:`MuiCssBaseline`});return(0,X.jsxs)(Y.Fragment,{children:[dn&&(0,X.jsx)(_n,{enableColorScheme:n}),!dn&&!n&&(0,X.jsx)(`span`,{className:hn,style:{display:`none`}}),t]})}function yn(e){return M(`MuiListItemButton`,e)}var bn=g(`MuiListItemButton`,[`root`,`focusVisible`,`dense`,`alignItemsFlexStart`,`disabled`,`divider`,`gutters`,`selected`]);function xn(e){return M(`MuiMenuItem`,e)}var Sn=g(`MuiMenuItem`,[`root`,`focusVisible`,`dense`,`disabled`,`divider`,`gutters`,`selected`]);function Cn(e){return M(`MuiToggleButton`,e)}var wn=g(`MuiToggleButton`,[`root`,`disabled`,`selected`,`standard`,`primary`,`secondary`,`sizeSmall`,`sizeMedium`,`sizeLarge`,`fullWidth`]);function Tn({theme:e,...t}){let n=`$$material`in e?e[T]:void 0;return(0,X.jsx)(Ut,{...t,themeId:n?T:void 0,theme:n||e})}var En={attribute:`data-mui-color-scheme`,colorSchemeStorageKey:`mui-color-scheme`,defaultLightColorScheme:`light`,defaultDarkColorScheme:`dark`,modeStorageKey:`mui-mode`},{CssVarsProvider:Dn,useColorScheme:On,getInitColorSchemeScript:kn}=nn({themeId:T,theme:()=>b({cssVariables:!0}),colorSchemeStorageKey:En.colorSchemeStorageKey,modeStorageKey:En.modeStorageKey,defaultColorScheme:{light:En.defaultLightColorScheme,dark:En.defaultDarkColorScheme},resolveTheme:e=>{let t={...e,typography:E(e.palette,e.typography)};return t.unstable_sx=function(e){return d({sx:e,theme:this})},t}}),An=Dn;function jn({theme:e,...t}){let n=Y.useMemo(()=>{if(typeof e==`function`)return e;let t=`$$material`in e?e[T]:e;return`colorSchemes`in t?null:`vars`in t?e:{...e,vars:null}},[e]);return n?(0,X.jsx)(Tn,{theme:n,...t}):(0,X.jsx)(An,{theme:e,...t})}function Mn(e){return M(`MuiAppBar`,e)}g(`MuiAppBar`,[`root`,`positionFixed`,`positionAbsolute`,`positionSticky`,`positionStatic`,`positionRelative`,`colorDefault`,`colorPrimary`,`colorSecondary`,`colorInherit`,`colorTransparent`,`colorError`,`colorInfo`,`colorSuccess`,`colorWarning`]);var Nn=e=>{let{color:t,position:n,classes:r}=e,i={root:[`root`,`color${G(t)}`,`position${G(n)}`]};return B(i,Mn,r)},Pn=(e,t)=>e?`${e.replace(`)`,``)}, ${t})`:t,Fn=W(ht,{name:`MuiAppBar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`position${G(n.position)}`],t[`color${G(n.color)}`]]}})(V(({theme:e})=>({display:`flex`,flexDirection:`column`,width:`100%`,boxSizing:`border-box`,flexShrink:0,variants:[{props:{position:`fixed`},style:{position:`fixed`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0,"@media print":{position:`absolute`}}},{props:{position:`absolute`},style:{position:`absolute`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0}},{props:{position:`sticky`},style:{position:`sticky`,zIndex:(e.vars||e).zIndex.appBar,top:0,left:`auto`,right:0}},{props:{position:`static`},style:{position:`static`}},{props:{position:`relative`},style:{position:`relative`}},{props:{color:`inherit`},style:{"--AppBar-color":`inherit`,color:`var(--AppBar-color)`}},{props:{color:`default`},style:{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[100],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[100]),...e.applyStyles(`dark`,{"--AppBar-background":e.vars?e.vars.palette.AppBar.defaultBg:e.palette.grey[900],"--AppBar-color":e.vars?e.vars.palette.text.primary:e.palette.getContrastText(e.palette.grey[900])})}},...Object.entries(e.palette).filter(U([`contrastText`])).map(([t])=>({props:{color:t},style:{"--AppBar-background":(e.vars??e).palette[t].main,"--AppBar-color":(e.vars??e).palette[t].contrastText}})),{props:e=>e.enableColorOnDark===!0&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`}},{props:e=>e.enableColorOnDark===!1&&![`inherit`,`transparent`].includes(e.color),style:{backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`,...e.applyStyles(`dark`,{backgroundColor:e.vars?Pn(e.vars.palette.AppBar.darkBg,`var(--AppBar-background)`):null,color:e.vars?Pn(e.vars.palette.AppBar.darkColor,`var(--AppBar-color)`):null})}},{props:{color:`transparent`},style:{"--AppBar-background":`transparent`,"--AppBar-color":`inherit`,backgroundColor:`var(--AppBar-background)`,color:`var(--AppBar-color)`,...e.applyStyles(`dark`,{backgroundImage:`none`})}}]}))),In=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiAppBar`}),{className:r,color:i=`primary`,enableColorOnDark:a=!1,position:o=`fixed`,...s}=n,c={...n,color:i,position:o,enableColorOnDark:a},l=Nn(c);return(0,X.jsx)(Fn,{square:!0,component:`header`,ownerState:c,elevation:4,className:P(l.root,r,o===`fixed`&&`mui-fixed`),ref:t,...s})});function Ln(e){let t=Y.useRef({});return Y.useEffect(()=>{t.current=e}),t.current}function Rn(e){let{badgeContent:t,invisible:n=!1,max:r=99,showZero:i=!1}=e,a=Ln({badgeContent:t,max:r}),o=n;n===!1&&t===0&&!i&&(o=!0);let{badgeContent:s,max:c=r}=o?a:e,l=s&&Number(s)>c?`${c}+`:s;return{badgeContent:s,invisible:o,max:c,displayValue:l}}function zn(e){return M(`MuiBadge`,e)}var Bn=g(`MuiBadge`,[`root`,`badge`,`dot`,`standard`,`anchorOriginTopRight`,`anchorOriginBottomRight`,`anchorOriginTopLeft`,`anchorOriginBottomLeft`,`invisible`,`colorError`,`colorInfo`,`colorPrimary`,`colorSecondary`,`colorSuccess`,`colorWarning`,`overlapRectangular`,`overlapCircular`,`anchorOriginTopLeftCircular`,`anchorOriginTopLeftRectangular`,`anchorOriginTopRightCircular`,`anchorOriginTopRightRectangular`,`anchorOriginBottomLeftCircular`,`anchorOriginBottomLeftRectangular`,`anchorOriginBottomRightCircular`,`anchorOriginBottomRightRectangular`]),Vn=10,Hn=4,Un=e=>{let{color:t,anchorOrigin:n,invisible:r,overlap:i,variant:a,classes:o={}}=e,s={root:[`root`],badge:[`badge`,a,r&&`invisible`,`anchorOrigin${G(n.vertical)}${G(n.horizontal)}`,`anchorOrigin${G(n.vertical)}${G(n.horizontal)}${G(i)}`,`overlap${G(i)}`,t!=="default"&&`color${G(t)}`]};return B(s,zn,o)},Wn=W(`span`,{name:`MuiBadge`,slot:`Root`})({position:`relative`,display:`inline-flex`,verticalAlign:`middle`,flexShrink:0}),Gn=W(`span`,{name:`MuiBadge`,slot:`Badge`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.badge,t[n.variant],t[`anchorOrigin${G(n.anchorOrigin.vertical)}${G(n.anchorOrigin.horizontal)}${G(n.overlap)}`],n.color!=="default"&&t[`color${G(n.color)}`],n.invisible&&t.invisible]}})(V(({theme:e})=>({display:`flex`,flexDirection:`row`,flexWrap:`wrap`,justifyContent:`center`,alignContent:`center`,alignItems:`center`,position:`absolute`,boxSizing:`border-box`,fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(12),minWidth:20,lineHeight:1,padding:`0 6px`,height:20,borderRadius:Vn,zIndex:1,"@media (forced-colors: active)":{border:`1px solid ButtonBorder`},...Be(e,`transform`,{easing:e.transitions.easing.easeInOut,duration:e.transitions.duration.enteringScreen}),variants:[...Object.entries(e.palette).filter(U([`contrastText`])).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main,color:(e.vars||e).palette[t].contrastText}})),{props:{variant:`dot`},style:{borderRadius:Hn,height:8,minWidth:8,padding:0}},{props:{invisible:!0},style:{...Be(e,`transform`,{easing:e.transitions.easing.easeInOut,duration:e.transitions.duration.leavingScreen})}},{style:{inset:`var(--Badge-inset)`,transform:`scale(1) translate(var(--Badge-translate))`,transformOrigin:`var(--Badge-origin)`,[`&.${Bn.invisible}`]:{transform:`scale(0) translate(var(--Badge-translate))`}}}]})));function Kn(e){return{vertical:e?.vertical??`top`,horizontal:e?.horizontal??`right`}}var qn=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiBadge`}),{anchorOrigin:r,className:i,classes:a,component:o,children:s,overlap:c=`rectangular`,color:l=`default`,invisible:u=!1,max:d=99,badgeContent:f,slots:p,slotProps:m,showZero:h=!1,variant:g=`standard`,..._}=n,{badgeContent:v,invisible:y,max:b,displayValue:x}=Rn({max:d,invisible:u,badgeContent:f,showZero:h}),S=Ln({anchorOrigin:Kn(r),color:l,overlap:c,variant:g,badgeContent:f}),C=y||v==null&&g!==`dot`,{color:w=l,overlap:T=c,anchorOrigin:E,variant:D=g}=C?S:n,O=Kn(E),k=D===`dot`?void 0:x,A={...n,badgeContent:v,invisible:C,max:b,displayValue:k,showZero:h,anchorOrigin:O,color:w,overlap:T,variant:D},j=Un(A),M={slots:p,slotProps:m},[N,F]=nt(`root`,{elementType:Wn,externalForwardedProps:{...M,..._},ownerState:A,className:P(j.root,i),ref:t,additionalProps:{as:o}}),{vertical:I,horizontal:ee}=O,te=T===`circular`?`14%`:`0`,L=I===`top`?te:`auto`,ne=I===`bottom`?te:`auto`,R=ee===`right`?te:`auto`,z=ee===`left`?te:`auto`,[re,ie]=nt(`badge`,{elementType:Gn,externalForwardedProps:M,ownerState:A,className:j.badge,additionalProps:{"aria-hidden":!0,style:{"--Badge-translate":`${ee===`right`?`50%`:`-50%`}, ${I===`top`?`-50%`:`50%`}`,"--Badge-inset":`${L} ${R} ${ne} ${z}`,"--Badge-origin":`${ee===`right`?`100%`:`0%`} ${I===`top`?`0%`:`100%`}`}}});return(0,X.jsxs)(N,{...F,children:[s,(0,X.jsx)(re,{...ie,children:k})]})}),Jn=g(`MuiBox`,[`root`]),Yn=b(),Z=Dt({themeId:T,defaultTheme:Yn,defaultClassName:Jn.root,generateClassName:v.generate}),Xn=K((0,X.jsx)(`path`,{d:`M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z`}),`Cancel`);function Zn(e){return M(`MuiChip`,e)}var Qn=g(`MuiChip`,[`root`,`sizeSmall`,`sizeMedium`,`colorDefault`,`colorError`,`colorInfo`,`colorPrimary`,`colorSecondary`,`colorSuccess`,`colorWarning`,`disabled`,`clickable`,`deletable`,`outlined`,`filled`,`avatar`,`icon`,`label`,`deleteIcon`,`focusVisible`]),$n=e=>{let{classes:t,disabled:n,size:r,color:i,onDelete:a,clickable:o,variant:s}=e,c={root:[`root`,s,n&&`disabled`,`size${G(r)}`,`color${G(i)}`,o&&`clickable`,a&&`deletable`],label:[`label`],avatar:[`avatar`],icon:[`icon`],deleteIcon:[`deleteIcon`]};return B(c,Zn,t)},er=W(`div`,{name:`MuiChip`,slot:`Root`,shouldForwardProp:e=>Ae(e)&&e!==`focusableWhenDisabled`&&e!==`skipFocusWhenDisabled`,overridesResolver:(e,t)=>{let{ownerState:n}=e,{color:r,clickable:i,onDelete:a,size:o,variant:s}=n;return[{[`& .${Qn.avatar}`]:t.avatar},{[`& .${Qn.icon}`]:t.icon},{[`& .${Qn.deleteIcon}`]:t.deleteIcon},t.root,t[`size${G(o)}`],t[`color${G(r)}`],i&&t.clickable,a&&t.deletable,t[s]]}})(V(({theme:e})=>{let t=e.palette.mode===`light`?e.palette.grey[700]:e.palette.grey[300];return{maxWidth:`100%`,fontFamily:e.typography.fontFamily,fontSize:e.typography.pxToRem(13),display:`inline-flex`,alignItems:`center`,justifyContent:`center`,height:32,lineHeight:1.5,color:(e.vars||e).palette.text.primary,backgroundColor:(e.vars||e).palette.action.selected,borderRadius:16,whiteSpace:`nowrap`,...Be(e,[`background-color`,`box-shadow`]),cursor:`unset`,outline:0,textDecoration:`none`,border:0,padding:0,verticalAlign:`middle`,boxSizing:`border-box`,[`&.${Qn.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity,pointerEvents:`none`},[`& .${Qn.avatar}`]:{marginLeft:5,marginRight:-6,width:24,height:24,color:e.vars?e.vars.palette.Chip.defaultAvatarColor:t,fontSize:e.typography.pxToRem(12)},[`& .${Qn.icon}`]:{marginLeft:5,marginRight:-6},[`& .${Qn.deleteIcon}`]:{WebkitTapHighlightColor:`transparent`,color:e.alpha((e.vars||e).palette.text.primary,.26),fontSize:22,cursor:`pointer`,margin:`0 5px 0 -6px`,"&:hover":{color:e.alpha((e.vars||e).palette.text.primary,.4)}},variants:[{props:{color:`primary`},style:{[`& .${Qn.avatar}`]:{color:(e.vars||e).palette.primary.contrastText,backgroundColor:(e.vars||e).palette.primary.dark}}},{props:{color:`secondary`},style:{[`& .${Qn.avatar}`]:{color:(e.vars||e).palette.secondary.contrastText,backgroundColor:(e.vars||e).palette.secondary.dark}}},{props:{size:`small`},style:{height:24,[`& .${Qn.avatar}`]:{marginLeft:4,marginRight:-4,width:18,height:18,fontSize:e.typography.pxToRem(10)},[`& .${Qn.icon}`]:{fontSize:18,marginLeft:4,marginRight:-4},[`& .${Qn.deleteIcon}`]:{fontSize:16,marginRight:4,marginLeft:-4}}},...Object.entries(e.palette).filter(U([`contrastText`])).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main,color:(e.vars||e).palette[t].contrastText,[`& .${Qn.deleteIcon}`]:{color:e.alpha((e.vars||e).palette[t].contrastText,.7),"&:hover, &:active":{color:(e.vars||e).palette[t].contrastText}}}})),{props:e=>e.iconColor===e.color,style:{[`& .${Qn.icon}`]:{color:e.vars?e.vars.palette.Chip.defaultIconColor:t}}},{props:e=>e.iconColor===e.color&&e.color!=="default",style:{[`& .${Qn.icon}`]:{color:`inherit`}}},{props:{onDelete:!0},style:{[`&.${Qn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}}},...Object.entries(e.palette).filter(U([`dark`])).map(([t])=>({props:{color:t,onDelete:!0},style:{[`&.${Qn.focusVisible}`]:{background:(e.vars||e).palette[t].dark}}})),{props:{clickable:!0},style:{userSelect:`none`,WebkitTapHighlightColor:`transparent`,cursor:`pointer`,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`)},[`&.${Qn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.action.selected,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)},"&:active":{boxShadow:(e.vars||e).shadows[1]}}},...Object.entries(e.palette).filter(U([`dark`])).map(([t])=>({props:{color:t,clickable:!0},style:{[`&:hover, &.${Qn.focusVisible}`]:{backgroundColor:(e.vars||e).palette[t].dark}}})),{props:{variant:`outlined`},style:{backgroundColor:`transparent`,border:e.vars?`1px solid ${e.vars.palette.Chip.defaultBorder}`:`1px solid ${e.palette.mode===`light`?e.palette.grey[400]:e.palette.grey[700]}`,[`&.${Qn.clickable}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${Qn.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`& .${Qn.avatar}`]:{marginLeft:4},[`& .${Qn.icon}`]:{marginLeft:4},[`& .${Qn.deleteIcon}`]:{marginRight:5}}},{props:{size:`small`,variant:`outlined`},style:{[`& .${Qn.avatar}`]:{marginLeft:2},[`& .${Qn.icon}`]:{marginLeft:2},[`& .${Qn.deleteIcon}`]:{marginRight:3}}},...Object.entries(e.palette).filter(U()).map(([t])=>({props:{variant:`outlined`,color:t},style:{color:(e.vars||e).palette[t].main,border:`1px solid ${e.alpha((e.vars||e).palette[t].main,.7)}`,[`&.${Qn.clickable}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity)},[`&.${Qn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.focusOpacity)},[`& .${Qn.deleteIcon}`]:{color:e.alpha((e.vars||e).palette[t].main,.7),"&:hover, &:active":{color:(e.vars||e).palette[t].main}}}}))]}})),tr=W(`span`,{name:`MuiChip`,slot:`Label`})({overflow:`hidden`,textOverflow:`ellipsis`,paddingLeft:12,paddingRight:12,whiteSpace:`nowrap`,variants:[{props:{variant:`outlined`},style:{paddingLeft:11,paddingRight:11}},{props:{size:`small`},style:{paddingLeft:8,paddingRight:8}},{props:{size:`small`,variant:`outlined`},style:{paddingLeft:7,paddingRight:7}}]});function nr(e){return e.key===`Backspace`||e.key===`Delete`}var rr=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiChip`}),{avatar:r,className:i,clickable:a,color:o=`default`,component:s,deleteIcon:c,disabled:l=!1,icon:u,label:d,onClick:f,onDelete:p,onKeyDown:m,onKeyUp:h,size:g=`medium`,variant:_=`filled`,tabIndex:v,skipFocusWhenDisabled:y=!1,slots:b={},slotProps:x={},...S}=n,{nativeButton:C,...w}=S,T=Y.useRef(null),E=Ke(T,t),D=e=>{e.stopPropagation(),p(e)},O=e=>{e.currentTarget===e.target&&nr(e)&&e.preventDefault(),m&&m(e)},k=e=>{e.currentTarget===e.target&&p&&nr(e)&&p(e),h&&h(e)},A=a!==!1&&f?!0:a,j=A||p?We:s||`div`,M={...n,component:j,disabled:l,size:g,color:o,iconColor:Y.isValidElement(u)&&u.props.color||o,onDelete:!!p,clickable:A,variant:_},N=$n(M),F=j===We?{component:s||`div`,internalNativeButton:!1,focusVisibleClassName:N.focusVisible,...p&&{disableRipple:!0},...C!==void 0&&{nativeButton:C}}:{},I=null;p&&(I=c&&Y.isValidElement(c)?Y.cloneElement(c,{className:P(c.props.className,N.deleteIcon),onClick:D}):(0,X.jsx)(Xn,{className:N.deleteIcon,onClick:D}));let ee=null;r&&Y.isValidElement(r)&&(ee=Y.cloneElement(r,{className:P(N.avatar,r.props.className)}));let te=null;u&&Y.isValidElement(u)&&(te=Y.cloneElement(u,{className:P(N.icon,u.props.className)}));let L={slots:b,slotProps:x},[ne,R]=nt(`root`,{elementType:er,externalForwardedProps:{...L,...w},ownerState:M,shouldForwardComponentProp:!0,ref:E,className:P(N.root,i),additionalProps:{disabled:A&&l?!0:void 0,tabIndex:y&&l?-1:v,...F},getSlotProps:e=>({...e,onClick:t=>{e.onClick?.(t),f?.(t)},onKeyDown:t=>{e.onKeyDown?.(t),O(t)},onKeyUp:t=>{e.onKeyUp?.(t),k(t)}})}),[z,re]=nt(`label`,{elementType:tr,externalForwardedProps:L,ownerState:M,className:N.label});return(0,X.jsxs)(ne,{as:j,...R,children:[ee||te,(0,X.jsx)(z,{...re,children:d}),I]})});function ir(e){return M(`MuiDivider`,e)}var ar=g(`MuiDivider`,[`root`,`absolute`,`fullWidth`,`inset`,`middle`,`flexItem`,`vertical`,`withChildren`,`textAlignRight`,`textAlignLeft`,`wrapper`,`wrapperVertical`]),or=e=>{let{absolute:t,children:n,classes:r,flexItem:i,orientation:a,textAlign:o,variant:s}=e;return B({root:[`root`,t&&`absolute`,s,a===`vertical`&&`vertical`,i&&`flexItem`,n&&`withChildren`,o===`right`&&a!==`vertical`&&`textAlignRight`,o===`left`&&a!==`vertical`&&`textAlignLeft`],wrapper:[`wrapper`,a===`vertical`&&`wrapperVertical`]},ir,r)},sr=W(`div`,{name:`MuiDivider`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.absolute&&t.absolute,t[n.variant],n.orientation===`vertical`&&t.vertical,n.flexItem&&t.flexItem,n.children&&t.withChildren,n.textAlign===`right`&&n.orientation!==`vertical`&&t.textAlignRight,n.textAlign===`left`&&n.orientation!==`vertical`&&t.textAlignLeft]}})(V(({theme:e})=>({margin:0,flexShrink:0,borderWidth:0,borderStyle:`solid`,borderColor:(e.vars||e).palette.divider,borderBottomWidth:`thin`,variants:[{props:{absolute:!0},style:{position:`absolute`,bottom:0,left:0,width:`100%`}},{props:{variant:`inset`},style:{marginLeft:72}},{props:{variant:`middle`,orientation:`horizontal`},style:{marginLeft:e.spacing(2),marginRight:e.spacing(2)}},{props:{variant:`middle`,orientation:`vertical`},style:{marginTop:e.spacing(1),marginBottom:e.spacing(1)}},{props:{orientation:`vertical`},style:{height:`100%`,borderBottomWidth:0,borderRightWidth:`thin`}},{props:{flexItem:!0},style:{alignSelf:`stretch`,height:`auto`}},{props:({ownerState:e})=>!!e.children,style:{display:`flex`,textAlign:`center`,border:0,borderTopStyle:`solid`,borderLeftStyle:`solid`,"&::before, &::after":{content:`""`,alignSelf:`center`}}},{props:({ownerState:e})=>e.children&&e.orientation!==`vertical`,style:{"&::before, &::after":{width:`100%`,borderTop:`thin solid ${(e.vars||e).palette.divider}`,borderTopStyle:`inherit`}}},{props:({ownerState:e})=>e.orientation===`vertical`&&e.children,style:{flexDirection:`column`,"&::before, &::after":{height:`100%`,borderLeft:`thin solid ${(e.vars||e).palette.divider}`,borderLeftStyle:`inherit`}}},{props:({ownerState:e})=>e.textAlign===`right`&&e.orientation!==`vertical`,style:{"&::before":{width:`90%`},"&::after":{width:`10%`}}},{props:({ownerState:e})=>e.textAlign===`left`&&e.orientation!==`vertical`,style:{"&::before":{width:`10%`},"&::after":{width:`90%`}}}]}))),cr=W(`span`,{name:`MuiDivider`,slot:`Wrapper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.wrapper,n.orientation===`vertical`&&t.wrapperVertical]}})(V(({theme:e})=>({display:`inline-block`,paddingLeft:`calc(${e.spacing(1)} * 1.2)`,paddingRight:`calc(${e.spacing(1)} * 1.2)`,whiteSpace:`nowrap`,variants:[{props:{orientation:`vertical`},style:{paddingTop:`calc(${e.spacing(1)} * 1.2)`,paddingBottom:`calc(${e.spacing(1)} * 1.2)`}}]}))),lr=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiDivider`}),{absolute:r=!1,children:i,className:a,orientation:o=`horizontal`,component:s=i||o===`vertical`?`div`:`hr`,flexItem:c=!1,role:l=s===`hr`?void 0:`separator`,textAlign:u=`center`,variant:d=`fullWidth`,...f}=n,p={...n,absolute:r,component:s,flexItem:c,orientation:o,role:l,textAlign:u,variant:d},m=or(p);return(0,X.jsx)(sr,{as:s,className:P(m.root,a),role:l,ref:t,ownerState:p,"aria-orientation":l===`separator`&&(s!==`hr`||o===`vertical`)?o:void 0,...f,children:i?(0,X.jsx)(cr,{className:m.wrapper,ownerState:p,children:i}):null})}),ur={visibility:`hidden`},dr={};function fr(e){return typeof e==`string`&&/^translate\(.+,\s*.+\)$/.test(e)}function pr(e,t,n,r=dr){let{resetInlineTransform:i=!0}=r,a=n&&n.getBoundingClientRect(),o=at(t),s,c;if(i){let e=t.style.transform,n=t.style.transition;t.style.transition=``,t.style.transform=``,s=t.getBoundingClientRect(),c=o.getComputedStyle(t).getPropertyValue(`transform`),t.style.transform=e,t.style.transition=n}else s=t.getBoundingClientRect(),c=o.getComputedStyle(t).getPropertyValue(`transform`);let{offsetX:l,offsetY:u}=Fe(c);return e===`left`?a?`translateX(${a.right+l-s.left}px)`:`translateX(${o.innerWidth+l-s.left}px)`:e===`right`?a?`translateX(-${s.right-a.left-l}px)`:`translateX(-${s.left+s.width-l}px)`:e===`up`?a?`translateY(${a.bottom+u-s.top}px)`:`translateY(${o.innerHeight+u-s.top}px)`:a?`translateY(-${s.top-a.top+s.height-u}px)`:`translateY(-${s.top+s.height-u}px)`}function mr(e){return typeof e==`function`?e():e}function hr(e,t,n,r){let i=pr(e,t,mr(n),r);i&&(t.style.transform=i)}var gr=Y.forwardRef(function(e,t){let n=y(),r={enter:n.transitions.easing.easeOut,exit:n.transitions.easing.sharp},i={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:a,appear:o=!0,children:s,container:c,disablePrefersReducedMotion:l=!1,direction:u=`down`,easing:d=r,in:f,onEnter:p,onEntered:m,onEntering:h,onExit:g,onExited:_,onExiting:v,style:b,timeout:x=i,...S}=e,C=Ie(n.motion.reducedMotion,l),w=Y.useRef(null),T=Y.useRef(!1),E=Ke(L(s),w,t),D=Pe(w,(e,t)=>{hr(u,e,c),C.shouldReduceMotion||je(e),p&&p(e,t)}),O=Pe(w,(e,t)=>{let r=Ue({timeout:x,style:b,easing:d},{mode:`enter`}),i=C.getTransitionTiming({duration:r.duration,delay:r.delay});e.style.transition=n.transitions.create(`transform`,{duration:i.duration,easing:r.easing,delay:i.delay}),e.style.transform=`none`,h&&h(e,t)}),k=Pe(w,m),A=Pe(w,v),j=Pe(w,e=>{let t=Ue({timeout:x,style:b,easing:d},{mode:`exit`}),r=C.getTransitionTiming({duration:t.duration,delay:t.delay});e.style.transition=n.transitions.create(`transform`,{duration:r.duration,easing:t.easing,delay:r.delay});let i=fr(e.style.transform);T.current=i,hr(u,e,c,{resetInlineTransform:!i}),g&&g(e)}),M=Pe(w,e=>{T.current=!1,e.style.transition=``,_&&_(e)}),N=a?e=>{a(w.current,e)}:void 0,P=Y.useCallback(()=>{w.current&&hr(u,w.current,c)},[u,c]);return Y.useEffect(()=>{if(f||u===`down`||u===`right`)return;let e=dt(()=>{w.current&&hr(u,w.current,c)}),t=at(w.current);return t.addEventListener(`resize`,e),()=>{e.clear(),t.removeEventListener(`resize`,e)}},[u,f,c]),Y.useEffect(()=>{!f&&!T.current&&P()},[f,P]),(0,X.jsx)(Se,{nodeRef:w,onEnter:D,onEntered:k,onEntering:O,onExit:j,onExited:M,onExiting:A,addEndListener:N,appear:o,in:f,reduceMotion:C.shouldReduceMotion,timeout:x,...S,children:(e,{ownerState:t,...n})=>{let r;return r=e===`exited`&&!f?b||s.props.style?{visibility:`hidden`,...b,...s.props.style}:ur:b&&s.props.style?{...b,...s.props.style}:b||s.props.style,Y.cloneElement(s,{ref:E,style:r,...n})}})});function _r(e){return M(`MuiDrawer`,e)}g(`MuiDrawer`,[`root`,`docked`,`paper`,`anchorLeft`,`anchorRight`,`anchorTop`,`anchorBottom`,`modal`]);var vr=(e,t)=>{let{ownerState:n}=e;return[t.root,(n.variant===`permanent`||n.variant===`persistent`)&&t.docked,n.variant===`temporary`&&t.modal]},yr=e=>{let{classes:t,anchor:n,variant:r}=e,i={root:[`root`,`anchor${G(n)}`],docked:[(r===`permanent`||r===`persistent`)&&`docked`],modal:[`modal`],paper:[`paper`]};return B(i,_r,t)},br=W(be,{name:`MuiDrawer`,slot:`Root`,overridesResolver:vr})(V(({theme:e})=>({zIndex:(e.vars||e).zIndex.drawer}))),xr=W(`div`,{shouldForwardProp:Ae,name:`MuiDrawer`,slot:`Docked`,skipVariantsResolver:!1,overridesResolver:vr})({flex:`0 0 auto`}),Sr=W(ht,{name:`MuiDrawer`,slot:`Paper`})(V(({theme:e})=>({overflowY:`auto`,display:`flex`,flexDirection:`column`,height:`100%`,flex:`1 0 auto`,zIndex:(e.vars||e).zIndex.drawer,WebkitOverflowScrolling:`touch`,position:`fixed`,top:0,outline:0,variants:[{props:{anchor:`left`},style:{left:0}},{props:{anchor:`top`},style:{top:0,left:0,right:0,height:`auto`,maxHeight:`100%`}},{props:{anchor:`right`},style:{right:0}},{props:{anchor:`bottom`},style:{top:`auto`,left:0,bottom:0,right:0,height:`auto`,maxHeight:`100%`}},{props:({ownerState:e})=>e.anchor===`left`&&e.variant!==`temporary`,style:{borderRight:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`top`&&e.variant!==`temporary`,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`right`&&e.variant!==`temporary`,style:{borderLeft:`1px solid ${(e.vars||e).palette.divider}`}},{props:({ownerState:e})=>e.anchor===`bottom`&&e.variant!==`temporary`,style:{borderTop:`1px solid ${(e.vars||e).palette.divider}`}}]}))),Cr={left:`right`,right:`left`,top:`down`,bottom:`up`};function wr(e){return[`left`,`right`].includes(e)}function Tr({direction:e},t){return e===`rtl`&&wr(t)?Cr[t]:t}var Er=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiDrawer`}),r=y(),i=Ye(),a={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{anchor:o=`left`,children:s,className:c,elevation:l=16,hideBackdrop:u=!1,ModalProps:d={},onClose:f,open:p=!1,transitionDuration:m=a,variant:h=`temporary`,slots:g={},slotProps:_={},...v}=n,b=Y.useRef(!1),x=Y.useRef(null),S=Ke(t,x);Y.useEffect(()=>{b.current=!0},[]);let C=Y.useCallback(()=>x.current,[]),w=Tr({direction:i?`rtl`:`ltr`},o),T=o,E={...n,anchor:T,elevation:l,open:p,variant:h,...v},D=yr(E),O={slots:g,slotProps:{..._,backdrop:se(_.backdrop,{transitionDuration:m})}},[k,A]=nt(`root`,{ref:S,elementType:br,className:P(D.root,D.modal,c),shouldForwardComponentProp:!0,ownerState:E,externalForwardedProps:{...O,...v,...d},additionalProps:{closeAfterTransition:!0,open:p,onClose:f,hideBackdrop:u,slots:{backdrop:O.slots.backdrop},slotProps:{backdrop:O.slotProps.backdrop}}}),[j,M]=nt(`paper`,{elementType:Sr,shouldForwardComponentProp:!0,className:D.paper,ownerState:E,externalForwardedProps:O,additionalProps:{elevation:h===`temporary`?l:0,square:!0,...h===`temporary`&&{role:`dialog`,"aria-modal":`true`,"data-mui-focusable":``,tabIndex:-1}}}),[N,F]=nt(`docked`,{elementType:xr,ref:S,className:P(D.root,D.docked,c),ownerState:E,externalForwardedProps:O,additionalProps:v}),[I,ee]=nt(`transition`,{elementType:gr,ownerState:E,externalForwardedProps:O,additionalProps:{in:p,direction:Cr[w],timeout:m,appear:b.current,...h===`temporary`&&(g.transition==null||g.transition===gr)&&{container:C}}}),te=(0,X.jsx)(j,{...M,children:s});if(h===`permanent`)return(0,X.jsx)(N,{...F,children:te});let L=(0,X.jsx)(I,{...ee,children:te});return h===`persistent`?(0,X.jsx)(N,{...F,children:L}):(0,X.jsx)(k,{...A,children:L})}),Dr=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.alignItems===`flex-start`&&t.alignItemsFlexStart,n.divider&&t.divider,!n.disableGutters&&t.gutters]},Or=e=>{let{alignItems:t,classes:n,dense:r,disabled:i,disableGutters:a,divider:o,selected:s}=e,c=B({root:[`root`,r&&`dense`,!a&&`gutters`,o&&`divider`,i&&`disabled`,t===`flex-start`&&`alignItemsFlexStart`,s&&`selected`]},yn,n);return{...n,...c}},kr=W(We,{shouldForwardProp:e=>Ae(e)||e===`classes`,name:`MuiListItemButton`,slot:`Root`,overridesResolver:Dr})(V(({theme:e})=>({display:`flex`,flexGrow:1,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,minWidth:0,boxSizing:`border-box`,textAlign:`left`,paddingTop:8,paddingBottom:8,...Be(e,`background-color`,{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${bn.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${bn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${bn.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${bn.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${bn.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},variants:[{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:{alignItems:`flex-start`},style:{alignItems:`flex-start`}},{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.dense,style:{paddingTop:4,paddingBottom:4}}]}))),Ar=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiListItemButton`}),{alignItems:r=`center`,autoFocus:i=!1,component:a=`div`,children:o,dense:s=!1,disableGutters:c=!1,divider:l=!1,focusVisibleClassName:u,selected:d=!1,className:f,...p}=n,m=Y.useContext(ce),h=Y.useMemo(()=>({dense:s||m.dense||!1,alignItems:r,disableGutters:c}),[r,m.dense,s,c]),g=Y.useRef(null);ft(()=>{i&&g.current&&g.current.focus()},[i]);let _={...n,alignItems:r,dense:h.dense,disableGutters:c,divider:l,selected:d},v=Or(_),{root:y,...b}=v,x=Ke(g,t);return(0,X.jsx)(ce.Provider,{value:h,children:(0,X.jsx)(kr,{ref:x,href:p.href||p.to,component:(p.href||p.to)&&a===`div`?`button`:a,internalNativeButton:!1,focusVisibleClassName:P(v.focusVisible,u),ownerState:_,className:P(v.root,f),...p,classes:b,children:o})})});function jr(e){return M(`MuiListItemIcon`,e)}var Mr=g(`MuiListItemIcon`,[`root`,`alignItemsFlexStart`]),Nr=e=>{let{alignItems:t,classes:n}=e;return B({root:[`root`,t===`flex-start`&&`alignItemsFlexStart`]},jr,n)},Pr=W(`div`,{name:`MuiListItemIcon`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.alignItems===`flex-start`&&t.alignItemsFlexStart]}})(V(({theme:e})=>({minWidth:e.spacing(4.5),color:(e.vars||e).palette.action.active,flexShrink:0,display:`inline-flex`,variants:[{props:{alignItems:`flex-start`},style:{marginTop:8}}]}))),Fr=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiListItemIcon`}),{className:r,...i}=n,a=Y.useContext(ce),o={...n,alignItems:a.alignItems},s=Nr(o);return(0,X.jsx)(Pr,{className:P(s.root,r),ownerState:o,ref:t,...i})});function Ir(e){return M(`MuiListItemText`,e)}var Lr=g(`MuiListItemText`,[`root`,`multiline`,`dense`,`inset`,`primary`,`secondary`]),Rr=e=>{let{classes:t,inset:n,primary:r,secondary:i,dense:a}=e;return B({root:[`root`,n&&`inset`,a&&`dense`,r&&i&&`multiline`],primary:[`primary`],secondary:[`secondary`]},Ir,t)},zr=W(`div`,{name:`MuiListItemText`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${Lr.primary}`]:t.primary},{[`& .${Lr.secondary}`]:t.secondary},t.root,n.inset&&t.inset,n.primary&&n.secondary&&t.multiline,n.dense&&t.dense]}})({flex:`1 1 auto`,minWidth:0,marginTop:4,marginBottom:4,[`.${mt.root}:where(& .${Lr.primary})`]:{display:`block`},[`.${mt.root}:where(& .${Lr.secondary})`]:{display:`block`},variants:[{props:({ownerState:e})=>e.primary&&e.secondary,style:{marginTop:6,marginBottom:6}},{props:({ownerState:e})=>e.inset,style:{paddingLeft:56}}]}),Br=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiListItemText`}),{children:r,className:i,disableTypography:a=!1,inset:o=!1,primary:s,secondary:c,slots:l={},slotProps:u={},...d}=n,{dense:f}=Y.useContext(ce),p=s??r,m=c,h={...n,disableTypography:a,inset:o,primary:!!p,secondary:!!m,dense:f},g=Rr(h),_={slots:l,slotProps:u},[v,y]=nt(`root`,{className:P(g.root,i),elementType:zr,externalForwardedProps:{..._,...d},ownerState:h,ref:t}),[b,x]=nt(`primary`,{className:g.primary,elementType:q,externalForwardedProps:_,ownerState:h}),[S,C]=nt(`secondary`,{className:g.secondary,elementType:q,externalForwardedProps:_,ownerState:h});return p!=null&&p.type!==q&&!a&&(p=(0,X.jsx)(b,{variant:f?`body2`:`body1`,component:x?.variant?void 0:`span`,...x,children:p})),m!=null&&m.type!==q&&!a&&(m=(0,X.jsx)(S,{variant:`body2`,color:`textSecondary`,...C,children:m})),(0,X.jsxs)(v,{...y,children:[p,m]})}),Q=un({createStyledComponent:W(`div`,{name:`MuiStack`,slot:`Root`}),useThemeProps:e=>we({props:e,name:`MuiStack`})}),Vr=Y.createContext({}),Hr=Y.createContext(void 0);function Ur(e,t){return t===void 0||e===void 0?!1:Array.isArray(t)?t.includes(e):e===t}function Wr(e,t){let{children:n,disabled:r=!1,selected:i=!1,value:a}=e,o=lt(),s=it({id:a,ref:t,disabled:r,selected:i}),c=o.getItemMap().size===0&&i?0:s.tabIndex;return Y.cloneElement(Y.Children.only(n),{...s,tabIndex:n.props.tabIndex??c})}var Gr=Y.forwardRef(Wr),Kr=e=>{let{classes:t,fullWidth:n,selected:r,disabled:i,size:a,color:o}=e,s={root:[`root`,r&&`selected`,i&&`disabled`,n&&`fullWidth`,`size${G(a)}`,o]};return B(s,Cn,t)},qr=W(We,{name:`MuiToggleButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`size${G(n.size)}`]]}})(V(({theme:e})=>({...e.typography.button,borderRadius:(e.vars||e).shape.borderRadius,padding:11,border:`1px solid ${(e.vars||e).palette.divider}`,color:(e.vars||e).palette.action.active,[`&.${wn.disabled}`]:{color:(e.vars||e).palette.action.disabled,border:`1px solid ${(e.vars||e).palette.action.disabledBackground}`},"&:hover":{textDecoration:`none`,backgroundColor:e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:`transparent`}},variants:[{props:{color:`standard`},style:{[`&.${wn.selected}`]:{color:(e.vars||e).palette.text.primary,backgroundColor:e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.text.primary,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.text.primary,(e.vars||e).palette.action.selectedOpacity)}}}}},...Object.entries(e.palette).filter(U()).map(([t])=>({props:{color:t},style:{[`&.${wn.selected}`]:{color:(e.vars||e).palette[t].main,backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.selectedOpacity)}}}}})),{props:{fullWidth:!0},style:{width:`100%`}},{props:{size:`small`},style:{padding:7,fontSize:e.typography.pxToRem(13)}},{props:{size:`large`},style:{padding:15,fontSize:e.typography.pxToRem(15)}}]}))),Jr=Y.forwardRef(function(e,t){let{value:n,isRovingTabIndex:r,...i}=Y.useContext(Vr),a=Y.useContext(Hr),o=Le({...i,selected:Ur(e.value,n)},e),s=we({props:o,name:`MuiToggleButton`}),{children:c,className:l,color:u=`standard`,disabled:d=!1,disableFocusRipple:f=!1,fullWidth:p=!1,onChange:m,onClick:h,selected:g,size:_=`medium`,value:v,...y}=s,b={...s,color:u,disabled:d,disableFocusRipple:f,fullWidth:p,size:_},x=Kr(b),S=e=>{h&&(h(e,v),e.defaultPrevented)||m&&m(e,v)},C=a||``,w=(0,X.jsx)(qr,{className:P(i.className,x.root,l,C),internalNativeButton:!0,disabled:d,focusRipple:!f,ref:r?void 0:t,onClick:S,onChange:m,value:v,ownerState:b,"aria-pressed":g,...y,children:c});return r?(0,X.jsx)(Gr,{disabled:d,selected:g,ref:t,value:v,children:w}):w});function Yr(e){return Y.Children.toArray(e).filter(e=>Y.isValidElement(e))}function Xr(e){return M(`MuiToggleButtonGroup`,e)}var Zr=g(`MuiToggleButtonGroup`,[`root`,`selected`,`horizontal`,`vertical`,`disabled`,`grouped`,`fullWidth`,`firstButton`,`lastButton`,`middleButton`]),Qr=e=>{let{classes:t,orientation:n,fullWidth:r,disabled:i}=e;return B({root:[`root`,n,r&&`fullWidth`],grouped:[`grouped`,i&&`disabled`],firstButton:[`firstButton`],lastButton:[`lastButton`],middleButton:[`middleButton`]},Xr,t)},$r=W(`div`,{name:`MuiToggleButtonGroup`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${Zr.grouped}`]:t.grouped},{[`& .${Zr.firstButton}`]:t.firstButton},{[`& .${Zr.lastButton}`]:t.lastButton},{[`& .${Zr.middleButton}`]:t.middleButton},t.root,n.orientation===`vertical`&&t.vertical,n.fullWidth&&t.fullWidth]}})(V(({theme:e})=>({display:`inline-flex`,borderRadius:(e.vars||e).shape.borderRadius,variants:[{props:{orientation:`vertical`},style:{flexDirection:`column`,[`& .${Zr.grouped}`]:{[`&.${Zr.selected} + .${Zr.grouped}.${Zr.selected}`]:{borderTop:0,marginTop:0}},[`& .${Zr.firstButton},& .${Zr.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${Zr.lastButton},& .${Zr.middleButton}`]:{marginTop:-1,borderTop:`1px solid transparent`,borderTopLeftRadius:0,borderTopRightRadius:0},[`& .${Zr.lastButton}.${wn.disabled},& .${Zr.middleButton}.${wn.disabled}`]:{borderTop:`1px solid transparent`}}},{props:{fullWidth:!0},style:{width:`100%`}},{props:{orientation:`horizontal`},style:{[`& .${Zr.grouped}`]:{[`&.${Zr.selected} + .${Zr.grouped}.${Zr.selected}`]:{borderLeft:0,marginLeft:0}},[`& .${Zr.firstButton},& .${Zr.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${Zr.lastButton},& .${Zr.middleButton}`]:{marginLeft:-1,borderLeft:`1px solid transparent`,borderTopLeftRadius:0,borderBottomLeftRadius:0},[`& .${Zr.lastButton}.${wn.disabled},& .${Zr.middleButton}.${wn.disabled}`]:{borderLeft:`1px solid transparent`}}}]}))),ei=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiToggleButtonGroup`}),{children:r,className:i,color:a=`standard`,disabled:o=!1,exclusive:s=!1,fullWidth:c=!1,onChange:l,orientation:u=`horizontal`,size:d=`medium`,value:f,...p}=n,m={...n,disabled:o,fullWidth:c,orientation:u,size:d},h=Qr(m),g=Ye(),_=Y.useCallback((e,t)=>{if(!l)return;let n=f&&f.indexOf(t),r;f&&n>=0?(r=f.slice(),r.splice(n,1)):r=f?f.concat(t):[t],l(e,r)},[l,f]),v=Y.useCallback((e,t)=>{l&&l(e,f===t?null:t)},[l,f]),y=Y.useMemo(()=>({className:h.grouped,onChange:s?v:_,value:f,size:d,fullWidth:c,color:a,disabled:o,isRovingTabIndex:!0}),[h.grouped,s,v,_,f,d,c,a,o]),b=Yr(r),x=b.length,S=e=>{let t=e===0,n=e===x-1;return t&&n?``:t?h.firstButton:n?h.lastButton:h.middleButton},C=Qe({orientation:u,isRtl:g}),w=C.getContainerProps(t,p.onFocus,p.onKeyDown);return(0,X.jsx)($r,{role:`group`,className:P(h.root,i),ownerState:m,...p,...w,children:(0,X.jsx)(st.Provider,{value:C,children:(0,X.jsx)(Vr.Provider,{value:y,children:b.map((e,t)=>(0,X.jsx)(Hr.Provider,{value:S(t),children:e},t))})})})});function ti(e){return M(`MuiToolbar`,e)}g(`MuiToolbar`,[`root`,`gutters`,`regular`,`dense`]);var ni=e=>{let{classes:t,disableGutters:n,variant:r}=e;return B({root:[`root`,!n&&`gutters`,r]},ti,t)},ri=W(`div`,{name:`MuiToolbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableGutters&&t.gutters,t[n.variant]]}})(V(({theme:e})=>({position:`relative`,display:`flex`,alignItems:`center`,variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:e.spacing(2),paddingRight:e.spacing(2),[e.breakpoints.up(`sm`)]:{paddingLeft:e.spacing(3),paddingRight:e.spacing(3)}}},{props:{variant:`dense`},style:{minHeight:48}},{props:{variant:`regular`},style:e.mixins.toolbar}]}))),ii=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiToolbar`}),{className:r,component:i=`div`,disableGutters:a=!1,variant:o=`regular`,...s}=n,c={...n,component:i,disableGutters:a,variant:o},l=ni(c);return(0,X.jsx)(ri,{as:i,className:P(l.root,r),ref:t,ownerState:c,...s})}),ai=`bottom`,oi=`right`,si=`left`,ci=`auto`,li=[`top`,ai,oi,si],ui=`start`,di=`clippingParents`,fi=`viewport`,pi=`popper`,mi=`reference`,hi=li.reduce(function(e,t){return e.concat([t+`-`+ui,t+`-end`])},[]),gi=[].concat(li,[ci]).reduce(function(e,t){return e.concat([t,t+`-`+ui,t+`-end`])},[]),_i=[`beforeRead`,`read`,`afterRead`,`beforeMain`,`main`,`afterMain`,`beforeWrite`,`write`,`afterWrite`];function vi(e){return e?(e.nodeName||``).toLowerCase():null}function yi(e){if(e==null)return window;if(e.toString()!==`[object Window]`){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function bi(e){return e instanceof yi(e).Element||e instanceof Element}function xi(e){return e instanceof yi(e).HTMLElement||e instanceof HTMLElement}function Si(e){return typeof ShadowRoot>`u`?!1:e instanceof yi(e).ShadowRoot||e instanceof ShadowRoot}function Ci(e){var t=e.state;Object.keys(t.elements).forEach(function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},i=t.elements[e];!xi(i)||!vi(i)||(Object.assign(i.style,n),Object.keys(r).forEach(function(e){var t=r[e];t===!1?i.removeAttribute(e):i.setAttribute(e,t===!0?``:t)}))})}function wi(e){var t=e.state,n={popper:{position:t.options.strategy,left:`0`,top:`0`,margin:`0`},arrow:{position:`absolute`},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(e){var r=t.elements[e],i=t.attributes[e]||{},a=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce(function(e,t){return e[t]=``,e},{});!xi(r)||!vi(r)||(Object.assign(r.style,a),Object.keys(i).forEach(function(e){r.removeAttribute(e)}))})}}var Ti={name:`applyStyles`,enabled:!0,phase:`write`,fn:Ci,effect:wi,requires:[`computeStyles`]};function Ei(e){return e.split(`-`)[0]}var Di=Math.max,Oi=Math.min,ki=Math.round;function Ai(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(e){return e.brand+`/`+e.version}).join(` `):navigator.userAgent}function ji(){return!/^((?!chrome|android).)*safari/i.test(Ai())}function Mi(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),i=1,a=1;t&&xi(e)&&(i=e.offsetWidth>0&&ki(r.width)/e.offsetWidth||1,a=e.offsetHeight>0&&ki(r.height)/e.offsetHeight||1);var o=(bi(e)?yi(e):window).visualViewport,s=!ji()&&n,c=(r.left+(s&&o?o.offsetLeft:0))/i,l=(r.top+(s&&o?o.offsetTop:0))/a,u=r.width/i,d=r.height/a;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c,x:c,y:l}}function Ni(e){var t=Mi(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Pi(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Si(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Fi(e){return yi(e).getComputedStyle(e)}function Ii(e){return[`table`,`td`,`th`].indexOf(vi(e))>=0}function Li(e){return((bi(e)?e.ownerDocument:e.document)||window.document).documentElement}function Ri(e){return vi(e)===`html`?e:e.assignedSlot||e.parentNode||(Si(e)?e.host:null)||Li(e)}function zi(e){return!xi(e)||Fi(e).position===`fixed`?null:e.offsetParent}function Bi(e){var t=/firefox/i.test(Ai());if(/Trident/i.test(Ai())&&xi(e)&&Fi(e).position===`fixed`)return null;var n=Ri(e);for(Si(n)&&(n=n.host);xi(n)&&[`html`,`body`].indexOf(vi(n))<0;){var r=Fi(n);if(r.transform!==`none`||r.perspective!==`none`||r.contain===`paint`||[`transform`,`perspective`].indexOf(r.willChange)!==-1||t&&r.willChange===`filter`||t&&r.filter&&r.filter!==`none`)return n;n=n.parentNode}return null}function Vi(e){for(var t=yi(e),n=zi(e);n&&Ii(n)&&Fi(n).position===`static`;)n=zi(n);return n&&(vi(n)===`html`||vi(n)===`body`&&Fi(n).position===`static`)?t:n||Bi(e)||t}function Hi(e){return[`top`,`bottom`].indexOf(e)>=0?`x`:`y`}function Ui(e,t,n){return Di(e,Oi(t,n))}function Wi(e,t,n){var r=Ui(e,t,n);return r>n?n:r}function Gi(){return{top:0,right:0,bottom:0,left:0}}function Ki(e){return Object.assign({},Gi(),e)}function qi(e,t){return t.reduce(function(t,n){return t[n]=e,t},{})}var Ji=function(e,t){return e=typeof e==`function`?e(Object.assign({},t.rects,{placement:t.placement})):e,Ki(typeof e==`number`?qi(e,li):e)};function Yi(e){var t,n=e.state,r=e.name,i=e.options,a=n.elements.arrow,o=n.modifiersData.popperOffsets,s=Ei(n.placement),c=Hi(s),l=[`left`,`right`].indexOf(s)>=0?`height`:`width`;if(!(!a||!o)){var u=Ji(i.padding,n),d=Ni(a),f=c===`y`?`top`:si,p=c===`y`?ai:oi,m=n.rects.reference[l]+n.rects.reference[c]-o[c]-n.rects.popper[l],h=o[c]-n.rects.reference[c],g=Vi(a),_=g?c===`y`?g.clientHeight||0:g.clientWidth||0:0,v=m/2-h/2,y=u[f],b=_-d[l]-u[p],x=_/2-d[l]/2+v,S=Ui(y,x,b),C=c;n.modifiersData[r]=(t={},t[C]=S,t.centerOffset=S-x,t)}}function Xi(e){var t=e.state,n=e.options.element,r=n===void 0?`[data-popper-arrow]`:n;r!=null&&(typeof r==`string`&&(r=t.elements.popper.querySelector(r),!r)||Pi(t.elements.popper,r)&&(t.elements.arrow=r))}var Zi={name:`arrow`,enabled:!0,phase:`main`,fn:Yi,effect:Xi,requires:[`popperOffsets`],requiresIfExists:[`preventOverflow`]};function Qi(e){return e.split(`-`)[1]}var $i={top:`auto`,right:`auto`,bottom:`auto`,left:`auto`};function ea(e,t){var n=e.x,r=e.y,i=t.devicePixelRatio||1;return{x:ki(n*i)/i||0,y:ki(r*i)/i||0}}function ta(e){var t,n=e.popper,r=e.popperRect,i=e.placement,a=e.variation,o=e.offsets,s=e.position,c=e.gpuAcceleration,l=e.adaptive,u=e.roundOffsets,d=e.isFixed,f=o.x,p=f===void 0?0:f,m=o.y,h=m===void 0?0:m,g=typeof u==`function`?u({x:p,y:h}):{x:p,y:h};p=g.x,h=g.y;var _=o.hasOwnProperty(`x`),v=o.hasOwnProperty(`y`),y=si,b=`top`,x=window;if(l){var S=Vi(n),C=`clientHeight`,w=`clientWidth`;if(S===yi(n)&&(S=Li(n),Fi(S).position!==`static`&&s===`absolute`&&(C=`scrollHeight`,w=`scrollWidth`)),S=S,i===`top`||(i===`left`||i===`right`)&&a===`end`){b=ai;var T=d&&S===x&&x.visualViewport?x.visualViewport.height:S[C];h-=T-r.height,h*=c?1:-1}if(i===`left`||(i===`top`||i===`bottom`)&&a===`end`){y=oi;var E=d&&S===x&&x.visualViewport?x.visualViewport.width:S[w];p-=E-r.width,p*=c?1:-1}}var D=Object.assign({position:s},l&&$i),O=u===!0?ea({x:p,y:h},yi(n)):{x:p,y:h};if(p=O.x,h=O.y,c){var k;return Object.assign({},D,(k={},k[b]=v?`0`:``,k[y]=_?`0`:``,k.transform=(x.devicePixelRatio||1)<=1?`translate(`+p+`px, `+h+`px)`:`translate3d(`+p+`px, `+h+`px, 0)`,k))}return Object.assign({},D,(t={},t[b]=v?h+`px`:``,t[y]=_?p+`px`:``,t.transform=``,t))}function na(e){var t=e.state,n=e.options,r=n.gpuAcceleration,i=r===void 0||r,a=n.adaptive,o=a===void 0||a,s=n.roundOffsets,c=s===void 0||s,l={placement:Ei(t.placement),variation:Qi(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:i,isFixed:t.options.strategy===`fixed`};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,ta(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:o,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,ta(Object.assign({},l,{offsets:t.modifiersData.arrow,position:`absolute`,adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var ra={name:`computeStyles`,enabled:!0,phase:`beforeWrite`,fn:na,data:{}},ia={passive:!0};function aa(e){var t=e.state,n=e.instance,r=e.options,i=r.scroll,a=i===void 0||i,o=r.resize,s=o===void 0||o,c=yi(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return a&&l.forEach(function(e){e.addEventListener(`scroll`,n.update,ia)}),s&&c.addEventListener(`resize`,n.update,ia),function(){a&&l.forEach(function(e){e.removeEventListener(`scroll`,n.update,ia)}),s&&c.removeEventListener(`resize`,n.update,ia)}}var oa={name:`eventListeners`,enabled:!0,phase:`write`,fn:function(){},effect:aa,data:{}},sa={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function ca(e){return e.replace(/left|right|bottom|top/g,function(e){return sa[e]})}var la={start:`end`,end:`start`};function ua(e){return e.replace(/start|end/g,function(e){return la[e]})}function da(e){var t=yi(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function fa(e){return Mi(Li(e)).left+da(e).scrollLeft}function pa(e,t){var n=yi(e),r=Li(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;var l=ji();(l||!l&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s+fa(e),y:c}}function ma(e){var t=Li(e),n=da(e),r=e.ownerDocument?.body,i=Di(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),a=Di(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),o=-n.scrollLeft+fa(e),s=-n.scrollTop;return Fi(r||t).direction===`rtl`&&(o+=Di(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:a,x:o,y:s}}function ha(e){var t=Fi(e),n=t.overflow,r=t.overflowX,i=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+i+r)}function ga(e){return[`html`,`body`,`#document`].indexOf(vi(e))>=0?e.ownerDocument.body:xi(e)&&ha(e)?e:ga(Ri(e))}function _a(e,t){t===void 0&&(t=[]);var n=ga(e),r=n===e.ownerDocument?.body,i=yi(n),a=r?[i].concat(i.visualViewport||[],ha(n)?n:[]):n,o=t.concat(a);return r?o:o.concat(_a(Ri(a)))}function va(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function ya(e,t){var n=Mi(e,!1,t===`fixed`);return n.top+=e.clientTop,n.left+=e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function ba(e,t,n){return t===`viewport`?va(pa(e,n)):bi(t)?ya(t,n):va(ma(Li(e)))}function xa(e){var t=_a(Ri(e)),n=[`absolute`,`fixed`].indexOf(Fi(e).position)>=0&&xi(e)?Vi(e):e;return bi(n)?t.filter(function(e){return bi(e)&&Pi(e,n)&&vi(e)!==`body`}):[]}function Sa(e,t,n,r){var i=t===`clippingParents`?xa(e):[].concat(t),a=[].concat(i,[n]),o=a[0],s=a.reduce(function(t,n){var i=ba(e,n,r);return t.top=Di(i.top,t.top),t.right=Oi(i.right,t.right),t.bottom=Oi(i.bottom,t.bottom),t.left=Di(i.left,t.left),t},ba(e,o,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function Ca(e){var t=e.reference,n=e.element,r=e.placement,i=r?Ei(r):null,a=r?Qi(r):null,o=t.x+t.width/2-n.width/2,s=t.y+t.height/2-n.height/2,c;switch(i){case`top`:c={x:o,y:t.y-n.height};break;case ai:c={x:o,y:t.y+t.height};break;case oi:c={x:t.x+t.width,y:s};break;case si:c={x:t.x-n.width,y:s};break;default:c={x:t.x,y:t.y}}var l=i?Hi(i):null;if(l!=null){var u=l===`y`?`height`:`width`;switch(a){case ui:c[l]=c[l]-(t[u]/2-n[u]/2);break;case`end`:c[l]=c[l]+(t[u]/2-n[u]/2)}}return c}function wa(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=r===void 0?e.placement:r,a=n.strategy,o=a===void 0?e.strategy:a,s=n.boundary,c=s===void 0?di:s,l=n.rootBoundary,u=l===void 0?fi:l,d=n.elementContext,f=d===void 0?pi:d,p=n.altBoundary,m=p!==void 0&&p,h=n.padding,g=h===void 0?0:h,_=Ki(typeof g==`number`?qi(g,li):g),v=f===`popper`?mi:pi,y=e.rects.popper,b=e.elements[m?v:f],x=Sa(bi(b)?b:b.contextElement||Li(e.elements.popper),c,u,o),S=Mi(e.elements.reference),C=Ca({reference:S,element:y,strategy:`absolute`,placement:i}),w=va(Object.assign({},y,C)),T=f===`popper`?w:S,E={top:x.top-T.top+_.top,bottom:T.bottom-x.bottom+_.bottom,left:x.left-T.left+_.left,right:T.right-x.right+_.right},D=e.modifiersData.offset;if(f===`popper`&&D){var O=D[i];Object.keys(E).forEach(function(e){var t=[`right`,`bottom`].indexOf(e)>=0?1:-1,n=[`top`,`bottom`].indexOf(e)>=0?`y`:`x`;E[e]+=O[n]*t})}return E}function Ta(e,t){t===void 0&&(t={});var n=t,r=n.placement,i=n.boundary,a=n.rootBoundary,o=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,l=c===void 0?gi:c,u=Qi(r),d=u?s?hi:hi.filter(function(e){return Qi(e)===u}):li,f=d.filter(function(e){return l.indexOf(e)>=0});f.length===0&&(f=d);var p=f.reduce(function(t,n){return t[n]=wa(e,{placement:n,boundary:i,rootBoundary:a,padding:o})[Ei(n)],t},{});return Object.keys(p).sort(function(e,t){return p[e]-p[t]})}function Ea(e){if(Ei(e)===`auto`)return[];var t=ca(e);return[ua(e),t,ua(t)]}function Da(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var i=n.mainAxis,a=i===void 0||i,o=n.altAxis,s=o===void 0||o,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,f=n.altBoundary,p=n.flipVariations,m=p===void 0||p,h=n.allowedAutoPlacements,g=t.options.placement,_=Ei(g)===g,v=c||(_||!m?[ca(g)]:Ea(g)),y=[g].concat(v).reduce(function(e,n){return e.concat(Ei(n)===`auto`?Ta(t,{placement:n,boundary:u,rootBoundary:d,padding:l,flipVariations:m,allowedAutoPlacements:h}):n)},[]),b=t.rects.reference,x=t.rects.popper,S=new Map,C=!0,w=y[0],T=0;T<y.length;T++){var E=y[T],D=Ei(E),O=Qi(E)===ui,k=[`top`,ai].indexOf(D)>=0,A=k?`width`:`height`,j=wa(t,{placement:E,boundary:u,rootBoundary:d,altBoundary:f,padding:l}),M=k?O?oi:si:O?ai:`top`;b[A]>x[A]&&(M=ca(M));var N=ca(M),P=[];if(a&&P.push(j[D]<=0),s&&P.push(j[M]<=0,j[N]<=0),P.every(function(e){return e})){w=E,C=!1;break}S.set(E,P)}if(C)for(var F=m?3:1,I=function(e){var t=y.find(function(t){var n=S.get(t);if(n)return n.slice(0,e).every(function(e){return e})});if(t)return w=t,`break`},ee=F;ee>0&&I(ee)!==`break`;ee--);t.placement!==w&&(t.modifiersData[r]._skip=!0,t.placement=w,t.reset=!0)}}var Oa={name:`flip`,enabled:!0,phase:`main`,fn:Da,requiresIfExists:[`offset`],data:{_skip:!1}};function ka(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Aa(e){return[`top`,oi,ai,si].some(function(t){return e[t]>=0})}function ja(e){var t=e.state,n=e.name,r=t.rects.reference,i=t.rects.popper,a=t.modifiersData.preventOverflow,o=wa(t,{elementContext:`reference`}),s=wa(t,{altBoundary:!0}),c=ka(o,r),l=ka(s,i,a),u=Aa(c),d=Aa(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}var Ma={name:`hide`,enabled:!0,phase:`main`,requiresIfExists:[`preventOverflow`],fn:ja};function Na(e,t,n){var r=Ei(e),i=[`left`,`top`].indexOf(r)>=0?-1:1,a=typeof n==`function`?n(Object.assign({},t,{placement:e})):n,o=a[0],s=a[1];return o||=0,s=(s||0)*i,[`left`,`right`].indexOf(r)>=0?{x:s,y:o}:{x:o,y:s}}function Pa(e){var t=e.state,n=e.options,r=e.name,i=n.offset,a=i===void 0?[0,0]:i,o=gi.reduce(function(e,n){return e[n]=Na(n,t.rects,a),e},{}),s=o[t.placement],c=s.x,l=s.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[r]=o}var Fa={name:`offset`,enabled:!0,phase:`main`,requires:[`popperOffsets`],fn:Pa};function Ia(e){var t=e.state,n=e.name;t.modifiersData[n]=Ca({reference:t.rects.reference,element:t.rects.popper,strategy:`absolute`,placement:t.placement})}var La={name:`popperOffsets`,enabled:!0,phase:`read`,fn:Ia,data:{}};function Ra(e){return e===`x`?`y`:`x`}function za(e){var t=e.state,n=e.options,r=e.name,i=n.mainAxis,a=i===void 0||i,o=n.altAxis,s=o!==void 0&&o,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,f=n.tether,p=f===void 0||f,m=n.tetherOffset,h=m===void 0?0:m,g=wa(t,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),_=Ei(t.placement),v=Qi(t.placement),y=!v,b=Hi(_),x=Ra(b),S=t.modifiersData.popperOffsets,C=t.rects.reference,w=t.rects.popper,T=typeof h==`function`?h(Object.assign({},t.rects,{placement:t.placement})):h,E=typeof T==`number`?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),D=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,O={x:0,y:0};if(S){if(a){var k=b===`y`?`top`:si,A=b===`y`?ai:oi,j=b===`y`?`height`:`width`,M=S[b],N=M+g[k],P=M-g[A],F=p?-w[j]/2:0,I=v===`start`?C[j]:w[j],ee=v===`start`?-w[j]:-C[j],te=t.elements.arrow,L=p&&te?Ni(te):{width:0,height:0},ne=t.modifiersData[`arrow#persistent`]?t.modifiersData[`arrow#persistent`].padding:Gi(),R=ne[k],z=ne[A],re=Ui(0,C[j],L[j]),ie=y?C[j]/2-F-re-R-E.mainAxis:I-re-R-E.mainAxis,ae=y?-C[j]/2+F+re+z+E.mainAxis:ee+re+z+E.mainAxis,oe=t.elements.arrow&&Vi(t.elements.arrow),se=oe?b===`y`?oe.clientTop||0:oe.clientLeft||0:0,ce=D?.[b]??0,le=M+ie-ce-se,ue=M+ae-ce,de=Ui(p?Oi(N,le):N,M,p?Di(P,ue):P);S[b]=de,O[b]=de-M}if(s){var fe=b===`x`?`top`:si,pe=b===`x`?ai:oi,me=S[x],he=x===`y`?`height`:`width`,ge=me+g[fe],_e=me-g[pe],ve=[`top`,si].indexOf(_)!==-1,ye=D?.[x]??0,be=ve?ge:me-C[he]-w[he]-ye+E.altAxis,xe=ve?me+C[he]+w[he]-ye-E.altAxis:_e,Se=p&&ve?Wi(be,me,xe):Ui(p?be:ge,me,p?xe:_e);S[x]=Se,O[x]=Se-me}t.modifiersData[r]=O}}var Ba={name:`preventOverflow`,enabled:!0,phase:`main`,fn:za,requiresIfExists:[`offset`]};function Va(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Ha(e){return e===yi(e)||!xi(e)?da(e):Va(e)}function Ua(e){var t=e.getBoundingClientRect(),n=ki(t.width)/e.offsetWidth||1,r=ki(t.height)/e.offsetHeight||1;return n!==1||r!==1}function Wa(e,t,n){n===void 0&&(n=!1);var r=xi(t),i=xi(t)&&Ua(t),a=Li(t),o=Mi(e,i,n),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((vi(t)!==`body`||ha(a))&&(s=Ha(t)),xi(t)?(c=Mi(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):a&&(c.x=fa(a))),{x:o.left+s.scrollLeft-c.x,y:o.top+s.scrollTop-c.y,width:o.width,height:o.height}}function Ga(e){var t=new Map,n=new Set,r=[];e.forEach(function(e){t.set(e.name,e)});function i(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach(function(e){if(!n.has(e)){var r=t.get(e);r&&i(r)}}),r.push(e)}return e.forEach(function(e){n.has(e.name)||i(e)}),r}function Ka(e){var t=Ga(e);return _i.reduce(function(e,n){return e.concat(t.filter(function(e){return e.phase===n}))},[])}function qa(e){var t;return function(){return t||=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})}),t}}function Ja(e){var t=e.reduce(function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e},{});return Object.keys(t).map(function(e){return t[e]})}var Ya={placement:`bottom`,modifiers:[],strategy:`absolute`};function Xa(){return![...arguments].some(function(e){return!(e&&typeof e.getBoundingClientRect==`function`)})}function Za(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,i=t.defaultOptions,a=i===void 0?Ya:i;return function(e,t,n){n===void 0&&(n=a);var i={placement:`bottom`,orderedModifiers:[],options:Object.assign({},Ya,a),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},o=[],s=!1,c={state:i,setOptions:function(n){var o=typeof n==`function`?n(i.options):n;u(),i.options=Object.assign({},a,i.options,o),i.scrollParents={reference:bi(e)?_a(e):e.contextElement?_a(e.contextElement):[],popper:_a(t)};var s=Ka(Ja([].concat(r,i.options.modifiers)));return i.orderedModifiers=s.filter(function(e){return e.enabled}),l(),c.update()},forceUpdate:function(){if(!s){var e=i.elements,t=e.reference,n=e.popper;if(Xa(t,n)){i.rects={reference:Wa(t,Vi(n),i.options.strategy===`fixed`),popper:Ni(n)},i.reset=!1,i.placement=i.options.placement,i.orderedModifiers.forEach(function(e){return i.modifiersData[e.name]=Object.assign({},e.data)});for(var r=0;r<i.orderedModifiers.length;r++){if(i.reset===!0){i.reset=!1,r=-1;continue}var a=i.orderedModifiers[r],o=a.fn,l=a.options,u=l===void 0?{}:l,d=a.name;typeof o==`function`&&(i=o({state:i,options:u,name:d,instance:c})||i)}}}},update:qa(function(){return new Promise(function(e){c.forceUpdate(),e(i)})}),destroy:function(){u(),s=!0}};if(!Xa(e,t))return c;c.setOptions(n).then(function(e){!s&&n.onFirstUpdate&&n.onFirstUpdate(e)});function l(){i.orderedModifiers.forEach(function(e){var t=e.name,n=e.options,r=n===void 0?{}:n,a=e.effect;if(typeof a==`function`){var s=a({state:i,name:t,instance:c,options:r});o.push(s||function(){})}})}function u(){o.forEach(function(e){return e()}),o=[]}return c}}var Qa=Za({defaultModifiers:[oa,La,ra,Ti,Fa,Oa,Ba,Zi,Ma]});function $a(e){return M(`MuiPopper`,e)}g(`MuiPopper`,[`root`]);function eo(e,t){if(t===`ltr`)return e;switch(e){case`bottom-end`:return`bottom-start`;case`bottom-start`:return`bottom-end`;case`top-end`:return`top-start`;case`top-start`:return`top-end`;default:return e}}function to(e){return typeof e==`function`?e():e}function no(e){return e.nodeType!==void 0}var ro=e=>{let{classes:t}=e;return B({root:[`root`]},$a,t)},io={},ao=Y.forwardRef(function(e,t){let{anchorEl:n,children:r,direction:i,disablePortal:a,modifiers:o,open:s,placement:c,popperOptions:l,popperRef:u,slotProps:d={},slots:f={},TransitionProps:p,ownerState:m,...h}=e,g=Y.useRef(null),_=ke(g,t),v=Y.useRef(null),y=ke(v,u),b=Y.useRef(y);Ce(()=>{b.current=y},[y]),Y.useImperativeHandle(u,()=>v.current,[]);let x=eo(c,i),[S,C]=Y.useState(x),w=Y.useMemo(()=>to(n),[n]);Y.useEffect(()=>{v.current&&v.current.forceUpdate()}),Ce(()=>{if(!w||!s)return;let e=e=>{C(e.placement)},t=[{name:`preventOverflow`,options:{altBoundary:a}},{name:`flip`,options:{altBoundary:a}},{name:`onUpdate`,enabled:!0,phase:`afterWrite`,fn:({state:t})=>{e(t)}}];o!=null&&(t=t.concat(o)),l&&l.modifiers!=null&&(t=t.concat(l.modifiers));let n=Qa(w,g.current,{placement:x,...l,modifiers:t});b.current(n);let r=g.current;return()=>{if(r){let{style:e}=r,t=e.position,i=e.top,a=e.left,o=e.transform;n.destroy(),e.position=t,e.top=i,e.left=a,e.transform=o}else n.destroy();b.current(null)}},[w,a,o,s,l,x]);let T={placement:S};p!==null&&(T.TransitionProps=p);let E=ro(e),D=f.root??`div`,O=ot({elementType:D,externalSlotProps:d.root,externalForwardedProps:h,additionalProps:{role:`tooltip`,ref:_},ownerState:e,className:E.root});return(0,X.jsx)(D,{...O,children:typeof r==`function`?r(T):r})}),oo=W(Y.forwardRef(function(e,t){let{anchorEl:n,children:r,container:i,direction:a=`ltr`,disablePortal:o=!1,keepMounted:s=!1,modifiers:c,open:l,placement:u=`bottom`,popperOptions:d=io,popperRef:f,style:p,transition:m=!1,slotProps:h={},slots:g={},..._}=e,[v,y]=Y.useState(!0),b=()=>{y(!1)},x=()=>{y(!0)};if(!s&&!l&&(!m||v))return null;let S;if(i)S=i;else if(n){let e=to(n);S=e&&no(e)?Je(e).body:Je(null).body}let C=!l&&s&&(!m||v)?`none`:void 0,w=m?{in:l,onEnter:b,onExited:x}:void 0;return(0,X.jsx)(re,{disablePortal:o,container:S,children:(0,X.jsx)(ao,{anchorEl:n,direction:a,disablePortal:o,modifiers:c,ref:t,open:m?!v:l,placement:u,popperOptions:d,popperRef:f,slotProps:h,slots:g,..._,style:{position:`fixed`,top:0,left:0,display:C,...p},TransitionProps:w,children:r})})}),{name:`MuiPopper`,slot:`Root`})({}),so=Y.forwardRef(function(e,t){let n=Ye(),{anchorEl:r,component:i,container:a,disablePortal:o,keepMounted:s,modifiers:c,open:l,placement:u,popperOptions:d,popperRef:f,transition:p,slots:m,slotProps:h,...g}=we({props:e,name:`MuiPopper`}),_={anchorEl:r,container:a,disablePortal:o,keepMounted:s,modifiers:c,open:l,placement:u,popperOptions:d,popperRef:f,transition:p,...g};return(0,X.jsx)(oo,{as:i,direction:n?`rtl`:`ltr`,slots:m,slotProps:h,..._,ref:t})});function co(e){return M(`MuiTooltip`,e)}var lo=g(`MuiTooltip`,[`popper`,`popperInteractive`,`popperArrow`,`popperClose`,`tooltip`,`tooltipArrow`,`touch`,`tooltipPlacementLeft`,`tooltipPlacementRight`,`tooltipPlacementTop`,`tooltipPlacementBottom`,`arrow`]);function uo(e){return Math.round(e*1e5)/1e5}var fo=e=>{let{classes:t,disableInteractive:n,arrow:r,touch:i,placement:a}=e,o={popper:[`popper`,!n&&`popperInteractive`,r&&`popperArrow`],tooltip:[`tooltip`,r&&`tooltipArrow`,i&&`touch`,`tooltipPlacement${G(a.split(`-`)[0])}`],arrow:[`arrow`]};return B(o,co,t)},po=W(so,{name:`MuiTooltip`,slot:`Popper`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.popper,!n.disableInteractive&&t.popperInteractive,n.arrow&&t.popperArrow,!n.open&&t.popperClose]}})(V(({theme:e})=>({zIndex:(e.vars||e).zIndex.tooltip,pointerEvents:`none`,variants:[{props:({ownerState:e,open:t})=>t&&!e.disableInteractive,style:{pointerEvents:`auto`}},{props:({ownerState:e})=>e.arrow,style:{[`&[data-popper-placement*="bottom"] .${lo.arrow}`]:{top:0,marginTop:`-0.71em`,"&::before":{transformOrigin:`0 100%`}},[`&[data-popper-placement*="top"] .${lo.arrow}`]:{bottom:0,marginBottom:`-0.71em`,"&::before":{transformOrigin:`100% 0`}},[`&[data-popper-placement*="right"] .${lo.arrow}`]:{height:`1em`,width:`0.71em`,insetInlineStart:0,marginInlineStart:`-0.71em`,"&::before":{transformOrigin:`100% 100%`}},[`&[data-popper-placement*="left"] .${lo.arrow}`]:{height:`1em`,width:`0.71em`,insetInlineEnd:0,marginInlineEnd:`-0.71em`,"&::before":{transformOrigin:`0 0`}}}}]}))),mo=W(`div`,{name:`MuiTooltip`,slot:`Tooltip`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.tooltip,n.touch&&t.touch,n.arrow&&t.tooltipArrow,t[`tooltipPlacement${G(n.placement.split(`-`)[0])}`]]}})(V(({theme:e})=>({backgroundColor:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.92),borderRadius:(e.vars||e).shape.borderRadius,color:(e.vars||e).palette.common.white,fontFamily:e.typography.fontFamily,padding:`4px 8px`,fontSize:e.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:`break-word`,fontWeight:e.typography.fontWeightMedium,[`.${lo.popper}[data-popper-placement*="left"] &`]:{transformOrigin:`right center`,marginInlineEnd:`14px`},[`.${lo.popper}[data-popper-placement*="right"] &`]:{transformOrigin:`left center`,marginInlineStart:`14px`},[`.${lo.popper}[data-popper-placement*="top"] &`]:{transformOrigin:`center bottom`,marginBottom:`14px`},[`.${lo.popper}[data-popper-placement*="bottom"] &`]:{transformOrigin:`center top`,marginTop:`14px`},variants:[{props:({ownerState:e})=>e.arrow,style:{position:`relative`,marginBlock:0}},{props:({ownerState:e})=>e.touch,style:{padding:`8px 16px`,fontSize:e.typography.pxToRem(14),lineHeight:`${uo(16/14)}em`,fontWeight:e.typography.fontWeightRegular}},{props:({ownerState:e})=>e.touch,style:{[`.${lo.popper}[data-popper-placement*="left"] &`]:{marginInlineEnd:`24px`},[`.${lo.popper}[data-popper-placement*="right"] &`]:{marginInlineStart:`24px`},[`.${lo.popper}[data-popper-placement*="top"] &`]:{marginBottom:`24px`},[`.${lo.popper}[data-popper-placement*="bottom"] &`]:{marginTop:`24px`}}}]}))),ho=W(`span`,{name:`MuiTooltip`,slot:`Arrow`})(V(({theme:e})=>({overflow:`hidden`,position:`absolute`,width:`1em`,height:`0.71em`,boxSizing:`border-box`,color:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.9),"&::before":{content:`""`,margin:`auto`,display:`block`,width:`100%`,height:`100%`,backgroundColor:`currentColor`,transform:`rotate(45deg)`}}))),go=!1,_o=new Me,vo={x:0,y:0};function yo(e,t){return(n,...r)=>{t&&t(n,...r),e(n,...r)}}var bo=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiTooltip`}),{arrow:r=!1,children:i,classes:a,describeChild:o=!1,disableFocusListener:s=!1,disableHoverListener:c=!1,disableInteractive:l=!1,disableTouchListener:u=!1,enterDelay:d=100,enterNextDelay:f=0,enterTouchDelay:p=700,followCursor:m=!1,id:h,leaveDelay:g=0,leaveTouchDelay:_=1500,onClose:v,onOpen:b,open:x,placement:S=`bottom`,slotProps:C={},slots:w={},title:T,...E}=n,D=Y.isValidElement(i)?i:(0,X.jsx)(`span`,{children:i}),O=y(),[k,A]=Y.useState(),[j,M]=Y.useState(null),N=Y.useRef(!1),F=l||m,I=He(),ee=He(),te=He(),ne=He(),[z,re]=R({controlled:x,default:!1,name:`Tooltip`,state:`open`}),ie=z,ae=Ge(h),oe=Y.useRef(),se=H(()=>{oe.current!==void 0&&(document.body.style.WebkitUserSelect=oe.current,oe.current=void 0),ne.clear()});Y.useEffect(()=>se,[se]);let ce=e=>{_o.clear(),go=!0,re(!0),b&&!ie&&b(e)},le=H(e=>{_o.start(800+g,()=>{go=!1}),re(!1),v&&ie&&v(e),I.start(O.transitions.duration.shortest,()=>{N.current=!1})}),ue=e=>{k?.disabled||N.current&&e.type!==`touchstart`||(k&&k.removeAttribute(`title`),ee.clear(),te.clear(),d||go&&f?ee.start(go?f:d,()=>{ce(e)}):ce(e))},de=e=>{ee.clear(),te.start(g,()=>{le(e)})},[,fe]=Y.useState(!1),pe=e=>{let t=e?.target??k;if(!t||t.disabled||!ze(t)){fe(!1);let n=e??new Event(`blur`);!e&&t&&(Object.defineProperty(n,"target",{value:t}),Object.defineProperty(n,"currentTarget",{value:t})),de(n)}},me=e=>{if(k||A(e.currentTarget),ze(e.target)){let t=e=>{e.target.disabled&&pe(e),e.target.removeEventListener(`blur`,t)};e.target.addEventListener(`blur`,t),fe(!0),ue(e)}},ge=e=>{N.current=!0;let t=D.props;t.onTouchStart&&t.onTouchStart(e)},_e=e=>{ge(e),te.clear(),I.clear(),se(),oe.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect=`none`,ne.start(p,()=>{document.body.style.WebkitUserSelect=oe.current,ue(e)})},ve=e=>{D.props.onTouchEnd&&D.props.onTouchEnd(e),se(),te.start(_,()=>{le(e)})};Y.useEffect(()=>{if(!ie)return;function e(e){e.key===`Escape`&&le(e)}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[le,ie]);let ye=Ke(L(D),A,t);!T&&T!==0&&(ie=!1);let be=Y.useRef(),xe=e=>{let t=D.props;t.onMouseMove&&t.onMouseMove(e),vo={x:e.clientX,y:e.clientY},be.current&&be.current.update()},Se={},Ce=typeof T==`string`;o?(Se.title=!ie&&Ce&&!c?T:null,Se[`aria-describedby`]=ie?ae:null):(Se[`aria-label`]=Ce?T:null,Se[`aria-labelledby`]=ie&&!Ce?ae:null);let B={...Se,...E,...D.props,className:P(E.className,D.props.className),onTouchStart:ge,ref:ye,...m?{onMouseMove:xe}:{}},Te={};u||(B.onTouchStart=_e,B.onTouchEnd=ve),c||(B.onMouseOver=yo(ue,B.onMouseOver),B.onMouseLeave=yo(de,B.onMouseLeave),F||(Te.onMouseOver=ue,Te.onMouseLeave=de)),s||(B.onFocus=yo(me,B.onFocus),B.onBlur=yo(pe,B.onBlur),F||(Te.onFocus=me,Te.onBlur=pe));let Ee={...n,arrow:r,disableInteractive:F,placement:S,touch:N.current},De=typeof C.popper==`function`?C.popper(Ee):C.popper,Oe=Y.useMemo(()=>{let e=[{name:`arrow`,enabled:!!j,options:{element:j,padding:4}}];return De?.popperOptions?.modifiers&&(e=e.concat(De.popperOptions.modifiers)),{...De?.popperOptions,modifiers:e}},[j,De?.popperOptions]),ke=fo(Ee),Ae={slots:w,slotProps:{arrow:C.arrow,popper:De,tooltip:C.tooltip,transition:C.transition}},[je,Me]=nt(`popper`,{elementType:po,externalForwardedProps:Ae,ownerState:Ee,className:ke.popper}),[V,Ne]=nt(`transition`,{elementType:he,externalForwardedProps:Ae,ownerState:Ee}),[Pe,Fe]=nt(`tooltip`,{elementType:mo,className:ke.tooltip,externalForwardedProps:Ae,ownerState:Ee}),[Ie,Le]=nt(`arrow`,{elementType:ho,className:ke.arrow,externalForwardedProps:Ae,ownerState:Ee,ref:M});return(0,X.jsxs)(Y.Fragment,{children:[Y.cloneElement(D,B),(0,X.jsx)(je,{as:so,placement:S,anchorEl:m?{getBoundingClientRect:()=>({top:vo.y,left:vo.x,right:vo.x,bottom:vo.y,width:0,height:0})}:k,popperRef:be,open:k?ie:!1,id:ae,transition:!0,...Te,...Me,popperOptions:Oe,children:({TransitionProps:e})=>(0,X.jsx)(V,{timeout:O.transitions.duration.shorter,...e,...Ne,children:(0,X.jsxs)(Pe,{...Fe,children:[T,r?(0,X.jsx)(Ie,{...Le}):null]})})})]})}),xo=Et(),So=K((0,X.jsx)(`path`,{d:`M4 13h6c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v8c0 .55.45 1 1 1m0 8h6c.55 0 1-.45 1-1v-4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1m10 0h6c.55 0 1-.45 1-1v-8c0-.55-.45-1-1-1h-6c-.55 0-1 .45-1 1v8c0 .55.45 1 1 1M13 4v4c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1h-6c-.55 0-1 .45-1 1`}),`DashboardRounded`),Co=K((0,X.jsx)(`path`,{d:`M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2`}),`ChatBubbleRounded`),wo=K((0,X.jsx)(`path`,{d:`M14.59 2.59c-.38-.38-.89-.59-1.42-.59H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8.83c0-.53-.21-1.04-.59-1.41zM15 18H9c-.55 0-1-.45-1-1s.45-1 1-1h6c.55 0 1 .45 1 1s-.45 1-1 1m0-4H9c-.55 0-1-.45-1-1s.45-1 1-1h6c.55 0 1 .45 1 1s-.45 1-1 1m-2-6V3.5L18.5 9H14c-.55 0-1-.45-1-1`}),`DescriptionRounded`),To=K((0,X.jsx)(`path`,{d:`M3 7c.55 0 1 .45 1 1v13h13c.55 0 1 .45 1 1s-.45 1-1 1H4c-1.1 0-2-.9-2-2V8c0-.55.45-1 1-1m12.59-5.41c-.38-.38-.89-.59-1.42-.59H8c-1.1 0-1.99.9-1.99 2L6 17c0 1.1.89 2 1.99 2H19c1.1 0 2-.9 2-2V7.83c0-.53-.21-1.04-.59-1.41zM15.5 15h-4c-.55 0-1-.45-1-1s.45-1 1-1h4c.55 0 1 .45 1 1s-.45 1-1 1m0-6h-1v1c0 .55-.45 1-1 1s-1-.45-1-1V9h-1c-.55 0-1-.45-1-1s.45-1 1-1h1V6c0-.55.45-1 1-1s1 .45 1 1v1h1c.55 0 1 .45 1 1s-.45 1-1 1`}),`DifferenceRounded`),Eo=K((0,X.jsx)(`path`,{d:`M20 4H4c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2m0 14H4V8h16zm-8-2c0-.55.45-1 1-1h4c.55 0 1 .45 1 1s-.45 1-1 1h-4c-.55 0-1-.45-1-1M6.79 9.71c.39-.39 1.02-.39 1.41 0l2.59 2.59c.39.39.39 1.02 0 1.41L8.2 16.3c-.39.39-1.02.39-1.41 0a.996.996 0 0 1 0-1.41L8.67 13l-1.88-1.88a.996.996 0 0 1 0-1.41`}),`TerminalRounded`),Do=K((0,X.jsx)(`path`,{d:`M13.26 3C8.17 2.86 4 6.95 4 12H2.21c-.45 0-.67.54-.35.85l2.79 2.8c.2.2.51.2.71 0l2.79-2.8c.31-.31.09-.85-.36-.85H6c0-3.9 3.18-7.05 7.1-7 3.72.05 6.85 3.18 6.9 6.9.05 3.91-3.1 7.1-7 7.1-1.61 0-3.1-.55-4.28-1.48-.4-.31-.96-.28-1.32.08-.42.42-.39 1.13.08 1.49C9 20.29 10.91 21 13 21c5.05 0 9.14-4.17 9-9.26-.13-4.69-4.05-8.61-8.74-8.74m-.51 5c-.41 0-.75.34-.75.75v3.68c0 .35.19.68.49.86l3.12 1.85c.36.21.82.09 1.03-.26.21-.36.09-.82-.26-1.03l-2.88-1.71v-3.4c0-.4-.34-.74-.75-.74`}),`HistoryRounded`),Oo=K((0,X.jsx)(`path`,{d:`M9.19 6.35c-2.04 2.29-3.44 5.58-3.57 5.89l-2.26-.97c-.65-.28-.81-1.13-.31-1.63l3.01-3.01c.47-.47 1.15-.68 1.81-.55zm1.49 10.16c.3.3.74.38 1.12.2 1.16-.54 3.65-1.81 5.26-3.42 4.59-4.59 4.63-8.33 4.36-9.93-.07-.4-.39-.72-.79-.79-1.6-.27-5.34-.23-9.93 4.36-1.61 1.61-2.87 4.1-3.42 5.26-.18.38-.09.83.2 1.12zm6.97-1.7c-2.29 2.04-5.58 3.44-5.89 3.57l.97 2.26c.28.65 1.13.81 1.63.31l3.01-3.01c.47-.47.68-1.15.55-1.81zm-8.71 2.6c.2 1.06-.15 2.04-.82 2.71-.77.77-3.16 1.34-4.71 1.64-.69.13-1.3-.48-1.17-1.17.3-1.55.86-3.94 1.64-4.71.67-.67 1.65-1.02 2.71-.82 1.17.22 2.13 1.18 2.35 2.35M13 9c0-1.1.9-2 2-2s2 .9 2 2-.9 2-2 2-2-.9-2-2`}),`RocketLaunchRounded`),ko=K((0,X.jsx)(`path`,{d:`M4 18h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1m0-5h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1M3 7c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1`}),`MenuRounded`),Ao=K((0,X.jsx)(`path`,{d:`M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z`}),`LightModeRounded`),jo=K((0,X.jsx)(`path`,{d:`M11.01 3.05C6.51 3.54 3 7.36 3 12c0 4.97 4.03 9 9 9 4.63 0 8.45-3.5 8.95-8 .09-.79-.78-1.42-1.54-.95-.84.54-1.84.85-2.91.85-2.98 0-5.4-2.42-5.4-5.4 0-1.06.31-2.06.84-2.89.45-.67-.04-1.63-.93-1.56`}),`DarkModeRounded`),Mo=`piagent-workspace-open`;function No(e,t=1){let n=/^(.+?)(?::(\d+)(?::\d+)?)?$/.exec(e.replace(/^@/,``)),r=n?.[1];return!r||r.length>4096||/^[~/]/.test(r)||/[\\\x00-\x1f\x7f:]/.test(r)||r.split(`/`).some(e=>!e||e===`.`||e===`..`)?null:{path:r,line:Math.max(1,Math.min(1e6,Number(n?.[2])||t||1))}}var Po=(0,Y.createContext)(null);function Fo({sessionRef:e,onOpen:t,children:n}){return(0,X.jsx)(Po.Provider,{value:e?n=>{t(),window.dispatchEvent(new CustomEvent(Mo,{detail:{sessionRef:e,...n}}))}:null,children:n})}function Io({path:e,line:t,children:n}){let r=(0,Y.useContext)(Po),{locale:i}=C(),a=No(e,t);return!r||!a?n?(0,X.jsx)(X.Fragment,{children:n}):null:(0,X.jsx)(J,{size:`small`,onClick:()=>r(a),sx:{textTransform:`none`,verticalAlign:`baseline`},children:n??D(i,`Mở trong editor`,`Open in editor`)})}function Lo({children:e}){return(0,X.jsx)(X.Fragment,{children:Y.Children.map(e,e=>typeof e==`string`?e.split(/((?<![\w@])@[\w./-]+\.[\w]+(?::\d+)?)/g).map((e,t)=>e.startsWith(`@`)&&No(e)?(0,X.jsx)(Io,{path:e,children:e},t):e):e)})}var Ro=K((0,X.jsx)(`path`,{d:`M20 6h-8l-1.41-1.41C10.21 4.21 9.7 4 9.17 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m-1 12H5c-.55 0-1-.45-1-1V9c0-.55.45-1 1-1h14c.55 0 1 .45 1 1v8c0 .55-.45 1-1 1`}),`FolderOpenRounded`);function zo(e){return M(`MuiTab`,e)}var Bo=g(`MuiTab`,[`root`,`labelIcon`,`textColorInherit`,`textColorPrimary`,`textColorSecondary`,`selected`,`disabled`,`fullWidth`,`wrapped`,`icon`]),Vo=e=>{let{classes:t,textColor:n,fullWidth:r,wrapped:i,icon:a,label:o,selected:s,disabled:c}=e,l={root:[`root`,a&&o&&`labelIcon`,`textColor${G(n)}`,r&&`fullWidth`,i&&`wrapped`,s&&`selected`,c&&`disabled`],icon:[`icon`]};return B(l,zo,t)},Ho=W(We,{name:`MuiTab`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.label&&n.icon&&t.labelIcon,t[`textColor${G(n.textColor)}`],n.fullWidth&&t.fullWidth,n.wrapped&&t.wrapped,{[`& .${Bo.icon}`]:t.icon}]}})(V(({theme:e})=>({...e.typography.button,maxWidth:360,minWidth:90,position:`relative`,minHeight:48,flexShrink:0,padding:`12px 16px`,overflow:`hidden`,whiteSpace:`normal`,textAlign:`center`,lineHeight:1.25,variants:[{props:({ownerState:e})=>e.label&&(e.iconPosition===`top`||e.iconPosition===`bottom`),style:{flexDirection:`column`}},{props:({ownerState:e})=>e.label&&e.iconPosition!==`top`&&e.iconPosition!==`bottom`,style:{flexDirection:`row`}},{props:({ownerState:e})=>e.icon&&e.label,style:{minHeight:72,paddingTop:9,paddingBottom:9}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`top`,style:{[`& > .${Bo.icon}`]:{marginBottom:6}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`bottom`,style:{[`& > .${Bo.icon}`]:{marginTop:6}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`start`,style:{[`& > .${Bo.icon}`]:{marginRight:e.spacing(1)}}},{props:({ownerState:e,iconPosition:t})=>e.icon&&e.label&&t===`end`,style:{[`& > .${Bo.icon}`]:{marginLeft:e.spacing(1)}}},{props:{textColor:`inherit`},style:{color:`inherit`,opacity:.6,[`&.${Bo.selected}`]:{opacity:1},[`&.${Bo.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity}}},{props:{textColor:`primary`},style:{color:(e.vars||e).palette.text.secondary,[`&.${Bo.selected}`]:{color:(e.vars||e).palette.primary.main},[`&.${Bo.disabled}`]:{color:(e.vars||e).palette.text.disabled}}},{props:{textColor:`secondary`},style:{color:(e.vars||e).palette.text.secondary,[`&.${Bo.selected}`]:{color:(e.vars||e).palette.secondary.main},[`&.${Bo.disabled}`]:{color:(e.vars||e).palette.text.disabled}}},{props:({ownerState:e})=>e.fullWidth,style:{flexShrink:1,flexGrow:1,flexBasis:0,maxWidth:`none`}},{props:({ownerState:e})=>e.wrapped,style:{fontSize:e.typography.pxToRem(12)}}]}))),Uo=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiTab`}),{className:r,disabled:i=!1,disableFocusRipple:a=!1,fullWidth:o,icon:s,iconPosition:c=`top`,indicator:l,label:u,onChange:d,onClick:f,onFocus:p,selected:m,selectionFollowsFocus:h,textColor:g=`inherit`,value:_,wrapped:v=!1,...y}=n,b=lt(),x=it({id:_,ref:t,disabled:i,selected:m}),S=b.getItemMap().size===0&&m?0:x.tabIndex,C={...n,disabled:i,disableFocusRipple:a,selected:m,icon:!!s,iconPosition:c,label:!!u,fullWidth:o,textColor:g,wrapped:v},w=Vo(C),T=s&&u&&Y.isValidElement(s)?Y.cloneElement(s,{className:P(w.icon,s.props.className)}):s;return(0,X.jsxs)(Ho,{internalNativeButton:!0,focusRipple:!a,className:P(w.root,r),ref:x.ref,role:`tab`,"aria-selected":m,disabled:i,onClick:e=>{!m&&d&&d(e,_),f&&f(e)},onFocus:e=>{h&&!m&&d&&d(e,_),p&&p(e)},tabIndex:S,ownerState:C,...y,children:[c===`top`||c===`start`?(0,X.jsxs)(Y.Fragment,{children:[T,u]}):(0,X.jsxs)(Y.Fragment,{children:[u,T]}),l]})});function Wo(e){return(1+Math.sin(Math.PI*e-Math.PI/2))/2}function Go(e,t,n,r={},i=()=>{}){let{ease:a=Wo,duration:o=300}=r,s=null,c=t[e],l=!1,u=()=>{l=!0},d=r=>{if(l){i(Error(`Animation cancelled`));return}s===null&&(s=r);let u=Math.min(1,(r-s)/o);if(t[e]=a(u)*(n-c)+c,u>=1){requestAnimationFrame(()=>{i(null)});return}requestAnimationFrame(d)};return c===n?(i(Error(`Element already at target position`)),u):(requestAnimationFrame(d),u)}var Ko={width:99,height:99,position:`absolute`,top:-9999,overflow:`scroll`,pointerEvents:`none`};function qo(e){let{onChange:t,...n}=e,r=Y.useRef(),i=Y.useRef(null),a=()=>{r.current=i.current.offsetHeight-i.current.clientHeight};return ft(()=>{let e=dt(()=>{let e=r.current;a(),e!==r.current&&t(r.current)}),n=at(i.current);return n.addEventListener(`resize`,e),()=>{e.clear(),n.removeEventListener(`resize`,e)}},[t]),Y.useEffect(()=>{a(),t(r.current)},[t]),(0,X.jsx)(`div`,{style:Ko,...n,ref:i})}var Jo=K((0,X.jsx)(`path`,{d:`M15.41 16.09l-4.58-4.59 4.58-4.59L14 5.5l-6 6 6 6z`}),`KeyboardArrowLeft`),Yo=K((0,X.jsx)(`path`,{d:`M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z`}),`KeyboardArrowRight`);function Xo(e){return M(`MuiTabScrollButton`,e)}var Zo=g(`MuiTabScrollButton`,[`root`,`vertical`,`horizontal`,`disabled`]),Qo=e=>{let{classes:t,orientation:n,disabled:r}=e;return B({root:[`root`,n,r&&`disabled`]},Xo,t)},$o=W(We,{name:`MuiTabScrollButton`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.orientation&&t[n.orientation]]}})({width:40,flexShrink:0,opacity:.8,[`&.${Zo.disabled}`]:{opacity:0},variants:[{props:{orientation:`vertical`},style:{width:`100%`,height:40,"& svg":{transform:`var(--TabScrollButton-svgRotate)`}}}]}),es=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiTabScrollButton`}),{className:r,slots:i={},slotProps:a={},direction:o,orientation:s,disabled:c,...l}=n,{nativeButton:u,...d}=l,f=Ye(),p={isRtl:f,...n},m=Qo(p),h=i.StartScrollButtonIcon??Jo,g=i.EndScrollButtonIcon??Yo,_=ot({elementType:h,externalSlotProps:a.startScrollButtonIcon,additionalProps:{fontSize:`small`},ownerState:p}),v=ot({elementType:g,externalSlotProps:a.endScrollButtonIcon,additionalProps:{fontSize:`small`},ownerState:p});return(0,X.jsx)($o,{component:`div`,className:P(m.root,r),ref:t,role:null,ownerState:p,tabIndex:null,...d,style:{...d.style,...s===`vertical`&&{"--TabScrollButton-svgRotate":`rotate(${f?-90:90}deg)`}},children:o===`left`?(0,X.jsx)(h,{..._}):(0,X.jsx)(g,{...v})})});function ts(e){return M(`MuiTabs`,e)}var ns=g(`MuiTabs`,[`root`,`vertical`,`list`,`centered`,`scroller`,`fixed`,`scrollableX`,`scrollableY`,`hideScrollbar`,`scrollButtons`,`scrollButtonsHideMobile`,`indicator`]),rs=e=>{let{vertical:t,fixed:n,hideScrollbar:r,scrollableX:i,scrollableY:a,centered:o,scrollButtonsHideMobile:s,classes:c}=e;return B({root:[`root`,t&&`vertical`],scroller:[`scroller`,n&&`fixed`,r&&`hideScrollbar`,i&&`scrollableX`,a&&`scrollableY`],list:[`list`,t&&`vertical`,o&&`centered`],indicator:[`indicator`],scrollButtons:[`scrollButtons`,s&&`scrollButtonsHideMobile`],scrollableX:[i&&`scrollableX`],hideScrollbar:[r&&`hideScrollbar`]},ts,c)},is=W(`div`,{name:`MuiTabs`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[{[`& .${ns.scrollButtons}`]:t.scrollButtons},{[`& .${ns.scrollButtons}`]:n.scrollButtonsHideMobile&&t.scrollButtonsHideMobile},t.root,n.vertical&&t.vertical]}})(V(({theme:e})=>({overflow:`hidden`,minHeight:48,WebkitOverflowScrolling:`touch`,display:`flex`,variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:`column`}},{props:({ownerState:e})=>e.scrollButtonsHideMobile,style:{[`& .${ns.scrollButtons}`]:{[e.breakpoints.down(`sm`)]:{display:`none`}}}}]}))),as=W(`div`,{name:`MuiTabs`,slot:`Scroller`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.scroller,n.fixed&&t.fixed,n.hideScrollbar&&t.hideScrollbar,n.scrollableX&&t.scrollableX,n.scrollableY&&t.scrollableY]}})({position:`relative`,display:`inline-block`,flex:`1 1 auto`,whiteSpace:`nowrap`,variants:[{props:({ownerState:e})=>e.fixed,style:{overflowX:`hidden`,width:`100%`}},{props:({ownerState:e})=>e.hideScrollbar,style:{scrollbarWidth:`none`,"&::-webkit-scrollbar":{display:`none`}}},{props:({ownerState:e})=>e.scrollableX,style:{overflowX:`auto`,overflowY:`hidden`}},{props:({ownerState:e})=>e.scrollableY,style:{overflowY:`auto`,overflowX:`hidden`}}]}),os=W(`div`,{name:`MuiTabs`,slot:`List`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.list,n.centered&&t.centered]}})({display:`flex`,variants:[{props:({ownerState:e})=>e.vertical,style:{flexDirection:`column`}},{props:({ownerState:e})=>e.centered,style:{justifyContent:`center`}}]}),ss=W(`span`,{name:`MuiTabs`,slot:`Indicator`})(V(({theme:e})=>({position:`absolute`,height:2,bottom:0,width:`100%`,...Be(e),variants:[{props:{indicatorColor:`primary`},style:{backgroundColor:(e.vars||e).palette.primary.main}},{props:{indicatorColor:`secondary`},style:{backgroundColor:(e.vars||e).palette.secondary.main}},{props:({ownerState:e})=>e.vertical,style:{height:`100%`,width:2,right:0}}]}))),cs=W(qo)({overflowX:`auto`,overflowY:`hidden`,scrollbarWidth:`none`,"&::-webkit-scrollbar":{display:`none`}}),ls={},us=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiTabs`}),r=y(),i=Ye(),a=Ie(r.motion.reducedMotion,!1),{"aria-label":o,"aria-labelledby":s,action:c,centered:l=!1,children:u,className:d,component:f=`div`,allowScrollButtonsMobile:p=!1,indicatorColor:m=`primary`,onChange:h,orientation:g=`horizontal`,scrollButtons:_=`auto`,selectionFollowsFocus:v,slots:b={},slotProps:x={},textColor:S=`primary`,value:C,variant:w=`standard`,visibleScrollbar:T=!1,...E}=n,D=w===`scrollable`,O=g===`vertical`,k=O?`scrollTop`:`scrollLeft`,A=O?`top`:`left`,j=O?`bottom`:`right`,M=O?`clientHeight`:`clientWidth`,N=O?`height`:`width`,F={...n,component:f,allowScrollButtonsMobile:p,indicatorColor:m,orientation:g,vertical:O,scrollButtons:_,textColor:S,variant:w,visibleScrollbar:T,fixed:!D,hideScrollbar:D&&!T,scrollableX:D&&!O,scrollableY:D&&O,centered:l&&!D,scrollButtonsHideMobile:!p},I=rs(F),ee=ot({elementType:b.startScrollButtonIcon,externalSlotProps:x.startScrollButtonIcon,ownerState:F}),te=ot({elementType:b.endScrollButtonIcon,externalSlotProps:x.endScrollButtonIcon,ownerState:F}),[L,ne]=Y.useState(!1),[R,z]=Y.useState(ls),[re,ie]=Y.useState(!1),[ae,oe]=Y.useState(!1),[se,ce]=Y.useState(!1),le=C===!1?null:C,[ue,de]=Y.useState(!1),[fe,pe]=Y.useState({overflow:`hidden`,scrollbarWidth:0}),me=new Map,he=Y.useRef(null),ge=Y.useRef(null),_e={slots:b,slotProps:x},ve=()=>{let e=he.current,t;if(e){let n=e.getBoundingClientRect();t={clientWidth:e.clientWidth,scrollLeft:e.scrollLeft,scrollTop:e.scrollTop,scrollWidth:e.scrollWidth,top:n.top,bottom:n.bottom,left:n.left,right:n.right}}let n;if(e&&C!==!1){let e=ge.current.children;if(e.length>0){let t=e[me.get(C)];n=t?t.getBoundingClientRect():null}}return{tabsMeta:t,tabMeta:n}},ye=H(()=>{let{tabsMeta:e,tabMeta:t}=ve(),n=0,r;O?(r=`top`,t&&e&&(n=t.top-e.top+e.scrollTop)):(r=i?`right`:`left`,t&&e&&(n=(i?-1:1)*(t[r]-e[r]+e.scrollLeft)));let a={[r]:n,[N]:t?t[N]:0};if(typeof R[r]!=`number`||typeof R[N]!=`number`)z(a);else{let e=Math.abs(R[r]-a[r]),t=Math.abs(R[N]-a[N]);(e>=1||t>=1)&&z(a)}}),be=(e,{animation:t=!0}={})=>{t&&!a.shouldReduceMotion?Go(k,he.current,e,{duration:r.transitions.duration.standard}):he.current[k]=e},xe=e=>{let t=he.current[k];t+=O?e:e*(i?-1:1),be(t)},Se=()=>{let e=he.current[M],t=0,n=Array.from(ge.current.children);for(let r=0;r<n.length;r+=1){let i=n[r];if(t+i[M]>e){r===0&&(t=e);break}t+=i[M]}return t},Ce=()=>{xe(-1*Se())},B=()=>{xe(Se())},[Te,{onChange:Ee,...De}]=nt(`scrollbar`,{className:P(I.scrollableX,I.hideScrollbar),elementType:cs,shouldForwardComponentProp:!0,externalForwardedProps:_e,ownerState:F}),Oe=Y.useCallback(e=>{Ee?.(e),pe({overflow:null,scrollbarWidth:e})},[Ee]),[ke,Ae]=nt(`scrollButtons`,{className:I.scrollButtons,elementType:es,externalForwardedProps:_e,ownerState:F,additionalProps:{orientation:g,slots:{StartScrollButtonIcon:b.startScrollButtonIcon,EndScrollButtonIcon:b.endScrollButtonIcon},slotProps:{startScrollButtonIcon:ee,endScrollButtonIcon:te}}}),je=()=>{let e={};e.scrollbarSizeListener=D?(0,X.jsx)(Te,{...De,onChange:Oe}):null;let t=D&&(_===`auto`&&(re||ae)||_===!0);return e.scrollButtonStart=t?(0,X.jsx)(ke,{direction:i?`right`:`left`,onClick:Ce,disabled:!re,...Ae}):null,e.scrollButtonEnd=t?(0,X.jsx)(ke,{direction:i?`left`:`right`,onClick:B,disabled:!ae,...Ae}):null,e},Me=H(e=>{let{tabsMeta:t,tabMeta:n}=ve();if(!(!n||!t)){if(n[A]<t[A]){let r=t[k]+(n[A]-t[A]);be(r,{animation:e})}else if(n[j]>t[j]){let r=t[k]+(n[j]-t[j]);be(r,{animation:e})}}}),V=H(()=>{D&&_!==!1&&ce(!se)});Y.useEffect(()=>{let e=dt(()=>{he.current&&ye()}),t,n=n=>{n.forEach(e=>{e.removedNodes.forEach(e=>{t?.unobserve(e)}),e.addedNodes.forEach(e=>{t?.observe(e)})}),e(),V()},r=at(he.current);r.addEventListener(`resize`,e);let i;return typeof ResizeObserver<`u`&&(t=new ResizeObserver(e),Array.from(ge.current.children).forEach(e=>{t.observe(e)})),typeof MutationObserver<`u`&&(i=new MutationObserver(n),i.observe(ge.current,{childList:!0})),()=>{e.clear(),r.removeEventListener(`resize`,e),i?.disconnect(),t?.disconnect()}},[ye,V]),Y.useEffect(()=>{let e=Array.from(ge.current.children),t=e.length;if(typeof IntersectionObserver<`u`&&t>0&&D&&_!==!1){let n=e[0],r=e[t-1],i={root:he.current,threshold:.99},a=new IntersectionObserver(e=>{ie(!e[0].isIntersecting)},i);a.observe(n);let o=new IntersectionObserver(e=>{oe(!e[0].isIntersecting)},i);return o.observe(r),()=>{a.disconnect(),o.disconnect()}}},[D,_,se,u?.length]),Y.useEffect(()=>{ne(!0)},[]),Y.useEffect(()=>{ye()}),Y.useEffect(()=>{Me(ls!==R)},[Me,R]),Y.useImperativeHandle(c,()=>({updateIndicator:ye,updateScrollButtons:V}),[ye,V]);let[Ne,Pe]=nt(`indicator`,{className:I.indicator,elementType:ss,externalForwardedProps:_e,ownerState:F,additionalProps:{style:R}}),Fe=(0,X.jsx)(Ne,{...Pe}),Le=Qe({activeItemId:ue?void 0:le,orientation:g,isRtl:i}),Re=Le.getContainerProps(),ze=Y.Children.toArray(u).filter(Y.isValidElement).map((e,t)=>{let n=e.props.value===void 0?t:e.props.value;return me.set(n,t),{child:e,index:t,childValue:n}}).map(({child:e,childValue:t})=>{let n=t===C;return Y.cloneElement(e,{fullWidth:w===`fullWidth`,indicator:n&&!L&&Fe,selected:n,selectionFollowsFocus:v,onChange:h,textColor:S,value:t})}),Be=je(),[Ve,He]=nt(`root`,{ref:t,className:P(I.root,d),elementType:is,externalForwardedProps:{..._e,...E,component:f},ownerState:F}),[Ue,We]=nt(`scroller`,{ref:he,className:I.scroller,elementType:as,externalForwardedProps:_e,ownerState:F,additionalProps:{style:{overflow:fe.overflow,[O?`margin${i?`Left`:`Right`}`:`marginBottom`]:T?void 0:-fe.scrollbarWidth}}}),Ge=Ke(Re.ref,ge),U=e=>{let t=ge.current;pt($e(t))?.getAttribute(`role`)===`tab`&&Re.onKeyDown(e)},[W,qe]=nt(`list`,{ref:Ge,className:I.list,elementType:os,externalForwardedProps:_e,ownerState:F,getSlotProps:e=>({...e,onBlur:t=>{tt(t.currentTarget,t.relatedTarget)||de(!1),e.onBlur?.(t)},onKeyDown:t=>{U(t),e.onKeyDown?.(t)},onFocus:t=>{de(!0),Re.onFocus(t),e.onFocus?.(t)}})});return(0,X.jsxs)(Ve,{...He,children:[Be.scrollButtonStart,Be.scrollbarSizeListener,(0,X.jsxs)(Ue,{...We,children:[(0,X.jsx)(W,{"aria-label":o,"aria-labelledby":s,"aria-orientation":g===`vertical`?`vertical`:null,role:`tablist`,...qe,children:(0,X.jsx)(st.Provider,{value:Le,children:ze})}),L&&Fe]}),Be.scrollButtonEnd]})}),ds=class extends Error{status;code;constructor(e,t=null){super(`webui-request-${e}`),this.status=e,this.code=t}};async function fs(e){try{let t=await e.json();return typeof t.error?.code==`string`?t.error.code:null}catch{return null}}async function ps(e){let t=await fetch(`/api/v1/snapshot`,{credentials:`same-origin`,headers:{Accept:`application/json`},signal:e});if(!t.ok)throw new ds(t.status);return await t.json()}function ms(e){return Es(`/api/v1/session-catalog`,e)}function hs(e){return Es(`/api/v1/session-live-state`,e)}function gs(e){return Es(`/api/v1/session-creation-options`,e)}function _s(e){return Es(`/api/v1/provider-auth`,e)}function vs(e,t){return Es(`/api/v1/provider-auth/jobs/${encodeURIComponent(e)}`,t)}async function ys(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/provider-auth`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(e)});if(!r.ok)throw new ds(r.status);return await r.json()}function bs(e,t){return ys({action:`provider-auth.start`,providerRef:e},t)}function xs(e,t,n,r){return ys({action:`provider-auth.respond`,jobRef:e,promptRef:t,value:n},r)}function Ss(e,t){return ys({action:`provider-auth.cancel`,jobRef:e},t)}async function Cs(e){let t=vt();if(!t)throw new ds(403);let n=await _t(`/api/v1/projects/import`,{method:`POST`,credentials:`same-origin`,signal:e,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":t},body:JSON.stringify({action:`project.import`})});if(!n.ok)throw new ds(n.status,await fs(n));return await n.json()}async function ws(e){try{return await Es(`/api/v1/managed`,e)}catch(e){if(e instanceof ds&&e.status===404)return null;throw e}}async function Ts(e){let t=vt();if(!t)throw new ds(403);let n=await _t(`/api/v1/managed/connect`,{method:`POST`,credentials:`same-origin`,signal:e,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":t},body:JSON.stringify({action:`managed.connect`})});if(!n.ok)throw new ds(n.status);return await n.json()}async function Es(e,t){let n=await fetch(e,{credentials:`same-origin`,headers:{Accept:`application/json`},signal:t});if(n.status===401&&yt(),!n.ok)throw new ds(n.status);return await n.json()}function Ds(e,t){if(!t.startsWith(`/api/v1/`))throw Error(`invalid-inspection-path`);return`/api/v1/sessions/${encodeURIComponent(e)}/inspection/${t.slice(8)}`}function Os(e,t){return Es(Ds(e,`/api/v1/snapshot`),t)}function ks(e,t=null,n=50,r){let i=new URLSearchParams({limit:String(n)});return t&&i.set(`before`,t),Es(Ds(e,`/api/v1/transcript?${i}`),r)}function As(e,t,n){return Es(Ds(e,`/api/v1/approvals/${encodeURIComponent(t)}`),n)}function js(e,t,n){return Es(Ds(e,`/api/v1/source-changes?view=${encodeURIComponent(t)}`),n)}function Ms(e,t,n,r){return Es(Ds(e,`/api/v1/diffs/${encodeURIComponent(n)}?view=${encodeURIComponent(t)}`),r)}function Ns(e,t,n,r){return Es(Ds(e,`/api/v1/reviews/${encodeURIComponent(n)}?view=${encodeURIComponent(t)}`),r)}function Ps(e,t,n,r){return Es(Ds(e,`/api/v1/source-mutations/${encodeURIComponent(n)}?action=${encodeURIComponent(t)}`),r)}function Fs(e,t,n=null,r){let i=n?`?hunkRef=${encodeURIComponent(n)}`:``;return Es(`/api/v1/sessions/${encodeURIComponent(e)}/source-reverts/${encodeURIComponent(t)}${i}`,r)}function Is(e,t){return Es(Ds(e,`/api/v1/commit-summary`),t)}function Ls(e,t,n){return Es(Ds(e,`/api/v1/log-previews/${encodeURIComponent(t)}`),n)}function Rs(e,t){return Es(Ds(e,`/api/v1/connections`),t)}async function zs(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/session-connections`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(e)});if(!r.ok)throw new ds(r.status);return await r.json()}function Bs(e,t){return Es(`/api/v1/mcp-auth/jobs/${encodeURIComponent(e)}`,t)}async function Vs(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/runtime-commands`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(e)});if(!r.ok)throw new ds(r.status);return await r.json()}async function Hs(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/mcp-auth/jobs/${encodeURIComponent(e)}/cancel`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"X-Piagent-CSRF":n}});if(!r.ok)throw new ds(r.status);return await r.json()}function Us(e,t){return Es(`/api/v1/source-changes?view=${encodeURIComponent(e)}`,t)}function Ws(e,t,n){return Es(`/api/v1/diffs/${encodeURIComponent(t)}?view=${encodeURIComponent(e)}`,n)}function Gs(e,t,n){return Es(`/api/v1/reviews/${encodeURIComponent(t)}?view=${encodeURIComponent(e)}`,n)}function Ks(e,t,n){return Es(`/api/v1/source-mutations/${encodeURIComponent(t)}?action=${encodeURIComponent(e)}`,n)}function qs(e,t=null,n){let r=t?`?hunkRef=${encodeURIComponent(t)}`:``;return Es(`/api/v1/source-reverts/${encodeURIComponent(e)}${r}`,n)}function Js(e){return Es(`/api/v1/commit-summary`,e)}function Ys(e){return Es(`/api/v1/tasks`,e)}function Xs(e,t){return Es(`/api/v1/tasks/${encodeURIComponent(e)}/timeline`,t)}function Zs(e,t){return Es(`/api/v1/tasks/${encodeURIComponent(e)}/recovery-history`,t)}function Qs(e,t){return Es(`/api/v1/tasks/${encodeURIComponent(e)}/handoff-history`,t)}function $s(e,t){return Es(`/api/v1/tasks/${encodeURIComponent(e)}/subagent-tree`,t)}function ec(e){return Es(`/api/v1/monitoring/release`,e)}function tc(e,t){return Es(`/api/v1/log-previews/${encodeURIComponent(e)}`,t)}function nc(e=null,t=50,n){let r=new URLSearchParams({limit:String(t)});return e&&r.set(`before`,e),Es(`/api/v1/transcript?${r}`,n)}function rc(e){return Es(`/api/v1/chat/queue`,e)}function ic(e){return Es(`/api/v1/session-options/models`,e)}function ac(e,t){return Es(`/api/v1/approvals/${encodeURIComponent(e)}`,t)}async function oc(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/approvals/${encodeURIComponent(e.approvalRef)}/decision`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(e)});if(!r.ok)throw new ds(r.status);return await r.json()}async function sc(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/chat/messages`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(e)});if(!r.ok)throw new ds(r.status);return await r.json()}async function cc(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/session-options`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(e)});if(!r.ok)throw new ds(r.status);return await r.json()}async function lc(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/lifecycle`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(e)});if(!r.ok)throw new ds(r.status);return await r.json()}async function uc(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/control/resume-and-continue`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(e)});if(!r.ok)throw new ds(r.status);return await r.json()}async function dc(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/reviews`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(e)});if(!r.ok)throw new ds(r.status);return await r.json()}async function fc(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/source-mutations`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(e)});if(!r.ok)throw new ds(r.status);return await r.json()}async function pc(e,t,n){let r=vt();if(!r)throw new ds(403);let i=await _t(n?`/api/v1/sessions/${encodeURIComponent(n)}/source-reverts`:`/api/v1/source-mutations`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":r},body:JSON.stringify(e)});if(!i.ok)throw new ds(i.status);return await i.json()}async function mc(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/source-handoffs`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(e)});if(!r.ok)throw new ds(r.status);return await r.json()}async function hc(e,t,n){let r=vt();if(!r)throw new ds(403);let i=await _t(`/api/v1/sessions/${encodeURIComponent(e)}/attachments`,{method:`POST`,credentials:`same-origin`,signal:n,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":r},body:JSON.stringify(t)});if(!i.ok)throw new ds(i.status);return await i.json()}function gc(e,t){return Es(e?Ds(e,`/api/v1/documents`):`/api/v1/documents`,t)}function _c(e,t,n){let r=`/api/v1/documents/${encodeURIComponent(t)}`;return Es(e?Ds(e,r):r,n)}async function vc(e,t){let n=vt();if(!n)throw new ds(403);let r=await _t(`/api/v1/attachments`,{method:`POST`,credentials:`same-origin`,signal:t,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(e)});if(!r.ok)throw new ds(r.status);return await r.json()}function yc(e,t,n){return Es(`/api/v1/projects/${encodeURIComponent(e)}/paths?query=${encodeURIComponent(t)}`,n)}function bc(e,t){return Es(`/api/v1/projects/${encodeURIComponent(e)}/commands`,t)}function xc(e,t){return Es(`/api/v1/sessions/${encodeURIComponent(e)}/questions`,t)}async function Sc(e,t,n,r){let i=vt();if(!i)throw new ds(403);let a=await _t(`/api/v1/sessions/${encodeURIComponent(e)}/questions/${encodeURIComponent(t)}/answer`,{method:`POST`,credentials:`same-origin`,signal:r,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":i},body:JSON.stringify(n)});if(!a.ok)throw new ds(a.status)}var Cc=class extends Error{status;code;detail;constructor(e,t,n){super(t),this.status=e,this.code=t,this.detail=n}};function wc(e,t=null,n){return Es(`/api/v1/projects/${encodeURIComponent(e)}/branches${t===null?``:`?repository=${encodeURIComponent(t)}`}`,n)}async function Tc(e,t,n){let r=vt();if(!r)throw new Cc(403,`mutation-authority-rejected`,null);let i=await _t(`/api/v1/projects/${encodeURIComponent(e)}/branches/switch`,{method:`POST`,credentials:`same-origin`,signal:n,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":r},body:JSON.stringify(t)});if(i.status===401&&yt(),!i.ok){let e=`branch-request-${i.status}`,t=null;try{let n=await i.json();typeof n.error?.code==`string`&&(e=n.error.code),typeof n.error?.detail==`string`&&(t=n.error.detail)}catch{}throw new Cc(i.status,e,t)}return await i.json()}function Ec(e){return Array.isArray(e)?`[${e.map(Ec).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${Ec(t)}`).join(`,`)}}`:JSON.stringify(e)}async function Dc(e){let t=new TextEncoder().encode(typeof e==`string`?e:Ec(e)),n=await crypto.subtle.digest(`SHA-256`,t);return`sha256:${[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}async function Oc(e,t,n,r){let i=new Date,a=new Date(i.getTime()+3e5),o=r?.attachmentRefs??[],s={messageRequestId:r?.messageRequestId??`message-request.${crypto.randomUUID()}`,capabilityAction:n===`steer`?`interruptAndSend`:n===`hold`?`hold`:`send`,delivery:n,text:t,attachmentRefs:o,contentDigest:await Dc({attachmentRefs:o,text:t})},c={runtimeRevision:e.revision.runtimeRevision,taskRevision:e.revision.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:e.revision.workspaceRevision,indexRevision:e.revision.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:null},l={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:i.toISOString(),expiresAt:a.toISOString(),capabilityScope:`control.chat`,action:`chat.send`,actionDigest:``,identity:structuredClone(e.identity),expectedRevisions:c,payload:s};return l.actionDigest=await Dc({action:l.action,identity:l.identity,expectedRevisions:c,payload:s}),l}async function kc(e,t,n){let r=new Date,i=new Date(r.getTime()+3e5);return{schemaVersion:1,version:`piagent-webui-attachment-v1`,messageType:`stage-command`,commandId:`attachment-command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:i.toISOString(),identity:{...structuredClone(e.identity),toolCallId:null},expectedRuntimeRevision:e.revision.runtimeRevision,messageRequestId:t,file:n}}function Ac(e,t,n){let r=new Date,i=new Date(r.getTime()+3e5);return{schemaVersion:1,version:`piagent-webui-attachment-v1`,messageType:`discard-command`,commandId:`attachment-command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:i.toISOString(),identity:{...structuredClone(e.identity),toolCallId:null},expectedRuntimeRevision:e.revision.runtimeRevision,messageRequestId:t,attachmentRef:n}}async function jc(e,t,n){let r=new Date,i=new Date(r.getTime()+3e5),a={runtimeRevision:e.revision.runtimeRevision,taskRevision:e.revision.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:e.revision.workspaceRevision,indexRevision:e.revision.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:null},o={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:i.toISOString(),capabilityScope:`control.chat`,action:t,actionDigest:``,identity:structuredClone(e.identity),expectedRevisions:a,payload:n};return o.actionDigest=await Dc({action:t,identity:o.identity,expectedRevisions:a,payload:n}),o}async function Mc(e,t){let n=[];return{queueItemRef:e,text:t,attachmentRefs:n,contentDigest:await Dc({attachmentRefs:n,text:t})}}async function Nc(e,t,n){let r=new Date,i=new Date(r.getTime()+3e5),a={runtimeRevision:e.revision.runtimeRevision,taskRevision:e.revision.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:e.revision.workspaceRevision,indexRevision:e.revision.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:null},o=t===`session-options.set-model`?{modelRef:n,effectScopeAcknowledged:`session-and-user-default`}:{thinkingLevel:n,effectScopeAcknowledged:`session-and-user-default`},s={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:i.toISOString(),capabilityScope:`control.sessionOptions`,action:t,actionDigest:``,identity:structuredClone(e.identity),expectedRevisions:a,payload:o};return s.actionDigest=await Dc({action:t,identity:s.identity,expectedRevisions:a,payload:o}),s}async function Pc(e,t){let n=new Date,r=new Date(n.getTime()+3e5),i={runtimeRevision:e.revision.runtimeRevision,taskRevision:e.revision.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:e.revision.workspaceRevision,indexRevision:e.revision.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:null},a=t===`lifecycle.stop`?{requestedScope:`current-agent-operation`}:t===`lifecycle.pause`?{safePointPolicy:`after-current-atomic-unit`}:{},o={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:n.toISOString(),expiresAt:r.toISOString(),capabilityScope:`control.lifecycle`,action:t,actionDigest:``,identity:structuredClone(e.identity),expectedRevisions:i,payload:a};return o.actionDigest=await Dc({action:t,identity:o.identity,expectedRevisions:i,payload:a}),o}async function Fc(e,t,n){let r=new Date,i=new Date(r.getTime()+3e5),a=n?.attachmentRefs??[],o={messageRequestId:n?.messageRequestId??`message-request.${crypto.randomUUID()}`,capabilityAction:`send`,delivery:`new-operation`,text:t,attachmentRefs:a,contentDigest:await Dc({attachmentRefs:a,text:t})},s={runtimeRevision:e.revision.runtimeRevision,taskRevision:e.revision.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:e.revision.workspaceRevision,indexRevision:e.revision.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:null},c={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:i.toISOString(),capabilityScope:`control.resumeAndContinue`,action:`lifecycle.resume-and-continue`,actionDigest:``,identity:structuredClone(e.identity),expectedRevisions:s,payload:o};return c.actionDigest=await Dc({action:c.action,identity:c.identity,expectedRevisions:s,payload:o}),c}function Ic(e){return Array.isArray(e)?`[${e.map(Ic).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${Ic(t)}`).join(`,`)}}`:JSON.stringify(e)}async function Lc(e){let t=new TextEncoder().encode(Ic(e)),n=await crypto.subtle.digest(`SHA-256`,t);return`sha256:${[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}async function Rc(e,t,n){if(!t.target||t.state===`unavailable`)throw Error(`review-target-unavailable`);let r=new Date,i=new Date(r.getTime()+3e5),a=t.target,o={...structuredClone(e.identity),agentOperationId:null,toolCallId:null},s={runtimeRevision:e.revision.runtimeRevision,taskRevision:a.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:a.workspaceRevision,indexRevision:a.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:a.patchPreimage},c={view:a.view,fileRef:a.fileRef,diffRef:a.diffRef,reviewState:n,contentDigest:a.contentDigest},l={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`review-command.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:i.toISOString(),capabilityScope:`reviewActions`,action:`review.mark`,actionDigest:``,identity:o,expectedRevisions:s,payload:c};return l.actionDigest=await Lc({action:l.action,identity:o,expectedRevisions:s,payload:c}),l}function zc(e){return Array.isArray(e)?`[${e.map(zc).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${zc(t)}`).join(`,`)}}`:JSON.stringify(e)}async function Bc(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(zc(e)));return`sha256:${[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}async function Vc(e,t,n=[]){if(t.state!==`ready`||!t.target)throw Error(`source-mutation-preview-unavailable`);let r=new Date,i=t.target,a={...structuredClone(e.identity),agentOperationId:null,toolCallId:null};if(n.length>128||new Set(n).size!==n.length||n.some(e=>!i.hunkRefs.includes(e))||zc(n)!==zc(i.hunkRefs.filter(e=>n.includes(e))))throw Error(`source-mutation-hunk-unavailable`);let o={runtimeRevision:e.revision.runtimeRevision,taskRevision:i.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:i.workspaceRevision,indexRevision:i.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:i.workspacePreimage,indexPreimage:i.indexPreimage,patchPreimage:i.patchPreimage},s={fileRef:i.fileRef,hunkRefs:[...n],contentDigest:i.contentDigest},c={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`source-mutation.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:r.toISOString(),expiresAt:new Date(r.getTime()+3e5).toISOString(),capabilityScope:`reviewActions`,action:t.action,actionDigest:``,identity:a,expectedRevisions:o,payload:s};return c.actionDigest=await Bc({action:c.action,identity:a,expectedRevisions:o,payload:s}),c}function Hc(e){return Array.isArray(e)?`[${e.map(Hc).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${Hc(t)}`).join(`,`)}}`:JSON.stringify(e)}async function Uc(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(Hc(e)));return`sha256:${[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}async function Wc(e,t){if(t.state!==`ready`||!t.target)throw Error(`source-revert-preview-unavailable`);let n=new Date,r=t.target;if(Date.parse(r.expiresAt)<=n.getTime())throw Error(`source-revert-preview-expired`);let i={...structuredClone(t.commandBinding?t.identity:e.identity),agentOperationId:null,toolCallId:null},a={runtimeRevision:t.commandBinding?.runtimeRevision??e.revision.runtimeRevision,taskRevision:r.taskRevision,controlRevision:t.commandBinding?.controlRevision??e.revision.controlRevision,workspaceRevision:r.workspaceRevision,indexRevision:r.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:r.workspacePreimage,indexPreimage:r.indexPreimage,patchPreimage:r.patchPreimage},o={fileRef:r.fileRef,hunkRefs:[...r.hunkRefs],previewRef:r.previewRef,confirmedPreviewDigest:r.confirmedPreviewDigest,contentDigest:r.contentDigest},s={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`source-revert.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:n.toISOString(),expiresAt:r.expiresAt,capabilityScope:`reviewActions`,action:`source.revert`,actionDigest:``,identity:i,expectedRevisions:a,payload:o};return s.actionDigest=await Uc({action:s.action,identity:i,expectedRevisions:a,payload:o}),s}function Gc(e){if(!e.commandBinding||!e.target)throw Error(`source-revert-binding-unavailable`);return Wc({identity:e.identity,revision:{...e.commandBinding,approvalRevision:null,sessionOptionRevision:null,queueRevision:null}},e)}function Kc(e){return Array.isArray(e)?`[${e.map(Kc).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${Kc(t)}`).join(`,`)}}`:JSON.stringify(e)}async function qc(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(Kc(e)));return`sha256:${[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}async function Jc(e,t,n=null,r=null){if(!e.identity.taskId||!e.identity.taskRunId||!e.revision.taskRevision||!e.revision.workspaceRevision)throw Error(`source-open-task-authority-unavailable`);if(r!==null&&n===null)throw Error(`source-open-location-invalid`);let i=new Date,a={...structuredClone(e.identity),agentOperationId:null,toolCallId:null},o={runtimeRevision:e.revision.runtimeRevision,taskRevision:e.revision.taskRevision,controlRevision:e.revision.controlRevision,workspaceRevision:e.revision.workspaceRevision,indexRevision:e.revision.indexRevision,approvalRevision:e.revision.approvalRevision,sessionOptionRevision:e.revision.sessionOptionRevision,queueRevision:e.revision.queueRevision,workspacePreimage:null,indexPreimage:null,patchPreimage:null},s={fileRef:t,line:n,column:r},c={schemaVersion:1,version:`piagent-webui-control-v1`,messageType:`command`,commandId:`source-open.${crypto.randomUUID()}`,idempotencyKey:crypto.randomUUID(),requestedAt:i.toISOString(),expiresAt:new Date(i.getTime()+3e5).toISOString(),capabilityScope:`reviewActions`,action:`source.open-in-vscode`,actionDigest:``,identity:a,expectedRevisions:o,payload:s};return c.actionDigest=await qc({action:c.action,identity:a,expectedRevisions:o,payload:s}),c}var Yc=new Set(`as.async.await.break.case.catch.class.const.continue.def.delete.do.else.enum.export.extends.finally.for.from.function.if.implements.import.in.interface.let.new.of.package.private.protected.public.return.static.struct.switch.throw.try.type.var.while.with.yield`.split(`.`)),Xc=new Set([`false`,`nil`,`null`,`None`,`true`,`undefined`]),Zc=new Set([`py`,`rb`,`sh`,`bash`,`zsh`,`yaml`,`yml`,`toml`]);function Qc(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<0?``:t.slice(n+1).toLowerCase()}function $c(e){return/[A-Za-z_$]/.test(e)}function el(e){return/[A-Za-z0-9_$-]/.test(e)}function tl(e){return e>=`0`&&e<=`9`}function nl(e,t,n){if(!n)return;let r=e[e.length-1];r?.kind===t?r.text+=n:e.push({kind:t,text:n})}function rl(e,t){let n=[],r=Qc(t),i=0;for(;i<e.length;){if(e.startsWith(`//`,i)||e.startsWith(`/*`,i)||e[i]===`#`&&Zc.has(r)){nl(n,`comment`,e.slice(i));break}let t=e[i]??``;if(t===`"`||t===`'`||t==="`"){let r=t,a=i+1;for(;a<e.length;){if(e[a]===`\\`){a+=2;continue}if(e[a]===r){a+=1;break}a+=1}let o=e.slice(i,a);nl(n,e.slice(a).match(/^\s*:/)&&r===`"`?`property`:`string`,o),i=a;continue}if(tl(t)||t===`.`&&tl(e[i+1]??``)){let t=i+1;for(;t<e.length&&/[0-9A-Fa-f_xXob.+-]/.test(e[t]??``);)t+=1;nl(n,`number`,e.slice(i,t)),i=t;continue}if($c(t)){let t=i+1;for(;t<e.length&&el(e[t]??``);)t+=1;let r=e.slice(i,t);nl(n,Yc.has(r)?`keyword`:Xc.has(r)?`literal`:`plain`,r),i=t;continue}nl(n,`plain`,t),i+=1}return n}var il=`piagent-line-comments-changed`,al=50,ol=2e3,sl=400,cl=e=>`piagent-line-comments:${e}`,ll=(e,t,n)=>`${t}:${n}:${e}`,ul=e=>ll(e.path,e.side,e.line);function dl(e){let t=e;return!!t&&typeof t.path==`string`&&t.path.length>0&&Number.isSafeInteger(t.line)&&t.line>0&&(t.side===`new`||t.side===`old`)&&typeof t.code==`string`&&typeof t.text==`string`&&t.text.trim().length>0}function fl(e){try{let t=JSON.parse(sessionStorage.getItem(cl(e))??`[]`);return Array.isArray(t)?t.filter(dl).slice(0,al):[]}catch{return[]}}function pl(e,t){try{t.length?sessionStorage.setItem(cl(e),JSON.stringify(t.slice(0,al))):sessionStorage.removeItem(cl(e))}catch{}typeof window<`u`&&window.dispatchEvent(new CustomEvent(il,{detail:e}))}function ml(e,t){let n=e.filter(e=>ul(e)!==ul(t)),r=t.text.trim().slice(0,ol);return r?[...n,{...t,text:r,code:t.code.slice(0,sl),at:Date.now()}].slice(-50):n}var hl=e=>[...e].sort((e,t)=>e.path.localeCompare(t.path)||e.line-t.line||e.side.localeCompare(t.side));function gl(e,t){let n=hl(e);return[t?`Review comments on the diff (${n.length}). Address each one at its file and line:`:`Review comment trên diff (${n.length}). Xử lý từng comment đúng file và dòng:`,...n.map((e,n)=>{let r=`${e.path}:${e.line}${e.side===`old`?t?` (removed line)`:` (dòng đã xóa)`:``}`,i=e.code.includes("```")?"````":"```";return`${n+1}. ${r}\n${i}\n${e.code}\n${i}\n${e.text}`})].join(`
39
+
40
+ `)}var _l=e=>e.replace(/\\/g,`/`).replace(/^\.\//,``).replace(/^\/+/,``);function vl(e,t){let n=_l(e),r=_l(t);return n.length>0&&(n===r||n.endsWith(`/${r}`)||r.endsWith(`/${n}`))}function yl(e,t,n){return(e??[]).filter(e=>e.line===n&&vl(e.file,t))}function bl(e,t,n){return(e??[]).filter(e=>vl(e.file,t)&&(e.line===null||!n.has(e.line)))}function xl(e,t){if(!t)return!1;let n=t.get(ul(e));return n===void 0||n!==e.code}var Sl=(0,Y.createContext)(null),Cl=()=>(0,Y.useContext)(Sl),wl={blocking:[`Chặn`,`Blocking`],major:[`Nặng`,`Major`],minor:[`Nhẹ`,`Minor`]};function Tl({finding:e,locale:t}){return(0,X.jsxs)(`div`,{className:`line-finding severity-${e.severity}`,role:`note`,children:[(0,X.jsxs)(`strong`,{children:[`Review · `,D(t,...wl[e.severity])]}),(0,X.jsx)(`span`,{children:e.issue})]})}function El({initial:e,locale:t,onSave:n,onCancel:r}){let[i,a]=(0,Y.useState)(e);return(0,X.jsxs)(`form`,{className:`line-comment-editor`,onSubmit:e=>{e.preventDefault(),n(i)},children:[(0,X.jsx)(`textarea`,{autoFocus:!0,rows:3,maxLength:2e3,value:i,"aria-label":D(t,`Comment cho dòng này`,`Comment on this line`),placeholder:D(t,`Agent cần sửa gì ở dòng này?`,`What should the agent change here?`),onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Escape`&&r(),e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&n(i)}}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`button`,{type:`button`,onClick:r,children:D(t,`Hủy`,`Cancel`)}),(0,X.jsx)(`button`,{type:`submit`,disabled:!i.trim(),children:D(t,`Lưu comment`,`Save comment`)})]})]})}function Dl({path:e,side:t,line:n}){let r=Cl();if(!r||n===null)return null;let i=ll(e,t,n),a=r.comments.find(e=>ul(e)===i),o=t===`new`?yl(r.findings,e,n):[];return!o.length&&!a&&r.editing!==i?null:(0,X.jsxs)(`div`,{className:`line-notes`,children:[o.map((e,t)=>(0,X.jsx)(Tl,{finding:e,locale:r.locale},t)),r.editing===i?(0,X.jsx)(El,{initial:a?.text??``,locale:r.locale,onSave:r.save,onCancel:r.cancel}):a&&(0,X.jsxs)(`div`,{className:`line-comment`,children:[(0,X.jsx)(`span`,{children:a.text}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>r.open(e,t,n,a.code),children:D(r.locale,`Sửa`,`Edit`)}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>r.remove(i),children:D(r.locale,`Xóa`,`Delete`)})]})]})}function Ol({path:e,side:t,line:n,code:r}){let i=Cl();return!i||n===null?(0,X.jsx)(`span`,{children:n??``}):(0,X.jsx)(`span`,{children:(0,X.jsx)(`button`,{type:`button`,className:`line-comment-anchor`,onClick:()=>i.open(e,t,n,r),"aria-label":D(i.locale,`Comment dòng ${n}`,`Comment on line ${n}`),children:n})})}function kl({path:e,shownLines:t}){let n=Cl(),r=n?bl(n.findings,e,t):[];return!n||!r.length?null:(0,X.jsx)(`div`,{className:`line-notes file-findings`,children:r.map((e,t)=>(0,X.jsxs)(`div`,{className:`line-finding severity-${e.severity}`,role:`note`,children:[(0,X.jsxs)(`strong`,{children:[`Review · `,D(n.locale,...wl[e.severity]),e.line?` · ${D(n.locale,`dòng`,`line`)} ${e.line}`:``]}),(0,X.jsx)(`span`,{children:e.issue})]},t))})}function Al({comments:e,lines:t,linesPath:n,locale:r,onSend:i,onClear:a}){let[o,s]=(0,Y.useState)(!1);if((0,Y.useEffect)(()=>{e.length||s(!1)},[e.length]),!e.length)return null;let c=e=>e.path===n&&xl(e,t),l=e.filter(c).length;return(0,X.jsxs)(`section`,{className:`line-comment-bar`,"aria-label":D(r,`Comment chờ gửi`,`Comments to send`),children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:D(r,`${e.length} comment chờ gửi`,`${e.length} comments to send`)}),l>0&&(0,X.jsx)(`small`,{children:D(r,`${l} dòng đã đổi sau khi comment`,`${l} lines changed since commented`)})]}),(0,X.jsx)(`ul`,{children:e.map(e=>(0,X.jsxs)(`li`,{className:c(e)?`changed`:void 0,children:[(0,X.jsxs)(`code`,{children:[e.path,`:`,e.line]}),(0,X.jsx)(`span`,{children:e.text}),c(e)&&(0,X.jsx)(`em`,{children:D(r,`đã đổi`,`changed`)})]},ul(e)))}),(0,X.jsxs)(`div`,{className:`line-comment-actions`,children:[o?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{children:D(r,`Xóa hết comment?`,`Delete every comment?`)}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>s(!1),children:D(r,`Không`,`No`)}),(0,X.jsx)(`button`,{type:`button`,onClick:a,children:D(r,`Xóa hết`,`Delete all`)})]}):(0,X.jsx)(`button`,{type:`button`,onClick:()=>s(!0),children:D(r,`Xóa hết`,`Delete all`)}),(0,X.jsx)(`button`,{type:`button`,className:`primary`,onClick:i,children:D(r,`Đưa vào ô chat`,`Put in the composer`)})]})]})}var jl=[{view:`task`,label:`Thay đổi của task`,shortLabel:`Task`},{view:`working-tree`,label:`Toàn bộ working tree`,shortLabel:`Working Tree`},{view:`staged`,label:`Đã chuẩn bị commit`,shortLabel:`Staged`}];function Ml(e){return e===`vi`?jl:[{view:`task`,label:`Task Changes`,shortLabel:`Task`},{view:`working-tree`,label:`Full Working Tree`,shortLabel:`Working Tree`},{view:`staged`,label:`Staged Changes`,shortLabel:`Staged`}]}var Nl={"pre-existing-user":`Có sẵn trước task`,"runtime-observed-agent":`Pi runtime đã chạm`,"post-baseline-unattributed":`Thay đổi sau baseline · chưa rõ nguồn`,mixed:`Trộn thay đổi người dùng và runtime`};function Pl(e,t=`vi`){return t===`vi`?Nl[e.provenance.classification]:{"pre-existing-user":`Pre-existing user change`,"runtime-observed-agent":`Runtime-observed agent touch`,"post-baseline-unattributed":`Post-baseline · unattributed`,mixed:`Mixed user and runtime change`}[e.provenance.classification]}function Fl(e,t=`vi`){return e.stats.state===`exact`?`+${e.stats.additions??0} −${e.stats.deletions??0}`:t===`vi`?`Dòng thay đổi chưa xác định`:`Line changes unavailable`}function Il(e,t=`vi`){let n=e.page.total;return e.availability.state===`stale`?t===`vi`?`Đang đồng bộ lại…`:`Resynchronizing…`:e.availability.state===`unavailable`?e.availability.message??(t===`vi`?`Nguồn thay đổi chưa sẵn sàng`:`Source changes unavailable`):n===0?t===`vi`?`Không có file thay đổi`:`No changed files`:t===`vi`?`${n} file${e.page.truncated?` · danh sách đã rút gọn`:``}`:`${n} file${n===1?``:`s`}${e.page.truncated?` · list truncated`:``}`}function Ll(e,t=`vi`){return t===`vi`?`${e.criterionIds.length} tiêu chí · ${e.verifierAttemptIds.length} verifier`:`${e.criterionIds.length} criteria · ${e.verifierAttemptIds.length} verifiers`}function Rl(e,t){return[t.projectRef,t.runtimeInstanceId,t.sessionRef,t.taskId??`no-task`,t.taskRunId??`no-run`,e.sourceProjectionRevision??`no-source-projection-revision`,e.taskViewRevision??`no-task-view-revision`,e.workspaceRevision??`no-workspace-revision`,e.indexRevision??`no-index-revision`].join(``)}function zl(e,t,n,r){if(!e||e.view!==t||e.availability.state===`stale`||e.identity.projectRef!==r.projectRef||e.identity.runtimeInstanceId!==r.runtimeInstanceId||e.identity.sessionRef!==r.sessionRef||e.identity.taskId!==r.taskId||e.identity.taskRunId!==r.taskRunId)return!1;let i=t===`task`?n.taskViewRevision:t===`working-tree`?n.workspaceRevision:n.indexRevision;if(!(i===null?e.availability.state===`unavailable`:e.viewRevision===i))return!1;let a=e.snapshotBinding;return a?n.sourceProjectionRevision!==null&&a.sourceProjectionRevision===n.sourceProjectionRevision&&a.taskViewRevision===n.taskViewRevision&&a.workspaceRevision===n.workspaceRevision&&a.indexRevision===n.indexRevision:n.sourceProjectionRevision===null}function Bl(e,t){if(!e||e.state!==`unavailable`||e.target!==null||!e.reasonCode)return!1;let n=t?.availability.state===`current`&&t.fallback.kind===`none`;return e.reasonCode===`review-target-unavailable`?n:e.reasonCode===`no-unstaged-change`||e.reasonCode===`no-staged-change`?n&&t.hunks.length>0:[`-target-stale`,`-preview-incomplete`,`-preimage-unavailable`,`-authority-unavailable`].some(t=>e.reasonCode.endsWith(t))}function Vl(e,t,n,r,i,a){return t===n&&zl(e,a,r,i)?e??null:null}function Hl(e,t,n,r,i,a){let o=e?.identity;return!!(e&&o&&o.projectRef===a.identity.projectRef&&o.runtimeInstanceId===a.identity.runtimeInstanceId&&o.sessionRef===a.identity.sessionRef&&o.taskId===a.identity.taskId&&o.taskRunId===a.identity.taskRunId&&e.view===t&&e.file.fileRef===n&&e.file.fileRevision===i&&e.precondition.expectedViewRevision===r&&e.precondition.expectedFileRevision===i&&e.observed.viewRevision===r&&e.observed.fileRevision===i&&e.availability.state!==`stale`&&e.fallback.kind!==`stale`)}function Ul(e,t){return t&&e.some(e=>e.fileRef===t)?t:e[0]?.fileRef??null}var Wl={active:`Đang hoạt động`,"pause-requested":`Đang yêu cầu tạm dừng`,paused:`Đã tạm dừng`,terminal:`Đã kết thúc`,idle:`Đang chờ`,running:`Đang chạy`,stopping:`Đang dừng`,settled:`Đã ổn định`,unknown:`Chưa xác định`,pending:`Chưa xong`,completed:`Hoàn thành`,blocked:`Bị chặn`,partial:`Một phần`,failed:`Thất bại`,satisfied:`Đã đạt`,unavailable:`Không có dữ liệu`,connected:`Đã kết nối`,disconnected:`Mất kết nối`,reconnecting:`Đang kết nối lại`,"resync-required":`Cần đồng bộ lại`,none:`Không có`,waiting:`Đang chờ duyệt`,current:`Mới nhất`,stale:`Đã cũ`,"not-run":`Chưa chạy`,"in-progress":`Đang làm`,done:`Đã xong`,skipped:`Bỏ qua`,resume:`Tiếp tục`,retry:`Thử lại`,observed:`Đã ghi nhận`,requested:`Đã yêu cầu`,"possible-interruption":`Có thể bị gián đoạn`,complete:`Đầy đủ`,"aggregate-only":`Chỉ có dữ liệu tổng hợp`,off:`Tắt`,minimal:`Tối thiểu`,low:`Thấp`,medium:`Trung bình`,high:`Cao`,xhigh:`Rất cao`,max:`Tối đa`,orphaned:`Mất owner`,cancelled:`Đã hủy`,succeeded:`Thành công`,"stale-result":`Kết quả đến muộn`,accepted:`Đã nhận`,rejected:`Không nhận`,"not-recorded":`Chưa có kết quả`,parent:`Task cha`,helper:`Helper`,"read-only":`Chỉ đọc`,"workspace-write":`Ghi trong project`,"trusted-full-access":`Toàn quyền`,bypass:`Bypass`,"single-writer":`Một writer`,retriever:`Retriever`,scout:`Scout`,planner:`Planner`,worker:`Worker`,reviewer:`Reviewer`,oracle:`Oracle`,researcher:`Researcher`,ready:`Sẵn sàng`,missing:`Chưa có bằng chứng`,interrupted:`Bị gián đoạn`,stopped:`Đã dừng`,aborted:`Đã hủy do lỗi`,incomplete:`Chưa có kết luận`,passed:`Đạt`,"not-applicable":`Không áp dụng`,smoke:`Smoke`,"public-regression":`Public regression`,capability:`Capability`,"private-holdout":`Private holdout`,"production-shadow":`Production shadow`,"pdf-converter-unavailable":`Host chưa cài pdftotext (poppler) nên chưa đọc được .pdf`,"pdf-text-unavailable":`PDF này không có text bóc được; nhiều khả năng là bản scan, cần OCR trước`,"pdf-extraction-failed":`Không chuyển được PDF này sang text`,"docx-unreadable":`File .docx này hỏng, bị mã hóa, hoặc không phải file Word thật`,"document-text-empty":`Tài liệu không có chữ nào để đọc`,"document-size-limit":`Tài liệu vượt giới hạn dung lượng`,"text-size-limit":`File text vượt giới hạn dung lượng`,"text-content-invalid":`Nội dung file không phải văn bản (file nhị phân), chưa gửi vào chat được`,"image-mime-mismatch":`Nội dung ảnh không khớp với đuôi file`,"model-image-input-unavailable":`Model hiện tại không nhận ảnh`,"attachment-capacity-limit":`Đã chạm giới hạn số file hoặc dung lượng đính kèm`,"no-readable-root":`Chưa có thư mục nào đọc được`,"document-roots-unavailable":`Không xác định được thư mục tài liệu`,"document-not-listed":`Tài liệu không còn trong danh sách; hãy tải lại`,"document-unavailable":`Không mở được tài liệu này`,"document-protected":`Tài liệu nằm trong protectedPaths nên không được đọc`,"document-changed":`File đã thay đổi sau khi liệt kê; chưa đọc gì cả`,"document-unreadable":`Không đọc được nội dung tài liệu`,"document-needs-ocr":`Tài liệu là bản scan, cần OCR trước khi đọc được chữ`,"document-converter-unavailable":`Host chưa cài pdftotext (poppler) nên chưa đọc được .pdf`,"session-command-effect-unknown":`Pi đã nhận yêu cầu nhưng đang đồng bộ trạng thái; không gửi lại để tránh chạy trùng`},Gl={active:`Active`,"pause-requested":`Pause requested`,paused:`Paused`,terminal:`Finished`,idle:`Idle`,running:`Running`,stopping:`Stopping`,settled:`Settled`,unknown:`Unknown`,pending:`Pending`,completed:`Completed`,blocked:`Blocked`,partial:`Partial`,failed:`Failed`,satisfied:`Satisfied`,unavailable:`Unavailable`,connected:`Connected`,disconnected:`Disconnected`,reconnecting:`Reconnecting`,"resync-required":`Resync required`,none:`None`,waiting:`Awaiting approval`,current:`Current`,stale:`Stale`,"not-run":`Not run`,"in-progress":`In progress`,done:`Done`,skipped:`Skipped`,resume:`Resume`,retry:`Retry`,observed:`Observed`,requested:`Requested`,"possible-interruption":`Possible interruption`,complete:`Complete`,"aggregate-only":`Aggregate only`,off:`Off`,minimal:`Minimal`,low:`Low`,medium:`Medium`,high:`High`,xhigh:`Extra high`,max:`Maximum`,orphaned:`Owner missing`,cancelled:`Cancelled`,succeeded:`Succeeded`,"stale-result":`Stale result`,accepted:`Accepted`,rejected:`Rejected`,"not-recorded":`Not recorded`,parent:`Parent task`,helper:`Helper`,"read-only":`Read only`,"workspace-write":`Workspace write`,"trusted-full-access":`Full access`,bypass:`Bypass`,"single-writer":`Single writer`,retriever:`Retriever`,scout:`Scout`,planner:`Planner`,worker:`Worker`,reviewer:`Reviewer`,oracle:`Oracle`,researcher:`Researcher`,ready:`Ready`,missing:`Evidence missing`,interrupted:`Interrupted`,stopped:`Stopped`,aborted:`Aborted`,incomplete:`Incomplete`,passed:`Passed`,"not-applicable":`Not applicable`,smoke:`Smoke`,"public-regression":`Public regression`,capability:`Capability`,"private-holdout":`Private holdout`,"production-shadow":`Production shadow`,"pdf-converter-unavailable":`This host has no pdftotext (poppler), so .pdf cannot be read`,"pdf-text-unavailable":`This PDF holds no extractable text; it is probably scanned and needs OCR first`,"pdf-extraction-failed":`The PDF could not be converted to text`,"docx-unreadable":`This .docx is corrupt, encrypted, or not really a Word document`,"document-text-empty":`The document contains no readable text`,"document-size-limit":`The document is over the size limit`,"text-size-limit":`The text file is over the size limit`,"text-content-invalid":`The file is not text (binary), so it cannot go into the chat`,"image-mime-mismatch":`The image content does not match its file extension`,"model-image-input-unavailable":`The current model does not accept images`,"attachment-capacity-limit":`The attachment count or size limit was reached`,"no-readable-root":`No readable directory is available`,"document-roots-unavailable":`The document directories could not be resolved`,"document-not-listed":`The document is no longer listed; reload the list`,"document-unavailable":`This document could not be opened`,"document-protected":`The document is under protectedPaths and is not readable`,"document-changed":`The file changed after it was listed; nothing was read`,"document-unreadable":`The document content could not be read`,"document-needs-ocr":`The document is scanned and needs OCR before it holds text`,"document-converter-unavailable":`This host has no pdftotext (poppler), so .pdf cannot be read`,"session-command-effect-unknown":`Pi received the request and is resyncing; do not resend it, to avoid a duplicate run`};function $(e,t=`vi`){return e?(t===`vi`?Wl:Gl)[e]??e.replaceAll(`-`,` `):t===`vi`?`Chưa có`:`Not available`}function Kl(e){return[`completed`,`satisfied`,`current`,`connected`,`done`,`passed`].includes(e??``)?`positive`:[`blocked`,`failed`,`error`,`expired`].includes(e??``)?`danger`:[`pause-requested`,`paused`,`waiting`,`stale`,`stale-result`,`orphaned`,`partial`,`reconnecting`].includes(e??``)?`warning`:[`running`,`active`,`in-progress`].includes(e??``)?`info`:`neutral`}function ql(e){return e?e.length>22?`${e.slice(0,10)}…${e.slice(-7)}`:e:`—`}function Jl(e,t=`vi`){return e.session.model.state===`known`&&e.session.model.value?e.session.model.value.displayName:t===`vi`?`Model chưa xác định`:`Unknown model`}function Yl(e,t=`vi`){return e.session.thinking.state===`known`&&e.session.thinking.value?$(e.session.thinking.value,t):t===`vi`?`Chưa xác định`:`Unknown`}function Xl(e,t=`vi`){let n=e.session.permissionProfile;return n.state===`known`&&n.value?$(n.value,t):t===`vi`?`Quyền chưa xác định`:`Unknown permission`}function Zl(e,t=`vi`){let n=e.relatedFileRefs.length,r=e.verifierAttemptRefs.length;return!n&&!r?t===`vi`?`Chưa có bằng chứng liên kết`:`No linked evidence`:t===`vi`?`${n} file · ${r} lần kiểm tra`:`${n} files · ${r} verifier runs`}function Ql(e,t=`vi`){let n=e.task;return n?{completed:n.progress.completed,total:n.progress.total,percent:Math.max(0,Math.min(100,n.progress.percent)),text:t===`vi`?`${n.progress.completed}/${n.progress.total} tiêu chí`:`${n.progress.completed}/${n.progress.total} criteria`}:{completed:0,total:0,percent:0,text:t===`vi`?`Chưa có task đang chạy`:`No active task`}}function $l(e){let t=e?.target;return t?[t.view,t.fileRef,t.diffRef,t.taskRevision,t.workspaceRevision,t.indexRevision??``,t.viewRevision,t.fileRevision,t.patchPreimage,t.contentDigest].join(``):`no-target`}function eu(e){return e?[$l(e),e.state,e.recordedState??``,e.recordedAt??``,e.evidenceRef??``].join(``):`no-review-state`}function tu(e,t){return e.identity.projectRef===t.identity.projectRef&&e.identity.runtimeInstanceId===t.identity.runtimeInstanceId&&e.identity.sessionRef===t.identity.sessionRef&&e.identity.taskId===t.identity.taskId&&e.identity.taskRunId===t.identity.taskRunId&&e.identity.agentOperationId===t.identity.agentOperationId&&e.identity.toolCallId===t.identity.toolCallId}function nu(e,t,n,r){return t.phase===`settled`&&t.resultCode===n&&t.action===`review.mark`&&t.commandId===e.commandId&&t.actionDigest===e.actionDigest&&t.idempotencyKeyDigest===r&&tu(e,t)&&typeof t.settledAt==`string`&&typeof t.settlementEvidenceRef==`string`}function ru(e,t){return!!(e&&e.projectRef===t.projectRef&&e.runtimeInstanceId===t.runtimeInstanceId&&e.sessionRef===t.sessionRef&&e.taskId===t.taskId&&e.taskRunId===t.taskRunId)}function iu(e,t,n,r,i,a){return e.view===t&&e.fileRef===n&&e.taskRevision===a.revision.taskRevision&&e.workspaceRevision===a.sourceChanges.workingTree.revision&&e.indexRevision===a.sourceChanges.staged.revision&&e.viewRevision===r&&e.fileRevision===i}function au(e,t,n,r,i,a,o){return!e||!ru(e.identity,a.identity)?!1:e.target?iu(e.target,t,n,r,i,a):e.state===`unavailable`&&!Bl(e,o)}async function ou(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest(`SHA-256`,t);return`sha256:${[...new Uint8Array(n)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function su({state:e,busy:t,status:n,deterministicEnabled:r,modelEnabled:i,locale:a,onGenerate:o,onCopy:s,onModel:c}){let l=e.value?.state===`ready`?e.value.summary:null;return(0,X.jsxs)(`section`,{className:`commit-summary-panel`,"aria-labelledby":`commit-summary-title`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Commit summary`}),(0,X.jsx)(`h3`,{id:`commit-summary-title`,children:D(a,`Tóm tắt phần đã stage`,`Staged changes summary`)}),(0,X.jsx)(`span`,{children:D(a,`Bản deterministic dùng 0 model token. Không commit hoặc push.`,`The deterministic version uses 0 model tokens. It does not commit or push.`)})]}),l?(0,X.jsxs)(`div`,{className:`commit-summary-output`,children:[(0,X.jsx)(`strong`,{children:l.title}),l.bodyLines.map((e,t)=>(0,X.jsx)(`code`,{children:e},`${l.summaryRef}.${t}`)),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`button`,{type:`button`,onClick:s,children:`Copy`}),(0,X.jsx)(`button`,{type:`button`,disabled:!i||t,onClick:c,children:D(a,`Nhờ Pi viết lại · tốn model token`,`Ask Pi to rewrite · uses model tokens`)})]})]}):(0,X.jsx)(`button`,{type:`button`,disabled:!r||t,onClick:o,children:t?D(a,`Đang tạo…`,`Generating…`):D(a,`Tạo summary · 0 token`,`Generate summary · 0 tokens`)}),n&&(0,X.jsx)(`p`,{className:`commit-summary-status`,role:`status`,children:n})]})}function cu({file:e,selected:t,onSelect:n,locale:r}){let i=e.path.lastIndexOf(`/`),a=i<0?e.path:e.path.slice(i+1);return(0,X.jsxs)(Ar,{component:`button`,className:`file-row`,selected:t,"data-selected":t,onClick:n,type:`button`,"aria-label":`${e.status} ${e.path} ${Fl(e,r)}`,"aria-pressed":t,children:[(0,X.jsx)(`span`,{className:`file-status status-${e.status}`,children:e.status}),(0,X.jsxs)(`span`,{className:`file-name`,children:[(0,X.jsx)(`strong`,{children:a}),e.oldPath&&(0,X.jsxs)(`small`,{children:[D(r,`từ`,`from`),` `,e.oldPath]})]}),(0,X.jsx)(`span`,{className:`file-provenance`,children:Pl(e,r)}),(0,X.jsx)(`span`,{className:`file-evidence`,children:Ll(e,r)}),(0,X.jsx)(`span`,{className:`file-stats`,children:Fl(e,r)})]})}function lu({text:e,path:t}){return(0,X.jsx)(X.Fragment,{children:rl(e,t).map((e,t)=>(0,X.jsx)(`span`,{className:`syntax-${e.kind}`,children:e.text},`${t}.${e.kind}`))})}function uu({line:e,side:t,path:n}){let r=e.kind===`deleted`?`old`:`new`,i=r===`old`?e.oldLineNumber??null:e.newLineNumber??null,a=r===`old`?(0,X.jsx)(Ol,{path:n,side:`old`,line:i,code:e.text}):(0,X.jsx)(`span`,{children:e.oldLineNumber??``}),o=r===`new`?(0,X.jsx)(Ol,{path:n,side:`new`,line:i,code:e.text}):(0,X.jsx)(`span`,{children:e.newLineNumber??``}),s=(0,X.jsx)(Dl,{path:n,side:r,line:i});if(t===`inline`)return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`diff-line diff-${e.kind}`,children:[a,o,(0,X.jsx)(`b`,{children:e.marker}),(0,X.jsx)(`code`,{children:(0,X.jsx)(lu,{text:e.text,path:n})})]}),s]});let c=e.kind===`added`?``:e.text,l=e.kind===`deleted`?``:e.text;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`split-line diff-${e.kind}`,children:[a,(0,X.jsx)(`code`,{children:(0,X.jsx)(lu,{text:c,path:n})}),o,(0,X.jsx)(`code`,{children:(0,X.jsx)(lu,{text:l,path:n})})]}),s]})}function du({state:e,review:t,mutation:n,revert:r,reviewEnabled:i,reviewBusy:a,reviewError:o,mutationEnabled:s,mutationBusy:c,mutationError:l,revertEnabled:u,revertBusy:d,openEnabled:f,openBusy:p,openStatus:m,detailError:h,mode:g,onMode:_,onReview:v,onMutation:y,onRevert:b,onOpen:x,onRetry:S,locale:C}){if(e.state===`idle`)return(0,X.jsx)(`div`,{className:`diff-empty`,children:(0,X.jsx)(`p`,{children:D(C,`Chọn một file để xem diff và bằng chứng liên quan.`,`Select a file to inspect its diff and related evidence.`)})});if(e.state===`loading`)return(0,X.jsx)(`div`,{className:`diff-empty`,children:(0,X.jsx)(`p`,{children:D(C,`Đang dựng diff từ Git và task baseline…`,`Building the diff from Git and the task baseline…`)})});if(e.state===`error`||!e.value)return(0,X.jsxs)(`div`,{className:`diff-empty error-state`,children:[(0,X.jsx)(`p`,{children:D(C,`Diff chưa thể đồng bộ với revision hiện tại.`,`The diff could not be reconciled with the current revision.`)}),S&&(0,X.jsx)(`button`,{type:`button`,onClick:S,children:D(C,`Thử đồng bộ lại`,`Retry reconciliation`)})]});let w=e.value;return(0,X.jsxs)(Z,{className:`diff-viewer`,sx:{minWidth:0,bgcolor:`background.paper`},children:[(0,X.jsxs)(Z,{component:`header`,className:`diff-toolbar`,sx:{position:`sticky`,top:0,zIndex:2,bgcolor:`background.paper`},children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:w.file.path}),(0,X.jsx)(rr,{size:`small`,variant:`outlined`,className:`access-badge tone-${Kl(w.availability.state)}`,label:$(w.availability.state,C)})]}),(0,X.jsxs)(`div`,{className:`diff-actions`,children:[t.state===`ready`&&t.value&&(0,X.jsxs)(`div`,{className:`review-state review-${t.value.state}`,children:[(0,X.jsx)(`span`,{children:t.value.state===`reviewed`?D(C,`Đã review`,`Reviewed`):t.value.state===`stale`?D(C,`Review đã cũ`,`Review stale`):t.value.state===`unavailable`?D(C,`Không thể review`,`Review unavailable`):D(C,`Chưa review`,`Not reviewed`)}),t.value.target&&t.value.state!==`unavailable`&&(0,X.jsx)(`button`,{type:`button`,disabled:!i||a,onClick:()=>v(t.value.state===`reviewed`?`unreviewed`:`reviewed`),children:a?D(C,`Đang ghi…`,`Saving…`):t.value.state===`reviewed`?D(C,`Bỏ dấu review`,`Mark unreviewed`):t.value.state===`stale`?D(C,`Review lại`,`Review again`):D(C,`Đánh dấu đã review`,`Mark reviewed`)})]}),n.state===`ready`&&n.value?.state===`ready`&&n.value.target&&(0,X.jsxs)(`div`,{className:`source-mutation-preview`,children:[(0,X.jsx)(`span`,{children:n.value.action===`source.stage`?D(C,`Chuẩn bị đúng thay đổi file này để commit`,`Prepare this exact file change for commit`):D(C,`Bỏ khỏi vùng commit; giữ nguyên file đang làm việc`,`Remove from commit while keeping the working file`)}),(0,X.jsx)(`button`,{type:`button`,disabled:!s||c,onClick:()=>y([]),children:c?D(C,`Đang cập nhật Git…`,`Updating Git…`):n.value.action===`source.stage`?`Stage file`:`Unstage file`})]}),r.state===`ready`&&r.value?.state===`ready`&&r.value.target&&(0,X.jsxs)(`div`,{className:`source-revert-preview`,children:[(0,X.jsx)(`span`,{children:D(C,`Hoàn tác phần chưa stage; giữ nguyên index`,`Revert unstaged changes while preserving the index`)}),(0,X.jsx)(`button`,{type:`button`,disabled:!u||d,onClick:()=>b(null),children:d?D(C,`Đang dựng preview…`,`Building preview…`):`Revert file`})]}),(0,X.jsx)(Io,{path:w.file.path}),f&&(0,X.jsx)(`div`,{className:`source-open-action`,children:(0,X.jsx)(`button`,{type:`button`,disabled:p,onClick:x,children:p?D(C,`Đang mở…`,`Opening…`):D(C,`Mở trong VS Code`,`Open in VS Code`)})}),(0,X.jsxs)(ei,{className:`mode-switch`,exclusive:!0,size:`small`,value:g,"aria-label":D(C,`Kiểu hiển thị diff`,`Diff layout`),onChange:(e,t)=>t&&_(t),children:[(0,X.jsx)(Jr,{value:`inline`,"aria-label":`Inline`,children:`Inline`}),(0,X.jsx)(Jr,{value:`split`,"aria-label":D(C,`Hai cột`,`Side by side`),children:D(C,`Hai cột`,`Side by side`)})]})]})]}),o&&(0,X.jsx)(`div`,{className:`review-error`,role:`status`,children:o}),l&&(0,X.jsx)(`div`,{className:`review-error`,role:`status`,children:l}),m&&(0,X.jsx)(`div`,{className:`source-open-status`,role:`status`,children:m}),h&&(0,X.jsxs)(`div`,{className:`detail-reconciliation-warning`,role:`status`,children:[(0,X.jsx)(`span`,{children:D(C,`Một thao tác source chưa đồng bộ; diff hiện tại vẫn chính xác.`,`A source action is not reconciled yet; the current diff remains exact.`)}),S&&(0,X.jsx)(`button`,{type:`button`,onClick:S,children:D(C,`Thử đồng bộ lại`,`Retry reconciliation`)})]}),(0,X.jsxs)(`div`,{className:`diff-context`,children:[(0,X.jsx)(`span`,{children:Pl(w.file,C)}),(0,X.jsx)(`span`,{children:Ll(w.file,C)}),(0,X.jsxs)(`span`,{className:`additions`,children:[`+`,w.file.stats.additions??`?`]}),(0,X.jsxs)(`span`,{className:`deletions`,children:[`−`,w.file.stats.deletions??`?`]})]}),w.fallback.kind!==`none`&&(0,X.jsxs)(`div`,{className:`diff-fallback`,children:[(0,X.jsx)(`strong`,{children:$(w.fallback.kind,C)}),(0,X.jsx)(`span`,{children:w.fallback.message??w.fallback.reasonCode??D(C,`Nội dung diff không sẵn sàng`,`Diff content unavailable`)})]}),w.hunks.map((e,t)=>(0,X.jsxs)(`section`,{className:`diff-hunk`,"aria-label":`${D(C,`Vùng thay đổi`,`Change region`)} ${t+1}`,children:[(0,X.jsxs)(`div`,{className:`hunk-header`,children:[(0,X.jsx)(`span`,{children:e.header}),(0,X.jsxs)(`span`,{className:`hunk-actions`,children:[n.value?.state===`ready`&&n.value.target?.hunkRefs.includes(e.hunkRef)&&(0,X.jsx)(`button`,{type:`button`,disabled:!s||c,onClick:()=>y([e.hunkRef]),children:n.value.action===`source.stage`?`Stage hunk`:`Unstage hunk`}),r.value?.state===`ready`&&r.value.target&&r.value.preview?.hunks.some(t=>t.hunkRef===e.hunkRef)&&(0,X.jsx)(`button`,{className:`revert-action`,type:`button`,disabled:!u||d,onClick:()=>b(e.hunkRef),children:`Revert hunk`})]})]}),(0,X.jsx)(`div`,{className:g===`split`?`split-code`:`inline-code`,children:e.lines.map(e=>(0,X.jsx)(uu,{line:e,side:g,path:w.file.path},e.lineRef))}),w.unchangedRegions[t]&&(0,X.jsxs)(`div`,{className:`unchanged-region`,children:[`… `,w.unchangedRegions[t].lineCount,` `,D(C,`dòng không đổi đã thu gọn`,`unchanged lines collapsed`),` …`]})]},e.hunkRef)),(0,X.jsx)(kl,{path:w.file.path,shownLines:new Set(w.hunks.flatMap(e=>e.lines.map(e=>e.newLineNumber).filter(e=>typeof e==`number`)))}),w.truncation.truncated&&(0,X.jsxs)(`div`,{className:`diff-fallback`,children:[(0,X.jsx)(`strong`,{children:D(C,`Diff đã rút gọn`,`Diff truncated`)}),(0,X.jsxs)(`span`,{children:[D(C,`Còn`,`Another`),` `,w.truncation.omittedLines,` `,D(C,`dòng chưa hiển thị.`,`lines are not shown.`)]})]})]})}function fu({snapshot:e,refreshSnapshot:t,sessionRef:n,findings:r,onSendComments:i}){let{locale:a}=C(),[o,s]=(0,Y.useState)(()=>n?fl(n):[]),[c,l]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{s(n?fl(n):[]),l(null)},[n]),(0,Y.useEffect)(()=>{let e=e=>{n&&e.detail===n&&s(fl(n))};return window.addEventListener(il,e),()=>window.removeEventListener(il,e)},[n]);let u=(0,Y.useCallback)(e=>{s(e),n&&pl(n,e)},[n]),d=!!(e.task&&e.sourceChanges.task?.state!==`unavailable`&&e.sourceChanges.task?.revision),f=(0,Y.useMemo)(()=>Ml(a),[a]),[p,m]=(0,Y.useState)(()=>d?`task`:`working-tree`),[h,g]=(0,Y.useState)({}),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)({state:`idle`}),[x,S]=(0,Y.useState)({state:`idle`}),[w,T]=(0,Y.useState)({state:`idle`}),[E,O]=(0,Y.useState)({state:`idle`}),[k,A]=(0,Y.useState)(null),[j,M]=(0,Y.useState)(!1),[N,P]=(0,Y.useState)(null),[F,I]=(0,Y.useState)(!1),[ee,te]=(0,Y.useState)(null),[L,ne]=(0,Y.useState)(!1),[R,z]=(0,Y.useState)(null),[re,ie]=(0,Y.useState)(!1),[ae,oe]=(0,Y.useState)(null),[se,ce]=(0,Y.useState)(null),[le,ue]=(0,Y.useState)({state:`idle`}),[de,fe]=(0,Y.useState)(!1),[pe,me]=(0,Y.useState)(null),[he,ge]=(0,Y.useState)(!1),[_e,ve]=(0,Y.useState)(0),[ye,be]=(0,Y.useState)(`inline`),xe={sourceProjectionRevision:e.sourceChanges.projectionRevision??null,taskViewRevision:e.sourceChanges.task.revision,workspaceRevision:e.sourceChanges.workingTree.revision,indexRevision:e.sourceChanges.staged.revision},Se=Rl(xe,e.identity),Ce=[Se,_e].join(``),we=[Se,e.revision.taskRevision??`no-task-revision`].join(``),B=[n??`default-session`,p,e.identity.projectRef,e.identity.runtimeInstanceId,e.identity.sessionRef,e.identity.taskId??`no-task`,e.identity.taskRunId??`no-run`].join(``),Te=(0,Y.useRef)(B);Te.current=B;let Ee=(0,Y.useRef)(0),De=(0,Y.useRef)(B);De.current!==B&&(De.current=B,Ee.current+=1);let Oe=Ee.current,ke=(0,Y.useRef)(null),Ae=h[p],je=Ae?.state===`ready`?Vl(Ae.value,Ae.revisionKey,Ce,xe,e.identity,p):null,Me=Ae?.state===`ready`&&!je?{state:`loading`}:Ae,V=je?.files??[],H=Ul(V,_),Ne=H?V.find(e=>e.fileRef===H)??null:null,Pe=!!(je&&Ne),Fe=e.capabilities.capabilities.reviewActions,Ie=JSON.stringify(Fe),Le=p===`working-tree`?`source.stage`:p===`staged`?`source.unstage`:null,Re=Fe.status===`available`&&Fe.actions.reviewMark.available,ze=Le===`source.stage`?Fe.status===`available`&&Fe.actions.stage.available:Le===`source.unstage`&&Fe.status===`available`&&Fe.actions.unstage.available,Be=p===`working-tree`&&Fe.status===`available`&&Fe.actions.revert.available,Ve=Pe?[n??`default-session`,p,H,je.viewRevision,Ne.fileRevision,we,_e,Ie].join(``):`no-detail-request`,He=!!(Pe&&y.requestKey===Ve&&y.state===`ready`&&Hl(y.value,p,H,je.viewRevision,Ne.fileRevision,e)),Ue=!!(Pe&&x.requestKey===Ve&&x.state===`ready`&&au(x.value,p,H,je.viewRevision,Ne.fileRevision,e,He?y.value:void 0)),We=!!(Pe&&w.requestKey===Ve&&w.state===`ready`&&au(w.value,p,H,je.viewRevision,Ne.fileRevision,e,He?y.value:void 0)),Ge=!!(Pe&&E.requestKey===Ve&&E.state===`ready`&&au(E.value,p,H,je.viewRevision,Ne.fileRevision,e,He?y.value:void 0)),U=!!(Pe&&y.requestKey===Ve&&y.state===`ready`&&!He),Ke=!!(Pe&&x.requestKey===Ve&&x.state===`ready`&&!Ue),W=!!(Pe&&w.requestKey===Ve&&w.state===`ready`&&!We),qe=!!(Pe&&E.requestKey===Ve&&E.state===`ready`&&!Ge),G=!!(Pe&&y.requestKey===Ve&&y.state===`error`),Je=!!(Pe&&Re&&x.requestKey===Ve&&x.state===`error`),Ye=!!(Pe&&ze&&w.requestKey===Ve&&w.state===`error`),Xe=!!(Pe&&Be&&E.requestKey===Ve&&E.state===`error`),Ze=U||Ke||W||qe||G||Je||Ye||Xe,Qe=!!(Pe&&He&&(!Re||Ue)&&(!ze||We)&&(!Be||Ge)),$e=(0,Y.useRef)(null);H&&($e.current={sourceScope:B,fileRef:H});let et=[B,H??($e.current?.sourceScope===B?$e.current.fileRef:`no-file`)].join(``),tt=(0,Y.useRef)(et);tt.current=et;let nt=(0,Y.useRef)(new Set),rt=(0,Y.useRef)(0),it=(0,Y.useRef)(et);it.current!==et&&(it.current=et,rt.current+=1);let at=rt.current,[K,ot]=(0,Y.useState)(null),st=!!(Ze&&t&&(!nt.current.has(et)||K?.scope===et&&K.generation===at&&K.requestKey===Ve)),ct=Pe?y.requestKey===Ve?(U||G)&&st?{state:`loading`}:U||G?{state:`error`}:y:{state:`loading`}:{state:`idle`},lt=ct.state===`ready`?ct.value:void 0,ut=new Map;for(let e of lt?.hunks.flatMap(e=>e.lines)??[]){let t=e.kind===`deleted`?`old`:`new`,n=t===`old`?e.oldLineNumber:e.newLineNumber;typeof n==`number`&&lt&&ut.set(ll(lt.file.path,t,n),e.text)}let dt=n&&i?{locale:a,findings:r,comments:o,editing:c?.key??null,open:(e,t,n,r)=>l({key:ll(e,t,n),path:e,side:t,line:n,code:r}),save:e=>{c&&u(ml(o,{path:c.path,side:c.side,line:c.line,code:c.code,text:e})),l(null)},cancel:()=>l(null),remove:e=>u(o.filter(t=>ll(t.path,t.side,t.line)!==e))}:null,ft=Pe&&Re?x.requestKey===Ve?st?{state:`loading`}:Ke||Je?{state:`error`}:x:{state:`loading`}:{state:`idle`},pt=Pe&&ze?w.requestKey===Ve?st?{state:`loading`}:W||Ye?{state:`error`}:w:{state:`loading`}:{state:`idle`},mt=Pe&&Be?E.requestKey===Ve?st?{state:`loading`}:qe||Xe?{state:`error`}:E:{state:`loading`}:{state:`idle`},J=Pe?[n??`default-session`,p,H,je.viewRevision,Ne.fileRevision,we].join(``):`no-source-authority`,gt=(0,Y.useRef)(J);gt.current=J;let _t=[J,e.revision.runtimeRevision,e.revision.controlRevision??`no-control-revision`,e.revision.approvalRevision??`no-approval-revision`,e.revision.sessionOptionRevision??`no-session-option-revision`,e.revision.queueRevision??`no-queue-revision`].join(``),vt=(0,Y.useRef)(_t);vt.current=_t;let yt=[n??`default-session`,e.identity.projectRef,e.identity.runtimeInstanceId,e.identity.sessionRef,e.identity.taskId??`no-task`,e.identity.taskRunId??`no-run`,e.revision.taskRevision??`no-task-revision`,e.sourceChanges.staged.revision??`no-index-revision`].join(``),bt=(0,Y.useRef)(yt);bt.current=yt;let xt=(0,Y.useRef)(``),St=(0,Y.useRef)(``);xt.current=[J,$l(ft.value)].join(``),St.current=eu(ft.value),(0,Y.useEffect)(()=>{ue({state:`idle`}),me(null),ge(!1)},[yt]),(0,Y.useEffect)(()=>{!d&&p===`task`&&(m(`working-tree`),v(null))},[d,p]),(0,Y.useEffect)(()=>{ke.current=null,ce(null)},[B,Oe]),(0,Y.useEffect)(()=>{Qe&&(nt.current.delete(et),ot(e=>e?.scope===et?null:e))},[Qe,et]),(0,Y.useEffect)(()=>{let r=new AbortController,i=Ce;return g(e=>({...e,[p]:{state:`loading`,revisionKey:i}})),(n?js(n,p,r.signal):Us(p,r.signal)).then(n=>{if(!n){r.signal.aborted||g(e=>({...e,[p]:{state:`error`,revisionKey:i}}));return}if(!zl(n,p,xe,e.identity)){if(r.signal.aborted)return;if(!t||ke.current===B){g(e=>({...e,[p]:{state:`error`,revisionKey:i}}));return}ke.current=B,g(e=>({...e,[p]:{state:`loading`,revisionKey:i}})),t().then(e=>{if(!r.signal.aborted){if(!e){g(e=>({...e,[p]:{state:`error`,revisionKey:i}}));return}ve(e=>e+1)}}).catch(()=>{r.signal.aborted||g(e=>({...e,[p]:{state:`error`,revisionKey:i}}))});return}ke.current=null,r.signal.aborted||g(e=>({...e,[p]:{state:`ready`,value:n,revisionKey:i}}))}).catch(()=>{r.signal.aborted||g(e=>({...e,[p]:{state:`error`,revisionKey:i}}))}),()=>r.abort()},[p,Ce,n]);let Ct=(0,Y.useCallback)(()=>{let e=B,n=Oe,r=Se;ke.current=null,g(e=>({...e,[p]:{state:`loading`,revisionKey:Ce}})),(async()=>{let i;try{i=await t?.()}catch{}if(Te.current!==e||Ee.current!==n)return;ke.current=e;let a=i?Rl({sourceProjectionRevision:i.sourceChanges.projectionRevision??null,taskViewRevision:i.sourceChanges.task.revision,workspaceRevision:i.sourceChanges.workingTree.revision,indexRevision:i.sourceChanges.staged.revision},i.identity):r;(!i||a===r)&&ve(e=>e+1)})()},[t,Se,Oe,B,Ce,p]);(0,Y.useEffect)(()=>{if(!H){b({state:`idle`}),S({state:`idle`}),T({state:`idle`}),O({state:`idle`}),P(null),te(null),z(null),A(null),oe(null);return}let e=new AbortController,t=Ve;return b({state:`loading`,requestKey:t}),P(null),te(null),z(null),A(null),oe(null),S(Re?{state:`loading`,requestKey:t}:{state:`idle`}),T(ze?{state:`loading`,requestKey:t}:{state:`idle`}),O(Be?{state:`loading`,requestKey:t}:{state:`idle`}),(n?Ms(n,p,H,e.signal):Ws(p,H,e.signal)).then(n=>{e.signal.aborted||b({state:`ready`,value:n,requestKey:t})}).catch(()=>{e.signal.aborted||b({state:`error`,requestKey:t})}),Re&&(n?Ns(n,p,H,e.signal):Gs(p,H,e.signal)).then(n=>{e.signal.aborted||S({state:`ready`,value:n,requestKey:t})}).catch(()=>{e.signal.aborted||S({state:`error`,requestKey:t})}),ze&&Le&&(n?Ps(n,Le,H,e.signal):Ks(Le,H,e.signal)).then(n=>{e.signal.aborted||T({state:`ready`,value:n,requestKey:t})}).catch(()=>{e.signal.aborted||T({state:`error`,requestKey:t})}),Be&&(n?Fs(n,H,null,e.signal):qs(H,null,e.signal)).then(n=>{e.signal.aborted||O({state:`ready`,value:n,requestKey:t})}).catch(()=>{e.signal.aborted||O({state:`error`,requestKey:t})}),()=>e.abort()},[H,p,we,_e,n,Ie,Ve]);let wt=(0,Y.useCallback)(e=>{if(!Pe||!t)return;let n=et,r=at,i=Ve;!e&&nt.current.has(n)||(nt.current.add(n),ot({scope:n,generation:r,requestKey:i}),t().then(e=>{e&&tt.current===n&&rt.current===r&&ve(e=>e+1)}).catch(()=>void 0).finally(()=>{ot(e=>e?.scope===n&&e.generation===r&&e.requestKey===i?null:e)}))},[Pe,at,et,Ve,t]);(0,Y.useEffect)(()=>{!Pe||!Ze||!t||nt.current.has(et)||wt(!1)},[wt,Pe,Ze,et,t]);let Tt=V,Et=(0,Y.useMemo)(()=>{let e=new Map;for(let t of Tt){let n=t.path.lastIndexOf(`/`),r=n<0?D(a,`Gốc project`,`Project root`):t.path.slice(0,n);e.set(r,[...e.get(r)??[],t])}return[...e.entries()]},[Tt,a]),Dt=(0,Y.useMemo)(()=>{let t={task:e.sourceChanges.task.counts.files,"working-tree":e.sourceChanges.workingTree.counts.files,staged:e.sourceChanges.staged.counts.files},n=n=>{let r=h[n];return(r?.state===`ready`?Vl(r.value,r.revisionKey,Ce,xe,e.identity,n):null)?.page.total??t[n]};return{task:n(`task`),"working-tree":n(`working-tree`),staged:n(`staged`)}},[h,Ce,e.sourceChanges.task.counts.files,e.sourceChanges.workingTree.counts.files,e.sourceChanges.staged.counts.files]),Ot=e=>{ce(null),m(e),v(null)},kt=Fe.status===`available`&&Fe.actions.reviewMark.available,At=pt.value?.action===`source.stage`?Fe.status===`available`&&Fe.actions.stage.available:pt.value?.action===`source.unstage`&&Fe.status===`available`&&Fe.actions.unstage.available,jt=Fe.status===`available`&&Fe.actions.revert.available,Mt=p===`working-tree`&&Fe.status===`available`&&Fe.actions.openInVsCode.available&&ct.state===`ready`&&ct.value?.availability.state===`current`&&ct.value.fallback.kind===`none`,Nt=p===`staged`&&Tt.length>0,Pt=Nt&&Fe.status===`available`&&Fe.actions.generateCommitSummaryDeterministic.available,Ft=Nt&&Fe.status===`available`&&Fe.actions.generateCommitSummaryModel.available,It=t=>!t||t.identity.projectRef!==e.identity.projectRef||t.identity.runtimeInstanceId!==e.identity.runtimeInstanceId||t.identity.sessionRef!==e.identity.sessionRef||t.identity.taskId!==e.identity.taskId||t.identity.taskRunId!==e.identity.taskRunId?!1:t.summary?t.summary.taskRevision===e.revision.taskRevision&&t.summary.indexRevision===e.sourceChanges.staged.revision:t.state===`unavailable`,Lt=async t=>{if(!H||!ft.value||j)return;let r=ft.value,i=eu(r),o=xt.current,s=vt.current,c=B,l=Oe,u=et,d=at,f=Se,m=!1;M(!0),P(null),ce(null);try{let h=await Rc(e,r,t);if(xt.current!==o||St.current!==i||vt.current!==s)return;let g=await ou(h.idempotencyKey);if(xt.current!==o||St.current!==i||vt.current!==s)return;m=!0;let _=await dc(h);if(!nu(h,_,t,g)){if(_.phase!==`rejected`){await Rt(c,l,u,d,f,D(a,`Chưa xác nhận được receipt review. Piagent đã đọc lại trạng thái chính thức và sẽ không tự gửi lại lệnh.`,`The review receipt is unconfirmed. Piagent reloaded canonical state and will not resend the command.`));return}xt.current===o&&St.current===i&&P(_.error?.message??D(a,`Không xác nhận được trạng thái review chính xác; hãy tải lại diff.`,`The exact review state could not be confirmed; reload the diff.`));return}if(xt.current!==o||St.current!==i)return;S(e=>xt.current===o&&eu(e.value)===i?{state:`ready`,requestKey:e.requestKey,value:{...r,generatedAt:_.settledAt,state:_.resultCode,recordedState:_.resultCode,recordedAt:_.settledAt,evidenceRef:_.settlementEvidenceRef,reasonCode:null,health:{state:`ok`,reasonCode:null,message:null}}}:e),(n?Ns(n,p,H):Gs(p,H)).then(e=>S(t=>xt.current===o&&t.state===`ready`&&t.value?.evidenceRef===_.settlementEvidenceRef?{state:`ready`,value:e,requestKey:t.requestKey}:t)).catch(()=>void 0)}catch{m?await Rt(c,l,u,d,f,D(a,`Mất kết nối khi đang ghi review. Piagent đã đọc lại trạng thái chính thức và sẽ không tự gửi lại lệnh.`,`The connection was lost while saving review. Piagent reloaded canonical state and will not resend the command.`)):xt.current===o&&St.current===i&&P(D(a,`Không thể ghi trạng thái review. Nội dung source không bị thay đổi.`,`Unable to save review state. Source content was not changed.`))}finally{M(!1)}},Rt=async(e,n,r,i,a,o)=>{tt.current===r&&rt.current===i&&(b({state:`idle`}),S({state:`idle`}),T({state:`idle`}),O({state:`idle`}),A(null),P(null),te(null),z(null),oe(null),ce(null));let s;try{s=await t?.()}catch{}if(Te.current!==e||Ee.current!==n)return;let c=s?Rl({sourceProjectionRevision:s.sourceChanges.projectionRevision??null,taskViewRevision:s.sourceChanges.task.revision,workspaceRevision:s.sourceChanges.workingTree.revision,indexRevision:s.sourceChanges.staged.revision},s.identity):a;(!s||c===a)&&ve(e=>e+1),ce({scope:e,generation:n,message:o})},zt=async(n=[])=>{if(!H||!je||!pt.value||pt.value.state!==`ready`||F)return;let r=gt.current,i=vt.current,o=pt.value,s=B,c=Oe,l=et,u=at,d=Se,f=!1;I(!0),te(null),ce(null);try{let p=await Vc(e,o,n);if(gt.current!==r||vt.current!==i)return;f=!0;let m=await fc(p);if(m.phase===`uncertain`){await Rt(s,c,l,u,d,D(a,`Chưa xác nhận được trạng thái Git. Piagent đã tải lại Source Changes và sẽ không tự gửi lại lệnh.`,`Git state is unconfirmed. Piagent refreshed Source Changes and will not resend the command.`));return}if(m.phase!==`settled`||![`staged`,`unstaged`].includes(m.resultCode)){gt.current===r&&te(m.error?.message??D(a,`File hoặc Git index đã thay đổi; hãy tải lại preview.`,`The file or Git index changed; reload the preview.`));return}gt.current===r&&v(null),await t?.(),ve(e=>e+1)}catch{f?await Rt(s,c,l,u,d,D(a,`Mất kết nối khi đang cập nhật Git. Piagent đã tải lại Source Changes và sẽ không tự gửi lại lệnh.`,`The connection was lost while updating Git. Piagent refreshed Source Changes and will not resend the command.`)):gt.current===r&&te(D(a,`Không thể chuẩn bị lệnh cập nhật Git; source chưa bị thay đổi.`,`Unable to prepare the Git update; source was not changed.`))}finally{I(!1)}},Bt=async e=>{if(!H||!je||!jt||L)return;let t=gt.current,r=H;ne(!0),z(null),ce(null);try{let i=n?await Fs(n,r,e):await qs(r,e);if(gt.current!==t)return;if(i.state!==`ready`||!i.target){z(D(a,`Không thể hoàn tác an toàn: provenance hoặc diff hiện tại không còn đủ bằng chứng.`,`Safe revert is unavailable because provenance or the current diff lacks evidence.`));return}A(i)}catch{gt.current===t&&z(D(a,`Không thể dựng preview hoàn tác. Source chưa bị thay đổi.`,`Unable to build a revert preview. Source was not changed.`))}finally{ne(!1)}},Vt=async()=>{if(!k?.target||!H||!je||!Ne||L||!iu(k.target,p,H,je.viewRevision,Ne.fileRevision,e))return;let r=gt.current,i=vt.current,o=k,s=B,c=Oe,l=et,u=at,d=Se,f=!1;ne(!0),z(null),ce(null);try{let p=await Wc(e,o);if(gt.current!==r||vt.current!==i)return;f=!0;let m=await pc(p,void 0,n);if(m.phase===`uncertain`){await Rt(s,c,l,u,d,D(a,`Chưa xác nhận được kết quả revert. Piagent đã tải lại Source Changes và sẽ không tự gửi lại lệnh.`,`The revert result is unconfirmed. Piagent refreshed Source Changes and will not resend the command.`));return}if(m.phase!==`settled`||m.resultCode!==`reverted`){gt.current===r&&z(m.error?.message??D(a,`Preview đã cũ; hãy mở lại trước khi xác nhận.`,`The preview is stale; reopen it before confirming.`));return}gt.current===r&&(A(null),v(null)),await t?.(),ve(e=>e+1)}catch{f?await Rt(s,c,l,u,d,D(a,`Mất kết nối khi đang revert. Piagent đã tải lại Source Changes và sẽ không tự gửi lại lệnh.`,`The connection was lost during revert. Piagent refreshed Source Changes and will not resend the command.`)):gt.current===r&&z(D(a,`Không thể chuẩn bị lệnh revert; source chưa bị thay đổi.`,`Unable to prepare the revert command; source was not changed.`))}finally{ne(!1)}},Ht=async()=>{if(!H||!Mt||re)return;let t=gt.current,n=vt.current,r=H;ie(!0),oe(null);try{let i=await Jc(e,r);if(gt.current!==t||vt.current!==n)return;let o=await mc(i);if(gt.current!==t)return;o.phase===`settled`&&o.resultCode===`opened`?oe(D(a,`VS Code đã nhận yêu cầu mở file.`,`VS Code received the open-file request.`)):oe(o.phase===`uncertain`?D(a,`Không xác nhận được VS Code đã nhận file. Piagent sẽ không tự mở lại.`,`It is unknown whether VS Code received the file. Piagent will not retry automatically.`):o.error?.message??D(a,`File hoặc phiên làm việc đã thay đổi; hãy tải lại trước khi mở.`,`The file or session changed; refresh before opening.`))}catch{gt.current===t&&oe(D(a,`Không thể mở file trong VS Code. Diff hiện tại vẫn được giữ nguyên.`,`Unable to open the file in VS Code. The current diff remains available.`))}finally{ie(!1)}},Ut=async()=>{if(!Pt||de)return;let e=bt.current;fe(!0),me(null),ue({state:`loading`});try{let t=n?await Is(n):await Js();if(bt.current!==e)return;if(!It(t)){ue({state:`error`}),me(D(a,`Staged Changes đã đổi trong lúc dựng summary; hãy tạo lại.`,`Staged Changes changed while the summary was generated; generate it again.`));return}ue({state:`ready`,value:t}),t.state!==`ready`&&me(D(a,`Staged Changes đã thay đổi hoặc chưa có dữ liệu để tóm tắt.`,`Staged Changes changed or has no data to summarize.`))}catch{bt.current===e&&(ue({state:`error`}),me(D(a,`Không thể dựng commit summary từ index hiện tại.`,`Unable to generate a commit summary from the current index.`)))}finally{fe(!1)}},Wt=async()=>{let e=le.value?.summary;if(!e||!It(le.value))return;let t=bt.current;try{await navigator.clipboard.writeText([e.title,``,...e.bodyLines].join(`
41
+ `)),bt.current===t&&me(D(a,`Đã copy summary. Chưa có commit nào được tạo.`,`Summary copied. No commit was created.`))}catch{bt.current===t&&me(D(a,`Trình duyệt không cho phép copy tự động.`,`The browser did not allow automatic copying.`))}},Gt=async()=>{let t=le.value?.summary;if(!t||!It(le.value)||!Ft||de)return;let n=bt.current;fe(!0),me(null);try{let r=await Oc(e,t.modelPrompt,`new-operation`);if(bt.current!==n||!It(le.value))return;let i=await sc(r);if(bt.current!==n)return;i.phase===`settled`&&i.resultCode===`dispatch-observed`?me(D(a,`Đã gửi yêu cầu sang Chat. Pi sẽ trả commit summary ở hội thoại; chưa commit hoặc push.`,`Request sent to Chat. Pi will return the commit summary in the conversation; nothing was committed or pushed.`)):me(i.phase===`uncertain`?D(a,`Không xác nhận được yêu cầu đã tới Pi; hệ thống sẽ không tự gửi lại.`,`It is unknown whether the request reached Pi; it will not be resent automatically.`):i.error?.message??D(a,`Không thể bắt đầu model work từ session hiện tại.`,`Unable to start model work from the current session.`))}catch{bt.current===n&&me(D(a,`Không thể gửi yêu cầu sang Pi session hiện tại.`,`Unable to send the request to the current Pi session.`))}finally{fe(!1),ge(!1)}},Kt=se?.scope===B&&se.generation===Oe?se.message:null;return(0,X.jsxs)(ht,{component:`section`,variant:`outlined`,className:`source-workspace`,"aria-labelledby":`source-title`,sx:{overflow:`hidden`,minHeight:`calc(100vh - 120px)`,display:`flex`,flexDirection:`column`},children:[(0,X.jsxs)(Z,{component:`header`,className:`source-heading`,sx:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,px:{xs:2,sm:2.5},py:1.75,borderBottom:1,borderColor:`divider`},children:[(0,X.jsxs)(Z,{children:[(0,X.jsx)(q,{variant:`overline`,color:`primary.main`,sx:{fontWeight:800,letterSpacing:`.14em`,lineHeight:1},children:`Source changes`}),(0,X.jsx)(q,{variant:`h2`,id:`source-title`,sx:{mt:.5},children:D(a,`Thay đổi trong project`,`Project changes`)})]}),(0,X.jsx)(rr,{label:`Git + task baseline`,variant:`outlined`,size:`small`})]}),(0,X.jsx)(us,{className:`source-tabs`,value:p,onChange:(e,t)=>Ot(t),selectionFollowsFocus:!0,variant:`scrollable`,scrollButtons:`auto`,"aria-label":D(a,`Nguồn thay đổi`,`Change sources`),sx:{borderBottom:1,borderColor:`divider`,minHeight:48},children:f.map(e=>(0,X.jsx)(Uo,{id:`source-tab-${e.view}`,value:e.view,"aria-controls":`source-tabpanel`,disabled:e.view===`task`&&!d,title:e.view===`task`&&!d?D(a,`Session này chưa có task baseline`,`This session has no task baseline`):void 0,label:(0,X.jsxs)(Q,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,X.jsx)(`span`,{children:e.label}),Dt[e.view]>0&&(0,X.jsx)(rr,{size:`small`,label:Dt[e.view],sx:{height:20,minWidth:24,"& .MuiChip-label":{px:.75}}})]})},e.view))}),p===`staged`&&(0,X.jsx)(su,{state:le,busy:de,status:pe,locale:a,deterministicEnabled:Pt,modelEnabled:Ft,onGenerate:()=>{Ut()},onCopy:()=>{Wt()},onModel:()=>ge(!0)}),dt&&(0,X.jsx)(Al,{comments:o,lines:ut,linesPath:lt?.file.path,locale:a,onSend:()=>{i?.(gl(o,a===`en`)),u([])},onClear:()=>u([])}),(0,X.jsxs)(Z,{className:`source-body`,sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,md:`minmax(286px, 330px) minmax(0, 1fr)`},flex:1,minHeight:620},children:[(0,X.jsxs)(Z,{className:`file-panel`,id:`source-tabpanel`,role:`tabpanel`,"aria-labelledby":`source-tab-${p}`,sx:{minWidth:0,borderRight:{md:1},borderBottom:{xs:1,md:0},borderColor:`divider`,bgcolor:`background.default`},children:[(0,X.jsxs)(Z,{className:`file-panel-meta`,sx:{minHeight:44,display:`flex`,alignItems:`center`,justifyContent:`space-between`,gap:1,px:1.5,borderBottom:1,borderColor:`divider`},children:[(0,X.jsx)(`span`,{"aria-live":`polite`,children:Me?.state===`ready`&&Me.value?Il(Me.value,a):Me?.state===`error`?D(a,`Không thể tải danh sách file`,`Unable to load files`):D(a,`Đang tải…`,`Loading…`)}),(0,X.jsxs)(Q,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[Me?.state===`error`&&(0,X.jsx)(`button`,{className:`source-list-retry`,type:`button`,onClick:Ct,children:D(a,`Thử tải lại`,`Retry`)}),(0,X.jsx)(`small`,{children:f.find(e=>e.view===p)?.shortLabel})]})]}),(0,X.jsxs)(Z,{className:`file-list`,sx:{maxHeight:{xs:300,md:`calc(100vh - 270px)`},overflow:`auto`,p:.75},children:[Et.map(([e,t])=>(0,X.jsxs)(Z,{children:[(0,X.jsxs)(Q,{direction:`row`,className:`file-group-label`,children:[(0,X.jsx)(Ro,{}),(0,X.jsx)(q,{component:`span`,noWrap:!0,children:e})]}),t.map(e=>(0,X.jsx)(cu,{file:e,selected:e.fileRef===H,onSelect:()=>{ce(null),v(e.fileRef)},locale:a},e.fileRef))]},e)),Me?.state===`ready`&&Tt.length===0&&(0,X.jsx)(`div`,{className:`files-empty`,children:D(a,`Không có thay đổi trong view này.`,`No changes in this view.`)})]})]}),(0,X.jsx)(Sl.Provider,{value:dt,children:(0,X.jsx)(du,{state:ct,review:ft,mutation:pt,revert:mt,reviewEnabled:kt,reviewBusy:j,reviewError:N,mutationEnabled:At,mutationBusy:F,mutationError:ee,revertEnabled:jt,revertBusy:L,openEnabled:Mt,openBusy:re,openStatus:ae,detailError:Ze&&!st,mode:ye,onMode:be,onReview:e=>{Lt(e)},onMutation:e=>{zt(e)},onRevert:e=>{Bt(e)},onOpen:()=>{Ht()},onRetry:Pe&&t?()=>wt(!0):void 0,locale:a})})]}),Kt&&(0,X.jsx)(`div`,{className:`source-action-warning`,role:`status`,children:Kt}),R&&(0,X.jsx)(`div`,{className:`source-revert-error`,role:`status`,children:R}),k?.target&&H&&je&&Ne&&iu(k.target,p,H,je.viewRevision,Ne.fileRevision,e)&&(0,X.jsx)(`div`,{className:`dialog-backdrop`,role:`presentation`,children:(0,X.jsxs)(`section`,{className:`confirm-dialog`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`revert-dialog-title`,"aria-describedby":`revert-dialog-description`,children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:D(a,`Xác nhận hoàn tác`,`Confirm revert`)}),(0,X.jsxs)(`h3`,{id:`revert-dialog-title`,children:[`Revert `,k.target.hunkRefs.length?`hunk`:`file`,`?`]}),(0,X.jsxs)(`p`,{id:`revert-dialog-description`,children:[D(a,`Thao tác sẽ bỏ`,`This will discard`),` `,(0,X.jsxs)(`strong`,{children:[k.target.summary.additionsDiscarded,` `,D(a,`dòng thêm`,`added lines`)]}),` `,D(a,`và khôi phục`,`and restore`),` `,(0,X.jsxs)(`strong`,{children:[k.target.summary.deletionsRestored,` `,D(a,`dòng xóa`,`deleted lines`)]}),` `,D(a,`trong`,`in`),` `,(0,X.jsx)(`code`,{children:k.target.path}),`.`]}),(0,X.jsx)(`div`,{className:`revert-diff`,"aria-label":D(a,`Các dòng chính xác sẽ được hoàn tác`,`Exact lines to revert`),children:k.preview?.hunks.map(e=>(0,X.jsxs)(`section`,{children:[(0,X.jsx)(`div`,{children:e.header}),e.lines.map((t,n)=>(0,X.jsxs)(`code`,{className:`revert-line revert-${t.kind}`,children:[(0,X.jsx)(`b`,{children:t.marker}),t.text]},`${e.hunkRef}.${n}`))]},e.hunkRef))}),(0,X.jsxs)(`div`,{className:`revert-safety`,children:[(0,X.jsx)(`strong`,{children:D(a,`Phần đã stage được giữ nguyên.`,`Staged content is preserved.`)}),(0,X.jsx)(`span`,{children:D(a,`Không auto-commit. Khả năng khôi phục sau thao tác không được bảo đảm.`,`No auto-commit. Recovery after this action is not guaranteed.`)})]}),(0,X.jsxs)(`div`,{className:`confirm-actions`,children:[(0,X.jsx)(`button`,{type:`button`,disabled:L,onClick:()=>A(null),children:D(a,`Hủy`,`Cancel`)}),(0,X.jsx)(`button`,{className:`danger-action`,type:`button`,disabled:L,onClick:()=>{Vt()},children:L?D(a,`Đang hoàn tác…`,`Reverting…`):D(a,`Xác nhận revert`,`Confirm revert`)})]})]})}),he&&It(le.value)&&(0,X.jsx)(`div`,{className:`dialog-backdrop`,role:`presentation`,children:(0,X.jsxs)(`section`,{className:`confirm-dialog model-summary-dialog`,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`model-summary-dialog-title`,"aria-describedby":`model-summary-dialog-description`,children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:D(a,`Model work có tính phí`,`Token-consuming model work`)}),(0,X.jsx)(`h3`,{id:`model-summary-dialog-title`,children:D(a,`Nhờ Pi viết lại commit summary?`,`Ask Pi to rewrite the commit summary?`)}),(0,X.jsx)(`p`,{id:`model-summary-dialog-description`,children:D(a,`Thao tác này gửi một message vào đúng Pi session hiện tại, bắt đầu một Pi operation và tiêu token theo model/thinking đang chọn. Chỉ staged summary đã rút gọn được gửi; source text không được đính kèm.`,`This sends a message to the exact current Pi session, starts a Pi operation, and consumes tokens using the selected model and thinking level. Only the bounded staged summary is sent; source text is not attached.`)}),(0,X.jsxs)(`div`,{className:`revert-safety`,children:[(0,X.jsx)(`strong`,{children:D(a,`Không tự commit hoặc push.`,`Does not commit or push.`)}),(0,X.jsx)(`span`,{children:D(a,`Kết quả sẽ xuất hiện trong Chat để review và copy.`,`The result will appear in Chat for review and copying.`)})]}),(0,X.jsxs)(`div`,{className:`confirm-actions`,children:[(0,X.jsx)(`button`,{type:`button`,disabled:de,onClick:()=>ge(!1),children:D(a,`Hủy`,`Cancel`)}),(0,X.jsx)(`button`,{type:`button`,disabled:de,onClick:()=>{Gt()},children:de?D(a,`Đang gửi…`,`Sending…`):D(a,`Xác nhận và gửi sang Pi`,`Confirm and send to Pi`)})]})]})})]})}var pu,mu=(e,t)=>{let{ownerState:n}=e;return[t.root,t[`position${G(n.position)}`],n.disablePointerEvents===!0&&t.disablePointerEvents,t[n.variant]]},hu=e=>{let{classes:t,disablePointerEvents:n,hiddenLabel:r,position:i,size:a,variant:o}=e,s={root:[`root`,n&&`disablePointerEvents`,i&&`position${G(i)}`,o,r&&`hiddenLabel`,a&&`size${G(a)}`]};return B(s,ae,t)},gu=W(`div`,{name:`MuiInputAdornment`,slot:`Root`,overridesResolver:mu})(V(({theme:e})=>({display:`flex`,maxHeight:`2em`,alignItems:`center`,whiteSpace:`nowrap`,color:(e.vars||e).palette.action.active,variants:[{props:{variant:`filled`},style:{[`&.${oe.positionStart}&:not(.${oe.hiddenLabel})`]:{marginTop:16}}},{props:{position:`start`},style:{marginRight:8}},{props:{position:`end`},style:{marginLeft:8}},{props:{disablePointerEvents:!0},style:{pointerEvents:`none`}}]}))),_u=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiInputAdornment`}),{children:r,className:i,component:a=`div`,disablePointerEvents:o=!1,disableTypography:s=!1,position:c,variant:l,...u}=n,d=xe()||{},f=l;l&&d.variant,d&&!f&&(f=d.variant);let p={...n,hiddenLabel:d.hiddenLabel,size:d.size,disablePointerEvents:o,position:c,variant:f},m=hu(p);return(0,X.jsx)(ne.Provider,{value:null,children:(0,X.jsx)(gu,{as:a,ownerState:p,className:P(m.root,i),ref:t,...u,children:typeof r==`string`&&!s?(0,X.jsx)(q,{color:`textSecondary`,children:r}):(0,X.jsxs)(Y.Fragment,{children:[c===`start`?pu||=(0,X.jsx)(`span`,{className:`notranslate`,"aria-hidden":!0,children:`​`}):null,r]})})})}),vu=K((0,X.jsx)(`path`,{d:`M15.5 14h-.79l-.28-.27c1.2-1.4 1.82-3.31 1.48-5.34-.47-2.78-2.79-5-5.59-5.34-4.23-.52-7.79 3.04-7.27 7.27.34 2.8 2.56 5.12 5.34 5.59 2.03.34 3.94-.28 5.34-1.48l.27.28v.79l4.25 4.25c.41.41 1.08.41 1.49 0s.41-1.08 0-1.49zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14`}),`SearchRounded`),yu=`modulepreload`,bu=function(e){return`/`+e},xu={},Su=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=bu(t,n),t=s(t),t in xu)return;xu[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:yu,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Cu=(0,Y.lazy)(async()=>({default:(await Su(async()=>{let{MarkdownMessage:e}=await import(`./MarkdownMessage-DtEwqme0.js`);return{MarkdownMessage:e}},__vite__mapDeps([0,1,2,3,4]))).MarkdownMessage})),wu=new Set([`md`,`markdown`]),Tu=new Set([`csv`,`tsv`]);function Eu(e){return e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1024))} KB`}function Du(e,t){return e.source===`project`?D(t,`Project`,`Project`):D(t,`Thư mục đã cấp quyền`,`Granted directory`)}function Ou(e,t){let n=[],r=[],i=``,a=!1,o=0,s=()=>{r.length<40&&r.push(i),i=``},c=()=>{s(),r.some(e=>e.length>0)&&n.push(r),r=[]};for(;o<e.length&&n.length<500;){let n=e[o];if(a){if(n===`"`&&e[o+1]===`"`){i+=`"`,o+=2;continue}if(n===`"`){a=!1,o+=1;continue}i+=n,o+=1;continue}if(n===`"`&&i.length===0){a=!0,o+=1;continue}if(n===t){s(),o+=1;continue}if(n===`
42
+ `||n===`\r`){c(),n===`\r`&&e[o+1]===`
43
+ `&&(o+=1),o+=1;continue}i+=n,o+=1}return n.length<500&&(i.length>0||r.length>0)&&c(),n}function ku({text:e,separator:t}){let n=(0,Y.useMemo)(()=>Ou(e,t),[e,t]);if(n.length===0)return null;let[r,...i]=n,a=Math.min(Math.max(...n.map(e=>e.length)),40);return(0,X.jsx)(Z,{sx:{overflowX:`auto`},children:(0,X.jsxs)(Z,{component:`table`,className:`document-table`,children:[(0,X.jsx)(Z,{component:`thead`,children:(0,X.jsx)(Z,{component:`tr`,children:Array.from({length:a},(e,t)=>(0,X.jsx)(Z,{component:`th`,children:r[t]??``},t))})}),(0,X.jsx)(Z,{component:`tbody`,children:i.map((e,t)=>(0,X.jsx)(Z,{component:`tr`,children:Array.from({length:a},(t,n)=>(0,X.jsx)(Z,{component:`td`,children:e[n]??``},n))},t))})]})})}function Au({document:e,extension:t}){let n=e.text??``;return wu.has(t??``)?(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Z,{component:`pre`,className:`document-plain`,children:n}),children:(0,X.jsx)(Cu,{children:n})}):Tu.has(t??``)?(0,X.jsx)(ku,{text:n,separator:t===`tsv`?` `:`,`}):(0,X.jsx)(Z,{component:`pre`,className:`document-plain`,children:n})}function ju({sessionRef:e=null}){let{locale:t}=C(),[n,r]=(0,Y.useState)({state:`idle`}),[i,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)({state:`idle`}),[c,l]=(0,Y.useState)(``),u=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let t=new AbortController;return r({state:`loading`}),a(null),s({state:`idle`}),gc(e,t.signal).then(e=>r({state:`ready`,value:e})).catch(()=>{t.signal.aborted||r({state:`error`})}),()=>t.abort()},[e]),(0,Y.useEffect)(()=>{if(!i){s({state:`idle`});return}let t=new AbortController;return s({state:`loading`}),_c(e,i,t.signal).then(e=>{s({state:`ready`,value:e}),u.current?.scrollTo({top:0})}).catch(()=>{t.signal.aborted||s({state:`error`})}),()=>t.abort()},[e,i]);let d=n.value,f=c.trim().toLowerCase(),p=(0,Y.useMemo)(()=>(d?.documents??[]).filter(e=>!f||e.relativePath.toLowerCase().includes(f)),[d,f]),m=(0,Y.useMemo)(()=>(d?.roots??[]).map(e=>({root:e,entries:p.filter(t=>t.rootRef===e.rootRef)})).filter(e=>e.entries.length>0),[d,p]),h=p.find(e=>e.documentRef===i)??d?.documents.find(e=>e.documentRef===i);return(0,X.jsxs)(`section`,{className:`document-workspace surface`,"aria-labelledby":`documents-heading`,children:[(0,X.jsxs)(`header`,{className:`document-heading`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:D(t,`Chỉ đọc · không sửa file`,`Read only · never writes`)}),(0,X.jsx)(`h2`,{id:`documents-heading`,children:D(t,`Tài liệu`,`Documents`)})]}),(0,X.jsx)(`span`,{children:d?`${d.documents.length}${d.truncated?`+`:``} ${D(t,`tài liệu`,`documents`)}`:`—`})]}),(0,X.jsxs)(`div`,{className:`document-body`,children:[(0,X.jsxs)(`aside`,{className:`document-list`,"aria-label":D(t,`Danh sách tài liệu`,`Document list`),children:[(0,X.jsx)(le,{size:`small`,fullWidth:!0,value:c,onChange:e=>l(e.target.value),placeholder:D(t,`Lọc theo tên hoặc thư mục…`,`Filter by name or folder…`),slotProps:{htmlInput:{"aria-label":D(t,`Lọc tài liệu`,`Filter documents`)},input:{startAdornment:(0,X.jsx)(_u,{position:`start`,children:(0,X.jsx)(vu,{fontSize:`small`})})}}}),n.state===`loading`&&(0,X.jsx)(`p`,{className:`document-empty`,children:D(t,`Đang quét tài liệu…`,`Scanning for documents…`)}),n.state===`error`&&(0,X.jsx)(`p`,{className:`document-empty`,children:D(t,`Không đọc được danh sách tài liệu.`,`The document list could not be read.`)}),d?.state===`unavailable`&&(0,X.jsx)(`p`,{className:`document-empty`,children:$(d.reasonCode,t)}),n.state===`ready`&&d?.state===`ready`&&m.length===0&&(0,X.jsx)(`p`,{className:`document-empty`,children:f?D(t,`Không có tài liệu nào khớp bộ lọc.`,`No document matches the filter.`):D(t,`Chưa tìm thấy tài liệu nào.`,`No documents were found.`)}),m.map(e=>(0,X.jsxs)(`div`,{className:`document-group`,children:[(0,X.jsxs)(`div`,{className:`document-group-heading`,children:[(0,X.jsx)(`strong`,{children:Du(e.root,t)}),(0,X.jsx)(`span`,{title:e.root.path,children:e.root.path})]}),e.entries.map(e=>(0,X.jsxs)(Ar,{component:`button`,type:`button`,className:`document-row`,selected:e.documentRef===i,onClick:()=>a(e.documentRef),children:[(0,X.jsx)(wo,{fontSize:`small`,"aria-hidden":`true`}),(0,X.jsxs)(`span`,{className:`document-row-copy`,children:[(0,X.jsx)(`strong`,{children:e.name}),(0,X.jsx)(`small`,{children:e.relativePath})]}),(0,X.jsxs)(`span`,{className:`document-row-meta`,children:[e.extension,` · `,Eu(e.sizeBytes)]})]},e.documentRef))]},e.root.rootRef)),d?.truncated&&(0,X.jsx)(`p`,{className:`document-empty`,children:D(t,`Danh sách đã đạt giới hạn; dùng bộ lọc để thu hẹp.`,`The list reached its limit; use the filter to narrow it.`)})]}),(0,X.jsxs)(`div`,{className:`document-viewer`,ref:u,children:[!i&&(0,X.jsxs)(`div`,{className:`document-placeholder`,children:[(0,X.jsx)(wo,{"aria-hidden":`true`}),(0,X.jsx)(q,{variant:`body2`,children:D(t,`Chọn một tài liệu để đọc nội dung tại đây.`,`Pick a document to read it here.`)}),(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,children:D(t,`Hỗ trợ .md .txt .csv .json .yaml .docx .pdf`,`Supports .md .txt .csv .json .yaml .docx .pdf`)})]}),i&&o.state===`loading`&&(0,X.jsx)(`p`,{className:`document-empty`,children:D(t,`Đang mở tài liệu…`,`Opening the document…`)}),i&&o.state===`error`&&(0,X.jsx)(`p`,{className:`document-empty`,children:D(t,`Không mở được tài liệu này.`,`This document could not be opened.`)}),o.state===`ready`&&o.value&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`document-toolbar`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:o.value.name??h?.name??`—`}),(0,X.jsx)(`small`,{children:o.value.relativePath??h?.relativePath??``})]}),(0,X.jsxs)(`div`,{className:`document-badges`,children:[o.value.format&&(0,X.jsx)(rr,{size:`small`,variant:`outlined`,label:o.value.format}),o.value.truncated&&(0,X.jsx)(rr,{size:`small`,color:`warning`,variant:`outlined`,label:D(t,`Đã cắt bớt`,`Truncated`)}),o.value.redacted&&(0,X.jsx)(rr,{size:`small`,color:`warning`,variant:`outlined`,label:D(t,`Đã che dữ liệu nhạy cảm`,`Sensitive data redacted`)})]})]}),o.value.state===`unavailable`?(0,X.jsx)(`p`,{className:`document-empty`,children:$(o.value.reasonCode,t)}):(0,X.jsx)(`article`,{className:`document-content`,children:(0,X.jsx)(Au,{document:o.value,extension:h?.extension})})]})]})]})]})}function Mu(e,t=`vi`){let n=e.state===`running`?`running`:e.state===`failed`?`failed`:`passed`,r=n===`running`?t===`vi`?`đang chạy`:`running`:n===`failed`?t===`vi`?`thất bại`:`failed`:t===`vi`?`hoàn tất`:`completed`,i=e.startedAt??e.finishedAt??``;return{activityRef:`live.${e.toolCallRef}`,kind:[`bash`,`shell`,`exec`].includes(e.toolLabel)?`command`:`tool`,state:n,label:`${e.toolLabel} ${r}`,preview:t===`vi`?`Cập nhật trực tiếp từ Gateway`:`Live update from the Gateway`,toolCallId:e.toolCallRef,toolName:e.toolLabel,commandDigest:null,logRef:null,exitCode:null,exitCodeExact:!1,startedAt:i,finishedAt:n===`running`?null:e.finishedAt??i}}function Nu(e,t=`vi`){let n=e.state===`failed`?t===`vi`?`Lượt chạy gặp lỗi`:`Operation failed`:e.state===`blocked`?t===`vi`?`Lượt chạy bị chặn`:`Operation blocked`:e.state===`aborted`?t===`vi`?`Lượt chạy đã dừng`:`Operation stopped`:t===`vi`?`Chưa xác định kết quả lượt chạy`:`Operation outcome unknown`;return{activityRef:e.activityRef,kind:`system`,state:e.state,label:n,preview:e.reasonCode,toolCallId:null,toolName:null,commandDigest:null,logRef:null,exitCode:null,exitCodeExact:!1,startedAt:e.settledAt,finishedAt:e.settledAt}}function Pu(e,t,n,r=`vi`,i){let a=[...e,...t],o=new Set(a.map(e=>e.activityRef)),s=n.filter(e=>!o.has(e.activityRef)).map(e=>Nu(e,r));if(i===void 0)return{rows:[...e,...s,...t],terminalCount:s.length,runningCount:e.length};let c=i.filter(e=>e.state===`running`).map(e=>Mu(e,r));return{rows:[...c,...s,...t],terminalCount:s.length,runningCount:c.length}}function Fu(e,t=`vi`){return e.state===`passed`&&/ recovered$/i.test(e.label)?t===`vi`?`Đã khôi phục`:`Recovered`:e.state===`passed`&&/ warning$/i.test(e.label)?t===`vi`?`Đã xử lý cảnh báo`:`Handled warning`:e.state===`passed`&&e.exitCodeExact?`Pass · exit ${e.exitCode??0}`:e.state===`failed`&&e.exitCodeExact?`Fail · exit ${e.exitCode??`?`}`:e.state===`blocked`?`Blocked`:e.state===`aborted`?t===`vi`?`Đã dừng`:`Stopped`:e.state===`unknown`?t===`vi`?`Chưa xác định`:`Unknown`:e.state===`failed`?t===`vi`?`Thất bại`:`Failed`:e.state===`running`?t===`vi`?`Đang chạy`:`Running`:e.state.replaceAll(`-`,` `)}function Iu(e,t=`vi`){let n=Date.parse(e.startedAt),r=e.finishedAt?Date.parse(e.finishedAt):Date.now();if(!Number.isFinite(n)||!Number.isFinite(r)||r<n)return t===`vi`?`Thời gian chưa xác định`:`Unknown duration`;let i=Math.round((r-n)/1e3);return i<60?`${i}s`:`${Math.floor(i/60)}m ${i%60}s`}function Lu({activity:e,preview:t,onPreview:n,locale:r}){return(0,X.jsxs)(`article`,{className:`activity-row`,children:[(0,X.jsx)(`span`,{className:`activity-state tone-${Kl(e.state)}`,"aria-label":e.state}),(0,X.jsxs)(`div`,{className:`activity-copy`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:e.label}),(0,X.jsx)(`span`,{children:e.kind})]}),(0,X.jsx)(`p`,{children:e.preview||D(r,`Không có mô tả ngắn`,`No short description`)}),t&&(0,X.jsxs)(`div`,{className:`log-preview ${t.state===`error`?`error-state`:``}`,children:[t.state===`loading`?D(r,`Đang tải log ngắn…`,`Loading log preview…`):t.state===`error`?D(r,`Log preview không còn sẵn sàng.`,`Log preview is no longer available.`):t.value?.preview??`${D(r,`Không có nội dung log`,`No log content`)} · ${t.value?.reasonCode??`unavailable`}`,t.value?.truncated&&(0,X.jsx)(`small`,{children:D(r,`Preview đã được rút gọn`,`Preview truncated`)})]})]}),(0,X.jsxs)(`div`,{className:`activity-result`,children:[(0,X.jsx)(`strong`,{children:Fu(e,r)}),(0,X.jsx)(`span`,{children:Iu(e,r)}),e.logRef&&n&&(0,X.jsx)(`button`,{type:`button`,onClick:n,"aria-expanded":!!t,children:t?D(r,`Ẩn log`,`Hide log`):D(r,`Xem log`,`View log`)})]})]})}function Ru({snapshot:e,sessionRef:t,terminalActivities:n=[],liveActivities:r}){let{locale:i}=C(),[a,o]=(0,Y.useState)({}),s=e?.activity.running??[],c=e?.activity.recent??[],{rows:l,terminalCount:u,runningCount:d}=Pu(s,c,n,i,r),f=e=>{if(a[e.activityRef]){o(t=>({...t,[e.activityRef]:void 0}));return}o(t=>({...t,[e.activityRef]:{state:`loading`}})),(t?Ls(t,e.activityRef):tc(e.activityRef)).then(t=>o(n=>({...n,[e.activityRef]:{state:`ready`,value:t}}))).catch(()=>o(t=>({...t,[e.activityRef]:{state:`error`}})))};return(0,X.jsxs)(`section`,{className:`activity-panel surface`,"aria-labelledby":`activity-title`,children:[(0,X.jsxs)(`header`,{className:`panel-heading`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Activity`}),(0,X.jsx)(`h2`,{id:`activity-title`,children:D(i,`Tool, command và kết quả lượt chạy`,`Tools, commands, and operation outcomes`)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`span`,{className:`running-count`,children:[d,` `,D(i,`đang chạy`,`running`)]}),(0,X.jsxs)(`span`,{children:[c.length+u,` `,D(i,`gần đây`,`recent`)]})]})]}),(0,X.jsxs)(`div`,{className:`activity-list`,children:[l.map(e=>(0,X.jsx)(Lu,{activity:e,preview:a[e.activityRef],onPreview:e.logRef?()=>f(e):void 0,locale:i},e.activityRef)),l.length===0&&(0,X.jsx)(`div`,{className:`activity-empty`,children:D(i,`Chưa có tool, command hoặc kết quả lượt chạy nào trong timeline hiện tại.`,`No tools, commands, or operation outcomes in the current timeline.`)})]}),e?.activity.page.truncated&&(0,X.jsx)(`footer`,{className:`panel-footnote`,children:D(i,`Timeline đã được rút gọn theo giới hạn local.`,`The timeline was truncated to local limits.`)})]})}function zu(e,t=`vi`){return e===null||!Number.isFinite(e)?t===`vi`?`Không có dữ liệu`:`No data`:Math.abs(e)<1e3?String(Math.round(e)):Math.abs(e)<1e6?`${(e/1e3).toFixed(e>=1e4?0:1)}k`:`${(e/1e6).toFixed(1)}m`}function Bu(e,t=`vi`){return e.state!==`known`||e.tokens===null||e.percent===null?t===`vi`?`Context chưa xác định`:`Unknown context`:`${zu(e.tokens,t)} / ${zu(e.contextWindow,t)} · ${e.percent.toFixed(1)}%`}function Vu(e,t=`vi`){return e.state===`known`?`↑ ${zu(e.input,t)} · ↓ ${zu(e.output,t)}`:t===`vi`?`Không có dữ liệu`:`No data`}function Hu(e,t=`vi`){return e?e.state===`passed`?e.exitCodeExact?`Pass · exit ${e.exitCode??0}`:t===`vi`?`Pass · exit chưa xác định`:`Pass · unknown exit`:e.state===`failed`?e.exitCodeExact?`Fail · exit ${e.exitCode??`?`}`:t===`vi`?`Fail · exit chưa xác định`:`Fail · unknown exit`:e.state===`stale`?e.staleFilesKnown?`Stale · ${e.staleByPaths.length} file`:t===`vi`?`Stale · file chưa xác định`:`Stale · unknown files`:e.state.replaceAll(`-`,` `):t===`vi`?`Chưa có verifier gần nhất`:`No recent verifier`}function Uu(e,t=`vi`){return e.task?.blocker??e.task?.reasonCode??e.verification.reasonCode??e.health.issues.find(e=>e.severity===`error`)?.message??(t===`vi`?`Không có blocker được ghi nhận`:`No recorded blocker`)}function Wu({kicker:e,title:t,children:n}){return(0,X.jsxs)(`section`,{className:`evidence-card surface`,children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:e}),(0,X.jsx)(`h3`,{children:t}),n]})}function Gu({snapshot:e}){let{locale:t}=C(),n=e.verification.latest,r=e.usage.context,i=e.continuation,a=e.handoff,o=r.state===`known`&&r.percent!==null?Math.max(0,Math.min(100,r.percent)):0;return(0,X.jsxs)(`section`,{className:`evidence-section`,"aria-labelledby":`evidence-title`,children:[(0,X.jsxs)(`header`,{className:`section-title-row`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Completion evidence`}),(0,X.jsx)(`h2`,{id:`evidence-title`,children:D(t,`Verifier, usage và handoff`,`Verifier, usage, and handoff`)})]}),(0,X.jsx)(`span`,{children:Uu(e,t)})]}),(0,X.jsxs)(`div`,{className:`evidence-grid`,children:[(0,X.jsx)(Wu,{kicker:D(t,`Verifier gần nhất`,`Latest verifier`),title:Hu(n,t),children:n?(0,X.jsxs)(`dl`,{className:`evidence-list`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Command`}),(0,X.jsx)(`dd`,{title:n.command,children:n.command})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Exact`}),(0,X.jsx)(`dd`,{children:n.exact?D(t,`Có`,`Yes`):D(t,`Không`,`No`)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Tree digest`}),(0,X.jsx)(`dd`,{title:n.treeDigest??void 0,children:ql(n.treeDigest)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:D(t,`File làm stale`,`Stale files`)}),(0,X.jsx)(`dd`,{children:n.staleFilesKnown?n.staleByPaths.length:D(t,`Chưa biết`,`Unknown`)})]})]}):(0,X.jsx)(`p`,{className:`card-empty`,children:e.verification.reasonCode?$(e.verification.reasonCode,t):D(t,`Task chưa chạy verifier.`,`The task has not run a verifier.`)})}),(0,X.jsxs)(Wu,{kicker:`Token & context`,title:Bu(r,t),children:[(0,X.jsx)(`div`,{className:`context-meter`,role:`progressbar`,"aria-label":D(t,`Mức sử dụng context`,`Context usage`),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":o,children:(0,X.jsx)(`span`,{style:{width:`${o}%`}})}),(0,X.jsxs)(`dl`,{className:`evidence-list`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:D(t,`Turn gần nhất`,`Latest turn`)}),(0,X.jsx)(`dd`,{children:Vu(e.usage.latestTurn,t)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Task total`}),(0,X.jsx)(`dd`,{children:Vu(e.usage.taskTotal,t)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Session total`}),(0,X.jsx)(`dd`,{children:Vu(e.usage.sessionTotal,t)})]})]})]}),(0,X.jsxs)(Wu,{kicker:`Continuation budget`,title:$(i.state,t),children:[(0,X.jsxs)(`dl`,{className:`budget-grid`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:D(t,`Còn lại`,`Remaining`)}),(0,X.jsx)(`dd`,{children:zu(i.remaining,t)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:D(t,`Đã dùng`,`Used`)}),(0,X.jsx)(`dd`,{children:zu(i.consumed,t)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:D(t,`Tối đa`,`Maximum`)}),(0,X.jsx)(`dd`,{children:zu(i.maximum,t)})]})]}),i.reasonCode&&(0,X.jsx)(`p`,{className:`card-note`,children:$(i.reasonCode,t)})]}),(0,X.jsx)(Wu,{kicker:`Handoff`,title:a?$(a.state,t):D(t,`Chưa có handoff`,`No handoff`),children:a?(0,X.jsxs)(`div`,{className:`handoff-copy`,children:[(0,X.jsx)(`p`,{children:a.summary}),a.blocker&&(0,X.jsxs)(`div`,{className:`handoff-blocker`,children:[(0,X.jsx)(`strong`,{children:`Blocker`}),(0,X.jsx)(`span`,{children:a.blocker})]}),a.nextSafeAction&&(0,X.jsxs)(`div`,{className:`next-action`,children:[(0,X.jsx)(`strong`,{children:D(t,`Bước an toàn tiếp theo`,`Next safe action`)}),(0,X.jsx)(`span`,{children:a.nextSafeAction})]})]}):(0,X.jsx)(`p`,{className:`card-empty`,children:D(t,`Handoff sẽ xuất hiện khi runtime ghi nhận trạng thái chuyển giao.`,`A handoff will appear when the runtime records a transfer state.`)})})]})]})}var Ku=16384;function qu(e,t){let n=new Map;for(let r of[...t,...e])n.has(r.messageRef)||n.set(r.messageRef,r);return[...n.values()].slice(0,200)}function Ju(e){let t=new Map,n=new Map;for(let r of e.slice(-500)){let e=r.kind,i=r.payload??{},a=r.messageRef;if([`agent-operation.settled`,`session.replacement-pending`,`session.replacement-committed`,`session.shutdown`].includes(String(e))){t.clear(),n.clear();continue}if(e===`message.started`&&i.role===`assistant`&&typeof a==`string`)t.set(a,{messageRef:a,text:``,thinking:!1,truncated:!1});else if(e===`message.text-delta`&&typeof a==`string`&&typeof i.delta==`string`){let e=t.get(a);if(!e)continue;let n=`${e.text}${i.delta}`;t.set(a,{...e,text:n.slice(0,Ku),truncated:e.truncated||n.length>Ku})}else if(e===`message.thinking-state`&&typeof a==`string`){let e=t.get(a);if(!e)continue;t.set(a,{...e,thinking:i.state!==`completed`})}else[`message.completed`,`message.failed`].includes(String(e))&&typeof a==`string`&&t.delete(a);[`activity.started`,`activity.progress`,`activity.finished`,`activity.failed`,`activity.blocked`,`activity.aborted`].includes(String(e))&&typeof r.toolCallId==`string`&&typeof i.activityRef==`string`&&typeof i.toolName==`string`&&n.set(r.toolCallId,{toolCallId:r.toolCallId,activityRef:i.activityRef,toolName:i.toolName,state:String(i.state??`unknown`)})}return{assistants:[...t.values()].slice(-2),tools:[...n.values()].slice(-8)}}var Yu=/^(?:\p{White_Space}|\p{Cc}|\p{Default_Ignorable_Code_Point})$/u,Xu=/\u001b(?:\[[0-?]*[ -/]*[@-~]|[@-_])/g;function Zu(e){for(let t of e.replace(Xu,``))if(!Yu.test(t))return!0;return!1}function Qu(e,t,n){if(!n?.complete)return{key:`${e}:${t}:active`,completionKey:null,user:``,assistant:``,operationRef:null,messageRequestId:null,startedAt:null};let r=n.startedAt??null,i=n.messageRequestId??null,a=`${i??`unknown`}:${n.operationRef??`unknown`}:${r??`unknown`}:${n.user}:${n.assistant.length}`;return{key:`${e}:${t}:complete:${a}`,completionKey:a,user:n.user,assistant:n.assistant,operationRef:n.operationRef,messageRequestId:i,startedAt:r}}function $u(e){let t=/^\[Piagent completion gate: (CONTINUING|NOT APPROVED)\][\t ]*/i.exec(e);if(!t)return{text:e,completionGate:null};let n=t[1]?.toUpperCase()===`CONTINUING`?`continuing`:`not-approved`,r=e.indexOf(`
44
+
45
+ `,t[0].length);return{text:r<0?``:e.slice(r+2).trimStart(),completionGate:n}}var ed=new Set([`provider-auth-expired`,`provider-auth-required`,`provider-rate-limited`,`provider-unavailable`,`provider-response-failed`,`assistant-output-incomplete`]);function td(e){let t=e.content.reasonCode;return e.role===`assistant`&&e.toolCalls.length===0&&e.content.state===`unavailable`&&t&&(ed.has(t)||t.startsWith(`company-`))?t:null}function nd(e){let t=$u(e);return t.completionGate===null&&Zu(t.text)?t.text:null}function rd(e,t){let n=e?.trim(),r=t.trim();return!!(n&&r&&(n===r||n.startsWith(`/`)&&n.endsWith(` ${r}`)))}function id(e,t){if(e.agentOperationId&&t.operationRef&&e.agentOperationId!==t.operationRef)return!1;if(e.messageRequestId&&t.messageRequestId)return e.messageRequestId===t.messageRequestId;if(e.agentOperationId&&t.operationRef)return e.agentOperationId===t.operationRef;let n=Date.parse(e.recordedAt),r=Date.parse(t.startedAt??``);return Number.isFinite(n)&&Number.isFinite(r)&&n>=r}function ad(e,t,n){let r=t.trim();if(!r)return-1;for(let t=e.length-1;t>=0;--t){let i=e[t];if(i?.role===`user`&&rd(i.content.text,r)&&id(i,n))return t}return-1}function od(e,t,n){return ad(e,t,n)>=0}function sd(e,t,n,r){let i=ad(e,t,r);if(i<0)return!1;let a=nd(n)?.trim()??``;if(!a)return!0;let o=e[i]?.messageRef??null;for(let t=i+1;t<e.length;t+=1){let n=e[t];if(n?.role===`user`)return!1;if(!(n?.role!==`assistant`&&n?.role!==`custom`||n.toolCalls.length>0)&&!(o&&n.parentMessageRef&&n.parentMessageRef!==o)&&nd(n.content.text??``)?.trim()===a)return!0}return!1}function cd(e,t,n){let r=ad(e,t,n);if(r<0)return!1;let i=e[r]?.messageRef??null;for(let t=r+1;t<e.length;t+=1){let n=e[t];if(n?.role===`user`)return!1;if(!(n?.role!==`assistant`&&n?.role!==`custom`||n.toolCalls.length>0)&&!(i&&n.parentMessageRef&&n.parentMessageRef!==i)&&(nd(n.content.text??``)||td(n)))return!0}return!1}function ld(e){let t=[],n=new Map,r=new Set,i=null,a=!1,o=null;for(let s of e){if(s.role===`user`){n.clear(),r.add(s.messageRef),i=s.messageRef,t.push(s),a=!1,o=null;continue}if(s.role!==`assistant`&&s.role!==`custom`||(s.parentMessageRef?!r.has(s.parentMessageRef):i===null)||s.toolCalls.length>0)continue;if(td(s)){if(a)continue;o?t[t.indexOf(o)]=s:t.push(s),o=s;continue}let e=nd(s.content.text??``);if(!e)continue;a=!0,o&&=(t.splice(t.indexOf(o),1),null);let c=`${s.role}:${e.trim()}`,l=n.get(c);l===void 0?(n.set(c,t.length),t.push(s)):t[l]=s}return t}function ud(e,t,n){return e===`vi`?t:n}var dd={txt:`text/plain`,text:`text/plain`,md:`text/markdown`,markdown:`text/markdown`,csv:`text/csv`,tsv:`text/tab-separated-values`,json:`application/json`,yaml:`application/yaml`,yml:`application/yaml`,pdf:`application/pdf`,docx:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,bmp:`image/bmp`},fd={xls:`sheet`,xlsx:`sheet`,xlsm:`sheet`,numbers:`sheet`,ods:`sheet`,ppt:`slides`,pptx:`slides`,key:`slides`,odp:`slides`,doc:`word`,pages:`word`,odt:`word`,rtf:`word`,...Object.fromEntries(`zip.gz.tgz.bz2.xz.rar.7z.tar.jar.war.exe.dmg.pkg.msi.deb.rpm.apk.ipa.bin.so.dylib.dll.o.a.lib.class.pyc.wasm.node.iso.img.sqlite.sqlite3.db.mdb.mp3.mp4.m4a.m4v.mov.avi.mkv.wav.flac.ogg.webm.aac.woff.woff2.ttf.otf.eot.ico.icns.heic.heif.tif.tiff.psd.ai.sketch.fig.xd.avif.raw.cr2.nef.dng.blend.fbx.glb`.split(`.`).map(e=>[e,`binary`]))};function pd(e){let t=e.lastIndexOf(`.`),n=t>0||t===0&&e.length>1?e.slice(t+1).toLowerCase():``,r=dd[n];if(r)return{mime:r};let i=fd[n];return i?{refused:i}:{mime:`text/plain`}}var md=new Set([`application/pdf`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`]);function hd(e){return e>=1048576?`${(e/1024/1024).toFixed(1)} MiB`:`${(e/1024).toFixed(+(e<10240))} KiB`}function gd(e,t){let n=e.truncated?` · ${ud(t,`đã cắt bớt`,`truncated`)}`:``;return e.kind===`image`?`${ud(t,`Ảnh`,`Image`)} · ${hd(e.sizeBytes)}`:e.kind===`document`?`${ud(t,`Tài liệu`,`Document`)} · ${hd(e.sourceBytes)} → ${hd(e.sizeBytes)} ${ud(t,`văn bản`,`text`)}${n}`:`File · ${hd(e.sizeBytes)}${n}`}function _d(e){return e.has(`text/plain`)?``:[...e,...Object.entries(dd).filter(([,t])=>e.has(t)).map(([e])=>`.${e}`)].join(`,`)}function vd(e){return!!(e&&[...e.types].includes(`Files`))}function yd(e,t){switch(e){case`sheet`:return ud(t,`bảng tính chưa đọc trực tiếp được; hãy xuất sang .csv rồi đính kèm.`,`spreadsheets cannot be read directly; export to .csv and attach that.`);case`slides`:return ud(t,`file trình chiếu chưa đọc trực tiếp được; hãy xuất sang .pdf rồi đính kèm.`,`slide decks cannot be read directly; export to .pdf and attach that.`);case`word`:return ud(t,`định dạng này chưa đọc được; hãy lưu sang .docx, .pdf hoặc .txt.`,`this format cannot be read; save it as .docx, .pdf or .txt.`);default:return ud(t,`file nhị phân không gửi vào chat được; hãy để file trong project để agent tự đọc bằng tool.`,`binary files cannot go into the chat; keep it in the project and the agent can use its tools on it.`)}}async function bd(e){let{snapshot:t,locale:n}=e,r=[...e.existing],i=null,a=Math.max(0,4-r.length);e.files.length>a&&(i=ud(n,`Chỉ nhận tối đa 4 file mỗi tin nhắn; đã bỏ qua ${e.files.length-a} file.`,`At most 4 files per message; ${e.files.length-a} skipped.`));for(let o of[...e.files].slice(0,a)){let a=pd(o.name);if(`refused`in a){i=`${o.name}: ${yd(a.refused,n)}`;continue}let s=a.mime;if(!e.allowed.has(s)){i=`${o.name}: ${s===`application/pdf`?ud(n,`host chưa cài pdftotext (poppler) nên chưa đọc được .pdf.`,`this host has no pdftotext (poppler), so .pdf cannot be read.`):ud(n,`phiên Pi hiện tại không nhận loại file này.`,`the current Pi session does not accept this file type.`)}`;continue}let c=s.startsWith(`image/`)||md.has(s)?Math.min(t.capabilities.limits.maxAttachmentFileBytes,8388608):262144;if(o.size<1||o.size>c||r.reduce((e,t)=>e+t.sourceBytes,0)+o.size>t.capabilities.limits.maxAttachmentTotalBytes){i=`${o.name}: ${md.has(s)?ud(n,`vượt giới hạn gửi trực tiếp ${hd(c)}. Hãy đặt tài liệu lớn trong project rồi mở ở mục Tài liệu; Pi sẽ đọc theo phần thay vì nhét cả file vào chat.`,`exceeds the ${hd(c)} direct-send limit. Put a large document in the project and open Documents; Pi can read it in parts instead of placing the whole file in chat.`):ud(n,`vượt giới hạn đính kèm (tối đa ${hd(c)}).`,`attachment limit exceeded (max ${hd(c)}).`)}`;continue}let l=new Uint8Array(await o.arrayBuffer()),u=``;for(let e=0;e<l.length;e+=32768)u+=String.fromCharCode(...l.subarray(e,e+32768));let d=await e.stage(await kc(t,e.messageRequestId,{displayName:o.name,declaredMimeType:s,dataBase64:btoa(u)}));if(d.resultCode!==`staged`||!(`attachment`in d)||!d.attachment){i=`${o.name}: ${$(d.error?.code??d.resultCode,n)}`;continue}r=[...r,d.attachment]}return{attachments:r,status:i}}async function xd(e){let t=await e.stage(Ac(e.snapshot,e.messageRequestId,e.attachmentRef));return t.messageType===`discard-receipt`&&t.resultCode===`discarded`?{discarded:!0,status:null}:{discarded:!1,status:`${ud(e.locale,`Chưa thể bỏ file`,`Unable to remove file`)} · ${$(t.error?.code??t.resultCode,e.locale)}`}}function Sd({snapshot:e,events:t,refreshSnapshot:n}){let{locale:r}=C(),[i,a]=(0,Y.useState)(),[o,s]=(0,Y.useState)(!0),[c,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(()=>`message-request.${crypto.randomUUID()}`),[S,w]=(0,Y.useState)([]),[T,E]=(0,Y.useState)(!1),[O,k]=(0,Y.useState)(!1),A=(0,Y.useRef)(0),j=(0,Y.useMemo)(()=>Ju(t),[t]),M=[...t].reverse().find(e=>[`message.completed`,`message.failed`,`agent-operation.settled`].includes(String(e.kind)))?.eventCursor??null;(0,Y.useEffect)(()=>{let e=new AbortController;return s(!0),a(void 0),nc(null,50,e.signal).then(e=>a(e)).catch(()=>void 0).finally(()=>s(!1)),()=>e.abort()},[e.identity.sessionRef]),(0,Y.useEffect)(()=>{w([]),x(`message-request.${crypto.randomUUID()}`)},[e.identity.sessionRef]),(0,Y.useEffect)(()=>{let e=e=>{e.dataTransfer&&[...e.dataTransfer.types].includes(`Files`)&&e.preventDefault()};return window.addEventListener(`dragover`,e),window.addEventListener(`drop`,e),()=>{window.removeEventListener(`dragover`,e),window.removeEventListener(`drop`,e)}},[]),(0,Y.useEffect)(()=>{if(!M)return;let e=new AbortController,t=window.setTimeout(()=>{nc(null,50,e.signal).then(e=>a(e)).catch(()=>void 0)},80);return()=>{window.clearTimeout(t),e.abort()}},[M]);let N=async()=>{try{let e=await rc();return h(e),e}catch{return}};(0,Y.useEffect)(()=>{let e=new AbortController;return rc(e.signal).then(h).catch(()=>void 0),()=>e.abort()},[e.identity.sessionRef,e.revision.queueRevision]);let P=async()=>{let e=i?.page.nextBeforeCursor;if(e)try{let t=await nc(e,i.page.limit);a(e=>e?{...e,items:qu(e.items,t.items),page:t.page}:t)}catch{}},F=(0,Y.useMemo)(()=>i?.state===`ready`?ld(i.items):[],[i]),I=e.capabilities.capabilities[`control.chat`],ee=I.status===`available`?I.actions:null,te=!!ee?.send.available,L=e.capabilities.capabilities[`control.resumeAndContinue`].status===`available`,ne=te||L,R=e.capabilities.capabilities.attachments,z=R.status===`available`,re=(0,Y.useMemo)(()=>new Set(R.status===`available`?R.mimeTypes:[]),[R]),ie=(0,Y.useMemo)(()=>_d(re),[re]),ae=z&&!u&&!T&&S.length<4,oe=e.session.operation.liveness===`running`,se=async()=>{await n?.(),await N()},ce=async t=>{let n=c.trim();if(!(!n||u||(t===`resume-and-continue`?!L:!te))){d(!0),p(null);try{let i=S.length?{messageRequestId:b,attachmentRefs:S.map(e=>e.attachmentRef)}:void 0,a=t===`resume-and-continue`?await uc(await Fc(e,n,i)):await sc(await Oc(e,n,t,i));[`dispatch-observed`,`dispatch-requested`].includes(a.resultCode)?(l(``),w([]),x(`message-request.${crypto.randomUUID()}`),p(a.resultCode===`dispatch-observed`?D(r,`Đã gửi vào Pi session`,`Sent to the Pi session`):D(r,`Pi đã nhận yêu cầu`,`Pi received the request`))):a.resultCode===`held`?(l(``),p(D(r,`Đã giữ trong hàng đợi`,`Held in the queue`))):a.resultCode===`resumed-not-dispatched`?p(D(r,`Task đã mở lại nhưng tin nhắn chưa được gửi; nội dung vẫn được giữ để kiểm tra lại.`,`The task resumed but the message was not sent; the content remains for review.`)):p(`${D(r,`Chưa gửi`,`Not sent`)} · ${$(a.resultCode,r)}`),await se()}catch{p(D(r,`Không thể gửi; trạng thái Pi có thể đã thay đổi.`,`Unable to send; Pi state may have changed.`))}finally{d(!1)}}},le=async t=>{if(!(!t?.length||!z||T)){E(!0),p(null);try{let n=await bd({files:t,snapshot:e,messageRequestId:b,existing:S,allowed:re,locale:r,stage:vc});w(n.attachments),p(n.status)}catch{p(D(r,`Không thể đính kèm; file không được gửi vào Pi.`,`Unable to attach the file; it was not sent to Pi.`))}finally{E(!1)}}},ue=()=>{A.current=0,k(!1)},de=e=>{vd(e.dataTransfer)&&(e.preventDefault(),ue(),ae&&le(e.dataTransfer.files))},fe=async t=>{if(!(u||T)){E(!0),p(null);try{let n=await xd({snapshot:e,messageRequestId:b,attachmentRef:t,locale:r,stage:vc});n.discarded?w(e=>e.filter(e=>e.attachmentRef!==t)):p(n.status)}catch{p(D(r,`Không thể bỏ file; trạng thái Pi có thể đã thay đổi.`,`Unable to remove the file; Pi state may have changed.`))}finally{E(!1)}}},pe=async(t,n,i)=>{if(!u){d(!0),p(null);try{let a=await sc(await jc(e,t,t===`queue.update`?await Mc(n,i?.trim()??``):t===`queue.delete`?{queueItemRef:n}:{queueItemRef:n,messageRequestId:`message-request.${crypto.randomUUID()}`}));[`updated`,`deleted`,`dispatch-observed`,`dispatch-requested`].includes(a.resultCode)?(_(null),y(``),p($(a.resultCode,r))):p(`${D(r,`Chưa thay đổi`,`Not changed`)} · ${$(a.resultCode,r)}`),await se()}catch{p(D(r,`Hàng đợi đã thay đổi; đã tải lại trạng thái mới nhất.`,`The queue changed; the latest state has been reloaded.`)),await se()}finally{d(!1)}}};return(0,X.jsxs)(`section`,{className:`chat-panel surface`,"aria-labelledby":`chat-heading`,"data-dragging":O||void 0,onDragEnter:e=>{vd(e.dataTransfer)&&(A.current+=1,k(!0))},onDragOver:e=>{vd(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect=ae?`copy`:`none`)},onDragLeave:e=>{vd(e.dataTransfer)&&(--A.current,A.current<=0&&ue())},onDrop:de,children:[O&&(0,X.jsxs)(`div`,{className:`chat-drop-overlay`,role:`status`,children:[(0,X.jsx)(`strong`,{children:ae?D(r,`Thả tài liệu vào đây`,`Drop documents here`):S.length>=4?D(r,`Đã đủ 4 file cho tin nhắn này`,`This message already holds 4 files`):D(r,`Chưa nhận file lúc này`,`Files cannot be attached right now`)}),ae&&(0,X.jsx)(`small`,{children:D(r,`.md .txt .csv .json .yaml .docx .pdf và ảnh`,`.md .txt .csv .json .yaml .docx .pdf and images`)})]}),(0,X.jsxs)(`header`,{className:`chat-heading`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:D(r,`Đúng Pi session hiện tại`,`Exact current Pi session`)}),(0,X.jsx)(`h2`,{id:`chat-heading`,children:`Chat`})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`span`,{children:[F.length,` `,D(r,`message gần nhất`,`recent messages`)]}),(0,X.jsx)(`span`,{className:`chat-read-state`,children:D(r,`Streaming trực tiếp`,`Live streaming`)})]})]}),(0,X.jsxs)(`div`,{className:`chat-body`,"aria-live":`polite`,children:[i?.page.hasOlder&&(0,X.jsx)(`button`,{type:`button`,className:`load-older`,onClick:()=>void P(),children:D(r,`Tải message cũ hơn`,`Load older messages`)}),o&&(0,X.jsx)(`p`,{className:`chat-empty`,children:D(r,`Đang tải transcript hiện tại…`,`Loading the current transcript…`)}),!o&&i?.state===`unavailable`&&(0,X.jsxs)(`p`,{className:`chat-empty`,children:[D(r,`Transcript cần đồng bộ lại`,`Transcript needs resync`),` · `,$(i.reasonCode,r)]}),!o&&i?.state===`ready`&&F.length===0&&j.assistants.length===0&&(0,X.jsx)(`p`,{className:`chat-empty`,children:D(r,`Chưa có message trong Pi session này.`,`There are no messages in this Pi session.`)}),F.map(e=>e.role===`tool-result`?(0,X.jsxs)(`article`,{className:`chat-tool-result`,children:[(0,X.jsx)(`strong`,{children:e.toolCalls[0]?.toolName??`Tool`}),(0,X.jsx)(`span`,{children:D(r,`Kết quả chi tiết nằm trong Activity`,`Detailed output is available in Activity`)})]},e.messageRef):(0,X.jsxs)(`article`,{className:`chat-message chat-${e.role}`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:e.role===`user`?D(r,`Anh`,`You`):e.role===`custom`?D(r,`Biên nhận Piagent`,`Piagent receipt`):`Pi`}),(0,X.jsx)(`time`,{children:new Date(e.recordedAt).toLocaleTimeString(r===`vi`?`vi-VN`:`en-US`,{hour:`2-digit`,minute:`2-digit`})})]}),(0,X.jsx)(`p`,{children:e.content.text||(e.content.imageCount?`${e.content.imageCount} ${D(r,`ảnh đính kèm`,`attached images`)}`:D(r,`Message trống`,`Empty message`))}),(e.content.redacted||e.content.truncated)&&(0,X.jsx)(`small`,{children:e.content.redacted?D(r,`Đã che dữ liệu nhạy cảm`,`Sensitive data redacted`):D(r,`Nội dung đã rút gọn`,`Content truncated`)})]},e.messageRef)),j.assistants.map(e=>(0,X.jsxs)(`article`,{className:`chat-message chat-assistant chat-streaming`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:`Pi`}),(0,X.jsx)(`span`,{className:`stream-indicator`,children:D(r,`Đang trả lời`,`Responding`)})]}),(0,X.jsx)(`p`,{children:e.text||(e.thinking?D(r,`Đang suy nghĩ…`,`Thinking…`):D(r,`Đang chuẩn bị câu trả lời…`,`Preparing a response…`))}),e.truncated&&(0,X.jsx)(`small`,{children:D(r,`Live preview đã đạt giới hạn`,`Live preview limit reached`)})]},e.messageRef)),j.tools.filter(e=>[`started`,`progress`].includes(e.state)).map(e=>(0,X.jsxs)(`article`,{className:`chat-tool-live`,children:[(0,X.jsx)(`span`,{className:`tool-spinner`,"aria-hidden":`true`}),(0,X.jsx)(`strong`,{children:e.toolName}),(0,X.jsx)(`span`,{children:$(e.state,r)})]},e.toolCallId))]}),m?.state===`ready`&&m.items.length>0&&(0,X.jsxs)(`section`,{className:`held-queue`,"aria-label":D(r,`Tin nhắn đang giữ`,`Held messages`),children:[(0,X.jsxs)(`div`,{className:`held-queue-heading`,children:[(0,X.jsx)(`strong`,{children:D(r,`Đang giữ ${m.heldCount} tin`,`${m.heldCount} held messages`)}),m.quarantinedCount>0&&(0,X.jsxs)(`span`,{children:[m.quarantinedCount,` `,D(r,`tin cần kiểm tra`,`need review`)]})]}),(0,X.jsx)(`ol`,{children:m.items.map(e=>(0,X.jsxs)(`li`,{"data-state":e.state,children:[g===e.queueItemRef?(0,X.jsx)(`textarea`,{"aria-label":D(r,`Sửa tin nhắn đang giữ`,`Edit held message`),rows:2,maxLength:65536,value:v,onChange:e=>y(e.target.value)}):(0,X.jsx)(`p`,{children:e.preview}),(0,X.jsx)(`div`,{children:g===e.queueItemRef?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{type:`button`,disabled:u||!v.trim(),onClick:()=>void pe(`queue.update`,e.queueItemRef,v),children:D(r,`Lưu`,`Save`)}),(0,X.jsx)(`button`,{type:`button`,disabled:u,onClick:()=>{_(null),y(``)},children:D(r,`Hủy`,`Cancel`)})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{type:`button`,disabled:u||e.state!==`held`||!ee?.dispatchHeld.available,onClick:()=>void pe(`queue.dispatch`,e.queueItemRef),children:D(r,`Gửi`,`Send`)}),(0,X.jsx)(`button`,{type:`button`,disabled:u||e.state!==`held`||e.redacted||e.truncated||!ee?.editHeld.available,title:e.redacted||e.truncated?D(r,`Không sửa từ preview đã che hoặc rút gọn`,`Redacted or truncated previews cannot be edited`):void 0,onClick:()=>{_(e.queueItemRef),y(e.preview)},children:D(r,`Sửa`,`Edit`)}),(0,X.jsx)(`button`,{type:`button`,disabled:u||!ee?.deleteHeld.available,onClick:()=>void pe(`queue.delete`,e.queueItemRef),children:D(r,`Xóa`,`Delete`)})]})}),(e.redacted||e.truncated||e.state===`quarantined`)&&(0,X.jsx)(`small`,{children:e.state===`quarantined`?D(r,`Lần gửi trước chưa xác định; không tự gửi lại`,`The previous dispatch is uncertain; it will not be resent automatically`):e.redacted?D(r,`Preview đã che dữ liệu nhạy cảm`,`Sensitive data is redacted in the preview`):D(r,`Preview đã rút gọn`,`Preview truncated`)})]},e.queueItemRef))})]}),(0,X.jsxs)(`footer`,{className:`chat-composer-preview`,children:[S.length>0&&(0,X.jsx)(`ul`,{className:`attachment-list`,"aria-label":D(r,`File sẽ gửi cùng message`,`Files to send with the message`),children:S.map(e=>(0,X.jsxs)(`li`,{"data-kind":e.kind,children:[(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`strong`,{children:e.displayName}),(0,X.jsx)(`small`,{children:gd(e,r)})]}),(0,X.jsx)(`button`,{type:`button`,disabled:u||T,"aria-label":`${D(r,`Bỏ`,`Remove`)} ${e.displayName}`,onClick:()=>void fe(e.attachmentRef),children:D(r,`Bỏ`,`Remove`)})]},e.attachmentRef))}),(0,X.jsx)(`textarea`,{"aria-label":D(r,`Nội dung chat`,`Chat message`),placeholder:L?D(r,`Nhập việc cần Pi làm ngay sau khi mở lại task…`,`Enter work for Pi immediately after the task resumes…`):te?D(r,`Nhắn vào đúng Pi session này…`,`Message this exact Pi session…`):D(r,`Chat control chưa khả dụng.`,`Chat control is unavailable.`),disabled:!ne||u,maxLength:65536,rows:2,value:c,onChange:e=>l(e.target.value),onPaste:e=>{e.clipboardData?.files.length&&(e.preventDefault(),ae&&le(e.clipboardData.files))}}),(0,X.jsxs)(`div`,{className:`composer-actions`,children:[(0,X.jsx)(`button`,{type:`button`,disabled:!ne||u||!c.trim(),onClick:()=>void ce(L?`resume-and-continue`:oe?`follow-up`:`new-operation`),children:u?D(r,`Đang gửi…`,`Sending…`):L?D(r,`Tiếp tục & gửi`,`Resume & send`):oe?D(r,`Gửi sau`,`Send next`):D(r,`Gửi`,`Send`)}),(0,X.jsx)(`button`,{type:`button`,disabled:!te||u||!c.trim()||S.length>0||!ee?.hold.available,title:S.length?D(r,`Bản này chưa giữ file trong hàng đợi`,`This version does not hold attachments in the queue`):void 0,onClick:()=>void ce(`hold`),children:D(r,`Giữ lại`,`Hold`)}),oe&&(0,X.jsx)(`button`,{type:`button`,className:`interrupt-send`,disabled:!te||u||!c.trim()||!ee?.interruptAndSend.available,onClick:()=>void ce(`steer`),children:D(r,`Ngắt & gửi`,`Interrupt & send`)})]}),(0,X.jsxs)(`label`,{className:`attachment-picker ${ae?``:`disabled`}`,title:D(r,`Chọn file, hoặc kéo thả / dán thẳng vào khung chat`,`Pick a file, or drag and drop / paste straight into the chat`),children:[(0,X.jsx)(`input`,{type:`file`,multiple:!0,disabled:!ae,accept:ie||void 0,onChange:e=>{le(e.target.files),e.currentTarget.value=``}}),T?D(r,`Đang đọc tài liệu…`,`Reading documents…`):`${D(r,`Đính kèm hoặc kéo thả`,`Attach or drop`)} (${S.length}/4)`]}),f&&(0,X.jsx)(`small`,{role:`status`,children:f})]})]})}function Cd({snapshot:e,refreshSnapshot:t}){let{locale:n}=C(),[r,i]=(0,Y.useState)(),[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(null),h=(0,Y.useRef)(0),g=(0,Y.useRef)({revision:0,modelDirty:!1,thinkingDirty:!1}),_=e.capabilities.capabilities[`control.sessionOptions`],v=_.status===`available`?_.actions:null,y=async e=>{let t=++h.current,n=g.current.revision;try{let r=await ic(e);return t===h.current?(i(r),r.state===`ready`&&n===g.current.revision&&(g.current.modelDirty||o(r.activeModelRef??``),g.current.thinkingDirty||c(r.activeThinkingLevel??`off`)),r):r}catch{!e?.aborted&&t===h.current&&i(void 0);return}};(0,Y.useEffect)(()=>{let e=new AbortController;return y(e.signal),()=>e.abort()},[e.identity.sessionRef,e.revision.sessionOptionRevision]);let b=(0,Y.useMemo)(()=>r?.models.find(e=>e.modelRef===r.activeModelRef),[r]),x=async i=>{if(!l||d||!r||r.state!==`ready`)return;let o=i===`model`?`session-options.set-model`:`session-options.set-thinking`,c=i===`model`?a:s;f(i),m(null);try{let r=await cc(await Nc(e,o,c));m(r.resultCode===`changed`?D(n,`Đã cập nhật trong Pi và mặc định người dùng`,`Updated in Pi and user defaults`):r.resultCode===`unchanged`?D(n,`Giá trị này đang được dùng`,`This value is already active`):r.resultCode===`effect-unknown`?D(n,`Pi chưa xác nhận được hậu trạng thái; hãy tải lại trước khi thử tiếp`,`Pi could not confirm the resulting state; refresh before trying again`):`${D(n,`Chưa thay đổi`,`Not changed`)} · ${$(r.resultCode,n)}`),u(!1),g.current.revision+=1,i===`model`?g.current.modelDirty=!1:g.current.thinkingDirty=!1,await t?.(),await y()}catch{m(D(n,`Không thể đổi; trạng thái Pi có thể đã thay đổi.`,`Unable to change the setting; Pi state may have changed.`))}finally{f(null)}};return(0,X.jsxs)(`section`,{className:`session-options surface`,"aria-labelledby":`session-options-title`,children:[(0,X.jsxs)(`div`,{className:`session-options-copy`,children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Model & thinking`}),(0,X.jsx)(`h2`,{id:`session-options-title`,children:D(n,`Thiết lập cho Pi session`,`Pi session settings`)}),(0,X.jsx)(`p`,{children:D(n,`Chỉ thay đổi khi Pi đang chờ. Thao tác này không gọi model, nhưng Pi cũng cập nhật mặc định người dùng.`,`Settings can only change while Pi is idle. This does not call the model, but Pi also updates user defaults.`)})]}),r?.state===`ready`?(0,X.jsxs)(`div`,{className:`session-options-controls`,children:[(0,X.jsxs)(`label`,{children:[(0,X.jsx)(`span`,{children:`Model`}),(0,X.jsx)(`select`,{"aria-label":D(n,`Chọn model`,`Select model`),value:a,disabled:d!==null||!v?.setModel.available,onChange:e=>{g.current.revision+=1,g.current.modelDirty=!0,o(e.target.value),u(!1),m(null)},children:r.models.map(e=>(0,X.jsxs)(`option`,{value:e.modelRef,children:[e.displayName,` · `,e.provider]},e.modelRef))})]}),(0,X.jsxs)(`label`,{children:[(0,X.jsx)(`span`,{children:`Thinking`}),(0,X.jsx)(`select`,{"aria-label":D(n,`Chọn thinking`,`Select thinking`),value:s,disabled:d!==null||!v?.setThinking.available,onChange:e=>{g.current.revision+=1,g.current.thinkingDirty=!0,c(e.target.value),u(!1),m(null)},children:(b?.supportedThinkingLevels??[]).map(e=>(0,X.jsx)(`option`,{value:e,children:$(e,n)},e))})]}),(0,X.jsxs)(`label`,{className:`effect-ack`,children:[(0,X.jsx)(`input`,{type:`checkbox`,checked:l,disabled:d!==null||!v,onChange:e=>u(e.target.checked)}),(0,X.jsx)(`span`,{children:D(n,`Tôi hiểu thay đổi này áp dụng cho session và mặc định người dùng.`,`I understand this applies to the session and user defaults.`)})]}),(0,X.jsxs)(`div`,{className:`session-option-actions`,children:[(0,X.jsx)(`button`,{type:`button`,disabled:!l||d!==null||!v?.setModel.available||a===r.activeModelRef,onClick:()=>void x(`model`),children:d===`model`?D(n,`Đang đổi…`,`Changing…`):D(n,`Đổi model`,`Change model`)}),(0,X.jsx)(`button`,{type:`button`,disabled:!l||d!==null||!v?.setThinking.available||s===r.activeThinkingLevel,onClick:()=>void x(`thinking`),children:d===`thinking`?D(n,`Đang đổi…`,`Changing…`):D(n,`Đổi thinking`,`Change thinking`)})]}),p&&(0,X.jsx)(`small`,{role:`status`,children:p}),!v?.setModel.available&&(0,X.jsxs)(`small`,{children:[D(n,`Đang khóa thay đổi`,`Changes locked`),` · `,$(v?.setModel.reasonCode??(_.status===`unavailable`?_.reason?.code:`unavailable`),n)]})]}):(0,X.jsxs)(`div`,{className:`session-options-unavailable`,children:[(0,X.jsx)(`strong`,{children:D(n,`Catalog model chưa sẵn sàng`,`Model catalog unavailable`)}),(0,X.jsx)(`span`,{children:$(r?.reasonCode??`authenticated-model-catalog-unavailable`,n)})]})]})}var wd=(e,t,n)=>e===`vi`?t:n,Td={"workspace-patch":[`Sửa trong project`,`Change in the project`],"external-provider-action":[`Tác động ra bên ngoài`,`Reaches outside this machine`]},Ed={"one-shell-command":[`Đúng một lệnh`,`This one command`],"network-command-once":[`Đúng một lệnh, có mạng`,`This one command, with network`],"docker-command-once":[`Đúng một lệnh, có mạng và Docker`,`This one command, with network and Docker`],"host-command-once":[`Đúng một lệnh, chạy trên máy bạn (ngoài sandbox)`,`This one command, on your machine (outside the sandbox)`],"start-docker-once":[`Mở Docker trên máy`,`Start Docker on this machine`],"one-external-action":[`Đúng một hành động`,`This one action`]},Dd={"Run this exact command once, after the guard checks the working tree again.":[`Chạy đúng lệnh này một lần, sau khi guard kiểm tra lại thư mục làm việc.`,``],"The command does not run; the agent is told you declined.":[`Lệnh không chạy; agent được báo là bạn đã từ chối.`,``],"Run this exact action once, after the guard checks its authority again.":[`Thực hiện đúng hành động này một lần, sau khi guard kiểm tra lại quyền.`,``],"The action does not run; nothing outside changes.":[`Hành động không chạy; không có gì bên ngoài bị thay đổi.`,``],"Run this exact command once, with internet access.":[`Chạy đúng lệnh này một lần, có mạng.`,``],"Run this exact command once, with internet access; a server it starts accepts connections while it runs.":[`Chạy đúng lệnh này một lần, có mạng; server mà lệnh mở nhận kết nối trong lúc chạy.`,``],"Run this exact command once, with internet access and the Docker engine; a container it starts can read folders Docker shares from this machine and may keep running.":[`Chạy đúng lệnh này một lần, có mạng và Docker; container mà lệnh tạo đọc được các thư mục Docker chia sẻ trên máy và có thể tiếp tục chạy.`,``],"Run this exact command once on this machine, outside the sandbox, as you: it can read and change your files and use your sign-ins.":[`Chạy đúng lệnh này một lần trên máy bạn, ngoài sandbox, bằng quyền của bạn: lệnh đọc/sửa được file và dùng được tài khoản đã đăng nhập trên máy.`,``],"Docker is not started; the agent is told you declined.":[`Không mở Docker; agent được báo là bạn đã từ chối.`,``]},Od=(e,t,n)=>{let r=e[t];return r?wd(n,r[0],r[1]||t):null};function kd(e,t){return t===`vi`?e.split(`; `).map(e=>{let t=e.match(/^Confirmation required: the command runs (.+)$/);if(t)return`Lệnh có ${t[1]} nên cần bạn duyệt trước khi chạy.`;let n=e.match(/^External provider action (.+) requires confirmation$/);return n?`Hành động ra bên ngoài (${n[1]}) cần bạn duyệt.`:e}).join(` `):e}var Ad=(e,t)=>Od(Td,e.kind,t)??$(e.kind,t),jd=(e,t)=>Od(Ed,e.requestedScope,t)??$(e.requestedScope,t);function Md(e,t){let n=t===`vi`?/^Start (.+) on this machine; it keeps running after the conversation\.$/.exec(e):null;return n?`Mở ${n[1]} trên máy; nó vẫn chạy sau cuộc trò chuyện.`:Od(Dd,e,t)??e}function Nd(e,t){return{schemaVersion:1,version:`piagent-webui-approval-v1`,recordType:`decision`,approvalRef:e.approvalRef,decisionId:`decision.${crypto.randomUUID()}`,decisionToken:e.decisionToken,identity:structuredClone(e.identity),actionDigest:e.action.actionDigest,expectedRevisions:structuredClone(e.expectedRevisions),decision:t,reason:null,decidedAt:new Date().toISOString(),expiresAt:e.expiresAt,decisionSurface:`webui`,executor:`pi-guard`,directExecution:!1}}function Pd({state:e,setState:t,refreshSnapshot:n,locale:r,asker:i}){let a=e.request;if(!a)return(0,X.jsx)(`article`,{className:`approval-card`,children:(0,X.jsx)(`p`,{children:e.error??D(r,`Đang tải yêu cầu phê duyệt…`,`Loading approval request…`)})});let o=a.action,s=Math.max(0,Math.ceil((Date.parse(a.expiresAt)-Date.now())/1e3)),c=async e=>{t({request:a,deciding:e});try{await oc(Nd(a,e)),await n?.()}catch{t({request:a,error:D(r,`Yêu cầu đã hết hạn, thay đổi hoặc được trả lời ở terminal. Hãy tải trạng thái mới.`,`The request expired, changed, or was answered in the terminal. Refresh status.`)})}};return(0,X.jsxs)(`article`,{className:`approval-card risk-${o.riskClass}`,"aria-labelledby":`approval-${a.approvalRef}`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:i?D(r,`${i} cần bạn duyệt`,`${i} needs your approval`):D(r,`Cần phê duyệt`,`Approval required`)}),(0,X.jsx)(`h2`,{id:`approval-${a.approvalRef}`,children:o.toolName})]}),(0,X.jsx)(`span`,{className:`approval-risk`,children:$(o.riskClass,r)})]}),(0,X.jsx)(`p`,{className:`approval-reason`,children:kd(o.reason,r)}),o.commandPreview&&(0,X.jsx)(`pre`,{className:`approval-preview`,children:(0,X.jsx)(`code`,{children:o.commandPreview})}),!o.commandPreview&&o.parameterPreview&&o.parameterPreview!==`No additional parameters`&&(0,X.jsx)(`p`,{className:`approval-preview`,children:o.parameterPreview}),(0,X.jsxs)(`dl`,{className:`approval-facts`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:D(r,`Hành động`,`Action`)}),(0,X.jsx)(`dd`,{children:Ad(o,r)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:D(r,`Phạm vi`,`Scope`)}),(0,X.jsx)(`dd`,{children:jd(o,r)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:D(r,`Thư mục`,`Directory`)}),(0,X.jsx)(`dd`,{children:o.cwdDisplay??D(r,`Đã ẩn`,`Hidden`)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:D(r,`Hết hạn`,`Expires`)}),(0,X.jsxs)(`dd`,{children:[s,`s`]})]})]}),o.targetPaths.length>0&&(0,X.jsxs)(`div`,{className:`approval-targets`,children:[(0,X.jsx)(`strong`,{children:D(r,`Đích tác động`,`Targets`)}),(0,X.jsx)(`ul`,{children:o.targetPaths.map(e=>(0,X.jsx)(`li`,{children:e===`.`?D(r,`Cả thư mục project`,`The whole project folder`):e},e))})]}),(0,X.jsxs)(`div`,{className:`approval-consequences`,children:[(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`strong`,{children:D(r,`Nếu cho phép:`,`If allowed:`)}),` `,Md(o.consequences.allow,r)]}),(0,X.jsxs)(`p`,{children:[(0,X.jsx)(`strong`,{children:D(r,`Nếu từ chối:`,`If denied:`)}),` `,Md(o.consequences.deny,r)]})]}),e.error&&(0,X.jsx)(`p`,{className:`form-error`,role:`alert`,children:e.error}),(0,X.jsxs)(`footer`,{children:[(0,X.jsx)(`button`,{type:`button`,className:`secondary-action`,disabled:!!e.deciding,onClick:()=>void c(`deny`),children:D(r,`Từ chối`,`Deny`)}),(0,X.jsx)(`button`,{type:`button`,className:`danger-action`,disabled:!!e.deciding,onClick:()=>void c(`allow`),children:e.deciding===`allow`?D(r,`Đang kiểm tra lại…`,`Rechecking…`):D(r,`Cho phép đúng 1 lần`,`Allow once`)})]})]})}function Fd(e,t,n){let r=(0,Y.useMemo)(()=>e,[e.join(`\0`)]),[i,a]=(0,Y.useState)({});return(0,Y.useEffect)(()=>{let e=new AbortController;for(let i of r)(t?As(t,i,e.signal):ac(i,e.signal)).then(e=>a(t=>({...t,[i]:{request:e}})),()=>a(e=>({...e,[i]:{error:D(n,`Không thể tải yêu cầu phê duyệt hiện tại.`,`Unable to load the current approval request.`)}})));return()=>e.abort()},[n,t,r]),{refs:r,states:i,set:(e,t)=>a(n=>({...n,[e]:t}))}}function Id({approvalRefs:e,sessionRef:t,refreshSnapshot:n}){let{locale:r}=C(),{refs:i,states:a,set:o}=Fd(e,t,r);return i.length===0?null:(0,X.jsx)(`section`,{className:`approval-stack`,"aria-label":D(r,`Yêu cầu phê duyệt đang chờ`,`Pending approval requests`),"aria-live":`polite`,children:i.map(e=>(0,X.jsx)(Pd,{state:a[e]??{},setState:t=>o(e,t),refreshSnapshot:n,locale:r},e))})}function Ld({snapshot:e,refreshSnapshot:t}){let n=(0,Y.useMemo)(()=>e.approvals.pending.map(e=>e.approvalRef),[e.approvals.pending]);return(0,X.jsx)(Id,{approvalRefs:n,refreshSnapshot:t})}var Rd={stopped:`Đã dừng lượt Pi hiện tại; task vẫn được giữ lại.`,"emergency-stop":`Đã dừng lượt Pi hiện tại.`,"stop-requested":`Đang chờ Pi xác nhận lượt hiện tại đã dừng.`,"already-idle":`Pi đang chờ, không có lượt nào cần dừng.`,"pause-requested":`Đang chờ tool hiện tại kết thúc tại điểm an toàn.`,paused:`Task đã tạm dừng an toàn.`,"already-pausing":`Task đang chờ điểm tạm dừng an toàn.`,"already-paused":`Task đang được tạm dừng.`,resumed:`Task đã hoạt động lại; chưa gửi thêm tin nhắn cho model.`,"pause-cancelled":`Đã hủy yêu cầu tạm dừng; chưa gọi model.`,"already-active":`Task đang hoạt động.`,"resume-rejected":`Chưa thể tiếp tục vì bằng chứng khôi phục chưa đủ an toàn.`,"settlement-unknown":`Chưa xác nhận được Pi đã dừng. Hãy xem trạng thái mới trước khi thử lại.`,"pause-unconfirmed":`Chưa đủ bằng chứng để xác nhận task đã tạm dừng.`},zd={stopped:`Stopped the current Pi turn; the task remains intact.`,"emergency-stop":`Stopped the current Pi turn.`,"stop-requested":`Waiting for Pi to confirm the current turn has stopped.`,"already-idle":`Pi is idle; there is no turn to stop.`,"pause-requested":`Waiting for the current tool to finish at a safe point.`,paused:`The task is safely paused.`,"already-pausing":`The task is waiting for a safe pause point.`,"already-paused":`The task is paused.`,resumed:`The task is active again; no model message was sent.`,"pause-cancelled":`Cancelled the pause request; no model call was made.`,"already-active":`The task is active.`,"resume-rejected":`Resume is blocked because recovery evidence is not yet safe.`,"settlement-unknown":`Pi stop is unconfirmed. Refresh status before trying again.`,"pause-unconfirmed":`There is not enough evidence to confirm the task is paused.`};function Bd(e,t){return(t===`vi`?Rd:zd)[e.resultCode]??(e.error?.message||`${D(t,`Chưa thực hiện`,`Not executed`)} · ${$(e.resultCode,t)}`)}function Vd({snapshot:e,refreshSnapshot:t}){let{locale:n}=C(),r=e.capabilities.capabilities[`control.lifecycle`],[i,a]=(0,Y.useState)(null),[o,s]=(0,Y.useState)(null),c=r.status===`available`,l=c?r.currentPhase:`unknown`,u=c?r.stopPhaseSupport[l]:null,d=!!(u?.stop===`supported`&&e.identity.agentOperationId),f=!!(c&&r.actions.pause.available),p=!!(c&&r.actions.resume.available);(0,Y.useEffect)(()=>{o?.resultCode===`pause-requested`&&e.session.controlState===`paused`&&s({action:`lifecycle.pause`,resultCode:`paused`,text:(n===`vi`?Rd:zd).paused}),o?.resultCode===`stop-requested`&&e.session.operation.liveness===`idle`&&s({action:`lifecycle.stop`,resultCode:`stopped`,text:(n===`vi`?Rd:zd).stopped})},[o?.resultCode,n,e.session.controlState,e.session.operation.liveness]);let m=async r=>{if(!i){a(r),s(null);try{let i=await lc(await Pc(e,r));s({action:r,resultCode:i.resultCode,text:Bd(i,n)}),await t?.()}catch{s({action:r,resultCode:`request-failed`,text:D(n,`Trạng thái Pi đã thay đổi hoặc kết nối local bị gián đoạn. Hãy tải trạng thái mới rồi thử lại.`,`Pi state changed or the local connection was interrupted. Refresh status before trying again.`)})}finally{a(null)}}};return(0,X.jsxs)(`section`,{className:`lifecycle-panel surface`,"aria-labelledby":`lifecycle-title`,children:[(0,X.jsxs)(`div`,{className:`lifecycle-copy`,children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:D(n,`Điều khiển task`,`Task controls`)}),(0,X.jsx)(`h2`,{id:`lifecycle-title`,children:`Stop, pause & resume`}),(0,X.jsx)(`p`,{children:D(n,`Stop dừng lượt Pi đang chạy. Pause chờ tool hiện tại kết thúc rồi giữ task. Resume chỉ mở lại task, không tự gọi model. Muốn mở lại và giao việc ngay, dùng “Tiếp tục & gửi” trong Chat.`,`Stop ends the running Pi turn. Pause waits for the current tool to reach a safe point and holds the task. Resume reopens the task without calling the model. Use “Resume & send” in Chat to continue with new work.`)})]}),(0,X.jsxs)(`div`,{className:`lifecycle-state`,children:[(0,X.jsx)(`span`,{children:D(n,`Trạng thái`,`Status`)}),(0,X.jsx)(`strong`,{children:$(e.session.controlState,n)}),(0,X.jsxs)(`small`,{children:[`Pi: `,$(e.session.operation.liveness,n),` · phase: `,$(l,n)]})]}),(0,X.jsxs)(`div`,{className:`lifecycle-actions`,children:[(0,X.jsx)(`button`,{type:`button`,className:`danger-action`,disabled:i!==null||!d,onClick:()=>void m(`lifecycle.stop`),title:d?void 0:$(u?.reasonCode??`no-current-operation`,n),children:i===`lifecycle.stop`?D(n,`Đang dừng…`,`Stopping…`):D(n,`Dừng lượt hiện tại`,`Stop current turn`)}),(0,X.jsx)(`button`,{type:`button`,className:`secondary-action`,disabled:i!==null||!f,onClick:()=>void m(`lifecycle.pause`),title:!f&&c?$(r.actions.pause.reasonCode,n):void 0,children:i===`lifecycle.pause`?D(n,`Đang yêu cầu…`,`Requesting…`):D(n,`Tạm dừng task`,`Pause task`)}),(0,X.jsx)(`button`,{type:`button`,className:`primary-action`,disabled:i!==null||!p,onClick:()=>void m(`lifecycle.resume`),title:!p&&c?$(r.actions.resume.reasonCode,n):void 0,children:i===`lifecycle.resume`?D(n,`Đang mở lại…`,`Resuming…`):D(n,`Tiếp tục task`,`Resume task`)})]}),o&&(0,X.jsx)(`p`,{className:`lifecycle-result result-${o.resultCode===`request-failed`||o.resultCode.includes(`unknown`)||o.resultCode.includes(`unconfirmed`)||o.resultCode===`resume-rejected`?`warning`:`ok`}`,role:`status`,children:o.text}),!c&&(0,X.jsxs)(`p`,{className:`lifecycle-result result-warning`,children:[D(n,`Điều khiển chưa sẵn sàng`,`Controls unavailable`),` · `,$(r.reason?.code,n)]})]})}function Hd(e,t){try{return new Intl.DateTimeFormat(t===`vi`?`vi-VN`:`en-US`,{dateStyle:`short`,timeStyle:`short`}).format(new Date(e))}catch{return e}}function Ud({value:e,locale:t}){return(0,X.jsxs)(`span`,{className:`status-pill tone-${Kl(e)}`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`status-dot`}),$(e,t)]})}function Wd({snapshot:e}){let{locale:t}=C(),[n,r]=(0,Y.useState)(),[i,a]=(0,Y.useState)(`loading`),[o,s]=(0,Y.useState)(`all`),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(),[f,p]=(0,Y.useState)(`idle`),[m,h]=(0,Y.useState)(),[g,_]=(0,Y.useState)(`idle`),[v,y]=(0,Y.useState)(),[b,x]=(0,Y.useState)(`idle`),[S,w]=(0,Y.useState)(),[T,E]=(0,Y.useState)(`idle`);(0,Y.useEffect)(()=>{let e=new AbortController;return a(`loading`),Ys(e.signal).then(t=>{e.signal.aborted||(r(t),a(`ready`),l(e=>e&&t.runs.some(t=>t.runRef===e)?e:t.activeRunRef??t.runs[0]?.runRef??null))}).catch(()=>{e.signal.aborted||a(`error`)}),()=>e.abort()},[e.revision.taskRevision,e.revision.eventCursor]);let O=(0,Y.useMemo)(()=>(n?.runs??[]).filter(e=>o===`all`||o===`current`&&e.isCurrentSession||o===`terminal`&&e.terminal),[n,o]);return(0,Y.useEffect)(()=>{if(!c){d(void 0),p(`idle`);return}let e=new AbortController;return p(`loading`),Xs(c,e.signal).then(t=>{e.signal.aborted||(d(t),p(`ready`))}).catch(()=>{e.signal.aborted||p(`error`)}),()=>e.abort()},[c,e.revision.eventCursor]),(0,Y.useEffect)(()=>{if(!c){y(void 0),x(`idle`);return}let e=new AbortController;return x(`loading`),Qs(c,e.signal).then(t=>{e.signal.aborted||(y(t),x(`ready`))}).catch(()=>{e.signal.aborted||x(`error`)}),()=>e.abort()},[c,e.revision.eventCursor]),(0,Y.useEffect)(()=>{if(!c){h(void 0),_(`idle`);return}let e=new AbortController;return _(`loading`),Zs(c,e.signal).then(t=>{e.signal.aborted||(h(t),_(`ready`))}).catch(()=>{e.signal.aborted||_(`error`)}),()=>e.abort()},[c,e.revision.eventCursor]),(0,Y.useEffect)(()=>{if(!c){w(void 0),E(`idle`);return}let e=new AbortController;return E(`loading`),$s(c,e.signal).then(t=>{e.signal.aborted||(w(t),E(`ready`))}).catch(()=>{e.signal.aborted||E(`error`)}),()=>e.abort()},[c,e.revision.eventCursor]),(0,X.jsxs)(`section`,{className:`task-run-index surface`,"aria-labelledby":`task-run-index-title`,children:[(0,X.jsxs)(`header`,{className:`source-heading`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Long-task dashboard`}),(0,X.jsx)(`h2`,{id:`task-run-index-title`,children:D(t,`Task và các lần chạy gần đây`,`Tasks and recent runs`)})]}),(0,X.jsxs)(`span`,{children:[n?.page.total??0,` `,D(t,`run từ local state`,`runs from local state`)]})]}),(0,X.jsx)(`div`,{className:`task-index-controls`,role:`group`,"aria-label":D(t,`Lọc task run`,`Filter task runs`),children:[[`all`,D(t,`Tất cả`,`All`)],[`current`,D(t,`Session này`,`This session`)],[`terminal`,D(t,`Đã kết thúc`,`Finished`)]].map(([e,t])=>(0,X.jsx)(`button`,{type:`button`,"aria-pressed":o===e,onClick:()=>s(e),children:t},e))}),i===`loading`&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Đang đọc task state bền vững…`,`Reading durable task state…`)}),(i===`error`||n?.state===`unavailable`)&&(0,X.jsx)(`p`,{className:`task-index-empty error-state`,children:D(t,`Task history chưa sẵn sàng; Pi session hiện tại không bị ảnh hưởng.`,`Task history is unavailable; the current Pi session is unaffected.`)}),i===`ready`&&n?.state===`ready`&&(0,X.jsxs)(`div`,{className:`task-run-list`,children:[O.map(e=>(0,X.jsxs)(`article`,{className:`task-run-card`,"data-active":e.isActive,"data-selected":e.runRef===c,children:[(0,X.jsxs)(`div`,{className:`task-run-main`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:e.summary||e.taskId}),e.isActive&&(0,X.jsx)(`span`,{className:`active-run-tag`,children:D(t,`Đang hoạt động`,`Active`)})]}),(0,X.jsxs)(`small`,{children:[e.taskId,` · `,D(t,`lần`,`attempt`),` `,e.attempt,`/`,e.maxAttempts,` · `,D(t,`cập nhật`,`updated`),` `,Hd(e.updatedAt,t)]})]}),(0,X.jsxs)(`div`,{className:`task-run-meta`,children:[(0,X.jsx)(Ud,{value:e.outcome,locale:t}),(0,X.jsx)(`span`,{children:e.progress.total?`${e.progress.completed}/${e.progress.total} ${D(t,`bước`,`steps`)}`:D(t,`Chưa có work plan`,`No work plan`)}),(0,X.jsx)(`span`,{children:e.sessionLabel??(e.isCurrentSession?D(t,`Session hiện tại`,`Current session`):D(t,`Session khác`,`Other session`))}),(0,X.jsx)(`button`,{type:`button`,"aria-pressed":e.runRef===c,onClick:()=>l(e.runRef),children:D(t,`Xem timeline`,`View timeline`)})]})]},e.runRef)),O.length===0&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Không có task run trong bộ lọc này.`,`No task runs match this filter.`)})]}),n?.warnings.map(e=>(0,X.jsx)(`p`,{className:`task-index-warning`,role:`status`,children:e.message},e.code)),n?.page.truncated&&(0,X.jsxs)(`p`,{className:`task-index-warning`,children:[D(t,`Danh sách đã rút gọn;`,`The list is truncated;`),` `,n.page.total-n.page.returned,` `,D(t,`run cũ chưa hiển thị.`,`older runs are not shown.`)]}),(0,X.jsxs)(`section`,{className:`task-timeline`,"aria-labelledby":`task-timeline-title`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Recovery timeline`}),(0,X.jsx)(`h3`,{id:`task-timeline-title`,children:D(t,`Crash, resume, pause và checkpoint`,`Crash, resume, pause, and checkpoints`)})]}),u?.state===`ready`&&(0,X.jsx)(Ud,{value:u.continuity.recoveryDecision,locale:t})]}),f===`idle`&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Chọn một run để xem timeline.`,`Select a run to view its timeline.`)}),f===`loading`&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Đang xác minh chuỗi Task Journal…`,`Verifying the Task Journal chain…`)}),(f===`error`||u?.state===`unavailable`)&&(0,X.jsx)(`p`,{className:`task-index-empty error-state`,children:D(t,`Timeline không đủ bằng chứng tin cậy; task hiện tại không bị ảnh hưởng.`,`The timeline lacks trustworthy evidence; the current task is unaffected.`)}),f===`ready`&&u?.state===`ready`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`timeline-continuity`,children:[(0,X.jsxs)(`span`,{children:[`Crash evidence: `,(0,X.jsx)(`strong`,{children:$(u.continuity.crashEvidence,t)})]}),(0,X.jsxs)(`span`,{children:[`Recovery: `,(0,X.jsx)(`strong`,{children:$(u.continuity.recoveryDecision,t)})]})]}),(0,X.jsx)(`ol`,{className:`timeline-events`,children:u.events.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`timeline-dot tone-${Kl(e.state)}`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:e.title}),(0,X.jsxs)(`small`,{children:[`#`,e.sequence,` · `,Hd(e.recordedAt,t)]}),e.detail&&(0,X.jsx)(`p`,{children:e.detail})]}),(0,X.jsx)(Ud,{value:e.state,locale:t})]},e.eventRef))}),u.events.length===0&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Run này chưa có fact timeline bền vững.`,`This run has no durable timeline facts.`)})]}),u?.warnings.map(e=>(0,X.jsx)(`p`,{className:`task-index-warning`,role:`status`,children:e.message},e.code))]}),(0,X.jsxs)(`section`,{className:`task-timeline recovery-history`,"aria-labelledby":`recovery-history-title`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Compaction & recovery`}),(0,X.jsx)(`h3`,{id:`recovery-history-title`,children:D(t,`Lịch sử rút gọn và phục hồi`,`Compaction and recovery history`)})]}),m?.state===`ready`&&(0,X.jsx)(Ud,{value:m.completeness,locale:t})]}),g===`idle`&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Chọn một run để xem lịch sử rút gọn.`,`Select a run to view compaction history.`)}),g===`loading`&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Đang đọc metadata compaction an toàn…`,`Reading safe compaction metadata…`)}),(g===`error`||m?.state===`unavailable`)&&(0,X.jsx)(`p`,{className:`task-index-empty error-state`,children:D(t,`Lịch sử compaction chưa đủ bằng chứng tin cậy; task hiện tại không bị ảnh hưởng.`,`Compaction history lacks trustworthy evidence; the current task is unaffected.`)}),g===`ready`&&m?.state===`ready`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`timeline-continuity recovery-summary`,children:[(0,X.jsxs)(`span`,{children:[`Context compact: `,(0,X.jsx)(`strong`,{children:m.summary.contextCompactions})]}),(0,X.jsxs)(`span`,{children:[`Tool result: `,(0,X.jsx)(`strong`,{children:m.summary.toolResultCompactions})]}),(0,X.jsxs)(`span`,{children:[`Recovery: `,(0,X.jsx)(`strong`,{children:$(m.recovery.decision,t)})]}),(0,X.jsxs)(`span`,{children:[`Verifier: `,(0,X.jsx)(`strong`,{children:$(m.recovery.verifierState,t)})]})]}),(0,X.jsx)(`p`,{className:`retained-content-note`,children:D(t,`Nội dung capture được giữ trong private runtime state và không gửi vào trình duyệt.`,`Captured content stays in private runtime state and is not sent to the browser.`)}),(0,X.jsx)(`ol`,{className:`timeline-events`,children:m.events.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`timeline-dot tone-${Kl(e.kind)}`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:e.title}),(0,X.jsxs)(`small`,{children:[`#`,e.sequence,` · `,Hd(e.recordedAt,t)]}),e.kind===`tool-result-compaction`&&(0,X.jsxs)(`p`,{children:[e.toolName,` · `,e.originalLines??`?`,` `,D(t,`dòng`,`lines`),` · `,e.captureCount,` capture`]}),e.detail&&(0,X.jsx)(`p`,{children:e.detail})]}),(0,X.jsx)(Ud,{value:`observed`,locale:t})]},e.eventRef))}),m.events.length===0&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Run này chưa có metadata compaction đã quan sát.`,`This run has no observed compaction metadata.`)})]}),m?.warnings.map(e=>(0,X.jsx)(`p`,{className:`task-index-warning`,role:`status`,children:e.message},e.code))]}),(0,X.jsxs)(`section`,{className:`task-timeline handoff-history`,"aria-labelledby":`handoff-history-title`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Handoff`}),(0,X.jsx)(`h3`,{id:`handoff-history-title`,children:D(t,`Bàn giao và việc cần làm tiếp theo`,`Handoff and next work`)})]}),v?.state===`ready`&&(0,X.jsx)(Ud,{value:v.completeness,locale:t})]}),b===`idle`&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Chọn một run để xem handoff.`,`Select a run to view its handoff.`)}),b===`loading`&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Đang xác minh handoff và next action…`,`Verifying the handoff and next action…`)}),(b===`error`||v?.state===`unavailable`)&&(0,X.jsx)(`p`,{className:`task-index-empty error-state`,children:D(t,`Handoff không đủ bằng chứng tin cậy; WebUI không đề xuất hành động.`,`The handoff lacks trustworthy evidence; WebUI will not suggest an action.`)}),b===`ready`&&v?.state===`ready`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`next-action-card`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{children:D(t,`Việc tiếp theo`,`Next work`)}),(0,X.jsx)(`strong`,{children:$(v.nextAction.action,t)})]}),(0,X.jsx)(`p`,{children:v.nextAction.reason}),(0,X.jsxs)(`small`,{children:[v.nextAction.exactCommandCount,` verifier command · `,D(t,`chỉ xem, không tự chạy`,`read-only, never auto-run`)]})]}),v.current&&(0,X.jsxs)(`div`,{className:`timeline-continuity handoff-summary`,children:[(0,X.jsxs)(`span`,{children:[`Outcome: `,(0,X.jsx)(`strong`,{children:$(v.current.taskOutcome,t)})]}),(0,X.jsxs)(`span`,{children:[`Gate: `,(0,X.jsx)(`strong`,{children:$(v.current.gateDecision,t)})]}),(0,X.jsxs)(`span`,{children:[`Authority: `,(0,X.jsx)(`strong`,{children:$(v.current.requiredAuthority,t)})]}),(0,X.jsxs)(`span`,{children:[`Tree evidence: `,(0,X.jsx)(`strong`,{children:v.current.treeEvidenceCurrent?`current`:`not current`})]})]}),(0,X.jsx)(`ol`,{className:`timeline-events`,children:v.events.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`timeline-dot tone-${Kl(e.completionApproved?`completed`:`handoff`)}`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:D(t,`Handoff projection đã được ghi`,`Handoff projection recorded`)}),(0,X.jsxs)(`small`,{children:[`#`,e.sequence,` · `,Hd(e.recordedAt,t)]}),(0,X.jsxs)(`p`,{children:[e.phase??`unknown`,` · `,$(e.projectedAction,t)]})]}),(0,X.jsx)(Ud,{value:e.completionApproved?`completed`:`observed`,locale:t})]},e.eventRef))}),!v.current&&v.events.length===0&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Run này chưa có handoff đã quan sát.`,`This run has no observed handoff.`)})]}),v?.warnings.map(e=>(0,X.jsx)(`p`,{className:`task-index-warning`,role:`status`,children:e.message},e.code))]}),(0,X.jsxs)(`section`,{className:`task-timeline subagent-tree`,"aria-labelledby":`subagent-tree-title`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Helper / subagent tree`}),(0,X.jsx)(`h3`,{id:`subagent-tree-title`,children:D(t,`Quyền sở hữu và vòng đời helper`,`Helper ownership and lifecycle`)})]}),S?.state===`ready`&&(0,X.jsx)(Ud,{value:S.evidenceState,locale:t})]}),T===`idle`&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Chọn một run để xem helper/subagent.`,`Select a run to view helpers and subagents.`)}),T===`loading`&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Đang xác minh helper ledger bền vững…`,`Verifying the durable helper ledger…`)}),(T===`error`||S?.state===`unavailable`)&&(0,X.jsx)(`p`,{className:`task-index-empty error-state`,children:D(t,`Helper ledger không đủ tin cậy; WebUI không suy đoán cây subagent.`,`The helper ledger lacks trustworthy evidence; WebUI will not infer a subagent tree.`)}),T===`ready`&&S?.state===`ready`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`next-action-card`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{children:D(t,`Quyết định điều phối`,`Delegation decision`)}),(0,X.jsx)(`strong`,{children:S.delegation.action===`dispatch`?D(t,`Gửi 1 helper chỉ đọc`,`Dispatch one read-only helper`):D(t,`Parent tự làm`,`Parent works directly`)})]}),(0,X.jsx)(`p`,{children:S.delegation.reasonCodes.map(e=>$(e,t)).join(` · `)}),(0,X.jsxs)(`small`,{children:[D(t,`Tiết kiệm token dự kiến`,`Projected net token saving`),`: `,S.delegation.projectedNetSavingsRatio===null?D(t,`chưa được chứng minh`,`not proven`):`${Math.round(S.delegation.projectedNetSavingsRatio*100)}%`,` · `,D(t,`ngưỡng`,`threshold`),` `,Math.round(S.delegation.minimumRequiredNetSavingsRatio*100),`% · `,D(t,`tối đa 1 helper, 0 retry, 0 writer`,`max 1 helper, 0 retries, 0 writers`)]})]}),(0,X.jsxs)(`div`,{className:`timeline-continuity subagent-summary`,children:[(0,X.jsxs)(`span`,{children:[D(t,`Tổng helper`,`Total helpers`),`: `,(0,X.jsx)(`strong`,{children:S.summary.total})]}),(0,X.jsxs)(`span`,{children:[D(t,`Đang chạy`,`Running`),`: `,(0,X.jsx)(`strong`,{children:S.summary.active})]}),(0,X.jsxs)(`span`,{children:[D(t,`Kết quả stale`,`Stale results`),`: `,(0,X.jsx)(`strong`,{children:S.summary.staleResults})]}),(0,X.jsxs)(`span`,{children:[D(t,`Writer hiện tại`,`Current writer`),`: `,(0,X.jsx)(`strong`,{children:$(S.writer.state,t)})]})]}),(0,X.jsx)(`p`,{className:`retained-content-note`,children:D(t,`Prompt, output, model và session ID của helper không được gửi vào trình duyệt.`,`Helper prompts, outputs, models, and session IDs are not sent to the browser.`)}),(0,X.jsx)(`ol`,{className:`timeline-events`,children:S.children.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(`span`,{className:`timeline-dot tone-${Kl(e.lifecycleState)}`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`strong`,{children:[$(e.role,t),` · `,$(e.authority,t)]}),(0,X.jsxs)(`small`,{children:[Hd(e.reservedAt,t),` → `,e.completedAt?Hd(e.completedAt,t):D(t,`đang giữ lease`,`lease active`)]}),(0,X.jsxs)(`p`,{children:[e.result.disposition?$(e.result.disposition,t):D(t,`Chưa có result evidence`,`No result evidence`),e.result.calls===null?``:` · ${e.result.calls} calls · ${e.result.tokens??0} tokens`]})]}),(0,X.jsx)(Ud,{value:e.result.state===`not-recorded`?e.lifecycleState:e.result.state,locale:t})]},e.nodeRef))}),S.children.length===0&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Không có lifecycle helper chi tiết cho run này.`,`No detailed helper lifecycle is available for this run.`)}),(0,X.jsx)(`p`,{className:`retained-content-note`,children:D(t,`Cây lồng nhiều tầng: chưa có durable lineage; WebUI chỉ hiển thị quan hệ task cha → helper trực tiếp.`,`Nested trees: durable lineage is not yet available, so WebUI only shows parent task → direct helper relationships.`)})]}),S?.warnings.map(e=>(0,X.jsx)(`p`,{className:`task-index-warning`,role:`status`,children:e.message},e.code))]})]})}function Gd(e,t){if(!e)return D(t,`Chưa có`,`Not available`);try{return new Intl.DateTimeFormat(t===`vi`?`vi-VN`:`en-US`,{dateStyle:`short`,timeStyle:`short`}).format(new Date(e))}catch{return e}}function Kd({value:e,locale:t}){return(0,X.jsxs)(`span`,{className:`status-pill tone-${Kl(e)}`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`status-dot`}),$(e,t)]})}function qd({snapshot:e}){let{locale:t}=C(),[n,r]=(0,Y.useState)(),[i,a]=(0,Y.useState)(`loading`),o=(0,Y.useRef)(null),s=(0,Y.useCallback)(()=>{o.current?.abort();let e=new AbortController;o.current=e,a(`loading`),ec(e.signal).then(t=>{e.signal.aborted||(r(t),a(`ready`))}).catch(()=>{e.signal.aborted||a(`error`)})},[]);return(0,Y.useEffect)(()=>(s(),()=>o.current?.abort()),[s,e.identity.projectRef,e.identity.runtimeInstanceId]),(0,X.jsxs)(`section`,{className:`release-monitor surface`,"aria-labelledby":`release-monitor-title`,children:[(0,X.jsxs)(`header`,{className:`source-heading`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Benchmark & release`}),(0,X.jsx)(`h2`,{id:`release-monitor-title`,children:D(t,`Theo dõi chất lượng và mức sẵn sàng phát hành`,`Quality and release readiness`)})]}),(0,X.jsx)(`button`,{type:`button`,onClick:s,disabled:i===`loading`,children:i===`loading`?D(t,`Đang đọc…`,`Loading…`):D(t,`Làm mới`,`Refresh`)})]}),(0,X.jsx)(`p`,{className:`retained-content-note`,children:D(t,`Màn hình chỉ đọc bằng chứng local; không tự chạy benchmark, resume, commit, tag, publish hay push.`,`This screen only reads local evidence; it never runs benchmarks, resumes, commits, tags, publishes, or pushes.`)}),(i===`error`||n?.state===`unavailable`)&&(0,X.jsx)(`p`,{className:`task-index-empty error-state`,children:D(t,`Bằng chứng benchmark/release chưa sẵn sàng; Pi session hiện tại không bị ảnh hưởng.`,`Benchmark and release evidence is unavailable; the current Pi session is unaffected.`)}),i===`loading`&&!n&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Đang xác minh report, manifest và ledger…`,`Verifying reports, manifests, and ledgers…`)}),n&&(0,X.jsxs)(`div`,{className:`release-monitor-grid`,children:[(0,X.jsxs)(`section`,{className:`release-monitor-column`,"aria-labelledby":`benchmark-monitor-title`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Benchmark runs`}),(0,X.jsx)(`h3`,{id:`benchmark-monitor-title`,children:D(t,`Các lần đo gần đây`,`Recent runs`)})]}),(0,X.jsx)(Kd,{value:n.benchmark.state,locale:t})]}),n.benchmark.runs.map(e=>(0,X.jsxs)(`article`,{className:`benchmark-run-card`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`strong`,{children:e.suiteId}),(0,X.jsx)(Kd,{value:e.lifecycle,locale:t})]}),(0,X.jsxs)(`small`,{children:[Gd(e.updatedAt,t),` · `,e.completedRuns,`/`,e.expectedRuns,` `,D(t,`lượt`,`runs`),` · `,D(t,`nguồn`,`source`),` `,$(e.sourceState,t)]}),(0,X.jsxs)(`div`,{className:`benchmark-run-facts`,children:[(0,X.jsxs)(`span`,{children:[`Gate `,(0,X.jsx)(`b`,{children:$(e.releaseGate,t)})]}),(0,X.jsxs)(`span`,{children:[D(t,`Điểm`,`Score`),` `,(0,X.jsx)(`b`,{children:e.scores.overall??`—`})]}),(0,X.jsxs)(`span`,{children:[`Claim `,(0,X.jsx)(`b`,{children:$(e.claimTier,t)})]})]})]},e.runRef)),n.benchmark.runs.length===0&&(0,X.jsx)(`p`,{className:`task-index-empty`,children:D(t,`Chưa có run thuộc repo hiện tại với bằng chứng đủ tin cậy.`,`No trustworthy runs are available for the current repository.`)}),n.benchmark.warnings.map(e=>(0,X.jsx)(`p`,{className:`task-index-warning`,role:`status`,children:e.message},e.code)),n.benchmark.page.truncated&&(0,X.jsx)(`p`,{className:`task-index-warning`,children:D(t,`Danh sách được giới hạn để giữ WebUI nhẹ và ổn định.`,`The list is bounded to keep WebUI fast and stable.`)})]}),(0,X.jsxs)(`section`,{className:`release-monitor-column`,"aria-labelledby":`release-readiness-title`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Release readiness`}),(0,X.jsx)(`h3`,{id:`release-readiness-title`,children:D(t,`RC hiện tại`,`Current RC`)})]}),(0,X.jsx)(Kd,{value:n.release.state,locale:t})]}),(0,X.jsxs)(`dl`,{className:`release-readiness-facts`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Local safe gate`}),(0,X.jsx)(`dd`,{children:(0,X.jsx)(Kd,{value:n.release.localSafeGate,locale:t})})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`RC assembly`}),(0,X.jsx)(`dd`,{children:$(n.release.rcAssembly,t)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Beta`}),(0,X.jsx)(`dd`,{children:$(n.release.beta,t)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`GA`}),(0,X.jsx)(`dd`,{children:$(n.release.gaRelease,t)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:D(t,`Báo cáo`,`Report`)}),(0,X.jsx)(`dd`,{children:Gd(n.release.generatedAt,t)})]})]}),n.release.sourceState===`stale`&&(0,X.jsx)(`p`,{className:`task-index-warning`,children:D(t,`Báo cáo RC thuộc phiên bản source cũ; không dùng để xác nhận tree hiện tại.`,`The RC report belongs to an older source revision and cannot validate the current tree.`)}),n.release.blockers.length>0&&(0,X.jsxs)(`div`,{className:`release-blockers`,children:[(0,X.jsxs)(`strong`,{children:[n.release.blockerCount,` blocker`]}),(0,X.jsx)(`ul`,{children:n.release.blockers.map((e,t)=>(0,X.jsx)(`li`,{children:e},`${t}-${e}`))})]}),(0,X.jsx)(`p`,{className:`retained-content-note`,children:D(t,`Mọi quyền phát hành đều tắt. Việc phát hành vẫn cần operator phê duyệt ngoài màn hình này.`,`All release authority is disabled. Release still requires operator approval outside this screen.`)})]})]})]})}var Jd=264,Yd={overview:{vi:[`Tổng quan`,`Task contract, tiến độ và bằng chứng hoàn thành`],en:[`Overview`,`Task contract, progress, and completion evidence`]},chat:{vi:[`Chat & điều khiển`,`Đúng Pi session hiện tại, không tạo runtime thứ hai`],en:[`Chat & controls`,`The exact current Pi session, without a second runtime`]},documents:{vi:[`Tài liệu`,`Mở .md, .docx, .pdf, .csv trong project và thư mục đã cấp quyền`],en:[`Documents`,`Open .md, .docx, .pdf, and .csv from the project and granted directories`]},source:{vi:[`Source Changes`,`Review thay đổi theo task baseline, working tree và staged`],en:[`Source Changes`,`Review task baseline, working tree, and staged changes`]},activity:{vi:[`Activity`,`Tool call, command, verifier và log preview`],en:[`Activity`,`Tool calls, commands, verifiers, and bounded log previews`]},history:{vi:[`Lịch sử task`,`Crash, resume, checkpoint, handoff và helper`],en:[`Task history`,`Crash, resume, checkpoints, handoffs, and helpers`]},release:{vi:[`Release`,`Benchmark evidence và mức sẵn sàng phát hành`],en:[`Release`,`Benchmark evidence and release readiness`]}};function Xd({value:e,text:t,locale:n=`vi`}){return(0,X.jsxs)(`span`,{className:`status-pill tone-${Kl(e)}`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`status-dot`}),t??$(e,n)]})}function Zd({locale:e}){return(0,X.jsxs)(`section`,{className:`task-empty surface`,"aria-labelledby":`task-title`,children:[(0,X.jsx)(`div`,{className:`empty-mark`,"aria-hidden":`true`,children:`π`}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Task contract`}),(0,X.jsx)(`h2`,{id:`task-title`,children:D(e,`Chưa có task đang chạy`,`No active task`)}),(0,X.jsx)(`p`,{children:D(e,`WebUI đang theo dõi đúng Pi session. Khi task bắt đầu, mục tiêu, tiêu chí và tiến độ sẽ xuất hiện tại đây.`,`WebUI is observing the exact Pi session. Objectives, criteria, and progress will appear here when a task begins.`)})]})]})}function Qd({snapshot:e,locale:t}){let n=e.task;if(!n)return(0,X.jsx)(Zd,{locale:t});let r=Ql(e,t);return(0,X.jsxs)(`section`,{className:`task-dashboard surface`,"aria-labelledby":`task-title`,children:[(0,X.jsxs)(`header`,{className:`task-heading`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:D(t,`Task hiện tại`,`Current task`)}),(0,X.jsx)(`h2`,{id:`task-title`,children:n.summary}),(0,X.jsxs)(`div`,{className:`task-meta`,children:[(0,X.jsx)(Xd,{value:n.outcome,locale:t}),(0,X.jsx)(`span`,{children:$(n.changeMode,t)}),(0,X.jsx)(`span`,{children:$(n.riskLane,t)})]})]}),(0,X.jsxs)(`div`,{className:`progress-number`,"aria-label":`${D(t,`Tiến độ`,`Progress`)} ${r.percent}%`,children:[(0,X.jsxs)(`strong`,{children:[r.percent,`%`]}),(0,X.jsx)(`span`,{children:r.text})]})]}),(0,X.jsx)(`div`,{className:`progress-track`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r.percent,"aria-label":D(t,`Tiến độ tiêu chí`,`Criteria progress`),children:(0,X.jsx)(`span`,{style:{width:`${r.percent}%`}})}),n.blocker&&(0,X.jsxs)(`div`,{className:`blocker`,role:`status`,children:[(0,X.jsx)(`span`,{children:`Blocker`}),(0,X.jsx)(`p`,{children:n.blocker})]}),(0,X.jsxs)(`div`,{className:`criteria-heading`,children:[(0,X.jsx)(`h2`,{children:D(t,`Tiêu chí hoàn thành`,`Completion criteria`)}),(0,X.jsxs)(`span`,{children:[n.criteria.length,` `,D(t,`tiêu chí`,`criteria`)]})]}),(0,X.jsx)(`ol`,{className:`criteria-list`,children:n.criteria.map((e,n)=>(0,X.jsxs)(`li`,{className:`criterion-card`,children:[(0,X.jsx)(`span`,{className:`criterion-index tone-${Kl(e.state)}`,children:String(n+1).padStart(2,`0`)}),(0,X.jsxs)(`div`,{className:`criterion-copy`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{children:e.obligation}),e.priority===`critical`&&(0,X.jsx)(`span`,{className:`critical-tag`,children:D(t,`Quan trọng`,`Critical`)})]}),(0,X.jsx)(`small`,{children:Zl(e,t)})]}),(0,X.jsx)(Xd,{value:e.state,locale:t})]},e.criterionId))}),n.workPlan.length>0&&(0,X.jsxs)(`details`,{className:`work-plan`,children:[(0,X.jsxs)(`summary`,{children:[D(t,`Kế hoạch thực hiện`,`Work plan`),` · `,n.workPlan.length,` `,D(t,`bước`,`steps`)]}),(0,X.jsx)(`ol`,{children:n.workPlan.map(e=>(0,X.jsxs)(`li`,{children:[(0,X.jsx)(Xd,{value:e.status,locale:t}),(0,X.jsx)(`span`,{children:e.summary})]},e.stepId))})]})]})}function $d({snapshot:e,locale:t}){return(0,X.jsxs)(`aside`,{className:`context-rail`,"aria-label":D(t,`Tóm tắt phiên`,`Session summary`),children:[(0,X.jsxs)(`section`,{className:`surface compact-panel`,children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:`Task contract`}),(0,X.jsxs)(`dl`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Task ID`}),(0,X.jsx)(`dd`,{title:e.identity.taskId??void 0,children:ql(e.identity.taskId)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Run ID`}),(0,X.jsx)(`dd`,{title:e.identity.taskRunId??void 0,children:ql(e.identity.taskRunId)})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Verifier`}),(0,X.jsx)(`dd`,{children:(0,X.jsx)(Xd,{value:e.verification.state,locale:t})})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`dt`,{children:`Queue`}),(0,X.jsx)(`dd`,{children:e.session.queue.state===`known`?`${e.session.queue.heldCount??0} ${D(t,`đang giữ`,`held`)}`:$(e.session.queue.state,t)})]})]})]}),(0,X.jsxs)(`section`,{className:`surface compact-panel`,children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:D(t,`Sức khỏe`,`Health`)}),(0,X.jsxs)(`div`,{className:`health-line`,children:[(0,X.jsx)(Xd,{value:e.health.state,locale:t}),(0,X.jsxs)(`span`,{children:[e.health.issues.length,` `,D(t,`lưu ý`,`issues`)]})]}),e.health.issues.slice(0,3).map(e=>(0,X.jsx)(`p`,{className:`health-issue`,children:e.message},e.issueRef))]})]})}function ef({snapshot:e,locale:t}){let n=[[`Runtime`,(0,X.jsx)(Xd,{value:e.session.operation.liveness,locale:t})],[`Task`,(0,X.jsx)(Xd,{value:e.session.controlState,locale:t})],[`Model`,(0,X.jsx)(`strong`,{children:Jl(e,t)})],[`Thinking`,(0,X.jsx)(`strong`,{children:Yl(e,t)})],[D(t,`Quyền`,`Permission`),(0,X.jsx)(`strong`,{children:Xl(e,t)})],[`Approval`,(0,X.jsx)(Xd,{value:e.session.approvalState,locale:t})]];return(0,X.jsx)(ht,{variant:`outlined`,className:`runtime-overview`,"aria-label":D(t,`Trạng thái Pi session`,`Pi session status`),sx:{display:`grid`,gridTemplateColumns:{xs:`repeat(2, minmax(0,1fr))`,sm:`repeat(3, minmax(0,1fr))`,xl:`repeat(6, minmax(0,1fr))`},overflow:`hidden`},children:n.map(([e,t])=>(0,X.jsxs)(Z,{sx:{minWidth:0,minHeight:72,px:2,py:1.5,display:`flex`,flexDirection:`column`,justifyContent:`center`,gap:.75,borderRight:1,borderBottom:{xs:1,xl:0},borderColor:`divider`,"&:last-child":{borderRight:0}},children:[(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,sx:{fontWeight:800,letterSpacing:`.11em`,textTransform:`uppercase`},children:e}),t]},e))})}function tf({active:e,snapshot:t,events:n,refreshSnapshot:r,locale:i}){return e===`overview`?(0,X.jsxs)(Q,{className:`workspace-stack`,spacing:2.25,children:[(0,X.jsx)(ef,{snapshot:t,locale:i}),(0,X.jsxs)(Z,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,lg:`minmax(0,1fr) 300px`},alignItems:`start`,gap:2.25},children:[(0,X.jsx)(Qd,{snapshot:t,locale:i}),(0,X.jsx)($d,{snapshot:t,locale:i})]}),(0,X.jsx)(Gu,{snapshot:t})]}):e===`chat`?(0,X.jsxs)(Q,{className:`workspace-stack`,spacing:2.25,children:[(0,X.jsx)(Vd,{snapshot:t,refreshSnapshot:r}),(0,X.jsx)(Cd,{snapshot:t,refreshSnapshot:r}),(0,X.jsx)(Sd,{snapshot:t,events:n,refreshSnapshot:r})]}):e===`documents`?(0,X.jsx)(ju,{}):e===`source`?(0,X.jsx)(fu,{snapshot:t,refreshSnapshot:r}):e===`activity`?(0,X.jsx)(Ru,{snapshot:t}):e===`history`?(0,X.jsx)(Wd,{snapshot:t}):(0,X.jsx)(qd,{snapshot:t})}function nf({snapshot:e,connection:t=`connecting`,events:n=[],refreshSnapshot:r}){let{locale:i,colorMode:a,setLocale:o,setColorMode:s}=C(),[c,l]=(0,Y.useState)(`overview`),[u,d]=(0,Y.useState)(!1);if(!e)return(0,X.jsxs)(Z,{className:`loading-shell`,children:[(0,X.jsx)(Z,{className:`brand-mark`,"aria-hidden":`true`,children:`π`}),(0,X.jsx)(`p`,{className:`section-kicker`,children:`Piagent WebUI · local`}),(0,X.jsx)(q,{variant:`h1`,children:t===`failed`?D(i,`Không thể nối vào Pi session`,`Unable to connect to the Pi session`):D(i,`Đang mở không gian làm việc`,`Opening the workspace`)}),(0,X.jsx)(q,{color:`text.secondary`,children:t===`failed`?D(i,`Hãy mở lại WebUI từ Pi terminal để tạo phiên local mới.`,`Reopen WebUI from the Pi terminal to create a new local session.`):D(i,`Đang tải task contract và trạng thái runtime hiện tại…`,`Loading the task contract and current runtime state…`)}),t!==`failed`&&(0,X.jsx)(Ve,{size:22}),(0,X.jsx)(Xd,{value:t,locale:i})]});let f=Yd[c][i],p=(e.sourceChanges.task?.counts.files??0)+e.sourceChanges.workingTree.counts.files+e.sourceChanges.staged.counts.files,m=[{id:`overview`,label:D(i,`Tổng quan`,`Overview`),icon:(0,X.jsx)(So,{})},{id:`chat`,label:D(i,`Chat & Task`,`Chat & Task`),icon:(0,X.jsx)(Co,{}),count:e.session.queue.heldCount??0},{id:`documents`,label:D(i,`Tài liệu`,`Documents`),icon:(0,X.jsx)(wo,{})},{id:`source`,label:`Source Changes`,icon:(0,X.jsx)(To,{}),count:p},{id:`activity`,label:`Activity`,icon:(0,X.jsx)(Eo,{}),count:e.activity.running.length},{id:`history`,label:D(i,`Lịch sử`,`History`),icon:(0,X.jsx)(Do,{})},{id:`release`,label:`Release`,icon:(0,X.jsx)(Oo,{})}],h=e=>{l(e),d(!1)},g=(0,X.jsxs)(Z,{sx:{height:`100%`,display:`flex`,flexDirection:`column`},children:[(0,X.jsxs)(ii,{sx:{minHeight:`72px !important`,px:`18px !important`,gap:1.25},children:[(0,X.jsx)(Z,{className:`brand-mark`,"aria-hidden":`true`,children:`π`}),(0,X.jsxs)(Z,{sx:{minWidth:0},children:[(0,X.jsx)(q,{sx:{fontWeight:760,lineHeight:1.15},children:`Piagent`}),(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,children:`WebUI · local`})]})]}),(0,X.jsxs)(Z,{sx:{mx:1.5,mb:1.25,p:1.35,border:1,borderColor:`divider`,borderRadius:1,bgcolor:`action.hover`},children:[(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,sx:{display:`block`,textTransform:`uppercase`,letterSpacing:`.09em`},children:D(i,`Pi session hiện tại`,`Current Pi session`)}),(0,X.jsx)(q,{variant:`body2`,noWrap:!0,title:e.session.displayName??void 0,sx:{mt:.45,fontWeight:700},children:e.session.displayName??`Pi session`}),(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,title:e.identity.sessionRef,children:ql(e.identity.sessionRef)})]}),(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,sx:{px:2.5,pt:1,pb:.5,fontWeight:800,letterSpacing:`.1em`,textTransform:`uppercase`},children:D(i,`Không gian làm việc`,`Workspaces`)}),(0,X.jsx)(fe,{component:`nav`,"aria-label":D(i,`Điều hướng WebUI`,`WebUI navigation`),sx:{py:.5},children:m.map(e=>(0,X.jsxs)(Ar,{selected:c===e.id,"aria-current":c===e.id?`page`:void 0,onClick:()=>h(e.id),children:[(0,X.jsx)(Fr,{sx:{minWidth:36,color:`inherit`,"& .MuiSvgIcon-root":{fontSize:19}},children:e.icon}),(0,X.jsx)(Br,{primary:e.label,slotProps:{primary:{sx:{fontSize:13,fontWeight:c===e.id?750:600}}}}),!!e.count&&(0,X.jsx)(qn,{badgeContent:e.count,color:e.id===`activity`?`secondary`:`primary`,max:99,sx:{mr:1}})]},e.id))}),(0,X.jsxs)(Z,{sx:{mt:`auto`,p:1.5},children:[(0,X.jsx)(lr,{sx:{mb:1.5}}),(0,X.jsxs)(Q,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,X.jsxs)(ei,{exclusive:!0,size:`small`,value:i,"aria-label":D(i,`Ngôn ngữ`,`Language`),onChange:(e,t)=>t&&o(t),sx:{flex:1},children:[(0,X.jsx)(Jr,{value:`vi`,"aria-label":`Tiếng Việt`,sx:{flex:1},children:`VI`}),(0,X.jsx)(Jr,{value:`en`,"aria-label":`English`,sx:{flex:1},children:`EN`})]}),(0,X.jsx)(bo,{title:a===`dark`?D(i,`Chuyển sang giao diện sáng`,`Use light mode`):D(i,`Chuyển sang giao diện tối`,`Use dark mode`),children:(0,X.jsx)(et,{"aria-label":a===`dark`?D(i,`Dùng giao diện sáng`,`Use light mode`):D(i,`Dùng giao diện tối`,`Use dark mode`),onClick:()=>s(a===`dark`?`light`:`dark`),sx:{border:1,borderColor:`divider`,borderRadius:1},children:a===`dark`?(0,X.jsx)(Ao,{fontSize:`small`}):(0,X.jsx)(jo,{fontSize:`small`})})})]})]})]});return(0,X.jsxs)(Z,{className:`app-shell`,"data-contract":`snapshot-v1`,children:[(0,X.jsx)(`a`,{className:`skip-link`,href:`#main-content`,children:D(i,`Bỏ qua điều hướng`,`Skip navigation`)}),(0,X.jsx)(In,{position:`fixed`,color:`transparent`,elevation:0,sx:{width:{md:`calc(100% - ${Jd}px)`},ml:{md:`${Jd}px`},borderBottom:1,borderColor:`divider`,bgcolor:`rgba(var(--piagent-palette-background-defaultChannel) / .88)`,backdropFilter:`blur(18px)`},children:(0,X.jsxs)(ii,{sx:{minHeight:`72px !important`,gap:1.5},children:[(0,X.jsx)(et,{edge:`start`,"aria-label":D(i,`Mở menu`,`Open menu`),onClick:()=>d(!0),sx:{display:{md:`none`}},children:(0,X.jsx)(ko,{})}),(0,X.jsxs)(Z,{sx:{minWidth:0,flex:1},children:[(0,X.jsx)(q,{component:`h1`,variant:`h2`,noWrap:!0,children:f[0]}),(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,noWrap:!0,sx:{display:{xs:`none`,sm:`block`}},children:f[1]})]}),(0,X.jsxs)(Q,{direction:`row`,spacing:1,sx:{alignItems:`center`},"aria-live":`polite`,children:[(0,X.jsx)(rr,{variant:`outlined`,size:`small`,color:t===`connected`?`success`:`default`,label:t===`connected`?`Live`:$(t,i)}),e.approvals.pending.length>0&&(0,X.jsx)(rr,{color:`warning`,size:`small`,label:`${e.approvals.pending.length} approval`}),(0,X.jsx)(rr,{variant:`outlined`,size:`small`,sx:{display:{xs:`none`,sm:`flex`}},label:e.capabilities.capabilities[`control.chat`].status===`available`?D(i,`Chat bật`,`Chat enabled`):D(i,`Chỉ xem`,`Read only`)})]})]})}),(0,X.jsxs)(Z,{component:`nav`,"aria-label":D(i,`Sidebar chính`,`Primary sidebar`),sx:{width:{md:Jd},flexShrink:{md:0}},children:[(0,X.jsx)(Er,{variant:`temporary`,open:u,onClose:()=>d(!1),ModalProps:{keepMounted:!0},sx:{display:{xs:`block`,md:`none`},"& .MuiDrawer-paper":{width:Jd}},children:g}),(0,X.jsx)(Er,{variant:`permanent`,open:!0,sx:{display:{xs:`none`,md:`block`},"& .MuiDrawer-paper":{width:Jd,borderRight:1,borderColor:`divider`,bgcolor:`background.paper`}},children:g})]}),(0,X.jsx)(Z,{component:`main`,id:`main-content`,sx:{ml:{md:`${Jd}px`},minWidth:0,pt:`72px`},children:(0,X.jsxs)(Z,{className:`workspace-view workspace-${c}`,sx:{width:`100%`,maxWidth:c===`source`?`none`:1580,mx:`auto`,p:{xs:1.5,sm:2.5,lg:3}},children:[e.approvals.pending.length>0&&(0,X.jsx)(Z,{sx:{mb:2.25},children:(0,X.jsx)(Ld,{snapshot:e,refreshSnapshot:r})}),(0,X.jsx)(tf,{active:c,snapshot:e,events:n,refreshSnapshot:r,locale:i})]})})]})}function rf({value:e,onChange:t}){let{locale:n}=C();return(0,X.jsxs)(us,{value:e,onChange:(e,n)=>t(n),variant:`fullWidth`,"aria-label":D(n,`Thanh bên`,`Sidebar`),children:[(0,X.jsx)(Uo,{value:`sessions`,label:D(n,`Phiên`,`Sessions`)}),(0,X.jsx)(Uo,{value:`files`,label:D(n,`Tệp`,`Files`)}),(0,X.jsx)(Uo,{value:`search`,label:D(n,`Tìm kiếm`,`Search`)})]})}var af=Pt({themeId:T}),of=(0,Y.lazy)(()=>Su(()=>import(`./WorkspaceQuickOpen-Bn4miZq4.js`),__vite__mapDeps([5,1,2,6,3,7,4,8,9]))),sf=(0,Y.lazy)(()=>Su(()=>import(`./TerminalPanel-C3vkzjQ6.js`),__vite__mapDeps([10,1,2,3,7,4,11,12]))),cf=(0,Y.lazy)(()=>Su(()=>import(`./WorkspaceExplorer-Coh_GWCO.js`),__vite__mapDeps([13,1,2,6,3,7,4,11,9,12,8]))),lf=60,uf=36,df=25,ff=75,pf=`piagent-webui-editor-width`;function mf(){try{let e=Number(window.localStorage.getItem(pf));return e>=df&&e<=ff?e:55}catch{return 55}}function hf({sessionRef:e,children:t,navigationHost:n,sidebarMode:r,onSection:i}){let{locale:a}=C(),o=af(y().breakpoints.up(`lg`)),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(),h=(0,Y.useRef)(null),[g,_]=(0,Y.useState)(mf),v=e=>{let t=Math.min(ff,Math.max(df,e));_(t);try{window.localStorage.setItem(pf,String(Math.round(t)))}catch{}},b=e=>{let t=h.current?.getBoundingClientRect();if(!t)return;e.preventDefault(),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let n=e=>v((e.clientX-t.left)/t.width*100),r=()=>{window.removeEventListener(`pointermove`,n),window.removeEventListener(`pointerup`,r),document.body.style.cursor=``,document.body.style.userSelect=``};window.addEventListener(`pointermove`,n),window.addEventListener(`pointerup`,r)};(0,Y.useEffect)(()=>{let t=e=>{(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`p`&&(e.preventDefault(),u(!0))},n=t=>{let n=t.detail;n?.sessionRef===e&&(m({path:n.path,line:n.line}),c(!0),i(`files`))};return window.addEventListener(`keydown`,t),window.addEventListener(Mo,n),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(Mo,n)}},[e]),(0,Y.useEffect)(()=>{r!==`sessions`&&c(!0)},[r]);let x=(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ve,{size:24}),children:(0,X.jsx)(cf,{sessionRef:e,target:p,navigationHost:o?n:null,sidebarMode:r,onHide:()=>{c(!1),i(`sessions`)},fill:o})}),S=(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ve,{size:24}),children:(0,X.jsx)(sf,{sessionRef:e,onHide:()=>f(!1)})});return(0,X.jsxs)(X.Fragment,{children:[l&&(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(Ve,{size:20}),children:(0,X.jsx)(of,{sessionRef:e,onClose:()=>u(!1),onOpen:e=>{u(!1),c(!0),i(`files`),m({path:e})}})}),(0,X.jsxs)(Z,{sx:{position:`sticky`,top:lf,zIndex:2,height:uf,display:`flex`,alignItems:`center`,gap:.5,px:1,bgcolor:`background.default`,borderBottom:1,borderColor:`divider`},children:[(0,X.jsx)(J,{size:`small`,"aria-expanded":s,onClick:()=>{c(e=>!e),i(s?`sessions`:`files`)},children:D(a,`Tệp`,`Files`)}),(0,X.jsx)(J,{size:`small`,"aria-expanded":d,onClick:()=>f(e=>!e),children:`Terminal`})]}),(0,X.jsxs)(Z,{ref:h,sx:{display:`flex`,minWidth:0},children:[o&&(s||d)&&(0,X.jsxs)(Z,{component:`section`,"aria-label":D(a,`Editor và terminal`,`Editor and terminal`),sx:{position:`sticky`,top:96,alignSelf:`flex-start`,flexShrink:0,minWidth:0,width:`clamp(320px, ${g}%, calc(100% - 360px))`,height:`calc(100vh - 96px - var(--piagent-status-bar, 0px))`,display:`flex`,flexDirection:`column`,bgcolor:`background.default`,zIndex:1},children:[s&&(0,X.jsx)(Z,{sx:{flex:1,minHeight:0,overflow:`hidden`},children:x}),d&&(0,X.jsx)(Z,{sx:{flexShrink:0,maxHeight:s?`60%`:`100%`,overflow:`auto`,...s?{}:{flex:1}},children:S}),(0,X.jsx)(Z,{role:`separator`,"aria-orientation":`vertical`,"aria-label":D(a,`Kéo để đổi độ rộng editor`,`Drag to resize the editor`),"aria-valuenow":Math.round(g),"aria-valuemin":df,"aria-valuemax":ff,tabIndex:0,onPointerDown:b,onKeyDown:e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),v(g+(e.key===`ArrowLeft`?-2:2)))},sx:{position:`absolute`,top:0,right:-3,bottom:0,width:6,cursor:`col-resize`,zIndex:2,borderRight:1,borderColor:`divider`,"&:hover, &:focus-visible":{borderColor:`primary.main`,outline:`none`}}})]}),(0,X.jsx)(Z,{sx:{flex:1,minWidth:0},children:t})]}),!o&&(0,X.jsxs)(Er,{anchor:`bottom`,open:d,onClose:()=>f(!1),children:[(0,X.jsx)(J,{onClick:()=>f(!1),children:D(a,`Ẩn terminal`,`Hide terminal`)}),d&&S]}),!o&&(0,X.jsxs)(Er,{anchor:`left`,open:s,onClose:()=>c(!1),slotProps:{paper:{sx:{width:`min(96vw, 800px)`}}},children:[(0,X.jsx)(J,{onClick:()=>c(!1),children:D(a,`Đóng`,`Close`)}),s&&x]})]})}var gf=K((0,X.jsx)(`path`,{d:`M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1`}),`AddRounded`),_f=K((0,X.jsx)(`path`,{d:`M16.5 6.75v10.58c0 2.09-1.53 3.95-3.61 4.15-2.39.23-4.39-1.64-4.39-3.98V5.14c0-1.31.94-2.5 2.24-2.63 1.5-.15 2.76 1.02 2.76 2.49v10.5c0 .55-.45 1-1 1s-1-.45-1-1V6.75c0-.41-.34-.75-.75-.75s-.75.34-.75.75v8.61c0 1.31.94 2.5 2.24 2.63 1.5.15 2.76-1.02 2.76-2.49V5.17c0-2.09-1.53-3.95-3.61-4.15C9.01.79 7 2.66 7 5v12.27c0 2.87 2.1 5.44 4.96 5.71 3.29.3 6.04-2.26 6.04-5.48V6.75c0-.41-.34-.75-.75-.75s-.75.34-.75.75`}),`AttachFileRounded`),vf=K((0,X.jsx)(`path`,{d:`M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m4.3 14.3c-.39.39-1.02.39-1.41 0L12 13.41 9.11 16.3c-.39.39-1.02.39-1.41 0a.996.996 0 0 1 0-1.41L10.59 12 7.7 9.11a.996.996 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0L12 10.59l2.89-2.89c.39-.39 1.02-.39 1.41 0s.39 1.02 0 1.41L13.41 12l2.89 2.89c.38.38.38 1.02 0 1.41`}),`CancelRounded`),yf=K((0,X.jsx)(`path`,{d:`M17.65 6.35c-1.63-1.63-3.94-2.57-6.48-2.31-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20c3.19 0 5.93-1.87 7.21-4.56.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53-1.13 2.43-3.84 3.97-6.8 3.31-2.22-.49-4.01-2.3-4.48-4.52C5.31 9.44 8.26 6 12 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71z`}),`RefreshRounded`),bf=K((0,X.jsx)(`path`,{d:`m3.4 20.4 17.45-7.48c.81-.35.81-1.49 0-1.84L3.4 3.6c-.66-.29-1.39.2-1.39.91L2 9.12c0 .5.37.93.87.99L17 12 2.87 13.88c-.5.07-.87.5-.87 1l.01 4.61c0 .71.73 1.2 1.39.91`}),`SendRounded`),xf=K((0,X.jsx)(`path`,{d:`M2 4v16h20V4zm18 4.67h-2.5V6H20zm-2.5 2H20v2.67h-2.5zM4 6h11.5v12H4zm13.5 12v-2.67H20V18z`}),`ViewSidebarOutlined`),Sf=K((0,X.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m3 14H9c-.55 0-1-.45-1-1V9c0-.55.45-1 1-1h6c.55 0 1 .45 1 1v6c0 .55-.45 1-1 1`}),`StopCircleRounded`);function Cf(e){return M(`MuiCollapse`,e)}g(`MuiCollapse`,[`root`,`horizontal`,`vertical`,`entered`,`hidden`,`wrapper`,`wrapperInner`]);var wf={},Tf=e=>{let{orientation:t,classes:n}=e;return B({root:[`root`,t],entered:[`entered`],hidden:[`hidden`],wrapper:[`wrapper`,t],wrapperInner:[`wrapperInner`,t]},Cf,n)},Ef=W(`div`,{name:`MuiCollapse`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.orientation],n.state===`entered`&&t.entered,n.state===`exited`&&!n.in&&n.collapsedSize===`0px`&&t.hidden]}})(V(({theme:e})=>({height:0,overflow:`hidden`,transition:e.transitions.create(`height`),variants:[{props:{orientation:`horizontal`},style:{height:`auto`,width:0,transition:e.transitions.create(`width`)}},{props:{state:`entered`},style:{height:`auto`,overflow:`visible`}},{props:{state:`entered`,orientation:`horizontal`},style:{width:`auto`}},{props:({ownerState:e})=>e.state===`exited`&&!e.in&&e.collapsedSize===`0px`,style:{visibility:`hidden`}}]}))),Df=W(`div`,{name:`MuiCollapse`,slot:`Wrapper`})({display:`flex`,width:`100%`,variants:[{props:{orientation:`horizontal`},style:{width:`auto`,height:`100%`}}]}),Of=W(`div`,{name:`MuiCollapse`,slot:`WrapperInner`})({width:`100%`,variants:[{props:{orientation:`horizontal`},style:{width:`auto`,height:`100%`}}]}),kf=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiCollapse`}),{addEndListener:r,children:i,className:a,collapsedSize:o=`0px`,component:s,disablePrefersReducedMotion:c=!1,easing:l,in:u,onEnter:d,onEntered:f,onEntering:p,onExit:m,onExited:h,onExiting:g,orientation:_=`vertical`,slots:v=wf,slotProps:b=wf,style:x,timeout:S=k.standard,TransitionComponent:C=Se,...w}=n,T={...n,orientation:_,collapsedSize:o},E=Tf(T),D=y(),O=Y.useRef(null),A=Y.useRef(null),j=typeof o==`number`?`${o}px`:o,M=_===`horizontal`,N=M?`width`:`height`,F=Ie(D.motion.reducedMotion,c),I=Y.useRef(null),ee=Ke(t,I),te=()=>O.current?O.current[M?`clientWidth`:`clientHeight`]:0,L=Pe(I,(e,t)=>{O.current&&M&&(O.current.style.position=`absolute`),e.style[N]=j,d&&d(e,t)}),ne=Pe(I,(e,t)=>{let n=te();O.current&&M&&(O.current.style.position=``);let{duration:r,easing:i}=Ue({style:x,timeout:S,easing:l},{mode:`enter`});if(S===`auto`&&!F.shouldReduceMotion){let e=D.transitions.getAutoHeightDuration(n);A.current=e}else A.current=null;let a=F.getTransitionTiming({duration:A.current??r,delay:void 0});e.style.transitionDuration=typeof a.duration==`string`?a.duration:`${a.duration}ms`,e.style[N]=`${n}px`,e.style.transitionTimingFunction=i,p&&p(e,t)}),R=Pe(I,(e,t)=>{e.style[N]=`auto`,f&&f(e,t)}),z=Pe(I,e=>{e.style[N]=`${te()}px`,m&&m(e)}),re=Pe(I,h),ie=Pe(I,e=>{let t=te(),{duration:n,easing:r}=Ue({style:x,timeout:S,easing:l},{mode:`exit`});if(S===`auto`&&!F.shouldReduceMotion){let e=D.transitions.getAutoHeightDuration(t);A.current=e}else A.current=null;let i=F.getTransitionTiming({duration:A.current??n,delay:void 0});e.style.transitionDuration=typeof i.duration==`string`?i.duration:`${i.duration}ms`,e.style[N]=j,e.style.transitionTimingFunction=r,g&&g(e)}),ae=r?e=>{r(I.current,e)}:void 0,oe={slots:v,slotProps:b,component:s},[se,ce]=nt(`root`,{ref:ee,className:P(E.root,a),elementType:Ef,externalForwardedProps:oe,ownerState:T,additionalProps:{style:{[M?`minWidth`:`minHeight`]:j,...x}}}),[le,ue]=nt(`wrapper`,{ref:O,className:E.wrapper,elementType:Df,externalForwardedProps:oe,ownerState:T}),[de,fe]=nt(`wrapperInner`,{className:E.wrapperInner,elementType:Of,externalForwardedProps:oe,ownerState:T});return(0,X.jsx)(C,{in:u,onEnter:L,onEntered:R,onEntering:ne,onExit:z,onExited:re,onExiting:ie,addEndListener:ae,getAutoTimeout:S===`auto`?()=>A.current:void 0,reduceMotion:F.shouldReduceMotion,nodeRef:I,timeout:S===`auto`?null:S,...w,children:(e,{ownerState:t,...n})=>{let r={...T,state:e};return(0,X.jsx)(se,{...ce,className:P(ce.className,{entered:E.entered,exited:!u&&j===`0px`&&E.hidden}[e]),ownerState:r,...n,children:(0,X.jsx)(le,{...ue,ownerState:r,children:(0,X.jsx)(de,{...fe,ownerState:r,children:i})})})}})});kf&&(kf.muiSupportAuto=!0);var Af=(e,[t,n])=>e===`vi`?t:n,jf={"managed-config-missing":[`Chưa nhập cấu hình công ty. Mở Agent Watch → Studio → Nhập cấu hình cho Piagent (trên Windows: Kết nối Piagent trong WSL).`,`Company configuration is not imported. Open Agent Watch → Studio and import it for Piagent (on Windows: Connect Piagent in WSL).`],"managed-keychain-approval-required":[`macOS chưa cho Agent Watch đọc key. Chọn “Luôn cho phép” khi được hỏi rồi kết nối lại.`,`macOS did not let Agent Watch read the key. Choose “Always Allow” when asked, then connect again.`],"managed-key-unavailable":[`Agent Watch không đọc được key công ty trên máy này. Mở Agent Watch, dán lại mã kết nối, bấm Kết nối Piagent trong WSL rồi kết nối lại.`,`Agent Watch cannot read the company key on this computer. Open Agent Watch, paste the connection code again, choose Connect Piagent in WSL, then connect again.`],"managed-profile-disconnected":[`Cấu hình Piagent đang thuộc key công ty đã ngắt kết nối. Nhập lại cấu hình cho Piagent trong Agent Watch (trên Windows: Kết nối Piagent trong WSL).`,`The Piagent configuration belongs to a disconnected company key. Import it again in Agent Watch (on Windows: Connect Piagent in WSL).`],"managed-launch-binding-changed":[`Agent Watch hoặc Piagent vừa cập nhật. Nhập lại cấu hình cho Piagent trong Agent Watch (trên Windows: Kết nối Piagent trong WSL).`,`Agent Watch or Piagent changed. Import the Piagent configuration again in Agent Watch (on Windows: Connect Piagent in WSL).`],"managed-project-contains-config":[`Không mở Piagent công ty ở thư mục này (thường là thư mục home ~) vì nó chứa cấu hình công ty. Vào thư mục dự án rồi chạy lại: cd ~/đường-dẫn-dự-án && piagent studio, hoặc piagent studio --project ~/đường-dẫn-dự-án.`,`The company Piagent cannot open this folder (usually your home folder ~) because it holds the company configuration. Go to a project folder and run it again: cd ~/your-project && piagent studio, or piagent studio --project ~/your-project.`],"managed-binding-update-pending":[`Agent Watch đang chạy nhưng chưa cập nhật cấu hình sau bản Piagent hoặc Agent Watch mới. Mở Agent Watch → Studio, bấm Áp dụng cho Piagent rồi mở lại.`,`Agent Watch is running but has not updated the configuration after the Piagent or Agent Watch update yet. Open Agent Watch → Studio, apply for Piagent, then open it again.`],"managed-binding-watch-not-running":[`Piagent hoặc Agent Watch vừa cập nhật nhưng Agent Watch không chạy nên chưa cập nhật cấu hình. Mở Agent Watch, chờ vài giây rồi mở lại.`,`Piagent or Agent Watch was updated but Agent Watch is not running, so the configuration was not updated. Open Agent Watch, wait a few seconds, then open it again.`],"managed-launch-version-mismatch":[`Agent Watch đang dùng một bản Piagent khác với dashboard này. Mở Agent Watch → Studio, bấm Áp dụng cho Piagent rồi kết nối lại.`,`Agent Watch points at another Piagent install than this dashboard. Open Agent Watch → Studio, apply for Piagent, then connect again.`],"managed-launch-stale-runtime":[`Phiên công ty của bản Piagent cũ chưa dừng được. Thử kết nối lại sau ít giây.`,`The company runtime from the previous Piagent did not stop yet. Connect again in a few seconds.`],"managed-launch-timeout":[`Phiên công ty khởi động quá lâu. Kết nối lại.`,`The company runtime took too long to start. Connect again.`],"company-gateway-timeout":["Phiên công ty đang chạy nhưng không trả lời. Đóng Piagent, chạy `pkill -f piagent-studio.mjs` trong Terminal (Windows: trong Ubuntu), rồi mở lại.","The company runtime is running but does not answer. Close Piagent, run `pkill -f piagent-studio.mjs` in a terminal (Windows: in Ubuntu), then open it again."]},Mf={"company-quota":{title:[`Hết hạn mức token`,`Token quota used up`],text:[`Hạn mức token của key này đã hết. Chờ kỳ hạn mức mới hoặc liên hệ quản trị viên để tăng hạn mức.`,`This key's token quota is used up. Wait for the next quota period or ask an administrator to raise it.`]},"company-provider-limit":{title:[`Tài khoản model của công ty hết lượt`,`Company model account limited`],text:[`Nhà cung cấp đang giới hạn tài khoản model của công ty (hết lượt dùng hoặc quá tải). Thử lại sau; quản trị viên có thể đổi model trong Harness.`,`The provider is limiting the company's model account (out of usage or overloaded). Try again later; an administrator can switch the harness model.`]},"company-account":{title:[`Tài khoản model cần đăng nhập lại`,`Model account must sign in again`],text:[`Tài khoản model của công ty đã hết phiên đăng nhập. Quản trị viên cần đăng nhập lại trong Studio (Tài khoản AI).`,`The company's model account is signed out. An administrator has to sign it in again in Studio (AI accounts).`]},"company-busy":{title:[`Đang quá tải`,`Busy`],text:[`Studio đang xử lý quá nhiều request của key này, hoặc tài khoản model đang bận. Chờ vài giây rồi gửi lại.`,`Studio is handling too many requests for this key, or the model account is busy. Wait a few seconds and send again.`]},"company-trial-limit":{title:[`Studio hết lượt thử nghiệm`,`Studio live-test limit reached`],text:[`Studio đã dùng hết số request thử nghiệm được cấp. Quản trị viên cần nâng trần trước khi chạy tiếp.`,`Studio has used up its live-test request ceiling. An administrator has to raise it before anything runs.`]},"company-key":{title:[`Key công ty không dùng được`,`Company key unusable`],text:[`Key công ty đã hết hạn, bị thu hồi, hoặc Agent Watch không đọc được. Nhập lại key trong Agent Watch.`,`The company key expired, was revoked, or Agent Watch cannot read it. Import the key again in Agent Watch.`]},"company-policy":{title:[`Không được phép`,`Not allowed`],text:[`Key này không được dùng model, mức suy luận hoặc độ dài trả lời đang chọn. Nếu Harness vừa đổi, gửi lại để dùng cấu hình mới; nếu vẫn lỗi, kiểm tra Harness trong Studio.`,`This key may not use this model, thinking level or answer length. If the harness just changed, send again to use the new one; otherwise check the harness in Studio.`]},"company-new-session":{title:[`Cần cuộc trò chuyện mới`,`New conversation needed`],text:[`Cuộc trò chuyện này không tiếp tục được với tài khoản model hiện tại. Nội dung cũ vẫn đọc được; tạo cuộc trò chuyện mới để làm tiếp.`,`This conversation cannot continue with the current model account. It stays readable; start a new conversation to go on.`]},"company-rejected":{title:[`Yêu cầu bị từ chối`,`Request rejected`],text:[`Model từ chối yêu cầu này, thường vì cuộc trò chuyện đã dài hơn model hiện tại nhận được. Bấm Tiếp tục: phần cũ được tóm tắt rồi mới gửi. Nếu vẫn bị từ chối, rút gọn tin nhắn hoặc tạo cuộc trò chuyện mới.`,`The model rejected this request, usually because the conversation grew longer than the current model accepts. Press Continue: the older part is summarised before sending. If it is still rejected, shorten the message or start a new conversation.`]},"company-refused":{title:[`Model từ chối yêu cầu này`,`The model declined this request`],text:[`Nhà cung cấp model từ chối yêu cầu này theo chính sách sử dụng của họ (ví dụ: in, mã hoá hoặc gửi ra ngoài thông tin bí mật). Gửi lại nguyên văn sẽ bị từ chối tiếp; hãy viết lại yêu cầu theo cách khác.`,`The model's provider declined this request under its usage policy (for example, printing, encoding or sending out secrets). The same request is declined again; ask in a different way.`]},"company-unreachable":{title:[`Lỗi kết nối`,`Connection error`],text:[`Không kết nối được tới Studio. Kiểm tra mạng hoặc VPN rồi gửi lại.`,`Studio could not be reached. Check the network or VPN and send again.`]},"company-service":{title:[`Dịch vụ model lỗi`,`Model service error`],text:[`Studio đã nhận yêu cầu nhưng dịch vụ model phía sau không trả lời. Gửi lại; nếu lặp lại, báo quản trị viên kèm mã bên dưới.`,`Studio took the request but its model service did not answer. Send again; if it repeats, give an administrator the code below.`]},"company-config-changed":{title:[`Cấu hình vừa thay đổi`,`Configuration changed`],text:[`Key hoặc Harness vừa thay đổi trong Studio. Gửi lại để chạy với cấu hình mới.`,`The key or harness just changed in Studio. Send again to run with the new one.`]},"company-update":{title:[`Cần cập nhật Piagent`,`Piagent update needed`],text:[`Harness dùng model mà bản Piagent này chưa biết. Cập nhật Piagent rồi gửi lại.`,`The harness uses a model this Piagent does not know. Update Piagent and send again.`]},"company-tool":{title:[`Công cụ lỗi`,`Tool error`],text:[`Công cụ này không chạy được ở bước này (ví dụ subagent đã chạy đủ 8 lần cho tin nhắn này).`,`This tool could not run at this step (for example, the subagent already ran 8 times for this message).`]},"company-failed":{title:[`Lỗi chưa phân loại`,`Unclassified error`],text:[`Yêu cầu không hoàn tất. Gửi lại; nếu lặp lại, báo quản trị viên kèm mã bên dưới.`,`The request did not complete. Send again; if it repeats, give an administrator the code below.`]}},Nf=[`Cuộc trò chuyện này thuộc thành viên hoặc Studio khác với key đang nhập trong Agent Watch. Nội dung cũ vẫn đọc được; tạo cuộc trò chuyện mới để làm tiếp.`,`This conversation belongs to another member or Studio than the key Agent Watch holds. It stays readable; start a new conversation to go on.`],Pf={harness_route_unavailable:{title:[`Không có tài khoản AI cho vai trò này`,`No AI account for this role`],text:[`Không tài khoản AI nào của công ty đang phục vụ model của vai trò này cho team (tài khoản bị ngắt, tắt cho team hoặc hết lượt). Quản trị viên cần gắn hoặc bật tài khoản trong Studio (Tài khoản AI), hoặc đổi model của vai trò trong Harness.`,`No company AI account serves this role's model for the team right now (disconnected, off for the team or out of usage). An administrator has to link or enable one in Studio (AI accounts), or change the role's model in the harness.`]},harness_profile_unavailable:{title:[`Harness không có model cho vai trò này`,`Harness has no model for this role`],text:[`Lượt này bắt đầu khi Harness của team không có model dùng được cho vai trò này. Quản trị viên kiểm tra Harness và tài khoản AI của team trong Studio, rồi gửi lại.`,`This run started while the team's harness had no usable model for this role. An administrator checks the team's harness and AI accounts in Studio; then send again.`]}};function Ff(e,t,n){let r=(t?Pf[t]:void 0)??Mf[e]??(e.startsWith(`company-`)?Mf[`company-failed`]:void 0);return r?{title:Af(n,r.title),text:Af(n,t===`managed-session-scope-changed`?Nf:r.text)}:null}function If(e,t){return e===`main`?`Main agent`:e===`scout`?Af(t,[`Subagent scout`,`Scout subagent`]):e===`research`?Af(t,[`Subagent research`,`Research subagent`]):e===`verify`?Af(t,[`Subagent verify`,`Verify subagent`]):Af(t,[`Subagent review`,`Review subagent`])}function Lf(e,t,n){return Ff(e,t,n)}var Rf=new Set([`company-quota`,`company-provider-limit`,`company-account`,`company-busy`,`company-trial-limit`,`company-key`,`company-policy`,`company-rejected`,`company-unreachable`,`company-service`,`company-config-changed`,`company-failed`]);function zf(e){return Rf.has(e)||!e.startsWith(`company-`)}function Bf(e,t){return If(e,t)}var Vf=jf,Hf={"session-revision-stale":[`Danh sách cuộc trò chuyện vừa thay đổi. Gửi lại tin nhắn.`,`The conversation list just changed. Send the message again.`],"catalog-unavailable":[`Danh sách cuộc trò chuyện chưa tải xong. Thử lại sau vài giây.`,`The conversation list has not loaded yet. Try again in a few seconds.`],"session-model-mismatch":[`Cuộc trò chuyện đã tạo nhưng đang dùng model khác model đã chọn, nên tin nhắn chưa được gửi.`,`The conversation was created with a different model than the one chosen, so the message was not sent.`],"gateway-command-response-timeout":[`Piagent chưa xác nhận được cuộc trò chuyện mới sau 2 phút; nó có thể đã được tạo và đang chạy. Xem danh sách cuộc trò chuyện bên trái trước khi gửi lại.`,`Piagent could not confirm the new conversation within 2 minutes; it may have been created and be running. Check the conversation list before sending again.`],"session-command-expired":[`Yêu cầu chờ quá lâu nên đã hết hạn. Gửi lại tin nhắn.`,`The request waited too long and expired. Send the message again.`]};function Uf(e,t){let n=e.startsWith(`company-`)?Lf(e,null,t):null;if(n)return`${n.title}: ${n.text}`;let r=Hf[e]??Vf[e];return r?D(t,...r):`${D(t,`Chưa tạo được cuộc trò chuyện`,`The conversation could not be created`)} (${e}).`}function Wf(e,t){let n=Vf[e?.reasonCode??``];return n?D(t,...n):null}var Gf=(e,t)=>e?.state===`connecting`?D(t,`Đang kết nối phiên công ty…`,`Connecting the company runtime…`):Wf(e,t)??D(t,`Chưa kết nối phiên công ty. Bấm để kết nối.`,`The company runtime is not connected. Select to connect.`);function Kf({locale:e,onConnected:t}){let[n,r]=(0,Y.useState)(),[i,a]=(0,Y.useState)(!1),o=(0,Y.useRef)(!1),s=()=>{o.current&&(o.current=!1,t())};if((0,Y.useEffect)(()=>{let e=!0,t=()=>void ws().then(t=>{e&&(r(t),t?.state===`ready`?s():t&&(o.current=!0))}).catch(()=>void 0);t();let n=window.setInterval(t,5e3);return()=>{e=!1,window.clearInterval(n)}},[]),!n||n.state===`ready`||n.state===`unconfigured`)return null;let c=async()=>{a(!0);try{let e=await Ts();r(e),e.state===`ready`&&s()}catch{r(await ws().catch(()=>null)??n)}finally{a(!1)}},l=Wf(n,e),u=i||n.state===`connecting`;return(0,X.jsxs)(ut,{severity:`warning`,role:`status`,sx:{mb:2},action:(0,X.jsx)(J,{color:`inherit`,size:`small`,disabled:u,onClick:()=>void c(),sx:{whiteSpace:`nowrap`},children:u?D(e,`Đang kết nối…`,`Connecting…`):D(e,`Kết nối lại`,`Reconnect`)}),children:[D(e,`Chế độ công ty đang tắt nên chưa đọc hay gửi tiếp được cuộc trò chuyện này. Bấm Kết nối lại; macOS có thể hỏi quyền đọc key một lần.`,`Company mode is not running, so this conversation cannot be read or continued yet. Select Reconnect; macOS may ask once to read the key.`),l&&(0,X.jsxs)(X.Fragment,{children:[` `,l]})]})}var qf=K((0,X.jsx)(`path`,{d:`M10.67 21c-.35 0-.62-.31-.57-.66L11 14H7.5c-.88 0-.33-.75-.31-.78 1.26-2.23 3.15-5.53 5.65-9.93.1-.18.3-.29.5-.29.35 0 .62.31.57.66l-.9 6.34h3.51c.4 0 .62.19.4.66-3.29 5.74-5.2 9.09-5.75 10.05-.1.18-.29.29-.5.29`}),`BoltRounded`),Jf=K((0,X.jsx)(`path`,{d:`M13 3.87v.02c0 .67.45 1.23 1.08 1.43C16.93 6.21 19 8.86 19 12c0 .52-.06 1.01-.17 1.49-.14.64.12 1.3.69 1.64l.01.01c.86.5 1.98.05 2.21-.91.17-.72.26-1.47.26-2.23 0-4.5-2.98-8.32-7.08-9.57-.95-.29-1.92.44-1.92 1.44m-2.06 15.05c-2.99-.43-5.42-2.86-5.86-5.84-.54-3.6 1.66-6.77 4.83-7.76.64-.19 1.09-.76 1.09-1.43v-.02c0-1-.97-1.73-1.93-1.44-4.51 1.38-7.66 5.86-6.98 10.96.59 4.38 4.13 7.92 8.51 8.51 3.14.42 6.04-.61 8.13-2.53.74-.68.61-1.89-.26-2.39-.58-.34-1.3-.23-1.8.22-1.47 1.34-3.51 2.05-5.73 1.72`}),`DataUsageRounded`),Yf=K((0,X.jsx)(`path`,{d:`M8.4 18.2c.38.5.6 1.12.6 1.8 0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3c.44 0 .85.09 1.23.26l1.41-1.77c-.92-1.03-1.29-2.39-1.09-3.69l-2.03-.68c-.54.83-1.46 1.38-2.52 1.38-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3c0 .07 0 .14-.01.21l2.03.68c.64-1.21 1.82-2.09 3.22-2.32V5.91C9.96 5.57 9 4.4 9 3c0-1.66 1.34-3 3-3s3 1.34 3 3c0 1.4-.96 2.57-2.25 2.91v2.16c1.4.23 2.58 1.11 3.22 2.32L18 9.71V9.5c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3c-1.06 0-1.98-.55-2.52-1.37l-2.03.68c.2 1.29-.16 2.65-1.09 3.69l1.41 1.77Q17.34 17 18 17c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3c0-.68.22-1.3.6-1.8l-1.41-1.77c-1.35.75-3.01.76-4.37 0z`}),`HubRounded`),Xf=K((0,X.jsx)(`path`,{d:`M15.5 13.5c0 2-2.5 3.5-2.5 5h-2c0-1.5-2.5-3-2.5-5 0-1.93 1.57-3.5 3.5-3.5s3.5 1.57 3.5 3.5m-2.5 6h-2V21h2zm6-6.5c0 1.68-.59 3.21-1.58 4.42l1.42 1.42C20.18 17.27 21 15.23 21 13c0-2.74-1.23-5.19-3.16-6.84l-1.42 1.42C17.99 8.86 19 10.82 19 13m-3-8-4-4v3c-4.97 0-9 4.03-9 9 0 2.23.82 4.27 2.16 5.84l1.42-1.42C5.59 16.21 5 14.68 5 13c0-3.86 3.14-7 7-7v3z`}),`ModelTrainingOutlined`),Zf=K((0,X.jsx)(`path`,{d:`M12 2 4 5v6.09c0 5.05 3.41 9.76 8 10.91 4.59-1.15 8-5.86 8-10.91V5zm6 9.09c0 4-2.55 7.7-6 8.83-3.45-1.13-6-4.82-6-8.83v-4.7l6-2.25 6 2.25z`}),`ShieldOutlined`);function Qf(e){return M(`MuiListItem`,e)}g(`MuiListItem`,[`root`,`dense`,`alignItemsFlexStart`,`divider`,`gutters`,`padding`,`secondaryAction`]);function $f(e){return M(`MuiListItemSecondaryAction`,e)}g(`MuiListItemSecondaryAction`,[`root`,`disableGutters`]);var ep=e=>{let{disableGutters:t,classes:n}=e;return B({root:[`root`,t&&`disableGutters`]},$f,n)},tp=W(`div`,{name:`MuiListItemSecondaryAction`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.disableGutters&&t.disableGutters]}})({position:`absolute`,right:16,top:`50%`,transform:`translateY(-50%)`,variants:[{props:({ownerState:e})=>e.disableGutters,style:{right:0}}]}),np=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiListItemSecondaryAction`}),{className:r,component:i,...a}=n,o=Y.useContext(ce),s={...n,disableGutters:o.disableGutters},c=ep(s);return(0,X.jsx)(tp,{as:i,className:P(c.root,r),ownerState:s,ref:t,...a})});np.muiName=`ListItemSecondaryAction`;var rp=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.alignItems===`flex-start`&&t.alignItemsFlexStart,n.divider&&t.divider,!n.disableGutters&&t.gutters,!n.disablePadding&&t.padding]},ip=e=>{let{alignItems:t,classes:n,dense:r,disableGutters:i,disablePadding:a,divider:o}=e;return B({root:[`root`,r&&`dense`,!i&&`gutters`,!a&&`padding`,o&&`divider`,t===`flex-start`&&`alignItemsFlexStart`],secondaryAction:[`secondaryAction`]},Qf,n)},ap=W(`div`,{name:`MuiListItem`,slot:`Root`,overridesResolver:rp})(V(({theme:e})=>({display:`flex`,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,width:`100%`,boxSizing:`border-box`,textAlign:`left`,variants:[{props:({ownerState:e})=>!e.disablePadding,style:{paddingTop:8,paddingBottom:8}},{props:({ownerState:e})=>!e.disablePadding&&e.dense,style:{paddingTop:4,paddingBottom:4}},{props:({ownerState:e})=>!e.disablePadding&&!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>!e.disablePadding&&!!e.secondaryAction,style:{paddingRight:48}},{props:({ownerState:e})=>!!e.secondaryAction,style:{[`& > .${bn.root}`]:{paddingRight:48}}},{props:{alignItems:`flex-start`},style:{alignItems:`flex-start`}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:({ownerState:e})=>e.button,style:{...Be(e,`background-color`,{duration:e.transitions.duration.shortest}),"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}}}}]}))),op=W(np,{name:`MuiListItem`,slot:`secondaryAction`})({}),sp=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiListItem`}),{alignItems:r=`center`,children:i,className:a,component:o=`li`,dense:s=!1,disableGutters:c=!1,disablePadding:l=!1,divider:u=!1,secondaryAction:d,slotProps:f={},slots:p={},...m}=n,h=Y.useContext(ce),g=Y.useMemo(()=>({dense:s||h.dense||!1,alignItems:r,disableGutters:c}),[r,h.dense,s,c]),_={...n,alignItems:r,dense:g.dense,disableGutters:c,disablePadding:l,divider:u,secondaryAction:d},v=ip(_),y={slots:p,slotProps:f},[b,x]=nt(`root`,{ref:t,elementType:ap,externalForwardedProps:{component:o,...y,...m},ownerState:_,className:P(v.root,a)}),[S,C]=nt(`secondaryAction`,{elementType:op,shouldForwardComponentProp:!0,externalForwardedProps:y,ownerState:_,className:v.secondaryAction});return(0,X.jsx)(ce.Provider,{value:g,children:(0,X.jsxs)(b,{...x,children:[i,d&&(0,X.jsx)(S,{...C,children:d})]})})}),cp=(e,t)=>{let{ownerState:n}=e;return[t.root,n.dense&&t.dense,n.divider&&t.divider,!n.disableGutters&&t.gutters]},lp=e=>{let{disabled:t,dense:n,divider:r,disableGutters:i,selected:a,classes:o}=e,s=B({root:[`root`,n&&`dense`,t&&`disabled`,!i&&`gutters`,r&&`divider`,a&&`selected`]},xn,o);return{...o,...s}},up=W(We,{shouldForwardProp:e=>Ae(e)||e===`classes`,name:`MuiMenuItem`,slot:`Root`,overridesResolver:cp})(V(({theme:e})=>({...e.typography.body1,display:`flex`,justifyContent:`flex-start`,alignItems:`center`,position:`relative`,textDecoration:`none`,minHeight:48,paddingTop:6,paddingBottom:6,boxSizing:`border-box`,whiteSpace:`nowrap`,"&:hover":{textDecoration:`none`,backgroundColor:(e.vars||e).palette.action.hover,"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${Sn.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),[`&.${Sn.focusVisible}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.focusOpacity}`)}},[`&.${Sn.selected}:hover`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`),"@media (hover: none)":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity)}},[`&.${Sn.focusVisible}`]:{backgroundColor:(e.vars||e).palette.action.focus},[`&.${Sn.disabled}`]:{opacity:(e.vars||e).palette.action.disabledOpacity},[`& + .${ar.root}`]:{marginTop:e.spacing(1),marginBottom:e.spacing(1)},[`& + .${ar.inset}`]:{marginLeft:52},[`& .${Lr.root}`]:{marginTop:0,marginBottom:0},[`& .${Lr.inset}`]:{paddingLeft:36},[`& .${Mr.root}`]:{minWidth:36},variants:[{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.divider,style:{borderBottom:`1px solid ${(e.vars||e).palette.divider}`,backgroundClip:`padding-box`}},{props:({ownerState:e})=>!e.dense,style:{[e.breakpoints.up(`sm`)]:{minHeight:`auto`}}},{props:({ownerState:e})=>e.dense,style:{minHeight:32,paddingTop:4,paddingBottom:4,...e.typography.body2,[`& .${Mr.root} svg`]:{fontSize:`1.25rem`}}}]}))),dp=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiMenuItem`}),{autoFocus:r=!1,component:i=`li`,dense:a=!1,divider:o=!1,disableGutters:s=!1,focusVisibleClassName:c,role:l=`menuitem`,tabIndex:u,className:d,...f}=n,p=l===`menuitemcheckbox`||l===`menuitemradio`?!!n.selected:void 0,m=de(),h=Y.useContext(ce),g=Y.useMemo(()=>({dense:a||h.dense||!1,disableGutters:s}),[h.dense,a,s]),_=ie(),v=Ge(),y=_.suppressInitialFocusVisible,b=_.itemsFocusableWhenDisabled,x=Y.useRef(null);ft(()=>{r&&x.current&&ye(x.current,m)},[r]);let S={...n,dense:g.dense,divider:o,disableGutters:s},C=lp(n),{root:w,...T}=C,E=it({id:v,ref:t,disabled:n.disabled,focusableWhenDisabled:b,selected:n.selected}),D=Ke(x,E.ref),O;return u===void 0?_.variant===`selectedMenu`?O=E.tabIndex:(!n.disabled||b)&&(O=-1):O=u,(0,X.jsx)(ce.Provider,{value:g,children:(0,X.jsx)(up,{ref:D,role:l,"aria-checked":p,tabIndex:O,component:i,internalNativeButton:!1,focusableWhenDisabled:b,suppressFocusVisible:y,focusVisibleClassName:P(C.focusVisible,c),className:P(C.root,d),...f,ownerState:S,classes:T})})});function fp(e={}){let{autoHideDuration:t=null,disableWindowBlurListener:n=!1,onClose:r,open:i,resumeHideDuration:a}=e,o=He();Y.useEffect(()=>{if(!i)return;function e(e){e.defaultPrevented||e.key===`Escape`&&r?.(e,`escapeKeyDown`)}return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[i,r]);let s=qe((e,t)=>{r?.(e,t)}),c=qe(e=>{!r||e==null||o.start(e,()=>{s(null,`timeout`)})});Y.useEffect(()=>(i&&c(t),o.clear),[i,t,c,o]);let l=e=>{r?.(e,`clickaway`)},u=o.clear,d=Y.useCallback(()=>{t!=null&&c(a??t*.5)},[t,a,c]),f=e=>t=>{let n=e.onBlur;n?.(t),d()},p=e=>t=>{let n=e.onFocus;n?.(t),u()},m=e=>t=>{let n=e.onMouseEnter;n?.(t),u()},h=e=>t=>{let n=e.onMouseLeave;n?.(t),d()};return Y.useEffect(()=>{if(!n&&i)return window.addEventListener(`focus`,d),window.addEventListener(`blur`,u),()=>{window.removeEventListener(`focus`,d),window.removeEventListener(`blur`,u)}},[n,i,d,u]),{getRootProps:(t={})=>{let n={...Ze(e),...Ze(t)};return{role:`presentation`,...t,...n,onBlur:f(n),onFocus:p(n),onMouseEnter:m(n),onMouseLeave:h(n)}},onClickAway:l}}function pp(e){return e.substring(2).toLowerCase()}function mp(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}function hp(e){let{children:t,disableReactTree:n=!1,mouseEvent:r=`onClick`,onClickAway:i,touchEvent:a=`onTouchEnd`}=e,o=Y.useRef(!1),s=Y.useRef(null),c=Y.useRef(!1),l=Y.useRef(!1);Y.useEffect(()=>(setTimeout(()=>{c.current=!0},0),()=>{c.current=!1}),[]);let u=ke(L(t),s),d=qe(e=>{let t=l.current;l.current=!1;let r=Je(s.current);if(!c.current||!s.current||`clientX`in e&&mp(e,r))return;if(o.current){o.current=!1;return}let a;a=e.composedPath?e.composedPath().includes(s.current):!ct(r.documentElement,e.target)||ct(s.current,e.target),!a&&(n||!t)&&i(e)}),f=e=>n=>{l.current=!0;let r=t.props[e];r&&r(n)},p={ref:u};return a!==!1&&(p[a]=f(a)),Y.useEffect(()=>{if(a!==!1){let e=pp(a),t=Je(s.current),n=()=>{o.current=!0};return t.addEventListener(e,d),t.addEventListener(`touchmove`,n),()=>{t.removeEventListener(e,d),t.removeEventListener(`touchmove`,n)}}},[d,a]),r!==!1&&(p[r]=f(r)),Y.useEffect(()=>{if(r!==!1){let e=pp(r),t=Je(s.current);return t.addEventListener(e,d),()=>{t.removeEventListener(e,d)}}},[d,r]),Y.cloneElement(t,p)}function gp(e){return M(`MuiSnackbarContent`,e)}g(`MuiSnackbarContent`,[`root`,`message`,`action`]);var _p=e=>{let{classes:t}=e;return B({root:[`root`],action:[`action`],message:[`message`]},gp,t)},vp=W(ht,{name:`MuiSnackbarContent`,slot:`Root`})(V(({theme:e})=>{let t=e.palette.mode===`light`?.8:.98;return{...e.typography.body2,color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(x(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:x(e.palette.background.default,t),display:`flex`,alignItems:`center`,flexWrap:`wrap`,padding:`6px 16px`,flexGrow:1,[e.breakpoints.up(`sm`)]:{flexGrow:`initial`,minWidth:288}}})),yp=W(`div`,{name:`MuiSnackbarContent`,slot:`Message`})({padding:`8px 0`}),bp=W(`div`,{name:`MuiSnackbarContent`,slot:`Action`})({display:`flex`,alignItems:`center`,marginLeft:`auto`,paddingLeft:16,marginRight:-8}),xp=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiSnackbarContent`}),{action:r,className:i,message:a,role:o=`alert`,...s}=n,c=n,l=_p(c);return(0,X.jsxs)(vp,{role:o,elevation:6,className:P(l.root,i),ownerState:c,ref:t,...s,children:[(0,X.jsx)(yp,{className:l.message,ownerState:c,children:a}),r?(0,X.jsx)(bp,{className:l.action,ownerState:c,children:r}):null]})});function Sp(e){return M(`MuiSnackbar`,e)}g(`MuiSnackbar`,[`root`,`anchorOriginTopCenter`,`anchorOriginBottomCenter`,`anchorOriginTopRight`,`anchorOriginBottomRight`,`anchorOriginTopLeft`,`anchorOriginBottomLeft`]);var Cp=e=>{let{classes:t,anchorOrigin:n}=e,r={root:[`root`,`anchorOrigin${G(n.vertical)}${G(n.horizontal)}`]};return B(r,Sp,t)},wp=W(`div`,{name:`MuiSnackbar`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`anchorOrigin${G(n.anchorOrigin.vertical)}${G(n.anchorOrigin.horizontal)}`]]}})(V(({theme:e})=>({zIndex:(e.vars||e).zIndex.snackbar,position:`fixed`,display:`flex`,left:8,right:8,justifyContent:`center`,alignItems:`center`,variants:[{props:({ownerState:e})=>e.anchorOrigin.vertical===`top`,style:{top:8,[e.breakpoints.up(`sm`)]:{top:24}}},{props:({ownerState:e})=>e.anchorOrigin.vertical!==`top`,style:{bottom:8,[e.breakpoints.up(`sm`)]:{bottom:24}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`left`,style:{justifyContent:`flex-start`,[e.breakpoints.up(`sm`)]:{left:24,right:`auto`}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`right`,style:{justifyContent:`flex-end`,[e.breakpoints.up(`sm`)]:{right:24,left:`auto`}}},{props:({ownerState:e})=>e.anchorOrigin.horizontal===`center`,style:{[e.breakpoints.up(`sm`)]:{left:`50%`,right:`auto`,transform:`translateX(-50%)`}}}]}))),Tp=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiSnackbar`}),r=y(),i={enter:r.transitions.duration.enteringScreen,exit:r.transitions.duration.leavingScreen},{action:a,anchorOrigin:{vertical:o,horizontal:s}={vertical:`bottom`,horizontal:`left`},autoHideDuration:c=null,children:l,className:u,disableWindowBlurListener:d=!1,message:f,onBlur:p,onClose:m,onFocus:h,onMouseEnter:g,onMouseLeave:_,open:v,resumeHideDuration:b,slots:x={},slotProps:S={},transitionDuration:C=i,...w}=n,T={...n,anchorOrigin:{vertical:o,horizontal:s},autoHideDuration:c,disableWindowBlurListener:d,transitionDuration:C},E=Cp(T),{getRootProps:D,onClickAway:O}=fp(T),[k,A]=Y.useState(!0),j={slots:x,slotProps:S},[M,N]=nt(`root`,{ref:t,className:[E.root,u],elementType:wp,getSlotProps:D,externalForwardedProps:{...j,...w},ownerState:T}),[P,{ownerState:F,...I}]=nt(`clickAwayListener`,{elementType:hp,externalForwardedProps:j,getSlotProps:e=>({onClickAway:(...t)=>{let n=t[0];e.onClickAway?.(...t),!n?.defaultMuiPrevented&&O(...t)}}),ownerState:T}),[ee,te]=nt(`content`,{elementType:xp,shouldForwardComponentProp:!0,externalForwardedProps:j,additionalProps:{message:f,action:a},ownerState:T}),[L,ne]=nt(`transition`,{elementType:he,externalForwardedProps:j,getSlotProps:e=>({onEnter:(...t)=>{e.onEnter?.(...t),A(!1)},onExited:(...t)=>{e.onExited?.(...t),A(!0)}}),additionalProps:{appear:!0,in:v,timeout:C,direction:o===`top`?`down`:`up`},ownerState:T});return!v&&k?null:(0,X.jsx)(P,{...I,...x.clickAwayListener&&{ownerState:F},children:(0,X.jsx)(M,{...N,children:(0,X.jsx)(L,{...ne,children:l||(0,X.jsx)(ee,{...te})})})})}),Ep=K((0,X.jsx)(`path`,{d:`m19.46 8 .79-1.75L22 5.46c.39-.18.39-.73 0-.91l-1.75-.79L19.46 2c-.18-.39-.73-.39-.91 0l-.79 1.75-1.76.79c-.39.18-.39.73 0 .91l1.75.79.79 1.76c.18.39.74.39.92 0M11.5 9.5 9.91 6c-.35-.78-1.47-.78-1.82 0L6.5 9.5 3 11.09c-.78.36-.78 1.47 0 1.82l3.5 1.59L8.09 18c.36.78 1.47.78 1.82 0l1.59-3.5 3.5-1.59c.78-.36.78-1.47 0-1.82zm7.04 6.5-.79 1.75-1.75.79c-.39.18-.39.73 0 .91l1.75.79.79 1.76c.18.39.73.39.91 0l.79-1.75 1.76-.79c.39-.18.39-.73 0-.91l-1.75-.79-.79-1.76c-.18-.39-.74-.39-.92 0`}),`AutoAwesomeRounded`),Dp=K((0,X.jsx)(`path`,{d:`M12 6c2.62 0 4.88 1.86 5.39 4.43l.3 1.5 1.53.11c1.56.1 2.78 1.41 2.78 2.96 0 1.65-1.35 3-3 3H6c-2.21 0-4-1.79-4-4 0-2.05 1.53-3.76 3.56-3.97l1.07-.11.5-.95C8.08 7.14 9.94 6 12 6m0-2C9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96C18.67 6.59 15.64 4 12 4`}),`CloudOutlined`),Op=K((0,X.jsx)(`path`,{d:`M8.7 15.9 4.8 12l3.9-3.9c.39-.39.39-1.01 0-1.4a.984.984 0 0 0-1.4 0l-4.59 4.59c-.39.39-.39 1.02 0 1.41l4.59 4.6c.39.39 1.01.39 1.4 0s.39-1.01 0-1.4m6.6 0 3.9-3.9-3.9-3.9a.984.984 0 0 1 0-1.4c.39-.39 1.01-.39 1.4 0l4.59 4.59c.39.39.39 1.02 0 1.41l-4.59 4.6c-.39.39-1.01.39-1.4 0a.984.984 0 0 1 0-1.4`}),`CodeRounded`),kp=K((0,X.jsx)(`path`,{d:`M7 5h10v1c0 .55.45 1 1 1s1-.45 1-1V3c0-1.1-.9-1.99-2-1.99L7 1c-1.1 0-2 .9-2 2v3c0 .55.45 1 1 1s1-.45 1-1zm9.12 10.88 3.17-3.17c.39-.39.39-1.02 0-1.41l-3.17-3.17c-.39-.39-1.03-.39-1.42 0s-.39 1.02 0 1.41L17.17 12l-2.47 2.47c-.39.39-.39 1.02 0 1.41s1.03.39 1.42 0m-6.83-1.42L6.83 12l2.46-2.46c.39-.39.39-1.02 0-1.41s-1.03-.39-1.42 0L4.7 11.3c-.39.39-.39 1.02 0 1.41l3.17 3.17c.39.39 1.03.39 1.42 0 .4-.39.39-1.03 0-1.42M17 19H7v-1c0-.55-.45-1-1-1s-1 .45-1 1v3c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2v-3c0-.55-.45-1-1-1s-1 .45-1 1z`}),`DeveloperModeRounded`),Ap=K((0,X.jsx)(`path`,{d:`M10.59 4.59C10.21 4.21 9.7 4 9.17 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z`}),`FolderRounded`),jp=K((0,X.jsx)(`path`,{d:`M12 1.27a11 11 0 00-3.48 21.46c.55.09.73-.28.73-.55v-1.84c-3.03.64-3.67-1.46-3.67-1.46-.55-1.29-1.28-1.65-1.28-1.65-.92-.65.1-.65.1-.65 1.1 0 1.73 1.1 1.73 1.1.92 1.65 2.57 1.2 3.21.92a2 2 0 01.64-1.47c-2.47-.27-5.04-1.19-5.04-5.5 0-1.1.46-2.1 1.2-2.84a3.76 3.76 0 010-2.93s.91-.28 3.11 1.1c1.8-.49 3.7-.49 5.5 0 2.1-1.38 3.02-1.1 3.02-1.1a3.76 3.76 0 010 2.93c.83.74 1.2 1.74 1.2 2.94 0 4.21-2.57 5.13-5.04 5.4.45.37.82.92.82 2.02v3.03c0 .27.1.64.73.55A11 11 0 0012 1.27`}),`GitHub`),Mp=K((0,X.jsx)(`path`,{d:`M4 20h16c1.1 0 2-.9 2-2s-.9-2-2-2H4c-1.1 0-2 .9-2 2s.9 2 2 2m0-3h2v2H4zM2 6c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2s-.9-2-2-2H4c-1.1 0-2 .9-2 2m4 1H4V5h2zm-2 7h16c1.1 0 2-.9 2-2s-.9-2-2-2H4c-1.1 0-2 .9-2 2s.9 2 2 2m0-3h2v2H4z`}),`StorageRounded`),Np={anthropic:`#d97757`,claude:`#d97757`,context7:`#7456f1`,chrome:`#4285f4`,deepseek:`#4d6bfe`,figma:`#1e1e1e`,gemini:`#4285f4`,github:`#24292f`,google:`#4285f4`,groq:`#f55036`,linear:`#5e6ad2`,mistral:`#f7a000`,notion:`#111111`,openai:`#10a37f`,slack:`#611f69`};function Pp(){return(0,X.jsxs)(`svg`,{viewBox:`0 0 24 24`,width:`1em`,height:`1em`,"aria-hidden":`true`,children:[(0,X.jsx)(`path`,{fill:`#f24e1e`,d:`M5 2h7v7H8.5A3.5 3.5 0 0 1 5 5.5V2Z`}),(0,X.jsx)(`path`,{fill:`#ff7262`,d:`M12 2h3.5a3.5 3.5 0 1 1 0 7H12V2Z`}),(0,X.jsx)(`path`,{fill:`#a259ff`,d:`M5 9h7v7H8.5A3.5 3.5 0 0 1 5 12.5V9Z`}),(0,X.jsx)(`circle`,{cx:`15.5`,cy:`12.5`,r:`3.5`,fill:`#1abcfe`}),(0,X.jsx)(`path`,{fill:`#0acf83`,d:`M5 16h7v3.5A3.5 3.5 0 1 1 5 16Z`})]})}function Fp(e){let t=e.toLowerCase();return t.includes(`figma`)?(0,X.jsx)(Pp,{}):t.includes(`github`)?(0,X.jsx)(jp,{fontSize:`inherit`}):t.includes(`chrome`)||t.includes(`devtools`)?(0,X.jsx)(kp,{fontSize:`inherit`}):t.includes(`anthropic`)||t.includes(`claude`)?(0,X.jsx)(Ep,{fontSize:`inherit`}):t.includes(`file`)||t.includes(`folder`)?(0,X.jsx)(Ap,{fontSize:`inherit`}):t.includes(`postgres`)||t.includes(`database`)||t.includes(`supabase`)?(0,X.jsx)(Mp,{fontSize:`inherit`}):t.includes(`code`)||t.includes(`context7`)?(0,X.jsx)(Op,{fontSize:`inherit`}):t.includes(`google`)||t.includes(`drive`)||t.includes(`cloud`)?(0,X.jsx)(Dp,{fontSize:`inherit`}):(0,X.jsx)(Yf,{fontSize:`inherit`})}function Ip({name:e,size:t=34}){let n=e.toLowerCase(),r=Object.keys(Np).find(e=>n.includes(e));return(0,X.jsx)(Z,{"aria-hidden":`true`,sx:{width:t,height:t,flex:`0 0 ${t}px`,display:`grid`,placeItems:`center`,borderRadius:t>30?2:1.4,bgcolor:r?Np[r]:`action.selected`,color:r?`#fff`:`text.secondary`,fontSize:Math.round(t*.52),border:1,borderColor:r?`transparent`:`divider`},children:Fp(e)})}var Lp=K((0,X.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m3.88-11.71L10 14.17l-1.88-1.88a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l2.59 2.59c.39.39 1.02.39 1.41 0L17.3 9.7c.39-.39.39-1.02 0-1.41s-1.03-.39-1.42 0`}),`CheckCircleOutlineRounded`),Rp=K((0,X.jsx)(`path`,{d:`M18 19H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h5c.55 0 1-.45 1-1s-.45-1-1-1H5c-1.11 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6c0-.55-.45-1-1-1s-1 .45-1 1v5c0 .55-.45 1-1 1M14 4c0 .55.45 1 1 1h2.59l-9.13 9.13c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0L19 6.41V9c0 .55.45 1 1 1s1-.45 1-1V3h-6c-.55 0-1 .45-1 1`}),`LaunchRounded`);function zp(e){return M(`MuiDialogActions`,e)}g(`MuiDialogActions`,[`root`,`spacing`]);var Bp=e=>{let{classes:t,disableSpacing:n}=e;return B({root:[`root`,!n&&`spacing`]},zp,t)},Vp=W(`div`,{name:`MuiDialogActions`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.disableSpacing&&t.spacing]}})({display:`flex`,alignItems:`center`,padding:8,justifyContent:`flex-end`,flex:`0 0 auto`,variants:[{props:({ownerState:e})=>!e.disableSpacing,style:{"& > :not(style) ~ :not(style)":{marginLeft:8}}}]}),Hp=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiDialogActions`}),{className:r,disableSpacing:i=!1,...a}=n,o={...n,disableSpacing:i},s=Bp(o);return(0,X.jsx)(Vp,{className:P(s.root,r),ownerState:o,ref:t,...a})});function Up(e){return M(`PrivateSwitchBase`,e)}g(`PrivateSwitchBase`,[`root`,`checked`,`disabled`,`input`,`edgeStart`,`edgeEnd`]);var Wp=e=>{let{classes:t,checked:n,disabled:r,edge:i}=e,a={root:[`root`,n&&`checked`,r&&`disabled`,i&&`edge${G(i)}`],input:[`input`]};return B(a,Up,t)},Gp=W(We,{name:`MuiSwitchBase`})({padding:9,borderRadius:`50%`,variants:[{props:{edge:`start`,size:`small`},style:{marginLeft:-3}},{props:({edge:e,ownerState:t})=>e===`start`&&t.size!==`small`,style:{marginLeft:-12}},{props:{edge:`end`,size:`small`},style:{marginRight:-3}},{props:({edge:e,ownerState:t})=>e===`end`&&t.size!==`small`,style:{marginRight:-12}}]}),Kp=W(`input`,{name:`MuiSwitchBase`,shouldForwardProp:Ae})({cursor:`inherit`,position:`absolute`,opacity:0,width:`100%`,height:`100%`,top:0,left:0,margin:0,padding:0,zIndex:1}),qp=Y.forwardRef(function(e,t){let{autoFocus:n,checked:r,checkedIcon:i,defaultChecked:a,disabled:o,disableFocusRipple:s=!1,edge:c=!1,icon:l,id:u,name:d,onBlur:f,onChange:p,onFocus:m,readOnly:h,required:g=!1,tabIndex:_,type:v,value:y,slots:b={},slotProps:x={},...S}=e,{nativeButton:C,...w}=S,[T,E]=R({controlled:r,default:!!a,name:`SwitchBase`,state:`checked`}),D=xe(),O=e=>{m&&m(e),D&&D.onFocus&&D.onFocus(e)},k=e=>{f&&f(e),D&&D.onBlur&&D.onBlur(e)},A=e=>{if(e.nativeEvent.defaultPrevented||h)return;let t=e.target.checked;E(t),p&&p(e,t)},j=o;D&&j===void 0&&(j=D.disabled);let M=v===`checkbox`||v===`radio`,N={...e,checked:T,disabled:j,disableFocusRipple:s,edge:c},P=Wp(N),F={slots:b,slotProps:x},[I,ee]=nt(`root`,{ref:t,elementType:Gp,className:P.root,shouldForwardComponentProp:!0,externalForwardedProps:{...F,component:`span`,...w},getSlotProps:e=>({...e,onFocus:t=>{e.onFocus?.(t),O(t)},onBlur:t=>{e.onBlur?.(t),k(t)}}),ownerState:N,additionalProps:{centerRipple:!0,focusRipple:!s,role:void 0,tabIndex:null}}),[te,L]=nt(`input`,{elementType:Kp,className:P.input,externalForwardedProps:F,getSlotProps:e=>({...e,onChange:t=>{e.onChange?.(t),A(t)}}),ownerState:N,additionalProps:{autoFocus:n,checked:r,defaultChecked:a,disabled:j,id:M?u:void 0,name:d,readOnly:h,required:g,tabIndex:_,type:v,...v===`checkbox`&&y===void 0?{}:{value:y}}});return(0,X.jsxs)(I,{...ee,children:[(0,X.jsx)(te,{...L}),T?i:l]})});function Jp(e){return M(`MuiSwitch`,e)}var Yp=g(`MuiSwitch`,[`root`,`edgeStart`,`edgeEnd`,`switchBase`,`colorPrimary`,`colorSecondary`,`sizeSmall`,`sizeMedium`,`checked`,`disabled`,`input`,`thumb`,`track`]),Xp=e=>{let{classes:t,edge:n,size:r,color:i,checked:a,disabled:o}=e,s={root:[`root`,n&&`edge${G(n)}`,`size${G(r)}`],switchBase:[`switchBase`,`color${G(i)}`,a&&`checked`,o&&`disabled`],thumb:[`thumb`],track:[`track`],input:[`input`]},c=B(s,Jp,t);return{...t,...c}},Zp=W(`span`,{name:`MuiSwitch`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.edge&&t[`edge${G(n.edge)}`],t[`size${G(n.size)}`]]}})({display:`inline-flex`,width:58,height:38,overflow:`hidden`,padding:12,boxSizing:`border-box`,position:`relative`,flexShrink:0,zIndex:0,verticalAlign:`middle`,"@media print":{colorAdjust:`exact`},variants:[{props:{edge:`start`},style:{marginLeft:-8}},{props:{edge:`end`},style:{marginRight:-8}},{props:{size:`small`},style:{width:40,height:24,padding:7,[`& .${Yp.thumb}`]:{width:16,height:16},[`& .${Yp.switchBase}`]:{padding:4,[`&.${Yp.checked}`]:{transform:`translateX(16px)`}}}}]}),Qp=W(qp,{name:`MuiSwitch`,slot:`SwitchBase`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.switchBase,{[`& .${Yp.input}`]:t.input},n.color!=="default"&&t[`color${G(n.color)}`]]}})(V(({theme:e})=>({position:`absolute`,top:0,left:0,zIndex:1,color:e.vars?e.vars.palette.Switch.defaultColor:`${e.palette.mode===`light`?e.palette.common.white:e.palette.grey[300]}`,...Be(e,[`left`,`transform`],{duration:e.transitions.duration.shortest}),[`&.${Yp.checked}`]:{transform:`translateX(20px)`},[`&.${Yp.disabled}`]:{color:e.vars?e.vars.palette.Switch.defaultDisabledColor:`${e.palette.mode===`light`?e.palette.grey[100]:e.palette.grey[600]}`},[`&.${Yp.checked} + .${Yp.track}`]:{opacity:.5},[`&.${Yp.disabled} + .${Yp.track}`]:{opacity:e.vars?e.vars.opacity.switchTrackDisabled:`${e.palette.mode===`light`?.12:.2}`},[`& .${Yp.input}`]:{left:`-100%`,width:`300%`}})),V(({theme:e})=>({"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:`transparent`}},variants:[...Object.entries(e.palette).filter(U([`light`])).map(([t])=>({props:{color:t},style:{[`&.${Yp.checked}`]:{color:(e.vars||e).palette[t].main,"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[t].main,(e.vars||e).palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:`transparent`}},[`&.${Yp.disabled}`]:{color:e.vars?e.vars.palette.Switch[`${t}DisabledColor`]:`${e.palette.mode===`light`?e.lighten(e.palette[t].main,.62):e.darken(e.palette[t].main,.55)}`}},[`&.${Yp.checked} + .${Yp.track}`]:{backgroundColor:(e.vars||e).palette[t].main}}}))]}))),$p=W(`span`,{name:`MuiSwitch`,slot:`Track`})(V(({theme:e})=>({height:`100%`,width:`100%`,borderRadius:7,zIndex:-1,...Be(e,[`opacity`,`background-color`],{duration:e.transitions.duration.shortest}),"@media (forced-colors: active)":{boxSizing:`border-box`,border:`1px solid ButtonBorder`},backgroundColor:e.vars?e.vars.palette.common.onBackground:`${e.palette.mode===`light`?e.palette.common.black:e.palette.common.white}`,opacity:e.vars?e.vars.opacity.switchTrack:`${e.palette.mode===`light`?.38:.3}`}))),em=W(`span`,{name:`MuiSwitch`,slot:`Thumb`})(V(({theme:e})=>({boxShadow:(e.vars||e).shadows[1],backgroundColor:`currentColor`,boxSizing:`border-box`,border:`1px solid transparent`,width:20,height:20,borderRadius:`50%`}))),tm=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiSwitch`}),{className:r,color:i=`primary`,edge:a=!1,size:o=`medium`,sx:s,slots:c={},slotProps:l={},...u}=n,d={...n,color:i,edge:a,size:o},f=Xp(d),p=l.input,m={slots:c,slotProps:l},[h,g]=nt(`root`,{className:P(f.root,r),elementType:Zp,externalForwardedProps:m,ownerState:d,additionalProps:{sx:s}}),[_,v]=nt(`thumb`,{className:f.thumb,elementType:em,externalForwardedProps:m,ownerState:d}),y=(0,X.jsx)(_,{...v}),[b,x]=nt(`track`,{className:f.track,elementType:$p,externalForwardedProps:m,ownerState:d});return(0,X.jsxs)(h,{...g,children:[(0,X.jsx)(Qp,{type:`checkbox`,icon:y,checkedIcon:y,ref:t,ownerState:d,...u,classes:{...f,root:f.switchBase},slots:{...c.switchBase&&{root:c.switchBase},...c.input&&{input:c.input}},slotProps:{...l.switchBase&&{root:typeof l.switchBase==`function`?l.switchBase(d):l.switchBase},input:se(typeof p==`function`?p(d):p,{role:`switch`})}}),(0,X.jsx)(b,{...x})]})});function nm(e,t){let n=e.name.toLowerCase();return n===`figma-desktop`?D(t,`Cần bật MCP trong Figma Desktop`,`Enable MCP in Figma Desktop`):n===`figma`?e.state===`disabled`?D(t,`Remote OAuth · chưa được Figma duyệt`,`Remote OAuth · not approved by Figma`):`Remote OAuth`:`${e.transport} · ${e.scope}`}function rm(e,t,n){return e===`mcp-oauth-client-not-approved`&&t.toLowerCase()===`figma`?D(n,`Figma Remote chưa cho phép Piagent đăng ký OAuth. Có thể dùng kết nối Figma Desktop bên dưới.`,`Figma Remote has not approved Piagent as an OAuth client. You can use the Figma Desktop connection below.`):e===`mcp-oauth-client-not-approved`?D(n,`Nhà cung cấp chưa cho phép client OAuth này.`,`The provider has not approved this OAuth client.`):e===`mcp-oauth-registration-rejected`?D(n,`Nhà cung cấp từ chối đăng ký OAuth.`,`The provider rejected OAuth client registration.`):e===`mcp-oauth-cancelled`||e===`cancelled-by-user`?D(n,`Đã hủy đăng nhập.`,`Sign in cancelled.`):D(n,`Không thể kết nối OAuth. Vui lòng thử lại.`,`Could not connect OAuth. Please try again.`)}function im({sessionRef:e,connection:t,onChanged:n,compact:r=!1}){let{locale:i}=C(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{if(!s||s.state!==`running`)return;let e=new AbortController,t=window.setTimeout(()=>void Bs(s.jobRef,e.signal).then(e=>{c(e),e.state===`completed`&&n()}).catch(()=>u(D(i,`Mất kết nối OAuth`,`OAuth flow disconnected`))),750);return()=>{e.abort(),window.clearTimeout(t)}},[s?.jobRef,s?.generatedAt,s?.state,i,n]);let d=async r=>{o(!0),u(null);try{let i=await zs({action:r?`mcp.enable`:`mcp.disable`,sessionRef:e,connectionRef:t.connectionRef});`connections`in i?n(i):n()}catch{u(D(i,`Không thể cập nhật MCP`,`Could not update MCP`))}finally{o(!1)}},f=async()=>{o(!0),u(null);try{let n=await zs({action:`mcp.oauth`,sessionRef:e,connectionRef:t.connectionRef});if(`jobRef`in n)c(n);else throw Error(`mcp-oauth-job-missing`)}catch{u(D(i,`Không thể bắt đầu OAuth`,`Could not start OAuth`))}finally{o(!1)}},p=async()=>{s?.state===`running`&&await Hs(s.jobRef).catch(()=>void 0),c(void 0),u(null)};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Q,{direction:`row`,spacing:.75,sx:{alignItems:`center`,flexWrap:`wrap`,justifyContent:`flex-end`},children:[t.authState===`connected`&&(0,X.jsx)(rr,{size:`small`,color:`success`,variant:`outlined`,icon:(0,X.jsx)(Lp,{}),label:D(i,`Đã kết nối`,`Connected`)}),t.oauthSupported&&t.authState!==`connected`&&t.state!==`disabled`&&(0,X.jsx)(J,{size:`small`,variant:`outlined`,disabled:a,onClick:()=>void f(),children:`OAuth`}),t.toggleSupported&&(0,X.jsx)(bo,{title:t.state===`disabled`?D(i,`Bật ${t.name}`,`Enable ${t.name}`):D(i,`Tắt ${t.name}`,`Disable ${t.name}`),arrow:!0,children:(0,X.jsx)(`span`,{children:(0,X.jsx)(tm,{size:r?`small`:`medium`,checked:t.state!==`disabled`,disabled:a,onChange:(e,t)=>void d(t),slotProps:{input:{"aria-label":t.state===`disabled`?D(i,`Bật ${t.name}`,`Enable ${t.name}`):D(i,`Tắt ${t.name}`,`Disable ${t.name}`)}}})})})]}),l&&(0,X.jsx)(q,{role:`status`,color:`error`,variant:`caption`,children:l}),(0,X.jsxs)(ge,{open:!!s,onClose:()=>void p(),fullWidth:!0,maxWidth:`xs`,children:[(0,X.jsxs)(ve,{children:[t.name,` · OAuth`]}),(0,X.jsx)(pe,{children:(0,X.jsxs)(Q,{spacing:1.25,sx:{pt:.5},children:[s?.state===`running`&&!s.authorizationUrl&&(0,X.jsx)(q,{color:`text.secondary`,children:D(i,`Đang chuẩn bị đăng nhập…`,`Preparing sign in…`)}),s?.authorizationUrl&&(0,X.jsx)(J,{component:`a`,href:s.authorizationUrl,target:`_blank`,rel:`noopener noreferrer`,variant:`contained`,endIcon:(0,X.jsx)(Rp,{}),children:D(i,`Mở trang đăng nhập`,`Open sign in`)}),s?.state===`completed`&&(0,X.jsx)(q,{color:`success.main`,children:D(i,`Đã kết nối MCP`,`MCP connected`)}),s&&[`failed`,`cancelled`].includes(s.state)&&(0,X.jsx)(q,{color:`error`,children:rm(s.reasonCode,t.name,i)})]})}),(0,X.jsx)(Hp,{children:(0,X.jsx)(J,{color:`inherit`,onClick:()=>void p(),children:s?.state===`running`?D(i,`Hủy`,`Cancel`):D(i,`Đóng`,`Close`)})})]})]})}var am=K((0,X.jsx)(`path`,{d:`M12 5.99 19.53 19H4.47zM2.74 18c-.77 1.33.19 3 1.73 3h15.06c1.54 0 2.5-1.67 1.73-3L13.73 4.99c-.77-1.33-2.69-1.33-3.46 0zM11 11v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1m0 5h2v2h-2z`}),`WarningAmberRounded`);function om(e){return M(`MuiDialogContentText`,e)}g(`MuiDialogContentText`,[`root`]);var sm=e=>{let{classes:t}=e,n=B({root:[`root`]},om,t);return{...t,...n}},cm=W(q,{shouldForwardProp:e=>Ae(e)||e===`classes`,name:`MuiDialogContentText`,slot:`Root`})({}),lm=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiDialogContentText`}),{children:r,className:i,...a}=n,o=sm(a);return(0,X.jsx)(cm,{component:`p`,variant:`body1`,color:`textSecondary`,ref:t,ownerState:a,className:P(o.root,i),...n,classes:o})});function um({open:e,title:t,description:n,confirmLabel:r,cancelLabel:i,onConfirm:a,onCancel:o}){return(0,X.jsxs)(ge,{open:e,onClose:o,fullWidth:!0,maxWidth:`xs`,"aria-describedby":`piagent-confirm-dialog-description`,slotProps:{paper:{sx:{borderRadius:1,p:.5}}},children:[(0,X.jsxs)(ve,{sx:{display:`flex`,alignItems:`center`,gap:1.25,pb:1},children:[(0,X.jsx)(Z,{sx:{width:36,height:36,borderRadius:1,display:`grid`,placeItems:`center`,bgcolor:`warning.main`,color:`warning.contrastText`},children:(0,X.jsx)(am,{fontSize:`small`})}),(0,X.jsx)(q,{component:`span`,sx:{fontSize:`1.08rem`,fontWeight:700},children:t})]}),(0,X.jsx)(pe,{children:(0,X.jsx)(lm,{id:`piagent-confirm-dialog-description`,sx:{color:`text.secondary`,lineHeight:1.65},children:n})}),(0,X.jsxs)(Hp,{sx:{px:2.5,pb:2,gap:.75},children:[(0,X.jsx)(J,{color:`inherit`,onClick:o,autoFocus:!0,children:i}),(0,X.jsx)(J,{variant:`contained`,color:`warning`,onClick:a,children:r})]})]})}function dm({name:e,value:t}){return(0,X.jsxs)(Q,{direction:`row`,sx:{justifyContent:`space-between`,gap:3,py:.65},children:[(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:e}),(0,X.jsx)(q,{variant:`body2`,sx:{fontWeight:600},children:t})]})}var fm=(e,t)=>e?D(t,`Fast: bật`,`Fast: on`):D(t,`Fast: tắt`,`Fast: off`),pm=e=>D(e,`Fast: main agent trả lời nhanh hơn trên model GPT (Codex); token tính vào quota gấp 2,5 lần. Model và mức suy luận không đổi.`,`Fast: the main agent answers faster on GPT (Codex) models; its tokens count 2.5 times toward the quota. Model and thinking level are unchanged.`),mm={borderColor:`warning.main`,color:`warning.main`,fontWeight:700,bgcolor:e=>S(e.palette.warning.main,.14),"&:hover":{bgcolor:e=>S(e.palette.warning.main,.22),color:`warning.main`}};function hm({title:e,label:t,icon:n,active:r,badge:i,tone:a,onClick:o}){let s={border:1,borderColor:r?`primary.main`:`divider`,bgcolor:r?`action.selected`:`transparent`,color:r?`primary.main`:`text.secondary`,borderRadius:1,"&:hover":{bgcolor:`action.hover`,color:`text.primary`},...r&&a===`warning`?mm:{}},c=t?(0,X.jsx)(J,{size:`small`,"aria-label":e,onClick:o,startIcon:n,sx:{...s,minHeight:34,minWidth:{xs:34,md:64},maxWidth:260,px:{xs:.75,md:1.15},"& .MuiButton-startIcon":{mr:{xs:0,md:.65},ml:0},"& .MuiButton-startIcon svg":{fontSize:17}},children:(0,X.jsx)(Z,{component:`span`,sx:{display:{xs:`none`,md:`inline`},overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:t})}):(0,X.jsx)(et,{size:`small`,"aria-label":e,onClick:o,sx:{...s,width:34,height:34},children:n});return(0,X.jsx)(bo,{title:e,arrow:!0,children:i?(0,X.jsx)(qn,{badgeContent:i,color:`primary`,max:9999,sx:{"& .MuiBadge-badge":{height:16,minWidth:16,px:.4,fontSize:9,fontWeight:700}},children:c}):c})}function gm({session:e,snapshot:t,connections:n,locale:r,onOpenChanges:i,canSetModel:a,canSetThinking:o,canSetPermission:s,onSetModel:c,onSetThinking:l,onSetPermission:u,onSetFast:d,onConnectionsChanged:f,placement:p=`composer`}){let[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(),[b,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),[E,O]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{if(p!==`header`)return;let e=new AbortController;return gs(e.signal).then(y).catch(()=>void 0),()=>e.abort()},[p]);let k=e=>t=>{h(e),_(t.currentTarget)},A=()=>{h(null),_(null)},j=t?.sourceChanges,M=j?.workingTree.counts.files??0,N=t?.session.permissionProfile,[P,F]=(0,Y.useState)(N?.state===`known`?N.value??null:null);(0,Y.useEffect)(()=>{F(e.managedPermission??(N?.state===`known`?N.value??null:null))},[e.sessionRef,e.managedPermission,N?.state,N?.value]);let I=t?.usage.context,ee=I?.state===`known`,te=ee?I.tokens:e.contextUsage.usedTokens,L=ee?I.contextWindow:e.contextUsage.contextWindow,ne=ee?I.percent:e.contextUsage.ratio===null?null:e.contextUsage.ratio*100,R=ne==null?`—`:`${Math.round(ne)}%`,re=t?.session.model.state===`known`&&t.session.model.value?t.session.model.value.modelRef:``,ie=v?.models.find(e=>e.modelRef===re)??(v?.models.length===1?v.models[0]:void 0),ae=e.modelLabel===`agent-watch-auto`||v?.models.length===1&&v.models[0].provider===`agent_watch_managed`,oe=(0,Y.useMemo)(()=>e.managedThinkingLevels??ie?.thinkingLevels??(ae?[]:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]),[ie,e.managedThinkingLevels,ae]),se=async e=>{if(!(!e||!c)){x(!0),C(null);try{await c(e)}catch{C(D(r,`Chưa thể đổi model lúc này`,`Could not change the model right now`))}finally{x(!1)}}},ce=async e=>{if(l){x(!0),C(null);try{await l(e)}catch{C(D(r,`Chưa thể đổi thinking lúc này`,`Could not change thinking right now`))}finally{x(!1)}}},le=e.managedFast===`on`,ue=async()=>{if(!(!d||b)){x(!0);try{await d(!le),O({tone:`success`,text:le?D(r,`Đã tắt Fast. Các lượt sau chạy tốc độ thường.`,`Fast is off. The next calls run at standard speed.`):D(r,`Đã bật Fast: main agent trả lời nhanh hơn trên model GPT, token tính vào quota gấp 2,5 lần. Model và mức suy luận không đổi.`,`Fast is on: the main agent answers faster on GPT models, and its tokens count 2.5 times toward the quota. Model and thinking level are unchanged.`)})}catch(e){let t=e instanceof Error&&/managed-fast-unavailable|unavailable/.test(e.message);O({tone:`error`,text:t?D(r,`Harness của team không cho phép Fast.`,`The team's Harness does not allow Fast.`):D(r,`Chưa đổi được Fast. Thử lại.`,`Fast not changed. Try again.`)})}finally{x(!1)}}},de=async t=>{if(!u)return;x(!0),C(null);let n=ae?_m(t,r):$(t,r);try{await u(t),F(t),O(ae&&e.liveState===`waiting-approval`?{tone:`info`,text:D(r,`Đã chuyển sang ${n}. Lệnh đang chờ vẫn cần bạn bấm Cho phép hoặc Từ chối; các lệnh sau theo ${n}.`,`Switched to ${n}. The command already waiting still needs Allow or Deny; the next ones follow ${n}.`)}:{tone:`success`,text:D(r,`Đã chuyển sang ${n}.`,`Switched to ${n}.`)})}catch(e){let t=e instanceof Error&&e.message===`session-runtime-busy`?D(r,`Chưa đổi được quyền: lượt này đang chạy. Đổi lại sau khi lượt xong.`,`Access not changed: this turn is running. Change it after the turn ends.`):D(r,`Chưa đổi được quyền. Thử lại.`,`Access not changed. Try again.`);C(t),O({tone:`error`,text:t})}finally{x(!1)}},pe=e=>{if(e===`trusted-full-access`||e===`bypass`){A(),T(e);return}de(e)},me=m===`model`?`Model & thinking`:m===`context`?`Context`:m===`connections`?D(r,`MCP & kết nối`,`MCP & connections`):m===`permission`?D(r,`Quyền`,`Access`):D(r,`Source Changes`,`Source Changes`);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Z,{sx:{display:`flex`,gap:.65,mb:p===`composer`?.8:0,px:.1,flexWrap:p===`header`?`nowrap`:`wrap`,flexShrink:0,alignItems:`center`,justifyContent:p===`header`?`flex-end`:`flex-start`},children:[p===`header`&&ae&&(e.managedHelpers?.maximum??2)>0&&(0,X.jsxs)(q,{variant:`caption`,color:`text.secondary`,title:D(r,`Subagent đang chạy trong phiên này; Studio giới hạn tổng số theo thành viên.`,`Subagents running in this session; Studio caps the total per member.`),sx:{whiteSpace:`nowrap`,display:{xs:`none`,sm:`block`},mr:.5},children:[D(r,`Subagent`,`Subagents`),` `,e.managedHelpers?.active??0,`/`,e.managedHelpers?.maximum??2]}),p===`header`&&(0,X.jsx)(hm,{active:m===`model`,onClick:k(`model`),icon:(0,X.jsx)(Xf,{fontSize:`small`}),label:`${(ae?`agent-watch-auto`:e.modelLabel)??D(r,`Model session`,`Session model`)} · ${e.thinkingLevel===`unknown`||oe.length>0&&!oe.includes(e.thinkingLevel)?`—`:$(e.thinkingLevel,r)}`,title:ae?`agent-watch-auto · Thinking`:D(r,`Đổi model và mức suy luận`,`Change model and thinking level`)}),p===`header`&&(0,X.jsx)(hm,{active:m===`permission`,onClick:k(`permission`),icon:(0,X.jsx)(Zf,{fontSize:`small`}),label:ae?_m(P,r):P?$(P,r):D(r,`Quyền`,`Access`),title:D(r,`Đổi quyền truy cập`,`Change access level`)}),p===`header`&&ae&&e.managedFast&&d&&(0,X.jsx)(hm,{active:le,tone:`warning`,onClick:()=>void ue(),icon:(0,X.jsx)(qf,{fontSize:`small`}),label:fm(le,r),title:le?D(r,`Fast đang bật: bấm để tắt (về tốc độ thường). Token tính vào quota gấp 2,5 lần.`,`Fast is on: click to turn it off (standard speed). Tokens count 2.5 times toward the quota.`):D(r,`Bật Fast: trả lời nhanh hơn, token tính vào quota gấp 2,5 lần`,`Turn Fast on: faster answers, tokens count 2.5 times toward the quota`)}),p===`composer`&&(0,X.jsx)(hm,{active:m===`context`,onClick:k(`context`),icon:(0,X.jsx)(Jf,{fontSize:`small`}),title:`Context · ${R}`}),p===`composer`&&(0,X.jsx)(hm,{active:m===`connections`,onClick:k(`connections`),icon:(0,X.jsx)(Yf,{fontSize:`small`}),badge:n?.summary.configured??0,title:(n?.summary.configured??0)>0?D(r,`MCP & kết nối · ${n?.summary.configured}`,`MCP & connections · ${n?.summary.configured}`):D(r,`MCP & kết nối`,`MCP & connections`)}),p===`composer`&&(0,X.jsx)(hm,{active:m===`changes`,onClick:k(`changes`),icon:(0,X.jsx)(To,{fontSize:`small`}),badge:M,title:`Source Changes${M?` · ${M}`:``}`})]}),(0,X.jsxs)(_e,{open:m!==null,anchorEl:g,onClose:A,anchorOrigin:{vertical:p===`header`?`bottom`:`top`,horizontal:`left`},transformOrigin:{vertical:p===`header`?`top`:`bottom`,horizontal:`left`},slotProps:{paper:{sx:{width:330,maxWidth:`calc(100vw - 24px)`,borderRadius:1,p:1.5,mt:+(p===`header`)}}},children:[(0,X.jsx)(q,{sx:{px:.5,pb:1,fontWeight:600},children:me}),(0,X.jsx)(lr,{}),m===`model`&&(0,X.jsxs)(Q,{sx:{px:.5,pt:1},spacing:1.25,children:[ae?(0,X.jsxs)(Z,{children:[(0,X.jsx)(q,{children:`agent-watch-auto`}),(0,X.jsx)(dm,{name:`Context`,value:L?new Intl.NumberFormat().format(L):`—`})]}):(0,X.jsxs)(Z,{children:[(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,children:`Model`}),(0,X.jsx)(z,{fullWidth:!0,size:`small`,value:re,disabled:!a||b||e.liveState===`running`,onChange:e=>void se(e.target.value),sx:{mt:.5},children:(v?.models??[]).map(e=>(0,X.jsx)(dp,{value:e.modelRef,children:e.displayName},e.modelRef))})]}),(0,X.jsxs)(Z,{children:[(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,children:`Thinking`}),(0,X.jsx)(z,{fullWidth:!0,size:`small`,inputProps:{"aria-label":`Thinking`},value:e.thinkingLevel===`unknown`?``:e.thinkingLevel,disabled:!o||b||e.liveState===`running`,onChange:e=>void ce(e.target.value),sx:{mt:.5},children:oe.map(e=>(0,X.jsx)(dp,{value:e,children:$(e,r)},e))})]}),S&&(0,X.jsx)(q,{role:`status`,color:`error`,variant:`caption`,children:S})]}),m===`context`&&(0,X.jsxs)(Z,{sx:{px:.5,pt:.75},children:[(0,X.jsx)(dm,{name:D(r,`Đã dùng`,`Used`),value:R}),(0,X.jsx)(dm,{name:`Tokens`,value:te===null?`—`:new Intl.NumberFormat().format(te)}),(0,X.jsx)(dm,{name:`Window`,value:L===null?`—`:new Intl.NumberFormat().format(L)})]}),m===`connections`&&(0,X.jsxs)(fe,{dense:!0,disablePadding:!0,sx:{pt:.5},children:[(n?.connections??[]).map(t=>(0,X.jsxs)(sp,{sx:{alignItems:`center`,gap:.5},children:[(0,X.jsx)(Fr,{sx:{minWidth:38},children:(0,X.jsx)(Ip,{name:t.name,size:28})}),(0,X.jsx)(Br,{primary:t.name,secondary:nm(t,r)}),(0,X.jsx)(im,{compact:!0,sessionRef:e.sessionRef,connection:t,onChanged:e=>f?.(e)})]},t.connectionRef)),n&&n.connections.length===0&&(0,X.jsx)(sp,{children:(0,X.jsx)(Br,{primary:D(r,`Chưa có MCP`,`No MCP configured`)})}),!n&&(0,X.jsx)(sp,{children:(0,X.jsx)(Br,{primary:D(r,`Đang đọc…`,`Loading…`)})})]}),m===`permission`&&(0,X.jsxs)(Q,{sx:{px:.5,pt:1},spacing:.75,children:[(ae?[`workspace-write`,`trusted-full-access`,...e.managedBypass?[`bypass`]:[]]:[`read-only`,`workspace-write`,`trusted-full-access`,`bypass`]).map(t=>(0,X.jsx)(J,{variant:P===t?`contained`:`outlined`,color:t===`bypass`?`error`:t===`trusted-full-access`?`warning`:`primary`,disabled:!s||b||!ae&&e.liveState===`running`,onClick:()=>pe(t),sx:{justifyContent:`flex-start`},children:ae?_m(t,r):$(t,r)},t)),S&&(0,X.jsx)(q,{role:`status`,color:`error`,variant:`caption`,children:S})]}),m===`changes`&&(0,X.jsxs)(Z,{sx:{px:.5,pt:.75},children:[(0,X.jsx)(dm,{name:D(r,`Task changes`,`Task changes`),value:String(j?.task?.counts.files??0)}),(0,X.jsx)(dm,{name:D(r,`Working tree`,`Working tree`),value:String(j?.workingTree.counts.files??0)}),(0,X.jsx)(dm,{name:D(r,`Staged`,`Staged`),value:String(j?.staged.counts.files??0)}),(0,X.jsx)(J,{fullWidth:!0,variant:`outlined`,startIcon:(0,X.jsx)(To,{}),sx:{mt:1},onClick:()=>{A(),i()},children:D(r,`Mở Source Changes`,`Open Source Changes`)})]})]}),(0,X.jsx)(um,{open:w!==null,title:w===`bypass`?D(r,`Bật Bypass?`,`Turn on Bypass?`):D(r,`Bật toàn quyền?`,`Enable full access?`),description:w===`bypass`?ae?ym(r):vm(r):ae?bm(r):D(r,`Session này sẽ được phép đọc, sửa file và chạy command trong phạm vi runtime. Các thao tác xóa hoặc gửi dữ liệu ra ngoài vẫn cần xác nhận riêng.`,`This session will be allowed to read and edit files and run commands within the runtime. Destructive actions and external data transfers still require separate confirmation.`),cancelLabel:D(r,`Hủy`,`Cancel`),confirmLabel:w===`bypass`?D(r,`Bật Bypass`,`Turn on Bypass`):D(r,`Bật toàn quyền`,`Enable full access`),onCancel:()=>T(null),onConfirm:()=>{let e=w;T(null),e&&de(e)}}),(0,X.jsx)(Tp,{open:E!==null,autoHideDuration:E?.tone===`success`?4e3:12e3,onClose:()=>O(null),anchorOrigin:{vertical:`top`,horizontal:`center`},children:(0,X.jsx)(ut,{severity:E?.tone??`info`,variant:`filled`,onClose:()=>O(null),role:E?.tone===`error`?`alert`:`status`,children:E?.text})})]})}function _m(e,t){return e===`bypass`?`Bypass`:e===`trusted-full-access`?D(t,`Toàn quyền`,`Full access`):D(t,`Hỏi trước`,`Ask first`)}function vm(e){return D(e,`Không hỏi, không chặn gì trong cuộc trò chuyện personal này: xoá, push, gửi ra ngoài, file được bảo vệ đều chạy luôn, như chế độ bypass của Codex. Output vẫn được che secret và /undo vẫn hoàn tác được từng lượt. Cuộc trò chuyện company theo công tắc Bypass trong Harness của Studio.`,`Nothing is asked or blocked in this personal conversation: deletes, pushes, external sends and protected files all run, as with Codex's bypass mode. Output is still redacted and /undo can still revert each turn. Company conversations follow the Bypass switch of the Studio Harness.`)}function ym(e){return D(e,`Không hỏi gì nữa trong cuộc trò chuyện này: lệnh cần internet, Docker, chạy trên máy, push, deploy, migration đều chạy luôn, như bypass của Codex. Lệnh thường vẫn chạy trong sandbox, output vẫn che secret và /undo vẫn hoàn tác được. Admin Studio có thể tắt Bypass trong Harness.`,`Nothing is asked in this conversation any more: commands that need the internet, Docker or this machine, pushes, deploys and migrations all run, as with Codex's bypass. Plain commands still run in the sandbox, output is still redacted and /undo still works. A Studio administrator can turn Bypass off in the Harness.`)}function bm(e){return D(e,`Lệnh cần internet (cài package, tải file, git pull, test có server hay browser) chạy luôn, không hỏi. Vẫn hỏi trước khi đẩy hoặc gửi dữ liệu ra ngoài (git push, publish, deploy, upload, ssh), chạy migration database, xóa mà không rõ đích hoặc dùng sudo.`,`Commands that need the internet (package installs, downloads, git pull, tests with a server or browser) run without asking. You are still asked before anything that pushes or sends data out (git push, publish, deploy, uploads, ssh), database migrations, deletes whose target is unknown, and sudo.`)}function xm(e){return e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing&&e.keyCode!==229}var Sm=K((0,X.jsx)(`path`,{d:`M19 11H7.83l4.88-4.88c.39-.39.39-1.03 0-1.42a.996.996 0 0 0-1.41 0l-6.59 6.59c-.39.39-.39 1.02 0 1.41l6.59 6.59c.39.39 1.02.39 1.41 0s.39-1.02 0-1.41L7.83 13H19c.55 0 1-.45 1-1s-.45-1-1-1`}),`ArrowBackRounded`),Cm=K((0,X.jsx)(`path`,{d:`M12 7V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V9c0-1.1-.9-2-2-2zM6 19H4v-2h2zm0-4H4v-2h2zm0-4H4V9h2zm0-4H4V5h2zm4 12H8v-2h2zm0-4H8v-2h2zm0-4H8V9h2zm0-4H8V5h2zm9 12h-7v-2h2v-2h-2v-2h2v-2h-2V9h7c.55 0 1 .45 1 1v8c0 .55-.45 1-1 1m-1-8h-2v2h2zm0 4h-2v2h2z`}),`BusinessRounded`),wm=K((0,X.jsx)(`path`,{d:`M15.88 9.29 12 13.17 8.12 9.29a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41-.39-.38-1.03-.39-1.42 0`}),`ExpandMoreRounded`),Tm=K((0,X.jsx)(`path`,{d:`M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m0 12H4V8h16z`}),`FolderOpenOutlined`),Em=K((0,X.jsx)(`path`,{d:`m11.19 1.36-7 3.11C3.47 4.79 3 5.51 3 6.3V11c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V6.3c0-.79-.47-1.51-1.19-1.83l-7-3.11c-.51-.23-1.11-.23-1.62 0M12 11.99h7c-.53 4.12-3.28 7.79-7 8.94V12H5V6.3l7-3.11z`}),`SecurityRounded`),Dm=K((0,X.jsx)(`path`,{d:`M3 18c0 .55.45 1 1 1h5v-2H4c-.55 0-1 .45-1 1M3 6c0 .55.45 1 1 1h9V5H4c-.55 0-1 .45-1 1m10 14v-1h7c.55 0 1-.45 1-1s-.45-1-1-1h-7v-1c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1s1-.45 1-1M7 10v1H4c-.55 0-1 .45-1 1s.45 1 1 1h3v1c0 .55.45 1 1 1s1-.45 1-1v-4c0-.55-.45-1-1-1s-1 .45-1 1m14 2c0-.55-.45-1-1-1h-9v2h9c.55 0 1-.45 1-1m-5-3c.55 0 1-.45 1-1V7h3c.55 0 1-.45 1-1s-.45-1-1-1h-3V4c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1`}),`TuneRounded`);function Om(e){return M(`MuiListSubheader`,e)}g(`MuiListSubheader`,[`root`,`colorPrimary`,`colorInherit`,`gutters`,`inset`,`sticky`]);var km=e=>{let{classes:t,color:n,disableGutters:r,inset:i,disableSticky:a}=e,o={root:[`root`,n!=="default"&&`color${G(n)}`,!r&&`gutters`,i&&`inset`,!a&&`sticky`]};return B(o,Om,t)},Am=W(`li`,{name:`MuiListSubheader`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.color!=="default"&&t[`color${G(n.color)}`],!n.disableGutters&&t.gutters,n.inset&&t.inset,!n.disableSticky&&t.sticky]}})(V(({theme:e})=>({boxSizing:`border-box`,lineHeight:`48px`,listStyle:`none`,color:(e.vars||e).palette.text.secondary,fontFamily:e.typography.fontFamily,fontWeight:e.typography.fontWeightMedium,fontSize:e.typography.pxToRem(14),variants:[{props:{color:`primary`},style:{color:(e.vars||e).palette.primary.main}},{props:{color:`inherit`},style:{color:`inherit`}},{props:({ownerState:e})=>!e.disableGutters,style:{paddingLeft:16,paddingRight:16}},{props:({ownerState:e})=>e.inset,style:{paddingLeft:72}},{props:({ownerState:e})=>!e.disableSticky,style:{position:`sticky`,top:0,zIndex:1,backgroundColor:(e.vars||e).palette.background.paper}}]}))),jm=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiListSubheader`}),{className:r,color:i=`default`,component:a=`li`,disableGutters:o=!1,disableSticky:s=!1,inset:c=!1,...l}=n,u={...n,color:i,component:a,disableGutters:o,disableSticky:s,inset:c},d=km(u);return(0,X.jsx)(Am,{as:a,className:P(d.root,r),ref:t,ownerState:u,...l})}),Mm=K((0,X.jsx)(`path`,{d:`m19 9 1.25-2.75L23 5l-2.75-1.25L19 1l-1.25 2.75L15 5l2.75 1.25zm0 6-1.25 2.75L15 19l2.75 1.25L19 23l1.25-2.75L23 19l-2.75-1.25zm-7.5-5.5L9 4 6.5 9.5 1 12l5.5 2.5L9 20l2.5-5.5L17 12zm-1.51 3.49L9 15.17l-.99-2.18L5.83 12l2.18-.99L9 8.83l.99 2.18 2.18.99z`}),`AutoAwesomeOutlined`),Nm=K((0,X.jsx)(`path`,{d:`M8 16h8v2H8zm0-4h8v2H8zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z`}),`DescriptionOutlined`),Pm=K((0,X.jsx)(`path`,{d:`m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z`}),`FolderOutlined`);function Fm(e,t){let n=e.slice(0,t),r=/(^|[\s(])@"([^"\n]*)$/.exec(n);if(r)return{start:r.index+r[1].length,end:e[t]===`"`?t+1:t,query:r[2],quoted:!0};let i=/(^|[\s(])@([^\s"]*)$/.exec(n);return i?{start:i.index+i[1].length,end:t+(/^[^\s"]*/.exec(e.slice(t))?.[0].length??0),query:i[2],quoted:!1}:null}function Im(e,t,n){let r=t.quoted||/\s/.test(n.value),i=r?`@"${n.value}"`:`@${n.value}`,a=n.kind===`directory`,o=e.slice(t.end),s=a||/^\s/.test(o)?``:` `;return{text:e.slice(0,t.start)+i+s+o,caret:t.start+i.length+s.length-(a&&r?1:0)}}function Lm(e,t){let n=e.slice(0,t);return/^\/[^\s/]*$/.test(n)?{start:0,end:t+(/^[^\s]*/.exec(e.slice(t))?.[0].length??0),query:n.slice(1),quoted:!1}:null}function Rm(e,t,n){let r=n.kind===`skill`?`/skill:${n.name}`:`/${n.name}`,i=e.slice(t.end);return{text:r+(/^\s/.test(i)?``:` `)+i,caret:r.length+1}}var zm=20,Bm=e=>e.normalize(`NFD`).replace(/\p{M}/gu,``).toLowerCase();function Vm(e,t,n){let r=Bm(t.replace(/^skill:/,``)),i=e=>Bm(e.name).startsWith(r)?0:Bm(e.name).includes(r)?1:Bm(e.description).includes(r)?2:3,a=e=>e.origin===`piagent`?`Piagent`:`${e.scope===`user`?`~/`:``}.${e.origin===`pi`?`pi`:e.origin}`;return e.filter(e=>i(e)<3&&(!t.startsWith(`skill:`)||e.kind===`skill`)).sort((e,t)=>i(e)-i(t)||e.name.localeCompare(t.name)).slice(0,zm).map(e=>({key:`${e.kind}:${e.name}`,icon:e.kind,label:e.kind===`skill`?`/skill:${e.name}`:`/${e.name}`,hint:e.argumentHint,detail:`${e.description}${e.description?` · `:``}${e.kind===`skill`?`skill`:D(n,`lệnh`,`command`)} ${a(e)}`,apply:(t,n)=>Rm(t,n,e)}))}function Hm({projectRef:e,value:t,onChange:n,locale:r,builtIns:i=[]}){let a=(0,Y.useRef)(null),o=(0,Y.useId)(),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(0),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(null),y=e&&s!==null&&s<=t.length?s:null,b=y===null?null:Lm(t,y),x=y===null||b?null:Fm(t,y),S=b??x,C=b?`command`:`path`,w=S&&`${C}:${S.start}`!==d?S:null,T=w&&C===`path`?w.query:null;(0,Y.useEffect)(()=>{if(T===null||!e){g(null);return}let t=new AbortController,n=setTimeout(()=>{yc(e,T,t.signal).then(e=>{g({query:T,items:e.suggestions.map(e=>({key:e.value,label:e.label,hint:null,icon:e.kind,detail:e.detail.slice(0,Math.max(0,e.detail.length-e.label.replace(/\/$/,``).length)),apply:(t,n)=>Im(t,n,e)}))}),m(0)}).catch(()=>{t.signal.aborted||g({query:T,items:[]})})},90);return()=>{clearTimeout(n),t.abort()}},[e,T]);let E=!!(w&&C===`command`&&e&&_?.projectRef!==e);(0,Y.useEffect)(()=>{if(!E||!e)return;let t=new AbortController;return bc(e,t.signal).then(t=>v({projectRef:e,list:t.commands})).catch(()=>{t.signal.aborted||v({projectRef:e,list:[]})}),()=>t.abort()},[E,e]);let O=w?C===`path`?h?.items??null:_&&_.projectRef===e?Vm([...i,..._.list.filter(e=>!i.some(t=>t.name===e.name))],w.query,r):null:null;(0,Y.useEffect)(()=>{m(0)},[C,w?.query]);let k=!!(l&&w&&O&&a.current),A=k?O:[];(0,Y.useEffect)(()=>{k&&document.getElementById(`${o}-${p}`)?.scrollIntoView({block:`nearest`})},[k,p,o]);let j=(0,Y.useRef)(null);(0,Y.useLayoutEffect)(()=>{let e=j.current,n=a.current;!e||!n||e.text!==t||(j.current=null,n.focus(),n.setSelectionRange(e.caret,e.caret),c(e.caret))},[t]);let M=e=>{if(!w)return;let r=e.apply(t,w);j.current=r,n(r.text),c(r.caret)},N=e=>!k||e.nativeEvent.isComposing||e.keyCode===229?!1:e.key===`Escape`?(e.preventDefault(),f(`${C}:${w.start}`),!0):A.length?e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),m(t=>(t+(e.key===`ArrowDown`?1:A.length-1))%A.length),!0):(e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey&&(e.preventDefault(),M(A[Math.min(p,A.length-1)]),!0):!1,P=e=>e===`directory`?(0,X.jsx)(Pm,{fontSize:`small`,color:`primary`}):e===`file`?(0,X.jsx)(Nm,{fontSize:`small`,color:`action`}):e===`skill`?(0,X.jsx)(Mm,{fontSize:`small`,color:`secondary`}):(0,X.jsx)(Eo,{fontSize:`small`,color:`primary`}),F=C===`command`?D(r,`Lệnh và skill`,`Commands and skills`):D(r,`File và folder`,`Files and folders`),I=a.current,ee=(0,X.jsx)(so,{open:k,anchorEl:I,placement:`top-start`,disablePortal:!0,sx:{zIndex:1350,width:Math.min(640,I?.clientWidth??640)},modifiers:[{name:`offset`,options:{offset:[0,10]}}],children:(0,X.jsxs)(ht,{elevation:8,sx:{borderRadius:1,overflow:`hidden`,display:`flex`,flexDirection:`column`,maxHeight:340},children:[(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,sx:{px:1.5,pt:1,pb:.5},children:C===`command`?D(r,`Lệnh và skill của project và trên máy này · Tab để chọn`,`Commands and skills of the project and on this computer · Tab to pick`):D(r,`File và folder · gõ ~/ hoặc / để chọn folder khác trên máy · Tab để chọn`,`Files and folders · type ~/ or / for other folders on this computer · Tab to pick`)}),A.length?(0,X.jsx)(Z,{component:`ul`,role:`listbox`,id:o,"aria-label":F,sx:{listStyle:`none`,m:0,p:.5,pt:0,overflowY:`auto`},children:A.map((e,t)=>(0,X.jsxs)(Z,{component:`li`,id:`${o}-${t}`,role:`option`,"aria-selected":t===p,onMouseDown:e=>e.preventDefault(),onMouseEnter:()=>m(t),onClick:()=>M(e),sx:{display:`flex`,alignItems:`center`,gap:1,minWidth:0,px:1,py:.55,borderRadius:1,cursor:`pointer`,bgcolor:t===p?`action.selected`:`transparent`},children:[P(e.icon),(0,X.jsx)(q,{noWrap:!0,sx:{flexShrink:0,maxWidth:`55%`,fontSize:14,fontWeight:600},children:e.label}),e.hint&&(0,X.jsx)(q,{noWrap:!0,variant:`caption`,sx:{flexShrink:0,maxWidth:`25%`,fontFamily:`monospace`},children:e.hint}),(0,X.jsx)(q,{noWrap:!0,variant:`caption`,color:`text.secondary`,sx:{minWidth:0},children:e.detail})]},e.key))}):(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,sx:{px:1.5,pb:1.25},children:C===`command`?D(r,`Không có lệnh hoặc skill khớp`,`No matching command or skill`):D(r,`Không có file hoặc folder khớp`,`No matching file or folder`)})]})}),te=e=>c(e.target.selectionStart??null);return{inputRef:a,menu:ee,onKeyDown:N,track:te,inputProps:{onFocus:()=>u(!0),onBlur:()=>u(!1)},htmlInput:{onSelect:te,"aria-autocomplete":`list`,"aria-controls":k&&A.length?o:void 0,"aria-activedescendant":k&&A.length?`${o}-${p}`:void 0}}}var Um=`new-chat`,Wm=`piagent.composer-drafts.v1`,Gm=50,Km=32768,qm=12096e5,Jm=null,Ym,Xm=new Map;function Zm(){if(Jm)return Jm;Jm=new Map;try{let e=JSON.parse(window.localStorage.getItem(Wm)??`{}`),t=Date.now();for(let[n,r]of Object.entries(e??{}))typeof r?.text==`string`&&typeof r.savedAt==`number`&&t-r.savedAt<qm&&Jm.set(n,{text:r.text.slice(0,Km),savedAt:r.savedAt})}catch{}return Jm}function Qm(){Ym!==void 0&&(window.clearTimeout(Ym),Ym=void 0);try{let e=[...Zm()].sort((e,t)=>t[1].savedAt-e[1].savedAt).slice(0,Gm);window.localStorage.setItem(Wm,JSON.stringify(Object.fromEntries(e)))}catch{}}var $m=!1;function eh(){$m||($m=!0,window.addEventListener(`pagehide`,Qm)),Ym===void 0&&(Ym=window.setTimeout(Qm,300))}function th(e){return Zm().get(e)?.text??``}function nh(e,t){let n=Zm();if(t.trim())n.set(e,{text:t.slice(0,Km),savedAt:Date.now()});else if(!n.delete(e))return;eh()}function rh(e){return Xm.get(e)}function ih(e,t){t===null?Xm.delete(e):Xm.set(e,t)}var ah=`piagent-composer-appended`;function oh(e,t){let n=th(e);nh(e,n.trim()?`${n.trimEnd()}\n\n${t}`:t),window.dispatchEvent(new CustomEvent(ah,{detail:e}))}var sh=`agent_watch_managed`;function ch(e,t,n){return e===`native-project-picker-unavailable`||e===`project-import-picker-failed`?D(n,`Không mở được hộp chọn thư mục của máy. Thử lại; nếu vẫn lỗi, mở cuộc trò chuyện từ Terminal trong thư mục đó (pi hoặc piagent studio).`,`The folder picker could not open. Try again; if it still fails, start a conversation from a Terminal in that folder (pi or piagent studio).`):e===`project-import-folder-invalid`?D(n,`Không dùng được thư mục này: thư mục gốc của ổ đĩa hoặc một liên kết (symlink). Chọn thư mục thật của project.`,`This folder cannot be used: a drive's root or a symbolic link. Choose the project's real folder.`):t===429?D(n,`Thao tác quá nhanh. Đợi vài giây rồi thử lại.`,`Too many attempts. Wait a few seconds and try again.`):D(n,`Không thể thêm thư mục. Thử lại; nếu vẫn lỗi, chạy piagent dashboard doctor.`,`Could not add this folder. Try again; if it still fails, run piagent dashboard doctor.`)}function lh({active:e,defaultProjectRef:t,busy:n,error:r,onCancel:i,onCreate:a}){let{locale:o}=C(),[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)(void 0),[d,f]=(0,Y.useState)(!1),p=l===null&&s?.models.length===1&&s.models[0].provider===`agent_watch_managed`,[m,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(``),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(`high`),[S,w]=(0,Y.useState)(!1),[T,E]=(0,Y.useState)(!1),[O,k]=(0,Y.useState)(null),[A,j]=(0,Y.useState)(()=>th(Um)),M=e=>{j(e),nh(Um,e)},[N,P]=(0,Y.useState)(null),[F,I]=(0,Y.useState)(()=>rh(`new-chat`)??[]),[ee,te]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{ih(Um,F.length?F:null)},[F]);let[L,ne]=(0,Y.useState)(!1),R=(0,Y.useRef)(0),[z,re]=(0,Y.useState)(null),[ie,ae]=(0,Y.useState)(null),[oe,se]=(0,Y.useState)(!1),[ce,ue]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{if(!e)return;let n=new AbortController;return c(void 0),h(!1),ue(null),te(null),ne(!1),w(!1),R.current=0,gs(n.signal).then(e=>{n.signal.aborted||(c(e),_(e.projects.some(e=>e.projectRef===t)?t:e.projects[0]?.projectRef??``),y(e.defaultModelRef??``),x(e.defaultThinkingLevel??`high`),k(null),E(!1))}).catch(()=>{n.signal.aborted||h(!0)}),u(void 0),ws(n.signal).then(e=>{n.signal.aborted||u(e)}).catch(()=>{n.signal.aborted||u(null)}),()=>n.abort()},[e,t]),(0,Y.useEffect)(()=>{if(!e)return;let t=e=>{vd(e.dataTransfer)&&e.preventDefault()};return window.addEventListener(`dragover`,t),window.addEventListener(`drop`,t),()=>{window.removeEventListener(`dragover`,t),window.removeEventListener(`drop`,t)}},[e]);let de=s?.projects.find(e=>e.projectRef===g),fe=Hm({projectRef:de?.projectRef,value:A,onChange:M,locale:o}),pe=s?.models.find(e=>e.modelRef===v),he=!p&&pe?.provider===sh,ge=p?[]:s?.models.filter(e=>e.provider===sh)??[],_e=(p||he)&&pe?.managedFast===!0,ve=p?s?.models??[]:s?.models.filter(e=>e.provider!==sh)??[],ye=async()=>{f(!0);try{let e=await Ts().catch(()=>null),t=await gs();c(t),u(e??await ws().catch(()=>null));let n=t.models.find(e=>e.provider===sh);n&&(y(n.modelRef),Ce())}catch{h(!0)}finally{f(!1)}},be=s?.models.find(e=>e.modelRef===s.defaultModelRef),xe=(0,Y.useMemo)(()=>pe?.thinkingLevels??[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],[pe]);(0,Y.useEffect)(()=>{xe.includes(b)||x(xe.includes(`high`)?`high`:xe[0]??`off`)},[v,xe]);let Se=e=>t=>{re(e),ae(t.currentTarget)},Ce=()=>{re(null),ae(null)},we=async()=>{se(!0),ue(null);try{let e=await Cs(),t=e.projects?.length?e.projects:[e.project];c(e=>e&&{...e,projects:[...e.projects.filter(e=>!t.some(t=>t.projectRef===e.projectRef)),...t]}),_(e.project.projectRef),Ce()}catch(e){e instanceof ds&&e.status===409?ue(null):ue(ch(e instanceof ds?e.code:null,e instanceof ds?e.status:0,o))}finally{se(!1)}},B=e=>{if(!e?.length)return;let t=[...F],n=!1,r=null;for(let i of[...e]){if(t.some(e=>e.name===i.name&&e.size===i.size&&e.lastModified===i.lastModified))continue;let e=pd(i.name);if(`refused`in e){r=`${i.name}: ${yd(e.refused,o)}`;continue}if(t.length===4){n=!0;continue}t.push(i)}I(t),te(r??(n?D(o,`Mỗi tin nhắn nhận tối đa 4 file.`,`Each message accepts at most 4 files.`):null))},Te=!n&&!m&&F.length<4,Ee=(0,Y.useRef)(!1),De=()=>{Ee.current||n||!de||!A.trim()||(Ee.current=!0,Promise.resolve(a({projectRef:g,placeRef:de.placeRef,modelRef:v||null,thinkingLevel:b,permissionMode:O,..._e&&T?{fast:!0}:{},message:A,files:F})).finally(()=>{Ee.current=!1}))};return(0,X.jsxs)(Z,{sx:{minHeight:`calc(100vh - 68px)`,display:`flex`,flexDirection:`column`},children:[(0,X.jsx)(Z,{sx:{p:{xs:1.5,sm:2}},children:(0,X.jsx)(et,{"aria-label":D(o,`Quay lại`,`Back`),onClick:i,children:(0,X.jsx)(Sm,{})})}),(0,X.jsxs)(Q,{sx:{flex:1,alignItems:`center`,justifyContent:`center`,px:2,pb:{xs:5,md:12}},spacing:4,children:[(0,X.jsx)(q,{component:`h1`,sx:{fontSize:{xs:`2rem`,md:`2.45rem`},fontWeight:500,letterSpacing:`-.035em`,textAlign:`center`},children:D(o,`Hôm nay làm gì?`,`What should we work on?`)}),(0,X.jsxs)(Z,{sx:{position:`relative`,width:`100%`,maxWidth:820,border:1,borderColor:L?`primary.main`:`divider`,borderStyle:L?`dashed`:`solid`,borderRadius:1,bgcolor:`background.paper`,p:1.25,boxShadow:`0 18px 55px rgba(0,0,0,.13)`},onDragEnter:e=>{vd(e.dataTransfer)&&(R.current+=1,ne(!0))},onDragOver:e=>{vd(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect=Te?`copy`:`none`)},onDragLeave:e=>{vd(e.dataTransfer)&&(--R.current,R.current<=0&&(R.current=0,ne(!1)))},onDrop:e=>{vd(e.dataTransfer)&&(e.preventDefault(),R.current=0,ne(!1),Te&&B(e.dataTransfer.files))},children:[L&&(0,X.jsxs)(Z,{role:`status`,sx:{position:`absolute`,inset:0,zIndex:3,display:`grid`,alignContent:`center`,justifyItems:`center`,gap:.5,borderRadius:1,bgcolor:`background.paper`,opacity:.96,pointerEvents:`none`,textAlign:`center`},children:[(0,X.jsx)(q,{sx:{fontWeight:750},children:Te?D(o,`Thả tài liệu vào đây`,`Drop documents here`):F.length>=4?D(o,`Đã đủ 4 file cho tin nhắn đầu tiên`,`The first message already holds 4 files`):D(o,`Chưa nhận file lúc này`,`Files cannot be attached right now`)}),Te&&(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,children:D(o,`.md .txt .csv .json .yaml .docx .pdf và ảnh`,`.md .txt .csv .json .yaml .docx .pdf and images`)})]}),!s&&!m?(0,X.jsxs)(Q,{direction:`row`,spacing:1.5,sx:{minHeight:126,alignItems:`center`,justifyContent:`center`},children:[(0,X.jsx)(Ve,{size:20}),(0,X.jsx)(q,{color:`text.secondary`,children:D(o,`Đang mở…`,`Opening…`)})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(le,{autoFocus:!0,fullWidth:!0,multiline:!0,minRows:3,maxRows:8,value:A,disabled:n||m,inputRef:fe.inputRef,...fe.inputProps,onChange:e=>{M(e.target.value),fe.track(e)},onKeyDown:e=>{fe.onKeyDown(e)||xm(e)&&(e.preventDefault(),De())},onPaste:e=>{e.clipboardData?.files.length&&(e.preventDefault(),Te&&B(e.clipboardData.files))},placeholder:D(o,`Nhắn cho Piagent… (@ để chọn file, folder)`,`Message Piagent… (@ for files and folders)`),variant:`standard`,slotProps:{input:{disableUnderline:!0},htmlInput:{maxLength:32768,...fe.htmlInput}},sx:{px:.5}}),fe.menu,F.length>0&&(0,X.jsx)(Q,{direction:`row`,sx:{flexWrap:`wrap`,gap:.75,px:.5,pt:.75},"aria-label":D(o,`File sẽ gửi cùng tin nhắn đầu tiên`,`Files for the first message`),children:F.map(e=>(0,X.jsx)(rr,{size:`small`,variant:`outlined`,label:`${e.name} · ${hd(e.size)}`,onDelete:n?void 0:()=>{I(t=>t.filter(t=>t!==e)),te(null)},deleteIcon:(0,X.jsx)(vf,{"aria-label":`${D(o,`Bỏ`,`Remove`)} ${e.name}`,role:`button`})},`${e.name}:${e.size}:${e.lastModified}`))}),(0,X.jsx)(kf,{in:S,id:`piagent-new-session-options`,children:(0,X.jsxs)(Z,{sx:{mx:.35,mt:1,px:1.1,py:1,borderRadius:1,bgcolor:`action.hover`},children:[(0,X.jsx)(q,{variant:`caption`,sx:{display:`block`,mb:.75,fontWeight:750},children:D(o,`Tùy chọn cho tin nhắn đầu tiên`,`Options for the first message`)}),(0,X.jsxs)(Q,{direction:`row`,sx:{alignItems:`center`,gap:.75,flexWrap:`wrap`},children:[(0,X.jsx)(J,{size:`small`,color:`inherit`,startIcon:(0,X.jsx)(Dm,{}),endIcon:(0,X.jsx)(wm,{}),onClick:Se(`thinking`),children:$(b,o)}),(0,X.jsx)(J,{size:`small`,color:`inherit`,startIcon:(0,X.jsx)(Em,{}),endIcon:(0,X.jsx)(wm,{}),onClick:Se(`permission`),children:p||he?_m(O,o):O?$(O,o):D(o,`Quyền theo profile`,`Profile access`)}),(0,X.jsxs)(J,{component:`label`,size:`small`,color:`inherit`,startIcon:(0,X.jsx)(_f,{}),disabled:!Te,"aria-label":`${D(o,`Thêm file`,`Add files`)} (${F.length}/4)`,children:[D(o,`Đính kèm`,`Attach`),(0,X.jsx)(`input`,{type:`file`,hidden:!0,multiple:!0,disabled:!Te,accept:``,onChange:e=>{B(e.target.files),e.currentTarget.value=``}})]})]}),he&&(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,sx:{display:`block`,mt:.75},children:D(o,`Model và quyền theo Harness công ty; thinking chọn ở đây.`,`Models and access follow the company Harness; choose thinking here.`)})]})}),(0,X.jsxs)(Q,{direction:`row`,sx:{mt:1,alignItems:`center`,gap:.65,flexWrap:`nowrap`,minWidth:0},children:[(0,X.jsx)(bo,{title:S?D(o,`Ẩn tùy chọn`,`Hide options`):D(o,`Thêm tùy chọn`,`More options`),children:(0,X.jsx)(et,{size:`small`,"aria-label":S?D(o,`Ẩn tùy chọn`,`Hide options`):D(o,`Thêm tùy chọn`,`More options`),"aria-expanded":S,"aria-controls":`piagent-new-session-options`,onClick:()=>w(e=>!e),sx:{flex:`0 0 auto`,bgcolor:S?`action.selected`:`transparent`},children:(0,X.jsx)(gf,{fontSize:`small`,sx:{transition:`transform .16s ease`,transform:S?`rotate(45deg)`:`none`}})})}),(0,X.jsx)(J,{size:`small`,color:`inherit`,startIcon:(0,X.jsx)(Tm,{}),endIcon:(0,X.jsx)(wm,{}),onClick:Se(`project`),"aria-label":`${D(o,`Project`,`Project`)}: ${de?.label??D(o,`Chọn project`,`Choose project`)}`,sx:{minWidth:0,maxWidth:{xs:118,sm:250},px:{xs:.75,sm:1},"& .MuiButton-startIcon":{display:{xs:`none`,sm:`inherit`}}},children:(0,X.jsx)(Z,{component:`span`,sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:de?.label??D(o,`Chọn project`,`Choose project`)})}),(0,X.jsx)(J,{size:`small`,color:`inherit`,startIcon:he?(0,X.jsx)(Cm,{}):(0,X.jsx)(Xf,{}),endIcon:(0,X.jsx)(wm,{}),onClick:Se(`model`),"aria-label":`${D(o,`Model`,`Model`)}: ${he?D(o,`Công ty · agent-watch-auto`,`Company · agent-watch-auto`):pe?.displayName??be?.displayName??D(o,`Mặc định của Pi`,`Pi default`)}`,sx:{minWidth:0,maxWidth:{xs:142,sm:250},px:{xs:.75,sm:1},"& .MuiButton-startIcon":{display:{xs:`none`,sm:`inherit`}}},children:(0,X.jsx)(Z,{component:`span`,sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},children:he?D(o,`Công ty · agent-watch-auto`,`Company · agent-watch-auto`):pe?`${pe.displayName}${pe.modelRef===s?.defaultModelRef?D(o,` · mặc định`,` · default`):``}`:be?.displayName??D(o,`Mặc định của Pi`,`Pi default`)})}),_e&&(0,X.jsx)(bo,{title:pm(o),arrow:!0,children:(0,X.jsx)(J,{size:`small`,color:`inherit`,variant:`outlined`,startIcon:(0,X.jsx)(qf,{}),"aria-pressed":T,"aria-label":`${fm(T,o)}. ${pm(o)}`,onClick:()=>E(e=>!e),sx:{flex:`0 0 auto`,minWidth:0,px:{xs:.75,sm:1},borderRadius:1,borderColor:`divider`,color:`text.secondary`,"& .MuiButton-startIcon":{mr:{xs:0,sm:.65},ml:0},...T?mm:{}},children:(0,X.jsx)(Z,{component:`span`,sx:{display:{xs:`none`,sm:`inline`},whiteSpace:`nowrap`},children:fm(T,o)})})}),(0,X.jsx)(Z,{sx:{flex:1,minWidth:0}}),(0,X.jsx)(et,{"aria-label":D(o,`Gửi`,`Send`),disabled:n||m||!de||!A.trim(),onClick:De,sx:{flex:`0 0 auto`,bgcolor:`primary.main`,color:`primary.contrastText`,"&:hover":{bgcolor:`primary.dark`},"&.Mui-disabled":{bgcolor:`action.disabledBackground`}},children:(0,X.jsx)(bf,{fontSize:`small`})})]}),_e&&T&&(0,X.jsx)(q,{variant:`caption`,sx:{display:`block`,px:.5,pt:.75,color:`warning.main`},children:pm(o)})]}),(ee||ce||r||m)&&(0,X.jsx)(q,{role:`status`,color:`error`,variant:`caption`,sx:{display:`block`,px:.5,pt:1},children:ee??ce??r??D(o,`Không tải được lựa chọn`,`Could not load choices`)})]})]}),(0,X.jsxs)(me,{anchorEl:ie,open:z===`project`,onClose:Ce,slotProps:{paper:{sx:{width:310,maxHeight:380}}},children:[(s?.projects??[]).map(e=>(0,X.jsxs)(dp,{selected:g===e.projectRef,onClick:()=>{_(e.projectRef),Ce()},children:[(0,X.jsx)(Fr,{children:(0,X.jsx)(Ip,{name:`folder`,size:26})}),(0,X.jsx)(Br,{primary:e.label,secondary:e.hint,slotProps:{secondary:{noWrap:!0,title:e.hint}}})]},e.projectRef)),(0,X.jsx)(lr,{}),(0,X.jsxs)(dp,{disabled:oe||s?.projectImport?.status!==`available`,onClick:()=>void we(),children:[(0,X.jsx)(Fr,{children:(0,X.jsx)(gf,{})}),(0,X.jsx)(Br,{primary:oe?D(o,`Đang chọn…`,`Choosing…`):D(o,`Thêm một hoặc nhiều folder`,`Add one or more folders`)})]})]}),(0,X.jsxs)(me,{anchorEl:ie,open:z===`model`,onClose:Ce,slotProps:{paper:{sx:{width:360,maxHeight:440}}},children:[!p&&(ge.length>0||l?.available)&&[(0,X.jsx)(jm,{children:D(o,`Công ty`,`Company`)},`company-heading`),...ge.length?ge.map(e=>(0,X.jsxs)(dp,{selected:v===e.modelRef,onClick:()=>{y(e.modelRef),Ce()},children:[(0,X.jsx)(Fr,{children:(0,X.jsx)(Cm,{})}),(0,X.jsx)(Br,{primary:`agent-watch-auto`,secondary:D(o,`Harness công ty · Studio quản lý model`,`Company Harness · models managed by Studio`)})]},e.modelRef)):[(0,X.jsxs)(dp,{disabled:d,onClick:()=>void ye(),children:[(0,X.jsx)(Fr,{children:d?(0,X.jsx)(Ve,{size:20}):(0,X.jsx)(Cm,{})}),(0,X.jsx)(Br,{primary:`agent-watch-auto`,secondary:d?D(o,`Đang kết nối…`,`Connecting…`):Gf(l,o),slotProps:{secondary:{sx:{whiteSpace:`normal`}}}})]},`company-connect`)],(0,X.jsx)(jm,{children:D(o,`Cá nhân`,`Personal`)},`personal-heading`)],!s?.defaultModelRef&&(0,X.jsxs)(dp,{selected:!v,onClick:()=>{y(``),Ce()},children:[(0,X.jsx)(Fr,{children:(0,X.jsx)(Xf,{})}),(0,X.jsx)(Br,{primary:D(o,`Model mặc định của Pi`,`Pi default model`)})]}),ve.map(e=>(0,X.jsxs)(dp,{selected:v===e.modelRef,onClick:()=>{y(e.modelRef),Ce()},children:[(0,X.jsx)(Fr,{children:(0,X.jsx)(Ip,{name:e.provider,size:26})}),(0,X.jsx)(Br,{primary:e.displayName,secondary:e.modelRef===s?.defaultModelRef?D(o,`Mặc định · ${e.provider} · High`,`Default · ${e.provider} · High`):e.provider})]},e.modelRef))]}),(0,X.jsx)(me,{anchorEl:ie,open:z===`thinking`,onClose:Ce,slotProps:{paper:{sx:{width:250,maxHeight:400}}},children:xe.map(e=>(0,X.jsxs)(dp,{value:e,selected:b===e,onClick:()=>{x(e),Ce()},children:[(0,X.jsx)(Fr,{children:(0,X.jsx)(Dm,{})}),(0,X.jsx)(Br,{primary:$(e,o)})]},e))}),(0,X.jsx)(me,{anchorEl:ie,open:z===`permission`,onClose:Ce,slotProps:{paper:{sx:{width:310}}},children:p||he?[(0,X.jsxs)(dp,{selected:O!==`trusted-full-access`&&O!==`bypass`,onClick:()=>{k(null),Ce()},children:[(0,X.jsx)(Fr,{children:(0,X.jsx)(Em,{})}),(0,X.jsx)(Br,{primary:_m(null,o),secondary:D(o,`Hỏi trước mỗi lệnh cần internet`,`Asks before each command that needs the internet`)})]},`ask`),(0,X.jsxs)(dp,{selected:O===`trusted-full-access`,onClick:()=>{Ce(),P(`trusted-full-access`)},children:[(0,X.jsx)(Fr,{children:(0,X.jsx)(Em,{color:`warning`})}),(0,X.jsx)(Br,{primary:_m(`trusted-full-access`,o),secondary:D(o,`Chỉ hỏi việc bắt buộc phải xác nhận`,`Asks only what must be confirmed`)})]},`full`),...pe?.managedBypass?[(0,X.jsxs)(dp,{selected:O===`bypass`,onClick:()=>{Ce(),P(`bypass`)},children:[(0,X.jsx)(Fr,{children:(0,X.jsx)(Em,{color:`error`})}),(0,X.jsx)(Br,{primary:`Bypass`,secondary:D(o,`Không hỏi gì; admin Studio có thể tắt`,`Asks nothing; a Studio administrator can turn it off`)})]},`bypass`)]:[]]:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(dp,{selected:O===null,onClick:()=>{k(null),Ce()},children:[(0,X.jsx)(Fr,{children:(0,X.jsx)(Em,{})}),(0,X.jsx)(Br,{primary:D(o,`Theo profile project`,`Project profile default`)})]}),[`read-only`,`workspace-write`,`trusted-full-access`,`bypass`].map(e=>(0,X.jsxs)(dp,{selected:O===e,onClick:()=>{Ce(),e===`trusted-full-access`||e===`bypass`?P(e):k(e)},children:[(0,X.jsx)(Fr,{children:(0,X.jsx)(Em,{color:e===`bypass`?`error`:e===`trusted-full-access`?`warning`:void 0})}),(0,X.jsx)(Br,{primary:$(e,o)})]},e))]})}),(0,X.jsx)(um,{open:N!==null,title:N===`bypass`?D(o,`Tạo cuộc trò chuyện với Bypass?`,`Create with Bypass?`):D(o,`Tạo session với toàn quyền?`,`Create with full access?`),description:N===`bypass`?p||he?ym(o):vm(o):p||he?bm(o):D(o,`Session mới được phép đọc, sửa file và chạy command trong runtime. Xóa dữ liệu và gửi ra ngoài vẫn cần xác nhận riêng.`,`The new session may read and edit files and run commands. Deletion and external transfer still require separate approval.`),cancelLabel:D(o,`Hủy`,`Cancel`),confirmLabel:N===`bypass`?D(o,`Dùng Bypass`,`Use Bypass`):D(o,`Dùng toàn quyền`,`Use full access`),onCancel:()=>P(null),onConfirm:()=>{let e=N;P(null),e&&k(e)}})]})}var uh=(e,t,n)=>e===`vi`?t:n,dh=[[`⌘K`,`Mở bảng lệnh`,`Open the command palette`],[`⌘⇧O`,`Cuộc trò chuyện mới`,`New chat`],[`⌘,`,`Cài đặt`,`Settings`],[`⌘/`,`Phím tắt và lệnh /`,`Shortcuts and / commands`],[`Esc`,`Dừng lượt đang chạy (trong ô nhập)`,`Stop the running turn (in the composer)`]];function fh(e,t){let n=/^\/([a-z][a-z-]*)(?:\s+([\s\S]*))?$/.exec(e.trim()),r=n?t.find(e=>e.name===n[1]):void 0;return r?{command:r,argument:(n[2]??``).trim()}:null}var ph=(e,t,n,r)=>({tone:`error`,text:t instanceof Error&&t.message===`session-runtime-busy`?uh(e,`${n}: lượt này đang chạy, thử lại khi xong.`,`${r}: this turn is running; try again when it ends.`):uh(e,`${n}. Thử lại.`,`${r}. Try again.`)});async function mh(e,t,n,r,i){try{return await t(),n}catch(t){return ph(e,t,r,i)}}function hh(e){let{locale:t,actions:n}=e,r=(e,n)=>uh(t,e,n),i=(e,t)=>({tone:`success`,text:r(e,t)}),a=(e,t)=>({tone:`warning`,text:r(e,t)}),o=[],s=(e,t,n,i,a)=>o.push({name:e,argumentHint:t,description:r(n,i),run:a});return s(`help`,null,`Danh sách lệnh / và phím tắt`,`The / commands and keyboard shortcuts`,async()=>({tone:`info`,text:[...o.map(e=>`/${e.name}${e.argumentHint?` ${e.argumentHint}`:``} — ${e.description}`),...dh.map(([e,t,n])=>`${e} — ${r(t,n)}`)].join(`
46
+ `)})),s(`new`,null,`Cuộc trò chuyện mới`,`New chat`,async()=>(n.newChat(),i(`Đã mở cuộc trò chuyện mới.`,`Opened a new chat.`))),s(`stop`,null,`Dừng lượt đang chạy`,`Stop the running turn`,async()=>e.running?mh(t,n.stop,i(`Đã dừng lượt đang chạy.`,`Stopped the running turn.`),`Chưa dừng được`,`Could not stop`):{tone:`info`,text:r(`Không có lượt nào đang chạy.`,`No turn is running.`)}),s(`name`,`<tên>`,`Đổi tên cuộc trò chuyện`,`Rename the conversation`,async e=>e?mh(t,()=>n.rename(e.slice(0,200)),i(`Đã đổi tên thành “${e.slice(0,200)}”.`,`Renamed to “${e.slice(0,200)}”.`),`Chưa đổi được tên`,`Could not rename`):a(`Cách dùng: /name <tên mới>`,`Usage: /name <new name>`)),s(`fork`,null,`Tạo cuộc trò chuyện mới từ cuộc này`,`Fork this conversation`,async()=>mh(t,n.fork,i(`Đã tạo bản sao của cuộc trò chuyện.`,`Forked the conversation.`),`Chưa tạo được bản sao`,`Could not fork`)),s(`pin`,null,e.pinned?`Bỏ ghim cuộc trò chuyện`:`Ghim cuộc trò chuyện`,e.pinned?`Unpin the conversation`:`Pin the conversation`,async()=>mh(t,()=>n.pin(!e.pinned),e.pinned?i(`Đã bỏ ghim.`,`Unpinned.`):i(`Đã ghim.`,`Pinned.`),`Chưa đổi được ghim`,`Could not change the pin`)),s(`archive`,null,`Lưu trữ cuộc trò chuyện`,`Archive the conversation`,async()=>mh(t,n.archive,i(`Đã lưu trữ cuộc trò chuyện.`,`Archived the conversation.`),`Chưa lưu trữ được`,`Could not archive`)),e.thinkingLevels.length&&s(`thinking`,`<${e.thinkingLevels.join(`|`)}>`,`Đổi mức suy luận`,`Change the thinking level`,async r=>e.thinkingLevels.includes(r)?mh(t,()=>n.setThinking(r),i(`Đã đổi thinking sang ${r}.`,`Thinking is now ${r}.`),`Chưa đổi được thinking`,`Could not change thinking`):a(`Cách dùng: /thinking ${e.thinkingLevels.join(`|`)}`,`Usage: /thinking ${e.thinkingLevels.join(`|`)}`)),e.company?(s(`undo`,null,`Hoàn tác file mà lượt trước của agent đã sửa`,`Undo the files the agent's last turn changed`,async()=>({send:!0})),e.fast&&s(`fast`,`[on|off]`,`Bật/tắt Fast (Harness cho phép)`,`Turn Fast on or off (where the Harness allows it)`,async r=>{let o=r===`on`?!0:r===`off`?!1:r?null:e.fast!==`on`;return o===null?a(`Cách dùng: /fast on|off`,`Usage: /fast on|off`):mh(t,()=>n.setFast(o),o?i(`Đã bật Fast.`,`Fast is on.`):i(`Đã tắt Fast.`,`Fast is off.`),`Chưa đổi được Fast`,`Could not change Fast`)}),s(`bypass`,`<on|full|off>`,`Bypass (không hỏi gì), Toàn quyền (chỉ hỏi việc bắt buộc) hoặc Hỏi trước`,`Bypass (asks nothing), Full access (asks only what must be asked) or Ask first`,async o=>o===`off`?mh(t,()=>n.setPermission(`workspace-write`),i(`Đã chuyển sang Hỏi trước.`,`Switched to Ask first.`),`Chưa đổi được quyền`,`Access not changed`):o===`full`?{confirm:{title:r(`Bật Toàn quyền?`,`Turn on Full access?`),confirmLabel:r(`Bật Toàn quyền`,`Turn on Full access`),description:r(`Lệnh cần internet hoặc Docker chạy không hỏi; push, deploy và lệnh trên máy vẫn hỏi.`,`Commands that need the internet or Docker run without asking; pushes, deploys and commands on this machine still ask.`),run:()=>mh(t,()=>n.setPermission(`trusted-full-access`),i(`Đã bật Toàn quyền.`,`Full access is on.`),`Chưa đổi được quyền`,`Access not changed`)}}:o===`on`?e.bypass?{confirm:{title:r(`Bật Bypass?`,`Turn on Bypass?`),confirmLabel:r(`Bật Bypass`,`Turn on Bypass`),description:r(`Không hỏi gì nữa: internet, Docker, lệnh trên máy, push, deploy, migration đều chạy luôn. Lệnh thường vẫn trong sandbox; /undo vẫn dùng được.`,`Nothing is asked any more: internet, Docker, commands on this machine, pushes, deploys and migrations all run. Plain commands stay in the sandbox; /undo still works.`),run:()=>mh(t,()=>n.setPermission(`bypass`),i(`Đã bật Bypass.`,`Bypass is on.`),`Chưa đổi được quyền`,`Access not changed`)}}:a(`Harness của team đã tắt Bypass (admin Studio). Dùng /bypass full cho Toàn quyền.`,`The team's Harness has Bypass off (Studio administrator). Use /bypass full for Full access.`):a(`Cách dùng: /bypass on|full|off`,`Usage: /bypass on|full|off`))):(s(`model`,`<tên model>`,`Đổi model`,`Change the model`,async r=>{let o=await e.loadModels().catch(()=>[]),s=r.toLowerCase(),c=s?o.filter(e=>e.label.toLowerCase()===s||e.modelRef.toLowerCase()===s):[],l=c.length?c:s?o.filter(e=>e.label.toLowerCase().includes(s)||e.modelRef.toLowerCase().includes(s)):[];return l.length===1?mh(t,()=>n.setModel(l[0].modelRef),i(`Đã đổi model sang ${l[0].label}.`,`The model is now ${l[0].label}.`),`Chưa đổi được model`,`Could not change the model`):a(`Cách dùng: /model <tên>. Có: ${o.map(e=>e.label).slice(0,12).join(`, `)||`—`}`,`Usage: /model <name>. Available: ${o.map(e=>e.label).slice(0,12).join(`, `)||`—`}`)}),s(`permission`,`<read-only|ask|full|bypass>`,`Đổi quyền của cuộc trò chuyện`,`Change the conversation's access`,async e=>{let o=e===`read-only`?`read-only`:e===`ask`?`workspace-write`:e===`full`?`trusted-full-access`:e===`bypass`?`bypass`:null;if(!o)return a(`Cách dùng: /permission read-only|ask|full|bypass`,`Usage: /permission read-only|ask|full|bypass`);let s=()=>mh(t,()=>n.setPermission(o),i(`Đã đổi quyền sang ${e}.`,`Access is now ${e}.`),`Chưa đổi được quyền`,`Access not changed`);return o===`bypass`?{confirm:{title:r(`Bật Bypass?`,`Turn on Bypass?`),confirmLabel:r(`Bật Bypass`,`Turn on Bypass`),description:r(`Không hỏi, không chặn gì trong cuộc trò chuyện này (xoá, push, file được bảo vệ đều chạy luôn). Output vẫn che secret, /undo vẫn hoàn tác được.`,`Nothing is asked or blocked in this conversation (deletes, pushes and protected files all run). Output is still redacted and /undo still works.`),run:s}}:o===`trusted-full-access`?{confirm:{title:r(`Bật toàn quyền?`,`Enable full access?`),confirmLabel:r(`Bật toàn quyền`,`Enable full access`),description:r(`Session được đọc, sửa file và chạy command trong phạm vi runtime; xoá hoặc gửi dữ liệu ra ngoài vẫn cần xác nhận riêng.`,`The session may read and edit files and run commands within the runtime; destructive actions and external transfers still ask.`),run:s}}:s()})),s(`changes`,null,`Mở Source Changes`,`Open Source Changes`,async()=>(n.openChanges(),i(`Đã mở Source Changes.`,`Opened Source Changes.`))),s(`settings`,null,`Mở Cài đặt`,`Open Settings`,async()=>(n.openSettings(),i(`Đã mở Cài đặt.`,`Opened Settings.`))),o}var gh=`piagent dashboard`;function _h(){return(0,Y.useSyncExternalStore)(xt,bt,bt)}function vh({locale:e}){let[t,n]=(0,Y.useState)(!1);return(0,X.jsxs)(Q,{role:`alert`,spacing:2,sx:{minHeight:`100vh`,alignItems:`center`,justifyContent:`center`,px:2,textAlign:`center`},children:[(0,X.jsx)(q,{variant:`h6`,component:`h1`,children:D(e,`Tab này đã hết phiên đăng nhập`,`This tab is no longer signed in`)}),(0,X.jsx)(q,{color:`text.secondary`,sx:{maxWidth:520},children:D(e,`Piagent vừa khởi động lại, tab không được dùng quá 8 giờ, hoặc tab được mở từ một link cũ. Các cuộc trò chuyện vẫn còn nguyên — mở lại Piagent để vào tiếp.`,`Piagent restarted, this tab was unused for over 8 hours, or this tab came from an old link. Your conversations are kept — open Piagent again to continue.`)}),(0,X.jsxs)(Z,{sx:{display:`flex`,gap:1,alignItems:`center`,flexWrap:`wrap`,justifyContent:`center`},children:[(0,X.jsx)(Z,{component:`code`,sx:{px:1.5,py:.75,borderRadius:1,bgcolor:`action.hover`,fontSize:`.9rem`},children:gh}),(0,X.jsx)(J,{size:`small`,variant:`outlined`,onClick:()=>{navigator.clipboard?.writeText(gh).then(()=>n(!0),()=>n(!1))},children:t?D(e,`Đã chép`,`Copied`):D(e,`Chép lệnh`,`Copy command`)})]}),(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:D(e,`Chạy lệnh trên trong terminal, hoặc bấm WebUI trong Agent Watch. Sau đó có thể đóng tab này.`,`Run it in a terminal, or choose WebUI in Agent Watch. You can close this tab afterwards.`)})]})}var yh=K((0,X.jsx)(`path`,{d:`m12.35 15.65 2.79-2.79c.31-.31.09-.85-.35-.85H13V4c0-.55-.45-1-1-1s-1 .45-1 1v8H9.21c-.45 0-.67.54-.35.85l2.79 2.79c.19.2.51.2.7.01M21 3h-5.01c-.54 0-.99.45-.99.99 0 .55.45.99.99.99H20c.55 0 1 .45 1 1v12.03c0 .55-.45 1-1 1H4c-.55 0-1-.45-1-1V5.99c0-.55.45-1 1-1h4.01c.54 0 .99-.45.99-.99 0-.55-.45-1-.99-1H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2`}),`SystemUpdateAltRounded`),bh=class extends Error{status;constructor(e,t){super(t),this.status=e}};async function xh(e,t){let n;if(t?.method===`POST`){let r=vt();if(!r)throw new bh(403,`mutation-authority-rejected`);n=await _t(e,{...t,credentials:`same-origin`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":r}})}else n=await fetch(e,{...t,credentials:`same-origin`,headers:{Accept:`application/json`}});n.status===401&&yt();let r=await n.json().catch(()=>null);if(!n.ok)throw new bh(n.status,typeof r?.error?.code==`string`?r.error.code:`request-${n.status}`);return r}var Sh=e=>xh(`/api/v1/updates`,{signal:e}),Ch=()=>xh(`/api/v1/updates/check`,{method:`POST`,body:`{}`}),wh=e=>xh(`/api/v1/updates/apply`,{method:`POST`,body:JSON.stringify({version:e})}),Th=e=>e?.job?.state===`starting`||e?.job?.state===`running`,Eh=(0,Y.createContext)(null);function Dh({children:e}){let[t,n]=(0,Y.useState)(null),[r,i]=(0,Y.useState)(!0),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),d=(0,Y.useRef)(!0),f=(0,Y.useCallback)(async()=>{try{if(await St(),bt())return;let e=await Sh();d.current&&(n(e),i(!0))}catch(e){d.current&&e instanceof bh&&e.status===404&&i(!1)}},[]),p=Th(t),m=t!==null||!r;(0,Y.useEffect)(()=>{d.current=!0,f();let e=setInterval(()=>void f(),m?p?3e3:6e4:2e3);return()=>{clearInterval(e)}},[f,p,m]),(0,Y.useEffect)(()=>()=>{d.current=!1},[]);let h=(0,Y.useCallback)(async()=>{o(!0),u(null);try{n(await Ch())}catch(e){u(e instanceof Error?e.message:`update-unavailable`)}finally{o(!1)}},[]),g=(0,Y.useCallback)(async()=>{let e=t?.piagent.latest;if(e){c(!0),u(null);try{await wh(e),await f()}catch(e){u(e instanceof Error?e.message:`update-unavailable`),await f()}finally{c(!1)}}},[t?.piagent.latest,f]),_=(0,Y.useMemo)(()=>({status:t,supported:r,checking:a||!!t?.checking,applying:s,error:l,refresh:f,check:h,apply:g}),[t,r,a,s,l,f,h,g]);return(0,X.jsx)(Eh.Provider,{value:_,children:e})}function Oh(){let e=(0,Y.useContext)(Eh);if(!e)throw Error(`Piagent update state is missing`);return e}var kh=`~/.pi/piagent-update-job.log`;function Ah(e,t){let n={"update-blocked-running":[`Đang có cuộc trò chuyện chạy. Cập nhật khi chúng xong, hoặc bấm Dừng.`,`A conversation is running. Update when it finishes, or stop it.`],"update-already-running":[`Một lần cập nhật khác đang chạy.`,`Another update is running.`],"update-version-changed":[`Đã có bản mới hơn bản bạn thấy. Kiểm tra lại rồi cập nhật.`,`A newer release appeared. Check again, then update.`],"update-not-available":[`Máy này đã ở bản mới nhất.`,`This machine is already up to date.`],"update-not-installable":[`Bản Piagent này không tự cập nhật được từ dashboard.`,`This Piagent cannot update itself from the dashboard.`]}[t];return n?D(e,n[0],n[1]):D(e,`Chưa cập nhật được. Thử lại sau.`,`The update could not start. Try again later.`)}function jh(e,t){return t.state===`succeeded`?t.reason===`dashboard-restart-failed`?{severity:`warning`,text:D(e,`Đã cập nhật lên ${t.installed??t.to}, nhưng dashboard chưa tự mở lại. Chạy \`piagent dashboard restart\`.`,`Updated to ${t.installed??t.to}, but the dashboard did not restart. Run \`piagent dashboard restart\`.`)}:{severity:`success`,text:D(e,`Đã cập nhật Piagent ${t.from} → ${t.installed??t.to}.`,`Updated Piagent ${t.from} → ${t.installed??t.to}.`)}:t.state===`failed`?{severity:`error`,text:`${t.reason===`update-interrupted`?D(e,`Lần cập nhật bị ngắt giữa chừng.`,`The update was interrupted.`):t.reason===`update-version-mismatch`?D(e,`Bản cài xong không đúng bản đã chọn.`,`The installed release is not the one chosen.`):D(e,`Lệnh cập nhật báo lỗi.`,`The update command failed.`)} ${D(e,`Chi tiết trong ${kh}.`,`Details are in ${kh}.`)}`}:null}function Mh(e,t){if(!t)return D(e,`chưa kiểm tra`,`not checked yet`);let n=Math.max(0,Math.round((Date.now()-Date.parse(t))/6e4));if(n<1)return D(e,`vừa xong`,`just now`);if(n<60)return D(e,`${n} phút trước`,`${n} min ago`);let r=Math.round(n/60);return r<48?D(e,`${r} giờ trước`,`${r} h ago`):D(e,`${Math.round(r/24)} ngày trước`,`${Math.round(r/24)} days ago`)}function Nh({name:e,detail:t,chip:n,tone:r}){return(0,X.jsxs)(Q,{direction:{xs:`column`,sm:`row`},sx:{alignItems:{sm:`center`},justifyContent:`space-between`,gap:1.5,p:2.25},children:[(0,X.jsxs)(Z,{sx:{minWidth:0},children:[(0,X.jsx)(q,{sx:{fontWeight:760},children:e}),(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:t})]}),(0,X.jsx)(rr,{size:`small`,label:n,color:r,variant:r==="default"?`outlined`:`filled`,sx:{alignSelf:{xs:`flex-start`,sm:`center`}}})]})}function Ph(e,t){let n=[];return t.piagent.updateAvailable&&n.push(D(e,`Piagent ${t.piagent.installed} → ${t.piagent.latest}`,`Piagent ${t.piagent.installed} → ${t.piagent.latest}`)),t.pi.updateAvailable&&n.push(D(e,`Pi ${t.pi.installed??`?`} → ${t.pi.required} (bản Piagent ${t.piagent.latest} yêu cầu)`,`Pi ${t.pi.installed??`?`} → ${t.pi.required} (the version Piagent ${t.piagent.latest} requires)`)),n.push(D(e,`Dashboard khởi động lại và mở trong tab mới; tab này có thể đóng.`,`The dashboard restarts and opens in a new tab; this tab can be closed.`)),n}function Fh(){let{locale:e}=C(),{status:t,supported:n,checking:r,applying:i,error:a,check:o,apply:s}=Oh(),[c,l]=(0,Y.useState)(!1),u=(0,Y.useRef)(null),d=Th(t);if((0,Y.useEffect)(()=>{d&&!u.current?.closest(`[role=dialog]`)?.contains(document.activeElement)&&u.current?.focus()},[d]),!n)return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{component:`h1`,variant:`h1`,sx:{mb:3},children:D(e,`Cập nhật`,`Updates`)}),(0,X.jsx)(ut,{severity:`info`,children:D(e,`Gateway này chưa hỗ trợ kiểm tra cập nhật.`,`This Gateway does not check for updates.`)})]});let f=t?.job,p=f?jh(e,f):null,m=(t?.runningConversations??0)>0,h=t?[D(e,`Đang dùng ${t.pi.installed??`—`}`,`Using ${t.pi.installed??`—`}`),t.pi.required?D(e,`Piagent ${t.piagent.latest} cần ${t.pi.required}`,`Piagent ${t.piagent.latest} needs ${t.pi.required}`):null].filter(Boolean).join(` · `):`—`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{component:`h1`,variant:`h1`,ref:u,tabIndex:-1,sx:{mb:1},children:D(e,`Cập nhật`,`Updates`)}),(0,X.jsx)(q,{color:`text.secondary`,sx:{mb:3},children:D(e,`Piagent và Pi được cập nhật cùng nhau: Pi luôn lên đúng bản mà Piagent mới đã kiểm chứng.`,`Piagent and Pi update together: Pi always moves to the version the new Piagent is qualified on.`)}),(0,X.jsxs)(ht,{variant:`outlined`,sx:{borderRadius:1,overflow:`hidden`},children:[(0,X.jsx)(Nh,{name:`Piagent`,detail:D(e,`Đang dùng ${t?.piagent.installed??`—`}`,`Using ${t?.piagent.installed??`—`}`),chip:t?.piagent.updateAvailable?D(e,`Có bản ${t.piagent.latest}`,`${t.piagent.latest} available`):t?.piagent.latest?D(e,`Mới nhất`,`Up to date`):D(e,`Chưa rõ`,`Unknown`),tone:t?.piagent.updateAvailable?`primary`:`default`}),(0,X.jsx)(lr,{}),(0,X.jsx)(Nh,{name:`Pi`,detail:h,chip:t?.pi.updateAvailable?D(e,`Lên ${t.pi.required}`,`To ${t.pi.required}`):D(e,`Đúng bản`,`Matches`),tone:t?.pi.updateAvailable?`primary`:`default`}),t?.pi.newerUntested&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(lr,{}),(0,X.jsx)(Z,{sx:{px:2.25,py:1.5},children:(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:D(e,`Pi đã có bản ${t.pi.latest}, nhưng Piagent chưa kiểm chứng bản đó (chưa tương thích). Pi sẽ được nâng khi một bản Piagent hỗ trợ nó.`,`Pi ${t.pi.latest} is out, but Piagent is not qualified on it yet (not compatible). Pi moves when a Piagent release supports it.`)})})]}),(0,X.jsx)(lr,{}),(0,X.jsxs)(Q,{direction:{xs:`column`,sm:`row`},sx:{alignItems:{sm:`center`},justifyContent:`space-between`,gap:1.5,p:2.25},children:[(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:D(e,`Kiểm tra lần cuối: ${Mh(e,t?.checkedAt??null)} · tự kiểm tra ${(t?.checkEveryHours??1)===1?`mỗi giờ`:`mỗi ${t?.checkEveryHours} giờ`}`,`Last checked: ${Mh(e,t?.checkedAt??null)} · checks every ${(t?.checkEveryHours??1)===1?`hour`:`${t?.checkEveryHours} hours`}`)}),(0,X.jsx)(J,{variant:`outlined`,disabled:r||d||!t?.installable,onClick:()=>void o(),startIcon:r?(0,X.jsx)(Ve,{size:14}):void 0,children:D(e,`Kiểm tra ngay`,`Check now`)})]})]}),(0,X.jsxs)(Z,{sx:{mt:2.5,display:`grid`,gap:1.5},children:[t&&!t.installable&&(0,X.jsx)(ut,{severity:`info`,children:t.reason===`company-runtime`?D(e,`Đây là runtime công ty; cập nhật từ dashboard Piagent.`,`This is the company runtime; update from the Piagent dashboard.`):D(e,`Piagent này chạy từ mã nguồn (git). Cập nhật bằng git pull rồi cài lại.`,`This Piagent runs from a source checkout. Update it with git pull and reinstall.`)}),d&&(0,X.jsx)(ut,{severity:`info`,icon:(0,X.jsx)(Ve,{size:18}),children:D(e,`Đang cập nhật lên Piagent ${f?.to}… Xong, dashboard mở lại trong tab mới; tab này có thể đóng.`,`Updating to Piagent ${f?.to}… When done, the dashboard opens in a new tab; this tab can be closed.`)}),!d&&p&&(0,X.jsx)(ut,{severity:p.severity,children:p.text}),!d&&f?.bindingChanged&&(0,X.jsx)(ut,{severity:`warning`,children:D(e,`Bản mới đổi trình khởi chạy công ty: Agent Watch tự cập nhật cấu hình trong vài phút (cần Agent Watch đang chạy), rồi chế độ công ty dùng lại được.`,`The new release changed the company launcher: Agent Watch updates the configuration within a few minutes (it must be running), then company mode works again.`)}),a&&(0,X.jsx)(ut,{severity:`error`,role:`alert`,children:Ah(e,a)}),t?.installable&&t.updateAvailable&&!d&&(0,X.jsxs)(Q,{direction:{xs:`column`,sm:`row`},sx:{alignItems:{sm:`center`},gap:1.5},children:[(0,X.jsx)(J,{variant:`contained`,size:`large`,startIcon:i?(0,X.jsx)(Ve,{size:16,color:`inherit`}):(0,X.jsx)(yh,{}),disabled:i||m,onClick:()=>l(!0),children:D(e,`Cập nhật lên Piagent ${t.piagent.latest}`,`Update to Piagent ${t.piagent.latest}`)}),m&&(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:D(e,`${t.runningConversations} cuộc trò chuyện đang chạy; nút mở lại khi chúng xong.`,`${t.runningConversations} conversation(s) running; available once they finish.`)})]})]}),(0,X.jsxs)(ge,{open:c&&!!t,onClose:()=>l(!1),fullWidth:!0,maxWidth:`xs`,"aria-labelledby":`piagent-update-confirm`,children:[(0,X.jsx)(ve,{id:`piagent-update-confirm`,children:D(e,`Cập nhật Piagent?`,`Update Piagent?`)}),(0,X.jsx)(pe,{children:(0,X.jsx)(Z,{component:`ul`,sx:{m:0,pl:2.5,display:`grid`,gap:.75},children:t&&Ph(e,t).map(e=>(0,X.jsx)(q,{component:`li`,variant:`body2`,children:e},e))})}),(0,X.jsxs)(Hp,{children:[(0,X.jsx)(J,{onClick:()=>l(!1),children:D(e,`Để sau`,`Later`)}),(0,X.jsx)(J,{variant:`contained`,onClick:()=>{l(!1),s()},children:D(e,`Cập nhật`,`Update`)})]})]})]})}var Ih=`piagent-update-snooze`,Lh=`piagent-update-job-seen`,Rh=36e5;function zh(e){try{return window.localStorage.getItem(e)}catch{return null}}function Bh(e,t){try{window.localStorage.setItem(e,t)}catch{}}function Vh(e,t){try{let n=JSON.parse(zh(Ih)??`null`);return n?.version===e&&typeof n.until==`number`&&t<n.until}catch{return!1}}function Hh({locale:e,onDetails:t}){let{status:n,applying:r,error:i,apply:a}=Oh(),[o,s]=(0,Y.useState)(()=>Date.now()),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{let e=window.setInterval(()=>s(Date.now()),6e4);return()=>window.clearInterval(e)},[]);let f=n?.piagent.latest??null,p=n?.job??null;(0,Y.useEffect)(()=>{!p||p.state!==`succeeded`||zh(Lh)===p.startedAt||(Bh(Lh,p.startedAt),d(D(e,`Đã cập nhật Piagent ${p.from} → ${p.installed??p.to}.`,`Piagent updated ${p.from} → ${p.installed??p.to}.`)))},[p,e]);let m=!!(n?.installable&&n.updateAvailable&&f&&!Th(n))&&c!==f&&!Vh(f,o),h=()=>{f&&(Bh(Ih,JSON.stringify({version:f,until:Date.now()+Rh})),l(f))},g=(n?.runningConversations??0)>0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(ge,{open:m,onClose:h,fullWidth:!0,maxWidth:`xs`,"aria-labelledby":`piagent-update-offer`,children:[(0,X.jsxs)(ve,{id:`piagent-update-offer`,sx:{display:`flex`,alignItems:`center`,gap:1},children:[(0,X.jsx)(yh,{color:`primary`}),D(e,`Có bản Piagent mới: ${f}`,`Piagent ${f} is available`)]}),(0,X.jsxs)(pe,{sx:{display:`grid`,gap:1.5},children:[(0,X.jsx)(Z,{component:`ul`,sx:{m:0,pl:2.5,display:`grid`,gap:.75},children:n&&Ph(e,n).map(e=>(0,X.jsx)(q,{component:`li`,variant:`body2`,children:e},e))}),g&&(0,X.jsx)(ut,{severity:`info`,children:D(e,`${n?.runningConversations} cuộc trò chuyện đang chạy. Cập nhật khi chúng xong — dialog này sẽ nhắc lại.`,`${n?.runningConversations} conversation(s) running. Update once they finish — this will ask again.`)}),i&&(0,X.jsx)(ut,{severity:`error`,children:Ah(e,i)})]}),(0,X.jsxs)(Hp,{sx:{flexWrap:`wrap`,gap:1},children:[(0,X.jsx)(J,{onClick:h,children:D(e,`Để sau (nhắc lại sau 1 giờ)`,`Later (ask again in an hour)`)}),(0,X.jsx)(J,{onClick:()=>{l(f),t()},children:D(e,`Xem chi tiết`,`Details`)}),(0,X.jsx)(J,{variant:`contained`,disabled:g||r,onClick:()=>{l(f),a().then(t)},children:D(e,`Cập nhật ngay`,`Update now`)})]})]}),(0,X.jsx)(Tp,{open:u!==null,autoHideDuration:8e3,onClose:()=>d(null),anchorOrigin:{vertical:`top`,horizontal:`center`},children:(0,X.jsx)(ut,{severity:`success`,variant:`filled`,onClose:()=>d(null),children:u})})]})}var Uh=K((0,X.jsx)(`path`,{d:`M18.3 5.71a.996.996 0 0 0-1.41 0L12 10.59 7.11 5.7a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0s.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4`}),`CloseRounded`);function Wh({active:e,snapshot:t,sessionRef:n,terminalActivities:r,liveActivities:i,refresh:a,findings:o,onSendComments:s}){let{locale:c}=C();return(0,Y.useEffect)(()=>{let e=e=>{e.detail?.sessionRef===n&&a()};return window.addEventListener(`piagent-workspace-saved`,e),()=>window.removeEventListener(`piagent-workspace-saved`,e)},[n,a]),e===`source`?(0,X.jsx)(fu,{snapshot:t,sessionRef:n,refreshSnapshot:a,findings:o,onSendComments:s}):e===`documents`?(0,X.jsx)(ju,{sessionRef:n}):e===`activity`?(0,X.jsx)(Ru,{snapshot:t,sessionRef:n,terminalActivities:r,liveActivities:i}):(0,X.jsxs)(Q,{spacing:2.25,children:[(0,X.jsx)(ef,{snapshot:t,locale:c}),(0,X.jsx)(Qd,{snapshot:t,locale:c}),(0,X.jsx)(Gu,{snapshot:t})]})}var Gh=`min(44vw, 860px)`;function Kh({open:e,active:t,snapshot:n,state:r,sessionRef:i,terminalActivities:a,liveActivities:o,onClose:s,onActive:c,refresh:l,findings:u,onSendComments:d}){let{locale:f}=C(),p=af(y().breakpoints.up(`xl`)),m=n?.sourceChanges.workingTree.counts.files??0,h=o===void 0?n?.activity.running.length??0:o.filter(e=>e.state===`running`).length;return(0,X.jsxs)(Er,{anchor:`right`,variant:p?`persistent`:`temporary`,open:e,onClose:s,sx:{"& .MuiDrawer-paper":{width:{xs:`100%`,sm:`min(88vw, 980px)`,xl:Gh},bgcolor:`background.default`}},children:[(0,X.jsxs)(Z,{sx:{position:`sticky`,top:0,zIndex:3,bgcolor:`background.paper`,borderBottom:1,borderColor:`divider`},children:[(0,X.jsxs)(Q,{direction:`row`,sx:{minHeight:64,px:{xs:1.5,md:2},alignItems:`center`,gap:1},children:[(0,X.jsxs)(Z,{sx:{flex:1,minWidth:0},children:[(0,X.jsx)(q,{sx:{fontWeight:820},children:D(f,`Agent Inspector`,`Agent Inspector`)}),(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,children:D(f,`Task contract · Git truth · verifier`,`Task contract · Git truth · verifier`)})]}),(0,X.jsx)(bo,{title:D(f,`Làm mới Inspector`,`Refresh Inspector`),children:(0,X.jsx)(et,{onClick:()=>void l(),children:(0,X.jsx)(yf,{fontSize:`small`})})}),(0,X.jsx)(et,{"aria-label":D(f,`Đóng Inspector`,`Close Inspector`),onClick:s,children:(0,X.jsx)(Uh,{})})]}),(0,X.jsxs)(us,{value:t,onChange:(e,t)=>c(t),variant:`scrollable`,scrollButtons:`auto`,children:[(0,X.jsx)(Uo,{value:`task`,icon:(0,X.jsx)(So,{}),iconPosition:`start`,label:n?.task?`${D(f,`Task`,`Task`)} · ${n.task.progress.completed}/${n.task.progress.total}`:D(f,`Task`,`Task`)}),(0,X.jsx)(Uo,{value:`source`,icon:(0,X.jsx)(To,{}),iconPosition:`start`,label:`Source Changes${m?` · ${m}`:``}`}),(0,X.jsx)(Uo,{value:`documents`,icon:(0,X.jsx)(wo,{}),iconPosition:`start`,label:D(f,`Tài liệu`,`Documents`)}),(0,X.jsx)(Uo,{value:`activity`,icon:(0,X.jsx)(Eo,{}),iconPosition:`start`,label:`${D(f,`Activity`,`Activity`)}${h?` · ${h}`:``}`})]})]}),r===`loading`?(0,X.jsxs)(Q,{sx:{alignItems:`center`,py:12},spacing:1.5,children:[(0,X.jsx)(Ve,{size:25}),(0,X.jsx)(q,{color:`text.secondary`,children:D(f,`Đang dựng Inspector từ session và Git…`,`Building the Inspector from the session and Git…`)})]}):(r===`error`||!n)&&i&&t===`activity`&&a?.length?(0,X.jsx)(Z,{sx:{p:{xs:1.5,sm:2.5,xl:3},maxWidth:1500,mx:`auto`,width:`100%`},children:(0,X.jsx)(Ru,{sessionRef:i,terminalActivities:a,liveActivities:o})}):r===`error`||!n||!i?(0,X.jsxs)(Q,{sx:{p:3,maxWidth:720},spacing:2,children:[(0,X.jsx)(ut,{severity:`warning`,children:D(f,`Không thể dựng Inspector cho session này. Chat vẫn an toàn; hãy kiểm tra project còn tồn tại và thử làm mới.`,`The Inspector could not be built for this session. Chat remains safe; check that the project still exists and refresh.`)}),(0,X.jsx)(J,{variant:`outlined`,onClick:()=>void l(),children:D(f,`Thử lại`,`Try again`)})]}):(0,X.jsx)(Z,{sx:{p:t===`source`?{xs:1,md:1.5}:{xs:1.5,sm:2.5,xl:3},maxWidth:t===`source`?`none`:1500,mx:`auto`,width:`100%`},children:(0,X.jsx)(Wh,{active:t,snapshot:n,sessionRef:i,terminalActivities:a,liveActivities:o,refresh:l,findings:u,onSendComments:d})})]})}var qh=K((0,X.jsx)(`path`,{d:`M12 7c.55 0 1 .45 1 1v4c0 .55-.45 1-1 1s-1-.45-1-1V8c0-.55.45-1 1-1m-.01-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m1-3h-2v-2h2z`}),`ErrorOutlineRounded`),Jh=e=>Array.from({length:e},()=>({selected:[],other:``,otherOn:!1})),Yh=e=>e.selected.length>0||e.otherOn&&e.other.trim().length>0,Xh=(e,t)=>!e||e===`main`?D(t,`Main agent`,`Main agent`):D(t,`Subagent ${e}`,`Subagent ${e}`);function Zh({sessionRef:e,pending:t,locale:n,onDone:r}){let[i,a]=(0,Y.useState)(()=>Jh(t.questions.length)),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(``),u=(0,Y.useRef)([]),d=(0,Y.useRef)(null),f=(0,Y.useRef)([]),[p,m]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{d.current?.focus({preventScroll:!0})},[]);let h=(e,t)=>a(n=>n.map((n,r)=>r===e?t(n):n)),g=(e,n)=>h(e,r=>t.questions[e].multiSelect?{...r,selected:r.selected.includes(n)?r.selected.filter(e=>e!==n):[...r.selected,n]}:{selected:[n],other:r.other,otherOn:!1}),_=(e,n=!0)=>{h(e,r=>t.questions[e].multiSelect?{...r,otherOn:n}:{selected:[],other:r.other,otherOn:n}),n&&setTimeout(()=>u.current[e]?.focus(),0)},v=i.every(Yh),y=e=>{if(e.target.tagName===`INPUT`&&e.target.type===`text`)return;if(e.key===`Enter`){v&&(e.preventDefault(),x());return}let n=Number(e.target.closest(`fieldset`)?.getAttribute(`data-question`)??NaN),r=Number.isInteger(n)?n:p,a=Number(e.key),o=t.questions[r],s=o.options.length;if(!(!Number.isInteger(a)||a<1||a>s+1)){if(e.preventDefault(),a===s+1){_(r,!o.multiSelect||!i[r].otherOn);return}g(r,a-1),!o.multiSelect&&r+1<t.questions.length&&(m(r+1),f.current[r+1]?.focus({preventScroll:!1}))}},b=async(i,a)=>{s(a),l(``);try{await Sc(e,t.questionRef,i),r()}catch(e){s(null),l(e.status===409?D(n,`Câu hỏi này đã được trả lời hoặc lượt làm việc đã dừng.`,`This question was already answered or the turn stopped.`):D(n,`Chưa gửi được câu trả lời. Thử lại.`,`The answer could not be sent. Try again.`))}},x=()=>{!v||o||b({answers:i.map(e=>({selected:[...e.selected].sort((e,t)=>e-t),...e.otherOn&&e.other.trim()?{other:e.other.trim()}:{}}))},`answer`)},S=t.questions.length;return(0,X.jsxs)(`article`,{className:`question-card`,ref:d,tabIndex:-1,onKeyDown:y,"aria-labelledby":`question-${t.questionRef}`,children:[(0,X.jsxs)(`header`,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`p`,{className:`section-kicker`,children:D(n,`${Xh(t.role,n)} cần bạn quyết định`,`${Xh(t.role,n)} needs your decision`)}),(0,X.jsx)(`h2`,{id:`question-${t.questionRef}`,children:S>1?D(n,`${S} câu hỏi`,`${S} questions`):D(n,`1 câu hỏi`,`1 question`)})]}),(0,X.jsx)(`span`,{className:`question-hint`,children:D(n,`Bấm số để chọn · Enter để gửi`,`Press a number to choose · Enter to send`)})]}),t.questions.map((e,r)=>{let a=i[r],o=`${t.questionRef}-${r}`,s=e.multiSelect?`checkbox`:`radio`;return(0,X.jsxs)(`fieldset`,{className:r===p?`question-block active`:`question-block`,"data-question":r,tabIndex:-1,ref:e=>{f.current[r]=e},onFocus:()=>m(r),children:[(0,X.jsxs)(`legend`,{children:[S>1&&(0,X.jsxs)(`span`,{className:`question-number`,children:[r+1,`.`]}),e.header&&(0,X.jsx)(`span`,{className:`question-chip`,children:e.header}),(0,X.jsx)(`span`,{className:`question-text`,children:e.question})]}),e.multiSelect&&(0,X.jsx)(`p`,{className:`question-multi`,children:D(n,`Có thể chọn nhiều đáp án.`,`You can choose more than one.`)}),(0,X.jsxs)(`ol`,{className:`question-options`,children:[e.options.map((e,t)=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`label`,{className:a.selected.includes(t)?`selected`:void 0,children:[(0,X.jsx)(`input`,{type:s,name:o,checked:a.selected.includes(t),onChange:()=>g(r,t)}),(0,X.jsx)(`span`,{className:`option-number`,"aria-hidden":`true`,children:t+1}),(0,X.jsxs)(`span`,{className:`option-body`,children:[(0,X.jsx)(`strong`,{children:e.label}),e.description&&(0,X.jsx)(`small`,{children:e.description})]})]})},t)),(0,X.jsxs)(`li`,{className:`question-other`,children:[(0,X.jsxs)(`label`,{className:a.otherOn?`selected`:void 0,children:[(0,X.jsx)(`input`,{type:s,name:o,checked:a.otherOn,onChange:()=>_(r,!e.multiSelect||!a.otherOn)}),(0,X.jsx)(`span`,{className:`option-number`,"aria-hidden":`true`,children:e.options.length+1}),(0,X.jsx)(`span`,{className:`option-body`,children:(0,X.jsx)(`strong`,{children:D(n,`Khác`,`Other`)})})]}),a.otherOn&&(0,X.jsx)(`input`,{type:`text`,ref:e=>{u.current[r]=e},maxLength:1e3,value:a.other,"aria-label":D(n,`Câu trả lời khác cho câu ${r+1}`,`Other answer to question ${r+1}`),placeholder:D(n,`Nhập câu trả lời của bạn`,`Type your answer`),onChange:e=>h(r,t=>({...t,other:e.target.value})),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),x())}})]})]})]},o)}),c&&(0,X.jsx)(`p`,{className:`form-error`,role:`alert`,children:c}),(0,X.jsxs)(`footer`,{children:[(0,X.jsx)(`button`,{type:`button`,className:`secondary-action`,disabled:!!o,onClick:()=>void b({skipped:!0},`skip`),children:o===`skip`?D(n,`Đang gửi…`,`Sending…`):D(n,`Để agent tự quyết`,`Let the agent decide`)}),(0,X.jsx)(`button`,{type:`button`,className:`primary-action`,disabled:!v||!!o,onClick:x,children:o===`answer`?D(n,`Đang gửi…`,`Sending…`):D(n,`Gửi câu trả lời`,`Send answer`)})]})]})}function Qh(e,t){let[n,r]=(0,Y.useState)([]),[i,a]=(0,Y.useState)(0);return(0,Y.useEffect)(()=>{let t=new AbortController;return xc(e,t.signal).then(e=>r(e.questions??[]),()=>void 0),()=>t.abort()},[e,t,i]),(0,Y.useEffect)(()=>{if(!t&&!n.length)return;let e=setInterval(()=>a(e=>e+1),n.length?4e3:1500);return()=>clearInterval(e)},[t,n.length]),{pending:n,done:e=>r(t=>t.filter(t=>t.questionRef!==e))}}var $h={main:0,scout:1,research:2,verify:3,review:4},eg=e=>$h[e]??5;function tg(e){return[...e].sort((e,t)=>eg(e.role)-eg(t.role)||Date.parse(e.askedAt)-Date.parse(t.askedAt))}function ng(e){return!!(e&&!e.complete&&e.activities.some(e=>e.toolLabel===`ask_user`&&e.state===`running`))}function rg(e,t){return ng(t)?`question`:e.liveState===`waiting-approval`?`approval`:e.needsAttention&&(e.liveState===`running`||e.liveState===`idle`)?`question`:null}function ig(e,t){let n={};for(let r of e){if(r.archived)continue;let e=t[r.sessionRef];n[r.sessionRef]={running:!!(e&&!e.complete),need:rg(r,e),operationRef:e?.operationRef??null}}return n}function ag(e,t,n,r){let i=[];for(let a of n){let n=e[a.sessionRef],o=t[a.sessionRef];if(!n||!o)continue;let s=r[a.sessionRef],c=o.operationRef??n.operationRef??`turn`;if(o.need&&o.need!==n.need&&i.push({id:`${a.sessionRef}:${c}:${o.need}:${Date.now()}`,sessionRef:a.sessionRef,title:a.title,kind:o.need}),n.running&&!o.running){let e=s?.settlement===`aborted`?`stopped`:s?.error||s?.settlement===`error`||s?.settlement===`blocked`?`failed`:`done`;i.push({id:`${a.sessionRef}:${c}:${e}`,sessionRef:a.sessionRef,title:a.title,kind:e})}}return i}function og({sessionRef:e,waiting:t,approvalRefs:n}){let{locale:r}=C(),i=Qh(e,t),a=Fd(n,e,r),[o,s]=(0,Y.useState)(null),c=tg([...i.pending.map(e=>({key:e.questionRef,kind:`question`,role:e.role??`main`,askedAt:e.askedAt,label:e.questions[0]?.header||e.questions[0]?.question||D(r,`Câu hỏi`,`Question`)})),...a.refs.map(e=>{let t=a.states[e]?.request;return{key:e,kind:`approval`,role:`main`,askedAt:t?.requestedAt??new Date(864e13).toISOString(),expiresAt:t?.expiresAt??null,label:t?t.action.commandPreview?.split(`
47
+ `)[0]||t.action.toolName:D(r,`Yêu cầu duyệt`,`Approval`)}})]),l=c.find(e=>e.key===o)??c[0];(0,Y.useEffect)(()=>{o&&!c.some(e=>e.key===o)&&s(null)},[o,c.map(e=>e.key).join(`\0`)]);let u=l?.key??null;if((0,Y.useLayoutEffect)(()=>{if(!u)return;let e=requestAnimationFrame(()=>window.scrollTo({top:document.documentElement.scrollHeight-window.innerHeight,behavior:`smooth`}));return()=>cancelAnimationFrame(e)},[u]),!l)return null;let d=c.indexOf(l);return(0,X.jsxs)(`section`,{className:`decision-queue`,"aria-label":D(r,`Việc đang chờ bạn quyết định`,`Decisions waiting for you`),"aria-live":`polite`,children:[c.length>1&&(0,X.jsxs)(`nav`,{className:`decision-steps`,"aria-label":D(r,`Các việc đang chờ`,`Waiting decisions`),children:[(0,X.jsx)(`strong`,{children:D(r,`Việc cần bạn quyết · ${d+1}/${c.length}`,`Needs your decision · ${d+1}/${c.length}`)}),(0,X.jsx)(`ol`,{children:c.map((e,t)=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,"aria-current":e===l?`step`:void 0,className:e===l?`decision-step current`:`decision-step`,onClick:()=>s(e.key),title:`${Xh(e.role,r)} · ${e.label}`,children:[(0,X.jsx)(`span`,{className:`decision-step-number`,children:t+1}),(0,X.jsx)(`span`,{className:`decision-step-kind`,children:e.kind===`question`?D(r,`Hỏi`,`Ask`):D(r,`Duyệt`,`Approve`)}),(0,X.jsx)(`span`,{className:`decision-step-role`,children:Xh(e.role,r)}),(0,X.jsx)(`span`,{className:`decision-step-label`,children:e.label})]})},e.key))})]}),l.kind===`question`?(0,X.jsx)(Zh,{sessionRef:e,locale:r,onDone:()=>i.done(l.key),pending:i.pending.find(e=>e.questionRef===l.key)},l.key):(0,X.jsx)(Pd,{state:a.states[l.key]??{},locale:r,asker:Xh(l.role,r),setState:e=>a.set(l.key,e)},l.key)]})}function sg(e,t){return e?.state===`ready`&&e.gatewayInstanceRef===t&&Number.isSafeInteger(e.eventSequence)&&e.eventSequence>=0&&Array.isArray(e.operations)&&Array.isArray(e.settlements)?e.eventSequence:null}function cg(e,t){return e&&!t?`connected`:`reconnecting`}var lg=100,ug=/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/,dg=/^[a-z0-9][a-z0-9.-]{0,95}$/,fg=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;function pg(e,t){return typeof t==`string`&&dg.test(t)?t:e===`aborted`?`operation-aborted`:e===`blocked`?`operation-blocked`:e===`error`?`operation-failed`:`operation-settlement-unknown`}function mg(e){if(e.settlement===`completed`||typeof e.operationRef!=`string`||!ug.test(e.operationRef)||typeof e.settledAt!=`string`||!fg.test(e.settledAt)||!Number.isSafeInteger(e.sequence)||Number(e.sequence)<1)return null;let t=[`blocked`,`aborted`,`error`,`unknown`].includes(String(e.settlement))?e.settlement:`unknown`,n=t===`error`?`failed`:t;return{activityRef:e.operationRef,operationRef:e.operationRef,settlement:t,state:n,reasonCode:pg(t,e.reasonCode),settledAt:e.settledAt,sequence:Number(e.sequence)}}function hg(e,t){let n=new Map;for(let r of[...e,...t])n.has(r.operationRef)||n.set(r.operationRef,r);return[...n.values()].sort((e,t)=>t.sequence-e.sequence).slice(0,lg)}function gg(e){if(e.state!==`ready`)return{};let t={};for(let n of e.settlements??[]){let e=mg(n);e&&(t[n.sessionRef]=hg(t[n.sessionRef]??[],[e]))}return t}function _g(e,t){let n=[`completed`,`blocked`,`aborted`,`error`].includes(String(t.settlement))?t.settlement:`unknown`;return{...e,operationRef:t.operationRef,abortable:!1,complete:!0,settlement:n,activities:[],delivery:e.user?`admitted`:e.delivery,assistant:n===`completed`?e.assistant:``,error:n===`completed`?null:String(t.reasonCode??`operation-settlement-unknown`)}}function vg(e,t){return{...e??{assistant:``,activities:[],operationRef:null,complete:!0,error:null},user:t.message,assistant:``,attachments:t.attachments,activities:[],operationRef:null,abortable:!1,complete:!1,settlement:null,error:null,messageRequestId:t.messageRequestId,delivery:`submitting`,startedAt:t.submittedAt,lastEventAt:t.submittedAt}}function yg(e,t,n,r){let i=t===`admitted`&&!!n&&e.operationRef===n&&e.complete;return{...e,delivery:t,operationRef:n??e.operationRef,abortable:t===`admitted`&&!i&&!!(n??e.operationRef),complete:t===`admitted`?i:e.complete,error:null,lastEventAt:r??e.lastEventAt}}function bg(e,t,n){return!e||e.messageRequestId!==n||e.delivery===`admitted`?e:t}function xg(e,t){if(t.state!==`ready`)return{...e};let n=new Map(t.operations.map(e=>[e.sessionRef,e])),r={...e};for(let[i,a]of Object.entries(e))n.has(i)||a.complete||a.delivery!==`submitting`&&(r[i]={...a,assistant:``,activities:[],operationRef:null,abortable:!1,complete:!0,settlement:`unknown`,error:`operation-settlement-unavailable`,lastEventAt:t.generatedAt});for(let n of t.operations){let i=e[n.sessionRef],a=!(n.messageRequestId&&i?.messageRequestId&&n.messageRequestId!==i.messageRequestId)&&(i?.operationRef===n.operationRef||!!(i?.user&&[`submitting`,`unconfirmed`].includes(String(i.delivery))));r[n.sessionRef]=a?{...i,operationRef:n.operationRef,abortable:n.abortable,complete:!1,settlement:null,messageRequestId:n.messageRequestId??i?.messageRequestId,delivery:i?.user?`admitted`:i?.delivery,error:null,lastEventAt:t.generatedAt}:{user:``,assistant:``,attachments:[],activities:[],operationRef:n.operationRef,messageRequestId:n.messageRequestId??null,abortable:n.abortable,complete:!1,settlement:null,error:null,runtimeRecovery:null,startedAt:t.generatedAt,lastEventAt:t.generatedAt}}return r}function Sg(e,t){let n=e.toLowerCase();return n===`compaction`?t===`vi`?`tóm tắt phần cũ của cuộc trò chuyện`:`summarising the older part of the conversation`:n===`capacity-wait`?t===`vi`?`chờ tài khoản công ty rảnh`:`waiting for a free company account`:n===`ask_user`?t===`vi`?`chờ bạn trả lời câu hỏi`:`waiting for your answer`:/(subagent|scout|delegate|agent)/.test(n)?t===`vi`?`phối hợp agent hỗ trợ`:`coordinating a helper agent`:/(bash|exec|shell|command|terminal)/.test(n)?t===`vi`?`chạy lệnh`:`running a command`:/(read|grep|find|list|glob|search_file)/.test(n)?t===`vi`?`đọc mã nguồn`:`reading source`:/(edit|write|patch|apply)/.test(n)?t===`vi`?`cập nhật file`:`updating files`:/(test|verify|check|lint)/.test(n)?t===`vi`?`kiểm tra kết quả`:`verifying results`:/(web|search|browser|fetch)/.test(n)?t===`vi`?`tìm kiếm thông tin`:`searching`:t===`vi`?`chạy công cụ`:`running a tool`}var Cg=/(?:sk-(?:proj|live|test|svcacct)-[A-Za-z0-9_-]{8,}|as_(?:live|device|run)_[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}_|(?:api[_-]?key|password|secret|token)=)/i;function wg(e){if(typeof e!=`string`)return null;let t=(e.replace(/\\/g,`/`).split(`/`).at(-1)??``).trim();return!t||t===`.`||t===`..`||t.length>160||/[\u0000-\u001f\u007f/\\]/.test(t)||Cg.test(t)||t.includes(`[REDACTED`)?null:t}function Tg(e,t=`vi`,n=Date.now()){let r=[...e.activities].reverse().find(e=>e.state===`running`),i=r?Sg(r.toolLabel,t):e.activities.length?t===`vi`?`tổng hợp bước tiếp theo`:`preparing the next step`:t===`vi`?`phân tích yêu cầu`:`analyzing the request`,a=Date.parse(e.lastEventAt??r?.startedAt??e.startedAt??``),o=Number.isFinite(a)?Math.max(0,Math.floor((n-a)/1e3)):null,s=o===null?t===`vi`?`Đang chờ cập nhật tiến trình đầu tiên`:`Waiting for the first progress update`:o<10?t===`vi`?`Tiến trình vừa cập nhật`:`Progress updated just now`:o<60?t===`vi`?`Cập nhật ${o} giây trước`:`Updated ${o}s ago`:t===`vi`?`Cập nhật ${Math.floor(o/60)} phút trước`:`Updated ${Math.floor(o/60)}m ago`,c=wg(r?.fileLabel),l=c?`${c} · ${s}`:s;return{label:t===`vi`?`Piagent đang ${i}…`:`Piagent is ${i}…`,detail:l}}function Eg(e,t,n,r){if(e?.state!==`ready`||e.gatewayInstanceRef!==t)return!1;let i=e.operations.find(e=>e.sessionRef===n);return i?.operationRef===r&&i.abortable===!0}function Dg(e,t){return{key:t,user:e,steps:[],answer:null,failure:null,failureDetail:null,requests:0,tokens:0,model:null,process:null,end:null,startedAt:e.recordedAt,endedAt:null,outputTokens:0,generationMs:0}}var Og=new Set([`objection`,`rejudge`,`dispute`]);function kg(e){let t=[],n=null,r=NaN;for(let i of e){let e=Date.parse(i.recordedAt),a=r;if(i.role!==`custom`&&(r=e),i.role===`user`){n=Dg(i,i.messageRef),t.push(n);continue}if(!n||i.role===`tool-result`)continue;if(n.endedAt=i.recordedAt,i.role===`custom`&&i.turnEnd){n.end=i.turnEnd;continue}if(i.role===`custom`&&i.process){if(n.process&&(n.answer&&(n.steps.push({kind:`note`,key:`${i.messageRef}:round-answer`,text:n.answer}),n.answer=null),n.steps.push({kind:`process`,key:`${i.messageRef}:round`,process:n.process}),n.process=null),i.process.phase===`final`){n.process=i.process;continue}n.answer&&!Og.has(i.process.phase)&&(n.steps.push({kind:`note`,key:`${i.messageRef}:answer`,text:n.answer}),n.answer=null),n.steps.push({kind:`process`,key:i.messageRef,process:i.process});continue}i.role===`assistant`&&i.usage?.outputTokens&&e>a&&(n.outputTokens+=i.usage.outputTokens,n.generationMs+=e-a),i.role===`assistant`&&(i.failure?.local||(n.requests+=1),n.tokens+=i.usage?.totalTokens??0,n.model=i.model??n.model);let o=td(i);if(o){n.answer||(n.failure=o,n.failureDetail=i.failure??null);continue}for(let e of i.toolCalls)n.steps.push({kind:`tool`,key:`${i.messageRef}:${e.toolCallRef}`,tool:e});if(i.toolCalls.length)continue;let s=i.role===`assistant`?nd(i.content.text??``):i.content.text;if(s){if(i.role===`custom`){n.steps.push({kind:`note`,key:i.messageRef,text:s});continue}n.answer&&n.answer.trim()!==s.trim()&&n.steps.push({kind:`note`,key:`${i.messageRef}:previous`,text:n.answer}),n.answer=s,n.failure=null,n.failureDetail=null}}return t}function Ag(e){let t=Date.parse(e.startedAt??``),n=Date.parse(e.endedAt??``);return Number.isFinite(t)&&Number.isFinite(n)&&n>=t?Math.round((n-t)/1e3):null}function jg(e){if(e.outputTokens<50||e.generationMs<250)return null;let t=e.outputTokens/(e.generationMs/1e3);return t>=10?Math.round(t):Math.round(t*10)/10}function Mg(e,t){return e<40||t<1e3?null:Math.round(e/4/(t/1e3))}function Ng(e){return e<1e3?String(e):e<1e6?`${(e/1e3).toFixed(+(e<1e4))}k`:`${(e/1e6).toFixed(1)}M`}var Pg=e=>`/api/v1/sessions/${encodeURIComponent(e)}/checkpoints`,Fg=`piagent-webui-checkpoint-v1`;function Ig(e){return Array.isArray(e)?`[${e.map(Ig).join(`,`)}]`:e&&typeof e==`object`?`{${Object.entries(e).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${JSON.stringify(e)}:${Ig(t)}`).join(`,`)}}`:JSON.stringify(e)}async function Lg(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return`sha256:${[...new Uint8Array(t)].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}var Rg=e=>typeof e==`string`&&/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/.test(e),zg=e=>typeof e==`string`&&/^[a-f0-9]{64}$/.test(e),Bg=(e,t)=>typeof e==`string`&&e.length>0&&e.length<=t,Vg=e=>Array.isArray(e)&&e.length<=1e4&&e.every(e=>Bg(e,4096)),Hg=e=>typeof e==`string`&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(e)&&Number.isFinite(Date.parse(e));function Ug(e){return e&&[`projectRef`,`runtimeInstanceId`,`sessionRef`].every(t=>typeof e[t]==`string`&&/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/.test(e[t]))&&[`taskId`,`taskRunId`,`agentOperationId`,`toolCallId`].every(t=>e[t]===null||typeof e[t]==`string`&&/^[A-Za-z0-9][A-Za-z0-9._:@~-]{0,159}$/.test(e[t]))}function Wg(e){return Rg(e.targetId)&&[`ready`,`conflict`,`busy`,`none`,`unavailable`].includes(e.result)&&(e.previewDigest===null||zg(e.previewDigest))&&(e.tree===null||typeof e.tree==`string`&&/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(e.tree))&&Array.isArray(e.steps)&&e.steps.length<=64&&e.steps.every(e=>e&&Rg(e.id)&&Bg(e.turnRef,256)&&Vg(e.restore)&&Vg(e.remove))&&Vg(e.files)&&Vg(e.conflicts)&&(e.stoppedAt===null||Rg(e.stoppedAt))}async function Gg(e,t,n){let r=await fetch(Pg(e)+(t?`/${encodeURIComponent(t)}`:``),{credentials:`same-origin`,signal:n,headers:{Accept:`application/json`}});if(r.status===401&&yt(),!r.ok)throw Error(`checkpoint-unavailable`);let i=await r.json();if(!i||i.schemaVersion!==1||i.version!==Fg||i.identity?.sessionRef!==e||!Ug(i.identity)||i.messageType!==(t?`preview`:`state`)||!/^[a-f0-9]{64}$/.test(i.revisions?.checkpointRevision??``)||i.messageType===`state`&&(typeof i.available!=`boolean`||typeof i.agentRunning!=`boolean`||!Array.isArray(i.points)||i.points.length>64||!i.points.every(e=>e&&Rg(e.id)&&Bg(e.turnRef,256)&&Number.isSafeInteger(e.at)&&e.at>=0))||i.messageType===`preview`&&(i.targetId!==t||!Wg(i)))throw Error(`checkpoint-response-invalid`);return i}var Kg=(e,t)=>Gg(e,null,t),qg=(e,t,n)=>Gg(e,t,n);async function Jg(e){if(!Wg(e)||!Ug(e.identity)||!zg(e.revisions?.checkpointRevision)||!e.previewDigest||!e.tree||!e.steps.length||![`ready`,`conflict`].includes(e.result))throw Error(`checkpoint-preview-unavailable`);let t=Date.now(),n=`checkpoint.restore`,r={...e.identity},i={...e.revisions},a={targetId:e.targetId,previewDigest:e.previewDigest,expectedTree:e.tree,confirmed:!0};return{schemaVersion:1,version:Fg,messageType:`command`,action:n,identity:r,expectedRevisions:i,payload:a,commandId:crypto.randomUUID(),idempotencyKey:crypto.randomUUID(),requestedAt:new Date(t).toISOString(),expiresAt:new Date(t+6e4).toISOString(),actionDigest:await Lg(Ig({action:n,identity:r,expectedRevisions:i,payload:a}))}}async function Yg(e,t){let{action:n,identity:r,expectedRevisions:i,payload:a}=e;return e.schemaVersion===1&&e.version===Fg&&e.messageType===`command`&&n===`checkpoint.restore`&&Ug(r)&&r.sessionRef===t&&zg(i?.checkpointRevision)&&a?.confirmed===!0&&Rg(a.targetId)&&zg(a.previewDigest)&&typeof a.expectedTree==`string`&&/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(a.expectedTree)&&typeof e.commandId==`string`&&/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/.test(e.commandId)&&typeof e.idempotencyKey==`string`&&/^[A-Za-z0-9._~-]{32,128}$/.test(e.idempotencyKey)&&Hg(e.requestedAt)&&Hg(e.expiresAt)&&e.actionDigest===await Lg(Ig({action:n,identity:r,expectedRevisions:i,payload:a}))}async function Xg(e,t){if(!await Yg(t,e))throw Error(`checkpoint-command-invalid`);let n=vt();if(!n)throw Error(`checkpoint-unavailable`);let r=await _t(Pg(e),{method:`POST`,credentials:`same-origin`,headers:{Accept:`application/json`,"Content-Type":`application/json`,"X-Piagent-CSRF":n},body:JSON.stringify(t)});if(r.status===401&&yt(),!r.ok)throw Error(`checkpoint-unavailable`);let i=await r.json();if(!i||i.schemaVersion!==1||i.version!==Fg||i.messageType!==`receipt`||i.commandId!==t.commandId||i.actionDigest!==t.actionDigest||i.action!==t.action||i.targetId!==t.payload.targetId||i.idempotencyKeyDigest!==await Lg(t.idempotencyKey)||Ig(i.identity)!==Ig(t.identity)||![`settled`,`rejected`,`uncertain`].includes(i.phase)||![`restored`,`conflict`,`stale-revision`,`identity-mismatch`,`read-only`,`busy`,`unavailable`,`expired`,`idempotency-payload-mismatch`,`effect-unknown`].includes(i.resultCode)||i.requestedAt!==t.requestedAt||!Hg(i.settledAt)||typeof i.deduplicated!=`boolean`||!zg(i.observedRevisionsBefore?.checkpointRevision)||!zg(i.observedRevisionsAfter?.checkpointRevision)||!Array.isArray(i.completed)||i.completed.length>64||!i.completed.every(Rg)||!Vg(i.files)||!Vg(i.conflicts)||!(i.stoppedAt===null||Rg(i.stoppedAt))||i.phase===`uncertain`!=(i.resultCode===`effect-unknown`)||i.resultCode===`restored`&&i.phase!==`settled`)throw Error(`checkpoint-receipt-invalid`);return i}var Zg=`piagent.checkpoint.pending.v1`,Qg=64;function $g(e){let t=e.getItem(Zg);if(t===null)return Object.create(null);if(t.length>262144)throw Error(`checkpoint-pending-invalid`);let n=JSON.parse(t);if(!Array.isArray(n)||n.length>Qg)throw Error(`checkpoint-pending-invalid`);let r=Object.create(null);for(let e of n){if(!Array.isArray(e)||e.length!==2)throw Error(`checkpoint-pending-invalid`);let[t,n]=e;if(typeof t!=`string`||!/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/.test(t)||r[t]||!n||n.schemaVersion!==1||n.version!==`piagent-webui-checkpoint-v1`||n.messageType!==`command`||n.action!==`checkpoint.restore`||n.identity?.sessionRef!==t||n.payload?.confirmed!==!0||typeof n.payload.targetId!=`string`||typeof n.commandId!=`string`||typeof n.idempotencyKey!=`string`)throw Error(`checkpoint-pending-invalid`);r[t]=n}return r}function e_(e,t=window.sessionStorage){return $g(t)[e]}function t_(e,t,n=window.sessionStorage){let r=$g(n),i=r[e];if(i&&JSON.stringify(i)!==JSON.stringify(t))throw Error(`checkpoint-pending-exists`);if(!i&&Object.keys(r).length>=Qg)throw Error(`checkpoint-pending-capacity`);if(t.identity.sessionRef!==e)throw Error(`checkpoint-pending-session`);r[e]=t;let a=JSON.stringify(Object.entries(r));if(a.length>262144)throw Error(`checkpoint-pending-capacity`);if(n.setItem(Zg,a),n.getItem(Zg)!==a)throw Error(`checkpoint-pending-write-failed`)}function n_(e,t,n=window.sessionStorage){let r=$g(n);if(r[e]){if(JSON.stringify(r[e])!==JSON.stringify(t))throw Error(`checkpoint-pending-replaced`);delete r[e],n.setItem(Zg,JSON.stringify(Object.entries(r)))}}var r_=(0,Y.createContext)(null);function i_({turnRef:e}){let t=(0,Y.useContext)(r_),n=t?.state?.points.find(t=>t.turnRef===e);return!t||!n?null:(0,X.jsx)(J,{size:`small`,disabled:t.busy||t.state?.agentRunning,onClick:()=>t.open(n.id),sx:{alignSelf:`flex-start`},children:D(t.locale,`Khôi phục về trước lượt này`,`Restore before this turn`)})}function a_({sessionRef:e,refresh:t,running:n,locale:r,children:i}){let[a,o]=(0,Y.useState)(),[s,c]=(0,Y.useState)(0),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(!1),[h,g]=(0,Y.useState)(),[_,v]=(0,Y.useState)(),[y,b]=(0,Y.useState)(!1),[x]=(0,Y.useState)(()=>{try{return{command:e_(e),failed:!1}}catch{return{command:void 0,failed:!0}}}),[S,C]=(0,Y.useState)(x.command),[w,T]=(0,Y.useState)(x.failed),E=(0,Y.useRef)(null),O=(0,Y.useRef)(!1),k=(0,Y.useRef)(!0);(0,Y.useEffect)(()=>(k.current=!0,()=>{k.current=!1,E.current?.abort()}),[]),(0,Y.useEffect)(()=>{let t=new AbortController;return Kg(e,t.signal).then(e=>{t.signal.aborted||o(e)}).catch(()=>{}),()=>t.abort()},[e,t,s]);let A=t=>{if(u(!0),v(void 0),b(!1),S)return;E.current?.abort();let n=new AbortController;E.current=n,g(void 0),f(!0),qg(e,t,n.signal).then(e=>{n.signal.aborted||g(e)}).catch(()=>{n.signal.aborted||b(!0)}).finally(()=>{n.signal.aborted||f(!1)})},j=async()=>{if(!(w||O.current||!S&&(!h||n||a?.agentRunning||![`ready`,`conflict`].includes(h.result)))){O.current=!0,m(!0),b(!1);try{let t=S??await Jg(h);try{t_(e,t)}catch{T(!0);return}C(t);let n=await Xg(e,t);if(n.phase!==`uncertain`&&n_(e,t),!k.current)return;v(n),n.phase!==`uncertain`&&C(void 0),c(e=>e+1)}catch{k.current&&b(!0)}finally{window.dispatchEvent(new CustomEvent(`piagent-workspace-changed`,{detail:{sessionRef:e}})),O.current=!1,k.current&&m(!1)}}},M=()=>{O.current||(E.current?.abort(),u(!1),f(!1))},N=_?.conflicts??h?.conflicts??[],P=_?.phase===`uncertain`||y&&!!S;return(0,X.jsxs)(r_.Provider,{value:{state:a,busy:n||p||w,open:A,locale:r},children:[a&&!a.available&&(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,children:D(r,`Project không dùng Git nên không có checkpoint để khôi phục.`,`This project has no Git repository, so checkpoints are unavailable.`)}),S&&!l&&(0,X.jsx)(ut,{severity:`warning`,action:(0,X.jsx)(J,{color:`inherit`,onClick:()=>A(S.payload.targetId),children:D(r,`Xem kết quả`,`Check result`)}),children:D(r,`Một lần khôi phục chưa có kết quả xác nhận.`,`A restore is awaiting a confirmed result.`)}),w&&!l&&(0,X.jsx)(ut,{severity:`error`,children:D(r,`Không đọc hoặc lưu được yêu cầu khôi phục đang chờ trong trình duyệt. Chưa gửi yêu cầu mới; hãy kiểm tra file trước khi tiếp tục.`,`The browser could not read or save the pending restore. No new request was sent; inspect your files before continuing.`)}),i,(0,X.jsxs)(ge,{open:l,onClose:M,fullWidth:!0,maxWidth:`sm`,"aria-labelledby":`checkpoint-dialog-title`,children:[(0,X.jsx)(ve,{id:`checkpoint-dialog-title`,children:D(r,`Khôi phục về trước lượt này`,`Restore before this turn`)}),(0,X.jsx)(pe,{children:(0,X.jsxs)(Q,{spacing:2,children:[w&&(0,X.jsx)(ut,{severity:`error`,children:D(r,`Không đọc hoặc lưu được yêu cầu khôi phục đang chờ trong trình duyệt. Chưa gửi yêu cầu mới; hãy kiểm tra file trước khi tiếp tục.`,`The browser could not read or save the pending restore. No new request was sent; inspect your files before continuing.`)}),d&&(0,X.jsx)(q,{children:D(r,`Đang xem trước…`,`Loading preview…`)}),h&&!_&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{children:D(r,`Sẽ hoàn tác ${h.steps.length} lượt từ mới nhất về lượt đã chọn. Commit và vùng stage được giữ nguyên.`,`Undo ${h.steps.length} turns from newest to the selected turn. Commits and staged changes are preserved.`)}),(0,X.jsx)(q,{variant:`body2`,sx:{whiteSpace:`pre-wrap`,maxHeight:240,overflow:`auto`},children:h.files.join(`
48
+ `)}),![`ready`,`conflict`].includes(h.result)&&(0,X.jsx)(ut,{severity:`info`,children:D(r,`Checkpoint hiện không thể khôi phục. Đóng hộp thoại rồi xem trước lại khi lượt chạy kết thúc.`,`This checkpoint cannot be restored now. Close this dialog and preview again after the running turn ends.`)})]}),N.length>0&&(0,X.jsxs)(ut,{severity:`warning`,children:[D(r,`Sẽ dừng trước file đã thay đổi sau lượt: `,`Stop before files changed after the turn: `),N.join(`, `)]}),_&&!P&&(0,X.jsx)(ut,{severity:_.resultCode===`restored`?`success`:`warning`,children:_.resultCode===`restored`?D(r,`Đã khôi phục ${_.completed.length} lượt.`,`Restored ${_.completed.length} turns.`):_.resultCode===`conflict`?D(r,`Đã khôi phục ${_.completed.length} lượt và dừng để giữ thay đổi của bạn.`,`Restored ${_.completed.length} turns and stopped to preserve your changes.`):D(r,`Chưa khôi phục: trạng thái hoặc quyền đã thay đổi. Đóng hộp thoại và xem trước lại.`,`Not restored: state or permissions changed. Close this dialog and preview again.`)}),P&&(0,X.jsx)(ut,{severity:`warning`,children:D(r,`Chưa xác nhận được kết quả; một số file có thể đã thay đổi. Kiểm tra file trước khi tiếp tục. Nút bên dưới chỉ kiểm tra lại cùng yêu cầu.`,`The result is unconfirmed; some files may have changed. Inspect them before continuing. The button below checks the same request.`)}),y&&!S&&(0,X.jsx)(ut,{severity:`error`,children:D(r,`Không tải được preview. Đóng hộp thoại và thử lại.`,`Could not load the preview. Close this dialog and try again.`)})]})}),(0,X.jsxs)(Hp,{children:[(0,X.jsx)(J,{disabled:p,onClick:M,children:D(r,`Đóng`,`Close`)}),(!_||P)&&(0,X.jsx)(J,{variant:`contained`,disabled:w||p||d||!S&&(n||a?.agentRunning||!h?.steps.length||![`ready`,`conflict`].includes(h?.result??``)),onClick:()=>void j(),children:S?D(r,`Kiểm tra lại kết quả`,`Check result again`):D(r,`Xác nhận khôi phục`,`Confirm restore`)})]})]})]})}var o_=K((0,X.jsx)(`path`,{d:`M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-4.86 8.86-3 3.87L9 13.14 6 17h12z`}),`ImageOutlined`);function s_(e){return M(`MuiAlertTitle`,e)}g(`MuiAlertTitle`,[`root`]);var c_=e=>{let{classes:t}=e;return B({root:[`root`]},s_,t)},l_=W(q,{name:`MuiAlertTitle`,slot:`Root`})(V(({theme:e})=>({fontWeight:e.typography.fontWeightMedium,marginTop:-2}))),u_=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiAlertTitle`}),{className:r,...i}=n,a=n,o=c_(a);return(0,X.jsx)(l_,{gutterBottom:!0,component:`div`,ownerState:a,ref:t,className:P(o.root,r),...i})}),d_=K((0,X.jsx)(`path`,{d:`M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3zM7 9H4V5h3zm10 6h3v4h-3zm0-10h3v4h-3z`}),`AccountTreeOutlined`),f_=K((0,X.jsx)(`path`,{d:`m22.61 18.99-9.08-9.08c.93-2.34.45-5.1-1.44-7C9.79.61 6.21.4 3.66 2.26L7.5 6.11 6.08 7.52 2.25 3.69C.39 6.23.6 9.82 2.9 12.11c1.86 1.86 4.57 2.35 6.89 1.48l9.11 9.11c.39.39 1.02.39 1.41 0l2.3-2.3c.4-.38.4-1.01 0-1.41m-3 1.6-9.46-9.46c-.61.45-1.29.72-2 .82-1.36.2-2.79-.21-3.83-1.25C3.37 9.76 2.93 8.5 3 7.26l3.09 3.09 4.24-4.24-3.09-3.09c1.24-.07 2.49.37 3.44 1.31 1.08 1.08 1.49 2.57 1.24 3.96-.12.71-.42 1.37-.88 1.96l9.45 9.45z`}),`BuildOutlined`),p_=K((0,X.jsx)(`path`,{d:`M22 8c0-.55-.45-1-1-1h-7c-.55 0-1 .45-1 1s.45 1 1 1h7c.55 0 1-.45 1-1m-9 8c0 .55.45 1 1 1h7c.55 0 1-.45 1-1s-.45-1-1-1h-7c-.55 0-1 .45-1 1M10.47 4.63c.39.39.39 1.02 0 1.41l-4.23 4.25c-.39.39-1.02.39-1.42 0L2.7 8.16a.996.996 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0l1.42 1.42 3.54-3.54c.38-.38 1.02-.38 1.4 0m.01 8.01c.39.39.39 1.02 0 1.41L6.25 18.3c-.39.39-1.02.39-1.42 0L2.7 16.16c-.39-.39-.39-1.02 0-1.41s1.02-.39 1.41 0l1.42 1.42 3.54-3.54c.38-.38 1.02-.38 1.41.01`}),`ChecklistRounded`),m_=K((0,X.jsx)(`path`,{d:`m14.85 4.85 1.44 1.44-2.88 2.88 1.42 1.42 2.88-2.88 1.44 1.44c.31.31.85.09.85-.36V4.5c0-.28-.22-.5-.5-.5h-4.29c-.45 0-.67.54-.36.85M8.79 4H4.5c-.28 0-.5.22-.5.5v4.29c0 .45.54.67.85.35L6.29 7.7 11 12.4V19c0 .55.45 1 1 1s1-.45 1-1v-7c0-.26-.11-.52-.29-.71l-5-5.01 1.44-1.44c.31-.3.09-.84-.36-.84`}),`CallSplitRounded`),h_=K((0,X.jsx)(`path`,{d:`M9 16.17 5.53 12.7a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.18 4.18c.39.39 1.02.39 1.41 0L20.29 7.71c.39-.39.39-1.02 0-1.41a.996.996 0 0 0-1.41 0z`}),`CheckRounded`),g_=K((0,X.jsx)(`path`,{d:`m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z`}),`EditOutlined`),__=K((0,X.jsx)(`path`,{d:`M8 2c-1.1 0-2 .9-2 2v3.17c0 .53.21 1.04.59 1.42L10 12l-3.42 3.42c-.37.38-.58.89-.58 1.42V20c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2v-3.16c0-.53-.21-1.04-.58-1.41L14 12l3.41-3.4c.38-.38.59-.89.59-1.42V4c0-1.1-.9-2-2-2zm8 14.5V19c0 .55-.45 1-1 1H9c-.55 0-1-.45-1-1v-2.5l4-4zm-4-5-4-4V5c0-.55.45-1 1-1h6c.55 0 1 .45 1 1v2.5z`}),`HourglassEmptyRounded`),v_=K((0,X.jsx)(`path`,{d:`M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56M12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96M4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2s.06 1.34.14 2zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56m2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8M12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96M14.34 14H9.66c-.09-.66-.16-1.32-.16-2s.07-1.35.16-2h4.68c.09.65.16 1.32.16 2s-.07 1.34-.16 2m.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56M16.36 14c.08-.66.14-1.32.14-2s-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2z`}),`LanguageRounded`),y_=K((0,X.jsx)(`path`,{d:`M13 11h-2v3H8v2h3v3h2v-3h3v-2h-3zm1-9H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8zm4 18H6V4h7v5h5z`}),`NoteAddOutlined`),b_=K((0,X.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39`}),`PublicRounded`),x_=K((0,X.jsx)(`path`,{d:`M2 6c.55 0 1-.45 1-1V4c0-.55.45-1 1-1h1c.55 0 1-.45 1-1s-.45-1-1-1H4C2.34 1 1 2.34 1 4v1c0 .55.45 1 1 1m3 15H4c-.55 0-1-.45-1-1v-1c0-.55-.45-1-1-1s-1 .45-1 1v1c0 1.66 1.34 3 3 3h1c.55 0 1-.45 1-1s-.45-1-1-1M20 1h-1c-.55 0-1 .45-1 1s.45 1 1 1h1c.55 0 1 .45 1 1v1c0 .55.45 1 1 1s1-.45 1-1V4c0-1.66-1.34-3-3-3m2 17c-.55 0-1 .45-1 1v1c0 .55-.45 1-1 1h-1c-.55 0-1 .45-1 1s.45 1 1 1h1c1.66 0 3-1.34 3-3v-1c0-.55-.45-1-1-1m-3-3.13V9.13c0-.72-.38-1.38-1-1.73l-5-2.88c-.31-.18-.65-.27-1-.27s-.69.09-1 .27L6 7.39c-.62.36-1 1.02-1 1.74v5.74c0 .72.38 1.38 1 1.73l5 2.88c.31.18.65.27 1 .27s.69-.09 1-.27l5-2.88c.62-.35 1-1.01 1-1.73m-8 2.3-4-2.3v-4.63l4 2.33zm1-6.33L8.04 8.53 12 6.25l3.96 2.28zm5 4.03-4 2.3v-4.6l4-2.33z`}),`ViewInArRounded`),S_=K((0,X.jsx)(`path`,{d:`M19.3 16.9c.58-1.01.95-2.23.51-3.65-.53-1.72-2.04-3.05-3.84-3.22-2.87-.28-5.23 2.07-4.95 4.95.18 1.79 1.5 3.31 3.22 3.84 1.43.44 2.64.07 3.65-.51l2.5 2.5c.39.39 1.01.39 1.4 0s.39-1.01 0-1.4zm-3.8.1c-1.4 0-2.5-1.1-2.5-2.5s1.1-2.5 2.5-2.5 2.5 1.1 2.5 2.5-1.1 2.5-2.5 2.5M12 20v2C6.48 22 2 17.52 2 12S6.48 2 12 2c4.84 0 8.87 3.44 9.8 8h-2.07c-.64-2.46-2.4-4.47-4.73-5.41V5c0 1.1-.9 2-2 2h-2v2c0 .55-.45 1-1 1H8v2h2v3H9l-4.79-4.79C4.08 10.79 4 11.38 4 12c0 4.41 3.59 8 8 8`}),`TravelExploreRounded`);function C_(e){return{color:`${e}.dark`,'html[data-piagent-color-mode="dark"] &':{color:`${e}.main`}}}var w_=`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,T_={read:Nm,write:y_,edit:g_,command:Eo,search:vu,list:Tm,"web-search":S_,"web-fetch":v_,subagent:d_,network:b_,docker:x_,git:m_,plan:p_,other:f_},E_={read:[`Đọc`,`Read`],write:[`Tạo`,`Write`],edit:[`Sửa`,`Edit`],command:[`Chạy`,`Run`],search:[`Tìm`,`Search`],list:[`Xem thư mục`,`List`],"web-search":[`Tìm web`,`Web search`],"web-fetch":[`Đọc trang`,`Fetch page`],subagent:[`Subagent`,`Subagent`],network:[`Chạy có mạng`,`Run with network`],docker:[`Chạy với Docker`,`Run with Docker`],git:[`Git`,`Git`],plan:[`Plan`,`Plan`],other:[`Công cụ`,`Tool`]},D_={read:`read`,write:`write`,edit:`edit`,apply_patch:`edit`,bash:`command`,run_experiment:`command`,grep:`search`,find:`search`,ls:`list`,web_search:`web-search`,web_fetch:`web-fetch`,delegate:`subagent`,subagent:`subagent`,run_with_network:`network`,run_with_docker:`docker`,fetch_origin:`git`,update_plan:`plan`};function O_(e){return D_[e.toLowerCase()]??`other`}function k_({preview:e}){return(0,X.jsx)(Z,{component:`pre`,sx:{m:0,fontFamily:w_,fontSize:12,lineHeight:1.55,overflowX:`auto`},children:e.split(`
49
+ `).map((e,t)=>{let n=e[0],r=n===`+`?`success`:n===`-`?`error`:null;return(0,X.jsx)(Z,{component:`div`,sx:{px:1,whiteSpace:`pre`,...r?C_(r):{color:e===`@@`?`text.disabled`:`text.secondary`},bgcolor:r?`rgba(var(--piagent-palette-${r}-mainChannel) / .12)`:`transparent`},children:e===`@@`?`⋯`:e||` `},t)})})}function A_({tool:e,locale:t,live:n,waiting:r}){let i=e.summary??{kind:`other`,target:null,detail:null},a=`change`in e?e.change:void 0,o=`result`in e?e.result:void 0,s=e.state===`failed`||o?.isError===!0,c=`failure`in e&&e.failure?{detail:e.failure,copy:Lf(e.failure.reasonCode,e.failure.code,t)}:null,l=n?e.state===`running`:e.state===`requested`,[u,d]=(0,Y.useState)(()=>s||(i.kind===`edit`||i.kind===`write`)&&!!a?.preview),f=!!(a?.preview||o?.text||c?.copy||i.detail&&i.kind!==`read`),p=r?__:T_[i.kind],m=E_[i.kind][t===`vi`?0:1],h=i.kind===`other`?e.toolName:m;return(0,X.jsxs)(Z,{sx:{border:1,borderColor:s?`error.main`:`divider`,borderRadius:1,bgcolor:`background.paper`,overflow:`hidden`},children:[(0,X.jsxs)(We,{component:`div`,disabled:!f,onClick:()=>d(e=>!e),"aria-expanded":f?u:void 0,sx:{width:`100%`,display:`flex`,alignItems:`center`,gap:1,px:1.25,py:.85,textAlign:`left`,justifyContent:`flex-start`},children:[(0,X.jsx)(p,{sx:{fontSize:17,color:s?`error.main`:`text.secondary`,flexShrink:0}}),(0,X.jsx)(q,{variant:`body2`,sx:{fontWeight:600,flexShrink:0},children:h}),i.target&&(0,X.jsx)(q,{variant:`body2`,noWrap:!0,title:i.target,sx:{fontFamily:w_,fontSize:12.5,color:`text.secondary`,minWidth:0,flex:1},children:i.target}),!i.target&&(0,X.jsx)(Z,{sx:{flex:1}}),i.kind===`read`&&i.detail&&(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,sx:{flexShrink:0},children:D(t,`dòng ${i.detail}`,`lines ${i.detail}`)}),a&&(a.added>0||a.removed>0)&&(0,X.jsxs)(q,{variant:`caption`,sx:{fontFamily:w_,flexShrink:0},children:[a.added>0&&(0,X.jsxs)(Z,{component:`span`,sx:C_(`success`),children:[`+`,a.added,` `]}),a.removed>0&&(0,X.jsxs)(Z,{component:`span`,sx:C_(`error`),children:[`−`,a.removed]})]}),s&&!l&&(0,X.jsx)(q,{variant:`caption`,sx:{flexShrink:0,fontWeight:600,...C_(`error`)},children:D(t,`Lỗi`,`Failed`)}),l?(0,X.jsx)(Ve,{size:14,thickness:5,"aria-label":D(t,`Đang chạy`,`Running`)}):s?(0,X.jsx)(Uh,{sx:{fontSize:16,color:`error.main`},"aria-hidden":`true`}):(0,X.jsx)(h_,{sx:{fontSize:16,color:`success.main`},"aria-label":D(t,`Xong`,`Done`)}),f&&(0,X.jsx)(wm,{sx:{fontSize:18,color:`text.disabled`,transition:`transform .15s`,transform:u?`rotate(180deg)`:`none`}})]}),i.target&&[`read`,`write`,`edit`].includes(i.kind)&&(0,X.jsx)(Io,{path:i.target,line:Number.parseInt(i.detail??`1`,10)||1}),(0,X.jsx)(kf,{in:u&&f,unmountOnExit:!0,children:(0,X.jsxs)(Z,{sx:{borderTop:1,borderColor:`divider`,bgcolor:`action.hover`,maxHeight:360,overflow:`auto`},children:[i.detail&&i.kind!==`read`&&(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,sx:{px:1.25,py:.75,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,...i.kind===`command`?{fontFamily:w_,fontSize:12}:{}},children:i.detail}),c?.copy&&(0,X.jsxs)(Z,{sx:{px:1.25,py:.75},children:[(0,X.jsxs)(q,{variant:`body2`,sx:{fontWeight:650,...C_(`error`)},children:[Bf(c.detail.role,t),` `,D(t,`lỗi`,`failed`),` · `,c.copy.title]}),(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:c.copy.text}),(0,X.jsxs)(q,{variant:`caption`,color:`text.secondary`,sx:{fontFamily:w_,overflowWrap:`anywhere`},title:c.detail.requestRef??void 0,children:[D(t,`Mã`,`Code`),`: `,c.detail.code,c.detail.requestRef?` · request ${c.detail.requestRef.slice(0,8)}`:``]})]}),a?.preview&&(0,X.jsx)(Z,{sx:{py:.5},children:(0,X.jsx)(k_,{preview:a.preview})}),o?.text&&!c?.copy&&(0,X.jsx)(Z,{component:`pre`,sx:{m:0,px:1.25,py:.75,fontFamily:w_,fontSize:12,lineHeight:1.55,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,color:o.isError?`error.main`:`text.secondary`},children:o.text}),(a?.truncated||o?.truncated)&&(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,sx:{display:`block`,px:1.25,pb:.75},children:D(t,`Đã rút gọn`,`Truncated`)})]})})]})}var j_=K((0,X.jsx)(`path`,{d:`M15 4v7H5.17L4 12.17V4zm1-2H3c-.55 0-1 .45-1 1v14l4-4h10c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1m5 4h-2v9H6v2c0 .55.45 1 1 1h11l4 4V7c0-.55-.45-1-1-1`}),`ForumOutlined`),M_=K((0,X.jsx)(`path`,{d:`M12 5V2.21c0-.45-.54-.67-.85-.35l-3.8 3.79c-.2.2-.2.51 0 .71l3.79 3.79c.32.31.86.09.86-.36V7c3.73 0 6.68 3.42 5.86 7.29-.47 2.27-2.31 4.1-4.57 4.57-3.57.75-6.75-1.7-7.23-5.01-.07-.48-.49-.85-.98-.85-.6 0-1.08.53-1 1.13.62 4.39 4.8 7.64 9.53 6.72 3.12-.61 5.63-3.12 6.24-6.24C20.84 9.48 16.94 5 12 5`}),`ReplayRounded`),N_=(e,t,n)=>e===`vi`?t:n,P_={blocking:[`blocking`,`blocking`],major:[`major`,`major`],minor:[`minor`,`minor`]},F_={wrong_premise:[`sai giả định`,`wrong premise`],conflicts_with_request:[`conflict với yêu cầu`,`conflicts with the request`],ambiguous:[`chưa rõ ràng`,`ambiguous`],out_of_scope:[`out of scope`,`out of scope`]},I_={too_large:[`patch quá lớn`,`the patch is too large`],not_git:[`thư mục không phải git`,`not a git repository`],limit:[`subagent đã hết lượt gọi`,`the subagent ran out of calls`],failed:[`subagent lỗi`,`the subagent failed`]};function L_(e,t){let n=[];return e.outcome===`interrupted`?N_(t,`Lượt bị dừng trước khi check xong`,`The turn stopped before its checks finished`):(e.outcome===`disputed`&&n.push((e.disputes??1)>1?N_(t,`${e.disputes} conflict giữa main agent và subagent, bạn quyết định`,`${e.disputes} disagreements between the main agent and a subagent; your call`):N_(t,`Main agent và subagent conflict, bạn quyết định`,`The main agent and a subagent disagree; your call`)),e.unchanged?n.join(` · `)||N_(t,`Không đổi code`,`No code changed`):(e.verified?n.push(N_(t,`Check đã pass trên code cuối`,`A check passed on the final code`)):e.verifyPolicy!==`off`&&n.push(N_(t,`Chưa có check pass trên code cuối`,`No check passed on the final code`)),e.reviewed?n.push(e.blockingOpen?N_(t,`Còn ${e.blockingOpen} lỗi blocking chưa fix`,`${e.blockingOpen} blocking issue(s) still open`):N_(t,`Review không có lỗi blocking`,`Review found no blocking issue`)):e.reviewPolicy!==`off`&&n.push(e.outcome===`review_unavailable`?N_(t,`Không chạy được review`,`The review could not run`)+(e.reviewUnavailable&&I_[e.reviewUnavailable]?` (${N_(t,...I_[e.reviewUnavailable])})`:``):N_(t,`Chưa review`,`Not reviewed`)),e.planSkipped&&n.push(N_(t,`Đã sửa code khi chưa có plan`,`Code was changed before a plan existed`)),e.planOpen&&n.push(N_(t,`Plan còn ${e.planOpen} bước chưa xong`,`${e.planOpen} plan step(s) not completed`)),n.join(` · `)||N_(t,`Đã đổi code`,`Code changed`)))}function R_(e,t){let n=e.loop&&e.maxLoops?N_(t,` (vòng ${e.loop}/${e.maxLoops})`,` (round ${e.loop}/${e.maxLoops})`):``,r=If(e.role??`review`,t),i=(e.findings??e.claims??e.issues??[]).length;switch(e.phase){case`continue`:return N_(t,`Harness: checklist còn ${e.planOpen??0} bước (${e.planDone??0}/${e.planSteps??0} xong), cho main agent làm tiếp · vòng ${e.round??1}${e.idle?` (vòng trước không xong thêm bước nào)`:``}`,`Harness: the checklist has ${e.planOpen??0} open step(s) (${e.planDone??0}/${e.planSteps??0} done); sent the main agent on · round ${e.round??1}${e.idle?` (the previous round finished no step)`:``}`);case`plan`:return N_(t,`Harness: plan còn ${e.planOpen??0} bước chưa đánh dấu xong, yêu cầu agent cập nhật`,`Harness: ${e.planOpen??0} plan step(s) not marked completed; asked the agent to update the plan`);case`verify`:return N_(t,`Harness: chưa có check nào pass trên code hiện tại, yêu cầu agent chạy check${n}`,`Harness: no check has passed on the current code; asked the agent to run checks${n}`);case`review`:return N_(t,`Harness: review tìm thấy ${i} lỗi blocking, gửi lại agent để fix hoặc giải thích${n}`,`Harness: the review found ${i} blocking issue(s); sent back to the agent to fix or answer${n}`);case`objection`:return N_(t,`${r} phản biện brief của main agent`,`${r} objected to the main agent's brief`);case`answer`:return N_(t,`Harness: yêu cầu main agent nói rõ đã quyết định gì với phản biện của subagent`,`Harness: asked the main agent to say what it decided about the subagent's objection`);case`claims`:return N_(t,`Harness: ${r} đánh fail ${i} claim, gửi lại main agent`,`Harness: ${r} marked ${i} claim(s) as failed; sent back to the main agent`);case`rejudge`:return e.role===`verify`?N_(t,`Harness: ${r} check lại các claim cùng câu trả lời của main agent`,`Harness: ${r} checks the claims again with the main agent's answer`):N_(t,`Harness: main agent giải thích thay vì fix, ${r} xem xét lại lời giải thích`,`Harness: the main agent answered instead of fixing; ${r} judges the answer`);case`undo`:{let n=e.undo,r=n?.files?.length?` (${n.files.join(`, `)})`:``;return n?.result===`done`?N_(t,`Đã hoàn tác lượt trước: ${n.restored} file trả về như trước, ${n.removed} file lượt đó tạo đã xoá${r}.${n.more?` Gửi /undo lần nữa để hoàn tác lượt trước nữa.`:``} Commit trong lượt đó vẫn giữ.`,`Undid the last turn: ${n.restored} file(s) restored, ${n.removed} file(s) it created removed${r}.${n.more?` Send /undo again to undo the turn before.`:``} Commits made in that turn stay.`):n?.result===`refused`?N_(t,`Không hoàn tác: file lượt trước đã sửa lại bị đổi tiếp sau đó${r}; hoàn tác sẽ ghi đè thay đổi đó.`,`Not undone: a file the last turn changed was changed again since${r}; undoing would overwrite that change.`):n?.result===`busy`?N_(t,`Đang có một lượt chạy: chờ nó xong (hoặc dừng nó) rồi /undo.`,`A turn is running: wait for it (or stop it), then /undo.`):n?.result===`none`?N_(t,`Không có lượt nào để hoàn tác (chỉ áp dụng cho project là git repository, từ khi mở cuộc trò chuyện).`,`There is no turn to undo (git repositories only, since the conversation opened).`):N_(t,`Không đọc được trạng thái project; không hoàn tác.`,`The project's state could not be read; nothing was undone.`)}case`dispute`:return N_(t,`Main agent và ${r} vẫn conflict sau 2 lượt, bạn quyết định`,`The main agent and the ${r} still disagree after two rounds; your call`);default:return``}}function z_(e,t){return(e.findings??[]).map(e=>({tag:N_(t,...P_[e.severity]??[e.severity,e.severity]),tone:e.severity===`blocking`?`error`:`warning`,location:e.file?`${e.file}${e.line?`:${e.line}`:``}`:null,text:e.issue})).concat((e.claims??[]).map(e=>({tag:`fail`,tone:`error`,location:null,text:e.claim}))).concat((e.issues??[]).map(e=>({tag:N_(t,...F_[e.kind]??[e.kind,e.kind]),tone:`warning`,location:null,text:e.detail})))}var B_={clean:`success`,disputed:`warning`,blocking_open:`error`,unverified:`warning`,unreviewed:`warning`,review_unavailable:`warning`,interrupted:`warning`,no_change:`info`};function V_(e,t){return L_(e,t)}var H_=e=>e?B_[e]:`info`,U_=e=>{let t=H_(e.outcome);return t===`success`&&(e.planSkipped||e.planOpen)?`warning`:t},W_={fontFamily:`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,fontSize:12.5};function G_({process:e,locale:t}){let n=z_(e,t).map(e=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Z,{component:`span`,sx:{fontWeight:600,...C_(e.tone)},children:[`[`,e.tag,`]`]}),e.location&&(0,X.jsxs)(Z,{component:`span`,sx:W_,children:[` `,e.location]}),e.location?` — `:` `,e.text]}));return n.length>0?(0,X.jsx)(Z,{component:`ol`,sx:{m:0,pl:3.5},children:n.map((e,t)=>(0,X.jsx)(q,{component:`li`,variant:`body2`,sx:{overflowWrap:`anywhere`},children:e},t))}):null}function K_({process:e,locale:t}){if(e.phase===`final`){let n=U_(e),r=n===`success`?Lp:n===`error`?qh:am;return(0,X.jsxs)(Q,{direction:`row`,role:`status`,"aria-label":D(t,`Tiến trình của lượt`,`Turn process`),sx:{alignItems:`flex-start`,gap:.75},children:[(0,X.jsx)(r,{sx:{fontSize:16,mt:.2,...C_(n)}}),(0,X.jsx)(q,{variant:`body2`,sx:C_(n),children:V_(e,t)})]})}let n=e.phase===`dispute`||e.phase===`objection`,r=e.phase===`dispute`?am:e.phase===`objection`?j_:M_,i=e.phase===`dispute`?`warning`:null;return(0,X.jsxs)(Q,{spacing:.5,role:n?`status`:void 0,sx:{borderLeft:2,borderColor:i?`warning.main`:`divider`,pl:1.25},children:[(0,X.jsxs)(Q,{direction:`row`,sx:{alignItems:`flex-start`,gap:.75},children:[(0,X.jsx)(r,{sx:{fontSize:16,mt:.2,...i?C_(i):{color:`text.secondary`}}}),(0,X.jsx)(q,{variant:`body2`,sx:i?{fontWeight:600,...C_(i)}:n?{fontWeight:600}:{color:`text.secondary`},children:R_(e,t)})]}),(0,X.jsx)(G_,{process:e,locale:t})]})}var q_=(e,t,n)=>e===`vi`?t:n;function J_(e,t){let n=e.planDeferred??0,r=e.planSteps-e.planDone-n,i=e.rounds?q_(t,` Harness đã cho agent làm tiếp ${e.rounds} vòng.`,` The harness sent the agent back ${e.rounds} time(s).`):``;if(e.state===`cancelled`)return{tone:`info`,continuable:!0,title:q_(t,`Bạn đã dừng lượt này`,`You stopped this turn`),text:q_(t,`Task chưa xong${e.planSteps?` (${e.planDone}/${e.planSteps} bước)`:``}. Bấm Tiếp tục để agent làm tiếp từ chỗ dừng.`,`The task is not finished${e.planSteps?` (${e.planDone}/${e.planSteps} steps)`:``}. Choose Continue to pick up where it stopped.`)};if(e.state===`failed`)return{tone:`error`,continuable:!0,title:q_(t,`Lượt dừng vì lỗi · ${If(e.role??`main`,t)}`,`Turn stopped by a failure · ${If(e.role??`main`,t)}`),text:q_(t,`Task chưa xong${e.planSteps?`: còn ${r}/${e.planSteps} bước`:``}. Xem lỗi phía trên; khi đã xử lý, bấm Tiếp tục để chạy lại từ chỗ dừng.`,`The task is not finished${e.planSteps?`: ${r} of ${e.planSteps} steps open`:``}. See the failure above; once it is resolved, choose Continue.`)+(e.code?` [${e.code}]`:``)};if(e.state===`midway`){let n=e.reason===`idle`?q_(t,`Main agent dừng 2 vòng liên tiếp mà không xong thêm bước nào: đọc câu trả lời cuối để biết vướng gì.`,`The main agent stopped 2 rounds in a row without finishing a step: its last answer says what is in the way.`):e.reason===`limit`?q_(t,`Đã tới giới hạn 30 vòng tự làm tiếp cho một tin nhắn.`,`The limit of 30 automatic rounds for one message was reached.`):q_(t,`Harness của team không bắt buộc plan nên không tự làm tiếp.`,`The team's Harness does not require a plan, so it does not continue on its own.`);return{tone:`warning`,continuable:!0,title:q_(t,`Dừng giữa chừng · còn ${r}/${e.planSteps} bước`,`Stopped midway · ${r} of ${e.planSteps} steps open`),text:`${n}${i} ${q_(t,`Bấm Tiếp tục để làm tiếp.`,`Choose Continue to go on.`)}`}}return n?{tone:`info`,continuable:!0,title:q_(t,`Dừng theo yêu cầu · ${e.planDone}/${e.planSteps} bước xong, ${n} bước để sau`,`Stopped as asked · ${e.planDone} of ${e.planSteps} steps done, ${n} left for later`),text:q_(t,`Các bước còn lại được để sau theo yêu cầu hoặc vì không cần nữa: câu trả lời cuối nói lý do. Bấm Tiếp tục khi muốn làm nốt.`,`The other steps were left for later as asked, or are no longer needed: the last answer says why. Choose Continue to do them.`)+i}:{tone:`success`,continuable:!1,title:e.planSteps?q_(t,`Hoàn thành · ${e.planSteps}/${e.planSteps} bước`,`Done · ${e.planSteps}/${e.planSteps} steps`):q_(t,`Xong lượt`,`Turn finished`),text:(e.planSteps?q_(t,`Mọi bước trong checklist đã xong.`,`Every checklist step is completed.`):q_(t,`Main agent đã trả lời xong; lượt này không có checklist.`,`The main agent finished its answer; this turn had no checklist.`))+i}}function Y_(e,t){return e.state===`done`&&e.planDeferred?q_(t,`Xong ${e.planDone}/${e.planSteps}, để sau ${e.planDeferred}`,`Done ${e.planDone}/${e.planSteps}, ${e.planDeferred} later`):e.state===`midway`?q_(t,`Dừng giữa chừng ${e.planDone}/${e.planSteps}`,`Stopped ${e.planDone}/${e.planSteps}`):e.state===`failed`?q_(t,`Lỗi, chưa xong`,`Failed`):e.state===`cancelled`?q_(t,`Đã dừng`,`Stopped`):e.planSteps?q_(t,`Xong ${e.planSteps}/${e.planSteps}`,`Done ${e.planSteps}/${e.planSteps}`):q_(t,`Xong`,`Done`)}function X_({end:e,locale:t,onContinue:n}){let r=J_(e,t),i=n&&r.continuable?(0,X.jsx)(J,{color:`inherit`,size:`small`,onClick:n,children:D(t,`Tiếp tục`,`Continue`)}):void 0;return(0,X.jsxs)(ut,{severity:r.tone,variant:`outlined`,role:`status`,"aria-label":D(t,`Kết quả của lượt`,`How the turn ended`),action:i,sx:{alignSelf:`stretch`},children:[(0,X.jsx)(u_,{sx:{fontSize:`inherit`,fontWeight:650,mb:.25},children:r.title}),r.text]})}var Z_={done:`success`,midway:`warning`,failed:`error`,cancelled:`info`},Q_=e=>e.state===`done`&&e.planDeferred?`info`:Z_[e.state];function $_(e,t){return Y_(e,t)}var ev=null,tv=()=>ev??=Su(()=>import(`./MarkdownMessage-DtEwqme0.js`),__vite__mapDeps([0,1,2,3,4])),nv=(0,Y.lazy)(async()=>({default:(await tv()).MarkdownMessage}));function rv({children:e}){return(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(q,{sx:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,lineHeight:1.75},children:e}),children:(0,X.jsx)(nv,{children:e})})}function iv({attachments:e,locale:t}){return e.length?(0,X.jsx)(Q,{spacing:.75,sx:{mb:1},"aria-label":D(t,`File đã gửi`,`Sent files`),children:e.map((e,n)=>{let r=`sourceBytes`in e?gd(e,t):`${e.kind===`document`?D(t,`Tài liệu`,`Document`):e.kind===`image`?D(t,`Ảnh`,`Image`):`File`}${e.truncated?` · ${D(t,`đã cắt bớt`,`truncated`)}`:``}`;return(0,X.jsxs)(ht,{variant:`outlined`,sx:{display:`flex`,alignItems:`center`,gap:1.1,minWidth:220,maxWidth:440,px:1.2,py:1,borderRadius:1,bgcolor:`background.paper`},children:[e.kind===`image`?(0,X.jsx)(o_,{color:`action`}):(0,X.jsx)(Nm,{color:`action`}),(0,X.jsxs)(Z,{sx:{minWidth:0},children:[(0,X.jsx)(q,{variant:`body2`,noWrap:!0,sx:{fontWeight:650},children:e.displayName}),(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,children:r})]})]},`${e.displayName}:${n}`)})}):null}var av=new Set([`assistant-response-failed`,`operation-failed`]);function ov(e,t){switch(e){case`provider-auth-expired`:return D(t,`Phiên đăng nhập model đã hết hạn. Mở Cài đặt → Nhà cung cấp & model để kết nối lại.`,`The model sign-in expired. Open Settings → Providers & models to reconnect.`);case`provider-auth-required`:return D(t,`Model cần đăng nhập lại. Mở Cài đặt → Nhà cung cấp & model.`,`The model needs to sign in again. Open Settings → Providers & models.`);case`provider-rate-limited`:return D(t,`Model đang bị giới hạn lượt gọi hoặc đã hết hạn mức. Thử lại sau.`,`The model is rate limited or out of quota. Try again later.`);case`provider-unavailable`:return D(t,`Model hoặc máy chủ trung gian đang không phục vụ yêu cầu này. Thử lại; nếu lỗi lặp lại, kiểm tra model đang dùng.`,`The model or its gateway did not serve this request. Retry; if it repeats, check the model in use.`);case`assistant-output-incomplete`:return D(t,`Câu trả lời dừng giữa chừng vì chạm giới hạn độ dài. Gửi “tiếp tục” để model viết tiếp.`,`The answer stopped at the length limit. Send “continue” to resume.`);default:return D(t,`Model trả lỗi và chưa có câu trả lời. Gửi lại; nếu lỗi lặp lại, kiểm tra model đang dùng.`,`The model returned an error without an answer. Send again; if it repeats, check the model in use.`)}}function sv({code:e,detail:t,locale:n,onContinue:r}){let i=Lf(e,t?.code??null,n),a=r&&zf(e)?(0,X.jsx)(J,{color:`inherit`,size:`small`,onClick:r,children:D(n,`Tiếp tục`,`Continue`)}):void 0;return i?(0,X.jsxs)(ut,{severity:`error`,variant:`outlined`,icon:(0,X.jsx)(qh,{}),action:a,sx:{alignSelf:`stretch`},children:[(0,X.jsxs)(u_,{sx:{fontSize:`inherit`,fontWeight:650,mb:.25},children:[Bf(t?.role??`main`,n),` `,D(n,`lỗi`,`failed`),` · `,i.title]}),i.text,t&&(0,X.jsxs)(q,{variant:`caption`,component:`div`,color:`text.secondary`,sx:{mt:.5,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,overflowWrap:`anywhere`},title:t.requestRef??void 0,children:[D(n,`Mã`,`Code`),`: `,t.code,t.requestRef?` · request ${t.requestRef.slice(0,8)}`:``]})]}):(0,X.jsx)(ut,{severity:`error`,variant:`outlined`,icon:(0,X.jsx)(qh,{}),action:a,sx:{alignSelf:`stretch`},children:ov(e,n)})}function cv({text:e,attachments:t,note:n,locale:r}){return(0,X.jsxs)(Z,{sx:{alignSelf:`flex-end`,maxWidth:`82%`,bgcolor:`action.selected`,borderRadius:1,px:2,py:1.4},children:[(0,X.jsx)(iv,{attachments:t,locale:r}),e&&(0,X.jsx)(q,{sx:{whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,lineHeight:1.7},children:(0,X.jsx)(Lo,{children:e})}),n&&(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,children:n})]})}function lv({children:e}){return(0,X.jsxs)(Z,{sx:{display:`flex`,gap:1.5,alignItems:`flex-start`},children:[(0,X.jsx)(Z,{className:`brand-mark`,"aria-hidden":`true`,children:`π`}),(0,X.jsxs)(Q,{spacing:1,sx:{minWidth:0,flex:1},children:[(0,X.jsx)(q,{sx:{fontWeight:600},children:`Piagent`}),e]})]})}function uv(e,t){return e.content.redacted?D(t,`Đã ẩn dữ liệu nhạy cảm`,`Sensitive data hidden`):e.content.truncated?D(t,`Nội dung đã rút gọn`,`Content truncated`):null}function dv({turn:e,locale:t}){let n=Ag(e),r=[`${e.requests} request`];e.tokens&&r.push(`${Ng(e.tokens)} token`),n!==null&&n>0&&r.push(n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`);let i=jg(e);return i!==null&&r.push(`${i} tok/s`),e.model&&r.push(e.model),(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,title:D(t,`Request model, token, thời gian và tốc độ sinh token (token đầu ra mỗi giây, tính cả thời gian chờ) của lượt này`,`Model requests, tokens, time and output speed (output tokens per second, waiting included) of this turn`),children:r.join(` · `)})}function fv({turn:e,locale:t,onContinue:n}){let r=!!n&&!e.answer&&!e.failure&&!e.end,i=e.steps.length>0||e.answer||e.failure||r||e.process||e.end;return(0,X.jsxs)(Q,{spacing:1.5,children:[(0,X.jsx)(cv,{text:e.user.content.text,attachments:e.user.attachments??[],note:uv(e.user,t),locale:t}),i&&(0,X.jsxs)(lv,{children:[e.steps.map(e=>e.kind===`tool`?(0,X.jsx)(A_,{tool:e.tool,locale:t},e.key):e.kind===`process`?(0,X.jsx)(K_,{process:e.process,locale:t},e.key):(0,X.jsx)(Z,{sx:{color:`text.secondary`,fontSize:`.875rem`,"& .MuiTypography-root":{fontSize:`inherit`}},children:(0,X.jsx)(rv,{children:e.text})},e.key)),e.failure&&(0,X.jsx)(sv,{code:e.failure,detail:e.failureDetail,locale:t,onContinue:n}),r&&(0,X.jsx)(ut,{severity:`info`,variant:`outlined`,sx:{alignSelf:`stretch`},action:(0,X.jsx)(J,{color:`inherit`,size:`small`,onClick:n,children:D(t,`Tiếp tục`,`Continue`)}),children:D(t,`Lượt này chưa có câu trả lời: nó đã bị dừng, hoặc ứng dụng hay máy tắt khi đang chạy. Các bước đã làm vẫn được giữ; bấm Tiếp tục để làm tiếp.`,`This turn has no answer: it was stopped, or the app or the machine went down while it ran. Its steps are kept; press Continue to go on.`)}),e.answer&&(0,X.jsx)(Z,{children:(0,X.jsx)(rv,{children:e.answer})}),e.process&&(0,X.jsx)(K_,{process:e.process,locale:t}),e.end&&(0,X.jsx)(X_,{end:e.end,locale:t,onContinue:e.failure?void 0:n}),e.requests>0&&(0,X.jsx)(dv,{turn:e,locale:t})]}),(0,X.jsx)(i_,{turnRef:e.user.messageRef})]})}function pv(e,t){return e===`compaction`?D(t,`Tóm tắt phần cũ của cuộc trò chuyện`,`Summarise the older part of the conversation`):e===`capacity-wait`?D(t,`Chờ tài khoản công ty rảnh (Studio đang bận, sẽ tự gửi lại)`,`Wait for a free company account (Studio is busy; it is sent again by itself)`):e}function mv({user:e,attachments:t,activities:n,assistant:r,running:i,failure:a,status:o,locale:s}){return(0,X.jsxs)(Q,{spacing:1.5,children:[e&&(0,X.jsx)(cv,{text:e,attachments:t,locale:s}),(0,X.jsxs)(lv,{children:[n.map(e=>(0,X.jsx)(A_,{live:!0,locale:s,waiting:e.toolLabel===`capacity-wait`,tool:{toolName:pv(e.toolLabel,s),state:e.state,summary:{kind:O_(e.toolLabel),target:e.fileLabel??null,detail:null}}},e.toolCallRef)),a&&(0,X.jsx)(sv,{code:a,locale:s}),r&&(0,X.jsx)(Z,{children:(0,X.jsx)(rv,{children:r})}),i&&o]})]})}function hv(e){let t=(0,Y.useRef)(null),[n,r]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{if(!e){t.current=null,r(null);return}t.current??={at:Date.now(),from:e.length},r(Mg(e.length-t.current.from,Date.now()-t.current.at))},[e]),n}function gv({live:e,locale:t,onOpenActivity:n}){let[r,i]=(0,Y.useState)(()=>Date.now());(0,Y.useEffect)(()=>{let e=window.setInterval(()=>i(Date.now()),1e4);return()=>window.clearInterval(e)},[]);let a=Tg(e,t,r),o=hv(e.assistant??``);return(0,X.jsxs)(Q,{direction:`row`,spacing:1.25,role:`status`,"aria-live":`polite`,sx:{alignItems:`center`,color:`text.secondary`,py:.75},children:[(0,X.jsx)(Ve,{size:19,thickness:4}),(0,X.jsxs)(Z,{sx:{minWidth:0},children:[(0,X.jsx)(q,{variant:`body2`,sx:{fontWeight:600},children:a.label}),(0,X.jsxs)(q,{variant:`caption`,color:`text.disabled`,children:[a.detail,o!==null&&` · ≈ ${o} tok/s`]})]}),n&&(0,X.jsx)(J,{size:`small`,variant:`text`,onClick:n,sx:{ml:`auto !important`},children:D(t,`Xem Activity`,`View Activity`)})]})}var _v=new Map,vv=96,yv=()=>document.documentElement.scrollHeight-window.innerHeight,bv=()=>yv()-window.scrollY<=vv;function xv(e,t){let n=(0,Y.useRef)(null),r=(0,Y.useRef)(!1),i=(0,Y.useRef)(!0);return(0,Y.useLayoutEffect)(()=>{if(!t||r.current)return;r.current=!0;let n=_v.get(e)??`end`;i.current=n===`end`,window.scrollTo(0,n===`end`?yv():Math.min(n,yv()))},[t,e]),(0,Y.useEffect)(()=>{let t=()=>{r.current&&(i.current=bv(),_v.set(e,i.current?`end`:window.scrollY))};window.addEventListener(`scroll`,t,{passive:!0});let a=n.current,o=typeof ResizeObserver>`u`||!a?null:new ResizeObserver(()=>{r.current&&i.current&&window.scrollTo(0,yv())});return a&&o?.observe(a),()=>{window.removeEventListener(`scroll`,t),o?.disconnect()}},[e]),n}function Sv({sessionRef:e,sessionRevision:t,live:n,approvals:r,locale:i,onOpenActivity:a,onContinue:o,reload:s=0}){let[c,l]=(0,Y.useState)(),[u,d]=(0,Y.useState)(!0),[f,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{tv()},[]);let v=Qu(e,t,n),{completionKey:y,user:b,assistant:x,operationRef:S,messageRequestId:C,startedAt:w}=v;(0,Y.useEffect)(()=>{let t=new AbortController;d(!0),h(!1),_(null);let n=window.setTimeout(()=>{ks(e,null,50,t.signal).then(e=>{l(e),y&&sd(e.items,b,x,{operationRef:S,messageRequestId:C,startedAt:w})&&_(y)}).catch(()=>{t.signal.aborted||h(!0)}).finally(()=>{t.signal.aborted||d(!1)})},y?100:0);return()=>{window.clearTimeout(n),t.abort()}},[v.key,s]);let T=c?.state===`ready`?c.items:[],E=(0,Y.useMemo)(()=>kg(T),[T]),O=(0,Y.useMemo)(()=>!!(n?.user&&cd(T,n.user,{operationRef:n.operationRef,messageRequestId:n.messageRequestId,startedAt:n.startedAt})),[T,n?.user,n?.operationRef,n?.messageRequestId,n?.startedAt]),k=!!(n&&!O&&(!n.complete||g!==y)),A=(0,Y.useMemo)(()=>!!(n?.user&&od(T,n.user,{operationRef:n.operationRef,messageRequestId:n.messageRequestId,startedAt:n.startedAt})),[T,n?.user,n?.operationRef,n?.messageRequestId,n?.startedAt]),j=async()=>{let t=c?.page.nextBeforeCursor;if(!(!t||f)){p(!0);try{let n=await ks(e,t,c.page.limit);l(e=>e?{...e,items:qu(e.items,n.items),page:n.page}:n)}catch{h(!0)}finally{p(!1)}}},M=n?nd(n.assistant||``):null,N=xv(e,!!c||m);return(0,X.jsx)(a_,{sessionRef:e,refresh:`${v.key}:${s}`,running:!!n&&!n.complete&&!n.error,locale:i,children:(0,X.jsxs)(Q,{ref:N,spacing:3,children:[c?.page.hasOlder&&(0,X.jsx)(Z,{sx:{textAlign:`center`},children:(0,X.jsx)(J,{size:`small`,variant:`text`,startIcon:f?(0,X.jsx)(Ve,{size:14}):(0,X.jsx)(Do,{}),disabled:f,onClick:()=>void j(),children:D(i,`Tải tin cũ hơn`,`Load older messages`)})}),u&&!c&&(0,X.jsx)(Z,{sx:{py:5,textAlign:`center`},children:(0,X.jsx)(Ve,{size:22})}),m&&!c&&(0,X.jsx)(ut,{severity:`warning`,icon:(0,X.jsx)(qh,{}),children:D(i,`Chưa tải được lịch sử cuộc trò chuyện. Thử lại bằng nút làm mới.`,`Session history could not be loaded. You can retry with Refresh.`)}),E.map((e,t)=>(0,X.jsx)(fv,{turn:e,locale:i,onContinue:t===E.length-1&&!k&&!r?.pending.length?o:void 0},e.key)),k&&n&&(0,X.jsx)(mv,{user:n.user&&!A?n.user:null,attachments:n.attachments,activities:n.activities,assistant:n.error?null:M,running:!n.complete&&!n.error,failure:n.complete&&n.error&&av.has(n.error)?n.error:null,locale:i,status:(0,X.jsx)(gv,{live:n,locale:i,onOpenActivity:a})}),(0,X.jsx)(og,{sessionRef:e,waiting:ng(n),approvalRefs:r?.pending.map(e=>e.approvalRef)??[]})]})})}var Cv=K((0,X.jsx)(`path`,{d:`m20.54 5.23-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27m-8.89 11.92L6.5 12H10v-2h4v2h3.5l-5.15 5.15c-.19.19-.51.19-.7 0M5.12 5l.81-1h12l.94 1z`}),`ArchiveRounded`),wv=K((0,X.jsx)(`path`,{d:`M20 4v12H5.17L4 17.17V4zm0-2H4c-1.1 0-2 .9-2 2v15.59c0 .89 1.08 1.34 1.71.71L6 18h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2`}),`ChatBubbleOutlineRounded`),Tv=K((0,X.jsx)(`path`,{d:`M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2`}),`MoreHorizRounded`),Ev=K((0,X.jsx)(`path`,{d:`M14 4v5c0 1.12.37 2.16 1 3H9c.65-.86 1-1.9 1-3V4zm3-2H7c-.55 0-1 .45-1 1s.45 1 1 1h1v5c0 1.66-1.34 3-3 3v2h5.97v7l1 1 1-1v-7H19v-2c-1.66 0-3-1.34-3-3V4h1c.55 0 1-.45 1-1s-.45-1-1-1`}),`PushPinOutlined`),Dv=K((0,X.jsx)(`path`,{d:`M19.5 12c0-.23-.01-.45-.03-.68l1.86-1.41c.4-.3.51-.86.26-1.3l-1.87-3.23c-.25-.44-.79-.62-1.25-.42l-2.15.91c-.37-.26-.76-.49-1.17-.68l-.29-2.31c-.06-.5-.49-.88-.99-.88h-3.73c-.51 0-.94.38-1 .88l-.29 2.31c-.41.19-.8.42-1.17.68l-2.15-.91c-.46-.2-1-.02-1.25.42L2.41 8.62c-.25.44-.14.99.26 1.3l1.86 1.41c-.02.22-.03.44-.03.67s.01.45.03.68l-1.86 1.41c-.4.3-.51.86-.26 1.3l1.87 3.23c.25.44.79.62 1.25.42l2.15-.91c.37.26.76.49 1.17.68l.29 2.31c.06.5.49.88.99.88h3.73c.5 0 .93-.38.99-.88l.29-2.31c.41-.19.8-.42 1.17-.68l2.15.91c.46.2 1 .02 1.25-.42l1.87-3.23c.25-.44.14-.99-.26-1.3l-1.86-1.41c.03-.23.04-.45.04-.68m-7.46 3.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5`}),`SettingsRounded`);function Ov(e){return(0,X.jsx)(rt,{viewBox:`0 0 16 16`,...e,children:(0,X.jsx)(`path`,{d:`M5 3.25a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0Zm0 2.122a2.25 2.25 0 1 0-1.5 0v5.256a2.25 2.25 0 1 0 1.5 0V9.5h3.25a2.75 2.75 0 0 0 2.75-2.75v-1.378a2.25 2.25 0 1 0-1.5 0V6.75c0 .69-.56 1.25-1.25 1.25H5V5.372ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm7.5-9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z`})})}function kv(e,t){return e.detached?D(t,`Git không ở nhánh nào (detached HEAD tại ${e.name})`,`Git is not on a branch (detached HEAD at ${e.name})`):D(t,`Nhánh Git của project: ${e.name}`,`The project's Git branch: ${e.name}`)}function Av({branch:e,locale:t,maxWidth:n=220,tooltip:r=!0}){if(!e)return null;let i=(0,X.jsxs)(Z,{component:`span`,"aria-label":r?kv(e,t):void 0,sx:{display:`inline-flex`,alignItems:`center`,gap:.4,minWidth:0,maxWidth:n,verticalAlign:`bottom`,color:e.detached?`warning.main`:`inherit`},children:[(0,X.jsx)(Ov,{sx:{fontSize:`1.1em`,flexShrink:0}}),(0,X.jsx)(Z,{component:`span`,sx:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:`.95em`},children:e.name})]});return r?(0,X.jsx)(bo,{describeChild:!0,title:kv(e,t),children:i}):i}function jv(e,t){let n=Math.max(0,Math.floor((Date.now()-Date.parse(e))/1e3));if(n<60)return D(t,`Vừa mới`,`Just now`);let r=Math.floor(n/60);if(r<60)return D(t,`${r} phút`,`${r}m`);let i=Math.floor(r/60);if(i<24)return D(t,`${i} giờ`,`${i}h`);let a=Math.floor(i/24);return D(t,`${a} ngày`,`${a}d`)}function Mv(e,t){return rg(e,t)?`attention`:t&&!t.complete?`running`:e.state===`terminal-owned`?`elsewhere`:e.state===`recovery-required`?`recovery`:e.needsAttention?`attention`:t?.complete&&t.error?`failed`:e.liveState===`running`?`running`:`idle`}function Nv({activity:e,locale:t,fresh:n=!1,question:r=!1}){let i={running:`primary.main`,elsewhere:`info.main`,attention:`warning.main`,recovery:`error.main`,failed:`error.main`,idle:n?`success.main`:`transparent`}[e],a={running:D(t,`Đang chạy`,`Running`),elsewhere:D(t,`Đang chạy ở Terminal hoặc tiến trình khác`,`Running in Terminal or another process`),attention:r?D(t,`Cần bạn trả lời`,`Needs your answer`):D(t,`Cần duyệt`,`Needs approval`),recovery:D(t,`Cần khôi phục`,`Needs recovery`),failed:D(t,`Lượt cuối lỗi`,`Last turn failed`),idle:n?D(t,`Xong, chưa xem`,`Done, not seen`):``}[e];return(0,X.jsx)(Z,{role:e===`idle`&&!n?void 0:`img`,"aria-label":a||void 0,title:a,sx:{width:8,height:8,mt:.9,ml:.75,flexShrink:0,borderRadius:`50%`,bgcolor:i,animation:e===`running`||e===`elsewhere`||e===`attention`?`piagent-pulse 1.4s ease-in-out infinite`:`none`}})}var Pv={clean:[`Đủ bước`,`All steps`],unverified:[`Chưa verify`,`Unverified`],unreviewed:[`Chưa review`,`Not reviewed`],blocking_open:[`Còn lỗi blocking`,`Blocking open`],review_unavailable:[`Không review được`,`Review unavailable`],interrupted:[`Bị dừng`,`Stopped`],disputed:[`Cần bạn quyết`,`Needs your call`]};function Fv({session:e,live:t,selected:n,locale:r,onSelect:i,onAction:a,showProject:o=!1,fresh:s=!1}){let[c,l]=(0,Y.useState)(null),u=e=>{l(null),a(e)},d=e.modelLabel===`agent-watch-auto`,f=Mv(e,t),p=f===`running`?D(r,`Đang chạy`,`Running`):f===`elsewhere`?D(r,`Đang chạy ở nơi khác`,`Running elsewhere`):f===`attention`?rg(e,t)===`question`?D(r,`Cần bạn trả lời`,`Needs your answer`):D(r,`Cần duyệt`,`Needs approval`):s?f===`failed`?D(r,`Lỗi · chưa xem`,`Failed · not seen`):D(r,`Xong · chưa xem`,`Done · not seen`):null,m=d&&!s&&f!==`running`&&f!==`elsewhere`?e.managedTurnEnd??null:null,h=!m&&d&&e.managedProcess&&e.managedProcess.outcome!==`no_change`?e.managedProcess.outcome:null;return(0,X.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,pr:.5},className:f===`attention`?`session-item attention`:s?`session-item fresh`:`session-item`,children:[(0,X.jsxs)(Ar,{selected:n,onClick:i,sx:{minWidth:0,alignItems:`flex-start`,py:1,px:1.4},children:[(0,X.jsx)(Br,{primary:(0,X.jsxs)(X.Fragment,{children:[e.pinned&&(0,X.jsx)(Ev,{sx:{fontSize:13,mr:.5,verticalAlign:`-2px`,color:`text.disabled`}}),e.title]}),secondary:(0,X.jsxs)(X.Fragment,{children:[d&&(0,X.jsxs)(Z,{component:`span`,sx:{fontWeight:650,color:`primary.main`},children:[D(r,`Công ty`,`Company`),(0,X.jsx)(`span`,{children:` · `})]}),p??jv(e.updatedAt,r),o&&(0,X.jsxs)(`span`,{children:[` · `,e.projectLabel]}),m&&(0,X.jsxs)(Z,{component:`span`,sx:C_(Q_(m)),children:[` · `,$_(m,r)]}),h&&(0,X.jsxs)(Z,{component:`span`,sx:C_(H_(h)),children:[` · `,D(r,...Pv[h])]})]}),slotProps:{primary:{noWrap:!0,sx:{fontSize:13.25,fontWeight:n?600:500}},secondary:{noWrap:!0,sx:{mt:.25,fontSize:11.25,...f===`attention`?{color:`warning.main`,fontWeight:650}:s?{color:f===`failed`?`error.main`:`success.main`,fontWeight:650}:{}}}}}),(0,X.jsx)(Nv,{activity:f,locale:r,fresh:s,question:rg(e,t)===`question`})]}),(0,X.jsx)(et,{size:`small`,"aria-label":D(r,`Tùy chọn cuộc trò chuyện`,`Chat options`),onClick:e=>l(e.currentTarget),children:(0,X.jsx)(Tv,{fontSize:`small`})}),(0,X.jsxs)(me,{anchorEl:c,open:!!c,onClose:()=>l(null),onClick:e=>e.stopPropagation(),children:[!e.archived&&(0,X.jsx)(dp,{onClick:()=>u(`rename`),children:D(r,`Đổi tên`,`Rename`)}),!e.archived&&(0,X.jsx)(dp,{onClick:()=>u(`pin`),children:e.pinned?D(r,`Bỏ ghim`,`Unpin`):D(r,`Ghim`,`Pin`)}),!e.archived&&(0,X.jsx)(dp,{onClick:()=>u(`fork`),children:D(r,`Tạo nhánh`,`Fork`)}),(0,X.jsx)(dp,{onClick:()=>u(e.archived?`unarchive`:`archive`),children:e.archived?D(r,`Bỏ lưu trữ`,`Unarchive`):D(r,`Lưu trữ`,`Archive`)})]})]})}var Iv=5,Lv=`piagent.sidebar.collapsed`;function Rv(e){try{let t=JSON.parse(window.localStorage.getItem(e)??`[]`);return new Set(Array.isArray(t)?t.filter(e=>typeof e==`string`).slice(0,500):[])}catch{return new Set}}function zv(e,t){try{window.localStorage.setItem(e,JSON.stringify([...t].slice(0,500)))}catch{}}var Bv=new Set,Vv={attention:0,recovery:1,failed:2,idle:3,running:4,elsewhere:5};function Hv({locale:e,canCreate:t,query:n,onQuery:r,groups:i,count:a,selectedRef:o,showArchived:s,archivedCount:c,settingsOpen:l,connection:u,live:d,unseen:f=Bv,onNew:p,onSelect:m,onAction:h,onToggleArchived:g,onSettings:_,updateDot:v=!1}){let y=af(e=>e.breakpoints.down(`md`)),[b,x]=(0,Y.useState)(`all`),[S,C]=(0,Y.useState)(()=>Rv(Lv)),[w,T]=(0,Y.useState)(()=>new Set),E=n.trim().length>0,O=e=>e.modelLabel===`agent-watch-auto`,k=i.flatMap(e=>e.sessions),A={company:k.filter(O).length,personal:k.filter(e=>!O(e)).length},j=(0,Y.useMemo)(()=>i.map(e=>({...e,sessions:e.sessions.filter(e=>b===`all`||b===`company`===O(e))})).filter(e=>e.sessions.length>0),[i,b]),M=j.reduce((e,t)=>e+t.sessions.length,0),N=s?[]:j.flatMap(e=>e.sessions).filter(e=>Mv(e,d[e.sessionRef])!==`idle`||f.has(e.sessionRef)).sort((e,t)=>Vv[Mv(e,d[e.sessionRef])]-Vv[Mv(t,d[t.sessionRef])]),P=(e,t,n)=>e(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),n&&zv(Lv,r),r});return(0,X.jsxs)(Z,{sx:{height:`100%`,display:`flex`,flexDirection:`column`,bgcolor:`background.paper`},children:[(0,X.jsxs)(ii,{sx:{minHeight:`60px !important`,px:`16px !important`,gap:1.1},children:[(0,X.jsx)(Z,{className:`brand-mark`,"aria-hidden":`true`,children:`π`}),(0,X.jsxs)(Z,{sx:{minWidth:0},children:[(0,X.jsx)(q,{sx:{fontWeight:600},children:`Piagent`}),(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,children:D(e,`Coding agent`,`Coding agent`)})]})]}),(0,X.jsxs)(Z,{sx:{px:1.25},children:[(0,X.jsx)(bo,{title:t?D(e,`Tạo cuộc trò chuyện mới`,`Create a new chat`):D(e,`Gateway hiện chưa cho phép tạo cuộc trò chuyện`,`The Gateway cannot create chats right now`),children:(0,X.jsx)(`span`,{children:(0,X.jsx)(J,{fullWidth:!0,disabled:!t,variant:`outlined`,onClick:p,startIcon:(0,X.jsx)(gf,{}),sx:{justifyContent:`flex-start`,py:1},children:D(e,`Cuộc trò chuyện mới`,`New chat`)})})}),(0,X.jsx)(le,{value:n,onChange:e=>r(e.target.value),fullWidth:!0,size:`small`,placeholder:D(e,`Tìm cuộc trò chuyện`,`Search chats`),sx:{mt:1.1},slotProps:{input:{startAdornment:(0,X.jsx)(_u,{position:`start`,children:(0,X.jsx)(vu,{fontSize:`small`})})}}})]}),(0,X.jsxs)(Q,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`,px:2,pt:2,pb:.4},children:[(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,sx:{fontWeight:600,textTransform:`uppercase`,letterSpacing:`.08em`},children:s?D(e,`Đã lưu trữ`,`Archived`):D(e,`Cuộc trò chuyện`,`Chats`)}),(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,children:M})]}),A.company>0&&A.personal>0&&(0,X.jsx)(Q,{direction:`row`,role:`group`,"aria-label":D(e,`Lọc theo loại`,`Filter by kind`),sx:{px:1.75,pb:.5,gap:.5,flexWrap:`wrap`},children:[`all`,`company`,`personal`].map(t=>(0,X.jsx)(rr,{size:`small`,clickable:!0,"aria-pressed":b===t,onClick:()=>x(t),color:b===t?`primary`:`default`,variant:b===t?`filled`:`outlined`,label:t===`all`?D(e,`Tất cả`,`All`):t===`company`?D(e,`Công ty · ${A.company}`,`Company · ${A.company}`):D(e,`Cá nhân · ${A.personal}`,`Personal · ${A.personal}`)},t))}),(0,X.jsxs)(fe,{component:`div`,sx:{flex:1,minHeight:0,overflowY:`auto`,py:.25},children:[N.length>0&&(0,X.jsxs)(Z,{component:`section`,"aria-label":D(e,`Đang chạy hoặc cần chú ý`,`Running or needing attention`),sx:{mt:.5},children:[(0,X.jsx)(q,{component:`div`,variant:`caption`,color:`text.secondary`,sx:{px:2,py:.55,fontWeight:600},children:D(e,`Đang chạy · cần chú ý`,`Running · needs attention`)}),N.map(t=>(0,X.jsx)(Fv,{session:t,live:d[t.sessionRef],showProject:!0,fresh:f.has(t.sessionRef),selected:o===t.sessionRef,locale:e,onSelect:()=>m(t.sessionRef),onAction:e=>h(t,e)},t.sessionRef)),(0,X.jsx)(lr,{sx:{mx:2,mt:.75}})]}),j.map(t=>{let n=t.sessions.some(e=>e.sessionRef===o),r=E||n||!S.has(t.projectRef),i=E||w.has(t.projectRef),a=i?t.sessions:t.sessions.filter((e,t)=>t<Iv||e.sessionRef===o);return(0,X.jsxs)(Z,{component:`section`,"aria-label":t.label,sx:{mt:.5},children:[(0,X.jsxs)(We,{onClick:()=>P(C,t.projectRef,!0),"aria-expanded":r,sx:{width:`100%`,justifyContent:`flex-start`,gap:.7,px:2,py:.55,borderRadius:1},children:[(0,X.jsx)(wm,{sx:{fontSize:16,color:`text.disabled`,transform:r?`none`:`rotate(-90deg)`,transition:`transform .15s`}}),(0,X.jsx)(Tm,{sx:{fontSize:15,color:`text.disabled`}}),(0,X.jsx)(q,{component:`div`,variant:`caption`,color:`text.secondary`,noWrap:!0,sx:{flexShrink:1,minWidth:0,fontWeight:600,textAlign:`left`},children:t.label}),(0,X.jsx)(q,{component:`div`,variant:`caption`,color:`text.disabled`,sx:{flex:1,minWidth:0,display:`flex`,textAlign:`left`},children:t.gitBranch?(0,X.jsx)(Av,{branch:t.gitBranch,locale:e,maxWidth:`100%`}):t.gitRepositories?.length?(0,X.jsxs)(Z,{component:`span`,title:t.gitRepositories.map(e=>`${e.name} · ${e.branch?.name??`?`}`).join(`
50
+ `),sx:{display:`inline-flex`,alignItems:`center`,gap:.4,whiteSpace:`nowrap`},children:[(0,X.jsx)(Ov,{sx:{fontSize:`1.1em`}}),D(e,`${t.gitRepositories.length} repo`,`${t.gitRepositories.length} repos`)]}):null}),(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,children:t.sessions.length})]}),r&&a.map(t=>(0,X.jsx)(Fv,{session:t,live:d[t.sessionRef],fresh:f.has(t.sessionRef),selected:o===t.sessionRef,locale:e,onSelect:()=>m(t.sessionRef),onAction:e=>h(t,e)},t.sessionRef)),r&&!E&&t.sessions.length>Iv&&(0,X.jsx)(J,{size:`small`,onClick:()=>P(T,t.projectRef,!1),sx:{ml:1.5,mb:.25,fontSize:12},children:i?D(e,`Thu gọn`,`Show less`):D(e,`Xem thêm ${t.sessions.length-Iv}`,`Show ${t.sessions.length-Iv} more`)})]},t.projectRef)}),M===0&&(0,X.jsxs)(Q,{sx:{alignItems:`center`,textAlign:`center`,px:3,py:5},spacing:1,children:[(0,X.jsx)(wv,{color:`disabled`}),(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:D(e,`Không tìm thấy cuộc trò chuyện`,`No conversations found`)})]})]}),(0,X.jsxs)(Z,{sx:{p:1.25},children:[(0,X.jsx)(lr,{sx:{mb:1}}),(0,X.jsx)(J,{fullWidth:!0,startIcon:(0,X.jsx)(Cv,{}),disabled:!s&&c===0,onClick:g,sx:{justifyContent:`flex-start`},children:s?D(e,`Quay lại cuộc trò chuyện`,`Back to chats`):D(e,`Đã lưu trữ (${c})`,`Archived (${c})`)}),(0,X.jsxs)(J,{fullWidth:!0,startIcon:(0,X.jsx)(Dv,{}),onClick:_,sx:{justifyContent:`flex-start`,mt:.25},color:l?`primary`:`inherit`,children:[D(e,`Cài đặt`,`Settings`),v&&(0,X.jsx)(Z,{component:`span`,role:`img`,"aria-label":D(e,`Có bản cập nhật`,`Update available`),sx:{ml:`auto`,width:8,height:8,borderRadius:`50%`,bgcolor:`primary.main`}})]}),y&&(0,X.jsxs)(Q,{direction:`row`,sx:{px:1.25,pt:1,alignItems:`center`,gap:1},children:[(0,X.jsx)(Z,{sx:{width:7,height:7,borderRadius:`50%`,bgcolor:u===`connected`?`success.main`:`warning.main`}}),(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,sx:{flex:1},children:u===`connected`?`Gateway live`:u}),(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,children:`local`})]})]})]})}var Uv=9e3,Wv=4,Gv={done:[`Xong`,`Done`,`Agent đã trả lời xong.`,`The agent finished its answer.`],failed:[`Lượt bị lỗi`,`Turn failed`,`Mở để xem lỗi và gửi “tiếp tục”.`,`Open it to see the error and continue.`],stopped:[`Đã dừng`,`Stopped`,`Lượt làm việc đã dừng giữa chừng.`,`The turn stopped midway.`],question:[`Cần bạn trả lời`,`Needs your answer`,`Main agent đang chờ bạn chọn phương án.`,`The main agent is waiting for your choice.`],approval:[`Cần bạn duyệt`,`Needs your approval`,`Main agent xin chạy một lệnh và đang chờ bạn duyệt.`,`The main agent asked to run a command and is waiting.`]},Kv={done:`success`,failed:`error`,stopped:`neutral`,question:`warning`,approval:`warning`};function qv({sessions:e,live:t,selectedRef:n,onOpen:r,locale:i}){let a=(0,Y.useRef)(null),[o,s]=(0,Y.useState)([]),[c,l]=(0,Y.useState)(()=>new Set);(0,Y.useEffect)(()=>{let r=ig(e,t);if(a.current){let i=document.visibilityState===`visible`,o=ag(a.current,r,e,t).filter(e=>!(i&&e.sessionRef===n));if(o.length){s(e=>[...o,...e.filter(e=>!o.some(t=>t.sessionRef===e.sessionRef))].slice(0,12));let e=o.filter(e=>[`done`,`failed`,`stopped`].includes(e.kind)).map(e=>e.sessionRef);e.length&&l(t=>new Set([...t,...e]))}}a.current=r,s(e=>{let t=e.filter(e=>![`question`,`approval`].includes(e.kind)||r[e.sessionRef]?.need===e.kind);return t.length===e.length?e:t})},[e,t,n]),(0,Y.useEffect)(()=>{n&&(l(e=>{if(!e.has(n))return e;let t=new Set(e);return t.delete(n),t}),s(e=>e.filter(e=>e.sessionRef!==n)))},[n]);let u=e.filter(e=>!e.archived&&rg(e,t[e.sessionRef])).length;(0,Y.useEffect)(()=>{let e=document.title.replace(/^\(\d+\) /,``);document.title=u?`(${u}) ${e}`:e},[u]);let d=e=>s(t=>t.filter(t=>t.id!==e));return{unseen:c,view:(0,X.jsx)(Jv,{toasts:o.slice(0,Wv),more:Math.max(0,o.length-Wv),locale:i,onClose:d,onOpen:e=>{d(e.id),r(e.sessionRef)}})}}function Jv({toasts:e,more:t,locale:n,onClose:r,onOpen:i}){return(0,X.jsxs)(`section`,{className:`attention-toasts`,"aria-label":D(n,`Thông báo cuộc trò chuyện`,`Chat notifications`),"aria-live":`polite`,children:[e.map(e=>(0,X.jsx)(Yv,{event:e,locale:n,onClose:()=>r(e.id),onOpen:()=>i(e)},e.id)),t>0&&(0,X.jsx)(`p`,{className:`attention-more`,children:D(n,`và ${t} thông báo khác`,`and ${t} more`)})]})}function Yv({event:e,locale:t,onClose:n,onOpen:r}){let i=e.kind===`question`||e.kind===`approval`,[a,o,s,c]=Gv[e.kind];return(0,Y.useEffect)(()=>{if(i)return;let e=window.setTimeout(n,Uv);return()=>window.clearTimeout(e)},[i]),(0,X.jsxs)(`article`,{className:`attention-toast tone-${Kv[e.kind]}`,role:i?`alert`:`status`,children:[(0,X.jsx)(`span`,{className:`attention-toast-mark`,"aria-hidden":`true`}),(0,X.jsxs)(`div`,{className:`attention-toast-body`,children:[(0,X.jsxs)(`strong`,{children:[D(t,a,o),` · `,(0,X.jsx)(`span`,{className:`attention-toast-title`,children:e.title})]}),(0,X.jsx)(`small`,{children:D(t,s,c)})]}),(0,X.jsxs)(`div`,{className:`attention-toast-actions`,children:[(0,X.jsx)(`button`,{type:`button`,className:`attention-open`,onClick:r,children:D(t,`Mở`,`Open`)}),(0,X.jsx)(`button`,{type:`button`,className:`attention-close`,"aria-label":D(t,`Đóng thông báo`,`Close notification`),onClick:n,children:`×`})]})]})}var Xv=K((0,X.jsx)(`path`,{d:`M18 19H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h12c.55 0 1 .45 1 1v12c0 .55-.45 1-1 1m1-16H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2`}),`CheckBoxOutlineBlankRounded`),Zv=K((0,X.jsx)(`path`,{d:`M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-8.29 13.29c-.39.39-1.02.39-1.41 0L5.71 12.7a.996.996 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0L10 14.17l6.88-6.88c.39-.39 1.02-.39 1.41 0s.39 1.02 0 1.41z`}),`CheckBoxRounded`),Qv=K((0,X.jsx)(`path`,{d:`m10.8 15.9 4.67-3.5c.27-.2.27-.6 0-.8L10.8 8.1c-.33-.25-.8-.01-.8.4v7c0 .41.47.65.8.4M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8`}),`PlayCircleOutlineRounded`),$v=K((0,X.jsx)(`path`,{d:`M7 12c0 .55.45 1 1 1h8c.55 0 1-.45 1-1s-.45-1-1-1H8c-.55 0-1 .45-1 1m5-10C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8`}),`RemoveCircleOutlineRounded`);function ey(e){return M(`MuiLinearProgress`,e)}g(`MuiLinearProgress`,[`root`,`colorPrimary`,`colorSecondary`,`determinate`,`indeterminate`,`buffer`,`query`,`dashed`,`bar`,`bar1`,`bar2`]);var ty=4,ny={},ry=Te`
51
+ 0% {
52
+ left: -35%;
53
+ right: 100%;
54
+ }
55
+
56
+ 60% {
57
+ left: 100%;
58
+ right: -90%;
59
+ }
60
+
61
+ 100% {
62
+ left: 100%;
63
+ right: -90%;
64
+ }
65
+ `,iy=typeof ry==`string`?null:Oe`
66
+ animation: ${ry} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
67
+ `,ay=Te`
68
+ 0% {
69
+ left: -200%;
70
+ right: 100%;
71
+ }
72
+
73
+ 60% {
74
+ left: 107%;
75
+ right: -8%;
76
+ }
77
+
78
+ 100% {
79
+ left: 107%;
80
+ right: -8%;
81
+ }
82
+ `,oy=typeof ay==`string`?null:Oe`
83
+ animation: ${ay} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite;
84
+ `,sy=Te`
85
+ 0% {
86
+ opacity: 1;
87
+ background-position: 0 -23px;
88
+ }
89
+
90
+ 60% {
91
+ opacity: 0;
92
+ background-position: 0 -23px;
93
+ }
94
+
95
+ 100% {
96
+ opacity: 1;
97
+ background-position: -200px -23px;
98
+ }
99
+ `,cy=typeof sy==`string`?null:Oe`
100
+ animation: ${sy} 3s infinite linear;
101
+ `,ly=e=>{let{classes:t,variant:n,color:r}=e,i={root:[`root`,`color${G(r)}`,n],dashed:[`dashed`],bar1:[`bar`,`bar1`],bar2:[`bar`,`bar2`,n===`buffer`&&`color${G(r)}`]};return B(i,ey,t)},uy=(e,t)=>e.vars?e.vars.palette.LinearProgress[`${t}Bg`]:e.palette.mode===`light`?e.lighten(e.palette[t].main,.62):e.darken(e.palette[t].main,.5),dy=W(`span`,{name:`MuiLinearProgress`,slot:`Root`,overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[`color${G(n.color)}`],t[n.variant]]}})(V(({theme:e})=>({position:`relative`,overflow:`hidden`,display:`block`,height:4,zIndex:0,"@media print":{colorAdjust:`exact`},variants:[...Object.entries(e.palette).filter(U()).map(([t])=>({props:{color:t},style:{backgroundColor:uy(e,t)}})),{props:({ownerState:e})=>e.color===`inherit`&&e.variant!==`buffer`,style:{"&::before":{content:`""`,position:`absolute`,left:0,top:0,right:0,bottom:0,backgroundColor:`currentColor`,opacity:.3}}},{props:{variant:`buffer`},style:{backgroundColor:`transparent`}},{props:{variant:`query`},style:{transform:`rotate(180deg)`}}]}))),fy=W(`span`,{name:`MuiLinearProgress`,slot:`Dashed`})(V(({theme:e})=>({position:`absolute`,marginTop:0,height:`100%`,width:`100%`,backgroundSize:`10px 10px`,backgroundPosition:`0 -23px`,variants:[{props:{color:`inherit`},style:{opacity:.3,backgroundImage:`radial-gradient(currentColor 0%, currentColor 16%, transparent 42%)`}},...Object.entries(e.palette).filter(U()).map(([t])=>{let n=uy(e,t);return{props:{color:t},style:{backgroundImage:`radial-gradient(${n} 0%, ${n} 16%, transparent 42%)`}}})]})),cy||{animation:`${sy} 3s infinite linear`},V(({theme:e})=>Ne(e,{animation:`none`})||ny)),py=W(`span`,{name:`MuiLinearProgress`,slot:`Bar1`,overridesResolver:(e,t)=>[t.bar,t.bar1]})(V(({theme:e})=>{let t=Ne(e,{animation:`none`,left:`30%`,right:`auto`,width:`40%`});return{width:`100%`,position:`absolute`,left:0,bottom:0,top:0,...Be(e,`transform`,{duration:`0.2s`,easing:`linear`}),transformOrigin:`left`,variants:[{props:{color:`inherit`},style:{backgroundColor:`currentColor`}},...Object.entries(e.palette).filter(U()).map(([t])=>({props:{color:t},style:{backgroundColor:(e.vars||e).palette[t].main}})),{props:{variant:`determinate`},style:{...Be(e,`transform`,{duration:`.${ty}s`,easing:`linear`})}},{props:{variant:`buffer`},style:{zIndex:1,...Be(e,`transform`,{duration:`.${ty}s`,easing:`linear`})}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:iy||{animation:`${ry} 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite`}},...t?[{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:t}]:[]]}})),my=W(`span`,{name:`MuiLinearProgress`,slot:`Bar2`,overridesResolver:(e,t)=>[t.bar,t.bar2]})(V(({theme:e})=>{let t=Ne(e,{animation:`none`,display:`none`});return{width:`100%`,position:`absolute`,left:0,bottom:0,top:0,...Be(e,`transform`,{duration:`0.2s`,easing:`linear`}),transformOrigin:`left`,variants:[...Object.entries(e.palette).filter(U()).map(([t])=>({props:{color:t},style:{"--LinearProgressBar2-barColor":(e.vars||e).palette[t].main}})),{props:({ownerState:e})=>e.variant!==`buffer`&&e.color!==`inherit`,style:{backgroundColor:`var(--LinearProgressBar2-barColor, currentColor)`}},{props:({ownerState:e})=>e.variant!==`buffer`&&e.color===`inherit`,style:{backgroundColor:`currentColor`}},{props:{color:`inherit`},style:{opacity:.3}},...Object.entries(e.palette).filter(U()).map(([t])=>({props:{color:t,variant:`buffer`},style:{backgroundColor:uy(e,t),...Be(e,`transform`,{duration:`.${ty}s`,easing:`linear`})}})),{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:{width:`auto`}},{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:oy||{animation:`${ay} 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite`}},...t?[{props:({ownerState:e})=>e.variant===`indeterminate`||e.variant===`query`,style:t}]:[]]}})),hy=Y.forwardRef(function(e,t){let n=we({props:e,name:`MuiLinearProgress`}),{className:r,color:i=`primary`,max:a,min:o,value:s,valueBuffer:c,variant:l=`indeterminate`,...u}=n,d={...n,color:i,variant:l},f=o??0,p=a??100,m=ly(d),h=Ye(),g={},_={bar1:{},bar2:{}};if((l===`determinate`||l===`buffer`)&&s!==void 0){let e=p-f,t=(s-f)/e*100-100;h&&(t=-t),_.bar1.transform=e>0?`translateX(${t}%)`:`translateX(-100%)`,g[`aria-valuenow`]=s,g[`aria-valuemin`]=f,g[`aria-valuemax`]=p}if(l===`buffer`&&c!==void 0){let e=p-f,t=(c-f)/e*100-100;h&&(t=-t),_.bar2.transform=e>0?`translateX(${t}%)`:`translateX(-100%)`}return(0,X.jsxs)(dy,{className:P(m.root,r),ownerState:d,role:`progressbar`,...g,ref:t,...u,children:[l===`buffer`?(0,X.jsx)(fy,{className:m.dashed,ownerState:d}):null,(0,X.jsx)(py,{className:m.bar1,ownerState:d,style:_.bar1}),l===`determinate`?null:(0,X.jsx)(my,{className:m.bar2,ownerState:d,style:_.bar2})]})}),gy=`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,_y={A:`success`,M:`warning`,D:`error`,R:`info`,C:`info`,U:`success`};function vy({title:e,action:t,children:n}){return(0,X.jsxs)(Z,{component:`section`,sx:{px:2,py:1.75,borderBottom:1,borderColor:`divider`},children:[(0,X.jsxs)(Q,{direction:`row`,sx:{alignItems:`center`,justifyContent:`space-between`,mb:1},children:[(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,sx:{fontWeight:650,textTransform:`uppercase`,letterSpacing:`.06em`},children:e}),t]}),n]})}function yy({session:e,snapshot:t,live:n,locale:r,onOpenReview:i,onClose:a}){let[o,s]=(0,Y.useState)(),[c,l]=(0,Y.useState)(!1),u=!!(n&&!n.complete);(0,Y.useEffect)(()=>{if(u)return;let t=new AbortController;l(!1);let n=window.setTimeout(()=>void js(e.sessionRef,`working-tree`,t.signal).then(e=>s(e)).catch(()=>{t.signal.aborted||l(!0)}),250);return()=>{window.clearTimeout(n),t.abort()}},[e.sessionRef,e.sessionRevision,u]),(0,Y.useEffect)(()=>{s(void 0)},[e.sessionRef]);let d=o?.files??[],f=d.reduce((e,t)=>e+(t.stats?.additions??0),0),p=d.reduce((e,t)=>e+(t.stats?.deletions??0),0),m=t?.usage.context,h=m?.state===`known`,g=h?m.percent:e.contextUsage.ratio===null?null:e.contextUsage.ratio*100,_=h?m.contextWindow:e.contextUsage.contextWindow,v=h?m.tokens:e.contextUsage.usedTokens,y=e.managedHelpers?.maximum===0?void 0:e.managedHelpers,b=e.managedPlan,x=e.managedProcess,S=b?.steps.filter(e=>e.status===`completed`).length??0,C=(n?.activities??[]).filter(e=>O_(e.toolLabel)===`subagent`);return(0,X.jsxs)(Z,{role:`region`,sx:{height:`100%`,overflowY:`auto`,bgcolor:`background.paper`},"aria-label":D(r,`Thay đổi và ngữ cảnh`,`Changes and context`),children:[(0,X.jsxs)(Q,{direction:`row`,sx:{alignItems:`center`,gap:1,px:2,minHeight:60,borderBottom:1,borderColor:`divider`},children:[(0,X.jsx)(q,{sx:{fontWeight:600,flex:1},children:D(r,`Workspace`,`Workspace`)}),a&&(0,X.jsx)(et,{size:`small`,"aria-label":D(r,`Đóng khung bên`,`Close side panel`),onClick:a,children:(0,X.jsx)(Uh,{fontSize:`small`})})]}),(0,X.jsxs)(vy,{title:o?D(r,`Thay đổi · ${d.length} file`,`Changes · ${d.length} files`):D(r,`Thay đổi`,`Changes`),action:d.length>0?(0,X.jsx)(bo,{title:D(r,`Xem diff đầy đủ, stage hoặc hoàn tác`,`Full diff, stage or revert`),children:(0,X.jsx)(J,{size:`small`,startIcon:(0,X.jsx)(To,{fontSize:`small`}),onClick:i,children:D(r,`Review`,`Review`)})}):void 0,children:[(f>0||p>0)&&(0,X.jsxs)(Q,{direction:`row`,sx:{alignItems:`center`,gap:.75,mb:1,color:`text.secondary`},children:[(0,X.jsx)(m_,{sx:{fontSize:15}}),(0,X.jsx)(q,{variant:`caption`,children:D(r,`Chưa commit`,`Uncommitted`)}),(0,X.jsxs)(q,{variant:`caption`,sx:{fontFamily:gy,ml:`auto`},children:[(0,X.jsxs)(Z,{component:`span`,sx:C_(`success`),children:[`+`,f]}),` `,(0,X.jsxs)(Z,{component:`span`,sx:C_(`error`),children:[`−`,p]})]})]}),o===void 0&&!c&&(u?(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:D(r,`Cập nhật khi lượt này chạy xong.`,`Updates when this turn finishes.`)}):(0,X.jsx)(hy,{sx:{borderRadius:1}})),(c||o?.availability.state===`unavailable`)&&(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:D(r,`Chưa đọc được thay đổi (thư mục có thể không phải git repo).`,`Changes are unavailable (the folder may not be a git repository).`)}),o&&o.availability.state!==`unavailable`&&d.length===0&&(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:D(r,`Chưa có thay đổi nào chưa commit.`,`No uncommitted changes.`)}),(0,X.jsx)(Q,{spacing:.25,children:d.slice(0,200).map(e=>(0,X.jsxs)(Q,{direction:`row`,sx:{alignItems:`center`,gap:1,py:.4},children:[(0,X.jsx)(q,{variant:`caption`,sx:{fontFamily:gy,fontWeight:700,width:12,..._y[e.status]?C_(_y[e.status]):{color:`text.secondary`}},children:e.status}),(0,X.jsx)(q,{variant:`body2`,noWrap:!0,title:e.path,sx:{fontFamily:gy,fontSize:12.5,flex:1,minWidth:0},children:e.path}),(0,X.jsxs)(q,{variant:`caption`,sx:{fontFamily:gy,flexShrink:0},children:[(e.stats?.additions??0)>0&&(0,X.jsxs)(Z,{component:`span`,sx:C_(`success`),children:[`+`,e.stats.additions,` `]}),(e.stats?.deletions??0)>0&&(0,X.jsxs)(Z,{component:`span`,sx:C_(`error`),children:[`−`,e.stats.deletions]})]})]},e.fileRef))})]}),(b||x)&&(0,X.jsxs)(vy,{title:b?D(r,`Plan · ${S}/${b.steps.length}`,`Plan · ${S}/${b.steps.length}`):D(r,`Tiến trình`,`Process`),children:[b&&(0,X.jsx)(Q,{component:`ol`,spacing:.25,sx:{m:0,p:0,listStyle:`none`},"aria-label":D(r,`Plan của agent`,`Agent plan`),children:b.steps.map((e,t)=>{let n=e.status===`completed`?Zv:e.status===`in_progress`?Qv:e.status===`deferred`?$v:Xv;return(0,X.jsxs)(Q,{component:`li`,direction:`row`,sx:{alignItems:`flex-start`,gap:.75,py:.25},"aria-label":`${e.step}: ${e.status===`completed`?D(r,`xong`,`done`):e.status===`in_progress`?D(r,`đang làm`,`in progress`):e.status===`deferred`?D(r,`để sau`,`left for later`):D(r,`chưa làm`,`pending`)}`,children:[(0,X.jsx)(n,{sx:{fontSize:16,mt:.2,color:e.status===`in_progress`?`primary.main`:`text.secondary`}}),(0,X.jsx)(q,{variant:`body2`,sx:{flex:1,minWidth:0,overflowWrap:`anywhere`,...e.status===`completed`?{color:`text.secondary`,textDecoration:`line-through`}:e.status===`deferred`?{color:`text.disabled`,fontStyle:`italic`}:{},...e.status===`in_progress`?{fontWeight:600}:{}},children:e.step})]},t)})}),x&&x.outcome!==`no_change`&&(0,X.jsxs)(q,{variant:`body2`,role:`status`,sx:{mt:+!!b,...C_(U_(x))},children:[D(r,`Lượt sửa code gần nhất: `,`Last code-changing turn: `),V_(x,r)]})]}),(0,X.jsxs)(vy,{title:D(r,`Ngữ cảnh`,`Context`),children:[(0,X.jsxs)(Q,{direction:`row`,sx:{justifyContent:`space-between`,mb:.75},children:[(0,X.jsx)(q,{variant:`body2`,children:g==null?`—`:`${Math.round(g)}%`}),(0,X.jsxs)(q,{variant:`caption`,color:`text.secondary`,children:[v?Ng(v):`—`,_?` / ${Ng(_)}`:``]})]}),(0,X.jsx)(hy,{variant:`determinate`,value:Math.min(100,Math.max(0,g??0)),sx:{height:6,borderRadius:1},color:(g??0)>85?`warning`:`primary`,"aria-label":D(r,`Mức dùng ngữ cảnh`,`Context usage`)})]}),(y||C.length>0)&&(0,X.jsxs)(vy,{title:`Subagent`,children:[y&&(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,sx:{mb:C.length?.75:0},children:D(r,`${y.active??0}/${y.maximum} đang chạy`,`${y.active??0}/${y.maximum} running`)}),C.map(e=>(0,X.jsxs)(Q,{direction:`row`,sx:{alignItems:`center`,gap:.75,py:.25},children:[(0,X.jsx)(d_,{sx:{fontSize:15,color:`text.secondary`}}),(0,X.jsx)(q,{variant:`body2`,sx:{flex:1},children:e.fileLabel??`subagent`}),(0,X.jsx)(q,{variant:`caption`,color:e.state===`failed`?`error`:`text.secondary`,children:e.state===`running`?D(r,`đang chạy`,`running`):e.state===`failed`?D(r,`lỗi`,`failed`):D(r,`xong`,`done`)})]},e.toolCallRef))]})]})}var by=K((0,X.jsx)(`path`,{d:`M21 19V5c0-1.1-.9-2-2-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2M8.9 13.98l2.1 2.53 3.1-3.99c.2-.26.6-.26.8.01l3.51 4.68c.25.33.01.8-.4.8H6.02c-.42 0-.65-.48-.39-.81L8.12 14c.19-.26.57-.27.78-.02`}),`ImageRounded`),xy=K((0,X.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M9.29 16.29 5.7 12.7a.996.996 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0L10 14.17l6.88-6.88c.39-.39 1.02-.39 1.41 0s.39 1.02 0 1.41l-7.59 7.59c-.38.39-1.02.39-1.41 0`}),`CheckCircleRounded`);function Sy({catalog:e,refresh:t}){let{locale:n}=C(),[r,i]=(0,Y.useState)(),[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{if(!r||r.state!==`running`)return;let e=new AbortController,a=window.setTimeout(()=>{vs(r.jobRef,e.signal).then(e=>{i(e),e.state===`completed`&&t()}).catch(()=>{e.signal.aborted||u(D(n,`Mất kết nối với luồng OAuth`,`OAuth flow disconnected`))})},750);return()=>{e.abort(),window.clearTimeout(a)}},[r?.jobRef,r?.generatedAt,r?.state,n]),(0,Y.useEffect)(()=>o(``),[r?.prompt?.promptRef]);let d=async e=>{c(!0),u(null);try{i(await bs(e))}catch{u(D(n,`Không thể bắt đầu OAuth`,`Could not start OAuth`))}finally{c(!1)}},f=async()=>{if(!(!r?.prompt||!a)){c(!0),u(null);try{i(await xs(r.jobRef,r.prompt.promptRef,a))}catch{u(D(n,`Bước xác thực đã hết hạn`,`Authentication step expired`))}finally{c(!1)}}},p=async()=>{r?.state===`running`&&await Ss(r.jobRef).catch(()=>void 0),i(void 0),u(null)},m=r?.events.slice(-4)??[];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Z,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,lg:`repeat(2,minmax(0,1fr))`},gap:1},children:(e?.providers??[]).map(e=>(0,X.jsx)(ht,{variant:`outlined`,sx:{p:1.75,borderRadius:1},children:(0,X.jsxs)(Q,{direction:`row`,sx:{alignItems:`center`,gap:1.25},children:[(0,X.jsx)(Ip,{name:e.name,size:38}),(0,X.jsx)(q,{sx:{flex:1,fontWeight:800},children:e.name}),e.state===`connected`&&(0,X.jsx)(rr,{size:`small`,color:`success`,variant:`outlined`,icon:(0,X.jsx)(xy,{}),label:D(n,`Đã kết nối`,`Connected`)}),(0,X.jsx)(J,{size:`small`,variant:`outlined`,disabled:s,onClick:()=>void d(e.providerRef),children:e.state===`connected`?D(n,`Kết nối lại`,`Reconnect`):D(n,`Kết nối`,`Connect`)})]})},e.providerRef))}),e&&e.providers.length===0&&(0,X.jsx)(q,{color:`text.secondary`,children:D(n,`Pi chưa có provider OAuth`,`No OAuth providers available`)}),l&&!r&&(0,X.jsx)(q,{role:`status`,color:`error`,variant:`body2`,sx:{mt:1},children:l}),(0,X.jsxs)(ge,{open:!!r,onClose:()=>void p(),fullWidth:!0,maxWidth:`xs`,children:[(0,X.jsx)(ve,{children:r?.providerName??`OAuth`}),(0,X.jsx)(pe,{children:(0,X.jsxs)(Q,{spacing:1.25,sx:{pt:.5},children:[r?.state===`completed`&&(0,X.jsxs)(Q,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,X.jsx)(xy,{color:`success`}),(0,X.jsx)(q,{children:D(n,`Đã kết nối`,`Connected`)})]}),m.map(e=>(0,X.jsxs)(Z,{children:[e.message&&(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:e.message}),e.userCode&&(0,X.jsx)(q,{sx:{my:1,fontFamily:`monospace`,fontSize:`1.35rem`,fontWeight:800,letterSpacing:`.12em`},children:e.userCode}),e.url&&(0,X.jsx)(J,{component:`a`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,variant:`outlined`,size:`small`,endIcon:(0,X.jsx)(Rp,{}),children:D(n,`Mở trang xác thực`,`Open authentication`)}),e.links.map(e=>(0,X.jsx)(J,{component:`a`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,size:`small`,children:e.label??D(n,`Mở liên kết`,`Open link`)},e.url))]},e.sequence)),r?.prompt&&(0,X.jsxs)(Z,{children:[(0,X.jsx)(q,{variant:`body2`,sx:{mb:1},children:r.prompt.message}),r.prompt.type===`select`?(0,X.jsx)(z,{fullWidth:!0,size:`small`,value:a,onChange:e=>o(e.target.value),children:r.prompt.options.map(e=>(0,X.jsx)(dp,{value:e.id,children:e.label},e.id))}):(0,X.jsx)(le,{fullWidth:!0,size:`small`,value:a,placeholder:r.prompt.placeholder??void 0,onChange:e=>o(e.target.value)})]}),r&&[`failed`,`cancelled`].includes(r.state)&&(0,X.jsx)(q,{color:`error`,variant:`body2`,children:$(r.reasonCode??r.state,n)}),l&&(0,X.jsx)(q,{role:`status`,color:`error`,variant:`body2`,children:l})]})}),(0,X.jsxs)(Hp,{children:[(0,X.jsx)(J,{color:`inherit`,onClick:()=>void p(),children:r?.state===`running`?D(n,`Hủy`,`Cancel`):D(n,`Đóng`,`Close`)}),r?.prompt&&(0,X.jsx)(J,{variant:`contained`,disabled:s||!a,onClick:()=>void f(),children:D(n,`Tiếp tục`,`Continue`)})]})]})]})}var Cy=K((0,X.jsx)(`path`,{d:`M4 7v2c0 .55-.45 1-1 1s-1 .45-1 1v2c0 .55.45 1 1 1s1 .45 1 1v2c0 1.66 1.34 3 3 3h2c.55 0 1-.45 1-1s-.45-1-1-1H7c-.55 0-1-.45-1-1v-2c0-1.3-.84-2.42-2-2.83v-.34C5.16 11.42 6 10.3 6 9V7c0-.55.45-1 1-1h2c.55 0 1-.45 1-1s-.45-1-1-1H7C5.34 4 4 5.34 4 7m17 3c-.55 0-1-.45-1-1V7c0-1.66-1.34-3-3-3h-2c-.55 0-1 .45-1 1s.45 1 1 1h2c.55 0 1 .45 1 1v2c0 1.3.84 2.42 2 2.83v.34c-1.16.41-2 1.52-2 2.83v2c0 .55-.45 1-1 1h-2c-.55 0-1 .45-1 1s.45 1 1 1h2c1.66 0 3-1.34 3-3v-2c0-.55.45-1 1-1s1-.45 1-1v-2c0-.55-.45-1-1-1`}),`DataObjectRounded`),wy=K((0,X.jsx)(`path`,{d:`M14 9h-4c-.55 0-1 .45-1 1v4c0 .55.45 1 1 1h4c.55 0 1-.45 1-1v-4c0-.55-.45-1-1-1m-1 4h-2v-2h2zm8-3c0-.55-.45-1-1-1h-1V7c0-1.1-.9-2-2-2h-2V4c0-.55-.45-1-1-1s-1 .45-1 1v1h-2V4c0-.55-.45-1-1-1s-1 .45-1 1v1H7c-1.1 0-2 .9-2 2v2H4c-.55 0-1 .45-1 1s.45 1 1 1h1v2H4c-.55 0-1 .45-1 1s.45 1 1 1h1v2c0 1.1.9 2 2 2h2v1c0 .55.45 1 1 1s1-.45 1-1v-1h2v1c0 .55.45 1 1 1s1-.45 1-1v-1h2c1.1 0 2-.9 2-2v-2h1c.55 0 1-.45 1-1s-.45-1-1-1h-1v-2h1c.55 0 1-.45 1-1m-5 7H8c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1h8c.55 0 1 .45 1 1v8c0 .55-.45 1-1 1`}),`MemoryRounded`),Ty=K([(0,X.jsx)(`circle`,{cx:`10`,cy:`8`,r:`4`},`0`),(0,X.jsx)(`path`,{d:`M10.35 14.01C7.62 13.91 2 15.27 2 18v1c0 .55.45 1 1 1h8.54c-2.47-2.76-1.23-5.89-1.19-5.99m9.08 4.01c.47-.8.7-1.77.48-2.82-.34-1.64-1.72-2.95-3.38-3.16-2.63-.34-4.85 1.87-4.5 4.5.22 1.66 1.52 3.04 3.16 3.38 1.05.22 2.02-.01 2.82-.48l1.86 1.86c.39.39 1.02.39 1.41 0s.39-1.02 0-1.41zM16 18c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2`},`1`)],`PersonSearchRounded`),Ey=K((0,X.jsx)(`path`,{d:`M19.88 18.47c.48-.77.75-1.67.69-2.66-.13-2.15-1.84-3.97-3.97-4.2-2.72-.3-5.02 1.81-5.02 4.47 0 2.49 2.01 4.5 4.49 4.5.88 0 1.7-.26 2.39-.7l2.41 2.41c.39.39 1.03.39 1.42 0s.39-1.03 0-1.42zm-3.8.11c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5m-.36-8.5c-.74.02-1.45.18-2.1.45l-.55-.83-3.08 5.01c-.36.58-1.17.64-1.61.13l-2.12-2.47-3.06 4.9c-.31.49-.97.62-1.44.28-.42-.31-.54-.89-.26-1.34l3.78-6.05c.36-.57 1.17-.63 1.61-.12L9 12.5l3.18-5.17c.38-.62 1.28-.64 1.68-.03zm2.59.5c-.64-.28-1.33-.45-2.05-.49L20.8 2.9c.31-.49.97-.61 1.43-.27.43.31.54.9.26 1.34z`}),`QueryStatsRounded`);function Dy({icon:e,title:t,detail:n,children:r}){return(0,X.jsxs)(ht,{variant:`outlined`,sx:{p:2,borderRadius:1},children:[(0,X.jsxs)(Q,{direction:`row`,spacing:1.25,sx:{alignItems:`flex-start`,mb:1.5},children:[(0,X.jsx)(Z,{sx:{width:38,height:38,borderRadius:1,bgcolor:`action.selected`,display:`grid`,placeItems:`center`,flex:`0 0 auto`},children:e}),(0,X.jsxs)(Z,{children:[(0,X.jsx)(q,{sx:{fontWeight:820},children:t}),(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:n})]})]}),r]})}function Oy({children:e}){return(0,X.jsx)(Q,{direction:`row`,sx:{gap:.75,flexWrap:`wrap`},children:e})}function ky({session:e,options:t,connections:n,onCompleted:r}){let{locale:i}=C(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(e?.sessionRevision??``),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(``),[y,b]=(0,Y.useState)(``),[x,S]=(0,Y.useState)(``);(0,Y.useEffect)(()=>{f(e?.sessionRevision??``),c(void 0),u(null)},[e?.sessionRef]),(0,Y.useEffect)(()=>{e?.sessionRevision&&f(e.sessionRevision)},[e?.sessionRevision]);let w=a||!e||!d||e.liveState===`running`||e.liveState===`waiting-approval`,T=t?.profiles??[],E=(0,Y.useMemo)(()=>(n?.connections??[]).filter(e=>/^[A-Za-z0-9][A-Za-z0-9._-]{0,119}$/.test(e.name)),[n]),O=s?.outputs.find(e=>e.customType===`piagent-service-tier-receipt`)?.details,k=async(t,n=null,a=!1)=>{if(!(!e||!d)){o(!0),u(null);try{let i=await Vs({schemaVersion:1,version:`piagent-runtime-command-v1`,messageType:`command`,requestId:`runtime_${crypto.randomUUID().replaceAll(`-`,`_`)}`,sessionRef:e.sessionRef,expectedSessionRevision:d,action:t,argument:n,confirmed:a});c(i),i.sessionRevisionAfter&&f(i.sessionRevisionAfter),i.state!==`settled`&&u(i.reasonCode??i.resultCode),await r?.()}catch{u(D(i,`Gateway chưa thể chạy điều khiển này.`,`The Gateway could not run this control.`))}finally{o(!1)}}},A=(e,t,n,r)=>m({action:e,argument:t,title:n,description:r}),j={size:`small`,variant:`outlined`,disabled:w};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{component:`h1`,variant:`h1`,sx:{mb:.75},children:D(i,`Điều khiển project`,`Project controls`)}),(0,X.jsx)(q,{color:`text.secondary`,sx:{mb:2.5},children:D(i,`Cùng logic với Terminal: Web UI gửi đúng slash command vào Pi runtime. Các nút xem trạng thái không gọi model; thao tác ghi luôn hỏi xác nhận.`,`The same logic as Terminal: Web UI sends the exact slash command to the Pi runtime. Status controls do not call the model; writes always require confirmation.`)}),!e&&(0,X.jsx)(ht,{variant:`outlined`,sx:{p:2,borderRadius:1,mb:2},children:(0,X.jsx)(q,{color:`text.secondary`,children:D(i,`Hãy chọn một cuộc trò chuyện để điều khiển project tương ứng.`,`Select a chat to control its project.`)})}),(0,X.jsxs)(Z,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,lg:`repeat(2,minmax(0,1fr))`},gap:1.25},children:[(0,X.jsxs)(Dy,{icon:(0,X.jsx)(Ey,{color:`primary`}),title:D(i,`Runtime & token`,`Runtime & tokens`),detail:D(i,`Tình trạng, inspector, lịch sử usage và preflight — 0 model token.`,`Status, inspector, usage history and preflight — zero model tokens.`),children:[(0,X.jsxs)(Oy,{children:[(0,X.jsx)(J,{...j,onClick:()=>void k(`runtime.status`),children:`Pi status`}),(0,X.jsx)(J,{...j,onClick:()=>void k(`runtime.inspector`),children:`Inspector`}),(0,X.jsx)(J,{...j,onClick:()=>void k(`orchestration.status`),children:`Orchestration`}),(0,X.jsx)(J,{...j,onClick:()=>void k(`usage.live`),children:`Usage live`}),(0,X.jsx)(J,{...j,onClick:()=>void k(`usage.history`),children:`History`}),(0,X.jsx)(J,{...j,onClick:()=>void k(`usage.logs`),children:`Logs`}),(0,X.jsx)(J,{...j,onClick:()=>void k(`usage.efficiency`),children:`Efficiency`})]}),(0,X.jsxs)(Q,{direction:{xs:`column`,sm:`row`},sx:{mt:1,gap:.75},children:[(0,X.jsx)(le,{size:`small`,fullWidth:!0,label:D(i,`Mô tả tác vụ sắp chạy`,`Upcoming task`),value:y,onChange:e=>b(e.target.value),slotProps:{htmlInput:{maxLength:2048}}}),(0,X.jsx)(J,{...j,sx:{whiteSpace:`nowrap`},onClick:()=>void k(`usage.preflight`,y.trim()||null),children:`Preflight`})]})]}),(0,X.jsx)(Dy,{icon:(0,X.jsx)(qf,{color:`primary`}),title:D(i,`Fast mode`,`Fast mode`),detail:D(i,`Giữ nguyên model/thinking và yêu cầu OpenAI Codex dùng service tier Fast. Session trống mặc định tắt; cấu hình môi trường hoặc trạng thái đã lưu khi resume có thể ghi đè.`,`Keeps model/thinking unchanged and requests the OpenAI Codex Fast service tier. Blank sessions default to off; an environment override or restored resume state can take precedence.`),children:(0,X.jsxs)(Oy,{children:[(0,X.jsx)(J,{...j,onClick:()=>void k(`runtime.fast-status`),children:D(i,`Trạng thái`,`Status`)}),(0,X.jsx)(J,{...j,color:`primary`,onClick:()=>A(`runtime.fast-on`,null,D(i,`Bật Fast mode?`,`Enable Fast mode?`),D(i,`Các lượt model tiếp theo sẽ yêu cầu service tier Fast và có thể dùng quota hoặc chi phí provider khác. Model và thinking không đổi.`,`Future model turns will request the Fast service tier and may use provider quota or pricing differently. Model and thinking remain unchanged.`)),children:D(i,`Bật Fast`,`Enable Fast`)}),(0,X.jsx)(J,{...j,onClick:()=>A(`runtime.fast-off`,null,D(i,`Tắt Fast mode?`,`Disable Fast mode?`),D(i,`Piagent sẽ ngừng ép Fast từ lượt model tiếp theo; cấu hình tier của host/provider vẫn được giữ nguyên.`,`Piagent will stop forcing Fast on the next model turn; host/provider tier configuration still applies.`)),children:D(i,`Tắt Fast`,`Disable Fast`)})]})}),(0,X.jsxs)(Dy,{icon:(0,X.jsx)(Ty,{color:`primary`}),title:D(i,`Profile`,`Profile`),detail:D(i,`Xem và áp dụng profile dùng chung có kiểm soát. Muốn onboard project, hãy nhờ agent trong chat.`,`View and apply a controlled reusable profile. To onboard the project, ask the agent in chat.`),children:[(0,X.jsxs)(Oy,{children:[(0,X.jsx)(J,{...j,onClick:()=>void k(`profile.status`),children:D(i,`Profile hiện tại`,`Current profile`)}),(0,X.jsx)(J,{...j,onClick:()=>void k(`profile.options`),children:D(i,`Danh sách profile`,`Profile options`)}),(0,X.jsx)(J,{...j,onClick:()=>void k(`profile.tech-options`),children:D(i,`Tech theo vai trò`,`Tech options`)})]}),(0,X.jsxs)(Q,{direction:{xs:`column`,sm:`row`},sx:{mt:1,gap:.75},children:[(0,X.jsx)(z,{size:`small`,fullWidth:!0,displayEmpty:!0,value:h,onChange:e=>g(e.target.value),disabled:w,renderValue:e=>e?T.find(t=>t.id===e)?.displayName??e:D(i,`Chọn profile…`,`Select profile…`),children:T.map(e=>(0,X.jsx)(dp,{value:e.id,children:e.displayName},e.id))}),(0,X.jsx)(J,{...j,disabled:w||!h,sx:{whiteSpace:`nowrap`},onClick:()=>A(`profile.apply`,h,D(i,`Áp dụng profile?`,`Apply profile?`),D(i,`Piagent sẽ cập nhật policy profile của project. Có thể xem diff trong Source Changes sau khi chạy.`,`Piagent will update the project's profile policy. You can inspect the diff in Source Changes afterward.`)),children:D(i,`Áp dụng`,`Apply`)}),(0,X.jsx)(J,{...j,onClick:()=>A(`profile.auto`,null,D(i,`Tự nhận diện profile?`,`Auto-detect profile?`),D(i,`Piagent sẽ kiểm tra dấu hiệu công nghệ và ghi profile phù hợp vào project.`,`Piagent will inspect technology markers and write the matching project profile.`)),children:`Auto`})]})]}),(0,X.jsxs)(Dy,{icon:(0,X.jsx)(Cy,{color:`primary`}),title:D(i,`Context engine`,`Context engine`),detail:D(i,`Tìm, đóng gói, đo tác động và rebuild context theo cùng policy Terminal.`,`Search, pack, measure impact and rebuild context under the same Terminal policy.`),children:[(0,X.jsxs)(Oy,{children:[(0,X.jsx)(J,{...j,onClick:()=>void k(`context.status`),children:`Index status`}),(0,X.jsx)(J,{...j,onClick:()=>void k(`context.efficiency`),children:`Efficiency`}),(0,X.jsx)(J,{...j,onClick:()=>void k(`context.impact`),children:`Impact`}),(0,X.jsx)(J,{...j,color:`warning`,onClick:()=>A(`context.rebuild`,null,D(i,`Rebuild context index?`,`Rebuild context index?`),D(i,`Thao tác này cập nhật index cục bộ của project và không gọi model.`,`This updates the project's local index and does not call the model.`)),children:`Rebuild`})]}),(0,X.jsxs)(Q,{direction:{xs:`column`,sm:`row`},sx:{mt:1,gap:.75},children:[(0,X.jsx)(le,{size:`small`,fullWidth:!0,label:D(i,`Câu hỏi hoặc mục tiêu`,`Question or goal`),value:_,onChange:e=>v(e.target.value),slotProps:{htmlInput:{maxLength:2048}}}),(0,X.jsx)(J,{...j,disabled:w||!_.trim(),onClick:()=>void k(`context.search`,_.trim()),children:`Search`}),(0,X.jsx)(J,{...j,disabled:w||!_.trim(),onClick:()=>void k(`context.pack`,_.trim()),children:`Pack`}),(0,X.jsx)(J,{...j,color:`warning`,onClick:()=>A(`context.compact`,_.trim()||null,D(i,`Compact context bằng model?`,`Compact context with the model?`),D(i,`Đây là điều khiển duy nhất trong bảng có thể dùng model token. Piagent vẫn giữ model hiện tại.`,`This is the only control in this panel that may use model tokens. Piagent keeps the current model.`)),children:`Compact`})]})]}),(0,X.jsx)(Dy,{icon:(0,X.jsx)(wy,{color:`primary`}),title:D(i,`Memory`,`Memory`),detail:D(i,`Xem chế độ, phạm vi và policy ghi nhớ đang có hiệu lực.`,`Inspect the active memory mode, scope and write policy.`),children:(0,X.jsx)(Oy,{children:(0,X.jsx)(J,{...j,onClick:()=>void k(`memory.status`),children:D(i,`Kiểm tra memory`,`Check memory`)})})}),(0,X.jsxs)(Dy,{icon:(0,X.jsx)(Yf,{color:`primary`}),title:D(i,`MCP governance`,`MCP governance`),detail:D(i,`Doctor, trust decision và reset dùng cùng registry với Terminal.`,`Doctor, trust decisions and reset use the same registry as Terminal.`),children:[(0,X.jsxs)(Oy,{children:[(0,X.jsx)(J,{...j,onClick:()=>void k(`mcp.status`),children:`MCP status`}),(0,X.jsx)(J,{...j,onClick:()=>void k(`mcp.doctor`),children:`Doctor`})]}),(0,X.jsxs)(Q,{direction:{xs:`column`,sm:`row`},sx:{mt:1,gap:.75},children:[(0,X.jsx)(z,{size:`small`,fullWidth:!0,displayEmpty:!0,value:x,onChange:e=>S(e.target.value),disabled:w,renderValue:e=>e||D(i,`Chọn MCP…`,`Select MCP…`),children:E.map(e=>(0,X.jsx)(dp,{value:e.name,children:e.name},e.connectionRef))}),(0,X.jsx)(J,{...j,disabled:w||!x,onClick:()=>void k(`mcp.detail`,x),children:`Detail`}),(0,X.jsx)(J,{...j,disabled:w||!x,onClick:()=>A(`mcp.approve`,x,D(i,`Phê duyệt MCP?`,`Approve MCP?`),D(i,`Project sẽ tin cậy cấu hình MCP đã chọn.`,`The project will trust the selected MCP configuration.`)),children:`Approve`}),(0,X.jsx)(J,{...j,disabled:w||!x,color:`warning`,onClick:()=>A(`mcp.reject`,x,D(i,`Từ chối MCP?`,`Reject MCP?`),D(i,`Project sẽ ghi quyết định từ chối cho MCP đã chọn.`,`The project will record a rejection for the selected MCP.`)),children:`Reject`}),(0,X.jsx)(J,{...j,disabled:w||!x,color:`warning`,onClick:()=>A(`mcp.reset`,x,D(i,`Reset quyết định MCP?`,`Reset MCP decision?`),D(i,`Quyết định trust hiện tại của MCP sẽ được xóa để đánh giá lại.`,`The MCP's current trust decision will be cleared for reevaluation.`)),children:`Reset`})]})]})]}),(a||s||l)&&(0,X.jsx)(ht,{"aria-live":`polite`,variant:`outlined`,sx:{mt:2,p:2,borderRadius:1},children:a?(0,X.jsxs)(Q,{direction:`row`,spacing:1,sx:{alignItems:`center`},children:[(0,X.jsx)(Ve,{size:18}),(0,X.jsx)(q,{children:D(i,`Đang chạy trong Pi runtime…`,`Running in the Pi runtime…`)})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(Q,{direction:`row`,sx:{alignItems:`center`,gap:1,flexWrap:`wrap`},children:[(0,X.jsx)(Lp,{color:s?.state===`settled`?`success`:`warning`}),(0,X.jsx)(q,{sx:{fontWeight:800},children:s?s.action:D(i,`Không hoàn tất`,`Not completed`)}),s&&(0,X.jsx)(rr,{size:`small`,color:s.state===`settled`?`success`:`warning`,variant:`outlined`,label:s.resultCode}),(s?.effect===`read-only`||s?.effect===`session-setting`)&&(0,X.jsx)(rr,{size:`small`,color:s.modelCallObserved?`warning`:`success`,variant:`outlined`,label:s.modelCallObserved?D(i,`Đã phát hiện model call`,`Model call detected`):`0 model token`})]}),O&&(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,sx:{mt:1},children:D(i,`Fast: ${O.mode} · provider: ${O.provider??`unknown`} · ${O.reasonCode}`,`Fast: ${O.mode} · provider: ${O.provider??`unknown`} · ${O.reasonCode}`)}),l&&(0,X.jsx)(q,{color:`error`,variant:`body2`,sx:{mt:1},children:l}),s?.outputs.map((e,t)=>(0,X.jsx)(Z,{component:`pre`,sx:{m:0,mt:1,p:1.25,borderRadius:1,bgcolor:`action.hover`,whiteSpace:`pre-wrap`,overflowWrap:`anywhere`,fontSize:12.5,maxHeight:260,overflow:`auto`},children:e.content},`${e.customType}-${t}`))]})}),(0,X.jsx)(um,{open:p!==null,title:p?.title??``,description:p?.description??``,cancelLabel:D(i,`Hủy`,`Cancel`),confirmLabel:D(i,`Xác nhận và chạy`,`Confirm and run`),onCancel:()=>m(null),onConfirm:()=>{let e=p;m(null),e&&k(e.action,e.argument,!0)}})]})}var Ay=K((0,X.jsx)(`path`,{d:`M17 11h3c1.11 0 2-.9 2-2V5c0-1.11-.9-2-2-2h-3c-1.11 0-2 .9-2 2v1H9.01V5c0-1.11-.9-2-2-2H4c-1.1 0-2 .9-2 2v4c0 1.11.9 2 2 2h3c1.11 0 2-.9 2-2V8h2v7.01c0 1.65 1.34 2.99 2.99 2.99H15v1c0 1.11.9 2 2 2h3c1.11 0 2-.9 2-2v-4c0-1.11-.9-2-2-2h-3c-1.11 0-2 .9-2 2v1h-1.01c-.54 0-.99-.45-.99-.99V8h2v1c0 1.1.9 2 2 2`}),`AccountTreeRounded`),jy=K((0,X.jsx)(`path`,{d:`M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8`}),`InfoOutlined`),My=K((0,X.jsx)(`path`,{d:`M20 5H4c-1.1 0-1.99.9-1.99 2L2 17c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m-9 3h2v2h-2zm0 3h2v2h-2zM8 8h2v2H8zm0 3h2v2H8zm-1 2H5v-2h2zm0-3H5V8h2zm8 7H9c-.55 0-1-.45-1-1s.45-1 1-1h6c.55 0 1 .45 1 1s-.45 1-1 1m1-4h-2v-2h2zm0-3h-2V8h2zm3 3h-2v-2h2zm0-3h-2V8h2z`}),`KeyboardRounded`),Ny=K([(0,X.jsx)(`path`,{d:`M13 8.57c-.79 0-1.43.64-1.43 1.43s.64 1.43 1.43 1.43 1.43-.64 1.43-1.43-.64-1.43-1.43-1.43`},`0`),(0,X.jsx)(`path`,{d:`M13.21 3c-3.84-.11-7 2.87-7.19 6.64L4.1 12.2c-.25.33-.01.8.4.8H6v3c0 1.1.9 2 2 2h1v2c0 .55.45 1 1 1h5c.55 0 1-.45 1-1v-3.68c2.44-1.16 4.1-3.68 4-6.58-.14-3.62-3.18-6.63-6.79-6.74M16 10c0 .13-.01.26-.02.39l.83.66c.08.06.1.16.05.25l-.8 1.39c-.05.09-.16.12-.24.09l-.99-.4c-.21.16-.43.29-.67.39L14 13.83c-.01.1-.1.17-.2.17h-1.6c-.1 0-.18-.07-.2-.17l-.15-1.06c-.25-.1-.47-.23-.68-.39l-.99.4c-.09.03-.2 0-.25-.09l-.8-1.39c-.05-.08-.03-.19.05-.25l.84-.66c-.01-.13-.02-.26-.02-.39s.02-.27.04-.39l-.85-.66c-.08-.06-.1-.16-.05-.26l.8-1.38c.05-.09.15-.12.24-.09l1 .4c.2-.15.43-.29.67-.39L12 6.17c.02-.1.1-.17.2-.17h1.6c.1 0 .18.07.2.17l.15 1.06c.24.1.46.23.67.39l1-.4c.09-.03.2 0 .24.09l.8 1.38c.05.09.03.2-.05.26l-.85.66c.03.12.04.25.04.39`},`1`)],`PsychologyRounded`),Py=e=>e.normalize(`NFD`).replace(/\p{M}/gu,``).replace(/đ/g,`d`).replace(/Đ/g,`D`).toLowerCase();function Fy(e,t){let n=Py(t).split(/\s+/).filter(Boolean),r=Py(e).split(/[^\p{L}\p{N}]+/u).filter(Boolean);return n.every(e=>r.some(t=>t.startsWith(e)))}function Iy(e,t,n=40){return t.trim()?e.filter(e=>Fy(`${e.label} ${e.keywords??``} ${e.group}`,t)).slice(0,n):e.slice(0,n)}function Ly(e){let t=(0,Y.useRef)(e);t.current=e,(0,Y.useEffect)(()=>{let e=e=>{if(!(e.isComposing||!(e.metaKey||e.ctrlKey)||e.altKey)){if(e.shiftKey){e.key.toLowerCase()===`o`&&t.current.newChat&&(e.preventDefault(),t.current.newChat());return}e.key.toLowerCase()===`k`?(e.preventDefault(),t.current.palette()):e.key===`,`&&(e.preventDefault(),t.current.settings())}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function Ry({open:e,onClose:t,commands:n,locale:r}){let[i,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(0),c=(0,Y.useMemo)(()=>Iy(n,i),[n,i]),l=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{e&&(a(``),s(0))},[e]),(0,Y.useEffect)(()=>{s(0)},[i]),(0,Y.useEffect)(()=>{l.current?.querySelector(`[data-index="${o}"]`)?.scrollIntoView({block:`nearest`})},[o]);let u=e=>{e&&(t(),setTimeout(()=>e.run(),0))},d=e=>{e.nativeEvent.isComposing||(e.key===`ArrowDown`?(e.preventDefault(),s(e=>Math.min(e+1,c.length-1))):e.key===`ArrowUp`?(e.preventDefault(),s(e=>Math.max(e-1,0))):e.key===`Enter`&&(e.preventDefault(),u(c[o])))},f=``;return(0,X.jsxs)(ge,{open:e,onClose:t,fullWidth:!0,maxWidth:`sm`,slotProps:{paper:{"aria-label":D(r,`Bảng lệnh`,`Command palette`),sx:{alignSelf:`flex-start`,mt:{xs:2,sm:`12vh`},borderRadius:1,overflow:`hidden`}}},children:[(0,X.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:1,px:2,py:1.25,borderBottom:1,borderColor:`divider`},children:[(0,X.jsx)(vu,{fontSize:`small`,color:`action`}),(0,X.jsx)(F,{autoFocus:!0,fullWidth:!0,value:i,onChange:e=>a(e.target.value),onKeyDown:d,placeholder:D(r,`Gõ lệnh hoặc tên cuộc trò chuyện…`,`Type a command or a conversation name…`),inputProps:{role:`combobox`,"aria-expanded":!0,"aria-controls":`piagent-palette-list`,"aria-activedescendant":c[o]?`palette-${c[o].id}`:void 0,"aria-label":D(r,`Tìm lệnh`,`Search commands`)}})]}),(0,X.jsxs)(fe,{component:`div`,id:`piagent-palette-list`,role:`listbox`,"aria-label":D(r,`Lệnh`,`Commands`),ref:l,dense:!0,sx:{maxHeight:`min(60vh, 460px)`,overflowY:`auto`,py:.5},children:[c.map((e,t)=>{let n=e.group===f?null:e.group;return f=e.group,(0,X.jsxs)(Y.Fragment,{children:[n&&(0,X.jsx)(jm,{component:`div`,"aria-hidden":!0,disableSticky:!0,sx:{lineHeight:`28px`,fontSize:11,fontWeight:800,letterSpacing:`.04em`,textTransform:`uppercase`},children:n}),(0,X.jsxs)(Ar,{id:`palette-${e.id}`,role:`option`,"aria-selected":t===o,"data-index":t,selected:t===o,onMouseMove:()=>s(t),onClick:()=>u(e),sx:{mx:.5,borderRadius:1,gap:2},children:[(0,X.jsx)(q,{sx:{flex:1,minWidth:0,fontSize:14},noWrap:!0,children:e.label}),e.hint&&(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,noWrap:!0,children:e.hint})]})]},e.id)}),!c.length&&(0,X.jsx)(q,{sx:{px:2.5,py:3},color:`text.secondary`,children:D(r,`Không có lệnh nào khớp.`,`No matching command.`)})]})]})}var zy=K((0,X.jsx)(`path`,{d:`M9.29 6.71c-.39.39-.39 1.02 0 1.41L13.17 12l-3.88 3.88c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41L10.7 6.7c-.38-.38-1.02-.38-1.41.01`}),`ChevronRightRounded`),By={"branch-switch-blocked-running":[`Có cuộc trò chuyện đang chạy trong folder này. Chờ chạy xong hoặc Dừng rồi chuyển nhánh.`,`A conversation is running in this folder. Wait for it to finish, or stop it, then switch.`],"branch-switch-local-changes":[`Git không chuyển được: thay đổi chưa commit sẽ bị ghi đè. Commit hoặc stash trước.`,`Git refused: uncommitted changes would be overwritten. Commit or stash them first.`],"branch-switch-unfinished-merge":[`Repo đang dở merge hoặc rebase. Xử lý xong rồi chuyển nhánh.`,`The repository is in the middle of a merge or rebase. Finish it first.`],"branch-exists":[`Đã có nhánh tên này.`,`A branch with this name already exists.`],"branch-name-invalid":[`Tên nhánh không hợp lệ với Git.`,`Git does not accept this branch name.`],"branch-not-found":[`Không còn nhánh này.`,`This branch no longer exists.`],"not-a-git-repository":[`Folder này không phải repo Git.`,`This folder is not a Git repository.`],"branch-switch-timeout":[`Git chạy quá lâu nên đã dừng.`,`Git took too long and was stopped.`]};function Vy({projectRef:e,projectLabel:t,branch:n,repositories:r,locale:i,onSwitched:a,maxWidth:o=220}){let[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(!1),[h,g]=(0,Y.useState)(``),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(null),x=(0,Y.useRef)(null),S=(0,Y.useRef)(null),[C,w]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{w(null)},[n?.name,n?.detached,e]);let T=C??n,E=!!s,O=()=>{x.current?.abort();let t=new AbortController;x.current=t,m(!1),wc(e,l,t.signal).then(e=>{t.signal.aborted||f(e)},()=>{t.signal.aborted||m(!0)})};(0,Y.useEffect)(()=>(E&&O(),()=>x.current?.abort()),[E,e,l]);let k=()=>{_||(x.current?.abort(),c(null),g(``),b(null),f(null),m(!1),u(null))},A=e=>{x.current?.abort(),f(null),g(``),b(null),u(e)},j=async t=>{v(t.branch),b(null);try{let n=await Tc(e,l===null?t:{...t,repository:l});n.head&&l===null&&w(n.head),a?.(),c(null),g(``),f(null),u(null)}catch(e){b(e instanceof Cc?{code:e.code,detail:e.detail}:{code:`branch-switch-failed`,detail:null}),O()}finally{v(null)}},M=d?.repository?d:null;(0,Y.useEffect)(()=>{E&&M&&requestAnimationFrame(()=>S.current?.focus())},[E,M]);let N=h.trim(),P=(0,Y.useMemo)(()=>(M?.branches??[]).filter(e=>!N||e.name.toLowerCase().includes(N.toLowerCase())),[M,N]),F=P.filter(e=>!e.remote),I=P.filter(e=>e.remote),ee=(M?.branches??[]).some(e=>e.name===N),te=(d?.running??0)>0,L=e=>(0,X.jsxs)(Ar,{dense:!0,disabled:!e.current&&(te||!!_),selected:e.current,"aria-current":e.current||void 0,onClick:()=>e.current?k():void j({branch:e.name,remote:e.remote}),sx:{borderRadius:1,py:.4},children:[(0,X.jsx)(Fr,{sx:{minWidth:26},children:_===e.name?(0,X.jsx)(Ve,{size:14}):e.current?(0,X.jsx)(h_,{sx:{fontSize:16}}):e.remote?(0,X.jsx)(Dp,{sx:{fontSize:15,color:`text.disabled`}}):null}),(0,X.jsx)(Br,{primary:e.name,secondary:[e.remote,e.committedAt?jv(e.committedAt,i):null].filter(Boolean).join(` · `)||void 0,slotProps:{primary:{noWrap:!0,sx:{fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`,fontSize:12.5}},secondary:{noWrap:!0,sx:{fontSize:11}}}})]},`${e.remote??``}/${e.name}`),ne=d&&!d.repository?d.repositories??[]:[],R=!T&&!!r?.length;if(!T&&!R)return null;let z={minWidth:0,maxWidth:o,borderRadius:.75,px:.4,mx:-.4,font:`inherit`,color:`inherit`,justifyContent:`flex-start`,"&:hover":{bgcolor:`action.hover`,color:`text.primary`},"&.Mui-focusVisible":{outline:`2px solid`,outlineColor:`primary.main`}},re=e=>{e.stopPropagation(),c(e.currentTarget)};return(0,X.jsxs)(X.Fragment,{children:[T?(0,X.jsx)(bo,{describeChild:!0,title:`${kv(T,i)} · ${D(i,`bấm để đổi nhánh`,`click to switch`)}`,children:(0,X.jsx)(We,{onClick:re,"aria-haspopup":`dialog`,"aria-expanded":E,"aria-label":T.detached?D(i,`Đổi nhánh Git của ${t} (detached HEAD tại ${T.name})`,`Switch ${t}'s Git branch (detached HEAD at ${T.name})`):D(i,`Đổi nhánh Git của ${t} (đang ở ${T.name})`,`Switch ${t}'s Git branch (on ${T.name})`),sx:z,children:(0,X.jsx)(Av,{branch:T,locale:i,maxWidth:`100%`,tooltip:!1})})}):(0,X.jsx)(bo,{describeChild:!0,title:r.map(e=>`${e.name} · ${e.branch?.name??`?`}`).join(`
102
+ `),children:(0,X.jsx)(We,{onClick:re,"aria-haspopup":`dialog`,"aria-expanded":E,"aria-label":D(i,`${r.length} repo Git trong ${t}`,`${r.length} Git repositories in ${t}`),sx:z,children:(0,X.jsxs)(Z,{component:`span`,sx:{display:`inline-flex`,alignItems:`center`,gap:.4,whiteSpace:`nowrap`},children:[(0,X.jsx)(Ov,{sx:{fontSize:`1.1em`}}),D(i,`${r.length} repo`,`${r.length} repos`)]})})}),(0,X.jsxs)(_e,{open:E,anchorEl:s,onClose:k,anchorOrigin:{vertical:`bottom`,horizontal:`left`},slotProps:{paper:{role:`dialog`,"aria-label":D(i,`Nhánh Git`,`Git branches`),sx:{width:`min(360px, calc(100vw - 32px))`,maxHeight:`min(520px, 70vh)`,display:`flex`,flexDirection:`column`,p:1.25,gap:1}}},children:[(0,X.jsxs)(Z,{sx:{display:`flex`,alignItems:`center`,gap:.5,minWidth:0},children:[l!==null&&(0,X.jsx)(et,{size:`small`,"aria-label":D(i,`Về danh sách repo`,`Back to the repositories`),onClick:()=>A(null),children:(0,X.jsx)(Sm,{sx:{fontSize:18}})}),(0,X.jsxs)(Z,{sx:{minWidth:0},children:[(0,X.jsx)(q,{variant:`subtitle2`,sx:{fontWeight:650},children:R&&l===null?D(i,`Repo Git`,`Git repositories`):D(i,`Nhánh Git`,`Git branches`)}),(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,noWrap:!0,component:`div`,children:l===null?t:`${t} / ${l}`})]})]}),te&&(0,X.jsx)(ut,{severity:`warning`,sx:{py:0,fontSize:12.5},children:D(i,`${d.running} cuộc trò chuyện đang chạy trong folder này. Chờ chạy xong hoặc Dừng rồi mới chuyển nhánh.`,`${d.running} conversation(s) running in this folder. Wait for them to finish, or stop them, before switching.`)}),M&&M.changedFiles>0&&!te&&(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,children:D(i,`${M.changedFiles} file đang sửa dở sẽ đi theo sang nhánh mới; Git từ chối nếu chúng bị ghi đè.`,`${M.changedFiles} changed file(s) come along to the new branch; Git refuses if they would be overwritten.`)}),y&&(0,X.jsxs)(ut,{severity:`error`,sx:{py:0,fontSize:12.5},children:[D(i,...By[y.code]??[`Không chuyển được nhánh.`,`The branch could not be switched.`]),y.detail&&(0,X.jsx)(Z,{component:`pre`,sx:{m:0,mt:.5,whiteSpace:`pre-wrap`,font:`11px ui-monospace, monospace`,opacity:.85},children:y.detail})]}),!(d&&!d.repository)&&(0,X.jsx)(le,{inputRef:S,size:`small`,value:h,onChange:e=>g(e.target.value),disabled:!M||!!_,placeholder:D(i,`Tìm hoặc đặt tên nhánh mới`,`Find a branch or name a new one`),slotProps:{htmlInput:{maxLength:200,"aria-label":D(i,`Tìm nhánh`,`Find a branch`)}},onKeyDown:e=>{if(e.key===`Enter`&&N&&!te&&!_){let e=M?.branches.find(e=>e.name===N);j(e?{branch:e.name,remote:e.remote}:{branch:N,create:!0})}}}),(0,X.jsxs)(Z,{sx:{overflowY:`auto`,minHeight:0,mx:-.5},children:[!d&&!p&&(0,X.jsx)(Z,{sx:{display:`flex`,justifyContent:`center`,py:2},children:(0,X.jsx)(Ve,{size:18})}),p&&(0,X.jsx)(ut,{severity:`error`,sx:{py:0,fontSize:12.5},children:D(i,`Không đọc được danh sách nhánh.`,`The branches could not be read.`)}),d&&!d.repository&&ne.length>0&&(0,X.jsx)(fe,{dense:!0,disablePadding:!0,"aria-label":D(i,`Repo trong folder`,`Repositories in the folder`),children:ne.map(e=>(0,X.jsxs)(Ar,{dense:!0,onClick:()=>A(e.name),sx:{borderRadius:1,py:.4},children:[(0,X.jsx)(Br,{primary:e.name,secondary:(0,X.jsxs)(Z,{component:`span`,sx:{display:`flex`,alignItems:`center`,gap:.5,minWidth:0,width:`100%`},children:[e.head?(0,X.jsx)(Av,{branch:e.head,locale:i,maxWidth:`100%`,tooltip:!1}):D(i,`chưa có commit`,`no commits`),e.changedFiles>0&&(0,X.jsxs)(Z,{component:`span`,sx:{flexShrink:0},children:[`· `,D(i,`${e.changedFiles} file đang sửa`,`${e.changedFiles} changed`)]})]}),slotProps:{primary:{noWrap:!0,sx:{fontSize:13,fontWeight:600}},secondary:{component:`div`,sx:{fontSize:11.5,minWidth:0}}},sx:{minWidth:0}}),(0,X.jsx)(zy,{sx:{fontSize:18,color:`text.disabled`}})]},e.name))}),d&&!d.repository&&ne.length===0&&(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,sx:{px:1},children:D(i,...By[`not-a-git-repository`])}),M&&(0,X.jsxs)(fe,{dense:!0,disablePadding:!0,children:[N&&!ee&&(0,X.jsxs)(Ar,{dense:!0,disabled:te||!!_,onClick:()=>void j({branch:N,create:!0}),sx:{borderRadius:1},children:[(0,X.jsx)(Fr,{sx:{minWidth:26},children:_===N?(0,X.jsx)(Ve,{size:14}):(0,X.jsx)(gf,{sx:{fontSize:16}})}),(0,X.jsx)(Br,{primary:D(i,`Tạo nhánh mới “${N}”`,`Create branch “${N}”`),secondary:D(i,`từ ${M.head?.name??`HEAD`}`,`from ${M.head?.name??`HEAD`}`),slotProps:{primary:{noWrap:!0,sx:{fontSize:12.5}},secondary:{sx:{fontSize:11}}}})]}),F.map(L),I.length>0&&(0,X.jsx)(jm,{disableSticky:!0,sx:{lineHeight:`26px`,fontSize:11,bgcolor:`transparent`},children:D(i,`Trên remote`,`On a remote`)}),I.map(L),P.length===0&&!N&&(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,sx:{px:1},children:D(i,`Chưa có nhánh nào.`,`No branches yet.`)}),M.truncated&&(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,sx:{px:1},children:D(i,`Chỉ hiện 200 nhánh có commit mới nhất.`,`Showing the 200 most recently committed branches.`)})]})]})]})]})}var Hy=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?`⌘`:`Ctrl`,Uy={height:28,px:1,gap:.75,fontSize:12,color:`text.secondary`,alignItems:`center`},Wy={...Uy,borderRadius:0,"&:hover":{bgcolor:`action.hover`,color:`text.primary`},"&.Mui-focusVisible":{outline:`2px solid`,outlineColor:`primary.main`,outlineOffset:-2}};function Gy({locale:e,connection:t,running:n,session:r,onBranchSwitched:i,onUpdates:a,onPalette:o}){let{status:s,supported:c}=Oh(),l=af(e=>e.breakpoints.up(`md`)),u=Th(s),d=!!(s?.updateAvailable&&s.installable),f=s?.piagent.installed?`Piagent ${s.piagent.installed}${s.pi.installed?` · Pi ${s.pi.installed}`:``}`:`Piagent`;return l?(0,X.jsxs)(Z,{component:`footer`,"aria-label":D(e,`Thanh trạng thái`,`Status bar`),sx:{position:`fixed`,left:0,right:0,bottom:0,height:28,display:`flex`,alignItems:`stretch`,borderTop:1,borderColor:`divider`,bgcolor:`background.paper`,zIndex:e=>e.zIndex.drawer+1,whiteSpace:`nowrap`},children:[(0,X.jsxs)(Q,{direction:`row`,sx:Uy,children:[(0,X.jsx)(Z,{sx:{width:7,height:7,borderRadius:`50%`,bgcolor:t===`connected`?`success.main`:`warning.main`}}),(0,X.jsx)(`span`,{children:t===`connected`?`Gateway live`:t}),(0,X.jsx)(Z,{component:`span`,sx:{color:`text.disabled`},children:`local`})]}),(r?.gitBranch||!!r?.gitRepositories?.length)&&(0,X.jsx)(Q,{direction:`row`,sx:{...Uy,minWidth:0},children:(0,X.jsx)(Vy,{projectRef:r.projectRef,projectLabel:r.projectLabel,branch:r.gitBranch,repositories:r.gitRepositories,locale:e,maxWidth:320,onSwitched:i})}),n>0&&(0,X.jsxs)(Q,{direction:`row`,sx:Uy,children:[(0,X.jsx)(Ve,{size:10,thickness:6}),(0,X.jsx)(`span`,{children:D(e,`${n} đang chạy`,`${n} running`)})]}),(0,X.jsx)(Z,{sx:{flex:1}}),c&&(0,X.jsx)(bo,{describeChild:!0,title:d?D(e,`Mở Cập nhật trong Cài đặt`,`Open Updates in Settings`):D(e,`Phiên bản và cập nhật`,`Version and updates`),children:(0,X.jsx)(We,{onClick:a,sx:{...Wy,...d&&{color:`primary.contrastText`,bgcolor:`primary.main`,fontWeight:700,"&:hover":{bgcolor:`primary.dark`,color:`primary.contrastText`}}},children:u?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ve,{size:11,thickness:6,color:`inherit`}),D(e,`Đang cập nhật lên ${s?.job?.to}…`,`Updating to ${s?.job?.to}…`)]}):d?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(yh,{sx:{fontSize:15}}),D(e,`Cập nhật Piagent ${s?.piagent.latest}`,`Update Piagent ${s?.piagent.latest}`)]}):(0,X.jsx)(`span`,{children:f})})}),(0,X.jsxs)(We,{onClick:o,"aria-label":D(e,`Mở bảng lệnh`,`Open command palette`),sx:Wy,children:[(0,X.jsxs)(Z,{component:`kbd`,sx:{font:`inherit`,fontSize:11,px:.6,border:1,borderColor:`divider`,borderRadius:.75},children:[Hy(),` K`]}),(0,X.jsx)(`span`,{children:D(e,`Lệnh`,`Commands`)})]})]}):null}function Ky(e){let t=D(e,`Chung`,`General`),n=`Agent`,r=D(e,`Công cụ`,`Tools`),i=D(e,`Thông tin`,`Information`);return[{id:`general`,group:t,label:D(e,`Giao diện`,`Appearance`),icon:(0,X.jsx)(Dm,{}),keywords:`ngôn ngữ language chủ đề theme sáng tối light dark tiếng việt english`},{id:`updates`,group:t,label:D(e,`Cập nhật`,`Updates`),icon:(0,X.jsx)(yh,{}),keywords:`update phiên bản version pi piagent npm nâng cấp upgrade`},{id:`shortcuts`,group:t,label:D(e,`Phím tắt`,`Shortcuts`),icon:(0,X.jsx)(My,{}),keywords:`keyboard bàn phím shortcut lệnh command palette enter`},{id:`models`,group:n,label:D(e,`Nhà cung cấp & model`,`Providers & models`),icon:(0,X.jsx)(Ny,{}),keywords:`model provider thinking đăng nhập login oauth tài khoản account công ty company`},{id:`controls`,group:n,label:D(e,`Điều khiển project`,`Project controls`),icon:(0,X.jsx)(Ay,{}),keywords:`project runtime khởi động lại restart session`},{id:`permissions`,group:n,label:D(e,`Quyền truy cập`,`Access`),icon:(0,X.jsx)(Em,{}),keywords:`permission quyền sandbox đọc ghi read write network mạng`},{id:`connections`,group:r,label:D(e,`MCP & kết nối`,`MCP & connections`),icon:(0,X.jsx)(Yf,{}),keywords:`mcp server tool công cụ oauth kết nối connection`},{id:`usage`,group:i,label:D(e,`Sử dụng & context`,`Usage & context`),icon:(0,X.jsx)(wy,{}),keywords:`token usage context ngữ cảnh input output`},{id:`about`,group:i,label:`Piagent`,icon:(0,X.jsx)(jy,{}),keywords:`gateway protocol runtime giới thiệu about`}]}function qy(e,t){return t.trim()?e.filter(e=>Fy(`${e.label} ${e.group} ${e.keywords}`,t)):e}function Jy({section:e,onSection:t,onBack:n}){let{locale:r}=C(),{status:i}=Oh(),[a,o]=(0,Y.useState)(``),s=(0,Y.useMemo)(()=>qy(Ky(r),a),[r,a]),c=!!(i?.updateAvailable&&i.installable),l=``;return(0,X.jsxs)(Z,{component:`nav`,"aria-label":D(r,`Mục cài đặt`,`Settings sections`),sx:{borderRight:{sm:1},borderBottom:{xs:1,sm:0},borderColor:`divider`,bgcolor:`background.paper`,p:1.25,minHeight:0,overflow:`auto`,display:`flex`,flexDirection:`column`},children:[(0,X.jsxs)(Q,{direction:`row`,sx:{minHeight:48,alignItems:`center`,justifyContent:`space-between`,px:1},children:[(0,X.jsx)(q,{id:`piagent-settings-title`,sx:{fontWeight:700},children:D(r,`Cài đặt`,`Settings`)}),(0,X.jsx)(et,{"aria-label":D(r,`Đóng cài đặt`,`Close settings`),onClick:n,children:(0,X.jsx)(Uh,{})})]}),(0,X.jsxs)(ht,{variant:`outlined`,sx:{display:`flex`,alignItems:`center`,gap:.75,px:1,mx:.5,mb:1,borderRadius:1},children:[(0,X.jsx)(vu,{fontSize:`small`,color:`action`}),(0,X.jsx)(F,{value:a,onChange:e=>o(e.target.value),placeholder:D(r,`Tìm cài đặt`,`Search settings`),inputProps:{"aria-label":D(r,`Tìm cài đặt`,`Search settings`)},onKeyDown:e=>{e.key===`Enter`&&s[0]&&(e.preventDefault(),t(s[0].id))},sx:{flex:1,fontSize:13,py:.5}})]}),(0,X.jsxs)(fe,{component:`div`,disablePadding:!0,sx:{display:{xs:`flex`,sm:`block`},minWidth:{xs:`max-content`,sm:0},overflowX:`auto`,flex:1},children:[s.map(n=>{let i=n.group===l?null:n.group;return l=n.group,(0,X.jsxs)(Z,{sx:{display:{xs:`contents`,sm:`block`}},children:[i&&(0,X.jsx)(jm,{component:`div`,disableSticky:!0,sx:{display:{xs:`none`,sm:`block`},bgcolor:`transparent`,lineHeight:`30px`,fontSize:11,fontWeight:800,letterSpacing:`.04em`,textTransform:`uppercase`,mt:.5},children:i}),(0,X.jsxs)(Ar,{selected:e===n.id,onClick:()=>t(n.id),children:[(0,X.jsx)(Fr,{sx:{minWidth:36,color:`inherit`,"& .MuiSvgIcon-root":{fontSize:19}},children:n.icon}),(0,X.jsx)(Br,{primary:n.label,slotProps:{primary:{sx:{fontSize:13,fontWeight:e===n.id?800:650}}}}),n.id===`updates`&&c&&(0,X.jsx)(Z,{"aria-label":D(r,`Có bản cập nhật`,`Update available`),role:`img`,sx:{width:8,height:8,borderRadius:`50%`,bgcolor:`primary.main`,flexShrink:0}})]})]},n.id)}),!s.length&&(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,sx:{px:1.5,py:2},children:D(r,`Không có mục nào khớp.`,`No matching setting.`)})]}),i?.piagent.installed&&(0,X.jsx)(q,{variant:`caption`,color:`text.disabled`,sx:{display:{xs:`none`,sm:`block`},px:1.5,pt:1},children:`Piagent ${i.piagent.installed}${i.pi.installed?` · Pi ${i.pi.installed}`:``}`})]})}function Yy(){let{locale:e}=C(),t=Hy(),n=[[`${t} K`,D(e,`Mở bảng lệnh: mọi thao tác và cuộc trò chuyện theo tên`,`Open the command palette: every action and conversation by name`)],[`${t} ,`,D(e,`Mở Cài đặt`,`Open Settings`)],[`Enter`,D(e,`Gửi tin nhắn`,`Send the message`)],[`Shift Enter`,D(e,`Xuống dòng trong tin nhắn`,`New line in the message`)],[`1 – 5`,D(e,`Chọn đáp án khi main agent hỏi; Enter để gửi câu trả lời`,`Pick an answer when the main agent asks; Enter sends it`)],[`Esc`,D(e,`Đóng hộp thoại hoặc bảng lệnh`,`Close a dialog or the palette`)]];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{component:`h1`,variant:`h1`,sx:{mb:3},children:D(e,`Phím tắt`,`Shortcuts`)}),(0,X.jsx)(ht,{variant:`outlined`,sx:{borderRadius:1,overflow:`hidden`},children:n.map(([e,t],n)=>(0,X.jsxs)(Q,{direction:`row`,sx:{px:2.25,py:1.5,gap:2,alignItems:`center`,justifyContent:`space-between`,borderTop:+!!n,borderColor:`divider`},children:[(0,X.jsx)(q,{children:t}),(0,X.jsx)(Z,{component:`kbd`,sx:{px:.9,py:.2,border:1,borderColor:`divider`,borderRadius:1,fontSize:12,fontFamily:`inherit`,whiteSpace:`nowrap`,bgcolor:`action.hover`},children:e})]},e))})]})}function Xy(e,t){return e==null?`—`:new Intl.NumberFormat(t===`vi`?`vi-VN`:`en-US`).format(e)}function Zy({children:e}){return(0,X.jsx)(q,{component:`h1`,variant:`h1`,sx:{mb:3},children:e})}function Qy({icon:e,title:t,detail:n,action:r}){return(0,X.jsxs)(Q,{direction:{xs:`column`,sm:`row`},sx:{alignItems:{sm:`center`},justifyContent:`space-between`,gap:2,p:2.25},children:[(0,X.jsxs)(Q,{direction:`row`,spacing:1.4,sx:{alignItems:`center`},children:[e,(0,X.jsxs)(Z,{children:[(0,X.jsx)(q,{sx:{fontWeight:760},children:t}),n&&(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:n})]})]}),r]})}function $y(){let{locale:e,colorMode:t,themeId:n,setLocale:r,setColorMode:i,setThemeId:a}=C();return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Zy,{children:D(e,`Giao diện`,`Appearance`)}),(0,X.jsxs)(ht,{variant:`outlined`,sx:{borderRadius:1,overflow:`hidden`},children:[(0,X.jsx)(Qy,{icon:(0,X.jsx)(v_,{color:`primary`}),title:D(e,`Ngôn ngữ`,`Language`),detail:D(e,`Ngôn ngữ của giao diện. Agent trả lời theo ngôn ngữ bạn nhắn.`,`The interface language. The agent answers in the language you write.`),action:(0,X.jsxs)(ei,{exclusive:!0,size:`small`,value:e,onChange:(e,t)=>t&&r(t),children:[(0,X.jsx)(Jr,{value:`vi`,children:`VI`}),(0,X.jsx)(Jr,{value:`en`,children:`EN`})]})}),(0,X.jsx)(lr,{}),(0,X.jsx)(Qy,{icon:t===`dark`?(0,X.jsx)(jo,{color:`primary`}):(0,X.jsx)(Ao,{color:`primary`}),title:D(e,`Chủ đề`,`Theme`),detail:D(e,`Sáng hoặc tối, lưu trên trình duyệt này.`,`Light or dark, kept in this browser.`),action:(0,X.jsxs)(ei,{exclusive:!0,size:`small`,value:t,onChange:(e,t)=>t&&i(t),children:[(0,X.jsx)(Jr,{value:`light`,children:D(e,`Sáng`,`Light`)}),(0,X.jsx)(Jr,{value:`dark`,children:D(e,`Tối`,`Dark`)})]})}),(0,X.jsx)(lr,{}),(0,X.jsxs)(Z,{sx:{p:2},children:[(0,X.jsx)(q,{sx:{fontWeight:600},children:D(e,`Chủ đề màu`,`Color theme`)}),(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,sx:{mb:1.5},children:D(e,`Đổi màu giao diện, editor và terminal.`,`Colours for the interface, the editor and the terminal.`)}),(0,X.jsx)(Z,{role:`radiogroup`,"aria-label":D(e,`Chủ đề màu`,`Color theme`),sx:{display:`grid`,gap:1,gridTemplateColumns:`repeat(auto-fill, minmax(150px, 1fr))`},children:O.map(e=>(0,X.jsxs)(Z,{component:`button`,type:`button`,role:`radio`,"aria-checked":e.id===n,onClick:()=>a(e.id),sx:{textAlign:`left`,p:1,cursor:`pointer`,font:`inherit`,color:e.text,bgcolor:e.paper,borderRadius:`2px`,border:2,borderColor:e.id===n?`primary.main`:e.divider,outlineOffset:2},children:[(0,X.jsx)(Z,{sx:{display:`flex`,gap:.5,mb:.75},children:[e.background,e.primary,e.secondary,e.syntax.keyword,e.syntax.string,e.warning].map((t,n)=>(0,X.jsx)(Z,{"aria-hidden":!0,sx:{width:14,height:14,bgcolor:t,border:1,borderColor:e.divider}},n))}),(0,X.jsx)(Z,{component:`span`,sx:{fontSize:13,fontWeight:500},children:e.label})]},e.id))})]})]})]})}function eb({options:e,snapshot:t,activeModel:n,observedProvider:r}){let{locale:i}=C(),a=e?.webSearch,o=t?.capabilities.capabilities.attachments,s=o?.status===`available`?o.kinds.some(e=>e===`image`):null,c=t?.session.model.state===`known`?t.session.model.value:null,l=c?c.inputCapabilities.some(e=>e===`image`):null,u=n?.imageInput??l??s,d=(n?.provider??r??null)===`openai-codex`,f=[{key:`search`,icon:(0,X.jsx)(S_,{color:`primary`}),title:a?.route===`codex-first`?`Codex Web Search`:D(i,`Tìm kiếm web`,`Web search`),detail:a?.route===`codex-first`?D(i,`Dùng đăng nhập Codex của Pi; tự chuyển sang Exa khi Codex Search không khả dụng.`,`Uses Pi's Codex sign-in and falls back to Exa when Codex Search is unavailable.`):a?.state===`configured`?D(i,`Route tự động đang hoạt động; kết nối Codex để ưu tiên native Web Search.`,`Automatic routing is configured; connect Codex to prefer native Web Search.`):D(i,`Chưa tìm thấy tích hợp web search trong Pi runtime.`,`The Pi runtime web-search integration was not found.`),status:a?.route===`codex-first`?D(i,`Ưu tiên Codex`,`Codex first`):a?.state===`configured`?D(i,`Đã cấu hình`,`Configured`):D(i,`Chưa có`,`Unavailable`),ready:a?.state===`configured`},{key:`vision`,icon:(0,X.jsx)(by,{color:`primary`}),title:d?`Codex Vision`:D(i,`Vision của model`,`Model vision`),detail:u===!0?D(i,`Ảnh đính kèm được gửi trực tiếp cho model của session hiện tại.`,`Image attachments are sent directly to the current session model.`):u===!1?D(i,`Model hiện tại chỉ nhận text; hãy chọn model hỗ trợ image input.`,`The current model is text-only; select a model that supports image input.`):D(i,`Runtime chưa công bố image-input capability của model hiện tại.`,`The runtime has not reported the current model's image-input capability.`),status:u===!0?D(i,`Đang dùng`,`Active`):u===!1?D(i,`Không hỗ trợ`,`Unsupported`):D(i,`Chưa rõ`,`Unknown`),ready:u===!0}];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{variant:`h2`,sx:{mt:3,mb:.5},children:D(i,`Tìm kiếm & hình ảnh`,`Search & vision`)}),(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,sx:{mb:1.25},children:D(i,`Capability thực tế của Pi runtime và model đang chọn.`,`Capabilities reported by the Pi runtime and selected model.`)}),(0,X.jsx)(Z,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,md:`repeat(2,minmax(0,1fr))`},gap:1},children:f.map(e=>(0,X.jsx)(ht,{variant:`outlined`,sx:{p:1.75,borderRadius:1},children:(0,X.jsxs)(Q,{direction:`row`,spacing:1.25,sx:{alignItems:`flex-start`},children:[(0,X.jsx)(Z,{sx:{width:36,height:36,display:`grid`,placeItems:`center`,borderRadius:1,bgcolor:`action.selected`,flex:`0 0 auto`},children:e.icon}),(0,X.jsxs)(Z,{sx:{flex:1,minWidth:0},children:[(0,X.jsx)(q,{sx:{fontWeight:800},children:e.title}),(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:e.detail})]}),(0,X.jsx)(rr,{size:`small`,color:e.ready?`success`:`default`,variant:`outlined`,label:e.status})]})},e.key))})]})}function tb({options:e,auth:t,refreshAuth:n,session:r,snapshot:i,onSetModel:a,onSetThinking:o}){let{locale:s}=C(),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(null),f=i?.session.model.state===`known`?i.session.model.value:null,p=(0,Y.useMemo)(()=>{let t=new Map;for(let n of e?.models??[])t.set(n.provider,[...t.get(n.provider)??[],n]);return[...t.entries()]},[e]),m=f?.modelRef??``,h=e?.models.find(e=>e.modelRef===m),g=h?m:``,_=f?.displayName??r?.modelLabel??`—`,v=r?.managedThinkingLevels??h?.thinkingLevels??[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`],y=async e=>{if(e){l(!0),d(null);try{await e()}catch{d(D(s,`Chưa thể áp dụng thay đổi`,`Could not apply this change`))}finally{l(!1)}}};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Zy,{children:D(s,`Nhà cung cấp & model`,`Providers & models`)}),r&&(0,X.jsxs)(ht,{variant:`outlined`,sx:{p:2.25,borderRadius:1,mb:2},children:[(0,X.jsxs)(Q,{direction:`row`,spacing:1.25,sx:{alignItems:`center`,mb:2},children:[(0,X.jsx)(Ip,{name:f?.provider??r.modelLabel??`model`,size:38}),(0,X.jsxs)(Z,{sx:{flex:1,minWidth:0},children:[(0,X.jsx)(q,{sx:{fontWeight:700},children:D(s,`Model của session hiện tại`,`Current session model`)}),(0,X.jsxs)(q,{variant:`body2`,color:`text.secondary`,noWrap:!0,children:[_,` · `,$(r.thinkingLevel,s)]})]}),(0,X.jsx)(rr,{size:`small`,variant:`outlined`,label:D(s,`Đang dùng`,`In use`)})]}),(0,X.jsxs)(Q,{direction:{xs:`column`,md:`row`},spacing:1.5,children:[(0,X.jsxs)(Z,{sx:{flex:1},children:[(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,children:`Model`}),(0,X.jsx)(z,{fullWidth:!0,size:`small`,value:g,displayEmpty:!0,renderValue:t=>t?e?.models.find(e=>e.modelRef===t)?.displayName??_:_,disabled:c||!a||r.liveState===`running`,onChange:e=>void y(()=>a?.(e.target.value)??Promise.resolve()),sx:{mt:.5},children:(e?.models??[]).map(e=>(0,X.jsx)(dp,{value:e.modelRef,children:e.displayName},e.modelRef))})]}),(0,X.jsxs)(Z,{sx:{width:{md:220}},children:[(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,children:`Thinking`}),(0,X.jsx)(z,{fullWidth:!0,size:`small`,value:r.thinkingLevel===`unknown`?`off`:r.thinkingLevel,disabled:c||!o||r.liveState===`running`,onChange:e=>void y(()=>o?.(e.target.value)??Promise.resolve()),sx:{mt:.5},children:v.map(e=>(0,X.jsx)(dp,{value:e,children:$(e,s)},e))})]})]}),u&&(0,X.jsx)(q,{role:`status`,color:`error`,variant:`caption`,sx:{mt:1},children:u})]}),(0,X.jsx)(eb,{options:e,snapshot:i,activeModel:h,observedProvider:f?.provider}),(0,X.jsx)(q,{variant:`h2`,sx:{mt:3,mb:.5},children:D(s,`Kết nối nhà cung cấp`,`Provider connections`)}),(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,sx:{mb:1.25},children:D(s,`Kết nối tài khoản để mở khóa model tương ứng.`,`Connect an account to make its models available.`)}),(0,X.jsx)(Sy,{catalog:t,refresh:n}),(0,X.jsx)(q,{variant:`h2`,sx:{mt:3,mb:.5},children:D(s,`Danh mục model`,`Model catalog`)}),(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,sx:{mb:1.25},children:D(s,`Các model hiện có từ những provider đã xác thực.`,`Models currently available from authenticated providers.`)}),(0,X.jsx)(Z,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,lg:`repeat(2,minmax(0,1fr))`},gap:1},children:p.map(([e,t])=>(0,X.jsxs)(ht,{variant:`outlined`,sx:{p:1.5,borderRadius:1},children:[(0,X.jsxs)(Q,{direction:`row`,sx:{alignItems:`center`,gap:1},children:[(0,X.jsx)(Ip,{name:e,size:32}),(0,X.jsxs)(Z,{sx:{flex:1,minWidth:0},children:[(0,X.jsx)(q,{noWrap:!0,sx:{fontWeight:700,textTransform:`capitalize`},children:e}),(0,X.jsxs)(q,{variant:`body2`,color:`text.secondary`,children:[t.length,` model`]})]}),(0,X.jsx)(rr,{size:`small`,color:`success`,variant:`outlined`,label:D(s,`Sẵn sàng`,`Ready`)})]}),(0,X.jsxs)(Z,{sx:{display:`flex`,gap:.6,mt:1.25,flexWrap:`wrap`},children:[t.slice(0,6).map(e=>(0,X.jsx)(rr,{size:`small`,variant:`outlined`,label:e.displayName},e.modelRef)),t.length>6&&(0,X.jsx)(rr,{size:`small`,variant:`outlined`,label:`+${t.length-6}`})]})]},e))}),e&&p.length===0&&(0,X.jsx)(q,{color:`text.secondary`,children:D(s,`Chưa có model đã xác thực`,`No authenticated models`)})]})}function nb({value:e,loading:t,sessionRef:n,onChanged:r}){let{locale:i}=C();return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Zy,{children:D(i,`MCP & kết nối`,`MCP & connections`)}),t?(0,X.jsx)(Ve,{size:22}):(0,X.jsxs)(Q,{spacing:1,children:[(e?.connections??[]).map(e=>(0,X.jsx)(ht,{variant:`outlined`,sx:{p:1.75,borderRadius:1},children:(0,X.jsxs)(Q,{direction:`row`,sx:{alignItems:`center`,gap:1.25},children:[(0,X.jsx)(Ip,{name:e.name,size:38}),(0,X.jsxs)(Z,{sx:{flex:1,minWidth:0},children:[(0,X.jsx)(q,{noWrap:!0,sx:{fontWeight:800},children:e.name}),(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,children:nm(e,i)})]}),n?(0,X.jsx)(im,{sessionRef:n,connection:e,onChanged:r}):(0,X.jsx)(rr,{size:`small`,variant:`outlined`,label:D(i,`Đã cấu hình`,`Configured`)})]})},e.connectionRef)),!e?.connections.length&&(0,X.jsx)(q,{color:`text.secondary`,children:D(i,`Chưa có MCP trong project này`,`No MCP configured for this project`)})]})]})}function rb({snapshot:e,session:t,onSetPermission:n}){let{locale:r}=C(),i=e?.session.permissionProfile,[a,o]=(0,Y.useState)(i?.state===`known`?i.value??null:null),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{o(t?.managedPermission??(i?.state===`known`?i.value??null:null))},[t?.sessionRef,t?.managedPermission,i?.state,i?.value]);let p=async e=>{if(n){c(!0),u(null);try{await n(e),o(e)}catch{u(D(r,`Chưa thể đổi quyền lúc này`,`Could not change access right now`))}finally{c(!1)}}},m=e=>{if(e===`trusted-full-access`||e===`bypass`){f(e);return}p(e)},h=[{mode:`read-only`,detail:D(r,`Chỉ xem session, task và source; không thay đổi project.`,`Inspect the session, task, and source without changing the project.`)},{mode:`workspace-write`,detail:D(r,`Đọc, sửa file và chạy command trong project; thao tác nhạy cảm vẫn cần xác nhận.`,`Read and edit project files and run commands; sensitive actions still require confirmation.`)},{mode:`trusted-full-access`,detail:D(r,`Quyền rộng hơn trong runtime; xóa hoặc gửi dữ liệu ra ngoài vẫn cần xác nhận riêng.`,`Broader runtime access; deleting or sending data externally still requires separate confirmation.`)},...!t?.managed||t.managedBypass?[{mode:`bypass`,detail:vm(r)}]:[]];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Zy,{children:D(r,`Quyền truy cập`,`Access`)}),(0,X.jsx)(q,{variant:`h2`,sx:{mb:.5},children:D(r,`Hồ sơ quyền`,`Permission profile`)}),(0,X.jsx)(q,{variant:`body2`,color:`text.secondary`,sx:{mb:1.5},children:D(r,`Áp dụng cho session hiện tại.`,`Applies to the current session.`)}),(0,X.jsx)(ht,{variant:`outlined`,sx:{borderRadius:1,overflow:`hidden`},children:h.map((e,i)=>(0,X.jsxs)(Z,{children:[(0,X.jsx)(Qy,{icon:(0,X.jsx)(Em,{color:e.mode===`bypass`?`error`:e.mode===`trusted-full-access`?`warning`:`primary`}),title:$(e.mode,r),detail:e.detail,action:(0,X.jsx)(J,{size:`small`,variant:a===e.mode?`contained`:`outlined`,color:e.mode===`bypass`?`error`:e.mode===`trusted-full-access`?`warning`:`primary`,"aria-pressed":a===e.mode,disabled:s||!t||!n||t.liveState===`running`,onClick:()=>m(e.mode),children:$(e.mode,r)})}),i<h.length-1&&(0,X.jsx)(lr,{})]},e.mode))}),l&&(0,X.jsx)(q,{role:`status`,color:`error`,variant:`caption`,sx:{mt:1},children:l}),(0,X.jsx)(um,{open:d!==null,title:d===`bypass`?D(r,`Bật Bypass?`,`Turn on Bypass?`):D(r,`Bật toàn quyền?`,`Enable full access?`),description:d===`bypass`?vm(r):D(r,`Session này sẽ được phép đọc, sửa file và chạy command trong phạm vi runtime. Các thao tác xóa hoặc gửi dữ liệu ra ngoài vẫn cần xác nhận riêng.`,`This session will be allowed to read and edit files and run commands within the runtime. Destructive actions and external data transfers still require separate confirmation.`),cancelLabel:D(r,`Hủy`,`Cancel`),confirmLabel:d===`bypass`?D(r,`Bật Bypass`,`Turn on Bypass`):D(r,`Bật toàn quyền`,`Enable full access`),onCancel:()=>f(null),onConfirm:()=>{let e=d;f(null),e&&p(e)}})]})}function ib({session:e,snapshot:t}){let{locale:n}=C(),r=t?.usage.context??(e?{state:e.contextUsage.state,tokens:e.contextUsage.usedTokens,contextWindow:e.contextUsage.contextWindow,percent:e.contextUsage.ratio===null?null:e.contextUsage.ratio*100}:void 0),i=[[D(n,`Context`,`Context`),r?.percent==null?`—`:`${Math.round(r.percent)}%`],[`Tokens`,`${Xy(r?.tokens,n)} / ${Xy(r?.contextWindow,n)}`],[D(n,`Input`,`Input`),Xy(t?.usage.sessionTotal.input,n)],[D(n,`Output`,`Output`),Xy(t?.usage.sessionTotal.output,n)],[D(n,`Continuation`,`Continuation`),Xy(t?.continuation.remaining,n)],[`Verifier`,t?.verification.state??`—`]];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Zy,{children:D(n,`Usage & context`,`Usage & context`)}),(0,X.jsx)(Z,{sx:{display:`grid`,gridTemplateColumns:{xs:`1fr`,sm:`repeat(2,minmax(0,1fr))`,lg:`repeat(3,minmax(0,1fr))`},gap:1},children:i.map(([e,t])=>(0,X.jsxs)(ht,{variant:`outlined`,sx:{p:2,borderRadius:1},children:[(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,children:e}),(0,X.jsx)(q,{sx:{mt:.6,fontSize:`1.25rem`,fontWeight:800},children:t})]},e))})]})}function ab({capabilities:e,connection:t}){let{locale:n}=C(),r=[[`Gateway`,t],[`Mode`,e?.mode??`unknown`],[`Protocol`,e?.protocol.selected??`—`],[D(n,`Runtime`,`Runtime`),e?.capabilities.sessionRuntime.status??`unknown`]];return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Zy,{children:`Piagent`}),(0,X.jsx)(ht,{variant:`outlined`,sx:{borderRadius:1,overflow:`hidden`},children:r.map(([e,t],n)=>(0,X.jsxs)(Z,{children:[(0,X.jsxs)(Q,{direction:`row`,sx:{px:2.25,py:1.6,justifyContent:`space-between`,gap:2},children:[(0,X.jsx)(q,{color:`text.secondary`,children:e}),(0,X.jsx)(q,{sx:{fontWeight:760},children:String(t)})]}),n<r.length-1&&(0,X.jsx)(lr,{})]},String(e)))})]})}function ob({section:e,onSection:t,onBack:n,session:r,snapshot:i,capabilities:a,connection:o,onSetModel:s,onSetThinking:c,onSetPermission:l,onRuntimeChanged:u}){let{locale:d}=C(),[f,p]=(0,Y.useState)(),[m,h]=(0,Y.useState)(),[g,_]=(0,Y.useState)(),[v,y]=(0,Y.useState)(!1);return(0,Y.useEffect)(()=>{let e=new AbortController;return gs(e.signal).then(p).catch(()=>void 0),()=>e.abort()},[]),(0,Y.useEffect)(()=>{let e=new AbortController;return _s(e.signal).then(h).catch(()=>void 0),()=>e.abort()},[]),(0,Y.useEffect)(()=>{if(!r){_(void 0);return}let e=new AbortController;return y(!0),_(void 0),Rs(r.sessionRef,e.signal).then(_).catch(()=>void 0).finally(()=>{e.signal.aborted||y(!1)}),()=>e.abort()},[r?.sessionRef]),(0,X.jsxs)(Z,{sx:{height:`100%`,minHeight:0,display:{sm:`grid`},gridTemplateColumns:{sm:`236px minmax(0,1fr)`},bgcolor:`background.default`},children:[(0,X.jsx)(Jy,{section:e,onSection:t,onBack:n}),(0,X.jsxs)(Z,{component:`main`,sx:{width:`100%`,minHeight:0,overflowY:`auto`,px:{xs:2,sm:3,lg:5},py:{xs:3,md:4}},children:[e===`general`&&(0,X.jsx)($y,{}),e===`updates`&&(0,X.jsx)(Fh,{}),e===`shortcuts`&&(0,X.jsx)(Yy,{}),e===`models`&&(0,X.jsx)(tb,{options:f,auth:m,refreshAuth:async()=>{let[e,t]=await Promise.all([_s(),gs()]);h(e),p(t)},session:r,snapshot:i,onSetModel:s,onSetThinking:c}),e===`connections`&&(0,X.jsx)(nb,{value:g,loading:v,sessionRef:r?.sessionRef,onChanged:async e=>{if(e){_(e);return}r&&_(await Rs(r.sessionRef).catch(()=>g))}}),e===`controls`&&(0,X.jsx)(ky,{session:r,options:f,connections:g,onCompleted:u}),e===`permissions`&&(0,X.jsx)(rb,{snapshot:i,session:r,onSetPermission:l}),e===`usage`&&(0,X.jsx)(ib,{session:r,snapshot:i}),e===`about`&&(0,X.jsx)(ab,{capabilities:a,connection:o})]})]})}function sb(e){let{locale:t,actions:n}=e,r=D(t,`Lệnh`,`Commands`),i=Hy(),a=[];e.canCreate&&a.push({id:`new-chat`,group:r,label:D(t,`Cuộc trò chuyện mới`,`New chat`),hint:`${i} ⇧ O`,keywords:`new create tạo`,run:n.newChat}),e.update.available&&e.update.latest&&a.push({id:`update-now`,group:r,label:D(t,`Cập nhật Piagent ${e.update.latest}`,`Update Piagent ${e.update.latest}`),keywords:`update upgrade nâng cấp phiên bản version`,run:()=>n.settings(`updates`)}),a.push({id:`check-updates`,group:r,label:D(t,`Kiểm tra cập nhật`,`Check for updates`),keywords:`update version phiên bản pi piagent`,run:n.checkUpdates}),e.hasSelection&&a.push({id:`toggle-panel`,group:r,label:D(t,`Bật/tắt khung Workspace`,`Toggle the Workspace panel`),keywords:`panel sidebar changes plan context`,run:n.togglePanel},{id:`open-changes`,group:r,label:D(t,`Mở Source Changes`,`Open Source Changes`),keywords:`diff review thay đổi git`,run:n.openChanges}),a.push({id:`theme`,group:r,label:e.colorMode===`dark`?D(t,`Chuyển sang chủ đề sáng`,`Switch to the light theme`):D(t,`Chuyển sang chủ đề tối`,`Switch to the dark theme`),keywords:`theme chủ đề dark light sáng tối`,run:()=>n.setColorMode(e.colorMode===`dark`?`light`:`dark`)},{id:`language`,group:r,label:t===`vi`?`Switch the interface to English`:`Chuyển giao diện sang tiếng Việt`,keywords:`language ngôn ngữ english tiếng việt`,run:()=>n.setLocale(t===`vi`?`en`:`vi`)},{id:`refresh`,group:r,label:D(t,`Làm mới`,`Refresh`),keywords:`reload tải lại`,run:n.refresh});let o=n.setTheme,s=D(t,`Chủ đề màu`,`Color theme`);if(o)for(let t of O)a.push({id:`theme-${t.id}`,group:s,label:`${s}: ${t.label}`,hint:t.id===e.themeId?`✓`:void 0,keywords:`theme chủ đề màu color ${t.mode}`,run:()=>o(t.id)});let c=D(t,`Cài đặt`,`Settings`);for(let e of Ky(t))a.push({id:`settings-${e.id}`,group:c,label:`${c}: ${e.label}`,hint:e.id===`general`?`${i} ,`:void 0,keywords:e.keywords,run:()=>n.settings(e.id)});let l=D(t,`Cuộc trò chuyện`,`Conversations`);for(let t of e.sessions)a.push({id:`session-${t.sessionRef}`,group:l,label:t.title,hint:t.projectLabel,keywords:t.projectLabel,run:()=>n.openSession(t.sessionRef)});return a}var cb=class{#e=0;run(e,t,n){let r=++this.#e;return(async()=>{try{let n=await e();return r===this.#e&&t(n),n}catch{r===this.#e&&n();return}})()}invalidate(){this.#e+=1}},lb=class{#e;#t;#n;#r=0;#i=0;#a=!1;#o=!1;#s=[];constructor(e){this.#e=e.read,this.#t=e.commit,this.#n=e.classify}request(){if(this.#o)return Promise.resolve({state:`cancelled`,readSequence:this.#i});let e=++this.#r,t=new Promise(t=>this.#s.push({ticket:e,resolve:t}));return this.#c(),t}invalidate(){if(this.#o)return;this.#o=!0;let e={state:`cancelled`,readSequence:this.#i},t=this.#s;this.#s=[];for(let n of t)n.resolve(e)}async#c(){if(!(this.#a||this.#o)){this.#a=!0;try{for(;!this.#o&&this.#s.length>0;){let e=this.#r,t=++this.#i,n;try{let e=await this.#e();if(this.#o)return;try{this.#t(e),n={state:`committed`,value:e,readSequence:t}}catch(e){n={state:`terminal-error`,error:e,readSequence:t}}}catch(e){if(this.#o)return;n={state:this.#n(e)===`retryable`?`retryable-error`:`terminal-error`,error:e,readSequence:t}}let r=this.#s.filter(t=>t.ticket<=e);this.#s=this.#s.filter(t=>t.ticket>e);for(let e of r)e.resolve(n);if(n.state===`terminal-error`){this.#o=!0;let e={state:`cancelled`,readSequence:t},n=this.#s;this.#s=[];for(let t of n)t.resolve(e)}}}finally{this.#a=!1,!this.#o&&this.#s.length>0&&this.#c()}}}},ub=`piagent-gateway-event-cursor-v1`,db=3e4,fb=12e4,pb=4001,mb=class extends Error{reasonCode;constructor(e){super(e),this.name=`SessionSendRejectedError`,this.reasonCode=e}};function hb(e,t){if(!e)return null;try{let n=JSON.parse(e);return n.gatewayInstanceRef===t&&Number.isSafeInteger(n.sequence)&&Number(n.sequence)>=0?Number(n.sequence):null}catch{return null}}function gb(e,t){if(t!==null)try{window.sessionStorage.setItem(ub,JSON.stringify({gatewayInstanceRef:e,sequence:t}))}catch{}}function _b(e){return`${e}_${crypto.randomUUID().replaceAll(`-`,``)}`}function vb(e){return e.phase===`rejected`&&e.resultCode===`stale-revision`&&e.error?.code===`session-revision-stale`}var yb=280,bb=320,xb=`min(44vw, 860px)`,Sb=`piagent-webui-workspace-panel`;function Cb({session:e,live:t,locale:n}){let r=Mv(e,t),[i,a]=r===`running`?[D(n,`Đang chạy`,`Running`),`primary`]:r===`elsewhere`?[D(n,`Đang chạy ở nơi khác`,`Running elsewhere`),`info`]:r===`attention`?rg(e,t)===`question`?[D(n,`Cần bạn trả lời`,`Needs your answer`),`warning`]:[D(n,`Cần duyệt`,`Needs approval`),`warning`]:r===`recovery`?[D(n,`Cần khôi phục`,`Recovery needed`),`error`]:r===`failed`?[D(n,`Lượt cuối lỗi`,`Last turn failed`),`error`]:[D(n,`Sẵn sàng`,`Ready`),`default`];return(0,X.jsx)(rr,{size:`small`,variant:`outlined`,color:a,label:i})}function wb({session:e,snapshot:t,locale:n,live:r,canSend:i,canRestart:a,send:o,abort:s,restart:c,onInspector:l,commandActions:u}){let d=e.sessionRef,f=rh(d),[p,m]=(0,Y.useState)(()=>th(d)),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(),y=e=>{m(e),nh(d,e)},b=e.modelLabel===`agent-watch-auto`,x=!!(r&&!r.complete),S=hh({locale:n,company:b,running:x,pinned:e.pinned,bypass:e.managedBypass===!0,fast:e.managedFast===`on`||e.managedFast===`off`?e.managedFast:null,thinkingLevels:e.managedThinkingLevels??(b?[]:[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`,`max`]),loadModels:()=>gs().then(e=>e.models.map(e=>({modelRef:e.modelRef,label:e.displayName}))),actions:{...u,stop:s}}),C=S.map(e=>({kind:`command`,name:e.name,argumentHint:e.argumentHint,origin:`piagent`,scope:`project`,description:e.description})),[w,T]=(0,Y.useState)(null),[E,O]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{let e=e=>{e.isComposing||E||(e.key===`Escape`&&x&&!e.metaKey&&!e.ctrlKey?(e.preventDefault(),s()):e.key===`/`&&(e.metaKey||e.ctrlKey)&&!e.altKey&&!e.shiftKey&&i&&(e.preventDefault(),y(`/`),requestAnimationFrame(()=>{let e=k.inputRef.current;e?.focus(),e?.setSelectionRange(1,1)})))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let k=Hm({projectRef:e.projectRef,value:p,locale:n,builtIns:C,onChange:e=>{y(e),R(null)}});(0,Y.useEffect)(()=>{let e=e=>{e.detail===d&&(m(th(d)),requestAnimationFrame(()=>k.inputRef.current?.focus()))};return window.addEventListener(ah,e),()=>window.removeEventListener(ah,e)},[d]);let[A,j]=(0,Y.useState)(()=>f?.attachments??[]),[M,N]=(0,Y.useState)(!1),[P,F]=(0,Y.useState)(()=>f?.messageRequestId??`message-request.${crypto.randomUUID()}`),[I,ee]=(0,Y.useState)(!1),[te,L]=(0,Y.useState)(null),[ne,R]=(0,Y.useState)(null),[z,re]=(0,Y.useState)(()=>f?.sendUnconfirmed??!1);(0,Y.useEffect)(()=>{ih(d,A.length||z?{attachments:A,messageRequestId:P,sendUnconfirmed:z}:null)},[d,A,P,z]),(0,Y.useEffect)(()=>{if(!z)return;let e=window.setTimeout(()=>{re(!1),R({tone:`error`,text:D(n,`Tin nhắn chưa được gửi: phiên chưa nhận nó trong 2 phút nên nó sẽ không chạy nữa. Nội dung vẫn còn; bấm Gửi để thử lại.`,`The message was not sent: the session did not take it within 2 minutes, so it will not run. Your message is kept; send it again.`)})},fb+15e3);return()=>window.clearTimeout(e)},[z,n]);let[ie,ae]=(0,Y.useState)(!1),[oe,se]=(0,Y.useState)(null),[ce,ue]=(0,Y.useState)(!1),[de,fe]=(0,Y.useState)(0),pe=(0,Y.useRef)(0);(0,Y.useEffect)(()=>{let e=e=>{vd(e.dataTransfer)&&e.preventDefault()};return window.addEventListener(`dragover`,e),window.addEventListener(`drop`,e),()=>{window.removeEventListener(`dragover`,e),window.removeEventListener(`drop`,e)}},[]);let me=t?.capabilities.capabilities.attachments,he=(0,Y.useMemo)(()=>new Set(me?.status===`available`?me.mimeTypes:[]),[me]),ge=(0,Y.useMemo)(()=>_d(he),[he]),_e=!!t&&me?.status===`available`&&i&&!h&&!z&&!I&&A.length<4,ve=async r=>{if(!(!r?.length||!t||me?.status!==`available`||I)){ee(!0),L(null);try{let i=await bd({files:r,snapshot:t,messageRequestId:P,existing:A,allowed:he,locale:n,stage:t=>hc(e.sessionRef,t)});j(i.attachments),L(i.status)}catch{L(D(n,`Không thể đính kèm; file không được gửi vào Pi.`,`Unable to attach the file; it was not sent to Pi.`))}finally{ee(!1)}}},ye=async r=>{if(!(!t||h||I)){ee(!0),L(null);try{let i=await xd({snapshot:t,messageRequestId:P,attachmentRef:r,locale:n,stage:t=>hc(e.sessionRef,t)});i.discarded?j(e=>e.filter(e=>e.attachmentRef!==r)):L(i.status)}catch{L(D(n,`Không thể bỏ file; trạng thái session có thể đã thay đổi.`,`Unable to remove the file; session state may have changed.`))}finally{ee(!1)}}};(0,Y.useEffect)(()=>{let t=new AbortController;return v(void 0),Rs(e.sessionRef,t.signal).then(v).catch(()=>void 0),()=>t.abort()},[e.sessionRef,e.sessionRevision]);let be=(0,Y.useRef)(!1),xe=async()=>{let e=p;if(!e.trim()||h||z||be.current)return;let t=A.length===0?fh(e,S):null;if(t){R(null),T(null);let e=await t.command.run(t.argument);if(`confirm`in e){O(e.confirm),y(``);return}if(!(`send`in e)){T(e),e.tone!==`warning`&&y(``);return}}be.current=!0,g(!0),R(null);let r=A.map(e=>e.attachmentRef);try{if((await o(e,r.length>0?{messageRequestId:P,attachmentRefs:r,attachments:A}:void 0)).state===`unconfirmed`){ih(d,{attachments:A,messageRequestId:P,sendUnconfirmed:!0}),re(!0),R({tone:`warning`,text:D(n,`Piagent đang xác nhận lần gửi này. Nội dung và file vẫn được giữ; đừng gửi lại để tránh chạy trùng.`,`Piagent is confirming this send. Your message and files remain preserved; do not resend, to avoid a duplicate run.`)});return}y(``),j([]),L(null),F(`message-request.${crypto.randomUUID()}`),ih(d,null)}catch{R({tone:`error`,text:D(n,`Tin nhắn chưa được gửi. Nội dung và file vẫn được giữ; có thể thử lại khi session sẵn sàng.`,`The message was not sent. Your message and files are preserved; retry when the session is ready.`)})}finally{be.current=!1,g(!1)}};(0,Y.useEffect)(()=>{!z||r?.messageRequestId!==P||r.delivery!==`admitted`||(y(``),j([]),L(null),R(null),re(!1),F(`message-request.${crypto.randomUUID()}`))},[r?.delivery,r?.messageRequestId,P,z]);let Se=async()=>{if(!(h||z)){g(!0),R(null);try{await o(D(n,`tiếp tục`,`continue`))}catch{R({tone:`error`,text:D(n,`Chưa gửi được. Thử lại khi session sẵn sàng.`,`Not sent. Retry when the session is ready.`)})}finally{g(!1)}}},Ce=async t=>{if(t){v(t);return}v(await Rs(e.sessionRef).catch(()=>_))},we=async()=>{if(!ie){ae(!0),se(null);try{await c()}catch(e){se(e instanceof Error?e.message:null)}finally{ae(!1)}}},B=r?.runtimeRecovery??(e.state===`recovery-required`?`stale`:null);return(0,X.jsxs)(Z,{sx:{minHeight:`calc(100vh - 68px)`,display:`flex`,flexDirection:`column`},children:[(0,X.jsxs)(Z,{sx:{flex:1,width:`100%`,maxWidth:860,mx:`auto`,px:{xs:2,sm:4},py:{xs:3,md:4},display:`flex`,flexDirection:`column`,justifyContent:`center`},children:[!i&&e.modelLabel===`agent-watch-auto`&&(0,X.jsx)(Kf,{locale:n,onConnected:()=>fe(e=>e+1)},e.sessionRef),(0,X.jsx)(Z,{sx:{width:`100%`},children:(0,X.jsx)(Sv,{reload:de,sessionRef:e.sessionRef,sessionRevision:e.sessionRevision,live:r,approvals:t?.approvals,locale:n,onOpenActivity:()=>l(`activity`),onContinue:i&&!h&&!z&&e.liveState!==`running`&&(!r||r.complete)?()=>void Se():void 0},e.sessionRef)})]}),(0,X.jsxs)(Z,{sx:{position:`sticky`,bottom:`var(--piagent-status-bar, 0px)`,px:{xs:1.5,sm:2.5},pb:2.5,background:`linear-gradient(transparent, var(--piagent-palette-background-default) 25%)`},children:[e.state===`terminal-owned`&&(0,X.jsx)(ut,{severity:`info`,role:`status`,sx:{maxWidth:820,mx:`auto`,mb:1},children:D(n,`Cuộc trò chuyện này đang chạy trong Terminal hoặc một tiến trình Piagent khác. Trang này tự cập nhật để bạn theo dõi; gửi tin nhắn khi nó chạy xong.`,`This conversation is running in Terminal or another Piagent process. This page follows it; send a message when it has finished.`)}),B&&(0,X.jsx)(ut,{severity:B===`recovered`?`success`:B===`failed`?`error`:`warning`,action:(B===`failed`||B===`required`||B===`stale`)&&a&&e.liveState!==`running`?(0,X.jsx)(J,{color:`inherit`,size:`small`,disabled:ie,onClick:()=>void we(),children:ie?D(n,`Đang khởi động…`,`Restarting…`):D(n,`Khởi động lại phiên`,`Restart session`)}):void 0,sx:{maxWidth:860,mx:`auto`,mb:1},children:B===`recovered`?D(n,`Runtime mới đã được xác minh; lịch sử và context của session được giữ nguyên.`,`The new runtime is verified; session history and context were preserved.`):B===`failed`?oe?.startsWith(`company-`)&&Lf(oe,null,n)?`${Lf(oe,null,n).title}: ${Lf(oe,null,n).text}`:D(n,`Runtime đã đổi nhưng chưa khởi động lại được. Hãy dùng nút bên cạnh hoặc restart Dashboard.`,`The runtime changed but could not restart. Use the action here or restart the Dashboard.`):B===`stale`&&[`session-runtime-open-failed`,`session-runtime-dispose-failed`].includes(e.reasonCode??``)?D(n,`Runtime của phiên này chưa mở được (thường do key, Harness hoặc Agent Watch lúc đó). Bấm Khởi động lại phiên để thử lại, hoặc lưu trữ phiên; lịch sử được giữ nguyên.`,`This session's runtime did not open (usually the key, the Harness or Agent Watch at the time). Restart the session to try again, or archive it; its history is kept.`):B===`stale`?D(n,`Phiên này chưa được đóng đúng cách và có thể đang mở ở cửa sổ Terminal khác. Đóng cửa sổ đó (nếu có) rồi bấm Khởi động lại phiên để làm tiếp; lịch sử được giữ nguyên.`,`This session was not closed cleanly and may still be open in a Terminal window. Close it (if any), then restart the session to go on; its history is kept.`):B===`restarting`?D(n,`Runtime vừa được cập nhật. Piagent đang khởi động lại session an toàn sau lượt hiện tại.`,`The runtime was updated. Piagent is safely restarting the session after the current turn.`):D(n,`Phát hiện runtime mới. Piagent sẽ giữ câu trả lời hiện tại rồi tự khởi động lại session.`,`A new runtime was detected. Piagent will preserve the current response and restart the session automatically.`)}),(0,X.jsxs)(Z,{sx:{position:`relative`,maxWidth:860,mx:`auto`,border:1,borderColor:ce?`primary.main`:`divider`,borderStyle:ce?`dashed`:`solid`,borderRadius:1,bgcolor:`background.paper`,p:1.15,boxShadow:`0 14px 44px rgba(0,0,0,.14)`},onDragEnter:e=>{vd(e.dataTransfer)&&(pe.current+=1,ue(!0))},onDragOver:e=>{vd(e.dataTransfer)&&(e.preventDefault(),e.dataTransfer.dropEffect=_e?`copy`:`none`)},onDragLeave:e=>{vd(e.dataTransfer)&&(--pe.current,pe.current<=0&&(pe.current=0,ue(!1)))},onDrop:e=>{vd(e.dataTransfer)&&(e.preventDefault(),pe.current=0,ue(!1),_e&&ve(e.dataTransfer.files))},children:[ce&&(0,X.jsxs)(Z,{role:`status`,sx:{position:`absolute`,inset:0,zIndex:3,display:`grid`,alignContent:`center`,justifyItems:`center`,gap:.5,borderRadius:1,bgcolor:`background.paper`,opacity:.96,pointerEvents:`none`,textAlign:`center`},children:[(0,X.jsx)(q,{sx:{fontWeight:750},children:_e?D(n,`Thả tài liệu vào đây`,`Drop documents here`):A.length>=4?D(n,`Đã đủ 4 file cho tin nhắn này`,`This message already holds 4 files`):D(n,`Chưa nhận file lúc này`,`Files cannot be attached right now`)}),_e&&(0,X.jsx)(q,{variant:`caption`,color:`text.secondary`,children:D(n,`.md .txt .csv .json .yaml .docx .pdf và ảnh`,`.md .txt .csv .json .yaml .docx .pdf and images`)})]}),A.length>0&&(0,X.jsx)(Q,{direction:`row`,sx:{flexWrap:`wrap`,gap:.75,px:.5,pb:.75},"aria-label":D(n,`File sẽ gửi cùng tin nhắn`,`Files to send with the message`),children:A.map(e=>(0,X.jsx)(rr,{size:`small`,variant:`outlined`,color:e.kind===`document`?`success`:`default`,label:`${e.displayName} · ${gd(e,n)}`,onDelete:h||z||I?void 0:()=>void ye(e.attachmentRef),deleteIcon:(0,X.jsx)(vf,{"aria-label":`${D(n,`Bỏ`,`Remove`)} ${e.displayName}`,role:`button`})},e.attachmentRef))}),w&&(0,X.jsx)(ut,{severity:w.tone,onClose:()=>T(null),sx:{mb:.75,whiteSpace:`pre-line`},children:w.text}),(0,X.jsx)(le,{fullWidth:!0,multiline:!0,minRows:2,disabled:!i||h||z,value:p,inputRef:k.inputRef,...k.inputProps,onChange:e=>{y(e.target.value),R(null),k.track(e)},onKeyDown:e=>{k.onKeyDown(e)||xm(e)&&(e.preventDefault(),xe())},onPaste:e=>{e.clipboardData?.files.length&&(e.preventDefault(),_e&&ve(e.clipboardData.files))},placeholder:D(n,`Nhắn cho Piagent… (@ để chọn file, folder)`,`Message Piagent… (@ for files and folders)`),variant:`standard`,slotProps:{input:{disableUnderline:!0},htmlInput:k.htmlInput}}),k.menu,(0,X.jsx)(um,{open:E!==null,title:E?.title??``,description:E?.description??``,confirmLabel:E?.confirmLabel??``,cancelLabel:D(n,`Huỷ`,`Cancel`),onCancel:()=>O(null),onConfirm:()=>{let e=E;O(null),e&&e.run().then(T)}}),(0,X.jsx)(kf,{in:M,id:`piagent-message-options`,children:(0,X.jsxs)(Z,{sx:{mt:.65,p:.85,borderRadius:1,bgcolor:`action.hover`},children:[(0,X.jsx)(gm,{session:e,snapshot:t,connections:_,locale:n,onOpenChanges:()=>l(`source`),onConnectionsChanged:Ce}),(0,X.jsx)(Q,{direction:`row`,sx:{minWidth:0,alignItems:`center`,gap:.75,flexWrap:`wrap`},children:me?.status===`available`&&(0,X.jsx)(bo,{title:D(n,`Chọn file, hoặc kéo thả / dán thẳng vào khung chat`,`Pick a file, or drag and drop / paste straight into the chat`),children:(0,X.jsxs)(J,{component:`label`,size:`small`,color:`inherit`,startIcon:(0,X.jsx)(_f,{}),disabled:!_e,"aria-label":`${D(n,`Đính kèm`,`Attach`)} (${A.length}/4)`,children:[D(n,`Đính kèm`,`Attach`),(0,X.jsx)(`input`,{type:`file`,multiple:!0,hidden:!0,disabled:!_e,accept:ge||void 0,onChange:e=>{ve(e.target.files),e.currentTarget.value=``}})]})})})]})}),(0,X.jsxs)(Q,{direction:`row`,sx:{justifyContent:`space-between`,alignItems:`center`,mt:.5,gap:1},children:[(0,X.jsxs)(Q,{direction:`row`,sx:{minWidth:0,alignItems:`center`,gap:1},children:[(0,X.jsx)(bo,{title:M?D(n,`Ẩn tùy chọn`,`Hide options`):D(n,`File và công cụ`,`Files and tools`),children:(0,X.jsx)(et,{size:`small`,"aria-label":M?D(n,`Ẩn tùy chọn`,`Hide options`):D(n,`Thêm tùy chọn`,`More options`),"aria-expanded":M,"aria-controls":`piagent-message-options`,onClick:()=>N(e=>!e),sx:{bgcolor:M?`action.selected`:`transparent`},children:(0,X.jsx)(gf,{fontSize:`small`,sx:{transition:`transform .16s ease`,transform:M?`rotate(45deg)`:`none`}})})}),(0,X.jsx)(q,{variant:`caption`,color:te||ne?.tone===`error`?`error`:ne?`warning.main`:`text.disabled`,noWrap:!ne,sx:{display:{xs:te||ne||I?`block`:`none`,sm:`block`}},children:ne?.text??te??(I?D(n,`Đang đọc tài liệu…`,`Reading documents…`):r&&!r.complete?D(n,`Piagent đang xử lý; có thể gửi việc tiếp theo khi lượt này xong.`,`Piagent is working; you can send the next task when it finishes.`):i?D(n,`Enter để gửi · Shift+Enter xuống dòng`,`Enter to send · Shift+Enter for a new line`):D(n,`Session hiện chỉ đọc`,`Session is currently read only`))})]}),r?.operationRef&&!r.complete&&r.abortable!==!1?(0,X.jsx)(J,{color:`error`,startIcon:(0,X.jsx)(Sf,{}),onClick:()=>void s(),children:D(n,`Dừng`,`Stop`)}):(0,X.jsx)(et,{"aria-label":D(n,`Gửi`,`Send`),disabled:!i||h||z||!p.trim(),color:`primary`,onClick:()=>void xe(),sx:{bgcolor:`primary.main`,color:`primary.contrastText`,"&:hover":{bgcolor:`primary.dark`},"&.Mui-disabled":{bgcolor:`action.disabledBackground`}},children:(0,X.jsx)(bf,{fontSize:`small`})})]})]})]})]})}function Tb({locale:e,canCreate:t,onNew:n}){return(0,X.jsxs)(Q,{sx:{minHeight:`calc(100vh - 68px)`,alignItems:`center`,justifyContent:`center`,px:3,textAlign:`center`},spacing:1.5,children:[(0,X.jsx)(Z,{className:`brand-mark`,"aria-hidden":`true`,sx:{width:50,height:50,fontSize:25},children:`π`}),(0,X.jsx)(q,{variant:`h1`,children:D(e,`Bắt đầu với Piagent`,`Start with Piagent`)}),(0,X.jsx)(q,{color:`text.secondary`,sx:{maxWidth:520},children:D(e,`Tạo cuộc trò chuyện mới, chọn project và model; session sẽ được lưu để tiếp tục sau khi đóng Gateway.`,`Create a new chat, choose a project and model, and the session will remain available after the Gateway closes.`)}),(0,X.jsx)(J,{disabled:!t,variant:`contained`,startIcon:(0,X.jsx)(gf,{}),onClick:n,children:D(e,`Cuộc trò chuyện mới`,`New chat`)})]})}function Eb({catalog:e,capabilities:t,connection:n,live:r,terminalActivities:i,refresh:a,create:o,send:s,abort:c,restart:l,setModel:u,setThinking:d,setPermission:f,setFast:p,rename:m,pin:h,archive:g,unarchive:_,fork:v}){let{locale:b,colorMode:x,themeId:S,setLocale:w,setColorMode:T,setThemeId:E}=C(),O=_h(),k=Oh(),[A,j]=(0,Y.useState)(!1),[M,N]=(0,Y.useState)(`sessions`),P=af(y().breakpoints.up(`lg`)),[F,I]=(0,Y.useState)(null),[ee,te]=(0,Y.useState)(``),[L,ne]=(0,Y.useState)(),[R,z]=(0,Y.useState)(!1),[re,ie]=(0,Y.useState)(!1),[ae,oe]=(0,Y.useState)(`chat`),[se,ce]=(0,Y.useState)(!1),[ue,de]=(0,Y.useState)(`general`),[fe,pe]=(0,Y.useState)(!1),[me,he]=(0,Y.useState)(`task`),_e=!P,[ve,ye]=(0,Y.useState)(()=>{try{let e=window.localStorage.getItem(Sb);if(e)return e===`open`}catch{}return window.innerWidth>=1200}),[be,xe]=(0,Y.useState)(!1),Se=()=>_e?xe(e=>!e):ye(e=>{try{window.localStorage.setItem(Sb,e?`closed`:`open`)}catch{}return!e}),Ce=(0,Y.useRef)(!1);Ce.current=fe&&me===`activity`;let[we,B]=(0,Y.useState)(),Te=(0,Y.useRef)(null),[Ee,De]=(0,Y.useState)(`idle`),Oe=(0,Y.useRef)(null),ke=(0,Y.useRef)(null);ke.current??=new cb;let[Ae,je]=(0,Y.useState)(!1),[Me,V]=(0,Y.useState)(null),[H,Ne]=(0,Y.useState)(null),[Pe,Fe]=(0,Y.useState)(``),[Ie,Le]=(0,Y.useState)(!1),[Re,ze]=(0,Y.useState)(null),[Be,He]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{ae===`chat`&&L||(window.scrollTo(0,0),document.documentElement.scrollTop=0,document.body.scrollTop=0)},[ae,L]);let Ue=(0,Y.useMemo)(()=>(e?.sessions??[]).filter(e=>e.archived===re&&`${e.title} ${e.projectLabel} ${e.preview}`.toLowerCase().includes(ee.trim().toLowerCase())),[e,ee,re]),We=(0,Y.useMemo)(()=>{let e=new Map;for(let t of Ue){let n=e.get(t.projectRef)??{label:t.projectLabel,gitBranch:t.gitBranch,sessions:[]};n.gitBranch??=t.gitBranch,n.gitRepositories??=t.gitRepositories,n.sessions.push(t),e.set(t.projectRef,n)}return[...e.entries()].map(([e,t])=>({projectRef:e,...t,sessions:t.sessions.sort((e,t)=>Number(t.pinned)-Number(e.pinned)||Date.parse(t.updatedAt)-Date.parse(e.updatedAt))})).sort((e,t)=>Date.parse(t.sessions[0]?.updatedAt??``)-Date.parse(e.sessions[0]?.updatedAt??``))},[Ue]),Ge=e?.sessions.filter(e=>e.archived).length??0;(0,Y.useEffect)(()=>{(!L||!(e?.sessions??[]).some(e=>e.sessionRef===L))&&ne((e?.sessions??[]).find(e=>!e.archived)?.sessionRef)},[L,e]);let U=(e?.sessions??[]).find(e=>e.sessionRef===L),Ke=U?.sessionRef,W=U?.state===`terminal-owned`,qe=(e?.sessions??[]).some(e=>e.state===`terminal-owned`);(0,Y.useEffect)(()=>{let e=W?3e3:qe?1e4:3e4,t=window.setInterval(()=>{document.visibilityState===`visible`&&a()},e);return()=>window.clearInterval(t)},[W,qe,a]);let G=(0,Y.useRef)(Ke);G.current=Ke;let Je=Te.current&&Te.current.sessionRef===Ke&&Te.current.snapshot===we?we:void 0,Ye=Oe.current===Ke?Ee:Ke?`loading`:`idle`,Xe=U?r[U.sessionRef]:void 0,[Ze,Qe]=(0,Y.useState)(null),$e=(0,Y.useRef)(!1);(0,Y.useEffect)(()=>{if(!e||$e.current)return;$e.current=!0;let t=gt();t&&(Qe(t),oe(`new`))},[e]);let tt=e=>{Qe(null),ne(e),oe(`chat`),z(!1)},nt=qv({sessions:(0,Y.useMemo)(()=>e?.sessions??[],[e]),live:r,selectedRef:ae===`chat`?Ke:void 0,onOpen:tt,locale:b}),rt=e=>{de(e),ce(!0)};Ly({palette:()=>j(!0),settings:()=>rt(`general`),newChat:()=>{K&&(V(null),oe(`new`))}});let it=e=>{he(e),pe(!0)},at=async()=>{let e=G.current;if(!e)return;Te.current?.sessionRef!==e&&(Oe.current=e,De(`loading`));let t=await ke.current.run(()=>Os(e),t=>{G.current===e&&(Te.current={sessionRef:e,snapshot:t},Oe.current=e,B(t),De(`ready`))},()=>{G.current===e&&(Oe.current=e,De(Te.current?.sessionRef===e?`ready`:`error`))});return G.current===e?t:void 0};(0,Y.useEffect)(()=>{if(!Ke){ke.current.invalidate(),Te.current=null,Oe.current=null,B(void 0),De(`idle`);return}let e=Ke,t=new AbortController;return Oe.current=e,Te.current?.sessionRef!==e&&(Te.current=null,B(void 0),De(`loading`)),ke.current.run(()=>Os(e,t.signal),n=>{t.signal.aborted||G.current!==e||(Te.current={sessionRef:e,snapshot:n},Oe.current=e,B(n),De(`ready`))},()=>{t.signal.aborted||G.current!==e||(Oe.current=e,De(Te.current?.sessionRef===e?`ready`:`error`))}),()=>t.abort()},[Ke,U?.sessionRevision]),(0,Y.useEffect)(()=>{if(!fe||me!==`activity`||!Ke||!Je||!Xe?.operationRef||Xe.complete)return;let e=Ke,t=!1,n,r=async()=>{await ke.current.run(()=>Os(e),n=>{t||!Ce.current||G.current!==e||(Te.current={sessionRef:e,snapshot:n},Oe.current=e,B(n),De(`ready`))},()=>void 0),t||(n=window.setTimeout(()=>void r(),2e3))};return n=window.setTimeout(()=>void r(),2e3),()=>{t=!0,n!==void 0&&window.clearTimeout(n)}},[fe,me,Ke,!!Je,Xe?.operationRef,Xe?.complete]);let K=n===`connected`&&t?.capabilities.sessionActions.create.status===`available`,ot=async e=>{je(!0),V(null);let t=null;try{let n=`message-request.${crypto.randomUUID()}`,r=e.files.length>0,i=await o({projectRef:e.projectRef,placeRef:e.placeRef,modelRef:e.modelRef,thinkingLevel:e.thinkingLevel,workflow:e.workflow,permissionMode:e.permissionMode,fast:e.fast,message:e.message,messageRequestId:n,deferInitialMessage:r});if(t=i.sessionRef,!t)throw Error(`session-create-result-invalid`);if(nh(Um,``),ih(Um,null),i.phase!==`settled`){ne(t),oe(`chat`),He({title:D(b,`Session đã được tạo`,`The session was created`),message:D(b,`Pi đã nhận yêu cầu và session đang tự đồng bộ. Không gửi lại để tránh chạy trùng.`,`Pi received the request and the session is resyncing. Do not resend it, to avoid a duplicate run.`)});return}if(r){let r=(await a())?.sessions.find(e=>e.sessionRef===t);if(!r)throw Error(`session-catalog-refresh-failed`);let i=await Os(t),o=i.capabilities.capabilities.attachments;if(o.status!==`available`)throw Error(o.reason?.code??`session-attachment-unavailable`);let c=await bd({files:e.files,snapshot:i,messageRequestId:n,existing:[],allowed:new Set(o.mimeTypes),locale:b,stage:e=>hc(t,e)});if(c.status||c.attachments.length!==e.files.length)throw await Promise.all(c.attachments.map(async e=>{try{await xd({snapshot:i,messageRequestId:n,attachmentRef:e.attachmentRef,locale:b,stage:e=>hc(t,e)})}catch{}})),Error(c.status??`session-attachment-incomplete`);await s(r,e.message,{messageRequestId:n,attachmentRefs:c.attachments.map(e=>e.attachmentRef),attachments:c.attachments,workflow:e.workflow})}ne(t),oe(`chat`)}catch(n){let r=n instanceof Error?n.message:`session-create-failed`;t?(e.files.length>0&&nh(t,e.message),ne(t),oe(`chat`),He({title:D(b,`Session đã tạo nhưng file chưa được gửi`,`The session was created, but the files were not sent`),message:r})):V(Uf(r,b))}finally{je(!1)}},st=(e,t)=>{if(t===`pin`){h(e,!e.pinned).catch(e=>He({title:D(b,`Không thể đổi trạng thái ghim`,`Could not change pin state`),message:e instanceof Error?e.message:`session-pin-failed`}));return}if(t===`unarchive`){_(e).then(()=>ie(!1)).catch(e=>He({title:D(b,`Không thể khôi phục cuộc trò chuyện`,`Could not restore chat`),message:e instanceof Error?e.message:`session-unarchive-failed`}));return}ze(null),Fe(t===`rename`?e.title:t===`fork`?`${e.title} · ${D(b,`nhánh`,`fork`)}`:``),Ne({kind:t,session:e})},ct=async()=>{if(!(!H||Ie)){Le(!0),ze(null);try{if(H.kind===`rename`)await m(H.session,Pe.trim());else if(H.kind===`archive`)await g(H.session);else{let e=await v(H.session,Pe.trim()||null);e.sessionRef&&(ne(e.sessionRef),oe(`chat`))}Ne(null)}catch(e){ze(kb(H.kind,e instanceof Error?e.message:`session-action-failed`,b))}finally{Le(!1)}}},lt=(0,X.jsx)(Hv,{locale:b,canCreate:K,query:ee,onQuery:te,groups:We,count:Ue.length,selectedRef:ae===`chat`?U?.sessionRef:void 0,showArchived:re,archivedCount:Ge,settingsOpen:se,connection:n,live:r,unseen:nt.unseen,onSelect:tt,onAction:st,onNew:()=>{V(null),oe(`new`),z(!1)},onToggleArchived:()=>{ie(e=>!e),z(!1)},updateDot:!!(k.status?.updateAvailable&&k.status.installable),onSettings:()=>{rt(k.status?.updateAvailable&&k.status.installable?`updates`:`general`),z(!1)}}),ut=ae===`chat`&&U?(0,X.jsx)(yy,{session:U,snapshot:Je,live:Xe,locale:b,onOpenReview:()=>it(`source`),onClose:()=>_e?xe(!1):ye(!1)}):null,dt=!!ut&&(_e?be:ve)&&!fe;if(O)return(0,X.jsx)(vh,{locale:b});if(!e&&n!==`failed`)return(0,X.jsxs)(Q,{sx:{minHeight:`100vh`,alignItems:`center`,justifyContent:`center`},spacing:2,children:[(0,X.jsx)(Ve,{size:24}),(0,X.jsx)(q,{children:D(b,`Đang mở Piagent…`,`Opening Piagent…`)})]});let ft=ae===`new`?D(b,`Cuộc trò chuyện mới`,`New chat`):U?.title??`Piagent`,pt=sb({locale:b,colorMode:x,themeId:S,canCreate:K,hasSelection:ae===`chat`&&!!U,sessions:(e?.sessions??[]).filter(e=>!e.archived),update:{available:!!(k.status?.updateAvailable&&k.status.installable&&!Th(k.status)),latest:k.status?.piagent.latest??null},actions:{newChat:()=>{V(null),oe(`new`)},togglePanel:Se,openChanges:()=>it(`source`),refresh:()=>void a(),settings:rt,checkUpdates:()=>{rt(`updates`),k.check()},setColorMode:T,setTheme:E,setLocale:w,openSession:tt}}),mt=Object.values(r).filter(e=>e&&!e.complete).length;return(0,X.jsx)(Fo,{sessionRef:ae===`chat`?Ke:void 0,onOpen:()=>pe(!1),children:(0,X.jsxs)(Z,{sx:{minHeight:`100vh`,bgcolor:`background.default`,"--piagent-status-bar":{xs:`0px`,md:`28px`}},children:[(0,X.jsx)(In,{position:`fixed`,color:`transparent`,elevation:0,sx:{left:{md:`${yb}px`},right:{lg:dt?`${bb}px`:0,xl:fe?xb:dt?`${bb}px`:0},width:{xs:`100%`,md:`auto`},borderBottom:1,transition:`right .2s ease`,borderColor:`divider`,bgcolor:`rgba(var(--piagent-palette-background-defaultChannel) / .9)`,backdropFilter:`blur(18px)`},children:(0,X.jsxs)(ii,{sx:{minHeight:`60px !important`,gap:1},children:[(0,X.jsx)(et,{"aria-label":D(b,`Mở điều hướng`,`Open navigation`),onClick:()=>z(!0),sx:{display:{md:`none`}},children:(0,X.jsx)(ko,{})}),(0,X.jsxs)(Z,{sx:{flex:1,minWidth:0},children:[(0,X.jsx)(q,{component:`h1`,noWrap:!0,sx:{fontWeight:600,fontSize:`inherit`},children:ft}),ae===`chat`&&U&&(0,X.jsxs)(q,{variant:`caption`,color:`text.secondary`,noWrap:!0,component:`div`,sx:{display:`flex`,alignItems:`center`,gap:.75,minWidth:0},children:[(0,X.jsx)(Z,{component:`span`,sx:{overflow:`hidden`,textOverflow:`ellipsis`,flexShrink:3,minWidth:24},children:U.projectLabel}),(U.gitBranch||!!U.gitRepositories?.length)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Z,{component:`span`,"aria-hidden":!0,sx:{color:`text.disabled`},children:`·`}),(0,X.jsx)(Vy,{projectRef:U.projectRef,projectLabel:U.projectLabel,branch:U.gitBranch,repositories:U.gitRepositories,locale:b,maxWidth:`45%`,onSwitched:()=>void a()})]})]})]}),ae===`chat`&&U&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(gm,{placement:`header`,session:U,snapshot:Je,locale:b,onOpenChanges:()=>it(`source`),canSetModel:n===`connected`&&t?.capabilities.sessionActions.setModel.status===`available`,canSetThinking:n===`connected`&&t?.capabilities.sessionActions.setThinking.status===`available`,canSetPermission:n===`connected`&&t?.capabilities.sessionActions.setPermission.status===`available`,onSetModel:e=>u(U,e),onSetThinking:e=>d(U,e),onSetPermission:e=>f(U,e),onSetFast:e=>p(U,e)}),(0,X.jsx)(Z,{sx:{display:{xs:`none`,sm:`block`}},children:(0,X.jsx)(Cb,{session:U,live:Xe,locale:b})}),(0,X.jsx)(bo,{title:`Source Changes`,children:(0,X.jsx)(et,{"aria-label":D(b,`Mở Source Changes Inspector`,`Open Source Changes Inspector`),onClick:()=>it(`source`),children:(0,X.jsx)(To,{fontSize:`small`})})}),(0,X.jsx)(bo,{title:D(b,`Khung Workspace: thay đổi, ngữ cảnh, subagent`,`Workspace panel: changes, context, subagents`),children:(0,X.jsx)(et,{"aria-label":D(b,`Khung Workspace`,`Workspace panel`),"aria-pressed":dt,onClick:()=>Se(),color:dt?`primary`:`default`,children:(0,X.jsx)(xf,{fontSize:`small`,sx:{transform:`scaleX(-1)`}})})})]}),(0,X.jsx)(bo,{title:D(b,`Làm mới`,`Refresh`),children:(0,X.jsx)(et,{"aria-label":D(b,`Làm mới`,`Refresh`),onClick:()=>void a(),children:(0,X.jsx)(yf,{fontSize:`small`})})})]})}),(0,X.jsxs)(Z,{component:`nav`,sx:{width:{md:yb}},children:[(0,X.jsx)(Er,{variant:`temporary`,open:R,onClose:()=>z(!1),sx:{display:{xs:`block`,md:`none`},"& .MuiDrawer-paper":{width:yb}},children:lt}),(0,X.jsxs)(Er,{variant:`permanent`,sx:{display:{xs:`none`,md:`block`},"& .MuiDrawer-paper":{width:yb,borderRight:1,borderColor:`divider`,height:`calc(100% - var(--piagent-status-bar, 0px))`}},children:[P&&U&&ae===`chat`&&(0,X.jsx)(rf,{value:M,onChange:N}),!P||M===`sessions`||!U||ae!==`chat`?lt:(0,X.jsx)(Z,{ref:I,sx:{overflow:`auto`,flex:1}})]})]}),(0,X.jsx)(Z,{component:`main`,sx:{ml:{md:`${yb}px`},mr:{lg:dt?`${bb}px`:0,xl:fe?xb:dt?`${bb}px`:0},pt:`60px`,transition:`margin-right .2s ease`},children:ae===`new`?(0,X.jsx)(lh,{active:!0,defaultProjectRef:Ze??U?.projectRef,busy:Ae,error:Me,onCancel:()=>oe(`chat`),onCreate:e=>ot(e)}):U?(0,X.jsx)(hf,{sessionRef:U.sessionRef,navigationHost:F,sidebarMode:M,onSection:N,children:(0,X.jsx)(wb,{session:U,snapshot:Je,locale:b,live:r[U.sessionRef],commandActions:{setModel:e=>u(U,e),setThinking:e=>d(U,e),setFast:e=>p(U,e),setPermission:e=>f(U,e),rename:e=>m(U,e),fork:()=>v(U,null),pin:e=>h(U,e),archive:()=>g(U),newChat:()=>{V(null),oe(`new`)},openChanges:()=>it(`source`),openSettings:()=>rt(`general`)},canSend:n===`connected`&&U.composerAvailable&&t?.capabilities.sessionActions.send.status===`available`&&(!Xe||Xe.complete)&&![`required`,`restarting`,`failed`].includes(String(r[U.sessionRef]?.runtimeRecovery)),canRestart:n===`connected`&&t?.capabilities.sessionActions.release.status===`available`&&t?.capabilities.sessionActions.acquire.status===`available`,send:(e,t)=>s(U,e,t),abort:()=>c(U).catch(e=>He({title:D(b,`Chưa dừng được lượt này`,`This turn could not be stopped`),message:e instanceof Error&&e.message===`operation-unavailable`?D(b,`Lượt đã kết thúc hoặc đang chuyển bước. Nếu vẫn còn chạy, bấm Dừng lần nữa.`,`The turn already ended or is between steps. If it is still running, press Stop again.`):e instanceof Error?e.message:`session-abort-failed`})),restart:()=>l(U),onInspector:it},U.sessionRef)},U.sessionRef):(0,X.jsx)(Tb,{locale:b,canCreate:K,onNew:()=>oe(`new`)})}),ut&&dt&&!_e&&(0,X.jsx)(Z,{component:`aside`,sx:{display:{xs:`none`,lg:`block`},position:`fixed`,top:0,right:0,bottom:`var(--piagent-status-bar, 0px)`,width:bb,borderLeft:1,borderColor:`divider`,zIndex:e=>e.zIndex.appBar-1},children:ut}),ut&&(0,X.jsx)(Er,{anchor:`right`,variant:`temporary`,open:be&&!fe&&_e,onClose:()=>xe(!1),sx:{display:{xs:`block`,lg:`none`},"& .MuiDrawer-paper":{width:`min(${bb}px, 88vw)`}},children:ut}),(0,X.jsx)(Kh,{open:fe,active:me,snapshot:Je,state:Ye,sessionRef:Ke,terminalActivities:U?i[U.sessionRef]:void 0,liveActivities:Xe&&!Xe.complete?Xe.activities:void 0,onClose:()=>pe(!1),onActive:he,refresh:at,findings:U?.managedReview?.findings,onSendComments:U&&U.composerAvailable?e=>{oh(U.sessionRef,e),pe(!1)}:void 0}),(0,X.jsx)(Hh,{locale:b,onDetails:()=>rt(`updates`)}),nt.view,(0,X.jsx)(Gy,{locale:b,connection:n,running:mt,session:ae===`chat`?U:void 0,onBranchSwitched:()=>void a(),onUpdates:()=>rt(`updates`),onPalette:()=>j(!0)}),(0,X.jsx)(Ry,{open:A,onClose:()=>j(!1),commands:pt,locale:b}),(0,X.jsx)(ge,{open:se,onClose:()=>ce(!1),fullWidth:!0,maxWidth:`lg`,"aria-labelledby":`piagent-settings-title`,slotProps:{paper:{sx:{m:{xs:0,sm:2},width:{xs:`100%`,sm:`calc(100% - 32px)`},height:{xs:`100%`,sm:`min(86vh, 840px)`},maxHeight:{xs:`100%`,sm:`86vh`},borderRadius:{xs:0,sm:2.5},overflow:`hidden`}}},children:(0,X.jsx)(ob,{section:ue,onSection:de,onBack:()=>ce(!1),session:U,snapshot:Je,capabilities:t,connection:n,onSetModel:U?e=>u(U,e):void 0,onSetThinking:U?e=>d(U,e):void 0,onSetPermission:U?e=>f(U,e):void 0,onRuntimeChanged:async()=>{await a(),await at()}})}),(0,X.jsx)(ge,{open:!!H,onClose:()=>!Ie&&Ne(null),fullWidth:!0,maxWidth:`xs`,children:(0,X.jsxs)(Q,{spacing:2,sx:{p:3},children:[(0,X.jsx)(q,{variant:`h2`,children:H?.kind===`rename`?D(b,`Đổi tên cuộc trò chuyện`,`Rename chat`):H?.kind===`fork`?D(b,`Tạo nhánh cuộc trò chuyện`,`Fork chat`):D(b,`Lưu trữ cuộc trò chuyện`,`Archive chat`)}),H?.kind===`archive`?(0,X.jsx)(q,{color:`text.secondary`,children:D(b,`Cuộc trò chuyện vẫn được lưu và có thể khôi phục từ mục Đã lưu trữ.`,`The chat remains saved and can be restored from Archived.`)}):(0,X.jsx)(le,{autoFocus:!0,label:D(b,`Tên`,`Title`),value:Pe,onChange:e=>Fe(e.target.value),slotProps:{htmlInput:{maxLength:500}}}),Re&&(0,X.jsx)(q,{color:`error`,children:Re}),(0,X.jsxs)(Q,{direction:`row`,spacing:1,sx:{justifyContent:`flex-end`},children:[(0,X.jsx)(J,{disabled:Ie,onClick:()=>Ne(null),children:D(b,`Hủy`,`Cancel`)}),(0,X.jsx)(J,{variant:`contained`,disabled:Ie||H?.kind!==`archive`&&!Pe.trim(),onClick:()=>void ct(),children:D(b,`Xác nhận`,`Confirm`)})]})]})}),(0,X.jsx)(ge,{open:!!Be,onClose:()=>He(null),fullWidth:!0,maxWidth:`xs`,"aria-labelledby":`piagent-session-notice-title`,children:(0,X.jsxs)(Q,{spacing:2,sx:{p:3},children:[(0,X.jsx)(q,{id:`piagent-session-notice-title`,variant:`h2`,children:Be?.title}),(0,X.jsx)(q,{color:`text.secondary`,children:Be?.message}),(0,X.jsx)(Q,{direction:`row`,sx:{justifyContent:`flex-end`},children:(0,X.jsx)(J,{variant:`contained`,onClick:()=>He(null),children:D(b,`Đóng`,`Close`)})})]})})]})})}var Db={"session-revision-stale":[`Cuộc trò chuyện vừa thay đổi trong lúc gửi. Bấm Xác nhận lần nữa.`,`The chat changed while this was sent. Select Confirm again.`],"session-runtime-busy":[`Cuộc trò chuyện đang bận. Thử lại khi lượt này xong.`,`The chat is busy. Try again when this turn ends.`],"session-runtime-unavailable":[`Cuộc trò chuyện chưa mở được. Mở lại cuộc trò chuyện rồi thử lại.`,`The chat is not open. Open it again and retry.`],"session-unavailable":[`Không còn thấy cuộc trò chuyện này trong danh sách. Tải lại trang rồi thử lại.`,`This chat is no longer in the list. Reload the page and retry.`],"session-archived":[`Cuộc trò chuyện đã được lưu trữ. Bỏ lưu trữ trước.`,`The chat is archived. Unarchive it first.`],"session-command-expired":[`Yêu cầu chờ quá lâu nên đã hết hạn. Thử lại.`,`The request waited too long and expired. Try again.`],"gateway-command-response-timeout":[`Piagent chưa trả lời. Xem lại danh sách trước khi thử lại.`,`Piagent did not answer. Check the list before trying again.`]},Ob={rename:[`Chưa đổi được tên`,`Could not rename`],fork:[`Chưa tạo được nhánh`,`Could not fork`],archive:[`Chưa lưu trữ được`,`Could not archive`]};function kb(e,t,n){let r=Db[t];return`${D(n,...Ob[e])}: ${r?D(n,...r):D(n,`thử lại.`,`try again.`)} (${t})`}function Ab(e){let t=e.mode===`dark`,n=e.mode,{primary:r,secondary:i,background:a,paper:o,text:s,muted:c,divider:l}=e;return b({cssVariables:{cssVarPrefix:`piagent`},palette:{mode:n,primary:{main:r,contrastText:e.onPrimary},secondary:{main:i},success:{main:i},warning:{main:e.warning},error:{main:e.error},background:{default:a,paper:o},text:{primary:s,secondary:c,disabled:c},divider:l},shape:{borderRadius:2},typography:{fontFamily:`system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif`,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:600,h1:{fontSize:`1.65rem`,fontWeight:600,letterSpacing:`-0.03em`},h2:{fontSize:`1.2rem`,fontWeight:600,letterSpacing:`-0.02em`},h3:{fontSize:`1rem`,fontWeight:600},button:{fontSize:`0.78rem`,fontWeight:500,textTransform:`none`},caption:{fontSize:`0.7rem`}},components:{MuiCssBaseline:{styleOverrides:{html:{backgroundColor:a},body:{minWidth:320,minHeight:`100vh`,backgroundImage:`radial-gradient(circle at 65% -18%, ${S(t?i:r,t?.12:.16)} 0, transparent 34rem)`},"::selection":{backgroundColor:S(r,.26)}}},MuiPaper:{defaultProps:{elevation:0},styleOverrides:{root:{backgroundImage:`none`}}},MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{minHeight:32,borderRadius:2},outlined:{borderColor:S(s,.18)}}},MuiChip:{styleOverrides:{root:{height:24,borderRadius:2,fontWeight:500}}},MuiListItemButton:{styleOverrides:{root:{minHeight:42,margin:`1px 6px`,borderRadius:2,color:c,"&.Mui-selected":{color:s,backgroundColor:S(r,t?.11:.1),boxShadow:`inset 2px 0 ${r}`},"&.Mui-selected:hover":{backgroundColor:S(r,.15)}}}},MuiTab:{styleOverrides:{root:{minHeight:48,paddingInline:18,textTransform:`none`,fontWeight:500}}},MuiTooltip:{defaultProps:{arrow:!0}}}})}function jb(e){for(let t of e??[]){let e=String(t).toLowerCase().split(`-`)[0];if(e===`vi`)return`vi`;if(e)return`en`}return`en`}var Mb=250,Nb=4e3,Pb=/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/;function Fb(e){return Math.min(Mb*2**Math.min(Math.max(0,e),16),Nb)}function Ib(e){return e instanceof ds?e.status===408||e.status===409||e.status===423||e.status===425||e.status===429||e.status>=500?`retryable`:`terminal`:typeof DOMException<`u`&&e instanceof DOMException&&e.name===`AbortError`?`terminal`:e instanceof TypeError?`retryable`:`terminal`}function Lb(e,...t){for(let e of t)if(typeof e==`string`&&Pb.test(e))return e;return e}function Rb(e){if(!e||typeof e!=`object`)throw Error(`invalid-inspection-snapshot`);let t=e;if(t.schemaVersion!==1||t.version!==`piagent-webui-snapshot-v1`||typeof t.generatedAt!=`string`||[`identity`,`revision`,`capabilities`,`session`,`sourceChanges`,`activity`,`approvals`,`verification`,`usage`,`continuation`,`health`].some(e=>!t[e]||typeof t[e]!=`object`))throw Error(`invalid-inspection-snapshot`);let n=t.revision;if(typeof n.eventCursor!=`string`||!Pb.test(n.eventCursor))throw Error(`invalid-inspection-snapshot-cursor`);return e}function zb(e=0){return{state:`cancelled`,readSequence:e}}async function Bb(e){let t=0;for(;!e.stopped();){let n=await e.read();if(e.stopped())return zb(n.readSequence);if(n.state!==`retryable-error`)return n;await e.wait(Fb(t)),t=Math.min(t+1,16)}return zb()}function Vb(){let[e,t]=(0,Y.useState)(),[n,r]=(0,Y.useState)(`connecting`),[i,a]=(0,Y.useState)([]),o=(0,Y.useRef)(()=>Promise.resolve(zb())),s=(0,Y.useRef)(()=>void 0),c=(0,Y.useCallback)(async()=>{let e=await o.current();if(e.state===`committed`)return s.current(e.value),e.value},[]);return(0,Y.useEffect)(()=>{let e=new AbortController,n,i,c,l,u,d=0,f=0,p=0,m=0,h=null,g=!1,_=!1,v=!1,y=!1,b=!1,x=!1,S=!1,C=!1,w=()=>{window.clearTimeout(i),i=void 0},T=()=>{window.clearTimeout(c),c=void 0},E=()=>{window.clearTimeout(l),l=void 0;let e=u;u=void 0,e?.()},D=e=>new Promise(t=>{let n=()=>{u===n&&(u=void 0,l=void 0),t()};u=n,l=window.setTimeout(n,e)}),O=()=>{d+=1,E()},k,A=()=>{C||S||(S=!0,O(),w(),T(),e.abort(),k.invalidate(),n?.close(),n=void 0,y=!1,r(`failed`))};k=new lb({read:async()=>{let t=m;return{snapshot:Rb(await ps(e.signal)),eventGenerationAtStart:t}},commit:({snapshot:e,eventGenerationAtStart:n})=>{C||S||(_=!0,v=!0,m===n&&(h=Lb(null,e.revision.eventCursor)),t(e),y&&r(`connected`))},classify:Ib});let j=async()=>{let e=await k.request();return e.state===`committed`?{...e,value:e.value.snapshot}:(e.state===`terminal-error`&&A(),e)};o.current=j;let M=()=>void 0,N=()=>void 0,P=()=>{if(C||S||!g||!_||n)return;O();let e=h?`?after=${encodeURIComponent(h)}`:``,t;try{t=new EventSource(`/api/v1/events${e}`,{withCredentials:!0})}catch{f=Math.min(f+1,16),r(`reconnecting`),M(Fb(f-1));return}n=t,y=!1,r(e=>e===`connecting`?`connecting`:`reconnecting`),t.onopen=()=>{C||S||n!==t||(y=!0,f=0,r(v?`connected`:`reconnecting`))},t.addEventListener(`runtime-event`,e=>{if(!(C||S||n!==t))try{let t=e,n=JSON.parse(t.data);if(!n||typeof n.kind!=`string`)return;let r=Lb(h,t.lastEventId,n.eventCursor);r!==h&&(h=r,m+=1),a(e=>[...e,n].slice(-500)),[`message.text-delta`,`message.thinking-state`,`activity.progress`].includes(String(n.kind))||N()}catch{}}),t.addEventListener(`resync-required`,()=>{C||S||n!==t||(t.close(),n=void 0,y=!1,w(),T(),x=!1,a([]),r(`reconnecting`),M(0,!0))}),t.onerror=()=>{C||S||n!==t||(t.close(),n=void 0,y=!1,v=!1,f=Math.min(f+1,16),r(`reconnecting`),M(Fb(f-1)))}};M=(e=0,t=!1)=>{if(C||S)return;let i=++d;E(),t&&a([]),r(_?`reconnecting`:`connecting`),(async()=>{if(e>0&&await D(e),C||S||d!==i||n)return;let t=await Bb({read:j,wait:D,stopped:()=>C||S||d!==i||!!n});C||S||d!==i||n||t.state===`committed`&&P()})()};let F=()=>{if(C||S||!n||c!==void 0)return;let e=Fb(p);p=Math.min(p+1,16),c=window.setTimeout(()=>{c=void 0,x=!0,I()},e)},I=async()=>{if(!(C||S||!n)){if(b){x=!0;return}b=!0;try{do{x=!1;let e=await j();if(C||S||!n||e.state===`cancelled`||e.state===`terminal-error`)return;if(e.state===`retryable-error`){v=!1,r(`reconnecting`),x=!0,F();return}p=0}while(x&&!C&&!S&&n)}finally{b=!1,x&&c===void 0&&i===void 0&&n&&!S&&!C&&(i=window.setTimeout(()=>{i=void 0,I()},80))}}};N=()=>{x=!0,!(C||S||b||c!==void 0||i!==void 0)&&(i=window.setTimeout(()=>{i=void 0,I()},80))};let ee=e=>{!C&&!S&&g&&!n&&P()};return s.current=ee,(async()=>{let e;try{e=await St()}catch{!C&&!S&&A();return}if(!(C||S)){if(e===`failed`){A();return}g=!0,M()}})(),()=>{C=!0,O(),e.abort(),k.invalidate(),n?.close(),w(),T(),s.current===ee&&(s.current=()=>void 0),o.current===j&&(o.current=()=>Promise.resolve(zb()))}},[]),{snapshot:e,connection:n,events:i,refreshSnapshot:c}}var Hb=e=>!!e&&typeof e==`object`&&!Array.isArray(e),Ub=e=>typeof e==`string`&&/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/.test(e),Wb=(e,t)=>Object.keys(e).length===t.length&&Object.keys(e).every(e=>t.includes(e));function Gb(e){if(!Hb(e)||e.schemaVersion!==1||e.version!==`piagent-terminal-v1`||!Hb(e.identity)||!Wb(e.identity,[`gatewayInstanceRef`,`runtimeInstanceRef`,`sessionRef`])||![`gatewayInstanceRef`,`runtimeInstanceRef`,`sessionRef`].every(t=>Ub(e.identity[t])))return!1;let t=[`schemaVersion`,`version`,`messageType`,`identity`];return e.messageType===`state`?Wb(e,[...t,`revisions`,`available`,`reasonCode`,`terminals`])&&Hb(e.revisions)&&Wb(e.revisions,[`terminalRevision`])&&typeof e.revisions.terminalRevision==`string`&&typeof e.available==`boolean`&&(e.reasonCode===null||typeof e.reasonCode==`string`)&&Array.isArray(e.terminals)&&e.terminals.length<=4&&e.terminals.every(e=>Hb(e)&&Wb(e,[`terminalRef`,`number`,`state`,`cols`,`rows`,`sequence`,`exitCode`])&&Ub(e.terminalRef)&&Number.isSafeInteger(e.number)&&e.number>0&&[`running`,`exited`].includes(e.state)&&Number.isSafeInteger(e.sequence)&&e.sequence>=0&&Number.isInteger(e.cols)&&e.cols>=2&&e.cols<=500&&Number.isInteger(e.rows)&&e.rows>=1&&e.rows<=200&&(e.exitCode===null||Number.isInteger(e.exitCode))):!Ub(e.terminalRef)||!Number.isSafeInteger(e.sequence)||e.sequence<0?!1:e.messageType===`output`?Wb(e,[...t,`terminalRef`,`sequence`,`data`,`replay`,`reset`,`complete`,`truncated`])&&typeof e.data==`string`&&e.data.length<=8192&&[`replay`,`reset`,`complete`,`truncated`].every(t=>typeof e[t]==`boolean`):e.messageType===`exit`&&Wb(e,[...t,`terminalRef`,`sequence`,`exitCode`,`signal`])&&(e.exitCode===null||Number.isInteger(e.exitCode))&&(e.signal===null||Number.isInteger(e.signal))}var Kb=e=>!!e&&typeof e==`object`&&!Array.isArray(e),qb=e=>typeof e==`string`&&/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/.test(e);function Jb(e){return Gb(e)}var Yb=new class{#e=null;#t=!1;#n=new Map;#r=new Set;#i=new Set;#a;constructor(e=vt){this.#a=e}get ready(){return this.#t}#o(e){this.#t=e;for(let t of this.#i)t(e)}attach(e){this.#s(),this.#e=e,e.addEventListener(`message`,t=>{if(e!==this.#e)return;let n;try{n=JSON.parse(String(t.data))}catch{return}if(Kb(n)){if(n.messageType===`hello`&&n.version===`piagent-gateway-protocol-v1`){this.#o(!0);return}if(n.messageType===`response`&&n.version===`piagent-gateway-protocol-v1`){let e=this.#n.get(n.requestId);if(!e)return;this.#n.delete(n.requestId),clearTimeout(e.timer),n.method===e.method?n.ok===!0?e.resolve(n.result):e.reject(Error(String(n.error?.code??`terminal-request-failed`))):e.reject(Error(`terminal-response-invalid`));return}if(Jb(n))for(let e of this.#r)e(n)}}),e.addEventListener(`close`,()=>{e===this.#e&&this.#s()})}#s(){this.#e=null,this.#o(!1);for(let e of this.#n.values())clearTimeout(e.timer),e.reject(Error(`terminal-connection-lost`));this.#n.clear()}subscribe(e){return this.#r.add(e),()=>{this.#r.delete(e)}}connection(e){return this.#i.add(e),()=>{this.#i.delete(e)}}#c(e,t){let n=this.#e,r=this.#a();if(!this.#t||!n||n.readyState!==1||!r)return Promise.reject(Error(`terminal-not-connected`));if(this.#n.size>=64)return Promise.reject(Error(`terminal-request-capacity`));let i=`terminal_${crypto.randomUUID().replaceAll(`-`,``)}`;return new Promise((a,o)=>{let s=setTimeout(()=>{this.#n.delete(i),o(Error(`terminal-response-timeout`))},15e3);this.#n.set(i,{method:e,resolve:a,reject:o,timer:s});try{n.send(JSON.stringify({schemaVersion:1,version:`piagent-gateway-protocol-v1`,messageType:`request`,requestId:i,method:e,params:{...t,csrfToken:r}}))}catch{clearTimeout(s),this.#n.delete(i),o(Error(`terminal-send-failed`))}})}async state(e){let t=await this.#c(`terminals.state`,{sessionRef:e});if(!Jb(t)||t.messageType!==`state`||t.identity.sessionRef!==e)throw Error(`terminal-state-invalid`);return t}async execute(e){let t=await this.#c(`terminals.command`,{command:e});if(!Kb(t)||t.schemaVersion!==1||t.version!==e.version||t.messageType!==`receipt`||t.commandId!==e.commandId||t.idempotencyKey!==e.idempotencyKey||t.actionDigest!==e.actionDigest||t.action!==e.action||!Kb(t.identity)||!Object.entries(e.identity).every(([e,n])=>t.identity[e]===n)||!Kb(t.observedRevisions)||typeof t.observedRevisions.terminalRevision!=`string`||![`settled`,`rejected`,`uncertain`].includes(t.phase)||typeof t.deduplicated!=`boolean`||!(t.terminalRef===null||qb(t.terminalRef))||t.reasonCode!==null&&typeof t.reasonCode!=`string`)throw Error(`terminal-receipt-invalid`);return t}};function Xb(e,t=150){let n,r=!1,i=!1,a=!1,o=()=>{if(!a){if(r||n!==void 0){i=r;return}n=setTimeout(()=>{n=void 0,r=!0,e().catch(()=>void 0).finally(()=>{r=!1,i&&(i=!1,o())})},t)}};return{request:o,stop:()=>{a=!0,n!==void 0&&clearTimeout(n),n=void 0}}}var Zb=class extends Error{effectMayHaveOccurred;constructor(e,t){super(e),this.name=`GatewayCommandTransportError`,this.effectMayHaveOccurred=t}};async function Qb(e,t,n=4){for(let r=1;;r+=1)try{return await e(t)}catch(e){if(r>=n||!(e instanceof Zb)||e.message!==`gateway-command-response-timeout`)throw e}}function $b(e,t){return e instanceof Zb?e.effectMayHaveOccurred:t}function ex(e,t,n=null,r=null){return!e||e.serial<=t||e.operationRef===n||r&&e.messageRequestId&&e.messageRequestId!==r?null:e}function tx(e,t,n=null){return e&&e.operationRef!==t&&!(n&&e.messageRequestId&&e.messageRequestId!==n)?{operationRef:e.operationRef,complete:!1}:null}function nx(e,t){return t?`observed`:e?.phase===`settled`||e?.phase===`accepted`?`confirmed`:e?.phase===`rejected`?`rejected`:`unconfirmed`}function rx(e,t){let n=new AbortController,r=()=>void 0,i=new Promise(e=>{r=e}),a=setTimeout(()=>{n.abort(),r(null)},t);return{promise:Promise.race([e(n.signal).catch(()=>null),i]).finally(()=>clearTimeout(a)),cancel(){n.abort(),r(null),clearTimeout(a)}}}function ix(e,t,n,r,i){let a=e[t];if(!a||a.messageRequestId!==n||i===`unconfirmed`&&(a.delivery===`admitted`||a.operationRef))return e;let o=yg(a,i,r.operationRef,new Date().toISOString()),s=i===`unconfirmed`||r.complete||!!(r.operationRef&&a.operationRef===r.operationRef&&a.complete);return{...e,[t]:{...o,complete:s,abortable:i===`admitted`&&!s&&!!r.operationRef}}}async function ax(e,t={}){let n=()=>{let t=ex(e.readLocalObservation?.()??e.localObservation,e.afterSerial,e.priorOperationRef,e.messageRequestId);return t?{operationRef:t.operationRef,complete:t.complete}:null},r=n();if(r)return r;let i=t.timeoutMs??5e3,a=t.readLiveState??hs,o=t.readTranscript??ks,s=[rx(async t=>{let n=await a(t);return tx(n?.state===`ready`?n.operations.find(t=>t.sessionRef===e.sessionRef):void 0,e.priorOperationRef,e.messageRequestId)},i),rx(async t=>{let n=await o(e.sessionRef,null,50,t);if(n?.state!==`ready`)return null;let r=[...n.items].reverse().find(t=>t.role===`user`&&t.messageRequestId===e.messageRequestId);if(r)return{operationRef:r.agentOperationId,complete:cd(n.items,e.message,{operationRef:r.agentOperationId,messageRequestId:e.messageRequestId,startedAt:null})};let i=Date.parse(e.requestedAt),a=[...n.items].reverse().find(t=>t.role===`user`&&!t.messageRequestId&&rd(t.content.text,e.message)&&Date.parse(t.recordedAt)>=i);return a?{operationRef:a.agentOperationId,complete:cd(n.items,e.message,{operationRef:a.agentOperationId,messageRequestId:null,startedAt:e.requestedAt})}:null},i)],c=new Map(s.map((e,t)=>[t,e.promise.then(e=>({evidence:e,index:t}))]));try{for(;c.size>0;){let e=await Promise.race(c.values());if(c.delete(e.index),e.evidence)return e.evidence;let t=n();if(t)return t}return n()}finally{for(let e of s)e.cancel()}}function ox(){let[e,t]=(0,Y.useState)(),[n,r]=(0,Y.useState)(),[i,a]=(0,Y.useState)(`connecting`),[o,s]=(0,Y.useState)({}),[c,l]=(0,Y.useState)({}),u=(0,Y.useRef)(void 0),d=(0,Y.useRef)(null),f=(0,Y.useRef)(null),p=(0,Y.useRef)({});p.current=o;let m=(0,Y.useRef)(0),h=(0,Y.useRef)(new Map),g=(0,Y.useRef)(null),_=(0,Y.useRef)(!0),v=(0,Y.useRef)(0),y=(0,Y.useRef)(0),b=(0,Y.useRef)(new Map),x=(0,Y.useCallback)(gb,[]),S=(0,Y.useCallback)(async(e={})=>{let n=++v.current;try{let[r,i]=await Promise.all([ms(),hs().catch(()=>void 0)]),o=sg(i,r.gatewayInstanceRef),c=!1;if(n>=y.current){y.current=n,u.current=r,t(r);let p=g.current;p!==null&&p!==r.gatewayInstanceRef&&(_.current=!0),g.current=r.gatewayInstanceRef;let m=e.requireLiveState||_.current,h=d.current?.readyState===WebSocket.OPEN;if(a(cg(h,m)),!h&&i&&o!==null)f.current=o,x(r.gatewayInstanceRef,o),s(e=>xg(e,i)),l(gg(i)),_.current=!1,c=!0;else if(p!==r.gatewayInstanceRef){if(l({}),m)f.current=null;else{let e=null;try{e=window.sessionStorage.getItem(ub)}catch{}f.current=hb(e,r.gatewayInstanceRef)}}}return e.requireLiveState&&!c?void 0:u.current??r}catch{a(`reconnecting`);return}},[x]),C=(0,Y.useCallback)(e=>{let t=d.current;if(!t||t.readyState!==WebSocket.OPEN)return Promise.reject(new Zb(`gateway-not-connected`,!1));let n=_b(`request`);return new Promise((r,i)=>{let a=window.setTimeout(()=>{b.current.delete(n)&&i(new Zb(`gateway-command-response-timeout`,!0))},db);b.current.set(n,{resolve:r,reject:i,timeout:a});try{t.send(JSON.stringify({schemaVersion:1,version:`piagent-gateway-protocol-v1`,messageType:`request`,requestId:n,method:`sessions.command`,params:{command:e}}))}catch(e){window.clearTimeout(a),b.current.delete(n),i(new Zb(e instanceof Error?e.message:`gateway-request-failed`,!1))}})},[]),w=(0,Y.useCallback)((e,t,n,r,i,a)=>ax({sessionRef:e,message:t,requestedAt:n,afterSerial:r,priorOperationRef:i,messageRequestId:a,readLocalObservation:()=>h.current.get(e)}),[]),T=(0,Y.useCallback)(async e=>{let t=u.current,n=e.message.trim(),r=e.messageRequestId??_b(`message`);if(!t?.catalogRevision)throw Error(`catalog-unavailable`);if(!n)throw Error(`message-empty`);let i=t=>{if(!t.catalogRevision)throw Error(`catalog-unavailable`);let i=new Date;return Qb(C,{schemaVersion:1,version:`piagent-session-command-v1`,messageType:`command`,commandId:_b(`command`),idempotencyKey:_b(`idempotency`),action:`session.create`,requestedAt:i.toISOString(),expiresAt:new Date(i.getTime()+3e5).toISOString(),sessionRef:null,expectedCatalogRevision:t.catalogRevision,expectedSessionRevision:null,payload:{projectRef:e.projectRef,placeRef:e.placeRef,modelRef:e.modelRef,thinkingLevel:e.thinkingLevel,workflow:e.workflow,message:n,messageRequestId:r,...e.permissionMode?{permissionMode:e.permissionMode}:{},...e.fast?{fast:!0}:{},...e.deferInitialMessage?{deferInitialMessage:!0}:{}}})},a=await i(t);if(vb(a)){let e=await S();e?.catalogRevision&&(a=await i(e))}if(!(a.phase===`uncertain`&&a.sessionRef)&&a.phase!==`settled`||!a.sessionRef)throw Error(a.error?.code??a.resultCode);let o=a.settledAt??a.requestedAt;return a.phase===`settled`&&!e.deferInitialMessage&&s(e=>{let t=e[a.sessionRef];return{...e,[a.sessionRef]:{...t??{assistant:``,attachments:[],activities:[],complete:!1,error:null},user:n,operationRef:a.operationRef,messageRequestId:r,abortable:!t?.complete&&!!a.operationRef,startedAt:t?.startedAt??o,lastEventAt:t?.lastEventAt??o}}}),await S(),a},[S,C]),E=(0,Y.useCallback)(async(e,t,n)=>{let r=u.current;if(!r?.catalogRevision)throw Error(`catalog-unavailable`);let i=t.trim();if(!i)throw Error(`message-empty`);let a=n?.messageRequestId??_b(`message`),o=n?.attachmentRefs??[],c=p.current[e.sessionRef],l=m.current,d=h.current.get(e.sessionRef)?.operationRef??c?.operationRef??null,f=new Date().toISOString();s(t=>({...t,[e.sessionRef]:vg(t[e.sessionRef],{message:i,attachments:n?.attachments??[],messageRequestId:a,submittedAt:f})}));let g=()=>s(t=>{let n=t[e.sessionRef],r=bg(n,c,a);if(r===n)return t;let i={...t};return r?i[e.sessionRef]=r:delete i[e.sessionRef],i}),_=(t,n)=>s(r=>ix(r,e.sessionRef,a,t,n)),v=f,y=!1;try{let t=t=>{let r=t.sessions.find(t=>t.sessionRef===e.sessionRef);if(!t.catalogRevision||!r)throw Error(`session-unavailable`);let s=new Date;return v=s.toISOString(),{schemaVersion:1,version:`piagent-session-command-v1`,messageType:`command`,commandId:_b(`command`),idempotencyKey:_b(`idempotency`),action:`session.send`,requestedAt:s.toISOString(),expiresAt:new Date(s.getTime()+fb).toISOString(),sessionRef:e.sessionRef,expectedCatalogRevision:t.catalogRevision,expectedSessionRevision:r.sessionRevision,payload:{delivery:`new-operation`,message:i,messageRequestId:a,expectedOperationRef:null,attachmentRefs:o,...n?.workflow?{workflow:n.workflow}:{}}}},s=t(r);y=!0;let c=await C(s);if(vb(c)){let e=await S();e?.catalogRevision&&(s=t(e),c=await C(s))}if(nx(c,null)===`confirmed`)return _({operationRef:c.operationRef,complete:!1},`admitted`),S(),{state:`confirmed`,receipt:c};let u=await w(e.sessionRef,i,v,l,d,a),f=nx(c,u);if(f===`observed`&&u)return _(u,`admitted`),S(),{state:`observed`,receipt:c};if(f===`unconfirmed`)return _({operationRef:null,complete:!0},`unconfirmed`),S(),{state:`unconfirmed`,receipt:c};throw g(),new mb(c.error?.code??c.resultCode)}catch(t){if(t instanceof mb)throw t;if($b(t,y)){let t=await w(e.sessionRef,i,v,l,d,a);return nx(null,t)===`observed`&&t?(_(t,`admitted`),S(),{state:`observed`,receipt:null}):(_({operationRef:null,complete:!0},`unconfirmed`),S(),{state:`unconfirmed`,receipt:null})}throw g(),t}},[w,S,C]),D=(0,Y.useCallback)(async e=>{let t=u.current,n=o[e.sessionRef]?.operationRef,r=t?.sessions.find(t=>t.sessionRef===e.sessionRef);if(!t?.catalogRevision||!r||!n||o[e.sessionRef]?.abortable===!1)throw Error(`operation-unavailable`);let i=t=>{let r=t.sessions.find(t=>t.sessionRef===e.sessionRef);if(!t.catalogRevision||!r)throw Error(`operation-unavailable`);let i=new Date;return C({schemaVersion:1,version:`piagent-session-command-v1`,messageType:`command`,commandId:_b(`command`),idempotencyKey:_b(`idempotency`),action:`session.abort`,requestedAt:i.toISOString(),expiresAt:new Date(i.getTime()+3e5).toISOString(),sessionRef:e.sessionRef,expectedCatalogRevision:t.catalogRevision,expectedSessionRevision:r.sessionRevision,payload:{operationRef:n,clearQueued:!0}})},a=await i(t);if(vb(a)){let[t,r]=await Promise.all([S(),hs().catch(()=>void 0)]);if(!t||!Eg(r,t.gatewayInstanceRef,e.sessionRef,n))throw Error(`operation-unavailable`);a=await i(t)}if(a.phase!==`settled`)throw Error(a.error?.code??a.resultCode);return S(),a},[o,S,C]),O=(0,Y.useCallback)(async e=>{let t=async t=>{let n=await S(),r=n?.sessions.find(t=>t.sessionRef===e.sessionRef);if(!n?.catalogRevision||!r)throw Error(`session-unavailable`);let i=new Date,a=await C({schemaVersion:1,version:`piagent-session-command-v1`,messageType:`command`,commandId:_b(`command`),idempotencyKey:_b(`idempotency`),action:t,requestedAt:i.toISOString(),expiresAt:new Date(i.getTime()+3e5).toISOString(),sessionRef:e.sessionRef,expectedCatalogRevision:n.catalogRevision,expectedSessionRevision:r.sessionRevision,payload:{}});if(a.phase!==`settled`)throw Error(a.error?.code??a.resultCode);return a};s(t=>({...t,[e.sessionRef]:{...t[e.sessionRef]??{user:``,assistant:``,attachments:[],activities:[],operationRef:null,complete:!0,error:null},runtimeRecovery:`restarting`}}));try{let n=(await S())?.sessions.find(t=>t.sessionRef===e.sessionRef);if(!n)throw Error(`session-unavailable`);n.state===`gateway-owned`&&await t(`session.release`);let r=await t(`session.acquire`);return s(t=>({...t,[e.sessionRef]:{...t[e.sessionRef]??{user:``,assistant:``,attachments:[],activities:[],operationRef:null,complete:!0,error:null},runtimeRecovery:`recovered`}})),await S(),r}catch(t){throw s(t=>({...t,[e.sessionRef]:{...t[e.sessionRef]??{user:``,assistant:``,attachments:[],activities:[],operationRef:null,complete:!0,error:null},runtimeRecovery:`failed`}})),t}},[S,C]),k=(0,Y.useCallback)(async(e,t,n)=>{let r=r=>{let i=r?.sessions.find(t=>t.sessionRef===e.sessionRef);if(!r?.catalogRevision||!i)throw Error(`session-unavailable`);let a=new Date;return C({schemaVersion:1,version:`piagent-session-command-v1`,messageType:`command`,commandId:_b(`command`),idempotencyKey:_b(`idempotency`),action:t,requestedAt:a.toISOString(),expiresAt:new Date(a.getTime()+3e5).toISOString(),sessionRef:e.sessionRef,expectedCatalogRevision:r.catalogRevision,expectedSessionRevision:i.sessionRevision,payload:n})},i=await r(u.current);for(let e=0;[`session.set-permission`,`session.set-fast`].includes(t)&&vb(i)&&e<2;e++)i=await r(await S());if(i.phase!==`settled`)throw Error(i.error?.code??i.resultCode);return await S(),i},[S,C]),A=(0,Y.useCallback)((e,t)=>k(e,`session.set-model`,{modelRef:t}),[k]),j=(0,Y.useCallback)((e,t)=>k(e,`session.set-thinking`,{thinkingLevel:t}),[k]),M=(0,Y.useCallback)((e,t)=>k(e,`session.set-permission`,{permissionMode:t}),[k]),N=(0,Y.useCallback)((e,t)=>k(e,`session.set-fast`,{fast:t}),[k]),P=(0,Y.useCallback)(async(e,t,n)=>{let r=r=>{let i=r?.sessions.find(t=>t.sessionRef===e.sessionRef);if(!r?.catalogRevision||!i)throw Error(`session-unavailable`);let a=new Date;return C({schemaVersion:1,version:`piagent-session-command-v1`,messageType:`command`,commandId:_b(`command`),idempotencyKey:_b(`idempotency`),action:t,requestedAt:a.toISOString(),expiresAt:new Date(a.getTime()+3e5).toISOString(),sessionRef:e.sessionRef,expectedCatalogRevision:r.catalogRevision,expectedSessionRevision:i.sessionRevision,payload:n})},i=await r(u.current);for(let e=0;t===`session.rename`&&vb(i)&&e<2;e++)i=await r(await S());if(i.phase!==`settled`)throw Error(i.error?.code??i.resultCode);return await S(),i},[S,C]),F=(0,Y.useCallback)((e,t)=>P(e,`session.rename`,{title:t}),[P]),I=(0,Y.useCallback)((e,t)=>P(e,`session.pin`,{pinned:t}),[P]),ee=(0,Y.useCallback)(e=>P(e,`session.archive`,{}),[P]),te=(0,Y.useCallback)(e=>P(e,`session.unarchive`,{}),[P]),L=(0,Y.useCallback)((e,t)=>P(e,`session.fork`,{entryRef:null,title:t}),[P]);return(0,Y.useEffect)(()=>{let e=!1,t,n=0,i=!1,o=Xb(()=>S()),c=o.request,p=(()=>{try{let e=window.localStorage.getItem(`piagent-gateway-client-ref`);if(e&&/^[A-Za-z0-9][A-Za-z0-9._~-]{0,159}$/.test(e))return e;let t=_b(`client`);return window.localStorage.setItem(`piagent-gateway-client-ref`,t),t}catch{return _b(`client`)}})(),v=()=>{if(e||bt())return;a(n===0?`connecting`:`reconnecting`);let o=window.location.protocol===`https:`?`wss:`:`ws:`,S=new WebSocket(`${o}//${window.location.host}/api/v1/gateway`,`piagent.gateway.v1`);d.current=S,Yb.attach(S);let C=window.setTimeout(()=>S.close(1008,`hello-timeout`),5e3);S.addEventListener(`open`,()=>S.send(JSON.stringify({schemaVersion:1,version:`piagent-gateway-protocol-v1`,messageType:`connect`,clientRef:p,minimumProtocol:1,maximumProtocol:1,lastEventSequence:f.current,catalogRevision:u.current?.catalogRevision??null}))),S.addEventListener(`message`,e=>{let t;try{t=JSON.parse(String(e.data))}catch{S.close(1007,`invalid-json`);return}if(!t||typeof t!=`object`){S.close(1008,`invalid-frame`);return}let o=t;if(o.messageType===`hello`){window.clearTimeout(C);let e=typeof o.capabilities?.gatewayInstanceRef==`string`?o.capabilities.gatewayInstanceRef:null;if(!e||g.current&&e!==g.current){f.current=null,_.current=!0,i=!0,S.close(pb,`gateway-epoch-changed`);return}g.current=e,n=0,r(o.capabilities),a(`connected`);return}if(o.messageType===`response`){let e=b.current.get(String(o.requestId));if(!e)return;b.current.delete(String(o.requestId)),window.clearTimeout(e.timeout),o.ok===!0&&o.result?e.resolve(o.result):e.reject(new Zb(String(o.error?.code??`gateway-request-failed`),!1));return}if(o.messageType!==`event`||!Number.isSafeInteger(o.sequence))return;let u=o.payload,d=typeof o.generatedAt==`string`?o.generatedAt:new Date().toISOString(),p=typeof u.messageRequestId==`string`?u.messageRequestId:null,v=e=>e&&p&&e.messageRequestId&&e.messageRequestId!==p?void 0:e;if(o.kind===`resync.required`){_.current=!0,i=!0,S.close(pb,`canonical-resync-required`);return}let y=Number(o.sequence),w=f.current;if(!(w!==null&&y<=w)){if(w!==null&&y!==w+1){_.current=!0,i=!0,S.close(pb,`gateway-event-sequence-gap`);return}if(f.current=y,g.current&&x(g.current,y),typeof u?.sessionRef==`string`&&typeof u.operationRef==`string`&&[`runtime.changed`,`message.delta`,`tool.started`,`tool.completed`,`message.completed`,`operation.settled`].includes(String(o.kind))&&(m.current+=1,h.current.set(u.sessionRef,{serial:m.current,operationRef:u.operationRef,messageRequestId:p,complete:[`message.completed`,`operation.settled`].includes(String(o.kind))})),o.kind===`message.delta`&&typeof u?.sessionRef==`string`&&typeof u.delta==`string`&&s(e=>{let t=v(e[u.sessionRef]);return{...e,[u.sessionRef]:{...t??{user:``,assistant:``,attachments:[],activities:[],complete:!1,error:null},operationRef:u.operationRef,messageRequestId:p??t?.messageRequestId,abortable:!0,complete:!1,delivery:t?.user?`admitted`:t?.delivery,assistant:`${t?.assistant??``}${u.delta}`,startedAt:t?.startedAt??d,lastEventAt:d}}}),[`tool.started`,`tool.completed`].includes(String(o.kind))&&typeof u?.sessionRef==`string`&&typeof u.toolCallRef==`string`&&typeof u.toolLabel==`string`&&s(e=>{let t=v(e[u.sessionRef])??{user:``,assistant:``,attachments:[],activities:[],operationRef:u.operationRef??null,abortable:!0,complete:!1,error:null,runtimeRecovery:null},n=o.kind===`tool.started`?`running`:u.isError===!0?`failed`:`completed`,r=t.activities.find(e=>e.toolCallRef===u.toolCallRef),i=[...t.activities.filter(e=>e.toolCallRef!==u.toolCallRef),{toolCallRef:u.toolCallRef,toolLabel:u.toolLabel,fileLabel:typeof u.fileLabel==`string`?u.fileLabel:r?.fileLabel??null,state:n,reasonCode:u.reasonCode??null,startedAt:r?.startedAt??d,finishedAt:n===`running`?null:d}].slice(-16),a=u.reasonCode===`runtime-restart-required`?`required`:t.runtimeRecovery;return{...e,[u.sessionRef]:{...t,operationRef:u.operationRef??t.operationRef,messageRequestId:p??t.messageRequestId,activities:i,complete:!1,delivery:t.user?`admitted`:t.delivery,runtimeRecovery:a,startedAt:t.startedAt??d,lastEventAt:d}}}),o.kind===`runtime.changed`&&typeof u?.sessionRef==`string`&&s(e=>{let t=[`running`,`paused`,`waiting-approval`].includes(String(u.liveState)),n=v(e[u.sessionRef])??(t&&typeof u.operationRef==`string`?{user:``,assistant:``,attachments:[],activities:[],operationRef:u.operationRef,messageRequestId:p,abortable:!0,complete:!1,settlement:null,error:null,runtimeRecovery:null}:null);if(!n)return e;let r=u.reasonCode===`runtime-restart-required`?`restarting`:u.reasonCode===`runtime-restart-failed`?`failed`:[`required`,`restarting`].includes(String(n.runtimeRecovery))&&u.liveState===`idle`?`recovered`:n.runtimeRecovery;return t?{...e,[u.sessionRef]:{...n,operationRef:u.operationRef??n.operationRef,messageRequestId:p??n.messageRequestId,abortable:!0,complete:!1,settlement:null,delivery:n.user?`admitted`:n.delivery,runtimeRecovery:r,startedAt:n.startedAt??d,lastEventAt:d}}:!n.complete&&u.operationRef===null?{...e,[u.sessionRef]:{...n,assistant:``,activities:[],abortable:!1,complete:!0,settlement:`unknown`,messageRequestId:p??n.messageRequestId,error:u.reasonCode??`operation-settlement-unknown`,runtimeRecovery:r,lastEventAt:d}}:r===n.runtimeRecovery?e:{...e,[u.sessionRef]:{...n,runtimeRecovery:r}}}),o.kind===`message.completed`&&typeof u?.sessionRef==`string`&&s(e=>{let t=v(e[u.sessionRef]);return{...e,[u.sessionRef]:{...t??{user:``,assistant:``,attachments:[],activities:[],operationRef:u.operationRef,error:null},operationRef:u.operationRef,messageRequestId:p??t?.messageRequestId,abortable:!1,complete:!0,settlement:`completed`,delivery:t?.user?`admitted`:t?.delivery,error:null,lastEventAt:d}}}),o.kind===`operation.settled`&&typeof u?.sessionRef==`string`&&typeof u.operationRef==`string`){s(e=>{let t=v(e[u.sessionRef])??{user:``,assistant:``,attachments:[],activities:[],operationRef:u.operationRef,complete:!1,error:null,runtimeRecovery:null};return t.operationRef&&t.operationRef!==u.operationRef?e:{...e,[u.sessionRef]:{..._g(t,{operationRef:u.operationRef,settlement:u.settlement,reasonCode:u.reasonCode}),messageRequestId:p??t.messageRequestId,lastEventAt:d}}});let e=mg({operationRef:u.operationRef,settlement:u.settlement,reasonCode:u.reasonCode,settledAt:o.generatedAt,sequence:y});e&&l(t=>({...t,[u.sessionRef]:hg(t[u.sessionRef]??[],[e])}))}[`catalog.changed`,`session.changed`,`runtime.changed`,`message.completed`,`operation.settled`].includes(String(o.kind))&&c(),[`session.changed`,`tool.completed`,`operation.settled`].includes(String(o.kind))&&typeof u?.sessionRef==`string`&&window.dispatchEvent(new CustomEvent(`piagent-workspace-changed`,{detail:{sessionRef:u.sessionRef}}))}}),S.addEventListener(`close`,()=>{window.clearTimeout(C);for(let e of b.current.values())window.clearTimeout(e.timeout),e.reject(new Zb(`gateway-connection-lost`,!0));if(b.current.clear(),!e){if(a(`reconnecting`),i){i=!1,y();return}n+=1,t=window.setTimeout(v,Math.min(5e3,250*2**Math.min(n,5)))}}),S.addEventListener(`error`,()=>{})},y=async()=>{if(e||bt())return;let r=await S({requireLiveState:!0});if(!e){if(r){n=0,v();return}a(`reconnecting`),n+=1,t=window.setTimeout(()=>void y(),Math.min(5e3,250*2**Math.min(n,5)))}};(async()=>{let t=await St();if(!e){if(t===`failed`){a(`failed`);return}await y()}})();let C=()=>{!e&&document.visibilityState===`visible`&&S()};return document.addEventListener(`visibilitychange`,C),()=>{e=!0,t&&window.clearTimeout(t),o.stop();for(let e of b.current.values())window.clearTimeout(e.timeout),e.reject(new Zb(`gateway-client-unmounted`,!0));b.current.clear(),d.current?.close(1e3,`client-unmount`),document.removeEventListener(`visibilitychange`,C)}},[x,S]),{catalog:e,capabilities:n,connection:i,live:o,terminalActivities:c,refresh:S,create:T,send:E,abort:D,restart:O,setModel:A,setThinking:j,setPermission:M,setFast:N,rename:F,pin:I,archive:ee,unarchive:te,fork:L}}var sx=document.getElementById(`root`);if(!sx)throw Error(`Piagent WebUI root is missing`);var cx=document.querySelector(`meta[name="csp-nonce"]`)?.content,lx=h({key:`piagent-mui`,nonce:cx&&!cx.startsWith(`__PIAGENT_`)?cx:void 0,prepend:!0});function ux(){let e=Vb();return(0,X.jsx)(nf,{...e})}function dx(){let e=ox();return(0,X.jsx)(Dh,{children:(0,X.jsx)(Eb,{...e})})}function fx(e,t,n){try{let r=window.localStorage.getItem(e);return r&&t.includes(r)?r:n}catch{return n}}function px(){let[e,t]=(0,Y.useState)(()=>fx(`piagent-webui-locale`,[`vi`,`en`],jb(window.navigator?.languages??[window.navigator?.language??``]))),[n,r]=(0,Y.useState)(()=>fx(`piagent-webui-theme`,O.map(e=>e.id),``)||_[fx(`piagent-webui-color-mode`,[`light`,`dark`],window.matchMedia?.(`(prefers-color-scheme: light)`).matches?`light`:`dark`)]),i=A(n)??A(_.dark),a=i.mode,o=(0,Y.useCallback)(e=>r(t=>A(t)?.mode===e?t:_[e]),[]),s=(0,Y.useMemo)(()=>Ab(i),[i]);(0,Y.useEffect)(()=>{document.documentElement.lang=e,document.documentElement.dataset.piagentColorMode=a,document.documentElement.dataset.piagentTheme=i.id;try{window.localStorage.setItem(`piagent-webui-locale`,e),window.localStorage.setItem(`piagent-webui-color-mode`,a),window.localStorage.setItem(`piagent-webui-theme`,i.id)}catch{}},[a,e,i]);let c=(0,Y.useMemo)(()=>({locale:e,colorMode:a,themeId:i.id,setLocale:t,setColorMode:o,setThemeId:r}),[a,e,i,o]),l=document.querySelector(`meta[name="piagent-webui-mode"]`)?.content;return(0,X.jsx)(j,{value:c,children:(0,X.jsxs)(jn,{theme:s,children:[(0,X.jsx)(vn,{}),l===`gateway`?(0,X.jsx)(dx,{}):(0,X.jsx)(ux,{})]})})}(0,xo.createRoot)(sx).render((0,X.jsx)(Y.StrictMode,{children:(0,X.jsx)(r,{value:lx,children:(0,X.jsx)(px,{})})}));export{Q as C,Z as E,No as S,lr as T,Fs as _,Hp as a,Uo as b,Dl as c,ll as d,fl as f,Gc as g,pl as h,Tm as i,Sl as l,ml as m,oh as n,Su as o,gl as p,Pm as r,Al as s,Yb as t,il as u,pc as v,Ar as w,Lo as x,us as y};