@jingyi0605/codingns 0.3.0 → 0.3.6
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.
- package/README.md +13 -0
- package/bin/codingns.mjs +880 -9
- package/dist/public/assets/{TerminalPage-Dfw1QUqW.js → TerminalPage-D00S4KM6.js} +19 -19
- package/dist/public/assets/index-BlOinYqR.js +122 -0
- package/dist/public/assets/index-Dg_7g6lA.css +1 -0
- package/dist/public/index.html +2 -2
- package/dist/server/config/env.d.ts +2 -0
- package/dist/server/config/env.js +35 -0
- package/dist/server/config/env.js.map +1 -1
- package/dist/server/config/opencode-base-url-resolver.d.ts +7 -0
- package/dist/server/config/opencode-base-url-resolver.js +48 -11
- package/dist/server/config/opencode-base-url-resolver.js.map +1 -1
- package/dist/server/config/opencode-system-probe-helper-client.d.ts +4 -0
- package/dist/server/config/opencode-system-probe-helper-client.js +29 -0
- package/dist/server/config/opencode-system-probe-helper-client.js.map +1 -1
- package/dist/server/config/opencode-system-probe-helper-process.d.ts +12 -0
- package/dist/server/config/opencode-system-probe-helper-process.js +34 -7
- package/dist/server/config/opencode-system-probe-helper-process.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +144 -0
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js +242 -1
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +133 -2
- package/dist/server/modules/assistant-capability/assistant-capability-service.js +395 -2
- package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
- package/dist/server/modules/auth/auth-service.d.ts +18 -1
- package/dist/server/modules/auth/auth-service.js +168 -7
- package/dist/server/modules/auth/auth-service.js.map +1 -1
- package/dist/server/modules/butler/butler-codex-model-policy.d.ts +1 -0
- package/dist/server/modules/butler/butler-codex-model-policy.js +36 -0
- package/dist/server/modules/butler/butler-codex-model-policy.js.map +1 -0
- package/dist/server/modules/butler/butler-control-session-service.d.ts +13 -1
- package/dist/server/modules/butler/butler-control-session-service.js +55 -231
- package/dist/server/modules/butler/butler-control-session-service.js.map +1 -1
- package/dist/server/modules/butler/butler-controller.d.ts +17 -0
- package/dist/server/modules/butler/butler-controller.js +20 -1
- package/dist/server/modules/butler/butler-controller.js.map +1 -1
- package/dist/server/modules/butler/butler-follow-up-service.js +7 -3
- package/dist/server/modules/butler/butler-follow-up-service.js.map +1 -1
- package/dist/server/modules/butler/butler-inbox-analysis-service.d.ts +36 -0
- package/dist/server/modules/butler/butler-inbox-analysis-service.js +375 -0
- package/dist/server/modules/butler/butler-inbox-analysis-service.js.map +1 -0
- package/dist/server/modules/butler/butler-inbox-instruction-adapter.d.ts +23 -0
- package/dist/server/modules/butler/butler-inbox-instruction-adapter.js +97 -0
- package/dist/server/modules/butler/butler-inbox-instruction-adapter.js.map +1 -0
- package/dist/server/modules/butler/butler-inbox-service.d.ts +39 -2
- package/dist/server/modules/butler/butler-inbox-service.js +392 -2
- package/dist/server/modules/butler/butler-inbox-service.js.map +1 -1
- package/dist/server/modules/butler/butler-session-service.d.ts +8 -0
- package/dist/server/modules/butler/butler-session-service.js +205 -53
- package/dist/server/modules/butler/butler-session-service.js.map +1 -1
- package/dist/server/modules/butler/butler-session-summary-service.d.ts +1 -0
- package/dist/server/modules/butler/butler-session-summary-service.js +48 -23
- package/dist/server/modules/butler/butler-session-summary-service.js.map +1 -1
- package/dist/server/modules/butler/butler-workspace-context.d.ts +13 -0
- package/dist/server/modules/butler/butler-workspace-context.js +234 -0
- package/dist/server/modules/butler/butler-workspace-context.js.map +1 -0
- package/dist/server/modules/client/client-controller.d.ts +6 -0
- package/dist/server/modules/client/client-controller.js +30 -8
- package/dist/server/modules/client/client-controller.js.map +1 -1
- package/dist/server/modules/client/client-service.d.ts +22 -10
- package/dist/server/modules/client/client-service.js +77 -100
- package/dist/server/modules/client/client-service.js.map +1 -1
- package/dist/server/modules/client/npm-global-package-service.d.ts +21 -0
- package/dist/server/modules/client/npm-global-package-service.js +210 -0
- package/dist/server/modules/client/npm-global-package-service.js.map +1 -0
- package/dist/server/modules/client/service-update-task-service.d.ts +15 -0
- package/dist/server/modules/client/service-update-task-service.js +147 -0
- package/dist/server/modules/client/service-update-task-service.js.map +1 -0
- package/dist/server/modules/client/service-update-types.d.ts +30 -0
- package/dist/server/modules/client/service-update-types.js +2 -0
- package/dist/server/modules/client/service-update-types.js.map +1 -0
- package/dist/server/modules/debug-target/debug-target-controller.d.ts +13 -0
- package/dist/server/modules/debug-target/debug-target-controller.js +77 -2
- package/dist/server/modules/debug-target/debug-target-controller.js.map +1 -1
- package/dist/server/modules/debug-target/debug-target-service.d.ts +11 -2
- package/dist/server/modules/debug-target/debug-target-service.js +138 -3
- package/dist/server/modules/debug-target/debug-target-service.js.map +1 -1
- package/dist/server/modules/git/git-command-helper-client.d.ts +2 -0
- package/dist/server/modules/git/git-command-helper-client.js +52 -3
- package/dist/server/modules/git/git-command-helper-client.js.map +1 -1
- package/dist/server/modules/git/git-command-helper-process.js +62 -9
- package/dist/server/modules/git/git-command-helper-process.js.map +1 -1
- package/dist/server/modules/git/git-command-runner.d.ts +1 -0
- package/dist/server/modules/git/git-command-runner.js +25 -0
- package/dist/server/modules/git/git-command-runner.js.map +1 -1
- package/dist/server/modules/git/git-controller.js +8 -7
- package/dist/server/modules/git/git-controller.js.map +1 -1
- package/dist/server/modules/git/git-read-service.d.ts +7 -7
- package/dist/server/modules/git/git-read-service.js +41 -24
- package/dist/server/modules/git/git-read-service.js.map +1 -1
- package/dist/server/modules/model-switch/cc-switch-adapter.d.ts +36 -0
- package/dist/server/modules/model-switch/cc-switch-adapter.js +321 -0
- package/dist/server/modules/model-switch/cc-switch-adapter.js.map +1 -0
- package/dist/server/modules/model-switch/model-switch-controller.d.ts +11 -0
- package/dist/server/modules/model-switch/model-switch-controller.js +30 -0
- package/dist/server/modules/model-switch/model-switch-controller.js.map +1 -0
- package/dist/server/modules/model-switch/model-switch-service.d.ts +16 -0
- package/dist/server/modules/model-switch/model-switch-service.js +29 -0
- package/dist/server/modules/model-switch/model-switch-service.js.map +1 -0
- package/dist/server/modules/preferences/profile-service.d.ts +1 -0
- package/dist/server/modules/preferences/profile-service.js +9 -0
- package/dist/server/modules/preferences/profile-service.js.map +1 -1
- package/dist/server/modules/provider/codex-model-options.js +2 -3
- package/dist/server/modules/provider/codex-model-options.js.map +1 -1
- package/dist/server/modules/provider/opencode-model-options.js +2 -3
- package/dist/server/modules/provider/opencode-model-options.js.map +1 -1
- package/dist/server/modules/provider/provider-discovery-helper-client.d.ts +9 -4
- package/dist/server/modules/provider/provider-discovery-helper-client.js +87 -11
- package/dist/server/modules/provider/provider-discovery-helper-client.js.map +1 -1
- package/dist/server/modules/provider/provider-discovery-helper-process.js +52 -47
- package/dist/server/modules/provider/provider-discovery-helper-process.js.map +1 -1
- package/dist/server/modules/provider/provider-discovery-runtime.d.ts +4 -0
- package/dist/server/modules/provider/provider-discovery-runtime.js +65 -0
- package/dist/server/modules/provider/provider-discovery-runtime.js.map +1 -0
- package/dist/server/modules/sessions/codex-app-server-helper-process.js +3 -0
- package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -1
- package/dist/server/modules/sessions/session-activity-authority-service.d.ts +3 -1
- package/dist/server/modules/sessions/session-activity-authority-service.js +3 -0
- package/dist/server/modules/sessions/session-activity-authority-service.js.map +1 -1
- package/dist/server/modules/sessions/session-activity-inspector.d.ts +1 -1
- package/dist/server/modules/sessions/session-activity-inspector.js +43 -16
- package/dist/server/modules/sessions/session-activity-inspector.js.map +1 -1
- package/dist/server/modules/sessions/session-controller.d.ts +3 -3
- package/dist/server/modules/sessions/session-controller.js +3 -3
- package/dist/server/modules/sessions/session-controller.js.map +1 -1
- package/dist/server/modules/sessions/session-history-service.d.ts +8 -2
- package/dist/server/modules/sessions/session-history-service.js +473 -65
- package/dist/server/modules/sessions/session-history-service.js.map +1 -1
- package/dist/server/modules/sessions/session-live-runtime-service.d.ts +9 -3
- package/dist/server/modules/sessions/session-live-runtime-service.js +114 -34
- package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
- package/dist/server/modules/sessions/session-message-attachment-service.d.ts +8 -8
- package/dist/server/modules/sessions/session-message-attachment-service.js +25 -34
- package/dist/server/modules/sessions/session-message-attachment-service.js.map +1 -1
- package/dist/server/modules/sessions/session-provider-error-mapper.js +7 -0
- package/dist/server/modules/sessions/session-provider-error-mapper.js.map +1 -1
- package/dist/server/modules/skills/builtin-skill-service.d.ts +12 -0
- package/dist/server/modules/skills/builtin-skill-service.js +49 -0
- package/dist/server/modules/skills/builtin-skill-service.js.map +1 -0
- package/dist/server/modules/skills/builtin-skills/codingns-assistant/SKILL.md +75 -0
- package/dist/server/modules/skills/builtin-skills/codingns-assistant/agents/openai.yaml +4 -0
- package/dist/server/modules/skills/builtin-skills/codingns-assistant/references/cli-workflow.md +130 -0
- package/dist/server/modules/skills/skill-manager-service.d.ts +7 -0
- package/dist/server/modules/skills/skill-manager-service.js +98 -0
- package/dist/server/modules/skills/skill-manager-service.js.map +1 -1
- package/dist/server/modules/tailscale/tailscale-helper-client.d.ts +1 -0
- package/dist/server/modules/tailscale/tailscale-helper-client.js +12 -0
- package/dist/server/modules/tailscale/tailscale-helper-client.js.map +1 -1
- package/dist/server/modules/tailscale/tailscale-manager.js +5 -1
- package/dist/server/modules/tailscale/tailscale-manager.js.map +1 -1
- package/dist/server/modules/tasks/task-helper-client.d.ts +5 -0
- package/dist/server/modules/tasks/task-helper-client.js +45 -0
- package/dist/server/modules/tasks/task-helper-client.js.map +1 -1
- package/dist/server/modules/tasks/task-helper-process-handlers.d.ts +10 -3
- package/dist/server/modules/tasks/task-helper-process-handlers.js +7 -5
- package/dist/server/modules/tasks/task-helper-process-handlers.js.map +1 -1
- package/dist/server/modules/tasks/task-helper-process.js +11 -1
- package/dist/server/modules/tasks/task-helper-process.js.map +1 -1
- package/dist/server/modules/tasks/task-lane-executors.js +5 -2
- package/dist/server/modules/tasks/task-lane-executors.js.map +1 -1
- package/dist/server/modules/tasks/task-types.d.ts +3 -0
- package/dist/server/modules/tasks/task-types.js +4 -1
- package/dist/server/modules/tasks/task-types.js.map +1 -1
- package/dist/server/modules/terminal/command-template-service.d.ts +2 -2
- package/dist/server/modules/terminal/command-template-service.js +14 -5
- package/dist/server/modules/terminal/command-template-service.js.map +1 -1
- package/dist/server/modules/terminal/runtime/terminal-log-writer-client.js +1 -1
- package/dist/server/modules/terminal/runtime/terminal-log-writer-client.js.map +1 -1
- package/dist/server/modules/terminal/runtime/terminal-log-writer-process.js +160 -11
- package/dist/server/modules/terminal/runtime/terminal-log-writer-process.js.map +1 -1
- package/dist/server/modules/terminal/template-port-runtime.d.ts +13 -2
- package/dist/server/modules/terminal/template-port-runtime.js +266 -44
- package/dist/server/modules/terminal/template-port-runtime.js.map +1 -1
- package/dist/server/modules/terminal/terminal-service.d.ts +4 -0
- package/dist/server/modules/terminal/terminal-service.js +65 -4
- package/dist/server/modules/terminal/terminal-service.js.map +1 -1
- package/dist/server/modules/workbench/workbench-service.js +3 -3
- package/dist/server/modules/workbench/workbench-service.js.map +1 -1
- package/dist/server/modules/workbench/workspace-panel-snapshot-service.d.ts +1 -0
- package/dist/server/modules/workbench/workspace-panel-snapshot-service.js +118 -39
- package/dist/server/modules/workbench/workspace-panel-snapshot-service.js.map +1 -1
- package/dist/server/modules/workspace/workspace-code-composition.d.ts +1 -0
- package/dist/server/modules/workspace/workspace-code-composition.js +277 -2
- package/dist/server/modules/workspace/workspace-code-composition.js.map +1 -1
- package/dist/server/modules/workspace/workspace-service.js +54 -17
- package/dist/server/modules/workspace/workspace-service.js.map +1 -1
- package/dist/server/modules/worktree/worktree-cleanup-service.d.ts +1 -1
- package/dist/server/modules/worktree/worktree-cleanup-service.js +22 -17
- package/dist/server/modules/worktree/worktree-cleanup-service.js.map +1 -1
- package/dist/server/modules/worktree/worktree-controller.js +6 -5
- package/dist/server/modules/worktree/worktree-controller.js.map +1 -1
- package/dist/server/modules/worktree/worktree-manager.d.ts +1 -1
- package/dist/server/modules/worktree/worktree-manager.js +26 -19
- package/dist/server/modules/worktree/worktree-manager.js.map +1 -1
- package/dist/server/modules/worktree/worktree-merge-service.d.ts +2 -2
- package/dist/server/modules/worktree/worktree-merge-service.js +34 -27
- package/dist/server/modules/worktree/worktree-merge-service.js.map +1 -1
- package/dist/server/modules/worktree/worktree-sync-service.d.ts +1 -1
- package/dist/server/modules/worktree/worktree-sync-service.js +5 -3
- package/dist/server/modules/worktree/worktree-sync-service.js.map +1 -1
- package/dist/server/routes/assistant.js +24 -0
- package/dist/server/routes/assistant.js.map +1 -1
- package/dist/server/routes/butler.js +4 -0
- package/dist/server/routes/butler.js.map +1 -1
- package/dist/server/routes/client.js +2 -0
- package/dist/server/routes/client.js.map +1 -1
- package/dist/server/routes/sessions.js +1 -1
- package/dist/server/routes/sessions.js.map +1 -1
- package/dist/server/routes/system.d.ts +2 -1
- package/dist/server/routes/system.js +3 -1
- package/dist/server/routes/system.js.map +1 -1
- package/dist/server/server/create-server.d.ts +4 -0
- package/dist/server/server/create-server.js +67 -8
- package/dist/server/server/create-server.js.map +1 -1
- package/dist/server/shared/errors/app-error.d.ts +2 -0
- package/dist/server/shared/errors/app-error.js +2 -0
- package/dist/server/shared/errors/app-error.js.map +1 -1
- package/dist/server/shared/http/error-handler.d.ts +2 -1
- package/dist/server/shared/http/error-handler.js +3 -2
- package/dist/server/shared/http/error-handler.js.map +1 -1
- package/dist/server/shared/http/request-abort.d.ts +2 -0
- package/dist/server/shared/http/request-abort.js +38 -0
- package/dist/server/shared/http/request-abort.js.map +1 -0
- package/dist/server/storage/repositories/auth-login-attempt-repository.d.ts +9 -0
- package/dist/server/storage/repositories/auth-login-attempt-repository.js +59 -0
- package/dist/server/storage/repositories/auth-login-attempt-repository.js.map +1 -0
- package/dist/server/storage/repositories/butler-control-session-repository.d.ts +3 -0
- package/dist/server/storage/repositories/butler-control-session-repository.js +80 -4
- package/dist/server/storage/repositories/butler-control-session-repository.js.map +1 -1
- package/dist/server/storage/repositories/butler-inbox-item-repository.js +54 -3
- package/dist/server/storage/repositories/butler-inbox-item-repository.js.map +1 -1
- package/dist/server/storage/repositories/terminal-instance-repository.js +1 -1
- package/dist/server/storage/repositories/terminal-instance-repository.js.map +1 -1
- package/dist/server/storage/repositories/user-preference-profile-repository.js +6 -3
- package/dist/server/storage/repositories/user-preference-profile-repository.js.map +1 -1
- package/dist/server/storage/sqlite/client.js +127 -0
- package/dist/server/storage/sqlite/client.js.map +1 -1
- package/dist/server/storage/sqlite/schema.sql +19 -1
- package/dist/server/types/domain.d.ts +37 -1
- package/dist/server/ws/workbench-ws-hub.d.ts +1 -0
- package/dist/server/ws/workbench-ws-hub.js +25 -3
- package/dist/server/ws/workbench-ws-hub.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.d.ts +23 -0
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.js +162 -0
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +1 -0
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +89 -33
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js +18 -2
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +3 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +238 -53
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js +1 -0
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +6 -2
- package/node_modules/@codingns/session-sync-core/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.mjs +33 -0
- package/dist/public/assets/index-DR2rPNi7.css +0 -1
- package/dist/public/assets/index-DTOruahn.js +0 -114
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPage-Dfw1QUqW.js","assets/TerminalPage-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
var WM=Object.defineProperty;var UM=(e,t,r)=>t in e?WM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var tt=(e,t,r)=>UM(e,typeof t!="symbol"?t+"":t,r);function Yj(e,t){for(var r=0;r<t.length;r++){const i=t[r];if(typeof i!="string"&&!Array.isArray(i)){for(const a in i)if(a!=="default"&&!(a in e)){const c=Object.getOwnPropertyDescriptor(i,a);c&&Object.defineProperty(e,a,c.get?c:{enumerable:!0,get:()=>i[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(a){if(a.ep)return;a.ep=!0;const c=r(a);fetch(a.href,c)}})();function uu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yp={exports:{}},lc={},Xp={exports:{}},yn={};/**
|
|
3
|
-
* @license React
|
|
4
|
-
* react.production.min.js
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
7
|
-
*
|
|
8
|
-
* This source code is licensed under the MIT license found in the
|
|
9
|
-
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var sk;function HM(){if(sk)return yn;sk=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),g=Symbol.iterator;function v(B){return B===null||typeof B!="object"?null:(B=g&&B[g]||B["@@iterator"],typeof B=="function"?B:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,C={};function j(B,Q,_){this.props=B,this.context=Q,this.refs=C,this.updater=_||y}j.prototype.isReactComponent={},j.prototype.setState=function(B,Q){if(typeof B!="object"&&typeof B!="function"&&B!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,B,Q,"setState")},j.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function N(){}N.prototype=j.prototype;function P(B,Q,_){this.props=B,this.context=Q,this.refs=C,this.updater=_||y}var L=P.prototype=new N;L.constructor=P,x(L,j.prototype),L.isPureReactComponent=!0;var Y=Array.isArray,H=Object.prototype.hasOwnProperty,W={current:null},I={key:!0,ref:!0,__self:!0,__source:!0};function M(B,Q,_){var de,le={},oe=null,ye=null;if(Q!=null)for(de in Q.ref!==void 0&&(ye=Q.ref),Q.key!==void 0&&(oe=""+Q.key),Q)H.call(Q,de)&&!I.hasOwnProperty(de)&&(le[de]=Q[de]);var Ne=arguments.length-2;if(Ne===1)le.children=_;else if(1<Ne){for(var Me=Array(Ne),Te=0;Te<Ne;Te++)Me[Te]=arguments[Te+2];le.children=Me}if(B&&B.defaultProps)for(de in Ne=B.defaultProps,Ne)le[de]===void 0&&(le[de]=Ne[de]);return{$$typeof:e,type:B,key:oe,ref:ye,props:le,_owner:W.current}}function O(B,Q){return{$$typeof:e,type:B.type,key:Q,ref:B.ref,props:B.props,_owner:B._owner}}function F(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function X(B){var Q={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(_){return Q[_]})}var U=/\/+/g;function G(B,Q){return typeof B=="object"&&B!==null&&B.key!=null?X(""+B.key):Q.toString(36)}function R(B,Q,_,de,le){var oe=typeof B;(oe==="undefined"||oe==="boolean")&&(B=null);var ye=!1;if(B===null)ye=!0;else switch(oe){case"string":case"number":ye=!0;break;case"object":switch(B.$$typeof){case e:case t:ye=!0}}if(ye)return ye=B,le=le(ye),B=de===""?"."+G(ye,0):de,Y(le)?(_="",B!=null&&(_=B.replace(U,"$&/")+"/"),R(le,Q,_,"",function(Te){return Te})):le!=null&&(F(le)&&(le=O(le,_+(!le.key||ye&&ye.key===le.key?"":(""+le.key).replace(U,"$&/")+"/")+B)),Q.push(le)),1;if(ye=0,de=de===""?".":de+":",Y(B))for(var Ne=0;Ne<B.length;Ne++){oe=B[Ne];var Me=de+G(oe,Ne);ye+=R(oe,Q,_,Me,le)}else if(Me=v(B),typeof Me=="function")for(B=Me.call(B),Ne=0;!(oe=B.next()).done;)oe=oe.value,Me=de+G(oe,Ne++),ye+=R(oe,Q,_,Me,le);else if(oe==="object")throw Q=String(B),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.");return ye}function A(B,Q,_){if(B==null)return B;var de=[],le=0;return R(B,de,"","",function(oe){return Q.call(_,oe,le++)}),de}function Z(B){if(B._status===-1){var Q=B._result;Q=Q(),Q.then(function(_){(B._status===0||B._status===-1)&&(B._status=1,B._result=_)},function(_){(B._status===0||B._status===-1)&&(B._status=2,B._result=_)}),B._status===-1&&(B._status=0,B._result=Q)}if(B._status===1)return B._result.default;throw B._result}var pe={current:null},q={transition:null},D={ReactCurrentDispatcher:pe,ReactCurrentBatchConfig:q,ReactCurrentOwner:W};function T(){throw Error("act(...) is not supported in production builds of React.")}return yn.Children={map:A,forEach:function(B,Q,_){A(B,function(){Q.apply(this,arguments)},_)},count:function(B){var Q=0;return A(B,function(){Q++}),Q},toArray:function(B){return A(B,function(Q){return Q})||[]},only:function(B){if(!F(B))throw Error("React.Children.only expected to receive a single React element child.");return B}},yn.Component=j,yn.Fragment=r,yn.Profiler=a,yn.PureComponent=P,yn.StrictMode=i,yn.Suspense=m,yn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=D,yn.act=T,yn.cloneElement=function(B,Q,_){if(B==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+B+".");var de=x({},B.props),le=B.key,oe=B.ref,ye=B._owner;if(Q!=null){if(Q.ref!==void 0&&(oe=Q.ref,ye=W.current),Q.key!==void 0&&(le=""+Q.key),B.type&&B.type.defaultProps)var Ne=B.type.defaultProps;for(Me in Q)H.call(Q,Me)&&!I.hasOwnProperty(Me)&&(de[Me]=Q[Me]===void 0&&Ne!==void 0?Ne[Me]:Q[Me])}var Me=arguments.length-2;if(Me===1)de.children=_;else if(1<Me){Ne=Array(Me);for(var Te=0;Te<Me;Te++)Ne[Te]=arguments[Te+2];de.children=Ne}return{$$typeof:e,type:B.type,key:le,ref:oe,props:de,_owner:ye}},yn.createContext=function(B){return B={$$typeof:u,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},B.Provider={$$typeof:c,_context:B},B.Consumer=B},yn.createElement=M,yn.createFactory=function(B){var Q=M.bind(null,B);return Q.type=B,Q},yn.createRef=function(){return{current:null}},yn.forwardRef=function(B){return{$$typeof:d,render:B}},yn.isValidElement=F,yn.lazy=function(B){return{$$typeof:w,_payload:{_status:-1,_result:B},_init:Z}},yn.memo=function(B,Q){return{$$typeof:f,type:B,compare:Q===void 0?null:Q}},yn.startTransition=function(B){var Q=q.transition;q.transition={};try{B()}finally{q.transition=Q}},yn.unstable_act=T,yn.useCallback=function(B,Q){return pe.current.useCallback(B,Q)},yn.useContext=function(B){return pe.current.useContext(B)},yn.useDebugValue=function(){},yn.useDeferredValue=function(B){return pe.current.useDeferredValue(B)},yn.useEffect=function(B,Q){return pe.current.useEffect(B,Q)},yn.useId=function(){return pe.current.useId()},yn.useImperativeHandle=function(B,Q,_){return pe.current.useImperativeHandle(B,Q,_)},yn.useInsertionEffect=function(B,Q){return pe.current.useInsertionEffect(B,Q)},yn.useLayoutEffect=function(B,Q){return pe.current.useLayoutEffect(B,Q)},yn.useMemo=function(B,Q){return pe.current.useMemo(B,Q)},yn.useReducer=function(B,Q,_){return pe.current.useReducer(B,Q,_)},yn.useRef=function(B){return pe.current.useRef(B)},yn.useState=function(B){return pe.current.useState(B)},yn.useSyncExternalStore=function(B,Q,_){return pe.current.useSyncExternalStore(B,Q,_)},yn.useTransition=function(){return pe.current.useTransition()},yn.version="18.3.1",yn}var ak;function vb(){return ak||(ak=1,Xp.exports=HM()),Xp.exports}/**
|
|
11
|
-
* @license React
|
|
12
|
-
* react-jsx-runtime.production.min.js
|
|
13
|
-
*
|
|
14
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the MIT license found in the
|
|
17
|
-
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var ok;function zM(){if(ok)return lc;ok=1;var e=vb(),t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function u(d,m,f){var w,g={},v=null,y=null;f!==void 0&&(v=""+f),m.key!==void 0&&(v=""+m.key),m.ref!==void 0&&(y=m.ref);for(w in m)i.call(m,w)&&!c.hasOwnProperty(w)&&(g[w]=m[w]);if(d&&d.defaultProps)for(w in m=d.defaultProps,m)g[w]===void 0&&(g[w]=m[w]);return{$$typeof:t,type:d,key:v,ref:y,props:g,_owner:a.current}}return lc.Fragment=r,lc.jsx=u,lc.jsxs=u,lc}var lk;function qM(){return lk||(lk=1,Yp.exports=zM()),Yp.exports}var n=qM(),vd={},Qp={exports:{}},Si={},Jp={exports:{}},Zp={};/**
|
|
19
|
-
* @license React
|
|
20
|
-
* scheduler.production.min.js
|
|
21
|
-
*
|
|
22
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the MIT license found in the
|
|
25
|
-
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var ck;function $M(){return ck||(ck=1,(function(e){function t(q,D){var T=q.length;q.push(D);e:for(;0<T;){var B=T-1>>>1,Q=q[B];if(0<a(Q,D))q[B]=D,q[T]=Q,T=B;else break e}}function r(q){return q.length===0?null:q[0]}function i(q){if(q.length===0)return null;var D=q[0],T=q.pop();if(T!==D){q[0]=T;e:for(var B=0,Q=q.length,_=Q>>>1;B<_;){var de=2*(B+1)-1,le=q[de],oe=de+1,ye=q[oe];if(0>a(le,T))oe<Q&&0>a(ye,le)?(q[B]=ye,q[oe]=T,B=oe):(q[B]=le,q[de]=T,B=de);else if(oe<Q&&0>a(ye,T))q[B]=ye,q[oe]=T,B=oe;else break e}}return D}function a(q,D){var T=q.sortIndex-D.sortIndex;return T!==0?T:q.id-D.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var m=[],f=[],w=1,g=null,v=3,y=!1,x=!1,C=!1,j=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,P=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function L(q){for(var D=r(f);D!==null;){if(D.callback===null)i(f);else if(D.startTime<=q)i(f),D.sortIndex=D.expirationTime,t(m,D);else break;D=r(f)}}function Y(q){if(C=!1,L(q),!x)if(r(m)!==null)x=!0,Z(H);else{var D=r(f);D!==null&&pe(Y,D.startTime-q)}}function H(q,D){x=!1,C&&(C=!1,N(M),M=-1),y=!0;var T=v;try{for(L(D),g=r(m);g!==null&&(!(g.expirationTime>D)||q&&!X());){var B=g.callback;if(typeof B=="function"){g.callback=null,v=g.priorityLevel;var Q=B(g.expirationTime<=D);D=e.unstable_now(),typeof Q=="function"?g.callback=Q:g===r(m)&&i(m),L(D)}else i(m);g=r(m)}if(g!==null)var _=!0;else{var de=r(f);de!==null&&pe(Y,de.startTime-D),_=!1}return _}finally{g=null,v=T,y=!1}}var W=!1,I=null,M=-1,O=5,F=-1;function X(){return!(e.unstable_now()-F<O)}function U(){if(I!==null){var q=e.unstable_now();F=q;var D=!0;try{D=I(!0,q)}finally{D?G():(W=!1,I=null)}}else W=!1}var G;if(typeof P=="function")G=function(){P(U)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,A=R.port2;R.port1.onmessage=U,G=function(){A.postMessage(null)}}else G=function(){j(U,0)};function Z(q){I=q,W||(W=!0,G())}function pe(q,D){M=j(function(){q(e.unstable_now())},D)}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(q){q.callback=null},e.unstable_continueExecution=function(){x||y||(x=!0,Z(H))},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_getFirstCallbackNode=function(){return r(m)},e.unstable_next=function(q){switch(v){case 1:case 2:case 3:var D=3;break;default:D=v}var T=v;v=D;try{return q()}finally{v=T}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(q,D){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var T=v;v=q;try{return D()}finally{v=T}},e.unstable_scheduleCallback=function(q,D,T){var B=e.unstable_now();switch(typeof T=="object"&&T!==null?(T=T.delay,T=typeof T=="number"&&0<T?B+T:B):T=B,q){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=T+Q,q={id:w++,callback:D,priorityLevel:q,startTime:T,expirationTime:Q,sortIndex:-1},T>B?(q.sortIndex=T,t(f,q),r(m)===null&&q===r(f)&&(C?(N(M),M=-1):C=!0,pe(Y,T-B))):(q.sortIndex=Q,t(m,q),x||y||(x=!0,Z(H))),q},e.unstable_shouldYield=X,e.unstable_wrapCallback=function(q){var D=v;return function(){var T=v;v=D;try{return q.apply(this,arguments)}finally{v=T}}}})(Zp)),Zp}var uk;function VM(){return uk||(uk=1,Jp.exports=$M()),Jp.exports}/**
|
|
27
|
-
* @license React
|
|
28
|
-
* react-dom.production.min.js
|
|
29
|
-
*
|
|
30
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
31
|
-
*
|
|
32
|
-
* This source code is licensed under the MIT license found in the
|
|
33
|
-
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var dk;function GM(){if(dk)return Si;dk=1;var e=vb(),t=VM();function r(s){for(var l="https://reactjs.org/docs/error-decoder.html?invariant="+s,h=1;h<arguments.length;h++)l+="&args[]="+encodeURIComponent(arguments[h]);return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,a={};function c(s,l){u(s,l),u(s+"Capture",l)}function u(s,l){for(a[s]=l,s=0;s<l.length;s++)i.add(l[s])}var d=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),m=Object.prototype.hasOwnProperty,f=/^[: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]*$/,w={},g={};function v(s){return m.call(g,s)?!0:m.call(w,s)?!1:f.test(s)?g[s]=!0:(w[s]=!0,!1)}function y(s,l,h,b){if(h!==null&&h.type===0)return!1;switch(typeof l){case"function":case"symbol":return!0;case"boolean":return b?!1:h!==null?!h.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function x(s,l,h,b){if(l===null||typeof l>"u"||y(s,l,h,b))return!0;if(b)return!1;if(h!==null)switch(h.type){case 3:return!l;case 4:return l===!1;case 5:return isNaN(l);case 6:return isNaN(l)||1>l}return!1}function C(s,l,h,b,k,S,E){this.acceptsBooleans=l===2||l===3||l===4,this.attributeName=b,this.attributeNamespace=k,this.mustUseProperty=h,this.propertyName=s,this.type=l,this.sanitizeURL=S,this.removeEmptyString=E}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){j[s]=new C(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var l=s[0];j[l]=new C(l,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){j[s]=new C(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){j[s]=new C(s,2,!1,s,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(s){j[s]=new C(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){j[s]=new C(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){j[s]=new C(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){j[s]=new C(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){j[s]=new C(s,5,!1,s.toLowerCase(),null,!1,!1)});var N=/[\-:]([a-z])/g;function P(s){return s[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(s){var l=s.replace(N,P);j[l]=new C(l,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var l=s.replace(N,P);j[l]=new C(l,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var l=s.replace(N,P);j[l]=new C(l,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){j[s]=new C(s,1,!1,s.toLowerCase(),null,!1,!1)}),j.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){j[s]=new C(s,1,!1,s.toLowerCase(),null,!0,!0)});function L(s,l,h,b){var k=j.hasOwnProperty(l)?j[l]:null;(k!==null?k.type!==0:b||!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(x(l,h,k,b)&&(h=null),b||k===null?v(l)&&(h===null?s.removeAttribute(l):s.setAttribute(l,""+h)):k.mustUseProperty?s[k.propertyName]=h===null?k.type===3?!1:"":h:(l=k.attributeName,b=k.attributeNamespace,h===null?s.removeAttribute(l):(k=k.type,h=k===3||k===4&&h===!0?"":""+h,b?s.setAttributeNS(b,l,h):s.setAttribute(l,h))))}var Y=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,H=Symbol.for("react.element"),W=Symbol.for("react.portal"),I=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),X=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),G=Symbol.for("react.suspense"),R=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),Z=Symbol.for("react.lazy"),pe=Symbol.for("react.offscreen"),q=Symbol.iterator;function D(s){return s===null||typeof s!="object"?null:(s=q&&s[q]||s["@@iterator"],typeof s=="function"?s:null)}var T=Object.assign,B;function Q(s){if(B===void 0)try{throw Error()}catch(h){var l=h.stack.trim().match(/\n( *(at )?)/);B=l&&l[1]||""}return`
|
|
35
|
-
`+B+s}var _=!1;function de(s,l){if(!s||_)return"";_=!0;var h=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(l)if(l=function(){throw Error()},Object.defineProperty(l.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(l,[])}catch(Pe){var b=Pe}Reflect.construct(s,[],l)}else{try{l.call()}catch(Pe){b=Pe}s.call(l.prototype)}else{try{throw Error()}catch(Pe){b=Pe}s()}}catch(Pe){if(Pe&&b&&typeof Pe.stack=="string"){for(var k=Pe.stack.split(`
|
|
36
|
-
`),S=b.stack.split(`
|
|
37
|
-
`),E=k.length-1,J=S.length-1;1<=E&&0<=J&&k[E]!==S[J];)J--;for(;1<=E&&0<=J;E--,J--)if(k[E]!==S[J]){if(E!==1||J!==1)do if(E--,J--,0>J||k[E]!==S[J]){var ae=`
|
|
38
|
-
`+k[E].replace(" at new "," at ");return s.displayName&&ae.includes("<anonymous>")&&(ae=ae.replace("<anonymous>",s.displayName)),ae}while(1<=E&&0<=J);break}}}finally{_=!1,Error.prepareStackTrace=h}return(s=s?s.displayName||s.name:"")?Q(s):""}function le(s){switch(s.tag){case 5:return Q(s.type);case 16:return Q("Lazy");case 13:return Q("Suspense");case 19:return Q("SuspenseList");case 0:case 2:case 15:return s=de(s.type,!1),s;case 11:return s=de(s.type.render,!1),s;case 1:return s=de(s.type,!0),s;default:return""}}function oe(s){if(s==null)return null;if(typeof s=="function")return s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case I:return"Fragment";case W:return"Portal";case O:return"Profiler";case M:return"StrictMode";case G:return"Suspense";case R:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case X:return(s.displayName||"Context")+".Consumer";case F:return(s._context.displayName||"Context")+".Provider";case U:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case A:return l=s.displayName||null,l!==null?l:oe(s.type)||"Memo";case Z:l=s._payload,s=s._init;try{return oe(s(l))}catch{}}return null}function ye(s){var l=s.type;switch(s.tag){case 24:return"Cache";case 9:return(l.displayName||"Context")+".Consumer";case 10:return(l._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=l.render,s=s.displayName||s.name||"",l.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return l;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return oe(l);case 8:return l===M?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function Ne(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Me(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Te(s){var l=Me(s)?"checked":"value",h=Object.getOwnPropertyDescriptor(s.constructor.prototype,l),b=""+s[l];if(!s.hasOwnProperty(l)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var k=h.get,S=h.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return k.call(this)},set:function(E){b=""+E,S.call(this,E)}}),Object.defineProperty(s,l,{enumerable:h.enumerable}),{getValue:function(){return b},setValue:function(E){b=""+E},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function Dt(s){s._valueTracker||(s._valueTracker=Te(s))}function st(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var h=l.getValue(),b="";return s&&(b=Me(s)?s.checked?"true":"false":s.value),s=b,s!==h?(l.setValue(s),!0):!1}function dt(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}function bt(s,l){var h=l.checked;return T({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:h??s._wrapperState.initialChecked})}function pt(s,l){var h=l.defaultValue==null?"":l.defaultValue,b=l.checked!=null?l.checked:l.defaultChecked;h=Ne(l.value!=null?l.value:h),s._wrapperState={initialChecked:b,initialValue:h,controlled:l.type==="checkbox"||l.type==="radio"?l.checked!=null:l.value!=null}}function we(s,l){l=l.checked,l!=null&&L(s,"checked",l,!1)}function he(s,l){we(s,l);var h=Ne(l.value),b=l.type;if(h!=null)b==="number"?(h===0&&s.value===""||s.value!=h)&&(s.value=""+h):s.value!==""+h&&(s.value=""+h);else if(b==="submit"||b==="reset"){s.removeAttribute("value");return}l.hasOwnProperty("value")?Oe(s,l.type,h):l.hasOwnProperty("defaultValue")&&Oe(s,l.type,Ne(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(s.defaultChecked=!!l.defaultChecked)}function Le(s,l,h){if(l.hasOwnProperty("value")||l.hasOwnProperty("defaultValue")){var b=l.type;if(!(b!=="submit"&&b!=="reset"||l.value!==void 0&&l.value!==null))return;l=""+s._wrapperState.initialValue,h||l===s.value||(s.value=l),s.defaultValue=l}h=s.name,h!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,h!==""&&(s.name=h)}function Oe(s,l,h){(l!=="number"||dt(s.ownerDocument)!==s)&&(h==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+h&&(s.defaultValue=""+h))}var Qe=Array.isArray;function wt(s,l,h,b){if(s=s.options,l){l={};for(var k=0;k<h.length;k++)l["$"+h[k]]=!0;for(h=0;h<s.length;h++)k=l.hasOwnProperty("$"+s[h].value),s[h].selected!==k&&(s[h].selected=k),k&&b&&(s[h].defaultSelected=!0)}else{for(h=""+Ne(h),l=null,k=0;k<s.length;k++){if(s[k].value===h){s[k].selected=!0,b&&(s[k].defaultSelected=!0);return}l!==null||s[k].disabled||(l=s[k])}l!==null&&(l.selected=!0)}}function Ie(s,l){if(l.dangerouslySetInnerHTML!=null)throw Error(r(91));return T({},l,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Be(s,l){var h=l.value;if(h==null){if(h=l.children,l=l.defaultValue,h!=null){if(l!=null)throw Error(r(92));if(Qe(h)){if(1<h.length)throw Error(r(93));h=h[0]}l=h}l==null&&(l=""),h=l}s._wrapperState={initialValue:Ne(h)}}function vt(s,l){var h=Ne(l.value),b=Ne(l.defaultValue);h!=null&&(h=""+h,h!==s.value&&(s.value=h),l.defaultValue==null&&s.defaultValue!==h&&(s.defaultValue=h)),b!=null&&(s.defaultValue=""+b)}function ft(s){var l=s.textContent;l===s._wrapperState.initialValue&&l!==""&&l!==null&&(s.value=l)}function ve(s){switch(s){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Ae(s,l){return s==null||s==="http://www.w3.org/1999/xhtml"?ve(l):s==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var et,We=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(l,h,b,k){MSApp.execUnsafeLocalFunction(function(){return s(l,h,b,k)})}:s})(function(s,l){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=l;else{for(et=et||document.createElement("div"),et.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=et.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;l.firstChild;)s.appendChild(l.firstChild)}});function lt(s,l){if(l){var h=s.firstChild;if(h&&h===s.lastChild&&h.nodeType===3){h.nodeValue=l;return}}s.textContent=l}var ct={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Vt=["Webkit","ms","Moz","O"];Object.keys(ct).forEach(function(s){Vt.forEach(function(l){l=l+s.charAt(0).toUpperCase()+s.substring(1),ct[l]=ct[s]})});function Bt(s,l,h){return l==null||typeof l=="boolean"||l===""?"":h||typeof l!="number"||l===0||ct.hasOwnProperty(s)&&ct[s]?(""+l).trim():l+"px"}function Wt(s,l){s=s.style;for(var h in l)if(l.hasOwnProperty(h)){var b=h.indexOf("--")===0,k=Bt(h,l[h],b);h==="float"&&(h="cssFloat"),b?s.setProperty(h,k):s[h]=k}}var Lt=T({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Nt(s,l){if(l){if(Lt[s]&&(l.children!=null||l.dangerouslySetInnerHTML!=null))throw Error(r(137,s));if(l.dangerouslySetInnerHTML!=null){if(l.children!=null)throw Error(r(60));if(typeof l.dangerouslySetInnerHTML!="object"||!("__html"in l.dangerouslySetInnerHTML))throw Error(r(61))}if(l.style!=null&&typeof l.style!="object")throw Error(r(62))}}function ln(s,l){if(s.indexOf("-")===-1)return typeof l.is=="string";switch(s){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 Jt=null;function Sn(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var se=null,He=null,xt=null;function Tt(s){if(s=Gl(s)){if(typeof se!="function")throw Error(r(280));var l=s.stateNode;l&&(l=Iu(l),se(s.stateNode,s.type,l))}}function Mn(s){He?xt?xt.push(s):xt=[s]:He=s}function wn(){if(He){var s=He,l=xt;if(xt=He=null,Tt(s),l)for(s=0;s<l.length;s++)Tt(l[s])}}function kn(s,l){return s(l)}function Ht(){}var Gt=!1;function dn(s,l,h){if(Gt)return s(l,h);Gt=!0;try{return kn(s,l,h)}finally{Gt=!1,(He!==null||xt!==null)&&(Ht(),wn())}}function hn(s,l){var h=s.stateNode;if(h===null)return null;var b=Iu(h);if(b===null)return null;h=b[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(b=!b.disabled)||(s=s.type,b=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!b;break e;default:s=!1}if(s)return null;if(h&&typeof h!="function")throw Error(r(231,l,typeof h));return h}var te=!1;if(d)try{var re={};Object.defineProperty(re,"passive",{get:function(){te=!0}}),window.addEventListener("test",re,re),window.removeEventListener("test",re,re)}catch{te=!1}function ue(s,l,h,b,k,S,E,J,ae){var Pe=Array.prototype.slice.call(arguments,3);try{l.apply(h,Pe)}catch($e){this.onError($e)}}var Se=!1,_e=null,ze=!1,yt=null,nt={onError:function(s){Se=!0,_e=s}};function Ve(s,l,h,b,k,S,E,J,ae){Se=!1,_e=null,ue.apply(nt,arguments)}function ne(s,l,h,b,k,S,E,J,ae){if(Ve.apply(this,arguments),Se){if(Se){var Pe=_e;Se=!1,_e=null}else throw Error(r(198));ze||(ze=!0,yt=Pe)}}function je(s){var l=s,h=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(h=l.return),s=l.return;while(s)}return l.tag===3?h:null}function ht(s){if(s.tag===13){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function Rt(s){if(je(s)!==s)throw Error(r(188))}function tn(s){var l=s.alternate;if(!l){if(l=je(s),l===null)throw Error(r(188));return l!==s?null:s}for(var h=s,b=l;;){var k=h.return;if(k===null)break;var S=k.alternate;if(S===null){if(b=k.return,b!==null){h=b;continue}break}if(k.child===S.child){for(S=k.child;S;){if(S===h)return Rt(k),s;if(S===b)return Rt(k),l;S=S.sibling}throw Error(r(188))}if(h.return!==b.return)h=k,b=S;else{for(var E=!1,J=k.child;J;){if(J===h){E=!0,h=k,b=S;break}if(J===b){E=!0,b=k,h=S;break}J=J.sibling}if(!E){for(J=S.child;J;){if(J===h){E=!0,h=S,b=k;break}if(J===b){E=!0,b=S,h=k;break}J=J.sibling}if(!E)throw Error(r(189))}}if(h.alternate!==b)throw Error(r(190))}if(h.tag!==3)throw Error(r(188));return h.stateNode.current===h?s:l}function Kt(s){return s=tn(s),s!==null?$t(s):null}function $t(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var l=$t(s);if(l!==null)return l;s=s.sibling}return null}var Zt=t.unstable_scheduleCallback,Tn=t.unstable_cancelCallback,Zn=t.unstable_shouldYield,Cn=t.unstable_requestPaint,_t=t.unstable_now,Fn=t.unstable_getCurrentPriorityLevel,mn=t.unstable_ImmediatePriority,bn=t.unstable_UserBlockingPriority,Ce=t.unstable_NormalPriority,De=t.unstable_LowPriority,mt=t.unstable_IdlePriority,Mt=null,en=null;function An(s){if(en&&typeof en.onCommitFiberRoot=="function")try{en.onCommitFiberRoot(Mt,s,void 0,(s.current.flags&128)===128)}catch{}}var zt=Math.clz32?Math.clz32:Hn,er=Math.log,fr=Math.LN2;function Hn(s){return s>>>=0,s===0?32:31-(er(s)/fr|0)|0}var ir=64,vr=4194304;function On(s){switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return s&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return s}}function Sr(s,l){var h=s.pendingLanes;if(h===0)return 0;var b=0,k=s.suspendedLanes,S=s.pingedLanes,E=h&268435455;if(E!==0){var J=E&~k;J!==0?b=On(J):(S&=E,S!==0&&(b=On(S)))}else E=h&~k,E!==0?b=On(E):S!==0&&(b=On(S));if(b===0)return 0;if(l!==0&&l!==b&&(l&k)===0&&(k=b&-b,S=l&-l,k>=S||k===16&&(S&4194240)!==0))return l;if((b&4)!==0&&(b|=h&16),l=s.entangledLanes,l!==0)for(s=s.entanglements,l&=b;0<l;)h=31-zt(l),k=1<<h,b|=s[h],l&=~k;return b}function Fi(s,l){switch(s){case 1:case 2:case 4:return l+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function _i(s,l){for(var h=s.suspendedLanes,b=s.pingedLanes,k=s.expirationTimes,S=s.pendingLanes;0<S;){var E=31-zt(S),J=1<<E,ae=k[E];ae===-1?((J&h)===0||(J&b)!==0)&&(k[E]=Fi(J,l)):ae<=l&&(s.expiredLanes|=J),S&=~J}}function Hr(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function sr(){var s=ir;return ir<<=1,(ir&4194240)===0&&(ir=64),s}function Pr(s){for(var l=[],h=0;31>h;h++)l.push(s);return l}function un(s,l,h){s.pendingLanes|=l,l!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,l=31-zt(l),s[l]=h}function Jr(s,l){var h=s.pendingLanes&~l;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=l,s.mutableReadLanes&=l,s.entangledLanes&=l,l=s.entanglements;var b=s.eventTimes;for(s=s.expirationTimes;0<h;){var k=31-zt(h),S=1<<k;l[k]=0,b[k]=-1,s[k]=-1,h&=~S}}function ar(s,l){var h=s.entangledLanes|=l;for(s=s.entanglements;h;){var b=31-zt(h),k=1<<b;k&l|s[b]&l&&(s[b]|=l),h&=~k}}var ee=0;function Ke(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Je,Et,an,on,nn,Dr=!1,zr=[],qr=null,yr=null,or=null,Dn=new Map,lr=new Map,Fr=[],Ut="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function Yr(s,l){switch(s){case"focusin":case"focusout":qr=null;break;case"dragenter":case"dragleave":yr=null;break;case"mouseover":case"mouseout":or=null;break;case"pointerover":case"pointerout":Dn.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":lr.delete(l.pointerId)}}function $(s,l,h,b,k,S){return s===null||s.nativeEvent!==S?(s={blockedOn:l,domEventName:h,eventSystemFlags:b,nativeEvent:S,targetContainers:[k]},l!==null&&(l=Gl(l),l!==null&&Et(l)),s):(s.eventSystemFlags|=b,l=s.targetContainers,k!==null&&l.indexOf(k)===-1&&l.push(k),s)}function me(s,l,h,b,k){switch(l){case"focusin":return qr=$(qr,s,l,h,b,k),!0;case"dragenter":return yr=$(yr,s,l,h,b,k),!0;case"mouseover":return or=$(or,s,l,h,b,k),!0;case"pointerover":var S=k.pointerId;return Dn.set(S,$(Dn.get(S)||null,s,l,h,b,k)),!0;case"gotpointercapture":return S=k.pointerId,lr.set(S,$(lr.get(S)||null,s,l,h,b,k)),!0}return!1}function ge(s){var l=Qa(s.target);if(l!==null){var h=je(l);if(h!==null){if(l=h.tag,l===13){if(l=ht(h),l!==null){s.blockedOn=l,nn(s.priority,function(){an(h)});return}}else if(l===3&&h.stateNode.current.memoizedState.isDehydrated){s.blockedOn=h.tag===3?h.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Ye(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var h=Bn(s.domEventName,s.eventSystemFlags,l[0],s.nativeEvent);if(h===null){h=s.nativeEvent;var b=new h.constructor(h.type,h);Jt=b,h.target.dispatchEvent(b),Jt=null}else return l=Gl(h),l!==null&&Et(l),s.blockedOn=h,!1;l.shift()}return!0}function Ge(s,l,h){Ye(s)&&h.delete(l)}function gt(){Dr=!1,qr!==null&&Ye(qr)&&(qr=null),yr!==null&&Ye(yr)&&(yr=null),or!==null&&Ye(or)&&(or=null),Dn.forEach(Ge),lr.forEach(Ge)}function cn(s,l){s.blockedOn===l&&(s.blockedOn=null,Dr||(Dr=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,gt)))}function jn(s){function l(k){return cn(k,s)}if(0<zr.length){cn(zr[0],s);for(var h=1;h<zr.length;h++){var b=zr[h];b.blockedOn===s&&(b.blockedOn=null)}}for(qr!==null&&cn(qr,s),yr!==null&&cn(yr,s),or!==null&&cn(or,s),Dn.forEach(l),lr.forEach(l),h=0;h<Fr.length;h++)b=Fr[h],b.blockedOn===s&&(b.blockedOn=null);for(;0<Fr.length&&(h=Fr[0],h.blockedOn===null);)ge(h),h.blockedOn===null&&Fr.shift()}var zn=Y.ReactCurrentBatchConfig,Zr=!0;function Gi(s,l,h,b){var k=ee,S=zn.transition;zn.transition=null;try{ee=1,li(s,l,h,b)}finally{ee=k,zn.transition=S}}function kr(s,l,h,b){var k=ee,S=zn.transition;zn.transition=null;try{ee=4,li(s,l,h,b)}finally{ee=k,zn.transition=S}}function li(s,l,h,b){if(Zr){var k=Bn(s,l,h,b);if(k===null)Bm(s,l,b,ci,h),Yr(s,b);else if(me(k,s,l,h,b))b.stopPropagation();else if(Yr(s,b),l&4&&-1<Ut.indexOf(s)){for(;k!==null;){var S=Gl(k);if(S!==null&&Je(S),S=Bn(s,l,h,b),S===null&&Bm(s,l,b,ci,h),S===k)break;k=S}k!==null&&b.stopPropagation()}else Bm(s,l,b,null,h)}}var ci=null;function Bn(s,l,h,b){if(ci=null,s=Sn(b),s=Qa(s),s!==null)if(l=je(s),l===null)s=null;else if(h=l.tag,h===13){if(s=ht(l),s!==null)return s;s=null}else if(h===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null);return ci=s,null}function ei(s){switch(s){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Fn()){case mn:return 1;case bn:return 4;case Ce:case De:return 16;case mt:return 536870912;default:return 16}default:return 16}}var ui=null,Ki=null,Oi=null;function Ks(){if(Oi)return Oi;var s,l=Ki,h=l.length,b,k="value"in ui?ui.value:ui.textContent,S=k.length;for(s=0;s<h&&l[s]===k[s];s++);var E=h-s;for(b=1;b<=E&&l[h-b]===k[S-b];b++);return Oi=k.slice(s,1<b?1-b:void 0)}function V(s){var l=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&l===13&&(s=13)):s=l,s===10&&(s=13),32<=s||s===13?s:0}function be(){return!0}function at(){return!1}function ot(s){function l(h,b,k,S,E){this._reactName=h,this._targetInst=k,this.type=b,this.nativeEvent=S,this.target=E,this.currentTarget=null;for(var J in s)s.hasOwnProperty(J)&&(h=s[J],this[J]=h?h(S):S[J]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?be:at,this.isPropagationStopped=at,this}return T(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var h=this.nativeEvent;h&&(h.preventDefault?h.preventDefault():typeof h.returnValue!="unknown"&&(h.returnValue=!1),this.isDefaultPrevented=be)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=be)},persist:function(){},isPersistent:be}),l}var qt={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Bi=ot(qt),di=T({},qt,{view:0,detail:0}),pa=ot(di),Ds,fa,Rs,Ys=T({},di,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qn,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Rs&&(Rs&&s.type==="mousemove"?(Ds=s.screenX-Rs.screenX,fa=s.screenY-Rs.screenY):fa=Ds=0,Rs=s),Ds)},movementY:function(s){return"movementY"in s?s.movementY:fa}}),ga=ot(Ys),Lo=T({},Ys,{dataTransfer:0}),Fo=ot(Lo),_o=T({},di,{relatedTarget:0}),hi=ot(_o),Oo=T({},qt,{animationName:0,elapsedTime:0,pseudoElement:0}),K=ot(Oo),fe=T({},qt,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Fe=ot(fe),ut=T({},qt,{data:0}),kt=ot(ut),gn={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ot={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"},tr={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function mi(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=tr[s])?!!l[s]:!1}function qn(){return mi}var _r=T({},di,{key:function(s){if(s.key){var l=gn[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=V(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Ot[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qn,charCode:function(s){return s.type==="keypress"?V(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?V(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Wi=ot(_r),Yi=T({},Ys,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Gn=ot(Yi),Ms=T({},di,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qn}),Xi=ot(Ms),$n=T({},qt,{propertyName:0,elapsedTime:0,pseudoElement:0}),Bo=ot($n),ba=T({},Ys,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),Wo=ot(ba),Uo=[9,13,27,32],wa=d&&"CompositionEvent"in window,z=null;d&&"documentMode"in document&&(z=document.documentMode);var ie=d&&"TextEvent"in window&&!z,Re=d&&(!wa||z&&8<z&&11>=z),rt=" ",Ct=!1;function jt(s,l){switch(s){case"keyup":return Uo.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function vn(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var _n=!1;function Wn(s,l){switch(s){case"compositionend":return vn(l);case"keypress":return l.which!==32?null:(Ct=!0,rt);case"textInput":return s=l.data,s===rt&&Ct?null:s;default:return null}}function pn(s,l){if(_n)return s==="compositionend"||!wa&&jt(s,l)?(s=Ks(),Oi=Ki=ui=null,_n=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return Re&&l.locale!=="ko"?null:l.data;default:return null}}var Or={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 As(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!Or[s.type]:l==="textarea"}function bi(s,l,h,b){Mn(b),l=Mu(l,"onChange"),0<l.length&&(h=new Bi("onChange","change",null,h,b),s.push({event:h,listeners:l}))}var ps=null,va=null;function Dm(s){kv(s,0)}function Tu(s){var l=Vo(s);if(st(l))return s}function UR(s,l){if(s==="change")return l}var iv=!1;if(d){var Rm;if(d){var Mm="oninput"in document;if(!Mm){var sv=document.createElement("div");sv.setAttribute("oninput","return;"),Mm=typeof sv.oninput=="function"}Rm=Mm}else Rm=!1;iv=Rm&&(!document.documentMode||9<document.documentMode)}function av(){ps&&(ps.detachEvent("onpropertychange",ov),va=ps=null)}function ov(s){if(s.propertyName==="value"&&Tu(va)){var l=[];bi(l,va,s,Sn(s)),dn(Dm,l)}}function HR(s,l,h){s==="focusin"?(av(),ps=l,va=h,ps.attachEvent("onpropertychange",ov)):s==="focusout"&&av()}function zR(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Tu(va)}function qR(s,l){if(s==="click")return Tu(l)}function $R(s,l){if(s==="input"||s==="change")return Tu(l)}function VR(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var fs=typeof Object.is=="function"?Object.is:VR;function Ul(s,l){if(fs(s,l))return!0;if(typeof s!="object"||s===null||typeof l!="object"||l===null)return!1;var h=Object.keys(s),b=Object.keys(l);if(h.length!==b.length)return!1;for(b=0;b<h.length;b++){var k=h[b];if(!m.call(l,k)||!fs(s[k],l[k]))return!1}return!0}function lv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function cv(s,l){var h=lv(s);s=0;for(var b;h;){if(h.nodeType===3){if(b=s+h.textContent.length,s<=l&&b>=l)return{node:h,offset:l-s};s=b}e:{for(;h;){if(h.nextSibling){h=h.nextSibling;break e}h=h.parentNode}h=void 0}h=lv(h)}}function uv(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?uv(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function dv(){for(var s=window,l=dt();l instanceof s.HTMLIFrameElement;){try{var h=typeof l.contentWindow.location.href=="string"}catch{h=!1}if(h)s=l.contentWindow;else break;l=dt(s.document)}return l}function Am(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l&&(l==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||l==="textarea"||s.contentEditable==="true")}function GR(s){var l=dv(),h=s.focusedElem,b=s.selectionRange;if(l!==h&&h&&h.ownerDocument&&uv(h.ownerDocument.documentElement,h)){if(b!==null&&Am(h)){if(l=b.start,s=b.end,s===void 0&&(s=l),"selectionStart"in h)h.selectionStart=l,h.selectionEnd=Math.min(s,h.value.length);else if(s=(l=h.ownerDocument||document)&&l.defaultView||window,s.getSelection){s=s.getSelection();var k=h.textContent.length,S=Math.min(b.start,k);b=b.end===void 0?S:Math.min(b.end,k),!s.extend&&S>b&&(k=b,b=S,S=k),k=cv(h,S);var E=cv(h,b);k&&E&&(s.rangeCount!==1||s.anchorNode!==k.node||s.anchorOffset!==k.offset||s.focusNode!==E.node||s.focusOffset!==E.offset)&&(l=l.createRange(),l.setStart(k.node,k.offset),s.removeAllRanges(),S>b?(s.addRange(l),s.extend(E.node,E.offset)):(l.setEnd(E.node,E.offset),s.addRange(l)))}}for(l=[],s=h;s=s.parentNode;)s.nodeType===1&&l.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof h.focus=="function"&&h.focus(),h=0;h<l.length;h++)s=l[h],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var KR=d&&"documentMode"in document&&11>=document.documentMode,Ho=null,Em=null,Hl=null,Im=!1;function hv(s,l,h){var b=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;Im||Ho==null||Ho!==dt(b)||(b=Ho,"selectionStart"in b&&Am(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),Hl&&Ul(Hl,b)||(Hl=b,b=Mu(Em,"onSelect"),0<b.length&&(l=new Bi("onSelect","select",null,l,h),s.push({event:l,listeners:b}),l.target=Ho)))}function Pu(s,l){var h={};return h[s.toLowerCase()]=l.toLowerCase(),h["Webkit"+s]="webkit"+l,h["Moz"+s]="moz"+l,h}var zo={animationend:Pu("Animation","AnimationEnd"),animationiteration:Pu("Animation","AnimationIteration"),animationstart:Pu("Animation","AnimationStart"),transitionend:Pu("Transition","TransitionEnd")},Lm={},mv={};d&&(mv=document.createElement("div").style,"AnimationEvent"in window||(delete zo.animationend.animation,delete zo.animationiteration.animation,delete zo.animationstart.animation),"TransitionEvent"in window||delete zo.transitionend.transition);function Du(s){if(Lm[s])return Lm[s];if(!zo[s])return s;var l=zo[s],h;for(h in l)if(l.hasOwnProperty(h)&&h in mv)return Lm[s]=l[h];return s}var pv=Du("animationend"),fv=Du("animationiteration"),gv=Du("animationstart"),bv=Du("transitionend"),wv=new Map,vv="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function ya(s,l){wv.set(s,l),c(l,[s])}for(var Fm=0;Fm<vv.length;Fm++){var _m=vv[Fm],YR=_m.toLowerCase(),XR=_m[0].toUpperCase()+_m.slice(1);ya(YR,"on"+XR)}ya(pv,"onAnimationEnd"),ya(fv,"onAnimationIteration"),ya(gv,"onAnimationStart"),ya("dblclick","onDoubleClick"),ya("focusin","onFocus"),ya("focusout","onBlur"),ya(bv,"onTransitionEnd"),u("onMouseEnter",["mouseout","mouseover"]),u("onMouseLeave",["mouseout","mouseover"]),u("onPointerEnter",["pointerout","pointerover"]),u("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var zl="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(" "),QR=new Set("cancel close invalid load scroll toggle".split(" ").concat(zl));function yv(s,l,h){var b=s.type||"unknown-event";s.currentTarget=h,ne(b,l,void 0,s),s.currentTarget=null}function kv(s,l){l=(l&4)!==0;for(var h=0;h<s.length;h++){var b=s[h],k=b.event;b=b.listeners;e:{var S=void 0;if(l)for(var E=b.length-1;0<=E;E--){var J=b[E],ae=J.instance,Pe=J.currentTarget;if(J=J.listener,ae!==S&&k.isPropagationStopped())break e;yv(k,J,Pe),S=ae}else for(E=0;E<b.length;E++){if(J=b[E],ae=J.instance,Pe=J.currentTarget,J=J.listener,ae!==S&&k.isPropagationStopped())break e;yv(k,J,Pe),S=ae}}}if(ze)throw s=yt,ze=!1,yt=null,s}function nr(s,l){var h=l[$m];h===void 0&&(h=l[$m]=new Set);var b=s+"__bubble";h.has(b)||(xv(l,s,2,!1),h.add(b))}function Om(s,l,h){var b=0;l&&(b|=4),xv(h,s,b,l)}var Ru="_reactListening"+Math.random().toString(36).slice(2);function ql(s){if(!s[Ru]){s[Ru]=!0,i.forEach(function(h){h!=="selectionchange"&&(QR.has(h)||Om(h,!1,s),Om(h,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Ru]||(l[Ru]=!0,Om("selectionchange",!1,l))}}function xv(s,l,h,b){switch(ei(l)){case 1:var k=Gi;break;case 4:k=kr;break;default:k=li}h=k.bind(null,l,h,s),k=void 0,!te||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(k=!0),b?k!==void 0?s.addEventListener(l,h,{capture:!0,passive:k}):s.addEventListener(l,h,!0):k!==void 0?s.addEventListener(l,h,{passive:k}):s.addEventListener(l,h,!1)}function Bm(s,l,h,b,k){var S=b;if((l&1)===0&&(l&2)===0&&b!==null)e:for(;;){if(b===null)return;var E=b.tag;if(E===3||E===4){var J=b.stateNode.containerInfo;if(J===k||J.nodeType===8&&J.parentNode===k)break;if(E===4)for(E=b.return;E!==null;){var ae=E.tag;if((ae===3||ae===4)&&(ae=E.stateNode.containerInfo,ae===k||ae.nodeType===8&&ae.parentNode===k))return;E=E.return}for(;J!==null;){if(E=Qa(J),E===null)return;if(ae=E.tag,ae===5||ae===6){b=S=E;continue e}J=J.parentNode}}b=b.return}dn(function(){var Pe=S,$e=Sn(h),Xe=[];e:{var qe=wv.get(s);if(qe!==void 0){var St=Bi,At=s;switch(s){case"keypress":if(V(h)===0)break e;case"keydown":case"keyup":St=Wi;break;case"focusin":At="focus",St=hi;break;case"focusout":At="blur",St=hi;break;case"beforeblur":case"afterblur":St=hi;break;case"click":if(h.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":St=ga;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":St=Fo;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":St=Xi;break;case pv:case fv:case gv:St=K;break;case bv:St=Bo;break;case"scroll":St=pa;break;case"wheel":St=Wo;break;case"copy":case"cut":case"paste":St=Fe;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":St=Gn}var It=(l&4)!==0,Cr=!It&&s==="scroll",ke=It?qe!==null?qe+"Capture":null:qe;It=[];for(var ce=Pe,xe;ce!==null;){xe=ce;var it=xe.stateNode;if(xe.tag===5&&it!==null&&(xe=it,ke!==null&&(it=hn(ce,ke),it!=null&&It.push($l(ce,it,xe)))),Cr)break;ce=ce.return}0<It.length&&(qe=new St(qe,At,null,h,$e),Xe.push({event:qe,listeners:It}))}}if((l&7)===0){e:{if(qe=s==="mouseover"||s==="pointerover",St=s==="mouseout"||s==="pointerout",qe&&h!==Jt&&(At=h.relatedTarget||h.fromElement)&&(Qa(At)||At[Xs]))break e;if((St||qe)&&(qe=$e.window===$e?$e:(qe=$e.ownerDocument)?qe.defaultView||qe.parentWindow:window,St?(At=h.relatedTarget||h.toElement,St=Pe,At=At?Qa(At):null,At!==null&&(Cr=je(At),At!==Cr||At.tag!==5&&At.tag!==6)&&(At=null)):(St=null,At=Pe),St!==At)){if(It=ga,it="onMouseLeave",ke="onMouseEnter",ce="mouse",(s==="pointerout"||s==="pointerover")&&(It=Gn,it="onPointerLeave",ke="onPointerEnter",ce="pointer"),Cr=St==null?qe:Vo(St),xe=At==null?qe:Vo(At),qe=new It(it,ce+"leave",St,h,$e),qe.target=Cr,qe.relatedTarget=xe,it=null,Qa($e)===Pe&&(It=new It(ke,ce+"enter",At,h,$e),It.target=xe,It.relatedTarget=Cr,it=It),Cr=it,St&&At)t:{for(It=St,ke=At,ce=0,xe=It;xe;xe=qo(xe))ce++;for(xe=0,it=ke;it;it=qo(it))xe++;for(;0<ce-xe;)It=qo(It),ce--;for(;0<xe-ce;)ke=qo(ke),xe--;for(;ce--;){if(It===ke||ke!==null&&It===ke.alternate)break t;It=qo(It),ke=qo(ke)}It=null}else It=null;St!==null&&Sv(Xe,qe,St,It,!1),At!==null&&Cr!==null&&Sv(Xe,Cr,At,It,!0)}}e:{if(qe=Pe?Vo(Pe):window,St=qe.nodeName&&qe.nodeName.toLowerCase(),St==="select"||St==="input"&&qe.type==="file")var Ft=UR;else if(As(qe))if(iv)Ft=$R;else{Ft=zR;var Yt=HR}else(St=qe.nodeName)&&St.toLowerCase()==="input"&&(qe.type==="checkbox"||qe.type==="radio")&&(Ft=qR);if(Ft&&(Ft=Ft(s,Pe))){bi(Xe,Ft,h,$e);break e}Yt&&Yt(s,qe,Pe),s==="focusout"&&(Yt=qe._wrapperState)&&Yt.controlled&&qe.type==="number"&&Oe(qe,"number",qe.value)}switch(Yt=Pe?Vo(Pe):window,s){case"focusin":(As(Yt)||Yt.contentEditable==="true")&&(Ho=Yt,Em=Pe,Hl=null);break;case"focusout":Hl=Em=Ho=null;break;case"mousedown":Im=!0;break;case"contextmenu":case"mouseup":case"dragend":Im=!1,hv(Xe,h,$e);break;case"selectionchange":if(KR)break;case"keydown":case"keyup":hv(Xe,h,$e)}var Xt;if(wa)e:{switch(s){case"compositionstart":var rn="onCompositionStart";break e;case"compositionend":rn="onCompositionEnd";break e;case"compositionupdate":rn="onCompositionUpdate";break e}rn=void 0}else _n?jt(s,h)&&(rn="onCompositionEnd"):s==="keydown"&&h.keyCode===229&&(rn="onCompositionStart");rn&&(Re&&h.locale!=="ko"&&(_n||rn!=="onCompositionStart"?rn==="onCompositionEnd"&&_n&&(Xt=Ks()):(ui=$e,Ki="value"in ui?ui.value:ui.textContent,_n=!0)),Yt=Mu(Pe,rn),0<Yt.length&&(rn=new kt(rn,s,null,h,$e),Xe.push({event:rn,listeners:Yt}),Xt?rn.data=Xt:(Xt=vn(h),Xt!==null&&(rn.data=Xt)))),(Xt=ie?Wn(s,h):pn(s,h))&&(Pe=Mu(Pe,"onBeforeInput"),0<Pe.length&&($e=new kt("onBeforeInput","beforeinput",null,h,$e),Xe.push({event:$e,listeners:Pe}),$e.data=Xt))}kv(Xe,l)})}function $l(s,l,h){return{instance:s,listener:l,currentTarget:h}}function Mu(s,l){for(var h=l+"Capture",b=[];s!==null;){var k=s,S=k.stateNode;k.tag===5&&S!==null&&(k=S,S=hn(s,h),S!=null&&b.unshift($l(s,S,k)),S=hn(s,l),S!=null&&b.push($l(s,S,k))),s=s.return}return b}function qo(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Sv(s,l,h,b,k){for(var S=l._reactName,E=[];h!==null&&h!==b;){var J=h,ae=J.alternate,Pe=J.stateNode;if(ae!==null&&ae===b)break;J.tag===5&&Pe!==null&&(J=Pe,k?(ae=hn(h,S),ae!=null&&E.unshift($l(h,ae,J))):k||(ae=hn(h,S),ae!=null&&E.push($l(h,ae,J)))),h=h.return}E.length!==0&&s.push({event:l,listeners:E})}var JR=/\r\n?/g,ZR=/\u0000|\uFFFD/g;function Cv(s){return(typeof s=="string"?s:""+s).replace(JR,`
|
|
39
|
-
`).replace(ZR,"")}function Au(s,l,h){if(l=Cv(l),Cv(s)!==l&&h)throw Error(r(425))}function Eu(){}var Wm=null,Um=null;function Hm(s,l){return s==="textarea"||s==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var zm=typeof setTimeout=="function"?setTimeout:void 0,eM=typeof clearTimeout=="function"?clearTimeout:void 0,jv=typeof Promise=="function"?Promise:void 0,tM=typeof queueMicrotask=="function"?queueMicrotask:typeof jv<"u"?function(s){return jv.resolve(null).then(s).catch(nM)}:zm;function nM(s){setTimeout(function(){throw s})}function qm(s,l){var h=l,b=0;do{var k=h.nextSibling;if(s.removeChild(h),k&&k.nodeType===8)if(h=k.data,h==="/$"){if(b===0){s.removeChild(k),jn(l);return}b--}else h!=="$"&&h!=="$?"&&h!=="$!"||b++;h=k}while(h);jn(l)}function ka(s){for(;s!=null;s=s.nextSibling){var l=s.nodeType;if(l===1||l===3)break;if(l===8){if(l=s.data,l==="$"||l==="$!"||l==="$?")break;if(l==="/$")return null}}return s}function Nv(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var h=s.data;if(h==="$"||h==="$!"||h==="$?"){if(l===0)return s;l--}else h==="/$"&&l++}s=s.previousSibling}return null}var $o=Math.random().toString(36).slice(2),Es="__reactFiber$"+$o,Vl="__reactProps$"+$o,Xs="__reactContainer$"+$o,$m="__reactEvents$"+$o,rM="__reactListeners$"+$o,iM="__reactHandles$"+$o;function Qa(s){var l=s[Es];if(l)return l;for(var h=s.parentNode;h;){if(l=h[Xs]||h[Es]){if(h=l.alternate,l.child!==null||h!==null&&h.child!==null)for(s=Nv(s);s!==null;){if(h=s[Es])return h;s=Nv(s)}return l}s=h,h=s.parentNode}return null}function Gl(s){return s=s[Es]||s[Xs],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function Vo(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(r(33))}function Iu(s){return s[Vl]||null}var Vm=[],Go=-1;function xa(s){return{current:s}}function rr(s){0>Go||(s.current=Vm[Go],Vm[Go]=null,Go--)}function Yn(s,l){Go++,Vm[Go]=s.current,s.current=l}var Sa={},ti=xa(Sa),wi=xa(!1),Ja=Sa;function Ko(s,l){var h=s.type.contextTypes;if(!h)return Sa;var b=s.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===l)return b.__reactInternalMemoizedMaskedChildContext;var k={},S;for(S in h)k[S]=l[S];return b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=l,s.__reactInternalMemoizedMaskedChildContext=k),k}function vi(s){return s=s.childContextTypes,s!=null}function Lu(){rr(wi),rr(ti)}function Tv(s,l,h){if(ti.current!==Sa)throw Error(r(168));Yn(ti,l),Yn(wi,h)}function Pv(s,l,h){var b=s.stateNode;if(l=l.childContextTypes,typeof b.getChildContext!="function")return h;b=b.getChildContext();for(var k in b)if(!(k in l))throw Error(r(108,ye(s)||"Unknown",k));return T({},h,b)}function Fu(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||Sa,Ja=ti.current,Yn(ti,s),Yn(wi,wi.current),!0}function Dv(s,l,h){var b=s.stateNode;if(!b)throw Error(r(169));h?(s=Pv(s,l,Ja),b.__reactInternalMemoizedMergedChildContext=s,rr(wi),rr(ti),Yn(ti,s)):rr(wi),Yn(wi,h)}var Qs=null,_u=!1,Gm=!1;function Rv(s){Qs===null?Qs=[s]:Qs.push(s)}function sM(s){_u=!0,Rv(s)}function Ca(){if(!Gm&&Qs!==null){Gm=!0;var s=0,l=ee;try{var h=Qs;for(ee=1;s<h.length;s++){var b=h[s];do b=b(!0);while(b!==null)}Qs=null,_u=!1}catch(k){throw Qs!==null&&(Qs=Qs.slice(s+1)),Zt(mn,Ca),k}finally{ee=l,Gm=!1}}return null}var Yo=[],Xo=0,Ou=null,Bu=0,Qi=[],Ji=0,Za=null,Js=1,Zs="";function eo(s,l){Yo[Xo++]=Bu,Yo[Xo++]=Ou,Ou=s,Bu=l}function Mv(s,l,h){Qi[Ji++]=Js,Qi[Ji++]=Zs,Qi[Ji++]=Za,Za=s;var b=Js;s=Zs;var k=32-zt(b)-1;b&=~(1<<k),h+=1;var S=32-zt(l)+k;if(30<S){var E=k-k%5;S=(b&(1<<E)-1).toString(32),b>>=E,k-=E,Js=1<<32-zt(l)+k|h<<k|b,Zs=S+s}else Js=1<<S|h<<k|b,Zs=s}function Km(s){s.return!==null&&(eo(s,1),Mv(s,1,0))}function Ym(s){for(;s===Ou;)Ou=Yo[--Xo],Yo[Xo]=null,Bu=Yo[--Xo],Yo[Xo]=null;for(;s===Za;)Za=Qi[--Ji],Qi[Ji]=null,Zs=Qi[--Ji],Qi[Ji]=null,Js=Qi[--Ji],Qi[Ji]=null}var Ui=null,Hi=null,cr=!1,gs=null;function Av(s,l){var h=ns(5,null,null,0);h.elementType="DELETED",h.stateNode=l,h.return=s,l=s.deletions,l===null?(s.deletions=[h],s.flags|=16):l.push(h)}function Ev(s,l){switch(s.tag){case 5:var h=s.type;return l=l.nodeType!==1||h.toLowerCase()!==l.nodeName.toLowerCase()?null:l,l!==null?(s.stateNode=l,Ui=s,Hi=ka(l.firstChild),!0):!1;case 6:return l=s.pendingProps===""||l.nodeType!==3?null:l,l!==null?(s.stateNode=l,Ui=s,Hi=null,!0):!1;case 13:return l=l.nodeType!==8?null:l,l!==null?(h=Za!==null?{id:Js,overflow:Zs}:null,s.memoizedState={dehydrated:l,treeContext:h,retryLane:1073741824},h=ns(18,null,null,0),h.stateNode=l,h.return=s,s.child=h,Ui=s,Hi=null,!0):!1;default:return!1}}function Xm(s){return(s.mode&1)!==0&&(s.flags&128)===0}function Qm(s){if(cr){var l=Hi;if(l){var h=l;if(!Ev(s,l)){if(Xm(s))throw Error(r(418));l=ka(h.nextSibling);var b=Ui;l&&Ev(s,l)?Av(b,h):(s.flags=s.flags&-4097|2,cr=!1,Ui=s)}}else{if(Xm(s))throw Error(r(418));s.flags=s.flags&-4097|2,cr=!1,Ui=s}}}function Iv(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Ui=s}function Wu(s){if(s!==Ui)return!1;if(!cr)return Iv(s),cr=!0,!1;var l;if((l=s.tag!==3)&&!(l=s.tag!==5)&&(l=s.type,l=l!=="head"&&l!=="body"&&!Hm(s.type,s.memoizedProps)),l&&(l=Hi)){if(Xm(s))throw Lv(),Error(r(418));for(;l;)Av(s,l),l=ka(l.nextSibling)}if(Iv(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));e:{for(s=s.nextSibling,l=0;s;){if(s.nodeType===8){var h=s.data;if(h==="/$"){if(l===0){Hi=ka(s.nextSibling);break e}l--}else h!=="$"&&h!=="$!"&&h!=="$?"||l++}s=s.nextSibling}Hi=null}}else Hi=Ui?ka(s.stateNode.nextSibling):null;return!0}function Lv(){for(var s=Hi;s;)s=ka(s.nextSibling)}function Qo(){Hi=Ui=null,cr=!1}function Jm(s){gs===null?gs=[s]:gs.push(s)}var aM=Y.ReactCurrentBatchConfig;function Kl(s,l,h){if(s=h.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(h._owner){if(h=h._owner,h){if(h.tag!==1)throw Error(r(309));var b=h.stateNode}if(!b)throw Error(r(147,s));var k=b,S=""+s;return l!==null&&l.ref!==null&&typeof l.ref=="function"&&l.ref._stringRef===S?l.ref:(l=function(E){var J=k.refs;E===null?delete J[S]:J[S]=E},l._stringRef=S,l)}if(typeof s!="string")throw Error(r(284));if(!h._owner)throw Error(r(290,s))}return s}function Uu(s,l){throw s=Object.prototype.toString.call(l),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s))}function Fv(s){var l=s._init;return l(s._payload)}function _v(s){function l(ke,ce){if(s){var xe=ke.deletions;xe===null?(ke.deletions=[ce],ke.flags|=16):xe.push(ce)}}function h(ke,ce){if(!s)return null;for(;ce!==null;)l(ke,ce),ce=ce.sibling;return null}function b(ke,ce){for(ke=new Map;ce!==null;)ce.key!==null?ke.set(ce.key,ce):ke.set(ce.index,ce),ce=ce.sibling;return ke}function k(ke,ce){return ke=Aa(ke,ce),ke.index=0,ke.sibling=null,ke}function S(ke,ce,xe){return ke.index=xe,s?(xe=ke.alternate,xe!==null?(xe=xe.index,xe<ce?(ke.flags|=2,ce):xe):(ke.flags|=2,ce)):(ke.flags|=1048576,ce)}function E(ke){return s&&ke.alternate===null&&(ke.flags|=2),ke}function J(ke,ce,xe,it){return ce===null||ce.tag!==6?(ce=zp(xe,ke.mode,it),ce.return=ke,ce):(ce=k(ce,xe),ce.return=ke,ce)}function ae(ke,ce,xe,it){var Ft=xe.type;return Ft===I?$e(ke,ce,xe.props.children,it,xe.key):ce!==null&&(ce.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===Z&&Fv(Ft)===ce.type)?(it=k(ce,xe.props),it.ref=Kl(ke,ce,xe),it.return=ke,it):(it=dd(xe.type,xe.key,xe.props,null,ke.mode,it),it.ref=Kl(ke,ce,xe),it.return=ke,it)}function Pe(ke,ce,xe,it){return ce===null||ce.tag!==4||ce.stateNode.containerInfo!==xe.containerInfo||ce.stateNode.implementation!==xe.implementation?(ce=qp(xe,ke.mode,it),ce.return=ke,ce):(ce=k(ce,xe.children||[]),ce.return=ke,ce)}function $e(ke,ce,xe,it,Ft){return ce===null||ce.tag!==7?(ce=lo(xe,ke.mode,it,Ft),ce.return=ke,ce):(ce=k(ce,xe),ce.return=ke,ce)}function Xe(ke,ce,xe){if(typeof ce=="string"&&ce!==""||typeof ce=="number")return ce=zp(""+ce,ke.mode,xe),ce.return=ke,ce;if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case H:return xe=dd(ce.type,ce.key,ce.props,null,ke.mode,xe),xe.ref=Kl(ke,null,ce),xe.return=ke,xe;case W:return ce=qp(ce,ke.mode,xe),ce.return=ke,ce;case Z:var it=ce._init;return Xe(ke,it(ce._payload),xe)}if(Qe(ce)||D(ce))return ce=lo(ce,ke.mode,xe,null),ce.return=ke,ce;Uu(ke,ce)}return null}function qe(ke,ce,xe,it){var Ft=ce!==null?ce.key:null;if(typeof xe=="string"&&xe!==""||typeof xe=="number")return Ft!==null?null:J(ke,ce,""+xe,it);if(typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case H:return xe.key===Ft?ae(ke,ce,xe,it):null;case W:return xe.key===Ft?Pe(ke,ce,xe,it):null;case Z:return Ft=xe._init,qe(ke,ce,Ft(xe._payload),it)}if(Qe(xe)||D(xe))return Ft!==null?null:$e(ke,ce,xe,it,null);Uu(ke,xe)}return null}function St(ke,ce,xe,it,Ft){if(typeof it=="string"&&it!==""||typeof it=="number")return ke=ke.get(xe)||null,J(ce,ke,""+it,Ft);if(typeof it=="object"&&it!==null){switch(it.$$typeof){case H:return ke=ke.get(it.key===null?xe:it.key)||null,ae(ce,ke,it,Ft);case W:return ke=ke.get(it.key===null?xe:it.key)||null,Pe(ce,ke,it,Ft);case Z:var Yt=it._init;return St(ke,ce,xe,Yt(it._payload),Ft)}if(Qe(it)||D(it))return ke=ke.get(xe)||null,$e(ce,ke,it,Ft,null);Uu(ce,it)}return null}function At(ke,ce,xe,it){for(var Ft=null,Yt=null,Xt=ce,rn=ce=0,Gr=null;Xt!==null&&rn<xe.length;rn++){Xt.index>rn?(Gr=Xt,Xt=null):Gr=Xt.sibling;var En=qe(ke,Xt,xe[rn],it);if(En===null){Xt===null&&(Xt=Gr);break}s&&Xt&&En.alternate===null&&l(ke,Xt),ce=S(En,ce,rn),Yt===null?Ft=En:Yt.sibling=En,Yt=En,Xt=Gr}if(rn===xe.length)return h(ke,Xt),cr&&eo(ke,rn),Ft;if(Xt===null){for(;rn<xe.length;rn++)Xt=Xe(ke,xe[rn],it),Xt!==null&&(ce=S(Xt,ce,rn),Yt===null?Ft=Xt:Yt.sibling=Xt,Yt=Xt);return cr&&eo(ke,rn),Ft}for(Xt=b(ke,Xt);rn<xe.length;rn++)Gr=St(Xt,ke,rn,xe[rn],it),Gr!==null&&(s&&Gr.alternate!==null&&Xt.delete(Gr.key===null?rn:Gr.key),ce=S(Gr,ce,rn),Yt===null?Ft=Gr:Yt.sibling=Gr,Yt=Gr);return s&&Xt.forEach(function(Ea){return l(ke,Ea)}),cr&&eo(ke,rn),Ft}function It(ke,ce,xe,it){var Ft=D(xe);if(typeof Ft!="function")throw Error(r(150));if(xe=Ft.call(xe),xe==null)throw Error(r(151));for(var Yt=Ft=null,Xt=ce,rn=ce=0,Gr=null,En=xe.next();Xt!==null&&!En.done;rn++,En=xe.next()){Xt.index>rn?(Gr=Xt,Xt=null):Gr=Xt.sibling;var Ea=qe(ke,Xt,En.value,it);if(Ea===null){Xt===null&&(Xt=Gr);break}s&&Xt&&Ea.alternate===null&&l(ke,Xt),ce=S(Ea,ce,rn),Yt===null?Ft=Ea:Yt.sibling=Ea,Yt=Ea,Xt=Gr}if(En.done)return h(ke,Xt),cr&&eo(ke,rn),Ft;if(Xt===null){for(;!En.done;rn++,En=xe.next())En=Xe(ke,En.value,it),En!==null&&(ce=S(En,ce,rn),Yt===null?Ft=En:Yt.sibling=En,Yt=En);return cr&&eo(ke,rn),Ft}for(Xt=b(ke,Xt);!En.done;rn++,En=xe.next())En=St(Xt,ke,rn,En.value,it),En!==null&&(s&&En.alternate!==null&&Xt.delete(En.key===null?rn:En.key),ce=S(En,ce,rn),Yt===null?Ft=En:Yt.sibling=En,Yt=En);return s&&Xt.forEach(function(BM){return l(ke,BM)}),cr&&eo(ke,rn),Ft}function Cr(ke,ce,xe,it){if(typeof xe=="object"&&xe!==null&&xe.type===I&&xe.key===null&&(xe=xe.props.children),typeof xe=="object"&&xe!==null){switch(xe.$$typeof){case H:e:{for(var Ft=xe.key,Yt=ce;Yt!==null;){if(Yt.key===Ft){if(Ft=xe.type,Ft===I){if(Yt.tag===7){h(ke,Yt.sibling),ce=k(Yt,xe.props.children),ce.return=ke,ke=ce;break e}}else if(Yt.elementType===Ft||typeof Ft=="object"&&Ft!==null&&Ft.$$typeof===Z&&Fv(Ft)===Yt.type){h(ke,Yt.sibling),ce=k(Yt,xe.props),ce.ref=Kl(ke,Yt,xe),ce.return=ke,ke=ce;break e}h(ke,Yt);break}else l(ke,Yt);Yt=Yt.sibling}xe.type===I?(ce=lo(xe.props.children,ke.mode,it,xe.key),ce.return=ke,ke=ce):(it=dd(xe.type,xe.key,xe.props,null,ke.mode,it),it.ref=Kl(ke,ce,xe),it.return=ke,ke=it)}return E(ke);case W:e:{for(Yt=xe.key;ce!==null;){if(ce.key===Yt)if(ce.tag===4&&ce.stateNode.containerInfo===xe.containerInfo&&ce.stateNode.implementation===xe.implementation){h(ke,ce.sibling),ce=k(ce,xe.children||[]),ce.return=ke,ke=ce;break e}else{h(ke,ce);break}else l(ke,ce);ce=ce.sibling}ce=qp(xe,ke.mode,it),ce.return=ke,ke=ce}return E(ke);case Z:return Yt=xe._init,Cr(ke,ce,Yt(xe._payload),it)}if(Qe(xe))return At(ke,ce,xe,it);if(D(xe))return It(ke,ce,xe,it);Uu(ke,xe)}return typeof xe=="string"&&xe!==""||typeof xe=="number"?(xe=""+xe,ce!==null&&ce.tag===6?(h(ke,ce.sibling),ce=k(ce,xe),ce.return=ke,ke=ce):(h(ke,ce),ce=zp(xe,ke.mode,it),ce.return=ke,ke=ce),E(ke)):h(ke,ce)}return Cr}var Jo=_v(!0),Ov=_v(!1),Hu=xa(null),zu=null,Zo=null,Zm=null;function ep(){Zm=Zo=zu=null}function tp(s){var l=Hu.current;rr(Hu),s._currentValue=l}function np(s,l,h){for(;s!==null;){var b=s.alternate;if((s.childLanes&l)!==l?(s.childLanes|=l,b!==null&&(b.childLanes|=l)):b!==null&&(b.childLanes&l)!==l&&(b.childLanes|=l),s===h)break;s=s.return}}function el(s,l){zu=s,Zm=Zo=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&l)!==0&&(yi=!0),s.firstContext=null)}function Zi(s){var l=s._currentValue;if(Zm!==s)if(s={context:s,memoizedValue:l,next:null},Zo===null){if(zu===null)throw Error(r(308));Zo=s,zu.dependencies={lanes:0,firstContext:s}}else Zo=Zo.next=s;return l}var to=null;function rp(s){to===null?to=[s]:to.push(s)}function Bv(s,l,h,b){var k=l.interleaved;return k===null?(h.next=h,rp(l)):(h.next=k.next,k.next=h),l.interleaved=h,ea(s,b)}function ea(s,l){s.lanes|=l;var h=s.alternate;for(h!==null&&(h.lanes|=l),h=s,s=s.return;s!==null;)s.childLanes|=l,h=s.alternate,h!==null&&(h.childLanes|=l),h=s,s=s.return;return h.tag===3?h.stateNode:null}var ja=!1;function ip(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Wv(s,l){s=s.updateQueue,l.updateQueue===s&&(l.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function ta(s,l){return{eventTime:s,lane:l,tag:0,payload:null,callback:null,next:null}}function Na(s,l,h){var b=s.updateQueue;if(b===null)return null;if(b=b.shared,(Rn&2)!==0){var k=b.pending;return k===null?l.next=l:(l.next=k.next,k.next=l),b.pending=l,ea(s,h)}return k=b.interleaved,k===null?(l.next=l,rp(b)):(l.next=k.next,k.next=l),b.interleaved=l,ea(s,h)}function qu(s,l,h){if(l=l.updateQueue,l!==null&&(l=l.shared,(h&4194240)!==0)){var b=l.lanes;b&=s.pendingLanes,h|=b,l.lanes=h,ar(s,h)}}function Uv(s,l){var h=s.updateQueue,b=s.alternate;if(b!==null&&(b=b.updateQueue,h===b)){var k=null,S=null;if(h=h.firstBaseUpdate,h!==null){do{var E={eventTime:h.eventTime,lane:h.lane,tag:h.tag,payload:h.payload,callback:h.callback,next:null};S===null?k=S=E:S=S.next=E,h=h.next}while(h!==null);S===null?k=S=l:S=S.next=l}else k=S=l;h={baseState:b.baseState,firstBaseUpdate:k,lastBaseUpdate:S,shared:b.shared,effects:b.effects},s.updateQueue=h;return}s=h.lastBaseUpdate,s===null?h.firstBaseUpdate=l:s.next=l,h.lastBaseUpdate=l}function $u(s,l,h,b){var k=s.updateQueue;ja=!1;var S=k.firstBaseUpdate,E=k.lastBaseUpdate,J=k.shared.pending;if(J!==null){k.shared.pending=null;var ae=J,Pe=ae.next;ae.next=null,E===null?S=Pe:E.next=Pe,E=ae;var $e=s.alternate;$e!==null&&($e=$e.updateQueue,J=$e.lastBaseUpdate,J!==E&&(J===null?$e.firstBaseUpdate=Pe:J.next=Pe,$e.lastBaseUpdate=ae))}if(S!==null){var Xe=k.baseState;E=0,$e=Pe=ae=null,J=S;do{var qe=J.lane,St=J.eventTime;if((b&qe)===qe){$e!==null&&($e=$e.next={eventTime:St,lane:0,tag:J.tag,payload:J.payload,callback:J.callback,next:null});e:{var At=s,It=J;switch(qe=l,St=h,It.tag){case 1:if(At=It.payload,typeof At=="function"){Xe=At.call(St,Xe,qe);break e}Xe=At;break e;case 3:At.flags=At.flags&-65537|128;case 0:if(At=It.payload,qe=typeof At=="function"?At.call(St,Xe,qe):At,qe==null)break e;Xe=T({},Xe,qe);break e;case 2:ja=!0}}J.callback!==null&&J.lane!==0&&(s.flags|=64,qe=k.effects,qe===null?k.effects=[J]:qe.push(J))}else St={eventTime:St,lane:qe,tag:J.tag,payload:J.payload,callback:J.callback,next:null},$e===null?(Pe=$e=St,ae=Xe):$e=$e.next=St,E|=qe;if(J=J.next,J===null){if(J=k.shared.pending,J===null)break;qe=J,J=qe.next,qe.next=null,k.lastBaseUpdate=qe,k.shared.pending=null}}while(!0);if($e===null&&(ae=Xe),k.baseState=ae,k.firstBaseUpdate=Pe,k.lastBaseUpdate=$e,l=k.shared.interleaved,l!==null){k=l;do E|=k.lane,k=k.next;while(k!==l)}else S===null&&(k.shared.lanes=0);io|=E,s.lanes=E,s.memoizedState=Xe}}function Hv(s,l,h){if(s=l.effects,l.effects=null,s!==null)for(l=0;l<s.length;l++){var b=s[l],k=b.callback;if(k!==null){if(b.callback=null,b=h,typeof k!="function")throw Error(r(191,k));k.call(b)}}}var Yl={},Is=xa(Yl),Xl=xa(Yl),Ql=xa(Yl);function no(s){if(s===Yl)throw Error(r(174));return s}function sp(s,l){switch(Yn(Ql,l),Yn(Xl,s),Yn(Is,Yl),s=l.nodeType,s){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:Ae(null,"");break;default:s=s===8?l.parentNode:l,l=s.namespaceURI||null,s=s.tagName,l=Ae(l,s)}rr(Is),Yn(Is,l)}function tl(){rr(Is),rr(Xl),rr(Ql)}function zv(s){no(Ql.current);var l=no(Is.current),h=Ae(l,s.type);l!==h&&(Yn(Xl,s),Yn(Is,h))}function ap(s){Xl.current===s&&(rr(Is),rr(Xl))}var gr=xa(0);function Vu(s){for(var l=s;l!==null;){if(l.tag===13){var h=l.memoizedState;if(h!==null&&(h=h.dehydrated,h===null||h.data==="$?"||h.data==="$!"))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var op=[];function lp(){for(var s=0;s<op.length;s++)op[s]._workInProgressVersionPrimary=null;op.length=0}var Gu=Y.ReactCurrentDispatcher,cp=Y.ReactCurrentBatchConfig,ro=0,br=null,Br=null,$r=null,Ku=!1,Jl=!1,Zl=0,oM=0;function ni(){throw Error(r(321))}function up(s,l){if(l===null)return!1;for(var h=0;h<l.length&&h<s.length;h++)if(!fs(s[h],l[h]))return!1;return!0}function dp(s,l,h,b,k,S){if(ro=S,br=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,Gu.current=s===null||s.memoizedState===null?dM:hM,s=h(b,k),Jl){S=0;do{if(Jl=!1,Zl=0,25<=S)throw Error(r(301));S+=1,$r=Br=null,l.updateQueue=null,Gu.current=mM,s=h(b,k)}while(Jl)}if(Gu.current=Qu,l=Br!==null&&Br.next!==null,ro=0,$r=Br=br=null,Ku=!1,l)throw Error(r(300));return s}function hp(){var s=Zl!==0;return Zl=0,s}function Ls(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return $r===null?br.memoizedState=$r=s:$r=$r.next=s,$r}function es(){if(Br===null){var s=br.alternate;s=s!==null?s.memoizedState:null}else s=Br.next;var l=$r===null?br.memoizedState:$r.next;if(l!==null)$r=l,Br=s;else{if(s===null)throw Error(r(310));Br=s,s={memoizedState:Br.memoizedState,baseState:Br.baseState,baseQueue:Br.baseQueue,queue:Br.queue,next:null},$r===null?br.memoizedState=$r=s:$r=$r.next=s}return $r}function ec(s,l){return typeof l=="function"?l(s):l}function mp(s){var l=es(),h=l.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=s;var b=Br,k=b.baseQueue,S=h.pending;if(S!==null){if(k!==null){var E=k.next;k.next=S.next,S.next=E}b.baseQueue=k=S,h.pending=null}if(k!==null){S=k.next,b=b.baseState;var J=E=null,ae=null,Pe=S;do{var $e=Pe.lane;if((ro&$e)===$e)ae!==null&&(ae=ae.next={lane:0,action:Pe.action,hasEagerState:Pe.hasEagerState,eagerState:Pe.eagerState,next:null}),b=Pe.hasEagerState?Pe.eagerState:s(b,Pe.action);else{var Xe={lane:$e,action:Pe.action,hasEagerState:Pe.hasEagerState,eagerState:Pe.eagerState,next:null};ae===null?(J=ae=Xe,E=b):ae=ae.next=Xe,br.lanes|=$e,io|=$e}Pe=Pe.next}while(Pe!==null&&Pe!==S);ae===null?E=b:ae.next=J,fs(b,l.memoizedState)||(yi=!0),l.memoizedState=b,l.baseState=E,l.baseQueue=ae,h.lastRenderedState=b}if(s=h.interleaved,s!==null){k=s;do S=k.lane,br.lanes|=S,io|=S,k=k.next;while(k!==s)}else k===null&&(h.lanes=0);return[l.memoizedState,h.dispatch]}function pp(s){var l=es(),h=l.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=s;var b=h.dispatch,k=h.pending,S=l.memoizedState;if(k!==null){h.pending=null;var E=k=k.next;do S=s(S,E.action),E=E.next;while(E!==k);fs(S,l.memoizedState)||(yi=!0),l.memoizedState=S,l.baseQueue===null&&(l.baseState=S),h.lastRenderedState=S}return[S,b]}function qv(){}function $v(s,l){var h=br,b=es(),k=l(),S=!fs(b.memoizedState,k);if(S&&(b.memoizedState=k,yi=!0),b=b.queue,fp(Kv.bind(null,h,b,s),[s]),b.getSnapshot!==l||S||$r!==null&&$r.memoizedState.tag&1){if(h.flags|=2048,tc(9,Gv.bind(null,h,b,k,l),void 0,null),Vr===null)throw Error(r(349));(ro&30)!==0||Vv(h,l,k)}return k}function Vv(s,l,h){s.flags|=16384,s={getSnapshot:l,value:h},l=br.updateQueue,l===null?(l={lastEffect:null,stores:null},br.updateQueue=l,l.stores=[s]):(h=l.stores,h===null?l.stores=[s]:h.push(s))}function Gv(s,l,h,b){l.value=h,l.getSnapshot=b,Yv(l)&&Xv(s)}function Kv(s,l,h){return h(function(){Yv(l)&&Xv(s)})}function Yv(s){var l=s.getSnapshot;s=s.value;try{var h=l();return!fs(s,h)}catch{return!0}}function Xv(s){var l=ea(s,1);l!==null&&ys(l,s,1,-1)}function Qv(s){var l=Ls();return typeof s=="function"&&(s=s()),l.memoizedState=l.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ec,lastRenderedState:s},l.queue=s,s=s.dispatch=uM.bind(null,br,s),[l.memoizedState,s]}function tc(s,l,h,b){return s={tag:s,create:l,destroy:h,deps:b,next:null},l=br.updateQueue,l===null?(l={lastEffect:null,stores:null},br.updateQueue=l,l.lastEffect=s.next=s):(h=l.lastEffect,h===null?l.lastEffect=s.next=s:(b=h.next,h.next=s,s.next=b,l.lastEffect=s)),s}function Jv(){return es().memoizedState}function Yu(s,l,h,b){var k=Ls();br.flags|=s,k.memoizedState=tc(1|l,h,void 0,b===void 0?null:b)}function Xu(s,l,h,b){var k=es();b=b===void 0?null:b;var S=void 0;if(Br!==null){var E=Br.memoizedState;if(S=E.destroy,b!==null&&up(b,E.deps)){k.memoizedState=tc(l,h,S,b);return}}br.flags|=s,k.memoizedState=tc(1|l,h,S,b)}function Zv(s,l){return Yu(8390656,8,s,l)}function fp(s,l){return Xu(2048,8,s,l)}function ey(s,l){return Xu(4,2,s,l)}function ty(s,l){return Xu(4,4,s,l)}function ny(s,l){if(typeof l=="function")return s=s(),l(s),function(){l(null)};if(l!=null)return s=s(),l.current=s,function(){l.current=null}}function ry(s,l,h){return h=h!=null?h.concat([s]):null,Xu(4,4,ny.bind(null,l,s),h)}function gp(){}function iy(s,l){var h=es();l=l===void 0?null:l;var b=h.memoizedState;return b!==null&&l!==null&&up(l,b[1])?b[0]:(h.memoizedState=[s,l],s)}function sy(s,l){var h=es();l=l===void 0?null:l;var b=h.memoizedState;return b!==null&&l!==null&&up(l,b[1])?b[0]:(s=s(),h.memoizedState=[s,l],s)}function ay(s,l,h){return(ro&21)===0?(s.baseState&&(s.baseState=!1,yi=!0),s.memoizedState=h):(fs(h,l)||(h=sr(),br.lanes|=h,io|=h,s.baseState=!0),l)}function lM(s,l){var h=ee;ee=h!==0&&4>h?h:4,s(!0);var b=cp.transition;cp.transition={};try{s(!1),l()}finally{ee=h,cp.transition=b}}function oy(){return es().memoizedState}function cM(s,l,h){var b=Ra(s);if(h={lane:b,action:h,hasEagerState:!1,eagerState:null,next:null},ly(s))cy(l,h);else if(h=Bv(s,l,h,b),h!==null){var k=fi();ys(h,s,b,k),uy(h,l,b)}}function uM(s,l,h){var b=Ra(s),k={lane:b,action:h,hasEagerState:!1,eagerState:null,next:null};if(ly(s))cy(l,k);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=l.lastRenderedReducer,S!==null))try{var E=l.lastRenderedState,J=S(E,h);if(k.hasEagerState=!0,k.eagerState=J,fs(J,E)){var ae=l.interleaved;ae===null?(k.next=k,rp(l)):(k.next=ae.next,ae.next=k),l.interleaved=k;return}}catch{}finally{}h=Bv(s,l,k,b),h!==null&&(k=fi(),ys(h,s,b,k),uy(h,l,b))}}function ly(s){var l=s.alternate;return s===br||l!==null&&l===br}function cy(s,l){Jl=Ku=!0;var h=s.pending;h===null?l.next=l:(l.next=h.next,h.next=l),s.pending=l}function uy(s,l,h){if((h&4194240)!==0){var b=l.lanes;b&=s.pendingLanes,h|=b,l.lanes=h,ar(s,h)}}var Qu={readContext:Zi,useCallback:ni,useContext:ni,useEffect:ni,useImperativeHandle:ni,useInsertionEffect:ni,useLayoutEffect:ni,useMemo:ni,useReducer:ni,useRef:ni,useState:ni,useDebugValue:ni,useDeferredValue:ni,useTransition:ni,useMutableSource:ni,useSyncExternalStore:ni,useId:ni,unstable_isNewReconciler:!1},dM={readContext:Zi,useCallback:function(s,l){return Ls().memoizedState=[s,l===void 0?null:l],s},useContext:Zi,useEffect:Zv,useImperativeHandle:function(s,l,h){return h=h!=null?h.concat([s]):null,Yu(4194308,4,ny.bind(null,l,s),h)},useLayoutEffect:function(s,l){return Yu(4194308,4,s,l)},useInsertionEffect:function(s,l){return Yu(4,2,s,l)},useMemo:function(s,l){var h=Ls();return l=l===void 0?null:l,s=s(),h.memoizedState=[s,l],s},useReducer:function(s,l,h){var b=Ls();return l=h!==void 0?h(l):l,b.memoizedState=b.baseState=l,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:l},b.queue=s,s=s.dispatch=cM.bind(null,br,s),[b.memoizedState,s]},useRef:function(s){var l=Ls();return s={current:s},l.memoizedState=s},useState:Qv,useDebugValue:gp,useDeferredValue:function(s){return Ls().memoizedState=s},useTransition:function(){var s=Qv(!1),l=s[0];return s=lM.bind(null,s[1]),Ls().memoizedState=s,[l,s]},useMutableSource:function(){},useSyncExternalStore:function(s,l,h){var b=br,k=Ls();if(cr){if(h===void 0)throw Error(r(407));h=h()}else{if(h=l(),Vr===null)throw Error(r(349));(ro&30)!==0||Vv(b,l,h)}k.memoizedState=h;var S={value:h,getSnapshot:l};return k.queue=S,Zv(Kv.bind(null,b,S,s),[s]),b.flags|=2048,tc(9,Gv.bind(null,b,S,h,l),void 0,null),h},useId:function(){var s=Ls(),l=Vr.identifierPrefix;if(cr){var h=Zs,b=Js;h=(b&~(1<<32-zt(b)-1)).toString(32)+h,l=":"+l+"R"+h,h=Zl++,0<h&&(l+="H"+h.toString(32)),l+=":"}else h=oM++,l=":"+l+"r"+h.toString(32)+":";return s.memoizedState=l},unstable_isNewReconciler:!1},hM={readContext:Zi,useCallback:iy,useContext:Zi,useEffect:fp,useImperativeHandle:ry,useInsertionEffect:ey,useLayoutEffect:ty,useMemo:sy,useReducer:mp,useRef:Jv,useState:function(){return mp(ec)},useDebugValue:gp,useDeferredValue:function(s){var l=es();return ay(l,Br.memoizedState,s)},useTransition:function(){var s=mp(ec)[0],l=es().memoizedState;return[s,l]},useMutableSource:qv,useSyncExternalStore:$v,useId:oy,unstable_isNewReconciler:!1},mM={readContext:Zi,useCallback:iy,useContext:Zi,useEffect:fp,useImperativeHandle:ry,useInsertionEffect:ey,useLayoutEffect:ty,useMemo:sy,useReducer:pp,useRef:Jv,useState:function(){return pp(ec)},useDebugValue:gp,useDeferredValue:function(s){var l=es();return Br===null?l.memoizedState=s:ay(l,Br.memoizedState,s)},useTransition:function(){var s=pp(ec)[0],l=es().memoizedState;return[s,l]},useMutableSource:qv,useSyncExternalStore:$v,useId:oy,unstable_isNewReconciler:!1};function bs(s,l){if(s&&s.defaultProps){l=T({},l),s=s.defaultProps;for(var h in s)l[h]===void 0&&(l[h]=s[h]);return l}return l}function bp(s,l,h,b){l=s.memoizedState,h=h(b,l),h=h==null?l:T({},l,h),s.memoizedState=h,s.lanes===0&&(s.updateQueue.baseState=h)}var Ju={isMounted:function(s){return(s=s._reactInternals)?je(s)===s:!1},enqueueSetState:function(s,l,h){s=s._reactInternals;var b=fi(),k=Ra(s),S=ta(b,k);S.payload=l,h!=null&&(S.callback=h),l=Na(s,S,k),l!==null&&(ys(l,s,k,b),qu(l,s,k))},enqueueReplaceState:function(s,l,h){s=s._reactInternals;var b=fi(),k=Ra(s),S=ta(b,k);S.tag=1,S.payload=l,h!=null&&(S.callback=h),l=Na(s,S,k),l!==null&&(ys(l,s,k,b),qu(l,s,k))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var h=fi(),b=Ra(s),k=ta(h,b);k.tag=2,l!=null&&(k.callback=l),l=Na(s,k,b),l!==null&&(ys(l,s,b,h),qu(l,s,b))}};function dy(s,l,h,b,k,S,E){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(b,S,E):l.prototype&&l.prototype.isPureReactComponent?!Ul(h,b)||!Ul(k,S):!0}function hy(s,l,h){var b=!1,k=Sa,S=l.contextType;return typeof S=="object"&&S!==null?S=Zi(S):(k=vi(l)?Ja:ti.current,b=l.contextTypes,S=(b=b!=null)?Ko(s,k):Sa),l=new l(h,S),s.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Ju,s.stateNode=l,l._reactInternals=s,b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=k,s.__reactInternalMemoizedMaskedChildContext=S),l}function my(s,l,h,b){s=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(h,b),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(h,b),l.state!==s&&Ju.enqueueReplaceState(l,l.state,null)}function wp(s,l,h,b){var k=s.stateNode;k.props=h,k.state=s.memoizedState,k.refs={},ip(s);var S=l.contextType;typeof S=="object"&&S!==null?k.context=Zi(S):(S=vi(l)?Ja:ti.current,k.context=Ko(s,S)),k.state=s.memoizedState,S=l.getDerivedStateFromProps,typeof S=="function"&&(bp(s,l,S,h),k.state=s.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(l=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),l!==k.state&&Ju.enqueueReplaceState(k,k.state,null),$u(s,h,k,b),k.state=s.memoizedState),typeof k.componentDidMount=="function"&&(s.flags|=4194308)}function nl(s,l){try{var h="",b=l;do h+=le(b),b=b.return;while(b);var k=h}catch(S){k=`
|
|
40
|
-
Error generating stack: `+S.message+`
|
|
41
|
-
`+S.stack}return{value:s,source:l,stack:k,digest:null}}function vp(s,l,h){return{value:s,source:null,stack:h??null,digest:l??null}}function yp(s,l){try{console.error(l.value)}catch(h){setTimeout(function(){throw h})}}var pM=typeof WeakMap=="function"?WeakMap:Map;function py(s,l,h){h=ta(-1,h),h.tag=3,h.payload={element:null};var b=l.value;return h.callback=function(){sd||(sd=!0,Lp=b),yp(s,l)},h}function fy(s,l,h){h=ta(-1,h),h.tag=3;var b=s.type.getDerivedStateFromError;if(typeof b=="function"){var k=l.value;h.payload=function(){return b(k)},h.callback=function(){yp(s,l)}}var S=s.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(h.callback=function(){yp(s,l),typeof b!="function"&&(Pa===null?Pa=new Set([this]):Pa.add(this));var E=l.stack;this.componentDidCatch(l.value,{componentStack:E!==null?E:""})}),h}function gy(s,l,h){var b=s.pingCache;if(b===null){b=s.pingCache=new pM;var k=new Set;b.set(l,k)}else k=b.get(l),k===void 0&&(k=new Set,b.set(l,k));k.has(h)||(k.add(h),s=PM.bind(null,s,l,h),l.then(s,s))}function by(s){do{var l;if((l=s.tag===13)&&(l=s.memoizedState,l=l!==null?l.dehydrated!==null:!0),l)return s;s=s.return}while(s!==null);return null}function wy(s,l,h,b,k){return(s.mode&1)===0?(s===l?s.flags|=65536:(s.flags|=128,h.flags|=131072,h.flags&=-52805,h.tag===1&&(h.alternate===null?h.tag=17:(l=ta(-1,1),l.tag=2,Na(h,l,1))),h.lanes|=1),s):(s.flags|=65536,s.lanes=k,s)}var fM=Y.ReactCurrentOwner,yi=!1;function pi(s,l,h,b){l.child=s===null?Ov(l,null,h,b):Jo(l,s.child,h,b)}function vy(s,l,h,b,k){h=h.render;var S=l.ref;return el(l,k),b=dp(s,l,h,b,S,k),h=hp(),s!==null&&!yi?(l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~k,na(s,l,k)):(cr&&h&&Km(l),l.flags|=1,pi(s,l,b,k),l.child)}function yy(s,l,h,b,k){if(s===null){var S=h.type;return typeof S=="function"&&!Hp(S)&&S.defaultProps===void 0&&h.compare===null&&h.defaultProps===void 0?(l.tag=15,l.type=S,ky(s,l,S,b,k)):(s=dd(h.type,null,b,l,l.mode,k),s.ref=l.ref,s.return=l,l.child=s)}if(S=s.child,(s.lanes&k)===0){var E=S.memoizedProps;if(h=h.compare,h=h!==null?h:Ul,h(E,b)&&s.ref===l.ref)return na(s,l,k)}return l.flags|=1,s=Aa(S,b),s.ref=l.ref,s.return=l,l.child=s}function ky(s,l,h,b,k){if(s!==null){var S=s.memoizedProps;if(Ul(S,b)&&s.ref===l.ref)if(yi=!1,l.pendingProps=b=S,(s.lanes&k)!==0)(s.flags&131072)!==0&&(yi=!0);else return l.lanes=s.lanes,na(s,l,k)}return kp(s,l,h,b,k)}function xy(s,l,h){var b=l.pendingProps,k=b.children,S=s!==null?s.memoizedState:null;if(b.mode==="hidden")if((l.mode&1)===0)l.memoizedState={baseLanes:0,cachePool:null,transitions:null},Yn(il,zi),zi|=h;else{if((h&1073741824)===0)return s=S!==null?S.baseLanes|h:h,l.lanes=l.childLanes=1073741824,l.memoizedState={baseLanes:s,cachePool:null,transitions:null},l.updateQueue=null,Yn(il,zi),zi|=s,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=S!==null?S.baseLanes:h,Yn(il,zi),zi|=b}else S!==null?(b=S.baseLanes|h,l.memoizedState=null):b=h,Yn(il,zi),zi|=b;return pi(s,l,k,h),l.child}function Sy(s,l){var h=l.ref;(s===null&&h!==null||s!==null&&s.ref!==h)&&(l.flags|=512,l.flags|=2097152)}function kp(s,l,h,b,k){var S=vi(h)?Ja:ti.current;return S=Ko(l,S),el(l,k),h=dp(s,l,h,b,S,k),b=hp(),s!==null&&!yi?(l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~k,na(s,l,k)):(cr&&b&&Km(l),l.flags|=1,pi(s,l,h,k),l.child)}function Cy(s,l,h,b,k){if(vi(h)){var S=!0;Fu(l)}else S=!1;if(el(l,k),l.stateNode===null)ed(s,l),hy(l,h,b),wp(l,h,b,k),b=!0;else if(s===null){var E=l.stateNode,J=l.memoizedProps;E.props=J;var ae=E.context,Pe=h.contextType;typeof Pe=="object"&&Pe!==null?Pe=Zi(Pe):(Pe=vi(h)?Ja:ti.current,Pe=Ko(l,Pe));var $e=h.getDerivedStateFromProps,Xe=typeof $e=="function"||typeof E.getSnapshotBeforeUpdate=="function";Xe||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(J!==b||ae!==Pe)&&my(l,E,b,Pe),ja=!1;var qe=l.memoizedState;E.state=qe,$u(l,b,E,k),ae=l.memoizedState,J!==b||qe!==ae||wi.current||ja?(typeof $e=="function"&&(bp(l,h,$e,b),ae=l.memoizedState),(J=ja||dy(l,h,J,b,qe,ae,Pe))?(Xe||typeof E.UNSAFE_componentWillMount!="function"&&typeof E.componentWillMount!="function"||(typeof E.componentWillMount=="function"&&E.componentWillMount(),typeof E.UNSAFE_componentWillMount=="function"&&E.UNSAFE_componentWillMount()),typeof E.componentDidMount=="function"&&(l.flags|=4194308)):(typeof E.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=b,l.memoizedState=ae),E.props=b,E.state=ae,E.context=Pe,b=J):(typeof E.componentDidMount=="function"&&(l.flags|=4194308),b=!1)}else{E=l.stateNode,Wv(s,l),J=l.memoizedProps,Pe=l.type===l.elementType?J:bs(l.type,J),E.props=Pe,Xe=l.pendingProps,qe=E.context,ae=h.contextType,typeof ae=="object"&&ae!==null?ae=Zi(ae):(ae=vi(h)?Ja:ti.current,ae=Ko(l,ae));var St=h.getDerivedStateFromProps;($e=typeof St=="function"||typeof E.getSnapshotBeforeUpdate=="function")||typeof E.UNSAFE_componentWillReceiveProps!="function"&&typeof E.componentWillReceiveProps!="function"||(J!==Xe||qe!==ae)&&my(l,E,b,ae),ja=!1,qe=l.memoizedState,E.state=qe,$u(l,b,E,k);var At=l.memoizedState;J!==Xe||qe!==At||wi.current||ja?(typeof St=="function"&&(bp(l,h,St,b),At=l.memoizedState),(Pe=ja||dy(l,h,Pe,b,qe,At,ae)||!1)?($e||typeof E.UNSAFE_componentWillUpdate!="function"&&typeof E.componentWillUpdate!="function"||(typeof E.componentWillUpdate=="function"&&E.componentWillUpdate(b,At,ae),typeof E.UNSAFE_componentWillUpdate=="function"&&E.UNSAFE_componentWillUpdate(b,At,ae)),typeof E.componentDidUpdate=="function"&&(l.flags|=4),typeof E.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof E.componentDidUpdate!="function"||J===s.memoizedProps&&qe===s.memoizedState||(l.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||J===s.memoizedProps&&qe===s.memoizedState||(l.flags|=1024),l.memoizedProps=b,l.memoizedState=At),E.props=b,E.state=At,E.context=ae,b=Pe):(typeof E.componentDidUpdate!="function"||J===s.memoizedProps&&qe===s.memoizedState||(l.flags|=4),typeof E.getSnapshotBeforeUpdate!="function"||J===s.memoizedProps&&qe===s.memoizedState||(l.flags|=1024),b=!1)}return xp(s,l,h,b,S,k)}function xp(s,l,h,b,k,S){Sy(s,l);var E=(l.flags&128)!==0;if(!b&&!E)return k&&Dv(l,h,!1),na(s,l,S);b=l.stateNode,fM.current=l;var J=E&&typeof h.getDerivedStateFromError!="function"?null:b.render();return l.flags|=1,s!==null&&E?(l.child=Jo(l,s.child,null,S),l.child=Jo(l,null,J,S)):pi(s,l,J,S),l.memoizedState=b.state,k&&Dv(l,h,!0),l.child}function jy(s){var l=s.stateNode;l.pendingContext?Tv(s,l.pendingContext,l.pendingContext!==l.context):l.context&&Tv(s,l.context,!1),sp(s,l.containerInfo)}function Ny(s,l,h,b,k){return Qo(),Jm(k),l.flags|=256,pi(s,l,h,b),l.child}var Sp={dehydrated:null,treeContext:null,retryLane:0};function Cp(s){return{baseLanes:s,cachePool:null,transitions:null}}function Ty(s,l,h){var b=l.pendingProps,k=gr.current,S=!1,E=(l.flags&128)!==0,J;if((J=E)||(J=s!==null&&s.memoizedState===null?!1:(k&2)!==0),J?(S=!0,l.flags&=-129):(s===null||s.memoizedState!==null)&&(k|=1),Yn(gr,k&1),s===null)return Qm(l),s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((l.mode&1)===0?l.lanes=1:s.data==="$!"?l.lanes=8:l.lanes=1073741824,null):(E=b.children,s=b.fallback,S?(b=l.mode,S=l.child,E={mode:"hidden",children:E},(b&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=E):S=hd(E,b,0,null),s=lo(s,b,h,null),S.return=l,s.return=l,S.sibling=s,l.child=S,l.child.memoizedState=Cp(h),l.memoizedState=Sp,s):jp(l,E));if(k=s.memoizedState,k!==null&&(J=k.dehydrated,J!==null))return gM(s,l,E,b,J,k,h);if(S){S=b.fallback,E=l.mode,k=s.child,J=k.sibling;var ae={mode:"hidden",children:b.children};return(E&1)===0&&l.child!==k?(b=l.child,b.childLanes=0,b.pendingProps=ae,l.deletions=null):(b=Aa(k,ae),b.subtreeFlags=k.subtreeFlags&14680064),J!==null?S=Aa(J,S):(S=lo(S,E,h,null),S.flags|=2),S.return=l,b.return=l,b.sibling=S,l.child=b,b=S,S=l.child,E=s.child.memoizedState,E=E===null?Cp(h):{baseLanes:E.baseLanes|h,cachePool:null,transitions:E.transitions},S.memoizedState=E,S.childLanes=s.childLanes&~h,l.memoizedState=Sp,b}return S=s.child,s=S.sibling,b=Aa(S,{mode:"visible",children:b.children}),(l.mode&1)===0&&(b.lanes=h),b.return=l,b.sibling=null,s!==null&&(h=l.deletions,h===null?(l.deletions=[s],l.flags|=16):h.push(s)),l.child=b,l.memoizedState=null,b}function jp(s,l){return l=hd({mode:"visible",children:l},s.mode,0,null),l.return=s,s.child=l}function Zu(s,l,h,b){return b!==null&&Jm(b),Jo(l,s.child,null,h),s=jp(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function gM(s,l,h,b,k,S,E){if(h)return l.flags&256?(l.flags&=-257,b=vp(Error(r(422))),Zu(s,l,E,b)):l.memoizedState!==null?(l.child=s.child,l.flags|=128,null):(S=b.fallback,k=l.mode,b=hd({mode:"visible",children:b.children},k,0,null),S=lo(S,k,E,null),S.flags|=2,b.return=l,S.return=l,b.sibling=S,l.child=b,(l.mode&1)!==0&&Jo(l,s.child,null,E),l.child.memoizedState=Cp(E),l.memoizedState=Sp,S);if((l.mode&1)===0)return Zu(s,l,E,null);if(k.data==="$!"){if(b=k.nextSibling&&k.nextSibling.dataset,b)var J=b.dgst;return b=J,S=Error(r(419)),b=vp(S,b,void 0),Zu(s,l,E,b)}if(J=(E&s.childLanes)!==0,yi||J){if(b=Vr,b!==null){switch(E&-E){case 4:k=2;break;case 16:k=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:k=32;break;case 536870912:k=268435456;break;default:k=0}k=(k&(b.suspendedLanes|E))!==0?0:k,k!==0&&k!==S.retryLane&&(S.retryLane=k,ea(s,k),ys(b,s,k,-1))}return Up(),b=vp(Error(r(421))),Zu(s,l,E,b)}return k.data==="$?"?(l.flags|=128,l.child=s.child,l=DM.bind(null,s),k._reactRetry=l,null):(s=S.treeContext,Hi=ka(k.nextSibling),Ui=l,cr=!0,gs=null,s!==null&&(Qi[Ji++]=Js,Qi[Ji++]=Zs,Qi[Ji++]=Za,Js=s.id,Zs=s.overflow,Za=l),l=jp(l,b.children),l.flags|=4096,l)}function Py(s,l,h){s.lanes|=l;var b=s.alternate;b!==null&&(b.lanes|=l),np(s.return,l,h)}function Np(s,l,h,b,k){var S=s.memoizedState;S===null?s.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:b,tail:h,tailMode:k}:(S.isBackwards=l,S.rendering=null,S.renderingStartTime=0,S.last=b,S.tail=h,S.tailMode=k)}function Dy(s,l,h){var b=l.pendingProps,k=b.revealOrder,S=b.tail;if(pi(s,l,b.children,h),b=gr.current,(b&2)!==0)b=b&1|2,l.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Py(s,h,l);else if(s.tag===19)Py(s,h,l);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===l)break e;for(;s.sibling===null;){if(s.return===null||s.return===l)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}b&=1}if(Yn(gr,b),(l.mode&1)===0)l.memoizedState=null;else switch(k){case"forwards":for(h=l.child,k=null;h!==null;)s=h.alternate,s!==null&&Vu(s)===null&&(k=h),h=h.sibling;h=k,h===null?(k=l.child,l.child=null):(k=h.sibling,h.sibling=null),Np(l,!1,k,h,S);break;case"backwards":for(h=null,k=l.child,l.child=null;k!==null;){if(s=k.alternate,s!==null&&Vu(s)===null){l.child=k;break}s=k.sibling,k.sibling=h,h=k,k=s}Np(l,!0,h,null,S);break;case"together":Np(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function ed(s,l){(l.mode&1)===0&&s!==null&&(s.alternate=null,l.alternate=null,l.flags|=2)}function na(s,l,h){if(s!==null&&(l.dependencies=s.dependencies),io|=l.lanes,(h&l.childLanes)===0)return null;if(s!==null&&l.child!==s.child)throw Error(r(153));if(l.child!==null){for(s=l.child,h=Aa(s,s.pendingProps),l.child=h,h.return=l;s.sibling!==null;)s=s.sibling,h=h.sibling=Aa(s,s.pendingProps),h.return=l;h.sibling=null}return l.child}function bM(s,l,h){switch(l.tag){case 3:jy(l),Qo();break;case 5:zv(l);break;case 1:vi(l.type)&&Fu(l);break;case 4:sp(l,l.stateNode.containerInfo);break;case 10:var b=l.type._context,k=l.memoizedProps.value;Yn(Hu,b._currentValue),b._currentValue=k;break;case 13:if(b=l.memoizedState,b!==null)return b.dehydrated!==null?(Yn(gr,gr.current&1),l.flags|=128,null):(h&l.child.childLanes)!==0?Ty(s,l,h):(Yn(gr,gr.current&1),s=na(s,l,h),s!==null?s.sibling:null);Yn(gr,gr.current&1);break;case 19:if(b=(h&l.childLanes)!==0,(s.flags&128)!==0){if(b)return Dy(s,l,h);l.flags|=128}if(k=l.memoizedState,k!==null&&(k.rendering=null,k.tail=null,k.lastEffect=null),Yn(gr,gr.current),b)break;return null;case 22:case 23:return l.lanes=0,xy(s,l,h)}return na(s,l,h)}var Ry,Tp,My,Ay;Ry=function(s,l){for(var h=l.child;h!==null;){if(h.tag===5||h.tag===6)s.appendChild(h.stateNode);else if(h.tag!==4&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===l)break;for(;h.sibling===null;){if(h.return===null||h.return===l)return;h=h.return}h.sibling.return=h.return,h=h.sibling}},Tp=function(){},My=function(s,l,h,b){var k=s.memoizedProps;if(k!==b){s=l.stateNode,no(Is.current);var S=null;switch(h){case"input":k=bt(s,k),b=bt(s,b),S=[];break;case"select":k=T({},k,{value:void 0}),b=T({},b,{value:void 0}),S=[];break;case"textarea":k=Ie(s,k),b=Ie(s,b),S=[];break;default:typeof k.onClick!="function"&&typeof b.onClick=="function"&&(s.onclick=Eu)}Nt(h,b);var E;h=null;for(Pe in k)if(!b.hasOwnProperty(Pe)&&k.hasOwnProperty(Pe)&&k[Pe]!=null)if(Pe==="style"){var J=k[Pe];for(E in J)J.hasOwnProperty(E)&&(h||(h={}),h[E]="")}else Pe!=="dangerouslySetInnerHTML"&&Pe!=="children"&&Pe!=="suppressContentEditableWarning"&&Pe!=="suppressHydrationWarning"&&Pe!=="autoFocus"&&(a.hasOwnProperty(Pe)?S||(S=[]):(S=S||[]).push(Pe,null));for(Pe in b){var ae=b[Pe];if(J=k!=null?k[Pe]:void 0,b.hasOwnProperty(Pe)&&ae!==J&&(ae!=null||J!=null))if(Pe==="style")if(J){for(E in J)!J.hasOwnProperty(E)||ae&&ae.hasOwnProperty(E)||(h||(h={}),h[E]="");for(E in ae)ae.hasOwnProperty(E)&&J[E]!==ae[E]&&(h||(h={}),h[E]=ae[E])}else h||(S||(S=[]),S.push(Pe,h)),h=ae;else Pe==="dangerouslySetInnerHTML"?(ae=ae?ae.__html:void 0,J=J?J.__html:void 0,ae!=null&&J!==ae&&(S=S||[]).push(Pe,ae)):Pe==="children"?typeof ae!="string"&&typeof ae!="number"||(S=S||[]).push(Pe,""+ae):Pe!=="suppressContentEditableWarning"&&Pe!=="suppressHydrationWarning"&&(a.hasOwnProperty(Pe)?(ae!=null&&Pe==="onScroll"&&nr("scroll",s),S||J===ae||(S=[])):(S=S||[]).push(Pe,ae))}h&&(S=S||[]).push("style",h);var Pe=S;(l.updateQueue=Pe)&&(l.flags|=4)}},Ay=function(s,l,h,b){h!==b&&(l.flags|=4)};function nc(s,l){if(!cr)switch(s.tailMode){case"hidden":l=s.tail;for(var h=null;l!==null;)l.alternate!==null&&(h=l),l=l.sibling;h===null?s.tail=null:h.sibling=null;break;case"collapsed":h=s.tail;for(var b=null;h!==null;)h.alternate!==null&&(b=h),h=h.sibling;b===null?l||s.tail===null?s.tail=null:s.tail.sibling=null:b.sibling=null}}function ri(s){var l=s.alternate!==null&&s.alternate.child===s.child,h=0,b=0;if(l)for(var k=s.child;k!==null;)h|=k.lanes|k.childLanes,b|=k.subtreeFlags&14680064,b|=k.flags&14680064,k.return=s,k=k.sibling;else for(k=s.child;k!==null;)h|=k.lanes|k.childLanes,b|=k.subtreeFlags,b|=k.flags,k.return=s,k=k.sibling;return s.subtreeFlags|=b,s.childLanes=h,l}function wM(s,l,h){var b=l.pendingProps;switch(Ym(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ri(l),null;case 1:return vi(l.type)&&Lu(),ri(l),null;case 3:return b=l.stateNode,tl(),rr(wi),rr(ti),lp(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(s===null||s.child===null)&&(Wu(l)?l.flags|=4:s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,gs!==null&&(Op(gs),gs=null))),Tp(s,l),ri(l),null;case 5:ap(l);var k=no(Ql.current);if(h=l.type,s!==null&&l.stateNode!=null)My(s,l,h,b,k),s.ref!==l.ref&&(l.flags|=512,l.flags|=2097152);else{if(!b){if(l.stateNode===null)throw Error(r(166));return ri(l),null}if(s=no(Is.current),Wu(l)){b=l.stateNode,h=l.type;var S=l.memoizedProps;switch(b[Es]=l,b[Vl]=S,s=(l.mode&1)!==0,h){case"dialog":nr("cancel",b),nr("close",b);break;case"iframe":case"object":case"embed":nr("load",b);break;case"video":case"audio":for(k=0;k<zl.length;k++)nr(zl[k],b);break;case"source":nr("error",b);break;case"img":case"image":case"link":nr("error",b),nr("load",b);break;case"details":nr("toggle",b);break;case"input":pt(b,S),nr("invalid",b);break;case"select":b._wrapperState={wasMultiple:!!S.multiple},nr("invalid",b);break;case"textarea":Be(b,S),nr("invalid",b)}Nt(h,S),k=null;for(var E in S)if(S.hasOwnProperty(E)){var J=S[E];E==="children"?typeof J=="string"?b.textContent!==J&&(S.suppressHydrationWarning!==!0&&Au(b.textContent,J,s),k=["children",J]):typeof J=="number"&&b.textContent!==""+J&&(S.suppressHydrationWarning!==!0&&Au(b.textContent,J,s),k=["children",""+J]):a.hasOwnProperty(E)&&J!=null&&E==="onScroll"&&nr("scroll",b)}switch(h){case"input":Dt(b),Le(b,S,!0);break;case"textarea":Dt(b),ft(b);break;case"select":case"option":break;default:typeof S.onClick=="function"&&(b.onclick=Eu)}b=k,l.updateQueue=b,b!==null&&(l.flags|=4)}else{E=k.nodeType===9?k:k.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=ve(h)),s==="http://www.w3.org/1999/xhtml"?h==="script"?(s=E.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof b.is=="string"?s=E.createElement(h,{is:b.is}):(s=E.createElement(h),h==="select"&&(E=s,b.multiple?E.multiple=!0:b.size&&(E.size=b.size))):s=E.createElementNS(s,h),s[Es]=l,s[Vl]=b,Ry(s,l,!1,!1),l.stateNode=s;e:{switch(E=ln(h,b),h){case"dialog":nr("cancel",s),nr("close",s),k=b;break;case"iframe":case"object":case"embed":nr("load",s),k=b;break;case"video":case"audio":for(k=0;k<zl.length;k++)nr(zl[k],s);k=b;break;case"source":nr("error",s),k=b;break;case"img":case"image":case"link":nr("error",s),nr("load",s),k=b;break;case"details":nr("toggle",s),k=b;break;case"input":pt(s,b),k=bt(s,b),nr("invalid",s);break;case"option":k=b;break;case"select":s._wrapperState={wasMultiple:!!b.multiple},k=T({},b,{value:void 0}),nr("invalid",s);break;case"textarea":Be(s,b),k=Ie(s,b),nr("invalid",s);break;default:k=b}Nt(h,k),J=k;for(S in J)if(J.hasOwnProperty(S)){var ae=J[S];S==="style"?Wt(s,ae):S==="dangerouslySetInnerHTML"?(ae=ae?ae.__html:void 0,ae!=null&&We(s,ae)):S==="children"?typeof ae=="string"?(h!=="textarea"||ae!=="")&<(s,ae):typeof ae=="number"&<(s,""+ae):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&(a.hasOwnProperty(S)?ae!=null&&S==="onScroll"&&nr("scroll",s):ae!=null&&L(s,S,ae,E))}switch(h){case"input":Dt(s),Le(s,b,!1);break;case"textarea":Dt(s),ft(s);break;case"option":b.value!=null&&s.setAttribute("value",""+Ne(b.value));break;case"select":s.multiple=!!b.multiple,S=b.value,S!=null?wt(s,!!b.multiple,S,!1):b.defaultValue!=null&&wt(s,!!b.multiple,b.defaultValue,!0);break;default:typeof k.onClick=="function"&&(s.onclick=Eu)}switch(h){case"button":case"input":case"select":case"textarea":b=!!b.autoFocus;break e;case"img":b=!0;break e;default:b=!1}}b&&(l.flags|=4)}l.ref!==null&&(l.flags|=512,l.flags|=2097152)}return ri(l),null;case 6:if(s&&l.stateNode!=null)Ay(s,l,s.memoizedProps,b);else{if(typeof b!="string"&&l.stateNode===null)throw Error(r(166));if(h=no(Ql.current),no(Is.current),Wu(l)){if(b=l.stateNode,h=l.memoizedProps,b[Es]=l,(S=b.nodeValue!==h)&&(s=Ui,s!==null))switch(s.tag){case 3:Au(b.nodeValue,h,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&Au(b.nodeValue,h,(s.mode&1)!==0)}S&&(l.flags|=4)}else b=(h.nodeType===9?h:h.ownerDocument).createTextNode(b),b[Es]=l,l.stateNode=b}return ri(l),null;case 13:if(rr(gr),b=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(cr&&Hi!==null&&(l.mode&1)!==0&&(l.flags&128)===0)Lv(),Qo(),l.flags|=98560,S=!1;else if(S=Wu(l),b!==null&&b.dehydrated!==null){if(s===null){if(!S)throw Error(r(318));if(S=l.memoizedState,S=S!==null?S.dehydrated:null,!S)throw Error(r(317));S[Es]=l}else Qo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;ri(l),S=!1}else gs!==null&&(Op(gs),gs=null),S=!0;if(!S)return l.flags&65536?l:null}return(l.flags&128)!==0?(l.lanes=h,l):(b=b!==null,b!==(s!==null&&s.memoizedState!==null)&&b&&(l.child.flags|=8192,(l.mode&1)!==0&&(s===null||(gr.current&1)!==0?Wr===0&&(Wr=3):Up())),l.updateQueue!==null&&(l.flags|=4),ri(l),null);case 4:return tl(),Tp(s,l),s===null&&ql(l.stateNode.containerInfo),ri(l),null;case 10:return tp(l.type._context),ri(l),null;case 17:return vi(l.type)&&Lu(),ri(l),null;case 19:if(rr(gr),S=l.memoizedState,S===null)return ri(l),null;if(b=(l.flags&128)!==0,E=S.rendering,E===null)if(b)nc(S,!1);else{if(Wr!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(E=Vu(s),E!==null){for(l.flags|=128,nc(S,!1),b=E.updateQueue,b!==null&&(l.updateQueue=b,l.flags|=4),l.subtreeFlags=0,b=h,h=l.child;h!==null;)S=h,s=b,S.flags&=14680066,E=S.alternate,E===null?(S.childLanes=0,S.lanes=s,S.child=null,S.subtreeFlags=0,S.memoizedProps=null,S.memoizedState=null,S.updateQueue=null,S.dependencies=null,S.stateNode=null):(S.childLanes=E.childLanes,S.lanes=E.lanes,S.child=E.child,S.subtreeFlags=0,S.deletions=null,S.memoizedProps=E.memoizedProps,S.memoizedState=E.memoizedState,S.updateQueue=E.updateQueue,S.type=E.type,s=E.dependencies,S.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),h=h.sibling;return Yn(gr,gr.current&1|2),l.child}s=s.sibling}S.tail!==null&&_t()>sl&&(l.flags|=128,b=!0,nc(S,!1),l.lanes=4194304)}else{if(!b)if(s=Vu(E),s!==null){if(l.flags|=128,b=!0,h=s.updateQueue,h!==null&&(l.updateQueue=h,l.flags|=4),nc(S,!0),S.tail===null&&S.tailMode==="hidden"&&!E.alternate&&!cr)return ri(l),null}else 2*_t()-S.renderingStartTime>sl&&h!==1073741824&&(l.flags|=128,b=!0,nc(S,!1),l.lanes=4194304);S.isBackwards?(E.sibling=l.child,l.child=E):(h=S.last,h!==null?h.sibling=E:l.child=E,S.last=E)}return S.tail!==null?(l=S.tail,S.rendering=l,S.tail=l.sibling,S.renderingStartTime=_t(),l.sibling=null,h=gr.current,Yn(gr,b?h&1|2:h&1),l):(ri(l),null);case 22:case 23:return Wp(),b=l.memoizedState!==null,s!==null&&s.memoizedState!==null!==b&&(l.flags|=8192),b&&(l.mode&1)!==0?(zi&1073741824)!==0&&(ri(l),l.subtreeFlags&6&&(l.flags|=8192)):ri(l),null;case 24:return null;case 25:return null}throw Error(r(156,l.tag))}function vM(s,l){switch(Ym(l),l.tag){case 1:return vi(l.type)&&Lu(),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return tl(),rr(wi),rr(ti),lp(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 5:return ap(l),null;case 13:if(rr(gr),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Qo()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return rr(gr),null;case 4:return tl(),null;case 10:return tp(l.type._context),null;case 22:case 23:return Wp(),null;case 24:return null;default:return null}}var td=!1,ii=!1,yM=typeof WeakSet=="function"?WeakSet:Set,Pt=null;function rl(s,l){var h=s.ref;if(h!==null)if(typeof h=="function")try{h(null)}catch(b){xr(s,l,b)}else h.current=null}function Pp(s,l,h){try{h()}catch(b){xr(s,l,b)}}var Ey=!1;function kM(s,l){if(Wm=Zr,s=dv(),Am(s)){if("selectionStart"in s)var h={start:s.selectionStart,end:s.selectionEnd};else e:{h=(h=s.ownerDocument)&&h.defaultView||window;var b=h.getSelection&&h.getSelection();if(b&&b.rangeCount!==0){h=b.anchorNode;var k=b.anchorOffset,S=b.focusNode;b=b.focusOffset;try{h.nodeType,S.nodeType}catch{h=null;break e}var E=0,J=-1,ae=-1,Pe=0,$e=0,Xe=s,qe=null;t:for(;;){for(var St;Xe!==h||k!==0&&Xe.nodeType!==3||(J=E+k),Xe!==S||b!==0&&Xe.nodeType!==3||(ae=E+b),Xe.nodeType===3&&(E+=Xe.nodeValue.length),(St=Xe.firstChild)!==null;)qe=Xe,Xe=St;for(;;){if(Xe===s)break t;if(qe===h&&++Pe===k&&(J=E),qe===S&&++$e===b&&(ae=E),(St=Xe.nextSibling)!==null)break;Xe=qe,qe=Xe.parentNode}Xe=St}h=J===-1||ae===-1?null:{start:J,end:ae}}else h=null}h=h||{start:0,end:0}}else h=null;for(Um={focusedElem:s,selectionRange:h},Zr=!1,Pt=l;Pt!==null;)if(l=Pt,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,Pt=s;else for(;Pt!==null;){l=Pt;try{var At=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(At!==null){var It=At.memoizedProps,Cr=At.memoizedState,ke=l.stateNode,ce=ke.getSnapshotBeforeUpdate(l.elementType===l.type?It:bs(l.type,It),Cr);ke.__reactInternalSnapshotBeforeUpdate=ce}break;case 3:var xe=l.stateNode.containerInfo;xe.nodeType===1?xe.textContent="":xe.nodeType===9&&xe.documentElement&&xe.removeChild(xe.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(it){xr(l,l.return,it)}if(s=l.sibling,s!==null){s.return=l.return,Pt=s;break}Pt=l.return}return At=Ey,Ey=!1,At}function rc(s,l,h){var b=l.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var k=b=b.next;do{if((k.tag&s)===s){var S=k.destroy;k.destroy=void 0,S!==void 0&&Pp(l,h,S)}k=k.next}while(k!==b)}}function nd(s,l){if(l=l.updateQueue,l=l!==null?l.lastEffect:null,l!==null){var h=l=l.next;do{if((h.tag&s)===s){var b=h.create;h.destroy=b()}h=h.next}while(h!==l)}}function Dp(s){var l=s.ref;if(l!==null){var h=s.stateNode;switch(s.tag){case 5:s=h;break;default:s=h}typeof l=="function"?l(s):l.current=s}}function Iy(s){var l=s.alternate;l!==null&&(s.alternate=null,Iy(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&(delete l[Es],delete l[Vl],delete l[$m],delete l[rM],delete l[iM])),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}function Ly(s){return s.tag===5||s.tag===3||s.tag===4}function Fy(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Ly(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Rp(s,l,h){var b=s.tag;if(b===5||b===6)s=s.stateNode,l?h.nodeType===8?h.parentNode.insertBefore(s,l):h.insertBefore(s,l):(h.nodeType===8?(l=h.parentNode,l.insertBefore(s,h)):(l=h,l.appendChild(s)),h=h._reactRootContainer,h!=null||l.onclick!==null||(l.onclick=Eu));else if(b!==4&&(s=s.child,s!==null))for(Rp(s,l,h),s=s.sibling;s!==null;)Rp(s,l,h),s=s.sibling}function Mp(s,l,h){var b=s.tag;if(b===5||b===6)s=s.stateNode,l?h.insertBefore(s,l):h.appendChild(s);else if(b!==4&&(s=s.child,s!==null))for(Mp(s,l,h),s=s.sibling;s!==null;)Mp(s,l,h),s=s.sibling}var Xr=null,ws=!1;function Ta(s,l,h){for(h=h.child;h!==null;)_y(s,l,h),h=h.sibling}function _y(s,l,h){if(en&&typeof en.onCommitFiberUnmount=="function")try{en.onCommitFiberUnmount(Mt,h)}catch{}switch(h.tag){case 5:ii||rl(h,l);case 6:var b=Xr,k=ws;Xr=null,Ta(s,l,h),Xr=b,ws=k,Xr!==null&&(ws?(s=Xr,h=h.stateNode,s.nodeType===8?s.parentNode.removeChild(h):s.removeChild(h)):Xr.removeChild(h.stateNode));break;case 18:Xr!==null&&(ws?(s=Xr,h=h.stateNode,s.nodeType===8?qm(s.parentNode,h):s.nodeType===1&&qm(s,h),jn(s)):qm(Xr,h.stateNode));break;case 4:b=Xr,k=ws,Xr=h.stateNode.containerInfo,ws=!0,Ta(s,l,h),Xr=b,ws=k;break;case 0:case 11:case 14:case 15:if(!ii&&(b=h.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){k=b=b.next;do{var S=k,E=S.destroy;S=S.tag,E!==void 0&&((S&2)!==0||(S&4)!==0)&&Pp(h,l,E),k=k.next}while(k!==b)}Ta(s,l,h);break;case 1:if(!ii&&(rl(h,l),b=h.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=h.memoizedProps,b.state=h.memoizedState,b.componentWillUnmount()}catch(J){xr(h,l,J)}Ta(s,l,h);break;case 21:Ta(s,l,h);break;case 22:h.mode&1?(ii=(b=ii)||h.memoizedState!==null,Ta(s,l,h),ii=b):Ta(s,l,h);break;default:Ta(s,l,h)}}function Oy(s){var l=s.updateQueue;if(l!==null){s.updateQueue=null;var h=s.stateNode;h===null&&(h=s.stateNode=new yM),l.forEach(function(b){var k=RM.bind(null,s,b);h.has(b)||(h.add(b),b.then(k,k))})}}function vs(s,l){var h=l.deletions;if(h!==null)for(var b=0;b<h.length;b++){var k=h[b];try{var S=s,E=l,J=E;e:for(;J!==null;){switch(J.tag){case 5:Xr=J.stateNode,ws=!1;break e;case 3:Xr=J.stateNode.containerInfo,ws=!0;break e;case 4:Xr=J.stateNode.containerInfo,ws=!0;break e}J=J.return}if(Xr===null)throw Error(r(160));_y(S,E,k),Xr=null,ws=!1;var ae=k.alternate;ae!==null&&(ae.return=null),k.return=null}catch(Pe){xr(k,l,Pe)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)By(l,s),l=l.sibling}function By(s,l){var h=s.alternate,b=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(vs(l,s),Fs(s),b&4){try{rc(3,s,s.return),nd(3,s)}catch(It){xr(s,s.return,It)}try{rc(5,s,s.return)}catch(It){xr(s,s.return,It)}}break;case 1:vs(l,s),Fs(s),b&512&&h!==null&&rl(h,h.return);break;case 5:if(vs(l,s),Fs(s),b&512&&h!==null&&rl(h,h.return),s.flags&32){var k=s.stateNode;try{lt(k,"")}catch(It){xr(s,s.return,It)}}if(b&4&&(k=s.stateNode,k!=null)){var S=s.memoizedProps,E=h!==null?h.memoizedProps:S,J=s.type,ae=s.updateQueue;if(s.updateQueue=null,ae!==null)try{J==="input"&&S.type==="radio"&&S.name!=null&&we(k,S),ln(J,E);var Pe=ln(J,S);for(E=0;E<ae.length;E+=2){var $e=ae[E],Xe=ae[E+1];$e==="style"?Wt(k,Xe):$e==="dangerouslySetInnerHTML"?We(k,Xe):$e==="children"?lt(k,Xe):L(k,$e,Xe,Pe)}switch(J){case"input":he(k,S);break;case"textarea":vt(k,S);break;case"select":var qe=k._wrapperState.wasMultiple;k._wrapperState.wasMultiple=!!S.multiple;var St=S.value;St!=null?wt(k,!!S.multiple,St,!1):qe!==!!S.multiple&&(S.defaultValue!=null?wt(k,!!S.multiple,S.defaultValue,!0):wt(k,!!S.multiple,S.multiple?[]:"",!1))}k[Vl]=S}catch(It){xr(s,s.return,It)}}break;case 6:if(vs(l,s),Fs(s),b&4){if(s.stateNode===null)throw Error(r(162));k=s.stateNode,S=s.memoizedProps;try{k.nodeValue=S}catch(It){xr(s,s.return,It)}}break;case 3:if(vs(l,s),Fs(s),b&4&&h!==null&&h.memoizedState.isDehydrated)try{jn(l.containerInfo)}catch(It){xr(s,s.return,It)}break;case 4:vs(l,s),Fs(s);break;case 13:vs(l,s),Fs(s),k=s.child,k.flags&8192&&(S=k.memoizedState!==null,k.stateNode.isHidden=S,!S||k.alternate!==null&&k.alternate.memoizedState!==null||(Ip=_t())),b&4&&Oy(s);break;case 22:if($e=h!==null&&h.memoizedState!==null,s.mode&1?(ii=(Pe=ii)||$e,vs(l,s),ii=Pe):vs(l,s),Fs(s),b&8192){if(Pe=s.memoizedState!==null,(s.stateNode.isHidden=Pe)&&!$e&&(s.mode&1)!==0)for(Pt=s,$e=s.child;$e!==null;){for(Xe=Pt=$e;Pt!==null;){switch(qe=Pt,St=qe.child,qe.tag){case 0:case 11:case 14:case 15:rc(4,qe,qe.return);break;case 1:rl(qe,qe.return);var At=qe.stateNode;if(typeof At.componentWillUnmount=="function"){b=qe,h=qe.return;try{l=b,At.props=l.memoizedProps,At.state=l.memoizedState,At.componentWillUnmount()}catch(It){xr(b,h,It)}}break;case 5:rl(qe,qe.return);break;case 22:if(qe.memoizedState!==null){Hy(Xe);continue}}St!==null?(St.return=qe,Pt=St):Hy(Xe)}$e=$e.sibling}e:for($e=null,Xe=s;;){if(Xe.tag===5){if($e===null){$e=Xe;try{k=Xe.stateNode,Pe?(S=k.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none"):(J=Xe.stateNode,ae=Xe.memoizedProps.style,E=ae!=null&&ae.hasOwnProperty("display")?ae.display:null,J.style.display=Bt("display",E))}catch(It){xr(s,s.return,It)}}}else if(Xe.tag===6){if($e===null)try{Xe.stateNode.nodeValue=Pe?"":Xe.memoizedProps}catch(It){xr(s,s.return,It)}}else if((Xe.tag!==22&&Xe.tag!==23||Xe.memoizedState===null||Xe===s)&&Xe.child!==null){Xe.child.return=Xe,Xe=Xe.child;continue}if(Xe===s)break e;for(;Xe.sibling===null;){if(Xe.return===null||Xe.return===s)break e;$e===Xe&&($e=null),Xe=Xe.return}$e===Xe&&($e=null),Xe.sibling.return=Xe.return,Xe=Xe.sibling}}break;case 19:vs(l,s),Fs(s),b&4&&Oy(s);break;case 21:break;default:vs(l,s),Fs(s)}}function Fs(s){var l=s.flags;if(l&2){try{e:{for(var h=s.return;h!==null;){if(Ly(h)){var b=h;break e}h=h.return}throw Error(r(160))}switch(b.tag){case 5:var k=b.stateNode;b.flags&32&&(lt(k,""),b.flags&=-33);var S=Fy(s);Mp(s,S,k);break;case 3:case 4:var E=b.stateNode.containerInfo,J=Fy(s);Rp(s,J,E);break;default:throw Error(r(161))}}catch(ae){xr(s,s.return,ae)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function xM(s,l,h){Pt=s,Wy(s)}function Wy(s,l,h){for(var b=(s.mode&1)!==0;Pt!==null;){var k=Pt,S=k.child;if(k.tag===22&&b){var E=k.memoizedState!==null||td;if(!E){var J=k.alternate,ae=J!==null&&J.memoizedState!==null||ii;J=td;var Pe=ii;if(td=E,(ii=ae)&&!Pe)for(Pt=k;Pt!==null;)E=Pt,ae=E.child,E.tag===22&&E.memoizedState!==null?zy(k):ae!==null?(ae.return=E,Pt=ae):zy(k);for(;S!==null;)Pt=S,Wy(S),S=S.sibling;Pt=k,td=J,ii=Pe}Uy(s)}else(k.subtreeFlags&8772)!==0&&S!==null?(S.return=k,Pt=S):Uy(s)}}function Uy(s){for(;Pt!==null;){var l=Pt;if((l.flags&8772)!==0){var h=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:ii||nd(5,l);break;case 1:var b=l.stateNode;if(l.flags&4&&!ii)if(h===null)b.componentDidMount();else{var k=l.elementType===l.type?h.memoizedProps:bs(l.type,h.memoizedProps);b.componentDidUpdate(k,h.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var S=l.updateQueue;S!==null&&Hv(l,S,b);break;case 3:var E=l.updateQueue;if(E!==null){if(h=null,l.child!==null)switch(l.child.tag){case 5:h=l.child.stateNode;break;case 1:h=l.child.stateNode}Hv(l,E,h)}break;case 5:var J=l.stateNode;if(h===null&&l.flags&4){h=J;var ae=l.memoizedProps;switch(l.type){case"button":case"input":case"select":case"textarea":ae.autoFocus&&h.focus();break;case"img":ae.src&&(h.src=ae.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(l.memoizedState===null){var Pe=l.alternate;if(Pe!==null){var $e=Pe.memoizedState;if($e!==null){var Xe=$e.dehydrated;Xe!==null&&jn(Xe)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}ii||l.flags&512&&Dp(l)}catch(qe){xr(l,l.return,qe)}}if(l===s){Pt=null;break}if(h=l.sibling,h!==null){h.return=l.return,Pt=h;break}Pt=l.return}}function Hy(s){for(;Pt!==null;){var l=Pt;if(l===s){Pt=null;break}var h=l.sibling;if(h!==null){h.return=l.return,Pt=h;break}Pt=l.return}}function zy(s){for(;Pt!==null;){var l=Pt;try{switch(l.tag){case 0:case 11:case 15:var h=l.return;try{nd(4,l)}catch(ae){xr(l,h,ae)}break;case 1:var b=l.stateNode;if(typeof b.componentDidMount=="function"){var k=l.return;try{b.componentDidMount()}catch(ae){xr(l,k,ae)}}var S=l.return;try{Dp(l)}catch(ae){xr(l,S,ae)}break;case 5:var E=l.return;try{Dp(l)}catch(ae){xr(l,E,ae)}}}catch(ae){xr(l,l.return,ae)}if(l===s){Pt=null;break}var J=l.sibling;if(J!==null){J.return=l.return,Pt=J;break}Pt=l.return}}var SM=Math.ceil,rd=Y.ReactCurrentDispatcher,Ap=Y.ReactCurrentOwner,ts=Y.ReactCurrentBatchConfig,Rn=0,Vr=null,Rr=null,Qr=0,zi=0,il=xa(0),Wr=0,ic=null,io=0,id=0,Ep=0,sc=null,ki=null,Ip=0,sl=1/0,ra=null,sd=!1,Lp=null,Pa=null,ad=!1,Da=null,od=0,ac=0,Fp=null,ld=-1,cd=0;function fi(){return(Rn&6)!==0?_t():ld!==-1?ld:ld=_t()}function Ra(s){return(s.mode&1)===0?1:(Rn&2)!==0&&Qr!==0?Qr&-Qr:aM.transition!==null?(cd===0&&(cd=sr()),cd):(s=ee,s!==0||(s=window.event,s=s===void 0?16:ei(s.type)),s)}function ys(s,l,h,b){if(50<ac)throw ac=0,Fp=null,Error(r(185));un(s,h,b),((Rn&2)===0||s!==Vr)&&(s===Vr&&((Rn&2)===0&&(id|=h),Wr===4&&Ma(s,Qr)),xi(s,b),h===1&&Rn===0&&(l.mode&1)===0&&(sl=_t()+500,_u&&Ca()))}function xi(s,l){var h=s.callbackNode;_i(s,l);var b=Sr(s,s===Vr?Qr:0);if(b===0)h!==null&&Tn(h),s.callbackNode=null,s.callbackPriority=0;else if(l=b&-b,s.callbackPriority!==l){if(h!=null&&Tn(h),l===1)s.tag===0?sM($y.bind(null,s)):Rv($y.bind(null,s)),tM(function(){(Rn&6)===0&&Ca()}),h=null;else{switch(Ke(b)){case 1:h=mn;break;case 4:h=bn;break;case 16:h=Ce;break;case 536870912:h=mt;break;default:h=Ce}h=Zy(h,qy.bind(null,s))}s.callbackPriority=l,s.callbackNode=h}}function qy(s,l){if(ld=-1,cd=0,(Rn&6)!==0)throw Error(r(327));var h=s.callbackNode;if(al()&&s.callbackNode!==h)return null;var b=Sr(s,s===Vr?Qr:0);if(b===0)return null;if((b&30)!==0||(b&s.expiredLanes)!==0||l)l=ud(s,b);else{l=b;var k=Rn;Rn|=2;var S=Gy();(Vr!==s||Qr!==l)&&(ra=null,sl=_t()+500,ao(s,l));do try{NM();break}catch(J){Vy(s,J)}while(!0);ep(),rd.current=S,Rn=k,Rr!==null?l=0:(Vr=null,Qr=0,l=Wr)}if(l!==0){if(l===2&&(k=Hr(s),k!==0&&(b=k,l=_p(s,k))),l===1)throw h=ic,ao(s,0),Ma(s,b),xi(s,_t()),h;if(l===6)Ma(s,b);else{if(k=s.current.alternate,(b&30)===0&&!CM(k)&&(l=ud(s,b),l===2&&(S=Hr(s),S!==0&&(b=S,l=_p(s,S))),l===1))throw h=ic,ao(s,0),Ma(s,b),xi(s,_t()),h;switch(s.finishedWork=k,s.finishedLanes=b,l){case 0:case 1:throw Error(r(345));case 2:oo(s,ki,ra);break;case 3:if(Ma(s,b),(b&130023424)===b&&(l=Ip+500-_t(),10<l)){if(Sr(s,0)!==0)break;if(k=s.suspendedLanes,(k&b)!==b){fi(),s.pingedLanes|=s.suspendedLanes&k;break}s.timeoutHandle=zm(oo.bind(null,s,ki,ra),l);break}oo(s,ki,ra);break;case 4:if(Ma(s,b),(b&4194240)===b)break;for(l=s.eventTimes,k=-1;0<b;){var E=31-zt(b);S=1<<E,E=l[E],E>k&&(k=E),b&=~S}if(b=k,b=_t()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*SM(b/1960))-b,10<b){s.timeoutHandle=zm(oo.bind(null,s,ki,ra),b);break}oo(s,ki,ra);break;case 5:oo(s,ki,ra);break;default:throw Error(r(329))}}}return xi(s,_t()),s.callbackNode===h?qy.bind(null,s):null}function _p(s,l){var h=sc;return s.current.memoizedState.isDehydrated&&(ao(s,l).flags|=256),s=ud(s,l),s!==2&&(l=ki,ki=h,l!==null&&Op(l)),s}function Op(s){ki===null?ki=s:ki.push.apply(ki,s)}function CM(s){for(var l=s;;){if(l.flags&16384){var h=l.updateQueue;if(h!==null&&(h=h.stores,h!==null))for(var b=0;b<h.length;b++){var k=h[b],S=k.getSnapshot;k=k.value;try{if(!fs(S(),k))return!1}catch{return!1}}}if(h=l.child,l.subtreeFlags&16384&&h!==null)h.return=l,l=h;else{if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Ma(s,l){for(l&=~Ep,l&=~id,s.suspendedLanes|=l,s.pingedLanes&=~l,s=s.expirationTimes;0<l;){var h=31-zt(l),b=1<<h;s[h]=-1,l&=~b}}function $y(s){if((Rn&6)!==0)throw Error(r(327));al();var l=Sr(s,0);if((l&1)===0)return xi(s,_t()),null;var h=ud(s,l);if(s.tag!==0&&h===2){var b=Hr(s);b!==0&&(l=b,h=_p(s,b))}if(h===1)throw h=ic,ao(s,0),Ma(s,l),xi(s,_t()),h;if(h===6)throw Error(r(345));return s.finishedWork=s.current.alternate,s.finishedLanes=l,oo(s,ki,ra),xi(s,_t()),null}function Bp(s,l){var h=Rn;Rn|=1;try{return s(l)}finally{Rn=h,Rn===0&&(sl=_t()+500,_u&&Ca())}}function so(s){Da!==null&&Da.tag===0&&(Rn&6)===0&&al();var l=Rn;Rn|=1;var h=ts.transition,b=ee;try{if(ts.transition=null,ee=1,s)return s()}finally{ee=b,ts.transition=h,Rn=l,(Rn&6)===0&&Ca()}}function Wp(){zi=il.current,rr(il)}function ao(s,l){s.finishedWork=null,s.finishedLanes=0;var h=s.timeoutHandle;if(h!==-1&&(s.timeoutHandle=-1,eM(h)),Rr!==null)for(h=Rr.return;h!==null;){var b=h;switch(Ym(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&Lu();break;case 3:tl(),rr(wi),rr(ti),lp();break;case 5:ap(b);break;case 4:tl();break;case 13:rr(gr);break;case 19:rr(gr);break;case 10:tp(b.type._context);break;case 22:case 23:Wp()}h=h.return}if(Vr=s,Rr=s=Aa(s.current,null),Qr=zi=l,Wr=0,ic=null,Ep=id=io=0,ki=sc=null,to!==null){for(l=0;l<to.length;l++)if(h=to[l],b=h.interleaved,b!==null){h.interleaved=null;var k=b.next,S=h.pending;if(S!==null){var E=S.next;S.next=k,b.next=E}h.pending=b}to=null}return s}function Vy(s,l){do{var h=Rr;try{if(ep(),Gu.current=Qu,Ku){for(var b=br.memoizedState;b!==null;){var k=b.queue;k!==null&&(k.pending=null),b=b.next}Ku=!1}if(ro=0,$r=Br=br=null,Jl=!1,Zl=0,Ap.current=null,h===null||h.return===null){Wr=1,ic=l,Rr=null;break}e:{var S=s,E=h.return,J=h,ae=l;if(l=Qr,J.flags|=32768,ae!==null&&typeof ae=="object"&&typeof ae.then=="function"){var Pe=ae,$e=J,Xe=$e.tag;if(($e.mode&1)===0&&(Xe===0||Xe===11||Xe===15)){var qe=$e.alternate;qe?($e.updateQueue=qe.updateQueue,$e.memoizedState=qe.memoizedState,$e.lanes=qe.lanes):($e.updateQueue=null,$e.memoizedState=null)}var St=by(E);if(St!==null){St.flags&=-257,wy(St,E,J,S,l),St.mode&1&&gy(S,Pe,l),l=St,ae=Pe;var At=l.updateQueue;if(At===null){var It=new Set;It.add(ae),l.updateQueue=It}else At.add(ae);break e}else{if((l&1)===0){gy(S,Pe,l),Up();break e}ae=Error(r(426))}}else if(cr&&J.mode&1){var Cr=by(E);if(Cr!==null){(Cr.flags&65536)===0&&(Cr.flags|=256),wy(Cr,E,J,S,l),Jm(nl(ae,J));break e}}S=ae=nl(ae,J),Wr!==4&&(Wr=2),sc===null?sc=[S]:sc.push(S),S=E;do{switch(S.tag){case 3:S.flags|=65536,l&=-l,S.lanes|=l;var ke=py(S,ae,l);Uv(S,ke);break e;case 1:J=ae;var ce=S.type,xe=S.stateNode;if((S.flags&128)===0&&(typeof ce.getDerivedStateFromError=="function"||xe!==null&&typeof xe.componentDidCatch=="function"&&(Pa===null||!Pa.has(xe)))){S.flags|=65536,l&=-l,S.lanes|=l;var it=fy(S,J,l);Uv(S,it);break e}}S=S.return}while(S!==null)}Yy(h)}catch(Ft){l=Ft,Rr===h&&h!==null&&(Rr=h=h.return);continue}break}while(!0)}function Gy(){var s=rd.current;return rd.current=Qu,s===null?Qu:s}function Up(){(Wr===0||Wr===3||Wr===2)&&(Wr=4),Vr===null||(io&268435455)===0&&(id&268435455)===0||Ma(Vr,Qr)}function ud(s,l){var h=Rn;Rn|=2;var b=Gy();(Vr!==s||Qr!==l)&&(ra=null,ao(s,l));do try{jM();break}catch(k){Vy(s,k)}while(!0);if(ep(),Rn=h,rd.current=b,Rr!==null)throw Error(r(261));return Vr=null,Qr=0,Wr}function jM(){for(;Rr!==null;)Ky(Rr)}function NM(){for(;Rr!==null&&!Zn();)Ky(Rr)}function Ky(s){var l=Jy(s.alternate,s,zi);s.memoizedProps=s.pendingProps,l===null?Yy(s):Rr=l,Ap.current=null}function Yy(s){var l=s;do{var h=l.alternate;if(s=l.return,(l.flags&32768)===0){if(h=wM(h,l,zi),h!==null){Rr=h;return}}else{if(h=vM(h,l),h!==null){h.flags&=32767,Rr=h;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Wr=6,Rr=null;return}}if(l=l.sibling,l!==null){Rr=l;return}Rr=l=s}while(l!==null);Wr===0&&(Wr=5)}function oo(s,l,h){var b=ee,k=ts.transition;try{ts.transition=null,ee=1,TM(s,l,h,b)}finally{ts.transition=k,ee=b}return null}function TM(s,l,h,b){do al();while(Da!==null);if((Rn&6)!==0)throw Error(r(327));h=s.finishedWork;var k=s.finishedLanes;if(h===null)return null;if(s.finishedWork=null,s.finishedLanes=0,h===s.current)throw Error(r(177));s.callbackNode=null,s.callbackPriority=0;var S=h.lanes|h.childLanes;if(Jr(s,S),s===Vr&&(Rr=Vr=null,Qr=0),(h.subtreeFlags&2064)===0&&(h.flags&2064)===0||ad||(ad=!0,Zy(Ce,function(){return al(),null})),S=(h.flags&15990)!==0,(h.subtreeFlags&15990)!==0||S){S=ts.transition,ts.transition=null;var E=ee;ee=1;var J=Rn;Rn|=4,Ap.current=null,kM(s,h),By(h,s),GR(Um),Zr=!!Wm,Um=Wm=null,s.current=h,xM(h),Cn(),Rn=J,ee=E,ts.transition=S}else s.current=h;if(ad&&(ad=!1,Da=s,od=k),S=s.pendingLanes,S===0&&(Pa=null),An(h.stateNode),xi(s,_t()),l!==null)for(b=s.onRecoverableError,h=0;h<l.length;h++)k=l[h],b(k.value,{componentStack:k.stack,digest:k.digest});if(sd)throw sd=!1,s=Lp,Lp=null,s;return(od&1)!==0&&s.tag!==0&&al(),S=s.pendingLanes,(S&1)!==0?s===Fp?ac++:(ac=0,Fp=s):ac=0,Ca(),null}function al(){if(Da!==null){var s=Ke(od),l=ts.transition,h=ee;try{if(ts.transition=null,ee=16>s?16:s,Da===null)var b=!1;else{if(s=Da,Da=null,od=0,(Rn&6)!==0)throw Error(r(331));var k=Rn;for(Rn|=4,Pt=s.current;Pt!==null;){var S=Pt,E=S.child;if((Pt.flags&16)!==0){var J=S.deletions;if(J!==null){for(var ae=0;ae<J.length;ae++){var Pe=J[ae];for(Pt=Pe;Pt!==null;){var $e=Pt;switch($e.tag){case 0:case 11:case 15:rc(8,$e,S)}var Xe=$e.child;if(Xe!==null)Xe.return=$e,Pt=Xe;else for(;Pt!==null;){$e=Pt;var qe=$e.sibling,St=$e.return;if(Iy($e),$e===Pe){Pt=null;break}if(qe!==null){qe.return=St,Pt=qe;break}Pt=St}}}var At=S.alternate;if(At!==null){var It=At.child;if(It!==null){At.child=null;do{var Cr=It.sibling;It.sibling=null,It=Cr}while(It!==null)}}Pt=S}}if((S.subtreeFlags&2064)!==0&&E!==null)E.return=S,Pt=E;else e:for(;Pt!==null;){if(S=Pt,(S.flags&2048)!==0)switch(S.tag){case 0:case 11:case 15:rc(9,S,S.return)}var ke=S.sibling;if(ke!==null){ke.return=S.return,Pt=ke;break e}Pt=S.return}}var ce=s.current;for(Pt=ce;Pt!==null;){E=Pt;var xe=E.child;if((E.subtreeFlags&2064)!==0&&xe!==null)xe.return=E,Pt=xe;else e:for(E=ce;Pt!==null;){if(J=Pt,(J.flags&2048)!==0)try{switch(J.tag){case 0:case 11:case 15:nd(9,J)}}catch(Ft){xr(J,J.return,Ft)}if(J===E){Pt=null;break e}var it=J.sibling;if(it!==null){it.return=J.return,Pt=it;break e}Pt=J.return}}if(Rn=k,Ca(),en&&typeof en.onPostCommitFiberRoot=="function")try{en.onPostCommitFiberRoot(Mt,s)}catch{}b=!0}return b}finally{ee=h,ts.transition=l}}return!1}function Xy(s,l,h){l=nl(h,l),l=py(s,l,1),s=Na(s,l,1),l=fi(),s!==null&&(un(s,1,l),xi(s,l))}function xr(s,l,h){if(s.tag===3)Xy(s,s,h);else for(;l!==null;){if(l.tag===3){Xy(l,s,h);break}else if(l.tag===1){var b=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(Pa===null||!Pa.has(b))){s=nl(h,s),s=fy(l,s,1),l=Na(l,s,1),s=fi(),l!==null&&(un(l,1,s),xi(l,s));break}}l=l.return}}function PM(s,l,h){var b=s.pingCache;b!==null&&b.delete(l),l=fi(),s.pingedLanes|=s.suspendedLanes&h,Vr===s&&(Qr&h)===h&&(Wr===4||Wr===3&&(Qr&130023424)===Qr&&500>_t()-Ip?ao(s,0):Ep|=h),xi(s,l)}function Qy(s,l){l===0&&((s.mode&1)===0?l=1:(l=vr,vr<<=1,(vr&130023424)===0&&(vr=4194304)));var h=fi();s=ea(s,l),s!==null&&(un(s,l,h),xi(s,h))}function DM(s){var l=s.memoizedState,h=0;l!==null&&(h=l.retryLane),Qy(s,h)}function RM(s,l){var h=0;switch(s.tag){case 13:var b=s.stateNode,k=s.memoizedState;k!==null&&(h=k.retryLane);break;case 19:b=s.stateNode;break;default:throw Error(r(314))}b!==null&&b.delete(l),Qy(s,h)}var Jy;Jy=function(s,l,h){if(s!==null)if(s.memoizedProps!==l.pendingProps||wi.current)yi=!0;else{if((s.lanes&h)===0&&(l.flags&128)===0)return yi=!1,bM(s,l,h);yi=(s.flags&131072)!==0}else yi=!1,cr&&(l.flags&1048576)!==0&&Mv(l,Bu,l.index);switch(l.lanes=0,l.tag){case 2:var b=l.type;ed(s,l),s=l.pendingProps;var k=Ko(l,ti.current);el(l,h),k=dp(null,l,b,s,k,h);var S=hp();return l.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(l.tag=1,l.memoizedState=null,l.updateQueue=null,vi(b)?(S=!0,Fu(l)):S=!1,l.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,ip(l),k.updater=Ju,l.stateNode=k,k._reactInternals=l,wp(l,b,s,h),l=xp(null,l,b,!0,S,h)):(l.tag=0,cr&&S&&Km(l),pi(null,l,k,h),l=l.child),l;case 16:b=l.elementType;e:{switch(ed(s,l),s=l.pendingProps,k=b._init,b=k(b._payload),l.type=b,k=l.tag=AM(b),s=bs(b,s),k){case 0:l=kp(null,l,b,s,h);break e;case 1:l=Cy(null,l,b,s,h);break e;case 11:l=vy(null,l,b,s,h);break e;case 14:l=yy(null,l,b,bs(b.type,s),h);break e}throw Error(r(306,b,""))}return l;case 0:return b=l.type,k=l.pendingProps,k=l.elementType===b?k:bs(b,k),kp(s,l,b,k,h);case 1:return b=l.type,k=l.pendingProps,k=l.elementType===b?k:bs(b,k),Cy(s,l,b,k,h);case 3:e:{if(jy(l),s===null)throw Error(r(387));b=l.pendingProps,S=l.memoizedState,k=S.element,Wv(s,l),$u(l,b,null,h);var E=l.memoizedState;if(b=E.element,S.isDehydrated)if(S={element:b,isDehydrated:!1,cache:E.cache,pendingSuspenseBoundaries:E.pendingSuspenseBoundaries,transitions:E.transitions},l.updateQueue.baseState=S,l.memoizedState=S,l.flags&256){k=nl(Error(r(423)),l),l=Ny(s,l,b,h,k);break e}else if(b!==k){k=nl(Error(r(424)),l),l=Ny(s,l,b,h,k);break e}else for(Hi=ka(l.stateNode.containerInfo.firstChild),Ui=l,cr=!0,gs=null,h=Ov(l,null,b,h),l.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling;else{if(Qo(),b===k){l=na(s,l,h);break e}pi(s,l,b,h)}l=l.child}return l;case 5:return zv(l),s===null&&Qm(l),b=l.type,k=l.pendingProps,S=s!==null?s.memoizedProps:null,E=k.children,Hm(b,k)?E=null:S!==null&&Hm(b,S)&&(l.flags|=32),Sy(s,l),pi(s,l,E,h),l.child;case 6:return s===null&&Qm(l),null;case 13:return Ty(s,l,h);case 4:return sp(l,l.stateNode.containerInfo),b=l.pendingProps,s===null?l.child=Jo(l,null,b,h):pi(s,l,b,h),l.child;case 11:return b=l.type,k=l.pendingProps,k=l.elementType===b?k:bs(b,k),vy(s,l,b,k,h);case 7:return pi(s,l,l.pendingProps,h),l.child;case 8:return pi(s,l,l.pendingProps.children,h),l.child;case 12:return pi(s,l,l.pendingProps.children,h),l.child;case 10:e:{if(b=l.type._context,k=l.pendingProps,S=l.memoizedProps,E=k.value,Yn(Hu,b._currentValue),b._currentValue=E,S!==null)if(fs(S.value,E)){if(S.children===k.children&&!wi.current){l=na(s,l,h);break e}}else for(S=l.child,S!==null&&(S.return=l);S!==null;){var J=S.dependencies;if(J!==null){E=S.child;for(var ae=J.firstContext;ae!==null;){if(ae.context===b){if(S.tag===1){ae=ta(-1,h&-h),ae.tag=2;var Pe=S.updateQueue;if(Pe!==null){Pe=Pe.shared;var $e=Pe.pending;$e===null?ae.next=ae:(ae.next=$e.next,$e.next=ae),Pe.pending=ae}}S.lanes|=h,ae=S.alternate,ae!==null&&(ae.lanes|=h),np(S.return,h,l),J.lanes|=h;break}ae=ae.next}}else if(S.tag===10)E=S.type===l.type?null:S.child;else if(S.tag===18){if(E=S.return,E===null)throw Error(r(341));E.lanes|=h,J=E.alternate,J!==null&&(J.lanes|=h),np(E,h,l),E=S.sibling}else E=S.child;if(E!==null)E.return=S;else for(E=S;E!==null;){if(E===l){E=null;break}if(S=E.sibling,S!==null){S.return=E.return,E=S;break}E=E.return}S=E}pi(s,l,k.children,h),l=l.child}return l;case 9:return k=l.type,b=l.pendingProps.children,el(l,h),k=Zi(k),b=b(k),l.flags|=1,pi(s,l,b,h),l.child;case 14:return b=l.type,k=bs(b,l.pendingProps),k=bs(b.type,k),yy(s,l,b,k,h);case 15:return ky(s,l,l.type,l.pendingProps,h);case 17:return b=l.type,k=l.pendingProps,k=l.elementType===b?k:bs(b,k),ed(s,l),l.tag=1,vi(b)?(s=!0,Fu(l)):s=!1,el(l,h),hy(l,b,k),wp(l,b,k,h),xp(null,l,b,!0,s,h);case 19:return Dy(s,l,h);case 22:return xy(s,l,h)}throw Error(r(156,l.tag))};function Zy(s,l){return Zt(s,l)}function MM(s,l,h,b){this.tag=s,this.key=h,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ns(s,l,h,b){return new MM(s,l,h,b)}function Hp(s){return s=s.prototype,!(!s||!s.isReactComponent)}function AM(s){if(typeof s=="function")return Hp(s)?1:0;if(s!=null){if(s=s.$$typeof,s===U)return 11;if(s===A)return 14}return 2}function Aa(s,l){var h=s.alternate;return h===null?(h=ns(s.tag,l,s.key,s.mode),h.elementType=s.elementType,h.type=s.type,h.stateNode=s.stateNode,h.alternate=s,s.alternate=h):(h.pendingProps=l,h.type=s.type,h.flags=0,h.subtreeFlags=0,h.deletions=null),h.flags=s.flags&14680064,h.childLanes=s.childLanes,h.lanes=s.lanes,h.child=s.child,h.memoizedProps=s.memoizedProps,h.memoizedState=s.memoizedState,h.updateQueue=s.updateQueue,l=s.dependencies,h.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},h.sibling=s.sibling,h.index=s.index,h.ref=s.ref,h}function dd(s,l,h,b,k,S){var E=2;if(b=s,typeof s=="function")Hp(s)&&(E=1);else if(typeof s=="string")E=5;else e:switch(s){case I:return lo(h.children,k,S,l);case M:E=8,k|=8;break;case O:return s=ns(12,h,l,k|2),s.elementType=O,s.lanes=S,s;case G:return s=ns(13,h,l,k),s.elementType=G,s.lanes=S,s;case R:return s=ns(19,h,l,k),s.elementType=R,s.lanes=S,s;case pe:return hd(h,k,S,l);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case F:E=10;break e;case X:E=9;break e;case U:E=11;break e;case A:E=14;break e;case Z:E=16,b=null;break e}throw Error(r(130,s==null?s:typeof s,""))}return l=ns(E,h,l,k),l.elementType=s,l.type=b,l.lanes=S,l}function lo(s,l,h,b){return s=ns(7,s,b,l),s.lanes=h,s}function hd(s,l,h,b){return s=ns(22,s,b,l),s.elementType=pe,s.lanes=h,s.stateNode={isHidden:!1},s}function zp(s,l,h){return s=ns(6,s,null,l),s.lanes=h,s}function qp(s,l,h){return l=ns(4,s.children!==null?s.children:[],s.key,l),l.lanes=h,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}function EM(s,l,h,b,k){this.tag=l,this.containerInfo=s,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Pr(0),this.expirationTimes=Pr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pr(0),this.identifierPrefix=b,this.onRecoverableError=k,this.mutableSourceEagerHydrationData=null}function $p(s,l,h,b,k,S,E,J,ae){return s=new EM(s,l,h,J,ae),l===1?(l=1,S===!0&&(l|=8)):l=0,S=ns(3,null,null,l),s.current=S,S.stateNode=s,S.memoizedState={element:b,isDehydrated:h,cache:null,transitions:null,pendingSuspenseBoundaries:null},ip(S),s}function IM(s,l,h){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:W,key:b==null?null:""+b,children:s,containerInfo:l,implementation:h}}function ek(s){if(!s)return Sa;s=s._reactInternals;e:{if(je(s)!==s||s.tag!==1)throw Error(r(170));var l=s;do{switch(l.tag){case 3:l=l.stateNode.context;break e;case 1:if(vi(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break e}}l=l.return}while(l!==null);throw Error(r(171))}if(s.tag===1){var h=s.type;if(vi(h))return Pv(s,h,l)}return l}function tk(s,l,h,b,k,S,E,J,ae){return s=$p(h,b,!0,s,k,S,E,J,ae),s.context=ek(null),h=s.current,b=fi(),k=Ra(h),S=ta(b,k),S.callback=l??null,Na(h,S,k),s.current.lanes=k,un(s,k,b),xi(s,b),s}function md(s,l,h,b){var k=l.current,S=fi(),E=Ra(k);return h=ek(h),l.context===null?l.context=h:l.pendingContext=h,l=ta(S,E),l.payload={element:s},b=b===void 0?null:b,b!==null&&(l.callback=b),s=Na(k,l,E),s!==null&&(ys(s,k,E,S),qu(s,k,E)),E}function pd(s){if(s=s.current,!s.child)return null;switch(s.child.tag){case 5:return s.child.stateNode;default:return s.child.stateNode}}function nk(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var h=s.retryLane;s.retryLane=h!==0&&h<l?h:l}}function Vp(s,l){nk(s,l),(s=s.alternate)&&nk(s,l)}function LM(){return null}var rk=typeof reportError=="function"?reportError:function(s){console.error(s)};function Gp(s){this._internalRoot=s}fd.prototype.render=Gp.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(r(409));md(s,l,null,null)},fd.prototype.unmount=Gp.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;so(function(){md(null,s,null,null)}),l[Xs]=null}};function fd(s){this._internalRoot=s}fd.prototype.unstable_scheduleHydration=function(s){if(s){var l=on();s={blockedOn:null,target:s,priority:l};for(var h=0;h<Fr.length&&l!==0&&l<Fr[h].priority;h++);Fr.splice(h,0,s),h===0&&ge(s)}};function Kp(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function gd(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function ik(){}function FM(s,l,h,b,k){if(k){if(typeof b=="function"){var S=b;b=function(){var Pe=pd(E);S.call(Pe)}}var E=tk(l,b,s,0,null,!1,!1,"",ik);return s._reactRootContainer=E,s[Xs]=E.current,ql(s.nodeType===8?s.parentNode:s),so(),E}for(;k=s.lastChild;)s.removeChild(k);if(typeof b=="function"){var J=b;b=function(){var Pe=pd(ae);J.call(Pe)}}var ae=$p(s,0,!1,null,null,!1,!1,"",ik);return s._reactRootContainer=ae,s[Xs]=ae.current,ql(s.nodeType===8?s.parentNode:s),so(function(){md(l,ae,h,b)}),ae}function bd(s,l,h,b,k){var S=h._reactRootContainer;if(S){var E=S;if(typeof k=="function"){var J=k;k=function(){var ae=pd(E);J.call(ae)}}md(l,E,s,k)}else E=FM(h,l,s,k,b);return pd(E)}Je=function(s){switch(s.tag){case 3:var l=s.stateNode;if(l.current.memoizedState.isDehydrated){var h=On(l.pendingLanes);h!==0&&(ar(l,h|1),xi(l,_t()),(Rn&6)===0&&(sl=_t()+500,Ca()))}break;case 13:so(function(){var b=ea(s,1);if(b!==null){var k=fi();ys(b,s,1,k)}}),Vp(s,1)}},Et=function(s){if(s.tag===13){var l=ea(s,134217728);if(l!==null){var h=fi();ys(l,s,134217728,h)}Vp(s,134217728)}},an=function(s){if(s.tag===13){var l=Ra(s),h=ea(s,l);if(h!==null){var b=fi();ys(h,s,l,b)}Vp(s,l)}},on=function(){return ee},nn=function(s,l){var h=ee;try{return ee=s,l()}finally{ee=h}},se=function(s,l,h){switch(l){case"input":if(he(s,h),l=h.name,h.type==="radio"&&l!=null){for(h=s;h.parentNode;)h=h.parentNode;for(h=h.querySelectorAll("input[name="+JSON.stringify(""+l)+'][type="radio"]'),l=0;l<h.length;l++){var b=h[l];if(b!==s&&b.form===s.form){var k=Iu(b);if(!k)throw Error(r(90));st(b),he(b,k)}}}break;case"textarea":vt(s,h);break;case"select":l=h.value,l!=null&&wt(s,!!h.multiple,l,!1)}},kn=Bp,Ht=so;var _M={usingClientEntryPoint:!1,Events:[Gl,Vo,Iu,Mn,wn,Bp]},oc={findFiberByHostInstance:Qa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},OM={bundleType:oc.bundleType,version:oc.version,rendererPackageName:oc.rendererPackageName,rendererConfig:oc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Y.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=Kt(s),s===null?null:s.stateNode},findFiberByHostInstance:oc.findFiberByHostInstance||LM,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var wd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wd.isDisabled&&wd.supportsFiber)try{Mt=wd.inject(OM),en=wd}catch{}}return Si.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_M,Si.createPortal=function(s,l){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Kp(l))throw Error(r(200));return IM(s,l,null,h)},Si.createRoot=function(s,l){if(!Kp(s))throw Error(r(299));var h=!1,b="",k=rk;return l!=null&&(l.unstable_strictMode===!0&&(h=!0),l.identifierPrefix!==void 0&&(b=l.identifierPrefix),l.onRecoverableError!==void 0&&(k=l.onRecoverableError)),l=$p(s,1,!1,null,null,h,!1,b,k),s[Xs]=l.current,ql(s.nodeType===8?s.parentNode:s),new Gp(l)},Si.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var l=s._reactInternals;if(l===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=Kt(l),s=s===null?null:s.stateNode,s},Si.flushSync=function(s){return so(s)},Si.hydrate=function(s,l,h){if(!gd(l))throw Error(r(200));return bd(null,s,l,!0,h)},Si.hydrateRoot=function(s,l,h){if(!Kp(s))throw Error(r(405));var b=h!=null&&h.hydratedSources||null,k=!1,S="",E=rk;if(h!=null&&(h.unstable_strictMode===!0&&(k=!0),h.identifierPrefix!==void 0&&(S=h.identifierPrefix),h.onRecoverableError!==void 0&&(E=h.onRecoverableError)),l=tk(l,null,s,1,h??null,k,!1,S,E),s[Xs]=l.current,ql(s),b)for(s=0;s<b.length;s++)h=b[s],k=h._getVersion,k=k(h._source),l.mutableSourceEagerHydrationData==null?l.mutableSourceEagerHydrationData=[h,k]:l.mutableSourceEagerHydrationData.push(h,k);return new fd(l)},Si.render=function(s,l,h){if(!gd(l))throw Error(r(200));return bd(null,s,l,!1,h)},Si.unmountComponentAtNode=function(s){if(!gd(s))throw Error(r(40));return s._reactRootContainer?(so(function(){bd(null,null,s,!1,function(){s._reactRootContainer=null,s[Xs]=null})}),!0):!1},Si.unstable_batchedUpdates=Bp,Si.unstable_renderSubtreeIntoContainer=function(s,l,h,b){if(!gd(h))throw Error(r(200));if(s==null||s._reactInternals===void 0)throw Error(r(38));return bd(s,l,h,!1,b)},Si.version="18.3.1-next-f1338f8080-20240426",Si}var hk;function Xj(){if(hk)return Qp.exports;hk=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Qp.exports=GM(),Qp.exports}var mk;function KM(){if(mk)return vd;mk=1;var e=Xj();return vd.createRoot=e.createRoot,vd.hydrateRoot=e.hydrateRoot,vd}var YM=KM();const XM=uu(YM);var p=vb();const QM=uu(p),JM=Yj({__proto__:null,default:QM},[p]),yb="default-host";function Qj(e,t){return t?e.hosts.find(r=>r.id===t)??null:null}function Ga(e){return Qj(e,e.activeHostId)??e.hosts[0]??null}function kb(e){var t;return((t=Ga(e))==null?void 0:t.baseUrl)??null}function ZM(e){return e==="http:"||e==="https:"}function Ps(e){const t=e.trim();if(!t)throw new Error("EMPTY_SERVER_URL");const r=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(t)?t:`http://${t}`,i=new URL(r);if(!ZM(i.protocol))throw new Error("INVALID_SERVER_PROTOCOL");i.hash="",i.search="";const a=i.pathname.replace(/\/+$/,"");return`${i.origin}${a==="/"?"":a}`}const js="codingns.auth.remembered-login";function du(){return typeof window<"u"&&typeof window.localStorage<"u"}function eA(e){return e.isNativeMobile?!0:e.isDesktop?e.ui.osFamily==="windows"||e.ui.osFamily==="macos":!1}function tA(e){const t={credentials:null,legacyServerBaseUrl:null};if(!du())return t;const r=window.localStorage.getItem(js);if(!r)return t;try{const i=JSON.parse(r);if(xb(i))return{credentials:e?i[e]??null:null,legacyServerBaseUrl:null};const a=Zj(i);if(!a||!e)return{credentials:null,legacyServerBaseUrl:(a==null?void 0:a.serverBaseUrl)??null};const c={hostId:e,username:a.username,password:a.password,savedAt:Date.now()},u={[e]:c};return window.localStorage.setItem(js,JSON.stringify(u)),{credentials:c,legacyServerBaseUrl:a.serverBaseUrl}}catch{return window.localStorage.removeItem(js),t}}function nA(e){if(!du())return;const t=Jj(),r={hostId:e.hostId,username:e.username.trim(),password:e.password,savedAt:Date.now()};!r.hostId||!r.username||!r.password||window.localStorage.setItem(js,JSON.stringify({...t,[r.hostId]:r}))}function rA(e){if(!du())return;const t=window.localStorage.getItem(js);if(t)try{const r=JSON.parse(t);if(xb(r))return;const i=Zj(r);if(!i){window.localStorage.removeItem(js);return}window.localStorage.setItem(js,JSON.stringify({...i,serverBaseUrl:Ps(e)}))}catch{window.localStorage.removeItem(js)}}function iA(e){if(!du()||!e)return;const t=Jj();if(!t[e])return;const r={...t};if(delete r[e],Object.keys(r).length===0){window.localStorage.removeItem(js);return}window.localStorage.setItem(js,JSON.stringify(r))}function Jj(){if(!du())return{};const e=window.localStorage.getItem(js);if(!e)return{};try{const t=JSON.parse(e);return xb(t)?t:{}}catch{return{}}}function xb(e){return typeof e!="object"||e===null||Array.isArray(e)?!1:Object.values(e).every(t=>sA(t))}function sA(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.hostId=="string"&&typeof t.username=="string"&&typeof t.password=="string"&&typeof t.savedAt=="number"&&t.username.trim().length>0&&t.password.length>0}function Zj(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.username!="string"||typeof t.password!="string"||typeof t.serverBaseUrl!="string")return null;const r=t.username.trim(),i=t.password,a=Ps(t.serverBaseUrl);return!r||!i?null:{username:r,password:i,serverBaseUrl:a}}function eN(e={}){return{x:e.x??null,y:e.y??null,width:e.width??1200,height:e.height??780,minWidth:e.minWidth??720,minHeight:e.minHeight??480}}function aA(e){return{windowId:e.windowId,kind:e.kind,workspaceId:e.workspaceId??null,sessionId:e.sessionId??null,mode:e.mode??"docked",bounds:eN(e.bounds),focusOwner:e.focusOwner??null}}function bl(e){return{...e,bounds:{...e.bounds}}}function oA(e){return{descriptors:Object.fromEntries(Object.entries(e.descriptors).map(([r,i])=>[r,bl(i)])),openWindowIds:[...e.openWindowIds],lastActiveWindowId:e.lastActiveWindowId}}function pk(){return{descriptors:{},openWindowIds:[],lastActiveWindowId:null}}function lA(e,t){return{...e,...t,windowId:e.windowId,bounds:eN({...e.bounds,...t.bounds})}}class cA{constructor(){tt(this,"state",pk());tt(this,"listeners",new Set);tt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));tt(this,"getState",()=>oA(this.state))}registerDescriptor(t){const r=bl(t),i=this.state.openWindowIds.includes(r.windowId);return this.state={...this.state,descriptors:{...this.state.descriptors,[r.windowId]:r},lastActiveWindowId:i?r.windowId:this.state.lastActiveWindowId},this.emit(),bl(r)}updateDescriptor(t,r){const i=this.state.descriptors[t];if(!i)return null;const a=lA(i,r);return this.state={...this.state,descriptors:{...this.state.descriptors,[t]:a}},this.emit(),bl(a)}getDescriptor(t){const r=this.state.descriptors[t];return r?bl(r):null}getWindows(){return Object.values(this.state.descriptors).map(t=>({descriptor:bl(t),isOpen:this.state.openWindowIds.includes(t.windowId)}))}markWindowOpen(t){if(!this.state.descriptors[t])return!1;const r=this.state.openWindowIds.filter(i=>i!==t);return this.state={...this.state,openWindowIds:[...r,t],lastActiveWindowId:t},this.emit(),!0}markWindowClosed(t){if(!this.state.openWindowIds.includes(t))return!1;const r=this.state.openWindowIds.filter(i=>i!==t);return this.state={...this.state,openWindowIds:r,lastActiveWindowId:this.state.lastActiveWindowId===t?r.at(-1)??null:this.state.lastActiveWindowId},this.emit(),!0}isWindowOpen(t){return this.state.openWindowIds.includes(t)}removeWindow(t){if(!this.state.descriptors[t])return!1;const r={...this.state.descriptors};delete r[t];const i=this.state.openWindowIds.filter(a=>a!==t);return this.state={descriptors:r,openWindowIds:i,lastActiveWindowId:this.state.lastActiveWindowId===t?i.at(-1)??null:this.state.lastActiveWindowId},this.emit(),!0}clear(){const t=this.state.openWindowIds.length>0||this.state.lastActiveWindowId!==null||Object.keys(this.state.descriptors).length>0;this.state=pk(),t&&this.emit()}emit(){for(const t of this.listeners)t()}}function uA(){return new cA}const dA=uA();function hA(){return dA}const mA=hA();function tN(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function nN(){var c,u;if(typeof navigator>"u")return"unknown";const e=navigator.userAgent.toLowerCase(),t=navigator.userAgentData,r=((c=t==null?void 0:t.platform)==null?void 0:c.toLowerCase())??((u=navigator.platform)==null?void 0:u.toLowerCase())??"",i=`${r} ${e}`,a=r.includes("mac")&&navigator.maxTouchPoints>1;return i.includes("android")?"android":i.includes("iphone")||i.includes("ipad")||i.includes("ipod")||a?"ios":i.includes("mac")?"macos":i.includes("win")?"windows":i.includes("linux")?"linux":"unknown"}function pA(e){var t;return typeof e=="number"&&Number.isFinite(e)&&e>0?e:typeof window<"u"&&Number.isFinite(window.innerWidth)&&window.innerWidth>0?window.innerWidth:typeof document<"u"&&Number.isFinite((t=document.documentElement)==null?void 0:t.clientWidth)&&document.documentElement.clientWidth>0?document.documentElement.clientWidth:1280}function fA(e){const t=pA(e);return t<768?"compact":t<1024?"medium":"expanded"}function gA(e){const t=nN();return e==="desktop"?{osFamily:t,windowControlsStyle:t==="macos"?"traffic-lights":t==="windows"?"windows":"none",prefersDesktopChrome:!0,prefersOverlayTitlebar:t==="macos",prefersSystemFontStack:!0}:{osFamily:t,windowControlsStyle:"none",prefersDesktopChrome:!1,prefersOverlayTitlebar:!1,prefersSystemFontStack:!0}}function jr(e){return{ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:e}}async function Mr(e,t){return rN(e,t)}async function rN(e,t){if(!tN())return jr("当前运行环境不支持桌面壳能力。");try{return{ok:!0,value:await window.__TAURI_INTERNALS__.invoke(e,t)}}catch(r){return{ok:!1,errorCode:"SHELL_BRIDGE_ERROR",detail:r instanceof Error?r.message:"桌面壳调用失败。"}}}function bA(e){switch(e){case"selection":return 10;case"action":return[12];case"gesture":return[10,18,10];case"success":return[16,30,20];case"warning":return[20,36,18];case"error":return[24,40,24,40,20];default:return 10}}function iN(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}async function sN(e){if(iN())try{navigator.vibrate(bA(e))}catch{return}}async function aN(e,t){if(typeof window>"u"||typeof Notification>"u")return jr("当前环境不支持系统通知。");try{if(Notification.permission==="default"&&await Notification.requestPermission()!=="granted"||Notification.permission!=="granted")return jr("系统通知权限未授予。");const r=new Notification(e,{body:t});return r.onerror=()=>{},{ok:!0}}catch(r){return{ok:!1,errorCode:"NOTIFICATION_FAILED",detail:r instanceof Error?r.message:"系统通知发送失败。"}}}class wA{constructor(){tt(this,"supported",!1)}openExternal(t){return typeof window>"u"?Promise.resolve(jr("当前环境无法打开外部链接。")):(window.open(t,"_blank","noopener,noreferrer"),Promise.resolve({ok:!0}))}showNotification(t,r){return aN(t,r)}writeClipboardText(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}setWindowState(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}readDesktopConfig(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}writeDesktopConfig(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}getRuntimeInfo(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}checkForUpdate(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}installUpdate(){return Promise.resolve({ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前不是桌面端运行环境。"})}rollbackToPreviousVersion(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}pickDirectory(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}createWindow(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}closeWindow(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}focusWindow(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}listWindows(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}isWindowOpen(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}getWindowDescriptor(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}syncWindowDescriptor(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}updateWindowBounds(){return Promise.resolve(jr("当前不是桌面端运行环境。"))}}class vA{constructor(){tt(this,"supported",iN())}trigger(t){return sN(t)}}class yA{constructor(){tt(this,"supported",!0)}openExternal(t){return Mr("open_external",{url:t})}async showNotification(t,r){const i=await aN(t,r);return i.ok?i:Mr("show_notification",{title:t,body:r})}writeClipboardText(t){return Mr("copy_text",{text:t})}setWindowState(t){return Mr("set_window_state",{state:t})}readDesktopConfig(){return Mr("read_desktop_config")}writeDesktopConfig(t){return Mr("write_desktop_config",{patch:t})}getRuntimeInfo(){return Mr("get_runtime_info")}checkForUpdate(t){return Mr("check_for_update",{channel:t})}async installUpdate(t){const r=await Mr("install_update",{manifest:t});return r.ok?r.value??{ok:!0}:{ok:!1,errorCode:r.errorCode,detail:r.detail}}rollbackToPreviousVersion(){return Mr("rollback_to_previous_version")}pickDirectory(){return Mr("pick_directory")}createWindow(t){return Mr("create_window",{descriptor:t})}closeWindow(t){return Mr("close_window",{windowId:t})}focusWindow(t){return Mr("focus_window",{windowId:t})}listWindows(){return Mr("list_windows")}isWindowOpen(t){return Mr("is_window_open",{windowId:t})}getWindowDescriptor(t){return typeof t=="string"?Mr("get_window_descriptor",{windowId:t}):Mr("get_window_descriptor")}syncWindowDescriptor(t){return Mr("sync_window_descriptor",{descriptor:t})}updateWindowBounds(t,r){return Mr("update_window_bounds",{windowId:t,bounds:r})}}class kA{constructor(){tt(this,"supported",!0)}async trigger(t){(await rN("perform_haptic_feedback",{kind:t})).ok||await sN(t)}}function oN(){if(!tN())return"web";const e=nN();return e==="ios"?"ios":e==="android"?"android":"desktop"}function $s(e={}){const t=oN(),r=fA(e.viewportWidth),i=t==="ios"||t==="android";return{platform:t,isDesktop:t==="desktop",isWeb:t==="web",isMobile:r!=="expanded",isNativeMobile:i,viewportClass:r,ui:gA(t),bridge:t==="desktop"?new yA:new wA,windows:mA,haptics:i?new kA:new vA}}const xg="codingns.client.runtime-config";function Sb(e){return e==="desktop"||e==="ios"||e==="android"}function Sg(e){return e==="en"||e==="en-US"?"en-US":"zh-CN"}function xA(){return typeof navigator>"u"?"zh-CN":Sg(navigator.language)}function fk(e){return e==="acceptEdits"||e==="bypassPermissions"?e:"default"}function lN(){return typeof window<"u"&&typeof window.localStorage<"u"}function SA(){if(!lN())return null;const e=window.localStorage.getItem(xg);if(!e)return null;try{return JSON.parse(e)}catch{return window.localStorage.removeItem(xg),null}}function cN(e){lN()&&window.localStorage.setItem(xg,JSON.stringify(e))}function CA(){var e;return typeof window>"u"||!((e=window.location)!=null&&e.origin)?null:window.location.origin}function jA(e){if(!e)return null;try{return Ps(e)}catch{return null}}function uN(e){if(e==="web"){const t=jA(CA());if(t)return t}return Ps("http://127.0.0.1:3002")}function dN(){return new Date().toISOString()}function Oa(e){return typeof e=="string"&&e.trim()?e.trim():null}function gk(e,t){return Oa(e)??t}function hN(e){try{const t=new URL(e).hostname.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"?"local":/^10\./.test(t)||/^192\.168\./.test(t)||/^172\.(1[6-9]|2\d|3[0-1])\./.test(t)?"lan":"remote"}catch{return"custom"}}function mN(e){try{const t=new URL(e),r=t.pathname==="/"?"":t.pathname.replace(/\/+$/,"");return`${t.host}${r}`}catch{return e}}function Dh(e,t,r={}){const i=Ps(e);return{id:Oa(r.id)??yb,name:Oa(r.name)??mN(i),baseUrl:i,kind:r.kind??hN(i),createdAt:gk(r.createdAt,t),updatedAt:gk(r.updatedAt,t),lastConnectedAt:Oa(r.lastConnectedAt)??null,lastUserId:Oa(r.lastUserId)??null,lastUsername:Oa(r.lastUsername)??null}}function NA(e){return typeof e=="object"&&e!==null}function TA(e,t){if(!Array.isArray(e))return[];const r=new Set,i=[];for(let a=0;a<e.length;a+=1){const c=e[a];if(!NA(c))continue;const u=Oa(c.baseUrl);if(u)try{const d=a===0?yb:`host-${a+1}`,m=Dh(u,t,{...c,id:Oa(c.id)??d});if(r.has(m.id))continue;r.add(m.id),i.push(m)}catch{continue}}return i}function PA(e){return typeof e=="object"&&e!==null}function DA(e,t,r){const i=Ps(t),a=Ga(e);return a?e.hosts.map(c=>c.id===a.id?Dh(i,r,{...c,name:mN(i),kind:hN(i),createdAt:c.createdAt,updatedAt:r}):c):[Dh(i,r)]}function Cb(e){const t=dN();return{platform:e,activeHostId:yb,hosts:[Dh(uN(e),t)],releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:xA(),defaultPermissionMode:"default"}}function Rh(e,t){var m;if(!t||!PA(t))return e;const r=t.platform??e.platform,i=Cb(r),a=dN();if(!Sb(r))return{platform:r,activeHostId:i.activeHostId,hosts:i.hosts,releaseChannel:t.releaseChannel??e.releaseChannel,autoReconnect:t.autoReconnect??e.autoReconnect,autoCheckUpdate:t.autoCheckUpdate??e.autoCheckUpdate,language:Sg(t.language??e.language),defaultPermissionMode:fk(t.defaultPermissionMode??e.defaultPermissionMode)};let c=t.hosts!==void 0?TA(t.hosts,a):e.hosts;t.hostBaseUrl&&(c=DA(e,t.hostBaseUrl,a)),c.length===0&&(c=i.hosts);const u=t.activeHostId??e.activeHostId,d=c.some(f=>f.id===u)?u:((m=c[0])==null?void 0:m.id)??null;return{platform:r,activeHostId:d,hosts:c,releaseChannel:t.releaseChannel??e.releaseChannel,autoReconnect:t.autoReconnect??e.autoReconnect,autoCheckUpdate:t.autoCheckUpdate??e.autoCheckUpdate,language:Sg(t.language??e.language),defaultPermissionMode:fk(t.defaultPermissionMode??e.defaultPermissionMode)}}function pN(e,t){return Rh(Cb(t),e)}async function RA(){const e=$s(),t=Cb(e.platform),r=SA();let i=null;if(e.isDesktop){const c=await e.bridge.readDesktopConfig();c.ok&&c.value&&(i=c.value)}const a=Rh(Rh(t,r),i);return cN(a),a}async function MA(e,t){var c;const r=Rh(e,t);cN(r);const i=(c=Ga(r))==null?void 0:c.baseUrl;i&&rA(i);const a=$s();return a.isDesktop&&await a.bridge.writeDesktopConfig(r),r}function AA(){return pN(null,oN())}class EA{constructor(){tt(this,"state",AA());tt(this,"listeners",new Set);tt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));tt(this,"getState",()=>this.state)}hydrate(t){this.state=pN(t,this.state.platform),this.emit()}async initialize(){const t=await RA();return this.hydrate(t),t}async update(t){const r=await MA(this.state,t);return this.hydrate(r),r}emit(){for(const t of this.listeners)t()}}const In=new EA;function rm(e){return p.useSyncExternalStore(In.subscribe,()=>e(In.getState()))}class Kr extends Error{constructor(r,i){super(i.detail);tt(this,"status");tt(this,"errorCode");tt(this,"field");this.name="ApiError",this.status=r,this.errorCode=i.error_code,this.field=i.field}}function IA(e){return e.endsWith("/")?e:`${e}/`}function LA(e){return e.replace(/^\/+/,"")}function jb(){const e=In.getState();return kb(e)??uN(e.platform)}function Nb(e,t=jb()){return new URL(LA(e),IA(t)).toString()}function fN(e,t=jb()){const r=new URL(Nb(e,t));return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}class FA{async request(t,r={}){const i=await this.performRequest(t,r);if(i.status===204||i.status===205)return;const a=await i.text();if(a)return JSON.parse(a)}async requestBlob(t,r={}){return(await this.performRequest(t,r)).blob()}async performRequest(t,r){var d;const i=new Headers(r.headers),a=r.body!==void 0&&r.body!==null,c=Nb(t,r.baseUrl??jb());if(a&&!i.has("Content-Type")&&i.set("Content-Type","application/json"),!r.skipAuth){const m=(d=hr.getState().session)==null?void 0:d.accessToken;if(!m)throw hr.clear(),new Kr(401,{detail:"当前没有可用的登录态",error_code:"UNAUTHORIZED"});i.set("Authorization",`Bearer ${m}`)}let u;try{u=await fetch(c,{...r,headers:i})}catch(m){const f=m instanceof Error?m.message:"未知网络错误";throw new Kr(0,{detail:`请求 ${c} 失败:${f}`,error_code:"NETWORK_ERROR"})}if(!u.ok){const m=await _A(u);if(gN(u.status,m.error_code)&&!r.skipAuth&&!r.retryAfterRefresh){const f=await hr.refresh();if(f.status==="refreshed")return this.performRequest(t,{...r,retryAfterRefresh:!0});throw f.status==="invalid"?new Kr(401,{detail:"登录态已经失效,请重新登录",error_code:"UNAUTHORIZED"}):new Kr(0,{detail:"登录态暂时无法恢复,请稍后重试",error_code:"AUTH_REFRESH_UNAVAILABLE"})}throw!r.skipAuth&&OA(u.status,m.error_code)&&(sessionStorage.setItem(Cg,String(Date.now())),hr.clear()),new Kr(u.status,m)}return u}}const Ue=new FA;async function _A(e){const t=await e.text();if(!t)return bk(e.status);try{const r=JSON.parse(t);if(typeof r.detail=="string"&&typeof r.error_code=="string")return{detail:r.detail,error_code:r.error_code,field:typeof r.field=="string"?r.field:void 0,timestamp:typeof r.timestamp=="string"?r.timestamp:void 0}}catch{}return bk(e.status,t)}function bk(e,t){return{detail:(t==null?void 0:t.trim())||`请求失败(HTTP ${e})`,error_code:e===401?"UNAUTHORIZED":"HTTP_ERROR"}}function gN(e,t){return e!==401?!1:t==="UNAUTHORIZED"||t==="TOKEN_EXPIRED"||t==="TOKEN_INVALID"}function OA(e,t){return e===403&&t==="BOOTSTRAP_REQUIRED"?!0:gN(e,t)}const Cg="codingns.auth_expired_at";function BA(){const e=sessionStorage.getItem(Cg);return e?(sessionStorage.removeItem(Cg),Date.now()-Number(e)<5e3):!1}function WA(e){return Ue.request("/api/public/bootstrap-status",{baseUrl:e,skipAuth:!0})}function UA(e,t){return Ue.request("/api/public/setup",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function HA(e,t){return Ue.request("/api/auth/login",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function zA(e,t){return Ue.request("/api/auth/refresh",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}const yd="codingns.auth.session";class qA{constructor(){tt(this,"state",{status:"anonymous",session:null});tt(this,"listeners",new Set);tt(this,"sessionMap",{});tt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));tt(this,"getState",()=>this.state);this.syncCurrentHostSession(),In.subscribe(()=>{this.syncCurrentHostSession()})}async login(t,r,i){const a=await HA({username:t,password:r},i);return this.setSession(a),a}async bootstrap(t,r,i){await UA({username:t,password:r},i)}hydrate(t){if(!t){this.clear();return}this.setSession(t)}async refresh(){const t=this.state.session,r=t==null?void 0:t.refreshToken,i=this.getCurrentHost();if(!r)return this.clear(),{status:"invalid",session:null};this.state={...this.state,status:"refreshing"},this.emit();try{const a=await zA({refreshToken:r},i==null?void 0:i.baseUrl);return this.setSession(a,i),{status:"refreshed",session:a}}catch(a){return XA(a)?(this.clear(),{status:"invalid",session:null}):(this.state={status:t?"authenticated":"anonymous",session:t},this.emit(),{status:"deferred",session:t,error:a})}}clear(){const t=this.getCurrentHost();if(!t){this.sessionMap={},this.persistSessionMap(),this.updateState({status:"anonymous",session:null});return}if(this.sessionMap[t.id]){const r={...this.sessionMap};delete r[t.id],this.sessionMap=r,this.persistSessionMap()}this.updateState({status:"anonymous",session:null})}setSession(t,r=this.getCurrentHost()){r&&(this.sessionMap={...this.sessionMap,[r.id]:{hostId:r.id,session:t,savedAt:Date.now()}},this.persistSessionMap(),In.update({hosts:In.getState().hosts.map(i=>i.id===r.id?{...i,lastConnectedAt:new Date().toISOString(),lastUserId:t.user.userId,lastUsername:t.user.username,updatedAt:new Date().toISOString()}:i)}).catch(()=>{}),this.updateState({status:"authenticated",session:t}))}syncCurrentHostSession(){var c;const t=this.getCurrentHost(),{sessionMap:r,migrated:i}=this.readSessionMapFromStorage(t);this.sessionMap=r,i&&this.persistSessionMap();const a=t?((c=r[t.id])==null?void 0:c.session)??null:null;this.updateState({status:a?"authenticated":"anonymous",session:a})}getCurrentHost(){return Ga(In.getState())}readSessionMapFromStorage(t){if(typeof window>"u"||typeof window.localStorage>"u")return{sessionMap:{},migrated:!1};const r=window.localStorage.getItem(yd);if(!r)return{sessionMap:{},migrated:!1};try{const i=JSON.parse(r);if(VA(i))return{sessionMap:i,migrated:!1};const a=KA(i,t);if(a)return{sessionMap:a,migrated:!0}}catch{}return window.localStorage.removeItem(yd),{sessionMap:{},migrated:!1}}persistSessionMap(){if(!(typeof window>"u"||typeof window.localStorage>"u")){if(Object.keys(this.sessionMap).length===0){window.localStorage.removeItem(yd);return}window.localStorage.setItem(yd,JSON.stringify(this.sessionMap))}}updateState(t){this.state.status===t.status&&this.state.session===t.session||(this.state=t,this.emit())}emit(){for(const t of this.listeners)t()}}const hr=new qA;function im(e){return p.useSyncExternalStore(hr.subscribe,()=>e(hr.getState()))}function $A(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.hostId=="string"&&typeof t.savedAt=="number"&&Tb(t.session)}function VA(e){return typeof e!="object"||e===null||Array.isArray(e)?!1:Object.values(e).every(t=>$A(t))}function GA(e){return typeof e!="object"||e===null?!1:"session"in e&&Tb(e.session)}function Tb(e){if(typeof e!="object"||e===null)return!1;const t=e;return typeof t.accessToken=="string"&&typeof t.refreshToken=="string"&&typeof t.expiresIn=="number"&&typeof t.user=="object"&&t.user!==null}function KA(e,t){const r=(t==null?void 0:t.id)??null;if(!r)return null;if(GA(e)){const i=YA(e.serverBaseUrl,t)??r;return{[i]:{hostId:i,session:e.session,savedAt:Date.now()}}}return Tb(e)?{[r]:{hostId:r,session:e,savedAt:Date.now()}}:null}function YA(e,t){if(!e)return(t==null?void 0:t.id)??null;const i=In.getState().hosts.find(a=>a.baseUrl===e);return(i==null?void 0:i.id)??(t==null?void 0:t.id)??null}function XA(e){return e instanceof Kr?e.status===401?!0:e.status===403&&e.errorCode==="BOOTSTRAP_REQUIRED":!1}const bN="/api/preferences/profile";async function QA(){return Ue.request(bN)}async function wN(e){return Ue.request(bN,{method:"PUT",body:JSON.stringify(e)})}const sm=["claude-code","codex","opencode","gemini","kimi"],vN="codingns.account.preferences.shadow",JA="codingns.client.runtime-config",ZA="codingns-theme",e1="composer-selected-model:",t1="composer-reasoning-level:";function hu(){return typeof window<"u"&&typeof window.localStorage<"u"}function Pb(e){return e==="en-US"||e==="en"?"en-US":e==="zh-CN"?"zh-CN":null}function n1(){return typeof navigator>"u"?"zh-CN":Pb(navigator.language)??"zh-CN"}function yN(e){return e==="light"||e==="dark"||e==="sky-blue"||e==="eye-green"?e:null}function r1(){return typeof window>"u"||typeof window.matchMedia!="function"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function kN(e){return e==="acceptEdits"||e==="bypassPermissions"||e==="default"?e:null}function xN(e){return e==="low"||e==="medium"||e==="high"||e==="xhigh"?e:null}function SN(){return{"claude-code":{defaultModel:null,defaultReasoningLevel:null},codex:{defaultModel:null,defaultReasoningLevel:null},opencode:{defaultModel:null,defaultReasoningLevel:null},gemini:{defaultModel:null,defaultReasoningLevel:null},kimi:{defaultModel:null,defaultReasoningLevel:null}}}function CN(){return{initialized:!0,profile:{language:n1(),theme:r1(),defaultPermissionMode:"default"},providers:SN(),updatedAt:null,source:"default"}}function i1(){const e=In.getState(),t={language:e.language,defaultPermissionMode:e.defaultPermissionMode};if(!hu())return t;const r=window.localStorage.getItem(JA);if(!r)return t;try{const i=JSON.parse(r);return{language:Pb(i.language)??t.language,defaultPermissionMode:kN(i.defaultPermissionMode)??t.defaultPermissionMode}}catch{return t}}function s1(){return hu()?yN(window.localStorage.getItem(ZA)):null}function a1(){var t;if(!hu())return;const e={};for(const r of sm){const i=((t=window.localStorage.getItem(`${e1}${r}`))==null?void 0:t.trim())||null,a=xN(window.localStorage.getItem(`${t1}${r}`));i===null&&a===null||(e[r]={defaultModel:i,defaultReasoningLevel:a})}return Object.keys(e).length>0?e:void 0}function jN(){const e=i1(),t=s1(),r=a1(),i={};return e.language&&(i.language=e.language),t&&(i.theme=t),e.defaultPermissionMode&&(i.defaultPermissionMode=e.defaultPermissionMode),r&&(i.providers=r),NN(i)?i:null}function NN(e){return e?e.language!==void 0||e.theme!==void 0||e.defaultPermissionMode!==void 0||e.providers!==void 0&&Object.keys(e.providers).length>0:!1}function Mh(e){var i;const t=CN(),r=SN();for(const a of sm){const c=(i=e==null?void 0:e.providers)==null?void 0:i[a];r[a]={defaultModel:typeof(c==null?void 0:c.defaultModel)=="string"&&c.defaultModel.trim()||null,defaultReasoningLevel:xN(c==null?void 0:c.defaultReasoningLevel)??null}}return{language:Pb(e==null?void 0:e.language)??t.profile.language,theme:yN(e==null?void 0:e.theme)??t.profile.theme,defaultPermissionMode:kN(e==null?void 0:e.defaultPermissionMode)??t.profile.defaultPermissionMode,providers:r,updatedAt:typeof(e==null?void 0:e.updatedAt)=="string"?e.updatedAt:null}}function o1(){var t,r,i;if(!hu())return null;const e=window.localStorage.getItem(vN);if(!e)return null;try{const a=JSON.parse(e),c=Mh({language:(t=a.profile)==null?void 0:t.language,theme:(r=a.profile)==null?void 0:r.theme,defaultPermissionMode:(i=a.profile)==null?void 0:i.defaultPermissionMode,providers:a.providers,updatedAt:a.updatedAt});return{profile:{language:c.language,theme:c.theme,defaultPermissionMode:c.defaultPermissionMode},providers:c.providers,updatedAt:c.updatedAt}}catch{return null}}function Ah(e){if(!hu())return;const t={profile:e.profile,providers:e.providers,updatedAt:e.updatedAt};window.localStorage.setItem(vN,JSON.stringify(t))}function ol(){const e=CN(),t=jN(),r=t?TN(e,t,"default"):e,i=o1();return i?{initialized:!0,profile:i.profile,providers:i.providers,updatedAt:i.updatedAt,source:"shadow"}:r}function jg(e,t){return{initialized:!0,profile:{language:e.language,theme:e.theme,defaultPermissionMode:e.defaultPermissionMode},providers:e.providers,updatedAt:e.updatedAt,source:t}}function TN(e,t,r){const i={...e.providers};if(t.providers)for(const a of sm){const c=t.providers[a];c&&(i[a]={defaultModel:c.defaultModel!==void 0?c.defaultModel??null:e.providers[a].defaultModel,defaultReasoningLevel:c.defaultReasoningLevel!==void 0?c.defaultReasoningLevel??null:e.providers[a].defaultReasoningLevel})}return{initialized:!0,profile:{language:t.language??e.profile.language,theme:t.theme??e.profile.theme,defaultPermissionMode:t.defaultPermissionMode??e.profile.defaultPermissionMode},providers:i,updatedAt:e.updatedAt,source:r}}async function l1(){const e=Mh(await QA());if(e.updatedAt===null){const r=jN();if(NN(r)){const i=Mh(await wN(r)),a=jg(i,"remote");return Ah(a),a}}const t=jg(e,"remote");return Ah(t),t}class c1{constructor(){tt(this,"state",ol());tt(this,"listeners",new Set);tt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));tt(this,"getState",()=>this.state);In.subscribe(()=>{hr.getState().session||this.state.source==="remote"||this.hydrate(ol())})}hydrate(t){this.state=t,this.emit()}resetToLocalFallback(){this.hydrate(ol())}async initialize(){if(!hr.getState().session){const t=ol();return this.hydrate(t),t}return this.refreshForAuthenticatedUser()}async refreshForAuthenticatedUser(){if(!hr.getState().session){const t=ol();return this.hydrate(t),t}try{const t=await l1();return this.hydrate(t),t}catch{const t=ol();return this.hydrate(t),t}}async updateProfile(t){const r=this.state,i=TN(r,t,r.source);if(this.hydrate(i),!hr.getState().session)return Ah(i),i;try{const a=Mh(await wN(t)),c=jg(a,"remote");return Ah(c),this.hydrate(c),c}catch(a){throw this.hydrate(r),a}}async updateProviderPreference(t,r){return this.updateProfile({providers:{[t]:r}})}emit(){for(const t of this.listeners)t()}}const Ts=new c1;function Ng(e){return p.useSyncExternalStore(Ts.subscribe,()=>e(Ts.getState()))}function ef(e){return sm.includes(e)}function u1(){return Ts.initialize()}function Eh(e){return Ts.updateProfile(e)}function Mo(e){return Ng(t=>e({profile:{...t.profile,providers:t.providers,updatedAt:t.updatedAt},isFetching:!1,error:null}))}async function d1(){const e=$s();return await In.initialize(),await u1(),{platform:e.platform}}var Vn=Xj();const h1=uu(Vn),m1=Yj({__proto__:null,default:h1},[Vn]);/**
|
|
42
|
-
* @remix-run/router v1.23.2
|
|
43
|
-
*
|
|
44
|
-
* Copyright (c) Remix Software Inc.
|
|
45
|
-
*
|
|
46
|
-
* This source code is licensed under the MIT license found in the
|
|
47
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
48
|
-
*
|
|
49
|
-
* @license MIT
|
|
50
|
-
*/function dr(){return dr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},dr.apply(this,arguments)}var Er;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Er||(Er={}));const wk="popstate";function p1(e){e===void 0&&(e={});function t(i,a){let{pathname:c,search:u,hash:d}=i.location;return qc("",{pathname:c,search:u,hash:d},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(i,a){return typeof a=="string"?a:mu(a)}return g1(t,r,null,e)}function Nn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function So(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function f1(){return Math.random().toString(36).substr(2,8)}function vk(e,t){return{usr:e.state,key:e.key,idx:t}}function qc(e,t,r,i){return r===void 0&&(r=null),dr({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ka(t):t,{state:r,key:t&&t.key||i||f1()})}function mu(e){let{pathname:t="/",search:r="",hash:i=""}=e;return r&&r!=="?"&&(t+=r.charAt(0)==="?"?r:"?"+r),i&&i!=="#"&&(t+=i.charAt(0)==="#"?i:"#"+i),t}function Ka(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substr(r),e=e.substr(0,r));let i=e.indexOf("?");i>=0&&(t.search=e.substr(i),e=e.substr(0,i)),e&&(t.pathname=e)}return t}function g1(e,t,r,i){i===void 0&&(i={});let{window:a=document.defaultView,v5Compat:c=!1}=i,u=a.history,d=Er.Pop,m=null,f=w();f==null&&(f=0,u.replaceState(dr({},u.state,{idx:f}),""));function w(){return(u.state||{idx:null}).idx}function g(){d=Er.Pop;let j=w(),N=j==null?null:j-f;f=j,m&&m({action:d,location:C.location,delta:N})}function v(j,N){d=Er.Push;let P=qc(C.location,j,N);f=w()+1;let L=vk(P,f),Y=C.createHref(P);try{u.pushState(L,"",Y)}catch(H){if(H instanceof DOMException&&H.name==="DataCloneError")throw H;a.location.assign(Y)}c&&m&&m({action:d,location:C.location,delta:1})}function y(j,N){d=Er.Replace;let P=qc(C.location,j,N);f=w();let L=vk(P,f),Y=C.createHref(P);u.replaceState(L,"",Y),c&&m&&m({action:d,location:C.location,delta:0})}function x(j){let N=a.location.origin!=="null"?a.location.origin:a.location.href,P=typeof j=="string"?j:mu(j);return P=P.replace(/ $/,"%20"),Nn(N,"No window.location.(origin|href) available to create URL for href: "+P),new URL(P,N)}let C={get action(){return d},get location(){return e(a,u)},listen(j){if(m)throw new Error("A history only accepts one active listener");return a.addEventListener(wk,g),m=j,()=>{a.removeEventListener(wk,g),m=null}},createHref(j){return t(a,j)},createURL:x,encodeLocation(j){let N=x(j);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:v,replace:y,go(j){return u.go(j)}};return C}var Un;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Un||(Un={}));const b1=new Set(["lazy","caseSensitive","path","id","index","children"]);function w1(e){return e.index===!0}function Ih(e,t,r,i){return r===void 0&&(r=[]),i===void 0&&(i={}),e.map((a,c)=>{let u=[...r,String(c)],d=typeof a.id=="string"?a.id:u.join("-");if(Nn(a.index!==!0||!a.children,"Cannot specify children on an index route"),Nn(!i[d],'Found a route id collision on id "'+d+`". Route id's must be globally unique within Data Router usages`),w1(a)){let m=dr({},a,t(a),{id:d});return i[d]=m,m}else{let m=dr({},a,t(a),{id:d,children:void 0});return i[d]=m,a.children&&(m.children=Ih(a.children,t,u,i)),m}})}function go(e,t,r){return r===void 0&&(r="/"),dh(e,t,r,!1)}function dh(e,t,r,i){let a=typeof t=="string"?Ka(t):t,c=pu(a.pathname||"/",r);if(c==null)return null;let u=PN(e);y1(u);let d=null;for(let m=0;d==null&&m<u.length;++m){let f=M1(c);d=D1(u[m],f,i)}return d}function v1(e,t){let{route:r,pathname:i,params:a}=e;return{id:r.id,pathname:i,params:a,data:t[r.id],handle:r.handle}}function PN(e,t,r,i){t===void 0&&(t=[]),r===void 0&&(r=[]),i===void 0&&(i="");let a=(c,u,d)=>{let m={relativePath:d===void 0?c.path||"":d,caseSensitive:c.caseSensitive===!0,childrenIndex:u,route:c};m.relativePath.startsWith("/")&&(Nn(m.relativePath.startsWith(i),'Absolute route path "'+m.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),m.relativePath=m.relativePath.slice(i.length));let f=$a([i,m.relativePath]),w=r.concat(m);c.children&&c.children.length>0&&(Nn(c.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+f+'".')),PN(c.children,t,w,f)),!(c.path==null&&!c.index)&&t.push({path:f,score:T1(f,c.index),routesMeta:w})};return e.forEach((c,u)=>{var d;if(c.path===""||!((d=c.path)!=null&&d.includes("?")))a(c,u);else for(let m of DN(c.path))a(c,u,m)}),t}function DN(e){let t=e.split("/");if(t.length===0)return[];let[r,...i]=t,a=r.endsWith("?"),c=r.replace(/\?$/,"");if(i.length===0)return a?[c,""]:[c];let u=DN(i.join("/")),d=[];return d.push(...u.map(m=>m===""?c:[c,m].join("/"))),a&&d.push(...u),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function y1(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:P1(t.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}const k1=/^:[\w-]+$/,x1=3,S1=2,C1=1,j1=10,N1=-2,yk=e=>e==="*";function T1(e,t){let r=e.split("/"),i=r.length;return r.some(yk)&&(i+=N1),t&&(i+=S1),r.filter(a=>!yk(a)).reduce((a,c)=>a+(k1.test(c)?x1:c===""?C1:j1),i)}function P1(e,t){return e.length===t.length&&e.slice(0,-1).every((i,a)=>i===t[a])?e[e.length-1]-t[t.length-1]:0}function D1(e,t,r){r===void 0&&(r=!1);let{routesMeta:i}=e,a={},c="/",u=[];for(let d=0;d<i.length;++d){let m=i[d],f=d===i.length-1,w=c==="/"?t:t.slice(c.length)||"/",g=Ir({path:m.relativePath,caseSensitive:m.caseSensitive,end:f},w),v=m.route;if(!g&&f&&r&&!i[i.length-1].route.index&&(g=Ir({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},w)),!g)return null;Object.assign(a,g.params),u.push({params:a,pathname:$a([c,g.pathname]),pathnameBase:L1($a([c,g.pathnameBase])),route:v}),g.pathnameBase!=="/"&&(c=$a([c,g.pathnameBase]))}return u}function Ir(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=R1(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let c=a[0],u=c.replace(/(.)\/+$/,"$1"),d=a.slice(1);return{params:i.reduce((f,w,g)=>{let{paramName:v,isOptional:y}=w;if(v==="*"){let C=d[g]||"";u=c.slice(0,c.length-C.length).replace(/(.)\/+$/,"$1")}const x=d[g];return y&&!x?f[v]=void 0:f[v]=(x||"").replace(/%2F/g,"/"),f},{}),pathname:c,pathnameBase:u,pattern:e}}function R1(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),So(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let i=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,d,m)=>(i.push({paramName:d,isOptional:m!=null}),m?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(i.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),i]}function M1(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return So(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function pu(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,i=e.charAt(r);return i&&i!=="/"?null:e.slice(r)||"/"}const A1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,E1=e=>A1.test(e);function I1(e,t){t===void 0&&(t="/");let{pathname:r,search:i="",hash:a=""}=typeof e=="string"?Ka(e):e,c;if(r)if(E1(r))c=r;else{if(r.includes("//")){let u=r;r=r.replace(/\/\/+/g,"/"),So(!1,"Pathnames cannot have embedded double slashes - normalizing "+(u+" -> "+r))}r.startsWith("/")?c=kk(r.substring(1),"/"):c=kk(r,t)}else c=t;return{pathname:c,search:F1(i),hash:_1(a)}}function kk(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?r.length>1&&r.pop():a!=="."&&r.push(a)}),r.length>1?r.join("/"):"/"}function tf(e,t,r,i){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function RN(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Db(e,t){let r=RN(e);return t?r.map((i,a)=>a===r.length-1?i.pathname:i.pathnameBase):r.map(i=>i.pathnameBase)}function Rb(e,t,r,i){i===void 0&&(i=!1);let a;typeof e=="string"?a=Ka(e):(a=dr({},e),Nn(!a.pathname||!a.pathname.includes("?"),tf("?","pathname","search",a)),Nn(!a.pathname||!a.pathname.includes("#"),tf("#","pathname","hash",a)),Nn(!a.search||!a.search.includes("#"),tf("#","search","hash",a)));let c=e===""||a.pathname==="",u=c?"/":a.pathname,d;if(u==null)d=r;else{let g=t.length-1;if(!i&&u.startsWith("..")){let v=u.split("/");for(;v[0]==="..";)v.shift(),g-=1;a.pathname=v.join("/")}d=g>=0?t[g]:"/"}let m=I1(a,d),f=u&&u!=="/"&&u.endsWith("/"),w=(c||u===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(f||w)&&(m.pathname+="/"),m}const $a=e=>e.join("/").replace(/\/\/+/g,"/"),L1=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),F1=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,_1=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Lh{constructor(t,r,i,a){a===void 0&&(a=!1),this.status=t,this.statusText=r||"",this.internal=a,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}}function $c(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const MN=["post","put","patch","delete"],O1=new Set(MN),B1=["get",...MN],W1=new Set(B1),U1=new Set([301,302,303,307,308]),H1=new Set([307,308]),nf={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},z1={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},cc={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Mb=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,q1=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),AN="remix-router-transitions";function $1(e){const t=e.window?e.window:typeof window<"u"?window:void 0,r=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",i=!r;Nn(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let a;if(e.mapRouteProperties)a=e.mapRouteProperties;else if(e.detectErrorBoundary){let te=e.detectErrorBoundary;a=re=>({hasErrorBoundary:te(re)})}else a=q1;let c={},u=Ih(e.routes,a,void 0,c),d,m=e.basename||"/",f=e.dataStrategy||Y1,w=e.patchRoutesOnNavigation,g=dr({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),v=null,y=new Set,x=null,C=null,j=null,N=e.hydrationData!=null,P=go(u,e.history.location,m),L=!1,Y=null;if(P==null&&!w){let te=Di(404,{pathname:e.history.location.pathname}),{matches:re,route:ue}=Ak(u);P=re,Y={[ue.id]:te}}P&&!e.hydrationData&&Ht(P,u,e.history.location.pathname).active&&(P=null);let H;if(P)if(P.some(te=>te.route.lazy))H=!1;else if(!P.some(te=>te.route.loader))H=!0;else if(g.v7_partialHydration){let te=e.hydrationData?e.hydrationData.loaderData:null,re=e.hydrationData?e.hydrationData.errors:null;if(re){let ue=P.findIndex(Se=>re[Se.route.id]!==void 0);H=P.slice(0,ue+1).every(Se=>!Pg(Se.route,te,re))}else H=P.every(ue=>!Pg(ue.route,te,re))}else H=e.hydrationData!=null;else if(H=!1,P=[],g.v7_partialHydration){let te=Ht(null,u,e.history.location.pathname);te.active&&te.matches&&(L=!0,P=te.matches)}let W,I={historyAction:e.history.action,location:e.history.location,matches:P,initialized:H,navigation:nf,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||Y,fetchers:new Map,blockers:new Map},M=Er.Pop,O=!1,F,X=!1,U=new Map,G=null,R=!1,A=!1,Z=[],pe=new Set,q=new Map,D=0,T=-1,B=new Map,Q=new Set,_=new Map,de=new Map,le=new Set,oe=new Map,ye=new Map,Ne;function Me(){if(v=e.history.listen(te=>{let{action:re,location:ue,delta:Se}=te;if(Ne){Ne(),Ne=void 0;return}So(ye.size===0||Se!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let _e=se({currentLocation:I.location,nextLocation:ue,historyAction:re});if(_e&&Se!=null){let ze=new Promise(yt=>{Ne=yt});e.history.go(Se*-1),Sn(_e,{state:"blocked",location:ue,proceed(){Sn(_e,{state:"proceeding",proceed:void 0,reset:void 0,location:ue}),ze.then(()=>e.history.go(Se))},reset(){let yt=new Map(I.blockers);yt.set(_e,cc),st({blockers:yt})}});return}return we(re,ue)}),r){cE(t,U);let te=()=>uE(t,U);t.addEventListener("pagehide",te),G=()=>t.removeEventListener("pagehide",te)}return I.initialized||we(Er.Pop,I.location,{initialHydration:!0}),W}function Te(){v&&v(),G&&G(),y.clear(),F&&F.abort(),I.fetchers.forEach((te,re)=>ct(re)),I.blockers.forEach((te,re)=>Jt(re))}function Dt(te){return y.add(te),()=>y.delete(te)}function st(te,re){re===void 0&&(re={}),I=dr({},I,te);let ue=[],Se=[];g.v7_fetcherPersist&&I.fetchers.forEach((_e,ze)=>{_e.state==="idle"&&(le.has(ze)?Se.push(ze):ue.push(ze))}),le.forEach(_e=>{!I.fetchers.has(_e)&&!q.has(_e)&&Se.push(_e)}),[...y].forEach(_e=>_e(I,{deletedFetchers:Se,viewTransitionOpts:re.viewTransitionOpts,flushSync:re.flushSync===!0})),g.v7_fetcherPersist?(ue.forEach(_e=>I.fetchers.delete(_e)),Se.forEach(_e=>ct(_e))):Se.forEach(_e=>le.delete(_e))}function dt(te,re,ue){var Se,_e;let{flushSync:ze}=ue===void 0?{}:ue,yt=I.actionData!=null&&I.navigation.formMethod!=null&&xs(I.navigation.formMethod)&&I.navigation.state==="loading"&&((Se=te.state)==null?void 0:Se._isRedirect)!==!0,nt;re.actionData?Object.keys(re.actionData).length>0?nt=re.actionData:nt=null:yt?nt=I.actionData:nt=null;let Ve=re.loaderData?Rk(I.loaderData,re.loaderData,re.matches||[],re.errors):I.loaderData,ne=I.blockers;ne.size>0&&(ne=new Map(ne),ne.forEach((Rt,tn)=>ne.set(tn,cc)));let je=O===!0||I.navigation.formMethod!=null&&xs(I.navigation.formMethod)&&((_e=te.state)==null?void 0:_e._isRedirect)!==!0;d&&(u=d,d=void 0),R||M===Er.Pop||(M===Er.Push?e.history.push(te,te.state):M===Er.Replace&&e.history.replace(te,te.state));let ht;if(M===Er.Pop){let Rt=U.get(I.location.pathname);Rt&&Rt.has(te.pathname)?ht={currentLocation:I.location,nextLocation:te}:U.has(te.pathname)&&(ht={currentLocation:te,nextLocation:I.location})}else if(X){let Rt=U.get(I.location.pathname);Rt?Rt.add(te.pathname):(Rt=new Set([te.pathname]),U.set(I.location.pathname,Rt)),ht={currentLocation:I.location,nextLocation:te}}st(dr({},re,{actionData:nt,loaderData:Ve,historyAction:M,location:te,initialized:!0,navigation:nf,revalidation:"idle",restoreScrollPosition:kn(te,re.matches||I.matches),preventScrollReset:je,blockers:ne}),{viewTransitionOpts:ht,flushSync:ze===!0}),M=Er.Pop,O=!1,X=!1,R=!1,A=!1,Z=[]}async function bt(te,re){if(typeof te=="number"){e.history.go(te);return}let ue=Tg(I.location,I.matches,m,g.v7_prependBasename,te,g.v7_relativeSplatPath,re==null?void 0:re.fromRouteId,re==null?void 0:re.relative),{path:Se,submission:_e,error:ze}=xk(g.v7_normalizeFormMethod,!1,ue,re),yt=I.location,nt=qc(I.location,Se,re&&re.state);nt=dr({},nt,e.history.encodeLocation(nt));let Ve=re&&re.replace!=null?re.replace:void 0,ne=Er.Push;Ve===!0?ne=Er.Replace:Ve===!1||_e!=null&&xs(_e.formMethod)&&_e.formAction===I.location.pathname+I.location.search&&(ne=Er.Replace);let je=re&&"preventScrollReset"in re?re.preventScrollReset===!0:void 0,ht=(re&&re.flushSync)===!0,Rt=se({currentLocation:yt,nextLocation:nt,historyAction:ne});if(Rt){Sn(Rt,{state:"blocked",location:nt,proceed(){Sn(Rt,{state:"proceeding",proceed:void 0,reset:void 0,location:nt}),bt(te,re)},reset(){let tn=new Map(I.blockers);tn.set(Rt,cc),st({blockers:tn})}});return}return await we(ne,nt,{submission:_e,pendingError:ze,preventScrollReset:je,replace:re&&re.replace,enableViewTransition:re&&re.viewTransition,flushSync:ht})}function pt(){if(Ae(),st({revalidation:"loading"}),I.navigation.state!=="submitting"){if(I.navigation.state==="idle"){we(I.historyAction,I.location,{startUninterruptedRevalidation:!0});return}we(M||I.historyAction,I.navigation.location,{overrideNavigation:I.navigation,enableViewTransition:X===!0})}}async function we(te,re,ue){F&&F.abort(),F=null,M=te,R=(ue&&ue.startUninterruptedRevalidation)===!0,wn(I.location,I.matches),O=(ue&&ue.preventScrollReset)===!0,X=(ue&&ue.enableViewTransition)===!0;let Se=d||u,_e=ue&&ue.overrideNavigation,ze=ue!=null&&ue.initialHydration&&I.matches&&I.matches.length>0&&!L?I.matches:go(Se,re,m),yt=(ue&&ue.flushSync)===!0;if(ze&&I.initialized&&!A&&tE(I.location,re)&&!(ue&&ue.submission&&xs(ue.submission.formMethod))){dt(re,{matches:ze},{flushSync:yt});return}let nt=Ht(ze,Se,re.pathname);if(nt.active&&nt.matches&&(ze=nt.matches),!ze){let{error:Kt,notFoundMatches:$t,route:Zt}=He(re.pathname);dt(re,{matches:$t,loaderData:{},errors:{[Zt.id]:Kt}},{flushSync:yt});return}F=new AbortController;let Ve=ll(e.history,re,F.signal,ue&&ue.submission),ne;if(ue&&ue.pendingError)ne=[bo(ze).route.id,{type:Un.error,error:ue.pendingError}];else if(ue&&ue.submission&&xs(ue.submission.formMethod)){let Kt=await he(Ve,re,ue.submission,ze,nt.active,{replace:ue.replace,flushSync:yt});if(Kt.shortCircuited)return;if(Kt.pendingActionResult){let[$t,Zt]=Kt.pendingActionResult;if($i(Zt)&&$c(Zt.error)&&Zt.error.status===404){F=null,dt(re,{matches:Kt.matches,loaderData:{},errors:{[$t]:Zt.error}});return}}ze=Kt.matches||ze,ne=Kt.pendingActionResult,_e=rf(re,ue.submission),yt=!1,nt.active=!1,Ve=ll(e.history,Ve.url,Ve.signal)}let{shortCircuited:je,matches:ht,loaderData:Rt,errors:tn}=await Le(Ve,re,ze,nt.active,_e,ue&&ue.submission,ue&&ue.fetcherSubmission,ue&&ue.replace,ue&&ue.initialHydration===!0,yt,ne);je||(F=null,dt(re,dr({matches:ht||ze},Mk(ne),{loaderData:Rt,errors:tn})))}async function he(te,re,ue,Se,_e,ze){ze===void 0&&(ze={}),Ae();let yt=oE(re,ue);if(st({navigation:yt},{flushSync:ze.flushSync===!0}),_e){let ne=await Gt(Se,re.pathname,te.signal);if(ne.type==="aborted")return{shortCircuited:!0};if(ne.type==="error"){let je=bo(ne.partialMatches).route.id;return{matches:ne.partialMatches,pendingActionResult:[je,{type:Un.error,error:ne.error}]}}else if(ne.matches)Se=ne.matches;else{let{notFoundMatches:je,error:ht,route:Rt}=He(re.pathname);return{matches:je,pendingActionResult:[Rt.id,{type:Un.error,error:ht}]}}}let nt,Ve=jc(Se,re);if(!Ve.route.action&&!Ve.route.lazy)nt={type:Un.error,error:Di(405,{method:te.method,pathname:re.pathname,routeId:Ve.route.id})};else if(nt=(await ft("action",I,te,[Ve],Se,null))[Ve.route.id],te.signal.aborted)return{shortCircuited:!0};if(vo(nt)){let ne;return ze&&ze.replace!=null?ne=ze.replace:ne=Tk(nt.response.headers.get("Location"),new URL(te.url),m,e.history)===I.location.pathname+I.location.search,await vt(te,nt,!0,{submission:ue,replace:ne}),{shortCircuited:!0}}if(Wa(nt))throw Di(400,{type:"defer-action"});if($i(nt)){let ne=bo(Se,Ve.route.id);return(ze&&ze.replace)!==!0&&(M=Er.Push),{matches:Se,pendingActionResult:[ne.route.id,nt]}}return{matches:Se,pendingActionResult:[Ve.route.id,nt]}}async function Le(te,re,ue,Se,_e,ze,yt,nt,Ve,ne,je){let ht=_e||rf(re,ze),Rt=ze||yt||Ik(ht),tn=!R&&(!g.v7_partialHydration||!Ve);if(Se){if(tn){let Mt=Oe(je);st(dr({navigation:ht},Mt!==void 0?{actionData:Mt}:{}),{flushSync:ne})}let mt=await Gt(ue,re.pathname,te.signal);if(mt.type==="aborted")return{shortCircuited:!0};if(mt.type==="error"){let Mt=bo(mt.partialMatches).route.id;return{matches:mt.partialMatches,loaderData:{},errors:{[Mt]:mt.error}}}else if(mt.matches)ue=mt.matches;else{let{error:Mt,notFoundMatches:en,route:An}=He(re.pathname);return{matches:en,loaderData:{},errors:{[An.id]:Mt}}}}let Kt=d||u,[$t,Zt]=Ck(e.history,I,ue,Rt,re,g.v7_partialHydration&&Ve===!0,g.v7_skipActionErrorRevalidation,A,Z,pe,le,_,Q,Kt,m,je);if(xt(mt=>!(ue&&ue.some(Mt=>Mt.route.id===mt))||$t&&$t.some(Mt=>Mt.route.id===mt)),T=++D,$t.length===0&&Zt.length===0){let mt=Lt();return dt(re,dr({matches:ue,loaderData:{},errors:je&&$i(je[1])?{[je[0]]:je[1].error}:null},Mk(je),mt?{fetchers:new Map(I.fetchers)}:{}),{flushSync:ne}),{shortCircuited:!0}}if(tn){let mt={};if(!Se){mt.navigation=ht;let Mt=Oe(je);Mt!==void 0&&(mt.actionData=Mt)}Zt.length>0&&(mt.fetchers=Qe(Zt)),st(mt,{flushSync:ne})}Zt.forEach(mt=>{Bt(mt.key),mt.controller&&q.set(mt.key,mt.controller)});let Tn=()=>Zt.forEach(mt=>Bt(mt.key));F&&F.signal.addEventListener("abort",Tn);let{loaderResults:Zn,fetcherResults:Cn}=await ve(I,ue,$t,Zt,te);if(te.signal.aborted)return{shortCircuited:!0};F&&F.signal.removeEventListener("abort",Tn),Zt.forEach(mt=>q.delete(mt.key));let _t=kd(Zn);if(_t)return await vt(te,_t.result,!0,{replace:nt}),{shortCircuited:!0};if(_t=kd(Cn),_t)return Q.add(_t.key),await vt(te,_t.result,!0,{replace:nt}),{shortCircuited:!0};let{loaderData:Fn,errors:mn}=Dk(I,ue,Zn,je,Zt,Cn,oe);oe.forEach((mt,Mt)=>{mt.subscribe(en=>{(en||mt.done)&&oe.delete(Mt)})}),g.v7_partialHydration&&Ve&&I.errors&&(mn=dr({},I.errors,mn));let bn=Lt(),Ce=Nt(T),De=bn||Ce||Zt.length>0;return dr({matches:ue,loaderData:Fn,errors:mn},De?{fetchers:new Map(I.fetchers)}:{})}function Oe(te){if(te&&!$i(te[1]))return{[te[0]]:te[1].data};if(I.actionData)return Object.keys(I.actionData).length===0?null:I.actionData}function Qe(te){return te.forEach(re=>{let ue=I.fetchers.get(re.key),Se=uc(void 0,ue?ue.data:void 0);I.fetchers.set(re.key,Se)}),new Map(I.fetchers)}function wt(te,re,ue,Se){if(i)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Bt(te);let _e=(Se&&Se.flushSync)===!0,ze=d||u,yt=Tg(I.location,I.matches,m,g.v7_prependBasename,ue,g.v7_relativeSplatPath,re,Se==null?void 0:Se.relative),nt=go(ze,yt,m),Ve=Ht(nt,ze,yt);if(Ve.active&&Ve.matches&&(nt=Ve.matches),!nt){We(te,re,Di(404,{pathname:yt}),{flushSync:_e});return}let{path:ne,submission:je,error:ht}=xk(g.v7_normalizeFormMethod,!0,yt,Se);if(ht){We(te,re,ht,{flushSync:_e});return}let Rt=jc(nt,ne),tn=(Se&&Se.preventScrollReset)===!0;if(je&&xs(je.formMethod)){Ie(te,re,ne,Rt,nt,Ve.active,_e,tn,je);return}_.set(te,{routeId:re,path:ne}),Be(te,re,ne,Rt,nt,Ve.active,_e,tn,je)}async function Ie(te,re,ue,Se,_e,ze,yt,nt,Ve){Ae(),_.delete(te);function ne(zt){if(!zt.route.action&&!zt.route.lazy){let er=Di(405,{method:Ve.formMethod,pathname:ue,routeId:re});return We(te,re,er,{flushSync:yt}),!0}return!1}if(!ze&&ne(Se))return;let je=I.fetchers.get(te);et(te,lE(Ve,je),{flushSync:yt});let ht=new AbortController,Rt=ll(e.history,ue,ht.signal,Ve);if(ze){let zt=await Gt(_e,new URL(Rt.url).pathname,Rt.signal,te);if(zt.type==="aborted")return;if(zt.type==="error"){We(te,re,zt.error,{flushSync:yt});return}else if(zt.matches){if(_e=zt.matches,Se=jc(_e,ue),ne(Se))return}else{We(te,re,Di(404,{pathname:ue}),{flushSync:yt});return}}q.set(te,ht);let tn=D,$t=(await ft("action",I,Rt,[Se],_e,te))[Se.route.id];if(Rt.signal.aborted){q.get(te)===ht&&q.delete(te);return}if(g.v7_fetcherPersist&&le.has(te)){if(vo($t)||$i($t)){et(te,_a(void 0));return}}else{if(vo($t))if(q.delete(te),T>tn){et(te,_a(void 0));return}else return Q.add(te),et(te,uc(Ve)),vt(Rt,$t,!1,{fetcherSubmission:Ve,preventScrollReset:nt});if($i($t)){We(te,re,$t.error);return}}if(Wa($t))throw Di(400,{type:"defer-action"});let Zt=I.navigation.location||I.location,Tn=ll(e.history,Zt,ht.signal),Zn=d||u,Cn=I.navigation.state!=="idle"?go(Zn,I.navigation.location,m):I.matches;Nn(Cn,"Didn't find any matches after fetcher action");let _t=++D;B.set(te,_t);let Fn=uc(Ve,$t.data);I.fetchers.set(te,Fn);let[mn,bn]=Ck(e.history,I,Cn,Ve,Zt,!1,g.v7_skipActionErrorRevalidation,A,Z,pe,le,_,Q,Zn,m,[Se.route.id,$t]);bn.filter(zt=>zt.key!==te).forEach(zt=>{let er=zt.key,fr=I.fetchers.get(er),Hn=uc(void 0,fr?fr.data:void 0);I.fetchers.set(er,Hn),Bt(er),zt.controller&&q.set(er,zt.controller)}),st({fetchers:new Map(I.fetchers)});let Ce=()=>bn.forEach(zt=>Bt(zt.key));ht.signal.addEventListener("abort",Ce);let{loaderResults:De,fetcherResults:mt}=await ve(I,Cn,mn,bn,Tn);if(ht.signal.aborted)return;ht.signal.removeEventListener("abort",Ce),B.delete(te),q.delete(te),bn.forEach(zt=>q.delete(zt.key));let Mt=kd(De);if(Mt)return vt(Tn,Mt.result,!1,{preventScrollReset:nt});if(Mt=kd(mt),Mt)return Q.add(Mt.key),vt(Tn,Mt.result,!1,{preventScrollReset:nt});let{loaderData:en,errors:An}=Dk(I,Cn,De,void 0,bn,mt,oe);if(I.fetchers.has(te)){let zt=_a($t.data);I.fetchers.set(te,zt)}Nt(_t),I.navigation.state==="loading"&&_t>T?(Nn(M,"Expected pending action"),F&&F.abort(),dt(I.navigation.location,{matches:Cn,loaderData:en,errors:An,fetchers:new Map(I.fetchers)})):(st({errors:An,loaderData:Rk(I.loaderData,en,Cn,An),fetchers:new Map(I.fetchers)}),A=!1)}async function Be(te,re,ue,Se,_e,ze,yt,nt,Ve){let ne=I.fetchers.get(te);et(te,uc(Ve,ne?ne.data:void 0),{flushSync:yt});let je=new AbortController,ht=ll(e.history,ue,je.signal);if(ze){let $t=await Gt(_e,new URL(ht.url).pathname,ht.signal,te);if($t.type==="aborted")return;if($t.type==="error"){We(te,re,$t.error,{flushSync:yt});return}else if($t.matches)_e=$t.matches,Se=jc(_e,ue);else{We(te,re,Di(404,{pathname:ue}),{flushSync:yt});return}}q.set(te,je);let Rt=D,Kt=(await ft("loader",I,ht,[Se],_e,te))[Se.route.id];if(Wa(Kt)&&(Kt=await Ab(Kt,ht.signal,!0)||Kt),q.get(te)===je&&q.delete(te),!ht.signal.aborted){if(le.has(te)){et(te,_a(void 0));return}if(vo(Kt))if(T>Rt){et(te,_a(void 0));return}else{Q.add(te),await vt(ht,Kt,!1,{preventScrollReset:nt});return}if($i(Kt)){We(te,re,Kt.error);return}Nn(!Wa(Kt),"Unhandled fetcher deferred data"),et(te,_a(Kt.data))}}async function vt(te,re,ue,Se){let{submission:_e,fetcherSubmission:ze,preventScrollReset:yt,replace:nt}=Se===void 0?{}:Se;re.response.headers.has("X-Remix-Revalidate")&&(A=!0);let Ve=re.response.headers.get("Location");Nn(Ve,"Expected a Location header on the redirect Response"),Ve=Tk(Ve,new URL(te.url),m,e.history);let ne=qc(I.location,Ve,{_isRedirect:!0});if(r){let $t=!1;if(re.response.headers.has("X-Remix-Reload-Document"))$t=!0;else if(Mb.test(Ve)){const Zt=e.history.createURL(Ve);$t=Zt.origin!==t.location.origin||pu(Zt.pathname,m)==null}if($t){nt?t.location.replace(Ve):t.location.assign(Ve);return}}F=null;let je=nt===!0||re.response.headers.has("X-Remix-Replace")?Er.Replace:Er.Push,{formMethod:ht,formAction:Rt,formEncType:tn}=I.navigation;!_e&&!ze&&ht&&Rt&&tn&&(_e=Ik(I.navigation));let Kt=_e||ze;if(H1.has(re.response.status)&&Kt&&xs(Kt.formMethod))await we(je,ne,{submission:dr({},Kt,{formAction:Ve}),preventScrollReset:yt||O,enableViewTransition:ue?X:void 0});else{let $t=rf(ne,_e);await we(je,ne,{overrideNavigation:$t,fetcherSubmission:ze,preventScrollReset:yt||O,enableViewTransition:ue?X:void 0})}}async function ft(te,re,ue,Se,_e,ze){let yt,nt={};try{yt=await X1(f,te,re,ue,Se,_e,ze,c,a)}catch(Ve){return Se.forEach(ne=>{nt[ne.route.id]={type:Un.error,error:Ve}}),nt}for(let[Ve,ne]of Object.entries(yt))if(nE(ne)){let je=ne.result;nt[Ve]={type:Un.redirect,response:Z1(je,ue,Ve,_e,m,g.v7_relativeSplatPath)}}else nt[Ve]=await J1(ne);return nt}async function ve(te,re,ue,Se,_e){let ze=te.matches,yt=ft("loader",te,_e,ue,re,null),nt=Promise.all(Se.map(async je=>{if(je.matches&&je.match&&je.controller){let Rt=(await ft("loader",te,ll(e.history,je.path,je.controller.signal),[je.match],je.matches,je.key))[je.match.route.id];return{[je.key]:Rt}}else return Promise.resolve({[je.key]:{type:Un.error,error:Di(404,{pathname:je.path})}})})),Ve=await yt,ne=(await nt).reduce((je,ht)=>Object.assign(je,ht),{});return await Promise.all([sE(re,Ve,_e.signal,ze,te.loaderData),aE(re,ne,Se)]),{loaderResults:Ve,fetcherResults:ne}}function Ae(){A=!0,Z.push(...xt()),_.forEach((te,re)=>{q.has(re)&&pe.add(re),Bt(re)})}function et(te,re,ue){ue===void 0&&(ue={}),I.fetchers.set(te,re),st({fetchers:new Map(I.fetchers)},{flushSync:(ue&&ue.flushSync)===!0})}function We(te,re,ue,Se){Se===void 0&&(Se={});let _e=bo(I.matches,re);ct(te),st({errors:{[_e.route.id]:ue},fetchers:new Map(I.fetchers)},{flushSync:(Se&&Se.flushSync)===!0})}function lt(te){return de.set(te,(de.get(te)||0)+1),le.has(te)&&le.delete(te),I.fetchers.get(te)||z1}function ct(te){let re=I.fetchers.get(te);q.has(te)&&!(re&&re.state==="loading"&&B.has(te))&&Bt(te),_.delete(te),B.delete(te),Q.delete(te),g.v7_fetcherPersist&&le.delete(te),pe.delete(te),I.fetchers.delete(te)}function Vt(te){let re=(de.get(te)||0)-1;re<=0?(de.delete(te),le.add(te),g.v7_fetcherPersist||ct(te)):de.set(te,re),st({fetchers:new Map(I.fetchers)})}function Bt(te){let re=q.get(te);re&&(re.abort(),q.delete(te))}function Wt(te){for(let re of te){let ue=lt(re),Se=_a(ue.data);I.fetchers.set(re,Se)}}function Lt(){let te=[],re=!1;for(let ue of Q){let Se=I.fetchers.get(ue);Nn(Se,"Expected fetcher: "+ue),Se.state==="loading"&&(Q.delete(ue),te.push(ue),re=!0)}return Wt(te),re}function Nt(te){let re=[];for(let[ue,Se]of B)if(Se<te){let _e=I.fetchers.get(ue);Nn(_e,"Expected fetcher: "+ue),_e.state==="loading"&&(Bt(ue),B.delete(ue),re.push(ue))}return Wt(re),re.length>0}function ln(te,re){let ue=I.blockers.get(te)||cc;return ye.get(te)!==re&&ye.set(te,re),ue}function Jt(te){I.blockers.delete(te),ye.delete(te)}function Sn(te,re){let ue=I.blockers.get(te)||cc;Nn(ue.state==="unblocked"&&re.state==="blocked"||ue.state==="blocked"&&re.state==="blocked"||ue.state==="blocked"&&re.state==="proceeding"||ue.state==="blocked"&&re.state==="unblocked"||ue.state==="proceeding"&&re.state==="unblocked","Invalid blocker state transition: "+ue.state+" -> "+re.state);let Se=new Map(I.blockers);Se.set(te,re),st({blockers:Se})}function se(te){let{currentLocation:re,nextLocation:ue,historyAction:Se}=te;if(ye.size===0)return;ye.size>1&&So(!1,"A router only supports one blocker at a time");let _e=Array.from(ye.entries()),[ze,yt]=_e[_e.length-1],nt=I.blockers.get(ze);if(!(nt&&nt.state==="proceeding")&&yt({currentLocation:re,nextLocation:ue,historyAction:Se}))return ze}function He(te){let re=Di(404,{pathname:te}),ue=d||u,{matches:Se,route:_e}=Ak(ue);return xt(),{notFoundMatches:Se,route:_e,error:re}}function xt(te){let re=[];return oe.forEach((ue,Se)=>{(!te||te(Se))&&(ue.cancel(),re.push(Se),oe.delete(Se))}),re}function Tt(te,re,ue){if(x=te,j=re,C=ue||null,!N&&I.navigation===nf){N=!0;let Se=kn(I.location,I.matches);Se!=null&&st({restoreScrollPosition:Se})}return()=>{x=null,j=null,C=null}}function Mn(te,re){return C&&C(te,re.map(Se=>v1(Se,I.loaderData)))||te.key}function wn(te,re){if(x&&j){let ue=Mn(te,re);x[ue]=j()}}function kn(te,re){if(x){let ue=Mn(te,re),Se=x[ue];if(typeof Se=="number")return Se}return null}function Ht(te,re,ue){if(w)if(te){if(Object.keys(te[0].params).length>0)return{active:!0,matches:dh(re,ue,m,!0)}}else return{active:!0,matches:dh(re,ue,m,!0)||[]};return{active:!1,matches:null}}async function Gt(te,re,ue,Se){if(!w)return{type:"success",matches:te};let _e=te;for(;;){let ze=d==null,yt=d||u,nt=c;try{await w({signal:ue,path:re,matches:_e,fetcherKey:Se,patch:(je,ht)=>{ue.aborted||Nk(je,ht,yt,nt,a)}})}catch(je){return{type:"error",error:je,partialMatches:_e}}finally{ze&&!ue.aborted&&(u=[...u])}if(ue.aborted)return{type:"aborted"};let Ve=go(yt,re,m);if(Ve)return{type:"success",matches:Ve};let ne=dh(yt,re,m,!0);if(!ne||_e.length===ne.length&&_e.every((je,ht)=>je.route.id===ne[ht].route.id))return{type:"success",matches:null};_e=ne}}function dn(te){c={},d=Ih(te,a,void 0,c)}function hn(te,re){let ue=d==null;Nk(te,re,d||u,c,a),ue&&(u=[...u],st({}))}return W={get basename(){return m},get future(){return g},get state(){return I},get routes(){return u},get window(){return t},initialize:Me,subscribe:Dt,enableScrollRestoration:Tt,navigate:bt,fetch:wt,revalidate:pt,createHref:te=>e.history.createHref(te),encodeLocation:te=>e.history.encodeLocation(te),getFetcher:lt,deleteFetcher:Vt,dispose:Te,getBlocker:ln,deleteBlocker:Jt,patchRoutes:hn,_internalFetchControllers:q,_internalActiveDeferreds:oe,_internalSetRoutes:dn},W}function V1(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Tg(e,t,r,i,a,c,u,d){let m,f;if(u){m=[];for(let g of t)if(m.push(g),g.route.id===u){f=g;break}}else m=t,f=t[t.length-1];let w=Rb(a||".",Db(m,c),pu(e.pathname,r)||e.pathname,d==="path");if(a==null&&(w.search=e.search,w.hash=e.hash),(a==null||a===""||a===".")&&f){let g=Eb(w.search);if(f.route.index&&!g)w.search=w.search?w.search.replace(/^\?/,"?index&"):"?index";else if(!f.route.index&&g){let v=new URLSearchParams(w.search),y=v.getAll("index");v.delete("index"),y.filter(C=>C).forEach(C=>v.append("index",C));let x=v.toString();w.search=x?"?"+x:""}}return i&&r!=="/"&&(w.pathname=w.pathname==="/"?r:$a([r,w.pathname])),mu(w)}function xk(e,t,r,i){if(!i||!V1(i))return{path:r};if(i.formMethod&&!iE(i.formMethod))return{path:r,error:Di(405,{method:i.formMethod})};let a=()=>({path:r,error:Di(400,{type:"invalid-body"})}),c=i.formMethod||"get",u=e?c.toUpperCase():c.toLowerCase(),d=LN(r);if(i.body!==void 0){if(i.formEncType==="text/plain"){if(!xs(u))return a();let v=typeof i.body=="string"?i.body:i.body instanceof FormData||i.body instanceof URLSearchParams?Array.from(i.body.entries()).reduce((y,x)=>{let[C,j]=x;return""+y+C+"="+j+`
|
|
51
|
-
`},""):String(i.body);return{path:r,submission:{formMethod:u,formAction:d,formEncType:i.formEncType,formData:void 0,json:void 0,text:v}}}else if(i.formEncType==="application/json"){if(!xs(u))return a();try{let v=typeof i.body=="string"?JSON.parse(i.body):i.body;return{path:r,submission:{formMethod:u,formAction:d,formEncType:i.formEncType,formData:void 0,json:v,text:void 0}}}catch{return a()}}}Nn(typeof FormData=="function","FormData is not available in this environment");let m,f;if(i.formData)m=Dg(i.formData),f=i.formData;else if(i.body instanceof FormData)m=Dg(i.body),f=i.body;else if(i.body instanceof URLSearchParams)m=i.body,f=Pk(m);else if(i.body==null)m=new URLSearchParams,f=new FormData;else try{m=new URLSearchParams(i.body),f=Pk(m)}catch{return a()}let w={formMethod:u,formAction:d,formEncType:i&&i.formEncType||"application/x-www-form-urlencoded",formData:f,json:void 0,text:void 0};if(xs(w.formMethod))return{path:r,submission:w};let g=Ka(r);return t&&g.search&&Eb(g.search)&&m.append("index",""),g.search="?"+m,{path:mu(g),submission:w}}function Sk(e,t,r){r===void 0&&(r=!1);let i=e.findIndex(a=>a.route.id===t);return i>=0?e.slice(0,r?i+1:i):e}function Ck(e,t,r,i,a,c,u,d,m,f,w,g,v,y,x,C){let j=C?$i(C[1])?C[1].error:C[1].data:void 0,N=e.createURL(t.location),P=e.createURL(a),L=r;c&&t.errors?L=Sk(r,Object.keys(t.errors)[0],!0):C&&$i(C[1])&&(L=Sk(r,C[0]));let Y=C?C[1].statusCode:void 0,H=u&&Y&&Y>=400,W=L.filter((M,O)=>{let{route:F}=M;if(F.lazy)return!0;if(F.loader==null)return!1;if(c)return Pg(F,t.loaderData,t.errors);if(G1(t.loaderData,t.matches[O],M)||m.some(G=>G===M.route.id))return!0;let X=t.matches[O],U=M;return jk(M,dr({currentUrl:N,currentParams:X.params,nextUrl:P,nextParams:U.params},i,{actionResult:j,actionStatus:Y,defaultShouldRevalidate:H?!1:d||N.pathname+N.search===P.pathname+P.search||N.search!==P.search||EN(X,U)}))}),I=[];return g.forEach((M,O)=>{if(c||!r.some(R=>R.route.id===M.routeId)||w.has(O))return;let F=go(y,M.path,x);if(!F){I.push({key:O,routeId:M.routeId,path:M.path,matches:null,match:null,controller:null});return}let X=t.fetchers.get(O),U=jc(F,M.path),G=!1;v.has(O)?G=!1:f.has(O)?(f.delete(O),G=!0):X&&X.state!=="idle"&&X.data===void 0?G=d:G=jk(U,dr({currentUrl:N,currentParams:t.matches[t.matches.length-1].params,nextUrl:P,nextParams:r[r.length-1].params},i,{actionResult:j,actionStatus:Y,defaultShouldRevalidate:H?!1:d})),G&&I.push({key:O,routeId:M.routeId,path:M.path,matches:F,match:U,controller:new AbortController})}),[W,I]}function Pg(e,t,r){if(e.lazy)return!0;if(!e.loader)return!1;let i=t!=null&&t[e.id]!==void 0,a=r!=null&&r[e.id]!==void 0;return!i&&a?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!i&&!a}function G1(e,t,r){let i=!t||r.route.id!==t.route.id,a=e[r.route.id]===void 0;return i||a}function EN(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function jk(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Nk(e,t,r,i,a){var c;let u;if(e){let f=i[e];Nn(f,"No route found to patch children into: routeId = "+e),f.children||(f.children=[]),u=f.children}else u=r;let d=t.filter(f=>!u.some(w=>IN(f,w))),m=Ih(d,a,[e||"_","patch",String(((c=u)==null?void 0:c.length)||"0")],i);u.push(...m)}function IN(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((r,i)=>{var a;return(a=t.children)==null?void 0:a.some(c=>IN(r,c))}):!1}async function K1(e,t,r){if(!e.lazy)return;let i=await e.lazy();if(!e.lazy)return;let a=r[e.id];Nn(a,"No route found in manifest");let c={};for(let u in i){let m=a[u]!==void 0&&u!=="hasErrorBoundary";So(!m,'Route "'+a.id+'" has a static property "'+u+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+u+'" will be ignored.')),!m&&!b1.has(u)&&(c[u]=i[u])}Object.assign(a,c),Object.assign(a,dr({},t(a),{lazy:void 0}))}async function Y1(e){let{matches:t}=e,r=t.filter(a=>a.shouldLoad);return(await Promise.all(r.map(a=>a.resolve()))).reduce((a,c,u)=>Object.assign(a,{[r[u].route.id]:c}),{})}async function X1(e,t,r,i,a,c,u,d,m,f){let w=c.map(y=>y.route.lazy?K1(y.route,m,d):void 0),g=c.map((y,x)=>{let C=w[x],j=a.some(P=>P.route.id===y.route.id);return dr({},y,{shouldLoad:j,resolve:async P=>(P&&i.method==="GET"&&(y.route.lazy||y.route.loader)&&(j=!0),j?Q1(t,i,y,C,P,f):Promise.resolve({type:Un.data,result:void 0}))})}),v=await e({matches:g,request:i,params:c[0].params,fetcherKey:u,context:f});try{await Promise.all(w)}catch{}return v}async function Q1(e,t,r,i,a,c){let u,d,m=f=>{let w,g=new Promise((x,C)=>w=C);d=()=>w(),t.signal.addEventListener("abort",d);let v=x=>typeof f!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+r.route.id+"]"))):f({request:t,params:r.params,context:c},...x!==void 0?[x]:[]),y=(async()=>{try{return{type:"data",result:await(a?a(C=>v(C)):v())}}catch(x){return{type:"error",result:x}}})();return Promise.race([y,g])};try{let f=r.route[e];if(i)if(f){let w,[g]=await Promise.all([m(f).catch(v=>{w=v}),i]);if(w!==void 0)throw w;u=g}else if(await i,f=r.route[e],f)u=await m(f);else if(e==="action"){let w=new URL(t.url),g=w.pathname+w.search;throw Di(405,{method:t.method,pathname:g,routeId:r.route.id})}else return{type:Un.data,result:void 0};else if(f)u=await m(f);else{let w=new URL(t.url),g=w.pathname+w.search;throw Di(404,{pathname:g})}Nn(u.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+r.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(f){return{type:Un.error,result:f}}finally{d&&t.signal.removeEventListener("abort",d)}return u}async function J1(e){let{result:t,type:r}=e;if(FN(t)){let g;try{let v=t.headers.get("Content-Type");v&&/\bapplication\/json\b/.test(v)?t.body==null?g=null:g=await t.json():g=await t.text()}catch(v){return{type:Un.error,error:v}}return r===Un.error?{type:Un.error,error:new Lh(t.status,t.statusText,g),statusCode:t.status,headers:t.headers}:{type:Un.data,data:g,statusCode:t.status,headers:t.headers}}if(r===Un.error){if(Ek(t)){var i,a;if(t.data instanceof Error){var c,u;return{type:Un.error,error:t.data,statusCode:(c=t.init)==null?void 0:c.status,headers:(u=t.init)!=null&&u.headers?new Headers(t.init.headers):void 0}}return{type:Un.error,error:new Lh(((i=t.init)==null?void 0:i.status)||500,void 0,t.data),statusCode:$c(t)?t.status:void 0,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}}return{type:Un.error,error:t,statusCode:$c(t)?t.status:void 0}}if(rE(t)){var d,m;return{type:Un.deferred,deferredData:t,statusCode:(d=t.init)==null?void 0:d.status,headers:((m=t.init)==null?void 0:m.headers)&&new Headers(t.init.headers)}}if(Ek(t)){var f,w;return{type:Un.data,data:t.data,statusCode:(f=t.init)==null?void 0:f.status,headers:(w=t.init)!=null&&w.headers?new Headers(t.init.headers):void 0}}return{type:Un.data,data:t}}function Z1(e,t,r,i,a,c){let u=e.headers.get("Location");if(Nn(u,"Redirects returned/thrown from loaders/actions must have a Location header"),!Mb.test(u)){let d=i.slice(0,i.findIndex(m=>m.route.id===r)+1);u=Tg(new URL(t.url),d,a,!0,u,c),e.headers.set("Location",u)}return e}function Tk(e,t,r,i){let a=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(Mb.test(e)){let c=e,u=c.startsWith("//")?new URL(t.protocol+c):new URL(c);if(a.includes(u.protocol))throw new Error("Invalid redirect location");let d=pu(u.pathname,r)!=null;if(u.origin===t.origin&&d)return u.pathname+u.search+u.hash}try{let c=i.createURL(e);if(a.includes(c.protocol))throw new Error("Invalid redirect location")}catch{}return e}function ll(e,t,r,i){let a=e.createURL(LN(t)).toString(),c={signal:r};if(i&&xs(i.formMethod)){let{formMethod:u,formEncType:d}=i;c.method=u.toUpperCase(),d==="application/json"?(c.headers=new Headers({"Content-Type":d}),c.body=JSON.stringify(i.json)):d==="text/plain"?c.body=i.text:d==="application/x-www-form-urlencoded"&&i.formData?c.body=Dg(i.formData):c.body=i.formData}return new Request(a,c)}function Dg(e){let t=new URLSearchParams;for(let[r,i]of e.entries())t.append(r,typeof i=="string"?i:i.name);return t}function Pk(e){let t=new FormData;for(let[r,i]of e.entries())t.append(r,i);return t}function eE(e,t,r,i,a){let c={},u=null,d,m=!1,f={},w=r&&$i(r[1])?r[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let v=g.route.id,y=t[v];if(Nn(!vo(y),"Cannot handle redirect results in processLoaderData"),$i(y)){let x=y.error;w!==void 0&&(x=w,w=void 0),u=u||{};{let C=bo(e,v);u[C.route.id]==null&&(u[C.route.id]=x)}c[v]=void 0,m||(m=!0,d=$c(y.error)?y.error.status:500),y.headers&&(f[v]=y.headers)}else Wa(y)?(i.set(v,y.deferredData),c[v]=y.deferredData.data,y.statusCode!=null&&y.statusCode!==200&&!m&&(d=y.statusCode),y.headers&&(f[v]=y.headers)):(c[v]=y.data,y.statusCode&&y.statusCode!==200&&!m&&(d=y.statusCode),y.headers&&(f[v]=y.headers))}),w!==void 0&&r&&(u={[r[0]]:w},c[r[0]]=void 0),{loaderData:c,errors:u,statusCode:d||200,loaderHeaders:f}}function Dk(e,t,r,i,a,c,u){let{loaderData:d,errors:m}=eE(t,r,i,u);return a.forEach(f=>{let{key:w,match:g,controller:v}=f,y=c[w];if(Nn(y,"Did not find corresponding fetcher result"),!(v&&v.signal.aborted))if($i(y)){let x=bo(e.matches,g==null?void 0:g.route.id);m&&m[x.route.id]||(m=dr({},m,{[x.route.id]:y.error})),e.fetchers.delete(w)}else if(vo(y))Nn(!1,"Unhandled fetcher revalidation redirect");else if(Wa(y))Nn(!1,"Unhandled fetcher deferred data");else{let x=_a(y.data);e.fetchers.set(w,x)}}),{loaderData:d,errors:m}}function Rk(e,t,r,i){let a=dr({},t);for(let c of r){let u=c.route.id;if(t.hasOwnProperty(u)?t[u]!==void 0&&(a[u]=t[u]):e[u]!==void 0&&c.route.loader&&(a[u]=e[u]),i&&i.hasOwnProperty(u))break}return a}function Mk(e){return e?$i(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function bo(e,t){return(t?e.slice(0,e.findIndex(i=>i.route.id===t)+1):[...e]).reverse().find(i=>i.route.hasErrorBoundary===!0)||e[0]}function Ak(e){let t=e.length===1?e[0]:e.find(r=>r.index||!r.path||r.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Di(e,t){let{pathname:r,routeId:i,method:a,type:c,message:u}=t===void 0?{}:t,d="Unknown Server Error",m="Unknown @remix-run/router error";return e===400?(d="Bad Request",a&&r&&i?m="You made a "+a+' request to "'+r+'" but '+('did not provide a `loader` for route "'+i+'", ')+"so there is no way to handle the request.":c==="defer-action"?m="defer() is not supported in actions":c==="invalid-body"&&(m="Unable to encode submission body")):e===403?(d="Forbidden",m='Route "'+i+'" does not match URL "'+r+'"'):e===404?(d="Not Found",m='No route matches URL "'+r+'"'):e===405&&(d="Method Not Allowed",a&&r&&i?m="You made a "+a.toUpperCase()+' request to "'+r+'" but '+('did not provide an `action` for route "'+i+'", ')+"so there is no way to handle the request.":a&&(m='Invalid request method "'+a.toUpperCase()+'"')),new Lh(e||500,d,new Error(m),!0)}function kd(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[i,a]=t[r];if(vo(a))return{key:i,result:a}}}function LN(e){let t=typeof e=="string"?Ka(e):e;return mu(dr({},t,{hash:""}))}function tE(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function nE(e){return FN(e.result)&&U1.has(e.result.status)}function Wa(e){return e.type===Un.deferred}function $i(e){return e.type===Un.error}function vo(e){return(e&&e.type)===Un.redirect}function Ek(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function rE(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function FN(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function iE(e){return W1.has(e.toLowerCase())}function xs(e){return O1.has(e.toLowerCase())}async function sE(e,t,r,i,a){let c=Object.entries(t);for(let u=0;u<c.length;u++){let[d,m]=c[u],f=e.find(v=>(v==null?void 0:v.route.id)===d);if(!f)continue;let w=i.find(v=>v.route.id===f.route.id),g=w!=null&&!EN(w,f)&&(a&&a[f.route.id])!==void 0;Wa(m)&&g&&await Ab(m,r,!1).then(v=>{v&&(t[d]=v)})}}async function aE(e,t,r){for(let i=0;i<r.length;i++){let{key:a,routeId:c,controller:u}=r[i],d=t[a];e.find(f=>(f==null?void 0:f.route.id)===c)&&Wa(d)&&(Nn(u,"Expected an AbortController for revalidating fetcher deferred result"),await Ab(d,u.signal,!0).then(f=>{f&&(t[a]=f)}))}}async function Ab(e,t,r){if(r===void 0&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:Un.data,data:e.deferredData.unwrappedData}}catch(a){return{type:Un.error,error:a}}return{type:Un.data,data:e.deferredData.data}}}function Eb(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function jc(e,t){let r=typeof t=="string"?Ka(t).search:t.search;if(e[e.length-1].route.index&&Eb(r||""))return e[e.length-1];let i=RN(e);return i[i.length-1]}function Ik(e){let{formMethod:t,formAction:r,formEncType:i,text:a,formData:c,json:u}=e;if(!(!t||!r||!i)){if(a!=null)return{formMethod:t,formAction:r,formEncType:i,formData:void 0,json:void 0,text:a};if(c!=null)return{formMethod:t,formAction:r,formEncType:i,formData:c,json:void 0,text:void 0};if(u!==void 0)return{formMethod:t,formAction:r,formEncType:i,formData:void 0,json:u,text:void 0}}}function rf(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function oE(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function uc(e,t){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function lE(e,t){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function _a(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function cE(e,t){try{let r=e.sessionStorage.getItem(AN);if(r){let i=JSON.parse(r);for(let[a,c]of Object.entries(i||{}))c&&Array.isArray(c)&&t.set(a,new Set(c||[]))}}catch{}}function uE(e,t){if(t.size>0){let r={};for(let[i,a]of t)r[i]=[...a];try{e.sessionStorage.setItem(AN,JSON.stringify(r))}catch(i){So(!1,"Failed to save applied view transitions in sessionStorage ("+i+").")}}}/**
|
|
52
|
-
* React Router v6.30.3
|
|
53
|
-
*
|
|
54
|
-
* Copyright (c) Remix Software Inc.
|
|
55
|
-
*
|
|
56
|
-
* This source code is licensed under the MIT license found in the
|
|
57
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
58
|
-
*
|
|
59
|
-
* @license MIT
|
|
60
|
-
*/function Fh(){return Fh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},Fh.apply(this,arguments)}const am=p.createContext(null),_N=p.createContext(null),fu=p.createContext(null),Ib=p.createContext(null),da=p.createContext({outlet:null,matches:[],isDataRoute:!1}),ON=p.createContext(null);function gu(){return p.useContext(Ib)!=null}function hs(){return gu()||Nn(!1),p.useContext(Ib).location}function BN(e){p.useContext(fu).static||p.useLayoutEffect(e)}function mr(){let{isDataRoute:e}=p.useContext(da);return e?CE():dE()}function dE(){gu()||Nn(!1);let e=p.useContext(am),{basename:t,future:r,navigator:i}=p.useContext(fu),{matches:a}=p.useContext(da),{pathname:c}=hs(),u=JSON.stringify(Db(a,r.v7_relativeSplatPath)),d=p.useRef(!1);return BN(()=>{d.current=!0}),p.useCallback(function(f,w){if(w===void 0&&(w={}),!d.current)return;if(typeof f=="number"){i.go(f);return}let g=Rb(f,JSON.parse(u),c,w.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:$a([t,g.pathname])),(w.replace?i.replace:i.push)(g,w.state,w)},[t,i,u,c,e])}const hE=p.createContext(null);function mE(e){let t=p.useContext(da).outlet;return t&&p.createElement(hE.Provider,{value:e},t)}function Ao(){let{matches:e}=p.useContext(da),t=e[e.length-1];return t?t.params:{}}function pE(e,t,r,i){gu()||Nn(!1);let{navigator:a}=p.useContext(fu),{matches:c}=p.useContext(da),u=c[c.length-1],d=u?u.params:{};u&&u.pathname;let m=u?u.pathnameBase:"/";u&&u.route;let f=hs(),w;w=f;let g=w.pathname||"/",v=g;if(m!=="/"){let C=m.replace(/^\//,"").split("/");v="/"+g.replace(/^\//,"").split("/").slice(C.length).join("/")}let y=go(e,{pathname:v});return vE(y&&y.map(C=>Object.assign({},C,{params:Object.assign({},d,C.params),pathname:$a([m,a.encodeLocation?a.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?m:$a([m,a.encodeLocation?a.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),c,r,i)}function fE(){let e=SE(),t=$c(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},t),r?p.createElement("pre",{style:a},r):null,null)}const gE=p.createElement(fE,null);class bE extends p.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,r){return r.location!==t.location||r.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:r.error,location:r.location,revalidation:t.revalidation||r.revalidation}}componentDidCatch(t,r){console.error("React Router caught the following error during render",t,r)}render(){return this.state.error!==void 0?p.createElement(da.Provider,{value:this.props.routeContext},p.createElement(ON.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function wE(e){let{routeContext:t,match:r,children:i}=e,a=p.useContext(am);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),p.createElement(da.Provider,{value:t},i)}function vE(e,t,r,i){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),i===void 0&&(i=null),e==null){var c;if(!r)return null;if(r.errors)e=r.matches;else if((c=i)!=null&&c.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let u=e,d=(a=r)==null?void 0:a.errors;if(d!=null){let w=u.findIndex(g=>g.route.id&&(d==null?void 0:d[g.route.id])!==void 0);w>=0||Nn(!1),u=u.slice(0,Math.min(u.length,w+1))}let m=!1,f=-1;if(r&&i&&i.v7_partialHydration)for(let w=0;w<u.length;w++){let g=u[w];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=w),g.route.id){let{loaderData:v,errors:y}=r,x=g.route.loader&&v[g.route.id]===void 0&&(!y||y[g.route.id]===void 0);if(g.route.lazy||x){m=!0,f>=0?u=u.slice(0,f+1):u=[u[0]];break}}}return u.reduceRight((w,g,v)=>{let y,x=!1,C=null,j=null;r&&(y=d&&g.route.id?d[g.route.id]:void 0,C=g.route.errorElement||gE,m&&(f<0&&v===0?(jE("route-fallback"),x=!0,j=null):f===v&&(x=!0,j=g.route.hydrateFallbackElement||null)));let N=t.concat(u.slice(0,v+1)),P=()=>{let L;return y?L=C:x?L=j:g.route.Component?L=p.createElement(g.route.Component,null):g.route.element?L=g.route.element:L=w,p.createElement(wE,{match:g,routeContext:{outlet:w,matches:N,isDataRoute:r!=null},children:L})};return r&&(g.route.ErrorBoundary||g.route.errorElement||v===0)?p.createElement(bE,{location:r.location,revalidation:r.revalidation,component:C,error:y,children:P(),routeContext:{outlet:null,matches:N,isDataRoute:!0}}):P()},null)}var WN=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(WN||{}),UN=(function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e})(UN||{});function yE(e){let t=p.useContext(am);return t||Nn(!1),t}function kE(e){let t=p.useContext(_N);return t||Nn(!1),t}function xE(e){let t=p.useContext(da);return t||Nn(!1),t}function HN(e){let t=xE(),r=t.matches[t.matches.length-1];return r.route.id||Nn(!1),r.route.id}function SE(){var e;let t=p.useContext(ON),r=kE(),i=HN();return t!==void 0?t:(e=r.errors)==null?void 0:e[i]}function CE(){let{router:e}=yE(WN.UseNavigateStable),t=HN(UN.UseNavigateStable),r=p.useRef(!1);return BN(()=>{r.current=!0}),p.useCallback(function(a,c){c===void 0&&(c={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,Fh({fromRouteId:t},c)))},[e,t])}const Lk={};function jE(e,t,r){Lk[e]||(Lk[e]=!0)}function NE(e,t){e==null||e.v7_startTransition,(e==null?void 0:e.v7_relativeSplatPath)===void 0&&(!t||t.v7_relativeSplatPath),t&&(t.v7_fetcherPersist,t.v7_normalizeFormMethod,t.v7_partialHydration,t.v7_skipActionErrorRevalidation)}function Al(e){let{to:t,replace:r,state:i,relative:a}=e;gu()||Nn(!1);let{future:c,static:u}=p.useContext(fu),{matches:d}=p.useContext(da),{pathname:m}=hs(),f=mr(),w=Rb(t,Db(d,c.v7_relativeSplatPath),m,a==="path"),g=JSON.stringify(w);return p.useEffect(()=>f(JSON.parse(g),{replace:r,state:i,relative:a}),[f,g,a,r,i]),null}function Rg(e){return mE(e.context)}function TE(e){let{basename:t="/",children:r=null,location:i,navigationType:a=Er.Pop,navigator:c,static:u=!1,future:d}=e;gu()&&Nn(!1);let m=t.replace(/^\/*/,"/"),f=p.useMemo(()=>({basename:m,navigator:c,static:u,future:Fh({v7_relativeSplatPath:!1},d)}),[m,d,c,u]);typeof i=="string"&&(i=Ka(i));let{pathname:w="/",search:g="",hash:v="",state:y=null,key:x="default"}=i,C=p.useMemo(()=>{let j=pu(w,m);return j==null?null:{location:{pathname:j,search:g,hash:v,state:y,key:x},navigationType:a}},[m,w,g,v,y,x,a]);return C==null?null:p.createElement(fu.Provider,{value:f},p.createElement(Ib.Provider,{children:r,value:C}))}new Promise(()=>{});function PE(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:p.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:p.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:p.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/**
|
|
61
|
-
* React Router DOM v6.30.3
|
|
62
|
-
*
|
|
63
|
-
* Copyright (c) Remix Software Inc.
|
|
64
|
-
*
|
|
65
|
-
* This source code is licensed under the MIT license found in the
|
|
66
|
-
* LICENSE.md file in the root directory of this source tree.
|
|
67
|
-
*
|
|
68
|
-
* @license MIT
|
|
69
|
-
*/function _h(){return _h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},_h.apply(this,arguments)}function Mg(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let i=e[r];return t.concat(Array.isArray(i)?i.map(a=>[r,a]):[[r,i]])},[]))}function DE(e,t){let r=Mg(e);return t&&t.forEach((i,a)=>{r.has(a)||t.getAll(a).forEach(c=>{r.append(a,c)})}),r}const RE="6";try{window.__reactRouterVersion=RE}catch{}function ME(e,t){return $1({basename:void 0,future:_h({},void 0,{v7_prependBasename:!0}),history:p1({window:void 0}),hydrationData:AE(),routes:e,mapRouteProperties:PE,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function AE(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=_h({},t,{errors:EE(t.errors)})),t}function EE(e){if(!e)return null;let t=Object.entries(e),r={};for(let[i,a]of t)if(a&&a.__type==="RouteErrorResponse")r[i]=new Lh(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let c=window[a.__subType];if(typeof c=="function")try{let u=new c(a.message);u.stack="",r[i]=u}catch{}}if(r[i]==null){let c=new Error(a.message);c.stack="",r[i]=c}}else r[i]=a;return r}const IE=p.createContext({isTransitioning:!1}),LE=p.createContext(new Map),FE="startTransition",Fk=JM[FE],_E="flushSync",_k=m1[_E];function OE(e){Fk?Fk(e):e()}function dc(e){_k?_k(e):e()}class BE{constructor(){this.status="pending",this.promise=new Promise((t,r)=>{this.resolve=i=>{this.status==="pending"&&(this.status="resolved",t(i))},this.reject=i=>{this.status==="pending"&&(this.status="rejected",r(i))}})}}function WE(e){let{fallbackElement:t,router:r,future:i}=e,[a,c]=p.useState(r.state),[u,d]=p.useState(),[m,f]=p.useState({isTransitioning:!1}),[w,g]=p.useState(),[v,y]=p.useState(),[x,C]=p.useState(),j=p.useRef(new Map),{v7_startTransition:N}=i||{},P=p.useCallback(M=>{N?OE(M):M()},[N]),L=p.useCallback((M,O)=>{let{deletedFetchers:F,flushSync:X,viewTransitionOpts:U}=O;M.fetchers.forEach((R,A)=>{R.data!==void 0&&j.current.set(A,R.data)}),F.forEach(R=>j.current.delete(R));let G=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!U||G){X?dc(()=>c(M)):P(()=>c(M));return}if(X){dc(()=>{v&&(w&&w.resolve(),v.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:U.currentLocation,nextLocation:U.nextLocation})});let R=r.window.document.startViewTransition(()=>{dc(()=>c(M))});R.finished.finally(()=>{dc(()=>{g(void 0),y(void 0),d(void 0),f({isTransitioning:!1})})}),dc(()=>y(R));return}v?(w&&w.resolve(),v.skipTransition(),C({state:M,currentLocation:U.currentLocation,nextLocation:U.nextLocation})):(d(M),f({isTransitioning:!0,flushSync:!1,currentLocation:U.currentLocation,nextLocation:U.nextLocation}))},[r.window,v,w,j,P]);p.useLayoutEffect(()=>r.subscribe(L),[r,L]),p.useEffect(()=>{m.isTransitioning&&!m.flushSync&&g(new BE)},[m]),p.useEffect(()=>{if(w&&u&&r.window){let M=u,O=w.promise,F=r.window.document.startViewTransition(async()=>{P(()=>c(M)),await O});F.finished.finally(()=>{g(void 0),y(void 0),d(void 0),f({isTransitioning:!1})}),y(F)}},[P,u,w,r.window]),p.useEffect(()=>{w&&u&&a.location.key===u.location.key&&w.resolve()},[w,v,a.location,u]),p.useEffect(()=>{!m.isTransitioning&&x&&(d(x.state),f({isTransitioning:!0,flushSync:!1,currentLocation:x.currentLocation,nextLocation:x.nextLocation}),C(void 0))},[m.isTransitioning,x]),p.useEffect(()=>{},[]);let Y=p.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:M=>r.navigate(M),push:(M,O,F)=>r.navigate(M,{state:O,preventScrollReset:F==null?void 0:F.preventScrollReset}),replace:(M,O,F)=>r.navigate(M,{replace:!0,state:O,preventScrollReset:F==null?void 0:F.preventScrollReset})}),[r]),H=r.basename||"/",W=p.useMemo(()=>({router:r,navigator:Y,static:!1,basename:H}),[r,Y,H]),I=p.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return p.useEffect(()=>NE(i,r.future),[i,r.future]),p.createElement(p.Fragment,null,p.createElement(am.Provider,{value:W},p.createElement(_N.Provider,{value:a},p.createElement(LE.Provider,{value:j.current},p.createElement(IE.Provider,{value:m},p.createElement(TE,{basename:H,location:a.location,navigationType:a.historyAction,navigator:Y,future:I},a.initialized||r.future.v7_partialHydration?p.createElement(UE,{routes:r.routes,future:r.future,state:a}):t))))),null)}const UE=p.memo(HE);function HE(e){let{routes:t,future:r,state:i}=e;return pE(t,void 0,i,r)}var Ok;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ok||(Ok={}));var Bk;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Bk||(Bk={}));function zE(e){let t=p.useRef(Mg(e)),r=p.useRef(!1),i=hs(),a=p.useMemo(()=>DE(i.search,r.current?null:t.current),[i.search]),c=mr(),u=p.useCallback((d,m)=>{const f=Mg(typeof d=="function"?d(a):d);r.current=!0,c("?"+f,m)},[c,a]);return[a,u]}const qE="modulepreload",$E=function(e){return"/"+e},Wk={},Pl=function(t,r,i){let a=Promise.resolve();if(r&&r.length>0){let u=function(f){return Promise.all(f.map(w=>Promise.resolve(w).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),m=(d==null?void 0:d.nonce)||(d==null?void 0:d.getAttribute("nonce"));a=u(r.map(f=>{if(f=$E(f),f in Wk)return;Wk[f]=!0;const w=f.endsWith(".css"),g=w?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const v=document.createElement("link");if(v.rel=w?"stylesheet":qE,w||(v.as="script"),v.crossOrigin="",v.href=f,m&&v.setAttribute("nonce",m),document.head.appendChild(v),w)return new Promise((y,x)=>{v.addEventListener("load",y),v.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${f}`)))})}))}function c(u){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=u,window.dispatchEvent(d),!d.defaultPrevented)throw u}return a.then(u=>{for(const d of u||[])d.status==="rejected"&&c(d.reason);return t().catch(c)})},VE="desktop://window-lifecycle",zN=p.createContext(null),GE=["--desktop-macos-traffic-light-center-y","--desktop-macos-traffic-light-leading-inset","--desktop-macos-traffic-light-safe-zone-width","--desktop-macos-titlebar-height","--desktop-macos-traffic-light-button-diameter"];function KE(e){if(typeof document>"u")return;const{documentElement:t,body:r}=document;t.dataset.runtimePlatform=e.platform,t.dataset.osFamily=e.ui.osFamily,t.dataset.windowControls=e.ui.windowControlsStyle,t.dataset.viewportClass=e.viewportClass,t.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar),r&&(r.dataset.runtimePlatform=e.platform,r.dataset.osFamily=e.ui.osFamily,r.dataset.windowControls=e.ui.windowControlsStyle,r.dataset.viewportClass=e.viewportClass,r.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar))}function Ag(){var e;if(!(typeof document>"u"))for(const t of GE)document.documentElement.style.removeProperty(t),(e=document.body)==null||e.style.removeProperty(t)}function YE(e){if(typeof document>"u")return;if(!e){Ag();return}const t=[document.documentElement,document.body].filter(i=>!!i),r=[["--desktop-macos-traffic-light-center-y",`${e.trafficLightCenterY}px`],["--desktop-macos-traffic-light-leading-inset",`${e.trafficLightLeadingInset}px`],["--desktop-macos-traffic-light-safe-zone-width",`${e.trafficLightSafeZoneWidth}px`],["--desktop-macos-titlebar-height",`${e.titlebarHeight}px`],["--desktop-macos-traffic-light-button-diameter",`${e.trafficLightButtonDiameter}px`]];for(const i of t)for(const[a,c]of r)i.style.setProperty(a,c)}function XE(){if(!(typeof window>"u"))return window.innerWidth}function QE({children:e}){const[t,r]=p.useState(()=>XE()),i=p.useMemo(()=>$s({viewportWidth:t}),[t]);return p.useEffect(()=>{if(typeof window>"u")return;function a(){r(window.innerWidth)}return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[]),p.useEffect(()=>{KE(i)},[i]),p.useEffect(()=>()=>{Ag()},[]),p.useEffect(()=>{let a=!1,c=null;return!i.isDesktop||!i.bridge.supported?()=>{a=!0}:(Pl(()=>Promise.resolve().then(()=>vL),void 0).then(async({listen:u})=>{const d=await u(VE,m=>{const f=m.payload,w=f==null?void 0:f.descriptor;w!=null&&w.windowId&&(i.windows.registerDescriptor(w),f.isOpen?i.windows.markWindowOpen(w.windowId):i.windows.markWindowClosed(w.windowId))});if(a){d();return}c=d}).catch(()=>{}),()=>{a=!0,c==null||c()})},[i]),p.useEffect(()=>{let a=!1,c=null;async function u(){var m,f;const d=await i.bridge.getRuntimeInfo();a||YE(d.ok?(f=(m=d.value)==null?void 0:m.windowChrome)==null?void 0:f.macosTitlebar:null)}return!i.isDesktop||i.ui.osFamily!=="macos"||!i.ui.prefersOverlayTitlebar?(Ag(),()=>{a=!0}):(u(),Pl(()=>Promise.resolve().then(()=>jL),void 0).then(async({getCurrentWindow:d})=>{const m=await d().onScaleChanged(()=>{u()});if(a){m();return}c=m}).catch(()=>{}),()=>{a=!0,c==null||c()})},[i]),n.jsx(zN.Provider,{value:i,children:e})}function pr(){return p.useContext(zN)??$s()}const JE={common:{appName:"CodingNS",loading:"Loading...",retry:"Retry",back:"Back",save:"Save",logout:"Log out",unknown:"Unknown session",close:"Close",cancel:"Cancel",language:"Language"},auth:{loginTitle:"Resume your coding session",loginSubtitle:"INITIALIZING DEVELOPMENT ENVIRONMENT...",serverPreset:"Server Preset",serverCustomOption:"Use custom server",serverAddress:"Server Address",serverPlaceholder:"For example: http://127.0.0.1:3002",serverHint:"Login, realtime messages, and terminals all connect through this host. Point the client at the Host API endpoint such as http://127.0.0.1:3002; frontend dev ports like 4174 or 5173 are not meant for packaged clients and only work for temporary debugging when proxying and CORS are configured correctly.",serverInvalid:"Invalid server address. Check it and try again.",serverCurrent:"Current Server",bootstrapTitle:"Complete the first-time bootstrap",bootstrapSubtitle:"This Host does not have an admin account yet. Create the minimal login entry first.",username:"Username",password:"Password",rememberPassword:"Remember Password",confirmPassword:"Confirm Password",submitLogin:"Enter Workspace",submitBootstrap:"Create Admin Account",bootstrapSuccess:"Bootstrap completed. You can log in now.",bootstrapMismatch:"The two passwords do not match.",authUnavailable:"Host is unreachable right now. Check the server and try again.",logoutSuccess:"The current login state has been cleared.",demoBanner:"Demo environment — all account data is public and cleared on logout",demoSessionExpired:"Demo session expired. Please log in again.",serverSettings:"Server Settings",serverSettingsTitle:"Server Configuration",saveServerSettings:"Save Settings"},settings:{title:"Settings",appearance:"Appearance",appearanceSectionSummary:"Language, theme, and interface colors",language:"Language",languageDescription:"Choose the display language used by the interface.",theme:"Theme",themeDescription:"Choose the color theme that fits the way you work.",fileManager:"File Manager",workspaceSessionSortMode:"Workspace session sort order",workspaceSessionSortModeDescription:"Controls the default sort order for session lists across the workspace. This setting only applies to the current device.",sessionSortModeCreatedAt:"By session created time",sessionSortModeUpdatedAt:"By session updated time",sessionSortModeTitle:"By session name",showSystemFiles:"Show system files",showSystemFilesDescription:"Display common macOS and Windows system files in the file manager, such as .DS_Store and Thumbs.db. This setting only applies to the current device.",serverConnection:"Server Connection",serverConnectionSectionSummary:"Server address and reconnection behavior",remoteAccess:"Remote Access",remoteAccessSectionSummary:"Check status and manage Tailscale remote access.",skills:"Skills",skillsSectionSummary:"Read and sync the local skills owned by each CLI. No marketplace and no remote catalog in this phase.",skillsNavValue:"Local sync",skillManagerTitle:"Local Skill Management",skillManagerDescription:"Read the local skill folders used by Codex, Claude Code, Gemini, and OpenCode, then import unmanaged entries or sync them again.",skillSummaryManagedSkills:"Managed skills",skillSummaryManagedEntries:"Managed folders",skillSummaryUnmanagedEntries:"Unmanaged folders",skillSummaryConflictedEntries:"Conflicts",skillSummaryDiagnostics:"Diagnostics",skillManageAction:"Configure Skills",skillConfigModalTitle:"Skill Configuration",skillConfigModalDescription:"Review managed, unmanaged, conflicted, and diagnostic results here, then import or sync as needed.",skillRefresh:"Refresh Overview",skillRefreshSuccess:"Skill overview refreshed.",skillScannedAt:"Last Scanned",skillManagedListTitle:"Managed Skills",skillManagedEmpty:"There are no managed skills yet.",skillUnmanagedListTitle:"Unmanaged Skills",skillUnmanagedEmpty:"No unmanaged skills were found.",skillConflictedListTitle:"Conflicts",skillConflictedEmpty:"No conflicted entries were found.",skillDiagnosticsTitle:"Diagnostics",skillDiagnosticsEmpty:"No extra diagnostics right now.",skillDirectoryName:"Directory Name",skillSsotPath:"SSOT Path",skillSourceCli:"Source CLI",skillDirectoryPath:"Directory Path",skillImportAction:"Import & Manage",skillImportSuccess:"{name} was imported and is now managed from {target}.",skillSyncAction:"Sync Again",skillSyncSuccess:"{name} was synced again.",skillSyncTargetMissing:"This skill is not bound to any target CLI yet, so it cannot be synced again.",skillLoadFailed:"Failed to load the skill overview.",skillTargetCodex:"Codex",skillTargetClaudeCode:"Claude Code",skillTargetGemini:"Gemini",skillTargetOpenCode:"OpenCode",skillBindingPending:"Pending",skillBindingSynced:"Synced",skillBindingFailed:"Failed",skillBindingConflicted:"Conflicted",securityPrivacy:"Security & Privacy",securityPrivacySectionSummary:"Session permissions, risk boundaries, and default approval policy",softwareUpdate:"Software Update",softwareUpdateSectionSummary:"Server and client versions",serverAddress:"Server Address",serverDescription:"Login, API requests, and realtime connections all use this Host entry, while the frontend UI is bundled inside the client itself.",tailscaleBrand:"Tailscale",tailscaleSectionTitle:"Tailscale Access",tailscaleSectionDescription:"Let this Host stay reachable across your devices with Tailscale.",tailscaleCurrentState:"Current State",tailscaleSwitchLabel:"Enabled",tailscaleStatusIndicator:"Status",tailscaleServerAddress:"Server Address",tailscaleAccountName:"Account",tailscaleIpAddress:"IP Address",tailscaleConfigure:"Configure",tailscaleConfigModalTitle:"Configure Tailscale",tailscaleConfigModalDescription:"Edit connectivity settings",tailscaleControlServer:"Control Server",tailscaleControlServerDescription:"Leave empty to use the default control server.",tailscaleControlServerPlaceholder:"Leave empty to use the default control server",tailscaleHostname:"Hostname",tailscaleHostnameDescription:"Optional.",tailscaleHostnamePlaceholder:"For example: codingns-host",tailscaleReachableBaseUrl:"Reachable Base URL",tailscaleTailnetFqdn:"Tailnet FQDN",tailscaleTailnetIpv4:"Tailnet IPv4",tailscaleTailnetIpv6:"Tailnet IPv6",tailscaleDetailAddresses:"Detailed Addresses",tailscaleRefresh:"Refresh",tailscaleInstallAction:"Install Tailscale",tailscaleInstallOpenFailed:"Failed to open the Tailscale install page.",tailscaleEnable:"Enable Tailscale",tailscaleDisable:"Disable Tailscale",tailscaleLogin:"Bind Account",tailscaleLogout:"Unbind Account",tailscaleUnavailable:"Unavailable",tailscaleLoadFailed:"Failed to load Tailscale status.",tailscalePhaseDisabled:"Disabled",tailscalePhaseBlockedUninitialized:"Blocked until bootstrap finishes",tailscalePhaseStarting:"Starting",tailscalePhaseNeedsLogin:"Waiting for login",tailscalePhaseRunning:"Running",tailscalePhaseStopping:"Stopping",tailscalePhaseError:"Error",tailscaleOverviewDisabled:"Remote access is not enabled yet.",tailscaleOverviewBlockedUninitialized:"Finish bootstrap before enabling remote access.",tailscaleOverviewStarting:"Connecting to Tailscale. Please wait.",tailscaleOverviewNeedsLogin:"Tailscale is enabled, but account binding is still required.",tailscaleOverviewRunning:"This instance is reachable through Tailscale now.",tailscaleOverviewStopping:"Remote access is being turned off.",tailscaleOverviewError:"Remote access hit an error. Refresh or reconfigure it first.",releaseChannel:"Release Channel",releaseChannelDescription:"Stable or beta",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"Auto Reconnect",autoReconnectDescription:"Retry HTTP and WebSocket links automatically when Host is briefly unavailable.",autoCheckUpdate:"Auto Check Client Updates",autoCheckUpdateDescription:"Clients only",defaultPermissionMode:"Default Session Permissions",defaultPermissionModeDescription:"Controls the default tool permissions for new and resumed sessions. Full access disables approval prompts and should only be used for trusted projects and environments.",permissionModeDefault:"Follow CLI defaults",permissionModeAcceptEdits:"Allow workspace edits without asking",permissionModeBypassPermissions:"Full access without asking",enabled:"Enabled",disabled:"Disabled",serverUpdate:"Server Update",serverUpdateDescription:"",clientUpdate:"Client Update",clientUpdateDescription:"",serverCurrentVersion:"Server Current Version",serverTargetVersion:"Server Target Version",serverPackageName:"npm Package",serverUpdateCommand:"Upgrade Command",serverCheckNow:"Check Server",serverOpenPage:"Open npm",serverLatestUnknown:"Unavailable",serverUpdateReady:"New version found",serverUpToDate:"Up to date",serverCheckFailed:"Check failed",serverOpenPageFailed:"Failed to open page",releaseCurrentVersion:"Current Version",releaseTargetVersion:"Target Version",releaseTargetTag:"Target Tag",releasePublishedAt:"Published At",releaseUnknownVersion:"Unknown",releaseNotes:"What's New",releaseNotesEmpty:"No details",releaseCheckNow:"Check Client",releaseInstallNow:"Install",releaseOpenPage:"Open Release",releaseRollback:"Rollback",releaseUpdateReady:"New version found",releaseUpToDate:"Up to date",releaseCheckFailed:"Check failed",releaseInstallerMissing:"A new version is available, but this release does not include a supported installer yet.",releaseSignatureMissing:"A new version is available, but this release does not provide checksum information yet.",releaseInstallStarted:"Install started",releaseInstallFailed:"Install failed",releasePageOpenFailed:"Failed to open page",releaseRollbackStarted:"Rollback started",releaseRollbackFailed:"Rollback failed",clientUpdateUnsupported:"Install updates are not supported here",logout:"Log out"},home:{title:"Continue from a session, not from a backend table",subtitle:"Pick a workspace and session here first. The real work starts in the next step.",terminalsEntry:"Open Terminal",workspaceSection:"Workspaces",sessionSection:"Recent Sessions",emptyWorkspaces:"No workspace has been imported yet. Import one on the Host side first, and the entry will appear here.",emptySessions:"There is no session to continue in the current workspace yet.",noActivity:"No activity yet"},terminal:{title:"Terminal",heroTitle:"Keep the real PTY on Host, keep the control surface in the workspace",heroSubtitle:"This page does not fake output and does not mix terminal with process management. It only consumes the real terminal stream managed by Host.",workspaceSection:"Workspace & Terminal",workspaceField:"Current Workspace",shellField:"Shell for New Terminal",runtimeField:"Runtime",runtimeAutoOption:"Auto",runtimeAutoShortLabel:"auto",runtimeAutoDescription:"Use the Host default policy for this terminal runtime.",runtimePersistentLabel:"Persistent Session",runtimePersistentShortLabel:"persist",runtimeTmuxDescription:"Use a persistent external session, ideal for development terminals that should stay alive.",runtimeWindowsPersistentDescription:"Use a Windows persistent session backed by ConPTY so the shell can survive Host restarts.",runtimeEmbeddedDescription:"Managed directly by the current Host and useful as the lightweight fallback.",runtimeConptyPowerShellLabel:"PowerShell Persistent",runtimeConptyCmdLabel:"CMD Persistent",runtimeConptyGitBashLabel:"Git Bash Persistent",runtimeMissingDialogTitle:"tmux is not installed on this system",runtimeMissingDialogDescription:"The tmux runtime cannot create a persistent terminal right now. Install tmux first, or temporarily switch to embedded-pty to continue.",runtimeMissingInstallDescription:"Installing tmux is recommended if you want terminals to survive Host restarts.",runtimeMissingInstallMacArm:"macOS (Apple Silicon / Homebrew): arch -arm64 brew install tmux",runtimeMissingInstallMacIntel:"macOS (Intel Mac / Homebrew): brew install tmux",runtimeMissingInstallDebian:"Ubuntu / Debian: sudo apt install tmux",runtimeMissingInstallFedora:"Fedora: sudo dnf install tmux",runtimeMissingFallbackDescription:"If you switch to embedded-pty now, the terminal can still start, but it will not stay as an external persistent session.",runtimeMissingKeepAction:"Not now",runtimeMissingFallbackAction:"Switch to embedded-pty",runtimeMissingFallbackPending:"Switching...",shellUnavailable:"Unavailable",workspaceLoadFailed:"The workspace or terminal list is not available right now.",terminalSection:"Terminal Instances",templateSection:"Command Templates",stageEmptyTitle:"No terminal selected yet",stageEmptySubtitle:"Create a terminal first, or run a command template.",emptyTerminals:"There is no terminal instance in the current workspace yet.",emptyTemplates:"There is no command template in the current workspace yet.",createButton:"Create Terminal",creating:"Creating terminal...",creationPendingDescription:"Host is starting the real PTY. This pane will take over as soon as the stream is ready.",defaultTerminalName:"Workspace Terminal",created:"The terminal has been created and connected to Host.",createFailed:"Failed to create terminal.",closeButton:"Close Terminal",closing:"Closing terminal...",closed:"The terminal close request has been submitted.",closeCompleted:"Terminal closed.",closePendingDescription:"The close request has been sent to Host. The page stays responsive and keeps syncing the final result in the background.",closeSyncDelayed:"Host is still finishing the close in the background. The list will keep syncing on the next refresh.",closeFailed:"Failed to close terminal.",inputLabel:"Send command to current terminal",inputPlaceholder:"For example: npm test",sendButton:"Send to Terminal",inputFailed:"Failed to send terminal input.",outputEmpty:"The terminal is connected, but there is no output yet.",outputTruncated:"Some output exceeded the cache window while disconnected. Only the retained part has been restored.",connectedHint:"Current output is coming from the real PTY stream on Host.",moreActions:"Terminal Actions",duplicateAction:"Duplicate Tab",duplicateSuccess:"A new terminal tab has been created with the same setup.",duplicateFailed:"Failed to duplicate the terminal tab.",disconnectAction:"Disconnect",disconnected:"Terminal connection has been disconnected.",reconnectAction:"Reconnect",reconnectRequested:"Reconnect request sent.",deleteAction:"Delete",deleting:"Deleting terminal...",deleted:"Terminal record deleted.",deletePendingDescription:"The delete request has been sent to Host. The page stays responsive and keeps syncing the list in the background.",deleteSyncDelayed:"Host is still finishing the delete in the background. The list will keep syncing on the next refresh.",deleteFailed:"Failed to delete the terminal record.",closePendingBadge:"Closing",deletePendingBadge:"Deleting",pinAction:"Pin",unpinAction:"Unpin",zoomLabel:"Terminal Zoom",zoomInAction:"Zoom in terminal display",zoomOutAction:"Zoom out terminal display",zoomResetAction:"Reset terminal zoom",toolbarToggleAction:"Open terminal toolbar",mobileSwipeHint:"Swipe left or right to switch terminals",mobileSwipePosition:"{current} / {total}",mobileDrawerAction:"Open quick terminal list",mobileDrawerTitle:"Quick Terminals",mobileDrawerDescription:"Swipe right to reveal the list, then tap to jump to another terminal.",mobilePinnedSectionTitle:"Pinned Terminals",mobileDrawerEmptyTitle:"No terminals yet",mobileDrawerEmptyDescription:"Create one first and the quick switcher will appear here.",mobileCreateSheetTitle:"Create Terminal",mobileCreateShellLabel:"Terminal Type",mobileCreateShellDescription:"Pick the shell for this terminal instead of squeezing desktop dropdowns onto mobile.",mobileCreateRuntimeLabel:"Session Type",mobileCreateRuntimeDescription:"Choose whether this terminal should stay persistent or only live in the current runtime.",mobileCreateLoadingShells:"Loading available terminal types for this system...",mobileCreateConfirm:"Create this terminal",createDialogTitle:"Create Terminal",createDialogShellDescription:"Choose the shell for this terminal before creation. On Windows we should not silently fall back to CMD anymore.",createDialogRuntimeDescription:"Choose whether this terminal should stay persistent or only live in the current runtime.",createDialogConfirm:"Create Terminal",mobileRuntimePersistentTitle:"Persistent Session",mobileRuntimePersistentDescription:"Best for development terminals that should stay alive and reconnect as a recoverable session.",mobileRuntimeSessionTitle:"runtime (current session)",mobileRuntimeSessionDescription:"Managed directly by the current Host. Lighter, but not an external persistent session.",mobileWorkspaceSwitcherPlaceholder:"Choose Workspace",mobileEmptyTitle:"No terminal content yet",mobileEmptyDescription:"Create a terminal first, or swipe right to open the quick list and switch to an existing one.",layoutLabel:"Layout",layoutSingleAction:"Single pane",layoutVerticalAction:"Split left and right",layoutHorizontalAction:"Split top and bottom",saveLogAction:"Save Log",saveLogSuccess:"The terminal log has been saved.",saveLogFailed:"Failed to save the terminal log.",logEmpty:"There is no terminal log to save yet.",bindToPaneAction:"Bind to current pane",bindToPrimaryPaneAction:"Bind to main pane",bindToSecondaryPaneAction:"Bind to side pane",panePrimary:"Main Pane",paneSecondary:"Side Pane",splitEmptySubtitle:"Pick a tab or create a terminal first, then bind it to this pane.",statusBadge:{creating:"starting",running:"running",closed:"closed",error:"error"},recoveryComplete:"Recovered to the terminal from before refresh. Key cached output has been restored.",recoveryTruncated:"Recovered to the previous terminal, but some disconnected output exceeded the cache window.",recoveryIdleClosed:"The previous terminal was auto-closed by Host after being idle too long. You are seeing the output kept before close.",reconnect:"Reconnect",liveConnected:"Live stream connected",templateName:"Template Name",templateCommand:"Main Command",templateArgs:"Arguments (space separated)",templateCreateButton:"Save Template",templateCreated:"The command template has been saved.",templateCreateFailed:"Failed to save the command template.",templateRunSent:"The command template has been sent to the current terminal.",templateRunCreatedTerminal:"The command template started in a new terminal.",templateRunFailed:"Failed to run the command template.",connection:{connected:"Connected",reconnecting:"Reconnecting",reconnect_failed:"Reconnect failed",closed:"Closed"}},conversation:{titleFallback:"Continue Conversation",historyLoading:"Loading message history from Host...",historyLoadingOlder:"Loading older messages...",historyLoadFailed:"Message history is not available right now. Try again later.",timelineEmpty:"There are no messages in this session yet. Your first message will go straight into the Host chain.",scrollToBottomAction:"Jump to bottom",rawRefLabel:"Source",copyAction:"Copy",copyContentSuccess:"Content copied.",copyContentFailed:"Failed to copy the content.",selectionTodoAction:"Todo",selectionActionButton:"Action",selectionActionSubmit:"Open action child session",selectionActionPromptLabel:"What should it do",selectionActionPromptPlaceholder:"For example: explain this, turn it into notes, or send it to a specific API",selectionActionIncludeContext:"Include current context",selectionActionContextUnavailable:"This selection spans multiple messages, so context inheritance is disabled for safety.",selectionActionDefaultPrompt:"Please process this content.",selectionActionQuotedLabel:"Selected text",selectionActionFailed:"Failed to create the action child session.",actionSessionBadge:"Action",actionInheritedSelectionSummary:'Collapsed the selected text from "{parentTitle}" by default.',forkFromHereAction:"Fork from here",forkingAction:"Forking...",forkMessageSucceeded:"Created a new branch from this message.",forkMessageFailed:"Failed to fork from this message.",forkDraftLabel:"Fork Quote",forkDraftEmpty:"This message does not contain text to quote.",forkDraftClear:"Cancel this fork quote",forkTargetProviderLabel:"Target CLI",forkTargetModelLabel:"Target Model",forkTargetSummary:"Source CLI: {sourceProvider} · Target CLI: {targetProvider}",forkInlineModelLoading:"Loading model options...",forkInlineNativeHint:"Stay on the same CLI and use native fork.",forkInlineCrossHint:"Switched to another CLI. The child session will be reconstructed from text history.",forkSwitchConfirmTitle:"Switch to another CLI?",forkSwitchConfirmDescription:"Using the same CLI keeps the native fork experience. Switching CLI changes this into a cross-provider fork.",forkSwitchConfirmKeepTitle:"Will keep",forkSwitchConfirmKeepBody:"User messages and assistant text before the fork point.",forkSwitchConfirmConvertTitle:"Will convert",forkSwitchConfirmConvertBody:"Reusable text history will be rebuilt into the new CLI session.",forkSwitchConfirmDropTitle:"Will lose",forkSwitchConfirmDropBody:"Tool calls, permission prompts, attachments, and running state.",forkSwitchConfirmAction:"Confirm switch",forkSwitchKeepNative:"Keep native",forkProviderNativeUnsupported:"This provider does not support native fork yet",forkProviderReconstructedUnsupported:"This provider cannot be used as a cross-provider fork target yet",loadMore:"Load More",composerPlaceholder:"State the next step clearly. Let the rest continue inside this session.",sendButton:"Send Message",queueTitle:"Queued Messages",queueDescription:"After the current run finishes, these messages will be processed automatically in order.",queueOrderPrefix:"Queue Position",queueStatusQueued:"Queued",queueStatusFailed:"Dispatch Failed",queueDelete:"Delete",queueDeleting:"Deleting",queueImageOnly:"Image attachments only",sendGuidanceButton:"Add Guidance",queueGuidanceButton:"Queue Guidance",queueSteer:"Steer",queueSteering:"Steering",resendButton:"Resend",quickPhraseTrigger:"Quick Phrases",quickPhraseModalTitle:"Quick Phrases",quickPhraseModalDescription:"Keep the prompts you reuse often in one place and drop them straight into the current composer.",quickPhraseCreateLabel:"New Phrase",quickPhraseOpenCreateAction:"Add Phrase",quickPhraseCreateModalTitle:"Create Quick Phrase",quickPhraseCreateModalDescription:"Save a reusable prompt on its own so it is ready across devices whenever you need it.",quickPhraseCreatePlaceholder:"Write a phrase you want to reuse later.",quickPhraseCreateAction:"Add Phrase",quickPhraseListLabel:"Quick phrase list",quickPhraseEmpty:"There are no quick phrases yet. Add the first one you actually reuse.",quickPhraseOrderLabel:"Item {index}",quickPhraseMoveUp:"Move phrase up",quickPhraseMoveDown:"Move phrase down",quickPhraseDelete:"Delete phrase",quickPhraseSaveFailed:"Failed to save quick phrases. Try again later.",sendingState:"Sending",sentState:"Synced",failedState:"Send failed",contextUsageTitle:"Context Usage",contextUsageUnavailable:"Context usage is not available yet",contextUsageEstimated:"Window is estimated",contextUsageCachedTokens:"{count} cached",contextUsageSourceProviderLog:"window from provider log",contextUsageSourceProviderRuntime:"window from provider runtime",contextUsageSourceProviderConfig:"window from provider config",contextUsageSourceModelMap:"window from model map",headerWorkspace:"Workspace",headerProvider:"Provider",headerCapability:"Capability Summary",connectionConnected:"Connected",connectionReconnecting:"Reconnecting",connectionReconnectFailed:"Reconnect failed",connectionClosed:"Connection closed",runtimeErrorTitle:"Session run failed",permissionRequestSectionTitle:"Pending approvals",permissionRequestSectionDescription:"Provider-side approvals are unified here so you do not need to learn three different dialogs.",permissionRequestToastTitle:"Approval needed",permissionRequestReplyFailed:"Failed to reply to the approval request.",permissionRequestSubmitting:"Submitting...",permissionRequestReasonLabel:"Reason",permissionRequestCommandLabel:"Command",permissionRequestToolLabel:"Tool",permissionRequestCwdLabel:"Working directory",permissionRequestPathsLabel:"Related paths",permissionRequestPermissionsLabel:"Requested permissions",permissionRequestReadLabel:"Read",permissionRequestWriteLabel:"Write",permissionRequestNetworkLabel:"Network",permissionRequestQuestionsLabel:"Questions",permissionRequestDetailLabel:"Details",permissionRequestEmpty:"None",permissionRequestUnknown:"Unknown",permissionRequestKindCommand:"Command",permissionRequestKindFileChange:"File Change",permissionRequestKindPermissions:"Permissions",permissionRequestKindUserInput:"User Input",permissionRequestKindToolCall:"Tool Call",reconnectExplain:"The realtime link is broken. The system is replaying missing messages.",reconnectFailedExplain:"Automatic recovery failed. Retry manually, or reopen the session later.",capabilityDenied:"This action is not supported in the current session.",capabilitySendDisabled:"The current provider does not support sending new messages.",capabilityAttachmentDisabled:"This session does not support attachment input yet.",capabilityInterruptDisabled:"This session does not support interruption.",sidebarTitle:"Current Session Context",sidebarSubtitle:"This sidebar only keeps the minimum capability summary. It does not turn the page into an admin console.",reconnectButton:"Restore Realtime Sync",headerResumedAt:"Last Resumed",headerLastSyncAt:"Last Synced",historyPages:"History Pages",syncStatusIdle:"Sync Idle",syncStatusSyncing:"Syncing",syncStatusError:"Sync Error",capabilityResume:"Resumable",capabilitySend:"Send Enabled",capabilityInterrupt:"Interrupt Enabled",capabilityTools:"Tool Calls",attachmentsLabel:"Attachments",filePanelTitle:"File Manager",filePanelSubtitle:"File capabilities here only serve the current session. This is not a heavy IDE shell.",filePanelNoWorkspace:"There is no selected workspace yet. Browsing or attaching files is unavailable.",filePanelRefresh:"Refresh",filePanelCopyPath:"Copy Path",filePanelCopyAbsolutePath:"Copy Absolute Path",filePanelCopyRelativePath:"Copy Relative Path",filePanelCopyAbsolutePathSuccess:"Absolute path copied.",filePanelCopyRelativePathSuccess:"Relative path copied.",filePanelCopyPathFailed:"Failed to copy the path.",filePanelCopy:"Copy",filePanelCut:"Cut",filePanelPaste:"Paste",filePanelCopySelectionSuccess:"{count} item(s) copied. Paste them into a target folder.",filePanelCutSelectionSuccess:"{count} item(s) cut. Paste them into a target folder.",filePanelPasteSuccess:"{count} item(s) pasted.",filePanelPasteFailed:"Paste failed. Check the target folder and name conflicts.",filePanelSelectionCount:"{count} item(s) selected",filePanelClipboardCopyReady:"{count} item(s) ready to copy",filePanelClipboardCutReady:"{count} item(s) ready to move",filePanelOpenFile:"Open File",filePanelExpandDirectory:"Expand Folder",filePanelCollapseDirectory:"Collapse Folder",filePanelActionsMenu:"File Actions",filePanelSearchPlaceholder:"Enter a file name or path fragment",filePanelSearchButton:"Search",filePanelShowSearch:"Open Search",filePanelHideSearch:"Hide Search",filePanelSearchEmpty:"No matching files found.",filePanelSearchResults:"Search Results",filePanelSearchFailed:"File search failed. Try again later.",filePanelBrowse:"Workspace Files",filePanelCollapseCurrent:"Collapse Current",filePanelCollapseAll:"Collapse All",filePanelBackDirectory:"Go to Parent",filePanelEmptyDirectory:"There are no files to show in this directory.",filePanelRecentTitle:"Recently Opened",filePanelEmptyRecent:"There is no recently opened file yet.",filePanelContextTitle:"Attached Files",filePanelEmptyContexts:"No file is attached to the current session yet.",filePanelEditorTitle:"Preview & Editor",filePanelEditorPlaceholder:"This is a lightweight text editor, not a full IDE.",filePanelSelectHint:"Pick a file first from browse, search, or recent items.",filePanelUnsupported:"This file cannot be edited directly in the sidebar right now.",filePanelAttach:"Attach to Session",filePanelAttached:"Attached",filePanelDetach:"Detach",filePanelSave:"Save",filePanelSaving:"Saving...",filePanelLoadFailed:"Failed to load the file panel.",filePanelOpenFailed:"Failed to open the file.",filePanelSaveSuccess:"File saved.",filePanelSaveFailed:"Failed to save the file.",fileViewerHint:"Opened in {language} mode. Preview and save after editing are supported.",fileViewerModeLabel:"File View Mode",fileViewerPreview:"Preview",fileViewerCode:"Code",fileViewerEdit:"Edit",fileViewerPlainText:"Plain Text",fileViewerImage:"Image",fileViewerPdf:"PDF",fileViewerRefreshPreview:"Refresh",fileViewerRefreshFailed:"Failed to refresh the file preview.",fileViewerOpenExternal:"Open Externally",fileViewerOpenExternalFailed:"Failed to open the file externally.",fileViewerZoomIn:"Zoom In",fileViewerZoomOut:"Zoom Out",fileViewerFit:"Fit",fileViewerActualSize:"Actual Size",fileViewerFitWidth:"Fit Width",fileViewerPreviousPage:"Previous Page",fileViewerNextPage:"Next Page",fileViewerPageIndicator:"Page {page}",fileViewerSizeLabel:"Viewer Size",fileViewerSizeDefault:"Default",fileViewerSizeWide:"Wide",fileViewerSizeFull:"Full",fileViewerImageUnavailable:"The image preview is unavailable right now. Try refreshing or opening it externally.",fileViewerPdfUnavailable:"The PDF preview is unavailable right now. Try refreshing or opening it externally.",fileViewerEnterFullscreen:"Full Screen",fileViewerExitFullscreen:"Exit",fileViewerOpenInBrowser:"Open in Browser",fileViewerOpenInBrowserFailed:"Failed to open the browser preview.",fileViewerHtmlPreviewLoading:"Loading the HTML preview...",fileViewerHtmlPreviewUnavailable:"The HTML preview is unavailable right now. Switch to code view instead.",fileViewerHtmlPreviewFailed:"Failed to create the HTML preview link.",filePanelAttachSuccess:"The file has been attached to the current session.",filePanelAttachFailed:"Failed to attach the file.",filePanelDetachSuccess:"The file has been detached from the current session.",filePanelDetachFailed:"Failed to detach the file.",filePanelNewFile:"New File",filePanelNewDirectory:"New Directory",filePanelUpload:"Upload File",filePanelDownload:"Download File",filePanelUploadSuccess:"{name} uploaded.",filePanelUploadFailed:"Failed to upload the file.",filePanelDownloadSuccess:"Started downloading {name}.",filePanelDownloadFailed:"Failed to download the file.",filePanelDelete:"Delete",filePanelDeleting:"Deleting...",filePanelDeleteSuccess:"Deleted {name}.",filePanelDeleteConfirmTitle:"Confirm Deletion",filePanelDeleteConfirmDescription:"The selected item will be removed from this workspace immediately and cannot be undone.",filePanelDeleteSelectionConfirm:"Delete the selected {count} items?",filePanelDeleteSelectionSuccess:"Deleted {count} items.",filePanelRenameMove:"Rename / Move",filePanelMutateFailed:"File operation failed. Check the path and current state.",filePanelCreateFilePrompt:"Enter the relative path of the file to create",filePanelCreateDirectoryPrompt:"Enter the relative path of the directory to create",filePanelFilterChanges:"Changes Only",filePanelShowAll:"Show All",filePanelNoChanges:"No changed files.",filePanelBinaryPreview:"Binary files cannot be previewed.",filePanelDeleteFileConfirm:"Delete this file? {path}",filePanelDeleteDirectoryConfirm:"Delete this folder? {path}",filePanelRenameMovePrompt:"Enter the new relative path",unavailableAction:"Unavailable",roleUser:"User",roleAssistant:"Assistant",roleTool:"Tool",roleSystem:"System"},git:{title:"Git Context",subtitle:"This is the session-side support area. It only handles Git facts inside the current workspace.",loading:"Loading Git context for the current workspace...",refresh:"Refresh",panelLoadFailed:"Git context is not available right now.",ahead:"Ahead",behind:"Behind",dirty:"Dirty",clean:"Clean",changeCount:"{count} changed files in the current workspace",noChanges:"There are no pending changes right now.",changesTitle:"Current Changes",rulesFirstHint:"Rules come first. Drafts must not bypass validation.",stage:"Stage",unstage:"Unstage",preview:"Preview",stageFailed:"Stage operation failed.",diffTitle:"Diff Preview",diffLoadFailed:"Diff content is not available right now.",binaryDiff:"This file is a binary change. The sidebar does not render its content directly.",stagedDiff:"Staged diff",worktreeDiff:"Working tree diff",emptyDiff:"There is no text diff to display right now.",diffTruncated:"The diff is too long and has been truncated for safety.",commitTitle:"Commit Draft",defaultRuleName:"Default Commit Rule",language:"Language",maxLength:"Max Length",bodyRequired:"Body Required",bodyOptional:"Body Optional",issueRequired:"Issue Required",issueOptional:"Issue Optional",commitSubject:"Commit Subject",commitSubjectPlaceholder:"Enter the commit message here",commitBody:"Commit Body",commitBodyPlaceholder:"Explain the change clearly. Do not write empty words.",commitFooter:"Commit Footer",commitFooterPlaceholder:"For example: Refs: #123",generateDraft:"AI Draft",validate:"Validate Draft",commit:"Commit",draftFailed:"Failed to generate the commit draft.",validateFailed:"Commit rule validation failed.",commitFailed:"Commit failed.",commitSuccess:"The commit has been written to the current repository.",validationPassed:"Rule validation passed. You can continue to commit.",validationFailed:"Rule validation failed. Fix the issues below first.",branchTitle:"Branch",branchPlaceholder:"Enter the branch name to switch to or create",switchBranch:"Switch",createBranch:"Create",branchFailed:"Branch operation failed.",historyTitle:"Recent History",historyHint:"Only keep the latest few entries here. This is not a graphical history tree.",noHistory:"There is no commit history to show right now.",viewAllVersions:"View All Versions",viewAllVersionsDescription:"Loaded commit history for the current repository. Total entries: {count}.",viewCommitChanges:"View Changed Files and DIFF",copyCommitMessage:"Copy Commit Message",copyCommitMessageSuccess:"The commit message has been copied.",copyCommitVersion:"Copy Git Version",copyCommitVersionSuccess:"The Git version has been copied.",commitDetailTitle:"Commit Detail",commitDetailDescription:"Showing the full change for commit {hash}.",commitDetailLoading:"Loading commit detail...",commitDetailEmpty:"There is no commit detail to show right now.",commitDetailLoadFailed:"The commit detail is not available right now.",commitVersionLabel:"Git Version",commitHashLabel:"Commit Hash",commitAuthorLabel:"Author",commitTimeLabel:"Commit Time",commitMessageLabel:"Commit Message",changedFilesTitle:"Changed Files",commitDiffLabel:"Commit DIFF",renamedFromLabel:"Renamed from {path}",explainCommitTitle:"Explain Commit Change",explainCommitDescription:"Choose a CLI provider first, then start a new session to analyze this commit.",explainCommitAction:"Explain Change",startExplainCommit:"Start Explaining",explainCommitStarted:"The explanation session has been created.",explainCommitFailed:"Failed to explain the commit change.",remoteTitle:"Remote Sync",remoteReady:"A remote is configured for the current repository.",remoteMissing:"The current repository has no remote configured yet.",fetch:"Fetch",pull:"Pull",push:"Push",pushNow:"Push Now",publish:"Publish",remoteFailed:"Remote sync failed.",remoteAuthAction:"Remote Auth",remoteAuthTitle:"Configure Remote Authentication",remoteAuthDescription:"Enter the username, password, or token to use for authenticated remote operations in this page session.",remoteAuthDescriptionGithub:"The current remote points to GitHub. For GitHub HTTPS Git operations, use a Personal Access Token (PAT) instead of your GitHub login password.",remoteAuthStatusLabel:"Authentication",remoteAuthConfigured:"Configured",remoteAuthNotConfigured:"Not Configured",remoteAuthGithubPatLabel:"Personal Access Token (PAT)",remoteAuthGithubPatPlaceholder:"Enter GitHub PAT",remoteAuthGithubUsernamePlaceholder:"Enter GitHub username",remoteAuthGithubPatHint:"GitHub does not support account passwords for Git HTTPS authentication. In basic mode, enter GitHub username + PAT. In token mode, you can paste the PAT directly.",remoteAuthRemember:"Remember On Host",remoteAuthSessionHint:"By default this only applies to the current page session. If you enable “Remember On Host”, the credential will be stored on the Host after a successful remote sync and reused later.",remoteAuthRememberHint:"When remember is enabled, this credential will be written to the Host after the remote sync succeeds.",remoteAuthSave:"Save Auth",remoteAuthSaved:"Remote authentication saved. Retry the remote sync now.",remoteAuthCleared:"Remote authentication for this page session has been cleared.",selectRemoteTitle:"Select Remote to Push",selectRemoteDesc:"Select remote repositories to push to. Multiple selection supported.",noRemotes:"No remote repositories are configured.",pushSelected:"Push ({count})",pushing:"Pushing…",pushAllSuccess:"Successfully pushed to {count} remote(s).",errors:{unauthorized:"The current login is no longer valid. Log in again and retry.",workspaceNotFound:"The workspace bound to the current session does not exist. Check whether it is still available.",invalidWorkspace:"The current workspace config is invalid. The Git sidebar must not operate outside the repo root.",notGitRepository:"The current workspace is not a Git repository. The Git sidebar will not fake a state.",repoNotFound:"No usable Git repository root was found for the current workspace.",pathOutOfWorkspace:"The Git target is outside the current workspace repository boundary. The operation was blocked.",invalidTarget:"The Git target path is invalid. Refresh the sidebar and try again.",notStaged:"The target file is not staged yet. Check the current change state first.",emptyStagedChanges:"The staging area is empty. Stage the changes before committing.",branchConflict:"The current branch has conflicts or is not a fast-forward update. Sync and resolve differences first.",branchNotFound:"The target branch does not exist. Check the branch name first.",remoteNotFound:"The current repository does not have a usable origin remote yet.",remoteAuthFailed:"Remote repository authentication failed. Check the current credentials first.",pushFailed:"Push failed. Check remote state and local commits first.",pullFailed:"Pull failed. Check the remote branch state first.",remoteFailed:"Remote sync failed. Check Git output and network state.",commitValidationFailed:"The commit draft has not passed validation yet. Fix validation issues first.",commandTimeout:"The Git operation timed out. Check repository state and network conditions."}},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"Theme"},locale:{zhCN:"Simplified Chinese",enUS:"English"}},ZE={common:{appName:"CodingNS",loading:"正在准备会话工作区…",retry:"重新尝试",back:"返回",save:"保存",close:"关闭",cancel:"取消",logout:"退出登录",unknown:"未命名会话"},auth:{loginTitle:"继续你的编码会话",loginSubtitle:"INITIALIZING DEVELOPMENT ENVIRONMENT...",serverPreset:"服务器列表",serverCustomOption:"使用自定义服务器",serverAddress:"服务器地址",serverPlaceholder:"例如:http://127.0.0.1:3002",serverHint:"登录、实时消息和终端都会连接到这里。客户端应填写 Host API 地址,例如 http://127.0.0.1:3002;4174、5173 这类前端开发端口不是给正式客户端直接连接的,只有代理和跨域都配好时才适合临时调试。",serverInvalid:"服务器地址无效,请检查后再试。",serverCurrent:"当前服务器",bootstrapTitle:"先完成首次初始化",bootstrapSubtitle:"这个 Host 还没有管理员账号,先创建一个最小登录入口。",username:"用户名",password:"密码",rememberPassword:"保存密码",confirmPassword:"确认密码",submitLogin:"进入工作台",submitBootstrap:"创建管理员账号",bootstrapSuccess:"初始化完成,现在可以登录了。",bootstrapMismatch:"两次输入的密码不一致。",authUnavailable:"暂时连不上 Host,请确认服务可访问。",logoutSuccess:"当前登录态已经清空。",demoBanner:"演示环境 — 所有账号数据公开可见,注销后自动清除",demoSessionExpired:"演示会话已过期,请重新登录",serverSettings:"服务器设置",serverSettingsTitle:"服务器配置",saveServerSettings:"保存设置"},settings:{title:"设置",appearance:"外观",appearanceSectionSummary:"语言、主题与界面配色",language:"语言",languageDescription:"选择界面显示语言,切换后立即应用到当前页面。",theme:"主题",themeDescription:"选择适合你的界面配色方案",fileManager:"文件管理",workspaceSessionSortMode:"工作区的会话显示排序方式",workspaceSessionSortModeDescription:"控制工作区里各处会话列表的默认排序,只影响当前设备。",sessionSortModeCreatedAt:"按照会话创建时间",sessionSortModeUpdatedAt:"按照会话更新时间",sessionSortModeTitle:"按照会话名称",showSystemFiles:"显示系统文件",showSystemFilesDescription:"在文件管理里显示 macOS 和 Windows 常见的系统文件,例如 .DS_Store、Thumbs.db。这个开关只影响当前设备。",serverConnection:"服务器连接",serverConnectionSectionSummary:"服务器地址与连接恢复策略",remoteAccess:"远程访问",remoteAccessSectionSummary:"查看状态并管理 Tailscale 远程访问。",skills:"Skills",skillsSectionSummary:"读取并同步各个 CLI 自己的本地 skill,不做市场,不接远端仓库。",skillsNavValue:"本地同步",skillManagerTitle:"本地 Skill 管理",skillManagerDescription:"统一读取 Codex、Claude Code、Gemini、OpenCode 的 skill 目录,支持导入未纳管项并重新同步。",skillSummaryManagedSkills:"受管 skill",skillSummaryManagedEntries:"已纳管目录",skillSummaryUnmanagedEntries:"未纳管目录",skillSummaryConflictedEntries:"冲突目录",skillSummaryDiagnostics:"诊断",skillManageAction:"SKILL配置",skillConfigModalTitle:"SKILL配置",skillConfigModalDescription:"这里统一查看受管、未纳管、冲突和诊断结果,并执行导入或重新同步。",skillRefresh:"刷新概况",skillRefreshSuccess:"Skill 概况已刷新。",skillScannedAt:"最近扫描",skillManagedListTitle:"已纳管 Skill",skillManagedEmpty:"当前还没有纳管中的 skill。",skillUnmanagedListTitle:"未纳管 Skill",skillUnmanagedEmpty:"当前没有发现未纳管的 skill。",skillConflictedListTitle:"冲突项",skillConflictedEmpty:"当前没有发现冲突项。",skillDiagnosticsTitle:"诊断",skillDiagnosticsEmpty:"当前没有额外诊断信息。",skillDirectoryName:"目录名",skillSsotPath:"统一存储目录",skillSourceCli:"来源 CLI",skillDirectoryPath:"目录路径",skillImportAction:"导入并纳管",skillImportSuccess:"已导入 {name},并纳管到 {target}。",skillSyncAction:"重新同步",skillSyncSuccess:"已重新同步 {name}。",skillSyncTargetMissing:"这个 skill 还没有绑定任何目标 CLI,暂时无法重新同步。",skillLoadFailed:"Skill 概况加载失败。",skillTargetCodex:"Codex",skillTargetClaudeCode:"Claude Code",skillTargetGemini:"Gemini",skillTargetOpenCode:"OpenCode",skillBindingPending:"待同步",skillBindingSynced:"已同步",skillBindingFailed:"同步失败",skillBindingConflicted:"内容冲突",securityPrivacy:"安全与隐私",securityPrivacySectionSummary:"会话权限、风险边界与默认授权策略",softwareUpdate:"软件更新",softwareUpdateSectionSummary:"服务端和客户端版本",serverAddress:"服务器地址",serverDescription:"客户端的登录、接口请求和实时连接都通过这个 Host 入口工作;前端界面资源由应用自身携带。",tailscaleBrand:"Tailscale",tailscaleSectionTitle:"Tailscale 接入",tailscaleSectionDescription:"让这台 Host 通过 Tailscale 在你的设备间可访问。",tailscaleCurrentState:"当前状态",tailscaleSwitchLabel:"启用开关",tailscaleStatusIndicator:"状态指示器",tailscaleServerAddress:"服务器地址",tailscaleAccountName:"账号名",tailscaleIpAddress:"IP 地址",tailscaleConfigure:"配置",tailscaleConfigModalTitle:"配置 Tailscale",tailscaleConfigModalDescription:"修改接入参数",tailscaleControlServer:"Control Server",tailscaleControlServerDescription:"留空时使用默认 control server。",tailscaleControlServerPlaceholder:"留空表示使用默认 control server",tailscaleHostname:"设备名称",tailscaleHostnameDescription:"可选。",tailscaleHostnamePlaceholder:"例如:codingns-host",tailscaleReachableBaseUrl:"外部访问地址",tailscaleTailnetFqdn:"Tailnet FQDN",tailscaleTailnetIpv4:"Tailnet IPv4",tailscaleTailnetIpv6:"Tailnet IPv6",tailscaleDetailAddresses:"详细地址",tailscaleRefresh:"刷新状态",tailscaleInstallAction:"安装 Tailscale",tailscaleInstallOpenFailed:"打开 Tailscale 安装页面失败。",tailscaleEnable:"启用 Tailscale",tailscaleDisable:"停用 Tailscale",tailscaleLogin:"开始绑定",tailscaleLogout:"解绑账号",tailscaleUnavailable:"暂不可用",tailscaleLoadFailed:"Tailscale 状态读取失败。",tailscalePhaseDisabled:"未启用",tailscalePhaseBlockedUninitialized:"实例未初始化,已阻断暴露",tailscalePhaseStarting:"正在启动",tailscalePhaseNeedsLogin:"等待绑定账号",tailscalePhaseRunning:"运行中",tailscalePhaseStopping:"正在停止",tailscalePhaseError:"状态异常",tailscaleOverviewDisabled:"当前还没有启用远程访问。",tailscaleOverviewBlockedUninitialized:"先完成初始化,再启用远程访问。",tailscaleOverviewStarting:"正在接入 Tailscale,请稍等。",tailscaleOverviewNeedsLogin:"启用完成后,还需要绑定账号。",tailscaleOverviewRunning:"当前实例已经可以通过 Tailscale 访问。",tailscaleOverviewStopping:"正在关闭远程访问。",tailscaleOverviewError:"远程访问状态异常,请先刷新或重新配置。",releaseChannel:"发布通道",releaseChannelDescription:"稳定版或测试版",releaseStable:"稳定版",releaseBeta:"测试版",autoReconnect:"自动重连",autoReconnectDescription:"当 Host 短暂不可达时,自动尝试恢复 HTTP 和 WebSocket 链路。",autoCheckUpdate:"自动检查客户端更新",autoCheckUpdateDescription:"仅客户端",defaultPermissionMode:"默认会话权限",defaultPermissionModeDescription:"控制新建和继续会话时默认使用的工具权限。完整权限会关闭询问,只适合你已经信任当前项目和运行环境时使用。",permissionModeDefault:"跟随 CLI 默认策略",permissionModeAcceptEdits:"允许编辑工作区,不询问",permissionModeBypassPermissions:"完整权限,不询问",enabled:"已启用",disabled:"已关闭",serverUpdate:"服务端更新",serverUpdateDescription:"",clientUpdate:"客户端更新",clientUpdateDescription:"",serverCurrentVersion:"服务端当前版本",serverTargetVersion:"服务端目标版本",serverPackageName:"npm 包名",serverUpdateCommand:"升级命令",serverCheckNow:"检查服务端",serverOpenPage:"打开 npm",serverLatestUnknown:"暂未获取",serverUpdateReady:"发现新版本",serverUpToDate:"已是最新版本",serverCheckFailed:"检查失败",serverOpenPageFailed:"打开页面失败",releaseCurrentVersion:"当前版本",releaseTargetVersion:"目标版本",releaseTargetTag:"目标 Tag",releasePublishedAt:"发布时间",releaseUnknownVersion:"未知",releaseNotes:"更新内容",releaseNotesEmpty:"暂无更新内容",releaseCheckNow:"检查客户端",releaseInstallNow:"安装更新",releaseOpenPage:"打开发布页",releaseRollback:"回退版本",releaseUpdateReady:"发现新版本",releaseUpToDate:"已是最新版本",releaseCheckFailed:"检查失败",releaseInstallerMissing:"有新版本,暂无安装包",releaseSignatureMissing:"有新版本,缺少校验信息",releaseInstallStarted:"安装已开始",releaseInstallFailed:"安装失败",releasePageOpenFailed:"打开页面失败",releaseRollbackStarted:"已开始回退",releaseRollbackFailed:"回退失败",clientUpdateUnsupported:"当前不支持安装更新",logout:"退出登录"},home:{title:"从一条会话继续,而不是从后台表格开始",subtitle:"这里先挑一个工作区和会话,真正的工作区在下一步。",terminalsEntry:"进入终端页",workspaceSection:"工作区",sessionSection:"最近会话",emptyWorkspaces:"还没有导入工作区。先在 Host 侧导入后,这里会出现入口。",emptySessions:"当前工作区还没有可继续的会话。",noActivity:"暂时还没有活动"},terminal:{title:"终端",heroTitle:"把真实 PTY 留在 Host,把操作入口留在工作台",heroSubtitle:"这里不伪造输出,不把终端和进程搅在一起,只消费 Host 统一托管的真实终端流。",workspaceSection:"工作区与终端",workspaceField:"当前工作区",shellField:"新终端使用的 Shell",runtimeField:"Runtime",runtimeAutoOption:"自动选择",runtimeAutoShortLabel:"auto",runtimeAutoDescription:"按 Host 默认策略选择当前终端 runtime。",runtimePersistentLabel:"持久会话",runtimePersistentShortLabel:"持久",runtimeTmuxDescription:"持久化外部会话,适合需要后台常驻的开发终端。",runtimeWindowsPersistentDescription:"使用基于 ConPTY 的 Windows 持久化会话,让终端在 Host 重启后仍可继续保留。",runtimeEmbeddedDescription:"由当前 Host 直接托管,适合作为轻量回退方案。",runtimeConptyPowerShellLabel:"PowerShell 持久会话",runtimeConptyCmdLabel:"CMD 持久会话",runtimeConptyGitBashLabel:"Git Bash 持久会话",runtimeMissingDialogTitle:"当前系统没有安装 tmux",runtimeMissingDialogDescription:"tmux runtime 无法继续创建持久化终端。你可以先安装 tmux,或者临时切换到 embedded-pty 继续。",runtimeMissingInstallDescription:"建议优先安装 tmux,这样终端才能在 Host 重启后继续保留。",runtimeMissingInstallMacArm:"macOS(Apple Silicon / Homebrew):arch -arm64 brew install tmux",runtimeMissingInstallMacIntel:"macOS(Intel Mac / Homebrew):brew install tmux",runtimeMissingInstallDebian:"Ubuntu / Debian:sudo apt install tmux",runtimeMissingInstallFedora:"Fedora:sudo dnf install tmux",runtimeMissingFallbackDescription:"如果现在先切到 embedded-pty,本次终端可以继续创建,但它不会作为外部持久会话保留。",runtimeMissingKeepAction:"先不切换",runtimeMissingFallbackAction:"切换到 embedded-pty 并继续",runtimeMissingFallbackPending:"正在切换…",shellUnavailable:"当前不可用",workspaceLoadFailed:"工作区或终端列表暂时没有拉回来。",terminalSection:"终端实例",templateSection:"命令模板",stageEmptyTitle:"还没有选中终端",stageEmptySubtitle:"先创建一个终端,或者运行一个命令模板。",emptyTerminals:"当前工作区还没有终端实例。",emptyTemplates:"当前工作区还没有命令模板。",createButton:"新建终端",creating:"正在创建终端…",creationPendingDescription:"Host 正在启动真实 PTY,连上以后这个窗口会立刻接管显示。",defaultTerminalName:"工作终端",created:"终端已经创建并接入 Host。",createFailed:"终端创建失败。",closeButton:"关闭终端",closing:"正在关闭终端…",closed:"终端关闭请求已经提交。",closeCompleted:"终端已关闭。",closePendingDescription:"关闭请求已经发给 Host,前台不会阻塞,系统会继续同步最终结果。",closeSyncDelayed:"Host 还在后台处理关闭,列表会在后续刷新时继续同步。",closeFailed:"终端关闭失败。",inputLabel:"向当前终端发送命令",inputPlaceholder:"例如:pnpm test",sendButton:"发送到终端",inputFailed:"终端输入发送失败。",outputEmpty:"终端已经连上,但暂时还没有输出。",outputTruncated:"断线期间有一段输出超出缓存窗口,当前只补回了仍保留的部分。",connectedHint:"当前输出来自 Host 真实 PTY 流。",moreActions:"终端操作",duplicateAction:"复制标签",duplicateSuccess:"已按当前终端配置新建一个标签。",duplicateFailed:"复制终端标签失败。",disconnectAction:"断开",disconnected:"终端连接已断开。",reconnectAction:"重连",reconnectRequested:"终端重连请求已发出。",deleteAction:"删除",deleting:"正在删除终端…",deleted:"终端记录已删除。",deletePendingDescription:"删除请求已经发给 Host,前台不会阻塞,系统会在后台继续同步列表。",deleteSyncDelayed:"Host 还在后台处理删除,列表会在后续刷新时继续同步。",deleteFailed:"终端记录删除失败。",closePendingBadge:"关闭中",deletePendingBadge:"删除中",pinAction:"固定",unpinAction:"取消固定",zoomLabel:"终端缩放",zoomInAction:"放大终端显示",zoomOutAction:"缩小终端显示",zoomResetAction:"恢复默认缩放",toolbarToggleAction:"展开终端工具栏",mobileSwipeHint:"左右滑动切换终端",mobileSwipePosition:"{current} / {total}",mobileDrawerAction:"打开快捷终端列表",mobileDrawerTitle:"快捷终端",mobileDrawerDescription:"右滑呼出列表,点一下就切到别的终端。",mobilePinnedSectionTitle:"已固定终端",mobileDrawerEmptyTitle:"当前还没有终端",mobileDrawerEmptyDescription:"先新建一个终端,这里才会出现可切换的列表。",mobileCreateSheetTitle:"新建终端",mobileCreateShellLabel:"终端类型",mobileCreateShellDescription:"先选这次要开的 Shell,别把桌面端那套下拉框搬到手机上。",mobileCreateRuntimeLabel:"会话方式",mobileCreateRuntimeDescription:"再决定它是持久保留,还是只作为当前 runtime 会话。",mobileCreateLoadingShells:"正在读取当前系统可用的终端类型…",mobileCreateConfirm:"创建这个终端",createDialogTitle:"新建终端",createDialogShellDescription:"先选这次要开的 Shell,再创建终端。Windows 下不再偷偷按默认值直接起。",createDialogRuntimeDescription:"再决定它是持久保留,还是只作为当前 runtime 会话。",createDialogConfirm:"创建终端",mobileRuntimePersistentTitle:"持久会话",mobileRuntimePersistentDescription:"适合需要一直挂着的开发终端,创建后会作为可恢复会话保留。",mobileRuntimeSessionTitle:"runtime(当前会话)",mobileRuntimeSessionDescription:"直接由当前 Host 托管,创建更轻,但不会保留成外部持久会话。",mobileWorkspaceSwitcherPlaceholder:"选择项目",mobileEmptyTitle:"这里还没有终端内容",mobileEmptyDescription:"先新建一个终端,或者右滑呼出快捷列表,切到当前工作区已有的终端。",layoutLabel:"分栏布局",layoutSingleAction:"单栏显示",layoutVerticalAction:"左右分栏",layoutHorizontalAction:"上下分栏",saveLogAction:"保存日志",saveLogSuccess:"终端日志已保存。",saveLogFailed:"终端日志保存失败。",logEmpty:"当前终端还没有可保存的日志内容。",bindToPaneAction:"绑定到当前分栏",bindToPrimaryPaneAction:"绑定到主分栏",bindToSecondaryPaneAction:"绑定到副分栏",panePrimary:"主分栏",paneSecondary:"副分栏",splitEmptySubtitle:"先点一个标签,或者新建一个终端,把它绑定到当前分栏。",statusBadge:{creating:"启动中",running:"运行中",closed:"已关闭",error:"异常"},recoveryComplete:"已回到刷新前的终端,缓存内的关键输出已经补回。",recoveryTruncated:"已恢复到上一个终端,但断线期间的部分输出已经超出缓存窗口。",recoveryIdleClosed:"上一个终端已因空闲超时被 Host 自动关闭,你现在看到的是关闭前保留的输出。",reconnect:"手动重连",liveConnected:"实时流已接入",templateName:"模板名称",templateCommand:"主命令",templateArgs:"参数(空格分隔)",templateCreateButton:"保存模板",templateCreated:"命令模板已经保存。",templateCreateFailed:"命令模板保存失败。",templateRunSent:"命令模板已经发送到当前终端。",templateRunCreatedTerminal:"命令模板已在新终端中启动。",templateRunFailed:"命令模板执行失败。",connection:{connected:"已连接",reconnecting:"正在重连",reconnect_failed:"重连失败",closed:"已关闭"}},conversation:{titleFallback:"继续对话",historyLoading:"正在从 Host 拉取消息历史…",historyLoadingOlder:"正在加载更早的消息…",historyLoadFailed:"历史消息暂时没有拉回来,可以稍后再试。",timelineEmpty:"这条会话还没有消息。你发出的第一句话会直接进入 Host 链路。",scrollToBottomAction:"回到底部",rawRefLabel:"来源",copyAction:"复制",copyContentSuccess:"内容已复制。",copyContentFailed:"内容复制失败。",selectionTodoAction:"代办",selectionActionButton:"操作",selectionActionSubmit:"新开操作子会话",selectionActionPromptLabel:"你想让它做什么",selectionActionPromptPlaceholder:"比如:解释这段话、整理成笔记,或调用指定接口处理它",selectionActionIncludeContext:"包含当前上下文",selectionActionContextUnavailable:"当前选区跨了多条消息,没法安全继承上下文,只能按无上下文新建子会话。",selectionActionDefaultPrompt:"请处理这段内容。",selectionActionQuotedLabel:"选中文本",selectionActionFailed:"创建操作子会话失败。",actionSessionBadge:"操作",actionInheritedSelectionSummary:"已默认折叠来自“{parentTitle}”的一段选中文本。",forkFromHereAction:"从这里分叉",forkingAction:"正在分叉…",forkMessageSucceeded:"已从这条消息创建新分支。",forkMessageFailed:"从这条消息分叉失败。",forkDraftLabel:"分叉引用",forkDraftEmpty:"这条消息没有可引用的文本内容。",forkDraftClear:"取消这次分叉引用",forkTargetProviderLabel:"目标 CLI",forkTargetModelLabel:"目标模型",forkTargetSummary:"源 CLI:{sourceProvider} · 目标 CLI:{targetProvider}",forkInlineModelLoading:"正在读取模型列表…",forkInlineNativeHint:"保持同一 CLI,继续走原生分叉。",forkInlineCrossHint:"已切到不同 CLI,将按文本历史重建新会话。",forkSwitchConfirmTitle:"切换到其他 CLI?",forkSwitchConfirmDescription:"同一 CLI 会尽量保留原生分叉体验;切到其他 CLI 会改成跨供应商分叉。",forkSwitchConfirmKeepTitle:"会保留",forkSwitchConfirmKeepBody:"分叉点之前的用户消息和助手文本。",forkSwitchConfirmConvertTitle:"会转换",forkSwitchConfirmConvertBody:"可继承文本会重建到新的 CLI 会话里。",forkSwitchConfirmDropTitle:"会丢失",forkSwitchConfirmDropBody:"工具调用、权限交互、附件和运行中状态。",forkSwitchConfirmAction:"确认切换",forkSwitchKeepNative:"保持原生",forkProviderNativeUnsupported:"当前 provider 还不支持原生 fork",forkProviderReconstructedUnsupported:"当前 provider 还不能作为跨 provider 分叉目标",loadMore:"加载更多消息",composerPlaceholder:"把下一步交代清楚,剩下的交给这条会话继续跑。",sendButton:"发送消息",queueTitle:"待发队列",queueDescription:"当前这轮结束后,队列里的消息会按顺序自动继续处理。",queueOrderPrefix:"队列序号",queueStatusQueued:"等待中",queueStatusFailed:"发送失败",queueDelete:"删除",queueDeleting:"删除中",queueImageOnly:"仅图片附件",sendGuidanceButton:"追加引导",queueGuidanceButton:"加入队列",queueSteer:"引导",queueSteering:"引导中",resendButton:"重试发送",quickPhraseTrigger:"快捷短语",quickPhraseModalTitle:"快捷短语",quickPhraseModalDescription:"这里集中管理你常用的会话指令,点一下就能直接填回当前输入框。",quickPhraseCreateLabel:"新增短语",quickPhraseOpenCreateAction:"新增短语",quickPhraseCreateModalTitle:"新增快捷短语",quickPhraseCreateModalDescription:"把常用指令单独存起来,后面在任何设备上都能直接复用。",quickPhraseCreatePlaceholder:"输入一条常用短语,保存后下次可以直接复用。",quickPhraseCreateAction:"添加短语",quickPhraseListLabel:"快捷短语列表",quickPhraseEmpty:"还没有可用的快捷短语,先加一条最常用的。",quickPhraseOrderLabel:"第 {index} 条",quickPhraseMoveUp:"上移短语",quickPhraseMoveDown:"下移短语",quickPhraseDelete:"删除短语",quickPhraseSaveFailed:"快捷短语保存失败,请稍后再试。",sendingState:"发送中",sentState:"已同步",failedState:"发送失败",contextUsageTitle:"当前上下文占用",contextUsageUnavailable:"当前上下文占用暂时不可用",contextUsageEstimated:"上限为估算值",contextUsageCachedTokens:"缓存命中 {count}",contextUsageSourceProviderLog:"上限来自 provider 运行日志",contextUsageSourceProviderRuntime:"上限来自 provider runtime",contextUsageSourceProviderConfig:"上限来自 provider 配置",contextUsageSourceModelMap:"上限来自模型映射",headerWorkspace:"工作区",headerProvider:"Provider",headerCapability:"能力摘要",connectionConnected:"已连接",connectionReconnecting:"正在重连",connectionReconnectFailed:"重连失败",connectionClosed:"连接已关闭",runtimeErrorTitle:"会话运行失败",reconnectExplain:"实时链路断开了,系统正在补回缺失消息。",reconnectFailedExplain:"自动恢复没有成功。你可以手动重试,或者稍后重新进入会话。",capabilityDenied:"当前会话不支持这个动作",capabilitySendDisabled:"当前 provider 不支持发送新消息",capabilityAttachmentDisabled:"当前会话还不支持附件输入",capabilityInterruptDisabled:"当前会话不支持中断运行",sidebarTitle:"当前会话上下文",sidebarSubtitle:"这里只保留最小能力摘要,不把页面做成后台控制台。",reconnectButton:"手动恢复实时同步",headerResumedAt:"最近续接",headerLastSyncAt:"最近同步",historyPages:"历史分页",syncStatusIdle:"同步空闲",syncStatusSyncing:"同步中",syncStatusError:"同步异常",capabilityResume:"可续接",capabilitySend:"可发送",capabilityInterrupt:"可中断",capabilityTools:"工具调用",attachmentsLabel:"附件",filePanelTitle:"文件管理",filePanelSubtitle:"这里的文件能力只服务当前会话,不把页面拉成重型 IDE。",filePanelNoWorkspace:"当前还没有选中项目,暂时不能浏览或挂载文件。",filePanelRefresh:"刷新",filePanelCopyPath:"复制路径",filePanelCopyAbsolutePath:"复制绝对路径",filePanelCopyRelativePath:"复制相对路径",filePanelCopyAbsolutePathSuccess:"绝对路径已复制。",filePanelCopyRelativePathSuccess:"相对路径已复制。",filePanelCopyPathFailed:"路径复制失败。",filePanelCopy:"复制",filePanelCut:"剪切",filePanelPaste:"粘贴",filePanelCopySelectionSuccess:"已复制 {count} 项,可到目标目录粘贴。",filePanelCutSelectionSuccess:"已剪切 {count} 项,可到目标目录粘贴。",filePanelPasteSuccess:"已粘贴 {count} 项。",filePanelPasteFailed:"粘贴失败,请检查目标目录和重名冲突。",filePanelSelectionCount:"已选 {count} 项",filePanelClipboardCopyReady:"剪贴板中有 {count} 个待复制项目",filePanelClipboardCutReady:"剪贴板中有 {count} 个待移动项目",filePanelOpenFile:"打开文件",filePanelExpandDirectory:"展开文件夹",filePanelCollapseDirectory:"折叠文件夹",filePanelActionsMenu:"文件操作",filePanelSearchPlaceholder:"输入文件名或路径片段",filePanelSearchButton:"搜索",filePanelShowSearch:"打开搜索",filePanelHideSearch:"收起搜索",filePanelSearchEmpty:"没有找到匹配的文件。",filePanelSearchResults:"搜索结果",filePanelSearchFailed:"文件搜索失败,请稍后再试。",filePanelBrowse:"工作区文件",filePanelCollapseCurrent:"折叠当前选中",filePanelCollapseAll:"全部折叠",filePanelBackDirectory:"返回上级",filePanelEmptyDirectory:"这个目录里暂时没有可显示的文件。",filePanelRecentTitle:"最近打开",filePanelEmptyRecent:"最近还没有打开记录。",filePanelContextTitle:"已挂载文件",filePanelEmptyContexts:"当前会话还没有挂载文件管理。",filePanelEditorTitle:"预览与编辑",filePanelEditorPlaceholder:"这里只做轻量文本编辑,不在这里做完整 IDE。",filePanelSelectHint:"先从目录、搜索或最近打开里选一个文件。",filePanelUnsupported:"这个文件当前不能在侧栏里直接编辑。",filePanelAttach:"挂到会话",filePanelAttached:"已挂载",filePanelDetach:"解绑",filePanelSave:"保存",filePanelSaving:"保存中",filePanelLoadFailed:"文件管理面板加载失败。",filePanelOpenFailed:"文件打开失败。",filePanelSaveSuccess:"文件已经保存。",filePanelSaveFailed:"文件保存失败。",fileViewerHint:"当前以 {language} 模式打开,支持预览与编辑保存。",fileViewerModeLabel:"文件查看模式",fileViewerPreview:"预览",fileViewerCode:"代码",fileViewerEdit:"编辑",fileViewerPlainText:"纯文本",fileViewerImage:"图片",fileViewerPdf:"PDF",fileViewerRefreshPreview:"刷新",fileViewerRefreshFailed:"文件预览刷新失败。",fileViewerOpenExternal:"外部打开",fileViewerOpenExternalFailed:"外部打开失败。",fileViewerZoomIn:"放大",fileViewerZoomOut:"缩小",fileViewerFit:"适配",fileViewerActualSize:"原始大小",fileViewerFitWidth:"适宽",fileViewerPreviousPage:"上一页",fileViewerNextPage:"下一页",fileViewerPageIndicator:"第 {page} 页",fileViewerSizeLabel:"查看器尺寸",fileViewerSizeDefault:"默认",fileViewerSizeWide:"加宽",fileViewerSizeFull:"铺满",fileViewerImageUnavailable:"当前无法显示图片预览,请尝试刷新或外部打开。",fileViewerPdfUnavailable:"当前无法显示 PDF 预览,请尝试刷新或外部打开。",fileViewerEnterFullscreen:"全屏",fileViewerExitFullscreen:"退出",fileViewerOpenInBrowser:"在浏览器中打开",fileViewerOpenInBrowserFailed:"打开浏览器预览失败。",fileViewerHtmlPreviewLoading:"正在加载 HTML 预览...",fileViewerHtmlPreviewUnavailable:"当前无法显示 HTML 预览,请先切到代码模式查看。",fileViewerHtmlPreviewFailed:"HTML 预览链接生成失败。",filePanelAttachSuccess:"文件已经挂到当前会话。",filePanelAttachFailed:"文件挂载失败。",filePanelDetachSuccess:"文件已经从当前会话解绑。",filePanelDetachFailed:"文件解绑失败。",filePanelNewFile:"新建文件",filePanelNewDirectory:"新建目录",filePanelUpload:"上传文件",filePanelDownload:"下载文件",filePanelUploadSuccess:"已上传 {name}。",filePanelUploadFailed:"文件上传失败。",filePanelDownloadSuccess:"已开始下载 {name}。",filePanelDownloadFailed:"文件下载失败。",filePanelDelete:"删除",filePanelDeleting:"删除中...",filePanelDeleteSuccess:"已删除 {name}。",filePanelDeleteConfirmTitle:"确认删除",filePanelDeleteConfirmDescription:"删除后会立即从当前项目移除,这一步不能撤销。",filePanelDeleteSelectionConfirm:"确认删除选中的 {count} 项吗?",filePanelDeleteSelectionSuccess:"已删除 {count} 项。",filePanelRenameMove:"重命名/移动",filePanelMutateFailed:"文件操作失败,请检查路径和当前状态。",filePanelCreateFilePrompt:"输入要创建的相对文件路径",filePanelCreateDirectoryPrompt:"输入要创建的相对目录路径",filePanelFilterChanges:"仅显示变更",filePanelShowAll:"显示全部",filePanelNoChanges:"当前没有变更文件。",filePanelBinaryPreview:"二进制文件不支持预览。",filePanelDeleteFileConfirm:"确认删除这个文件吗?{path}",filePanelDeleteDirectoryConfirm:"确认删除这个文件夹吗?{path}",filePanelRenameMovePrompt:"输入新的相对路径",unavailableAction:"当前不可用",roleUser:"你",roleAssistant:"助手",roleTool:"工具",roleSystem:"系统"},git:{title:"Git 上下文",subtitle:"这里是会话侧边的辅助区,只处理当前工作区里的 Git 事实。",loading:"正在读取当前工作区的 Git 上下文。",refresh:"刷新",panelLoadFailed:"Git 上下文暂时没有加载出来。",ahead:"领先",behind:"落后",dirty:"有改动",clean:"已干净",changeCount:"当前有 {count} 个变更文件",noChanges:"当前没有待处理改动。",changesTitle:"当前变更",rulesFirstHint:"规则先于生成,草稿不能绕过校验。",stage:"暂存",unstage:"取消暂存",preview:"预览",stageFailed:"暂存操作失败。",diffTitle:"差异预览",diffLoadFailed:"差异内容暂时没有拉回来。",binaryDiff:"这个文件是二进制改动,侧栏不直接展示内容。",stagedDiff:"暂存区 diff",worktreeDiff:"工作区 diff",emptyDiff:"当前没有可展示的文本差异。",diffTruncated:"差异内容过长,已经做了截断保护。",commitTitle:"提交草稿",defaultRuleName:"默认提交规则",language:"语言",maxLength:"长度",bodyRequired:"正文必填",bodyOptional:"正文可选",issueRequired:"Issue 必填",issueOptional:"Issue 可选",commitSubject:"提交标题",commitSubjectPlaceholder:"在这里输入提交信息",commitBody:"提交正文",commitBodyPlaceholder:"把这次改动说清楚,别写空话。",commitFooter:"提交脚注",commitFooterPlaceholder:"例如:Refs: #123",generateDraft:"AI 起草",validate:"校验草稿",commit:"执行提交",draftFailed:"提交草稿生成失败。",validateFailed:"提交规则校验失败。",commitFailed:"提交失败。",commitSuccess:"提交已经写入当前仓库。",validationPassed:"规则校验通过,可以继续提交。",validationFailed:"规则校验没有通过,先把下面的问题修掉。",branchTitle:"分支",branchPlaceholder:"输入要切换或创建的分支名",switchBranch:"切换",createBranch:"新建",branchFailed:"分支操作失败。",historyTitle:"最近历史",historyHint:"只放最近几条,不做图形历史树。",noHistory:"当前没有可展示的提交历史。",viewAllVersions:"查看所有版本",viewAllVersionsDescription:"这里展示当前仓库已加载的版本历史,共 {count} 条。",viewCommitChanges:"查看更改文件与 DIFF",copyCommitMessage:"复制提交信息",copyCommitMessageSuccess:"提交信息已复制。",copyCommitVersion:"复制 Git 版本号",copyCommitVersionSuccess:"Git 版本号已复制。",commitDetailTitle:"版本详情",commitDetailDescription:"当前查看提交 {hash} 的完整改动。",commitDetailLoading:"正在读取提交详情…",commitDetailEmpty:"当前没有可展示的提交详情。",commitDetailLoadFailed:"提交详情暂时没有拉回来。",commitVersionLabel:"Git 版本号",commitHashLabel:"提交 Hash",commitAuthorLabel:"作者",commitTimeLabel:"提交时间",commitMessageLabel:"提交信息",changedFilesTitle:"变更文件",commitDiffLabel:"提交 DIFF",renamedFromLabel:"从 {path} 重命名",explainCommitTitle:"解释版本更改",explainCommitDescription:"先选择一个 CLI 供应商,再新建会话分析这个提交。",explainCommitAction:"解释更改",startExplainCommit:"开始解释",explainCommitStarted:"解释会话已经创建。",explainCommitFailed:"解释更改失败。",remoteTitle:"远程同步",remoteReady:"当前仓库已配置远程。",remoteMissing:"当前仓库还没有远程。",fetch:"Fetch",pull:"Pull",push:"Push",pushNow:"立即推送",publish:"Publish",remoteFailed:"远程同步失败。",remoteAuthAction:"远程认证",remoteAuthTitle:"设置远程仓库认证",remoteAuthDescription:"需要认证的远程仓库,在这里填写本次页面会话使用的用户名、密码或 token。",remoteAuthDescriptionGithub:"检测到当前远程仓库来自 GitHub。GitHub 的 HTTPS Git 操作请使用 Personal Access Token (PAT),不要填写 GitHub 登录密码。",remoteAuthStatusLabel:"认证状态",remoteAuthConfigured:"已配置",remoteAuthNotConfigured:"未配置",remoteAuthGithubPatLabel:"Personal Access Token (PAT)",remoteAuthGithubPatPlaceholder:"输入 GitHub PAT",remoteAuthGithubUsernamePlaceholder:"输入 GitHub 用户名",remoteAuthGithubPatHint:"GitHub 不支持用账号密码做 Git HTTPS 认证。basic 模式请填写 GitHub 用户名 + PAT;token 模式可以直接填写 PAT。",remoteAuthRemember:"记住账号密码到 Host",remoteAuthSessionHint:"默认只在当前页面会话里生效;勾选“记住账号密码到 Host”后,远程同步成功时会写到 Host,后续自动复用。",remoteAuthRememberHint:"勾选记住后,本次远程同步成功时会把认证写到 Host。",remoteAuthSave:"保存认证",remoteAuthSaved:"远程仓库认证已保存,请重新执行同步。",remoteAuthCleared:"已清除当前页面会话里的远程认证设置。",selectRemoteTitle:"选择推送仓库",selectRemoteDesc:"勾选要推送到的远程仓库,支持多选。",noRemotes:"当前仓库没有配置任何远程仓库。",pushSelected:"推送 ({count})",pushing:"推送中…",pushAllSuccess:"已成功推送到 {count} 个远程仓库。",errors:{unauthorized:"当前登录态已经失效,请重新登录后再试。",workspaceNotFound:"当前会话绑定的工作区不存在,先确认工作区是否还可用。",invalidWorkspace:"当前工作区配置无效,Git 侧栏不能脱离仓库根目录执行。",notGitRepository:"当前工作区不是 Git 仓库,Git 侧栏不会伪造状态。",repoNotFound:"当前工作区找不到可用的 Git 仓库根目录。",pathOutOfWorkspace:"Git 目标超出了当前工作区仓库边界,操作已被拦截。",invalidTarget:"Git 目标路径无效,请先刷新侧栏后重试。",notStaged:"目标文件还不在暂存区里,先确认当前变更状态。",emptyStagedChanges:"暂存区为空,先把要提交的改动放进暂存区。",branchConflict:"当前分支存在冲突或不是快进更新,先同步并处理差异。",branchNotFound:"目标分支不存在,先确认分支名是否正确。",remoteNotFound:"当前仓库还没有可用的 origin 远程,先配置远程再同步。",remoteAuthFailed:"远程仓库认证失败,请先确认当前仓库凭据可用。",pushFailed:"推送失败,请先检查远程状态和本地提交。",pullFailed:"拉取失败,请先确认远程分支状态。",remoteFailed:"远程同步失败,请检查 Git 输出和网络状态。",commitValidationFailed:"提交草稿还没通过规则校验,先把校验问题修掉。",commandTimeout:"Git 操作超时了,先确认仓库状态和网络环境。"}}},eI=[{id:"zh-CN",labelKey:"locale.zhCN"},{id:"en-US",labelKey:"locale.enUS"}];function Lb({variant:e="default",className:t}){const r=Mo(a=>a.profile.language);function i(a){a!==r&&Eh({language:a}).catch(()=>{})}return n.jsxs("label",{className:`language-switcher language-switcher-${e}${t?` ${t}`:""}`,children:[n.jsx("span",{className:"language-switcher-label",children:o("common.language")}),n.jsx("div",{className:"language-switcher-options",role:"group","aria-label":o("common.language"),children:eI.map(a=>n.jsx("button",{type:"button",className:`language-switcher-option${r===a.id?" active":""}`,"aria-pressed":r===a.id,onClick:()=>i(a.id),children:o(a.labelKey)},a.id))})]})}const tI={common:{close:"关闭",cancel:"取消",logout:"退出登录",language:"语言"},locale:{zhCN:"简体中文",enUS:"English"},settings:{title:"设置",appearance:"外观",language:"语言",languageDescription:"选择界面显示语言,切换后立即应用到当前页面。",theme:"主题",themeDescription:"选择适合你的界面配色方案",connection:"连接与更新",serverAddress:"服务地址",serverDescription:"桌面端和 H5 都通过这个 Host 入口工作。",releaseChannel:"发布通道",releaseChannelDescription:"稳定版或测试版",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"自动重连",autoReconnectDescription:"当 Host 短暂不可达时,自动尝试恢复 HTTP 和 WebSocket 链路。",autoCheckUpdate:"自动检查客户端更新",autoCheckUpdateDescription:"仅客户端",notificationSettings:"通知",notificationSettingsDescription:"单独控制会话相关的系统通知提醒。",notifyOnPermissionRequest:"会话等待审批时通知",notifyOnPermissionRequestDescription:"后台会话出现新的权限申请时推送通知。",notifyOnSessionCompleted:"会话完成时通知",notifyOnSessionCompletedDescription:"后台会话变为已完成时推送通知。",notifyOnSessionFailed:"会话异常时通知",notifyOnSessionFailedDescription:"后台会话运行失败时推送通知。",enabled:"已启用",disabled:"已关闭",serverUpdate:"服务端更新",serverUpdateDescription:"",clientUpdate:"客户端更新",clientUpdateDescription:"",serverCurrentVersion:"服务端当前版本",serverTargetVersion:"服务端目标版本",serverPackageName:"npm 包名",serverUpdateCommand:"升级命令",serverCheckNow:"检查服务端",serverOpenPage:"打开 npm",serverLatestUnknown:"暂未获取",serverUpdateReady:"发现新版本",serverUpToDate:"已是最新版本",serverCheckFailed:"检查失败",serverOpenPageFailed:"打开页面失败",runtimePlatform:"当前运行平台",runtimePlatformDescription:"用来确认现在是 Web/H5、Desktop、iOS 还是 Android 运行环境。",platformDesktop:"Desktop",platformWeb:"Web",platformIos:"iOS",platformAndroid:"Android",releaseDesktopOnly:"当前是 Web/H5 运行环境,不支持桌面更新。",releaseCurrentVersion:"当前版本",releaseTargetVersion:"目标版本",releaseUnknownVersion:"未知",releaseNotes:"更新内容",releaseNotesEmpty:"暂无更新内容",releaseCheckNow:"检查客户端",releaseInstallNow:"安装更新",releaseRollback:"回退版本",releaseUpdateReady:"发现新版本",releaseUpToDate:"已是最新版本",releaseCheckFailed:"检查失败",releaseInstallStarted:"安装已开始",releaseInstallFailed:"安装失败",releaseRollbackStarted:"已开始回退",releaseRollbackFailed:"回退失败",clientUpdateUnsupported:"当前不支持安装更新",account:"账号",logout:"退出登录",logoutDescription:"退出当前账号并返回登录页面",advancedSettings:"高级设置",parallelTaskDebug:"并行任务调试",parallelTaskDebugDescription:"打开后才会启用运行时采样,用来实时看后台任务、调度器和主线程压力指标。",parallelTaskDebugAction:"打开调试面板",parallelTaskDebugModalTitle:"并行任务调试",parallelTaskDebugModalDescription:"这个窗口打开时才会继续采集任务活动和 event loop 指标,关掉后立即停止。",parallelTaskDebugClose:"关闭并行任务调试",parallelTaskDebugLoading:"正在建立观测会话并拉取快照…",parallelTaskDebugLoadFailed:"加载并行任务调试信息失败",parallelTaskDebugEmpty:"当前没有可展示的执行记录。",parallelTaskDebugStatusActive:"采集中",parallelTaskDebugStatusError:"采集异常",parallelTaskDebugObservedAt:"最后更新",parallelTaskDebugSessionExpireAt:"会话到期时间",parallelTaskDebugSessionTtl:"会话 TTL",parallelTaskDebugCollectorState:"采集器状态",parallelTaskDebugCollectorEnabled:"已启用",parallelTaskDebugCollectorDisabled:"未启用",parallelTaskDebugAutoRefresh:"每秒自动刷新",parallelTaskDebugCountersTitle:"总指标",parallelTaskDebugTaskMetricsTitle:"后台任务指标",parallelTaskDebugSchedulerTitle:"调度器指标",parallelTaskDebugEventLoopTitle:"Event Loop",parallelTaskDebugRecentActivitiesTitle:"最近执行记录",parallelTaskDebugWaitAvg:"平均等待",parallelTaskDebugRunAvg:"平均执行",parallelTaskDebugRunMax:"最长执行",parallelTaskDebugStartedCount:"启动次数",parallelTaskDebugFinishedCount:"完成次数",parallelTaskDebugFailedCount:"失败次数",parallelTaskDebugCacheHitCount:"缓存命中",parallelTaskDebugIdle:"空转",parallelTaskDebugBusy:"已命中任务",parallelTaskDebugTickTotal:"tick 总数",parallelTaskDebugIdleTickTotal:"空转 tick",parallelTaskDebugTaskCountTotal:"命中任务",parallelTaskDebugSchedulerErrorTotal:"异常次数",parallelTaskDebugLastDuration:"上次耗时",parallelTaskDebugNextDelay:"下次延迟",parallelTaskDebugEventLoopResolution:"采样粒度",parallelTaskDebugEventLoopMean:"平均延迟",parallelTaskDebugEventLoopP95:"P95 延迟",parallelTaskDebugEventLoopP99:"P99 延迟",parallelTaskDebugEventLoopMax:"最大延迟",parallelTaskDebugTaskKey:"任务 Key",parallelTaskDebugStatus:"状态",parallelTaskDebugAttempt:"尝试",parallelTaskDebugWaitMs:"等待",parallelTaskDebugRunMs:"执行",parallelTaskDebugSource:"来源",parallelTaskDebugError:"错误",parallelTaskDebugMetricEnqueue:"入队",parallelTaskDebugMetricDedupe:"去重",parallelTaskDebugMetricStarted:"已启动",parallelTaskDebugMetricFinished:"已完成",parallelTaskDebugMetricFailed:"失败",parallelTaskDebugMetricCancelled:"已取消",parallelTaskDebugMetricTimeout:"超时",parallelTaskDebugMetricCacheHit:"缓存命中",parallelTaskDebugLaneRequestMainThread:"请求主线程",parallelTaskDebugLaneHostBackground:"Host 后台",parallelTaskDebugLaneHelperProcess:"Helper 进程",parallelTaskDebugLaneExternalProcess:"外部进程",parallelTaskDebugEventEnqueued:"入队",parallelTaskDebugEventDeduped:"去重复用",parallelTaskDebugEventStarted:"开始",parallelTaskDebugEventFinished:"完成",parallelTaskDebugEventFailed:"失败",parallelTaskDebugEventCancelled:"取消",parallelTaskDebugEventTimeout:"超时",parallelTaskDebugEventCacheHit:"命中缓存",parallelTaskDebugTaskStatusQueued:"排队中",parallelTaskDebugTaskStatusRunning:"运行中",parallelTaskDebugTaskStatusSucceeded:"已成功",parallelTaskDebugTaskStatusFailed:"已失败",parallelTaskDebugTaskStatusCancelled:"已取消",parallelTaskDebugTaskStatusTimeout:"已超时"},shell:{title:"工作台",subtitle:"管理代码项目里的 AI 会话",mobileWorkspacesEntry:"工作区",mobileTerminalsEntry:"终端",mobileSessionsEntry:"对话",mobileToolsEntry:"工具",mobileSettingsEntry:"设置",mobileNavigationAction:"打开工作台菜单",mobileSearchAction:"打开搜索",mobileAuxiliaryAction:"打开工具面板",mobileRevealNavigationAction:"显示主导航",mobileHideNavigationAction:"收起主导航",mobileConversationPreviewTitle:"快速预览",mobileConversationCurrentWorkspaceSection:"当前工作区",mobileConversationCollapsePreviewAction:"收起预览",mobileConversationRestorePreviewAction:"恢复会话预览",iosMoreAction:"更多操作",androidMoreAction:"更多操作",conversationEntry:"对话",terminalsEntry:"终端",butlerEntry:"助手",globalNotificationsAction:"通知",globalNotificationsUnreadAria:"未读通知 {count}",globalNotificationsPanelTitle:"通知中心",globalNotificationsPanelDescription:"这里集中看需要你拍板、跟进完成、跟进失败和验证失败的提醒。",globalNotificationsEmpty:"当前没有新的全局通知。",globalNotificationsShowArchived:"显示已归档通知",globalNotificationsArchiveAction:"归档",globalNotificationsRemoveArchiveAction:"移除归档",globalNotificationsArchiveFailed:"通知归档更新失败",globalNotificationKindWaitingUser:"等待你决定",globalNotificationKindFollowUpFailed:"跟进失败",globalNotificationKindFollowUpCompleted:"跟进完成",globalNotificationKindVerificationFailed:"验证失败",globalNotificationFollowUpWaitingTitle:"需要你决定:{title}",globalNotificationFollowUpFailedTitle:"跟进失败:{title}",globalNotificationFollowUpCompletedTitle:"跟进完成:{title}",globalNotificationVerificationFailedTitle:"验证失败:{title}",globalNotificationVerificationFailedFallback:"最近一次验证没有通过,请尽快查看。",searchEntry:"搜索",butlerInitTitle:"初始化代码助手",butlerInitDescription:"先设置助手的称呼、provider 和工作方式。助手工作目录和第一版 AGENTS.md 会由系统自动创建。",butlerInitPreviewTitle:"当前预览",butlerInitPreviewDescription:"这不是花架子,下面这些选择会直接决定首版规则的语气和汇报方式。",butlerInitBasicsTitle:"基础设置",butlerInitBasicsDescription:"先把名字、provider 和规则载体定下来,别让初始化阶段长成配置地狱。",butlerInitPersonaTitle:"表达方式",butlerInitPersonaDescription:"语气、语言和总结风格决定它怎么说,不决定它会不会胡来。",butlerInitPreferenceTitle:"默认偏好",butlerInitPreferenceDescription:"这里控制它默认先盯什么风险、先汇报什么结果。",butlerInitRuleLabel:"规则载体",butlerInitTipAutoWorkspace:"系统会自动创建助手目录和首版 AGENTS.md,你现在只需要定默认偏好。",butlerInitTipProviderSwitch:"Provider 后续还能切,不用在第一次初始化时把自己困死。",butlerInitTipReportPriority:"汇报优先级会影响它先告诉你风险、阻塞,还是验证结果。",butlerDisplayNameLabel:"助手称呼",butlerDisplayNamePlaceholder:"例如:阿尔文、小助手",butlerDisplayNameHint:"这是助手的自称,系统会写入 AGENTS.md 首版规则。",butlerProviderLabel:"Provider",butlerWorkspacePathLabel:"助手工作目录",butlerWorkspacePathPlaceholder:"例如:/Users/you/WorkFile/butler-home",butlerAgentsModeLabel:"AGENTS 模式",butlerAgentsModeInline:"内联",butlerAgentsModeFile:"文件",butlerAgentsModeInlineDescription:"内联:系统按你的初始化选项生成规则,后续由系统管理为主。",butlerAgentsModeFileDescription:"文件:系统会在助手独立工作目录下写入 AGENTS.md,后续可以直接改这个文件。",butlerAgentsFilePathLabel:"AGENTS.md 文件路径",butlerAgentsFilePathPlaceholder:"例如:/Users/you/WorkFile/butler-home/AGENTS.md",butlerAgentsContentLabel:"AGENTS 规则内容",butlerAgentsContentPlaceholder:"输入助手的工作规则和解答风格",butlerAgentsContentHint:"这里维护助手的正式规则正文,保存后会直接回写 Butler 专用 AGENTS.md 或内联规则。",butlerPersonaToneLabel:"语气",butlerPersonaLanguageLabel:"使用语言",butlerPersonaSummaryStyleLabel:"总结风格",butlerFocusRiskPreferenceLabel:"风险倾向",butlerFocusReportPriorityLabel:"汇报优先级(逗号分隔)",butlerFocusReportPriorityPlaceholder:"例如:risk,blocker,verification",butlerToneDirect:"直接明确",butlerToneSteady:"稳健克制",butlerToneFriendly:"友好耐心",butlerLanguageZhCn:"中文优先",butlerLanguageEnUs:"英文优先",butlerLanguageBilingual:"中英双语",butlerSummaryBrief:"简明扫一眼",butlerSummaryStructured:"分段清晰",butlerSummaryThorough:"详细展开",butlerRiskConservative:"保守稳妥",butlerRiskBalanced:"推进/风险平衡",butlerRiskProactive:"主动预警",butlerReportPriorityPresetLabel:"汇报优先级",butlerReportRiskFirst:"风险优先",butlerReportBlockerFirst:"阻塞优先",butlerReportVerificationFirst:"验证优先",butlerReportProgressFirst:"进展优先",butlerSummaryDebounceLabel:"会话摘要防抖",butlerSummaryDebounceOption1Minute:"1 分钟",butlerSummaryDebounceOption3Minutes:"3 分钟",butlerSummaryDebounceOption5Minutes:"5 分钟(默认)",butlerSummaryDebounceOption10Minutes:"10 分钟",butlerSummaryDebounceOption15Minutes:"15 分钟",butlerSummaryDebounceOption30Minutes:"30 分钟",butlerSettingsTitle:"助手设置",butlerSettingsSaveAction:"保存设置",butlerSettingsSaving:"保存中...",butlerSettingsSaved:"助手设置已保存",butlerSettingsSaveFailed:"保存助手设置失败",butlerInitSubmitting:"初始化中...",butlerInitSubmit:"完成初始化",butlerInitSuccess:"代码助手初始化成功",butlerInitFailed:"代码助手初始化失败",butlerInitNameRequired:"请先输入助手称呼",butlerInitWorkspaceRequired:"请先填写助手工作目录",butlerInitAgentsFileRequired:"文件模式下请填写 AGENTS.md 路径",butlerWorkbenchTitle:"代码助手工作台",butlerWorkbenchSubtitle:"在这里与助手对话,并查看聚合上下文和动作事件。",butlerWorkspaceHint:"助手工作目录:{workspacePath}",butlerDisplayNameActiveHint:"当前助手称呼:{displayName}",butlerNewSessionAction:"新建会话",butlerNewSessionStarted:"已为助手新建会话",butlerNewSessionFailed:"新建助手会话失败",butlerRefreshAction:"刷新",butlerLoadingTitle:"助手页面加载中",butlerLoadingDescription:"正在整理当前助手的会话、摘要和控制状态,请稍候。",butlerSidebarInfoTab:"信息",butlerSidebarAutomationTab:"自动化",butlerSidebarSettingsTab:"设置",butlerSidebarTabsLabel:"助手信息栏标签",butlerSidebarLoadFailed:"助手信息栏读取失败",butlerInfoContextTitle:"当前上下文",butlerInfoContextDescription:"这里先告诉你助手这一轮正在看什么,不把无关信息一股脑塞进来。",butlerInfoCurrentScopeLabel:"当前范围",butlerInfoCurrentScopeProject:"项目:{projectName}",butlerInfoCurrentScopeGlobal:"全局总览",butlerInfoManagedProjectsLabel:"已跟踪项目",butlerInfoManagedProjectsValue:"活跃 {activeCount} / 全部 {totalCount}",butlerInfoCurrentContextProjectHint:"当前已经切到 {projectName},助手后续补查会优先围绕这个项目展开。",butlerInfoCurrentContextGlobalHint:"当前还是全局视角,只有你点进项目或追问细节时,助手才继续补查更深的信息。",butlerInfoProjectSelectedAction:"当前已选中",butlerInfoProjectViewAction:"查看这个项目",butlerInfoProjectBlockedBadge:"有阻塞",butlerInfoProjectRiskBadge:"风险:{riskLevel}",butlerInfoProjectRiskShortBadge:"风险 {riskLevel}",butlerInfoProjectLastActivityBadge:"最近活跃:{updatedAt}",butlerInfoLatestSessionAction:"打开最近会话",butlerInfoProgressTitle:"当前进展",butlerInfoAttentionTitle:"需要留意",butlerInfoNextStepTitle:"建议下一步",butlerInfoFollowUpRecordsTitle:"会话跟进",butlerInfoFollowUpRecordsDescription:"这里只显示最近 5 条会话跟进状态,完整历史通过按钮展开查看。",butlerInfoFollowUpRecordsEmpty:"还没有会话跟进记录。",butlerInfoFollowUpUntitled:"未命名会话",butlerInfoFollowUpFallback:"最近更新时间:{updatedAt}",butlerFollowUpHistoryAction:"查看历史",butlerFollowUpHistoryTitle:"会话跟进历史",butlerFollowUpHistoryDescription:"这里查看完整的会话跟进状态历史,并可继续下钻轮次详情。",butlerInfoVerificationRecordsTitle:"会话验证",butlerInfoVerificationRecordsDescription:"这里看全局的功能验证记录。",butlerInfoVerificationRecordsEmpty:"还没有会话验证记录。",butlerInfoVerificationFallback:"当前状态:{status}",butlerInfoTodoRecordsTitle:"代办进度",butlerInfoTodoRecordsDescription:"这里看当前汇总出来的代办推进情况。",butlerInfoTodoRecordsEmpty:"还没有代办进度记录。",butlerInfoTodoItemTitle:"代办 {index}",butlerInfoTodoPending:"待处理",butlerInfoTodoInProgress:"进行中",butlerInfoTodoClosed:"已关闭",butlerAutomationTasksTitle:"自动化任务",butlerAutomationTasksDescription:"这里只看自动化任务本身:有哪些任务、现在什么状态、下一次什么时候运行。",butlerAutomationTasksEmpty:"当前还没有自动化任务。",butlerAutomationRunsTitle:"最近运行记录",butlerAutomationRunsDescription:"这里只看自动化任务最近执行了什么,以及每次运行的结果。",butlerAutomationRunsEmpty:"最近还没有自动化运行记录。",butlerAutomationStatusActive:"进行中",butlerAutomationStatusWaitingUser:"等你决定",butlerAutomationStatusCompleted:"已完成",butlerAutomationStatusFailed:"失败",butlerAutomationStatusCancelled:"已取消",butlerAutomationTaskTypeLabel:"任务类型",butlerAutomationTaskTypeManual:"手动计划任务",butlerAutomationTaskTypeInterval:"定时计划任务",butlerAutomationTaskTypeCron:"Cron 计划任务",butlerAutomationTaskTypeFollowUp:"条件跟进任务",butlerAutomationTaskEnabled:"已启用",butlerAutomationTaskDisabled:"已停用",butlerAutomationTaskLastRunLabel:"最近运行",butlerAutomationTaskNextRunLabel:"下一次运行",butlerAutomationRunSourceLabel:"来源",butlerAutomationRunSourcePatrol:"计划任务运行",butlerAutomationRunSourceFollowUp:"条件跟进运行",butlerAutomationRunSummaryLabel:"运行结果",butlerAutomationRunProcessedAtLabel:"运行时间",butlerAutomationRunEmptySummary:"本次运行没有返回摘要。",butlerAutomationPatrolRunTitle:"巡视任务运行",butlerAutomationObjectiveLabel:"当前目标",butlerAutomationLatestAssessmentLabel:"最近判断",butlerAutomationWaitingReasonLabel:"等你决定什么",butlerAutomationNextCheckLabel:"下一次查看",butlerAutomationFinishedAtLabel:"结束时间",butlerAutomationViewRoundsAction:"查看每轮详情",butlerAutomationRoundDetailsTitle:"跟进轮次详情",butlerAutomationRoundDetailsDescription:"查看这个跟进任务每一轮的判断和动作。",butlerAutomationRoundLoading:"正在读取跟进轮次详情...",butlerAutomationRoundLoadFailed:"读取跟进轮次详情失败",butlerAutomationRoundEmpty:"当前还没有可展示的跟进轮次详情。",butlerAutomationRoundLabel:"第 {round} 轮",butlerAutomationRoundProcessedAtLabel:"处理时间",butlerAutomationRoundStatusLabel:"任务状态",butlerAutomationRoundObservedStateLabel:"会话运行状态",butlerAutomationRoundSummaryLabel:"这一轮判断",butlerAutomationRoundWaitingReasonLabel:"等待原因",butlerAutomationRoundPromptLabel:"代理发送内容",butlerAutomationRoundKindStarted:"开始跟进",butlerAutomationRoundKindContinue:"已直接续接",butlerAutomationRoundKindQueued:"已进入消息队列",butlerAutomationRoundKindWaitingUser:"等待用户处理",butlerAutomationRoundKindCompleted:"确认完成",butlerAutomationRoundKindFailed:"跟进失败",butlerAutomationRoundKindCancelled:"手动终止",butlerAutomationRoundKindLimitReached:"达到轮数上限",butlerInboxAction:"收件箱",butlerInboxModalTitle:"收件箱",butlerInboxModalDescription:"在这里记录项目代办,并按项目维护当前推进情况。",butlerInboxLoading:"正在读取收件箱...",butlerInboxLoadFailed:"收件箱读取失败",butlerInboxProjectsEmpty:"还没有可绑定的项目,请先在管家里管理项目。",butlerInboxEmpty:"还没有收件箱记录。",butlerInboxCreateTitle:"新增代办",butlerInboxEditingTitle:"编辑代办",butlerInboxFormDescription:"每条代办都必须绑定到一个项目,后续助手才能围绕它继续跟进。",butlerInboxListTitle:"当前代办",butlerInboxListDescription:"这里会列出你管理的项目代办,方便统一收口处理。",butlerInboxProjectLabel:"绑定项目",butlerInboxTypeLabel:"类型",butlerInboxTitleLabel:"标题",butlerInboxTitlePlaceholder:"例如:登录页验证码收尾",butlerInboxContentLabel:"内容",butlerInboxContentPlaceholder:"写清楚当前问题、目标或你希望助手后续继续推进的点。",butlerInboxStatusLabel:"进度",butlerInboxTypeTask:"任务",butlerInboxTypeBug:"缺陷",butlerInboxTypeFeature:"新功能",butlerInboxTypeChange:"修改",butlerInboxStatusPending:"待处理",butlerInboxStatusInProgress:"进行中",butlerInboxStatusClosed:"已关闭",butlerInboxCreateAction:"新增代办",butlerInboxUpdateAction:"保存修改",butlerInboxCancelEditAction:"取消编辑",butlerInboxEditAction:"编辑",butlerInboxDeleteAction:"删除",butlerInboxCreated:"代办已新增",butlerInboxUpdated:"代办已更新",butlerInboxDeleted:"代办已删除",butlerInboxSaveFailed:"代办保存失败",butlerInboxDeleteFailed:"代办删除失败",butlerProviderSwitched:"Provider 已切换",butlerProviderSwitchedDescription:"已切换到 {provider},当前视图已重置并重新加载。",butlerProviderSwitchFailed:"Provider 切换失败",butlerAttachmentUnsupported:"助手对话暂不支持附件",butlerOverviewTitle:"整体情况",butlerOverviewDescription:"这里会先帮你整理当前最值得关注的内容。",butlerMetricProjectCount:"项目",butlerMetricBlockedCount:"阻塞",butlerMetricHighRiskCount:"高风险",butlerTopRisksTitle:"优先风险",butlerNextActionsTitle:"建议动作",butlerOverviewEmpty:"暂无",butlerOverviewLoading:"正在读取助手聚合摘要...",butlerEventsTitle:"最近操作",butlerEventsDescription:"助手最近帮你做过什么,这里会记下来。",butlerEventsEmpty:"暂无动作事件",butlerLoadFailed:"助手工作台加载失败",butlerContextStrategyTitle:"按需上下文",butlerContextStrategyDescription:"默认只给助手全局摘要,只有你点到某个项目时,才再向后端补拉该项目的会话、记忆、巡视和验证摘要。",butlerConversationTitle:"与助手对话",butlerConversationDescription:"这个对话窗口只属于 {displayName}。需要细节时,{displayName} 会先用聚合摘要回答,再按需直达后端补查具体项目、会话、巡视或验证信息。",butlerComposerPlaceholder:"直接对 {displayName} 说你现在想搞清楚什么",butlerProjectsTitle:"项目",butlerProjectsDescription:"选一个项目,助手就会继续帮你查它的进展和记录。",butlerProjectsEmpty:"暂无可下钻的项目",butlerProjectWorkspaceLabel:"所属工作区:{workspaceId}",butlerProjectSummaryEmpty:"暂无可用摘要",butlerProjectOpenDetailAction:"查看详情",butlerProjectSyncAction:"同步到时间线",butlerProjectSyncSucceeded:"已把项目 {projectName} 同步到助手时间线",butlerProjectActionRequiresSession:"先和助手说一句话,然后再让它继续处理项目。",butlerProjectContextTitle:"当前项目",butlerProjectContextDescription:"这里会显示这个项目的会话、记录和结果。",butlerProjectContextEmpty:"先从上面的项目列表或动作事件里选一个项目。",butlerProjectContextLoading:"正在读取项目关联信息...",butlerProjectContextMeta:"项目状态:{status} · 风险级别:{riskLevel}",butlerProjectActionSucceeded:"助手动作已执行",butlerProjectActionFailed:"助手动作失败",butlerProjectActionPending:"处理中...",butlerProjectSessionsTitle:"项目会话",butlerProjectMemoriesTitle:"项目记忆",butlerProjectPatrolsTitle:"巡视记录",butlerProjectVerificationsTitle:"验证记录",butlerProjectOpenConversationAction:"打开真实会话",butlerProjectResumeAction:"续接会话",butlerProjectResumeSucceeded:"已续接会话:{sessionTitle}",butlerProjectStartPatrolAction:"发起巡视",butlerProjectPatrolSucceeded:"已为 {projectName} 发起巡视",butlerProjectStartVerificationAction:"发起验证",butlerProjectVerificationSucceeded:"已为 {projectName} 发起验证",butlerProjectMemoryMeta:"类型:{memoryType} · 状态:{status}",butlerProjectSessionMeta:"角色:{role} · 状态:{status}",butlerProjectPatrolMeta:"状态:{status} · 风险:{riskLevel}",butlerProjectVerificationMeta:"类型:{verificationType} · 状态:{status}",butlerProjectRunSummaryEmpty:"暂无摘要",butlerProjectFocusAction:"定位这条记录",butlerProjectUpdatedAtLabel:"更新时间:{updatedAt}",butlerFocusedBadge:"当前定位",searchModalTitle:"搜索",searchModalDescription:"支持搜会话标题,或在当前工作区里搜代码文件。",searchModeLabel:"搜索模式",searchModeSessions:"会话",searchModeCode:"代码",searchKeywordLabel:"关键词",searchWorkspaceLabel:"工作区",searchSessionPlaceholder:"输入会话名称、工作区或 provider",searchCodePlaceholder:"输入文件名或路径片段",searchSessionHint:"输入关键词后,这里会立即列出匹配的会话。",searchCodeHint:"选一个工作区,然后搜文件名或路径。",searchSessionEmpty:"没找到匹配的会话。",searchCodeEmpty:"没找到匹配的文件。",searchCodeFailed:"代码搜索失败,请稍后重试。",searchSubmit:"开始搜索",filesEntry:"文件管理",gitEntry:"GIT管理",terminalManagerEntry:"进程管理",workspaceSectionTitle:"工作区",goBack:"后退",goForward:"前进",workspaceCount:"项目",sessionCount:"会话",manageWorkspaceAction:"管理项目",manageWorkspaceTitle:"管理项目",manageWorkspaceDescription:"默认只列出当前已加载的项目,展开后可以查看路径、Git 摘要、代码类型组成,也可以从当前工作台列表里移除。",manageWorkspaceEmpty:"当前没有可管理的项目。",manageWorkspaceLoading:"正在读取项目详情...",manageWorkspaceLoadFailed:"项目详情加载失败",manageWorkspacePathLabel:"路径",manageWorkspaceGitCommitCount:"Git 提交版本数",manageWorkspaceGitInfoLabel:"Git 仓库信息",manageWorkspaceRepoRoot:"仓库根目录",manageWorkspaceCurrentBranch:"当前分支",manageWorkspaceRemoteLabel:"远程",manageWorkspaceNoRemote:"未配置远程",manageWorkspaceNotGit:"当前项目不是 Git 仓库。",manageWorkspaceCodeCompositionLabel:"代码类型组成",manageWorkspaceCodeCompositionFiles:"文件",manageWorkspaceCodeCompositionOther:"其他",manageWorkspaceNoCodeComposition:"暂时没有识别到可统计的代码文件。",manageWorkspaceCodeTruncated:"文件过多,只统计了前 {count} 个可识别文件。",manageWorkspaceColorLabel:"背景颜色",manageWorkspaceColorSelectSwatch:"使用颜色 {color}",manageWorkspaceColorClearAction:"清除颜色",manageWorkspaceColorUnset:"未设置,当前使用默认颜色",manageWorkspaceColorSaveFailed:"工作区颜色保存失败",manageWorkspaceRemoveAction:"移除项目",manageWorkspaceRemoving:"移除中...",manageWorkspaceRemoveSuccess:"项目已从当前工作台移除",manageWorkspaceRemoveFailed:"移除项目失败",manageWorkspaceRemoveConfirmTitle:"确认移除项目",manageWorkspaceRemoveConfirmDescription:"这只会把项目从当前工作台列表移除,不会删除任何磁盘数据或历史记录。后续重新加载同一路径时,旧记录会直接恢复显示。",manageWorkspaceRemoveConfirmTarget:"确定移除「{name}」吗?",manageWorkspaceRemoveConfirmAction:"确认移除",importWorkspaceTitle:"添加项目",importWorkspaceHint:"导入本地代码目录",importExpand:"展开",importCollapse:"收起",importPathLabel:"项目路径",importPathPlaceholder:"输入项目文件夹路径",importNameLabel:"项目名称",importNamePlaceholder:"可选",importSubmit:"添加项目",importSubmitting:"添加中...",importChooseFolder:"选择文件夹",importPickFolderFailed:"打开文件夹选择器失败",importDesktopDropHint:"支持把本地项目文件夹直接拖到这个区域",importHint:"输入本地代码目录后就能开始工作",importServerDirectoryHint:"浏览并选择运行服务器上的项目目录",importBrowserTitle:"选择服务器目录",importBrowserDescription:"这里浏览的是项目运行所在服务器上的目录,不是当前设备的本地目录。",importBrowserCurrentPath:"当前目录",importBrowserRoots:"根目录",importBrowserOpenParent:"返回上一级",importBrowserOpenPath:"打开路径",importBrowserCreateDirectory:"新建文件夹",importBrowserCreateDirectoryTitle:"新建文件夹",importBrowserCreateDirectoryDescription:"只在当前服务器目录下新建一层子文件夹,不接受带路径的输入。",importBrowserCreateDirectoryLabel:"文件夹名称",importBrowserCreateDirectoryPlaceholder:"输入新文件夹名称",importBrowserCreateDirectorySuccess:"文件夹已创建",importBrowserCreateDirectoryFailed:"新建文件夹失败",importBrowserCreateDirectorySubmit:"确认新建",importBrowserCreatingDirectory:"新建中...",importBrowserEmpty:"当前目录下没有可选的子目录",importBrowserBrowseFailed:"加载服务器目录失败",importBrowserSubmit:"导入当前目录",importPathRequired:"请输入项目路径",importSuccess:"项目已添加",importFailed:"添加失败",cloneWorkspaceTitle:"Clone项目",cloneWorkspaceHint:"从 Git 仓库拉取代码到服务端目录,完成后直接加入项目列表。",cloneSubmit:"Clone项目",cloneSubmitting:"Clone 中...",cloneRepositoryLabel:"Git 仓库地址",cloneRepositoryPlaceholder:"例如:https://github.com/org/repo.git",cloneParentPathLabel:"目标父目录",cloneParentPathPlaceholder:"选择后端服务上已存在的目录",cloneDirectoryNameLabel:"新项目目录名",cloneDirectoryNamePlaceholder:"留空时默认使用仓库名",clonePickDirectory:"选择目录",cloneAuthModeLabel:"认证方式",cloneAuthModeNone:"无认证",cloneAuthModeBasic:"用户名 + 密码",cloneAuthModeToken:"Token",cloneUsernameLabel:"用户名",cloneUsernamePlaceholder:"输入 Git 用户名",clonePasswordLabel:"密码",clonePasswordPlaceholder:"输入 Git 密码",cloneTokenLabel:"Token",cloneTokenPlaceholder:"输入 access token",cloneTokenUsernamePlaceholder:"可选,留空时默认使用 git",cloneRepoRequired:"请输入 Git 仓库地址",clonePathRequired:"请选择目标父目录",cloneSuccess:"项目已成功 Clone",cloneFailed:"Clone 失败",cloneHint:"目标父目录必须已经存在,Clone 时会在这个目录下新建仓库文件夹。",cloneBrowserTitle:"选择 Clone 目标父目录",cloneBrowserDescription:"这里选的是服务端已存在的父目录,Clone 时会在其下新建一个项目文件夹。",cloneBrowserSubmit:"使用当前目录",refreshNavigation:"刷新",desktopChromeLabel:"桌面工作台",windowMinimize:"最小化窗口",windowMaximize:"最大化或还原窗口",windowClose:"关闭窗口",contextOpenSession:"打开会话",navigationLoadFailed:"加载失败,请重试",emptyNavigationTitle:"还没有项目",emptyNavigationBody:"添加本地代码目录开始工作",emptyWorkspaceSessions:"暂无会话",favoriteSectionTitle:"收藏会话",favoriteSectionEmpty:"收藏后的会话会固定放在这里,方便你快速回到常用链路。",worktreeSectionTitle:"子工作树",worktreeSectionExpand:"展开子工作树",worktreeSectionCollapse:"收起子工作树",worktreeMergePanelLabel:"工作树合并",worktreeMergePanelTitle:"合回直接父工作区",worktreeMergeExpandDetails:"展开详情",worktreeMergeCollapseDetails:"收起详情",worktreeMergePreviewAction:"预检",worktreeMergePreviewRefresh:"预检",worktreeMergePreviewIdle:"尚未预检",worktreeMergePreviewLoading:"预检中...",worktreeMergeReady:"可以合并",worktreeMergeBlocked:"当前不能合并",worktreeMergeApplying:"合并中...",worktreeMergeApplyAction:"合并",worktreeMergeApplySuccess:"子工作树已经合回直接父工作区",worktreeMergeApplyFailed:"合并子工作树失败",worktreeMergePreviewFailed:"读取工作树合并预检失败",worktreeMergeAlreadyMerged:"已合回直接父工作区",worktreeMergeMergedHint:"代码已经合回直接父工作区,下一步可以继续做清理。",worktreeMergeMergedDirtyHint:"提交历史已经同步到父工作区,但当前子工作树还有未处理事项,暂时不能清理。",worktreeMergeChecklistTitle:"合并检查清单",worktreeMergeChecklistSourceState:"工作树状态正常",worktreeMergeChecklistSourceStateBlocked:"当前子工作树状态异常,系统暂时没有把它当作活跃工作树",worktreeMergeChecklistSourceClean:"子工作区已清理",worktreeMergeChecklistSourceCleanBlocked:"当前子工作树存在未提交改动,请先提交",worktreeMergeChecklistTargetClean:"父工作区可接收合并",worktreeMergeChecklistTargetCleanBlocked:"直接父工作区存在未提交改动,不能接收合并",worktreeMergeChecklistChildren:"没有活跃子工作树",worktreeMergeChecklistChildrenBlocked:"当前子工作树下面还有活跃子节点,必须先从叶子节点开始回收",worktreeMergeChecklistCommits:"存在待合并提交",worktreeMergeChecklistCommitsBlocked:"当前子工作树没有领先父工作区的提交",worktreeMergeChecklistConflicts:"合并不会产生冲突",worktreeMergeChecklistConflictsBlocked:"检测到合并冲突,先处理冲突后再继续",worktreeMergeChecklistResultPending:"等待预检结果",worktreeMergeChecklistResultReady:"可以执行合并",worktreeMergeChecklistResultReadyDetail:"所有条件已满足,可以开始合并",worktreeMergeChecklistResultBlocked:"暂时不能执行合并",worktreeMergeChecklistResultBlockedDetail:"上面的阻塞项解决后,才可以继续",worktreeMergeChecklistResultMerged:"已完成合并,可继续清理",worktreeMergeCompactPending:"待预检",worktreeMergeCompactChecking:"预检中",worktreeMergeCompactReady:"可合并",worktreeMergeCompactBlocked:"受阻",worktreeMergeCompactMerged:"已合并",worktreeMergeCompactMerging:"合并中",worktreeMergeCompactCleaning:"清理中",worktreeMergeCompactInactive:"状态异常",worktreeMergeCompactDirty:"未提交",worktreeMergeCompactTargetDirty:"父区脏",worktreeMergeCompactConflict:"有冲突",worktreeMergeCompactChildren:"有子树",worktreeMergeCompactNoCommits:"无提交",worktreeCleanupAction:"清理",worktreeCleanupRunning:"清理中...",worktreeCleanupSuccess:"工作树已经清理完成",worktreeCleanupFailed:"清理工作树失败",worktreeCleanupModalTitle:"确认清理工作树",worktreeCleanupModalDescription:"默认只清理工作树目录和系统记录。只有分支已经合并进父分支后,才允许额外删除分支。",worktreeCleanupConfirm:"确认清理 {name} 吗?默认会保留 git 分支。",worktreeCleanupDeleteBranchLabel:"同时删除分支 {branch}",worktreeCleanupDeleteBranchHint:"只有分支已经合并进父分支后,才允许删除分支。",worktreeCleanupDeleteBranchAction:"清理并删除分支",worktreeCleanupDeleteBranchSuccess:"工作树和分支 {branch} 已清理完成",worktreeCleanupDeleteBranchPartialFailed:"工作树已清理,但分支 {branch} 删除失败",worktreeMergeCurrentBranch:"当前分支:{branch}",worktreeMergeParentBranch:"父分支:{branch}",worktreeMergeTargetWorkspace:"目标父工作区:{name}",worktreeMergeAheadBehindPending:"提交差异:待预检",worktreeMergeAheadBehind:"提交差异:领先 {ahead} / 落后 {behind}",worktreeMergeBaseCommit:"merge base:{commit}",worktreeMergeConflictLabel:"冲突文件",favoriteAction:"收藏会话",unfavoriteAction:"取消收藏",favoriteAdded:"会话已加入收藏",favoriteRemoved:"会话已取消收藏",favoriteToggleFailed:"收藏状态更新失败",sessionMoreAction:"更多操作",sessionStateInferred:"推断",renameAction:"重命名",renameSuccess:"会话名称已更新",renameFailed:"会话重命名失败",renameModalTitle:"重命名会话",renameModalDescription:"改成你自己能一眼认出来的名字,只改标题,不改消息内容。",renameInputLabel:"会话名称",renameInputPlaceholder:"输入新的会话名称",renamingSession:"保存中...",archiveFolderLabel:"归档会话",archiveFolderAction:"打开归档文件夹",archiveAction:"归档会话",archiveCurrentSessionAction:"归档当前会话",archiveAdded:"会话已归档",archiveConfirmTitle:"确认归档会话",archiveConfirmDescription:"归档后,这条会话会从当前工作区主列表里隐藏,你仍然可以在归档区恢复它。",unarchiveAction:"取消归档",archiveRestored:"会话已恢复到主列表",archiveModalTitle:"归档会话",archiveModalDescription:"这里列出当前项目暂时隐藏的会话,需要时可以恢复到主列表。",archiveEmpty:"这个项目还没有归档会话。",subagentBadge:"子代理",sessionForkSession:"会话分叉",sessionForkMessage:"消息分叉",sessionForkReconstructed:"重建分叉",subagentExpand:"展开子代理列表",subagentCollapse:"收起子代理列表",subagentExpandMore:"展开更多子会话",favoriteExpandMore:"显示更多收藏",sessionExpandMore:"显示更多会话",archiveExpandMore:"查看更多归档会话",worktreeCollapse:"收起工作树",worktreeExpand:"展开工作树",workspaceCollapse:"收起项目",workspaceExpand:"展开项目",reorderWorkspace:"拖拽调整项目顺序",switchWorkspace:"切换到此项目",workspaceReorderFailed:"项目排序保存失败",workspaceCollapseStateSaveFailed:"项目折叠状态保存失败",workspaceHomeSwitcherLabel:"切换工作区",workspaceHomeSwitcherTitle:"工作区",hostWorkspaceSwitcherTitle:"HOST 与工作区",hostSwitcherAriaLabel:"切换 HOST",hostSwitcherTitle:"HOST 切换",hostSwitcherCurrentBadge:"当前",hostSwitcherNodeBadge:"HOST",hostSwitcherAddAction:"新增 HOST",hostSwitcherNameLabel:"HOST 名称",hostSwitcherNamePlaceholder:"例如:办公室 Host",hostSwitcherUrlLabel:"HOST 地址",hostSwitcherUrlPlaceholder:"例如:http://192.168.1.20:3002",hostSwitcherSaveAction:"保存 HOST",hostSwitcherSwitching:"切换中",hostSwitcherWorkspaceCount:"{count} 个工作区",hostSwitcherWorkspaceCountWithUser:"{username} · {count} 个工作区",hostSwitchFailed:"切换 HOST 失败",hostSwitchUnreachable:"{name} 当前不可达",hostSwitchMissing:"目标 HOST 不存在",hostAddInvalidUrl:"HOST 地址无效",hostAddDuplicate:"这个 HOST 已经存在",hostAddFailed:"新增 HOST 失败",hostAddSuccess:"已新增 HOST:{name}",mobileWorktreeBadge:"工作树",workspaceHomeStatusSectionTitle:"当前工作区",workspaceHomeViewAllAction:"查看全部会话",workspaceHomeMetricActive:"活动",workspaceHomeMetricUnread:"通知",workspaceHomeMetricTerminal:"终端",workspaceHomeMetricChanges:"变更",workspaceHomeActiveSessionsSectionTitle:"活动会话",workspaceHomeQuickLaunchStatusLabel:"快捷启动进程",workspaceHomeQuickLaunchRunning:"运行中",workspaceHomeQuickLaunchStopped:"未运行",workspaceHomeWaitingInputLabel:"等待输入",workspaceHomeButlerLabel:"代码助手",mobileButlerEntry:"代码助手",mobileButlerEmptyTitle:"代码助手还没准备好",mobileButlerEmptyBody:"当前还没有完成代码助手初始化,先在桌面端做完首轮初始化,再回到手机端看跟进和自动化。",mobileButlerSummaryTitle:"当前工作区摘要",mobileButlerSummaryProjects:"项目",mobileButlerSummaryFollowUps:"进行中任务",mobileButlerSummaryWaitingUser:"待你处理",mobileButlerSummaryInbox:"未完成代办",mobileButlerAssistantWorkspaceLabel:"助手工作目录",mobileButlerAssistantToneLabel:"沟通风格",mobileButlerAssistantLanguageLabel:"工作语言",mobileButlerAssistantUpdatedAtLabel:"最近更新",workspaceOverviewTitle:"把项目入口放到看得见的地方",workspaceOverviewBody:"先选项目,再决定是继续已有会话,还是开一条新的工作链路。",workspaceListBody:"这里保留当前工作台里的全部项目,并把高频操作直接放到首页。",workspaceDetailTitle:"项目详情",workspaceDetailSummaryTitle:"项目概览",workspaceDetailSummaryBody:"先看当前项目路径、Git 摘要和代码规模,再决定下一步去哪做事。",workspaceDetailMissingTitle:"没找到这个项目",workspaceDetailMissingBody:"这个项目可能已经被移除,或者当前快照还没加载到它。",workspaceDetailDebugTitle:"服务状态",manageWorkspaceDebugDescription:"查看当前项目里的服务识别结果、最近一次启动情况和支持说明。",workspaceDetailDebugAnalyzeFailed:"读取服务状态失败",workspaceDetailDebugFrameworkLabel:"识别类型",workspaceDetailDebugConfidenceLabel:"识别把握",workspaceDetailDebugCompatibilityLabel:"可用程度",workspaceDetailDebugInjectionLabel:"推荐处理方式",workspaceDetailDebugRuntimeStatusLabel:"当前状态",workspaceDetailDebugFailureStageLabel:"卡住位置",workspaceDetailDebugServiceDiscoveryLabel:"服务地址处理",workspaceDetailDebugHmrLabel:"热更新处理",workspaceDetailDebugCallbackLabel:"回调处理",workspaceDetailDebugAiFallbackLabel:"人工处理策略",workspaceDetailDebugFrameworkNoteLabel:"说明",workspaceDetailDebugReasonsLabel:"当前说明",workspaceDetailDebugFilesLabel:"参考文件",workspaceDetailDebugFailureStageEmpty:"暂无",workspaceDetailDebugRuntimeEmpty:"当前还没有运行记录。",workspaceDetailDebugFrameworkNoteEmpty:"当前没有额外兼容说明。",workspaceDetailDebugEmptyReasons:"暂无",workspaceDetailDebugEmptyFiles:"暂无",workspaceDetailDebugConfidenceHigh:"高",workspaceDetailDebugConfidenceMedium:"中",workspaceDetailDebugConfidenceLow:"低",workspaceDetailDebugCompatibilitySupported:"可以直接使用",workspaceDetailDebugCompatibilityConditional:"需要补充处理",workspaceDetailDebugCompatibilityUnsupported:"暂不建议直接使用",workspaceDetailDebugCompatibilityUnknown:"未知",workspaceDetailDebugInjectionCli:"启动参数",workspaceDetailDebugInjectionEnv:"环境变量",workspaceDetailDebugInjectionOverride:"调整启动命令",workspaceDetailDebugInjectionAiFallback:"需要人工辅助",workspaceDetailDebugInjectionNone:"暂不自动处理",workspaceDetailDebugRuntimePreparing:"准备中",workspaceDetailDebugRuntimeRunning:"运行中",workspaceDetailDebugRuntimeFailed:"启动失败",workspaceDetailDebugRuntimeStopped:"已停止",workspaceDetailDebugRuntimeNotStarted:"未启动",workspaceDetailDebugRequirementRequired:"需要补充",workspaceDetailDebugRequirementNotRequired:"不需要补充",workspaceDetailDebugAiPolicyNever:"不建议自动处理",workspaceDetailDebugAiPolicyConditional:"视情况处理",workspaceDetailDebugAiPolicyAllowed:"可以处理",workspaceDetailDebugRuntimeServicesTitle:"最近一次启动",workspaceDetailDebugRuntimeHistoryTitle:"最近几次启动记录",workspaceDetailDebugRuntimeHistoryTimeLabel:"启动时间",workspaceDetailDebugRuntimeHistoryServiceLabel:"涉及服务",workspaceDetailDebugRuntimeHistoryResultLabel:"结果",workspaceDetailDebugRuntimeHistoryTitleWithIndex:"启动记录 #{id}",workspaceDetailDebugRuntimeHistoryFailedSummary:"这次启动里,{services} 没有正常启动。",workspaceDetailDebugRuntimeHistoryGenericSummary:"这里保留最近几次启动结果,方便回看问题是否重复出现。",workspaceDetailDebugRuntimeHistoryNoServices:"暂无",workspaceDetailDebugRuntimeHistoryResultRunning:"仍在运行",workspaceDetailDebugRuntimeHistoryResultFailed:"启动失败",workspaceDetailDebugRuntimeHistoryResultStopped:"已结束",workspaceDetailDebugRuntimeHistoryResultPreparing:"准备中",workspaceDetailDebugRuntimeServicePortLabel:"分配端口",workspaceDetailDebugRuntimeServiceBindingLabel:"端口状态",workspaceDetailDebugRuntimeServiceProcessLabel:"服务进程",workspaceDetailDebugRuntimeServiceFailureLabel:"问题位置",workspaceDetailDebugRuntimeServiceAiLabel:"人工处理记录",workspaceDetailDebugDetectedServicesTitle:"识别到的服务",workspaceDetailDebugServicePathLabel:"所在位置",workspaceDetailDebugServiceFrameworkLabel:"识别结果",workspaceDetailDebugServiceCommandLabel:"启动方式",workspaceDetailDebugServiceRequirementsLabel:"需要补充处理",workspaceDetailDebugServiceActionLabel:"建议动作",workspaceDetailDebugOpenPageAction:"服务调试",workspaceDetailDebugPageTitle:"服务调试",workspaceDetailDebugPageDescription:"这里集中查看当前项目里的服务、最近一次启动情况和支持说明。",workspaceDetailDebugPageHeroEyebrow:"项目服务概览",workspaceDetailDebugOverallStatusLabel:"整体状态",workspaceDetailDebugOverallSummaryLabel:"整体说明",workspaceDetailDebugOverallStatusSupported:"可以直接启动",workspaceDetailDebugOverallStatusConditional:"部分服务还要补充设置",workspaceDetailDebugOverallStatusBlocked:"当前不建议整体直接启动",workspaceDetailDebugOverallSummaryEmpty:"暂时还没拿到可用的服务检查结果。",workspaceDetailDebugOverallSummaryMixed:"当前识别到 {webCount} 个网页服务,以及 {desktopCount} 个桌面壳服务。桌面壳服务会单独展示,不参与网页服务的自动处理。",workspaceDetailDebugOverallSummaryDesktopOnly:"当前识别到 {count} 个桌面壳服务,还没有明确识别出网页服务。",workspaceDetailDebugOverallSummaryWebOnly:"当前识别到 {count} 个可以参与网页调试的服务。",workspaceDetailDebugSummaryServiceCountLabel:"服务总数",workspaceDetailDebugSummaryWebCountLabel:"网页服务",workspaceDetailDebugSummaryDesktopShellCountLabel:"桌面壳服务",workspaceDetailDebugSummaryWebServicesChip:"{count} 个网页服务",workspaceDetailDebugSummaryDesktopShellChip:"{count} 个桌面壳",workspaceDetailDebugSummaryUnsupportedChip:"{count} 个阻断项",workspaceDetailDebugAutoInjectionEligible:"当前网页服务已经满足自动处理条件",workspaceDetailDebugAutoInjectionBlocked:"当前还不建议把整个项目当成可自动处理目标",workspaceDetailDebugDesktopShellSummaryHint:"桌面壳服务单独识别,不参与网页服务协调",workspaceDetailDebugCompatibilityBreakdown:"可直接使用 {supported} / 需要补充 {conditional} / 暂不建议 {unsupported}",workspaceDetailDebugLastAnalyzedAtLabel:"最近检查时间",workspaceDetailDebugTargetSourceRepo:"检查范围:仓库根目录",workspaceDetailDebugTargetSourceWorktree:"检查范围:当前工作树",workspaceDetailDebugRequirementsNone:"目前没有额外要求",workspaceDetailDebugServiceSectionDescription:"把项目拆成单个服务来看,方便确认哪些可以直接启动,哪些还要补充设置。",workspaceDetailDebugRuntimeSectionDescription:"这里只显示最近一次启动结果,方便快速确认是哪一个服务没有正常跑起来。",workspaceDetailDebugMatrixSectionDescription:"这里展示不同类型服务的默认支持情况,帮助你判断下一步怎么处理。",workspaceDetailDebugMatrixTitle:"支持说明",workspaceDetailDebugMatrixOpenAction:"查看支持矩阵",workspaceDetailDebugMatrixModalDescription:"把不同服务类型的默认支持情况放到一张矩阵里,别再靠长列表硬扫。",workspaceDetailDebugMatrixFrameworkHeader:"框架",workspaceDetailDebugMatrixCompatibilityHeader:"支持",workspaceDetailDebugMatrixInjectionHeader:"方式",workspaceDetailDebugMatrixDiscoveryHeader:"发现",workspaceDetailDebugMatrixHmrHeader:"HMR",workspaceDetailDebugMatrixCallbackHeader:"回调",workspaceDetailDebugMatrixAiHeader:"人工",workspaceDetailDebugMatrixNotesHeader:"说明",workspaceDetailDebugMatrixCompatibilitySupportedShort:"可直接",workspaceDetailDebugMatrixCompatibilityConditionalShort:"先补充",workspaceDetailDebugMatrixCompatibilityUnsupportedShort:"不建议",workspaceDetailDebugMatrixCompatibilityUnknownShort:"未知",workspaceDetailDebugMatrixInjectionCliShort:"参数",workspaceDetailDebugMatrixInjectionEnvShort:"环境",workspaceDetailDebugMatrixInjectionOverrideShort:"改命令",workspaceDetailDebugMatrixInjectionAiFallbackShort:"人工",workspaceDetailDebugMatrixInjectionNoneShort:"无",workspaceDetailDebugMatrixRequirementRequiredShort:"需处理",workspaceDetailDebugMatrixRequirementNotRequiredShort:"无需",workspaceDetailDebugMatrixAiNeverShort:"不处理",workspaceDetailDebugMatrixAiConditionalShort:"视情况",workspaceDetailDebugMatrixAiAllowedShort:"可处理",workspaceDetailDebugMatrixLegendSummary:"表格里的图标含义是:勾表示默认可过,警示表示启动前还要补设置,叉表示当前不建议自动处理。下面把短表头补成人话,省得你猜。",workspaceDetailDebugMatrixDiscoveryNote:"服务地址、代理、rewrites 这一类处理。",workspaceDetailDebugMatrixHmrNote:"热更新、前端开发长连这类处理。",workspaceDetailDebugMatrixCallbackNote:"登录回调、OAuth、Webhook 这类回调入口。",workspaceDetailDebugMatrixAiNote:"遇到边界情况时,是否允许转人工辅助。",workspaceDetailDebugFailureStageServiceDiscovery:"还缺少服务地址相关处理",workspaceDetailDebugFailureStageHmr:"还缺少热更新相关处理",workspaceDetailDebugFailureStageCallback:"还缺少回调处理",workspaceDetailDebugFailureStageAiFallbackRequired:"需要转人工处理",workspaceDetailDebugFailureStageAdapterSelection:"还没找到合适的启动方式",workspaceDetailDebugFailureStageLaunchRequirements:"启动前还有条件没有满足",workspaceDetailDebugFailureStageCommandExecution:"启动命令没有正常执行",workspaceDetailDebugFailureStageProcessExit:"服务启动后很快退出了",workspaceDetailDebugFailureStageProcessRuntimeError:"服务运行时出现错误",workspaceDetailDebugFailureStageStaleRuntimeBinding:"这次启动记录已经失效",workspaceDetailDebugFailureStageUnknown:"未知阶段({code})",workspaceDetailDebugBindingAllocated:"已分配",workspaceDetailDebugBindingListening:"可访问",workspaceDetailDebugBindingFailed:"未就绪",workspaceDetailDebugBindingReleased:"已释放",workspaceDetailDebugBindingUnknown:"未知",workspaceDetailDebugProcessCreating:"启动中",workspaceDetailDebugProcessRunning:"运行中",workspaceDetailDebugProcessClosed:"已结束",workspaceDetailDebugProcessError:"异常",workspaceDetailDebugProcessUnknown:"未知",workspaceDetailDebugPortEmpty:"暂无",workspaceDetailDebugRoleFrontend:"网页服务",workspaceDetailDebugRoleBackend:"后端服务",workspaceDetailDebugRoleWorker:"后台任务",workspaceDetailDebugRoleMock:"模拟服务",workspaceDetailDebugRoleDesktopShell:"桌面壳服务",workspaceDetailDebugRoleCustom:"自定义",workspaceDetailDebugServiceOverviewSupported:"这个服务已经识别清楚,按推荐方式处理后通常可以直接启动。",workspaceDetailDebugServiceOverviewConditional:"这个服务已经识别出来,但启动前还需要补充一些设置或配套处理。",workspaceDetailDebugServiceOverviewUnsupported:"这个服务目前不建议直接自动处理,建议先手动确认启动方式。",workspaceDetailDebugServiceOverviewUnknown:"这个服务还没有识别清楚,先保留结果,后续再补充判断。",workspaceDetailDebugServiceOverviewDesktopShell:"这是桌面壳服务,会单独展示,不参与网页服务的自动端口处理。",workspaceDetailDebugServiceActionSupported:"可直接启动",workspaceDetailDebugServiceActionConditional:"先补配置",workspaceDetailDebugServiceActionUnsupported:"建议手动处理",workspaceDetailDebugServiceActionUnknown:"先确认服务类型",workspaceDetailDebugServiceActionDesktopShell:"按桌面壳方式单独处理",workspaceDetailDebugAiEditEmpty:"无",workspaceDetailDebugAiEditPending:"待处理",workspaceDetailDebugAiEditApplied:"已应用",workspaceDetailDebugAiEditRolledBack:"已回滚",workspaceDetailDebugAiEditRejected:"已拒绝",workspaceSessionListBody:"项目里的会话、收藏和归档操作都收在这里,不再让你先去翻侧栏。",recentSessionsSectionTitle:"最近会话",recentSessionsSectionBody:"先回到最近在做的事情,别让手机端还要你猜入口。",currentWorkspaceSectionTitle:"当前项目会话",currentWorkspaceSectionBody:"当前项目下的会话都集中在这里,方便继续刚才的上下文。",sessionIndexTitle:"会话入口单独成页",sessionIndexBody:"最近、收藏、当前项目三块分开看,手机上找会话别再靠侧栏折叠。",toolsMoreAction:"更多",toolsSwipeHint:"左右滑动切换文件管理和 Git 管理",toolsSwipePosition:"{current} / {total}",toolFilesBody:"查看项目文件、变更文件和代码上下文,不再靠桌面右栏概念。",toolGitBody:"把当前项目的 Git 状态、提交和分支操作收进一个明确入口。",toolTerminalsBody:"进入终端主页面,处理输入密集和滚动密集的操作。",toolProcessesBody:"查看当前项目的终端模板、运行状态和进程入口。",toolsWorkspaceRequiredBody:"先选一个项目,再打开对应的工具页。",createSession:"新建会话",createSessionModalTitle:"选择新会话类型",createSessionModalDescription:"先选会话类型,再启动真正的会话进程。",createSessionWorkspaceLabel:"选择工作区",createSessionProviderLabel:"选择供应商",createSessionTarget:"当前项目",createWorktreeSectionTitle:"子工作区",createWorktreeSectionDescription:"先从当前项目分出子工作区,再决定用哪个供应商开新会话。",createWorktreeAction:"新增子工作区",createWorktreeCollapseAction:"收起子工作区表单",createWorktreeBranchLabel:"分支名",createWorktreeBranchPlaceholder:"例如:feat/login-codex",createWorktreeBranchRequired:"请先输入子工作区分支名",createWorktreeBranchInvalid:"分支名只能包含英文、数字、-、_、/,并且不能以 / 开头、结尾或连续出现 /",createWorktreeDisplayNameLabel:"显示名称(可选)",createWorktreeDisplayNamePlaceholder:"默认沿用分支名",createWorktreeBaseRefLabel:"从哪个分支/提交创建(可选)",createWorktreeBaseRefPlaceholder:"默认沿用当前分支",createWorktreeBaseRefHint:"可选当前仓库的本地分支 {localCount} 个、远端分支 {remoteCount} 个、标签 {tagCount} 个;也可以手填 commit hash。",createWorktreeBaseRefLoading:"正在读取当前仓库的分支和标签...",createWorktreeBaseRefLoadFailed:"分支和标签列表读取失败,仍然可以手动输入分支、标签或 commit hash。",createWorktreeBaseRefLocalGroup:"本地分支",createWorktreeBaseRefRemoteGroup:"远端分支",createWorktreeBaseRefTagGroup:"标签",createWorktreeBaseRefCurrentBadge:"当前分支",createWorktreeBaseRefRecommendedBadge:"推荐",createWorktreeBaseRefEmpty:"没有找到匹配项。你也可以直接输入想使用的分支、标签或 commit hash。",createWorktreeBaseRefToggle:"展开可选分支和标签",createWorktreeHelpAction:"填写说明",createWorktreeHelpTitle:"这三个内容怎么填",createWorktreeHelpBranchTitle:"分支名",createWorktreeHelpBranchBody:"这是新子工作区自己的名字,后面在列表里也会用它区分。一般填类似 feat/login 这种短名字就够了。",createWorktreeHelpDisplayNameTitle:"显示名称",createWorktreeHelpDisplayNameBody:"如果你想让列表里更好认,可以填一个更直白的名字。不填也没关系,系统会直接用分支名。",createWorktreeHelpBaseRefTitle:"从哪个分支/提交创建",createWorktreeHelpBaseRefBody:"这决定新子工作区从哪里开始。大多数时候保持默认就行;只有你想从别的分支、标签,或者某次提交继续时再改。",createWorktreeSubmit:"创建子工作区",createWorktreeSubmitting:"创建中...",createWorktreeSucceeded:"子工作区已创建:{name}",createWorktreeFailed:"创建子工作区失败",providerClaudeCode:"Claude Code",providerCodexDescription:"创建 Codex 会话,适合继续当前默认工作流。",providerClaudeDescription:"创建 Claude Code 会话,适合切换另一条会话链路。",providerOpenCodeDescription:"创建 OpenCode 会话,适合通过 OpenCode server 延续当前上下文。",providerGeminiDescription:"创建 Gemini 会话,适合接入 Gemini CLI 的原生工作流。",providerKimiDescription:"创建 Kimi 会话,适合接入 Kimi CLI 的原生工作流。",providerOptionHint:"选择后会立即创建会话",providerChecking:"检查中...",startClaude:"Claude",startCodex:"Codex",startingSession:"创建中...",startClaudeSuccess:"Claude 会话已创建",startCodexSuccess:"Codex 会话已创建",startSessionFailed:"创建失败",auxiliaryTitle:"信息",auxiliarySubtitle:"文件与 Git 状态",expandAuxiliary:"展开",collapseAuxiliary:"收起",auxiliaryEmptyTitle:"选择一个会话",auxiliaryEmptyBody:"会话文件和 Git 信息将显示在这里",batchSelectSessions:"批量选择会话",batchSelectionMode:"批量选择",selectAllSessions:"全选",clearSelectedSessions:"清空选择",batchArchiveAction:"归档已选",batchArchiving:"归档中...",batchArchiveSuccess:"已归档选中的会话",batchArchivePartialFailed:"部分会话归档失败,请重试",batchArchiveFailed:"批量归档失败",hideSessionSidebar:"隐藏会话列表",showSessionSidebar:"显示会话列表",hideInfoSidebar:"隐藏信息栏",showInfoSidebar:"显示信息栏",centerTabsLabel:"中间区域标签",infoTabsLabel:"信息栏标签",leftResizerLabel:"调整左侧宽度",rightResizerLabel:"调整右侧宽度",filesPanelEmpty:"先导入或选中一个项目,文件管理才能显示。",gitPanelEmpty:"先导入或选中一个工作区,Git 信息才能显示。",infoPanelDeferred:"左侧会话列表优先加载,右侧附属面板稍后再挂载。"},workbench:{emptyEyebrow:"开始",emptyTitle:"先选一个会话",emptyBody:"从左侧继续之前的内容,或新建一个会话。",emptyResumeTitle:"继续",emptyResumeBody:"回到上次停下的地方。",emptyNewTitle:"新建",emptyNewBody:"把新问题放进新会话。",emptyCompanionTitle:"查看辅助信息",emptyCompanionBody:"需要文件、Git 或终端时,再看右侧。",emptyTip:"准备好后,从左侧选一个会话开始。"},conversation:{resendButton:"重发",historyLoading:"加载中...",historyLoadingOlder:"加载更早的消息...",historyLoadFailed:"加载失败",inheritedContextLoading:"正在整理从父会话继承的上下文...",inheritedContextMessageLabel:"继承自某条消息之前的上下文",inheritedContextSessionLabel:"继承自主会话的上下文",inheritedContextSummary:"已默认折叠从“{parentTitle}”继承的 {count} 条消息。",actionInheritedSelectionSummary:"已默认折叠来自“{parentTitle}”的一段选中文本。",inheritedContextExpand:"展开完整上文",inheritedContextCollapse:"收起继承上文",inheritedContextParentFallback:"父会话",timelineEmpty:"开始对话",composerPlaceholder:"把下一步交代清楚,剩下的交给这条会话继续跑。",sendButton:"发送消息",attachFiles:"附加文件",attachmentSourceSheetTitle:"添加图片",attachmentSourceSheetDescription:"选择直接拍照,或从相册里挑一张现有图片。",attachmentTakePhoto:"拍照",attachmentTakePhotoHint:"直接打开相机拍一张新图片",attachmentChooseFromLibrary:"从相册选择",attachmentChooseFromLibraryHint:"从手机相册或图片库里挑选",pasteImagesHint:"支持直接粘贴图片",attachmentImageOnly:"目前只支持图片附件",attachmentReadFailed:"图片读取失败,请重试",attachmentPreviewAlt:"已选图片预览",attachmentPreviewOpen:"点击查看大图",attachmentPreviewClose:"关闭图片预览",attachmentPreviewLoading:"图片加载中",attachmentPreviewUnavailable:"图片暂时不可预览",imageAttachmentLabel:"图片附件",imagePreviewTitle:"图片预览",imagePreviewHint:"点击遮罩或按 Esc 可以关闭预览",removeAttachment:"移除附件",selectionTodoAction:"代办",selectionActionButton:"操作",selectionActionSubmit:"新开操作子会话",selectionActionPromptLabel:"你想让它做什么",selectionActionPromptPlaceholder:"比如:解释这段话、整理成笔记,或调用指定接口处理它",selectionActionIncludeContext:"包含当前上下文",selectionActionContextUnavailable:"当前选区跨了多条消息,没法安全继承上下文,只能按无上下文新建子会话。",selectionActionDefaultPrompt:"请处理这段内容。",selectionActionQuotedLabel:"选中文本",selectionActionFailed:"创建操作子会话失败。",actionSessionBadge:"操作",modelSelectorLabel:"选择模型",modelUseCliDefault:"默认",modelUseCodexConfig:"跟随当前 Codex 配置",modelUseOpenCodeConfig:"跟随当前 OpenCode 配置",reasoningSelectorLabel:"选择推理强度",reasoningLow:"低",reasoningMedium:"中",reasoningHigh:"高",reasoningMaximum:"极高",slashMenu:"命令",slashMenuTitle:"快捷命令",slashCommandPlan:"先让对方给出执行路线",slashCommandReview:"直接进入代码审查模式",slashCommandExplain:"要求用更清楚的方式解释",toolInputLabel:"输入",toolResultLabel:"结果",toolResultEmpty:"暂无输出",toolPreviewCommand:"命令",toolPreviewTerminal:"终端",toolStatusRunning:"运行中",toolStatusFailed:"已失败",toolStatusCompleted:"已完成",runtimeThinkingPlaceholder:"{provider} 正在思考...",applyPatchEditedLabel:"已编辑",applyPatchAddedLabel:"已新增",applyPatchDeletedLabel:"已删除",applyPatchDialogTitle:"Patch 变更预览",applyPatchDialogDescription:"这里按文件显示 apply_patch 将要执行的变更。",applyPatchOpenDiff:"查看 diff",applyPatchAddedStat:"新增",applyPatchRemovedStat:"减少",applyPatchEmpty:"这个 patch 暂时没有可展示的文件变更。",titleFallback:"继续对话",draftTitleCodex:"New Codex session",draftTitleClaude:"New Claude Code session",draftTitleOpenCode:"New OpenCode session",draftTitleGemini:"New Gemini session",draftTitleKimi:"New Kimi session",headerWorkspace:"工作区",headerWorkspaceUnknown:"未知工作区",headerProvider:"Provider",headerConnection:"连接",headerRuntime:"运行态",providerCodex:"Codex",branchTreeAction:"分支树",branchTreeTitle:"分支树",branchTreeDescription:"这里只看当前会话所在的父子链,不把整个工作区会话列表混进来。",branchTreeUpstreamLabel:"上游链路",branchTreeCurrentLabel:"当前会话",branchTreeChildrenLabel:"下游分支",branchTreeCurrentBadge:"当前",branchTreeArchivedBadge:"已归档",branchTreeEmpty:"这条会话当前还没有下游分支。",branchTreeMapTitle:"分支关系图",branchTreeMapDescription:"这里会把当前会话所在主干和所有关联分支一起展开。",branchTreePreviewTitle:"会话预览",branchTreePreviewDescription:"点一下节点就会浮出最近几条消息,再决定要不要切过去。",branchTreePreviewLoading:"正在读取这条会话的最近消息...",branchTreePreviewFailed:"会话预览读取失败。",branchTreePreviewEmpty:"这条会话最近没有可预览的消息。",branchTreeResizeHandle:"调整分支树宽度",branchTreeZoomInAction:"放大分支图",branchTreeZoomOutAction:"缩小分支图",branchTreeZoomResetAction:"重置分支图缩放",branchTreeSwitchAction:"切换到这个会话",branchTreeCurrentAction:"已在当前会话",branchTreeToolMessageFallback:"工具消息",branchTreeMessageEmpty:"这条消息当前没有可展示的正文。",moreSessionActions:"更多会话操作",moreSessionActionsTitle:"更多会话操作",moreSessionActionsDescription:"分支树和 AI 助手统一收在这里,避免移动端标题栏被按钮挤满。",branchTreeTab:"分支树",aiAssistantTab:"AI助手",aiAssistantTabDescription:"这里保留当前会话的 AI 助手入口,需要继续跟进或发起验证时直接点下面这个按钮。",providerClaude:"Claude",providerOpenCode:"OpenCode",providerGemini:"Gemini",providerKimi:"Kimi",capabilitySend:"可发送",queueTitle:"待发队列",queueDescription:"当前运行结束后,会按顺序自动继续处理下面的消息。",queueOrderPrefix:"等待顺序",queueStatusQueued:"等待中",queueStatusFailed:"续跑失败",queueDelete:"删除",queueDeleting:"删除中",permissionRequestSectionTitle:"待处理审批",permissionRequestSectionDescription:"这里把供应商原生的权限申请统一收口,不再让你面对三套不同的确认框。",permissionRequestToastTitle:"需要审批",backgroundPermissionToastDescription:"{title} · {requestTitle}",backgroundCompletionToastTitle:"会话已完成",backgroundCompletionToastDescription:"{title}",backgroundFailureToastTitle:"会话异常",backgroundFailureToastDescription:"{title} · {detail}",permissionRequestReplyFailed:"回复权限申请失败。",permissionRequestSubmitting:"提交中...",permissionRequestReasonLabel:"原因",permissionRequestCommandLabel:"命令",permissionRequestToolLabel:"工具",permissionRequestCwdLabel:"工作目录",permissionRequestPathsLabel:"相关路径",permissionRequestPermissionsLabel:"申请权限",permissionRequestReadLabel:"读取",permissionRequestWriteLabel:"写入",permissionRequestNetworkLabel:"网络",permissionRequestQuestionsLabel:"补充问题",permissionRequestDetailLabel:"详情",permissionRequestEmpty:"无",permissionRequestUnknown:"未知",permissionRequestKindCommand:"命令",permissionRequestKindFileChange:"文件改动",permissionRequestKindPermissions:"权限扩展",permissionRequestKindUserInput:"补充输入",permissionRequestKindToolCall:"工具调用",queueImageOnly:"只包含图片附件",sendGuidanceButton:"追加指导",queueGuidanceButton:"加入队列",capabilityDenied:"受限",capabilitySendDisabled:"发送受限",connectionConnected:"实时已连接",connectionReconnecting:"正在重连",connectionReconnectFailed:"重连失败",connectionClosed:"连接已关闭",runtimeIdle:"空闲",runtimeStarting:"启动中",runtimeRunning:"运行中",runtimeReconnecting:"恢复中",runtimeStale:"运行待确认",runtimeUnknown:"状态待确认",runtimeCompleted:"已完成",runtimeInterrupted:"已中断",runtimeFailed:"失败",rulesMessageTitle:"规则信息",rulesMessageHint:"这是一段会话启动规则,默认折叠显示,需要时再展开查看。",rulesMessageExpand:"展开规则",rulesMessageCollapse:"收起规则",systemPromptTitle:"系统提示",systemPromptHint:"这是 Kimi 会话开头的系统提示词,默认折叠显示,需要时再展开查看。",systemPromptExpand:"展开提示词",systemPromptCollapse:"收起提示词",taskProgressButton:"任务进度({count})",taskProgressModalTitle:"任务进度",taskProgressModalDescription:"当前会话已记录 {count} 条任务,这里直接看最新进度。",taskProgressExplanationTitle:"本轮更新说明",taskProgressSummaryTotal:"总数",taskProgressStatusPending:"待处理",taskProgressStatusInProgress:"进行中",taskProgressStatusCompleted:"已完成",taskProgressStatusFailed:"已失败",taskProgressStatusCancelled:"已取消",taskCardPlanTitle:"计划更新",taskCardTodoTitle:"任务更新",taskCardPlanUpdated:"最新计划",taskCardTodoUpdated:"最新任务列表",taskCardRawExpand:"展开原始调用",taskCardRawCollapse:"收起原始调用",taskCardSummaryTotal:"共 {count} 项",taskCardSummaryInProgress:"进行中 {count}",taskCardSummaryPending:"待处理 {count}",taskCardSummaryCompleted:"已完成 {count}",taskCardSummaryFailed:"已失败 {count}",butlerActionButton:"AI 助手",butlerActionModalTitle:"助手动作",butlerActionModalDescription:"让助手继续跟进当前开发会话,或发起一次开发验证。",butlerActionLoading:"正在连接助手记录...",butlerActionLoadFailed:"读取助手动作信息失败",butlerActionProjectLabel:"当前项目",butlerActionSessionLabel:"当前会话",butlerFollowUpAction:"跟进当前会话",butlerFollowUpActionDescription:"让助手持续盯住这条开发会话,并在结束或阻塞后继续推动。",butlerFollowUpObjectiveLabel:"跟进目标",butlerFollowUpObjectivePlaceholder:"例如:帮我把这个会话的功能真正做完,若 spec 还有未完成项就继续补齐。",butlerFollowUpCompletionCriteriaLabel:"结束条件",butlerFollowUpCompletionCriteriaPlaceholder:"例如:只有当当前功能按既定需求完成,且不再存在必须继续推进的未完成项时,才停止自动跟进。",butlerFollowUpRoundLimitLabel:"最多自动跟进轮数",butlerFollowUpRoundLimitHint:"达到上限后,助手会停止自动续接,避免无限扩展会话。",butlerCurrentFollowUpLabel:"当前跟进任务",butlerCurrentFollowUpProgress:"已自动推进 {current} / {max} 轮",butlerStopFollowUpAction:"停止当前跟进",butlerFollowUpObjectiveRequired:"请先写清楚这次希望助手持续推动的目标",butlerVerificationAction:"发起开发验证",butlerVerificationActionDescription:"让助手从用户视角对当前会话对应功能发起一次验证。",butlerFollowUpStarted:"已交给助手继续跟进",butlerFollowUpStartedDescription:"助手会继续跟进 {projectName} 的当前开发会话。",butlerFollowUpFailed:"助手跟进启动失败",butlerFollowUpStopped:"已停止当前助手跟进",butlerFollowUpStoppedDescription:"当前会话的自动跟进已经停止,不会继续自动续接。",butlerFollowUpStopFailed:"停止助手跟进失败",butlerVerificationStarted:"已发起开发验证",butlerVerificationStartedDescription:"助手会对 {projectName} 发起一次开发验证。",butlerVerificationFailed:"开发验证启动失败",butlerAnalysisTitle:"助手分析过程",butlerAnalysisLoadFailed:"读取助手分析失败",butlerAnalysisObjectiveLabel:"当前目标",butlerAnalysisStatusLabel:"当前判断",butlerAnalysisSummaryLabel:"最近分析",butlerAnalysisWaitingReasonLabel:"等待原因",butlerAnalysisEmpty:"当前还没有可展示的助手分析记录。",butlerProxyMessageBadge:"代理发送",butlerOriginDetailTitle:"对应的助手跟进",butlerOriginDetailLoading:"正在读取对应的助手跟进记录...",butlerOriginDetailLoadFailed:"读取对应的助手跟进记录失败",butlerOriginDetailObjectiveLabel:"跟进目标",butlerOriginDetailStatusLabel:"当前状态",butlerOriginDetailSummaryLabel:"最近分析",butlerOriginDetailWaitingReasonLabel:"等待原因",thinkingLabel:"思考中",filePanelWorkspaceTab:"工作区",filePanelSessionTab:"本次会话",filePanelSessionViewLabel:"本次会话视图",filePanelSessionTreeView:"树状",filePanelSessionListView:"列表",filePanelSessionLoading:"正在整理本次会话修改的文件...",filePanelSessionEmpty:"这条会话还没识别到可暂存的修改文件。",filePanelSessionNoSession:"当前只选中了项目,还没选中会话,无法查看“本次会话”文件。",filePanelSessionStageAll:"全部暂存",filePanelSessionStageSuccess:"已把本次会话的修改加入暂存区。",filePanelSessionLoadFailed:"本次会话修改文件加载失败。",filePanelSessionSummary:"已识别文件",filePanelSessionUnstagedSummary:"未暂存",filePanelSessionDeleted:"已删除",filePanelOpenExternalWindow:"在新窗口打开",filePanelOpenExternalFailed:"打开文件外部窗口失败。"},desktopWindow:{invalidWindowId:"缺少窗口 ID,无法加载外部窗口。",loadDescriptorFailed:"读取窗口描述失败。",unsupportedKind:"暂不支持渲染 {kind} 窗口。"},git:{recentVersionsTitle:"最近版本",stagedChangesTitle:"暂存的更改",expandRecentVersions:"展开最近版本",collapseRecentVersions:"折叠最近版本",stagedLabel:"暂存区",workingTreeLabel:"工作区",changeTreeHint:"按目录层级展示当前变更",discard:"放弃改动",discardFailed:"放弃改动失败",operationMenu:"操作菜单",currentBranch:"当前分支",resizePanels:"调整文件区和最近版本高度",switchBranchTo:"切换到",undoLastCommit:"撤销上次提交",undoLastCommitFailed:"撤销上次提交失败",undoLastCommitSuccess:"已撤销上次提交",historyKindLocal:"本地",historyKindRemote:"远程",historyKindShared:"已同步",pushNow:"推送",commitNow:"提交",refreshNow:"刷新",openExternalWindow:"在新窗口打开 Git",openExternalFailed:"打开 Git 外部窗口失败。",stageAll:"暂存全部",unstageAll:"取消暂存全部",discardAll:"放弃全部改动",selectedFiles:"已选文件",clearSelection:"清空选中",selectFile:"选中文件",discardConfirm:"确认放弃这些改动吗?{path}",historyItemMenu:"版本操作",copyCommitHash:"复制 Commit Hash",copyCommitHashSuccess:"Commit Hash 已复制。",copyCommitSubject:"复制提交标题",copyCommitSubjectSuccess:"提交标题已复制。"},terminalManager:{workspaceField:"当前工作区",refresh:"刷新列表",loadFailed:"终端管理面板加载失败",shellLoadFailed:"终端 Shell 列表加载失败",emptyWorkspaceBody:"还没有可用工作区。",noCurrentWorkspaceBody:"先选中一条会话,进程管理才能绑定对应的工作区。",emptyTerminalBody:"当前工作区还没有终端实例。",emptyTemplateBody:"还没有快捷启动项,可以先保存一条命令或脚本。",shellField:"新终端 Shell",shellUnavailable:"当前不可用",cwdField:"启动目录",cwdLabel:"目录",cwdPlaceholder:"留空时默认使用工作区根目录",modeField:"启动方式",commandMode:"命令",scriptMode:"脚本",quickLaunchTitle:"快捷启动",quickLaunchDescription:"先保存启动方式,需要时一键拉起到新终端。",desktopPanelDescription:"默认只看启动决策所需的信息,路径和命令行收进详情层。",openExternalWindow:"在新窗口打开",openExternalFailed:"打开进程管理外部窗口失败。",runningCountLabel:"运行中",portWatchCountLabel:"已监控端口",terminalCountLabel:"终端数",templateSectionTitle:"启动项",templateSectionDescription:"右侧优先显示启动项的端口状态,看清楚是否已被占用。",openCreateModalAction:"添加快捷启动项",createModalTitle:"添加快捷启动项",createModalDescription:"在这里保存命令或脚本,可以附带端口,后面就能一键启动并判断是否在跑。",editAction:"编辑启动项",editModalTitle:"编辑快捷启动项",editModalDescription:"直接修改这条快捷启动的名称、命令、目录和端口配置。",saveTemplateChangesAction:"保存修改",templateUpdating:"保存修改中...",templateUpdateSuccess:"快捷启动项已更新。",templateUpdateFailed:"快捷启动项更新失败",removeAction:"移除启动项",templateRemoving:"移除中...",removeConfirmTitle:"确认移除启动项",removeConfirmAction:"确认移除",removeConfirmTarget:"确认移除“{name}”吗?移除后将不再出现在快捷启动列表中。",removeRunningConfirmTarget:"“{name}”对应的进程还在跑。现在移除的是启动项配置,不会自动结束已经运行的进程。确认继续吗?",templateDeleteSuccess:"快捷启动项已移除。",templateDeleteFailed:"快捷启动项移除失败",terminalSectionTitle:"终端实例",terminalSectionDescription:"这里显示当前工作区由 CodingNS 托管的终端。",closeAction:"关闭终端",closing:"关闭中...",closeSuccess:"终端关闭请求已提交。",closeFailed:"终端关闭失败",createTerminalAction:"新建空终端",creatingTerminal:"创建中...",createTerminalSuccess:"新终端已创建。",createTerminalFailed:"新终端创建失败",defaultTerminalName:"工作终端",templateNameField:"名称",templateNamePlaceholder:"留空时会自动生成",commandField:"启动命令",commandPlaceholder:"例如:npm",scriptPathField:"脚本路径",scriptPathPlaceholder:"例如:scripts/dev.ps1 或 scripts/dev.sh",argsField:"参数",argsPlaceholder:"例如:run dev 或 --watch",portField:"监听端口",portLabel:"端口",portPlaceholder:"例如:3000",proxyField:"反向代理",proxyToggleLabel:"开启反向代理",proxyEnabled:"代理已启用",proxyEnabledDescription:"开启后会生成随机 URL 码,可通过 /proxy/地址访问当前开发服务。",proxyDisabledDescription:"未开启反向代理",proxyPortRequired:"开启反向代理时,必须同时配置端口",openProxyUrlAction:"在浏览器打开代理地址",openProxyUrlFailed:"打开代理地址失败",invalidPort:"端口必须是 1 到 65535 的整数",saveLaunchAction:"保存为快速启动",templateSaving:"保存中...",templateSaveSuccess:"快捷启动项已保存。",templateSaveFailed:"快捷启动项保存失败",runTemplateAction:"启动到新终端",runningTemplate:"启动中...",templateRunSuccess:"快捷启动已发送到新终端。",templateRunFailed:"快捷启动执行失败",showDetailsAction:"显示详细信息",hideDetailsAction:"隐藏详细信息",detailsSectionTitle:"启动项详情",commandPreviewLabel:"启动命令",processIdLabel:"进程 ID",processCommandLabel:"进程命令行",stopProcessAction:"结束进程",stoppingProcess:"结束中...",stopProcessSuccess:"监听进程已结束。",stopProcessFailed:"监听进程结束失败",defaultCommandName:"新启动命令",defaultScriptName:"新启动脚本",lastActiveAt:"最近活跃",updatedAt:"最后更新",processCommandFallback:"这个进程没有暴露命令行",portUnset:"未配置端口",portUnsetDescription:"没有端口时,只能启动,不能自动判断服务是否在跑。",portOccupied:"进程已启动",portAvailable:"端口暂未被占用",portAvailableDescription:"这个启动项对应的端口目前还没有监听进程。",statusRunning:"运行中",statusStopped:"未运行",exitCode:"Exit Code",runningValue:"运行中"},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"主题"}},nI={common:{close:"Close",cancel:"Cancel",logout:"Log out",language:"Language"},locale:{zhCN:"Simplified Chinese",enUS:"English"},settings:{title:"Settings",appearance:"Appearance",language:"Language",languageDescription:"Choose the display language used by the interface. The page updates immediately.",theme:"Theme",themeDescription:"Choose the color theme that fits the way you work.",connection:"Connection & Updates",serverAddress:"Server Address",serverDescription:"Desktop and H5 both work through this host entry.",releaseChannel:"Release Channel",releaseChannelDescription:"Stable or beta",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"Auto Reconnect",autoReconnectDescription:"Retry HTTP and WebSocket links automatically when Host is briefly unavailable.",autoCheckUpdate:"Auto Check Client Updates",autoCheckUpdateDescription:"Clients only",notificationSettings:"Notifications",notificationSettingsDescription:"Control each session-related system notification independently.",notifyOnPermissionRequest:"Notify on permission requests",notifyOnPermissionRequestDescription:"Notify when a background session needs a new permission approval.",notifyOnSessionCompleted:"Notify when sessions complete",notifyOnSessionCompletedDescription:"Notify when a background session finishes.",notifyOnSessionFailed:"Notify when sessions fail",notifyOnSessionFailedDescription:"Notify when a background session fails.",enabled:"Enabled",disabled:"Disabled",serverUpdate:"Server Update",serverUpdateDescription:"",clientUpdate:"Client Update",clientUpdateDescription:"",serverCurrentVersion:"Server Current Version",serverTargetVersion:"Server Target Version",serverPackageName:"npm Package",serverUpdateCommand:"Upgrade Command",serverCheckNow:"Check Server",serverOpenPage:"Open npm",serverLatestUnknown:"Unavailable",serverUpdateReady:"New version found",serverUpToDate:"Up to date",serverCheckFailed:"Check failed",serverOpenPageFailed:"Failed to open page",runtimePlatform:"Runtime Platform",runtimePlatformDescription:"Shows whether the app is running in Web/H5, Desktop, iOS, or Android.",platformDesktop:"Desktop",platformWeb:"Web",platformIos:"iOS",platformAndroid:"Android",releaseDesktopOnly:"Desktop updates are not available in the current Web/H5 runtime.",releaseCurrentVersion:"Current Version",releaseTargetVersion:"Target Version",releaseUnknownVersion:"Unknown",releaseNotes:"What's New",releaseNotesEmpty:"No details",releaseCheckNow:"Check Client",releaseInstallNow:"Install",releaseRollback:"Rollback",releaseUpdateReady:"New version found",releaseUpToDate:"Up to date",releaseCheckFailed:"Check failed",releaseInstallStarted:"Install started",releaseInstallFailed:"Install failed",releaseRollbackStarted:"Rollback started",releaseRollbackFailed:"Rollback failed",clientUpdateUnsupported:"Install updates are not supported here",account:"Account",logout:"Log out",logoutDescription:"Sign out of the current account and return to the login page.",advancedSettings:"Advanced Settings",parallelTaskDebug:"Parallel Task Debug",parallelTaskDebugDescription:"Runtime sampling stays off until you open this panel. Use it to inspect background tasks, schedulers, and main-thread pressure in real time.",parallelTaskDebugAction:"Open Debug Panel",parallelTaskDebugModalTitle:"Parallel Task Debug",parallelTaskDebugModalDescription:"Task activity and event loop sampling only stay active while this window is open. Closing it stops collection immediately.",parallelTaskDebugClose:"Close parallel task debug",parallelTaskDebugLoading:"Opening observability session and loading runtime snapshot...",parallelTaskDebugLoadFailed:"Failed to load parallel task debug information",parallelTaskDebugEmpty:"No execution records are available right now.",parallelTaskDebugStatusActive:"Collecting",parallelTaskDebugStatusError:"Collection Error",parallelTaskDebugObservedAt:"Last Updated",parallelTaskDebugSessionExpireAt:"Session Expires At",parallelTaskDebugSessionTtl:"Session TTL",parallelTaskDebugCollectorState:"Collector State",parallelTaskDebugCollectorEnabled:"Enabled",parallelTaskDebugCollectorDisabled:"Disabled",parallelTaskDebugAutoRefresh:"Auto refresh every second",parallelTaskDebugCountersTitle:"Overall Counters",parallelTaskDebugTaskMetricsTitle:"Background Task Metrics",parallelTaskDebugSchedulerTitle:"Scheduler Metrics",parallelTaskDebugEventLoopTitle:"Event Loop",parallelTaskDebugRecentActivitiesTitle:"Recent Execution Records",parallelTaskDebugWaitAvg:"Average Wait",parallelTaskDebugRunAvg:"Average Run",parallelTaskDebugRunMax:"Longest Run",parallelTaskDebugStartedCount:"Started",parallelTaskDebugFinishedCount:"Finished",parallelTaskDebugFailedCount:"Failed",parallelTaskDebugCacheHitCount:"Cache Hits",parallelTaskDebugIdle:"Idle",parallelTaskDebugBusy:"Busy",parallelTaskDebugTickTotal:"Tick Total",parallelTaskDebugIdleTickTotal:"Idle Ticks",parallelTaskDebugTaskCountTotal:"Task Hits",parallelTaskDebugSchedulerErrorTotal:"Errors",parallelTaskDebugLastDuration:"Last Duration",parallelTaskDebugNextDelay:"Next Delay",parallelTaskDebugEventLoopResolution:"Resolution",parallelTaskDebugEventLoopMean:"Mean Delay",parallelTaskDebugEventLoopP95:"P95 Delay",parallelTaskDebugEventLoopP99:"P99 Delay",parallelTaskDebugEventLoopMax:"Max Delay",parallelTaskDebugTaskKey:"Task Key",parallelTaskDebugStatus:"Status",parallelTaskDebugAttempt:"Attempt",parallelTaskDebugWaitMs:"Wait",parallelTaskDebugRunMs:"Run",parallelTaskDebugSource:"Source",parallelTaskDebugError:"Error",parallelTaskDebugMetricEnqueue:"Enqueue",parallelTaskDebugMetricDedupe:"Dedupe",parallelTaskDebugMetricStarted:"Started",parallelTaskDebugMetricFinished:"Finished",parallelTaskDebugMetricFailed:"Failed",parallelTaskDebugMetricCancelled:"Cancelled",parallelTaskDebugMetricTimeout:"Timeout",parallelTaskDebugMetricCacheHit:"Cache Hit",parallelTaskDebugLaneRequestMainThread:"Request Main Thread",parallelTaskDebugLaneHostBackground:"Host Background",parallelTaskDebugLaneHelperProcess:"Helper Process",parallelTaskDebugLaneExternalProcess:"External Process",parallelTaskDebugEventEnqueued:"Enqueued",parallelTaskDebugEventDeduped:"Deduped",parallelTaskDebugEventStarted:"Started",parallelTaskDebugEventFinished:"Finished",parallelTaskDebugEventFailed:"Failed",parallelTaskDebugEventCancelled:"Cancelled",parallelTaskDebugEventTimeout:"Timeout",parallelTaskDebugEventCacheHit:"Cache Hit",parallelTaskDebugTaskStatusQueued:"Queued",parallelTaskDebugTaskStatusRunning:"Running",parallelTaskDebugTaskStatusSucceeded:"Succeeded",parallelTaskDebugTaskStatusFailed:"Failed",parallelTaskDebugTaskStatusCancelled:"Cancelled",parallelTaskDebugTaskStatusTimeout:"Timeout"},shell:{title:"Workbench",subtitle:"Manage AI sessions inside code projects",mobileWorkspacesEntry:"Workspaces",mobileTerminalsEntry:"Terminal",mobileSessionsEntry:"Conversation",mobileToolsEntry:"Tools",mobileSettingsEntry:"Settings",mobileNavigationAction:"Open workbench menu",mobileSearchAction:"Open search",mobileAuxiliaryAction:"Open tools panel",mobileRevealNavigationAction:"Show primary navigation",mobileHideNavigationAction:"Hide primary navigation",mobileConversationPreviewTitle:"Quick Preview",mobileConversationCurrentWorkspaceSection:"Current Workspace",mobileConversationCollapsePreviewAction:"Hide Preview",mobileConversationRestorePreviewAction:"Restore Session Preview",iosMoreAction:"More actions",androidMoreAction:"More actions",conversationEntry:"Conversation",terminalsEntry:"Terminal",butlerEntry:"Butler",globalNotificationsAction:"Notifications",globalNotificationsUnreadAria:"{count} unread notifications",globalNotificationsPanelTitle:"Notification Center",globalNotificationsPanelDescription:"Review items waiting for your decision, completed follow-ups, failed follow-ups, and failed verifications.",globalNotificationsEmpty:"There are no new global notifications right now.",globalNotificationsShowArchived:"Show archived notifications",globalNotificationsArchiveAction:"Archive",globalNotificationsRemoveArchiveAction:"Remove Archive",globalNotificationsArchiveFailed:"Failed to update notification archive state",globalNotificationKindWaitingUser:"Waiting for You",globalNotificationKindFollowUpFailed:"Follow-up Failed",globalNotificationKindFollowUpCompleted:"Follow-up Completed",globalNotificationKindVerificationFailed:"Verification Failed",globalNotificationFollowUpWaitingTitle:"Needs your decision: {title}",globalNotificationFollowUpFailedTitle:"Follow-up failed: {title}",globalNotificationFollowUpCompletedTitle:"Follow-up completed: {title}",globalNotificationVerificationFailedTitle:"Verification failed: {title}",globalNotificationVerificationFailedFallback:"The latest verification did not pass. Please review it soon.",searchEntry:"Search",butlerInitTitle:"Initialize Butler",butlerInitDescription:"Set the Butler name, provider, and work style first. The dedicated workspace and first AGENTS.md will be created automatically.",butlerInitPreviewTitle:"Live Preview",butlerInitPreviewDescription:"These choices directly shape the first rule set, so show the result instead of dumping a plain form.",butlerInitBasicsTitle:"Basics",butlerInitBasicsDescription:"Lock in the name, provider, and rule storage first so initialization does not become config soup.",butlerInitPersonaTitle:"Expression Style",butlerInitPersonaDescription:"Tone, language, and summary style decide how Butler speaks, not whether it gets to be sloppy.",butlerInitPreferenceTitle:"Default Priorities",butlerInitPreferenceDescription:"This decides which risks Butler watches first and what it surfaces first in reports.",butlerInitRuleLabel:"Rule Format",butlerInitTipAutoWorkspace:"The system creates the Butler workspace and first AGENTS.md automatically, so you only set the defaults here.",butlerInitTipProviderSwitch:"You can switch provider later, so do not overthink the first initialization pass.",butlerInitTipReportPriority:"Report priority changes whether Butler leads with risk, blockers, or verification results.",butlerDisplayNameLabel:"Butler Name",butlerDisplayNamePlaceholder:"Example: Arvin, Butler",butlerDisplayNameHint:"This is the Butler's self-name. The system writes it into the first generated AGENTS.md.",butlerProviderLabel:"Provider",butlerWorkspacePathLabel:"Butler Workspace Path",butlerWorkspacePathPlaceholder:"Example: /Users/you/WorkFile/butler-home",butlerAgentsModeLabel:"AGENTS Mode",butlerAgentsModeInline:"Inline",butlerAgentsModeFile:"File",butlerAgentsModeInlineDescription:"Inline: the system generates rules from your initialization choices and manages them for you.",butlerAgentsModeFileDescription:"File: the system writes AGENTS.md into the Butler workspace so you can edit the file directly later.",butlerAgentsFilePathLabel:"AGENTS.md File Path",butlerAgentsFilePathPlaceholder:"Example: /Users/you/WorkFile/butler-home/AGENTS.md",butlerAgentsContentLabel:"AGENTS Instructions",butlerAgentsContentPlaceholder:"Describe the Butler's work rules and response style",butlerAgentsContentHint:"Maintain Butler's formal rules here. Saving will write back to the dedicated AGENTS.md or inline instructions.",butlerPersonaToneLabel:"Tone",butlerPersonaLanguageLabel:"Language",butlerPersonaSummaryStyleLabel:"Summary Style",butlerFocusRiskPreferenceLabel:"Risk Preference",butlerFocusReportPriorityLabel:"Report Priorities (comma-separated)",butlerFocusReportPriorityPlaceholder:"Example: risk,blocker,verification",butlerToneDirect:"Direct and Clear",butlerToneSteady:"Steady and Controlled",butlerToneFriendly:"Friendly and Patient",butlerLanguageZhCn:"Chinese First",butlerLanguageEnUs:"English First",butlerLanguageBilingual:"Bilingual",butlerSummaryBrief:"Brief",butlerSummaryStructured:"Structured",butlerSummaryThorough:"Thorough",butlerRiskConservative:"Conservative",butlerRiskBalanced:"Balanced",butlerRiskProactive:"Proactive",butlerReportPriorityPresetLabel:"Report Priority",butlerReportRiskFirst:"Risk First",butlerReportBlockerFirst:"Blockers First",butlerReportVerificationFirst:"Verification First",butlerReportProgressFirst:"Progress First",butlerSummaryDebounceLabel:"Session Summary Debounce",butlerSummaryDebounceOption1Minute:"1 minute",butlerSummaryDebounceOption3Minutes:"3 minutes",butlerSummaryDebounceOption5Minutes:"5 minutes (default)",butlerSummaryDebounceOption10Minutes:"10 minutes",butlerSummaryDebounceOption15Minutes:"15 minutes",butlerSummaryDebounceOption30Minutes:"30 minutes",butlerSettingsTitle:"Butler Settings",butlerSettingsSaveAction:"Save Settings",butlerSettingsSaving:"Saving...",butlerSettingsSaved:"Butler settings saved",butlerSettingsSaveFailed:"Failed to save Butler settings",butlerInitSubmitting:"Initializing...",butlerInitSubmit:"Initialize Butler",butlerInitSuccess:"Butler initialized",butlerInitFailed:"Failed to initialize Butler",butlerInitNameRequired:"Butler name is required",butlerInitWorkspaceRequired:"Butler workspace path is required",butlerInitAgentsFileRequired:"AGENTS.md path is required in file mode",butlerWorkbenchTitle:"Butler Workbench",butlerWorkbenchSubtitle:"Chat with Butler here and review aggregated context with action events.",butlerWorkspaceHint:"Butler workspace: {workspacePath}",butlerDisplayNameActiveHint:"Current Butler name: {displayName}",butlerNewSessionAction:"New Session",butlerNewSessionStarted:"Started a fresh Butler session",butlerNewSessionFailed:"Failed to start a fresh Butler session",butlerRefreshAction:"Refresh",butlerLoadingTitle:"Loading Butler",butlerLoadingDescription:"Pulling the current assistant session, summaries, and control state. Please wait a moment.",butlerSidebarInfoTab:"Info",butlerSidebarAutomationTab:"Automation",butlerSidebarSettingsTab:"Settings",butlerSidebarTabsLabel:"Butler sidebar tabs",butlerSidebarLoadFailed:"Failed to load Butler sidebar",butlerInfoContextTitle:"Current Context",butlerInfoContextDescription:"Show only what the Butler is using in this round, without flooding the panel with unrelated details.",butlerInfoCurrentScopeLabel:"Current Scope",butlerInfoCurrentScopeProject:"Project: {projectName}",butlerInfoCurrentScopeGlobal:"Global Overview",butlerInfoManagedProjectsLabel:"Tracked Projects",butlerInfoManagedProjectsValue:"Active {activeCount} / Total {totalCount}",butlerInfoCurrentContextProjectHint:"{projectName} is selected, so follow-up lookups will stay centered on this project first.",butlerInfoCurrentContextGlobalHint:"The Butler is still in global view. It only drills down when you pick a project or ask for details.",butlerInfoProjectSelectedAction:"Currently Selected",butlerInfoProjectViewAction:"View Project",butlerInfoProjectBlockedBadge:"Blocked",butlerInfoProjectRiskBadge:"Risk: {riskLevel}",butlerInfoProjectRiskShortBadge:"Risk {riskLevel}",butlerInfoProjectLastActivityBadge:"Active: {updatedAt}",butlerInfoLatestSessionAction:"Open Latest Session",butlerInfoProgressTitle:"Current Progress",butlerInfoAttentionTitle:"Watch For",butlerInfoNextStepTitle:"Next Step",butlerInfoFollowUpRecordsTitle:"Follow-up Records",butlerInfoFollowUpRecordsDescription:"Only the latest 5 follow-up states are shown here; open the full history for more.",butlerInfoFollowUpRecordsEmpty:"No follow-up records yet.",butlerInfoFollowUpUntitled:"Untitled Session",butlerInfoFollowUpFallback:"Last updated: {updatedAt}",butlerFollowUpHistoryAction:"View History",butlerFollowUpHistoryTitle:"Follow-up History",butlerFollowUpHistoryDescription:"Review the complete follow-up status history and continue drilling into round details.",butlerInfoVerificationRecordsTitle:"Verification Records",butlerInfoVerificationRecordsDescription:"A global view of feature verification records.",butlerInfoVerificationRecordsEmpty:"No verification records yet.",butlerInfoVerificationFallback:"Current status: {status}",butlerInfoTodoRecordsTitle:"Todo Progress",butlerInfoTodoRecordsDescription:"A global view of current todo progress.",butlerInfoTodoRecordsEmpty:"No todo progress records yet.",butlerInfoTodoItemTitle:"Todo {index}",butlerInfoTodoPending:"Pending",butlerInfoTodoInProgress:"In Progress",butlerInfoTodoClosed:"Closed",butlerAutomationTasksTitle:"Automation Tasks",butlerAutomationTasksDescription:"Only automation tasks live here: what exists, what state it is in, and when it runs next.",butlerAutomationTasksEmpty:"No automation tasks yet.",butlerAutomationRunsTitle:"Recent Automation Runs",butlerAutomationRunsDescription:"This view only shows recent automation executions and their outcomes.",butlerAutomationRunsEmpty:"No automation run records yet.",butlerAutomationStatusActive:"Running",butlerAutomationStatusWaitingUser:"Waiting for You",butlerAutomationStatusCompleted:"Completed",butlerAutomationStatusFailed:"Failed",butlerAutomationStatusCancelled:"Cancelled",butlerAutomationTaskTypeLabel:"Task type",butlerAutomationTaskTypeManual:"Manual plan task",butlerAutomationTaskTypeInterval:"Scheduled plan task",butlerAutomationTaskTypeCron:"Cron plan task",butlerAutomationTaskTypeFollowUp:"Conditional follow-up task",butlerAutomationTaskEnabled:"Enabled",butlerAutomationTaskDisabled:"Disabled",butlerAutomationTaskLastRunLabel:"Last run",butlerAutomationTaskNextRunLabel:"Next run",butlerAutomationRunSourceLabel:"Source",butlerAutomationRunSourcePatrol:"Plan task run",butlerAutomationRunSourceFollowUp:"Conditional follow-up run",butlerAutomationRunSummaryLabel:"Outcome",butlerAutomationRunProcessedAtLabel:"Processed at",butlerAutomationRunEmptySummary:"No summary was returned for this run.",butlerAutomationPatrolRunTitle:"Patrol Task Run",butlerAutomationViewRoundsAction:"View Round Details",butlerAutomationRoundDetailsTitle:"Follow-up Round Details",butlerAutomationRoundDetailsDescription:"Review each Butler follow-up round for this task.",butlerAutomationRoundLoading:"Loading follow-up round details...",butlerAutomationRoundLoadFailed:"Failed to load follow-up round details",butlerAutomationRoundEmpty:"There are no follow-up round details yet.",butlerAutomationRoundLabel:"Round {round}",butlerAutomationRoundProcessedAtLabel:"Processed at",butlerAutomationRoundStatusLabel:"Task status",butlerAutomationRoundObservedStateLabel:"Session runtime state",butlerAutomationRoundSummaryLabel:"Round decision",butlerAutomationRoundWaitingReasonLabel:"Waiting reason",butlerAutomationRoundPromptLabel:"Proxy-sent content",butlerAutomationRoundKindStarted:"Follow-up started",butlerAutomationRoundKindContinue:"Resumed immediately",butlerAutomationRoundKindQueued:"Queued for send",butlerAutomationRoundKindWaitingUser:"Waiting for user",butlerAutomationRoundKindCompleted:"Marked completed",butlerAutomationRoundKindFailed:"Follow-up failed",butlerAutomationRoundKindCancelled:"Stopped manually",butlerAutomationRoundKindLimitReached:"Round limit reached",butlerInboxAction:"Inbox",butlerInboxModalTitle:"Inbox",butlerInboxModalDescription:"Track project todos here and keep their current progress tied to real projects.",butlerInboxLoading:"Loading inbox...",butlerInboxLoadFailed:"Failed to load inbox",butlerInboxProjectsEmpty:"No managed project is available to bind yet.",butlerInboxEmpty:"No inbox records yet.",butlerInboxCreateTitle:"Add Todo",butlerInboxEditingTitle:"Edit Todo",butlerInboxFormDescription:"Every todo must be bound to a project so the assistant can keep following it later.",butlerInboxListTitle:"Current Todos",butlerInboxListDescription:"This list shows todos across your managed projects so you can handle them in one place.",butlerInboxProjectLabel:"Project",butlerInboxTypeLabel:"Type",butlerInboxTitleLabel:"Title",butlerInboxTitlePlaceholder:"For example: Finish login captcha flow",butlerInboxContentLabel:"Details",butlerInboxContentPlaceholder:"Describe the current issue, target, or what you want the assistant to keep pushing forward.",butlerInboxStatusLabel:"Progress",butlerInboxTypeTask:"Task",butlerInboxTypeBug:"Bug",butlerInboxTypeFeature:"Feature",butlerInboxTypeChange:"Change",butlerInboxStatusPending:"Pending",butlerInboxStatusInProgress:"In Progress",butlerInboxStatusClosed:"Closed",butlerInboxCreateAction:"Add Todo",butlerInboxUpdateAction:"Save Changes",butlerInboxCancelEditAction:"Cancel Edit",butlerInboxEditAction:"Edit",butlerInboxDeleteAction:"Delete",butlerInboxCreated:"Todo created",butlerInboxUpdated:"Todo updated",butlerInboxDeleted:"Todo deleted",butlerInboxSaveFailed:"Failed to save todo",butlerInboxDeleteFailed:"Failed to delete todo",butlerProviderSwitched:"Provider switched",butlerProviderSwitchedDescription:"Switched to {provider}. The current view was reset and reloaded.",butlerProviderSwitchFailed:"Failed to switch provider",butlerAttachmentUnsupported:"Attachments are not supported in Butler chat yet",butlerOverviewTitle:"Overview",butlerOverviewDescription:"This area pulls together the most important things to pay attention to right now.",butlerMetricProjectCount:"Projects",butlerMetricBlockedCount:"Blocked",butlerMetricHighRiskCount:"High Risk",butlerTopRisksTitle:"Top Risks",butlerNextActionsTitle:"Next Actions",butlerOverviewEmpty:"No data",butlerOverviewLoading:"Loading Butler context summary...",butlerEventsTitle:"Recent Actions",butlerEventsDescription:"Anything Butler just helped you do is listed here.",butlerEventsEmpty:"No action events yet",butlerLoadFailed:"Failed to load Butler workbench",butlerContextStrategyTitle:"Context On Demand",butlerContextStrategyDescription:"Butler only receives the global summary by default. Project sessions, memories, patrols, and verifications are fetched from the backend only after you drill into a specific project.",butlerConversationTitle:"Talk to Butler",butlerConversationDescription:"This conversation belongs to {displayName} only. When details are needed, {displayName} answers from the aggregated summary first, then pulls the relevant project, session, patrol, or verification data from the backend on demand.",butlerComposerPlaceholder:"Tell {displayName} what you want to inspect or decide next",butlerProjectsTitle:"Projects",butlerProjectsDescription:"Pick a project here and Butler will continue with its latest progress and records.",butlerProjectsEmpty:"No projects available for drilldown",butlerProjectWorkspaceLabel:"Workspace: {workspaceId}",butlerProjectSummaryEmpty:"No summary available yet",butlerProjectOpenDetailAction:"Open Details",butlerProjectSyncAction:"Sync to Timeline",butlerProjectSyncSucceeded:"Project {projectName} was synced into Butler's timeline",butlerProjectActionRequiresSession:"Send Butler a message first, then ask it to continue working on a project.",butlerProjectContextTitle:"Current Project",butlerProjectContextDescription:"This area shows the sessions, records, and results tied to the project you selected.",butlerProjectContextEmpty:"Pick a project from the list or action events first.",butlerProjectContextLoading:"Loading project-related context...",butlerProjectContextMeta:"Project status: {status} · Risk level: {riskLevel}",butlerProjectActionSucceeded:"Butler action completed",butlerProjectActionFailed:"Butler action failed",butlerProjectActionPending:"Processing...",butlerProjectSessionsTitle:"Project Sessions",butlerProjectMemoriesTitle:"Project Memories",butlerProjectPatrolsTitle:"Patrol Runs",butlerProjectVerificationsTitle:"Verification Runs",butlerProjectOpenConversationAction:"Open Real Session",butlerProjectResumeAction:"Resume Session",butlerProjectResumeSucceeded:"Session resumed: {sessionTitle}",butlerProjectStartPatrolAction:"Start Patrol",butlerProjectPatrolSucceeded:"Started a patrol for {projectName}",butlerProjectStartVerificationAction:"Start Verification",butlerProjectVerificationSucceeded:"Started a verification for {projectName}",butlerProjectMemoryMeta:"Type: {memoryType} · Status: {status}",butlerProjectSessionMeta:"Role: {role} · Status: {status}",butlerProjectPatrolMeta:"Status: {status} · Risk: {riskLevel}",butlerProjectVerificationMeta:"Type: {verificationType} · Status: {status}",butlerProjectRunSummaryEmpty:"No summary yet",butlerProjectFocusAction:"Focus This Record",butlerProjectUpdatedAtLabel:"Updated: {updatedAt}",butlerFocusedBadge:"Focused",searchModalTitle:"Search",searchModalDescription:"Search sessions by title, or search code files inside the selected workspace.",searchModeLabel:"Search mode",searchModeSessions:"Sessions",searchModeCode:"Code",searchKeywordLabel:"Keyword",searchWorkspaceLabel:"Workspace",searchSessionPlaceholder:"Search by session title, workspace, or provider",searchCodePlaceholder:"Search by file name or path fragment",searchSessionHint:"Type a keyword to instantly filter matching sessions.",searchCodeHint:"Pick a workspace, then search by file name or path.",searchSessionEmpty:"No matching sessions found.",searchCodeEmpty:"No matching files found.",searchCodeFailed:"Code search failed. Please try again later.",searchSubmit:"Search",filesEntry:"Files",gitEntry:"Git",terminalManagerEntry:"Process Manager",workspaceSectionTitle:"Workspaces",goBack:"Back",goForward:"Forward",workspaceCount:"Projects",sessionCount:"Sessions",manageWorkspaceAction:"Manage Projects",manageWorkspaceTitle:"Manage Projects",manageWorkspaceDescription:"The list starts with the currently loaded projects. Expand one to inspect its path, Git summary, and code composition, or remove it from the current workbench list.",manageWorkspaceEmpty:"There are no projects to manage right now.",manageWorkspaceLoading:"Loading project details...",manageWorkspaceLoadFailed:"Failed to load project details.",manageWorkspacePathLabel:"Path",manageWorkspaceGitCommitCount:"Git Commit Count",manageWorkspaceGitInfoLabel:"Git Repository Info",manageWorkspaceRepoRoot:"Repository Root",manageWorkspaceCurrentBranch:"Current Branch",manageWorkspaceRemoteLabel:"Remote",manageWorkspaceNoRemote:"No remote configured",manageWorkspaceNotGit:"This project is not a Git repository.",manageWorkspaceCodeCompositionLabel:"Code Composition",manageWorkspaceCodeCompositionFiles:"files",manageWorkspaceCodeCompositionOther:"Other",manageWorkspaceNoCodeComposition:"No recognizable code files were found for composition stats.",manageWorkspaceCodeTruncated:"The project is large, so only the first {count} recognizable files were counted.",manageWorkspaceColorLabel:"Background Color",manageWorkspaceColorSelectSwatch:"Use color {color}",manageWorkspaceColorClearAction:"Clear Color",manageWorkspaceColorUnset:"Not set. The default worktree color is in use.",manageWorkspaceColorSaveFailed:"Failed to save the workspace color.",manageWorkspaceRemoveAction:"Remove Project",manageWorkspaceRemoving:"Removing...",manageWorkspaceRemoveSuccess:"Project removed from the current workbench list",manageWorkspaceRemoveFailed:"Failed to remove the project",manageWorkspaceRemoveConfirmTitle:"Confirm Project Removal",manageWorkspaceRemoveConfirmDescription:"This only removes the project from the current workbench list. It does not delete any files on disk or historical records. If you load the same path again later, the old records will appear again.",manageWorkspaceRemoveConfirmTarget:'Remove "{name}" from the current workbench?',manageWorkspaceRemoveConfirmAction:"Remove Project",importWorkspaceTitle:"Add Project",importWorkspaceHint:"Import a local code directory",importExpand:"Expand",importCollapse:"Collapse",importPathLabel:"Project Path",importPathPlaceholder:"Enter the project folder path",importNameLabel:"Project Name",importNamePlaceholder:"Optional",importSubmit:"Add Project",importSubmitting:"Adding...",importChooseFolder:"Choose Folder",importPickFolderFailed:"Failed to open the folder picker",importDesktopDropHint:"You can drag a local project folder directly into this area",importHint:"Enter a local code directory and start working",importServerDirectoryHint:"Browse and select the project directory on the server",importBrowserTitle:"Select Server Directory",importBrowserDescription:"You are browsing directories on the server, not on the current device.",importBrowserCurrentPath:"Current Path",importBrowserRoots:"Root Directories",importBrowserOpenParent:"Go Up",importBrowserOpenPath:"Open Path",importBrowserCreateDirectory:"New Folder",importBrowserCreateDirectoryTitle:"New Folder",importBrowserCreateDirectoryDescription:"Create a single child folder in the current server path. Path separators are not accepted.",importBrowserCreateDirectoryLabel:"Folder Name",importBrowserCreateDirectoryPlaceholder:"Enter the new folder name",importBrowserCreateDirectorySuccess:"Folder created",importBrowserCreateDirectoryFailed:"Failed to create folder",importBrowserCreateDirectorySubmit:"Create Folder",importBrowserCreatingDirectory:"Creating...",importBrowserEmpty:"No subdirectory is available in the current path",importBrowserBrowseFailed:"Failed to load server directories",importBrowserSubmit:"Import Current Directory",importPathRequired:"Enter the project path",importSuccess:"Project added",importFailed:"Failed to add project",cloneWorkspaceTitle:"Clone Project",cloneWorkspaceHint:"Clone a Git repository into a server directory and add it to the project list.",cloneSubmit:"Clone Project",cloneSubmitting:"Cloning...",cloneRepositoryLabel:"Git Repository URL",cloneRepositoryPlaceholder:"For example: https://github.com/org/repo.git",cloneParentPathLabel:"Target Parent Directory",cloneParentPathPlaceholder:"Choose an existing directory on the backend server",cloneDirectoryNameLabel:"New Project Directory Name",cloneDirectoryNamePlaceholder:"Defaults to the repository name when left empty",clonePickDirectory:"Choose Directory",cloneAuthModeLabel:"Authentication",cloneAuthModeNone:"No Authentication",cloneAuthModeBasic:"Username + Password",cloneAuthModeToken:"Token",cloneUsernameLabel:"Username",cloneUsernamePlaceholder:"Enter Git username",clonePasswordLabel:"Password",clonePasswordPlaceholder:"Enter Git password",cloneTokenLabel:"Token",cloneTokenPlaceholder:"Enter access token",cloneTokenUsernamePlaceholder:"Optional, defaults to git when left empty",cloneRepoRequired:"Enter the Git repository URL",clonePathRequired:"Select the target parent directory",cloneSuccess:"Project cloned successfully",cloneFailed:"Clone failed",cloneHint:"The target parent directory must already exist. Clone creates a new repository folder under it.",cloneBrowserTitle:"Select Clone Parent Directory",cloneBrowserDescription:"Choose an existing server-side parent directory. Clone will create a new project folder under it.",cloneBrowserSubmit:"Use Current Directory",refreshNavigation:"Refresh",desktopChromeLabel:"Desktop Workbench",windowMinimize:"Minimize Window",windowMaximize:"Maximize or Restore Window",windowClose:"Close Window",contextOpenSession:"Open Session",navigationLoadFailed:"Load failed. Retry.",emptyNavigationTitle:"No project yet",emptyNavigationBody:"Add a local code directory to start working",emptyWorkspaceSessions:"No sessions",favoriteSectionTitle:"Pinned Sessions",favoriteSectionEmpty:"Pinned sessions stay here for quick access.",worktreeSectionTitle:"Child Worktrees",worktreeSectionExpand:"Expand Child Worktrees",worktreeSectionCollapse:"Collapse Child Worktrees",worktreeMergePanelLabel:"Worktree Merge",worktreeMergePanelTitle:"Merge Into Direct Parent",worktreeMergePreviewAction:"Preview",worktreeMergePreviewRefresh:"Preview",worktreeMergePreviewIdle:"Preview not loaded",worktreeMergePreviewLoading:"Checking...",worktreeMergeReady:"Ready to merge",worktreeMergeBlocked:"Merge blocked",worktreeMergeApplying:"Merging...",worktreeMergeApplyAction:"Merge",worktreeMergeApplySuccess:"The worktree has been merged into its direct parent",worktreeMergeApplyFailed:"Failed to merge worktree",worktreeMergePreviewFailed:"Failed to load merge preview",worktreeMergeAlreadyMerged:"Already merged into parent",worktreeMergeMergedHint:"The code is already back in the parent. Cleanup can be done next.",worktreeMergeMergedDirtyHint:"Committed history is already in the parent, but this worktree still has pending work and cannot be cleaned up yet.",worktreeMergeChecklistTitle:"Merge Checklist",worktreeMergeChecklistSourceState:"Worktree state is valid",worktreeMergeChecklistSourceStateBlocked:"The worktree state is inconsistent. The system is not treating it as an active worktree yet.",worktreeMergeChecklistSourceClean:"Source worktree is clean",worktreeMergeChecklistSourceCleanBlocked:"The source worktree still has uncommitted changes. Commit them first.",worktreeMergeChecklistTargetClean:"Parent workspace is clean",worktreeMergeChecklistTargetCleanBlocked:"The direct parent workspace has uncommitted changes and cannot receive the merge.",worktreeMergeChecklistChildren:"No active child worktrees",worktreeMergeChecklistChildrenBlocked:"There are still active child worktrees under this node. Clean leaf nodes first.",worktreeMergeChecklistCommits:"There are commits to merge",worktreeMergeChecklistCommitsBlocked:"This worktree has no commits ahead of the parent workspace.",worktreeMergeChecklistConflicts:"No merge conflicts detected",worktreeMergeChecklistConflictsBlocked:"Merge conflicts were detected. Resolve them before continuing.",worktreeMergeChecklistResultPending:"Waiting for preview",worktreeMergeChecklistResultReady:"Merge can proceed",worktreeMergeChecklistResultReadyDetail:"All checks passed. You can start the merge now.",worktreeMergeChecklistResultBlocked:"Merge cannot proceed yet",worktreeMergeChecklistResultBlockedDetail:"Resolve the blockers above before continuing.",worktreeMergeChecklistResultMerged:"Merged. Cleanup can continue",worktreeMergeCompactPending:"Pending",worktreeMergeCompactChecking:"Checking",worktreeMergeCompactReady:"Ready",worktreeMergeCompactBlocked:"Blocked",worktreeMergeCompactMerged:"Merged",worktreeMergeCompactMerging:"Merging",worktreeMergeCompactCleaning:"Cleaning",worktreeMergeCompactInactive:"State Error",worktreeMergeCompactDirty:"Dirty",worktreeMergeCompactTargetDirty:"Parent Dirty",worktreeMergeCompactConflict:"Conflict",worktreeMergeCompactChildren:"Has Children",worktreeMergeCompactNoCommits:"No Commits",worktreeCleanupAction:"Cleanup",worktreeCleanupRunning:"Cleaning...",worktreeCleanupSuccess:"The worktree has been cleaned up",worktreeCleanupFailed:"Failed to clean up worktree",worktreeCleanupModalTitle:"Confirm Worktree Cleanup",worktreeCleanupModalDescription:"Cleanup removes the worktree directory and app metadata by default. Deleting the branch is only available after it has been merged into the parent branch.",worktreeCleanupConfirm:"Clean up {name}? The git branch will be kept by default.",worktreeCleanupDeleteBranchLabel:"Also delete branch {branch}",worktreeCleanupDeleteBranchHint:"Branch deletion is only available after the branch has been merged into the parent branch.",worktreeCleanupDeleteBranchAction:"Cleanup and Delete Branch",worktreeCleanupDeleteBranchSuccess:"The worktree and branch {branch} have been cleaned up",worktreeCleanupDeleteBranchPartialFailed:"The worktree was cleaned up, but branch {branch} could not be deleted",worktreeMergeCurrentBranch:"Current branch: {branch}",worktreeMergeParentBranch:"Parent branch: {branch}",worktreeMergeTargetWorkspace:"Target parent: {name}",worktreeMergeAheadBehind:"Commit delta: ahead {ahead} / behind {behind}",worktreeMergeBaseCommit:"merge base: {commit}",worktreeMergeConflictLabel:"Conflicting files",favoriteAction:"Pin Session",unfavoriteAction:"Unpin",favoriteAdded:"Session pinned",favoriteRemoved:"Session unpinned",favoriteToggleFailed:"Failed to update pinned state",sessionMoreAction:"More Actions",sessionStateInferred:"Inferred",renameAction:"Rename",renameSuccess:"Session name updated",renameFailed:"Failed to rename session",renameModalTitle:"Rename Session",renameModalDescription:"Use a name you can recognize at a glance. This changes only the title, not the content.",renameInputLabel:"Session Name",renameInputPlaceholder:"Enter a new session name",renamingSession:"Saving...",archiveFolderLabel:"Archived Sessions",archiveFolderAction:"Open Archive Folder",archiveAction:"Archive Session",archiveCurrentSessionAction:"Archive Current Session",archiveAdded:"Session archived",archiveConfirmTitle:"Archive This Session",archiveConfirmDescription:"After archiving, this session will be hidden from the main list for the current workspace, and you can still restore it from archive.",unarchiveAction:"Restore from Archive",archiveRestored:"Session restored to the main list",archiveModalTitle:"Archived Sessions",archiveModalDescription:"This list shows sessions temporarily hidden in the current project. Restore them when needed.",archiveEmpty:"There are no archived sessions in this project yet.",subagentBadge:"Sub-agent",sessionForkSession:"Session Fork",sessionForkMessage:"Message Fork",sessionForkReconstructed:"Reconstructed Fork",subagentExpand:"Expand Sub-agent List",subagentCollapse:"Collapse Sub-agent List",subagentExpandMore:"Show More Sub-agents",favoriteExpandMore:"Show More Pinned",sessionExpandMore:"Show More Sessions",archiveExpandMore:"Show More Archived Sessions",worktreeCollapse:"Collapse Worktree",worktreeExpand:"Expand Worktree",workspaceCollapse:"Collapse Project",workspaceExpand:"Expand Project",reorderWorkspace:"Drag to Reorder Projects",switchWorkspace:"Switch to Project",workspaceReorderFailed:"Failed to save project order.",workspaceCollapseStateSaveFailed:"Failed to save project collapse state.",workspaceHomeSwitcherLabel:"Switch Workspace",workspaceHomeSwitcherTitle:"Workspace",hostWorkspaceSwitcherTitle:"Hosts and Workspaces",hostSwitcherAriaLabel:"Switch Host",hostSwitcherTitle:"Hosts",hostSwitcherCurrentBadge:"Current",hostSwitcherNodeBadge:"HOST",hostSwitcherAddAction:"Add Host",hostSwitcherNameLabel:"Host Name",hostSwitcherNamePlaceholder:"For example: Office Host",hostSwitcherUrlLabel:"Host URL",hostSwitcherUrlPlaceholder:"For example: http://192.168.1.20:3002",hostSwitcherSaveAction:"Save Host",hostSwitcherSwitching:"Switching",hostSwitcherWorkspaceCount:"{count} workspaces",hostSwitcherWorkspaceCountWithUser:"{username} · {count} workspaces",hostSwitchFailed:"Failed to switch host.",hostSwitchUnreachable:"{name} is unreachable right now.",hostSwitchMissing:"The target host no longer exists.",hostAddInvalidUrl:"The host URL is invalid.",hostAddDuplicate:"This host already exists.",hostAddFailed:"Failed to add the host.",hostAddSuccess:"Added host: {name}",mobileWorktreeBadge:"Worktree",workspaceHomeStatusSectionTitle:"Current Workspace",workspaceHomeViewAllAction:"View All Sessions",workspaceHomeMetricActive:"Active",workspaceHomeMetricUnread:"Notifications",workspaceHomeMetricTerminal:"Terminals",workspaceHomeMetricChanges:"Changes",workspaceHomeActiveSessionsSectionTitle:"Active Sessions",workspaceHomeQuickLaunchStatusLabel:"Quick Launch Process",workspaceHomeQuickLaunchRunning:"Running",workspaceHomeQuickLaunchStopped:"Stopped",workspaceHomeWaitingInputLabel:"Waiting Input",workspaceHomeButlerLabel:"Code Butler",mobileButlerEntry:"Code Butler",mobileButlerEmptyTitle:"Code Butler is not ready yet",mobileButlerEmptyBody:"The first Code Butler setup has not been completed yet. Finish the initial setup on desktop, then come back on mobile to review follow-ups and automations.",mobileButlerSummaryTitle:"Workspace Summary",mobileButlerSummaryProjects:"Projects",mobileButlerSummaryFollowUps:"Active Tasks",mobileButlerSummaryWaitingUser:"Waiting on You",mobileButlerSummaryInbox:"Open Todos",mobileButlerAssistantWorkspaceLabel:"Butler Workspace",mobileButlerAssistantToneLabel:"Tone",mobileButlerAssistantLanguageLabel:"Language",mobileButlerAssistantUpdatedAtLabel:"Updated",workspaceOverviewTitle:"Put project entry points where you can actually see them",workspaceOverviewBody:"Choose a project first, then decide whether to continue or start a new session.",workspaceListBody:"Keep every loaded project here and surface the frequent actions on the page.",workspaceDetailTitle:"Project Details",workspaceDetailSummaryTitle:"Project Overview",workspaceDetailSummaryBody:"See the path, Git summary, and code footprint first, then jump into the right tool.",workspaceDetailMissingTitle:"Project not found",workspaceDetailMissingBody:"This project may have been removed, or the current snapshot has not loaded it yet.",workspaceDetailDebugTitle:"Service Status",manageWorkspaceDebugDescription:"Review detected services, recent start status, and support guidance for the current project.",workspaceDetailDebugAnalyzeFailed:"Failed to load service status",workspaceDetailDebugFrameworkLabel:"Detected Type",workspaceDetailDebugConfidenceLabel:"Confidence",workspaceDetailDebugCompatibilityLabel:"Readiness",workspaceDetailDebugInjectionLabel:"Recommended Handling",workspaceDetailDebugRuntimeStatusLabel:"Current Status",workspaceDetailDebugFailureStageLabel:"Blocked At",workspaceDetailDebugServiceDiscoveryLabel:"Service Address Handling",workspaceDetailDebugHmrLabel:"Hot Reload Handling",workspaceDetailDebugCallbackLabel:"Callback Handling",workspaceDetailDebugAiFallbackLabel:"Manual Handling Policy",workspaceDetailDebugFrameworkNoteLabel:"Notes",workspaceDetailDebugReasonsLabel:"Summary",workspaceDetailDebugFilesLabel:"Reference Files",workspaceDetailDebugFailureStageEmpty:"None",workspaceDetailDebugRuntimeEmpty:"No runtime record yet.",workspaceDetailDebugFrameworkNoteEmpty:"No extra compatibility note.",workspaceDetailDebugEmptyReasons:"None",workspaceDetailDebugEmptyFiles:"None",workspaceDetailDebugConfidenceHigh:"High",workspaceDetailDebugConfidenceMedium:"Medium",workspaceDetailDebugConfidenceLow:"Low",workspaceDetailDebugCompatibilitySupported:"Ready to Use",workspaceDetailDebugCompatibilityConditional:"Needs More Setup",workspaceDetailDebugCompatibilityUnsupported:"Not Recommended Yet",workspaceDetailDebugCompatibilityUnknown:"Unknown",workspaceDetailDebugInjectionCli:"Startup Args",workspaceDetailDebugInjectionEnv:"Environment",workspaceDetailDebugInjectionOverride:"Adjust Command",workspaceDetailDebugInjectionAiFallback:"Needs Manual Help",workspaceDetailDebugInjectionNone:"Do Not Auto Handle Yet",workspaceDetailDebugRuntimePreparing:"Preparing",workspaceDetailDebugRuntimeRunning:"Running",workspaceDetailDebugRuntimeFailed:"Start Failed",workspaceDetailDebugRuntimeStopped:"Stopped",workspaceDetailDebugRuntimeNotStarted:"Not Started",workspaceDetailDebugRequirementRequired:"Needs Extra Setup",workspaceDetailDebugRequirementNotRequired:"No Extra Setup",workspaceDetailDebugAiPolicyNever:"Do Not Auto Handle",workspaceDetailDebugAiPolicyConditional:"Case by Case",workspaceDetailDebugAiPolicyAllowed:"Allowed",workspaceDetailDebugRuntimeServicesTitle:"Most Recent Start",workspaceDetailDebugRuntimeHistoryTitle:"Recent Starts",workspaceDetailDebugRuntimeHistoryTimeLabel:"Started At",workspaceDetailDebugRuntimeHistoryServiceLabel:"Services",workspaceDetailDebugRuntimeHistoryResultLabel:"Result",workspaceDetailDebugRuntimeHistoryTitleWithIndex:"Run #{id}",workspaceDetailDebugRuntimeHistoryFailedSummary:"{services} did not start correctly in this run.",workspaceDetailDebugRuntimeHistoryGenericSummary:"Recent start records are kept here so repeated failures are easier to spot.",workspaceDetailDebugRuntimeHistoryNoServices:"None",workspaceDetailDebugRuntimeHistoryResultRunning:"Still Running",workspaceDetailDebugRuntimeHistoryResultFailed:"Start Failed",workspaceDetailDebugRuntimeHistoryResultStopped:"Stopped",workspaceDetailDebugRuntimeHistoryResultPreparing:"Preparing",workspaceDetailDebugRuntimeServicePortLabel:"Assigned Port",workspaceDetailDebugRuntimeServiceBindingLabel:"Port State",workspaceDetailDebugRuntimeServiceProcessLabel:"Process",workspaceDetailDebugRuntimeServiceFailureLabel:"Issue Stage",workspaceDetailDebugRuntimeServiceAiLabel:"Manual Handling Record",workspaceDetailDebugDetectedServicesTitle:"Detected Services",workspaceDetailDebugServicePathLabel:"Location",workspaceDetailDebugServiceFrameworkLabel:"Detected As",workspaceDetailDebugServiceCommandLabel:"Start Command",workspaceDetailDebugServiceRequirementsLabel:"Extra Setup Needed",workspaceDetailDebugServiceActionLabel:"Recommended Action",workspaceDetailDebugOpenPageAction:"Service Debug",workspaceDetailDebugPageTitle:"Service Debug",workspaceDetailDebugPageDescription:"See detected services, recent start results, and support guidance for this workspace.",workspaceDetailDebugPageHeroEyebrow:"Service Overview",workspaceDetailDebugOverallStatusLabel:"Overall Status",workspaceDetailDebugOverallSummaryLabel:"Summary",workspaceDetailDebugOverallStatusSupported:"Ready to Start",workspaceDetailDebugOverallStatusConditional:"Some Services Need More Setup",workspaceDetailDebugOverallStatusBlocked:"Do Not Start Everything Yet",workspaceDetailDebugOverallSummaryEmpty:"No usable service check result is available yet.",workspaceDetailDebugOverallSummaryMixed:"Detected {webCount} web services and {desktopCount} desktop-shell services. Desktop shells are shown separately and excluded from web auto handling.",workspaceDetailDebugOverallSummaryDesktopOnly:"Detected {count} desktop-shell services and no clear web service yet.",workspaceDetailDebugOverallSummaryWebOnly:"Detected {count} web services that can join the web debug flow.",workspaceDetailDebugSummaryServiceCountLabel:"Total Services",workspaceDetailDebugSummaryWebCountLabel:"Web Services",workspaceDetailDebugSummaryDesktopShellCountLabel:"Desktop Shells",workspaceDetailDebugSummaryWebServicesChip:"{count} web services",workspaceDetailDebugSummaryDesktopShellChip:"{count} desktop shells",workspaceDetailDebugSummaryUnsupportedChip:"{count} blocking items",workspaceDetailDebugAutoInjectionEligible:"Current web services are ready for automatic handling",workspaceDetailDebugAutoInjectionBlocked:"Do not treat this whole project as auto-ready yet",workspaceDetailDebugDesktopShellSummaryHint:"Desktop shell services are shown separately from web service handling",workspaceDetailDebugCompatibilityBreakdown:"Ready {supported} / Needs setup {conditional} / Not recommended {unsupported}",workspaceDetailDebugLastAnalyzedAtLabel:"Last Check",workspaceDetailDebugTargetSourceRepo:"Scope: Repository Root",workspaceDetailDebugTargetSourceWorktree:"Scope: Current Worktree",workspaceDetailDebugRequirementsNone:"No extra setup required",workspaceDetailDebugServiceSectionDescription:"View the project one service at a time so you can tell what is ready and what still needs setup.",workspaceDetailDebugRuntimeSectionDescription:"This only shows the most recent start result so you can quickly see which service failed to come up.",workspaceDetailDebugMatrixSectionDescription:"This section explains the default support level for each detected service type.",workspaceDetailDebugMatrixTitle:"Support Guidance",workspaceDetailDebugMatrixOpenAction:"Open Support Matrix",workspaceDetailDebugMatrixModalDescription:"Use a real matrix table so people can scan support rules without reading a wall of cards.",workspaceDetailDebugMatrixFrameworkHeader:"Framework",workspaceDetailDebugMatrixCompatibilityHeader:"Support",workspaceDetailDebugMatrixInjectionHeader:"Mode",workspaceDetailDebugMatrixDiscoveryHeader:"Discovery",workspaceDetailDebugMatrixHmrHeader:"HMR",workspaceDetailDebugMatrixCallbackHeader:"Callback",workspaceDetailDebugMatrixAiHeader:"Manual",workspaceDetailDebugMatrixNotesHeader:"Notes",workspaceDetailDebugMatrixCompatibilitySupportedShort:"Ready",workspaceDetailDebugMatrixCompatibilityConditionalShort:"Needs Setup",workspaceDetailDebugMatrixCompatibilityUnsupportedShort:"Avoid",workspaceDetailDebugMatrixCompatibilityUnknownShort:"Unknown",workspaceDetailDebugMatrixInjectionCliShort:"CLI",workspaceDetailDebugMatrixInjectionEnvShort:"ENV",workspaceDetailDebugMatrixInjectionOverrideShort:"CMD",workspaceDetailDebugMatrixInjectionAiFallbackShort:"Manual",workspaceDetailDebugMatrixInjectionNoneShort:"None",workspaceDetailDebugMatrixRequirementRequiredShort:"Needs Work",workspaceDetailDebugMatrixRequirementNotRequiredShort:"Not Needed",workspaceDetailDebugMatrixAiNeverShort:"Do Not Use",workspaceDetailDebugMatrixAiConditionalShort:"Conditional",workspaceDetailDebugMatrixAiAllowedShort:"Allowed",workspaceDetailDebugMatrixLegendSummary:"Icon meanings: check means the default path is clear, warning means you still need setup, and cross means this path is not recommended for automatic handling yet.",workspaceDetailDebugMatrixDiscoveryNote:"Service address handling such as proxy, rewrites, and discovery.",workspaceDetailDebugMatrixHmrNote:"Hot reload and other long-lived frontend dev connections.",workspaceDetailDebugMatrixCallbackNote:"Callback-style entries such as OAuth, login callback, or webhook.",workspaceDetailDebugMatrixAiNote:"Whether edge cases are allowed to fall back to manual help.",workspaceDetailDebugFailureStageServiceDiscovery:"Still needs service address handling",workspaceDetailDebugFailureStageHmr:"Still needs hot reload handling",workspaceDetailDebugFailureStageCallback:"Still needs callback handling",workspaceDetailDebugFailureStageAiFallbackRequired:"Needs manual review",workspaceDetailDebugFailureStageAdapterSelection:"No suitable start method was found",workspaceDetailDebugFailureStageLaunchRequirements:"Some launch requirements are still missing",workspaceDetailDebugFailureStageCommandExecution:"The start command did not run correctly",workspaceDetailDebugFailureStageProcessExit:"The service exited right after start",workspaceDetailDebugFailureStageProcessRuntimeError:"The service hit a runtime error",workspaceDetailDebugFailureStageStaleRuntimeBinding:"This start record is no longer valid",workspaceDetailDebugFailureStageUnknown:"Unknown stage ({code})",workspaceDetailDebugBindingAllocated:"Assigned",workspaceDetailDebugBindingListening:"Reachable",workspaceDetailDebugBindingFailed:"Not Ready",workspaceDetailDebugBindingReleased:"Released",workspaceDetailDebugBindingUnknown:"Unknown",workspaceDetailDebugProcessCreating:"Starting",workspaceDetailDebugProcessRunning:"Running",workspaceDetailDebugProcessClosed:"Stopped",workspaceDetailDebugProcessError:"Error",workspaceDetailDebugProcessUnknown:"Unknown",workspaceDetailDebugPortEmpty:"None",workspaceDetailDebugRoleFrontend:"Web Service",workspaceDetailDebugRoleBackend:"Backend Service",workspaceDetailDebugRoleWorker:"Background Worker",workspaceDetailDebugRoleMock:"Mock Service",workspaceDetailDebugRoleDesktopShell:"Desktop Shell",workspaceDetailDebugRoleCustom:"Custom",workspaceDetailDebugServiceOverviewSupported:"This service is clearly identified and is usually ready to start once you follow the recommended handling.",workspaceDetailDebugServiceOverviewConditional:"This service is identified, but still needs a few extra setup steps before it can start cleanly.",workspaceDetailDebugServiceOverviewUnsupported:"This service is not recommended for direct automatic handling yet. Confirm the start flow manually first.",workspaceDetailDebugServiceOverviewUnknown:"This service has not been identified clearly yet. The current result is kept for later review.",workspaceDetailDebugServiceOverviewDesktopShell:"This is a desktop shell service. It is shown separately and does not participate in automatic web-port handling.",workspaceDetailDebugServiceActionSupported:"Start Directly",workspaceDetailDebugServiceActionConditional:"Complete Setup First",workspaceDetailDebugServiceActionUnsupported:"Handle Manually",workspaceDetailDebugServiceActionUnknown:"Confirm Service Type First",workspaceDetailDebugServiceActionDesktopShell:"Handle as Desktop Shell",workspaceDetailDebugAiEditEmpty:"None",workspaceDetailDebugAiEditPending:"Pending",workspaceDetailDebugAiEditApplied:"Applied",workspaceDetailDebugAiEditRolledBack:"Rolled Back",workspaceDetailDebugAiEditRejected:"Rejected",workspaceSessionListBody:"Project sessions, favorites, and archive actions live here instead of hiding in a sidebar.",recentSessionsSectionTitle:"Recent Sessions",recentSessionsSectionBody:"Jump back into the work you touched most recently.",currentWorkspaceSectionTitle:"Current Project Sessions",currentWorkspaceSectionBody:"Keep the sessions for the current project together so the context stays obvious.",sessionIndexTitle:"Sessions deserve their own page",sessionIndexBody:"Recent, favorites, and current-project sessions are split into clear sections for mobile.",toolsMoreAction:"More",toolsSwipeHint:"Swipe left or right to switch between files and Git",toolsSwipePosition:"{current} / {total}",toolFilesBody:"Browse project files, changed files, and code context without relying on a desktop sidebar.",toolGitBody:"Open a clear Git entry for status, commits, and branches in the current project.",toolTerminalsBody:"Open the full terminal page for input-heavy and scroll-heavy tasks.",toolProcessesBody:"Review terminal templates, runtime status, and process entry points for the current project.",toolsWorkspaceRequiredBody:"Pick a project before opening this tool page.",createSession:"New Session",createSessionModalTitle:"Choose Session Type",createSessionModalDescription:"Pick the session type first, then start the actual session process.",createSessionWorkspaceLabel:"Choose Workspace",createSessionProviderLabel:"Choose Provider",createSessionTarget:"Current Project",createWorktreeSectionTitle:"Child Workspace",createWorktreeSectionDescription:"Create a child workspace from the current project first, then choose the provider for the new session.",createWorktreeAction:"Add Child Workspace",createWorktreeCollapseAction:"Hide Child Workspace Form",createWorktreeBranchLabel:"Branch Name",createWorktreeBranchPlaceholder:"For example: feat/login-codex",createWorktreeBranchRequired:"Enter the child workspace branch name first.",createWorktreeBranchInvalid:"Branch names may only contain letters, numbers, -, _, and /. They cannot start or end with / or contain //.",createWorktreeDisplayNameLabel:"Display Name (Optional)",createWorktreeDisplayNamePlaceholder:"Defaults to the branch name",createWorktreeBaseRefLabel:"Create From Branch/Commit (Optional)",createWorktreeBaseRefPlaceholder:"Defaults to the current branch",createWorktreeBaseRefHint:"You can choose from {localCount} local branches, {remoteCount} remote branches, and {tagCount} tags, or enter a commit hash manually.",createWorktreeBaseRefLoading:"Loading branches and tags from the current repository...",createWorktreeBaseRefLoadFailed:"Failed to load branches and tags. You can still enter a branch, tag, or commit hash manually.",createWorktreeBaseRefLocalGroup:"Local Branches",createWorktreeBaseRefRemoteGroup:"Remote Branches",createWorktreeBaseRefTagGroup:"Tags",createWorktreeBaseRefCurrentBadge:"Current",createWorktreeBaseRefRecommendedBadge:"Recommended",createWorktreeBaseRefEmpty:"No matches found. You can still enter a branch, tag, or commit hash manually.",createWorktreeBaseRefToggle:"Show available branches and tags",createWorktreeHelpAction:"How to Fill This",createWorktreeHelpTitle:"What These Fields Mean",createWorktreeHelpBranchTitle:"Branch Name",createWorktreeHelpBranchBody:"This is the name of the new child workspace. It is also what you will see in the list later. A short name like feat/login is usually enough.",createWorktreeHelpDisplayNameTitle:"Display Name",createWorktreeHelpDisplayNameBody:"Use this if you want a clearer name in the list. If you leave it empty, the branch name will be used automatically.",createWorktreeHelpBaseRefTitle:"Create From Branch/Commit",createWorktreeHelpBaseRefBody:"This decides where the new child workspace starts from. Most of the time, you can keep the default. Only change it if you want to start from another branch, tag, or specific commit.",createWorktreeSubmit:"Create Child Workspace",createWorktreeSubmitting:"Creating...",createWorktreeSucceeded:"Child workspace created: {name}",createWorktreeFailed:"Failed to create child workspace",providerClaudeCode:"Claude Code",providerCodexDescription:"Create a Codex session for the current default workflow.",providerClaudeDescription:"Create a Claude Code session when you want to switch to another conversation chain.",providerOpenCodeDescription:"Create an OpenCode session to continue context via the OpenCode service.",providerGeminiDescription:"Create a Gemini session for the native Gemini CLI workflow.",providerKimiDescription:"Create a Kimi session for the native Kimi CLI workflow.",providerOptionHint:"A session is created immediately after selection",providerChecking:"Checking...",startClaude:"Claude",startCodex:"Codex",startingSession:"Creating...",startClaudeSuccess:"Claude session created",startCodexSuccess:"Codex session created",startSessionFailed:"Failed to create session",auxiliaryTitle:"Info",auxiliarySubtitle:"Files and Git status",expandAuxiliary:"Expand",collapseAuxiliary:"Collapse",auxiliaryEmptyTitle:"Select a session",auxiliaryEmptyBody:"Session files and Git info will appear here",batchSelectSessions:"Select Sessions in Bulk",batchSelectionMode:"Batch Selection",selectAllSessions:"Select All",clearSelectedSessions:"Clear Selection",batchArchiveAction:"Archive Selected",batchArchiving:"Archiving...",batchArchiveSuccess:"Selected sessions archived",batchArchivePartialFailed:"Some sessions failed to archive. Retry.",batchArchiveFailed:"Batch archive failed",hideSessionSidebar:"Hide Session List",showSessionSidebar:"Show Session List",hideInfoSidebar:"Hide Info Sidebar",showInfoSidebar:"Show Info Sidebar",centerTabsLabel:"Center Area Tabs",infoTabsLabel:"Info Sidebar Tabs",leftResizerLabel:"Resize Left Sidebar",rightResizerLabel:"Resize Right Sidebar",filesPanelEmpty:"Import or select a workspace first to use file management.",gitPanelEmpty:"Import or select a workspace first to view Git info.",infoPanelDeferred:"The left session list loads first. The right auxiliary panel mounts slightly later."},workbench:{emptyEyebrow:"Start",emptyTitle:"Choose a session first",emptyBody:"Continue from the left, or create a new session.",emptyResumeTitle:"Continue",emptyResumeBody:"Go back to where you stopped.",emptyNewTitle:"New session",emptyNewBody:"Put a new question into a clean session.",emptyCompanionTitle:"Side details",emptyCompanionBody:"Open files, Git, or terminal on the right when needed.",emptyTip:"When you are ready, pick a session from the left."},conversation:{resendButton:"Resend",historyLoading:"Loading...",historyLoadingOlder:"Loading older messages...",historyLoadFailed:"Load failed",inheritedContextLoading:"Preparing inherited context from the parent session...",inheritedContextMessageLabel:"Inherited context before the forked message",inheritedContextSessionLabel:"Inherited context from the parent session",inheritedContextSummary:'Collapsed {count} inherited messages from "{parentTitle}" by default.',actionInheritedSelectionSummary:'Collapsed the selected text from "{parentTitle}" by default.',inheritedContextExpand:"Show inherited context",inheritedContextCollapse:"Hide inherited context",inheritedContextParentFallback:"Parent session",timelineEmpty:"Start Conversation",composerPlaceholder:"State the next step clearly. Let the session continue from there.",sendButton:"Send Message",attachFiles:"Attach File",attachmentSourceSheetTitle:"Add Image",attachmentSourceSheetDescription:"Take a new photo now, or choose one from the photo library.",attachmentTakePhoto:"Take Photo",attachmentTakePhotoHint:"Open the camera and capture a new image",attachmentChooseFromLibrary:"Choose from Library",attachmentChooseFromLibraryHint:"Pick an existing image from the system photo library",pasteImagesHint:"Supports pasting images directly",attachmentImageOnly:"Only image attachments are supported right now",attachmentReadFailed:"Failed to read image. Retry.",attachmentPreviewAlt:"Selected image preview",attachmentPreviewOpen:"Click to view full image",attachmentPreviewClose:"Close image preview",attachmentPreviewLoading:"Loading image...",attachmentPreviewUnavailable:"Image preview unavailable",imageAttachmentLabel:"Image Attachment",imagePreviewTitle:"Image Preview",imagePreviewHint:"Click the backdrop or press Esc to close the preview",removeAttachment:"Remove Attachment",selectionTodoAction:"Todo",selectionActionButton:"Action",selectionActionSubmit:"Open action child session",selectionActionPromptLabel:"What should it do",selectionActionPromptPlaceholder:"For example: explain this, turn it into notes, or send it to a specific API",selectionActionIncludeContext:"Include current context",selectionActionContextUnavailable:"This selection spans multiple messages, so context inheritance is disabled for safety.",selectionActionDefaultPrompt:"Please process this content.",selectionActionQuotedLabel:"Selected text",selectionActionFailed:"Failed to create the action child session.",actionSessionBadge:"Action",modelSelectorLabel:"Model",modelUseCliDefault:"Default",modelUseCodexConfig:"Follow current Codex config",modelUseOpenCodeConfig:"Follow current OpenCode config",reasoningSelectorLabel:"Reasoning Effort",reasoningLow:"Low",reasoningMedium:"Medium",reasoningHigh:"High",reasoningMaximum:"Maximum",slashMenu:"Commands",slashMenuTitle:"Quick Commands",slashCommandPlan:"Ask for an execution plan first",slashCommandReview:"Switch directly to code review mode",slashCommandExplain:"Ask for a clearer explanation",toolInputLabel:"Input",toolResultLabel:"Result",toolResultEmpty:"No output yet",toolPreviewCommand:"Command",toolPreviewTerminal:"Terminal",toolStatusRunning:"Running",toolStatusFailed:"Failed",toolStatusCompleted:"Completed",runtimeThinkingPlaceholder:"{provider} is thinking...",applyPatchEditedLabel:"Edited",applyPatchAddedLabel:"Added",applyPatchDeletedLabel:"Deleted",applyPatchDialogTitle:"Patch Change Preview",applyPatchDialogDescription:"This shows the file-level changes that apply_patch is about to perform.",applyPatchOpenDiff:"View Diff",applyPatchAddedStat:"Added",applyPatchRemovedStat:"Removed",applyPatchEmpty:"This patch does not contain any file change that can be displayed right now.",titleFallback:"Continue Conversation",draftTitleCodex:"New Codex session",draftTitleClaude:"New Claude Code session",draftTitleOpenCode:"New OpenCode session",draftTitleGemini:"New Gemini session",draftTitleKimi:"New Kimi session",headerWorkspace:"Workspace",headerWorkspaceUnknown:"Unknown Workspace",headerProvider:"Provider",headerConnection:"Connection",headerRuntime:"Runtime",providerCodex:"Codex",branchTreeAction:"Branch Tree",branchTreeTitle:"Branch Tree",branchTreeDescription:"This panel only shows the parent-child chain around the current session.",branchTreeUpstreamLabel:"Upstream Chain",branchTreeCurrentLabel:"Current Session",branchTreeChildrenLabel:"Child Branches",branchTreeCurrentBadge:"Current",branchTreeArchivedBadge:"Archived",branchTreeEmpty:"This session does not have any child branches yet.",branchTreeMapTitle:"Branch Map",branchTreeMapDescription:"This view expands the full branch family around the current session.",branchTreePreviewTitle:"Session Preview",branchTreePreviewDescription:"Click a node to float its latest messages before switching.",branchTreePreviewLoading:"Loading recent messages for this session...",branchTreePreviewFailed:"Failed to load the session preview.",branchTreePreviewEmpty:"There are no recent messages to preview for this session.",branchTreeResizeHandle:"Resize branch tree width",branchTreeZoomInAction:"Zoom in branch map",branchTreeZoomOutAction:"Zoom out branch map",branchTreeZoomResetAction:"Reset branch map zoom",branchTreeSwitchAction:"Switch to This Session",branchTreeCurrentAction:"Already Current",branchTreeToolMessageFallback:"tool message",branchTreeMessageEmpty:"This message does not have visible text.",moreSessionActions:"More session actions",moreSessionActionsTitle:"More Session Actions",moreSessionActionsDescription:"Branch navigation and AI actions live here so the mobile header stays clean.",branchTreeTab:"Branch Tree",aiAssistantTab:"AI Assistant",aiAssistantTabDescription:"Use the AI assistant entry here when you want to continue follow-up or start verification for this session.",providerClaude:"Claude",providerOpenCode:"OpenCode",providerGemini:"Gemini",providerKimi:"Kimi",capabilitySend:"Send Enabled",queueTitle:"Queued Messages",queueDescription:"After the current run finishes, these messages will be processed automatically in order.",queueOrderPrefix:"Queue Position",queueStatusQueued:"Queued",queueStatusFailed:"Dispatch Failed",queueDelete:"Delete",queueDeleting:"Deleting",permissionRequestSectionTitle:"Pending approvals",permissionRequestSectionDescription:"Provider-side approvals are unified here so you do not need to learn three different dialogs.",permissionRequestToastTitle:"Approval needed",backgroundPermissionToastDescription:"{title} · {requestTitle}",backgroundCompletionToastTitle:"Session completed",backgroundCompletionToastDescription:"{title}",backgroundFailureToastTitle:"Session failed",backgroundFailureToastDescription:"{title} · {detail}",permissionRequestReplyFailed:"Failed to reply to the approval request.",permissionRequestSubmitting:"Submitting...",permissionRequestReasonLabel:"Reason",permissionRequestCommandLabel:"Command",permissionRequestToolLabel:"Tool",permissionRequestCwdLabel:"Working directory",permissionRequestPathsLabel:"Related paths",permissionRequestPermissionsLabel:"Requested permissions",permissionRequestReadLabel:"Read",permissionRequestWriteLabel:"Write",permissionRequestNetworkLabel:"Network",permissionRequestQuestionsLabel:"Questions",permissionRequestDetailLabel:"Details",permissionRequestEmpty:"None",permissionRequestUnknown:"Unknown",permissionRequestKindCommand:"Command",permissionRequestKindFileChange:"File Change",permissionRequestKindPermissions:"Permissions",permissionRequestKindUserInput:"User Input",permissionRequestKindToolCall:"Tool Call",queueImageOnly:"Image attachments only",sendGuidanceButton:"Add Guidance",queueGuidanceButton:"Queue Guidance",capabilityDenied:"Restricted",capabilitySendDisabled:"Sending disabled",connectionConnected:"Realtime connected",connectionReconnecting:"Reconnecting",connectionReconnectFailed:"Reconnect failed",connectionClosed:"Connection closed",runtimeIdle:"Idle",runtimeStarting:"Starting",runtimeRunning:"Running",runtimeReconnecting:"Recovering",runtimeStale:"Awaiting confirmation",runtimeUnknown:"Status pending",runtimeCompleted:"Completed",runtimeInterrupted:"Interrupted",runtimeFailed:"Failed",rulesMessageTitle:"Rules",rulesMessageHint:"This is the startup rule block for the session. It is collapsed by default and can be expanded when needed.",rulesMessageExpand:"Expand Rules",rulesMessageCollapse:"Collapse Rules",systemPromptTitle:"System Prompt",systemPromptHint:"This is the Kimi startup system prompt for the session. It is collapsed by default and can be expanded when needed.",systemPromptExpand:"Expand Prompt",systemPromptCollapse:"Collapse Prompt",taskProgressButton:"Task Progress ({count})",taskProgressModalTitle:"Task Progress",taskProgressModalDescription:"This session has recorded {count} tasks. Check the latest progress here.",taskProgressExplanationTitle:"Latest Update Note",taskProgressSummaryTotal:"Total",taskProgressStatusPending:"Pending",taskProgressStatusInProgress:"In Progress",taskProgressStatusCompleted:"Completed",taskProgressStatusFailed:"Failed",taskProgressStatusCancelled:"Cancelled",taskCardPlanTitle:"Plan Update",taskCardTodoTitle:"Task Update",taskCardPlanUpdated:"Latest Plan",taskCardTodoUpdated:"Latest Task List",taskCardRawExpand:"Show Raw Call",taskCardRawCollapse:"Hide Raw Call",taskCardSummaryTotal:"{count} total",taskCardSummaryInProgress:"{count} in progress",taskCardSummaryPending:"{count} pending",taskCardSummaryCompleted:"{count} completed",taskCardSummaryFailed:"{count} failed",butlerActionButton:"AI Butler",butlerActionModalTitle:"Butler Actions",butlerActionModalDescription:"Ask Butler to continue this development session or start a development verification run.",butlerActionLoading:"Loading Butler action context...",butlerActionLoadFailed:"Failed to load Butler action context",butlerActionProjectLabel:"Project",butlerActionSessionLabel:"Session",butlerFollowUpAction:"Follow Up This Session",butlerFollowUpActionDescription:"Let Butler keep watching this session and continue pushing it after each stop or blocker.",butlerFollowUpObjectiveLabel:"Follow-up Goal",butlerFollowUpObjectivePlaceholder:"Example: finish this feature for me; if the spec still has unfinished work, keep going.",butlerFollowUpCompletionCriteriaLabel:"Finish Conditions",butlerFollowUpCompletionCriteriaPlaceholder:"Example: only stop once the current feature is finished against the agreed requirements.",butlerFollowUpRoundLimitLabel:"Max Auto Follow-up Rounds",butlerFollowUpRoundLimitHint:"Once the limit is reached, Butler stops auto-resuming so the session does not expand forever.",butlerCurrentFollowUpLabel:"Current Follow-up",butlerCurrentFollowUpProgress:"Auto-continued {current} / {max} rounds",butlerStopFollowUpAction:"Stop Current Follow-up",butlerFollowUpObjectiveRequired:"Please describe the goal you want Butler to keep pushing",butlerVerificationAction:"Start Development Verification",butlerVerificationActionDescription:"Let Butler start a user-facing verification run for the feature behind this session.",butlerFollowUpStarted:"Butler follow-up started",butlerFollowUpStartedDescription:"Butler will continue following the current development session for {projectName}.",butlerFollowUpFailed:"Failed to start Butler follow-up",butlerFollowUpStopped:"Current Butler follow-up stopped",butlerFollowUpStoppedDescription:"Automatic follow-up for the current session has been stopped and will not auto-resume.",butlerFollowUpStopFailed:"Failed to stop Butler follow-up",butlerVerificationStarted:"Development verification started",butlerVerificationStartedDescription:"Butler will start a development verification run for {projectName}.",butlerVerificationFailed:"Failed to start development verification",butlerAnalysisTitle:"Butler Analysis",butlerAnalysisLoadFailed:"Failed to load Butler analysis",butlerAnalysisObjectiveLabel:"Objective",butlerAnalysisStatusLabel:"Decision",butlerAnalysisSummaryLabel:"Latest analysis",butlerAnalysisWaitingReasonLabel:"Waiting reason",butlerAnalysisEmpty:"There is no Butler analysis record yet.",butlerProxyMessageBadge:"Sent by Butler",butlerOriginDetailTitle:"Related Butler Follow-up",butlerOriginDetailLoading:"Loading the related Butler follow-up...",butlerOriginDetailLoadFailed:"Failed to load the related Butler follow-up",butlerOriginDetailObjectiveLabel:"Objective",butlerOriginDetailStatusLabel:"Status",butlerOriginDetailSummaryLabel:"Latest analysis",butlerOriginDetailWaitingReasonLabel:"Waiting reason",thinkingLabel:"Thinking",filePanelWorkspaceTab:"Workspace",filePanelSessionTab:"Session",filePanelSessionViewLabel:"Session File View",filePanelSessionTreeView:"Tree",filePanelSessionListView:"List",filePanelSessionLoading:"Collecting files changed in this session...",filePanelSessionEmpty:"No cacheable changed files have been detected in this session yet.",filePanelSessionNoSession:"Only the workspace is selected right now. Pick a session before viewing session-scoped files.",filePanelSessionStageAll:"Stage All",filePanelSessionStageSuccess:"Changes from this session have been added to the staging area.",filePanelSessionLoadFailed:"Failed to load changed files for this session.",filePanelSessionSummary:"Detected Files",filePanelSessionUnstagedSummary:"Unstaged",filePanelSessionDeleted:"Deleted",filePanelOpenExternalWindow:"Open in New Window",filePanelOpenExternalFailed:"Failed to open the file window externally."},desktopWindow:{invalidWindowId:"The external window is missing a window id.",loadDescriptorFailed:"Failed to load the window descriptor.",unsupportedKind:"Rendering the {kind} window is not supported yet."},git:{recentVersionsTitle:"Recent Versions",stagedChangesTitle:"Staged Changes",expandRecentVersions:"Expand Recent Versions",collapseRecentVersions:"Collapse Recent Versions",stagedLabel:"Staged",workingTreeLabel:"Working Tree",changeTreeHint:"Show current changes by directory hierarchy",discard:"Discard Changes",discardFailed:"Failed to discard changes",operationMenu:"Actions",currentBranch:"Current Branch",resizePanels:"Resize file and recent-version panels",switchBranchTo:"Switch To",undoLastCommit:"Undo Last Commit",undoLastCommitFailed:"Failed to undo last commit",undoLastCommitSuccess:"Last commit undone",historyKindLocal:"Local",historyKindRemote:"Remote",historyKindShared:"Synced",pushNow:"Push",commitNow:"Commit",refreshNow:"Refresh",openExternalWindow:"Open Git in New Window",openExternalFailed:"Failed to open the Git window externally.",stageAll:"Stage All",unstageAll:"Unstage All",discardAll:"Discard All Changes",selectedFiles:"Selected Files",clearSelection:"Clear Selection",selectFile:"Select File",discardConfirm:"Discard these changes? {path}",historyItemMenu:"Commit Actions",copyCommitHash:"Copy Commit Hash",copyCommitHashSuccess:"Commit hash copied.",copyCommitSubject:"Copy Commit Title",copyCommitSubjectSuccess:"Commit title copied."},terminalManager:{workspaceField:"Current Workspace",refresh:"Refresh List",loadFailed:"Failed to load the terminal management panel",shellLoadFailed:"Failed to load the terminal shell list",emptyWorkspaceBody:"There is no available workspace yet.",noCurrentWorkspaceBody:"Select a session first so process management can bind to its workspace.",emptyTerminalBody:"There is no terminal instance in the current workspace yet.",emptyTemplateBody:"There is no quick launch item yet. Save a command or script first.",shellField:"Shell for New Terminal",shellUnavailable:"Unavailable",cwdField:"Startup Directory",cwdLabel:"Directory",cwdPlaceholder:"Defaults to the workspace root when left empty",modeField:"Launch Mode",commandMode:"Command",scriptMode:"Script",quickLaunchTitle:"Quick Launch",quickLaunchDescription:"Save a launch preset here so you can start it in a new terminal with one click later.",desktopPanelDescription:"Keep the default view focused on launch decisions, while paths and command lines stay inside the details layer.",openExternalWindow:"Open in New Window",openExternalFailed:"Failed to open the process management window externally.",runningCountLabel:"Running",portWatchCountLabel:"Watched Ports",terminalCountLabel:"Terminals",templateSectionTitle:"Launch Items",templateSectionDescription:"The right side prioritizes the port status of launch items so you can see whether a service is already in use.",openCreateModalAction:"Add Quick Launch Item",createModalTitle:"Add Quick Launch Item",createModalDescription:"Save a command or script here. You can attach a port and then start it with one click while checking whether it is already running.",editAction:"Edit Launch Item",editModalTitle:"Edit Quick Launch Item",editModalDescription:"Update the name, command, directory, and port for this quick launch item.",saveTemplateChangesAction:"Save Changes",templateUpdating:"Saving changes...",templateUpdateSuccess:"Quick launch item updated.",templateUpdateFailed:"Failed to update quick launch item",removeAction:"Remove Launch Item",templateRemoving:"Removing...",removeConfirmTitle:"Remove Quick Launch Item",removeConfirmAction:"Remove Item",removeConfirmTarget:'Remove "{name}"? It will disappear from the quick launch list after removal.',removeRunningConfirmTarget:'"{name}" is still running. Removing it only deletes the launch item configuration and will not stop the active process. Continue?',templateDeleteSuccess:"Quick launch item removed.",templateDeleteFailed:"Failed to remove quick launch item",terminalSectionTitle:"Terminal Instances",terminalSectionDescription:"This area shows terminals currently managed by CodingNS for the workspace.",closeAction:"Close Terminal",closing:"Closing...",closeSuccess:"Terminal close request submitted.",closeFailed:"Failed to close terminal",createTerminalAction:"New Empty Terminal",creatingTerminal:"Creating...",createTerminalSuccess:"New terminal created.",createTerminalFailed:"Failed to create a new terminal",defaultTerminalName:"Workspace Terminal",templateNameField:"Name",templateNamePlaceholder:"Generated automatically when left empty",commandField:"Launch Command",commandPlaceholder:"For example: npm",scriptPathField:"Script Path",scriptPathPlaceholder:"For example: scripts/dev.ps1 or scripts/dev.sh",argsField:"Arguments",argsPlaceholder:"For example: run dev or --watch",portField:"Listening Port",portLabel:"Port",portPlaceholder:"For example: 3000",proxyField:"Reverse Proxy",proxyToggleLabel:"Enable Reverse Proxy",proxyEnabled:"Proxy Enabled",proxyEnabledDescription:"When enabled, the system generates a random URL code and exposes your dev service under /proxy/.",proxyDisabledDescription:"Reverse proxy is disabled",proxyPortRequired:"A listening port is required when reverse proxy is enabled",openProxyUrlAction:"Open Proxy URL",openProxyUrlFailed:"Failed to open proxy URL",invalidPort:"Port must be an integer between 1 and 65535",saveLaunchAction:"Save as Quick Launch",templateSaving:"Saving...",templateSaveSuccess:"Quick launch item saved.",templateSaveFailed:"Failed to save quick launch item",runTemplateAction:"Run in New Terminal",runningTemplate:"Starting...",templateRunSuccess:"Quick launch item sent to a new terminal.",templateRunFailed:"Failed to run quick launch item",showDetailsAction:"Show details",hideDetailsAction:"Hide details",detailsSectionTitle:"Launch item details",commandPreviewLabel:"Launch Command",processIdLabel:"Process ID",processCommandLabel:"Process Command Line",stopProcessAction:"Stop Process",stoppingProcess:"Stopping...",stopProcessSuccess:"The listening process has been stopped.",stopProcessFailed:"Failed to stop the listening process",defaultCommandName:"New Launch Command",defaultScriptName:"New Launch Script",lastActiveAt:"Last Active",updatedAt:"Updated At",processCommandFallback:"This process did not expose its command line",portUnset:"Port Not Configured",portUnsetDescription:"Without a port, the item can only be started. The system cannot determine automatically whether the service is running.",portOccupied:"Process Started",portAvailable:"Port Available",portAvailableDescription:"There is currently no listening process on the port used by this launch item.",statusRunning:"Running",statusStopped:"Stopped",exitCode:"Exit Code",runningValue:"Running"},theme:{light:"浅色",dark:"深色",skyBlue:"赛博",eyeGreen:"护眼",switchLabel:"Theme"}},qN={"zh-CN":ZE,"en-US":JE},rI={butlerInitTitle:"设置助手",butlerInitDescription:"先完成几个基本设置。",butlerInitPreviewTitle:"当前效果",butlerInitPreviewDescription:"",butlerInitBasicsTitle:"基本信息",butlerInitBasicsDescription:"",butlerInitPersonaTitle:"说话方式",butlerInitPersonaDescription:"",butlerInitPreferenceTitle:"默认偏好",butlerInitPreferenceDescription:"",butlerInitRuleLabel:"规则方式",butlerInitPreviewRuleLabel:"管理方式",butlerInitTipAutoWorkspace:"",butlerInitTipProviderSwitch:"",butlerInitTipReportPriority:"",butlerDisplayNameLabel:"助手称呼",butlerDisplayNamePlaceholder:"例如:小助手",butlerDisplayNameHint:"这个名字会显示在助手页面里。",butlerProviderLabel:"助手引擎",butlerAgentsModeLabel:"规则方式",butlerAgentsModeInline:"自动管理",butlerAgentsModeFile:"手动编辑",butlerAgentsModeInlineDescription:"规则由系统自动管理。",butlerAgentsModeFileDescription:"会生成一份可编辑的规则文件。",butlerPersonaToneLabel:"语气",butlerPersonaLanguageLabel:"使用语言",butlerPersonaSummaryStyleLabel:"回答风格",butlerFocusRiskPreferenceLabel:"处理方式",butlerFocusReportPriorityLabel:"优先提醒",butlerToneDirect:"直接",butlerToneSteady:"稳重",butlerToneFriendly:"亲切",butlerLanguageZhCn:"中文",butlerLanguageEnUs:"英文",butlerLanguageBilingual:"中英双语",butlerSummaryBrief:"简洁",butlerSummaryStructured:"清晰",butlerSummaryThorough:"详细",butlerRiskConservative:"保守稳妥",butlerRiskBalanced:"平衡",butlerRiskProactive:"主动提醒",butlerReportPriorityPresetLabel:"优先提醒",butlerSummaryDebounceLabel:"摘要节奏",butlerSettingsTitle:"助手设置",butlerSettingsSaveAction:"保存设置",butlerSettingsSaving:"保存中...",butlerSettingsSaved:"助手设置已保存",butlerSettingsSaveFailed:"保存助手设置失败",butlerInitSubmitting:"保存中...",butlerInitSubmit:"完成设置",butlerInitSuccess:"助手已设置完成",butlerInitFailed:"助手设置失败",butlerInitNameRequired:"请先填写助手名称"},iI={butlerInitTitle:"Set Up Butler",butlerInitDescription:"Finish a few basic settings first.",butlerInitPreviewTitle:"Preview",butlerInitPreviewDescription:"",butlerInitBasicsTitle:"Basic Info",butlerInitBasicsDescription:"",butlerInitPersonaTitle:"Voice",butlerInitPersonaDescription:"",butlerInitPreferenceTitle:"Default Preferences",butlerInitPreferenceDescription:"",butlerInitRuleLabel:"Rule Style",butlerInitPreviewRuleLabel:"Mode",butlerInitTipAutoWorkspace:"",butlerInitTipProviderSwitch:"",butlerInitTipReportPriority:"",butlerDisplayNameLabel:"Butler Name",butlerDisplayNamePlaceholder:"Example: Butler",butlerDisplayNameHint:"This name appears on the Butler page.",butlerProviderLabel:"Engine",butlerAgentsModeLabel:"Rule Style",butlerAgentsModeInline:"Auto",butlerAgentsModeFile:"Editable File",butlerAgentsModeInlineDescription:"Rules are managed automatically.",butlerAgentsModeFileDescription:"An editable rule file will be created.",butlerPersonaToneLabel:"Tone",butlerPersonaLanguageLabel:"Language",butlerPersonaSummaryStyleLabel:"Reply Style",butlerFocusRiskPreferenceLabel:"Work Style",butlerFocusReportPriorityLabel:"Priority",butlerToneDirect:"Direct",butlerToneSteady:"Steady",butlerToneFriendly:"Friendly",butlerLanguageZhCn:"Chinese",butlerLanguageEnUs:"English",butlerLanguageBilingual:"Bilingual",butlerSummaryBrief:"Brief",butlerSummaryStructured:"Clear",butlerSummaryThorough:"Detailed",butlerRiskConservative:"Conservative",butlerRiskBalanced:"Balanced",butlerRiskProactive:"Proactive",butlerReportPriorityPresetLabel:"Priority",butlerSummaryDebounceLabel:"Summary Cadence",butlerSettingsTitle:"Butler Settings",butlerSettingsSaveAction:"Save Settings",butlerSettingsSaving:"Saving...",butlerSettingsSaved:"Butler settings saved",butlerSettingsSaveFailed:"Failed to save Butler settings",butlerInitSubmitting:"Saving...",butlerInitSubmit:"Finish Setup",butlerInitSuccess:"Butler is ready",butlerInitFailed:"Failed to save Butler settings",butlerInitNameRequired:"Please enter a Butler name"};function Uk(e,t){const r=e.shell;return{...e,shell:{...r&&typeof r=="object"?r:{},...t}}}const $N={"zh-CN":Uk(tI,rI),"en-US":Uk(nI,iI)};function Oh(e,t){const r=e.split(".");let i=t;for(const a of r){if(!i||typeof i=="string")return e;const c=i[a];if(c==null)return e;i=c}return typeof i=="string"?i:e}function sI(){return Ts.getState().profile.language??"zh-CN"}function o(e,t){const i=sI()==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const a of i){const c=Oh(e,$N[a]);if(c!==e)return sf(c,t);const u=Oh(e,qN[a]);if(u!==e)return sf(u,t)}return sf(e,t)}function sf(e,t){return t?e.replace(/\{([^}]+)\}/g,(r,i)=>{const a=t[i];return a==null?r:String(a)}):e}function aI({children:e,language:t}){return p.useEffect(()=>{document.documentElement.setAttribute("lang",t)},[t]),e}function oI(){const e=Mo(t=>t.profile.language);return t=>{const r=e==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const i of r){const a=Oh(t,$N[i]);if(a!==t)return a;const c=Oh(t,qN[i]);if(c!==t)return c}return t}}const VN=[{id:"light",labelKey:"theme.light",color:"#f6f4ef"},{id:"dark",labelKey:"theme.dark",color:"#1b1b1b"},{id:"sky-blue",labelKey:"theme.skyBlue",color:"#00f0ff"},{id:"eye-green",labelKey:"theme.eyeGreen",color:"#16a34a"}];function GN(e){return o(e.labelKey)}function lI(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function cI(){return Ts.getState().profile.theme??lI()}function uI(e){typeof window>"u"||(document.documentElement.setAttribute("data-theme",e),Eh({theme:e}).catch(()=>{}))}function KN(){return{theme:Mo(t=>t.profile.theme),setTheme:uI}}function dI(){typeof window>"u"||document.documentElement.setAttribute("data-theme",cI())}function hI({children:e}){const t=Mo(r=>r.profile.theme);return p.useEffect(()=>{dI()},[t]),n.jsx(n.Fragment,{children:e})}const mI={showToast:()=>"",dismissToast:()=>{}},YN=p.createContext(mI);function pI(){return`toast-${Math.random().toString(36).slice(2,10)}`}function fI({toast:e,onDismiss:t}){const{id:r,title:i,description:a,tone:c,durationMs:u,action:d}=e;return p.useEffect(()=>{if(u===null)return;const m=window.setTimeout(()=>{t(r)},u);return()=>{window.clearTimeout(m)}},[u,r,t,i,a,c]),n.jsxs("article",{className:"toast-card","data-tone":c,role:c==="error"?"alert":"status",children:[n.jsxs("div",{className:"toast-body",children:[n.jsx("strong",{className:"toast-title",children:i}),a?n.jsx("p",{className:"toast-description",children:a}):null]}),n.jsxs("div",{className:"toast-actions",children:[d?n.jsx("button",{className:"toast-action",type:"button",onClick:()=>{d.onClick(),t(r)},children:d.label}):null,n.jsx("button",{className:"toast-dismiss",type:"button","aria-label":"关闭通知",onClick:()=>t(r),children:"×"})]})]})}function gI({children:e}){const[t,r]=p.useState([]),i=p.useCallback(u=>{r(d=>d.filter(m=>m.id!==u))},[]),a=p.useCallback(u=>{const d=u.id??pI(),m={id:d,title:u.title,description:u.description,tone:u.tone??"info",durationMs:u.durationMs===void 0?4200:u.durationMs,action:u.action};return r(f=>{const w=f.findIndex(v=>v.id===d);if(w===-1)return[...f,m];const g=[...f];return g[w]=m,g}),d},[]),c=p.useMemo(()=>({showToast:a,dismissToast:i}),[i,a]);return n.jsxs(YN.Provider,{value:c,children:[e,n.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(u=>n.jsx(fI,{toast:u,onDismiss:i},u.id))})]})}function Jn(){return p.useContext(YN)}const hh="0.3.0",XN=p.createContext(hh);function bI({children:e}){const t=pr(),[r,i]=p.useState(hh);return p.useEffect(()=>{let a=!1;return t.isDesktop?(t.bridge.getRuntimeInfo().then(c=>{var d,m;if(a)return;const u=c.ok?(m=(d=c.value)==null?void 0:d.version)==null?void 0:m.trim():"";i(u||hh)}),()=>{a=!0}):(i(hh),()=>{a=!0})},[t]),n.jsx(XN.Provider,{value:r,children:e})}function QN(){return p.useContext(XN)}class wI{constructor(){tt(this,"state",{epoch:0,activeHostId:In.getState().activeHostId});tt(this,"listeners",new Set);tt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));tt(this,"getState",()=>this.state);In.subscribe(()=>{const t=In.getState().activeHostId;t!==this.state.activeHostId&&(this.state={epoch:this.state.epoch+1,activeHostId:t},this.emit())})}emit(){for(const t of this.listeners)t()}}const Hk=new wI;function vI(){return p.useSyncExternalStore(Hk.subscribe,()=>{const e=Hk.getState();return`${e.activeHostId??"anonymous"}:${e.epoch}`})}const JN="codingns.server.base-url.history",ZN=6,eT="__custom__";function tT(){return typeof window<"u"&&typeof window.localStorage<"u"}function yI(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function nT(e){if(!e)return null;try{return Ps(e)}catch{return null}}function kI(){if(!tT())return[];const e=window.localStorage.getItem(JN);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>typeof r=="string"?nT(r):null).filter(r=>!!r):[]}catch{return[]}}function xI(e){const t=new Set,r=[];for(const i of e)!i||t.has(i)||(t.add(i),r.push(i));return r}function SI(e,t){const r=kI();return xI([e,...t,...r,nT(yI())]).slice(0,ZN)}function CI(e){tT()&&window.localStorage.setItem(JN,JSON.stringify(e.slice(0,ZN)))}class jI{constructor(){tt(this,"state",this.createState(In.getState()));tt(this,"listeners",new Set);tt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));tt(this,"getState",()=>this.state);In.subscribe(()=>{const t=this.createState(In.getState());t.baseUrl===this.state.baseUrl&&t.options.length===this.state.options.length&&t.options.every((r,i)=>r===this.state.options[i])||(this.state=t,this.emit())})}setBaseUrl(t){const r=In.getState(),i=Ga(r);if(!i)return!1;const a=Ps(t),c=a!==i.baseUrl,u=r.hosts.map(d=>d.id===i.id?{...d,baseUrl:a,name:new URL(a).host,updatedAt:new Date().toISOString()}:d);return this.state=this.createState({...r,hosts:u}),this.emit(),In.update({hosts:u}),c}reset(){this.state=this.createState(In.getState()),this.emit()}createState(t){const r=Ga(t),i=(r==null?void 0:r.baseUrl)??"",a=SI(i,t.hosts.map(c=>c.baseUrl));return CI(a),{baseUrl:i,options:a}}emit(){for(const t of this.listeners)t()}}const Bh=new jI;function Wh(e){return p.useSyncExternalStore(Bh.subscribe,()=>e(Bh.getState()))}function NI(e,t){return t.includes(e)?e:eT}function TI(){return eT}const rT={login(e,t,r){return hr.login(e,t,r)},bootstrap(e,t,r){return hr.bootstrap(e,t,r)},refresh(){return hr.refresh()},logout(){hr.clear()}};function PI(){const e=mr(),t=Wh(C=>C.baseUrl),[r,i]=p.useState("admin"),[a,c]=p.useState(""),[u,d]=p.useState(""),[m,f]=p.useState(null),[w,g]=p.useState("error"),[v,y]=p.useState(!1);async function x(C){if(C.preventDefault(),a!==u){g("error"),f(o("auth.bootstrapMismatch"));return}y(!0),f(null);try{await rT.bootstrap(r,a),g("success"),f(o("auth.bootstrapSuccess")),window.setTimeout(()=>e("/login",{replace:!0}),500)}catch(j){g("error"),j instanceof Kr?f(j.message):f(o("auth.authUnavailable"))}finally{y(!1)}}return n.jsx("main",{className:"page-center app-shell",children:n.jsxs("section",{className:"auth-card surface-card",children:[n.jsx("h1",{children:o("auth.bootstrapTitle")}),n.jsx("p",{className:"status-text",children:o("auth.bootstrapSubtitle")}),n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("auth.serverCurrent")}),n.jsx("span",{className:"auth-server-value",children:t})]}),n.jsxs("form",{className:"auth-form",onSubmit:x,children:[n.jsxs("label",{className:"field-group",children:[n.jsx("span",{children:o("auth.username")}),n.jsx("input",{value:r,onChange:C=>i(C.target.value)})]}),n.jsxs("label",{className:"field-group",children:[n.jsx("span",{children:o("auth.password")}),n.jsx("input",{type:"password",value:a,onChange:C=>c(C.target.value)})]}),n.jsxs("label",{className:"field-group",children:[n.jsx("span",{children:o("auth.confirmPassword")}),n.jsx("input",{type:"password",value:u,onChange:C=>d(C.target.value)})]}),m?n.jsx("p",{className:"status-text","data-tone":w,children:m}):null,n.jsx("button",{className:"primary-button",type:"submit",disabled:v,children:o(v?"common.loading":"auth.submitBootstrap")})]})]})})}async function iT(e){try{return{...await WA(e),reachable:!0}}catch{return{initialized:!1,reachable:!1}}}function DI({isOpen:e,onClose:t,onSave:r,theme:i="dark"}){const a=Wh(P=>P.baseUrl),c=Wh(P=>P.options),u=TI(),[d,m]=p.useState(a),[f,w]=p.useState(null),g=p.useMemo(()=>{try{return Ps(d)}catch{return null}},[d]),v=NI(g??d,c),y="server-settings-preset",x="server-settings-address";if(p.useEffect(()=>{e&&(m(a),w(null))},[e,a]),!e)return null;function C(){if(!g){w(o("auth.serverInvalid"));return}Bh.setBaseUrl(g),r==null||r(g),t()}function j(P){P.target===P.currentTarget&&t()}function N(){g&&m(g)}return n.jsx("div",{className:"server-settings-modal-backdrop","data-theme":i,onClick:j,role:"dialog","aria-modal":"true","aria-labelledby":"server-settings-title",children:n.jsxs("div",{className:"server-settings-modal",children:[n.jsxs("div",{className:"server-settings-modal-header",children:[n.jsx("div",{className:"cyber-header-line"}),n.jsxs("h2",{id:"server-settings-title",className:"cyber-title",children:[n.jsx("span",{className:"cyber-title-icon",children:"◈"}),o("auth.serverSettingsTitle")]}),n.jsx("div",{className:"cyber-header-line"}),n.jsx("button",{className:"server-settings-close",onClick:t,"aria-label":o("common.close"),children:"×"})]}),n.jsxs("div",{className:"server-settings-modal-content",children:[n.jsxs("label",{className:"field-group cyber-field",htmlFor:y,children:[n.jsx("span",{className:"cyber-label",children:o("auth.serverPreset")}),n.jsxs("div",{className:"cyber-select-wrapper",children:[n.jsxs("select",{id:y,"aria-label":o("auth.serverPreset"),className:"cyber-select",value:v,onChange:P=>{const L=P.target.value;L!==u&&(m(L),w(null))},children:[c.map(P=>n.jsx("option",{value:P,children:P},P)),n.jsx("option",{value:u,children:o("auth.serverCustomOption")})]}),n.jsx("span",{className:"cyber-select-arrow",children:"▼"})]})]}),n.jsxs("label",{className:"field-group cyber-field",htmlFor:x,children:[n.jsx("span",{className:"cyber-label",children:o("auth.serverAddress")}),n.jsxs("div",{className:"cyber-input-wrapper",children:[n.jsx("input",{id:x,"aria-label":o("auth.serverAddress"),className:"cyber-input",value:d,placeholder:o("auth.serverPlaceholder"),onBlur:N,onChange:P=>{m(P.target.value),w(null)}}),n.jsx("div",{className:"cyber-input-glow"})]})]}),n.jsxs("p",{className:"cyber-hint",children:[n.jsx("span",{className:"cyber-hint-icon",children:"ℹ"}),o("auth.serverHint")]}),f?n.jsxs("p",{className:"cyber-status","data-tone":"error",children:[n.jsx("span",{className:"cyber-status-icon",children:"⚠"}),f]}):null]}),n.jsxs("div",{className:"server-settings-modal-footer",children:[n.jsx("button",{className:"cyber-button cyber-button-secondary",onClick:t,children:o("common.cancel")}),n.jsxs("button",{className:"cyber-button cyber-button-primary",onClick:C,children:[n.jsx("span",{className:"cyber-button-glow"}),n.jsx("span",{className:"cyber-button-text",children:o("auth.saveServerSettings")})]})]})]})})}const zk="width=device-width, initial-scale=1.0, viewport-fit=cover",RI="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover";function MI(){const e=p.useRef(null);return p.useEffect(()=>{const t=e.current;if(!t)return;const r=t.getContext("2d");if(!r)return;let i;const a=()=>{u(),d()};let c=[];const u=()=>{t.width=window.innerWidth,t.height=window.innerHeight},d=()=>{c=[];const f=Math.min(50,Math.floor(t.width*t.height/25e3));for(let w=0;w<f;w++)c.push({x:Math.random()*t.width,y:Math.random()*t.height,vx:(Math.random()-.5)*.5,vy:(Math.random()-.5)*.5,size:Math.random()*2+1,opacity:Math.random()*.5+.2})},m=()=>{r.clearRect(0,0,t.width,t.height),c.forEach((f,w)=>{f.x+=f.vx,f.y+=f.vy,f.x<0&&(f.x=t.width),f.x>t.width&&(f.x=0),f.y<0&&(f.y=t.height),f.y>t.height&&(f.y=0),r.beginPath(),r.arc(f.x,f.y,f.size,0,Math.PI*2),r.fillStyle=`rgba(10, 132, 255, ${f.opacity})`,r.fill(),c.slice(w+1).forEach(g=>{const v=f.x-g.x,y=f.y-g.y,x=Math.sqrt(v*v+y*y);x<150&&(r.beginPath(),r.moveTo(f.x,f.y),r.lineTo(g.x,g.y),r.strokeStyle=`rgba(10, 132, 255, ${.1*(1-x/150)})`,r.stroke())})}),i=requestAnimationFrame(m)};return u(),d(),m(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),cancelAnimationFrame(i)}},[]),n.jsx("canvas",{ref:e,className:"particle-canvas"})}function AI({text:e}){return n.jsx("span",{className:"glitch-text","data-text":e,children:e})}function EI({text:e}){const[t,r]=p.useState(""),[i,a]=p.useState(!0);return p.useEffect(()=>{let c=0,u=null;const d=setInterval(()=>{c<=e.length?(r(e.slice(0,c)),c++):(clearInterval(d),u=window.setTimeout(()=>a(!1),1e3))},50);return()=>{clearInterval(d),u!==null&&window.clearTimeout(u)}},[e]),n.jsxs("span",{className:"typewriter-text",children:[t,i&&n.jsx("span",{className:"typewriter-cursor",children:"_"})]})}function II(){const e=mr(),t=oI(),[r]=zE(),i=pr(),a=QN(),c=rm(de=>de.activeHostId),u=Sb(i.platform),d=p.useMemo(()=>eA(i),[i]),m=p.useMemo(()=>d?tA(c):{credentials:null,legacyServerBaseUrl:null},[c,d]),f=m.credentials,w=m.legacyServerBaseUrl,[g,v]=p.useState(()=>(f==null?void 0:f.username)??"admin"),[y,x]=p.useState(()=>(f==null?void 0:f.password)??""),[C,j]=p.useState(()=>!!f),N=Wh(de=>de.baseUrl),[P,L]=p.useState(N),[Y,H]=p.useState(null),[W,I]=p.useState(!1),[M,O]=p.useState(!1),[F,X]=p.useState(null),[U,G]=p.useState(!1),R=im(de=>de.session),A=p.useMemo(()=>r.get("returnTo")??"/",[r]),{theme:Z}=KN(),pe=p.useRef(!1),q=i.isNativeMobile,D=p.useMemo(()=>Z==="light"?"light":"dark",[Z]);p.useEffect(()=>{v((f==null?void 0:f.username)??"admin"),x((f==null?void 0:f.password)??""),j(!!f)},[f]),p.useEffect(()=>{if(typeof document>"u")return;const de=document.querySelector('meta[name="viewport"]');if(!(de instanceof HTMLMetaElement))return;const le=de.getAttribute("content")??zk;return q?de.setAttribute("content",RI):de.setAttribute("content",zk),()=>{de.setAttribute("content",le)}},[q]),p.useEffect(()=>{pe.current||(pe.current=!0,!(!d||!w||w===N)&&(Bh.setBaseUrl(w),L(w)))},[N,d,w]),p.useEffect(()=>{if(R){e(A,{replace:!0});return}if(!P)return;let de=!1;return iT(P).then(le=>{de||(le.demoMode&&(G(!0),BA()&&H(t("auth.demoSessionExpired"))),le.reachable&&!le.initialized&&e("/bootstrap",{replace:!0}))}).catch(()=>{de||H(t("auth.authUnavailable"))}),()=>{de=!0}},[R,e,P,A,t]);async function T(de){de.preventDefault(),I(!0),H(null),L(N),d&&!C&&c&&iA(c);try{await rT.login(g,y,N),await Ts.refreshForAuthenticatedUser(),d&&C&&c&&nA({hostId:c,username:g,password:y}),e(A,{replace:!0})}catch(le){if(le instanceof Kr){if(le.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}H(le.message)}else H(t("auth.authUnavailable"))}finally{I(!1)}}function B(de){L(de),H(null)}const Q="login-username",_="login-password";return n.jsxs("main",{className:"cyber-login-page","data-theme":D,"data-native-mobile":q?"true":"false",children:[n.jsxs("div",{className:"cyber-bg",children:[n.jsx("div",{className:"cyber-grid"}),n.jsx("div",{className:"cyber-glow cyber-glow-1"}),n.jsx("div",{className:"cyber-glow cyber-glow-2"}),n.jsx(MI,{})]}),n.jsx("div",{className:"scanlines"}),n.jsxs("div",{className:"cyber-login-container",children:[n.jsx("div",{className:"cyber-login-toolbar",children:n.jsx(Lb,{variant:"compact"})}),n.jsxs("div",{className:"cyber-login-content",children:[n.jsxs("div",{className:"cyber-brand",children:[n.jsx("div",{className:"cyber-logo",children:n.jsx("img",{src:"/logo.png",alt:"CodingNS",className:"cyber-logo-svg"})}),n.jsx("h1",{className:"cyber-brand-title",children:n.jsx(AI,{text:"CodingNS"})}),n.jsx("p",{className:"cyber-brand-subtitle",children:n.jsx(EI,{text:t("auth.loginSubtitle")})})]}),n.jsxs("div",{className:"cyber-card",children:[n.jsx("div",{className:"cyber-corner corner-tl"}),n.jsx("div",{className:"cyber-corner corner-tr"}),n.jsx("div",{className:"cyber-corner corner-bl"}),n.jsx("div",{className:"cyber-corner corner-br"}),n.jsxs("div",{className:"cyber-card-header",children:[n.jsx("div",{className:"cyber-line"}),n.jsx("span",{className:"cyber-card-label",children:t("auth.loginTitle").toUpperCase()}),n.jsx("div",{className:"cyber-line"})]}),U?n.jsxs("div",{className:"cyber-demo-banner",children:[n.jsx("span",{className:"cyber-demo-icon",children:"⚠"}),n.jsx("span",{children:t("auth.demoBanner")})]}):null,n.jsxs("form",{className:"cyber-form",onSubmit:T,children:[n.jsxs("div",{className:`cyber-field ${F==="username"?"focused":""}`,children:[n.jsx("div",{className:"cyber-field-border",children:n.jsx("div",{className:"cyber-field-border-glow"})}),n.jsxs("label",{className:"cyber-field-label",htmlFor:Q,children:[n.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),n.jsx("input",{id:Q,"aria-label":t("auth.username"),className:"cyber-input",value:g,onChange:de=>v(de.target.value),onFocus:()=>X("username"),onBlur:()=>X(null),autoComplete:"username"})]}),n.jsxs("div",{className:`cyber-field ${F==="password"?"focused":""}`,children:[n.jsx("div",{className:"cyber-field-border",children:n.jsx("div",{className:"cyber-field-border-glow"})}),n.jsxs("label",{className:"cyber-field-label",htmlFor:_,children:[n.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),n.jsx("input",{id:_,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:y,onChange:de=>x(de.target.value),onFocus:()=>X("password"),onBlur:()=>X(null),autoComplete:"current-password"})]}),d?n.jsxs("label",{className:"cyber-remember-toggle",children:[n.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:C,onChange:de=>j(de.target.checked)}),n.jsx("span",{children:t("auth.rememberPassword")})]}):null,Y?n.jsxs("div",{className:"cyber-status","data-tone":"error",children:[n.jsx("span",{className:"cyber-status-icon",children:"⚠"}),n.jsx("span",{children:Y})]}):null,n.jsxs("button",{className:`cyber-submit ${W?"loading":""}`,type:"submit",disabled:W,children:[n.jsx("span",{className:"cyber-submit-glow"}),n.jsx("span",{className:"cyber-submit-border"}),n.jsx("span",{className:"cyber-submit-text",children:W?n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"cyber-spinner"}),t("common.loading")]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"cyber-submit-icon",children:"➤"}),t("auth.submitLogin")]})})]})]}),u?n.jsxs("div",{className:"cyber-footer",children:[n.jsxs("div",{className:"cyber-divider",children:[n.jsx("span",{className:"cyber-divider-line"}),n.jsx("span",{className:"cyber-divider-text",children:"//"}),n.jsx("span",{className:"cyber-divider-line"})]}),n.jsxs("button",{className:"cyber-server-btn",onClick:()=>O(!0),type:"button",children:[n.jsx("span",{className:"cyber-server-icon",children:"⚙"}),n.jsx("span",{className:"cyber-server-text",children:t("auth.serverSettings")}),n.jsx("span",{className:"cyber-server-current",children:N})]})]}):null]})]}),n.jsxs("div",{className:"cyber-version",children:[n.jsxs("span",{className:"cyber-version-text",children:["v",a]}),n.jsx("span",{className:"cyber-version-divider",children:"|"}),n.jsx("span",{className:"cyber-version-text",children:"SYSTEM READY"})]})]}),u?n.jsx(DI,{isOpen:M,onClose:()=>O(!1),onSave:B,theme:D}):null]})}function ms(){return pr().haptics}function sT(e,t){const r=new Map(e.map(c=>[t.getId(c),c])),i=new Map,a=[];for(const c of e){const u=LI(c,r,t);if(!u){a.push(c);continue}const d=i.get(u)??[];i.set(u,[...d,c])}return[...a].sort(t.compare).map(c=>lT(c,0,i,t,new Set))}function qs(e){return Array.isArray(e==null?void 0:e.children)?e.children:[]}function aT(e){return e.flatMap(t=>[t.item,...aT(qs(t))])}function cs(e){return e.flatMap(t=>[t,...cs(qs(t))])}function om(e,t){return e.some(r=>t(r.item)||om(qs(r),t))}function oT(e,t,r){return e?r(e.item)===t?!0:qs(e).some(i=>oT(i,t,r)):!1}function ca(e,t,r){for(const i of e){const a=r(i.item);if(a===t)return[];const c=ca(qs(i),t,r);if(oT(i,t,r)&&c.length>=0)return[a,...c]}return[]}function lT(e,t,r,i,a){const c=i.getId(e),u=new Set(a);u.add(c);const d=[...r.get(c)??[]].filter(m=>!u.has(i.getId(m))).sort(i.compare).map(m=>lT(m,t+1,r,i,u));return{item:e,depth:t,children:d}}function LI(e,t,r){const i=qk(r.getParentId(e));if(!i)return null;const a=t.get(i);if(!a)return null;const c=new Set([r.getId(e)]);let u=a;for(;u;){const d=r.getId(u);if(c.has(d))return null;c.add(d);const m=qk(r.getParentId(u));if(!m||(u=t.get(m),!u))return i}return i}function qk(e){const t=e==null?void 0:e.trim();return t||null}function Ti(){return"/workspaces"}function Ai(e){return`/workspaces/${encodeURIComponent(e)}`}function FI(e){return`${Ai(e)}/debug`}function Co(e){return`${Ai(e)}/sessions`}function Nr(e,t){return`${Co(e)}/${encodeURIComponent(t)}`}function El(e,t){const r=`${Ai(e)}/tools`;if(!t)return r;const i=new URLSearchParams({tab:t});return`${r}?${i.toString()}`}function cT(e){return`${Ai(e)}/tools/files`}function uT(e){return`${Ai(e)}/tools/git`}function lm(e){return`${Ai(e)}/tools/processes`}function vl(e){return`${Ai(e)}/terminals`}function jo(e,t){const r=`${Ai(e)}/butler`;if(!t)return r;const i=new URLSearchParams({tab:t});return`${r}?${i.toString()}`}function dT(e){return e.flatMap(t=>[...t.sessions.map(r=>({session:r,workspace:t.workspace})),...mT(t.childWorktrees??[])]).sort((t,r)=>(r.session.lastMessageAt??r.session.updatedAt).localeCompare(t.session.lastMessageAt??t.session.updatedAt))}function Fb(e){return sT(e,{getId:t=>t.session.sessionId,getParentId:t=>{var r;return((r=t.session.parentSessionId)==null?void 0:r.trim())||null},compare:OI})}function hT(e,t){const r=_I(),i=new URLSearchParams({provider:t});return`${Nr(e,r)}?${i.toString()}`}function _I(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`draft-${e.randomUUID()}`:`draft-${Date.now()}-${Math.random().toString(16).slice(2)}`}function OI(e,t){return(t.session.lastMessageAt??t.session.updatedAt).localeCompare(e.session.lastMessageAt??e.session.updatedAt)}function mT(e){return e.flatMap(t=>[...t.sessions.map(r=>({session:r,workspace:t.workspace})),...mT(t.children)])}const BI="mobile.tools.last-primary-tool";function pT(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(BI)==="git"?"git":"files"}catch{return"files"}}function _b(e){var i;const t=[{pattern:"/workspaces/:workspaceId/tools/processes",routeKind:"processes"},{pattern:"/workspaces/:workspaceId/tools/files",routeKind:"files"},{pattern:"/workspaces/:workspaceId/tools/git",routeKind:"git"},{pattern:"/workspaces/:workspaceId/tools",routeKind:"home"}];for(const a of t){const c=Ir(a.pattern,e),u=((i=c==null?void 0:c.params.workspaceId)==null?void 0:i.trim())??null;if(u)return{workspaceId:u,routeKind:a.routeKind,legacy:!1}}const r=[{pattern:"/tools/processes",routeKind:"processes"},{pattern:"/tools/files",routeKind:"files"},{pattern:"/tools/git",routeKind:"git"},{pattern:"/tools",routeKind:"home"}];for(const a of r)if(Ir(a.pattern,e))return{workspaceId:null,routeKind:a.routeKind,legacy:!0};return null}function WI(e,t){const r=_b(e);if((r==null?void 0:r.routeKind)==="git")return"git";if((r==null?void 0:r.routeKind)==="files")return"files";const i=new URLSearchParams(t).get("tab");return i==="git"?"git":i==="files"?"files":pT()}function Ob(e,t){const r=_b(e);return r!=null&&r.workspaceId?El(r.workspaceId,WI(e,t)):r!=null&&r.legacy?pT()==="git"?"/tools?tab=git":"/tools?tab=files":null}function Bb({activeEntry:e,presentation:t,pathname:r,search:i,moreButtonLabel:a}){if(t==="conversation-focus"||e!=="tools")return null;const c=_b(r);return c?c.routeKind==="processes"?{title:o("shell.terminalManagerEntry"),showBackButton:!0,showMoreButton:!1,moreButtonLabel:a}:(c.routeKind==="home"||c.routeKind==="files"||c.routeKind==="git",null):null}const fT=p.createContext({composerPortalTarget:null});function Wb({composerPortalTarget:e,children:t}){return n.jsx(fT.Provider,{value:{composerPortalTarget:e},children:t})}function gT(){return p.useContext(fT)}function Ub(e,t,r){const[i,a]=p.useState(void 0);return p.useEffect(()=>{const c=e.current,u=t.current;if(!r||!c||!u){a(void 0),c&&c.style.removeProperty("--mobile-conversation-tabbar-height");return}const d=c,m=u;function f(){if(!e.current||!m.isConnected)return;const g=`${Math.round(m.getBoundingClientRect().height)}px`;d.style.setProperty("--mobile-conversation-tabbar-height",g),a(g)}f();const w=typeof ResizeObserver<"u"?new ResizeObserver(f):null;return w==null||w.observe(m),window.addEventListener("resize",f),()=>{w==null||w.disconnect(),window.removeEventListener("resize",f),d.style.removeProperty("--mobile-conversation-tabbar-height")}},[r,e,t]),i}const UI=3e3,xd=10,$k=84,Vk=.36;function Hb({enabled:e,rootRef:t,suspended:r=!1,resetKey:i}){const a=p.useRef(null),c=p.useRef(null),u=p.useRef("visible"),d=p.useRef(1),[m,f]=p.useState("visible"),[w,g]=p.useState(1);p.useEffect(()=>{u.current=m},[m]),p.useEffect(()=>{d.current=w},[w]);function v(){co(a),a.current=window.setTimeout(()=>{y()},UI)}function y(){f("hidden"),g(0)}function x(){f("visible"),g(1),v()}p.useEffect(()=>{if(co(a),!e){co(a),f("visible"),g(1);return}if(r){f("hidden"),g(0);return}return x(),()=>{co(a)}},[e,i,r]),p.useEffect(()=>()=>{co(a)},[]),p.useEffect(()=>{if(!e||r){c.current=null;return}const j=t.current;if(!j)return;function N(M){if(M.touches.length!==1){c.current=null;return}const O=M.touches[0],F=Yk(M.target);if(!O||!F){c.current=null;return}c.current={surface:F,startX:O.clientX,startY:O.clientY,pointerType:"touch",initialState:u.current==="visible"?"visible":"hidden",touchId:O.identifier,dragging:!1,latestProgress:d.current},u.current==="visible"&&co(a)}function P(M){const O=c.current;if(!O||O.pointerType!=="touch")return;const F=af(M.touches,O.touchId);if(!F)return;const X=F.clientX-O.startX,U=F.clientY-O.startY;if(O.surface==="conversation"){if(Math.abs(U)<=xd||Math.abs(U)<=Math.abs(X))return;c.current=null,O.initialState==="visible"&&y();return}const G=O.initialState==="hidden"?-U:U;G<=xd&&!O.dragging||(Qk(M),O.dragging=!0,O.latestProgress=Gk(O.initialState,G),f("dragging"),g(O.latestProgress))}function L(M){const O=c.current;if(!(!O||O.pointerType!=="touch"||!af(M.changedTouches,O.touchId))){if(c.current=null,!O.dragging){O.initialState==="visible"&&v();return}Kk(O.initialState,O.latestProgress,x,f,g)}}function Y(M){const O=c.current;if(!(!O||O.pointerType!=="touch"||!af(M.changedTouches,O.touchId))){if(c.current=null,!O.dragging){O.initialState==="visible"&&v();return}if(O.initialState==="visible"){x();return}f("hidden"),g(0)}}function H(M){if(M.pointerType!=="touch")return;const O=Yk(M.target);if(!O){c.current=null;return}if(c.current={surface:O,startX:M.clientX,startY:M.clientY,pointerType:"pointer",initialState:u.current==="visible"?"visible":"hidden",pointerId:M.pointerId,captureTarget:M.target instanceof Element?M.target:null,dragging:!1,latestProgress:d.current},M.target instanceof Element)try{M.target.setPointerCapture(M.pointerId)}catch{}u.current==="visible"&&co(a)}function W(M){const O=c.current;if(!O||O.pointerType!=="pointer")return;const F=M.clientX-O.startX,X=M.clientY-O.startY;if(O.surface==="conversation"){if(Math.abs(X)<=xd||Math.abs(X)<=Math.abs(F))return;c.current=null,O.initialState==="visible"&&y();return}const U=O.initialState==="hidden"?-X:X;U<=xd&&!O.dragging||(Qk(M),O.dragging=!0,O.latestProgress=Gk(O.initialState,U),f("dragging"),g(O.latestProgress))}function I(M){const O=c.current;if(!(!O||O.pointerType!=="pointer"||O.pointerId!==M.pointerId)){if(c.current=null,HI(O),!O.dragging){O.initialState==="visible"&&v();return}Kk(O.initialState,O.latestProgress,x,f,g)}}return j.addEventListener("touchstart",N,{passive:!0}),j.addEventListener("pointerdown",H,{passive:!0}),window.addEventListener("touchmove",P,{passive:!1}),window.addEventListener("touchend",L),window.addEventListener("touchcancel",Y),window.addEventListener("pointermove",W,{passive:!1}),window.addEventListener("pointerup",I),window.addEventListener("pointercancel",I),()=>{j.removeEventListener("touchstart",N),j.removeEventListener("pointerdown",H),window.removeEventListener("touchmove",P),window.removeEventListener("touchend",L),window.removeEventListener("touchcancel",Y),window.removeEventListener("pointermove",W),window.removeEventListener("pointerup",I),window.removeEventListener("pointercancel",I)}},[e,t,r]);const C=e&&!r?w:e?0:1;return{state:r&&e?"hidden":m,progress:C,isOpen:C>.01}}function co(e){e.current!==null&&(window.clearTimeout(e.current),e.current=null)}function Gk(e,t){return Xk(e==="hidden"?t/$k:1-t/$k,0,1)}function Kk(e,t,r,i,a){if(e==="hidden"){if(t>=Vk){r();return}i("hidden"),a(0);return}if(t<=1-Vk){i("hidden"),a(0);return}r()}function HI(e){if(!(e.pointerType!=="pointer"||typeof e.pointerId!="number"||!(e.captureTarget instanceof Element)))try{e.captureTarget.hasPointerCapture(e.pointerId)&&e.captureTarget.releasePointerCapture(e.pointerId)}catch{}}function af(e,t){if(typeof t!="number")return e[0]??null;for(let r=0;r<e.length;r+=1){const i=e[r];if((i==null?void 0:i.identifier)===t)return i}return null}function Yk(e){return e instanceof Element?e.closest(".composer-panel")?"composer":e.closest(".message-list, .message-timeline, .mobile-conversation-main, .conversation-page-shell")?"conversation":null:null}function Xk(e,t,r){return Math.min(Math.max(e,t),r)}function Qk(e){e.cancelable&&e.preventDefault()}function bu({viewportClass:e,activeEntry:t,hasNavigationPanel:r,hasAuxiliaryPanel:i,preferCompactLayout:a=!1}){return a||e==="compact"?"compact":e==="expanded"&&r&&i?"expanded":t==="tools"&&i?"medium-auxiliary":r?"medium-navigation":i?"medium-auxiliary":"compact"}function cm(e){return!e.isNativeMobile||e.viewportClass==="expanded"||typeof window>"u"?!1:window.innerHeight>window.innerWidth}function bT(e){return e==="medium-navigation"||e==="expanded"}function wT(e){return e==="medium-auxiliary"||e==="expanded"}function zb({viewportClass:e,activeEntry:t,hasNavigationPanel:r,hasAuxiliaryPanel:i,preferCompactLayout:a=!1,children:c,navigationPanel:u,auxiliaryPanel:d}){const m=bu({viewportClass:e,activeEntry:t,hasNavigationPanel:r,hasAuxiliaryPanel:i,preferCompactLayout:a}),f=bT(m)&&u,w=wT(m)&&d;return n.jsxs("div",{className:"mobile-adaptive-pane-layout","data-pane-layout":m,children:[f?n.jsx("aside",{className:"workbench-nav surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-navigation",children:u}):null,n.jsx("div",{className:"mobile-adaptive-pane-main",children:c}),w?n.jsx("aside",{className:"workbench-auxiliary surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-auxiliary",children:d}):null]})}function zI({activeEntry:e,presentation:t="default",children:r,navigationPanel:i,auxiliaryPanel:a,onNavigateWorkspaces:c,onNavigateTerminals:u,onNavigateSessions:d,onNavigateTools:m,onNavigateToolFiles:f,onNavigateToolGit:w,onNavigateToolProcesses:g,onNavigateSettings:v}){const y=pr(),x=ms(),C=hs(),j=mr(),N=p.useRef(null),P=p.useRef(null),[L,Y]=p.useState(null),H=t==="conversation-focus",W=cm({isNativeMobile:y.isNativeMobile,viewportClass:y.viewportClass}),I=Hb({enabled:H,rootRef:N,resetKey:`${C.pathname}${C.search}`}),M=bu({viewportClass:y.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:W}),O=Bb({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:o("shell.androidMoreAction")}),F=[{key:"workspaces",label:o("shell.mobileWorkspacesEntry"),icon:n.jsx(VI,{}),onClick:c},{key:"sessions",label:o("shell.mobileSessionsEntry"),icon:n.jsx(GI,{}),onClick:d},{key:"terminals",label:o("shell.mobileTerminalsEntry"),icon:n.jsx(KI,{}),onClick:u},{key:"tools",label:o("shell.mobileToolsEntry"),icon:n.jsx(YI,{}),onClick:m},{key:"settings",label:o("shell.mobileSettingsEntry"),icon:n.jsx(XI,{}),onClick:v}],X=H?{"--mobile-conversation-tabbar-progress":I.progress.toFixed(4)}:void 0;Ub(N,P,H);function U(){const R=Ob(C.pathname,C.search);if(!R){m();return}j(R,{replace:!0})}const G=n.jsx("nav",{ref:P,className:"android-workbench-bottom-nav","aria-label":o("shell.title"),children:F.map(R=>n.jsxs("button",{type:"button",className:"android-workbench-bottom-nav-item","data-active":R.key===e,"aria-current":R.key===e?"page":void 0,onClick:()=>{R.key!==e&&x.trigger("selection"),R.onClick()},children:[n.jsx("span",{className:"android-workbench-bottom-nav-icon","aria-hidden":"true",children:R.icon}),n.jsx("span",{className:"android-workbench-bottom-nav-label",children:R.label})]},R.key))});return n.jsx(Wb,{composerPortalTarget:H?L:null,children:n.jsxs("div",{ref:N,className:"android-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":M,"data-tabbar-open":H?I.isOpen:!0,"data-conversation-tabbar-state":H?I.state:"default",style:X,children:[O?n.jsxs("header",{className:"android-workbench-topbar","data-header-kind":"tools",children:[n.jsxs("div",{className:"android-workbench-topbar-leading",children:[O.showBackButton?n.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":o("common.back"),onClick:U,children:n.jsx(qI,{})}):null,n.jsx("div",{className:"android-workbench-topbar-copy",children:n.jsx("h1",{children:O.title})})]}),n.jsx("div",{className:"android-workbench-topbar-actions",children:O.showMoreButton?n.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":O.moreButtonLabel,onClick:g,children:n.jsx($I,{})}):null})]}):null,n.jsx("div",{className:"android-workbench-content",children:n.jsx(zb,{viewportClass:y.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:W,navigationPanel:i,auxiliaryPanel:a,children:r})}),H?n.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[n.jsx("div",{ref:Y,className:"mobile-conversation-bottom-layer-composer-slot"}),n.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:G})]}):G]})})}function qI(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"m15 18-6-6 6-6"}),n.jsx("path",{d:"M21 12H9"})]})}function $I(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[n.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function VI(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),n.jsx("path",{d:"M8 13h8"})]})}function GI(){return n.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function KI(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),n.jsx("path",{d:"m7.5 9 3 3-3 3"}),n.jsx("path",{d:"M12.5 15H17"})]})}function YI(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M8 6V4.8A1.8 1.8 0 0 1 9.8 3h4.4A1.8 1.8 0 0 1 16 4.8V6"}),n.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),n.jsx("path",{d:"M3 12h18"}),n.jsx("path",{d:"M10 11.5h4"})]})}function XI(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("circle",{cx:"12",cy:"12",r:"3"}),n.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}const QI=120,Nc={viewportHeight:null,keyboardInset:0,keyboardOpen:!1};function Eg(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function JI(e){if(!(e instanceof HTMLElement))return!1;if(e.isContentEditable||e.closest("[contenteditable='true']"))return!0;if(e instanceof HTMLTextAreaElement)return!e.readOnly&&!e.disabled;if(e instanceof HTMLInputElement){if(e.readOnly||e.disabled)return!1;const t=(e.type||"text").toLowerCase();return!["button","checkbox","color","file","hidden","image","radio","range","reset","submit"].includes(t)}return!1}function ZI(){var t;if(typeof window>"u")return 0;const e=[window.innerHeight,typeof document<"u"?(t=document.documentElement)==null?void 0:t.clientHeight:0].filter(Eg);return e.length>0?Math.max(...e):0}function Jk(){if(typeof window>"u")return Nc;const e=window.visualViewport,t=ZI(),r=(e==null?void 0:e.height)??t,i=Eg(r)?Math.round(r):null,a=Eg(e==null?void 0:e.offsetTop)?(e==null?void 0:e.offsetTop)??0:0,c=i===null?0:Math.max(0,Math.round(t-i-a));return{viewportHeight:i,keyboardInset:c,keyboardOpen:JI(typeof document<"u"?document.activeElement:null)&&c>=QI}}function of(e,t){if(typeof document>"u")return;[document.documentElement,document.body].filter(i=>i instanceof HTMLElement).forEach(i=>{if(!e){delete i.dataset.mobileKeyboardOpen,delete i.dataset.mobileViewportBound,i.style.removeProperty("--mobile-shell-viewport-height"),i.style.removeProperty("--mobile-shell-keyboard-inset");return}i.dataset.mobileKeyboardOpen=String(t.keyboardOpen),i.dataset.mobileViewportBound="true",t.viewportHeight===null?i.style.removeProperty("--mobile-shell-viewport-height"):i.style.setProperty("--mobile-shell-viewport-height",`${t.viewportHeight}px`),i.style.setProperty("--mobile-shell-keyboard-inset",`${t.keyboardInset}px`)})}function eL(e){const[t,r]=p.useState(()=>e?Jk():Nc),i=p.useRef(null);return p.useEffect(()=>{if(!e){r(Nc),of(!1,Nc);return}function a(){r(Jk())}function c(){i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{i.current=null,a()},0)}a();const u=window.visualViewport;return window.addEventListener("resize",a),window.addEventListener("orientationchange",a),u==null||u.addEventListener("resize",a),u==null||u.addEventListener("scroll",a),document.addEventListener("focusin",a),document.addEventListener("focusout",c),()=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null),window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a),u==null||u.removeEventListener("resize",a),u==null||u.removeEventListener("scroll",a),document.removeEventListener("focusin",a),document.removeEventListener("focusout",c),of(!1,Nc)}},[e]),p.useEffect(()=>{of(e,t)},[e,t]),t}function tL({activeEntry:e,presentation:t="default",children:r,navigationPanel:i,auxiliaryPanel:a,onNavigateWorkspaces:c,onNavigateTerminals:u,onNavigateSessions:d,onNavigateTools:m,onNavigateToolFiles:f,onNavigateToolGit:w,onNavigateToolProcesses:g,onNavigateSettings:v}){const y=pr(),x=ms(),C=hs(),j=mr(),N=p.useRef(null),P=p.useRef(null),[L,Y]=p.useState(null),H=t==="conversation-focus",W=cm({isNativeMobile:y.isNativeMobile,viewportClass:y.viewportClass}),I=Hb({enabled:H,rootRef:N,resetKey:`${C.pathname}${C.search}`}),M=bu({viewportClass:y.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:W}),O=Bb({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:o("shell.iosMoreAction")}),F=[{key:"workspaces",label:o("shell.mobileWorkspacesEntry"),icon:n.jsx(iL,{}),onClick:c},{key:"sessions",label:o("shell.mobileSessionsEntry"),icon:n.jsx(sL,{}),onClick:d},{key:"terminals",label:o("shell.mobileTerminalsEntry"),icon:n.jsx(aL,{}),onClick:u},{key:"tools",label:o("shell.mobileToolsEntry"),icon:n.jsx(oL,{}),onClick:m},{key:"settings",label:o("shell.mobileSettingsEntry"),icon:n.jsx(lL,{}),onClick:v}],X=H?{"--mobile-conversation-tabbar-progress":I.progress.toFixed(4)}:void 0;Ub(N,P,H);function U(){const R=Ob(C.pathname,C.search);if(!R){m();return}j(R,{replace:!0})}const G=n.jsx("nav",{ref:P,className:"ios-workbench-tabbar","aria-label":o("shell.title"),children:F.map(R=>n.jsxs("button",{type:"button",className:"ios-workbench-tabbar-item","data-active":R.key===e,"aria-current":R.key===e?"page":void 0,onClick:()=>{R.key!==e&&x.trigger("selection"),R.onClick()},children:[n.jsx("span",{className:"ios-workbench-tabbar-icon","aria-hidden":"true",children:R.icon}),n.jsx("span",{className:"ios-workbench-tabbar-label",children:R.label})]},R.key))});return n.jsx(Wb,{composerPortalTarget:H?L:null,children:n.jsxs("div",{ref:N,className:"ios-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":M,"data-tabbar-open":H?I.isOpen:!0,"data-conversation-tabbar-state":H?I.state:"default",style:X,children:[O?n.jsxs("header",{className:"ios-workbench-nav","data-header-kind":"tools",children:[n.jsx("div",{className:"ios-workbench-nav-leading",children:O.showBackButton?n.jsxs("button",{type:"button",className:"ios-workbench-back-button","aria-label":o("common.back"),onClick:U,children:[n.jsx(nL,{}),n.jsx("span",{children:o("common.back")})]}):null}),n.jsx("div",{className:"ios-workbench-nav-copy",children:n.jsx("h1",{children:O.title})}),n.jsx("div",{className:"ios-workbench-nav-actions",children:O.showMoreButton?n.jsx("button",{type:"button",className:"ios-workbench-icon-button","aria-label":O.moreButtonLabel,onClick:g,children:n.jsx(rL,{})}):null})]}):null,n.jsx("div",{className:"ios-workbench-content",children:n.jsx(zb,{viewportClass:y.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:W,navigationPanel:i,auxiliaryPanel:a,children:r})}),H?n.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[n.jsx("div",{ref:Y,className:"mobile-conversation-bottom-layer-composer-slot"}),n.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:G})]}):G]})})}function nL(){return n.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:n.jsx("path",{d:"m15 18-6-6 6-6"})})}function rL(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[n.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function iL(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[n.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),n.jsx("path",{d:"M8 13h8"})]})}function sL(){return n.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:n.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function aL(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),n.jsx("path",{d:"m7.5 9 3 3-3 3"}),n.jsx("path",{d:"M12.5 15H17"})]})}function oL(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[n.jsx("path",{d:"M8 6V4.8A1.8 1.8 0 0 1 9.8 3h4.4A1.8 1.8 0 0 1 16 4.8V6"}),n.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),n.jsx("path",{d:"M3 12h18"}),n.jsx("path",{d:"M10 11.5h4"})]})}function lL(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",children:[n.jsx("circle",{cx:"12",cy:"12",r:"3"}),n.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}function cL(e){const t=pr();return t.platform==="ios"?n.jsx(tL,{...e}):t.platform==="android"?n.jsx(zI,{...e}):n.jsx(uL,{...e})}function uL({activeEntry:e,presentation:t="default",children:r,navigationPanel:i,auxiliaryPanel:a,onNavigateWorkspaces:c,onNavigateTerminals:u,onNavigateSessions:d,onNavigateTools:m,onNavigateToolFiles:f,onNavigateToolGit:w,onNavigateToolProcesses:g,onNavigateSettings:v}){const y=pr(),x=ms(),C=hs(),j=mr(),N=p.useRef(null),P=p.useRef(null),[L,Y]=p.useState(null),H=eL(y.platform==="web"),W=y.platform==="web"&&H.keyboardOpen,I=t==="conversation-focus",M=cm({isNativeMobile:y.isNativeMobile,viewportClass:y.viewportClass}),O=Hb({enabled:I,rootRef:N,suspended:W,resetKey:`${C.pathname}${C.search}`}),F=bu({viewportClass:y.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:M}),X=Bb({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:o("shell.iosMoreAction")}),U=[{key:"workspaces",label:o("shell.mobileWorkspacesEntry"),icon:n.jsx(mL,{}),onClick:c},{key:"sessions",label:o("shell.mobileSessionsEntry"),icon:n.jsx(pL,{}),onClick:d},{key:"terminals",label:o("shell.mobileTerminalsEntry"),icon:n.jsx(fL,{}),onClick:u},{key:"tools",label:o("shell.mobileToolsEntry"),icon:n.jsx(gL,{}),onClick:m},{key:"settings",label:o("shell.mobileSettingsEntry"),icon:n.jsx(bL,{}),onClick:v}],G=I?{"--mobile-conversation-tabbar-progress":O.progress.toFixed(4)}:void 0;Ub(N,P,I);function R(){const Z=Ob(C.pathname,C.search);if(!Z){m();return}j(Z,{replace:!0})}const A=n.jsx("nav",{ref:P,className:"mobile-workbench-tabbar","aria-label":o("shell.title"),hidden:W,children:U.map(Z=>n.jsxs("button",{type:"button",className:"mobile-workbench-tabbar-item","data-active":Z.key===e,"aria-current":Z.key===e?"page":void 0,onClick:()=>{Z.key!==e&&x.trigger("selection"),Z.onClick()},children:[n.jsx("span",{className:"mobile-workbench-tabbar-icon","aria-hidden":"true",children:Z.icon}),n.jsx("span",{className:"mobile-workbench-tabbar-label",children:Z.label})]},Z.key))});return n.jsx(Wb,{composerPortalTarget:I?L:null,children:n.jsxs("div",{ref:N,className:"mobile-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-mobile-runtime":y.platform,"data-mobile-keyboard-open":W,"data-pane-layout":F,"data-tabbar-open":W?!1:I?O.isOpen:!0,"data-conversation-tabbar-state":I?O.state:"default",style:G,children:[X?n.jsxs("header",{className:"mobile-workbench-header","data-header-kind":"tools",children:[n.jsxs("div",{className:"mobile-workbench-header-leading",children:[X.showBackButton?n.jsx("button",{type:"button",className:"mobile-workbench-header-button","aria-label":o("common.back"),onClick:R,children:n.jsx(dL,{})}):null,n.jsx("div",{className:"mobile-workbench-header-copy",children:n.jsx("h1",{children:X.title})})]}),n.jsx("div",{className:"mobile-workbench-header-actions",children:X.showMoreButton?n.jsx("button",{type:"button",className:"mobile-workbench-header-button mobile-tools-more-button","aria-label":X.moreButtonLabel,onClick:g,children:n.jsx(hL,{})}):null})]}):null,n.jsx("div",{className:"mobile-workbench-content",children:n.jsx(zb,{viewportClass:y.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:M,navigationPanel:i,auxiliaryPanel:a,children:r})}),I?n.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[n.jsx("div",{ref:Y,className:"mobile-conversation-bottom-layer-composer-slot"}),n.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:A})]}):A]})})}function dL(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("path",{d:"m15 18-6-6 6-6"}),n.jsx("path",{d:"M21 12H9"})]})}function hL(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[n.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function mL(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),n.jsx("path",{d:"M8 13h8"})]})}function pL(){return n.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:n.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function fL(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),n.jsx("path",{d:"m7.5 9 3 3-3 3"}),n.jsx("path",{d:"M12.5 15H17"})]})}function gL(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("path",{d:"M8 6V4.8A1.8 1.8 0 0 1 9.8 3h4.4A1.8 1.8 0 0 1 16 4.8V6"}),n.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),n.jsx("path",{d:"M3 12h18"}),n.jsx("path",{d:"M10 11.5h4"})]})}function bL(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("circle",{cx:"12",cy:"12",r:"3"}),n.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}class vT{constructor(t){tt(this,"maxAttempts");tt(this,"baseDelayMs");tt(this,"reconnectAttempts",0);tt(this,"reconnectTimer",null);tt(this,"disposed",!1);this.options=t,this.maxAttempts=t.maxAttempts??4,this.baseDelayMs=t.baseDelayMs??300}start(){this.options.onReconnect(!1)}markConnected(){this.reconnectAttempts=0,this.options.onStateChange("connected")}markTransientFailure(){this.disposed||this.reconnectAttempts>0||this.options.onStateChange("reconnecting")}markDisconnected(){if(this.disposed)return;if(!In.getState().autoReconnect){this.options.onStateChange("reconnect_failed");return}if(this.reconnectAttempts+=1,this.reconnectAttempts>this.maxAttempts){this.options.onStateChange("reconnect_failed");return}this.options.onStateChange("reconnecting");const t=this.baseDelayMs*this.reconnectAttempts;this.reconnectTimer=window.setTimeout(()=>{this.options.onReconnect(!0)},t)}reconnectNow(){this.reconnectAttempts=0,this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.options.onReconnect(!0)}close(){this.disposed=!0,this.reconnectTimer!==null&&(window.clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.options.onStateChange("closed")}}class yT{constructor(t){tt(this,"socket",null);tt(this,"disposed",!1);tt(this,"authRecoveryInFlight",!1);tt(this,"pendingRefresh",!1);tt(this,"fileTreeSubscription",null);tt(this,"gitWorkspaceId",null);tt(this,"terminalManagerWorkspaceId",null);tt(this,"workspaceManagementWorkspaceId",null);tt(this,"pendingFileTreeRefresh",null);tt(this,"pendingGitRefreshWorkspaceId",null);tt(this,"pendingTerminalManagerRefreshWorkspaceId",null);tt(this,"pendingWorkspaceManagementRefreshWorkspaceId",null);tt(this,"fileTreeListeners",new Set);tt(this,"gitListeners",new Set);tt(this,"terminalManagerListeners",new Set);tt(this,"workspaceManagementListeners",new Set);tt(this,"connectionManager");this.options=t,this.connectionManager=new vT({onReconnect:r=>{this.connect(r)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}requestRefresh(){const t=this.socket;if(!Zk(t)){this.pendingRefresh=!0;return}t.send(JSON.stringify({type:"workbench.refresh"})),this.pendingRefresh=!1}subscribeFileTree(t,r){this.fileTreeSubscription={workspaceId:t,paths:ex(r)},this.sendWhenReady({type:"fileTree.subscribe",workspaceId:t,paths:this.fileTreeSubscription.paths})}requestFileTreeRefresh(t,r){const i=ex(r),a={type:"fileTree.refresh",workspaceId:t,paths:i};this.sendWhenReady(a)?this.pendingFileTreeRefresh=null:this.pendingFileTreeRefresh={workspaceId:t,paths:i}}subscribeGit(t){this.gitWorkspaceId=t,this.sendWhenReady({type:"git.subscribe",workspaceId:t})}requestGitRefresh(t){this.sendWhenReady({type:"git.refresh",workspaceId:t})?this.pendingGitRefreshWorkspaceId=null:this.pendingGitRefreshWorkspaceId=t}subscribeTerminalManager(t){this.terminalManagerWorkspaceId=t,this.sendWhenReady({type:"terminalManager.subscribe",workspaceId:t})}requestTerminalManagerRefresh(t){this.sendWhenReady({type:"terminalManager.refresh",workspaceId:t})?this.pendingTerminalManagerRefreshWorkspaceId=null:this.pendingTerminalManagerRefreshWorkspaceId=t}subscribeWorkspaceManagement(t){this.workspaceManagementWorkspaceId=t,this.sendWhenReady({type:"workspaceManagement.subscribe",workspaceId:t})}requestWorkspaceManagementRefresh(t){this.sendWhenReady({type:"workspaceManagement.refresh",workspaceId:t})?this.pendingWorkspaceManagementRefreshWorkspaceId=null:this.pendingWorkspaceManagementRefreshWorkspaceId=t}addFileTreeSnapshotListener(t){return this.fileTreeListeners.add(t),()=>{this.fileTreeListeners.delete(t)}}addGitSnapshotListener(t){return this.gitListeners.add(t),()=>{this.gitListeners.delete(t)}}addTerminalManagerSnapshotListener(t){return this.terminalManagerListeners.add(t),()=>{this.terminalManagerListeners.delete(t)}}addWorkspaceManagementSnapshotListener(t){return this.workspaceManagementListeners.add(t),()=>{this.workspaceManagementListeners.delete(t)}}close(){var t;this.disposed=!0,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var c;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const r=(c=hr.getState().session)==null?void 0:c.accessToken;if(!r){this.options.onUnauthorized();return}const i=`${fN("/ws")}?access_token=${encodeURIComponent(r)}`,a=new WebSocket(i);this.socket=a,a.addEventListener("open",()=>{a.send(JSON.stringify({type:"workbench.subscribe"})),this.pendingRefresh&&this.requestRefresh(),this.fileTreeSubscription&&a.send(JSON.stringify({type:"fileTree.subscribe",workspaceId:this.fileTreeSubscription.workspaceId,paths:this.fileTreeSubscription.paths})),this.pendingFileTreeRefresh&&this.requestFileTreeRefresh(this.pendingFileTreeRefresh.workspaceId,this.pendingFileTreeRefresh.paths),this.gitWorkspaceId&&a.send(JSON.stringify({type:"git.subscribe",workspaceId:this.gitWorkspaceId})),this.pendingGitRefreshWorkspaceId&&this.requestGitRefresh(this.pendingGitRefreshWorkspaceId),this.terminalManagerWorkspaceId&&a.send(JSON.stringify({type:"terminalManager.subscribe",workspaceId:this.terminalManagerWorkspaceId})),this.pendingTerminalManagerRefreshWorkspaceId&&this.requestTerminalManagerRefresh(this.pendingTerminalManagerRefreshWorkspaceId),this.workspaceManagementWorkspaceId&&a.send(JSON.stringify({type:"workspaceManagement.subscribe",workspaceId:this.workspaceManagementWorkspaceId})),this.pendingWorkspaceManagementRefreshWorkspaceId&&this.requestWorkspaceManagementRefresh(this.pendingWorkspaceManagementRefreshWorkspaceId)}),a.addEventListener("message",u=>{var m,f,w,g,v,y,x,C;const d=JSON.parse(u.data);if(d.type==="system.connected"){this.connectionManager.markConnected();return}if(d.type==="session.error"){d.error_code==="UNAUTHORIZED"&&this.handleUnauthorized();return}if(d.type==="fileTree.snapshot"){(f=(m=this.options).onFileTreeSnapshot)==null||f.call(m,d.snapshot),this.fileTreeListeners.forEach(j=>j(d.snapshot));return}if(d.type==="git.snapshot"){(g=(w=this.options).onGitSnapshot)==null||g.call(w,d.snapshot),this.gitListeners.forEach(j=>j(d.snapshot));return}if(d.type==="terminalManager.snapshot"){(y=(v=this.options).onTerminalManagerSnapshot)==null||y.call(v,d.snapshot),this.terminalManagerListeners.forEach(j=>j(d.snapshot));return}if(d.type==="workspaceManagement.snapshot"){(C=(x=this.options).onWorkspaceManagementSnapshot)==null||C.call(x,d.snapshot),this.workspaceManagementListeners.forEach(j=>j(d.snapshot));return}d.type==="workbench.snapshot"&&wL(d.snapshot)&&this.options.onSnapshot(d.snapshot)}),a.addEventListener("close",()=>{this.disposed||this.socket!==a||this.connectionManager.markDisconnected()}),a.addEventListener("error",()=>{this.disposed||this.socket!==a||this.connectionManager.markTransientFailure()})}handleUnauthorized(){if(this.authRecoveryInFlight||this.disposed)return;this.authRecoveryInFlight=!0;const t=this.socket;this.socket=null,t==null||t.close(),hr.refresh().then(r=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(r.status==="refreshed"){this.connectionManager.reconnectNow();return}if(r.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}sendWhenReady(t){const r=this.socket;return Zk(r)?(r.send(JSON.stringify(t)),!0):!1}}function Zk(e){const t=typeof WebSocket.OPEN=="number"?WebSocket.OPEN:1;return e!==null&&e.readyState===t}function wL(e){return typeof e!="object"||e===null?!1:Array.isArray(e.items)}function ex(e){const t=new Set;for(const r of e??[""])t.add(r.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,""));return[...t]}function Ur(e,t,r,i){if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(e):i?i.value:t.get(e)}function Ba(e,t,r,i,a){if(typeof t=="function"?e!==t||!0:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var uo,rs,cl,Sd,mh;const Ii="__TAURI_TO_IPC_KEY__";function kT(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class xT{constructor(t){uo.set(this,void 0),rs.set(this,0),cl.set(this,[]),Sd.set(this,void 0),Ba(this,uo,t||(()=>{})),this.id=kT(r=>{const i=r.index;if("end"in r){i==Ur(this,rs,"f")?this.cleanupCallback():Ba(this,Sd,i);return}const a=r.message;if(i==Ur(this,rs,"f")){for(Ur(this,uo,"f").call(this,a),Ba(this,rs,Ur(this,rs,"f")+1);Ur(this,rs,"f")in Ur(this,cl,"f");){const c=Ur(this,cl,"f")[Ur(this,rs,"f")];Ur(this,uo,"f").call(this,c),delete Ur(this,cl,"f")[Ur(this,rs,"f")],Ba(this,rs,Ur(this,rs,"f")+1)}Ur(this,rs,"f")===Ur(this,Sd,"f")&&this.cleanupCallback()}else Ur(this,cl,"f")[i]=a})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){Ba(this,uo,t)}get onmessage(){return Ur(this,uo,"f")}[(uo=new WeakMap,rs=new WeakMap,cl=new WeakMap,Sd=new WeakMap,Ii)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[Ii]()}}async function Ee(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}class ST{get rid(){return Ur(this,mh,"f")}constructor(t){mh.set(this,void 0),Ba(this,mh,t)}async close(){return Ee("plugin:resources|close",{rid:this.rid})}}mh=new WeakMap;class qb{constructor(...t){this.type="Logical",t.length===1?"Logical"in t[0]?(this.width=t[0].Logical.width,this.height=t[0].Logical.height):(this.width=t[0].width,this.height=t[0].height):(this.width=t[0],this.height=t[1])}toPhysical(t){return new Va(this.width*t,this.height*t)}[Ii](){return{width:this.width,height:this.height}}toJSON(){return this[Ii]()}}class Va{constructor(...t){this.type="Physical",t.length===1?"Physical"in t[0]?(this.width=t[0].Physical.width,this.height=t[0].Physical.height):(this.width=t[0].width,this.height=t[0].height):(this.width=t[0],this.height=t[1])}toLogical(t){return new qb(this.width/t,this.height/t)}[Ii](){return{width:this.width,height:this.height}}toJSON(){return this[Ii]()}}class ul{constructor(t){this.size=t}toLogical(t){return this.size instanceof qb?this.size:this.size.toLogical(t)}toPhysical(t){return this.size instanceof Va?this.size:this.size.toPhysical(t)}[Ii](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[Ii]()}}class $b{constructor(...t){this.type="Logical",t.length===1?"Logical"in t[0]?(this.x=t[0].Logical.x,this.y=t[0].Logical.y):(this.x=t[0].x,this.y=t[0].y):(this.x=t[0],this.y=t[1])}toPhysical(t){return new as(this.x*t,this.y*t)}[Ii](){return{x:this.x,y:this.y}}toJSON(){return this[Ii]()}}class as{constructor(...t){this.type="Physical",t.length===1?"Physical"in t[0]?(this.x=t[0].Physical.x,this.y=t[0].Physical.y):(this.x=t[0].x,this.y=t[0].y):(this.x=t[0],this.y=t[1])}toLogical(t){return new $b(this.x/t,this.y/t)}[Ii](){return{x:this.x,y:this.y}}toJSON(){return this[Ii]()}}class Ua{constructor(t){this.position=t}toLogical(t){return this.position instanceof $b?this.position:this.position.toLogical(t)}toPhysical(t){return this.position instanceof as?this.position:this.position.toPhysical(t)}[Ii](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[Ii]()}}var Pi;(function(e){e.WINDOW_RESIZED="tauri://resize",e.WINDOW_MOVED="tauri://move",e.WINDOW_CLOSE_REQUESTED="tauri://close-requested",e.WINDOW_DESTROYED="tauri://destroyed",e.WINDOW_FOCUS="tauri://focus",e.WINDOW_BLUR="tauri://blur",e.WINDOW_SCALE_FACTOR_CHANGED="tauri://scale-change",e.WINDOW_THEME_CHANGED="tauri://theme-changed",e.WINDOW_CREATED="tauri://window-created",e.WEBVIEW_CREATED="tauri://webview-created",e.DRAG_ENTER="tauri://drag-enter",e.DRAG_OVER="tauri://drag-over",e.DRAG_DROP="tauri://drag-drop",e.DRAG_LEAVE="tauri://drag-leave"})(Pi||(Pi={}));async function CT(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await Ee("plugin:event|unlisten",{event:e,eventId:t})}async function Vb(e,t,r){var i;const a=typeof(r==null?void 0:r.target)=="string"?{kind:"AnyLabel",label:r.target}:(i=r==null?void 0:r.target)!==null&&i!==void 0?i:{kind:"Any"};return Ee("plugin:event|listen",{event:e,target:a,handler:kT(t)}).then(c=>async()=>CT(e,c))}async function jT(e,t,r){return Vb(e,i=>{CT(e,i.id),t(i)},r)}async function NT(e,t){await Ee("plugin:event|emit",{event:e,payload:t})}async function TT(e,t,r){await Ee("plugin:event|emit_to",{target:typeof e=="string"?{kind:"AnyLabel",label:e}:e,event:t,payload:r})}const vL=Object.freeze(Object.defineProperty({__proto__:null,get TauriEvent(){return Pi},emit:NT,emitTo:TT,listen:Vb,once:jT},Symbol.toStringTag,{value:"Module"}));class Ec extends ST{constructor(t){super(t)}static async new(t,r,i){return Ee("plugin:image|new",{rgba:Us(t),width:r,height:i}).then(a=>new Ec(a))}static async fromBytes(t){return Ee("plugin:image|from_bytes",{bytes:Us(t)}).then(r=>new Ec(r))}static async fromPath(t){return Ee("plugin:image|from_path",{path:t}).then(r=>new Ec(r))}async rgba(){return Ee("plugin:image|rgba",{rid:this.rid}).then(t=>new Uint8Array(t))}async size(){return Ee("plugin:image|size",{rid:this.rid})}}function Us(e){return e==null?null:typeof e=="string"?e:e instanceof Ec?e.rid:e}var Uh;(function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"})(Uh||(Uh={}));class PT{constructor(t){this._preventDefault=!1,this.event=t.event,this.id=t.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var Ig;(function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"})(Ig||(Ig={}));function um(){return new Gb(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function ph(){return Ee("plugin:window|get_all_windows").then(e=>e.map(t=>new Gb(t,{skip:!0})))}const lf=["tauri://created","tauri://error"];class Gb{constructor(t,r={}){var i;this.label=t,this.listeners=Object.create(null),r!=null&&r.skip||Ee("plugin:window|create",{options:{...r,parent:typeof r.parent=="string"?r.parent:(i=r.parent)===null||i===void 0?void 0:i.label,label:t}}).then(async()=>this.emit("tauri://created")).catch(async a=>this.emit("tauri://error",a))}static async getByLabel(t){var r;return(r=(await ph()).find(i=>i.label===t))!==null&&r!==void 0?r:null}static getCurrent(){return um()}static async getAll(){return ph()}static async getFocusedWindow(){for(const t of await ph())if(await t.isFocused())return t;return null}async listen(t,r){return this._handleTauriEvent(t,r)?()=>{const i=this.listeners[t];i.splice(i.indexOf(r),1)}:Vb(t,r,{target:{kind:"Window",label:this.label}})}async once(t,r){return this._handleTauriEvent(t,r)?()=>{const i=this.listeners[t];i.splice(i.indexOf(r),1)}:jT(t,r,{target:{kind:"Window",label:this.label}})}async emit(t,r){if(lf.includes(t)){for(const i of this.listeners[t]||[])i({event:t,id:-1,payload:r});return}return NT(t,r)}async emitTo(t,r,i){if(lf.includes(r)){for(const a of this.listeners[r]||[])a({event:r,id:-1,payload:i});return}return TT(t,r,i)}_handleTauriEvent(t,r){return lf.includes(t)?(t in this.listeners?this.listeners[t].push(r):this.listeners[t]=[r],!0):!1}async scaleFactor(){return Ee("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return Ee("plugin:window|inner_position",{label:this.label}).then(t=>new as(t))}async outerPosition(){return Ee("plugin:window|outer_position",{label:this.label}).then(t=>new as(t))}async innerSize(){return Ee("plugin:window|inner_size",{label:this.label}).then(t=>new Va(t))}async outerSize(){return Ee("plugin:window|outer_size",{label:this.label}).then(t=>new Va(t))}async isFullscreen(){return Ee("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return Ee("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return Ee("plugin:window|is_maximized",{label:this.label})}async isFocused(){return Ee("plugin:window|is_focused",{label:this.label})}async isDecorated(){return Ee("plugin:window|is_decorated",{label:this.label})}async isResizable(){return Ee("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return Ee("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return Ee("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return Ee("plugin:window|is_closable",{label:this.label})}async isVisible(){return Ee("plugin:window|is_visible",{label:this.label})}async title(){return Ee("plugin:window|title",{label:this.label})}async theme(){return Ee("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return Ee("plugin:window|is_always_on_top",{label:this.label})}async center(){return Ee("plugin:window|center",{label:this.label})}async requestUserAttention(t){let r=null;return t&&(t===Uh.Critical?r={type:"Critical"}:r={type:"Informational"}),Ee("plugin:window|request_user_attention",{label:this.label,value:r})}async setResizable(t){return Ee("plugin:window|set_resizable",{label:this.label,value:t})}async setEnabled(t){return Ee("plugin:window|set_enabled",{label:this.label,value:t})}async isEnabled(){return Ee("plugin:window|is_enabled",{label:this.label})}async setMaximizable(t){return Ee("plugin:window|set_maximizable",{label:this.label,value:t})}async setMinimizable(t){return Ee("plugin:window|set_minimizable",{label:this.label,value:t})}async setClosable(t){return Ee("plugin:window|set_closable",{label:this.label,value:t})}async setTitle(t){return Ee("plugin:window|set_title",{label:this.label,value:t})}async maximize(){return Ee("plugin:window|maximize",{label:this.label})}async unmaximize(){return Ee("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return Ee("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return Ee("plugin:window|minimize",{label:this.label})}async unminimize(){return Ee("plugin:window|unminimize",{label:this.label})}async show(){return Ee("plugin:window|show",{label:this.label})}async hide(){return Ee("plugin:window|hide",{label:this.label})}async close(){return Ee("plugin:window|close",{label:this.label})}async destroy(){return Ee("plugin:window|destroy",{label:this.label})}async setDecorations(t){return Ee("plugin:window|set_decorations",{label:this.label,value:t})}async setShadow(t){return Ee("plugin:window|set_shadow",{label:this.label,value:t})}async setEffects(t){return Ee("plugin:window|set_effects",{label:this.label,value:t})}async clearEffects(){return Ee("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(t){return Ee("plugin:window|set_always_on_top",{label:this.label,value:t})}async setAlwaysOnBottom(t){return Ee("plugin:window|set_always_on_bottom",{label:this.label,value:t})}async setContentProtected(t){return Ee("plugin:window|set_content_protected",{label:this.label,value:t})}async setSize(t){return Ee("plugin:window|set_size",{label:this.label,value:t instanceof ul?t:new ul(t)})}async setMinSize(t){return Ee("plugin:window|set_min_size",{label:this.label,value:t instanceof ul?t:t?new ul(t):null})}async setMaxSize(t){return Ee("plugin:window|set_max_size",{label:this.label,value:t instanceof ul?t:t?new ul(t):null})}async setSizeConstraints(t){function r(i){return i?{Logical:i}:null}return Ee("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:r(t==null?void 0:t.minWidth),minHeight:r(t==null?void 0:t.minHeight),maxWidth:r(t==null?void 0:t.maxWidth),maxHeight:r(t==null?void 0:t.maxHeight)}})}async setPosition(t){return Ee("plugin:window|set_position",{label:this.label,value:t instanceof Ua?t:new Ua(t)})}async setFullscreen(t){return Ee("plugin:window|set_fullscreen",{label:this.label,value:t})}async setSimpleFullscreen(t){return Ee("plugin:window|set_simple_fullscreen",{label:this.label,value:t})}async setFocus(){return Ee("plugin:window|set_focus",{label:this.label})}async setFocusable(t){return Ee("plugin:window|set_focusable",{label:this.label,value:t})}async setIcon(t){return Ee("plugin:window|set_icon",{label:this.label,value:Us(t)})}async setSkipTaskbar(t){return Ee("plugin:window|set_skip_taskbar",{label:this.label,value:t})}async setCursorGrab(t){return Ee("plugin:window|set_cursor_grab",{label:this.label,value:t})}async setCursorVisible(t){return Ee("plugin:window|set_cursor_visible",{label:this.label,value:t})}async setCursorIcon(t){return Ee("plugin:window|set_cursor_icon",{label:this.label,value:t})}async setBackgroundColor(t){return Ee("plugin:window|set_background_color",{color:t})}async setCursorPosition(t){return Ee("plugin:window|set_cursor_position",{label:this.label,value:t instanceof Ua?t:new Ua(t)})}async setIgnoreCursorEvents(t){return Ee("plugin:window|set_ignore_cursor_events",{label:this.label,value:t})}async startDragging(){return Ee("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(t){return Ee("plugin:window|start_resize_dragging",{label:this.label,value:t})}async setBadgeCount(t){return Ee("plugin:window|set_badge_count",{label:this.label,value:t})}async setBadgeLabel(t){return Ee("plugin:window|set_badge_label",{label:this.label,value:t})}async setOverlayIcon(t){return Ee("plugin:window|set_overlay_icon",{label:this.label,value:t?Us(t):void 0})}async setProgressBar(t){return Ee("plugin:window|set_progress_bar",{label:this.label,value:t})}async setVisibleOnAllWorkspaces(t){return Ee("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:t})}async setTitleBarStyle(t){return Ee("plugin:window|set_title_bar_style",{label:this.label,value:t})}async setTheme(t){return Ee("plugin:window|set_theme",{label:this.label,value:t})}async onResized(t){return this.listen(Pi.WINDOW_RESIZED,r=>{r.payload=new Va(r.payload),t(r)})}async onMoved(t){return this.listen(Pi.WINDOW_MOVED,r=>{r.payload=new as(r.payload),t(r)})}async onCloseRequested(t){return this.listen(Pi.WINDOW_CLOSE_REQUESTED,async r=>{const i=new PT(r);await t(i),i.isPreventDefault()||await this.destroy()})}async onDragDropEvent(t){const r=await this.listen(Pi.DRAG_ENTER,u=>{t({...u,payload:{type:"enter",paths:u.payload.paths,position:new as(u.payload.position)}})}),i=await this.listen(Pi.DRAG_OVER,u=>{t({...u,payload:{type:"over",position:new as(u.payload.position)}})}),a=await this.listen(Pi.DRAG_DROP,u=>{t({...u,payload:{type:"drop",paths:u.payload.paths,position:new as(u.payload.position)}})}),c=await this.listen(Pi.DRAG_LEAVE,u=>{t({...u,payload:{type:"leave"}})});return()=>{r(),a(),i(),c()}}async onFocusChanged(t){const r=await this.listen(Pi.WINDOW_FOCUS,a=>{t({...a,payload:!0})}),i=await this.listen(Pi.WINDOW_BLUR,a=>{t({...a,payload:!1})});return()=>{r(),i()}}async onScaleChanged(t){return this.listen(Pi.WINDOW_SCALE_FACTOR_CHANGED,t)}async onThemeChanged(t){return this.listen(Pi.WINDOW_THEME_CHANGED,t)}}var tx;(function(e){e.Disabled="disabled",e.Throttle="throttle",e.Suspend="suspend"})(tx||(tx={}));var nx;(function(e){e.Default="default",e.FluentOverlay="fluentOverlay"})(nx||(nx={}));var Lg;(function(e){e.AppearanceBased="appearanceBased",e.Light="light",e.Dark="dark",e.MediumLight="mediumLight",e.UltraDark="ultraDark",e.Titlebar="titlebar",e.Selection="selection",e.Menu="menu",e.Popover="popover",e.Sidebar="sidebar",e.HeaderView="headerView",e.Sheet="sheet",e.WindowBackground="windowBackground",e.HudWindow="hudWindow",e.FullScreenUI="fullScreenUI",e.Tooltip="tooltip",e.ContentBackground="contentBackground",e.UnderWindowBackground="underWindowBackground",e.UnderPageBackground="underPageBackground",e.Mica="mica",e.Blur="blur",e.Acrylic="acrylic",e.Tabbed="tabbed",e.TabbedDark="tabbedDark",e.TabbedLight="tabbedLight"})(Lg||(Lg={}));var Fg;(function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"})(Fg||(Fg={}));function dm(e){return e===null?null:{name:e.name,scaleFactor:e.scaleFactor,position:new as(e.position),size:new Va(e.size),workArea:{position:new as(e.workArea.position),size:new Va(e.workArea.size)}}}async function yL(){return Ee("plugin:window|current_monitor").then(dm)}async function kL(){return Ee("plugin:window|primary_monitor").then(dm)}async function xL(e,t){return Ee("plugin:window|monitor_from_point",{x:e,y:t}).then(dm)}async function SL(){return Ee("plugin:window|available_monitors").then(e=>e.map(dm))}async function CL(){return Ee("plugin:window|cursor_position").then(e=>new as(e))}const jL=Object.freeze(Object.defineProperty({__proto__:null,CloseRequestedEvent:PT,get Effect(){return Lg},get EffectState(){return Fg},LogicalPosition:$b,LogicalSize:qb,PhysicalPosition:as,PhysicalSize:Va,get ProgressBarStatus(){return Ig},get UserAttentionType(){return Uh},Window:Gb,availableMonitors:SL,currentMonitor:yL,cursorPosition:CL,getAllWindows:ph,getCurrentWindow:um,monitorFromPoint:xL,primaryMonitor:kL},Symbol.toStringTag,{value:"Module"})),NL=["button","a","input","textarea","select","summary","[role='button']","[role='link']","[role='tab']","[role='menuitem']","[contenteditable='true']","[data-window-drag='ignore']"].join(", ");function Kb(e){return e instanceof HTMLElement?!e.closest(NL):!0}async function Yb(){typeof window>"u"||typeof window.__TAURI_INTERNALS__>"u"||await um().startDragging()}const Hh=.78,TL=1;function PL(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function DT(e,t,r,i){const a=Math.hypot(r-e,i-t),c=Math.min(1,a/120);return Hh+(TL-Hh)*c}function Ha(e){return Math.round(Number.isFinite(e)?e:0)}function DL(e){if(!PL())return null;const t=Ha(e.x),r=Ha(e.y);let i=!1,a=Promise.resolve();const c=(d,m)=>(a=a.then(async()=>{await window.__TAURI_INTERNALS__.invoke(d,m)}).catch(()=>{}),a),u=async()=>{i||(i=!0,await c("close_detach_preview"))};return c("show_detach_preview",{title:e.title,x:t,y:r,scale:Hh}),{updatePosition(d,m){if(i)return;const f=Ha(d),w=Ha(m);c("update_detach_preview_position",{x:f,y:w,scale:DT(t,r,f,w)})},complete(){return u()},cancel(){return u()}}}function RL(e){if(typeof document>"u")return null;const t=Ha(e.x),r=Ha(e.y),i=document.createElement("div");i.className="desktop-window-detach-animation",i.setAttribute("aria-hidden","true"),i.dataset.state="preview",i.style.left=`${t}px`,i.style.top=`${r}px`,i.style.setProperty("--detach-preview-scale",Hh.toFixed(3));const a=document.createElement("div");a.className="desktop-window-detach-animation-bar";const c=document.createElement("strong");c.className="desktop-window-detach-animation-title",c.textContent=e.title;const u=document.createElement("div");u.className="desktop-window-detach-animation-body",a.append(c),i.append(a,u),document.body.append(i);let d=!1;const m=()=>{d||(d=!0,i.remove())};return{updatePosition(f,w){if(d)return;const g=Ha(f),v=Ha(w),y=DT(t,r,g,v);i.style.left=`${g}px`,i.style.top=`${v}px`,i.style.setProperty("--detach-preview-scale",y.toFixed(3))},async complete(){m()},async cancel(){m()}}}function rx(e){return DL(e)??RL(e)}const ML={files:{kind:"files",label:"文件",defaultFocusOwner:"file-context-panel"},git:{kind:"git",label:"Git",defaultFocusOwner:"git-sidebar"},processes:{kind:"processes",label:"进程管理",defaultFocusOwner:"terminal-manager-panel"}};function AL(e){return{...e,bounds:{...e.bounds}}}function EL(e,t,r){t&&(e.windows.registerDescriptor(t),r?e.windows.markWindowOpen(t.windowId):e.windows.markWindowClosed(t.windowId))}function IL(e){return ML[e]}function LL(e,t){return`${e}-${t}`}async function Xb(e,t,r){const i=r.workspaceId.trim(),a=IL(t);if(!e.isDesktop||!e.bridge.supported)return{ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前运行环境不支持桌面外部窗口。"};if(!i)return{ok:!1,errorCode:"WINDOW_WORKSPACE_REQUIRED",detail:`${a.label}外部窗口必须绑定工作区。`};const c=LL(t,i),u=e.windows.getDescriptor(c),d=u?AL(u):null,m=e.windows.isWindowOpen(c),f=aA({windowId:c,kind:t,workspaceId:i,sessionId:r.sessionId??(d==null?void 0:d.sessionId)??null,mode:"external",bounds:d==null?void 0:d.bounds,focusOwner:r.focusOwner??a.defaultFocusOwner});e.windows.registerDescriptor(f);const w=await e.bridge.createWindow(f);return w.ok?(e.windows.markWindowOpen(c),{ok:!0,value:f}):(d?EL(e,d,m):e.windows.removeWindow(c),{ok:!1,errorCode:w.errorCode,detail:w.detail})}function FL(e,t){return Xb(e,"files",t)}function _L(e,t){return Xb(e,"git",t)}function OL(e,t){return Xb(e,"processes",t)}const fh="codingns.workspace.session-display-sort-mode",gh="codingns.file-panel.show-system-files",Qb="codingns.notification.preferences",dl={notifyOnPermissionRequest:!0,notifyOnSessionCompleted:!0,notifyOnSessionFailed:!0};function Dl(){return typeof window<"u"&&typeof window.localStorage<"u"}function BL(e){return e==="createdAt"||e==="updatedAt"||e==="title"}function ix(){if(!Dl())return"createdAt";const e=window.localStorage.getItem(fh);return BL(e)?e:"createdAt"}function sx(){return Dl()?window.localStorage.getItem(gh)==="1":!1}function cf(e){return typeof e=="boolean"}function ax(){if(!Dl())return dl;const e=window.localStorage.getItem(Qb);if(!e)return dl;try{const t=JSON.parse(e);return{notifyOnPermissionRequest:cf(t.notifyOnPermissionRequest)?t.notifyOnPermissionRequest:dl.notifyOnPermissionRequest,notifyOnSessionCompleted:cf(t.notifyOnSessionCompleted)?t.notifyOnSessionCompleted:dl.notifyOnSessionCompleted,notifyOnSessionFailed:cf(t.notifyOnSessionFailed)?t.notifyOnSessionFailed:dl.notifyOnSessionFailed}}catch{return dl}}function ox(e,t){return e.notifyOnPermissionRequest===t.notifyOnPermissionRequest&&e.notifyOnSessionCompleted===t.notifyOnSessionCompleted&&e.notifyOnSessionFailed===t.notifyOnSessionFailed}function WL(e){Dl()&&window.localStorage.setItem(Qb,JSON.stringify(e))}class UL{constructor(){tt(this,"state",{sessionDisplaySortMode:ix(),showSystemFiles:sx(),notificationPreferences:ax()});tt(this,"listeners",new Set);tt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));tt(this,"getState",()=>this.state);tt(this,"handleStorage",t=>{if(t.key!==null&&t.key!==fh&&t.key!==gh&&t.key!==Qb)return;const r=ix(),i=sx(),a=ax(),c=this.state.sessionDisplaySortMode===r,u=this.state.showSystemFiles===i,d=ox(this.state.notificationPreferences,a);c&&u&&d||(this.state={sessionDisplaySortMode:r,showSystemFiles:i,notificationPreferences:a},this.emit())});typeof window<"u"&&window.addEventListener("storage",this.handleStorage)}setSessionDisplaySortMode(t){Dl()&&(t==="createdAt"?window.localStorage.removeItem(fh):window.localStorage.setItem(fh,t)),this.state.sessionDisplaySortMode!==t&&(this.state={...this.state,sessionDisplaySortMode:t},this.emit())}setShowSystemFiles(t){Dl()&&(t?window.localStorage.setItem(gh,"1"):window.localStorage.removeItem(gh)),this.state.showSystemFiles!==t&&(this.state={...this.state,showSystemFiles:t},this.emit())}setNotificationPreferences(t){const r={...this.state.notificationPreferences,...t};ox(this.state.notificationPreferences,r)||(WL(r),this.state={...this.state,notificationPreferences:r},this.emit())}emit(){for(const t of this.listeners)t()}}const wo=new UL;function us(e){return p.useSyncExternalStore(wo.subscribe,()=>e(wo.getState()))}const Tc=new Map;function RT(){return typeof window<"u"&&typeof window.sessionStorage<"u"}function lx(e,t){return!Number.isFinite(e)||Date.now()-e>t}function Lr(e,t){const r=Tc.get(e);if(r&&!lx(r.savedAt,t))return r.value;if(!RT())return null;const i=window.sessionStorage.getItem(e);if(!i)return null;try{const a=JSON.parse(i);return!a||lx(a.savedAt,t)?(window.sessionStorage.removeItem(e),Tc.delete(e),null):(Tc.set(e,a),a.value)}catch{return window.sessionStorage.removeItem(e),Tc.delete(e),null}}function Ei(e,t){const r={savedAt:Date.now(),value:t};if(Tc.set(e,r),!!RT())try{window.sessionStorage.setItem(e,JSON.stringify(r))}catch{}}const HL="codingns.debug.perf";function zL(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(HL)==="1"}catch{return!1}}function sn(e,t){if(!zL()||typeof performance>"u")return;const r=Math.round(performance.now());if(t&&Object.keys(t).length>0){console.info(`[perf-ui] ${e} ${r}ms`,t);return}console.info(`[perf-ui] ${e} ${r}ms`)}function qL(){return Ue.request("/api/workspaces")}async function MT(){try{return await Ue.request("/api/workbench")}catch(e){if(!(e instanceof Kr)||e.status!==404)throw e;const t=await qL();return{items:await Promise.all(t.items.map(async i=>({workspace:i,sessions:(await JL(i.id)).items})))}}}function $L(e){return Ue.request("/api/workspaces/import",{method:"POST",body:JSON.stringify(e)})}function VL(e){return Ue.request("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})}function AT(e){return Ue.request(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})}function GL(e){return Ue.request("/api/debug-targets/analyze",{method:"POST",body:JSON.stringify(e)})}function KL(e,t=5){const r=new URLSearchParams;return r.set("limit",String(t)),Ue.request(`/api/debug-targets/${encodeURIComponent(e)}/runtimes?${r.toString()}`)}function YL(){return Ue.request("/api/framework-compatibility-matrix")}function XL(e){return Ue.request("/api/workspaces/reorder",{method:"PUT",body:JSON.stringify(e)})}function ET(e,t){return Ue.request(`/api/workspaces/${encodeURIComponent(e)}/navigation-state`,{method:"PUT",body:JSON.stringify(t)})}function IT(e){const t=new URLSearchParams;return e!=null&&e.trim()&&t.set("path",e.trim()),Ue.request(`/api/workspaces/browse${t.size>0?`?${t.toString()}`:""}`)}function QL(e){return Ue.request("/api/workspaces/directories",{method:"POST",body:JSON.stringify(e)})}function JL(e){return Ue.request(`/api/sessions?workspaceId=${encodeURIComponent(e)}`)}function Jb(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}`)}function ZL(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/changed-files`)}function eF(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/seen`,{method:"POST"})}function LT(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/title`,{method:"PATCH",body:JSON.stringify({title:t})})}function FT(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"PATCH",body:JSON.stringify({archived:t})})}function tF(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/favorite`,{method:"PATCH",body:JSON.stringify({favorite:t})})}function nF(e){return Ue.request("/api/worktrees",{method:"POST",body:JSON.stringify(e)})}function rF(e){return Ue.request(`/api/worktrees/${encodeURIComponent(e)}/merge-preview`,{method:"POST"})}function iF(e){return Ue.request(`/api/worktrees/${encodeURIComponent(e)}/merge-into-parent`,{method:"POST"})}function sF(e,t){return Ue.request(`/api/worktrees/${encodeURIComponent(e)}/cleanup`,{method:"POST",body:JSON.stringify(t??{})})}function aF(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/capabilities`)}function _T(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests`)}function oF(){return Ue.request("/api/preferences/quick-phrases")}function lF(e){return Ue.request("/api/preferences/quick-phrases",{method:"PUT",body:JSON.stringify({items:e})})}function Il(e,t){const r=new URLSearchParams;return t!=null&&t.trim()&&r.set("workspaceId",t.trim()),Ue.request(`/api/providers/${encodeURIComponent(e)}/capabilities${r.size>0?`?${r.toString()}`:""}`)}async function Zb(e,t){const r=await Promise.allSettled(e.map(async a=>[a,await Il(a,t)])),i=[];for(const a of r){if(a.status!=="fulfilled")continue;const[c,u]=a.value;i.push([c,u])}return Object.fromEntries(i)}function ew(e,t,r,i="forward"){const a=new URLSearchParams;return a.set("limit",String(r)),a.set("direction",i),Ue.request(`/api/sessions/${encodeURIComponent(e)}/messages?${a.toString()}`)}function cF(e,t){return Ue.requestBlob(`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content`)}function uF(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:JSON.stringify(t)})}function OT(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/forks`,{method:"POST",body:JSON.stringify(t)})}function tw(e){return Ue.request("/api/sessions/start-live",{method:"POST",body:JSON.stringify(e)})}function nw(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/messages/live`,{method:"POST",body:JSON.stringify(t)})}function dF(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/queue`)}function hF(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/queue`,{method:"POST",body:JSON.stringify(t)})}function mF(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}`,{method:"DELETE"})}function pF(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}/steer`,{method:"POST"})}function _g(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/runtime`)}function fF(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:"POST"})}function gF(e,t,r){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests/${encodeURIComponent(t)}/reply`,{method:"POST",body:JSON.stringify(r)})}function BT(e){return Ue.request(`/api/git/status?workspaceId=${encodeURIComponent(e)}`)}function WT(e,t,r){const i=new URLSearchParams({workspaceId:e,path:t,staged:String(r)});return Ue.request(`/api/git/diff?${i.toString()}`)}function UT(e,t){return Ue.request("/api/git/stage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function bF(e,t){return Ue.request("/api/git/unstage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function wF(e,t){return Ue.request("/api/git/discard",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function vF(e,t){return Ue.request("/api/git/commit/draft",{method:"POST",body:JSON.stringify({workspaceId:e,mode:t})})}function yF(e,t){return Ue.request("/api/git/commit",{method:"POST",body:JSON.stringify({workspaceId:e,draft:t})})}function kF(e){return Ue.request("/api/git/commit/undo",{method:"POST",body:JSON.stringify({workspaceId:e})})}function cx(e,t=5,r=null){const i=new URLSearchParams({workspaceId:e,limit:String(t)});return r&&i.set("cursor",r),Ue.request(`/api/git/history?${i.toString()}`)}function xF(e,t){const r=new URLSearchParams({workspaceId:e,commitHash:t});return Ue.request(`/api/git/commit-detail?${r.toString()}`)}function HT(e){return Ue.request(`/api/git/branches?workspaceId=${encodeURIComponent(e)}`)}function SF(e){return Ue.request(`/api/git/tags?workspaceId=${encodeURIComponent(e)}`)}function CF(e,t,r){return Ue.request("/api/git/branches/switch",{method:"POST",body:JSON.stringify({workspaceId:e,branchName:t,create:r})})}function ux(e,t,r,i,a){return Ue.request("/api/git/remote/sync",{method:"POST",body:JSON.stringify({workspaceId:e,action:t,...r?{remote:r}:{},...i?{auth:i}:{},...a?{remember:a}:{}})})}function dx(e){return Ue.request(`/api/git/remotes?workspaceId=${encodeURIComponent(e)}`)}const jF="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAF+0lEQVRYha2XbXBUZxXHf+e5u4SkCZjg0NIWnQLJLgRF5UWnL75MP9gMjqPT2eyC0qlMiYxOUAR206LOyhiSTVscp52O0xamWgu7WTp0qLUz6kht6Qed1L7M5GUTsAoDTRSIJJos2b33+GFfWMJuNqmcT/c595z/+d3nOc+9zxXKWE9Li7tm0fjyqmT6H0t/Fp8sFz9XM+UCauouH8Rx+ifmWWdP7Q0sLRbT98g3lySC/mcSQd+GGwrQt2vzx1G2ZEa6KJ3S1mJxlpOKIDyEmEM3FGCk5vw5YCw3FmFbb9hXfV2gcm/26vINBfhS+LU0qgcKXB9xT1hbr6kdDhtgcYaDxHSNwVBg92Ao0DMY8n97zgAAZnK8U2AoX1D0++rzWfkC44k6wAVghP7C3EQo8Iiijyq61oEDiV2bPjojwKk234pEsPnh/lDgzpyv/olXrwi6qyDsjsQy2ZQXmJdefPWWvp0v3uZ/CLQ9NxZINpxJj84IYDvmOUT2G/T1DD0CUB/pflnhd1eT5Mcnwl90Adi23JzPl9TbAEN7fF9AeapQW5AOicftGQFEOJ+9tEDbB9v8x99r21wLYBlnJ5AGUKhfklz8QEbY3J71nVnZceziUPAbtzvGxAB3wdPH6yPRx6cXvw4gbbm/B5zIO5SvVKjdMxAMrKvviPcpHMyLqvyoN+ybh7AUwIi+M9TaVOGI/SJwc4Fsf6rS2SqgxQBkukPDYTM40RdCZB/Z5gKmEGmzjStq2alBoDqbvF2hEWgF9oEuAvlugdx/Deaz9ZEjvcWKFwXIWaLNv14cDqmwugDvFRVOi8qOrOMdhT6BzQhvoNxzjbjItxo6o8+VqjEjAMBQa1OFXbXwh4KGuLqmDleXToHzwG1FpLs9kah/uvf98IPz08nkSuZbp+vDL4zNCJAHaQt82lH9JfCJ2cQrTFjq8hiZGrfVtQGcDQhrFNYAywELuFw15SwRgN6dvrrahcnkreGXJ0pCtDZVOFULwsCerEBJExhVGAY8FH/Z2cBvPJHY1ySx13cbaXMaqACSwCVRLqlhVNBRVTOm4lxCOSdqPkB0FdA2m5kosGGEHpC3UP2z6uRJb9fx8SwsJEL+nwBNwEKgWqBSoXaORQqtH+VNhDdErJMNnYf/ViqwbBNO3lRbVZFSS9yyIG1jucRuVuGnM6TZZL4d/wS9KEgawIH/gF5EzAWBvzecto9KPG7PqgkBTu0NLHVs7VBlcxnwS8ALgtyp6Kco3S9/OF850lQWYCD41RpMZUiUH5BZmgkRDqmyVaCqeJYeS1dqwJq4UoG56S5w7hb4PMp6YH426LJR1+qSAOrzWYPLZCvIPuAWAIHXxGGXY3geWAV6DOTrJRR+r5q8P9dskNtJ1etBVl4R19FPdh4eLQowEPR5RKxfgebOeGMqGvLMX/V0YrK/W+B+4ATCYZRnEJ5E+Q5gFM4AFwQ+I8hbLks2Ltt/ZKTUg163Rwfamrcj5q/54spvLZes9nZ2/yIx0b8jW/wCLmeLOLoCAEdeAjmYnaWPGXga9Jiia1O28+bAbt8dswJQEFF5IrO2chGVBzxdsY0r2qNnBx5uvkuELkAFedDTHj+nIl4AIzJsjL2XTAOisB+XtqryKLBcLHNyKLSpsSyAgKrKJoRtbksaPV3R5yFz7BaHOOBGOdAQib6SRV4L4KQZqe+I/wvYmZWqE1ue8nbFggjbgDoH/VOxY3vZXdDT0uKuqR37I+jdIH9JV9r3NIbjU717fLe4jPkASDVEYhW5730i2PwqIvdlZkK3eCPdv06E/GuAbmCBJxJbUnIGill13b8fyxRnRG070BiOTwG4MeuyszBSeNiw3KZFYDTzdPLzU7u3LPZEYu+qTq5Tlev+K2YESAQD94rKjqzgl72Pxd/P3VNLsgAyXJizoj161kG3Z4d1aZP6HIC36/i4tyt6dE4AasQNDIhxNnoisXevvZndJcLw9DxvpLsb5XGE9yzD2ZlqzPpVPN0SIf854FaUZz1dsW0fVqdsD5Q05Qhgg7z+oTX+Xyv2pzNX+x+eTlGviPgh3AAAAABJRU5ErkJggg==",zT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAbGSURBVHgBzZo/bBtVHMd/ZzuJA0gYCYlsOFO7xRFDy1R3olucqd0SJtiSjiCknBckpjZjBxRn7BR3owOqs5Wp7tZKoDgSQysh4UqUOCG2eZ/3/Oznv/fObqJ+pfPZd+/ufn++vz/vnQN5FwjbGZFGQSRYUb+yIu2c2tSxIOOMqpktqKpzz9X3ioSLNZkRgUwLhA4aW9KWvPqVl6mgldmVGZSJr0BX8Pb2gIVnRUltxbiKxFOgeLJzAYL3I5BQdhaL/sN9EJ5k1dADw+1LQU1tN328kYgaIMWzDSX4s0sUHmSVwZ5JeFqIGjhZgeKpokyzdKGUGQuyWOtA03YCxlNIC98K5X3AhLgYrYB2ndLeE5l0IFvXklK4mpRsxvyuvmqrrSX71aZUjlsyM4LkpuzM7w8dHhqoAxbO+9Fm63pSwhspLTSo1dt6n830bl1SStx9fK6/Z9LmWL3B1hZ/BHUl1+pgYI9S4Eh0EEVjJ5/SwiPI7m9Nuf+02SfUZi4pO+o8ynDcKmlRqRkPlZ43xQ+q8IXpVfdIsu88vJd2ZOSD/OcJKRXmtMW//PlMyi9a0jjvH5NZCDStEDydCjSlfvm9pa/hd24poc+zf/zH8PUjsCT57wOp/FjpqtQ9pakjR+KJo60Fbdnl3dMubSw4vrc2J/msSXLlF4ZCg+M4zzjGEzM39888aAWVFpYlZN+fRnfEE1iMh8JtVygsDWWefTOvhYMiCLX+8L8h4QHnVx+cas/klgLZvpb0eDrp9d/trjr609P6brbhgesPDXXA5kpS7t0ywYwVi4fERD8noJ1WfIDzBDYeRRw8GscL1gP5iCv0g7FsqAIX4UH9pHeegEb44uG5EuKsT3iuPbg9J08252VPxQ3CoowFGYlgRhEMEY2eFzp3CbbEQ3j28BnXjwI0CSvnXQu6lMJrnOd67qOV6fAf2HuuLPn2l4kbRgGT9yf2OU825o11lXDw+bgenb8LV5JdjwE8s/rAxMPXj0xMkGbxBkpWX8epCRp5WvuERNAHl9qADQ+j8xz0QuGDOz3rIizXW8/wHa7bzISSKAveNCQGGoVElPU3coaTcDQKhmoL3QxEkLMna2FplzKAOCFLGf6b4x+nJQbauURnHjsWWJQg8+1nsChCsZGh2LuUwTvb11J94zfVeVtPGOOej4CuNNlJI2xa9BUeQQaD3FKG83iAdItHClcSQ4rzLJvRohGsRCowqoexyCxKbNiUqVPrnf5MhBL0VKRTv6IWZCJnZJR4bujm7eprY+GD2/M6g/hZyypgKENGspThHha2fqxdjZ4sUg8iRz16aYLXBrN5SLPLa5tBMrGCT3T7wD0GgYcM1XwU0IWsXZ80wPY7WMpVguM2g0ABvMDmZhkXZox4w3dswvQV44FFSIe4vqT46rrbzSAEru1pXF6j1L2vTND6Us10p15Zr5Ywq2OTQRwUO0UMyiCM27PYDDKYLomRoy2VNq+n9HGfbGbvyzM9FWgd+4zMfWY4iaV1v6+assHCZNOl7XcKnUC0bUQ9osrq3qnTevgUTtZYUz4ecGEDDwtjaTYER8jsx0YAO5Gxc2EfyyP83lqq27b4Fc6gqhRolEXSe1FDrRBUZioslrYpkD3WthzHSyg0WNCIkVFeoNWw3S7UsQsAHqiobvQTgrgSNbL80gizdmU4EyEswsNzPMQxV3hqiO1oR3kDoyD87tOm57QStKusUNiUcigRXSlZQRchZW2qpc0Sdg5AbQDuw3XboDIQcwGAUm7uh3LWEPvPx88zRiNgWd5OaBr3o+oBrmeaCJhdDeZ7BB83kbETdjZ3bmzryii6eaDCR8c0PzUk/wOdTX7SFU//bEmg5EYoUiOCvv5H5NXbnuDffpHUGYoxLJN892uvarsgXXIPa/14SJTU+pBepXOWVf5W88yFI58VOWqBW9DAYNM3KQMRE0x4gO2JYmLZrtD1ItLTC3ooK2rKasdvzAIVwNp2PfTqpwmdWZY+CswMKzDeYZp579acNgDjodSLv+IK31JvcT4o218jlhYbM78LcJcUR8EG8xSWrynLL7sHZl7cnQQUoYKvLJn0eVwnHTenCVgxSSbwWNwF4cmm+owsbpeLxLqEC+WhoyPHhosl4Y3hewN4Pyw8mNzfhiehxFgzvRgg/IfhuLPRDXr4ljfwe5f/nkxz/m6HDWMR4zWrPBHPFx+zQ7/BX/d5zRrvRfeFU0pbfVcJHvpeMcVfDfAGby8TG/LO0BFc0vftiwtfzPBnD02rvFnZnrrwVUR3wvEFt5heARddZVDE/uXGjRdt4bru4UWODcfT5WmFdvE/Jeqz44iuBr4AAAAASUVORK5CYII=",NF="/assets/gemini-D4G1NbrE.png",TF="/assets/kimi-BWNNSh7e.png",PF="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAABzUlEQVR4AeycQQrCQBAEF1+g6J/0o5LPCXmCnnNx0E2nNqGEPciw024VffV0PZ/fHo7BqflBCSgAxd+aAhQAE4DjbYACYAJwvA1QAEwAjrcBCgAIDBRpA2AZClAATACOtwEKgAnA8TZAATABOD7egNc8tz2ftJ+4gPQD9r5fAbDBDQXALx00XgGwGAUoACYAx9sABcAE4HgboACYABxvAxSwJHC7XFryLNP4bzYg7KBar4CKUHiugDDgar0CKkLhuQLCgKv1CqgIhecKCAOu1iugIhSeKyAMuFqvgIpQeK6AMOBq/XAC7o9H6z5fdlRAtp4PJ2BrAHSeAmADClAATACOtwEKgAnA8TZAATABON4GKAAmAMev2AD4JTuNVwAsTgEKgAnA8TZAATABON4GKAAmAMfbAAXABOB4G9ApoPe6AnoJdt5XQCfA3uvDCXhOU0ueXmBr3x9OwNoPHH2fAmBDClAATACOtwEKgAnA8TZAAX8QONAVGwDLVIACYAJwfLwByf/+2WJ32k9cQPoBe9+vANigAhQAE4DjbYACYAJw/A8NgH/pQeMVAItVgAJgAnC8DVAATACOtwEKgAnA8TZAATABON4GFALS4w8AAAD//x7wkLQAAAAGSURBVAMAKj5LkLSa6SQAAAAASUVORK5CYII=",DF=new Set(["low","medium","high","xhigh"]),RF=["claude-code","codex","opencode","gemini","kimi"],Ic=["codex","claude-code","opencode","gemini","kimi"],qT={"claude-code":{displayNameKey:"conversation.providerClaude",fullDisplayNameKey:"shell.providerClaudeCode",draftTitleKey:"conversation.draftTitleClaude",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:jF,defaultRunInputMode:"streaming_guidance",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!0,foldRulesMessagesByDefault:!1},codex:{displayNameKey:"conversation.providerCodex",draftTitleKey:"conversation.draftTitleCodex",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:zT,defaultRunInputMode:"none",reasoningLevelPersists:!0,defaultReasoningLevel:null,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!0},opencode:{displayNameKey:"conversation.providerOpenCode",draftTitleKey:"conversation.draftTitleOpenCode",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:PF,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!1},gemini:{displayNameKey:"conversation.providerGemini",draftTitleKey:"conversation.draftTitleGemini",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:NF,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:null,supportsInterrupt:!0,supportsAttachments:!1,supportsPermissionPrompt:!1,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!1},kimi:{displayNameKey:"conversation.providerKimi",draftTitleKey:"conversation.draftTitleKimi",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:TF,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:null,supportsInterrupt:!0,supportsAttachments:!1,supportsPermissionPrompt:!1,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!0}},MF=Array.from(new Set(Object.values(qT).map(e=>e.icon)));let hx=!1;function AF(e){return RF.includes(e)}function ha(e){return!e||!AF(e)?null:qT[e]}function EF(e){return[{id:"provider-default",name:o(e),usesProviderDefault:!0}]}function IF(e){const t=ha(e);return EF((t==null?void 0:t.defaultModelLabelKey)??"conversation.modelUseCliDefault")}function $T(e){return!!(e&&ha(e))}function LF(e){const t=ha(e);return o((t==null?void 0:t.draftTitleKey)??"conversation.draftTitleCodex")}function ds(e,t="compact"){const r=ha(e);return r?t==="full"&&r.fullDisplayNameKey?o(r.fullDisplayNameKey):o(r.displayNameKey):(e==null?void 0:e.trim())||o("conversation.providerCodex")}function VT(e){const t=ha(e);return(t==null?void 0:t.icon)??zT}function GT(){hx||typeof window>"u"||(hx=!0,MF.forEach(e=>{const t=new window.Image;t.decoding="async",t.src=e,typeof t.decode=="function"&&t.decode().catch(()=>{})}))}function za(e){const t=ha(e);return{provider:e,canStartSession:!0,canResumeSession:!0,canSendMessage:!0,inRunInputMode:(t==null?void 0:t.defaultRunInputMode)??"none",supportsSubagents:!1,supportsInterrupt:(t==null?void 0:t.supportsInterrupt)??!1,supportsStructuredToolCalls:!0,supportsTokenUsage:!0,supportsAttachments:(t==null?void 0:t.supportsAttachments)??!0,supportsPermissionPrompt:(t==null?void 0:t.supportsPermissionPrompt)??!0,supportsCheckpoint:!1,modelOptions:IF(e),defaultReasoningLevel:t==null?void 0:t.defaultReasoningLevel,limitations:[]}}function FF(e){return(e==null?void 0:e.provider)??"claude-code"}function _F(e){var r;if((e==null?void 0:e.supportsSlashMenu)!==void 0)return e.supportsSlashMenu;const t=(e==null?void 0:e.provider)??null;return((r=ha(t))==null?void 0:r.supportsSlashMenuByDefault)??!1}function OF(e){var t;return(e==null?void 0:e.supportsReasoningSelector)!==void 0?e.supportsReasoningSelector:!!((t=e==null?void 0:e.modelOptions)!=null&&t.some(r=>{var i;return((i=r.supportedReasoningEfforts)==null?void 0:i.some(a=>DF.has(a)))??!1}))}function BF(e,t){if((e==null?void 0:e.supportsQueueWhileRunning)!==void 0)return e.supportsQueueWhileRunning;const r=(e==null?void 0:e.inRunInputMode)??"none";return r==="queued_guidance"||r==="none"||r==="streaming_guidance"&&t===!1}function KT(e){return(e==null?void 0:e.supportsRunSteering)!==void 0?e.supportsRunSteering:(e==null?void 0:e.inRunInputMode)==="streaming_guidance"}function WF(e){const t=ha(e);return(t==null?void 0:t.reasoningLevelPersists)??!1}function UF(e,t){var i;return((i=ha(t??null))==null?void 0:i.foldRulesMessagesByDefault)??!1}typeof window<"u"&>();function HF(e,t,r,i){return Ue.request("/api/files/content",{method:"PUT",body:JSON.stringify({workspaceId:e,path:t,content:r,expectedVersion:i??void 0})})}function uf(e){return Ue.request("/api/files/ops",{method:"POST",body:JSON.stringify(e)})}function zF(e){return Ue.request("/api/files/upload",{method:"POST",body:JSON.stringify(e)})}function qF(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return Ue.request(`/api/files/download?${r.toString()}`)}function Pc(e,t,r=1,i=20){const a=new URLSearchParams({workspaceId:e,keyword:t,page:String(r),pageSize:String(i)});return Ue.request(`/api/files/search?${a.toString()}`)}function df(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return Ue.request(`/api/files/preview?${r.toString()}`)}function wu(e){var t,r;return e.runningState==="failed"||!!((t=e.lastErrorCode)!=null&&t.trim())||!!((r=e.lastErrorDetail)!=null&&r.trim())}function rw(e,t,r){return`${e} is-${YT(t,r)}`}function YT(e,t){t==null||t.isActive;const r=$F(e);return t!=null&&t.hasSubagents?r==="error"?"error":r==="unread"?"subagent-unread":r==="running"||r==="running_inferred"?"subagent-running":"subagent":r==="running_inferred"?"running-inferred":r.replace("_","-")}function Vc(e){return e.runningState==="stale"?o("conversation.runtimeStale"):e.runningState==="unknown"?o("conversation.runtimeUnknown"):null}function XT(e,t){return t.runningState==="stale"?`${e} is-stale`:t.runningState==="unknown"?`${e} is-unknown`:null}function $F(e){return wu(e)?"error":e.runningState==="stale"?"stale":e.runningState==="unknown"?"unknown":e.activityState==="running"?VF(e)?"running_inferred":"running":e.activityState==="completed_unread"?"unread":"idle"}function VF(e){return e.activityResolutionSource==="inferred_log"||e.activitySource==="inferred"}function GF(e){return vu(e)!==null}function Ya(e){return e.isSubagent===!0&&!GF(e)}function vu(e){return e.forkMethod==="reconstructed_message_fork"||e.forkMethod==="reconstructed_session_fork"?"reconstructed":e.forkMethod==="native_message_fork"||e.forkSourceType==="message"?"message":e.forkMethod==="native_session_fork"||e.forkSourceType==="session"?"session":null}function iw(e){const t=vu(e);return t==="reconstructed"?o("shell.sessionForkReconstructed"):t==="message"?o("shell.sessionForkMessage"):t==="session"?o("shell.sessionForkSession"):null}function sw(e){return e.sessionKind==="annotation"?"annotation":null}function QT(e){return sw(e)==="annotation"?o("conversation.actionSessionBadge"):null}const mx=48;function KF(e){return typeof e=="string"?e.replace(/\s+/g," ").trim():""}function Vs(e,t){const r=KF(e)||t,i=r.length>mx?r.slice(0,mx).trimEnd():r;return{fullTitle:r,displayTitle:i}}function Cd(e,t){return(t??"").localeCompare(e??"")}function px(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"})}function jd(e){return(e==null?void 0:e.trim())??""}function aw(e,t,r){if(r==="updatedAt"){const u=Cd(e.updatedAt,t.updatedAt);if(u!==0)return u}if(r==="title"){const u=px(jd(e.title),jd(t.title));if(u!==0)return u}else{const u=Cd(e.createdAt,t.createdAt);if(u!==0)return u}const i=Cd(e.updatedAt,t.updatedAt);if(i!==0)return i;const a=Cd(e.createdAt,t.createdAt);if(a!==0)return a;const c=px(jd(e.title),jd(t.title));return c!==0?c:e.sessionId.localeCompare(t.sessionId)}function yu(e,t){return[...e].sort((r,i)=>aw(r,i,t))}function ow(e,t){return Array.isArray(e)?e.map(r=>({...r,sessions:yu(r.sessions,t),children:ow(r.children,t)})):[]}const hf=5,mf=["#2563eb","#0891b2","#16a34a","#d97706","#dc2626","#64748b"];function JT(e){const t=Math.round(e.ratio*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}function ZT(e,t){const r=e.reduce((d,m)=>d+m.count,0);if(r<=0)return[];const a=e.slice(0,hf).map((d,m)=>({...d,key:d.type,ratio:d.count/r,color:mf[m]??mf[0]})),c=e.slice(hf);if(c.length===0)return a;const u=c.reduce((d,m)=>d+m.count,0);return a.push({key:"other",type:t,count:u,ratio:u/r,color:mf[hf]}),a}function YF(e){if(e.length===0)return"conic-gradient(color-mix(in srgb, var(--border-primary) 78%, transparent) 0% 100%)";let t=0;return`conic-gradient(${e.map((i,a)=>{const c=t,u=a===e.length-1?1:Math.min(1,t+i.ratio);return t=u,`${i.color} ${fx(c)} ${fx(u)}`}).join(", ")})`}function eP(e){return{"--workbench-manage-chart-background":YF(e)}}function fx(e){const t=Math.round(e*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}const XF=8,QF=12,JF=160,gx=96;function tP(e,t,r,i={}){const a=i.gapPx??XF,c=i.viewportMarginPx??QF,u=i.defaultWidthPx??JF,d=i.estimatedHeightPx??gx,m=i.minHeightPx??gx,f=Math.max(0,r.width),w=Math.max(0,r.height),g=Math.max(0,w-c*2),v=Math.max(0,f-c*2),y=Nd(Math.max(t.width||u,u),0,v),x=Math.max(t.height||d,d),C=Math.max(0,f-e.x-c),j=Math.max(0,e.x-c),N=C<y&&j>C,P=Math.max(0,w-e.y-a-c),L=Math.max(0,e.y-a-c),Y=P<x&&L>P,W=Nd(Math.max(Y?L:P,m),0,g),I=Math.min(x,W),M=N?e.x-y:e.x,O=Math.max(c,f-c-y),F=Y?e.y-a-I:e.y+a,X=Math.max(c,w-c-I),U=Nd(M,c,O),G=Nd(F,c,X),R=N||U<e.x?"right":"left";return{top:G,left:U,width:y,maxHeight:Math.max(0,W),transformOrigin:`${Y?"bottom":"top"} ${R}`}}function Nd(e,t,r){return!Number.isFinite(e)||r<t?t:Math.min(Math.max(e,t),r)}const nP="workbench.navigation.snapshot",rP=1800*1e3,ZF="workbench.navigation.snapshot.host.";function iP(e){return`${ZF}${e}`}function sP(e=rP,t=In.getState().activeHostId){if(t){const r=Lr(iP(t),e);if(r)return r}return Lr(nP,e)}function Td(e,t=In.getState().activeHostId){Ei(nP,e),t&&Ei(iP(t),e)}function Gc(e,t="createdAt"){return!e||!Array.isArray(e.items)?[]:e.items.map(r=>({workspace:r.workspace,sessions:yu(r.sessions,t),childWorktrees:e_(r.childWorktrees,t)}))}function e_(e,t){return ow(e,t)}function ku(e){return{workspaceId:e.id,tone:"root",backgroundColor:e.backgroundColor??null,displayName:e.name,workspaceName:e.name,branchName:null,depth:0,rootWorkspaceId:e.id,rootDisplayName:e.name,parentWorkspaceId:null,parentDisplayName:null}}function hm(e){const t=new Map;for(const r of e)t.set(r.workspace.id,ku(r.workspace)),aP(t,r.childWorktrees??[],r.workspace,r.workspace);return Object.fromEntries(t)}function os(e){if(e!=null&&e.backgroundColor)return{"--workspace-tone-color":e.backgroundColor}}function aP(e,t,r,i,a=i.name){var c;for(const u of t){const d=((c=u.meta.displayName)==null?void 0:c.trim())||u.workspace.name;e.set(u.workspace.id,{workspaceId:u.workspace.id,tone:"worktree",backgroundColor:u.workspace.backgroundColor??null,displayName:d,workspaceName:u.workspace.name,branchName:u.meta.branchName||null,depth:u.meta.depth,rootWorkspaceId:r.id,rootDisplayName:r.name,parentWorkspaceId:u.meta.parentWorkspaceId||i.id,parentDisplayName:a}),aP(e,u.children,r,u.workspace,d)}}function mm(){return Ue.request("/api/butler/profile")}function t_(e){return Ue.request("/api/butler/profile/init",{method:"POST",body:JSON.stringify(e)})}function bx(e){return Ue.request("/api/butler/profile",{method:"PATCH",body:JSON.stringify(e)})}function n_(){return Ue.request("/api/butler/control-session")}function r_(){return Ue.request("/api/butler/control-session/reset",{method:"POST"})}function i_(e={}){return Ue.request("/api/butler/control-session/start",{method:"POST",body:JSON.stringify(e)})}function s_(e){return Ue.request("/api/butler/control-session/messages",{method:"POST",body:JSON.stringify(e)})}function a_(){return Ue.request("/api/butler/control-session/events")}function pm(){return Ue.request("/api/butler/overview")}function o_(e={}){var a;const t=new URLSearchParams;(a=e.workspaceId)!=null&&a.trim()&&t.set("workspaceId",e.workspaceId.trim()),e.status&&t.set("status",e.status),e.riskLevel&&t.set("riskLevel",e.riskLevel);const r=t.toString(),i=r?`/api/butler/projects?${r}`:"/api/butler/projects";return Ue.request(i)}function oP(e,t={}){const r=new URLSearchParams;t.enabled!==null&&t.enabled!==void 0&&r.set("enabled",String(t.enabled)),t.executionMode&&r.set("executionMode",t.executionMode);const i=r.toString(),a=i?`/api/butler/projects/${encodeURIComponent(e)}/patrol-plans?${i}`:`/api/butler/projects/${encodeURIComponent(e)}/patrol-plans`;return Ue.request(a)}function Kc(e={}){var a,c;const t=new URLSearchParams;(a=e.workspaceId)!=null&&a.trim()&&t.set("workspaceId",e.workspaceId.trim()),(c=e.projectId)!=null&&c.trim()&&t.set("projectId",e.projectId.trim()),e.status&&t.set("status",e.status),e.itemType&&t.set("itemType",e.itemType);const r=t.toString(),i=r?`/api/butler/inbox?${r}`:"/api/butler/inbox";return Ue.request(i)}function l_(e){return Ue.request("/api/butler/inbox",{method:"POST",body:JSON.stringify(e)})}function Yc(e={}){var a,c;const t=new URLSearchParams;e.status&&t.set("status",e.status),(a=e.projectId)!=null&&a.trim()&&t.set("projectId",e.projectId.trim()),(c=e.sessionId)!=null&&c.trim()&&t.set("sessionId",e.sessionId.trim());const r=t.toString(),i=r?`/api/butler/follow-up-tasks?${r}`:"/api/butler/follow-up-tasks";return Ue.request(i)}function c_(e){return Ue.request("/api/butler/follow-up-tasks",{method:"POST",body:JSON.stringify(e)})}function lP(e){return Ue.request(`/api/butler/follow-up-tasks/${encodeURIComponent(e)}`)}function u_(e){return Ue.request(`/api/butler/follow-up-tasks/${encodeURIComponent(e)}/cancel`,{method:"POST"})}function d_(e,t){return Ue.request(`/api/butler/inbox/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify({projectId:t.projectId,itemType:t.itemType,title:t.title,content:t.content,priority:t.priority,status:t.status})})}function h_(e){return Ue.request(`/api/butler/inbox/${encodeURIComponent(e)}`,{method:"DELETE"})}function m_(){return Ue.request("/api/butler/notifications/archives")}function p_(e,t){return Ue.request(`/api/butler/notifications/archives/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify({archived:t})})}function f_(e){const t=new URLSearchParams;return t.set("sessionId",e),Ue.request(`/api/butler/session-target?${t.toString()}`)}function g_(e){const t=new URLSearchParams;return t.set("sessionId",e),Ue.request(`/api/butler/session-action-context?${t.toString()}`)}function b_(e){return Ue.request("/api/butler/actions/start-verification",{method:"POST",body:JSON.stringify(e)})}const lw=new Map;function w_(){lw.clear()}function cw({disabled:e=!1,workspaceId:t=null,pendingProvider:r=null,selectedProvider:i=null,providers:a=Ic,className:c,disabledReasons:u,statusHintByProvider:d,onSelect:m}){const f=ms(),w=!!t,[g,v]=p.useState(()=>wx(a,t)),y=a.map(x=>({provider:x}));return p.useEffect(()=>{GT()},[]),p.useEffect(()=>{if(!t){v({});return}const x=wx(a,t);v(x);const C=a.filter(N=>!x[N]);if(C.length===0)return;let j=!1;return Zb(C,t).then(N=>{y_(t,N),j||v(P=>({...P,...N}))}),()=>{j=!0}},[a,t]),n.jsx("div",{className:`session-provider-grid${c?` ${c}`:""}`,children:y.map(x=>{const C=ds(x.provider,"full"),j=r===x.provider,N=i===x.provider,P=!!g[x.provider],L=v_(g[x.provider]??null),Y=(u==null?void 0:u[x.provider])??L,H=j?o("shell.startingSession"):Y||((d==null?void 0:d[x.provider])??(w&&!P&&!j?o("shell.providerChecking"):null));return n.jsxs("button",{type:"button",className:"session-provider-card","data-provider":x.provider,"data-pending":j?"true":"false","data-selected":N?"true":"false","aria-label":C,disabled:e||!!Y,onClick:()=>{f.trigger("action"),m(x.provider)},children:[n.jsx("span",{className:"session-provider-card-icon","aria-hidden":"true",children:n.jsx("img",{src:VT(x.provider),alt:"",loading:"eager",decoding:"async"})}),n.jsxs("span",{className:"session-provider-card-copy",children:[n.jsx("strong",{children:C}),H?n.jsx("span",{className:"session-provider-card-status",children:H}):null]})]},x.provider)})})}function v_(e){return!e||e.canStartSession!==!1?null:e.limitations[0]??o("conversation.capabilityDenied")}function wx(e,t){const r=(t==null?void 0:t.trim())??"";if(!r)return{};const i=[];for(const a of e){const c=lw.get(cP(r,a));c&&i.push([a,c])}return Object.fromEntries(i)}function y_(e,t){const r=e.trim();if(r)for(const[i,a]of Object.entries(t))a&&lw.set(cP(r,i),a)}function cP(e,t){return`${e}::${t}`}class zh extends Error{constructor(t,r){super(r),this.code=t,this.name="HostSwitchError"}}class k_{constructor(){tt(this,"inFlight",null)}async switchHost(t){this.inFlight&&await this.inFlight;const r=this.performSwitch(t).finally(()=>{this.inFlight===r&&(this.inFlight=null)});this.inFlight=r,await r}async performSwitch(t){const r=In.getState();if(r.activeHostId===t)return;const i=Qj(r,t);if(!i)throw new zh("HOST_NOT_FOUND",`找不到 HOST:${t}`);if(!(await iT(i.baseUrl)).reachable)throw new zh("HOST_UNREACHABLE",`目标 HOST 不可达:${i.baseUrl}`);await In.update({hosts:r.hosts.map(c=>c.id===t?{...c,lastConnectedAt:new Date().toISOString(),updatedAt:new Date().toISOString()}:c),activeHostId:t})}}const uP=new k_;function dP({collapsed:e=!1}){const[t,r]=p.useState(!1),[i,a]=p.useState(!1),[c,u]=p.useState(""),[d,m]=p.useState(""),[f,w]=p.useState(null),[g,v]=p.useState(null),y=p.useRef(null),x=p.useRef(null),C=rm(M=>M),j=im(M=>M.session),{showToast:N}=Jn(),P=Ga(C),L=p.useMemo(()=>x_(C.hosts,C.activeHostId),[C.activeHostId,C.hosts]),Y=p.useCallback(()=>{if(typeof window>"u")return;const M=y.current;if(!M)return;const O=M.getBoundingClientRect(),F=window.innerWidth,X=window.innerHeight,U=16,G=8,A=Math.min(320,Math.max(240,F-U*2)),Z=Math.min(e?Math.max(U,O.right+G):Math.max(U,O.left),Math.max(U,F-A-U)),pe=i?320:240,q=e?O.top:O.bottom+G,D=Math.min(Math.max(U,q),Math.max(U,X-pe-U));v({position:"fixed",top:D,left:Z,width:A,maxWidth:F-U*2})},[e,i]);p.useEffect(()=>{if(!t){v(null);return}function M(F){var X,U;F.target instanceof Node&&!((X=y.current)!=null&&X.contains(F.target))&&!((U=x.current)!=null&&U.contains(F.target))&&(r(!1),a(!1))}function O(F){F.key==="Escape"&&(r(!1),a(!1))}return window.addEventListener("pointerdown",M),window.addEventListener("keydown",O),window.addEventListener("resize",Y),window.addEventListener("scroll",Y,!0),Y(),()=>{window.removeEventListener("pointerdown",M),window.removeEventListener("keydown",O),window.removeEventListener("resize",Y),window.removeEventListener("scroll",Y,!0)}},[t,Y]);async function H(M){if(f||M.id===C.activeHostId){r(!1);return}w(M.id);try{await uP.switchHost(M.id),r(!1),a(!1)}catch(O){N({title:N_(O,M.name),tone:"error"})}finally{w(null)}}async function W(){let M;try{M=Ps(d)}catch{N({title:o("shell.hostAddInvalidUrl"),tone:"error"});return}if(C.hosts.some(X=>X.baseUrl===M)){N({title:o("shell.hostAddDuplicate"),tone:"error"});return}const O=new Date().toISOString(),F={id:j_(),name:c.trim()||S_(M),baseUrl:M,kind:C_(M),createdAt:O,updatedAt:O,lastConnectedAt:null,lastUserId:null,lastUsername:null};try{await In.update({hosts:[...C.hosts,F]}),u(""),m(""),a(!1),N({title:o("shell.hostAddSuccess",{name:F.name})})}catch{N({title:o("shell.hostAddFailed"),tone:"error"})}}if(!P)return null;const I=j!=null&&j.user.username?`${P.baseUrl} · ${j.user.username}`:P.baseUrl;return n.jsxs("div",{ref:y,className:"workbench-host-switcher-anchor","data-collapsed":e,children:[n.jsx("button",{type:"button",className:e?"workbench-nav-toolbar-button workbench-collapsed-button":"workbench-nav-toolbar-button","aria-label":o("shell.hostSwitcherAriaLabel"),title:I,"aria-expanded":t,onClick:()=>{r(M=>!M),a(!1)},children:n.jsx(T_,{})}),t&&g&&typeof document<"u"?Vn.createPortal(n.jsxs("div",{ref:x,className:"workbench-host-switcher-menu",style:g,role:"menu","aria-label":o("shell.hostSwitcherTitle"),children:[n.jsx("div",{className:"workbench-host-switcher-menu-header",children:n.jsx("strong",{children:o("shell.hostSwitcherTitle")})}),n.jsx("div",{className:"workbench-host-switcher-list",children:L.map(M=>{const O=M.id===C.activeHostId,F=O?(j==null?void 0:j.user.username)??M.lastUsername??M.baseUrl:M.lastUsername??M.baseUrl;return n.jsxs("button",{type:"button",className:"workbench-host-switcher-item","data-active":O,disabled:f!==null,onClick:()=>{H(M)},children:[n.jsxs("span",{className:"workbench-host-switcher-item-copy",children:[n.jsxs("span",{className:"workbench-host-switcher-item-title",children:[M.name,O?n.jsx("span",{className:"workbench-host-switcher-item-badge",children:o("shell.hostSwitcherCurrentBadge")}):null]}),n.jsx("span",{className:"workbench-host-switcher-item-meta",children:F})]}),n.jsx("span",{className:"workbench-host-switcher-item-trailing",children:f===M.id?o("shell.hostSwitcherSwitching"):O?n.jsx(D_,{}):n.jsx(P_,{})})]},M.id)})}),i?n.jsxs("div",{className:"workbench-host-switcher-form",children:[n.jsxs("label",{className:"workbench-host-switcher-field",children:[n.jsx("span",{children:o("shell.hostSwitcherNameLabel")}),n.jsx("input",{value:c,onChange:M=>u(M.target.value),placeholder:o("shell.hostSwitcherNamePlaceholder")})]}),n.jsxs("label",{className:"workbench-host-switcher-field",children:[n.jsx("span",{children:o("shell.hostSwitcherUrlLabel")}),n.jsx("input",{value:d,onChange:M=>m(M.target.value),placeholder:o("shell.hostSwitcherUrlPlaceholder")})]}),n.jsxs("div",{className:"workbench-host-switcher-form-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{a(!1),u(""),m("")},children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",onClick:()=>{W()},children:o("shell.hostSwitcherSaveAction")})]})]}):n.jsxs("button",{type:"button",className:"workbench-host-switcher-add",onClick:()=>{a(!0)},children:[n.jsx(R_,{}),o("shell.hostSwitcherAddAction")]})]}),document.body):null]})}function x_(e,t){return[...e].sort((r,i)=>{if(r.id===t)return-1;if(i.id===t)return 1;const a=r.lastConnectedAt??r.updatedAt??r.createdAt;return(i.lastConnectedAt??i.updatedAt??i.createdAt).localeCompare(a)})}function S_(e){try{const t=new URL(e),r=t.pathname==="/"?"":t.pathname.replace(/\/+$/,"");return`${t.host}${r}`}catch{return e}}function C_(e){try{const t=new URL(e).hostname.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="::1"||t==="[::1]"?"local":/^10\./.test(t)||/^192\.168\./.test(t)||/^172\.(1[6-9]|2\d|3[0-1])\./.test(t)?"lan":"remote"}catch{return"custom"}}function j_(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?`host-${crypto.randomUUID()}`:`host-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function N_(e,t){return e instanceof zh?e.code==="HOST_UNREACHABLE"?o("shell.hostSwitchUnreachable",{name:t}):o("shell.hostSwitchMissing"):o("shell.hostSwitchFailed")}function T_(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[n.jsx("rect",{x:"4",y:"4.5",width:"16",height:"6.5",rx:"2.2",stroke:"currentColor",strokeWidth:"1.8"}),n.jsx("rect",{x:"4",y:"13",width:"16",height:"6.5",rx:"2.2",stroke:"currentColor",strokeWidth:"1.8"}),n.jsx("path",{d:"M11 7.75h5.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"}),n.jsx("path",{d:"M11 16.25h5.5",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"}),n.jsx("circle",{cx:"7.5",cy:"7.75",r:"1",fill:"currentColor",stroke:"none"}),n.jsx("circle",{cx:"7.5",cy:"16.25",r:"1",fill:"currentColor",stroke:"none"})]})}function P_(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function D_(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}function R_(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M8 3.5v9M3.5 8h9",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function M_(){return n.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:n.jsx("path",{d:"M7 7L17 17M17 7L7 17",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.8"})})}function Ln({open:e,title:t,description:r,className:i,headerActions:a,showCloseButton:c=!0,onClose:u,children:d}){return p.useEffect(()=>{if(!e)return;function m(f){f.key==="Escape"&&u()}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[u,e]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:u}),n.jsxs("section",{className:`workbench-modal-card surface-card${i?` ${i}`:""}`,role:"dialog","aria-modal":"true","aria-label":t,children:[n.jsxs("div",{className:"workbench-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:t}),n.jsx("p",{children:r})]}),a||c?n.jsxs("div",{className:"workbench-modal-header-actions",children:[a,c?n.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":o("common.close"),onClick:u,children:n.jsx(M_,{})}):null]}):null]}),n.jsx("div",{className:"workbench-modal-body",children:d})]})]}),document.body)}const Pd={repositoryUrl:"",parentPath:"",directoryName:"",name:"",authMode:"none",username:"",password:"",token:""};function hP({open:e,onClose:t,onCloned:r}){const{showToast:i}=Jn(),[a,c]=p.useState(!1),[u,d]=p.useState(Pd),[m,f]=p.useState(!1),[w,g]=p.useState(!1),[v,y]=p.useState(null),[x,C]=p.useState(""),[j,N]=p.useState(""),[P,L]=p.useState(null),[Y,H]=p.useState([]),[W,I]=p.useState([]),M=a||w;p.useEffect(()=>{!e&&!a&&(d(Pd),f(!1),y(null))},[a,e]);const O=p.useCallback(async Z=>{g(!0),y(null);try{const pe=await IT(Z);C(pe.currentPath),N(pe.currentPath),L(pe.parentPath),H(pe.roots),I(pe.items),d(q=>({...q,parentPath:pe.currentPath}))}catch(pe){C(""),L(null),I([]),y(pe instanceof Error?pe.message:o("shell.importBrowserBrowseFailed"))}finally{g(!1)}},[]);function F(){a||(f(!1),y(null),d(Pd),t())}function X(){f(!0),O(u.parentPath||void 0)}function U(){a||(f(!1),y(null))}async function G(Z){Z.preventDefault(),await O(j)}function R(){d(Z=>({...Z,parentPath:x})),f(!1),y(null)}async function A(Z){Z.preventDefault();const pe=u.repositoryUrl.trim(),q=u.parentPath.trim();if(!pe){i({title:o("shell.cloneRepoRequired"),tone:"error"});return}if(!q){i({title:o("shell.clonePathRequired"),tone:"error"});return}c(!0);try{const D=await VL({repositoryUrl:pe,parentPath:q,directoryName:u.directoryName.trim()||void 0,name:u.name.trim()||void 0,auth:u.authMode==="none"?{mode:"none"}:u.authMode==="basic"?{mode:"basic",username:u.username.trim(),password:u.password}:{mode:"token",username:u.username.trim()||void 0,token:u.token}});await(r==null?void 0:r(D)),d(Pd),f(!1),i({title:o("shell.cloneSuccess"),description:D.path,tone:"success"}),t()}catch(D){i({title:D instanceof Error?D.message:o("shell.cloneFailed"),tone:"error"})}finally{c(!1)}}return n.jsxs(n.Fragment,{children:[n.jsx(Ln,{open:e,title:o("shell.cloneWorkspaceTitle"),description:o("shell.cloneWorkspaceHint"),onClose:F,children:n.jsxs("form",{className:"workbench-clone-form",onSubmit:Z=>void A(Z),children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneRepositoryLabel")}),n.jsx("input",{type:"text",value:u.repositoryUrl,placeholder:o("shell.cloneRepositoryPlaceholder"),onChange:Z=>d(pe=>({...pe,repositoryUrl:Z.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneParentPathLabel")}),n.jsxs("div",{className:"workbench-modal-inline-field",children:[n.jsx("input",{type:"text",value:u.parentPath,placeholder:o("shell.cloneParentPathPlaceholder"),onChange:Z=>d(pe=>({...pe,parentPath:Z.target.value}))}),n.jsx("button",{type:"button",className:"secondary-button",disabled:a,onClick:X,children:o("shell.clonePickDirectory")})]})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneDirectoryNameLabel")}),n.jsx("input",{type:"text",value:u.directoryName,placeholder:o("shell.cloneDirectoryNamePlaceholder"),onChange:Z=>d(pe=>({...pe,directoryName:Z.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.importNameLabel")}),n.jsx("input",{type:"text",value:u.name,placeholder:o("shell.importNamePlaceholder"),onChange:Z=>d(pe=>({...pe,name:Z.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneAuthModeLabel")}),n.jsxs("select",{value:u.authMode,onChange:Z=>d(pe=>({...pe,authMode:Z.target.value})),children:[n.jsx("option",{value:"none",children:o("shell.cloneAuthModeNone")}),n.jsx("option",{value:"basic",children:o("shell.cloneAuthModeBasic")}),n.jsx("option",{value:"token",children:o("shell.cloneAuthModeToken")})]})]}),u.authMode==="basic"?n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneUsernameLabel")}),n.jsx("input",{type:"text",value:u.username,placeholder:o("shell.cloneUsernamePlaceholder"),autoComplete:"username",onChange:Z=>d(pe=>({...pe,username:Z.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.clonePasswordLabel")}),n.jsx("input",{type:"password",value:u.password,placeholder:o("shell.clonePasswordPlaceholder"),autoComplete:"current-password",onChange:Z=>d(pe=>({...pe,password:Z.target.value}))})]})]}):null,u.authMode==="token"?n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneUsernameLabel")}),n.jsx("input",{type:"text",value:u.username,placeholder:o("shell.cloneTokenUsernamePlaceholder"),onChange:Z=>d(pe=>({...pe,username:Z.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneTokenLabel")}),n.jsx("input",{type:"password",value:u.token,placeholder:o("shell.cloneTokenPlaceholder"),onChange:Z=>d(pe=>({...pe,token:Z.target.value}))})]})]}):null,n.jsx("p",{className:"workbench-import-hint",children:o("shell.cloneHint")}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:a,onClick:F,children:o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:a,children:o(a?"shell.cloneSubmitting":"shell.cloneSubmit")})]})]})}),n.jsxs(Ln,{open:e&&m,title:o("shell.cloneBrowserTitle"),description:o("shell.cloneBrowserDescription"),onClose:U,children:[n.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:G,children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.importBrowserCurrentPath")}),n.jsx("input",{type:"text",value:j,placeholder:o("shell.importPathPlaceholder"),onChange:Z=>N(Z.target.value)})]}),n.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:M||!P,onClick:()=>{P&&O(P)},children:o("shell.importBrowserOpenParent")}),n.jsx("button",{type:"submit",className:"secondary-button",disabled:M,children:o("shell.importBrowserOpenPath")})]})]}),n.jsxs("section",{className:"workbench-directory-browser-panel",children:[n.jsxs("div",{className:"workbench-directory-browser-section",children:[n.jsx("span",{className:"workbench-directory-browser-section-title",children:o("shell.importBrowserRoots")}),n.jsx("div",{className:"workbench-directory-browser-root-list",children:Y.map(Z=>n.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:M,onClick:()=>{O(Z.path)},children:Z.name},Z.path))})]}),n.jsx("div",{className:"workbench-directory-browser-current-path",children:x}),v?n.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:v}):null,w?n.jsx("p",{className:"workbench-directory-browser-status status-text",children:o("common.loading")}):W.length>0?n.jsx("div",{className:"workbench-directory-browser-list",children:W.map(Z=>n.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:M,onClick:()=>{O(Z.path)},children:[n.jsx("span",{className:"workbench-directory-browser-item-name",children:Z.name}),n.jsx("span",{className:"workbench-directory-browser-item-path",children:Z.path})]},Z.path))}):n.jsx("p",{className:"workbench-directory-browser-status status-text",children:o("shell.importBrowserEmpty")})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:a,onClick:U,children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:M||!x,onClick:R,children:o("shell.cloneBrowserSubmit")})]})]})]})}const No="butler:inbox-updated";function vx(){typeof window>"u"||window.dispatchEvent(new Event(No))}const yx={projectId:"",itemType:"task",title:"",content:"",status:"pending"};function mP({active:e,preferredWorkspaceId:t,preferredSessionId:r,creationRequestId:i=0,initialDraft:a=null,compactComposer:c=!1,composerOpen:u=!0,onComposerOpenChange:d}){const{showToast:m}=Jn(),[f,w]=p.useState(!1),[g,v]=p.useState(!1),[y,x]=p.useState([]),[C,j]=p.useState([]),[N,P]=p.useState(null),[L,Y]=p.useState(null),[H,W]=p.useState(yx),I=p.useMemo(()=>xx(y,t,L),[L,t,y]);p.useEffect(()=>{e&&M()},[e,r]),p.useEffect(()=>{!e||N||W(G=>{const R=Cx({projects:I,currentProjectId:G.projectId,preferredProjectId:L,preferredWorkspaceId:t});return R===G.projectId?G:{...G,projectId:R}})},[e,N,L,t,I]),p.useEffect(()=>{!e||i<=0||(O(void 0,t,a,L),d==null||d(!0))},[e,i,a,d,L,t]);async function M(){w(!0);try{const[G,R,A]=await Promise.all([o_(),Kc(),r?f_(r).catch(()=>null):Promise.resolve(null)]),Z=(A==null?void 0:A.target.project.id)??null;Y(Z),x(G.items),j(R.items),N||O(G.items,t,i>0?a:null,Z)}catch(G){m({title:o("shell.butlerInboxLoadFailed"),description:G instanceof Error?G.message:void 0,tone:"error"})}finally{w(!1)}}function O(G=y,R=t,A=a,Z=L){var q,D;const pe=xx(G,R,Z);P(null),W({...yx,projectId:Cx({projects:pe,preferredProjectId:Z,preferredWorkspaceId:R}),title:((q=A==null?void 0:A.title)==null?void 0:q.trim())??"",content:((D=A==null?void 0:A.content)==null?void 0:D.trim())??""})}function F(G){P(G.id),W({projectId:G.projectId,itemType:G.itemType,title:G.title,content:G.content,status:G.status}),c&&(d==null||d(!0))}async function X(G){G.preventDefault(),v(!0);try{N?(await d_(N,{projectId:H.projectId,itemType:H.itemType,title:H.title,content:H.content,status:H.status,priority:"medium"}),m({title:o("shell.butlerInboxUpdated"),tone:"success"})):(await l_({projectId:H.projectId,itemType:H.itemType,title:H.title,content:H.content,status:H.status,priority:"medium"}),m({title:o("shell.butlerInboxCreated"),tone:"success"})),vx(),await M(),O(),c&&(d==null||d(!1))}catch(R){m({title:o("shell.butlerInboxSaveFailed"),description:R instanceof Error?R.message:void 0,tone:"error"})}finally{v(!1)}}async function U(G){v(!0);try{await h_(G),m({title:o("shell.butlerInboxDeleted"),tone:"success"}),vx(),await M(),N===G&&O()}catch(R){m({title:o("shell.butlerInboxDeleteFailed"),description:R instanceof Error?R.message:void 0,tone:"error"})}finally{v(!1)}}return n.jsxs("div",{className:"workspace-inbox-modal",children:[c?null:n.jsx("section",{className:"workspace-inbox-panel",children:n.jsx(kx,{selectableProjects:I,formState:H,saving:g,editingItemId:N,useMobilePicker:!1,onProjectChange:G=>{W(R=>({...R,projectId:G}))},onItemTypeChange:G=>{W(R=>({...R,itemType:G}))},onStatusChange:G=>{W(R=>({...R,status:G}))},onTitleChange:G=>{W(R=>({...R,title:G}))},onContentChange:G=>{W(R=>({...R,content:G}))},onCancel:()=>O(),onSubmit:X})}),n.jsxs("section",{className:"workspace-inbox-panel",children:[n.jsxs("header",{className:"workspace-inbox-panel-header",children:[n.jsx("h3",{children:o("shell.butlerInboxListTitle")}),n.jsx("p",{children:o("shell.butlerInboxListDescription")})]}),f?n.jsx("p",{className:"workspace-inbox-status",children:o("shell.butlerInboxLoading")}):null,!f&&C.length===0?n.jsx("p",{className:"workspace-inbox-status",children:o("shell.butlerInboxEmpty")}):null,!f&&C.length>0?n.jsx("div",{className:"workspace-inbox-list",children:C.map(G=>n.jsxs("article",{className:"workspace-inbox-item",children:[n.jsxs("div",{className:"workspace-inbox-item-header",children:[n.jsxs("div",{children:[n.jsx("strong",{children:G.title}),n.jsx("p",{children:G.projectName})]}),n.jsxs("div",{className:"workspace-inbox-item-badges",children:[n.jsx("span",{className:"workspace-inbox-badge",children:__(G.status)}),n.jsx("span",{className:"workspace-inbox-badge",children:F_(G.itemType)})]})]}),n.jsx("p",{className:"workspace-inbox-item-content",children:G.content}),n.jsxs("div",{className:"workspace-inbox-item-footer",children:[n.jsx("span",{children:O_(G.updatedAt)}),n.jsxs("div",{className:"workspace-inbox-item-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:g,onClick:()=>F(G),children:o("shell.butlerInboxEditAction")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:g,onClick:()=>{U(G.id)},children:o("shell.butlerInboxDeleteAction")})]})]})]},G.id))}):null]}),c?n.jsx(Ln,{open:e&&u,title:o(N?"shell.butlerInboxEditingTitle":"shell.butlerInboxCreateTitle"),description:o("shell.butlerInboxFormDescription"),className:"workspace-inbox-modal-card workspace-inbox-composer-modal-card",onClose:()=>{d==null||d(!1),O()},children:n.jsx("div",{className:"workspace-inbox-composer-modal-body",children:n.jsx(kx,{selectableProjects:I,formState:H,saving:g,editingItemId:N,useMobilePicker:!0,onProjectChange:G=>{W(R=>({...R,projectId:G}))},onItemTypeChange:G=>{W(R=>({...R,itemType:G}))},onStatusChange:G=>{W(R=>({...R,status:G}))},onTitleChange:G=>{W(R=>({...R,title:G}))},onContentChange:G=>{W(R=>({...R,content:G}))},onCancel:()=>{d==null||d(!1),O()},onSubmit:X})})}):null]})}function kx(e){const t=e.selectableProjects.map(a=>({value:a.id,label:a.name})),r=[{value:"task",label:o("shell.butlerInboxTypeTask")},{value:"bug",label:o("shell.butlerInboxTypeBug")},{value:"feature",label:o("shell.butlerInboxTypeFeature")},{value:"change",label:o("shell.butlerInboxTypeChange")}],i=[{value:"pending",label:o("shell.butlerInboxStatusPending")},{value:"in_progress",label:o("shell.butlerInboxStatusInProgress")},{value:"closed",label:o("shell.butlerInboxStatusClosed")}];return n.jsxs(n.Fragment,{children:[n.jsxs("header",{className:"workspace-inbox-panel-header",children:[n.jsx("h3",{children:e.editingItemId?o("shell.butlerInboxEditingTitle"):o("shell.butlerInboxCreateTitle")}),n.jsx("p",{children:o("shell.butlerInboxFormDescription")})]}),e.selectableProjects.length===0?n.jsx("p",{className:"workspace-inbox-status",children:o("shell.butlerInboxProjectsEmpty")}):n.jsxs("form",{className:"workspace-inbox-form",onSubmit:e.onSubmit,children:[n.jsx("div",{className:"workspace-inbox-form-grid",children:e.useMobilePicker?n.jsxs(n.Fragment,{children:[n.jsx(pf,{label:o("shell.butlerInboxProjectLabel"),value:e.formState.projectId,options:t,disabled:e.saving,onChange:e.onProjectChange}),n.jsx(pf,{label:o("shell.butlerInboxTypeLabel"),value:e.formState.itemType,options:r,disabled:e.saving,onChange:e.onItemTypeChange}),n.jsx(pf,{label:o("shell.butlerInboxStatusLabel"),value:e.formState.status,options:i,disabled:e.saving,onChange:e.onStatusChange})]}):n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.butlerInboxProjectLabel")}),n.jsx("select",{value:e.formState.projectId,disabled:e.saving,onChange:a=>e.onProjectChange(a.target.value),children:e.selectableProjects.map(a=>n.jsx("option",{value:a.id,children:a.name},a.id))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.butlerInboxTypeLabel")}),n.jsxs("select",{value:e.formState.itemType,disabled:e.saving,onChange:a=>e.onItemTypeChange(a.target.value),children:[n.jsx("option",{value:"task",children:o("shell.butlerInboxTypeTask")}),n.jsx("option",{value:"bug",children:o("shell.butlerInboxTypeBug")}),n.jsx("option",{value:"feature",children:o("shell.butlerInboxTypeFeature")}),n.jsx("option",{value:"change",children:o("shell.butlerInboxTypeChange")})]})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.butlerInboxStatusLabel")}),n.jsxs("select",{value:e.formState.status,disabled:e.saving,onChange:a=>e.onStatusChange(a.target.value),children:[n.jsx("option",{value:"pending",children:o("shell.butlerInboxStatusPending")}),n.jsx("option",{value:"in_progress",children:o("shell.butlerInboxStatusInProgress")}),n.jsx("option",{value:"closed",children:o("shell.butlerInboxStatusClosed")})]})]})]})}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.butlerInboxTitleLabel")}),n.jsx("input",{value:e.formState.title,placeholder:o("shell.butlerInboxTitlePlaceholder"),disabled:e.saving,onChange:a=>e.onTitleChange(a.target.value)})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.butlerInboxContentLabel")}),n.jsx("textarea",{rows:4,value:e.formState.content,placeholder:o("shell.butlerInboxContentPlaceholder"),disabled:e.saving,onChange:a=>e.onContentChange(a.target.value)})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:e.saving,onClick:e.onCancel,children:e.editingItemId?o("shell.butlerInboxCancelEditAction"):o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:e.saving||!e.formState.projectId,children:e.editingItemId?o("shell.butlerInboxUpdateAction"):o("shell.butlerInboxCreateAction")})]})]})]})}function pf({label:e,value:t,options:r,disabled:i,onChange:a}){const[c,u]=p.useState(!1),d=r.find(m=>m.value===t)??r[0]??null;return p.useEffect(()=>{if(!c)return;function m(f){f.key==="Escape"&&u(!1)}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[c]),n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"workbench-modal-field workspace-inbox-mobile-picker",children:[n.jsx("span",{children:e}),n.jsxs("button",{type:"button",className:"workspace-inbox-mobile-picker-trigger","aria-label":e,"aria-haspopup":"dialog","aria-expanded":c,disabled:i||r.length===0,onClick:()=>u(!0),children:[n.jsx("span",{className:"workspace-inbox-mobile-picker-trigger-value",children:(d==null?void 0:d.label)??""}),n.jsx("span",{className:"workspace-inbox-mobile-picker-trigger-icon",children:n.jsx(I_,{expanded:c})})]})]}),n.jsx(A_,{open:c,title:e,options:r,selectedValue:t,onClose:()=>u(!1),onSelect:m=>{a(m),u(!1)}})]})}function A_({open:e,title:t,options:r,selectedValue:i,onClose:a,onSelect:c}){return!e||typeof document>"u"?null:Vn.createPortal(n.jsx("div",{className:"ios-action-sheet-overlay workspace-inbox-picker-sheet-overlay",role:"presentation",onClick:a,children:n.jsxs("div",{className:"mobile-workspace-home-sheet workspace-inbox-picker-sheet",role:"dialog","aria-modal":"true","aria-label":t,onClick:u=>u.stopPropagation(),children:[n.jsxs("div",{className:"mobile-workspace-home-sheet-card workspace-inbox-picker-sheet-card",children:[n.jsx("div",{className:"mobile-workspace-home-sheet-header workspace-inbox-picker-sheet-header",children:n.jsx("strong",{children:t})}),n.jsx("div",{className:"mobile-workspace-home-group workspace-inbox-picker-sheet-options",role:"listbox","aria-label":t,children:r.map(u=>{const d=u.value===i;return n.jsxs("button",{type:"button",className:"mobile-workspace-home-row workspace-inbox-picker-option",role:"option","aria-selected":d,onClick:()=>c(u.value),children:[n.jsxs("span",{className:"workspace-inbox-picker-option-copy",children:[n.jsx("strong",{children:u.label}),u.description?n.jsx("span",{children:u.description}):null]}),n.jsx("span",{className:"workspace-inbox-picker-option-indicator","aria-hidden":"true",children:d?n.jsx(L_,{}):null})]},u.value)})})]}),n.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:a,children:o("common.cancel")})]})}),document.body)}function Og({open:e,preferredWorkspaceId:t,preferredSessionId:r,creationRequestId:i=0,initialDraft:a=null,onClose:c,compactComposer:u=!1}){const[d,m]=p.useState(0),[f,w]=p.useState(!u);return p.useEffect(()=>{e||w(!u)},[u,e]),n.jsx(Ln,{open:e,title:o("shell.butlerInboxModalTitle"),description:o("shell.butlerInboxModalDescription"),className:"workspace-inbox-modal-card",showCloseButton:!u,headerActions:u?n.jsx("button",{type:"button",className:"workspace-inbox-modal-create-button","aria-label":o("shell.butlerInboxCreateAction"),title:o("shell.butlerInboxCreateAction"),onClick:()=>{m(g=>g+1),w(!0)},children:n.jsx(E_,{})}):void 0,onClose:c,children:n.jsx(mP,{active:e,preferredWorkspaceId:t,preferredSessionId:r,creationRequestId:Math.max(i,d),initialDraft:a,compactComposer:u,composerOpen:f,onComposerOpenChange:w})})}function xx(e,t,r){return[...e].filter(i=>i.lifecycleStatus!=="archived").sort((i,a)=>{const c=Sx(i,t,r),u=Sx(a,t,r);return c!==u?u-c:i.name.localeCompare(a.name,"zh-Hans-CN")})}function Sx(e,t,r){return r&&e.id===r?2:t&&e.workspaceId===t?1:0}function Cx({projects:e,currentProjectId:t,preferredProjectId:r,preferredWorkspaceId:i}){var c;if(t&&e.some(u=>u.id===t))return t;if(r&&e.some(u=>u.id===r))return r;const a=i?e.find(u=>u.workspaceId===i):null;return(a==null?void 0:a.id)||((c=e[0])==null?void 0:c.id)||""}function E_(){return n.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[n.jsx("path",{d:"M12 5v14"}),n.jsx("path",{d:"M5 12h14"})]})}function I_({expanded:e}){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true","data-expanded":e?"true":void 0,children:n.jsx("path",{d:"M3.5 6 8 10l4.5-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function L_(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 8.4 6.6 11.5 12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}function F_(e){switch(e){case"bug":return o("shell.butlerInboxTypeBug");case"feature":return o("shell.butlerInboxTypeFeature");case"change":return o("shell.butlerInboxTypeChange");case"task":default:return o("shell.butlerInboxTypeTask")}}function __(e){switch(e){case"in_progress":return o("shell.butlerInboxStatusInProgress");case"closed":return o("shell.butlerInboxStatusClosed");case"pending":default:return o("shell.butlerInboxStatusPending")}}function O_(e){return new Date(e).toLocaleString()}function pP({open:e,onClose:t,onImported:r}){const{showToast:i}=Jn(),[a,c]=p.useState(!1),[u,d]=p.useState(!1),[m,f]=p.useState(!1),[w,g]=p.useState(null),[v,y]=p.useState(""),[x,C]=p.useState(""),[j,N]=p.useState(null),[P,L]=p.useState([]),[Y,H]=p.useState([]),[W,I]=p.useState(!1),[M,O]=p.useState(""),F=a||u||m,X=p.useCallback(async q=>{c(!0),g(null);try{const D=await IT(q);y(D.currentPath),C(D.currentPath),N(D.parentPath),L(D.roots),H(D.items)}catch(D){y(""),N(null),H([]),g(D instanceof Error?D.message:o("shell.importBrowserBrowseFailed"))}finally{c(!1)}},[]);p.useEffect(()=>{if(!e){I(!1),O(""),g(null);return}X(v||void 0)},[X,e]);function U(){F||(I(!1),O(""),t())}async function G(q){q.preventDefault(),await X(x)}function R(){!v||F||(O(""),I(!0))}function A(){u||(I(!1),O(""))}async function Z(q){q==null||q.preventDefault();const D=M.trim();if(!(!v||!D||F)){d(!0),g(null);try{const T=await QL({parentPath:v,directoryName:D});i({title:o("shell.importBrowserCreateDirectorySuccess"),description:T.path,tone:"success"}),I(!1),O(""),await X(T.path)}catch(T){const B=T instanceof Error?T.message:o("shell.importBrowserCreateDirectoryFailed");g(B),i({title:B,tone:"error"})}finally{d(!1)}}}async function pe(){const q=v.trim();if(!(!q||F)){f(!0),g(null);try{const D=await $L({path:q});i({title:o("shell.importSuccess"),description:D.path,tone:"success"}),t(),Promise.resolve().then(()=>r==null?void 0:r(D)).catch(T=>{i({title:T instanceof Error?T.message:o("shell.navigationLoadFailed"),tone:"error"})})}catch(D){i({title:D instanceof Error?D.message:o("shell.importFailed"),tone:"error"})}finally{f(!1)}}}return n.jsxs(n.Fragment,{children:[n.jsxs(Ln,{open:e,title:o("shell.importBrowserTitle"),description:o("shell.importBrowserDescription"),onClose:U,children:[n.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:G,children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.importBrowserCurrentPath")}),n.jsx("input",{type:"text",value:x,placeholder:o("shell.importPathPlaceholder"),onChange:q=>C(q.target.value)})]}),n.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:F||!j,onClick:()=>{j&&X(j)},children:o("shell.importBrowserOpenParent")}),n.jsx("button",{type:"submit",className:"secondary-button",disabled:F,children:o("shell.importBrowserOpenPath")}),n.jsx("button",{type:"button",className:"secondary-button",disabled:F||!v,onClick:R,children:o("shell.importBrowserCreateDirectory")})]})]}),n.jsxs("section",{className:"workbench-directory-browser-panel",children:[n.jsxs("div",{className:"workbench-directory-browser-section",children:[n.jsx("span",{className:"workbench-directory-browser-section-title",children:o("shell.importBrowserRoots")}),n.jsx("div",{className:"workbench-directory-browser-root-list",children:P.map(q=>n.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:F,onClick:()=>{X(q.path)},children:q.name},q.path))})]}),n.jsx("div",{className:"workbench-directory-browser-current-path",children:v}),w?n.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:w}):null,a?n.jsx("p",{className:"workbench-directory-browser-status status-text",children:o("common.loading")}):Y.length>0?n.jsx("div",{className:"workbench-directory-browser-list",children:Y.map(q=>n.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:F,onClick:()=>{X(q.path)},children:[n.jsx("span",{className:"workbench-directory-browser-item-name",children:q.name}),n.jsx("span",{className:"workbench-directory-browser-item-path",children:q.path})]},q.path))}):n.jsx("p",{className:"workbench-directory-browser-status status-text",children:o("shell.importBrowserEmpty")})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:F,onClick:U,children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:F||!v,onClick:()=>{pe()},children:o(m?"shell.importSubmitting":"shell.importBrowserSubmit")})]})]}),n.jsx(Ln,{open:e&&W,title:o("shell.importBrowserCreateDirectoryTitle"),description:o("shell.importBrowserCreateDirectoryDescription"),onClose:A,children:n.jsxs("form",{className:"workbench-rename-form",onSubmit:q=>void Z(q),children:[n.jsx("div",{className:"workbench-directory-browser-current-path",children:v}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.importBrowserCreateDirectoryLabel")}),n.jsx("input",{type:"text",value:M,placeholder:o("shell.importBrowserCreateDirectoryPlaceholder"),autoFocus:!0,onChange:q=>O(q.target.value)})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:u,onClick:A,children:o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:u||!M.trim(),children:o(u?"shell.importBrowserCreatingDirectory":"shell.importBrowserCreateDirectorySubmit")})]})]})})]})}const jx="workbench.left.width",Nx="workbench.right.width",Tx="workbench.left.collapsed",Px="workbench.right.collapsed",ff="workbench.last.session.path",gf="workbench.workspace.selected.id",Dx="workbench.notifications.seen_at",B_=280,W_=320,Dd=208,Rx=520,Mx=560,U_=200,bf=20,hc=40,Rd=5,H_=3e4,z_=12,Ax=60*1e3,q_=4e3,Ex=220,Ix=18,$_="workbench:focus-composer",V_=new Set(["starting","running","reconnecting","stale","unknown"]),G_=["#34C759","#22C55E","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899","#F43F5E","#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#10B981"];function K_(e){return V_.has(e.runningState??"idle")||e.activityState==="running"}function Y_(e){var a,c;const t=((a=e.lastErrorCode)==null?void 0:a.trim())??"",r=((c=e.lastErrorDetail)==null?void 0:c.trim())??"",i=[t,r].filter(u=>u.length>0).join(" · ");return i?i.length<=Ex?i:`${i.slice(0,Ex-3)}...`:null}function X_(e,t){var a,c,u,d,m,f,w,g;const r=new Map(e.projects.map(v=>[v.id,v.workspaceId])),i=[];for(const v of t){const y=((a=v.sessionTitle)==null?void 0:a.trim())||v.projectName,x=v.updatedAt||v.lastAutomationAt||v.createdAt;if(v.status==="waiting_user"){i.push({id:`follow-up-waiting:${v.id}`,kind:"follow_up_waiting_user",title:o("shell.globalNotificationFollowUpWaitingTitle",{title:y}),body:((c=v.waitingReason)==null?void 0:c.trim())||((u=v.lastAutomationSummary)==null?void 0:u.trim())||v.objective,routePath:Nr(v.workspaceId,v.sessionId),workspaceId:v.workspaceId,createdAt:x});continue}if(v.status==="completed"){i.push({id:`follow-up-completed:${v.id}`,kind:"follow_up_completed",title:o("shell.globalNotificationFollowUpCompletedTitle",{title:y}),body:((d=v.lastAutomationSummary)==null?void 0:d.trim())||v.objective,routePath:Nr(v.workspaceId,v.sessionId),workspaceId:v.workspaceId,createdAt:x});continue}v.status==="failed"&&i.push({id:`follow-up-failed:${v.id}`,kind:"follow_up_failed",title:o("shell.globalNotificationFollowUpFailedTitle",{title:y}),body:((m=v.lastAutomationSummary)==null?void 0:m.trim())||((f=v.waitingReason)==null?void 0:f.trim())||v.objective,routePath:Nr(v.workspaceId,v.sessionId),workspaceId:v.workspaceId,createdAt:x})}for(const v of e.verifications){if(v.status!=="failed")continue;const y=v.projectId?r.get(v.projectId)??null:null,x=((w=v.targetRef)==null?void 0:w.trim())||v.verificationType;i.push({id:`verification-failed:${v.id}`,kind:"verification_failed",title:o("shell.globalNotificationVerificationFailedTitle",{title:x}),body:((g=v.summary)==null?void 0:g.trim())||o("shell.globalNotificationVerificationFailedFallback"),routePath:y?jo(y):null,workspaceId:y,createdAt:v.finishedAt||v.startedAt||v.createdAt})}return i.sort((v,y)=>{const x=Lx(v.kind)-Lx(y.kind);return x!==0?x:qa(y.createdAt)-qa(v.createdAt)}).slice(0,z_)}function Lx(e){switch(e){case"follow_up_waiting_user":return 0;case"follow_up_completed":return 1;case"follow_up_failed":return 2;case"verification_failed":return 3;default:return 9}}function Q_(e){switch(e){case"follow_up_waiting_user":return o("shell.globalNotificationKindWaitingUser");case"follow_up_completed":return o("shell.globalNotificationKindFollowUpCompleted");case"follow_up_failed":return o("shell.globalNotificationKindFollowUpFailed");case"verification_failed":return o("shell.globalNotificationKindVerificationFailed");default:return o("shell.globalNotificationsPanelTitle")}}function qa(e){if(!e)return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function J_(e){return/^(?:[A-Za-z0-9_-]+)(?:\/[A-Za-z0-9_-]+)*$/.test(e)}function Z_(e){return/^(?:[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*\/?)?$/.test(e)}function eO(e,t){const r=new Set,i=(e==null?void 0:e.currentBranch)??"",a=((e==null?void 0:e.local)??[]).slice().sort((d,m)=>Number(m.current)-Number(d.current)||d.name.localeCompare(m.name)).map(d=>({value:d.name,current:d.current,recommended:d.name===i})).filter(d=>!d.value||r.has(d.value)?!1:(r.add(d.value),!0)),c=((e==null?void 0:e.remote)??[]).map(d=>({value:d.name})).filter(d=>!d.value||r.has(d.value)?!1:(r.add(d.value),!0)),u=t.map(d=>({value:d.name})).filter(d=>!d.value||r.has(d.value)?!1:(r.add(d.value),!0));return{localBranches:a,remoteBranches:c,tags:u}}function tO(e){return e.getBoundingClientRect()}function nO(e,t){return t?qa(e.createdAt)>qa(t):!0}function rO(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function Fx(e,t){var u,d;const r=["/workspaces/:workspaceId","/workspaces/:workspaceId/sessions","/workspaces/:workspaceId/sessions/:sessionId","/workspaces/:workspaceId/tools","/workspaces/:workspaceId/tools/files","/workspaces/:workspaceId/tools/git","/workspaces/:workspaceId/tools/processes","/workspaces/:workspaceId/terminals","/workspaces/:workspaceId/butler"];for(const m of r){const f=Ir(m,e),w=(u=f==null?void 0:f.params.workspaceId)==null?void 0:u.trim();if(w)return w}const i=Lc(e),a=(i==null?void 0:i.sessionId)??null;return!a||!HP(a)?null:((d=new URLSearchParams(t).get("workspaceId"))==null?void 0:d.trim())||null}function iO(e){return e.startsWith("/sessions")||e.startsWith("/terminals")||e.startsWith("/tools")}function sO(e){return e==="mobile"?Ti():"/landing"}function Lc(e){var c,u,d;const t=Ir("/workspaces/:workspaceId/sessions/:sessionId",e),r=(c=t==null?void 0:t.params.sessionId)==null?void 0:c.trim();if(r)return{sessionId:r,workspaceId:((u=t==null?void 0:t.params.workspaceId)==null?void 0:u.trim())??null};const i=Ir("/sessions/:sessionId",e),a=(d=i==null?void 0:i.params.sessionId)==null?void 0:d.trim();return a?{sessionId:a,workspaceId:null}:null}function aO(e){return!!(Ir("/sessions",e)||Ir("/workspaces/:workspaceId/sessions",e))}function _x(e){return!!Lc(e)}function oO(e){return!!(Ir("/tools",e)||Ir("/tools/files",e)||Ir("/tools/git",e)||Ir("/tools/processes",e)||Ir("/workspaces/:workspaceId/tools",e)||Ir("/workspaces/:workspaceId/tools/files",e)||Ir("/workspaces/:workspaceId/tools/git",e)||Ir("/workspaces/:workspaceId/tools/processes",e))}function Ox(e){return!!(Ir("/terminals",e)||Ir("/workspaces/:workspaceId/terminals",e))}function lO(e){return!!Ir("/workspaces/:workspaceId/butler",e)}function cO(e){return e.trim().replace(/\\/g,"/").replace(/^(?:\.\/)+/,"").replace(/^\/+/,"")}const uO=p.lazy(async()=>({default:(await Pl(()=>Promise.resolve().then(()=>w8),void 0)).FileContextPanel})),dO=p.lazy(async()=>({default:(await Pl(()=>Promise.resolve().then(()=>E8),void 0)).GitSidebar})),hO=p.lazy(async()=>({default:(await Pl(()=>Promise.resolve().then(()=>tG),void 0)).TerminalManagerPanel}));function mO(e){return!!((e==null?void 0:e.item)??(e==null?void 0:e.session))}function Ss(e){return qs(e)}function pO(e){return e&&"item"in e?e.item:(e==null?void 0:e.session)??null}function Dc(e){return Array.isArray(e==null?void 0:e.visibleSessionTree)?e.visibleSessionTree.filter(mO):[]}async function fP(e,t){const r=await Il(t,e);if(r.canStartSession===!1)throw new Error(r.limitations[0]??o("conversation.capabilityDenied"))}const gP=p.createContext(null);function Bg(e){return Ya(e)}function zs(e){return e.isArchived===!0}function fm(e){var t;return((t=e.parentSessionId)==null?void 0:t.trim())||null}function uw(e,t){return sT(e,{getId:r=>r.sessionId,getParentId:fm,compare:(r,i)=>aw(r,i,t)})}function bP(e){return e.filter(t=>{if(zs(t))return!1;const r=fm(t);if(!r)return!0;const i=e.find(a=>a.sessionId===r);return!i||!zs(i)})}function fO(e){return e.flatMap(t=>{const r=pO(t);return r?[r,...aT(Ss(t))]:[]})}function gO(e,t,r){const i=new Set(cs(Ss(e)).sort((a,c)=>aw(a.item,c.item,r)).slice(0,t).map(a=>a.item.sessionId));return{...e,children:wP(Ss(e),i)}}function wP(e,t){return e.flatMap(r=>{const i=wP(Ss(r),t);return!t.has(r.item.sessionId)&&i.length===0?[]:[{...r,children:i}]})}function Md(e,t,r,i=-1){if(e<=0)return 0;const a=i>=0?Math.max(t,i+1):t;return Math.min(e,Math.max(r??0,a))}function Bx(e,t){const r=Object.keys(e),i=Object.keys(t);return r.length!==i.length?!1:r.every(a=>e[a]===t[a])}function bO(e){const t=e.lastMessageAt??e.updatedAt;return t?new Date(t).toLocaleDateString():""}function wO(e){return wu(e)||e.syncStatus==="error"}function vO(e){var i,a;if(!wO(e))return null;const t=((i=e.lastErrorCode)==null?void 0:i.trim())??"",r=((a=e.lastErrorDetail)==null?void 0:a.replace(/\s+/g," ").trim())??"";return t&&r&&!r.includes(t)?`${t} · ${r}`:r||t||(e.syncStatus==="error"&&!wu(e)?o("conversation.syncStatusError"):o("conversation.runtimeErrorTitle"))}function yO(e,t=110){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}function gm(e,t="compact"){return ds(e,t)}const kO={position:"relative",zIndex:0},xO={zIndex:1};function vP(e,t,r,i){const a=[],c=(i==null?void 0:i.trim())||t.name;r&&a.push(c);const u=bO(e);return u&&a.push(u),a.join(" · ")||c}function Wx(e,t){return rw("session-state-indicator",e,t)}function SO(e,t){return YT(e,t)}function Ux(e,t){try{const r=window.localStorage.getItem(e),i=r?Number(r):Number.NaN;return Number.isFinite(i)?i:t}catch{return t}}function Hx(e,t){try{const r=window.localStorage.getItem(e);return r===null?t:r==="true"}catch{return t}}function zx(e){var t;try{const r=(t=window.localStorage.getItem(e))==null?void 0:t.trim();return r||null}catch{return null}}function ho(e,t){try{window.localStorage.setItem(e,t)}catch{}}function CO(e){try{window.localStorage.removeItem(e)}catch{}}function Ad(e,t,r){return Math.max(t,Math.min(r,e))}function jO(e){return e instanceof HTMLElement?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||!!e.closest("[contenteditable='true']"):!1}function NO(){typeof window>"u"||window.dispatchEvent(new CustomEvent($_))}function yP(e,t){const r=t==null?void 0:t.trim();if(!r)return null;for(const i of e){if(i.workspace.id===r)return i;const a=yP(i.children,r);if(a)return a}return null}function TO(e,t){const r=t==null?void 0:t.trim();if(!r)return null;for(const i of e){const a=yP(i.childWorktrees,r);if(a)return a}return null}function qx(e){return!e||!Array.isArray(e.items)?[]:e.items.filter(t=>{var r;return t.collapsed===!0&&((r=t.workspace)==null?void 0:r.id)}).map(t=>t.workspace.id)}function wf(e,t){const r=new Set(t);return{items:e.map(i=>({workspace:i.workspace,sessions:i.sessions,childWorktrees:i.childWorktrees,collapsed:r.has(i.workspace.id)}))}}function kP(e,t,r){return e.map(i=>{const a=bP(i.sessions);return{workspace:i.workspace,meta:i.meta,visibleSessions:a,archivedSessions:i.sessions.filter(c=>zs(c)&&!fm(c)),visibleSessionTree:uw(a,r).filter(c=>!t.has(c.item.sessionId)&&!om(Ss(c),u=>t.has(u.sessionId))),children:kP(i.children,t,r)}})}function Wg(e){return e.flatMap(t=>[t.workspace.id,...Wg(t.children)])}function Rc(e){return e.flatMap(t=>[...t.visibleSessionTree,...Rc(t.children)])}function PO(e,t){if(!t)return null;for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,visibleSessionTree:Dc(r)};const i=SP(r.childWorktrees,t);if(i)return i}return null}function xP(e,t){for(const r of e){const i=cs(r.visibleSessionTree).find(c=>c.item.sessionId===t);if(i)return i;const a=xP(r.children,t);if(a)return a}return null}function SP(e,t){for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,visibleSessionTree:r.visibleSessionTree};const i=SP(r.children,t);if(i)return i}return null}function DO(e,t){if(!t)return null;for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,archivedSessions:r.archivedSessions};const i=CP(r.childWorktrees,t);if(i)return i}return null}function $x(e,t){if(!t)return null;for(const r of e){if(r.workspace.id===t)return r.workspace;const i=jP(r.childWorktrees,t);if(i)return i}return null}function CP(e,t){for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,archivedSessions:r.archivedSessions};const i=CP(r.children,t);if(i)return i}return null}function jP(e,t){for(const r of e){if(r.workspace.id===t)return r.workspace;const i=jP(r.children,t);if(i)return i}return null}function NP(e,t){for(const r of e){if(r.workspace.id===t)return[r.workspace.id];const i=NP(r.children,t);if(i.length>0)return[r.workspace.id,...i]}return[]}function Vx(e){return e.flatMap(t=>[t.workspace.id,...TP(t.childWorktrees)])}function TP(e){return e.flatMap(t=>[t.workspace.id,...TP(t.children)])}function RO(e,t=[]){if(e.tone!=="worktree")return e.rootDisplayName;if(t.length>0)return t.join(" / ");const r=[e.rootDisplayName];return e.parentDisplayName&&e.parentDisplayName!==e.rootDisplayName&&r.push(e.parentDisplayName),r.join(" / ")}function MO(e,t,r,i){if(t===r)return e;const a=e.findIndex(f=>f.workspace.id===t),c=e.findIndex(f=>f.workspace.id===r);if(a<0||c<0)return e;const u=[...e],[d]=u.splice(a,1);if(!d)return e;const m=u.findIndex(f=>f.workspace.id===r);return m<0?e:(u.splice(i==="before"?m:m+1,0,d),u.every((f,w)=>{var g;return f.workspace.id===((g=e[w])==null?void 0:g.workspace.id)})?e:u)}function AO(e,t){if(!Array.isArray(e.items)||t.size===0)return e;let r=!1;const i=e.items.map(a=>{let c=!1;const u=a.sessions.map(m=>{const f=t.get(m.sessionId);return f===void 0||zs(m)===f?m:(r=!0,c=!0,{...m,isArchived:f})}),d=DP(a.childWorktrees??[],t,m=>{m&&(r=!0,c=!0)});return c?{...a,sessions:u,childWorktrees:d}:a});return r?{...e,items:i}:e}function EO(e,t){if(!(!Array.isArray(t.items)||e.size===0))for(const r of t.items){for(const i of r.sessions){const a=e.get(i.sessionId);a!==void 0&&zs(i)===a&&e.delete(i.sessionId)}RP(e,r.childWorktrees??[])}}function IO(e,t,r){let i=!1;const a=e.map(c=>{if(c.workspace.id!==t.workspaceId){const{nodes:m,changed:f}=MP(c.childWorktrees,t,r);return f?(i=!0,{...c,childWorktrees:m}):c}const u=c.sessions.findIndex(m=>m.sessionId===t.sessionId),d=u>=0?c.sessions.map((m,f)=>f===u?t:m):[t,...c.sessions];return i=!0,{...c,sessions:yu(d,r)}});return i?a:e}function LO(e,t,r){let i=!1;const a=e.map(c=>{let u=!1;const d=c.sessions.map(f=>f.sessionId!==t?f:(i=!0,u=!0,{...f,lastSeenAt:f.lastSeenAt&&f.lastSeenAt>r?f.lastSeenAt:r,activityState:f.activityState==="completed_unread"?"idle":f.activityState})),m=bm(c.childWorktrees,f=>f.sessionId!==t?f:(i=!0,u=!0,{...f,lastSeenAt:f.lastSeenAt&&f.lastSeenAt>r?f.lastSeenAt:r,activityState:f.activityState==="completed_unread"?"idle":f.activityState}));return u?{...c,sessions:d,childWorktrees:m}:c});return i?a:e}function Gx(e,t,r){let i=!1;const a=e.map(c=>{let u=!1;const d=c.sessions.map(f=>f.sessionId!==t||f.isArchived===r?f:(i=!0,u=!0,{...f,isArchived:r})),m=bm(c.childWorktrees,f=>f.sessionId!==t||f.isArchived===r?f:(i=!0,u=!0,{...f,isArchived:r}));return u?{...c,sessions:d,childWorktrees:m}:c});return i?a:e}function Kx(e,t,r){let i=!1;const a=e.map(c=>{let u=!1;const d=c.sessions.map(f=>f.sessionId!==t||f.isFavorite===!0===r?f:(i=!0,u=!0,{...f,isFavorite:r})),m=bm(c.childWorktrees,f=>f.sessionId!==t||f.isFavorite===!0===r?f:(i=!0,u=!0,{...f,isFavorite:r}));return u?{...c,sessions:d,childWorktrees:m}:c});return i?a:e}function FO(e,t){return e.includes(t)?e.filter(r=>r!==t):[...e,t]}function _O(e){return e?e.slice(0,8):"--"}function Yx(e,t,r){return r?e.includes(t)?e:[...e,t]:e.includes(t)?e.filter(i=>i!==t):e}function PP(e,t){const r=e.filter(i=>t.has(i));return r.length===e.length?e:r}function DP(e,t,r){return e.map(i=>{let a=!1;const c=i.sessions.map(d=>{const m=t.get(d.sessionId);return m===void 0||zs(d)===m?d:(a=!0,{...d,isArchived:m})}),u=DP(i.children,t,d=>{d&&(a=!0)});return r(a),a?{...i,sessions:c,children:u}:i})}function RP(e,t){for(const r of t){for(const i of r.sessions){const a=e.get(i.sessionId);a!==void 0&&zs(i)===a&&e.delete(i.sessionId)}RP(e,r.children)}}function MP(e,t,r){let i=!1;const a=e.map(c=>{if(c.workspace.id===t.workspaceId){const d=c.sessions.findIndex(f=>f.sessionId===t.sessionId),m=d>=0?c.sessions.map((f,w)=>w===d?t:f):[t,...c.sessions];return i=!0,{...c,sessions:yu(m,r)}}const u=MP(c.children,t,r);return u.changed?(i=!0,{...c,children:u.nodes}):c});return{nodes:i?a:[...e],changed:i}}function OO(e,t){return e.map(r=>({...r,sessions:yu(r.sessions,t),childWorktrees:ow(r.childWorktrees,t)}))}function bm(e,t){let r=!1;const i=e.map(a=>{let c=!1;const u=a.sessions.map(m=>{const f=t(m);return f!==m&&(c=!0,r=!0),f}),d=bm(a.children,t);return d!==a.children&&(c=!0,r=!0),c?{...a,sessions:u,children:d}:a});return r?i:[...e]}function Ug(e){return`workspace-management.summary.${e}`}function AP(e){return`git-sidebar.snapshot.${e}`}function EP(e,t){const r=e.repoRoot??null;return{workspaceId:e.id,name:e.name,path:e.path,git:{isRepository:!!r,repoRoot:r,currentBranch:null,commitCount:null,remotes:[],error:null},codeComposition:{scannedFileCount:0,truncated:!1,items:[],error:null}}}function IP(e,t){const r=e.git.repoRoot??t.repoRoot??null;return{...e,workspaceId:t.id,name:t.name,path:t.path,git:{...e.git,isRepository:e.git.isRepository||!!r,repoRoot:r}}}function LP(e,t){var a,c,u;const r=((a=t.status)==null?void 0:a.snapshot.repoRoot)??e.git.repoRoot,i=((c=t.status)==null?void 0:c.snapshot.branch)??((u=t.branches)==null?void 0:u.currentBranch)??e.git.currentBranch??null;return{...e,git:{...e.git,isRepository:e.git.isRepository||!!r,repoRoot:r,currentBranch:i,error:null}}}function FP({count:e,className:t="workbench-skeleton-lines"}){return n.jsx("div",{className:t,"aria-hidden":"true",children:Array.from({length:e},(r,i)=>n.jsx("span",{className:"skeleton-line"},i))})}function BO(){return n.jsx("div",{className:"workbench-nav-loading","aria-hidden":"true",children:Array.from({length:3},(e,t)=>n.jsxs("section",{className:"workbench-skeleton-card",children:[n.jsxs("div",{className:"workbench-skeleton-heading",children:[n.jsx("span",{className:"skeleton-line short"}),n.jsx("span",{className:"skeleton-line tiny"})]}),n.jsx("div",{className:"workbench-skeleton-list",children:Array.from({length:3},(r,i)=>n.jsxs("div",{className:"workbench-skeleton-session",children:[n.jsx("span",{className:"workbench-skeleton-dot"}),n.jsx(FP,{count:2,className:"workbench-skeleton-lines compact"})]},i))})]},t))})}function Ed(){return n.jsx("section",{className:"workbench-info-skeleton","aria-hidden":"true",children:Array.from({length:4},(e,t)=>n.jsxs("article",{className:"workbench-info-skeleton-card",children:[n.jsx("span",{className:"skeleton-line short"}),n.jsx(FP,{count:3})]},t))})}function WO({side:e,collapsed:t}){const r=e==="left"?8.5:15.5,i=e==="left"?t?"12 9 15 12 12 15":"15 9 12 12 15 15":t?"12 9 9 12 12 15":"9 9 12 12 9 15";return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),n.jsx("line",{x1:r,y1:"4",x2:r,y2:"20"}),n.jsx("polyline",{points:i})]})}function Xx({ariaLabel:e,side:t,collapsed:r,className:i="panel-icon-button",onClick:a}){return n.jsx("button",{className:i,type:"button","aria-label":e,title:e,onClick:a,children:n.jsx(WO,{side:t,collapsed:r})})}function Mc({expanded:e}){return n.jsx("svg",{className:e?"workbench-chevron":"workbench-chevron collapsed",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})}function UO(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),n.jsx("polyline",{points:"7 10 12 15 17 10"}),n.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function HO(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"}),n.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),n.jsx("line",{x1:"8",y1:"14",x2:"12",y2:"14"}),n.jsx("circle",{cx:"17.5",cy:"15.5",r:"2.5"})]})}function zO(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M7.5 10.2a4.5 4.5 0 1 1 9 0v3.1c0 .8.3 1.6.9 2.2l.8.8H5.8l.8-.8c.6-.6.9-1.4.9-2.2z",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M10 18.5a2 2 0 0 0 4 0",strokeLinecap:"round"})]})}function _P(e){return n.jsx("div",{className:"workbench-notification-anchor",children:n.jsxs("button",{type:"button",className:e.collapsed?"workbench-nav-toolbar-button workbench-collapsed-button":"workbench-nav-toolbar-button","aria-label":o("shell.globalNotificationsAction"),title:o("shell.globalNotificationsAction"),"aria-expanded":e.open,onClick:e.onToggle,children:[n.jsx(zO,{}),e.unreadCount>0?n.jsx("span",{className:"workbench-notification-badge","aria-label":o("shell.globalNotificationsUnreadAria",{count:String(e.unreadCount)}),children:e.unreadCount>99?"99+":e.unreadCount}):null]})})}function qO(e){const[t,r]=p.useState("notifications");p.useEffect(()=>{e.open&&r("notifications")},[e.open]);const i=p.useMemo(()=>e.notifications.filter(a=>e.showArchivedNotifications||!e.archivedNotificationIds.has(a.id)),[e.archivedNotificationIds,e.notifications,e.showArchivedNotifications]);return n.jsxs(Ln,{open:e.open,title:o("shell.globalNotificationsPanelTitle"),description:o("shell.globalNotificationsPanelDescription"),className:"workbench-notification-modal-card workspace-inbox-modal-card",showCloseButton:!1,onClose:e.onClose,children:[n.jsxs("div",{className:"workbench-notification-tabs",role:"tablist","aria-label":o("shell.globalNotificationsPanelTitle"),children:[n.jsx("button",{type:"button",className:t==="notifications"?"workbench-notification-tab active":"workbench-notification-tab",role:"tab","aria-selected":t==="notifications",onClick:()=>r("notifications"),children:o("shell.globalNotificationsAction")}),n.jsx("button",{type:"button",className:t==="inbox"?"workbench-notification-tab active":"workbench-notification-tab",role:"tab","aria-selected":t==="inbox",onClick:()=>r("inbox"),children:o("shell.butlerInboxAction")})]}),n.jsx("div",{className:"workbench-notification-content","data-tab":t,children:t==="notifications"?n.jsxs("div",{className:"workbench-notification-pane",role:"tabpanel","aria-label":o("shell.globalNotificationsAction"),children:[n.jsx("div",{className:"workbench-notification-toolbar",children:n.jsxs("label",{className:"workbench-notification-filter",children:[n.jsx("input",{type:"checkbox",checked:e.showArchivedNotifications,onChange:a=>e.onToggleShowArchivedNotifications(a.target.checked)}),n.jsx("span",{children:o("shell.globalNotificationsShowArchived")})]})}),i.length>0?n.jsx("div",{className:"workbench-notification-list",children:i.map(a=>{const c=e.archivedNotificationIds.has(a.id);return n.jsxs("article",{className:"workbench-notification-item","data-archived":c,children:[n.jsxs("button",{type:"button",className:"workbench-notification-item-content",onClick:()=>{e.onSelectNotification(a)},children:[n.jsxs("div",{className:"workbench-notification-item-header",children:[n.jsx("span",{className:"workbench-notification-item-kind",children:Q_(a.kind)}),n.jsx("time",{children:rO(a.createdAt)})]}),n.jsx("strong",{children:a.title}),n.jsx("p",{children:a.body})]}),n.jsx("div",{className:"workbench-notification-item-actions",children:n.jsx("button",{type:"button",className:"secondary-button",onClick:u=>{if(u.stopPropagation(),c){e.onUnarchiveNotification(a.id);return}e.onArchiveNotification(a.id)},children:o(c?"shell.globalNotificationsRemoveArchiveAction":"shell.globalNotificationsArchiveAction")})})]},a.id)})}):n.jsx("p",{className:"workbench-notification-empty",children:o("shell.globalNotificationsEmpty")})]}):n.jsx("div",{className:"workbench-notification-pane",role:"tabpanel","aria-label":o("shell.butlerInboxAction"),children:n.jsx(mP,{active:e.open&&t==="inbox",preferredWorkspaceId:e.preferredWorkspaceId,preferredSessionId:e.preferredSessionId})})}),n.jsx("div",{className:"workbench-modal-actions workbench-notification-footer-actions",children:n.jsx("button",{type:"button",className:"secondary-button",onClick:e.onClose,children:o("common.close")})})]})}function $O(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function VO(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("circle",{cx:"11",cy:"11",r:"7"}),n.jsx("line",{x1:"20",y1:"20",x2:"16.65",y2:"16.65"})]})}function GO(){return n.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:n.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H8l-5 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}function KO(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),n.jsx("path",{d:"M7 9l3 3-3 3"}),n.jsx("path",{d:"M13 15h4"})]})}function YO(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("rect",{x:"4",y:"5",width:"16",height:"14",rx:"3"}),n.jsx("circle",{cx:"9",cy:"11",r:"1"}),n.jsx("circle",{cx:"15",cy:"11",r:"1"}),n.jsx("path",{d:"M8 15h8"}),n.jsx("path",{d:"M12 5V3"})]})}function OP(){return n.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"15 18 9 12 15 6"})})}function BP(){return n.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function WP(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),n.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),n.jsx("polyline",{points:"14 9 11 12 14 15"})]})}function XO(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("circle",{cx:"18",cy:"6",r:"3"}),n.jsx("circle",{cx:"6",cy:"6",r:"3"}),n.jsx("circle",{cx:"18",cy:"18",r:"3"}),n.jsx("path",{d:"M6 9v6a3 3 0 0 0 3 3h3"}),n.jsx("line",{x1:"18",y1:"9",x2:"18",y2:"15"})]})}function QO(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("circle",{cx:"12",cy:"12",r:"3"}),n.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.6 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82L4.21 7.1a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 8.92 4a1.65 1.65 0 0 0 1-1.51V2.4a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9c0 .66.39 1.25 1 1.51h.09a2 2 0 0 1 0 4h-.09c-.61.26-1 .85-1 1.49z"})]})}function JO(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("rect",{x:"4",y:"5",width:"6",height:"6",rx:"1.5"}),n.jsx("rect",{x:"14",y:"5",width:"6",height:"6",rx:"1.5"}),n.jsx("rect",{x:"4",y:"13",width:"6",height:"6",rx:"1.5"}),n.jsx("path",{d:"M14 16l2 2 4-4"})]})}function ZO(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("rect",{x:"4",y:"6",width:"10",height:"12",rx:"2"}),n.jsx("path",{d:"M10 12h8"}),n.jsx("path",{d:"M15 8l4 4-4 4"})]})}function e2({selected:e}){return e?n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"}),n.jsx("path",{d:"M8 12.5l2.8 2.8L16.5 9.5"})]}):n.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"})})}function UP({active:e}){return e?n.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.5",children:n.jsx("polygon",{points:"12 3 15 9 22 10 17 15 18 22 12 18 6 22 7 15 2 10 9 9"})}):n.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:n.jsx("polygon",{points:"12 3 15 9 22 10 17 15 18 22 12 18 6 22 7 15 2 10 9 9"})})}function t2(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M3 7h18"}),n.jsx("path",{d:"M5 7l1 12h12l1-12"}),n.jsx("path",{d:"M9 11h6"}),n.jsx("path",{d:"M8 4h8l1 3H7l1-3z"})]})}function n2(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M12 20h9"}),n.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 1 1 3 3L7 19l-4 1 1-4 12.5-12.5z"})]})}function r2(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"}),n.jsx("path",{d:"M9 13h6"})]})}function i2(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("circle",{cx:"12",cy:"12",r:"9"}),n.jsx("path",{d:"M9.7 9.4a2.5 2.5 0 1 1 4.1 2c-.8.7-1.8 1.2-1.8 2.6",strokeLinecap:"round"}),n.jsx("circle",{cx:"12",cy:"17.2",r:"1",fill:"currentColor",stroke:"none"})]})}function s2({open:e,mode:t,keyword:r,codeWorkspaceId:i,codeResults:a,codeLoading:c,codeError:u,workspaceOptions:d,sessionResults:m,onClose:f,onModeChange:w,onKeywordChange:g,onCodeWorkspaceChange:v,onCodeSearch:y,onOpenSession:x}){const C=r.trim().length>0&&i.trim().length>0;return n.jsx(Ln,{open:e,title:o("shell.searchModalTitle"),description:o("shell.searchModalDescription"),onClose:f,children:n.jsxs("div",{className:"workbench-search-modal",children:[n.jsxs("div",{className:"workbench-search-mode-switch",role:"tablist","aria-label":o("shell.searchModeLabel"),children:[n.jsx("button",{type:"button",className:t==="sessions"?"workbench-search-mode-button active":"workbench-search-mode-button",role:"tab","aria-selected":t==="sessions",onClick:()=>w("sessions"),children:o("shell.searchModeSessions")}),n.jsx("button",{type:"button",className:t==="code"?"workbench-search-mode-button active":"workbench-search-mode-button",role:"tab","aria-selected":t==="code",onClick:()=>w("code"),children:o("shell.searchModeCode")})]}),t==="sessions"?n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.searchKeywordLabel")}),n.jsx("input",{type:"text",value:r,placeholder:o("shell.searchSessionPlaceholder"),autoFocus:!0,onChange:j=>g(j.target.value)})]}),n.jsx("div",{className:"workbench-search-results",children:r.trim().length===0?n.jsx("p",{className:"workbench-search-empty",children:o("shell.searchSessionHint")}):m.length>0?m.map(j=>{const N=Vs(j.session.title,o("common.unknown"));return n.jsxs("button",{type:"button",className:"workbench-search-result-item",onClick:()=>x(j.session.sessionId),children:[n.jsx("span",{className:"workbench-search-result-title",title:N.fullTitle,children:N.displayTitle}),n.jsxs("span",{className:"workbench-search-result-meta",children:[j.workspace.name," · ",gm(j.session.provider,"full")]})]},j.session.sessionId)}):n.jsx("p",{className:"workbench-search-empty",children:o("shell.searchSessionEmpty")})})]}):n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.searchWorkspaceLabel")}),n.jsx("select",{value:i,onChange:j=>v(j.target.value),children:d.map(j=>n.jsx("option",{value:j.id,children:j.name},j.id))})]}),n.jsxs("form",{className:"workbench-search-code-form",onSubmit:j=>{j.preventDefault(),y()},children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.searchKeywordLabel")}),n.jsx("input",{type:"text",value:r,placeholder:o("shell.searchCodePlaceholder"),autoFocus:!0,onChange:j=>g(j.target.value)})]}),n.jsx("button",{type:"submit",className:"primary-button",disabled:!C||c,children:o(c?"common.loading":"shell.searchSubmit")})]}),n.jsxs("div",{className:"workbench-search-results",children:[u?n.jsx("p",{className:"status-text","data-tone":"error",children:u}):null,!u&&r.trim().length===0?n.jsx("p",{className:"workbench-search-empty",children:o("shell.searchCodeHint")}):null,!u&&r.trim().length>0&&!c&&a.length===0?n.jsx("p",{className:"workbench-search-empty",children:o("shell.searchCodeEmpty")}):null,a.map(j=>n.jsxs("div",{className:"workbench-search-result-item static",children:[n.jsx("span",{className:"workbench-search-result-title",children:j.name}),n.jsx("span",{className:"workbench-search-result-meta",children:j.path})]},`${j.path}-${j.kind}`))]})]})]})})}function a2({menuKey:e,session:t,workspace:r,workspaceContext:i,isActive:a,isFavorite:c,menuOpen:u,menuAnchorPoint:d,showWorkspaceName:m,depth:f=0,showActions:w=!0,hasSubagents:g=!1,subagentListExpanded:v=!1,selectionMode:y=!1,selected:x=!1,onToggleSelect:C,onToggleSubagents:j,onOpen:N,onRename:P,onOpenContextMenu:L,onToggleFavorite:Y,onArchive:H,onCloseMenu:W}){var D;const I=Bg(t)?((D=t.subagentLabel)==null?void 0:D.trim())||o("shell.subagentBadge"):null,M=Vs(t.title,o("common.unknown")),O=vO(t),F=O?yO(O):null,X=Vc(t),U=X?XT("session-activity-badge",t):null,G=vu(t),R=iw(t),A=p.useRef(null),[Z,pe]=p.useState(null);p.useLayoutEffect(()=>{if(!u||!d||typeof window>"u"){pe(null);return}const T=()=>{var Q,_;const B=tP(d,{width:((Q=A.current)==null?void 0:Q.offsetWidth)??0,height:((_=A.current)==null?void 0:_.offsetHeight)??0},{width:window.innerWidth,height:window.innerHeight},{estimatedHeightPx:168});pe({position:"fixed",top:`${Math.round(B.top)}px`,left:`${Math.round(B.left)}px`,width:`${Math.round(B.width)}px`,maxWidth:"calc(100vw - 24px)",maxHeight:`${Math.round(B.maxHeight)}px`,transformOrigin:B.transformOrigin})};return T(),window.addEventListener("resize",T),window.addEventListener("scroll",T,!0),()=>{window.removeEventListener("resize",T),window.removeEventListener("scroll",T,!0)}},[d,u]);const q=u&&typeof document<"u"?Vn.createPortal(n.jsxs("div",{ref:A,className:"workbench-session-menu","data-menu-key":e,role:"menu","aria-label":o("shell.sessionMoreAction"),onClick:T=>T.stopPropagation(),style:Z??{position:"fixed",top:0,left:0,visibility:"hidden"},children:[n.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{P(),W()},children:[n.jsx(n2,{}),n.jsx("span",{children:o("shell.renameAction")})]}),n.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{Y(),W()},children:[n.jsx(UP,{active:c}),n.jsx("span",{children:o(c?"shell.unfavoriteAction":"shell.favoriteAction")})]}),n.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{H(),W()},children:[n.jsx(t2,{}),n.jsx("span",{children:o("shell.archiveAction")})]})]}),document.body):null;return n.jsxs("article",{className:"workbench-session-card","data-active":a,"data-depth":f,"data-subagent":Bg(t),"data-workspace-tone":i.tone,"data-worktree-depth":i.depth,"data-has-subagents":g,"data-selecting":y,"data-selected":x,style:os(i),onContextMenu:T=>{y||!w||!L||(T.preventDefault(),T.stopPropagation(),L({x:T.clientX,y:T.clientY}))},children:[n.jsxs("div",{className:"workbench-session-main",children:[y?n.jsx("span",{className:"workbench-session-selection-indicator","data-selected":x,"aria-hidden":"true",children:n.jsx(e2,{selected:x})}):g?n.jsxs("button",{type:"button",className:"workbench-session-subagent-toggle",style:xO,"data-indicator-variant":SO(t,{hasSubagents:!0,isActive:a}),"aria-label":o(v?"shell.subagentCollapse":"shell.subagentExpand"),title:o(v?"shell.subagentCollapse":"shell.subagentExpand"),"aria-expanded":v,onClick:T=>{T.stopPropagation(),j==null||j()},children:[n.jsx("span",{className:Wx(t,{hasSubagents:!0,isActive:a}),"data-activity-source":t.activitySource,"aria-hidden":"true"}),n.jsx("span",{className:"workbench-session-subagent-toggle-icon","aria-hidden":"true",children:n.jsx(Mc,{expanded:v})})]}):n.jsx("span",{className:Wx(t,{isActive:a}),"data-activity-source":t.activitySource,"aria-hidden":"true"}),n.jsx("button",{type:"button",className:"workbench-session-link",style:g?kO:void 0,"data-active":a,"aria-pressed":y?x:void 0,onClick:y?C:N,onKeyDown:T=>{if(y||!w||!L||T.key!=="ContextMenu"&&!(T.shiftKey&&T.key==="F10"))return;T.preventDefault(),T.stopPropagation();const B=T.currentTarget.getBoundingClientRect();L({x:B.right,y:B.bottom})},children:n.jsxs("div",{className:"workbench-session-link-copy",children:[n.jsxs("div",{className:"session-title-row",children:[n.jsx("span",{className:"session-title",title:M.fullTitle,children:M.displayTitle}),I?n.jsx("span",{className:"session-subagent-badge",children:I}):null,R&&G?n.jsx("span",{className:`session-fork-badge ${G}`,children:R}):null]}),n.jsxs("div",{className:"session-meta-row",children:[n.jsx("span",{className:"session-meta",children:vP(t,r,m,i.displayName)}),X&&U?n.jsx("span",{className:U,children:X}):null,n.jsx("span",{className:`session-provider-badge ${t.provider}`,children:gm(t.provider)})]}),F?n.jsx("div",{className:"session-error-row",title:O??void 0,children:n.jsx("span",{className:"session-error-text",children:F})}):null]})})]}),q]})}function Qx({workspaceGroups:e,workspaceVisualContextMap:t,sessionDisplaySortMode:r,favoriteSessions:i,favoriteSessionIds:a,activeWorkspaceId:c,isConversationActive:u,isTerminalActive:d,isButlerActive:m,isSearchOpen:f,navigationLoading:w,navigationError:g,activeSessionId:v,onRefreshNavigation:y,onSessionUpdated:x,onNavigateConversation:C,onNavigateTerminals:j,onNavigateButler:N,onOpenSearch:P,onOpenSettings:L,onSelectWorkspace:Y,onToggleWorkspaceCollapse:H,onStartWorkspaceReorder:W,onPreviewWorkspaceReorder:I,onCommitWorkspaceReorder:M,allowWorkspaceReorder:O,subscribeGitSnapshot:F,requestGitRefresh:X,subscribeWorkspaceManagementSnapshot:U,requestWorkspaceManagementRefresh:G,onToggleFavoriteSession:R,onArchiveSession:A,onUnarchiveSession:Z,workspaceManagementStateById:pe,setWorkspaceManagementStateById:q,unreadNotificationCount:D,notificationPanelOpen:T,onToggleNotificationPanel:B,onClose:Q,onToggleCollapse:_}){const de=mr(),le=pr(),{showToast:oe}=Jn(),ye=p.useCallback(K=>{!le.isDesktop||le.ui.osFamily!=="macos"||K.button!==0||Kb(K.target)&&Yb()},[le.isDesktop,le.ui.osFamily]),[Ne,Me]=p.useState(!1),[Te,Dt]=p.useState(!1),[st,dt]=p.useState(!1),[bt,pt]=p.useState([]),[we,he]=p.useState(null),[Le,Oe]=p.useState(null),[Qe,wt]=p.useState(null),[Ie,Be]=p.useState(null),[vt,ft]=p.useState(null),[ve,Ae]=p.useState(null),[et,We]=p.useState(!1),[lt,ct]=p.useState(!1),[Vt,Bt]=p.useState(""),[Wt,Lt]=p.useState(""),[Nt,ln]=p.useState(""),[Jt,Sn]=p.useState({localBranches:[],remoteBranches:[],tags:[]}),[se,He]=p.useState(!1),[xt,Tt]=p.useState(-1),[Mn,wn]=p.useState(!1),[kn,Ht]=p.useState(!1),[Gt,dn]=p.useState(null),[hn,te]=p.useState(null),[re,ue]=p.useState(null),[Se,_e]=p.useState(null),[ze,yt]=p.useState(null),[nt,Ve]=p.useState(null),[ne,je]=p.useState(bf),[ht,Rt]=p.useState({}),[tn,Kt]=p.useState({}),[$t,Zt]=p.useState([]),[Tn,Zn]=p.useState({expandedWorkspaceIds:[],collapsedWorkspaceIds:[]}),[Cn,_t]=p.useState(null),[Fn,mn]=p.useState(""),[bn,Ce]=p.useState(null),[De,mt]=p.useState(null),[Mt,en]=p.useState([]),[An,zt]=p.useState(!1),[er,fr]=p.useState({}),[Hn,ir]=p.useState(null),vr=p.useRef(null),On=p.useRef(null),Sr=p.useRef(null),Fi=p.useMemo(()=>new Set(Tn.expandedWorkspaceIds),[Tn.expandedWorkspaceIds]),_i=p.useMemo(()=>new Set(Tn.collapsedWorkspaceIds),[Tn.collapsedWorkspaceIds]),Hr=Hn!==null,sr=p.useCallback(()=>{yt(null),Ve(null)},[]),Pr=p.useCallback((K,fe)=>{yt(K),Ve(fe)},[]),un=$x(e,vt)??((ve==null?void 0:ve.id)===vt?ve:null),Jr=Nt.trim().toLowerCase(),ar=p.useMemo(()=>[{key:"localBranches",label:o("shell.createWorktreeBaseRefLocalGroup"),items:Jt.localBranches},{key:"remoteBranches",label:o("shell.createWorktreeBaseRefRemoteGroup"),items:Jt.remoteBranches},{key:"tags",label:o("shell.createWorktreeBaseRefTagGroup"),items:Jt.tags}].map(fe=>({...fe,items:fe.items.filter(Fe=>Jr?Fe.value.toLowerCase().includes(Jr):!0)})).filter(fe=>fe.items.length>0),[Jr,Jt]),ee=p.useMemo(()=>ar.flatMap(K=>K.items),[ar]),Ke=un?`create-worktree-base-ref-listbox-${un.id}`:"create-worktree-base-ref-listbox",Je=DO(e,Se),Et=Je?hi(Je.workspace):null,an=p.useMemo(()=>PO(e,De),[De,e]),on=p.useMemo(()=>an?fO(an.visibleSessionTree):[],[an]),nn=p.useMemo(()=>on.map(K=>K.sessionId),[on]),Dr=p.useMemo(()=>new Set(nn),[nn]),zr=p.useMemo(()=>new Set(Mt),[Mt]),qr=nn.length>0&&Mt.length===nn.length;p.useEffect(()=>{q(K=>{const fe=Vx(e),Fe=new Set(fe),ut={};Object.entries(K).forEach(([Ot,tr])=>{Fe.has(Ot)&&(ut[Ot]=tr)}),fe.forEach(Ot=>{const tr=$x(e,Ot);if(!tr)return;const mi=Lr(Ug(Ot),Ax),qn=Lr(AP(Ot),Ax),_r=ut[Ot];let Wi=IP((_r==null?void 0:_r.detail)??mi??EP(tr),tr);(qn!=null&&qn.status||qn!=null&&qn.branches)&&(Wi=LP(Wi,{status:qn.status??null,branches:qn.branches??null})),ut[Ot]={detail:Wi,loading:!1,error:null}});const kt=Object.keys(K),gn=Object.keys(ut);return kt.length===gn.length&&gn.every(Ot=>K[Ot]===ut[Ot])?K:ut})},[e]);const yr=p.useCallback(async K=>{await y(),await le.bridge.showNotification(o("shell.importSuccess"),K.path)},[y,le.bridge]),or=p.useCallback(async K=>{await y(),await le.bridge.showNotification(o("shell.cloneSuccess"),K.path)},[y,le.bridge]);function Dn(K){if(bt.includes(K)){pt(Fe=>Fe.filter(ut=>ut!==K));return}pt(Fe=>[...Fe,K]),F(K),X(K),U(K),G(K)}async function lr(K,fe){if(er[K])return;const Fe=(fe==null?void 0:fe.trim().toUpperCase())??null;fr(ut=>({...ut,[K]:!0}));try{await ET(K,{backgroundColor:Fe}),await y()}catch(ut){oe({title:ut instanceof Error?ut.message:o("shell.manageWorkspaceColorSaveFailed"),tone:"error"})}finally{fr(ut=>({...ut,[K]:!1}))}}async function Fr(){if(!(!we||Le)){Oe(we.id);try{await AT(we.id),pt(K=>K.filter(fe=>fe!==we.id)),q(K=>{const fe={...K};return delete fe[we.id],fe}),he(null),await y(),oe({title:o("shell.manageWorkspaceRemoveSuccess"),tone:"success"})}catch(K){oe({title:K instanceof Error?K.message:o("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{Oe(null)}}}p.useEffect(()=>{if(!ze)return;function K(fe){const Fe=fe.target;Fe instanceof HTMLElement&&Fe.closest(".workbench-session-menu")||sr()}return window.addEventListener("pointerdown",K),()=>{window.removeEventListener("pointerdown",K)}},[sr,ze]),p.useEffect(()=>{if(!De){Mt.length>0&&en([]);return}if(!an){mt(null),en([]);return}en(K=>PP(K,Dr))},[an,Dr,De,Mt.length]),p.useEffect(()=>{De&&nn.length===0&&(mt(null),en([]))},[nn.length,De]),p.useEffect(()=>{const K=new Set(Vx(e)),fe=new Set(e.flatMap(Fe=>Wg(Fe.childWorktrees)));pt(Fe=>Fe.filter(ut=>K.has(ut))),Zn(Fe=>({expandedWorkspaceIds:Fe.expandedWorkspaceIds.filter(ut=>fe.has(ut)),collapsedWorkspaceIds:Fe.collapsedWorkspaceIds.filter(ut=>fe.has(ut))})),he(Fe=>Fe&&K.has(Fe.id)?Fe:null),fr(Fe=>Object.fromEntries(Object.entries(Fe).filter(([ut,kt])=>kt&&K.has(ut))))},[e]),p.useEffect(()=>{const K=i.findIndex(fe=>fe.session.sessionId===v);je(fe=>{const Fe=Md(i.length,bf,fe,K);return Fe===fe?fe:Fe})},[v,i]),p.useEffect(()=>{Rt(K=>{const fe={};for(const Fe of e){const ut=Dc(Fe),kt=ut.findIndex(gn=>gn.item.sessionId===v||ca([gn],v??"",Ot=>Ot.sessionId).length>0);fe[Fe.workspace.id]=Md(ut.length,hc,K[Fe.workspace.id],kt);for(const gn of Rc(Fe.childWorktrees)){gn.item.sessionId===v||ca([gn],v??"",qn=>qn.sessionId).length>0;const Ot=gn.item.workspaceId;if(fe[Ot]!==void 0)continue;const tr=Rc(Fe.childWorktrees).filter(qn=>qn.item.workspaceId===Ot&&qn.depth===0),mi=tr.findIndex(qn=>qn.item.sessionId===v||ca([qn],v??"",_r=>_r.sessionId).length>0);fe[Ot]=Md(tr.length,hc,K[Ot],mi)}}return Bx(K,fe)?K:fe})},[v,e]),p.useEffect(()=>{Kt(K=>{const fe={};for(const Fe of e)for(const ut of[...Dc(Fe),...Rc(Fe.childWorktrees)])for(const kt of cs(Ss(ut))){const gn=Ss(kt);if(gn.length===0)continue;const Ot=cs(gn),tr=Ot.findIndex(mi=>mi.item.sessionId===v);fe[kt.item.sessionId]=Md(Ot.length,Rd,K[kt.item.sessionId],tr)}return Bx(K,fe)?K:fe})},[v,e]),p.useEffect(()=>{if(!v)return;const K=e.flatMap(fe=>[...ca(Dc(fe),v,Fe=>Fe.sessionId),...Rc(fe.childWorktrees).flatMap(Fe=>ca([Fe],v,ut=>ut.sessionId))]);K.length!==0&&Zt(fe=>{const Fe=new Set(fe);let ut=!1;for(const kt of K)Fe.has(kt)||(Fe.add(kt),ut=!0);return ut?Array.from(Fe):fe})},[v,e]),p.useEffect(()=>{if(!c)return;const K=[];for(const fe of e){const Fe=NP(fe.childWorktrees,c);Fe.length!==0&&K.push(...Fe)}K.length>0&&Zn(fe=>{const Fe=new Set(fe.expandedWorkspaceIds);let ut=!1;for(const kt of K)Fe.has(kt)||(Fe.add(kt),ut=!0);return ut?{expandedWorkspaceIds:Array.from(Fe),collapsedWorkspaceIds:fe.collapsedWorkspaceIds}:fe})},[c,e]),p.useEffect(()=>{if(!vt){Ae(null),We(!1),ct(!1),Bt(""),Lt(""),ln(""),He(!1),Tt(-1),wn(!1),Sn({localBranches:[],remoteBranches:[],tags:[]}),Ht(!1),dn(null);return}We(!1),Bt(""),Lt(""),ln(""),He(!1),Tt(-1),wn(!1),Sn({localBranches:[],remoteBranches:[],tags:[]}),Ht(!1),dn(null)},[vt]),p.useEffect(()=>{const K=un;if(!et||!K)return;let fe=!1;const Fe=K.id;return Ht(!0),dn(null),Promise.all([HT(Fe),SF(Fe)]).then(([ut,kt])=>{fe||Sn(eO(ut,kt))}).catch(()=>{fe||(Sn({localBranches:[],remoteBranches:[],tags:[]}),dn(o("shell.createWorktreeBaseRefLoadFailed")))}).finally(()=>{fe||Ht(!1)}),()=>{fe=!0}},[un==null?void 0:un.id,et]),p.useLayoutEffect(()=>{if(!se||!vr.current){te(null),ue(null);return}const K=()=>{const Fe=vr.current;if(!Fe)return;const ut=tO(Fe);te({top:ut.bottom+8,left:ut.left,width:ut.width})};K();const fe=Fe=>{var kt,gn;const ut=Fe.target;ut instanceof Node&&((kt=vr.current)!=null&&kt.contains(ut)||(gn=On.current)!=null&&gn.contains(ut)||(He(!1),Tt(-1)))};return window.addEventListener("resize",K),window.addEventListener("scroll",K,!0),window.addEventListener("pointerdown",fe),()=>{window.removeEventListener("resize",K),window.removeEventListener("scroll",K,!0),window.removeEventListener("pointerdown",fe)}},[ee.length,se]),p.useLayoutEffect(()=>{if(!se||!On.current){ue(null);return}const K=On.current,fe=()=>{const ut=Math.ceil(K.getBoundingClientRect().height);ue(kt=>kt===ut?kt:ut)};if(fe(),typeof ResizeObserver>"u")return;const Fe=new ResizeObserver(()=>{fe()});return Fe.observe(K),()=>{Fe.disconnect()}},[se,ar,kn,Gt]);function Ut(){Me(!0)}function Yr(){Dt(!0)}function $(){We(!1),Bt(""),Lt(""),ln(""),He(!1),Tt(-1),wn(!1)}function me(K,fe){const Fe=K.getBoundingClientRect();return fe<=Fe.top+Fe.height/2?"before":"after"}function ge(){Sr.current!==null&&(cancelAnimationFrame(Sr.current),Sr.current=null),ir(null)}function Ye(K,fe){K.dataTransfer.effectAllowed="move",K.dataTransfer.setData("text/plain",fe),W(),Sr.current!==null&&cancelAnimationFrame(Sr.current),Sr.current=requestAnimationFrame(()=>{Sr.current=null,ir(fe)})}function Ge(K,fe){const Fe=Hn||K.dataTransfer.getData("text/plain");!Fe||Fe===fe||(K.preventDefault(),K.dataTransfer.dropEffect="move",I(Fe,fe,me(K.currentTarget,K.clientY)))}function gt(K){K.preventDefault()}function cn(){ge(),M()}function jn(K){return tn[K]??Rd}function zn(K){return $t.includes(K)}function Zr(K){return ht[K]??hc}function Gi(){je(K=>Math.min(i.length,K+bf))}function kr(K,fe){Rt(Fe=>({...Fe,[K]:Math.min(fe,(Fe[K]??hc)+hc)}))}function li(K){Kt(fe=>({...fe,[K]:(fe[K]??Rd)+Rd}))}function ci(K){Zt(fe=>fe.includes(K)?fe.filter(Fe=>Fe!==K):[...fe,K])}function Bn(K,fe){return _i.has(K)?!1:fe||Fi.has(K)}function ei(K,fe){const Fe=!Bn(K,fe);Zn(ut=>{const kt=ut.expandedWorkspaceIds.filter(Ot=>Ot!==K),gn=ut.collapsedWorkspaceIds.filter(Ot=>Ot!==K);return Fe?{expandedWorkspaceIds:[...kt,K],collapsedWorkspaceIds:gn}:{expandedWorkspaceIds:kt,collapsedWorkspaceIds:[...gn,K]}})}function ui(K){for(const fe of e){const Fe=cs(uw(fe.visibleSessions,r)).find(ut=>ut.item.sessionId===K)??xP(fe.childWorktrees,K);if(Fe)return Ss(Fe)}return[]}function Ki(K,fe){const Fe=hi(K);return n.jsxs("button",{type:"button",className:"workbench-archive-folder","data-workspace-tone":Fe.tone,style:os(Fe),onClick:()=>_e(K.id),children:[n.jsxs("span",{className:"workbench-archive-folder-main",children:[n.jsx(r2,{}),n.jsx("span",{children:o("shell.archiveFolderLabel")})]}),n.jsx("span",{className:"workbench-section-counter",children:fe.length})]})}function Oi(){return n.jsxs("div",{className:"workbench-workspace-batch-toolbar",children:[n.jsx("span",{className:"workbench-workspace-batch-label",children:o("shell.batchSelectionMode")}),n.jsxs("span",{className:"workbench-workspace-batch-counter",children:[Mt.length,"/",nn.length]}),n.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:Bi,children:o(qr?"shell.clearSelectedSessions":"shell.selectAllSessions")}),n.jsx("button",{type:"button",className:"workbench-workspace-batch-action primary",disabled:Mt.length===0||An,onClick:()=>{Rs()},children:o(An?"shell.batchArchiving":"shell.batchArchiveAction")}),n.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:ot,children:o("common.cancel")})]})}function Ks(K,fe="workbench-workspace-actions"){return n.jsxs("div",{className:fe,children:[n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.switchWorkspace"),title:o("shell.switchWorkspace"),"aria-pressed":c===K,onClick:()=>{Y(K),Q==null||Q()},children:n.jsx(ZO,{})}),n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.batchSelectSessions"),title:o("shell.batchSelectSessions"),onClick:()=>at(K),children:n.jsx(JO,{})}),n.jsx("button",{type:"button",className:"workbench-workspace-icon-button workbench-workspace-create","aria-label":o("shell.createSession"),title:o("shell.createSession"),onClick:()=>ft(K),children:n.jsx($O,{})})]})}function V(K){const fe=K.visibleSessionTree,ut=new Set(Wg(K.children)).has(c??""),kt=K.workspace.id===c||ut,gn=Hr||!Bn(K.workspace.id,kt),Ot=hi(K.workspace);return n.jsxs("section",{className:"workbench-workspace-group","data-worktree-node":"true","data-batch-active":De===K.workspace.id,"data-worktree-depth":K.meta.depth,"data-workspace-tone":"worktree",style:os(Ot),children:[n.jsxs("div",{className:"workbench-workspace-header minimal",children:[n.jsxs("button",{type:"button",className:"workbench-workspace-toggle","aria-label":o(gn?"shell.worktreeExpand":"shell.worktreeCollapse"),onClick:()=>ei(K.workspace.id,kt),children:[n.jsx("span",{className:"workbench-workspace-toggle-icon","aria-hidden":"true",children:n.jsx(Mc,{expanded:!gn})}),n.jsxs("span",{children:[n.jsx("strong",{children:K.meta.displayName||K.workspace.name}),n.jsx("span",{className:"session-meta",children:K.meta.branchName})]})]}),De===K.workspace.id?Oi():Ks(K.workspace.id)]}),gn?null:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"workbench-session-list","data-workspace-tone":Ot.tone,style:os(Ot),children:[fe.length===0?n.jsx("p",{className:"workbench-session-empty",children:o("shell.emptyWorkspaceSessions")}):fe.slice(0,Zr(K.workspace.id)).map(tr=>be({node:tr,workspace:K.workspace,workspaceContext:Ot,menuKeyPrefix:`worktree:${K.workspace.id}`,showWorkspaceName:!1,selectionMode:De===K.workspace.id,favoriteEnabled:!0})),fe.length>Zr(K.workspace.id)?n.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>kr(K.workspace.id,fe.length),children:o("shell.sessionExpandMore")}):null]}),K.children.length>0?n.jsx("div",{className:"workbench-session-list workbench-worktree-child-list",children:K.children.map(tr=>V(tr))}):null,Ki(K.workspace,K.archivedSessions)]})]},K.workspace.id)}function be(K){const{node:fe,workspace:Fe,workspaceContext:ut,menuKeyPrefix:kt,showWorkspaceName:gn,selectionMode:Ot,favoriteEnabled:tr,ancestorExpanded:mi=!1,allowToggle:qn=fe.depth===0,ancestorHasNextSiblings:_r=[],hasNextSibling:Wi=!1,isFirstSibling:Yi=!1}=K,Gn=fe.item,Ms=Ss(fe),Xi=mi||zn(Gn.sessionId),$n=Xi&&qn,Bo=$n?gO(fe,jn(Gn.sessionId),r):fe,ba=Xi?Ss(Bo):[],Wo=cs(Ms).length,Uo=cs(ba).length,wa=$n&&Uo<Wo,z=fe.depth>0?[..._r,Wi]:[..._r];return n.jsxs("div",{className:"workbench-session-tree-node",children:[n.jsxs("div",{className:"workbench-session-tree-row",style:{"--workbench-session-tree-depth":fe.depth},children:[fe.depth>0?n.jsxs("div",{className:"workbench-session-tree-guides","aria-hidden":"true",children:[_r.map((ie,Re)=>ie?n.jsx("span",{className:"workbench-session-tree-guide-column",style:{"--workbench-session-tree-level":Re+1}},`${Gn.sessionId}:ancestor:${Re}`):null),n.jsx("span",{className:"workbench-session-tree-guide-branch","data-continue":Wi,"data-first":Yi,style:{"--workbench-session-tree-level":fe.depth},children:n.jsx("span",{className:"workbench-session-tree-guide-branch-horizontal"})})]}):null,n.jsx(a2,{menuKey:`${kt}:${Gn.sessionId}`,session:Gn,workspace:Fe,workspaceContext:ut,isActive:Gn.sessionId===v,isFavorite:tr&&a.has(Gn.sessionId),menuOpen:ze===`${kt}:${Gn.sessionId}`,showWorkspaceName:gn,depth:fe.depth,showActions:tr,hasSubagents:qn&&Ms.length>0,subagentListExpanded:Xi,selectionMode:Ot,selected:zr.has(Gn.sessionId),onToggleSelect:()=>qt(Gn.sessionId),onToggleSubagents:()=>ci(Gn.sessionId),onOpen:()=>{de(Nr(Fe.id,Gn.sessionId)),Q==null||Q()},onRename:()=>ga(Gn,Fe),menuAnchorPoint:ze===`${kt}:${Gn.sessionId}`?nt:null,onOpenContextMenu:ie=>Pr(`${kt}:${Gn.sessionId}`,ie),onToggleFavorite:()=>Ds(Gn.sessionId),onArchive:()=>fa(Gn.sessionId),onCloseMenu:sr})]}),Ms.length>0&&Xi?n.jsxs("div",{className:"workbench-subsession-list",children:[ba.map((ie,Re)=>be({node:ie,workspace:Fe,workspaceContext:ut,menuKeyPrefix:kt,showWorkspaceName:gn,selectionMode:Ot,favoriteEnabled:tr,ancestorExpanded:!0,allowToggle:!1,ancestorHasNextSiblings:z,hasNextSibling:Re<ba.length-1,isFirstSibling:Re===0})),wa?n.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>li(Gn.sessionId),children:o("shell.subagentExpandMore")}):null]}):null]},Gn.sessionId)}function at(K){sr(),mt(K),en([])}function ot(){mt(null),en([])}function qt(K){en(fe=>FO(fe,K))}function Bi(){en(K=>K.length===nn.length?[]:nn)}async function di(K,fe){wt(K),Be(fe);try{await fP(K,fe),ft(null),de(hT(K,fe)),Q==null||Q()}catch(Fe){oe({title:Fe instanceof Error?Fe.message:o("shell.startSessionFailed"),tone:"error"})}finally{wt(null),Be(null)}}async function pa(K){if(K.preventDefault(),!un||lt)return;const fe=Vt.trim(),Fe=Wt.trim(),ut=Nt.trim();if(!fe){oe({title:o("shell.createWorktreeBranchRequired"),tone:"error"});return}if(!J_(fe)){oe({title:o("shell.createWorktreeBranchInvalid"),tone:"error"});return}ct(!0);try{const kt=await nF({sourceWorkspaceId:un.id,branchName:fe,displayName:Fe||void 0,baseRef:ut||void 0});Ae(kt.workspace),Y(kt.workspace.id),await y(),ft(kt.workspace.id),$(),oe({title:o("shell.createWorktreeSucceeded",{name:kt.meta.displayName||kt.workspace.name}),tone:"success"})}catch(kt){oe({title:kt instanceof Error?kt.message:o("shell.createWorktreeFailed"),tone:"error"})}finally{ct(!1)}}async function Ds(K){const fe=a.has(K);sr();try{await R(K),oe({title:o(fe?"shell.favoriteRemoved":"shell.favoriteAdded"),tone:"success"})}catch(Fe){oe({title:Fe instanceof Error?Fe.message:o("shell.favoriteToggleFailed"),tone:"error"})}}async function fa(K){sr();try{await A(K),oe({title:o("shell.archiveAdded"),tone:"success"})}catch(fe){oe({title:fe instanceof Error?fe.message:o("shell.navigationLoadFailed"),tone:"error"})}}async function Rs(){if(!(Mt.length===0||An)){sr(),zt(!0);try{const K=[...Mt],fe=await Promise.allSettled(K.map(async kt=>({sessionId:kt,session:await FT(kt,!0)}))),Fe=[];let ut=0;for(const kt of fe){if(kt.status==="fulfilled"){Fe.push(kt.value.sessionId),x(kt.value.session);continue}ut+=1}Fe.length>0&&(await y(),en(kt=>kt.filter(gn=>!Fe.includes(gn)))),ut>0?oe({title:Fe.length>0?o("shell.batchArchivePartialFailed"):o("shell.batchArchiveFailed"),tone:"error"}):oe({title:o("shell.batchArchiveSuccess"),tone:"success"})}catch(K){oe({title:K instanceof Error?K.message:o("shell.batchArchiveFailed"),tone:"error"})}finally{zt(!1)}}}async function Ys(K){sr();try{await Z(K),oe({title:o("shell.archiveRestored"),tone:"success"})}catch(fe){oe({title:fe instanceof Error?fe.message:o("shell.navigationLoadFailed"),tone:"error"})}}function ga(K,fe){sr(),_t({session:K,workspace:fe}),mn(K.title)}async function Lo(K){if(K.preventDefault(),!Cn)return;const fe=Fn.trim();if(fe){Ce(Cn.session.sessionId);try{const Fe=await LT(Cn.session.sessionId,fe);x(Fe),_t(null),mn(""),oe({title:o("shell.renameSuccess"),tone:"success"})}catch(Fe){oe({title:Fe instanceof Error?Fe.message:o("shell.renameFailed"),tone:"error"})}finally{Ce(null)}}}const Fo=i.slice(0,ne),_o=Fo.length<i.length;function hi(K){return t[K.id]??ku(K)}function Oo(K,fe,Fe,ut,kt=[]){var Xi;const gn=bt.includes(K.id),Ot=pe[K.id]??{detail:null,loading:!1,error:null},tr=Le===K.id,mi=er[K.id]===!0,qn=(Xi=Ot.detail)!=null&&Xi.git.remotes.length?Ot.detail.git.remotes.map($n=>`${$n.name}: ${$n.url}`).join(" · "):o("shell.manageWorkspaceNoRemote"),_r=Ot.detail?ZT(Ot.detail.codeComposition.items,o("shell.manageWorkspaceCodeCompositionOther")):[],Wi=_r.length>0?eP(_r):void 0,Yi=hi(K),Gn=RO(Yi,kt),Ms=[...kt,Yi.displayName];return n.jsxs("article",{className:"workbench-manage-item","data-workspace-tone":Yi.tone,"data-worktree-node":ut,style:os(Yi),children:[n.jsxs("button",{type:"button",className:"workbench-manage-item-toggle","aria-expanded":gn,onClick:()=>Dn(K.id),children:[n.jsxs("span",{className:"workbench-manage-item-heading",children:[n.jsx(Mc,{expanded:gn}),n.jsxs("span",{className:"workbench-manage-item-heading-copy",children:[n.jsx("strong",{children:Yi.displayName}),n.jsx("span",{className:"workbench-manage-item-tree-path",children:Gn})]})]}),n.jsx("span",{className:"workbench-section-counter",children:fe})]}),gn?n.jsxs("div",{className:"workbench-manage-item-body",children:[n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspacePathLabel")}),n.jsx("p",{className:"workbench-manage-detail-value",children:K.path})]}),ut?n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsxs("div",{className:"workbench-manage-detail-header",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspaceColorLabel")}),n.jsxs("div",{className:"workbench-manage-color-actions",children:[n.jsx("div",{className:"workbench-manage-color-palette","aria-label":o("shell.manageWorkspaceColorLabel"),children:G_.map($n=>n.jsx("button",{type:"button",className:"workbench-manage-color-swatch","aria-label":o("shell.manageWorkspaceColorSelectSwatch",{color:$n}),"aria-pressed":K.backgroundColor===$n,disabled:mi,"data-selected":K.backgroundColor===$n,style:{backgroundColor:$n},onClick:()=>{lr(K.id,$n)}},$n))}),n.jsx("button",{type:"button",className:"ghost-button",disabled:mi||!K.backgroundColor,onClick:()=>{lr(K.id,null)},children:o("shell.manageWorkspaceColorClearAction")})]})]}),n.jsx("p",{className:"workbench-manage-hint",children:K.backgroundColor??o("shell.manageWorkspaceColorUnset")})]}):null,Ot.loading&&Ot.detail===null?n.jsx("p",{className:"workbench-manage-status status-text",children:o("shell.manageWorkspaceLoading")}):null,Ot.error?n.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:Ot.error}):null,Ot.detail?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"workbench-manage-detail-block",children:n.jsxs("div",{className:"workbench-manage-detail-header",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspaceGitCommitCount")}),n.jsx("strong",{className:"workbench-manage-detail-accent",children:Ot.detail.git.commitCount??"--"})]})}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspaceGitInfoLabel")}),Ot.detail.git.isRepository?n.jsxs("div",{className:"workbench-manage-kv-list",children:[n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.manageWorkspaceRepoRoot")}),n.jsx("span",{children:Ot.detail.git.repoRoot??"--"})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.manageWorkspaceCurrentBranch")}),n.jsx("span",{children:Ot.detail.git.currentBranch??"--"})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.manageWorkspaceRemoteLabel")}),n.jsx("span",{children:qn})]})]}):n.jsx("p",{className:"workbench-section-empty",children:Ot.detail.git.error??o("shell.manageWorkspaceNotGit")})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspaceCodeCompositionLabel")}),_r.length>0?n.jsxs("div",{className:"workbench-manage-type-chart",children:[n.jsxs("div",{className:"workbench-manage-type-chart-ring",style:Wi,"aria-hidden":"true",children:[n.jsx("strong",{className:"workbench-manage-type-chart-total",children:Ot.detail.codeComposition.scannedFileCount}),n.jsx("span",{className:"workbench-manage-type-chart-caption",children:o("shell.manageWorkspaceCodeCompositionFiles")})]}),n.jsx("div",{className:"workbench-manage-type-list",children:_r.map($n=>n.jsxs("div",{className:"workbench-manage-type-item",children:[n.jsxs("span",{className:"workbench-manage-type-meta",children:[n.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:$n.color},"aria-hidden":"true"}),n.jsx("span",{className:"workbench-manage-type-name",children:$n.type})]}),n.jsxs("span",{children:[$n.count," · ",JT($n)]})]},$n.key))})]}):n.jsx("p",{className:"workbench-section-empty",children:Ot.detail.codeComposition.error??o("shell.manageWorkspaceNoCodeComposition")}),Ot.detail.codeComposition.truncated?n.jsx("p",{className:"workbench-manage-hint",children:o("shell.manageWorkspaceCodeTruncated",{count:Ot.detail.codeComposition.scannedFileCount})}):null]})]}):null,n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{dt(!1),de(FI(K.id))},children:o("shell.workspaceDetailDebugOpenPageAction")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!Le,onClick:()=>he(K),children:o(tr?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})]})]}):null,Fe.length>0?n.jsx("div",{className:"workbench-manage-children",children:Fe.map($n=>Oo($n.workspace,$n.visibleSessions.length+$n.archivedSessions.length,$n.children,!0,Ms))}):null]},K.id)}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"workbench-nav-header","data-window-drag-handle":"workbench-nav-header",onMouseDownCapture:ye,children:n.jsxs("div",{className:"workbench-nav-toolbar",children:[_?n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":o("shell.hideSessionSidebar"),title:o("shell.hideSessionSidebar"),onClick:_,children:n.jsx(WP,{})}):null,n.jsx(dP,{}),n.jsx(_P,{unreadCount:D,open:T,onToggle:B}),n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":o("shell.goBack"),title:o("shell.goBack"),onClick:()=>de(-1),children:n.jsx(OP,{})}),n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":o("shell.goForward"),title:o("shell.goForward"),onClick:()=>de(1),children:n.jsx(BP,{})})]})}),n.jsxs("div",{className:"workbench-nav-body",children:[n.jsxs("div",{className:"workbench-nav-segment",role:"tablist","aria-label":o("shell.centerTabsLabel"),children:[n.jsxs("button",{type:"button",className:u?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":u,onClick:C,children:[n.jsx(GO,{}),o("shell.conversationEntry")]}),n.jsxs("button",{type:"button",className:d?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":d,onClick:j,children:[n.jsx(KO,{}),o("shell.terminalsEntry")]}),n.jsxs("button",{type:"button",className:m?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":m,onClick:N,children:[n.jsx(YO,{}),o("shell.butlerEntry")]}),n.jsxs("button",{type:"button",className:"workbench-nav-segment-button","data-open":f,"aria-haspopup":"dialog","aria-expanded":f,onClick:P,children:[n.jsx(VO,{}),n.jsx("span",{children:o("shell.searchEntry")})]})]}),g?n.jsx("div",{className:"workbench-status-row",children:n.jsx("p",{className:"status-text","data-tone":"error",children:g})}):null,i.length>0?n.jsxs("section",{className:"workbench-section-block",children:[n.jsxs("div",{className:"workbench-section-heading",children:[n.jsxs("div",{className:"workbench-section-heading-main",children:[n.jsx(UP,{active:!0}),n.jsx("span",{children:o("shell.favoriteSectionTitle")})]}),n.jsx("span",{className:"workbench-section-counter",children:i.length})]}),n.jsxs("div",{className:"workbench-session-list",children:[Fo.map(K=>{const fe=ui(K.session.sessionId);return n.jsx("div",{children:be({node:{item:K.session,depth:0,children:fe},workspace:K.workspace,workspaceContext:hi(K.workspace),menuKeyPrefix:"favorite",showWorkspaceName:!0,selectionMode:!1,favoriteEnabled:!0})},K.session.sessionId)}),_o?n.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:Gi,children:o("shell.favoriteExpandMore")}):null]})]}):null,w&&e.length===0?n.jsx(BO,{}):null,!w&&!g&&e.length===0?n.jsx("div",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("shell.emptyNavigationBody")})}):null,n.jsxs("section",{className:"workbench-section-block workbench-workspace-section",children:[n.jsxs("div",{className:"workbench-section-heading",children:[n.jsx("div",{className:"workbench-section-heading-main",children:n.jsx("span",{children:o("shell.workspaceSectionTitle")})}),n.jsxs("div",{className:"workbench-section-actions",children:[n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.manageWorkspaceAction"),title:o("shell.manageWorkspaceAction"),onClick:()=>dt(!0),children:n.jsx(HO,{})}),n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.importWorkspaceTitle"),title:o("shell.importWorkspaceTitle"),onClick:Ut,children:n.jsx(UO,{})}),n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.cloneWorkspaceTitle"),title:o("shell.cloneWorkspaceTitle"),onClick:Yr,children:n.jsx(XO,{})})]})]}),e.map(K=>{const fe=Dc(K),Fe=Hn===K.workspace.id,ut=K.isCollapsed||Hr;return n.jsxs("section",{className:"workbench-workspace-group","data-batch-active":De===K.workspace.id,"data-dragging":Fe,onDragOver:kt=>Ge(kt,K.workspace.id),onDrop:gt,children:[n.jsxs("div",{className:"workbench-workspace-header minimal",children:[n.jsxs("button",{type:"button",className:"workbench-workspace-toggle","aria-label":o(ut?"shell.workspaceExpand":"shell.workspaceCollapse"),draggable:O,onClick:()=>H(K.workspace.id),onDragStart:O?kt=>Ye(kt,K.workspace.id):void 0,onDragEnd:O?cn:void 0,"data-reorder-enabled":O?"true":void 0,children:[n.jsx("span",{className:"workbench-workspace-toggle-icon","aria-hidden":"true",children:n.jsx(Mc,{expanded:!ut})}),n.jsx("strong",{children:K.workspace.name})]}),De===K.workspace.id?Oi():Ks(K.workspace.id)]}),ut?null:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"workbench-session-list",children:[fe.length===0?n.jsx("p",{className:"workbench-session-empty",children:o("shell.emptyWorkspaceSessions")}):fe.slice(0,Zr(K.workspace.id)).map(kt=>be({node:kt,workspace:K.workspace,workspaceContext:hi(K.workspace),menuKeyPrefix:`workspace:${K.workspace.id}`,showWorkspaceName:!1,selectionMode:De===K.workspace.id,favoriteEnabled:!0})),fe.length>Zr(K.workspace.id)?n.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>kr(K.workspace.id,fe.length),children:o("shell.sessionExpandMore")}):null]}),K.childWorktrees.length>0?n.jsx("div",{className:"workbench-session-list workbench-worktree-child-list",children:K.childWorktrees.map(kt=>V(kt))}):null,Ki(K.workspace,K.archivedSessions)]})]},K.workspace.id)})]})]}),n.jsx("div",{className:"workbench-nav-footer minimal",children:n.jsxs("button",{className:"settings-entry-button workbench-nav-settings-button",type:"button",onClick:L,title:o("settings.title"),children:[n.jsx(QO,{}),n.jsx("span",{className:"settings-entry-label",children:o("settings.title")})]})}),n.jsx(Ln,{open:st,title:o("shell.manageWorkspaceTitle"),description:o("shell.manageWorkspaceDescription"),onClose:()=>{Le||dt(!1)},children:e.length>0?n.jsx("div",{className:"workbench-manage-list",children:e.map(K=>Oo(K.workspace,K.visibleSessions.length+K.archivedSessions.length,K.childWorktrees,!1))}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.manageWorkspaceEmpty")})}),n.jsxs(Ln,{open:we!==null,title:o("shell.manageWorkspaceRemoveConfirmTitle"),description:o("shell.manageWorkspaceRemoveConfirmDescription"),onClose:()=>{Le||he(null)},children:[n.jsx("p",{className:"workbench-section-empty",children:we?o("shell.manageWorkspaceRemoveConfirmTarget",{name:we.name}):""}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:!!Le,onClick:()=>he(null),children:o("common.cancel")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!Le,onClick:()=>{Fr()},children:o(Le?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveConfirmAction")})]})]}),n.jsx(hP,{open:Te,onClose:()=>Dt(!1),onCloned:or}),n.jsx(pP,{open:Ne,onClose:()=>Me(!1),onImported:yr}),n.jsx(Ln,{open:un!==null,title:o("shell.createSessionModalTitle"),className:"workbench-create-session-modal",description:un?`${o("shell.createSessionTarget")} · ${un.name}`:o("shell.createSessionModalDescription"),headerActions:n.jsx("button",{type:"button",className:"secondary-button create-session-worktree-trigger",disabled:lt||!!Qe,onClick:()=>We(!0),children:o("shell.createWorktreeAction")}),onClose:()=>ft(null),children:n.jsxs("section",{className:"create-session-modal-section",children:[n.jsxs("div",{className:"create-session-modal-section-header",children:[n.jsx("strong",{children:o("shell.createSessionProviderLabel")}),n.jsx("span",{children:o("shell.providerOptionHint")})]}),n.jsx(cw,{disabled:!!Qe||lt,workspaceId:(un==null?void 0:un.id)??null,pendingProvider:Qe===(un==null?void 0:un.id)?Ie??null:null,onSelect:K=>{un&&di(un.id,K)}})]})}),n.jsx(Ln,{open:un!==null&&et,title:o("shell.createWorktreeAction"),className:"workbench-create-worktree-modal",headerActions:n.jsx("button",{type:"button",className:Mn?"workbench-modal-help-button active":"workbench-modal-help-button","aria-label":o("shell.createWorktreeHelpAction"),title:o("shell.createWorktreeHelpAction"),"aria-pressed":Mn,onClick:()=>wn(K=>!K),children:n.jsx(i2,{})}),description:un?`${o("shell.createWorktreeSectionDescription")} ${o("shell.createSessionTarget")} · ${un.name}`:o("shell.createWorktreeSectionDescription"),onClose:$,children:n.jsxs("form",{className:"create-session-worktree-form",onSubmit:pa,children:[Mn?n.jsxs("section",{className:"create-session-worktree-help-card","aria-label":o("shell.createWorktreeHelpTitle"),children:[n.jsx("strong",{children:o("shell.createWorktreeHelpTitle")}),n.jsxs("div",{className:"create-session-worktree-help-grid",children:[n.jsxs("article",{children:[n.jsx("h3",{children:o("shell.createWorktreeHelpBranchTitle")}),n.jsx("p",{children:o("shell.createWorktreeHelpBranchBody")})]}),n.jsxs("article",{children:[n.jsx("h3",{children:o("shell.createWorktreeHelpDisplayNameTitle")}),n.jsx("p",{children:o("shell.createWorktreeHelpDisplayNameBody")})]}),n.jsxs("article",{children:[n.jsx("h3",{children:o("shell.createWorktreeHelpBaseRefTitle")}),n.jsx("p",{children:o("shell.createWorktreeHelpBaseRefBody")})]})]})]}):null,n.jsxs("label",{className:"create-session-worktree-field",children:[n.jsx("span",{children:o("shell.createWorktreeBranchLabel")}),n.jsx("input",{className:"settings-text-input",value:Vt,placeholder:o("shell.createWorktreeBranchPlaceholder"),onChange:K=>{const fe=K.target.value;Z_(fe)&&Bt(fe)}})]}),n.jsxs("label",{className:"create-session-worktree-field",children:[n.jsx("span",{children:o("shell.createWorktreeDisplayNameLabel")}),n.jsx("input",{className:"settings-text-input",value:Wt,placeholder:o("shell.createWorktreeDisplayNamePlaceholder"),onChange:K=>Lt(K.target.value)})]}),n.jsxs("label",{className:"create-session-worktree-field",children:[n.jsx("span",{children:o("shell.createWorktreeBaseRefLabel")}),n.jsx("div",{className:"create-session-worktree-combobox",ref:vr,onBlurCapture:K=>{var Fe,ut;const fe=K.relatedTarget;fe instanceof Node&&((Fe=vr.current)!=null&&Fe.contains(fe)||(ut=On.current)!=null&&ut.contains(fe))||(He(!1),Tt(-1))},children:n.jsxs("div",{className:"create-session-worktree-combobox-input-wrap",children:[n.jsx("input",{className:"settings-text-input create-session-worktree-combobox-input",role:"combobox","aria-autocomplete":"list","aria-expanded":se,"aria-controls":Ke,value:Nt,placeholder:o("shell.createWorktreeBaseRefPlaceholder"),onFocus:()=>{He(!0),Tt(ee.length>0?0:-1)},onChange:K=>{ln(K.target.value),He(!0),Tt(ee.length>0?0:-1)},onKeyDown:K=>{if(K.key==="ArrowDown"){if(K.preventDefault(),!se){He(!0);return}ee.length>0&&Tt(fe=>fe>=ee.length-1?0:fe+1);return}if(K.key==="ArrowUp"){if(K.preventDefault(),!se){He(!0);return}ee.length>0&&Tt(fe=>fe<=0?ee.length-1:fe-1);return}if(K.key==="Enter"&&se&&xt>=0){K.preventDefault();const fe=ee[xt];fe&&(ln(fe.value),He(!1),Tt(-1));return}K.key==="Escape"&&He(!1)}}),n.jsx("button",{type:"button",className:"create-session-worktree-combobox-toggle","aria-label":o("shell.createWorktreeBaseRefToggle"),"aria-expanded":se,onClick:()=>{He(K=>!K),Tt(!se&&ee.length>0?0:-1)},children:n.jsx(Mc,{expanded:se})})]})}),n.jsx("span",{className:"create-session-worktree-field-hint",children:kn?o("shell.createWorktreeBaseRefLoading"):Gt||o("shell.createWorktreeBaseRefHint",{localCount:Jt.localBranches.length,remoteCount:Jt.remoteBranches.length,tagCount:Jt.tags.length})})]}),se&&hn&&typeof document<"u"?Vn.createPortal(n.jsxs("div",{className:"create-session-worktree-combobox-floating-layer",children:[n.jsx("div",{className:"create-session-worktree-combobox-floating-backdrop",style:{"--create-worktree-combobox-top":`${hn.top}px`,"--create-worktree-combobox-left":`${hn.left}px`,"--create-worktree-combobox-width":`${hn.width}px`,"--create-worktree-combobox-height":`${re??0}px`}}),n.jsx("div",{ref:On,className:"create-session-worktree-combobox-popover floating",style:{"--create-worktree-combobox-top":`${hn.top}px`,"--create-worktree-combobox-left":`${hn.left}px`,"--create-worktree-combobox-width":`${hn.width}px`},children:kn?n.jsx("p",{className:"create-session-worktree-combobox-empty",children:o("shell.createWorktreeBaseRefLoading")}):Gt?n.jsx("p",{className:"create-session-worktree-combobox-empty",children:Gt}):ar.length>0?n.jsx("div",{id:Ke,className:"create-session-worktree-combobox-list",role:"listbox",children:ar.map(K=>n.jsxs("section",{className:"create-session-worktree-combobox-group","aria-label":K.label,children:[n.jsx("header",{className:"create-session-worktree-combobox-group-title",children:K.label}),n.jsx("div",{className:"create-session-worktree-combobox-group-options",children:K.items.map(fe=>{const Fe=ee.findIndex(gn=>gn.value===fe.value),ut=Nt===fe.value,kt=xt===Fe;return n.jsxs("button",{type:"button",role:"option",className:"create-session-worktree-combobox-option","aria-selected":ut,"data-highlighted":kt,onMouseDown:gn=>gn.preventDefault(),onMouseEnter:()=>Tt(Fe),onClick:()=>{ln(fe.value),He(!1),Tt(-1)},children:[n.jsx("span",{className:"create-session-worktree-combobox-option-label",children:fe.value}),n.jsxs("span",{className:"create-session-worktree-combobox-option-badges",children:[fe.current?n.jsx("span",{className:"create-session-worktree-combobox-badge",children:o("shell.createWorktreeBaseRefCurrentBadge")}):null,fe.recommended?n.jsx("span",{className:"create-session-worktree-combobox-badge recommended",children:o("shell.createWorktreeBaseRefRecommendedBadge")}):null]})]},`${K.key}:${fe.value}`)})})]},K.key))}):n.jsx("p",{className:"create-session-worktree-combobox-empty",children:o("shell.createWorktreeBaseRefEmpty")})})]}),document.body):null,n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:lt,onClick:$,children:o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:lt,children:o(lt?"shell.createWorktreeSubmitting":"shell.createWorktreeSubmit")})]})]})}),n.jsx(Ln,{open:Je!==null,title:o("shell.archiveModalTitle"),description:Je?`${Je.workspace.name} · ${o("shell.archiveModalDescription")}`:o("shell.archiveModalDescription"),onClose:()=>_e(null),children:Je&&Je.archivedSessions.length>0?n.jsx("div",{className:"workbench-archive-list","data-workspace-tone":(Et==null?void 0:Et.tone)??"root",style:os(Et),children:Je.archivedSessions.map(K=>{const fe=Vs(K.title,o("common.unknown"));return n.jsxs("article",{className:"workbench-archive-item","data-workspace-tone":(Et==null?void 0:Et.tone)??"root",style:os(Et),children:[n.jsxs("div",{className:"workbench-archive-item-main",children:[n.jsx("strong",{title:fe.fullTitle,children:fe.displayTitle}),n.jsxs("p",{children:[vP(K,Je.workspace,!1)," ·"," ",gm(K.provider)]})]}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Ys(K.sessionId),children:o("shell.unarchiveAction")})]},K.sessionId)})}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.archiveEmpty")})}),n.jsx(Ln,{open:Cn!==null,title:o("shell.renameModalTitle"),description:o("shell.renameModalDescription"),onClose:()=>{bn||(_t(null),mn(""))},children:n.jsxs("form",{className:"workbench-rename-form",onSubmit:Lo,children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.renameInputLabel")}),n.jsx("input",{type:"text",value:Fn,placeholder:o("shell.renameInputPlaceholder"),maxLength:120,autoFocus:!0,onChange:K=>mn(K.target.value)})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:!!bn,onClick:()=>{_t(null),mn("")},children:o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:!Fn.trim()||bn===(Cn==null?void 0:Cn.session.sessionId),children:bn===(Cn==null?void 0:Cn.session.sessionId)?o("shell.renamingSession"):o("common.save")})]})]})})]})}function Jx({panelReady:e,activeTab:t,fileRevealRequest:r,onTabChange:i,onToggleCollapse:a,currentSessionId:c,activeWorkspaceId:u,navigationGroups:d,workspaceContext:m,worktreeMeta:f,worktreeMergeState:w,onRefreshWorktreeMergePreview:g,onApplyWorktreeMerge:v,onCleanupWorktree:y}){var G;const x=u??((G=d[0])==null?void 0:G.workspace.id)??null,C=pr(),{showToast:j}=Jn(),N=p.useRef(null),P=p.useRef(null),L=C.isDesktop&&C.bridge.supported,Y=L&&!!u,H=L&&!!x,W=L&&!!x,I=typeof globalThis<"u"&&"PointerEvent"in globalThis,M=p.useCallback(async(R,A,Z)=>{if(R==="files"){const q=await FL(C,{workspaceId:A,sessionId:Z,focusOwner:"file-context-panel"});q.ok||j({title:q.detail??o("conversation.filePanelOpenExternalFailed"),tone:"error"});return}if(R==="git"){const q=await _L(C,{workspaceId:A,focusOwner:"git-sidebar"});q.ok||j({title:q.detail??o("git.openExternalFailed"),tone:"error"});return}const pe=await OL(C,{workspaceId:A,focusOwner:"terminal-manager-panel"});pe.ok||j({title:pe.detail??o("terminalManager.openExternalFailed"),tone:"error"})},[C,j]),O=p.useCallback((R,A)=>{if(R.button!==0||!L)return;const Z=A==="files"?u:A==="git"||A==="terminals"?x:null;if(!Z)return;const pe=A==="files"?c:null;N.current={tab:A,startX:R.clientX,startY:R.clientY,workspaceId:Z,sessionId:pe,detached:!1,preview:null};const q=Q=>{var oe;const _=N.current;if(!_)return;const de=Math.abs(Q.clientX-_.startX),le=Math.abs(Q.clientY-_.startY);!_.detached&&Math.max(de,le)<Ix||(_.detached||(_.detached=!0,P.current=_.tab,_.preview=rx({title:_.tab==="files"?o("shell.filesEntry"):_.tab==="git"?o("shell.gitEntry"):o("shell.terminalManagerEntry"),x:Q.clientX,y:Q.clientY})),(oe=_.preview)==null||oe.updatePosition(Q.clientX,Q.clientY))},D=Q=>{var de;const _=(de=N.current)==null?void 0:de.preview;Q&&(_==null||_.cancel()),window.removeEventListener("mousemove",q),window.removeEventListener("mouseup",T),window.removeEventListener("blur",B),N.current=null},T=async()=>{var _;const Q=N.current;D(!1),Q!=null&&Q.detached&&(await((_=Q.preview)==null?void 0:_.complete()),await M(Q.tab,Q.workspaceId,Q.sessionId))},B=()=>{D(!0)};window.addEventListener("mousemove",q),window.addEventListener("mouseup",T),window.addEventListener("blur",B)},[u,L,c,x,M]),F=p.useCallback((R,A)=>{if(R.button!==0||!L)return;const Z=A==="files"?u:A==="git"||A==="terminals"?x:null;if(!Z)return;const pe=R.currentTarget,q=R.pointerId;pe.setPointerCapture(q);const D=A==="files"?c:null;N.current={tab:A,startX:R.clientX,startY:R.clientY,workspaceId:Z,sessionId:D,detached:!1,preview:null};const T=le=>{var Me;if(le.pointerId!==q)return;const oe=N.current;if(!oe)return;const ye=Math.abs(le.clientX-oe.startX),Ne=Math.abs(le.clientY-oe.startY);!oe.detached&&Math.max(ye,Ne)<Ix||(oe.detached||(oe.detached=!0,P.current=oe.tab,oe.preview=rx({title:oe.tab==="files"?o("shell.filesEntry"):oe.tab==="git"?o("shell.gitEntry"):o("shell.terminalManagerEntry"),x:le.clientX,y:le.clientY})),(Me=oe.preview)==null||Me.updatePosition(le.clientX,le.clientY))},B=le=>{var ye;const oe=(ye=N.current)==null?void 0:ye.preview;le&&(oe==null||oe.cancel()),pe.removeEventListener("pointermove",T),pe.removeEventListener("pointerup",Q),pe.removeEventListener("pointercancel",_),pe.removeEventListener("lostpointercapture",_),window.removeEventListener("blur",de),N.current=null,pe.hasPointerCapture(q)&&pe.releasePointerCapture(q)},Q=async le=>{var ye;if(le.pointerId!==q)return;const oe=N.current;B(!1),oe!=null&&oe.detached&&(await((ye=oe.preview)==null?void 0:ye.complete()),await M(oe.tab,oe.workspaceId,oe.sessionId))},_=le=>{le.pointerId===q&&B(!0)},de=()=>{B(!0)};pe.addEventListener("pointermove",T),pe.addEventListener("pointerup",Q),pe.addEventListener("pointercancel",_),pe.addEventListener("lostpointercapture",_),window.addEventListener("blur",de)},[u,L,c,x,M]),X=p.useCallback(R=>{if(P.current===R){P.current=null;return}i(R)},[i]),U=p.useCallback(R=>{!C.isDesktop||C.ui.osFamily!=="macos"||R.button!==0||Kb(R.target)&&Yb()},[C.isDesktop,C.ui.osFamily]);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"workbench-auxiliary-header","data-workspace-tone":(m==null?void 0:m.tone)??"root",style:os(m),"data-window-drag-handle":"workbench-auxiliary-header",onMouseDownCapture:U,children:[a?n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":o("shell.hideInfoSidebar"),title:o("shell.hideInfoSidebar"),onClick:a,children:n.jsx(WP,{})}):null,n.jsxs("div",{className:"workbench-info-tabs",role:"tablist","aria-label":o("shell.infoTabsLabel"),children:[n.jsx("button",{className:t==="files"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="files",title:Y?"拖拽标签到独立窗口":void 0,onPointerDown:R=>F(R,"files"),onMouseDown:I?void 0:R=>O(R,"files"),onClick:()=>X("files"),children:o("shell.filesEntry")}),n.jsx("button",{className:t==="git"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="git",title:H?"拖拽标签到独立窗口":void 0,onPointerDown:R=>F(R,"git"),onMouseDown:I?void 0:R=>O(R,"git"),onClick:()=>X("git"),children:o("shell.gitEntry")}),n.jsx("button",{className:t==="terminals"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="terminals",title:W?"拖拽标签到独立窗口":void 0,onPointerDown:R=>F(R,"terminals"),onMouseDown:I?void 0:R=>O(R,"terminals"),onClick:()=>X("terminals"),children:o("shell.terminalManagerEntry")})]})]}),n.jsxs("div",{className:"workbench-auxiliary-body",children:[e?null:n.jsx(Ed,{}),e&&t==="git"&&f?n.jsx(o2,{meta:f,state:w,onRefresh:()=>g(f.workspaceId,!0),onApply:()=>v(f.workspaceId),onCleanup:()=>y(f)}):null,e&&t==="files"?u?n.jsx(p.Suspense,{fallback:n.jsx(Ed,{}),children:n.jsx(uO,{sessionId:c,workspaceId:u,externalRevealRequest:r})}):n.jsx("section",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("shell.filesPanelEmpty")})}):null,e&&t==="git"?x?n.jsx(p.Suspense,{fallback:n.jsx(Ed,{}),children:n.jsx(dO,{workspaceId:x})}):n.jsx("section",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("shell.gitPanelEmpty")})}):null,e&&t==="terminals"?n.jsx(p.Suspense,{fallback:n.jsx(Ed,{}),children:n.jsx(hO,{currentWorkspaceId:u,navigationGroups:d})}):null]})]})}function o2({meta:e,state:t,onRefresh:r,onApply:i,onCleanup:a}){const[c,u]=p.useState(!1),d=(t==null?void 0:t.preview)??null,m=(t==null?void 0:t.loading)??!1,f=(t==null?void 0:t.applying)??!1,w=(t==null?void 0:t.cleaning)??!1,g=d!==null,v=(d==null?void 0:d.alreadyMerged)===!0,y=new Set((d==null?void 0:d.blockers.map(U=>U.code))??[]),x=y.size>0||!!(t!=null&&t.error),C=v&&!x,j=(d==null?void 0:d.canMerge)===!0&&!m&&!f&&!w&&!C,N=C&&!m&&!f&&!w&&!y.has("SOURCE_DIRTY")&&!y.has("HAS_ACTIVE_CHILDREN"),P=m||f||w?"loading":x?"blocked":C?"merged":d!=null&&d.canMerge?"ready":g?"blocked":"idle",L=(d==null?void 0:d.targetWorkspace.name)??o("common.unknown"),Y=(d==null?void 0:d.sourceBranchName)??e.branchName,H=(d==null?void 0:d.targetBranchName)??e.baseRef??o("common.unknown"),W=c2({t:o,hasPreview:g,showMergedState:C,isMerged:v,canMerge:(d==null?void 0:d.canMerge)===!0,ahead:(d==null?void 0:d.ahead)??0,blockerCodeSet:y}),I=m?o("shell.worktreeMergePreviewLoading"):f?o("shell.worktreeMergeApplying"):w?o("shell.worktreeCleanupRunning"):C?o("shell.worktreeMergeAlreadyMerged"):d!=null&&d.canMerge?o("shell.worktreeMergeReady"):o(g?"shell.worktreeMergeBlocked":"shell.worktreeMergePreviewIdle"),M=[o("shell.worktreeMergeCurrentBranch",{branch:Y}),o("shell.worktreeMergeParentBranch",{branch:H}),o("shell.worktreeMergeTargetWorkspace",{name:L}),d?o("shell.worktreeMergeAheadBehind",{ahead:d.ahead,behind:d.behind}):o("shell.worktreeMergeAheadBehindPending"),d!=null&&d.mergeBaseCommit?o("shell.worktreeMergeBaseCommit",{commit:_O(d.mergeBaseCommit)}):null].filter(U=>!!U),O=`worktree-merge-panel-details-${e.workspaceId}`,F=o(c?"shell.worktreeMergeCollapseDetails":"shell.worktreeMergeExpandDetails"),X=l2({t:o,loading:m,applying:f,cleaning:w,hasPreview:g,canMerge:(d==null?void 0:d.canMerge)===!0,showMergedState:C,blockerCodeSet:y});return p.useEffect(()=>{u(!1)},[e.workspaceId]),n.jsxs("section",{className:"worktree-merge-panel","data-state":P,children:[n.jsxs("button",{type:"button",className:"worktree-merge-panel-summary","aria-label":F,"aria-expanded":c,"aria-controls":O,onClick:()=>{u(U=>!U)},children:[n.jsx("span",{className:"worktree-merge-panel-summary-label",children:o("shell.worktreeMergePanelLabel")}),n.jsx("span",{className:"worktree-merge-panel-summary-main",children:n.jsx("span",{className:"worktree-merge-panel-summary-tags",children:X.map(U=>n.jsx("span",{className:"worktree-merge-panel-summary-tag","data-state":P,children:U},U))})}),n.jsx("span",{className:"worktree-merge-panel-summary-toggle",children:F})]}),c?n.jsxs("div",{id:O,className:"worktree-merge-panel-details",children:[n.jsx("div",{className:"worktree-merge-panel-detail-head",children:n.jsx("span",{className:"worktree-merge-panel-status","data-state":P,children:I})}),n.jsx("div",{className:"worktree-merge-panel-meta",children:M.map(U=>n.jsx("span",{children:U},U))}),g?n.jsx("div",{className:"worktree-merge-panel-checklist","aria-label":o("shell.worktreeMergeChecklistTitle"),children:W.map(U=>n.jsxs("div",{className:"worktree-merge-panel-checklist-item","data-state":U.state,children:[n.jsx("span",{className:"worktree-merge-panel-checklist-marker","aria-hidden":"true",children:U.state==="done"?"✓":U.state==="blocked"?"!":"·"}),n.jsxs("span",{className:"worktree-merge-panel-checklist-copy",children:[n.jsx("strong",{children:U.label}),U.detail?n.jsx("span",{children:U.detail}):null]})]},U.key))}):null,t!=null&&t.error?n.jsx("p",{className:"worktree-merge-panel-error status-text","data-tone":"error",children:t.error}):null,d!=null&&d.conflictPaths.length?n.jsxs("div",{className:"worktree-merge-panel-conflicts",children:[n.jsx("span",{className:"worktree-merge-panel-conflicts-label",children:o("shell.worktreeMergeConflictLabel")}),n.jsx("div",{className:"worktree-merge-panel-conflict-list",children:d.conflictPaths.map(U=>n.jsx("code",{children:U},U))})]}):null,n.jsxs("div",{className:"worktree-merge-panel-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:m||f||w,onClick:r,children:o(g?"shell.worktreeMergePreviewRefresh":"shell.worktreeMergePreviewAction")}),n.jsx("button",{type:"button",className:"primary-button",disabled:!j,onClick:i,children:o(f?"shell.worktreeMergeApplying":"shell.worktreeMergeApplyAction")}),n.jsx("button",{type:"button",className:"secondary-button worktree-merge-panel-cleanup-button",disabled:!N,onClick:a,children:o(w?"shell.worktreeCleanupRunning":"shell.worktreeCleanupAction")})]})]}):null]})}function l2(e){const{t,loading:r,applying:i,cleaning:a,hasPreview:c,canMerge:u,showMergedState:d,blockerCodeSet:m}=e;if(r)return[t("shell.worktreeMergeCompactChecking")];if(i)return[t("shell.worktreeMergeCompactMerging")];if(a)return[t("shell.worktreeMergeCompactCleaning")];const f=[];return m.has("SOURCE_NOT_ACTIVE")&&f.push(t("shell.worktreeMergeCompactInactive")),m.has("SOURCE_DIRTY")&&f.push(t("shell.worktreeMergeCompactDirty")),m.has("TARGET_DIRTY")&&f.push(t("shell.worktreeMergeCompactTargetDirty")),m.has("HAS_CONFLICTS")&&f.push(t("shell.worktreeMergeCompactConflict")),m.has("HAS_ACTIVE_CHILDREN")&&f.push(t("shell.worktreeMergeCompactChildren")),f.length>0?f:u?[t("shell.worktreeMergeCompactReady")]:d?[t("shell.worktreeMergeCompactMerged")]:c?m.has("NO_COMMITS_TO_MERGE")?[t("shell.worktreeMergeCompactNoCommits")]:[t("shell.worktreeMergeCompactBlocked")]:[t("shell.worktreeMergeCompactPending")]}function c2(e){const{t,hasPreview:r,showMergedState:i,isMerged:a,canMerge:c,ahead:u,blockerCodeSet:d}=e,m=d.has("SOURCE_NOT_ACTIVE"),f=d.has("SOURCE_DIRTY"),w=d.has("TARGET_DIRTY"),g=d.has("HAS_ACTIVE_CHILDREN"),v=d.has("HAS_CONFLICTS"),y=r&&!a&&(d.has("NO_COMMITS_TO_MERGE")||u<=0),x=i?{key:"merge-result",label:t("shell.worktreeMergeChecklistResultMerged"),detail:t("shell.worktreeMergeMergedHint"),state:"done"}:c?{key:"merge-result",label:t("shell.worktreeMergeChecklistResultReady"),detail:t("shell.worktreeMergeChecklistResultReadyDetail"),state:"done"}:r?{key:"merge-result",label:t("shell.worktreeMergeChecklistResultBlocked"),detail:t("shell.worktreeMergeChecklistResultBlockedDetail"),state:"blocked"}:{key:"merge-result",label:t("shell.worktreeMergeChecklistResultPending"),detail:null,state:"pending"};return[{key:"source-state",label:t("shell.worktreeMergeChecklistSourceState"),detail:r&&m?t("shell.worktreeMergeChecklistSourceStateBlocked"):null,state:r?m?"blocked":"done":"pending"},{key:"clean-source",label:t("shell.worktreeMergeChecklistSourceClean"),detail:r&&f?t("shell.worktreeMergeChecklistSourceCleanBlocked"):null,state:r?f?"blocked":"done":"pending"},{key:"clean-target",label:t("shell.worktreeMergeChecklistTargetClean"),detail:r&&w?t("shell.worktreeMergeChecklistTargetCleanBlocked"):null,state:r?w?"blocked":"done":"pending"},{key:"children",label:t("shell.worktreeMergeChecklistChildren"),detail:r&&g?t("shell.worktreeMergeChecklistChildrenBlocked"):null,state:r?g?"blocked":"done":"pending"},{key:"commits",label:t("shell.worktreeMergeChecklistCommits"),detail:y?t(a?"shell.worktreeMergeMergedDirtyHint":"shell.worktreeMergeChecklistCommitsBlocked"):null,state:y?a?"done":"blocked":r?"done":"pending"},{key:"conflicts",label:t("shell.worktreeMergeChecklistConflicts"),detail:v?t("shell.worktreeMergeChecklistConflictsBlocked"):null,state:v?"blocked":r?"done":"pending"},x]}function u2({shellMode:e="desktop"}){var tr,mi,qn,_r,Wi,Yi,Gn,Ms,Xi,$n,Bo,ba,Wo,Uo,wa;const t=hs(),r=mr(),i=pr(),{showToast:a}=Jn(),c=us(z=>z.sessionDisplaySortMode),u=us(z=>z.notificationPreferences.notifyOnPermissionRequest),d=us(z=>z.notificationPreferences.notifyOnSessionCompleted),m=us(z=>z.notificationPreferences.notifyOnSessionFailed),f=p.useRef(sP(rP)),w=p.useRef(0),g=p.useRef((((mi=(tr=f.current)==null?void 0:tr.items)==null?void 0:mi.length)??0)>0),v=p.useRef(new Map),y=p.useRef(!1),x=p.useRef(null),C=p.useRef(0),j=p.useRef(null),N=p.useRef(null),P=p.useRef(new Set),L=p.useRef(new Set),Y=p.useRef(new Set),H=p.useRef(new Set),W=p.useRef(null),I=p.useRef(null),M=p.useRef(null),O=p.useRef(null),F=p.useRef(null),X=p.useRef(null),U=p.useRef(null),G=p.useRef(null),R=p.useRef(0),A=p.useRef(0),Z=p.useRef(a),pe=p.useRef(i.bridge),q=p.useRef(!1),D=p.useRef(new Map),T=p.useRef(!1),B=p.useRef(new Map),Q=p.useRef([]),_=p.useRef(c),de=p.useRef(null),[le,oe]=p.useState(()=>Gc(f.current,c)),ye=p.useRef(le),[Ne,Me]=p.useState(()=>{var z,ie;return(((ie=(z=f.current)==null?void 0:z.items)==null?void 0:ie.length)??0)===0}),[Te,Dt]=p.useState(null),[st,dt]=p.useState(()=>Ad(Ux(jx,B_),Dd,Rx)),[bt,pt]=p.useState(()=>Ad(Ux(Nx,W_),Dd,Mx)),[we,he]=p.useState(()=>Hx(Tx,!1)),[Le,Oe]=p.useState(()=>Hx(Px,!1)),[Qe,wt]=p.useState(()=>qx(f.current)),[Ie,Be]=p.useState(()=>zx(gf)),[vt,ft]=p.useState(!1),[ve,Ae]=p.useState("files"),[et,We]=p.useState(!1),[lt,ct]=p.useState(!1),[Vt,Bt]=p.useState(null),[Wt,Lt]=p.useState({}),[Nt,ln]=p.useState(!1),[Jt,Sn]=p.useState("sessions"),[se,He]=p.useState(""),[xt,Tt]=p.useState(""),[Mn,wn]=p.useState(!1),[kn,Ht]=p.useState(null),[Gt,dn]=p.useState([]),[hn,te]=p.useState(null),[re,ue]=p.useState({}),[Se,_e]=p.useState({}),[ze,yt]=p.useState(null),[nt,Ve]=p.useState(!1),[ne,je]=p.useState([]),[ht,Rt]=p.useState(()=>new Set),[tn,Kt]=p.useState(!1),[$t,Zt]=p.useState(!1),[Tn,Zn]=p.useState(()=>zx(Dx));p.useEffect(()=>{Z.current=a},[a]),p.useEffect(()=>{_.current=c,oe(z=>OO(z,c))},[c]),p.useEffect(()=>{ye.current=le},[le]),p.useEffect(()=>{pe.current=i.bridge},[i.bridge]);const Cn=p.useCallback(async()=>{const z=R.current+1;R.current=z;try{const ie=await mm();if(z!==R.current)return;if(!ie.initialized){je([]),Rt(new Set);return}const[Re,rt,Ct]=await Promise.all([pm(),Yc(),m_()]);if(z!==R.current)return;je(X_(Re.overview,rt.items)),Rt(new Set(Ct.items.map(jt=>jt.notificationId)))}catch{if(z!==R.current)return;je([]),Rt(new Set)}},[]),_t=p.useCallback(z=>{const ie=z.map(Re=>Re.createdAt).sort((Re,rt)=>qa(rt)-qa(Re))[0]??null;ie&&Zn(Re=>Re&&qa(Re)>=qa(ie)?Re:ie)},[]);p.useEffect(()=>{Tn&&ho(Dx,Tn)},[Tn]),p.useEffect(()=>{Cn();const z=window.setInterval(()=>{Cn()},H_);return()=>{window.clearInterval(z)}},[Cn]),p.useEffect(()=>{sn("workbench.layout_mounted",{path:t.pathname,search:t.search})},[t.pathname,t.search]),p.useEffect(()=>{var z,ie;sn("workbench.cached_snapshot_loaded",{cached:!!f.current,workspaceCount:((z=f.current)==null?void 0:z.items.length)??0,sessionCount:((ie=f.current)==null?void 0:ie.items.reduce((Re,rt)=>Re+rt.sessions.length,0))??0})},[]);function Fn(z){var rt;if(!z||!Array.isArray(z.items))return;EO(v.current,z);const ie=AO(z,v.current);sn("workbench.apply_snapshot",{workspaceCount:ie.items.length,sessionCount:ie.items.reduce((Ct,jt)=>Ct+jt.sessions.length,0),currentSessionId:((rt=Lc(t.pathname))==null?void 0:rt.sessionId)??null});const Re=Gc(ie,_.current);f.current=ie,Td(ie),ye.current=Re,oe(Re),wt(qx(ie)),Dt(null)}const mn=p.useCallback(async()=>{const z=w.current+1;w.current=z,Me(ie=>ie||!g.current),sn("workbench.refresh_navigation.start",{requestId:z,hasNavigationData:g.current});try{const ie=await MT();if(z!==w.current){sn("workbench.refresh_navigation.stale",{requestId:z});return}Fn(ie)}catch(ie){if(z!==w.current)return;Dt(ie instanceof Error?ie.message:o("shell.navigationLoadFailed")),Z.current({title:ie instanceof Error?ie.message:o("shell.navigationLoadFailed"),tone:"error"})}finally{sn("workbench.refresh_navigation.end",{requestId:z,success:z===w.current}),z===w.current&&Me(!1)}},[]),bn=p.useCallback(z=>{oe(ie=>{const Re=IO(ie,z,_.current);return ye.current=Re,Re})},[]),Ce=p.useCallback(()=>{var z;(z=N.current)==null||z.requestRefresh()},[]),De=p.useCallback((z,ie)=>{r(Nr(z,ie))},[r]),mt=p.useCallback((z,ie)=>{var Re;W.current={workspaceId:z,paths:ie},(Re=N.current)==null||Re.subscribeFileTree(z,ie)},[]),Mt=p.useCallback((z,ie)=>{var Re;I.current={workspaceId:z,paths:ie},(Re=N.current)==null||Re.requestFileTreeRefresh(z,ie)},[]),en=p.useCallback(z=>(P.current.add(z),()=>{P.current.delete(z)}),[]),An=p.useCallback(z=>{var ie;M.current=z,(ie=N.current)==null||ie.subscribeGit(z)},[]),zt=p.useCallback(z=>{var ie;O.current=z,(ie=N.current)==null||ie.requestGitRefresh(z)},[]),er=p.useCallback(z=>(L.current.add(z),()=>{L.current.delete(z)}),[]),fr=p.useCallback(z=>{var ie;F.current=z,(ie=N.current)==null||ie.subscribeWorkspaceManagement(z)},[]),Hn=p.useCallback(z=>{var ie;X.current=z,ue(Re=>{var rt;return{...Re,[z]:{detail:((rt=Re[z])==null?void 0:rt.detail)??null,loading:!0,error:null}}}),(ie=N.current)==null||ie.requestWorkspaceManagementRefresh(z)},[]),ir=p.useCallback(z=>(Y.current.add(z),()=>{Y.current.delete(z)}),[]),vr=p.useCallback(async(z,ie=!1)=>{const Re=z.trim();if(!Re)return;let rt=!0;if(_e(Ct=>{const jt=Ct[Re];return!ie&&(jt!=null&&jt.loading)?(rt=!1,Ct):{...Ct,[Re]:{preview:(jt==null?void 0:jt.preview)??null,loading:!0,applying:(jt==null?void 0:jt.applying)??!1,cleaning:(jt==null?void 0:jt.cleaning)??!1,error:null}}}),!!rt)try{const Ct=await rF(Re);_e(jt=>{var vn,_n;return{...jt,[Re]:{preview:Ct,loading:!1,applying:((vn=jt[Re])==null?void 0:vn.applying)??!1,cleaning:((_n=jt[Re])==null?void 0:_n.cleaning)??!1,error:null}}})}catch(Ct){_e(jt=>{var vn,_n,Wn;return{...jt,[Re]:{preview:((vn=jt[Re])==null?void 0:vn.preview)??null,loading:!1,applying:((_n=jt[Re])==null?void 0:_n.applying)??!1,cleaning:((Wn=jt[Re])==null?void 0:Wn.cleaning)??!1,error:Ct instanceof Error?Ct.message:o("shell.worktreeMergePreviewFailed")}}})}},[]),On=p.useCallback(async z=>{const ie=z.trim();if(ie){_e(Re=>{var rt,Ct;return{...Re,[ie]:{preview:((rt=Re[ie])==null?void 0:rt.preview)??null,loading:!1,applying:!0,cleaning:((Ct=Re[ie])==null?void 0:Ct.cleaning)??!1,error:null}}});try{const Re=await iF(ie);_e(rt=>{var Ct;return{...rt,[ie]:{preview:Re.preview,loading:!1,applying:!1,cleaning:((Ct=rt[ie])==null?void 0:Ct.cleaning)??!1,error:null}}}),Ce(),mn(),vr(ie,!0),zt(Re.preview.targetWorkspace.id),Z.current({title:Re.applied?o("shell.worktreeMergeApplySuccess"):o("shell.worktreeMergeAlreadyMerged"),tone:"success"})}catch(Re){_e(rt=>{var Ct,jt;return{...rt,[ie]:{preview:((Ct=rt[ie])==null?void 0:Ct.preview)??null,loading:!1,applying:!1,cleaning:((jt=rt[ie])==null?void 0:jt.cleaning)??!1,error:Re instanceof Error?Re.message:o("shell.worktreeMergeApplyFailed")}}}),Z.current({title:Re instanceof Error?Re.message:o("shell.worktreeMergeApplyFailed"),tone:"error"})}}},[vr,mn,zt,Ce]),Sr=p.useCallback(async z=>{var rt,Ct;const ie=z.workspaceId,Re=nt&&((Ct=(rt=Se[ie])==null?void 0:rt.preview)==null?void 0:Ct.alreadyMerged)===!0;_e(jt=>{var vn;return{...jt,[ie]:{preview:((vn=jt[ie])==null?void 0:vn.preview)??null,loading:!1,applying:!1,cleaning:!0,error:null}}});try{const jt=await sF(ie,{deleteBranch:Re});if(_e(vn=>{var _n;return{...vn,[ie]:{preview:((_n=vn[ie])==null?void 0:_n.preview)??null,loading:!1,applying:!1,cleaning:!1,error:null}}}),Ve(!1),yt(vn=>(vn==null?void 0:vn.workspaceId)===ie?null:vn),Ce(),await mn(),r(Ai(z.parentWorkspaceId),{replace:!0}),jt.branchDeleted){Z.current({title:o("shell.worktreeCleanupDeleteBranchSuccess",{branch:jt.deletedBranchName||z.branchName}),tone:"success"});return}if(jt.branchDeleteRequested){Z.current({title:o("shell.worktreeCleanupDeleteBranchPartialFailed",{branch:z.branchName}),description:jt.branchDeleteError||void 0,tone:"warning"});return}Z.current({title:o("shell.worktreeCleanupSuccess"),tone:"success"})}catch(jt){_e(vn=>{var _n;return{...vn,[ie]:{preview:((_n=vn[ie])==null?void 0:_n.preview)??null,loading:!1,applying:!1,cleaning:!1,error:jt instanceof Error?jt.message:o("shell.worktreeCleanupFailed")}}}),Z.current({title:jt instanceof Error?jt.message:o("shell.worktreeCleanupFailed"),tone:"error"})}},[nt,r,mn,Ce,Se]),Fi=p.useCallback(z=>{Ve(!1),yt(z)},[]),_i=p.useCallback(z=>{var ie;U.current=z,(ie=N.current)==null||ie.subscribeTerminalManager(z)},[]),Hr=p.useCallback(z=>{var ie;G.current=z,(ie=N.current)==null||ie.requestTerminalManagerRefresh(z)},[]),sr=p.useCallback(z=>(H.current.add(z),()=>{H.current.delete(z)}),[]),Pr=p.useCallback((z,ie)=>{oe(Re=>LO(Re,z,ie??new Date().toISOString()))},[]),un=p.useCallback(async(z,ie)=>{v.current.set(z,ie),oe(Re=>Gx(Re,z,ie));try{const Re=await FT(z,ie),rt=zs(Re);rt===ie?v.current.set(z,rt):v.current.delete(z),bn(Re),Ce(),mn()}catch(Re){throw v.current.delete(z),oe(rt=>Gx(rt,z,!ie)),Re}},[mn,Ce,bn]),Jr=p.useCallback((z,ie)=>{sn("workbench.set_session_workspace",{sessionId:z,workspaceId:ie}),Lt(Re=>{if(!ie){if(!(z in Re))return Re;const rt={...Re};return delete rt[z],rt}return Re[z]===ie?Re:{...Re,[z]:ie}})},[]);p.useEffect(()=>{g.current=le.length>0},[le]),p.useEffect(()=>{sn("workbench.navigation_state",{navigationLoading:Ne,workspaceCount:le.length,sessionCount:le.reduce((z,ie)=>z+ie.sessions.length,0)})},[le,Ne]),p.useEffect(()=>{j.current!==null&&window.clearTimeout(j.current),j.current=window.setTimeout(()=>{var pn;j.current=null,!(y.current||g.current)&&(sn("workbench.refresh_navigation.ws_fallback_triggered"),(pn=N.current)==null||pn.requestRefresh())},1200);const z=new yT({onConnectionChange:pn=>{pn==="connected"&&w_(),pn==="reconnect_failed"&&!g.current&&(Dt(o("shell.navigationLoadFailed")),Z.current({id:"workbench-navigation-connection",title:o("shell.navigationLoadFailed"),tone:"warning",durationMs:3600}))},onSnapshot:pn=>{y.current=!0,sn("workbench.ws_snapshot_received",{workspaceCount:pn.items.length,sessionCount:pn.items.reduce((Or,As)=>Or+As.sessions.length,0)}),j.current!==null&&(window.clearTimeout(j.current),j.current=null),Fn(pn),Me(!1)},onFileTreeSnapshot:pn=>{P.current.forEach(Or=>Or(pn))},onGitSnapshot:pn=>{Ei(AP(pn.workspaceId),{status:pn.status,history:pn.history,historyTotalCount:pn.historyTotalCount,historyNextCursor:pn.historyNextCursor,branches:pn.branches}),ue(Or=>{var va;const As=((va=le.find(Dm=>Dm.workspace.id===pn.workspaceId))==null?void 0:va.workspace)??null;if(!As)return Or;const bi=Or[pn.workspaceId],ps=LP(IP((bi==null?void 0:bi.detail)??EP(As),As),pn);return Ei(Ug(pn.workspaceId),ps),{...Or,[pn.workspaceId]:{detail:ps,loading:!1,error:null}}}),L.current.forEach(Or=>Or(pn))},onWorkspaceManagementSnapshot:pn=>{Ei(Ug(pn.workspaceId),pn),ue(Or=>({...Or,[pn.workspaceId]:{detail:pn,loading:!1,error:null}})),Y.current.forEach(Or=>Or(pn))},onTerminalManagerSnapshot:pn=>{H.current.forEach(Or=>Or(pn))},onUnauthorized:()=>{hr.clear(),r("/login",{replace:!0})}});N.current=z;const ie=W.current,Re=I.current,rt=M.current,Ct=O.current,jt=F.current,vn=X.current,_n=U.current,Wn=G.current;return ie&&z.subscribeFileTree(ie.workspaceId,ie.paths),rt&&z.subscribeGit(rt),jt&&z.subscribeWorkspaceManagement(jt),_n&&z.subscribeTerminalManager(_n),Re&&z.requestFileTreeRefresh(Re.workspaceId,Re.paths),Ct&&z.requestGitRefresh(Ct),vn&&z.requestWorkspaceManagementRefresh(vn),Wn&&z.requestTerminalManagerRefresh(Wn),z.start(),()=>{j.current!==null&&(window.clearTimeout(j.current),j.current=null),N.current===z&&(N.current=null),z.close()}},[r]),p.useEffect(()=>{ho(jx,String(st))},[st]),p.useEffect(()=>{ho(Nx,String(bt))},[bt]),p.useEffect(()=>{ho(Tx,String(we))},[we]),p.useEffect(()=>{ho(Px,String(Le))},[Le]),p.useEffect(()=>{if(!Ie){CO(gf);return}ho(gf,Ie)},[Ie]),p.useEffect(()=>{if(vt||Le)return;const z=window.setTimeout(()=>{ft(!0)},U_);return()=>{window.clearTimeout(z)}},[vt,Le]);const ar=Lc(t.pathname),ee=(ar==null?void 0:ar.sessionId)??null,Ke=ee?HP(ee):!1,Je=p.useMemo(()=>dT(le),[le]),Et=p.useMemo(()=>new Set(Qe),[Qe]),an=p.useMemo(()=>Je.filter(z=>z.session.isFavorite===!0).map(z=>z.session.sessionId),[Je]),on=p.useMemo(()=>new Set(an),[an]),nn=p.useCallback(z=>{const ie=wf(z,Qe);f.current=ie,Td(ie),ye.current=z,oe(z)},[Qe]),Dr=p.useCallback(z=>{const ie=!Et.has(z),Re=Yx(Qe,z,ie),rt=wf(le,Re);f.current=rt,Td(rt),wt(Re),ET(z,{collapsed:ie}).catch(Ct=>{const jt=Yx(Re,z,!ie),vn=wf(le,jt);f.current=vn,Td(vn),wt(jt),Z.current({title:Ct instanceof Error?Ct.message:o("shell.workspaceCollapseStateSaveFailed"),tone:"error"})})},[Et,Qe,le]),zr=p.useCallback(()=>{de.current={originalGroups:ye.current}},[]),qr=p.useCallback((z,ie,Re)=>{const rt=ye.current,Ct=MO(rt,z,ie,Re);Ct!==rt&&nn(Ct)},[nn]),yr=p.useCallback(()=>{const z=de.current;de.current=null;const ie=ye.current;z&&(z.originalGroups.length===ie.length&&z.originalGroups.every((Re,rt)=>{var Ct;return Re.workspace.id===((Ct=ie[rt])==null?void 0:Ct.workspace.id)})||XL({workspaceIds:ie.map(Re=>Re.workspace.id)}).catch(Re=>{nn(z.originalGroups),Z.current({title:Re instanceof Error?Re.message:o("shell.workspaceReorderFailed"),tone:"error"})}))},[nn]);p.useEffect(()=>{const z=new Map;if(Je.forEach(({session:ie})=>{z.set(ie.sessionId,{activityState:ie.activityState,completedAt:ie.completedAt??null,runningState:ie.runningState??null})}),!q.current){q.current=!0,D.current=z;return}Je.forEach(({session:ie})=>{var vn;if(ie.sessionId===ee)return;const Re=D.current.get(ie.sessionId);if(!Re)return;const rt=Re.activityState!=="completed_unread"&&ie.activityState==="completed_unread",Ct=((vn=ie.title)==null?void 0:vn.trim())||o("common.unknown");if(d&&rt){const _n=o("conversation.backgroundCompletionToastDescription",{title:Ct});Z.current({id:`workbench-session-completed-${ie.sessionId}-${ie.completedAt??"unknown"}`,title:o("conversation.backgroundCompletionToastTitle"),description:_n,tone:"success",durationMs:8e3,action:{label:o("shell.contextOpenSession"),onClick:()=>De(ie.workspaceId,ie.sessionId)}}),pe.current.showNotification(o("conversation.backgroundCompletionToastTitle"),_n)}const jt=Re.runningState!=="failed"&&(ie.runningState??null)==="failed";if(m&&jt){const _n=Y_(ie)??o("conversation.runtimeFailed"),Wn=o("conversation.backgroundFailureToastDescription",{title:Ct,detail:_n});Z.current({id:`workbench-session-failed-${ie.sessionId}-${ie.updatedAt}`,title:o("conversation.backgroundFailureToastTitle"),description:Wn,tone:"error",durationMs:8e3,action:{label:o("shell.contextOpenSession"),onClick:()=>De(ie.workspaceId,ie.sessionId)}}),pe.current.showNotification(o("conversation.backgroundFailureToastTitle"),Wn)}}),D.current=z},[ee,Je,d,m,De]),p.useEffect(()=>{Q.current=Je.map(z=>z.session).filter(z=>z.sessionId!==ee&&K_(z)).map(z=>{var ie;return{sessionId:z.sessionId,workspaceId:z.workspaceId,title:((ie=z.title)==null?void 0:ie.trim())||o("common.unknown")}})},[ee,Je]),p.useEffect(()=>{let z=!1,ie=null;const Re=()=>{ie=window.setTimeout(()=>{rt().finally(()=>{z||Re()})},q_)},rt=async()=>{var _n;const Ct=Q.current;if(Ct.length===0){T.current||(T.current=!0);return}(_n=N.current)==null||_n.requestRefresh();const jt=new Set(Ct.map(Wn=>Wn.sessionId)),vn=await Promise.all(Ct.map(async Wn=>{try{const pn=await _T(Wn.sessionId);return{session:Wn,items:pn.items}}catch{return{session:Wn,items:null}}}));if(!z){for(const Wn of vn){if(!Wn.items)continue;const pn=Wn.items.filter(bi=>bi.status==="pending"),Or=new Set(pn.map(bi=>bi.id)),As=B.current.get(Wn.session.sessionId)??new Set;T.current&&pn.forEach(bi=>{if(As.has(bi.id)||!u)return;const ps=o("conversation.backgroundPermissionToastDescription",{title:Wn.session.title,requestTitle:bi.title});Z.current({id:`workbench-permission-request-${bi.id}`,title:o("conversation.permissionRequestToastTitle"),description:ps,tone:"warning",durationMs:8e3,action:{label:o("shell.contextOpenSession"),onClick:()=>De(Wn.session.workspaceId,Wn.session.sessionId)}}),pe.current.showNotification(o("conversation.permissionRequestToastTitle"),ps)}),B.current.set(Wn.session.sessionId,Or)}for(const[Wn,pn]of B.current.entries())!jt.has(Wn)&&pn.size===0&&B.current.delete(Wn);T.current=!0}};return rt().finally(()=>{z||Re()}),()=>{z=!0,ie!==null&&window.clearTimeout(ie)}},[u,De]),p.useEffect(()=>{if(Ne&&le.length===0)return;const z=new Set(le.map(ie=>ie.workspace.id));wt(ie=>PP(ie,z)),Be(ie=>ie&&z.has(ie)?ie:null)},[le,Ne]);const or=Je.find(z=>z.session.sessionId===ee)??null,Dn=(or==null?void 0:or.workspace.id)??(ee?Wt[ee]??null:null),lr=Fx(t.pathname,t.search),Fr=Dn??lr??Ie??null,Ut=Fr??((qn=le[0])==null?void 0:qn.workspace.id)??null,Yr=p.useMemo(()=>ne.filter(z=>!ht.has(z.id)),[ht,ne]),$=p.useMemo(()=>Yr.filter(z=>nO(z,Tn)).length,[Yr,Tn]);p.useEffect(()=>{tn&&_t(Yr)},[Yr,_t,tn]);const me=p.useCallback(z=>{Kt(!1),z.routePath&&r(z.routePath)},[r]),ge=p.useCallback(async(z,ie)=>{const Re=A.current+1;A.current=Re;try{const rt=await p_(z,ie);if(Re!==A.current)return;Rt(Ct=>{const jt=new Set(Ct);return rt.item?jt.add(rt.item.notificationId):jt.delete(z),jt})}catch(rt){if(Re!==A.current)return;Z.current({title:o("shell.globalNotificationsArchiveFailed"),description:rt instanceof Error?rt.message:void 0,tone:"error"})}},[]);p.useEffect(()=>{Dn&&Be(z=>z===Dn?z:Dn)},[Dn]),p.useEffect(()=>{sn("workbench.current_workspace_resolved",{currentSessionId:ee,sessionWorkspaceId:Dn,routeWorkspaceId:lr,currentWorkspaceId:Ut,source:Dn?or?"navigation":"sessionWorkspaceMap":lr?"route":Ie?"workspaceSelection":"navigationFallback"})},[or,ee,Ut,lr,Ie,Dn]),p.useEffect(()=>{sn("workbench.info_panel_state",{infoPanelReady:vt,rightCollapsed:Le,currentWorkspaceId:Ut,sessionWorkspaceId:Dn,currentSessionId:ee})},[ee,Ut,vt,Le,Dn]);const Ye=Ox(t.pathname)?"terminals":lO(t.pathname)?"butler":"conversation",Ge=e==="mobile",gt=sO(e),cn=p.useMemo(()=>le.map(z=>{const ie=bP(z.sessions);return{workspace:z.workspace,visibleSessions:ie,archivedSessions:z.sessions.filter(Re=>zs(Re)&&!fm(Re)),visibleSessionTree:uw(ie,c).filter(Re=>!on.has(Re.item.sessionId)&&!om(Ss(Re),rt=>on.has(rt.sessionId))),childWorktrees:kP(z.childWorktrees,on,c),isCollapsed:Et.has(z.workspace.id)}}),[Et,on,le,c]),jn=p.useMemo(()=>hm(le),[le]),zn=p.useMemo(()=>TO(le,Ut),[Ut,le]),Zr=p.useMemo(()=>Ut?(zn==null?void 0:zn.workspace)??le.map(z=>z.workspace).find(z=>z.id===Ut)??null:null,[Ut,zn,le]),Gi=(zn==null?void 0:zn.meta)??null,kr=(Ut?jn[Ut]??null:null)??(Zr?ku(Zr):null),li=Gi?Se[Gi.workspaceId]??null:null,ci=p.useMemo(()=>Je.filter(z=>on.has(z.session.sessionId)&&!zs(z.session)&&!Bg(z.session)),[on,Je]),Bn=t.pathname.startsWith("/settings")?"settings":Ox(t.pathname)?"terminals":oO(t.pathname)?"tools":aO(t.pathname)||_x(t.pathname)?"sessions":"workspaces",ei=Ge&&Bn==="sessions"&&_x(t.pathname),ui=cm({isNativeMobile:i.isNativeMobile,viewportClass:i.viewportClass}),Ki=bu({viewportClass:i.viewportClass,activeEntry:Bn,hasNavigationPanel:Ge,hasAuxiliaryPanel:Ge,preferCompactLayout:ui}),Oi=Ge&&bT(Ki),Ks=Ge&&wT(Ki),V=p.useMemo(()=>le.map(z=>z.workspace),[le]),be=p.useMemo(()=>{const z=se.trim().toLowerCase();return z?Je.filter(ie=>{const Re=(ie.session.title||"").toLowerCase(),rt=ie.workspace.name.toLowerCase(),Ct=gm(ie.session.provider,"full").toLowerCase();return Re.includes(z)||rt.includes(z)||Ct.includes(z)}):[]},[Je,se]);p.useEffect(()=>{var ie;const z=Ut??((ie=le[0])==null?void 0:ie.workspace.id)??"";z&&Tt(Re=>Re&&le.some(Ct=>Ct.workspace.id===Re)?Re:z)},[Ut,le]),p.useEffect(()=>{ee&&!Ke&&ho(ff,`${t.pathname}${t.search}`)},[ee,Ke,t.pathname,t.search]),p.useEffect(()=>{if(ee&&Ke){x.current=`${t.pathname}${t.search}`;return}ee&&!Ke&&(x.current=null)},[ee,Ke,t.pathname,t.search]),p.useEffect(()=>{Ge||(We(!1),ct(!1))},[Ge]),p.useEffect(()=>{!Ge||Ne||!iO(t.pathname)||Fr||(We(!1),ct(!1),r(gt,{replace:!0}))},[Fr,Ge,t.pathname,r,Ne,gt]);function at(){if(Ge){We(!0);return}he(!1)}function ot(){if(di(),Ge){ct(!0);return}Oe(!1)}function qt(){if(Ge){We(z=>!z);return}he(z=>!z)}function Bi(){if(di(),Ge){ct(z=>!z);return}Oe(z=>!z)}function di(){ft(!0)}function pa(z){Be(z),di(),ee&&Dn!==z&&r(gt)}const Ds=p.useCallback(async z=>{var rt;const ie=((rt=Je.find(Ct=>Ct.session.sessionId===z))==null?void 0:rt.session)??null,Re=(ie==null?void 0:ie.isFavorite)!==!0;oe(Ct=>Kx(Ct,z,Re));try{const Ct=await tF(z,Re);bn(Ct),Ce()}catch(Ct){throw oe(jt=>Kx(jt,z,!Re)),Ct}},[Je,Ce,bn]),fa=p.useCallback((z,ie)=>{fP(z,ie).then(()=>{r(hT(z,ie))}).catch(Re=>{a({title:Re instanceof Error?Re.message:o("shell.startSessionFailed"),tone:"error"})})},[r,a]),Rs=p.useCallback(z=>{var rt;const ie=((rt=z.workspaceId)==null?void 0:rt.trim())||Ut,Re=cO(z.filePath);return!ie||!Re?!1:(di(),Ae("files"),Ge?(We(!1),ct(!0)):Oe(!1),te({requestId:C.current+1,workspaceId:ie,filePath:Re,openViewer:z.openViewer===!0}),C.current+=1,!0)},[Ut,Ge]),Ys=p.useCallback(async(z,ie)=>{const Re=await LT(z,ie.trim());return bn(Re),Re},[bn]);function ga(z){ln(!0)}function Lo(){ln(!1),Sn("sessions"),He(""),Ht(null),dn([]),wn(!1)}async function Fo(){const z=se.trim();if(!z||!xt.trim()){dn([]),Ht(null);return}wn(!0),Ht(null);try{const ie=await Pc(xt,z);dn(ie.items)}catch(ie){dn([]),Ht(ie instanceof Error?ie.message:o("shell.searchCodeFailed"))}finally{wn(!1)}}function _o(z,ie){const Re=z==="left"?st:bt;function rt(jt){const vn=jt.clientX-ie;if(z==="left"){dt(Ad(Re+vn,Dd,Rx));return}pt(Ad(Re-vn,Dd,Mx))}function Ct(){document.removeEventListener("mousemove",rt),document.removeEventListener("mouseup",Ct)}document.addEventListener("mousemove",rt),document.addEventListener("mouseup",Ct)}function hi(){if(K())return;if(Je.length===0){r(gt);return}const z=Nr(Je[0].workspace.id,Je[0].session.sessionId);r(z)}function Oo(){if(!K(Ut)){if(Ut){r(Co(Ut));return}r(gt)}}function K(z){if(ee)return z&&Dn&&Dn!==z?!1:(r(`${t.pathname}${t.search}`),!0);if(x.current){if(z){const[Re,rt=""]=x.current.split("?"),Ct=Fx(Re??x.current,rt?`?${rt}`:"");if(Ct&&Ct!==z)return!1}return r(x.current),!0}const ie=typeof window>"u"?null:window.localStorage.getItem(ff);if(ie){const Re=ie.split("?")[0]??ie,rt=Lc(Re);if(rt){const Ct=rt.sessionId,jt=Je.find(Wn=>Wn.session.sessionId===Ct)??null,vn=rt.workspaceId??(jt==null?void 0:jt.workspace.id)??null;if(jt!==null&&(!z||vn===z))return r(ie),!0}window.localStorage.removeItem(ff)}return!1}p.useEffect(()=>{if(typeof window>"u")return;function z(ie){if(!(ie.metaKey||ie.ctrlKey)){ie.key==="Escape"&&(We(!1),ct(!1));return}if(jO(ie.target))return;const rt=ie.key.toLowerCase();if(!ie.shiftKey&&rt==="b"){ie.preventDefault(),qt();return}if(ie.shiftKey&&rt==="i"){ie.preventDefault(),Bi();return}if(!ie.shiftKey&&rt===","){ie.preventDefault(),r("/settings");return}if(!ie.shiftKey&&rt==="1"){ie.preventDefault(),hi();return}if(!ie.shiftKey&&rt==="2"){ie.preventDefault(),r(Ut?vl(Ut):Ti());return}if(!ie.shiftKey&&rt==="k"){ie.preventDefault(),NO();return}ie.shiftKey&&rt==="r"&&(ie.preventDefault(),mn())}return window.addEventListener("keydown",z),()=>{window.removeEventListener("keydown",z)}},[r,mn,Ge,hi]);const fe=p.useMemo(()=>({shellMode:e,navigationGroups:le,navigationLoading:Ne,navigationError:Te,currentWorkspaceId:Ut,currentSessionId:ee,favoriteSessionIds:an,favoriteSessions:ci,globalNotifications:ne,archivedNotificationIds:Array.from(ht),showArchivedNotifications:$t,unreadNotificationCount:$,refreshNavigation:mn,requestNavigationRefresh:Ce,openNotificationPanel:()=>{Kt(!0)},closeNotificationPanel:()=>{Kt(!1)},setShowArchivedNotifications:Zt,archiveNotification:z=>{ge(z,!0)},unarchiveNotification:z=>{ge(z,!1)},setAuxiliaryPanel:Bt,subscribeFileTree:mt,requestFileTreeRefresh:Mt,addFileTreeSnapshotListener:en,subscribeGitSnapshot:An,requestGitRefresh:zt,addGitSnapshotListener:er,subscribeWorkspaceManagementSnapshot:fr,requestWorkspaceManagementRefresh:Hn,addWorkspaceManagementSnapshotListener:ir,workspaceManagementStateById:re,subscribeTerminalManagerSnapshot:_i,requestTerminalManagerRefresh:Hr,addTerminalManagerSnapshotListener:sr,selectWorkspace:pa,toggleFavoriteSession:Ds,archiveSession:z=>un(z,!0),unarchiveSession:z=>un(z,!1),renameSession:Ys,startDraftSession:fa,markNavigationSessionSeen:Pr,upsertNavigationSession:bn,setSessionWorkspace:Jr,revealWorkspaceFile:Rs}),[en,er,ir,sr,un,ee,Ut,ne,an,ci,pa,ht,Pr,Te,le,Ne,$,Mt,zt,Hn,mn,Ce,Zt,Bt,Hr,Ys,$t,re,e,fa,Jr,mt,An,fr,_i,ge,Ds,bn,Rs]),Fe={"--workbench-left-width":`${st}px`,"--workbench-left-current-width":we?"0px":`${st}px`,"--workbench-right-width":`${bt}px`,"--workbench-right-current-width":Le?"0px":`${bt}px`},ut=Ye==="butler"?Vt:n.jsx(Jx,{panelReady:vt,activeTab:ve,fileRevealRequest:hn,onTabChange:z=>{di(),Ae(z)},currentSessionId:Ke?null:ee,activeWorkspaceId:Ut,navigationGroups:le,workspaceContext:kr,worktreeMeta:Gi,worktreeMergeState:li,onRefreshWorktreeMergePreview:vr,onApplyWorktreeMerge:On,onCleanupWorktree:Sr}),kt=ut!==null,gn=Ge?n.jsx(Qx,{workspaceGroups:cn,workspaceVisualContextMap:jn,sessionDisplaySortMode:c,favoriteSessions:ci,favoriteSessionIds:on,activeWorkspaceId:Ut,isConversationActive:Ye==="conversation",isTerminalActive:Ye==="terminals",isButlerActive:Ye==="butler",isSearchOpen:Nt,navigationLoading:Ne,navigationError:Te,activeSessionId:ee,onRefreshNavigation:mn,onSessionUpdated:bn,onNavigateConversation:hi,onNavigateTerminals:()=>{We(!1),r(Ut?vl(Ut):Ti())},onNavigateButler:()=>{We(!1),r(Ut?jo(Ut):Ti())},onOpenSearch:()=>{We(!1),ga()},onOpenSettings:()=>{We(!1),r("/settings")},onSelectWorkspace:pa,onToggleWorkspaceCollapse:Dr,onStartWorkspaceReorder:zr,onPreviewWorkspaceReorder:qr,onCommitWorkspaceReorder:yr,allowWorkspaceReorder:!1,subscribeGitSnapshot:An,requestGitRefresh:zt,subscribeWorkspaceManagementSnapshot:fr,requestWorkspaceManagementRefresh:Hn,onToggleFavoriteSession:Ds,onArchiveSession:z=>un(z,!0),onUnarchiveSession:z=>un(z,!1),workspaceManagementStateById:re,setWorkspaceManagementStateById:ue,unreadNotificationCount:$,notificationPanelOpen:tn,onToggleNotificationPanel:()=>{Kt(z=>!z)},onClose:()=>We(!1)}):null,Ot=Ge&&kt?ut:null;return n.jsxs(gP.Provider,{value:fe,children:[Ge?n.jsx(n.Fragment,{children:n.jsx(cL,{activeEntry:Bn,presentation:ei?"conversation-focus":"default",navigationPanel:gn,auxiliaryPanel:Ot,onOpenNavigation:()=>{ct(!1),We(!0)},onOpenSearch:()=>{We(!1),ct(!1),ga()},onOpenAuxiliary:()=>{kt&&(di(),We(!1),ct(!0))},onNavigateWorkspaces:()=>{We(!1),ct(!1),r(Ti())},onNavigateTerminals:()=>{We(!1),ct(!1),r(Ut?vl(Ut):Ti())},onNavigateSessions:()=>{We(!1),ct(!1),Oo()},onNavigateTools:()=>{We(!1),ct(!1),r(Ut?El(Ut):Ti())},onNavigateToolFiles:()=>{We(!1),ct(!1),r(Ut?cT(Ut):Ti())},onNavigateToolGit:()=>{We(!1),ct(!1),r(Ut?uT(Ut):Ti())},onNavigateToolProcesses:()=>{We(!1),ct(!1),r(Ut?lm(Ut):Ti())},onNavigateSettings:()=>{We(!1),ct(!1),r("/settings")},children:n.jsx(Rg,{})})}):n.jsx("div",{className:"workbench-shell",style:Fe,"data-nav-loading":Ne,"data-left-collapsed":we,"data-right-collapsed":Le,"data-info-ready":vt,"data-runtime-platform":i.platform,"data-os-family":i.ui.osFamily,"data-overlay-titlebar":i.ui.prefersOverlayTitlebar,children:n.jsxs("div",{className:"workbench-body-shell",children:[n.jsx("aside",{className:"workbench-nav surface-card","data-collapsed":we,children:n.jsx(Qx,{workspaceGroups:cn,workspaceVisualContextMap:jn,sessionDisplaySortMode:c,favoriteSessions:ci,favoriteSessionIds:on,activeWorkspaceId:Ut,isConversationActive:Ye==="conversation",isTerminalActive:Ye==="terminals",isButlerActive:Ye==="butler",isSearchOpen:Nt,navigationLoading:Ne,navigationError:Te,activeSessionId:ee,onRefreshNavigation:mn,onSessionUpdated:bn,onNavigateConversation:hi,onNavigateTerminals:()=>r(Ut?vl(Ut):Ti()),onNavigateButler:()=>r(Ut?jo(Ut):Ti()),onOpenSearch:()=>ga(),onOpenSettings:()=>r("/settings"),onSelectWorkspace:pa,onToggleWorkspaceCollapse:Dr,onStartWorkspaceReorder:zr,onPreviewWorkspaceReorder:qr,onCommitWorkspaceReorder:yr,allowWorkspaceReorder:!0,subscribeGitSnapshot:An,requestGitRefresh:zt,subscribeWorkspaceManagementSnapshot:fr,requestWorkspaceManagementRefresh:Hn,onToggleFavoriteSession:Ds,onArchiveSession:z=>un(z,!0),onUnarchiveSession:z=>un(z,!1),workspaceManagementStateById:re,setWorkspaceManagementStateById:ue,unreadNotificationCount:$,notificationPanelOpen:tn,onToggleNotificationPanel:()=>{Kt(z=>!z)},onToggleCollapse:()=>he(!0)})}),n.jsx("div",{className:"workbench-side-resizer","data-side":"left","data-collapsed":we,role:"separator","aria-label":o("shell.leftResizerLabel"),onMouseDown:we?void 0:z=>_o("left",z.clientX)}),n.jsxs("div",{className:"workbench-main-shell",children:[n.jsxs("div",{className:"workbench-collapsed-rail","aria-hidden":!we&&!Le,children:[n.jsxs("div",{className:"workbench-collapsed-controls left","data-visible":we,children:[n.jsx(Xx,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:o("shell.showSessionSidebar"),side:"left",collapsed:!0,onClick:at}),n.jsx(dP,{collapsed:!0}),n.jsx(_P,{unreadCount:$,open:tn,onToggle:()=>{Kt(z=>!z)},collapsed:!0}),n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button workbench-collapsed-button","aria-label":o("shell.goBack"),title:o("shell.goBack"),onClick:()=>r(-1),children:n.jsx(OP,{})}),n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button workbench-collapsed-button","aria-label":o("shell.goForward"),title:o("shell.goForward"),onClick:()=>r(1),children:n.jsx(BP,{})})]}),kt?n.jsx("div",{className:"workbench-collapsed-controls right","data-visible":Le,children:n.jsx(Xx,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:o("shell.showInfoSidebar"),side:"right",collapsed:!0,onClick:ot})}):null]}),n.jsx(Rg,{})]}),kt?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"workbench-side-resizer","data-side":"right","data-collapsed":Le,role:"separator","aria-label":o("shell.rightResizerLabel"),onMouseDown:Le?void 0:z=>_o("right",z.clientX)}),n.jsx("aside",{className:"workbench-auxiliary surface-card","data-workspace-tone":(kr==null?void 0:kr.tone)??"root","data-worktree-depth":(kr==null?void 0:kr.depth)??0,"data-collapsed":Le,"data-custom-panel":Ye==="butler",style:os(kr),children:Ye==="butler"?n.jsx("div",{className:"workbench-auxiliary-custom-panel",children:Vt}):n.jsx(Jx,{panelReady:vt,activeTab:ve,fileRevealRequest:hn,onTabChange:z=>{di(),Ae(z)},onToggleCollapse:()=>Oe(!0),currentSessionId:Ke?null:ee,activeWorkspaceId:Ut,navigationGroups:le,workspaceContext:kr,worktreeMeta:Gi,worktreeMergeState:li,onRefreshWorktreeMergePreview:vr,onApplyWorktreeMerge:On,onCleanupWorktree:Fi})})]}):null]})}),n.jsx(qO,{open:tn,notifications:ne,archivedNotificationIds:ht,showArchivedNotifications:$t,onClose:()=>Kt(!1),onToggleShowArchivedNotifications:Zt,onArchiveNotification:z=>{ge(z,!0)},onUnarchiveNotification:z=>{ge(z,!1)},onSelectNotification:me,preferredWorkspaceId:Ut,preferredSessionId:Ke?null:ee}),n.jsx(s2,{open:Nt,mode:Jt,keyword:se,codeWorkspaceId:xt,codeResults:Gt,codeLoading:Mn,codeError:kn,workspaceOptions:V,sessionResults:be,onClose:Lo,onModeChange:z=>{Sn(z),Ht(null),dn([])},onKeywordChange:z=>{He(z),Jt==="code"&&!z.trim()&&(dn([]),Ht(null))},onCodeWorkspaceChange:z=>Tt(z),onCodeSearch:()=>{Fo()},onOpenSession:z=>{Lo();const ie=Je.find(Re=>Re.session.sessionId===z)??null;r(ie?Nr(ie.workspace.id,z):Ti())}}),n.jsxs(Ln,{open:ze!==null,title:o("shell.worktreeCleanupModalTitle"),description:o("shell.worktreeCleanupModalDescription"),onClose:()=>{var z;ze&&((z=Se[ze.workspaceId])!=null&&z.cleaning)||(Ve(!1),yt(null))},children:[n.jsx("p",{className:"workbench-section-empty",children:ze?o("shell.worktreeCleanupConfirm",{name:ze.displayName||ze.branchName}):""}),ze?n.jsxs("div",{className:"worktree-cleanup-modal-options",children:[n.jsxs("label",{className:"conversation-selection-checkbox worktree-cleanup-modal-option",children:[n.jsx("input",{type:"checkbox",checked:nt,disabled:!!((_r=Se[ze.workspaceId])!=null&&_r.cleaning)||((Yi=(Wi=Se[ze.workspaceId])==null?void 0:Wi.preview)==null?void 0:Yi.alreadyMerged)!==!0,onChange:z=>Ve(z.target.checked)}),n.jsx("span",{children:o("shell.worktreeCleanupDeleteBranchLabel",{branch:ze.branchName})})]}),((Ms=(Gn=Se[ze.workspaceId])==null?void 0:Gn.preview)==null?void 0:Ms.alreadyMerged)!==!0?n.jsx("p",{className:"conversation-selection-hint worktree-cleanup-modal-hint",children:o("shell.worktreeCleanupDeleteBranchHint")}):null]}):null,n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:!!(ze&&((Xi=Se[ze.workspaceId])!=null&&Xi.cleaning)),onClick:()=>{Ve(!1),yt(null)},children:o("common.cancel")}),n.jsx("button",{type:"button",className:nt&&ze&&((Bo=($n=Se[ze.workspaceId])==null?void 0:$n.preview)==null?void 0:Bo.alreadyMerged)===!0?"secondary-button workbench-danger-button":"primary-button",disabled:!ze||!!(ze&&((ba=Se[ze.workspaceId])!=null&&ba.cleaning)),onClick:()=>{ze&&Sr(ze)},children:ze&&((Wo=Se[ze.workspaceId])!=null&&Wo.cleaning)?o("shell.worktreeCleanupRunning"):nt&&ze&&((wa=(Uo=Se[ze.workspaceId])==null?void 0:Uo.preview)==null?void 0:wa.alreadyMerged)===!0?o("shell.worktreeCleanupDeleteBranchAction"):o("shell.worktreeCleanupAction")})]})]}),Ge?n.jsxs(n.Fragment,{children:[Oi?null:n.jsx(Zx,{isOpen:et,side:"left",onClose:()=>We(!1),children:gn}),Ks?null:n.jsx(Zx,{isOpen:lt,side:"right",onClose:()=>ct(!1),children:Ot})]}):null]})}function Zx({isOpen:e,side:t,onClose:r,children:i,className:a,overlayClassName:c}){if(!e)return null;const u=n.jsxs(n.Fragment,{children:[n.jsx("div",{className:["mobile-nav-overlay","open",c].filter(Boolean).join(" "),onClick:r,role:"button",tabIndex:0,"aria-label":o("common.back"),onKeyDown:d=>{d.key==="Escape"&&r()}}),n.jsx("div",{className:["mobile-nav-drawer",t,"open",a].filter(Boolean).join(" "),children:i})]});return typeof document>"u"?u:Vn.createPortal(u,document.body)}function Tr(){return p.useContext(gP)??{navigationGroups:[],navigationLoading:!1,navigationError:null,shellMode:"desktop",currentWorkspaceId:null,currentSessionId:null,favoriteSessionIds:[],favoriteSessions:[],globalNotifications:[],archivedNotificationIds:[],showArchivedNotifications:!1,unreadNotificationCount:0,refreshNavigation:async()=>{},requestNavigationRefresh:()=>{},openNotificationPanel:()=>{},closeNotificationPanel:()=>{},setShowArchivedNotifications:()=>{},archiveNotification:()=>{},unarchiveNotification:()=>{},setAuxiliaryPanel:()=>{},subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{},subscribeWorkspaceManagementSnapshot:()=>{},requestWorkspaceManagementRefresh:()=>{},addWorkspaceManagementSnapshotListener:()=>()=>{},workspaceManagementStateById:{},subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{},selectWorkspace:()=>{},toggleFavoriteSession:async()=>{},archiveSession:async()=>{},unarchiveSession:async()=>{},renameSession:async()=>{throw new Error("workbench shell unavailable")},startDraftSession:()=>{},setSessionWorkspace:()=>{},upsertNavigationSession:()=>{},markNavigationSessionSeen:()=>{},revealWorkspaceFile:()=>!1}}function HP(e){return e.startsWith("draft-")}function vf(e,t){if(!e)return{allowed:!1,hidden:!1,reason:o("conversation.capabilityDenied")};switch(t){case"send_message":return e.canSendMessage===!1?{allowed:!1,hidden:!1,reason:o("conversation.capabilitySendDisabled")}:{allowed:!0,hidden:!1,reason:null};case"attachments":return e.supportsAttachments?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:o("conversation.capabilityAttachmentDisabled")};case"interrupt":return e.supportsInterrupt?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:o("conversation.capabilityInterruptDisabled")};default:return{allowed:!1,hidden:!1,reason:o("conversation.capabilityDenied")}}}const d2=new Set(["updateplan"]),zP=new Set(["todowrite"]),Hg=new Set(["todoread"]),qP=new Set(["taskcreate","taskupdate","taskget","tasklist","taskdelete","taskremove"]);function h2(e,t){const r=p2(e,t);return r||f2(e,t)}function $P(e){return e.reduce((t,r)=>(t[r.status]+=1,t),{pending:0,in_progress:0,completed:0,failed:0,cancelled:0})}function m2(e,t,r){if(!e)return null;if(zg(e.name)){const u=xl(e);if(!u||!vm(u.value))return null;const d=VP(u.value,r);return!d||d.items.length===0?null:{provider:t,source:"plan",explanation:d.explanation,items:d.items,updatedAt:r}}const i=wm(e.name);if(!zP.has(i)&&!Hg.has(i)&&!qP.has(i))return null;const a=xl(e,(Hg.has(i),"prefer-output"));if(!a)return null;if(i==="taskdelete"||i==="taskremove"){const u=GP(a.value);return u.length>0?{provider:t,source:"todo",explanation:null,items:u.map((d,m)=>({id:d,title:`Task ${m+1}`,status:"cancelled",detail:d,updatedAt:r})),updatedAt:r}:null}const c=Ac(a.value,r);return c.length===0?null:{provider:t,source:zg(e.name)?"plan":"todo",explanation:null,items:c,updatedAt:r}}function p2(e,t){let r=null;for(const i of e){const a=i.toolCall;if(!a||wm(a.name)===""||!zg(a.name))continue;const c=xl(a);if(!c||typeof c.value!="object"||c.value===null)continue;const u=VP(c.value,i.timestamp);!u||u.items.length===0||(r={provider:t,source:"plan",explanation:u.explanation,items:u.items,updatedAt:i.timestamp})}return r}function f2(e,t){const r=new Map;let i=null;for(const c of e){const u=c.toolCall;if(!u)continue;const d=wm(u.name);if(zP.has(d)){const w=xl(u),g=w?Ac(w.value,c.timestamp):[];g.length>0&&(yf(r,g),i=c.timestamp);continue}if(Hg.has(d)){const w=xl(u,"prefer-output"),g=w?Ac(w.value,c.timestamp):[];g.length>0&&(yf(r,g),i=c.timestamp);continue}if(!qP.has(d))continue;const m=xl(u,"prefer-output");if(!m)continue;if(d==="tasklist"||d==="taskget"){const w=Ac(m.value,c.timestamp);w.length>0&&(yf(r,w),i=c.timestamp);continue}if(d==="taskdelete"||d==="taskremove"){const w=GP(m.value);if(w.length>0){for(const g of w)r.delete(g);i=c.timestamp}continue}const f=Ac(m.value,c.timestamp);if(f.length!==0){for(const w of f)b2(r,w);i=c.timestamp}}const a=Array.from(r.values()).sort((c,u)=>c.updatedAt.localeCompare(u.updatedAt)).map(c=>({...c}));return a.length===0||!i?null:{provider:t,source:"todo",explanation:null,items:a,updatedAt:i}}function zg(e){return d2.has(wm(e))}function VP(e,t){const r=Array.isArray(e.plan)?e.plan:null;if(!r||r.length===0)return null;const i=r.map((a,c)=>KP(a,{fallbackIdPrefix:"plan",fallbackTitle:`Step ${c+1}`,fallbackStatus:"pending",updatedAt:t})).filter(a=>a!==null);return i.length===0?null:{items:i,explanation:wr(e.explanation)}}function xl(e,t="prefer-input"){const r=t==="prefer-output"?[{text:e.output,source:"output"},{text:e.input,source:"input"}]:[{text:e.input,source:"input"},{text:e.output,source:"output"}];for(const i of r){const a=g2(i.text);if(a!==null)return{value:a,source:i.source}}return null}function g2(e){const t=(e==null?void 0:e.trim())??"";if(!t)return null;const r=Id(t);if(r!==null)return r;const i=t.match(/```(?:json)?\s*([\s\S]+?)```/i);if(i!=null&&i[1]){const m=Id(i[1].trim());if(m!==null)return m}const a=t.indexOf("{"),c=t.lastIndexOf("}");if(a>=0&&c>a){const m=Id(t.slice(a,c+1));if(m!==null)return m}const u=t.indexOf("["),d=t.lastIndexOf("]");return u>=0&&d>u?Id(t.slice(u,d+1)):null}function Id(e){try{return JSON.parse(e)}catch{return null}}function Ac(e,t){return Fc(e).map((i,a)=>KP(i,{fallbackIdPrefix:"task",fallbackTitle:`Task ${a+1}`,fallbackStatus:"pending",updatedAt:t})).filter(i=>i!==null)}function Fc(e){if(Array.isArray(e))return e.flatMap(r=>Fc(r));if(!vm(e))return[];if(k2(e))return[e];const t=["tasks","todos","items","entries","results","data"];for(const r of t){if(!(r in e))continue;const i=Fc(e[r]);if(i.length>0)return i}return Object.values(e).flatMap(r=>Fc(r))}function GP(e){const r=Fc(e).map(a=>qg(a)).filter(a=>a!==null);if(r.length>0)return r;if(!vm(e))return[];const i=qg(e);return i?[i]:[]}function KP(e,t){if(!vm(e))return null;const r=wr(e.step)??wr(e.title)??wr(e.content)??wr(e.task)??wr(e.text)??wr(e.name)??wr(e.subject)??wr(e.description)??t.fallbackTitle,i=qg(e)??y2(t.fallbackIdPrefix,r),a=v2(e,r);return{id:i,title:r,status:w2(e.status,t.fallbackStatus),detail:a,updatedAt:t.updatedAt}}function b2(e,t){const r=e.get(t.id);if(!r){e.set(t.id,{...t});return}e.set(t.id,{id:r.id,title:t.title||r.title,status:t.status,detail:t.detail??r.detail,updatedAt:t.updatedAt})}function yf(e,t){e.clear();for(const r of t)e.set(r.id,{...r})}function w2(e,t){var i;const r=(i=wr(e))==null?void 0:i.toLowerCase().replace(/[\s-]+/g,"_");return r?["pending","todo","open","queued","not_started","created"].includes(r)?"pending":["in_progress","progress","active","doing","running","started"].includes(r)?"in_progress":["completed","complete","done","success","succeeded","finished","closed"].includes(r)?"completed":["failed","error","errored"].includes(r)?"failed":["cancelled","canceled","aborted","skipped"].includes(r)?"cancelled":t:t}function v2(e,t){const r=[wr(e.detail),wr(e.details),wr(e.description),wr(e.reason),wr(e.summary),wr(e.note),wr(e.priority)].filter(i=>i!==null);for(const i of r)if(i!==t)return i;return null}function qg(e){return wr(e.id)??wr(e.taskId)??wr(e.task_id)??wr(e.uuid)??wr(e.key)}function y2(e,t){return`${e}:${t.trim().toLowerCase()}`}function k2(e){return[e.step,e.title,e.content,e.task,e.text,e.subject,e.name,e.description].some(t=>wr(t)!==null)}function wm(e){return e.trim().toLowerCase().replace(/[\s_.-]+/g,"")}function vm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function wr(e){if(typeof e!="string")return null;const t=e.trim();return t||null}function x2(){return n.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[n.jsx("rect",{x:"7",y:"5",width:"9",height:"11",rx:"2.5"}),n.jsx("path",{d:"M5.5 12.5H5A2 2 0 0 1 3 10.5V5a2 2 0 0 1 2-2h5.5"})]})}function S2(){return n.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[n.jsx("circle",{cx:"6",cy:"5",r:"2.25"}),n.jsx("circle",{cx:"14",cy:"6",r:"2.25"}),n.jsx("circle",{cx:"14",cy:"14",r:"2.25"}),n.jsx("path",{d:"M8.4 5.7h2.2a2.7 2.7 0 0 1 2.7 2.7v1.2"}),n.jsx("path",{d:"M8.1 5.9l4.1 6.2"})]})}function C2(){return n.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[n.jsx("path",{d:"M10 2.8l1.6 3.4 3.8.5-2.8 2.6.7 3.9-3.3-1.8-3.3 1.8.7-3.9-2.8-2.6 3.8-.5L10 2.8z"}),n.jsx("path",{d:"M15.8 13.3l.7 1.5 1.7.2-1.2 1.1.3 1.8-1.5-.8-1.5.8.3-1.8-1.2-1.1 1.7-.2.7-1.5z"})]})}function j2(){return n.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[n.jsx("circle",{cx:"6",cy:"5",r:"2.2"}),n.jsx("circle",{cx:"14",cy:"5",r:"2.2"}),n.jsx("circle",{cx:"10",cy:"14",r:"2.2"}),n.jsx("path",{d:"M8.2 5h3.6"}),n.jsx("path",{d:"M10 7.2v4.6"}),n.jsx("path",{d:"M7.3 6.8l1.7 4"}),n.jsx("path",{d:"M12.7 6.8l-1.7 4"})]})}function N2({expanded:e}){return n.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[n.jsx("path",{d:"M4 6.5h8"}),n.jsx("path",{d:"M4 10h8"}),n.jsx("path",{d:"M4 13.5h5"}),e?n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M14 12.8V7.2"}),n.jsx("path",{d:"M11.8 9.4L14 7.2l2.2 2.2"})]}):n.jsxs(n.Fragment,{children:[n.jsx("path",{d:"M14 7.2v5.6"}),n.jsx("path",{d:"M11.8 10.6L14 12.8l2.2-2.2"})]})]})}function T2(){return n.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",className:"conversation-action-icon",children:[n.jsx("path",{d:"M4.5 5.5h1.2"}),n.jsx("path",{d:"M8 5.5h7.5"}),n.jsx("path",{d:"M4.5 10h1.2"}),n.jsx("path",{d:"M8 10h7.5"}),n.jsx("path",{d:"M4.5 14.5h1.2"}),n.jsx("path",{d:"M8 14.5h7.5"}),n.jsx("path",{d:"M5.1 5.5l.5.5 1-1"}),n.jsx("circle",{cx:"5.1",cy:"10",r:".8",fill:"currentColor",stroke:"none"}),n.jsx("path",{d:"M5.1 14.5l.5.5 1-1"})]})}const eS={in_progress:0,failed:1,pending:2,completed:3,cancelled:4};function P2({provider:e,messages:t,variant:r="header"}){const[i,a]=p.useState(!1),c=p.useMemo(()=>h2(t,e),[t,e]);if(!c||c.items.length===0)return null;const u=$P(c.items),d=u.in_progress||u.pending,m=d>0?d:c.items.length,f=[...c.items].sort((g,v)=>{const y=eS[g.status]-eS[v.status];return y!==0?y:g.updatedAt.localeCompare(v.updatedAt)}),w=r==="composer"?"conversation-task-progress-button composer-task-progress-button":"conversation-header-ai-button conversation-task-progress-button";return n.jsxs(n.Fragment,{children:[n.jsxs("button",{type:"button",className:w,"data-variant":r,"aria-label":o("conversation.taskProgressButton",{count:c.items.length}),title:o("conversation.taskProgressButton",{count:c.items.length}),onClick:()=>{a(!0)},children:[n.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:n.jsx(T2,{})}),n.jsx("span",{className:"conversation-task-progress-badge",children:m})]}),n.jsx(Ln,{open:i,title:o("conversation.taskProgressModalTitle"),description:o("conversation.taskProgressModalDescription",{count:c.items.length}),className:"conversation-task-progress-modal",onClose:()=>{a(!1)},children:n.jsxs("div",{className:"conversation-task-progress-modal-body",children:[n.jsxs("div",{className:"conversation-task-progress-summary",children:[n.jsx(mc,{label:o("conversation.taskProgressSummaryTotal"),value:c.items.length}),n.jsx(mc,{label:o("conversation.taskProgressStatusInProgress"),value:u.in_progress}),n.jsx(mc,{label:o("conversation.taskProgressStatusPending"),value:u.pending}),n.jsx(mc,{label:o("conversation.taskProgressStatusCompleted"),value:u.completed}),u.failed>0?n.jsx(mc,{label:o("conversation.taskProgressStatusFailed"),value:u.failed}):null]}),c.explanation?n.jsxs("div",{className:"conversation-task-progress-explanation",children:[n.jsx("strong",{children:o("conversation.taskProgressExplanationTitle")}),n.jsx("p",{children:c.explanation})]}):null,n.jsx("ol",{className:"conversation-task-progress-list",children:f.map(g=>n.jsxs("li",{className:"conversation-task-progress-item","data-status":g.status,children:[n.jsx("span",{className:"conversation-task-progress-item-indicator","data-status":g.status,"aria-hidden":"true"}),n.jsxs("div",{className:"conversation-task-progress-item-body",children:[n.jsxs("div",{className:"conversation-task-progress-item-header",children:[n.jsx("strong",{children:g.title}),n.jsx("span",{className:"conversation-task-progress-item-status",children:D2(g.status)})]}),g.detail?n.jsx("p",{className:"conversation-task-progress-item-detail",children:g.detail}):null]})]},g.id))})]})})]})}function mc({label:e,value:t}){return n.jsxs("div",{className:"conversation-task-progress-summary-card",children:[n.jsx("span",{children:e}),n.jsx("strong",{children:t})]})}function D2(e){switch(e){case"in_progress":return o("conversation.taskProgressStatusInProgress");case"completed":return o("conversation.taskProgressStatusCompleted");case"failed":return o("conversation.taskProgressStatusFailed");case"cancelled":return o("conversation.taskProgressStatusCancelled");case"pending":default:return o("conversation.taskProgressStatusPending")}}const R2="codingns.conversation.composer-draft:",M2=1,A2=[{id:"builtin-stage-and-summarize",text:"请将本次会话变更的所有代码提交到git暂存区,然后总结一条中文的提交信息"},{id:"builtin-review-module",text:"分析本项目 模块的代码实现,并分析存在的问题"},{id:"builtin-group-commits",text:"分析当前项目中的未提交文件,按照功能模块进行分类提交,提交信息格式请参考我最近的提交记录"}];function dw(){return typeof window<"u"&&typeof window.localStorage<"u"}function E2(e){if(!e||typeof e!="object")return null;const t="id"in e?e.id:null,r="fileName"in e?e.fileName:null,i="mimeType"in e?e.mimeType:null,a="fileSize"in e?e.fileSize:null,c="lastModified"in e?e.lastModified:null,u="contentBase64"in e?e.contentBase64:null;if(typeof t!="string"||typeof r!="string"||typeof i!="string"||typeof a!="number"||typeof c!="number"||typeof u!="string")return null;const d=t.trim(),m=r.trim(),f=i.trim(),w=u.trim();return!d||!m||!f||a<0||c<0||!w?null:{id:d,fileName:m,mimeType:f,fileSize:a,lastModified:c,contentBase64:w}}function I2(e){if(!e||typeof e!="object")return null;const t="content"in e?e.content:null,r="attachments"in e?e.attachments:null;if(typeof t!="string"||!Array.isArray(r))return null;const i=r.map(a=>E2(a)).filter(a=>a!==null);return i.length!==r.length||t.length===0&&i.length===0?null:{content:t,attachments:i}}function _c(e){return`${R2}${e}`}function L2(e){var t,r;return{id:((r=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:r.call(t))??`phrase-${Date.now()}-${Math.random().toString(16).slice(2)}`,text:e.trim()}}function F2(e){if(!dw())return null;const t=e.trim();if(!t)return null;const r=window.localStorage.getItem(_c(t));if(!r)return null;try{const i=JSON.parse(r),a=i&&typeof i=="object"&&"draft"in i&&i.draft&&typeof i.draft=="object"?i.draft:i,c=I2(a);return c||(window.localStorage.removeItem(_c(t)),null)}catch{return window.localStorage.removeItem(_c(t)),null}}function _2(e,t){if(!dw())return!1;const r=e.trim();if(!r)return!1;if(t.content.length===0&&t.attachments.length===0)return YP(r),!0;try{return window.localStorage.setItem(_c(r),JSON.stringify({schemaVersion:M2,draft:t})),!0}catch{return!1}}function YP(e){if(!dw())return;const t=e.trim();t&&window.localStorage.removeItem(_c(t))}const tS="workbench:focus-composer",Oc="provider-default",nS=["codex","claude-code","opencode","gemini","kimi"],O2=new Set(["codex","claude-code","opencode"]),B2=new Set(["codex","claude-code","opencode"]),rS={position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function W2(e){return[{id:Oc,name:o("conversation.modelUseCliDefault"),provider:e,usesProviderDefault:!0}]}function iS(e){return W2(e)}function sS(e){return e.usesProviderDefault===!0||e.id===Oc}function U2(){var e,t;return((t=(e=globalThis.crypto)==null?void 0:e.randomUUID)==null?void 0:t.call(e))??`${Date.now()}-${Math.random().toString(16).slice(2)}`}function aS(e){if(e){e.value="";try{const t=e.showPicker;if(typeof t=="function"){t.call(e);return}}catch{}e.click()}}function H2(e,t,r,i){const a=globalThis.atob(r),c=Uint8Array.from(a,u=>u.charCodeAt(0));return new File([c],e,{type:t,lastModified:i})}function z2(e){const t=H2(e.fileName,e.mimeType,e.contentBase64,e.lastModified);return{id:e.id,file:t,previewUrl:URL.createObjectURL(t)}}function q2(e){const t=e.trim().replace(/\s+/g," ");return t.length===0?o("conversation.forkDraftEmpty"):t.length>140?`${t.slice(0,140)}…`:t}function $2(e,t){return t===e?B2.has(t)?null:o("conversation.forkProviderNativeUnsupported"):O2.has(t)?null:o("conversation.forkProviderReconstructedUnsupported")}function XP(e){return(e==null?void 0:e.canStartSession)===!1}function V2(e){return XP(e)?(e==null?void 0:e.limitations[0])??o("conversation.capabilityDenied"):null}function G2(e,t){return{id:t,kind:"image",fileName:e.name,mimeType:e.type||"image/png",fileSize:e.size}}function oS(e){return new Promise((t,r)=>{const i=new FileReader;i.onerror=()=>{r(i.error??new Error("FILE_READ_FAILED"))},i.onload=()=>{const a=typeof i.result=="string"?i.result:"",c=a.includes(",")?a.split(",").at(-1)??"":a;t(c)},i.readAsDataURL(e)})}function K2(e){e.forEach(t=>{URL.revokeObjectURL(t.previewUrl)})}function Y2(e){const t=[];let r=0;for(const i of e){if(i.type.startsWith("image/")){t.push(i);continue}r+=1}return{accepted:t,rejectedCount:r}}function X2(e,t){const r=new Set(e.map(a=>`${a.file.name}:${a.file.size}:${a.file.lastModified}`)),i=[...e];return t.forEach(a=>{const c=`${a.name}:${a.size}:${a.lastModified}`;r.has(c)||(r.add(c),i.push({id:U2(),file:a,previewUrl:URL.createObjectURL(a)}))}),i}function hw({capabilities:e,placeholder:t,draftStorageId:r,forkDraft:i=null,onClearForkDraft:a,onForkDraftChange:c,panelRef:u,portalContainer:d=null,hasActiveRun:m=null,canInterrupt:f=null,contextUsage:w=null,taskProvider:g=null,taskMessages:v=[],hasPendingQueuedMessages:y=!1,isSubmitting:x,isRunning:C=!1,onInterrupt:j,onQueueSend:N,onSend:P}){const L=pr(),Y=p.useId(),H=p.useId(),[W,I]=p.useState(""),[M,O]=p.useState(""),[F,X]=p.useState("medium"),[U,G]=p.useState([]),[R,A]=p.useState(!1),[Z,pe]=p.useState(A2),[q,D]=p.useState(!1),[T,B]=p.useState(!1),[Q,_]=p.useState(""),[de,le]=p.useState(!1),[oe,ye]=p.useState(!1),[Ne,Me]=p.useState(!1),[Te,Dt]=p.useState(!1),[st,dt]=p.useState(null),[bt,pt]=p.useState(!1),[we,he]=p.useState({}),[Le,Oe]=p.useState(null),Qe=p.useRef(null),wt=p.useRef(null),Ie=p.useRef(null),Be=p.useRef(!1),vt=p.useRef(new Set),ft=p.useRef(new Map),ve=p.useRef(0),{showToast:Ae}=Jn(),et=ms(),We=FF(e),lt=Mo(ee=>ef(We)?ee.profile.providers[We]:null),ct=(lt==null?void 0:lt.defaultModel)??null,Vt=(lt==null?void 0:lt.defaultReasoningLevel)??null,Bt=p.useMemo(()=>vf(e,"send_message"),[e]),Wt=p.useMemo(()=>vf(e,"interrupt"),[e]),Lt=p.useMemo(()=>vf(e,"attachments"),[e]),Nt=p.useMemo(()=>{var Ke;const ee=(Ke=e==null?void 0:e.modelOptions)==null?void 0:Ke.map(Je=>{var Et;return{...Je,provider:We,supportedReasoningEfforts:(Et=Je.supportedReasoningEfforts)==null?void 0:Et.filter(an=>an==="low"||an==="medium"||an==="high"||an==="xhigh")}});return ee!=null&&ee.length?ee:iS(We)},[e==null?void 0:e.modelOptions,We]),ln=p.useMemo(()=>Nt.find(ee=>ee.id===M)??null,[Nt,M]),Jt=OF(e),Sn=_F(e),se=p.useMemo(()=>[{value:"low",label:o("conversation.reasoningLow")},{value:"medium",label:o("conversation.reasoningMedium")},{value:"high",label:o("conversation.reasoningHigh")},{value:"xhigh",label:o("conversation.reasoningMaximum")}],[]),He=p.useMemo(()=>{if(!Jt)return[];const ee=ln==null?void 0:ln.supportedReasoningEfforts;return!ee||ee.length===0?se:se.filter(Ke=>ee.includes(Ke.value))},[Jt,se,ln==null?void 0:ln.supportedReasoningEfforts]),xt=p.useMemo(()=>Nt.map(ee=>({value:ee.id,label:sS(ee)?o("conversation.modelUseCliDefault"):ee.name})),[Nt]),Tt=p.useMemo(()=>He.map(ee=>({value:ee.value,label:ee.label})),[He]),Mn=p.useMemo(()=>[{command:"/plan",label:o("conversation.slashCommandPlan")},{command:"/review",label:o("conversation.slashCommandReview")},{command:"/explain",label:o("conversation.slashCommandExplain")}],[]),wn=(e==null?void 0:e.inRunInputMode)??"none",kn=!!i,Ht=(i==null?void 0:i.targetProvider)??null,Gt=!!i&&(e==null?void 0:e.provider)===Ht,dn=p.useMemo(()=>i?Gt?e:st??za(i.targetProvider):null,[e,st,i,Gt]),hn=p.useMemo(()=>{var Ke;if(!i)return[];const ee=(Ke=dn==null?void 0:dn.modelOptions)==null?void 0:Ke.map(Je=>{var Et;return{...Je,provider:i.targetProvider,supportedReasoningEfforts:(Et=Je.supportedReasoningEfforts)==null?void 0:Et.filter(an=>an==="low"||an==="medium"||an==="high"||an==="xhigh")}});return ee!=null&&ee.length?ee:iS(i.targetProvider)},[dn==null?void 0:dn.modelOptions,i]),te=p.useMemo(()=>hn.map(ee=>({value:ee.id,label:sS(ee)?o("conversation.modelUseCliDefault"):ee.name})),[hn]),re=p.useMemo(()=>!i||!i.targetModel?Oc:hn.some(ee=>ee.id===i.targetModel)?i.targetModel:Oc,[hn,i]),ue=p.useMemo(()=>i?nS.filter(ee=>$2(i.sourceProvider,ee)!==null?!1:!XP(we[ee]??null)):[],[i,we]),Se=p.useMemo(()=>i?ue.length>0?ue:[i.targetProvider]:[],[i,ue]),_e=p.useMemo(()=>Se.map(ee=>({value:ee,label:ds(ee,"full")})),[Se]),ze=p.useMemo(()=>i?V2(we[i.targetProvider]??dn??null):null,[dn,i,we]),yt=m??null,nt=C&&wn==="streaming_guidance"&&yt===!1&&!KT(e),Ve=!kn&&C&&wn==="streaming_guidance"&&!nt,ne=!kn&&C&&typeof N=="function"&&BF(e,yt),je=!kn&&C&&!Ve&&!ne,ht=kn&&!!ze,Rt=W.trim().length>0||U.length>0,tn=f??Wt.allowed,$t=C&&tn&&!!j&&!Ne&&!Rt&&!Te&&!x,Zt=!$t&&!Rt&&(Te||x||C||!C&&y),Tn=o(Te||x||y?"conversation.sendingState":"conversation.runtimeRunning"),Zn=o(C?ne?"conversation.queueGuidanceButton":Ve?"conversation.sendGuidanceButton":"conversation.sendButton":"conversation.sendButton"),Cn=p.useCallback(ee=>{O(ee),ef(We)&&Eh({providers:{[We]:{defaultModel:ee}}}).catch(()=>{})},[We]),_t=p.useCallback(ee=>{X(ee),ef(We)&&Eh({providers:{[We]:{defaultReasoningLevel:ee}}}).catch(()=>{})},[We]),Fn=p.useCallback(ee=>{vt.current.forEach(Ke=>{URL.revokeObjectURL(Ke)}),vt.current.clear(),ee.forEach(Ke=>{vt.current.add(Ke.previewUrl)}),G(ee)},[]),mn=p.useCallback(ee=>{const{accepted:Ke,rejectedCount:Je}=Y2(ee);Je>0&&Ae({title:o("conversation.attachmentImageOnly"),tone:"error"}),Ke.length!==0&&G(Et=>{const an=X2(Et,Ke);return an.forEach(on=>{vt.current.add(on.previewUrl)}),an})},[Ae]),bn=p.useCallback(ee=>{ft.current.delete(ee),G(Ke=>{const Je=Ke.find(Et=>Et.id===ee);return Je&&(vt.current.delete(Je.previewUrl),URL.revokeObjectURL(Je.previewUrl)),Ke.filter(Et=>Et.id!==ee)})},[]),Ce=p.useCallback(ee=>{const Ke=Array.from(ee.target.files??[]);Ke.length>0&&mn(Ke),ee.target.value=""},[mn]),De=p.useCallback(ee=>{if(!Lt.allowed||je)return;const Ke=ee==="camera"?Ie.current:wt.current;aS(Ke),A(!1)},[Lt.allowed,je]),mt=p.useCallback(()=>{if(!(!Lt.allowed||je)){if(ye(!1),L.isNativeMobile){et.trigger("selection"),A(!0);return}aS(wt.current)}},[Lt.allowed,et,je,L.isNativeMobile]),Mt=p.useCallback(()=>{ye(ee=>!ee)},[]),en=p.useCallback(ee=>{var Ke;I(Je=>Je.trimStart().startsWith(ee)?Je:Je.trim()?`${ee} ${Je.trim()}`:`${ee} `),ye(!1),(Ke=Qe.current)==null||Ke.focus()},[]),An=p.useCallback(async ee=>{const Ke=Z;ve.current+=1,pe(ee),le(!0);try{const Je=await lF(ee.map(Et=>({id:Et.id,text:Et.text})));return pe(Je.items.map(Et=>({id:Et.id,text:Et.text}))),!0}catch(Je){return pe(Ke),Ae({title:Je instanceof Error?Je.message:o("conversation.quickPhraseSaveFailed"),tone:"error"}),!1}finally{le(!1)}},[Z,Ae]),zt=p.useCallback(async()=>{const ee=Q.trim();!ee||!await An([...Z,L2(ee)])||(_(""),B(!1))},[An,Q,Z]),er=p.useCallback(ee=>{An(Z.filter(Ke=>Ke.id!==ee))},[An,Z]),fr=p.useCallback((ee,Ke)=>{const Je=Z.findIndex(nn=>nn.id===ee);if(Je<0)return;const Et=Je+Ke;if(Et<0||Et>=Z.length)return;const an=[...Z],[on]=an.splice(Je,1);an.splice(Et,0,on),An(an)},[An,Z]),Hn=p.useCallback(ee=>{var Ke;I(ee),D(!1),(Ke=Qe.current)==null||Ke.focus()},[]),ir=p.useCallback(ee=>{const Ke=ee?F2(ee):null,Je=(Ke==null?void 0:Ke.attachments.map(Et=>z2(Et)))??[];ft.current=new Map(((Ke==null?void 0:Ke.attachments)??[]).map(Et=>[Et.id,Et])),Fn(Je),I((Ke==null?void 0:Ke.content)??""),ye(!1)},[Fn]);p.useEffect(()=>{if(!Nt.length)return;if(ct&&Nt.some(Ke=>Ke.id===ct)){M!==ct&&O(ct);return}if(Nt.some(Ke=>Ke.id===M))return;const ee=Nt[0].id;O(ee)},[Nt,We,M,ct]),p.useEffect(()=>{if(!WF(We)||He.length===0)return;if(Vt&&He.some(Je=>Je.value===Vt)){F!==Vt&&X(Vt);return}const ee=e==null?void 0:e.defaultReasoningLevel;if(ee&&He.some(Je=>Je.value===ee)){F!==ee&&X(ee);return}if(He.some(Je=>Je.value===F))return;const Ke=He[0].value;X(Ke)},[He,e==null?void 0:e.defaultReasoningLevel,We,F,Vt]),p.useEffect(()=>{let ee=!1;const Ke=ve.current;return oF().then(Je=>{ee||ve.current!==Ke||pe(Je.items.map(Et=>({id:Et.id,text:Et.text})))}).catch(()=>{}),()=>{ee=!0}},[]),p.useEffect(()=>{ir(r)},[r,ir]),p.useEffect(()=>{if(!r)return;const ee=r,Ke=new Set(U.map(an=>an.id));ft.current.forEach((an,on)=>{Ke.has(on)||ft.current.delete(on)});let Je=!1;async function Et(){if(W.length===0&&U.length===0){YP(ee);return}const an=await Promise.all(U.map(async on=>{const nn=ft.current.get(on.id);return nn&&nn.fileName===on.file.name&&nn.fileSize===on.file.size&&nn.lastModified===on.file.lastModified&&nn.mimeType===(on.file.type||"image/png")?nn:{id:on.id,fileName:on.file.name,mimeType:on.file.type||"image/png",fileSize:on.file.size,lastModified:on.file.lastModified,contentBase64:await oS(on.file)}}));Je||(ft.current=new Map(an.map(on=>[on.id,on])),_2(ee,{content:W,attachments:an}))}return Et(),()=>{Je=!0}},[U,W,r]),p.useEffect(()=>{const ee=Qe.current;ee&&(ee.style.height="0px",ee.style.height=`${Math.min(ee.scrollHeight,120)}px`)},[W]),p.useEffect(()=>{Lt.allowed||(ft.current.clear(),A(!1),Fn([]))},[Lt.allowed,Fn]),p.useEffect(()=>{L.isMobile||A(!1)},[L.isMobile]),p.useEffect(()=>()=>{vt.current.forEach(ee=>{URL.revokeObjectURL(ee)}),vt.current.clear()},[]),p.useEffect(()=>{function ee(){var Ke;(Ke=Qe.current)==null||Ke.focus()}return window.addEventListener(tS,ee),()=>{window.removeEventListener(tS,ee)}},[]),p.useEffect(()=>{if(!i){dt(null),pt(!1),he({}),Oe(null);return}if(Gt){dt(null),pt(!1);return}let ee=!1;return dt(za(i.targetProvider)),pt(!0),Il(i.targetProvider,i.workspaceId).then(Ke=>{ee||dt(Ke)}).catch(()=>{ee||dt(za(i.targetProvider))}).finally(()=>{ee||pt(!1)}),()=>{ee=!0}},[i==null?void 0:i.targetProvider,i==null?void 0:i.workspaceId,Gt]),p.useEffect(()=>{if(!i){he({});return}let ee=!1;return Zb(nS,i.workspaceId).then(Ke=>{ee||he(Ke)}),()=>{ee=!0}},[i==null?void 0:i.workspaceId]),p.useEffect(()=>{!i||!c||ue.length!==0&&(ue.includes(i.targetProvider)||c({...i,targetProvider:ue[0]??i.targetProvider,targetModel:null}))},[i,c,ue]),p.useEffect(()=>{!i||!i.targetModel||!c||hn.some(ee=>ee.id===i.targetModel)||c({...i,targetModel:null})},[hn,i,c]);const vr=p.useCallback(ee=>{if(!(!i||!c||ee===i.targetProvider)){if(ee!==i.sourceProvider&&i.targetProvider===i.sourceProvider){Oe(ee);return}c({...i,targetProvider:ee,targetModel:null})}},[i,c]),On=p.useCallback(ee=>{!i||!c||c({...i,targetModel:ee===Oc?null:ee})},[i,c]),Sr=p.useCallback(()=>{!i||!Le||!c||(c({...i,targetProvider:Le,targetModel:null}),Oe(null))},[i,c,Le]),Fi=p.useCallback(()=>{Oe(null)},[]);async function _i(ee){if(Be.current)return;const Ke=W.trim(),Je=U;if(Ke.length===0&&Je.length===0||!Bt.allowed||je||ht){Ae({title:je?o("conversation.runtimeRunning"):ze??Bt.reason??o("conversation.capabilityDenied"),tone:"error"});return}Be.current=!0,et.trigger(ee==="queue"?"selection":"action"),Dt(!0),I(""),G([]),A(!1),D(!1),B(!1),ye(!1);try{const Et=await Promise.all(Je.map(async nn=>({fileName:nn.file.name,mimeType:nn.file.type||"image/png",fileSize:nn.file.size,contentBase64:await oS(nn.file)}))),an=Je.map(nn=>G2(nn.file,nn.id));await(ee==="queue"&&N?N:P)(Ke,{model:kn||ln!=null&&ln.usesProviderDefault?void 0:M||void 0,reasoningLevel:kn?void 0:Jt&&He.length>0?F:void 0,attachments:Et,attachmentMeta:an}),K2(Je),Je.forEach(nn=>{vt.current.delete(nn.previewUrl)})}catch(Et){I(Ke),G(Je),Ae({title:Et instanceof Error&&Et.message==="FILE_READ_FAILED"?o("conversation.attachmentReadFailed"):Et instanceof Error?Et.message:o("conversation.capabilityDenied"),tone:"error"})}finally{Dt(!1),Be.current=!1}}async function Hr(ee){ee.preventDefault(),await _i(ne?"queue":"send")}async function sr(){if(!(!tn||!j||Ne))try{Me(!0),et.trigger("action"),await j()}catch(ee){Ae({title:ee instanceof Error?ee.message:o("conversation.capabilityInterruptDisabled"),tone:"error"})}finally{Me(!1)}}const Pr=Te||x||je||ht||!Bt.allowed||!Rt,un=Te||x||je||!Lt.allowed,Jr=W.length===0&&!je,ar=n.jsxs("section",{ref:u,className:"composer-panel",children:[n.jsxs("form",{className:"composer-form",onSubmit:Hr,children:[n.jsx("input",{id:Y,ref:wt,type:"file",accept:"image/*",multiple:!0,tabIndex:-1,"aria-hidden":"true",style:rS,onChange:Ce}),n.jsx("input",{id:H,ref:Ie,type:"file",accept:"image/*",capture:"environment",tabIndex:-1,"aria-hidden":"true",style:rS,onChange:Ce}),n.jsxs("div",{className:"composer-input-container",children:[i?n.jsxs("div",{className:"composer-fork-draft",children:[n.jsxs("div",{className:"composer-fork-draft-main",children:[n.jsxs("div",{className:"composer-fork-draft-copy",children:[n.jsx("span",{className:"composer-fork-draft-label",children:o("conversation.forkDraftLabel")}),n.jsx("span",{className:"composer-fork-draft-text",children:q2(i.content)})]}),n.jsxs("div",{className:"composer-fork-config",children:[n.jsxs("div",{className:"composer-fork-config-grid",children:[n.jsxs("div",{className:"composer-fork-field",children:[n.jsx("span",{className:"composer-fork-model-label",children:o("conversation.forkTargetProviderLabel")}),n.jsx(Ld,{ariaLabel:o("conversation.forkTargetProviderLabel"),value:i.targetProvider,options:_e,onChange:ee=>vr(ee),compact:!0})]}),n.jsxs("div",{className:"composer-fork-field",children:[n.jsx("span",{className:"composer-fork-model-label",children:o("conversation.forkTargetModelLabel")}),n.jsx(Ld,{ariaLabel:o("conversation.forkTargetModelLabel"),value:re,options:te,onChange:On,disabled:bt||ht,compact:!0})]})]}),ze?n.jsx("p",{className:"composer-capability-hint",children:ze}):null]})]}),a?n.jsx("button",{type:"button",className:"composer-fork-draft-clear","aria-label":o("conversation.forkDraftClear"),title:o("conversation.forkDraftClear"),onClick:a,children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):null]}):null,U.length>0?n.jsx("div",{className:"composer-attachments",children:U.map(ee=>n.jsxs("div",{className:"composer-attachment-card",children:[n.jsx("img",{src:ee.previewUrl,alt:o("conversation.attachmentPreviewAlt"),className:"composer-attachment-preview"}),n.jsxs("div",{className:"composer-attachment-meta",children:[n.jsx("span",{className:"attachment-name",title:ee.file.name,children:ee.file.name}),n.jsxs("span",{className:"attachment-size",children:[(ee.file.size/1024).toFixed(1)," KB"]})]}),n.jsx("button",{type:"button",className:"attachment-remove",onClick:()=>bn(ee.id),"aria-label":o("conversation.removeAttachment"),children:n.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),n.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},ee.id))}):null,n.jsxs("div",{className:"composer-input-wrapper",children:[n.jsx("textarea",{ref:Qe,className:"composer-input",value:W,placeholder:t??o("conversation.composerPlaceholder"),readOnly:je,"aria-readonly":je,onChange:ee=>I(ee.target.value),rows:1,onFocus:()=>ye(!1),onPaste:ee=>{if(je||!Lt.allowed)return;const Ke=Array.from(ee.clipboardData.items).filter(Je=>Je.kind==="file").map(Je=>Je.getAsFile()).filter(Je=>!!Je);Ke.length!==0&&(ee.preventDefault(),mn(Ke))},onKeyDown:ee=>{ee.key==="Escape"&&ye(!1),ee.key==="Enter"&&!ee.shiftKey&&(ee.preventDefault(),Pr||Hr(ee))}}),Jr?n.jsx("button",{type:"button",className:"composer-quick-phrase-trigger","aria-label":o("conversation.quickPhraseTrigger"),title:o("conversation.quickPhraseTrigger"),onClick:()=>{D(!0),ye(!1)},children:n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("path",{d:"M7 8h10"}),n.jsx("path",{d:"M7 12h8"}),n.jsx("path",{d:"M7 16h5"}),n.jsx("path",{d:"M5 5h14v14H9l-4 4V5z"})]})}):null]}),oe?n.jsx("div",{className:"composer-slash-menu",role:"menu","aria-label":o("conversation.slashMenuTitle"),children:Mn.map(ee=>n.jsxs("button",{type:"button",className:"composer-slash-item",onClick:()=>en(ee.command),children:[n.jsx("span",{className:"composer-slash-command",children:ee.command}),n.jsx("span",{className:"composer-slash-label",children:ee.label})]},ee.command))}):null,n.jsxs("div",{className:"composer-controls",children:[n.jsxs("div",{className:"composer-controls-left",children:[Lt.allowed?L.isNativeMobile?n.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":o("conversation.attachFiles"),title:o("conversation.attachFiles"),disabled:un,onClick:mt,children:n.jsx(kf,{})}):un?n.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":o("conversation.attachFiles"),title:o("conversation.attachFiles"),disabled:!0,children:n.jsx(kf,{})}):n.jsx("label",{htmlFor:Y,className:"composer-attach-btn","aria-label":o("conversation.attachFiles"),title:o("conversation.attachFiles"),onClick:()=>{ye(!1)},children:n.jsx(kf,{})}):null,kn?null:n.jsx(Ld,{ariaLabel:o("conversation.modelSelectorLabel"),value:M,options:xt,onChange:Cn}),!kn&&Jt&&He.length>0?n.jsx(Ld,{ariaLabel:o("conversation.reasoningSelectorLabel"),value:F,options:Tt,onChange:ee=>_t(ee),compact:!0}):null,Sn?n.jsxs("button",{type:"button",className:"composer-slash-btn",onClick:Mt,title:o("conversation.slashMenu"),children:[n.jsx("span",{className:"slash-icon",children:"/"}),n.jsx("span",{children:o("conversation.slashMenu")})]}):null,n.jsx(rB,{contextUsage:w}),n.jsx(P2,{provider:g,messages:v,variant:"composer"})]}),Zt?n.jsx("div",{className:"composer-send-group",children:n.jsx("button",{className:"composer-send composer-send-busy",type:"button",disabled:!0,"aria-label":Tn,title:Tn,children:n.jsxs("svg",{className:"composer-send-spinner",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[n.jsx("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeOpacity:"0.28",strokeWidth:"2.5"}),n.jsx("path",{d:"M20 12a8 8 0 0 0-8-8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]})})}):n.jsx("div",{className:"composer-send-group",children:$t?n.jsx("button",{className:"composer-send composer-send-busy",type:"button",onClick:()=>{sr()},"aria-label":o("conversation.capabilityInterrupt"),title:o("conversation.capabilityInterrupt"),children:n.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:n.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})}):n.jsx("button",{className:"composer-send",type:"submit",disabled:Pr,"aria-label":Zn,title:Zn,children:n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[n.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),n.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})})]})]})]}),n.jsx(Ln,{open:q,title:o("conversation.quickPhraseModalTitle"),description:o("conversation.quickPhraseModalDescription"),className:"composer-quick-phrase-modal",onClose:()=>{D(!1),B(!1)},children:n.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[n.jsxs("div",{className:"composer-quick-phrase-toolbar",children:[n.jsx("div",{className:"composer-quick-phrase-toolbar-copy",children:n.jsx("span",{children:o("conversation.quickPhraseListLabel")})}),n.jsx("button",{type:"button",className:"primary-button",disabled:de,onClick:()=>B(!0),children:o("conversation.quickPhraseOpenCreateAction")})]}),n.jsx("div",{className:"composer-quick-phrase-list",role:"list","aria-label":o("conversation.quickPhraseListLabel"),children:Z.length===0?n.jsx("div",{className:"composer-quick-phrase-empty",children:o("conversation.quickPhraseEmpty")}):Z.map((ee,Ke)=>n.jsxs("div",{className:"composer-quick-phrase-item",role:"listitem",children:[n.jsxs("button",{type:"button",className:"composer-quick-phrase-select",onClick:()=>Hn(ee.text),children:[n.jsx("span",{className:"composer-quick-phrase-order",children:o("conversation.quickPhraseOrderLabel",{index:Ke+1})}),n.jsx("span",{className:"composer-quick-phrase-text",children:ee.text})]}),n.jsxs("div",{className:"composer-quick-phrase-actions",children:[n.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:de||Ke===0,"aria-label":o("conversation.quickPhraseMoveUp"),title:o("conversation.quickPhraseMoveUp"),onClick:()=>fr(ee.id,-1),children:"↑"}),n.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:de||Ke===Z.length-1,"aria-label":o("conversation.quickPhraseMoveDown"),title:o("conversation.quickPhraseMoveDown"),onClick:()=>fr(ee.id,1),children:"↓"}),n.jsx("button",{type:"button",className:"composer-quick-phrase-action is-danger",disabled:de,"aria-label":o("conversation.quickPhraseDelete"),title:o("conversation.quickPhraseDelete"),onClick:()=>er(ee.id),children:"×"})]})]},ee.id))})]})}),n.jsx(Ln,{open:T,title:o("conversation.quickPhraseCreateModalTitle"),description:o("conversation.quickPhraseCreateModalDescription"),className:"composer-quick-phrase-create-modal",onClose:()=>B(!1),children:n.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("conversation.quickPhraseCreateLabel")}),n.jsx("textarea",{className:"composer-quick-phrase-textarea",value:Q,placeholder:o("conversation.quickPhraseCreatePlaceholder"),rows:4,onChange:ee=>_(ee.target.value)})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>B(!1),children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:de||Q.trim().length===0,onClick:()=>{zt()},children:o("conversation.quickPhraseCreateAction")})]})]})}),n.jsx(Ln,{open:Le!==null,title:o("conversation.forkSwitchConfirmTitle"),description:o("conversation.forkSwitchConfirmDescription"),className:"composer-fork-confirm-modal",onClose:Fi,children:n.jsxs("div",{className:"composer-fork-confirm-body",children:[n.jsxs("div",{className:"composer-fork-confirm-list",children:[n.jsxs("div",{className:"composer-fork-confirm-item",children:[n.jsx("span",{className:"composer-fork-confirm-icon is-keep","aria-hidden":"true",children:n.jsx(eB,{})}),n.jsxs("div",{className:"composer-fork-confirm-copy",children:[n.jsx("strong",{children:o("conversation.forkSwitchConfirmKeepTitle")}),n.jsx("p",{children:o("conversation.forkSwitchConfirmKeepBody")})]})]}),n.jsxs("div",{className:"composer-fork-confirm-item",children:[n.jsx("span",{className:"composer-fork-confirm-icon is-convert","aria-hidden":"true",children:n.jsx(tB,{})}),n.jsxs("div",{className:"composer-fork-confirm-copy",children:[n.jsx("strong",{children:o("conversation.forkSwitchConfirmConvertTitle")}),n.jsx("p",{children:o("conversation.forkSwitchConfirmConvertBody")})]})]}),n.jsxs("div",{className:"composer-fork-confirm-item",children:[n.jsx("span",{className:"composer-fork-confirm-icon is-drop","aria-hidden":"true",children:n.jsx(nB,{})}),n.jsxs("div",{className:"composer-fork-confirm-copy",children:[n.jsx("strong",{children:o("conversation.forkSwitchConfirmDropTitle")}),n.jsx("p",{children:o("conversation.forkSwitchConfirmDropBody")})]})]})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:Fi,children:o("conversation.forkSwitchKeepNative")}),n.jsx("button",{type:"button",className:"primary-button",onClick:Sr,children:o("conversation.forkSwitchConfirmAction")})]})]})}),n.jsx(Q2,{open:R&&L.isNativeMobile,onClose:()=>A(!1),onSelectCamera:()=>De("camera"),onSelectLibrary:()=>De("library")})]});return d?Vn.createPortal(ar,d):ar}function Q2({open:e,onClose:t,onSelectCamera:r,onSelectLibrary:i}){return!e||typeof document>"u"?null:Vn.createPortal(n.jsx("div",{className:"ios-action-sheet-overlay composer-attachment-sheet-overlay",role:"presentation",onClick:t,children:n.jsxs("div",{className:"mobile-workspace-home-sheet composer-attachment-sheet",role:"dialog","aria-modal":"true","aria-label":o("conversation.attachmentSourceSheetTitle"),onClick:a=>a.stopPropagation(),children:[n.jsxs("div",{className:"mobile-workspace-home-sheet-card composer-attachment-sheet-card",children:[n.jsxs("div",{className:"mobile-workspace-home-sheet-header",children:[n.jsx("strong",{children:o("conversation.attachmentSourceSheetTitle")}),n.jsx("span",{children:o("conversation.attachmentSourceSheetDescription")})]}),n.jsxs("div",{className:"mobile-workspace-home-group composer-attachment-sheet-actions",children:[n.jsxs("button",{type:"button",className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":o("conversation.attachmentTakePhoto"),onClick:r,children:[n.jsxs("span",{className:"composer-attachment-sheet-option-copy",children:[n.jsx("strong",{children:o("conversation.attachmentTakePhoto")}),n.jsx("span",{children:o("conversation.attachmentTakePhotoHint")})]}),n.jsx(J2,{})]}),n.jsxs("button",{type:"button",className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":o("conversation.attachmentChooseFromLibrary"),onClick:i,children:[n.jsxs("span",{className:"composer-attachment-sheet-option-copy",children:[n.jsx("strong",{children:o("conversation.attachmentChooseFromLibrary")}),n.jsx("span",{children:o("conversation.attachmentChooseFromLibraryHint")})]}),n.jsx(Z2,{})]})]})]}),n.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:t,children:o("common.cancel")})]})}),document.body)}function J2(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M4 8h3l1.5-2h7L17 8h3a1 1 0 0 1 1 1v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9a1 1 0 0 1 1-1Z"}),n.jsx("circle",{cx:"12",cy:"13",r:"4"})]})}function kf(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),n.jsx("path",{d:"M8 12h8M12 8v8"})]})}function Z2(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2.5"}),n.jsx("path",{d:"m7.5 15 3-3 2.5 2.5 3-4L18 13.5"}),n.jsx("circle",{cx:"8.75",cy:"8.75",r:"1.25",fill:"currentColor",stroke:"none"})]})}function eB(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("path",{d:"M12 3 4 7v5c0 5 3.5 8 8 9 4.5-1 8-4 8-9V7l-8-4Z"}),n.jsx("path",{d:"m9.5 12 1.8 1.8L15 10.2"})]})}function tB(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("path",{d:"M4 7h9"}),n.jsx("path",{d:"m10 3 4 4-4 4"}),n.jsx("path",{d:"M20 17h-9"}),n.jsx("path",{d:"m14 13-4 4 4 4"})]})}function nB(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[n.jsx("path",{d:"m7 7 10 10"}),n.jsx("path",{d:"M17 7 7 17"}),n.jsx("path",{d:"M12 3v2"}),n.jsx("path",{d:"M12 19v2"})]})}function Ld({ariaLabel:e,value:t,options:r,onChange:i,disabled:a=!1,compact:c=!1}){const[u,d]=p.useState(!1),m=p.useRef(null),f=p.useRef(null),w=p.useRef(null),[g,v]=p.useState(null),y=p.useId(),x=r.find(j=>j.value===t)??r[0]??null,C=p.useCallback(()=>{const j=f.current;if(!j||typeof window>"u")return;const N=j.getBoundingClientRect(),P=window.innerWidth,L=window.innerHeight,Y=12,H=10,W=Math.max(160,P-Y*2),I=c?140:220,M=Math.min(W,Math.max(N.width,I)),O=Math.min(Math.max(Y,N.left),Math.max(Y,P-M-Y)),F=N.top-Y,X=L-N.bottom-Y,U=F>=180||F>=X;v({position:"fixed",left:O,width:M,maxWidth:W,top:U?void 0:N.bottom+H,bottom:U?L-N.top+H:void 0})},[c]);return p.useEffect(()=>{if(!u)return;function j(P){var Y,H;const L=P.target;!((Y=m.current)!=null&&Y.contains(L))&&!((H=w.current)!=null&&H.contains(L))&&d(!1)}function N(P){P.key==="Escape"&&d(!1)}return window.addEventListener("pointerdown",j),window.addEventListener("keydown",N),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),C(),()=>{window.removeEventListener("pointerdown",j),window.removeEventListener("keydown",N),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[u,C]),x?n.jsxs("div",{ref:m,className:`composer-mac-select ${c?"is-compact":""}`,"data-open":u?"true":"false",children:[n.jsxs("button",{ref:f,type:"button",className:"composer-mac-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":u,"aria-controls":y,disabled:a,onClick:()=>d(j=>!j),children:[n.jsx("span",{className:"composer-mac-select-label",children:x.label}),n.jsx("svg",{className:"composer-mac-select-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"6 14 12 8 18 14"})})]}),u&&g&&typeof document<"u"?Vn.createPortal(n.jsx("div",{ref:w,className:"composer-mac-select-popover",style:g,role:"presentation",children:n.jsx("div",{id:y,className:"composer-mac-select-list",role:"listbox","aria-label":e,children:r.map(j=>{const N=j.value===t;return n.jsxs("button",{type:"button",role:"option","aria-selected":N,className:`composer-mac-select-option ${N?"is-selected":""}`,onClick:()=>{i(j.value),d(!1)},children:[n.jsx("span",{className:"composer-mac-select-option-check","aria-hidden":"true",children:N?"✓":""}),n.jsx("span",{className:"composer-mac-select-option-label",children:j.label})]},j.value)})})}),document.body):null]}):null}function rB({contextUsage:e}){const[t,r]=p.useState(!1),i=p.useRef(null),a=p.useRef(null),[c,u]=p.useState(null),d=p.useId(),m=e?Math.round(e.usageRatio*100):null,f=e?Math.max(0,Math.min(e.usageRatio,1)):0,w=iB(f),g=e?sB(e.contextWindowSource):null,v=e?`${o("conversation.contextUsageTitle")} ${m}%`:o("conversation.contextUsageUnavailable"),y=p.useCallback(()=>{const x=i.current;if(!x||typeof window>"u")return;const C=x.getBoundingClientRect(),j=window.innerWidth,N=window.innerHeight,P=12,L=10,Y=Math.min(240,Math.max(188,j-P*2)),H=Math.min(Math.max(P,C.left+C.width/2-Y/2),Math.max(P,j-Y-P)),W=C.top-P,I=N-C.bottom-P,M=W>=140||W>=I;u({position:"fixed",left:H,width:Y,maxWidth:j-P*2,top:M?void 0:C.bottom+L,bottom:M?N-C.top+L:void 0})},[]);return p.useEffect(()=>{if(!t)return;function x(j){var P,L;const N=j.target;!((P=i.current)!=null&&P.contains(N))&&!((L=a.current)!=null&&L.contains(N))&&r(!1)}function C(j){j.key==="Escape"&&r(!1)}return window.addEventListener("pointerdown",x),window.addEventListener("keydown",C),window.addEventListener("resize",y),window.addEventListener("scroll",y,!0),y(),()=>{window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",C),window.removeEventListener("resize",y),window.removeEventListener("scroll",y,!0)}},[t,y]),n.jsxs(n.Fragment,{children:[n.jsx("button",{ref:i,type:"button",className:`composer-context-ring ${w}`,style:{"--context-usage-progress":`${f}`},"aria-label":v,"aria-expanded":t,"aria-describedby":t?d:void 0,onClick:()=>r(x=>!x),onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),onFocus:()=>r(!0),onBlur:()=>r(!1),children:n.jsx("span",{className:"composer-context-ring-value",children:m===null?"--":n.jsxs(n.Fragment,{children:[n.jsx("span",{children:m}),n.jsx("span",{className:"composer-context-ring-suffix",children:"%"})]})})}),t&&c&&typeof document<"u"?Vn.createPortal(n.jsx("div",{ref:a,id:d,className:"composer-context-tooltip",style:c,role:"tooltip",children:e?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"composer-context-tooltip-title",children:o("conversation.contextUsageTitle")}),n.jsxs("div",{className:"composer-context-tooltip-line",children:[m,"% · ",xf(e.promptTokens)," /"," ",xf(e.contextWindow)," tokens"]}),e.cachedInputTokens>0?n.jsx("div",{className:"composer-context-tooltip-line",children:o("conversation.contextUsageCachedTokens").replace("{count}",xf(e.cachedInputTokens))}):null,g?n.jsx("div",{className:"composer-context-tooltip-meta",children:g}):null,e.isEstimated?n.jsx("div",{className:"composer-context-tooltip-meta",children:o("conversation.contextUsageEstimated")}):null]}):n.jsx("div",{className:"composer-context-tooltip-line",children:o("conversation.contextUsageUnavailable")})}),document.body):null]})}function iB(e){return e>=.95?"is-critical":e>=.8?"is-warning":"is-normal"}function sB(e){switch(e){case"provider-log":return o("conversation.contextUsageSourceProviderLog");case"provider-runtime":return o("conversation.contextUsageSourceProviderRuntime");case"provider-config":return o("conversation.contextUsageSourceProviderConfig");case"model-map":return o("conversation.contextUsageSourceModelMap");default:return""}}function xf(e){return new Intl.NumberFormat().format(e)}function aB(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const oB=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,lB=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,cB={};function lS(e,t){return(cB.jsx?lB:oB).test(e)}const uB=/[ \t\n\f\r]/g;function dB(e){return typeof e=="object"?e.type==="text"?cS(e.value):!1:cS(e)}function cS(e){return e.replace(uB,"")===""}class xu{constructor(t,r,i){this.normal=r,this.property=t,i&&(this.space=i)}}xu.prototype.normal={};xu.prototype.property={};xu.prototype.space=void 0;function QP(e,t){const r={},i={};for(const a of e)Object.assign(r,a.property),Object.assign(i,a.normal);return new xu(r,i,t)}function $g(e){return e.toLowerCase()}class Li{constructor(t,r){this.attribute=r,this.property=t}}Li.prototype.attribute="";Li.prototype.booleanish=!1;Li.prototype.boolean=!1;Li.prototype.commaOrSpaceSeparated=!1;Li.prototype.commaSeparated=!1;Li.prototype.defined=!1;Li.prototype.mustUseProperty=!1;Li.prototype.number=!1;Li.prototype.overloadedBoolean=!1;Li.prototype.property="";Li.prototype.spaceSeparated=!1;Li.prototype.space=void 0;let hB=0;const fn=Eo(),Ar=Eo(),Vg=Eo(),Ze=Eo(),Xn=Eo(),Sl=Eo(),qi=Eo();function Eo(){return 2**++hB}const Gg=Object.freeze(Object.defineProperty({__proto__:null,boolean:fn,booleanish:Ar,commaOrSpaceSeparated:qi,commaSeparated:Sl,number:Ze,overloadedBoolean:Vg,spaceSeparated:Xn},Symbol.toStringTag,{value:"Module"})),Sf=Object.keys(Gg);class mw extends Li{constructor(t,r,i,a){let c=-1;if(super(t,r),uS(this,"space",a),typeof i=="number")for(;++c<Sf.length;){const u=Sf[c];uS(this,Sf[c],(i&Gg[u])===Gg[u])}}}mw.prototype.defined=!0;function uS(e,t,r){r&&(e[t]=r)}function Ll(e){const t={},r={};for(const[i,a]of Object.entries(e.properties)){const c=new mw(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(c.mustUseProperty=!0),t[i]=c,r[$g(i)]=i,r[$g(c.attribute)]=i}return new xu(t,r,e.space)}const JP=Ll({properties:{ariaActiveDescendant:null,ariaAtomic:Ar,ariaAutoComplete:null,ariaBusy:Ar,ariaChecked:Ar,ariaColCount:Ze,ariaColIndex:Ze,ariaColSpan:Ze,ariaControls:Xn,ariaCurrent:null,ariaDescribedBy:Xn,ariaDetails:null,ariaDisabled:Ar,ariaDropEffect:Xn,ariaErrorMessage:null,ariaExpanded:Ar,ariaFlowTo:Xn,ariaGrabbed:Ar,ariaHasPopup:null,ariaHidden:Ar,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Xn,ariaLevel:Ze,ariaLive:null,ariaModal:Ar,ariaMultiLine:Ar,ariaMultiSelectable:Ar,ariaOrientation:null,ariaOwns:Xn,ariaPlaceholder:null,ariaPosInSet:Ze,ariaPressed:Ar,ariaReadOnly:Ar,ariaRelevant:null,ariaRequired:Ar,ariaRoleDescription:Xn,ariaRowCount:Ze,ariaRowIndex:Ze,ariaRowSpan:Ze,ariaSelected:Ar,ariaSetSize:Ze,ariaSort:null,ariaValueMax:Ze,ariaValueMin:Ze,ariaValueNow:Ze,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function ZP(e,t){return t in e?e[t]:t}function eD(e,t){return ZP(e,t.toLowerCase())}const mB=Ll({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Sl,acceptCharset:Xn,accessKey:Xn,action:null,allow:null,allowFullScreen:fn,allowPaymentRequest:fn,allowUserMedia:fn,alt:null,as:null,async:fn,autoCapitalize:null,autoComplete:Xn,autoFocus:fn,autoPlay:fn,blocking:Xn,capture:null,charSet:null,checked:fn,cite:null,className:Xn,cols:Ze,colSpan:null,content:null,contentEditable:Ar,controls:fn,controlsList:Xn,coords:Ze|Sl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:fn,defer:fn,dir:null,dirName:null,disabled:fn,download:Vg,draggable:Ar,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:fn,formTarget:null,headers:Xn,height:Ze,hidden:Vg,high:Ze,href:null,hrefLang:null,htmlFor:Xn,httpEquiv:Xn,id:null,imageSizes:null,imageSrcSet:null,inert:fn,inputMode:null,integrity:null,is:null,isMap:fn,itemId:null,itemProp:Xn,itemRef:Xn,itemScope:fn,itemType:Xn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:fn,low:Ze,manifest:null,max:null,maxLength:Ze,media:null,method:null,min:null,minLength:Ze,multiple:fn,muted:fn,name:null,nonce:null,noModule:fn,noValidate:fn,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:fn,optimum:Ze,pattern:null,ping:Xn,placeholder:null,playsInline:fn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:fn,referrerPolicy:null,rel:Xn,required:fn,reversed:fn,rows:Ze,rowSpan:Ze,sandbox:Xn,scope:null,scoped:fn,seamless:fn,selected:fn,shadowRootClonable:fn,shadowRootDelegatesFocus:fn,shadowRootMode:null,shape:null,size:Ze,sizes:null,slot:null,span:Ze,spellCheck:Ar,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ze,step:null,style:null,tabIndex:Ze,target:null,title:null,translate:null,type:null,typeMustMatch:fn,useMap:null,value:Ar,width:Ze,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Xn,axis:null,background:null,bgColor:null,border:Ze,borderColor:null,bottomMargin:Ze,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:fn,declare:fn,event:null,face:null,frame:null,frameBorder:null,hSpace:Ze,leftMargin:Ze,link:null,longDesc:null,lowSrc:null,marginHeight:Ze,marginWidth:Ze,noResize:fn,noHref:fn,noShade:fn,noWrap:fn,object:null,profile:null,prompt:null,rev:null,rightMargin:Ze,rules:null,scheme:null,scrolling:Ar,standby:null,summary:null,text:null,topMargin:Ze,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ze,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:fn,disableRemotePlayback:fn,prefix:null,property:null,results:Ze,security:null,unselectable:null},space:"html",transform:eD}),pB=Ll({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:qi,accentHeight:Ze,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ze,amplitude:Ze,arabicForm:null,ascent:Ze,attributeName:null,attributeType:null,azimuth:Ze,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ze,by:null,calcMode:null,capHeight:Ze,className:Xn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ze,diffuseConstant:Ze,direction:null,display:null,dur:null,divisor:Ze,dominantBaseline:null,download:fn,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ze,enableBackground:null,end:null,event:null,exponent:Ze,externalResourcesRequired:null,fill:null,fillOpacity:Ze,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Sl,g2:Sl,glyphName:Sl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ze,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ze,horizOriginX:Ze,horizOriginY:Ze,id:null,ideographic:Ze,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ze,k:Ze,k1:Ze,k2:Ze,k3:Ze,k4:Ze,kernelMatrix:qi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ze,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ze,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ze,overlineThickness:Ze,paintOrder:null,panose1:null,path:null,pathLength:Ze,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Xn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ze,pointsAtY:Ze,pointsAtZ:Ze,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:qi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:qi,rev:qi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:qi,requiredFeatures:qi,requiredFonts:qi,requiredFormats:qi,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ze,specularExponent:Ze,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ze,strikethroughThickness:Ze,string:null,stroke:null,strokeDashArray:qi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ze,strokeOpacity:Ze,strokeWidth:null,style:null,surfaceScale:Ze,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:qi,tabIndex:Ze,tableValues:null,target:null,targetX:Ze,targetY:Ze,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:qi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ze,underlineThickness:Ze,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ze,values:null,vAlphabetic:Ze,vMathematical:Ze,vectorEffect:null,vHanging:Ze,vIdeographic:Ze,version:null,vertAdvY:Ze,vertOriginX:Ze,vertOriginY:Ze,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ze,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ZP}),tD=Ll({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),nD=Ll({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:eD}),rD=Ll({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),fB={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},gB=/[A-Z]/g,dS=/-[a-z]/g,bB=/^data[-\w.:]+$/i;function wB(e,t){const r=$g(t);let i=t,a=Li;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&bB.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(dS,yB);i="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!dS.test(c)){let u=c.replace(gB,vB);u.charAt(0)!=="-"&&(u="-"+u),t="data"+u}}a=mw}return new a(i,t)}function vB(e){return"-"+e.toLowerCase()}function yB(e){return e.charAt(1).toUpperCase()}const kB=QP([JP,mB,tD,nD,rD],"html"),pw=QP([JP,pB,tD,nD,rD],"svg");function xB(e){return e.join(" ").trim()}var hl={},Cf,hS;function SB(){if(hS)return Cf;hS=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,u=/^[;\s]*/,d=/^\s+|\s+$/g,m=`
|
|
70
|
-
`,f="/",w="*",g="",v="comment",y="declaration";function x(j,N){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];N=N||{};var P=1,L=1;function Y(R){var A=R.match(t);A&&(P+=A.length);var Z=R.lastIndexOf(m);L=~Z?R.length-Z:L+R.length}function H(){var R={line:P,column:L};return function(A){return A.position=new W(R),O(),A}}function W(R){this.start=R,this.end={line:P,column:L},this.source=N.source}W.prototype.content=j;function I(R){var A=new Error(N.source+":"+P+":"+L+": "+R);if(A.reason=R,A.filename=N.source,A.line=P,A.column=L,A.source=j,!N.silent)throw A}function M(R){var A=R.exec(j);if(A){var Z=A[0];return Y(Z),j=j.slice(Z.length),A}}function O(){M(r)}function F(R){var A;for(R=R||[];A=X();)A!==!1&&R.push(A);return R}function X(){var R=H();if(!(f!=j.charAt(0)||w!=j.charAt(1))){for(var A=2;g!=j.charAt(A)&&(w!=j.charAt(A)||f!=j.charAt(A+1));)++A;if(A+=2,g===j.charAt(A-1))return I("End of comment missing");var Z=j.slice(2,A-2);return L+=2,Y(Z),j=j.slice(A),L+=2,R({type:v,comment:Z})}}function U(){var R=H(),A=M(i);if(A){if(X(),!M(a))return I("property missing ':'");var Z=M(c),pe=R({type:y,property:C(A[0].replace(e,g)),value:Z?C(Z[0].replace(e,g)):g});return M(u),pe}}function G(){var R=[];F(R);for(var A;A=U();)A!==!1&&(R.push(A),F(R));return R}return O(),G()}function C(j){return j?j.replace(d,g):g}return Cf=x,Cf}var mS;function CB(){if(mS)return hl;mS=1;var e=hl&&hl.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(hl,"__esModule",{value:!0}),hl.default=r;const t=e(SB());function r(i,a){let c=null;if(!i||typeof i!="string")return c;const u=(0,t.default)(i),d=typeof a=="function";return u.forEach(m=>{if(m.type!=="declaration")return;const{property:f,value:w}=m;d?a(f,w,m):w&&(c=c||{},c[f]=w)}),c}return hl}var pc={},pS;function jB(){if(pS)return pc;pS=1,Object.defineProperty(pc,"__esModule",{value:!0}),pc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,c=function(f){return!f||r.test(f)||e.test(f)},u=function(f,w){return w.toUpperCase()},d=function(f,w){return"".concat(w,"-")},m=function(f,w){return w===void 0&&(w={}),c(f)?f:(f=f.toLowerCase(),w.reactCompat?f=f.replace(a,d):f=f.replace(i,d),f.replace(t,u))};return pc.camelCase=m,pc}var fc,fS;function NB(){if(fS)return fc;fS=1;var e=fc&&fc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(CB()),r=jB();function i(a,c){var u={};return!a||typeof a!="string"||(0,t.default)(a,function(d,m){d&&m&&(u[(0,r.camelCase)(d,c)]=m)}),u}return i.default=i,fc=i,fc}var TB=NB();const PB=uu(TB),iD=sD("end"),fw=sD("start");function sD(e){return t;function t(r){const i=r&&r.position&&r.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function DB(e){const t=fw(e),r=iD(e);if(t&&r)return{start:t,end:r}}function Bc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?gS(e.position):"start"in e||"end"in e?gS(e):"line"in e||"column"in e?Kg(e):""}function Kg(e){return bS(e&&e.line)+":"+bS(e&&e.column)}function gS(e){return Kg(e&&e.start)+"-"+Kg(e&&e.end)}function bS(e){return e&&typeof e=="number"?e:1}class oi extends Error{constructor(t,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let a="",c={},u=!1;if(r&&("line"in r&&"column"in r?c={place:r}:"start"in r&&"end"in r?c={place:r}:"type"in r?c={ancestors:[r],place:r.position}:c={...r}),typeof t=="string"?a=t:!c.cause&&t&&(u=!0,a=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof i=="string"){const m=i.indexOf(":");m===-1?c.ruleId=i:(c.source=i.slice(0,m),c.ruleId=i.slice(m+1))}if(!c.place&&c.ancestors&&c.ancestors){const m=c.ancestors[c.ancestors.length-1];m&&(c.place=m.position)}const d=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=d?d.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=d?d.line:void 0,this.name=Bc(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=u&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}oi.prototype.file="";oi.prototype.name="";oi.prototype.reason="";oi.prototype.message="";oi.prototype.stack="";oi.prototype.column=void 0;oi.prototype.line=void 0;oi.prototype.ancestors=void 0;oi.prototype.cause=void 0;oi.prototype.fatal=void 0;oi.prototype.place=void 0;oi.prototype.ruleId=void 0;oi.prototype.source=void 0;const gw={}.hasOwnProperty,RB=new Map,MB=/[A-Z]/g,AB=new Set(["table","tbody","thead","tfoot","tr"]),EB=new Set(["td","th"]),aD="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function IB(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const r=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=HB(r,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=UB(r,t.jsx,t.jsxs)}const a={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:r,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?pw:kB,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=oD(a,e,void 0);return c&&typeof c!="string"?c:a.create(e,a.Fragment,{children:c||void 0},void 0)}function oD(e,t,r){if(t.type==="element")return LB(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return FB(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return OB(e,t,r);if(t.type==="mdxjsEsm")return _B(e,t);if(t.type==="root")return BB(e,t,r);if(t.type==="text")return WB(e,t)}function LB(e,t,r){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=pw,e.schema=a),e.ancestors.push(t);const c=cD(e,t.tagName,!1),u=zB(e,t);let d=ww(e,t);return AB.has(t.tagName)&&(d=d.filter(function(m){return typeof m=="string"?!dB(m):!0})),lD(e,u,c,t),bw(u,d),e.ancestors.pop(),e.schema=i,e.create(t,c,u,r)}function FB(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Xc(e,t.position)}function _B(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Xc(e,t.position)}function OB(e,t,r){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=pw,e.schema=a),e.ancestors.push(t);const c=t.name===null?e.Fragment:cD(e,t.name,!0),u=qB(e,t),d=ww(e,t);return lD(e,u,c,t),bw(u,d),e.ancestors.pop(),e.schema=i,e.create(t,c,u,r)}function BB(e,t,r){const i={};return bw(i,ww(e,t)),e.create(t,e.Fragment,i,r)}function WB(e,t){return t.value}function lD(e,t,r,i){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=i)}function bw(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function UB(e,t,r){return i;function i(a,c,u,d){const f=Array.isArray(u.children)?r:t;return d?f(c,u,d):f(c,u)}}function HB(e,t){return r;function r(i,a,c,u){const d=Array.isArray(c.children),m=fw(i);return t(a,c,u,d,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function zB(e,t){const r={};let i,a;for(a in t.properties)if(a!=="children"&&gw.call(t.properties,a)){const c=$B(e,a,t.properties[a]);if(c){const[u,d]=c;e.tableCellAlignToStyle&&u==="align"&&typeof d=="string"&&EB.has(t.tagName)?i=d:r[u]=d}}if(i){const c=r.style||(r.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function qB(e,t){const r={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const c=i.data.estree.body[0];c.type;const u=c.expression;u.type;const d=u.properties[0];d.type,Object.assign(r,e.evaluater.evaluateExpression(d.argument))}else Xc(e,t.position);else{const a=i.name;let c;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const d=i.value.data.estree.body[0];d.type,c=e.evaluater.evaluateExpression(d.expression)}else Xc(e,t.position);else c=i.value===null?!0:i.value;r[a]=c}return r}function ww(e,t){const r=[];let i=-1;const a=e.passKeys?new Map:RB;for(;++i<t.children.length;){const c=t.children[i];let u;if(e.passKeys){const m=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(m){const f=a.get(m)||0;u=m+"-"+f,a.set(m,f+1)}}const d=oD(e,c,u);d!==void 0&&r.push(d)}return r}function $B(e,t,r){const i=wB(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?aB(r):xB(r)),i.property==="style"){let a=typeof r=="object"?r:VB(e,String(r));return e.stylePropertyNameCase==="css"&&(a=GB(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?fB[i.property]||i.property:i.attribute,r]}}function VB(e,t){try{return PB(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,a=new oi("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:i,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=aD+"#cannot-parse-style-attribute",a}}function cD(e,t,r){let i;if(!r)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let c=-1,u;for(;++c<a.length;){const d=lS(a[c])?{type:"Identifier",name:a[c]}:{type:"Literal",value:a[c]};u=u?{type:"MemberExpression",object:u,property:d,computed:!!(c&&d.type==="Literal"),optional:!1}:d}i=u}else i=lS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return gw.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Xc(e)}function Xc(e,t){const r=new oi("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw r.file=e.filePath||void 0,r.url=aD+"#cannot-handle-mdx-estrees-without-createevaluater",r}function GB(e){const t={};let r;for(r in e)gw.call(e,r)&&(t[KB(r)]=e[r]);return t}function KB(e){let t=e.replace(MB,YB);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function YB(e){return"-"+e.toLowerCase()}const jf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},XB={};function vw(e,t){const r=XB,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,a=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return uD(e,i,a)}function uD(e,t,r){if(QB(e)){if("value"in e)return e.type==="html"&&!r?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return wS(e.children,t,r)}return Array.isArray(e)?wS(e,t,r):""}function wS(e,t,r){const i=[];let a=-1;for(;++a<e.length;)i[a]=uD(e[a],t,r);return i.join("")}function QB(e){return!!(e&&typeof e=="object")}const vS=document.createElement("i");function yw(e){const t="&"+e+";";vS.innerHTML=t;const r=vS.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function Vi(e,t,r,i){const a=e.length;let c=0,u;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,r=r>0?r:0,i.length<1e4)u=Array.from(i),u.unshift(t,r),e.splice(...u);else for(r&&e.splice(t,r);c<i.length;)u=i.slice(c,c+1e4),u.unshift(t,0),e.splice(...u),c+=1e4,t+=1e4}function ls(e,t){return e.length>0?(Vi(e,e.length,0,t),e):t}const yS={}.hasOwnProperty;function dD(e){const t={};let r=-1;for(;++r<e.length;)JB(t,e[r]);return t}function JB(e,t){let r;for(r in t){const a=(yS.call(e,r)?e[r]:void 0)||(e[r]={}),c=t[r];let u;if(c)for(u in c){yS.call(a,u)||(a[u]=[]);const d=c[u];ZB(a[u],Array.isArray(d)?d:d?[d]:[])}}}function ZB(e,t){let r=-1;const i=[];for(;++r<t.length;)(t[r].add==="after"?e:i).push(t[r]);Vi(e,0,0,i)}function hD(e,t){const r=Number.parseInt(e,t);return r<9||r===11||r>13&&r<32||r>126&&r<160||r>55295&&r<57344||r>64975&&r<65008||(r&65535)===65535||(r&65535)===65534||r>1114111?"�":String.fromCodePoint(r)}function Ns(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const gi=Xa(/[A-Za-z]/),ai=Xa(/[\dA-Za-z]/),eW=Xa(/[#-'*+\--9=?A-Z^-~]/);function qh(e){return e!==null&&(e<32||e===127)}const Yg=Xa(/\d/),tW=Xa(/[\dA-Fa-f]/),nW=Xa(/[!-/:-@[-`{-~]/);function Qt(e){return e!==null&&e<-2}function Kn(e){return e!==null&&(e<0||e===32)}function xn(e){return e===-2||e===-1||e===32}const ym=Xa(new RegExp("\\p{P}|\\p{S}","u")),To=Xa(/\s/);function Xa(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Fl(e){const t=[];let r=-1,i=0,a=0;for(;++r<e.length;){const c=e.charCodeAt(r);let u="";if(c===37&&ai(e.charCodeAt(r+1))&&ai(e.charCodeAt(r+2)))a=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(u=String.fromCharCode(c));else if(c>55295&&c<57344){const d=e.charCodeAt(r+1);c<56320&&d>56319&&d<57344?(u=String.fromCharCode(c,d),a=1):u="�"}else u=String.fromCharCode(c);u&&(t.push(e.slice(i,r),encodeURIComponent(u)),i=r+a+1,u=""),a&&(r+=a,a=0)}return t.join("")+e.slice(i)}function Pn(e,t,r,i){const a=i?i-1:Number.POSITIVE_INFINITY;let c=0;return u;function u(m){return xn(m)?(e.enter(r),d(m)):t(m)}function d(m){return xn(m)&&c++<a?(e.consume(m),d):(e.exit(r),t(m))}}const rW={tokenize:iW};function iW(e){const t=e.attempt(this.parser.constructs.contentInitial,i,a);let r;return t;function i(d){if(d===null){e.consume(d);return}return e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),Pn(e,t,"linePrefix")}function a(d){return e.enter("paragraph"),c(d)}function c(d){const m=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,u(d)}function u(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Qt(d)?(e.consume(d),e.exit("chunkText"),c):(e.consume(d),u)}}const sW={tokenize:aW},kS={tokenize:oW};function aW(e){const t=this,r=[];let i=0,a,c,u;return d;function d(L){if(i<r.length){const Y=r[i];return t.containerState=Y[1],e.attempt(Y[0].continuation,m,f)(L)}return f(L)}function m(L){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&P();const Y=t.events.length;let H=Y,W;for(;H--;)if(t.events[H][0]==="exit"&&t.events[H][1].type==="chunkFlow"){W=t.events[H][1].end;break}N(i);let I=Y;for(;I<t.events.length;)t.events[I][1].end={...W},I++;return Vi(t.events,H+1,0,t.events.slice(Y)),t.events.length=I,f(L)}return d(L)}function f(L){if(i===r.length){if(!a)return v(L);if(a.currentConstruct&&a.currentConstruct.concrete)return x(L);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(kS,w,g)(L)}function w(L){return a&&P(),N(i),v(L)}function g(L){return t.parser.lazy[t.now().line]=i!==r.length,u=t.now().offset,x(L)}function v(L){return t.containerState={},e.attempt(kS,y,x)(L)}function y(L){return i++,r.push([t.currentConstruct,t.containerState]),v(L)}function x(L){if(L===null){a&&P(),N(0),e.consume(L);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:c}),C(L)}function C(L){if(L===null){j(e.exit("chunkFlow"),!0),N(0),e.consume(L);return}return Qt(L)?(e.consume(L),j(e.exit("chunkFlow")),i=0,t.interrupt=void 0,d):(e.consume(L),C)}function j(L,Y){const H=t.sliceStream(L);if(Y&&H.push(null),L.previous=c,c&&(c.next=L),c=L,a.defineSkip(L.start),a.write(H),t.parser.lazy[L.start.line]){let W=a.events.length;for(;W--;)if(a.events[W][1].start.offset<u&&(!a.events[W][1].end||a.events[W][1].end.offset>u))return;const I=t.events.length;let M=I,O,F;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(O){F=t.events[M][1].end;break}O=!0}for(N(i),W=I;W<t.events.length;)t.events[W][1].end={...F},W++;Vi(t.events,M+1,0,t.events.slice(I)),t.events.length=W}}function N(L){let Y=r.length;for(;Y-- >L;){const H=r[Y];t.containerState=H[1],H[0].exit.call(t,e)}r.length=L}function P(){a.write([null]),c=void 0,a=void 0,t.containerState._closeFlow=void 0}}function oW(e,t,r){return Pn(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Rl(e){if(e===null||Kn(e)||To(e))return 1;if(ym(e))return 2}function km(e,t,r){const i=[];let a=-1;for(;++a<e.length;){const c=e[a].resolveAll;c&&!i.includes(c)&&(t=c(t,r),i.push(c))}return t}const Xg={name:"attention",resolveAll:lW,tokenize:cW};function lW(e,t){let r=-1,i,a,c,u,d,m,f,w;for(;++r<e.length;)if(e[r][0]==="enter"&&e[r][1].type==="attentionSequence"&&e[r][1]._close){for(i=r;i--;)if(e[i][0]==="exit"&&e[i][1].type==="attentionSequence"&&e[i][1]._open&&t.sliceSerialize(e[i][1]).charCodeAt(0)===t.sliceSerialize(e[r][1]).charCodeAt(0)){if((e[i][1]._close||e[r][1]._open)&&(e[r][1].end.offset-e[r][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[r][1].end.offset-e[r][1].start.offset)%3))continue;m=e[i][1].end.offset-e[i][1].start.offset>1&&e[r][1].end.offset-e[r][1].start.offset>1?2:1;const g={...e[i][1].end},v={...e[r][1].start};xS(g,-m),xS(v,m),u={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[i][1].end}},d={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:v},c={type:m>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[r][1].start}},a={type:m>1?"strong":"emphasis",start:{...u.start},end:{...d.end}},e[i][1].end={...u.start},e[r][1].start={...d.end},f=[],e[i][1].end.offset-e[i][1].start.offset&&(f=ls(f,[["enter",e[i][1],t],["exit",e[i][1],t]])),f=ls(f,[["enter",a,t],["enter",u,t],["exit",u,t],["enter",c,t]]),f=ls(f,km(t.parser.constructs.insideSpan.null,e.slice(i+1,r),t)),f=ls(f,[["exit",c,t],["enter",d,t],["exit",d,t],["exit",a,t]]),e[r][1].end.offset-e[r][1].start.offset?(w=2,f=ls(f,[["enter",e[r][1],t],["exit",e[r][1],t]])):w=0,Vi(e,i-1,r-i+3,f),r=i+f.length-w-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function cW(e,t){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,a=Rl(i);let c;return u;function u(m){return c=m,e.enter("attentionSequence"),d(m)}function d(m){if(m===c)return e.consume(m),d;const f=e.exit("attentionSequence"),w=Rl(m),g=!w||w===2&&a||r.includes(m),v=!a||a===2&&w||r.includes(i);return f._open=!!(c===42?g:g&&(a||!v)),f._close=!!(c===42?v:v&&(w||!g)),t(m)}}function xS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const uW={name:"autolink",tokenize:dW};function dW(e,t,r){let i=0;return a;function a(y){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(y){return gi(y)?(e.consume(y),u):y===64?r(y):f(y)}function u(y){return y===43||y===45||y===46||ai(y)?(i=1,d(y)):f(y)}function d(y){return y===58?(e.consume(y),i=0,m):(y===43||y===45||y===46||ai(y))&&i++<32?(e.consume(y),d):(i=0,f(y))}function m(y){return y===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):y===null||y===32||y===60||qh(y)?r(y):(e.consume(y),m)}function f(y){return y===64?(e.consume(y),w):eW(y)?(e.consume(y),f):r(y)}function w(y){return ai(y)?g(y):r(y)}function g(y){return y===46?(e.consume(y),i=0,w):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):v(y)}function v(y){if((y===45||ai(y))&&i++<63){const x=y===45?v:g;return e.consume(y),x}return r(y)}}const Su={partial:!0,tokenize:hW};function hW(e,t,r){return i;function i(c){return xn(c)?Pn(e,a,"linePrefix")(c):a(c)}function a(c){return c===null||Qt(c)?t(c):r(c)}}const mD={continuation:{tokenize:pW},exit:fW,name:"blockQuote",tokenize:mW};function mW(e,t,r){const i=this;return a;function a(u){if(u===62){const d=i.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(u),e.exit("blockQuoteMarker"),c}return r(u)}function c(u){return xn(u)?(e.enter("blockQuotePrefixWhitespace"),e.consume(u),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(u))}}function pW(e,t,r){const i=this;return a;function a(u){return xn(u)?Pn(e,c,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u):c(u)}function c(u){return e.attempt(mD,t,r)(u)}}function fW(e){e.exit("blockQuote")}const pD={name:"characterEscape",tokenize:gW};function gW(e,t,r){return i;function i(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),a}function a(c){return nW(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(c)}}const fD={name:"characterReference",tokenize:bW};function bW(e,t,r){const i=this;let a=0,c,u;return d;function d(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),m}function m(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),f):(e.enter("characterReferenceValue"),c=31,u=ai,w(g))}function f(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,u=tW,w):(e.enter("characterReferenceValue"),c=7,u=Yg,w(g))}function w(g){if(g===59&&a){const v=e.exit("characterReferenceValue");return u===ai&&!yw(i.sliceSerialize(v))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return u(g)&&a++<c?(e.consume(g),w):r(g)}}const SS={partial:!0,tokenize:vW},CS={concrete:!0,name:"codeFenced",tokenize:wW};function wW(e,t,r){const i=this,a={partial:!0,tokenize:H};let c=0,u=0,d;return m;function m(W){return f(W)}function f(W){const I=i.events[i.events.length-1];return c=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,d=W,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),w(W)}function w(W){return W===d?(u++,e.consume(W),w):u<3?r(W):(e.exit("codeFencedFenceSequence"),xn(W)?Pn(e,g,"whitespace")(W):g(W))}function g(W){return W===null||Qt(W)?(e.exit("codeFencedFence"),i.interrupt?t(W):e.check(SS,C,Y)(W)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),v(W))}function v(W){return W===null||Qt(W)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(W)):xn(W)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Pn(e,y,"whitespace")(W)):W===96&&W===d?r(W):(e.consume(W),v)}function y(W){return W===null||Qt(W)?g(W):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(W))}function x(W){return W===null||Qt(W)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(W)):W===96&&W===d?r(W):(e.consume(W),x)}function C(W){return e.attempt(a,Y,j)(W)}function j(W){return e.enter("lineEnding"),e.consume(W),e.exit("lineEnding"),N}function N(W){return c>0&&xn(W)?Pn(e,P,"linePrefix",c+1)(W):P(W)}function P(W){return W===null||Qt(W)?e.check(SS,C,Y)(W):(e.enter("codeFlowValue"),L(W))}function L(W){return W===null||Qt(W)?(e.exit("codeFlowValue"),P(W)):(e.consume(W),L)}function Y(W){return e.exit("codeFenced"),t(W)}function H(W,I,M){let O=0;return F;function F(A){return W.enter("lineEnding"),W.consume(A),W.exit("lineEnding"),X}function X(A){return W.enter("codeFencedFence"),xn(A)?Pn(W,U,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):U(A)}function U(A){return A===d?(W.enter("codeFencedFenceSequence"),G(A)):M(A)}function G(A){return A===d?(O++,W.consume(A),G):O>=u?(W.exit("codeFencedFenceSequence"),xn(A)?Pn(W,R,"whitespace")(A):R(A)):M(A)}function R(A){return A===null||Qt(A)?(W.exit("codeFencedFence"),I(A)):M(A)}}}function vW(e,t,r){const i=this;return a;function a(u){return u===null?r(u):(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c)}function c(u){return i.parser.lazy[i.now().line]?r(u):t(u)}}const Nf={name:"codeIndented",tokenize:kW},yW={partial:!0,tokenize:xW};function kW(e,t,r){const i=this;return a;function a(f){return e.enter("codeIndented"),Pn(e,c,"linePrefix",5)(f)}function c(f){const w=i.events[i.events.length-1];return w&&w[1].type==="linePrefix"&&w[2].sliceSerialize(w[1],!0).length>=4?u(f):r(f)}function u(f){return f===null?m(f):Qt(f)?e.attempt(yW,u,m)(f):(e.enter("codeFlowValue"),d(f))}function d(f){return f===null||Qt(f)?(e.exit("codeFlowValue"),u(f)):(e.consume(f),d)}function m(f){return e.exit("codeIndented"),t(f)}}function xW(e,t,r){const i=this;return a;function a(u){return i.parser.lazy[i.now().line]?r(u):Qt(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),a):Pn(e,c,"linePrefix",5)(u)}function c(u){const d=i.events[i.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):Qt(u)?a(u):r(u)}}const SW={name:"codeText",previous:jW,resolve:CW,tokenize:NW};function CW(e){let t=e.length-4,r=3,i,a;if((e[r][1].type==="lineEnding"||e[r][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=r;++i<t;)if(e[i][1].type==="codeTextData"){e[r][1].type="codeTextPadding",e[t][1].type="codeTextPadding",r+=2,t-=2;break}}for(i=r-1,t++;++i<=t;)a===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(a=i):(i===t||e[i][1].type==="lineEnding")&&(e[a][1].type="codeTextData",i!==a+2&&(e[a][1].end=e[i-1][1].end,e.splice(a+2,i-a-2),t-=i-a-2,i=a+2),a=void 0);return e}function jW(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function NW(e,t,r){let i=0,a,c;return u;function u(g){return e.enter("codeText"),e.enter("codeTextSequence"),d(g)}function d(g){return g===96?(e.consume(g),i++,d):(e.exit("codeTextSequence"),m(g))}function m(g){return g===null?r(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),m):g===96?(c=e.enter("codeTextSequence"),a=0,w(g)):Qt(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),m):(e.enter("codeTextData"),f(g))}function f(g){return g===null||g===32||g===96||Qt(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),f)}function w(g){return g===96?(e.consume(g),a++,w):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(c.type="codeTextData",f(g))}}class TW{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,r){const i=r??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,r,i){const a=r||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&gc(this.left,i),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),gc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),gc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const r=this.left.splice(t,Number.POSITIVE_INFINITY);gc(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);gc(this.left,r.reverse())}}}function gc(e,t){let r=0;if(t.length<1e4)e.push(...t);else for(;r<t.length;)e.push(...t.slice(r,r+1e4)),r+=1e4}function gD(e){const t={};let r=-1,i,a,c,u,d,m,f;const w=new TW(e);for(;++r<w.length;){for(;r in t;)r=t[r];if(i=w.get(r),r&&i[1].type==="chunkFlow"&&w.get(r-1)[1].type==="listItemPrefix"&&(m=i[1]._tokenizer.events,c=0,c<m.length&&m[c][1].type==="lineEndingBlank"&&(c+=2),c<m.length&&m[c][1].type==="content"))for(;++c<m.length&&m[c][1].type!=="content";)m[c][1].type==="chunkText"&&(m[c][1]._isInFirstContentOfListItem=!0,c++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,PW(w,r)),r=t[r],f=!0);else if(i[1]._container){for(c=r,a=void 0;c--;)if(u=w.get(c),u[1].type==="lineEnding"||u[1].type==="lineEndingBlank")u[0]==="enter"&&(a&&(w.get(a)[1].type="lineEndingBlank"),u[1].type="lineEnding",a=c);else if(!(u[1].type==="linePrefix"||u[1].type==="listItemIndent"))break;a&&(i[1].end={...w.get(a)[1].start},d=w.slice(a,r),d.unshift(i),w.splice(a,r-a+1,d))}}return Vi(e,0,Number.POSITIVE_INFINITY,w.slice(0)),!f}function PW(e,t){const r=e.get(t)[1],i=e.get(t)[2];let a=t-1;const c=[];let u=r._tokenizer;u||(u=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(u._contentTypeTextTrailing=!0));const d=u.events,m=[],f={};let w,g,v=-1,y=r,x=0,C=0;const j=[C];for(;y;){for(;e.get(++a)[1]!==y;);c.push(a),y._tokenizer||(w=i.sliceStream(y),y.next||w.push(null),g&&u.defineSkip(y.start),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=!0),u.write(w),y._isInFirstContentOfListItem&&(u._gfmTasklistFirstContentOfListItem=void 0)),g=y,y=y.next}for(y=r;++v<d.length;)d[v][0]==="exit"&&d[v-1][0]==="enter"&&d[v][1].type===d[v-1][1].type&&d[v][1].start.line!==d[v][1].end.line&&(C=v+1,j.push(C),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(u.events=[],y?(y._tokenizer=void 0,y.previous=void 0):j.pop(),v=j.length;v--;){const N=d.slice(j[v],j[v+1]),P=c.pop();m.push([P,P+N.length-1]),e.splice(P,2,N)}for(m.reverse(),v=-1;++v<m.length;)f[x+m[v][0]]=x+m[v][1],x+=m[v][1]-m[v][0]-1;return f}const DW={resolve:MW,tokenize:AW},RW={partial:!0,tokenize:EW};function MW(e){return gD(e),e}function AW(e,t){let r;return i;function i(d){return e.enter("content"),r=e.enter("chunkContent",{contentType:"content"}),a(d)}function a(d){return d===null?c(d):Qt(d)?e.check(RW,u,c)(d):(e.consume(d),a)}function c(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function u(d){return e.consume(d),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,a}}function EW(e,t,r){const i=this;return a;function a(u){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),Pn(e,c,"linePrefix")}function c(u){if(u===null||Qt(u))return r(u);const d=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(u):e.interrupt(i.parser.constructs.flow,r,t)(u)}}function bD(e,t,r,i,a,c,u,d,m){const f=m||Number.POSITIVE_INFINITY;let w=0;return g;function g(N){return N===60?(e.enter(i),e.enter(a),e.enter(c),e.consume(N),e.exit(c),v):N===null||N===32||N===41||qh(N)?r(N):(e.enter(i),e.enter(u),e.enter(d),e.enter("chunkString",{contentType:"string"}),C(N))}function v(N){return N===62?(e.enter(c),e.consume(N),e.exit(c),e.exit(a),e.exit(i),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),y(N))}function y(N){return N===62?(e.exit("chunkString"),e.exit(d),v(N)):N===null||N===60||Qt(N)?r(N):(e.consume(N),N===92?x:y)}function x(N){return N===60||N===62||N===92?(e.consume(N),y):y(N)}function C(N){return!w&&(N===null||N===41||Kn(N))?(e.exit("chunkString"),e.exit(d),e.exit(u),e.exit(i),t(N)):w<f&&N===40?(e.consume(N),w++,C):N===41?(e.consume(N),w--,C):N===null||N===32||N===40||qh(N)?r(N):(e.consume(N),N===92?j:C)}function j(N){return N===40||N===41||N===92?(e.consume(N),C):C(N)}}function wD(e,t,r,i,a,c){const u=this;let d=0,m;return f;function f(y){return e.enter(i),e.enter(a),e.consume(y),e.exit(a),e.enter(c),w}function w(y){return d>999||y===null||y===91||y===93&&!m||y===94&&!d&&"_hiddenFootnoteSupport"in u.parser.constructs?r(y):y===93?(e.exit(c),e.enter(a),e.consume(y),e.exit(a),e.exit(i),t):Qt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),w):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===null||y===91||y===93||Qt(y)||d++>999?(e.exit("chunkString"),w(y)):(e.consume(y),m||(m=!xn(y)),y===92?v:g)}function v(y){return y===91||y===92||y===93?(e.consume(y),d++,g):g(y)}}function vD(e,t,r,i,a,c){let u;return d;function d(v){return v===34||v===39||v===40?(e.enter(i),e.enter(a),e.consume(v),e.exit(a),u=v===40?41:v,m):r(v)}function m(v){return v===u?(e.enter(a),e.consume(v),e.exit(a),e.exit(i),t):(e.enter(c),f(v))}function f(v){return v===u?(e.exit(c),m(u)):v===null?r(v):Qt(v)?(e.enter("lineEnding"),e.consume(v),e.exit("lineEnding"),Pn(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),w(v))}function w(v){return v===u||v===null||Qt(v)?(e.exit("chunkString"),f(v)):(e.consume(v),v===92?g:w)}function g(v){return v===u||v===92?(e.consume(v),w):w(v)}}function Wc(e,t){let r;return i;function i(a){return Qt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r=!0,i):xn(a)?Pn(e,i,r?"linePrefix":"lineSuffix")(a):t(a)}}const IW={name:"definition",tokenize:FW},LW={partial:!0,tokenize:_W};function FW(e,t,r){const i=this;let a;return c;function c(y){return e.enter("definition"),u(y)}function u(y){return wD.call(i,e,d,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function d(y){return a=Ns(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),y===58?(e.enter("definitionMarker"),e.consume(y),e.exit("definitionMarker"),m):r(y)}function m(y){return Kn(y)?Wc(e,f)(y):f(y)}function f(y){return bD(e,w,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function w(y){return e.attempt(LW,g,g)(y)}function g(y){return xn(y)?Pn(e,v,"whitespace")(y):v(y)}function v(y){return y===null||Qt(y)?(e.exit("definition"),i.parser.defined.push(a),t(y)):r(y)}}function _W(e,t,r){return i;function i(d){return Kn(d)?Wc(e,a)(d):r(d)}function a(d){return vD(e,c,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function c(d){return xn(d)?Pn(e,u,"whitespace")(d):u(d)}function u(d){return d===null||Qt(d)?t(d):r(d)}}const OW={name:"hardBreakEscape",tokenize:BW};function BW(e,t,r){return i;function i(c){return e.enter("hardBreakEscape"),e.consume(c),a}function a(c){return Qt(c)?(e.exit("hardBreakEscape"),t(c)):r(c)}}const WW={name:"headingAtx",resolve:UW,tokenize:HW};function UW(e,t){let r=e.length-2,i=3,a,c;return e[i][1].type==="whitespace"&&(i+=2),r-2>i&&e[r][1].type==="whitespace"&&(r-=2),e[r][1].type==="atxHeadingSequence"&&(i===r-1||r-4>i&&e[r-2][1].type==="whitespace")&&(r-=i+1===r?2:4),r>i&&(a={type:"atxHeadingText",start:e[i][1].start,end:e[r][1].end},c={type:"chunkText",start:e[i][1].start,end:e[r][1].end,contentType:"text"},Vi(e,i,r-i+1,[["enter",a,t],["enter",c,t],["exit",c,t],["exit",a,t]])),e}function HW(e,t,r){let i=0;return a;function a(w){return e.enter("atxHeading"),c(w)}function c(w){return e.enter("atxHeadingSequence"),u(w)}function u(w){return w===35&&i++<6?(e.consume(w),u):w===null||Kn(w)?(e.exit("atxHeadingSequence"),d(w)):r(w)}function d(w){return w===35?(e.enter("atxHeadingSequence"),m(w)):w===null||Qt(w)?(e.exit("atxHeading"),t(w)):xn(w)?Pn(e,d,"whitespace")(w):(e.enter("atxHeadingText"),f(w))}function m(w){return w===35?(e.consume(w),m):(e.exit("atxHeadingSequence"),d(w))}function f(w){return w===null||w===35||Kn(w)?(e.exit("atxHeadingText"),d(w)):(e.consume(w),f)}}const zW=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],jS=["pre","script","style","textarea"],qW={concrete:!0,name:"htmlFlow",resolveTo:GW,tokenize:KW},$W={partial:!0,tokenize:XW},VW={partial:!0,tokenize:YW};function GW(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function KW(e,t,r){const i=this;let a,c,u,d,m;return f;function f(_){return w(_)}function w(_){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(_),g}function g(_){return _===33?(e.consume(_),v):_===47?(e.consume(_),c=!0,C):_===63?(e.consume(_),a=3,i.interrupt?t:T):gi(_)?(e.consume(_),u=String.fromCharCode(_),j):r(_)}function v(_){return _===45?(e.consume(_),a=2,y):_===91?(e.consume(_),a=5,d=0,x):gi(_)?(e.consume(_),a=4,i.interrupt?t:T):r(_)}function y(_){return _===45?(e.consume(_),i.interrupt?t:T):r(_)}function x(_){const de="CDATA[";return _===de.charCodeAt(d++)?(e.consume(_),d===de.length?i.interrupt?t:U:x):r(_)}function C(_){return gi(_)?(e.consume(_),u=String.fromCharCode(_),j):r(_)}function j(_){if(_===null||_===47||_===62||Kn(_)){const de=_===47,le=u.toLowerCase();return!de&&!c&&jS.includes(le)?(a=1,i.interrupt?t(_):U(_)):zW.includes(u.toLowerCase())?(a=6,de?(e.consume(_),N):i.interrupt?t(_):U(_)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(_):c?P(_):L(_))}return _===45||ai(_)?(e.consume(_),u+=String.fromCharCode(_),j):r(_)}function N(_){return _===62?(e.consume(_),i.interrupt?t:U):r(_)}function P(_){return xn(_)?(e.consume(_),P):F(_)}function L(_){return _===47?(e.consume(_),F):_===58||_===95||gi(_)?(e.consume(_),Y):xn(_)?(e.consume(_),L):F(_)}function Y(_){return _===45||_===46||_===58||_===95||ai(_)?(e.consume(_),Y):H(_)}function H(_){return _===61?(e.consume(_),W):xn(_)?(e.consume(_),H):L(_)}function W(_){return _===null||_===60||_===61||_===62||_===96?r(_):_===34||_===39?(e.consume(_),m=_,I):xn(_)?(e.consume(_),W):M(_)}function I(_){return _===m?(e.consume(_),m=null,O):_===null||Qt(_)?r(_):(e.consume(_),I)}function M(_){return _===null||_===34||_===39||_===47||_===60||_===61||_===62||_===96||Kn(_)?H(_):(e.consume(_),M)}function O(_){return _===47||_===62||xn(_)?L(_):r(_)}function F(_){return _===62?(e.consume(_),X):r(_)}function X(_){return _===null||Qt(_)?U(_):xn(_)?(e.consume(_),X):r(_)}function U(_){return _===45&&a===2?(e.consume(_),Z):_===60&&a===1?(e.consume(_),pe):_===62&&a===4?(e.consume(_),B):_===63&&a===3?(e.consume(_),T):_===93&&a===5?(e.consume(_),D):Qt(_)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check($W,Q,G)(_)):_===null||Qt(_)?(e.exit("htmlFlowData"),G(_)):(e.consume(_),U)}function G(_){return e.check(VW,R,Q)(_)}function R(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),A}function A(_){return _===null||Qt(_)?G(_):(e.enter("htmlFlowData"),U(_))}function Z(_){return _===45?(e.consume(_),T):U(_)}function pe(_){return _===47?(e.consume(_),u="",q):U(_)}function q(_){if(_===62){const de=u.toLowerCase();return jS.includes(de)?(e.consume(_),B):U(_)}return gi(_)&&u.length<8?(e.consume(_),u+=String.fromCharCode(_),q):U(_)}function D(_){return _===93?(e.consume(_),T):U(_)}function T(_){return _===62?(e.consume(_),B):_===45&&a===2?(e.consume(_),T):U(_)}function B(_){return _===null||Qt(_)?(e.exit("htmlFlowData"),Q(_)):(e.consume(_),B)}function Q(_){return e.exit("htmlFlow"),t(_)}}function YW(e,t,r){const i=this;return a;function a(u){return Qt(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):r(u)}function c(u){return i.parser.lazy[i.now().line]?r(u):t(u)}}function XW(e,t,r){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Su,t,r)}}const QW={name:"htmlText",tokenize:JW};function JW(e,t,r){const i=this;let a,c,u;return d;function d(T){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(T),m}function m(T){return T===33?(e.consume(T),f):T===47?(e.consume(T),H):T===63?(e.consume(T),L):gi(T)?(e.consume(T),M):r(T)}function f(T){return T===45?(e.consume(T),w):T===91?(e.consume(T),c=0,x):gi(T)?(e.consume(T),P):r(T)}function w(T){return T===45?(e.consume(T),y):r(T)}function g(T){return T===null?r(T):T===45?(e.consume(T),v):Qt(T)?(u=g,pe(T)):(e.consume(T),g)}function v(T){return T===45?(e.consume(T),y):g(T)}function y(T){return T===62?Z(T):T===45?v(T):g(T)}function x(T){const B="CDATA[";return T===B.charCodeAt(c++)?(e.consume(T),c===B.length?C:x):r(T)}function C(T){return T===null?r(T):T===93?(e.consume(T),j):Qt(T)?(u=C,pe(T)):(e.consume(T),C)}function j(T){return T===93?(e.consume(T),N):C(T)}function N(T){return T===62?Z(T):T===93?(e.consume(T),N):C(T)}function P(T){return T===null||T===62?Z(T):Qt(T)?(u=P,pe(T)):(e.consume(T),P)}function L(T){return T===null?r(T):T===63?(e.consume(T),Y):Qt(T)?(u=L,pe(T)):(e.consume(T),L)}function Y(T){return T===62?Z(T):L(T)}function H(T){return gi(T)?(e.consume(T),W):r(T)}function W(T){return T===45||ai(T)?(e.consume(T),W):I(T)}function I(T){return Qt(T)?(u=I,pe(T)):xn(T)?(e.consume(T),I):Z(T)}function M(T){return T===45||ai(T)?(e.consume(T),M):T===47||T===62||Kn(T)?O(T):r(T)}function O(T){return T===47?(e.consume(T),Z):T===58||T===95||gi(T)?(e.consume(T),F):Qt(T)?(u=O,pe(T)):xn(T)?(e.consume(T),O):Z(T)}function F(T){return T===45||T===46||T===58||T===95||ai(T)?(e.consume(T),F):X(T)}function X(T){return T===61?(e.consume(T),U):Qt(T)?(u=X,pe(T)):xn(T)?(e.consume(T),X):O(T)}function U(T){return T===null||T===60||T===61||T===62||T===96?r(T):T===34||T===39?(e.consume(T),a=T,G):Qt(T)?(u=U,pe(T)):xn(T)?(e.consume(T),U):(e.consume(T),R)}function G(T){return T===a?(e.consume(T),a=void 0,A):T===null?r(T):Qt(T)?(u=G,pe(T)):(e.consume(T),G)}function R(T){return T===null||T===34||T===39||T===60||T===61||T===96?r(T):T===47||T===62||Kn(T)?O(T):(e.consume(T),R)}function A(T){return T===47||T===62||Kn(T)?O(T):r(T)}function Z(T){return T===62?(e.consume(T),e.exit("htmlTextData"),e.exit("htmlText"),t):r(T)}function pe(T){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),q}function q(T){return xn(T)?Pn(e,D,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):D(T)}function D(T){return e.enter("htmlTextData"),u(T)}}const kw={name:"labelEnd",resolveAll:nU,resolveTo:rU,tokenize:iU},ZW={tokenize:sU},eU={tokenize:aU},tU={tokenize:oU};function nU(e){let t=-1;const r=[];for(;++t<e.length;){const i=e[t][1];if(r.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const a=i.type==="labelImage"?4:2;i.type="data",t+=a}}return e.length!==r.length&&Vi(e,0,e.length,r),e}function rU(e,t){let r=e.length,i=0,a,c,u,d;for(;r--;)if(a=e[r][1],c){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[r][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(u){if(e[r][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(c=r,a.type!=="labelLink")){i=2;break}}else a.type==="labelEnd"&&(u=r);const m={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[c][1].start},end:{...e[u][1].end}},w={type:"labelText",start:{...e[c+i+2][1].end},end:{...e[u-2][1].start}};return d=[["enter",m,t],["enter",f,t]],d=ls(d,e.slice(c+1,c+i+3)),d=ls(d,[["enter",w,t]]),d=ls(d,km(t.parser.constructs.insideSpan.null,e.slice(c+i+4,u-3),t)),d=ls(d,[["exit",w,t],e[u-2],e[u-1],["exit",f,t]]),d=ls(d,e.slice(u+1)),d=ls(d,[["exit",m,t]]),Vi(e,c,e.length,d),e}function iU(e,t,r){const i=this;let a=i.events.length,c,u;for(;a--;)if((i.events[a][1].type==="labelImage"||i.events[a][1].type==="labelLink")&&!i.events[a][1]._balanced){c=i.events[a][1];break}return d;function d(v){return c?c._inactive?g(v):(u=i.parser.defined.includes(Ns(i.sliceSerialize({start:c.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(v),e.exit("labelMarker"),e.exit("labelEnd"),m):r(v)}function m(v){return v===40?e.attempt(ZW,w,u?w:g)(v):v===91?e.attempt(eU,w,u?f:g)(v):u?w(v):g(v)}function f(v){return e.attempt(tU,w,g)(v)}function w(v){return t(v)}function g(v){return c._balanced=!0,r(v)}}function sU(e,t,r){return i;function i(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),a}function a(g){return Kn(g)?Wc(e,c)(g):c(g)}function c(g){return g===41?w(g):bD(e,u,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function u(g){return Kn(g)?Wc(e,m)(g):w(g)}function d(g){return r(g)}function m(g){return g===34||g===39||g===40?vD(e,f,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):w(g)}function f(g){return Kn(g)?Wc(e,w)(g):w(g)}function w(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):r(g)}}function aU(e,t,r){const i=this;return a;function a(d){return wD.call(i,e,c,u,"reference","referenceMarker","referenceString")(d)}function c(d){return i.parser.defined.includes(Ns(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(d):r(d)}function u(d){return r(d)}}function oU(e,t,r){return i;function i(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),a}function a(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):r(c)}}const lU={name:"labelStartImage",resolveAll:kw.resolveAll,tokenize:cU};function cU(e,t,r){const i=this;return a;function a(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),c}function c(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),u):r(d)}function u(d){return d===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(d):t(d)}}const uU={name:"labelStartLink",resolveAll:kw.resolveAll,tokenize:dU};function dU(e,t,r){const i=this;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),e.exit("labelLink"),c}function c(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(u):t(u)}}const Tf={name:"lineEnding",tokenize:hU};function hU(e,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Pn(e,t,"linePrefix")}}const bh={name:"thematicBreak",tokenize:mU};function mU(e,t,r){let i=0,a;return c;function c(f){return e.enter("thematicBreak"),u(f)}function u(f){return a=f,d(f)}function d(f){return f===a?(e.enter("thematicBreakSequence"),m(f)):i>=3&&(f===null||Qt(f))?(e.exit("thematicBreak"),t(f)):r(f)}function m(f){return f===a?(e.consume(f),i++,m):(e.exit("thematicBreakSequence"),xn(f)?Pn(e,d,"whitespace")(f):d(f))}}const Ni={continuation:{tokenize:bU},exit:vU,name:"list",tokenize:gU},pU={partial:!0,tokenize:yU},fU={partial:!0,tokenize:wU};function gU(e,t,r){const i=this,a=i.events[i.events.length-1];let c=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,u=0;return d;function d(y){const x=i.containerState.type||(y===42||y===43||y===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!i.containerState.marker||y===i.containerState.marker:Yg(y)){if(i.containerState.type||(i.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),y===42||y===45?e.check(bh,r,f)(y):f(y);if(!i.interrupt||y===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),m(y)}return r(y)}function m(y){return Yg(y)&&++u<10?(e.consume(y),m):(!i.interrupt||u<2)&&(i.containerState.marker?y===i.containerState.marker:y===41||y===46)?(e.exit("listItemValue"),f(y)):r(y)}function f(y){return e.enter("listItemMarker"),e.consume(y),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||y,e.check(Su,i.interrupt?r:w,e.attempt(pU,v,g))}function w(y){return i.containerState.initialBlankLine=!0,c++,v(y)}function g(y){return xn(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),v):r(y)}function v(y){return i.containerState.size=c+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function bU(e,t,r){const i=this;return i.containerState._closeFlow=void 0,e.check(Su,a,c);function a(d){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Pn(e,t,"listItemIndent",i.containerState.size+1)(d)}function c(d){return i.containerState.furtherBlankLines||!xn(d)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,u(d)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(fU,t,u)(d))}function u(d){return i.containerState._closeFlow=!0,i.interrupt=void 0,Pn(e,e.attempt(Ni,t,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function wU(e,t,r){const i=this;return Pn(e,a,"listItemIndent",i.containerState.size+1);function a(c){const u=i.events[i.events.length-1];return u&&u[1].type==="listItemIndent"&&u[2].sliceSerialize(u[1],!0).length===i.containerState.size?t(c):r(c)}}function vU(e){e.exit(this.containerState.type)}function yU(e,t,r){const i=this;return Pn(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(c){const u=i.events[i.events.length-1];return!xn(c)&&u&&u[1].type==="listItemPrefixWhitespace"?t(c):r(c)}}const NS={name:"setextUnderline",resolveTo:kU,tokenize:xU};function kU(e,t){let r=e.length,i,a,c;for(;r--;)if(e[r][0]==="enter"){if(e[r][1].type==="content"){i=r;break}e[r][1].type==="paragraph"&&(a=r)}else e[r][1].type==="content"&&e.splice(r,1),!c&&e[r][1].type==="definition"&&(c=r);const u={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",c?(e.splice(a,0,["enter",u,t]),e.splice(c+1,0,["exit",e[i][1],t]),e[i][1].end={...e[c][1].end}):e[i][1]=u,e.push(["exit",u,t]),e}function xU(e,t,r){const i=this;let a;return c;function c(f){let w=i.events.length,g;for(;w--;)if(i.events[w][1].type!=="lineEnding"&&i.events[w][1].type!=="linePrefix"&&i.events[w][1].type!=="content"){g=i.events[w][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(e.enter("setextHeadingLine"),a=f,u(f)):r(f)}function u(f){return e.enter("setextHeadingLineSequence"),d(f)}function d(f){return f===a?(e.consume(f),d):(e.exit("setextHeadingLineSequence"),xn(f)?Pn(e,m,"lineSuffix")(f):m(f))}function m(f){return f===null||Qt(f)?(e.exit("setextHeadingLine"),t(f)):r(f)}}const SU={tokenize:CU};function CU(e){const t=this,r=e.attempt(Su,i,e.attempt(this.parser.constructs.flowInitial,a,Pn(e,e.attempt(this.parser.constructs.flow,a,e.attempt(DW,a)),"linePrefix")));return r;function i(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function a(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const jU={resolveAll:kD()},NU=yD("string"),TU=yD("text");function yD(e){return{resolveAll:kD(e==="text"?PU:void 0),tokenize:t};function t(r){const i=this,a=this.parser.constructs[e],c=r.attempt(a,u,d);return u;function u(w){return f(w)?c(w):d(w)}function d(w){if(w===null){r.consume(w);return}return r.enter("data"),r.consume(w),m}function m(w){return f(w)?(r.exit("data"),c(w)):(r.consume(w),m)}function f(w){if(w===null)return!0;const g=a[w];let v=-1;if(g)for(;++v<g.length;){const y=g[v];if(!y.previous||y.previous.call(i,i.previous))return!0}return!1}}}function kD(e){return t;function t(r,i){let a=-1,c;for(;++a<=r.length;)c===void 0?r[a]&&r[a][1].type==="data"&&(c=a,a++):(!r[a]||r[a][1].type!=="data")&&(a!==c+2&&(r[c][1].end=r[a-1][1].end,r.splice(c+2,a-c-2),a=c+2),c=void 0);return e?e(r,i):r}}function PU(e,t){let r=0;for(;++r<=e.length;)if((r===e.length||e[r][1].type==="lineEnding")&&e[r-1][1].type==="data"){const i=e[r-1][1],a=t.sliceStream(i);let c=a.length,u=-1,d=0,m;for(;c--;){const f=a[c];if(typeof f=="string"){for(u=f.length;f.charCodeAt(u-1)===32;)d++,u--;if(u)break;u=-1}else if(f===-2)m=!0,d++;else if(f!==-1){c++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(d=0),d){const f={type:r===e.length||m||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?u:i.start._bufferIndex+u,_index:i.start._index+c,line:i.end.line,column:i.end.column-d,offset:i.end.offset-d},end:{...i.end}};i.end={...f.start},i.start.offset===i.end.offset?Object.assign(i,f):(e.splice(r,0,["enter",f,t],["exit",f,t]),r+=2)}r++}return e}const DU={42:Ni,43:Ni,45:Ni,48:Ni,49:Ni,50:Ni,51:Ni,52:Ni,53:Ni,54:Ni,55:Ni,56:Ni,57:Ni,62:mD},RU={91:IW},MU={[-2]:Nf,[-1]:Nf,32:Nf},AU={35:WW,42:bh,45:[NS,bh],60:qW,61:NS,95:bh,96:CS,126:CS},EU={38:fD,92:pD},IU={[-5]:Tf,[-4]:Tf,[-3]:Tf,33:lU,38:fD,42:Xg,60:[uW,QW],91:uU,92:[OW,pD],93:kw,95:Xg,96:SW},LU={null:[Xg,jU]},FU={null:[42,95]},_U={null:[]},OU=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:FU,contentInitial:RU,disable:_U,document:DU,flow:AU,flowInitial:MU,insideSpan:LU,string:EU,text:IU},Symbol.toStringTag,{value:"Module"}));function BU(e,t,r){let i={_bufferIndex:-1,_index:0,line:r&&r.line||1,column:r&&r.column||1,offset:r&&r.offset||0};const a={},c=[];let u=[],d=[];const m={attempt:I(H),check:I(W),consume:P,enter:L,exit:Y,interrupt:I(W,{interrupt:!0})},f={code:null,containerState:{},defineSkip:C,events:[],now:x,parser:e,previous:null,sliceSerialize:v,sliceStream:y,write:g};let w=t.tokenize.call(f,m);return t.resolveAll&&c.push(t),f;function g(X){return u=ls(u,X),j(),u[u.length-1]!==null?[]:(M(t,0),f.events=km(c,f.events,f),f.events)}function v(X,U){return UU(y(X),U)}function y(X){return WU(u,X)}function x(){const{_bufferIndex:X,_index:U,line:G,column:R,offset:A}=i;return{_bufferIndex:X,_index:U,line:G,column:R,offset:A}}function C(X){a[X.line]=X.column,F()}function j(){let X;for(;i._index<u.length;){const U=u[i._index];if(typeof U=="string")for(X=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===X&&i._bufferIndex<U.length;)N(U.charCodeAt(i._bufferIndex));else N(U)}}function N(X){w=w(X)}function P(X){Qt(X)?(i.line++,i.column=1,i.offset+=X===-3?2:1,F()):X!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===u[i._index].length&&(i._bufferIndex=-1,i._index++)),f.previous=X}function L(X,U){const G=U||{};return G.type=X,G.start=x(),f.events.push(["enter",G,f]),d.push(G),G}function Y(X){const U=d.pop();return U.end=x(),f.events.push(["exit",U,f]),U}function H(X,U){M(X,U.from)}function W(X,U){U.restore()}function I(X,U){return G;function G(R,A,Z){let pe,q,D,T;return Array.isArray(R)?Q(R):"tokenize"in R?Q([R]):B(R);function B(oe){return ye;function ye(Ne){const Me=Ne!==null&&oe[Ne],Te=Ne!==null&&oe.null,Dt=[...Array.isArray(Me)?Me:Me?[Me]:[],...Array.isArray(Te)?Te:Te?[Te]:[]];return Q(Dt)(Ne)}}function Q(oe){return pe=oe,q=0,oe.length===0?Z:_(oe[q])}function _(oe){return ye;function ye(Ne){return T=O(),D=oe,oe.partial||(f.currentConstruct=oe),oe.name&&f.parser.constructs.disable.null.includes(oe.name)?le():oe.tokenize.call(U?Object.assign(Object.create(f),U):f,m,de,le)(Ne)}}function de(oe){return X(D,T),A}function le(oe){return T.restore(),++q<pe.length?_(pe[q]):Z}}}function M(X,U){X.resolveAll&&!c.includes(X)&&c.push(X),X.resolve&&Vi(f.events,U,f.events.length-U,X.resolve(f.events.slice(U),f)),X.resolveTo&&(f.events=X.resolveTo(f.events,f))}function O(){const X=x(),U=f.previous,G=f.currentConstruct,R=f.events.length,A=Array.from(d);return{from:R,restore:Z};function Z(){i=X,f.previous=U,f.currentConstruct=G,f.events.length=R,d=A,F()}}function F(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function WU(e,t){const r=t.start._index,i=t.start._bufferIndex,a=t.end._index,c=t.end._bufferIndex;let u;if(r===a)u=[e[r].slice(i,c)];else{if(u=e.slice(r,a),i>-1){const d=u[0];typeof d=="string"?u[0]=d.slice(i):u.shift()}c>0&&u.push(e[a].slice(0,c))}return u}function UU(e,t){let r=-1;const i=[];let a;for(;++r<e.length;){const c=e[r];let u;if(typeof c=="string")u=c;else switch(c){case-5:{u="\r";break}case-4:{u=`
|
|
71
|
-
`;break}case-3:{u=`\r
|
|
72
|
-
`;break}case-2:{u=t?" ":" ";break}case-1:{if(!t&&a)continue;u=" ";break}default:u=String.fromCharCode(c)}a=c===-2,i.push(u)}return i.join("")}function HU(e){const i={constructs:dD([OU,...(e||{}).extensions||[]]),content:a(rW),defined:[],document:a(sW),flow:a(SU),lazy:{},string:a(NU),text:a(TU)};return i;function a(c){return u;function u(d){return BU(i,c,d)}}}function zU(e){for(;!gD(e););return e}const TS=/[\0\t\n\r]/g;function qU(){let e=1,t="",r=!0,i;return a;function a(c,u,d){const m=[];let f,w,g,v,y;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(u||void 0).decode(c)),g=0,t="",r&&(c.charCodeAt(0)===65279&&g++,r=void 0);g<c.length;){if(TS.lastIndex=g,f=TS.exec(c),v=f&&f.index!==void 0?f.index:c.length,y=c.charCodeAt(v),!f){t=c.slice(g);break}if(y===10&&g===v&&i)m.push(-3),i=void 0;else switch(i&&(m.push(-5),i=void 0),g<v&&(m.push(c.slice(g,v)),e+=v-g),y){case 0:{m.push(65533),e++;break}case 9:{for(w=Math.ceil(e/4)*4,m.push(-2);e++<w;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:i=!0,e=1}g=v+1}return d&&(i&&m.push(-5),t&&m.push(t),m.push(null)),m}}const $U=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function VU(e){return e.replace($U,GU)}function GU(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const a=r.charCodeAt(1),c=a===120||a===88;return hD(r.slice(c?2:1),c?16:10)}return yw(r)||e}const xD={}.hasOwnProperty;function KU(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),YU(r)(zU(HU(r).document().write(qU()(e,t,!0))))}function YU(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(Oe),autolinkProtocol:O,autolinkEmail:O,atxHeading:c(pt),blockQuote:c(Te),characterEscape:O,characterReference:O,codeFenced:c(Dt),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:c(Dt,u),codeText:c(st,u),codeTextData:O,data:O,codeFlowValue:O,definition:c(dt),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:c(bt),hardBreakEscape:c(we),hardBreakTrailing:c(we),htmlFlow:c(he,u),htmlFlowData:O,htmlText:c(he,u),htmlTextData:O,image:c(Le),label:u,link:c(Oe),listItem:c(wt),listItemValue:v,listOrdered:c(Qe,g),listUnordered:c(Qe),paragraph:c(Ie),reference:_,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:c(pt),strong:c(Be),thematicBreak:c(ft)},exit:{atxHeading:m(),atxHeadingSequence:H,autolink:m(),autolinkEmail:Me,autolinkProtocol:Ne,blockQuote:m(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:le,characterReferenceMarkerNumeric:le,characterReferenceValue:oe,characterReference:ye,codeFenced:m(j),codeFencedFence:C,codeFencedFenceInfo:y,codeFencedFenceMeta:x,codeFlowValue:F,codeIndented:m(N),codeText:m(A),codeTextData:F,data:F,definition:m(),definitionDestinationString:Y,definitionLabelString:P,definitionTitleString:L,emphasis:m(),hardBreakEscape:m(U),hardBreakTrailing:m(U),htmlFlow:m(G),htmlFlowData:F,htmlText:m(R),htmlTextData:F,image:m(pe),label:D,labelText:q,lineEnding:X,link:m(Z),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:de,resourceDestinationString:T,resourceTitleString:B,resource:Q,setextHeading:m(M),setextHeadingLineSequence:I,setextHeadingText:W,strong:m(),thematicBreak:m()}};SD(t,(e||{}).mdastExtensions||[]);const r={};return i;function i(ve){let Ae={type:"root",children:[]};const et={stack:[Ae],tokenStack:[],config:t,enter:d,exit:f,buffer:u,resume:w,data:r},We=[];let lt=-1;for(;++lt<ve.length;)if(ve[lt][1].type==="listOrdered"||ve[lt][1].type==="listUnordered")if(ve[lt][0]==="enter")We.push(lt);else{const ct=We.pop();lt=a(ve,ct,lt)}for(lt=-1;++lt<ve.length;){const ct=t[ve[lt][0]];xD.call(ct,ve[lt][1].type)&&ct[ve[lt][1].type].call(Object.assign({sliceSerialize:ve[lt][2].sliceSerialize},et),ve[lt][1])}if(et.tokenStack.length>0){const ct=et.tokenStack[et.tokenStack.length-1];(ct[1]||PS).call(et,void 0,ct[0])}for(Ae.position={start:Ia(ve.length>0?ve[0][1].start:{line:1,column:1,offset:0}),end:Ia(ve.length>0?ve[ve.length-2][1].end:{line:1,column:1,offset:0})},lt=-1;++lt<t.transforms.length;)Ae=t.transforms[lt](Ae)||Ae;return Ae}function a(ve,Ae,et){let We=Ae-1,lt=-1,ct=!1,Vt,Bt,Wt,Lt;for(;++We<=et;){const Nt=ve[We];switch(Nt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Nt[0]==="enter"?lt++:lt--,Lt=void 0;break}case"lineEndingBlank":{Nt[0]==="enter"&&(Vt&&!Lt&&!lt&&!Wt&&(Wt=We),Lt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Lt=void 0}if(!lt&&Nt[0]==="enter"&&Nt[1].type==="listItemPrefix"||lt===-1&&Nt[0]==="exit"&&(Nt[1].type==="listUnordered"||Nt[1].type==="listOrdered")){if(Vt){let ln=We;for(Bt=void 0;ln--;){const Jt=ve[ln];if(Jt[1].type==="lineEnding"||Jt[1].type==="lineEndingBlank"){if(Jt[0]==="exit")continue;Bt&&(ve[Bt][1].type="lineEndingBlank",ct=!0),Jt[1].type="lineEnding",Bt=ln}else if(!(Jt[1].type==="linePrefix"||Jt[1].type==="blockQuotePrefix"||Jt[1].type==="blockQuotePrefixWhitespace"||Jt[1].type==="blockQuoteMarker"||Jt[1].type==="listItemIndent"))break}Wt&&(!Bt||Wt<Bt)&&(Vt._spread=!0),Vt.end=Object.assign({},Bt?ve[Bt][1].start:Nt[1].end),ve.splice(Bt||We,0,["exit",Vt,Nt[2]]),We++,et++}if(Nt[1].type==="listItemPrefix"){const ln={type:"listItem",_spread:!1,start:Object.assign({},Nt[1].start),end:void 0};Vt=ln,ve.splice(We,0,["enter",ln,Nt[2]]),We++,et++,Wt=void 0,Lt=!0}}}return ve[Ae][1]._spread=ct,et}function c(ve,Ae){return et;function et(We){d.call(this,ve(We),We),Ae&&Ae.call(this,We)}}function u(){this.stack.push({type:"fragment",children:[]})}function d(ve,Ae,et){this.stack[this.stack.length-1].children.push(ve),this.stack.push(ve),this.tokenStack.push([Ae,et||void 0]),ve.position={start:Ia(Ae.start),end:void 0}}function m(ve){return Ae;function Ae(et){ve&&ve.call(this,et),f.call(this,et)}}function f(ve,Ae){const et=this.stack.pop(),We=this.tokenStack.pop();if(We)We[0].type!==ve.type&&(Ae?Ae.call(this,ve,We[0]):(We[1]||PS).call(this,ve,We[0]));else throw new Error("Cannot close `"+ve.type+"` ("+Bc({start:ve.start,end:ve.end})+"): it’s not open");et.position.end=Ia(ve.end)}function w(){return vw(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function v(ve){if(this.data.expectingFirstListItemValue){const Ae=this.stack[this.stack.length-2];Ae.start=Number.parseInt(this.sliceSerialize(ve),10),this.data.expectingFirstListItemValue=void 0}}function y(){const ve=this.resume(),Ae=this.stack[this.stack.length-1];Ae.lang=ve}function x(){const ve=this.resume(),Ae=this.stack[this.stack.length-1];Ae.meta=ve}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function j(){const ve=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=ve.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function N(){const ve=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=ve.replace(/(\r?\n|\r)$/g,"")}function P(ve){const Ae=this.resume(),et=this.stack[this.stack.length-1];et.label=Ae,et.identifier=Ns(this.sliceSerialize(ve)).toLowerCase()}function L(){const ve=this.resume(),Ae=this.stack[this.stack.length-1];Ae.title=ve}function Y(){const ve=this.resume(),Ae=this.stack[this.stack.length-1];Ae.url=ve}function H(ve){const Ae=this.stack[this.stack.length-1];if(!Ae.depth){const et=this.sliceSerialize(ve).length;Ae.depth=et}}function W(){this.data.setextHeadingSlurpLineEnding=!0}function I(ve){const Ae=this.stack[this.stack.length-1];Ae.depth=this.sliceSerialize(ve).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function O(ve){const et=this.stack[this.stack.length-1].children;let We=et[et.length-1];(!We||We.type!=="text")&&(We=vt(),We.position={start:Ia(ve.start),end:void 0},et.push(We)),this.stack.push(We)}function F(ve){const Ae=this.stack.pop();Ae.value+=this.sliceSerialize(ve),Ae.position.end=Ia(ve.end)}function X(ve){const Ae=this.stack[this.stack.length-1];if(this.data.atHardBreak){const et=Ae.children[Ae.children.length-1];et.position.end=Ia(ve.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Ae.type)&&(O.call(this,ve),F.call(this,ve))}function U(){this.data.atHardBreak=!0}function G(){const ve=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=ve}function R(){const ve=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=ve}function A(){const ve=this.resume(),Ae=this.stack[this.stack.length-1];Ae.value=ve}function Z(){const ve=this.stack[this.stack.length-1];if(this.data.inReference){const Ae=this.data.referenceType||"shortcut";ve.type+="Reference",ve.referenceType=Ae,delete ve.url,delete ve.title}else delete ve.identifier,delete ve.label;this.data.referenceType=void 0}function pe(){const ve=this.stack[this.stack.length-1];if(this.data.inReference){const Ae=this.data.referenceType||"shortcut";ve.type+="Reference",ve.referenceType=Ae,delete ve.url,delete ve.title}else delete ve.identifier,delete ve.label;this.data.referenceType=void 0}function q(ve){const Ae=this.sliceSerialize(ve),et=this.stack[this.stack.length-2];et.label=VU(Ae),et.identifier=Ns(Ae).toLowerCase()}function D(){const ve=this.stack[this.stack.length-1],Ae=this.resume(),et=this.stack[this.stack.length-1];if(this.data.inReference=!0,et.type==="link"){const We=ve.children;et.children=We}else et.alt=Ae}function T(){const ve=this.resume(),Ae=this.stack[this.stack.length-1];Ae.url=ve}function B(){const ve=this.resume(),Ae=this.stack[this.stack.length-1];Ae.title=ve}function Q(){this.data.inReference=void 0}function _(){this.data.referenceType="collapsed"}function de(ve){const Ae=this.resume(),et=this.stack[this.stack.length-1];et.label=Ae,et.identifier=Ns(this.sliceSerialize(ve)).toLowerCase(),this.data.referenceType="full"}function le(ve){this.data.characterReferenceType=ve.type}function oe(ve){const Ae=this.sliceSerialize(ve),et=this.data.characterReferenceType;let We;et?(We=hD(Ae,et==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):We=yw(Ae);const lt=this.stack[this.stack.length-1];lt.value+=We}function ye(ve){const Ae=this.stack.pop();Ae.position.end=Ia(ve.end)}function Ne(ve){F.call(this,ve);const Ae=this.stack[this.stack.length-1];Ae.url=this.sliceSerialize(ve)}function Me(ve){F.call(this,ve);const Ae=this.stack[this.stack.length-1];Ae.url="mailto:"+this.sliceSerialize(ve)}function Te(){return{type:"blockquote",children:[]}}function Dt(){return{type:"code",lang:null,meta:null,value:""}}function st(){return{type:"inlineCode",value:""}}function dt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function bt(){return{type:"emphasis",children:[]}}function pt(){return{type:"heading",depth:0,children:[]}}function we(){return{type:"break"}}function he(){return{type:"html",value:""}}function Le(){return{type:"image",title:null,url:"",alt:null}}function Oe(){return{type:"link",title:null,url:"",children:[]}}function Qe(ve){return{type:"list",ordered:ve.type==="listOrdered",start:null,spread:ve._spread,children:[]}}function wt(ve){return{type:"listItem",spread:ve._spread,checked:null,children:[]}}function Ie(){return{type:"paragraph",children:[]}}function Be(){return{type:"strong",children:[]}}function vt(){return{type:"text",value:""}}function ft(){return{type:"thematicBreak"}}}function Ia(e){return{line:e.line,column:e.column,offset:e.offset}}function SD(e,t){let r=-1;for(;++r<t.length;){const i=t[r];Array.isArray(i)?SD(e,i):XU(e,i)}}function XU(e,t){let r;for(r in t)if(xD.call(t,r))switch(r){case"canContainEols":{const i=t[r];i&&e[r].push(...i);break}case"transforms":{const i=t[r];i&&e[r].push(...i);break}case"enter":case"exit":{const i=t[r];i&&Object.assign(e[r],i);break}}}function PS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Bc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Bc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Bc({start:t.start,end:t.end})+") is still open")}function QU(e){const t=this;t.parser=r;function r(i){return KU(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function JU(e,t){const r={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,r),e.applyData(t,r)}function ZU(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
73
|
-
`}]}function eH(e,t){const r=t.value?t.value+`
|
|
74
|
-
`:"",i={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(i.className=["language-"+a[0]]);let c={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function tH(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function nH(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function rH(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=Fl(i.toLowerCase()),c=e.footnoteOrder.indexOf(i);let u,d=e.footnoteCounts.get(i);d===void 0?(d=0,e.footnoteOrder.push(i),u=e.footnoteOrder.length):u=c+1,d+=1,e.footnoteCounts.set(i,d);const m={type:"element",tagName:"a",properties:{href:"#"+r+"fn-"+a,id:r+"fnref-"+a+(d>1?"-"+d:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(u)}]};e.patch(t,m);const f={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,f),e.applyData(t,f)}function iH(e,t){const r={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function sH(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function CD(e,t){const r=t.referenceType;let i="]";if(r==="collapsed"?i+="[]":r==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const a=e.all(t),c=a[0];c&&c.type==="text"?c.value="["+c.value:a.unshift({type:"text",value:"["});const u=a[a.length-1];return u&&u.type==="text"?u.value+=i:a.push({type:"text",value:i}),a}function aH(e,t){const r=String(t.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return CD(e,t);const a={src:Fl(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(a.title=i.title);const c={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,c),e.applyData(t,c)}function oH(e,t){const r={src:Fl(t.url)};t.alt!==null&&t.alt!==void 0&&(r.alt=t.alt),t.title!==null&&t.title!==void 0&&(r.title=t.title);const i={type:"element",tagName:"img",properties:r,children:[]};return e.patch(t,i),e.applyData(t,i)}function lH(e,t){const r={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,r);const i={type:"element",tagName:"code",properties:{},children:[r]};return e.patch(t,i),e.applyData(t,i)}function cH(e,t){const r=String(t.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return CD(e,t);const a={href:Fl(i.url||"")};i.title!==null&&i.title!==void 0&&(a.title=i.title);const c={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function uH(e,t){const r={href:Fl(t.url)};t.title!==null&&t.title!==void 0&&(r.title=t.title);const i={type:"element",tagName:"a",properties:r,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function dH(e,t,r){const i=e.all(t),a=r?hH(r):jD(t),c={},u=[];if(typeof t.checked=="boolean"){const w=i[0];let g;w&&w.type==="element"&&w.tagName==="p"?g=w:(g={type:"element",tagName:"p",properties:{},children:[]},i.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let d=-1;for(;++d<i.length;){const w=i[d];(a||d!==0||w.type!=="element"||w.tagName!=="p")&&u.push({type:"text",value:`
|
|
75
|
-
`}),w.type==="element"&&w.tagName==="p"&&!a?u.push(...w.children):u.push(w)}const m=i[i.length-1];m&&(a||m.type!=="element"||m.tagName!=="p")&&u.push({type:"text",value:`
|
|
76
|
-
`});const f={type:"element",tagName:"li",properties:c,children:u};return e.patch(t,f),e.applyData(t,f)}function hH(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const r=e.children;let i=-1;for(;!t&&++i<r.length;)t=jD(r[i])}return t}function jD(e){const t=e.spread;return t??e.children.length>1}function mH(e,t){const r={},i=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(r.start=t.start);++a<i.length;){const u=i[a];if(u.type==="element"&&u.tagName==="li"&&u.properties&&Array.isArray(u.properties.className)&&u.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const c={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(i,!0)};return e.patch(t,c),e.applyData(t,c)}function pH(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function fH(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function gH(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function bH(e,t){const r=e.all(t),i=r.shift(),a=[];if(i){const u={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],u),a.push(u)}if(r.length>0){const u={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},d=fw(t.children[1]),m=iD(t.children[t.children.length-1]);d&&m&&(u.position={start:d,end:m}),a.push(u)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,c),e.applyData(t,c)}function wH(e,t,r){const i=r?r.children:void 0,c=(i?i.indexOf(t):1)===0?"th":"td",u=r&&r.type==="table"?r.align:void 0,d=u?u.length:t.children.length;let m=-1;const f=[];for(;++m<d;){const g=t.children[m],v={},y=u?u[m]:void 0;y&&(v.align=y);let x={type:"element",tagName:c,properties:v,children:[]};g&&(x.children=e.all(g),e.patch(g,x),x=e.applyData(g,x)),f.push(x)}const w={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,w),e.applyData(t,w)}function vH(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const DS=9,RS=32;function yH(e){const t=String(e),r=/\r?\n|\r/g;let i=r.exec(t),a=0;const c=[];for(;i;)c.push(MS(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=r.exec(t);return c.push(MS(t.slice(a),a>0,!1)),c.join("")}function MS(e,t,r){let i=0,a=e.length;if(t){let c=e.codePointAt(i);for(;c===DS||c===RS;)i++,c=e.codePointAt(i)}if(r){let c=e.codePointAt(a-1);for(;c===DS||c===RS;)a--,c=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function kH(e,t){const r={type:"text",value:yH(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function xH(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const SH={blockquote:JU,break:ZU,code:eH,delete:tH,emphasis:nH,footnoteReference:rH,heading:iH,html:sH,imageReference:aH,image:oH,inlineCode:lH,linkReference:cH,link:uH,listItem:dH,list:mH,paragraph:pH,root:fH,strong:gH,table:bH,tableCell:vH,tableRow:wH,text:kH,thematicBreak:xH,toml:Fd,yaml:Fd,definition:Fd,footnoteDefinition:Fd};function Fd(){}const ND=-1,xm=0,Uc=1,$h=2,xw=3,Sw=4,Cw=5,jw=6,TD=7,PD=8,AS=typeof self=="object"?self:globalThis,CH=(e,t)=>{const r=(a,c)=>(e.set(c,a),a),i=a=>{if(e.has(a))return e.get(a);const[c,u]=t[a];switch(c){case xm:case ND:return r(u,a);case Uc:{const d=r([],a);for(const m of u)d.push(i(m));return d}case $h:{const d=r({},a);for(const[m,f]of u)d[i(m)]=i(f);return d}case xw:return r(new Date(u),a);case Sw:{const{source:d,flags:m}=u;return r(new RegExp(d,m),a)}case Cw:{const d=r(new Map,a);for(const[m,f]of u)d.set(i(m),i(f));return d}case jw:{const d=r(new Set,a);for(const m of u)d.add(i(m));return d}case TD:{const{name:d,message:m}=u;return r(new AS[d](m),a)}case PD:return r(BigInt(u),a);case"BigInt":return r(Object(BigInt(u)),a);case"ArrayBuffer":return r(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:d}=new Uint8Array(u);return r(new DataView(d),u)}}return r(new AS[c](u),a)};return i},ES=e=>CH(new Map,e)(0),ml="",{toString:jH}={},{keys:NH}=Object,bc=e=>{const t=typeof e;if(t!=="object"||!e)return[xm,t];const r=jH.call(e).slice(8,-1);switch(r){case"Array":return[Uc,ml];case"Object":return[$h,ml];case"Date":return[xw,ml];case"RegExp":return[Sw,ml];case"Map":return[Cw,ml];case"Set":return[jw,ml];case"DataView":return[Uc,r]}return r.includes("Array")?[Uc,r]:r.includes("Error")?[TD,r]:[$h,r]},_d=([e,t])=>e===xm&&(t==="function"||t==="symbol"),TH=(e,t,r,i)=>{const a=(u,d)=>{const m=i.push(u)-1;return r.set(d,m),m},c=u=>{if(r.has(u))return r.get(u);let[d,m]=bc(u);switch(d){case xm:{let w=u;switch(m){case"bigint":d=PD,w=u.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);w=null;break;case"undefined":return a([ND],u)}return a([d,w],u)}case Uc:{if(m){let v=u;return m==="DataView"?v=new Uint8Array(u.buffer):m==="ArrayBuffer"&&(v=new Uint8Array(u)),a([m,[...v]],u)}const w=[],g=a([d,w],u);for(const v of u)w.push(c(v));return g}case $h:{if(m)switch(m){case"BigInt":return a([m,u.toString()],u);case"Boolean":case"Number":case"String":return a([m,u.valueOf()],u)}if(t&&"toJSON"in u)return c(u.toJSON());const w=[],g=a([d,w],u);for(const v of NH(u))(e||!_d(bc(u[v])))&&w.push([c(v),c(u[v])]);return g}case xw:return a([d,u.toISOString()],u);case Sw:{const{source:w,flags:g}=u;return a([d,{source:w,flags:g}],u)}case Cw:{const w=[],g=a([d,w],u);for(const[v,y]of u)(e||!(_d(bc(v))||_d(bc(y))))&&w.push([c(v),c(y)]);return g}case jw:{const w=[],g=a([d,w],u);for(const v of u)(e||!_d(bc(v)))&&w.push(c(v));return g}}const{message:f}=u;return a([d,{name:m,message:f}],u)};return c},IS=(e,{json:t,lossy:r}={})=>{const i=[];return TH(!(t||r),!!t,new Map,i)(e),i},Vh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ES(IS(e,t)):structuredClone(e):(e,t)=>ES(IS(e,t));function PH(e,t){const r=[{type:"text",value:"↩"}];return t>1&&r.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),r}function DH(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function RH(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||PH,i=e.options.footnoteBackLabel||DH,a=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",u=e.options.footnoteLabelProperties||{className:["sr-only"]},d=[];let m=-1;for(;++m<e.footnoteOrder.length;){const f=e.footnoteById.get(e.footnoteOrder[m]);if(!f)continue;const w=e.all(f),g=String(f.identifier).toUpperCase(),v=Fl(g.toLowerCase());let y=0;const x=[],C=e.footnoteCounts.get(g);for(;C!==void 0&&++y<=C;){x.length>0&&x.push({type:"text",value:" "});let P=typeof r=="string"?r:r(m,y);typeof P=="string"&&(P={type:"text",value:P}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+v+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(m,y),className:["data-footnote-backref"]},children:Array.isArray(P)?P:[P]})}const j=w[w.length-1];if(j&&j.type==="element"&&j.tagName==="p"){const P=j.children[j.children.length-1];P&&P.type==="text"?P.value+=" ":j.children.push({type:"text",value:" "}),j.children.push(...x)}else w.push(...x);const N={type:"element",tagName:"li",properties:{id:t+"fn-"+v},children:e.wrap(w,!0)};e.patch(f,N),d.push(N)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Vh(u),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
|
|
77
|
-
`},{type:"element",tagName:"ol",properties:{},children:e.wrap(d,!0)},{type:"text",value:`
|
|
78
|
-
`}]}}const Sm=(function(e){if(e==null)return IH;if(typeof e=="function")return Cm(e);if(typeof e=="object")return Array.isArray(e)?MH(e):AH(e);if(typeof e=="string")return EH(e);throw new Error("Expected function, string, or object as test")});function MH(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=Sm(e[r]);return Cm(i);function i(...a){let c=-1;for(;++c<t.length;)if(t[c].apply(this,a))return!0;return!1}}function AH(e){const t=e;return Cm(r);function r(i){const a=i;let c;for(c in e)if(a[c]!==t[c])return!1;return!0}}function EH(e){return Cm(t);function t(r){return r&&r.type===e}}function Cm(e){return t;function t(r,i,a){return!!(LH(r)&&e.call(this,r,typeof i=="number"?i:void 0,a||void 0))}}function IH(){return!0}function LH(e){return e!==null&&typeof e=="object"&&"type"in e}const DD=[],FH=!0,Qg=!1,_H="skip";function RD(e,t,r,i){let a;typeof t=="function"&&typeof r!="function"?(i=r,r=t):a=t;const c=Sm(a),u=i?-1:1;d(e,void 0,[])();function d(m,f,w){const g=m&&typeof m=="object"?m:{};if(typeof g.type=="string"){const y=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(v,"name",{value:"node ("+(m.type+(y?"<"+y+">":""))+")"})}return v;function v(){let y=DD,x,C,j;if((!t||c(m,f,w[w.length-1]||void 0))&&(y=OH(r(m,w)),y[0]===Qg))return y;if("children"in m&&m.children){const N=m;if(N.children&&y[0]!==_H)for(C=(i?N.children.length:-1)+u,j=w.concat(N);C>-1&&C<N.children.length;){const P=N.children[C];if(x=d(P,C,j)(),x[0]===Qg)return x;C=typeof x[1]=="number"?x[1]:C+u}}return y}}}function OH(e){return Array.isArray(e)?e:typeof e=="number"?[FH,e]:e==null?DD:[e]}function Nw(e,t,r,i){let a,c,u;typeof t=="function"&&typeof r!="function"?(c=void 0,u=t,a=r):(c=t,u=r,a=i),RD(e,c,d,a);function d(m,f){const w=f[f.length-1],g=w?w.children.indexOf(m):void 0;return u(m,g,w)}}const Jg={}.hasOwnProperty,BH={};function WH(e,t){const r=t||BH,i=new Map,a=new Map,c=new Map,u={...SH,...r.handlers},d={all:f,applyData:HH,definitionById:i,footnoteById:a,footnoteCounts:c,footnoteOrder:[],handlers:u,one:m,options:r,patch:UH,wrap:qH};return Nw(e,function(w){if(w.type==="definition"||w.type==="footnoteDefinition"){const g=w.type==="definition"?i:a,v=String(w.identifier).toUpperCase();g.has(v)||g.set(v,w)}}),d;function m(w,g){const v=w.type,y=d.handlers[v];if(Jg.call(d.handlers,v)&&y)return y(d,w,g);if(d.options.passThrough&&d.options.passThrough.includes(v)){if("children"in w){const{children:C,...j}=w,N=Vh(j);return N.children=d.all(w),N}return Vh(w)}return(d.options.unknownHandler||zH)(d,w,g)}function f(w){const g=[];if("children"in w){const v=w.children;let y=-1;for(;++y<v.length;){const x=d.one(v[y],w);if(x){if(y&&v[y-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=LS(x.value)),!Array.isArray(x)&&x.type==="element")){const C=x.children[0];C&&C.type==="text"&&(C.value=LS(C.value))}Array.isArray(x)?g.push(...x):g.push(x)}}}return g}}function UH(e,t){e.position&&(t.position=DB(e))}function HH(e,t){let r=t;if(e&&e.data){const i=e.data.hName,a=e.data.hChildren,c=e.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const u="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:u}}r.type==="element"&&c&&Object.assign(r.properties,Vh(c)),"children"in r&&r.children&&a!==null&&a!==void 0&&(r.children=a)}return r}function zH(e,t){const r=t.data||{},i="value"in t&&!(Jg.call(r,"hProperties")||Jg.call(r,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function qH(e,t){const r=[];let i=-1;for(t&&r.push({type:"text",value:`
|
|
79
|
-
`});++i<e.length;)i&&r.push({type:"text",value:`
|
|
80
|
-
`}),r.push(e[i]);return t&&e.length>0&&r.push({type:"text",value:`
|
|
81
|
-
`}),r}function LS(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function FS(e,t){const r=WH(e,t),i=r.one(e,void 0),a=RH(r),c=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return a&&c.children.push({type:"text",value:`
|
|
82
|
-
`},a),c}function $H(e,t){return e&&"run"in e?async function(r,i){const a=FS(r,{file:i,...t});await e.run(a,i)}:function(r,i){return FS(r,{file:i,...e||t})}}function _S(e){if(e)throw e}var Pf,OS;function VH(){if(OS)return Pf;OS=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(f){return typeof Array.isArray=="function"?Array.isArray(f):t.call(f)==="[object Array]"},c=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var w=e.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!w&&!g)return!1;var v;for(v in f);return typeof v>"u"||e.call(f,v)},u=function(f,w){r&&w.name==="__proto__"?r(f,w.name,{enumerable:!0,configurable:!0,value:w.newValue,writable:!0}):f[w.name]=w.newValue},d=function(f,w){if(w==="__proto__")if(e.call(f,w)){if(i)return i(f,w).value}else return;return f[w]};return Pf=function m(){var f,w,g,v,y,x,C=arguments[0],j=1,N=arguments.length,P=!1;for(typeof C=="boolean"&&(P=C,C=arguments[1]||{},j=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});j<N;++j)if(f=arguments[j],f!=null)for(w in f)g=d(C,w),v=d(f,w),C!==v&&(P&&v&&(c(v)||(y=a(v)))?(y?(y=!1,x=g&&a(g)?g:[]):x=g&&c(g)?g:{},u(C,{name:w,newValue:m(P,x,v)})):typeof v<"u"&&u(C,{name:w,newValue:v}));return C},Pf}var GH=VH();const Df=uu(GH);function Zg(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function KH(){const e=[],t={run:r,use:i};return t;function r(...a){let c=-1;const u=a.pop();if(typeof u!="function")throw new TypeError("Expected function as last argument, not "+u);d(null,...a);function d(m,...f){const w=e[++c];let g=-1;if(m){u(m);return}for(;++g<a.length;)(f[g]===null||f[g]===void 0)&&(f[g]=a[g]);a=f,w?YH(w,d)(...f):u(null,...f)}}function i(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function YH(e,t){let r;return i;function i(...u){const d=e.length>u.length;let m;d&&u.push(a);try{m=e.apply(this,u)}catch(f){const w=f;if(d&&r)throw w;return a(w)}d||(m&&m.then&&typeof m.then=="function"?m.then(c,a):m instanceof Error?a(m):c(m))}function a(u,...d){r||(r=!0,t(u,...d))}function c(u){a(null,u)}}const Ws={basename:XH,dirname:QH,extname:JH,join:ZH,sep:"/"};function XH(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Cu(e);let r=0,i=-1,a=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(c){r=a+1;break}}else i<0&&(c=!0,i=a+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let u=-1,d=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(c){r=a+1;break}}else u<0&&(c=!0,u=a+1),d>-1&&(e.codePointAt(a)===t.codePointAt(d--)?d<0&&(i=a):(d=-1,i=u));return r===i?i=u:i<0&&(i=e.length),e.slice(r,i)}function QH(e){if(Cu(e),e.length===0)return".";let t=-1,r=e.length,i;for(;--r;)if(e.codePointAt(r)===47){if(i){t=r;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function JH(e){Cu(e);let t=e.length,r=-1,i=0,a=-1,c=0,u;for(;t--;){const d=e.codePointAt(t);if(d===47){if(u){i=t+1;break}continue}r<0&&(u=!0,r=t+1),d===46?a<0?a=t:c!==1&&(c=1):a>-1&&(c=-1)}return a<0||r<0||c===0||c===1&&a===r-1&&a===i+1?"":e.slice(a,r)}function ZH(...e){let t=-1,r;for(;++t<e.length;)Cu(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":e4(r)}function e4(e){Cu(e);const t=e.codePointAt(0)===47;let r=t4(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function t4(e,t){let r="",i=0,a=-1,c=0,u=-1,d,m;for(;++u<=e.length;){if(u<e.length)d=e.codePointAt(u);else{if(d===47)break;d=47}if(d===47){if(!(a===u-1||c===1))if(a!==u-1&&c===2){if(r.length<2||i!==2||r.codePointAt(r.length-1)!==46||r.codePointAt(r.length-2)!==46){if(r.length>2){if(m=r.lastIndexOf("/"),m!==r.length-1){m<0?(r="",i=0):(r=r.slice(0,m),i=r.length-1-r.lastIndexOf("/")),a=u,c=0;continue}}else if(r.length>0){r="",i=0,a=u,c=0;continue}}t&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+e.slice(a+1,u):r=e.slice(a+1,u),i=u-a-1;a=u,c=0}else d===46&&c>-1?c++:c=-1}return r}function Cu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const n4={cwd:r4};function r4(){return"/"}function eb(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function i4(e){if(typeof e=="string")e=new URL(e);else if(!eb(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return s4(e)}function s4(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let r=-1;for(;++r<t.length;)if(t.codePointAt(r)===37&&t.codePointAt(r+1)===50){const i=t.codePointAt(r+2);if(i===70||i===102){const a=new TypeError("File URL path must not include encoded / characters");throw a.code="ERR_INVALID_FILE_URL_PATH",a}}return decodeURIComponent(t)}const Rf=["history","path","basename","stem","extname","dirname"];class MD{constructor(t){let r;t?eb(t)?r={path:t}:typeof t=="string"||a4(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":n4.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<Rf.length;){const c=Rf[i];c in r&&r[c]!==void 0&&r[c]!==null&&(this[c]=c==="history"?[...r[c]]:r[c])}let a;for(a in r)Rf.includes(a)||(this[a]=r[a])}get basename(){return typeof this.path=="string"?Ws.basename(this.path):void 0}set basename(t){Af(t,"basename"),Mf(t,"basename"),this.path=Ws.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ws.dirname(this.path):void 0}set dirname(t){BS(this.basename,"dirname"),this.path=Ws.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ws.extname(this.path):void 0}set extname(t){if(Mf(t,"extname"),BS(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Ws.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){eb(t)&&(t=i4(t)),Af(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ws.basename(this.path,this.extname):void 0}set stem(t){Af(t,"stem"),Mf(t,"stem"),this.path=Ws.join(this.dirname||"",t+(this.extname||""))}fail(t,r,i){const a=this.message(t,r,i);throw a.fatal=!0,a}info(t,r,i){const a=this.message(t,r,i);return a.fatal=void 0,a}message(t,r,i){const a=new oi(t,r,i);return this.path&&(a.name=this.path+":"+a.name,a.file=this.path),a.fatal=!1,this.messages.push(a),a}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Mf(e,t){if(e&&e.includes(Ws.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ws.sep+"`")}function Af(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function BS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function a4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const o4=(function(e){const i=this.constructor.prototype,a=i[e],c=function(){return a.apply(c,arguments)};return Object.setPrototypeOf(c,i),c}),l4={}.hasOwnProperty;class Tw extends o4{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=KH()}copy(){const t=new Tw;let r=-1;for(;++r<this.attachers.length;){const i=this.attachers[r];t.use(...i)}return t.data(Df(!0,{},this.namespace)),t}data(t,r){return typeof t=="string"?arguments.length===2?(Lf("data",this.frozen),this.namespace[t]=r,this):l4.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Lf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[r,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const a=r.call(t,...i);typeof a=="function"&&this.transformers.use(a)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const r=Od(t),i=this.parser||this.Parser;return Ef("parse",i),i(String(r),r)}process(t,r){const i=this;return this.freeze(),Ef("process",this.parser||this.Parser),If("process",this.compiler||this.Compiler),r?a(void 0,r):new Promise(a);function a(c,u){const d=Od(t),m=i.parse(d);i.run(m,d,function(w,g,v){if(w||!g||!v)return f(w);const y=g,x=i.stringify(y,v);d4(x)?v.value=x:v.result=x,f(w,v)});function f(w,g){w||!g?u(w):c?c(g):r(void 0,g)}}}processSync(t){let r=!1,i;return this.freeze(),Ef("processSync",this.parser||this.Parser),If("processSync",this.compiler||this.Compiler),this.process(t,a),US("processSync","process",r),i;function a(c,u){r=!0,_S(c),i=u}}run(t,r,i){WS(t),this.freeze();const a=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?c(void 0,i):new Promise(c);function c(u,d){const m=Od(r);a.run(t,m,f);function f(w,g,v){const y=g||t;w?d(w):u?u(y):i(void 0,y,v)}}}runSync(t,r){let i=!1,a;return this.run(t,r,c),US("runSync","run",i),a;function c(u,d){_S(u),a=d,i=!0}}stringify(t,r){this.freeze();const i=Od(r),a=this.compiler||this.Compiler;return If("stringify",a),WS(t),a(t,i)}use(t,...r){const i=this.attachers,a=this.namespace;if(Lf("use",this.frozen),t!=null)if(typeof t=="function")m(t,r);else if(typeof t=="object")Array.isArray(t)?d(t):u(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function c(f){if(typeof f=="function")m(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[w,...g]=f;m(w,g)}else u(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function u(f){if(!("plugins"in f)&&!("settings"in f))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");d(f.plugins),f.settings&&(a.settings=Df(!0,a.settings,f.settings))}function d(f){let w=-1;if(f!=null)if(Array.isArray(f))for(;++w<f.length;){const g=f[w];c(g)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function m(f,w){let g=-1,v=-1;for(;++g<i.length;)if(i[g][0]===f){v=g;break}if(v===-1)i.push([f,...w]);else if(w.length>0){let[y,...x]=w;const C=i[v][1];Zg(C)&&Zg(y)&&(y=Df(!0,C,y)),i[v]=[f,y,...x]}}}}const c4=new Tw().freeze();function Ef(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function If(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Lf(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function WS(e){if(!Zg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function US(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Od(e){return u4(e)?e:new MD(e)}function u4(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function d4(e){return typeof e=="string"||h4(e)}function h4(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const m4="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",HS=[],zS={allowDangerousHtml:!0},p4=/^(https?|ircs?|mailto|xmpp)$/i,f4=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Pw(e){const t=g4(e),r=b4(e);return w4(t.runSync(t.parse(r),r),e)}function g4(e){const t=e.rehypePlugins||HS,r=e.remarkPlugins||HS,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...zS}:zS;return c4().use(QU).use(r).use($H,i).use(t)}function b4(e){const t=e.children||"",r=new MD;return typeof t=="string"&&(r.value=t),r}function w4(e,t){const r=t.allowedElements,i=t.allowElement,a=t.components,c=t.disallowedElements,u=t.skipHtml,d=t.unwrapDisallowed,m=t.urlTransform||v4;for(const w of f4)Object.hasOwn(t,w.from)&&(""+w.from+(w.to?"use `"+w.to+"` instead":"remove it")+m4+w.id,void 0);return Nw(e,f),IB(e,{Fragment:n.Fragment,components:a,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.jsxs,passKeys:!0,passNode:!0});function f(w,g,v){if(w.type==="raw"&&v&&typeof g=="number")return u?v.children.splice(g,1):v.children[g]={type:"text",value:w.value},g;if(w.type==="element"){let y;for(y in jf)if(Object.hasOwn(jf,y)&&Object.hasOwn(w.properties,y)){const x=w.properties[y],C=jf[y];(C===null||C.includes(w.tagName))&&(w.properties[y]=m(String(x||""),y,w))}}if(w.type==="element"){let y=r?!r.includes(w.tagName):c?c.includes(w.tagName):!1;if(!y&&i&&typeof g=="number"&&(y=!i(w,g,v)),y&&v&&typeof g=="number")return d&&w.children?v.children.splice(g,1,...w.children):v.children.splice(g,1),g}}}function v4(e){const t=e.indexOf(":"),r=e.indexOf("?"),i=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||r!==-1&&t>r||i!==-1&&t>i||p4.test(e.slice(0,t))?e:""}function qS(e,t){const r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,a=r.indexOf(t);for(;a!==-1;)i++,a=r.indexOf(t,a+t.length);return i}function y4(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function k4(e,t,r){const a=Sm((r||{}).ignore||[]),c=x4(t);let u=-1;for(;++u<c.length;)RD(e,"text",d);function d(f,w){let g=-1,v;for(;++g<w.length;){const y=w[g],x=v?v.children:void 0;if(a(y,x?x.indexOf(y):void 0,v))return;v=y}if(v)return m(f,w)}function m(f,w){const g=w[w.length-1],v=c[u][0],y=c[u][1];let x=0;const j=g.children.indexOf(f);let N=!1,P=[];v.lastIndex=0;let L=v.exec(f.value);for(;L;){const Y=L.index,H={index:L.index,input:L.input,stack:[...w,f]};let W=y(...L,H);if(typeof W=="string"&&(W=W.length>0?{type:"text",value:W}:void 0),W===!1?v.lastIndex=Y+1:(x!==Y&&P.push({type:"text",value:f.value.slice(x,Y)}),Array.isArray(W)?P.push(...W):W&&P.push(W),x=Y+L[0].length,N=!0),!v.global)break;L=v.exec(f.value)}return N?(x<f.value.length&&P.push({type:"text",value:f.value.slice(x)}),g.children.splice(j,1,...P)):P=[f],j+P.length}}function x4(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const r=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<r.length;){const a=r[i];t.push([S4(a[0]),C4(a[1])])}return t}function S4(e){return typeof e=="string"?new RegExp(y4(e),"g"):e}function C4(e){return typeof e=="function"?e:function(){return e}}const Ff="phrasing",_f=["autolink","link","image","label"];function j4(){return{transforms:[A4],enter:{literalAutolink:T4,literalAutolinkEmail:Of,literalAutolinkHttp:Of,literalAutolinkWww:Of},exit:{literalAutolink:M4,literalAutolinkEmail:R4,literalAutolinkHttp:P4,literalAutolinkWww:D4}}}function N4(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ff,notInConstruct:_f},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ff,notInConstruct:_f},{character:":",before:"[ps]",after:"\\/",inConstruct:Ff,notInConstruct:_f}]}}function T4(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Of(e){this.config.enter.autolinkProtocol.call(this,e)}function P4(e){this.config.exit.autolinkProtocol.call(this,e)}function D4(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function R4(e){this.config.exit.autolinkEmail.call(this,e)}function M4(e){this.exit(e)}function A4(e){k4(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,E4],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),I4]],{ignore:["link","linkReference"]})}function E4(e,t,r,i,a){let c="";if(!AD(a)||(/^w/i.test(t)&&(r=t+r,t="",c="http://"),!L4(r)))return!1;const u=F4(r+i);if(!u[0])return!1;const d={type:"link",title:null,url:c+t+u[0],children:[{type:"text",value:t+u[0]}]};return u[1]?[d,{type:"text",value:u[1]}]:d}function I4(e,t,r,i){return!AD(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function L4(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function F4(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],i=r.indexOf(")");const a=qS(e,"(");let c=qS(e,")");for(;i!==-1&&a>c;)e+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),c++;return[e,r]}function AD(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||To(r)||ym(r))&&(!t||r!==47)}ED.peek=$4;function _4(){this.buffer()}function O4(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function B4(){this.buffer()}function W4(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function U4(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Ns(this.sliceSerialize(e)).toLowerCase(),r.label=t}function H4(e){this.exit(e)}function z4(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=Ns(this.sliceSerialize(e)).toLowerCase(),r.label=t}function q4(e){this.exit(e)}function $4(){return"["}function ED(e,t,r,i){const a=r.createTracker(i);let c=a.move("[^");const u=r.enter("footnoteReference"),d=r.enter("reference");return c+=a.move(r.safe(r.associationId(e),{after:"]",before:c})),d(),u(),c+=a.move("]"),c}function V4(){return{enter:{gfmFootnoteCallString:_4,gfmFootnoteCall:O4,gfmFootnoteDefinitionLabelString:B4,gfmFootnoteDefinition:W4},exit:{gfmFootnoteCallString:U4,gfmFootnoteCall:H4,gfmFootnoteDefinitionLabelString:z4,gfmFootnoteDefinition:q4}}}function G4(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:ED},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,a,c,u){const d=c.createTracker(u);let m=d.move("[^");const f=c.enter("footnoteDefinition"),w=c.enter("label");return m+=d.move(c.safe(c.associationId(i),{before:m,after:"]"})),w(),m+=d.move("]:"),i.children&&i.children.length>0&&(d.shift(4),m+=d.move((t?`
|
|
83
|
-
`:" ")+c.indentLines(c.containerFlow(i,d.current()),t?ID:K4))),f(),m}}function K4(e,t,r){return t===0?e:ID(e,t,r)}function ID(e,t,r){return(r?"":" ")+e}const Y4=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];LD.peek=ez;function X4(){return{canContainEols:["delete"],enter:{strikethrough:J4},exit:{strikethrough:Z4}}}function Q4(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Y4}],handlers:{delete:LD}}}function J4(e){this.enter({type:"delete",children:[]},e)}function Z4(e){this.exit(e)}function LD(e,t,r,i){const a=r.createTracker(i),c=r.enter("strikethrough");let u=a.move("~~");return u+=r.containerPhrasing(e,{...a.current(),before:u,after:"~"}),u+=a.move("~~"),c(),u}function ez(){return"~"}function tz(e){return e.length}function nz(e,t){const r=t||{},i=(r.align||[]).concat(),a=r.stringLength||tz,c=[],u=[],d=[],m=[];let f=0,w=-1;for(;++w<e.length;){const C=[],j=[];let N=-1;for(e[w].length>f&&(f=e[w].length);++N<e[w].length;){const P=rz(e[w][N]);if(r.alignDelimiters!==!1){const L=a(P);j[N]=L,(m[N]===void 0||L>m[N])&&(m[N]=L)}C.push(P)}u[w]=C,d[w]=j}let g=-1;if(typeof i=="object"&&"length"in i)for(;++g<f;)c[g]=$S(i[g]);else{const C=$S(i);for(;++g<f;)c[g]=C}g=-1;const v=[],y=[];for(;++g<f;){const C=c[g];let j="",N="";C===99?(j=":",N=":"):C===108?j=":":C===114&&(N=":");let P=r.alignDelimiters===!1?1:Math.max(1,m[g]-j.length-N.length);const L=j+"-".repeat(P)+N;r.alignDelimiters!==!1&&(P=j.length+P+N.length,P>m[g]&&(m[g]=P),y[g]=P),v[g]=L}u.splice(1,0,v),d.splice(1,0,y),w=-1;const x=[];for(;++w<u.length;){const C=u[w],j=d[w];g=-1;const N=[];for(;++g<f;){const P=C[g]||"";let L="",Y="";if(r.alignDelimiters!==!1){const H=m[g]-(j[g]||0),W=c[g];W===114?L=" ".repeat(H):W===99?H%2?(L=" ".repeat(H/2+.5),Y=" ".repeat(H/2-.5)):(L=" ".repeat(H/2),Y=L):Y=" ".repeat(H)}r.delimiterStart!==!1&&!g&&N.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&P==="")&&(r.delimiterStart!==!1||g)&&N.push(" "),r.alignDelimiters!==!1&&N.push(L),N.push(P),r.alignDelimiters!==!1&&N.push(Y),r.padding!==!1&&N.push(" "),(r.delimiterEnd!==!1||g!==f-1)&&N.push("|")}x.push(r.delimiterEnd===!1?N.join("").replace(/ +$/,""):N.join(""))}return x.join(`
|
|
84
|
-
`)}function rz(e){return e==null?"":String(e)}function $S(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}function iz(e,t,r,i){const a=r.enter("blockquote"),c=r.createTracker(i);c.move("> "),c.shift(2);const u=r.indentLines(r.containerFlow(e,c.current()),sz);return a(),u}function sz(e,t,r){return">"+(r?"":" ")+e}function az(e,t){return VS(e,t.inConstruct,!0)&&!VS(e,t.notInConstruct,!1)}function VS(e,t,r){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return r;let i=-1;for(;++i<t.length;)if(e.includes(t[i]))return!0;return!1}function GS(e,t,r,i){let a=-1;for(;++a<r.unsafe.length;)if(r.unsafe[a].character===`
|
|
85
|
-
`&&az(r.stack,r.unsafe[a]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
86
|
-
`}function oz(e,t){const r=String(e);let i=r.indexOf(t),a=i,c=0,u=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===a?++c>u&&(u=c):c=1,a=i+t.length,i=r.indexOf(t,a);return u}function lz(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function cz(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function uz(e,t,r,i){const a=cz(r),c=e.value||"",u=a==="`"?"GraveAccent":"Tilde";if(lz(e,r)){const g=r.enter("codeIndented"),v=r.indentLines(c,dz);return g(),v}const d=r.createTracker(i),m=a.repeat(Math.max(oz(c,a)+1,3)),f=r.enter("codeFenced");let w=d.move(m);if(e.lang){const g=r.enter(`codeFencedLang${u}`);w+=d.move(r.safe(e.lang,{before:w,after:" ",encode:["`"],...d.current()})),g()}if(e.lang&&e.meta){const g=r.enter(`codeFencedMeta${u}`);w+=d.move(" "),w+=d.move(r.safe(e.meta,{before:w,after:`
|
|
87
|
-
`,encode:["`"],...d.current()})),g()}return w+=d.move(`
|
|
88
|
-
`),c&&(w+=d.move(c+`
|
|
89
|
-
`)),w+=d.move(m),f(),w}function dz(e,t,r){return(r?"":" ")+e}function Dw(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function hz(e,t,r,i){const a=Dw(r),c=a==='"'?"Quote":"Apostrophe",u=r.enter("definition");let d=r.enter("label");const m=r.createTracker(i);let f=m.move("[");return f+=m.move(r.safe(r.associationId(e),{before:f,after:"]",...m.current()})),f+=m.move("]: "),d(),!e.url||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(r.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(d=r.enter("destinationRaw"),f+=m.move(r.safe(e.url,{before:f,after:e.title?" ":`
|
|
90
|
-
`,...m.current()}))),d(),e.title&&(d=r.enter(`title${c}`),f+=m.move(" "+a),f+=m.move(r.safe(e.title,{before:f,after:a,...m.current()})),f+=m.move(a),d()),u(),f}function mz(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Qc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Gh(e,t,r){const i=Rl(e),a=Rl(t);return i===void 0?a===void 0?r==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:a===void 0?{inside:!1,outside:!1}:a===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}FD.peek=pz;function FD(e,t,r,i){const a=mz(r),c=r.enter("emphasis"),u=r.createTracker(i),d=u.move(a);let m=u.move(r.containerPhrasing(e,{after:a,before:d,...u.current()}));const f=m.charCodeAt(0),w=Gh(i.before.charCodeAt(i.before.length-1),f,a);w.inside&&(m=Qc(f)+m.slice(1));const g=m.charCodeAt(m.length-1),v=Gh(i.after.charCodeAt(0),g,a);v.inside&&(m=m.slice(0,-1)+Qc(g));const y=u.move(a);return c(),r.attentionEncodeSurroundingInfo={after:v.outside,before:w.outside},d+m+y}function pz(e,t,r){return r.options.emphasis||"*"}function fz(e,t){let r=!1;return Nw(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,Qg}),!!((!e.depth||e.depth<3)&&vw(e)&&(t.options.setext||r))}function gz(e,t,r,i){const a=Math.max(Math.min(6,e.depth||1),1),c=r.createTracker(i);if(fz(e,r)){const w=r.enter("headingSetext"),g=r.enter("phrasing"),v=r.containerPhrasing(e,{...c.current(),before:`
|
|
91
|
-
`,after:`
|
|
92
|
-
`});return g(),w(),v+`
|
|
93
|
-
`+(a===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(`
|
|
94
|
-
`))+1))}const u="#".repeat(a),d=r.enter("headingAtx"),m=r.enter("phrasing");c.move(u+" ");let f=r.containerPhrasing(e,{before:"# ",after:`
|
|
95
|
-
`,...c.current()});return/^[\t ]/.test(f)&&(f=Qc(f.charCodeAt(0))+f.slice(1)),f=f?u+" "+f:u,r.options.closeAtx&&(f+=" "+u),m(),d(),f}_D.peek=bz;function _D(e){return e.value||""}function bz(){return"<"}OD.peek=wz;function OD(e,t,r,i){const a=Dw(r),c=a==='"'?"Quote":"Apostrophe",u=r.enter("image");let d=r.enter("label");const m=r.createTracker(i);let f=m.move("![");return f+=m.move(r.safe(e.alt,{before:f,after:"]",...m.current()})),f+=m.move("]("),d(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(d=r.enter("destinationLiteral"),f+=m.move("<"),f+=m.move(r.safe(e.url,{before:f,after:">",...m.current()})),f+=m.move(">")):(d=r.enter("destinationRaw"),f+=m.move(r.safe(e.url,{before:f,after:e.title?" ":")",...m.current()}))),d(),e.title&&(d=r.enter(`title${c}`),f+=m.move(" "+a),f+=m.move(r.safe(e.title,{before:f,after:a,...m.current()})),f+=m.move(a),d()),f+=m.move(")"),u(),f}function wz(){return"!"}BD.peek=vz;function BD(e,t,r,i){const a=e.referenceType,c=r.enter("imageReference");let u=r.enter("label");const d=r.createTracker(i);let m=d.move("![");const f=r.safe(e.alt,{before:m,after:"]",...d.current()});m+=d.move(f+"]["),u();const w=r.stack;r.stack=[],u=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...d.current()});return u(),r.stack=w,c(),a==="full"||!f||f!==g?m+=d.move(g+"]"):a==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function vz(){return"!"}WD.peek=yz;function WD(e,t,r){let i=e.value||"",a="`",c=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(i);)a+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++c<r.unsafe.length;){const u=r.unsafe[c],d=r.compilePattern(u);let m;if(u.atBreak)for(;m=d.exec(i);){let f=m.index;i.charCodeAt(f)===10&&i.charCodeAt(f-1)===13&&f--,i=i.slice(0,f)+" "+i.slice(m.index+1)}}return a+i+a}function yz(){return"`"}function UD(e,t){const r=vw(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(r===e.url||"mailto:"+r===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}HD.peek=kz;function HD(e,t,r,i){const a=Dw(r),c=a==='"'?"Quote":"Apostrophe",u=r.createTracker(i);let d,m;if(UD(e,r)){const w=r.stack;r.stack=[],d=r.enter("autolink");let g=u.move("<");return g+=u.move(r.containerPhrasing(e,{before:g,after:">",...u.current()})),g+=u.move(">"),d(),r.stack=w,g}d=r.enter("link"),m=r.enter("label");let f=u.move("[");return f+=u.move(r.containerPhrasing(e,{before:f,after:"](",...u.current()})),f+=u.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=r.enter("destinationLiteral"),f+=u.move("<"),f+=u.move(r.safe(e.url,{before:f,after:">",...u.current()})),f+=u.move(">")):(m=r.enter("destinationRaw"),f+=u.move(r.safe(e.url,{before:f,after:e.title?" ":")",...u.current()}))),m(),e.title&&(m=r.enter(`title${c}`),f+=u.move(" "+a),f+=u.move(r.safe(e.title,{before:f,after:a,...u.current()})),f+=u.move(a),m()),f+=u.move(")"),d(),f}function kz(e,t,r){return UD(e,r)?"<":"["}zD.peek=xz;function zD(e,t,r,i){const a=e.referenceType,c=r.enter("linkReference");let u=r.enter("label");const d=r.createTracker(i);let m=d.move("[");const f=r.containerPhrasing(e,{before:m,after:"]",...d.current()});m+=d.move(f+"]["),u();const w=r.stack;r.stack=[],u=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...d.current()});return u(),r.stack=w,c(),a==="full"||!f||f!==g?m+=d.move(g+"]"):a==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function xz(){return"["}function Rw(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function Sz(e){const t=Rw(e),r=e.options.bulletOther;if(!r)return t==="*"?"-":"*";if(r!=="*"&&r!=="+"&&r!=="-")throw new Error("Cannot serialize items with `"+r+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(r===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+r+"`) to be different");return r}function Cz(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function qD(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function jz(e,t,r,i){const a=r.enter("list"),c=r.bulletCurrent;let u=e.ordered?Cz(r):Rw(r);const d=e.ordered?u==="."?")":".":Sz(r);let m=t&&r.bulletLastUsed?u===r.bulletLastUsed:!1;if(!e.ordered){const w=e.children?e.children[0]:void 0;if((u==="*"||u==="-")&&w&&(!w.children||!w.children[0])&&r.stack[r.stack.length-1]==="list"&&r.stack[r.stack.length-2]==="listItem"&&r.stack[r.stack.length-3]==="list"&&r.stack[r.stack.length-4]==="listItem"&&r.indexStack[r.indexStack.length-1]===0&&r.indexStack[r.indexStack.length-2]===0&&r.indexStack[r.indexStack.length-3]===0&&(m=!0),qD(r)===u&&w){let g=-1;for(;++g<e.children.length;){const v=e.children[g];if(v&&v.type==="listItem"&&v.children&&v.children[0]&&v.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(u=d),r.bulletCurrent=u;const f=r.containerFlow(e,i);return r.bulletLastUsed=u,r.bulletCurrent=c,a(),f}function Nz(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function Tz(e,t,r,i){const a=Nz(r);let c=r.bulletCurrent||Rw(r);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let u=c.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(u=Math.ceil(u/4)*4);const d=r.createTracker(i);d.move(c+" ".repeat(u-c.length)),d.shift(u);const m=r.enter("listItem"),f=r.indentLines(r.containerFlow(e,d.current()),w);return m(),f;function w(g,v,y){return v?(y?"":" ".repeat(u))+g:(y?c:c+" ".repeat(u-c.length))+g}}function Pz(e,t,r,i){const a=r.enter("paragraph"),c=r.enter("phrasing"),u=r.containerPhrasing(e,i);return c(),a(),u}const Dz=Sm(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Rz(e,t,r,i){return(e.children.some(function(u){return Dz(u)})?r.containerPhrasing:r.containerFlow).call(r,e,i)}function Mz(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}$D.peek=Az;function $D(e,t,r,i){const a=Mz(r),c=r.enter("strong"),u=r.createTracker(i),d=u.move(a+a);let m=u.move(r.containerPhrasing(e,{after:a,before:d,...u.current()}));const f=m.charCodeAt(0),w=Gh(i.before.charCodeAt(i.before.length-1),f,a);w.inside&&(m=Qc(f)+m.slice(1));const g=m.charCodeAt(m.length-1),v=Gh(i.after.charCodeAt(0),g,a);v.inside&&(m=m.slice(0,-1)+Qc(g));const y=u.move(a+a);return c(),r.attentionEncodeSurroundingInfo={after:v.outside,before:w.outside},d+m+y}function Az(e,t,r){return r.options.strong||"*"}function Ez(e,t,r,i){return r.safe(e.value,i)}function Iz(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Lz(e,t,r){const i=(qD(r)+(r.options.ruleSpaces?" ":"")).repeat(Iz(r));return r.options.ruleSpaces?i.slice(0,-1):i}const VD={blockquote:iz,break:GS,code:uz,definition:hz,emphasis:FD,hardBreak:GS,heading:gz,html:_D,image:OD,imageReference:BD,inlineCode:WD,link:HD,linkReference:zD,list:jz,listItem:Tz,paragraph:Pz,root:Rz,strong:$D,text:Ez,thematicBreak:Lz};function Fz(){return{enter:{table:_z,tableData:KS,tableHeader:KS,tableRow:Bz},exit:{codeText:Wz,table:Oz,tableData:Bf,tableHeader:Bf,tableRow:Bf}}}function _z(e){const t=e._align;this.enter({type:"table",align:t.map(function(r){return r==="none"?null:r}),children:[]},e),this.data.inTable=!0}function Oz(e){this.exit(e),this.data.inTable=void 0}function Bz(e){this.enter({type:"tableRow",children:[]},e)}function Bf(e){this.exit(e)}function KS(e){this.enter({type:"tableCell",children:[]},e)}function Wz(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Uz));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function Uz(e,t){return t==="|"?t:e}function Hz(e){const t=e||{},r=t.tableCellPadding,i=t.tablePipeAlign,a=t.stringLength,c=r?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
96
|
-
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:v,table:u,tableCell:m,tableRow:d}};function u(y,x,C,j){return f(w(y,C,j),y.align)}function d(y,x,C,j){const N=g(y,C,j),P=f([N]);return P.slice(0,P.indexOf(`
|
|
97
|
-
`))}function m(y,x,C,j){const N=C.enter("tableCell"),P=C.enter("phrasing"),L=C.containerPhrasing(y,{...j,before:c,after:c});return P(),N(),L}function f(y,x){return nz(y,{align:x,alignDelimiters:i,padding:r,stringLength:a})}function w(y,x,C){const j=y.children;let N=-1;const P=[],L=x.enter("table");for(;++N<j.length;)P[N]=g(j[N],x,C);return L(),P}function g(y,x,C){const j=y.children;let N=-1;const P=[],L=x.enter("tableRow");for(;++N<j.length;)P[N]=m(j[N],y,x,C);return L(),P}function v(y,x,C){let j=VD.inlineCode(y,x,C);return C.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function zz(){return{exit:{taskListCheckValueChecked:YS,taskListCheckValueUnchecked:YS,paragraph:$z}}}function qz(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Vz}}}function YS(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function $z(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const r=this.stack[this.stack.length-1];r.type;const i=r.children[0];if(i&&i.type==="text"){const a=t.children;let c=-1,u;for(;++c<a.length;){const d=a[c];if(d.type==="paragraph"){u=d;break}}u===r&&(i.value=i.value.slice(1),i.value.length===0?r.children.shift():r.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,r.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function Vz(e,t,r,i){const a=e.children[0],c=typeof e.checked=="boolean"&&a&&a.type==="paragraph",u="["+(e.checked?"x":" ")+"] ",d=r.createTracker(i);c&&d.move(u);let m=VD.listItem(e,t,r,{...i,...d.current()});return c&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),m;function f(w){return w+u}}function Gz(){return[j4(),V4(),X4(),Fz(),zz()]}function Kz(e){return{extensions:[N4(),G4(e),Q4(),Hz(e),qz()]}}const Yz={tokenize:t5,partial:!0},GD={tokenize:n5,partial:!0},KD={tokenize:r5,partial:!0},YD={tokenize:i5,partial:!0},Xz={tokenize:s5,partial:!0},XD={name:"wwwAutolink",tokenize:Zz,previous:JD},QD={name:"protocolAutolink",tokenize:e5,previous:ZD},ma={name:"emailAutolink",tokenize:Jz,previous:e0},Gs={};function Qz(){return{text:Gs}}let mo=48;for(;mo<123;)Gs[mo]=ma,mo++,mo===58?mo=65:mo===91&&(mo=97);Gs[43]=ma;Gs[45]=ma;Gs[46]=ma;Gs[95]=ma;Gs[72]=[ma,QD];Gs[104]=[ma,QD];Gs[87]=[ma,XD];Gs[119]=[ma,XD];function Jz(e,t,r){const i=this;let a,c;return u;function u(g){return!tb(g)||!e0.call(i,i.previous)||Mw(i.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(g))}function d(g){return tb(g)?(e.consume(g),d):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(Xz,w,f)(g):g===45||g===95||ai(g)?(c=!0,e.consume(g),m):w(g)}function f(g){return e.consume(g),a=!0,m}function w(g){return c&&a&&gi(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):r(g)}}function Zz(e,t,r){const i=this;return a;function a(u){return u!==87&&u!==119||!JD.call(i,i.previous)||Mw(i.events)?r(u):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Yz,e.attempt(GD,e.attempt(KD,c),r),r)(u))}function c(u){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(u)}}function e5(e,t,r){const i=this;let a="",c=!1;return u;function u(g){return(g===72||g===104)&&ZD.call(i,i.previous)&&!Mw(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(g),e.consume(g),d):r(g)}function d(g){if(gi(g)&&a.length<5)return a+=String.fromCodePoint(g),e.consume(g),d;if(g===58){const v=a.toLowerCase();if(v==="http"||v==="https")return e.consume(g),m}return r(g)}function m(g){return g===47?(e.consume(g),c?f:(c=!0,m)):r(g)}function f(g){return g===null||qh(g)||Kn(g)||To(g)||ym(g)?r(g):e.attempt(GD,e.attempt(KD,w),r)(g)}function w(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function t5(e,t,r){let i=0;return a;function a(u){return(u===87||u===119)&&i<3?(i++,e.consume(u),a):u===46&&i===3?(e.consume(u),c):r(u)}function c(u){return u===null?r(u):t(u)}}function n5(e,t,r){let i,a,c;return u;function u(f){return f===46||f===95?e.check(YD,m,d)(f):f===null||Kn(f)||To(f)||f!==45&&ym(f)?m(f):(c=!0,e.consume(f),u)}function d(f){return f===95?i=!0:(a=i,i=void 0),e.consume(f),u}function m(f){return a||i||!c?r(f):t(f)}}function r5(e,t){let r=0,i=0;return a;function a(u){return u===40?(r++,e.consume(u),a):u===41&&i<r?c(u):u===33||u===34||u===38||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===60||u===63||u===93||u===95||u===126?e.check(YD,t,c)(u):u===null||Kn(u)||To(u)?t(u):(e.consume(u),a)}function c(u){return u===41&&i++,e.consume(u),a}}function i5(e,t,r){return i;function i(d){return d===33||d===34||d===39||d===41||d===42||d===44||d===46||d===58||d===59||d===63||d===95||d===126?(e.consume(d),i):d===38?(e.consume(d),c):d===93?(e.consume(d),a):d===60||d===null||Kn(d)||To(d)?t(d):r(d)}function a(d){return d===null||d===40||d===91||Kn(d)||To(d)?t(d):i(d)}function c(d){return gi(d)?u(d):r(d)}function u(d){return d===59?(e.consume(d),i):gi(d)?(e.consume(d),u):r(d)}}function s5(e,t,r){return i;function i(c){return e.consume(c),a}function a(c){return ai(c)?r(c):t(c)}}function JD(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Kn(e)}function ZD(e){return!gi(e)}function e0(e){return!(e===47||tb(e))}function tb(e){return e===43||e===45||e===46||e===95||ai(e)}function Mw(e){let t=e.length,r=!1;for(;t--;){const i=e[t][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){r=!0;break}if(i._gfmAutolinkLiteralWalkedInto){r=!1;break}}return e.length>0&&!r&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),r}const a5={tokenize:p5,partial:!0};function o5(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:d5,continuation:{tokenize:h5},exit:m5}},text:{91:{name:"gfmFootnoteCall",tokenize:u5},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:l5,resolveTo:c5}}}}function l5(e,t,r){const i=this;let a=i.events.length;const c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u;for(;a--;){const m=i.events[a][1];if(m.type==="labelImage"){u=m;break}if(m.type==="gfmFootnoteCall"||m.type==="labelLink"||m.type==="label"||m.type==="image"||m.type==="link")break}return d;function d(m){if(!u||!u._balanced)return r(m);const f=Ns(i.sliceSerialize({start:u.end,end:i.now()}));return f.codePointAt(0)!==94||!c.includes(f.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function c5(e,t){let r=e.length;for(;r--;)if(e[r][1].type==="labelImage"&&e[r][0]==="enter"){e[r][1];break}e[r+1][1].type="data",e[r+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[r+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[r+3][1].end),end:Object.assign({},e[r+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},u={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},d=[e[r+1],e[r+2],["enter",i,t],e[r+3],e[r+4],["enter",a,t],["exit",a,t],["enter",c,t],["enter",u,t],["exit",u,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(r,e.length-r+1,...d),e}function u5(e,t,r){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c=0,u;return d;function d(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),m}function m(g){return g!==94?r(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",f)}function f(g){if(c>999||g===93&&!u||g===null||g===91||Kn(g))return r(g);if(g===93){e.exit("chunkString");const v=e.exit("gfmFootnoteCallString");return a.includes(Ns(i.sliceSerialize(v)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(g)}return Kn(g)||(u=!0),c++,e.consume(g),g===92?w:f}function w(g){return g===91||g===92||g===93?(e.consume(g),c++,f):f(g)}}function d5(e,t,r){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c,u=0,d;return m;function m(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),f}function f(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",w):r(x)}function w(x){if(u>999||x===93&&!d||x===null||x===91||Kn(x))return r(x);if(x===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return c=Ns(i.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),v}return Kn(x)||(d=!0),u++,e.consume(x),x===92?g:w}function g(x){return x===91||x===92||x===93?(e.consume(x),u++,w):w(x)}function v(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),a.includes(c)||a.push(c),Pn(e,y,"gfmFootnoteDefinitionWhitespace")):r(x)}function y(x){return t(x)}}function h5(e,t,r){return e.check(Su,t,e.attempt(a5,t,r))}function m5(e){e.exit("gfmFootnoteDefinition")}function p5(e,t,r){const i=this;return Pn(e,a,"gfmFootnoteDefinitionIndent",5);function a(c){const u=i.events[i.events.length-1];return u&&u[1].type==="gfmFootnoteDefinitionIndent"&&u[2].sliceSerialize(u[1],!0).length===4?t(c):r(c)}}function f5(e){let r=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:c,resolveAll:a};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function a(u,d){let m=-1;for(;++m<u.length;)if(u[m][0]==="enter"&&u[m][1].type==="strikethroughSequenceTemporary"&&u[m][1]._close){let f=m;for(;f--;)if(u[f][0]==="exit"&&u[f][1].type==="strikethroughSequenceTemporary"&&u[f][1]._open&&u[m][1].end.offset-u[m][1].start.offset===u[f][1].end.offset-u[f][1].start.offset){u[m][1].type="strikethroughSequence",u[f][1].type="strikethroughSequence";const w={type:"strikethrough",start:Object.assign({},u[f][1].start),end:Object.assign({},u[m][1].end)},g={type:"strikethroughText",start:Object.assign({},u[f][1].end),end:Object.assign({},u[m][1].start)},v=[["enter",w,d],["enter",u[f][1],d],["exit",u[f][1],d],["enter",g,d]],y=d.parser.constructs.insideSpan.null;y&&Vi(v,v.length,0,km(y,u.slice(f+1,m),d)),Vi(v,v.length,0,[["exit",g,d],["enter",u[m][1],d],["exit",u[m][1],d],["exit",w,d]]),Vi(u,f-1,m-f+3,v),m=f+v.length-2;break}}for(m=-1;++m<u.length;)u[m][1].type==="strikethroughSequenceTemporary"&&(u[m][1].type="data");return u}function c(u,d,m){const f=this.previous,w=this.events;let g=0;return v;function v(x){return f===126&&w[w.length-1][1].type!=="characterEscape"?m(x):(u.enter("strikethroughSequenceTemporary"),y(x))}function y(x){const C=Rl(f);if(x===126)return g>1?m(x):(u.consume(x),g++,y);if(g<2&&!r)return m(x);const j=u.exit("strikethroughSequenceTemporary"),N=Rl(x);return j._open=!N||N===2&&!!C,j._close=!C||C===2&&!!N,d(x)}}}class g5{constructor(){this.map=[]}add(t,r,i){b5(this,t,r,i)}consume(t){if(this.map.sort(function(c,u){return c[0]-u[0]}),this.map.length===0)return;let r=this.map.length;const i=[];for(;r>0;)r-=1,i.push(t.slice(this.map[r][0]+this.map[r][1]),this.map[r][2]),t.length=this.map[r][0];i.push(t.slice()),t.length=0;let a=i.pop();for(;a;){for(const c of a)t.push(c);a=i.pop()}this.map.length=0}}function b5(e,t,r,i){let a=0;if(!(r===0&&i.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=r,e.map[a][2].push(...i);return}a+=1}e.map.push([t,r,i])}}function w5(e,t){let r=!1;const i=[];for(;t<e.length;){const a=e[t];if(r){if(a[0]==="enter")a[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=i.length-1;i[c]=i[c]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(r=!0);t+=1}return i}function v5(){return{flow:{null:{name:"table",tokenize:y5,resolveAll:k5}}}}function y5(e,t,r){const i=this;let a=0,c=0,u;return d;function d(F){let X=i.events.length-1;for(;X>-1;){const R=i.events[X][1].type;if(R==="lineEnding"||R==="linePrefix")X--;else break}const U=X>-1?i.events[X][1].type:null,G=U==="tableHead"||U==="tableRow"?W:m;return G===W&&i.parser.lazy[i.now().line]?r(F):G(F)}function m(F){return e.enter("tableHead"),e.enter("tableRow"),f(F)}function f(F){return F===124||(u=!0,c+=1),w(F)}function w(F){return F===null?r(F):Qt(F)?c>1?(c=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),y):r(F):xn(F)?Pn(e,w,"whitespace")(F):(c+=1,u&&(u=!1,a+=1),F===124?(e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),u=!0,w):(e.enter("data"),g(F)))}function g(F){return F===null||F===124||Kn(F)?(e.exit("data"),w(F)):(e.consume(F),F===92?v:g)}function v(F){return F===92||F===124?(e.consume(F),g):g(F)}function y(F){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(F):(e.enter("tableDelimiterRow"),u=!1,xn(F)?Pn(e,x,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):x(F))}function x(F){return F===45||F===58?j(F):F===124?(u=!0,e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),C):H(F)}function C(F){return xn(F)?Pn(e,j,"whitespace")(F):j(F)}function j(F){return F===58?(c+=1,u=!0,e.enter("tableDelimiterMarker"),e.consume(F),e.exit("tableDelimiterMarker"),N):F===45?(c+=1,N(F)):F===null||Qt(F)?Y(F):H(F)}function N(F){return F===45?(e.enter("tableDelimiterFiller"),P(F)):H(F)}function P(F){return F===45?(e.consume(F),P):F===58?(u=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(F),e.exit("tableDelimiterMarker"),L):(e.exit("tableDelimiterFiller"),L(F))}function L(F){return xn(F)?Pn(e,Y,"whitespace")(F):Y(F)}function Y(F){return F===124?x(F):F===null||Qt(F)?!u||a!==c?H(F):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(F)):H(F)}function H(F){return r(F)}function W(F){return e.enter("tableRow"),I(F)}function I(F){return F===124?(e.enter("tableCellDivider"),e.consume(F),e.exit("tableCellDivider"),I):F===null||Qt(F)?(e.exit("tableRow"),t(F)):xn(F)?Pn(e,I,"whitespace")(F):(e.enter("data"),M(F))}function M(F){return F===null||F===124||Kn(F)?(e.exit("data"),I(F)):(e.consume(F),F===92?O:M)}function O(F){return F===92||F===124?(e.consume(F),M):M(F)}}function k5(e,t){let r=-1,i=!0,a=0,c=[0,0,0,0],u=[0,0,0,0],d=!1,m=0,f,w,g;const v=new g5;for(;++r<e.length;){const y=e[r],x=y[1];y[0]==="enter"?x.type==="tableHead"?(d=!1,m!==0&&(XS(v,t,m,f,w),w=void 0,m=0),f={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},v.add(r,0,[["enter",f,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(i=!0,g=void 0,c=[0,0,0,0],u=[0,r+1,0,0],d&&(d=!1,w={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},v.add(r,0,[["enter",w,t]])),a=x.type==="tableDelimiterRow"?2:w?3:1):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(i=!1,u[2]===0&&(c[1]!==0&&(u[0]=u[1],g=Bd(v,t,c,a,void 0,g),c=[0,0,0,0]),u[2]=r)):x.type==="tableCellDivider"&&(i?i=!1:(c[1]!==0&&(u[0]=u[1],g=Bd(v,t,c,a,void 0,g)),c=u,u=[c[1],r,0,0])):x.type==="tableHead"?(d=!0,m=r):x.type==="tableRow"||x.type==="tableDelimiterRow"?(m=r,c[1]!==0?(u[0]=u[1],g=Bd(v,t,c,a,r,g)):u[1]!==0&&(g=Bd(v,t,u,a,r,g)),a=0):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(u[3]=r)}for(m!==0&&XS(v,t,m,f,w),v.consume(t.events),r=-1;++r<t.events.length;){const y=t.events[r];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=w5(t.events,r))}return e}function Bd(e,t,r,i,a,c){const u=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",d="tableContent";r[0]!==0&&(c.end=Object.assign({},wl(t.events,r[0])),e.add(r[0],0,[["exit",c,t]]));const m=wl(t.events,r[1]);if(c={type:u,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",c,t]]),r[2]!==0){const f=wl(t.events,r[2]),w=wl(t.events,r[3]),g={type:d,start:Object.assign({},f),end:Object.assign({},w)};if(e.add(r[2],0,[["enter",g,t]]),i!==2){const v=t.events[r[2]],y=t.events[r[3]];if(v[1].end=Object.assign({},y[1].end),v[1].type="chunkText",v[1].contentType="text",r[3]>r[2]+1){const x=r[2]+1,C=r[3]-r[2]-1;e.add(x,C,[])}}e.add(r[3]+1,0,[["exit",g,t]])}return a!==void 0&&(c.end=Object.assign({},wl(t.events,a)),e.add(a,0,[["exit",c,t]]),c=void 0),c}function XS(e,t,r,i,a){const c=[],u=wl(t.events,r);a&&(a.end=Object.assign({},u),c.push(["exit",a,t])),i.end=Object.assign({},u),c.push(["exit",i,t]),e.add(r+1,0,c)}function wl(e,t){const r=e[t],i=r[0]==="enter"?"start":"end";return r[1][i]}const x5={name:"tasklistCheck",tokenize:C5};function S5(){return{text:{91:x5}}}function C5(e,t,r){const i=this;return a;function a(m){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?r(m):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),c)}function c(m){return Kn(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),u):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),u):r(m)}function u(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):r(m)}function d(m){return Qt(m)?t(m):xn(m)?e.check({tokenize:j5},t,r)(m):r(m)}}function j5(e,t,r){return Pn(e,i,"whitespace");function i(a){return a===null?r(a):t(a)}}function N5(e){return dD([Qz(),o5(),f5(e),v5(),S5()])}const T5={};function Aw(e){const t=this,r=e||T5,i=t.data(),a=i.micromarkExtensions||(i.micromarkExtensions=[]),c=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),u=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);a.push(N5(r)),c.push(Gz()),u.push(Kz(r))}const QS="*** Begin Patch",JS="*** End Patch";function P5(e){const t=e.replace(/\r\n/g,`
|
|
98
|
-
`);if(!t.includes(QS)||!t.includes(JS))return null;const r=t.split(`
|
|
99
|
-
`),i=[];let a=null,c=null;for(const u of r){if(u===QS||u===JS)continue;if(u.startsWith("*** Update File: ")){a=Wf("update",u.slice(17)),i.push(a),c=null;continue}if(u.startsWith("*** Add File: ")){a=Wf("add",u.slice(14)),i.push(a),c={oldLineNumber:0,newLineNumber:1};continue}if(u.startsWith("*** Delete File: ")){a=Wf("delete",u.slice(17)),i.push(a),c=null;continue}if(!a)continue;if(u.startsWith("*** Move to: ")){a.nextPath=u.slice(13),a.lines.push({kind:"meta",text:u,oldLineNumber:null,newLineNumber:null});continue}if(u.startsWith("@@")){c=R5(u)??{oldLineNumber:0,newLineNumber:0},a.lines.push({kind:"hunk",text:u,oldLineNumber:null,newLineNumber:null});continue}if(u==="*** End of File"){a.lines.push({kind:"meta",text:u,oldLineNumber:null,newLineNumber:null});continue}if(a.action==="add"&&u.startsWith("+")){a.additions+=1,a.lines.push({kind:"add",text:u,oldLineNumber:null,newLineNumber:(c==null?void 0:c.newLineNumber)??a.additions}),c&&(c.newLineNumber+=1);continue}if(!c){a.lines.push({kind:"meta",text:u,oldLineNumber:null,newLineNumber:null});continue}if(u.startsWith("+")){a.additions+=1,a.lines.push({kind:"add",text:u,oldLineNumber:null,newLineNumber:c.newLineNumber}),c.newLineNumber+=1;continue}if(u.startsWith("-")){a.deletions+=1,a.lines.push({kind:"remove",text:u,oldLineNumber:c.oldLineNumber,newLineNumber:null}),c.oldLineNumber+=1;continue}if(u.startsWith(" ")||u.length===0){a.lines.push({kind:"context",text:u,oldLineNumber:c.oldLineNumber,newLineNumber:c.newLineNumber}),c.oldLineNumber+=1,c.newLineNumber+=1;continue}a.lines.push({kind:"meta",text:u,oldLineNumber:null,newLineNumber:null})}return i.length===0?null:{files:i,totalAdditions:i.reduce((u,d)=>u+d.additions,0),totalDeletions:i.reduce((u,d)=>u+d.deletions,0)}}function D5(e){return e.replace(/\\/g,"/").split("/").at(-1)||e}function Wf(e,t){return{path:t,nextPath:null,action:e,additions:0,deletions:0,lines:[]}}function R5(e){const t=e.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}const M5=/data:image\/([a-zA-Z0-9.+-]+);base64,([A-Za-z0-9+/=]+)/g,A5=/!\[([^\]]*)\]\((data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)\)/g,E5=/<img\b[^>]*src=["'](data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)["'][^>]*>/gi,I5=/<image\b([^>]*)>([\s\S]*?)<\/image>/gi;function Po(e){const t=L5(e);return t||t0(e)}function L5(e){const t=e.trim();if(!F5(t))return null;try{const r=JSON.parse(t),i=_5(r);return i.text||i.inlineImages.length>0?i:null}catch{return null}}function F5(e){return e.length<2?!1:e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}")}function _5(e){const t=[],r=[];return wh(e,t,r),{text:r0(t.join(`
|
|
100
|
-
|
|
101
|
-
`)),inlineImages:n0(r)}}function wh(e,t,r){if(typeof e=="string"){const u=t0(e);u.text&&t.push(u.text),r.push(...u.inlineImages);return}if(e==null)return;if(Array.isArray(e)){e.forEach(u=>wh(u,t,r));return}if(typeof e!="object")return;const i=e,a=new Set,c=O5(i);c&&(r.push(c),["type","source","media_type","mime_type","mimeType","data","image_url","imageUrl","url","src","alt","name"].forEach(u=>{u in i&&a.add(u)}));for(const u of["image_url","url","src","source"]){const d=i[u];typeof d!="string"||!i0(d)||(r.push(yo(d,ss(i.alt))),a.add(u))}for(const u of["text","message","content","output","result","summary","caption"])u in i&&(a.add(u),wh(i[u],t,r));a.size>0||Object.values(i).forEach(u=>{wh(u,t,r)})}function t0(e){const t=[];let r=e;return r=r.replace(I5,(i,a,c)=>{const u=z5(a,"name"),d=H5(c);return d!=null&&d.url&&t.push(yo(d.url,d.altText||u)),""}),r=r.replace(A5,(i,a,c)=>(t.push(yo(c,a)),"")),r=r.replace(E5,(i,a)=>(t.push(yo(a,null)),"")),r=r.replace(M5,(i,a,c)=>(t.push(yo(i,null,`image/${a}`,Kh(c))),"")),{text:r0(r),inlineImages:n0(t)}}function yo(e,t,r,i){const a=r??B5(e)??"image/png";return{url:e,mimeType:a,altText:Jc(t),estimatedBytes:i??W5(e)}}function O5(e){const t=U5(e.source);if(t){const a=ss(t.type).trim().toLowerCase(),c=eC(t.media_type??t.mime_type??t.mimeType),u=ZS(t.data);if(a==="base64"&&c&&u)return yo(`data:${c};base64,${u}`,Jc(ss(t.alt)||ss(t.name)||ss(e.alt)||ss(e.name)),c,Kh(u))}const r=eC(e.media_type??e.mime_type??e.mimeType),i=ZS(e.data);return r&&i?yo(`data:${r};base64,${i}`,Jc(ss(e.alt)||ss(e.name)),r,Kh(i)):null}function n0(e){const t=new Map;return e.forEach(r=>{t.has(r.url)||t.set(r.url,r)}),[...t.values()]}function r0(e){return e.replace(/\r\n/g,`
|
|
102
|
-
`).replace(/[ \t]{2,}/g," ").replace(/[ \t]+\n/g,`
|
|
103
|
-
`).replace(/\n{3,}/g,`
|
|
104
|
-
|
|
105
|
-
`).trim()}function i0(e){return/^data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/.test(e.trim())}function B5(e){var r;const t=e.match(/^data:(image\/[a-zA-Z0-9.+-]+);base64,/i);return((r=t==null?void 0:t[1])==null?void 0:r.toLowerCase())??null}function W5(e){const t=e.match(/^data:image\/[a-zA-Z0-9.+-]+;base64,([A-Za-z0-9+/=]+)$/i);return t?Kh(t[1]):null}function Kh(e){const t=e.trim(),r=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.max(0,Math.floor(t.length*3/4)-r)}function Jc(e){const t=ss(e).trim();return t.length>0?t:null}function ZS(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g,"").trim();return/^[A-Za-z0-9+/=]+$/.test(t)?t:null}function eC(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.startsWith("image/")?t:null}function ss(e){return typeof e=="string"?e:""}function U5(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function H5(e){const t=e.trim();if(t.length===0)return null;try{const r=JSON.parse(t),i=ss(r.image_url??r.imageUrl).trim(),a=Jc(ss(r.name)||ss(r.alt));return{url:i0(i)?i:null,altText:a}}catch{const r=t.match(/(data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)/i);return r?{url:r[1],altText:null}:null}}function z5(e,t){const r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=e.match(new RegExp(`${r}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|\\[([^\\]]*)\\]|([^\\s>]+))`,"i"));return Jc((i==null?void 0:i[1])??(i==null?void 0:i[2])??(i==null?void 0:i[3])??(i==null?void 0:i[4])??"")}const s0="codingns.user-app.conversation-scroll",pl=1,q5=200,$5=1e7;function a0(){return typeof window<"u"&&typeof window.localStorage<"u"}function o0(e){return e.trim()}function l0(e){return!Number.isFinite(e)||e<=0?0:Math.min(Math.round(e),$5)}function c0(e){return!e||typeof e!="object"?null:{scrollTop:l0(e.scrollTop),stickToBottom:e.stickToBottom===!0,lastMessageSignature:typeof e.lastMessageSignature=="string"?e.lastMessageSignature:null,updatedAt:Number.isFinite(e.updatedAt)?e.updatedAt:0}}function u0(){if(!a0())return{schemaVersion:pl,bySessionId:{}};const e=window.localStorage.getItem(s0);if(!e)return{schemaVersion:pl,bySessionId:{}};try{const t=JSON.parse(e);if(!t||typeof t!="object"||t.schemaVersion!==pl||!t.bySessionId||typeof t.bySessionId!="object"||Array.isArray(t.bySessionId))return{schemaVersion:pl,bySessionId:{}};const r=Object.fromEntries(Object.entries(t.bySessionId).map(([i,a])=>{const c=c0(a);return c?[i,c]:null}).filter(i=>!!i));return{schemaVersion:pl,bySessionId:r}}catch{return{schemaVersion:pl,bySessionId:{}}}}function V5(e){if(a0())try{window.localStorage.setItem(s0,JSON.stringify(e))}catch{}}function Wd(e){const t=o0(e);if(!t)return null;const r=u0().bySessionId[t],i=c0(r);return i?{scrollTop:i.scrollTop,stickToBottom:i.stickToBottom,lastMessageSignature:i.lastMessageSignature}:null}function tC(e,t){const r=o0(e);if(!r)return;const i=u0();i.bySessionId[r]={scrollTop:l0(t.scrollTop),stickToBottom:t.stickToBottom,lastMessageSignature:t.lastMessageSignature,updatedAt:Date.now()};const a=Object.entries(i.bySessionId).sort((c,u)=>u[1].updatedAt-c[1].updatedAt).slice(0,q5);i.bySessionId=Object.fromEntries(a),V5(i)}function G5(e){return e.replace(/(\.{3,}|…+)$/,"").trimEnd()}const K5=480,nC=80,rC=240,Y5=120,X5=50,Q5=3500,d0=p.createContext(!1);function nb(e){return e.replace(/\\/g,"/")}function Yh(e){return/^[a-zA-Z]:\//.test(e)}function J5(e){return e.startsWith("/")||e.startsWith("//")||Yh(e)}function Z5(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)&&!Yh(e)}function iC(e){return e.replace(/\/+$/,"")}function e6(e){const t=e.indexOf("#"),r=t>=0?e.slice(0,t):e,i=r.indexOf("?");return(i>=0?r.slice(0,i):r).replace(/:(\d+)(?::(\d+))?$/,"")}function t6(e){const t=[];for(const r of nb(e).split("/"))if(!(!r||r===".")){if(r===".."){if(t.length===0)return null;t.pop();continue}t.push(r)}return t.join("/")}function Ew(e){try{return decodeURIComponent(e)}catch{return e}}function n6(e,t){const r=Ew(e).trim();if(!r||r.startsWith("#"))return null;let i=r;if(/^file:\/\//i.test(i))try{i=decodeURIComponent(new URL(i).pathname),/^\/[a-zA-Z]:\//.test(i)&&(i=i.slice(1))}catch{return null}else if(Z5(i))return null;if(i=nb(e6(i.trim())),!i)return null;const a=iC(nb(t.trim()));if(!a)return null;if(J5(i)){const c=iC(i),u=Yh(a)?a.toLowerCase():a,d=Yh(c)?c.toLowerCase():c;if(d===u)return null;const m=`${u}/`;return d.startsWith(m)?c.slice(a.length+1):null}return t6(i)}function rb(e){return e.kind==="tool_call"||e.kind==="tool_result"}function h0(e){return e.toolCall?e.toolCall:rb(e)?{callId:e.rawRef||e.id,name:"tool",input:e.kind==="tool_call"?e.content:"",output:e.kind==="tool_result"&&e.content?e.content:null,error:null,status:e.kind==="tool_call"?"running":"completed"}:null}function r6(e){return e==="shell_command"||e==="tool"?o("conversation.roleTool"):e}function m0(e){if(!e.trim())return null;try{const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?null:t}catch{return null}}function po(e,t){const r=e[t];return typeof r=="string"?r:""}function i6(e){if(e.name==="apply_patch")return P5(e.input);if(e.name!=="Write"&&e.name!=="Edit"&&e.name!=="MultiEdit")return null;const t=m0(e.input);if(!t)return null;const r=po(t,"file_path")||po(t,"path");if(!r)return null;if(e.name==="Write"){const c=po(t,"content"),u=c.length>0?c.split(/\r?\n/):[];return{files:[{path:r,nextPath:null,action:"add",additions:u.length,deletions:0,lines:u.map((d,m)=>({kind:"add",text:`+${d}`,oldLineNumber:null,newLineNumber:m+1}))}],totalAdditions:u.length,totalDeletions:0}}if(e.name==="Edit"){const c=po(t,"old_string").split(/\r?\n/),u=po(t,"new_string").split(/\r?\n/);return sC(r,[{oldLines:c,newLines:u}])}const a=(Array.isArray(t.edits)?t.edits:[]).map(c=>{if(!c||typeof c!="object"||Array.isArray(c))return null;const u=c;return{oldLines:po(u,"old_string").split(/\r?\n/),newLines:po(u,"new_string").split(/\r?\n/)}}).filter(c=>!!c);return a.length>0?sC(r,a):null}function sC(e,t){const r=[];let i=0,a=0;return t.forEach((c,u)=>{r.push({kind:"hunk",text:`@@ -1,${c.oldLines.length} +1,${c.newLines.length} @@`,oldLineNumber:null,newLineNumber:null}),c.oldLines.forEach((d,m)=>{d.length===0&&c.oldLines.length===1&&c.newLines.length>0||(a+=1,r.push({kind:"remove",text:`-${d}`,oldLineNumber:m+1,newLineNumber:null}))}),c.newLines.forEach((d,m)=>{d.length===0&&c.newLines.length===1&&c.oldLines.length>0||(i+=1,r.push({kind:"add",text:`+${d}`,oldLineNumber:null,newLineNumber:m+1}))}),u<t.length-1&&r.push({kind:"meta",text:"***",oldLineNumber:null,newLineNumber:null})}),{files:[{path:e,nextPath:null,action:"update",additions:i,deletions:a,lines:r}],totalAdditions:i,totalDeletions:a}}function s6(e){const t=m0(e.input),r=t&&typeof t.command=="string"?t.command.trim():"";if(r)return`${o("conversation.toolPreviewCommand")}:${r}`;if(e.name==="read_thread_terminal")return o("conversation.toolPreviewTerminal");const i=e.input||e.error||e.output||o("conversation.toolResultEmpty");return i.length>60?`${i.slice(0,60)}...`:i}function a6(e){var c;const t=e.map(u=>({message:u,tool:h0(u)})).filter(u=>!!u.tool);if(t.length===0)return null;const r={...t[0].tool};let i=!1,a=!1;for(const{message:u,tool:d}of t)u.kind==="tool_call"&&(i=!0,!r.input&&d.input&&(r.input=d.input)),u.kind==="tool_result"&&(a=!0,r.output=d.output,r.error=d.error,r.status=d.status,!r.input&&d.input&&(r.input=d.input)),!r.name&&d.name&&(r.name=d.name);return{key:t.map(({message:u})=>u.id).join(":"),tool:r,hasRequest:i,hasResult:a,updatedAt:((c=t.at(-1))==null?void 0:c.message.timestamp)??t[0].message.timestamp}}function o6(e){const t=new Map;for(const r of e){const i=h0(r);if(!i)continue;const a=t.get(i.callId);if(a){a.messages.push(r);continue}t.set(i.callId,{messages:[r],firstSequence:r.sequence})}return Array.from(t.values()).sort((r,i)=>r.firstSequence-i.firstSequence).map(r=>a6(r.messages)).filter(r=>!!r)}function l6(e){const t=[];for(let r=0;r<e.length;r+=1){const i=e[r];if(!rb(i)){t.push({type:"message",key:i.id,message:i});continue}const a=[i];let c=r+1;for(;c<e.length;){const d=e[c];if(!rb(d))break;a.push(d),c+=1}const u=o6(a);if(u.length===0){t.push({type:"message",key:i.id,message:i}),r=c-1;continue}u.forEach(d=>{t.push({type:"tool_group",key:d.key,group:d})}),r=c-1}return t}function c6(e,t){if(!UF(null,e))return!1;const r=t.trim();return/AGENTS\.md instructions for/i.test(r)&&/<INSTRUCTIONS>/i.test(r)&&/<\/INSTRUCTIONS>/i.test(r)}function u6(e){const t=e.split(/\r?\n/).map(r=>r.trim()).find(Boolean);return t?t.replace(/^#+\s*/,""):o("conversation.rulesMessageTitle")}function d6(e,t){const r=new Set;if(t!=="kimi")return r;for(const i of e){if(i.role==="system"&&i.kind==="text"){r.add(i.id);continue}break}return r}function Zc(e){var t;return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(r=>Zc(r)).join(""):e&&typeof e=="object"&&"props"in e?Zc(((t=e.props)==null?void 0:t.children)??""):""}function h6(e){const t=Array.isArray(e)?e[0]:e;if(!p.isValidElement(t))return null;const r=t.props,i=typeof r.className=="string"?r.className:"",a=/language-([^\s]+)/.exec(i);return{content:Zc(r.children).replace(/\n$/,""),codeClassName:i||void 0,language:(a==null?void 0:a[1])??null}}function m6(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function Iw(e,t){var r;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!m6(e))throw new Error(o("conversation.copyContentFailed"))}}function p6({className:e,children:t,onCopy:r}){const i=p.useContext(d0),a=Zc(t).trim();if(i||!a)return n.jsx("code",{className:e||void 0,children:t});function c(u){u.key!=="Enter"&&u.key!==" "||(u.preventDefault(),r(a))}return n.jsx("code",{className:[e,"markdown-inline-copy"].filter(Boolean).join(" "),role:"button",tabIndex:0,"aria-label":o("conversation.copyAction"),onClick:()=>r(a),onKeyDown:c,children:t})}function f6({href:e,children:t,className:r,onInteract:i}){const a=Zc(t).trim()||(e?Ew(e).trim():"");return n.jsx(d0.Provider,{value:!0,children:n.jsx("a",{href:e,className:[r,"markdown-interactive-link"].filter(Boolean).join(" "),onClick:c=>{c.preventDefault(),i(e,a)},children:t})})}function p0({language:e,codeClassName:t,content:r}){const{showToast:i}=Jn(),a=pr(),c=(e==null?void 0:e.trim().toLowerCase())??null,u=c==="text",d=c||"code";async function m(){try{await Iw(r,a),i({title:o("conversation.copyContentSuccess"),tone:"success"})}catch(f){i({title:f instanceof Error?f.message:o("conversation.copyContentFailed"),tone:"error"})}}return n.jsxs("div",{className:`code-block${u?" text-code-block":""}`,children:[n.jsxs("div",{className:"code-header",children:[n.jsx("span",{className:"code-header-label",children:d}),n.jsx("button",{className:"code-copy-button",type:"button",onClick:()=>void m(),children:o("conversation.copyAction")})]}),n.jsx("pre",{className:t,children:n.jsx("code",{children:r})})]})}function vh({content:e,className:t}){const{showToast:r}=Jn(),i=pr(),{navigationGroups:a,currentWorkspaceId:c,revealWorkspaceFile:u}=Tr(),d=p.useMemo(()=>{var w;return((w=a.find(g=>g.workspace.id===c))==null?void 0:w.workspace)??null},[c,a]);async function m(w){if(w.trim())try{await Iw(w,i),r({title:o("conversation.copyContentSuccess"),tone:"success"})}catch(g){r({title:g instanceof Error?g.message:o("conversation.copyContentFailed"),tone:"error"})}}function f(w,g){const v=w&&(d!=null&&d.path)?n6(w,d.path):null;v&&u({workspaceId:(d==null?void 0:d.id)??c,filePath:v,openViewer:!1})||m(g||(w?Ew(w).trim():""))}return n.jsx("div",{className:t,children:n.jsx(Pw,{remarkPlugins:[Aw],components:{p:({node:w,...g})=>n.jsx("p",{...g}),a(w){return n.jsx(f6,{href:typeof w.href=="string"?w.href:void 0,className:typeof w.className=="string"?w.className:void 0,onInteract:f,children:w.children})},pre(w){const g=h6(w.children);return g?n.jsx(p0,{language:g.language,codeClassName:g.codeClassName,content:g.content}):n.jsx("pre",{children:w.children})},code(w){const g=typeof w.className=="string"?w.className:"";return n.jsx(p6,{className:g||void 0,onCopy:v=>{m(v)},children:w.children})}},children:e})})}function aC(e,t){return!(t!=null&&t.contentBase64)||t.mimeType!==e.mimeType?null:`data:${t.mimeType};base64,${t.contentBase64}`}function Ud({sessionId:e,attachmentPayloads:t=[],attachments:r=[],inlineImages:i=[]}){return n.jsx(g6,{sessionId:e,attachments:r,attachmentPayloads:t,inlineImages:i})}function g6({sessionId:e,attachmentPayloads:t=[],attachments:r=[],inlineImages:i=[]}){const[a,c]=p.useState({}),[u,d]=p.useState(null),m=p.useMemo(()=>r.map((v,y)=>{const x=aC(v,t==null?void 0:t[y]);if(x)return{id:v.id,fileName:v.fileName,fileSize:v.fileSize,url:x,status:"ready"};const C=a[v.id];return{id:v.id,fileName:v.fileName,fileSize:v.fileSize,url:(C==null?void 0:C.url)??null,status:(C==null?void 0:C.status)??(e?"loading":"error")}}),[t,r,a,e]),f=p.useMemo(()=>i.map((v,y)=>({id:`inline-image-${y}`,fileName:v.altText||`${o("conversation.imageAttachmentLabel")} ${y+1}`,fileSize:v.estimatedBytes,url:v.url,status:"ready"})),[i]),w=p.useMemo(()=>[...f,...m],[m,f]),g=w.find(v=>v.id===u)??null;return p.useEffect(()=>{if(!u)return;function v(y){y.key==="Escape"&&d(null)}return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[u]),p.useEffect(()=>{const v=r.filter((C,j)=>!aC(C,t==null?void 0:t[j]));if(!e||v.length===0){c({});return}let y=!1;const x=[];return c(Object.fromEntries(v.map(C=>[C.id,{id:C.id,fileName:C.fileName,fileSize:C.fileSize,url:null,status:"loading"}]))),Promise.all(v.map(async C=>{try{const j=await cF(e,C.id),N=URL.createObjectURL(j);return x.push(N),{id:C.id,fileName:C.fileName,fileSize:C.fileSize,url:N,status:"ready"}}catch{return{id:C.id,fileName:C.fileName,fileSize:C.fileSize,url:null,status:"error"}}})).then(C=>{if(y){x.forEach(j=>URL.revokeObjectURL(j));return}c(Object.fromEntries(C.map(j=>[j.id,j])))}),()=>{y=!0,x.forEach(C=>URL.revokeObjectURL(C))}},[t,r,e]),w.length===0?null:n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"message-attachments",children:w.map(v=>{const y=v.status==="loading"?o("conversation.attachmentPreviewLoading"):v.status==="error"?o("conversation.attachmentPreviewUnavailable"):o("conversation.attachmentPreviewOpen");return n.jsx("button",{type:"button",className:"message-attachment-button",onClick:()=>v.url&&d(v.id),disabled:!v.url,"aria-label":`${v.fileName} - ${y}`,title:y,children:n.jsx("div",{className:"message-attachment-card",children:v.url?n.jsx("img",{className:"message-attachment-thumbnail",src:v.url,alt:v.fileName||o("conversation.attachmentPreviewAlt"),loading:"lazy"}):n.jsx("div",{className:"message-attachment-placeholder","aria-hidden":"true",children:v.status==="loading"?o("conversation.attachmentPreviewLoading"):o("conversation.attachmentPreviewUnavailable")})})},v.id)})}),g!=null&&g.url?n.jsxs("div",{className:"workbench-modal-layer message-image-modal",role:"dialog","aria-modal":"true",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("conversation.attachmentPreviewClose"),onClick:()=>d(null)}),n.jsxs("div",{className:"workbench-modal-card surface-card message-image-modal-card",children:[n.jsxs("div",{className:"workbench-modal-header message-image-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:o("conversation.imagePreviewTitle")}),n.jsx("p",{children:g.fileName})]}),n.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":o("conversation.attachmentPreviewClose"),onClick:()=>d(null),children:"x"})]}),n.jsxs("div",{className:"message-image-modal-body",children:[n.jsx("div",{className:"message-image-modal-stage",children:n.jsx("img",{className:"message-image-modal-image",src:g.url,alt:g.fileName||o("conversation.attachmentPreviewAlt")})}),n.jsx("p",{className:"message-image-modal-hint",children:o("conversation.imagePreviewHint")})]})]})]}):null]})}function b6(){return n.jsx("div",{className:"timeline-skeleton","aria-hidden":"true",children:Array.from({length:3},(e,t)=>n.jsxs("article",{className:`timeline-skeleton-item ${t%2===0?"assistant":"user"}`,children:[n.jsx("div",{className:"timeline-skeleton-avatar"}),n.jsxs("div",{className:"timeline-skeleton-bubble",children:[n.jsx("span",{className:"timeline-skeleton-line long"}),n.jsx("span",{className:"timeline-skeleton-line medium"}),n.jsx("span",{className:"timeline-skeleton-line short"})]})]},t))})}function w6({tool:e,preview:t}){const[r,i]=p.useState(null);return p.useEffect(()=>{if(r===null)return;function a(c){c.key==="Escape"&&i(null)}return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r]),n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"tool-call-item apply-patch-item",children:t.files.map((a,c)=>n.jsxs("button",{type:"button",className:"apply-patch-summary-row",onClick:()=>i(c),children:[n.jsx("span",{className:"apply-patch-summary-label",children:oC(a.action)}),n.jsx("span",{className:"apply-patch-summary-file",title:Uf(a),children:D5(a.nextPath??a.path)}),n.jsxs("span",{className:"apply-patch-summary-stats",children:[n.jsxs("span",{className:"apply-patch-summary-added",children:["+",a.additions]}),n.jsxs("span",{className:"apply-patch-summary-removed",children:["-",a.deletions]})]})]},lC(a,c)))}),r!==null&&typeof document<"u"?Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer apply-patch-modal",role:"dialog","aria-modal":"true",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:()=>i(null)}),n.jsxs("div",{className:"workbench-modal-card surface-card apply-patch-modal-card",children:[n.jsxs("div",{className:"workbench-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:o("conversation.applyPatchDialogTitle")}),n.jsx("p",{children:o("conversation.applyPatchDialogDescription")})]}),n.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":o("common.close"),onClick:()=>i(null),children:"x"})]}),(()=>{const a=t.files[r];return a?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"apply-patch-modal-totals",children:[n.jsxs("span",{className:"apply-patch-stat-pill positive",children:[o("conversation.applyPatchAddedStat")," +",a.additions]}),n.jsxs("span",{className:"apply-patch-stat-pill negative",children:[o("conversation.applyPatchRemovedStat")," -",a.deletions]})]}),n.jsxs("div",{className:"apply-patch-modal-body",children:[n.jsxs("section",{className:"apply-patch-file-panel",children:[n.jsxs("div",{className:"apply-patch-file-panel-header",children:[n.jsxs("div",{className:"apply-patch-file-panel-title",children:[n.jsx("span",{className:"apply-patch-summary-label",children:oC(a.action)}),n.jsx("strong",{children:Uf(a)})]}),n.jsxs("div",{className:"apply-patch-summary-stats",children:[n.jsxs("span",{className:"apply-patch-summary-added",children:["+",a.additions]}),n.jsxs("span",{className:"apply-patch-summary-removed",children:["-",a.deletions]})]})]}),n.jsx("div",{className:"apply-patch-diff-view",children:n.jsx("div",{className:"apply-patch-diff-scroll",children:a.lines.map((c,u)=>n.jsxs("div",{className:`apply-patch-diff-line ${C6(c.kind)}`,children:[n.jsx("span",{className:"apply-patch-line-number",children:cC(c.oldLineNumber)}),n.jsx("span",{className:"apply-patch-line-number",children:cC(c.newLineNumber)}),n.jsx("span",{className:"apply-patch-line-content",children:c.text||" "})]},`${Uf(a)}:${u}`))})})]},lC(a,r)),e.error?n.jsxs("section",{className:"apply-patch-error-panel",children:[n.jsx("div",{className:"tool-call-section-label",children:o("conversation.toolResultLabel")}),n.jsx("pre",{className:"tool-call-error",children:e.error})]}):null]})]}):null})()]})]}),document.body):null]})}function v6({group:e}){const[t,r]=p.useState(!1),{tool:i,hasRequest:a,hasResult:c}=e,u=r6(i.name),d=p.useMemo(()=>m2(i,null,e.updatedAt),[e.updatedAt,i]),m=p.useMemo(()=>i6(i),[i.input,i.name]);if(m)return n.jsx(w6,{tool:i,preview:m});if(d)return n.jsx(y6,{tool:i,snapshot:d,expanded:t,hasRequest:a,hasResult:c,onToggleExpanded:()=>{r(g=>!g)}});const f=s6(i),w=!!(i.input||i.output||i.error);return n.jsxs("div",{className:`tool-call-item ${c?"tool-result":""}`,children:[n.jsxs("button",{type:"button",className:"tool-call-header",onClick:()=>w&&r(g=>!g),children:[n.jsxs("div",{className:"tool-call-info",children:[n.jsx("span",{className:"tool-call-name",children:u}),n.jsx("span",{className:"tool-call-input-preview",children:f})]}),n.jsx("div",{className:"tool-call-meta",children:w&&n.jsx("span",{className:`tool-call-toggle ${t?"expanded":""}`,children:n.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})})})]}),t&&w&&n.jsxs("div",{className:"tool-call-output",children:[a&&i.input&&n.jsxs("div",{className:"tool-call-section",children:[n.jsx("div",{className:"tool-call-section-label",children:o("conversation.toolInputLabel")}),n.jsx("pre",{children:i.input})]}),(c||i.error||i.output)&&n.jsxs("div",{className:"tool-call-section",children:[n.jsx("div",{className:"tool-call-section-label",children:o("conversation.toolResultLabel")}),n.jsx("pre",{className:i.error?"tool-call-error":void 0,children:i.error||i.output||o("conversation.toolResultEmpty")})]})]})]})}function y6({tool:e,snapshot:t,expanded:r,hasRequest:i,hasResult:a,onToggleExpanded:c}){const u=$P(t.items),d=o(r?"conversation.taskCardRawCollapse":"conversation.taskCardRawExpand");return n.jsxs("div",{className:"tool-call-item task-tool-item",children:[n.jsxs("div",{className:"task-tool-header",children:[n.jsxs("div",{className:"task-tool-heading",children:[n.jsx("span",{className:"task-tool-badge",children:t.source==="plan"?o("conversation.taskCardPlanTitle"):o("conversation.taskCardTodoTitle")}),n.jsxs("div",{className:"task-tool-heading-main",children:[n.jsx("strong",{children:k6(t,e.name)}),n.jsx("span",{className:"task-tool-summary-text",children:x6(t.items,u)})]})]}),n.jsx("button",{type:"button",className:"task-tool-raw-toggle",onClick:c,children:d})]}),n.jsx("ol",{className:"task-tool-list",children:t.items.map(m=>n.jsxs("li",{className:"task-tool-list-item","data-status":m.status,children:[n.jsx("span",{className:"task-tool-item-indicator","data-status":m.status,"aria-hidden":"true"}),n.jsx("strong",{className:"task-tool-item-title",children:m.title}),m.detail?n.jsx("span",{className:"task-tool-item-detail",children:m.detail}):null,n.jsx("span",{className:"task-tool-item-status",children:S6(m.status)})]},m.id))}),r?n.jsxs("div",{className:"tool-call-output",children:[i&&e.input?n.jsxs("div",{className:"tool-call-section",children:[n.jsx("div",{className:"tool-call-section-label",children:o("conversation.toolInputLabel")}),n.jsx("pre",{children:e.input})]}):null,a||e.error||e.output?n.jsxs("div",{className:"tool-call-section",children:[n.jsx("div",{className:"tool-call-section-label",children:o("conversation.toolResultLabel")}),n.jsx("pre",{className:e.error?"tool-call-error":void 0,children:e.error||e.output||o("conversation.toolResultEmpty")})]}):null]}):null]})}function k6(e,t){if(e.source==="plan")return o("conversation.taskCardPlanUpdated");const r=t.trim().toLowerCase();return r==="taskcreate"||r==="todowrite"||r==="todoread"||r.startsWith("task"),o("conversation.taskCardTodoUpdated")}function x6(e,t){const r=[o("conversation.taskCardSummaryTotal",{count:e.length})];return t.in_progress>0&&r.push(o("conversation.taskCardSummaryInProgress",{count:t.in_progress})),t.pending>0&&r.push(o("conversation.taskCardSummaryPending",{count:t.pending})),t.completed>0&&r.push(o("conversation.taskCardSummaryCompleted",{count:t.completed})),t.failed>0&&r.push(o("conversation.taskCardSummaryFailed",{count:t.failed})),r.join(" / ")}function S6(e){switch(e){case"in_progress":return o("conversation.taskProgressStatusInProgress");case"completed":return o("conversation.taskProgressStatusCompleted");case"failed":return o("conversation.taskProgressStatusFailed");case"cancelled":return o("conversation.taskProgressStatusCancelled");case"pending":default:return o("conversation.taskProgressStatusPending")}}function oC(e){return o(e==="add"?"conversation.applyPatchAddedLabel":e==="delete"?"conversation.applyPatchDeletedLabel":"conversation.applyPatchEditedLabel")}function Uf(e){return e.nextPath&&e.nextPath!==e.path?`${e.path} -> ${e.nextPath}`:e.nextPath??e.path}function lC(e,t){return`${e.path}:${e.nextPath??""}:${t}`}function C6(e){return e==="add"?"is-added":e==="remove"?"is-removed":e==="hunk"?"is-hunk":e==="meta"?"is-meta":"is-context"}function cC(e){return e===null||e<=0?"":String(e)}function j6(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function f0({timestamp:e,leading:t,children:r}){return n.jsxs("div",{className:"user-message-footer",children:[n.jsx("div",{className:"user-message-footer-leading",children:t}),n.jsxs("div",{className:"user-message-footer-trailing",children:[n.jsx("time",{className:"message-time",dateTime:e,children:j6(e)}),r]})]})}function yl({text:e,canCopy:t=!0,canFork:r=!1,compact:i=!1,onFork:a}){const{showToast:c}=Jn(),u=pr(),[d,m]=p.useState(!1),[f,w]=p.useState(!1),g=e.trim().length>0,v=t&&g;async function y(){if(!(!v||d)){m(!0);try{await Iw(e,u),c({title:o("conversation.copyContentSuccess"),tone:"success"})}catch(C){c({title:C instanceof Error?C.message:o("conversation.copyContentFailed"),tone:"error"})}finally{m(!1)}}}async function x(){if(!(!a||f)){w(!0);try{await a()}finally{w(!1)}}}return!v&&!r?null:n.jsxs("div",{className:i?"message-metadata-bar compact":"message-metadata-bar",children:[v?n.jsx("button",{type:"button",className:"message-metadata-action","aria-label":o("conversation.copyAction"),title:o("conversation.copyAction"),onClick:()=>{y()},disabled:d,children:n.jsx(x2,{})}):null,r?n.jsx("button",{type:"button",className:"message-metadata-action","aria-label":o(f?"conversation.forkingAction":"conversation.forkFromHereAction"),title:o(f?"conversation.forkingAction":"conversation.forkFromHereAction"),onClick:()=>{x()},disabled:f,children:n.jsx(S2,{})}):null]})}function N6({message:e,kind:t,tone:r,actionState:i,onRetry:a,onForkMessage:c}){const[u,d]=p.useState(!1),m=u6(e.content),f=r==="user-message",w=o(t==="system_prompt"?"conversation.systemPromptTitle":"conversation.rulesMessageTitle"),g=o(t==="system_prompt"?"conversation.systemPromptHint":"conversation.rulesMessageHint"),v=o(u?t==="system_prompt"?"conversation.systemPromptCollapse":"conversation.rulesMessageCollapse":t==="system_prompt"?"conversation.systemPromptExpand":"conversation.rulesMessageExpand");return n.jsx("article",{className:`message-item ${r} rules-message-row`,"data-message-id":e.id,children:n.jsxs("div",{className:"message-content-wrapper",children:[n.jsxs("div",{className:"rules-message-card",children:[n.jsxs("button",{type:"button",className:"rules-message-toggle","aria-expanded":u,onClick:()=>d(y=>!y),children:[n.jsxs("div",{className:"rules-message-heading",children:[n.jsx("span",{className:"rules-message-badge",children:w}),n.jsx("span",{className:"rules-message-summary",children:m})]}),n.jsx("span",{className:"rules-message-action",children:v})]}),n.jsx("p",{className:"rules-message-hint",children:g}),u&&n.jsx("div",{className:"rules-message-body",children:n.jsx(vh,{content:e.content,className:"message-text message-content markdown-content"})}),f?n.jsx(f0,{timestamp:e.timestamp,children:n.jsx(yl,{text:e.content,canCopy:i.canCopy,canFork:i.canFork&&!!(c&&e.deliveryState==="sent"),compact:!0,onFork:c?()=>c(e):null})}):n.jsx(yl,{text:e.content,canCopy:i.canCopy,canFork:i.canFork&&!!(c&&e.deliveryState==="sent"),onFork:c?()=>c(e):null})]}),e.deliveryState==="failed"&&e.clientRequestId&&n.jsx("button",{className:"retry-button",type:"button",onClick:()=>a(e.clientRequestId),children:o("conversation.resendButton")})]})})}function T6({message:e,provider:t,foldedPromptKind:r=null,actionState:i,onRetry:a,onForkMessage:c,assistantAvatar:u}){const d=e.role==="user",m=e.kind==="thinking",f=e.role==="assistant"&&e.kind==="text",w=r??(c6(t,e.content)?"rules":null),g=p.useMemo(()=>Po(e.content),[e.content]),v=g.text,y=g.inlineImages,[x,C]=p.useState(!1),[j,N]=p.useState(!1),[P,L]=p.useState(null),[Y,H]=p.useState(null);if(w){const W=e.role==="user"?"user-message":e.role==="assistant"?"assistant-message":"system-message";return n.jsx(N6,{message:e,kind:w,tone:W,actionState:i,onRetry:a,onForkMessage:c})}if(d){const W=e.origin==="butler_proxy"||P6(e.clientRequestId),I=e.origin==="butler_proxy"&&typeof e.originRef=="string"&&e.originRef.trim().length>0;async function M(){if(!I)return;const F=!x;if(C(F),!(!F||Y||j)){N(!0),L(null);try{const X=await lP(e.originRef);H(X.task)}catch(X){L(X instanceof Error?X.message:o("conversation.butlerOriginDetailLoadFailed"))}finally{N(!1)}}}const O=W?I?n.jsxs("div",{className:"message-origin-detail-anchor",children:[n.jsx("button",{type:"button",className:"message-origin-badge message-origin-badge-button","aria-expanded":x,onClick:()=>{M()},children:o("conversation.butlerProxyMessageBadge")}),x?n.jsxs("div",{className:"message-origin-detail-popover",role:"dialog","aria-live":"polite",children:[n.jsx("strong",{children:o("conversation.butlerOriginDetailTitle")}),j?n.jsx("p",{children:o("conversation.butlerOriginDetailLoading")}):P?n.jsx("p",{children:P}):Y?n.jsxs(n.Fragment,{children:[n.jsxs("p",{children:[o("conversation.butlerOriginDetailObjectiveLabel"),":",Y.objective]}),n.jsxs("p",{children:[o("conversation.butlerOriginDetailStatusLabel"),":",D6(Y.status)]}),n.jsxs("p",{children:[o("conversation.butlerOriginDetailSummaryLabel"),":",Y.lastAutomationSummary||o("conversation.butlerAnalysisEmpty")]}),Y.waitingReason?n.jsxs("p",{children:[o("conversation.butlerOriginDetailWaitingReasonLabel"),":",Y.waitingReason]}):null]}):n.jsx("p",{children:o("conversation.butlerAnalysisEmpty")})]}):null]}):n.jsx("span",{className:"message-origin-badge",children:o("conversation.butlerProxyMessageBadge")}):null;return n.jsx("article",{className:"message-item user-message","data-message-id":e.id,children:n.jsxs("div",{className:"message-content-wrapper",children:[n.jsx(Ud,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:y}),v?n.jsx(vh,{content:v,className:"message-text message-content markdown-content"}):null,e.deliveryState==="failed"&&e.clientRequestId&&n.jsx("button",{className:"retry-button",type:"button",onClick:()=>a(e.clientRequestId),children:o("conversation.resendButton")}),n.jsx(f0,{timestamp:e.timestamp,leading:O,children:n.jsx(yl,{text:v,canCopy:i.canCopy,canFork:i.canFork&&!!(c&&e.deliveryState==="sent"),compact:!0,onFork:c?()=>c(e):null})})]})})}return m?n.jsxs("article",{className:"message-item assistant-message thinking-message-row","data-message-id":e.id,children:[n.jsx("div",{className:"message-avatar",children:u??n.jsx(uC,{})}),n.jsxs("div",{className:"thinking-message-content",children:[n.jsx("div",{className:"thinking-message-label",children:o("conversation.thinkingLabel")}),n.jsx(Ud,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:y}),v&&n.jsx(vh,{content:v,className:"message-text message-content markdown-content thinking-message-text"}),n.jsx(yl,{text:v,canCopy:i.canCopy,canFork:i.canFork&&!!(c&&e.deliveryState==="sent"),onFork:c?()=>c(e):null})]})]}):f?n.jsxs("article",{className:"message-item assistant-message","data-message-id":e.id,children:[n.jsx("div",{className:"message-avatar",children:u??n.jsx(uC,{})}),n.jsxs("div",{className:"message-content-wrapper",children:[n.jsx(Ud,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:y}),v&&n.jsx(vh,{content:v,className:"message-text message-content markdown-content"}),n.jsx(yl,{text:v,canCopy:i.canCopy,canFork:i.canFork&&!!(c&&e.deliveryState==="sent"),onFork:c?()=>c(e):null})]})]}):n.jsx("article",{className:"message-item system-message","data-message-id":e.id,children:n.jsxs("div",{className:"message-content-wrapper",children:[n.jsx(Ud,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:y}),v?n.jsx("div",{className:"message-text message-content",children:n.jsx(p0,{language:"text",content:v})}):null,n.jsx(yl,{text:v,canCopy:i.canCopy,canFork:i.canFork&&!!(c&&e.deliveryState==="sent"),onFork:c?()=>c(e):null})]})})}function uC(){return n.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("path",{d:"M12 16v-4M12 8h.01"})]})}function P6(e){return typeof e=="string"&&e.startsWith("butler-follow-up:")}function D6(e){switch(e){case"waiting_user":return o("shell.butlerAutomationStatusWaitingUser");case"completed":return o("shell.butlerAutomationStatusCompleted");case"failed":return o("shell.butlerAutomationStatusFailed");case"cancelled":return o("shell.butlerAutomationStatusCancelled");case"active":default:return o("shell.butlerAutomationStatusActive")}}function Lw({sessionId:e="session",messages:t,historyState:r,loadingOlderMessages:i=!1,hasOlderMessages:a=!1,onLoadOlderMessages:c=()=>{},onRetryMessage:u,onForkMessage:d,provider:m,runtimeThinkingPlaceholder:f=null,assistantAvatar:w}){var pt;const{showToast:g}=Jn(),v=p.useRef(null),y=p.useRef(e),x=p.useRef(0),C=p.useRef(null),j=p.useRef(!0),N=p.useRef(null),P=p.useRef(!1),L=p.useRef(Wd(e)),Y=p.useRef(((pt=Wd(e))==null?void 0:pt.lastMessageSignature)??null),H=p.useRef(Wd(e)),W=p.useRef(null),I=p.useRef(null),M=p.useRef(null),O=p.useRef(0),F=p.useRef(!1),[X,U]=p.useState(!1),[G,R]=p.useState(!1),A=p.useRef(!1),Z=l6(t),pe=p.useMemo(()=>d6(t,m),[t,m]),q=p.useMemo(()=>R6(t),[t]),D=r==="loading"&&t.length===0;function T(we){const Le=we.scrollHeight-we.clientHeight-we.scrollTop<=nC;return{scrollTop:we.scrollTop,stickToBottom:Le,lastMessageSignature:A.current&&!Le?Y.current:Hd(t.at(-1)??null)}}function B(we){return H.current=T(we),H.current}function Q(we){const he=we.scrollHeight-we.clientHeight-we.scrollTop,Le=he<=nC;j.current=Le,Le&&A.current&&(Me(),A.current=!1,Y.current=Hd(t.at(-1)??null),R(!1)),U(t.length>0&&(he>rC||A.current)),B(we)}function _(we=v.current){we&&B(we),H.current&&tC(e,H.current)}function de(we){H.current&&tC(we,H.current)}function le(){W.current!==null&&(window.clearTimeout(W.current),W.current=null)}function oe(){le(),W.current=window.setTimeout(()=>{W.current=null,_()},Y5)}function ye(we){we.scrollTop=we.scrollHeight}function Ne(){I.current!==null&&(window.clearTimeout(I.current),I.current=null)}function Me(){Ne(),F.current=!1,M.current=null,O.current=0}function Te(we,he){const Le=Math.max(0,we.scrollHeight-we.clientHeight),Oe=Math.max(0,Math.min(he,Le));we.scrollTop=Oe,j.current=!1,U(t.length>0&&(Le-Oe>rC||A.current))}function Dt(){Ne(),F.current&&(I.current=window.setTimeout(()=>{I.current=null;const we=v.current,he=M.current;if(!we||he===null){Me();return}if(Te(we,he),Date.now()<O.current){Dt();return}Me(),Q(we)},X5))}function st(we,he){F.current=!0,M.current=we,O.current=Date.now()+Q5,Te(he,we),Dt()}function dt(we){return P.current||!a||i||r!=="ready"||we.scrollTop>K5?!1:(P.current=!0,N.current=we.scrollHeight-we.scrollTop,c(),!0)}p.useEffect(()=>{r==="error"&&g({title:o("conversation.historyLoadFailed"),tone:"error"})},[r,g]),p.useLayoutEffect(()=>{var we,he;y.current!==e&&(de(y.current),y.current=e,x.current=0,C.current=null,L.current=Wd(e),Y.current=((we=L.current)==null?void 0:we.lastMessageSignature)??null,H.current=L.current,j.current=((he=L.current)==null?void 0:he.stickToBottom)??!0,N.current=null,Me(),A.current=!1,R(!1),U(!1))},[e]),p.useLayoutEffect(()=>()=>{le(),Me(),de(y.current)},[e]),p.useLayoutEffect(()=>{const we=v.current,he=Hd(t.at(-1)??null);if(!we){x.current=t.length,C.current=he;return}const Le=x.current,Oe=C.current,Qe=L.current;if(Qe&&r==="ready"){const wt=!Qe.stickToBottom&&Qe.lastMessageSignature!==null&&he!==null&&Qe.lastMessageSignature!==he;Qe.stickToBottom?(Me(),ye(we)):st(Qe.scrollTop,we),A.current=wt,Y.current=Qe.lastMessageSignature,R(wt),L.current=null,Q(we),x.current=t.length,C.current=he,B(we);return}if(Qe&&r==="error"){Qe.stickToBottom?(Me(),ye(we)):st(Qe.scrollTop,we),L.current=null,Q(we),x.current=t.length,C.current=he,B(we);return}if(F.current){Te(we,M.current??we.scrollTop),x.current=t.length,C.current=he,B(we);return}N.current!==null&&t.length>=Le?(we.scrollTop=Math.max(0,we.scrollHeight-N.current),N.current=null):j.current&&(Le===0||t.length!==Le||he!==Oe)&&ye(we),Q(we),x.current=t.length,C.current=he},[r,t,e]),p.useEffect(()=>{if(!a){P.current=!1;return}!i&&N.current===null&&(P.current=!1)},[a,i,t.length]);function bt(){const we=v.current;we&&(Q(we),oe(),dt(we))}return n.jsxs("section",{className:"message-timeline",children:[r==="loading"&&n.jsx("div",{className:"timeline-status",children:n.jsx("span",{className:"status-text",children:o("conversation.historyLoading")})}),n.jsxs("div",{ref:v,className:"message-list",onScroll:bt,children:[D?n.jsx(b6,{}):null,i?n.jsx("div",{className:"timeline-status timeline-status-inline",children:n.jsx("span",{className:"status-text",children:o("conversation.historyLoadingOlder")})}):null,Z.length===0&&r==="ready"&&n.jsx("div",{className:"timeline-empty",children:n.jsx("p",{className:"status-text",children:o("conversation.timelineEmpty")})}),Z.map(we=>we.type==="tool_group"?n.jsx("article",{className:"message-item tool-message-row",children:n.jsx(v6,{group:we.group})},we.key):n.jsx(T6,{message:we.message,provider:m,foldedPromptKind:pe.has(we.message.id)?"system_prompt":null,actionState:q.get(we.message.id)??{canCopy:we.message.role==="user",canFork:!1},onRetry:u,onForkMessage:d,assistantAvatar:w},we.key)),f?n.jsx("div",{className:"timeline-status timeline-status-inline thinking-status-inline",children:n.jsxs("span",{className:"status-text thinking-status-text","aria-label":f,children:[n.jsx("span",{children:G5(f)||f}),n.jsx("span",{className:"thinking-status-dots","aria-hidden":"true",children:"..."})]})}):null]}),X?n.jsxs("button",{type:"button",className:"conversation-scroll-to-bottom-button","data-has-new":G?"true":"false","aria-label":o("conversation.scrollToBottomAction"),title:o("conversation.scrollToBottomAction"),onClick:()=>{const we=v.current;we&&(Me(),ye(we),A.current=!1,Y.current=Hd(t.at(-1)??null),R(!1),Q(we),_(we))},children:[G?n.jsx("span",{className:"conversation-scroll-to-bottom-button-badge",children:"NEW"}):null,n.jsx("svg",{className:"conversation-scroll-to-bottom-button-icon",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:n.jsx("path",{d:"M10 4.25a.75.75 0 0 1 .75.75v7.19l2.72-2.72a.75.75 0 1 1 1.06 1.06l-4 4a.75.75 0 0 1-1.06 0l-4-4a.75.75 0 1 1 1.06-1.06l2.72 2.72V5a.75.75 0 0 1 .75-.75Zm-4 11a.75.75 0 0 1 0-1.5h8a.75.75 0 0 1 0 1.5H6Z",fill:"currentColor"})})]}):null]})}function Hd(e){return e?JSON.stringify({id:e.id,content:e.content,attachments:e.attachments,timestamp:e.timestamp,deliveryState:e.deliveryState,toolCall:e.toolCall?{status:e.toolCall.status,output:e.toolCall.output,error:e.toolCall.error}:null}):null}function R6(e){const t=new Map;let r=0;function i(a){let c=null;for(let u=a-1;u>=r;u-=1){const d=e[u];if(!(!d||!M6(d))){c=d.id;break}}for(let u=r;u<a;u+=1){const d=e[u];if(d){if(d.role==="user"){t.set(d.id,{canCopy:!0,canFork:!1});continue}t.set(d.id,{canCopy:d.id===c,canFork:d.id===c})}}}for(let a=0;a<e.length;a+=1){const c=e[a];c&&c.role==="user"&&a>r&&(i(a),r=a)}return i(e.length),t}function M6(e){return e.role==="user"?!1:e.kind!=="tool_call"&&e.kind!=="tool_result"}class g0{constructor(t){tt(this,"socket",null);tt(this,"disposed",!1);tt(this,"authRecoveryInFlight",!1);tt(this,"latestCursor");tt(this,"subscribed",!1);tt(this,"pendingOlderRequest",null);tt(this,"connectionManager");this.options=t,this.latestCursor=t.cursor,this.connectionManager=new vT({onReconnect:r=>{this.connect(r)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}updateCursor(t){this.latestCursor=t}reconnectNow(){this.connectionManager.reconnectNow()}requestOlderMessages(t,r){return!this.socket||this.socket.readyState!==WebSocket.OPEN?!1:this.subscribed?(this.sendOlderMessagesRequest(t,r),!0):(this.pendingOlderRequest={cursor:t,limit:r},!0)}close(){var t;this.disposed=!0,this.subscribed=!1,this.pendingOlderRequest=null,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var c;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const r=(c=hr.getState().session)==null?void 0:c.accessToken;if(!r){this.options.onUnauthorized();return}const i=`${fN("/ws")}?access_token=${encodeURIComponent(r)}`,a=new WebSocket(i);this.subscribed=!1,this.socket=a,a.addEventListener("open",()=>{a.send(JSON.stringify({type:"session.subscribe",sessionId:this.options.sessionId,cursor:this.latestCursor,limit:this.options.limit}))}),a.addEventListener("message",u=>{const d=JSON.parse(u.data);if(d.type==="system.connected"){this.connectionManager.markConnected();return}if(d.type==="session.subscribed"){this.subscribed=!0,this.options.onSubscribed(),this.flushPendingOlderRequest();return}if(d.type==="session.error"){if(d.error_code==="UNAUTHORIZED"){this.handleUnauthorized();return}this.options.onError(d);return}if(d.type==="session.runtime_status"){this.options.onRuntimeStatus(d);return}if(d.type==="session.activity"){this.options.onActivity(d);return}if(d.type==="session.history_older"){this.options.onOlderHistory(d);return}if(d.type==="session.runtime_message"){this.options.onRuntimeMessage(d);return}if(d.type==="session.runtime_error"){this.options.onRuntimeError(d);return}if(d.type==="session.interrupted"){this.options.onInterrupted(d);return}if(d.type==="session.permission_request"){this.options.onPermissionRequest(d);return}if(d.type==="session.permission_request_resolved"){this.options.onPermissionRequestResolved(d);return}this.latestCursor=d.cursor,this.options.onEnvelope(d)}),a.addEventListener("close",()=>{this.disposed||this.socket!==a||(this.subscribed=!1,this.connectionManager.markDisconnected())}),a.addEventListener("error",()=>{this.disposed||this.socket!==a||this.connectionManager.markTransientFailure()})}handleUnauthorized(){if(this.authRecoveryInFlight||this.disposed)return;this.authRecoveryInFlight=!0,this.subscribed=!1;const t=this.socket;this.socket=null,t==null||t.close(),hr.refresh().then(r=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(r.status==="refreshed"){this.connectionManager.reconnectNow();return}if(r.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}sendOlderMessagesRequest(t,r){var i;(i=this.socket)==null||i.send(JSON.stringify({type:"session.load_older",sessionId:this.options.sessionId,cursor:t,limit:r}))}flushPendingOlderRequest(){if(!this.pendingOlderRequest)return;const t=this.pendingOlderRequest;this.pendingOlderRequest=null,this.sendOlderMessagesRequest(t.cursor,t.limit)}}function dC(e){return{session:(e==null?void 0:e.session)??null,capabilities:(e==null?void 0:e.capabilities)??null,runtimeHasActiveRun:(e==null?void 0:e.runtimeHasActiveRun)??null,runtimeCanInterrupt:(e==null?void 0:e.runtimeCanInterrupt)??null,contextUsage:(e==null?void 0:e.contextUsage)??null,messages:(e==null?void 0:e.messages)??[],permissionRequests:(e==null?void 0:e.permissionRequests)??[],queuedMessages:(e==null?void 0:e.queuedMessages)??[],historyState:"idle",loadingOlderMessages:!1,olderCursor:(e==null?void 0:e.olderCursor)??null,hasOlderMessages:(e==null?void 0:e.hasOlderMessages)??!1,connectionState:"closed",lastCursor:(e==null?void 0:e.lastCursor)??null,pagesLoaded:(e==null?void 0:e.pagesLoaded)??0,errorCode:null,errorDetail:null}}function jm(e,t,r="sent",i=null){const a=t.kind??(t.role==="tool"?"tool_result":"text"),c=t.toolCall??(a==="tool_call"||a==="tool_result"?{callId:t.rawRef||t.messageId,name:"tool",input:a==="tool_call"?t.content:"",output:a==="tool_result"&&t.content?t.content:null,error:null,status:a==="tool_call"?"running":"completed"}:null);return{id:t.messageId,sessionId:e,role:t.role,kind:a,content:t.content,toolCall:c,attachments:t.attachments??[],attachmentPayloads:null,origin:t.origin??null,originRef:t.originRef??null,timestamp:t.timestamp,sequence:t.sequence,rawRef:t.rawRef,deliveryState:r,clientRequestId:i}}function b0(e,t,r,i=[],a=[],c=Number.MAX_SAFE_INTEGER){return{id:`pending-${r}`,sessionId:e,role:"user",kind:"text",content:t,toolCall:null,attachments:i,attachmentPayloads:a,origin:null,originRef:null,timestamp:new Date().toISOString(),sequence:c,rawRef:`pending://${r}`,deliveryState:"sending",clientRequestId:r}}function wc(e,t,r){const i=new Map;for(const a of e)i.set(a.id,a);for(const a of r){const c=jm(t,a),u=i3(i,c);if(u&&u!==c.id)continue;const d=r3(i,c);d&&d!==c.id&&i.delete(d);const m=i.get(a.messageId)??null;i.set(a.messageId,m?W6(m,c):c)}return w0(Array.from(i.values()))}function hC(e,t,r,i){const a=i===null?null:e.find(m=>m.clientRequestId===i)??null,c=e.filter(m=>m.clientRequestId!==i),u=jm(t,r,"sent",i),d=B6(u,a);return w0([...c.filter(m=>m.id!==d.id),d])}function ib(e,t){return e.map(r=>r.clientRequestId===t?{...r,deliveryState:"failed"}:r)}function A6(e){const t=[];for(const r of e){const i=t.at(-1);if(!i||!v0(i,r)){t.push(r);continue}t[t.length-1]=V6(i,r)}return t}function E6(e){const t=[];for(const r of e){if(!H6(r)){t.push(r);continue}let i=t.length-1;for(;i>=0&&z6(t[i]);)i-=1;const a=i>=0?t[i]:null;if(!a||!v0(a,r)){t.push(r);continue}t[i]=G6(a,r)}return t}function I6(e){const t=[];let r=null,i=!1;for(const a of e)if(!q6(r,a,i)){if(t.push(a),eu(a)){r=a,i=!1;continue}r&&sb(a)&&(i=!0)}return t}function L6(e){const t=[];for(const r of e){const i=t.at(-1);if(!i||!y0(i,r)){t.push(r);continue}t[t.length-1]=k0(i,r)}return t}function F6(e){const t=[];for(const r of e){if(t.push(r),t.length<4)continue;const i=t[t.length-4],a=t[t.length-3],c=t[t.length-2],u=t[t.length-1];$6(i,a,c,u)&&t.splice(t.length-3,3,k0(a,u))}return t}function _6(e){const t=[];for(const r of e){const i=t.at(-1);if(!i||!K6(i,r)){t.push(r);continue}t[t.length-1]=X6(i,r)}return t}function O6(e){const t=[];for(const r of e){const i=t.findIndex(a=>Y6(a,r));if(i===-1){t.push(r);continue}t[i]=Q6(t[i],r)}return t}function w0(e){const t=[...e].sort((r,i)=>r.sequence!==i.sequence?r.sequence-i.sequence:r.timestamp.localeCompare(i.timestamp));return O6(_6(I6(F6(L6(E6(A6(t)))))))}function B6(e,t){if(!t||!U6(t,e))return e;const r=e.attachments??[];return{...e,sequence:t.sequence,timestamp:t.timestamp,attachments:r.length>0?r:t.attachments??[],attachmentPayloads:t.attachmentPayloads??null}}function W6(e,t){if(e.id!==t.id)return t;if(e.role!==t.role||e.kind!==t.kind||e.rawRef!==t.rawRef)return tu(e,t);const r=J6(e.toolCall,t.toolCall),i=e3(e.content,t.content,e.timestamp,t.timestamp),a=t3(e.attachments,t.attachments);return{...tu(e,t),content:i,toolCall:r,attachments:a,attachmentPayloads:e.attachmentPayloads??t.attachmentPayloads??null,timestamp:e.timestamp.localeCompare(t.timestamp)>=0?e.timestamp:t.timestamp,sequence:Math.max(e.sequence,t.sequence)}}function U6(e,t){return Nm(e)&&t.role==="user"&&t.kind==="text"&&e.sequence>t.sequence}function v0(e,t){if(e.deliveryState!=="sent"||t.deliveryState!=="sent"||!e.rawRef.startsWith("codex://")||!t.rawRef.startsWith("codex://")||e.role!==t.role||e.kind!==t.kind||e.toolCall!==null||t.toolCall!==null||e.kind!=="text"&&e.kind!=="thinking")return!1;const r=Po(e.content),i=Po(t.content);return _l(e.timestamp,t.timestamp,30*1e3)&&Qn(r.text)===Qn(i.text)&&n3(r.inlineImages,i.inlineImages)}function H6(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("codex://")&&e.role==="assistant"&&(e.kind==="text"||e.kind==="thinking")&&e.toolCall===null}function z6(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("codex://")&&(e.kind==="tool_call"||e.kind==="tool_result")}function q6(e,t,r){return!e||r||!eu(e)||!eu(t)?!1:_l(e.timestamp,t.timestamp,120*1e3)&&Qn(e.content)===Qn(t.content)}function eu(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="user"&&e.kind==="text"}function sb(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="assistant"&&e.kind==="text"}function y0(e,t){return sb(e)&&sb(t)&&_l(e.timestamp,t.timestamp,120*1e3)&&Qn(e.content)===Qn(t.content)}function $6(e,t,r,i){return!e||!t||!r||!i||!eu(e)||!eu(r)?!1:y0(t,i)&&_l(e.timestamp,r.timestamp,120*1e3)&&Qn(e.content)===Qn(r.content)}function k0(e,t){var u,d;const r=((u=e.attachments)==null?void 0:u.length)??0,i=((d=t.attachments)==null?void 0:d.length)??0;if(r!==i)return r>i?e:t;const a=Qn(e.content).length,c=Qn(t.content).length;return a!==c?a>c?e:t:tu(e,t)}function V6(e,t){var m,f;const r=((m=e.attachments)==null?void 0:m.length)??0,i=((f=t.attachments)==null?void 0:f.length)??0;if(r!==i)return r>i?e:t;const a=Po(e.content).inlineImages.length,c=Po(t.content).inlineImages.length;if(a!==c)return a>c?e:t;const u=e.content!==Qn(e.content),d=t.content!==Qn(t.content);return u!==d?u?t:e:t}function G6(e,t){var m,f;const r=((m=e.attachments)==null?void 0:m.length)??0,i=((f=t.attachments)==null?void 0:f.length)??0;if(r!==i)return r>i?e:t;const a=Po(e.content).inlineImages.length,c=Po(t.content).inlineImages.length;if(a!==c)return a>c?e:t;const u=e.content!==Qn(e.content),d=t.content!==Qn(t.content);return u!==d&&u?t:e}function K6(e,t){return!mC(e)||!mC(t)?!1:e.role===t.role&&_l(e.timestamp,t.timestamp,120*1e3)&&Qn(e.content)===Qn(t.content)}function Y6(e,t){return!pC(e)||!pC(t)?!1:e.role===t.role&&_l(e.timestamp,t.timestamp,120*1e3)&&Qn(e.content)===Qn(t.content)}function mC(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("gemini://session/")&&e.kind==="text"&&e.toolCall===null&&(e.role==="user"||e.role==="assistant")}function pC(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("kimi://session/")&&e.kind==="text"&&e.toolCall===null&&(e.role==="user"||e.role==="assistant")}function X6(e,t){var m,f;const r=((m=e.attachments)==null?void 0:m.length)??0,i=((f=t.attachments)==null?void 0:f.length)??0;if(r!==i)return r>i?e:t;const a=Qn(e.content).length,c=Qn(t.content).length;if(a!==c)return a>c?e:t;const u=e.rawRef.includes("#file="),d=t.rawRef.includes("#file=");return u!==d?u?e:t:tu(e,t)}function Q6(e,t){var m,f;const r=((m=e.attachments)==null?void 0:m.length)??0,i=((f=t.attachments)==null?void 0:f.length)??0;if(r!==i)return r>i?e:t;const a=Qn(e.content).length,c=Qn(t.content).length;if(a!==c)return a>c?e:t;const u=e.rawRef.includes("/context#"),d=t.rawRef.includes("/context#");return u!==d?u?e:t:tu(e,t)}function J6(e,t){return e?t?{...Z6(e,t),input:x0(e.input,t.input),output:gC(e.output,t.output),error:gC(e.error,t.error)}:e:t}function Z6(e,t){const r=fC(e.status),i=fC(t.status);return i!==r?i>r?t:e:t}function fC(e){return e==="running"?0:1}function e3(e,t,r,i){const a=Qn(e),c=Qn(t);return a===c?e.length>=t.length?e:t:a.length>c.length&&a.includes(c)?e:c.length>a.length&&c.includes(a)||i.localeCompare(r)>=0?t:e}function t3(e,t){const r=(e==null?void 0:e.length)??0,i=(t==null?void 0:t.length)??0;return i!==r?i>r?t:e:t??e}function x0(e,t){return t.length>e.length?t:e}function gC(e,t){return e===null?t:t===null?e:x0(e,t)}function tu(e,t){return t.timestamp!==e.timestamp?t.timestamp.localeCompare(e.timestamp)>=0?t:e:t.sequence!==e.sequence?t.sequence>=e.sequence?t:e:t}function Qn(e){return e.replace(/\r\n/g,`
|
|
106
|
-
`).trimEnd()}function n3(e,t){return e.length===0||t.length===0?!0:e.length!==t.length?!1:e.every((r,i)=>{var a;return r.url===((a=t[i])==null?void 0:a.url)})}function r3(e,t){return C0(t)?S0(e,t,"optimistic"):null}function i3(e,t){return Nm(t)?S0(e,t,"authoritative"):null}function S0(e,t,r){const i=Xh(t.timestamp),a=Qn(t.content);let c=null,u=Number.POSITIVE_INFINITY;for(const[d,m]of e.entries()){if(!(r==="optimistic"?Nm(m):C0(m))||Qn(m.content)!==a)continue;const w=Xh(m.timestamp),g=Math.abs(w-i);g>300*1e3||g<u&&(c=d,u=g)}return c}function Nm(e){return e.role!=="user"||e.kind!=="text"||e.deliveryState==="failed"?!1:e.rawRef.startsWith("pending://")||e.rawRef.startsWith("synthetic://")||e.rawRef.includes("#synthetic")}function C0(e){return e.role==="user"&&e.kind==="text"&&!Nm(e)}function Xh(e){const t=Date.parse(e);return Number.isFinite(t)?t:0}function s3(e){return e.reduce((r,i)=>Number.isFinite(i.sequence)&&i.sequence>r?i.sequence:r,0)+1}function _l(e,t,r){return Math.abs(Xh(e)-Xh(t))<=r}const bC=30,j0=40,wC=300*1e3,a3=600,o3=5e3,l3=1e4;function Hf(){const e=Ts.getState().profile.defaultPermissionMode;return e==="default"?null:e}class N0{constructor(t,r={}){tt(this,"state");tt(this,"listeners",new Set);tt(this,"realtimeClient",null);tt(this,"historyBootstrapFallbackTimer",null);tt(this,"historyBootstrapEnvelopeReceived",!1);tt(this,"markSeenTimer",null);tt(this,"markSeenInFlight",!1);tt(this,"lastMarkSeenRequestAt",0);tt(this,"seenWatermark",null);tt(this,"runtimeRefreshTimer",null);tt(this,"runtimeRefreshMode",null);tt(this,"replaceSnapshotSeedOnBackfill",!1);tt(this,"pendingReplyDebugTraces",[]);tt(this,"hasAuthoritativeBootstrapMessages");tt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));tt(this,"getState",()=>this.state);var u;this.sessionId=t,this.options=r;const i=Lr(Vf(t),wC);this.hasAuthoritativeBootstrapMessages=(((u=r.bootstrapMessages)==null?void 0:u.length)??0)>0;const a=zd(r.initialSession??null,(i==null?void 0:i.session)??null),c=wc((i==null?void 0:i.messages)??[],this.sessionId,r.bootstrapMessages??[]);this.replaceSnapshotSeedOnBackfill=!this.hasAuthoritativeBootstrapMessages&&((i==null?void 0:i.messages.length)??0)>0&&((i==null?void 0:i.pagesLoaded)??0)<=1,this.state=dC({session:a,capabilities:(i==null?void 0:i.capabilities)??null,runtimeHasActiveRun:(i==null?void 0:i.runtimeHasActiveRun)??null,runtimeCanInterrupt:(i==null?void 0:i.runtimeCanInterrupt)??null,contextUsage:(i==null?void 0:i.contextUsage)??null,messages:c,permissionRequests:(i==null?void 0:i.permissionRequests)??[],queuedMessages:(i==null?void 0:i.queuedMessages)??[],olderCursor:(i==null?void 0:i.olderCursor)??null,hasOlderMessages:(i==null?void 0:i.hasOlderMessages)??!1,lastCursor:(i==null?void 0:i.lastCursor)??null,pagesLoaded:(i==null?void 0:i.pagesLoaded)??0}),this.seenWatermark=(a==null?void 0:a.lastSeenAt)??null}async initialize(){this.historyBootstrapEnvelopeReceived=!1,this.clearHistoryBootstrapFallbackTimer();const t=this.options.bootstrapMessages??[],r=wc(this.state.messages,this.sessionId,t),i=this.hasAuthoritativeBootstrapMessages;this.patch({messages:r,historyState:u3(this.state.session,i?r.length:0),loadingOlderMessages:!1,olderCursor:i?null:this.state.olderCursor,hasOlderMessages:fl({session:this.state.session,loadedMessageCount:r.length,olderCursor:i?null:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),pagesLoaded:i?Math.max(this.state.pagesLoaded,1):this.state.pagesLoaded,errorCode:null,errorDetail:null}),this.shouldRefreshSessionDetail()&&this.refreshSessionMetadata(),this.shouldRefreshRuntimeSnapshot()&&this.refreshRuntimeSnapshot("bootstrap"),this.refreshPermissionRequests(),this.refreshQueue();try{this.startRealtime(),i&&this.scheduleMarkSeen()}catch(a){this.handleError(a)}}async reload(){var r,i;this.clearHistoryBootstrapFallbackTimer(),this.historyBootstrapEnvelopeReceived=!1,(r=this.realtimeClient)==null||r.close(),this.realtimeClient=null;const t=Lr(Vf(this.sessionId),wC);this.state=dC({session:zd(this.options.initialSession??null,(t==null?void 0:t.session)??null),capabilities:(t==null?void 0:t.capabilities)??null,runtimeHasActiveRun:(t==null?void 0:t.runtimeHasActiveRun)??null,runtimeCanInterrupt:(t==null?void 0:t.runtimeCanInterrupt)??null,contextUsage:(t==null?void 0:t.contextUsage)??null,messages:wc((t==null?void 0:t.messages)??[],this.sessionId,this.options.bootstrapMessages??[]),permissionRequests:(t==null?void 0:t.permissionRequests)??[],queuedMessages:(t==null?void 0:t.queuedMessages)??[],olderCursor:(t==null?void 0:t.olderCursor)??null,hasOlderMessages:(t==null?void 0:t.hasOlderMessages)??!1,lastCursor:(t==null?void 0:t.lastCursor)??null,pagesLoaded:(t==null?void 0:t.pagesLoaded)??0}),this.seenWatermark=((i=this.state.session)==null?void 0:i.lastSeenAt)??null,this.replaceSnapshotSeedOnBackfill=!this.hasAuthoritativeBootstrapMessages&&((t==null?void 0:t.messages.length)??0)>0&&((t==null?void 0:t.pagesLoaded)??0)<=1,this.emit(),await this.initialize()}applyNavigationSession(t){if(!t||t.sessionId!==this.sessionId)return;const r=zd(this.state.session,t);r!==this.state.session&&this.patch({session:r,hasOlderMessages:fl({session:r,loadedMessageCount:this.state.messages.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages})})}async sendMessage(t,r){const i=SC();this.beginPendingReplyDebugTrace("send_live",i,t.length);const a=b0(this.sessionId,t,i,(r==null?void 0:r.attachmentMeta)??[],(r==null?void 0:r.attachments)??[],s3(this.state.messages));this.patch({messages:[...this.state.messages,a],session:_s(this.state.session,"running"),runtimeHasActiveRun:CC(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:jC(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt});try{const c=await this.sendMessageWithFallback(t,i,r);this.markPendingReplyDebugTraceResponseReady(i,{returnedMessageId:c.message.messageId,returnedProviderSessionId:c.message.providerSessionId}),this.patch({messages:hC(this.state.messages,this.sessionId,c.message,i)})}catch(c){throw this.failPendingReplyDebugTrace(i,c),this.patch({messages:ib(this.state.messages,i),session:_s(this.state.session,"failed"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1}),c}}async retryMessage(t){const r=this.state.messages.find(i=>i.clientRequestId===t);if(r){this.patch({messages:this.state.messages.map(i=>i.clientRequestId===t?{...i,deliveryState:"sending"}:i),runtimeHasActiveRun:CC(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:jC(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt}),this.beginPendingReplyDebugTrace("retry_live",t,r.content.length);try{const i=await this.sendMessageWithFallback(r.content,t,{attachments:r.attachmentPayloads??[],attachmentMeta:r.attachments});this.markPendingReplyDebugTraceResponseReady(t,{returnedMessageId:i.message.messageId,returnedProviderSessionId:i.message.providerSessionId}),this.patch({messages:hC(this.state.messages,this.sessionId,i.message,t)})}catch(i){throw this.failPendingReplyDebugTrace(t,i),this.patch({messages:ib(this.state.messages,t),session:_s(this.state.session,"failed")}),i}}}async enqueueMessage(t,r){const i=SC();try{const a=await hF(this.sessionId,{content:t,clientRequestId:i,model:(r==null?void 0:r.model)??null,reasoningLevel:(r==null?void 0:r.reasoningLevel)??null,permissionMode:Hf(),attachments:(r==null?void 0:r.attachments)??[]});this.patch({queuedMessages:f3(this.state.queuedMessages,a)}),await this.refreshQueue()}catch(a){throw a}}async deleteQueuedMessage(t){await mF(this.sessionId,t),await this.refreshQueue()}async steerQueuedMessage(t){await pF(this.sessionId,t),await this.refreshRuntimeSnapshot("queue_steer")}async interrupt(){await fF(this.sessionId),this.patch({session:_s(this.state.session,"interrupted"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:null,errorDetail:null})}async replyPermissionRequest(t,r){if(!(this.state.permissionRequests.find(c=>c.id===t)??null))return;const a=await gF(this.sessionId,t,r);this.patch({permissionRequests:Gf(this.state.permissionRequests,a)})}reconnect(){var t;(t=this.realtimeClient)==null||t.reconnectNow()}async loadOlderMessages(){var t;if(!(this.state.historyState!=="ready"||this.state.loadingOlderMessages||!this.state.olderCursor)){this.patch({loadingOlderMessages:!0,errorCode:null,errorDetail:null});try{if(!((t=this.realtimeClient)==null?void 0:t.requestOlderMessages(this.state.olderCursor,bC)))throw new Error("REALTIME_NOT_CONNECTED")}catch(r){const i=r instanceof Error?r.message:"unknown";this.patch({loadingOlderMessages:!1,errorCode:"HISTORY_LOAD_MORE_FAILED",errorDetail:i})}}}destroy(){var t;this.clearHistoryBootstrapFallbackTimer(),(t=this.realtimeClient)==null||t.close(),this.realtimeClient=null,this.pendingReplyDebugTraces.length=0,this.markSeenTimer!==null&&(window.clearTimeout(this.markSeenTimer),this.markSeenTimer=null),this.runtimeRefreshTimer!==null&&(window.clearTimeout(this.runtimeRefreshTimer),this.runtimeRefreshTimer=null),this.runtimeRefreshMode=null}startRealtime(){var r;if(!((r=hr.getState().session)==null?void 0:r.accessToken)){hr.clear();return}this.realtimeClient=new g0({sessionId:this.sessionId,cursor:this.state.lastCursor,limit:j0,onSubscribed:()=>{sn("session_send.realtime_subscribed",{sessionId:this.sessionId,lastCursor:this.state.lastCursor}),this.patch({connectionState:"connected",hasOlderMessages:fl({session:this.state.session,loadedMessageCount:this.state.messages.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages})}),this.scheduleHistoryBootstrapFallback()},onConnectionChange:i=>{var c;const a=this.state.connectionState;if(this.patch({connectionState:i,session:i==="reconnecting"&&oa((c=this.state.session)==null?void 0:c.runningState)?_s(this.state.session,"reconnecting"):this.state.session}),i==="connected"){this.clearRuntimeRefreshTimer("poll"),a!=="closed"&&a!=="connected"&&this.patch({errorCode:null,errorDetail:null});return}this.scheduleRuntimeRefresh("poll","connection_state_change")},onEnvelope:i=>{var u,d;this.historyBootstrapEnvelopeReceived=!0,this.clearHistoryBootstrapFallbackTimer();const a=i.type==="session.backfill"&&this.replaceSnapshotSeedOnBackfill,c=this.mergeHistoryMessages(i.messages,i.type==="session.backfill");this.patch({messages:c,lastCursor:i.cursor,historyState:"ready",olderCursor:i.type==="session.backfill"&&!a&&this.state.pagesLoaded>1?this.state.olderCursor:i.olderCursor??this.state.olderCursor,hasOlderMessages:i.type==="session.backfill"?!a&&this.state.pagesLoaded>1?this.state.hasOlderMessages:!!i.olderCursor:fl({session:this.state.session,loadedMessageCount:c.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),pagesLoaded:i.type==="session.backfill"?!a&&this.state.pagesLoaded>1?this.state.pagesLoaded:Math.max(this.state.pagesLoaded,c.length>0?1:0):this.state.pagesLoaded,session:_s(this.state.session,xC(i.type,(u=this.state.session)==null?void 0:u.runningState))}),(d=this.realtimeClient)==null||d.updateCursor(i.cursor),this.scheduleMarkSeen(),this.state.queuedMessages.length>0&&this.refreshQueue()},onOlderHistory:i=>{const a=this.mergeHistoryMessages(i.messages,!1);this.patch({messages:a,historyState:"ready",loadingOlderMessages:!1,olderCursor:i.olderCursor,hasOlderMessages:!!i.olderCursor,pagesLoaded:this.state.pagesLoaded+1,errorCode:null,errorDetail:null})},onRuntimeMessage:i=>{this.handleRuntimeMessage(i)},onActivity:i=>{this.handleActivity(i)},onRuntimeStatus:i=>{this.handleRuntimeStatus(i)},onRuntimeError:i=>{this.handleRuntimeError(i)},onInterrupted:i=>{this.handleInterrupted(i)},onPermissionRequest:i=>{this.handlePermissionRequest(i)},onPermissionRequestResolved:i=>{this.handlePermissionRequestResolved(i)},onError:i=>{this.patch({loadingOlderMessages:!1,errorCode:i.error_code,errorDetail:i.detail})},onUnauthorized:()=>{hr.clear()}}),this.realtimeClient.start()}patch(t){let r=t;Object.prototype.hasOwnProperty.call(t,"session")&&(this.syncSeenWatermark(t.session??null),r={...t,session:this.applySeenWatermark(t.session??null)}),this.state={...this.state,...r},(Object.prototype.hasOwnProperty.call(r,"session")||Object.prototype.hasOwnProperty.call(r,"capabilities")||Object.prototype.hasOwnProperty.call(r,"contextUsage")||Object.prototype.hasOwnProperty.call(r,"messages")||Object.prototype.hasOwnProperty.call(r,"permissionRequests")||Object.prototype.hasOwnProperty.call(r,"queuedMessages"))&&this.persistSnapshot(),this.emit()}mergeHistoryMessages(t,r){const i=r&&this.replaceSnapshotSeedOnBackfill?this.state.messages.filter(c=>c.deliveryState!=="sent"):this.state.messages,a=wc(i,this.sessionId,t);return r&&(this.replaceSnapshotSeedOnBackfill=!1),a}handleError(t){this.clearHistoryBootstrapFallbackTimer();const r=t instanceof Error?t.message:"unknown";this.patch({historyState:"error",errorCode:"RUNTIME_INIT_FAILED",errorDetail:r})}scheduleMarkSeen(){if(this.markSeenTimer!==null)return;const t=this.getTargetSeenAt();if(this.markSeenInFlight||t===null)return;const r=this.getMarkSeenThrottleDelayMs(),i=Math.max(a3,r);this.markSeenTimer=window.setTimeout(()=>{this.markSeenTimer=null;const a=this.getTargetSeenAt();a!==null&&(sn("session_seen.start",{sessionId:this.sessionId,targetSeenAt:a,seenWatermark:this.seenWatermark}),this.markSeenInFlight=!0,this.lastMarkSeenRequestAt=Date.now(),eF(this.sessionId).then(()=>{var c,u;this.bumpSeenWatermark(a),this.patch({session:vC(this.state.session,a)}),(u=(c=this.options).onSeen)==null||u.call(c,this.sessionId,a),sn("session_seen.end",{sessionId:this.sessionId,seenWatermark:this.seenWatermark})}).catch(()=>{sn("session_seen.error",{sessionId:this.sessionId,targetSeenAt:a})}).finally(()=>{this.markSeenInFlight=!1,this.shouldMarkSeen()&&this.scheduleMarkSeen()}))},i)}clearRuntimeRefreshTimer(t){this.runtimeRefreshTimer!==null&&(t&&this.runtimeRefreshMode!==t||(window.clearTimeout(this.runtimeRefreshTimer),this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null))}scheduleHistoryBootstrapFallback(){this.historyBootstrapEnvelopeReceived||this.historyBootstrapFallbackTimer!==null||(this.historyBootstrapFallbackTimer=window.setTimeout(()=>{this.historyBootstrapFallbackTimer=null,!this.historyBootstrapEnvelopeReceived&&this.resolveHistoryBootstrapFallback()},350))}clearHistoryBootstrapFallbackTimer(){this.historyBootstrapFallbackTimer!==null&&(window.clearTimeout(this.historyBootstrapFallbackTimer),this.historyBootstrapFallbackTimer=null)}async resolveHistoryBootstrapFallback(){try{const t=await ew(this.sessionId,null,bC,"backward");if(this.historyBootstrapEnvelopeReceived)return;this.historyBootstrapEnvelopeReceived=!0;const r=this.mergeHistoryMessages(t.messages,!0),i=this.replaceSnapshotSeedOnBackfill;this.patch({messages:r,historyState:"ready",olderCursor:!i&&this.state.pagesLoaded>1?this.state.olderCursor:t.nextCursor,hasOlderMessages:!i&&this.state.pagesLoaded>1?this.state.hasOlderMessages:fl({session:this.state.session,loadedMessageCount:r.length,olderCursor:t.nextCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),lastCursor:t.cursor??this.state.lastCursor,pagesLoaded:!i&&this.state.pagesLoaded>1?this.state.pagesLoaded:r.length>0?Math.max(this.state.pagesLoaded,1):this.state.pagesLoaded,errorCode:null,errorDetail:null}),this.scheduleMarkSeen()}catch{}}scheduleRuntimeRefresh(t,r){var i,a;if(!oa((i=this.state.session)==null?void 0:i.runningState)){this.clearRuntimeRefreshTimer();return}t==="poll"&&this.state.connectionState==="connected"||(this.clearRuntimeRefreshTimer(),this.runtimeRefreshMode=t,sn("session_runtime.refresh.schedule",{sessionId:this.sessionId,mode:t,reason:r,connectionState:this.state.connectionState,runningState:((a=this.state.session)==null?void 0:a.runningState)??null}),this.runtimeRefreshTimer=window.setTimeout(()=>{const c=this.runtimeRefreshMode??t;this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null,this.refreshRuntimeState(c,r)},t==="poll"?l3:1200))}async refreshRuntimeState(t,r){var i,a,c,u,d;sn("session_runtime.refresh.start",{sessionId:this.sessionId,mode:t,reason:r,connectionState:this.state.connectionState,runningState:((i=this.state.session)==null?void 0:i.runningState)??null});try{const m=await _g(this.sessionId);this.patch({session:yC(this.state.session,m),runtimeHasActiveRun:m.hasActiveRun,runtimeCanInterrupt:m.canInterrupt,contextUsage:m.contextUsage,...qf(m)}),await this.refreshQueue();const f=t==="poll"&&this.state.connectionState!=="connected"&&oa((a=this.state.session)==null?void 0:a.runningState);sn("session_runtime.refresh.end",{sessionId:this.sessionId,mode:t,reason:r,connectionState:this.state.connectionState,runningState:((c=this.state.session)==null?void 0:c.runningState)??null,continuePolling:f}),f&&this.scheduleRuntimeRefresh("poll","connection_poll")}catch(m){sn("session_runtime.refresh.error",{sessionId:this.sessionId,mode:t,reason:r,connectionState:this.state.connectionState,runningState:((u=this.state.session)==null?void 0:u.runningState)??null,message:m instanceof Error?m.message:"unknown"}),t==="poll"&&this.state.connectionState!=="connected"&&oa((d=this.state.session)==null?void 0:d.runningState)&&this.scheduleRuntimeRefresh("poll","connection_poll_retry")}}async refreshSessionMetadata(){const t=[];this.state.session===null&&t.push(Jb(this.sessionId).then(r=>{this.patch({session:zd(r,this.state.session)})}).catch(()=>{})),kC(this.state.capabilities)&&t.push(aF(this.sessionId).then(r=>{this.patch({capabilities:r})}).catch(()=>{})),t.length!==0&&await Promise.allSettled(t)}async refreshPermissionRequests(){try{const t=await _T(this.sessionId);this.patch({permissionRequests:t.items})}catch{return}}shouldRefreshSessionDetail(){return this.state.session===null||kC(this.state.capabilities)||this.state.session.runningState===null}shouldRefreshRuntimeSnapshot(){return this.state.contextUsage===null}async refreshRuntimeSnapshot(t){sn("session_runtime.snapshot.start",{sessionId:this.sessionId,reason:t});try{const r=await _g(this.sessionId);this.patch({session:yC(this.state.session,r),runtimeHasActiveRun:r.hasActiveRun,runtimeCanInterrupt:r.canInterrupt,contextUsage:r.contextUsage,...qf(r)}),await this.refreshQueue(),sn("session_runtime.snapshot.end",{sessionId:this.sessionId,reason:t,hasContextUsage:r.contextUsage!==null})}catch(r){sn("session_runtime.snapshot.error",{sessionId:this.sessionId,reason:t,message:r instanceof Error?r.message:"unknown"})}}async refreshQueue(){try{const t=await dF(this.sessionId);this.patch({queuedMessages:t.items})}catch{return}}async sendMessageWithFallback(t,r,i){var a;try{return await nw(this.sessionId,{content:t,clientRequestId:r,model:(i==null?void 0:i.model)??null,reasoningLevel:(i==null?void 0:i.reasoningLevel)??null,permissionMode:Hf(),attachments:(i==null?void 0:i.attachments)??[]})}catch(c){if(!(c instanceof Kr)||c.status!==404&&c.status!==405||(((a=i==null?void 0:i.attachments)==null?void 0:a.length)??0)>0)throw c;return sn("session_send.live_fallback",{sessionId:this.sessionId,clientRequestId:r,reason:c.message}),uF(this.sessionId,{content:t,clientRequestId:r,permissionMode:Hf()})}}handleRuntimeStatus(t){var i;const r=zf((i=this.state.session)==null?void 0:i.runningState,t.status);this.patch({session:_s(this.state.session,r),runtimeHasActiveRun:oa(r)?this.state.runtimeHasActiveRun??!0:!1,runtimeCanInterrupt:oa(r)?this.state.runtimeCanInterrupt:!1,errorCode:null,errorDetail:r===t.status?t.detail:this.state.errorDetail}),Qh(r)&&(this.completePendingReplyDebugTraceWithoutAssistant("session_send.client_terminal_before_message",{status:t.status,detail:t.detail}),this.clearRuntimeRefreshTimer(),this.refreshQueue(),this.refreshRuntimeSnapshot("runtime_terminal"))}handleActivity(t){if(this.patch({session:h3(this.state.session,t),runtimeHasActiveRun:t.hasActiveRun,runtimeCanInterrupt:t.canInterrupt,...qf(t)}),Qh(t.runningState)){this.clearRuntimeRefreshTimer(),this.refreshQueue();return}(t.runningState==="stale"||t.runningState==="unknown")&&this.scheduleRuntimeRefresh("tail","activity_watchdog")}handleRuntimeMessage(t){var i;t.message.role==="assistant"&&this.completePendingReplyDebugTrace(t);const r=wc(this.state.messages,this.sessionId,[t.message]);this.patch({messages:r,historyState:"ready",hasOlderMessages:fl({session:this.state.session,loadedMessageCount:r.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),session:_s(this.state.session,xC("session.delta",(i=this.state.session)==null?void 0:i.runningState))}),this.scheduleMarkSeen(),this.state.queuedMessages.length>0&&this.refreshQueue()}handleRuntimeError(t){var i;const r=zf((i=this.state.session)==null?void 0:i.runningState,"failed");this.completePendingReplyDebugTraceWithoutAssistant("session_send.client_runtime_error",{errorCode:t.error_code,detail:t.detail}),this.clearRuntimeRefreshTimer(),this.patch({session:_s(this.state.session,r),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:r==="failed"?t.error_code:this.state.errorCode,errorDetail:r==="failed"?t.detail:this.state.errorDetail}),this.refreshQueue()}handleInterrupted(t){var i;const r=zf((i=this.state.session)==null?void 0:i.runningState,"interrupted");this.completePendingReplyDebugTraceWithoutAssistant("session_send.client_interrupted",{detail:t.detail}),this.clearRuntimeRefreshTimer(),this.patch({session:_s(this.state.session,r),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:r==="interrupted"?null:this.state.errorCode,errorDetail:r==="interrupted"?t.detail:this.state.errorDetail}),this.refreshQueue()}handlePermissionRequest(t){this.patch({permissionRequests:Gf(this.state.permissionRequests,t.request)})}handlePermissionRequestResolved(t){this.patch({permissionRequests:Gf(this.state.permissionRequests,t.request)})}shouldMarkSeen(){return this.getTargetSeenAt()!==null}getTargetSeenAt(){const t=[...this.state.messages].reverse().find(i=>i.role!=="user");if(!t)return null;const r=this.seenWatermark;return r?t.timestamp>r?t.timestamp:null:t.timestamp}syncSeenWatermark(t){t!=null&&t.lastSeenAt&&this.bumpSeenWatermark(t.lastSeenAt)}bumpSeenWatermark(t){this.seenWatermark&&this.seenWatermark>=t||(this.seenWatermark=t)}getMarkSeenThrottleDelayMs(){return this.lastMarkSeenRequestAt<=0?0:Math.max(0,o3-(Date.now()-this.lastMarkSeenRequestAt))}applySeenWatermark(t){return!t||!this.seenWatermark?t:vC(t,this.seenWatermark)}emit(){for(const t of this.listeners)t()}persistSnapshot(){Ei(Vf(this.sessionId),{session:this.state.session,capabilities:this.state.capabilities,runtimeHasActiveRun:this.state.runtimeHasActiveRun,runtimeCanInterrupt:this.state.runtimeCanInterrupt,contextUsage:this.state.contextUsage,messages:p3(this.state.messages),permissionRequests:this.state.permissionRequests,queuedMessages:this.state.queuedMessages,olderCursor:this.state.olderCursor,hasOlderMessages:this.state.hasOlderMessages,lastCursor:this.state.lastCursor,pagesLoaded:this.state.pagesLoaded})}beginPendingReplyDebugTrace(t,r,i){const a={mode:t,clientRequestId:r,startedAtMs:performance.now(),responseReadyAtMs:null,contentLength:i};this.pendingReplyDebugTraces.push(a),sn(`session_send.${t}.client_start`,{sessionId:this.sessionId,clientRequestId:r,contentLength:i})}markPendingReplyDebugTraceResponseReady(t,r={}){const i=this.pendingReplyDebugTraces.find(a=>a.clientRequestId===t);!i||i.responseReadyAtMs!==null||(i.responseReadyAtMs=performance.now(),sn(`session_send.${i.mode}.client_response`,{sessionId:this.sessionId,clientRequestId:t,durationMs:Math.round(i.responseReadyAtMs-i.startedAtMs),...r}))}failPendingReplyDebugTrace(t,r){const i=this.pendingReplyDebugTraces.find(a=>a.clientRequestId===t);i&&(sn(`session_send.${i.mode}.client_error`,{sessionId:this.sessionId,clientRequestId:t,durationMs:Math.round(performance.now()-i.startedAtMs),error:r instanceof Error?r.message:String(r)}),this.removePendingReplyDebugTrace(i.clientRequestId))}completePendingReplyDebugTrace(t){const r=this.pendingReplyDebugTraces[0];if(!r)return;const i=performance.now();sn(`session_send.${r.mode}.first_assistant_message`,{sessionId:this.sessionId,clientRequestId:r.clientRequestId,durationMs:Math.round(i-r.startedAtMs),responseToAssistantMs:r.responseReadyAtMs===null?null:Math.round(i-r.responseReadyAtMs),messageId:t.message.messageId,kind:t.message.kind,contentLength:t.message.content.length}),this.removePendingReplyDebugTrace(r.clientRequestId)}completePendingReplyDebugTraceWithoutAssistant(t,r={}){const i=this.pendingReplyDebugTraces[0];i&&(sn(t,{sessionId:this.sessionId,clientRequestId:i.clientRequestId,durationMs:Math.round(performance.now()-i.startedAtMs),responseReady:i.responseReadyAtMs!==null,...r}),this.removePendingReplyDebugTrace(i.clientRequestId))}removePendingReplyDebugTrace(t){const r=this.pendingReplyDebugTraces.findIndex(i=>i.clientRequestId===t);r<0||this.pendingReplyDebugTraces.splice(r,1)}}function Ci(e,t){const[r,i]=p.useState(()=>t(e.getState()));return p.useEffect(()=>(i(t(e.getState())),e.subscribe(()=>{i(t(e.getState()))})),[t,e]),r}function c3(e){const t=e==null?void 0:e.messageCount;return typeof t=="number"&&Number.isFinite(t)?t:null}function u3(e,t){return t>0?"ready":"loading"}function d3(e,t){const r=c3(e);return r!==null?r>t:t>=j0}function fl(e){return e.olderCursor?!0:e.pagesLoaded>1?e.currentHasOlderMessages:d3(e.session,e.loadedMessageCount)}function _s(e,t){return e&&{...e,runningState:t,activityState:P0(e,t,e.completedAt??null,oa(t))}}function vC(e,t){return!e||e.lastSeenAt&&e.lastSeenAt>=t?e:{...e,lastSeenAt:t,activityState:e.activityState==="completed_unread"?"idle":e.activityState}}function yC(e,t){return T0(e,{runningState:t.runningState,activityResolutionSource:t.activityResolutionSource,activityConfidence:t.activityConfidence,runId:t.runId,detail:t.detail,errorCode:t.errorCode,errorDetail:t.errorDetail,hasActiveRun:t.hasActiveRun,updatedAt:t.updatedAt,watchdogTriggeredAt:t.watchdogTriggeredAt})}function h3(e,t){return T0(e,t)}function T0(e,t){if(!e)return e;const r=m3(t.activityResolutionSource),i=Qh(t.runningState)?$f(e.completedAt,t.updatedAt):null,a=t.runningState==="completed"||t.runningState==="interrupted"||t.runningState==="failed"?$f(e.lastEventAt,t.updatedAt):t.updatedAt;return{...e,runningState:t.runningState,activitySource:r,activityResolutionSource:t.activityResolutionSource,activityConfidence:t.activityConfidence,runId:t.runId,lastEventAt:a,completedAt:i,lastErrorCode:t.runningState==="failed"?t.errorCode??e.lastErrorCode:null,lastErrorDetail:t.runningState==="failed"?t.errorDetail??t.detail??e.lastErrorDetail:null,watchdogTriggeredAt:t.watchdogTriggeredAt,updatedAt:$f(e.updatedAt,t.updatedAt)??t.updatedAt,activityState:P0(e,t.runningState,i,t.hasActiveRun)}}function P0(e,t,r,i){return i||oa(t)?"running":r&&(!e.lastSeenAt||r>e.lastSeenAt)?"completed_unread":e.activityState==="running"||e.activityState==="completed_unread"?"idle":e.activityState??"idle"}function oa(e){return e==="starting"||e==="running"||e==="reconnecting"}function Qh(e){return e==="completed"||e==="interrupted"||e==="failed"}function kC(e){if(e===null)return!0;const t=e.modelOptions??[];return t.length===0?!0:t.every(r=>r.usesProviderDefault===!0)}function xC(e,t){return e==="session.backfill"?t??"idle":t==="completed"||t==="interrupted"||t==="failed"?t:"running"}function zf(e,t){return Qh(e)?e:t}function qf(e){return e.runningState==="failed"?{errorCode:e.errorCode,errorDetail:e.errorDetail??e.detail}:e.runningState==="interrupted"?{errorCode:null,errorDetail:e.detail}:e.runningState==="completed"?{errorCode:null,errorDetail:e.detail}:{errorCode:null,errorDetail:null}}function m3(e){return e==="authoritative_runtime"||e==="authoritative_provider_event"?"runtime":e==="inferred_log"?"inferred":"none"}function $f(e,t){return e?t?e>=t?e:t:e:t??null}function SC(){var e,t;if(typeof((e=globalThis.crypto)==null?void 0:e.randomUUID)=="function")return globalThis.crypto.randomUUID();if(typeof((t=globalThis.crypto)==null?void 0:t.getRandomValues)=="function"){const r=new Uint8Array(16);globalThis.crypto.getRandomValues(r),r[6]=r[6]&15|64,r[8]=r[8]&63|128;const i=Array.from(r,a=>a.toString(16).padStart(2,"0")).join("");return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}return`fallback-${Date.now()}-${Math.random().toString(16).slice(2,10)}`}function CC(e,t){return e?t&&e.provider===t.provider?!!t.canSendMessage:$T(e.provider):!1}function jC(e,t){return e?t&&e.provider===t.provider?!(!t.supportsInterrupt||e.provider==="claude-code"&&e.activitySource==="inferred"):e.provider==="codex"||e.provider==="opencode"?!0:e.provider==="claude-code"&&e.activitySource!=="inferred":!1}function Vf(e){return`session-runtime.snapshot.${e}`}function p3(e){return e.filter(t=>t.deliveryState==="sent").slice(-600)}function f3(e,t){const r=e.filter(i=>i.id!==t.id);return r.push(t),r.sort((i,a)=>i.orderIndex-a.orderIndex),r}function Gf(e,t){const r=e.filter(i=>i.id!==t.id);return r.push(t),r.sort((i,a)=>i.status!==a.status?i.status==="pending"?-1:1:a.createdAt.localeCompare(i.createdAt)),r}function zd(e,t){if(!e)return t;if(!t||NC(e,t))return e;if(NC(t,e))return t;const r=Date.parse(e.updatedAt||e.lastMessageAt||e.createdAt),i=Date.parse(t.updatedAt||t.lastMessageAt||t.createdAt);return!Number.isFinite(r)||!Number.isFinite(i)?t:r>=i?e:t}function NC(e,t){return TC(e)&&!TC(t)&&e.lastEventAt===t.lastEventAt&&e.lastMessageAt===t.lastMessageAt&&e.completedAt===t.completedAt}function TC(e){return e.activityState==="running"||oa(e.runningState)}const PC="butler:records-updated";function Fw(e){if(typeof window>"u")return()=>{};const t=()=>{e()};return window.addEventListener(PC,t),()=>{window.removeEventListener(PC,t)}}const DC=60;class g3{constructor(t){tt(this,"state");tt(this,"listeners",new Set);tt(this,"realtimeClient",null);tt(this,"realtimeSessionId",null);tt(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));tt(this,"getState",()=>this.state);this.workspaceId=t,this.state={loading:!0,sending:!1,switchingProvider:!1,initialized:!1,profile:null,activeProvider:"codex",controlSession:null,capabilities:gl("codex"),overview:null,events:[],messages:[],historyState:"idle",runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null,error:null}}async initialize(){this.patch({loading:!0,error:null});try{const t=await mm();if(!t.initialized||!t.profile){this.patch({loading:!1,initialized:!1,profile:null,activeProvider:"codex",capabilities:gl("codex"),controlSession:null,messages:[],historyState:"idle",overview:null,events:[],runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null});return}const r=t.profile;this.patch({initialized:!0,profile:r,activeProvider:r.providerId,capabilities:gl(r.providerId)}),await this.reloadForProvider(r.providerId),this.patch({loading:!1})}catch(t){this.patch({loading:!1,error:ia(t)})}}async initializeProfile(t){this.patch({loading:!0,error:null});try{const r=await t_(t);if(!r.initialized||!r.profile)throw new Error("BUTLER_PROFILE_INIT_FAILED");this.patch({initialized:!0,profile:r.profile,activeProvider:r.profile.providerId,capabilities:gl(r.profile.providerId)}),await this.reloadForProvider(r.profile.providerId)}catch(r){throw this.patch({error:ia(r)}),r}finally{this.patch({loading:!1})}}async switchProvider(t){if(!this.state.initialized||!this.state.profile||this.state.activeProvider===t)return;const r={activeProvider:this.state.activeProvider,profile:this.state.profile,controlSession:this.state.controlSession,capabilities:this.state.capabilities,overview:this.state.overview,events:this.state.events,messages:this.state.messages,historyState:this.state.historyState,runtimeHasActiveRun:this.state.runtimeHasActiveRun,runtimeCanInterrupt:this.state.runtimeCanInterrupt,contextUsage:this.state.contextUsage};this.patch({switchingProvider:!0,error:null,activeProvider:t,controlSession:null,messages:[],historyState:"idle",overview:null,events:[],runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null,capabilities:gl(t)});try{const i=await bx({providerId:t});if(!i.initialized||!i.profile)throw new Error("BUTLER_PROFILE_UPDATE_FAILED");this.patch({initialized:!0,profile:i.profile,activeProvider:i.profile.providerId}),await Promise.all([this.refreshCapabilities(i.profile.providerId),this.refreshOverview(),this.refreshEvents()]),await this.startFreshSession({preserveSwitchingState:!0})}catch(i){throw this.patch({...r,error:ia(i)}),i}finally{this.patch({switchingProvider:!1})}}async updateProfile(t){if(!(!this.state.initialized||!this.state.profile)){this.patch({loading:!0,error:null});try{const r=await bx(t);if(!r.initialized||!r.profile)throw new Error("BUTLER_PROFILE_UPDATE_FAILED");this.patch({initialized:!0,profile:r.profile,activeProvider:r.profile.providerId})}catch(r){throw this.patch({error:ia(r)}),r}finally{this.patch({loading:!1})}}}async sendMessage(t,r){const i=t.trim();if(!(!i||!this.state.initialized)){this.patch({sending:!0,error:null});try{if(this.state.controlSession){const c=await s_({content:i,model:(r==null?void 0:r.model)??null,reasoningLevel:(r==null?void 0:r.reasoningLevel)??null,permissionMode:(r==null?void 0:r.permissionMode)??null});this.patch({controlSession:c.controlSession})}else{const c=await i_({content:i,model:(r==null?void 0:r.model)??null,reasoningLevel:(r==null?void 0:r.reasoningLevel)??null,permissionMode:(r==null?void 0:r.permissionMode)??null});this.patch({controlSession:c.controlSession})}await this.reloadControlSession(),await Promise.all([this.refreshOverview(),this.refreshEvents()])}catch(a){throw this.patch({error:ia(a)}),a}finally{this.patch({sending:!1})}}}async retryMessage(t){const r=this.state.messages.find(i=>i.clientRequestId===t);!r||!r.content.trim()||await this.sendMessage(r.content)}async startFreshSession(t){if(this.state.initialized){this.teardownRealtime(),this.patch({sending:!1,error:null,controlSession:null,messages:[],historyState:"ready",runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null});try{await r_()}catch(r){throw this.patch({historyState:"error",error:ia(r)}),r}this.patch({switchingProvider:t!=null&&t.preserveSwitchingState?this.state.switchingProvider:!1})}}async refreshAll(){if(this.state.initialized){this.patch({loading:!0,error:null});try{await this.reloadForProvider(this.state.activeProvider)}finally{this.patch({loading:!1})}}}async reloadEventsAndOverview(){this.state.initialized&&await Promise.all([this.refreshOverview(),this.refreshEvents()])}async reloadForProvider(t){await Promise.all([this.refreshCapabilities(t),this.refreshOverview(),this.refreshEvents()]),await this.reloadControlSession()}async reloadControlSession(){this.patch({historyState:"loading"});try{const r=(await n_()).controlSession;if(!r){this.teardownRealtime(),this.patch({controlSession:null,messages:[],historyState:"ready",runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null});return}const[i,a]=await Promise.all([ew(r.session.sessionId,null,DC,"forward"),_g(r.session.sessionId)]),c=i.messages.map(u=>jm(r.session.sessionId,u));this.ensureRealtimeSubscription(r.session.sessionId,i.cursor),this.patch({controlSession:r,messages:c,historyState:"ready",runtimeHasActiveRun:a.hasActiveRun,runtimeCanInterrupt:a.canInterrupt,contextUsage:a.contextUsage})}catch(t){this.patch({historyState:"error",error:ia(t)})}}async refreshCapabilities(t){try{const r=await Il(t,this.workspaceId);this.patch({capabilities:r})}catch{this.patch({capabilities:gl(t)})}}async refreshOverview(){try{const t=await pm();this.patch({overview:t.overview})}catch(t){this.patch({error:ia(t)})}}async refreshEvents(){try{const t=await a_();this.patch({events:t.items})}catch(t){this.patch({error:ia(t)})}}patch(t){this.state={...this.state,...t},this.emit()}emit(){for(const t of this.listeners)t()}ensureRealtimeSubscription(t,r){if(this.realtimeClient&&this.realtimeSessionId===t){this.realtimeClient.updateCursor(r);return}this.teardownRealtime(),this.realtimeSessionId=t,this.realtimeClient=new g0({sessionId:t,cursor:r,limit:DC,onConnectionChange:()=>{},onSubscribed:()=>{},onEnvelope:i=>{this.handleRealtimeMessages(i.sessionId,i.messages)},onOlderHistory:i=>{this.handleRealtimeMessages(i.sessionId,i.messages)},onRuntimeMessage:i=>{this.handleRealtimeRuntimeMessage(i)},onActivity:i=>{this.handleRealtimeActivity(i)},onRuntimeStatus:i=>{this.handleRealtimeStatus(i)},onRuntimeError:i=>{this.handleRealtimeRuntimeError(i)},onInterrupted:i=>{this.handleRealtimeInterrupted(i)},onPermissionRequest:()=>{},onPermissionRequestResolved:()=>{},onError:i=>{this.isActiveControlSession(i.sessionId??null)&&this.patch({error:i.detail})},onUnauthorized:()=>{this.patch({error:o("common.unauthorized")})}}),this.realtimeClient.start()}teardownRealtime(){var t;(t=this.realtimeClient)==null||t.close(),this.realtimeClient=null,this.realtimeSessionId=null}handleRealtimeMessages(t,r){this.isActiveControlSession(t)&&this.patch({messages:b3(this.state.messages,t,r),historyState:"ready"})}handleRealtimeRuntimeMessage(t){this.handleRealtimeMessages(t.sessionId,[t.message])}handleRealtimeActivity(t){this.isActiveControlSession(t.sessionId)&&(this.patch({runtimeHasActiveRun:t.hasActiveRun,runtimeCanInterrupt:t.canInterrupt}),t.hasActiveRun||this.reloadControlSession())}handleRealtimeStatus(t){this.isActiveControlSession(t.sessionId)&&(this.patch({runtimeHasActiveRun:t.status==="starting"||t.status==="running",runtimeCanInterrupt:t.status==="starting"||t.status==="running"?!0:this.state.runtimeCanInterrupt}),(t.status==="completed"||t.status==="failed"||t.status==="interrupted")&&this.reloadControlSession())}handleRealtimeRuntimeError(t){this.isActiveControlSession(t.sessionId)&&(this.patch({error:t.detail,runtimeHasActiveRun:!1}),this.reloadControlSession())}handleRealtimeInterrupted(t){this.isActiveControlSession(t.sessionId)&&(this.patch({runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,error:t.detail}),this.reloadControlSession())}isActiveControlSession(t){var r;return!!(t&&((r=this.state.controlSession)==null?void 0:r.session.sessionId)===t)}}function si(e,t){const[r,i]=p.useState(()=>t(e.getState()));return p.useEffect(()=>(i(t(e.getState())),e.subscribe(()=>{i(t(e.getState()))})),[t,e]),r}function gl(e){const t=[{id:"provider-default",name:o("conversation.modelUseCliDefault"),usesProviderDefault:!0}];return{provider:e,canStartSession:!0,canResumeSession:!0,canSendMessage:!0,inRunInputMode:e==="claude-code"?"streaming_guidance":"none",supportsSubagents:!1,supportsInterrupt:!0,supportsStructuredToolCalls:!0,supportsTokenUsage:!0,supportsAttachments:!1,supportsPermissionPrompt:!0,supportsCheckpoint:!1,supportsQueueWhileRunning:!1,supportsRunSteering:!1,supportsSlashMenu:!1,supportsReasoningSelector:!0,modelOptions:t,defaultReasoningLevel:null,limitations:[]}}function b3(e,t,r){const i=new Map;for(const a of e)i.set(RC(a),a);for(const a of r){const c=jm(t,a);i.set(RC(c),c)}return[...i.values()].sort((a,c)=>a.sequence!==c.sequence?a.sequence-c.sequence:a.timestamp.localeCompare(c.timestamp))}function RC(e){return e.id||e.rawRef}function ia(e){return e instanceof Error?e.message:String(e)}const ab={"risk-first":["risk","blocker","verification"],"blocker-first":["blocker","risk","verification"],"verification-first":["verification","risk","blocker"],"progress-first":["progress","risk","blocker"]},D0=300,w3={displayName:"",providerId:"codex",agentsMode:"inline",personaTone:"direct",personaLanguage:"zh-CN",personaSummaryStyle:"brief",focusRiskPreference:"conservative",reportPriorityPreset:"risk-first"},Kf={displayName:"",agentsMode:"inline",agentsFilePath:"",agentsContent:"",personaTone:"direct",personaLanguage:"zh-CN",personaSummaryStyle:"brief",focusRiskPreference:"conservative",reportPriorityPreset:"risk-first",summaryDebounceSeconds:D0},v3=[{value:60,labelKey:"shell.butlerSummaryDebounceOption1Minute"},{value:180,labelKey:"shell.butlerSummaryDebounceOption3Minutes"},{value:300,labelKey:"shell.butlerSummaryDebounceOption5Minutes"},{value:600,labelKey:"shell.butlerSummaryDebounceOption10Minutes"},{value:900,labelKey:"shell.butlerSummaryDebounceOption15Minutes"},{value:1800,labelKey:"shell.butlerSummaryDebounceOption30Minutes"}],aa={builder:["🧠","🤖","🦾","🛠️","⚙️","🧩","🚀","🛰️","🔧","💡"],analyst:["🦉","🧭","🔍","📚","🧪","📐","🗂️","📝","🧮","📊"],direct:["🦅","🛡️","⚡","🎯","🪓","🧱","🔨","📌","🧰","🏹"],steady:["🐢","🐘","🦬","🦫","🌲","⛰️","🪨","🧺","🧷","🕰️"],friendly:["🐼","🦊","🐻","🐶","🐱","🐹","🐰","🦄","🌼","🍀"],default:["🧠","🤖","🦉","🧩","📚","💡","🛠️","🚀","🌟","🪄","🧭","🔮"]};function y3(){var _e,ze,yt,nt,Ve;const{workspaceId:e=""}=Ao(),t=mr(),{showToast:r}=Jn(),{requestNavigationRefresh:i,setAuxiliaryPanel:a}=Tr(),c=p.useRef(null),u=p.useRef(null),[d,m]=p.useState(w3),[f,w]=p.useState(!1),[g,v]=p.useState(Kf),[y,x]=p.useState(!1),[C,j]=p.useState(0),[N,P]=p.useState([]),[L,Y]=p.useState([]),[H,W]=p.useState([]),[I,M]=p.useState(!1),[O,F]=p.useState(!1),[X,U]=p.useState(null),[G,R]=p.useState(null),[A,Z]=p.useState(!1),[pe,q]=p.useState(null);(!c.current||u.current!==e)&&(c.current=new g3(e),u.current=e);const D=c.current,T=si(D,ne=>ne.loading),B=si(D,ne=>ne.sending),Q=si(D,ne=>ne.switchingProvider),_=si(D,ne=>ne.initialized),de=si(D,ne=>ne.profile),le=si(D,ne=>ne.activeProvider),oe=si(D,ne=>ne.controlSession),ye=si(D,ne=>ne.capabilities),Ne=si(D,ne=>ne.overview),Me=si(D,ne=>ne.events),Te=si(D,ne=>ne.messages),Dt=si(D,ne=>ne.historyState),st=si(D,ne=>ne.runtimeHasActiveRun),dt=si(D,ne=>ne.runtimeCanInterrupt),bt=si(D,ne=>ne.contextUsage),pt=si(D,ne=>ne.error),we=((_e=de==null?void 0:de.displayName)==null?void 0:_e.trim())||d.displayName.trim()||o("shell.butlerEntry"),he=p.useMemo(()=>W3({displayName:we,providerId:(de==null?void 0:de.providerId)??d.providerId,tone:(de==null?void 0:de.persona.tone)??d.personaTone}),[we,d.personaTone,d.providerId,de==null?void 0:de.persona.tone,de==null?void 0:de.providerId]),Le=((yt=(ze=oe==null?void 0:oe.session)==null?void 0:ze.sessionId)==null?void 0:yt.trim())||null,Oe=p.useMemo(()=>!Le||!(oe!=null&&oe.session)?null:new N0(Le,{initialSession:oe.session}),[Le]),Qe=q3(Oe),wt=Oe?Qe.messages:Te,Ie=Oe?Qe.historyState:Dt,Be=Oe?Qe.runtimeHasActiveRun:st,vt=Oe?Qe.runtimeCanInterrupt:dt,ft=Oe?Qe.contextUsage:bt,ve=Oe?Qe.loadingOlderMessages:!1,Ae=Oe?Qe.hasOlderMessages:!1,et=p.useMemo(()=>L.slice(0,3),[L]),We=p.useMemo(()=>((Ne==null?void 0:Ne.projects)??[]).map(ne=>ne.id).sort(),[Ne==null?void 0:Ne.projects]),lt=p.useCallback(()=>{F(!0)},[]),ct=p.useCallback(ne=>{v(je=>({...je,...ne}))},[]),Vt=p.useCallback(async ne=>{F(!1),U(ne),R(null),q(null),Z(!0);try{const je=await lP(ne);R(je.task)}catch(je){q(je instanceof Error?je.message:o("shell.butlerAutomationRoundLoadFailed"))}finally{Z(!1)}},[]),Bt=p.useCallback(async()=>{if(de){if(!g.displayName.trim()){r({title:o("shell.butlerInitNameRequired"),tone:"warning"});return}x(!0);try{await D.updateProfile({displayName:g.displayName.trim(),agentsMode:g.agentsMode,agentsFilePath:g.agentsMode==="file"?g.agentsFilePath:null,agentsContent:g.agentsContent,persona:{tone:g.personaTone,language:g.personaLanguage,summaryStyle:g.personaSummaryStyle},focus:{...de.focus,riskPreference:g.focusRiskPreference,reportPriority:ab[g.reportPriorityPreset],summaryDebounceSeconds:g.summaryDebounceSeconds}}),r({title:o("shell.butlerSettingsSaved"),tone:"success"})}catch(ne){r({title:o("shell.butlerSettingsSaveFailed"),description:ne instanceof Error?ne.message:void 0,tone:"error"})}finally{x(!1)}}},[de,g,r,D]);p.useEffect(()=>{D.initialize()},[D]),p.useEffect(()=>{if(Oe)return Oe.initialize(),()=>{Oe.destroy()}},[Oe]),p.useEffect(()=>{!Oe||!(oe!=null&&oe.session)||Oe.applyNavigationSession(oe.session)},[oe==null?void 0:oe.session,Oe]),p.useEffect(()=>{pt&&r({title:o("shell.butlerLoadFailed"),description:pt,tone:"error"})},[pt,r]),p.useEffect(()=>{if(!de){v(Kf);return}v({displayName:de.displayName,agentsMode:de.agentsMode,agentsFilePath:_3(de),agentsContent:de.agentsContent,personaTone:de.persona.tone,personaLanguage:de.persona.language,personaSummaryStyle:de.persona.summaryStyle,focusRiskPreference:de.focus.riskPreference,reportPriorityPreset:F3(de.focus.reportPriority),summaryDebounceSeconds:de.focus.summaryDebounceSeconds??Kf.summaryDebounceSeconds})},[de]),p.useEffect(()=>{if(!_){P([]),Y([]),W([]);return}let ne=!1;async function je(){try{const[tn,Kt,$t]=await Promise.all([Kc(),Yc(),Promise.all(We.map(Zt=>oP(Zt)))]);ne||(P(tn.items),Y(Kt.items),W($t.flatMap(Zt=>Zt.items)))}catch(tn){if(ne)return;P([]),Y([]),W([]),r({title:o("shell.butlerSidebarLoadFailed"),description:tn instanceof Error?tn.message:void 0,tone:"error"})}}je();function ht(){je()}const Rt=window.setInterval(()=>{je()},15e3);return window.addEventListener(No,ht),()=>{ne=!0,window.clearInterval(Rt),window.removeEventListener(No,ht)}},[_,We,r]),p.useEffect(()=>Fw(()=>{D.reloadEventsAndOverview()}),[D]);const Wt=p.useMemo(()=>[{value:"codex",label:"Codex"}],[]),Lt=p.useMemo(()=>[{value:"inline",label:o("shell.butlerAgentsModeInline")},{value:"file",label:o("shell.butlerAgentsModeFile")}],[]),Nt=p.useMemo(()=>[{value:"direct",label:o("shell.butlerToneDirect")},{value:"steady",label:o("shell.butlerToneSteady")},{value:"friendly",label:o("shell.butlerToneFriendly")}],[]),ln=p.useMemo(()=>[{value:"zh-CN",label:o("shell.butlerLanguageZhCn")},{value:"en-US",label:o("shell.butlerLanguageEnUs")},{value:"bilingual",label:o("shell.butlerLanguageBilingual")}],[]),Jt=p.useMemo(()=>[{value:"brief",label:o("shell.butlerSummaryBrief")},{value:"structured",label:o("shell.butlerSummaryStructured")},{value:"thorough",label:o("shell.butlerSummaryThorough")}],[]),Sn=p.useMemo(()=>[{value:"conservative",label:o("shell.butlerRiskConservative")},{value:"balanced",label:o("shell.butlerRiskBalanced")},{value:"proactive",label:o("shell.butlerRiskProactive")}],[]),se=p.useMemo(()=>[{value:"risk-first",label:o("shell.butlerReportRiskFirst")},{value:"blocker-first",label:o("shell.butlerReportBlockerFirst")},{value:"verification-first",label:o("shell.butlerReportVerificationFirst")},{value:"progress-first",label:o("shell.butlerReportProgressFirst")}],[]),He=La(Wt,d.providerId),xt=La(Lt,d.agentsMode),Tt=La(Nt,d.personaTone),Mn=La(ln,d.personaLanguage),wn=La(Jt,d.personaSummaryStyle),kn=La(Sn,d.focusRiskPreference),Ht=La(se,d.reportPriorityPreset),Gt=d.agentsMode==="inline"?o("shell.butlerAgentsModeInlineDescription"):o("shell.butlerAgentsModeFileDescription"),dn=[xt,Mn,kn],hn=p.useMemo(()=>n.jsx(k3,{overview:Ne,events:Me,inboxItems:N,followUpTasks:L,patrolPlans:H,settingsForm:g,savingSettings:y,onOpenFollowUpHistory:lt,onOpenFollowUpDetail:Vt,onSettingsFormChange:ct,onSaveSettings:()=>{Bt()}}),[Me,lt,L,Vt,Bt,ct,N,Ne,H,y,g]);p.useEffect(()=>{if(!_){a(null);return}return a(hn),()=>{a(null)}},[_,a,hn]);async function te(ne){ne.preventDefault();const je=d.displayName.trim();if(!je){r({title:o("shell.butlerInitNameRequired"),tone:"warning"});return}const ht={displayName:je,providerId:d.providerId,agentsMode:d.agentsMode,persona:{tone:d.personaTone,language:d.personaLanguage,summaryStyle:d.personaSummaryStyle},focus:{projectIds:[],riskPreference:d.focusRiskPreference,reportPriority:ab[d.reportPriorityPreset],summaryDebounceSeconds:D0}};w(!0);try{await D.initializeProfile(ht),r({title:o("shell.butlerInitSuccess"),tone:"success"})}catch(Rt){r({title:o("shell.butlerInitFailed"),description:Rt instanceof Error?Rt.message:void 0,tone:"error"})}finally{w(!1)}}async function re(ne){if(ne!==le)try{await D.switchProvider(ne),Se(ne),r({title:o("shell.butlerProviderSwitched"),description:o("shell.butlerProviderSwitchedDescription",{provider:La(Wt,ne)}),tone:"success"})}catch(je){r({title:o("shell.butlerProviderSwitchFailed"),description:je instanceof Error?je.message:void 0,tone:"error"})}}async function ue(){try{Se(le),await D.startFreshSession(),r({title:o("shell.butlerNewSessionStarted"),tone:"success"})}catch(ne){r({title:o("shell.butlerNewSessionFailed"),description:ne instanceof Error?ne.message:void 0,tone:"error"})}}function Se(ne){j(je=>je+1),t(jo(e),{replace:!0}),ne&&i()}return T&&!_&&!f?n.jsx("main",{className:"workbench-page butler-page-shell butler-loading-shell",children:n.jsx(R3,{})}):_?n.jsxs(n.Fragment,{children:[n.jsxs("main",{className:"workbench-page conversation-page-shell butler-page-shell butler-chat-workspace",children:[n.jsxs("header",{className:"workbench-auxiliary-header butler-main-header","data-window-drag-handle":"conversation-header",children:[n.jsx("div",{className:"butler-header-main",children:n.jsxs("div",{className:"butler-header-analysis-anchor",onMouseEnter:()=>{M(!0)},onMouseLeave:()=>{M(!1)},children:[n.jsx("div",{className:"butler-chat-avatar","aria-hidden":"true",children:n.jsx("span",{children:he})}),n.jsx("div",{className:"butler-main-heading",children:n.jsx("h1",{tabIndex:0,onFocus:()=>{M(!0)},onBlur:()=>{M(!1)},children:we})}),I?n.jsxs("div",{className:"butler-header-analysis-popover",role:"status","aria-live":"polite",children:[n.jsx("strong",{children:o("conversation.butlerAnalysisTitle")}),et.length>0?et.map(ne=>n.jsxs("div",{className:"butler-header-analysis-item",children:[n.jsxs("p",{children:[o("conversation.butlerAnalysisObjectiveLabel"),":",ne.objective]}),n.jsxs("p",{children:[o("conversation.butlerAnalysisStatusLabel"),":",ju(ne.status)]}),n.jsxs("p",{children:[o("conversation.butlerAnalysisSummaryLabel"),":",ne.lastAutomationSummary||ne.waitingReason||o("conversation.butlerAnalysisEmpty")]})]},ne.id)):n.jsx("p",{children:o("conversation.butlerAnalysisEmpty")})]}):null]})}),n.jsxs("div",{className:"butler-toolbar-cluster",children:[n.jsx("div",{className:"butler-provider-switcher",children:n.jsx("select",{"aria-label":o("shell.butlerProviderLabel"),value:le,disabled:Wt.length<=1||Q||B,onChange:ne=>{re(ne.target.value)},children:Wt.map(ne=>n.jsx("option",{value:ne.value,children:ne.label},ne.value))})}),n.jsx("button",{type:"button",className:"terminal-tab-control butler-header-icon-button","aria-label":o("shell.butlerNewSessionAction"),title:o("shell.butlerNewSessionAction"),disabled:T||B||Q,onClick:()=>{ue()},children:n.jsx("span",{className:"terminal-toolbar-icon","aria-hidden":"true",children:n.jsx(H3,{})})}),n.jsx("button",{type:"button",className:"terminal-tab-control butler-header-icon-button","aria-label":o("shell.butlerRefreshAction"),title:o("shell.butlerRefreshAction"),disabled:T||B||Q,onClick:()=>{Promise.all([D.refreshAll(),Kc().then(ne=>P(ne.items)),Yc().then(ne=>Y(ne.items))])},children:n.jsx("span",{className:"terminal-toolbar-icon","aria-hidden":"true",children:n.jsx(z3,{})})})]})]}),n.jsx("section",{className:"butler-main-column",children:n.jsxs("div",{className:"butler-conversation-shell",children:[n.jsx(Lw,{sessionId:(nt=oe==null?void 0:oe.session)==null?void 0:nt.sessionId,messages:wt,historyState:Ie,loadingOlderMessages:ve,hasOlderMessages:Ae,provider:le,assistantAvatar:n.jsx("span",{className:"butler-message-avatar","aria-hidden":"true",children:he}),onLoadOlderMessages:()=>{Oe&&Oe.loadOlderMessages()},onRetryMessage:ne=>{const je=wt.find(ht=>ht.clientRequestId===ne);if(je!=null&&je.content.trim()){D.sendMessage(je.content);return}D.retryMessage(ne)}}),n.jsx("div",{className:"butler-composer-shell",children:n.jsx(hw,{capabilities:ye,draftStorageId:`butler:${le}:${C}`,placeholder:o("shell.butlerComposerPlaceholder",{displayName:we}),hasActiveRun:Be,canInterrupt:vt,contextUsage:ft,isSubmitting:B||Q,isRunning:Be??!1,onSend:async(ne,je)=>{var ht;(((ht=je==null?void 0:je.attachments)==null?void 0:ht.length)??0)>0&&r({title:o("shell.butlerAttachmentUnsupported"),tone:"warning"}),await D.sendMessage(ne,{model:(je==null?void 0:je.model)??null,reasoningLevel:(je==null?void 0:je.reasoningLevel)??null,permissionMode:null}),i()}})})]},`timeline:${le}:${C}`)})]}),n.jsx(Ln,{open:O,title:o("shell.butlerFollowUpHistoryTitle"),description:o("shell.butlerFollowUpHistoryDescription"),onClose:()=>{F(!1)},children:n.jsx(N3,{tasks:L,onOpenFollowUpDetail:Vt,onClose:()=>{F(!1)}})}),n.jsx(Ln,{open:X!==null,title:o("shell.butlerAutomationRoundDetailsTitle"),description:((Ve=G==null?void 0:G.sessionTitle)==null?void 0:Ve.trim())||(G==null?void 0:G.projectName)||o("shell.butlerAutomationRoundDetailsDescription"),onClose:()=>{U(null),R(null),q(null),Z(!1)},children:n.jsx(E3,{task:G,loading:A,error:pe})})]}):n.jsxs("main",{className:"workbench-page butler-page-shell butler-init-shell",children:[n.jsxs("div",{className:"butler-init-backdrop","aria-hidden":"true",children:[n.jsx("span",{className:"butler-init-glow butler-init-glow-primary"}),n.jsx("span",{className:"butler-init-glow butler-init-glow-secondary"})]}),n.jsxs("div",{className:"butler-init-layout",children:[n.jsxs("aside",{className:"butler-init-sidebar",children:[n.jsx("section",{className:"butler-init-hero-card",children:n.jsxs("div",{className:"butler-init-hero-copy",children:[n.jsx("h1",{children:o("shell.butlerInitTitle")}),n.jsx("p",{children:o("shell.butlerInitDescription")})]})}),n.jsxs("section",{className:"butler-init-preview-card",children:[n.jsx("header",{className:"butler-init-section-header",children:n.jsx("div",{children:n.jsx("h2",{children:o("shell.butlerInitPreviewTitle")})})}),n.jsxs("div",{className:"butler-init-preview-identity",children:[n.jsxs("div",{className:"butler-init-preview-nameplate",children:[n.jsx("div",{className:"butler-chat-avatar butler-init-preview-avatar",children:n.jsx("span",{children:he})}),n.jsx("strong",{children:we})]}),n.jsx("span",{className:"butler-init-preview-provider",children:He})]}),n.jsx("div",{className:"butler-init-chip-list",children:dn.map(ne=>n.jsx("span",{className:"butler-init-chip",children:ne},ne))}),n.jsxs("div",{className:"butler-init-preview-rows",children:[n.jsxs("div",{className:"butler-init-preview-row",children:[n.jsx("span",{children:o("shell.butlerPersonaToneLabel")}),n.jsx("strong",{children:Tt})]}),n.jsxs("div",{className:"butler-init-preview-row",children:[n.jsx("span",{children:o("shell.butlerInitPreviewRuleLabel")}),n.jsx("strong",{children:xt})]}),n.jsxs("div",{className:"butler-init-preview-row",children:[n.jsx("span",{children:o("shell.butlerPersonaSummaryStyleLabel")}),n.jsx("strong",{children:wn})]}),n.jsxs("div",{className:"butler-init-preview-row",children:[n.jsx("span",{children:o("shell.butlerReportPriorityPresetLabel")}),n.jsx("strong",{children:Ht})]})]})]})]}),n.jsxs("form",{className:"butler-init-form",onSubmit:te,children:[n.jsxs("section",{className:"butler-init-form-section",children:[n.jsx("header",{className:"butler-init-section-header",children:n.jsx("div",{children:n.jsx("h2",{children:o("shell.butlerInitBasicsTitle")})})}),n.jsxs("div",{className:"butler-init-basic-grid",children:[n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerDisplayNameLabel")}),n.jsx("input",{className:"butler-form-control",value:d.displayName,onChange:ne=>m(je=>({...je,displayName:ne.target.value})),placeholder:o("shell.butlerDisplayNamePlaceholder")}),n.jsx("small",{children:o("shell.butlerDisplayNameHint")})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerProviderLabel")}),n.jsx("select",{className:"butler-form-control",value:d.providerId,disabled:Wt.length<=1,onChange:ne=>m(je=>({...je,providerId:ne.target.value})),children:Wt.map(ne=>n.jsx("option",{value:ne.value,children:ne.label},ne.value))})]}),n.jsxs("label",{className:"butler-form-field butler-form-field-wide",children:[n.jsx("span",{children:o("shell.butlerAgentsModeLabel")}),n.jsx("select",{className:"butler-form-control",value:d.agentsMode,onChange:ne=>m(je=>({...je,agentsMode:ne.target.value})),children:Lt.map(ne=>n.jsx("option",{value:ne.value,children:ne.label},ne.value))}),n.jsx("small",{children:Gt})]})]})]}),n.jsxs("section",{className:"butler-init-form-section",children:[n.jsx("header",{className:"butler-init-section-header",children:n.jsx("div",{children:n.jsx("h2",{children:o("shell.butlerInitPersonaTitle")})})}),n.jsxs("div",{className:"butler-init-persona-grid",children:[n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerPersonaToneLabel")}),n.jsx("select",{className:"butler-form-control",value:d.personaTone,onChange:ne=>m(je=>({...je,personaTone:ne.target.value})),children:Nt.map(ne=>n.jsx("option",{value:ne.value,children:ne.label},ne.value))})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerPersonaLanguageLabel")}),n.jsx("select",{className:"butler-form-control",value:d.personaLanguage,onChange:ne=>m(je=>({...je,personaLanguage:ne.target.value})),children:ln.map(ne=>n.jsx("option",{value:ne.value,children:ne.label},ne.value))})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerPersonaSummaryStyleLabel")}),n.jsx("select",{className:"butler-form-control",value:d.personaSummaryStyle,onChange:ne=>m(je=>({...je,personaSummaryStyle:ne.target.value})),children:Jt.map(ne=>n.jsx("option",{value:ne.value,children:ne.label},ne.value))})]})]})]}),n.jsxs("section",{className:"butler-init-form-section",children:[n.jsx("header",{className:"butler-init-section-header",children:n.jsx("div",{children:n.jsx("h2",{children:o("shell.butlerInitPreferenceTitle")})})}),n.jsxs("div",{className:"butler-init-preferences-grid",children:[n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerFocusRiskPreferenceLabel")}),n.jsx("select",{className:"butler-form-control",value:d.focusRiskPreference,onChange:ne=>m(je=>({...je,focusRiskPreference:ne.target.value})),children:Sn.map(ne=>n.jsx("option",{value:ne.value,children:ne.label},ne.value))})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerReportPriorityPresetLabel")}),n.jsx("select",{className:"butler-form-control",value:d.reportPriorityPreset,onChange:ne=>m(je=>({...je,reportPriorityPreset:ne.target.value})),children:se.map(ne=>n.jsx("option",{value:ne.value,children:ne.label},ne.value))})]})]})]}),n.jsx("div",{className:"butler-init-actions",children:n.jsx("button",{className:"butler-init-submit",type:"submit",disabled:T||f,children:o(T||f?"shell.butlerInitSubmitting":"shell.butlerInitSubmit")})})]})]})]})}function k3(e){const[t,r]=p.useState("info"),i=[{id:"info",label:o("shell.butlerSidebarInfoTab")},{id:"automation",label:o("shell.butlerSidebarAutomationTab")},{id:"settings",label:o("shell.butlerSidebarSettingsTab")}];return n.jsxs("div",{className:"butler-side-column",children:[n.jsx("div",{className:"workbench-auxiliary-header butler-side-header",children:n.jsx("div",{className:"workbench-info-tabs butler-side-tabs",role:"tablist","aria-label":o("shell.butlerSidebarTabsLabel"),children:i.map(a=>n.jsx("button",{type:"button",role:"tab","aria-selected":t===a.id,className:t===a.id?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{r(a.id)},children:a.label},a.id))})}),t==="info"?n.jsx(x3,{overview:e.overview,inboxItems:e.inboxItems,followUpTasks:e.followUpTasks,onOpenFollowUpHistory:e.onOpenFollowUpHistory,onOpenFollowUpDetail:e.onOpenFollowUpDetail}):t==="automation"?n.jsx(S3,{overview:e.overview,followUpTasks:e.followUpTasks,patrolPlans:e.patrolPlans}):n.jsx(D3,{settingsForm:e.settingsForm,savingSettings:e.savingSettings,onSettingsFormChange:e.onSettingsFormChange,onSaveSettings:e.onSaveSettings})]})}function x3(e){var i;const t=p.useMemo(()=>{var a;return I3(((a=e.overview)==null?void 0:a.verifications)??[])},[(i=e.overview)==null?void 0:i.verifications]),r=p.useMemo(()=>L3(e.inboxItems),[e.inboxItems]);return n.jsxs(n.Fragment,{children:[n.jsx(j3,{tasks:e.followUpTasks,onOpenFollowUpHistory:e.onOpenFollowUpHistory,onOpenFollowUpDetail:e.onOpenFollowUpDetail}),n.jsx(MC,{title:o("shell.butlerInfoVerificationRecordsTitle"),items:t,emptyText:o("shell.butlerInfoVerificationRecordsEmpty")}),n.jsx(MC,{title:o("shell.butlerInfoTodoRecordsTitle"),items:r,emptyText:o("shell.butlerInfoTodoRecordsEmpty")})]})}function S3(e){const t=p.useMemo(()=>M3(e.patrolPlans,e.followUpTasks,e.overview),[e.followUpTasks,e.overview,e.patrolPlans]),r=p.useMemo(()=>A3(e.followUpTasks,e.overview),[e.followUpTasks,e.overview]);return n.jsxs(n.Fragment,{children:[n.jsx(T3,{items:t,emptyText:o("shell.butlerAutomationTasksEmpty")}),n.jsx(P3,{items:r,emptyText:o("shell.butlerAutomationRunsEmpty")})]})}function MC(e){return n.jsxs("section",{className:"butler-side-card",children:[n.jsx("header",{children:n.jsx("h2",{children:e.title})}),e.items.length>0?n.jsx("div",{className:"butler-record-list",children:e.items.map(t=>n.jsx(C3,{title:t.title,content:t.content},`${t.title}:${t.content}`))}):n.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function C3(e){return n.jsxs("div",{className:"butler-simple-info-block",children:[n.jsx("span",{children:e.title}),n.jsx("strong",{children:e.content})]})}function j3(e){const t=p.useMemo(()=>[...e.tasks].sort((r,i)=>Mi(nu(i))-Mi(nu(r))).slice(0,5),[e.tasks]);return n.jsxs("section",{className:"butler-side-card",children:[n.jsxs("header",{children:[n.jsx("div",{className:"butler-card-header-copy",children:n.jsx("h2",{children:o("shell.butlerInfoFollowUpRecordsTitle")})}),n.jsx("button",{type:"button",className:"secondary-button butler-side-header-action",onClick:e.onOpenFollowUpHistory,children:o("shell.butlerFollowUpHistoryAction")})]}),t.length>0?n.jsx("div",{className:"butler-record-list",children:t.map(r=>n.jsx(R0,{task:r,onOpenFollowUpDetail:e.onOpenFollowUpDetail},r.id))}):n.jsx("p",{className:"butler-secondary-text",children:o("shell.butlerInfoFollowUpRecordsEmpty")})]})}function N3(e){const t=p.useMemo(()=>[...e.tasks].sort((r,i)=>Mi(nu(i))-Mi(nu(r))),[e.tasks]);return n.jsx("div",{className:"butler-follow-up-history-panel",children:t.length>0?n.jsx("div",{className:"butler-record-list",children:t.map(r=>n.jsx(R0,{task:r,onOpenFollowUpDetail:async i=>{e.onClose(),await e.onOpenFollowUpDetail(i)}},r.id))}):n.jsx("p",{className:"butler-secondary-text",children:o("shell.butlerInfoFollowUpRecordsEmpty")})})}function R0(e){var a,c,u;const{task:t}=e,r=((a=t.sessionTitle)==null?void 0:a.trim())||t.projectName,i=((c=t.waitingReason)==null?void 0:c.trim())||((u=t.lastAutomationSummary)==null?void 0:u.trim())||t.objective;return n.jsxs("article",{className:"butler-follow-up-status-card",children:[n.jsxs("header",{className:"butler-follow-up-status-header",children:[n.jsxs("div",{className:"butler-follow-up-status-title-group",children:[n.jsx("strong",{children:r}),n.jsx("span",{children:t.projectName})]}),n.jsx("span",{className:"butler-automation-status-badge","data-status":t.status,children:ju(t.status)})]}),n.jsx("div",{className:"butler-follow-up-status-body",children:n.jsx("p",{children:i})}),n.jsxs("footer",{className:"butler-follow-up-status-footer",children:[n.jsx("span",{children:Ml(nu(t))}),n.jsx("button",{type:"button",className:"secondary-button butler-follow-up-status-action",onClick:()=>{e.onOpenFollowUpDetail(t.id)},children:o("shell.butlerAutomationViewRoundsAction")})]})]})}function T3(e){return n.jsxs("section",{className:"butler-side-card",children:[n.jsx("header",{children:n.jsx("h2",{children:o("shell.butlerAutomationTasksTitle")})}),e.items.length>0?n.jsx("div",{className:"butler-record-list",children:e.items.map(t=>n.jsxs("article",{className:"butler-automation-card",children:[n.jsxs("header",{className:"butler-automation-card-header",children:[n.jsxs("div",{className:"butler-automation-card-title-group",children:[n.jsx("strong",{children:t.title}),n.jsx("span",{children:t.projectName})]}),n.jsx("span",{className:"butler-automation-status-badge","data-status":"active",children:t.statusLabel})]}),n.jsxs("div",{className:"butler-automation-card-body",children:[n.jsxs("div",{className:"butler-automation-row",children:[n.jsx("span",{children:o("shell.butlerAutomationTaskTypeLabel")}),n.jsx("strong",{children:t.taskTypeLabel})]}),n.jsxs("div",{className:"butler-automation-row",children:[n.jsx("span",{children:o("shell.butlerAutomationTaskLastRunLabel")}),n.jsx("strong",{children:Ml(t.lastRunAt)})]})]}),n.jsxs("footer",{className:"butler-automation-card-footer",children:[n.jsx("span",{children:o("shell.butlerAutomationTaskNextRunLabel")}),n.jsx("strong",{children:Ml(t.nextRunAt)})]})]},t.id))}):n.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function P3(e){return n.jsxs("section",{className:"butler-side-card",children:[n.jsx("header",{children:n.jsx("h2",{children:o("shell.butlerAutomationRunsTitle")})}),e.items.length>0?n.jsx("div",{className:"butler-record-list",children:e.items.map(t=>n.jsxs("article",{className:"butler-automation-card",children:[n.jsxs("header",{className:"butler-automation-card-header",children:[n.jsxs("div",{className:"butler-automation-card-title-group",children:[n.jsx("strong",{children:t.title}),n.jsx("span",{children:t.projectName})]}),n.jsx("span",{className:"butler-automation-status-badge","data-status":"active",children:t.statusLabel})]}),n.jsxs("div",{className:"butler-automation-card-body",children:[n.jsxs("div",{className:"butler-automation-row",children:[n.jsx("span",{children:o("shell.butlerAutomationRunSourceLabel")}),n.jsx("strong",{children:t.sourceLabel})]}),n.jsxs("div",{className:"butler-automation-row",children:[n.jsx("span",{children:o("shell.butlerAutomationRunSummaryLabel")}),n.jsx("strong",{children:t.summary})]})]}),n.jsxs("footer",{className:"butler-automation-card-footer",children:[n.jsx("span",{children:o("shell.butlerAutomationRunProcessedAtLabel")}),n.jsx("strong",{children:Ml(t.createdAt)})]})]},t.id))}):n.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function D3(e){return n.jsxs("section",{className:"butler-side-card butler-settings-panel",children:[n.jsx("header",{children:n.jsx("h2",{children:o("shell.butlerSettingsTitle")})}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerDisplayNameLabel")}),n.jsx("input",{"aria-label":o("shell.butlerDisplayNameLabel"),className:"butler-form-control",value:e.settingsForm.displayName,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({displayName:t.target.value})}})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerAgentsModeLabel")}),n.jsxs("select",{"aria-label":o("shell.butlerAgentsModeLabel"),className:"butler-form-control",value:e.settingsForm.agentsMode,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({agentsMode:t.target.value})},children:[n.jsx("option",{value:"inline",children:o("shell.butlerAgentsModeInline")}),n.jsx("option",{value:"file",children:o("shell.butlerAgentsModeFile")})]}),n.jsx("small",{children:e.settingsForm.agentsMode==="file"?o("shell.butlerAgentsModeFileDescription"):o("shell.butlerAgentsModeInlineDescription")})]}),e.settingsForm.agentsMode==="file"?n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerAgentsFilePathLabel")}),n.jsx("input",{"aria-label":o("shell.butlerAgentsFilePathLabel"),className:"butler-form-control butler-settings-file-path",value:e.settingsForm.agentsFilePath,readOnly:!0,disabled:e.savingSettings})]}):null,n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerAgentsContentLabel")}),n.jsx("textarea",{"aria-label":o("shell.butlerAgentsContentLabel"),className:"butler-form-control butler-settings-agents-editor",rows:10,value:e.settingsForm.agentsContent,disabled:e.savingSettings,placeholder:o("shell.butlerAgentsContentPlaceholder"),onChange:t=>{e.onSettingsFormChange({agentsContent:t.target.value})}}),n.jsx("small",{children:o("shell.butlerAgentsContentHint")})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerPersonaToneLabel")}),n.jsxs("select",{"aria-label":o("shell.butlerPersonaToneLabel"),className:"butler-form-control",value:e.settingsForm.personaTone,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({personaTone:t.target.value})},children:[n.jsx("option",{value:"direct",children:o("shell.butlerToneDirect")}),n.jsx("option",{value:"steady",children:o("shell.butlerToneSteady")}),n.jsx("option",{value:"friendly",children:o("shell.butlerToneFriendly")})]})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerPersonaLanguageLabel")}),n.jsxs("select",{"aria-label":o("shell.butlerPersonaLanguageLabel"),className:"butler-form-control",value:e.settingsForm.personaLanguage,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({personaLanguage:t.target.value})},children:[n.jsx("option",{value:"zh-CN",children:o("shell.butlerLanguageZhCn")}),n.jsx("option",{value:"en-US",children:o("shell.butlerLanguageEnUs")}),n.jsx("option",{value:"bilingual",children:o("shell.butlerLanguageBilingual")})]})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerPersonaSummaryStyleLabel")}),n.jsxs("select",{"aria-label":o("shell.butlerPersonaSummaryStyleLabel"),className:"butler-form-control",value:e.settingsForm.personaSummaryStyle,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({personaSummaryStyle:t.target.value})},children:[n.jsx("option",{value:"brief",children:o("shell.butlerSummaryBrief")}),n.jsx("option",{value:"structured",children:o("shell.butlerSummaryStructured")}),n.jsx("option",{value:"thorough",children:o("shell.butlerSummaryThorough")})]})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerFocusRiskPreferenceLabel")}),n.jsxs("select",{"aria-label":o("shell.butlerFocusRiskPreferenceLabel"),className:"butler-form-control",value:e.settingsForm.focusRiskPreference,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({focusRiskPreference:t.target.value})},children:[n.jsx("option",{value:"conservative",children:o("shell.butlerRiskConservative")}),n.jsx("option",{value:"balanced",children:o("shell.butlerRiskBalanced")}),n.jsx("option",{value:"proactive",children:o("shell.butlerRiskProactive")})]})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerReportPriorityPresetLabel")}),n.jsxs("select",{"aria-label":o("shell.butlerReportPriorityPresetLabel"),className:"butler-form-control",value:e.settingsForm.reportPriorityPreset,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({reportPriorityPreset:t.target.value})},children:[n.jsx("option",{value:"risk-first",children:o("shell.butlerReportRiskFirst")}),n.jsx("option",{value:"blocker-first",children:o("shell.butlerReportBlockerFirst")}),n.jsx("option",{value:"verification-first",children:o("shell.butlerReportVerificationFirst")}),n.jsx("option",{value:"progress-first",children:o("shell.butlerReportProgressFirst")})]})]}),n.jsxs("label",{className:"butler-form-field",children:[n.jsx("span",{children:o("shell.butlerSummaryDebounceLabel")}),n.jsx("select",{"aria-label":o("shell.butlerSummaryDebounceLabel"),className:"butler-form-control",value:String(e.settingsForm.summaryDebounceSeconds),disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({summaryDebounceSeconds:Number(t.target.value)})},children:v3.map(t=>n.jsx("option",{value:t.value,children:o(t.labelKey)},t.value))})]}),n.jsx("div",{className:"butler-inline-actions",children:n.jsx("button",{type:"button",className:"primary-button",disabled:e.savingSettings,onClick:e.onSaveSettings,children:e.savingSettings?o("shell.butlerSettingsSaving"):o("shell.butlerSettingsSaveAction")})})]})}function R3(){return n.jsxs("section",{className:"butler-loading-panel",role:"status","aria-live":"polite",children:[n.jsxs("div",{className:"butler-loading-orb","aria-hidden":"true",children:[n.jsx("span",{className:"butler-loading-ring butler-loading-ring-primary"}),n.jsx("span",{className:"butler-loading-ring butler-loading-ring-secondary"}),n.jsx("span",{className:"butler-loading-core"})]}),n.jsxs("div",{className:"butler-loading-copy",children:[n.jsx("h1",{children:o("shell.butlerLoadingTitle")}),n.jsx("p",{children:o("shell.butlerLoadingDescription")})]})]})}function Ml(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function nu(e){return e.updatedAt||e.lastAutomationAt||e.lastCheckedAt||e.createdAt}function M3(e,t,r){const i=new Map(((r==null?void 0:r.projects)??[]).map(u=>[u.id,u.name])),a=e.map(u=>({id:`patrol-plan:${u.id}`,title:u.name,projectName:i.get(u.projectId)??u.projectId,taskTypeLabel:EC("patrol_plan",u.triggerType),statusLabel:u.enabled?o("shell.butlerAutomationTaskEnabled"):o("shell.butlerAutomationTaskDisabled"),nextRunAt:u.nextRunAt,lastRunAt:u.lastScheduledAt})),c=t.map(u=>{var d;return{id:`follow-up:${u.id}`,title:((d=u.sessionTitle)==null?void 0:d.trim())||u.projectName,projectName:u.projectName,taskTypeLabel:EC("follow_up"),statusLabel:ju(u.status),nextRunAt:u.nextCheckAt,lastRunAt:u.lastAutomationAt||u.lastCheckedAt||u.updatedAt}});return[...a,...c].sort((u,d)=>{const m=Mi(u.nextRunAt),f=Mi(d.nextRunAt);return m!==f?m===0?1:f===0?-1:m-f:Mi(d.lastRunAt)-Mi(u.lastRunAt)}).slice(0,10)}function A3(e,t){const r=new Map(((t==null?void 0:t.projects)??[]).map(c=>[c.id,c.name])),i=((t==null?void 0:t.patrols)??[]).map(c=>{var u;return{id:`patrol-run:${c.id}`,title:o("shell.butlerAutomationPatrolRunTitle"),projectName:r.get(c.projectId)??c.projectId,sourceLabel:IC("patrol_run"),statusLabel:c.status,summary:((u=c.summary)==null?void 0:u.trim())||o("shell.butlerAutomationRunEmptySummary"),createdAt:c.finishedAt||c.startedAt||c.createdAt}}),a=e.flatMap(c=>(c.rounds??[]).map(u=>{var d,m;return{id:`follow-up-round:${c.id}:${u.roundNumber}`,title:`${((d=c.sessionTitle)==null?void 0:d.trim())||c.projectName} · ${o("shell.butlerAutomationRoundLabel",{round:u.roundNumber})}`,projectName:c.projectName,sourceLabel:IC("follow_up_round"),statusLabel:ju(u.status),summary:((m=u.summary)==null?void 0:m.trim())||o("shell.butlerAutomationRunEmptySummary"),createdAt:u.createdAt}}));return[...i,...a].sort((c,u)=>Mi(u.createdAt)-Mi(c.createdAt)).slice(0,12)}function E3(e){if(e.loading)return n.jsx("p",{className:"butler-secondary-text",children:o("shell.butlerAutomationRoundLoading")});if(e.error)return n.jsx("p",{className:"butler-secondary-text",children:e.error});if(!e.task)return n.jsx("p",{className:"butler-secondary-text",children:o("shell.butlerAutomationRoundEmpty")});const t=[...e.task.rounds??[]].sort((r,i)=>Mi(i.createdAt)-Mi(r.createdAt));return n.jsxs("div",{className:"butler-follow-up-rounds",children:[n.jsxs("div",{className:"butler-follow-up-round-summary",children:[n.jsx("strong",{children:e.task.objective}),n.jsx("span",{children:o("conversation.butlerCurrentFollowUpProgress",{current:e.task.autoContinueCount,max:e.task.maxAutoContinueCount??5})})]}),t.length>0?n.jsx("div",{className:"butler-follow-up-round-list",children:t.map(r=>n.jsxs("article",{className:"butler-follow-up-round-card",children:[n.jsxs("header",{className:"butler-follow-up-round-header",children:[n.jsxs("div",{children:[n.jsx("strong",{children:o("shell.butlerAutomationRoundLabel",{round:r.roundNumber})}),n.jsx("span",{children:B3(r.kind)})]}),n.jsx("span",{children:Ml(r.createdAt)})]}),n.jsxs("div",{className:"butler-follow-up-round-body",children:[n.jsxs("p",{children:[o("shell.butlerAutomationRoundProcessedAtLabel"),":",Ml(r.createdAt)]}),n.jsxs("p",{children:[o("shell.butlerAutomationRoundStatusLabel"),":",ju(r.status)]}),r.observedRunningState?n.jsxs("p",{children:[o("shell.butlerAutomationRoundObservedStateLabel"),":",r.observedRunningState]}):null,n.jsxs("p",{children:[o("shell.butlerAutomationRoundSummaryLabel"),":",r.summary||o("conversation.butlerAnalysisEmpty")]}),r.waitingReason?n.jsxs("p",{children:[o("shell.butlerAutomationRoundWaitingReasonLabel"),":",r.waitingReason]}):null,r.continuePrompt?n.jsxs("p",{children:[o("shell.butlerAutomationRoundPromptLabel"),":",r.continuePrompt]}):null]})]},`${r.roundNumber}:${r.createdAt}`))}):n.jsx("p",{className:"butler-secondary-text",children:o("shell.butlerAutomationRoundEmpty")})]})}function I3(e){return[...e].sort((t,r)=>Mi(AC(r))-Mi(AC(t))).slice(0,5).map(t=>{var r,i;return{title:((r=t.targetRef)==null?void 0:r.trim())||t.verificationType,content:((i=t.summary)==null?void 0:i.trim())||o("shell.butlerInfoVerificationFallback",{status:t.status})}})}function L3(e){return e.slice(0,5).map(t=>({title:t.title,content:`${t.projectName} · ${O3(t.status)}`}))}function AC(e){return e.finishedAt||e.startedAt||e.createdAt}function Mi(e){if(!e)return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function F3(e){for(const[t,r]of Object.entries(ab))if(r.length===e.length&&r.every((i,a)=>i===e[a]))return t;return"risk-first"}function _3(e){var i;if((i=e.agentsFilePath)!=null&&i.trim())return e.agentsFilePath.trim();const t=e.workspacePath.includes("\\")?"\\":"/";return`${e.workspacePath.replace(/[\\/]+$/,"")}${t}AGENTS.md`}function O3(e){switch(e){case"pending":return o("shell.butlerInfoTodoPending");case"in_progress":return o("shell.butlerInfoTodoInProgress");case"closed":return o("shell.butlerInfoTodoClosed");default:return o("shell.butlerInfoTodoPending")}}function ju(e){switch(e){case"active":return o("shell.butlerAutomationStatusActive");case"waiting_user":return o("shell.butlerAutomationStatusWaitingUser");case"completed":return o("shell.butlerAutomationStatusCompleted");case"failed":return o("shell.butlerAutomationStatusFailed");case"cancelled":return o("shell.butlerAutomationStatusCancelled");default:return o("shell.butlerAutomationStatusActive")}}function B3(e){switch(e){case"started":return o("shell.butlerAutomationRoundKindStarted");case"continue":return o("shell.butlerAutomationRoundKindContinue");case"queued":return o("shell.butlerAutomationRoundKindQueued");case"waiting_user":return o("shell.butlerAutomationRoundKindWaitingUser");case"completed":return o("shell.butlerAutomationRoundKindCompleted");case"failed":return o("shell.butlerAutomationRoundKindFailed");case"cancelled":return o("shell.butlerAutomationRoundKindCancelled");case"limit_reached":return o("shell.butlerAutomationRoundKindLimitReached");default:return e}}function EC(e,t){if(e==="follow_up")return o("shell.butlerAutomationTaskTypeFollowUp");switch(t){case"interval":return o("shell.butlerAutomationTaskTypeInterval");case"cron":return o("shell.butlerAutomationTaskTypeCron");case"manual":default:return o("shell.butlerAutomationTaskTypeManual")}}function IC(e){return o(e==="patrol_run"?"shell.butlerAutomationRunSourcePatrol":"shell.butlerAutomationRunSourceFollowUp")}function W3(e){const r=`${e.displayName.trim()}:${e.providerId}:${e.tone}`,i=U3(e);if(!r)return aa.default[0];const a=Array.from(r).reduce((c,u)=>{const d=u.codePointAt(0)??0;return c+d},0);return i[a%i.length]}function U3(e){const t=e.displayName.trim().toLowerCase();return/(bot|ai|智能|助手|助理|管家|buddy|helper)/.test(t)?aa.builder:/(书|学|知|研|析|查|review|audit|scan)/.test(t)?aa.analyst:e.tone==="friendly"?aa.friendly:e.tone==="steady"?aa.steady:e.tone==="direct"?e.providerId==="claude-code"?aa.analyst:aa.direct:e.providerId==="claude-code"?aa.analyst:aa.default}function La(e,t){var r;return((r=e.find(i=>i.value===t))==null?void 0:r.label)??t}function H3(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function z3(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M12.8 5.2A5.5 5.5 0 1 0 13.5 8h-1.8A3.7 3.7 0 1 1 10.6 5l-1.4 1.4h4V2l-1.4 1.4z",fill:"currentColor"})})}function q3(e){const[t,r]=p.useState(()=>LC());return p.useEffect(()=>{if(!e){r(LC());return}const i=()=>{const a=e.getState();r({messages:a.messages,historyState:a.historyState,loadingOlderMessages:a.loadingOlderMessages,hasOlderMessages:a.hasOlderMessages,runtimeHasActiveRun:a.runtimeHasActiveRun,runtimeCanInterrupt:a.runtimeCanInterrupt,contextUsage:a.contextUsage})};return i(),e.subscribe(i)},[e]),t}function LC(){return{messages:[],historyState:"ready",loadingOlderMessages:!1,hasOlderMessages:!1,runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null}}function Ol(e){return e.flatMap(t=>[{workspace:t.workspace,label:t.workspace.name,subtitle:t.workspace.path,depth:0,kind:"workspace",meta:null},...M0(t.childWorktrees??[])])}function ua(e,t){const r=t==null?void 0:t.trim();if(!r)return null;for(const i of e){if(i.workspace.id===r)return{workspace:i.workspace,sessions:i.sessions,childWorktrees:i.childWorktrees??[],meta:null};const a=A0(i.childWorktrees??[],r);if(a)return a}return null}function M0(e){return e.flatMap(t=>[{workspace:t.workspace,label:t.meta.displayName||t.workspace.name,subtitle:t.workspace.path,depth:t.meta.depth,kind:"worktree",meta:t.meta},...M0(t.children)])}function A0(e,t){for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,sessions:r.sessions,childWorktrees:r.children,meta:r.meta};const i=A0(r.children,t);if(i)return i}return null}const $3=10080*60*1e3;function V3(e,t){return G3(e.hosts,e.activeHostId).flatMap(r=>{const i=r.id===e.activeHostId?t:K3(r.id);return[{kind:"host",host:r,workspaceCount:i.length},...i.map(a=>({kind:"workspace",host:r,workspace:a.workspace,option:a}))]})}function G3(e,t){return[...e].sort((r,i)=>{if(r.id===t)return-1;if(i.id===t)return 1;const a=r.lastConnectedAt??r.updatedAt??r.createdAt;return(i.lastConnectedAt??i.updatedAt??i.createdAt).localeCompare(a)})}function K3(e){const t=sP($3,e);return t?Ol(Gc(t)):[]}function E0({children:e,className:t,frameRef:r,...i}){return n.jsx("div",{ref:r,className:["mobile-top-header-frame",t].filter(Boolean).join(" "),...i,children:e})}function Io({currentWorkspace:e,workspaces:t,workspaceOptions:r,onSelectWorkspace:i,className:a,containerRef:c,heading:u,content:d,sheetContent:m,triggerLabel:f,triggerAriaLabel:w,onTriggerClick:g,trailing:v,gestureHandlers:y}){const[x,C]=p.useState(!1),[j,N]=p.useState(null),P=ms(),L=mr(),{showToast:Y}=Jn(),H=rm(U=>U),W=Ga(H),I=r??t.map(U=>({workspace:{...U,repoRoot:U.path},label:U.name,subtitle:U.path,depth:0,kind:"workspace",meta:null})),M=V3(H,I),O=(e==null?void 0:e.name)??(W==null?void 0:W.name)??null,F=(e==null?void 0:e.path)??(W==null?void 0:W.baseUrl)??null;if(!O)return null;async function X(U){const G=U.kind==="host"?`host:${U.host.id}`:`workspace:${U.host.id}:${U.workspace.id}`;if(!j){N(G);try{U.host.id!==H.activeHostId&&(P.trigger("selection"),await uP.switchHost(U.host.id)),U.kind==="host"?L(Ti()):(U.workspace.id!==(e==null?void 0:e.id)||U.host.id!==H.activeHostId)&&await(i==null?void 0:i(U.workspace.id)),C(!1)}catch(R){Y({title:Y3(R,U.host.name),tone:"error"})}finally{N(null)}}}return n.jsxs(n.Fragment,{children:[n.jsx(E0,{className:a,frameRef:c,...y,children:n.jsxs("section",{className:"mobile-workspace-home-header",children:[n.jsx("h1",{className:"mobile-workspace-switcher-heading",children:u??O}),n.jsxs("div",{className:"mobile-workspace-home-toolbar-top",children:[n.jsxs("button",{type:"button",className:"mobile-workspace-home-switcher","aria-label":w??o("shell.workspaceHomeSwitcherLabel"),onClick:()=>{if(g){g();return}P.trigger("selection"),C(!0)},children:[n.jsx("span",{className:"mobile-workspace-home-switcher-label",children:f??O}),n.jsx(Z3,{})]}),n.jsx("div",{className:"mobile-workspace-home-toolbar-actions",children:v})]}),F?n.jsx("p",{className:"mobile-workspace-home-path",children:F}):null,d]})}),x&&!g?Q3(n.jsxs(J3,{title:o("shell.hostWorkspaceSwitcherTitle"),onClose:()=>C(!1),children:[n.jsx("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:M.map(U=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row","data-host-entry-kind":U.kind,"data-host-active":U.host.id===H.activeHostId,"data-worktree-kind":U.kind==="workspace"?U.option.kind:void 0,"data-worktree-depth":U.kind==="workspace"?U.option.depth+1:0,disabled:j!==null,onClick:()=>{X(U)},children:[n.jsxs("div",{className:U.kind==="host"?"mobile-workspace-home-session-main mobile-host-workspace-switcher-host-main":"mobile-workspace-home-session-main",style:{"--mobile-workspace-tree-depth":String(U.kind==="host"?0:U.option.depth+1)},children:[n.jsxs("span",{className:"mobile-workspace-home-session-title",children:[U.kind==="host"?n.jsx("span",{className:"mobile-host-workspace-switcher-host-badge",children:o("shell.hostSwitcherNodeBadge")}):null,U.kind==="workspace"&&U.option.kind==="worktree"?n.jsx("span",{className:"mobile-workspace-home-worktree-badge",children:o("shell.mobileWorktreeBadge")}):null,U.kind==="host"?U.host.name:U.option.label]}),n.jsx("span",{className:"mobile-workspace-home-session-meta",children:U.kind==="host"?X3(U.host,U.workspaceCount):U.option.subtitle})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:U.kind==="host"&&U.host.id===H.activeHostId?n.jsx(FC,{}):U.kind==="workspace"&&U.workspace.id===(e==null?void 0:e.id)&&U.host.id===H.activeHostId?n.jsx(FC,{}):n.jsx(eq,{})})]},U.kind==="host"?`host-${U.host.id}`:`workspace-${U.host.id}-${U.workspace.id}`))}),m?m(()=>C(!1)):null]})):null]})}function Y3(e,t){return e instanceof zh?e.code==="HOST_UNREACHABLE"?o("shell.hostSwitchUnreachable",{name:t}):o("shell.hostSwitchMissing"):o("shell.hostSwitchFailed")}function X3(e,t){return e?e.lastUsername?o("shell.hostSwitcherWorkspaceCountWithUser",{username:e.lastUsername,count:t}):t>0?o("shell.hostSwitcherWorkspaceCount",{count:t}):e.baseUrl:""}function Q3(e){return typeof document>"u"?null:Vn.createPortal(e,document.body)}function J3({title:e,onClose:t,children:r}){return n.jsx("div",{className:"ios-action-sheet-overlay",role:"presentation",onClick:t,children:n.jsxs("div",{className:"mobile-workspace-home-sheet",role:"dialog","aria-modal":"true","aria-label":e,onClick:i=>i.stopPropagation(),children:[n.jsxs("div",{className:"mobile-workspace-home-sheet-card",children:[n.jsx("div",{className:"mobile-workspace-home-sheet-header",children:n.jsx("strong",{children:e})}),r]}),n.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:t,children:o("common.cancel")})]})})}function Z3(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function eq(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function FC(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}function tq(e){return e.status==="active"}function nq(e){return e.status==="queued"||e.status==="running"}function I0(e,t){return e.filter(tq).length+t.filter(nq).length}const L0="mobile.butler.active-tab",yh=["info","automation"],rq=15e3,iq=56,sq=1.2;function aq(){if(typeof window>"u")return"info";try{return window.localStorage.getItem(L0)==="automation"?"automation":"info"}catch{return"info"}}function oq(e,t){return e==="automation"?"automation":e==="info"?"info":t}function lq(e,t,r){if(!t)return e;const i=r.x-t.x,a=r.y-t.y;if(Math.abs(i)<iq||Math.abs(i)<Math.abs(a)*sq)return e;const c=yh.indexOf(e),u=i<0?Math.min(yh.length-1,c+1):Math.max(0,c-1);return yh[u]??e}function cq(){var F,X,U,G;const{workspaceId:e=""}=Ao(),t=hs(),r=mr(),{showToast:i}=Jn(),{navigationGroups:a,selectWorkspace:c}=Tr(),u=((F=a.find(R=>R.workspace.id===e))==null?void 0:F.workspace)??null,d=new URLSearchParams(t.search).get("tab"),m=p.useRef(aq()),f=oq(d,m.current),w=p.useRef(null),[g,v]=p.useState({loading:!0,initialized:!1,profile:null,overview:null,followUpTasks:[],inboxItems:[],patrolPlans:[]});p.useEffect(()=>{if(m.current=f,!(typeof window>"u"))try{window.localStorage.setItem(L0,f)}catch{}},[f]),p.useEffect(()=>{if(d===f)return;const R=new URLSearchParams(t.search);R.set("tab",f),r({pathname:t.pathname,search:`?${R.toString()}`},{replace:!0})},[f,t.pathname,t.search,r,d]),p.useEffect(()=>{e&&c(e)},[c,e]),p.useEffect(()=>{if(!e){v({loading:!1,initialized:!1,profile:null,overview:null,followUpTasks:[],inboxItems:[],patrolPlans:[]});return}let R=!1;async function A(D){v(T=>({...T,loading:!0}));try{const T=await mm();if(!T.initialized||!T.profile){R||v({loading:!1,initialized:!1,profile:null,overview:null,followUpTasks:[],inboxItems:[],patrolPlans:[]});return}const[B,Q,_]=await Promise.all([pm(),Yc(),Kc({workspaceId:e})]),de=B.overview.projects.filter(oe=>oe.workspaceId===e).map(oe=>oe.id),le=await Promise.all(de.map(oe=>oP(oe)));if(R)return;v({loading:!1,initialized:!0,profile:T.profile,overview:B.overview,followUpTasks:Q.items.filter(oe=>oe.workspaceId===e),inboxItems:_.items.filter(oe=>oe.status!=="closed"),patrolPlans:le.flatMap(oe=>oe.items)})}catch(T){if(R)return;v(B=>({...B,loading:!1})),D&&i({title:o("shell.butlerLoadFailed"),description:T instanceof Error?T.message:void 0,tone:"error"})}}A(!0);const Z=window.setInterval(()=>{A(!1)},rq),pe=Fw(()=>{A(!1)}),q=()=>{A(!1)};return window.addEventListener(No,q),()=>{R=!0,window.clearInterval(Z),pe(),window.removeEventListener(No,q)}},[i,e]);const y=p.useMemo(()=>{var R;return new Set((((R=g.overview)==null?void 0:R.projects)??[]).filter(A=>A.workspaceId===e).map(A=>A.id))},[(X=g.overview)==null?void 0:X.projects,e]),x=p.useMemo(()=>{var R;return(((R=g.overview)==null?void 0:R.projects)??[]).filter(A=>A.workspaceId===e)},[(U=g.overview)==null?void 0:U.projects,e]),C=p.useMemo(()=>g.followUpTasks.filter(R=>R.status==="waiting_user").length,[g.followUpTasks]),j=p.useMemo(()=>{var R;return(((R=g.overview)==null?void 0:R.verifications)??[]).filter(A=>A.projectId?y.has(A.projectId):!1)},[(G=g.overview)==null?void 0:G.verifications,y]),N=p.useMemo(()=>I0(g.followUpTasks,j),[g.followUpTasks,j]),P=p.useMemo(()=>[...g.followUpTasks].sort((R,A)=>Hs(Yf(A))-Hs(Yf(R))).slice(0,4),[g.followUpTasks]),L=p.useMemo(()=>uq(j),[j]),Y=p.useMemo(()=>dq(g.inboxItems).slice(0,4),[g.inboxItems]),H=p.useMemo(()=>hq(g.patrolPlans,g.followUpTasks,g.overview,y),[g.followUpTasks,g.overview,g.patrolPlans,y]),W=p.useMemo(()=>mq(g.followUpTasks,g.overview,y),[g.followUpTasks,g.overview,y]);function I(R){R!==f&&r(jo(e,R),{replace:!0})}function M(R){if(R.changedTouches.length!==1){w.current=null;return}const A=R.changedTouches[0];w.current={x:A.clientX,y:A.clientY}}function O(R){const A=w.current;if(w.current=null,R.changedTouches.length!==1)return;const Z=R.changedTouches[0],pe=lq(f,A,{x:Z.clientX,y:Z.clientY});pe!==f&&I(pe)}return u?n.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-butler-page",children:[n.jsx(Io,{currentWorkspace:u,workspaces:a.map(R=>R.workspace),heading:o("shell.mobileButlerEntry"),triggerLabel:u.name,onSelectWorkspace:R=>{c(R),r(jo(R,f))},content:n.jsx("div",{className:"mobile-butler-segmented-shell",children:n.jsx("div",{className:"mobile-butler-segmented-control",role:"tablist","aria-label":o("shell.mobileButlerEntry"),children:yh.map(R=>{const A=f===R,Z=o(R==="info"?"shell.butlerSidebarInfoTab":"shell.butlerSidebarAutomationTab");return n.jsx("button",{type:"button",role:"tab",className:"mobile-butler-segmented-button","aria-selected":A,onClick:()=>{I(R)},children:Z},R)})})})}),n.jsx("div",{className:"mobile-page-top-body mobile-butler-body",onTouchStart:M,onTouchEnd:O,children:g.loading?n.jsx("section",{className:"mobile-feature-panel surface-card mobile-butler-empty-panel",children:n.jsx("p",{children:o("common.loading")})}):!g.initialized||!g.profile?n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-butler-empty-panel",children:[n.jsx("h2",{children:o("shell.mobileButlerEmptyTitle")}),n.jsx("p",{children:o("shell.mobileButlerEmptyBody")})]}):f==="info"?n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-butler-hero-card",children:[n.jsxs("div",{className:"mobile-butler-hero-top",children:[n.jsx("div",{className:"mobile-butler-hero-badge",children:"AI"}),n.jsxs("div",{className:"mobile-butler-hero-copy",children:[n.jsx("strong",{children:g.profile.displayName||o("shell.mobileButlerEntry")}),n.jsx("span",{children:fq(g.profile.providerId)})]})]}),n.jsxs("div",{className:"mobile-butler-hero-grid",children:[n.jsx(qd,{label:o("shell.mobileButlerAssistantWorkspaceLabel"),value:g.profile.workspacePath}),n.jsx(qd,{label:o("shell.mobileButlerAssistantToneLabel"),value:gq(g.profile.persona.tone)}),n.jsx(qd,{label:o("shell.mobileButlerAssistantLanguageLabel"),value:bq(g.profile.persona.language)}),n.jsx(qd,{label:o("shell.mobileButlerAssistantUpdatedAtLabel"),value:Vd(g.profile.updatedAt)})]})]}),n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-butler-summary-card",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.mobileButlerSummaryTitle")})}),n.jsx("span",{className:"mobile-feature-counter",children:x.length})]}),n.jsxs("div",{className:"mobile-butler-summary-grid",children:[n.jsx($d,{label:o("shell.mobileButlerSummaryProjects"),value:x.length}),n.jsx($d,{label:o("shell.mobileButlerSummaryFollowUps"),value:N}),n.jsx($d,{label:o("shell.mobileButlerSummaryWaitingUser"),value:C}),n.jsx($d,{label:o("shell.mobileButlerSummaryInbox"),value:g.inboxItems.length})]})]}),n.jsx(vc,{title:o("shell.butlerInfoFollowUpRecordsTitle"),emptyText:o("shell.butlerInfoFollowUpRecordsEmpty"),items:P.map(R=>{var A,Z,pe;return{id:R.id,title:((A=R.sessionTitle)==null?void 0:A.trim())||R.projectName,subtitle:R.projectName,status:_w(R.status),content:((Z=R.waitingReason)==null?void 0:Z.trim())||((pe=R.lastAutomationSummary)==null?void 0:pe.trim())||R.objective,meta:Vd(Yf(R))}})}),n.jsx(vc,{title:o("shell.butlerInfoVerificationRecordsTitle"),emptyText:o("shell.butlerInfoVerificationRecordsEmpty"),items:L.map((R,A)=>({id:`${R.title}:${A}`,title:R.title,subtitle:null,status:null,content:R.content,meta:null}))}),n.jsx(vc,{title:o("shell.butlerInfoTodoRecordsTitle"),emptyText:o("shell.butlerInfoTodoRecordsEmpty"),items:Y.map((R,A)=>({id:`${R.title}:${A}`,title:R.title,subtitle:null,status:null,content:R.content,meta:null}))})]}):n.jsxs(n.Fragment,{children:[n.jsx(vc,{title:o("shell.butlerAutomationTasksTitle"),emptyText:o("shell.butlerAutomationTasksEmpty"),items:H.map(R=>({id:R.id,title:R.title,subtitle:R.projectName,status:R.statusLabel,content:`${o("shell.butlerAutomationTaskTypeLabel")} · ${R.taskTypeLabel}`,meta:`${o("shell.butlerAutomationTaskNextRunLabel")} · ${Vd(R.nextRunAt)}`}))}),n.jsx(vc,{title:o("shell.butlerAutomationRunsTitle"),emptyText:o("shell.butlerAutomationRunsEmpty"),items:W.map(R=>({id:R.id,title:R.title,subtitle:R.projectName,status:R.statusLabel,content:`${R.sourceLabel} · ${R.summary}`,meta:Vd(R.createdAt)}))})]})})]}):n.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:n.jsxs("article",{className:"mobile-feature-empty surface-card",children:[n.jsx("h1",{children:o("shell.workspaceDetailMissingTitle")}),n.jsx("p",{children:o("shell.workspaceDetailMissingBody")})]})})}function qd({label:e,value:t}){return n.jsxs("div",{className:"mobile-butler-info-metric",children:[n.jsx("span",{children:e}),n.jsx("strong",{title:t,children:t})]})}function $d({label:e,value:t}){return n.jsxs("div",{className:"mobile-butler-summary-pill",children:[n.jsx("strong",{children:t}),n.jsx("span",{children:e})]})}function vc(e){return n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-butler-record-section",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:e.title})}),n.jsx("span",{className:"mobile-feature-counter",children:e.items.length})]}),e.items.length>0?n.jsx("div",{className:"mobile-butler-record-list",children:e.items.map(t=>n.jsxs("article",{className:"mobile-butler-record-card",children:[n.jsxs("header",{className:"mobile-butler-record-header",children:[n.jsxs("div",{className:"mobile-butler-record-copy",children:[n.jsx("strong",{children:t.title}),t.subtitle?n.jsx("span",{children:t.subtitle}):null]}),t.status?n.jsx("span",{className:"mobile-butler-record-badge",children:t.status}):null]}),n.jsx("p",{children:t.content}),t.meta?n.jsx("footer",{children:t.meta}):null]},t.id))}):n.jsx("p",{className:"mobile-butler-empty-text",children:e.emptyText})]})}function uq(e){return[...e].sort((t,r)=>Hs(BC(r))-Hs(BC(t))).slice(0,4).map(t=>{var r,i;return{title:((r=t.targetRef)==null?void 0:r.trim())||t.verificationType,content:((i=t.summary)==null?void 0:i.trim())||o("shell.butlerInfoVerificationFallback",{status:t.status})}})}function dq(e){return e.map(t=>({title:t.title,content:`${t.projectName} · ${pq(t.status)}`}))}function hq(e,t,r,i){const a=new Map(((r==null?void 0:r.projects)??[]).filter(d=>i.has(d.id)).map(d=>[d.id,d.name])),c=e.filter(d=>i.has(d.projectId)).map(d=>({id:`patrol-plan:${d.id}`,title:d.name,projectName:a.get(d.projectId)??d.projectId,taskTypeLabel:_C("patrol_plan",d.triggerType),statusLabel:d.enabled?o("shell.butlerAutomationTaskEnabled"):o("shell.butlerAutomationTaskDisabled"),nextRunAt:d.nextRunAt,lastRunAt:d.lastScheduledAt})),u=t.map(d=>{var m;return{id:`follow-up:${d.id}`,title:((m=d.sessionTitle)==null?void 0:m.trim())||d.projectName,projectName:d.projectName,taskTypeLabel:_C("follow_up"),statusLabel:_w(d.status),nextRunAt:d.nextCheckAt,lastRunAt:d.lastAutomationAt||d.lastCheckedAt||d.updatedAt}});return[...c,...u].sort((d,m)=>{const f=Hs(d.nextRunAt),w=Hs(m.nextRunAt);return f!==w?f===0?1:w===0?-1:f-w:Hs(m.lastRunAt)-Hs(d.lastRunAt)}).slice(0,8)}function mq(e,t,r){const i=new Map(((t==null?void 0:t.projects)??[]).filter(u=>r.has(u.id)).map(u=>[u.id,u.name])),a=((t==null?void 0:t.patrols)??[]).filter(u=>r.has(u.projectId)).map(u=>{var d;return{id:`patrol-run:${u.id}`,title:o("shell.butlerAutomationPatrolRunTitle"),projectName:i.get(u.projectId)??u.projectId,sourceLabel:OC("patrol_run"),statusLabel:u.status,summary:((d=u.summary)==null?void 0:d.trim())||o("shell.butlerAutomationRunEmptySummary"),createdAt:u.finishedAt||u.startedAt||u.createdAt}}),c=e.flatMap(u=>(u.rounds??[]).map(d=>{var m,f;return{id:`follow-up-round:${u.id}:${d.roundNumber}`,title:`${((m=u.sessionTitle)==null?void 0:m.trim())||u.projectName} · ${o("shell.butlerAutomationRoundLabel",{round:d.roundNumber})}`,projectName:u.projectName,sourceLabel:OC("follow_up_round"),statusLabel:_w(d.status),summary:((f=d.summary)==null?void 0:f.trim())||o("shell.butlerAutomationRunEmptySummary"),createdAt:d.createdAt}}));return[...a,...c].sort((u,d)=>Hs(d.createdAt)-Hs(u.createdAt)).slice(0,10)}function pq(e){switch(e){case"pending":return o("shell.butlerInfoTodoPending");case"in_progress":return o("shell.butlerInfoTodoInProgress");case"closed":return o("shell.butlerInfoTodoClosed");default:return o("shell.butlerInfoTodoPending")}}function Yf(e){return e.updatedAt||e.lastAutomationAt||e.lastCheckedAt||e.createdAt}function _w(e){switch(e){case"active":return o("shell.butlerAutomationStatusActive");case"waiting_user":return o("shell.butlerAutomationStatusWaitingUser");case"completed":return o("shell.butlerAutomationStatusCompleted");case"failed":return o("shell.butlerAutomationStatusFailed");case"cancelled":return o("shell.butlerAutomationStatusCancelled");default:return o("shell.butlerAutomationStatusActive")}}function _C(e,t){if(e==="follow_up")return o("shell.butlerAutomationTaskTypeFollowUp");switch(t){case"interval":return o("shell.butlerAutomationTaskTypeInterval");case"cron":return o("shell.butlerAutomationTaskTypeCron");case"manual":default:return o("shell.butlerAutomationTaskTypeManual")}}function OC(e){return o(e==="patrol_run"?"shell.butlerAutomationRunSourcePatrol":"shell.butlerAutomationRunSourceFollowUp")}function BC(e){return e.finishedAt||e.startedAt||e.createdAt}function Hs(e){if(!e)return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function Vd(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function fq(e){switch(e){case"claude-code":return"Claude Code";case"codex":default:return"Codex"}}function gq(e){switch(e){case"friendly":return o("shell.butlerToneFriendly");case"steady":return o("shell.butlerToneSteady");case"direct":default:return o("shell.butlerToneDirect")}}function bq(e){switch(e){case"en-US":return o("shell.butlerLanguageEnUs");case"bilingual":return o("shell.butlerLanguageBilingual");case"zh-CN":default:return o("shell.butlerLanguageZhCn")}}function wq(){const{shellMode:e}=Tr();return e==="mobile"?n.jsx(cq,{}):n.jsx(y3,{})}function F0({connectionState:e,onReconnect:t}){const{showToast:r,dismissToast:i}=Jn();return p.useEffect(()=>{if(e==="connected"||e==="closed"){i("conversation-connection-state");return}if(e==="reconnect_failed"){r({id:"conversation-connection-state",title:o("conversation.connectionReconnectFailed"),description:o("conversation.reconnectFailedExplain"),tone:"warning",durationMs:null,action:{label:o("conversation.reconnectButton"),onClick:t}});return}r({id:"conversation-connection-state",title:o("conversation.connectionReconnecting"),description:o("conversation.reconnectExplain"),tone:"info",durationMs:3200})},[e,i,t,r]),null}const Gd="provider-default",vq=420,yq=520,kq=32;function xq(e){if(typeof document>"u")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.opacity="0",t.style.pointerEvents="none",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}async function Sq(e,t){var r;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!xq(e))throw new Error(o("conversation.copyContentFailed"))}}function Kd(e,t,r){return Math.min(Math.max(e,t),r)}function Xf(e){return e&&Ic.includes(e)?e:"codex"}function ob(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function WC(e){var r,i;const t=ob(e);return((i=(r=t==null?void 0:t.closest("[data-message-id]"))==null?void 0:r.getAttribute("data-message-id"))==null?void 0:i.trim())||null}function Cq(e,t){return[t.trim()||o("conversation.selectionActionDefaultPrompt"),"",o("conversation.selectionActionQuotedLabel"),"```text",e.trim(),"```"].join(`
|
|
107
|
-
`)}function jq({containerRef:e,session:t,currentCapabilities:r}){const i=mr(),a=pr(),{showToast:c}=Jn(),{shellMode:u,requestNavigationRefresh:d,selectWorkspace:m,upsertNavigationSession:f}=Tr(),w=Mo(he=>he.profile.providers),[g,v]=p.useState(null),[y,x]=p.useState(!1),[C,j]=p.useState(""),[N,P]=p.useState(!1),[L,Y]=p.useState(Xf(t==null?void 0:t.provider)),[H,W]=p.useState(Gd),[I,M]=p.useState(null),[O,F]=p.useState({}),[X,U]=p.useState(!1),[G,R]=p.useState(!1),[A,Z]=p.useState(!1),[pe,q]=p.useState(0),[D,T]=p.useState(null),[B,Q]=p.useState(()=>({width:typeof window>"u"?0:window.innerWidth,height:typeof window>"u"?0:window.innerHeight})),_=p.useRef(!1),de=u==="mobile"||a.isMobile,le=p.useMemo(()=>he=>{var Le,Oe;return((Oe=(Le=w[he])==null?void 0:Le.defaultModel)==null?void 0:Oe.trim())||Gd},[w]),oe=p.useMemo(()=>L===(t==null?void 0:t.provider)&&r?r:I??za(L),[r,I,L,t==null?void 0:t.provider]),ye=p.useMemo(()=>{var Le;const he=za(L).modelOptions??[];return(Le=oe.modelOptions)!=null&&Le.length?oe.modelOptions:he},[oe.modelOptions,L]),Ne=p.useMemo(()=>ye.find(he=>he.id===H)??ye[0]??null,[ye,H]),Me=p.useMemo(()=>{const he=O[L]??(L===(t==null?void 0:t.provider)?r:I);return!he||he.canStartSession!==!1?null:he.limitations[0]??o("conversation.capabilityDenied")},[r,I,O,L,t==null?void 0:t.provider]),Te=p.useMemo(()=>{var Be;if(!g||typeof window>"u")return null;const he=(Be=e.current)==null?void 0:Be.getBoundingClientRect(),Le=he?Math.max(80,he.left+80):96,Oe=he?Math.min(B.width-80,he.right-80):B.width-96,Qe=he?Math.max(12,he.top+12):12,wt=he?Math.max(Qe,he.bottom-48):Math.max(12,B.height-48),Ie=g.rect.left+g.rect.width/2;return{left:Kd(Ie,Le,Math.max(Le,Oe)),top:Kd(g.rect.top-48,Qe,wt)}},[e,g,B.height,B.width]),Dt=p.useMemo(()=>{var ct;if(!g||typeof window>"u")return null;const he=(ct=e.current)==null?void 0:ct.getBoundingClientRect(),Le=(he==null?void 0:he.left)??0,Oe=(he==null?void 0:he.right)??B.width,Qe=(he==null?void 0:he.top)??0,wt=(he==null?void 0:he.bottom)??B.height;if(de)return{left:B.width/2,top:B.height/2,width:Math.min(420,Math.max(280,B.width-24)),maxHeight:Math.max(260,B.height-kq),transform:"translate(-50%, -50%)"};const Ie=Math.max(280,Math.min(B.width-24,Oe-Le-24)),Be=Math.min(420,Ie),vt=g.rect.left+g.rect.width/2,ft=Math.max(12,Le+12),ve=Math.max(ft,Math.min(B.width-Be-12,Oe-Be-12)),Ae=Math.min(yq,Math.max(280,wt-Qe-24),Math.max(280,B.height-24)),et=Math.max(12,Qe+12),We=Math.max(et,Math.min(B.height-Ae-12,wt-Ae-12)),lt=g.rect.top-vq-18;return{left:Kd(vt-Be/2,ft,ve),top:Kd(lt,et,We),width:Be,maxHeight:Ae}},[e,de,g,B.height,B.width]);p.useEffect(()=>{if(typeof window>"u")return;const he=()=>{Q({width:window.innerWidth,height:window.innerHeight})};return he(),window.addEventListener("resize",he),()=>{window.removeEventListener("resize",he)}},[]),p.useEffect(()=>{if(!t){v(null),x(!1);return}const he=Xf(t.provider);Y(he),W(le(he))},[le,t]),p.useEffect(()=>{if(!t||!e.current||typeof window>"u"){v(null);return}const he=e.current,Le=()=>{if(_.current)return;const Qe=window.getSelection();if(!Qe||Qe.rangeCount===0||Qe.isCollapsed){v(null);return}const wt=Qe.getRangeAt(0),Ie=ob(wt.startContainer),Be=ob(wt.endContainer);if(!Ie||!Be||!he.contains(Ie)||!he.contains(Be)){v(null);return}const vt=Qe.toString().trim();if(!vt){v(null);return}const ft=wt.getBoundingClientRect();if(!ft.width&&!ft.height){v(null);return}const ve=WC(wt.startContainer),Ae=WC(wt.endContainer);v({text:vt,sourceMessageId:ve&&ve===Ae?ve:null,rect:{left:ft.left,top:ft.top,right:ft.right,bottom:ft.bottom,width:ft.width,height:ft.height}})},Oe=()=>{_.current||(v(null),x(!1))};return document.addEventListener("selectionchange",Le),window.addEventListener("resize",Oe),window.addEventListener("scroll",Oe,!0),()=>{document.removeEventListener("selectionchange",Le),window.removeEventListener("resize",Oe),window.removeEventListener("scroll",Oe,!0)}},[e,t]),p.useEffect(()=>{(!y||!(g!=null&&g.sourceMessageId))&&P(!1)},[y,g==null?void 0:g.sourceMessageId]),p.useEffect(()=>{if(!y||!t)return;let he=!1;return L===t.provider&&r?(U(!1),M(r),()=>{he=!0}):(U(!0),M(za(L)),Il(L,t.workspaceId).then(Le=>{he||M(Le)}).catch(()=>{he||M(za(L))}).finally(()=>{he||U(!1)}),()=>{he=!0})},[y,r,L,t]),p.useEffect(()=>{if(!y||!t){F({});return}let he=!1;return Zb(Ic,t.workspaceId).then(Le=>{he||F(Le)}),()=>{he=!0}},[y,t]),p.useEffect(()=>{if(!y||!t)return;const he=Ic.filter(Oe=>{const Qe=O[Oe];return!Qe||Qe.canStartSession!==!1});if(he.length===0||he.includes(L))return;const Le=he[0];Y(Le),W(le(Le))},[y,le,O,L,t]),p.useEffect(()=>{var Le;const he=le(L);if(!ye.some(Oe=>Oe.id===H)){if(ye.some(Oe=>Oe.id===he)){W(he);return}W(((Le=ye[0])==null?void 0:Le.id)??Gd)}},[ye,le,H,L]),p.useEffect(()=>{if(!y){_.current=!1;return}_.current=!0},[y]),p.useEffect(()=>{if(typeof window>"u")return;const he=Le=>{Le.key==="Escape"&&(x(!1),v(null),_.current=!1)};return window.addEventListener("keydown",he),()=>{window.removeEventListener("keydown",he)}},[]);async function st(){if(g)try{await Sq(g.text,a),c({title:o("conversation.copyContentSuccess"),tone:"success"})}catch(he){c({title:he instanceof Error?he.message:o("conversation.copyContentFailed"),tone:"error"})}}function dt(){g&&(T({title:"",content:g.text}),q(he=>he+1),Z(!0),x(!1),v(null),_.current=!1)}function bt(){if(!g||!t)return;const he=Xf(t.provider);Y(he),W(le(he)),j(""),P(!1),x(!0)}async function pt(){var he,Le,Oe,Qe;if(!(!g||!t)){if(Me){c({title:Me,tone:"error"});return}R(!0);try{const wt=Cq(g.text,C),Ie=(Ne==null?void 0:Ne.id)===Gd?null:(Ne==null?void 0:Ne.id)??null;let Be=null;if(N&&g.sourceMessageId)Be=await OT(t.sessionId,{sourceType:"message",sourceMessageId:g.sourceMessageId,strategy:"auto",targetProvider:L,sessionKind:"annotation",annotationSourceMessageId:g.sourceMessageId,annotationSourceText:g.text}),f(Be),await nw(Be.sessionId,{content:wt,clientRequestId:((Le=(he=globalThis.crypto)==null?void 0:he.randomUUID)==null?void 0:Le.call(he))??`selection-action-${Date.now()}-${Math.random().toString(16).slice(2)}`,model:Ie});else{const vt=await tw({workspaceId:t.workspaceId,provider:L,content:wt,clientRequestId:((Qe=(Oe=globalThis.crypto)==null?void 0:Oe.randomUUID)==null?void 0:Qe.call(Oe))??`selection-action-${Date.now()}-${Math.random().toString(16).slice(2)}`,model:Ie,parentSessionId:t.sessionId,sessionKind:"annotation",annotationSourceMessageId:g.sourceMessageId??null,annotationSourceText:g.text});Be=vt.session??await Jb(vt.sessionId)}f(Be),d(),m(Be.workspaceId),i(Nr(Be.workspaceId,Be.sessionId)),x(!1),v(null),_.current=!1}catch(wt){c({title:wt instanceof Error?wt.message:o("conversation.selectionActionFailed"),tone:"error"})}finally{R(!1)}}}function we(he=!1){x(!1),_.current=!1,he&&v(null)}return!t||!g||!Te||typeof document>"u"?n.jsx(Og,{open:A,preferredWorkspaceId:(t==null?void 0:t.workspaceId)??null,preferredSessionId:(t==null?void 0:t.sessionId)??null,creationRequestId:pe,initialDraft:D,onClose:()=>Z(!1)}):n.jsxs(n.Fragment,{children:[Vn.createPortal(n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"conversation-selection-toolbar",style:Te,onMouseDown:he=>he.preventDefault(),children:[n.jsx("button",{type:"button",className:"conversation-selection-action",onClick:()=>void st(),children:o("conversation.copyAction")}),n.jsx("button",{type:"button",className:"conversation-selection-action",onClick:dt,children:o("conversation.selectionTodoAction")}),n.jsx("button",{type:"button",className:"conversation-selection-action is-primary",onClick:bt,children:o("conversation.selectionActionButton")})]}),y&&Dt?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:`conversation-selection-dialog-backdrop${de?" is-mobile":""}`,onMouseDown:()=>we(!1)}),n.jsxs("div",{className:`conversation-selection-action-dialog${de?" is-centered":""}`,style:Dt,role:"dialog","aria-modal":"true","aria-label":o("conversation.selectionActionButton"),onMouseDown:he=>he.stopPropagation(),children:[n.jsxs("div",{className:"conversation-selection-action-dialog-header",children:[n.jsx("strong",{children:o("conversation.selectionActionButton")}),n.jsx("button",{type:"button",className:"conversation-selection-action-dialog-close","aria-label":o("common.close"),onClick:()=>we(!1),children:"×"})]}),n.jsx("p",{className:"conversation-selection-action-dialog-quote",children:g.text}),n.jsxs("label",{className:"conversation-selection-field",children:[n.jsx("span",{children:o("conversation.selectionActionPromptLabel")}),n.jsx("textarea",{value:C,rows:4,placeholder:o("conversation.selectionActionPromptPlaceholder"),onChange:he=>j(he.target.value)})]}),n.jsxs("label",{className:"conversation-selection-checkbox",children:[n.jsx("input",{type:"checkbox",checked:N,disabled:!g.sourceMessageId,onChange:he=>P(he.target.checked)}),n.jsx("span",{children:o("conversation.selectionActionIncludeContext")})]}),g.sourceMessageId?null:n.jsx("p",{className:"conversation-selection-hint",children:o("conversation.selectionActionContextUnavailable")}),Me?n.jsx("p",{className:"conversation-selection-hint",children:Me}):null,n.jsxs("div",{className:"conversation-selection-grid",children:[n.jsxs("label",{className:"conversation-selection-field",children:[n.jsx("span",{children:o("conversation.forkTargetProviderLabel")}),n.jsx("select",{value:L,onChange:he=>{const Le=he.target.value;Y(Le),W(le(Le))},children:Ic.map(he=>{var Le;return n.jsx("option",{value:he,disabled:((Le=O[he])==null?void 0:Le.canStartSession)===!1,children:ds(he,"full")},he)})})]}),n.jsxs("label",{className:"conversation-selection-field",children:[n.jsx("span",{children:o("conversation.forkTargetModelLabel")}),n.jsx("select",{value:H,disabled:X||!!Me,onChange:he=>W(he.target.value),children:ye.map(he=>n.jsx("option",{value:he.id,children:he.name},he.id))})]})]}),n.jsxs("div",{className:"conversation-selection-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>we(!1),children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:G||!!Me,onClick:()=>void pt(),children:o(G?"conversation.sendingState":"conversation.selectionActionSubmit")})]})]})]}):null]}),document.body),n.jsx(Og,{open:A,preferredWorkspaceId:t.workspaceId,preferredSessionId:t.sessionId,creationRequestId:pe,initialDraft:D,onClose:()=>Z(!1)})]})}const yc=5;function _0({session:e}){const{showToast:t}=Jn(),{requestNavigationRefresh:r}=Tr(),[i,a]=p.useState(!1),[c,u]=p.useState(!1),[d,m]=p.useState(null),[f,w]=p.useState(null),[g,v]=p.useState(null),[y,x]=p.useState(""),[C,j]=p.useState(""),[N,P]=p.useState(yc),[L,Y]=p.useState(!1),[H,W]=p.useState(0),I=p.useMemo(()=>{var A;return((A=e==null?void 0:e.title)==null?void 0:A.trim())||null},[e==null?void 0:e.title]),M=p.useMemo(()=>d?{workspaceId:d.workspaceId,project:d.project,session:d.session}:null,[d]),O=(d==null?void 0:d.latestFollowUpTask)??null;if(p.useEffect(()=>{a(!1),Y(!1),w(null),m(null),x(""),j(""),P(yc)},[e==null?void 0:e.sessionId]),p.useEffect(()=>{if(!(e!=null&&e.sessionId)){u(!1);return}let A=!1;return u(!0),w(null),g_(e.sessionId).then(Z=>{A||m(Z.context)}).catch(Z=>{A||(m(null),w(Z instanceof Error?Z.message:o("conversation.butlerActionLoadFailed")))}).finally(()=>{A||u(!1)}),()=>{A=!0}},[H,e==null?void 0:e.sessionId]),!(e!=null&&e.sessionId))return null;function F(){c||W(A=>A+1)}function X(){!d&&!c&&F()}async function U(){if(!M){X();return}const A=y.trim();if(!A){t({title:o("conversation.butlerFollowUpObjectiveRequired"),tone:"warning"});return}v("follow-up");try{const Z=await c_({projectId:M.project.id,butlerSessionId:M.session.id,objective:A,completionCriteria:C.trim()||void 0,maxAutoContinueCount:N});m(pe=>pe&&{...pe,latestFollowUpTask:Z.task}),r(),t({title:o("conversation.butlerFollowUpStarted"),description:o("conversation.butlerFollowUpStartedDescription",{projectName:M.project.name}),tone:"success"}),x(""),j(""),P(yc),a(!1)}catch(Z){t({title:o("conversation.butlerFollowUpFailed"),description:Z instanceof Error?Z.message:void 0,tone:"error"})}finally{v(null)}}async function G(){if(O){v("follow-up");try{const A=await u_(O.id);m(Z=>Z&&{...Z,latestFollowUpTask:A.task}),r(),t({title:o("conversation.butlerFollowUpStopped"),description:o("conversation.butlerFollowUpStoppedDescription"),tone:"success"}),a(!1)}catch(A){t({title:o("conversation.butlerFollowUpStopFailed"),description:A instanceof Error?A.message:void 0,tone:"error"})}finally{v(null)}}}async function R(){if(!M){X();return}v("verification");try{await b_({projectId:M.project.id,butlerSessionId:M.session.id,verificationType:"browser",targetRef:I||M.session.title||M.project.name}),r(),t({title:o("conversation.butlerVerificationStarted"),description:o("conversation.butlerVerificationStartedDescription",{projectName:M.project.name}),tone:"success"}),a(!1)}catch(A){t({title:o("conversation.butlerVerificationFailed"),description:A instanceof Error?A.message:void 0,tone:"error"})}finally{v(null)}}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"conversation-butler-entry",onMouseEnter:()=>{Y(!0),X()},onMouseLeave:()=>{Y(!1)},children:[n.jsx("button",{type:"button",className:"conversation-header-ai-button","aria-label":o("conversation.butlerActionButton"),title:o("conversation.butlerActionButton"),onFocus:()=>{Y(!0),X()},onBlur:()=>{Y(!1)},onClick:()=>{a(!0),X()},children:n.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:n.jsx(C2,{})})}),L?n.jsxs("div",{className:"conversation-butler-analysis-popover",role:"status","aria-live":"polite",children:[n.jsx("strong",{children:o("conversation.butlerAnalysisTitle")}),c?n.jsx("p",{children:o("conversation.butlerActionLoading")}):f?n.jsx("p",{children:f}):O?n.jsxs(n.Fragment,{children:[n.jsxs("p",{children:[o("conversation.butlerAnalysisObjectiveLabel"),":",O.objective]}),n.jsxs("p",{children:[o("conversation.butlerAnalysisStatusLabel"),":",UC(O.status)]}),n.jsxs("p",{children:[o("conversation.butlerAnalysisSummaryLabel"),":",O.lastAutomationSummary||O.waitingReason||o("conversation.butlerAnalysisEmpty")]}),O.waitingReason?n.jsxs("p",{children:[o("conversation.butlerAnalysisWaitingReasonLabel"),":",O.waitingReason]}):null]}):n.jsx("p",{children:o("conversation.butlerAnalysisEmpty")})]}):null]}),n.jsx(Ln,{open:i,title:o("conversation.butlerActionModalTitle"),description:o("conversation.butlerActionModalDescription"),onClose:()=>{g||a(!1)},children:n.jsxs("div",{className:"conversation-butler-modal",children:[c?n.jsx("p",{className:"conversation-butler-modal-hint",children:o("conversation.butlerActionLoading")}):null,!c&&f?n.jsx("p",{className:"conversation-butler-modal-error",children:f}):null,!c&&!f&&M?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"conversation-butler-target-card",children:[n.jsx("span",{children:o("conversation.butlerActionProjectLabel")}),n.jsx("strong",{children:M.project.name})]}),n.jsxs("div",{className:"conversation-butler-target-card",children:[n.jsx("span",{children:o("conversation.butlerActionSessionLabel")}),n.jsx("strong",{children:M.session.title||I||M.session.sessionId})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("conversation.butlerFollowUpObjectiveLabel")}),n.jsx("textarea",{rows:4,value:y,placeholder:o("conversation.butlerFollowUpObjectivePlaceholder"),disabled:g!==null,onChange:A=>{x(A.target.value)}})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("conversation.butlerFollowUpCompletionCriteriaLabel")}),n.jsx("textarea",{rows:3,value:C,placeholder:o("conversation.butlerFollowUpCompletionCriteriaPlaceholder"),disabled:g!==null,onChange:A=>{j(A.target.value)}})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("conversation.butlerFollowUpRoundLimitLabel")}),n.jsx("input",{type:"number",min:1,max:20,value:N,disabled:g!==null,onChange:A=>{const Z=Number.parseInt(A.target.value,10);P(Number.isFinite(Z)?Z:yc)}}),n.jsx("small",{children:o("conversation.butlerFollowUpRoundLimitHint")})]}),O&&(O.status==="active"||O.status==="waiting_user")?n.jsxs("div",{className:"conversation-butler-target-card",children:[n.jsx("span",{children:o("conversation.butlerCurrentFollowUpLabel")}),n.jsx("strong",{children:UC(O.status)}),n.jsx("small",{children:o("conversation.butlerCurrentFollowUpProgress",{current:O.autoContinueCount,max:O.maxAutoContinueCount??yc})}),n.jsx("button",{type:"button",className:"workbench-secondary-button",disabled:g!==null,onClick:()=>{G()},children:o("conversation.butlerStopFollowUpAction")})]}):null,n.jsxs("div",{className:"conversation-butler-action-grid",children:[n.jsxs("button",{type:"button",className:"conversation-butler-action-card",disabled:g!==null,onClick:()=>{U()},children:[n.jsx("strong",{children:o("conversation.butlerFollowUpAction")}),n.jsx("span",{children:o("conversation.butlerFollowUpActionDescription")})]}),n.jsxs("button",{type:"button",className:"conversation-butler-action-card",disabled:g!==null,onClick:()=>{R()},children:[n.jsx("strong",{children:o("conversation.butlerVerificationAction")}),n.jsx("span",{children:o("conversation.butlerVerificationActionDescription")})]})]})]}):null]})})]})}function UC(e){switch(e){case"waiting_user":return o("shell.butlerAutomationStatusWaitingUser");case"completed":return o("shell.butlerAutomationStatusCompleted");case"failed":return o("shell.butlerAutomationStatusFailed");case"cancelled":return o("shell.butlerAutomationStatusCancelled");case"active":default:return o("shell.butlerAutomationStatusActive")}}function Nq({session:e}){return e?n.jsx(n.Fragment,{children:n.jsx(_0,{session:e})}):null}function Tq({requests:e,replyingRequestId:t,onReply:r}){const[i,a]=p.useState({}),c=p.useMemo(()=>e.filter(u=>u.status==="pending"),[e]);return c.length===0?null:n.jsxs("section",{className:"permission-request-list",children:[n.jsxs("div",{className:"permission-request-list-header",children:[n.jsx("div",{children:n.jsx("strong",{children:o("conversation.permissionRequestSectionTitle")})}),n.jsx("span",{className:"permission-request-count",children:c.length})]}),n.jsx("div",{className:"permission-request-stack",children:c.map(u=>{var v,y;const d=i[u.id]??{},m=u.paths.filter(Boolean),f=u.kind==="command"&&!!((v=u.command)!=null&&v.trim()),w=u.questions.length===0&&m.length===0&&!f&&!!((y=u.summary)!=null&&y.trim()),g=u.kind==="user_input"&&u.questions.some(x=>{var C;return(((C=d[x.id])==null?void 0:C.filter(Boolean).length)??0)===0});return n.jsxs("article",{className:"permission-request-card",children:[n.jsxs("header",{className:"permission-request-card-header",children:[n.jsxs("div",{className:"permission-request-provider",children:[n.jsx("span",{className:"permission-request-provider-icon","aria-hidden":"true",children:n.jsx("img",{src:VT(u.provider),alt:"",loading:"lazy"})}),n.jsxs("div",{className:"permission-request-provider-copy",children:[n.jsx("strong",{children:u.title}),n.jsx("span",{children:ds(u.provider,"full")})]})]}),n.jsx("span",{className:"permission-request-kind",children:Pq(u.kind)})]}),n.jsxs("div",{className:"permission-request-card-body",children:[m.length>0?n.jsx("div",{className:"permission-request-block",children:n.jsx("ul",{className:"permission-request-target-list",children:m.map(x=>n.jsxs("li",{className:"permission-request-target-item",children:[n.jsx("strong",{children:Dq(x)}),n.jsx("span",{children:x})]},`${u.id}:${x}`))})}):null,f?n.jsxs("div",{className:"permission-request-block",children:[n.jsx("div",{className:"permission-request-block-label",children:o("conversation.permissionRequestCommandLabel")}),n.jsx("pre",{children:u.command})]}):null,w?n.jsx("p",{className:"permission-request-summary",children:u.summary}):null,u.questions.length>0?n.jsxs("div",{className:"permission-request-block",children:[n.jsx("div",{className:"permission-request-block-label",children:o("conversation.permissionRequestQuestionsLabel")}),n.jsx("div",{className:"permission-request-question-list",children:u.questions.map(x=>n.jsxs("div",{className:"permission-request-question",children:[n.jsx("div",{className:"permission-request-question-header",children:x.header}),n.jsx("p",{children:x.question}),n.jsx("div",{className:"permission-request-question-options",children:x.options.map(C=>{var N;const j=((N=d[x.id])==null?void 0:N.includes(C.label))??!1;return n.jsxs("label",{className:"permission-request-question-option",children:[n.jsx("input",{type:"radio",name:`${u.id}:${x.id}`,checked:j,onChange:()=>{a(P=>({...P,[u.id]:{...P[u.id]??{},[x.id]:[C.label]}}))}}),n.jsxs("span",{children:[n.jsx("strong",{children:C.label}),C.description?n.jsx("small",{children:C.description}):null]})]},`${x.id}:${C.label}`)})})]},x.id))})]}):null]}),n.jsx("footer",{className:"permission-request-card-footer",children:u.actions.map(x=>n.jsx("button",{type:"button",className:`permission-request-action permission-request-action-${x.tone}`,disabled:t===u.id||x.value==="submit"&&g,onClick:()=>void r(u.id,{action:x.value,answers:u.kind==="user_input"?d:void 0}),children:t===u.id?o("conversation.permissionRequestSubmitting"):x.label},`${u.id}:${x.value}`))})]},u.id)})})]})}function Pq(e){return o(e==="command"?"conversation.permissionRequestKindCommand":e==="file_change"?"conversation.permissionRequestKindFileChange":e==="permissions"?"conversation.permissionRequestKindPermissions":e==="user_input"?"conversation.permissionRequestKindUserInput":"conversation.permissionRequestKindToolCall")}function Dq(e){return e.split(/[/\\]+/).filter(Boolean).at(-1)??e}function Rq({items:e,deletingQueueItemId:t=null,steeringQueueItemId:r=null,canSteer:i=!1,onDelete:a,onSteer:c}){return e.length===0?null:n.jsxs("section",{className:"queued-message-list","aria-label":o("conversation.queueTitle"),children:[n.jsx("div",{className:"queued-message-list__header",children:n.jsx("h2",{children:`${o("conversation.queueTitle")} · ${e.length}`})}),n.jsx("div",{className:"queued-message-list__items",children:e.map((u,d)=>{const m=u.status==="queued"||u.status==="failed",f=i&&typeof c=="function"&&u.status==="queued";return n.jsxs("article",{className:"queued-message-item",children:[n.jsxs("div",{className:"queued-message-item__main",children:[n.jsx("span",{className:"queued-message-item__order","aria-hidden":"true",children:d+1}),n.jsx("p",{className:"queued-message-item__content",title:u.content||o("conversation.queueImageOnly"),children:u.content||o("conversation.queueImageOnly")}),n.jsx("span",{className:`queued-message-item__status queued-message-item__status--${u.status}`,children:u.status==="failed"?o("conversation.queueStatusFailed"):o("conversation.queueStatusQueued")}),n.jsxs("div",{className:"queued-message-item__actions",children:[f?n.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--steer",onClick:()=>void c(u.id),disabled:r===u.id,"aria-label":o("conversation.queueSteer"),title:o("conversation.queueSteer"),children:r===u.id?o("conversation.queueSteering"):o("conversation.queueSteer")}):null,m?n.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--delete",onClick:()=>void a(u.id),disabled:t===u.id,"aria-label":o("conversation.queueDelete"),title:o("conversation.queueDelete"),children:t===u.id?"…":"×"}):null]})]}),u.errorDetail?n.jsx("p",{className:"queued-message-item__error",children:u.errorDetail}):null]},u.id)})})]})}const Cl=196,ko=82,HC=28,zC=24,O0=34,lb=18,Mq=332,Yd=360,Jh=840,Aq=520,qC=18,Eq=.22,Iq=2.4,Lq=6;function Fq(e,t){return(t.lastMessageAt??t.updatedAt).localeCompare(e.lastMessageAt??e.updatedAt)}function B0(e,t,r){var y,x;if(!t)return null;const i=e.find(C=>C.workspace.id===t);if(!i)return null;const a=new Map(i.sessions.map(C=>[C.sessionId,C])),c=a.get(r)??null;if(!c)return null;const u=new Map;for(const C of i.sessions){const j=((y=C.parentSessionId)==null?void 0:y.trim())||null;if(!j)continue;const N=u.get(j)??[];u.set(j,[...N,C.sessionId])}const d=new Set,m=new Set;let f=c,w=c.sessionId;for(;f&&!m.has(f.sessionId);){d.add(f.sessionId),m.add(f.sessionId),w=f.sessionId;const C=((x=f.parentSessionId)==null?void 0:x.trim())||null;f=C?a.get(C)??null:null}const g=W0(w,0,a,u,new Set),v=Oq(g);return{root:g,current:c,currentPathIds:d,relatedSessionIds:v,sessionsById:a}}function _q(e){return((e==null?void 0:e.relatedSessionIds.size)??0)>1}function W0(e,t,r,i,a){const c=r.get(e);if(!c)throw new Error(`Session ${e} not found`);const u=new Set(a);u.add(e);const d=[...i.get(e)??[]].filter(m=>!u.has(m)).sort((m,f)=>{const w=r.get(m),g=r.get(f);return!w||!g?0:Fq(w,g)});return{session:c,depth:t,children:d.map(m=>W0(m,t+1,r,i,u))}}function Oq(e){const t=new Set;function r(i){t.add(i.session.sessionId),i.children.forEach(r)}return r(e),t}function U0(e){const t=Vc(e),r=e.lastMessageAt??e.updatedAt,i=r?new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(r)):null;return[ds(e.provider),i,t].filter(Boolean).join(" · ")}function H0(e){return e.isArchived===!0}function Bq(e){return[...e].sort((t,r)=>t.sequence-r.sequence).filter(t=>t.content.trim().length>0||t.kind==="tool_call"||t.kind==="tool_result")}function Wq(e,t){return e<=0||t<=0?1:Math.min(1,e/t)}function cb(e,t,r){return Math.min(r,Math.max(t,e))}function Uq(e,t,r,i){if(e<=0||t<=0||r<=0||i<=0)return 1;const a=Math.max(1,e-qC*2),c=Math.max(1,t-qC*2);return Math.min(1,a/r,c/i)}function Zh(e,t,r,i,a){const c=i*e.scale,u=a*e.scale,d=(t-c)/2,m=(r-u)/2,f=c<=t?d:cb(e.offsetX,t-c,0),w=u<=r?m:cb(e.offsetY,r-u,0);return{scale:e.scale,offsetX:f,offsetY:w}}function Xd(e,t,r,i){const a=Uq(e,t,r,i);return Zh({scale:a,offsetX:(e-r*a)/2,offsetY:(t-i*a)/2},e,t,r,i)}function Hq(e,t,r,i,a,c,u,d){const m=(r-e.offsetX)/e.scale,f=(i-e.offsetY)/e.scale;return Zh({scale:t,offsetX:r-m*t,offsetY:i-f*t},a,c,u,d)}function zq(e){var r;const t=e.content.trim();if(t.length>0){const i=t.replace(/\s+/g," ").trim();return i.length<=160?i:`${i.slice(0,157)}...`}return(r=e.toolCall)!=null&&r.name?`${e.toolCall.name} ${o("conversation.branchTreeToolMessageFallback")}`:o("conversation.branchTreeMessageEmpty")}function qq(e){switch(e.role){case"assistant":return o("conversation.roleAssistant");case"system":return o("conversation.roleSystem");case"tool":return o("conversation.roleTool");case"user":default:return o("conversation.roleUser")}}function ub(e,t){const r=t.get(e.session.sessionId);if(r!==void 0)return r;if(e.children.length===0)return t.set(e.session.sessionId,Cl),Cl;const i=e.children.reduce((c,u,d)=>{const m=c+ub(u,t);return d===0?m:m+lb},0),a=Math.max(Cl,i);return t.set(e.session.sessionId,a),a}function $q(e){const t=new Map,r=[],i=new Map;function a(d,m,f){const w=ub(d,t),g=m+w/2,v=zC+f*(ko+O0),y=g-Cl/2,x=d.children.reduce((P,L,Y)=>{const H=P+ub(L,t);return Y===0?H:H+lb},0);let C=m+Math.max(0,(w-x)/2);const j=d.children.map(P=>{const L=a(P,C,f+1);return C+=L.subtreeWidth+lb,L}),N={node:d,children:j,x:y,y:v,centerX:g,centerY:v+ko/2,subtreeWidth:w};return r.push(N),i.set(d.session.sessionId,N),N}const c=a(e,HC,0),u=r.reduce((d,m)=>Math.max(d,m.y+ko),0);return{root:c,nodes:r,bySessionId:i,width:c.subtreeWidth+HC*2,height:u+zC}}function Vq(e){return Math.max(0,Math.min(255,Number.parseFloat(e)))}function Gq(e){const t=e.trim();if(t.startsWith("#")){const i=t.slice(1);if(i.length===3){const[a,c,u]=i.split("").map(d=>Number.parseInt(d.repeat(2),16));return{r:a,g:c,b:u}}if(i.length>=6)return{r:Number.parseInt(i.slice(0,2),16),g:Number.parseInt(i.slice(2,4),16),b:Number.parseInt(i.slice(4,6),16)}}const r=t.match(/rgba?\(([^)]+)\)/i);if(r){const[i,a,c]=r[1].split(",").map(u=>Vq(u));return{r:i,g:a,b:c}}return null}function sa(e,t,r){const i=Gq(e);return i?`rgba(${i.r}, ${i.g}, ${i.b}, ${t})`:r}function Kq(e,t,r,i,a,c){const u=e.getContext("2d");if(!u)return;const d=u,m=window.devicePixelRatio||1;e.width=Math.max(1,Math.floor(t.width*m)),e.height=Math.max(1,Math.floor(t.height*m)),e.style.width=`${t.width}px`,e.style.height=`${t.height}px`,d.setTransform(m,0,0,m,0,0),d.clearRect(0,0,t.width,t.height);const f=window.getComputedStyle(e),w=f.getPropertyValue("--accent").trim()||"#3b82f6",g=f.getPropertyValue("--border-primary").trim()||"#d4d8df",v=f.getPropertyValue("--bg-surface").trim()||"#ffffff";if(!c){const x=d.createLinearGradient(0,0,t.width,t.height);x.addColorStop(0,sa(v,.38,"rgba(255, 255, 255, 0.38)")),x.addColorStop(1,sa(w,.05,"rgba(59, 130, 246, 0.05)")),d.fillStyle=x,d.fillRect(0,0,t.width,t.height)}function y(x){for(const C of x.children){const j=i.has(x.node.session.sessionId)&&i.has(C.node.session.sessionId),N=x.node.session.sessionId===a||C.node.session.sessionId===a;d.beginPath(),d.moveTo(x.centerX,x.y+ko-10);const P=x.y+ko+O0*.52;d.bezierCurveTo(x.centerX,P,C.centerX,P,C.centerX,C.y+10),d.lineWidth=N?3:j?2.5:1.5,d.strokeStyle=N?sa(w,.52,"rgba(59, 130, 246, 0.52)"):j?sa(w,.32,"rgba(59, 130, 246, 0.32)"):sa(g,.72,"rgba(148, 163, 184, 0.72)"),d.stroke(),d.beginPath(),d.arc(C.centerX,C.y,N?4.5:3.5,0,Math.PI*2),d.fillStyle=N?sa(w,.9,"rgba(59, 130, 246, 0.9)"):sa(g,.78,"rgba(148, 163, 184, 0.78)"),d.fill(),y(C)}}y(t.root);for(const x of t.nodes){const C=x.node.session.sessionId===r,j=x.node.session.sessionId===a,N=i.has(x.node.session.sessionId);if(!C&&!j&&!N)continue;const P=d.createRadialGradient(x.centerX,x.centerY,10,x.centerX,x.centerY,j?90:64);P.addColorStop(0,sa(w,j?.22:.14,"rgba(59, 130, 246, 0.22)")),P.addColorStop(1,"rgba(59, 130, 246, 0)"),d.fillStyle=P,d.beginPath(),d.ellipse(x.centerX,x.centerY,Cl*.72,ko*.9,0,0,Math.PI*2),d.fill(),(j||C)&&(d.beginPath(),d.arc(x.centerX,x.y+12,j?6:5,0,Math.PI*2),d.fillStyle=sa(w,.94,"rgba(59, 130, 246, 0.94)"),d.fill())}}function Yq(e,t,r){const i=Math.min(Mq,t-24),a=e.left+e.width/2-i/2,c=Math.max(12,Math.min(t-i-12,a)),m=r-e.bottom-12<220&&e.top>Yd?Math.max(12,e.top-Yd-12):Math.max(12,Math.min(r-Yd-12,e.bottom+12));return{width:i,left:c,top:m,maxHeight:Math.min(Yd,r-24)}}function Xq({model:e,selectedSession:t,selectedTreeNode:r,previewEntry:i,onClose:a,onOpenSession:c}){const u=Vs(t.title,o("common.unknown")),d=t.sessionId===e.current.sessionId,m=H0(t),f=vu(r.session),w=iw(r.session),g=sw(r.session),v=QT(r.session);return n.jsxs("div",{className:"conversation-branch-preview-popover",role:"dialog","aria-label":`${o("conversation.branchTreePreviewTitle")} ${u.fullTitle}`,children:[n.jsxs("div",{className:"conversation-branch-preview-popover-header",children:[n.jsxs("div",{className:"conversation-branch-preview-card-title-row",children:[n.jsx("strong",{title:u.fullTitle,children:u.displayTitle}),d?n.jsx("span",{className:"conversation-branch-current-badge",children:o("conversation.branchTreeCurrentBadge")}):null,m?n.jsx("span",{className:"conversation-branch-archived-badge",children:o("conversation.branchTreeArchivedBadge")}):null]}),n.jsx("button",{type:"button",className:"conversation-branch-preview-close","aria-label":o("common.close"),onClick:a,children:"x"})]}),n.jsx("p",{className:"conversation-branch-preview-popover-meta",children:U0(t)}),w&&f||v&&g?n.jsxs("div",{className:"conversation-branch-badge-row",children:[v&&g?n.jsx("span",{className:`session-fork-badge ${g}`,children:v}):null,w&&f?n.jsx("span",{className:`session-fork-badge ${f}`,children:w}):null]}):null,n.jsx("div",{className:"conversation-branch-preview-messages",children:i.status==="loading"?n.jsx("p",{className:"conversation-branch-empty",children:o("conversation.branchTreePreviewLoading")}):i.status==="error"?n.jsx("p",{className:"conversation-branch-empty",children:i.error||o("conversation.branchTreePreviewFailed")}):i.messages.length>0?i.messages.map(y=>n.jsxs("article",{className:"conversation-branch-preview-message",children:[n.jsxs("div",{className:"conversation-branch-preview-message-meta",children:[n.jsx("span",{children:qq(y)}),n.jsx("span",{children:new Intl.DateTimeFormat(void 0,{hour:"2-digit",minute:"2-digit"}).format(new Date(y.timestamp))})]}),n.jsx("p",{children:zq(y)})]},`${t.sessionId}:${y.messageId}`)):n.jsx("p",{className:"conversation-branch-empty",children:o("conversation.branchTreePreviewEmpty")})}),n.jsx("div",{className:"conversation-branch-preview-actions",children:n.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:()=>c(t),children:o(d?"conversation.branchTreeCurrentAction":"conversation.branchTreeSwitchAction")})})]})}function Qq({layout:e,model:t,selectedSessionId:r,onSelectSession:i,onBackgroundClick:a,stageScale:c,transform:u,isMobileViewport:d,viewportRef:m,onRegisterNodeElement:f,onViewportTouchStart:w,onViewportTouchMove:g,onViewportTouchEnd:v}){const y=p.useRef(null);return p.useEffect(()=>{const x=y.current;x&&Kq(x,e,t.current.sessionId,t.currentPathIds,r,d)},[d,e,t.current.sessionId,t.currentPathIds,r]),n.jsx("div",{ref:m,className:"conversation-branch-canvas-viewport","data-scaled":c<.999,"data-mobile":d,onClick:x=>{x.target===x.currentTarget&&(a==null||a())},onTouchStart:w,onTouchMove:g,onTouchEnd:v,onTouchCancel:v,children:n.jsx("div",{className:"conversation-branch-canvas-stage-shell",style:{width:d?"100%":e.width*c,height:d?"100%":e.height*c},onClick:x=>{x.target===x.currentTarget&&(a==null||a())},children:n.jsxs("div",{className:"conversation-branch-canvas-stage",style:{width:e.width,height:e.height,transform:u?`translate(${u.offsetX}px, ${u.offsetY}px) scale(${u.scale})`:`scale(${c})`,transformOrigin:"top left"},onClick:()=>{if(a){a();return}i(null)},children:[n.jsx("canvas",{ref:y,className:"conversation-branch-canvas",width:e.width,height:e.height,"aria-hidden":"true"}),e.nodes.map(x=>{const C=Vs(x.node.session.title,o("common.unknown")),j=vu(x.node.session),N=iw(x.node.session),P=sw(x.node.session),L=QT(x.node.session),Y=x.node.session.sessionId===t.current.sessionId,H=x.node.session.sessionId===r,W=t.currentPathIds.has(x.node.session.sessionId),I=H0(x.node.session);return n.jsx("button",{ref:M=>f(x.node.session.sessionId,M),type:"button",className:"conversation-branch-smart-card conversation-branch-canvas-node","data-current":Y,"data-selected":H,"data-current-path":W,"data-archived":I,style:{left:x.x,top:x.y,width:Cl,minHeight:ko},"aria-pressed":H,onClick:M=>{M.stopPropagation(),i(x.node.session.sessionId)},children:n.jsxs("div",{className:"conversation-branch-smart-card-main",children:[n.jsxs("div",{className:"conversation-branch-smart-card-title-row",children:[n.jsx("strong",{title:C.fullTitle,children:C.displayTitle}),Y?n.jsx("span",{className:"conversation-branch-current-badge",children:o("conversation.branchTreeCurrentBadge")}):null,I?n.jsx("span",{className:"conversation-branch-archived-badge",children:o("conversation.branchTreeArchivedBadge")}):null]}),n.jsx("p",{children:U0(x.node.session)}),N&&j||L&&P?n.jsxs("div",{className:"conversation-branch-badge-row",children:[L&&P?n.jsx("span",{className:`session-fork-badge ${P}`,children:L}):null,N&&j?n.jsx("span",{className:`session-fork-badge ${j}`,children:N}):null]}):null]})},x.node.session.sessionId)})]})})})}function Jq({model:e,onOpenSession:t,onClose:r,dialogLabel:i,dialogStyle:a,showResizeHandle:c,onBeginResize:u}){const d=p.useMemo(()=>$q(e.root),[e.root]),m=p.useRef(null),f=p.useRef(new Map),[w,g]=p.useState(null),[v,y]=p.useState(0),[x,C]=p.useState(0),[j,N]=p.useState(null),[P,L]=p.useState({}),Y=p.useRef(new Set),[H,W]=p.useState(typeof window<"u"?window.innerWidth<=Jh:!1),[I,M]=p.useState(null),O=p.useRef({mode:"idle",startDistance:0,startScale:1,startOffsetX:0,startOffsetY:0,startTouchX:0,startTouchY:0,anchorX:0,anchorY:0,moved:!1});p.useEffect(()=>{const D=m.current;if(!D)return;const T=D;function B(){y(T.clientWidth),C(T.clientHeight),W(window.innerWidth<=Jh)}if(B(),typeof ResizeObserver>"u")return window.addEventListener("resize",B),()=>window.removeEventListener("resize",B);const Q=new ResizeObserver(B);return Q.observe(D),()=>Q.disconnect()},[]),p.useEffect(()=>{g(null)},[e.current.sessionId,e.root.session.sessionId]);const F=p.useMemo(()=>Wq(v,d.width),[v,d.width]);p.useEffect(()=>{if(!H||v<=0||x<=0){M(null);return}M(D=>D?Zh(D,v,x,d.width,d.height):Xd(v,x,d.width,d.height))},[x,v,H,d.height,d.width]);const X=w?e.sessionsById.get(w)??null:null,U=X?d.bySessionId.get(X.sessionId)??null:null,G=X?P[X.sessionId]??{status:"idle",messages:[],error:null}:null,R=H&&!!r;p.useEffect(()=>{if(!w){N(null);return}const D=w;function T(){const B=f.current.get(D);if(!B){N(null);return}N(B.getBoundingClientRect())}return T(),window.addEventListener("resize",T),window.addEventListener("scroll",T,!0),()=>{window.removeEventListener("resize",T),window.removeEventListener("scroll",T,!0)}},[w,F]),p.useEffect(()=>{if(!H)return;const D=w;if(!D)return;const T=window.requestAnimationFrame(()=>{const B=f.current.get(D);B&&N(B.getBoundingClientRect())});return()=>window.cancelAnimationFrame(T)},[H,I,w]),p.useEffect(()=>{if(!(X!=null&&X.sessionId)||(G==null?void 0:G.status)==="ready"||Y.current.has(X.sessionId))return;let D=!1;return Y.current.add(X.sessionId),L(T=>{var B;return{...T,[X.sessionId]:{status:"loading",messages:((B=T[X.sessionId])==null?void 0:B.messages)??[],error:null}}}),ew(X.sessionId,null,6,"backward").then(T=>{Y.current.delete(X.sessionId),!D&&L(B=>({...B,[X.sessionId]:{status:"ready",messages:Bq(T.messages),error:null}}))}).catch(T=>{Y.current.delete(X.sessionId),!D&&L(B=>{var Q;return{...B,[X.sessionId]:{status:"error",messages:((Q=B[X.sessionId])==null?void 0:Q.messages)??[],error:T instanceof Error?T.message:o("conversation.branchTreePreviewFailed")}}})}),()=>{D=!0}},[X==null?void 0:X.sessionId]);function A(D){!H||v<=0||x<=0||M(T=>{const B=T??Xd(v,x,d.width,d.height);return Zh(D(B),v,x,d.width,d.height)})}function Z(D){if(!H)return;const T=D.currentTarget.getBoundingClientRect();if(D.touches.length>=2){const _=D.touches[0],de=D.touches[1],le=Math.hypot(de.clientX-_.clientX,de.clientY-_.clientY),oe=(_.clientX+de.clientX)/2-T.left,ye=(_.clientY+de.clientY)/2-T.top,Ne=I??Xd(v,x,d.width,d.height);O.current={mode:"pinch",startDistance:le,startScale:Ne.scale,startOffsetX:Ne.offsetX,startOffsetY:Ne.offsetY,startTouchX:oe,startTouchY:ye,anchorX:oe,anchorY:ye,moved:!1};return}const B=D.touches[0],Q=I??Xd(v,x,d.width,d.height);O.current={mode:"pan",startDistance:0,startScale:Q.scale,startOffsetX:Q.offsetX,startOffsetY:Q.offsetY,startTouchX:B.clientX,startTouchY:B.clientY,anchorX:0,anchorY:0,moved:!1}}function pe(D){if(!H)return;const T=O.current;if(D.touches.length>=2){const le=D.currentTarget.getBoundingClientRect(),oe=D.touches[0],ye=D.touches[1],Ne=Math.hypot(ye.clientX-oe.clientX,ye.clientY-oe.clientY);if(Ne<=0||T.startDistance<=0)return;D.preventDefault();const Me=(oe.clientX+ye.clientX)/2-le.left,Te=(oe.clientY+ye.clientY)/2-le.top,Dt=cb(T.startScale*(Ne/T.startDistance),Eq,Iq);O.current={...T,mode:"pinch",moved:!0,anchorX:Me,anchorY:Te},A(st=>Hq({...st,scale:T.startScale,offsetX:T.startOffsetX,offsetY:T.startOffsetY},Dt,Me,Te,v,x,d.width,d.height));return}if(T.mode!=="pan"||D.touches.length!==1)return;const B=D.touches[0],Q=B.clientX-T.startTouchX,_=B.clientY-T.startTouchY;(T.moved||Math.hypot(Q,_)>=Lq)&&(D.preventDefault(),O.current={...T,moved:!0},A(le=>({...le,offsetX:T.startOffsetX+Q,offsetY:T.startOffsetY+_})))}function q(){O.current={mode:"idle",startDistance:0,startScale:(I==null?void 0:I.scale)??1,startOffsetX:(I==null?void 0:I.offsetX)??0,startOffsetY:(I==null?void 0:I.offsetY)??0,startTouchX:0,startTouchY:0,anchorX:0,anchorY:0,moved:!1}}return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:`conversation-branch-tree-pane${r?" conversation-branch-dialog":""}${R?" conversation-branch-dialog-mobile-bare":""}`,role:r?"dialog":void 0,"aria-modal":r?"true":void 0,"aria-label":i,style:a,children:[R?null:n.jsx("div",{className:"conversation-branch-tree-pane-header",children:n.jsxs("div",{className:"conversation-branch-tree-pane-topbar",children:[n.jsxs("div",{className:"conversation-branch-tree-pane-heading",children:[n.jsx("h3",{children:o("conversation.branchTreeMapTitle")}),n.jsx("p",{children:o("conversation.branchTreeMapDescription")})]}),r?n.jsx("button",{type:"button",className:"conversation-branch-pane-close","aria-label":o("common.close"),onClick:r,children:"x"}):null]})}),n.jsxs("div",{className:"conversation-branch-canvas-shell",children:[R?n.jsx("button",{type:"button",className:"conversation-branch-pane-close conversation-branch-mobile-floating-close","aria-label":o("common.close"),onClick:r,children:"x"}):null,R?null:n.jsx("div",{className:"conversation-branch-canvas-tip",children:o("conversation.branchTreePreviewDescription")}),n.jsx(Qq,{layout:d,model:e,selectedSessionId:w,onSelectSession:g,onBackgroundClick:R?r:void 0,stageScale:F,transform:H?I:null,isMobileViewport:H,viewportRef:m,onRegisterNodeElement:(D,T)=>{if(T){f.current.set(D,T);return}f.current.delete(D)},onViewportTouchStart:Z,onViewportTouchMove:pe,onViewportTouchEnd:q})]}),c?n.jsx("div",{className:"conversation-branch-dialog-resizer",role:"separator","aria-orientation":"vertical","aria-label":o("conversation.branchTreeResizeHandle"),onMouseDown:D=>u==null?void 0:u(D.clientX)}):null]}),X&&U&&G&&j&&typeof document<"u"?Vn.createPortal(n.jsx("div",{className:"conversation-branch-preview-floating",style:Yq(j,window.innerWidth,window.innerHeight),children:n.jsx(Xq,{model:e,selectedSession:X,selectedTreeNode:U.node,previewEntry:G,onClose:()=>g(null),onOpenSession:t})}),document.body):null]})}function Zq({open:e,navigationGroups:t,workspaceId:r,sessionId:i,onClose:a,onOpenSession:c}){const u=p.useMemo(()=>B0(t,r,i),[t,i,r]),[d,m]=p.useState(null),[f,w]=p.useState(typeof window<"u"?window.innerWidth>Jh:!0);function g(C){const j=Math.max(420,C-32),N=Math.min(Aq,j),P=Math.min(Math.max(C*.5,N),j);return{minWidth:N,maxWidth:j,defaultWidth:P}}p.useEffect(()=>{if(!e)return;function C(j){j.key==="Escape"&&a()}return window.addEventListener("keydown",C),()=>window.removeEventListener("keydown",C)},[a,e]),p.useEffect(()=>{if(typeof window>"u")return;function C(){const j=window.innerWidth>Jh;if(w(j),!j){m(null);return}const N=g(window.innerWidth);m(P=>P===null?N.defaultWidth:Math.min(N.maxWidth,Math.max(N.minWidth,P)))}return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);function v(C){if(typeof window>"u"||!f)return;const j=g(window.innerWidth),N=d??j.defaultWidth;function P(Y){const H=Y.clientX-C;m(Math.min(j.maxWidth,Math.max(j.minWidth,N+H)))}function L(){document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",L)}document.addEventListener("mousemove",P),document.addEventListener("mouseup",L)}if(!e||!u||typeof document>"u")return null;const y=g(window.innerWidth),x=f?d??y.defaultWidth:void 0;return Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer conversation-branch-panel-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:a}),n.jsx(Jq,{model:u,onOpenSession:c,onClose:a,dialogLabel:o("conversation.branchTreeTitle"),dialogStyle:x?{width:x,maxWidth:y.maxWidth,minWidth:y.minWidth}:void 0,showResizeHandle:f,onBeginResize:v})]}),document.body)}function e$(e){const t=e.trim().length;return t<=16?"xl":t<=26?"lg":t<=38?"md":"sm"}function z0({session:e,actions:t,workspaceContext:r=null}){const i=pr(),a=p.useCallback(d=>{!i.isDesktop||i.ui.osFamily!=="macos"||d.button!==0||Kb(d.target)&&Yb()},[i.isDesktop,i.ui.osFamily]);if(!e)return n.jsxs("header",{className:"conversation-header conversation-header-skeleton","aria-hidden":"true","data-window-drag-handle":"conversation-header",onMouseDownCapture:a,children:[n.jsxs("div",{className:"conversation-header-main",children:[n.jsx("span",{className:"skeleton-line short"}),n.jsx("span",{className:"skeleton-line long"})]}),t?n.jsx("div",{className:"conversation-header-actions",children:t}):null]});const c=Vs(e.title,o("conversation.titleFallback")),u=e$(c.displayTitle);return n.jsxs("header",{className:"conversation-header","data-workspace-tone":(r==null?void 0:r.tone)??"root",style:os(r),"data-window-drag-handle":"conversation-header",onMouseDownCapture:a,children:[n.jsx("div",{className:"conversation-header-main",children:n.jsx("h1",{className:`conversation-title is-${u}`,title:c.fullTitle,children:c.displayTitle})}),t?n.jsx("div",{className:"conversation-header-actions",children:t}):null]})}function Nu({open:e,workspaces:t,workspaceOptions:r,initialWorkspaceId:i,onClose:a,onSelect:c}){const[u,d]=p.useState(""),[m,f]=p.useState(!1),w=ms(),g=p.useMemo(()=>r??t.map(x=>({workspace:x,label:x.name,subtitle:x.path,depth:0,kind:"workspace",meta:null})),[r,t]),v=p.useMemo(()=>g.map(x=>x.workspace.id).join("|"),[g]);if(p.useEffect(()=>{e&&(d(t$(g,i)),f(!1))},[i,e,v]),!e||typeof document>"u")return null;const y=g.find(x=>x.workspace.id===u)??g[0]??null;return Vn.createPortal(n.jsx("div",{className:"ios-action-sheet-overlay",role:"presentation",onClick:a,children:n.jsxs("div",{className:"mobile-workspace-home-sheet",role:"dialog","aria-modal":"true","aria-label":o("shell.createSessionModalTitle"),onClick:x=>x.stopPropagation(),children:[n.jsxs("div",{className:"mobile-workspace-home-sheet-card",children:[n.jsx("div",{className:"mobile-workspace-home-sheet-header",children:n.jsx("strong",{children:o("shell.createSessionModalTitle")})}),n.jsxs("div",{className:"mobile-feature-form mobile-workspace-home-form mobile-create-session-form",children:[n.jsx("p",{className:"mobile-create-session-description",children:o("shell.createSessionModalDescription")}),n.jsxs("div",{className:"mobile-feature-field",children:[n.jsx("span",{children:o("shell.createSessionWorkspaceLabel")}),n.jsxs("button",{type:"button",className:"mobile-create-session-workspace-trigger","aria-label":`${o("shell.createSessionWorkspaceLabel")} ${(y==null?void 0:y.label)??""}`.trim(),"aria-expanded":m?"true":"false",disabled:g.length===0,onClick:()=>{w.trigger("selection"),f(x=>!x)},children:[n.jsxs("span",{className:"mobile-create-session-workspace-copy",children:[n.jsx("strong",{children:(y==null?void 0:y.label)??o("common.unknown")}),n.jsx("span",{children:(y==null?void 0:y.subtitle)??o("common.unknown")})]}),n.jsx(n$,{expanded:m})]}),m?n.jsx("div",{className:"mobile-workspace-home-group mobile-create-session-workspace-list",role:"list",children:g.map(x=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-create-session-workspace-row","data-worktree-kind":x.kind,"data-worktree-depth":x.depth,onClick:()=>{x.workspace.id!==u&&w.trigger("selection"),d(x.workspace.id),f(!1)},children:[n.jsxs("span",{className:"mobile-create-session-workspace-option-copy",style:{"--mobile-workspace-tree-depth":String(x.depth)},children:[n.jsxs("strong",{children:[x.kind==="worktree"?n.jsx("span",{className:"mobile-workspace-home-worktree-badge",children:o("shell.mobileWorktreeBadge")}):null,x.label]}),n.jsx("span",{children:x.subtitle})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:x.workspace.id===u?n.jsx(i$,{}):n.jsx(r$,{})})]},x.workspace.id))}):null]}),n.jsxs("div",{className:"mobile-create-session-provider-block",children:[n.jsxs("div",{className:"mobile-create-session-provider-header",children:[n.jsx("span",{className:"mobile-create-session-provider-label",children:o("shell.createSessionProviderLabel")}),n.jsx("span",{className:"mobile-create-session-provider-hint",children:o("shell.providerOptionHint")})]}),n.jsx(cw,{disabled:!u,workspaceId:u||null,onSelect:x=>{u&&c(u,x)}})]})]})]}),n.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:a,children:o("common.cancel")})]})}),document.body)}function t$(e,t){var r;return t&&e.some(i=>i.workspace.id===t)?t:((r=e[0])==null?void 0:r.workspace.id)??""}function n$({expanded:e}){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"mobile-create-session-workspace-chevron","data-expanded":e?"true":"false",children:n.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function r$(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function i$(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}const q0="mobile.conversation.preview.mode";function Qf(){if(typeof window>"u")return"preview";try{return window.localStorage.getItem(q0)==="immersive"?"immersive":"preview"}catch{return"preview"}}function Cs(e){if(!(typeof window>"u"))try{window.localStorage.setItem(q0,e)}catch{}}function s$(e,t,r){if(!t)return null;const i=e.find(u=>u.workspace.id===t);if(!i)return null;const a=dT([i]).filter(u=>!u.session.isArchived&&!Ya(u.session)),c=a.findIndex(u=>u.session.sessionId===r);return c<0?null:a[c+1]??null}const a$=15e3,$C=.6,Jf=.6,VC=8,o$=36,l$=48,c$=96,u$=320,d$="workbench:focus-composer";function h$(){const{sessionId:e="",workspaceId:t}=Ao(),r=hs(),i=mr(),a=p.useMemo(()=>new URLSearchParams(r.search),[r.search]),c=(t==null?void 0:t.trim())||null,u=p.useMemo(()=>b$(e,c,a),[c,a,e]),d=p.useMemo(()=>E$(e,r.state),[r.state,e]);return u?n.jsx(g$,{draft:u,navigate:i}):n.jsx(m$,{sessionId:e,bootstrapMessages:d})}function m$({sessionId:e,bootstrapMessages:t}){var _t,Fn,mn,bn;const{shellMode:r,navigationGroups:i,requestNavigationRefresh:a,selectWorkspace:c,setSessionWorkspace:u,markNavigationSessionSeen:d,favoriteSessions:m,archiveSession:f,unarchiveSession:w,startDraftSession:g,upsertNavigationSession:v}=Tr(),y=mr(),x=p.useRef(null),C=p.useRef(null),[j,N]=p.useState(!1),[P,L]=p.useState(null),[Y,H]=p.useState(!1),[W,I]=p.useState(!1),[M,O]=p.useState(null),[F,X]=p.useState(!1),[U,G]=p.useState(!1),[R,A]=p.useState(null),[Z,pe]=p.useState(!1),q=p.useMemo(()=>i.flatMap(Ce=>Ce.sessions).find(Ce=>Ce.sessionId===e)??null,[i,e]);(!x.current||C.current!==e)&&((_t=x.current)==null||_t.destroy(),x.current=new N0(e,{initialSession:q,bootstrapMessages:t,onSeen:(Ce,De)=>{d(Ce,De)}}),C.current=e);const D=x.current,{showToast:T,dismissToast:B}=Jn(),Q=us(Ce=>Ce.notificationPreferences.notifyOnPermissionRequest),_=pr(),de=ms(),le=p.useRef(null),oe=p.useRef(null),ye=p.useRef(null),Ne=p.useRef((q==null?void 0:q.runningState)??null),Me=p.useRef(new Set),Te=Ci(D,Ce=>Ce.session),Dt=Ci(D,Ce=>Ce.capabilities),st=Ci(D,Ce=>Ce.runtimeHasActiveRun),dt=Ci(D,Ce=>Ce.runtimeCanInterrupt),bt=Ci(D,Ce=>Ce.messages),pt=Ci(D,Ce=>Ce.permissionRequests),we=Ci(D,Ce=>Ce.queuedMessages),he=Ci(D,Ce=>Ce.contextUsage),Le=Ci(D,Ce=>Ce.historyState),Oe=Ci(D,Ce=>Ce.errorCode),Qe=Ci(D,Ce=>Ce.errorDetail),wt=Ci(D,Ce=>Ce.loadingOlderMessages),Ie=Ci(D,Ce=>Ce.hasOlderMessages),Be=Ci(D,Ce=>Ce.connectionState),[vt,ft]=p.useState(!1),[ve,Ae]=p.useState(null),[et,We]=p.useState(null),lt=N$(Te),ct=lt&&KT(Dt)&&(Te==null?void 0:Te.provider)===(Dt==null?void 0:Dt.provider),Vt=we.some(Ce=>Ce.status==="queued"||Ce.status==="dispatching"),Bt=T$({sessionId:e,provider:(Te==null?void 0:Te.provider)??null,runningState:(Te==null?void 0:Te.runningState)??null,activityState:(Te==null?void 0:Te.activityState)??null,runtimeHasActiveRun:st,messages:bt})?o("conversation.runtimeThinkingPlaceholder",{provider:o("conversation.providerCodex")}):null,Wt=r!=="mobile",Lt=Q0(!Wt),Nt=(Te==null?void 0:Te.workspaceId)??(q==null?void 0:q.workspaceId)??null,ln=p.useMemo(()=>new Set(m.map(Ce=>Ce.session.sessionId)),[m]),Jt=p.useMemo(()=>i.map(Ce=>Ce.workspace),[i]),Sn=p.useMemo(()=>Ol(i),[i]),se=p.useMemo(()=>hm(i),[i]),He=p.useMemo(()=>V0(i,(Te==null?void 0:Te.workspaceId)??(q==null?void 0:q.workspaceId)??null,ln),[ln,i,q==null?void 0:q.workspaceId,Te==null?void 0:Te.workspaceId]),xt=p.useMemo(()=>G0(m,i),[m,i]),[Tt,Mn]=p.useState([]),wn=p.useMemo(()=>[...xt,...He],[xt,He]),kn=p.useMemo(()=>Nt?Jt.find(Ce=>Ce.id===Nt)??null:null,[Nt,Jt]),Ht=(Nt?se[Nt]??null:null)??(kn?ku(kn):null),Gt=p.useMemo(()=>ua(i,Nt),[Nt,i]),dn=Sn.find(Ce=>Ce.workspace.id===Nt)??(Gt?{workspace:Gt.workspace,label:Gt.workspace.name,subtitle:Gt.workspace.path}:null),hn=p.useMemo(()=>s$(i,Nt,e),[Nt,i,e]);(Te==null?void 0:Te.provider)??(q==null||q.provider);const te=p.useMemo(()=>{var Ce;return Vs(((Ce=Te??q)==null?void 0:Ce.title)??null,o("conversation.titleFallback"))},[q,Te]),re=Te??q??null,ue=p.useMemo(()=>new Map(i.flatMap(Ce=>Ce.sessions.map(De=>[De.sessionId,De]))),[i]);p.useEffect(()=>{const Ce=ca(wn,e,De=>De.session.sessionId);Ce.length!==0&&Mn(De=>{const mt=new Set(De);let Mt=!1;for(const en of Ce)mt.has(en)||(mt.add(en),Mt=!0);return Mt?Array.from(mt):De})},[wn,e]);const Se=p.useMemo(()=>F$(re,bt),[re,bt]),_e=Se!=null&&Se.parentSessionId&&((mn=(Fn=ue.get(Se.parentSessionId))==null?void 0:Fn.title)==null?void 0:mn.trim())||o("conversation.inheritedContextParentFallback"),ze=p.useMemo(()=>!Se||Se.hiddenMessageCount<=0?bt:vt?Se.sourceType!=="selection"?bt:[{id:`annotation-selection-${e}`,sessionId:e,role:"system",kind:"text",content:Se.hiddenSelectionText,toolCall:null,attachments:[],attachmentPayloads:null,origin:"system",originRef:Se.sourceMessageId??null,timestamp:(re==null?void 0:re.createdAt)??new Date(0).toISOString(),sequence:Se.hiddenSequenceBoundary,rawRef:`annotation-selection://${e}`,deliveryState:"sent",clientRequestId:null},...bt]:bt.filter(De=>De.sequence>Se.hiddenSequenceBoundary),[re==null?void 0:re.createdAt,vt,Se,bt,e]),yt=(re==null?void 0:re.workspaceId)??(q==null?void 0:q.workspaceId)??null,nt=p.useMemo(()=>B0(i,yt,e),[yt,i,e]),Ve=_q(nt),ne=!!(re&&yt&&Ve),je=p.useMemo(()=>(Gt==null?void 0:Gt.sessions.filter(Ce=>Ce.isArchived===!0&&!Ya(Ce)))??[],[Gt]),ht=p.useRef(null),Rt=p.useRef(null),tn=p.useRef(null),Kt=p.useRef(null),[$t,Zt]=p.useState(null),{composerPortalTarget:Tn}=gT();p.useEffect(()=>{D.applyNavigationSession(q)},[q,D]),p.useEffect(()=>(D.initialize(),()=>{D.destroy()}),[D]),p.useEffect(()=>(u(e,(Te==null?void 0:Te.workspaceId)??null),()=>{u(e,null)}),[Te==null?void 0:Te.workspaceId,e,u]),p.useEffect(()=>{G(!1),A(null),ft(!1)},[e]),p.useEffect(()=>()=>{ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null)},[]),p.useEffect(()=>{if(!Oe||!Qe){ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null),oe.current=null,le.current=null,B("conversation-runtime-error");return}const Ce=`${Oe}:${Qe}`;if(!(le.current===Ce||oe.current===Ce)){if(ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null),p$((Te==null?void 0:Te.provider)??null,Oe,Qe)){oe.current=Ce,ye.current=window.setTimeout(()=>{oe.current=null,ye.current=null,le.current=Ce,T({id:"conversation-runtime-error",title:o("conversation.runtimeErrorTitle"),description:Qe,tone:"error",durationMs:null})},a$);return}oe.current=null,le.current=Ce,T({id:"conversation-runtime-error",title:o("conversation.runtimeErrorTitle"),description:Qe,tone:"error",durationMs:null})}},[B,Oe,Qe,Te==null?void 0:Te.provider,T]),p.useEffect(()=>{const Ce=Ne.current,De=(Te==null?void 0:Te.runningState)??null;(Ce==="starting"||Ce==="running"||Ce==="reconnecting")&&De==="completed"&&de.trigger("success"),Ne.current=De},[de,Te==null?void 0:Te.runningState]),p.useEffect(()=>{const Ce=pt.filter(mt=>mt.status==="pending"),De=(Te==null?void 0:Te.workspaceId)??(q==null?void 0:q.workspaceId)??null;for(const mt of Ce)Me.current.has(mt.id)||(Me.current.add(mt.id),Q&&(T({id:`permission-request-${mt.id}`,title:o("conversation.permissionRequestToastTitle"),description:mt.title,tone:"warning",durationMs:8e3,action:De?{label:o("shell.contextOpenSession"),onClick:()=>{y(Nr(De,e))}}:void 0}),_.bridge.showNotification(o("conversation.permissionRequestToastTitle"),mt.title)))},[q==null?void 0:q.workspaceId,y,Q,pt,_.bridge,Te==null?void 0:Te.workspaceId,e,T]),Y0(tn,$t,!Wt,e),X0(tn,Kt,!Wt,e);async function Zn(Ce,De){var en,An;const mt=R;if(!mt){await D.sendMessage(Ce,{model:De==null?void 0:De.model,reasoningLevel:De==null?void 0:De.reasoningLevel,attachments:De==null?void 0:De.attachments,attachmentMeta:De==null?void 0:De.attachmentMeta}),a();return}let Mt=null;try{Mt=await OT(e,{sourceType:"message",sourceMessageId:mt.sourceMessageId,sourceMessageSnapshot:mt.sourceMessageSnapshot,strategy:"auto",targetProvider:mt.targetProvider}),v(Mt),await nw(Mt.sessionId,{content:Ce,clientRequestId:((An=(en=globalThis.crypto)==null?void 0:en.randomUUID)==null?void 0:An.call(en))??`fork-${Date.now()}-${Math.random().toString(16).slice(2)}`,model:mt.targetModel,reasoningLevel:(De==null?void 0:De.reasoningLevel)??null,attachments:(De==null?void 0:De.attachments)??[]}),A(null),a(),c(Mt.workspaceId),Cs("preview"),y(Nr(Mt.workspaceId,Mt.sessionId)),T({title:o("conversation.forkMessageSucceeded"),tone:"success"})}catch(zt){throw Mt&&(v(Mt),a()),zt}}function Cn(Ce){c(Ce),y(Co(Ce))}return n.jsxs(n.Fragment,{children:[n.jsxs("main",{ref:tn,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!Wt,"data-workspace-tone":(Ht==null?void 0:Ht.tone)??"root","data-worktree-depth":(Ht==null?void 0:Ht.depth)??0,"data-preview-mode":Wt?void 0:Lt.displayMode,"data-preview-dragging":Wt?void 0:Lt.isDragging,style:{...os(Ht)??{},...Wt?{}:Lt.pageStyle},children:[Wt?n.jsx(z0,{session:Te??q,workspaceContext:Ht,actions:n.jsx(_0,{session:Te??q})}):null,Wt?null:n.jsx(Io,{containerRef:Kt,className:"mobile-conversation-page-header",gestureHandlers:Lt.mainGestureHandlers,currentWorkspace:dn?{id:dn.workspace.id,name:dn.label,path:dn.subtitle}:Jt[0]??null,workspaces:Jt,workspaceOptions:Sn,onSelectWorkspace:Cn,heading:te.fullTitle,trailing:n.jsxs("div",{className:"mobile-conversation-toolbar-main",children:[n.jsx("span",{className:"mobile-conversation-toolbar-title",title:te.fullTitle,children:te.displayTitle}),n.jsx(Nq,{session:Te??q})]})}),Wt?null:n.jsx(J0,{visible:Lt.isVisible,widthPx:Lt.previewWidthPx,isDragging:Lt.isDragging,gestureHandlers:Lt.railGestureHandlers,activeSessionId:e,createSessionActionLabel:o("shell.createSession"),favoriteItems:xt,items:He,expandedRootIds:Tt,workspaceSectionLabel:o("shell.mobileConversationCurrentWorkspaceSection"),onCreateSession:()=>{pe(!0)},archiveCurrentActionLabel:o("shell.archiveCurrentSessionAction"),archiveFolderActionLabel:o("shell.archiveFolderAction"),onArchiveActiveSession:()=>{H(!0)},onOpenArchiveFolder:()=>{I(!0)},onToggleSubsessions:Ce=>{Mn(De=>De.includes(Ce)?De.filter(mt=>mt!==Ce):[...De,Ce])},onActivate:Ce=>{Cs("preview"),y(Nr(Ce.workspace.id,Ce.session.sessionId))}}),n.jsx("div",{className:"mobile-conversation-stage",...Wt?{}:Lt.mainGestureHandlers,children:n.jsxs("div",{ref:ht,className:"mobile-conversation-main",children:[n.jsx(F0,{connectionState:Be,onReconnect:()=>D.reconnect()}),n.jsx(Tq,{requests:pt,replyingRequestId:P,onReply:async(Ce,De)=>{L(Ce);try{await D.replyPermissionRequest(Ce,De)}catch(mt){T({title:o("conversation.permissionRequestReplyFailed"),description:mt instanceof Error?mt.message:void 0,tone:"error"})}finally{L(null)}}}),Se&&Se.hiddenMessageCount>0?n.jsx(j$,{expanded:vt,hiddenMessageCount:Se.hiddenMessageCount,parentTitle:_e,sourceType:Se.sourceType,onToggle:()=>{ft(Ce=>!Ce)},onOpenBranchTree:ne?()=>G(!0):void 0}):null,n.jsx("div",{ref:Rt,className:"conversation-timeline-shell",children:n.jsx(Lw,{sessionId:e,messages:ze,historyState:Le,loadingOlderMessages:wt,hasOlderMessages:Ie,provider:(Te==null?void 0:Te.provider)??null,runtimeThinkingPlaceholder:Bt,onLoadOlderMessages:()=>{D.loadOlderMessages()},onRetryMessage:Ce=>{D.retryMessage(Ce)},onForkMessage:Ce=>{Te&&(A({sourceMessageId:Ce.id,sourceMessageSnapshot:{role:Ce.role,kind:Ce.kind??(Ce.role==="tool"?"tool_result":"text"),content:Ce.content},content:Ce.content,sourceProvider:Te.provider,workspaceId:Te.workspaceId,targetProvider:Te.provider,targetModel:null}),f$())}})}),n.jsx(jq,{containerRef:Rt,session:Te??q??null,currentCapabilities:Dt}),n.jsx(Rq,{items:we,deletingQueueItemId:ve,steeringQueueItemId:et,canSteer:ct,onDelete:async Ce=>{Ae(Ce);try{await D.deleteQueuedMessage(Ce)}finally{Ae(null)}},onSteer:async Ce=>{We(Ce);try{await D.steerQueuedMessage(Ce),a()}finally{We(null)}}}),n.jsx(hw,{capabilities:Dt,draftStorageId:e,forkDraft:R,onClearForkDraft:()=>A(null),onForkDraftChange:Ce=>A(Ce),panelRef:Wt?void 0:Zt,portalContainer:Wt?null:Tn,hasActiveRun:st,contextUsage:he,taskProvider:((bn=Te??q)==null?void 0:bn.provider)??null,taskMessages:bt,hasPendingQueuedMessages:Vt,canInterrupt:dt,isSubmitting:j,isRunning:lt,onInterrupt:async()=>{await D.interrupt(),a()},onSend:async(Ce,De)=>{N(!0);try{await Zn(Ce,{model:De==null?void 0:De.model,reasoningLevel:De==null?void 0:De.reasoningLevel,attachments:De==null?void 0:De.attachments,attachmentMeta:De==null?void 0:De.attachmentMeta})}finally{N(!1)}},onQueueSend:async(Ce,De)=>{N(!0);try{R?await Zn(Ce,{model:De==null?void 0:De.model,reasoningLevel:De==null?void 0:De.reasoningLevel,attachments:De==null?void 0:De.attachments,attachmentMeta:De==null?void 0:De.attachmentMeta}):await D.enqueueMessage(Ce,{model:De==null?void 0:De.model,reasoningLevel:De==null?void 0:De.reasoningLevel,attachments:De==null?void 0:De.attachments,attachmentMeta:De==null?void 0:De.attachmentMeta})}finally{N(!1)}}})]})})]}),n.jsx(Zq,{open:U,navigationGroups:i,workspaceId:yt,sessionId:e,onClose:()=>G(!1),onOpenSession:Ce=>{G(!1),c(Ce.workspaceId),Cs("preview"),y(Nr(Ce.workspaceId,Ce.sessionId))}}),n.jsx(S$,{open:Y,busy:F,onClose:()=>{F||H(!1)},onConfirm:async()=>{if(!F){X(!0);try{if(await f(e),H(!1),T({title:o("shell.archiveAdded"),tone:"success"}),Nt){if(c(Nt),Cs("preview"),hn){y(Nr(hn.workspace.id,hn.session.sessionId));return}y(Co(Nt));return}y("/workspaces")}catch(Ce){T({title:Ce instanceof Error?Ce.message:o("shell.navigationLoadFailed"),tone:"error"})}finally{X(!1)}}}}),n.jsx(C$,{open:W,workspaceName:(Gt==null?void 0:Gt.workspace.name)??null,sessions:je,restoringSessionId:M,onClose:()=>{M||I(!1)},onRestore:async Ce=>{O(Ce);try{await w(Ce),T({title:o("shell.archiveRestored"),tone:"success"})}catch(De){T({title:De instanceof Error?De.message:o("shell.navigationLoadFailed"),tone:"error"})}finally{O(null)}}}),n.jsx(Nu,{open:Z,workspaces:Jt,workspaceOptions:Sn,initialWorkspaceId:Nt,onClose:()=>pe(!1),onSelect:(Ce,De)=>{pe(!1),Cs("immersive"),g(Ce,De)}})]})}function p$(e,t,r){return e!=="opencode"?!1:t==="OPENCODE_REQUEST_TIMEOUT"||t==="PROVIDER_RUNTIME_TIMEOUT"||/\bSERVER_TIMEOUT\b/i.test(r)||/timeout/i.test(r)||/超时/.test(r)}function f$(){typeof window>"u"||window.dispatchEvent(new CustomEvent(d$))}function g$({draft:e,navigate:t}){const{shellMode:r,navigationGroups:i,requestNavigationRefresh:a,selectWorkspace:c,setSessionWorkspace:u,upsertNavigationSession:d,favoriteSessions:m,startDraftSession:f}=Tr(),[w,g]=p.useState(!1),[v,y]=p.useState([]),[x,C]=p.useState(!1),j=p.useMemo(()=>za(e.provider),[e.provider]),[N,P]=p.useState(j),L=r!=="mobile",Y=Q0(!L),H=p.useMemo(()=>w$(e),[e]),W=p.useMemo(()=>new Set(m.map(ye=>ye.session.sessionId)),[m]),I=p.useMemo(()=>i.map(ye=>ye.workspace),[i]),M=p.useMemo(()=>Ol(i),[i]),O=p.useMemo(()=>hm(i),[i]),F=p.useMemo(()=>I.find(ye=>ye.id===e.workspaceId)??null,[e.workspaceId,I]),X=O[e.workspaceId]??(F?ku(F):null),U=p.useMemo(()=>Vs(H.title??null,o("conversation.titleFallback")),[H]),G=p.useMemo(()=>V0(i,e.workspaceId,W),[e.workspaceId,W,i]),R=p.useMemo(()=>G0(m,i),[m,i]),[A,Z]=p.useState([]),pe=p.useMemo(()=>[...R,...G],[R,G]),q=p.useMemo(()=>ua(i,e.workspaceId),[e.workspaceId,i]),D=M.find(ye=>ye.workspace.id===e.workspaceId)??(q?{workspace:q.workspace,label:q.workspace.name,subtitle:q.workspace.path}:null),T=p.useRef(null),B=p.useRef(null),Q=p.useRef(null),[_,de]=p.useState(null),{composerPortalTarget:le}=gT();p.useEffect(()=>{const ye=ca(pe,e.sessionId,Ne=>Ne.session.sessionId);ye.length!==0&&Z(Ne=>{const Me=new Set(Ne);let Te=!1;for(const Dt of ye)Me.has(Dt)||(Me.add(Dt),Te=!0);return Te?Array.from(Me):Ne})},[e.sessionId,pe]),p.useEffect(()=>(u(e.sessionId,e.workspaceId),()=>{u(e.sessionId,null)}),[e.sessionId,e.workspaceId,u]),p.useEffect(()=>{let ye=!1;return P(j),Il(e.provider,e.workspaceId).then(Ne=>{ye||P(Ne)}).catch(()=>{}),()=>{ye=!0}},[e.provider,e.workspaceId,j]),Y0(B,_,!L,e.sessionId),X0(B,Q,!L,e.sessionId);function oe(ye){c(ye),t(Co(ye))}return n.jsxs(n.Fragment,{children:[n.jsxs("main",{ref:B,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!L,"data-workspace-tone":(X==null?void 0:X.tone)??"root","data-worktree-depth":(X==null?void 0:X.depth)??0,"data-preview-mode":L?void 0:Y.displayMode,"data-preview-dragging":L?void 0:Y.isDragging,style:{...os(X)??{},...L?{}:Y.pageStyle},children:[L?n.jsx(z0,{session:H,workspaceContext:X}):null,L?null:n.jsx(Io,{containerRef:Q,className:"mobile-conversation-page-header",gestureHandlers:Y.mainGestureHandlers,currentWorkspace:D?{id:D.workspace.id,name:D.label,path:D.subtitle}:I[0]??null,workspaces:I,workspaceOptions:M,onSelectWorkspace:oe,heading:U.fullTitle,trailing:n.jsx("span",{className:"mobile-conversation-toolbar-title",title:U.fullTitle,children:U.displayTitle})}),L?null:n.jsx(J0,{visible:Y.isVisible,widthPx:Y.previewWidthPx,isDragging:Y.isDragging,gestureHandlers:Y.railGestureHandlers,activeSessionId:e.sessionId,createSessionActionLabel:o("shell.createSession"),favoriteItems:R,items:G,expandedRootIds:A,workspaceSectionLabel:o("shell.mobileConversationCurrentWorkspaceSection"),onCreateSession:()=>{C(!0)},onToggleSubsessions:ye=>{Z(Ne=>Ne.includes(ye)?Ne.filter(Me=>Me!==ye):[...Ne,ye])},onActivate:ye=>{Cs("preview"),t(Nr(ye.workspace.id,ye.session.sessionId))}}),n.jsx("div",{className:"mobile-conversation-stage",...L?{}:Y.mainGestureHandlers,children:n.jsxs("div",{ref:T,className:"mobile-conversation-main",children:[n.jsx(F0,{connectionState:"closed",onReconnect:()=>{}}),n.jsx("div",{className:"conversation-timeline-shell",children:n.jsx(Lw,{sessionId:e.sessionId,messages:v,historyState:"ready",loadingOlderMessages:!1,hasOlderMessages:!1,provider:e.provider,runtimeThinkingPlaceholder:null,onLoadOlderMessages:()=>{},onRetryMessage:()=>{}})}),n.jsx(hw,{capabilities:N,draftStorageId:e.sessionId,panelRef:L?void 0:de,portalContainer:L?null:le,contextUsage:null,taskProvider:e.provider,taskMessages:v,isSubmitting:w,isRunning:!1,onSend:async(ye,Ne)=>{var Dt,st,dt,bt;const Me=L$();y(pt=>[...pt,b0(e.sessionId,ye,Me,(Ne==null?void 0:Ne.attachmentMeta)??[],(Ne==null?void 0:Ne.attachments)??[])]),g(!0);const Te=performance.now();sn("session_send.start_live.client_start",{draftSessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,clientRequestId:Me,contentLength:ye.length});try{const pt=Ts.getState().profile.defaultPermissionMode,we=await tw({workspaceId:e.workspaceId,provider:e.provider,content:ye,clientRequestId:Me,model:(Ne==null?void 0:Ne.model)??null,reasoningLevel:(Ne==null?void 0:Ne.reasoningLevel)??null,permissionMode:pt==="default"?null:pt,attachments:(Ne==null?void 0:Ne.attachments)??[]});sn("session_send.start_live.client_response",{draftSessionId:e.sessionId,sessionId:we.sessionId,workspaceId:((Dt=we.session)==null?void 0:Dt.workspaceId)??e.workspaceId,provider:we.provider,clientRequestId:Me,durationMs:Math.round(performance.now()-Te),returnedMessageId:((st=we.message)==null?void 0:st.messageId)??null}),we.session&&d(we.session);const he=((bt=(dt=we.session)==null?void 0:dt.workspaceId)==null?void 0:bt.trim())||e.workspaceId;u(we.sessionId,he),Cs("preview"),t(Nr(he,we.sessionId),{replace:!0,state:we.message?{bootstrap:{sessionId:we.sessionId,messages:[we.message]}}:null}),a()}catch(pt){throw sn("session_send.start_live.client_error",{draftSessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,clientRequestId:Me,durationMs:Math.round(performance.now()-Te),error:pt instanceof Error?pt.message:String(pt)}),y(we=>ib(we,Me)),pt}finally{g(!1)}}})]})})]}),n.jsx(Nu,{open:x,workspaces:I,workspaceOptions:M,initialWorkspaceId:e.workspaceId,onClose:()=>C(!1),onSelect:(ye,Ne)=>{C(!1),Cs("immersive"),f(ye,Ne)}})]})}function b$(e,t,r,i=null){var u,d;if(!A$(e))return null;const a=t??((u=r.get("workspaceId"))==null?void 0:u.trim())??null,c=((d=r.get("provider"))==null?void 0:d.trim())??i??null;return!a||!$T(c)?null:{sessionId:e,workspaceId:a,provider:c}}function w$(e){const t=new Date().toISOString();return{sessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,providerSessionId:`draft://${e.sessionId}`,rawStoreRef:`draft://${e.sessionId}`,parentSessionId:null,isSubagent:!1,subagentLabel:null,isArchived:!1,title:LF(e.provider),messageCount:0,lastMessageAt:null,createdAt:t,updatedAt:t,syncStatus:"idle",syncCursor:null,lastSyncAt:null,lastErrorCode:null,lastErrorDetail:null,resumedAt:null,runningState:"idle",activitySource:"none",lastEventAt:null,completedAt:null,lastSeenAt:null,activityState:"idle"}}function v$(e){var t;return((t=e.parentSessionId)==null?void 0:t.trim())||null}function $0(e){const t=new Map(e.map(a=>[a.sessionId,a])),r=new Map,i=a=>{const c=r.get(a.sessionId);if(typeof c=="boolean")return c;if(a.isArchived)return r.set(a.sessionId,!1),!1;const u=v$(a);if(!u)return r.set(a.sessionId,!0),!0;const d=t.get(u);if(!d)return r.set(a.sessionId,!0),!0;const m=i(d);return r.set(a.sessionId,m),m};return e.filter(a=>i(a))}function V0(e,t,r){if(!t)return[];const i=ua(e,t);if(!i)return[];const a=$0(i.sessions).map(u=>({session:u,workspace:i.workspace}));return Fb(a).filter(u=>!r.has(u.item.session.sessionId)&&!om(u.children,d=>r.has(d.session.sessionId)))}function G0(e,t){return e.filter(r=>!Ya(r.session)).flatMap(r=>{const i=ua(t,r.workspace.id);if(!i)return[];const a=Fb($0(i.sessions).map(u=>({session:u,workspace:i.workspace}))),c=K0(a,r.session.sessionId);return c?[c]:[]})}function K0(e,t){for(const r of e){if(r.item.session.sessionId===t)return r;const i=K0(r.children,t);if(i)return i}return null}function Y0(e,t,r,i){p.useEffect(()=>{const a=e.current;if(!r||!a){a&&a.style.removeProperty("--mobile-conversation-composer-height");return}if(!t){a.style.removeProperty("--mobile-conversation-composer-height");return}const c=a,u=t;function d(){!e.current||!u.isConnected||c.style.setProperty("--mobile-conversation-composer-height",`${u.offsetHeight}px`)}d();const m=typeof ResizeObserver<"u"?new ResizeObserver(d):null;return m==null||m.observe(u),window.addEventListener("resize",d),()=>{m==null||m.disconnect(),window.removeEventListener("resize",d),a.style.removeProperty("--mobile-conversation-composer-height")}},[t,r,i,e])}function X0(e,t,r,i){p.useEffect(()=>{const a=e.current,c=t.current;if(!r||!a){a&&a.style.removeProperty("--mobile-conversation-page-header-height");return}if(!c){a.style.removeProperty("--mobile-conversation-page-header-height");return}const u=a,d=c;function m(){!e.current||!d.isConnected||u.style.setProperty("--mobile-conversation-page-header-height",`${d.offsetHeight}px`)}m();const f=typeof ResizeObserver<"u"?new ResizeObserver(m):null;return f==null||f.observe(d),window.addEventListener("resize",m),()=>{f==null||f.disconnect(),window.removeEventListener("resize",m),a.style.removeProperty("--mobile-conversation-page-header-height")}},[r,t,i,e])}function Q0(e){const t=ms(),[r,i]=p.useState(()=>e?Qf():"immersive"),[a,c]=p.useState(()=>GC()),[u,d]=p.useState(()=>e&&Qf()==="preview"?"default":"closed"),m=p.useRef(u),f=p.useRef(null);p.useEffect(()=>{m.current=u},[u]),p.useEffect(()=>{if(!e){f.current=null,m.current="closed",d("closed"),i("immersive");return}const M=Qf();i(M),d(M==="preview"?"default":"closed")},[e]),p.useEffect(()=>{e&&Cs(r)},[e,r]),p.useEffect(()=>{if(typeof window>"u")return;function M(){c(GC())}return M(),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M)}},[]);function w(M){m.current=M,d(M)}function g(M="default"){w(M),i("preview")}function v(){w("closed"),i("immersive")}function y(){w("expanded"),i("preview")}function x(){if(m.current!=="closed"){t.trigger("gesture"),v();return}t.trigger("gesture"),g()}function C(M,O){if(!e||O.touches.length!==1){f.current=null;return}if(k$(O.target)){f.current=null;return}const F=O.touches[0];if(!F){f.current=null;return}if(M==="main"){if(m.current==="closed"&&F.clientX>c$){f.current=null;return}}else if(m.current==="closed"){f.current=null;return}f.current={source:M,intent:M==="rail"?"rail":m.current==="closed"?"open":"close",startX:F.clientX,startY:F.clientY,lastX:F.clientX,lastY:F.clientY,horizontalLocked:!1}}function j(M){const O=f.current,F=M.touches[0];if(!e||!O||!F)return;const X=F.clientX-O.startX,U=F.clientY-O.startY;if(O.lastX=F.clientX,O.lastY=F.clientY,!O.horizontalLocked){if(Math.abs(X)<VC&&Math.abs(U)<VC)return;if(Math.abs(X)<=Math.abs(U)){f.current=null;return}if(O.intent==="open"&&X<=0){f.current=null;return}if(O.intent==="close"&&X>=0){f.current=null;return}O.horizontalLocked=!0}}function N(M){var U;const O=f.current;if(f.current=null,!(O!=null&&O.horizontalLocked))return;const F=(U=M==null?void 0:M.changedTouches)==null?void 0:U[0];F&&(O.lastX=F.clientX,O.lastY=F.clientY);const X=O.lastX-O.startX;if(O.intent==="open"){X>=o$&&(t.trigger("gesture"),g("default"));return}if(O.intent==="close"){X<=-34&&(t.trigger("gesture"),v());return}if(X<=-34){t.trigger("gesture"),v();return}X>=l$&&m.current==="default"&&(t.trigger("gesture"),y())}const P=u==="expanded"?Jf:u==="default"?$C:0,L=Math.round(a*P*100)/100,Y=P===0?0:P/Jf,H={"--mobile-conversation-preview-default-width":`${Math.round(a*$C*100)/100}px`,"--mobile-conversation-preview-max-width":`${Math.round(a*Jf*100)/100}px`,"--mobile-conversation-preview-width":`${L}px`,"--mobile-conversation-preview-progress":Y.toFixed(4)};return{closePreview:v,displayMode:u==="closed"?"immersive":"preview",isDragging:!1,isVisible:u!=="closed",mainGestureHandlers:{onTouchStart:M=>C("main",M),onTouchMove:j,onTouchEnd:N,onTouchCancel:N},pageStyle:H,previewWidthPx:L,railGestureHandlers:{onTouchStart:M=>C("rail",M),onTouchMove:j,onTouchEnd:N,onTouchCancel:N},togglePreview:x}}function J0({visible:e,widthPx:t,isDragging:r,gestureHandlers:i,activeSessionId:a,createSessionActionLabel:c,favoriteItems:u,items:d,expandedRootIds:m,workspaceSectionLabel:f,onCreateSession:w,archiveCurrentActionLabel:g,archiveFolderActionLabel:v,onArchiveActiveSession:y,onOpenArchiveFolder:x,onToggleSubsessions:C,onActivate:j}){if(!e)return null;function N(P,L){const{workspaceName:Y,ancestorExpanded:H=!1,ancestorHasNextSiblings:W=[],hasNextSibling:I=!1,isFirstSibling:M=!1}=L??{},O=P.item.session.sessionId,F=P.children,X=P.depth===0&&F.length>0,U=H||X&&m.includes(O),G=P.depth>0?[...W,I]:[...W];return n.jsxs("div",{className:"mobile-conversation-preview-tree-node",children:[n.jsxs("div",{className:"mobile-conversation-preview-tree-row",style:{"--mobile-preview-tree-depth":P.depth},children:[P.depth>0?n.jsxs("div",{className:"mobile-conversation-preview-guides","aria-hidden":"true",children:[W.map((R,A)=>R?n.jsx("span",{className:"mobile-conversation-preview-guide-column",style:{"--mobile-preview-tree-level":A+1}},`${O}:ancestor:${A}`):null),n.jsx("span",{className:"mobile-conversation-preview-guide-branch","data-continue":I,"data-first":M,style:{"--mobile-preview-tree-level":P.depth},children:n.jsx("span",{className:"mobile-conversation-preview-guide-branch-horizontal"})})]}):null,n.jsx(y$,{entry:P.item,activeSessionId:a,hasSubsessions:X,subsessionsExpanded:U,workspaceName:Y,onToggleSubsessions:X?()=>{C(O)}:void 0,onActivate:j})]}),F.length>0&&U?n.jsx("div",{className:"mobile-conversation-preview-children",children:F.map((R,A)=>N(R,{workspaceName:Y,ancestorExpanded:!0,ancestorHasNextSiblings:G,hasNextSibling:A<F.length-1,isFirstSibling:A===0}))}):null]},`${P.item.workspace.id}:${O}`)}return n.jsxs("aside",{className:"mobile-conversation-preview-rail terminal-mobile-list-rail surface-card","data-dragging":r,style:{width:`${t}px`,maxWidth:`${t}px`},...i,children:[c&&w?n.jsx("div",{className:"mobile-conversation-preview-topbar terminal-mobile-list-footer",children:n.jsxs("button",{type:"button",className:"mobile-conversation-preview-create-button workbench-import-toggle terminal-mobile-list-create",onClick:w,children:[n.jsx("span",{className:"workbench-import-toggle-symbol","aria-hidden":"true",children:"+"}),n.jsx("span",{className:"workbench-import-toggle-label",children:c})]})}):null,n.jsxs("div",{className:"mobile-conversation-preview-body terminal-mobile-list-body",children:[u.length>0?n.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-list-favorites terminal-mobile-list-group terminal-mobile-list-group-pinned",children:[n.jsxs("div",{className:"mobile-conversation-preview-group-heading terminal-mobile-list-group-heading",children:[n.jsx("span",{children:o("shell.favoriteSectionTitle")}),n.jsx("span",{className:"workbench-section-counter",children:u.length})]}),n.jsx("div",{className:"mobile-conversation-preview-list mobile-conversation-preview-list-static terminal-mobile-session-list",children:u.map(P=>n.jsx("div",{children:N(P,{workspaceName:P.item.workspace.name})},`favorite:${P.item.workspace.id}:${P.item.session.sessionId}`))})]}):null,n.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-group-workspace terminal-mobile-list-group terminal-mobile-list-group-workspace",children:[n.jsxs("div",{className:"mobile-conversation-preview-group-heading terminal-mobile-list-group-heading",children:[n.jsx("span",{children:f}),n.jsx("span",{className:"workbench-section-counter",children:d.length})]}),d.length===0?n.jsx("div",{className:"workbench-session-empty",children:o("shell.emptyWorkspaceSessions")}):n.jsx("div",{className:"mobile-conversation-preview-list terminal-mobile-session-list","data-preview-gesture":"ignore",children:d.map(P=>N(P))})]})]}),g&&y||v&&x?n.jsxs("div",{className:"mobile-conversation-preview-actions terminal-mobile-list-footer",children:[g&&y?n.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button workbench-import-toggle",onClick:()=>{y()},children:g}):null,v&&x?n.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button workbench-import-toggle",onClick:x,children:v}):null]}):null]})}function y$({entry:e,activeSessionId:t,hasSubsessions:r=!1,subsessionsExpanded:i=!1,onActivate:a,onToggleSubsessions:c,workspaceName:u}){const d=e.session.sessionId===t;return n.jsxs("article",{className:"mobile-conversation-preview-entry terminal-mobile-session-card","data-active":d,children:[r?n.jsx("button",{type:"button",className:"mobile-conversation-preview-toggle","aria-label":o(i?"shell.subagentCollapse":"shell.subagentExpand"),title:o(i?"shell.subagentCollapse":"shell.subagentExpand"),"aria-expanded":i,onClick:m=>{m.stopPropagation(),c==null||c()},children:n.jsx("span",{className:KC(e.session,{isActive:d,hasSubsessions:r}),"aria-hidden":"true"})}):n.jsx("span",{className:KC(e.session,{isActive:d,hasSubsessions:r}),"aria-hidden":"true"}),n.jsx("button",{type:"button",className:"mobile-conversation-preview-item terminal-mobile-session-primary","data-active":d,onClick:()=>a(e),children:n.jsxs("div",{className:"mobile-conversation-preview-item-body",children:[n.jsx("span",{className:"mobile-conversation-preview-item-title",children:e.session.title||o("common.unknown")}),n.jsx("span",{className:"mobile-conversation-preview-item-meta",children:Z0(e.session,u)})]})})]})}function GC(){return typeof window>"u"?390:Math.max(window.innerWidth||390,320)}function k$(e){return e instanceof Element?!!e.closest("input, textarea, select, option, label, [contenteditable='true'], [data-preview-gesture='ignore']"):!1}function KC(e,t){const r=rw("mobile-conversation-preview-indicator",e,{hasSubagents:t.hasSubsessions});return r.endsWith(" is-idle")&&t.isActive?"mobile-conversation-preview-indicator is-active":r}function Z0(e,t){const r=Vc(e);return[t??null,ds(e.provider),x$(e.lastMessageAt??e.updatedAt),r].filter(Boolean).join(" · ")}function x$(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):o("common.unknown")}function S$({open:e,busy:t,onClose:r,onConfirm:i}){return p.useEffect(()=>{if(!e)return;function a(c){c.key==="Escape"&&!t&&r()}return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[t,r,e]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),disabled:t,onClick:r}),n.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":o("shell.archiveConfirmTitle"),children:[n.jsx("div",{className:"workbench-modal-header",children:n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:o("shell.archiveConfirmTitle")}),n.jsx("p",{children:o("shell.archiveConfirmDescription")})]})}),n.jsx("div",{className:"workbench-modal-body",children:n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:r,children:o("common.cancel")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:t,onClick:()=>{i()},children:o("shell.archiveAction")})]})})]})]}),document.body)}function C$({open:e,workspaceName:t,sessions:r,restoringSessionId:i,onClose:a,onRestore:c}){return p.useEffect(()=>{if(!e)return;function u(d){d.key==="Escape"&&!i&&a()}return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[a,e,i]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),disabled:!!i,onClick:a}),n.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":o("shell.archiveModalTitle"),children:[n.jsx("div",{className:"workbench-modal-header",children:n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:o("shell.archiveModalTitle")}),n.jsx("p",{children:t?`${t} · ${o("shell.archiveModalDescription")}`:o("shell.archiveModalDescription")})]})}),n.jsx("div",{className:"workbench-modal-body",children:r.length>0?n.jsx("div",{className:"workbench-archive-list",children:r.map(u=>{const d=Vs(u.title,o("common.unknown"));return n.jsxs("article",{className:"workbench-archive-item",children:[n.jsxs("div",{className:"workbench-archive-item-main",children:[n.jsx("strong",{title:d.fullTitle,children:d.displayTitle}),n.jsx("p",{children:Z0(u)})]}),n.jsx("button",{type:"button",className:"secondary-button",disabled:i===u.sessionId,onClick:()=>{c(u.sessionId)},children:o("shell.unarchiveAction")})]},u.sessionId)})}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.archiveEmpty")})})]})]}),document.body)}function j$(e){const t=e.sourceType==="selection"?o("conversation.actionInheritedSelectionSummary",{parentTitle:e.parentTitle}):o("conversation.inheritedContextSummary",{count:e.hiddenMessageCount,parentTitle:e.parentTitle});return n.jsxs("section",{className:"conversation-inherited-context-banner",children:[n.jsx("div",{className:"conversation-inherited-context-copy",children:n.jsx("p",{title:t,children:t})}),n.jsxs("div",{className:"conversation-inherited-context-actions",children:[e.hiddenMessageCount>0?n.jsx("button",{type:"button",className:"conversation-inherited-context-icon-button","aria-label":e.expanded?o("conversation.inheritedContextCollapse"):o("conversation.inheritedContextExpand"),title:e.expanded?o("conversation.inheritedContextCollapse"):o("conversation.inheritedContextExpand"),onClick:e.onToggle,children:n.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:n.jsx(N2,{expanded:e.expanded})})}):null,e.onOpenBranchTree?n.jsx("button",{type:"button",className:"conversation-inherited-context-icon-button","aria-label":o("conversation.branchTreeAction"),title:o("conversation.branchTreeAction"),onClick:e.onOpenBranchTree,children:n.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:n.jsx(j2,{})})}):null]})]})}function N$(e){return e?e.activityState==="running"?!0:e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting":!1}function T$(e){const t=P$(e),[r,i]=p.useState(t==="show"),a=p.useRef(null);return p.useEffect(()=>{a.current!==null&&(window.clearTimeout(a.current),a.current=null),i(t==="show")},[e.sessionId]),p.useEffect(()=>{if(t==="show"){a.current!==null&&(window.clearTimeout(a.current),a.current=null),i(!0);return}if(t==="hide_immediately"){a.current!==null&&(window.clearTimeout(a.current),a.current=null),i(!1);return}!r||a.current!==null||(a.current=window.setTimeout(()=>{a.current=null,i(!1)},u$))},[t,r]),p.useEffect(()=>()=>{a.current!==null&&window.clearTimeout(a.current)},[]),r}function P$(e){const{provider:t,runningState:r,activityState:i,runtimeHasActiveRun:a,messages:c}=e;if(t!=="codex")return"hide_immediately";const u=M$(c);return u<0||R$(c,u)?"hide_immediately":D$(r,i,a)?"show":"hide_deferred"}function D$(e,t,r){return r===!0||t==="running"||e==="starting"||e==="running"||e==="reconnecting"}function R$(e,t){return e.slice(t+1).some(r=>r.role==="assistant"&&(r.kind==="text"||r.kind==="thinking"))}function M$(e){let t=-1;for(let r=e.length-1;r>=0;r-=1){const i=e[r];if(i.role==="user"&&i.kind==="text"){t=r;break}}return t}function A$(e){return e.startsWith("draft-")}function E$(e,t){if(!t||typeof t!="object")return[];const r=t.bootstrap;if(!r||typeof r!="object")return[];const i=r.sessionId,a=r.messages;return i!==e||!Array.isArray(a)?[]:a.filter(I$)}function I$(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.messageId=="string"&&typeof t.provider=="string"&&typeof t.providerSessionId=="string"&&typeof t.role=="string"&&typeof t.content=="string"&&typeof t.timestamp=="string"&&typeof t.sequence=="number"&&typeof t.rawRef=="string"}function L$(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?e.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}function F$(e,t){var u,d,m;if(!e)return null;const r=((u=e.parentSessionId)==null?void 0:u.trim())||null;if(!r||Ya(e))return null;if(e.sessionKind==="annotation"&&typeof e.annotationSourceText=="string"&&e.annotationSourceText.trim().length>0)return{parentSessionId:r,sourceType:"selection",hiddenMessageCount:1,hiddenSequenceBoundary:0,hiddenSelectionText:e.annotationSourceText,sourceMessageId:((d=e.annotationSourceMessageId)==null?void 0:d.trim())||null};const i=e.forkSourceType==="message"||e.forkSourceType==="session"?e.forkSourceType:e.forkSourceMessageId?"message":"session",a=Math.max(0,e.inheritedPrefixMessageCount??0),c=t.filter(f=>f.sequence<=a).length;return c<=0?null:{parentSessionId:r,sourceType:i,hiddenMessageCount:c,hiddenSequenceBoundary:a,hiddenSelectionText:"",sourceMessageId:((m=e.forkSourceMessageId)==null?void 0:m.trim())||null}}function _$(){return p.useEffect(()=>{const e=document.documentElement.style.background,t=document.body.style.background;return document.documentElement.style.background="transparent",document.body.style.background="transparent",()=>{document.documentElement.style.background=e,document.body.style.background=t}},[]),n.jsx("main",{className:"desktop-detach-preview-page","aria-hidden":"true",children:n.jsxs("section",{className:"desktop-detach-preview-card",children:[n.jsx("header",{className:"desktop-detach-preview-bar",children:n.jsx("strong",{className:"desktop-detach-preview-title",children:"小窗口"})}),n.jsx("div",{className:"desktop-detach-preview-body",children:n.jsx("span",{className:"desktop-detach-preview-badge"})})]})})}var kh,xh;function eR(e){var t;if("items"in e)e.items=(t=e.items)===null||t===void 0?void 0:t.map(r=>"rid"in r?r:eR(r));else if("action"in e&&e.action){const r=new xT;return r.onmessage=e.action,delete e.action,{...e,handler:r}}return e}async function Bl(e,t){const r=new xT;if(t&&typeof t=="object"&&("action"in t&&t.action&&(r.onmessage=t.action,delete t.action),"item"in t&&t.item&&typeof t.item=="object"&&"About"in t.item&&t.item.About&&typeof t.item.About=="object"&&"icon"in t.item.About&&t.item.About.icon&&(t.item.About.icon=Us(t.item.About.icon)),"icon"in t&&t.icon&&(t.icon=Us(t.icon)),"items"in t&&t.items)){let i=function(a){var c;return"rid"in a?[a.rid,a.kind]:("item"in a&&typeof a.item=="object"&&(!((c=a.item.About)===null||c===void 0)&&c.icon)&&(a.item.About.icon=Us(a.item.About.icon)),"icon"in a&&a.icon&&(a.icon=Us(a.icon)),"items"in a&&a.items&&(a.items=a.items.map(i)),eR(a))};t.items=t.items.map(i)}return Ee("plugin:menu|new",{kind:e,options:t,handler:r})}class Wl extends ST{get id(){return Ur(this,kh,"f")}get kind(){return Ur(this,xh,"f")}constructor(t,r,i){super(t),kh.set(this,void 0),xh.set(this,void 0),Ba(this,kh,r),Ba(this,xh,i)}}kh=new WeakMap,xh=new WeakMap;class Ow extends Wl{constructor(t,r){super(t,r,"MenuItem")}static async new(t){return Bl("MenuItem",t).then(([r,i])=>new Ow(r,i))}async text(){return Ee("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Ee("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return Ee("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return Ee("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return Ee("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}}class Bw extends Wl{constructor(t,r){super(t,r,"Check")}static async new(t){return Bl("Check",t).then(([r,i])=>new Bw(r,i))}async text(){return Ee("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Ee("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return Ee("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return Ee("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return Ee("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async isChecked(){return Ee("plugin:menu|is_checked",{rid:this.rid})}async setChecked(t){return Ee("plugin:menu|set_checked",{rid:this.rid,checked:t})}}var YC;(function(e){e.Add="Add",e.Advanced="Advanced",e.Bluetooth="Bluetooth",e.Bookmarks="Bookmarks",e.Caution="Caution",e.ColorPanel="ColorPanel",e.ColumnView="ColumnView",e.Computer="Computer",e.EnterFullScreen="EnterFullScreen",e.Everyone="Everyone",e.ExitFullScreen="ExitFullScreen",e.FlowView="FlowView",e.Folder="Folder",e.FolderBurnable="FolderBurnable",e.FolderSmart="FolderSmart",e.FollowLinkFreestanding="FollowLinkFreestanding",e.FontPanel="FontPanel",e.GoLeft="GoLeft",e.GoRight="GoRight",e.Home="Home",e.IChatTheater="IChatTheater",e.IconView="IconView",e.Info="Info",e.InvalidDataFreestanding="InvalidDataFreestanding",e.LeftFacingTriangle="LeftFacingTriangle",e.ListView="ListView",e.LockLocked="LockLocked",e.LockUnlocked="LockUnlocked",e.MenuMixedState="MenuMixedState",e.MenuOnState="MenuOnState",e.MobileMe="MobileMe",e.MultipleDocuments="MultipleDocuments",e.Network="Network",e.Path="Path",e.PreferencesGeneral="PreferencesGeneral",e.QuickLook="QuickLook",e.RefreshFreestanding="RefreshFreestanding",e.Refresh="Refresh",e.Remove="Remove",e.RevealFreestanding="RevealFreestanding",e.RightFacingTriangle="RightFacingTriangle",e.Share="Share",e.Slideshow="Slideshow",e.SmartBadge="SmartBadge",e.StatusAvailable="StatusAvailable",e.StatusNone="StatusNone",e.StatusPartiallyAvailable="StatusPartiallyAvailable",e.StatusUnavailable="StatusUnavailable",e.StopProgressFreestanding="StopProgressFreestanding",e.StopProgress="StopProgress",e.TrashEmpty="TrashEmpty",e.TrashFull="TrashFull",e.User="User",e.UserAccounts="UserAccounts",e.UserGroup="UserGroup",e.UserGuest="UserGuest"})(YC||(YC={}));class Ww extends Wl{constructor(t,r){super(t,r,"Icon")}static async new(t){return Bl("Icon",t).then(([r,i])=>new Ww(r,i))}async text(){return Ee("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Ee("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return Ee("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return Ee("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return Ee("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async setIcon(t){return Ee("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:Us(t)})}}class Uw extends Wl{constructor(t,r){super(t,r,"Predefined")}static async new(t){return Bl("Predefined",t).then(([r,i])=>new Uw(r,i))}async text(){return Ee("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Ee("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}}function jl([e,t,r]){switch(r){case"Submenu":return new Hw(e,t);case"Predefined":return new Uw(e,t);case"Check":return new Bw(e,t);case"Icon":return new Ww(e,t);case"MenuItem":default:return new Ow(e,t)}}class Hw extends Wl{constructor(t,r){super(t,r,"Submenu")}static async new(t){return Bl("Submenu",t).then(([r,i])=>new Hw(r,i))}async text(){return Ee("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Ee("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return Ee("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return Ee("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async append(t){return Ee("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(r=>"rid"in r?[r.rid,r.kind]:r)})}async prepend(t){return Ee("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(r=>"rid"in r?[r.rid,r.kind]:r)})}async insert(t,r){return Ee("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(i=>"rid"in i?[i.rid,i.kind]:i),position:r})}async remove(t){return Ee("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return Ee("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(jl)}async items(){return Ee("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(jl))}async get(t){return Ee("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(r=>r?jl(r):null)}async popup(t,r){var i;return Ee("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(i=r==null?void 0:r.label)!==null&&i!==void 0?i:null,at:t instanceof Ua?t:t?new Ua(t):null})}async setAsWindowsMenuForNSApp(){return Ee("plugin:menu|set_as_windows_menu_for_nsapp",{rid:this.rid})}async setAsHelpMenuForNSApp(){return Ee("plugin:menu|set_as_help_menu_for_nsapp",{rid:this.rid})}async setIcon(t){return Ee("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:Us(t)})}}class kl extends Wl{constructor(t,r){super(t,r,"Menu")}static async new(t){return Bl("Menu",t).then(([r,i])=>new kl(r,i))}static async default(){return Ee("plugin:menu|create_default").then(([t,r])=>new kl(t,r))}async append(t){return Ee("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(r=>"rid"in r?[r.rid,r.kind]:r)})}async prepend(t){return Ee("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(r=>"rid"in r?[r.rid,r.kind]:r)})}async insert(t,r){return Ee("plugin:menu|insert",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(i=>"rid"in i?[i.rid,i.kind]:i),position:r})}async remove(t){return Ee("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return Ee("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(jl)}async items(){return Ee("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(jl))}async get(t){return Ee("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(r=>r?jl(r):null)}async popup(t,r){var i;return Ee("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(i=r==null?void 0:r.label)!==null&&i!==void 0?i:null,at:t instanceof Ua?t:t?new Ua(t):null})}async setAsAppMenu(){return Ee("plugin:menu|set_as_app_menu",{rid:this.rid}).then(t=>t?new kl(t[0],t[1]):null)}async setAsWindowMenu(t){var r;return Ee("plugin:menu|set_as_window_menu",{rid:this.rid,window:(r=t==null?void 0:t.label)!==null&&r!==void 0?r:null}).then(i=>i?new kl(i[0],i[1]):null)}}async function O$(e){if(e.length===0)return;await(await kl.new({items:e.map(r=>({id:r.id,text:r.label,enabled:!r.disabled,accelerator:r.accelerator,action:()=>{r.onSelect()}}))})).popup(void 0,um())}const B$=new Set(["abstract","as","async","await","break","case","catch","class","const","continue","default","delete","do","else","enum","export","extends","false","finally","for","from","function","if","implements","import","in","instanceof","interface","let","new","null","package","private","protected","public","readonly","return","static","super","switch","this","throw","true","try","type","typeof","undefined","var","void","while","with","yield"]),W$=new Set(["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","False","finally","for","from","global","if","import","in","is","lambda","None","nonlocal","not","or","pass","raise","return","True","try","while","with","yield"]),U$=new Set(["case","do","done","elif","else","esac","export","fi","for","function","if","in","local","readonly","return","then","until","while"]),H$=new Set(["add","alter","and","as","asc","between","by","create","delete","desc","drop","from","group","having","insert","into","join","left","like","limit","not","null","offset","on","or","order","right","select","set","table","union","update","values","where"]),z$=new Set(["add","arg","cmd","copy","entrypoint","env","expose","from","healthcheck","label","maintainer","onbuild","run","shell","stopsignal","user","volume","workdir","as"]),q$=new Set(["trace","debug","info","warn","warning","error","fatal"]);function tR({workspaceId:e,filePath:t,open:r,onClose:i,onSaved:a,diffContent:c}){const[u,d]=p.useState(null),[m,f]=p.useState(""),[w,g]=p.useState(!1),[v,y]=p.useState(!1),[x,C]=p.useState("preview"),[j,N]=p.useState("default"),[P,L]=p.useState(0),[Y,H]=p.useState("fit"),[W,I]=p.useState(1),[M,O]=p.useState(1),[F,X]=p.useState(110),[U,G]=p.useState(!0),{showToast:R}=Jn(),A=pr(),Z=p.useRef(i),pe=p.useRef(R),q=p.useMemo(()=>qw(t),[t]),D=p.useMemo(()=>yV(c),[c]),T=(u==null?void 0:u.kind)??null,B=!!(u!=null&&u.capabilities.canEdit),Q=!!(u!=null&&u.capabilities.canRefresh),_=K$(T,q),de=p.useMemo(()=>Y$(u,A.isDesktop),[A.isDesktop,u]),le=p.useMemo(()=>hb(de,P),[de,P]),oe=p.useMemo(()=>X$(de,P,M,F,U),[de,P,M,F,U]),ye=p.useMemo(()=>hb(de,P),[de,P]),Ne=(u==null?void 0:u.content)??"",Me=B&&m!==Ne,Te=iR(T),Dt=db(T);if(p.useEffect(()=>{Z.current=i},[i]),p.useEffect(()=>{pe.current=R},[R]),p.useEffect(()=>{if(!r){d(null),f(""),g(!1),y(!1),C(nR(t,null)),rR({setResourceRefreshVersion:L,setImageScale:I,setImageScaleMode:H,setPdfPage:O,setPdfScale:X,setPdfFitWidth:G}),N("default");return}if(!e||!t)return;const Oe=e,Qe=t;let wt=!1;async function Ie(){g(!0);try{const Be=await df(Oe,Qe);wt||Zf(Be,Qe,{preserveMode:!1,setPreview:d,setEditorContent:f,setMode:C,setResourceRefreshVersion:L,setImageScale:I,setImageScaleMode:H,setPdfPage:O,setPdfScale:X,setPdfFitWidth:G})}catch(Be){wt||(pe.current({title:eg(Be,o("conversation.filePanelOpenFailed")),tone:"error"}),Z.current())}finally{wt||g(!1)}}return Ie(),()=>{wt=!0}},[t,r,e]),p.useEffect(()=>{if(!r)return;function Oe(Qe){Qe.key==="Escape"&&i()}return window.addEventListener("keydown",Oe),()=>{window.removeEventListener("keydown",Oe)}},[i,r]),!r||!t||typeof document>"u")return null;const st=t,dt=e;async function bt(){if(!(!dt||!(u!=null&&u.version)||!B)){y(!0);try{await HF(dt,st,m,u.version);const Oe=await df(dt,st);Zf(Oe,st,{preserveMode:!1,setPreview:d,setEditorContent:f,setMode:C,setResourceRefreshVersion:L,setImageScale:I,setImageScaleMode:H,setPdfPage:O,setPdfScale:X,setPdfFitWidth:G}),await a(st),R({title:o("conversation.filePanelSaveSuccess"),tone:"success"})}catch(Oe){R({title:eg(Oe,o("conversation.filePanelSaveFailed")),tone:"error"})}finally{y(!1)}}}async function pt(){if(!(!dt||!Q||Me)){g(!0);try{const Oe=await df(dt,st);Zf(Oe,st,{preserveMode:!0,setPreview:d,setEditorContent:f,setMode:C,setResourceRefreshVersion:L,setImageScale:I,setImageScaleMode:H,setPdfPage:O,setPdfScale:X,setPdfFitWidth:G}),L(Qe=>Qe+1)}catch(Oe){R({title:eg(Oe,o("conversation.fileViewerRefreshFailed")),tone:"error"})}finally{g(!1)}}}async function we(){if(!de)return;const Oe=await A.bridge.openExternal(de);Oe.ok||R({title:Oe.detail??o("conversation.fileViewerOpenExternalFailed"),tone:"error"})}const he=V$({canShowPreviewTab:Te,canShowCodeTab:Dt,canEdit:B}),Le=G$({preview:u,isDirty:Me,handleRefreshPreview:pt,handleOpenExternal:we,imageScaleMode:Y,imageScale:W,setImageScale:I,setImageScaleMode:H,pdfPage:M,setPdfPage:O,pdfScale:F,setPdfScale:X,pdfFitWidth:U,setPdfFitWidth:G});return Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:i}),n.jsxs("section",{className:"workbench-modal-card surface-card file-viewer-modal","data-size":j,"data-resizable":A.isDesktop&&j!=="full"?"true":void 0,role:"dialog","aria-modal":"true","aria-label":t,children:[n.jsxs("div",{className:"workbench-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:t}),n.jsx("p",{children:o("conversation.fileViewerHint").replace("{language}",_)})]}),n.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":o("common.close"),onClick:i,children:n.jsx(wV,{})})]}),n.jsxs("div",{className:"file-viewer-toolbar",children:[n.jsxs("div",{className:"file-viewer-toolbar-start",children:[n.jsxs("div",{className:"file-viewer-tabs",role:"tablist","aria-label":o("conversation.fileViewerModeLabel"),children:[he.includes("preview")?n.jsx("button",{type:"button",className:"file-viewer-tab","data-active":x==="preview",role:"tab","aria-selected":x==="preview",onClick:()=>C("preview"),children:o("conversation.fileViewerPreview")}):null,he.includes("code")?n.jsx("button",{type:"button",className:"file-viewer-tab","data-active":x==="code",role:"tab","aria-selected":x==="code",onClick:()=>C("code"),children:o("conversation.fileViewerCode")}):null,he.includes("edit")?n.jsx("button",{type:"button",className:"file-viewer-tab","data-active":x==="edit",role:"tab","aria-selected":x==="edit",onClick:()=>C("edit"),disabled:!B,children:o("conversation.fileViewerEdit")}):null]}),n.jsx("span",{className:"file-viewer-language",children:_})]}),n.jsxs("div",{className:"file-viewer-toolbar-end",children:[n.jsxs("div",{className:"file-viewer-size-group",role:"group","aria-label":o("conversation.fileViewerSizeLabel"),children:[n.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":j==="default",onClick:()=>N("default"),children:o("conversation.fileViewerSizeDefault")}),n.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":j==="wide",onClick:()=>N("wide"),children:o("conversation.fileViewerSizeWide")}),n.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":j==="full",onClick:()=>N("full"),children:o("conversation.fileViewerSizeFull")})]}),n.jsx("div",{className:"file-viewer-actions",children:Le.map(Oe=>n.jsx("button",{type:"button",className:"secondary-button file-viewer-action-button","data-active":Oe.active?"true":void 0,onClick:()=>void Oe.onClick(),disabled:Oe.disabled,children:Oe.label},Oe.id))}),B?n.jsx("button",{type:"button",className:"primary-button",onClick:()=>void bt(),disabled:!Me||v,children:o(v?"conversation.filePanelSaving":"conversation.filePanelSave")}):null]})]}),n.jsx("div",{className:"workbench-modal-body file-viewer-body",children:w?n.jsx("p",{className:"status-text",children:o("common.loading")}):(u==null?void 0:u.supported)===!1?n.jsx("p",{className:"status-text",children:u.reason??o("conversation.filePanelUnsupported")}):x==="edit"?n.jsx("textarea",{className:"file-viewer-editor","data-testid":"file-viewer-editor",value:m,onChange:Oe=>f(Oe.target.value),spellCheck:!1}):x==="preview"&&T==="html"?n.jsx(Q$,{src:ye,filePath:t}):x==="preview"&&T==="image"?n.jsx(J$,{src:le,filePath:t,scale:W,scaleMode:Y}):x==="preview"&&T==="pdf"?n.jsx(Z$,{src:oe,filePath:t}):x==="preview"&&T==="markdown"?n.jsx(eV,{content:m}):n.jsx(sR,{content:m,language:q,overviewMarkers:D})})]})]}),document.body)}function nR(e,t){return t==="markdown"||t==="html"||t==="image"||t==="pdf"||gV(e??"")||bV(e??"")?"preview":"code"}function Zf(e,t,r){r.setPreview(e),r.setEditorContent(e.content??""),r.setMode(i=>r.preserveMode&&$$(i,e.kind)?i:nR(t,e.kind)),rR(r)}function rR(e){e.setResourceRefreshVersion(0),e.setImageScale(1),e.setImageScaleMode("fit"),e.setPdfPage(1),e.setPdfScale(110),e.setPdfFitWidth(!0)}function iR(e){return e==="markdown"||e==="html"||e==="image"||e==="pdf"}function db(e){return e==="text"||e==="markdown"||e==="html"}function $$(e,t){return e==="preview"?iR(t):db(t)}function V$(e){const t=[];return e.canShowPreviewTab&&t.push("preview"),e.canShowCodeTab?(t.push("code"),t.push("edit")):e.canEdit&&t.push("edit"),t}function G$(e){var i;if(!((i=e.preview)!=null&&i.supported))return[];const t=[],r=!e.preview.capabilities.canRefresh||e.isDirty;return e.preview.kind==="image"&&t.push({id:"image-zoom-out",label:o("conversation.fileViewerZoomOut"),onClick:()=>{e.setImageScaleMode("custom"),e.setImageScale(a=>Math.max(.25,XC(a-.25)))}},{id:"image-zoom-in",label:o("conversation.fileViewerZoomIn"),onClick:()=>{e.setImageScaleMode("custom"),e.setImageScale(a=>Math.min(4,XC(a+.25)))}},{id:"image-fit",label:o("conversation.fileViewerFit"),active:e.imageScaleMode==="fit",onClick:()=>{e.setImageScaleMode("fit"),e.setImageScale(1)}},{id:"image-actual",label:o("conversation.fileViewerActualSize"),active:e.imageScaleMode==="actual",onClick:()=>{e.setImageScaleMode("actual"),e.setImageScale(1)}},{id:"image-refresh",label:o("conversation.fileViewerRefreshPreview"),disabled:r,onClick:e.handleRefreshPreview}),e.preview.kind==="pdf"&&t.push({id:"pdf-prev-page",label:o("conversation.fileViewerPreviousPage"),disabled:e.pdfPage<=1,onClick:()=>e.setPdfPage(a=>Math.max(1,a-1))},{id:"pdf-page-indicator",label:o("conversation.fileViewerPageIndicator").replace("{page}",String(e.pdfPage)),disabled:!0,onClick:()=>{}},{id:"pdf-next-page",label:o("conversation.fileViewerNextPage"),onClick:()=>e.setPdfPage(a=>a+1)},{id:"pdf-zoom-out",label:o("conversation.fileViewerZoomOut"),onClick:()=>{e.setPdfFitWidth(!1),e.setPdfScale(a=>Math.max(50,Math.round(a-10)))}},{id:"pdf-zoom-in",label:o("conversation.fileViewerZoomIn"),onClick:()=>{e.setPdfFitWidth(!1),e.setPdfScale(a=>Math.min(300,Math.round(a+10)))}},{id:"pdf-fit-width",label:o("conversation.fileViewerFitWidth"),active:e.pdfFitWidth,onClick:()=>e.setPdfFitWidth(!0)},{id:"pdf-refresh",label:o("conversation.fileViewerRefreshPreview"),disabled:r,onClick:e.handleRefreshPreview}),(e.preview.kind==="html"||e.preview.kind==="markdown"||e.preview.kind==="text")&&t.push({id:"text-refresh",label:o("conversation.fileViewerRefreshPreview"),disabled:r,onClick:e.handleRefreshPreview}),e.preview.previewUrl&&t.push({id:"open-external",label:o("conversation.fileViewerOpenExternal"),onClick:e.handleOpenExternal}),t}function K$(e,t){switch(e){case"image":return o("conversation.fileViewerImage");case"pdf":return o("conversation.fileViewerPdf");case"html":return"HTML";case"markdown":return"Markdown";default:return oR(t)}}function hb(e,t){if(!e)return null;const r=new URL(e,window.location.origin);return r.searchParams.set("_preview",String(t)),r.hash="",r.toString()}function Y$(e,t){var r;return e?!t&&e.previewPath&&typeof window<"u"&&((r=window.location)!=null&&r.origin)?new URL(e.previewPath,window.location.origin).toString():e.previewUrl??null:null}function X$(e,t,r,i,a){const c=hb(e,t);if(!c)return null;const u=new URL(c,window.location.origin),d=new URLSearchParams;return d.set("page",String(r)),d.set("zoom",a?"page-width":String(i)),u.hash=d.toString(),u.toString()}function XC(e){return Math.round(e*100)/100}function Q$({src:e,filePath:t}){return e?n.jsx("div",{className:"file-viewer-html-frame-shell",children:n.jsx("iframe",{className:"file-viewer-html-frame","data-testid":"file-viewer-html-preview",title:t,src:e,sandbox:"allow-forms allow-modals allow-scripts"},e)}):n.jsx("p",{className:"status-text",children:o("conversation.fileViewerHtmlPreviewUnavailable")})}function J$({src:e,filePath:t,scale:r,scaleMode:i}){return e?n.jsx("div",{className:"file-viewer-media-shell","data-mode":i,children:n.jsx("div",{className:"file-viewer-image-stage",children:n.jsx("img",{className:"file-viewer-image","data-testid":"file-viewer-image-preview","data-mode":i,src:e,alt:t,style:i==="fit"?void 0:{transform:`scale(${r})`}})})}):n.jsx("p",{className:"status-text",children:o("conversation.fileViewerImageUnavailable")})}function Z$({src:e,filePath:t}){return e?n.jsx("div",{className:"file-viewer-pdf-shell",children:n.jsx("iframe",{className:"file-viewer-pdf-frame","data-testid":"file-viewer-pdf-preview",title:t,src:e},e)}):n.jsx("p",{className:"status-text",children:o("conversation.fileViewerPdfUnavailable")})}function eV({content:e}){return n.jsx("div",{className:"markdown-content file-viewer-markdown",children:n.jsx(Pw,{remarkPlugins:[Aw],components:{code(t){const r=typeof t.className=="string"?t.className:"",i=/language-([\w-]+)/.exec(r);return i?n.jsx(sR,{content:String(t.children).replace(/\n$/,""),language:$w(i[1]??"plain")}):n.jsx("code",{className:r||void 0,children:t.children})}},children:e})})}function sR({content:e,language:t,overviewMarkers:r=[]}){const i=e.split(/\r?\n/),a=p.useRef(null),c=p.useMemo(()=>{const u=new Map;for(const d of r)for(let m=0;m<d.span;m++)u.set(d.line+m,d.kind);return u},[r]);return n.jsxs("div",{className:"file-viewer-code-block",children:[n.jsx("div",{className:"file-viewer-code-header",children:oR(t)}),n.jsxs("div",{className:"file-viewer-scroll-shell",children:[n.jsx("div",{className:"file-viewer-code-body",ref:a,children:i.map((u,d)=>{const m=tV(u,t),f=d+1,w=c.get(f);return n.jsxs("div",{className:`file-viewer-code-line${w?` diff-line-${w}`:""}`,children:[n.jsx("span",{className:"file-viewer-code-gutter",children:f}),n.jsx("code",{className:"file-viewer-code-content",children:m.length?m.map((g,v)=>n.jsx("span",{className:`code-token ${g.kind}`,children:g.text},`${d}-${v}-${g.text}`)):n.jsx("span",{className:"code-token plain",children:" "})})]},`${d}-${u}`)})}),n.jsx(xV,{markers:r,totalLines:i.length,scrollContainerRef:a})]})]})}function tV(e,t){const r=$w(t);return r==="json"?nV(e):r==="yaml"?aV(e):r==="toml"?oV(e):r==="ini"?aR(e):r==="env"?lV(e):r==="properties"?cV(e):r==="conf"?uV(e):r==="editorconfig"?dV(e):r==="dockerfile"?hV(e):r==="gitignore"?mV(e):r==="log"?pV(e):r==="python"?Hc(e,W$,"#"):r==="shell"?Hc(e,U$,"#"):r==="sql"?sV(e):r==="html"||r==="xml"?rV(e):r==="css"?iV(e):r==="markdown"?[{text:e,kind:"plain"}]:Hc(e,B$,"//")}function Hc(e,t,r){const i=[];let a=0;for(;a<e.length;){const c=e.slice(a);if(c.startsWith(r)){i.push({text:c,kind:"comment"});break}const u=/^(?:'[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|`[^`\\]*(?:\\.[^`\\]*)*`)/.exec(c);if(u){i.push({text:u[0],kind:"string"}),a+=u[0].length;continue}const d=/^(?:0x[\da-fA-F]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/.exec(c);if(d){i.push({text:d[0],kind:"number"}),a+=d[0].length;continue}const m=/^[A-Za-z_][\w$-]*/.exec(c);if(m){const w=m[0],g=w.toLowerCase();w==="true"||w==="false"||g==="true"||g==="false"?i.push({text:w,kind:"boolean"}):w==="null"||w==="None"||g==="none"?i.push({text:w,kind:"null"}):t.has(w)||t.has(g)?i.push({text:w,kind:"keyword"}):i.push({text:w,kind:"plain"}),a+=w.length;continue}const f=/^(?:===|!==|==|!=|<=|>=|=>|&&|\|\||[+\-*/%=<>!?:|&^~]+)/.exec(c);if(f){i.push({text:f[0],kind:"operator"}),a+=f[0].length;continue}i.push({text:c[0]??"",kind:"plain"}),a+=1}return i}function nV(e){const t=[];let r=0;for(;r<e.length;){const i=e.slice(r),a=/^"(?:[^"\\]|\\.)*"/.exec(i);if(a){const m=e.slice(r+a[0].length).trimStart()[0];t.push({text:a[0],kind:m===":"?"attr":"string"}),r+=a[0].length;continue}const c=/^(?:-?\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i.exec(i);if(c){t.push({text:c[0],kind:"number"}),r+=c[0].length;continue}const u=/^(?:true|false|null)\b/.exec(i);if(u){const m=u[0]==="null"?"null":"boolean";t.push({text:u[0],kind:m}),r+=u[0].length;continue}const d=/^(?::|,|\{|\}|\[|\])/.exec(i);if(d){t.push({text:d[0],kind:"operator"}),r+=d[0].length;continue}t.push({text:i[0]??"",kind:"plain"}),r+=1}return t}function rV(e){const t=[];let r=0;for(;r<e.length;){const i=e.slice(r);if(i.startsWith("<!--")){t.push({text:i,kind:"comment"});break}const a=/^(<\/?[\w:-]+)/.exec(i);if(a){t.push({text:a[0],kind:"tag"}),r+=a[0].length;continue}const c=/^([\w:-]+)(=)/.exec(i);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),r+=c[0].length;continue}const u=/^(?:'[^']*'|"[^"]*")/.exec(i);if(u){t.push({text:u[0],kind:"string"}),r+=u[0].length;continue}const d=/^(?:\/?>)/.exec(i);if(d){t.push({text:d[0],kind:"operator"}),r+=d[0].length;continue}t.push({text:i[0]??"",kind:"plain"}),r+=1}return t}function iV(e){const t=[];let r=0;for(;r<e.length;){const i=e.slice(r);if(i.startsWith("/*")){t.push({text:i,kind:"comment"});break}const a=/^(?:'[^']*'|"[^"]*")/.exec(i);if(a){t.push({text:a[0],kind:"string"}),r+=a[0].length;continue}const c=/^([A-Za-z-]+)(\s*:)/.exec(i);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),r+=c[0].length;continue}const u=/^(?:#(?:[\da-fA-F]{3,8})|\d+(?:\.\d+)?(?:px|rem|em|vh|vw|%)?)/.exec(i);if(u){t.push({text:u[0],kind:"number"}),r+=u[0].length;continue}const d=/^(?:@media|@supports|@import|@keyframes)\b/.exec(i);if(d){t.push({text:d[0],kind:"keyword"}),r+=d[0].length;continue}const m=/^(?:[{}:;(),.>])/.exec(i);if(m){t.push({text:m[0],kind:"operator"}),r+=m[0].length;continue}t.push({text:i[0]??"",kind:"plain"}),r+=1}return t}function sV(e){return Hc(e,H$,"--")}function aV(e){const t=[];let r=0;for(;r<e.length;){const i=e.slice(r);if(i.startsWith("#")){t.push({text:i,kind:"comment"});break}const a=/^([A-Za-z0-9_.-]+)(\s*:)/.exec(i);if(a){t.push({text:a[1]??"",kind:"attr"}),t.push({text:a[2]??"",kind:"operator"}),r+=a[0].length;continue}const c=/^(?:'[^']*'|"[^"]*")/.exec(i);if(c){t.push({text:c[0],kind:"string"}),r+=c[0].length;continue}const u=/^(?:-?\d+(?:\.\d+)?)/.exec(i);if(u){t.push({text:u[0],kind:"number"}),r+=u[0].length;continue}const d=/^(?:true|false|yes|no|null|~)\b/i.exec(i);if(d){const f=d[0].toLowerCase(),w=f==="null"||f==="~"?"null":"boolean";t.push({text:d[0],kind:w}),r+=d[0].length;continue}const m=/^(?:[-?:,[\]{}|>])/.exec(i);if(m){t.push({text:m[0],kind:"operator"}),r+=m[0].length;continue}t.push({text:i[0]??"",kind:"plain"}),r+=1}return t}function oV(e){const t=[];let r=0;for(;r<e.length;){const i=e.slice(r);if(i.startsWith("#")){t.push({text:i,kind:"comment"});break}const a=/^(\[\[?[^\]]+\]?\])/.exec(i);if(a){t.push({text:a[0],kind:"tag"}),r+=a[0].length;continue}const c=/^([A-Za-z0-9_.-]+)(\s*=)/.exec(i);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),r+=c[0].length;continue}const u=Tm(i,{trueValues:["true"],falseValues:["false"],nullValues:[]});if(u){t.push(...u.tokens),r+=u.length;continue}const d=/^(?:[,[\]{}])/.exec(i);if(d){t.push({text:d[0],kind:"operator"}),r+=d[0].length;continue}t.push({text:i[0]??"",kind:"plain"}),r+=1}return t}function aR(e){const t=[];let r=0;for(;r<e.length;){const i=e.slice(r),a=i.trimStart();if(a.startsWith(";")||a.startsWith("#")){t.push({text:i,kind:"comment"});break}const c=/^(\[[^\]]+\])/.exec(i);if(c){t.push({text:c[0],kind:"tag"}),r+=c[0].length;continue}const u=/^([A-Za-z0-9_.-]+)(\s*[=:])/.exec(i);if(u){t.push({text:u[1]??"",kind:"attr"}),t.push({text:u[2]??"",kind:"operator"}),r+=u[0].length;continue}const d=Tm(i,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(d){t.push(...d.tokens),r+=d.length;continue}t.push({text:i[0]??"",kind:"plain"}),r+=1}return t}function lV(e){if(e.trimStart().startsWith("#"))return[{text:e,kind:"comment"}];const r=/^(\s*)(export)(\s+)/.exec(e),i=r?r[0].length:0,a=[];r&&(a.push({text:r[1]??"",kind:"plain"}),a.push({text:r[2]??"",kind:"keyword"}),a.push({text:r[3]??"",kind:"plain"}));const c=e.slice(i),u=/^([A-Za-z_][A-Za-z0-9_]*)(=)/.exec(c);if(!u)return aR(e);a.push({text:u[1]??"",kind:"attr"}),a.push({text:u[2]??"",kind:"operator"});const d=c.slice(u[0].length),m=Tm(d,{trueValues:["true"],falseValues:["false"],nullValues:["null"]});return m?(a.push(...m.tokens),a):(a.push({text:d,kind:"plain"}),a)}function cV(e){return zw(e,{commentPrefixes:["#","!"],allowSection:!1,delimiters:["=",":"]})}function uV(e){return zw(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["=",":"]})}function dV(e){return zw(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["="]})}function hV(e){return Hc(e,z$,"#")}function mV(e){const t=e.trimStart();if(!t)return[];if(t.startsWith("#"))return[{text:e,kind:"comment"}];if(t.startsWith("!")){const r=e.length-t.length,i=e.slice(0,r),a=t.slice(1);return[{text:i,kind:"plain"},{text:"!",kind:"operator"},{text:a,kind:"string"}]}return[{text:e,kind:"string"}]}function pV(e){const t=[];let r=0;for(;r<e.length;){const i=e.slice(r);if(i.startsWith("#")){t.push({text:i,kind:"comment"});break}const a=/^(?:\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:[.,]\d{3,6})?(?:Z|[+-]\d{2}:\d{2})?)/.exec(i);if(a){t.push({text:a[0],kind:"tag"}),r+=a[0].length;continue}const c=/^(?:\[(TRACE|DEBUG|INFO|WARN|WARNING|ERROR|FATAL)\])/.exec(i);if(c){t.push({text:i.slice(0,c[0].length),kind:"keyword"}),r+=c[0].length;continue}const u=/^[A-Za-z_][\w-]*/.exec(i);if(u){const m=u[0];q$.has(m.toLowerCase())?t.push({text:m,kind:"keyword"}):t.push({text:m,kind:"plain"}),r+=m.length;continue}const d=/^(?:\d+(?:\.\d+)?)/.exec(i);if(d){t.push({text:d[0],kind:"number"}),r+=d[0].length;continue}t.push({text:i[0]??"",kind:"plain"}),r+=1}return t}function zw(e,t){const r=e.trimStart();if(t.commentPrefixes.some(m=>r.startsWith(m)))return[{text:e,kind:"comment"}];if(t.allowSection){const m=/^(\[[^\]]+\])/.exec(e);if(m)return[{text:m[0],kind:"tag"}]}const i=/^([A-Za-z0-9_.\-*?]+)(\s*(?:=|:))/.exec(e);if(!i)return[{text:e,kind:"plain"}];const a=(i[2]??"").trim();if(!t.delimiters.includes(a))return[{text:e,kind:"plain"}];const c=[{text:i[1]??"",kind:"attr"},{text:i[2]??"",kind:"operator"}],u=e.slice(i[0].length),d=fV(u);return d.length&&c.push(...d),c}function fV(e){if(!e)return[];const t=[];let r=0;for(;r<e.length;){const i=e.slice(r),a=Tm(i,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(a){t.push(...a.tokens),r+=a.length;continue}if(i.startsWith("#")||i.startsWith(";")){t.push({text:i,kind:"comment"});break}t.push({text:i[0]??"",kind:"plain"}),r+=1}return t}function Tm(e,t){const r=/^(?:'[^']*'|"[^"]*")/.exec(e);if(r)return{tokens:[{text:r[0],kind:"string"}],length:r[0].length};const i=/^(?:-?\d+(?:\.\d+)?)/.exec(e);if(i)return{tokens:[{text:i[0],kind:"number"}],length:i[0].length};const a=/^[A-Za-z0-9_.:+/-]+/.exec(e);if(!a)return null;const c=a[0],u=c.toLowerCase();return t.trueValues.includes(u)?{tokens:[{text:c,kind:"boolean"}],length:c.length}:t.falseValues.includes(u)?{tokens:[{text:c,kind:"boolean"}],length:c.length}:t.nullValues.includes(u)?{tokens:[{text:c,kind:"null"}],length:c.length}:{tokens:[{text:c,kind:"plain"}],length:c.length}}function qw(e){var i,a;if(!e)return"plain";const t=((i=e.split(/[\\/]/).pop())==null?void 0:i.toLowerCase())??"";if(t===".env"||t.startsWith(".env."))return"env";if(t===".editorconfig")return"editorconfig";if(t==="dockerfile"||t.endsWith(".dockerfile"))return"dockerfile";if(t===".gitignore")return"gitignore";switch(((a=e.split(".").pop())==null?void 0:a.toLowerCase())??""){case"md":case"markdown":return"markdown";case"ts":case"tsx":return"typescript";case"js":case"jsx":case"mjs":case"cjs":return"javascript";case"json":return"json";case"log":return"log";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"conf":return"conf";case"dockerfile":return"dockerfile";case"css":case"scss":case"less":return"css";case"html":case"htm":return"html";case"xml":case"svg":return"xml";case"py":return"python";case"sh":case"bash":case"zsh":return"shell";case"sql":return"sql";case"yml":case"yaml":return"yaml";case"rs":return"rust";case"go":return"go";case"java":return"java";case"c":case"h":case"cpp":case"cc":case"hpp":return"cpp";default:return"plain"}}function $w(e){const t=e.toLowerCase();switch(t){case"ts":case"tsx":case"typescript":return"typescript";case"js":case"jsx":case"javascript":return"javascript";case"bash":case"shell":case"sh":case"zsh":return"shell";case"md":case"markdown":return"markdown";case"properties":return"properties";case"toml":return"toml";case"ini":return"ini";case"env":return"env";case"conf":return"conf";case"editorconfig":return"editorconfig";case"dockerfile":return"dockerfile";case"gitignore":return"gitignore";case"log":return"log";default:return t}}function oR(e){switch($w(e)){case"typescript":return"TypeScript";case"javascript":return"JavaScript";case"markdown":return"Markdown";case"json":return"JSON";case"properties":return"Properties";case"toml":return"TOML";case"ini":return"INI";case"env":return"ENV";case"conf":return"CONF";case"editorconfig":return"EditorConfig";case"dockerfile":return"Dockerfile";case"gitignore":return"GitIgnore";case"log":return"Log";case"css":return"CSS";case"html":return"HTML";case"xml":return"XML";case"python":return"Python";case"shell":return"Shell";case"sql":return"SQL";case"yaml":return"YAML";case"rust":return"Rust";case"go":return"Go";case"java":return"Java";case"cpp":return"C/C++";default:return o("conversation.fileViewerPlainText")}}function gV(e){return qw(e)==="markdown"}function bV(e){return qw(e)==="html"}function eg(e,t){return e instanceof Kr?e.message:t}function wV(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M4.2 4.2l7.6 7.6M11.8 4.2l-7.6 7.6",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function vV(e){const t=[],r=e.replace(/\r\n/g,`
|
|
108
|
-
`).split(`
|
|
109
|
-
`);let i=0,a=0;for(const c of r){if(c.startsWith("diff --git")||c.startsWith("index ")||c.startsWith("--- ")||c.startsWith("+++ ")){t.push({kind:"meta",text:c,oldLineNo:null,newLineNo:null});continue}const u=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(c);if(u){i=parseInt(u[1],10),a=parseInt(u[2],10),t.push({kind:"hunk",text:c,oldLineNo:null,newLineNo:null});continue}if(c.startsWith(" ")||c===""){t.push({kind:"context",text:c.slice(1),oldLineNo:i,newLineNo:a}),i++,a++;continue}if(c.startsWith("+")){t.push({kind:"add",text:c.slice(1),oldLineNo:null,newLineNo:a}),a++;continue}if(c.startsWith("-")){t.push({kind:"remove",text:c.slice(1),oldLineNo:i,newLineNo:null}),i++;continue}t.push({kind:"meta",text:c,oldLineNo:null,newLineNo:null})}return t}function yV(e){if(!(e!=null&&e.trim()))return[];const t=vV(e),r=[];let i=0,a=[];function c(){if(a.length===0){i=0;return}const u=i>0?"modify":"add";kV(r,a,u),i=0,a=[]}for(const u of t){if(u.kind==="remove"){i+=1;continue}if(u.kind==="add"){u.newLineNo!==null&&a.push(u.newLineNo);continue}c()}return c(),r}function kV(e,t,r){const i=t.filter(u=>u>0);if(i.length===0)return;let a=i[0]??1,c=a;for(let u=1;u<i.length;u+=1){const d=i[u]??c;if(d===c+1){c=d;continue}e.push({line:a,span:c-a+1,kind:r}),a=d,c=d}e.push({line:a,span:c-a+1,kind:r})}function xV({markers:e,totalLines:t,scrollContainerRef:r}){const[i,a]=p.useState({top:0,height:0});if(p.useEffect(()=>{const u=r.current;if(!u){a({top:0,height:0});return}const d=u;function m(){const{clientHeight:f,scrollHeight:w,scrollTop:g}=d;if(w<=0||f<=0||w<=f){a({top:0,height:0});return}const v=f/w,y=Math.min(100,Math.max(12,v*100)),x=w-f,C=Math.max(0,100-y),j=x<=0?0:g/x*C;a({top:j,height:y})}return m(),d.addEventListener("scroll",m,{passive:!0}),window.addEventListener("resize",m),()=>{d.removeEventListener("scroll",m),window.removeEventListener("resize",m)}},[r]),e.length===0&&i.height===0)return null;const c=Math.max(t,1);return n.jsxs("div",{className:"file-overview-ruler","data-testid":"file-overview-ruler","aria-hidden":"true",children:[e.map(u=>{const d=(u.line-1)/c*100,m=Math.max(2,u.span/c*100);return n.jsx("div",{className:`file-overview-marker is-${u.kind}`,"data-kind":u.kind,style:{top:`${d}%`,height:`${m}%`}},`${u.kind}-${u.line}-${u.span}`)}),i.height>0?n.jsx("div",{className:"file-overview-viewport",style:{top:`${i.top}%`,height:`${i.height}%`}}):null]})}function Do(e){const t=e.toLowerCase();if(t===".env"||t.startsWith(".env."))return"ENV";if(t.endsWith(".d.ts"))return"DTS";switch(t.includes(".")?t.slice(t.lastIndexOf(".")+1):""){case"ts":return"TS";case"tsx":return"TSX";case"js":return"JS";case"jsx":return"JSX";case"json":return"{}";case"md":return"MD";case"css":return"CSS";case"scss":return"SASS";case"html":return"HTML";case"yml":case"yaml":return"YAML";case"png":case"jpg":case"jpeg":case"gif":case"svg":case"webp":return"IMG";case"txt":return"TXT";default:return"FILE"}}function Ro(e){const t=e.toLowerCase();return t===".env"||t.startsWith(".env.")?"env":t.endsWith(".md")?"md":t.endsWith(".css")||t.endsWith(".scss")?"style":t.endsWith(".png")||t.endsWith(".jpg")||t.endsWith(".jpeg")||t.endsWith(".gif")||t.endsWith(".svg")||t.endsWith(".webp")?"image":t.endsWith(".ts")||t.endsWith(".tsx")||t.endsWith(".js")||t.endsWith(".jsx")?"code":t.endsWith(".json")||t.endsWith(".yml")||t.endsWith(".yaml")?"data":"default"}const SV=new Set([".ds_store","thumbs.db","ehthumbs.db","desktop.ini",".spotlight-v100",".trashes",".fseventsd","__macosx","$recycle.bin","system volume information",".apdisk",".appledouble",".temporaryitems"]),CV=["._"];function tg(e){return e.split(/[/\\]/).filter(Boolean).pop()??e}function jV(e){const t=e.trim().toLowerCase();return t?SV.has(t)||CV.some(r=>t.startsWith(r)):!1}function Vw(e,t,r){return r?[...e]:e.filter(i=>!jV(t(i)))}function Sh(e,t){return Vw(e,r=>r.name,t)}function NV(e,t){return t?e:Object.entries(e).reduce((r,[i,a])=>(r[i]=Sh(a,!1),r),{})}async function ng(e,t){const[r,i]=await Promise.all([BT(t),ZL(e)]);return TV(r.changes,i.items)}function TV(e,t){const r=new Set(t.map(i=>jh(i.path)));return e.filter(i=>r.has(jh(i.path))||i.oldPath!==null&&r.has(jh(i.oldPath)))}function PV(e){const t=QC("","");for(const r of e){const i=jh(r.path),a=i.split("/").filter(Boolean);let c=t;a.forEach((u,d)=>{const m=a.slice(0,d+1).join("/");if(d===a.length-1){c.children.set(`file:${m}`,{kind:"file",name:u,path:i,change:r});return}const f=`directory:${m}`,w=c.children.get(f);if(w&&w.kind==="directory"){c=w;return}const g=QC(u,m);c.children.set(f,g),c=g})}return uR(cR([...t.children.values()]))}function lR(e,t){const r=e.oldPath?`${e.oldPath} -> ${e.path}`:e.path;return Gw(e)?`${r} ${t}`:r}function Gw(e){return e.status==="D"||e.stagedStatus==="D"||e.worktreeStatus==="D"}function Ch(e){return e.split("/").filter(Boolean).pop()??e}function jh(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").trim()}function QC(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function cR(e){return[...e].sort((t,r)=>t.kind!==r.kind?t.kind==="directory"?-1:1:t.name.localeCompare(r.name,"zh-CN")).map(t=>t.kind==="directory"?{kind:"directory",name:t.name,path:t.path,children:cR([...t.children.values()])}:t)}function uR(e){return e.map(t=>{var u;if(t.kind!=="directory")return t;const r=uR(t.children);let i=t.name,a=t.path,c=r;for(;c.length===1&&((u=c[0])==null?void 0:u.kind)==="directory";){const d=c[0];i=`${i}/${d.name}`,a=d.path,c=d.children}return{kind:"directory",name:i,path:a,children:c}})}const DV=450,RV=60*1e3,JC=20,ZC=16;function MV({sessionId:e,workspaceId:t,showSystemFiles:r,selectedPath:i,refreshVersion:a,onCountChange:c,onSelectFile:u,onOpenFile:d}){const[m,f]=p.useState("tree"),[w,g]=p.useState([]),[v,y]=p.useState(!0),[x,C]=p.useState(!1),[j,N]=p.useState([]),P=p.useRef(null),{showToast:L}=Jn();p.useEffect(()=>{const G=Lr(Qd(t,e),RV);f("tree"),g(G??[]),y(G===null),C(!1),N([]),P.current=null},[e,t]),p.useEffect(()=>{let G=!1;async function R(){y(!0);try{const A=await ng(e,t);G||(g(A),Ei(Qd(t,e),A))}catch(A){G||L({title:rg(A,o("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{G||y(!1)}}return R(),()=>{G=!0}},[a,e,L,t]);async function Y(){y(!0);try{const G=await ng(e,t);g(G),Ei(Qd(t,e),G)}catch(G){L({title:rg(G,o("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{y(!1)}}async function H(){if(F.length!==0){C(!0);try{await UT(t,F.map(R=>R.path));const G=await ng(e,t);g(G),Ei(Qd(t,e),G),L({title:o("conversation.filePanelSessionStageSuccess"),tone:"success"})}catch(G){L({title:rg(G,o("git.stageFailed")),tone:"error"})}finally{C(!1)}}}function W(G){N(R=>R.includes(G)?R.filter(A=>A!==G):[...R,G])}function I(G){const R=Date.now(),A=P.current;return P.current={filePath:G,timestamp:R},(A==null?void 0:A.filePath)===G&&R-A.timestamp<=DV}async function M(G,R){if(R&&I(G)){await d(G),P.current=null;return}R||(P.current=null),await u(G)}const O=p.useMemo(()=>Vw(w,G=>Ch(G.path),r),[w,r]),F=O.filter(G=>!G.staged),X=PV(O),U=new Set(j);return p.useEffect(()=>{c==null||c(O.length)},[c,O.length]),n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"file-panel-session-toolbar",children:[n.jsxs("div",{className:"file-panel-view-modes",role:"tablist","aria-label":o("conversation.filePanelSessionViewLabel"),children:[n.jsx("button",{className:m==="tree"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":m==="tree",onClick:()=>f("tree"),children:o("conversation.filePanelSessionTreeView")}),n.jsx("button",{className:m==="list"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":m==="list",onClick:()=>f("list"),children:o("conversation.filePanelSessionListView")})]}),n.jsxs("div",{className:"file-panel-session-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void Y(),disabled:v||x,children:o("conversation.filePanelRefresh")}),n.jsx("button",{className:"primary-button",type:"button",onClick:()=>void H(),disabled:x||F.length===0,children:o("conversation.filePanelSessionStageAll")})]})]}),n.jsxs("div",{className:"file-panel-session-summary",children:[n.jsx("span",{children:`${o("conversation.filePanelSessionSummary")} ${O.length}`}),n.jsx("span",{children:`${o("conversation.filePanelSessionUnstagedSummary")} ${F.length}`})]}),n.jsx("div",{className:"file-tree",children:v?n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelSessionLoading")}):O.length===0?n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelSessionEmpty")}):m==="tree"?dR({nodes:X,depth:0,collapsedPathSet:U,selectedPath:i,onToggleTreePath:W,onFileClick:M}):AV({items:O,selectedPath:i,onFileClick:M})})]})}function dR({nodes:e,depth:t,collapsedPathSet:r,selectedPath:i,onToggleTreePath:a,onFileClick:c}){return e.map(u=>{if(u.kind==="directory"){const d=!r.has(u.path);return n.jsxs("div",{className:"file-tree-node",children:[n.jsxs("button",{className:"file-tree-item",type:"button","data-kind":"directory","aria-expanded":d,style:{paddingInlineStart:`${JC+t*ZC}px`},onClick:()=>a(u.path),children:[n.jsx("span",{className:"file-tree-chevron","aria-hidden":"true",children:d?"v":">"}),n.jsx("span",{className:"file-tree-label",children:u.name})]}),d?n.jsx("div",{className:"file-tree-children",children:dR({nodes:u.children,depth:t+1,collapsedPathSet:r,selectedPath:i,onToggleTreePath:a,onFileClick:c})}):null]},`session-directory:${u.path}`)}return n.jsx("div",{className:"file-tree-node",children:n.jsxs("button",{className:"file-tree-item is-session-change",type:"button","data-active":i===u.change.path,"data-kind":"file",style:{paddingInlineStart:`${JC+t*ZC}px`},onClick:()=>void c(u.change.path,!Gw(u.change)),children:[n.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),n.jsx("span",{className:"git-tree-file-icon","data-kind":Ro(u.name),"aria-hidden":"true",children:Do(u.name)}),n.jsxs("span",{className:"file-tree-label",children:[n.jsx("span",{className:"file-tree-name",children:u.name}),n.jsx("span",{className:"file-tree-path",children:lR(u.change,o("conversation.filePanelSessionDeleted"))})]}),n.jsxs("span",{className:"file-session-item-meta",children:[n.jsx("span",{className:"file-session-badge","data-status":u.change.status,children:u.change.status}),n.jsx("span",{className:"file-session-badge subtle",children:u.change.staged?o("git.stagedLabel"):o("git.workingTreeLabel")})]})]})},`session-file:${u.path}`)})}function AV({items:e,selectedPath:t,onFileClick:r}){return e.map(i=>n.jsx("div",{className:"file-session-list-item",children:n.jsxs("button",{className:"file-session-list-button",type:"button","data-active":t===i.path,onClick:()=>void r(i.path,!Gw(i)),children:[n.jsx("span",{className:"git-tree-file-icon","data-kind":Ro(Ch(i.path)),"aria-hidden":"true",children:Do(Ch(i.path))}),n.jsxs("span",{className:"file-tree-label",children:[n.jsx("span",{className:"file-tree-name",children:Ch(i.path)}),n.jsx("span",{className:"file-tree-path",children:lR(i,o("conversation.filePanelSessionDeleted"))})]}),n.jsxs("span",{className:"file-session-item-meta",children:[n.jsx("span",{className:"file-session-badge","data-status":i.status,children:i.status}),n.jsx("span",{className:"file-session-badge subtle",children:i.staged?o("git.stagedLabel"):o("git.workingTreeLabel")})]})]})},`session-list:${i.path}`))}function Qd(e,t){return`file-panel.session-changes.${e}.${t}`}function rg(e,t){return e instanceof Kr?e.message:typeof e=="object"&&e&&"message"in e?String(e.message??t):t}const ur="",EV=450,Os=8,Jd=4,IV=176,LV=120,FV=300*1e3,_V=60*1e3,ej=1600,OV=20,BV=16;function Kw({className:e,sessionId:t,workspaceId:r,hideHeading:i=!1,externalRevealRequest:a=null,externalWindowMode:c=!1,workbenchShellOverrides:u}){var Ut,Yr;const d=Tr(),{navigationGroups:m,subscribeFileTree:f,requestFileTreeRefresh:w,addFileTreeSnapshotListener:g,subscribeGitSnapshot:v,requestGitRefresh:y,addGitSnapshotListener:x}={...d,...u},[C,j]=p.useState({}),[N,P]=p.useState([]),[L,Y]=p.useState([]),[H,W]=p.useState(ur),[I,M]=p.useState([]),[O,F]=p.useState(null),[X,U]=p.useState(!1),[G,R]=p.useState(!1),[A,Z]=p.useState(!1),[pe,q]=p.useState(!1),[D,T]=p.useState(""),[B,Q]=p.useState(null),[_,de]=p.useState(!1),[le,oe]=p.useState(null),[ye,Ne]=p.useState("workspace"),[Me,Te]=p.useState(0),[Dt,st]=p.useState(0),[dt,bt]=p.useState(!1),[pt,we]=p.useState(!1),[he,Le]=p.useState(null),[Oe,Qe]=p.useState(null),[wt,Ie]=p.useState(null),[Be,vt]=p.useState(null),[ft,ve]=p.useState([]),[Ae,et]=p.useState(!1),[We,lt]=p.useState(null),ct=p.useRef({}),Vt=p.useRef([]),Bt=p.useRef(ur),Wt=p.useRef(!1),Lt=p.useRef(null),Nt=p.useRef(null),ln=p.useRef(null),Jt=p.useRef(null),Sn=p.useRef(null),se=p.useRef(null),He=p.useRef(0),xt=p.useRef(new Map),{showToast:Tt}=Jn(),Mn=pr(),wn=us($=>$.showSystemFiles),kn=!!(t!=null&&t.trim()),Ht=i&&Mn.isMobile;p.useEffect(()=>{sn("file_panel.props",{sessionId:t,workspaceId:r,externalWindowMode:c})},[c,t,r]),p.useEffect(()=>{Bt.current=H},[H]);function Gt($){j(me=>{const ge=typeof $=="function"?$(me):$;return ct.current=ge,ge})}function dn($){P(me=>{const ge=typeof $=="function"?$(me):$;return Vt.current=ge,ge})}p.useEffect(()=>{var Ge,gt;if(De(),!r){De(),Wt.current=!1,ct.current={},Vt.current=[],Bt.current=ur,Gt({}),dn([]),Y([]),W(ur),q(!1),T(""),Q(null),de(!1),U(!1),et(!1),lt(null),M([]),F(null),Le(null),Qe(null),Ie(null);return}Wt.current=!0;const $=Lr(sj(r),FV);sn("file_panel.workspace_snapshot",{workspaceId:r,cached:!!$,cachedRootItems:((gt=(Ge=$==null?void 0:$.treeCache)==null?void 0:Ge[ur])==null?void 0:gt.length)??0,cachedDirectoryCount:Object.keys(($==null?void 0:$.treeCache)??{}).length});const me=t8(($==null?void 0:$.activeDirectoryPath)??ur,($==null?void 0:$.treeCache)??{}),ge=ij(($==null?void 0:$.expandedDirectories)??[],me),Ye=th(($==null?void 0:$.treeCache)??{},me,ge);ct.current=Ye,Vt.current=ge,Bt.current=me,Gt(Ye),dn(ge),Y([]),W(me),U(!1),R(!1),q(!1),T(""),Q(null),de(!1),queueMicrotask(()=>{Wt.current=!1})},[r]),p.useEffect(()=>{if(!a||a.workspaceId!==r)return;const $=()=>{if(se.current===a.requestId)return;se.current=a.requestId,Ne("workspace"),(a.openViewer?ir(a.filePath):Hn(a.filePath)).catch(ge=>{Tt({title:Bs(ge,o("conversation.filePanelOpenFailed")),tone:"error"})})};if(Wt.current){queueMicrotask($);return}$()},[a,ir,Hn,Tt,r]),p.useEffect(()=>{if(r)return g($=>{$.workspaceId===r&&(Gt(me=>({...me,[$.path]:$.items})),$.path===ur&&U(!1),Y(me=>me.filter(ge=>ge!==$.path)),bn($.path,$.items))})},[g,r]),p.useEffect(()=>()=>{De()},[]),p.useEffect(()=>{r&&f(r,sg(Vt.current,Bt.current))},[H,N,f,r]),p.useEffect(()=>{M([]),F(null),oe(null),lt(null),Te(0),bt(!1),we(!1),Le(null),Qe(null),Ie(null),Lt.current=null,He.current+=1},[t]),p.useEffect(()=>{!kn&&ye==="session"&&Ne("workspace")},[ye,kn]),p.useEffect(()=>{if(!dt&&!pt&&!he)return;function $(ge){var cn,jn,zn;if(!(ge.target instanceof Node))return;const Ye=((cn=Nt.current)==null?void 0:cn.contains(ge.target))??!1,Ge=((jn=ln.current)==null?void 0:jn.contains(ge.target))??!1,gt=((zn=Jt.current)==null?void 0:zn.contains(ge.target))??!1;!Ye&&!Ge&&!gt&&(bt(!1),we(!1),Le(null),Qe(null))}function me(ge){ge.key==="Escape"&&(bt(!1),we(!1),Le(null),Qe(null))}return document.addEventListener("pointerdown",$),document.addEventListener("keydown",me),()=>{document.removeEventListener("pointerdown",$),document.removeEventListener("keydown",me)}},[dt,pt,he]),p.useLayoutEffect(()=>{if(!he||typeof window>"u"){Qe(null);return}const $=he;function me(){const Ye=Jt.current;if(!Ye)return;const Ge=Ye.getBoundingClientRect();Qe(GV({x:$.positionX,y:$.positionY},{width:Ge.width||IV,height:Ge.height||Ye.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}me();const ge=window.requestAnimationFrame(me);return window.addEventListener("resize",me),window.addEventListener("scroll",me,!0),()=>{window.cancelAnimationFrame(ge),window.removeEventListener("resize",me),window.removeEventListener("scroll",me,!0)}},[he]),p.useEffect(()=>{if(!r)return;const $=ij(N,H),me=th(C,H,$);Ei(sj(r),{treeCache:me,expandedDirectories:$,activeDirectoryPath:H})},[H,N,C,r]),p.useEffect(()=>{if(Wt.current)return;const $=th(C,H,N);r8(C,$)||Gt($)},[H,N,C]),p.useEffect(()=>{let $=!1;const me=(r==null?void 0:r.trim())??null;async function ge(Ge){if(!me)return;const gt=Sh(ct.current[ur]??[],wn),cn=(Ge==null?void 0:Ge.silent)!==!0&>.length===0;cn&&U(!0),sn("file_panel.load_root_tree.start",{sessionId:t,workspaceId:me,silent:(Ge==null?void 0:Ge.silent)===!0,cachedRootItems:gt.length});try{const jn=await Fn(ur,{force:!0});$||(sn("file_panel.load_root_tree.end",{sessionId:t,workspaceId:me,itemCount:jn.length}),Gt(zn=>({...th(zn,Bt.current,Vt.current),[ur]:jn})))}catch(jn){!$&&!aj(jn)&&Tt({title:Bs(jn,o("conversation.filePanelLoadFailed")),tone:"error"})}finally{!$&&cn&&U(!1)}}if(Sh(ct.current[ur]??[],wn).length>0){const Ge=window.setTimeout(()=>{me&&(f(me,sg(Vt.current,Bt.current)),ge({silent:!0}))},1500);return()=>{$=!0,window.clearTimeout(Ge)}}return ge(),()=>{$=!0}},[t,wn,Tt,r]),p.useEffect(()=>{if(!r||!t){st(0);return}const $=Lr(i8(r,t),_V);sn("file_panel.session_change_count.snapshot",{sessionId:t,workspaceId:r,cached:$!==null,cachedCount:$}),st($??0)},[t,Me,r]),p.useEffect(()=>{if(!r){ve([]);return}const $=r.trim();v($),y($)},[r,v,y]),p.useEffect(()=>{if(!r)return;const $=r.trim();return x(me=>{var ge;me.workspaceId===$&&ve(((ge=me.status)==null?void 0:ge.changes)??[])})},[x,r]);const hn=p.useMemo(()=>Vw(ft,$=>tg($.path),wn),[ft,wn]),te=p.useMemo(()=>{const $=new Map,me=new Set;for(const ge of hn){const Ye=ge.path.replace(/\\/g,"/"),Ge=ge.worktreeStatus??ge.stagedStatus??ge.status;$.set(Ye,Ge);const gt=Ye.split("/");for(let cn=1;cn<gt.length;cn++)me.add(gt.slice(0,cn).join("/"))}return{statusByPath:$,changedDirs:me}},[hn]),re=p.useMemo(()=>NV(C,wn),[wn,C]),ue=p.useMemo(()=>B===null?null:Sh(B,wn),[B,wn]),Se=re[ur]??[],_e=pe&&ue!==null,ze=p.useMemo(()=>Ae?mb(Se,re,te.statusByPath,te.changedDirs):Se,[te.changedDirs,te.statusByPath,Se,Ae,re]),yt=p.useMemo(()=>_e?(ue??[]).map($=>ks($.path,$.kind)):hR(ze,re,N,Ae,te.statusByPath,te.changedDirs),[N,te.changedDirs,te.statusByPath,_e,Ae,ue,re,ze]),nt=((Ut=m.find($=>$.workspace.id===r))==null?void 0:Ut.workspace)??null,Ve=rj(I),ne=(Ve==null?void 0:Ve.path)??null,je=(Ve==null?void 0:Ve.kind)==="file"?Ve.path:null,ht=p.useMemo(()=>new Set(I.map($=>$.path)),[I]),Rt=p.useMemo(()=>eh(I),[I]),tn=!!(nt!=null&&nt.path&&I.length===1&&ne),Kt=I.length===1&&(Ve==null?void 0:Ve.kind)==="file",$t=Rt.length>0,Zt=Rt.length>0,Tn=!!(Be!=null&&Be.items.length&&r),Zn=!!((je?la(je):H)&&N.length);async function Cn($,me=!1){if(!r)return[];if(!me){const ge=ct.current[$];if(ge)return ge}$===ur?U(!0):Y(ge=>Th(ge,$));try{const ge=await Fn($,{force:me});return Gt(Ye=>({...Ye,[$]:ge})),ge}catch(ge){throw aj(ge)||Tt({title:Bs(ge,o("conversation.filePanelLoadFailed")),tone:"error"}),ge}finally{$===ur?U(!1):Y(ge=>ge.filter(Ye=>Ye!==$))}}async function _t($){if(!r)return;const me=($==null?void 0:$.activeDirectoryPath)??Bt.current,ge=($==null?void 0:$.expandedDirectories)??Vt.current,Ye=n8(ct.current,me,ge);sn("file_panel.refresh_tree_cache.start",{sessionId:t,workspaceId:r,targetDirectories:Ye});const gt=(await Promise.all(Ye.map(async cn=>{const jn=await Fn(cn,{force:!0});return[cn,jn]}))).reduce((cn,[jn,zn])=>(cn[jn]=zn,cn),{});sn("file_panel.refresh_tree_cache.end",{sessionId:t,workspaceId:r,targetDirectories:Ye,directoryCount:Object.keys(gt).length}),Gt(gt)}async function Fn($,me){if(!r)return[];if(!(me!=null&&me.force)){const Ye=ct.current[$];if(Ye)return Ye}const ge=sg(Th(Vt.current,$),$||Bt.current);return f(r,ge),w(r,[$]),mn($,ej,{allowCached:(me==null?void 0:me.force)!==!0})}function mn($,me=ej,ge){const Ye=ct.current[$];return(ge==null?void 0:ge.allowCached)!==!1&&Ye?Promise.resolve(Ye):new Promise((Ge,gt)=>{const cn=window.setTimeout(()=>{Ce($,cn),gt(new Error(`FILE_TREE_SNAPSHOT_TIMEOUT:${$}`))},me),jn=xt.current.get($)??[];xt.current.set($,[...jn,{resolve:Ge,reject:gt,timerId:cn}])})}function bn($,me){const ge=xt.current.get($)??[];ge.length!==0&&(xt.current.delete($),ge.forEach(Ye=>{window.clearTimeout(Ye.timerId),Ye.resolve(me)}))}function Ce($,me){const Ye=(xt.current.get($)??[]).filter(Ge=>Ge.timerId!==me);if(Ye.length===0){xt.current.delete($);return}xt.current.set($,Ye)}function De(){for(const[$,me]of xt.current.entries())me.forEach(ge=>{window.clearTimeout(ge.timerId),ge.reject(new Error(`FILE_TREE_ABORTED:${$}`))});xt.current.clear()}function mt($){M([$]),F($.path)}function Mt($){W($.kind==="directory"?$.path:la($.path))}function en($){const me=HV(yt,O,$);M(me),F($.path),Mt($)}function An($){const me=UV(I,$),ge=rj(me);M(me),F($.path),ge&&Mt(ge)}function zt($){mt($),Mt($)}function er($,me){if(me!=null&&me.shiftKey){en($);return}if(Zd(me)){An($);return}zt($)}async function fr($,me=!1){const ge=ru($,me);if(!ge.length){W(ur);return}dn(Ye=>fR(Ye,ge)),W(ge[ge.length-1]??ur);for(const Ye of ge)try{await Cn(Ye)}catch{return}}async function Hn($){const me=ks($,"file");mt(me),Mt(me),await fr($)}async function ir($){oe($),lt(null),Lt.current=null,He.current+=1,Hn($);const me=He.current,ge=$.replace(/\\/g,"/"),Ye=te.statusByPath.get(ge);if(r&&Ye&&Ye!=="?"&&Ye!=="D")try{const Ge=await WT(r,$,!1);He.current===me&<(Ge.content||null)}catch{He.current===me&<(null)}}function vr($){const me=Date.now(),ge=Lt.current;return Lt.current={filePath:$,timestamp:me},(ge==null?void 0:ge.filePath)===$&&me-ge.timestamp<=EV}function On(){Lt.current=null}async function Sr($,me){const ge=ks($,"file");if(me!=null&&me.shiftKey||Zd(me)){On(),er(ge,me);return}if(vr($)){await ir($);return}er(ge,me),await fr($)}function Fi(){q(!1),T(""),Q(null),On()}async function _i($,me){const ge=ks($.path,$.kind);if(me!=null&&me.shiftKey||Zd(me)){On(),er(ge,me);return}if($.kind==="directory"){Fi(),er(ge,me),await Hr($.path);return}if(vr($.path)){Fi(),await ir($.path);return}await Hn($.path)}async function Hr($){if(mt(ks($,"directory")),W($),!Vt.current.includes($))try{await Cn($),dn(me=>Th(me,$))}catch{}}async function sr($){if(mt(ks($,"directory")),W($),Vt.current.includes($)){Pr($);return}await Hr($)}function Pr($){dn(me=>me.filter(ge=>ge!==$&&!ge.startsWith(`${$}/`))),W(la($)),M([]),F(null)}async function un(){if(!r)return;const $=r;try{if(y($),await _t(),je&&await fr(je),_e&&D.trim()){const me=await Pc($,D.trim());Q(me.items)}}catch(me){Tt({title:Bs(me,o("conversation.filePanelLoadFailed")),tone:"error"})}}async function Jr($){if($==null||$.preventDefault(),!r||!D.trim()){Q(null);return}de(!0);try{const me=await Pc(r,D.trim());Q(me.items)}catch(me){Tt({title:Bs(me,o("conversation.filePanelSearchFailed")),tone:"error"})}finally{de(!1)}}function ar(){if(pe){q(!1),T(""),Q(null);return}q(!0)}function ee($){we(!1),$()}function Ke(){var $;($=Sn.current)==null||$.click()}async function Je($){var gt;const me=((gt=$.target.files)==null?void 0:gt[0])??null;if($.target.value="",!me||!r)return;const ge=WV(me.name);if(!ge){Tt({title:o("conversation.filePanelUploadFailed"),tone:"error"});return}const Ye=tj(H,Ve),Ge=nj(Ye,ge);Z(!0);try{const cn=await XV(me);await zF({workspaceId:r,path:Ge,contentBase64:cn}),await _t(),await Hn(Ge),Tt({title:o("conversation.filePanelUploadSuccess",{name:ge}),tone:"success"})}catch(cn){Tt({title:Bs(cn,o("conversation.filePanelUploadFailed")),tone:"error"})}finally{Z(!1)}}async function Et($=je){if(!(!r||!$)){Z(!0);try{const me=await qF(r,$),ge=QV(me.contentBase64);JV(me.fileName,new Blob([ge],{type:"application/octet-stream"})),Tt({title:o("conversation.filePanelDownloadSuccess",{name:me.fileName}),tone:"success"})}catch(me){Tt({title:Bs(me,o("conversation.filePanelDownloadFailed")),tone:"error"})}finally{Z(!1)}}}function an(){const $=je?la(je):H;!$||!Vt.current.includes($)||Pr($)}async function on($,me=tj(H,Ve)){if(!r)return;const ge=me,Ye=ge?`${ge}/`:"",Ge=window.prompt(o($==="create_file"?"conversation.filePanelCreateFilePrompt":"conversation.filePanelCreateDirectoryPrompt"),Ye);if(!(Ge!=null&&Ge.trim()))return;const gt=Ge.trim();R(!0);try{await uf({workspaceId:r,opType:$,dstPath:gt,content:$==="create_file"?"":void 0}),await _t(),$==="create_directory"?(await fr(gt,!0),mt(ks(gt,"directory")),W(gt)):await Hn(gt)}catch(cn){Tt({title:Bs(cn,o("conversation.filePanelMutateFailed")),tone:"error"})}finally{R(!1)}}function nn($,me=Rt){var Ye;if(me.length===0)return;const ge=eh(me);vt({mode:$,items:ge}),M(ge),F(((Ye=ge[ge.length-1])==null?void 0:Ye.path)??null),Tt({title:$==="copy"?o("conversation.filePanelCopySelectionSuccess",{count:ge.length}):o("conversation.filePanelCutSelectionSuccess",{count:ge.length}),tone:"success"}),Le(null)}async function Dr($=$V(Ve,H)){if(!r||!Be||!Be.items.length)return;const me=$??ur,ge=Be.items.map(Ye=>({source:Ye,destinationPath:nj(me,tg(Ye.path)||Ye.path)}));R(!0);try{for(const gt of ge)Be.mode==="cut"&&Nh(gt.source.path)===Nh(gt.destinationPath)||await uf({workspaceId:r,opType:Be.mode==="copy"?"copy":"move",srcPath:gt.source.path,dstPath:gt.destinationPath});const Ye=ge.map(gt=>ks(gt.destinationPath,gt.source.kind)),Ge=Ye[Ye.length-1]??null;if(Be.mode==="cut"&&vt(null),M(Ye),F((Ge==null?void 0:Ge.path)??null),Ge&&Mt(Ge),On(),await _t({activeDirectoryPath:(Ge==null?void 0:Ge.kind)==="directory"?Ge.path:Ge?la(Ge.path):Bt.current,expandedDirectories:Vt.current}),_e&&D.trim()){const gt=await Pc(r,D.trim());Q(gt.items)}Te(gt=>gt+1),Tt({title:o("conversation.filePanelPasteSuccess",{count:Ye.length}),tone:"success"}),Le(null)}catch(Ye){await _t().catch(()=>{}),Tt({title:Bs(Ye,o("conversation.filePanelPasteFailed")),tone:"error"})}finally{R(!1)}}function zr($=Rt){!$.length||G||(Ie(eh($)),Le(null))}async function qr(){var me,ge;if(!r||!(wt!=null&&wt.length))return;const $=eh(wt);R(!0);try{for(const gt of $)await uf({workspaceId:r,opType:"delete",srcPath:gt.path});const Ye=VV(H,$),Ge=Vt.current.filter(gt=>!$.some(cn=>cn.kind==="directory"&&em(cn.path,gt)));if(le&&$.some(gt=>em(gt.path,le))&&(He.current+=1,oe(null),lt(null)),Ie(null),M([]),F(null),Bt.current=Ye,Vt.current=Ge,W(Ye),dn(Ge),On(),await _t({activeDirectoryPath:Ye,expandedDirectories:Ge}),_e&&D.trim()){const gt=await Pc(r,D.trim());Q(gt.items)}Te(gt=>gt+1),Tt({title:$.length===1?o("conversation.filePanelDeleteSuccess",{name:tg(((me=$[0])==null?void 0:me.path)??"")||((ge=$[0])==null?void 0:ge.path)||""}):o("conversation.filePanelDeleteSelectionSuccess",{count:$.length}),tone:"success"})}catch(Ye){Tt({title:Bs(Ye,o("conversation.filePanelMutateFailed")),tone:"error"})}finally{R(!1)}}async function yr($,me=Ve){const ge=(nt==null?void 0:nt.path)??"",Ye=(me==null?void 0:me.path)??null;if(Ye===null||!ge){bt(!1);return}try{const Ge=YV(ge),gt=$==="absolute"?KV(ge,Ye,Ge):Nh(Ye,Ge);await ZV(gt,Mn),Tt({title:o($==="absolute"?"conversation.filePanelCopyAbsolutePathSuccess":"conversation.filePanelCopyRelativePathSuccess"),tone:"success"})}catch(Ge){Tt({title:Ge instanceof Error?Ge.message:o("conversation.filePanelCopyPathFailed"),tone:"error"})}finally{bt(!1),Le(null)}}function or($,me,ge){return[{id:`open-${$.path}`,label:$.kind==="directory"?N.includes($.path)?o("conversation.filePanelCollapseDirectory"):o("conversation.filePanelExpandDirectory"):o("conversation.filePanelOpenFile"),onSelect:()=>{if($.kind==="directory"){sr($.path);return}ir($.path)}},{id:`download-${$.path}`,label:o("conversation.filePanelDownload"),disabled:$.kind!=="file"||A,onSelect:()=>{Et($.kind==="file"?$.path:null)}},{id:`create-file-${$.path}`,label:o("conversation.filePanelNewFile"),disabled:!r||G||A,onSelect:()=>{on("create_file",ge)}},{id:`create-directory-${$.path}`,label:o("conversation.filePanelNewDirectory"),disabled:!r||G||A,onSelect:()=>{on("create_directory",ge)}},{id:`copy-${$.path}`,label:o("conversation.filePanelCopy"),disabled:me.length===0,onSelect:()=>nn("copy",me)},{id:`cut-${$.path}`,label:o("conversation.filePanelCut"),disabled:me.length===0,onSelect:()=>nn("cut",me)},{id:`paste-${$.path}`,label:o("conversation.filePanelPaste"),disabled:!Tn,onSelect:()=>{Dr(ge)}},{id:`copy-relative-${$.path}`,label:o("conversation.filePanelCopyRelativePath"),onSelect:()=>{yr("relative",$)}},{id:`copy-absolute-${$.path}`,label:o("conversation.filePanelCopyAbsolutePath"),onSelect:()=>{yr("absolute",$)}},{id:`delete-${$.path}`,label:o("conversation.filePanelDelete"),disabled:me.length===0||G||A,onSelect:()=>zr(me)}]}async function Dn($,me){if(Mn.isMobile)return;$.preventDefault();const ge=ks(me.path,me.kind),Ye=ht.has(ge.path)?Rt:[ge],Ge=ge.kind==="directory"?ge.path:la(ge.path);ht.has(ge.path)||zt(ge);const gt=or(ge,Ye,Ge);if(Mn.isDesktop){await O$(gt);return}Mn.isWeb&&(bt(!1),we(!1),Le({positionX:$.clientX,positionY:$.clientY,items:gt}))}p.useEffect(()=>{if(ye!=="workspace")return;function $(me){if(!zV(me)||me.altKey||me.shiftKey||qV(me.target))return;const ge=me.key.toLowerCase();if(ge==="c"&&Zt){me.preventDefault(),nn("copy");return}if(ge==="x"&&Zt){me.preventDefault(),nn("cut");return}ge==="v"&&Tn&&(me.preventDefault(),Dr())}return document.addEventListener("keydown",$),()=>{document.removeEventListener("keydown",$)}},[ye,Zt,Tn,nn,Dr]);function lr($,me){return n.jsx(n.Fragment,{children:$.map(ge=>{const Ye=ks(ge.path,ge.kind),Ge=ge.kind==="directory",gt=Ge&&N.includes(ge.path),cn=Ge&&L.includes(ge.path),jn=re[ge.path]??[],zn=Ae?mb(jn,re,te.statusByPath,te.changedDirs):jn,Zr=ht.has(ge.path),Gi=ne===ge.path,kr=te.statusByPath.get(ge.path.replace(/\\/g,"/")),li=Ge&&te.changedDirs.has(ge.path.replace(/\\/g,"/")),ci=(Be==null?void 0:Be.mode)==="cut"&&Be.items.some(Bn=>Bn.path===ge.path);return n.jsxs("div",{className:"file-tree-node",children:[n.jsxs("button",{className:"file-tree-item",type:"button","data-active":Gi,"data-selected":Zr,"data-cut-pending":ci||void 0,"data-kind":ge.kind,"aria-expanded":Ge?gt:void 0,style:{paddingInlineStart:`${OV+me*BV}px`},onClick:Bn=>{if(Ge){if(Bn.shiftKey||Zd(Bn)){On(),er(Ye,Bn);return}On(),er(Ye,Bn),sr(ge.path);return}Sr(ge.path,Bn)},onContextMenu:Bn=>{Dn(Bn,ge)},children:[n.jsx("span",{className:`file-tree-chevron${Ge?"":" is-hidden"}`,"aria-hidden":"true",children:gt?"v":">"}),Ge?null:n.jsx("span",{className:"git-tree-file-icon","data-kind":Ro(ge.name),"aria-hidden":"true",children:Do(ge.name)}),n.jsx("span",{className:"file-tree-label","data-status":kr??void 0,"data-has-changes":li||void 0,children:ge.name}),!Ge&&kr?n.jsx("span",{className:"git-status-badge","data-status":kr,"aria-label":kr,children:kr}):null,Ge&&li?n.jsx("span",{className:"file-tree-dir-badge","aria-hidden":"true"}):null,cn?n.jsx("span",{className:"file-tree-meta",children:o("common.loading")}):null]}),Ge&>?n.jsx("div",{className:"file-tree-children",children:cn&&!jn.length?n.jsx("p",{className:"file-tree-empty",children:o("common.loading")}):zn.length?lr(zn,me+1):n.jsx("p",{className:"file-tree-empty",children:o("conversation.filePanelEmptyDirectory")})}):null]},`${ge.kind}-${ge.path}`)})})}function Fr($){return n.jsx(n.Fragment,{children:$.map(me=>{const ge=me.kind==="directory",Ye=ht.has(me.path),Ge=ne===me.path;return n.jsx("div",{className:"file-tree-node",children:n.jsxs("button",{className:"file-tree-item is-search-result",type:"button","data-active":Ge,"data-selected":Ye,"data-kind":me.kind,onClick:gt=>{_i(me,gt)},onContextMenu:gt=>{Dn(gt,me)},children:[n.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),ge?null:n.jsx("span",{className:"git-tree-file-icon","data-kind":Ro(me.name),"aria-hidden":"true",children:Do(me.name)}),n.jsxs("span",{className:"file-tree-label",children:[n.jsx("span",{className:"file-tree-name",children:me.name}),n.jsx("span",{className:"file-tree-path",children:me.path})]})]})},`search-${me.kind}-${me.path}`)})})}return n.jsx("section",{className:["conversation-panel","surface-card","file-panel",e].filter(Boolean).join(" "),"data-testid":"file-context-panel",children:r?n.jsxs(n.Fragment,{children:[n.jsx(tR,{workspaceId:r,filePath:le,open:le!==null,onClose:()=>{He.current+=1,oe(null),lt(null)},onSaved:async $=>{await _t(),await Hn($),Te(me=>me+1)},diffContent:We}),i?null:n.jsx("div",{className:"file-panel-heading-row",children:n.jsx("h2",{className:"file-panel-heading",children:o("conversation.filePanelTitle")})}),n.jsxs("div",{className:"file-panel-tabs",role:"tablist","aria-label":o("conversation.filePanelTitle"),children:[n.jsx("button",{className:ye==="workspace"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":ye==="workspace",onClick:()=>Ne("workspace"),children:o("conversation.filePanelWorkspaceTab")}),n.jsxs("button",{className:ye==="session"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":ye==="session",onClick:()=>{kn&&Ne("session")},disabled:!kn,children:[o("conversation.filePanelSessionTab"),n.jsx("span",{className:"file-panel-tab-badge","aria-label":`${o("conversation.filePanelSessionTab")} ${Dt}`,children:Dt})]})]}),ye==="workspace"?n.jsxs(n.Fragment,{children:[n.jsx("input",{ref:Sn,"data-testid":"file-panel-upload-input",type:"file",hidden:!0,onChange:$=>void Je($)}),Ht?n.jsx("div",{className:"file-panel-toolbar file-panel-toolbar-mobile","aria-label":o("conversation.filePanelTitle"),children:n.jsxs("div",{className:"file-mobile-action-shell",ref:ln,children:[n.jsxs("button",{className:"secondary-button file-mobile-action-trigger",type:"button","aria-label":o("conversation.filePanelActionsMenu"),"aria-haspopup":"menu","aria-expanded":pt,"data-active":pt,onClick:()=>{bt(!1),we($=>!$)},children:[n.jsx("span",{children:o("conversation.filePanelActionsMenu")}),n.jsx(g8,{})]}),pt?n.jsxs("div",{className:"file-mobile-action-menu",role:"menu","aria-label":o("conversation.filePanelActionsMenu"),children:[n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>ee(()=>nn("copy")),disabled:!Zt,children:o("conversation.filePanelCopy")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>ee(()=>nn("cut")),disabled:!Zt,children:o("conversation.filePanelCut")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>ee(()=>Dr()),disabled:!Tn||G||A,children:o("conversation.filePanelPaste")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{we(!1),ar()},children:o(pe?"conversation.filePanelHideSearch":"conversation.filePanelShowSearch")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{we(!1),et($=>!$)},disabled:hn.length===0,children:o(Ae?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>ee(un),disabled:X||G||_,children:o("conversation.filePanelRefresh")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{we(!1),an()},disabled:!Zn,children:o("conversation.filePanelCollapseCurrent")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{we(!1),Ke()},disabled:G||A,children:o("conversation.filePanelUpload")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>ee(Et),disabled:!Kt||A,children:o("conversation.filePanelDownload")}),n.jsx("button",{className:"file-mobile-action-menu-item danger",type:"button",role:"menuitem",onClick:()=>ee(zr),disabled:!$t||G||A,children:o("conversation.filePanelDelete")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>ee(()=>on("create_file")),disabled:G||A,children:o("conversation.filePanelNewFile")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>ee(()=>on("create_directory")),disabled:G||A,children:o("conversation.filePanelNewDirectory")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>ee(()=>yr("absolute")),disabled:!tn,children:o("conversation.filePanelCopyAbsolutePath")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>ee(()=>yr("relative")),disabled:!tn,children:o("conversation.filePanelCopyRelativePath")})]}):null]})}):n.jsxs("div",{className:"file-panel-toolbar","aria-label":o("conversation.filePanelTitle"),children:[n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCopy"),"aria-label":o("conversation.filePanelCopy"),onClick:()=>nn("copy"),disabled:!Zt,children:n.jsx(l8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCut"),"aria-label":o("conversation.filePanelCut"),onClick:()=>nn("cut"),disabled:!Zt,children:n.jsx(c8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelPaste"),"aria-label":o("conversation.filePanelPaste"),onClick:()=>void Dr(),disabled:!Tn||G||A,children:n.jsx(u8,{})}),n.jsxs("div",{className:"file-toolbar-menu-shell",ref:Nt,children:[n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCopyPath"),"aria-label":o("conversation.filePanelCopyPath"),"aria-haspopup":"menu","aria-expanded":dt,"data-active":dt,onClick:()=>{we(!1),bt($=>!$)},disabled:!tn,children:n.jsx(o8,{})}),dt?n.jsxs("div",{className:"file-toolbar-menu",role:"menu",children:[n.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void yr("absolute"),children:o("conversation.filePanelCopyAbsolutePath")}),n.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void yr("relative"),children:o("conversation.filePanelCopyRelativePath")})]}):null]}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCollapseCurrent"),"aria-label":o("conversation.filePanelCollapseCurrent"),onClick:an,disabled:!Zn,children:n.jsx(s8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelRefresh"),"aria-label":o("conversation.filePanelRefresh"),onClick:()=>void un(),disabled:X||G||_,children:n.jsx(a8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelSearchButton"),"aria-label":o("conversation.filePanelSearchButton"),"data-active":pe,onClick:ar,disabled:X,children:n.jsx(oj,{})}),hn.length>0?n.jsx("button",{className:"file-toolbar-button",type:"button",title:o(Ae?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges"),"aria-label":o(Ae?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges"),"data-active":Ae,onClick:()=>et($=>!$),children:n.jsx(b8,{})}):null,n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelUpload"),"aria-label":o("conversation.filePanelUpload"),onClick:Ke,disabled:G||A,children:n.jsx(h8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelDownload"),"aria-label":o("conversation.filePanelDownload"),onClick:()=>void Et(),disabled:!Kt||A,children:n.jsx(m8,{})}),n.jsx("button",{className:"file-toolbar-button danger",type:"button",title:o("conversation.filePanelDelete"),"aria-label":o("conversation.filePanelDelete"),onClick:()=>zr(),disabled:!$t||G||A,children:n.jsx(p8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelNewFile"),"aria-label":o("conversation.filePanelNewFile"),onClick:()=>void on("create_file"),disabled:G||A,children:n.jsx(d8,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelNewDirectory"),"aria-label":o("conversation.filePanelNewDirectory"),onClick:()=>void on("create_directory"),disabled:G||A,children:n.jsx(f8,{})})]}),he&&typeof document<"u"?Vn.createPortal(n.jsx("div",{className:"file-web-context-menu",ref:Jt,role:"menu","aria-label":o("conversation.filePanelActionsMenu"),style:{left:`${(Oe==null?void 0:Oe.left)??Math.max(8,he.positionX)}px`,top:`${(Oe==null?void 0:Oe.top)??Math.max(8,he.positionY)}px`,maxHeight:Oe?`${Oe.maxHeight}px`:void 0},children:he.items.map($=>n.jsx("button",{className:["file-web-context-menu-item",$.label===o("conversation.filePanelDelete")?"danger":""].filter(Boolean).join(" "),type:"button",role:"menuitem",disabled:$.disabled,onClick:()=>{Le(null),$.onSelect()},children:$.label},$.id))}),document.body):null,pe?n.jsxs("form",{className:"file-toolbar-search",onSubmit:$=>void Jr($),children:[n.jsx("input",{value:D,onChange:$=>T($.target.value),placeholder:o("conversation.filePanelSearchPlaceholder")}),Ht?n.jsx("button",{className:"secondary-button file-mobile-search-submit",type:"submit","aria-label":o("conversation.filePanelSearchButton"),disabled:_,children:o("conversation.filePanelSearchButton")}):n.jsx("button",{className:"file-toolbar-button",type:"submit",title:o("conversation.filePanelSearchButton"),"aria-label":o("conversation.filePanelSearchButton"),disabled:_,children:n.jsx(oj,{})})]}):null,n.jsx("div",{className:"file-tree","data-search-mode":_e,children:X&&Se.length===0?n.jsx("p",{className:"file-tree-status status-text",children:o("common.loading")}):_e?ue!=null&&ue.length?Fr(ue):n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelSearchEmpty")}):Ae?ze.length?lr(ze,0):n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelNoChanges")}):Se.length?lr(Se,0):n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelEmptyDirectory")})}),n.jsxs(Ln,{open:wt!==null,title:o("conversation.filePanelDeleteConfirmTitle"),description:o("conversation.filePanelDeleteConfirmDescription"),onClose:()=>{G||Ie(null)},children:[n.jsx("p",{className:"workbench-section-empty",children:wt!=null&&wt.length?wt.length===1?((Yr=wt[0])==null?void 0:Yr.kind)==="directory"?o("conversation.filePanelDeleteDirectoryConfirm",{path:wt[0].path}):o("conversation.filePanelDeleteFileConfirm",{path:wt[0].path}):o("conversation.filePanelDeleteSelectionConfirm",{count:wt.length}):""}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:G,onClick:()=>Ie(null),children:o("common.cancel")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:G,onClick:()=>{qr()},children:o(G?"conversation.filePanelDeleting":"conversation.filePanelDelete")})]})]})]}):kn&&t?n.jsx(MV,{sessionId:t,workspaceId:r,showSystemFiles:wn,selectedPath:je,refreshVersion:Me,onCountChange:st,onSelectFile:Hn,onOpenFile:ir}):n.jsx("section",{className:"file-panel-section",children:n.jsx("p",{className:"status-text",children:o("conversation.filePanelSessionNoSession")})})]}):n.jsx("section",{className:"file-panel-section",children:n.jsx("p",{className:"status-text",children:o("conversation.filePanelNoWorkspace")})})})}function la(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):ur}function ru(e,t=!1){const r=e.split("/").filter(Boolean),i=t?r.length:r.length-1,a=[];for(let c=0;c<i;c+=1)a.push(r.slice(0,c+1).join("/"));return a}function tj(e,t){return e||((t==null?void 0:t.kind)==="directory"?t.path:t!=null&&t.path?la(t.path):ur)}function nj(e,t){return e?`${e}/${t}`:t}function WV(e){var t;return((t=e.split(/[/\\]/).pop())==null?void 0:t.trim())??""}function ks(e,t){return{path:e,kind:t}}function rj(e){return e[e.length-1]??null}function UV(e,t){return e.findIndex(i=>i.path===t.path)>=0?e.filter(i=>i.path!==t.path):[...e,t]}function HV(e,t,r){const i=e.findIndex(d=>d.path===r.path);if(i<0)return[r];const a=t?e.findIndex(d=>d.path===t):i;if(a<0)return[r];const c=Math.min(a,i),u=Math.max(a,i);return e.slice(c,u+1)}function Zd(e){return!!(e!=null&&e.ctrlKey||e!=null&&e.metaKey)}function zV(e){return e.ctrlKey||e.metaKey}function qV(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"||e.isContentEditable}function eh(e){const t=[...new Map(e.map(i=>[i.path,i])).values()].sort((i,a)=>i.path.localeCompare(a.path)),r=[];for(const i of t)r.some(a=>a.kind==="directory"&&em(a.path,i.path))||r.push(i);return r}function $V(e,t){return(e==null?void 0:e.kind)==="directory"?e.path:e!=null&&e.path?la(e.path):t}function VV(e,t){let r=e;for(;r&&t.some(i=>i.kind==="directory"&&em(i.path,r));)r=la(r);return r}function hR(e,t,r,i,a,c){const u=[];for(const d of e){if(u.push(ks(d.path,d.kind)),d.kind!=="directory"||!r.includes(d.path))continue;const m=t[d.path]??[],f=i?mb(m,t,a,c):m;u.push(...hR(f,t,r,i,a,c))}return u}function GV(e,t,r){const i=Math.max(0,r.width),a=Math.max(0,r.height),c=Math.max(0,a-Os*2),u=Math.max(0,i-Os*2),d=Math.min(Math.max(t.width,0),u),m=Math.max(0,a-e.y-Jd-Os),f=Math.max(0,e.y-Jd-Os),w=m<t.height&&f>m,v=ig(Math.max(w?f:m,LV),0,c),y=Math.min(Math.max(t.height,0),v),x=w?e.y-Jd-y:e.y+Jd,C=Math.max(Os,a-Os-y),j=Math.max(Os,i-Os-d);return{top:ig(x,Os,C),left:ig(e.x,Os,j),maxHeight:Math.max(0,v)}}function ig(e,t,r){return!Number.isFinite(e)||r<t?t:Math.min(Math.max(e,t),r)}function Nh(e,t="posix"){return e?mR(e,t):"."}function KV(e,t,r){const i=mR(e,r),a=Nh(t,r).replace(/^\.[/\\]?/,"");if(!a)return i;const c=pR(r),u=a.replace(/^[/\\]+/,"");return u?i.endsWith("/")||i.endsWith("\\")?`${i}${u}`:`${i}${c}${u}`:i}function YV(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.includes("\\")?"windows":"posix"}function mR(e,t){return e&&(pR(t)==="\\"?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"))}function pR(e){return e==="windows"?"\\":"/"}function em(e,t){return t===e||t.startsWith(`${e}/`)}async function XV(e){const t=await e.arrayBuffer(),r=new Uint8Array(t),i=32768;let a="";for(let c=0;c<r.length;c+=i){const u=r.subarray(c,c+i);a+=String.fromCharCode(...u)}return btoa(a)}function QV(e){const t=atob(e),r=new Uint8Array(t.length);for(let i=0;i<t.length;i+=1)r[i]=t.charCodeAt(i);return r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)}function JV(e,t){if(typeof document>"u")throw new Error(o("conversation.filePanelDownloadFailed"));const r=window.URL.createObjectURL(t),i=document.createElement("a");i.href=r,i.download=e,document.body.append(i),i.click(),i.remove(),window.URL.revokeObjectURL(r)}async function ZV(e,t){var r;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((r=navigator.clipboard)!=null&&r.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!e8(e))throw new Error(o("conversation.filePanelCopyPathFailed"))}}function e8(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly","true"),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t),t.focus(),t.select();try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(t)}}function t8(e,t){return e&&ru(e,!0).every(a=>a in t)?e:ur}function ij(e,t){if(!t)return[];const r=ru(t,!0);return e.filter(i=>r.includes(i))}function th(e,t,r){const i=Yw(t,r);return Object.entries(e).reduce((a,[c,u])=>(i.has(c)&&(a[c]=u),a),{})}function n8(e,t,r){const a=[...Yw(t,r)].filter(c=>c===ur||c in e);return a.length?a:[ur]}function Yw(e,t){const r=new Set([ur]),i=fR(t,ru(e,!0));for(const a of i){r.add(a);for(const c of ru(a,!0))r.add(c)}return r}function r8(e,t){const r=Object.keys(e),i=Object.keys(t);return r.length!==i.length?!1:r.every(a=>e[a]===t[a])}function Th(e,t){return e.includes(t)?e:[...e,t]}function fR(e,t){return t.reduce((r,i)=>Th(r,i),e)}function sj(e){return`file-panel.workspace-tree.${e}`}function i8(e,t){return`file-panel.session-change-count.${e}.${t}`}function sg(e,t){return[...Yw(t,e)]}function Bs(e,t){return e instanceof Kr?e.message:t}function aj(e){return e instanceof Error&&(e.message.startsWith("FILE_TREE_SNAPSHOT_TIMEOUT:")||e.message.startsWith("FILE_TREE_ABORTED:"))}function s8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M2.5 4.5h11v2h-11zM2.5 7.5h7v2h-7zM2.5 10.5h4v2h-4z",fill:"currentColor"})})}function a8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M12.8 5.2A5.5 5.5 0 1 0 13.5 8h-1.8A3.7 3.7 0 1 1 10.6 5l-1.4 1.4h4V2l-1.4 1.4z",fill:"currentColor"})})}function oj(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M11.2 10.1l3 3-1.1 1.1-3-3a5 5 0 1 1 1.1-1.1zM6.8 10.3a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z",fill:"currentColor"})})}function o8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M3.5 4.3h5.2v1.4H4.9v5.4H3.5zm3.8-2.1h5.2v9.5H7.3z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M5.7 10.8h4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function l8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M5 2.5h7.5v9H5z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M3.5 5H2.4V13.5H10V12.4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function c8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M4.2 4.2a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8zm0 5.4a1.4 1.4 0 1 1 0 2.8 1.4 1.4 0 0 1 0-2.8zm1-3.2 6.6 5.6M5.2 9.6l6.6-5.6",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})}function u8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M4 3.5h8v10H4zM6 2.2h4v2H6z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M6 7.2h4M6 9.6h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function d8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M4 1.5h5l3 3v10H4z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M9 1.5v3h3",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M8 6.5v5M5.5 9h5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function h8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"m5.5 5 2.5-2.5L10.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function m8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"m5.5 8.5 2.5 2.5 2.5-2.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function p8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 4.5h9M6.2 2.5h3.6l.6 1.4H13v1.2H3V3.9h2.6zM5.2 5.7v6.1m2.8-6.1v6.1m2.8-6.1v6.1M4.4 13.5h7.2",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function f8(){return n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M1.8 4.5h4l1.2 1.3h7.2v6.7H1.8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),n.jsx("path",{d:"M8.5 7.2v4M6.5 9.2h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function g8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function b8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M1.5 2h13l-5 6v5l-3 1.5V8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function mb(e,t,r,i){const a=[];for(const c of e){const u=c.path.replace(/\\/g,"/");c.kind==="file"?r.has(u)&&a.push(c):gR(u,t,r,i)&&a.push(c)}return a}function gR(e,t,r,i,a){const c=a??new Set;if(c.has(e))return!1;c.add(e);const u=t[e];if(!u)return i.has(e);for(const d of u){const m=d.path.replace(/\\/g,"/");if(d.kind==="file"){if(r.has(m))return!0}else if(gR(m,t,r,i,c))return!0}return!1}const w8=Object.freeze(Object.defineProperty({__proto__:null,FileContextPanel:Kw},Symbol.toStringTag,{value:"Module"})),ag=56,lj=28,og=72,nh=8,cj=960,uj=60*1e3,dj=20,hj=9,mj=9,lg=68,Ri=12,rh=8,pb=260,v8=120,cg=6e4,tm={authMode:"none",username:"",password:"",token:"",rememberOnHost:!1};function Xw({className:e,workspaceId:t,panelActive:r=!0,externalWindowMode:i=!1,workbenchShellOverrides:a}){const c=mr(),u=Tr(),{subscribeGitSnapshot:d,requestGitRefresh:m,addGitSnapshotListener:f,requestNavigationRefresh:w,selectWorkspace:g,upsertNavigationSession:v}={...u,...a},[y,x]=p.useState(null),[C,j]=p.useState([]),[N,P]=p.useState(0),[L,Y]=p.useState(null),[H,W]=p.useState(!1),[I,M]=p.useState(null),[O,F]=p.useState(null),[X,U]=p.useState(""),[G,R]=p.useState(!1),[A,Z]=p.useState(!1),[pe,q]=p.useState([]),[D,T]=p.useState(!0),[B,Q]=p.useState(!1),[_,de]=p.useState(()=>typeof window<"u"?window.innerWidth<=cj:!1),[le,oe]=p.useState([]),[ye,Ne]=p.useState(null),[Me,Te]=p.useState("unstaged"),[Dt,st]=p.useState(null),[dt,bt]=p.useState(null),[pt,we]=p.useState(!1),[he,Le]=p.useState(null),[Oe,Qe]=p.useState(!1),[wt,Ie]=p.useState(null),[Be,vt]=p.useState(null),[ft,ve]=p.useState(null),[Ae,et]=p.useState(!1),[We,lt]=p.useState(null),[ct,Vt]=p.useState(!1),[Bt,Wt]=p.useState(!1),[Lt,Nt]=p.useState([]),[ln,Jt]=p.useState(!1),[Sn,se]=p.useState(new Set),[He,xt]=p.useState(new Map),[Tt,Mn]=p.useState(null),[wn,kn]=p.useState(!1),[Ht,Gt]=p.useState(tm),[dn,hn]=p.useState("generic"),[te,re]=p.useState(null),[ue,Se]=p.useState(null),[_e,ze]=p.useState(null),[yt,nt]=p.useState(ag),[Ve,ne]=p.useState(!1),[je,ht]=p.useState(null),[Rt,tn]=p.useState(null),Kt=p.useRef(null),$t=p.useRef(null),Zt=p.useRef(null),Tn=p.useRef(null),Zn=p.useRef(null),Cn=p.useRef(null),_t=p.useRef(null),Fn=p.useRef(new Map),mn=p.useRef(new Map),bn=p.useRef(0),Ce=p.useRef(r),{showToast:De}=Jn();p.useEffect(()=>{sn("git_sidebar.props",{workspaceId:t,externalWindowMode:i})},[i,t]),p.useEffect(()=>{q([]),T(!0),P(0),Y(null),W(!1),F(null),U(""),Q(!1),oe([]),Ne(null),Te("unstaged"),st(null),bt(null),we(!1),Le(null),Qe(!1),Ie(null),vt(null),ve(null),et(!1),lt(null),Vt(!1),Wt(!1),Nt([]),se(new Set),xt(new Map),Mn(null),kn(!1),Gt(tm),hn("generic"),re(null),Se(null),ze(null),ne(!1),nt(ag),ht(null),tn(null),mn.current.clear(),Fn.current.clear()},[t]),p.useEffect(()=>{function V(){de(window.innerWidth<=cj)}return V(),window.addEventListener("resize",V),()=>{window.removeEventListener("resize",V)}},[]),p.useEffect(()=>{if(!Ve)return;const V=document.body.style.cursor,be=document.body.style.userSelect;document.body.style.cursor="row-resize",document.body.style.userSelect="none";function at(qt){qr(qt.clientY)}function ot(){ne(!1)}return window.addEventListener("pointermove",at),window.addEventListener("pointerup",ot),()=>{document.body.style.cursor=V,document.body.style.userSelect=be,window.removeEventListener("pointermove",at),window.removeEventListener("pointerup",ot)}},[Ve]),p.useEffect(()=>{var at,ot;if(!(t!=null&&t.trim())){x(null),j([]),P(0),Y(null),M(null),R(!1);return}const V=t.trim(),be=Lr(dg(V),uj);if(sn("git_sidebar.snapshot",{workspaceId:V,cached:!!be,cachedHistoryCount:((at=be==null?void 0:be.history)==null?void 0:at.length)??0,cachedChangedCount:((ot=be==null?void 0:be.status)==null?void 0:ot.changes.length)??0}),be){Mt(be),R(!1);return}x(null),j([]),P(0),Y(null),M(null),R(!0)},[t]),p.useEffect(()=>{if(t!=null&&t.trim())return f(V=>{var be,at,ot;V.workspaceId===t.trim()&&(sn("git_sidebar.snapshot_received",{workspaceId:V.workspaceId,changedCount:((be=V.status)==null?void 0:be.changes.length)??0,historyCount:V.history.length,branchCount:(((at=V.branches)==null?void 0:at.local.length)??0)+(((ot=V.branches)==null?void 0:ot.remote.length)??0)}),Mt(V),R(!1))})},[f,t]),p.useEffect(()=>{if(!(t!=null&&t.trim()))return;const V=t.trim(),be=Lr(dg(V),uj)!==null;if(d(V),be){m(V);return}en()},[m,d,t]),p.useEffect(()=>{const V=Ce.current;Ce.current=r,t!=null&&t.trim()&&!V&&r&&m(t.trim())},[r,m,t]),p.useEffect(()=>{t&&Ei(dg(t),{status:y,history:C,historyTotalCount:N,historyNextCursor:L,branches:I})},[I,C,L,N,y,t]),p.useEffect(()=>{if(!y||!O)return;y.changes.find(be=>be.path===O)||F(null)},[O,y]),p.useEffect(()=>{j8(Tn.current)},[X]),p.useEffect(()=>{_||(oe([]),Ne(null),st(null),re(null))},[_]),p.useEffect(()=>{if(!y){oe([]);return}const V=new Set(y.changes.map(be=>be.path));oe(be=>be.filter(at=>V.has(at)))},[y]);function mt(){const V=Zt.current;if(!V)return;V.querySelectorAll(".git-tree-shell").forEach(at=>{at.scrollTop=0})}function Mt(V){x(V.status),j(Array.isArray(V.history)?V.history:[]),P(typeof V.historyTotalCount=="number"?V.historyTotalCount:0),Y(typeof V.historyNextCursor=="string"?V.historyNextCursor:null),M(V.branches??null)}function en(V){t!=null&&t.trim()&&(R(!0),sn("git_sidebar.refresh_requested",{workspaceId:t.trim(),resetTreeScroll:!1}),m(t.trim()))}async function An(V){if(!(t!=null&&t.trim()))return;const be=t.trim();R(!0);try{const[at,ot,qt]=await Promise.all([BT(be),cx(be,dj,null),HT(be)]);Mt({status:at,history:ot.items,historyTotalCount:ot.totalCount,historyNextCursor:ot.nextCursor,branches:qt}),m(be),V!=null&&V.resetTreeScroll&&requestAnimationFrame(()=>{mt()})}catch(at){De({title:ji(at,o("git.panelLoadFailed")),tone:"error"})}finally{R(!1)}}async function zt(){if(!(!t||!L||H)){W(!0);try{const V=await cx(t,dj,L);j(be=>{const at=new Set(be.map(qt=>qt.commitHash)),ot=V.items.filter(qt=>!at.has(qt.commitHash));return[...be,...ot]}),P(V.totalCount),Y(V.nextCursor)}catch(V){De({title:ji(V,o("git.panelLoadFailed")),tone:"error"})}finally{W(!1)}}}function er(V){if(!D||H||!L)return;const be=V.currentTarget;be.scrollHeight-be.scrollTop-be.clientHeight<=40&&zt()}async function fr(){if(t){Z(!0);try{const V=await vF(t,"ai");U(V.validation.normalizedDraft.subject||V.draft.subject)}catch(V){De({title:ji(V,o("git.draftFailed")),tone:"error"})}finally{Z(!1)}}}async function Hn(V,be){if(t&&V.length){Z(!0);try{const at=be?await bF(t,V):await UT(t,V);x(at),F(V[V.length-1]??null),oe(ot=>ot.filter(qt=>!V.includes(qt))),Ne(null),en()}catch(at){R(!1),De({title:ji(at,o("git.stageFailed")),tone:"error"})}finally{Z(!1)}}}async function ir(V){if(t&&V.length){Z(!0);try{const be=await wF(t,V);x(be),V.includes(O??"")&&F(null),oe(at=>at.filter(ot=>!V.includes(ot))),Ne(null),en()}catch(be){R(!1),De({title:ji(be,o("git.discardFailed")),tone:"error"})}finally{Z(!1)}}}async function vr(){if(!(!t||!X.trim())){Z(!0);try{await yF(t,S8(X)),De({title:o("git.commitSuccess"),tone:"success"}),U(""),F(null),en()}catch(V){De({title:ji(V,o("git.commitFailed")),tone:"error"})}finally{Z(!1)}}}function On(V){Gt(P8(Tt)),kn(!0),Sr(V)}async function Sr(V){const be=t==null?void 0:t.trim();if(!be){hn("generic");return}try{const at=await dx(be);if((t==null?void 0:t.trim())!==be)return;hn(R8(at,V))}catch{if((t==null?void 0:t.trim())!==be)return;hn("generic")}}function Fi(){const V=D8(Ht),be=o(dn==="github"?"git.remoteAuthGithubPatPlaceholder":"shell.clonePasswordPlaceholder");if(Ht.authMode==="basic"){if(!Ht.username.trim()){De({title:o("shell.cloneUsernamePlaceholder"),tone:"error"});return}if(!Ht.password){De({title:be,tone:"error"});return}}if(Ht.authMode==="token"&&!Ht.token){De({title:o("shell.cloneTokenPlaceholder"),tone:"error"});return}Mn(V),kn(!1),De({title:o(V?"git.remoteAuthSaved":"git.remoteAuthCleared"),description:V&&Ht.rememberOnHost?o("git.remoteAuthRememberHint"):void 0,tone:"success"})}async function _i(){if(t){Jt(!0);try{const V=await dx(t);if(V.length===0){De({title:o("git.noRemotes"),tone:"error"});return}if(V.length===1){Hr([V[0].name]);return}Nt(V),se(new Set),xt(new Map),Wt(!0)}catch(V){De({title:ji(V,o("git.remoteFailed")),tone:"error"})}finally{Jt(!1)}}}async function Hr(V){if(!t||V.length===0)return;Z(!0),xt(new Map);const be=new Map;let at=!1;try{for(const ot of V)try{const qt=await ux(t,"push",ot,Tt,Ht.rememberOnHost);be.set(ot,{ok:!0,summary:qt.summary})}catch(qt){if(at=!0,be.set(ot,{ok:!1,summary:ji(qt,o("git.remoteFailed"))}),xt(new Map(be)),kj(qt)){On(ot);return}}xt(be),en(),at||(De({title:o("git.pushAllSuccess",{count:String(V.length)}),tone:"success"}),Wt(!1))}finally{Z(!1)}}async function sr(V){if(t){if(V==="push"){Q(!1),_i();return}Z(!0);try{const be=await ux(t,V,void 0,Tt,Ht.rememberOnHost);De({title:be.summary,tone:"success"}),Q(!1),en()}catch(be){if(kj(be)){On();return}De({title:ji(be,o("git.remoteFailed")),tone:"error"})}finally{Z(!1)}}}async function Pr(){if(t){Z(!0);try{const V=await kF(t);U(V.commitSubject??""),De({title:V.summary||o("git.undoLastCommitSuccess"),tone:"success"}),Q(!1),en()}catch(V){De({title:ji(V,o("git.undoLastCommitFailed")),tone:"error"})}finally{Z(!1)}}}async function un(V){if(t){Z(!0);try{const be=await CF(t,V,!1);M(be),Q(!1),en()}catch(be){De({title:ji(be,o("git.branchFailed")),tone:"error"})}finally{Z(!1)}}}async function Jr(V){const be=t==null?void 0:t.trim();if(!be)throw new Error(o("git.panelLoadFailed"));const at=mn.current.get(V);if(at)return at;const ot=await xF(be,V);return mn.current.set(V,ot),ot}async function ar(V){bt(null),st(null),Le(V),Ie(null);const be=mn.current.get(V)??null;if(vt(be),Qe(!be),be)return;const at=bn.current+1;bn.current=at;try{const ot=await Jr(V);if(bn.current!==at)return;vt(ot)}catch(ot){if(bn.current!==at)return;Ie(ji(ot,o("git.commitDetailLoadFailed"))),vt(null)}finally{bn.current===at&&Qe(!1)}}function ee(){Le(null),Qe(!1),Ie(null),vt(null)}async function Ke(V){try{const be=await Jr(V);await ei(be.versionLabel,o("git.copyCommitVersionSuccess"))}catch(be){De({title:ji(be,o("git.commitDetailLoadFailed")),tone:"error"})}}function Je(V){bt(null),st(null),ve(V),lt(null),et(!0)}async function Et(){var V,be;if(!(!t||!ft||!We||ct)){Vt(!0);try{const at=await Jr(ft),ot=await tw({workspaceId:t,provider:We,content:C8(at),clientRequestId:((be=(V=globalThis.crypto)==null?void 0:V.randomUUID)==null?void 0:be.call(V))??`git-explain-${Date.now()}-${Math.random().toString(16).slice(2)}`}),qt=ot.session??await Jb(ot.sessionId);v(qt),w(),g(qt.workspaceId),c(Nr(qt.workspaceId,qt.sessionId)),et(!1),ve(null),lt(null),De({title:o("git.explainCommitStarted"),tone:"success"})}catch(at){De({title:ji(at,o("git.explainCommitFailed")),tone:"error"})}finally{Vt(!1)}}}function an(V){q(be=>be.includes(V)?be.filter(at=>at!==V):[...be,V])}const on=450;function nn(V){const be=Date.now(),at=Kt.current;return Kt.current={filePath:V,timestamp:be},(at==null?void 0:at.filePath)===V&&be-at.timestamp<=on}async function Dr(V,be){if(be.binary){De({title:o("git.binaryDiff"),tone:"info"});return}if(be.status==="A"||be.status==="?")tn(null),ht(V);else if(t)try{const at=await WT(t,V,be.staged);tn(at.content),ht(V)}catch{tn(null),ht(V)}}function zr(V){F(V),Ne(null),oe(be=>be.includes(V)?be.filter(at=>at!==V):[...be,V])}function qr(V){const be=$t.current;if(!be||!Number.isFinite(V))return;const at=be.getBoundingClientRect(),ot=at.height-nh;if(!Number.isFinite(at.top)||!Number.isFinite(at.height)||ot<=0)return;const qt=(V-at.top-nh/2)/ot*100;if(!Number.isFinite(qt))return;const Bi=Math.max(lj,Math.min(og,Math.round(qt)));nt(Bi)}function yr(V){V.preventDefault(),qr(V.clientY),ne(!0)}const or=(y==null?void 0:y.changes)??[],Dn=or.filter(V=>fb(V,"staged")),lr=or.filter(V=>fb(V,"unstaged")),Fr=vj(Dn,"staged"),Ut=vj(lr,"unstaged"),Yr=new Set(pe),$=new Set(le),me=yj(le,or,"staged"),ge=yj(le,or,"unstaged"),Ye=or.length===0&&((y==null?void 0:y.snapshot.ahead)??0)>0,Ge=Dn.length>0&&X.trim().length>0,gt=(I==null?void 0:I.currentBranch)??(y==null?void 0:y.snapshot.branch)??o("common.unknown"),cn=Tt!==null,jn=dn==="github",zn=o(jn?"git.remoteAuthDescriptionGithub":"git.remoteAuthDescription"),Zr=o(jn?"git.remoteAuthGithubPatLabel":"shell.clonePasswordLabel"),Gi=o(jn?"git.remoteAuthGithubPatPlaceholder":"shell.clonePasswordPlaceholder"),kr=o(jn?"git.remoteAuthGithubUsernamePlaceholder":"shell.cloneUsernamePlaceholder"),li=Number.isFinite(yt)?yt:ag,ci=D?`minmax(120px, ${li}fr) ${nh}px minmax(140px, ${100-li}fr)`:`minmax(120px, 1fr) ${nh}px auto`;p.useEffect(()=>{ye==="staged"&&me.length===0&&Ne(null),ye==="unstaged"&&ge.length===0&&Ne(null)},[ye,me.length,ge.length]),p.useEffect(()=>{if(!_)return;const V=lr.length>0?"unstaged":Dn.length>0?"staged":"history";Te(be=>be==="unstaged"&&lr.length>0||be==="staged"&&Dn.length>0?be:V)},[_,Dn.length,lr.length]),p.useEffect(()=>{Dt&&(C.some(V=>V.commitHash===Dt)||st(null))},[C,Dt]),p.useEffect(()=>{dt&&(C.some(V=>V.commitHash===dt)||bt(null))},[dt,C]),p.useEffect(()=>{_&&Me!=="history"&&B&&Q(!1)},[_,B,Me]),p.useLayoutEffect(()=>{if(_||!B){Se(null);return}function V(){const at=Zn.current,ot=Cn.current;!at||!ot||typeof window>"u"||Se(gb(at.getBoundingClientRect(),{width:ot.getBoundingClientRect().width||pb,height:ot.getBoundingClientRect().height||ot.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}V();const be=window.requestAnimationFrame(V);return window.addEventListener("resize",V),window.addEventListener("scroll",V,!0),()=>{window.cancelAnimationFrame(be),window.removeEventListener("resize",V),window.removeEventListener("scroll",V,!0)}},[A,I==null?void 0:I.local.length,gt,_,B,cn]);const Bn=Dt??dt;p.useLayoutEffect(()=>{if(!Bn){ze(null);return}const V=Bn;function be(){const ot=Fn.current.get(V)??null,qt=_t.current;!ot||!qt||typeof window>"u"||ze(gb(ot.getBoundingClientRect(),{width:qt.getBoundingClientRect().width||pb,height:qt.getBoundingClientRect().height||qt.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}be();const at=window.requestAnimationFrame(be);return window.addEventListener("resize",be),window.addEventListener("scroll",be,!0),()=>{window.cancelAnimationFrame(at),window.removeEventListener("resize",be),window.removeEventListener("scroll",be,!0)}},[Bn,C.length]),p.useEffect(()=>{if(!Bn||typeof document>"u")return;const V=Bn;function be(at){const ot=at.target;if(!(ot instanceof Node))return;const qt=Fn.current.get(V)??null,Bi=_t.current;qt!=null&&qt.contains(ot)||Bi!=null&&Bi.contains(ot)||(st(null),bt(null))}return document.addEventListener("pointerdown",be),()=>{document.removeEventListener("pointerdown",be)}},[Bn]);async function ei(V,be){var at;try{if(typeof navigator>"u"||!((at=navigator.clipboard)!=null&&at.writeText))throw new Error("clipboard unavailable");await navigator.clipboard.writeText(V),De({title:be,tone:"success"})}catch{De({title:o("common.copyContentFailed"),tone:"error"})}}async function ui(V,be){typeof window<"u"&&!window.confirm(o("git.discardConfirm",{path:be}))||await ir(V)}function Ki(V){const be=(V==null?void 0:V.desktopFloating)===!0&&!_,at=be?{top:(ue==null?void 0:ue.top)??Ri,left:(ue==null?void 0:ue.left)??Ri,maxHeight:ue==null?void 0:ue.maxHeight,transformOrigin:(ue==null?void 0:ue.transformOrigin)??"top right"}:void 0,ot=n.jsxs("div",{ref:be?Cn:void 0,className:"git-operations-menu","data-floating":be?"true":"false",style:at,children:[n.jsxs("div",{className:"git-menu-section",children:[n.jsx("span",{className:"git-menu-caption",children:o("git.currentBranch")}),n.jsx("strong",{className:"git-menu-branch",children:gt})]}),n.jsxs("div",{className:"git-menu-section",children:[n.jsx("span",{className:"git-menu-caption",children:o("git.remoteAuthStatusLabel")}),n.jsxs("div",{className:"git-menu-branch-list",children:[n.jsx("strong",{className:"git-menu-branch",children:o(cn?"git.remoteAuthConfigured":"git.remoteAuthNotConfigured")}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:A,onClick:()=>On(),children:n.jsx("span",{children:o("git.remoteAuthAction")})})]})]}),n.jsxs("div",{className:"git-menu-section",children:[n.jsx("span",{className:"git-menu-caption",children:o("git.branchTitle")}),n.jsx("div",{className:"git-menu-branch-list",children:I==null?void 0:I.local.map(qt=>n.jsx("button",{className:"git-menu-item",type:"button",disabled:A||qt.current,onClick:()=>void un(qt.name),children:n.jsx("span",{children:qt.current?`${o("git.switchBranch")} ${qt.name}`:`${o("git.switchBranchTo")} ${qt.name}`})},qt.name))})]}),n.jsxs("div",{className:"git-menu-section",children:[n.jsx("button",{className:"git-menu-item",type:"button",disabled:A,onClick:()=>{Q(!1),we(!0)},children:n.jsx("span",{children:o("git.viewAllVersions")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:A,onClick:()=>void sr("fetch"),children:n.jsx("span",{children:o("git.fetch")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:A,onClick:()=>void sr("pull"),children:n.jsx("span",{children:o("git.pull")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:A,onClick:()=>void sr("push"),children:n.jsx("span",{children:o("git.push")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:A,onClick:()=>void Pr(),children:n.jsx("span",{children:o("git.undoLastCommit")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:A||G,onClick:()=>void An({resetTreeScroll:!0}),children:n.jsx("span",{children:o("git.refresh")})})]})]});return be?typeof document>"u"?null:Vn.createPortal(ot,document.body):ot}function Oi(V,be){if(be){Fn.current.set(V,be);return}Fn.current.delete(V)}function Ks(){var at;if(!Bn||typeof document>"u")return null;const V=C.find(ot=>ot.commitHash===Bn);if(!V)return null;const be=((at=C[0])==null?void 0:at.commitHash)===V.commitHash&&V.commitKind==="local";return Vn.createPortal(n.jsx("div",{ref:_t,className:"git-history-entry-menu","data-floating":"true",style:{top:(_e==null?void 0:_e.top)??Ri,left:(_e==null?void 0:_e.left)??Ri,maxHeight:_e==null?void 0:_e.maxHeight,transformOrigin:(_e==null?void 0:_e.transformOrigin)??"top right"},children:n.jsx(k8,{item:V,canUndo:be,actioning:A,onViewCommitChanges:ot=>void ar(ot),onCopyCommitHash:ot=>void ei(ot,o("git.copyCommitHashSuccess")),onCopyCommitMessage:ot=>void ei(kc(ot),o("git.copyCommitMessageSuccess")),onCopyCommitVersion:ot=>void Ke(ot),onExplainCommitChange:ot=>void Je(ot),onUndoLastCommit:()=>void Pr()})}),document.body)}return n.jsxs("section",{className:["conversation-panel","surface-card","git-sidebar",e].filter(Boolean).join(" "),"data-testid":"git-sidebar",children:[n.jsxs("section",{className:"git-card git-scaffold-section",children:[n.jsxs("div",{className:"git-editor-row",children:[n.jsx("textarea",{ref:Tn,rows:1,value:X,onChange:V=>U(kR(V.target.value)),onKeyDown:V=>{V.key==="Enter"&&V.preventDefault()},placeholder:o("git.commitSubjectPlaceholder")}),n.jsx("button",{className:"git-icon-button",type:"button","aria-label":o("git.generateDraft"),title:o("git.generateDraft"),onClick:()=>void fr(),disabled:A||G,children:n.jsx(A8,{})})]}),n.jsxs("div",{className:"git-primary-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void An({resetTreeScroll:!0}),disabled:A||G||!t,children:o("git.refreshNow")}),n.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(Ye){_i();return}vr()},disabled:A||!Ye&&!Ge,children:o(Ye?"git.pushNow":"git.commitNow")})]})]}),_?n.jsxs("div",{className:"git-mobile-sections",children:[n.jsx(ug,{title:o("git.stagedChangesTitle"),count:Dn.length,expanded:Me==="staged",onToggle:()=>Te("staged"),children:n.jsx(fj,{title:o("git.stagedChangesTitle"),nodes:Fr,collapsedTreePathSet:Yr,onToggleTreePath:an,onToggleMobileSelection:zr,selectedMobilePathSet:$,selectedTargets:me,actioning:A,variant:"staged",swipeRowState:te,onSwipeRowChange:re,onStageToggle:Hn,onDiscardWithConfirm:ui,onClearSelectedTargets:()=>oe(V=>V.filter(be=>!me.includes(be))),onPreviewFile:Dr})}),n.jsx(ug,{title:o("git.changesTitle"),count:lr.length,expanded:Me==="unstaged",onToggle:()=>Te("unstaged"),children:n.jsx(fj,{title:o("git.changesTitle"),nodes:Ut,collapsedTreePathSet:Yr,onToggleTreePath:an,onToggleMobileSelection:zr,selectedMobilePathSet:$,selectedTargets:ge,actioning:A,variant:"unstaged",swipeRowState:te,onSwipeRowChange:re,onStageToggle:Hn,onDiscardWithConfirm:ui,onClearSelectedTargets:()=>oe(V=>V.filter(be=>!ge.includes(be))),onPreviewFile:Dr})}),n.jsxs(ug,{title:o("git.recentVersionsTitle"),count:N,expanded:Me==="history",onToggle:()=>Te("history"),trailingContent:n.jsx("span",{className:"badge",children:gt}),headerAction:n.jsx("button",{className:"git-icon-button git-mobile-section-action",type:"button","aria-label":o("git.operationMenu"),title:o("git.operationMenu"),"aria-expanded":B,onClick:()=>{Te("history"),Q(V=>!V)},disabled:A,children:n.jsx(iu,{})}),children:[B?n.jsx("div",{className:"git-mobile-operations-shell",children:Ki()}):null,n.jsx(y8,{history:C,historyLoadingMore:H,hasMore:!!L,actioning:A,openCommitHash:Dt,onMenuTriggerRef:Oi,onToggleMenu:V=>st(be=>be===V?null:V),onViewCommitChanges:V=>void ar(V),onCopyCommitHash:V=>void ei(V,o("git.copyCommitHashSuccess")),onCopyCommitMessage:V=>void ei(kc(V),o("git.copyCommitMessageSuccess")),onCopyCommitVersion:V=>void Ke(V),onExplainCommitChange:V=>void Je(V),onUndoLastCommit:()=>void Pr(),onLoadMore:()=>void zt()})]})]}):n.jsxs("div",{ref:$t,className:"git-content-split",style:{gridTemplateRows:ci},children:[n.jsx("section",{className:"git-card git-tree-panel",children:n.jsxs("div",{ref:Zt,className:"git-tree-panel-body",children:[Dn.length>0?n.jsx(pj,{title:o("git.stagedChangesTitle"),count:Dn.length,nodes:Fr,selectedPath:O,collapsedTreePathSet:Yr,onToggleTreePath:an,onSelectFile:F,onPreviewFile:(V,be)=>{nn(V)&&Dr(V,be)},onToggleMobileSelection:zr,onStageToggle:Hn,onDiscard:ir,actioning:A,variant:"staged",isMobileViewport:_,selectedMobilePathSet:$,selectedTargets:me,mobileActionMenuOpen:ye==="staged",onToggleMobileActionMenu:()=>Ne(V=>V==="staged"?null:"staged"),onClearSelectedTargets:()=>oe(V=>V.filter(be=>!me.includes(be)))}):null,n.jsx(pj,{title:o("git.changesTitle"),count:lr.length,nodes:Ut,selectedPath:O,collapsedTreePathSet:Yr,onToggleTreePath:an,onSelectFile:F,onPreviewFile:(V,be)=>{nn(V)&&Dr(V,be)},onToggleMobileSelection:zr,onStageToggle:Hn,onDiscard:ir,actioning:A,variant:"unstaged",isMobileViewport:_,selectedMobilePathSet:$,selectedTargets:ge,mobileActionMenuOpen:ye==="unstaged",onToggleMobileActionMenu:()=>Ne(V=>V==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>oe(V=>V.filter(be=>!ge.includes(be)))})]})}),n.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":o("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":lj,"aria-valuemax":og,"aria-valuenow":D?li:og,"data-dragging":Ve,onPointerDown:yr,children:n.jsx("span",{className:"git-panel-divider-handle","aria-hidden":"true"})}),n.jsxs("section",{className:"git-card git-history-section",children:[n.jsxs("div",{className:"git-history-topbar",children:[n.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":D,"aria-label":o(D?"git.collapseRecentVersions":"git.expandRecentVersions"),onClick:()=>T(V=>!V),children:[n.jsxs("span",{className:"git-section-toggle-main",children:[n.jsx(Pm,{expanded:D}),n.jsx("span",{children:o("git.recentVersionsTitle")})]}),n.jsx("span",{className:"workbench-section-counter",children:N})]}),n.jsxs("div",{className:"git-history-actions",children:[n.jsx("span",{className:"badge",children:gt}),n.jsx("button",{className:"git-icon-button",type:"button",ref:Zn,"aria-label":o("git.operationMenu"),title:o("git.operationMenu"),onClick:()=>Q(V=>!V),disabled:A,children:n.jsx(iu,{})}),B?Ki({desktopFloating:!0}):null]})]}),D?n.jsx(bj,{history:C,historyLoadingMore:H,hasMore:!!L,actioning:A,openCommitHash:dt,onMenuTriggerRef:Oi,onScroll:er,onToggleMenu:V=>bt(be=>be===V?null:V),onViewCommitChanges:V=>void ar(V),onCopyCommitHash:V=>void ei(V,o("git.copyCommitHashSuccess")),onCopyCommitMessage:V=>void ei(kc(V),o("git.copyCommitMessageSuccess")),onCopyCommitVersion:V=>void Ke(V),onExplainCommitChange:V=>void Je(V),onUndoLastCommit:()=>void Pr(),onLoadMore:()=>void zt()}):null]})]}),n.jsxs(Ln,{open:Bt,title:o("git.selectRemoteTitle"),description:o("git.selectRemoteDesc"),onClose:()=>{A||Wt(!1)},children:[n.jsxs("div",{className:"git-remote-auth-banner",children:[n.jsxs("div",{className:"git-remote-auth-banner-copy",children:[n.jsx("strong",{children:o("git.remoteAuthStatusLabel")}),n.jsx("span",{children:o(cn?"git.remoteAuthConfigured":"git.remoteAuthNotConfigured")})]}),n.jsx("button",{className:"secondary-button",type:"button",disabled:A,onClick:()=>On(),children:o("git.remoteAuthAction")})]}),n.jsx("div",{className:"git-remote-select-list",children:Lt.map(V=>{const be=Sn.has(V.name),at=He.get(V.name);return n.jsxs("label",{className:"git-remote-item",children:[n.jsx("input",{type:"checkbox",checked:be,disabled:A,onChange:()=>{se(ot=>{const qt=new Set(ot);return qt.has(V.name)?qt.delete(V.name):qt.add(V.name),qt})}}),n.jsxs("span",{className:"git-remote-item-body",children:[n.jsx("span",{className:"git-remote-name",children:V.name}),n.jsx("span",{className:"git-remote-url",children:V.pushUrl}),at&&n.jsx("span",{className:`git-remote-result ${at.ok?"ok":"err"}`,children:at.summary})]})]},V.name)})}),n.jsxs("div",{className:"git-remote-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",disabled:A,onClick:()=>Wt(!1),children:o("common.close")}),n.jsx("button",{className:"primary-button",type:"button",disabled:A||Sn.size===0,onClick:()=>void Hr(Array.from(Sn)),children:A?o("git.pushing"):o("git.pushSelected",{count:String(Sn.size)})})]})]}),n.jsxs(Ln,{open:wn,title:o("git.remoteAuthTitle"),description:zn,onClose:()=>{A||kn(!1)},children:[n.jsxs("div",{className:"workbench-clone-form",children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneAuthModeLabel")}),n.jsxs("select",{value:Ht.authMode,disabled:A,onChange:V=>Gt(be=>({...be,authMode:V.target.value})),children:[n.jsx("option",{value:"none",children:o("shell.cloneAuthModeNone")}),n.jsx("option",{value:"basic",children:o("shell.cloneAuthModeBasic")}),n.jsx("option",{value:"token",children:o("shell.cloneAuthModeToken")})]})]}),Ht.authMode==="basic"?n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneUsernameLabel")}),n.jsx("input",{type:"text",value:Ht.username,placeholder:kr,autoComplete:"username",onChange:V=>Gt(be=>({...be,username:V.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:Zr}),n.jsx("input",{type:"password",value:Ht.password,placeholder:Gi,autoComplete:"current-password",onChange:V=>Gt(be=>({...be,password:V.target.value}))})]})]}):null,Ht.authMode==="token"?n.jsxs(n.Fragment,{children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneUsernameLabel")}),n.jsx("input",{type:"text",value:Ht.username,placeholder:o("shell.cloneTokenUsernamePlaceholder"),autoComplete:"username",onChange:V=>Gt(be=>({...be,username:V.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneTokenLabel")}),n.jsx("input",{type:"password",value:Ht.token,placeholder:o("shell.cloneTokenPlaceholder"),autoComplete:"current-password",onChange:V=>Gt(be=>({...be,token:V.target.value}))})]})]}):null,jn?n.jsx("p",{className:"git-remote-auth-hint",children:o("git.remoteAuthGithubPatHint")}):null,Ht.authMode!=="none"?n.jsxs("label",{className:"settings-checkbox git-remote-auth-remember-toggle",children:[n.jsx("input",{type:"checkbox",checked:Ht.rememberOnHost,onChange:V=>Gt(be=>({...be,rememberOnHost:V.target.checked}))}),n.jsx("span",{children:o("git.remoteAuthRemember")})]}):null,n.jsx("p",{className:"git-remote-auth-hint",children:o("git.remoteAuthSessionHint")})]}),n.jsxs("div",{className:"git-remote-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",disabled:A,onClick:()=>kn(!1),children:o("common.close")}),n.jsx("button",{className:"primary-button",type:"button",disabled:A,onClick:Fi,children:o("git.remoteAuthSave")})]})]}),n.jsx(Ln,{open:pt,title:o("git.viewAllVersions"),description:o("git.viewAllVersionsDescription",{count:String(N)}),onClose:()=>we(!1),children:n.jsx(bj,{history:C,historyLoadingMore:H,hasMore:!!L,actioning:A,openCommitHash:dt,className:"git-history-modal-list",onMenuTriggerRef:Oi,onToggleMenu:V=>bt(be=>be===V?null:V),onViewCommitChanges:V=>void ar(V),onCopyCommitHash:V=>void ei(V,o("git.copyCommitHashSuccess")),onCopyCommitMessage:V=>void ei(kc(V),o("git.copyCommitMessageSuccess")),onCopyCommitVersion:V=>void Ke(V),onExplainCommitChange:V=>void Je(V),onUndoLastCommit:()=>void Pr(),onLoadMore:()=>void zt()})}),n.jsx(Ln,{open:he!==null,className:"git-commit-detail-modal",title:(Be==null?void 0:Be.subject)||o("git.commitDetailTitle"),description:Be?o("git.commitDetailDescription",{hash:Be.shortHash}):o("git.commitDetailLoading"),onClose:ee,children:Oe?n.jsx("div",{className:"git-commit-detail-state",children:n.jsx("p",{children:o("git.commitDetailLoading")})}):wt?n.jsx("div",{className:"git-commit-detail-state is-error",children:n.jsx("p",{children:wt})}):Be?n.jsxs("div",{className:"git-commit-detail-shell",children:[n.jsxs("div",{className:"git-commit-detail-meta-grid",children:[n.jsxs("div",{className:"git-commit-detail-meta-card",children:[n.jsx("span",{children:o("git.commitVersionLabel")}),n.jsx("strong",{children:Be.versionLabel})]}),n.jsxs("div",{className:"git-commit-detail-meta-card",children:[n.jsx("span",{children:o("git.commitHashLabel")}),n.jsx("strong",{children:Be.commitHash})]}),n.jsxs("div",{className:"git-commit-detail-meta-card",children:[n.jsx("span",{children:o("git.commitAuthorLabel")}),n.jsx("strong",{children:Be.authorName})]}),n.jsxs("div",{className:"git-commit-detail-meta-card",children:[n.jsx("span",{children:o("git.commitTimeLabel")}),n.jsx("strong",{children:N8(Be.authoredAt)})]})]}),n.jsxs("section",{className:"git-commit-detail-section",children:[n.jsx("div",{className:"git-commit-detail-section-header",children:n.jsx("h3",{children:o("git.commitMessageLabel")})}),n.jsx("pre",{className:"git-commit-detail-message",children:kc(Be)})]}),n.jsxs("section",{className:"git-commit-detail-section",children:[n.jsxs("div",{className:"git-commit-detail-section-header",children:[n.jsx("h3",{children:o("git.changedFilesTitle")}),n.jsx("span",{className:"workbench-section-counter",children:Be.changedFiles.length})]}),n.jsx("div",{className:"git-commit-detail-file-list",children:Be.changedFiles.map(V=>n.jsxs("div",{className:"git-commit-detail-file-item",children:[n.jsx("span",{className:"git-commit-detail-file-status","data-status":V.status,children:V.status}),n.jsxs("div",{className:"git-commit-detail-file-copy",children:[n.jsx("strong",{children:V.path}),V.oldPath?n.jsx("span",{children:o("git.renamedFromLabel",{path:V.oldPath})}):null]})]},`${V.status}:${V.oldPath??""}:${V.path}`))})]}),n.jsxs("section",{className:"git-commit-detail-section",children:[n.jsxs("div",{className:"git-commit-detail-section-header",children:[n.jsx("h3",{children:o("git.commitDiffLabel")}),Be.diffTruncated?n.jsx("span",{className:"git-commit-detail-truncated",children:o("git.diffTruncated")}):null]}),n.jsx("pre",{className:"git-commit-detail-diff",children:Be.diffContent||o("git.emptyDiff")})]})]}):n.jsx("div",{className:"git-commit-detail-state",children:n.jsx("p",{children:o("git.commitDetailEmpty")})})}),n.jsx(Ln,{open:Ae,className:"git-explain-provider-modal",title:o("git.explainCommitTitle"),description:o("git.explainCommitDescription"),onClose:()=>{ct||(et(!1),ve(null),lt(null))},children:n.jsxs("div",{className:"git-explain-provider-shell",children:[n.jsx(cw,{workspaceId:t,selectedProvider:We,pendingProvider:ct?We:null,disabled:ct,onSelect:V=>lt(V)}),n.jsxs("div",{className:"git-explain-provider-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:ct,onClick:()=>{et(!1),ve(null),lt(null)},children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:!We||ct,onClick:()=>void Et(),children:o(ct?"conversation.sendingState":"git.startExplainCommit")})]})]})}),n.jsx(tR,{workspaceId:t,filePath:je,open:je!==null,onClose:()=>{ht(null),tn(null)},onSaved:async()=>{await An({resetTreeScroll:!0})},diffContent:Rt}),Ks()]})}function pj({title:e,count:t,nodes:r,selectedPath:i,collapsedTreePathSet:a,onToggleTreePath:c,onSelectFile:u,onPreviewFile:d,onToggleMobileSelection:m,onStageToggle:f,onDiscard:w,actioning:g,variant:v,isMobileViewport:y,selectedMobilePathSet:x,selectedTargets:C,mobileActionMenuOpen:j,onToggleMobileActionMenu:N,onClearSelectedTargets:P}){const L=Qw(r),Y=o(v==="staged"?"git.unstageAll":"git.stageAll");return n.jsxs("section",{className:"git-tree-group","data-variant":v,children:[n.jsxs("div",{className:"git-section-header git-tree-group-header",children:[n.jsx("h3",{children:e}),n.jsxs("div",{className:"git-tree-group-actions",children:[n.jsx("span",{className:"workbench-section-counter",children:t}),!y&&L.length>0?n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"git-icon-button",type:"button","aria-label":Y,title:Y,onClick:()=>void f(L,v==="staged"),disabled:g,children:n.jsx(bb,{staged:v==="staged"})}),v==="unstaged"?n.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":o("git.discardAll"),title:o("git.discardAll"),onClick:()=>void w(L),disabled:g,children:n.jsx(wb,{})}):null]}):null,y&&C.length>0?n.jsx("button",{className:"git-icon-button",type:"button","aria-label":o("git.operationMenu"),title:o("git.operationMenu"),onClick:N,disabled:g,children:n.jsx(iu,{})}):null]}),y&&j?n.jsxs("div",{className:"git-selection-menu",children:[n.jsxs("div",{className:"git-menu-section",children:[n.jsx("span",{className:"git-menu-caption",children:o("git.selectedFiles")}),n.jsx("strong",{className:"git-menu-branch",children:C.length})]}),n.jsxs("div",{className:"git-menu-section",children:[n.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:()=>void f(C,v==="staged"),children:n.jsx("span",{children:o(v==="staged"?"git.unstage":"git.stage")})}),v==="unstaged"?n.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:()=>void w(C),children:n.jsx("span",{children:o("git.discard")})}):null,n.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:P,children:n.jsx("span",{children:o("git.clearSelection")})})]})]}):null]}),n.jsx("div",{className:"git-tree-shell",role:"tree","aria-label":e,children:r.length?wR({nodes:r,depth:0,collapsedTreePathSet:a,selectedPath:i,onToggleTreePath:c,onSelectFile:u,onPreviewFile:d,onToggleMobileSelection:m,onStageToggle:f,onDiscard:w,actioning:g,variant:v,isMobileViewport:y,selectedMobilePathSet:x}):n.jsx("p",{className:"git-tree-status",children:o("git.noChanges")})})]})}function ug({title:e,count:t,expanded:r,onToggle:i,trailingContent:a,headerAction:c,children:u}){return n.jsxs("section",{className:"git-mobile-section","data-expanded":r,children:[n.jsxs("div",{className:"git-mobile-section-header",children:[n.jsxs("button",{className:"git-mobile-section-toggle",type:"button","aria-expanded":r,onClick:i,children:[n.jsxs("span",{className:"git-mobile-section-toggle-main",children:[n.jsx(Pm,{expanded:r}),n.jsx("h3",{children:e})]}),n.jsxs("span",{className:"git-mobile-section-toggle-meta",children:[a,n.jsx("span",{className:"workbench-section-counter",children:t})]})]}),c?n.jsx("div",{className:"git-mobile-section-header-action",children:c}):null]}),r?n.jsx("div",{className:"git-mobile-section-body",children:u}):null]})}function fj({title:e,nodes:t,collapsedTreePathSet:r,onToggleTreePath:i,onToggleMobileSelection:a,selectedMobilePathSet:c,selectedTargets:u,actioning:d,variant:m,swipeRowState:f,onSwipeRowChange:w,onStageToggle:g,onDiscardWithConfirm:v,onClearSelectedTargets:y,onPreviewFile:x}){return n.jsxs("div",{className:"git-mobile-record-shell",children:[u.length>0?n.jsxs("div",{className:"git-mobile-selection-toolbar",children:[n.jsxs("span",{className:"git-mobile-selection-count",children:[o("git.selectedFiles")," ",u.length]}),n.jsxs("div",{className:"git-mobile-selection-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:()=>void g(u,m==="staged"),children:o(m==="staged"?"git.unstage":"git.stage")}),m==="unstaged"?n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:d,onClick:()=>void v(u,`${u.length}`),children:o("git.discard")}):null,n.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:y,children:o("git.clearSelection")})]})]}):null,n.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":e,children:t.length?bR({nodes:t,depth:0,collapsedTreePathSet:r,onToggleTreePath:i,onToggleMobileSelection:a,selectedMobilePathSet:c,actioning:d,variant:m,swipeRowState:f,onSwipeRowChange:w,onStageToggle:g,onDiscardWithConfirm:v,onPreviewFile:x}):n.jsx("p",{className:"git-tree-status",children:o("git.noChanges")})})]})}function bR({nodes:e,depth:t,collapsedTreePathSet:r,onToggleTreePath:i,onToggleMobileSelection:a,selectedMobilePathSet:c,actioning:u,variant:d,swipeRowState:m,onSwipeRowChange:f,onStageToggle:w,onDiscardWithConfirm:g,onPreviewFile:v}){return e.map(y=>{if(y.kind==="directory"){const j=!r.has(y.path),N=Qw(y.children),P=`directory:${y.path}`;return n.jsxs("div",{className:"git-mobile-record-branch",children:[n.jsx(gj,{rowKey:P,openState:(m==null?void 0:m.path)===P?m.direction:null,onOpenStateChange:L=>f(L?{path:P,direction:L}:null),trailingActions:N.length>0?[{label:o(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void w(N,d==="staged")},...d==="unstaged"?[{label:o("git.discard"),tone:"danger",onPress:()=>void g(N,y.path)}]:[]]:null,children:n.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${hj+t*mj}px`},onClick:()=>i(y.path),children:[n.jsxs("span",{className:"git-mobile-record-leading",children:[n.jsx("span",{className:"git-tree-chevron","data-expanded":j,children:n.jsx(Pm,{expanded:j})}),n.jsx("span",{className:"git-mobile-record-title",children:y.name})]}),n.jsx("span",{className:"git-mobile-record-meta",children:N.length})]})}),j?n.jsx("div",{className:"git-mobile-record-children",role:"group",children:bR({nodes:y.children,depth:t+1,collapsedTreePathSet:r,onToggleTreePath:i,onToggleMobileSelection:a,selectedMobilePathSet:c,actioning:u,variant:d,swipeRowState:m,onSwipeRowChange:f,onStageToggle:w,onDiscardWithConfirm:g,onPreviewFile:v})}):null]},P)}const x=`file:${y.path}`,C=c.has(y.path);return n.jsx(gj,{rowKey:x,openState:(m==null?void 0:m.path)===x?m.direction:null,onOpenStateChange:j=>f(j?{path:x,direction:j}:null),trailingActions:[{label:o("git.preview"),tone:"neutral",onPress:()=>v(y.change.path,y.change)},{label:o(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void w([y.change.path],d==="staged")},...d==="unstaged"?[{label:o("git.discard"),tone:"danger",onPress:()=>void g([y.change.path],y.path)}]:[]],children:n.jsxs("div",{className:"git-mobile-record git-mobile-record-file","data-active":C,style:{paddingInlineStart:`${hj+t*mj}px`},children:[n.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:C,"aria-label":`${o("git.selectFile")} ${y.name}`,onChange:()=>a(y.change.path)}),n.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>a(y.change.path),children:[n.jsx("span",{className:"git-tree-file-icon","data-kind":Ro(y.name),"aria-hidden":"true",children:Do(y.name)}),n.jsxs("span",{className:"git-mobile-record-copy",children:[n.jsx("span",{className:"git-mobile-record-title",children:y.name}),n.jsx("span",{className:"git-mobile-record-path",children:y.path})]}),n.jsx("span",{className:"git-status-badge","data-status":y.status,children:y.status})]})]})},x)})}function gj({rowKey:e,openState:t,onOpenStateChange:r,trailingActions:i,children:a}){const c=ms(),u=p.useRef(null),[d,m]=p.useState(0),f=((i==null?void 0:i.length)??0)*lg;p.useEffect(()=>{t||m(0)},[t,e]);const w=d!==0?d:t==="trailing"?-f:0;function g(C){var j,N;C.button===0&&(u.current={pointerId:C.pointerId,startX:C.clientX},(N=(j=C.currentTarget).setPointerCapture)==null||N.call(j,C.pointerId))}function v(C){const j=u.current;if(!j||j.pointerId!==C.pointerId)return;const N=f>0?f+10:0,P=Math.max(-N,Math.min(0,C.clientX-j.startX));m(P)}function y(C){var N,P;const j=u.current;if(!(!j||j.pointerId!==C.pointerId)){if((P=(N=C.currentTarget).releasePointerCapture)==null||P.call(N,C.pointerId),u.current=null,d<=-44&&(i!=null&&i.length)){c.trigger("gesture"),r("trailing"),m(0);return}r(null),m(0)}}function x(C){var N,P;const j=u.current;!j||j.pointerId!==C.pointerId||((P=(N=C.currentTarget).releasePointerCapture)==null||P.call(N,C.pointerId),u.current=null,m(0))}return n.jsxs("div",{className:"git-mobile-swipe-row","data-open-state":t??"closed","data-dragging":d!==0,children:[i==null?void 0:i.map((C,j)=>n.jsx("button",{type:"button",className:"git-mobile-swipe-action trailing","data-tone":C.tone,style:{right:j*lg,width:lg},onClick:()=>{c.trigger(C.tone==="danger"?"warning":"action"),r(null),C.onPress()},children:C.label},`trailing-${j}`)),n.jsx("div",{className:"git-mobile-swipe-content",style:{transform:`translateX(${w}px)`},onPointerDown:g,onPointerMove:v,onPointerUp:y,onPointerCancel:x,children:a})]})}function y8({history:e,historyLoadingMore:t,hasMore:r,actioning:i,openCommitHash:a,onMenuTriggerRef:c,onToggleMenu:u,onViewCommitChanges:d,onCopyCommitHash:m,onCopyCommitMessage:f,onCopyCommitVersion:w,onExplainCommitChange:g,onUndoLastCommit:v,onLoadMore:y}){return e.length?n.jsxs("div",{className:"git-mobile-history-list",children:[e.map(x=>n.jsx("article",{className:"git-mobile-history-entry","data-kind":x.commitKind,children:n.jsxs("div",{className:"git-mobile-history-entry-main",children:[n.jsx("span",{className:"git-history-marker","data-kind":x.commitKind,"aria-hidden":"true"}),n.jsxs("div",{className:"git-mobile-history-copy",children:[n.jsxs("div",{className:"git-history-title-row",children:[n.jsx("strong",{title:x.subject,children:x.subject}),n.jsx("span",{className:"git-history-kind-badge","data-kind":x.commitKind,children:xR(x.commitKind)})]}),x.refs.length>0?n.jsx("div",{className:"git-history-ref-list",children:x.refs.map(C=>n.jsx("span",{className:"git-history-ref-pill","data-kind":C.kind,"data-remote-index":String(SR(C.remoteName)),children:C.name},`${x.commitHash}:${C.kind}:${C.name}`))}):null,n.jsxs("div",{className:"git-history-meta",children:[n.jsx("span",{className:"git-history-hash",children:x.commitHash.slice(0,8)}),n.jsx("span",{children:x.authorName}),n.jsx("time",{dateTime:x.authoredAt,children:CR(x.authoredAt)})]})]}),n.jsx("button",{type:"button",className:"git-icon-button",ref:C=>c(x.commitHash,C),"aria-label":o("git.historyItemMenu"),onClick:()=>u(x.commitHash),children:n.jsx(iu,{})})]})},x.commitHash)),r?n.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:t,onClick:y,children:t?`${o("git.refreshNow")}...`:o("common.loadMore")}):null]}):n.jsx("p",{className:"git-tree-status",children:o("git.noHistory")})}function bj({history:e,historyLoadingMore:t,hasMore:r,actioning:i,openCommitHash:a,className:c,onMenuTriggerRef:u,onScroll:d,onToggleMenu:m,onViewCommitChanges:f,onCopyCommitHash:w,onCopyCommitMessage:g,onCopyCommitVersion:v,onExplainCommitChange:y,onUndoLastCommit:x,onLoadMore:C}){return e.length?n.jsxs("div",{className:["git-history-list",c].filter(Boolean).join(" "),onScroll:d,children:[e.map(j=>{const N=a===j.commitHash;return n.jsxs("article",{className:"git-history-entry","data-kind":j.commitKind,"data-menu-open":N?"true":"false",children:[n.jsx("span",{className:"git-history-marker","data-kind":j.commitKind,"aria-hidden":"true"}),n.jsxs("div",{className:"git-history-body",children:[n.jsxs("div",{className:"git-history-title-row",children:[n.jsx("strong",{title:j.subject,children:j.subject}),n.jsxs("div",{className:"git-history-title-actions",children:[n.jsx("span",{className:"git-history-kind-badge","data-kind":j.commitKind,children:xR(j.commitKind)}),n.jsx("button",{type:"button",className:"git-icon-button git-history-more",ref:P=>u(j.commitHash,P),"aria-label":o("git.historyItemMenu"),onClick:()=>m(j.commitHash),children:n.jsx(iu,{})})]})]}),j.refs.length>0?n.jsx("div",{className:"git-history-ref-list",children:j.refs.map(P=>n.jsx("span",{className:"git-history-ref-pill","data-kind":P.kind,"data-remote-index":String(SR(P.remoteName)),children:P.name},`${j.commitHash}:${P.kind}:${P.name}`))}):null,n.jsxs("div",{className:"git-history-meta",children:[n.jsx("span",{className:"git-history-hash",children:j.commitHash.slice(0,8)}),n.jsx("span",{children:j.authorName}),n.jsx("time",{dateTime:j.authoredAt,children:CR(j.authoredAt)})]})]})]},j.commitHash)}),t?n.jsxs("p",{className:"git-history-loading",children:[o("git.refreshNow"),"..."]}):null,r?n.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:t,onClick:C,children:t?`${o("git.refreshNow")}...`:o("common.loadMore")}):null]}):n.jsx("p",{className:"status-text",children:o("git.noHistory")})}function k8({item:e,canUndo:t,actioning:r,onViewCommitChanges:i,onCopyCommitHash:a,onCopyCommitMessage:c,onCopyCommitVersion:u,onExplainCommitChange:d,onUndoLastCommit:m}){return n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>i(e.commitHash),children:n.jsx("span",{children:o("git.viewCommitChanges")})}),n.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>a(e.commitHash),children:n.jsx("span",{children:o("git.copyCommitHash")})}),n.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>c(e),children:n.jsx("span",{children:o("git.copyCommitMessage")})}),n.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>u(e.commitHash),children:n.jsx("span",{children:o("git.copyCommitVersion")})}),n.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>d(e.commitHash),children:n.jsx("span",{children:o("git.explainCommitAction")})}),t?n.jsx("button",{type:"button",className:"git-menu-item",disabled:r,onClick:m,children:n.jsx("span",{children:o("git.undoLastCommit")})}):null]})}function wR({nodes:e,depth:t,collapsedTreePathSet:r,selectedPath:i,onToggleTreePath:a,onSelectFile:c,onPreviewFile:u,onToggleMobileSelection:d,onStageToggle:m,onDiscard:f,actioning:w,variant:g,isMobileViewport:v,selectedMobilePathSet:y}){return e.map(x=>{if(x.kind==="directory"){const N=!r.has(x.path),P=Qw(x.children),L=`${o(g==="staged"?"git.unstage":"git.stage")} ${x.path}`,Y=`${o("git.discard")} ${x.path}`;return n.jsxs("div",{className:"git-tree-node",children:[n.jsxs("div",{className:"git-tree-row",role:"treeitem","aria-expanded":N,children:[n.jsxs("button",{className:"git-tree-trigger",type:"button",style:{paddingInlineStart:`${6+t*8}px`},onClick:()=>a(x.path),children:[n.jsx("span",{className:"git-tree-chevron","data-expanded":N,children:n.jsx(Pm,{expanded:N})}),n.jsx("span",{className:"git-tree-label git-tree-label-directory",children:x.name})]}),!v&&P.length>0?n.jsxs("div",{className:"git-row-actions",children:[n.jsx("button",{className:"git-icon-button",type:"button","aria-label":L,title:L,onClick:()=>void m(P,g==="staged"),disabled:w,children:n.jsx(bb,{staged:g==="staged"})}),g==="unstaged"?n.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":Y,title:Y,onClick:()=>void f(P),disabled:w,children:n.jsx(wb,{})}):null]}):null]}),N?n.jsx("div",{className:"git-tree-children",role:"group",children:wR({nodes:x.children,depth:t+1,collapsedTreePathSet:r,selectedPath:i,onToggleTreePath:a,onSelectFile:c,onPreviewFile:u,onToggleMobileSelection:d,onStageToggle:m,onDiscard:f,actioning:w,variant:g,isMobileViewport:v,selectedMobilePathSet:y})}):null]},`directory:${x.path}`)}const C=y.has(x.path),j=v?C:i===x.path;return v?n.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":j,"data-mobile":"true",children:[n.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:C,"aria-label":`${o("git.selectFile")} ${x.name}`,onChange:()=>d(x.change.path)}),n.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":j,"data-mobile":"true",style:{paddingInlineStart:`${18+t*8}px`},onClick:()=>d(x.change.path),children:[n.jsx("span",{className:"git-tree-file-icon","data-kind":Ro(x.name),"aria-hidden":"true",children:Do(x.name)}),n.jsx("span",{className:"git-tree-label-wrap",children:n.jsx("span",{className:"git-tree-label",children:x.name})}),n.jsx("span",{className:"git-tree-file-meta",children:n.jsx("span",{className:"git-status-badge","data-status":x.status,children:x.status})})]})]},`file:${x.path}`):n.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":j,children:[n.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":j,style:{paddingInlineStart:`${18+t*8}px`},onClick:()=>{c(x.change.path),u&&u(x.change.path,x.change)},children:[n.jsx("span",{className:"git-tree-file-icon","data-kind":Ro(x.name),"aria-hidden":"true",children:Do(x.name)}),n.jsx("span",{className:"git-tree-label-wrap",children:n.jsx("span",{className:"git-tree-label",children:x.name})}),n.jsx("span",{className:"git-tree-file-meta",children:n.jsx("span",{className:"git-status-badge","data-status":x.status,children:x.status})})]}),n.jsxs("div",{className:"git-row-actions",children:[n.jsx("button",{className:"git-icon-button",type:"button","aria-label":x.variant==="staged"?o("git.unstage"):o("git.stage"),title:x.variant==="staged"?o("git.unstage"):o("git.stage"),onClick:()=>void m([x.change.path],x.variant==="staged"),disabled:w,children:n.jsx(bb,{staged:x.variant==="staged"})}),g==="unstaged"?n.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":o("git.discard"),title:o("git.discard"),onClick:()=>void f([x.change.path]),disabled:w,children:n.jsx(wb,{})}):null]})]},`file:${x.path}`)})}function wj(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function vj(e,t){const r=wj("","");for(const i of e){const a=i.path.replace(/\\/g,"/"),c=a.split("/").filter(Boolean);let u=r;c.forEach((d,m)=>{const f=c.slice(0,m+1).join("/");if(m===c.length-1){u.children.set(`file:${f}`,{kind:"file",name:d,path:a,change:i,status:x8(i,t),variant:t});return}const w=`directory:${f}`,g=u.children.get(w);if(g&&g.kind==="directory"){u=g;return}const v=wj(d,f);u.children.set(w,v),u=v})}return yR(vR([...r.children.values()]))}function vR(e){return[...e].sort((t,r)=>t.kind!==r.kind?t.kind==="directory"?-1:1:t.name.localeCompare(r.name,"zh-CN")).map(t=>t.kind==="directory"?{kind:"directory",name:t.name,path:t.path,children:vR([...t.children.values()])}:t)}function yR(e){return e.map(t=>{var u;if(t.kind!=="directory")return t;const r=yR(t.children);let i=t.name,a=t.path,c=r;for(;c.length===1&&((u=c[0])==null?void 0:u.kind)==="directory";){const d=c[0];i=`${i}/${d.name}`,a=d.path,c=d.children}return{kind:"directory",name:i,path:a,children:c}})}function yj(e,t,r){const i=new Set(e);return t.filter(a=>fb(a,r)&&i.has(a.path)).map(a=>a.path)}function Qw(e){const t=[],r=new Set;function i(a){if(a.kind==="file"){r.has(a.path)||(r.add(a.path),t.push(a.path));return}a.children.forEach(i)}return e.forEach(i),t}function fb(e,t){return t==="staged"?!!e.stagedStatus:!!e.worktreeStatus}function x8(e,t){return t==="staged"?e.stagedStatus??e.status:e.worktreeStatus??e.status}function S8(e){return{subject:kR(e).trim(),body:null,footer:null,source:"manual"}}function kR(e){return e.replace(/[\r\n]+/g," ")}function kc(e){const t=e.subject.trim(),r=e.body.trim();return r?`${t}
|
|
110
|
-
|
|
111
|
-
${r}`:t}function C8(e){const t=e.changedFiles.map(a=>`- [${a.status}] ${a.path}${a.oldPath?` (from ${a.oldPath})`:""}`).join(`
|
|
112
|
-
`),r=e.diffContent.length>cg?e.diffContent.slice(0,cg):e.diffContent,i=e.diffContent.length>cg||e.diffTruncated?`
|
|
113
|
-
注意:diff 内容过长,下面已经截断,只分析可见部分,同时明确指出可能遗漏的区域。`:"";return["请你分析下面这个 Git 提交。","输出要求:","1. 先用 3 到 5 句话说明这次改动的核心目的。","2. 按文件说明关键改动点,不要泛泛而谈。","3. 指出潜在风险、边界情况和可能的回归点。","4. 如果提交信息写得差,给出一条更合适的中文提交说明。","",`版本号:${e.versionLabel}`,`Commit Hash:${e.commitHash}`,`提交标题:${e.subject}`,`提交作者:${e.authorName} <${e.authorEmail}>`,`提交时间:${e.authoredAt}`,"","变更文件:",t||"- 无",i,"","Diff:",r||"(empty diff)"].join(`
|
|
114
|
-
`)}function j8(e){if(!e)return;e.style.height="0px";const t=Math.min(Math.max(e.scrollHeight,34),120);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>120?"auto":"hidden"}function xR(e){switch(e){case"local":return o("git.historyKindLocal");case"remote":return o("git.historyKindRemote");default:return o("git.historyKindShared")}}function SR(e){if(!e)return 0;let t=0;for(const r of e)t=t*33+r.charCodeAt(0)>>>0;return t%6}function N8(e){const t=Date.parse(e);return Number.isNaN(t)?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).format(t)}function ji(e,t){return e instanceof Kr?T8(e)??e.message:typeof e=="object"&&e&&"message"in e?e.message:t}function dg(e){return`git-sidebar.snapshot.${e}`}function T8(e){switch(e.errorCode){case"UNAUTHORIZED":return o("git.errors.unauthorized");case"WORKSPACE_NOT_FOUND":return o("git.errors.workspaceNotFound");case"INVALID_WORKSPACE":return o("git.errors.invalidWorkspace");case"NOT_GIT_REPOSITORY":return o("git.errors.notGitRepository");case"GIT_REPO_NOT_FOUND":return o("git.errors.repoNotFound");case"PATH_OUT_OF_WORKSPACE":return o("git.errors.pathOutOfWorkspace");case"INVALID_TARGET":return o("git.errors.invalidTarget");case"NOT_STAGED":return o("git.errors.notStaged");case"EMPTY_STAGED_CHANGES":return o("git.errors.emptyStagedChanges");case"BRANCH_CONFLICT":return o("git.errors.branchConflict");case"BRANCH_NOT_FOUND":return o("git.errors.branchNotFound");case"REMOTE_NOT_FOUND":return o("git.errors.remoteNotFound");case"GIT_REMOTE_AUTH_FAILED":return o("git.errors.remoteAuthFailed");case"GIT_PUSH_FAILED":return o("git.errors.pushFailed");case"GIT_PULL_FAILED":return o("git.errors.pullFailed");case"GIT_REMOTE_FAILED":return o("git.errors.remoteFailed");case"GIT_COMMAND_TIMEOUT":return o("git.errors.commandTimeout");case"GIT_DISCARD_FAILED":return o("git.discardFailed");case"GIT_UNDO_FAILED":return o("git.undoLastCommitFailed");default:return null}}function kj(e){return e instanceof Kr&&e.errorCode==="GIT_REMOTE_AUTH_FAILED"}function P8(e){return!e||!e.mode||e.mode==="none"?tm:e.mode==="basic"?{authMode:"basic",username:e.username??"",password:e.password??"",token:"",rememberOnHost:!1}:e.mode==="token"?{authMode:"token",username:e.username??"",password:"",token:e.token??"",rememberOnHost:!1}:tm}function D8(e){return e.authMode==="none"?null:e.authMode==="basic"?{mode:"basic",username:e.username.trim(),password:e.password}:{mode:"token",username:e.username.trim()||void 0,token:e.token}}function R8(e,t){const r=e.find(a=>a.name===t)??e.find(a=>a.name==="origin")??e[0];if(!r)return"generic";const i=r.pushUrl||r.fetchUrl;return M8(i)?"github":"generic"}function M8(e){const t=(e==null?void 0:e.trim().toLowerCase())??"";return t.startsWith("https://github.com/")||t.startsWith("http://github.com/")||t.startsWith("ssh://git@github.com/")||t.startsWith("git@github.com:")}function gb(e,t,r){const i=Math.max(0,r.width),a=Math.max(0,r.height),c=Math.max(0,a-Ri*2),u=Math.max(0,i-Ri*2),d=Math.min(Math.max(t.width||pb,0),u),m=Math.max(0,a-e.bottom-rh-Ri),f=Math.max(0,e.top-rh-Ri),w=m<t.height&&f>m,v=hg(Math.max(w?f:m,v8),0,c),y=Math.min(Math.max(t.height,0),v),x=w?e.top-rh-y:e.bottom+rh,C=Math.max(Ri,a-Ri-y),j=Math.max(Ri,i-Ri-d);return{top:hg(x,Ri,C),left:hg(e.right-d,Ri,j),maxHeight:Math.max(0,v),transformOrigin:`${w?"bottom":"top"} right`}}function hg(e,t,r){return!Number.isFinite(e)||r<t?t:Math.min(Math.max(e,t),r)}function Pm({expanded:e}){return n.jsx("svg",{className:"git-chevron-icon",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:e?"rotate(0deg)":"rotate(-90deg)"},"aria-hidden":"true",children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})}function bb({staged:e}){return e?n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:n.jsx("path",{d:"M5 12h14"})}):n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[n.jsx("path",{d:"M12 5v14"}),n.jsx("path",{d:"M5 12h14"})]})}function wb(){return n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[n.jsx("path",{d:"M10 7L6 11l4 4",strokeLinecap:"round",strokeLinejoin:"round"}),n.jsx("path",{d:"M7 11h7c3.87 0 7 3.13 7 7 0 1.9-.76 3.63-2 4.89",strokeLinecap:"round",strokeLinejoin:"round"})]})}function A8(){return n.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:n.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"})})}function iu(){return n.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[n.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),n.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function CR(e){try{return new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(e))}catch{return e}}const E8=Object.freeze(Object.defineProperty({__proto__:null,GitSidebar:Xw,resolveGitOperationsMenuPosition:gb},Symbol.toStringTag,{value:"Module"}));function CK(){return Ue.request("/api/terminals/shells")}function jK(e){return Ue.request(`/api/terminals?workspaceId=${encodeURIComponent(e)}`)}function I8(e){return Ue.request(`/api/terminals/templates/${encodeURIComponent(e)}/stop`,{method:"POST"})}function NK(e){return Ue.request("/api/terminals",{method:"POST",body:JSON.stringify(e)})}function TK(e){return Ue.request(`/api/terminals/${encodeURIComponent(e)}`,{method:"DELETE"})}function PK(e){return Ue.request(`/api/terminals/${encodeURIComponent(e)}/record`,{method:"DELETE"})}function DK(e,t={}){const r=new URLSearchParams;typeof t.beforeSeq=="number"&&r.set("beforeSeq",String(t.beforeSeq)),typeof t.limit=="number"&&r.set("limit",String(t.limit));const i=r.toString();return Ue.request(`/api/terminals/${encodeURIComponent(e)}/history${i?`?${i}`:""}`)}function L8(e){return Ue.request("/api/terminals/templates",{method:"POST",body:JSON.stringify(e)})}function F8(e,t){return Ue.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function _8(e){return Ue.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"DELETE"})}function xj(e,t){return Ue.request(`/api/terminals/templates/${encodeURIComponent(e)}/run`,{method:"POST",body:JSON.stringify(t)})}function O8(e){return[{value:"",label:o("terminal.runtimeAutoOption"),description:o("terminal.runtimeAutoDescription")},{value:"tmux",label:e==="windows"?o("terminal.runtimePersistentLabel"):"tmux",description:o(e==="windows"?"terminal.runtimeWindowsPersistentDescription":"terminal.runtimeTmuxDescription")},{value:"embedded-pty",label:"embedded-pty",description:o("terminal.runtimeEmbeddedDescription")}]}function Sj(e,t){return e?e==="conpty-powershell"?o("terminal.runtimeConptyPowerShellLabel"):e==="conpty-cmd"?o("terminal.runtimeConptyCmdLabel"):e==="conpty-git-bash"?o("terminal.runtimeConptyGitBashLabel"):e==="tmux"&&t==="windows"?o("terminal.runtimePersistentLabel"):e:o("terminal.runtimeAutoOption")}function RK(e,t){return e?e==="embedded-pty"?"pty":e==="conpty-powershell"||e==="conpty-cmd"||e==="conpty-git-bash"||e==="tmux"&&t==="windows"?o("terminal.runtimePersistentShortLabel"):e:o("terminal.runtimeAutoShortLabel")}function B8(e){return e instanceof Kr?e.errorCode==="RUNTIME_DEPENDENCY_MISSING"||e.message.includes("当前系统未安装 tmux"):!1}function W8({open:e,busy:t=!1,onClose:r,onConfirmFallback:i}){return p.useEffect(()=>{if(!e)return;function a(c){c.key==="Escape"&&!t&&r()}return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[t,r,e]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:()=>{t||r()}}),n.jsxs("section",{className:"workbench-modal-card surface-card terminal-runtime-fallback-modal",role:"dialog","aria-modal":"true","aria-label":o("terminal.runtimeMissingDialogTitle"),children:[n.jsxs("div",{className:"workbench-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:o("terminal.runtimeMissingDialogTitle")}),n.jsx("p",{children:o("terminal.runtimeMissingDialogDescription")})]}),n.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":o("common.close"),onClick:()=>{t||r()},children:"x"})]}),n.jsxs("div",{className:"workbench-modal-body terminal-runtime-fallback-body",children:[n.jsxs("section",{className:"terminal-runtime-fallback-section",children:[n.jsx("span",{className:"badge","data-tone":"error",children:"tmux"}),n.jsx("p",{className:"status-text",children:o("terminal.runtimeMissingInstallDescription")}),n.jsxs("ul",{className:"terminal-runtime-fallback-list",children:[n.jsx("li",{children:o("terminal.runtimeMissingInstallMacArm")}),n.jsx("li",{children:o("terminal.runtimeMissingInstallMacIntel")}),n.jsx("li",{children:o("terminal.runtimeMissingInstallDebian")}),n.jsx("li",{children:o("terminal.runtimeMissingInstallFedora")})]})]}),n.jsxs("section",{className:"terminal-runtime-fallback-section",children:[n.jsx("span",{className:"badge",children:"embedded-pty"}),n.jsx("p",{className:"status-text",children:o("terminal.runtimeMissingFallbackDescription")})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:r,children:o("terminal.runtimeMissingKeepAction")}),n.jsx("button",{type:"button",className:"primary-button",disabled:t,onClick:i,children:o(t?"terminal.runtimeMissingFallbackPending":"terminal.runtimeMissingFallbackAction")})]})]})]})]}),document.body)}const ih={mode:"command",name:"",cwd:"",target:"",args:"",port:"",proxyEnabled:!1},Cj=60*1e3;function U8(e){return e?new Date(e).toLocaleString():o("common.unknown")}function H8(e){return e.split(" ").map(t=>t.trim()).filter(Boolean)}function z8(e){var t,r,i;return((t=e.find(a=>a.id==="cmd"&&a.available))==null?void 0:t.id)??((r=e.find(a=>a.available))==null?void 0:r.id)??((i=e[0])==null?void 0:i.id)??""}function q8(e){const t=e.name.trim();if(t)return t;const r=e.target.trim(),i=e.args.trim();return r?i?`${r} ${i}`:r:e.mode==="script"?o("terminalManager.defaultScriptName"):o("terminalManager.defaultCommandName")}function $8(e){const t=e.args.join(" ");return t?`${e.command} ${t}`:e.command}function V8(e){return{mode:jR(e),name:e.name,cwd:e.cwd,target:e.command,args:e.args.join(" "),port:e.port===null?"":String(e.port),proxyEnabled:e.proxyEnabled}}function G8(e){return Nb(`/proxy/${encodeURIComponent(e)}`)}function jR(e){const t=e.command.toLowerCase();return t.endsWith(".ps1")||t.endsWith(".bat")||t.endsWith(".cmd")||t.endsWith(".sh")?"script":"command"}function K8(e){const t=e.trim();if(!t)return null;const r=Number(t);return Number.isInteger(r)?r:Number.NaN}function jj(e,t){return e.get(t)??null}function Y8(e,t){return e.port===null?{tone:"untracked",title:o("terminalManager.portUnset"),summary:o("terminalManager.portUnsetDescription"),badgeLabel:o("terminalManager.portUnset")}:t!=null&&t.occupied?{tone:"running",title:o("terminalManager.portOccupied"),summary:t.processName||o("terminalManager.processCommandFallback"),badgeLabel:t.processId?`PID ${t.processId}`:o("terminalManager.statusRunning"),badgeTone:"success"}:{tone:"idle",title:o("terminalManager.portAvailable"),summary:o("terminalManager.portAvailableDescription"),badgeLabel:o("terminalManager.statusStopped")}}function X8({open:e,title:t,description:r,onClose:i,children:a,className:c}){return p.useEffect(()=>{if(!e)return;function u(d){d.key==="Escape"&&i()}return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},[i,e]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:i}),n.jsxs("section",{className:["workbench-modal-card","surface-card","terminal-manager-modal-card",c].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-label":t,children:[n.jsxs("div",{className:"workbench-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:t}),n.jsx("p",{children:r})]}),n.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":o("common.close"),onClick:i,children:"x"})]}),n.jsx("div",{className:"workbench-modal-body",children:a})]})]}),document.body)}function Q8({open:e,busy:t,title:r,description:i,confirmLabel:a,onClose:c,onConfirm:u,className:d}){return p.useEffect(()=>{if(!e)return;function m(f){f.key==="Escape"&&!t&&c()}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[t,c,e]),!e||typeof document>"u"?null:Vn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),disabled:t,onClick:c}),n.jsxs("section",{className:["workbench-modal-card","surface-card",d].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-label":r,children:[n.jsx("div",{className:"workbench-modal-header",children:n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{children:r}),n.jsx("p",{children:i})]})}),n.jsx("div",{className:"workbench-modal-body",children:n.jsxs("div",{className:"workbench-modal-actions terminal-manager-confirm-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:c,children:o("common.cancel")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:t,onClick:()=>{u()},children:t?o("terminalManager.templateRemoving"):a})]})})]})]}),document.body)}function Nj({label:e,value:t,options:r,open:i,onToggle:a,onChange:c}){const u=r.find(d=>d.value===t)??r[0]??null;return n.jsxs("div",{className:"field-group terminal-manager-mobile-picker",children:[n.jsx("span",{children:e}),n.jsxs("button",{type:"button",className:"terminal-manager-mobile-picker-trigger","aria-label":`${e} ${(u==null?void 0:u.label)??""}`.trim(),"aria-expanded":i?"true":"false",onClick:a,children:[n.jsxs("span",{className:"terminal-manager-mobile-picker-copy",children:[n.jsx("strong",{children:(u==null?void 0:u.label)??o("common.unknown")}),u!=null&&u.description?n.jsx("span",{children:u.description}):null]}),n.jsx(J8,{expanded:i})]}),i?n.jsx("div",{className:"terminal-manager-mobile-picker-list",role:"listbox","aria-label":e,children:r.map(d=>{const m=d.value===t;return n.jsxs("button",{type:"button",role:"option",className:"terminal-manager-mobile-picker-option","aria-selected":m,disabled:d.disabled,onClick:()=>{c(d.value)},children:[n.jsxs("span",{className:"terminal-manager-mobile-picker-option-copy",children:[n.jsx("strong",{children:d.label}),d.description?n.jsx("span",{children:d.description}):null]}),n.jsx("span",{className:"terminal-manager-mobile-picker-option-indicator","aria-hidden":"true",children:m?n.jsx(eG,{}):n.jsx(Z8,{})})]},d.value||"__empty__")})}):null]})}function J8({expanded:e}){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"terminal-manager-mobile-picker-chevron","data-expanded":e?"true":"false",children:n.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.7"})})}function Z8(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function eG(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.5 8.5L6.5 11.5L12.5 5.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.8"})})}function Jw({className:e,currentWorkspaceId:t,navigationGroups:r,externalWindowMode:i=!1,workbenchShellOverrides:a}){var Nt,ln,Jt,Sn;const c=pr(),u=Tr(),{subscribeTerminalManagerSnapshot:d,requestTerminalManagerRefresh:m,addTerminalManagerSnapshotListener:f}={...u,...a},w=(t==null?void 0:t.trim())||null,[g,v]=p.useState([]),[y,x]=p.useState([]),[C,j]=p.useState([]),[N,P]=p.useState([]),[L,Y]=p.useState(""),[H,W]=p.useState(""),[I,M]=p.useState(ih),[O,F]=p.useState(null),[X,U]=p.useState(null),[G,R]=p.useState([]),[A,Z]=p.useState(!1),[pe,q]=p.useState(!1),[D,T]=p.useState(null),[B,Q]=p.useState(null),[_,de]=p.useState(null),[le,oe]=p.useState(null),[ye,Ne]=p.useState(null),[Me,Te]=p.useState(!1),[Dt,st]=p.useState(null),{showToast:dt}=Jn(),bt=(e==null?void 0:e.includes("mobile-tool-process-panel"))??!1,pt=O!==null,we=O==="edit"?y.find(se=>se.id===X)??null:null,he=O==="edit";p.useEffect(()=>{sn("terminal_manager.props",{currentWorkspaceId:t,workspaceCount:r.length,externalWindowMode:i})},[t,i,r.length]);const Le=p.useMemo(()=>N.find(se=>se.id===L)??null,[L,N]),Oe=p.useMemo(()=>O8(c.ui.osFamily),[c.ui.osFamily]),Qe=p.useMemo(()=>new Map(C.map(se=>[se.templateId,se])),[C]),wt=p.useMemo(()=>C.filter(se=>se.occupied).length,[C]),Ie=p.useMemo(()=>y.filter(se=>se.port!==null).length,[y]),Be=(Le==null?void 0:Le.available)===!1&&N.length>0;p.useEffect(()=>{Y(se=>N.length?se&&N.some(He=>He.id===se)?se:z8(N):"")},[N]),p.useEffect(()=>{!pt||!w||N.length>0||ft(w)},[w,N.length,pt]),p.useEffect(()=>{pt||st(null)},[pt]),p.useEffect(()=>{O==="edit"&&X&&!we&&(F(null),U(null),M(ih),W(""),st(null))},[we,X,O]),p.useEffect(()=>{!le||_===le.templateId||y.some(se=>se.id===le.templateId)||oe(null)},[le,_,y]),p.useEffect(()=>{if(!w){v([]),x([]),j([]),Z(!1);return}const se=Lr(mg(w),Cj);sn("terminal_manager.snapshot",{workspaceId:w,cached:!!se,cachedTemplateCount:(se==null?void 0:se.templates.length)??0,cachedStatusCount:(se==null?void 0:se.templateStatuses.length)??0}),se?(v(se.terminals),x(se.templates),j(se.templateStatuses),P(se.shellOptions??[]),Z(!1)):(v([]),x([]),j([]),P([]),Z(!0))},[w]),p.useEffect(()=>{if(w)return f(se=>{se.workspaceId===w&&(sn("terminal_manager.snapshot_received",{workspaceId:se.workspaceId,terminalCount:se.terminals.length,templateCount:se.templates.length,statusCount:se.templateStatuses.length}),vt(se),Z(!1))})},[w,f]),p.useEffect(()=>{if(!w)return;const se=Lr(mg(w),Cj)!==null;if(d(w),se){const He=window.setTimeout(()=>{ft(w)},1500);return()=>{window.clearTimeout(He)}}ft(w)},[w,m,d]),p.useEffect(()=>{w&&Ei(mg(w),{terminals:g,templates:y,templateStatuses:C,shellOptions:N})},[w,N,C,y,g]);function vt(se){v(se.terminals),x(se.templates),j(se.templateStatuses),P(se.shellOptions??[])}function ft(se){sn("terminal_manager.refresh_requested",{workspaceId:se}),m(se)}function ve(){F(null),U(null),M(ih),W(""),st(null)}function Ae(){U(null),M(ih),W(""),F("create")}function et(se){U(se.id),M(V8(se)),W(se.runtimeType??""),F("edit")}async function We(se){if(w){Q(se);try{await I8(se),ft(w),dt({title:o("terminalManager.stopProcessSuccess"),tone:"success"})}catch(He){dt({title:He instanceof Error?He.message:o("terminalManager.stopProcessFailed"),tone:"error"})}finally{Q(null)}}}async function lt(){if(!w||!I.target.trim())return;const se=K8(I.port);if(Number.isNaN(se)){dt({title:o("terminalManager.invalidPort"),tone:"error"});return}if(I.proxyEnabled&&se===null){dt({title:o("terminalManager.proxyPortRequired"),tone:"error"});return}q(!0);try{const He={workspaceId:w,name:q8(I),cwd:I.cwd.trim()||void 0,command:I.target.trim(),args:H8(I.args),port:se,proxyEnabled:I.proxyEnabled,runtimeType:H||null};if(he&&X){const xt=await F8(X,He);x(Tt=>Tt.map(Mn=>Mn.id===xt.id?xt:Mn))}else await L8(He);ve(),ft(w),dt({title:o(he?"terminalManager.templateUpdateSuccess":"terminalManager.templateSaveSuccess"),tone:"success"})}catch(He){dt({title:He instanceof Error?He.message:o(he?"terminalManager.templateUpdateFailed":"terminalManager.templateSaveFailed"),tone:"error"})}finally{q(!1)}}async function ct(se){const He=await c.bridge.openExternal(se);He.ok||dt({title:He.detail||o("terminalManager.openProxyUrlFailed"),tone:"error"})}async function Vt(se,He){if(w){de(se.id);try{await _8(se.id),x(xt=>xt.filter(Tt=>Tt.id!==se.id)),j(xt=>xt.filter(Tt=>Tt.templateId!==se.id)),R(xt=>xt.filter(Tt=>Tt!==se.id)),oe(xt=>(xt==null?void 0:xt.templateId)===se.id?null:xt),X===se.id&&ve(),ft(w),dt({title:o("terminalManager.templateDeleteSuccess"),tone:"success"})}catch(xt){dt({title:xt instanceof Error?xt.message:o("terminalManager.templateDeleteFailed"),tone:"error"})}finally{de(null)}}}async function Bt(se){if(!w)return;const He=Le!=null&&Le.available?Le.shell:void 0;T(se);try{await xj(se,{shell:He}),ft(w),dt({title:o("terminalManager.templateRunSuccess"),tone:"success"})}catch(xt){if(B8(xt)){Ne({templateId:se,shell:He});return}dt({title:xt instanceof Error?xt.message:o("terminalManager.templateRunFailed"),tone:"error"})}finally{T(null)}}async function Wt(){if(!(!w||!ye)){Te(!0);try{await xj(ye.templateId,{shell:ye.shell,runtimeType:"embedded-pty"}),Ne(null),ft(w),dt({title:o("terminalManager.templateRunSuccess"),tone:"success"})}catch(se){dt({title:se instanceof Error?se.message:o("terminalManager.templateRunFailed"),tone:"error"})}finally{Te(!1)}}}function Lt(se){R(He=>He.includes(se)?He.filter(xt=>xt!==se):[...He,se])}return r.length?w?n.jsxs("section",{className:["conversation-panel","surface-card","terminal-manager-panel",e].filter(Boolean).join(" "),children:[n.jsx(W8,{open:ye!==null,busy:Me,onClose:()=>{Me||Ne(null)},onConfirmFallback:()=>{Wt()}}),n.jsxs("div",{className:"terminal-manager-header terminal-manager-desktop-header",children:[n.jsxs("div",{className:"terminal-manager-panel-heading",children:[n.jsx("span",{className:"terminal-manager-panel-eyebrow",children:o("terminalManager.quickLaunchTitle")}),n.jsxs("div",{children:[n.jsx("h2",{children:o("terminalManager.templateSectionTitle")}),n.jsx("p",{className:"status-text",children:o("terminalManager.desktopPanelDescription")})]})]}),n.jsxs("div",{className:"terminal-manager-overview",children:[n.jsxs("article",{className:"terminal-manager-overview-card",children:[n.jsx("span",{children:o("terminalManager.runningCountLabel")}),n.jsx("strong",{children:wt})]}),n.jsxs("article",{className:"terminal-manager-overview-card",children:[n.jsx("span",{children:o("terminalManager.portWatchCountLabel")}),n.jsx("strong",{children:Ie})]}),n.jsxs("article",{className:"terminal-manager-overview-card",children:[n.jsx("span",{children:o("terminalManager.terminalCountLabel")}),n.jsx("strong",{children:g.length})]})]}),n.jsxs("div",{className:"terminal-manager-toolbar terminal-manager-toolbar-header",children:[n.jsx("button",{className:"ghost-button",type:"button",disabled:!w||A,onClick:()=>{w&&ft(w)},children:o("terminalManager.refresh")}),n.jsx("button",{className:"primary-button",type:"button",disabled:!w,onClick:()=>{Ae()},children:o("terminalManager.openCreateModalAction")})]})]}),n.jsxs("section",{className:"terminal-manager-section",children:[n.jsxs("div",{className:"terminal-manager-section-header",children:[n.jsxs("div",{children:[n.jsx("h3",{children:o("terminalManager.templateSectionTitle")}),n.jsx("p",{className:"status-text",children:o("terminalManager.templateSectionDescription")})]}),n.jsx("span",{className:"workbench-section-counter",children:y.length})]}),A&&!y.length?n.jsx("p",{className:"status-text",children:o("common.loading")}):null,y.length?n.jsx("div",{className:"terminal-manager-list",children:y.map(se=>{const He=jj(Qe,se.id),xt=Y8(se,He),Tt=G.includes(se.id),Mn=o(Tt?"terminalManager.hideDetailsAction":"terminalManager.showDetailsAction"),wn=se.proxyEnabled&&se.proxySlug?G8(se.proxySlug):null;return n.jsxs("article",{className:"terminal-manager-card terminal-manager-desktop-card","data-tone":xt.tone,"data-expanded":Tt?"true":"false",children:[n.jsxs("div",{className:"terminal-manager-card-header",children:[n.jsxs("div",{className:"terminal-manager-card-title",children:[n.jsx("span",{className:"terminal-manager-card-indicator","aria-hidden":"true"}),n.jsx("strong",{children:se.name})]}),n.jsxs("div",{className:"terminal-manager-card-tools",children:[n.jsx("span",{className:"badge terminal-runtime-badge",children:Sj(se.runtimeType,c.ui.osFamily)}),n.jsx("span",{className:"badge",children:jR(se)==="script"?o("terminalManager.scriptMode"):o("terminalManager.commandMode")}),n.jsx("button",{className:"terminal-manager-detail-toggle",type:"button","aria-label":Mn,"aria-expanded":Tt,onClick:()=>{Lt(se.id)},children:"i"})]})]}),n.jsxs("div",{className:"terminal-manager-status-panel",children:[n.jsxs("div",{className:"terminal-manager-status-copy",children:[n.jsx("p",{className:"terminal-manager-status-title",children:xt.title}),n.jsx("p",{className:"status-text",children:xt.summary})]}),n.jsxs("div",{className:"terminal-manager-status-badges",children:[n.jsx("span",{className:"terminal-manager-stat-pill",children:se.port===null?o("terminalManager.portUnset"):`${o("terminalManager.portLabel")} ${se.port}`}),n.jsx("span",{className:"badge","data-tone":xt.badgeTone,children:xt.badgeLabel}),se.proxyEnabled?n.jsx("span",{className:"badge",children:o("terminalManager.proxyEnabled")}):null]})]}),n.jsxs("div",{className:"terminal-manager-actions",children:[He!=null&&He.occupied?n.jsx("button",{className:"secondary-button",type:"button",disabled:B===se.id,onClick:()=>{We(se.id)},children:B===se.id?o("terminalManager.stoppingProcess"):o("terminalManager.stopProcessAction")}):null,n.jsx("button",{className:"secondary-button",type:"button",disabled:D===se.id||Be,onClick:()=>{Bt(se.id)},children:D===se.id?o("terminalManager.runningTemplate"):o("terminalManager.runTemplateAction")})]}),Tt?n.jsxs("section",{className:"terminal-manager-details","aria-label":o("terminalManager.detailsSectionTitle"),children:[n.jsxs("div",{className:"terminal-manager-detail-grid",children:[n.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[n.jsx("span",{children:o("terminalManager.commandPreviewLabel")}),n.jsx("strong",{children:$8(se)})]}),n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.cwdLabel")}),n.jsx("strong",{children:se.cwd})]}),n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminal.runtimeField")}),n.jsx("strong",{children:Sj(se.runtimeType,c.ui.osFamily)})]}),n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.updatedAt")}),n.jsx("strong",{children:U8(se.updatedAt)})]}),n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.portLabel")}),n.jsx("strong",{children:se.port===null?o("terminalManager.portUnset"):se.port})]}),n.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[n.jsx("span",{children:o("terminalManager.proxyField")}),n.jsx("strong",{children:wn??o("terminalManager.proxyDisabledDescription")})]}),He!=null&&He.processId?n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.processIdLabel")}),n.jsx("strong",{children:He.processId})]}):null,He!=null&&He.processCommandLine?n.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[n.jsx("span",{children:o("terminalManager.processCommandLabel")}),n.jsx("strong",{children:He.processCommandLine})]}):null]}),n.jsxs("div",{className:"terminal-manager-actions terminal-manager-detail-actions",children:[wn?n.jsx("button",{className:"secondary-button",type:"button",onClick:()=>{ct(wn)},children:o("terminalManager.openProxyUrlAction")}):null,n.jsx("button",{className:"secondary-button",type:"button",disabled:pe||_===se.id,onClick:()=>{et(se)},children:o("terminalManager.editAction")}),n.jsx("button",{className:"secondary-button workbench-danger-button",type:"button",disabled:_===se.id,onClick:()=>{oe({templateId:se.id,name:se.name,occupied:!!(He!=null&&He.occupied)})},children:_===se.id?o("terminalManager.templateRemoving"):o("terminalManager.removeAction")})]})]}):null]},se.id)})}):n.jsx("section",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("terminalManager.emptyTemplateBody")})})]}),n.jsx(X8,{open:pt,title:o(he?"terminalManager.editModalTitle":"terminalManager.createModalTitle"),description:o(he?"terminalManager.editModalDescription":"terminalManager.createModalDescription"),className:bt?"terminal-manager-mobile-modal":void 0,onClose:ve,children:n.jsxs("section",{className:"terminal-manager-modal-form",children:[bt?n.jsxs(n.Fragment,{children:[n.jsx(Nj,{label:o("terminalManager.shellField"),value:L,open:Dt==="shell",options:N.map(se=>({value:se.id,label:se.label,description:se.available?null:se.unavailableReason??o("terminalManager.shellUnavailable"),disabled:!se.available})),onToggle:()=>{st(se=>se==="shell"?null:"shell")},onChange:se=>{Y(se),st(null)}}),(Le==null?void 0:Le.available)===!1&&Le.unavailableReason?n.jsx("p",{className:"status-text",children:Le.unavailableReason}):null,n.jsx(Nj,{label:o("terminal.runtimeField"),value:H,open:Dt==="runtime",options:Oe.map(se=>({value:se.value,label:se.label,description:se.description})),onToggle:()=>{st(se=>se==="runtime"?null:"runtime")},onChange:se=>{W(se),st(null)}}),n.jsx("p",{className:"status-text",children:((Nt=Oe.find(se=>se.value===H))==null?void 0:Nt.description)??((ln=Oe[0])==null?void 0:ln.description)})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.shellField")}),n.jsx("select",{value:L,onChange:se=>{Y(se.target.value)},children:N.map(se=>n.jsx("option",{value:se.id,disabled:!se.available,children:se.available?se.label:`${se.label} - ${o("terminalManager.shellUnavailable")}`},se.id))}),(Le==null?void 0:Le.available)===!1&&Le.unavailableReason?n.jsx("p",{className:"status-text",children:Le.unavailableReason}):null]}),n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminal.runtimeField")}),n.jsx("select",{value:H,onChange:se=>{W(se.target.value)},children:Oe.map(se=>n.jsx("option",{value:se.value,children:se.label},se.value||"auto"))}),n.jsx("p",{className:"status-text",children:((Jt=Oe.find(se=>se.value===H))==null?void 0:Jt.description)??((Sn=Oe[0])==null?void 0:Sn.description)})]})]}),n.jsxs("div",{className:"terminal-manager-mode-row",role:"tablist","aria-label":o("terminalManager.modeField"),children:[n.jsx("button",{type:"button",className:I.mode==="command"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{M(se=>({...se,mode:"command"}))},children:o("terminalManager.commandMode")}),n.jsx("button",{type:"button",className:I.mode==="script"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{M(se=>({...se,mode:"script"}))},children:o("terminalManager.scriptMode")})]}),n.jsxs("div",{className:"terminal-manager-grid",children:[n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.templateNameField")}),n.jsx("input",{value:I.name,placeholder:o("terminalManager.templateNamePlaceholder"),onChange:se=>{M(He=>({...He,name:se.target.value}))}})]}),n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.cwdField")}),n.jsx("input",{value:I.cwd,placeholder:o("terminalManager.cwdPlaceholder"),onChange:se=>{M(He=>({...He,cwd:se.target.value}))}})]})]}),n.jsxs("div",{className:"terminal-manager-grid",children:[n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:I.mode==="script"?o("terminalManager.scriptPathField"):o("terminalManager.commandField")}),n.jsx("input",{value:I.target,placeholder:I.mode==="script"?o("terminalManager.scriptPathPlaceholder"):o("terminalManager.commandPlaceholder"),onChange:se=>{M(He=>({...He,target:se.target.value}))}})]}),n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.argsField")}),n.jsx("input",{value:I.args,placeholder:o("terminalManager.argsPlaceholder"),onChange:se=>{M(He=>({...He,args:se.target.value}))}})]})]}),n.jsxs("div",{className:"terminal-manager-grid",children:[n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.portField")}),n.jsx("input",{value:I.port,placeholder:o("terminalManager.portPlaceholder"),onChange:se=>{M(He=>({...He,port:se.target.value}))}})]}),n.jsxs("div",{className:"field-group terminal-manager-proxy-field",children:[n.jsx("span",{children:o("terminalManager.proxyField")}),n.jsxs("div",{className:"terminal-manager-proxy-control",children:[n.jsx("span",{children:o("terminalManager.proxyToggleLabel")}),n.jsxs("label",{className:"terminal-manager-proxy-switch",children:[n.jsx("input",{type:"checkbox",role:"switch","aria-label":o("terminalManager.proxyField"),checked:I.proxyEnabled,onChange:se=>{M(He=>({...He,proxyEnabled:se.target.checked}))}}),n.jsx("span",{className:"terminal-manager-proxy-track","aria-hidden":"true",children:n.jsx("span",{className:"terminal-manager-proxy-thumb"})})]})]})]})]}),n.jsxs("div",{className:"terminal-manager-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",onClick:ve,children:o("common.close")}),n.jsx("button",{className:"primary-button",type:"button",disabled:!w||pe||!I.target.trim(),onClick:()=>{lt()},children:o(pe?he?"terminalManager.templateUpdating":"terminalManager.templateSaving":he?"terminalManager.saveTemplateChangesAction":"terminalManager.saveLaunchAction")})]})]})}),n.jsx(Q8,{open:le!==null,busy:le!==null&&_===le.templateId,title:o("terminalManager.removeConfirmTitle"),description:le?o(le.occupied?"terminalManager.removeRunningConfirmTarget":"terminalManager.removeConfirmTarget",{name:le.name}):"",confirmLabel:o("terminalManager.removeConfirmAction"),className:bt?"terminal-manager-mobile-modal":"terminal-manager-confirm-modal",onClose:()=>{_||oe(null)},onConfirm:()=>{if(!le)return;const se=y.find(He=>He.id===le.templateId);if(!se){oe(null);return}jj(Qe,se.id),Vt(se)}})]}):n.jsx("section",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("terminalManager.noCurrentWorkspaceBody")})}):n.jsx("section",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("terminalManager.emptyWorkspaceBody")})})}function mg(e){return`terminal-manager.snapshot.${e}`}const tG=Object.freeze(Object.defineProperty({__proto__:null,TerminalManagerPanel:Jw},Symbol.toStringTag,{value:"Module"}));function nG(e){return{navigationGroups:e,subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function rG(){return{subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function iG(){return{subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function sG(e){return e.kind==="files"?o("shell.filesEntry"):e.kind==="git"?o("shell.gitEntry"):e.kind==="processes"?o("shell.terminalManagerEntry"):e.kind}function aG(){const{windowId:e}=Ao(),t=mr(),r=pr(),i=us(P=>P.sessionDisplaySortMode),[a,c]=p.useState(null),[u,d]=p.useState(!0),[m,f]=p.useState(null),[w,g]=p.useState([]),[v,y]=p.useState(null);p.useEffect(()=>{let P=!1;async function L(){if(!e){c(null),d(!1),f(o("desktopWindow.invalidWindowId"));return}d(!0),f(null);const Y=await r.bridge.getWindowDescriptor(e),H=Y.ok?Y.value??null:r.windows.getDescriptor(e);if(!P){if(!H){c(null),d(!1),f(Y.detail??o("desktopWindow.loadDescriptorFailed"));return}r.windows.registerDescriptor(H),r.windows.markWindowOpen(H.windowId),c(H),d(!1)}}return L(),()=>{P=!0}},[r,e]),p.useEffect(()=>{if(!(a!=null&&a.workspaceId)){g([]);return}let P=!1;async function L(){try{const Y=await MT();if(P)return;g(Gc(Y,i))}catch{if(P)return;g([])}}return L(),()=>{P=!0}},[a==null?void 0:a.workspaceId,i]),p.useEffect(()=>{if(!a){y(null);return}const P=new yT({onConnectionChange:()=>{},onSnapshot:L=>{g(Gc(L,i))},onUnauthorized:()=>{hr.clear(),t(`/login?returnTo=${encodeURIComponent(`/desktop-window/${a.windowId}`)}`,{replace:!0})}});return y(P),P.start(),()=>{P.close(),y(null)}},[a,t,i]);const x=p.useMemo(()=>v?{navigationGroups:w,subscribeFileTree:v.subscribeFileTree.bind(v),requestFileTreeRefresh:v.requestFileTreeRefresh.bind(v),addFileTreeSnapshotListener:v.addFileTreeSnapshotListener.bind(v),subscribeGitSnapshot:v.subscribeGit.bind(v),requestGitRefresh:v.requestGitRefresh.bind(v),addGitSnapshotListener:v.addGitSnapshotListener.bind(v)}:nG(w),[w,v]),C=p.useMemo(()=>v?{subscribeGitSnapshot:v.subscribeGit.bind(v),requestGitRefresh:v.requestGitRefresh.bind(v),addGitSnapshotListener:v.addGitSnapshotListener.bind(v)}:rG(),[v]),j=p.useMemo(()=>v?{subscribeTerminalManagerSnapshot:v.subscribeTerminalManager.bind(v),requestTerminalManagerRefresh:v.requestTerminalManagerRefresh.bind(v),addTerminalManagerSnapshotListener:v.addTerminalManagerSnapshotListener.bind(v)}:iG(),[v]);if(!r.isDesktop)return n.jsx(Al,{to:"/",replace:!0});if(u)return n.jsx("main",{className:"desktop-window-page",children:n.jsx("p",{className:"status-text",children:o("common.loading")})});if(m)return n.jsx("main",{className:"desktop-window-page",children:n.jsx("p",{className:"status-text",children:m})});if(!a)return n.jsx("main",{className:"desktop-window-page",children:n.jsx("p",{className:"status-text",children:o("desktopWindow.loadDescriptorFailed")})});let N=null;return a.kind==="files"?N=n.jsx(Kw,{sessionId:a.sessionId,workspaceId:a.workspaceId,externalWindowMode:!0,workbenchShellOverrides:x}):a.kind==="git"?N=n.jsx(Xw,{workspaceId:a.workspaceId,externalWindowMode:!0,workbenchShellOverrides:C}):a.kind==="processes"&&(N=n.jsx(Jw,{currentWorkspaceId:a.workspaceId,navigationGroups:w,externalWindowMode:!0,workbenchShellOverrides:j})),N?n.jsx("main",{className:"desktop-window-page",children:n.jsx("div",{className:"desktop-window-body","data-window-kind":a.kind,"aria-label":sG(a),children:N})}):n.jsx("main",{className:"desktop-window-page",children:n.jsx("p",{className:"status-text",children:o("desktopWindow.unsupportedKind",{kind:a.kind})})})}const oG=420,lG=156;function cG({entry:e,isFavorite:t,isActive:r=!1,depth:i=0,variant:a="default",workspaceTone:c="root",hasSubsessions:u=!1,subsessionsExpanded:d=!1,showActions:m=!0,onActivate:f,onToggleSubsessions:w,onToggleFavorite:g,onArchive:v,onUnarchive:y,onRename:x}){const[C,j]=p.useState(!1),[N,P]=p.useState(null),[L,Y]=p.useState(null),H=p.useRef(null),W=p.useRef(!1),I=p.useRef(null),M=ms(),{session:O,workspace:F}=e,X=O.title??O.sessionId,U=ds(O.provider),G=[U,uG(O.lastMessageAt??O.updatedAt??null),Vc(O)].filter(Boolean).join(" · "),R=hG(O),A=R?mG(R):null,Z=a==="mobile"?null:Vc(O),pe=Z?XT("session-list-activity-badge",O):null;p.useEffect(()=>()=>{T()},[]),p.useLayoutEffect(()=>{if(!C||!L||typeof window>"u"){P(null);return}const Me=()=>{var dt,bt;const st=tP(L,{width:((dt=I.current)==null?void 0:dt.offsetWidth)??0,height:((bt=I.current)==null?void 0:bt.offsetHeight)??0},{width:window.innerWidth,height:window.innerHeight},{estimatedHeightPx:lG});P({position:"fixed",left:`${Math.round(st.left)}px`,top:`${Math.round(st.top)}px`,width:`${Math.round(st.width)}px`,maxWidth:"calc(100vw - 24px)",maxHeight:`${Math.round(st.maxHeight)}px`,transformOrigin:st.transformOrigin})},Te=st=>{var bt;const dt=st.target;dt&&!((bt=I.current)!=null&&bt.contains(dt))&&D()},Dt=st=>{st.key==="Escape"&&D()};return Me(),window.addEventListener("pointerdown",Te),window.addEventListener("keydown",Dt),window.addEventListener("resize",Me),window.addEventListener("scroll",Me,!0),()=>{window.removeEventListener("pointerdown",Te),window.removeEventListener("keydown",Dt),window.removeEventListener("resize",Me),window.removeEventListener("scroll",Me,!0)}},[L,C]);function q(Me){Y(Me),j(!0)}function D(){j(!1),Y(null)}function T(){H.current!==null&&(window.clearTimeout(H.current),H.current=null)}function B(Me){if(!m||Me.pointerType==="mouse")return;const Te={x:Me.clientX,y:Me.clientY};T(),H.current=window.setTimeout(()=>{W.current=!0,M.trigger("gesture"),q(Te)},oG)}function Q(){T()}function _(){if(W.current){W.current=!1;return}M.trigger("selection"),f(O.sessionId)}const de=async()=>{const Me=window.prompt(o("shell.renameModalDescription"),X);Me&&(await x(O.sessionId,Me.trim()),D())},le=async()=>{if(O.isArchived){await y(O.sessionId),D();return}await v(O.sessionId),D()},oe=()=>{g(O.sessionId),D()},ye=Me=>{if(Me.key!=="ContextMenu"&&!(Me.shiftKey&&Me.key==="F10"))return;Me.preventDefault(),Me.stopPropagation();const Te=Me.currentTarget.getBoundingClientRect();q({x:Te.right,y:Te.bottom})},Ne=C&&typeof document<"u"?Vn.createPortal(n.jsxs("div",{ref:I,className:"session-action-menu surface-card",role:"menu","aria-label":o("shell.sessionMoreAction"),style:N??{position:"fixed",top:0,left:0,visibility:"hidden"},onClick:Me=>Me.stopPropagation(),children:[n.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:oe,children:o(t?"shell.unfavoriteAction":"shell.favoriteAction")}),n.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void le(),children:O.isArchived?o("shell.unarchiveAction"):o("shell.archiveAction")}),n.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void de(),children:o("shell.renameAction")})]}),document.body):null;return n.jsxs("article",{className:"session-list-item","data-depth":i,"data-active":r,"data-workspace-tone":c,"data-has-subsessions":u,"data-variant":a,onContextMenu:Me=>{m&&(Me.preventDefault(),Me.stopPropagation(),q({x:Me.clientX,y:Me.clientY}))},children:[u?n.jsx("button",{type:"button",className:"session-list-subsession-toggle","aria-label":o(d?"shell.subagentCollapse":"shell.subagentExpand"),title:o(d?"shell.subagentCollapse":"shell.subagentExpand"),"aria-expanded":d,onClick:Me=>{Me.stopPropagation(),M.trigger("selection"),w==null||w()},children:n.jsx("span",{className:Tj(O,{isActive:r,hasSubsessions:u}),"aria-hidden":"true"})}):n.jsx("span",{className:Tj(O,{isActive:r,hasSubsessions:u}),"aria-hidden":"true"}),n.jsx("button",{type:"button",className:"session-list-link",onClick:_,onPointerDown:B,onPointerUp:Q,onPointerCancel:Q,onPointerLeave:Q,onKeyDown:ye,children:n.jsxs("div",{className:"session-list-copy",children:[n.jsx("div",{className:"session-list-title",children:X||o("shell.searchEntry")}),n.jsx("div",{className:"session-list-meta",children:a==="mobile"?n.jsx("span",{children:G}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:F.name}),Z&&pe?n.jsxs(n.Fragment,{children:[n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx("span",{className:pe,children:Z})]}):null,n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx("span",{children:U})]})}),A?n.jsx("div",{className:"session-list-error",title:R??void 0,children:A}):null]})}),Ne]})}function Tj(e,t){return rw("session-list-indicator",e,{isActive:t.isActive,hasSubagents:t.hasSubsessions})}function uG(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):o("common.unknown")}function dG(e){return wu(e)||e.syncStatus==="error"}function hG(e){var i,a;if(!dG(e))return null;const t=((i=e.lastErrorCode)==null?void 0:i.trim())??"",r=((a=e.lastErrorDetail)==null?void 0:a.replace(/\s+/g," ").trim())??"";return t&&r&&!r.includes(t)?`${t} · ${r}`:r||t||(e.syncStatus==="error"&&!wu(e)?o("conversation.syncStatusError"):o("conversation.runtimeErrorTitle"))}function mG(e,t=96){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}const sh=5;function pG(){var pe;const e=mr(),{navigationGroups:t,favoriteSessionIds:r,currentWorkspaceId:i,currentSessionId:a,navigationLoading:c,selectWorkspace:u,toggleFavoriteSession:d,archiveSession:m,unarchiveSession:f,renameSession:w,startDraftSession:g}=Tr(),v=Ol(t),y=p.useMemo(()=>hm(t),[t]),x=ua(t,i)??ua(t,((pe=t[0])==null?void 0:pe.workspace.id)??null),C=v.find(q=>q.workspace.id===(x==null?void 0:x.workspace.id))??(x?{workspace:x.workspace,label:x.workspace.name,subtitle:x.workspace.path}:null),j=p.useMemo(()=>new Set(r),[r]),N=p.useMemo(()=>x?x.sessions.filter(q=>{var B;if(q.isArchived)return!1;const D=((B=q.parentSessionId)==null?void 0:B.trim())||null;if(!D)return!0;const T=x.sessions.find(Q=>Q.sessionId===D);return!T||!T.isArchived}).map(q=>({session:q,workspace:x.workspace})):[],[x]),P=p.useMemo(()=>Fb(N),[N]),L=(x==null?void 0:x.workspace.id)??"",Y=!!L,[H,W]=p.useState([]),[I,M]=p.useState({}),[O,F]=p.useState(!1);p.useEffect(()=>{M(q=>{const D={};for(const T of P){const B=cs(qs(T));if(B.length===0)continue;const Q=B.findIndex(_=>_.item.session.sessionId===a);D[T.item.session.sessionId]=gG(B.length,sh,q[T.item.session.sessionId],Q)}return bG(q,D)?q:D})},[a,P]),p.useEffect(()=>{if(!a)return;const q=ca(P,a,D=>D.session.sessionId);q.length!==0&&W(D=>{const T=new Set(D);let B=!1;for(const Q of q)T.has(Q)||(T.add(Q),B=!0);return B?Array.from(T):D})},[a,P]);function X(q){W(D=>D.includes(q)?D.filter(T=>T!==q):[...D,q])}function U(q){return I[q]??sh}function G(q){M(D=>({...D,[q]:(D[q]??sh)+sh}))}function R(q,D){Cs("immersive"),e(Nr(q,D))}function A(q,D){F(!1),Cs("immersive"),g(q,D)}function Z(q,D=!1,T=[],B=!1,Q=!1){var bt;const _=q.item.session.sessionId,de=q.children,le=q.depth===0&&de.length>0,oe=D||le&&H.includes(_),ye=oe&&le,Ne=ye?fG(q,U(_)):q,Me=oe?Ne.children:[],Te=cs(de).length,Dt=cs(Me).length,st=ye&&Dt<Te,dt=q.depth>0?[...T,B]:[...T];return n.jsxs("div",{className:"session-list-tree-node",children:[n.jsxs("div",{className:"session-list-tree-row",style:{"--session-tree-depth":q.depth},children:[q.depth>0?n.jsxs("div",{className:"session-tree-guides","aria-hidden":"true",style:{"--session-tree-depth":q.depth},children:[T.map((pt,we)=>pt?n.jsx("span",{className:"session-tree-guide-column",style:{"--session-tree-level":we+1}},`${_}:ancestor:${we}`):null),n.jsx("span",{className:"session-tree-guide-branch","data-continue":B,"data-first":Q,style:{"--session-tree-level":q.depth},children:n.jsx("span",{className:"session-tree-guide-branch-horizontal"})})]}):null,n.jsx(cG,{entry:q.item,isFavorite:j.has(_),isActive:a===_,depth:q.depth,variant:"mobile",workspaceTone:((bt=y[q.item.workspace.id])==null?void 0:bt.tone)??"root",hasSubsessions:le,subsessionsExpanded:oe,onActivate:pt=>R(q.item.workspace.id,pt),onToggleSubsessions:le?()=>X(_):void 0,onToggleFavorite:pt=>{d(pt)},onArchive:pt=>m(pt),onUnarchive:pt=>f(pt),onRename:(pt,we)=>w(pt,we)})]}),oe&&Me.length>0?n.jsx("div",{className:"session-list-children",children:Me.map((pt,we)=>Z(pt,!0,dt,we<Me.length-1,we===0))}):null,st?n.jsx("div",{className:"session-list-children",children:n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>G(_),children:o("shell.subagentExpandMore")})}):null]},`${q.item.workspace.id}:${_}`)}return n.jsxs("main",{className:"session-index-page mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header",children:[n.jsx(Io,{currentWorkspace:C?{id:C.workspace.id,name:C.label,path:C.subtitle}:null,workspaces:t.map(q=>q.workspace),workspaceOptions:v,onSelectWorkspace:q=>{u(q),e(Co(q))},content:n.jsx("button",{type:"button",className:"primary-button mobile-session-index-create-button",disabled:c||!Y,onClick:()=>F(!0),children:o("shell.createSession")})}),n.jsx("div",{className:"mobile-page-top-body",children:n.jsxs("section",{className:"session-section session-section-sheet",children:[n.jsxs("header",{className:"session-section-heading",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.mobileConversationCurrentWorkspaceSection")})}),n.jsx("span",{className:"session-section-count",children:P.length})]}),P.length===0?n.jsx("p",{className:"session-section-empty",children:o(c?"shell.searchSessionHint":"shell.emptyWorkspaceSessions")}):n.jsx("div",{className:"session-current-workspace-list",children:P.map(q=>Z(q))})]})}),n.jsx(Nu,{open:O,workspaces:t.map(q=>q.workspace),workspaceOptions:v,initialWorkspaceId:i??L,onClose:()=>F(!1),onSelect:A})]})}function fG(e,t){const r=new Set(cs(qs(e)).sort((i,a)=>(a.item.session.lastMessageAt??a.item.session.updatedAt).localeCompare(i.item.session.lastMessageAt??i.item.session.updatedAt)).slice(0,t).map(i=>i.item.session.sessionId));return{...e,children:NR(qs(e),r)}}function NR(e,t){return e.flatMap(r=>{const i=NR(qs(r),t);return!t.has(r.item.session.sessionId)&&i.length===0?[]:[{...r,children:i}]})}function gG(e,t,r,i=-1){if(e<=0)return 0;const a=i>=0?Math.max(t,i+1):t;return Math.min(e,Math.max(r??0,a))}function bG(e,t){const r=Object.keys(e),i=Object.keys(t);return r.length!==i.length?!1:r.every(a=>e[a]===t[a])}function wG(){const{currentWorkspaceId:e}=Tr();return e?n.jsx(Al,{to:El(e,"files"),replace:!0}):n.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:n.jsxs("article",{className:"mobile-feature-empty surface-card",children:[n.jsx("h1",{children:o("shell.filesEntry")}),n.jsx("p",{children:o("shell.toolsWorkspaceRequiredBody")})]})})}function vG(){const{currentWorkspaceId:e}=Tr();return e?n.jsx(Al,{to:El(e,"git"),replace:!0}):n.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:n.jsxs("article",{className:"mobile-feature-empty surface-card",children:[n.jsx("h1",{children:o("shell.gitEntry")}),n.jsx("p",{children:o("shell.toolsWorkspaceRequiredBody")})]})})}function yG(){const{currentWorkspaceId:e,navigationGroups:t}=Tr();return e?n.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root mobile-tool-panel-page mobile-tool-process-page",children:n.jsx(Jw,{className:"mobile-panel-scroll-root mobile-tool-native-panel mobile-tool-process-panel",currentWorkspaceId:e,navigationGroups:t})}):n.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:n.jsxs("article",{className:"mobile-feature-empty surface-card",children:[n.jsx("h1",{children:o("shell.terminalManagerEntry")}),n.jsx("p",{children:o("shell.toolsWorkspaceRequiredBody")})]})})}const TR="mobile.tools.last-primary-tool",Ph=["files","git"],kG=56,xG=1.2;function Pj(e,t){return e==="git"?"git":e==="files"?"files":t}function SG(e,t,r){if(!t)return e;const i=r.x-t.x,a=r.y-t.y;if(Math.abs(i)<kG||Math.abs(i)<Math.abs(a)*xG)return e;const c=Ph.indexOf(e),u=i<0?Math.min(Ph.length-1,c+1):Math.max(0,c-1);return Ph[u]??e}function CG(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(TR)==="git"?"git":"files"}catch{return"files"}}function jG(){var L,Y;const e=hs(),t=mr(),r=ms(),{navigationGroups:i,currentWorkspaceId:a,currentSessionId:c,selectWorkspace:u}=Tr(),d=((L=i.find(H=>H.workspace.id===a))==null?void 0:L.workspace)??((Y=i[0])==null?void 0:Y.workspace)??null,m=new URLSearchParams(e.search).get("tab"),f=p.useRef(CG()),w=Pj(m,f.current),[g,v]=p.useState(()=>{const H=Pj(m,f.current);return{files:H==="files",git:H==="git"}}),y=p.useRef(null),x=p.useMemo(()=>[{key:"files",title:o("shell.filesEntry"),render:()=>n.jsx(Kw,{sessionId:c,workspaceId:a,hideHeading:!0})},{key:"git",title:o("shell.gitEntry"),render:()=>n.jsx(Xw,{className:"mobile-tool-native-panel mobile-tool-git-panel",workspaceId:a,panelActive:w==="git"})}],[w,c,a]),C=Ph.indexOf(w);p.useEffect(()=>{v(H=>({...H,[w]:!0}))},[w]),p.useEffect(()=>{if(f.current=w,!(typeof window>"u"))try{window.localStorage.setItem(TR,w)}catch{}},[w]),p.useEffect(()=>{if(m===w)return;const H=new URLSearchParams(e.search);H.set("tab",w),t({pathname:e.pathname,search:`?${H.toString()}`},{replace:!0})},[w,e.pathname,e.search,t,m]);function j(H,W="selection"){if(H===w)return;r.trigger(W);const I=new URLSearchParams(e.search);I.set("tab",H),t({pathname:e.pathname,search:`?${I.toString()}`},{replace:!0})}function N(H){if(H.changedTouches.length!==1){y.current=null;return}const W=H.changedTouches[0];y.current={x:W.clientX,y:W.clientY}}function P(H){const W=y.current;if(y.current=null,H.changedTouches.length!==1)return;const I=H.changedTouches[0],M=SG(w,W,{x:I.clientX,y:I.clientY});M!==w&&j(M)}return n.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root mobile-tools-workspace-page",children:d?n.jsxs(n.Fragment,{children:[n.jsx(Io,{currentWorkspace:d,workspaces:i.map(H=>H.workspace),onSelectWorkspace:H=>{u(H),t(El(H,w))},trailing:n.jsx("button",{type:"button",className:"secondary-button mobile-tools-more-button","aria-label":o("shell.toolsMoreAction"),title:o("shell.toolsMoreAction"),onClick:()=>{r.trigger("action"),t(lm(d.id))},children:n.jsx(NG,{})}),content:n.jsx("div",{className:"mobile-tools-switcher","aria-label":o("shell.mobileToolsEntry"),children:n.jsx("div",{className:"mobile-tools-segmented-control",role:"tablist","aria-label":o("shell.mobileToolsEntry"),children:x.map(H=>{const W=H.key===w;return n.jsx("button",{type:"button",role:"tab",className:"mobile-tools-segmented-button","data-active":W,"aria-selected":W,"aria-controls":`mobile-tool-panel-${H.key}`,onClick:()=>j(H.key,"selection"),children:H.title},H.key)})})})}),n.jsx("section",{className:"mobile-tools-stage","data-active-tool":w,"data-testid":"mobile-tools-stage",onTouchStart:N,onTouchEnd:P,onTouchCancel:()=>{y.current=null},children:n.jsx("div",{className:"mobile-tools-stage-viewport",children:n.jsx("div",{className:"mobile-tools-stage-track",style:{transform:`translateX(-${C*100}%)`},children:x.map(H=>n.jsx("article",{id:`mobile-tool-panel-${H.key}`,role:"tabpanel","aria-label":H.title,"aria-hidden":H.key!==w,className:"mobile-tools-stage-panel",children:n.jsx("div",{className:"mobile-tools-stage-panel-shell",children:g[H.key]?H.render():null})},H.key))})})})]}):n.jsx("article",{className:"mobile-feature-empty surface-card",children:n.jsx("p",{children:o("shell.emptyNavigationBody")})})})}function NG(){return n.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[n.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),n.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function TG(e){const t=p.useMemo(()=>e.notifications.filter(r=>e.showArchivedNotifications||!e.archivedNotificationIds.has(r.id)),[e.archivedNotificationIds,e.notifications,e.showArchivedNotifications]);return n.jsx(Ln,{open:e.open,title:o("shell.globalNotificationsPanelTitle"),description:o("shell.globalNotificationsPanelDescription"),className:"workbench-notification-modal-card mobile-notification-modal-card",onClose:e.onClose,children:n.jsxs("div",{className:"workbench-notification-pane mobile-notification-pane",role:"tabpanel","aria-label":o("shell.globalNotificationsAction"),children:[n.jsx("div",{className:"workbench-notification-toolbar",children:n.jsxs("label",{className:"workbench-notification-filter",children:[n.jsx("input",{type:"checkbox",checked:e.showArchivedNotifications,onChange:r=>e.onToggleShowArchivedNotifications(r.target.checked)}),n.jsx("span",{children:o("shell.globalNotificationsShowArchived")})]})}),t.length>0?n.jsx("div",{className:"workbench-notification-list",children:t.map(r=>{const i=e.archivedNotificationIds.has(r.id);return n.jsxs("article",{className:"workbench-notification-item","data-archived":i,children:[n.jsxs("button",{type:"button",className:"workbench-notification-item-content",onClick:()=>{e.onSelectNotification(r)},children:[n.jsxs("div",{className:"workbench-notification-item-header",children:[n.jsx("span",{className:"workbench-notification-item-kind",children:PG(r.kind)}),n.jsx("time",{children:DG(r.createdAt)})]}),n.jsx("strong",{children:r.title}),n.jsx("p",{children:r.body})]}),n.jsx("div",{className:"workbench-notification-item-actions",children:n.jsx("button",{type:"button",className:"secondary-button",onClick:a=>{if(a.stopPropagation(),i){e.onUnarchiveNotification(r.id);return}e.onArchiveNotification(r.id)},children:o(i?"shell.globalNotificationsRemoveArchiveAction":"shell.globalNotificationsArchiveAction")})})]},r.id)})}):n.jsx("p",{className:"workbench-notification-empty",children:o("shell.globalNotificationsEmpty")})]})})}function PG(e){switch(e){case"follow_up_waiting_user":return o("shell.globalNotificationKindWaitingUser");case"follow_up_completed":return o("shell.globalNotificationKindFollowUpCompleted");case"follow_up_failed":return o("shell.globalNotificationKindFollowUpFailed");case"verification_failed":return o("shell.globalNotificationKindVerificationFailed");default:return o("shell.globalNotificationsPanelTitle")}}function DG(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function RG(e){return e.isArchived!==!0&&!Ya(e)}function PR(e){return e.activityState==="running"||e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting"}function MG(e){return e.activityState==="idle"&&PR(e)===!1}function Dj(e){return e==="creating"||e==="running"}function Rj(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt}function Mj(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):o("common.unknown")}function fo(e){return e!==null&&e>0}const ah=60*1e3,AG=15e3;function EG(){var wt;const e=mr(),{showToast:t}=Jn(),r=Tr(),{navigationGroups:i,currentWorkspaceId:a,refreshNavigation:c,selectWorkspace:u,startDraftSession:d,subscribeGitSnapshot:m,requestGitRefresh:f,addGitSnapshotListener:w,subscribeTerminalManagerSnapshot:g,requestTerminalManagerRefresh:v,addTerminalManagerSnapshotListener:y}=r,x=r.globalNotifications??[],C=new Set(r.archivedNotificationIds??[]),j=r.showArchivedNotifications??!1,N=r.unreadNotificationCount??0,P=r.setShowArchivedNotifications??(()=>{}),L=r.archiveNotification??(()=>{}),Y=r.unarchiveNotification??(()=>{}),[H,W]=p.useState(null),[I,M]=p.useState(!1),[O,F]=p.useState(!1),[X,U]=p.useState(!1),[G,R]=p.useState({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null}),[A,Z]=p.useState({loading:!0,activeTaskCount:0,pendingInboxCount:0}),pe=Ol(i),q=ua(i,a)??ua(i,((wt=i[0])==null?void 0:wt.workspace.id)??null),D=(q==null?void 0:q.workspace)??null,T=pe.find(Ie=>Ie.workspace.id===(D==null?void 0:D.id))??(D?{workspace:D,label:D.name,subtitle:D.path}:null),B=[...(q==null?void 0:q.sessions)??[]].filter(RG),Q=B.filter(PR),_=B.filter(MG),de=B.filter(Ie=>Ie.isFavorite===!0),le=Q.slice(0,6),oe=de.slice(0,6),ye=G.quickLaunchRunning===null?"…":G.quickLaunchRunning?o("shell.workspaceHomeQuickLaunchRunning"):o("shell.workspaceHomeQuickLaunchStopped");p.useEffect(()=>{const Ie=(D==null?void 0:D.id)??null;if(!Ie){R({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null});return}const Be=Lr(pg(Ie),ah);R(vt=>{var ft,ve;return{...vt,gitLoading:Be===null,branch:((ft=Be==null?void 0:Be.status)==null?void 0:ft.snapshot.branch)??null,changedFileCount:((ve=Be==null?void 0:Be.status)==null?void 0:ve.changes.length)??null}})},[D==null?void 0:D.id]),p.useEffect(()=>{const Ie=(D==null?void 0:D.id)??null;if(Ie)return w(Be=>{Be.workspaceId===Ie&&(Ei(pg(Ie),Be),R(vt=>{var ft,ve,Ae;return{...vt,gitLoading:!1,branch:((ft=Be.status)==null?void 0:ft.snapshot.branch)??((ve=Be.branches)==null?void 0:ve.currentBranch)??null,changedFileCount:((Ae=Be.status)==null?void 0:Ae.changes.length)??null}}))})},[w,D==null?void 0:D.id]),p.useEffect(()=>{const Ie=(D==null?void 0:D.id)??null;if(!Ie){R(vt=>({...vt,gitLoading:!1,branch:null,changedFileCount:null}));return}const Be=Lr(fg(Ie),ah);R(vt=>({...vt,terminalLoading:Be===null,activeTerminalCount:Be?Be.terminals.filter(ft=>Dj(ft.status)).length:null,quickLaunchRunning:Be?Be.templateStatuses.some(ft=>ft.occupied):null}))},[D==null?void 0:D.id]),p.useEffect(()=>{const Ie=(D==null?void 0:D.id)??null;if(!Ie){R(Be=>({...Be,terminalLoading:!1,activeTerminalCount:null,quickLaunchRunning:null}));return}return y(Be=>{Be.workspaceId===Ie&&(Ei(fg(Ie),{terminals:Be.terminals,templates:Be.templates,templateStatuses:Be.templateStatuses}),R(vt=>({...vt,terminalLoading:!1,activeTerminalCount:Be.terminals.filter(ft=>Dj(ft.status)).length,quickLaunchRunning:Be.templateStatuses.some(ft=>ft.occupied)})))})},[y,D==null?void 0:D.id]),p.useEffect(()=>{const Ie=(D==null?void 0:D.id)??null;if(!Ie)return;const Be=Lr(pg(Ie),ah)!==null;m(Ie),!Be&&f(Ie)},[D==null?void 0:D.id,f,m]),p.useEffect(()=>{const Ie=(D==null?void 0:D.id)??null;if(!Ie)return;const Be=Lr(fg(Ie),ah)!==null;g(Ie),!Be&&v(Ie)},[D==null?void 0:D.id,v,g]),p.useEffect(()=>{const Ie=(D==null?void 0:D.id)??null;if(!Ie){Z({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}let Be=!1;async function vt(et){Z(We=>({...We,loading:!0}));try{const We=await mm();if(!We.initialized||!We.profile){Be||Z({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}const[lt,ct,Vt]=await Promise.all([pm(),Yc(),Kc({workspaceId:Ie})]);if(Be)return;const Bt=new Set(lt.overview.projects.filter(Lt=>Lt.workspaceId===Ie).map(Lt=>Lt.id)),Wt=lt.overview.verifications.filter(Lt=>Lt.projectId?Bt.has(Lt.projectId):!1);Z({loading:!1,activeTaskCount:I0(ct.items.filter(Lt=>Lt.workspaceId===Ie),Wt),pendingInboxCount:Vt.items.filter(Lt=>Lt.status!=="closed").length})}catch(We){if(Be)return;Z(lt=>({...lt,loading:!1})),et&&t({title:o("shell.butlerLoadFailed"),description:We instanceof Error?We.message:void 0,tone:"error"})}}vt(!0);const ft=window.setInterval(()=>{vt(!1)},AG),ve=Fw(()=>{vt(!1)}),Ae=()=>{vt(!1)};return window.addEventListener(No,Ae),()=>{Be=!0,window.clearInterval(ft),ve(),window.removeEventListener(No,Ae)}},[D==null?void 0:D.id,t]);async function Ne(Ie){await c(),u(Ie.id),W(null),e(Ai(Ie.id))}async function Me(Ie){await c(),u(Ie.id),W(null),e(Ai(Ie.id))}function Te(){D&&(u(D.id),e(El(D.id,"git")))}function Dt(){D&&(u(D.id),e(vl(D.id)))}function st(){D&&(u(D.id),e(lm(D.id)))}function dt(){D&&(u(D.id),e(jo(D.id)))}function bt(){D&&e(Co(D.id))}function pt(){D&&M(!0)}function we(Ie,Be){M(!1),d(Ie,Be)}function he(){D&&(u(D.id),e(Ai(D.id)))}function Le(Ie){u(Ie)}const Oe=[{label:o("shell.workspaceHomeMetricActive"),value:Q.length,accent:fo(Q.length),onClick:B.length>0?bt:void 0},{label:o("shell.workspaceHomeMetricUnread"),value:N,accent:fo(N),onClick:()=>U(!0)},{label:o("shell.workspaceHomeMetricTerminal"),value:G.terminalLoading?"…":G.activeTerminalCount??"—",accent:G.terminalLoading===!1&&fo(G.activeTerminalCount),onClick:D?Dt:void 0},{label:o("shell.workspaceHomeMetricChanges"),value:G.gitLoading?"…":G.changedFileCount??"—",accent:G.gitLoading===!1&&fo(G.changedFileCount),onClick:D?Te:void 0}],Qe=[{label:o("shell.workspaceHomeWaitingInputLabel"),value:_.length,accent:fo(_.length),onClick:B.length>0?bt:void 0},{label:o("shell.workspaceHomeButlerLabel"),value:A.loading?"…":A.activeTaskCount,accent:A.loading===!1&&fo(A.activeTaskCount),onClick:D?dt:void 0},{label:o("shell.workspaceHomeQuickLaunchStatusLabel"),value:ye,accent:G.quickLaunchRunning===!0,onClick:D?st:void 0},{label:o("shell.butlerInboxAction"),value:A.loading?"…":A.pendingInboxCount,accent:A.loading===!1&&fo(A.pendingInboxCount),onClick:D?()=>F(!0):void 0}];return n.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-home-page",children:[n.jsx(Io,{currentWorkspace:T?{id:T.workspace.id,name:T.label,path:T.subtitle}:null,workspaces:i.map(Ie=>Ie.workspace),workspaceOptions:pe,onSelectWorkspace:Le,sheetContent:Ie=>n.jsxs("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:[n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{Ie(),W("import")},children:[n.jsx("span",{className:"mobile-workspace-home-row-label",children:o("shell.importWorkspaceTitle")}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Fa,{})})]}),n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{Ie(),W("clone")},children:[n.jsx("span",{className:"mobile-workspace-home-row-label",children:o("shell.cloneWorkspaceTitle")}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Fa,{})})]})]})}),D?n.jsx(n.Fragment,{children:n.jsxs("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:[n.jsx("section",{className:"mobile-workspace-home-section",children:n.jsx("div",{className:"mobile-workspace-home-metrics-card","aria-label":o("shell.workspaceHomeStatusSectionTitle"),children:n.jsx("div",{className:"mobile-workspace-home-toolbar-summary",children:Oe.map(Ie=>Ie.onClick?n.jsxs("button",{type:"button",className:"mobile-workspace-home-toolbar-metric","data-accent":Ie.accent?"true":void 0,onClick:Ie.onClick,children:[n.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:Ie.value}),n.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:Ie.label})]},Ie.label):n.jsxs("div",{className:"mobile-workspace-home-toolbar-metric","data-accent":Ie.accent?"true":void 0,role:"listitem",children:[n.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:Ie.value}),n.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:Ie.label})]},Ie.label))})})}),n.jsx("section",{className:"mobile-workspace-home-section",children:n.jsxs("div",{className:"mobile-workspace-home-primary-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:he,children:o("shell.workspaceDetailTitle")}),n.jsx("button",{type:"button",className:"primary-button",onClick:pt,children:o("shell.createSession")})]})}),n.jsx("section",{className:"mobile-workspace-home-section",children:n.jsx("div",{className:"mobile-workspace-home-group",children:Qe.map(Ie=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row","data-accent":Ie.accent?"true":void 0,onClick:Ie.onClick,children:[n.jsx("span",{className:"mobile-workspace-home-row-label",children:Ie.label}),n.jsxs("span",{className:"mobile-workspace-home-row-trailing",children:[n.jsx("strong",{children:Ie.value}),n.jsx(Fa,{})]})]},Ie.label))})}),n.jsxs("section",{className:"mobile-workspace-home-section",children:[n.jsxs("div",{className:"mobile-workspace-home-section-header",children:[n.jsx("p",{className:"mobile-workspace-home-section-title",children:o("shell.workspaceHomeActiveSessionsSectionTitle")}),D?n.jsx("button",{type:"button",className:"mobile-workspace-home-link-button",onClick:bt,children:o("shell.workspaceHomeViewAllAction")}):null]}),n.jsx("div",{className:"mobile-workspace-home-group",children:le.length===0?n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-empty-row",onClick:pt,children:[n.jsxs("div",{className:"mobile-workspace-home-session-main",children:[n.jsx("span",{className:"mobile-workspace-home-session-title",children:o("shell.createSession")}),n.jsx("span",{className:"mobile-workspace-home-session-meta",children:D.name})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Fa,{})})]}):le.map(Ie=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Nr(D.id,Ie.sessionId)),children:[n.jsxs("div",{className:"mobile-workspace-home-session-main",children:[n.jsx("span",{className:"mobile-workspace-home-session-title",children:Ie.title||o("common.unknown")}),n.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[ds(Ie.provider,"full")," · ",Mj(Rj(Ie))]})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Fa,{})})]},Ie.sessionId))})]}),oe.length>0?n.jsxs("section",{className:"mobile-workspace-home-section",children:[n.jsx("div",{className:"mobile-workspace-home-section-header",children:n.jsx("p",{className:"mobile-workspace-home-section-title",children:o("shell.favoriteSectionTitle")})}),n.jsx("div",{className:"mobile-workspace-home-group",children:oe.map(Ie=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Nr(D.id,Ie.sessionId)),children:[n.jsxs("div",{className:"mobile-workspace-home-session-main",children:[n.jsx("span",{className:"mobile-workspace-home-session-title",children:Ie.title||o("common.unknown")}),n.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[ds(Ie.provider,"full")," · ",Mj(Rj(Ie))]})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Fa,{})})]},Ie.sessionId))})]}):null]})}):n.jsx("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:n.jsxs("section",{className:"mobile-workspace-home-section mobile-workspace-home-empty",children:[n.jsx("p",{className:"mobile-workspace-home-section-title",children:o("shell.workspaceHomeSwitcherTitle")}),n.jsxs("div",{className:"mobile-workspace-home-group",children:[n.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>W("import"),children:[n.jsx("span",{className:"mobile-workspace-home-row-label",children:o("shell.importWorkspaceTitle")}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Fa,{})})]}),n.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>W("clone"),children:[n.jsx("span",{className:"mobile-workspace-home-row-label",children:o("shell.cloneWorkspaceTitle")}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Fa,{})})]})]})]})}),n.jsx(pP,{open:H==="import",onClose:()=>W(null),onImported:Ne}),n.jsx(hP,{open:H==="clone",onClose:()=>W(null),onCloned:Me}),n.jsx(Nu,{open:I,workspaces:i.map(Ie=>Ie.workspace),workspaceOptions:pe,initialWorkspaceId:(D==null?void 0:D.id)??a??null,onClose:()=>M(!1),onSelect:we}),n.jsx(Og,{open:O,preferredWorkspaceId:(D==null?void 0:D.id)??null,compactComposer:!0,onClose:()=>F(!1)}),n.jsx(TG,{open:X,notifications:x,archivedNotificationIds:C,showArchivedNotifications:j,onClose:()=>U(!1),onToggleShowArchivedNotifications:P,onArchiveNotification:L,onUnarchiveNotification:Y,onSelectNotification:Ie=>{U(!1),Ie.routePath&&e(Ie.routePath)}})]})}function pg(e){return`git-sidebar.snapshot.${e}`}function fg(e){return`terminal-manager.snapshot.${e}`}function Fa(){return n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function DR({workspace:e,state:t,variant:r,actions:i,matrixLimit:a}){return e?r==="mobile"?n.jsx(IG,{workspace:e,state:t,actions:i,matrixLimit:a}):r==="desktop-modal"?n.jsx(LG,{workspace:e,state:t,actions:i,matrixLimit:a}):n.jsx(FG,{workspace:e,state:t,actions:i,matrixLimit:a}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.workspaceDetailMissingBody")})}function IG({workspace:e,state:t,actions:r,matrixLimit:i}){var w,g,v;const a=t.primaryAnalysis,c=((w=t.runtime)==null?void 0:w.runtimeSession)??null,u=i?t.matrixItems.slice(0,i):t.matrixItems,d=Zw(t),[m,f]=p.useState(!1);return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[n.jsx("div",{className:"mobile-feature-section-header",children:n.jsx("div",{children:n.jsx("h2",{children:o("shell.workspaceDetailDebugTitle")})})}),t.loading&&a===null?n.jsx("p",{children:o("common.loading")}):null,t.error?n.jsx("p",{className:"status-text","data-tone":"error",children:t.error}):null,a?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugOverallStatusLabel")}),n.jsx("strong",{children:ev(d)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFrameworkLabel")}),n.jsx("strong",{children:a.primaryFramework??o("common.unknown")})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugConfidenceLabel")}),n.jsx("strong",{children:MR(a.confidence)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugSummaryServiceCountLabel")}),n.jsx("strong",{children:d.totalServices})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugCompatibilityLabel")}),n.jsx("strong",{children:xo(a.compatibilityLevel)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugInjectionLabel")}),n.jsx("strong",{children:au(a.recommendedInjectionMode??"none")})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeStatusLabel")}),n.jsx("strong",{children:zc((c==null?void 0:c.status)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFailureStageLabel")}),n.jsx("strong",{children:ou((c==null?void 0:c.failureStage)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceDiscoveryLabel")}),n.jsx("strong",{children:Nl(a.requiresServiceDiscoveryHandling)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugHmrLabel")}),n.jsx("strong",{children:Nl(a.requiresHmrHandling)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugCallbackLabel")}),n.jsx("strong",{children:Nl(a.requiresCallbackHandling)})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugAiFallbackLabel")}),n.jsx("strong",{children:nv(a.aiFallbackPolicy)})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.manageWorkspacePathLabel")}),n.jsx("strong",{children:e.path})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFrameworkNoteLabel")}),n.jsx("strong",{children:((g=t.currentCompatibilityItem)==null?void 0:g.notes)??o("shell.workspaceDetailDebugFrameworkNoteEmpty")})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugOverallSummaryLabel")}),n.jsx("strong",{children:tv(d)})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugReasonsLabel")}),n.jsx("strong",{children:nm(a.reasons,"shell.workspaceDetailDebugEmptyReasons")})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFilesLabel")}),n.jsx("strong",{children:nm(a.detectedFiles,"shell.workspaceDetailDebugEmptyFiles")})]})]}),t.runtime===null?n.jsx("p",{className:"status-text",children:o("shell.workspaceDetailDebugRuntimeEmpty")}):null,r?n.jsx("div",{className:"workbench-modal-actions",children:r}):null]}):null]}),t.services.length>0?n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.workspaceDetailDebugDetectedServicesTitle")})}),n.jsx("span",{className:"mobile-feature-counter",children:t.services.length})]}),n.jsx("div",{className:"mobile-feature-stack",children:t.services.map(y=>{const x=t.analyses.find(C=>C.serviceId===y.id)??null;return n.jsxs("article",{className:"surface-card mobile-session-row",children:[n.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[n.jsx("span",{className:"mobile-session-row-title",children:y.name}),n.jsx("span",{className:"mobile-session-row-provider",children:lu(su(y,x))})]}),n.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServicePathLabel")}),n.jsx("strong",{title:y.cwd,children:cu(y.cwd,e.path)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceFrameworkLabel")}),n.jsx("strong",{children:(x==null?void 0:x.primaryFramework)??o("common.unknown")})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugCompatibilityLabel")}),n.jsx("strong",{children:xo((x==null?void 0:x.compatibilityLevel)??"unknown")})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceCommandLabel")}),n.jsx("strong",{children:rv(y)})]})]})]},y.id)})})]}):null,(v=t.runtime)!=null&&v.services.length?n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.workspaceDetailDebugRuntimeServicesTitle")})}),n.jsx("span",{className:"mobile-feature-counter",children:t.runtime.services.length})]}),n.jsx("div",{className:"mobile-feature-stack",children:t.runtime.services.map(y=>{var x,C,j,N,P;return n.jsxs("article",{className:"surface-card mobile-session-row",children:[n.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[n.jsx("span",{className:"mobile-session-row-title",children:y.service.name}),n.jsx("span",{className:"mobile-session-row-provider",children:lu(su(y.service,y.analysis))})]}),n.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServicePathLabel")}),n.jsx("strong",{title:y.service.cwd,children:cu(y.service.cwd,e.path)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeServicePortLabel")}),n.jsx("strong",{children:ER(((x=y.binding)==null?void 0:x.leasedPort)??((C=y.portLease)==null?void 0:C.port)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeServiceBindingLabel")}),n.jsx("strong",{children:IR(((j=y.binding)==null?void 0:j.status)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeServiceProcessLabel")}),n.jsx("strong",{children:LR(((N=y.processInstance)==null?void 0:N.status)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeServiceFailureLabel")}),n.jsx("strong",{children:ou(((P=y.processInstance)==null?void 0:P.failureStage)??(c==null?void 0:c.failureStage)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeServiceAiLabel")}),n.jsx("strong",{children:r9(y.aiFallbackEdits.map(L=>L.status))})]})]})]},y.service.id)})})]}):null,u.length>0?n.jsx("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:n.jsx(RR,{items:u,layout:"mobile",open:m,onOpen:()=>f(!0),onClose:()=>f(!1)})}):null]})}function LG({workspace:e,state:t,actions:r,matrixLimit:i}){var m,f,w;const a=t.primaryAnalysis,c=((m=t.runtime)==null?void 0:m.runtimeSession)??null,u=i?t.matrixItems.slice(0,i):t.matrixItems,d=Zw(t);return n.jsxs("div",{className:"workbench-manage-list",children:[t.loading&&a===null?n.jsx("p",{className:"workbench-manage-status status-text",children:o("common.loading")}):null,t.error?n.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:t.error}):null,a?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugOverallStatusLabel")}),n.jsx("p",{className:"workbench-manage-detail-value",children:ev(d)}),n.jsx("p",{className:"workbench-manage-hint",children:tv(d)})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspacePathLabel")}),n.jsx("p",{className:"workbench-manage-detail-value",children:e.path})]}),n.jsx("div",{className:"workbench-manage-detail-block",children:n.jsxs("div",{className:"workbench-manage-kv-list",children:[n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFrameworkLabel")}),n.jsx("span",{children:a.primaryFramework??o("common.unknown")})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugConfidenceLabel")}),n.jsx("span",{children:MR(a.confidence)})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugCompatibilityLabel")}),n.jsx("span",{children:xo(a.compatibilityLevel)})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugInjectionLabel")}),n.jsx("span",{children:au(a.recommendedInjectionMode??"none")})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeStatusLabel")}),n.jsx("span",{children:zc((c==null?void 0:c.status)??null)})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFailureStageLabel")}),n.jsx("span",{children:ou((c==null?void 0:c.failureStage)??null)})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugAiFallbackLabel")}),n.jsx("span",{children:nv(a.aiFallbackPolicy)})]})]})}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugDetectedServicesTitle")}),t.services.length>0?n.jsx("div",{className:"workbench-manage-type-list",children:t.services.map(g=>{const v=t.analyses.find(y=>y.serviceId===g.id)??null;return n.jsxs("div",{className:"workbench-manage-type-item",children:[n.jsx("span",{className:"workbench-manage-type-meta",children:n.jsxs("span",{className:"workbench-manage-type-name",children:[g.name," · ",lu(su(g,v))]})}),n.jsxs("span",{title:g.cwd,children:[cu(g.cwd,e.path)," · ",(v==null?void 0:v.primaryFramework)??o("common.unknown")," · ",xo((v==null?void 0:v.compatibilityLevel)??"unknown")," · ",rv(g)]})]},g.id)})}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.workspaceDetailDebugRuntimeEmpty")})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugFrameworkNoteLabel")}),n.jsx("p",{className:"workbench-manage-hint",children:((f=t.currentCompatibilityItem)==null?void 0:f.notes)??o("shell.workspaceDetailDebugFrameworkNoteEmpty")})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugReasonsLabel")}),n.jsx("p",{className:"workbench-manage-hint",children:nm(a.reasons,"shell.workspaceDetailDebugEmptyReasons")})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugFilesLabel")}),n.jsx("p",{className:"workbench-manage-hint",children:nm(a.detectedFiles,"shell.workspaceDetailDebugEmptyFiles")})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugRuntimeServicesTitle")}),(w=t.runtime)!=null&&w.services.length?n.jsx("div",{className:"workbench-manage-type-list",children:t.runtime.services.map(g=>{var v,y,x,C;return n.jsxs("div",{className:"workbench-manage-type-item",children:[n.jsx("span",{className:"workbench-manage-type-meta",children:n.jsxs("span",{className:"workbench-manage-type-name",children:[g.service.name," · ",lu(su(g.service,g.analysis))]})}),n.jsxs("span",{title:g.service.cwd,children:[cu(g.service.cwd,e.path)," · ",o("shell.workspaceDetailDebugRuntimeServicePortLabel")," ",ER(((v=g.binding)==null?void 0:v.leasedPort)??((y=g.portLease)==null?void 0:y.port)??null)," · ",o("shell.workspaceDetailDebugRuntimeServiceBindingLabel")," ",IR(((x=g.binding)==null?void 0:x.status)??null)," · ",o("shell.workspaceDetailDebugRuntimeServiceProcessLabel")," ",LR(((C=g.processInstance)==null?void 0:C.status)??null)]})]},g.service.id)})}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.workspaceDetailDebugRuntimeEmpty")})]}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.workspaceDetailDebugMatrixTitle")}),n.jsx("div",{className:"workbench-manage-type-list",children:u.map(g=>n.jsxs("div",{className:"workbench-manage-type-item",children:[n.jsx("span",{className:"workbench-manage-type-meta",children:n.jsx("span",{className:"workbench-manage-type-name",children:g.framework})}),n.jsxs("span",{children:[xo(g.compatibilityLevel)," · ",au(g.recommendedInjectionMode)]})]},g.framework))})]}),r?n.jsx("div",{className:"workbench-modal-actions",children:r}):null]}):null]})}function FG({workspace:e,state:t,actions:r,matrixLimit:i}){var v,y;const a=t.primaryAnalysis,c=((v=t.runtime)==null?void 0:v.runtimeSession)??null,u=i?t.matrixItems.slice(0,i):t.matrixItems,d=Zw(t),m=AR(t),f=((y=t.analyses[0])==null?void 0:y.createdAt)??null,[w,g]=p.useState(!1);return n.jsxs("div",{className:"debug-readiness-page",children:[t.loading&&a===null?n.jsx("p",{className:"workbench-manage-status status-text",children:o("common.loading")}):null,t.error?n.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:t.error}):null,a?n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"debug-readiness-hero surface-card",children:[n.jsxs("div",{className:"debug-readiness-hero-header",children:[n.jsxs("div",{className:"debug-readiness-hero-copy",children:[n.jsx("span",{className:"debug-readiness-eyebrow",children:e.name??o("shell.workspaceDetailDebugPageHeroEyebrow")}),n.jsx("h2",{children:o("shell.workspaceDetailDebugPageTitle")}),n.jsx("p",{children:tv(d)})]}),r?n.jsx("div",{className:"debug-readiness-hero-actions",children:r}):null]}),n.jsxs("div",{className:"debug-readiness-summary-grid",children:[n.jsxs("article",{className:"debug-readiness-summary-card","data-tone":d.overallTone,children:[n.jsx("span",{children:o("shell.workspaceDetailDebugOverallStatusLabel")}),n.jsx("strong",{children:ev(d)}),n.jsx("small",{children:d.autoInjectionEligible?o("shell.workspaceDetailDebugAutoInjectionEligible"):o("shell.workspaceDetailDebugAutoInjectionBlocked")})]}),n.jsxs("article",{className:"debug-readiness-summary-card",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugSummaryServiceCountLabel")}),n.jsx("strong",{children:d.totalServices}),n.jsx("small",{children:o("shell.workspaceDetailDebugDetectedServicesTitle")})]}),n.jsxs("article",{className:"debug-readiness-summary-card",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugSummaryWebCountLabel")}),n.jsx("strong",{children:d.webServiceCount}),n.jsx("small",{children:WG(d)})]}),n.jsxs("article",{className:"debug-readiness-summary-card",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugSummaryDesktopShellCountLabel")}),n.jsx("strong",{children:d.desktopShellCount}),n.jsx("small",{children:o("shell.workspaceDetailDebugDesktopShellSummaryHint")})]}),n.jsxs("article",{className:"debug-readiness-summary-card",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeStatusLabel")}),n.jsx("strong",{children:zc((c==null?void 0:c.status)??null)}),n.jsx("small",{children:ou((c==null?void 0:c.failureStage)??null)})]}),n.jsxs("article",{className:"debug-readiness-summary-card",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugLastAnalyzedAtLabel")}),n.jsx("strong",{children:Aj(f)}),n.jsx("small",{children:UG(t.targetSourceType)})]})]}),n.jsx("div",{className:"debug-readiness-chip-row",children:d.categoryChips.map(x=>n.jsx("span",{className:"debug-readiness-chip","data-tone":x.tone,children:x.label},x.key))}),n.jsxs("div",{className:"debug-readiness-hero-meta",children:[n.jsx("span",{children:o("shell.manageWorkspacePathLabel")}),n.jsx("strong",{children:e.path})]})]}),n.jsxs("div",{className:"debug-readiness-layout",children:[n.jsxs("section",{className:"debug-readiness-section surface-card",children:[n.jsx("div",{className:"debug-readiness-section-header",children:n.jsxs("div",{children:[n.jsx("h3",{children:o("shell.workspaceDetailDebugDetectedServicesTitle")}),n.jsx("p",{children:o("shell.workspaceDetailDebugServiceSectionDescription")})]})}),n.jsx("div",{className:"debug-readiness-service-grid",children:m.map(x=>{var C,j,N;return n.jsxs("article",{className:"debug-readiness-service-card",children:[n.jsxs("div",{className:"debug-readiness-service-card-header",children:[n.jsxs("div",{children:[n.jsx("strong",{children:x.service.name}),n.jsx("p",{children:cu(x.service.cwd,e.path)})]}),n.jsx("span",{className:"debug-readiness-chip","data-tone":BG(x.category),children:lu(x.category)})]}),n.jsxs("div",{className:"debug-readiness-service-card-grid",children:[n.jsxs("div",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceFrameworkLabel")}),n.jsx("strong",{children:((C=x.analysis)==null?void 0:C.primaryFramework)??o("common.unknown")})]}),n.jsxs("div",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugCompatibilityLabel")}),n.jsx("strong",{children:xo(((j=x.analysis)==null?void 0:j.compatibilityLevel)??"unknown")})]}),n.jsxs("div",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugInjectionLabel")}),n.jsx("strong",{children:au(((N=x.analysis)==null?void 0:N.recommendedInjectionMode)??"none")})]}),n.jsxs("div",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeStatusLabel")}),n.jsx("strong",{children:zc(HG(x))})]})]}),n.jsxs("div",{className:"debug-readiness-service-card-list",children:[n.jsxs("p",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceCommandLabel")}),n.jsx("strong",{children:rv(x.service)})]}),n.jsxs("p",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceRequirementsLabel")}),n.jsx("strong",{children:zG(x.analysis)})]}),n.jsxs("p",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceActionLabel")}),n.jsx("strong",{children:$G(x)})]}),n.jsxs("p",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugReasonsLabel")}),n.jsx("strong",{children:qG(x)})]})]})]},x.service.id)})})]}),n.jsxs("aside",{className:"debug-readiness-sidebar",children:[n.jsxs("section",{className:"debug-readiness-section surface-card",children:[n.jsx("div",{className:"debug-readiness-section-header",children:n.jsxs("div",{children:[n.jsx("h3",{children:o("shell.workspaceDetailDebugRuntimeHistoryTitle")}),n.jsx("p",{children:o("shell.workspaceDetailDebugRuntimeSectionDescription")})]})}),t.runtimeHistory.length>0?n.jsx("div",{className:"debug-readiness-runtime-list",children:t.runtimeHistory.map(x=>n.jsxs("article",{className:"debug-readiness-runtime-item",children:[n.jsxs("div",{className:"debug-readiness-runtime-item-header",children:[n.jsx("strong",{children:VG(x)}),n.jsx("span",{children:zc(x.runtimeSession.status)})]}),n.jsx("p",{children:GG(x)}),n.jsxs("div",{className:"debug-readiness-runtime-item-grid",children:[n.jsxs("span",{children:[o("shell.workspaceDetailDebugRuntimeHistoryTimeLabel")," ",Aj(x.runtimeSession.startedAt??x.runtimeSession.createdAt)]}),n.jsxs("span",{children:[o("shell.workspaceDetailDebugRuntimeHistoryServiceLabel")," ",KG(x)]}),n.jsxs("span",{children:[o("shell.workspaceDetailDebugRuntimeServiceFailureLabel")," ",ou(x.runtimeSession.failureStage??null)]}),n.jsxs("span",{children:[o("shell.workspaceDetailDebugRuntimeHistoryResultLabel")," ",YG(x)]})]})]},x.runtimeSession.id))}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.workspaceDetailDebugRuntimeEmpty")})]}),n.jsx("section",{className:"debug-readiness-section surface-card",children:n.jsx(RR,{items:u,layout:"desktop",open:w,onOpen:()=>g(!0),onClose:()=>g(!1)})})]})]})]}):null]})}function RR({items:e,layout:t,open:r,onOpen:i,onClose:a}){const c=OG(e);return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:t==="mobile"?void 0:"debug-readiness-section-body",children:[n.jsxs("div",{className:t==="mobile"?"mobile-feature-section-header":"debug-readiness-section-header",children:[n.jsxs("div",{children:[t==="mobile"?n.jsx("h2",{children:o("shell.workspaceDetailDebugMatrixTitle")}):null,t==="desktop"?n.jsx("h3",{children:o("shell.workspaceDetailDebugMatrixTitle")}):null,n.jsx("p",{children:o("shell.workspaceDetailDebugMatrixSectionDescription")})]}),n.jsx("span",{className:t==="mobile"?"mobile-feature-counter":"debug-readiness-matrix-counter",children:e.length})]}),n.jsxs("div",{className:`debug-readiness-matrix-entry${t==="mobile"?" debug-readiness-matrix-entry-mobile":""}`,children:[n.jsxs("div",{className:"debug-readiness-matrix-summary-row",children:[n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"success",children:[o("shell.workspaceDetailDebugCompatibilitySupported"),n.jsx("strong",{children:c.supportedCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"warn",children:[o("shell.workspaceDetailDebugCompatibilityConditional"),n.jsx("strong",{children:c.conditionalCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"danger",children:[o("shell.workspaceDetailDebugCompatibilityUnsupported"),n.jsx("strong",{children:c.unsupportedCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"neutral",children:[o("shell.workspaceDetailDebugCompatibilityUnknown"),n.jsx("strong",{children:c.unknownCount})]})]}),n.jsx("button",{type:"button",className:"secondary-button debug-readiness-matrix-open-button",onClick:i,children:o("shell.workspaceDetailDebugMatrixOpenAction")})]})]}),n.jsx(Ln,{open:r,title:o("shell.workspaceDetailDebugMatrixTitle"),description:o("shell.workspaceDetailDebugMatrixModalDescription"),className:`debug-readiness-matrix-modal-card${t==="mobile"?" debug-readiness-matrix-modal-card-mobile":""}`,onClose:a,children:n.jsxs("div",{className:"debug-readiness-matrix-modal",children:[n.jsxs("div",{className:"debug-readiness-matrix-summary-row debug-readiness-matrix-summary-row-modal",children:[n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"success",children:[o("shell.workspaceDetailDebugCompatibilitySupported"),n.jsx("strong",{children:c.supportedCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"warn",children:[o("shell.workspaceDetailDebugCompatibilityConditional"),n.jsx("strong",{children:c.conditionalCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"danger",children:[o("shell.workspaceDetailDebugCompatibilityUnsupported"),n.jsx("strong",{children:c.unsupportedCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"neutral",children:[o("shell.workspaceDetailDebugCompatibilityUnknown"),n.jsx("strong",{children:c.unknownCount})]})]}),n.jsx("div",{className:"debug-readiness-matrix-table-wrap",children:n.jsxs("table",{className:"debug-readiness-matrix-table",children:[n.jsx("thead",{children:n.jsxs("tr",{children:[n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixFrameworkHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixCompatibilityHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixInjectionHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixDiscoveryHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixHmrHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixCallbackHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixAiHeader")}),n.jsx("th",{scope:"col",children:o("shell.workspaceDetailDebugMatrixNotesHeader")})]})}),n.jsx("tbody",{children:e.map(u=>{const d=JG(u.compatibilityLevel);return n.jsxs("tr",{children:[n.jsx("th",{scope:"row",className:"debug-readiness-matrix-framework-cell",children:u.framework}),n.jsx("td",{children:n.jsx(xc,{className:"debug-readiness-matrix-badge",tone:d,icon:QG(u.compatibilityLevel),label:XG(u.compatibilityLevel),title:xo(u.compatibilityLevel)})}),n.jsx("td",{children:n.jsx("span",{className:"debug-readiness-matrix-badge debug-readiness-matrix-badge-subtle","data-tone":"neutral",title:au(u.recommendedInjectionMode),children:ZG(u.recommendedInjectionMode)})}),n.jsx("td",{children:n.jsx(xc,{className:"debug-readiness-matrix-flag",tone:u.requiresServiceDiscoveryHandling?"warn":"success",icon:u.requiresServiceDiscoveryHandling?"warn":"check",label:gg(u.requiresServiceDiscoveryHandling),title:Nl(u.requiresServiceDiscoveryHandling)})}),n.jsx("td",{children:n.jsx(xc,{className:"debug-readiness-matrix-flag",tone:u.requiresHmrHandling?"warn":"success",icon:u.requiresHmrHandling?"warn":"check",label:gg(u.requiresHmrHandling),title:Nl(u.requiresHmrHandling)})}),n.jsx("td",{children:n.jsx(xc,{className:"debug-readiness-matrix-flag",tone:u.requiresCallbackHandling?"warn":"success",icon:u.requiresCallbackHandling?"warn":"check",label:gg(u.requiresCallbackHandling),title:Nl(u.requiresCallbackHandling)})}),n.jsx("td",{children:n.jsx(xc,{className:"debug-readiness-matrix-badge debug-readiness-matrix-badge-subtle",tone:t9(u.aiFallbackPolicy),icon:n9(u.aiFallbackPolicy),label:e9(u.aiFallbackPolicy),title:nv(u.aiFallbackPolicy)})}),n.jsx("td",{className:"debug-readiness-matrix-note-cell",children:u.notes})]},u.framework)})})]})}),n.jsxs("div",{className:"debug-readiness-matrix-legend",children:[n.jsx("p",{children:o("shell.workspaceDetailDebugMatrixLegendSummary")}),n.jsxs("div",{className:"debug-readiness-matrix-legend-grid",children:[n.jsxs("div",{children:[n.jsx("strong",{children:o("shell.workspaceDetailDebugMatrixDiscoveryHeader")}),n.jsx("span",{children:o("shell.workspaceDetailDebugMatrixDiscoveryNote")})]}),n.jsxs("div",{children:[n.jsx("strong",{children:o("shell.workspaceDetailDebugMatrixHmrHeader")}),n.jsx("span",{children:o("shell.workspaceDetailDebugMatrixHmrNote")})]}),n.jsxs("div",{children:[n.jsx("strong",{children:o("shell.workspaceDetailDebugMatrixCallbackHeader")}),n.jsx("span",{children:o("shell.workspaceDetailDebugMatrixCallbackNote")})]}),n.jsxs("div",{children:[n.jsx("strong",{children:o("shell.workspaceDetailDebugMatrixAiHeader")}),n.jsx("span",{children:o("shell.workspaceDetailDebugMatrixAiNote")})]})]})]})]})})]})}function xc({tone:e,icon:t,label:r,title:i,className:a}){return n.jsxs("span",{className:a,"data-tone":e,title:i,children:[n.jsx(_G,{kind:t}),n.jsx("span",{children:r})]})}function _G({kind:e}){return e==="check"?n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M3.2 8.3L6.4 11.5L12.8 4.8",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.9"})}):e==="cross"?n.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:n.jsx("path",{d:"M4.4 4.4L11.6 11.6M11.6 4.4L4.4 11.6",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.9"})}):e==="warn"?n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("path",{d:"M8 2.2L14 13.4H2L8 2.2Z",fill:"currentColor",opacity:"0.18"}),n.jsx("path",{d:"M8 5.3V8.8M8 11.3H8.01",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.7"}),n.jsx("path",{d:"M8 2.2L14 13.4H2L8 2.2Z",fill:"none",stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"1.2"})]}):n.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[n.jsx("circle",{cx:"8",cy:"8",r:"5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),n.jsx("path",{d:"M8 5.1V8.4M8 11H8.01",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.7"})]})}function MR(e){switch(e){case"high":return o("shell.workspaceDetailDebugConfidenceHigh");case"medium":return o("shell.workspaceDetailDebugConfidenceMedium");case"low":return o("shell.workspaceDetailDebugConfidenceLow");default:return e}}function AR(e){return e.services.map(t=>{var a;const r=e.analyses.find(c=>c.serviceId===t.id)??null,i=((a=e.runtime)==null?void 0:a.services.find(c=>c.service.id===t.id))??null;return{service:t,analysis:r,runtimeItem:i,category:su(t,r)}})}function Zw(e){const t=AR(e),r=t.filter(x=>x.category!=="desktop_shell"),i=r.map(x=>x.analysis).filter(x=>x!==null),a=i.length>0?i:e.analyses,c=a.filter(x=>x.compatibilityLevel==="supported").length,u=a.filter(x=>x.compatibilityLevel==="conditional").length,d=a.filter(x=>x.compatibilityLevel==="unsupported").length,m=a.filter(x=>x.compatibilityLevel==="unknown").length,f=t.filter(x=>x.category==="desktop_shell").length,w=t.length,g=r.length,v=d>0?"danger":u>0?"warn":c>0?"success":"neutral",y=[g>0?{key:"web",label:o("shell.workspaceDetailDebugSummaryWebServicesChip",{count:g}),tone:g===c&&u===0?"success":"warn"}:null,f>0?{key:"desktop-shell",label:o("shell.workspaceDetailDebugSummaryDesktopShellChip",{count:f}),tone:"neutral"}:null,d>0?{key:"unsupported",label:o("shell.workspaceDetailDebugSummaryUnsupportedChip",{count:d}),tone:"danger"}:null].filter(x=>x!==null);return{totalServices:w,webServiceCount:g,desktopShellCount:f,supportedCount:c,conditionalCount:u,unsupportedCount:d,unknownCount:m,autoInjectionEligible:e.autoInjectionEligible,overallTone:v,categoryChips:y}}function OG(e){return{supportedCount:e.filter(t=>t.compatibilityLevel==="supported").length,conditionalCount:e.filter(t=>t.compatibilityLevel==="conditional").length,unsupportedCount:e.filter(t=>t.compatibilityLevel==="unsupported").length,unknownCount:e.filter(t=>t.compatibilityLevel==="unknown").length}}function su(e,t){if((t==null?void 0:t.primaryFramework)==="tauri"||(t==null?void 0:t.primaryFramework)==="electron")return"desktop_shell";switch(e.role){case"frontend":return"frontend";case"backend":return"backend";case"worker":return"worker";case"mock":return"mock";default:return"custom"}}function BG(e){switch(e){case"frontend":return"success";case"backend":return"warn";case"desktop_shell":return"neutral";case"worker":case"mock":case"custom":default:return"neutral"}}function ev(e){return e.unsupportedCount>0?o("shell.workspaceDetailDebugOverallStatusBlocked"):e.conditionalCount>0?o("shell.workspaceDetailDebugOverallStatusConditional"):e.supportedCount>0?o("shell.workspaceDetailDebugOverallStatusSupported"):o("shell.workspaceDetailDebugCompatibilityUnknown")}function tv(e){return e.totalServices===0?o("shell.workspaceDetailDebugOverallSummaryEmpty"):e.desktopShellCount>0&&e.webServiceCount>0?o("shell.workspaceDetailDebugOverallSummaryMixed",{webCount:e.webServiceCount,desktopCount:e.desktopShellCount}):e.desktopShellCount>0&&e.webServiceCount===0?o("shell.workspaceDetailDebugOverallSummaryDesktopOnly",{count:e.desktopShellCount}):o("shell.workspaceDetailDebugOverallSummaryWebOnly",{count:e.webServiceCount})}function WG(e){return o("shell.workspaceDetailDebugCompatibilityBreakdown",{supported:e.supportedCount,conditional:e.conditionalCount,unsupported:e.unsupportedCount})}function UG(e){switch(e){case"repo":return o("shell.workspaceDetailDebugTargetSourceRepo");case"worktree":return o("shell.workspaceDetailDebugTargetSourceWorktree");default:return o("common.unknown")}}function HG(e){var t,r,i,a,c;return((r=(t=e.runtimeItem)==null?void 0:t.processInstance)==null?void 0:r.status)==="running"?"RUNNING":((a=(i=e.runtimeItem)==null?void 0:i.processInstance)==null?void 0:a.status)==="error"?"FAILED":e.runtimeItem&&((c=e.runtimeItem.binding)==null?void 0:c.status)==="RELEASED"?"STOPPED":null}function zG(e){if(!e)return o("shell.workspaceDetailDebugEmptyReasons");const t=[e.requiresServiceDiscoveryHandling?o("shell.workspaceDetailDebugFailureStageServiceDiscovery"):null,e.requiresHmrHandling?o("shell.workspaceDetailDebugFailureStageHmr"):null,e.requiresCallbackHandling?o("shell.workspaceDetailDebugFailureStageCallback"):null].filter(r=>r!==null);return t.length>0?t.join(" / "):o("shell.workspaceDetailDebugRequirementsNone")}function qG(e){var t;if(e.category==="desktop_shell")return o("shell.workspaceDetailDebugServiceOverviewDesktopShell");switch((t=e.analysis)==null?void 0:t.compatibilityLevel){case"supported":return o("shell.workspaceDetailDebugServiceOverviewSupported");case"conditional":return o("shell.workspaceDetailDebugServiceOverviewConditional");case"unsupported":return o("shell.workspaceDetailDebugServiceOverviewUnsupported");default:return o("shell.workspaceDetailDebugServiceOverviewUnknown")}}function $G(e){var t;if(e.category==="desktop_shell")return o("shell.workspaceDetailDebugServiceActionDesktopShell");switch((t=e.analysis)==null?void 0:t.compatibilityLevel){case"supported":return o("shell.workspaceDetailDebugServiceActionSupported");case"conditional":return o("shell.workspaceDetailDebugServiceActionConditional");case"unsupported":return o("shell.workspaceDetailDebugServiceActionUnsupported");default:return o("shell.workspaceDetailDebugServiceActionUnknown")}}function VG(e){return o("shell.workspaceDetailDebugRuntimeHistoryTitleWithIndex",{id:e.runtimeSession.id.slice(0,8)})}function GG(e){const t=e.services.filter(r=>{var i,a;return((i=r.processInstance)==null?void 0:i.status)==="error"||((a=r.binding)==null?void 0:a.status)==="FAILED"}).map(r=>r.service.name);return t.length>0?o("shell.workspaceDetailDebugRuntimeHistoryFailedSummary",{services:t.join("、")}):o("shell.workspaceDetailDebugRuntimeHistoryGenericSummary")}function KG(e){return e.services.length===0?o("shell.workspaceDetailDebugRuntimeHistoryNoServices"):e.services.map(t=>t.service.name).join("、")}function YG(e){const t=e.services.some(r=>{var i;return((i=r.processInstance)==null?void 0:i.status)==="running"});return e.runtimeSession.status==="RUNNING"||t?o("shell.workspaceDetailDebugRuntimeHistoryResultRunning"):e.runtimeSession.status==="FAILED"?o("shell.workspaceDetailDebugRuntimeHistoryResultFailed"):e.runtimeSession.status==="STOPPED"?o("shell.workspaceDetailDebugRuntimeHistoryResultStopped"):o("shell.workspaceDetailDebugRuntimeHistoryResultPreparing")}function Aj(e){if(!e)return o("shell.workspaceDetailDebugFailureStageEmpty");const t=new Date(e);return Number.isNaN(t.getTime())?e:new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t)}function xo(e){switch(e){case"supported":return o("shell.workspaceDetailDebugCompatibilitySupported");case"conditional":return o("shell.workspaceDetailDebugCompatibilityConditional");case"unsupported":return o("shell.workspaceDetailDebugCompatibilityUnsupported");default:return o("shell.workspaceDetailDebugCompatibilityUnknown")}}function XG(e){switch(e){case"supported":return o("shell.workspaceDetailDebugMatrixCompatibilitySupportedShort");case"conditional":return o("shell.workspaceDetailDebugMatrixCompatibilityConditionalShort");case"unsupported":return o("shell.workspaceDetailDebugMatrixCompatibilityUnsupportedShort");default:return o("shell.workspaceDetailDebugMatrixCompatibilityUnknownShort")}}function QG(e){switch(e){case"supported":return"check";case"conditional":return"warn";case"unsupported":return"cross";default:return"neutral"}}function JG(e){switch(e){case"supported":return"success";case"conditional":return"warn";case"unsupported":return"danger";default:return"neutral"}}function au(e){switch(e){case"cli":return o("shell.workspaceDetailDebugInjectionCli");case"env":return o("shell.workspaceDetailDebugInjectionEnv");case"override":return o("shell.workspaceDetailDebugInjectionOverride");case"ai_fallback":return o("shell.workspaceDetailDebugInjectionAiFallback");default:return o("shell.workspaceDetailDebugInjectionNone")}}function ZG(e){switch(e){case"cli":return o("shell.workspaceDetailDebugMatrixInjectionCliShort");case"env":return o("shell.workspaceDetailDebugMatrixInjectionEnvShort");case"override":return o("shell.workspaceDetailDebugMatrixInjectionOverrideShort");case"ai_fallback":return o("shell.workspaceDetailDebugMatrixInjectionAiFallbackShort");default:return o("shell.workspaceDetailDebugMatrixInjectionNoneShort")}}function zc(e){switch(e){case"PREPARING":return o("shell.workspaceDetailDebugRuntimePreparing");case"RUNNING":return o("shell.workspaceDetailDebugRuntimeRunning");case"FAILED":return o("shell.workspaceDetailDebugRuntimeFailed");case"STOPPED":return o("shell.workspaceDetailDebugRuntimeStopped");default:return o("shell.workspaceDetailDebugRuntimeNotStarted")}}function ou(e){switch(e){case null:case"":return o("shell.workspaceDetailDebugFailureStageEmpty");case"service_discovery":return o("shell.workspaceDetailDebugFailureStageServiceDiscovery");case"hmr":return o("shell.workspaceDetailDebugFailureStageHmr");case"callback":return o("shell.workspaceDetailDebugFailureStageCallback");case"ai_fallback_required":return o("shell.workspaceDetailDebugFailureStageAiFallbackRequired");case"adapter_selection":return o("shell.workspaceDetailDebugFailureStageAdapterSelection");case"launch_requirements":return o("shell.workspaceDetailDebugFailureStageLaunchRequirements");case"command_execution":return o("shell.workspaceDetailDebugFailureStageCommandExecution");case"process_exit":return o("shell.workspaceDetailDebugFailureStageProcessExit");case"process_runtime_error":return o("shell.workspaceDetailDebugFailureStageProcessRuntimeError");case"stale_runtime_binding":return o("shell.workspaceDetailDebugFailureStageStaleRuntimeBinding");default:return o("shell.workspaceDetailDebugFailureStageUnknown",{code:e})}}function Nl(e){return o(e?"shell.workspaceDetailDebugRequirementRequired":"shell.workspaceDetailDebugRequirementNotRequired")}function gg(e){return o(e?"shell.workspaceDetailDebugMatrixRequirementRequiredShort":"shell.workspaceDetailDebugMatrixRequirementNotRequiredShort")}function nv(e){switch(e){case"never":return o("shell.workspaceDetailDebugAiPolicyNever");case"conditional":return o("shell.workspaceDetailDebugAiPolicyConditional");default:return o("shell.workspaceDetailDebugAiPolicyAllowed")}}function e9(e){switch(e){case"never":return o("shell.workspaceDetailDebugMatrixAiNeverShort");case"conditional":return o("shell.workspaceDetailDebugMatrixAiConditionalShort");default:return o("shell.workspaceDetailDebugMatrixAiAllowedShort")}}function t9(e){switch(e){case"never":return"danger";case"conditional":return"warn";default:return"success"}}function n9(e){switch(e){case"never":return"cross";case"conditional":return"warn";default:return"check"}}function nm(e,t){return e.length>0?e.join(", "):o(t)}function lu(e){switch(e){case"frontend":return o("shell.workspaceDetailDebugRoleFrontend");case"backend":return o("shell.workspaceDetailDebugRoleBackend");case"worker":return o("shell.workspaceDetailDebugRoleWorker");case"mock":return o("shell.workspaceDetailDebugRoleMock");case"desktop_shell":return o("shell.workspaceDetailDebugRoleDesktopShell");default:return o("shell.workspaceDetailDebugRoleCustom")}}function ER(e){return e===null?o("shell.workspaceDetailDebugPortEmpty"):String(e)}function IR(e){switch(e){case"ALLOCATED":return o("shell.workspaceDetailDebugBindingAllocated");case"LISTENING":return o("shell.workspaceDetailDebugBindingListening");case"FAILED":return o("shell.workspaceDetailDebugBindingFailed");case"RELEASED":return o("shell.workspaceDetailDebugBindingReleased");default:return o("shell.workspaceDetailDebugBindingUnknown")}}function LR(e){switch(e){case"creating":return o("shell.workspaceDetailDebugProcessCreating");case"running":return o("shell.workspaceDetailDebugProcessRunning");case"closed":return o("shell.workspaceDetailDebugProcessClosed");case"error":return o("shell.workspaceDetailDebugProcessError");default:return o("shell.workspaceDetailDebugProcessUnknown")}}function r9(e){return e.length===0?o("shell.workspaceDetailDebugAiEditEmpty"):e.map(t=>i9(t)).join(", ")}function i9(e){switch(e){case"PENDING":return o("shell.workspaceDetailDebugAiEditPending");case"APPLIED":return o("shell.workspaceDetailDebugAiEditApplied");case"ROLLED_BACK":return o("shell.workspaceDetailDebugAiEditRolledBack");case"REJECTED":return o("shell.workspaceDetailDebugAiEditRejected");default:return e}}function cu(e,t){const r=Ej(t),i=Ej(e);return i===r?".":i.startsWith(`${r}/`)?i.slice(r.length+1):i}function rv(e){return[e.command,...e.args].filter(Boolean).join(" ")}function Ej(e){return e.replace(/\\/g,"/").replace(/\/+$/g,"")}function FR(e){const[t,r]=p.useState({loading:!1,error:null,targetId:null,targetSourceType:null,autoInjectionEligible:!1,services:[],analyses:[],runtime:null,runtimeHistory:[],matrixItems:[]});p.useEffect(()=>{if(!(e!=null&&e.id)||!e.path){r({loading:!1,error:null,targetId:null,targetSourceType:null,autoInjectionEligible:!1,services:[],analyses:[],runtime:null,runtimeHistory:[],matrixItems:[]});return}let c=!1;return r(u=>({...u,loading:!0,error:null})),(async()=>{try{const u=await GL({workspaceId:e.id,rootPath:e.path}),[d,m]=await Promise.all([KL(u.target.id,5),YL()]),f=s9(d);if(c)return;r({loading:!1,error:null,targetId:u.target.id,targetSourceType:u.target.sourceType,autoInjectionEligible:u.autoInjectionEligible,services:u.services,analyses:u.analyses,runtime:f,runtimeHistory:d.items,matrixItems:m.items})}catch(u){if(c)return;r({loading:!1,error:u instanceof Error?u.message:o("shell.workspaceDetailDebugAnalyzeFailed"),targetId:null,targetSourceType:null,autoInjectionEligible:!1,services:[],analyses:[],runtime:null,runtimeHistory:[],matrixItems:[]})}})(),()=>{c=!0}},[e==null?void 0:e.id,e==null?void 0:e.path]);const i=p.useMemo(()=>a9(t.services,t.analyses),[t.analyses,t.services]),a=p.useMemo(()=>t.matrixItems.find(c=>c.framework===((i==null?void 0:i.primaryFramework)??"unknown"))??null,[i==null?void 0:i.primaryFramework,t.matrixItems]);return{...t,primaryAnalysis:i,currentCompatibilityItem:a}}function s9(e){return e.items[0]??null}function a9(e,t){if(t.length===0)return null;const r=new Map(t.filter(a=>a.serviceId).map(a=>[a.serviceId,a]));return[...e].sort((a,c)=>o9(a,c)).map(a=>r.get(a.id)??null).find(a=>a!==null)??t[0]??null}function o9(e,t){const r=Ij(e.role)-Ij(t.role);return r!==0?r:e.name.localeCompare(t.name)}function Ij(e){switch(e){case"frontend":return 0;case"backend":return 1;case"worker":return 2;case"mock":return 3;default:return 4}}function l9(e){return e.isArchived!==!0&&!Ya(e)}function c9(e){return e.isArchived===!0&&!Ya(e)}const bg=60*1e3,wg=10;function u9(){var D;const{workspaceId:e=""}=Ao(),t=mr(),{showToast:r}=Jn(),{navigationGroups:i,currentWorkspaceId:a,favoriteSessionIds:c,workspaceManagementStateById:u,selectWorkspace:d,subscribeGitSnapshot:m,requestGitRefresh:f,subscribeWorkspaceManagementSnapshot:w,requestWorkspaceManagementRefresh:g,toggleFavoriteSession:v,archiveSession:y,unarchiveSession:x,startDraftSession:C}=Tr(),[j,N]=p.useState(!1),[P,L]=p.useState(!1),[Y,H]=p.useState(wg),W=Ol(i),I=ua(i,e),M=(I==null?void 0:I.workspace)??null,O=W.find(T=>T.workspace.id===(M==null?void 0:M.id))??(M?{workspace:M,label:M.name,subtitle:M.path}:null),F=p.useMemo(()=>[...(I==null?void 0:I.sessions)??[]].filter(l9),[I]),X=p.useMemo(()=>[...(I==null?void 0:I.sessions)??[]].filter(c9),[I]);p.useEffect(()=>{e&&d(e)},[d,e]),p.useEffect(()=>{if(!e)return;m(e),w(e);const T=Lr(m9(e),bg)!==null,B=Lr(Lj(e),bg)!==null;T||f(e),B||g(e)},[f,g,m,w,e]),p.useEffect(()=>{H(wg)},[e]);const U=p.useMemo(()=>{if(!e)return{loading:!1,error:null,hasMeaningfulSummary:!1,summary:null};const T=Lr(Lj(e),bg),B=u[e]??null,Q=(B==null?void 0:B.detail)??(M?p9(M,T):T??null);return{loading:(B==null?void 0:B.loading)??!1,error:(B==null?void 0:B.error)??null,hasMeaningfulSummary:f9(Q),summary:Q}},[M,e,u]),G=p.useMemo(()=>U.summary?ZT(U.summary.codeComposition.items,o("shell.manageWorkspaceCodeCompositionOther")):[],[U.summary]),R=p.useMemo(()=>G.length>0?eP(G):void 0,[G]),A=p.useMemo(()=>X.slice(0,Y),[X,Y]),Z=FR(M?{id:M.id,path:M.path,name:M.name}:null);async function pe(){if(!(!M||!(typeof window>"u"||window.confirm(o("shell.manageWorkspaceRemoveConfirmTarget",{name:M.name}))))){N(!0);try{await AT(M.id),r({title:o("shell.manageWorkspaceRemoveSuccess"),tone:"success"}),t("/workspaces",{replace:!0})}catch(B){r({title:B instanceof Error?B.message:o("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{N(!1)}}}function q(T,B){L(!1),C(T,B)}return M?n.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-detail-page",children:[n.jsx(Io,{currentWorkspace:O?{id:O.workspace.id,name:O.label,path:O.subtitle}:null,workspaces:i.map(T=>T.workspace),workspaceOptions:W,heading:o("shell.workspaceDetailTitle"),triggerLabel:(O==null?void 0:O.label)??M.name,onSelectWorkspace:T=>{d(T),t(Ai(T))},content:n.jsxs("div",{className:"mobile-workspace-detail-header-actions",children:[n.jsx("button",{type:"button",className:"primary-button",onClick:()=>L(!0),children:o("shell.createSession")}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(M.id),t(cT(M.id))},children:o("shell.filesEntry")}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(M.id),t(vl(M.id))},children:o("shell.terminalsEntry")})]})}),n.jsxs("div",{className:"mobile-page-top-body mobile-workspace-detail-body",children:[n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-detail-summary-panel",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.workspaceDetailSummaryTitle")})}),a!==M.id?n.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-switch-button",onClick:()=>d(M.id),children:o("shell.switchWorkspace")}):null]}),U.loading&&U.summary===null?n.jsx("p",{children:o("common.loading")}):null,U.error?n.jsx("p",{className:"status-text","data-tone":"error",children:U.error}):null,U.summary?n.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.manageWorkspacePathLabel")}),n.jsx("strong",{title:U.summary.path,children:U.summary.path})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.manageWorkspaceCurrentBranch")}),n.jsx("strong",{title:U.summary.git.currentBranch??o("common.unknown"),children:U.summary.git.currentBranch??o("common.unknown")})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.manageWorkspaceGitCommitCount")}),n.jsx("strong",{children:U.hasMeaningfulSummary?U.summary.git.commitCount??0:"—"})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.manageWorkspaceCodeCompositionFiles")}),n.jsx("strong",{children:U.hasMeaningfulSummary?U.summary.codeComposition.scannedFileCount:"—"})]})]}):null,n.jsxs("div",{className:"mobile-feature-inline-actions mobile-workspace-detail-summary-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(M.id),t(uT(M.id))},children:o("shell.gitEntry")}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(M.id),t(lm(M.id))},children:o("shell.terminalManagerEntry")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:j,onClick:()=>{pe()},children:o(j?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})]})]}),n.jsx(DR,{workspace:M?{id:M.id,path:M.path,name:M.name}:null,state:Z,variant:"mobile"}),n.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.manageWorkspaceCodeCompositionLabel")})}),U.summary?n.jsx("span",{className:"mobile-feature-counter",children:U.summary.codeComposition.scannedFileCount}):null]}),U.loading&&U.summary===null?n.jsx("p",{children:o("common.loading")}):null,U.summary?G.length>0?n.jsxs("div",{className:"workbench-manage-type-chart",children:[n.jsxs("div",{className:"workbench-manage-type-chart-ring",style:R,"aria-hidden":"true",children:[n.jsx("strong",{className:"workbench-manage-type-chart-total",children:U.summary.codeComposition.scannedFileCount}),n.jsx("span",{className:"workbench-manage-type-chart-caption",children:o("shell.manageWorkspaceCodeCompositionFiles")})]}),n.jsx("div",{className:"workbench-manage-type-list",children:G.map(T=>n.jsxs("div",{className:"workbench-manage-type-item",children:[n.jsxs("span",{className:"workbench-manage-type-meta",children:[n.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:T.color},"aria-hidden":"true"}),n.jsx("span",{className:"workbench-manage-type-name",children:T.type})]}),n.jsxs("span",{children:[T.count," · ",JT(T)]})]},T.key))})]}):n.jsx("p",{children:U.summary.codeComposition.error??o("shell.manageWorkspaceNoCodeComposition")}):null,(D=U.summary)!=null&&D.codeComposition.truncated?n.jsx("p",{className:"mobile-workspace-composition-note",children:o("shell.manageWorkspaceCodeTruncated",{count:U.summary.codeComposition.scannedFileCount})}):null]}),n.jsxs("section",{className:"mobile-feature-section",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.recentSessionsSectionTitle")})}),n.jsx("span",{className:"mobile-feature-counter",children:F.length})]}),n.jsx("div",{className:"mobile-feature-stack",children:F.length===0?n.jsx("article",{className:"mobile-feature-empty surface-card",children:n.jsx("p",{children:o("shell.emptyWorkspaceSessions")})}):F.map(T=>{const B=Vs(T.title,o("common.unknown")),Q=c.includes(T.sessionId);return n.jsxs("article",{className:"mobile-session-row surface-card",children:[n.jsxs("button",{type:"button",className:"mobile-session-row-primary",onClick:()=>t(Nr(M.id,T.sessionId)),children:[n.jsx("span",{className:"mobile-session-row-title",title:B.fullTitle,children:B.displayTitle}),n.jsx("span",{className:"mobile-session-row-provider",children:ds(T.provider)})]}),n.jsxs("div",{className:"mobile-session-row-actions",children:[n.jsx("span",{className:"mobile-feature-badge mobile-session-row-count",children:T.messageCount}),n.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":o(Q?"shell.unfavoriteAction":"shell.favoriteAction"),title:o(Q?"shell.unfavoriteAction":"shell.favoriteAction"),onClick:()=>{v(T.sessionId)},children:n.jsx(d9,{active:Q})}),n.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":o("shell.archiveAction"),title:o("shell.archiveAction"),onClick:()=>{y(T.sessionId)},children:n.jsx(h9,{})})]})]},T.sessionId)})})]}),X.length>0?n.jsxs("section",{className:"mobile-feature-section",children:[n.jsxs("div",{className:"mobile-feature-section-header",children:[n.jsx("div",{children:n.jsx("h2",{children:o("shell.archiveModalTitle")})}),n.jsx("span",{className:"mobile-feature-counter",children:X.length})]}),n.jsx("div",{className:"mobile-feature-stack",children:A.map(T=>n.jsxs("article",{className:"mobile-session-row surface-card",children:[n.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[n.jsx("span",{className:"mobile-session-row-title",title:T.title,children:T.title}),n.jsx("span",{className:"mobile-session-row-provider",children:ds(T.provider)})]}),n.jsx("div",{className:"mobile-session-row-actions",children:n.jsx("button",{type:"button",className:"secondary-button mobile-session-row-restore",onClick:()=>{x(T.sessionId)},children:o("shell.unarchiveAction")})})]},T.sessionId))}),A.length<X.length?n.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-expand-button",onClick:()=>{H(T=>T+wg)},children:o("shell.archiveExpandMore")}):null]}):null]}),n.jsx(Nu,{open:P,workspaces:i.map(T=>T.workspace),workspaceOptions:W,initialWorkspaceId:a??M.id,onClose:()=>L(!1),onSelect:q})]}):n.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:n.jsxs("article",{className:"mobile-feature-empty surface-card",children:[n.jsx("h1",{children:o("shell.workspaceDetailMissingTitle")}),n.jsx("p",{children:o("shell.workspaceDetailMissingBody")}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>t("/workspaces"),children:o("shell.mobileWorkspacesEntry")})]})})}function d9({active:e}){return n.jsx("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.8",children:n.jsx("path",{d:"m12 3.6 2.6 5.2 5.7.8-4.1 4 1 5.7L12 16.5 6.8 19.3l1-5.7-4.1-4 5.7-.8Z"})})}function h9(){return n.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[n.jsx("path",{d:"M4 7.5h16"}),n.jsx("path",{d:"M6.4 7.5h11.2l-.9 10.2a2 2 0 0 1-2 1.8H9.3a2 2 0 0 1-2-1.8Z"}),n.jsx("path",{d:"M8 4.5h8a1.5 1.5 0 0 1 1.5 1.5v1.5h-11V6A1.5 1.5 0 0 1 8 4.5Z"}),n.jsx("path",{d:"M10 11.5h4"})]})}function Lj(e){return`workspace-management.summary.${e}`}function m9(e){return`git-sidebar.snapshot.${e}`}function p9(e,t){const r=(t==null?void 0:t.git.repoRoot)??e.repoRoot??null;return{workspaceId:e.id,name:e.name,path:e.path,git:{isRepository:(t==null?void 0:t.git.isRepository)??!!r,repoRoot:r,currentBranch:(t==null?void 0:t.git.currentBranch)??null,commitCount:(t==null?void 0:t.git.commitCount)??null,remotes:(t==null?void 0:t.git.remotes)??[],error:(t==null?void 0:t.git.error)??null},codeComposition:(t==null?void 0:t.codeComposition)??{scannedFileCount:0,truncated:!1,items:[],error:null}}}function f9(e){return e?e.git.isRepository||e.git.repoRoot!==null||e.git.currentBranch!==null||e.git.commitCount!==null||e.git.remotes.length>0||e.codeComposition.scannedFileCount>0||e.codeComposition.items.length>0||e.codeComposition.error!==null:!1}function g9(){var d;const{workspaceId:e=""}=Ao(),t=mr(),{navigationGroups:r,selectWorkspace:i}=Tr(),a=((d=r.find(m=>m.workspace.id===e))==null?void 0:d.workspace)??null;p.useEffect(()=>{e&&i(e)},[i,e]);const c=p.useMemo(()=>a?{id:a.id,path:a.path,name:a.name}:null,[a]),u=FR(c);return a?n.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:n.jsx(DR,{workspace:c,state:u,variant:"desktop-page",actions:n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>t(Ai(a.id)),children:o("shell.goBack")})})}):n.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:n.jsxs("div",{className:"workbench-empty-guide surface-card",children:[n.jsx("h1",{children:o("shell.workspaceDetailMissingTitle")}),n.jsx("p",{children:o("shell.workspaceDetailMissingBody")})]})})}function b9({isDesktop:e,viewportClass:t}){return e||t==="expanded"?"desktop":"mobile"}function w9(){const e=pr(),t=b9(e);return n.jsx(u2,{shellMode:t})}const v9=[{titleKey:"workbench.emptyResumeTitle",bodyKey:"workbench.emptyResumeBody"},{titleKey:"workbench.emptyNewTitle",bodyKey:"workbench.emptyNewBody"},{titleKey:"workbench.emptyCompanionTitle",bodyKey:"workbench.emptyCompanionBody"}];function y9(){return n.jsx("main",{className:"workbench-page conversation-page-shell",children:n.jsx("section",{className:"workbench-center-placeholder",children:n.jsxs("div",{className:"workbench-empty-guide surface-card",children:[n.jsx("p",{className:"workbench-empty-eyebrow",children:o("workbench.emptyEyebrow")}),n.jsx("div",{className:"workbench-empty-main",children:n.jsxs("div",{className:"workbench-empty-copy",children:[n.jsx("h1",{children:o("workbench.emptyTitle")}),n.jsx("p",{className:"workbench-empty-body",children:o("workbench.emptyBody")})]})}),n.jsx("ol",{className:"workbench-empty-steps",children:v9.map((e,t)=>n.jsxs("li",{className:"workbench-empty-step",children:[n.jsx("span",{className:"workbench-empty-step-index",children:t+1}),n.jsxs("div",{className:"workbench-empty-step-copy",children:[n.jsx("h2",{children:o(e.titleKey)}),n.jsx("p",{children:o(e.bodyKey)})]})]},e.titleKey))}),n.jsx("p",{className:"workbench-empty-tip",children:o("workbench.emptyTip")})]})})})}function k9(){const{shellMode:e}=Tr();return e==="mobile"?n.jsx(Al,{to:"/workspaces",replace:!0}):n.jsx(y9,{})}const Fj=2e4,x9=1e3,S9=5e3;function C9({isOpen:e,onClose:t}){const[r,i]=p.useState(null),[a,c]=p.useState(null),[u,d]=p.useState(!1),[m,f]=p.useState(!1),[w,g]=p.useState(null),v=p.useRef(null);if(p.useEffect(()=>{if(!e)return;let j=!1;async function N(){d(!0),g(null),c(null);try{const P=await Ue.request("/api/observability/runtime/session",{method:"POST",body:JSON.stringify({ttlMs:Fj})});if(j){await vg(P.sessionId);return}v.current=P.sessionId,i(P);const L=await _j(P.sessionId);if(j){await vg(P.sessionId);return}c(L)}catch(P){j||g(yg(P))}finally{j||d(!1)}}return N(),()=>{j=!0;const P=v.current;v.current=null,i(null),c(null),d(!1),f(!1),g(null),P&&vg(P)}},[e]),p.useEffect(()=>{const j=(r==null?void 0:r.sessionId)??null;if(!e||!j)return;const N=j;let P=!1;async function L(){f(!0);try{const H=await _j(N);P||(c(H),g(null))}catch(H){P||g(yg(H))}finally{P||f(!1)}}const Y=window.setInterval(()=>{L()},x9);return()=>{P=!0,window.clearInterval(Y)}},[e,r==null?void 0:r.sessionId]),p.useEffect(()=>{const j=(r==null?void 0:r.sessionId)??null;if(!e||!j)return;const N=j;let P=!1;async function L(){try{const H=await Ue.request(`/api/observability/runtime/session/${N}/heartbeat`,{method:"POST",body:JSON.stringify({ttlMs:Fj})});P||i(H)}catch(H){P||g(yg(H))}}const Y=window.setInterval(()=>{L()},S9);return()=>{P=!0,window.clearInterval(Y)}},[e,r==null?void 0:r.sessionId]),!e)return null;const y=Object.entries((a==null?void 0:a.backgroundTasks.taskTypes)??{}),x=Object.entries((a==null?void 0:a.schedulers.schedulers)??{}),C=Object.entries((a==null?void 0:a.backgroundTasks.totals)??{});return n.jsxs("div",{className:"workbench-modal-layer","aria-hidden":!e,children:[n.jsx("div",{className:"workbench-modal-backdrop",onClick:t,"aria-hidden":"true"}),n.jsxs("div",{className:"workbench-modal-card surface-card parallel-task-debug-modal-card",role:"dialog","aria-modal":"true","aria-labelledby":"parallel-task-debug-title",children:[n.jsxs("div",{className:"workbench-modal-header",children:[n.jsxs("div",{className:"workbench-modal-title-wrap",children:[n.jsx("h2",{id:"parallel-task-debug-title",children:o("settings.parallelTaskDebugModalTitle")}),n.jsx("p",{children:o("settings.parallelTaskDebugModalDescription")})]}),n.jsxs("div",{className:"workbench-modal-header-actions",children:[n.jsx("span",{className:"parallel-task-debug-status-chip","data-tone":w?"error":"active",children:o(w?"settings.parallelTaskDebugStatusError":"settings.parallelTaskDebugStatusActive")}),n.jsx("button",{className:"workbench-modal-close",onClick:t,type:"button","aria-label":o("settings.parallelTaskDebugClose"),children:"×"})]})]}),n.jsxs("div",{className:"workbench-modal-body parallel-task-debug-body",children:[n.jsxs("div",{className:"parallel-task-debug-meta-grid",children:[n.jsxs("div",{className:"parallel-task-debug-meta-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugObservedAt")}),n.jsx("strong",{children:kg(a==null?void 0:a.observedAt)})]}),n.jsxs("div",{className:"parallel-task-debug-meta-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugSessionExpireAt")}),n.jsx("strong",{children:kg(r==null?void 0:r.expiresAt)})]}),n.jsxs("div",{className:"parallel-task-debug-meta-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugSessionTtl")}),n.jsx("strong",{children:j9((r==null?void 0:r.ttlMs)??null)})]}),n.jsxs("div",{className:"parallel-task-debug-meta-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugCollectorState")}),n.jsx("strong",{children:a!=null&&a.eventLoop.enabled?o("settings.parallelTaskDebugCollectorEnabled"):o("settings.parallelTaskDebugCollectorDisabled")})]})]}),u?n.jsx("div",{className:"parallel-task-debug-empty",children:o("settings.parallelTaskDebugLoading")}):null,!u&&w?n.jsx("div",{className:"parallel-task-debug-error",children:w}):null,!u&&!w&&a?n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"parallel-task-debug-section",children:[n.jsxs("div",{className:"parallel-task-debug-section-header",children:[n.jsx("h3",{children:o("settings.parallelTaskDebugCountersTitle")}),n.jsx("span",{children:o(m?"common.loading":"settings.parallelTaskDebugAutoRefresh")})]}),n.jsx("div",{className:"parallel-task-debug-counter-grid",children:C.map(([j,N])=>n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:N9(j)}),n.jsx("strong",{children:N})]},j))})]}),n.jsxs("section",{className:"parallel-task-debug-section",children:[n.jsxs("div",{className:"parallel-task-debug-section-header",children:[n.jsx("h3",{children:o("settings.parallelTaskDebugTaskMetricsTitle")}),n.jsx("span",{children:y.length})]}),y.length>0?n.jsx("div",{className:"parallel-task-debug-grid",children:y.map(([j,N])=>n.jsxs("article",{className:"parallel-task-debug-panel",children:[n.jsxs("div",{className:"parallel-task-debug-panel-header",children:[n.jsx("strong",{children:j}),n.jsx("span",{children:Oj(N.executionLane)})]}),n.jsxs("div",{className:"parallel-task-debug-panel-body",children:[n.jsxs("span",{children:[o("settings.parallelTaskDebugWaitAvg"),": ",is(N.waitMs.avg)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugRunAvg"),": ",is(N.runMs.avg)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugRunMax"),": ",is(N.runMs.max)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugStartedCount"),": ",N.counters.started??0]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugFinishedCount"),": ",N.counters.finished??0]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugFailedCount"),": ",N.counters.failed??0]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugCacheHitCount"),": ",N.counters.cache_hit??0]})]})]},j))}):n.jsx("div",{className:"parallel-task-debug-empty",children:o("settings.parallelTaskDebugEmpty")})]}),n.jsxs("section",{className:"parallel-task-debug-section",children:[n.jsxs("div",{className:"parallel-task-debug-section-header",children:[n.jsx("h3",{children:o("settings.parallelTaskDebugSchedulerTitle")}),n.jsx("span",{children:x.length})]}),x.length>0?n.jsx("div",{className:"parallel-task-debug-grid",children:x.map(([j,N])=>n.jsxs("article",{className:"parallel-task-debug-panel",children:[n.jsxs("div",{className:"parallel-task-debug-panel-header",children:[n.jsx("strong",{children:j}),n.jsx("span",{children:N.lastIdle?o("settings.parallelTaskDebugIdle"):o("settings.parallelTaskDebugBusy")})]}),n.jsxs("div",{className:"parallel-task-debug-panel-body",children:[n.jsxs("span",{children:[o("settings.parallelTaskDebugTickTotal"),": ",N.tickTotal]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugIdleTickTotal"),": ",N.idleTickTotal]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugTaskCountTotal"),": ",N.taskCountTotal]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugSchedulerErrorTotal"),": ",N.errorTotal]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugLastDuration"),": ",is(N.lastDurationMs)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugNextDelay"),": ",is(N.nextDelayMs)]})]})]},j))}):n.jsx("div",{className:"parallel-task-debug-empty",children:o("settings.parallelTaskDebugEmpty")})]}),n.jsxs("section",{className:"parallel-task-debug-section",children:[n.jsxs("div",{className:"parallel-task-debug-section-header",children:[n.jsx("h3",{children:o("settings.parallelTaskDebugEventLoopTitle")}),n.jsx("span",{children:a.eventLoop.enabled?o("settings.parallelTaskDebugCollectorEnabled"):o("settings.parallelTaskDebugCollectorDisabled")})]}),n.jsxs("div",{className:"parallel-task-debug-counter-grid",children:[n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopResolution")}),n.jsx("strong",{children:is(a.eventLoop.resolutionMs)})]}),n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopMean")}),n.jsx("strong",{children:is(a.eventLoop.meanMs)})]}),n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopP95")}),n.jsx("strong",{children:is(a.eventLoop.p95Ms)})]}),n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopP99")}),n.jsx("strong",{children:is(a.eventLoop.p99Ms)})]}),n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopMax")}),n.jsx("strong",{children:is(a.eventLoop.maxMs)})]})]})]}),n.jsxs("section",{className:"parallel-task-debug-section",children:[n.jsxs("div",{className:"parallel-task-debug-section-header",children:[n.jsx("h3",{children:o("settings.parallelTaskDebugRecentActivitiesTitle")}),n.jsx("span",{children:a.recentTaskActivities.length})]}),a.recentTaskActivities.length>0?n.jsx("div",{className:"parallel-task-debug-activity-list",children:a.recentTaskActivities.map(j=>n.jsxs("article",{className:"parallel-task-debug-activity-item",children:[n.jsxs("div",{className:"parallel-task-debug-activity-main",children:[n.jsxs("div",{className:"parallel-task-debug-activity-title-row",children:[n.jsx("strong",{children:j.taskType}),n.jsx("span",{children:T9(j.eventType)}),n.jsx("span",{children:Oj(j.executionLane)})]}),n.jsxs("p",{children:[o("settings.parallelTaskDebugTaskKey"),": ",j.key]}),n.jsxs("p",{children:[o("settings.parallelTaskDebugStatus"),": ",j.status?P9(j.status):"-"]})]}),n.jsxs("div",{className:"parallel-task-debug-activity-meta",children:[n.jsx("span",{children:kg(j.recordedAt)}),n.jsxs("span",{children:[o("settings.parallelTaskDebugAttempt"),": ",j.attempt??"-"]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugWaitMs"),": ",is(j.waitMs)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugRunMs"),": ",is(j.runMs)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugSource"),": ",j.source??"-"]}),j.errorMessage?n.jsxs("span",{children:[o("settings.parallelTaskDebugError"),": ",j.errorMessage]}):null]})]},j.eventId))}):n.jsx("div",{className:"parallel-task-debug-empty",children:o("settings.parallelTaskDebugEmpty")})]})]}):null]})]})]})}async function _j(e){return await Ue.request(`/api/observability/runtime?sessionId=${encodeURIComponent(e)}`)}async function vg(e){try{await Ue.request(`/api/observability/runtime/session/${e}`,{method:"DELETE"})}catch{}}function yg(e){return e instanceof Error&&e.message?e.message:o("settings.parallelTaskDebugLoadFailed")}function kg(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function is(e){return e==null||Number.isNaN(e)?"-":`${Math.round(e*100)/100} ms`}function j9(e){return e===null||Number.isNaN(e)?"-":`${Math.round(e/1e3)} s`}function N9(e){switch(e){case"enqueue":return o("settings.parallelTaskDebugMetricEnqueue");case"dedupe":return o("settings.parallelTaskDebugMetricDedupe");case"started":return o("settings.parallelTaskDebugMetricStarted");case"finished":return o("settings.parallelTaskDebugMetricFinished");case"failed":return o("settings.parallelTaskDebugMetricFailed");case"cancelled":return o("settings.parallelTaskDebugMetricCancelled");case"timeout":return o("settings.parallelTaskDebugMetricTimeout");case"cache_hit":return o("settings.parallelTaskDebugMetricCacheHit");default:return e}}function Oj(e){switch(e){case"host_background":return o("settings.parallelTaskDebugLaneHostBackground");case"helper_process":return o("settings.parallelTaskDebugLaneHelperProcess");case"external_process":return o("settings.parallelTaskDebugLaneExternalProcess");default:return o("settings.parallelTaskDebugLaneRequestMainThread")}}function T9(e){switch(e){case"enqueued":return o("settings.parallelTaskDebugEventEnqueued");case"deduped":return o("settings.parallelTaskDebugEventDeduped");case"started":return o("settings.parallelTaskDebugEventStarted");case"finished":return o("settings.parallelTaskDebugEventFinished");case"failed":return o("settings.parallelTaskDebugEventFailed");case"cancelled":return o("settings.parallelTaskDebugEventCancelled");case"timeout":return o("settings.parallelTaskDebugEventTimeout");case"cache_hit":return o("settings.parallelTaskDebugEventCacheHit");default:return e}}function P9(e){switch(e){case"queued":return o("settings.parallelTaskDebugTaskStatusQueued");case"running":return o("settings.parallelTaskDebugTaskStatusRunning");case"succeeded":return o("settings.parallelTaskDebugTaskStatusSucceeded");case"failed":return o("settings.parallelTaskDebugTaskStatusFailed");case"cancelled":return o("settings.parallelTaskDebugTaskStatusCancelled");case"timeout":return o("settings.parallelTaskDebugTaskStatusTimeout");default:return e}}async function D9(){const e=$s(),t=In.getState(),r=await e.bridge.checkForUpdate(t.releaseChannel);if(!r.ok||!r.value)throw new Error(r.detail??"更新检查失败。");return r.value}async function R9(e){return $s().bridge.installUpdate(e)}async function M9(){return $s().bridge.rollbackToPreviousVersion()}function _R(){const e=$s(),t=e.isDesktop,[r,i]=p.useState(!1),[a,c]=p.useState(!1),[u,d]=p.useState(!1),[m,f]=p.useState(null),[w,g]=p.useState(null),[v,y]=p.useState(null),[x,C]=p.useState(!1);async function j(){var W,I;i(!0),f(null);try{const M=await D9();y(M.manifest),g(M.currentVersion),C(M.hasUpdate),f(A9(M.manifest,M.hasUpdate)),M.hasUpdate&&await e.bridge.showNotification(o("settings.releaseUpdateReady"),((W=M.manifest)==null?void 0:W.tagName)??((I=M.manifest)==null?void 0:I.version)??"-")}catch(M){f(M instanceof Error?M.message:o("settings.releaseCheckFailed"))}finally{i(!1)}}async function N(){if(!(!(v!=null&&v.packageUrl)||!v.signature)){c(!0),f(null);try{const W=await R9(v);if(!W.ok){f(W.detail??o("settings.releaseInstallFailed"));return}f(o("settings.releaseInstallStarted")),await e.bridge.showNotification(o("settings.releaseInstallStarted"),v.version)}catch(W){f(W instanceof Error?W.message:o("settings.releaseInstallFailed"))}finally{c(!1)}}}async function P(){c(!0),f(null);try{const W=await M9();f(W.ok?o("settings.releaseRollbackStarted"):W.detail??o("settings.releaseRollbackFailed")),W.ok&&await e.bridge.showNotification(o("settings.releaseRollbackStarted"),w??o("settings.releaseUnknownVersion"))}catch(W){f(W instanceof Error?W.message:o("settings.releaseRollbackFailed"))}finally{c(!1)}}async function L(){if(v!=null&&v.htmlUrl){d(!0);try{const W=await e.bridge.openExternal(v.htmlUrl);W.ok||f(W.detail??o("settings.releasePageOpenFailed"))}catch(W){f(W instanceof Error?W.message:o("settings.releasePageOpenFailed"))}finally{d(!1)}}}const Y=!!(t&&(v!=null&&v.packageUrl)&&v.signature&&x),H=m??(t?null:o("settings.clientUpdateUnsupported"));return n.jsxs("div",{className:"settings-release-card",children:[n.jsxs("div",{className:"settings-release-meta",children:[n.jsxs("span",{children:[o("settings.releaseCurrentVersion"),": ",w??o("settings.releaseUnknownVersion")]}),n.jsxs("span",{children:[o("settings.releaseTargetVersion"),": ",(v==null?void 0:v.version)??"-"]}),n.jsxs("span",{children:[o("settings.releaseTargetTag"),": ",(v==null?void 0:v.tagName)??"-"]}),n.jsxs("span",{children:[o("settings.releasePublishedAt"),": ",E9(v==null?void 0:v.publishedAt)]})]}),v?n.jsxs("div",{className:"settings-release-notes",children:[n.jsx("strong",{children:o("settings.releaseNotes")}),v.title&&v.title!==v.tagName?n.jsx("p",{className:"settings-release-title",children:v.title}):null,v.notes?n.jsx("div",{className:"settings-release-markdown",children:n.jsx(Pw,{remarkPlugins:[Aw],children:v.notes})}):n.jsx("p",{children:o("settings.releaseNotesEmpty")})]}):null,H?n.jsx("p",{className:"settings-release-status",children:H}):null,n.jsxs("div",{className:"settings-release-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",disabled:!t||r||a,onClick:j,children:o(r?"common.loading":"settings.releaseCheckNow")}),n.jsx("button",{className:"primary-button",type:"button",disabled:!Y||a,onClick:N,children:o(a?"common.loading":"settings.releaseInstallNow")}),n.jsx("button",{className:"secondary-button",type:"button",disabled:!(v!=null&&v.htmlUrl)||r||a||u,onClick:L,children:o(u?"common.loading":"settings.releaseOpenPage")}),n.jsx("button",{className:"secondary-button",type:"button",disabled:!t||a,onClick:P,children:o("settings.releaseRollback")})]})]})}function A9(e,t){return t?e!=null&&e.packageUrl?e.signature?o("settings.releaseUpdateReady"):o("settings.releaseSignatureMissing"):o("settings.releaseInstallerMissing"):o("settings.releaseUpToDate")}function E9(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}async function I9(){const e=In.getState();return Ue.request(`/api/client/service-update?channel=${encodeURIComponent(e.releaseChannel)}`)}function OR(){const e=$s(),[t,r]=p.useState(!1),[i,a]=p.useState(!1),[c,u]=p.useState(null),[d,m]=p.useState(null);async function f(){r(!0),u(null);try{const g=await I9();m(g),u(L9(g)),g.hasUpdate&&await e.bridge.showNotification(o("settings.serverUpdateReady"),`${o("settings.serverTargetVersion")}: ${g.latestVersion??"-"}`)}catch(g){u(g instanceof Error?g.message:o("settings.serverCheckFailed"))}finally{r(!1)}}async function w(){if(d!=null&&d.packagePageUrl){a(!0);try{const g=await e.bridge.openExternal(d.packagePageUrl);g.ok||u(g.detail??o("settings.serverOpenPageFailed"))}catch(g){u(g instanceof Error?g.message:o("settings.serverOpenPageFailed"))}finally{a(!1)}}}return n.jsxs("div",{className:"settings-release-card",children:[n.jsxs("div",{className:"settings-release-meta",children:[n.jsxs("span",{children:[o("settings.serverCurrentVersion"),": ",(d==null?void 0:d.currentVersion)??"-"]}),n.jsxs("span",{children:[o("settings.serverTargetVersion"),": ",(d==null?void 0:d.latestVersion)??o("settings.serverLatestUnknown")]}),n.jsxs("span",{children:[o("settings.serverPackageName"),": ",(d==null?void 0:d.packageName)??"-"]})]}),d?n.jsxs("div",{className:"settings-release-notes",children:[n.jsx("strong",{children:o("settings.serverUpdateCommand")}),n.jsx("p",{className:"settings-release-command",children:d.updateCommand})]}):null,c?n.jsx("p",{className:"settings-release-status",children:c}):null,n.jsxs("div",{className:"settings-release-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",disabled:t,onClick:f,children:o(t?"common.loading":"settings.serverCheckNow")}),n.jsx("button",{className:"secondary-button",type:"button",disabled:!(d!=null&&d.packagePageUrl)||t||i,onClick:w,children:o(i?"common.loading":"settings.serverOpenPage")})]})]})}function L9(e){return e.latestVersion?e.hasUpdate?o("settings.serverUpdateReady"):o("settings.serverUpToDate"):o("settings.serverLatestUnknown")}async function Bj(){return await Ue.request("/api/skills/overview")}async function F9(e){await Ue.request("/api/skills/import",{method:"POST",body:JSON.stringify(e)})}async function _9(e){await Ue.request("/api/skills/sync",{method:"POST",body:JSON.stringify(e)})}function BR(){const e=im(P=>{var L;return((L=P.session)==null?void 0:L.accessToken)??null}),[t,r]=p.useState(null),[i,a]=p.useState(!0),[c,u]=p.useState(null),[d,m]=p.useState(null),[f,w]=p.useState(null),[g,v]=p.useState(!1);p.useEffect(()=>{let P=!0;if(!e){r(null),m(null),w(null),a(!1);return}return(async()=>{a(!0);try{const Y=await Bj();if(!P)return;r(Y),m(null)}catch(Y){if(!P)return;m(lh(Y))}finally{P&&a(!1)}})(),()=>{P=!1}},[e]);async function y(){const P=await Bj();r(P),m(null)}async function x(){if(e){u("refresh"),m(null),w(null);try{await y(),w(o("settings.skillRefreshSuccess"))}catch(P){m(lh(P))}finally{u(null)}}}async function C(P){if(e){u(Wj(P)),m(null),w(null);try{await F9({targetCli:P.targetCli,directoryPath:P.directoryPath,expectedContentHash:P.contentHash}),await y(),w(o("settings.skillImportSuccess",{name:P.name,target:Cc(P.targetCli)}))}catch(L){m(lh(L))}finally{u(null)}}}async function j(P){if(!e)return;const L=P.bindings.filter(Y=>Y.enabled).map(Y=>Y.targetCli);if(L.length===0){m(o("settings.skillSyncTargetMissing"));return}u(Uj(P.skill.id)),m(null),w(null);try{await _9({skillId:P.skill.id,targetCli:L}),await y(),w(o("settings.skillSyncSuccess",{name:P.skill.name}))}catch(Y){m(lh(Y))}finally{u(null)}}const N=(t==null?void 0:t.summary)??{managedSkillCount:0,managedEntryCount:0,unmanagedEntryCount:0,conflictedEntryCount:0,diagnosticCount:0};return n.jsxs("div",{className:"settings-skill-panel",children:[n.jsxs("div",{className:"settings-release-card",children:[n.jsxs("div",{className:"settings-skill-summary-grid",children:[n.jsx(Sc,{label:o("settings.skillSummaryManagedSkills"),value:String(N.managedSkillCount)}),n.jsx(Sc,{label:o("settings.skillSummaryManagedEntries"),value:String(N.managedEntryCount)}),n.jsx(Sc,{label:o("settings.skillSummaryUnmanagedEntries"),value:String(N.unmanagedEntryCount)}),n.jsx(Sc,{label:o("settings.skillSummaryConflictedEntries"),value:String(N.conflictedEntryCount)}),n.jsx(Sc,{label:o("settings.skillSummaryDiagnostics"),value:String(N.diagnosticCount)})]}),n.jsx("div",{className:"settings-release-actions",children:n.jsx("button",{className:"secondary-button",type:"button",disabled:!e,onClick:()=>{v(!0)},children:o("settings.skillManageAction")})})]}),n.jsxs(Ln,{open:g,title:o("settings.skillConfigModalTitle"),description:o("settings.skillConfigModalDescription"),className:"settings-skill-modal",headerActions:n.jsx("button",{className:"secondary-button",type:"button",disabled:!e||i||c!==null,onClick:()=>{x()},children:o(c==="refresh"?"common.loading":"settings.skillRefresh")}),onClose:()=>v(!1),children:[n.jsx("div",{className:"settings-release-meta",children:n.jsxs("span",{children:[o("settings.skillScannedAt"),": ",i?o("common.loading"):B9(t==null?void 0:t.scannedAt)]})}),f?n.jsx("p",{className:"settings-release-status",children:f}):null,d?n.jsx("p",{className:"settings-release-status",children:d}):null,n.jsx(oh,{title:o("settings.skillManagedListTitle"),emptyText:o("settings.skillManagedEmpty"),items:(t==null?void 0:t.managedSkills)??[],renderItem:P=>{const L=Uj(P.skill.id);return n.jsxs("div",{className:"settings-skill-entry",children:[n.jsxs("div",{className:"settings-skill-entry-main",children:[n.jsx("strong",{className:"settings-skill-entry-title",children:P.skill.name}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillDirectoryName"),": ",P.skill.directoryName]}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillSsotPath"),": ",n.jsx("span",{className:"settings-skill-path",children:P.ssotPath})]}),n.jsx("div",{className:"settings-skill-tags",children:P.bindings.map(Y=>n.jsxs("span",{className:"settings-skill-tag","data-status":Y.syncStatus,children:[Cc(Y.targetCli)," · ",O9(Y.syncStatus)]},`${P.skill.id}-${Y.targetCli}`))})]}),n.jsx("div",{className:"settings-skill-entry-actions",children:n.jsx("button",{className:"secondary-button",type:"button",disabled:i||c!==null,onClick:()=>{j(P)},children:o(c===L?"common.loading":"settings.skillSyncAction")})})]},P.skill.id)}}),n.jsx(oh,{title:o("settings.skillUnmanagedListTitle"),emptyText:o("settings.skillUnmanagedEmpty"),items:(t==null?void 0:t.unmanagedEntries)??[],renderItem:P=>{const L=Wj(P);return n.jsxs("div",{className:"settings-skill-entry",children:[n.jsxs("div",{className:"settings-skill-entry-main",children:[n.jsx("strong",{className:"settings-skill-entry-title",children:P.name}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillSourceCli"),": ",Cc(P.targetCli)]}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillDirectoryPath"),": ",n.jsx("span",{className:"settings-skill-path",children:P.directoryPath})]})]}),n.jsx("div",{className:"settings-skill-entry-actions",children:n.jsx("button",{className:"secondary-button",type:"button",disabled:i||c!==null,onClick:()=>{C(P)},children:o(c===L?"common.loading":"settings.skillImportAction")})})]},`${P.targetCli}:${P.directoryPath}`)}}),n.jsx(oh,{title:o("settings.skillConflictedListTitle"),emptyText:o("settings.skillConflictedEmpty"),items:(t==null?void 0:t.conflictedEntries)??[],renderItem:P=>n.jsx("div",{className:"settings-skill-entry",children:n.jsxs("div",{className:"settings-skill-entry-main",children:[n.jsx("strong",{className:"settings-skill-entry-title",children:P.name}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillSourceCli"),": ",Cc(P.targetCli)]}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillDirectoryPath"),": ",n.jsx("span",{className:"settings-skill-path",children:P.directoryPath})]})]})},`${P.targetCli}:${P.directoryPath}`)}),n.jsx(oh,{title:o("settings.skillDiagnosticsTitle"),emptyText:o("settings.skillDiagnosticsEmpty"),items:(t==null?void 0:t.diagnostics)??[],renderItem:P=>n.jsx("div",{className:"settings-skill-entry",children:n.jsxs("div",{className:"settings-skill-entry-main",children:[n.jsxs("strong",{className:"settings-skill-entry-title",children:[Cc(P.targetCli)," · ",P.code]}),n.jsx("p",{className:"settings-skill-entry-meta",children:P.detail}),n.jsxs("p",{className:"settings-skill-entry-meta",children:[o("settings.skillDirectoryPath"),":"," ",n.jsx("span",{className:"settings-skill-path",children:P.directoryPath??P.rootDir})]})]})},`${P.targetCli}:${P.code}:${P.directoryPath??P.rootDir}`)})]})]})}function oh({title:e,emptyText:t,items:r,renderItem:i}){return n.jsxs("section",{className:"settings-skill-section",children:[n.jsx("h3",{className:"settings-skill-section-title",children:e}),r.length>0?n.jsx("div",{className:"settings-skill-entry-list",children:r.map(a=>i(a))}):n.jsx("div",{className:"settings-skill-empty",children:t})]})}function Sc({label:e,value:t}){return n.jsxs("div",{className:"settings-skill-summary-card",children:[n.jsx("span",{children:e}),n.jsx("strong",{children:t})]})}function Wj(e){return`import:${e.targetCli}:${e.directoryPath}`}function Uj(e){return`sync:${e}`}function lh(e){return e instanceof Kr?e.message||o("settings.skillLoadFailed"):e instanceof Error?e.message:o("settings.skillLoadFailed")}function Cc(e){switch(e){case"claude-code":return o("settings.skillTargetClaudeCode");case"gemini":return o("settings.skillTargetGemini");case"opencode":return o("settings.skillTargetOpenCode");default:return o("settings.skillTargetCodex")}}function O9(e){switch(e){case"conflicted":return o("settings.skillBindingConflicted");case"failed":return o("settings.skillBindingFailed");case"pending":return o("settings.skillBindingPending");default:return o("settings.skillBindingSynced")}}function B9(e){if(!e)return"-";const t=Date.parse(e);return Number.isNaN(t)?e:new Date(t).toLocaleString()}async function Hj(){return await Ue.request("/api/system/tailscale/status")}async function W9(e){return await Ue.request("/api/system/tailscale/config",{method:"PUT",body:JSON.stringify(e)})}async function U9(){return await Ue.request("/api/system/tailscale/enable",{method:"POST"})}async function H9(){return await Ue.request("/api/system/tailscale/disable",{method:"POST"})}async function z9(){return await Ue.request("/api/system/tailscale/login",{method:"POST"})}async function q9(){return await Ue.request("/api/system/tailscale/logout",{method:"POST"})}function WR(){const e=pr(),[t,r]=p.useState(null),[i,a]=p.useState(""),[c,u]=p.useState(""),[d,m]=p.useState(!0),[f,w]=p.useState(null),[g,v]=p.useState(null),[y,x]=p.useState(!1),[C,j]=p.useState(!1),N=p.useRef(!0),P=p.useRef(!1),L=p.useRef(async()=>{});P.current=C;function Y(R){r(R),a(R.controlServerUrl??""),u(R.hostname??""),v(null),P.current&&!qj(R.lastError)&&j(!1)}L.current=async R=>{R||m(!0);try{const A=await Hj();if(!N.current)return;Y(A)}catch(A){if(!N.current)return;v(uh(A))}finally{N.current&&!R&&m(!1)}},p.useEffect(()=>{N.current=!0,L.current(!1);const R=window.setInterval(()=>{L.current(!0)},5e3);return()=>{N.current=!1,window.clearInterval(R)}},[]),p.useEffect(()=>{if(!C)return;function R(){L.current(!0)}function A(){document.visibilityState==="visible"&&L.current(!0)}return window.addEventListener("focus",R),document.addEventListener("visibilitychange",A),()=>{window.removeEventListener("focus",R),document.removeEventListener("visibilitychange",A)}},[C]);const H=((t==null?void 0:t.controlServerUrl)??"")!==i.trim()||((t==null?void 0:t.hostname)??"")!==c.trim(),W=qj(t==null?void 0:t.lastError),I=G9(e.ui.osFamily)&&W;async function M(){const R=await W9({controlServerUrl:zj(i),hostname:zj(c)});return Y(R),R}async function O(R){w(R),v(null);try{H&&R!=="disable"&&R!=="logout"&&await M();const A=R==="enable"?await U9():R==="disable"?await H9():R==="login"?await z9():await q9();r(A),a(A.controlServerUrl??""),u(A.hostname??"")}catch(A){v(uh(A))}finally{w(null)}}async function F(){w("save"),v(null);try{const R=await M();r(R),x(!1)}catch(R){v(uh(R))}finally{w(null)}}async function X(){w("refresh"),v(null);try{const R=await Hj();Y(R)}catch(R){v(uh(R))}finally{w(null),m(!1)}}async function U(){const R=K9(e.ui.osFamily);if(R){w("install"),v(null);try{const A=await e.bridge.openExternal(R);if(!A.ok){v(A.detail??o("settings.tailscaleInstallOpenFailed"));return}j(!0)}catch(A){v(A instanceof Error?A.message:o("settings.tailscaleInstallOpenFailed"))}finally{w(null)}}}function G(){f!=="save"&&x(!1)}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"settings-tailscale-panel",children:n.jsxs("div",{className:"settings-release-card",children:[n.jsx("div",{className:"settings-tailscale-overview",children:n.jsxs("div",{className:"settings-tailscale-summary",children:[n.jsx(ch,{label:o("settings.tailscaleStatusIndicator"),value:n.jsxs("span",{className:"settings-tailscale-status-indicator","data-tone":Y9((t==null?void 0:t.phase)??"disabled"),children:[n.jsx("span",{className:"settings-tailscale-status-dot","aria-hidden":"true"}),V9((t==null?void 0:t.phase)??"disabled")]})}),n.jsx(ch,{label:o("settings.tailscaleServerAddress"),value:(t==null?void 0:t.reachableBaseUrl)??o("settings.tailscaleUnavailable"),href:(t==null?void 0:t.reachableBaseUrl)??void 0}),n.jsx(ch,{label:o("settings.tailscaleAccountName"),value:(t==null?void 0:t.accountName)??o("settings.tailscaleUnavailable")}),n.jsx(ch,{label:o("settings.tailscaleIpAddress"),value:$9(t)})]})}),(t==null?void 0:t.phase)==="needs_login"&&t.loginUrl?n.jsx("div",{className:"settings-release-notes",children:n.jsx("p",{className:"settings-tailscale-login-url",children:n.jsx("a",{className:"settings-tailscale-link",href:t.loginUrl,rel:"noreferrer",target:"_blank",children:t.loginUrl})})}):null,t!=null&&t.lastError||g?n.jsx("p",{className:"settings-release-status",children:g??(t==null?void 0:t.lastError)}):null,n.jsxs("div",{className:"settings-release-actions",children:[I?n.jsx("button",{className:"settings-button",type:"button",disabled:d||f!==null,onClick:()=>{U()},children:o(f==="install"?"common.loading":"settings.tailscaleInstallAction")}):null,n.jsx("button",{className:"secondary-button",type:"button",disabled:d||f!==null,onClick:()=>x(!0),children:o("settings.tailscaleConfigure")}),n.jsx("button",{className:"secondary-button",type:"button",disabled:d||f!==null,onClick:()=>{X()},children:o(f==="refresh"?"common.loading":"settings.tailscaleRefresh")}),t!=null&&t.enabled?n.jsx("button",{className:"secondary-button",type:"button",disabled:d||f!==null||W,onClick:()=>{O("disable")},children:o(f==="disable"?"common.loading":"settings.tailscaleDisable")}):n.jsx("button",{className:"secondary-button",type:"button",disabled:d||f!==null||W,onClick:()=>{O("enable")},children:o(f==="enable"?"common.loading":"settings.tailscaleEnable")}),n.jsx("button",{className:"secondary-button",type:"button",disabled:d||f!==null||!(t!=null&&t.enabled)||W,onClick:()=>{O("login")},children:o(f==="login"?"common.loading":"settings.tailscaleLogin")}),n.jsx("button",{className:"secondary-button",type:"button",disabled:d||f!==null||!(t!=null&&t.enabled)||W,onClick:()=>{O("logout")},children:o(f==="logout"?"common.loading":"settings.tailscaleLogout")})]})]})}),n.jsx(Ln,{open:y,title:o("settings.tailscaleConfigModalTitle"),description:o("settings.tailscaleConfigModalDescription"),className:"settings-tailscale-modal",onClose:G,children:n.jsxs("div",{className:"settings-tailscale-modal-body",children:[n.jsxs("div",{className:"settings-tailscale-form",children:[n.jsxs("label",{className:"settings-tailscale-field",children:[n.jsx("span",{className:"settings-tailscale-field-label",children:o("settings.tailscaleControlServer")}),n.jsx("input",{"aria-label":o("settings.tailscaleControlServer"),className:"settings-text-input",placeholder:o("settings.tailscaleControlServerPlaceholder"),value:i,onChange:R=>a(R.target.value)})]}),n.jsxs("label",{className:"settings-tailscale-field",children:[n.jsx("span",{className:"settings-tailscale-field-label",children:o("settings.tailscaleHostname")}),n.jsx("input",{"aria-label":o("settings.tailscaleHostname"),className:"settings-text-input",placeholder:o("settings.tailscaleHostnamePlaceholder"),value:c,onChange:R=>u(R.target.value)})]})]}),n.jsxs("div",{className:"settings-tailscale-modal-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",disabled:f==="save",onClick:G,children:o("common.cancel")}),n.jsx("button",{className:"settings-button",type:"button",disabled:f!==null||!H,onClick:()=>{F()},children:o(f==="save"?"common.loading":"common.save")})]})]})})]})}function ch({label:e,value:t,href:r}){return n.jsxs("div",{className:"settings-tailscale-summary-row",children:[n.jsx("span",{className:"settings-tailscale-summary-label",children:e}),n.jsx("span",{className:"settings-tailscale-summary-value",children:r&&typeof t=="string"?n.jsx("a",{className:"settings-tailscale-link",href:r,target:"_blank",rel:"noreferrer",children:t}):t})]})}function zj(e){const t=e.trim();return t.length>0?t:null}function uh(e){return e instanceof Kr||e instanceof Error?e.message:o("settings.tailscaleLoadFailed")}function $9(e){if(!e)return o("settings.tailscaleUnavailable");const t=[e.tailnetIpv4,e.tailnetIpv6].filter(r=>!!r);return t.length>0?t.join(" / "):o("settings.tailscaleUnavailable")}function V9(e){switch(e){case"blocked_uninitialized":return o("settings.tailscalePhaseBlockedUninitialized");case"starting":return o("settings.tailscalePhaseStarting");case"needs_login":return o("settings.tailscalePhaseNeedsLogin");case"running":return o("settings.tailscalePhaseRunning");case"stopping":return o("settings.tailscalePhaseStopping");case"error":return o("settings.tailscalePhaseError");case"disabled":default:return o("settings.tailscalePhaseDisabled")}}function qj(e){return e?e.includes("Tailscale CLI"):!1}function G9(e){return e==="macos"||e==="windows"}function K9(e){switch(e){case"macos":return"https://tailscale.com/download/mac";case"windows":return"https://tailscale.com/download/windows";default:return null}}function Y9(e){switch(e){case"running":return"green";case"starting":case"needs_login":case"error":return"yellow";case"disabled":case"blocked_uninitialized":case"stopping":default:return"gray"}}function $j({title:e,description:t,actions:r,content:i,className:a}){return n.jsx(E0,{className:a,children:n.jsxs("section",{className:"mobile-workspace-home-header mobile-page-header",children:[n.jsx("h1",{className:"mobile-workspace-switcher-heading",children:e}),n.jsxs("div",{className:"mobile-workspace-home-toolbar-top mobile-page-header-main",children:[n.jsx("div",{className:"mobile-page-header-copy",children:n.jsx("div",{className:"mobile-workspace-home-switcher mobile-page-header-static-title",children:n.jsx("span",{className:"mobile-workspace-home-switcher-label",children:e})})}),r?n.jsx("div",{className:"mobile-workspace-home-toolbar-actions mobile-page-header-actions",children:r}):null]}),t?n.jsx("p",{className:"mobile-workspace-home-path mobile-page-header-description",children:t}):null,i?n.jsx("div",{className:"mobile-page-header-content",children:i}):null]})})}function X9(e){return e==="appearance"||e==="server-connection"||e==="remote-access"||e==="skills"||e==="security-privacy"||e==="software-update"}function Q9(e){return o(e==="en-US"?"locale.enUS":"locale.zhCN")}function J9(e){return o(e==="beta"?"settings.releaseBeta":"settings.releaseStable")}function Z9(e){switch(e){case"acceptEdits":return o("settings.permissionModeAcceptEdits");case"bypassPermissions":return o("settings.permissionModeBypassPermissions");default:return o("settings.permissionModeDefault")}}function eK(){const e=mr(),{theme:t,setTheme:r}=KN(),i=rm(D=>D),a=Ng(D=>D.profile.language),c=Ng(D=>D.profile.defaultPermissionMode),u=us(D=>D.sessionDisplaySortMode),d=us(D=>D.showSystemFiles),m=us(D=>D.notificationPreferences.notifyOnPermissionRequest),f=us(D=>D.notificationPreferences.notifyOnSessionCompleted),w=us(D=>D.notificationPreferences.notifyOnSessionFailed),g={language:a,defaultPermissionMode:c},v=pr(),y=Sb(i.platform),x=y,C=kb(i)??"",[j,N]=p.useState(C);p.useEffect(()=>{N(C)},[C]);function P(){hr.clear(),Ts.resetToLocalFallback(),e("/login",{replace:!0})}function L(D){r(D)}function Y(D){try{return Ps(D)}catch{return null}}const H=Y(j),W=H!==null&&H!==C;function I(D){D.preventDefault(),H&&In.update({hosts:i.hosts.map(T=>T.id===i.activeHostId?{...T,baseUrl:H,updatedAt:new Date().toISOString()}:T)})}const M=[{value:"default",label:o("settings.permissionModeDefault")},{value:"acceptEdits",label:o("settings.permissionModeAcceptEdits")},{value:"bypassPermissions",label:o("settings.permissionModeBypassPermissions")}],O=[{value:"createdAt",label:o("settings.sessionSortModeCreatedAt")},{value:"updatedAt",label:o("settings.sessionSortModeUpdatedAt")},{value:"title",label:o("settings.sessionSortModeTitle")}];function F(D){In.update({releaseChannel:D==="beta"?"beta":"stable"})}function X(D){In.update({autoReconnect:D})}function U(D){In.update({autoCheckUpdate:D})}function G(D){const T=D==="acceptEdits"||D==="bypassPermissions"?D:"default";Ts.updateProfile({defaultPermissionMode:T}).catch(()=>{})}function R(D){const T=D==="updatedAt"||D==="title"?D:"createdAt";wo.setSessionDisplaySortMode(T)}function A(D){wo.setShowSystemFiles(D)}function Z(D){wo.setNotificationPreferences({notifyOnPermissionRequest:D})}function pe(D){wo.setNotificationPreferences({notifyOnSessionCompleted:D})}function q(D){wo.setNotificationPreferences({notifyOnSessionFailed:D})}return{platform:v,theme:t,applyTheme:L,runtimeConfig:i,accountPreferences:g,sessionDisplaySortMode:u,showSystemFiles:d,notifyOnPermissionRequest:m,notifyOnSessionCompleted:f,notifyOnSessionFailed:w,showServerSettings:x,canConfigureServerAddress:y,hostBaseUrlDraft:j,setHostBaseUrlDraft:N,canSaveHostBaseUrl:W,permissionModeOptions:M,sessionDisplaySortModeOptions:O,handleHostBaseUrlSubmit:I,handleLogout:P,updateReleaseChannel:F,updateAutoReconnect:X,updateAutoCheckUpdate:U,updateDefaultPermissionMode:G,updateSessionDisplaySortMode:R,updateShowSystemFiles:A,updateNotifyOnPermissionRequest:Z,updateNotifyOnSessionCompleted:pe,updateNotifyOnSessionFailed:q}}function Vj(){const e=eK(),t=QN();return e.platform.isMobile?n.jsx(nK,{model:e,appVersion:t}):n.jsx(tK,{model:e,appVersion:t})}function tK({model:e,appVersion:t}){const[r,i]=p.useState(!1),{theme:a,applyTheme:c,runtimeConfig:u,accountPreferences:d,sessionDisplaySortMode:m,showSystemFiles:f,notifyOnPermissionRequest:w,notifyOnSessionCompleted:g,notifyOnSessionFailed:v,showServerSettings:y,hostBaseUrlDraft:x,setHostBaseUrlDraft:C,canSaveHostBaseUrl:j,permissionModeOptions:N,sessionDisplaySortModeOptions:P,platform:L,handleHostBaseUrlSubmit:Y,handleLogout:H,updateReleaseChannel:W,updateAutoReconnect:I,updateAutoCheckUpdate:M,updateDefaultPermissionMode:O,updateSessionDisplaySortMode:F,updateShowSystemFiles:X,updateNotifyOnPermissionRequest:U,updateNotifyOnSessionCompleted:G,updateNotifyOnSessionFailed:R}=e;return n.jsxs("div",{className:"settings-page",children:[n.jsxs("div",{className:"settings-container",children:[n.jsx("h1",{className:"settings-title",children:o("settings.title")}),n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.appearance")}),n.jsxs("div",{className:"settings-card",children:[n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.language")}),n.jsx("span",{className:"settings-row-description",children:o("settings.languageDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx(Lb,{})})]}),n.jsxs("div",{className:"settings-row settings-row-theme",children:[n.jsx("div",{className:"settings-row-label",children:n.jsx("span",{className:"settings-row-title",children:o("settings.theme")})}),n.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:n.jsx("div",{className:"theme-selector",children:VN.map(A=>n.jsxs("button",{type:"button",className:`theme-card ${a===A.id?"active":""}`,"aria-pressed":a===A.id,onClick:()=>c(A.id),children:[n.jsx("span",{className:"theme-preview",style:{background:A.color}}),n.jsx("span",{className:"theme-label",children:GN(A)}),a===A.id?n.jsx("span",{className:"theme-check",children:"✓"}):null]},A.id))})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.workspaceSessionSortMode")}),n.jsx("span",{className:"settings-row-description",children:o("settings.workspaceSessionSortModeDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx("select",{"aria-label":o("settings.workspaceSessionSortMode"),className:"settings-select",value:m,onChange:A=>F(A.target.value),children:P.map(A=>n.jsx("option",{value:A.value,children:A.label},A.value))})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.showSystemFiles")}),n.jsx("span",{className:"settings-row-description",children:o("settings.showSystemFilesDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsxs("label",{className:"settings-checkbox",children:[n.jsx("input",{type:"checkbox","aria-label":o("settings.showSystemFiles"),checked:f,onChange:A=>X(A.target.checked)}),n.jsx("span",{children:o(f?"settings.enabled":"settings.disabled")})]})})]})]})]}),y?n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.serverConnection")}),n.jsxs("div",{className:"settings-card",children:[n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.serverAddress")}),n.jsx("span",{className:"settings-row-description",children:o("settings.serverDescription")})]}),n.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:n.jsxs("form",{className:"settings-inline-form",onSubmit:Y,children:[n.jsx("input",{"aria-label":o("settings.serverAddress"),className:"settings-text-input",value:x,onChange:A=>C(A.target.value)}),n.jsx("button",{className:"settings-button",disabled:!j,type:"submit",children:o("common.save")})]})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.autoReconnect")}),n.jsx("span",{className:"settings-row-description",children:o("settings.autoReconnectDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsxs("label",{className:"settings-checkbox",children:[n.jsx("input",{type:"checkbox",checked:u.autoReconnect,onChange:A=>I(A.target.checked)}),n.jsx("span",{children:u.autoReconnect?o("settings.enabled"):o("settings.disabled")})]})})]})]})]}):null,n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.remoteAccess")}),n.jsx("div",{className:"settings-card",children:n.jsx("div",{className:"settings-row",children:n.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:n.jsx(WR,{})})})})]}),n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.skills")}),n.jsx("div",{className:"settings-card",children:n.jsx("div",{className:"settings-row",children:n.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:n.jsx(BR,{})})})})]}),n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.securityPrivacy")}),n.jsxs("div",{className:"settings-card",children:[n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.defaultPermissionMode")}),n.jsx("span",{className:"settings-row-description",children:o("settings.defaultPermissionModeDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx("select",{"aria-label":o("settings.defaultPermissionMode"),className:"settings-select",value:d.defaultPermissionMode,onChange:A=>O(A.target.value),children:N.map(A=>n.jsx("option",{value:A.value,children:A.label},A.value))})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.notifyOnPermissionRequest")}),n.jsx("span",{className:"settings-row-description",children:o("settings.notifyOnPermissionRequestDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsxs("label",{className:"settings-checkbox",children:[n.jsx("input",{type:"checkbox","aria-label":o("settings.notifyOnPermissionRequest"),checked:w,onChange:A=>U(A.target.checked)}),n.jsx("span",{children:o(w?"settings.enabled":"settings.disabled")})]})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.notifyOnSessionCompleted")}),n.jsx("span",{className:"settings-row-description",children:o("settings.notifyOnSessionCompletedDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsxs("label",{className:"settings-checkbox",children:[n.jsx("input",{type:"checkbox","aria-label":o("settings.notifyOnSessionCompleted"),checked:g,onChange:A=>G(A.target.checked)}),n.jsx("span",{children:o(g?"settings.enabled":"settings.disabled")})]})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.notifyOnSessionFailed")}),n.jsx("span",{className:"settings-row-description",children:o("settings.notifyOnSessionFailedDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsxs("label",{className:"settings-checkbox",children:[n.jsx("input",{type:"checkbox","aria-label":o("settings.notifyOnSessionFailed"),checked:v,onChange:A=>R(A.target.checked)}),n.jsx("span",{children:o(v?"settings.enabled":"settings.disabled")})]})})]})]})]}),n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.softwareUpdate")}),n.jsxs("div",{className:"settings-card",children:[n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.releaseChannel")}),n.jsx("span",{className:"settings-row-description",children:o("settings.releaseChannelDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsxs("select",{"aria-label":o("settings.releaseChannel"),className:"settings-select",value:u.releaseChannel,onChange:A=>W(A.target.value),children:[n.jsx("option",{value:"stable",children:o("settings.releaseStable")}),n.jsx("option",{value:"beta",children:o("settings.releaseBeta")})]})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsx("div",{className:"settings-row-label",children:n.jsx("span",{className:"settings-row-title",children:o("settings.serverUpdate")})}),n.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:n.jsx(OR,{})})]}),L.isWeb?null:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"settings-row",children:[n.jsx("div",{className:"settings-row-label",children:n.jsx("span",{className:"settings-row-title",children:o("settings.autoCheckUpdate")})}),n.jsx("div",{className:"settings-row-control",children:n.jsxs("label",{className:"settings-checkbox",children:[n.jsx("input",{type:"checkbox",checked:u.autoCheckUpdate,onChange:A=>M(A.target.checked)}),n.jsx("span",{children:u.autoCheckUpdate?o("settings.enabled"):o("settings.disabled")})]})})]}),n.jsxs("div",{className:"settings-row",children:[n.jsx("div",{className:"settings-row-label",children:n.jsx("span",{className:"settings-row-title",children:o("settings.clientUpdate")})}),n.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:n.jsx(_R,{})})]})]})]})]}),n.jsxs("section",{className:"settings-section",children:[n.jsx("h2",{className:"settings-section-title",children:o("settings.advancedSettings")}),n.jsx("div",{className:"settings-card",children:n.jsxs("div",{className:"settings-row",children:[n.jsxs("div",{className:"settings-row-label",children:[n.jsx("span",{className:"settings-row-title",children:o("settings.parallelTaskDebug")}),n.jsx("span",{className:"settings-row-description",children:o("settings.parallelTaskDebugDescription")})]}),n.jsx("div",{className:"settings-row-control",children:n.jsx("button",{className:"settings-button",type:"button",onClick:()=>i(!0),children:o("settings.parallelTaskDebugAction")})})]})})]}),n.jsxs("div",{className:"settings-footer settings-footer-with-logout",children:[n.jsxs("span",{className:"settings-version",children:["CodingNS v",t]}),n.jsx("button",{className:"settings-button settings-button-danger settings-button-sticky",onClick:H,type:"button",children:o("common.logout")})]})]}),n.jsx(C9,{isOpen:r,onClose:()=>i(!1)})]})}function nK({model:e,appVersion:t}){const r=mr(),{section:i}=Ao(),a=X9(i)?i:null,c=[{id:"appearance",title:o("settings.appearance"),description:o("settings.appearanceSectionSummary"),value:Q9(e.accountPreferences.language),icon:n.jsx(cK,{})}];return e.showServerSettings&&c.push({id:"server-connection",title:o("settings.serverConnection"),description:o("settings.serverConnectionSectionSummary"),value:kb(e.runtimeConfig)??"",icon:n.jsx(uK,{})}),c.push({id:"remote-access",title:o("settings.remoteAccess"),description:o("settings.remoteAccessSectionSummary"),value:o("settings.tailscaleBrand"),icon:n.jsx(hK,{})},{id:"skills",title:o("settings.skills"),description:o("settings.skillsSectionSummary"),value:o("settings.skillsNavValue"),icon:n.jsx(mK,{})},{id:"security-privacy",title:o("settings.securityPrivacy"),description:o("settings.securityPrivacySectionSummary"),value:Z9(e.accountPreferences.defaultPermissionMode),icon:n.jsx(pK,{})},{id:"software-update",title:o("settings.softwareUpdate"),description:o("settings.softwareUpdateSectionSummary"),value:J9(e.runtimeConfig.releaseChannel),icon:n.jsx(dK,{})}),(a?c.find(d=>d.id===a)??null:null)?n.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[n.jsx($j,{title:o("settings.title")}),n.jsxs("div",{className:"settings-mobile-container",children:[a==="appearance"?n.jsx(rK,{model:e}):null,a==="server-connection"&&e.showServerSettings?n.jsx(iK,{model:e}):null,a==="remote-access"?n.jsx(aK,{}):null,a==="skills"?n.jsx(oK,{}):null,a==="security-privacy"?n.jsx(sK,{model:e}):null,a==="software-update"?n.jsx(lK,{model:e}):null]}),n.jsx(Gj,{onLogout:e.handleLogout})]}):n.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[n.jsx($j,{title:o("settings.title")}),n.jsxs("div",{className:"settings-mobile-container",children:[n.jsx("section",{className:"settings-mobile-group-section",children:n.jsx("div",{className:"settings-mobile-card",children:c.map(d=>n.jsxs("button",{type:"button",className:"settings-mobile-nav-row",onClick:()=>r(`/settings/${d.id}`),children:[n.jsx("span",{className:"settings-mobile-nav-icon",children:d.icon}),n.jsxs("span",{className:"settings-mobile-nav-copy",children:[n.jsx("span",{className:"settings-mobile-nav-title",children:d.title}),n.jsx("span",{className:"settings-mobile-nav-description",children:d.description})]}),n.jsxs("span",{className:"settings-mobile-nav-trailing",children:[d.value?n.jsx("span",{className:"settings-mobile-nav-value",children:d.value}):null,n.jsx(fK,{})]})]},d.id))})}),n.jsx("div",{className:"settings-footer settings-footer-mobile",children:n.jsxs("span",{className:"settings-version",children:["CodingNS v",t]})})]}),n.jsx(Gj,{onLogout:e.handleLogout})]})}function rK({model:e}){return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.language")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.languageDescription")}),n.jsx("div",{className:"settings-mobile-card",children:n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsx("div",{className:"settings-mobile-row-copy",children:n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.language")})}),n.jsx(Lb,{variant:"compact",className:"settings-mobile-language-switcher"})]})})]}),n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.theme")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.themeDescription")}),n.jsx("div",{className:"settings-mobile-card",children:VN.map(t=>{const r=e.theme===t.id;return n.jsxs("button",{type:"button",className:`settings-mobile-choice-row${r?" active":""}`,"aria-pressed":r,onClick:()=>e.applyTheme(t.id),children:[n.jsxs("span",{className:"settings-mobile-choice-leading",children:[n.jsx("span",{className:"settings-mobile-choice-dot",style:{background:t.color},"aria-hidden":"true"}),n.jsx("span",{className:"settings-mobile-choice-label",children:GN(t)})]}),n.jsx("span",{className:"settings-mobile-choice-indicator","aria-hidden":"true",children:r?n.jsx(gK,{}):null})]},t.id)})})]}),n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.fileManager")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.workspaceSessionSortModeDescription")}),n.jsxs("div",{className:"settings-mobile-card",children:[n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.workspaceSessionSortMode")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.workspaceSessionSortModeDescription")})]}),n.jsx("select",{"aria-label":o("settings.workspaceSessionSortMode"),className:"settings-select settings-mobile-select",value:e.sessionDisplaySortMode,onChange:t=>e.updateSessionDisplaySortMode(t.target.value),children:e.sessionDisplaySortModeOptions.map(t=>n.jsx("option",{value:t.value,children:t.label},t.value))})]}),n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.showSystemFiles")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.showSystemFilesDescription")})]}),n.jsx(Tl,{checked:e.showSystemFiles,label:o("settings.showSystemFiles"),onChange:e.updateShowSystemFiles})]})]})]})]})}function iK({model:e}){return n.jsxs(n.Fragment,{children:[e.canConfigureServerAddress?n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.serverAddress")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.serverDescription")}),n.jsx("div",{className:"settings-mobile-card",children:n.jsxs("form",{className:"settings-mobile-form-stack",onSubmit:e.handleHostBaseUrlSubmit,children:[n.jsx("input",{"aria-label":o("settings.serverAddress"),className:"settings-text-input settings-mobile-input",value:e.hostBaseUrlDraft,onChange:t=>e.setHostBaseUrlDraft(t.target.value)}),n.jsx("button",{className:"settings-mobile-primary-button",disabled:!e.canSaveHostBaseUrl,type:"submit",children:o("common.save")})]})})]}):null,n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.serverConnection")}),n.jsx("div",{className:"settings-mobile-card",children:n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.autoReconnect")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.autoReconnectDescription")})]}),n.jsx(Tl,{checked:e.runtimeConfig.autoReconnect,label:o("settings.autoReconnect"),onChange:e.updateAutoReconnect})]})})]})]})}function sK({model:e}){return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.securityPrivacy")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.securityPrivacySectionSummary")}),n.jsx("div",{className:"settings-mobile-card",children:n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.defaultPermissionMode")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.defaultPermissionModeDescription")})]}),n.jsx("select",{"aria-label":o("settings.defaultPermissionMode"),className:"settings-select settings-mobile-select",value:e.accountPreferences.defaultPermissionMode,onChange:t=>e.updateDefaultPermissionMode(t.target.value),children:e.permissionModeOptions.map(t=>n.jsx("option",{value:t.value,children:t.label},t.value))})]})})]}),n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.notificationSettings")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.notificationSettingsDescription")}),n.jsxs("div",{className:"settings-mobile-card",children:[n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.notifyOnPermissionRequest")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.notifyOnPermissionRequestDescription")})]}),n.jsx(Tl,{checked:e.notifyOnPermissionRequest,label:o("settings.notifyOnPermissionRequest"),onChange:e.updateNotifyOnPermissionRequest})]}),n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.notifyOnSessionCompleted")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.notifyOnSessionCompletedDescription")})]}),n.jsx(Tl,{checked:e.notifyOnSessionCompleted,label:o("settings.notifyOnSessionCompleted"),onChange:e.updateNotifyOnSessionCompleted})]}),n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.notifyOnSessionFailed")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.notifyOnSessionFailedDescription")})]}),n.jsx(Tl,{checked:e.notifyOnSessionFailed,label:o("settings.notifyOnSessionFailed"),onChange:e.updateNotifyOnSessionFailed})]})]})]})]})}function aK(){return n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.remoteAccess")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.remoteAccessSectionSummary")}),n.jsx("div",{className:"settings-mobile-card settings-mobile-release-card",children:n.jsx(WR,{})})]})}function oK(){return n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.skills")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.skillsSectionSummary")}),n.jsx("div",{className:"settings-mobile-card settings-mobile-release-card",children:n.jsx(BR,{})})]})}function lK({model:e}){return n.jsxs(n.Fragment,{children:[n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.softwareUpdate")}),n.jsx("p",{className:"settings-mobile-group-note",children:o("settings.softwareUpdateSectionSummary")}),n.jsx("div",{className:"settings-mobile-card",children:n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsxs("div",{className:"settings-mobile-row-copy",children:[n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.releaseChannel")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.releaseChannelDescription")})]}),n.jsxs("select",{"aria-label":o("settings.releaseChannel"),className:"settings-select settings-mobile-select",value:e.runtimeConfig.releaseChannel,onChange:t=>e.updateReleaseChannel(t.target.value),children:[n.jsx("option",{value:"stable",children:o("settings.releaseStable")}),n.jsx("option",{value:"beta",children:o("settings.releaseBeta")})]})]})})]}),n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.serverUpdate")}),n.jsx("div",{className:"settings-mobile-card settings-mobile-release-card",children:n.jsx(OR,{})})]}),e.platform.isWeb?null:n.jsxs("section",{className:"settings-mobile-group-section",children:[n.jsx("h2",{className:"settings-mobile-group-title",children:o("settings.clientUpdate")}),n.jsx("div",{className:"settings-mobile-card",children:n.jsxs("div",{className:"settings-mobile-form-row",children:[n.jsx("div",{className:"settings-mobile-row-copy",children:n.jsx("span",{className:"settings-mobile-row-title",children:o("settings.autoCheckUpdate")})}),n.jsx(Tl,{checked:e.runtimeConfig.autoCheckUpdate,label:o("settings.autoCheckUpdate"),onChange:e.updateAutoCheckUpdate})]})}),n.jsx("div",{className:"settings-mobile-card settings-mobile-release-card",children:n.jsx(_R,{})})]})]})}function Gj({onLogout:e}){return n.jsx("div",{className:"settings-mobile-sticky-footer",children:n.jsx("button",{type:"button",className:"settings-mobile-danger-button settings-mobile-danger-button-sticky",onClick:e,children:o("common.logout")})})}function Tl({checked:e,label:t,onChange:r}){return n.jsxs("label",{className:"settings-mobile-switch","aria-label":t,children:[n.jsx("input",{type:"checkbox",checked:e,onChange:i=>r(i.target.checked)}),n.jsx("span",{className:"settings-mobile-switch-track","aria-hidden":"true",children:n.jsx("span",{className:"settings-mobile-switch-thumb"})})]})}function cK(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[n.jsx("path",{d:"M10 3.5a6.5 6.5 0 1 0 6.5 6.5c0-.8-.6-1.4-1.4-1.4h-1.6A1.5 1.5 0 0 1 12 7.1V5.5c0-1.1-.9-2-2-2Z"}),n.jsx("circle",{cx:"6.6",cy:"9.2",r:".8",fill:"currentColor",stroke:"none"}),n.jsx("circle",{cx:"8.8",cy:"6.8",r:".8",fill:"currentColor",stroke:"none"}),n.jsx("circle",{cx:"12.1",cy:"6.6",r:".8",fill:"currentColor",stroke:"none"})]})}function uK(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[n.jsx("path",{d:"M4 7.5 10 4l6 3.5v5L10 16l-6-3.5v-5Z"}),n.jsx("path",{d:"M10 9.5V16"}),n.jsx("path",{d:"M4 7.5 10 11l6-3.5"})]})}function dK(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[n.jsx("rect",{x:"3.5",y:"4",width:"13",height:"9.5",rx:"2.2"}),n.jsx("path",{d:"M7 16h6"}),n.jsx("path",{d:"M10 13.5V16"}),n.jsx("path",{d:"m8 8 2 2 3-3"})]})}function hK(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[n.jsx("circle",{cx:"10",cy:"10",r:"5.8"}),n.jsx("path",{d:"M10 4.2c1.5 1.3 2.4 3.5 2.4 5.8s-.9 4.5-2.4 5.8c-1.5-1.3-2.4-3.5-2.4-5.8s.9-4.5 2.4-5.8Z"}),n.jsx("path",{d:"M4.6 8.1h10.8"}),n.jsx("path",{d:"M4.6 11.9h10.8"})]})}function mK(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.7","aria-hidden":"true",children:[n.jsx("rect",{x:"3.5",y:"4",width:"13",height:"12",rx:"2.5"}),n.jsx("path",{d:"M6 7h8M6 10h8M6 13h4",strokeLinecap:"round"}),n.jsx("path",{d:"m12.7 13.2 1.4 1.4 2.6-2.8",strokeLinecap:"round",strokeLinejoin:"round"})]})}function pK(){return n.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[n.jsx("path",{d:"M10 3.2 15 5v4.4c0 3-1.9 5.8-5 7.4-3.1-1.6-5-4.4-5-7.4V5l5-1.8Z"}),n.jsx("path",{d:"m8.3 9.8 1.2 1.2 2.4-2.5"})]})}function fK(){return n.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:n.jsx("path",{d:"m4 2 4 4-4 4"})})}function gK(){return n.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:n.jsx("path",{d:"m3.5 8.2 2.6 2.6 6-6"})})}function bK({runtimeKey:e,children:t}){return n.jsx("div",{children:t},e)}function wK(){const e=vI();return n.jsx(bK,{runtimeKey:e,children:n.jsx(Rg,{})})}function vK(){const e=im(r=>r.session),t=hs();if(!e){const r=`${t.pathname}${t.search}`;return n.jsx(Al,{to:`/login?returnTo=${encodeURIComponent(r)}`,replace:!0})}return n.jsx(wK,{})}function Kj(){const{shellMode:e}=Tr();return n.jsx(Al,{to:e==="mobile"?"/workspaces":"/landing",replace:!0})}const yK=[{path:"/bootstrap",element:n.jsx(PI,{})},{path:"/login",element:n.jsx(II,{})},{path:"/desktop-window-preview",element:n.jsx(_$,{})},{path:"/",element:n.jsx(vK,{}),children:[{path:"desktop-window/:windowId",element:n.jsx(aG,{})},{element:n.jsx(w9,{}),children:[{index:!0,element:n.jsx(Kj,{})},{path:"landing",element:n.jsx(k9,{})},{path:"workspaces",element:n.jsx(EG,{})},{path:"workspaces/:workspaceId",element:n.jsx(u9,{})},{path:"workspaces/:workspaceId/debug",element:n.jsx(g9,{})},{path:"workspaces/:workspaceId/sessions",element:n.jsx(pG,{})},{path:"workspaces/:workspaceId/sessions/:sessionId",element:n.jsx(h$,{})},{path:"workspaces/:workspaceId/tools",element:n.jsx(jG,{})},{path:"workspaces/:workspaceId/tools/files",element:n.jsx(wG,{})},{path:"workspaces/:workspaceId/tools/git",element:n.jsx(vG,{})},{path:"workspaces/:workspaceId/tools/processes",element:n.jsx(yG,{})},{path:"workspaces/:workspaceId/terminals",lazy:async()=>({Component:(await Pl(()=>import("./TerminalPage-Dfw1QUqW.js"),__vite__mapDeps([0,1]))).TerminalPage})},{path:"workspaces/:workspaceId/butler",element:n.jsx(wq,{})},{path:"settings",element:n.jsx(Vj,{})},{path:"settings/:section",element:n.jsx(Vj,{})},{path:"*",element:n.jsx(Kj,{})}]}]}];function kK(){return ME(yK)}function xK(){const e=Mo(r=>r.profile.language),t=p.useMemo(()=>kK(),[]);return n.jsx(QE,{children:n.jsx(bI,{children:n.jsx(aI,{language:e,children:n.jsx(hI,{children:n.jsx(gI,{children:n.jsx(WE,{router:t})})})})})})}d1().finally(()=>{XM.createRoot(document.getElementById("root")).render(n.jsx(xK,{}))});export{vT as C,Io as M,W8 as T,hr as a,ms as b,Kb as c,mr as d,Ao as e,Tr as f,fN as g,Jn as h,jK as i,Lr as j,n as k,O8 as l,RK as m,Sj as n,TK as o,DK as p,Vn as q,p as r,Yb as s,o as t,pr as u,NK as v,Ei as w,B8 as x,PK as y,CK as z};
|