@jingyi0605/codingns 0.2.0 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/bin/codingns.mjs +640 -53
- package/dist/public/assets/{TerminalPage-BlbQuWi1.js → TerminalPage-BkjqU9NG.js} +19 -19
- package/dist/public/assets/index-C6U8-9jg.css +1 -0
- package/dist/public/assets/index-CKSumuV2.js +109 -0
- package/dist/public/index.html +2 -2
- package/dist/server/config/env.d.ts +1 -0
- package/dist/server/config/env.js +3 -0
- package/dist/server/config/env.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +89 -0
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js +138 -0
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -0
- package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +115 -0
- package/dist/server/modules/assistant-capability/assistant-capability-service.js +241 -0
- package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -0
- package/dist/server/modules/butler/butler-control-session-service.js +69 -30
- package/dist/server/modules/butler/butler-control-session-service.js.map +1 -1
- package/dist/server/modules/butler/butler-follow-up-scheduler.d.ts +9 -0
- package/dist/server/modules/butler/butler-follow-up-scheduler.js +47 -11
- package/dist/server/modules/butler/butler-follow-up-scheduler.js.map +1 -1
- package/dist/server/modules/butler/butler-follow-up-service.d.ts +7 -1
- package/dist/server/modules/butler/butler-follow-up-service.js +10 -0
- package/dist/server/modules/butler/butler-follow-up-service.js.map +1 -1
- package/dist/server/modules/butler/butler-session-service.d.ts +2 -1
- package/dist/server/modules/butler/butler-session-service.js +10 -1
- package/dist/server/modules/butler/butler-session-service.js.map +1 -1
- package/dist/server/modules/butler/butler-session-summary-service.d.ts +8 -1
- package/dist/server/modules/butler/butler-session-summary-service.js +34 -7
- package/dist/server/modules/butler/butler-session-summary-service.js.map +1 -1
- package/dist/server/modules/butler/context-aggregator.js +44 -13
- package/dist/server/modules/butler/context-aggregator.js.map +1 -1
- package/dist/server/modules/butler/patrol-scheduler.d.ts +9 -0
- package/dist/server/modules/butler/patrol-scheduler.js +63 -9
- package/dist/server/modules/butler/patrol-scheduler.js.map +1 -1
- package/dist/server/modules/butler/session-summary-scheduler.d.ts +9 -0
- package/dist/server/modules/butler/session-summary-scheduler.js +47 -11
- package/dist/server/modules/butler/session-summary-scheduler.js.map +1 -1
- package/dist/server/modules/debug-target/debug-runtime-reconciliation-scheduler.d.ts +38 -0
- package/dist/server/modules/debug-target/debug-runtime-reconciliation-scheduler.js +99 -0
- package/dist/server/modules/debug-target/debug-runtime-reconciliation-scheduler.js.map +1 -0
- package/dist/server/modules/debug-target/debug-target-controller.d.ts +70 -0
- package/dist/server/modules/debug-target/debug-target-controller.js +113 -0
- package/dist/server/modules/debug-target/debug-target-controller.js.map +1 -0
- package/dist/server/modules/debug-target/debug-target-service.d.ts +102 -0
- package/dist/server/modules/debug-target/debug-target-service.js +1484 -0
- package/dist/server/modules/debug-target/debug-target-service.js.map +1 -0
- package/dist/server/modules/debug-target/framework-compatibility-matrix.d.ts +4 -0
- package/dist/server/modules/debug-target/framework-compatibility-matrix.js +45 -0
- package/dist/server/modules/debug-target/framework-compatibility-matrix.js.map +1 -0
- package/dist/server/modules/debug-target/launch-adapter-registry.d.ts +25 -0
- package/dist/server/modules/debug-target/launch-adapter-registry.js +445 -0
- package/dist/server/modules/debug-target/launch-adapter-registry.js.map +1 -0
- package/dist/server/modules/file/file-content-service.d.ts +2 -1
- package/dist/server/modules/file/file-content-service.js +53 -0
- package/dist/server/modules/file/file-content-service.js.map +1 -1
- package/dist/server/modules/git/commit-orchestrator.d.ts +4 -1
- package/dist/server/modules/git/commit-orchestrator.js +18 -1
- package/dist/server/modules/git/commit-orchestrator.js.map +1 -1
- package/dist/server/modules/git/git-auth.d.ts +25 -0
- package/dist/server/modules/git/git-auth.js +88 -0
- package/dist/server/modules/git/git-auth.js.map +1 -0
- package/dist/server/modules/git/git-controller.d.ts +6 -0
- package/dist/server/modules/git/git-controller.js +5 -1
- package/dist/server/modules/git/git-controller.js.map +1 -1
- package/dist/server/modules/git/git-read-service.d.ts +2 -1
- package/dist/server/modules/git/git-read-service.js +19 -2
- package/dist/server/modules/git/git-read-service.js.map +1 -1
- package/dist/server/modules/git/git-remote-credential-service.d.ts +9 -0
- package/dist/server/modules/git/git-remote-credential-service.js +76 -0
- package/dist/server/modules/git/git-remote-credential-service.js.map +1 -0
- package/dist/server/modules/git/git-write-service.d.ts +5 -2
- package/dist/server/modules/git/git-write-service.js +33 -17
- package/dist/server/modules/git/git-write-service.js.map +1 -1
- package/dist/server/modules/git/types.d.ts +3 -0
- package/dist/server/modules/git/workspace-repo-guard.js +3 -2
- package/dist/server/modules/git/workspace-repo-guard.js.map +1 -1
- package/dist/server/modules/provider/codex-model-options.d.ts +3 -1
- package/dist/server/modules/provider/codex-model-options.js +4 -1
- package/dist/server/modules/provider/codex-model-options.js.map +1 -1
- package/dist/server/modules/provider/opencode-model-options.d.ts +3 -1
- package/dist/server/modules/provider/opencode-model-options.js +5 -1
- package/dist/server/modules/provider/opencode-model-options.js.map +1 -1
- package/dist/server/modules/provider/provider-discovery-helper-client.d.ts +24 -0
- package/dist/server/modules/provider/provider-discovery-helper-client.js +14 -0
- package/dist/server/modules/provider/provider-discovery-helper-client.js.map +1 -1
- package/dist/server/modules/provider/provider-discovery-helper-process.js +54 -0
- package/dist/server/modules/provider/provider-discovery-helper-process.js.map +1 -1
- package/dist/server/modules/sessions/session-controller.d.ts +5 -0
- package/dist/server/modules/sessions/session-controller.js +16 -0
- package/dist/server/modules/sessions/session-controller.js.map +1 -1
- package/dist/server/modules/sessions/session-history-service.d.ts +19 -5
- package/dist/server/modules/sessions/session-history-service.js +322 -39
- package/dist/server/modules/sessions/session-history-service.js.map +1 -1
- package/dist/server/modules/tasks/event-loop-monitor.d.ts +21 -0
- package/dist/server/modules/tasks/event-loop-monitor.js +64 -0
- package/dist/server/modules/tasks/event-loop-monitor.js.map +1 -0
- package/dist/server/modules/tasks/observability-controller.d.ts +30 -0
- package/dist/server/modules/tasks/observability-controller.js +44 -0
- package/dist/server/modules/tasks/observability-controller.js.map +1 -0
- package/dist/server/modules/tasks/observability-service.d.ts +32 -0
- package/dist/server/modules/tasks/observability-service.js +104 -0
- package/dist/server/modules/tasks/observability-service.js.map +1 -0
- package/dist/server/modules/tasks/scheduler-metrics.d.ts +41 -0
- package/dist/server/modules/tasks/scheduler-metrics.js +92 -0
- package/dist/server/modules/tasks/scheduler-metrics.js.map +1 -0
- package/dist/server/modules/tasks/task-activity-log.d.ts +39 -0
- package/dist/server/modules/tasks/task-activity-log.js +43 -0
- package/dist/server/modules/tasks/task-activity-log.js.map +1 -0
- package/dist/server/modules/tasks/task-helper-client.d.ts +11 -0
- package/dist/server/modules/tasks/task-helper-client.js +132 -0
- package/dist/server/modules/tasks/task-helper-client.js.map +1 -0
- package/dist/server/modules/tasks/task-helper-process-handlers.d.ts +16 -0
- package/dist/server/modules/tasks/task-helper-process-handlers.js +14 -0
- package/dist/server/modules/tasks/task-helper-process-handlers.js.map +1 -0
- package/dist/server/modules/tasks/task-helper-process.d.ts +1 -0
- package/dist/server/modules/tasks/task-helper-process.js +49 -0
- package/dist/server/modules/tasks/task-helper-process.js.map +1 -0
- package/dist/server/modules/tasks/task-lane-executors.d.ts +2 -0
- package/dist/server/modules/tasks/task-lane-executors.js +15 -0
- package/dist/server/modules/tasks/task-lane-executors.js.map +1 -0
- package/dist/server/modules/tasks/task-manager.d.ts +15 -0
- package/dist/server/modules/tasks/task-manager.js +36 -0
- package/dist/server/modules/tasks/task-manager.js.map +1 -0
- package/dist/server/modules/tasks/task-metrics.d.ts +9 -0
- package/dist/server/modules/tasks/task-metrics.js +81 -0
- package/dist/server/modules/tasks/task-metrics.js.map +1 -0
- package/dist/server/modules/tasks/task-registry.d.ts +7 -0
- package/dist/server/modules/tasks/task-registry.js +21 -0
- package/dist/server/modules/tasks/task-registry.js.map +1 -0
- package/dist/server/modules/tasks/task-scheduler.d.ts +31 -0
- package/dist/server/modules/tasks/task-scheduler.js +473 -0
- package/dist/server/modules/tasks/task-scheduler.js.map +1 -0
- package/dist/server/modules/tasks/task-types.d.ts +106 -0
- package/dist/server/modules/tasks/task-types.js +23 -0
- package/dist/server/modules/tasks/task-types.js.map +1 -0
- package/dist/server/modules/terminal/command-template-service.d.ts +4 -0
- package/dist/server/modules/terminal/command-template-service.js +5 -3
- package/dist/server/modules/terminal/command-template-service.js.map +1 -1
- package/dist/server/modules/terminal/runtime/terminal-log-spooler.d.ts +7 -3
- package/dist/server/modules/terminal/runtime/terminal-log-spooler.js +95 -15
- package/dist/server/modules/terminal/runtime/terminal-log-spooler.js.map +1 -1
- package/dist/server/modules/terminal/runtime/terminal-log-writer-client.d.ts +21 -0
- package/dist/server/modules/terminal/runtime/terminal-log-writer-client.js +144 -0
- package/dist/server/modules/terminal/runtime/terminal-log-writer-client.js.map +1 -0
- package/dist/server/modules/terminal/runtime/terminal-log-writer-process.d.ts +1 -0
- package/dist/server/modules/terminal/runtime/terminal-log-writer-process.js +187 -0
- package/dist/server/modules/terminal/runtime/terminal-log-writer-process.js.map +1 -0
- package/dist/server/modules/terminal/terminal-service.d.ts +12 -0
- package/dist/server/modules/terminal/terminal-service.js +34 -17
- package/dist/server/modules/terminal/terminal-service.js.map +1 -1
- package/dist/server/modules/workbench/workbench-service.d.ts +23 -2
- package/dist/server/modules/workbench/workbench-service.js +126 -15
- package/dist/server/modules/workbench/workbench-service.js.map +1 -1
- package/dist/server/modules/workbench/workspace-panel-snapshot-service.d.ts +5 -1
- package/dist/server/modules/workbench/workspace-panel-snapshot-service.js +88 -19
- package/dist/server/modules/workbench/workspace-panel-snapshot-service.js.map +1 -1
- package/dist/server/modules/workspace/workspace-code-composition.d.ts +2 -0
- package/dist/server/modules/workspace/workspace-code-composition.js +154 -0
- package/dist/server/modules/workspace/workspace-code-composition.js.map +1 -0
- package/dist/server/modules/workspace/workspace-controller.d.ts +14 -0
- package/dist/server/modules/workspace/workspace-controller.js +19 -0
- package/dist/server/modules/workspace/workspace-controller.js.map +1 -1
- package/dist/server/modules/workspace/workspace-service.d.ts +21 -14
- package/dist/server/modules/workspace/workspace-service.js +183 -234
- package/dist/server/modules/workspace/workspace-service.js.map +1 -1
- package/dist/server/modules/worktree/worktree-cleanup-service.d.ts +35 -0
- package/dist/server/modules/worktree/worktree-cleanup-service.js +210 -0
- package/dist/server/modules/worktree/worktree-cleanup-service.js.map +1 -0
- package/dist/server/modules/worktree/worktree-controller.d.ts +44 -0
- package/dist/server/modules/worktree/worktree-controller.js +40 -0
- package/dist/server/modules/worktree/worktree-controller.js.map +1 -0
- package/dist/server/modules/worktree/worktree-manager.d.ts +34 -0
- package/dist/server/modules/worktree/worktree-manager.js +292 -0
- package/dist/server/modules/worktree/worktree-manager.js.map +1 -0
- package/dist/server/modules/worktree/worktree-merge-service.d.ts +52 -0
- package/dist/server/modules/worktree/worktree-merge-service.js +293 -0
- package/dist/server/modules/worktree/worktree-merge-service.js.map +1 -0
- package/dist/server/modules/worktree/worktree-sync-service.d.ts +23 -0
- package/dist/server/modules/worktree/worktree-sync-service.js +166 -0
- package/dist/server/modules/worktree/worktree-sync-service.js.map +1 -0
- package/dist/server/routes/assistant.d.ts +3 -0
- package/dist/server/routes/assistant.js +15 -0
- package/dist/server/routes/assistant.js.map +1 -0
- package/dist/server/routes/debug-targets.d.ts +3 -0
- package/dist/server/routes/debug-targets.js +15 -0
- package/dist/server/routes/debug-targets.js.map +1 -0
- package/dist/server/routes/git.js +1 -0
- package/dist/server/routes/git.js.map +1 -1
- package/dist/server/routes/observability.d.ts +3 -0
- package/dist/server/routes/observability.js +7 -0
- package/dist/server/routes/observability.js.map +1 -0
- package/dist/server/routes/workspaces.js +2 -0
- package/dist/server/routes/workspaces.js.map +1 -1
- package/dist/server/routes/worktrees.d.ts +3 -0
- package/dist/server/routes/worktrees.js +8 -0
- package/dist/server/routes/worktrees.js.map +1 -0
- package/dist/server/server/create-server.d.ts +34 -0
- package/dist/server/server/create-server.js +100 -10
- package/dist/server/server/create-server.js.map +1 -1
- package/dist/server/shared/utils/secret-box.d.ts +2 -0
- package/dist/server/shared/utils/secret-box.js +29 -0
- package/dist/server/shared/utils/secret-box.js.map +1 -0
- package/dist/server/shared/utils/terminal-debug-log.js +5 -3
- package/dist/server/shared/utils/terminal-debug-log.js.map +1 -1
- package/dist/server/storage/repositories/ai-fallback-edit-repository.d.ts +11 -0
- package/dist/server/storage/repositories/ai-fallback-edit-repository.js +118 -0
- package/dist/server/storage/repositories/ai-fallback-edit-repository.js.map +1 -0
- package/dist/server/storage/repositories/debug-runtime-session-repository.d.ts +11 -0
- package/dist/server/storage/repositories/debug-runtime-session-repository.js +100 -0
- package/dist/server/storage/repositories/debug-runtime-session-repository.js.map +1 -0
- package/dist/server/storage/repositories/debug-service-repository.d.ts +9 -0
- package/dist/server/storage/repositories/debug-service-repository.js +99 -0
- package/dist/server/storage/repositories/debug-service-repository.js.map +1 -0
- package/dist/server/storage/repositories/debug-target-repository.d.ts +11 -0
- package/dist/server/storage/repositories/debug-target-repository.js +100 -0
- package/dist/server/storage/repositories/debug-target-repository.js.map +1 -0
- package/dist/server/storage/repositories/framework-analysis-result-repository.d.ts +9 -0
- package/dist/server/storage/repositories/framework-analysis-result-repository.js +98 -0
- package/dist/server/storage/repositories/framework-analysis-result-repository.js.map +1 -0
- package/dist/server/storage/repositories/git-remote-credential-repository.d.ts +9 -0
- package/dist/server/storage/repositories/git-remote-credential-repository.js +51 -0
- package/dist/server/storage/repositories/git-remote-credential-repository.js.map +1 -0
- package/dist/server/storage/repositories/port-lease-repository.d.ts +12 -0
- package/dist/server/storage/repositories/port-lease-repository.js +124 -0
- package/dist/server/storage/repositories/port-lease-repository.js.map +1 -0
- package/dist/server/storage/repositories/runtime-binding-repository.d.ts +10 -0
- package/dist/server/storage/repositories/runtime-binding-repository.js +89 -0
- package/dist/server/storage/repositories/runtime-binding-repository.js.map +1 -0
- package/dist/server/storage/repositories/terminal-command-template-repository.js +77 -4
- package/dist/server/storage/repositories/terminal-command-template-repository.js.map +1 -1
- package/dist/server/storage/repositories/terminal-instance-repository.js +89 -7
- package/dist/server/storage/repositories/terminal-instance-repository.js.map +1 -1
- package/dist/server/storage/repositories/workspace-navigation-state-repository.d.ts +9 -0
- package/dist/server/storage/repositories/workspace-navigation-state-repository.js +49 -0
- package/dist/server/storage/repositories/workspace-navigation-state-repository.js.map +1 -0
- package/dist/server/storage/repositories/workspace-repository.d.ts +7 -1
- package/dist/server/storage/repositories/workspace-repository.js +32 -8
- package/dist/server/storage/repositories/workspace-repository.js.map +1 -1
- package/dist/server/storage/repositories/workspace-worktree-repository.d.ts +13 -0
- package/dist/server/storage/repositories/workspace-worktree-repository.js +158 -0
- package/dist/server/storage/repositories/workspace-worktree-repository.js.map +1 -0
- package/dist/server/storage/sqlite/client.js +301 -0
- package/dist/server/storage/sqlite/client.js.map +1 -1
- package/dist/server/storage/sqlite/schema.sql +238 -0
- package/dist/server/types/domain.d.ts +231 -0
- package/dist/server/ws/workbench-ws-hub.js +33 -9
- package/dist/server/ws/workbench-ws-hub.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +18 -6
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +14 -2
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +25 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -1
- package/node_modules/@codingns/session-sync-core/dist/types.d.ts +6 -0
- package/package.json +1 -1
- package/dist/public/assets/index-1VIm8lVL.css +0 -1
- package/dist/public/assets/index-Dti93O2S.js +0 -109
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPage-BkjqU9NG.js","assets/TerminalPage-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var JR=Object.defineProperty;var ZR=(e,t,r)=>t in e?JR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var it=(e,t,r)=>ZR(e,typeof t!="symbol"?t+"":t,r);function fj(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 u=Object.getOwnPropertyDescriptor(i,a);u&&Object.defineProperty(e,a,u.get?u:{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 u of a)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&i(c)}).observe(document,{childList:!0,subtree:!0});function r(a){const u={};return a.integrity&&(u.integrity=a.integrity),a.referrerPolicy&&(u.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?u.credentials="include":a.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(a){if(a.ep)return;a.ep=!0;const u=r(a);fetch(a.href,u)}})();function au(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ap={exports:{}},ac={},Ep={exports:{}},pn={};/**
|
|
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 Dy;function e1(){if(Dy)return pn;Dy=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"),u=Symbol.for("react.provider"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),g=Symbol.iterator;function w(L){return L===null||typeof L!="object"?null:(L=g&&L[g]||L["@@iterator"],typeof L=="function"?L:null)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,C={};function j(L,X,D){this.props=L,this.context=X,this.refs=C,this.updater=D||y}j.prototype.isReactComponent={},j.prototype.setState=function(L,X){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,X,"setState")},j.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function T(){}T.prototype=j.prototype;function P(L,X,D){this.props=L,this.context=X,this.refs=C,this.updater=D||y}var I=P.prototype=new T;I.constructor=P,x(I,j.prototype),I.isPureReactComponent=!0;var Z=Array.isArray,q=Object.prototype.hasOwnProperty,B={current:null},E={key:!0,ref:!0,__self:!0,__source:!0};function A(L,X,D){var be,ce={},le=null,ye=null;if(X!=null)for(be in X.ref!==void 0&&(ye=X.ref),X.key!==void 0&&(le=""+X.key),X)q.call(X,be)&&!E.hasOwnProperty(be)&&(ce[be]=X[be]);var Se=arguments.length-2;if(Se===1)ce.children=D;else if(1<Se){for(var _e=Array(Se),Ce=0;Ce<Se;Ce++)_e[Ce]=arguments[Ce+2];ce.children=_e}if(L&&L.defaultProps)for(be in Se=L.defaultProps,Se)ce[be]===void 0&&(ce[be]=Se[be]);return{$$typeof:e,type:L,key:le,ref:ye,props:ce,_owner:B.current}}function H(L,X){return{$$typeof:e,type:L.type,key:X,ref:L.ref,props:L.props,_owner:L._owner}}function _(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function Y(L){var X={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(D){return X[D]})}var z=/\/+/g;function K(L,X){return typeof L=="object"&&L!==null&&L.key!=null?Y(""+L.key):X.toString(36)}function O(L,X,D,be,ce){var le=typeof L;(le==="undefined"||le==="boolean")&&(L=null);var ye=!1;if(L===null)ye=!0;else switch(le){case"string":case"number":ye=!0;break;case"object":switch(L.$$typeof){case e:case t:ye=!0}}if(ye)return ye=L,ce=ce(ye),L=be===""?"."+K(ye,0):be,Z(ce)?(D="",L!=null&&(D=L.replace(z,"$&/")+"/"),O(ce,X,D,"",function(Ce){return Ce})):ce!=null&&(_(ce)&&(ce=H(ce,D+(!ce.key||ye&&ye.key===ce.key?"":(""+ce.key).replace(z,"$&/")+"/")+L)),X.push(ce)),1;if(ye=0,be=be===""?".":be+":",Z(L))for(var Se=0;Se<L.length;Se++){le=L[Se];var _e=be+K(le,Se);ye+=O(le,X,D,_e,ce)}else if(_e=w(L),typeof _e=="function")for(L=_e.call(L),Se=0;!(le=L.next()).done;)le=le.value,_e=be+K(le,Se++),ye+=O(le,X,D,_e,ce);else if(le==="object")throw X=String(L),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.");return ye}function F(L,X,D){if(L==null)return L;var be=[],ce=0;return O(L,be,"","",function(le){return X.call(D,le,ce++)}),be}function te(L){if(L._status===-1){var X=L._result;X=X(),X.then(function(D){(L._status===0||L._status===-1)&&(L._status=1,L._result=D)},function(D){(L._status===0||L._status===-1)&&(L._status=2,L._result=D)}),L._status===-1&&(L._status=0,L._result=X)}if(L._status===1)return L._result.default;throw L._result}var de={current:null},W={transition:null},M={ReactCurrentDispatcher:de,ReactCurrentBatchConfig:W,ReactCurrentOwner:B};function N(){throw Error("act(...) is not supported in production builds of React.")}return pn.Children={map:F,forEach:function(L,X,D){F(L,function(){X.apply(this,arguments)},D)},count:function(L){var X=0;return F(L,function(){X++}),X},toArray:function(L){return F(L,function(X){return X})||[]},only:function(L){if(!_(L))throw Error("React.Children.only expected to receive a single React element child.");return L}},pn.Component=j,pn.Fragment=r,pn.Profiler=a,pn.PureComponent=P,pn.StrictMode=i,pn.Suspense=m,pn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=M,pn.act=N,pn.cloneElement=function(L,X,D){if(L==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+L+".");var be=x({},L.props),ce=L.key,le=L.ref,ye=L._owner;if(X!=null){if(X.ref!==void 0&&(le=X.ref,ye=B.current),X.key!==void 0&&(ce=""+X.key),L.type&&L.type.defaultProps)var Se=L.type.defaultProps;for(_e in X)q.call(X,_e)&&!E.hasOwnProperty(_e)&&(be[_e]=X[_e]===void 0&&Se!==void 0?Se[_e]:X[_e])}var _e=arguments.length-2;if(_e===1)be.children=D;else if(1<_e){Se=Array(_e);for(var Ce=0;Ce<_e;Ce++)Se[Ce]=arguments[Ce+2];be.children=Se}return{$$typeof:e,type:L.type,key:ce,ref:le,props:be,_owner:ye}},pn.createContext=function(L){return L={$$typeof:c,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},L.Provider={$$typeof:u,_context:L},L.Consumer=L},pn.createElement=A,pn.createFactory=function(L){var X=A.bind(null,L);return X.type=L,X},pn.createRef=function(){return{current:null}},pn.forwardRef=function(L){return{$$typeof:d,render:L}},pn.isValidElement=_,pn.lazy=function(L){return{$$typeof:v,_payload:{_status:-1,_result:L},_init:te}},pn.memo=function(L,X){return{$$typeof:f,type:L,compare:X===void 0?null:X}},pn.startTransition=function(L){var X=W.transition;W.transition={};try{L()}finally{W.transition=X}},pn.unstable_act=N,pn.useCallback=function(L,X){return de.current.useCallback(L,X)},pn.useContext=function(L){return de.current.useContext(L)},pn.useDebugValue=function(){},pn.useDeferredValue=function(L){return de.current.useDeferredValue(L)},pn.useEffect=function(L,X){return de.current.useEffect(L,X)},pn.useId=function(){return de.current.useId()},pn.useImperativeHandle=function(L,X,D){return de.current.useImperativeHandle(L,X,D)},pn.useInsertionEffect=function(L,X){return de.current.useInsertionEffect(L,X)},pn.useLayoutEffect=function(L,X){return de.current.useLayoutEffect(L,X)},pn.useMemo=function(L,X){return de.current.useMemo(L,X)},pn.useReducer=function(L,X,D){return de.current.useReducer(L,X,D)},pn.useRef=function(L){return de.current.useRef(L)},pn.useState=function(L){return de.current.useState(L)},pn.useSyncExternalStore=function(L,X,D){return de.current.useSyncExternalStore(L,X,D)},pn.useTransition=function(){return de.current.useTransition()},pn.version="18.3.1",pn}var Ry;function Jg(){return Ry||(Ry=1,Ep.exports=e1()),Ep.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 My;function t1(){if(My)return ac;My=1;var e=Jg(),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,u={key:!0,ref:!0,__self:!0,__source:!0};function c(d,m,f){var v,g={},w=null,y=null;f!==void 0&&(w=""+f),m.key!==void 0&&(w=""+m.key),m.ref!==void 0&&(y=m.ref);for(v in m)i.call(m,v)&&!u.hasOwnProperty(v)&&(g[v]=m[v]);if(d&&d.defaultProps)for(v in m=d.defaultProps,m)g[v]===void 0&&(g[v]=m[v]);return{$$typeof:t,type:d,key:w,ref:y,props:g,_owner:a.current}}return ac.Fragment=r,ac.jsx=c,ac.jsxs=c,ac}var Ay;function n1(){return Ay||(Ay=1,Ap.exports=t1()),Ap.exports}var n=n1(),pd={},Ip={exports:{}},fi={},Lp={exports:{}},Fp={};/**
|
|
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 Ey;function r1(){return Ey||(Ey=1,(function(e){function t(W,M){var N=W.length;W.push(M);e:for(;0<N;){var L=N-1>>>1,X=W[L];if(0<a(X,M))W[L]=M,W[N]=X,N=L;else break e}}function r(W){return W.length===0?null:W[0]}function i(W){if(W.length===0)return null;var M=W[0],N=W.pop();if(N!==M){W[0]=N;e:for(var L=0,X=W.length,D=X>>>1;L<D;){var be=2*(L+1)-1,ce=W[be],le=be+1,ye=W[le];if(0>a(ce,N))le<X&&0>a(ye,ce)?(W[L]=ye,W[le]=N,L=le):(W[L]=ce,W[be]=N,L=be);else if(le<X&&0>a(ye,N))W[L]=ye,W[le]=N,L=le;else break e}}return M}function a(W,M){var N=W.sortIndex-M.sortIndex;return N!==0?N:W.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var m=[],f=[],v=1,g=null,w=3,y=!1,x=!1,C=!1,j=typeof setTimeout=="function"?setTimeout:null,T=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 I(W){for(var M=r(f);M!==null;){if(M.callback===null)i(f);else if(M.startTime<=W)i(f),M.sortIndex=M.expirationTime,t(m,M);else break;M=r(f)}}function Z(W){if(C=!1,I(W),!x)if(r(m)!==null)x=!0,te(q);else{var M=r(f);M!==null&&de(Z,M.startTime-W)}}function q(W,M){x=!1,C&&(C=!1,T(A),A=-1),y=!0;var N=w;try{for(I(M),g=r(m);g!==null&&(!(g.expirationTime>M)||W&&!Y());){var L=g.callback;if(typeof L=="function"){g.callback=null,w=g.priorityLevel;var X=L(g.expirationTime<=M);M=e.unstable_now(),typeof X=="function"?g.callback=X:g===r(m)&&i(m),I(M)}else i(m);g=r(m)}if(g!==null)var D=!0;else{var be=r(f);be!==null&&de(Z,be.startTime-M),D=!1}return D}finally{g=null,w=N,y=!1}}var B=!1,E=null,A=-1,H=5,_=-1;function Y(){return!(e.unstable_now()-_<H)}function z(){if(E!==null){var W=e.unstable_now();_=W;var M=!0;try{M=E(!0,W)}finally{M?K():(B=!1,E=null)}}else B=!1}var K;if(typeof P=="function")K=function(){P(z)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,F=O.port2;O.port1.onmessage=z,K=function(){F.postMessage(null)}}else K=function(){j(z,0)};function te(W){E=W,B||(B=!0,K())}function de(W,M){A=j(function(){W(e.unstable_now())},M)}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(W){W.callback=null},e.unstable_continueExecution=function(){x||y||(x=!0,te(q))},e.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<W?Math.floor(1e3/W):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_getFirstCallbackNode=function(){return r(m)},e.unstable_next=function(W){switch(w){case 1:case 2:case 3:var M=3;break;default:M=w}var N=w;w=M;try{return W()}finally{w=N}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(W,M){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var N=w;w=W;try{return M()}finally{w=N}},e.unstable_scheduleCallback=function(W,M,N){var L=e.unstable_now();switch(typeof N=="object"&&N!==null?(N=N.delay,N=typeof N=="number"&&0<N?L+N:L):N=L,W){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=N+X,W={id:v++,callback:M,priorityLevel:W,startTime:N,expirationTime:X,sortIndex:-1},N>L?(W.sortIndex=N,t(f,W),r(m)===null&&W===r(f)&&(C?(T(A),A=-1):C=!0,de(Z,N-L))):(W.sortIndex=X,t(m,W),x||y||(x=!0,te(q))),W},e.unstable_shouldYield=Y,e.unstable_wrapCallback=function(W){var M=w;return function(){var N=w;w=M;try{return W.apply(this,arguments)}finally{w=N}}}})(Fp)),Fp}var Iy;function i1(){return Iy||(Iy=1,Lp.exports=r1()),Lp.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 Ly;function s1(){if(Ly)return fi;Ly=1;var e=Jg(),t=i1();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 u(s,l){c(s,l),c(s+"Capture",l)}function c(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]*$/,v={},g={};function w(s){return m.call(g,s)?!0:m.call(v,s)?!1:f.test(s)?g[s]=!0:(v[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,R){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=R}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 T=/[\-:]([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(T,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(T,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(T,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 I(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?w(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 Z=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,q=Symbol.for("react.element"),B=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),_=Symbol.for("react.provider"),Y=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),K=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),F=Symbol.for("react.memo"),te=Symbol.for("react.lazy"),de=Symbol.for("react.offscreen"),W=Symbol.iterator;function M(s){return s===null||typeof s!="object"?null:(s=W&&s[W]||s["@@iterator"],typeof s=="function"?s:null)}var N=Object.assign,L;function X(s){if(L===void 0)try{throw Error()}catch(h){var l=h.stack.trim().match(/\n( *(at )?)/);L=l&&l[1]||""}return`
|
|
35
|
+
`+L+s}var D=!1;function be(s,l){if(!s||D)return"";D=!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(De){var b=De}Reflect.construct(s,[],l)}else{try{l.call()}catch(De){b=De}s.call(l.prototype)}else{try{throw Error()}catch(De){b=De}s()}}catch(De){if(De&&b&&typeof De.stack=="string"){for(var k=De.stack.split(`
|
|
36
|
+
`),S=b.stack.split(`
|
|
37
|
+
`),R=k.length-1,J=S.length-1;1<=R&&0<=J&&k[R]!==S[J];)J--;for(;1<=R&&0<=J;R--,J--)if(k[R]!==S[J]){if(R!==1||J!==1)do if(R--,J--,0>J||k[R]!==S[J]){var se=`
|
|
38
|
+
`+k[R].replace(" at new "," at ");return s.displayName&&se.includes("<anonymous>")&&(se=se.replace("<anonymous>",s.displayName)),se}while(1<=R&&0<=J);break}}}finally{D=!1,Error.prepareStackTrace=h}return(s=s?s.displayName||s.name:"")?X(s):""}function ce(s){switch(s.tag){case 5:return X(s.type);case 16:return X("Lazy");case 13:return X("Suspense");case 19:return X("SuspenseList");case 0:case 2:case 15:return s=be(s.type,!1),s;case 11:return s=be(s.type.render,!1),s;case 1:return s=be(s.type,!0),s;default:return""}}function le(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 E:return"Fragment";case B:return"Portal";case H:return"Profiler";case A:return"StrictMode";case K:return"Suspense";case O:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case Y:return(s.displayName||"Context")+".Consumer";case _:return(s._context.displayName||"Context")+".Provider";case z:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case F:return l=s.displayName||null,l!==null?l:le(s.type)||"Memo";case te:l=s._payload,s=s._init;try{return le(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 le(l);case 8:return l===A?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof l=="function")return l.displayName||l.name||null;if(typeof l=="string")return l}return null}function Se(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function _e(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function Ce(s){var l=_e(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(R){b=""+R,S.call(this,R)}}),Object.defineProperty(s,l,{enumerable:h.enumerable}),{getValue:function(){return b},setValue:function(R){b=""+R},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function Nt(s){s._valueTracker||(s._valueTracker=Ce(s))}function ct(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var h=l.getValue(),b="";return s&&(b=_e(s)?s.checked?"true":"false":s.value),s=b,s!==h?(l.setValue(s),!0):!1}function gt(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 ft(s,l){var h=l.checked;return N({},l,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:h??s._wrapperState.initialChecked})}function rt(s,l){var h=l.defaultValue==null?"":l.defaultValue,b=l.checked!=null?l.checked:l.defaultChecked;h=Se(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 fe(s,l){l=l.checked,l!=null&&I(s,"checked",l,!1)}function ue(s,l){fe(s,l);var h=Se(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")?qe(s,l.type,h):l.hasOwnProperty("defaultValue")&&qe(s,l.type,Se(l.defaultValue)),l.checked==null&&l.defaultChecked!=null&&(s.defaultChecked=!!l.defaultChecked)}function Oe(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 qe(s,l,h){(l!=="number"||gt(s.ownerDocument)!==s)&&(h==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+h&&(s.defaultValue=""+h))}var nt=Array.isArray;function yt(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=""+Se(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 Me(s,l){if(l.dangerouslySetInnerHTML!=null)throw Error(r(91));return N({},l,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function Le(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(nt(h)){if(1<h.length)throw Error(r(93));h=h[0]}l=h}l==null&&(l=""),h=l}s._wrapperState={initialValue:Se(h)}}function pt(s,l){var h=Se(l.value),b=Se(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 ut(s){var l=s.textContent;l===s._wrapperState.initialValue&&l!==""&&l!==null&&(s.value=l)}function we(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 xe(s,l){return s==null||s==="http://www.w3.org/1999/xhtml"?we(l):s==="http://www.w3.org/2000/svg"&&l==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var Qe,Fe=(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(Qe=Qe||document.createElement("div"),Qe.innerHTML="<svg>"+l.valueOf().toString()+"</svg>",l=Qe.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;l.firstChild;)s.appendChild(l.firstChild)}});function dt(s,l){if(l){var h=s.firstChild;if(h&&h===s.lastChild&&h.nodeType===3){h.nodeValue=l;return}}s.textContent=l}var It={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},qt=["Webkit","ms","Moz","O"];Object.keys(It).forEach(function(s){qt.forEach(function(l){l=l+s.charAt(0).toUpperCase()+s.substring(1),It[l]=It[s]})});function Ht(s,l,h){return l==null||typeof l=="boolean"||l===""?"":h||typeof l!="number"||l===0||It.hasOwnProperty(s)&&It[s]?(""+l).trim():l+"px"}function Ft(s,l){s=s.style;for(var h in l)if(l.hasOwnProperty(h)){var b=h.indexOf("--")===0,k=Ht(h,l[h],b);h==="float"&&(h="cssFloat"),b?s.setProperty(h,k):s[h]=k}}var Dt=N({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 bt(s,l){if(l){if(Dt[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 Qt(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 zt=null;function on(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ae=null,$e=null,ht=null;function Wt(s){if(s=$l(s)){if(typeof ae!="function")throw Error(r(280));var l=s.stateNode;l&&(l=Du(l),ae(s.stateNode,s.type,l))}}function jn(s){$e?ht?ht.push(s):ht=[s]:$e=s}function ln(){if($e){var s=$e,l=ht;if(ht=$e=null,Wt(s),l)for(s=0;s<l.length;s++)Wt(l[s])}}function Ut(s,l){return s(l)}function dn(){}var Jt=!1;function nn(s,l,h){if(Jt)return s(l,h);Jt=!0;try{return Ut(s,l,h)}finally{Jt=!1,($e!==null||ht!==null)&&(dn(),ln())}}function hn(s,l){var h=s.stateNode;if(h===null)return null;var b=Du(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 ee=!1;if(d)try{var ne={};Object.defineProperty(ne,"passive",{get:function(){ee=!0}}),window.addEventListener("test",ne,ne),window.removeEventListener("test",ne,ne)}catch{ee=!1}function pe(s,l,h,b,k,S,R,J,se){var De=Array.prototype.slice.call(arguments,3);try{l.apply(h,De)}catch(ze){this.onError(ze)}}var ve=!1,We=null,Ye=!1,mt=null,Je={onError:function(s){ve=!0,We=s}};function Ke(s,l,h,b,k,S,R,J,se){ve=!1,We=null,pe.apply(Je,arguments)}function re(s,l,h,b,k,S,R,J,se){if(Ke.apply(this,arguments),ve){if(ve){var De=We;ve=!1,We=null}else throw Error(r(198));Ye||(Ye=!0,mt=De)}}function Pe(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 ot(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 kt(s){if(Pe(s)!==s)throw Error(r(188))}function an(s){var l=s.alternate;if(!l){if(l=Pe(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 kt(k),s;if(S===b)return kt(k),l;S=S.sibling}throw Error(r(188))}if(h.return!==b.return)h=k,b=S;else{for(var R=!1,J=k.child;J;){if(J===h){R=!0,h=k,b=S;break}if(J===b){R=!0,b=k,h=S;break}J=J.sibling}if(!R){for(J=S.child;J;){if(J===h){R=!0,h=S,b=k;break}if(J===b){R=!0,b=S,h=k;break}J=J.sibling}if(!R)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 $t(s){return s=an(s),s!==null?Bt(s):null}function Bt(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var l=Bt(s);if(l!==null)return l;s=s.sibling}return null}var _t=t.unstable_scheduleCallback,Sn=t.unstable_cancelCallback,On=t.unstable_shouldYield,Mn=t.unstable_requestPaint,Tt=t.unstable_now,fn=t.unstable_getCurrentPriorityLevel,Xt=t.unstable_ImmediatePriority,kn=t.unstable_UserBlockingPriority,Te=t.unstable_NormalPriority,Be=t.unstable_LowPriority,lt=t.unstable_IdlePriority,Mt=null,rn=null;function Nn(s){if(rn&&typeof rn.onCommitFiberRoot=="function")try{rn.onCommitFiberRoot(Mt,s,void 0,(s.current.flags&128)===128)}catch{}}var Vt=Math.clz32?Math.clz32:En,Un=Math.log,qn=Math.LN2;function En(s){return s>>>=0,s===0?32:31-(Un(s)/qn|0)|0}var Dn=64,zr=4194304;function hr(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 qr(s,l){var h=s.pendingLanes;if(h===0)return 0;var b=0,k=s.suspendedLanes,S=s.pingedLanes,R=h&268435455;if(R!==0){var J=R&~k;J!==0?b=hr(J):(S&=R,S!==0&&(b=hr(S)))}else R=h&~k,R!==0?b=hr(R):S!==0&&(b=hr(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-Vt(l),k=1<<h,b|=s[h],l&=~k;return b}function xn(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 $r(s,l){for(var h=s.suspendedLanes,b=s.pingedLanes,k=s.expirationTimes,S=s.pendingLanes;0<S;){var R=31-Vt(S),J=1<<R,se=k[R];se===-1?((J&h)===0||(J&b)!==0)&&(k[R]=xn(J,l)):se<=l&&(s.expiredLanes|=J),S&=~J}}function br(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function In(){var s=Dn;return Dn<<=1,(Dn&4194240)===0&&(Dn=64),s}function Mr(s){for(var l=[],h=0;31>h;h++)l.push(s);return l}function Bn(s,l,h){s.pendingLanes|=l,l!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,l=31-Vt(l),s[l]=h}function Q(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-Vt(h),S=1<<k;l[k]=0,b[k]=-1,s[k]=-1,h&=~S}}function je(s,l){var h=s.entangledLanes|=l;for(s=s.entanglements;h;){var b=31-Vt(h),k=1<<b;k&l|s[b]&l&&(s[b]|=l),h&=~k}}var G=0;function Ee(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Ge,At,gn,bn,wn,oi=!1,li=[],Ar=null,Rn=null,Or=null,Vr=new Map,Ot=new Map,Br=[],Ii="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 Fs(s,l){switch(s){case"focusin":case"focusout":Ar=null;break;case"dragenter":case"dragleave":Rn=null;break;case"mouseover":case"mouseout":Or=null;break;case"pointerover":case"pointerout":Vr.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ot.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=$l(l),l!==null&&At(l)),s):(s.eventSystemFlags|=b,l=s.targetContainers,k!==null&&l.indexOf(k)===-1&&l.push(k),s)}function he(s,l,h,b,k){switch(l){case"focusin":return Ar=$(Ar,s,l,h,b,k),!0;case"dragenter":return Rn=$(Rn,s,l,h,b,k),!0;case"mouseover":return Or=$(Or,s,l,h,b,k),!0;case"pointerover":var S=k.pointerId;return Vr.set(S,$(Vr.get(S)||null,s,l,h,b,k)),!0;case"gotpointercapture":return S=k.pointerId,Ot.set(S,$(Ot.get(S)||null,s,l,h,b,k)),!0}return!1}function me(s){var l=Ka(s.target);if(l!==null){var h=Pe(l);if(h!==null){if(l=h.tag,l===13){if(l=ot(h),l!==null){s.blockedOn=l,wn(s.priority,function(){gn(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 et(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var h=Er(s.domEventName,s.eventSystemFlags,l[0],s.nativeEvent);if(h===null){h=s.nativeEvent;var b=new h.constructor(h.type,h);zt=b,h.target.dispatchEvent(b),zt=null}else return l=$l(h),l!==null&&At(l),s.blockedOn=h,!1;l.shift()}return!0}function st(s,l,h){et(s)&&h.delete(l)}function xt(){oi=!1,Ar!==null&&et(Ar)&&(Ar=null),Rn!==null&&et(Rn)&&(Rn=null),Or!==null&&et(Or)&&(Or=null),Vr.forEach(st),Ot.forEach(st)}function Zt(s,l){s.blockedOn===l&&(s.blockedOn=null,oi||(oi=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,xt)))}function Ln(s){function l(k){return Zt(k,s)}if(0<li.length){Zt(li[0],s);for(var h=1;h<li.length;h++){var b=li[h];b.blockedOn===s&&(b.blockedOn=null)}}for(Ar!==null&&Zt(Ar,s),Rn!==null&&Zt(Rn,s),Or!==null&&Zt(Or,s),Vr.forEach(l),Ot.forEach(l),h=0;h<Br.length;h++)b=Br[h],b.blockedOn===s&&(b.blockedOn=null);for(;0<Br.length&&(h=Br[0],h.blockedOn===null);)me(h),h.blockedOn===null&&Br.shift()}var sr=Z.ReactCurrentBatchConfig,Sr=!0;function sa(s,l,h,b){var k=G,S=sr.transition;sr.transition=null;try{G=1,Ci(s,l,h,b)}finally{G=k,sr.transition=S}}function ci(s,l,h,b){var k=G,S=sr.transition;sr.transition=null;try{G=4,Ci(s,l,h,b)}finally{G=k,sr.transition=S}}function Ci(s,l,h,b){if(Sr){var k=Er(s,l,h,b);if(k===null)xm(s,l,b,ns,h),Fs(s,b);else if(he(k,s,l,h,b))b.stopPropagation();else if(Fs(s,b),l&4&&-1<Ii.indexOf(s)){for(;k!==null;){var S=$l(k);if(S!==null&&Ge(S),S=Er(s,l,h,b),S===null&&xm(s,l,b,ns,h),S===k)break;k=S}k!==null&&b.stopPropagation()}else xm(s,l,b,null,h)}}var ns=null;function Er(s,l,h,b){if(ns=null,s=on(b),s=Ka(s),s!==null)if(l=Pe(s),l===null)s=null;else if(h=l.tag,h===13){if(s=ot(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 ns=s,null}function aa(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 Xt:return 1;case kn:return 4;case Te:case Be:return 16;case lt:return 536870912;default:return 16}default:return 16}}var ri=null,za=null,oa=null;function Mo(){if(oa)return oa;var s,l=za,h=l.length,b,k="value"in ri?ri.value:ri.textContent,S=k.length;for(s=0;s<h&&l[s]===k[s];s++);var R=h-s;for(b=1;b<=R&&l[h-b]===k[S-b];b++);return oa=k.slice(s,1<b?1-b:void 0)}function la(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 ca(){return!0}function Ao(){return!1}function Ir(s){function l(h,b,k,S,R){this._reactName=h,this._targetInst=k,this.type=b,this.nativeEvent=S,this.target=R,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)?ca:Ao,this.isPropagationStopped=Ao,this}return N(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=ca)},stopPropagation:function(){var h=this.nativeEvent;h&&(h.stopPropagation?h.stopPropagation():typeof h.cancelBubble!="unknown"&&(h.cancelBubble=!0),this.isPropagationStopped=ca)},persist:function(){},isPersistent:ca}),l}var Wr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vs=Ir(Wr),Li=N({},Wr,{view:0,detail:0}),qa=Ir(Li),ua,da,Fi,_s=N({},Li,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Fn,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!==Fi&&(Fi&&s.type==="mousemove"?(ua=s.screenX-Fi.screenX,da=s.screenY-Fi.screenY):da=ua=0,Fi=s),ua)},movementY:function(s){return"movementY"in s?s.movementY:da}}),rs=Ir(_s),$a=N({},_s,{dataTransfer:0}),V=Ir($a),ge=N({},Li,{relatedTarget:0}),Ie=Ir(ge),at=N({},Wr,{animationName:0,elapsedTime:0,pseudoElement:0}),vt=Ir(at),un=N({},Wr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),Lt=Ir(un),Qn=N({},Wr,{data:0}),Gr=Ir(Qn),$n={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Cr={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"},ji={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function _i(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=ji[s])?!!l[s]:!1}function Fn(){return _i}var ws=N({},Li,{key:function(s){if(s.key){var l=$n[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=la(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?Cr[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Fn,charCode:function(s){return s.type==="keypress"?la(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?la(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),Oi=Ir(ws),Wn=N({},_s,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Va=Ir(Wn),ha=N({},Li,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Fn}),Eo=Ir(ha),Io=N({},Wr,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lo=Ir(Io),Fo=N({},_s,{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}),ys=Ir(Fo),U=[9,13,27,32],ie=d&&"CompositionEvent"in window,Re=null;d&&"documentMode"in document&&(Re=document.documentMode);var tt=d&&"TextEvent"in window&&!Re,St=d&&(!ie||Re&&8<Re&&11>=Re),Ct=" ",mn=!1;function Vn(s,l){switch(s){case"keyup":return U.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function An(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var sn=!1;function jr(s,l){switch(s){case"compositionend":return An(l);case"keypress":return l.which!==32?null:(mn=!0,Ct);case"textInput":return s=l.data,s===Ct&&mn?null:s;default:return null}}function Os(s,l){if(sn)return s==="compositionend"||!ie&&Vn(s,l)?(s=Mo(),oa=za=ri=null,sn=!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 St&&l.locale!=="ko"?null:l.data;default:return null}}var Ni={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 ma(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!Ni[s.type]:l==="textarea"}function _l(s,l,h,b){jn(b),l=Nu(l,"onChange"),0<l.length&&(h=new vs("onChange","change",null,h,b),s.push({event:h,listeners:l}))}var Ga=null,Ol=null;function J0(s){$v(s,0)}function xu(s){var l=Uo(s);if(ct(l))return s}function Z0(s,l){if(s==="change")return l}var Pv=!1;if(d){var mm;if(d){var pm="oninput"in document;if(!pm){var Dv=document.createElement("div");Dv.setAttribute("oninput","return;"),pm=typeof Dv.oninput=="function"}mm=pm}else mm=!1;Pv=mm&&(!document.documentMode||9<document.documentMode)}function Rv(){Ga&&(Ga.detachEvent("onpropertychange",Mv),Ol=Ga=null)}function Mv(s){if(s.propertyName==="value"&&xu(Ol)){var l=[];_l(l,Ol,s,on(s)),nn(J0,l)}}function eR(s,l,h){s==="focusin"?(Rv(),Ga=l,Ol=h,Ga.attachEvent("onpropertychange",Mv)):s==="focusout"&&Rv()}function tR(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return xu(Ol)}function nR(s,l){if(s==="click")return xu(l)}function rR(s,l){if(s==="input"||s==="change")return xu(l)}function iR(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var is=typeof Object.is=="function"?Object.is:iR;function Bl(s,l){if(is(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)||!is(s[k],l[k]))return!1}return!0}function Av(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Ev(s,l){var h=Av(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=Av(h)}}function Iv(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?Iv(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function Lv(){for(var s=window,l=gt();l instanceof s.HTMLIFrameElement;){try{var h=typeof l.contentWindow.location.href=="string"}catch{h=!1}if(h)s=l.contentWindow;else break;l=gt(s.document)}return l}function fm(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 sR(s){var l=Lv(),h=s.focusedElem,b=s.selectionRange;if(l!==h&&h&&h.ownerDocument&&Iv(h.ownerDocument.documentElement,h)){if(b!==null&&fm(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=Ev(h,S);var R=Ev(h,b);k&&R&&(s.rangeCount!==1||s.anchorNode!==k.node||s.anchorOffset!==k.offset||s.focusNode!==R.node||s.focusOffset!==R.offset)&&(l=l.createRange(),l.setStart(k.node,k.offset),s.removeAllRanges(),S>b?(s.addRange(l),s.extend(R.node,R.offset)):(l.setEnd(R.node,R.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 aR=d&&"documentMode"in document&&11>=document.documentMode,_o=null,gm=null,Wl=null,bm=!1;function Fv(s,l,h){var b=h.window===h?h.document:h.nodeType===9?h:h.ownerDocument;bm||_o==null||_o!==gt(b)||(b=_o,"selectionStart"in b&&fm(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}),Wl&&Bl(Wl,b)||(Wl=b,b=Nu(gm,"onSelect"),0<b.length&&(l=new vs("onSelect","select",null,l,h),s.push({event:l,listeners:b}),l.target=_o)))}function Su(s,l){var h={};return h[s.toLowerCase()]=l.toLowerCase(),h["Webkit"+s]="webkit"+l,h["Moz"+s]="moz"+l,h}var Oo={animationend:Su("Animation","AnimationEnd"),animationiteration:Su("Animation","AnimationIteration"),animationstart:Su("Animation","AnimationStart"),transitionend:Su("Transition","TransitionEnd")},vm={},_v={};d&&(_v=document.createElement("div").style,"AnimationEvent"in window||(delete Oo.animationend.animation,delete Oo.animationiteration.animation,delete Oo.animationstart.animation),"TransitionEvent"in window||delete Oo.transitionend.transition);function Cu(s){if(vm[s])return vm[s];if(!Oo[s])return s;var l=Oo[s],h;for(h in l)if(l.hasOwnProperty(h)&&h in _v)return vm[s]=l[h];return s}var Ov=Cu("animationend"),Bv=Cu("animationiteration"),Wv=Cu("animationstart"),Uv=Cu("transitionend"),Hv=new Map,zv="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 pa(s,l){Hv.set(s,l),u(l,[s])}for(var wm=0;wm<zv.length;wm++){var ym=zv[wm],oR=ym.toLowerCase(),lR=ym[0].toUpperCase()+ym.slice(1);pa(oR,"on"+lR)}pa(Ov,"onAnimationEnd"),pa(Bv,"onAnimationIteration"),pa(Wv,"onAnimationStart"),pa("dblclick","onDoubleClick"),pa("focusin","onFocus"),pa("focusout","onBlur"),pa(Uv,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),u("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),u("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),u("onBeforeInput",["compositionend","keypress","textInput","paste"]),u("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),u("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ul="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(" "),cR=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ul));function qv(s,l,h){var b=s.type||"unknown-event";s.currentTarget=h,re(b,l,void 0,s),s.currentTarget=null}function $v(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 R=b.length-1;0<=R;R--){var J=b[R],se=J.instance,De=J.currentTarget;if(J=J.listener,se!==S&&k.isPropagationStopped())break e;qv(k,J,De),S=se}else for(R=0;R<b.length;R++){if(J=b[R],se=J.instance,De=J.currentTarget,J=J.listener,se!==S&&k.isPropagationStopped())break e;qv(k,J,De),S=se}}}if(Ye)throw s=mt,Ye=!1,mt=null,s}function Jn(s,l){var h=l[Pm];h===void 0&&(h=l[Pm]=new Set);var b=s+"__bubble";h.has(b)||(Vv(l,s,2,!1),h.add(b))}function km(s,l,h){var b=0;l&&(b|=4),Vv(h,s,b,l)}var ju="_reactListening"+Math.random().toString(36).slice(2);function Hl(s){if(!s[ju]){s[ju]=!0,i.forEach(function(h){h!=="selectionchange"&&(cR.has(h)||km(h,!1,s),km(h,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[ju]||(l[ju]=!0,km("selectionchange",!1,l))}}function Vv(s,l,h,b){switch(aa(l)){case 1:var k=sa;break;case 4:k=ci;break;default:k=Ci}h=k.bind(null,l,h,s),k=void 0,!ee||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 xm(s,l,h,b,k){var S=b;if((l&1)===0&&(l&2)===0&&b!==null)e:for(;;){if(b===null)return;var R=b.tag;if(R===3||R===4){var J=b.stateNode.containerInfo;if(J===k||J.nodeType===8&&J.parentNode===k)break;if(R===4)for(R=b.return;R!==null;){var se=R.tag;if((se===3||se===4)&&(se=R.stateNode.containerInfo,se===k||se.nodeType===8&&se.parentNode===k))return;R=R.return}for(;J!==null;){if(R=Ka(J),R===null)return;if(se=R.tag,se===5||se===6){b=S=R;continue e}J=J.parentNode}}b=b.return}nn(function(){var De=S,ze=on(h),Ve=[];e:{var He=Hv.get(s);if(He!==void 0){var wt=vs,Pt=s;switch(s){case"keypress":if(la(h)===0)break e;case"keydown":case"keyup":wt=Oi;break;case"focusin":Pt="focus",wt=Ie;break;case"focusout":Pt="blur",wt=Ie;break;case"beforeblur":case"afterblur":wt=Ie;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":wt=rs;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":wt=V;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":wt=Eo;break;case Ov:case Bv:case Wv:wt=vt;break;case Uv:wt=Lo;break;case"scroll":wt=qa;break;case"wheel":wt=ys;break;case"copy":case"cut":case"paste":wt=Lt;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":wt=Va}var Rt=(l&4)!==0,mr=!Rt&&s==="scroll",ke=Rt?He!==null?He+"Capture":null:He;Rt=[];for(var oe=De,Ne;oe!==null;){Ne=oe;var Ze=Ne.stateNode;if(Ne.tag===5&&Ze!==null&&(Ne=Ze,ke!==null&&(Ze=hn(oe,ke),Ze!=null&&Rt.push(zl(oe,Ze,Ne)))),mr)break;oe=oe.return}0<Rt.length&&(He=new wt(He,Pt,null,h,ze),Ve.push({event:He,listeners:Rt}))}}if((l&7)===0){e:{if(He=s==="mouseover"||s==="pointerover",wt=s==="mouseout"||s==="pointerout",He&&h!==zt&&(Pt=h.relatedTarget||h.fromElement)&&(Ka(Pt)||Pt[Bs]))break e;if((wt||He)&&(He=ze.window===ze?ze:(He=ze.ownerDocument)?He.defaultView||He.parentWindow:window,wt?(Pt=h.relatedTarget||h.toElement,wt=De,Pt=Pt?Ka(Pt):null,Pt!==null&&(mr=Pe(Pt),Pt!==mr||Pt.tag!==5&&Pt.tag!==6)&&(Pt=null)):(wt=null,Pt=De),wt!==Pt)){if(Rt=rs,Ze="onMouseLeave",ke="onMouseEnter",oe="mouse",(s==="pointerout"||s==="pointerover")&&(Rt=Va,Ze="onPointerLeave",ke="onPointerEnter",oe="pointer"),mr=wt==null?He:Uo(wt),Ne=Pt==null?He:Uo(Pt),He=new Rt(Ze,oe+"leave",wt,h,ze),He.target=mr,He.relatedTarget=Ne,Ze=null,Ka(ze)===De&&(Rt=new Rt(ke,oe+"enter",Pt,h,ze),Rt.target=Ne,Rt.relatedTarget=mr,Ze=Rt),mr=Ze,wt&&Pt)t:{for(Rt=wt,ke=Pt,oe=0,Ne=Rt;Ne;Ne=Bo(Ne))oe++;for(Ne=0,Ze=ke;Ze;Ze=Bo(Ze))Ne++;for(;0<oe-Ne;)Rt=Bo(Rt),oe--;for(;0<Ne-oe;)ke=Bo(ke),Ne--;for(;oe--;){if(Rt===ke||ke!==null&&Rt===ke.alternate)break t;Rt=Bo(Rt),ke=Bo(ke)}Rt=null}else Rt=null;wt!==null&&Gv(Ve,He,wt,Rt,!1),Pt!==null&&mr!==null&&Gv(Ve,mr,Pt,Rt,!0)}}e:{if(He=De?Uo(De):window,wt=He.nodeName&&He.nodeName.toLowerCase(),wt==="select"||wt==="input"&&He.type==="file")var Et=Z0;else if(ma(He))if(Pv)Et=rR;else{Et=tR;var Gt=eR}else(wt=He.nodeName)&&wt.toLowerCase()==="input"&&(He.type==="checkbox"||He.type==="radio")&&(Et=nR);if(Et&&(Et=Et(s,De))){_l(Ve,Et,h,ze);break e}Gt&&Gt(s,He,De),s==="focusout"&&(Gt=He._wrapperState)&&Gt.controlled&&He.type==="number"&&qe(He,"number",He.value)}switch(Gt=De?Uo(De):window,s){case"focusin":(ma(Gt)||Gt.contentEditable==="true")&&(_o=Gt,gm=De,Wl=null);break;case"focusout":Wl=gm=_o=null;break;case"mousedown":bm=!0;break;case"contextmenu":case"mouseup":case"dragend":bm=!1,Fv(Ve,h,ze);break;case"selectionchange":if(aR)break;case"keydown":case"keyup":Fv(Ve,h,ze)}var Kt;if(ie)e:{switch(s){case"compositionstart":var en="onCompositionStart";break e;case"compositionend":en="onCompositionEnd";break e;case"compositionupdate":en="onCompositionUpdate";break e}en=void 0}else sn?Vn(s,h)&&(en="onCompositionEnd"):s==="keydown"&&h.keyCode===229&&(en="onCompositionStart");en&&(St&&h.locale!=="ko"&&(sn||en!=="onCompositionStart"?en==="onCompositionEnd"&&sn&&(Kt=Mo()):(ri=ze,za="value"in ri?ri.value:ri.textContent,sn=!0)),Gt=Nu(De,en),0<Gt.length&&(en=new Gr(en,s,null,h,ze),Ve.push({event:en,listeners:Gt}),Kt?en.data=Kt:(Kt=An(h),Kt!==null&&(en.data=Kt)))),(Kt=tt?jr(s,h):Os(s,h))&&(De=Nu(De,"onBeforeInput"),0<De.length&&(ze=new Gr("onBeforeInput","beforeinput",null,h,ze),Ve.push({event:ze,listeners:De}),ze.data=Kt))}$v(Ve,l)})}function zl(s,l,h){return{instance:s,listener:l,currentTarget:h}}function Nu(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(zl(s,S,k)),S=hn(s,l),S!=null&&b.push(zl(s,S,k))),s=s.return}return b}function Bo(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Gv(s,l,h,b,k){for(var S=l._reactName,R=[];h!==null&&h!==b;){var J=h,se=J.alternate,De=J.stateNode;if(se!==null&&se===b)break;J.tag===5&&De!==null&&(J=De,k?(se=hn(h,S),se!=null&&R.unshift(zl(h,se,J))):k||(se=hn(h,S),se!=null&&R.push(zl(h,se,J)))),h=h.return}R.length!==0&&s.push({event:l,listeners:R})}var uR=/\r\n?/g,dR=/\u0000|\uFFFD/g;function Kv(s){return(typeof s=="string"?s:""+s).replace(uR,`
|
|
39
|
+
`).replace(dR,"")}function Tu(s,l,h){if(l=Kv(l),Kv(s)!==l&&h)throw Error(r(425))}function Pu(){}var Sm=null,Cm=null;function jm(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 Nm=typeof setTimeout=="function"?setTimeout:void 0,hR=typeof clearTimeout=="function"?clearTimeout:void 0,Yv=typeof Promise=="function"?Promise:void 0,mR=typeof queueMicrotask=="function"?queueMicrotask:typeof Yv<"u"?function(s){return Yv.resolve(null).then(s).catch(pR)}:Nm;function pR(s){setTimeout(function(){throw s})}function Tm(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),Ln(l);return}b--}else h!=="$"&&h!=="$?"&&h!=="$!"||b++;h=k}while(h);Ln(l)}function fa(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 Xv(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 Wo=Math.random().toString(36).slice(2),ks="__reactFiber$"+Wo,ql="__reactProps$"+Wo,Bs="__reactContainer$"+Wo,Pm="__reactEvents$"+Wo,fR="__reactListeners$"+Wo,gR="__reactHandles$"+Wo;function Ka(s){var l=s[ks];if(l)return l;for(var h=s.parentNode;h;){if(l=h[Bs]||h[ks]){if(h=l.alternate,l.child!==null||h!==null&&h.child!==null)for(s=Xv(s);s!==null;){if(h=s[ks])return h;s=Xv(s)}return l}s=h,h=s.parentNode}return null}function $l(s){return s=s[ks]||s[Bs],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function Uo(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(r(33))}function Du(s){return s[ql]||null}var Dm=[],Ho=-1;function ga(s){return{current:s}}function Zn(s){0>Ho||(s.current=Dm[Ho],Dm[Ho]=null,Ho--)}function Gn(s,l){Ho++,Dm[Ho]=s.current,s.current=l}var ba={},Kr=ga(ba),ui=ga(!1),Ya=ba;function zo(s,l){var h=s.type.contextTypes;if(!h)return ba;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 di(s){return s=s.childContextTypes,s!=null}function Ru(){Zn(ui),Zn(Kr)}function Qv(s,l,h){if(Kr.current!==ba)throw Error(r(168));Gn(Kr,l),Gn(ui,h)}function Jv(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 N({},h,b)}function Mu(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||ba,Ya=Kr.current,Gn(Kr,s),Gn(ui,ui.current),!0}function Zv(s,l,h){var b=s.stateNode;if(!b)throw Error(r(169));h?(s=Jv(s,l,Ya),b.__reactInternalMemoizedMergedChildContext=s,Zn(ui),Zn(Kr),Gn(Kr,s)):Zn(ui),Gn(ui,h)}var Ws=null,Au=!1,Rm=!1;function ew(s){Ws===null?Ws=[s]:Ws.push(s)}function bR(s){Au=!0,ew(s)}function va(){if(!Rm&&Ws!==null){Rm=!0;var s=0,l=G;try{var h=Ws;for(G=1;s<h.length;s++){var b=h[s];do b=b(!0);while(b!==null)}Ws=null,Au=!1}catch(k){throw Ws!==null&&(Ws=Ws.slice(s+1)),_t(Xt,va),k}finally{G=l,Rm=!1}}return null}var qo=[],$o=0,Eu=null,Iu=0,Bi=[],Wi=0,Xa=null,Us=1,Hs="";function Qa(s,l){qo[$o++]=Iu,qo[$o++]=Eu,Eu=s,Iu=l}function tw(s,l,h){Bi[Wi++]=Us,Bi[Wi++]=Hs,Bi[Wi++]=Xa,Xa=s;var b=Us;s=Hs;var k=32-Vt(b)-1;b&=~(1<<k),h+=1;var S=32-Vt(l)+k;if(30<S){var R=k-k%5;S=(b&(1<<R)-1).toString(32),b>>=R,k-=R,Us=1<<32-Vt(l)+k|h<<k|b,Hs=S+s}else Us=1<<S|h<<k|b,Hs=s}function Mm(s){s.return!==null&&(Qa(s,1),tw(s,1,0))}function Am(s){for(;s===Eu;)Eu=qo[--$o],qo[$o]=null,Iu=qo[--$o],qo[$o]=null;for(;s===Xa;)Xa=Bi[--Wi],Bi[Wi]=null,Hs=Bi[--Wi],Bi[Wi]=null,Us=Bi[--Wi],Bi[Wi]=null}var Ti=null,Pi=null,er=!1,ss=null;function nw(s,l){var h=qi(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 rw(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,Ti=s,Pi=fa(l.firstChild),!0):!1;case 6:return l=s.pendingProps===""||l.nodeType!==3?null:l,l!==null?(s.stateNode=l,Ti=s,Pi=null,!0):!1;case 13:return l=l.nodeType!==8?null:l,l!==null?(h=Xa!==null?{id:Us,overflow:Hs}:null,s.memoizedState={dehydrated:l,treeContext:h,retryLane:1073741824},h=qi(18,null,null,0),h.stateNode=l,h.return=s,s.child=h,Ti=s,Pi=null,!0):!1;default:return!1}}function Em(s){return(s.mode&1)!==0&&(s.flags&128)===0}function Im(s){if(er){var l=Pi;if(l){var h=l;if(!rw(s,l)){if(Em(s))throw Error(r(418));l=fa(h.nextSibling);var b=Ti;l&&rw(s,l)?nw(b,h):(s.flags=s.flags&-4097|2,er=!1,Ti=s)}}else{if(Em(s))throw Error(r(418));s.flags=s.flags&-4097|2,er=!1,Ti=s}}}function iw(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Ti=s}function Lu(s){if(s!==Ti)return!1;if(!er)return iw(s),er=!0,!1;var l;if((l=s.tag!==3)&&!(l=s.tag!==5)&&(l=s.type,l=l!=="head"&&l!=="body"&&!jm(s.type,s.memoizedProps)),l&&(l=Pi)){if(Em(s))throw sw(),Error(r(418));for(;l;)nw(s,l),l=fa(l.nextSibling)}if(iw(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){Pi=fa(s.nextSibling);break e}l--}else h!=="$"&&h!=="$!"&&h!=="$?"||l++}s=s.nextSibling}Pi=null}}else Pi=Ti?fa(s.stateNode.nextSibling):null;return!0}function sw(){for(var s=Pi;s;)s=fa(s.nextSibling)}function Vo(){Pi=Ti=null,er=!1}function Lm(s){ss===null?ss=[s]:ss.push(s)}var vR=Z.ReactCurrentBatchConfig;function Vl(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(R){var J=k.refs;R===null?delete J[S]:J[S]=R},l._stringRef=S,l)}if(typeof s!="string")throw Error(r(284));if(!h._owner)throw Error(r(290,s))}return s}function Fu(s,l){throw s=Object.prototype.toString.call(l),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s))}function aw(s){var l=s._init;return l(s._payload)}function ow(s){function l(ke,oe){if(s){var Ne=ke.deletions;Ne===null?(ke.deletions=[oe],ke.flags|=16):Ne.push(oe)}}function h(ke,oe){if(!s)return null;for(;oe!==null;)l(ke,oe),oe=oe.sibling;return null}function b(ke,oe){for(ke=new Map;oe!==null;)oe.key!==null?ke.set(oe.key,oe):ke.set(oe.index,oe),oe=oe.sibling;return ke}function k(ke,oe){return ke=Na(ke,oe),ke.index=0,ke.sibling=null,ke}function S(ke,oe,Ne){return ke.index=Ne,s?(Ne=ke.alternate,Ne!==null?(Ne=Ne.index,Ne<oe?(ke.flags|=2,oe):Ne):(ke.flags|=2,oe)):(ke.flags|=1048576,oe)}function R(ke){return s&&ke.alternate===null&&(ke.flags|=2),ke}function J(ke,oe,Ne,Ze){return oe===null||oe.tag!==6?(oe=Np(Ne,ke.mode,Ze),oe.return=ke,oe):(oe=k(oe,Ne),oe.return=ke,oe)}function se(ke,oe,Ne,Ze){var Et=Ne.type;return Et===E?ze(ke,oe,Ne.props.children,Ze,Ne.key):oe!==null&&(oe.elementType===Et||typeof Et=="object"&&Et!==null&&Et.$$typeof===te&&aw(Et)===oe.type)?(Ze=k(oe,Ne.props),Ze.ref=Vl(ke,oe,Ne),Ze.return=ke,Ze):(Ze=ad(Ne.type,Ne.key,Ne.props,null,ke.mode,Ze),Ze.ref=Vl(ke,oe,Ne),Ze.return=ke,Ze)}function De(ke,oe,Ne,Ze){return oe===null||oe.tag!==4||oe.stateNode.containerInfo!==Ne.containerInfo||oe.stateNode.implementation!==Ne.implementation?(oe=Tp(Ne,ke.mode,Ze),oe.return=ke,oe):(oe=k(oe,Ne.children||[]),oe.return=ke,oe)}function ze(ke,oe,Ne,Ze,Et){return oe===null||oe.tag!==7?(oe=so(Ne,ke.mode,Ze,Et),oe.return=ke,oe):(oe=k(oe,Ne),oe.return=ke,oe)}function Ve(ke,oe,Ne){if(typeof oe=="string"&&oe!==""||typeof oe=="number")return oe=Np(""+oe,ke.mode,Ne),oe.return=ke,oe;if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case q:return Ne=ad(oe.type,oe.key,oe.props,null,ke.mode,Ne),Ne.ref=Vl(ke,null,oe),Ne.return=ke,Ne;case B:return oe=Tp(oe,ke.mode,Ne),oe.return=ke,oe;case te:var Ze=oe._init;return Ve(ke,Ze(oe._payload),Ne)}if(nt(oe)||M(oe))return oe=so(oe,ke.mode,Ne,null),oe.return=ke,oe;Fu(ke,oe)}return null}function He(ke,oe,Ne,Ze){var Et=oe!==null?oe.key:null;if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number")return Et!==null?null:J(ke,oe,""+Ne,Ze);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case q:return Ne.key===Et?se(ke,oe,Ne,Ze):null;case B:return Ne.key===Et?De(ke,oe,Ne,Ze):null;case te:return Et=Ne._init,He(ke,oe,Et(Ne._payload),Ze)}if(nt(Ne)||M(Ne))return Et!==null?null:ze(ke,oe,Ne,Ze,null);Fu(ke,Ne)}return null}function wt(ke,oe,Ne,Ze,Et){if(typeof Ze=="string"&&Ze!==""||typeof Ze=="number")return ke=ke.get(Ne)||null,J(oe,ke,""+Ze,Et);if(typeof Ze=="object"&&Ze!==null){switch(Ze.$$typeof){case q:return ke=ke.get(Ze.key===null?Ne:Ze.key)||null,se(oe,ke,Ze,Et);case B:return ke=ke.get(Ze.key===null?Ne:Ze.key)||null,De(oe,ke,Ze,Et);case te:var Gt=Ze._init;return wt(ke,oe,Ne,Gt(Ze._payload),Et)}if(nt(Ze)||M(Ze))return ke=ke.get(Ne)||null,ze(oe,ke,Ze,Et,null);Fu(oe,Ze)}return null}function Pt(ke,oe,Ne,Ze){for(var Et=null,Gt=null,Kt=oe,en=oe=0,_r=null;Kt!==null&&en<Ne.length;en++){Kt.index>en?(_r=Kt,Kt=null):_r=Kt.sibling;var Pn=He(ke,Kt,Ne[en],Ze);if(Pn===null){Kt===null&&(Kt=_r);break}s&&Kt&&Pn.alternate===null&&l(ke,Kt),oe=S(Pn,oe,en),Gt===null?Et=Pn:Gt.sibling=Pn,Gt=Pn,Kt=_r}if(en===Ne.length)return h(ke,Kt),er&&Qa(ke,en),Et;if(Kt===null){for(;en<Ne.length;en++)Kt=Ve(ke,Ne[en],Ze),Kt!==null&&(oe=S(Kt,oe,en),Gt===null?Et=Kt:Gt.sibling=Kt,Gt=Kt);return er&&Qa(ke,en),Et}for(Kt=b(ke,Kt);en<Ne.length;en++)_r=wt(Kt,ke,en,Ne[en],Ze),_r!==null&&(s&&_r.alternate!==null&&Kt.delete(_r.key===null?en:_r.key),oe=S(_r,oe,en),Gt===null?Et=_r:Gt.sibling=_r,Gt=_r);return s&&Kt.forEach(function(Ta){return l(ke,Ta)}),er&&Qa(ke,en),Et}function Rt(ke,oe,Ne,Ze){var Et=M(Ne);if(typeof Et!="function")throw Error(r(150));if(Ne=Et.call(Ne),Ne==null)throw Error(r(151));for(var Gt=Et=null,Kt=oe,en=oe=0,_r=null,Pn=Ne.next();Kt!==null&&!Pn.done;en++,Pn=Ne.next()){Kt.index>en?(_r=Kt,Kt=null):_r=Kt.sibling;var Ta=He(ke,Kt,Pn.value,Ze);if(Ta===null){Kt===null&&(Kt=_r);break}s&&Kt&&Ta.alternate===null&&l(ke,Kt),oe=S(Ta,oe,en),Gt===null?Et=Ta:Gt.sibling=Ta,Gt=Ta,Kt=_r}if(Pn.done)return h(ke,Kt),er&&Qa(ke,en),Et;if(Kt===null){for(;!Pn.done;en++,Pn=Ne.next())Pn=Ve(ke,Pn.value,Ze),Pn!==null&&(oe=S(Pn,oe,en),Gt===null?Et=Pn:Gt.sibling=Pn,Gt=Pn);return er&&Qa(ke,en),Et}for(Kt=b(ke,Kt);!Pn.done;en++,Pn=Ne.next())Pn=wt(Kt,ke,en,Pn.value,Ze),Pn!==null&&(s&&Pn.alternate!==null&&Kt.delete(Pn.key===null?en:Pn.key),oe=S(Pn,oe,en),Gt===null?Et=Pn:Gt.sibling=Pn,Gt=Pn);return s&&Kt.forEach(function(QR){return l(ke,QR)}),er&&Qa(ke,en),Et}function mr(ke,oe,Ne,Ze){if(typeof Ne=="object"&&Ne!==null&&Ne.type===E&&Ne.key===null&&(Ne=Ne.props.children),typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case q:e:{for(var Et=Ne.key,Gt=oe;Gt!==null;){if(Gt.key===Et){if(Et=Ne.type,Et===E){if(Gt.tag===7){h(ke,Gt.sibling),oe=k(Gt,Ne.props.children),oe.return=ke,ke=oe;break e}}else if(Gt.elementType===Et||typeof Et=="object"&&Et!==null&&Et.$$typeof===te&&aw(Et)===Gt.type){h(ke,Gt.sibling),oe=k(Gt,Ne.props),oe.ref=Vl(ke,Gt,Ne),oe.return=ke,ke=oe;break e}h(ke,Gt);break}else l(ke,Gt);Gt=Gt.sibling}Ne.type===E?(oe=so(Ne.props.children,ke.mode,Ze,Ne.key),oe.return=ke,ke=oe):(Ze=ad(Ne.type,Ne.key,Ne.props,null,ke.mode,Ze),Ze.ref=Vl(ke,oe,Ne),Ze.return=ke,ke=Ze)}return R(ke);case B:e:{for(Gt=Ne.key;oe!==null;){if(oe.key===Gt)if(oe.tag===4&&oe.stateNode.containerInfo===Ne.containerInfo&&oe.stateNode.implementation===Ne.implementation){h(ke,oe.sibling),oe=k(oe,Ne.children||[]),oe.return=ke,ke=oe;break e}else{h(ke,oe);break}else l(ke,oe);oe=oe.sibling}oe=Tp(Ne,ke.mode,Ze),oe.return=ke,ke=oe}return R(ke);case te:return Gt=Ne._init,mr(ke,oe,Gt(Ne._payload),Ze)}if(nt(Ne))return Pt(ke,oe,Ne,Ze);if(M(Ne))return Rt(ke,oe,Ne,Ze);Fu(ke,Ne)}return typeof Ne=="string"&&Ne!==""||typeof Ne=="number"?(Ne=""+Ne,oe!==null&&oe.tag===6?(h(ke,oe.sibling),oe=k(oe,Ne),oe.return=ke,ke=oe):(h(ke,oe),oe=Np(Ne,ke.mode,Ze),oe.return=ke,ke=oe),R(ke)):h(ke,oe)}return mr}var Go=ow(!0),lw=ow(!1),_u=ga(null),Ou=null,Ko=null,Fm=null;function _m(){Fm=Ko=Ou=null}function Om(s){var l=_u.current;Zn(_u),s._currentValue=l}function Bm(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 Yo(s,l){Ou=s,Fm=Ko=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&l)!==0&&(hi=!0),s.firstContext=null)}function Ui(s){var l=s._currentValue;if(Fm!==s)if(s={context:s,memoizedValue:l,next:null},Ko===null){if(Ou===null)throw Error(r(308));Ko=s,Ou.dependencies={lanes:0,firstContext:s}}else Ko=Ko.next=s;return l}var Ja=null;function Wm(s){Ja===null?Ja=[s]:Ja.push(s)}function cw(s,l,h,b){var k=l.interleaved;return k===null?(h.next=h,Wm(l)):(h.next=k.next,k.next=h),l.interleaved=h,zs(s,b)}function zs(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 wa=!1;function Um(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function uw(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 qs(s,l){return{eventTime:s,lane:l,tag:0,payload:null,callback:null,next:null}}function ya(s,l,h){var b=s.updateQueue;if(b===null)return null;if(b=b.shared,(Tn&2)!==0){var k=b.pending;return k===null?l.next=l:(l.next=k.next,k.next=l),b.pending=l,zs(s,h)}return k=b.interleaved,k===null?(l.next=l,Wm(b)):(l.next=k.next,k.next=l),b.interleaved=l,zs(s,h)}function Bu(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,je(s,h)}}function dw(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 R={eventTime:h.eventTime,lane:h.lane,tag:h.tag,payload:h.payload,callback:h.callback,next:null};S===null?k=S=R:S=S.next=R,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 Wu(s,l,h,b){var k=s.updateQueue;wa=!1;var S=k.firstBaseUpdate,R=k.lastBaseUpdate,J=k.shared.pending;if(J!==null){k.shared.pending=null;var se=J,De=se.next;se.next=null,R===null?S=De:R.next=De,R=se;var ze=s.alternate;ze!==null&&(ze=ze.updateQueue,J=ze.lastBaseUpdate,J!==R&&(J===null?ze.firstBaseUpdate=De:J.next=De,ze.lastBaseUpdate=se))}if(S!==null){var Ve=k.baseState;R=0,ze=De=se=null,J=S;do{var He=J.lane,wt=J.eventTime;if((b&He)===He){ze!==null&&(ze=ze.next={eventTime:wt,lane:0,tag:J.tag,payload:J.payload,callback:J.callback,next:null});e:{var Pt=s,Rt=J;switch(He=l,wt=h,Rt.tag){case 1:if(Pt=Rt.payload,typeof Pt=="function"){Ve=Pt.call(wt,Ve,He);break e}Ve=Pt;break e;case 3:Pt.flags=Pt.flags&-65537|128;case 0:if(Pt=Rt.payload,He=typeof Pt=="function"?Pt.call(wt,Ve,He):Pt,He==null)break e;Ve=N({},Ve,He);break e;case 2:wa=!0}}J.callback!==null&&J.lane!==0&&(s.flags|=64,He=k.effects,He===null?k.effects=[J]:He.push(J))}else wt={eventTime:wt,lane:He,tag:J.tag,payload:J.payload,callback:J.callback,next:null},ze===null?(De=ze=wt,se=Ve):ze=ze.next=wt,R|=He;if(J=J.next,J===null){if(J=k.shared.pending,J===null)break;He=J,J=He.next,He.next=null,k.lastBaseUpdate=He,k.shared.pending=null}}while(!0);if(ze===null&&(se=Ve),k.baseState=se,k.firstBaseUpdate=De,k.lastBaseUpdate=ze,l=k.shared.interleaved,l!==null){k=l;do R|=k.lane,k=k.next;while(k!==l)}else S===null&&(k.shared.lanes=0);to|=R,s.lanes=R,s.memoizedState=Ve}}function hw(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 Gl={},xs=ga(Gl),Kl=ga(Gl),Yl=ga(Gl);function Za(s){if(s===Gl)throw Error(r(174));return s}function Hm(s,l){switch(Gn(Yl,l),Gn(Kl,s),Gn(xs,Gl),s=l.nodeType,s){case 9:case 11:l=(l=l.documentElement)?l.namespaceURI:xe(null,"");break;default:s=s===8?l.parentNode:l,l=s.namespaceURI||null,s=s.tagName,l=xe(l,s)}Zn(xs),Gn(xs,l)}function Xo(){Zn(xs),Zn(Kl),Zn(Yl)}function mw(s){Za(Yl.current);var l=Za(xs.current),h=xe(l,s.type);l!==h&&(Gn(Kl,s),Gn(xs,h))}function zm(s){Kl.current===s&&(Zn(xs),Zn(Kl))}var ar=ga(0);function Uu(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 qm=[];function $m(){for(var s=0;s<qm.length;s++)qm[s]._workInProgressVersionPrimary=null;qm.length=0}var Hu=Z.ReactCurrentDispatcher,Vm=Z.ReactCurrentBatchConfig,eo=0,or=null,Nr=null,Lr=null,zu=!1,Xl=!1,Ql=0,wR=0;function Yr(){throw Error(r(321))}function Gm(s,l){if(l===null)return!1;for(var h=0;h<l.length&&h<s.length;h++)if(!is(s[h],l[h]))return!1;return!0}function Km(s,l,h,b,k,S){if(eo=S,or=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,Hu.current=s===null||s.memoizedState===null?SR:CR,s=h(b,k),Xl){S=0;do{if(Xl=!1,Ql=0,25<=S)throw Error(r(301));S+=1,Lr=Nr=null,l.updateQueue=null,Hu.current=jR,s=h(b,k)}while(Xl)}if(Hu.current=Vu,l=Nr!==null&&Nr.next!==null,eo=0,Lr=Nr=or=null,zu=!1,l)throw Error(r(300));return s}function Ym(){var s=Ql!==0;return Ql=0,s}function Ss(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Lr===null?or.memoizedState=Lr=s:Lr=Lr.next=s,Lr}function Hi(){if(Nr===null){var s=or.alternate;s=s!==null?s.memoizedState:null}else s=Nr.next;var l=Lr===null?or.memoizedState:Lr.next;if(l!==null)Lr=l,Nr=s;else{if(s===null)throw Error(r(310));Nr=s,s={memoizedState:Nr.memoizedState,baseState:Nr.baseState,baseQueue:Nr.baseQueue,queue:Nr.queue,next:null},Lr===null?or.memoizedState=Lr=s:Lr=Lr.next=s}return Lr}function Jl(s,l){return typeof l=="function"?l(s):l}function Xm(s){var l=Hi(),h=l.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=s;var b=Nr,k=b.baseQueue,S=h.pending;if(S!==null){if(k!==null){var R=k.next;k.next=S.next,S.next=R}b.baseQueue=k=S,h.pending=null}if(k!==null){S=k.next,b=b.baseState;var J=R=null,se=null,De=S;do{var ze=De.lane;if((eo&ze)===ze)se!==null&&(se=se.next={lane:0,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null}),b=De.hasEagerState?De.eagerState:s(b,De.action);else{var Ve={lane:ze,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null};se===null?(J=se=Ve,R=b):se=se.next=Ve,or.lanes|=ze,to|=ze}De=De.next}while(De!==null&&De!==S);se===null?R=b:se.next=J,is(b,l.memoizedState)||(hi=!0),l.memoizedState=b,l.baseState=R,l.baseQueue=se,h.lastRenderedState=b}if(s=h.interleaved,s!==null){k=s;do S=k.lane,or.lanes|=S,to|=S,k=k.next;while(k!==s)}else k===null&&(h.lanes=0);return[l.memoizedState,h.dispatch]}function Qm(s){var l=Hi(),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 R=k=k.next;do S=s(S,R.action),R=R.next;while(R!==k);is(S,l.memoizedState)||(hi=!0),l.memoizedState=S,l.baseQueue===null&&(l.baseState=S),h.lastRenderedState=S}return[S,b]}function pw(){}function fw(s,l){var h=or,b=Hi(),k=l(),S=!is(b.memoizedState,k);if(S&&(b.memoizedState=k,hi=!0),b=b.queue,Jm(vw.bind(null,h,b,s),[s]),b.getSnapshot!==l||S||Lr!==null&&Lr.memoizedState.tag&1){if(h.flags|=2048,Zl(9,bw.bind(null,h,b,k,l),void 0,null),Fr===null)throw Error(r(349));(eo&30)!==0||gw(h,l,k)}return k}function gw(s,l,h){s.flags|=16384,s={getSnapshot:l,value:h},l=or.updateQueue,l===null?(l={lastEffect:null,stores:null},or.updateQueue=l,l.stores=[s]):(h=l.stores,h===null?l.stores=[s]:h.push(s))}function bw(s,l,h,b){l.value=h,l.getSnapshot=b,ww(l)&&yw(s)}function vw(s,l,h){return h(function(){ww(l)&&yw(s)})}function ww(s){var l=s.getSnapshot;s=s.value;try{var h=l();return!is(s,h)}catch{return!0}}function yw(s){var l=zs(s,1);l!==null&&cs(l,s,1,-1)}function kw(s){var l=Ss();return typeof s=="function"&&(s=s()),l.memoizedState=l.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Jl,lastRenderedState:s},l.queue=s,s=s.dispatch=xR.bind(null,or,s),[l.memoizedState,s]}function Zl(s,l,h,b){return s={tag:s,create:l,destroy:h,deps:b,next:null},l=or.updateQueue,l===null?(l={lastEffect:null,stores:null},or.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 xw(){return Hi().memoizedState}function qu(s,l,h,b){var k=Ss();or.flags|=s,k.memoizedState=Zl(1|l,h,void 0,b===void 0?null:b)}function $u(s,l,h,b){var k=Hi();b=b===void 0?null:b;var S=void 0;if(Nr!==null){var R=Nr.memoizedState;if(S=R.destroy,b!==null&&Gm(b,R.deps)){k.memoizedState=Zl(l,h,S,b);return}}or.flags|=s,k.memoizedState=Zl(1|l,h,S,b)}function Sw(s,l){return qu(8390656,8,s,l)}function Jm(s,l){return $u(2048,8,s,l)}function Cw(s,l){return $u(4,2,s,l)}function jw(s,l){return $u(4,4,s,l)}function Nw(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 Tw(s,l,h){return h=h!=null?h.concat([s]):null,$u(4,4,Nw.bind(null,l,s),h)}function Zm(){}function Pw(s,l){var h=Hi();l=l===void 0?null:l;var b=h.memoizedState;return b!==null&&l!==null&&Gm(l,b[1])?b[0]:(h.memoizedState=[s,l],s)}function Dw(s,l){var h=Hi();l=l===void 0?null:l;var b=h.memoizedState;return b!==null&&l!==null&&Gm(l,b[1])?b[0]:(s=s(),h.memoizedState=[s,l],s)}function Rw(s,l,h){return(eo&21)===0?(s.baseState&&(s.baseState=!1,hi=!0),s.memoizedState=h):(is(h,l)||(h=In(),or.lanes|=h,to|=h,s.baseState=!0),l)}function yR(s,l){var h=G;G=h!==0&&4>h?h:4,s(!0);var b=Vm.transition;Vm.transition={};try{s(!1),l()}finally{G=h,Vm.transition=b}}function Mw(){return Hi().memoizedState}function kR(s,l,h){var b=Ca(s);if(h={lane:b,action:h,hasEagerState:!1,eagerState:null,next:null},Aw(s))Ew(l,h);else if(h=cw(s,l,h,b),h!==null){var k=si();cs(h,s,b,k),Iw(h,l,b)}}function xR(s,l,h){var b=Ca(s),k={lane:b,action:h,hasEagerState:!1,eagerState:null,next:null};if(Aw(s))Ew(l,k);else{var S=s.alternate;if(s.lanes===0&&(S===null||S.lanes===0)&&(S=l.lastRenderedReducer,S!==null))try{var R=l.lastRenderedState,J=S(R,h);if(k.hasEagerState=!0,k.eagerState=J,is(J,R)){var se=l.interleaved;se===null?(k.next=k,Wm(l)):(k.next=se.next,se.next=k),l.interleaved=k;return}}catch{}finally{}h=cw(s,l,k,b),h!==null&&(k=si(),cs(h,s,b,k),Iw(h,l,b))}}function Aw(s){var l=s.alternate;return s===or||l!==null&&l===or}function Ew(s,l){Xl=zu=!0;var h=s.pending;h===null?l.next=l:(l.next=h.next,h.next=l),s.pending=l}function Iw(s,l,h){if((h&4194240)!==0){var b=l.lanes;b&=s.pendingLanes,h|=b,l.lanes=h,je(s,h)}}var Vu={readContext:Ui,useCallback:Yr,useContext:Yr,useEffect:Yr,useImperativeHandle:Yr,useInsertionEffect:Yr,useLayoutEffect:Yr,useMemo:Yr,useReducer:Yr,useRef:Yr,useState:Yr,useDebugValue:Yr,useDeferredValue:Yr,useTransition:Yr,useMutableSource:Yr,useSyncExternalStore:Yr,useId:Yr,unstable_isNewReconciler:!1},SR={readContext:Ui,useCallback:function(s,l){return Ss().memoizedState=[s,l===void 0?null:l],s},useContext:Ui,useEffect:Sw,useImperativeHandle:function(s,l,h){return h=h!=null?h.concat([s]):null,qu(4194308,4,Nw.bind(null,l,s),h)},useLayoutEffect:function(s,l){return qu(4194308,4,s,l)},useInsertionEffect:function(s,l){return qu(4,2,s,l)},useMemo:function(s,l){var h=Ss();return l=l===void 0?null:l,s=s(),h.memoizedState=[s,l],s},useReducer:function(s,l,h){var b=Ss();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=kR.bind(null,or,s),[b.memoizedState,s]},useRef:function(s){var l=Ss();return s={current:s},l.memoizedState=s},useState:kw,useDebugValue:Zm,useDeferredValue:function(s){return Ss().memoizedState=s},useTransition:function(){var s=kw(!1),l=s[0];return s=yR.bind(null,s[1]),Ss().memoizedState=s,[l,s]},useMutableSource:function(){},useSyncExternalStore:function(s,l,h){var b=or,k=Ss();if(er){if(h===void 0)throw Error(r(407));h=h()}else{if(h=l(),Fr===null)throw Error(r(349));(eo&30)!==0||gw(b,l,h)}k.memoizedState=h;var S={value:h,getSnapshot:l};return k.queue=S,Sw(vw.bind(null,b,S,s),[s]),b.flags|=2048,Zl(9,bw.bind(null,b,S,h,l),void 0,null),h},useId:function(){var s=Ss(),l=Fr.identifierPrefix;if(er){var h=Hs,b=Us;h=(b&~(1<<32-Vt(b)-1)).toString(32)+h,l=":"+l+"R"+h,h=Ql++,0<h&&(l+="H"+h.toString(32)),l+=":"}else h=wR++,l=":"+l+"r"+h.toString(32)+":";return s.memoizedState=l},unstable_isNewReconciler:!1},CR={readContext:Ui,useCallback:Pw,useContext:Ui,useEffect:Jm,useImperativeHandle:Tw,useInsertionEffect:Cw,useLayoutEffect:jw,useMemo:Dw,useReducer:Xm,useRef:xw,useState:function(){return Xm(Jl)},useDebugValue:Zm,useDeferredValue:function(s){var l=Hi();return Rw(l,Nr.memoizedState,s)},useTransition:function(){var s=Xm(Jl)[0],l=Hi().memoizedState;return[s,l]},useMutableSource:pw,useSyncExternalStore:fw,useId:Mw,unstable_isNewReconciler:!1},jR={readContext:Ui,useCallback:Pw,useContext:Ui,useEffect:Jm,useImperativeHandle:Tw,useInsertionEffect:Cw,useLayoutEffect:jw,useMemo:Dw,useReducer:Qm,useRef:xw,useState:function(){return Qm(Jl)},useDebugValue:Zm,useDeferredValue:function(s){var l=Hi();return Nr===null?l.memoizedState=s:Rw(l,Nr.memoizedState,s)},useTransition:function(){var s=Qm(Jl)[0],l=Hi().memoizedState;return[s,l]},useMutableSource:pw,useSyncExternalStore:fw,useId:Mw,unstable_isNewReconciler:!1};function as(s,l){if(s&&s.defaultProps){l=N({},l),s=s.defaultProps;for(var h in s)l[h]===void 0&&(l[h]=s[h]);return l}return l}function ep(s,l,h,b){l=s.memoizedState,h=h(b,l),h=h==null?l:N({},l,h),s.memoizedState=h,s.lanes===0&&(s.updateQueue.baseState=h)}var Gu={isMounted:function(s){return(s=s._reactInternals)?Pe(s)===s:!1},enqueueSetState:function(s,l,h){s=s._reactInternals;var b=si(),k=Ca(s),S=qs(b,k);S.payload=l,h!=null&&(S.callback=h),l=ya(s,S,k),l!==null&&(cs(l,s,k,b),Bu(l,s,k))},enqueueReplaceState:function(s,l,h){s=s._reactInternals;var b=si(),k=Ca(s),S=qs(b,k);S.tag=1,S.payload=l,h!=null&&(S.callback=h),l=ya(s,S,k),l!==null&&(cs(l,s,k,b),Bu(l,s,k))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var h=si(),b=Ca(s),k=qs(h,b);k.tag=2,l!=null&&(k.callback=l),l=ya(s,k,b),l!==null&&(cs(l,s,b,h),Bu(l,s,b))}};function Lw(s,l,h,b,k,S,R){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(b,S,R):l.prototype&&l.prototype.isPureReactComponent?!Bl(h,b)||!Bl(k,S):!0}function Fw(s,l,h){var b=!1,k=ba,S=l.contextType;return typeof S=="object"&&S!==null?S=Ui(S):(k=di(l)?Ya:Kr.current,b=l.contextTypes,S=(b=b!=null)?zo(s,k):ba),l=new l(h,S),s.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Gu,s.stateNode=l,l._reactInternals=s,b&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=k,s.__reactInternalMemoizedMaskedChildContext=S),l}function _w(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&&Gu.enqueueReplaceState(l,l.state,null)}function tp(s,l,h,b){var k=s.stateNode;k.props=h,k.state=s.memoizedState,k.refs={},Um(s);var S=l.contextType;typeof S=="object"&&S!==null?k.context=Ui(S):(S=di(l)?Ya:Kr.current,k.context=zo(s,S)),k.state=s.memoizedState,S=l.getDerivedStateFromProps,typeof S=="function"&&(ep(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&&Gu.enqueueReplaceState(k,k.state,null),Wu(s,h,k,b),k.state=s.memoizedState),typeof k.componentDidMount=="function"&&(s.flags|=4194308)}function Qo(s,l){try{var h="",b=l;do h+=ce(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 np(s,l,h){return{value:s,source:null,stack:h??null,digest:l??null}}function rp(s,l){try{console.error(l.value)}catch(h){setTimeout(function(){throw h})}}var NR=typeof WeakMap=="function"?WeakMap:Map;function Ow(s,l,h){h=qs(-1,h),h.tag=3,h.payload={element:null};var b=l.value;return h.callback=function(){ed||(ed=!0,vp=b),rp(s,l)},h}function Bw(s,l,h){h=qs(-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(){rp(s,l)}}var S=s.stateNode;return S!==null&&typeof S.componentDidCatch=="function"&&(h.callback=function(){rp(s,l),typeof b!="function"&&(xa===null?xa=new Set([this]):xa.add(this));var R=l.stack;this.componentDidCatch(l.value,{componentStack:R!==null?R:""})}),h}function Ww(s,l,h){var b=s.pingCache;if(b===null){b=s.pingCache=new NR;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=WR.bind(null,s,l,h),l.then(s,s))}function Uw(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 Hw(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=qs(-1,1),l.tag=2,ya(h,l,1))),h.lanes|=1),s):(s.flags|=65536,s.lanes=k,s)}var TR=Z.ReactCurrentOwner,hi=!1;function ii(s,l,h,b){l.child=s===null?lw(l,null,h,b):Go(l,s.child,h,b)}function zw(s,l,h,b,k){h=h.render;var S=l.ref;return Yo(l,k),b=Km(s,l,h,b,S,k),h=Ym(),s!==null&&!hi?(l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~k,$s(s,l,k)):(er&&h&&Mm(l),l.flags|=1,ii(s,l,b,k),l.child)}function qw(s,l,h,b,k){if(s===null){var S=h.type;return typeof S=="function"&&!jp(S)&&S.defaultProps===void 0&&h.compare===null&&h.defaultProps===void 0?(l.tag=15,l.type=S,$w(s,l,S,b,k)):(s=ad(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 R=S.memoizedProps;if(h=h.compare,h=h!==null?h:Bl,h(R,b)&&s.ref===l.ref)return $s(s,l,k)}return l.flags|=1,s=Na(S,b),s.ref=l.ref,s.return=l,l.child=s}function $w(s,l,h,b,k){if(s!==null){var S=s.memoizedProps;if(Bl(S,b)&&s.ref===l.ref)if(hi=!1,l.pendingProps=b=S,(s.lanes&k)!==0)(s.flags&131072)!==0&&(hi=!0);else return l.lanes=s.lanes,$s(s,l,k)}return ip(s,l,h,b,k)}function Vw(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},Gn(Zo,Di),Di|=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,Gn(Zo,Di),Di|=s,null;l.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=S!==null?S.baseLanes:h,Gn(Zo,Di),Di|=b}else S!==null?(b=S.baseLanes|h,l.memoizedState=null):b=h,Gn(Zo,Di),Di|=b;return ii(s,l,k,h),l.child}function Gw(s,l){var h=l.ref;(s===null&&h!==null||s!==null&&s.ref!==h)&&(l.flags|=512,l.flags|=2097152)}function ip(s,l,h,b,k){var S=di(h)?Ya:Kr.current;return S=zo(l,S),Yo(l,k),h=Km(s,l,h,b,S,k),b=Ym(),s!==null&&!hi?(l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~k,$s(s,l,k)):(er&&b&&Mm(l),l.flags|=1,ii(s,l,h,k),l.child)}function Kw(s,l,h,b,k){if(di(h)){var S=!0;Mu(l)}else S=!1;if(Yo(l,k),l.stateNode===null)Yu(s,l),Fw(l,h,b),tp(l,h,b,k),b=!0;else if(s===null){var R=l.stateNode,J=l.memoizedProps;R.props=J;var se=R.context,De=h.contextType;typeof De=="object"&&De!==null?De=Ui(De):(De=di(h)?Ya:Kr.current,De=zo(l,De));var ze=h.getDerivedStateFromProps,Ve=typeof ze=="function"||typeof R.getSnapshotBeforeUpdate=="function";Ve||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(J!==b||se!==De)&&_w(l,R,b,De),wa=!1;var He=l.memoizedState;R.state=He,Wu(l,b,R,k),se=l.memoizedState,J!==b||He!==se||ui.current||wa?(typeof ze=="function"&&(ep(l,h,ze,b),se=l.memoizedState),(J=wa||Lw(l,h,J,b,He,se,De))?(Ve||typeof R.UNSAFE_componentWillMount!="function"&&typeof R.componentWillMount!="function"||(typeof R.componentWillMount=="function"&&R.componentWillMount(),typeof R.UNSAFE_componentWillMount=="function"&&R.UNSAFE_componentWillMount()),typeof R.componentDidMount=="function"&&(l.flags|=4194308)):(typeof R.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=b,l.memoizedState=se),R.props=b,R.state=se,R.context=De,b=J):(typeof R.componentDidMount=="function"&&(l.flags|=4194308),b=!1)}else{R=l.stateNode,uw(s,l),J=l.memoizedProps,De=l.type===l.elementType?J:as(l.type,J),R.props=De,Ve=l.pendingProps,He=R.context,se=h.contextType,typeof se=="object"&&se!==null?se=Ui(se):(se=di(h)?Ya:Kr.current,se=zo(l,se));var wt=h.getDerivedStateFromProps;(ze=typeof wt=="function"||typeof R.getSnapshotBeforeUpdate=="function")||typeof R.UNSAFE_componentWillReceiveProps!="function"&&typeof R.componentWillReceiveProps!="function"||(J!==Ve||He!==se)&&_w(l,R,b,se),wa=!1,He=l.memoizedState,R.state=He,Wu(l,b,R,k);var Pt=l.memoizedState;J!==Ve||He!==Pt||ui.current||wa?(typeof wt=="function"&&(ep(l,h,wt,b),Pt=l.memoizedState),(De=wa||Lw(l,h,De,b,He,Pt,se)||!1)?(ze||typeof R.UNSAFE_componentWillUpdate!="function"&&typeof R.componentWillUpdate!="function"||(typeof R.componentWillUpdate=="function"&&R.componentWillUpdate(b,Pt,se),typeof R.UNSAFE_componentWillUpdate=="function"&&R.UNSAFE_componentWillUpdate(b,Pt,se)),typeof R.componentDidUpdate=="function"&&(l.flags|=4),typeof R.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof R.componentDidUpdate!="function"||J===s.memoizedProps&&He===s.memoizedState||(l.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||J===s.memoizedProps&&He===s.memoizedState||(l.flags|=1024),l.memoizedProps=b,l.memoizedState=Pt),R.props=b,R.state=Pt,R.context=se,b=De):(typeof R.componentDidUpdate!="function"||J===s.memoizedProps&&He===s.memoizedState||(l.flags|=4),typeof R.getSnapshotBeforeUpdate!="function"||J===s.memoizedProps&&He===s.memoizedState||(l.flags|=1024),b=!1)}return sp(s,l,h,b,S,k)}function sp(s,l,h,b,k,S){Gw(s,l);var R=(l.flags&128)!==0;if(!b&&!R)return k&&Zv(l,h,!1),$s(s,l,S);b=l.stateNode,TR.current=l;var J=R&&typeof h.getDerivedStateFromError!="function"?null:b.render();return l.flags|=1,s!==null&&R?(l.child=Go(l,s.child,null,S),l.child=Go(l,null,J,S)):ii(s,l,J,S),l.memoizedState=b.state,k&&Zv(l,h,!0),l.child}function Yw(s){var l=s.stateNode;l.pendingContext?Qv(s,l.pendingContext,l.pendingContext!==l.context):l.context&&Qv(s,l.context,!1),Hm(s,l.containerInfo)}function Xw(s,l,h,b,k){return Vo(),Lm(k),l.flags|=256,ii(s,l,h,b),l.child}var ap={dehydrated:null,treeContext:null,retryLane:0};function op(s){return{baseLanes:s,cachePool:null,transitions:null}}function Qw(s,l,h){var b=l.pendingProps,k=ar.current,S=!1,R=(l.flags&128)!==0,J;if((J=R)||(J=s!==null&&s.memoizedState===null?!1:(k&2)!==0),J?(S=!0,l.flags&=-129):(s===null||s.memoizedState!==null)&&(k|=1),Gn(ar,k&1),s===null)return Im(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):(R=b.children,s=b.fallback,S?(b=l.mode,S=l.child,R={mode:"hidden",children:R},(b&1)===0&&S!==null?(S.childLanes=0,S.pendingProps=R):S=od(R,b,0,null),s=so(s,b,h,null),S.return=l,s.return=l,S.sibling=s,l.child=S,l.child.memoizedState=op(h),l.memoizedState=ap,s):lp(l,R));if(k=s.memoizedState,k!==null&&(J=k.dehydrated,J!==null))return PR(s,l,R,b,J,k,h);if(S){S=b.fallback,R=l.mode,k=s.child,J=k.sibling;var se={mode:"hidden",children:b.children};return(R&1)===0&&l.child!==k?(b=l.child,b.childLanes=0,b.pendingProps=se,l.deletions=null):(b=Na(k,se),b.subtreeFlags=k.subtreeFlags&14680064),J!==null?S=Na(J,S):(S=so(S,R,h,null),S.flags|=2),S.return=l,b.return=l,b.sibling=S,l.child=b,b=S,S=l.child,R=s.child.memoizedState,R=R===null?op(h):{baseLanes:R.baseLanes|h,cachePool:null,transitions:R.transitions},S.memoizedState=R,S.childLanes=s.childLanes&~h,l.memoizedState=ap,b}return S=s.child,s=S.sibling,b=Na(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 lp(s,l){return l=od({mode:"visible",children:l},s.mode,0,null),l.return=s,s.child=l}function Ku(s,l,h,b){return b!==null&&Lm(b),Go(l,s.child,null,h),s=lp(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function PR(s,l,h,b,k,S,R){if(h)return l.flags&256?(l.flags&=-257,b=np(Error(r(422))),Ku(s,l,R,b)):l.memoizedState!==null?(l.child=s.child,l.flags|=128,null):(S=b.fallback,k=l.mode,b=od({mode:"visible",children:b.children},k,0,null),S=so(S,k,R,null),S.flags|=2,b.return=l,S.return=l,b.sibling=S,l.child=b,(l.mode&1)!==0&&Go(l,s.child,null,R),l.child.memoizedState=op(R),l.memoizedState=ap,S);if((l.mode&1)===0)return Ku(s,l,R,null);if(k.data==="$!"){if(b=k.nextSibling&&k.nextSibling.dataset,b)var J=b.dgst;return b=J,S=Error(r(419)),b=np(S,b,void 0),Ku(s,l,R,b)}if(J=(R&s.childLanes)!==0,hi||J){if(b=Fr,b!==null){switch(R&-R){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|R))!==0?0:k,k!==0&&k!==S.retryLane&&(S.retryLane=k,zs(s,k),cs(b,s,k,-1))}return Cp(),b=np(Error(r(421))),Ku(s,l,R,b)}return k.data==="$?"?(l.flags|=128,l.child=s.child,l=UR.bind(null,s),k._reactRetry=l,null):(s=S.treeContext,Pi=fa(k.nextSibling),Ti=l,er=!0,ss=null,s!==null&&(Bi[Wi++]=Us,Bi[Wi++]=Hs,Bi[Wi++]=Xa,Us=s.id,Hs=s.overflow,Xa=l),l=lp(l,b.children),l.flags|=4096,l)}function Jw(s,l,h){s.lanes|=l;var b=s.alternate;b!==null&&(b.lanes|=l),Bm(s.return,l,h)}function cp(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 Zw(s,l,h){var b=l.pendingProps,k=b.revealOrder,S=b.tail;if(ii(s,l,b.children,h),b=ar.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&&Jw(s,h,l);else if(s.tag===19)Jw(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(Gn(ar,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&&Uu(s)===null&&(k=h),h=h.sibling;h=k,h===null?(k=l.child,l.child=null):(k=h.sibling,h.sibling=null),cp(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&&Uu(s)===null){l.child=k;break}s=k.sibling,k.sibling=h,h=k,k=s}cp(l,!0,h,null,S);break;case"together":cp(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function Yu(s,l){(l.mode&1)===0&&s!==null&&(s.alternate=null,l.alternate=null,l.flags|=2)}function $s(s,l,h){if(s!==null&&(l.dependencies=s.dependencies),to|=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=Na(s,s.pendingProps),l.child=h,h.return=l;s.sibling!==null;)s=s.sibling,h=h.sibling=Na(s,s.pendingProps),h.return=l;h.sibling=null}return l.child}function DR(s,l,h){switch(l.tag){case 3:Yw(l),Vo();break;case 5:mw(l);break;case 1:di(l.type)&&Mu(l);break;case 4:Hm(l,l.stateNode.containerInfo);break;case 10:var b=l.type._context,k=l.memoizedProps.value;Gn(_u,b._currentValue),b._currentValue=k;break;case 13:if(b=l.memoizedState,b!==null)return b.dehydrated!==null?(Gn(ar,ar.current&1),l.flags|=128,null):(h&l.child.childLanes)!==0?Qw(s,l,h):(Gn(ar,ar.current&1),s=$s(s,l,h),s!==null?s.sibling:null);Gn(ar,ar.current&1);break;case 19:if(b=(h&l.childLanes)!==0,(s.flags&128)!==0){if(b)return Zw(s,l,h);l.flags|=128}if(k=l.memoizedState,k!==null&&(k.rendering=null,k.tail=null,k.lastEffect=null),Gn(ar,ar.current),b)break;return null;case 22:case 23:return l.lanes=0,Vw(s,l,h)}return $s(s,l,h)}var ey,up,ty,ny;ey=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}},up=function(){},ty=function(s,l,h,b){var k=s.memoizedProps;if(k!==b){s=l.stateNode,Za(xs.current);var S=null;switch(h){case"input":k=ft(s,k),b=ft(s,b),S=[];break;case"select":k=N({},k,{value:void 0}),b=N({},b,{value:void 0}),S=[];break;case"textarea":k=Me(s,k),b=Me(s,b),S=[];break;default:typeof k.onClick!="function"&&typeof b.onClick=="function"&&(s.onclick=Pu)}bt(h,b);var R;h=null;for(De in k)if(!b.hasOwnProperty(De)&&k.hasOwnProperty(De)&&k[De]!=null)if(De==="style"){var J=k[De];for(R in J)J.hasOwnProperty(R)&&(h||(h={}),h[R]="")}else De!=="dangerouslySetInnerHTML"&&De!=="children"&&De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&De!=="autoFocus"&&(a.hasOwnProperty(De)?S||(S=[]):(S=S||[]).push(De,null));for(De in b){var se=b[De];if(J=k!=null?k[De]:void 0,b.hasOwnProperty(De)&&se!==J&&(se!=null||J!=null))if(De==="style")if(J){for(R in J)!J.hasOwnProperty(R)||se&&se.hasOwnProperty(R)||(h||(h={}),h[R]="");for(R in se)se.hasOwnProperty(R)&&J[R]!==se[R]&&(h||(h={}),h[R]=se[R])}else h||(S||(S=[]),S.push(De,h)),h=se;else De==="dangerouslySetInnerHTML"?(se=se?se.__html:void 0,J=J?J.__html:void 0,se!=null&&J!==se&&(S=S||[]).push(De,se)):De==="children"?typeof se!="string"&&typeof se!="number"||(S=S||[]).push(De,""+se):De!=="suppressContentEditableWarning"&&De!=="suppressHydrationWarning"&&(a.hasOwnProperty(De)?(se!=null&&De==="onScroll"&&Jn("scroll",s),S||J===se||(S=[])):(S=S||[]).push(De,se))}h&&(S=S||[]).push("style",h);var De=S;(l.updateQueue=De)&&(l.flags|=4)}},ny=function(s,l,h,b){h!==b&&(l.flags|=4)};function ec(s,l){if(!er)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 Xr(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 RR(s,l,h){var b=l.pendingProps;switch(Am(l),l.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xr(l),null;case 1:return di(l.type)&&Ru(),Xr(l),null;case 3:return b=l.stateNode,Xo(),Zn(ui),Zn(Kr),$m(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(s===null||s.child===null)&&(Lu(l)?l.flags|=4:s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,ss!==null&&(kp(ss),ss=null))),up(s,l),Xr(l),null;case 5:zm(l);var k=Za(Yl.current);if(h=l.type,s!==null&&l.stateNode!=null)ty(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 Xr(l),null}if(s=Za(xs.current),Lu(l)){b=l.stateNode,h=l.type;var S=l.memoizedProps;switch(b[ks]=l,b[ql]=S,s=(l.mode&1)!==0,h){case"dialog":Jn("cancel",b),Jn("close",b);break;case"iframe":case"object":case"embed":Jn("load",b);break;case"video":case"audio":for(k=0;k<Ul.length;k++)Jn(Ul[k],b);break;case"source":Jn("error",b);break;case"img":case"image":case"link":Jn("error",b),Jn("load",b);break;case"details":Jn("toggle",b);break;case"input":rt(b,S),Jn("invalid",b);break;case"select":b._wrapperState={wasMultiple:!!S.multiple},Jn("invalid",b);break;case"textarea":Le(b,S),Jn("invalid",b)}bt(h,S),k=null;for(var R in S)if(S.hasOwnProperty(R)){var J=S[R];R==="children"?typeof J=="string"?b.textContent!==J&&(S.suppressHydrationWarning!==!0&&Tu(b.textContent,J,s),k=["children",J]):typeof J=="number"&&b.textContent!==""+J&&(S.suppressHydrationWarning!==!0&&Tu(b.textContent,J,s),k=["children",""+J]):a.hasOwnProperty(R)&&J!=null&&R==="onScroll"&&Jn("scroll",b)}switch(h){case"input":Nt(b),Oe(b,S,!0);break;case"textarea":Nt(b),ut(b);break;case"select":case"option":break;default:typeof S.onClick=="function"&&(b.onclick=Pu)}b=k,l.updateQueue=b,b!==null&&(l.flags|=4)}else{R=k.nodeType===9?k:k.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=we(h)),s==="http://www.w3.org/1999/xhtml"?h==="script"?(s=R.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof b.is=="string"?s=R.createElement(h,{is:b.is}):(s=R.createElement(h),h==="select"&&(R=s,b.multiple?R.multiple=!0:b.size&&(R.size=b.size))):s=R.createElementNS(s,h),s[ks]=l,s[ql]=b,ey(s,l,!1,!1),l.stateNode=s;e:{switch(R=Qt(h,b),h){case"dialog":Jn("cancel",s),Jn("close",s),k=b;break;case"iframe":case"object":case"embed":Jn("load",s),k=b;break;case"video":case"audio":for(k=0;k<Ul.length;k++)Jn(Ul[k],s);k=b;break;case"source":Jn("error",s),k=b;break;case"img":case"image":case"link":Jn("error",s),Jn("load",s),k=b;break;case"details":Jn("toggle",s),k=b;break;case"input":rt(s,b),k=ft(s,b),Jn("invalid",s);break;case"option":k=b;break;case"select":s._wrapperState={wasMultiple:!!b.multiple},k=N({},b,{value:void 0}),Jn("invalid",s);break;case"textarea":Le(s,b),k=Me(s,b),Jn("invalid",s);break;default:k=b}bt(h,k),J=k;for(S in J)if(J.hasOwnProperty(S)){var se=J[S];S==="style"?Ft(s,se):S==="dangerouslySetInnerHTML"?(se=se?se.__html:void 0,se!=null&&Fe(s,se)):S==="children"?typeof se=="string"?(h!=="textarea"||se!=="")&&dt(s,se):typeof se=="number"&&dt(s,""+se):S!=="suppressContentEditableWarning"&&S!=="suppressHydrationWarning"&&S!=="autoFocus"&&(a.hasOwnProperty(S)?se!=null&&S==="onScroll"&&Jn("scroll",s):se!=null&&I(s,S,se,R))}switch(h){case"input":Nt(s),Oe(s,b,!1);break;case"textarea":Nt(s),ut(s);break;case"option":b.value!=null&&s.setAttribute("value",""+Se(b.value));break;case"select":s.multiple=!!b.multiple,S=b.value,S!=null?yt(s,!!b.multiple,S,!1):b.defaultValue!=null&&yt(s,!!b.multiple,b.defaultValue,!0);break;default:typeof k.onClick=="function"&&(s.onclick=Pu)}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 Xr(l),null;case 6:if(s&&l.stateNode!=null)ny(s,l,s.memoizedProps,b);else{if(typeof b!="string"&&l.stateNode===null)throw Error(r(166));if(h=Za(Yl.current),Za(xs.current),Lu(l)){if(b=l.stateNode,h=l.memoizedProps,b[ks]=l,(S=b.nodeValue!==h)&&(s=Ti,s!==null))switch(s.tag){case 3:Tu(b.nodeValue,h,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&Tu(b.nodeValue,h,(s.mode&1)!==0)}S&&(l.flags|=4)}else b=(h.nodeType===9?h:h.ownerDocument).createTextNode(b),b[ks]=l,l.stateNode=b}return Xr(l),null;case 13:if(Zn(ar),b=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(er&&Pi!==null&&(l.mode&1)!==0&&(l.flags&128)===0)sw(),Vo(),l.flags|=98560,S=!1;else if(S=Lu(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[ks]=l}else Vo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Xr(l),S=!1}else ss!==null&&(kp(ss),ss=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||(ar.current&1)!==0?Tr===0&&(Tr=3):Cp())),l.updateQueue!==null&&(l.flags|=4),Xr(l),null);case 4:return Xo(),up(s,l),s===null&&Hl(l.stateNode.containerInfo),Xr(l),null;case 10:return Om(l.type._context),Xr(l),null;case 17:return di(l.type)&&Ru(),Xr(l),null;case 19:if(Zn(ar),S=l.memoizedState,S===null)return Xr(l),null;if(b=(l.flags&128)!==0,R=S.rendering,R===null)if(b)ec(S,!1);else{if(Tr!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(R=Uu(s),R!==null){for(l.flags|=128,ec(S,!1),b=R.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,R=S.alternate,R===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=R.childLanes,S.lanes=R.lanes,S.child=R.child,S.subtreeFlags=0,S.deletions=null,S.memoizedProps=R.memoizedProps,S.memoizedState=R.memoizedState,S.updateQueue=R.updateQueue,S.type=R.type,s=R.dependencies,S.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),h=h.sibling;return Gn(ar,ar.current&1|2),l.child}s=s.sibling}S.tail!==null&&Tt()>el&&(l.flags|=128,b=!0,ec(S,!1),l.lanes=4194304)}else{if(!b)if(s=Uu(R),s!==null){if(l.flags|=128,b=!0,h=s.updateQueue,h!==null&&(l.updateQueue=h,l.flags|=4),ec(S,!0),S.tail===null&&S.tailMode==="hidden"&&!R.alternate&&!er)return Xr(l),null}else 2*Tt()-S.renderingStartTime>el&&h!==1073741824&&(l.flags|=128,b=!0,ec(S,!1),l.lanes=4194304);S.isBackwards?(R.sibling=l.child,l.child=R):(h=S.last,h!==null?h.sibling=R:l.child=R,S.last=R)}return S.tail!==null?(l=S.tail,S.rendering=l,S.tail=l.sibling,S.renderingStartTime=Tt(),l.sibling=null,h=ar.current,Gn(ar,b?h&1|2:h&1),l):(Xr(l),null);case 22:case 23:return Sp(),b=l.memoizedState!==null,s!==null&&s.memoizedState!==null!==b&&(l.flags|=8192),b&&(l.mode&1)!==0?(Di&1073741824)!==0&&(Xr(l),l.subtreeFlags&6&&(l.flags|=8192)):Xr(l),null;case 24:return null;case 25:return null}throw Error(r(156,l.tag))}function MR(s,l){switch(Am(l),l.tag){case 1:return di(l.type)&&Ru(),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return Xo(),Zn(ui),Zn(Kr),$m(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 5:return zm(l),null;case 13:if(Zn(ar),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Vo()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return Zn(ar),null;case 4:return Xo(),null;case 10:return Om(l.type._context),null;case 22:case 23:return Sp(),null;case 24:return null;default:return null}}var Xu=!1,Qr=!1,AR=typeof WeakSet=="function"?WeakSet:Set,jt=null;function Jo(s,l){var h=s.ref;if(h!==null)if(typeof h=="function")try{h(null)}catch(b){ur(s,l,b)}else h.current=null}function dp(s,l,h){try{h()}catch(b){ur(s,l,b)}}var ry=!1;function ER(s,l){if(Sm=Sr,s=Lv(),fm(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 R=0,J=-1,se=-1,De=0,ze=0,Ve=s,He=null;t:for(;;){for(var wt;Ve!==h||k!==0&&Ve.nodeType!==3||(J=R+k),Ve!==S||b!==0&&Ve.nodeType!==3||(se=R+b),Ve.nodeType===3&&(R+=Ve.nodeValue.length),(wt=Ve.firstChild)!==null;)He=Ve,Ve=wt;for(;;){if(Ve===s)break t;if(He===h&&++De===k&&(J=R),He===S&&++ze===b&&(se=R),(wt=Ve.nextSibling)!==null)break;Ve=He,He=Ve.parentNode}Ve=wt}h=J===-1||se===-1?null:{start:J,end:se}}else h=null}h=h||{start:0,end:0}}else h=null;for(Cm={focusedElem:s,selectionRange:h},Sr=!1,jt=l;jt!==null;)if(l=jt,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,jt=s;else for(;jt!==null;){l=jt;try{var Pt=l.alternate;if((l.flags&1024)!==0)switch(l.tag){case 0:case 11:case 15:break;case 1:if(Pt!==null){var Rt=Pt.memoizedProps,mr=Pt.memoizedState,ke=l.stateNode,oe=ke.getSnapshotBeforeUpdate(l.elementType===l.type?Rt:as(l.type,Rt),mr);ke.__reactInternalSnapshotBeforeUpdate=oe}break;case 3:var Ne=l.stateNode.containerInfo;Ne.nodeType===1?Ne.textContent="":Ne.nodeType===9&&Ne.documentElement&&Ne.removeChild(Ne.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(Ze){ur(l,l.return,Ze)}if(s=l.sibling,s!==null){s.return=l.return,jt=s;break}jt=l.return}return Pt=ry,ry=!1,Pt}function tc(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&&dp(l,h,S)}k=k.next}while(k!==b)}}function Qu(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 hp(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[ks],delete l[ql],delete l[Pm],delete l[fR],delete l[gR])),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 sy(s){return s.tag===5||s.tag===3||s.tag===4}function ay(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||sy(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 mp(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=Pu));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}function pp(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(pp(s,l,h),s=s.sibling;s!==null;)pp(s,l,h),s=s.sibling}var Ur=null,os=!1;function ka(s,l,h){for(h=h.child;h!==null;)oy(s,l,h),h=h.sibling}function oy(s,l,h){if(rn&&typeof rn.onCommitFiberUnmount=="function")try{rn.onCommitFiberUnmount(Mt,h)}catch{}switch(h.tag){case 5:Qr||Jo(h,l);case 6:var b=Ur,k=os;Ur=null,ka(s,l,h),Ur=b,os=k,Ur!==null&&(os?(s=Ur,h=h.stateNode,s.nodeType===8?s.parentNode.removeChild(h):s.removeChild(h)):Ur.removeChild(h.stateNode));break;case 18:Ur!==null&&(os?(s=Ur,h=h.stateNode,s.nodeType===8?Tm(s.parentNode,h):s.nodeType===1&&Tm(s,h),Ln(s)):Tm(Ur,h.stateNode));break;case 4:b=Ur,k=os,Ur=h.stateNode.containerInfo,os=!0,ka(s,l,h),Ur=b,os=k;break;case 0:case 11:case 14:case 15:if(!Qr&&(b=h.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){k=b=b.next;do{var S=k,R=S.destroy;S=S.tag,R!==void 0&&((S&2)!==0||(S&4)!==0)&&dp(h,l,R),k=k.next}while(k!==b)}ka(s,l,h);break;case 1:if(!Qr&&(Jo(h,l),b=h.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=h.memoizedProps,b.state=h.memoizedState,b.componentWillUnmount()}catch(J){ur(h,l,J)}ka(s,l,h);break;case 21:ka(s,l,h);break;case 22:h.mode&1?(Qr=(b=Qr)||h.memoizedState!==null,ka(s,l,h),Qr=b):ka(s,l,h);break;default:ka(s,l,h)}}function ly(s){var l=s.updateQueue;if(l!==null){s.updateQueue=null;var h=s.stateNode;h===null&&(h=s.stateNode=new AR),l.forEach(function(b){var k=HR.bind(null,s,b);h.has(b)||(h.add(b),b.then(k,k))})}}function ls(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,R=l,J=R;e:for(;J!==null;){switch(J.tag){case 5:Ur=J.stateNode,os=!1;break e;case 3:Ur=J.stateNode.containerInfo,os=!0;break e;case 4:Ur=J.stateNode.containerInfo,os=!0;break e}J=J.return}if(Ur===null)throw Error(r(160));oy(S,R,k),Ur=null,os=!1;var se=k.alternate;se!==null&&(se.return=null),k.return=null}catch(De){ur(k,l,De)}}if(l.subtreeFlags&12854)for(l=l.child;l!==null;)cy(l,s),l=l.sibling}function cy(s,l){var h=s.alternate,b=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(ls(l,s),Cs(s),b&4){try{tc(3,s,s.return),Qu(3,s)}catch(Rt){ur(s,s.return,Rt)}try{tc(5,s,s.return)}catch(Rt){ur(s,s.return,Rt)}}break;case 1:ls(l,s),Cs(s),b&512&&h!==null&&Jo(h,h.return);break;case 5:if(ls(l,s),Cs(s),b&512&&h!==null&&Jo(h,h.return),s.flags&32){var k=s.stateNode;try{dt(k,"")}catch(Rt){ur(s,s.return,Rt)}}if(b&4&&(k=s.stateNode,k!=null)){var S=s.memoizedProps,R=h!==null?h.memoizedProps:S,J=s.type,se=s.updateQueue;if(s.updateQueue=null,se!==null)try{J==="input"&&S.type==="radio"&&S.name!=null&&fe(k,S),Qt(J,R);var De=Qt(J,S);for(R=0;R<se.length;R+=2){var ze=se[R],Ve=se[R+1];ze==="style"?Ft(k,Ve):ze==="dangerouslySetInnerHTML"?Fe(k,Ve):ze==="children"?dt(k,Ve):I(k,ze,Ve,De)}switch(J){case"input":ue(k,S);break;case"textarea":pt(k,S);break;case"select":var He=k._wrapperState.wasMultiple;k._wrapperState.wasMultiple=!!S.multiple;var wt=S.value;wt!=null?yt(k,!!S.multiple,wt,!1):He!==!!S.multiple&&(S.defaultValue!=null?yt(k,!!S.multiple,S.defaultValue,!0):yt(k,!!S.multiple,S.multiple?[]:"",!1))}k[ql]=S}catch(Rt){ur(s,s.return,Rt)}}break;case 6:if(ls(l,s),Cs(s),b&4){if(s.stateNode===null)throw Error(r(162));k=s.stateNode,S=s.memoizedProps;try{k.nodeValue=S}catch(Rt){ur(s,s.return,Rt)}}break;case 3:if(ls(l,s),Cs(s),b&4&&h!==null&&h.memoizedState.isDehydrated)try{Ln(l.containerInfo)}catch(Rt){ur(s,s.return,Rt)}break;case 4:ls(l,s),Cs(s);break;case 13:ls(l,s),Cs(s),k=s.child,k.flags&8192&&(S=k.memoizedState!==null,k.stateNode.isHidden=S,!S||k.alternate!==null&&k.alternate.memoizedState!==null||(bp=Tt())),b&4&&ly(s);break;case 22:if(ze=h!==null&&h.memoizedState!==null,s.mode&1?(Qr=(De=Qr)||ze,ls(l,s),Qr=De):ls(l,s),Cs(s),b&8192){if(De=s.memoizedState!==null,(s.stateNode.isHidden=De)&&!ze&&(s.mode&1)!==0)for(jt=s,ze=s.child;ze!==null;){for(Ve=jt=ze;jt!==null;){switch(He=jt,wt=He.child,He.tag){case 0:case 11:case 14:case 15:tc(4,He,He.return);break;case 1:Jo(He,He.return);var Pt=He.stateNode;if(typeof Pt.componentWillUnmount=="function"){b=He,h=He.return;try{l=b,Pt.props=l.memoizedProps,Pt.state=l.memoizedState,Pt.componentWillUnmount()}catch(Rt){ur(b,h,Rt)}}break;case 5:Jo(He,He.return);break;case 22:if(He.memoizedState!==null){hy(Ve);continue}}wt!==null?(wt.return=He,jt=wt):hy(Ve)}ze=ze.sibling}e:for(ze=null,Ve=s;;){if(Ve.tag===5){if(ze===null){ze=Ve;try{k=Ve.stateNode,De?(S=k.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none"):(J=Ve.stateNode,se=Ve.memoizedProps.style,R=se!=null&&se.hasOwnProperty("display")?se.display:null,J.style.display=Ht("display",R))}catch(Rt){ur(s,s.return,Rt)}}}else if(Ve.tag===6){if(ze===null)try{Ve.stateNode.nodeValue=De?"":Ve.memoizedProps}catch(Rt){ur(s,s.return,Rt)}}else if((Ve.tag!==22&&Ve.tag!==23||Ve.memoizedState===null||Ve===s)&&Ve.child!==null){Ve.child.return=Ve,Ve=Ve.child;continue}if(Ve===s)break e;for(;Ve.sibling===null;){if(Ve.return===null||Ve.return===s)break e;ze===Ve&&(ze=null),Ve=Ve.return}ze===Ve&&(ze=null),Ve.sibling.return=Ve.return,Ve=Ve.sibling}}break;case 19:ls(l,s),Cs(s),b&4&&ly(s);break;case 21:break;default:ls(l,s),Cs(s)}}function Cs(s){var l=s.flags;if(l&2){try{e:{for(var h=s.return;h!==null;){if(sy(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&&(dt(k,""),b.flags&=-33);var S=ay(s);pp(s,S,k);break;case 3:case 4:var R=b.stateNode.containerInfo,J=ay(s);mp(s,J,R);break;default:throw Error(r(161))}}catch(se){ur(s,s.return,se)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function IR(s,l,h){jt=s,uy(s)}function uy(s,l,h){for(var b=(s.mode&1)!==0;jt!==null;){var k=jt,S=k.child;if(k.tag===22&&b){var R=k.memoizedState!==null||Xu;if(!R){var J=k.alternate,se=J!==null&&J.memoizedState!==null||Qr;J=Xu;var De=Qr;if(Xu=R,(Qr=se)&&!De)for(jt=k;jt!==null;)R=jt,se=R.child,R.tag===22&&R.memoizedState!==null?my(k):se!==null?(se.return=R,jt=se):my(k);for(;S!==null;)jt=S,uy(S),S=S.sibling;jt=k,Xu=J,Qr=De}dy(s)}else(k.subtreeFlags&8772)!==0&&S!==null?(S.return=k,jt=S):dy(s)}}function dy(s){for(;jt!==null;){var l=jt;if((l.flags&8772)!==0){var h=l.alternate;try{if((l.flags&8772)!==0)switch(l.tag){case 0:case 11:case 15:Qr||Qu(5,l);break;case 1:var b=l.stateNode;if(l.flags&4&&!Qr)if(h===null)b.componentDidMount();else{var k=l.elementType===l.type?h.memoizedProps:as(l.type,h.memoizedProps);b.componentDidUpdate(k,h.memoizedState,b.__reactInternalSnapshotBeforeUpdate)}var S=l.updateQueue;S!==null&&hw(l,S,b);break;case 3:var R=l.updateQueue;if(R!==null){if(h=null,l.child!==null)switch(l.child.tag){case 5:h=l.child.stateNode;break;case 1:h=l.child.stateNode}hw(l,R,h)}break;case 5:var J=l.stateNode;if(h===null&&l.flags&4){h=J;var se=l.memoizedProps;switch(l.type){case"button":case"input":case"select":case"textarea":se.autoFocus&&h.focus();break;case"img":se.src&&(h.src=se.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(l.memoizedState===null){var De=l.alternate;if(De!==null){var ze=De.memoizedState;if(ze!==null){var Ve=ze.dehydrated;Ve!==null&&Ln(Ve)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(r(163))}Qr||l.flags&512&&hp(l)}catch(He){ur(l,l.return,He)}}if(l===s){jt=null;break}if(h=l.sibling,h!==null){h.return=l.return,jt=h;break}jt=l.return}}function hy(s){for(;jt!==null;){var l=jt;if(l===s){jt=null;break}var h=l.sibling;if(h!==null){h.return=l.return,jt=h;break}jt=l.return}}function my(s){for(;jt!==null;){var l=jt;try{switch(l.tag){case 0:case 11:case 15:var h=l.return;try{Qu(4,l)}catch(se){ur(l,h,se)}break;case 1:var b=l.stateNode;if(typeof b.componentDidMount=="function"){var k=l.return;try{b.componentDidMount()}catch(se){ur(l,k,se)}}var S=l.return;try{hp(l)}catch(se){ur(l,S,se)}break;case 5:var R=l.return;try{hp(l)}catch(se){ur(l,R,se)}}}catch(se){ur(l,l.return,se)}if(l===s){jt=null;break}var J=l.sibling;if(J!==null){J.return=l.return,jt=J;break}jt=l.return}}var LR=Math.ceil,Ju=Z.ReactCurrentDispatcher,fp=Z.ReactCurrentOwner,zi=Z.ReactCurrentBatchConfig,Tn=0,Fr=null,vr=null,Hr=0,Di=0,Zo=ga(0),Tr=0,nc=null,to=0,Zu=0,gp=0,rc=null,mi=null,bp=0,el=1/0,Vs=null,ed=!1,vp=null,xa=null,td=!1,Sa=null,nd=0,ic=0,wp=null,rd=-1,id=0;function si(){return(Tn&6)!==0?Tt():rd!==-1?rd:rd=Tt()}function Ca(s){return(s.mode&1)===0?1:(Tn&2)!==0&&Hr!==0?Hr&-Hr:vR.transition!==null?(id===0&&(id=In()),id):(s=G,s!==0||(s=window.event,s=s===void 0?16:aa(s.type)),s)}function cs(s,l,h,b){if(50<ic)throw ic=0,wp=null,Error(r(185));Bn(s,h,b),((Tn&2)===0||s!==Fr)&&(s===Fr&&((Tn&2)===0&&(Zu|=h),Tr===4&&ja(s,Hr)),pi(s,b),h===1&&Tn===0&&(l.mode&1)===0&&(el=Tt()+500,Au&&va()))}function pi(s,l){var h=s.callbackNode;$r(s,l);var b=qr(s,s===Fr?Hr:0);if(b===0)h!==null&&Sn(h),s.callbackNode=null,s.callbackPriority=0;else if(l=b&-b,s.callbackPriority!==l){if(h!=null&&Sn(h),l===1)s.tag===0?bR(fy.bind(null,s)):ew(fy.bind(null,s)),mR(function(){(Tn&6)===0&&va()}),h=null;else{switch(Ee(b)){case 1:h=Xt;break;case 4:h=kn;break;case 16:h=Te;break;case 536870912:h=lt;break;default:h=Te}h=Sy(h,py.bind(null,s))}s.callbackPriority=l,s.callbackNode=h}}function py(s,l){if(rd=-1,id=0,(Tn&6)!==0)throw Error(r(327));var h=s.callbackNode;if(tl()&&s.callbackNode!==h)return null;var b=qr(s,s===Fr?Hr:0);if(b===0)return null;if((b&30)!==0||(b&s.expiredLanes)!==0||l)l=sd(s,b);else{l=b;var k=Tn;Tn|=2;var S=by();(Fr!==s||Hr!==l)&&(Vs=null,el=Tt()+500,ro(s,l));do try{OR();break}catch(J){gy(s,J)}while(!0);_m(),Ju.current=S,Tn=k,vr!==null?l=0:(Fr=null,Hr=0,l=Tr)}if(l!==0){if(l===2&&(k=br(s),k!==0&&(b=k,l=yp(s,k))),l===1)throw h=nc,ro(s,0),ja(s,b),pi(s,Tt()),h;if(l===6)ja(s,b);else{if(k=s.current.alternate,(b&30)===0&&!FR(k)&&(l=sd(s,b),l===2&&(S=br(s),S!==0&&(b=S,l=yp(s,S))),l===1))throw h=nc,ro(s,0),ja(s,b),pi(s,Tt()),h;switch(s.finishedWork=k,s.finishedLanes=b,l){case 0:case 1:throw Error(r(345));case 2:io(s,mi,Vs);break;case 3:if(ja(s,b),(b&130023424)===b&&(l=bp+500-Tt(),10<l)){if(qr(s,0)!==0)break;if(k=s.suspendedLanes,(k&b)!==b){si(),s.pingedLanes|=s.suspendedLanes&k;break}s.timeoutHandle=Nm(io.bind(null,s,mi,Vs),l);break}io(s,mi,Vs);break;case 4:if(ja(s,b),(b&4194240)===b)break;for(l=s.eventTimes,k=-1;0<b;){var R=31-Vt(b);S=1<<R,R=l[R],R>k&&(k=R),b&=~S}if(b=k,b=Tt()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*LR(b/1960))-b,10<b){s.timeoutHandle=Nm(io.bind(null,s,mi,Vs),b);break}io(s,mi,Vs);break;case 5:io(s,mi,Vs);break;default:throw Error(r(329))}}}return pi(s,Tt()),s.callbackNode===h?py.bind(null,s):null}function yp(s,l){var h=rc;return s.current.memoizedState.isDehydrated&&(ro(s,l).flags|=256),s=sd(s,l),s!==2&&(l=mi,mi=h,l!==null&&kp(l)),s}function kp(s){mi===null?mi=s:mi.push.apply(mi,s)}function FR(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(!is(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 ja(s,l){for(l&=~gp,l&=~Zu,s.suspendedLanes|=l,s.pingedLanes&=~l,s=s.expirationTimes;0<l;){var h=31-Vt(l),b=1<<h;s[h]=-1,l&=~b}}function fy(s){if((Tn&6)!==0)throw Error(r(327));tl();var l=qr(s,0);if((l&1)===0)return pi(s,Tt()),null;var h=sd(s,l);if(s.tag!==0&&h===2){var b=br(s);b!==0&&(l=b,h=yp(s,b))}if(h===1)throw h=nc,ro(s,0),ja(s,l),pi(s,Tt()),h;if(h===6)throw Error(r(345));return s.finishedWork=s.current.alternate,s.finishedLanes=l,io(s,mi,Vs),pi(s,Tt()),null}function xp(s,l){var h=Tn;Tn|=1;try{return s(l)}finally{Tn=h,Tn===0&&(el=Tt()+500,Au&&va())}}function no(s){Sa!==null&&Sa.tag===0&&(Tn&6)===0&&tl();var l=Tn;Tn|=1;var h=zi.transition,b=G;try{if(zi.transition=null,G=1,s)return s()}finally{G=b,zi.transition=h,Tn=l,(Tn&6)===0&&va()}}function Sp(){Di=Zo.current,Zn(Zo)}function ro(s,l){s.finishedWork=null,s.finishedLanes=0;var h=s.timeoutHandle;if(h!==-1&&(s.timeoutHandle=-1,hR(h)),vr!==null)for(h=vr.return;h!==null;){var b=h;switch(Am(b),b.tag){case 1:b=b.type.childContextTypes,b!=null&&Ru();break;case 3:Xo(),Zn(ui),Zn(Kr),$m();break;case 5:zm(b);break;case 4:Xo();break;case 13:Zn(ar);break;case 19:Zn(ar);break;case 10:Om(b.type._context);break;case 22:case 23:Sp()}h=h.return}if(Fr=s,vr=s=Na(s.current,null),Hr=Di=l,Tr=0,nc=null,gp=Zu=to=0,mi=rc=null,Ja!==null){for(l=0;l<Ja.length;l++)if(h=Ja[l],b=h.interleaved,b!==null){h.interleaved=null;var k=b.next,S=h.pending;if(S!==null){var R=S.next;S.next=k,b.next=R}h.pending=b}Ja=null}return s}function gy(s,l){do{var h=vr;try{if(_m(),Hu.current=Vu,zu){for(var b=or.memoizedState;b!==null;){var k=b.queue;k!==null&&(k.pending=null),b=b.next}zu=!1}if(eo=0,Lr=Nr=or=null,Xl=!1,Ql=0,fp.current=null,h===null||h.return===null){Tr=1,nc=l,vr=null;break}e:{var S=s,R=h.return,J=h,se=l;if(l=Hr,J.flags|=32768,se!==null&&typeof se=="object"&&typeof se.then=="function"){var De=se,ze=J,Ve=ze.tag;if((ze.mode&1)===0&&(Ve===0||Ve===11||Ve===15)){var He=ze.alternate;He?(ze.updateQueue=He.updateQueue,ze.memoizedState=He.memoizedState,ze.lanes=He.lanes):(ze.updateQueue=null,ze.memoizedState=null)}var wt=Uw(R);if(wt!==null){wt.flags&=-257,Hw(wt,R,J,S,l),wt.mode&1&&Ww(S,De,l),l=wt,se=De;var Pt=l.updateQueue;if(Pt===null){var Rt=new Set;Rt.add(se),l.updateQueue=Rt}else Pt.add(se);break e}else{if((l&1)===0){Ww(S,De,l),Cp();break e}se=Error(r(426))}}else if(er&&J.mode&1){var mr=Uw(R);if(mr!==null){(mr.flags&65536)===0&&(mr.flags|=256),Hw(mr,R,J,S,l),Lm(Qo(se,J));break e}}S=se=Qo(se,J),Tr!==4&&(Tr=2),rc===null?rc=[S]:rc.push(S),S=R;do{switch(S.tag){case 3:S.flags|=65536,l&=-l,S.lanes|=l;var ke=Ow(S,se,l);dw(S,ke);break e;case 1:J=se;var oe=S.type,Ne=S.stateNode;if((S.flags&128)===0&&(typeof oe.getDerivedStateFromError=="function"||Ne!==null&&typeof Ne.componentDidCatch=="function"&&(xa===null||!xa.has(Ne)))){S.flags|=65536,l&=-l,S.lanes|=l;var Ze=Bw(S,J,l);dw(S,Ze);break e}}S=S.return}while(S!==null)}wy(h)}catch(Et){l=Et,vr===h&&h!==null&&(vr=h=h.return);continue}break}while(!0)}function by(){var s=Ju.current;return Ju.current=Vu,s===null?Vu:s}function Cp(){(Tr===0||Tr===3||Tr===2)&&(Tr=4),Fr===null||(to&268435455)===0&&(Zu&268435455)===0||ja(Fr,Hr)}function sd(s,l){var h=Tn;Tn|=2;var b=by();(Fr!==s||Hr!==l)&&(Vs=null,ro(s,l));do try{_R();break}catch(k){gy(s,k)}while(!0);if(_m(),Tn=h,Ju.current=b,vr!==null)throw Error(r(261));return Fr=null,Hr=0,Tr}function _R(){for(;vr!==null;)vy(vr)}function OR(){for(;vr!==null&&!On();)vy(vr)}function vy(s){var l=xy(s.alternate,s,Di);s.memoizedProps=s.pendingProps,l===null?wy(s):vr=l,fp.current=null}function wy(s){var l=s;do{var h=l.alternate;if(s=l.return,(l.flags&32768)===0){if(h=RR(h,l,Di),h!==null){vr=h;return}}else{if(h=MR(h,l),h!==null){h.flags&=32767,vr=h;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{Tr=6,vr=null;return}}if(l=l.sibling,l!==null){vr=l;return}vr=l=s}while(l!==null);Tr===0&&(Tr=5)}function io(s,l,h){var b=G,k=zi.transition;try{zi.transition=null,G=1,BR(s,l,h,b)}finally{zi.transition=k,G=b}return null}function BR(s,l,h,b){do tl();while(Sa!==null);if((Tn&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(Q(s,S),s===Fr&&(vr=Fr=null,Hr=0),(h.subtreeFlags&2064)===0&&(h.flags&2064)===0||td||(td=!0,Sy(Te,function(){return tl(),null})),S=(h.flags&15990)!==0,(h.subtreeFlags&15990)!==0||S){S=zi.transition,zi.transition=null;var R=G;G=1;var J=Tn;Tn|=4,fp.current=null,ER(s,h),cy(h,s),sR(Cm),Sr=!!Sm,Cm=Sm=null,s.current=h,IR(h),Mn(),Tn=J,G=R,zi.transition=S}else s.current=h;if(td&&(td=!1,Sa=s,nd=k),S=s.pendingLanes,S===0&&(xa=null),Nn(h.stateNode),pi(s,Tt()),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(ed)throw ed=!1,s=vp,vp=null,s;return(nd&1)!==0&&s.tag!==0&&tl(),S=s.pendingLanes,(S&1)!==0?s===wp?ic++:(ic=0,wp=s):ic=0,va(),null}function tl(){if(Sa!==null){var s=Ee(nd),l=zi.transition,h=G;try{if(zi.transition=null,G=16>s?16:s,Sa===null)var b=!1;else{if(s=Sa,Sa=null,nd=0,(Tn&6)!==0)throw Error(r(331));var k=Tn;for(Tn|=4,jt=s.current;jt!==null;){var S=jt,R=S.child;if((jt.flags&16)!==0){var J=S.deletions;if(J!==null){for(var se=0;se<J.length;se++){var De=J[se];for(jt=De;jt!==null;){var ze=jt;switch(ze.tag){case 0:case 11:case 15:tc(8,ze,S)}var Ve=ze.child;if(Ve!==null)Ve.return=ze,jt=Ve;else for(;jt!==null;){ze=jt;var He=ze.sibling,wt=ze.return;if(iy(ze),ze===De){jt=null;break}if(He!==null){He.return=wt,jt=He;break}jt=wt}}}var Pt=S.alternate;if(Pt!==null){var Rt=Pt.child;if(Rt!==null){Pt.child=null;do{var mr=Rt.sibling;Rt.sibling=null,Rt=mr}while(Rt!==null)}}jt=S}}if((S.subtreeFlags&2064)!==0&&R!==null)R.return=S,jt=R;else e:for(;jt!==null;){if(S=jt,(S.flags&2048)!==0)switch(S.tag){case 0:case 11:case 15:tc(9,S,S.return)}var ke=S.sibling;if(ke!==null){ke.return=S.return,jt=ke;break e}jt=S.return}}var oe=s.current;for(jt=oe;jt!==null;){R=jt;var Ne=R.child;if((R.subtreeFlags&2064)!==0&&Ne!==null)Ne.return=R,jt=Ne;else e:for(R=oe;jt!==null;){if(J=jt,(J.flags&2048)!==0)try{switch(J.tag){case 0:case 11:case 15:Qu(9,J)}}catch(Et){ur(J,J.return,Et)}if(J===R){jt=null;break e}var Ze=J.sibling;if(Ze!==null){Ze.return=J.return,jt=Ze;break e}jt=J.return}}if(Tn=k,va(),rn&&typeof rn.onPostCommitFiberRoot=="function")try{rn.onPostCommitFiberRoot(Mt,s)}catch{}b=!0}return b}finally{G=h,zi.transition=l}}return!1}function yy(s,l,h){l=Qo(h,l),l=Ow(s,l,1),s=ya(s,l,1),l=si(),s!==null&&(Bn(s,1,l),pi(s,l))}function ur(s,l,h){if(s.tag===3)yy(s,s,h);else for(;l!==null;){if(l.tag===3){yy(l,s,h);break}else if(l.tag===1){var b=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof b.componentDidCatch=="function"&&(xa===null||!xa.has(b))){s=Qo(h,s),s=Bw(l,s,1),l=ya(l,s,1),s=si(),l!==null&&(Bn(l,1,s),pi(l,s));break}}l=l.return}}function WR(s,l,h){var b=s.pingCache;b!==null&&b.delete(l),l=si(),s.pingedLanes|=s.suspendedLanes&h,Fr===s&&(Hr&h)===h&&(Tr===4||Tr===3&&(Hr&130023424)===Hr&&500>Tt()-bp?ro(s,0):gp|=h),pi(s,l)}function ky(s,l){l===0&&((s.mode&1)===0?l=1:(l=zr,zr<<=1,(zr&130023424)===0&&(zr=4194304)));var h=si();s=zs(s,l),s!==null&&(Bn(s,l,h),pi(s,h))}function UR(s){var l=s.memoizedState,h=0;l!==null&&(h=l.retryLane),ky(s,h)}function HR(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),ky(s,h)}var xy;xy=function(s,l,h){if(s!==null)if(s.memoizedProps!==l.pendingProps||ui.current)hi=!0;else{if((s.lanes&h)===0&&(l.flags&128)===0)return hi=!1,DR(s,l,h);hi=(s.flags&131072)!==0}else hi=!1,er&&(l.flags&1048576)!==0&&tw(l,Iu,l.index);switch(l.lanes=0,l.tag){case 2:var b=l.type;Yu(s,l),s=l.pendingProps;var k=zo(l,Kr.current);Yo(l,h),k=Km(null,l,b,s,k,h);var S=Ym();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,di(b)?(S=!0,Mu(l)):S=!1,l.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,Um(l),k.updater=Gu,l.stateNode=k,k._reactInternals=l,tp(l,b,s,h),l=sp(null,l,b,!0,S,h)):(l.tag=0,er&&S&&Mm(l),ii(null,l,k,h),l=l.child),l;case 16:b=l.elementType;e:{switch(Yu(s,l),s=l.pendingProps,k=b._init,b=k(b._payload),l.type=b,k=l.tag=qR(b),s=as(b,s),k){case 0:l=ip(null,l,b,s,h);break e;case 1:l=Kw(null,l,b,s,h);break e;case 11:l=zw(null,l,b,s,h);break e;case 14:l=qw(null,l,b,as(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:as(b,k),ip(s,l,b,k,h);case 1:return b=l.type,k=l.pendingProps,k=l.elementType===b?k:as(b,k),Kw(s,l,b,k,h);case 3:e:{if(Yw(l),s===null)throw Error(r(387));b=l.pendingProps,S=l.memoizedState,k=S.element,uw(s,l),Wu(l,b,null,h);var R=l.memoizedState;if(b=R.element,S.isDehydrated)if(S={element:b,isDehydrated:!1,cache:R.cache,pendingSuspenseBoundaries:R.pendingSuspenseBoundaries,transitions:R.transitions},l.updateQueue.baseState=S,l.memoizedState=S,l.flags&256){k=Qo(Error(r(423)),l),l=Xw(s,l,b,h,k);break e}else if(b!==k){k=Qo(Error(r(424)),l),l=Xw(s,l,b,h,k);break e}else for(Pi=fa(l.stateNode.containerInfo.firstChild),Ti=l,er=!0,ss=null,h=lw(l,null,b,h),l.child=h;h;)h.flags=h.flags&-3|4096,h=h.sibling;else{if(Vo(),b===k){l=$s(s,l,h);break e}ii(s,l,b,h)}l=l.child}return l;case 5:return mw(l),s===null&&Im(l),b=l.type,k=l.pendingProps,S=s!==null?s.memoizedProps:null,R=k.children,jm(b,k)?R=null:S!==null&&jm(b,S)&&(l.flags|=32),Gw(s,l),ii(s,l,R,h),l.child;case 6:return s===null&&Im(l),null;case 13:return Qw(s,l,h);case 4:return Hm(l,l.stateNode.containerInfo),b=l.pendingProps,s===null?l.child=Go(l,null,b,h):ii(s,l,b,h),l.child;case 11:return b=l.type,k=l.pendingProps,k=l.elementType===b?k:as(b,k),zw(s,l,b,k,h);case 7:return ii(s,l,l.pendingProps,h),l.child;case 8:return ii(s,l,l.pendingProps.children,h),l.child;case 12:return ii(s,l,l.pendingProps.children,h),l.child;case 10:e:{if(b=l.type._context,k=l.pendingProps,S=l.memoizedProps,R=k.value,Gn(_u,b._currentValue),b._currentValue=R,S!==null)if(is(S.value,R)){if(S.children===k.children&&!ui.current){l=$s(s,l,h);break e}}else for(S=l.child,S!==null&&(S.return=l);S!==null;){var J=S.dependencies;if(J!==null){R=S.child;for(var se=J.firstContext;se!==null;){if(se.context===b){if(S.tag===1){se=qs(-1,h&-h),se.tag=2;var De=S.updateQueue;if(De!==null){De=De.shared;var ze=De.pending;ze===null?se.next=se:(se.next=ze.next,ze.next=se),De.pending=se}}S.lanes|=h,se=S.alternate,se!==null&&(se.lanes|=h),Bm(S.return,h,l),J.lanes|=h;break}se=se.next}}else if(S.tag===10)R=S.type===l.type?null:S.child;else if(S.tag===18){if(R=S.return,R===null)throw Error(r(341));R.lanes|=h,J=R.alternate,J!==null&&(J.lanes|=h),Bm(R,h,l),R=S.sibling}else R=S.child;if(R!==null)R.return=S;else for(R=S;R!==null;){if(R===l){R=null;break}if(S=R.sibling,S!==null){S.return=R.return,R=S;break}R=R.return}S=R}ii(s,l,k.children,h),l=l.child}return l;case 9:return k=l.type,b=l.pendingProps.children,Yo(l,h),k=Ui(k),b=b(k),l.flags|=1,ii(s,l,b,h),l.child;case 14:return b=l.type,k=as(b,l.pendingProps),k=as(b.type,k),qw(s,l,b,k,h);case 15:return $w(s,l,l.type,l.pendingProps,h);case 17:return b=l.type,k=l.pendingProps,k=l.elementType===b?k:as(b,k),Yu(s,l),l.tag=1,di(b)?(s=!0,Mu(l)):s=!1,Yo(l,h),Fw(l,b,k),tp(l,b,k,h),sp(null,l,b,!0,s,h);case 19:return Zw(s,l,h);case 22:return Vw(s,l,h)}throw Error(r(156,l.tag))};function Sy(s,l){return _t(s,l)}function zR(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 qi(s,l,h,b){return new zR(s,l,h,b)}function jp(s){return s=s.prototype,!(!s||!s.isReactComponent)}function qR(s){if(typeof s=="function")return jp(s)?1:0;if(s!=null){if(s=s.$$typeof,s===z)return 11;if(s===F)return 14}return 2}function Na(s,l){var h=s.alternate;return h===null?(h=qi(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 ad(s,l,h,b,k,S){var R=2;if(b=s,typeof s=="function")jp(s)&&(R=1);else if(typeof s=="string")R=5;else e:switch(s){case E:return so(h.children,k,S,l);case A:R=8,k|=8;break;case H:return s=qi(12,h,l,k|2),s.elementType=H,s.lanes=S,s;case K:return s=qi(13,h,l,k),s.elementType=K,s.lanes=S,s;case O:return s=qi(19,h,l,k),s.elementType=O,s.lanes=S,s;case de:return od(h,k,S,l);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case _:R=10;break e;case Y:R=9;break e;case z:R=11;break e;case F:R=14;break e;case te:R=16,b=null;break e}throw Error(r(130,s==null?s:typeof s,""))}return l=qi(R,h,l,k),l.elementType=s,l.type=b,l.lanes=S,l}function so(s,l,h,b){return s=qi(7,s,b,l),s.lanes=h,s}function od(s,l,h,b){return s=qi(22,s,b,l),s.elementType=de,s.lanes=h,s.stateNode={isHidden:!1},s}function Np(s,l,h){return s=qi(6,s,null,l),s.lanes=h,s}function Tp(s,l,h){return l=qi(4,s.children!==null?s.children:[],s.key,l),l.lanes=h,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}function $R(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=Mr(0),this.expirationTimes=Mr(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mr(0),this.identifierPrefix=b,this.onRecoverableError=k,this.mutableSourceEagerHydrationData=null}function Pp(s,l,h,b,k,S,R,J,se){return s=new $R(s,l,h,J,se),l===1?(l=1,S===!0&&(l|=8)):l=0,S=qi(3,null,null,l),s.current=S,S.stateNode=s,S.memoizedState={element:b,isDehydrated:h,cache:null,transitions:null,pendingSuspenseBoundaries:null},Um(S),s}function VR(s,l,h){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:B,key:b==null?null:""+b,children:s,containerInfo:l,implementation:h}}function Cy(s){if(!s)return ba;s=s._reactInternals;e:{if(Pe(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(di(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(di(h))return Jv(s,h,l)}return l}function jy(s,l,h,b,k,S,R,J,se){return s=Pp(h,b,!0,s,k,S,R,J,se),s.context=Cy(null),h=s.current,b=si(),k=Ca(h),S=qs(b,k),S.callback=l??null,ya(h,S,k),s.current.lanes=k,Bn(s,k,b),pi(s,b),s}function ld(s,l,h,b){var k=l.current,S=si(),R=Ca(k);return h=Cy(h),l.context===null?l.context=h:l.pendingContext=h,l=qs(S,R),l.payload={element:s},b=b===void 0?null:b,b!==null&&(l.callback=b),s=ya(k,l,R),s!==null&&(cs(s,k,R,S),Bu(s,k,R)),R}function cd(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 Ny(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var h=s.retryLane;s.retryLane=h!==0&&h<l?h:l}}function Dp(s,l){Ny(s,l),(s=s.alternate)&&Ny(s,l)}function GR(){return null}var Ty=typeof reportError=="function"?reportError:function(s){console.error(s)};function Rp(s){this._internalRoot=s}ud.prototype.render=Rp.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(r(409));ld(s,l,null,null)},ud.prototype.unmount=Rp.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;no(function(){ld(null,s,null,null)}),l[Bs]=null}};function ud(s){this._internalRoot=s}ud.prototype.unstable_scheduleHydration=function(s){if(s){var l=bn();s={blockedOn:null,target:s,priority:l};for(var h=0;h<Br.length&&l!==0&&l<Br[h].priority;h++);Br.splice(h,0,s),h===0&&me(s)}};function Mp(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function dd(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function Py(){}function KR(s,l,h,b,k){if(k){if(typeof b=="function"){var S=b;b=function(){var De=cd(R);S.call(De)}}var R=jy(l,b,s,0,null,!1,!1,"",Py);return s._reactRootContainer=R,s[Bs]=R.current,Hl(s.nodeType===8?s.parentNode:s),no(),R}for(;k=s.lastChild;)s.removeChild(k);if(typeof b=="function"){var J=b;b=function(){var De=cd(se);J.call(De)}}var se=Pp(s,0,!1,null,null,!1,!1,"",Py);return s._reactRootContainer=se,s[Bs]=se.current,Hl(s.nodeType===8?s.parentNode:s),no(function(){ld(l,se,h,b)}),se}function hd(s,l,h,b,k){var S=h._reactRootContainer;if(S){var R=S;if(typeof k=="function"){var J=k;k=function(){var se=cd(R);J.call(se)}}ld(l,R,s,k)}else R=KR(h,l,s,k,b);return cd(R)}Ge=function(s){switch(s.tag){case 3:var l=s.stateNode;if(l.current.memoizedState.isDehydrated){var h=hr(l.pendingLanes);h!==0&&(je(l,h|1),pi(l,Tt()),(Tn&6)===0&&(el=Tt()+500,va()))}break;case 13:no(function(){var b=zs(s,1);if(b!==null){var k=si();cs(b,s,1,k)}}),Dp(s,1)}},At=function(s){if(s.tag===13){var l=zs(s,134217728);if(l!==null){var h=si();cs(l,s,134217728,h)}Dp(s,134217728)}},gn=function(s){if(s.tag===13){var l=Ca(s),h=zs(s,l);if(h!==null){var b=si();cs(h,s,l,b)}Dp(s,l)}},bn=function(){return G},wn=function(s,l){var h=G;try{return G=s,l()}finally{G=h}},ae=function(s,l,h){switch(l){case"input":if(ue(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=Du(b);if(!k)throw Error(r(90));ct(b),ue(b,k)}}}break;case"textarea":pt(s,h);break;case"select":l=h.value,l!=null&&yt(s,!!h.multiple,l,!1)}},Ut=xp,dn=no;var YR={usingClientEntryPoint:!1,Events:[$l,Uo,Du,jn,ln,xp]},sc={findFiberByHostInstance:Ka,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},XR={bundleType:sc.bundleType,version:sc.version,rendererPackageName:sc.rendererPackageName,rendererConfig:sc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Z.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=$t(s),s===null?null:s.stateNode},findFiberByHostInstance:sc.findFiberByHostInstance||GR,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 md=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!md.isDisabled&&md.supportsFiber)try{Mt=md.inject(XR),rn=md}catch{}}return fi.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=YR,fi.createPortal=function(s,l){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Mp(l))throw Error(r(200));return VR(s,l,null,h)},fi.createRoot=function(s,l){if(!Mp(s))throw Error(r(299));var h=!1,b="",k=Ty;return l!=null&&(l.unstable_strictMode===!0&&(h=!0),l.identifierPrefix!==void 0&&(b=l.identifierPrefix),l.onRecoverableError!==void 0&&(k=l.onRecoverableError)),l=Pp(s,1,!1,null,null,h,!1,b,k),s[Bs]=l.current,Hl(s.nodeType===8?s.parentNode:s),new Rp(l)},fi.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=$t(l),s=s===null?null:s.stateNode,s},fi.flushSync=function(s){return no(s)},fi.hydrate=function(s,l,h){if(!dd(l))throw Error(r(200));return hd(null,s,l,!0,h)},fi.hydrateRoot=function(s,l,h){if(!Mp(s))throw Error(r(405));var b=h!=null&&h.hydratedSources||null,k=!1,S="",R=Ty;if(h!=null&&(h.unstable_strictMode===!0&&(k=!0),h.identifierPrefix!==void 0&&(S=h.identifierPrefix),h.onRecoverableError!==void 0&&(R=h.onRecoverableError)),l=jy(l,null,s,1,h??null,k,!1,S,R),s[Bs]=l.current,Hl(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 ud(l)},fi.render=function(s,l,h){if(!dd(l))throw Error(r(200));return hd(null,s,l,!1,h)},fi.unmountComponentAtNode=function(s){if(!dd(s))throw Error(r(40));return s._reactRootContainer?(no(function(){hd(null,null,s,!1,function(){s._reactRootContainer=null,s[Bs]=null})}),!0):!1},fi.unstable_batchedUpdates=xp,fi.unstable_renderSubtreeIntoContainer=function(s,l,h,b){if(!dd(h))throw Error(r(200));if(s==null||s._reactInternals===void 0)throw Error(r(38));return hd(s,l,h,!1,b)},fi.version="18.3.1-next-f1338f8080-20240426",fi}var Fy;function gj(){if(Fy)return Ip.exports;Fy=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(),Ip.exports=s1(),Ip.exports}var _y;function a1(){if(_y)return pd;_y=1;var e=gj();return pd.createRoot=e.createRoot,pd.hydrateRoot=e.hydrateRoot,pd}var o1=a1();const l1=au(o1);var p=Jg();const c1=au(p),u1=fj({__proto__:null,default:c1},[p]);function d1(e){return e==="http:"||e==="https:"}function ta(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(!d1(i.protocol))throw new Error("INVALID_SERVER_PROTOCOL");i.hash="",i.search="";const a=i.pathname.replace(/\/+$/,"");return`${i.origin}${a==="/"?"":a}`}const pl="codingns.auth.remembered-login";function Zg(){return typeof window<"u"&&typeof window.localStorage<"u"}function h1(e){return e.isNativeMobile?!0:e.isDesktop?e.ui.osFamily==="windows"||e.ui.osFamily==="macos":!1}function bj(){if(!Zg())return null;const e=window.localStorage.getItem(pl);if(!e)return null;try{const t=JSON.parse(e);if(typeof t.username!="string"||typeof t.password!="string"||typeof t.serverBaseUrl!="string")return window.localStorage.removeItem(pl),null;const r=t.username.trim(),i=t.password,a=ta(t.serverBaseUrl);return!r||!i?(window.localStorage.removeItem(pl),null):{username:r,password:i,serverBaseUrl:a}}catch{return window.localStorage.removeItem(pl),null}}function vj(e){if(!Zg())return;const t={username:e.username.trim(),password:e.password,serverBaseUrl:ta(e.serverBaseUrl)};window.localStorage.setItem(pl,JSON.stringify(t))}function m1(e){const t=bj();t&&vj({...t,serverBaseUrl:e})}function p1(){Zg()&&window.localStorage.removeItem(pl)}function wj(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 f1(e){return{windowId:e.windowId,kind:e.kind,workspaceId:e.workspaceId??null,sessionId:e.sessionId??null,mode:e.mode??"docked",bounds:wj(e.bounds),focusOwner:e.focusOwner??null}}function hl(e){return{...e,bounds:{...e.bounds}}}function g1(e){return{descriptors:Object.fromEntries(Object.entries(e.descriptors).map(([r,i])=>[r,hl(i)])),openWindowIds:[...e.openWindowIds],lastActiveWindowId:e.lastActiveWindowId}}function Oy(){return{descriptors:{},openWindowIds:[],lastActiveWindowId:null}}function b1(e,t){return{...e,...t,windowId:e.windowId,bounds:wj({...e.bounds,...t.bounds})}}class v1{constructor(){it(this,"state",Oy());it(this,"listeners",new Set);it(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));it(this,"getState",()=>g1(this.state))}registerDescriptor(t){const r=hl(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(),hl(r)}updateDescriptor(t,r){const i=this.state.descriptors[t];if(!i)return null;const a=b1(i,r);return this.state={...this.state,descriptors:{...this.state.descriptors,[t]:a}},this.emit(),hl(a)}getDescriptor(t){const r=this.state.descriptors[t];return r?hl(r):null}getWindows(){return Object.values(this.state.descriptors).map(t=>({descriptor:hl(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=Oy(),t&&this.emit()}emit(){for(const t of this.listeners)t()}}function w1(){return new v1}const y1=w1();function k1(){return y1}const x1=k1();function yj(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function kj(){var u,c;if(typeof navigator>"u")return"unknown";const e=navigator.userAgent.toLowerCase(),t=navigator.userAgentData,r=((u=t==null?void 0:t.platform)==null?void 0:u.toLowerCase())??((c=navigator.platform)==null?void 0:c.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 S1(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 C1(e){const t=S1(e);return t<768?"compact":t<1024?"medium":"expanded"}function j1(e){const t=kj();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 pr(e){return{ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:e}}async function wr(e,t){return xj(e,t)}async function xj(e,t){if(!yj())return pr("当前运行环境不支持桌面壳能力。");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 N1(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 Sj(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}async function Cj(e){if(Sj())try{navigator.vibrate(N1(e))}catch{return}}async function jj(e,t){if(typeof window>"u"||typeof Notification>"u")return pr("当前环境不支持系统通知。");try{if(Notification.permission==="default"&&await Notification.requestPermission()!=="granted"||Notification.permission!=="granted")return pr("系统通知权限未授予。");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 T1{constructor(){it(this,"supported",!1)}openExternal(t){return typeof window>"u"?Promise.resolve(pr("当前环境无法打开外部链接。")):(window.open(t,"_blank","noopener,noreferrer"),Promise.resolve({ok:!0}))}showNotification(t,r){return jj(t,r)}writeClipboardText(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}setWindowState(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}readDesktopConfig(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}writeDesktopConfig(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}getRuntimeInfo(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}checkForUpdate(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}installUpdate(){return Promise.resolve({ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前不是桌面端运行环境。"})}rollbackToPreviousVersion(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}pickDirectory(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}createWindow(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}closeWindow(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}focusWindow(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}listWindows(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}isWindowOpen(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}getWindowDescriptor(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}syncWindowDescriptor(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}updateWindowBounds(){return Promise.resolve(pr("当前不是桌面端运行环境。"))}}class P1{constructor(){it(this,"supported",Sj())}trigger(t){return Cj(t)}}class D1{constructor(){it(this,"supported",!0)}openExternal(t){return wr("open_external",{url:t})}async showNotification(t,r){const i=await jj(t,r);return i.ok?i:wr("show_notification",{title:t,body:r})}writeClipboardText(t){return wr("copy_text",{text:t})}setWindowState(t){return wr("set_window_state",{state:t})}readDesktopConfig(){return wr("read_desktop_config")}writeDesktopConfig(t){return wr("write_desktop_config",{patch:t})}getRuntimeInfo(){return wr("get_runtime_info")}checkForUpdate(t){return wr("check_for_update",{channel:t})}async installUpdate(t){const r=await wr("install_update",{manifest:t});return r.ok?r.value??{ok:!0}:{ok:!1,errorCode:r.errorCode,detail:r.detail}}rollbackToPreviousVersion(){return wr("rollback_to_previous_version")}pickDirectory(){return wr("pick_directory")}createWindow(t){return wr("create_window",{descriptor:t})}closeWindow(t){return wr("close_window",{windowId:t})}focusWindow(t){return wr("focus_window",{windowId:t})}listWindows(){return wr("list_windows")}isWindowOpen(t){return wr("is_window_open",{windowId:t})}getWindowDescriptor(t){return typeof t=="string"?wr("get_window_descriptor",{windowId:t}):wr("get_window_descriptor")}syncWindowDescriptor(t){return wr("sync_window_descriptor",{descriptor:t})}updateWindowBounds(t,r){return wr("update_window_bounds",{windowId:t,bounds:r})}}class R1{constructor(){it(this,"supported",!0)}async trigger(t){(await xj("perform_haptic_feedback",{kind:t})).ok||await Cj(t)}}function Nj(){if(!yj())return"web";const e=kj();return e==="ios"?"ios":e==="android"?"android":"desktop"}function Es(e={}){const t=Nj(),r=C1(e.viewportWidth),i=t==="ios"||t==="android";return{platform:t,isDesktop:t==="desktop",isWeb:t==="web",isMobile:r!=="expanded",isNativeMobile:i,viewportClass:r,ui:j1(t),bridge:t==="desktop"?new D1:new T1,windows:x1,haptics:i?new R1:new P1}}const ig="codingns.client.runtime-config";function eb(e){return e==="desktop"||e==="ios"||e==="android"}function Tj(e){return e==="en"||e==="en-US"?"en-US":"zh-CN"}function M1(){return typeof navigator>"u"?"zh-CN":Tj(navigator.language)}function A1(e){return e==="acceptEdits"||e==="bypassPermissions"?e:"default"}function Pj(){return typeof window<"u"&&typeof window.localStorage<"u"}function E1(){if(!Pj())return null;const e=window.localStorage.getItem(ig);if(!e)return null;try{return JSON.parse(e)}catch{return window.localStorage.removeItem(ig),null}}function Dj(e){Pj()&&window.localStorage.setItem(ig,JSON.stringify(e))}function I1(){var e;return typeof window>"u"||!((e=window.location)!=null&&e.origin)?null:window.location.origin}function L1(e){if(!e)return null;try{return ta(e)}catch{return null}}function tb(e){if(e==="web"){const t=L1(I1());if(t)return t}return ta("http://127.0.0.1:3002")}function F1(e){return{platform:e,hostBaseUrl:tb(e),releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:M1(),defaultPermissionMode:"default"}}function sg(e,t){if(!t)return e;const r=t.platform??e.platform;return{...e,...t,hostBaseUrl:eb(r)?t.hostBaseUrl?ta(t.hostBaseUrl):e.hostBaseUrl:tb(r),platform:r,releaseChannel:t.releaseChannel??e.releaseChannel,autoReconnect:t.autoReconnect??e.autoReconnect,autoCheckUpdate:t.autoCheckUpdate??e.autoCheckUpdate,language:Tj(t.language??e.language),defaultPermissionMode:A1(t.defaultPermissionMode??e.defaultPermissionMode)}}async function _1(){const e=Es(),t=F1(e.platform),r=E1();let i=null;if(e.isDesktop){const u=await e.bridge.readDesktopConfig();u.ok&&u.value&&(i=u.value)}const a=sg(sg(t,r),i);return Dj(a),a}async function O1(e,t){const r=sg(e,t);Dj(r),m1(r.hostBaseUrl);const i=Es();return i.isDesktop&&await i.bridge.writeDesktopConfig(r),r}function B1(){const e=Nj();return{platform:e,hostBaseUrl:tb(e),releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:"zh-CN",defaultPermissionMode:"default"}}class W1{constructor(){it(this,"state",B1());it(this,"listeners",new Set);it(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));it(this,"getState",()=>this.state)}hydrate(t){this.state=t,this.emit()}async initialize(){const t=await _1();return this.hydrate(t),t}async update(t){const r=await O1(this.state,t);return this.hydrate(r),r}emit(){for(const t of this.listeners)t()}}const Dr=new W1;function U1(e){return p.useSyncExternalStore(Dr.subscribe,()=>e(Dr.getState()))}function H1(e){return e.endsWith("/")?e:`${e}/`}function z1(e){return e.replace(/^\/+/,"")}function Uc(){return Dr.getState().hostBaseUrl}function nb(e,t=Uc()){return new URL(z1(e),H1(t)).toString()}function Rj(e,t=Uc()){const r=new URL(nb(e,t));return r.protocol=r.protocol==="https:"?"wss:":"ws:",r.toString()}class ei extends Error{constructor(r,i){super(i.detail);it(this,"status");it(this,"errorCode");it(this,"field");this.name="ApiError",this.status=r,this.errorCode=i.error_code,this.field=i.field}}class q1{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,u=nb(t,r.baseUrl??Uc());if(a&&!i.has("Content-Type")&&i.set("Content-Type","application/json"),!r.skipAuth){const m=(d=rr.getState().session)==null?void 0:d.accessToken;if(!m)throw rr.clear(),new ei(401,{detail:"当前没有可用的登录态",error_code:"UNAUTHORIZED"});i.set("Authorization",`Bearer ${m}`)}let c;try{c=await fetch(u,{...r,headers:i})}catch(m){const f=m instanceof Error?m.message:"未知网络错误";throw new ei(0,{detail:`请求 ${u} 失败:${f}`,error_code:"NETWORK_ERROR"})}if(!c.ok){const m=await $1(c);if(Mj(c.status,m.error_code)&&!r.skipAuth&&!r.retryAfterRefresh){const f=await rr.refresh();if(f.status==="refreshed")return this.performRequest(t,{...r,retryAfterRefresh:!0});throw f.status==="invalid"?new ei(401,{detail:"登录态已经失效,请重新登录",error_code:"UNAUTHORIZED"}):new ei(0,{detail:"登录态暂时无法恢复,请稍后重试",error_code:"AUTH_REFRESH_UNAVAILABLE"})}throw!r.skipAuth&&V1(c.status,m.error_code)&&(sessionStorage.setItem(ag,String(Date.now())),rr.clear()),new ei(c.status,m)}return c}}const Ue=new q1;async function $1(e){const t=await e.text();if(!t)return By(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 By(e.status,t)}function By(e,t){return{detail:(t==null?void 0:t.trim())||`请求失败(HTTP ${e})`,error_code:e===401?"UNAUTHORIZED":"HTTP_ERROR"}}function Mj(e,t){return e!==401?!1:t==="UNAUTHORIZED"||t==="TOKEN_EXPIRED"||t==="TOKEN_INVALID"}function V1(e,t){return e===403&&t==="BOOTSTRAP_REQUIRED"?!0:Mj(e,t)}const ag="codingns.auth_expired_at";function G1(){const e=sessionStorage.getItem(ag);return e?(sessionStorage.removeItem(ag),Date.now()-Number(e)<5e3):!1}function K1(e){return Ue.request("/api/public/bootstrap-status",{baseUrl:e,skipAuth:!0})}function Y1(e,t){return Ue.request("/api/public/setup",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function X1(e,t){return Ue.request("/api/auth/login",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function Q1(e,t){return Ue.request("/api/auth/refresh",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}const oc="codingns.auth.session";class J1{constructor(){it(this,"state",{status:"anonymous",session:this.readSession()});it(this,"listeners",new Set);it(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));it(this,"getState",()=>this.state);this.state.session&&(this.state={status:"authenticated",session:this.state.session})}async login(t,r,i){const a=await X1({username:t,password:r},i);return this.setSession(a),a}async bootstrap(t,r,i){await Y1({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;if(!r)return this.clear(),{status:"invalid",session:null};this.state={...this.state,status:"refreshing"},this.emit();try{const i=await Q1({refreshToken:r});return this.setSession(i),{status:"refreshed",session:i}}catch(i){return eM(i)?(this.clear(),{status:"invalid",session:null}):(this.state={status:t?"authenticated":"anonymous",session:t},this.emit(),{status:"deferred",session:t,error:i})}}clear(){this.state={status:"anonymous",session:null},window.localStorage.removeItem(oc),this.emit()}setSession(t){this.state={status:"authenticated",session:t};const r={serverBaseUrl:Uc(),session:t};window.localStorage.setItem(oc,JSON.stringify(r)),this.emit()}readSession(){const t=window.localStorage.getItem(oc);if(!t)return null;try{const r=JSON.parse(t),i=Uc();return Z1(r)?(r.serverBaseUrl&&r.serverBaseUrl!==i,r.session):Ej(r)?r:(window.localStorage.removeItem(oc),null)}catch{return window.localStorage.removeItem(oc),null}}emit(){for(const t of this.listeners)t()}}const rr=new J1;function Aj(e){return p.useSyncExternalStore(rr.subscribe,()=>e(rr.getState()))}function Z1(e){return typeof e!="object"||e===null?!1:"session"in e&&Ej(e.session)}function Ej(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 eM(e){return e instanceof ei?e.status===401?!0:e.status===403&&e.errorCode==="BOOTSTRAP_REQUIRED":!1}const Ij="/api/preferences/profile";async function tM(){return Ue.request(Ij)}async function Lj(e){return Ue.request(Ij,{method:"PUT",body:JSON.stringify(e)})}const Hh=["claude-code","codex","opencode","gemini","kimi"],Fj="codingns.account.preferences.shadow",nM="codingns.client.runtime-config",rM="codingns-theme",iM="composer-selected-model:",sM="composer-reasoning-level:";function ou(){return typeof window<"u"&&typeof window.localStorage<"u"}function rb(e){return e==="en-US"||e==="en"?"en-US":e==="zh-CN"?"zh-CN":null}function aM(){return typeof navigator>"u"?"zh-CN":rb(navigator.language)??"zh-CN"}function _j(e){return e==="light"||e==="dark"||e==="sky-blue"||e==="eye-green"?e:null}function oM(){return typeof window>"u"||typeof window.matchMedia!="function"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Oj(e){return e==="acceptEdits"||e==="bypassPermissions"||e==="default"?e:null}function Bj(e){return e==="low"||e==="medium"||e==="high"||e==="xhigh"?e:null}function Wj(){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 Uj(){return{initialized:!0,profile:{language:aM(),theme:oM(),defaultPermissionMode:"default"},providers:Wj(),updatedAt:null,source:"default"}}function lM(){const e=Dr.getState(),t={language:e.language,defaultPermissionMode:e.defaultPermissionMode};if(!ou())return t;const r=window.localStorage.getItem(nM);if(!r)return t;try{const i=JSON.parse(r);return{language:rb(i.language)??t.language,defaultPermissionMode:Oj(i.defaultPermissionMode)??t.defaultPermissionMode}}catch{return t}}function cM(){return ou()?_j(window.localStorage.getItem(rM)):null}function uM(){var t;if(!ou())return;const e={};for(const r of Hh){const i=((t=window.localStorage.getItem(`${iM}${r}`))==null?void 0:t.trim())||null,a=Bj(window.localStorage.getItem(`${sM}${r}`));i===null&&a===null||(e[r]={defaultModel:i,defaultReasoningLevel:a})}return Object.keys(e).length>0?e:void 0}function Hj(){const e=lM(),t=cM(),r=uM(),i={};return e.language&&(i.language=e.language),t&&(i.theme=t),e.defaultPermissionMode&&(i.defaultPermissionMode=e.defaultPermissionMode),r&&(i.providers=r),zj(i)?i:null}function zj(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 fh(e){var i;const t=Uj(),r=Wj();for(const a of Hh){const u=(i=e==null?void 0:e.providers)==null?void 0:i[a];r[a]={defaultModel:typeof(u==null?void 0:u.defaultModel)=="string"&&u.defaultModel.trim()||null,defaultReasoningLevel:Bj(u==null?void 0:u.defaultReasoningLevel)??null}}return{language:rb(e==null?void 0:e.language)??t.profile.language,theme:_j(e==null?void 0:e.theme)??t.profile.theme,defaultPermissionMode:Oj(e==null?void 0:e.defaultPermissionMode)??t.profile.defaultPermissionMode,providers:r,updatedAt:typeof(e==null?void 0:e.updatedAt)=="string"?e.updatedAt:null}}function dM(){var t,r,i;if(!ou())return null;const e=window.localStorage.getItem(Fj);if(!e)return null;try{const a=JSON.parse(e),u=fh({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:u.language,theme:u.theme,defaultPermissionMode:u.defaultPermissionMode},providers:u.providers,updatedAt:u.updatedAt}}catch{return null}}function gh(e){if(!ou())return;const t={profile:e.profile,providers:e.providers,updatedAt:e.updatedAt};window.localStorage.setItem(Fj,JSON.stringify(t))}function nl(){const e=Uj(),t=Hj(),r=t?qj(e,t,"default"):e,i=dM();return i?{initialized:!0,profile:i.profile,providers:i.providers,updatedAt:i.updatedAt,source:"shadow"}:r}function og(e,t){return{initialized:!0,profile:{language:e.language,theme:e.theme,defaultPermissionMode:e.defaultPermissionMode},providers:e.providers,updatedAt:e.updatedAt,source:t}}function qj(e,t,r){const i={...e.providers};if(t.providers)for(const a of Hh){const u=t.providers[a];u&&(i[a]={defaultModel:u.defaultModel!==void 0?u.defaultModel??null:e.providers[a].defaultModel,defaultReasoningLevel:u.defaultReasoningLevel!==void 0?u.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 hM(){const e=fh(await tM());if(e.updatedAt===null){const r=Hj();if(zj(r)){const i=fh(await Lj(r)),a=og(i,"remote");return gh(a),a}}const t=og(e,"remote");return gh(t),t}class mM{constructor(){it(this,"state",nl());it(this,"listeners",new Set);it(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));it(this,"getState",()=>this.state);Dr.subscribe(()=>{rr.getState().session||this.state.source==="remote"||this.hydrate(nl())})}hydrate(t){this.state=t,this.emit()}resetToLocalFallback(){this.hydrate(nl())}async initialize(){if(!rr.getState().session){const t=nl();return this.hydrate(t),t}return this.refreshForAuthenticatedUser()}async refreshForAuthenticatedUser(){if(!rr.getState().session){const t=nl();return this.hydrate(t),t}try{const t=await hM();return this.hydrate(t),t}catch{const t=nl();return this.hydrate(t),t}}async updateProfile(t){const r=this.state,i=qj(r,t,r.source);if(this.hydrate(i),!rr.getState().session)return gh(i),i;try{const a=fh(await Lj(t)),u=og(a,"remote");return gh(u),this.hydrate(u),u}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 bs=new mM;function lg(e){return p.useSyncExternalStore(bs.subscribe,()=>e(bs.getState()))}function _p(e){return Hh.includes(e)}function pM(){return bs.initialize()}function bh(e){return bs.updateProfile(e)}function To(e){return lg(t=>e({profile:{...t.profile,providers:t.providers,updatedAt:t.updatedAt},isFetching:!1,error:null}))}async function fM(){const e=Es();return await Dr.initialize(),await pM(),{platform:e.platform}}var Xn=gj();const gM=au(Xn),bM=fj({__proto__:null,default:gM},[Xn]);/**
|
|
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 nr(){return nr=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},nr.apply(this,arguments)}var kr;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(kr||(kr={}));const Wy="popstate";function vM(e){e===void 0&&(e={});function t(i,a){let{pathname:u,search:c,hash:d}=i.location;return Hc("",{pathname:u,search:c,hash:d},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function r(i,a){return typeof a=="string"?a:lu(a)}return yM(t,r,null,e)}function yn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function wo(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function wM(){return Math.random().toString(36).substr(2,8)}function Uy(e,t){return{usr:e.state,key:e.key,idx:t}}function Hc(e,t,r,i){return r===void 0&&(r=null),nr({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Wa(t):t,{state:r,key:t&&t.key||i||wM()})}function lu(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 Wa(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 yM(e,t,r,i){i===void 0&&(i={});let{window:a=document.defaultView,v5Compat:u=!1}=i,c=a.history,d=kr.Pop,m=null,f=v();f==null&&(f=0,c.replaceState(nr({},c.state,{idx:f}),""));function v(){return(c.state||{idx:null}).idx}function g(){d=kr.Pop;let j=v(),T=j==null?null:j-f;f=j,m&&m({action:d,location:C.location,delta:T})}function w(j,T){d=kr.Push;let P=Hc(C.location,j,T);f=v()+1;let I=Uy(P,f),Z=C.createHref(P);try{c.pushState(I,"",Z)}catch(q){if(q instanceof DOMException&&q.name==="DataCloneError")throw q;a.location.assign(Z)}u&&m&&m({action:d,location:C.location,delta:1})}function y(j,T){d=kr.Replace;let P=Hc(C.location,j,T);f=v();let I=Uy(P,f),Z=C.createHref(P);c.replaceState(I,"",Z),u&&m&&m({action:d,location:C.location,delta:0})}function x(j){let T=a.location.origin!=="null"?a.location.origin:a.location.href,P=typeof j=="string"?j:lu(j);return P=P.replace(/ $/,"%20"),yn(T,"No window.location.(origin|href) available to create URL for href: "+P),new URL(P,T)}let C={get action(){return d},get location(){return e(a,c)},listen(j){if(m)throw new Error("A history only accepts one active listener");return a.addEventListener(Wy,g),m=j,()=>{a.removeEventListener(Wy,g),m=null}},createHref(j){return t(a,j)},createURL:x,encodeLocation(j){let T=x(j);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:w,replace:y,go(j){return c.go(j)}};return C}var _n;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(_n||(_n={}));const kM=new Set(["lazy","caseSensitive","path","id","index","children"]);function xM(e){return e.index===!0}function vh(e,t,r,i){return r===void 0&&(r=[]),i===void 0&&(i={}),e.map((a,u)=>{let c=[...r,String(u)],d=typeof a.id=="string"?a.id:c.join("-");if(yn(a.index!==!0||!a.children,"Cannot specify children on an index route"),yn(!i[d],'Found a route id collision on id "'+d+`". Route id's must be globally unique within Data Router usages`),xM(a)){let m=nr({},a,t(a),{id:d});return i[d]=m,m}else{let m=nr({},a,t(a),{id:d,children:void 0});return i[d]=m,a.children&&(m.children=vh(a.children,t,c,i)),m}})}function mo(e,t,r){return r===void 0&&(r="/"),Jd(e,t,r,!1)}function Jd(e,t,r,i){let a=typeof t=="string"?Wa(t):t,u=cu(a.pathname||"/",r);if(u==null)return null;let c=$j(e);CM(c);let d=null;for(let m=0;d==null&&m<c.length;++m){let f=LM(u);d=EM(c[m],f,i)}return d}function SM(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 $j(e,t,r,i){t===void 0&&(t=[]),r===void 0&&(r=[]),i===void 0&&(i="");let a=(u,c,d)=>{let m={relativePath:d===void 0?u.path||"":d,caseSensitive:u.caseSensitive===!0,childrenIndex:c,route:u};m.relativePath.startsWith("/")&&(yn(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=Oa([i,m.relativePath]),v=r.concat(m);u.children&&u.children.length>0&&(yn(u.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+f+'".')),$j(u.children,t,v,f)),!(u.path==null&&!u.index)&&t.push({path:f,score:MM(f,u.index),routesMeta:v})};return e.forEach((u,c)=>{var d;if(u.path===""||!((d=u.path)!=null&&d.includes("?")))a(u,c);else for(let m of Vj(u.path))a(u,c,m)}),t}function Vj(e){let t=e.split("/");if(t.length===0)return[];let[r,...i]=t,a=r.endsWith("?"),u=r.replace(/\?$/,"");if(i.length===0)return a?[u,""]:[u];let c=Vj(i.join("/")),d=[];return d.push(...c.map(m=>m===""?u:[u,m].join("/"))),a&&d.push(...c),d.map(m=>e.startsWith("/")&&m===""?"/":m)}function CM(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:AM(t.routesMeta.map(i=>i.childrenIndex),r.routesMeta.map(i=>i.childrenIndex)))}const jM=/^:[\w-]+$/,NM=3,TM=2,PM=1,DM=10,RM=-2,Hy=e=>e==="*";function MM(e,t){let r=e.split("/"),i=r.length;return r.some(Hy)&&(i+=RM),t&&(i+=TM),r.filter(a=>!Hy(a)).reduce((a,u)=>a+(jM.test(u)?NM:u===""?PM:DM),i)}function AM(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 EM(e,t,r){r===void 0&&(r=!1);let{routesMeta:i}=e,a={},u="/",c=[];for(let d=0;d<i.length;++d){let m=i[d],f=d===i.length-1,v=u==="/"?t:t.slice(u.length)||"/",g=xr({path:m.relativePath,caseSensitive:m.caseSensitive,end:f},v),w=m.route;if(!g&&f&&r&&!i[i.length-1].route.index&&(g=xr({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},v)),!g)return null;Object.assign(a,g.params),c.push({params:a,pathname:Oa([u,g.pathname]),pathnameBase:BM(Oa([u,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(u=Oa([u,g.pathnameBase]))}return c}function xr(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,i]=IM(e.path,e.caseSensitive,e.end),a=t.match(r);if(!a)return null;let u=a[0],c=u.replace(/(.)\/+$/,"$1"),d=a.slice(1);return{params:i.reduce((f,v,g)=>{let{paramName:w,isOptional:y}=v;if(w==="*"){let C=d[g]||"";c=u.slice(0,u.length-C.length).replace(/(.)\/+$/,"$1")}const x=d[g];return y&&!x?f[w]=void 0:f[w]=(x||"").replace(/%2F/g,"/"),f},{}),pathname:u,pathnameBase:c,pattern:e}}function IM(e,t,r){t===void 0&&(t=!1),r===void 0&&(r=!0),wo(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,(c,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 LM(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return wo(!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 cu(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 FM=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_M=e=>FM.test(e);function OM(e,t){t===void 0&&(t="/");let{pathname:r,search:i="",hash:a=""}=typeof e=="string"?Wa(e):e,u;if(r)if(_M(r))u=r;else{if(r.includes("//")){let c=r;r=r.replace(/\/\/+/g,"/"),wo(!1,"Pathnames cannot have embedded double slashes - normalizing "+(c+" -> "+r))}r.startsWith("/")?u=zy(r.substring(1),"/"):u=zy(r,t)}else u=t;return{pathname:u,search:WM(i),hash:UM(a)}}function zy(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 Op(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 Gj(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function ib(e,t){let r=Gj(e);return t?r.map((i,a)=>a===r.length-1?i.pathname:i.pathnameBase):r.map(i=>i.pathnameBase)}function sb(e,t,r,i){i===void 0&&(i=!1);let a;typeof e=="string"?a=Wa(e):(a=nr({},e),yn(!a.pathname||!a.pathname.includes("?"),Op("?","pathname","search",a)),yn(!a.pathname||!a.pathname.includes("#"),Op("#","pathname","hash",a)),yn(!a.search||!a.search.includes("#"),Op("#","search","hash",a)));let u=e===""||a.pathname==="",c=u?"/":a.pathname,d;if(c==null)d=r;else{let g=t.length-1;if(!i&&c.startsWith("..")){let w=c.split("/");for(;w[0]==="..";)w.shift(),g-=1;a.pathname=w.join("/")}d=g>=0?t[g]:"/"}let m=OM(a,d),f=c&&c!=="/"&&c.endsWith("/"),v=(u||c===".")&&r.endsWith("/");return!m.pathname.endsWith("/")&&(f||v)&&(m.pathname+="/"),m}const Oa=e=>e.join("/").replace(/\/\/+/g,"/"),BM=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),WM=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,UM=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class wh{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 zc(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Kj=["post","put","patch","delete"],HM=new Set(Kj),zM=["get",...Kj],qM=new Set(zM),$M=new Set([301,302,303,307,308]),VM=new Set([307,308]),Bp={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},GM={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},lc={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},ab=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,KM=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Yj="remix-router-transitions";function YM(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;yn(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 ee=e.detectErrorBoundary;a=ne=>({hasErrorBoundary:ee(ne)})}else a=KM;let u={},c=vh(e.routes,a,void 0,u),d,m=e.basename||"/",f=e.dataStrategy||ZM,v=e.patchRoutesOnNavigation,g=nr({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),w=null,y=new Set,x=null,C=null,j=null,T=e.hydrationData!=null,P=mo(c,e.history.location,m),I=!1,Z=null;if(P==null&&!v){let ee=wi(404,{pathname:e.history.location.pathname}),{matches:ne,route:pe}=ek(c);P=ne,Z={[pe.id]:ee}}P&&!e.hydrationData&&dn(P,c,e.history.location.pathname).active&&(P=null);let q;if(P)if(P.some(ee=>ee.route.lazy))q=!1;else if(!P.some(ee=>ee.route.loader))q=!0;else if(g.v7_partialHydration){let ee=e.hydrationData?e.hydrationData.loaderData:null,ne=e.hydrationData?e.hydrationData.errors:null;if(ne){let pe=P.findIndex(ve=>ne[ve.route.id]!==void 0);q=P.slice(0,pe+1).every(ve=>!ug(ve.route,ee,ne))}else q=P.every(pe=>!ug(pe.route,ee,ne))}else q=e.hydrationData!=null;else if(q=!1,P=[],g.v7_partialHydration){let ee=dn(null,c,e.history.location.pathname);ee.active&&ee.matches&&(I=!0,P=ee.matches)}let B,E={historyAction:e.history.action,location:e.history.location,matches:P,initialized:q,navigation:Bp,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||Z,fetchers:new Map,blockers:new Map},A=kr.Pop,H=!1,_,Y=!1,z=new Map,K=null,O=!1,F=!1,te=[],de=new Set,W=new Map,M=0,N=-1,L=new Map,X=new Set,D=new Map,be=new Map,ce=new Set,le=new Map,ye=new Map,Se;function _e(){if(w=e.history.listen(ee=>{let{action:ne,location:pe,delta:ve}=ee;if(Se){Se(),Se=void 0;return}wo(ye.size===0||ve!=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 We=ae({currentLocation:E.location,nextLocation:pe,historyAction:ne});if(We&&ve!=null){let Ye=new Promise(mt=>{Se=mt});e.history.go(ve*-1),on(We,{state:"blocked",location:pe,proceed(){on(We,{state:"proceeding",proceed:void 0,reset:void 0,location:pe}),Ye.then(()=>e.history.go(ve))},reset(){let mt=new Map(E.blockers);mt.set(We,lc),ct({blockers:mt})}});return}return fe(ne,pe)}),r){mA(t,z);let ee=()=>pA(t,z);t.addEventListener("pagehide",ee),K=()=>t.removeEventListener("pagehide",ee)}return E.initialized||fe(kr.Pop,E.location,{initialHydration:!0}),B}function Ce(){w&&w(),K&&K(),y.clear(),_&&_.abort(),E.fetchers.forEach((ee,ne)=>It(ne)),E.blockers.forEach((ee,ne)=>zt(ne))}function Nt(ee){return y.add(ee),()=>y.delete(ee)}function ct(ee,ne){ne===void 0&&(ne={}),E=nr({},E,ee);let pe=[],ve=[];g.v7_fetcherPersist&&E.fetchers.forEach((We,Ye)=>{We.state==="idle"&&(ce.has(Ye)?ve.push(Ye):pe.push(Ye))}),ce.forEach(We=>{!E.fetchers.has(We)&&!W.has(We)&&ve.push(We)}),[...y].forEach(We=>We(E,{deletedFetchers:ve,viewTransitionOpts:ne.viewTransitionOpts,flushSync:ne.flushSync===!0})),g.v7_fetcherPersist?(pe.forEach(We=>E.fetchers.delete(We)),ve.forEach(We=>It(We))):ve.forEach(We=>ce.delete(We))}function gt(ee,ne,pe){var ve,We;let{flushSync:Ye}=pe===void 0?{}:pe,mt=E.actionData!=null&&E.navigation.formMethod!=null&&ms(E.navigation.formMethod)&&E.navigation.state==="loading"&&((ve=ee.state)==null?void 0:ve._isRedirect)!==!0,Je;ne.actionData?Object.keys(ne.actionData).length>0?Je=ne.actionData:Je=null:mt?Je=E.actionData:Je=null;let Ke=ne.loaderData?Jy(E.loaderData,ne.loaderData,ne.matches||[],ne.errors):E.loaderData,re=E.blockers;re.size>0&&(re=new Map(re),re.forEach((kt,an)=>re.set(an,lc)));let Pe=H===!0||E.navigation.formMethod!=null&&ms(E.navigation.formMethod)&&((We=ee.state)==null?void 0:We._isRedirect)!==!0;d&&(c=d,d=void 0),O||A===kr.Pop||(A===kr.Push?e.history.push(ee,ee.state):A===kr.Replace&&e.history.replace(ee,ee.state));let ot;if(A===kr.Pop){let kt=z.get(E.location.pathname);kt&&kt.has(ee.pathname)?ot={currentLocation:E.location,nextLocation:ee}:z.has(ee.pathname)&&(ot={currentLocation:ee,nextLocation:E.location})}else if(Y){let kt=z.get(E.location.pathname);kt?kt.add(ee.pathname):(kt=new Set([ee.pathname]),z.set(E.location.pathname,kt)),ot={currentLocation:E.location,nextLocation:ee}}ct(nr({},ne,{actionData:Je,loaderData:Ke,historyAction:A,location:ee,initialized:!0,navigation:Bp,revalidation:"idle",restoreScrollPosition:Ut(ee,ne.matches||E.matches),preventScrollReset:Pe,blockers:re}),{viewTransitionOpts:ot,flushSync:Ye===!0}),A=kr.Pop,H=!1,Y=!1,O=!1,F=!1,te=[]}async function ft(ee,ne){if(typeof ee=="number"){e.history.go(ee);return}let pe=cg(E.location,E.matches,m,g.v7_prependBasename,ee,g.v7_relativeSplatPath,ne==null?void 0:ne.fromRouteId,ne==null?void 0:ne.relative),{path:ve,submission:We,error:Ye}=qy(g.v7_normalizeFormMethod,!1,pe,ne),mt=E.location,Je=Hc(E.location,ve,ne&&ne.state);Je=nr({},Je,e.history.encodeLocation(Je));let Ke=ne&&ne.replace!=null?ne.replace:void 0,re=kr.Push;Ke===!0?re=kr.Replace:Ke===!1||We!=null&&ms(We.formMethod)&&We.formAction===E.location.pathname+E.location.search&&(re=kr.Replace);let Pe=ne&&"preventScrollReset"in ne?ne.preventScrollReset===!0:void 0,ot=(ne&&ne.flushSync)===!0,kt=ae({currentLocation:mt,nextLocation:Je,historyAction:re});if(kt){on(kt,{state:"blocked",location:Je,proceed(){on(kt,{state:"proceeding",proceed:void 0,reset:void 0,location:Je}),ft(ee,ne)},reset(){let an=new Map(E.blockers);an.set(kt,lc),ct({blockers:an})}});return}return await fe(re,Je,{submission:We,pendingError:Ye,preventScrollReset:Pe,replace:ne&&ne.replace,enableViewTransition:ne&&ne.viewTransition,flushSync:ot})}function rt(){if(xe(),ct({revalidation:"loading"}),E.navigation.state!=="submitting"){if(E.navigation.state==="idle"){fe(E.historyAction,E.location,{startUninterruptedRevalidation:!0});return}fe(A||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:Y===!0})}}async function fe(ee,ne,pe){_&&_.abort(),_=null,A=ee,O=(pe&&pe.startUninterruptedRevalidation)===!0,ln(E.location,E.matches),H=(pe&&pe.preventScrollReset)===!0,Y=(pe&&pe.enableViewTransition)===!0;let ve=d||c,We=pe&&pe.overrideNavigation,Ye=pe!=null&&pe.initialHydration&&E.matches&&E.matches.length>0&&!I?E.matches:mo(ve,ne,m),mt=(pe&&pe.flushSync)===!0;if(Ye&&E.initialized&&!F&&sA(E.location,ne)&&!(pe&&pe.submission&&ms(pe.submission.formMethod))){gt(ne,{matches:Ye},{flushSync:mt});return}let Je=dn(Ye,ve,ne.pathname);if(Je.active&&Je.matches&&(Ye=Je.matches),!Ye){let{error:$t,notFoundMatches:Bt,route:_t}=$e(ne.pathname);gt(ne,{matches:Bt,loaderData:{},errors:{[_t.id]:$t}},{flushSync:mt});return}_=new AbortController;let Ke=rl(e.history,ne,_.signal,pe&&pe.submission),re;if(pe&&pe.pendingError)re=[po(Ye).route.id,{type:_n.error,error:pe.pendingError}];else if(pe&&pe.submission&&ms(pe.submission.formMethod)){let $t=await ue(Ke,ne,pe.submission,Ye,Je.active,{replace:pe.replace,flushSync:mt});if($t.shortCircuited)return;if($t.pendingActionResult){let[Bt,_t]=$t.pendingActionResult;if(Ai(_t)&&zc(_t.error)&&_t.error.status===404){_=null,gt(ne,{matches:$t.matches,loaderData:{},errors:{[Bt]:_t.error}});return}}Ye=$t.matches||Ye,re=$t.pendingActionResult,We=Wp(ne,pe.submission),mt=!1,Je.active=!1,Ke=rl(e.history,Ke.url,Ke.signal)}let{shortCircuited:Pe,matches:ot,loaderData:kt,errors:an}=await Oe(Ke,ne,Ye,Je.active,We,pe&&pe.submission,pe&&pe.fetcherSubmission,pe&&pe.replace,pe&&pe.initialHydration===!0,mt,re);Pe||(_=null,gt(ne,nr({matches:ot||Ye},Zy(re),{loaderData:kt,errors:an})))}async function ue(ee,ne,pe,ve,We,Ye){Ye===void 0&&(Ye={}),xe();let mt=dA(ne,pe);if(ct({navigation:mt},{flushSync:Ye.flushSync===!0}),We){let re=await Jt(ve,ne.pathname,ee.signal);if(re.type==="aborted")return{shortCircuited:!0};if(re.type==="error"){let Pe=po(re.partialMatches).route.id;return{matches:re.partialMatches,pendingActionResult:[Pe,{type:_n.error,error:re.error}]}}else if(re.matches)ve=re.matches;else{let{notFoundMatches:Pe,error:ot,route:kt}=$e(ne.pathname);return{matches:Pe,pendingActionResult:[kt.id,{type:_n.error,error:ot}]}}}let Je,Ke=kc(ve,ne);if(!Ke.route.action&&!Ke.route.lazy)Je={type:_n.error,error:wi(405,{method:ee.method,pathname:ne.pathname,routeId:Ke.route.id})};else if(Je=(await ut("action",E,ee,[Ke],ve,null))[Ke.route.id],ee.signal.aborted)return{shortCircuited:!0};if(fo(Je)){let re;return Ye&&Ye.replace!=null?re=Ye.replace:re=Yy(Je.response.headers.get("Location"),new URL(ee.url),m,e.history)===E.location.pathname+E.location.search,await pt(ee,Je,!0,{submission:pe,replace:re}),{shortCircuited:!0}}if(Ea(Je))throw wi(400,{type:"defer-action"});if(Ai(Je)){let re=po(ve,Ke.route.id);return(Ye&&Ye.replace)!==!0&&(A=kr.Push),{matches:ve,pendingActionResult:[re.route.id,Je]}}return{matches:ve,pendingActionResult:[Ke.route.id,Je]}}async function Oe(ee,ne,pe,ve,We,Ye,mt,Je,Ke,re,Pe){let ot=We||Wp(ne,Ye),kt=Ye||mt||nk(ot),an=!O&&(!g.v7_partialHydration||!Ke);if(ve){if(an){let Mt=qe(Pe);ct(nr({navigation:ot},Mt!==void 0?{actionData:Mt}:{}),{flushSync:re})}let lt=await Jt(pe,ne.pathname,ee.signal);if(lt.type==="aborted")return{shortCircuited:!0};if(lt.type==="error"){let Mt=po(lt.partialMatches).route.id;return{matches:lt.partialMatches,loaderData:{},errors:{[Mt]:lt.error}}}else if(lt.matches)pe=lt.matches;else{let{error:Mt,notFoundMatches:rn,route:Nn}=$e(ne.pathname);return{matches:rn,loaderData:{},errors:{[Nn.id]:Mt}}}}let $t=d||c,[Bt,_t]=Vy(e.history,E,pe,kt,ne,g.v7_partialHydration&&Ke===!0,g.v7_skipActionErrorRevalidation,F,te,de,ce,D,X,$t,m,Pe);if(ht(lt=>!(pe&&pe.some(Mt=>Mt.route.id===lt))||Bt&&Bt.some(Mt=>Mt.route.id===lt)),N=++M,Bt.length===0&&_t.length===0){let lt=Dt();return gt(ne,nr({matches:pe,loaderData:{},errors:Pe&&Ai(Pe[1])?{[Pe[0]]:Pe[1].error}:null},Zy(Pe),lt?{fetchers:new Map(E.fetchers)}:{}),{flushSync:re}),{shortCircuited:!0}}if(an){let lt={};if(!ve){lt.navigation=ot;let Mt=qe(Pe);Mt!==void 0&&(lt.actionData=Mt)}_t.length>0&&(lt.fetchers=nt(_t)),ct(lt,{flushSync:re})}_t.forEach(lt=>{Ht(lt.key),lt.controller&&W.set(lt.key,lt.controller)});let Sn=()=>_t.forEach(lt=>Ht(lt.key));_&&_.signal.addEventListener("abort",Sn);let{loaderResults:On,fetcherResults:Mn}=await we(E,pe,Bt,_t,ee);if(ee.signal.aborted)return{shortCircuited:!0};_&&_.signal.removeEventListener("abort",Sn),_t.forEach(lt=>W.delete(lt.key));let Tt=fd(On);if(Tt)return await pt(ee,Tt.result,!0,{replace:Je}),{shortCircuited:!0};if(Tt=fd(Mn),Tt)return X.add(Tt.key),await pt(ee,Tt.result,!0,{replace:Je}),{shortCircuited:!0};let{loaderData:fn,errors:Xt}=Qy(E,pe,On,Pe,_t,Mn,le);le.forEach((lt,Mt)=>{lt.subscribe(rn=>{(rn||lt.done)&&le.delete(Mt)})}),g.v7_partialHydration&&Ke&&E.errors&&(Xt=nr({},E.errors,Xt));let kn=Dt(),Te=bt(N),Be=kn||Te||_t.length>0;return nr({matches:pe,loaderData:fn,errors:Xt},Be?{fetchers:new Map(E.fetchers)}:{})}function qe(ee){if(ee&&!Ai(ee[1]))return{[ee[0]]:ee[1].data};if(E.actionData)return Object.keys(E.actionData).length===0?null:E.actionData}function nt(ee){return ee.forEach(ne=>{let pe=E.fetchers.get(ne.key),ve=cc(void 0,pe?pe.data:void 0);E.fetchers.set(ne.key,ve)}),new Map(E.fetchers)}function yt(ee,ne,pe,ve){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.");Ht(ee);let We=(ve&&ve.flushSync)===!0,Ye=d||c,mt=cg(E.location,E.matches,m,g.v7_prependBasename,pe,g.v7_relativeSplatPath,ne,ve==null?void 0:ve.relative),Je=mo(Ye,mt,m),Ke=dn(Je,Ye,mt);if(Ke.active&&Ke.matches&&(Je=Ke.matches),!Je){Fe(ee,ne,wi(404,{pathname:mt}),{flushSync:We});return}let{path:re,submission:Pe,error:ot}=qy(g.v7_normalizeFormMethod,!0,mt,ve);if(ot){Fe(ee,ne,ot,{flushSync:We});return}let kt=kc(Je,re),an=(ve&&ve.preventScrollReset)===!0;if(Pe&&ms(Pe.formMethod)){Me(ee,ne,re,kt,Je,Ke.active,We,an,Pe);return}D.set(ee,{routeId:ne,path:re}),Le(ee,ne,re,kt,Je,Ke.active,We,an,Pe)}async function Me(ee,ne,pe,ve,We,Ye,mt,Je,Ke){xe(),D.delete(ee);function re(Vt){if(!Vt.route.action&&!Vt.route.lazy){let Un=wi(405,{method:Ke.formMethod,pathname:pe,routeId:ne});return Fe(ee,ne,Un,{flushSync:mt}),!0}return!1}if(!Ye&&re(ve))return;let Pe=E.fetchers.get(ee);Qe(ee,hA(Ke,Pe),{flushSync:mt});let ot=new AbortController,kt=rl(e.history,pe,ot.signal,Ke);if(Ye){let Vt=await Jt(We,new URL(kt.url).pathname,kt.signal,ee);if(Vt.type==="aborted")return;if(Vt.type==="error"){Fe(ee,ne,Vt.error,{flushSync:mt});return}else if(Vt.matches){if(We=Vt.matches,ve=kc(We,pe),re(ve))return}else{Fe(ee,ne,wi(404,{pathname:pe}),{flushSync:mt});return}}W.set(ee,ot);let an=M,Bt=(await ut("action",E,kt,[ve],We,ee))[ve.route.id];if(kt.signal.aborted){W.get(ee)===ot&&W.delete(ee);return}if(g.v7_fetcherPersist&&ce.has(ee)){if(fo(Bt)||Ai(Bt)){Qe(ee,Ma(void 0));return}}else{if(fo(Bt))if(W.delete(ee),N>an){Qe(ee,Ma(void 0));return}else return X.add(ee),Qe(ee,cc(Ke)),pt(kt,Bt,!1,{fetcherSubmission:Ke,preventScrollReset:Je});if(Ai(Bt)){Fe(ee,ne,Bt.error);return}}if(Ea(Bt))throw wi(400,{type:"defer-action"});let _t=E.navigation.location||E.location,Sn=rl(e.history,_t,ot.signal),On=d||c,Mn=E.navigation.state!=="idle"?mo(On,E.navigation.location,m):E.matches;yn(Mn,"Didn't find any matches after fetcher action");let Tt=++M;L.set(ee,Tt);let fn=cc(Ke,Bt.data);E.fetchers.set(ee,fn);let[Xt,kn]=Vy(e.history,E,Mn,Ke,_t,!1,g.v7_skipActionErrorRevalidation,F,te,de,ce,D,X,On,m,[ve.route.id,Bt]);kn.filter(Vt=>Vt.key!==ee).forEach(Vt=>{let Un=Vt.key,qn=E.fetchers.get(Un),En=cc(void 0,qn?qn.data:void 0);E.fetchers.set(Un,En),Ht(Un),Vt.controller&&W.set(Un,Vt.controller)}),ct({fetchers:new Map(E.fetchers)});let Te=()=>kn.forEach(Vt=>Ht(Vt.key));ot.signal.addEventListener("abort",Te);let{loaderResults:Be,fetcherResults:lt}=await we(E,Mn,Xt,kn,Sn);if(ot.signal.aborted)return;ot.signal.removeEventListener("abort",Te),L.delete(ee),W.delete(ee),kn.forEach(Vt=>W.delete(Vt.key));let Mt=fd(Be);if(Mt)return pt(Sn,Mt.result,!1,{preventScrollReset:Je});if(Mt=fd(lt),Mt)return X.add(Mt.key),pt(Sn,Mt.result,!1,{preventScrollReset:Je});let{loaderData:rn,errors:Nn}=Qy(E,Mn,Be,void 0,kn,lt,le);if(E.fetchers.has(ee)){let Vt=Ma(Bt.data);E.fetchers.set(ee,Vt)}bt(Tt),E.navigation.state==="loading"&&Tt>N?(yn(A,"Expected pending action"),_&&_.abort(),gt(E.navigation.location,{matches:Mn,loaderData:rn,errors:Nn,fetchers:new Map(E.fetchers)})):(ct({errors:Nn,loaderData:Jy(E.loaderData,rn,Mn,Nn),fetchers:new Map(E.fetchers)}),F=!1)}async function Le(ee,ne,pe,ve,We,Ye,mt,Je,Ke){let re=E.fetchers.get(ee);Qe(ee,cc(Ke,re?re.data:void 0),{flushSync:mt});let Pe=new AbortController,ot=rl(e.history,pe,Pe.signal);if(Ye){let Bt=await Jt(We,new URL(ot.url).pathname,ot.signal,ee);if(Bt.type==="aborted")return;if(Bt.type==="error"){Fe(ee,ne,Bt.error,{flushSync:mt});return}else if(Bt.matches)We=Bt.matches,ve=kc(We,pe);else{Fe(ee,ne,wi(404,{pathname:pe}),{flushSync:mt});return}}W.set(ee,Pe);let kt=M,$t=(await ut("loader",E,ot,[ve],We,ee))[ve.route.id];if(Ea($t)&&($t=await ob($t,ot.signal,!0)||$t),W.get(ee)===Pe&&W.delete(ee),!ot.signal.aborted){if(ce.has(ee)){Qe(ee,Ma(void 0));return}if(fo($t))if(N>kt){Qe(ee,Ma(void 0));return}else{X.add(ee),await pt(ot,$t,!1,{preventScrollReset:Je});return}if(Ai($t)){Fe(ee,ne,$t.error);return}yn(!Ea($t),"Unhandled fetcher deferred data"),Qe(ee,Ma($t.data))}}async function pt(ee,ne,pe,ve){let{submission:We,fetcherSubmission:Ye,preventScrollReset:mt,replace:Je}=ve===void 0?{}:ve;ne.response.headers.has("X-Remix-Revalidate")&&(F=!0);let Ke=ne.response.headers.get("Location");yn(Ke,"Expected a Location header on the redirect Response"),Ke=Yy(Ke,new URL(ee.url),m,e.history);let re=Hc(E.location,Ke,{_isRedirect:!0});if(r){let Bt=!1;if(ne.response.headers.has("X-Remix-Reload-Document"))Bt=!0;else if(ab.test(Ke)){const _t=e.history.createURL(Ke);Bt=_t.origin!==t.location.origin||cu(_t.pathname,m)==null}if(Bt){Je?t.location.replace(Ke):t.location.assign(Ke);return}}_=null;let Pe=Je===!0||ne.response.headers.has("X-Remix-Replace")?kr.Replace:kr.Push,{formMethod:ot,formAction:kt,formEncType:an}=E.navigation;!We&&!Ye&&ot&&kt&&an&&(We=nk(E.navigation));let $t=We||Ye;if(VM.has(ne.response.status)&&$t&&ms($t.formMethod))await fe(Pe,re,{submission:nr({},$t,{formAction:Ke}),preventScrollReset:mt||H,enableViewTransition:pe?Y:void 0});else{let Bt=Wp(re,We);await fe(Pe,re,{overrideNavigation:Bt,fetcherSubmission:Ye,preventScrollReset:mt||H,enableViewTransition:pe?Y:void 0})}}async function ut(ee,ne,pe,ve,We,Ye){let mt,Je={};try{mt=await eA(f,ee,ne,pe,ve,We,Ye,u,a)}catch(Ke){return ve.forEach(re=>{Je[re.route.id]={type:_n.error,error:Ke}}),Je}for(let[Ke,re]of Object.entries(mt))if(aA(re)){let Pe=re.result;Je[Ke]={type:_n.redirect,response:rA(Pe,pe,Ke,We,m,g.v7_relativeSplatPath)}}else Je[Ke]=await nA(re);return Je}async function we(ee,ne,pe,ve,We){let Ye=ee.matches,mt=ut("loader",ee,We,pe,ne,null),Je=Promise.all(ve.map(async Pe=>{if(Pe.matches&&Pe.match&&Pe.controller){let kt=(await ut("loader",ee,rl(e.history,Pe.path,Pe.controller.signal),[Pe.match],Pe.matches,Pe.key))[Pe.match.route.id];return{[Pe.key]:kt}}else return Promise.resolve({[Pe.key]:{type:_n.error,error:wi(404,{pathname:Pe.path})}})})),Ke=await mt,re=(await Je).reduce((Pe,ot)=>Object.assign(Pe,ot),{});return await Promise.all([cA(ne,Ke,We.signal,Ye,ee.loaderData),uA(ne,re,ve)]),{loaderResults:Ke,fetcherResults:re}}function xe(){F=!0,te.push(...ht()),D.forEach((ee,ne)=>{W.has(ne)&&de.add(ne),Ht(ne)})}function Qe(ee,ne,pe){pe===void 0&&(pe={}),E.fetchers.set(ee,ne),ct({fetchers:new Map(E.fetchers)},{flushSync:(pe&&pe.flushSync)===!0})}function Fe(ee,ne,pe,ve){ve===void 0&&(ve={});let We=po(E.matches,ne);It(ee),ct({errors:{[We.route.id]:pe},fetchers:new Map(E.fetchers)},{flushSync:(ve&&ve.flushSync)===!0})}function dt(ee){return be.set(ee,(be.get(ee)||0)+1),ce.has(ee)&&ce.delete(ee),E.fetchers.get(ee)||GM}function It(ee){let ne=E.fetchers.get(ee);W.has(ee)&&!(ne&&ne.state==="loading"&&L.has(ee))&&Ht(ee),D.delete(ee),L.delete(ee),X.delete(ee),g.v7_fetcherPersist&&ce.delete(ee),de.delete(ee),E.fetchers.delete(ee)}function qt(ee){let ne=(be.get(ee)||0)-1;ne<=0?(be.delete(ee),ce.add(ee),g.v7_fetcherPersist||It(ee)):be.set(ee,ne),ct({fetchers:new Map(E.fetchers)})}function Ht(ee){let ne=W.get(ee);ne&&(ne.abort(),W.delete(ee))}function Ft(ee){for(let ne of ee){let pe=dt(ne),ve=Ma(pe.data);E.fetchers.set(ne,ve)}}function Dt(){let ee=[],ne=!1;for(let pe of X){let ve=E.fetchers.get(pe);yn(ve,"Expected fetcher: "+pe),ve.state==="loading"&&(X.delete(pe),ee.push(pe),ne=!0)}return Ft(ee),ne}function bt(ee){let ne=[];for(let[pe,ve]of L)if(ve<ee){let We=E.fetchers.get(pe);yn(We,"Expected fetcher: "+pe),We.state==="loading"&&(Ht(pe),L.delete(pe),ne.push(pe))}return Ft(ne),ne.length>0}function Qt(ee,ne){let pe=E.blockers.get(ee)||lc;return ye.get(ee)!==ne&&ye.set(ee,ne),pe}function zt(ee){E.blockers.delete(ee),ye.delete(ee)}function on(ee,ne){let pe=E.blockers.get(ee)||lc;yn(pe.state==="unblocked"&&ne.state==="blocked"||pe.state==="blocked"&&ne.state==="blocked"||pe.state==="blocked"&&ne.state==="proceeding"||pe.state==="blocked"&&ne.state==="unblocked"||pe.state==="proceeding"&&ne.state==="unblocked","Invalid blocker state transition: "+pe.state+" -> "+ne.state);let ve=new Map(E.blockers);ve.set(ee,ne),ct({blockers:ve})}function ae(ee){let{currentLocation:ne,nextLocation:pe,historyAction:ve}=ee;if(ye.size===0)return;ye.size>1&&wo(!1,"A router only supports one blocker at a time");let We=Array.from(ye.entries()),[Ye,mt]=We[We.length-1],Je=E.blockers.get(Ye);if(!(Je&&Je.state==="proceeding")&&mt({currentLocation:ne,nextLocation:pe,historyAction:ve}))return Ye}function $e(ee){let ne=wi(404,{pathname:ee}),pe=d||c,{matches:ve,route:We}=ek(pe);return ht(),{notFoundMatches:ve,route:We,error:ne}}function ht(ee){let ne=[];return le.forEach((pe,ve)=>{(!ee||ee(ve))&&(pe.cancel(),ne.push(ve),le.delete(ve))}),ne}function Wt(ee,ne,pe){if(x=ee,j=ne,C=pe||null,!T&&E.navigation===Bp){T=!0;let ve=Ut(E.location,E.matches);ve!=null&&ct({restoreScrollPosition:ve})}return()=>{x=null,j=null,C=null}}function jn(ee,ne){return C&&C(ee,ne.map(ve=>SM(ve,E.loaderData)))||ee.key}function ln(ee,ne){if(x&&j){let pe=jn(ee,ne);x[pe]=j()}}function Ut(ee,ne){if(x){let pe=jn(ee,ne),ve=x[pe];if(typeof ve=="number")return ve}return null}function dn(ee,ne,pe){if(v)if(ee){if(Object.keys(ee[0].params).length>0)return{active:!0,matches:Jd(ne,pe,m,!0)}}else return{active:!0,matches:Jd(ne,pe,m,!0)||[]};return{active:!1,matches:null}}async function Jt(ee,ne,pe,ve){if(!v)return{type:"success",matches:ee};let We=ee;for(;;){let Ye=d==null,mt=d||c,Je=u;try{await v({signal:pe,path:ne,matches:We,fetcherKey:ve,patch:(Pe,ot)=>{pe.aborted||Ky(Pe,ot,mt,Je,a)}})}catch(Pe){return{type:"error",error:Pe,partialMatches:We}}finally{Ye&&!pe.aborted&&(c=[...c])}if(pe.aborted)return{type:"aborted"};let Ke=mo(mt,ne,m);if(Ke)return{type:"success",matches:Ke};let re=Jd(mt,ne,m,!0);if(!re||We.length===re.length&&We.every((Pe,ot)=>Pe.route.id===re[ot].route.id))return{type:"success",matches:null};We=re}}function nn(ee){u={},d=vh(ee,a,void 0,u)}function hn(ee,ne){let pe=d==null;Ky(ee,ne,d||c,u,a),pe&&(c=[...c],ct({}))}return B={get basename(){return m},get future(){return g},get state(){return E},get routes(){return c},get window(){return t},initialize:_e,subscribe:Nt,enableScrollRestoration:Wt,navigate:ft,fetch:yt,revalidate:rt,createHref:ee=>e.history.createHref(ee),encodeLocation:ee=>e.history.encodeLocation(ee),getFetcher:dt,deleteFetcher:qt,dispose:Ce,getBlocker:Qt,deleteBlocker:zt,patchRoutes:hn,_internalFetchControllers:W,_internalActiveDeferreds:le,_internalSetRoutes:nn},B}function XM(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function cg(e,t,r,i,a,u,c,d){let m,f;if(c){m=[];for(let g of t)if(m.push(g),g.route.id===c){f=g;break}}else m=t,f=t[t.length-1];let v=sb(a||".",ib(m,u),cu(e.pathname,r)||e.pathname,d==="path");if(a==null&&(v.search=e.search,v.hash=e.hash),(a==null||a===""||a===".")&&f){let g=lb(v.search);if(f.route.index&&!g)v.search=v.search?v.search.replace(/^\?/,"?index&"):"?index";else if(!f.route.index&&g){let w=new URLSearchParams(v.search),y=w.getAll("index");w.delete("index"),y.filter(C=>C).forEach(C=>w.append("index",C));let x=w.toString();v.search=x?"?"+x:""}}return i&&r!=="/"&&(v.pathname=v.pathname==="/"?r:Oa([r,v.pathname])),lu(v)}function qy(e,t,r,i){if(!i||!XM(i))return{path:r};if(i.formMethod&&!lA(i.formMethod))return{path:r,error:wi(405,{method:i.formMethod})};let a=()=>({path:r,error:wi(400,{type:"invalid-body"})}),u=i.formMethod||"get",c=e?u.toUpperCase():u.toLowerCase(),d=Jj(r);if(i.body!==void 0){if(i.formEncType==="text/plain"){if(!ms(c))return a();let w=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:c,formAction:d,formEncType:i.formEncType,formData:void 0,json:void 0,text:w}}}else if(i.formEncType==="application/json"){if(!ms(c))return a();try{let w=typeof i.body=="string"?JSON.parse(i.body):i.body;return{path:r,submission:{formMethod:c,formAction:d,formEncType:i.formEncType,formData:void 0,json:w,text:void 0}}}catch{return a()}}}yn(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=Xy(m);else if(i.body==null)m=new URLSearchParams,f=new FormData;else try{m=new URLSearchParams(i.body),f=Xy(m)}catch{return a()}let v={formMethod:c,formAction:d,formEncType:i&&i.formEncType||"application/x-www-form-urlencoded",formData:f,json:void 0,text:void 0};if(ms(v.formMethod))return{path:r,submission:v};let g=Wa(r);return t&&g.search&&lb(g.search)&&m.append("index",""),g.search="?"+m,{path:lu(g),submission:v}}function $y(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 Vy(e,t,r,i,a,u,c,d,m,f,v,g,w,y,x,C){let j=C?Ai(C[1])?C[1].error:C[1].data:void 0,T=e.createURL(t.location),P=e.createURL(a),I=r;u&&t.errors?I=$y(r,Object.keys(t.errors)[0],!0):C&&Ai(C[1])&&(I=$y(r,C[0]));let Z=C?C[1].statusCode:void 0,q=c&&Z&&Z>=400,B=I.filter((A,H)=>{let{route:_}=A;if(_.lazy)return!0;if(_.loader==null)return!1;if(u)return ug(_,t.loaderData,t.errors);if(QM(t.loaderData,t.matches[H],A)||m.some(K=>K===A.route.id))return!0;let Y=t.matches[H],z=A;return Gy(A,nr({currentUrl:T,currentParams:Y.params,nextUrl:P,nextParams:z.params},i,{actionResult:j,actionStatus:Z,defaultShouldRevalidate:q?!1:d||T.pathname+T.search===P.pathname+P.search||T.search!==P.search||Xj(Y,z)}))}),E=[];return g.forEach((A,H)=>{if(u||!r.some(O=>O.route.id===A.routeId)||v.has(H))return;let _=mo(y,A.path,x);if(!_){E.push({key:H,routeId:A.routeId,path:A.path,matches:null,match:null,controller:null});return}let Y=t.fetchers.get(H),z=kc(_,A.path),K=!1;w.has(H)?K=!1:f.has(H)?(f.delete(H),K=!0):Y&&Y.state!=="idle"&&Y.data===void 0?K=d:K=Gy(z,nr({currentUrl:T,currentParams:t.matches[t.matches.length-1].params,nextUrl:P,nextParams:r[r.length-1].params},i,{actionResult:j,actionStatus:Z,defaultShouldRevalidate:q?!1:d})),K&&E.push({key:H,routeId:A.routeId,path:A.path,matches:_,match:z,controller:new AbortController})}),[B,E]}function ug(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 QM(e,t,r){let i=!t||r.route.id!==t.route.id,a=e[r.route.id]===void 0;return i||a}function Xj(e,t){let r=e.route.path;return e.pathname!==t.pathname||r!=null&&r.endsWith("*")&&e.params["*"]!==t.params["*"]}function Gy(e,t){if(e.route.shouldRevalidate){let r=e.route.shouldRevalidate(t);if(typeof r=="boolean")return r}return t.defaultShouldRevalidate}function Ky(e,t,r,i,a){var u;let c;if(e){let f=i[e];yn(f,"No route found to patch children into: routeId = "+e),f.children||(f.children=[]),c=f.children}else c=r;let d=t.filter(f=>!c.some(v=>Qj(f,v))),m=vh(d,a,[e||"_","patch",String(((u=c)==null?void 0:u.length)||"0")],i);c.push(...m)}function Qj(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(u=>Qj(r,u))}):!1}async function JM(e,t,r){if(!e.lazy)return;let i=await e.lazy();if(!e.lazy)return;let a=r[e.id];yn(a,"No route found in manifest");let u={};for(let c in i){let m=a[c]!==void 0&&c!=="hasErrorBoundary";wo(!m,'Route "'+a.id+'" has a static property "'+c+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+c+'" will be ignored.')),!m&&!kM.has(c)&&(u[c]=i[c])}Object.assign(a,u),Object.assign(a,nr({},t(a),{lazy:void 0}))}async function ZM(e){let{matches:t}=e,r=t.filter(a=>a.shouldLoad);return(await Promise.all(r.map(a=>a.resolve()))).reduce((a,u,c)=>Object.assign(a,{[r[c].route.id]:u}),{})}async function eA(e,t,r,i,a,u,c,d,m,f){let v=u.map(y=>y.route.lazy?JM(y.route,m,d):void 0),g=u.map((y,x)=>{let C=v[x],j=a.some(P=>P.route.id===y.route.id);return nr({},y,{shouldLoad:j,resolve:async P=>(P&&i.method==="GET"&&(y.route.lazy||y.route.loader)&&(j=!0),j?tA(t,i,y,C,P,f):Promise.resolve({type:_n.data,result:void 0}))})}),w=await e({matches:g,request:i,params:u[0].params,fetcherKey:c,context:f});try{await Promise.all(v)}catch{}return w}async function tA(e,t,r,i,a,u){let c,d,m=f=>{let v,g=new Promise((x,C)=>v=C);d=()=>v(),t.signal.addEventListener("abort",d);let w=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:u},...x!==void 0?[x]:[]),y=(async()=>{try{return{type:"data",result:await(a?a(C=>w(C)):w())}}catch(x){return{type:"error",result:x}}})();return Promise.race([y,g])};try{let f=r.route[e];if(i)if(f){let v,[g]=await Promise.all([m(f).catch(w=>{v=w}),i]);if(v!==void 0)throw v;c=g}else if(await i,f=r.route[e],f)c=await m(f);else if(e==="action"){let v=new URL(t.url),g=v.pathname+v.search;throw wi(405,{method:t.method,pathname:g,routeId:r.route.id})}else return{type:_n.data,result:void 0};else if(f)c=await m(f);else{let v=new URL(t.url),g=v.pathname+v.search;throw wi(404,{pathname:g})}yn(c.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:_n.error,result:f}}finally{d&&t.signal.removeEventListener("abort",d)}return c}async function nA(e){let{result:t,type:r}=e;if(Zj(t)){let g;try{let w=t.headers.get("Content-Type");w&&/\bapplication\/json\b/.test(w)?t.body==null?g=null:g=await t.json():g=await t.text()}catch(w){return{type:_n.error,error:w}}return r===_n.error?{type:_n.error,error:new wh(t.status,t.statusText,g),statusCode:t.status,headers:t.headers}:{type:_n.data,data:g,statusCode:t.status,headers:t.headers}}if(r===_n.error){if(tk(t)){var i,a;if(t.data instanceof Error){var u,c;return{type:_n.error,error:t.data,statusCode:(u=t.init)==null?void 0:u.status,headers:(c=t.init)!=null&&c.headers?new Headers(t.init.headers):void 0}}return{type:_n.error,error:new wh(((i=t.init)==null?void 0:i.status)||500,void 0,t.data),statusCode:zc(t)?t.status:void 0,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}}return{type:_n.error,error:t,statusCode:zc(t)?t.status:void 0}}if(oA(t)){var d,m;return{type:_n.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(tk(t)){var f,v;return{type:_n.data,data:t.data,statusCode:(f=t.init)==null?void 0:f.status,headers:(v=t.init)!=null&&v.headers?new Headers(t.init.headers):void 0}}return{type:_n.data,data:t}}function rA(e,t,r,i,a,u){let c=e.headers.get("Location");if(yn(c,"Redirects returned/thrown from loaders/actions must have a Location header"),!ab.test(c)){let d=i.slice(0,i.findIndex(m=>m.route.id===r)+1);c=cg(new URL(t.url),d,a,!0,c,u),e.headers.set("Location",c)}return e}function Yy(e,t,r,i){let a=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(ab.test(e)){let u=e,c=u.startsWith("//")?new URL(t.protocol+u):new URL(u);if(a.includes(c.protocol))throw new Error("Invalid redirect location");let d=cu(c.pathname,r)!=null;if(c.origin===t.origin&&d)return c.pathname+c.search+c.hash}try{let u=i.createURL(e);if(a.includes(u.protocol))throw new Error("Invalid redirect location")}catch{}return e}function rl(e,t,r,i){let a=e.createURL(Jj(t)).toString(),u={signal:r};if(i&&ms(i.formMethod)){let{formMethod:c,formEncType:d}=i;u.method=c.toUpperCase(),d==="application/json"?(u.headers=new Headers({"Content-Type":d}),u.body=JSON.stringify(i.json)):d==="text/plain"?u.body=i.text:d==="application/x-www-form-urlencoded"&&i.formData?u.body=dg(i.formData):u.body=i.formData}return new Request(a,u)}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 Xy(e){let t=new FormData;for(let[r,i]of e.entries())t.append(r,i);return t}function iA(e,t,r,i,a){let u={},c=null,d,m=!1,f={},v=r&&Ai(r[1])?r[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let w=g.route.id,y=t[w];if(yn(!fo(y),"Cannot handle redirect results in processLoaderData"),Ai(y)){let x=y.error;v!==void 0&&(x=v,v=void 0),c=c||{};{let C=po(e,w);c[C.route.id]==null&&(c[C.route.id]=x)}u[w]=void 0,m||(m=!0,d=zc(y.error)?y.error.status:500),y.headers&&(f[w]=y.headers)}else Ea(y)?(i.set(w,y.deferredData),u[w]=y.deferredData.data,y.statusCode!=null&&y.statusCode!==200&&!m&&(d=y.statusCode),y.headers&&(f[w]=y.headers)):(u[w]=y.data,y.statusCode&&y.statusCode!==200&&!m&&(d=y.statusCode),y.headers&&(f[w]=y.headers))}),v!==void 0&&r&&(c={[r[0]]:v},u[r[0]]=void 0),{loaderData:u,errors:c,statusCode:d||200,loaderHeaders:f}}function Qy(e,t,r,i,a,u,c){let{loaderData:d,errors:m}=iA(t,r,i,c);return a.forEach(f=>{let{key:v,match:g,controller:w}=f,y=u[v];if(yn(y,"Did not find corresponding fetcher result"),!(w&&w.signal.aborted))if(Ai(y)){let x=po(e.matches,g==null?void 0:g.route.id);m&&m[x.route.id]||(m=nr({},m,{[x.route.id]:y.error})),e.fetchers.delete(v)}else if(fo(y))yn(!1,"Unhandled fetcher revalidation redirect");else if(Ea(y))yn(!1,"Unhandled fetcher deferred data");else{let x=Ma(y.data);e.fetchers.set(v,x)}}),{loaderData:d,errors:m}}function Jy(e,t,r,i){let a=nr({},t);for(let u of r){let c=u.route.id;if(t.hasOwnProperty(c)?t[c]!==void 0&&(a[c]=t[c]):e[c]!==void 0&&u.route.loader&&(a[c]=e[c]),i&&i.hasOwnProperty(c))break}return a}function Zy(e){return e?Ai(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function po(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 ek(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 wi(e,t){let{pathname:r,routeId:i,method:a,type:u,message:c}=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.":u==="defer-action"?m="defer() is not supported in actions":u==="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 wh(e||500,d,new Error(m),!0)}function fd(e){let t=Object.entries(e);for(let r=t.length-1;r>=0;r--){let[i,a]=t[r];if(fo(a))return{key:i,result:a}}}function Jj(e){let t=typeof e=="string"?Wa(e):e;return lu(nr({},t,{hash:""}))}function sA(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function aA(e){return Zj(e.result)&&$M.has(e.result.status)}function Ea(e){return e.type===_n.deferred}function Ai(e){return e.type===_n.error}function fo(e){return(e&&e.type)===_n.redirect}function tk(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function oA(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 Zj(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function lA(e){return qM.has(e.toLowerCase())}function ms(e){return HM.has(e.toLowerCase())}async function cA(e,t,r,i,a){let u=Object.entries(t);for(let c=0;c<u.length;c++){let[d,m]=u[c],f=e.find(w=>(w==null?void 0:w.route.id)===d);if(!f)continue;let v=i.find(w=>w.route.id===f.route.id),g=v!=null&&!Xj(v,f)&&(a&&a[f.route.id])!==void 0;Ea(m)&&g&&await ob(m,r,!1).then(w=>{w&&(t[d]=w)})}}async function uA(e,t,r){for(let i=0;i<r.length;i++){let{key:a,routeId:u,controller:c}=r[i],d=t[a];e.find(f=>(f==null?void 0:f.route.id)===u)&&Ea(d)&&(yn(c,"Expected an AbortController for revalidating fetcher deferred result"),await ob(d,c.signal,!0).then(f=>{f&&(t[a]=f)}))}}async function ob(e,t,r){if(r===void 0&&(r=!1),!await e.deferredData.resolveData(t)){if(r)try{return{type:_n.data,data:e.deferredData.unwrappedData}}catch(a){return{type:_n.error,error:a}}return{type:_n.data,data:e.deferredData.data}}}function lb(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function kc(e,t){let r=typeof t=="string"?Wa(t).search:t.search;if(e[e.length-1].route.index&&lb(r||""))return e[e.length-1];let i=Gj(e);return i[i.length-1]}function nk(e){let{formMethod:t,formAction:r,formEncType:i,text:a,formData:u,json:c}=e;if(!(!t||!r||!i)){if(a!=null)return{formMethod:t,formAction:r,formEncType:i,formData:void 0,json:void 0,text:a};if(u!=null)return{formMethod:t,formAction:r,formEncType:i,formData:u,json:void 0,text:void 0};if(c!==void 0)return{formMethod:t,formAction:r,formEncType:i,formData:void 0,json:c,text:void 0}}}function Wp(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 dA(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 cc(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 hA(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 Ma(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 mA(e,t){try{let r=e.sessionStorage.getItem(Yj);if(r){let i=JSON.parse(r);for(let[a,u]of Object.entries(i||{}))u&&Array.isArray(u)&&t.set(a,new Set(u||[]))}}catch{}}function pA(e,t){if(t.size>0){let r={};for(let[i,a]of t)r[i]=[...a];try{e.sessionStorage.setItem(Yj,JSON.stringify(r))}catch(i){wo(!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 yh(){return yh=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},yh.apply(this,arguments)}const zh=p.createContext(null),eN=p.createContext(null),uu=p.createContext(null),cb=p.createContext(null),na=p.createContext({outlet:null,matches:[],isDataRoute:!1}),tN=p.createContext(null);function du(){return p.useContext(cb)!=null}function es(){return du()||yn(!1),p.useContext(cb).location}function nN(e){p.useContext(uu).static||p.useLayoutEffect(e)}function dr(){let{isDataRoute:e}=p.useContext(na);return e?PA():fA()}function fA(){du()||yn(!1);let e=p.useContext(zh),{basename:t,future:r,navigator:i}=p.useContext(uu),{matches:a}=p.useContext(na),{pathname:u}=es(),c=JSON.stringify(ib(a,r.v7_relativeSplatPath)),d=p.useRef(!1);return nN(()=>{d.current=!0}),p.useCallback(function(f,v){if(v===void 0&&(v={}),!d.current)return;if(typeof f=="number"){i.go(f);return}let g=sb(f,JSON.parse(c),u,v.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Oa([t,g.pathname])),(v.replace?i.replace:i.push)(g,v.state,v)},[t,i,c,u,e])}const gA=p.createContext(null);function bA(e){let t=p.useContext(na).outlet;return t&&p.createElement(gA.Provider,{value:e},t)}function Po(){let{matches:e}=p.useContext(na),t=e[e.length-1];return t?t.params:{}}function vA(e,t,r,i){du()||yn(!1);let{navigator:a}=p.useContext(uu),{matches:u}=p.useContext(na),c=u[u.length-1],d=c?c.params:{};c&&c.pathname;let m=c?c.pathnameBase:"/";c&&c.route;let f=es(),v;v=f;let g=v.pathname||"/",w=g;if(m!=="/"){let C=m.replace(/^\//,"").split("/");w="/"+g.replace(/^\//,"").split("/").slice(C.length).join("/")}let y=mo(e,{pathname:w});return SA(y&&y.map(C=>Object.assign({},C,{params:Object.assign({},d,C.params),pathname:Oa([m,a.encodeLocation?a.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?m:Oa([m,a.encodeLocation?a.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),u,r,i)}function wA(){let e=TA(),t=zc(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 yA=p.createElement(wA,null);class kA 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(na.Provider,{value:this.props.routeContext},p.createElement(tN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function xA(e){let{routeContext:t,match:r,children:i}=e,a=p.useContext(zh);return a&&a.static&&a.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=r.route.id),p.createElement(na.Provider,{value:t},i)}function SA(e,t,r,i){var a;if(t===void 0&&(t=[]),r===void 0&&(r=null),i===void 0&&(i=null),e==null){var u;if(!r)return null;if(r.errors)e=r.matches;else if((u=i)!=null&&u.v7_partialHydration&&t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let c=e,d=(a=r)==null?void 0:a.errors;if(d!=null){let v=c.findIndex(g=>g.route.id&&(d==null?void 0:d[g.route.id])!==void 0);v>=0||yn(!1),c=c.slice(0,Math.min(c.length,v+1))}let m=!1,f=-1;if(r&&i&&i.v7_partialHydration)for(let v=0;v<c.length;v++){let g=c[v];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=v),g.route.id){let{loaderData:w,errors:y}=r,x=g.route.loader&&w[g.route.id]===void 0&&(!y||y[g.route.id]===void 0);if(g.route.lazy||x){m=!0,f>=0?c=c.slice(0,f+1):c=[c[0]];break}}}return c.reduceRight((v,g,w)=>{let y,x=!1,C=null,j=null;r&&(y=d&&g.route.id?d[g.route.id]:void 0,C=g.route.errorElement||yA,m&&(f<0&&w===0?(DA("route-fallback"),x=!0,j=null):f===w&&(x=!0,j=g.route.hydrateFallbackElement||null)));let T=t.concat(c.slice(0,w+1)),P=()=>{let I;return y?I=C:x?I=j:g.route.Component?I=p.createElement(g.route.Component,null):g.route.element?I=g.route.element:I=v,p.createElement(xA,{match:g,routeContext:{outlet:v,matches:T,isDataRoute:r!=null},children:I})};return r&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?p.createElement(kA,{location:r.location,revalidation:r.revalidation,component:C,error:y,children:P(),routeContext:{outlet:null,matches:T,isDataRoute:!0}}):P()},null)}var rN=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(rN||{}),iN=(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})(iN||{});function CA(e){let t=p.useContext(zh);return t||yn(!1),t}function jA(e){let t=p.useContext(eN);return t||yn(!1),t}function NA(e){let t=p.useContext(na);return t||yn(!1),t}function sN(e){let t=NA(),r=t.matches[t.matches.length-1];return r.route.id||yn(!1),r.route.id}function TA(){var e;let t=p.useContext(tN),r=jA(iN.UseRouteError),i=sN();return t!==void 0?t:(e=r.errors)==null?void 0:e[i]}function PA(){let{router:e}=CA(rN.UseNavigateStable),t=sN(),r=p.useRef(!1);return nN(()=>{r.current=!0}),p.useCallback(function(a,u){u===void 0&&(u={}),r.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,yh({fromRouteId:t},u)))},[e,t])}const rk={};function DA(e,t,r){rk[e]||(rk[e]=!0)}function RA(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 Pl(e){let{to:t,replace:r,state:i,relative:a}=e;du()||yn(!1);let{future:u,static:c}=p.useContext(uu),{matches:d}=p.useContext(na),{pathname:m}=es(),f=dr(),v=sb(t,ib(d,u.v7_relativeSplatPath),m,a==="path"),g=JSON.stringify(v);return p.useEffect(()=>f(JSON.parse(g),{replace:r,state:i,relative:a}),[f,g,a,r,i]),null}function hg(e){return bA(e.context)}function MA(e){let{basename:t="/",children:r=null,location:i,navigationType:a=kr.Pop,navigator:u,static:c=!1,future:d}=e;du()&&yn(!1);let m=t.replace(/^\/*/,"/"),f=p.useMemo(()=>({basename:m,navigator:u,static:c,future:yh({v7_relativeSplatPath:!1},d)}),[m,d,u,c]);typeof i=="string"&&(i=Wa(i));let{pathname:v="/",search:g="",hash:w="",state:y=null,key:x="default"}=i,C=p.useMemo(()=>{let j=cu(v,m);return j==null?null:{location:{pathname:j,search:g,hash:w,state:y,key:x},navigationType:a}},[m,v,g,w,y,x,a]);return C==null?null:p.createElement(uu.Provider,{value:f},p.createElement(cb.Provider,{children:r,value:C}))}new Promise(()=>{});function AA(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 kh(){return kh=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},kh.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 EA(e,t){let r=mg(e);return t&&t.forEach((i,a)=>{r.has(a)||t.getAll(a).forEach(u=>{r.append(a,u)})}),r}const IA="6";try{window.__reactRouterVersion=IA}catch{}function LA(e,t){return YM({basename:void 0,future:kh({},void 0,{v7_prependBasename:!0}),history:vM({window:void 0}),hydrationData:FA(),routes:e,mapRouteProperties:AA,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function FA(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=kh({},t,{errors:_A(t.errors)})),t}function _A(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 wh(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let u=window[a.__subType];if(typeof u=="function")try{let c=new u(a.message);c.stack="",r[i]=c}catch{}}if(r[i]==null){let u=new Error(a.message);u.stack="",r[i]=u}}else r[i]=a;return r}const OA=p.createContext({isTransitioning:!1}),BA=p.createContext(new Map),WA="startTransition",ik=u1[WA],UA="flushSync",sk=bM[UA];function HA(e){ik?ik(e):e()}function uc(e){sk?sk(e):e()}class zA{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 qA(e){let{fallbackElement:t,router:r,future:i}=e,[a,u]=p.useState(r.state),[c,d]=p.useState(),[m,f]=p.useState({isTransitioning:!1}),[v,g]=p.useState(),[w,y]=p.useState(),[x,C]=p.useState(),j=p.useRef(new Map),{v7_startTransition:T}=i||{},P=p.useCallback(A=>{T?HA(A):A()},[T]),I=p.useCallback((A,H)=>{let{deletedFetchers:_,flushSync:Y,viewTransitionOpts:z}=H;A.fetchers.forEach((O,F)=>{O.data!==void 0&&j.current.set(F,O.data)}),_.forEach(O=>j.current.delete(O));let K=r.window==null||r.window.document==null||typeof r.window.document.startViewTransition!="function";if(!z||K){Y?uc(()=>u(A)):P(()=>u(A));return}if(Y){uc(()=>{w&&(v&&v.resolve(),w.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:z.currentLocation,nextLocation:z.nextLocation})});let O=r.window.document.startViewTransition(()=>{uc(()=>u(A))});O.finished.finally(()=>{uc(()=>{g(void 0),y(void 0),d(void 0),f({isTransitioning:!1})})}),uc(()=>y(O));return}w?(v&&v.resolve(),w.skipTransition(),C({state:A,currentLocation:z.currentLocation,nextLocation:z.nextLocation})):(d(A),f({isTransitioning:!0,flushSync:!1,currentLocation:z.currentLocation,nextLocation:z.nextLocation}))},[r.window,w,v,j,P]);p.useLayoutEffect(()=>r.subscribe(I),[r,I]),p.useEffect(()=>{m.isTransitioning&&!m.flushSync&&g(new zA)},[m]),p.useEffect(()=>{if(v&&c&&r.window){let A=c,H=v.promise,_=r.window.document.startViewTransition(async()=>{P(()=>u(A)),await H});_.finished.finally(()=>{g(void 0),y(void 0),d(void 0),f({isTransitioning:!1})}),y(_)}},[P,c,v,r.window]),p.useEffect(()=>{v&&c&&a.location.key===c.location.key&&v.resolve()},[v,w,a.location,c]),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 Z=p.useMemo(()=>({createHref:r.createHref,encodeLocation:r.encodeLocation,go:A=>r.navigate(A),push:(A,H,_)=>r.navigate(A,{state:H,preventScrollReset:_==null?void 0:_.preventScrollReset}),replace:(A,H,_)=>r.navigate(A,{replace:!0,state:H,preventScrollReset:_==null?void 0:_.preventScrollReset})}),[r]),q=r.basename||"/",B=p.useMemo(()=>({router:r,navigator:Z,static:!1,basename:q}),[r,Z,q]),E=p.useMemo(()=>({v7_relativeSplatPath:r.future.v7_relativeSplatPath}),[r.future.v7_relativeSplatPath]);return p.useEffect(()=>RA(i,r.future),[i,r.future]),p.createElement(p.Fragment,null,p.createElement(zh.Provider,{value:B},p.createElement(eN.Provider,{value:a},p.createElement(BA.Provider,{value:j.current},p.createElement(OA.Provider,{value:m},p.createElement(MA,{basename:q,location:a.location,navigationType:a.historyAction,navigator:Z,future:E},a.initialized||r.future.v7_partialHydration?p.createElement($A,{routes:r.routes,future:r.future,state:a}):t))))),null)}const $A=p.memo(VA);function VA(e){let{routes:t,future:r,state:i}=e;return vA(t,void 0,i,r)}var ak;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(ak||(ak={}));var ok;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(ok||(ok={}));function GA(e){let t=p.useRef(mg(e)),r=p.useRef(!1),i=es(),a=p.useMemo(()=>EA(i.search,r.current?null:t.current),[i.search]),u=dr(),c=p.useCallback((d,m)=>{const f=mg(typeof d=="function"?d(a):d);r.current=!0,u("?"+f,m)},[u,a]);return[a,c]}const KA="modulepreload",YA=function(e){return"/"+e},lk={},jl=function(t,r,i){let a=Promise.resolve();if(r&&r.length>0){let c=function(f){return Promise.all(f.map(v=>Promise.resolve(v).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=c(r.map(f=>{if(f=YA(f),f in lk)return;lk[f]=!0;const v=f.endsWith(".css"),g=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${f}"]${g}`))return;const w=document.createElement("link");if(w.rel=v?"stylesheet":KA,v||(w.as="script"),w.crossOrigin="",w.href=f,m&&w.setAttribute("nonce",m),document.head.appendChild(w),v)return new Promise((y,x)=>{w.addEventListener("load",y),w.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${f}`)))})}))}function u(c){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=c,window.dispatchEvent(d),!d.defaultPrevented)throw c}return a.then(c=>{for(const d of c||[])d.status==="rejected"&&u(d.reason);return t().catch(u)})},XA="desktop://window-lifecycle",aN=p.createContext(null),QA=["--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 JA(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 pg(){var e;if(!(typeof document>"u"))for(const t of QA)document.documentElement.style.removeProperty(t),(e=document.body)==null||e.style.removeProperty(t)}function ZA(e){if(typeof document>"u")return;if(!e){pg();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,u]of r)i.style.setProperty(a,u)}function eE(){if(!(typeof window>"u"))return window.innerWidth}function tE({children:e}){const[t,r]=p.useState(()=>eE()),i=p.useMemo(()=>Es({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(()=>{JA(i)},[i]),p.useEffect(()=>()=>{pg()},[]),p.useEffect(()=>{let a=!1,u=null;return!i.isDesktop||!i.bridge.supported?()=>{a=!0}:(jl(()=>Promise.resolve().then(()=>xI),void 0).then(async({listen:c})=>{const d=await c(XA,m=>{const f=m.payload,v=f==null?void 0:f.descriptor;v!=null&&v.windowId&&(i.windows.registerDescriptor(v),f.isOpen?i.windows.markWindowOpen(v.windowId):i.windows.markWindowClosed(v.windowId))});if(a){d();return}u=d}).catch(()=>{}),()=>{a=!0,u==null||u()})},[i]),p.useEffect(()=>{let a=!1,u=null;async function c(){var m,f;const d=await i.bridge.getRuntimeInfo();a||ZA(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?(pg(),()=>{a=!0}):(c(),jl(()=>Promise.resolve().then(()=>PI),void 0).then(async({getCurrentWindow:d})=>{const m=await d().onScaleChanged(()=>{c()});if(a){m();return}u=m}).catch(()=>{}),()=>{a=!0,u==null||u()})},[i]),n.jsx(aN.Provider,{value:i,children:e})}function cr(){return p.useContext(aN)??Es()}const nE={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",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",securityPrivacy:"Security & Privacy",securityPrivacySectionSummary:"Session permissions, risk boundaries, and default approval policy",softwareUpdate:"Software Update",softwareUpdateSectionSummary:"Server and client versions",serverAddress:"Server Address",serverDescription:"Login, API requests, and realtime connections all use this Host entry, while the frontend UI is bundled inside the client itself.",releaseChannel:"Release Channel",releaseChannelDescription:"Stable or beta",releaseStable:"Stable",releaseBeta:"Beta",autoReconnect:"Auto Reconnect",autoReconnectDescription:"Retry HTTP and WebSocket links automatically when Host is briefly unavailable.",autoCheckUpdate:"Auto Check Client Updates",autoCheckUpdateDescription:"Clients only",defaultPermissionMode:"Default Session Permissions",defaultPermissionModeDescription:"Controls the default tool permissions for new and resumed sessions. Full access disables approval prompts and should only be used for trusted projects and environments.",permissionModeDefault:"Follow CLI defaults",permissionModeAcceptEdits:"Allow workspace edits without asking",permissionModeBypassPermissions:"Full access without asking",enabled:"Enabled",disabled:"Disabled",serverUpdate:"Server Update",serverUpdateDescription:"",clientUpdate:"Client Update",clientUpdateDescription:"",serverCurrentVersion:"Server Current Version",serverTargetVersion:"Server Target Version",serverPackageName:"npm Package",serverUpdateCommand:"Upgrade Command",serverCheckNow:"Check Server",serverOpenPage:"Open npm",serverLatestUnknown:"Unavailable",serverUpdateReady:"New version found",serverUpToDate:"Up to date",serverCheckFailed:"Check failed",serverOpenPageFailed:"Failed to open page",releaseCurrentVersion:"Current Version",releaseTargetVersion:"Target Version",releaseTargetTag:"Target Tag",releasePublishedAt:"Published At",releaseUnknownVersion:"Unknown",releaseNotes:"What's New",releaseNotesEmpty:"No details",releaseCheckNow:"Check Client",releaseInstallNow:"Install",releaseOpenPage:"Open Release",releaseRollback:"Rollback",releaseUpdateReady:"New version found",releaseUpToDate:"Up to date",releaseCheckFailed:"Check failed",releaseInstallerMissing:"A new version is available, but this release does not include a supported installer yet.",releaseSignatureMissing:"A new version is available, but this release does not provide checksum information yet.",releaseInstallStarted:"Install started",releaseInstallFailed:"Install failed",releasePageOpenFailed:"Failed to open page",releaseRollbackStarted:"Rollback started",releaseRollbackFailed:"Rollback failed",clientUpdateUnsupported:"Install updates are not supported here",logout:"Log out"},home:{title:"Continue from a session, not from a backend table",subtitle:"Pick a workspace and session here first. The real work starts in the next step.",terminalsEntry:"Open Terminal",workspaceSection:"Workspaces",sessionSection:"Recent Sessions",emptyWorkspaces:"No workspace has been imported yet. Import one on the Host side first, and the entry will appear here.",emptySessions:"There is no session to continue in the current workspace yet.",noActivity:"No activity yet"},terminal:{title:"Terminal",heroTitle:"Keep the real PTY on Host, keep the control surface in the workspace",heroSubtitle:"This page does not fake output and does not mix terminal with process management. It only consumes the real terminal stream managed by Host.",workspaceSection:"Workspace & Terminal",workspaceField:"Current Workspace",shellField:"Shell for New Terminal",runtimeField:"Runtime",runtimeAutoOption:"Auto",runtimeAutoShortLabel:"auto",runtimeAutoDescription:"Use the Host default policy for this terminal runtime.",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",fileViewerRefreshPreview:"Refresh",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.",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"}},rE={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:"文件管理",showSystemFiles:"显示系统文件",showSystemFilesDescription:"在文件管理里显示 macOS 和 Windows 常见的系统文件,例如 .DS_Store、Thumbs.db。这个开关只影响当前设备。",serverConnection:"服务器连接",serverConnectionSectionSummary:"服务器地址与连接恢复策略",securityPrivacy:"安全与隐私",securityPrivacySectionSummary:"会话权限、风险边界与默认授权策略",softwareUpdate:"软件更新",softwareUpdateSectionSummary:"服务端和客户端版本",serverAddress:"服务器地址",serverDescription:"客户端的登录、接口请求和实时连接都通过这个 Host 入口工作;前端界面资源由应用自身携带。",releaseChannel:"发布通道",releaseChannelDescription:"稳定版或测试版",releaseStable:"稳定版",releaseBeta:"测试版",autoReconnect:"自动重连",autoReconnectDescription:"当 Host 短暂不可达时,自动尝试恢复 HTTP 和 WebSocket 链路。",autoCheckUpdate:"自动检查客户端更新",autoCheckUpdateDescription:"仅客户端",defaultPermissionMode:"默认会话权限",defaultPermissionModeDescription:"控制新建和继续会话时默认使用的工具权限。完整权限会关闭询问,只适合你已经信任当前项目和运行环境时使用。",permissionModeDefault:"跟随 CLI 默认策略",permissionModeAcceptEdits:"允许编辑工作区,不询问",permissionModeBypassPermissions:"完整权限,不询问",enabled:"已启用",disabled:"已关闭",serverUpdate:"服务端更新",serverUpdateDescription:"",clientUpdate:"客户端更新",clientUpdateDescription:"",serverCurrentVersion:"服务端当前版本",serverTargetVersion:"服务端目标版本",serverPackageName:"npm 包名",serverUpdateCommand:"升级命令",serverCheckNow:"检查服务端",serverOpenPage:"打开 npm",serverLatestUnknown:"暂未获取",serverUpdateReady:"发现新版本",serverUpToDate:"已是最新版本",serverCheckFailed:"检查失败",serverOpenPageFailed:"打开页面失败",releaseCurrentVersion:"当前版本",releaseTargetVersion:"目标版本",releaseTargetTag:"目标 Tag",releasePublishedAt:"发布时间",releaseUnknownVersion:"未知",releaseNotes:"更新内容",releaseNotesEmpty:"暂无更新内容",releaseCheckNow:"检查客户端",releaseInstallNow:"安装更新",releaseOpenPage:"打开发布页",releaseRollback:"回退版本",releaseUpdateReady:"发现新版本",releaseUpToDate:"已是最新版本",releaseCheckFailed:"检查失败",releaseInstallerMissing:"有新版本,暂无安装包",releaseSignatureMissing:"有新版本,缺少校验信息",releaseInstallStarted:"安装已开始",releaseInstallFailed:"安装失败",releasePageOpenFailed:"打开页面失败",releaseRollbackStarted:"已开始回退",releaseRollbackFailed:"回退失败",clientUpdateUnsupported:"当前不支持安装更新",logout:"退出登录"},home:{title:"从一条会话继续,而不是从后台表格开始",subtitle:"这里先挑一个工作区和会话,真正的工作区在下一步。",terminalsEntry:"进入终端页",workspaceSection:"工作区",sessionSection:"最近会话",emptyWorkspaces:"还没有导入工作区。先在 Host 侧导入后,这里会出现入口。",emptySessions:"当前工作区还没有可继续的会话。",noActivity:"暂时还没有活动"},terminal:{title:"终端",heroTitle:"把真实 PTY 留在 Host,把操作入口留在工作台",heroSubtitle:"这里不伪造输出,不把终端和进程搅在一起,只消费 Host 统一托管的真实终端流。",workspaceSection:"工作区与终端",workspaceField:"当前工作区",shellField:"新终端使用的 Shell",runtimeField:"Runtime",runtimeAutoOption:"自动选择",runtimeAutoShortLabel:"auto",runtimeAutoDescription:"按 Host 默认策略选择当前终端 runtime。",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:"纯文本",fileViewerRefreshPreview:"刷新",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:"当前没有可展示的提交历史。",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 操作超时了,先确认仓库状态和网络环境。"}}},iE=[{id:"zh-CN",labelKey:"locale.zhCN"},{id:"en-US",labelKey:"locale.enUS"}];function ub({variant:e="default",className:t}){const r=To(a=>a.profile.language);function i(a){a!==r&&bh({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:iE.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 sE={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:"工作区",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:"主题"}},aE={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",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"}},oN={"zh-CN":rE,"en-US":nE},oE={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:"请先填写助手名称"},lE={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 ck(e,t){const r=e.shell;return{...e,shell:{...r&&typeof r=="object"?r:{},...t}}}const lN={"zh-CN":ck(sE,oE),"en-US":ck(aE,lE)};function xh(e,t){const r=e.split(".");let i=t;for(const a of r){if(!i||typeof i=="string")return e;const u=i[a];if(u==null)return e;i=u}return typeof i=="string"?i:e}function cE(){return bs.getState().profile.language??"zh-CN"}function o(e,t){const i=cE()==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const a of i){const u=xh(e,lN[a]);if(u!==e)return Up(u,t);const c=xh(e,oN[a]);if(c!==e)return Up(c,t)}return Up(e,t)}function Up(e,t){return t?e.replace(/\{([^}]+)\}/g,(r,i)=>{const a=t[i];return a==null?r:String(a)}):e}function uE({children:e,language:t}){return p.useEffect(()=>{document.documentElement.setAttribute("lang",t)},[t]),e}function dE(){const e=To(t=>t.profile.language);return t=>{const r=e==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const i of r){const a=xh(t,lN[i]);if(a!==t)return a;const u=xh(t,oN[i]);if(u!==t)return u}return t}}const cN=[{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 uN(e){return o(e.labelKey)}function hE(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function mE(){return bs.getState().profile.theme??hE()}function pE(e){typeof window>"u"||(document.documentElement.setAttribute("data-theme",e),bh({theme:e}).catch(()=>{}))}function dN(){return{theme:To(t=>t.profile.theme),setTheme:pE}}function fE(){typeof window>"u"||document.documentElement.setAttribute("data-theme",mE())}function gE({children:e}){const t=To(r=>r.profile.theme);return p.useEffect(()=>{fE()},[t]),n.jsx(n.Fragment,{children:e})}const bE={showToast:()=>"",dismissToast:()=>{}},hN=p.createContext(bE);function vE(){return`toast-${Math.random().toString(36).slice(2,10)}`}function wE({toast:e,onDismiss:t}){const{id:r,title:i,description:a,tone:u,durationMs:c,action:d}=e;return p.useEffect(()=>{if(c===null)return;const m=window.setTimeout(()=>{t(r)},c);return()=>{window.clearTimeout(m)}},[c,r,t,i,a,u]),n.jsxs("article",{className:"toast-card","data-tone":u,role:u==="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 yE({children:e}){const[t,r]=p.useState([]),i=p.useCallback(c=>{r(d=>d.filter(m=>m.id!==c))},[]),a=p.useCallback(c=>{const d=c.id??vE(),m={id:d,title:c.title,description:c.description,tone:c.tone??"info",durationMs:c.durationMs===void 0?4200:c.durationMs,action:c.action};return r(f=>{const v=f.findIndex(w=>w.id===d);if(v===-1)return[...f,m];const g=[...f];return g[v]=m,g}),d},[]),u=p.useMemo(()=>({showToast:a,dismissToast:i}),[i,a]);return n.jsxs(hN.Provider,{value:u,children:[e,n.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(c=>n.jsx(wE,{toast:c,onDismiss:i},c.id))})]})}function ir(){return p.useContext(hN)}const Zd="0.2.5",mN=p.createContext(Zd);function kE({children:e}){const t=cr(),[r,i]=p.useState(Zd);return p.useEffect(()=>{let a=!1;return t.isDesktop?(t.bridge.getRuntimeInfo().then(u=>{var d,m;if(a)return;const c=u.ok?(m=(d=u.value)==null?void 0:d.version)==null?void 0:m.trim():"";i(c||Zd)}),()=>{a=!0}):(i(Zd),()=>{a=!0})},[t]),n.jsx(mN.Provider,{value:r,children:e})}function pN(){return p.useContext(mN)}const fN="codingns.server.base-url.history",gN=6,bN="__custom__";function vN(){return typeof window<"u"&&typeof window.localStorage<"u"}function xE(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function wN(e){if(!e)return null;try{return ta(e)}catch{return null}}function SE(){if(!vN())return[];const e=window.localStorage.getItem(fN);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(r=>typeof r=="string"?wN(r):null).filter(r=>!!r):[]}catch{return[]}}function CE(e){const t=new Set,r=[];for(const i of e)!i||t.has(i)||(t.add(i),r.push(i));return r}function jE(e){const t=SE();return CE([e,...t,wN(xE())]).slice(0,gN)}function NE(e){vN()&&window.localStorage.setItem(fN,JSON.stringify(e.slice(0,gN)))}class TE{constructor(){it(this,"state",this.createState(Dr.getState().hostBaseUrl));it(this,"listeners",new Set);it(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));it(this,"getState",()=>this.state);Dr.subscribe(()=>{const t=this.createState(Dr.getState().hostBaseUrl);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=ta(t),i=r!==Dr.getState().hostBaseUrl;return this.state=this.createState(r),this.emit(),Dr.update({hostBaseUrl:r}),i}reset(){this.state=this.createState(Dr.getState().hostBaseUrl),this.emit()}createState(t){const r=jE(t);return NE(r),{baseUrl:t,options:r}}emit(){for(const t of this.listeners)t()}}const Sh=new TE;function Ch(e){return p.useSyncExternalStore(Sh.subscribe,()=>e(Sh.getState()))}function PE(e,t){return t.includes(e)?e:bN}function DE(){return bN}const yN={login(e,t,r){return rr.login(e,t,r)},bootstrap(e,t,r){return rr.bootstrap(e,t,r)},refresh(){return rr.refresh()},logout(){rr.clear()}};function RE(){const e=dr(),t=Ch(C=>C.baseUrl),[r,i]=p.useState("admin"),[a,u]=p.useState(""),[c,d]=p.useState(""),[m,f]=p.useState(null),[v,g]=p.useState("error"),[w,y]=p.useState(!1);async function x(C){if(C.preventDefault(),a!==c){g("error"),f(o("auth.bootstrapMismatch"));return}y(!0),f(null);try{await yN.bootstrap(r,a),g("success"),f(o("auth.bootstrapSuccess")),window.setTimeout(()=>e("/login",{replace:!0}),500)}catch(j){g("error"),j instanceof ei?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=>u(C.target.value)})]}),n.jsxs("label",{className:"field-group",children:[n.jsx("span",{children:o("auth.confirmPassword")}),n.jsx("input",{type:"password",value:c,onChange:C=>d(C.target.value)})]}),m?n.jsx("p",{className:"status-text","data-tone":v,children:m}):null,n.jsx("button",{className:"primary-button",type:"submit",disabled:w,children:o(w?"common.loading":"auth.submitBootstrap")})]})]})})}async function ME(e){try{return{...await K1(e),reachable:!0}}catch{return{initialized:!1,reachable:!1}}}function AE({isOpen:e,onClose:t,onSave:r,theme:i="dark"}){const a=Ch(P=>P.baseUrl),u=Ch(P=>P.options),c=DE(),[d,m]=p.useState(a),[f,v]=p.useState(null),g=p.useMemo(()=>{try{return ta(d)}catch{return null}},[d]),w=PE(g??d,u),y="server-settings-preset",x="server-settings-address";if(p.useEffect(()=>{e&&(m(a),v(null))},[e,a]),!e)return null;function C(){if(!g){v(o("auth.serverInvalid"));return}Sh.setBaseUrl(g),r==null||r(g),t()}function j(P){P.target===P.currentTarget&&t()}function T(){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:w,onChange:P=>{const I=P.target.value;I!==c&&(m(I),v(null))},children:[u.map(P=>n.jsx("option",{value:P,children:P},P)),n.jsx("option",{value:c,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:T,onChange:P=>{m(P.target.value),v(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 uk="width=device-width, initial-scale=1.0, viewport-fit=cover",EE="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover";function IE(){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=()=>{c(),d()};let u=[];const c=()=>{t.width=window.innerWidth,t.height=window.innerHeight},d=()=>{u=[];const f=Math.min(50,Math.floor(t.width*t.height/25e3));for(let v=0;v<f;v++)u.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),u.forEach((f,v)=>{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(),u.slice(v+1).forEach(g=>{const w=f.x-g.x,y=f.y-g.y,x=Math.sqrt(w*w+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 c(),d(),m(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),cancelAnimationFrame(i)}},[]),n.jsx("canvas",{ref:e,className:"particle-canvas"})}function LE({text:e}){return n.jsx("span",{className:"glitch-text","data-text":e,children:e})}function FE({text:e}){const[t,r]=p.useState(""),[i,a]=p.useState(!0);return p.useEffect(()=>{let u=0,c=null;const d=setInterval(()=>{u<=e.length?(r(e.slice(0,u)),u++):(clearInterval(d),c=window.setTimeout(()=>a(!1),1e3))},50);return()=>{clearInterval(d),c!==null&&window.clearTimeout(c)}},[e]),n.jsxs("span",{className:"typewriter-text",children:[t,i&&n.jsx("span",{className:"typewriter-cursor",children:"_"})]})}function _E(){const e=dr(),t=dE(),[r]=GA(),i=cr(),a=pN(),u=eb(i.platform),c=p.useMemo(()=>h1(i),[i]),d=p.useMemo(()=>c?bj():null,[c]),m=(d==null?void 0:d.serverBaseUrl)??null,[f,v]=p.useState(()=>(d==null?void 0:d.username)??"admin"),[g,w]=p.useState(()=>(d==null?void 0:d.password)??""),[y,x]=p.useState(()=>!!d),C=Ch(X=>X.baseUrl),[j,T]=p.useState(C),[P,I]=p.useState(null),[Z,q]=p.useState(!1),[B,E]=p.useState(!1),[A,H]=p.useState(null),[_,Y]=p.useState(!1),z=Aj(X=>X.session),K=p.useMemo(()=>r.get("returnTo")??"/",[r]),{theme:O}=dN(),F=p.useRef(!1),te=i.isNativeMobile,de=p.useMemo(()=>O==="light"?"light":"dark",[O]);p.useEffect(()=>{if(typeof document>"u")return;const X=document.querySelector('meta[name="viewport"]');if(!(X instanceof HTMLMetaElement))return;const D=X.getAttribute("content")??uk;return te?X.setAttribute("content",EE):X.setAttribute("content",uk),()=>{X.setAttribute("content",D)}},[te]),p.useEffect(()=>{F.current||(F.current=!0,!(!c||!m||m===C)&&(Sh.setBaseUrl(m),T(m)))},[C,c,m]),p.useEffect(()=>{if(z){e(K,{replace:!0});return}if(!j)return;let X=!1;return ME(j).then(D=>{X||(D.demoMode&&(Y(!0),G1()&&I(t("auth.demoSessionExpired"))),D.reachable&&!D.initialized&&e("/bootstrap",{replace:!0}))}).catch(()=>{X||I(t("auth.authUnavailable"))}),()=>{X=!0}},[z,e,j,K,t]);async function W(X){X.preventDefault(),q(!0),I(null),T(C),c&&!y&&p1();try{await yN.login(f,g,C),await bs.refreshForAuthenticatedUser(),c&&y&&vj({username:f,password:g,serverBaseUrl:C}),e(K,{replace:!0})}catch(D){if(D instanceof ei){if(D.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}I(D.message)}else I(t("auth.authUnavailable"))}finally{q(!1)}}function M(X){T(X),I(null)}const N="login-username",L="login-password";return n.jsxs("main",{className:"cyber-login-page","data-theme":de,"data-native-mobile":te?"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(IE,{})]}),n.jsx("div",{className:"scanlines"}),n.jsxs("div",{className:"cyber-login-container",children:[n.jsx("div",{className:"cyber-login-toolbar",children:n.jsx(ub,{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(LE,{text:"CodingNS"})}),n.jsx("p",{className:"cyber-brand-subtitle",children:n.jsx(FE,{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"})]}),_?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:W,children:[n.jsxs("div",{className:`cyber-field ${A==="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:N,children:[n.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),n.jsx("input",{id:N,"aria-label":t("auth.username"),className:"cyber-input",value:f,onChange:X=>v(X.target.value),onFocus:()=>H("username"),onBlur:()=>H(null),autoComplete:"username"})]}),n.jsxs("div",{className:`cyber-field ${A==="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:L,children:[n.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),n.jsx("input",{id:L,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:g,onChange:X=>w(X.target.value),onFocus:()=>H("password"),onBlur:()=>H(null),autoComplete:"current-password"})]}),c?n.jsxs("label",{className:"cyber-remember-toggle",children:[n.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:y,onChange:X=>x(X.target.checked)}),n.jsx("span",{children:t("auth.rememberPassword")})]}):null,P?n.jsxs("div",{className:"cyber-status","data-tone":"error",children:[n.jsx("span",{className:"cyber-status-icon",children:"⚠"}),n.jsx("span",{children:P})]}):null,n.jsxs("button",{className:`cyber-submit ${Z?"loading":""}`,type:"submit",disabled:Z,children:[n.jsx("span",{className:"cyber-submit-glow"}),n.jsx("span",{className:"cyber-submit-border"}),n.jsx("span",{className:"cyber-submit-text",children:Z?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:()=>E(!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:C})]})]}):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(AE,{isOpen:B,onClose:()=>E(!1),onSave:M,theme:de}):null]})}function ts(){return cr().haptics}function kN(e,t){const r=new Map(e.map(u=>[t.getId(u),u])),i=new Map,a=[];for(const u of e){const c=OE(u,r,t);if(!c){a.push(u);continue}const d=i.get(c)??[];i.set(c,[...d,u])}return[...a].sort(t.compare).map(u=>CN(u,0,i,t,new Set))}function As(e){return Array.isArray(e==null?void 0:e.children)?e.children:[]}function xN(e){return e.flatMap(t=>[t.item,...xN(As(t))])}function Ji(e){return e.flatMap(t=>[t,...Ji(As(t))])}function qh(e,t){return e.some(r=>t(r.item)||qh(As(r),t))}function SN(e,t,r){return e?r(e.item)===t?!0:As(e).some(i=>SN(i,t,r)):!1}function Js(e,t,r){for(const i of e){const a=r(i.item);if(a===t)return[];const u=Js(As(i),t,r);if(SN(i,t,r)&&u.length>=0)return[a,...u]}return[]}function CN(e,t,r,i,a){const u=i.getId(e),c=new Set(a);c.add(u);const d=[...r.get(u)??[]].filter(m=>!c.has(i.getId(m))).sort(i.compare).map(m=>CN(m,t+1,r,i,c));return{item:e,depth:t,children:d}}function OE(e,t,r){const i=dk(r.getParentId(e));if(!i)return null;const a=t.get(i);if(!a)return null;const u=new Set([r.getId(e)]);let c=a;for(;c;){const d=r.getId(c);if(u.has(d))return null;u.add(d);const m=dk(r.getParentId(c));if(!m||(c=t.get(m),!c))return i}return i}function dk(e){const t=e==null?void 0:e.trim();return t||null}function Ri(){return"/workspaces"}function ki(e){return`/workspaces/${encodeURIComponent(e)}`}function BE(e){return`${ki(e)}/debug`}function yo(e){return`${ki(e)}/sessions`}function fr(e,t){return`${yo(e)}/${encodeURIComponent(t)}`}function Dl(e,t){const r=`${ki(e)}/tools`;if(!t)return r;const i=new URLSearchParams({tab:t});return`${r}?${i.toString()}`}function jN(e){return`${ki(e)}/tools/files`}function NN(e){return`${ki(e)}/tools/git`}function $h(e){return`${ki(e)}/tools/processes`}function fl(e){return`${ki(e)}/terminals`}function ko(e,t){const r=`${ki(e)}/butler`;if(!t)return r;const i=new URLSearchParams({tab:t});return`${r}?${i.toString()}`}function TN(e){return e.flatMap(t=>[...t.sessions.map(r=>({session:r,workspace:t.workspace})),...DN(t.childWorktrees??[])]).sort((t,r)=>(r.session.lastMessageAt??r.session.updatedAt).localeCompare(t.session.lastMessageAt??t.session.updatedAt))}function db(e){return kN(e,{getId:t=>t.session.sessionId,getParentId:t=>{var r;return((r=t.session.parentSessionId)==null?void 0:r.trim())||null},compare:UE})}function PN(e,t){const r=WE(),i=new URLSearchParams({provider:t});return`${fr(e,r)}?${i.toString()}`}function WE(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`draft-${e.randomUUID()}`:`draft-${Date.now()}-${Math.random().toString(16).slice(2)}`}function UE(e,t){return(t.session.lastMessageAt??t.session.updatedAt).localeCompare(e.session.lastMessageAt??e.session.updatedAt)}function DN(e){return e.flatMap(t=>[...t.sessions.map(r=>({session:r,workspace:t.workspace})),...DN(t.children)])}const HE="mobile.tools.last-primary-tool";function RN(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(HE)==="git"?"git":"files"}catch{return"files"}}function hb(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 u=xr(a.pattern,e),c=((i=u==null?void 0:u.params.workspaceId)==null?void 0:i.trim())??null;if(c)return{workspaceId:c,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(xr(a.pattern,e))return{workspaceId:null,routeKind:a.routeKind,legacy:!0};return null}function zE(e,t){const r=hb(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":RN()}function mb(e,t){const r=hb(e);return r!=null&&r.workspaceId?Dl(r.workspaceId,zE(e,t)):r!=null&&r.legacy?RN()==="git"?"/tools?tab=git":"/tools?tab=files":null}function pb({activeEntry:e,presentation:t,pathname:r,search:i,moreButtonLabel:a}){if(t==="conversation-focus"||e!=="tools")return null;const u=hb(r);return u?u.routeKind==="processes"?{title:o("shell.terminalManagerEntry"),showBackButton:!0,showMoreButton:!1,moreButtonLabel:a}:(u.routeKind==="home"||u.routeKind==="files"||u.routeKind==="git",null):null}const MN=p.createContext({composerPortalTarget:null});function fb({composerPortalTarget:e,children:t}){return n.jsx(MN.Provider,{value:{composerPortalTarget:e},children:t})}function AN(){return p.useContext(MN)}function gb(e,t,r){const[i,a]=p.useState(void 0);return p.useEffect(()=>{const u=e.current,c=t.current;if(!r||!u||!c){a(void 0),u&&u.style.removeProperty("--mobile-conversation-tabbar-height");return}const d=u,m=c;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 v=typeof ResizeObserver<"u"?new ResizeObserver(f):null;return v==null||v.observe(m),window.addEventListener("resize",f),()=>{v==null||v.disconnect(),window.removeEventListener("resize",f),d.style.removeProperty("--mobile-conversation-tabbar-height")}},[r,e,t]),i}const qE=3e3,gd=10,hk=84,mk=.36;function bb({enabled:e,rootRef:t,suspended:r=!1,resetKey:i}){const a=p.useRef(null),u=p.useRef(null),c=p.useRef("visible"),d=p.useRef(1),[m,f]=p.useState("visible"),[v,g]=p.useState(1);p.useEffect(()=>{c.current=m},[m]),p.useEffect(()=>{d.current=v},[v]);function w(){ao(a),a.current=window.setTimeout(()=>{y()},qE)}function y(){f("hidden"),g(0)}function x(){f("visible"),g(1),w()}p.useEffect(()=>{if(ao(a),!e){ao(a),f("visible"),g(1);return}if(r){f("hidden"),g(0);return}return x(),()=>{ao(a)}},[e,i,r]),p.useEffect(()=>()=>{ao(a)},[]),p.useEffect(()=>{if(!e||r){u.current=null;return}const j=t.current;if(!j)return;function T(A){if(A.touches.length!==1){u.current=null;return}const H=A.touches[0],_=gk(A.target);if(!H||!_){u.current=null;return}u.current={surface:_,startX:H.clientX,startY:H.clientY,pointerType:"touch",initialState:c.current==="visible"?"visible":"hidden",touchId:H.identifier,dragging:!1,latestProgress:d.current},c.current==="visible"&&ao(a)}function P(A){const H=u.current;if(!H||H.pointerType!=="touch")return;const _=Hp(A.touches,H.touchId);if(!_)return;const Y=_.clientX-H.startX,z=_.clientY-H.startY;if(H.surface==="conversation"){if(Math.abs(z)<=gd||Math.abs(z)<=Math.abs(Y))return;u.current=null,H.initialState==="visible"&&y();return}const K=H.initialState==="hidden"?-z:z;K<=gd&&!H.dragging||(vk(A),H.dragging=!0,H.latestProgress=pk(H.initialState,K),f("dragging"),g(H.latestProgress))}function I(A){const H=u.current;if(!(!H||H.pointerType!=="touch"||!Hp(A.changedTouches,H.touchId))){if(u.current=null,!H.dragging){H.initialState==="visible"&&w();return}fk(H.initialState,H.latestProgress,x,f,g)}}function Z(A){const H=u.current;if(!(!H||H.pointerType!=="touch"||!Hp(A.changedTouches,H.touchId))){if(u.current=null,!H.dragging){H.initialState==="visible"&&w();return}if(H.initialState==="visible"){x();return}f("hidden"),g(0)}}function q(A){if(A.pointerType!=="touch")return;const H=gk(A.target);if(!H){u.current=null;return}if(u.current={surface:H,startX:A.clientX,startY:A.clientY,pointerType:"pointer",initialState:c.current==="visible"?"visible":"hidden",pointerId:A.pointerId,captureTarget:A.target instanceof Element?A.target:null,dragging:!1,latestProgress:d.current},A.target instanceof Element)try{A.target.setPointerCapture(A.pointerId)}catch{}c.current==="visible"&&ao(a)}function B(A){const H=u.current;if(!H||H.pointerType!=="pointer")return;const _=A.clientX-H.startX,Y=A.clientY-H.startY;if(H.surface==="conversation"){if(Math.abs(Y)<=gd||Math.abs(Y)<=Math.abs(_))return;u.current=null,H.initialState==="visible"&&y();return}const z=H.initialState==="hidden"?-Y:Y;z<=gd&&!H.dragging||(vk(A),H.dragging=!0,H.latestProgress=pk(H.initialState,z),f("dragging"),g(H.latestProgress))}function E(A){const H=u.current;if(!(!H||H.pointerType!=="pointer"||H.pointerId!==A.pointerId)){if(u.current=null,$E(H),!H.dragging){H.initialState==="visible"&&w();return}fk(H.initialState,H.latestProgress,x,f,g)}}return j.addEventListener("touchstart",T,{passive:!0}),j.addEventListener("pointerdown",q,{passive:!0}),window.addEventListener("touchmove",P,{passive:!1}),window.addEventListener("touchend",I),window.addEventListener("touchcancel",Z),window.addEventListener("pointermove",B,{passive:!1}),window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),()=>{j.removeEventListener("touchstart",T),j.removeEventListener("pointerdown",q),window.removeEventListener("touchmove",P),window.removeEventListener("touchend",I),window.removeEventListener("touchcancel",Z),window.removeEventListener("pointermove",B),window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E)}},[e,t,r]);const C=e&&!r?v:e?0:1;return{state:r&&e?"hidden":m,progress:C,isOpen:C>.01}}function ao(e){e.current!==null&&(window.clearTimeout(e.current),e.current=null)}function pk(e,t){return bk(e==="hidden"?t/hk:1-t/hk,0,1)}function fk(e,t,r,i,a){if(e==="hidden"){if(t>=mk){r();return}i("hidden"),a(0);return}if(t<=1-mk){i("hidden"),a(0);return}r()}function $E(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 Hp(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 gk(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 bk(e,t,r){return Math.min(Math.max(e,t),r)}function vk(e){e.cancelable&&e.preventDefault()}function hu({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 Vh(e){return!e.isNativeMobile||e.viewportClass==="expanded"||typeof window>"u"?!1:window.innerHeight>window.innerWidth}function EN(e){return e==="medium-navigation"||e==="expanded"}function IN(e){return e==="medium-auxiliary"||e==="expanded"}function vb({viewportClass:e,activeEntry:t,hasNavigationPanel:r,hasAuxiliaryPanel:i,preferCompactLayout:a=!1,children:u,navigationPanel:c,auxiliaryPanel:d}){const m=hu({viewportClass:e,activeEntry:t,hasNavigationPanel:r,hasAuxiliaryPanel:i,preferCompactLayout:a}),f=EN(m)&&c,v=IN(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:c}):null,n.jsx("div",{className:"mobile-adaptive-pane-main",children:u}),v?n.jsx("aside",{className:"workbench-auxiliary surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-auxiliary",children:d}):null]})}function VE({activeEntry:e,presentation:t="default",children:r,navigationPanel:i,auxiliaryPanel:a,onNavigateWorkspaces:u,onNavigateTerminals:c,onNavigateSessions:d,onNavigateTools:m,onNavigateToolFiles:f,onNavigateToolGit:v,onNavigateToolProcesses:g,onNavigateSettings:w}){const y=cr(),x=ts(),C=es(),j=dr(),T=p.useRef(null),P=p.useRef(null),[I,Z]=p.useState(null),q=t==="conversation-focus",B=Vh({isNativeMobile:y.isNativeMobile,viewportClass:y.viewportClass}),E=bb({enabled:q,rootRef:T,resetKey:`${C.pathname}${C.search}`}),A=hu({viewportClass:y.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:B}),H=pb({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:o("shell.androidMoreAction")}),_=[{key:"workspaces",label:o("shell.mobileWorkspacesEntry"),icon:n.jsx(YE,{}),onClick:u},{key:"sessions",label:o("shell.mobileSessionsEntry"),icon:n.jsx(XE,{}),onClick:d},{key:"terminals",label:o("shell.mobileTerminalsEntry"),icon:n.jsx(QE,{}),onClick:c},{key:"tools",label:o("shell.mobileToolsEntry"),icon:n.jsx(JE,{}),onClick:m},{key:"settings",label:o("shell.mobileSettingsEntry"),icon:n.jsx(ZE,{}),onClick:w}],Y=q?{"--mobile-conversation-tabbar-progress":E.progress.toFixed(4)}:void 0;gb(T,P,q);function z(){const O=mb(C.pathname,C.search);if(!O){m();return}j(O,{replace:!0})}const K=n.jsx("nav",{ref:P,className:"android-workbench-bottom-nav","aria-label":o("shell.title"),children:_.map(O=>n.jsxs("button",{type:"button",className:"android-workbench-bottom-nav-item","data-active":O.key===e,"aria-current":O.key===e?"page":void 0,onClick:()=>{O.key!==e&&x.trigger("selection"),O.onClick()},children:[n.jsx("span",{className:"android-workbench-bottom-nav-icon","aria-hidden":"true",children:O.icon}),n.jsx("span",{className:"android-workbench-bottom-nav-label",children:O.label})]},O.key))});return n.jsx(fb,{composerPortalTarget:q?I:null,children:n.jsxs("div",{ref:T,className:"android-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":A,"data-tabbar-open":q?E.isOpen:!0,"data-conversation-tabbar-state":q?E.state:"default",style:Y,children:[H?n.jsxs("header",{className:"android-workbench-topbar","data-header-kind":"tools",children:[n.jsxs("div",{className:"android-workbench-topbar-leading",children:[H.showBackButton?n.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":o("common.back"),onClick:z,children:n.jsx(GE,{})}):null,n.jsx("div",{className:"android-workbench-topbar-copy",children:n.jsx("h1",{children:H.title})})]}),n.jsx("div",{className:"android-workbench-topbar-actions",children:H.showMoreButton?n.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":H.moreButtonLabel,onClick:g,children:n.jsx(KE,{})}):null})]}):null,n.jsx("div",{className:"android-workbench-content",children:n.jsx(vb,{viewportClass:y.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:B,navigationPanel:i,auxiliaryPanel:a,children:r})}),q?n.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[n.jsx("div",{ref:Z,className:"mobile-conversation-bottom-layer-composer-slot"}),n.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:K})]}):K]})})}function GE(){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 KE(){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 YE(){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 XE(){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 QE(){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 JE(){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 ZE(){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 eI=120,xc={viewportHeight:null,keyboardInset:0,keyboardOpen:!1};function fg(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function tI(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 nI(){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(fg);return e.length>0?Math.max(...e):0}function wk(){if(typeof window>"u")return xc;const e=window.visualViewport,t=nI(),r=(e==null?void 0:e.height)??t,i=fg(r)?Math.round(r):null,a=fg(e==null?void 0:e.offsetTop)?(e==null?void 0:e.offsetTop)??0:0,u=i===null?0:Math.max(0,Math.round(t-i-a));return{viewportHeight:i,keyboardInset:u,keyboardOpen:tI(typeof document<"u"?document.activeElement:null)&&u>=eI}}function zp(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 rI(e){const[t,r]=p.useState(()=>e?wk():xc),i=p.useRef(null);return p.useEffect(()=>{if(!e){r(xc),zp(!1,xc);return}function a(){r(wk())}function u(){i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{i.current=null,a()},0)}a();const c=window.visualViewport;return window.addEventListener("resize",a),window.addEventListener("orientationchange",a),c==null||c.addEventListener("resize",a),c==null||c.addEventListener("scroll",a),document.addEventListener("focusin",a),document.addEventListener("focusout",u),()=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null),window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a),c==null||c.removeEventListener("resize",a),c==null||c.removeEventListener("scroll",a),document.removeEventListener("focusin",a),document.removeEventListener("focusout",u),zp(!1,xc)}},[e]),p.useEffect(()=>{zp(e,t)},[e,t]),t}function iI({activeEntry:e,presentation:t="default",children:r,navigationPanel:i,auxiliaryPanel:a,onNavigateWorkspaces:u,onNavigateTerminals:c,onNavigateSessions:d,onNavigateTools:m,onNavigateToolFiles:f,onNavigateToolGit:v,onNavigateToolProcesses:g,onNavigateSettings:w}){const y=cr(),x=ts(),C=es(),j=dr(),T=p.useRef(null),P=p.useRef(null),[I,Z]=p.useState(null),q=t==="conversation-focus",B=Vh({isNativeMobile:y.isNativeMobile,viewportClass:y.viewportClass}),E=bb({enabled:q,rootRef:T,resetKey:`${C.pathname}${C.search}`}),A=hu({viewportClass:y.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:B}),H=pb({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:o("shell.iosMoreAction")}),_=[{key:"workspaces",label:o("shell.mobileWorkspacesEntry"),icon:n.jsx(oI,{}),onClick:u},{key:"sessions",label:o("shell.mobileSessionsEntry"),icon:n.jsx(lI,{}),onClick:d},{key:"terminals",label:o("shell.mobileTerminalsEntry"),icon:n.jsx(cI,{}),onClick:c},{key:"tools",label:o("shell.mobileToolsEntry"),icon:n.jsx(uI,{}),onClick:m},{key:"settings",label:o("shell.mobileSettingsEntry"),icon:n.jsx(dI,{}),onClick:w}],Y=q?{"--mobile-conversation-tabbar-progress":E.progress.toFixed(4)}:void 0;gb(T,P,q);function z(){const O=mb(C.pathname,C.search);if(!O){m();return}j(O,{replace:!0})}const K=n.jsx("nav",{ref:P,className:"ios-workbench-tabbar","aria-label":o("shell.title"),children:_.map(O=>n.jsxs("button",{type:"button",className:"ios-workbench-tabbar-item","data-active":O.key===e,"aria-current":O.key===e?"page":void 0,onClick:()=>{O.key!==e&&x.trigger("selection"),O.onClick()},children:[n.jsx("span",{className:"ios-workbench-tabbar-icon","aria-hidden":"true",children:O.icon}),n.jsx("span",{className:"ios-workbench-tabbar-label",children:O.label})]},O.key))});return n.jsx(fb,{composerPortalTarget:q?I:null,children:n.jsxs("div",{ref:T,className:"ios-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":A,"data-tabbar-open":q?E.isOpen:!0,"data-conversation-tabbar-state":q?E.state:"default",style:Y,children:[H?n.jsxs("header",{className:"ios-workbench-nav","data-header-kind":"tools",children:[n.jsx("div",{className:"ios-workbench-nav-leading",children:H.showBackButton?n.jsxs("button",{type:"button",className:"ios-workbench-back-button","aria-label":o("common.back"),onClick:z,children:[n.jsx(sI,{}),n.jsx("span",{children:o("common.back")})]}):null}),n.jsx("div",{className:"ios-workbench-nav-copy",children:n.jsx("h1",{children:H.title})}),n.jsx("div",{className:"ios-workbench-nav-actions",children:H.showMoreButton?n.jsx("button",{type:"button",className:"ios-workbench-icon-button","aria-label":H.moreButtonLabel,onClick:g,children:n.jsx(aI,{})}):null})]}):null,n.jsx("div",{className:"ios-workbench-content",children:n.jsx(vb,{viewportClass:y.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:B,navigationPanel:i,auxiliaryPanel:a,children:r})}),q?n.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[n.jsx("div",{ref:Z,className:"mobile-conversation-bottom-layer-composer-slot"}),n.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:K})]}):K]})})}function sI(){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 aI(){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 oI(){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 lI(){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 cI(){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 uI(){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 dI(){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 hI(e){const t=cr();return t.platform==="ios"?n.jsx(iI,{...e}):t.platform==="android"?n.jsx(VE,{...e}):n.jsx(mI,{...e})}function mI({activeEntry:e,presentation:t="default",children:r,navigationPanel:i,auxiliaryPanel:a,onNavigateWorkspaces:u,onNavigateTerminals:c,onNavigateSessions:d,onNavigateTools:m,onNavigateToolFiles:f,onNavigateToolGit:v,onNavigateToolProcesses:g,onNavigateSettings:w}){const y=cr(),x=ts(),C=es(),j=dr(),T=p.useRef(null),P=p.useRef(null),[I,Z]=p.useState(null),q=rI(y.platform==="web"),B=y.platform==="web"&&q.keyboardOpen,E=t==="conversation-focus",A=Vh({isNativeMobile:y.isNativeMobile,viewportClass:y.viewportClass}),H=bb({enabled:E,rootRef:T,suspended:B,resetKey:`${C.pathname}${C.search}`}),_=hu({viewportClass:y.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:A}),Y=pb({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:o("shell.iosMoreAction")}),z=[{key:"workspaces",label:o("shell.mobileWorkspacesEntry"),icon:n.jsx(gI,{}),onClick:u},{key:"sessions",label:o("shell.mobileSessionsEntry"),icon:n.jsx(bI,{}),onClick:d},{key:"terminals",label:o("shell.mobileTerminalsEntry"),icon:n.jsx(vI,{}),onClick:c},{key:"tools",label:o("shell.mobileToolsEntry"),icon:n.jsx(wI,{}),onClick:m},{key:"settings",label:o("shell.mobileSettingsEntry"),icon:n.jsx(yI,{}),onClick:w}],K=E?{"--mobile-conversation-tabbar-progress":H.progress.toFixed(4)}:void 0;gb(T,P,E);function O(){const te=mb(C.pathname,C.search);if(!te){m();return}j(te,{replace:!0})}const F=n.jsx("nav",{ref:P,className:"mobile-workbench-tabbar","aria-label":o("shell.title"),hidden:B,children:z.map(te=>n.jsxs("button",{type:"button",className:"mobile-workbench-tabbar-item","data-active":te.key===e,"aria-current":te.key===e?"page":void 0,onClick:()=>{te.key!==e&&x.trigger("selection"),te.onClick()},children:[n.jsx("span",{className:"mobile-workbench-tabbar-icon","aria-hidden":"true",children:te.icon}),n.jsx("span",{className:"mobile-workbench-tabbar-label",children:te.label})]},te.key))});return n.jsx(fb,{composerPortalTarget:E?I:null,children:n.jsxs("div",{ref:T,className:"mobile-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-mobile-runtime":y.platform,"data-mobile-keyboard-open":B,"data-pane-layout":_,"data-tabbar-open":B?!1:E?H.isOpen:!0,"data-conversation-tabbar-state":E?H.state:"default",style:K,children:[Y?n.jsxs("header",{className:"mobile-workbench-header","data-header-kind":"tools",children:[n.jsxs("div",{className:"mobile-workbench-header-leading",children:[Y.showBackButton?n.jsx("button",{type:"button",className:"mobile-workbench-header-button","aria-label":o("common.back"),onClick:O,children:n.jsx(pI,{})}):null,n.jsx("div",{className:"mobile-workbench-header-copy",children:n.jsx("h1",{children:Y.title})})]}),n.jsx("div",{className:"mobile-workbench-header-actions",children:Y.showMoreButton?n.jsx("button",{type:"button",className:"mobile-workbench-header-button mobile-tools-more-button","aria-label":Y.moreButtonLabel,onClick:g,children:n.jsx(fI,{})}):null})]}):null,n.jsx("div",{className:"mobile-workbench-content",children:n.jsx(vb,{viewportClass:y.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:A,navigationPanel:i,auxiliaryPanel:a,children:r})}),E?n.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[n.jsx("div",{ref:Z,className:"mobile-conversation-bottom-layer-composer-slot"}),n.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:F})]}):F]})})}function pI(){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 fI(){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 gI(){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 bI(){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 vI(){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 wI(){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 yI(){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 LN{constructor(t){it(this,"maxAttempts");it(this,"baseDelayMs");it(this,"reconnectAttempts",0);it(this,"reconnectTimer",null);it(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(!Dr.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 FN{constructor(t){it(this,"socket",null);it(this,"disposed",!1);it(this,"authRecoveryInFlight",!1);it(this,"pendingRefresh",!1);it(this,"fileTreeSubscription",null);it(this,"gitWorkspaceId",null);it(this,"terminalManagerWorkspaceId",null);it(this,"workspaceManagementWorkspaceId",null);it(this,"pendingFileTreeRefresh",null);it(this,"pendingGitRefreshWorkspaceId",null);it(this,"pendingTerminalManagerRefreshWorkspaceId",null);it(this,"pendingWorkspaceManagementRefreshWorkspaceId",null);it(this,"fileTreeListeners",new Set);it(this,"gitListeners",new Set);it(this,"terminalManagerListeners",new Set);it(this,"workspaceManagementListeners",new Set);it(this,"connectionManager");this.options=t,this.connectionManager=new LN({onReconnect:r=>{this.connect(r)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}requestRefresh(){const t=this.socket;if(!yk(t)){this.pendingRefresh=!0;return}t.send(JSON.stringify({type:"workbench.refresh"})),this.pendingRefresh=!1}subscribeFileTree(t,r){this.fileTreeSubscription={workspaceId:t,paths:kk(r)},this.sendWhenReady({type:"fileTree.subscribe",workspaceId:t,paths:this.fileTreeSubscription.paths})}requestFileTreeRefresh(t,r){const i=kk(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 u;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const r=(u=rr.getState().session)==null?void 0:u.accessToken;if(!r){this.options.onUnauthorized();return}const i=`${Rj("/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",c=>{var m,f,v,g,w,y,x,C;const d=JSON.parse(c.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=(v=this.options).onGitSnapshot)==null||g.call(v,d.snapshot),this.gitListeners.forEach(j=>j(d.snapshot));return}if(d.type==="terminalManager.snapshot"){(y=(w=this.options).onTerminalManagerSnapshot)==null||y.call(w,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"&&kI(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(),rr.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 yk(r)?(r.send(JSON.stringify(t)),!0):!1}}function yk(e){const t=typeof WebSocket.OPEN=="number"?WebSocket.OPEN:1;return e!==null&&e.readyState===t}function kI(e){return typeof e!="object"||e===null?!1:Array.isArray(e.items)}function kk(e){const t=new Set;for(const r of e??[""])t.add(r.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,""));return[...t]}function Pr(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 Aa(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 oo,$i,il,bd,eh;const xi="__TAURI_TO_IPC_KEY__";function _N(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class ON{constructor(t){oo.set(this,void 0),$i.set(this,0),il.set(this,[]),bd.set(this,void 0),Aa(this,oo,t||(()=>{})),this.id=_N(r=>{const i=r.index;if("end"in r){i==Pr(this,$i,"f")?this.cleanupCallback():Aa(this,bd,i);return}const a=r.message;if(i==Pr(this,$i,"f")){for(Pr(this,oo,"f").call(this,a),Aa(this,$i,Pr(this,$i,"f")+1);Pr(this,$i,"f")in Pr(this,il,"f");){const u=Pr(this,il,"f")[Pr(this,$i,"f")];Pr(this,oo,"f").call(this,u),delete Pr(this,il,"f")[Pr(this,$i,"f")],Aa(this,$i,Pr(this,$i,"f")+1)}Pr(this,$i,"f")===Pr(this,bd,"f")&&this.cleanupCallback()}else Pr(this,il,"f")[i]=a})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){Aa(this,oo,t)}get onmessage(){return Pr(this,oo,"f")}[(oo=new WeakMap,$i=new WeakMap,il=new WeakMap,bd=new WeakMap,xi)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[xi]()}}async function Ae(e,t={},r){return window.__TAURI_INTERNALS__.invoke(e,t,r)}class BN{get rid(){return Pr(this,eh,"f")}constructor(t){eh.set(this,void 0),Aa(this,eh,t)}async close(){return Ae("plugin:resources|close",{rid:this.rid})}}eh=new WeakMap;class Rc extends BN{constructor(t){super(t)}static async new(t,r,i){return Ae("plugin:image|new",{rgba:Ds(t),width:r,height:i}).then(a=>new Rc(a))}static async fromBytes(t){return Ae("plugin:image|from_bytes",{bytes:Ds(t)}).then(r=>new Rc(r))}static async fromPath(t){return Ae("plugin:image|from_path",{path:t}).then(r=>new Rc(r))}async rgba(){return Ae("plugin:image|rgba",{rid:this.rid}).then(t=>new Uint8Array(t))}async size(){return Ae("plugin:image|size",{rid:this.rid})}}function Ds(e){return e==null?null:typeof e=="string"?e:e instanceof Rc?e.rid:e}var th,nh;function WN(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:WN(r));else if("action"in e&&e.action){const r=new ON;return r.onmessage=e.action,delete e.action,{...e,handler:r}}return e}async function Rl(e,t){const r=new ON;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=Ds(t.item.About.icon)),"icon"in t&&t.icon&&(t.icon=Ds(t.icon)),"items"in t&&t.items)){let i=function(a){var u;return"rid"in a?[a.rid,a.kind]:("item"in a&&typeof a.item=="object"&&(!((u=a.item.About)===null||u===void 0)&&u.icon)&&(a.item.About.icon=Ds(a.item.About.icon)),"icon"in a&&a.icon&&(a.icon=Ds(a.icon)),"items"in a&&a.items&&(a.items=a.items.map(i)),WN(a))};t.items=t.items.map(i)}return Ae("plugin:menu|new",{kind:e,options:t,handler:r})}class Ml extends BN{get id(){return Pr(this,th,"f")}get kind(){return Pr(this,nh,"f")}constructor(t,r,i){super(t),th.set(this,void 0),nh.set(this,void 0),Aa(this,th,r),Aa(this,nh,i)}}th=new WeakMap,nh=new WeakMap;class wb extends Ml{constructor(t,r){super(t,r,"MenuItem")}static async new(t){return Rl("MenuItem",t).then(([r,i])=>new wb(r,i))}async text(){return Ae("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Ae("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return Ae("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return Ae("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return Ae("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}}class yb extends Ml{constructor(t,r){super(t,r,"Check")}static async new(t){return Rl("Check",t).then(([r,i])=>new yb(r,i))}async text(){return Ae("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Ae("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return Ae("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return Ae("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return Ae("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async isChecked(){return Ae("plugin:menu|is_checked",{rid:this.rid})}async setChecked(t){return Ae("plugin:menu|set_checked",{rid:this.rid,checked:t})}}var xk;(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"})(xk||(xk={}));class kb extends Ml{constructor(t,r){super(t,r,"Icon")}static async new(t){return Rl("Icon",t).then(([r,i])=>new kb(r,i))}async text(){return Ae("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Ae("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return Ae("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return Ae("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return Ae("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async setIcon(t){return Ae("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:Ds(t)})}}class xb extends Ml{constructor(t,r){super(t,r,"Predefined")}static async new(t){return Rl("Predefined",t).then(([r,i])=>new xb(r,i))}async text(){return Ae("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Ae("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}}class Sb{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 Ba(this.width*t,this.height*t)}[xi](){return{width:this.width,height:this.height}}toJSON(){return this[xi]()}}class Ba{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 Sb(this.width/t,this.height/t)}[xi](){return{width:this.width,height:this.height}}toJSON(){return this[xi]()}}class sl{constructor(t){this.size=t}toLogical(t){return this.size instanceof Sb?this.size:this.size.toLogical(t)}toPhysical(t){return this.size instanceof Ba?this.size:this.size.toPhysical(t)}[xi](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[xi]()}}class Cb{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 Yi(this.x*t,this.y*t)}[xi](){return{x:this.x,y:this.y}}toJSON(){return this[xi]()}}class Yi{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 Cb(this.x/t,this.y/t)}[xi](){return{x:this.x,y:this.y}}toJSON(){return this[xi]()}}class Ia{constructor(t){this.position=t}toLogical(t){return this.position instanceof Cb?this.position:this.position.toLogical(t)}toPhysical(t){return this.position instanceof Yi?this.position:this.position.toPhysical(t)}[xi](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[xi]()}}function wl([e,t,r]){switch(r){case"Submenu":return new jb(e,t);case"Predefined":return new xb(e,t);case"Check":return new yb(e,t);case"Icon":return new kb(e,t);case"MenuItem":default:return new wb(e,t)}}class jb extends Ml{constructor(t,r){super(t,r,"Submenu")}static async new(t){return Rl("Submenu",t).then(([r,i])=>new jb(r,i))}async text(){return Ae("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return Ae("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return Ae("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return Ae("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async append(t){return Ae("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 Ae("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 Ae("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 Ae("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return Ae("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(wl)}async items(){return Ae("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(wl))}async get(t){return Ae("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(r=>r?wl(r):null)}async popup(t,r){var i;return Ae("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 Ia?t:t?new Ia(t):null})}async setAsWindowsMenuForNSApp(){return Ae("plugin:menu|set_as_windows_menu_for_nsapp",{rid:this.rid})}async setAsHelpMenuForNSApp(){return Ae("plugin:menu|set_as_help_menu_for_nsapp",{rid:this.rid})}async setIcon(t){return Ae("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:Ds(t)})}}class gl extends Ml{constructor(t,r){super(t,r,"Menu")}static async new(t){return Rl("Menu",t).then(([r,i])=>new gl(r,i))}static async default(){return Ae("plugin:menu|create_default").then(([t,r])=>new gl(t,r))}async append(t){return Ae("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 Ae("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 Ae("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 Ae("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return Ae("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(wl)}async items(){return Ae("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(wl))}async get(t){return Ae("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(r=>r?wl(r):null)}async popup(t,r){var i;return Ae("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 Ia?t:t?new Ia(t):null})}async setAsAppMenu(){return Ae("plugin:menu|set_as_app_menu",{rid:this.rid}).then(t=>t?new gl(t[0],t[1]):null)}async setAsWindowMenu(t){var r;return Ae("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 gl(i[0],i[1]):null)}}var vi;(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"})(vi||(vi={}));async function UN(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await Ae("plugin:event|unlisten",{event:e,eventId:t})}async function Nb(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 Ae("plugin:event|listen",{event:e,target:a,handler:_N(t)}).then(u=>async()=>UN(e,u))}async function HN(e,t,r){return Nb(e,i=>{UN(e,i.id),t(i)},r)}async function zN(e,t){await Ae("plugin:event|emit",{event:e,payload:t})}async function qN(e,t,r){await Ae("plugin:event|emit_to",{target:typeof e=="string"?{kind:"AnyLabel",label:e}:e,event:t,payload:r})}const xI=Object.freeze(Object.defineProperty({__proto__:null,get TauriEvent(){return vi},emit:zN,emitTo:qN,listen:Nb,once:HN},Symbol.toStringTag,{value:"Module"}));var jh;(function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"})(jh||(jh={}));class $N{constructor(t){this._preventDefault=!1,this.event=t.event,this.id=t.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var gg;(function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"})(gg||(gg={}));function Gh(){return new Tb(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function rh(){return Ae("plugin:window|get_all_windows").then(e=>e.map(t=>new Tb(t,{skip:!0})))}const qp=["tauri://created","tauri://error"];class Tb{constructor(t,r={}){var i;this.label=t,this.listeners=Object.create(null),r!=null&&r.skip||Ae("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 rh()).find(i=>i.label===t))!==null&&r!==void 0?r:null}static getCurrent(){return Gh()}static async getAll(){return rh()}static async getFocusedWindow(){for(const t of await rh())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)}:Nb(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)}:HN(t,r,{target:{kind:"Window",label:this.label}})}async emit(t,r){if(qp.includes(t)){for(const i of this.listeners[t]||[])i({event:t,id:-1,payload:r});return}return zN(t,r)}async emitTo(t,r,i){if(qp.includes(r)){for(const a of this.listeners[r]||[])a({event:r,id:-1,payload:i});return}return qN(t,r,i)}_handleTauriEvent(t,r){return qp.includes(t)?(t in this.listeners?this.listeners[t].push(r):this.listeners[t]=[r],!0):!1}async scaleFactor(){return Ae("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return Ae("plugin:window|inner_position",{label:this.label}).then(t=>new Yi(t))}async outerPosition(){return Ae("plugin:window|outer_position",{label:this.label}).then(t=>new Yi(t))}async innerSize(){return Ae("plugin:window|inner_size",{label:this.label}).then(t=>new Ba(t))}async outerSize(){return Ae("plugin:window|outer_size",{label:this.label}).then(t=>new Ba(t))}async isFullscreen(){return Ae("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return Ae("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return Ae("plugin:window|is_maximized",{label:this.label})}async isFocused(){return Ae("plugin:window|is_focused",{label:this.label})}async isDecorated(){return Ae("plugin:window|is_decorated",{label:this.label})}async isResizable(){return Ae("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return Ae("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return Ae("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return Ae("plugin:window|is_closable",{label:this.label})}async isVisible(){return Ae("plugin:window|is_visible",{label:this.label})}async title(){return Ae("plugin:window|title",{label:this.label})}async theme(){return Ae("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return Ae("plugin:window|is_always_on_top",{label:this.label})}async center(){return Ae("plugin:window|center",{label:this.label})}async requestUserAttention(t){let r=null;return t&&(t===jh.Critical?r={type:"Critical"}:r={type:"Informational"}),Ae("plugin:window|request_user_attention",{label:this.label,value:r})}async setResizable(t){return Ae("plugin:window|set_resizable",{label:this.label,value:t})}async setEnabled(t){return Ae("plugin:window|set_enabled",{label:this.label,value:t})}async isEnabled(){return Ae("plugin:window|is_enabled",{label:this.label})}async setMaximizable(t){return Ae("plugin:window|set_maximizable",{label:this.label,value:t})}async setMinimizable(t){return Ae("plugin:window|set_minimizable",{label:this.label,value:t})}async setClosable(t){return Ae("plugin:window|set_closable",{label:this.label,value:t})}async setTitle(t){return Ae("plugin:window|set_title",{label:this.label,value:t})}async maximize(){return Ae("plugin:window|maximize",{label:this.label})}async unmaximize(){return Ae("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return Ae("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return Ae("plugin:window|minimize",{label:this.label})}async unminimize(){return Ae("plugin:window|unminimize",{label:this.label})}async show(){return Ae("plugin:window|show",{label:this.label})}async hide(){return Ae("plugin:window|hide",{label:this.label})}async close(){return Ae("plugin:window|close",{label:this.label})}async destroy(){return Ae("plugin:window|destroy",{label:this.label})}async setDecorations(t){return Ae("plugin:window|set_decorations",{label:this.label,value:t})}async setShadow(t){return Ae("plugin:window|set_shadow",{label:this.label,value:t})}async setEffects(t){return Ae("plugin:window|set_effects",{label:this.label,value:t})}async clearEffects(){return Ae("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(t){return Ae("plugin:window|set_always_on_top",{label:this.label,value:t})}async setAlwaysOnBottom(t){return Ae("plugin:window|set_always_on_bottom",{label:this.label,value:t})}async setContentProtected(t){return Ae("plugin:window|set_content_protected",{label:this.label,value:t})}async setSize(t){return Ae("plugin:window|set_size",{label:this.label,value:t instanceof sl?t:new sl(t)})}async setMinSize(t){return Ae("plugin:window|set_min_size",{label:this.label,value:t instanceof sl?t:t?new sl(t):null})}async setMaxSize(t){return Ae("plugin:window|set_max_size",{label:this.label,value:t instanceof sl?t:t?new sl(t):null})}async setSizeConstraints(t){function r(i){return i?{Logical:i}:null}return Ae("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 Ae("plugin:window|set_position",{label:this.label,value:t instanceof Ia?t:new Ia(t)})}async setFullscreen(t){return Ae("plugin:window|set_fullscreen",{label:this.label,value:t})}async setSimpleFullscreen(t){return Ae("plugin:window|set_simple_fullscreen",{label:this.label,value:t})}async setFocus(){return Ae("plugin:window|set_focus",{label:this.label})}async setFocusable(t){return Ae("plugin:window|set_focusable",{label:this.label,value:t})}async setIcon(t){return Ae("plugin:window|set_icon",{label:this.label,value:Ds(t)})}async setSkipTaskbar(t){return Ae("plugin:window|set_skip_taskbar",{label:this.label,value:t})}async setCursorGrab(t){return Ae("plugin:window|set_cursor_grab",{label:this.label,value:t})}async setCursorVisible(t){return Ae("plugin:window|set_cursor_visible",{label:this.label,value:t})}async setCursorIcon(t){return Ae("plugin:window|set_cursor_icon",{label:this.label,value:t})}async setBackgroundColor(t){return Ae("plugin:window|set_background_color",{color:t})}async setCursorPosition(t){return Ae("plugin:window|set_cursor_position",{label:this.label,value:t instanceof Ia?t:new Ia(t)})}async setIgnoreCursorEvents(t){return Ae("plugin:window|set_ignore_cursor_events",{label:this.label,value:t})}async startDragging(){return Ae("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(t){return Ae("plugin:window|start_resize_dragging",{label:this.label,value:t})}async setBadgeCount(t){return Ae("plugin:window|set_badge_count",{label:this.label,value:t})}async setBadgeLabel(t){return Ae("plugin:window|set_badge_label",{label:this.label,value:t})}async setOverlayIcon(t){return Ae("plugin:window|set_overlay_icon",{label:this.label,value:t?Ds(t):void 0})}async setProgressBar(t){return Ae("plugin:window|set_progress_bar",{label:this.label,value:t})}async setVisibleOnAllWorkspaces(t){return Ae("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:t})}async setTitleBarStyle(t){return Ae("plugin:window|set_title_bar_style",{label:this.label,value:t})}async setTheme(t){return Ae("plugin:window|set_theme",{label:this.label,value:t})}async onResized(t){return this.listen(vi.WINDOW_RESIZED,r=>{r.payload=new Ba(r.payload),t(r)})}async onMoved(t){return this.listen(vi.WINDOW_MOVED,r=>{r.payload=new Yi(r.payload),t(r)})}async onCloseRequested(t){return this.listen(vi.WINDOW_CLOSE_REQUESTED,async r=>{const i=new $N(r);await t(i),i.isPreventDefault()||await this.destroy()})}async onDragDropEvent(t){const r=await this.listen(vi.DRAG_ENTER,c=>{t({...c,payload:{type:"enter",paths:c.payload.paths,position:new Yi(c.payload.position)}})}),i=await this.listen(vi.DRAG_OVER,c=>{t({...c,payload:{type:"over",position:new Yi(c.payload.position)}})}),a=await this.listen(vi.DRAG_DROP,c=>{t({...c,payload:{type:"drop",paths:c.payload.paths,position:new Yi(c.payload.position)}})}),u=await this.listen(vi.DRAG_LEAVE,c=>{t({...c,payload:{type:"leave"}})});return()=>{r(),a(),i(),u()}}async onFocusChanged(t){const r=await this.listen(vi.WINDOW_FOCUS,a=>{t({...a,payload:!0})}),i=await this.listen(vi.WINDOW_BLUR,a=>{t({...a,payload:!1})});return()=>{r(),i()}}async onScaleChanged(t){return this.listen(vi.WINDOW_SCALE_FACTOR_CHANGED,t)}async onThemeChanged(t){return this.listen(vi.WINDOW_THEME_CHANGED,t)}}var Sk;(function(e){e.Disabled="disabled",e.Throttle="throttle",e.Suspend="suspend"})(Sk||(Sk={}));var Ck;(function(e){e.Default="default",e.FluentOverlay="fluentOverlay"})(Ck||(Ck={}));var bg;(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"})(bg||(bg={}));var vg;(function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"})(vg||(vg={}));function Kh(e){return e===null?null:{name:e.name,scaleFactor:e.scaleFactor,position:new Yi(e.position),size:new Ba(e.size),workArea:{position:new Yi(e.workArea.position),size:new Ba(e.workArea.size)}}}async function SI(){return Ae("plugin:window|current_monitor").then(Kh)}async function CI(){return Ae("plugin:window|primary_monitor").then(Kh)}async function jI(e,t){return Ae("plugin:window|monitor_from_point",{x:e,y:t}).then(Kh)}async function NI(){return Ae("plugin:window|available_monitors").then(e=>e.map(Kh))}async function TI(){return Ae("plugin:window|cursor_position").then(e=>new Yi(e))}const PI=Object.freeze(Object.defineProperty({__proto__:null,CloseRequestedEvent:$N,get Effect(){return bg},get EffectState(){return vg},LogicalPosition:Cb,LogicalSize:Sb,PhysicalPosition:Yi,PhysicalSize:Ba,get ProgressBarStatus(){return gg},get UserAttentionType(){return jh},Window:Tb,availableMonitors:NI,currentMonitor:SI,cursorPosition:TI,getAllWindows:rh,getCurrentWindow:Gh,monitorFromPoint:jI,primaryMonitor:CI},Symbol.toStringTag,{value:"Module"}));async function VN(e){if(e.length===0)return;await(await gl.new({items:e.map(r=>({id:r.id,text:r.label,enabled:!r.disabled,accelerator:r.accelerator,action:()=>{r.onSelect()}}))})).popup(void 0,Gh())}const DI=["button","a","input","textarea","select","summary","[role='button']","[role='link']","[role='tab']","[role='menuitem']","[contenteditable='true']","[data-window-drag='ignore']"].join(", ");function Pb(e){return e instanceof HTMLElement?!e.closest(DI):!0}async function Db(){typeof window>"u"||typeof window.__TAURI_INTERNALS__>"u"||await Gh().startDragging()}const Nh=.78,RI=1;function MI(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function GN(e,t,r,i){const a=Math.hypot(r-e,i-t),u=Math.min(1,a/120);return Nh+(RI-Nh)*u}function La(e){return Math.round(Number.isFinite(e)?e:0)}function AI(e){if(!MI())return null;const t=La(e.x),r=La(e.y);let i=!1,a=Promise.resolve();const u=(d,m)=>(a=a.then(async()=>{await window.__TAURI_INTERNALS__.invoke(d,m)}).catch(()=>{}),a),c=async()=>{i||(i=!0,await u("close_detach_preview"))};return u("show_detach_preview",{title:e.title,x:t,y:r,scale:Nh}),{updatePosition(d,m){if(i)return;const f=La(d),v=La(m);u("update_detach_preview_position",{x:f,y:v,scale:GN(t,r,f,v)})},complete(){return c()},cancel(){return c()}}}function EI(e){if(typeof document>"u")return null;const t=La(e.x),r=La(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",Nh.toFixed(3));const a=document.createElement("div");a.className="desktop-window-detach-animation-bar";const u=document.createElement("strong");u.className="desktop-window-detach-animation-title",u.textContent=e.title;const c=document.createElement("div");c.className="desktop-window-detach-animation-body",a.append(u),i.append(a,c),document.body.append(i);let d=!1;const m=()=>{d||(d=!0,i.remove())};return{updatePosition(f,v){if(d)return;const g=La(f),w=La(v),y=GN(t,r,g,w);i.style.left=`${g}px`,i.style.top=`${w}px`,i.style.setProperty("--detach-preview-scale",y.toFixed(3))},async complete(){m()},async cancel(){m()}}}function jk(e){return AI(e)??EI(e)}const II={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 LI(e){return{...e,bounds:{...e.bounds}}}function FI(e,t,r){t&&(e.windows.registerDescriptor(t),r?e.windows.markWindowOpen(t.windowId):e.windows.markWindowClosed(t.windowId))}function _I(e){return II[e]}function OI(e,t){return`${e}-${t}`}async function Rb(e,t,r){const i=r.workspaceId.trim(),a=_I(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 u=OI(t,i),c=e.windows.getDescriptor(u),d=c?LI(c):null,m=e.windows.isWindowOpen(u),f=f1({windowId:u,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 v=await e.bridge.createWindow(f);return v.ok?(e.windows.markWindowOpen(u),{ok:!0,value:f}):(d?FI(e,d,m):e.windows.removeWindow(u),{ok:!1,errorCode:v.errorCode,detail:v.detail})}function BI(e,t){return Rb(e,"files",t)}function WI(e,t){return Rb(e,"git",t)}function UI(e,t){return Rb(e,"processes",t)}const ih="codingns.file-panel.show-system-files",Mb="codingns.notification.preferences",al={notifyOnPermissionRequest:!0,notifyOnSessionCompleted:!0,notifyOnSessionFailed:!0};function Yh(){return typeof window<"u"&&typeof window.localStorage<"u"}function Nk(){return Yh()?window.localStorage.getItem(ih)==="1":!1}function $p(e){return typeof e=="boolean"}function Tk(){if(!Yh())return al;const e=window.localStorage.getItem(Mb);if(!e)return al;try{const t=JSON.parse(e);return{notifyOnPermissionRequest:$p(t.notifyOnPermissionRequest)?t.notifyOnPermissionRequest:al.notifyOnPermissionRequest,notifyOnSessionCompleted:$p(t.notifyOnSessionCompleted)?t.notifyOnSessionCompleted:al.notifyOnSessionCompleted,notifyOnSessionFailed:$p(t.notifyOnSessionFailed)?t.notifyOnSessionFailed:al.notifyOnSessionFailed}}catch{return al}}function Pk(e,t){return e.notifyOnPermissionRequest===t.notifyOnPermissionRequest&&e.notifyOnSessionCompleted===t.notifyOnSessionCompleted&&e.notifyOnSessionFailed===t.notifyOnSessionFailed}function HI(e){Yh()&&window.localStorage.setItem(Mb,JSON.stringify(e))}class zI{constructor(){it(this,"state",{showSystemFiles:Nk(),notificationPreferences:Tk()});it(this,"listeners",new Set);it(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));it(this,"getState",()=>this.state);it(this,"handleStorage",t=>{if(t.key!==null&&t.key!==ih&&t.key!==Mb)return;const r=Nk(),i=Tk(),a=this.state.showSystemFiles===r,u=Pk(this.state.notificationPreferences,i);a&&u||(this.state={showSystemFiles:r,notificationPreferences:i},this.emit())});typeof window<"u"&&window.addEventListener("storage",this.handleStorage)}setShowSystemFiles(t){Yh()&&(t?window.localStorage.setItem(ih,"1"):window.localStorage.removeItem(ih)),this.state.showSystemFiles!==t&&(this.state={...this.state,showSystemFiles:t},this.emit())}setNotificationPreferences(t){const r={...this.state.notificationPreferences,...t};Pk(this.state.notificationPreferences,r)||(HI(r),this.state={...this.state,notificationPreferences:r},this.emit())}emit(){for(const t of this.listeners)t()}}const bl=new zI;function Zs(e){return p.useSyncExternalStore(bl.subscribe,()=>e(bl.getState()))}const Sc=new Map;function KN(){return typeof window<"u"&&typeof window.sessionStorage<"u"}function Dk(e,t){return!Number.isFinite(e)||Date.now()-e>t}function Rr(e,t){const r=Sc.get(e);if(r&&!Dk(r.savedAt,t))return r.value;if(!KN())return null;const i=window.sessionStorage.getItem(e);if(!i)return null;try{const a=JSON.parse(i);return!a||Dk(a.savedAt,t)?(window.sessionStorage.removeItem(e),Sc.delete(e),null):(Sc.set(e,a),a.value)}catch{return window.sessionStorage.removeItem(e),Sc.delete(e),null}}function Zr(e,t){const r={savedAt:Date.now(),value:t};if(Sc.set(e,r),!!KN())try{window.sessionStorage.setItem(e,JSON.stringify(r))}catch{}}const qI="codingns.debug.perf";function $I(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(qI)==="1"}catch{return!1}}function tn(e,t){if(!$I()||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 VI(){return Ue.request("/api/workspaces")}async function YN(){try{return await Ue.request("/api/workbench")}catch(e){if(!(e instanceof ei)||e.status!==404)throw e;const t=await VI();return{items:await Promise.all(t.items.map(async i=>({workspace:i,sessions:(await eL(i.id)).items})))}}}function GI(e){return Ue.request("/api/workspaces/import",{method:"POST",body:JSON.stringify(e)})}function KI(e){return Ue.request("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})}function XN(e){return Ue.request(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})}function YI(e){return Ue.request("/api/debug-targets/analyze",{method:"POST",body:JSON.stringify(e)})}function XI(e,t=5){const r=new URLSearchParams;return r.set("limit",String(t)),Ue.request(`/api/debug-targets/${encodeURIComponent(e)}/runtimes?${r.toString()}`)}function QI(){return Ue.request("/api/framework-compatibility-matrix")}function JI(e){return Ue.request("/api/workspaces/reorder",{method:"PUT",body:JSON.stringify(e)})}function QN(e,t){return Ue.request(`/api/workspaces/${encodeURIComponent(e)}/navigation-state`,{method:"PUT",body:JSON.stringify(t)})}function JN(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 ZI(e){return Ue.request("/api/workspaces/directories",{method:"POST",body:JSON.stringify(e)})}function eL(e){return Ue.request(`/api/sessions?workspaceId=${encodeURIComponent(e)}`)}function ZN(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}`)}function tL(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/changed-files`)}function nL(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/seen`,{method:"POST"})}function eT(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/title`,{method:"PATCH",body:JSON.stringify({title:t})})}function tT(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"PATCH",body:JSON.stringify({archived:t})})}function rL(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/favorite`,{method:"PATCH",body:JSON.stringify({favorite:t})})}function iL(e){return Ue.request("/api/worktrees",{method:"POST",body:JSON.stringify(e)})}function sL(e){return Ue.request(`/api/worktrees/${encodeURIComponent(e)}/merge-preview`,{method:"POST"})}function aL(e){return Ue.request(`/api/worktrees/${encodeURIComponent(e)}/merge-into-parent`,{method:"POST"})}function oL(e,t){return Ue.request(`/api/worktrees/${encodeURIComponent(e)}/cleanup`,{method:"POST",body:JSON.stringify(t??{})})}function lL(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/capabilities`)}function nT(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests`)}function cL(){return Ue.request("/api/preferences/quick-phrases")}function uL(e){return Ue.request("/api/preferences/quick-phrases",{method:"PUT",body:JSON.stringify({items:e})})}function Al(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 Ab(e,t){const r=await Promise.allSettled(e.map(async a=>[a,await Al(a,t)])),i=[];for(const a of r){if(a.status!=="fulfilled")continue;const[u,c]=a.value;i.push([u,c])}return Object.fromEntries(i)}function Eb(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 dL(e,t){return Ue.requestBlob(`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content`)}function hL(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:JSON.stringify(t)})}function rT(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/forks`,{method:"POST",body:JSON.stringify(t)})}function iT(e){return Ue.request("/api/sessions/start-live",{method:"POST",body:JSON.stringify(e)})}function Ib(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/messages/live`,{method:"POST",body:JSON.stringify(t)})}function mL(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/queue`)}function pL(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/queue`,{method:"POST",body:JSON.stringify(t)})}function fL(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}`,{method:"DELETE"})}function gL(e,t){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}/steer`,{method:"POST"})}function wg(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/runtime`)}function bL(e){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:"POST"})}function vL(e,t,r){return Ue.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests/${encodeURIComponent(t)}/reply`,{method:"POST",body:JSON.stringify(r)})}function sT(e){return Ue.request(`/api/git/status?workspaceId=${encodeURIComponent(e)}`)}function aT(e,t,r){const i=new URLSearchParams({workspaceId:e,path:t,staged:String(r)});return Ue.request(`/api/git/diff?${i.toString()}`)}function oT(e,t){return Ue.request("/api/git/stage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function wL(e,t){return Ue.request("/api/git/unstage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function yL(e,t){return Ue.request("/api/git/discard",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function kL(e,t){return Ue.request("/api/git/commit/draft",{method:"POST",body:JSON.stringify({workspaceId:e,mode:t})})}function xL(e,t){return Ue.request("/api/git/commit",{method:"POST",body:JSON.stringify({workspaceId:e,draft:t})})}function SL(e){return Ue.request("/api/git/commit/undo",{method:"POST",body:JSON.stringify({workspaceId:e})})}function Rk(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 lT(e){return Ue.request(`/api/git/branches?workspaceId=${encodeURIComponent(e)}`)}function CL(e){return Ue.request(`/api/git/tags?workspaceId=${encodeURIComponent(e)}`)}function jL(e,t,r){return Ue.request("/api/git/branches/switch",{method:"POST",body:JSON.stringify({workspaceId:e,branchName:t,create:r})})}function Mk(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 Ak(e){return Ue.request(`/api/git/remotes?workspaceId=${encodeURIComponent(e)}`)}const NL="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==",cT="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=",TL="/assets/gemini-D4G1NbrE.png",PL="/assets/kimi-BWNNSh7e.png",DL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAABzUlEQVR4AeycQQrCQBAEF1+g6J/0o5LPCXmCnnNx0E2nNqGEPciw024VffV0PZ/fHo7BqflBCSgAxd+aAhQAE4DjbYACYAJwvA1QAEwAjrcBCgAIDBRpA2AZClAATACOtwEKgAnA8TZAATABOD7egNc8tz2ftJ+4gPQD9r5fAbDBDQXALx00XgGwGAUoACYAx9sABcAE4HgboACYABxvAxSwJHC7XFryLNP4bzYg7KBar4CKUHiugDDgar0CKkLhuQLCgKv1CqgIhecKCAOu1iugIhSeKyAMuFqvgIpQeK6AMOBq/XAC7o9H6z5fdlRAtp4PJ2BrAHSeAmADClAATACOtwEKgAnA8TZAATABON4GKAAmAMev2AD4JTuNVwAsTgEKgAnA8TZAATABON4GKAAmAMfbAAXABOB4G9ApoPe6AnoJdt5XQCfA3uvDCXhOU0ueXmBr3x9OwNoPHH2fAmBDClAATACOtwEKgAnA8TZAAX8QONAVGwDLVIACYAJwfLwByf/+2WJ32k9cQPoBe9+vANigAhQAE4DjbYACYAJw/A8NgH/pQeMVAItVgAJgAnC8DVAATACOtwEKgAnA8TZAATABON4GFALS4w8AAAD//x7wkLQAAAAGSURBVAMAKj5LkLSa6SQAAAAASUVORK5CYII=",RL=new Set(["low","medium","high","xhigh"]),ML=["claude-code","codex","opencode","gemini","kimi"],Mc=["codex","claude-code","opencode","gemini","kimi"],uT={"claude-code":{displayNameKey:"conversation.providerClaude",fullDisplayNameKey:"shell.providerClaudeCode",draftTitleKey:"conversation.draftTitleClaude",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:NL,defaultRunInputMode:"streaming_guidance",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!0,foldRulesMessagesByDefault:!1},codex:{displayNameKey:"conversation.providerCodex",draftTitleKey:"conversation.draftTitleCodex",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:cT,defaultRunInputMode:"none",reasoningLevelPersists:!0,defaultReasoningLevel:null,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!0},opencode:{displayNameKey:"conversation.providerOpenCode",draftTitleKey:"conversation.draftTitleOpenCode",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:DL,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!1},gemini:{displayNameKey:"conversation.providerGemini",draftTitleKey:"conversation.draftTitleGemini",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:TL,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:PL,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:null,supportsInterrupt:!0,supportsAttachments:!1,supportsPermissionPrompt:!1,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!0}},AL=Array.from(new Set(Object.values(uT).map(e=>e.icon)));let Ek=!1;function EL(e){return ML.includes(e)}function ra(e){return!e||!EL(e)?null:uT[e]}function IL(e){return[{id:"provider-default",name:o(e),usesProviderDefault:!0}]}function LL(e){const t=ra(e);return IL((t==null?void 0:t.defaultModelLabelKey)??"conversation.modelUseCliDefault")}function dT(e){return!!(e&&ra(e))}function FL(e){const t=ra(e);return o((t==null?void 0:t.draftTitleKey)??"conversation.draftTitleCodex")}function Zi(e,t="compact"){const r=ra(e);return r?t==="full"&&r.fullDisplayNameKey?o(r.fullDisplayNameKey):o(r.displayNameKey):(e==null?void 0:e.trim())||o("conversation.providerCodex")}function hT(e){const t=ra(e);return(t==null?void 0:t.icon)??cT}function mT(){Ek||typeof window>"u"||(Ek=!0,AL.forEach(e=>{const t=new window.Image;t.decoding="async",t.src=e,typeof t.decode=="function"&&t.decode().catch(()=>{})}))}function Fa(e){const t=ra(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:LL(e),defaultReasoningLevel:t==null?void 0:t.defaultReasoningLevel,limitations:[]}}function _L(e){return(e==null?void 0:e.provider)??"claude-code"}function OL(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=ra(t))==null?void 0:r.supportsSlashMenuByDefault)??!1}function BL(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=>RL.has(a)))??!1}))}function WL(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 pT(e){return(e==null?void 0:e.supportsRunSteering)!==void 0?e.supportsRunSteering:(e==null?void 0:e.inRunInputMode)==="streaming_guidance"}function UL(e){const t=ra(e);return(t==null?void 0:t.reasoningLevelPersists)??!1}function HL(e,t){var i;return((i=ra(t??null))==null?void 0:i.foldRulesMessagesByDefault)??!1}typeof window<"u"&&mT();function zL(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 Vp(e){return Ue.request("/api/files/ops",{method:"POST",body:JSON.stringify(e)})}function qL(e){return Ue.request("/api/files/upload",{method:"POST",body:JSON.stringify(e)})}function $L(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return Ue.request(`/api/files/download?${r.toString()}`)}function Cc(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 Ik(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return Ue.request(`/api/files/preview?${r.toString()}`)}function Lk(e,t){const r=new URLSearchParams({workspaceId:e,path:t});return Ue.request(`/api/files/preview-link?${r.toString()}`)}function mu(e){var t,r;return e.runningState==="failed"||!!((t=e.lastErrorCode)!=null&&t.trim())||!!((r=e.lastErrorDetail)!=null&&r.trim())}function Lb(e,t,r){return`${e} is-${fT(t,r)}`}function fT(e,t){t==null||t.isActive;const r=VL(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 qc(e){return e.runningState==="stale"?o("conversation.runtimeStale"):e.runningState==="unknown"?o("conversation.runtimeUnknown"):null}function gT(e,t){return t.runningState==="stale"?`${e} is-stale`:t.runningState==="unknown"?`${e} is-unknown`:null}function VL(e){return mu(e)?"error":e.runningState==="stale"?"stale":e.runningState==="unknown"?"unknown":e.activityState==="running"?GL(e)?"running_inferred":"running":e.activityState==="completed_unread"?"unread":"idle"}function GL(e){return e.activityResolutionSource==="inferred_log"||e.activitySource==="inferred"}function KL(e){return pu(e)!==null}function Ua(e){return e.isSubagent===!0&&!KL(e)}function pu(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 Fb(e){const t=pu(e);return t==="reconstructed"?o("shell.sessionForkReconstructed"):t==="message"?o("shell.sessionForkMessage"):t==="session"?o("shell.sessionForkSession"):null}function _b(e){return e.sessionKind==="annotation"?"annotation":null}function bT(e){return _b(e)==="annotation"?o("conversation.actionSessionBadge"):null}const Fk=48;function YL(e){return typeof e=="string"?e.replace(/\s+/g," ").trim():""}function Is(e,t){const r=YL(e)||t,i=r.length>Fk?r.slice(0,Fk).trimEnd():r;return{fullTitle:r,displayTitle:i}}const Gp=5,Kp=["#2563eb","#0891b2","#16a34a","#d97706","#dc2626","#64748b"];function vT(e){const t=Math.round(e.ratio*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}function wT(e,t){const r=e.reduce((d,m)=>d+m.count,0);if(r<=0)return[];const a=e.slice(0,Gp).map((d,m)=>({...d,key:d.type,ratio:d.count/r,color:Kp[m]??Kp[0]})),u=e.slice(Gp);if(u.length===0)return a;const c=u.reduce((d,m)=>d+m.count,0);return a.push({key:"other",type:t,count:c,ratio:c/r,color:Kp[Gp]}),a}function XL(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 u=t,c=a===e.length-1?1:Math.min(1,t+i.ratio);return t=c,`${i.color} ${_k(u)} ${_k(c)}`}).join(", ")})`}function yT(e){return{"--workbench-manage-chart-background":XL(e)}}function _k(e){const t=Math.round(e*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}function fu(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 Xh(e){const t=new Map;for(const r of e)t.set(r.workspace.id,fu(r.workspace)),kT(t,r.childWorktrees??[],r.workspace,r.workspace);return Object.fromEntries(t)}function Xi(e){if(e!=null&&e.backgroundColor)return{"--workspace-tone-color":e.backgroundColor}}function kT(e,t,r,i,a=i.name){var u;for(const c of t){const d=((u=c.meta.displayName)==null?void 0:u.trim())||c.workspace.name;e.set(c.workspace.id,{workspaceId:c.workspace.id,tone:"worktree",backgroundColor:c.workspace.backgroundColor??null,displayName:d,workspaceName:c.workspace.name,branchName:c.meta.branchName||null,depth:c.meta.depth,rootWorkspaceId:r.id,rootDisplayName:r.name,parentWorkspaceId:c.meta.parentWorkspaceId||i.id,parentDisplayName:a}),kT(e,c.children,r,c.workspace,d)}}function Qh(){return Ue.request("/api/butler/profile")}function QL(e){return Ue.request("/api/butler/profile/init",{method:"POST",body:JSON.stringify(e)})}function Ok(e){return Ue.request("/api/butler/profile",{method:"PATCH",body:JSON.stringify(e)})}function JL(){return Ue.request("/api/butler/control-session")}function ZL(){return Ue.request("/api/butler/control-session/reset",{method:"POST"})}function eF(e={}){return Ue.request("/api/butler/control-session/start",{method:"POST",body:JSON.stringify(e)})}function tF(e){return Ue.request("/api/butler/control-session/messages",{method:"POST",body:JSON.stringify(e)})}function nF(){return Ue.request("/api/butler/control-session/events")}function Jh(){return Ue.request("/api/butler/overview")}function rF(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 xT(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 $c(e={}){var a,u;const t=new URLSearchParams;(a=e.workspaceId)!=null&&a.trim()&&t.set("workspaceId",e.workspaceId.trim()),(u=e.projectId)!=null&&u.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 iF(e){return Ue.request("/api/butler/inbox",{method:"POST",body:JSON.stringify(e)})}function Vc(e={}){var a,u;const t=new URLSearchParams;e.status&&t.set("status",e.status),(a=e.projectId)!=null&&a.trim()&&t.set("projectId",e.projectId.trim()),(u=e.sessionId)!=null&&u.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 sF(e){return Ue.request("/api/butler/follow-up-tasks",{method:"POST",body:JSON.stringify(e)})}function ST(e){return Ue.request(`/api/butler/follow-up-tasks/${encodeURIComponent(e)}`)}function aF(e){return Ue.request(`/api/butler/follow-up-tasks/${encodeURIComponent(e)}/cancel`,{method:"POST"})}function oF(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 lF(e){return Ue.request(`/api/butler/inbox/${encodeURIComponent(e)}`,{method:"DELETE"})}function cF(){return Ue.request("/api/butler/notifications/archives")}function uF(e,t){return Ue.request(`/api/butler/notifications/archives/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify({archived:t})})}function dF(e){const t=new URLSearchParams;return t.set("sessionId",e),Ue.request(`/api/butler/session-target?${t.toString()}`)}function hF(e){const t=new URLSearchParams;return t.set("sessionId",e),Ue.request(`/api/butler/session-action-context?${t.toString()}`)}function mF(e){return Ue.request("/api/butler/actions/start-verification",{method:"POST",body:JSON.stringify(e)})}const Ob=new Map;function pF(){Ob.clear()}function CT({disabled:e=!1,workspaceId:t=null,pendingProvider:r=null,selectedProvider:i=null,providers:a=Mc,className:u,disabledReasons:c,statusHintByProvider:d,onSelect:m}){const f=ts(),v=!!t,[g,w]=p.useState(()=>Bk(a,t)),y=a.map(x=>({provider:x}));return p.useEffect(()=>{mT()},[]),p.useEffect(()=>{if(!t){w({});return}const x=Bk(a,t);w(x);const C=a.filter(T=>!x[T]);if(C.length===0)return;let j=!1;return Ab(C,t).then(T=>{gF(t,T),j||w(P=>({...P,...T}))}),()=>{j=!0}},[a,t]),n.jsx("div",{className:`session-provider-grid${u?` ${u}`:""}`,children:y.map(x=>{const C=Zi(x.provider,"full"),j=r===x.provider,T=i===x.provider,P=!!g[x.provider],I=fF(g[x.provider]??null),Z=(c==null?void 0:c[x.provider])??I,q=j?o("shell.startingSession"):Z||((d==null?void 0:d[x.provider])??(v&&!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":T?"true":"false","aria-label":C,disabled:e||!!Z,onClick:()=>{f.trigger("action"),m(x.provider)},children:[n.jsx("span",{className:"session-provider-card-icon","aria-hidden":"true",children:n.jsx("img",{src:hT(x.provider),alt:"",loading:"eager",decoding:"async"})}),n.jsxs("span",{className:"session-provider-card-copy",children:[n.jsx("strong",{children:C}),q?n.jsx("span",{className:"session-provider-card-status",children:q}):null]})]},x.provider)})})}function fF(e){return!e||e.canStartSession!==!1?null:e.limitations[0]??o("conversation.capabilityDenied")}function Bk(e,t){const r=(t==null?void 0:t.trim())??"";if(!r)return{};const i=[];for(const a of e){const u=Ob.get(jT(r,a));u&&i.push([a,u])}return Object.fromEntries(i)}function gF(e,t){const r=e.trim();if(r)for(const[i,a]of Object.entries(t))a&&Ob.set(jT(r,i),a)}function jT(e,t){return`${e}::${t}`}function bF(){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 Hn({open:e,title:t,description:r,className:i,headerActions:a,showCloseButton:u=!0,onClose:c,children:d}){return p.useEffect(()=>{if(!e)return;function m(f){f.key==="Escape"&&c()}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[c,e]),!e||typeof document>"u"?null:Xn.createPortal(n.jsxs("div",{className:"workbench-modal-layer",children:[n.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":o("common.close"),onClick:c}),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||u?n.jsxs("div",{className:"workbench-modal-header-actions",children:[a,u?n.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":o("common.close"),onClick:c,children:n.jsx(bF,{})}):null]}):null]}),n.jsx("div",{className:"workbench-modal-body",children:d})]})]}),document.body)}const vd={repositoryUrl:"",parentPath:"",directoryName:"",name:"",authMode:"none",username:"",password:"",token:""};function NT({open:e,onClose:t,onCloned:r}){const{showToast:i}=ir(),[a,u]=p.useState(!1),[c,d]=p.useState(vd),[m,f]=p.useState(!1),[v,g]=p.useState(!1),[w,y]=p.useState(null),[x,C]=p.useState(""),[j,T]=p.useState(""),[P,I]=p.useState(null),[Z,q]=p.useState([]),[B,E]=p.useState([]),A=a||v;p.useEffect(()=>{!e&&!a&&(d(vd),f(!1),y(null))},[a,e]);const H=p.useCallback(async te=>{g(!0),y(null);try{const de=await JN(te);C(de.currentPath),T(de.currentPath),I(de.parentPath),q(de.roots),E(de.items),d(W=>({...W,parentPath:de.currentPath}))}catch(de){C(""),I(null),E([]),y(de instanceof Error?de.message:o("shell.importBrowserBrowseFailed"))}finally{g(!1)}},[]);function _(){a||(f(!1),y(null),d(vd),t())}function Y(){f(!0),H(c.parentPath||void 0)}function z(){a||(f(!1),y(null))}async function K(te){te.preventDefault(),await H(j)}function O(){d(te=>({...te,parentPath:x})),f(!1),y(null)}async function F(te){te.preventDefault();const de=c.repositoryUrl.trim(),W=c.parentPath.trim();if(!de){i({title:o("shell.cloneRepoRequired"),tone:"error"});return}if(!W){i({title:o("shell.clonePathRequired"),tone:"error"});return}u(!0);try{const M=await KI({repositoryUrl:de,parentPath:W,directoryName:c.directoryName.trim()||void 0,name:c.name.trim()||void 0,auth:c.authMode==="none"?{mode:"none"}:c.authMode==="basic"?{mode:"basic",username:c.username.trim(),password:c.password}:{mode:"token",username:c.username.trim()||void 0,token:c.token}});await(r==null?void 0:r(M)),d(vd),f(!1),i({title:o("shell.cloneSuccess"),description:M.path,tone:"success"}),t()}catch(M){i({title:M instanceof Error?M.message:o("shell.cloneFailed"),tone:"error"})}finally{u(!1)}}return n.jsxs(n.Fragment,{children:[n.jsx(Hn,{open:e,title:o("shell.cloneWorkspaceTitle"),description:o("shell.cloneWorkspaceHint"),onClose:_,children:n.jsxs("form",{className:"workbench-clone-form",onSubmit:te=>void F(te),children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneRepositoryLabel")}),n.jsx("input",{type:"text",value:c.repositoryUrl,placeholder:o("shell.cloneRepositoryPlaceholder"),onChange:te=>d(de=>({...de,repositoryUrl:te.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:c.parentPath,placeholder:o("shell.cloneParentPathPlaceholder"),onChange:te=>d(de=>({...de,parentPath:te.target.value}))}),n.jsx("button",{type:"button",className:"secondary-button",disabled:a,onClick:Y,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:c.directoryName,placeholder:o("shell.cloneDirectoryNamePlaceholder"),onChange:te=>d(de=>({...de,directoryName:te.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.importNameLabel")}),n.jsx("input",{type:"text",value:c.name,placeholder:o("shell.importNamePlaceholder"),onChange:te=>d(de=>({...de,name:te.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneAuthModeLabel")}),n.jsxs("select",{value:c.authMode,onChange:te=>d(de=>({...de,authMode:te.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")})]})]}),c.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:c.username,placeholder:o("shell.cloneUsernamePlaceholder"),autoComplete:"username",onChange:te=>d(de=>({...de,username:te.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.clonePasswordLabel")}),n.jsx("input",{type:"password",value:c.password,placeholder:o("shell.clonePasswordPlaceholder"),autoComplete:"current-password",onChange:te=>d(de=>({...de,password:te.target.value}))})]})]}):null,c.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:c.username,placeholder:o("shell.cloneTokenUsernamePlaceholder"),onChange:te=>d(de=>({...de,username:te.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneTokenLabel")}),n.jsx("input",{type:"password",value:c.token,placeholder:o("shell.cloneTokenPlaceholder"),onChange:te=>d(de=>({...de,token:te.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:_,children:o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:a,children:o(a?"shell.cloneSubmitting":"shell.cloneSubmit")})]})]})}),n.jsxs(Hn,{open:e&&m,title:o("shell.cloneBrowserTitle"),description:o("shell.cloneBrowserDescription"),onClose:z,children:[n.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:K,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:te=>T(te.target.value)})]}),n.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:A||!P,onClick:()=>{P&&H(P)},children:o("shell.importBrowserOpenParent")}),n.jsx("button",{type:"submit",className:"secondary-button",disabled:A,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:Z.map(te=>n.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:A,onClick:()=>{H(te.path)},children:te.name},te.path))})]}),n.jsx("div",{className:"workbench-directory-browser-current-path",children:x}),w?n.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:w}):null,v?n.jsx("p",{className:"workbench-directory-browser-status status-text",children:o("common.loading")}):B.length>0?n.jsx("div",{className:"workbench-directory-browser-list",children:B.map(te=>n.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:A,onClick:()=>{H(te.path)},children:[n.jsx("span",{className:"workbench-directory-browser-item-name",children:te.name}),n.jsx("span",{className:"workbench-directory-browser-item-path",children:te.path})]},te.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:z,children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:A||!x,onClick:O,children:o("shell.cloneBrowserSubmit")})]})]})]})}const xo="butler:inbox-updated";function Wk(){typeof window>"u"||window.dispatchEvent(new Event(xo))}const Uk={projectId:"",itemType:"task",title:"",content:"",status:"pending"};function TT({active:e,preferredWorkspaceId:t,preferredSessionId:r,creationRequestId:i=0,initialDraft:a=null,compactComposer:u=!1,composerOpen:c=!0,onComposerOpenChange:d}){const{showToast:m}=ir(),[f,v]=p.useState(!1),[g,w]=p.useState(!1),[y,x]=p.useState([]),[C,j]=p.useState([]),[T,P]=p.useState(null),[I,Z]=p.useState(null),[q,B]=p.useState(Uk),E=p.useMemo(()=>zk(y,t,I),[I,t,y]);p.useEffect(()=>{e&&A()},[e,r]),p.useEffect(()=>{!e||T||B(K=>{const O=$k({projects:E,currentProjectId:K.projectId,preferredProjectId:I,preferredWorkspaceId:t});return O===K.projectId?K:{...K,projectId:O}})},[e,T,I,t,E]),p.useEffect(()=>{!e||i<=0||(H(void 0,t,a,I),d==null||d(!0))},[e,i,a,d,I,t]);async function A(){v(!0);try{const[K,O,F]=await Promise.all([rF(),$c(),r?dF(r).catch(()=>null):Promise.resolve(null)]),te=(F==null?void 0:F.target.project.id)??null;Z(te),x(K.items),j(O.items),T||H(K.items,t,i>0?a:null,te)}catch(K){m({title:o("shell.butlerInboxLoadFailed"),description:K instanceof Error?K.message:void 0,tone:"error"})}finally{v(!1)}}function H(K=y,O=t,F=a,te=I){var W,M;const de=zk(K,O,te);P(null),B({...Uk,projectId:$k({projects:de,preferredProjectId:te,preferredWorkspaceId:O}),title:((W=F==null?void 0:F.title)==null?void 0:W.trim())??"",content:((M=F==null?void 0:F.content)==null?void 0:M.trim())??""})}function _(K){P(K.id),B({projectId:K.projectId,itemType:K.itemType,title:K.title,content:K.content,status:K.status}),u&&(d==null||d(!0))}async function Y(K){K.preventDefault(),w(!0);try{T?(await oF(T,{projectId:q.projectId,itemType:q.itemType,title:q.title,content:q.content,status:q.status,priority:"medium"}),m({title:o("shell.butlerInboxUpdated"),tone:"success"})):(await iF({projectId:q.projectId,itemType:q.itemType,title:q.title,content:q.content,status:q.status,priority:"medium"}),m({title:o("shell.butlerInboxCreated"),tone:"success"})),Wk(),await A(),H(),u&&(d==null||d(!1))}catch(O){m({title:o("shell.butlerInboxSaveFailed"),description:O instanceof Error?O.message:void 0,tone:"error"})}finally{w(!1)}}async function z(K){w(!0);try{await lF(K),m({title:o("shell.butlerInboxDeleted"),tone:"success"}),Wk(),await A(),T===K&&H()}catch(O){m({title:o("shell.butlerInboxDeleteFailed"),description:O instanceof Error?O.message:void 0,tone:"error"})}finally{w(!1)}}return n.jsxs("div",{className:"workspace-inbox-modal",children:[u?null:n.jsx("section",{className:"workspace-inbox-panel",children:n.jsx(Hk,{selectableProjects:E,formState:q,saving:g,editingItemId:T,useMobilePicker:!1,onProjectChange:K=>{B(O=>({...O,projectId:K}))},onItemTypeChange:K=>{B(O=>({...O,itemType:K}))},onStatusChange:K=>{B(O=>({...O,status:K}))},onTitleChange:K=>{B(O=>({...O,title:K}))},onContentChange:K=>{B(O=>({...O,content:K}))},onCancel:()=>H(),onSubmit:Y})}),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(K=>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:K.title}),n.jsx("p",{children:K.projectName})]}),n.jsxs("div",{className:"workspace-inbox-item-badges",children:[n.jsx("span",{className:"workspace-inbox-badge",children:SF(K.status)}),n.jsx("span",{className:"workspace-inbox-badge",children:xF(K.itemType)})]})]}),n.jsx("p",{className:"workspace-inbox-item-content",children:K.content}),n.jsxs("div",{className:"workspace-inbox-item-footer",children:[n.jsx("span",{children:CF(K.updatedAt)}),n.jsxs("div",{className:"workspace-inbox-item-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:g,onClick:()=>_(K),children:o("shell.butlerInboxEditAction")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:g,onClick:()=>{z(K.id)},children:o("shell.butlerInboxDeleteAction")})]})]})]},K.id))}):null]}),u?n.jsx(Hn,{open:e&&c,title:o(T?"shell.butlerInboxEditingTitle":"shell.butlerInboxCreateTitle"),description:o("shell.butlerInboxFormDescription"),className:"workspace-inbox-modal-card workspace-inbox-composer-modal-card",onClose:()=>{d==null||d(!1),H()},children:n.jsx("div",{className:"workspace-inbox-composer-modal-body",children:n.jsx(Hk,{selectableProjects:E,formState:q,saving:g,editingItemId:T,useMobilePicker:!0,onProjectChange:K=>{B(O=>({...O,projectId:K}))},onItemTypeChange:K=>{B(O=>({...O,itemType:K}))},onStatusChange:K=>{B(O=>({...O,status:K}))},onTitleChange:K=>{B(O=>({...O,title:K}))},onContentChange:K=>{B(O=>({...O,content:K}))},onCancel:()=>{d==null||d(!1),H()},onSubmit:Y})})}):null]})}function Hk(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(Yp,{label:o("shell.butlerInboxProjectLabel"),value:e.formState.projectId,options:t,disabled:e.saving,onChange:e.onProjectChange}),n.jsx(Yp,{label:o("shell.butlerInboxTypeLabel"),value:e.formState.itemType,options:r,disabled:e.saving,onChange:e.onItemTypeChange}),n.jsx(Yp,{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 Yp({label:e,value:t,options:r,disabled:i,onChange:a}){const[u,c]=p.useState(!1),d=r.find(m=>m.value===t)??r[0]??null;return p.useEffect(()=>{if(!u)return;function m(f){f.key==="Escape"&&c(!1)}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[u]),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":u,disabled:i||r.length===0,onClick:()=>c(!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(yF,{expanded:u})})]})]}),n.jsx(vF,{open:u,title:e,options:r,selectedValue:t,onClose:()=>c(!1),onSelect:m=>{a(m),c(!1)}})]})}function vF({open:e,title:t,options:r,selectedValue:i,onClose:a,onSelect:u}){return!e||typeof document>"u"?null:Xn.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:c=>c.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(c=>{const d=c.value===i;return n.jsxs("button",{type:"button",className:"mobile-workspace-home-row workspace-inbox-picker-option",role:"option","aria-selected":d,onClick:()=>u(c.value),children:[n.jsxs("span",{className:"workspace-inbox-picker-option-copy",children:[n.jsx("strong",{children:c.label}),c.description?n.jsx("span",{children:c.description}):null]}),n.jsx("span",{className:"workspace-inbox-picker-option-indicator","aria-hidden":"true",children:d?n.jsx(kF,{}):null})]},c.value)})})]}),n.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:a,children:o("common.cancel")})]})}),document.body)}function yg({open:e,preferredWorkspaceId:t,preferredSessionId:r,creationRequestId:i=0,initialDraft:a=null,onClose:u,compactComposer:c=!1}){const[d,m]=p.useState(0),[f,v]=p.useState(!c);return p.useEffect(()=>{e||v(!c)},[c,e]),n.jsx(Hn,{open:e,title:o("shell.butlerInboxModalTitle"),description:o("shell.butlerInboxModalDescription"),className:"workspace-inbox-modal-card",showCloseButton:!c,headerActions:c?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),v(!0)},children:n.jsx(wF,{})}):void 0,onClose:u,children:n.jsx(TT,{active:e,preferredWorkspaceId:t,preferredSessionId:r,creationRequestId:Math.max(i,d),initialDraft:a,compactComposer:c,composerOpen:f,onComposerOpenChange:v})})}function zk(e,t,r){return[...e].filter(i=>i.lifecycleStatus!=="archived").sort((i,a)=>{const u=qk(i,t,r),c=qk(a,t,r);return u!==c?c-u:i.name.localeCompare(a.name,"zh-Hans-CN")})}function qk(e,t,r){return r&&e.id===r?2:t&&e.workspaceId===t?1:0}function $k({projects:e,currentProjectId:t,preferredProjectId:r,preferredWorkspaceId:i}){var u;if(t&&e.some(c=>c.id===t))return t;if(r&&e.some(c=>c.id===r))return r;const a=i?e.find(c=>c.workspaceId===i):null;return(a==null?void 0:a.id)||((u=e[0])==null?void 0:u.id)||""}function wF(){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 yF({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 kF(){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 xF(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 SF(e){switch(e){case"in_progress":return o("shell.butlerInboxStatusInProgress");case"closed":return o("shell.butlerInboxStatusClosed");case"pending":default:return o("shell.butlerInboxStatusPending")}}function CF(e){return new Date(e).toLocaleString()}function PT({open:e,onClose:t,onImported:r}){const{showToast:i}=ir(),[a,u]=p.useState(!1),[c,d]=p.useState(!1),[m,f]=p.useState(!1),[v,g]=p.useState(null),[w,y]=p.useState(""),[x,C]=p.useState(""),[j,T]=p.useState(null),[P,I]=p.useState([]),[Z,q]=p.useState([]),[B,E]=p.useState(!1),[A,H]=p.useState(""),_=a||c||m,Y=p.useCallback(async W=>{u(!0),g(null);try{const M=await JN(W);y(M.currentPath),C(M.currentPath),T(M.parentPath),I(M.roots),q(M.items)}catch(M){y(""),T(null),q([]),g(M instanceof Error?M.message:o("shell.importBrowserBrowseFailed"))}finally{u(!1)}},[]);p.useEffect(()=>{if(!e){E(!1),H(""),g(null);return}Y(w||void 0)},[Y,e]);function z(){_||(E(!1),H(""),t())}async function K(W){W.preventDefault(),await Y(x)}function O(){!w||_||(H(""),E(!0))}function F(){c||(E(!1),H(""))}async function te(W){W==null||W.preventDefault();const M=A.trim();if(!(!w||!M||_)){d(!0),g(null);try{const N=await ZI({parentPath:w,directoryName:M});i({title:o("shell.importBrowserCreateDirectorySuccess"),description:N.path,tone:"success"}),E(!1),H(""),await Y(N.path)}catch(N){const L=N instanceof Error?N.message:o("shell.importBrowserCreateDirectoryFailed");g(L),i({title:L,tone:"error"})}finally{d(!1)}}}async function de(){const W=w.trim();if(!(!W||_)){f(!0),g(null);try{const M=await GI({path:W});i({title:o("shell.importSuccess"),description:M.path,tone:"success"}),t(),Promise.resolve().then(()=>r==null?void 0:r(M)).catch(N=>{i({title:N instanceof Error?N.message:o("shell.navigationLoadFailed"),tone:"error"})})}catch(M){i({title:M instanceof Error?M.message:o("shell.importFailed"),tone:"error"})}finally{f(!1)}}}return n.jsxs(n.Fragment,{children:[n.jsxs(Hn,{open:e,title:o("shell.importBrowserTitle"),description:o("shell.importBrowserDescription"),onClose:z,children:[n.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:K,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:W=>C(W.target.value)})]}),n.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:_||!j,onClick:()=>{j&&Y(j)},children:o("shell.importBrowserOpenParent")}),n.jsx("button",{type:"submit",className:"secondary-button",disabled:_,children:o("shell.importBrowserOpenPath")}),n.jsx("button",{type:"button",className:"secondary-button",disabled:_||!w,onClick:O,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(W=>n.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:_,onClick:()=>{Y(W.path)},children:W.name},W.path))})]}),n.jsx("div",{className:"workbench-directory-browser-current-path",children:w}),v?n.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:v}):null,a?n.jsx("p",{className:"workbench-directory-browser-status status-text",children:o("common.loading")}):Z.length>0?n.jsx("div",{className:"workbench-directory-browser-list",children:Z.map(W=>n.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:_,onClick:()=>{Y(W.path)},children:[n.jsx("span",{className:"workbench-directory-browser-item-name",children:W.name}),n.jsx("span",{className:"workbench-directory-browser-item-path",children:W.path})]},W.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:_,onClick:z,children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:_||!w,onClick:()=>{de()},children:o(m?"shell.importSubmitting":"shell.importBrowserSubmit")})]})]}),n.jsx(Hn,{open:e&&B,title:o("shell.importBrowserCreateDirectoryTitle"),description:o("shell.importBrowserCreateDirectoryDescription"),onClose:F,children:n.jsxs("form",{className:"workbench-rename-form",onSubmit:W=>void te(W),children:[n.jsx("div",{className:"workbench-directory-browser-current-path",children:w}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.importBrowserCreateDirectoryLabel")}),n.jsx("input",{type:"text",value:A,placeholder:o("shell.importBrowserCreateDirectoryPlaceholder"),autoFocus:!0,onChange:W=>H(W.target.value)})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:c,onClick:F,children:o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:c||!A.trim(),children:o(c?"shell.importBrowserCreatingDirectory":"shell.importBrowserCreateDirectorySubmit")})]})]})})]})}const Vk="workbench.left.width",Gk="workbench.right.width",Kk="workbench.left.collapsed",Yk="workbench.right.collapsed",Xp="workbench.last.session.path",Qp="workbench.workspace.selected.id",jc="workbench.navigation.snapshot",Xk="workbench.notifications.seen_at",jF=280,NF=320,wd=208,Qk=520,Jk=560,TF=200,Jp=20,dc=40,yd=5,PF=3e4,DF=12,RF=1800*1e3,Zk=60*1e3,MF=4e3,ex=220,tx=18,AF="workbench:focus-composer",EF=new Set(["starting","running","reconnecting","stale","unknown"]),IF=["#34C759","#22C55E","#14B8A6","#06B6D4","#0EA5E9","#3B82F6","#6366F1","#8B5CF6","#A855F7","#D946EF","#EC4899","#F43F5E","#EF4444","#F97316","#F59E0B","#EAB308","#84CC16","#10B981"];function LF(e){return EF.has(e.runningState??"idle")||e.activityState==="running"}function FF(e){var a,u;const t=((a=e.lastErrorCode)==null?void 0:a.trim())??"",r=((u=e.lastErrorDetail)==null?void 0:u.trim())??"",i=[t,r].filter(c=>c.length>0).join(" · ");return i?i.length<=ex?i:`${i.slice(0,ex-3)}...`:null}function _F(e,t){var a,u,c,d,m,f,v,g;const r=new Map(e.projects.map(w=>[w.id,w.workspaceId])),i=[];for(const w of t){const y=((a=w.sessionTitle)==null?void 0:a.trim())||w.projectName,x=w.updatedAt||w.lastAutomationAt||w.createdAt;if(w.status==="waiting_user"){i.push({id:`follow-up-waiting:${w.id}`,kind:"follow_up_waiting_user",title:o("shell.globalNotificationFollowUpWaitingTitle",{title:y}),body:((u=w.waitingReason)==null?void 0:u.trim())||((c=w.lastAutomationSummary)==null?void 0:c.trim())||w.objective,routePath:fr(w.workspaceId,w.sessionId),workspaceId:w.workspaceId,createdAt:x});continue}if(w.status==="completed"){i.push({id:`follow-up-completed:${w.id}`,kind:"follow_up_completed",title:o("shell.globalNotificationFollowUpCompletedTitle",{title:y}),body:((d=w.lastAutomationSummary)==null?void 0:d.trim())||w.objective,routePath:fr(w.workspaceId,w.sessionId),workspaceId:w.workspaceId,createdAt:x});continue}w.status==="failed"&&i.push({id:`follow-up-failed:${w.id}`,kind:"follow_up_failed",title:o("shell.globalNotificationFollowUpFailedTitle",{title:y}),body:((m=w.lastAutomationSummary)==null?void 0:m.trim())||((f=w.waitingReason)==null?void 0:f.trim())||w.objective,routePath:fr(w.workspaceId,w.sessionId),workspaceId:w.workspaceId,createdAt:x})}for(const w of e.verifications){if(w.status!=="failed")continue;const y=w.projectId?r.get(w.projectId)??null:null,x=((v=w.targetRef)==null?void 0:v.trim())||w.verificationType;i.push({id:`verification-failed:${w.id}`,kind:"verification_failed",title:o("shell.globalNotificationVerificationFailedTitle",{title:x}),body:((g=w.summary)==null?void 0:g.trim())||o("shell.globalNotificationVerificationFailedFallback"),routePath:y?ko(y):null,workspaceId:y,createdAt:w.finishedAt||w.startedAt||w.createdAt})}return i.sort((w,y)=>{const x=nx(w.kind)-nx(y.kind);return x!==0?x:_a(y.createdAt)-_a(w.createdAt)}).slice(0,DF)}function nx(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 OF(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 _a(e){if(!e)return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function BF(e){return/^(?:[A-Za-z0-9_-]+)(?:\/[A-Za-z0-9_-]+)*$/.test(e)}function WF(e){return/^(?:[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*\/?)?$/.test(e)}function UF(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)),u=((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)),c=t.map(d=>({value:d.name})).filter(d=>!d.value||r.has(d.value)?!1:(r.add(d.value),!0));return{localBranches:a,remoteBranches:u,tags:c}}function HF(e){return e.getBoundingClientRect()}function zF(e,t){return t?_a(e.createdAt)>_a(t):!0}function qF(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 rx(e,t){var c,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=xr(m,e),v=(c=f==null?void 0:f.params.workspaceId)==null?void 0:c.trim();if(v)return v}const i=Ac(e),a=(i==null?void 0:i.sessionId)??null;return!a||!rP(a)?null:((d=new URLSearchParams(t).get("workspaceId"))==null?void 0:d.trim())||null}function $F(e){return e.startsWith("/sessions")||e.startsWith("/terminals")||e.startsWith("/tools")}function VF(e){return e==="mobile"?Ri():"/landing"}function Ac(e){var u,c,d;const t=xr("/workspaces/:workspaceId/sessions/:sessionId",e),r=(u=t==null?void 0:t.params.sessionId)==null?void 0:u.trim();if(r)return{sessionId:r,workspaceId:((c=t==null?void 0:t.params.workspaceId)==null?void 0:c.trim())??null};const i=xr("/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 GF(e){return!!(xr("/sessions",e)||xr("/workspaces/:workspaceId/sessions",e))}function ix(e){return!!Ac(e)}function KF(e){return!!(xr("/tools",e)||xr("/tools/files",e)||xr("/tools/git",e)||xr("/tools/processes",e)||xr("/workspaces/:workspaceId/tools",e)||xr("/workspaces/:workspaceId/tools/files",e)||xr("/workspaces/:workspaceId/tools/git",e)||xr("/workspaces/:workspaceId/tools/processes",e))}function sx(e){return!!(xr("/terminals",e)||xr("/workspaces/:workspaceId/terminals",e))}function YF(e){return!!xr("/workspaces/:workspaceId/butler",e)}function XF(e){return e.trim().replace(/\\/g,"/").replace(/^(?:\.\/)+/,"").replace(/^\/+/,"")}const QF=p.lazy(async()=>({default:(await jl(()=>Promise.resolve().then(()=>$$),void 0)).FileContextPanel})),JF=p.lazy(async()=>({default:(await jl(()=>Promise.resolve().then(()=>r8),void 0)).GitSidebar})),ZF=p.lazy(async()=>({default:(await jl(()=>Promise.resolve().then(()=>j8),void 0)).TerminalManagerPanel}));function e_(e){return!!((e==null?void 0:e.item)??(e==null?void 0:e.session))}function ps(e){return As(e)}function t_(e){return e&&"item"in e?e.item:(e==null?void 0:e.session)??null}function Nc(e){return Array.isArray(e==null?void 0:e.visibleSessionTree)?e.visibleSessionTree.filter(e_):[]}async function DT(e,t){const r=await Al(t,e);if(r.canStartSession===!1)throw new Error(r.limitations[0]??o("conversation.capabilityDenied"))}const RT=p.createContext(null);function El(e,t){return(t.lastMessageAt??t.updatedAt).localeCompare(e.lastMessageAt??e.updatedAt)}function kg(e){return Ua(e)}function Ms(e){return e.isArchived===!0}function Zh(e){var t;return((t=e.parentSessionId)==null?void 0:t.trim())||null}function Bb(e){return kN(e,{getId:t=>t.sessionId,getParentId:Zh,compare:El})}function MT(e){return e.filter(t=>{if(Ms(t))return!1;const r=Zh(t);if(!r)return!0;const i=e.find(a=>a.sessionId===r);return!i||!Ms(i)})}function n_(e){return e.flatMap(t=>{const r=t_(t);return r?[r,...xN(ps(t))]:[]})}function r_(e,t){const r=new Set(Ji(ps(e)).sort((i,a)=>El(i.item,a.item)).slice(0,t).map(i=>i.item.sessionId));return{...e,children:AT(ps(e),r)}}function AT(e,t){return e.flatMap(r=>{const i=AT(ps(r),t);return!t.has(r.item.sessionId)&&i.length===0?[]:[{...r,children:i}]})}function kd(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 ax(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 i_(e){const t=e.lastMessageAt??e.updatedAt;return t?new Date(t).toLocaleDateString():""}function s_(e){return mu(e)||e.syncStatus==="error"}function a_(e){var i,a;if(!s_(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"&&!mu(e)?o("conversation.syncStatusError"):o("conversation.runtimeErrorTitle"))}function o_(e,t=110){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}function em(e,t="compact"){return Zi(e,t)}const l_={position:"relative",zIndex:0},c_={zIndex:1};function ET(e,t,r,i){const a=[],u=(i==null?void 0:i.trim())||t.name;r&&a.push(u);const c=i_(e);return c&&a.push(c),a.join(" · ")||u}function ox(e,t){return Lb("session-state-indicator",e,t)}function u_(e,t){return fT(e,t)}function lx(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 cx(e,t){try{const r=window.localStorage.getItem(e);return r===null?t:r==="true"}catch{return t}}function ux(e){var t;try{const r=(t=window.localStorage.getItem(e))==null?void 0:t.trim();return r||null}catch{return null}}function lo(e,t){try{window.localStorage.setItem(e,t)}catch{}}function d_(e){try{window.localStorage.removeItem(e)}catch{}}function xd(e,t,r){return Math.max(t,Math.min(r,e))}function h_(e){return e instanceof HTMLElement?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||!!e.closest("[contenteditable='true']"):!1}function m_(){typeof window>"u"||window.dispatchEvent(new CustomEvent(AF))}function dx(e){return!e||!Array.isArray(e.items)?[]:e.items.map(t=>({workspace:t.workspace,sessions:[...t.sessions].sort(El),childWorktrees:zT(t.childWorktrees)}))}function IT(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=IT(i.children,r);if(a)return a}return null}function p_(e,t){const r=t==null?void 0:t.trim();if(!r)return null;for(const i of e){const a=IT(i.childWorktrees,r);if(a)return a}return null}function hx(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 Zp(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 LT(e,t){return e.map(r=>{const i=MT(r.sessions);return{workspace:r.workspace,meta:r.meta,visibleSessions:i,archivedSessions:r.sessions.filter(a=>Ms(a)&&!Zh(a)),visibleSessionTree:Bb(i).filter(a=>!t.has(a.item.sessionId)&&!qh(ps(a),u=>t.has(u.sessionId))),children:LT(r.children,t)}})}function xg(e){return e.flatMap(t=>[t.workspace.id,...xg(t.children)])}function Tc(e){return e.flatMap(t=>[...t.visibleSessionTree,...Tc(t.children)])}function f_(e,t){if(!t)return null;for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,visibleSessionTree:Nc(r)};const i=_T(r.childWorktrees,t);if(i)return i}return null}function FT(e,t){for(const r of e){const i=Ji(r.visibleSessionTree).find(u=>u.item.sessionId===t);if(i)return i;const a=FT(r.children,t);if(a)return a}return null}function _T(e,t){for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,visibleSessionTree:r.visibleSessionTree};const i=_T(r.children,t);if(i)return i}return null}function g_(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=OT(r.childWorktrees,t);if(i)return i}return null}function mx(e,t){if(!t)return null;for(const r of e){if(r.workspace.id===t)return r.workspace;const i=BT(r.childWorktrees,t);if(i)return i}return null}function OT(e,t){for(const r of e){if(r.workspace.id===t)return{workspace:r.workspace,archivedSessions:r.archivedSessions};const i=OT(r.children,t);if(i)return i}return null}function BT(e,t){for(const r of e){if(r.workspace.id===t)return r.workspace;const i=BT(r.children,t);if(i)return i}return null}function WT(e,t){for(const r of e){if(r.workspace.id===t)return[r.workspace.id];const i=WT(r.children,t);if(i.length>0)return[r.workspace.id,...i]}return[]}function px(e){return e.flatMap(t=>[t.workspace.id,...UT(t.childWorktrees)])}function UT(e){return e.flatMap(t=>[t.workspace.id,...UT(t.children)])}function b_(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 v_(e,t,r,i){if(t===r)return e;const a=e.findIndex(f=>f.workspace.id===t),u=e.findIndex(f=>f.workspace.id===r);if(a<0||u<0)return e;const c=[...e],[d]=c.splice(a,1);if(!d)return e;const m=c.findIndex(f=>f.workspace.id===r);return m<0?e:(c.splice(i==="before"?m:m+1,0,d),c.every((f,v)=>{var g;return f.workspace.id===((g=e[v])==null?void 0:g.workspace.id)})?e:c)}function w_(e,t){if(!Array.isArray(e.items)||t.size===0)return e;let r=!1;const i=e.items.map(a=>{let u=!1;const c=a.sessions.map(m=>{const f=t.get(m.sessionId);return f===void 0||Ms(m)===f?m:(r=!0,u=!0,{...m,isArchived:f})}),d=qT(a.childWorktrees??[],t,m=>{m&&(r=!0,u=!0)});return u?{...a,sessions:c,childWorktrees:d}:a});return r?{...e,items:i}:e}function y_(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&&Ms(i)===a&&e.delete(i.sessionId)}$T(e,r.childWorktrees??[])}}function k_(){return Rr(jc,RF)}function x_(e,t){let r=!1;const i=e.map(a=>{if(a.workspace.id!==t.workspaceId){const{nodes:d,changed:m}=VT(a.childWorktrees,t);return m?(r=!0,{...a,childWorktrees:d}):a}const u=a.sessions.findIndex(d=>d.sessionId===t.sessionId),c=u>=0?a.sessions.map((d,m)=>m===u?t:d):[t,...a.sessions];return r=!0,{...a,sessions:[...c].sort(El)}});return r?i:e}function S_(e,t,r){let i=!1;const a=e.map(u=>{let c=!1;const d=u.sessions.map(f=>f.sessionId!==t?f:(i=!0,c=!0,{...f,lastSeenAt:f.lastSeenAt&&f.lastSeenAt>r?f.lastSeenAt:r,activityState:f.activityState==="completed_unread"?"idle":f.activityState})),m=tm(u.childWorktrees,f=>f.sessionId!==t?f:(i=!0,c=!0,{...f,lastSeenAt:f.lastSeenAt&&f.lastSeenAt>r?f.lastSeenAt:r,activityState:f.activityState==="completed_unread"?"idle":f.activityState}));return c?{...u,sessions:d,childWorktrees:m}:u});return i?a:e}function fx(e,t,r){let i=!1;const a=e.map(u=>{let c=!1;const d=u.sessions.map(f=>f.sessionId!==t||f.isArchived===r?f:(i=!0,c=!0,{...f,isArchived:r})),m=tm(u.childWorktrees,f=>f.sessionId!==t||f.isArchived===r?f:(i=!0,c=!0,{...f,isArchived:r}));return c?{...u,sessions:d,childWorktrees:m}:u});return i?a:e}function gx(e,t,r){let i=!1;const a=e.map(u=>{let c=!1;const d=u.sessions.map(f=>f.sessionId!==t||f.isFavorite===!0===r?f:(i=!0,c=!0,{...f,isFavorite:r})),m=tm(u.childWorktrees,f=>f.sessionId!==t||f.isFavorite===!0===r?f:(i=!0,c=!0,{...f,isFavorite:r}));return c?{...u,sessions:d,childWorktrees:m}:u});return i?a:e}function C_(e,t){return e.includes(t)?e.filter(r=>r!==t):[...e,t]}function j_(e){return e?e.slice(0,8):"--"}function bx(e,t,r){return r?e.includes(t)?e:[...e,t]:e.includes(t)?e.filter(i=>i!==t):e}function HT(e,t){const r=e.filter(i=>t.has(i));return r.length===e.length?e:r}function zT(e){return Array.isArray(e)?e.map(t=>({...t,sessions:[...t.sessions].sort(El),children:zT(t.children)})):[]}function qT(e,t,r){return e.map(i=>{let a=!1;const u=i.sessions.map(d=>{const m=t.get(d.sessionId);return m===void 0||Ms(d)===m?d:(a=!0,{...d,isArchived:m})}),c=qT(i.children,t,d=>{d&&(a=!0)});return r(a),a?{...i,sessions:u,children:c}:i})}function $T(e,t){for(const r of t){for(const i of r.sessions){const a=e.get(i.sessionId);a!==void 0&&Ms(i)===a&&e.delete(i.sessionId)}$T(e,r.children)}}function VT(e,t){let r=!1;const i=e.map(a=>{if(a.workspace.id===t.workspaceId){const c=a.sessions.findIndex(m=>m.sessionId===t.sessionId),d=c>=0?a.sessions.map((m,f)=>f===c?t:m):[t,...a.sessions];return r=!0,{...a,sessions:[...d].sort(El)}}const u=VT(a.children,t);return u.changed?(r=!0,{...a,children:u.nodes}):a});return{nodes:r?i:[...e],changed:r}}function tm(e,t){let r=!1;const i=e.map(a=>{let u=!1;const c=a.sessions.map(m=>{const f=t(m);return f!==m&&(u=!0,r=!0),f}),d=tm(a.children,t);return d!==a.children&&(u=!0,r=!0),u?{...a,sessions:c,children:d}:a});return r?i:[...e]}function Sg(e){return`workspace-management.summary.${e}`}function GT(e){return`git-sidebar.snapshot.${e}`}function KT(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 YT(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 XT(e,t){var a,u,c;const r=((a=t.status)==null?void 0:a.snapshot.repoRoot)??e.git.repoRoot,i=((u=t.status)==null?void 0:u.snapshot.branch)??((c=t.branches)==null?void 0:c.currentBranch)??e.git.currentBranch??null;return{...e,git:{...e.git,isRepository:e.git.isRepository||!!r,repoRoot:r,currentBranch:i,error:null}}}function QT({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 N_(){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(QT,{count:2,className:"workbench-skeleton-lines compact"})]},i))})]},t))})}function Sd(){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(QT,{count:3})]},t))})}function T_({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 vx({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(T_,{side:t,collapsed:r})})}function Pc({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 P_(){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 D_(){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 R_(){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 JT(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(R_,{}),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 M_(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(Hn,{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 u=e.archivedNotificationIds.has(a.id);return n.jsxs("article",{className:"workbench-notification-item","data-archived":u,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:OF(a.kind)}),n.jsx("time",{children:qF(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:c=>{if(c.stopPropagation(),u){e.onUnarchiveNotification(a.id);return}e.onArchiveNotification(a.id)},children:o(u?"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(TT,{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 A_(){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 E_(){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 I_(){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 L_(){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 F_(){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 ZT(){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 eP(){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 tP(){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 __(){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 O_(){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 B_(){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 W_(){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 U_({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 nP({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 H_(){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 z_(){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 q_(){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 $_(){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 V_(){return n.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",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 G_({open:e,mode:t,keyword:r,codeWorkspaceId:i,codeResults:a,codeLoading:u,codeError:c,workspaceOptions:d,sessionResults:m,onClose:f,onModeChange:v,onKeywordChange:g,onCodeWorkspaceChange:w,onCodeSearch:y,onOpenSession:x}){const C=r.trim().length>0&&i.trim().length>0;return n.jsx(Hn,{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:()=>v("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:()=>v("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 T=Is(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:T.fullTitle,children:T.displayTitle}),n.jsxs("span",{className:"workbench-search-result-meta",children:[j.workspace.name," · ",em(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=>w(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||u,children:o(u?"common.loading":"shell.searchSubmit")})]}),n.jsxs("div",{className:"workbench-search-results",children:[c?n.jsx("p",{className:"status-text","data-tone":"error",children:c}):null,!c&&r.trim().length===0?n.jsx("p",{className:"workbench-search-empty",children:o("shell.searchCodeHint")}):null,!c&&r.trim().length>0&&!u&&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 K_({menuKey:e,session:t,workspace:r,workspaceContext:i,isActive:a,isFavorite:u,menuOpen:c,showWorkspaceName:d,depth:m=0,showActions:f=!0,hasSubagents:v=!1,subagentListExpanded:g=!1,selectionMode:w=!1,selected:y=!1,onToggleSelect:x,onToggleSubagents:C,onOpen:j,onRename:T,onToggleMenu:P,onToggleFavorite:I,onArchive:Z,onCloseMenu:q,onContextMenu:B}){var M;const E=kg(t)?((M=t.subagentLabel)==null?void 0:M.trim())||o("shell.subagentBadge"):null,A=Is(t.title,o("common.unknown")),H=a_(t),_=H?o_(H):null,Y=qc(t),z=Y?gT("session-activity-badge",t):null,K=pu(t),O=Fb(t),F=p.useRef(null),[te,de]=p.useState(null);p.useLayoutEffect(()=>{if(!c){de(null);return}const N=()=>{const L=F.current;if(!L)return;const X=L.getBoundingClientRect();de({top:`${X.bottom}px`,left:`${X.right}px`})};return N(),window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),()=>{window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0)}},[c]);const W=c&&typeof document<"u"&&te?Xn.createPortal(n.jsxs("div",{className:"workbench-session-menu","data-menu-key":e,onClick:N=>N.stopPropagation(),style:te,children:[n.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{T(),q()},children:[n.jsx(z_,{}),n.jsx("span",{children:o("shell.renameAction")})]}),n.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{I(),q()},children:[n.jsx(nP,{active:u}),n.jsx("span",{children:o(u?"shell.unfavoriteAction":"shell.favoriteAction")})]}),n.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{Z(),q()},children:[n.jsx(H_,{}),n.jsx("span",{children:o("shell.archiveAction")})]})]}),document.body):null;return n.jsxs("article",{className:"workbench-session-card","data-active":a,"data-depth":m,"data-subagent":kg(t),"data-workspace-tone":i.tone,"data-worktree-depth":i.depth,"data-has-subagents":v,"data-selecting":w,"data-selected":y,style:Xi(i),onContextMenu:N=>{w||!B||(N.preventDefault(),B())},children:[n.jsxs("div",{className:"workbench-session-main",children:[w?n.jsx("span",{className:"workbench-session-selection-indicator","data-selected":y,"aria-hidden":"true",children:n.jsx(U_,{selected:y})}):v?n.jsxs("button",{type:"button",className:"workbench-session-subagent-toggle",style:c_,"data-indicator-variant":u_(t,{hasSubagents:!0,isActive:a}),"aria-label":o(g?"shell.subagentCollapse":"shell.subagentExpand"),title:o(g?"shell.subagentCollapse":"shell.subagentExpand"),"aria-expanded":g,onClick:N=>{N.stopPropagation(),C==null||C()},children:[n.jsx("span",{className:ox(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(Pc,{expanded:g})})]}):n.jsx("span",{className:ox(t,{isActive:a}),"data-activity-source":t.activitySource,"aria-hidden":"true"}),n.jsx("button",{type:"button",className:"workbench-session-link",style:v?l_:void 0,"data-active":a,"aria-pressed":w?y:void 0,onClick:w?x:j,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:A.fullTitle,children:A.displayTitle}),E?n.jsx("span",{className:"session-subagent-badge",children:E}):null,O&&K?n.jsx("span",{className:`session-fork-badge ${K}`,children:O}):null]}),n.jsxs("div",{className:"session-meta-row",children:[n.jsx("span",{className:"session-meta",children:ET(t,r,d,i.displayName)}),Y&&z?n.jsx("span",{className:z,children:Y}):null,n.jsx("span",{className:`session-provider-badge ${t.provider}`,children:em(t.provider)})]}),_?n.jsx("div",{className:"session-error-row",title:H??void 0,children:n.jsx("span",{className:"session-error-text",children:_})}):null]})})]}),f&&!w?n.jsx("div",{className:"workbench-session-actions","data-open":c,children:n.jsx("button",{ref:F,type:"button",className:"workbench-session-menu-trigger","data-open":c,"aria-label":o("shell.sessionMoreAction"),title:o("shell.sessionMoreAction"),"aria-expanded":c,onClick:N=>{N.stopPropagation(),P()},children:n.jsx(V_,{})})}):null,W]})}function wx({workspaceGroups:e,workspaceVisualContextMap:t,favoriteSessions:r,favoriteSessionIds:i,activeWorkspaceId:a,isConversationActive:u,isTerminalActive:c,isButlerActive:d,isSearchOpen:m,navigationLoading:f,navigationError:v,activeSessionId:g,onRefreshNavigation:w,onSessionUpdated:y,onNavigateConversation:x,onNavigateTerminals:C,onNavigateButler:j,onOpenSearch:T,onOpenSettings:P,onSelectWorkspace:I,onToggleWorkspaceCollapse:Z,onStartWorkspaceReorder:q,onPreviewWorkspaceReorder:B,onCommitWorkspaceReorder:E,allowWorkspaceReorder:A,subscribeGitSnapshot:H,requestGitRefresh:_,subscribeWorkspaceManagementSnapshot:Y,requestWorkspaceManagementRefresh:z,onToggleFavoriteSession:K,onArchiveSession:O,onUnarchiveSession:F,workspaceManagementStateById:te,setWorkspaceManagementStateById:de,unreadNotificationCount:W,notificationPanelOpen:M,onToggleNotificationPanel:N,onClose:L,onToggleCollapse:X}){const D=dr(),be=cr(),{showToast:ce}=ir(),le=p.useCallback(V=>{!be.isDesktop||be.ui.osFamily!=="macos"||V.button!==0||Pb(V.target)&&Db()},[be.isDesktop,be.ui.osFamily]),[ye,Se]=p.useState(!1),[_e,Ce]=p.useState(!1),[Nt,ct]=p.useState(!1),[gt,ft]=p.useState([]),[rt,fe]=p.useState(null),[ue,Oe]=p.useState(null),[qe,nt]=p.useState(null),[yt,Me]=p.useState(null),[Le,pt]=p.useState(null),[ut,we]=p.useState(null),[xe,Qe]=p.useState(!1),[Fe,dt]=p.useState(!1),[It,qt]=p.useState(""),[Ht,Ft]=p.useState(""),[Dt,bt]=p.useState(""),[Qt,zt]=p.useState({localBranches:[],remoteBranches:[],tags:[]}),[on,ae]=p.useState(!1),[$e,ht]=p.useState(-1),[Wt,jn]=p.useState(!1),[ln,Ut]=p.useState(!1),[dn,Jt]=p.useState(null),[nn,hn]=p.useState(null),[ee,ne]=p.useState(null),[pe,ve]=p.useState(null),[We,Ye]=p.useState(null),[mt,Je]=p.useState(Jp),[Ke,re]=p.useState({}),[Pe,ot]=p.useState({}),[kt,an]=p.useState([]),[$t,Bt]=p.useState({expandedWorkspaceIds:[],collapsedWorkspaceIds:[]}),[_t,Sn]=p.useState(null),[On,Mn]=p.useState(""),[Tt,fn]=p.useState(null),[Xt,kn]=p.useState(null),[Te,Be]=p.useState([]),[lt,Mt]=p.useState(!1),[rn,Nn]=p.useState({}),[Vt,Un]=p.useState(null),qn=p.useRef(null),En=p.useRef(null),Dn=p.useRef(null),zr=p.useMemo(()=>new Set($t.expandedWorkspaceIds),[$t.expandedWorkspaceIds]),hr=p.useMemo(()=>new Set($t.collapsedWorkspaceIds),[$t.collapsedWorkspaceIds]),qr=Vt!==null,xn=mx(e,Le)??((ut==null?void 0:ut.id)===Le?ut:null),$r=Dt.trim().toLowerCase(),br=p.useMemo(()=>[{key:"localBranches",label:o("shell.createWorktreeBaseRefLocalGroup"),items:Qt.localBranches},{key:"remoteBranches",label:o("shell.createWorktreeBaseRefRemoteGroup"),items:Qt.remoteBranches},{key:"tags",label:o("shell.createWorktreeBaseRefTagGroup"),items:Qt.tags}].map(ge=>({...ge,items:ge.items.filter(Ie=>$r?Ie.value.toLowerCase().includes($r):!0)})).filter(ge=>ge.items.length>0),[$r,Qt]),In=p.useMemo(()=>br.flatMap(V=>V.items),[br]),Mr=xn?`create-worktree-base-ref-listbox-${xn.id}`:"create-worktree-base-ref-listbox",Bn=g_(e,pe),Q=Bn?rs(Bn.workspace):null,je=p.useMemo(()=>f_(e,Xt),[Xt,e]),G=p.useMemo(()=>je?n_(je.visibleSessionTree):[],[je]),Ee=p.useMemo(()=>G.map(V=>V.sessionId),[G]),Ge=p.useMemo(()=>new Set(Ee),[Ee]),At=p.useMemo(()=>new Set(Te),[Te]),gn=Ee.length>0&&Te.length===Ee.length;p.useEffect(()=>{de(V=>{const ge=px(e),Ie=new Set(ge),at={};Object.entries(V).forEach(([Lt,Qn])=>{Ie.has(Lt)&&(at[Lt]=Qn)}),ge.forEach(Lt=>{const Qn=mx(e,Lt);if(!Qn)return;const Gr=Rr(Sg(Lt),Zk),$n=Rr(GT(Lt),Zk),Cr=at[Lt];let ji=YT((Cr==null?void 0:Cr.detail)??Gr??KT(Qn),Qn);($n!=null&&$n.status||$n!=null&&$n.branches)&&(ji=XT(ji,{status:$n.status??null,branches:$n.branches??null})),at[Lt]={detail:ji,loading:!1,error:null}});const vt=Object.keys(V),un=Object.keys(at);return vt.length===un.length&&un.every(Lt=>V[Lt]===at[Lt])?V:at})},[e]);const bn=p.useCallback(async V=>{await w(),await be.bridge.showNotification(o("shell.importSuccess"),V.path)},[w,be.bridge]),wn=p.useCallback(async V=>{await w(),await be.bridge.showNotification(o("shell.cloneSuccess"),V.path)},[w,be.bridge]);function oi(V){if(gt.includes(V)){ft(Ie=>Ie.filter(at=>at!==V));return}ft(Ie=>[...Ie,V]),H(V),_(V),Y(V),z(V)}async function li(V,ge){if(rn[V])return;const Ie=(ge==null?void 0:ge.trim().toUpperCase())??null;Nn(at=>({...at,[V]:!0}));try{await QN(V,{backgroundColor:Ie}),await w()}catch(at){ce({title:at instanceof Error?at.message:o("shell.manageWorkspaceColorSaveFailed"),tone:"error"})}finally{Nn(at=>({...at,[V]:!1}))}}async function Ar(){if(!(!rt||ue)){Oe(rt.id);try{await XN(rt.id),ft(V=>V.filter(ge=>ge!==rt.id)),de(V=>{const ge={...V};return delete ge[rt.id],ge}),fe(null),await w(),ce({title:o("shell.manageWorkspaceRemoveSuccess"),tone:"success"})}catch(V){ce({title:V instanceof Error?V.message:o("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{Oe(null)}}}p.useEffect(()=>{if(!We)return;function V(ge){const Ie=ge.target;Ie instanceof HTMLElement&&(Ie.closest(".workbench-session-actions")||Ie.closest(".workbench-session-menu"))||Ye(null)}return window.addEventListener("pointerdown",V),()=>{window.removeEventListener("pointerdown",V)}},[We]),p.useEffect(()=>{if(!Xt){Te.length>0&&Be([]);return}if(!je){kn(null),Be([]);return}Be(V=>HT(V,Ge))},[je,Ge,Xt,Te.length]),p.useEffect(()=>{Xt&&Ee.length===0&&(kn(null),Be([]))},[Ee.length,Xt]),p.useEffect(()=>{const V=new Set(px(e)),ge=new Set(e.flatMap(Ie=>xg(Ie.childWorktrees)));ft(Ie=>Ie.filter(at=>V.has(at))),Bt(Ie=>({expandedWorkspaceIds:Ie.expandedWorkspaceIds.filter(at=>ge.has(at)),collapsedWorkspaceIds:Ie.collapsedWorkspaceIds.filter(at=>ge.has(at))})),fe(Ie=>Ie&&V.has(Ie.id)?Ie:null),Nn(Ie=>Object.fromEntries(Object.entries(Ie).filter(([at,vt])=>vt&&V.has(at))))},[e]),p.useEffect(()=>{const V=r.findIndex(ge=>ge.session.sessionId===g);Je(ge=>{const Ie=kd(r.length,Jp,ge,V);return Ie===ge?ge:Ie})},[g,r]),p.useEffect(()=>{re(V=>{const ge={};for(const Ie of e){const at=Nc(Ie),vt=at.findIndex(un=>un.item.sessionId===g||Js([un],g??"",Lt=>Lt.sessionId).length>0);ge[Ie.workspace.id]=kd(at.length,dc,V[Ie.workspace.id],vt);for(const un of Tc(Ie.childWorktrees)){un.item.sessionId===g||Js([un],g??"",$n=>$n.sessionId).length>0;const Lt=un.item.workspaceId;if(ge[Lt]!==void 0)continue;const Qn=Tc(Ie.childWorktrees).filter($n=>$n.item.workspaceId===Lt&&$n.depth===0),Gr=Qn.findIndex($n=>$n.item.sessionId===g||Js([$n],g??"",Cr=>Cr.sessionId).length>0);ge[Lt]=kd(Qn.length,dc,V[Lt],Gr)}}return ax(V,ge)?V:ge})},[g,e]),p.useEffect(()=>{ot(V=>{const ge={};for(const Ie of e)for(const at of[...Nc(Ie),...Tc(Ie.childWorktrees)])for(const vt of Ji(ps(at))){const un=ps(vt);if(un.length===0)continue;const Lt=Ji(un),Qn=Lt.findIndex(Gr=>Gr.item.sessionId===g);ge[vt.item.sessionId]=kd(Lt.length,yd,V[vt.item.sessionId],Qn)}return ax(V,ge)?V:ge})},[g,e]),p.useEffect(()=>{if(!g)return;const V=e.flatMap(ge=>[...Js(Nc(ge),g,Ie=>Ie.sessionId),...Tc(ge.childWorktrees).flatMap(Ie=>Js([Ie],g,at=>at.sessionId))]);V.length!==0&&an(ge=>{const Ie=new Set(ge);let at=!1;for(const vt of V)Ie.has(vt)||(Ie.add(vt),at=!0);return at?Array.from(Ie):ge})},[g,e]),p.useEffect(()=>{if(!a)return;const V=[];for(const ge of e){const Ie=WT(ge.childWorktrees,a);Ie.length!==0&&V.push(...Ie)}V.length>0&&Bt(ge=>{const Ie=new Set(ge.expandedWorkspaceIds);let at=!1;for(const vt of V)Ie.has(vt)||(Ie.add(vt),at=!0);return at?{expandedWorkspaceIds:Array.from(Ie),collapsedWorkspaceIds:ge.collapsedWorkspaceIds}:ge})},[a,e]),p.useEffect(()=>{if(!Le){we(null),Qe(!1),dt(!1),qt(""),Ft(""),bt(""),ae(!1),ht(-1),jn(!1),zt({localBranches:[],remoteBranches:[],tags:[]}),Ut(!1),Jt(null);return}Qe(!1),qt(""),Ft(""),bt(""),ae(!1),ht(-1),jn(!1),zt({localBranches:[],remoteBranches:[],tags:[]}),Ut(!1),Jt(null)},[Le]),p.useEffect(()=>{const V=xn;if(!xe||!V)return;let ge=!1;const Ie=V.id;return Ut(!0),Jt(null),Promise.all([lT(Ie),CL(Ie)]).then(([at,vt])=>{ge||zt(UF(at,vt))}).catch(()=>{ge||(zt({localBranches:[],remoteBranches:[],tags:[]}),Jt(o("shell.createWorktreeBaseRefLoadFailed")))}).finally(()=>{ge||Ut(!1)}),()=>{ge=!0}},[xn==null?void 0:xn.id,xe]),p.useLayoutEffect(()=>{if(!on||!qn.current){hn(null),ne(null);return}const V=()=>{const Ie=qn.current;if(!Ie)return;const at=HF(Ie);hn({top:at.bottom+8,left:at.left,width:at.width})};V();const ge=Ie=>{var vt,un;const at=Ie.target;at instanceof Node&&((vt=qn.current)!=null&&vt.contains(at)||(un=En.current)!=null&&un.contains(at)||(ae(!1),ht(-1)))};return window.addEventListener("resize",V),window.addEventListener("scroll",V,!0),window.addEventListener("pointerdown",ge),()=>{window.removeEventListener("resize",V),window.removeEventListener("scroll",V,!0),window.removeEventListener("pointerdown",ge)}},[In.length,on]),p.useLayoutEffect(()=>{if(!on||!En.current){ne(null);return}const V=En.current,ge=()=>{const at=Math.ceil(V.getBoundingClientRect().height);ne(vt=>vt===at?vt:at)};if(ge(),typeof ResizeObserver>"u")return;const Ie=new ResizeObserver(()=>{ge()});return Ie.observe(V),()=>{Ie.disconnect()}},[on,br,ln,dn]);function Rn(){Se(!0)}function Or(){Ce(!0)}function Vr(){Qe(!1),qt(""),Ft(""),bt(""),ae(!1),ht(-1),jn(!1)}function Ot(V,ge){const Ie=V.getBoundingClientRect();return ge<=Ie.top+Ie.height/2?"before":"after"}function Br(){Dn.current!==null&&(cancelAnimationFrame(Dn.current),Dn.current=null),Un(null)}function Ii(V,ge){V.dataTransfer.effectAllowed="move",V.dataTransfer.setData("text/plain",ge),q(),Dn.current!==null&&cancelAnimationFrame(Dn.current),Dn.current=requestAnimationFrame(()=>{Dn.current=null,Un(ge)})}function Fs(V,ge){const Ie=Vt||V.dataTransfer.getData("text/plain");!Ie||Ie===ge||(V.preventDefault(),V.dataTransfer.dropEffect="move",B(Ie,ge,Ot(V.currentTarget,V.clientY)))}function $(V){V.preventDefault()}function he(){Br(),E()}function me(V){return Pe[V]??yd}function et(V){return kt.includes(V)}function st(V){return Ke[V]??dc}function xt(){Je(V=>Math.min(r.length,V+Jp))}function Zt(V,ge){re(Ie=>({...Ie,[V]:Math.min(ge,(Ie[V]??dc)+dc)}))}function Ln(V){ot(ge=>({...ge,[V]:(ge[V]??yd)+yd}))}function sr(V){an(ge=>ge.includes(V)?ge.filter(Ie=>Ie!==V):[...ge,V])}function Sr(V,ge){return hr.has(V)?!1:ge||zr.has(V)}function sa(V,ge){const Ie=!Sr(V,ge);Bt(at=>{const vt=at.expandedWorkspaceIds.filter(Lt=>Lt!==V),un=at.collapsedWorkspaceIds.filter(Lt=>Lt!==V);return Ie?{expandedWorkspaceIds:[...vt,V],collapsedWorkspaceIds:un}:{expandedWorkspaceIds:vt,collapsedWorkspaceIds:[...un,V]}})}function ci(V){for(const ge of e){const Ie=Ji(Bb(ge.visibleSessions)).find(at=>at.item.sessionId===V)??FT(ge.childWorktrees,V);if(Ie)return ps(Ie)}return[]}function Ci(V,ge){const Ie=rs(V);return n.jsxs("button",{type:"button",className:"workbench-archive-folder","data-workspace-tone":Ie.tone,style:Xi(Ie),onClick:()=>ve(V.id),children:[n.jsxs("span",{className:"workbench-archive-folder-main",children:[n.jsx(q_,{}),n.jsx("span",{children:o("shell.archiveFolderLabel")})]}),n.jsx("span",{className:"workbench-section-counter",children:ge.length})]})}function ns(){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:[Te.length,"/",Ee.length]}),n.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:la,children:o(gn?"shell.clearSelectedSessions":"shell.selectAllSessions")}),n.jsx("button",{type:"button",className:"workbench-workspace-batch-action primary",disabled:Te.length===0||lt,onClick:()=>{vs()},children:o(lt?"shell.batchArchiving":"shell.batchArchiveAction")}),n.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:oa,children:o("common.cancel")})]})}function Er(V,ge="workbench-workspace-actions"){return n.jsxs("div",{className:ge,children:[n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.switchWorkspace"),title:o("shell.switchWorkspace"),"aria-pressed":a===V,onClick:()=>{I(V),L==null||L()},children:n.jsx(W_,{})}),n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.batchSelectSessions"),title:o("shell.batchSelectSessions"),onClick:()=>za(V),children:n.jsx(B_,{})}),n.jsx("button",{type:"button",className:"workbench-workspace-icon-button workbench-workspace-create","aria-label":o("shell.createSession"),title:o("shell.createSession"),onClick:()=>pt(V),children:n.jsx(A_,{})})]})}function aa(V){const ge=V.visibleSessionTree,at=new Set(xg(V.children)).has(a??""),vt=V.workspace.id===a||at,un=qr||!Sr(V.workspace.id,vt),Lt=rs(V.workspace);return n.jsxs("section",{className:"workbench-workspace-group","data-worktree-node":"true","data-batch-active":Xt===V.workspace.id,"data-worktree-depth":V.meta.depth,"data-workspace-tone":"worktree",style:Xi(Lt),children:[n.jsxs("div",{className:"workbench-workspace-header minimal",children:[n.jsxs("button",{type:"button",className:"workbench-workspace-toggle","aria-label":o(un?"shell.worktreeExpand":"shell.worktreeCollapse"),onClick:()=>sa(V.workspace.id,vt),children:[n.jsx("span",{className:"workbench-workspace-toggle-icon","aria-hidden":"true",children:n.jsx(Pc,{expanded:!un})}),n.jsxs("span",{children:[n.jsx("strong",{children:V.meta.displayName||V.workspace.name}),n.jsx("span",{className:"session-meta",children:V.meta.branchName})]})]}),Xt===V.workspace.id?ns():Er(V.workspace.id)]}),un?null:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"workbench-session-list","data-workspace-tone":Lt.tone,style:Xi(Lt),children:[ge.length===0?n.jsx("p",{className:"workbench-session-empty",children:o("shell.emptyWorkspaceSessions")}):ge.slice(0,st(V.workspace.id)).map(Qn=>ri({node:Qn,workspace:V.workspace,workspaceContext:Lt,menuKeyPrefix:`worktree:${V.workspace.id}`,showWorkspaceName:!1,selectionMode:Xt===V.workspace.id,favoriteEnabled:!0})),ge.length>st(V.workspace.id)?n.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Zt(V.workspace.id,ge.length),children:o("shell.sessionExpandMore")}):null]}),V.children.length>0?n.jsx("div",{className:"workbench-session-list workbench-worktree-child-list",children:V.children.map(Qn=>aa(Qn))}):null,Ci(V.workspace,V.archivedSessions)]})]},V.workspace.id)}function ri(V){const{node:ge,workspace:Ie,workspaceContext:at,menuKeyPrefix:vt,showWorkspaceName:un,selectionMode:Lt,favoriteEnabled:Qn,ancestorExpanded:Gr=!1,allowToggle:$n=ge.depth===0,ancestorHasNextSiblings:Cr=[],hasNextSibling:ji=!1,isFirstSibling:_i=!1}=V,Fn=ge.item,ws=ps(ge),Oi=Gr||et(Fn.sessionId),Wn=Oi&&$n,Va=Wn?r_(ge,me(Fn.sessionId)):ge,ha=Oi?ps(Va):[],Eo=Ji(ws).length,Io=Ji(ha).length,Lo=Wn&&Io<Eo,Fo=ge.depth>0?[...Cr,ji]:[...Cr];return n.jsxs("div",{className:"workbench-session-tree-node",children:[n.jsxs("div",{className:"workbench-session-tree-row",style:{"--workbench-session-tree-depth":ge.depth},children:[ge.depth>0?n.jsxs("div",{className:"workbench-session-tree-guides","aria-hidden":"true",children:[Cr.map((ys,U)=>ys?n.jsx("span",{className:"workbench-session-tree-guide-column",style:{"--workbench-session-tree-level":U+1}},`${Fn.sessionId}:ancestor:${U}`):null),n.jsx("span",{className:"workbench-session-tree-guide-branch","data-continue":ji,"data-first":_i,style:{"--workbench-session-tree-level":ge.depth},children:n.jsx("span",{className:"workbench-session-tree-guide-branch-horizontal"})})]}):null,n.jsx(K_,{menuKey:`${vt}:${Fn.sessionId}`,session:Fn,workspace:Ie,workspaceContext:at,isActive:Fn.sessionId===g,isFavorite:Qn&&i.has(Fn.sessionId),menuOpen:We===`${vt}:${Fn.sessionId}`,showWorkspaceName:un,depth:ge.depth,showActions:Qn,hasSubagents:$n&&ws.length>0,subagentListExpanded:Oi,selectionMode:Lt,selected:At.has(Fn.sessionId),onToggleSelect:()=>Mo(Fn.sessionId),onToggleSubagents:()=>sr(Fn.sessionId),onOpen:()=>{D(fr(Ie.id,Fn.sessionId)),L==null||L()},onRename:()=>qa(Fn,Ie),onToggleMenu:()=>Ye(ys=>ys===`${vt}:${Fn.sessionId}`?null:`${vt}:${Fn.sessionId}`),onToggleFavorite:()=>Ir(Fn.sessionId),onArchive:()=>Wr(Fn.sessionId),onCloseMenu:()=>Ye(null),onContextMenu:be.isDesktop?()=>{da({session:Fn,workspace:Ie})}:void 0})]}),ws.length>0&&Oi?n.jsxs("div",{className:"workbench-subsession-list",children:[ha.map((ys,U)=>ri({node:ys,workspace:Ie,workspaceContext:at,menuKeyPrefix:vt,showWorkspaceName:un,selectionMode:Lt,favoriteEnabled:Qn,ancestorExpanded:!0,allowToggle:!1,ancestorHasNextSiblings:Fo,hasNextSibling:U<ha.length-1,isFirstSibling:U===0})),Lo?n.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Ln(Fn.sessionId),children:o("shell.subagentExpandMore")}):null]}):null]},Fn.sessionId)}function za(V){Ye(null),kn(V),Be([])}function oa(){kn(null),Be([])}function Mo(V){Be(ge=>C_(ge,V))}function la(){Be(V=>V.length===Ee.length?[]:Ee)}async function ca(V,ge){nt(V),Me(ge);try{await DT(V,ge),pt(null),D(PN(V,ge)),L==null||L()}catch(Ie){ce({title:Ie instanceof Error?Ie.message:o("shell.startSessionFailed"),tone:"error"})}finally{nt(null),Me(null)}}async function Ao(V){if(V.preventDefault(),!xn||Fe)return;const ge=It.trim(),Ie=Ht.trim(),at=Dt.trim();if(!ge){ce({title:o("shell.createWorktreeBranchRequired"),tone:"error"});return}if(!BF(ge)){ce({title:o("shell.createWorktreeBranchInvalid"),tone:"error"});return}dt(!0);try{const vt=await iL({sourceWorkspaceId:xn.id,branchName:ge,displayName:Ie||void 0,baseRef:at||void 0});we(vt.workspace),I(vt.workspace.id),await w(),pt(vt.workspace.id),Vr(),ce({title:o("shell.createWorktreeSucceeded",{name:vt.meta.displayName||vt.workspace.name}),tone:"success"})}catch(vt){ce({title:vt instanceof Error?vt.message:o("shell.createWorktreeFailed"),tone:"error"})}finally{dt(!1)}}async function Ir(V){const ge=i.has(V);Ye(null);try{await K(V),ce({title:o(ge?"shell.favoriteRemoved":"shell.favoriteAdded"),tone:"success"})}catch(Ie){ce({title:Ie instanceof Error?Ie.message:o("shell.favoriteToggleFailed"),tone:"error"})}}async function Wr(V){Ye(null);try{await O(V),ce({title:o("shell.archiveAdded"),tone:"success"})}catch(ge){ce({title:ge instanceof Error?ge.message:o("shell.navigationLoadFailed"),tone:"error"})}}async function vs(){if(!(Te.length===0||lt)){Ye(null),Mt(!0);try{const V=[...Te],ge=await Promise.allSettled(V.map(async vt=>({sessionId:vt,session:await tT(vt,!0)}))),Ie=[];let at=0;for(const vt of ge){if(vt.status==="fulfilled"){Ie.push(vt.value.sessionId),y(vt.value.session);continue}at+=1}Ie.length>0&&(await w(),Be(vt=>vt.filter(un=>!Ie.includes(un)))),at>0?ce({title:Ie.length>0?o("shell.batchArchivePartialFailed"):o("shell.batchArchiveFailed"),tone:"error"}):ce({title:o("shell.batchArchiveSuccess"),tone:"success"})}catch(V){ce({title:V instanceof Error?V.message:o("shell.batchArchiveFailed"),tone:"error"})}finally{Mt(!1)}}}async function Li(V){Ye(null);try{await F(V),ce({title:o("shell.archiveRestored"),tone:"success"})}catch(ge){ce({title:ge instanceof Error?ge.message:o("shell.navigationLoadFailed"),tone:"error"})}}function qa(V,ge){Ye(null),Sn({session:V,workspace:ge}),Mn(V.title)}async function ua(V){if(V.preventDefault(),!_t)return;const ge=On.trim();if(ge){fn(_t.session.sessionId);try{const Ie=await eT(_t.session.sessionId,ge);y(Ie),Sn(null),Mn(""),ce({title:o("shell.renameSuccess"),tone:"success"})}catch(Ie){ce({title:Ie instanceof Error?Ie.message:o("shell.renameFailed"),tone:"error"})}finally{fn(null)}}}async function da(V){if(!be.isDesktop)return;const ge=i.has(V.session.sessionId);await VN([{id:`open-${V.session.sessionId}`,label:o("shell.contextOpenSession"),onSelect:()=>{D(fr(V.workspace.id,V.session.sessionId)),L==null||L()}},{id:`rename-${V.session.sessionId}`,label:o("shell.renameAction"),onSelect:()=>qa(V.session,V.workspace)},{id:`favorite-${V.session.sessionId}`,label:o(ge?"shell.unfavoriteAction":"shell.favoriteAction"),onSelect:()=>Ir(V.session.sessionId)},{id:`archive-${V.session.sessionId}`,label:o("shell.archiveAction"),onSelect:()=>{Wr(V.session.sessionId)}}])}const Fi=r.slice(0,mt),_s=Fi.length<r.length;function rs(V){return t[V.id]??fu(V)}function $a(V,ge,Ie,at,vt=[]){var Oi;const un=gt.includes(V.id),Lt=te[V.id]??{detail:null,loading:!1,error:null},Qn=ue===V.id,Gr=rn[V.id]===!0,$n=(Oi=Lt.detail)!=null&&Oi.git.remotes.length?Lt.detail.git.remotes.map(Wn=>`${Wn.name}: ${Wn.url}`).join(" · "):o("shell.manageWorkspaceNoRemote"),Cr=Lt.detail?wT(Lt.detail.codeComposition.items,o("shell.manageWorkspaceCodeCompositionOther")):[],ji=Cr.length>0?yT(Cr):void 0,_i=rs(V),Fn=b_(_i,vt),ws=[...vt,_i.displayName];return n.jsxs("article",{className:"workbench-manage-item","data-workspace-tone":_i.tone,"data-worktree-node":at,style:Xi(_i),children:[n.jsxs("button",{type:"button",className:"workbench-manage-item-toggle","aria-expanded":un,onClick:()=>oi(V.id),children:[n.jsxs("span",{className:"workbench-manage-item-heading",children:[n.jsx(Pc,{expanded:un}),n.jsxs("span",{className:"workbench-manage-item-heading-copy",children:[n.jsx("strong",{children:_i.displayName}),n.jsx("span",{className:"workbench-manage-item-tree-path",children:Fn})]})]}),n.jsx("span",{className:"workbench-section-counter",children:ge})]}),un?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:V.path})]}),at?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:IF.map(Wn=>n.jsx("button",{type:"button",className:"workbench-manage-color-swatch","aria-label":o("shell.manageWorkspaceColorSelectSwatch",{color:Wn}),"aria-pressed":V.backgroundColor===Wn,disabled:Gr,"data-selected":V.backgroundColor===Wn,style:{backgroundColor:Wn},onClick:()=>{li(V.id,Wn)}},Wn))}),n.jsx("button",{type:"button",className:"ghost-button",disabled:Gr||!V.backgroundColor,onClick:()=>{li(V.id,null)},children:o("shell.manageWorkspaceColorClearAction")})]})]}),n.jsx("p",{className:"workbench-manage-hint",children:V.backgroundColor??o("shell.manageWorkspaceColorUnset")})]}):null,Lt.loading&&Lt.detail===null?n.jsx("p",{className:"workbench-manage-status status-text",children:o("shell.manageWorkspaceLoading")}):null,Lt.error?n.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:Lt.error}):null,Lt.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:Lt.detail.git.commitCount??"--"})]})}),n.jsxs("div",{className:"workbench-manage-detail-block",children:[n.jsx("span",{className:"workbench-manage-detail-label",children:o("shell.manageWorkspaceGitInfoLabel")}),Lt.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:Lt.detail.git.repoRoot??"--"})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.manageWorkspaceCurrentBranch")}),n.jsx("span",{children:Lt.detail.git.currentBranch??"--"})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.manageWorkspaceRemoteLabel")}),n.jsx("span",{children:$n})]})]}):n.jsx("p",{className:"workbench-section-empty",children:Lt.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")}),Cr.length>0?n.jsxs("div",{className:"workbench-manage-type-chart",children:[n.jsxs("div",{className:"workbench-manage-type-chart-ring",style:ji,"aria-hidden":"true",children:[n.jsx("strong",{className:"workbench-manage-type-chart-total",children:Lt.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:Cr.map(Wn=>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:Wn.color},"aria-hidden":"true"}),n.jsx("span",{className:"workbench-manage-type-name",children:Wn.type})]}),n.jsxs("span",{children:[Wn.count," · ",vT(Wn)]})]},Wn.key))})]}):n.jsx("p",{className:"workbench-section-empty",children:Lt.detail.codeComposition.error??o("shell.manageWorkspaceNoCodeComposition")}),Lt.detail.codeComposition.truncated?n.jsx("p",{className:"workbench-manage-hint",children:o("shell.manageWorkspaceCodeTruncated",{count:Lt.detail.codeComposition.scannedFileCount})}):null]})]}):null,n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{ct(!1),D(BE(V.id))},children:o("shell.workspaceDetailDebugOpenPageAction")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!ue,onClick:()=>fe(V),children:o(Qn?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})]})]}):null,Ie.length>0?n.jsx("div",{className:"workbench-manage-children",children:Ie.map(Wn=>$a(Wn.workspace,Wn.visibleSessions.length+Wn.archivedSessions.length,Wn.children,!0,ws))}):null]},V.id)}return n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"workbench-nav-header","data-window-drag-handle":"workbench-nav-header",onMouseDownCapture:le,children:n.jsxs("div",{className:"workbench-nav-toolbar",children:[X?n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":o("shell.hideSessionSidebar"),title:o("shell.hideSessionSidebar"),onClick:X,children:n.jsx(tP,{})}):null,n.jsx(JT,{unreadCount:W,open:M,onToggle:N}),n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":o("shell.goBack"),title:o("shell.goBack"),onClick:()=>D(-1),children:n.jsx(ZT,{})}),n.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":o("shell.goForward"),title:o("shell.goForward"),onClick:()=>D(1),children:n.jsx(eP,{})})]})}),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:x,children:[n.jsx(I_,{}),o("shell.conversationEntry")]}),n.jsxs("button",{type:"button",className:c?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":c,onClick:C,children:[n.jsx(L_,{}),o("shell.terminalsEntry")]}),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(F_,{}),o("shell.butlerEntry")]}),n.jsxs("button",{type:"button",className:"workbench-nav-segment-button","data-open":m,"aria-haspopup":"dialog","aria-expanded":m,onClick:T,children:[n.jsx(E_,{}),n.jsx("span",{children:o("shell.searchEntry")})]})]}),v?n.jsx("div",{className:"workbench-status-row",children:n.jsx("p",{className:"status-text","data-tone":"error",children:v})}):null,r.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(nP,{active:!0}),n.jsx("span",{children:o("shell.favoriteSectionTitle")})]}),n.jsx("span",{className:"workbench-section-counter",children:r.length})]}),n.jsxs("div",{className:"workbench-session-list",children:[Fi.map(V=>{const ge=ci(V.session.sessionId);return n.jsx("div",{children:ri({node:{item:V.session,depth:0,children:ge},workspace:V.workspace,workspaceContext:rs(V.workspace),menuKeyPrefix:"favorite",showWorkspaceName:!0,selectionMode:!1,favoriteEnabled:!0})},V.session.sessionId)}),_s?n.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:xt,children:o("shell.favoriteExpandMore")}):null]})]}):null,f&&e.length===0?n.jsx(N_,{}):null,!f&&!v&&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:()=>ct(!0),children:n.jsx(D_,{})}),n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.importWorkspaceTitle"),title:o("shell.importWorkspaceTitle"),onClick:Rn,children:n.jsx(P_,{})}),n.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":o("shell.cloneWorkspaceTitle"),title:o("shell.cloneWorkspaceTitle"),onClick:Or,children:n.jsx(__,{})})]})]}),e.map(V=>{const ge=Nc(V),Ie=Vt===V.workspace.id,at=V.isCollapsed||qr;return n.jsxs("section",{className:"workbench-workspace-group","data-batch-active":Xt===V.workspace.id,"data-dragging":Ie,onDragOver:vt=>Fs(vt,V.workspace.id),onDrop:$,children:[n.jsxs("div",{className:"workbench-workspace-header minimal",children:[n.jsxs("button",{type:"button",className:"workbench-workspace-toggle","aria-label":o(at?"shell.workspaceExpand":"shell.workspaceCollapse"),draggable:A,onClick:()=>Z(V.workspace.id),onDragStart:A?vt=>Ii(vt,V.workspace.id):void 0,onDragEnd:A?he:void 0,"data-reorder-enabled":A?"true":void 0,children:[n.jsx("span",{className:"workbench-workspace-toggle-icon","aria-hidden":"true",children:n.jsx(Pc,{expanded:!at})}),n.jsx("strong",{children:V.workspace.name})]}),Xt===V.workspace.id?ns():Er(V.workspace.id)]}),at?null:n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"workbench-session-list",children:[ge.length===0?n.jsx("p",{className:"workbench-session-empty",children:o("shell.emptyWorkspaceSessions")}):ge.slice(0,st(V.workspace.id)).map(vt=>ri({node:vt,workspace:V.workspace,workspaceContext:rs(V.workspace),menuKeyPrefix:`workspace:${V.workspace.id}`,showWorkspaceName:!1,selectionMode:Xt===V.workspace.id,favoriteEnabled:!0})),ge.length>st(V.workspace.id)?n.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Zt(V.workspace.id,ge.length),children:o("shell.sessionExpandMore")}):null]}),V.childWorktrees.length>0?n.jsx("div",{className:"workbench-session-list workbench-worktree-child-list",children:V.childWorktrees.map(vt=>aa(vt))}):null,Ci(V.workspace,V.archivedSessions)]})]},V.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:P,title:o("settings.title"),children:[n.jsx(O_,{}),n.jsx("span",{className:"settings-entry-label",children:o("settings.title")})]})}),n.jsx(Hn,{open:Nt,title:o("shell.manageWorkspaceTitle"),description:o("shell.manageWorkspaceDescription"),onClose:()=>{ue||ct(!1)},children:e.length>0?n.jsx("div",{className:"workbench-manage-list",children:e.map(V=>$a(V.workspace,V.visibleSessions.length+V.archivedSessions.length,V.childWorktrees,!1))}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.manageWorkspaceEmpty")})}),n.jsxs(Hn,{open:rt!==null,title:o("shell.manageWorkspaceRemoveConfirmTitle"),description:o("shell.manageWorkspaceRemoveConfirmDescription"),onClose:()=>{ue||fe(null)},children:[n.jsx("p",{className:"workbench-section-empty",children:rt?o("shell.manageWorkspaceRemoveConfirmTarget",{name:rt.name}):""}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:!!ue,onClick:()=>fe(null),children:o("common.cancel")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!ue,onClick:()=>{Ar()},children:o(ue?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveConfirmAction")})]})]}),n.jsx(NT,{open:_e,onClose:()=>Ce(!1),onCloned:wn}),n.jsx(PT,{open:ye,onClose:()=>Se(!1),onImported:bn}),n.jsx(Hn,{open:xn!==null,title:o("shell.createSessionModalTitle"),className:"workbench-create-session-modal",description:xn?`${o("shell.createSessionTarget")} · ${xn.name}`:o("shell.createSessionModalDescription"),headerActions:n.jsx("button",{type:"button",className:"secondary-button create-session-worktree-trigger",disabled:Fe||!!qe,onClick:()=>Qe(!0),children:o("shell.createWorktreeAction")}),onClose:()=>pt(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(CT,{disabled:!!qe||Fe,workspaceId:(xn==null?void 0:xn.id)??null,pendingProvider:qe===(xn==null?void 0:xn.id)?yt??null:null,onSelect:V=>{xn&&ca(xn.id,V)}})]})}),n.jsx(Hn,{open:xn!==null&&xe,title:o("shell.createWorktreeAction"),className:"workbench-create-worktree-modal",headerActions:n.jsx("button",{type:"button",className:Wt?"workbench-modal-help-button active":"workbench-modal-help-button","aria-label":o("shell.createWorktreeHelpAction"),title:o("shell.createWorktreeHelpAction"),"aria-pressed":Wt,onClick:()=>jn(V=>!V),children:n.jsx($_,{})}),description:xn?`${o("shell.createWorktreeSectionDescription")} ${o("shell.createSessionTarget")} · ${xn.name}`:o("shell.createWorktreeSectionDescription"),onClose:Vr,children:n.jsxs("form",{className:"create-session-worktree-form",onSubmit:Ao,children:[Wt?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:It,placeholder:o("shell.createWorktreeBranchPlaceholder"),onChange:V=>{const ge=V.target.value;WF(ge)&&qt(ge)}})]}),n.jsxs("label",{className:"create-session-worktree-field",children:[n.jsx("span",{children:o("shell.createWorktreeDisplayNameLabel")}),n.jsx("input",{className:"settings-text-input",value:Ht,placeholder:o("shell.createWorktreeDisplayNamePlaceholder"),onChange:V=>Ft(V.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:qn,onBlurCapture:V=>{var Ie,at;const ge=V.relatedTarget;ge instanceof Node&&((Ie=qn.current)!=null&&Ie.contains(ge)||(at=En.current)!=null&&at.contains(ge))||(ae(!1),ht(-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":on,"aria-controls":Mr,value:Dt,placeholder:o("shell.createWorktreeBaseRefPlaceholder"),onFocus:()=>{ae(!0),ht(In.length>0?0:-1)},onChange:V=>{bt(V.target.value),ae(!0),ht(In.length>0?0:-1)},onKeyDown:V=>{if(V.key==="ArrowDown"){if(V.preventDefault(),!on){ae(!0);return}In.length>0&&ht(ge=>ge>=In.length-1?0:ge+1);return}if(V.key==="ArrowUp"){if(V.preventDefault(),!on){ae(!0);return}In.length>0&&ht(ge=>ge<=0?In.length-1:ge-1);return}if(V.key==="Enter"&&on&&$e>=0){V.preventDefault();const ge=In[$e];ge&&(bt(ge.value),ae(!1),ht(-1));return}V.key==="Escape"&&ae(!1)}}),n.jsx("button",{type:"button",className:"create-session-worktree-combobox-toggle","aria-label":o("shell.createWorktreeBaseRefToggle"),"aria-expanded":on,onClick:()=>{ae(V=>!V),ht(!on&&In.length>0?0:-1)},children:n.jsx(Pc,{expanded:on})})]})}),n.jsx("span",{className:"create-session-worktree-field-hint",children:ln?o("shell.createWorktreeBaseRefLoading"):dn||o("shell.createWorktreeBaseRefHint",{localCount:Qt.localBranches.length,remoteCount:Qt.remoteBranches.length,tagCount:Qt.tags.length})})]}),on&&nn&&typeof document<"u"?Xn.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":`${nn.top}px`,"--create-worktree-combobox-left":`${nn.left}px`,"--create-worktree-combobox-width":`${nn.width}px`,"--create-worktree-combobox-height":`${ee??0}px`}}),n.jsx("div",{ref:En,className:"create-session-worktree-combobox-popover floating",style:{"--create-worktree-combobox-top":`${nn.top}px`,"--create-worktree-combobox-left":`${nn.left}px`,"--create-worktree-combobox-width":`${nn.width}px`},children:ln?n.jsx("p",{className:"create-session-worktree-combobox-empty",children:o("shell.createWorktreeBaseRefLoading")}):dn?n.jsx("p",{className:"create-session-worktree-combobox-empty",children:dn}):br.length>0?n.jsx("div",{id:Mr,className:"create-session-worktree-combobox-list",role:"listbox",children:br.map(V=>n.jsxs("section",{className:"create-session-worktree-combobox-group","aria-label":V.label,children:[n.jsx("header",{className:"create-session-worktree-combobox-group-title",children:V.label}),n.jsx("div",{className:"create-session-worktree-combobox-group-options",children:V.items.map(ge=>{const Ie=In.findIndex(un=>un.value===ge.value),at=Dt===ge.value,vt=$e===Ie;return n.jsxs("button",{type:"button",role:"option",className:"create-session-worktree-combobox-option","aria-selected":at,"data-highlighted":vt,onMouseDown:un=>un.preventDefault(),onMouseEnter:()=>ht(Ie),onClick:()=>{bt(ge.value),ae(!1),ht(-1)},children:[n.jsx("span",{className:"create-session-worktree-combobox-option-label",children:ge.value}),n.jsxs("span",{className:"create-session-worktree-combobox-option-badges",children:[ge.current?n.jsx("span",{className:"create-session-worktree-combobox-badge",children:o("shell.createWorktreeBaseRefCurrentBadge")}):null,ge.recommended?n.jsx("span",{className:"create-session-worktree-combobox-badge recommended",children:o("shell.createWorktreeBaseRefRecommendedBadge")}):null]})]},`${V.key}:${ge.value}`)})})]},V.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:Fe,onClick:Vr,children:o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:Fe,children:o(Fe?"shell.createWorktreeSubmitting":"shell.createWorktreeSubmit")})]})]})}),n.jsx(Hn,{open:Bn!==null,title:o("shell.archiveModalTitle"),description:Bn?`${Bn.workspace.name} · ${o("shell.archiveModalDescription")}`:o("shell.archiveModalDescription"),onClose:()=>ve(null),children:Bn&&Bn.archivedSessions.length>0?n.jsx("div",{className:"workbench-archive-list","data-workspace-tone":(Q==null?void 0:Q.tone)??"root",style:Xi(Q),children:Bn.archivedSessions.map(V=>{const ge=Is(V.title,o("common.unknown"));return n.jsxs("article",{className:"workbench-archive-item","data-workspace-tone":(Q==null?void 0:Q.tone)??"root",style:Xi(Q),children:[n.jsxs("div",{className:"workbench-archive-item-main",children:[n.jsx("strong",{title:ge.fullTitle,children:ge.displayTitle}),n.jsxs("p",{children:[ET(V,Bn.workspace,!1)," ·"," ",em(V.provider)]})]}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Li(V.sessionId),children:o("shell.unarchiveAction")})]},V.sessionId)})}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.archiveEmpty")})}),n.jsx(Hn,{open:_t!==null,title:o("shell.renameModalTitle"),description:o("shell.renameModalDescription"),onClose:()=>{Tt||(Sn(null),Mn(""))},children:n.jsxs("form",{className:"workbench-rename-form",onSubmit:ua,children:[n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.renameInputLabel")}),n.jsx("input",{type:"text",value:On,placeholder:o("shell.renameInputPlaceholder"),maxLength:120,autoFocus:!0,onChange:V=>Mn(V.target.value)})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:!!Tt,onClick:()=>{Sn(null),Mn("")},children:o("common.cancel")}),n.jsx("button",{type:"submit",className:"primary-button",disabled:!On.trim()||Tt===(_t==null?void 0:_t.session.sessionId),children:Tt===(_t==null?void 0:_t.session.sessionId)?o("shell.renamingSession"):o("common.save")})]})]})})]})}function yx({panelReady:e,activeTab:t,fileRevealRequest:r,onTabChange:i,onToggleCollapse:a,currentSessionId:u,activeWorkspaceId:c,navigationGroups:d,workspaceContext:m,worktreeMeta:f,worktreeMergeState:v,onRefreshWorktreeMergePreview:g,onApplyWorktreeMerge:w,onCleanupWorktree:y}){var K;const x=c??((K=d[0])==null?void 0:K.workspace.id)??null,C=cr(),{showToast:j}=ir(),T=p.useRef(null),P=p.useRef(null),I=C.isDesktop&&C.bridge.supported,Z=I&&!!c,q=I&&!!x,B=I&&!!x,E=typeof globalThis<"u"&&"PointerEvent"in globalThis,A=p.useCallback(async(O,F,te)=>{if(O==="files"){const W=await BI(C,{workspaceId:F,sessionId:te,focusOwner:"file-context-panel"});W.ok||j({title:W.detail??o("conversation.filePanelOpenExternalFailed"),tone:"error"});return}if(O==="git"){const W=await WI(C,{workspaceId:F,focusOwner:"git-sidebar"});W.ok||j({title:W.detail??o("git.openExternalFailed"),tone:"error"});return}const de=await UI(C,{workspaceId:F,focusOwner:"terminal-manager-panel"});de.ok||j({title:de.detail??o("terminalManager.openExternalFailed"),tone:"error"})},[C,j]),H=p.useCallback((O,F)=>{if(O.button!==0||!I)return;const te=F==="files"?c:F==="git"||F==="terminals"?x:null;if(!te)return;const de=F==="files"?u:null;T.current={tab:F,startX:O.clientX,startY:O.clientY,workspaceId:te,sessionId:de,detached:!1,preview:null};const W=X=>{var le;const D=T.current;if(!D)return;const be=Math.abs(X.clientX-D.startX),ce=Math.abs(X.clientY-D.startY);!D.detached&&Math.max(be,ce)<tx||(D.detached||(D.detached=!0,P.current=D.tab,D.preview=jk({title:D.tab==="files"?o("shell.filesEntry"):D.tab==="git"?o("shell.gitEntry"):o("shell.terminalManagerEntry"),x:X.clientX,y:X.clientY})),(le=D.preview)==null||le.updatePosition(X.clientX,X.clientY))},M=X=>{var be;const D=(be=T.current)==null?void 0:be.preview;X&&(D==null||D.cancel()),window.removeEventListener("mousemove",W),window.removeEventListener("mouseup",N),window.removeEventListener("blur",L),T.current=null},N=async()=>{var D;const X=T.current;M(!1),X!=null&&X.detached&&(await((D=X.preview)==null?void 0:D.complete()),await A(X.tab,X.workspaceId,X.sessionId))},L=()=>{M(!0)};window.addEventListener("mousemove",W),window.addEventListener("mouseup",N),window.addEventListener("blur",L)},[c,I,u,x,A]),_=p.useCallback((O,F)=>{if(O.button!==0||!I)return;const te=F==="files"?c:F==="git"||F==="terminals"?x:null;if(!te)return;const de=O.currentTarget,W=O.pointerId;de.setPointerCapture(W);const M=F==="files"?u:null;T.current={tab:F,startX:O.clientX,startY:O.clientY,workspaceId:te,sessionId:M,detached:!1,preview:null};const N=ce=>{var _e;if(ce.pointerId!==W)return;const le=T.current;if(!le)return;const ye=Math.abs(ce.clientX-le.startX),Se=Math.abs(ce.clientY-le.startY);!le.detached&&Math.max(ye,Se)<tx||(le.detached||(le.detached=!0,P.current=le.tab,le.preview=jk({title:le.tab==="files"?o("shell.filesEntry"):le.tab==="git"?o("shell.gitEntry"):o("shell.terminalManagerEntry"),x:ce.clientX,y:ce.clientY})),(_e=le.preview)==null||_e.updatePosition(ce.clientX,ce.clientY))},L=ce=>{var ye;const le=(ye=T.current)==null?void 0:ye.preview;ce&&(le==null||le.cancel()),de.removeEventListener("pointermove",N),de.removeEventListener("pointerup",X),de.removeEventListener("pointercancel",D),de.removeEventListener("lostpointercapture",D),window.removeEventListener("blur",be),T.current=null,de.hasPointerCapture(W)&&de.releasePointerCapture(W)},X=async ce=>{var ye;if(ce.pointerId!==W)return;const le=T.current;L(!1),le!=null&&le.detached&&(await((ye=le.preview)==null?void 0:ye.complete()),await A(le.tab,le.workspaceId,le.sessionId))},D=ce=>{ce.pointerId===W&&L(!0)},be=()=>{L(!0)};de.addEventListener("pointermove",N),de.addEventListener("pointerup",X),de.addEventListener("pointercancel",D),de.addEventListener("lostpointercapture",D),window.addEventListener("blur",be)},[c,I,u,x,A]),Y=p.useCallback(O=>{if(P.current===O){P.current=null;return}i(O)},[i]),z=p.useCallback(O=>{!C.isDesktop||C.ui.osFamily!=="macos"||O.button!==0||Pb(O.target)&&Db()},[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:Xi(m),"data-window-drag-handle":"workbench-auxiliary-header",onMouseDownCapture:z,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(tP,{})}):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:Z?"拖拽标签到独立窗口":void 0,onPointerDown:O=>_(O,"files"),onMouseDown:E?void 0:O=>H(O,"files"),onClick:()=>Y("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:q?"拖拽标签到独立窗口":void 0,onPointerDown:O=>_(O,"git"),onMouseDown:E?void 0:O=>H(O,"git"),onClick:()=>Y("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:B?"拖拽标签到独立窗口":void 0,onPointerDown:O=>_(O,"terminals"),onMouseDown:E?void 0:O=>H(O,"terminals"),onClick:()=>Y("terminals"),children:o("shell.terminalManagerEntry")})]})]}),n.jsxs("div",{className:"workbench-auxiliary-body",children:[e?null:n.jsx(Sd,{}),e&&t==="git"&&f?n.jsx(Y_,{meta:f,state:v,onRefresh:()=>g(f.workspaceId,!0),onApply:()=>w(f.workspaceId),onCleanup:()=>y(f)}):null,e&&t==="files"?c?n.jsx(p.Suspense,{fallback:n.jsx(Sd,{}),children:n.jsx(QF,{sessionId:u,workspaceId:c,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(Sd,{}),children:n.jsx(JF,{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(Sd,{}),children:n.jsx(ZF,{currentWorkspaceId:c,navigationGroups:d})}):null]})]})}function Y_({meta:e,state:t,onRefresh:r,onApply:i,onCleanup:a}){const[u,c]=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,v=(t==null?void 0:t.cleaning)??!1,g=d!==null,w=(d==null?void 0:d.alreadyMerged)===!0,y=new Set((d==null?void 0:d.blockers.map(z=>z.code))??[]),x=y.size>0||!!(t!=null&&t.error),C=w&&!x,j=(d==null?void 0:d.canMerge)===!0&&!m&&!f&&!v&&!C,T=C&&!m&&!f&&!v&&!y.has("SOURCE_DIRTY")&&!y.has("HAS_ACTIVE_CHILDREN"),P=m||f||v?"loading":x?"blocked":C?"merged":d!=null&&d.canMerge?"ready":g?"blocked":"idle",I=(d==null?void 0:d.targetWorkspace.name)??o("common.unknown"),Z=(d==null?void 0:d.sourceBranchName)??e.branchName,q=(d==null?void 0:d.targetBranchName)??e.baseRef??o("common.unknown"),B=Q_({t:o,hasPreview:g,showMergedState:C,isMerged:w,canMerge:(d==null?void 0:d.canMerge)===!0,ahead:(d==null?void 0:d.ahead)??0,blockerCodeSet:y}),E=m?o("shell.worktreeMergePreviewLoading"):f?o("shell.worktreeMergeApplying"):v?o("shell.worktreeCleanupRunning"):C?o("shell.worktreeMergeAlreadyMerged"):d!=null&&d.canMerge?o("shell.worktreeMergeReady"):o(g?"shell.worktreeMergeBlocked":"shell.worktreeMergePreviewIdle"),A=[o("shell.worktreeMergeCurrentBranch",{branch:Z}),o("shell.worktreeMergeParentBranch",{branch:q}),o("shell.worktreeMergeTargetWorkspace",{name:I}),d?o("shell.worktreeMergeAheadBehind",{ahead:d.ahead,behind:d.behind}):o("shell.worktreeMergeAheadBehindPending"),d!=null&&d.mergeBaseCommit?o("shell.worktreeMergeBaseCommit",{commit:j_(d.mergeBaseCommit)}):null].filter(z=>!!z),H=`worktree-merge-panel-details-${e.workspaceId}`,_=o(u?"shell.worktreeMergeCollapseDetails":"shell.worktreeMergeExpandDetails"),Y=X_({t:o,loading:m,applying:f,cleaning:v,hasPreview:g,canMerge:(d==null?void 0:d.canMerge)===!0,showMergedState:C,blockerCodeSet:y});return p.useEffect(()=>{c(!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":_,"aria-expanded":u,"aria-controls":H,onClick:()=>{c(z=>!z)},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:Y.map(z=>n.jsx("span",{className:"worktree-merge-panel-summary-tag","data-state":P,children:z},z))})}),n.jsx("span",{className:"worktree-merge-panel-summary-toggle",children:_})]}),u?n.jsxs("div",{id:H,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:E})}),n.jsx("div",{className:"worktree-merge-panel-meta",children:A.map(z=>n.jsx("span",{children:z},z))}),g?n.jsx("div",{className:"worktree-merge-panel-checklist","aria-label":o("shell.worktreeMergeChecklistTitle"),children:B.map(z=>n.jsxs("div",{className:"worktree-merge-panel-checklist-item","data-state":z.state,children:[n.jsx("span",{className:"worktree-merge-panel-checklist-marker","aria-hidden":"true",children:z.state==="done"?"✓":z.state==="blocked"?"!":"·"}),n.jsxs("span",{className:"worktree-merge-panel-checklist-copy",children:[n.jsx("strong",{children:z.label}),z.detail?n.jsx("span",{children:z.detail}):null]})]},z.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(z=>n.jsx("code",{children:z},z))})]}):null,n.jsxs("div",{className:"worktree-merge-panel-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:m||f||v,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:!T,onClick:a,children:o(v?"shell.worktreeCleanupRunning":"shell.worktreeCleanupAction")})]})]}):null]})}function X_(e){const{t,loading:r,applying:i,cleaning:a,hasPreview:u,canMerge:c,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:c?[t("shell.worktreeMergeCompactReady")]:d?[t("shell.worktreeMergeCompactMerged")]:u?m.has("NO_COMMITS_TO_MERGE")?[t("shell.worktreeMergeCompactNoCommits")]:[t("shell.worktreeMergeCompactBlocked")]:[t("shell.worktreeMergeCompactPending")]}function Q_(e){const{t,hasPreview:r,showMergedState:i,isMerged:a,canMerge:u,ahead:c,blockerCodeSet:d}=e,m=d.has("SOURCE_NOT_ACTIVE"),f=d.has("SOURCE_DIRTY"),v=d.has("TARGET_DIRTY"),g=d.has("HAS_ACTIVE_CHILDREN"),w=d.has("HAS_CONFLICTS"),y=r&&!a&&(d.has("NO_COMMITS_TO_MERGE")||c<=0),x=i?{key:"merge-result",label:t("shell.worktreeMergeChecklistResultMerged"),detail:t("shell.worktreeMergeMergedHint"),state:"done"}:u?{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&&v?t("shell.worktreeMergeChecklistTargetCleanBlocked"):null,state:r?v?"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:w?t("shell.worktreeMergeChecklistConflictsBlocked"):null,state:w?"blocked":r?"done":"pending"},x]}function J_({shellMode:e="desktop"}){var $n,Cr,ji,_i,Fn,ws,Oi,Wn,Va,ha,Eo,Io,Lo,Fo,ys;const t=es(),r=dr(),i=cr(),{showToast:a}=ir(),u=Zs(U=>U.notificationPreferences.notifyOnPermissionRequest),c=Zs(U=>U.notificationPreferences.notifyOnSessionCompleted),d=Zs(U=>U.notificationPreferences.notifyOnSessionFailed),m=p.useRef(k_()),f=p.useRef(0),v=p.useRef((((Cr=($n=m.current)==null?void 0:$n.items)==null?void 0:Cr.length)??0)>0),g=p.useRef(new Map),w=p.useRef(!1),y=p.useRef(null),x=p.useRef(0),C=p.useRef(null),j=p.useRef(null),T=p.useRef(new Set),P=p.useRef(new Set),I=p.useRef(new Set),Z=p.useRef(new Set),q=p.useRef(null),B=p.useRef(null),E=p.useRef(null),A=p.useRef(null),H=p.useRef(null),_=p.useRef(null),Y=p.useRef(null),z=p.useRef(null),K=p.useRef(0),O=p.useRef(0),F=p.useRef(a),te=p.useRef(i.bridge),de=p.useRef(!1),W=p.useRef(new Map),M=p.useRef(!1),N=p.useRef(new Map),L=p.useRef([]),X=p.useRef(null),[D,be]=p.useState(()=>dx(m.current)),ce=p.useRef(D),[le,ye]=p.useState(()=>{var U,ie;return(((ie=(U=m.current)==null?void 0:U.items)==null?void 0:ie.length)??0)===0}),[Se,_e]=p.useState(null),[Ce,Nt]=p.useState(()=>xd(lx(Vk,jF),wd,Qk)),[ct,gt]=p.useState(()=>xd(lx(Gk,NF),wd,Jk)),[ft,rt]=p.useState(()=>cx(Kk,!1)),[fe,ue]=p.useState(()=>cx(Yk,!1)),[Oe,qe]=p.useState(()=>hx(m.current)),[nt,yt]=p.useState(()=>ux(Qp)),[Me,Le]=p.useState(!1),[pt,ut]=p.useState("files"),[we,xe]=p.useState(!1),[Qe,Fe]=p.useState(!1),[dt,It]=p.useState(null),[qt,Ht]=p.useState({}),[Ft,Dt]=p.useState(!1),[bt,Qt]=p.useState("sessions"),[zt,on]=p.useState(""),[ae,$e]=p.useState(""),[ht,Wt]=p.useState(!1),[jn,ln]=p.useState(null),[Ut,dn]=p.useState([]),[Jt,nn]=p.useState(null),[hn,ee]=p.useState({}),[ne,pe]=p.useState({}),[ve,We]=p.useState(null),[Ye,mt]=p.useState(!1),[Je,Ke]=p.useState([]),[re,Pe]=p.useState(()=>new Set),[ot,kt]=p.useState(!1),[an,$t]=p.useState(!1),[Bt,_t]=p.useState(()=>ux(Xk));p.useEffect(()=>{F.current=a},[a]),p.useEffect(()=>{ce.current=D},[D]),p.useEffect(()=>{te.current=i.bridge},[i.bridge]);const Sn=p.useCallback(async()=>{const U=K.current+1;K.current=U;try{const ie=await Qh();if(U!==K.current)return;if(!ie.initialized){Ke([]),Pe(new Set);return}const[Re,tt,St]=await Promise.all([Jh(),Vc(),cF()]);if(U!==K.current)return;Ke(_F(Re.overview,tt.items)),Pe(new Set(St.items.map(Ct=>Ct.notificationId)))}catch{if(U!==K.current)return;Ke([]),Pe(new Set)}},[]),On=p.useCallback(U=>{const ie=U.map(Re=>Re.createdAt).sort((Re,tt)=>_a(tt)-_a(Re))[0]??null;ie&&_t(Re=>Re&&_a(Re)>=_a(ie)?Re:ie)},[]);p.useEffect(()=>{Bt&&lo(Xk,Bt)},[Bt]),p.useEffect(()=>{Sn();const U=window.setInterval(()=>{Sn()},PF);return()=>{window.clearInterval(U)}},[Sn]),p.useEffect(()=>{tn("workbench.layout_mounted",{path:t.pathname,search:t.search})},[t.pathname,t.search]),p.useEffect(()=>{var U,ie;tn("workbench.cached_snapshot_loaded",{cached:!!m.current,workspaceCount:((U=m.current)==null?void 0:U.items.length)??0,sessionCount:((ie=m.current)==null?void 0:ie.items.reduce((Re,tt)=>Re+tt.sessions.length,0))??0})},[]);function Mn(U){var tt;if(!U||!Array.isArray(U.items))return;y_(g.current,U);const ie=w_(U,g.current);tn("workbench.apply_snapshot",{workspaceCount:ie.items.length,sessionCount:ie.items.reduce((St,Ct)=>St+Ct.sessions.length,0),currentSessionId:((tt=Ac(t.pathname))==null?void 0:tt.sessionId)??null});const Re=dx(ie);m.current=ie,Zr(jc,ie),ce.current=Re,be(Re),qe(hx(ie)),_e(null)}const Tt=p.useCallback(async()=>{const U=f.current+1;f.current=U,ye(ie=>ie||!v.current),tn("workbench.refresh_navigation.start",{requestId:U,hasNavigationData:v.current});try{const ie=await YN();if(U!==f.current){tn("workbench.refresh_navigation.stale",{requestId:U});return}Mn(ie)}catch(ie){if(U!==f.current)return;_e(ie instanceof Error?ie.message:o("shell.navigationLoadFailed")),F.current({title:ie instanceof Error?ie.message:o("shell.navigationLoadFailed"),tone:"error"})}finally{tn("workbench.refresh_navigation.end",{requestId:U,success:U===f.current}),U===f.current&&ye(!1)}},[]),fn=p.useCallback(U=>{be(ie=>{const Re=x_(ie,U);return ce.current=Re,Re})},[]),Xt=p.useCallback(()=>{var U;(U=j.current)==null||U.requestRefresh()},[]),kn=p.useCallback((U,ie)=>{r(fr(U,ie))},[r]),Te=p.useCallback((U,ie)=>{var Re;q.current={workspaceId:U,paths:ie},(Re=j.current)==null||Re.subscribeFileTree(U,ie)},[]),Be=p.useCallback((U,ie)=>{var Re;B.current={workspaceId:U,paths:ie},(Re=j.current)==null||Re.requestFileTreeRefresh(U,ie)},[]),lt=p.useCallback(U=>(T.current.add(U),()=>{T.current.delete(U)}),[]),Mt=p.useCallback(U=>{var ie;E.current=U,(ie=j.current)==null||ie.subscribeGit(U)},[]),rn=p.useCallback(U=>{var ie;A.current=U,(ie=j.current)==null||ie.requestGitRefresh(U)},[]),Nn=p.useCallback(U=>(P.current.add(U),()=>{P.current.delete(U)}),[]),Vt=p.useCallback(U=>{var ie;H.current=U,(ie=j.current)==null||ie.subscribeWorkspaceManagement(U)},[]),Un=p.useCallback(U=>{var ie;_.current=U,ee(Re=>{var tt;return{...Re,[U]:{detail:((tt=Re[U])==null?void 0:tt.detail)??null,loading:!0,error:null}}}),(ie=j.current)==null||ie.requestWorkspaceManagementRefresh(U)},[]),qn=p.useCallback(U=>(I.current.add(U),()=>{I.current.delete(U)}),[]),En=p.useCallback(async(U,ie=!1)=>{const Re=U.trim();if(!Re)return;let tt=!0;if(pe(St=>{const Ct=St[Re];return!ie&&(Ct!=null&&Ct.loading)?(tt=!1,St):{...St,[Re]:{preview:(Ct==null?void 0:Ct.preview)??null,loading:!0,applying:(Ct==null?void 0:Ct.applying)??!1,cleaning:(Ct==null?void 0:Ct.cleaning)??!1,error:null}}}),!!tt)try{const St=await sL(Re);pe(Ct=>{var mn,Vn;return{...Ct,[Re]:{preview:St,loading:!1,applying:((mn=Ct[Re])==null?void 0:mn.applying)??!1,cleaning:((Vn=Ct[Re])==null?void 0:Vn.cleaning)??!1,error:null}}})}catch(St){pe(Ct=>{var mn,Vn,An;return{...Ct,[Re]:{preview:((mn=Ct[Re])==null?void 0:mn.preview)??null,loading:!1,applying:((Vn=Ct[Re])==null?void 0:Vn.applying)??!1,cleaning:((An=Ct[Re])==null?void 0:An.cleaning)??!1,error:St instanceof Error?St.message:o("shell.worktreeMergePreviewFailed")}}})}},[]),Dn=p.useCallback(async U=>{const ie=U.trim();if(ie){pe(Re=>{var tt,St;return{...Re,[ie]:{preview:((tt=Re[ie])==null?void 0:tt.preview)??null,loading:!1,applying:!0,cleaning:((St=Re[ie])==null?void 0:St.cleaning)??!1,error:null}}});try{const Re=await aL(ie);pe(tt=>{var St;return{...tt,[ie]:{preview:Re.preview,loading:!1,applying:!1,cleaning:((St=tt[ie])==null?void 0:St.cleaning)??!1,error:null}}}),Xt(),Tt(),En(ie,!0),rn(Re.preview.targetWorkspace.id),F.current({title:Re.applied?o("shell.worktreeMergeApplySuccess"):o("shell.worktreeMergeAlreadyMerged"),tone:"success"})}catch(Re){pe(tt=>{var St,Ct;return{...tt,[ie]:{preview:((St=tt[ie])==null?void 0:St.preview)??null,loading:!1,applying:!1,cleaning:((Ct=tt[ie])==null?void 0:Ct.cleaning)??!1,error:Re instanceof Error?Re.message:o("shell.worktreeMergeApplyFailed")}}}),F.current({title:Re instanceof Error?Re.message:o("shell.worktreeMergeApplyFailed"),tone:"error"})}}},[En,Tt,rn,Xt]),zr=p.useCallback(async U=>{var tt,St;const ie=U.workspaceId,Re=Ye&&((St=(tt=ne[ie])==null?void 0:tt.preview)==null?void 0:St.alreadyMerged)===!0;pe(Ct=>{var mn;return{...Ct,[ie]:{preview:((mn=Ct[ie])==null?void 0:mn.preview)??null,loading:!1,applying:!1,cleaning:!0,error:null}}});try{const Ct=await oL(ie,{deleteBranch:Re});if(pe(mn=>{var Vn;return{...mn,[ie]:{preview:((Vn=mn[ie])==null?void 0:Vn.preview)??null,loading:!1,applying:!1,cleaning:!1,error:null}}}),mt(!1),We(mn=>(mn==null?void 0:mn.workspaceId)===ie?null:mn),Xt(),await Tt(),r(ki(U.parentWorkspaceId),{replace:!0}),Ct.branchDeleted){F.current({title:o("shell.worktreeCleanupDeleteBranchSuccess",{branch:Ct.deletedBranchName||U.branchName}),tone:"success"});return}if(Ct.branchDeleteRequested){F.current({title:o("shell.worktreeCleanupDeleteBranchPartialFailed",{branch:U.branchName}),description:Ct.branchDeleteError||void 0,tone:"warning"});return}F.current({title:o("shell.worktreeCleanupSuccess"),tone:"success"})}catch(Ct){pe(mn=>{var Vn;return{...mn,[ie]:{preview:((Vn=mn[ie])==null?void 0:Vn.preview)??null,loading:!1,applying:!1,cleaning:!1,error:Ct instanceof Error?Ct.message:o("shell.worktreeCleanupFailed")}}}),F.current({title:Ct instanceof Error?Ct.message:o("shell.worktreeCleanupFailed"),tone:"error"})}},[Ye,r,Tt,Xt,ne]),hr=p.useCallback(U=>{mt(!1),We(U)},[]),qr=p.useCallback(U=>{var ie;Y.current=U,(ie=j.current)==null||ie.subscribeTerminalManager(U)},[]),xn=p.useCallback(U=>{var ie;z.current=U,(ie=j.current)==null||ie.requestTerminalManagerRefresh(U)},[]),$r=p.useCallback(U=>(Z.current.add(U),()=>{Z.current.delete(U)}),[]),br=p.useCallback((U,ie)=>{be(Re=>S_(Re,U,ie??new Date().toISOString()))},[]),In=p.useCallback(async(U,ie)=>{g.current.set(U,ie),be(Re=>fx(Re,U,ie));try{const Re=await tT(U,ie),tt=Ms(Re);tt===ie?g.current.set(U,tt):g.current.delete(U),fn(Re),Xt(),Tt()}catch(Re){throw g.current.delete(U),be(tt=>fx(tt,U,!ie)),Re}},[Tt,Xt,fn]),Mr=p.useCallback((U,ie)=>{tn("workbench.set_session_workspace",{sessionId:U,workspaceId:ie}),Ht(Re=>{if(!ie){if(!(U in Re))return Re;const tt={...Re};return delete tt[U],tt}return Re[U]===ie?Re:{...Re,[U]:ie}})},[]);p.useEffect(()=>{v.current=D.length>0},[D]),p.useEffect(()=>{tn("workbench.navigation_state",{navigationLoading:le,workspaceCount:D.length,sessionCount:D.reduce((U,ie)=>U+ie.sessions.length,0)})},[D,le]),p.useEffect(()=>{C.current!==null&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>{var sn;C.current=null,!(w.current||v.current)&&(tn("workbench.refresh_navigation.ws_fallback_triggered"),(sn=j.current)==null||sn.requestRefresh())},1200);const U=new FN({onConnectionChange:sn=>{sn==="connected"&&pF(),sn==="reconnect_failed"&&!v.current&&(_e(o("shell.navigationLoadFailed")),F.current({id:"workbench-navigation-connection",title:o("shell.navigationLoadFailed"),tone:"warning",durationMs:3600}))},onSnapshot:sn=>{w.current=!0,tn("workbench.ws_snapshot_received",{workspaceCount:sn.items.length,sessionCount:sn.items.reduce((jr,Os)=>jr+Os.sessions.length,0)}),C.current!==null&&(window.clearTimeout(C.current),C.current=null),Mn(sn),ye(!1)},onFileTreeSnapshot:sn=>{T.current.forEach(jr=>jr(sn))},onGitSnapshot:sn=>{Zr(GT(sn.workspaceId),{status:sn.status,history:sn.history,historyTotalCount:sn.historyTotalCount,historyNextCursor:sn.historyNextCursor,branches:sn.branches}),ee(jr=>{var _l;const Os=((_l=D.find(Ga=>Ga.workspace.id===sn.workspaceId))==null?void 0:_l.workspace)??null;if(!Os)return jr;const Ni=jr[sn.workspaceId],ma=XT(YT((Ni==null?void 0:Ni.detail)??KT(Os),Os),sn);return Zr(Sg(sn.workspaceId),ma),{...jr,[sn.workspaceId]:{detail:ma,loading:!1,error:null}}}),P.current.forEach(jr=>jr(sn))},onWorkspaceManagementSnapshot:sn=>{Zr(Sg(sn.workspaceId),sn),ee(jr=>({...jr,[sn.workspaceId]:{detail:sn,loading:!1,error:null}})),I.current.forEach(jr=>jr(sn))},onTerminalManagerSnapshot:sn=>{Z.current.forEach(jr=>jr(sn))},onUnauthorized:()=>{rr.clear(),r("/login",{replace:!0})}});j.current=U;const ie=q.current,Re=B.current,tt=E.current,St=A.current,Ct=H.current,mn=_.current,Vn=Y.current,An=z.current;return ie&&U.subscribeFileTree(ie.workspaceId,ie.paths),tt&&U.subscribeGit(tt),Ct&&U.subscribeWorkspaceManagement(Ct),Vn&&U.subscribeTerminalManager(Vn),Re&&U.requestFileTreeRefresh(Re.workspaceId,Re.paths),St&&U.requestGitRefresh(St),mn&&U.requestWorkspaceManagementRefresh(mn),An&&U.requestTerminalManagerRefresh(An),U.start(),()=>{C.current!==null&&(window.clearTimeout(C.current),C.current=null),j.current===U&&(j.current=null),U.close()}},[r]),p.useEffect(()=>{lo(Vk,String(Ce))},[Ce]),p.useEffect(()=>{lo(Gk,String(ct))},[ct]),p.useEffect(()=>{lo(Kk,String(ft))},[ft]),p.useEffect(()=>{lo(Yk,String(fe))},[fe]),p.useEffect(()=>{if(!nt){d_(Qp);return}lo(Qp,nt)},[nt]),p.useEffect(()=>{if(Me||fe)return;const U=window.setTimeout(()=>{Le(!0)},TF);return()=>{window.clearTimeout(U)}},[Me,fe]);const Bn=Ac(t.pathname),Q=(Bn==null?void 0:Bn.sessionId)??null,je=Q?rP(Q):!1,G=p.useMemo(()=>TN(D),[D]),Ee=p.useMemo(()=>new Set(Oe),[Oe]),Ge=p.useMemo(()=>G.filter(U=>U.session.isFavorite===!0).map(U=>U.session.sessionId),[G]),At=p.useMemo(()=>new Set(Ge),[Ge]),gn=p.useCallback(U=>{const ie=Zp(U,Oe);m.current=ie,Zr(jc,ie),ce.current=U,be(U)},[Oe]),bn=p.useCallback(U=>{const ie=!Ee.has(U),Re=bx(Oe,U,ie),tt=Zp(D,Re);m.current=tt,Zr(jc,tt),qe(Re),QN(U,{collapsed:ie}).catch(St=>{const Ct=bx(Re,U,!ie),mn=Zp(D,Ct);m.current=mn,Zr(jc,mn),qe(Ct),F.current({title:St instanceof Error?St.message:o("shell.workspaceCollapseStateSaveFailed"),tone:"error"})})},[Ee,Oe,D]),wn=p.useCallback(()=>{X.current={originalGroups:ce.current}},[]),oi=p.useCallback((U,ie,Re)=>{const tt=ce.current,St=v_(tt,U,ie,Re);St!==tt&&gn(St)},[gn]),li=p.useCallback(()=>{const U=X.current;X.current=null;const ie=ce.current;U&&(U.originalGroups.length===ie.length&&U.originalGroups.every((Re,tt)=>{var St;return Re.workspace.id===((St=ie[tt])==null?void 0:St.workspace.id)})||JI({workspaceIds:ie.map(Re=>Re.workspace.id)}).catch(Re=>{gn(U.originalGroups),F.current({title:Re instanceof Error?Re.message:o("shell.workspaceReorderFailed"),tone:"error"})}))},[gn]);p.useEffect(()=>{const U=new Map;if(G.forEach(({session:ie})=>{U.set(ie.sessionId,{activityState:ie.activityState,completedAt:ie.completedAt??null,runningState:ie.runningState??null})}),!de.current){de.current=!0,W.current=U;return}G.forEach(({session:ie})=>{var mn;if(ie.sessionId===Q)return;const Re=W.current.get(ie.sessionId);if(!Re)return;const tt=Re.activityState!=="completed_unread"&&ie.activityState==="completed_unread",St=((mn=ie.title)==null?void 0:mn.trim())||o("common.unknown");if(c&&tt){const Vn=o("conversation.backgroundCompletionToastDescription",{title:St});F.current({id:`workbench-session-completed-${ie.sessionId}-${ie.completedAt??"unknown"}`,title:o("conversation.backgroundCompletionToastTitle"),description:Vn,tone:"success",durationMs:8e3,action:{label:o("shell.contextOpenSession"),onClick:()=>kn(ie.workspaceId,ie.sessionId)}}),te.current.showNotification(o("conversation.backgroundCompletionToastTitle"),Vn)}const Ct=Re.runningState!=="failed"&&(ie.runningState??null)==="failed";if(d&&Ct){const Vn=FF(ie)??o("conversation.runtimeFailed"),An=o("conversation.backgroundFailureToastDescription",{title:St,detail:Vn});F.current({id:`workbench-session-failed-${ie.sessionId}-${ie.updatedAt}`,title:o("conversation.backgroundFailureToastTitle"),description:An,tone:"error",durationMs:8e3,action:{label:o("shell.contextOpenSession"),onClick:()=>kn(ie.workspaceId,ie.sessionId)}}),te.current.showNotification(o("conversation.backgroundFailureToastTitle"),An)}}),W.current=U},[Q,G,c,d,kn]),p.useEffect(()=>{L.current=G.map(U=>U.session).filter(U=>U.sessionId!==Q&&LF(U)).map(U=>{var ie;return{sessionId:U.sessionId,workspaceId:U.workspaceId,title:((ie=U.title)==null?void 0:ie.trim())||o("common.unknown")}})},[Q,G]),p.useEffect(()=>{let U=!1,ie=null;const Re=()=>{ie=window.setTimeout(()=>{tt().finally(()=>{U||Re()})},MF)},tt=async()=>{var Vn;const St=L.current;if(St.length===0){M.current||(M.current=!0);return}(Vn=j.current)==null||Vn.requestRefresh();const Ct=new Set(St.map(An=>An.sessionId)),mn=await Promise.all(St.map(async An=>{try{const sn=await nT(An.sessionId);return{session:An,items:sn.items}}catch{return{session:An,items:null}}}));if(!U){for(const An of mn){if(!An.items)continue;const sn=An.items.filter(Ni=>Ni.status==="pending"),jr=new Set(sn.map(Ni=>Ni.id)),Os=N.current.get(An.session.sessionId)??new Set;M.current&&sn.forEach(Ni=>{if(Os.has(Ni.id)||!u)return;const ma=o("conversation.backgroundPermissionToastDescription",{title:An.session.title,requestTitle:Ni.title});F.current({id:`workbench-permission-request-${Ni.id}`,title:o("conversation.permissionRequestToastTitle"),description:ma,tone:"warning",durationMs:8e3,action:{label:o("shell.contextOpenSession"),onClick:()=>kn(An.session.workspaceId,An.session.sessionId)}}),te.current.showNotification(o("conversation.permissionRequestToastTitle"),ma)}),N.current.set(An.session.sessionId,jr)}for(const[An,sn]of N.current.entries())!Ct.has(An)&&sn.size===0&&N.current.delete(An);M.current=!0}};return tt().finally(()=>{U||Re()}),()=>{U=!0,ie!==null&&window.clearTimeout(ie)}},[u,kn]),p.useEffect(()=>{if(le&&D.length===0)return;const U=new Set(D.map(ie=>ie.workspace.id));qe(ie=>HT(ie,U)),yt(ie=>ie&&U.has(ie)?ie:null)},[D,le]);const Ar=G.find(U=>U.session.sessionId===Q)??null,Rn=(Ar==null?void 0:Ar.workspace.id)??(Q?qt[Q]??null:null),Or=rx(t.pathname,t.search),Vr=Rn??Or??nt??null,Ot=Vr??((ji=D[0])==null?void 0:ji.workspace.id)??null,Br=p.useMemo(()=>Je.filter(U=>!re.has(U.id)),[re,Je]),Ii=p.useMemo(()=>Br.filter(U=>zF(U,Bt)).length,[Br,Bt]);p.useEffect(()=>{ot&&On(Br)},[Br,On,ot]);const Fs=p.useCallback(U=>{kt(!1),U.routePath&&r(U.routePath)},[r]),$=p.useCallback(async(U,ie)=>{const Re=O.current+1;O.current=Re;try{const tt=await uF(U,ie);if(Re!==O.current)return;Pe(St=>{const Ct=new Set(St);return tt.item?Ct.add(tt.item.notificationId):Ct.delete(U),Ct})}catch(tt){if(Re!==O.current)return;F.current({title:o("shell.globalNotificationsArchiveFailed"),description:tt instanceof Error?tt.message:void 0,tone:"error"})}},[]);p.useEffect(()=>{Rn&&yt(U=>U===Rn?U:Rn)},[Rn]),p.useEffect(()=>{tn("workbench.current_workspace_resolved",{currentSessionId:Q,sessionWorkspaceId:Rn,routeWorkspaceId:Or,currentWorkspaceId:Ot,source:Rn?Ar?"navigation":"sessionWorkspaceMap":Or?"route":nt?"workspaceSelection":"navigationFallback"})},[Ar,Q,Ot,Or,nt,Rn]),p.useEffect(()=>{tn("workbench.info_panel_state",{infoPanelReady:Me,rightCollapsed:fe,currentWorkspaceId:Ot,sessionWorkspaceId:Rn,currentSessionId:Q})},[Q,Ot,Me,fe,Rn]);const he=sx(t.pathname)?"terminals":YF(t.pathname)?"butler":"conversation",me=e==="mobile",et=VF(e),st=p.useMemo(()=>D.map(U=>{const ie=MT(U.sessions);return{workspace:U.workspace,visibleSessions:ie,archivedSessions:U.sessions.filter(Re=>Ms(Re)&&!Zh(Re)),visibleSessionTree:Bb(ie).filter(Re=>!At.has(Re.item.sessionId)&&!qh(ps(Re),tt=>At.has(tt.sessionId))),childWorktrees:LT(U.childWorktrees,At),isCollapsed:Ee.has(U.workspace.id)}}),[Ee,At,D]),xt=p.useMemo(()=>Xh(D),[D]),Zt=p.useMemo(()=>p_(D,Ot),[Ot,D]),Ln=p.useMemo(()=>Ot?(Zt==null?void 0:Zt.workspace)??D.map(U=>U.workspace).find(U=>U.id===Ot)??null:null,[Ot,Zt,D]),sr=(Zt==null?void 0:Zt.meta)??null,Sr=(Ot?xt[Ot]??null:null)??(Ln?fu(Ln):null),sa=sr?ne[sr.workspaceId]??null:null,ci=p.useMemo(()=>G.filter(U=>At.has(U.session.sessionId)&&!Ms(U.session)&&!kg(U.session)),[At,G]),Ci=t.pathname.startsWith("/settings")?"settings":sx(t.pathname)?"terminals":KF(t.pathname)?"tools":GF(t.pathname)||ix(t.pathname)?"sessions":"workspaces",ns=me&&Ci==="sessions"&&ix(t.pathname),Er=Vh({isNativeMobile:i.isNativeMobile,viewportClass:i.viewportClass}),aa=hu({viewportClass:i.viewportClass,activeEntry:Ci,hasNavigationPanel:me,hasAuxiliaryPanel:me,preferCompactLayout:Er}),ri=me&&EN(aa),za=me&&IN(aa),oa=p.useMemo(()=>D.map(U=>U.workspace),[D]),Mo=p.useMemo(()=>{const U=zt.trim().toLowerCase();return U?G.filter(ie=>{const Re=(ie.session.title||"").toLowerCase(),tt=ie.workspace.name.toLowerCase(),St=em(ie.session.provider,"full").toLowerCase();return Re.includes(U)||tt.includes(U)||St.includes(U)}):[]},[G,zt]);p.useEffect(()=>{var ie;const U=Ot??((ie=D[0])==null?void 0:ie.workspace.id)??"";U&&$e(Re=>Re&&D.some(St=>St.workspace.id===Re)?Re:U)},[Ot,D]),p.useEffect(()=>{Q&&!je&&lo(Xp,`${t.pathname}${t.search}`)},[Q,je,t.pathname,t.search]),p.useEffect(()=>{if(Q&&je){y.current=`${t.pathname}${t.search}`;return}Q&&!je&&(y.current=null)},[Q,je,t.pathname,t.search]),p.useEffect(()=>{me||(xe(!1),Fe(!1))},[me]),p.useEffect(()=>{!me||le||!$F(t.pathname)||Vr||(xe(!1),Fe(!1),r(et,{replace:!0}))},[Vr,me,t.pathname,r,le,et]);function la(){if(me){xe(!0);return}rt(!1)}function ca(){if(Wr(),me){Fe(!0);return}ue(!1)}function Ao(){if(me){xe(U=>!U);return}rt(U=>!U)}function Ir(){if(Wr(),me){Fe(U=>!U);return}ue(U=>!U)}function Wr(){Le(!0)}function vs(U){yt(U),Wr(),Q&&Rn!==U&&r(et)}const Li=p.useCallback(async U=>{var tt;const ie=((tt=G.find(St=>St.session.sessionId===U))==null?void 0:tt.session)??null,Re=(ie==null?void 0:ie.isFavorite)!==!0;be(St=>gx(St,U,Re));try{const St=await rL(U,Re);fn(St),Xt()}catch(St){throw be(Ct=>gx(Ct,U,!Re)),St}},[G,Xt,fn]),qa=p.useCallback((U,ie)=>{DT(U,ie).then(()=>{r(PN(U,ie))}).catch(Re=>{a({title:Re instanceof Error?Re.message:o("shell.startSessionFailed"),tone:"error"})})},[r,a]),ua=p.useCallback(U=>{var tt;const ie=((tt=U.workspaceId)==null?void 0:tt.trim())||Ot,Re=XF(U.filePath);return!ie||!Re?!1:(Wr(),ut("files"),me?(xe(!1),Fe(!0)):ue(!1),nn({requestId:x.current+1,workspaceId:ie,filePath:Re,openViewer:U.openViewer===!0}),x.current+=1,!0)},[Ot,me]),da=p.useCallback(async(U,ie)=>{const Re=await eT(U,ie.trim());return fn(Re),Re},[fn]);function Fi(U){Dt(!0)}function _s(){Dt(!1),Qt("sessions"),on(""),ln(null),dn([]),Wt(!1)}async function rs(){const U=zt.trim();if(!U||!ae.trim()){dn([]),ln(null);return}Wt(!0),ln(null);try{const ie=await Cc(ae,U);dn(ie.items)}catch(ie){dn([]),ln(ie instanceof Error?ie.message:o("shell.searchCodeFailed"))}finally{Wt(!1)}}function $a(U,ie){const Re=U==="left"?Ce:ct;function tt(Ct){const mn=Ct.clientX-ie;if(U==="left"){Nt(xd(Re+mn,wd,Qk));return}gt(xd(Re-mn,wd,Jk))}function St(){document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",St)}document.addEventListener("mousemove",tt),document.addEventListener("mouseup",St)}function V(){if(Ie())return;if(G.length===0){r(et);return}const U=fr(G[0].workspace.id,G[0].session.sessionId);r(U)}function ge(){if(!Ie(Ot)){if(Ot){r(yo(Ot));return}r(et)}}function Ie(U){if(Q)return U&&Rn&&Rn!==U?!1:(r(`${t.pathname}${t.search}`),!0);if(y.current){if(U){const[Re,tt=""]=y.current.split("?"),St=rx(Re??y.current,tt?`?${tt}`:"");if(St&&St!==U)return!1}return r(y.current),!0}const ie=typeof window>"u"?null:window.localStorage.getItem(Xp);if(ie){const Re=ie.split("?")[0]??ie,tt=Ac(Re);if(tt){const St=tt.sessionId,Ct=G.find(An=>An.session.sessionId===St)??null,mn=tt.workspaceId??(Ct==null?void 0:Ct.workspace.id)??null;if(Ct!==null&&(!U||mn===U))return r(ie),!0}window.localStorage.removeItem(Xp)}return!1}p.useEffect(()=>{if(typeof window>"u")return;function U(ie){if(!(ie.metaKey||ie.ctrlKey)){ie.key==="Escape"&&(xe(!1),Fe(!1));return}if(h_(ie.target))return;const tt=ie.key.toLowerCase();if(!ie.shiftKey&&tt==="b"){ie.preventDefault(),Ao();return}if(ie.shiftKey&&tt==="i"){ie.preventDefault(),Ir();return}if(!ie.shiftKey&&tt===","){ie.preventDefault(),r("/settings");return}if(!ie.shiftKey&&tt==="1"){ie.preventDefault(),V();return}if(!ie.shiftKey&&tt==="2"){ie.preventDefault(),r(Ot?fl(Ot):Ri());return}if(!ie.shiftKey&&tt==="k"){ie.preventDefault(),m_();return}ie.shiftKey&&tt==="r"&&(ie.preventDefault(),Tt())}return window.addEventListener("keydown",U),()=>{window.removeEventListener("keydown",U)}},[r,Tt,me,V]);const at=p.useMemo(()=>({shellMode:e,navigationGroups:D,navigationLoading:le,navigationError:Se,currentWorkspaceId:Ot,currentSessionId:Q,favoriteSessionIds:Ge,favoriteSessions:ci,globalNotifications:Je,archivedNotificationIds:Array.from(re),showArchivedNotifications:an,unreadNotificationCount:Ii,refreshNavigation:Tt,requestNavigationRefresh:Xt,openNotificationPanel:()=>{kt(!0)},closeNotificationPanel:()=>{kt(!1)},setShowArchivedNotifications:$t,archiveNotification:U=>{$(U,!0)},unarchiveNotification:U=>{$(U,!1)},setAuxiliaryPanel:It,subscribeFileTree:Te,requestFileTreeRefresh:Be,addFileTreeSnapshotListener:lt,subscribeGitSnapshot:Mt,requestGitRefresh:rn,addGitSnapshotListener:Nn,subscribeWorkspaceManagementSnapshot:Vt,requestWorkspaceManagementRefresh:Un,addWorkspaceManagementSnapshotListener:qn,workspaceManagementStateById:hn,subscribeTerminalManagerSnapshot:qr,requestTerminalManagerRefresh:xn,addTerminalManagerSnapshotListener:$r,selectWorkspace:vs,toggleFavoriteSession:Li,archiveSession:U=>In(U,!0),unarchiveSession:U=>In(U,!1),renameSession:da,startDraftSession:qa,markNavigationSessionSeen:br,upsertNavigationSession:fn,setSessionWorkspace:Mr,revealWorkspaceFile:ua}),[lt,Nn,qn,$r,In,Q,Ot,Je,Ge,ci,vs,re,br,Se,D,le,Ii,Be,rn,Un,Tt,Xt,$t,It,xn,da,an,hn,e,qa,Mr,Te,Mt,Vt,qr,$,Li,fn,ua]),vt={"--workbench-left-width":`${Ce}px`,"--workbench-left-current-width":ft?"0px":`${Ce}px`,"--workbench-right-width":`${ct}px`,"--workbench-right-current-width":fe?"0px":`${ct}px`},un=he==="butler"?dt:n.jsx(yx,{panelReady:Me,activeTab:pt,fileRevealRequest:Jt,onTabChange:U=>{Wr(),ut(U)},currentSessionId:je?null:Q,activeWorkspaceId:Ot,navigationGroups:D,workspaceContext:Sr,worktreeMeta:sr,worktreeMergeState:sa,onRefreshWorktreeMergePreview:En,onApplyWorktreeMerge:Dn,onCleanupWorktree:zr}),Lt=un!==null,Qn=me?n.jsx(wx,{workspaceGroups:st,workspaceVisualContextMap:xt,favoriteSessions:ci,favoriteSessionIds:At,activeWorkspaceId:Ot,isConversationActive:he==="conversation",isTerminalActive:he==="terminals",isButlerActive:he==="butler",isSearchOpen:Ft,navigationLoading:le,navigationError:Se,activeSessionId:Q,onRefreshNavigation:Tt,onSessionUpdated:fn,onNavigateConversation:V,onNavigateTerminals:()=>{xe(!1),r(Ot?fl(Ot):Ri())},onNavigateButler:()=>{xe(!1),r(Ot?ko(Ot):Ri())},onOpenSearch:()=>{xe(!1),Fi()},onOpenSettings:()=>{xe(!1),r("/settings")},onSelectWorkspace:vs,onToggleWorkspaceCollapse:bn,onStartWorkspaceReorder:wn,onPreviewWorkspaceReorder:oi,onCommitWorkspaceReorder:li,allowWorkspaceReorder:!1,subscribeGitSnapshot:Mt,requestGitRefresh:rn,subscribeWorkspaceManagementSnapshot:Vt,requestWorkspaceManagementRefresh:Un,onToggleFavoriteSession:Li,onArchiveSession:U=>In(U,!0),onUnarchiveSession:U=>In(U,!1),workspaceManagementStateById:hn,setWorkspaceManagementStateById:ee,unreadNotificationCount:Ii,notificationPanelOpen:ot,onToggleNotificationPanel:()=>{kt(U=>!U)},onClose:()=>xe(!1)}):null,Gr=me&&Lt?un:null;return n.jsxs(RT.Provider,{value:at,children:[me?n.jsx(n.Fragment,{children:n.jsx(hI,{activeEntry:Ci,presentation:ns?"conversation-focus":"default",navigationPanel:Qn,auxiliaryPanel:Gr,onOpenNavigation:()=>{Fe(!1),xe(!0)},onOpenSearch:()=>{xe(!1),Fe(!1),Fi()},onOpenAuxiliary:()=>{Lt&&(Wr(),xe(!1),Fe(!0))},onNavigateWorkspaces:()=>{xe(!1),Fe(!1),r(Ri())},onNavigateTerminals:()=>{xe(!1),Fe(!1),r(Ot?fl(Ot):Ri())},onNavigateSessions:()=>{xe(!1),Fe(!1),ge()},onNavigateTools:()=>{xe(!1),Fe(!1),r(Ot?Dl(Ot):Ri())},onNavigateToolFiles:()=>{xe(!1),Fe(!1),r(Ot?jN(Ot):Ri())},onNavigateToolGit:()=>{xe(!1),Fe(!1),r(Ot?NN(Ot):Ri())},onNavigateToolProcesses:()=>{xe(!1),Fe(!1),r(Ot?$h(Ot):Ri())},onNavigateSettings:()=>{xe(!1),Fe(!1),r("/settings")},children:n.jsx(hg,{})})}):n.jsx("div",{className:"workbench-shell",style:vt,"data-nav-loading":le,"data-left-collapsed":ft,"data-right-collapsed":fe,"data-info-ready":Me,"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":ft,children:n.jsx(wx,{workspaceGroups:st,workspaceVisualContextMap:xt,favoriteSessions:ci,favoriteSessionIds:At,activeWorkspaceId:Ot,isConversationActive:he==="conversation",isTerminalActive:he==="terminals",isButlerActive:he==="butler",isSearchOpen:Ft,navigationLoading:le,navigationError:Se,activeSessionId:Q,onRefreshNavigation:Tt,onSessionUpdated:fn,onNavigateConversation:V,onNavigateTerminals:()=>r(Ot?fl(Ot):Ri()),onNavigateButler:()=>r(Ot?ko(Ot):Ri()),onOpenSearch:()=>Fi(),onOpenSettings:()=>r("/settings"),onSelectWorkspace:vs,onToggleWorkspaceCollapse:bn,onStartWorkspaceReorder:wn,onPreviewWorkspaceReorder:oi,onCommitWorkspaceReorder:li,allowWorkspaceReorder:!0,subscribeGitSnapshot:Mt,requestGitRefresh:rn,subscribeWorkspaceManagementSnapshot:Vt,requestWorkspaceManagementRefresh:Un,onToggleFavoriteSession:Li,onArchiveSession:U=>In(U,!0),onUnarchiveSession:U=>In(U,!1),workspaceManagementStateById:hn,setWorkspaceManagementStateById:ee,unreadNotificationCount:Ii,notificationPanelOpen:ot,onToggleNotificationPanel:()=>{kt(U=>!U)},onToggleCollapse:()=>rt(!0)})}),n.jsx("div",{className:"workbench-side-resizer","data-side":"left","data-collapsed":ft,role:"separator","aria-label":o("shell.leftResizerLabel"),onMouseDown:ft?void 0:U=>$a("left",U.clientX)}),n.jsxs("div",{className:"workbench-main-shell",children:[n.jsxs("div",{className:"workbench-collapsed-rail","aria-hidden":!ft&&!fe,children:[n.jsxs("div",{className:"workbench-collapsed-controls left","data-visible":ft,children:[n.jsx(vx,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:o("shell.showSessionSidebar"),side:"left",collapsed:!0,onClick:la}),n.jsx(JT,{unreadCount:Ii,open:ot,onToggle:()=>{kt(U=>!U)},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(ZT,{})}),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(eP,{})})]}),Lt?n.jsx("div",{className:"workbench-collapsed-controls right","data-visible":fe,children:n.jsx(vx,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:o("shell.showInfoSidebar"),side:"right",collapsed:!0,onClick:ca})}):null]}),n.jsx(hg,{})]}),Lt?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"workbench-side-resizer","data-side":"right","data-collapsed":fe,role:"separator","aria-label":o("shell.rightResizerLabel"),onMouseDown:fe?void 0:U=>$a("right",U.clientX)}),n.jsx("aside",{className:"workbench-auxiliary surface-card","data-workspace-tone":(Sr==null?void 0:Sr.tone)??"root","data-worktree-depth":(Sr==null?void 0:Sr.depth)??0,"data-collapsed":fe,"data-custom-panel":he==="butler",style:Xi(Sr),children:he==="butler"?n.jsx("div",{className:"workbench-auxiliary-custom-panel",children:dt}):n.jsx(yx,{panelReady:Me,activeTab:pt,fileRevealRequest:Jt,onTabChange:U=>{Wr(),ut(U)},onToggleCollapse:()=>ue(!0),currentSessionId:je?null:Q,activeWorkspaceId:Ot,navigationGroups:D,workspaceContext:Sr,worktreeMeta:sr,worktreeMergeState:sa,onRefreshWorktreeMergePreview:En,onApplyWorktreeMerge:Dn,onCleanupWorktree:hr})})]}):null]})}),n.jsx(M_,{open:ot,notifications:Je,archivedNotificationIds:re,showArchivedNotifications:an,onClose:()=>kt(!1),onToggleShowArchivedNotifications:$t,onArchiveNotification:U=>{$(U,!0)},onUnarchiveNotification:U=>{$(U,!1)},onSelectNotification:Fs,preferredWorkspaceId:Ot,preferredSessionId:je?null:Q}),n.jsx(G_,{open:Ft,mode:bt,keyword:zt,codeWorkspaceId:ae,codeResults:Ut,codeLoading:ht,codeError:jn,workspaceOptions:oa,sessionResults:Mo,onClose:_s,onModeChange:U=>{Qt(U),ln(null),dn([])},onKeywordChange:U=>{on(U),bt==="code"&&!U.trim()&&(dn([]),ln(null))},onCodeWorkspaceChange:U=>$e(U),onCodeSearch:()=>{rs()},onOpenSession:U=>{_s();const ie=G.find(Re=>Re.session.sessionId===U)??null;r(ie?fr(ie.workspace.id,U):Ri())}}),n.jsxs(Hn,{open:ve!==null,title:o("shell.worktreeCleanupModalTitle"),description:o("shell.worktreeCleanupModalDescription"),onClose:()=>{var U;ve&&((U=ne[ve.workspaceId])!=null&&U.cleaning)||(mt(!1),We(null))},children:[n.jsx("p",{className:"workbench-section-empty",children:ve?o("shell.worktreeCleanupConfirm",{name:ve.displayName||ve.branchName}):""}),ve?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:Ye,disabled:!!((_i=ne[ve.workspaceId])!=null&&_i.cleaning)||((ws=(Fn=ne[ve.workspaceId])==null?void 0:Fn.preview)==null?void 0:ws.alreadyMerged)!==!0,onChange:U=>mt(U.target.checked)}),n.jsx("span",{children:o("shell.worktreeCleanupDeleteBranchLabel",{branch:ve.branchName})})]}),((Wn=(Oi=ne[ve.workspaceId])==null?void 0:Oi.preview)==null?void 0:Wn.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:!!(ve&&((Va=ne[ve.workspaceId])!=null&&Va.cleaning)),onClick:()=>{mt(!1),We(null)},children:o("common.cancel")}),n.jsx("button",{type:"button",className:Ye&&ve&&((Eo=(ha=ne[ve.workspaceId])==null?void 0:ha.preview)==null?void 0:Eo.alreadyMerged)===!0?"secondary-button workbench-danger-button":"primary-button",disabled:!ve||!!(ve&&((Io=ne[ve.workspaceId])!=null&&Io.cleaning)),onClick:()=>{ve&&zr(ve)},children:ve&&((Lo=ne[ve.workspaceId])!=null&&Lo.cleaning)?o("shell.worktreeCleanupRunning"):Ye&&ve&&((ys=(Fo=ne[ve.workspaceId])==null?void 0:Fo.preview)==null?void 0:ys.alreadyMerged)===!0?o("shell.worktreeCleanupDeleteBranchAction"):o("shell.worktreeCleanupAction")})]})]}),me?n.jsxs(n.Fragment,{children:[ri?null:n.jsx(kx,{isOpen:we,side:"left",onClose:()=>xe(!1),children:Qn}),za?null:n.jsx(kx,{isOpen:Qe,side:"right",onClose:()=>Fe(!1),children:Gr})]}):null]})}function kx({isOpen:e,side:t,onClose:r,children:i,className:a,overlayClassName:u}){if(!e)return null;const c=n.jsxs(n.Fragment,{children:[n.jsx("div",{className:["mobile-nav-overlay","open",u].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"?c:Xn.createPortal(c,document.body)}function gr(){return p.useContext(RT)??{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 rP(e){return e.startsWith("draft-")}function ef(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 Z_=new Set(["updateplan"]),iP=new Set(["todowrite"]),Cg=new Set(["todoread"]),sP=new Set(["taskcreate","taskupdate","taskget","tasklist","taskdelete","taskremove"]);function eO(e,t){const r=nO(e,t);return r||rO(e,t)}function aP(e){return e.reduce((t,r)=>(t[r.status]+=1,t),{pending:0,in_progress:0,completed:0,failed:0,cancelled:0})}function tO(e,t,r){if(!e)return null;if(jg(e.name)){const c=yl(e);if(!c||!rm(c.value))return null;const d=oP(c.value,r);return!d||d.items.length===0?null:{provider:t,source:"plan",explanation:d.explanation,items:d.items,updatedAt:r}}const i=nm(e.name);if(!iP.has(i)&&!Cg.has(i)&&!sP.has(i))return null;const a=yl(e,(Cg.has(i),"prefer-output"));if(!a)return null;if(i==="taskdelete"||i==="taskremove"){const c=lP(a.value);return c.length>0?{provider:t,source:"todo",explanation:null,items:c.map((d,m)=>({id:d,title:`Task ${m+1}`,status:"cancelled",detail:d,updatedAt:r})),updatedAt:r}:null}const u=Dc(a.value,r);return u.length===0?null:{provider:t,source:jg(e.name)?"plan":"todo",explanation:null,items:u,updatedAt:r}}function nO(e,t){let r=null;for(const i of e){const a=i.toolCall;if(!a||nm(a.name)===""||!jg(a.name))continue;const u=yl(a);if(!u||typeof u.value!="object"||u.value===null)continue;const c=oP(u.value,i.timestamp);!c||c.items.length===0||(r={provider:t,source:"plan",explanation:c.explanation,items:c.items,updatedAt:i.timestamp})}return r}function rO(e,t){const r=new Map;let i=null;for(const u of e){const c=u.toolCall;if(!c)continue;const d=nm(c.name);if(iP.has(d)){const v=yl(c),g=v?Dc(v.value,u.timestamp):[];g.length>0&&(tf(r,g),i=u.timestamp);continue}if(Cg.has(d)){const v=yl(c,"prefer-output"),g=v?Dc(v.value,u.timestamp):[];g.length>0&&(tf(r,g),i=u.timestamp);continue}if(!sP.has(d))continue;const m=yl(c,"prefer-output");if(!m)continue;if(d==="tasklist"||d==="taskget"){const v=Dc(m.value,u.timestamp);v.length>0&&(tf(r,v),i=u.timestamp);continue}if(d==="taskdelete"||d==="taskremove"){const v=lP(m.value);if(v.length>0){for(const g of v)r.delete(g);i=u.timestamp}continue}const f=Dc(m.value,u.timestamp);if(f.length!==0){for(const v of f)sO(r,v);i=u.timestamp}}const a=Array.from(r.values()).sort((u,c)=>u.updatedAt.localeCompare(c.updatedAt)).map(u=>({...u}));return a.length===0||!i?null:{provider:t,source:"todo",explanation:null,items:a,updatedAt:i}}function jg(e){return Z_.has(nm(e))}function oP(e,t){const r=Array.isArray(e.plan)?e.plan:null;if(!r||r.length===0)return null;const i=r.map((a,u)=>cP(a,{fallbackIdPrefix:"plan",fallbackTitle:`Step ${u+1}`,fallbackStatus:"pending",updatedAt:t})).filter(a=>a!==null);return i.length===0?null:{items:i,explanation:lr(e.explanation)}}function yl(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=iO(i.text);if(a!==null)return{value:a,source:i.source}}return null}function iO(e){const t=(e==null?void 0:e.trim())??"";if(!t)return null;const r=Cd(t);if(r!==null)return r;const i=t.match(/```(?:json)?\s*([\s\S]+?)```/i);if(i!=null&&i[1]){const m=Cd(i[1].trim());if(m!==null)return m}const a=t.indexOf("{"),u=t.lastIndexOf("}");if(a>=0&&u>a){const m=Cd(t.slice(a,u+1));if(m!==null)return m}const c=t.indexOf("["),d=t.lastIndexOf("]");return c>=0&&d>c?Cd(t.slice(c,d+1)):null}function Cd(e){try{return JSON.parse(e)}catch{return null}}function Dc(e,t){return Ec(e).map((i,a)=>cP(i,{fallbackIdPrefix:"task",fallbackTitle:`Task ${a+1}`,fallbackStatus:"pending",updatedAt:t})).filter(i=>i!==null)}function Ec(e){if(Array.isArray(e))return e.flatMap(r=>Ec(r));if(!rm(e))return[];if(cO(e))return[e];const t=["tasks","todos","items","entries","results","data"];for(const r of t){if(!(r in e))continue;const i=Ec(e[r]);if(i.length>0)return i}return Object.values(e).flatMap(r=>Ec(r))}function lP(e){const r=Ec(e).map(a=>Ng(a)).filter(a=>a!==null);if(r.length>0)return r;if(!rm(e))return[];const i=Ng(e);return i?[i]:[]}function cP(e,t){if(!rm(e))return null;const r=lr(e.step)??lr(e.title)??lr(e.content)??lr(e.task)??lr(e.text)??lr(e.name)??lr(e.subject)??lr(e.description)??t.fallbackTitle,i=Ng(e)??lO(t.fallbackIdPrefix,r),a=oO(e,r);return{id:i,title:r,status:aO(e.status,t.fallbackStatus),detail:a,updatedAt:t.updatedAt}}function sO(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 tf(e,t){e.clear();for(const r of t)e.set(r.id,{...r})}function aO(e,t){var i;const r=(i=lr(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 oO(e,t){const r=[lr(e.detail),lr(e.details),lr(e.description),lr(e.reason),lr(e.summary),lr(e.note),lr(e.priority)].filter(i=>i!==null);for(const i of r)if(i!==t)return i;return null}function Ng(e){return lr(e.id)??lr(e.taskId)??lr(e.task_id)??lr(e.uuid)??lr(e.key)}function lO(e,t){return`${e}:${t.trim().toLowerCase()}`}function cO(e){return[e.step,e.title,e.content,e.task,e.text,e.subject,e.name,e.description].some(t=>lr(t)!==null)}function nm(e){return e.trim().toLowerCase().replace(/[\s_.-]+/g,"")}function rm(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function lr(e){if(typeof e!="string")return null;const t=e.trim();return t||null}function uO(){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 dO(){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 hO(){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 mO(){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 pO({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 fO(){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 xx={in_progress:0,failed:1,pending:2,completed:3,cancelled:4};function gO({provider:e,messages:t,variant:r="header"}){const[i,a]=p.useState(!1),u=p.useMemo(()=>eO(t,e),[t,e]);if(!u||u.items.length===0)return null;const c=aP(u.items),d=c.in_progress||c.pending,m=d>0?d:u.items.length,f=[...u.items].sort((g,w)=>{const y=xx[g.status]-xx[w.status];return y!==0?y:g.updatedAt.localeCompare(w.updatedAt)}),v=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:v,"data-variant":r,"aria-label":o("conversation.taskProgressButton",{count:u.items.length}),title:o("conversation.taskProgressButton",{count:u.items.length}),onClick:()=>{a(!0)},children:[n.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:n.jsx(fO,{})}),n.jsx("span",{className:"conversation-task-progress-badge",children:m})]}),n.jsx(Hn,{open:i,title:o("conversation.taskProgressModalTitle"),description:o("conversation.taskProgressModalDescription",{count:u.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(hc,{label:o("conversation.taskProgressSummaryTotal"),value:u.items.length}),n.jsx(hc,{label:o("conversation.taskProgressStatusInProgress"),value:c.in_progress}),n.jsx(hc,{label:o("conversation.taskProgressStatusPending"),value:c.pending}),n.jsx(hc,{label:o("conversation.taskProgressStatusCompleted"),value:c.completed}),c.failed>0?n.jsx(hc,{label:o("conversation.taskProgressStatusFailed"),value:c.failed}):null]}),u.explanation?n.jsxs("div",{className:"conversation-task-progress-explanation",children:[n.jsx("strong",{children:o("conversation.taskProgressExplanationTitle")}),n.jsx("p",{children:u.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:bO(g.status)})]}),g.detail?n.jsx("p",{className:"conversation-task-progress-item-detail",children:g.detail}):null]})]},g.id))})]})})]})}function hc({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 bO(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 vO="codingns.conversation.composer-draft:",wO=1,yO=[{id:"builtin-stage-and-summarize",text:"请将本次会话变更的所有代码提交到git暂存区,然后总结一条中文的提交信息"},{id:"builtin-review-module",text:"分析本项目 模块的代码实现,并分析存在的问题"},{id:"builtin-group-commits",text:"分析当前项目中的未提交文件,按照功能模块进行分类提交,提交信息格式请参考我最近的提交记录"}];function Wb(){return typeof window<"u"&&typeof window.localStorage<"u"}function kO(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,u="lastModified"in e?e.lastModified:null,c="contentBase64"in e?e.contentBase64:null;if(typeof t!="string"||typeof r!="string"||typeof i!="string"||typeof a!="number"||typeof u!="number"||typeof c!="string")return null;const d=t.trim(),m=r.trim(),f=i.trim(),v=c.trim();return!d||!m||!f||a<0||u<0||!v?null:{id:d,fileName:m,mimeType:f,fileSize:a,lastModified:u,contentBase64:v}}function xO(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=>kO(a)).filter(a=>a!==null);return i.length!==r.length||t.length===0&&i.length===0?null:{content:t,attachments:i}}function Ic(e){return`${vO}${e}`}function SO(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 CO(e){if(!Wb())return null;const t=e.trim();if(!t)return null;const r=window.localStorage.getItem(Ic(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,u=xO(a);return u||(window.localStorage.removeItem(Ic(t)),null)}catch{return window.localStorage.removeItem(Ic(t)),null}}function jO(e,t){if(!Wb())return!1;const r=e.trim();if(!r)return!1;if(t.content.length===0&&t.attachments.length===0)return uP(r),!0;try{return window.localStorage.setItem(Ic(r),JSON.stringify({schemaVersion:wO,draft:t})),!0}catch{return!1}}function uP(e){if(!Wb())return;const t=e.trim();t&&window.localStorage.removeItem(Ic(t))}const Sx="workbench:focus-composer",Lc="provider-default",Cx=["codex","claude-code","opencode","gemini","kimi"],NO=new Set(["codex","claude-code","opencode"]),TO=new Set(["codex","claude-code","opencode"]),jx={position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function PO(e){return[{id:Lc,name:o("conversation.modelUseCliDefault"),provider:e,usesProviderDefault:!0}]}function Nx(e){return PO(e)}function Tx(e){return e.usesProviderDefault===!0||e.id===Lc}function DO(){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 Px(e){if(e){e.value="";try{const t=e.showPicker;if(typeof t=="function"){t.call(e);return}}catch{}e.click()}}function RO(e,t,r,i){const a=globalThis.atob(r),u=Uint8Array.from(a,c=>c.charCodeAt(0));return new File([u],e,{type:t,lastModified:i})}function MO(e){const t=RO(e.fileName,e.mimeType,e.contentBase64,e.lastModified);return{id:e.id,file:t,previewUrl:URL.createObjectURL(t)}}function AO(e){const t=e.trim().replace(/\s+/g," ");return t.length===0?o("conversation.forkDraftEmpty"):t.length>140?`${t.slice(0,140)}…`:t}function EO(e,t){return t===e?TO.has(t)?null:o("conversation.forkProviderNativeUnsupported"):NO.has(t)?null:o("conversation.forkProviderReconstructedUnsupported")}function dP(e){return(e==null?void 0:e.canStartSession)===!1}function IO(e){return dP(e)?(e==null?void 0:e.limitations[0])??o("conversation.capabilityDenied"):null}function LO(e,t){return{id:t,kind:"image",fileName:e.name,mimeType:e.type||"image/png",fileSize:e.size}}function Dx(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:"",u=a.includes(",")?a.split(",").at(-1)??"":a;t(u)},i.readAsDataURL(e)})}function FO(e){e.forEach(t=>{URL.revokeObjectURL(t.previewUrl)})}function _O(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 OO(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 u=`${a.name}:${a.size}:${a.lastModified}`;r.has(u)||(r.add(u),i.push({id:DO(),file:a,previewUrl:URL.createObjectURL(a)}))}),i}function Ub({capabilities:e,placeholder:t,draftStorageId:r,forkDraft:i=null,onClearForkDraft:a,onForkDraftChange:u,panelRef:c,portalContainer:d=null,hasActiveRun:m=null,canInterrupt:f=null,contextUsage:v=null,taskProvider:g=null,taskMessages:w=[],hasPendingQueuedMessages:y=!1,isSubmitting:x,isRunning:C=!1,onInterrupt:j,onQueueSend:T,onSend:P}){const I=cr(),Z=p.useId(),q=p.useId(),[B,E]=p.useState(""),[A,H]=p.useState(""),[_,Y]=p.useState("medium"),[z,K]=p.useState([]),[O,F]=p.useState(!1),[te,de]=p.useState(yO),[W,M]=p.useState(!1),[N,L]=p.useState(!1),[X,D]=p.useState(""),[be,ce]=p.useState(!1),[le,ye]=p.useState(!1),[Se,_e]=p.useState(!1),[Ce,Nt]=p.useState(!1),[ct,gt]=p.useState(null),[ft,rt]=p.useState(!1),[fe,ue]=p.useState({}),[Oe,qe]=p.useState(null),nt=p.useRef(null),yt=p.useRef(null),Me=p.useRef(null),Le=p.useRef(!1),pt=p.useRef(new Set),ut=p.useRef(new Map),we=p.useRef(0),{showToast:xe}=ir(),Qe=ts(),Fe=_L(e),dt=To(G=>_p(Fe)?G.profile.providers[Fe]:null),It=(dt==null?void 0:dt.defaultModel)??null,qt=(dt==null?void 0:dt.defaultReasoningLevel)??null,Ht=p.useMemo(()=>ef(e,"send_message"),[e]),Ft=p.useMemo(()=>ef(e,"interrupt"),[e]),Dt=p.useMemo(()=>ef(e,"attachments"),[e]),bt=p.useMemo(()=>{var Ee;const G=(Ee=e==null?void 0:e.modelOptions)==null?void 0:Ee.map(Ge=>{var At;return{...Ge,provider:Fe,supportedReasoningEfforts:(At=Ge.supportedReasoningEfforts)==null?void 0:At.filter(gn=>gn==="low"||gn==="medium"||gn==="high"||gn==="xhigh")}});return G!=null&&G.length?G:Nx(Fe)},[e==null?void 0:e.modelOptions,Fe]),Qt=p.useMemo(()=>bt.find(G=>G.id===A)??null,[bt,A]),zt=BL(e),on=OL(e),ae=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")}],[]),$e=p.useMemo(()=>{if(!zt)return[];const G=Qt==null?void 0:Qt.supportedReasoningEfforts;return!G||G.length===0?ae:ae.filter(Ee=>G.includes(Ee.value))},[zt,ae,Qt==null?void 0:Qt.supportedReasoningEfforts]),ht=p.useMemo(()=>bt.map(G=>({value:G.id,label:Tx(G)?o("conversation.modelUseCliDefault"):G.name})),[bt]),Wt=p.useMemo(()=>$e.map(G=>({value:G.value,label:G.label})),[$e]),jn=p.useMemo(()=>[{command:"/plan",label:o("conversation.slashCommandPlan")},{command:"/review",label:o("conversation.slashCommandReview")},{command:"/explain",label:o("conversation.slashCommandExplain")}],[]),ln=(e==null?void 0:e.inRunInputMode)??"none",Ut=!!i,dn=(i==null?void 0:i.targetProvider)??null,Jt=!!i&&(e==null?void 0:e.provider)===dn,nn=p.useMemo(()=>i?Jt?e:ct??Fa(i.targetProvider):null,[e,ct,i,Jt]),hn=p.useMemo(()=>{var Ee;if(!i)return[];const G=(Ee=nn==null?void 0:nn.modelOptions)==null?void 0:Ee.map(Ge=>{var At;return{...Ge,provider:i.targetProvider,supportedReasoningEfforts:(At=Ge.supportedReasoningEfforts)==null?void 0:At.filter(gn=>gn==="low"||gn==="medium"||gn==="high"||gn==="xhigh")}});return G!=null&&G.length?G:Nx(i.targetProvider)},[nn==null?void 0:nn.modelOptions,i]),ee=p.useMemo(()=>hn.map(G=>({value:G.id,label:Tx(G)?o("conversation.modelUseCliDefault"):G.name})),[hn]),ne=p.useMemo(()=>!i||!i.targetModel?Lc:hn.some(G=>G.id===i.targetModel)?i.targetModel:Lc,[hn,i]),pe=p.useMemo(()=>i?Cx.filter(G=>EO(i.sourceProvider,G)!==null?!1:!dP(fe[G]??null)):[],[i,fe]),ve=p.useMemo(()=>i?pe.length>0?pe:[i.targetProvider]:[],[i,pe]),We=p.useMemo(()=>ve.map(G=>({value:G,label:Zi(G,"full")})),[ve]),Ye=p.useMemo(()=>i?IO(fe[i.targetProvider]??nn??null):null,[nn,i,fe]),mt=m??null,Je=C&&ln==="streaming_guidance"&&mt===!1&&!pT(e),Ke=!Ut&&C&&ln==="streaming_guidance"&&!Je,re=!Ut&&C&&typeof T=="function"&&WL(e,mt),Pe=!Ut&&C&&!Ke&&!re,ot=Ut&&!!Ye,kt=B.trim().length>0||z.length>0,an=f??Ft.allowed,Bt=C&&an&&!!j&&!Se&&!kt&&!Ce&&!x,_t=!Bt&&!kt&&(Ce||x||C||!C&&y),Sn=o(Ce||x||y?"conversation.sendingState":"conversation.runtimeRunning"),On=o(C?re?"conversation.queueGuidanceButton":Ke?"conversation.sendGuidanceButton":"conversation.sendButton":"conversation.sendButton"),Mn=p.useCallback(G=>{H(G),_p(Fe)&&bh({providers:{[Fe]:{defaultModel:G}}}).catch(()=>{})},[Fe]),Tt=p.useCallback(G=>{Y(G),_p(Fe)&&bh({providers:{[Fe]:{defaultReasoningLevel:G}}}).catch(()=>{})},[Fe]),fn=p.useCallback(G=>{pt.current.forEach(Ee=>{URL.revokeObjectURL(Ee)}),pt.current.clear(),G.forEach(Ee=>{pt.current.add(Ee.previewUrl)}),K(G)},[]),Xt=p.useCallback(G=>{const{accepted:Ee,rejectedCount:Ge}=_O(G);Ge>0&&xe({title:o("conversation.attachmentImageOnly"),tone:"error"}),Ee.length!==0&&K(At=>{const gn=OO(At,Ee);return gn.forEach(bn=>{pt.current.add(bn.previewUrl)}),gn})},[xe]),kn=p.useCallback(G=>{ut.current.delete(G),K(Ee=>{const Ge=Ee.find(At=>At.id===G);return Ge&&(pt.current.delete(Ge.previewUrl),URL.revokeObjectURL(Ge.previewUrl)),Ee.filter(At=>At.id!==G)})},[]),Te=p.useCallback(G=>{const Ee=Array.from(G.target.files??[]);Ee.length>0&&Xt(Ee),G.target.value=""},[Xt]),Be=p.useCallback(G=>{if(!Dt.allowed||Pe)return;const Ee=G==="camera"?Me.current:yt.current;Px(Ee),F(!1)},[Dt.allowed,Pe]),lt=p.useCallback(()=>{if(!(!Dt.allowed||Pe)){if(ye(!1),I.isNativeMobile){Qe.trigger("selection"),F(!0);return}Px(yt.current)}},[Dt.allowed,Qe,Pe,I.isNativeMobile]),Mt=p.useCallback(()=>{ye(G=>!G)},[]),rn=p.useCallback(G=>{var Ee;E(Ge=>Ge.trimStart().startsWith(G)?Ge:Ge.trim()?`${G} ${Ge.trim()}`:`${G} `),ye(!1),(Ee=nt.current)==null||Ee.focus()},[]),Nn=p.useCallback(async G=>{const Ee=te;we.current+=1,de(G),ce(!0);try{const Ge=await uL(G.map(At=>({id:At.id,text:At.text})));return de(Ge.items.map(At=>({id:At.id,text:At.text}))),!0}catch(Ge){return de(Ee),xe({title:Ge instanceof Error?Ge.message:o("conversation.quickPhraseSaveFailed"),tone:"error"}),!1}finally{ce(!1)}},[te,xe]),Vt=p.useCallback(async()=>{const G=X.trim();!G||!await Nn([...te,SO(G)])||(D(""),L(!1))},[Nn,X,te]),Un=p.useCallback(G=>{Nn(te.filter(Ee=>Ee.id!==G))},[Nn,te]),qn=p.useCallback((G,Ee)=>{const Ge=te.findIndex(wn=>wn.id===G);if(Ge<0)return;const At=Ge+Ee;if(At<0||At>=te.length)return;const gn=[...te],[bn]=gn.splice(Ge,1);gn.splice(At,0,bn),Nn(gn)},[Nn,te]),En=p.useCallback(G=>{var Ee;E(G),M(!1),(Ee=nt.current)==null||Ee.focus()},[]),Dn=p.useCallback(G=>{const Ee=G?CO(G):null,Ge=(Ee==null?void 0:Ee.attachments.map(At=>MO(At)))??[];ut.current=new Map(((Ee==null?void 0:Ee.attachments)??[]).map(At=>[At.id,At])),fn(Ge),E((Ee==null?void 0:Ee.content)??""),ye(!1)},[fn]);p.useEffect(()=>{if(!bt.length)return;if(It&&bt.some(Ee=>Ee.id===It)){A!==It&&H(It);return}if(bt.some(Ee=>Ee.id===A))return;const G=bt[0].id;H(G)},[bt,Fe,A,It]),p.useEffect(()=>{if(!UL(Fe)||$e.length===0)return;if(qt&&$e.some(Ge=>Ge.value===qt)){_!==qt&&Y(qt);return}const G=e==null?void 0:e.defaultReasoningLevel;if(G&&$e.some(Ge=>Ge.value===G)){_!==G&&Y(G);return}if($e.some(Ge=>Ge.value===_))return;const Ee=$e[0].value;Y(Ee)},[$e,e==null?void 0:e.defaultReasoningLevel,Fe,_,qt]),p.useEffect(()=>{let G=!1;const Ee=we.current;return cL().then(Ge=>{G||we.current!==Ee||de(Ge.items.map(At=>({id:At.id,text:At.text})))}).catch(()=>{}),()=>{G=!0}},[]),p.useEffect(()=>{Dn(r)},[r,Dn]),p.useEffect(()=>{if(!r)return;const G=r,Ee=new Set(z.map(gn=>gn.id));ut.current.forEach((gn,bn)=>{Ee.has(bn)||ut.current.delete(bn)});let Ge=!1;async function At(){if(B.length===0&&z.length===0){uP(G);return}const gn=await Promise.all(z.map(async bn=>{const wn=ut.current.get(bn.id);return wn&&wn.fileName===bn.file.name&&wn.fileSize===bn.file.size&&wn.lastModified===bn.file.lastModified&&wn.mimeType===(bn.file.type||"image/png")?wn:{id:bn.id,fileName:bn.file.name,mimeType:bn.file.type||"image/png",fileSize:bn.file.size,lastModified:bn.file.lastModified,contentBase64:await Dx(bn.file)}}));Ge||(ut.current=new Map(gn.map(bn=>[bn.id,bn])),jO(G,{content:B,attachments:gn}))}return At(),()=>{Ge=!0}},[z,B,r]),p.useEffect(()=>{const G=nt.current;G&&(G.style.height="0px",G.style.height=`${Math.min(G.scrollHeight,120)}px`)},[B]),p.useEffect(()=>{Dt.allowed||(ut.current.clear(),F(!1),fn([]))},[Dt.allowed,fn]),p.useEffect(()=>{I.isMobile||F(!1)},[I.isMobile]),p.useEffect(()=>()=>{pt.current.forEach(G=>{URL.revokeObjectURL(G)}),pt.current.clear()},[]),p.useEffect(()=>{function G(){var Ee;(Ee=nt.current)==null||Ee.focus()}return window.addEventListener(Sx,G),()=>{window.removeEventListener(Sx,G)}},[]),p.useEffect(()=>{if(!i){gt(null),rt(!1),ue({}),qe(null);return}if(Jt){gt(null),rt(!1);return}let G=!1;return gt(Fa(i.targetProvider)),rt(!0),Al(i.targetProvider,i.workspaceId).then(Ee=>{G||gt(Ee)}).catch(()=>{G||gt(Fa(i.targetProvider))}).finally(()=>{G||rt(!1)}),()=>{G=!0}},[i==null?void 0:i.targetProvider,i==null?void 0:i.workspaceId,Jt]),p.useEffect(()=>{if(!i){ue({});return}let G=!1;return Ab(Cx,i.workspaceId).then(Ee=>{G||ue(Ee)}),()=>{G=!0}},[i==null?void 0:i.workspaceId]),p.useEffect(()=>{!i||!u||pe.length!==0&&(pe.includes(i.targetProvider)||u({...i,targetProvider:pe[0]??i.targetProvider,targetModel:null}))},[i,u,pe]),p.useEffect(()=>{!i||!i.targetModel||!u||hn.some(G=>G.id===i.targetModel)||u({...i,targetModel:null})},[hn,i,u]);const zr=p.useCallback(G=>{if(!(!i||!u||G===i.targetProvider)){if(G!==i.sourceProvider&&i.targetProvider===i.sourceProvider){qe(G);return}u({...i,targetProvider:G,targetModel:null})}},[i,u]),hr=p.useCallback(G=>{!i||!u||u({...i,targetModel:G===Lc?null:G})},[i,u]),qr=p.useCallback(()=>{!i||!Oe||!u||(u({...i,targetProvider:Oe,targetModel:null}),qe(null))},[i,u,Oe]),xn=p.useCallback(()=>{qe(null)},[]);async function $r(G){if(Le.current)return;const Ee=B.trim(),Ge=z;if(Ee.length===0&&Ge.length===0||!Ht.allowed||Pe||ot){xe({title:Pe?o("conversation.runtimeRunning"):Ye??Ht.reason??o("conversation.capabilityDenied"),tone:"error"});return}Le.current=!0,Qe.trigger(G==="queue"?"selection":"action"),Nt(!0),E(""),K([]),F(!1),M(!1),L(!1),ye(!1);try{const At=await Promise.all(Ge.map(async wn=>({fileName:wn.file.name,mimeType:wn.file.type||"image/png",fileSize:wn.file.size,contentBase64:await Dx(wn.file)}))),gn=Ge.map(wn=>LO(wn.file,wn.id));await(G==="queue"&&T?T:P)(Ee,{model:Ut||Qt!=null&&Qt.usesProviderDefault?void 0:A||void 0,reasoningLevel:Ut?void 0:zt&&$e.length>0?_:void 0,attachments:At,attachmentMeta:gn}),FO(Ge),Ge.forEach(wn=>{pt.current.delete(wn.previewUrl)})}catch(At){E(Ee),K(Ge),xe({title:At instanceof Error&&At.message==="FILE_READ_FAILED"?o("conversation.attachmentReadFailed"):At instanceof Error?At.message:o("conversation.capabilityDenied"),tone:"error"})}finally{Nt(!1),Le.current=!1}}async function br(G){G.preventDefault(),await $r(re?"queue":"send")}async function In(){if(!(!an||!j||Se))try{_e(!0),Qe.trigger("action"),await j()}catch(G){xe({title:G instanceof Error?G.message:o("conversation.capabilityInterruptDisabled"),tone:"error"})}finally{_e(!1)}}const Mr=Ce||x||Pe||ot||!Ht.allowed||!kt,Bn=Ce||x||Pe||!Dt.allowed,Q=B.length===0&&!Pe,je=n.jsxs("section",{ref:c,className:"composer-panel",children:[n.jsxs("form",{className:"composer-form",onSubmit:br,children:[n.jsx("input",{id:Z,ref:yt,type:"file",accept:"image/*",multiple:!0,tabIndex:-1,"aria-hidden":"true",style:jx,onChange:Te}),n.jsx("input",{id:q,ref:Me,type:"file",accept:"image/*",capture:"environment",tabIndex:-1,"aria-hidden":"true",style:jx,onChange:Te}),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:AO(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(jd,{ariaLabel:o("conversation.forkTargetProviderLabel"),value:i.targetProvider,options:We,onChange:G=>zr(G),compact:!0})]}),n.jsxs("div",{className:"composer-fork-field",children:[n.jsx("span",{className:"composer-fork-model-label",children:o("conversation.forkTargetModelLabel")}),n.jsx(jd,{ariaLabel:o("conversation.forkTargetModelLabel"),value:ne,options:ee,onChange:hr,disabled:ft||ot,compact:!0})]})]}),Ye?n.jsx("p",{className:"composer-capability-hint",children:Ye}):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,z.length>0?n.jsx("div",{className:"composer-attachments",children:z.map(G=>n.jsxs("div",{className:"composer-attachment-card",children:[n.jsx("img",{src:G.previewUrl,alt:o("conversation.attachmentPreviewAlt"),className:"composer-attachment-preview"}),n.jsxs("div",{className:"composer-attachment-meta",children:[n.jsx("span",{className:"attachment-name",title:G.file.name,children:G.file.name}),n.jsxs("span",{className:"attachment-size",children:[(G.file.size/1024).toFixed(1)," KB"]})]}),n.jsx("button",{type:"button",className:"attachment-remove",onClick:()=>kn(G.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"})]})})]},G.id))}):null,n.jsxs("div",{className:"composer-input-wrapper",children:[n.jsx("textarea",{ref:nt,className:"composer-input",value:B,placeholder:t??o("conversation.composerPlaceholder"),readOnly:Pe,"aria-readonly":Pe,onChange:G=>E(G.target.value),rows:1,onFocus:()=>ye(!1),onPaste:G=>{if(Pe||!Dt.allowed)return;const Ee=Array.from(G.clipboardData.items).filter(Ge=>Ge.kind==="file").map(Ge=>Ge.getAsFile()).filter(Ge=>!!Ge);Ee.length!==0&&(G.preventDefault(),Xt(Ee))},onKeyDown:G=>{G.key==="Escape"&&ye(!1),G.key==="Enter"&&!G.shiftKey&&(G.preventDefault(),Mr||br(G))}}),Q?n.jsx("button",{type:"button",className:"composer-quick-phrase-trigger","aria-label":o("conversation.quickPhraseTrigger"),title:o("conversation.quickPhraseTrigger"),onClick:()=>{M(!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]}),le?n.jsx("div",{className:"composer-slash-menu",role:"menu","aria-label":o("conversation.slashMenuTitle"),children:jn.map(G=>n.jsxs("button",{type:"button",className:"composer-slash-item",onClick:()=>rn(G.command),children:[n.jsx("span",{className:"composer-slash-command",children:G.command}),n.jsx("span",{className:"composer-slash-label",children:G.label})]},G.command))}):null,n.jsxs("div",{className:"composer-controls",children:[n.jsxs("div",{className:"composer-controls-left",children:[Dt.allowed?I.isNativeMobile?n.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":o("conversation.attachFiles"),title:o("conversation.attachFiles"),disabled:Bn,onClick:lt,children:n.jsx(nf,{})}):Bn?n.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":o("conversation.attachFiles"),title:o("conversation.attachFiles"),disabled:!0,children:n.jsx(nf,{})}):n.jsx("label",{htmlFor:Z,className:"composer-attach-btn","aria-label":o("conversation.attachFiles"),title:o("conversation.attachFiles"),onClick:()=>{ye(!1)},children:n.jsx(nf,{})}):null,Ut?null:n.jsx(jd,{ariaLabel:o("conversation.modelSelectorLabel"),value:A,options:ht,onChange:Mn}),!Ut&&zt&&$e.length>0?n.jsx(jd,{ariaLabel:o("conversation.reasoningSelectorLabel"),value:_,options:Wt,onChange:G=>Tt(G),compact:!0}):null,on?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($O,{contextUsage:v}),n.jsx(gO,{provider:g,messages:w,variant:"composer"})]}),_t?n.jsx("div",{className:"composer-send-group",children:n.jsx("button",{className:"composer-send composer-send-busy",type:"button",disabled:!0,"aria-label":Sn,title:Sn,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:Bt?n.jsx("button",{className:"composer-send composer-send-busy",type:"button",onClick:()=>{In()},"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:Mr,"aria-label":On,title:On,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(Hn,{open:W,title:o("conversation.quickPhraseModalTitle"),description:o("conversation.quickPhraseModalDescription"),className:"composer-quick-phrase-modal",onClose:()=>{M(!1),L(!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:be,onClick:()=>L(!0),children:o("conversation.quickPhraseOpenCreateAction")})]}),n.jsx("div",{className:"composer-quick-phrase-list",role:"list","aria-label":o("conversation.quickPhraseListLabel"),children:te.length===0?n.jsx("div",{className:"composer-quick-phrase-empty",children:o("conversation.quickPhraseEmpty")}):te.map((G,Ee)=>n.jsxs("div",{className:"composer-quick-phrase-item",role:"listitem",children:[n.jsxs("button",{type:"button",className:"composer-quick-phrase-select",onClick:()=>En(G.text),children:[n.jsx("span",{className:"composer-quick-phrase-order",children:o("conversation.quickPhraseOrderLabel",{index:Ee+1})}),n.jsx("span",{className:"composer-quick-phrase-text",children:G.text})]}),n.jsxs("div",{className:"composer-quick-phrase-actions",children:[n.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:be||Ee===0,"aria-label":o("conversation.quickPhraseMoveUp"),title:o("conversation.quickPhraseMoveUp"),onClick:()=>qn(G.id,-1),children:"↑"}),n.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:be||Ee===te.length-1,"aria-label":o("conversation.quickPhraseMoveDown"),title:o("conversation.quickPhraseMoveDown"),onClick:()=>qn(G.id,1),children:"↓"}),n.jsx("button",{type:"button",className:"composer-quick-phrase-action is-danger",disabled:be,"aria-label":o("conversation.quickPhraseDelete"),title:o("conversation.quickPhraseDelete"),onClick:()=>Un(G.id),children:"×"})]})]},G.id))})]})}),n.jsx(Hn,{open:N,title:o("conversation.quickPhraseCreateModalTitle"),description:o("conversation.quickPhraseCreateModalDescription"),className:"composer-quick-phrase-create-modal",onClose:()=>L(!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:X,placeholder:o("conversation.quickPhraseCreatePlaceholder"),rows:4,onChange:G=>D(G.target.value)})]}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>L(!1),children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:be||X.trim().length===0,onClick:()=>{Vt()},children:o("conversation.quickPhraseCreateAction")})]})]})}),n.jsx(Hn,{open:Oe!==null,title:o("conversation.forkSwitchConfirmTitle"),description:o("conversation.forkSwitchConfirmDescription"),className:"composer-fork-confirm-modal",onClose:xn,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(HO,{})}),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(zO,{})}),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(qO,{})}),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:xn,children:o("conversation.forkSwitchKeepNative")}),n.jsx("button",{type:"button",className:"primary-button",onClick:qr,children:o("conversation.forkSwitchConfirmAction")})]})]})}),n.jsx(BO,{open:O&&I.isNativeMobile,onClose:()=>F(!1),onSelectCamera:()=>Be("camera"),onSelectLibrary:()=>Be("library")})]});return d?Xn.createPortal(je,d):je}function BO({open:e,onClose:t,onSelectCamera:r,onSelectLibrary:i}){return!e||typeof document>"u"?null:Xn.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(WO,{})]}),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(UO,{})]})]})]}),n.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:t,children:o("common.cancel")})]})}),document.body)}function WO(){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 nf(){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 UO(){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 HO(){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 zO(){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 qO(){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 jd({ariaLabel:e,value:t,options:r,onChange:i,disabled:a=!1,compact:u=!1}){const[c,d]=p.useState(!1),m=p.useRef(null),f=p.useRef(null),v=p.useRef(null),[g,w]=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 T=j.getBoundingClientRect(),P=window.innerWidth,I=window.innerHeight,Z=12,q=10,B=Math.max(160,P-Z*2),E=u?140:220,A=Math.min(B,Math.max(T.width,E)),H=Math.min(Math.max(Z,T.left),Math.max(Z,P-A-Z)),_=T.top-Z,Y=I-T.bottom-Z,z=_>=180||_>=Y;w({position:"fixed",left:H,width:A,maxWidth:B,top:z?void 0:T.bottom+q,bottom:z?I-T.top+q:void 0})},[u]);return p.useEffect(()=>{if(!c)return;function j(P){var Z,q;const I=P.target;!((Z=m.current)!=null&&Z.contains(I))&&!((q=v.current)!=null&&q.contains(I))&&d(!1)}function T(P){P.key==="Escape"&&d(!1)}return window.addEventListener("pointerdown",j),window.addEventListener("keydown",T),window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),C(),()=>{window.removeEventListener("pointerdown",j),window.removeEventListener("keydown",T),window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[c,C]),x?n.jsxs("div",{ref:m,className:`composer-mac-select ${u?"is-compact":""}`,"data-open":c?"true":"false",children:[n.jsxs("button",{ref:f,type:"button",className:"composer-mac-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":c,"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"})})]}),c&&g&&typeof document<"u"?Xn.createPortal(n.jsx("div",{ref:v,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 T=j.value===t;return n.jsxs("button",{type:"button",role:"option","aria-selected":T,className:`composer-mac-select-option ${T?"is-selected":""}`,onClick:()=>{i(j.value),d(!1)},children:[n.jsx("span",{className:"composer-mac-select-option-check","aria-hidden":"true",children:T?"✓":""}),n.jsx("span",{className:"composer-mac-select-option-label",children:j.label})]},j.value)})})}),document.body):null]}):null}function $O({contextUsage:e}){const[t,r]=p.useState(!1),i=p.useRef(null),a=p.useRef(null),[u,c]=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,v=VO(f),g=e?GO(e.contextWindowSource):null,w=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,T=window.innerHeight,P=12,I=10,Z=Math.min(240,Math.max(188,j-P*2)),q=Math.min(Math.max(P,C.left+C.width/2-Z/2),Math.max(P,j-Z-P)),B=C.top-P,E=T-C.bottom-P,A=B>=140||B>=E;c({position:"fixed",left:q,width:Z,maxWidth:j-P*2,top:A?void 0:C.bottom+I,bottom:A?T-C.top+I:void 0})},[]);return p.useEffect(()=>{if(!t)return;function x(j){var P,I;const T=j.target;!((P=i.current)!=null&&P.contains(T))&&!((I=a.current)!=null&&I.contains(T))&&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 ${v}`,style:{"--context-usage-progress":`${f}`},"aria-label":w,"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&&u&&typeof document<"u"?Xn.createPortal(n.jsx("div",{ref:a,id:d,className:"composer-context-tooltip",style:u,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,"% · ",rf(e.promptTokens)," /"," ",rf(e.contextWindow)," tokens"]}),e.cachedInputTokens>0?n.jsx("div",{className:"composer-context-tooltip-line",children:o("conversation.contextUsageCachedTokens").replace("{count}",rf(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 VO(e){return e>=.95?"is-critical":e>=.8?"is-warning":"is-normal"}function GO(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 rf(e){return new Intl.NumberFormat().format(e)}function KO(e,t){const r={};return(e[e.length-1]===""?[...e,""]:e).join((r.padRight?" ":"")+","+(r.padLeft===!1?"":" ")).trim()}const YO=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,XO=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QO={};function Rx(e,t){return(QO.jsx?XO:YO).test(e)}const JO=/[ \t\n\f\r]/g;function ZO(e){return typeof e=="object"?e.type==="text"?Mx(e.value):!1:Mx(e)}function Mx(e){return e.replace(JO,"")===""}class gu{constructor(t,r,i){this.normal=r,this.property=t,i&&(this.space=i)}}gu.prototype.normal={};gu.prototype.property={};gu.prototype.space=void 0;function hP(e,t){const r={},i={};for(const a of e)Object.assign(r,a.property),Object.assign(i,a.normal);return new gu(r,i,t)}function Tg(e){return e.toLowerCase()}class Si{constructor(t,r){this.attribute=r,this.property=t}}Si.prototype.attribute="";Si.prototype.booleanish=!1;Si.prototype.boolean=!1;Si.prototype.commaOrSpaceSeparated=!1;Si.prototype.commaSeparated=!1;Si.prototype.defined=!1;Si.prototype.mustUseProperty=!1;Si.prototype.number=!1;Si.prototype.overloadedBoolean=!1;Si.prototype.property="";Si.prototype.spaceSeparated=!1;Si.prototype.space=void 0;let e2=0;const cn=Do(),yr=Do(),Pg=Do(),Xe=Do(),Kn=Do(),kl=Do(),Mi=Do();function Do(){return 2**++e2}const Dg=Object.freeze(Object.defineProperty({__proto__:null,boolean:cn,booleanish:yr,commaOrSpaceSeparated:Mi,commaSeparated:kl,number:Xe,overloadedBoolean:Pg,spaceSeparated:Kn},Symbol.toStringTag,{value:"Module"})),sf=Object.keys(Dg);class Hb extends Si{constructor(t,r,i,a){let u=-1;if(super(t,r),Ax(this,"space",a),typeof i=="number")for(;++u<sf.length;){const c=sf[u];Ax(this,sf[u],(i&Dg[c])===Dg[c])}}}Hb.prototype.defined=!0;function Ax(e,t,r){r&&(e[t]=r)}function Il(e){const t={},r={};for(const[i,a]of Object.entries(e.properties)){const u=new Hb(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(u.mustUseProperty=!0),t[i]=u,r[Tg(i)]=i,r[Tg(u.attribute)]=i}return new gu(t,r,e.space)}const mP=Il({properties:{ariaActiveDescendant:null,ariaAtomic:yr,ariaAutoComplete:null,ariaBusy:yr,ariaChecked:yr,ariaColCount:Xe,ariaColIndex:Xe,ariaColSpan:Xe,ariaControls:Kn,ariaCurrent:null,ariaDescribedBy:Kn,ariaDetails:null,ariaDisabled:yr,ariaDropEffect:Kn,ariaErrorMessage:null,ariaExpanded:yr,ariaFlowTo:Kn,ariaGrabbed:yr,ariaHasPopup:null,ariaHidden:yr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Kn,ariaLevel:Xe,ariaLive:null,ariaModal:yr,ariaMultiLine:yr,ariaMultiSelectable:yr,ariaOrientation:null,ariaOwns:Kn,ariaPlaceholder:null,ariaPosInSet:Xe,ariaPressed:yr,ariaReadOnly:yr,ariaRelevant:null,ariaRequired:yr,ariaRoleDescription:Kn,ariaRowCount:Xe,ariaRowIndex:Xe,ariaRowSpan:Xe,ariaSelected:yr,ariaSetSize:Xe,ariaSort:null,ariaValueMax:Xe,ariaValueMin:Xe,ariaValueNow:Xe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function pP(e,t){return t in e?e[t]:t}function fP(e,t){return pP(e,t.toLowerCase())}const t2=Il({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:kl,acceptCharset:Kn,accessKey:Kn,action:null,allow:null,allowFullScreen:cn,allowPaymentRequest:cn,allowUserMedia:cn,alt:null,as:null,async:cn,autoCapitalize:null,autoComplete:Kn,autoFocus:cn,autoPlay:cn,blocking:Kn,capture:null,charSet:null,checked:cn,cite:null,className:Kn,cols:Xe,colSpan:null,content:null,contentEditable:yr,controls:cn,controlsList:Kn,coords:Xe|kl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:cn,defer:cn,dir:null,dirName:null,disabled:cn,download:Pg,draggable:yr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:cn,formTarget:null,headers:Kn,height:Xe,hidden:Pg,high:Xe,href:null,hrefLang:null,htmlFor:Kn,httpEquiv:Kn,id:null,imageSizes:null,imageSrcSet:null,inert:cn,inputMode:null,integrity:null,is:null,isMap:cn,itemId:null,itemProp:Kn,itemRef:Kn,itemScope:cn,itemType:Kn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:cn,low:Xe,manifest:null,max:null,maxLength:Xe,media:null,method:null,min:null,minLength:Xe,multiple:cn,muted:cn,name:null,nonce:null,noModule:cn,noValidate:cn,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:cn,optimum:Xe,pattern:null,ping:Kn,placeholder:null,playsInline:cn,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:cn,referrerPolicy:null,rel:Kn,required:cn,reversed:cn,rows:Xe,rowSpan:Xe,sandbox:Kn,scope:null,scoped:cn,seamless:cn,selected:cn,shadowRootClonable:cn,shadowRootDelegatesFocus:cn,shadowRootMode:null,shape:null,size:Xe,sizes:null,slot:null,span:Xe,spellCheck:yr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Xe,step:null,style:null,tabIndex:Xe,target:null,title:null,translate:null,type:null,typeMustMatch:cn,useMap:null,value:yr,width:Xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Kn,axis:null,background:null,bgColor:null,border:Xe,borderColor:null,bottomMargin:Xe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:cn,declare:cn,event:null,face:null,frame:null,frameBorder:null,hSpace:Xe,leftMargin:Xe,link:null,longDesc:null,lowSrc:null,marginHeight:Xe,marginWidth:Xe,noResize:cn,noHref:cn,noShade:cn,noWrap:cn,object:null,profile:null,prompt:null,rev:null,rightMargin:Xe,rules:null,scheme:null,scrolling:yr,standby:null,summary:null,text:null,topMargin:Xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Xe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:cn,disableRemotePlayback:cn,prefix:null,property:null,results:Xe,security:null,unselectable:null},space:"html",transform:fP}),n2=Il({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:Mi,accentHeight:Xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Xe,amplitude:Xe,arabicForm:null,ascent:Xe,attributeName:null,attributeType:null,azimuth:Xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Xe,by:null,calcMode:null,capHeight:Xe,className:Kn,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:Xe,diffuseConstant:Xe,direction:null,display:null,dur:null,divisor:Xe,dominantBaseline:null,download:cn,dx:null,dy:null,edgeMode:null,editable:null,elevation:Xe,enableBackground:null,end:null,event:null,exponent:Xe,externalResourcesRequired:null,fill:null,fillOpacity:Xe,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:kl,g2:kl,glyphName:kl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Xe,horizOriginX:Xe,horizOriginY:Xe,id:null,ideographic:Xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Xe,k:Xe,k1:Xe,k2:Xe,k3:Xe,k4:Xe,kernelMatrix:Mi,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Xe,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:Xe,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:Xe,overlineThickness:Xe,paintOrder:null,panose1:null,path:null,pathLength:Xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Kn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Xe,pointsAtY:Xe,pointsAtZ:Xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Mi,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Mi,rev:Mi,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Mi,requiredFeatures:Mi,requiredFonts:Mi,requiredFormats:Mi,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:Xe,specularExponent:Xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Xe,strikethroughThickness:Xe,string:null,stroke:null,strokeDashArray:Mi,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Xe,strokeOpacity:Xe,strokeWidth:null,style:null,surfaceScale:Xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Mi,tabIndex:Xe,tableValues:null,target:null,targetX:Xe,targetY:Xe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Mi,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Xe,underlineThickness:Xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Xe,values:null,vAlphabetic:Xe,vMathematical:Xe,vectorEffect:null,vHanging:Xe,vIdeographic:Xe,version:null,vertAdvY:Xe,vertOriginX:Xe,vertOriginY:Xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:pP}),gP=Il({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()}}),bP=Il({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:fP}),vP=Il({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),r2={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"},i2=/[A-Z]/g,Ex=/-[a-z]/g,s2=/^data[-\w.:]+$/i;function a2(e,t){const r=Tg(t);let i=t,a=Si;if(r in e.normal)return e.property[e.normal[r]];if(r.length>4&&r.slice(0,4)==="data"&&s2.test(t)){if(t.charAt(4)==="-"){const u=t.slice(5).replace(Ex,l2);i="data"+u.charAt(0).toUpperCase()+u.slice(1)}else{const u=t.slice(4);if(!Ex.test(u)){let c=u.replace(i2,o2);c.charAt(0)!=="-"&&(c="-"+c),t="data"+c}}a=Hb}return new a(i,t)}function o2(e){return"-"+e.toLowerCase()}function l2(e){return e.charAt(1).toUpperCase()}const c2=hP([mP,t2,gP,bP,vP],"html"),zb=hP([mP,n2,gP,bP,vP],"svg");function u2(e){return e.join(" ").trim()}var ol={},af,Ix;function d2(){if(Ix)return af;Ix=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,r=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,u=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,d=/^\s+|\s+$/g,m=`
|
|
70
|
+
`,f="/",v="*",g="",w="comment",y="declaration";function x(j,T){if(typeof j!="string")throw new TypeError("First argument must be a string");if(!j)return[];T=T||{};var P=1,I=1;function Z(O){var F=O.match(t);F&&(P+=F.length);var te=O.lastIndexOf(m);I=~te?O.length-te:I+O.length}function q(){var O={line:P,column:I};return function(F){return F.position=new B(O),H(),F}}function B(O){this.start=O,this.end={line:P,column:I},this.source=T.source}B.prototype.content=j;function E(O){var F=new Error(T.source+":"+P+":"+I+": "+O);if(F.reason=O,F.filename=T.source,F.line=P,F.column=I,F.source=j,!T.silent)throw F}function A(O){var F=O.exec(j);if(F){var te=F[0];return Z(te),j=j.slice(te.length),F}}function H(){A(r)}function _(O){var F;for(O=O||[];F=Y();)F!==!1&&O.push(F);return O}function Y(){var O=q();if(!(f!=j.charAt(0)||v!=j.charAt(1))){for(var F=2;g!=j.charAt(F)&&(v!=j.charAt(F)||f!=j.charAt(F+1));)++F;if(F+=2,g===j.charAt(F-1))return E("End of comment missing");var te=j.slice(2,F-2);return I+=2,Z(te),j=j.slice(F),I+=2,O({type:w,comment:te})}}function z(){var O=q(),F=A(i);if(F){if(Y(),!A(a))return E("property missing ':'");var te=A(u),de=O({type:y,property:C(F[0].replace(e,g)),value:te?C(te[0].replace(e,g)):g});return A(c),de}}function K(){var O=[];_(O);for(var F;F=z();)F!==!1&&(O.push(F),_(O));return O}return H(),K()}function C(j){return j?j.replace(d,g):g}return af=x,af}var Lx;function h2(){if(Lx)return ol;Lx=1;var e=ol&&ol.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(ol,"__esModule",{value:!0}),ol.default=r;const t=e(d2());function r(i,a){let u=null;if(!i||typeof i!="string")return u;const c=(0,t.default)(i),d=typeof a=="function";return c.forEach(m=>{if(m.type!=="declaration")return;const{property:f,value:v}=m;d?a(f,v,m):v&&(u=u||{},u[f]=v)}),u}return ol}var mc={},Fx;function m2(){if(Fx)return mc;Fx=1,Object.defineProperty(mc,"__esModule",{value:!0}),mc.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,u=function(f){return!f||r.test(f)||e.test(f)},c=function(f,v){return v.toUpperCase()},d=function(f,v){return"".concat(v,"-")},m=function(f,v){return v===void 0&&(v={}),u(f)?f:(f=f.toLowerCase(),v.reactCompat?f=f.replace(a,d):f=f.replace(i,d),f.replace(t,c))};return mc.camelCase=m,mc}var pc,_x;function p2(){if(_x)return pc;_x=1;var e=pc&&pc.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(h2()),r=m2();function i(a,u){var c={};return!a||typeof a!="string"||(0,t.default)(a,function(d,m){d&&m&&(c[(0,r.camelCase)(d,u)]=m)}),c}return i.default=i,pc=i,pc}var f2=p2();const g2=au(f2),wP=yP("end"),qb=yP("start");function yP(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 b2(e){const t=qb(e),r=wP(e);if(t&&r)return{start:t,end:r}}function Fc(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Ox(e.position):"start"in e||"end"in e?Ox(e):"line"in e||"column"in e?Rg(e):""}function Rg(e){return Bx(e&&e.line)+":"+Bx(e&&e.column)}function Ox(e){return Rg(e&&e.start)+"-"+Rg(e&&e.end)}function Bx(e){return e&&typeof e=="number"?e:1}class ni extends Error{constructor(t,r,i){super(),typeof r=="string"&&(i=r,r=void 0);let a="",u={},c=!1;if(r&&("line"in r&&"column"in r?u={place:r}:"start"in r&&"end"in r?u={place:r}:"type"in r?u={ancestors:[r],place:r.position}:u={...r}),typeof t=="string"?a=t:!u.cause&&t&&(c=!0,a=t.message,u.cause=t),!u.ruleId&&!u.source&&typeof i=="string"){const m=i.indexOf(":");m===-1?u.ruleId=i:(u.source=i.slice(0,m),u.ruleId=i.slice(m+1))}if(!u.place&&u.ancestors&&u.ancestors){const m=u.ancestors[u.ancestors.length-1];m&&(u.place=m.position)}const d=u.place&&"start"in u.place?u.place.start:u.place;this.ancestors=u.ancestors||void 0,this.cause=u.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=Fc(u.place)||"1:1",this.place=u.place||void 0,this.reason=this.message,this.ruleId=u.ruleId||void 0,this.source=u.source||void 0,this.stack=c&&u.cause&&typeof u.cause.stack=="string"?u.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ni.prototype.file="";ni.prototype.name="";ni.prototype.reason="";ni.prototype.message="";ni.prototype.stack="";ni.prototype.column=void 0;ni.prototype.line=void 0;ni.prototype.ancestors=void 0;ni.prototype.cause=void 0;ni.prototype.fatal=void 0;ni.prototype.place=void 0;ni.prototype.ruleId=void 0;ni.prototype.source=void 0;const $b={}.hasOwnProperty,v2=new Map,w2=/[A-Z]/g,y2=new Set(["table","tbody","thead","tfoot","tr"]),k2=new Set(["td","th"]),kP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function x2(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=R2(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=D2(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"?zb:c2,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},u=xP(a,e,void 0);return u&&typeof u!="string"?u:a.create(e,a.Fragment,{children:u||void 0},void 0)}function xP(e,t,r){if(t.type==="element")return S2(e,t,r);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return C2(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return N2(e,t,r);if(t.type==="mdxjsEsm")return j2(e,t);if(t.type==="root")return T2(e,t,r);if(t.type==="text")return P2(e,t)}function S2(e,t,r){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=zb,e.schema=a),e.ancestors.push(t);const u=CP(e,t.tagName,!1),c=M2(e,t);let d=Gb(e,t);return y2.has(t.tagName)&&(d=d.filter(function(m){return typeof m=="string"?!ZO(m):!0})),SP(e,c,u,t),Vb(c,d),e.ancestors.pop(),e.schema=i,e.create(t,u,c,r)}function C2(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)}Gc(e,t.position)}function j2(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Gc(e,t.position)}function N2(e,t,r){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=zb,e.schema=a),e.ancestors.push(t);const u=t.name===null?e.Fragment:CP(e,t.name,!0),c=A2(e,t),d=Gb(e,t);return SP(e,c,u,t),Vb(c,d),e.ancestors.pop(),e.schema=i,e.create(t,u,c,r)}function T2(e,t,r){const i={};return Vb(i,Gb(e,t)),e.create(t,e.Fragment,i,r)}function P2(e,t){return t.value}function SP(e,t,r,i){typeof r!="string"&&r!==e.Fragment&&e.passNode&&(t.node=i)}function Vb(e,t){if(t.length>0){const r=t.length>1?t:t[0];r&&(e.children=r)}}function D2(e,t,r){return i;function i(a,u,c,d){const f=Array.isArray(c.children)?r:t;return d?f(u,c,d):f(u,c)}}function R2(e,t){return r;function r(i,a,u,c){const d=Array.isArray(u.children),m=qb(i);return t(a,u,c,d,{columnNumber:m?m.column-1:void 0,fileName:e,lineNumber:m?m.line:void 0},void 0)}}function M2(e,t){const r={};let i,a;for(a in t.properties)if(a!=="children"&&$b.call(t.properties,a)){const u=E2(e,a,t.properties[a]);if(u){const[c,d]=u;e.tableCellAlignToStyle&&c==="align"&&typeof d=="string"&&k2.has(t.tagName)?i=d:r[c]=d}}if(i){const u=r.style||(r.style={});u[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return r}function A2(e,t){const r={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const u=i.data.estree.body[0];u.type;const c=u.expression;c.type;const d=c.properties[0];d.type,Object.assign(r,e.evaluater.evaluateExpression(d.argument))}else Gc(e,t.position);else{const a=i.name;let u;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,u=e.evaluater.evaluateExpression(d.expression)}else Gc(e,t.position);else u=i.value===null?!0:i.value;r[a]=u}return r}function Gb(e,t){const r=[];let i=-1;const a=e.passKeys?new Map:v2;for(;++i<t.children.length;){const u=t.children[i];let c;if(e.passKeys){const m=u.type==="element"?u.tagName:u.type==="mdxJsxFlowElement"||u.type==="mdxJsxTextElement"?u.name:void 0;if(m){const f=a.get(m)||0;c=m+"-"+f,a.set(m,f+1)}}const d=xP(e,u,c);d!==void 0&&r.push(d)}return r}function E2(e,t,r){const i=a2(e.schema,t);if(!(r==null||typeof r=="number"&&Number.isNaN(r))){if(Array.isArray(r)&&(r=i.commaSeparated?KO(r):u2(r)),i.property==="style"){let a=typeof r=="object"?r:I2(e,String(r));return e.stylePropertyNameCase==="css"&&(a=L2(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?r2[i.property]||i.property:i.attribute,r]}}function I2(e,t){try{return g2(t,{reactCompat:!0})}catch(r){if(e.ignoreInvalidStyle)return{};const i=r,a=new ni("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=kP+"#cannot-parse-style-attribute",a}}function CP(e,t,r){let i;if(!r)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let u=-1,c;for(;++u<a.length;){const d=Rx(a[u])?{type:"Identifier",name:a[u]}:{type:"Literal",value:a[u]};c=c?{type:"MemberExpression",object:c,property:d,computed:!!(u&&d.type==="Literal"),optional:!1}:d}i=c}else i=Rx(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return $b.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Gc(e)}function Gc(e,t){const r=new ni("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=kP+"#cannot-handle-mdx-estrees-without-createevaluater",r}function L2(e){const t={};let r;for(r in e)$b.call(e,r)&&(t[F2(r)]=e[r]);return t}function F2(e){let t=e.replace(w2,_2);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function _2(e){return"-"+e.toLowerCase()}const of={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"]},O2={};function Kb(e,t){const r=O2,i=typeof r.includeImageAlt=="boolean"?r.includeImageAlt:!0,a=typeof r.includeHtml=="boolean"?r.includeHtml:!0;return jP(e,i,a)}function jP(e,t,r){if(B2(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 Wx(e.children,t,r)}return Array.isArray(e)?Wx(e,t,r):""}function Wx(e,t,r){const i=[];let a=-1;for(;++a<e.length;)i[a]=jP(e[a],t,r);return i.join("")}function B2(e){return!!(e&&typeof e=="object")}const Ux=document.createElement("i");function Yb(e){const t="&"+e+";";Ux.innerHTML=t;const r=Ux.textContent;return r.charCodeAt(r.length-1)===59&&e!=="semi"||r===t?!1:r}function Ei(e,t,r,i){const a=e.length;let u=0,c;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,r=r>0?r:0,i.length<1e4)c=Array.from(i),c.unshift(t,r),e.splice(...c);else for(r&&e.splice(t,r);u<i.length;)c=i.slice(u,u+1e4),c.unshift(t,0),e.splice(...c),u+=1e4,t+=1e4}function Qi(e,t){return e.length>0?(Ei(e,e.length,0,t),e):t}const Hx={}.hasOwnProperty;function NP(e){const t={};let r=-1;for(;++r<e.length;)W2(t,e[r]);return t}function W2(e,t){let r;for(r in t){const a=(Hx.call(e,r)?e[r]:void 0)||(e[r]={}),u=t[r];let c;if(u)for(c in u){Hx.call(a,c)||(a[c]=[]);const d=u[c];U2(a[c],Array.isArray(d)?d:d?[d]:[])}}}function U2(e,t){let r=-1;const i=[];for(;++r<t.length;)(t[r].add==="after"?e:i).push(t[r]);Ei(e,0,0,i)}function TP(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 gs(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ai=Ha(/[A-Za-z]/),ti=Ha(/[\dA-Za-z]/),H2=Ha(/[#-'*+\--9=?A-Z^-~]/);function Th(e){return e!==null&&(e<32||e===127)}const Mg=Ha(/\d/),z2=Ha(/[\dA-Fa-f]/),q2=Ha(/[!-/:-@[-`{-~]/);function Yt(e){return e!==null&&e<-2}function zn(e){return e!==null&&(e<0||e===32)}function vn(e){return e===-2||e===-1||e===32}const im=Ha(new RegExp("\\p{P}|\\p{S}","u")),So=Ha(/\s/);function Ha(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function Ll(e){const t=[];let r=-1,i=0,a=0;for(;++r<e.length;){const u=e.charCodeAt(r);let c="";if(u===37&&ti(e.charCodeAt(r+1))&&ti(e.charCodeAt(r+2)))a=2;else if(u<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(u))||(c=String.fromCharCode(u));else if(u>55295&&u<57344){const d=e.charCodeAt(r+1);u<56320&&d>56319&&d<57344?(c=String.fromCharCode(u,d),a=1):c="�"}else c=String.fromCharCode(u);c&&(t.push(e.slice(i,r),encodeURIComponent(c)),i=r+a+1,c=""),a&&(r+=a,a=0)}return t.join("")+e.slice(i)}function Cn(e,t,r,i){const a=i?i-1:Number.POSITIVE_INFINITY;let u=0;return c;function c(m){return vn(m)?(e.enter(r),d(m)):t(m)}function d(m){return vn(m)&&u++<a?(e.consume(m),d):(e.exit(r),t(m))}}const $2={tokenize:V2};function V2(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"),Cn(e,t,"linePrefix")}function a(d){return e.enter("paragraph"),u(d)}function u(d){const m=e.enter("chunkText",{contentType:"text",previous:r});return r&&(r.next=m),r=m,c(d)}function c(d){if(d===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(d);return}return Yt(d)?(e.consume(d),e.exit("chunkText"),u):(e.consume(d),c)}}const G2={tokenize:K2},zx={tokenize:Y2};function K2(e){const t=this,r=[];let i=0,a,u,c;return d;function d(I){if(i<r.length){const Z=r[i];return t.containerState=Z[1],e.attempt(Z[0].continuation,m,f)(I)}return f(I)}function m(I){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&P();const Z=t.events.length;let q=Z,B;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){B=t.events[q][1].end;break}T(i);let E=Z;for(;E<t.events.length;)t.events[E][1].end={...B},E++;return Ei(t.events,q+1,0,t.events.slice(Z)),t.events.length=E,f(I)}return d(I)}function f(I){if(i===r.length){if(!a)return w(I);if(a.currentConstruct&&a.currentConstruct.concrete)return x(I);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(zx,v,g)(I)}function v(I){return a&&P(),T(i),w(I)}function g(I){return t.parser.lazy[t.now().line]=i!==r.length,c=t.now().offset,x(I)}function w(I){return t.containerState={},e.attempt(zx,y,x)(I)}function y(I){return i++,r.push([t.currentConstruct,t.containerState]),w(I)}function x(I){if(I===null){a&&P(),T(0),e.consume(I);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:u}),C(I)}function C(I){if(I===null){j(e.exit("chunkFlow"),!0),T(0),e.consume(I);return}return Yt(I)?(e.consume(I),j(e.exit("chunkFlow")),i=0,t.interrupt=void 0,d):(e.consume(I),C)}function j(I,Z){const q=t.sliceStream(I);if(Z&&q.push(null),I.previous=u,u&&(u.next=I),u=I,a.defineSkip(I.start),a.write(q),t.parser.lazy[I.start.line]){let B=a.events.length;for(;B--;)if(a.events[B][1].start.offset<c&&(!a.events[B][1].end||a.events[B][1].end.offset>c))return;const E=t.events.length;let A=E,H,_;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(H){_=t.events[A][1].end;break}H=!0}for(T(i),B=E;B<t.events.length;)t.events[B][1].end={..._},B++;Ei(t.events,A+1,0,t.events.slice(E)),t.events.length=B}}function T(I){let Z=r.length;for(;Z-- >I;){const q=r[Z];t.containerState=q[1],q[0].exit.call(t,e)}r.length=I}function P(){a.write([null]),u=void 0,a=void 0,t.containerState._closeFlow=void 0}}function Y2(e,t,r){return Cn(e,e.attempt(this.parser.constructs.document,t,r),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Nl(e){if(e===null||zn(e)||So(e))return 1;if(im(e))return 2}function sm(e,t,r){const i=[];let a=-1;for(;++a<e.length;){const u=e[a].resolveAll;u&&!i.includes(u)&&(t=u(t,r),i.push(u))}return t}const Ag={name:"attention",resolveAll:X2,tokenize:Q2};function X2(e,t){let r=-1,i,a,u,c,d,m,f,v;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},w={...e[r][1].start};qx(g,-m),qx(w,m),c={type:m>1?"strongSequence":"emphasisSequence",start:g,end:{...e[i][1].end}},d={type:m>1?"strongSequence":"emphasisSequence",start:{...e[r][1].start},end:w},u={type:m>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[r][1].start}},a={type:m>1?"strong":"emphasis",start:{...c.start},end:{...d.end}},e[i][1].end={...c.start},e[r][1].start={...d.end},f=[],e[i][1].end.offset-e[i][1].start.offset&&(f=Qi(f,[["enter",e[i][1],t],["exit",e[i][1],t]])),f=Qi(f,[["enter",a,t],["enter",c,t],["exit",c,t],["enter",u,t]]),f=Qi(f,sm(t.parser.constructs.insideSpan.null,e.slice(i+1,r),t)),f=Qi(f,[["exit",u,t],["enter",d,t],["exit",d,t],["exit",a,t]]),e[r][1].end.offset-e[r][1].start.offset?(v=2,f=Qi(f,[["enter",e[r][1],t],["exit",e[r][1],t]])):v=0,Ei(e,i-1,r-i+3,f),r=i+f.length-v-2;break}}for(r=-1;++r<e.length;)e[r][1].type==="attentionSequence"&&(e[r][1].type="data");return e}function Q2(e,t){const r=this.parser.constructs.attentionMarkers.null,i=this.previous,a=Nl(i);let u;return c;function c(m){return u=m,e.enter("attentionSequence"),d(m)}function d(m){if(m===u)return e.consume(m),d;const f=e.exit("attentionSequence"),v=Nl(m),g=!v||v===2&&a||r.includes(m),w=!a||a===2&&v||r.includes(i);return f._open=!!(u===42?g:g&&(a||!w)),f._close=!!(u===42?w:w&&(v||!g)),t(m)}}function qx(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const J2={name:"autolink",tokenize:Z2};function Z2(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"),u}function u(y){return ai(y)?(e.consume(y),c):y===64?r(y):f(y)}function c(y){return y===43||y===45||y===46||ti(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||ti(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||Th(y)?r(y):(e.consume(y),m)}function f(y){return y===64?(e.consume(y),v):H2(y)?(e.consume(y),f):r(y)}function v(y){return ti(y)?g(y):r(y)}function g(y){return y===46?(e.consume(y),i=0,v):y===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(y),e.exit("autolinkMarker"),e.exit("autolink"),t):w(y)}function w(y){if((y===45||ti(y))&&i++<63){const x=y===45?w:g;return e.consume(y),x}return r(y)}}const bu={partial:!0,tokenize:eB};function eB(e,t,r){return i;function i(u){return vn(u)?Cn(e,a,"linePrefix")(u):a(u)}function a(u){return u===null||Yt(u)?t(u):r(u)}}const PP={continuation:{tokenize:nB},exit:rB,name:"blockQuote",tokenize:tB};function tB(e,t,r){const i=this;return a;function a(c){if(c===62){const d=i.containerState;return d.open||(e.enter("blockQuote",{_container:!0}),d.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(c),e.exit("blockQuoteMarker"),u}return r(c)}function u(c){return vn(c)?(e.enter("blockQuotePrefixWhitespace"),e.consume(c),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(c))}}function nB(e,t,r){const i=this;return a;function a(c){return vn(c)?Cn(e,u,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c):u(c)}function u(c){return e.attempt(PP,t,r)(c)}}function rB(e){e.exit("blockQuote")}const DP={name:"characterEscape",tokenize:iB};function iB(e,t,r){return i;function i(u){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(u),e.exit("escapeMarker"),a}function a(u){return q2(u)?(e.enter("characterEscapeValue"),e.consume(u),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):r(u)}}const RP={name:"characterReference",tokenize:sB};function sB(e,t,r){const i=this;let a=0,u,c;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"),u=31,c=ti,v(g))}function f(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),u=6,c=z2,v):(e.enter("characterReferenceValue"),u=7,c=Mg,v(g))}function v(g){if(g===59&&a){const w=e.exit("characterReferenceValue");return c===ti&&!Yb(i.sliceSerialize(w))?r(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return c(g)&&a++<u?(e.consume(g),v):r(g)}}const $x={partial:!0,tokenize:oB},Vx={concrete:!0,name:"codeFenced",tokenize:aB};function aB(e,t,r){const i=this,a={partial:!0,tokenize:q};let u=0,c=0,d;return m;function m(B){return f(B)}function f(B){const E=i.events[i.events.length-1];return u=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,d=B,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),v(B)}function v(B){return B===d?(c++,e.consume(B),v):c<3?r(B):(e.exit("codeFencedFenceSequence"),vn(B)?Cn(e,g,"whitespace")(B):g(B))}function g(B){return B===null||Yt(B)?(e.exit("codeFencedFence"),i.interrupt?t(B):e.check($x,C,Z)(B)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),w(B))}function w(B){return B===null||Yt(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(B)):vn(B)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Cn(e,y,"whitespace")(B)):B===96&&B===d?r(B):(e.consume(B),w)}function y(B){return B===null||Yt(B)?g(B):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(B))}function x(B){return B===null||Yt(B)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(B)):B===96&&B===d?r(B):(e.consume(B),x)}function C(B){return e.attempt(a,Z,j)(B)}function j(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),T}function T(B){return u>0&&vn(B)?Cn(e,P,"linePrefix",u+1)(B):P(B)}function P(B){return B===null||Yt(B)?e.check($x,C,Z)(B):(e.enter("codeFlowValue"),I(B))}function I(B){return B===null||Yt(B)?(e.exit("codeFlowValue"),P(B)):(e.consume(B),I)}function Z(B){return e.exit("codeFenced"),t(B)}function q(B,E,A){let H=0;return _;function _(F){return B.enter("lineEnding"),B.consume(F),B.exit("lineEnding"),Y}function Y(F){return B.enter("codeFencedFence"),vn(F)?Cn(B,z,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):z(F)}function z(F){return F===d?(B.enter("codeFencedFenceSequence"),K(F)):A(F)}function K(F){return F===d?(H++,B.consume(F),K):H>=c?(B.exit("codeFencedFenceSequence"),vn(F)?Cn(B,O,"whitespace")(F):O(F)):A(F)}function O(F){return F===null||Yt(F)?(B.exit("codeFencedFence"),E(F)):A(F)}}}function oB(e,t,r){const i=this;return a;function a(c){return c===null?r(c):(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u)}function u(c){return i.parser.lazy[i.now().line]?r(c):t(c)}}const lf={name:"codeIndented",tokenize:cB},lB={partial:!0,tokenize:uB};function cB(e,t,r){const i=this;return a;function a(f){return e.enter("codeIndented"),Cn(e,u,"linePrefix",5)(f)}function u(f){const v=i.events[i.events.length-1];return v&&v[1].type==="linePrefix"&&v[2].sliceSerialize(v[1],!0).length>=4?c(f):r(f)}function c(f){return f===null?m(f):Yt(f)?e.attempt(lB,c,m)(f):(e.enter("codeFlowValue"),d(f))}function d(f){return f===null||Yt(f)?(e.exit("codeFlowValue"),c(f)):(e.consume(f),d)}function m(f){return e.exit("codeIndented"),t(f)}}function uB(e,t,r){const i=this;return a;function a(c){return i.parser.lazy[i.now().line]?r(c):Yt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),a):Cn(e,u,"linePrefix",5)(c)}function u(c){const d=i.events[i.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?t(c):Yt(c)?a(c):r(c)}}const dB={name:"codeText",previous:mB,resolve:hB,tokenize:pB};function hB(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 mB(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function pB(e,t,r){let i=0,a,u;return c;function c(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?(u=e.enter("codeTextSequence"),a=0,v(g)):Yt(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||Yt(g)?(e.exit("codeTextData"),m(g)):(e.consume(g),f)}function v(g){return g===96?(e.consume(g),a++,v):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(u.type="codeTextData",f(g))}}class fB{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 u=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&fc(this.left,i),u.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),fc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),fc(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);fc(this.right,r.reverse())}else{const r=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);fc(this.left,r.reverse())}}}function fc(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 MP(e){const t={};let r=-1,i,a,u,c,d,m,f;const v=new fB(e);for(;++r<v.length;){for(;r in t;)r=t[r];if(i=v.get(r),r&&i[1].type==="chunkFlow"&&v.get(r-1)[1].type==="listItemPrefix"&&(m=i[1]._tokenizer.events,u=0,u<m.length&&m[u][1].type==="lineEndingBlank"&&(u+=2),u<m.length&&m[u][1].type==="content"))for(;++u<m.length&&m[u][1].type!=="content";)m[u][1].type==="chunkText"&&(m[u][1]._isInFirstContentOfListItem=!0,u++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,gB(v,r)),r=t[r],f=!0);else if(i[1]._container){for(u=r,a=void 0;u--;)if(c=v.get(u),c[1].type==="lineEnding"||c[1].type==="lineEndingBlank")c[0]==="enter"&&(a&&(v.get(a)[1].type="lineEndingBlank"),c[1].type="lineEnding",a=u);else if(!(c[1].type==="linePrefix"||c[1].type==="listItemIndent"))break;a&&(i[1].end={...v.get(a)[1].start},d=v.slice(a,r),d.unshift(i),v.splice(a,r-a+1,d))}}return Ei(e,0,Number.POSITIVE_INFINITY,v.slice(0)),!f}function gB(e,t){const r=e.get(t)[1],i=e.get(t)[2];let a=t-1;const u=[];let c=r._tokenizer;c||(c=i.parser[r.contentType](r.start),r._contentTypeTextTrailing&&(c._contentTypeTextTrailing=!0));const d=c.events,m=[],f={};let v,g,w=-1,y=r,x=0,C=0;const j=[C];for(;y;){for(;e.get(++a)[1]!==y;);u.push(a),y._tokenizer||(v=i.sliceStream(y),y.next||v.push(null),g&&c.defineSkip(y.start),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=!0),c.write(v),y._isInFirstContentOfListItem&&(c._gfmTasklistFirstContentOfListItem=void 0)),g=y,y=y.next}for(y=r;++w<d.length;)d[w][0]==="exit"&&d[w-1][0]==="enter"&&d[w][1].type===d[w-1][1].type&&d[w][1].start.line!==d[w][1].end.line&&(C=w+1,j.push(C),y._tokenizer=void 0,y.previous=void 0,y=y.next);for(c.events=[],y?(y._tokenizer=void 0,y.previous=void 0):j.pop(),w=j.length;w--;){const T=d.slice(j[w],j[w+1]),P=u.pop();m.push([P,P+T.length-1]),e.splice(P,2,T)}for(m.reverse(),w=-1;++w<m.length;)f[x+m[w][0]]=x+m[w][1],x+=m[w][1]-m[w][0]-1;return f}const bB={resolve:wB,tokenize:yB},vB={partial:!0,tokenize:kB};function wB(e){return MP(e),e}function yB(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?u(d):Yt(d)?e.check(vB,c,u)(d):(e.consume(d),a)}function u(d){return e.exit("chunkContent"),e.exit("content"),t(d)}function c(d){return e.consume(d),e.exit("chunkContent"),r.next=e.enter("chunkContent",{contentType:"content",previous:r}),r=r.next,a}}function kB(e,t,r){const i=this;return a;function a(c){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),Cn(e,u,"linePrefix")}function u(c){if(c===null||Yt(c))return r(c);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(c):e.interrupt(i.parser.constructs.flow,r,t)(c)}}function AP(e,t,r,i,a,u,c,d,m){const f=m||Number.POSITIVE_INFINITY;let v=0;return g;function g(T){return T===60?(e.enter(i),e.enter(a),e.enter(u),e.consume(T),e.exit(u),w):T===null||T===32||T===41||Th(T)?r(T):(e.enter(i),e.enter(c),e.enter(d),e.enter("chunkString",{contentType:"string"}),C(T))}function w(T){return T===62?(e.enter(u),e.consume(T),e.exit(u),e.exit(a),e.exit(i),t):(e.enter(d),e.enter("chunkString",{contentType:"string"}),y(T))}function y(T){return T===62?(e.exit("chunkString"),e.exit(d),w(T)):T===null||T===60||Yt(T)?r(T):(e.consume(T),T===92?x:y)}function x(T){return T===60||T===62||T===92?(e.consume(T),y):y(T)}function C(T){return!v&&(T===null||T===41||zn(T))?(e.exit("chunkString"),e.exit(d),e.exit(c),e.exit(i),t(T)):v<f&&T===40?(e.consume(T),v++,C):T===41?(e.consume(T),v--,C):T===null||T===32||T===40||Th(T)?r(T):(e.consume(T),T===92?j:C)}function j(T){return T===40||T===41||T===92?(e.consume(T),C):C(T)}}function EP(e,t,r,i,a,u){const c=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(u),v}function v(y){return d>999||y===null||y===91||y===93&&!m||y===94&&!d&&"_hiddenFootnoteSupport"in c.parser.constructs?r(y):y===93?(e.exit(u),e.enter(a),e.consume(y),e.exit(a),e.exit(i),t):Yt(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),v):(e.enter("chunkString",{contentType:"string"}),g(y))}function g(y){return y===null||y===91||y===93||Yt(y)||d++>999?(e.exit("chunkString"),v(y)):(e.consume(y),m||(m=!vn(y)),y===92?w:g)}function w(y){return y===91||y===92||y===93?(e.consume(y),d++,g):g(y)}}function IP(e,t,r,i,a,u){let c;return d;function d(w){return w===34||w===39||w===40?(e.enter(i),e.enter(a),e.consume(w),e.exit(a),c=w===40?41:w,m):r(w)}function m(w){return w===c?(e.enter(a),e.consume(w),e.exit(a),e.exit(i),t):(e.enter(u),f(w))}function f(w){return w===c?(e.exit(u),m(c)):w===null?r(w):Yt(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),Cn(e,f,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),v(w))}function v(w){return w===c||w===null||Yt(w)?(e.exit("chunkString"),f(w)):(e.consume(w),w===92?g:v)}function g(w){return w===c||w===92?(e.consume(w),v):v(w)}}function _c(e,t){let r;return i;function i(a){return Yt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),r=!0,i):vn(a)?Cn(e,i,r?"linePrefix":"lineSuffix")(a):t(a)}}const xB={name:"definition",tokenize:CB},SB={partial:!0,tokenize:jB};function CB(e,t,r){const i=this;let a;return u;function u(y){return e.enter("definition"),c(y)}function c(y){return EP.call(i,e,d,r,"definitionLabel","definitionLabelMarker","definitionLabelString")(y)}function d(y){return a=gs(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 zn(y)?_c(e,f)(y):f(y)}function f(y){return AP(e,v,r,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(y)}function v(y){return e.attempt(SB,g,g)(y)}function g(y){return vn(y)?Cn(e,w,"whitespace")(y):w(y)}function w(y){return y===null||Yt(y)?(e.exit("definition"),i.parser.defined.push(a),t(y)):r(y)}}function jB(e,t,r){return i;function i(d){return zn(d)?_c(e,a)(d):r(d)}function a(d){return IP(e,u,r,"definitionTitle","definitionTitleMarker","definitionTitleString")(d)}function u(d){return vn(d)?Cn(e,c,"whitespace")(d):c(d)}function c(d){return d===null||Yt(d)?t(d):r(d)}}const NB={name:"hardBreakEscape",tokenize:TB};function TB(e,t,r){return i;function i(u){return e.enter("hardBreakEscape"),e.consume(u),a}function a(u){return Yt(u)?(e.exit("hardBreakEscape"),t(u)):r(u)}}const PB={name:"headingAtx",resolve:DB,tokenize:RB};function DB(e,t){let r=e.length-2,i=3,a,u;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},u={type:"chunkText",start:e[i][1].start,end:e[r][1].end,contentType:"text"},Ei(e,i,r-i+1,[["enter",a,t],["enter",u,t],["exit",u,t],["exit",a,t]])),e}function RB(e,t,r){let i=0;return a;function a(v){return e.enter("atxHeading"),u(v)}function u(v){return e.enter("atxHeadingSequence"),c(v)}function c(v){return v===35&&i++<6?(e.consume(v),c):v===null||zn(v)?(e.exit("atxHeadingSequence"),d(v)):r(v)}function d(v){return v===35?(e.enter("atxHeadingSequence"),m(v)):v===null||Yt(v)?(e.exit("atxHeading"),t(v)):vn(v)?Cn(e,d,"whitespace")(v):(e.enter("atxHeadingText"),f(v))}function m(v){return v===35?(e.consume(v),m):(e.exit("atxHeadingSequence"),d(v))}function f(v){return v===null||v===35||zn(v)?(e.exit("atxHeadingText"),d(v)):(e.consume(v),f)}}const MB=["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"],Gx=["pre","script","style","textarea"],AB={concrete:!0,name:"htmlFlow",resolveTo:LB,tokenize:FB},EB={partial:!0,tokenize:OB},IB={partial:!0,tokenize:_B};function LB(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 FB(e,t,r){const i=this;let a,u,c,d,m;return f;function f(D){return v(D)}function v(D){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(D),g}function g(D){return D===33?(e.consume(D),w):D===47?(e.consume(D),u=!0,C):D===63?(e.consume(D),a=3,i.interrupt?t:N):ai(D)?(e.consume(D),c=String.fromCharCode(D),j):r(D)}function w(D){return D===45?(e.consume(D),a=2,y):D===91?(e.consume(D),a=5,d=0,x):ai(D)?(e.consume(D),a=4,i.interrupt?t:N):r(D)}function y(D){return D===45?(e.consume(D),i.interrupt?t:N):r(D)}function x(D){const be="CDATA[";return D===be.charCodeAt(d++)?(e.consume(D),d===be.length?i.interrupt?t:z:x):r(D)}function C(D){return ai(D)?(e.consume(D),c=String.fromCharCode(D),j):r(D)}function j(D){if(D===null||D===47||D===62||zn(D)){const be=D===47,ce=c.toLowerCase();return!be&&!u&&Gx.includes(ce)?(a=1,i.interrupt?t(D):z(D)):MB.includes(c.toLowerCase())?(a=6,be?(e.consume(D),T):i.interrupt?t(D):z(D)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?r(D):u?P(D):I(D))}return D===45||ti(D)?(e.consume(D),c+=String.fromCharCode(D),j):r(D)}function T(D){return D===62?(e.consume(D),i.interrupt?t:z):r(D)}function P(D){return vn(D)?(e.consume(D),P):_(D)}function I(D){return D===47?(e.consume(D),_):D===58||D===95||ai(D)?(e.consume(D),Z):vn(D)?(e.consume(D),I):_(D)}function Z(D){return D===45||D===46||D===58||D===95||ti(D)?(e.consume(D),Z):q(D)}function q(D){return D===61?(e.consume(D),B):vn(D)?(e.consume(D),q):I(D)}function B(D){return D===null||D===60||D===61||D===62||D===96?r(D):D===34||D===39?(e.consume(D),m=D,E):vn(D)?(e.consume(D),B):A(D)}function E(D){return D===m?(e.consume(D),m=null,H):D===null||Yt(D)?r(D):(e.consume(D),E)}function A(D){return D===null||D===34||D===39||D===47||D===60||D===61||D===62||D===96||zn(D)?q(D):(e.consume(D),A)}function H(D){return D===47||D===62||vn(D)?I(D):r(D)}function _(D){return D===62?(e.consume(D),Y):r(D)}function Y(D){return D===null||Yt(D)?z(D):vn(D)?(e.consume(D),Y):r(D)}function z(D){return D===45&&a===2?(e.consume(D),te):D===60&&a===1?(e.consume(D),de):D===62&&a===4?(e.consume(D),L):D===63&&a===3?(e.consume(D),N):D===93&&a===5?(e.consume(D),M):Yt(D)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(EB,X,K)(D)):D===null||Yt(D)?(e.exit("htmlFlowData"),K(D)):(e.consume(D),z)}function K(D){return e.check(IB,O,X)(D)}function O(D){return e.enter("lineEnding"),e.consume(D),e.exit("lineEnding"),F}function F(D){return D===null||Yt(D)?K(D):(e.enter("htmlFlowData"),z(D))}function te(D){return D===45?(e.consume(D),N):z(D)}function de(D){return D===47?(e.consume(D),c="",W):z(D)}function W(D){if(D===62){const be=c.toLowerCase();return Gx.includes(be)?(e.consume(D),L):z(D)}return ai(D)&&c.length<8?(e.consume(D),c+=String.fromCharCode(D),W):z(D)}function M(D){return D===93?(e.consume(D),N):z(D)}function N(D){return D===62?(e.consume(D),L):D===45&&a===2?(e.consume(D),N):z(D)}function L(D){return D===null||Yt(D)?(e.exit("htmlFlowData"),X(D)):(e.consume(D),L)}function X(D){return e.exit("htmlFlow"),t(D)}}function _B(e,t,r){const i=this;return a;function a(c){return Yt(c)?(e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),u):r(c)}function u(c){return i.parser.lazy[i.now().line]?r(c):t(c)}}function OB(e,t,r){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(bu,t,r)}}const BB={name:"htmlText",tokenize:WB};function WB(e,t,r){const i=this;let a,u,c;return d;function d(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),m}function m(N){return N===33?(e.consume(N),f):N===47?(e.consume(N),q):N===63?(e.consume(N),I):ai(N)?(e.consume(N),A):r(N)}function f(N){return N===45?(e.consume(N),v):N===91?(e.consume(N),u=0,x):ai(N)?(e.consume(N),P):r(N)}function v(N){return N===45?(e.consume(N),y):r(N)}function g(N){return N===null?r(N):N===45?(e.consume(N),w):Yt(N)?(c=g,de(N)):(e.consume(N),g)}function w(N){return N===45?(e.consume(N),y):g(N)}function y(N){return N===62?te(N):N===45?w(N):g(N)}function x(N){const L="CDATA[";return N===L.charCodeAt(u++)?(e.consume(N),u===L.length?C:x):r(N)}function C(N){return N===null?r(N):N===93?(e.consume(N),j):Yt(N)?(c=C,de(N)):(e.consume(N),C)}function j(N){return N===93?(e.consume(N),T):C(N)}function T(N){return N===62?te(N):N===93?(e.consume(N),T):C(N)}function P(N){return N===null||N===62?te(N):Yt(N)?(c=P,de(N)):(e.consume(N),P)}function I(N){return N===null?r(N):N===63?(e.consume(N),Z):Yt(N)?(c=I,de(N)):(e.consume(N),I)}function Z(N){return N===62?te(N):I(N)}function q(N){return ai(N)?(e.consume(N),B):r(N)}function B(N){return N===45||ti(N)?(e.consume(N),B):E(N)}function E(N){return Yt(N)?(c=E,de(N)):vn(N)?(e.consume(N),E):te(N)}function A(N){return N===45||ti(N)?(e.consume(N),A):N===47||N===62||zn(N)?H(N):r(N)}function H(N){return N===47?(e.consume(N),te):N===58||N===95||ai(N)?(e.consume(N),_):Yt(N)?(c=H,de(N)):vn(N)?(e.consume(N),H):te(N)}function _(N){return N===45||N===46||N===58||N===95||ti(N)?(e.consume(N),_):Y(N)}function Y(N){return N===61?(e.consume(N),z):Yt(N)?(c=Y,de(N)):vn(N)?(e.consume(N),Y):H(N)}function z(N){return N===null||N===60||N===61||N===62||N===96?r(N):N===34||N===39?(e.consume(N),a=N,K):Yt(N)?(c=z,de(N)):vn(N)?(e.consume(N),z):(e.consume(N),O)}function K(N){return N===a?(e.consume(N),a=void 0,F):N===null?r(N):Yt(N)?(c=K,de(N)):(e.consume(N),K)}function O(N){return N===null||N===34||N===39||N===60||N===61||N===96?r(N):N===47||N===62||zn(N)?H(N):(e.consume(N),O)}function F(N){return N===47||N===62||zn(N)?H(N):r(N)}function te(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):r(N)}function de(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),W}function W(N){return vn(N)?Cn(e,M,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):M(N)}function M(N){return e.enter("htmlTextData"),c(N)}}const Xb={name:"labelEnd",resolveAll:qB,resolveTo:$B,tokenize:VB},UB={tokenize:GB},HB={tokenize:KB},zB={tokenize:YB};function qB(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&&Ei(e,0,e.length,r),e}function $B(e,t){let r=e.length,i=0,a,u,c,d;for(;r--;)if(a=e[r][1],u){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[r][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(c){if(e[r][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(u=r,a.type!=="labelLink")){i=2;break}}else a.type==="labelEnd"&&(c=r);const m={type:e[u][1].type==="labelLink"?"link":"image",start:{...e[u][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[u][1].start},end:{...e[c][1].end}},v={type:"labelText",start:{...e[u+i+2][1].end},end:{...e[c-2][1].start}};return d=[["enter",m,t],["enter",f,t]],d=Qi(d,e.slice(u+1,u+i+3)),d=Qi(d,[["enter",v,t]]),d=Qi(d,sm(t.parser.constructs.insideSpan.null,e.slice(u+i+4,c-3),t)),d=Qi(d,[["exit",v,t],e[c-2],e[c-1],["exit",f,t]]),d=Qi(d,e.slice(c+1)),d=Qi(d,[["exit",m,t]]),Ei(e,u,e.length,d),e}function VB(e,t,r){const i=this;let a=i.events.length,u,c;for(;a--;)if((i.events[a][1].type==="labelImage"||i.events[a][1].type==="labelLink")&&!i.events[a][1]._balanced){u=i.events[a][1];break}return d;function d(w){return u?u._inactive?g(w):(c=i.parser.defined.includes(gs(i.sliceSerialize({start:u.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(w),e.exit("labelMarker"),e.exit("labelEnd"),m):r(w)}function m(w){return w===40?e.attempt(UB,v,c?v:g)(w):w===91?e.attempt(HB,v,c?f:g)(w):c?v(w):g(w)}function f(w){return e.attempt(zB,v,g)(w)}function v(w){return t(w)}function g(w){return u._balanced=!0,r(w)}}function GB(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 zn(g)?_c(e,u)(g):u(g)}function u(g){return g===41?v(g):AP(e,c,d,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function c(g){return zn(g)?_c(e,m)(g):v(g)}function d(g){return r(g)}function m(g){return g===34||g===39||g===40?IP(e,f,r,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):v(g)}function f(g){return zn(g)?_c(e,v)(g):v(g)}function v(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):r(g)}}function KB(e,t,r){const i=this;return a;function a(d){return EP.call(i,e,u,c,"reference","referenceMarker","referenceString")(d)}function u(d){return i.parser.defined.includes(gs(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(d):r(d)}function c(d){return r(d)}}function YB(e,t,r){return i;function i(u){return e.enter("reference"),e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),a}function a(u){return u===93?(e.enter("referenceMarker"),e.consume(u),e.exit("referenceMarker"),e.exit("reference"),t):r(u)}}const XB={name:"labelStartImage",resolveAll:Xb.resolveAll,tokenize:QB};function QB(e,t,r){const i=this;return a;function a(d){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(d),e.exit("labelImageMarker"),u}function u(d){return d===91?(e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelImage"),c):r(d)}function c(d){return d===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(d):t(d)}}const JB={name:"labelStartLink",resolveAll:Xb.resolveAll,tokenize:ZB};function ZB(e,t,r){const i=this;return a;function a(c){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelLink"),u}function u(c){return c===94&&"_hiddenFootnoteSupport"in i.parser.constructs?r(c):t(c)}}const cf={name:"lineEnding",tokenize:eW};function eW(e,t){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),Cn(e,t,"linePrefix")}}const sh={name:"thematicBreak",tokenize:tW};function tW(e,t,r){let i=0,a;return u;function u(f){return e.enter("thematicBreak"),c(f)}function c(f){return a=f,d(f)}function d(f){return f===a?(e.enter("thematicBreakSequence"),m(f)):i>=3&&(f===null||Yt(f))?(e.exit("thematicBreak"),t(f)):r(f)}function m(f){return f===a?(e.consume(f),i++,m):(e.exit("thematicBreakSequence"),vn(f)?Cn(e,d,"whitespace")(f):d(f))}}const bi={continuation:{tokenize:sW},exit:oW,name:"list",tokenize:iW},nW={partial:!0,tokenize:lW},rW={partial:!0,tokenize:aW};function iW(e,t,r){const i=this,a=i.events[i.events.length-1];let u=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,c=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:Mg(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(sh,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 Mg(y)&&++c<10?(e.consume(y),m):(!i.interrupt||c<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(bu,i.interrupt?r:v,e.attempt(nW,w,g))}function v(y){return i.containerState.initialBlankLine=!0,u++,w(y)}function g(y){return vn(y)?(e.enter("listItemPrefixWhitespace"),e.consume(y),e.exit("listItemPrefixWhitespace"),w):r(y)}function w(y){return i.containerState.size=u+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(y)}}function sW(e,t,r){const i=this;return i.containerState._closeFlow=void 0,e.check(bu,a,u);function a(d){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,Cn(e,t,"listItemIndent",i.containerState.size+1)(d)}function u(d){return i.containerState.furtherBlankLines||!vn(d)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,c(d)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(rW,t,c)(d))}function c(d){return i.containerState._closeFlow=!0,i.interrupt=void 0,Cn(e,e.attempt(bi,t,r),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(d)}}function aW(e,t,r){const i=this;return Cn(e,a,"listItemIndent",i.containerState.size+1);function a(u){const c=i.events[i.events.length-1];return c&&c[1].type==="listItemIndent"&&c[2].sliceSerialize(c[1],!0).length===i.containerState.size?t(u):r(u)}}function oW(e){e.exit(this.containerState.type)}function lW(e,t,r){const i=this;return Cn(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(u){const c=i.events[i.events.length-1];return!vn(u)&&c&&c[1].type==="listItemPrefixWhitespace"?t(u):r(u)}}const Kx={name:"setextUnderline",resolveTo:cW,tokenize:uW};function cW(e,t){let r=e.length,i,a,u;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),!u&&e[r][1].type==="definition"&&(u=r);const c={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",u?(e.splice(a,0,["enter",c,t]),e.splice(u+1,0,["exit",e[i][1],t]),e[i][1].end={...e[u][1].end}):e[i][1]=c,e.push(["exit",c,t]),e}function uW(e,t,r){const i=this;let a;return u;function u(f){let v=i.events.length,g;for(;v--;)if(i.events[v][1].type!=="lineEnding"&&i.events[v][1].type!=="linePrefix"&&i.events[v][1].type!=="content"){g=i.events[v][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(e.enter("setextHeadingLine"),a=f,c(f)):r(f)}function c(f){return e.enter("setextHeadingLineSequence"),d(f)}function d(f){return f===a?(e.consume(f),d):(e.exit("setextHeadingLineSequence"),vn(f)?Cn(e,m,"lineSuffix")(f):m(f))}function m(f){return f===null||Yt(f)?(e.exit("setextHeadingLine"),t(f)):r(f)}}const dW={tokenize:hW};function hW(e){const t=this,r=e.attempt(bu,i,e.attempt(this.parser.constructs.flowInitial,a,Cn(e,e.attempt(this.parser.constructs.flow,a,e.attempt(bB,a)),"linePrefix")));return r;function i(u){if(u===null){e.consume(u);return}return e.enter("lineEndingBlank"),e.consume(u),e.exit("lineEndingBlank"),t.currentConstruct=void 0,r}function a(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),t.currentConstruct=void 0,r}}const mW={resolveAll:FP()},pW=LP("string"),fW=LP("text");function LP(e){return{resolveAll:FP(e==="text"?gW:void 0),tokenize:t};function t(r){const i=this,a=this.parser.constructs[e],u=r.attempt(a,c,d);return c;function c(v){return f(v)?u(v):d(v)}function d(v){if(v===null){r.consume(v);return}return r.enter("data"),r.consume(v),m}function m(v){return f(v)?(r.exit("data"),u(v)):(r.consume(v),m)}function f(v){if(v===null)return!0;const g=a[v];let w=-1;if(g)for(;++w<g.length;){const y=g[w];if(!y.previous||y.previous.call(i,i.previous))return!0}return!1}}}function FP(e){return t;function t(r,i){let a=-1,u;for(;++a<=r.length;)u===void 0?r[a]&&r[a][1].type==="data"&&(u=a,a++):(!r[a]||r[a][1].type!=="data")&&(a!==u+2&&(r[u][1].end=r[a-1][1].end,r.splice(u+2,a-u-2),a=u+2),u=void 0);return e?e(r,i):r}}function gW(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 u=a.length,c=-1,d=0,m;for(;u--;){const f=a[u];if(typeof f=="string"){for(c=f.length;f.charCodeAt(c-1)===32;)d++,c--;if(c)break;c=-1}else if(f===-2)m=!0,d++;else if(f!==-1){u++;break}}if(t._contentTypeTextTrailing&&r===e.length&&(d=0),d){const f={type:r===e.length||m||d<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:u?c:i.start._bufferIndex+c,_index:i.start._index+u,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 bW={42:bi,43:bi,45:bi,48:bi,49:bi,50:bi,51:bi,52:bi,53:bi,54:bi,55:bi,56:bi,57:bi,62:PP},vW={91:xB},wW={[-2]:lf,[-1]:lf,32:lf},yW={35:PB,42:sh,45:[Kx,sh],60:AB,61:Kx,95:sh,96:Vx,126:Vx},kW={38:RP,92:DP},xW={[-5]:cf,[-4]:cf,[-3]:cf,33:XB,38:RP,42:Ag,60:[J2,BB],91:JB,92:[NB,DP],93:Xb,95:Ag,96:dB},SW={null:[Ag,mW]},CW={null:[42,95]},jW={null:[]},NW=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:CW,contentInitial:vW,disable:jW,document:bW,flow:yW,flowInitial:wW,insideSpan:SW,string:kW,text:xW},Symbol.toStringTag,{value:"Module"}));function TW(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={},u=[];let c=[],d=[];const m={attempt:E(q),check:E(B),consume:P,enter:I,exit:Z,interrupt:E(B,{interrupt:!0})},f={code:null,containerState:{},defineSkip:C,events:[],now:x,parser:e,previous:null,sliceSerialize:w,sliceStream:y,write:g};let v=t.tokenize.call(f,m);return t.resolveAll&&u.push(t),f;function g(Y){return c=Qi(c,Y),j(),c[c.length-1]!==null?[]:(A(t,0),f.events=sm(u,f.events,f),f.events)}function w(Y,z){return DW(y(Y),z)}function y(Y){return PW(c,Y)}function x(){const{_bufferIndex:Y,_index:z,line:K,column:O,offset:F}=i;return{_bufferIndex:Y,_index:z,line:K,column:O,offset:F}}function C(Y){a[Y.line]=Y.column,_()}function j(){let Y;for(;i._index<c.length;){const z=c[i._index];if(typeof z=="string")for(Y=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===Y&&i._bufferIndex<z.length;)T(z.charCodeAt(i._bufferIndex));else T(z)}}function T(Y){v=v(Y)}function P(Y){Yt(Y)?(i.line++,i.column=1,i.offset+=Y===-3?2:1,_()):Y!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===c[i._index].length&&(i._bufferIndex=-1,i._index++)),f.previous=Y}function I(Y,z){const K=z||{};return K.type=Y,K.start=x(),f.events.push(["enter",K,f]),d.push(K),K}function Z(Y){const z=d.pop();return z.end=x(),f.events.push(["exit",z,f]),z}function q(Y,z){A(Y,z.from)}function B(Y,z){z.restore()}function E(Y,z){return K;function K(O,F,te){let de,W,M,N;return Array.isArray(O)?X(O):"tokenize"in O?X([O]):L(O);function L(le){return ye;function ye(Se){const _e=Se!==null&&le[Se],Ce=Se!==null&&le.null,Nt=[...Array.isArray(_e)?_e:_e?[_e]:[],...Array.isArray(Ce)?Ce:Ce?[Ce]:[]];return X(Nt)(Se)}}function X(le){return de=le,W=0,le.length===0?te:D(le[W])}function D(le){return ye;function ye(Se){return N=H(),M=le,le.partial||(f.currentConstruct=le),le.name&&f.parser.constructs.disable.null.includes(le.name)?ce():le.tokenize.call(z?Object.assign(Object.create(f),z):f,m,be,ce)(Se)}}function be(le){return Y(M,N),F}function ce(le){return N.restore(),++W<de.length?D(de[W]):te}}}function A(Y,z){Y.resolveAll&&!u.includes(Y)&&u.push(Y),Y.resolve&&Ei(f.events,z,f.events.length-z,Y.resolve(f.events.slice(z),f)),Y.resolveTo&&(f.events=Y.resolveTo(f.events,f))}function H(){const Y=x(),z=f.previous,K=f.currentConstruct,O=f.events.length,F=Array.from(d);return{from:O,restore:te};function te(){i=Y,f.previous=z,f.currentConstruct=K,f.events.length=O,d=F,_()}}function _(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function PW(e,t){const r=t.start._index,i=t.start._bufferIndex,a=t.end._index,u=t.end._bufferIndex;let c;if(r===a)c=[e[r].slice(i,u)];else{if(c=e.slice(r,a),i>-1){const d=c[0];typeof d=="string"?c[0]=d.slice(i):c.shift()}u>0&&c.push(e[a].slice(0,u))}return c}function DW(e,t){let r=-1;const i=[];let a;for(;++r<e.length;){const u=e[r];let c;if(typeof u=="string")c=u;else switch(u){case-5:{c="\r";break}case-4:{c=`
|
|
71
|
+
`;break}case-3:{c=`\r
|
|
72
|
+
`;break}case-2:{c=t?" ":" ";break}case-1:{if(!t&&a)continue;c=" ";break}default:c=String.fromCharCode(u)}a=u===-2,i.push(c)}return i.join("")}function RW(e){const i={constructs:NP([NW,...(e||{}).extensions||[]]),content:a($2),defined:[],document:a(G2),flow:a(dW),lazy:{},string:a(pW),text:a(fW)};return i;function a(u){return c;function c(d){return TW(i,u,d)}}}function MW(e){for(;!MP(e););return e}const Yx=/[\0\t\n\r]/g;function AW(){let e=1,t="",r=!0,i;return a;function a(u,c,d){const m=[];let f,v,g,w,y;for(u=t+(typeof u=="string"?u.toString():new TextDecoder(c||void 0).decode(u)),g=0,t="",r&&(u.charCodeAt(0)===65279&&g++,r=void 0);g<u.length;){if(Yx.lastIndex=g,f=Yx.exec(u),w=f&&f.index!==void 0?f.index:u.length,y=u.charCodeAt(w),!f){t=u.slice(g);break}if(y===10&&g===w&&i)m.push(-3),i=void 0;else switch(i&&(m.push(-5),i=void 0),g<w&&(m.push(u.slice(g,w)),e+=w-g),y){case 0:{m.push(65533),e++;break}case 9:{for(v=Math.ceil(e/4)*4,m.push(-2);e++<v;)m.push(-1);break}case 10:{m.push(-4),e=1;break}default:i=!0,e=1}g=w+1}return d&&(i&&m.push(-5),t&&m.push(t),m.push(null)),m}}const EW=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function IW(e){return e.replace(EW,LW)}function LW(e,t,r){if(t)return t;if(r.charCodeAt(0)===35){const a=r.charCodeAt(1),u=a===120||a===88;return TP(r.slice(u?2:1),u?16:10)}return Yb(r)||e}const _P={}.hasOwnProperty;function FW(e,t,r){return t&&typeof t=="object"&&(r=t,t=void 0),_W(r)(MW(RW(r).document().write(AW()(e,t,!0))))}function _W(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:u(qe),autolinkProtocol:H,autolinkEmail:H,atxHeading:u(rt),blockQuote:u(Ce),characterEscape:H,characterReference:H,codeFenced:u(Nt),codeFencedFenceInfo:c,codeFencedFenceMeta:c,codeIndented:u(Nt,c),codeText:u(ct,c),codeTextData:H,data:H,codeFlowValue:H,definition:u(gt),definitionDestinationString:c,definitionLabelString:c,definitionTitleString:c,emphasis:u(ft),hardBreakEscape:u(fe),hardBreakTrailing:u(fe),htmlFlow:u(ue,c),htmlFlowData:H,htmlText:u(ue,c),htmlTextData:H,image:u(Oe),label:c,link:u(qe),listItem:u(yt),listItemValue:w,listOrdered:u(nt,g),listUnordered:u(nt),paragraph:u(Me),reference:D,referenceString:c,resourceDestinationString:c,resourceTitleString:c,setextHeading:u(rt),strong:u(Le),thematicBreak:u(ut)},exit:{atxHeading:m(),atxHeadingSequence:q,autolink:m(),autolinkEmail:_e,autolinkProtocol:Se,blockQuote:m(),characterEscapeValue:_,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:le,characterReference:ye,codeFenced:m(j),codeFencedFence:C,codeFencedFenceInfo:y,codeFencedFenceMeta:x,codeFlowValue:_,codeIndented:m(T),codeText:m(F),codeTextData:_,data:_,definition:m(),definitionDestinationString:Z,definitionLabelString:P,definitionTitleString:I,emphasis:m(),hardBreakEscape:m(z),hardBreakTrailing:m(z),htmlFlow:m(K),htmlFlowData:_,htmlText:m(O),htmlTextData:_,image:m(de),label:M,labelText:W,lineEnding:Y,link:m(te),listItem:m(),listOrdered:m(),listUnordered:m(),paragraph:m(),referenceString:be,resourceDestinationString:N,resourceTitleString:L,resource:X,setextHeading:m(A),setextHeadingLineSequence:E,setextHeadingText:B,strong:m(),thematicBreak:m()}};OP(t,(e||{}).mdastExtensions||[]);const r={};return i;function i(we){let xe={type:"root",children:[]};const Qe={stack:[xe],tokenStack:[],config:t,enter:d,exit:f,buffer:c,resume:v,data:r},Fe=[];let dt=-1;for(;++dt<we.length;)if(we[dt][1].type==="listOrdered"||we[dt][1].type==="listUnordered")if(we[dt][0]==="enter")Fe.push(dt);else{const It=Fe.pop();dt=a(we,It,dt)}for(dt=-1;++dt<we.length;){const It=t[we[dt][0]];_P.call(It,we[dt][1].type)&&It[we[dt][1].type].call(Object.assign({sliceSerialize:we[dt][2].sliceSerialize},Qe),we[dt][1])}if(Qe.tokenStack.length>0){const It=Qe.tokenStack[Qe.tokenStack.length-1];(It[1]||Xx).call(Qe,void 0,It[0])}for(xe.position={start:Pa(we.length>0?we[0][1].start:{line:1,column:1,offset:0}),end:Pa(we.length>0?we[we.length-2][1].end:{line:1,column:1,offset:0})},dt=-1;++dt<t.transforms.length;)xe=t.transforms[dt](xe)||xe;return xe}function a(we,xe,Qe){let Fe=xe-1,dt=-1,It=!1,qt,Ht,Ft,Dt;for(;++Fe<=Qe;){const bt=we[Fe];switch(bt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{bt[0]==="enter"?dt++:dt--,Dt=void 0;break}case"lineEndingBlank":{bt[0]==="enter"&&(qt&&!Dt&&!dt&&!Ft&&(Ft=Fe),Dt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Dt=void 0}if(!dt&&bt[0]==="enter"&&bt[1].type==="listItemPrefix"||dt===-1&&bt[0]==="exit"&&(bt[1].type==="listUnordered"||bt[1].type==="listOrdered")){if(qt){let Qt=Fe;for(Ht=void 0;Qt--;){const zt=we[Qt];if(zt[1].type==="lineEnding"||zt[1].type==="lineEndingBlank"){if(zt[0]==="exit")continue;Ht&&(we[Ht][1].type="lineEndingBlank",It=!0),zt[1].type="lineEnding",Ht=Qt}else if(!(zt[1].type==="linePrefix"||zt[1].type==="blockQuotePrefix"||zt[1].type==="blockQuotePrefixWhitespace"||zt[1].type==="blockQuoteMarker"||zt[1].type==="listItemIndent"))break}Ft&&(!Ht||Ft<Ht)&&(qt._spread=!0),qt.end=Object.assign({},Ht?we[Ht][1].start:bt[1].end),we.splice(Ht||Fe,0,["exit",qt,bt[2]]),Fe++,Qe++}if(bt[1].type==="listItemPrefix"){const Qt={type:"listItem",_spread:!1,start:Object.assign({},bt[1].start),end:void 0};qt=Qt,we.splice(Fe,0,["enter",Qt,bt[2]]),Fe++,Qe++,Ft=void 0,Dt=!0}}}return we[xe][1]._spread=It,Qe}function u(we,xe){return Qe;function Qe(Fe){d.call(this,we(Fe),Fe),xe&&xe.call(this,Fe)}}function c(){this.stack.push({type:"fragment",children:[]})}function d(we,xe,Qe){this.stack[this.stack.length-1].children.push(we),this.stack.push(we),this.tokenStack.push([xe,Qe||void 0]),we.position={start:Pa(xe.start),end:void 0}}function m(we){return xe;function xe(Qe){we&&we.call(this,Qe),f.call(this,Qe)}}function f(we,xe){const Qe=this.stack.pop(),Fe=this.tokenStack.pop();if(Fe)Fe[0].type!==we.type&&(xe?xe.call(this,we,Fe[0]):(Fe[1]||Xx).call(this,we,Fe[0]));else throw new Error("Cannot close `"+we.type+"` ("+Fc({start:we.start,end:we.end})+"): it’s not open");Qe.position.end=Pa(we.end)}function v(){return Kb(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function w(we){if(this.data.expectingFirstListItemValue){const xe=this.stack[this.stack.length-2];xe.start=Number.parseInt(this.sliceSerialize(we),10),this.data.expectingFirstListItemValue=void 0}}function y(){const we=this.resume(),xe=this.stack[this.stack.length-1];xe.lang=we}function x(){const we=this.resume(),xe=this.stack[this.stack.length-1];xe.meta=we}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function j(){const we=this.resume(),xe=this.stack[this.stack.length-1];xe.value=we.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function T(){const we=this.resume(),xe=this.stack[this.stack.length-1];xe.value=we.replace(/(\r?\n|\r)$/g,"")}function P(we){const xe=this.resume(),Qe=this.stack[this.stack.length-1];Qe.label=xe,Qe.identifier=gs(this.sliceSerialize(we)).toLowerCase()}function I(){const we=this.resume(),xe=this.stack[this.stack.length-1];xe.title=we}function Z(){const we=this.resume(),xe=this.stack[this.stack.length-1];xe.url=we}function q(we){const xe=this.stack[this.stack.length-1];if(!xe.depth){const Qe=this.sliceSerialize(we).length;xe.depth=Qe}}function B(){this.data.setextHeadingSlurpLineEnding=!0}function E(we){const xe=this.stack[this.stack.length-1];xe.depth=this.sliceSerialize(we).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function H(we){const Qe=this.stack[this.stack.length-1].children;let Fe=Qe[Qe.length-1];(!Fe||Fe.type!=="text")&&(Fe=pt(),Fe.position={start:Pa(we.start),end:void 0},Qe.push(Fe)),this.stack.push(Fe)}function _(we){const xe=this.stack.pop();xe.value+=this.sliceSerialize(we),xe.position.end=Pa(we.end)}function Y(we){const xe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Qe=xe.children[xe.children.length-1];Qe.position.end=Pa(we.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(xe.type)&&(H.call(this,we),_.call(this,we))}function z(){this.data.atHardBreak=!0}function K(){const we=this.resume(),xe=this.stack[this.stack.length-1];xe.value=we}function O(){const we=this.resume(),xe=this.stack[this.stack.length-1];xe.value=we}function F(){const we=this.resume(),xe=this.stack[this.stack.length-1];xe.value=we}function te(){const we=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";we.type+="Reference",we.referenceType=xe,delete we.url,delete we.title}else delete we.identifier,delete we.label;this.data.referenceType=void 0}function de(){const we=this.stack[this.stack.length-1];if(this.data.inReference){const xe=this.data.referenceType||"shortcut";we.type+="Reference",we.referenceType=xe,delete we.url,delete we.title}else delete we.identifier,delete we.label;this.data.referenceType=void 0}function W(we){const xe=this.sliceSerialize(we),Qe=this.stack[this.stack.length-2];Qe.label=IW(xe),Qe.identifier=gs(xe).toLowerCase()}function M(){const we=this.stack[this.stack.length-1],xe=this.resume(),Qe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Qe.type==="link"){const Fe=we.children;Qe.children=Fe}else Qe.alt=xe}function N(){const we=this.resume(),xe=this.stack[this.stack.length-1];xe.url=we}function L(){const we=this.resume(),xe=this.stack[this.stack.length-1];xe.title=we}function X(){this.data.inReference=void 0}function D(){this.data.referenceType="collapsed"}function be(we){const xe=this.resume(),Qe=this.stack[this.stack.length-1];Qe.label=xe,Qe.identifier=gs(this.sliceSerialize(we)).toLowerCase(),this.data.referenceType="full"}function ce(we){this.data.characterReferenceType=we.type}function le(we){const xe=this.sliceSerialize(we),Qe=this.data.characterReferenceType;let Fe;Qe?(Fe=TP(xe,Qe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Fe=Yb(xe);const dt=this.stack[this.stack.length-1];dt.value+=Fe}function ye(we){const xe=this.stack.pop();xe.position.end=Pa(we.end)}function Se(we){_.call(this,we);const xe=this.stack[this.stack.length-1];xe.url=this.sliceSerialize(we)}function _e(we){_.call(this,we);const xe=this.stack[this.stack.length-1];xe.url="mailto:"+this.sliceSerialize(we)}function Ce(){return{type:"blockquote",children:[]}}function Nt(){return{type:"code",lang:null,meta:null,value:""}}function ct(){return{type:"inlineCode",value:""}}function gt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function ft(){return{type:"emphasis",children:[]}}function rt(){return{type:"heading",depth:0,children:[]}}function fe(){return{type:"break"}}function ue(){return{type:"html",value:""}}function Oe(){return{type:"image",title:null,url:"",alt:null}}function qe(){return{type:"link",title:null,url:"",children:[]}}function nt(we){return{type:"list",ordered:we.type==="listOrdered",start:null,spread:we._spread,children:[]}}function yt(we){return{type:"listItem",spread:we._spread,checked:null,children:[]}}function Me(){return{type:"paragraph",children:[]}}function Le(){return{type:"strong",children:[]}}function pt(){return{type:"text",value:""}}function ut(){return{type:"thematicBreak"}}}function Pa(e){return{line:e.line,column:e.column,offset:e.offset}}function OP(e,t){let r=-1;for(;++r<t.length;){const i=t[r];Array.isArray(i)?OP(e,i):OW(e,i)}}function OW(e,t){let r;for(r in t)if(_P.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 Xx(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Fc({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Fc({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Fc({start:t.start,end:t.end})+") is still open")}function BW(e){const t=this;t.parser=r;function r(i){return FW(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function WW(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 UW(e,t){const r={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,r),[e.applyData(t,r),{type:"text",value:`
|
|
73
|
+
`}]}function HW(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 u={type:"element",tagName:"code",properties:i,children:[{type:"text",value:r}]};return t.meta&&(u.data={meta:t.meta}),e.patch(t,u),u=e.applyData(t,u),u={type:"element",tagName:"pre",properties:{},children:[u]},e.patch(t,u),u}function zW(e,t){const r={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function qW(e,t){const r={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function $W(e,t){const r=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=Ll(i.toLowerCase()),u=e.footnoteOrder.indexOf(i);let c,d=e.footnoteCounts.get(i);d===void 0?(d=0,e.footnoteOrder.push(i),c=e.footnoteOrder.length):c=u+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(c)}]};e.patch(t,m);const f={type:"element",tagName:"sup",properties:{},children:[m]};return e.patch(t,f),e.applyData(t,f)}function VW(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 GW(e,t){if(e.options.allowDangerousHtml){const r={type:"raw",value:t.value};return e.patch(t,r),e.applyData(t,r)}}function BP(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),u=a[0];u&&u.type==="text"?u.value="["+u.value:a.unshift({type:"text",value:"["});const c=a[a.length-1];return c&&c.type==="text"?c.value+=i:a.push({type:"text",value:i}),a}function KW(e,t){const r=String(t.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return BP(e,t);const a={src:Ll(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(a.title=i.title);const u={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,u),e.applyData(t,u)}function YW(e,t){const r={src:Ll(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 XW(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 QW(e,t){const r=String(t.identifier).toUpperCase(),i=e.definitionById.get(r);if(!i)return BP(e,t);const a={href:Ll(i.url||"")};i.title!==null&&i.title!==void 0&&(a.title=i.title);const u={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,u),e.applyData(t,u)}function JW(e,t){const r={href:Ll(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 ZW(e,t,r){const i=e.all(t),a=r?eU(r):WP(t),u={},c=[];if(typeof t.checked=="boolean"){const v=i[0];let g;v&&v.type==="element"&&v.tagName==="p"?g=v:(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:[]}),u.className=["task-list-item"]}let d=-1;for(;++d<i.length;){const v=i[d];(a||d!==0||v.type!=="element"||v.tagName!=="p")&&c.push({type:"text",value:`
|
|
75
|
+
`}),v.type==="element"&&v.tagName==="p"&&!a?c.push(...v.children):c.push(v)}const m=i[i.length-1];m&&(a||m.type!=="element"||m.tagName!=="p")&&c.push({type:"text",value:`
|
|
76
|
+
`});const f={type:"element",tagName:"li",properties:u,children:c};return e.patch(t,f),e.applyData(t,f)}function eU(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=WP(r[i])}return t}function WP(e){const t=e.spread;return t??e.children.length>1}function tU(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 c=i[a];if(c.type==="element"&&c.tagName==="li"&&c.properties&&Array.isArray(c.properties.className)&&c.properties.className.includes("task-list-item")){r.className=["contains-task-list"];break}}const u={type:"element",tagName:t.ordered?"ol":"ul",properties:r,children:e.wrap(i,!0)};return e.patch(t,u),e.applyData(t,u)}function nU(e,t){const r={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function rU(e,t){const r={type:"root",children:e.wrap(e.all(t))};return e.patch(t,r),e.applyData(t,r)}function iU(e,t){const r={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function sU(e,t){const r=e.all(t),i=r.shift(),a=[];if(i){const c={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],c),a.push(c)}if(r.length>0){const c={type:"element",tagName:"tbody",properties:{},children:e.wrap(r,!0)},d=qb(t.children[1]),m=wP(t.children[t.children.length-1]);d&&m&&(c.position={start:d,end:m}),a.push(c)}const u={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,u),e.applyData(t,u)}function aU(e,t,r){const i=r?r.children:void 0,u=(i?i.indexOf(t):1)===0?"th":"td",c=r&&r.type==="table"?r.align:void 0,d=c?c.length:t.children.length;let m=-1;const f=[];for(;++m<d;){const g=t.children[m],w={},y=c?c[m]:void 0;y&&(w.align=y);let x={type:"element",tagName:u,properties:w,children:[]};g&&(x.children=e.all(g),e.patch(g,x),x=e.applyData(g,x)),f.push(x)}const v={type:"element",tagName:"tr",properties:{},children:e.wrap(f,!0)};return e.patch(t,v),e.applyData(t,v)}function oU(e,t){const r={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}const Qx=9,Jx=32;function lU(e){const t=String(e),r=/\r?\n|\r/g;let i=r.exec(t),a=0;const u=[];for(;i;)u.push(Zx(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=r.exec(t);return u.push(Zx(t.slice(a),a>0,!1)),u.join("")}function Zx(e,t,r){let i=0,a=e.length;if(t){let u=e.codePointAt(i);for(;u===Qx||u===Jx;)i++,u=e.codePointAt(i)}if(r){let u=e.codePointAt(a-1);for(;u===Qx||u===Jx;)a--,u=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function cU(e,t){const r={type:"text",value:lU(String(t.value))};return e.patch(t,r),e.applyData(t,r)}function uU(e,t){const r={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,r),e.applyData(t,r)}const dU={blockquote:WW,break:UW,code:HW,delete:zW,emphasis:qW,footnoteReference:$W,heading:VW,html:GW,imageReference:KW,image:YW,inlineCode:XW,linkReference:QW,link:JW,listItem:ZW,list:tU,paragraph:nU,root:rU,strong:iU,table:sU,tableCell:oU,tableRow:aU,text:cU,thematicBreak:uU,toml:Nd,yaml:Nd,definition:Nd,footnoteDefinition:Nd};function Nd(){}const UP=-1,am=0,Oc=1,Ph=2,Qb=3,Jb=4,Zb=5,ev=6,HP=7,zP=8,eS=typeof self=="object"?self:globalThis,hU=(e,t)=>{const r=(a,u)=>(e.set(u,a),a),i=a=>{if(e.has(a))return e.get(a);const[u,c]=t[a];switch(u){case am:case UP:return r(c,a);case Oc:{const d=r([],a);for(const m of c)d.push(i(m));return d}case Ph:{const d=r({},a);for(const[m,f]of c)d[i(m)]=i(f);return d}case Qb:return r(new Date(c),a);case Jb:{const{source:d,flags:m}=c;return r(new RegExp(d,m),a)}case Zb:{const d=r(new Map,a);for(const[m,f]of c)d.set(i(m),i(f));return d}case ev:{const d=r(new Set,a);for(const m of c)d.add(i(m));return d}case HP:{const{name:d,message:m}=c;return r(new eS[d](m),a)}case zP:return r(BigInt(c),a);case"BigInt":return r(Object(BigInt(c)),a);case"ArrayBuffer":return r(new Uint8Array(c).buffer,c);case"DataView":{const{buffer:d}=new Uint8Array(c);return r(new DataView(d),c)}}return r(new eS[u](c),a)};return i},tS=e=>hU(new Map,e)(0),ll="",{toString:mU}={},{keys:pU}=Object,gc=e=>{const t=typeof e;if(t!=="object"||!e)return[am,t];const r=mU.call(e).slice(8,-1);switch(r){case"Array":return[Oc,ll];case"Object":return[Ph,ll];case"Date":return[Qb,ll];case"RegExp":return[Jb,ll];case"Map":return[Zb,ll];case"Set":return[ev,ll];case"DataView":return[Oc,r]}return r.includes("Array")?[Oc,r]:r.includes("Error")?[HP,r]:[Ph,r]},Td=([e,t])=>e===am&&(t==="function"||t==="symbol"),fU=(e,t,r,i)=>{const a=(c,d)=>{const m=i.push(c)-1;return r.set(d,m),m},u=c=>{if(r.has(c))return r.get(c);let[d,m]=gc(c);switch(d){case am:{let v=c;switch(m){case"bigint":d=zP,v=c.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+m);v=null;break;case"undefined":return a([UP],c)}return a([d,v],c)}case Oc:{if(m){let w=c;return m==="DataView"?w=new Uint8Array(c.buffer):m==="ArrayBuffer"&&(w=new Uint8Array(c)),a([m,[...w]],c)}const v=[],g=a([d,v],c);for(const w of c)v.push(u(w));return g}case Ph:{if(m)switch(m){case"BigInt":return a([m,c.toString()],c);case"Boolean":case"Number":case"String":return a([m,c.valueOf()],c)}if(t&&"toJSON"in c)return u(c.toJSON());const v=[],g=a([d,v],c);for(const w of pU(c))(e||!Td(gc(c[w])))&&v.push([u(w),u(c[w])]);return g}case Qb:return a([d,c.toISOString()],c);case Jb:{const{source:v,flags:g}=c;return a([d,{source:v,flags:g}],c)}case Zb:{const v=[],g=a([d,v],c);for(const[w,y]of c)(e||!(Td(gc(w))||Td(gc(y))))&&v.push([u(w),u(y)]);return g}case ev:{const v=[],g=a([d,v],c);for(const w of c)(e||!Td(gc(w)))&&v.push(u(w));return g}}const{message:f}=c;return a([d,{name:m,message:f}],c)};return u},nS=(e,{json:t,lossy:r}={})=>{const i=[];return fU(!(t||r),!!t,new Map,i)(e),i},Dh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?tS(nS(e,t)):structuredClone(e):(e,t)=>tS(nS(e,t));function gU(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 bU(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function vU(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=e.options.footnoteBackContent||gU,i=e.options.footnoteBackLabel||bU,a=e.options.footnoteLabel||"Footnotes",u=e.options.footnoteLabelTagName||"h2",c=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 v=e.all(f),g=String(f.identifier).toUpperCase(),w=Ll(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-"+w+(y>1?"-"+y:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(m,y),className:["data-footnote-backref"]},children:Array.isArray(P)?P:[P]})}const j=v[v.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 v.push(...x);const T={type:"element",tagName:"li",properties:{id:t+"fn-"+w},children:e.wrap(v,!0)};e.patch(f,T),d.push(T)}if(d.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:u,properties:{...Dh(c),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 om=(function(e){if(e==null)return xU;if(typeof e=="function")return lm(e);if(typeof e=="object")return Array.isArray(e)?wU(e):yU(e);if(typeof e=="string")return kU(e);throw new Error("Expected function, string, or object as test")});function wU(e){const t=[];let r=-1;for(;++r<e.length;)t[r]=om(e[r]);return lm(i);function i(...a){let u=-1;for(;++u<t.length;)if(t[u].apply(this,a))return!0;return!1}}function yU(e){const t=e;return lm(r);function r(i){const a=i;let u;for(u in e)if(a[u]!==t[u])return!1;return!0}}function kU(e){return lm(t);function t(r){return r&&r.type===e}}function lm(e){return t;function t(r,i,a){return!!(SU(r)&&e.call(this,r,typeof i=="number"?i:void 0,a||void 0))}}function xU(){return!0}function SU(e){return e!==null&&typeof e=="object"&&"type"in e}const qP=[],CU=!0,Eg=!1,jU="skip";function $P(e,t,r,i){let a;typeof t=="function"&&typeof r!="function"?(i=r,r=t):a=t;const u=om(a),c=i?-1:1;d(e,void 0,[])();function d(m,f,v){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(w,"name",{value:"node ("+(m.type+(y?"<"+y+">":""))+")"})}return w;function w(){let y=qP,x,C,j;if((!t||u(m,f,v[v.length-1]||void 0))&&(y=NU(r(m,v)),y[0]===Eg))return y;if("children"in m&&m.children){const T=m;if(T.children&&y[0]!==jU)for(C=(i?T.children.length:-1)+c,j=v.concat(T);C>-1&&C<T.children.length;){const P=T.children[C];if(x=d(P,C,j)(),x[0]===Eg)return x;C=typeof x[1]=="number"?x[1]:C+c}}return y}}}function NU(e){return Array.isArray(e)?e:typeof e=="number"?[CU,e]:e==null?qP:[e]}function tv(e,t,r,i){let a,u,c;typeof t=="function"&&typeof r!="function"?(u=void 0,c=t,a=r):(u=t,c=r,a=i),$P(e,u,d,a);function d(m,f){const v=f[f.length-1],g=v?v.children.indexOf(m):void 0;return c(m,g,v)}}const Ig={}.hasOwnProperty,TU={};function PU(e,t){const r=t||TU,i=new Map,a=new Map,u=new Map,c={...dU,...r.handlers},d={all:f,applyData:RU,definitionById:i,footnoteById:a,footnoteCounts:u,footnoteOrder:[],handlers:c,one:m,options:r,patch:DU,wrap:AU};return tv(e,function(v){if(v.type==="definition"||v.type==="footnoteDefinition"){const g=v.type==="definition"?i:a,w=String(v.identifier).toUpperCase();g.has(w)||g.set(w,v)}}),d;function m(v,g){const w=v.type,y=d.handlers[w];if(Ig.call(d.handlers,w)&&y)return y(d,v,g);if(d.options.passThrough&&d.options.passThrough.includes(w)){if("children"in v){const{children:C,...j}=v,T=Dh(j);return T.children=d.all(v),T}return Dh(v)}return(d.options.unknownHandler||MU)(d,v,g)}function f(v){const g=[];if("children"in v){const w=v.children;let y=-1;for(;++y<w.length;){const x=d.one(w[y],v);if(x){if(y&&w[y-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=rS(x.value)),!Array.isArray(x)&&x.type==="element")){const C=x.children[0];C&&C.type==="text"&&(C.value=rS(C.value))}Array.isArray(x)?g.push(...x):g.push(x)}}}return g}}function DU(e,t){e.position&&(t.position=b2(e))}function RU(e,t){let r=t;if(e&&e.data){const i=e.data.hName,a=e.data.hChildren,u=e.data.hProperties;if(typeof i=="string")if(r.type==="element")r.tagName=i;else{const c="children"in r?r.children:[r];r={type:"element",tagName:i,properties:{},children:c}}r.type==="element"&&u&&Object.assign(r.properties,Dh(u)),"children"in r&&r.children&&a!==null&&a!==void 0&&(r.children=a)}return r}function MU(e,t){const r=t.data||{},i="value"in t&&!(Ig.call(r,"hProperties")||Ig.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 AU(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 rS(e){let t=0,r=e.charCodeAt(t);for(;r===9||r===32;)t++,r=e.charCodeAt(t);return e.slice(t)}function iS(e,t){const r=PU(e,t),i=r.one(e,void 0),a=vU(r),u=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return a&&u.children.push({type:"text",value:`
|
|
82
|
+
`},a),u}function EU(e,t){return e&&"run"in e?async function(r,i){const a=iS(r,{file:i,...t});await e.run(a,i)}:function(r,i){return iS(r,{file:i,...e||t})}}function sS(e){if(e)throw e}var uf,aS;function IU(){if(aS)return uf;aS=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]"},u=function(f){if(!f||t.call(f)!=="[object Object]")return!1;var v=e.call(f,"constructor"),g=f.constructor&&f.constructor.prototype&&e.call(f.constructor.prototype,"isPrototypeOf");if(f.constructor&&!v&&!g)return!1;var w;for(w in f);return typeof w>"u"||e.call(f,w)},c=function(f,v){r&&v.name==="__proto__"?r(f,v.name,{enumerable:!0,configurable:!0,value:v.newValue,writable:!0}):f[v.name]=v.newValue},d=function(f,v){if(v==="__proto__")if(e.call(f,v)){if(i)return i(f,v).value}else return;return f[v]};return uf=function m(){var f,v,g,w,y,x,C=arguments[0],j=1,T=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<T;++j)if(f=arguments[j],f!=null)for(v in f)g=d(C,v),w=d(f,v),C!==w&&(P&&w&&(u(w)||(y=a(w)))?(y?(y=!1,x=g&&a(g)?g:[]):x=g&&u(g)?g:{},c(C,{name:v,newValue:m(P,x,w)})):typeof w<"u"&&c(C,{name:v,newValue:w}));return C},uf}var LU=IU();const df=au(LU);function Lg(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 FU(){const e=[],t={run:r,use:i};return t;function r(...a){let u=-1;const c=a.pop();if(typeof c!="function")throw new TypeError("Expected function as last argument, not "+c);d(null,...a);function d(m,...f){const v=e[++u];let g=-1;if(m){c(m);return}for(;++g<a.length;)(f[g]===null||f[g]===void 0)&&(f[g]=a[g]);a=f,v?_U(v,d)(...f):c(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 _U(e,t){let r;return i;function i(...c){const d=e.length>c.length;let m;d&&c.push(a);try{m=e.apply(this,c)}catch(f){const v=f;if(d&&r)throw v;return a(v)}d||(m&&m.then&&typeof m.then=="function"?m.then(u,a):m instanceof Error?a(m):u(m))}function a(c,...d){r||(r=!0,t(c,...d))}function u(c){a(null,c)}}const Ps={basename:OU,dirname:BU,extname:WU,join:UU,sep:"/"};function OU(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');vu(e);let r=0,i=-1,a=e.length,u;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(u){r=a+1;break}}else i<0&&(u=!0,i=a+1);return i<0?"":e.slice(r,i)}if(t===e)return"";let c=-1,d=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(u){r=a+1;break}}else c<0&&(u=!0,c=a+1),d>-1&&(e.codePointAt(a)===t.codePointAt(d--)?d<0&&(i=a):(d=-1,i=c));return r===i?i=c:i<0&&(i=e.length),e.slice(r,i)}function BU(e){if(vu(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 WU(e){vu(e);let t=e.length,r=-1,i=0,a=-1,u=0,c;for(;t--;){const d=e.codePointAt(t);if(d===47){if(c){i=t+1;break}continue}r<0&&(c=!0,r=t+1),d===46?a<0?a=t:u!==1&&(u=1):a>-1&&(u=-1)}return a<0||r<0||u===0||u===1&&a===r-1&&a===i+1?"":e.slice(a,r)}function UU(...e){let t=-1,r;for(;++t<e.length;)vu(e[t]),e[t]&&(r=r===void 0?e[t]:r+"/"+e[t]);return r===void 0?".":HU(r)}function HU(e){vu(e);const t=e.codePointAt(0)===47;let r=zU(e,!t);return r.length===0&&!t&&(r="."),r.length>0&&e.codePointAt(e.length-1)===47&&(r+="/"),t?"/"+r:r}function zU(e,t){let r="",i=0,a=-1,u=0,c=-1,d,m;for(;++c<=e.length;){if(c<e.length)d=e.codePointAt(c);else{if(d===47)break;d=47}if(d===47){if(!(a===c-1||u===1))if(a!==c-1&&u===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=c,u=0;continue}}else if(r.length>0){r="",i=0,a=c,u=0;continue}}t&&(r=r.length>0?r+"/..":"..",i=2)}else r.length>0?r+="/"+e.slice(a+1,c):r=e.slice(a+1,c),i=c-a-1;a=c,u=0}else d===46&&u>-1?u++:u=-1}return r}function vu(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const qU={cwd:$U};function $U(){return"/"}function Fg(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function VU(e){if(typeof e=="string")e=new URL(e);else if(!Fg(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 GU(e)}function GU(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 hf=["history","path","basename","stem","extname","dirname"];class VP{constructor(t){let r;t?Fg(t)?r={path:t}:typeof t=="string"||KU(t)?r={value:t}:r=t:r={},this.cwd="cwd"in r?"":qU.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<hf.length;){const u=hf[i];u in r&&r[u]!==void 0&&r[u]!==null&&(this[u]=u==="history"?[...r[u]]:r[u])}let a;for(a in r)hf.includes(a)||(this[a]=r[a])}get basename(){return typeof this.path=="string"?Ps.basename(this.path):void 0}set basename(t){pf(t,"basename"),mf(t,"basename"),this.path=Ps.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Ps.dirname(this.path):void 0}set dirname(t){oS(this.basename,"dirname"),this.path=Ps.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Ps.extname(this.path):void 0}set extname(t){if(mf(t,"extname"),oS(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=Ps.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Fg(t)&&(t=VU(t)),pf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Ps.basename(this.path,this.extname):void 0}set stem(t){pf(t,"stem"),mf(t,"stem"),this.path=Ps.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 ni(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(Ps.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Ps.sep+"`")}function pf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function oS(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function KU(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const YU=(function(e){const i=this.constructor.prototype,a=i[e],u=function(){return a.apply(u,arguments)};return Object.setPrototypeOf(u,i),u}),XU={}.hasOwnProperty;class nv extends YU{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=FU()}copy(){const t=new nv;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?(bf("data",this.frozen),this.namespace[t]=r,this):XU.call(this.namespace,t)&&this.namespace[t]||void 0:t?(bf("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=Pd(t),i=this.parser||this.Parser;return ff("parse",i),i(String(r),r)}process(t,r){const i=this;return this.freeze(),ff("process",this.parser||this.Parser),gf("process",this.compiler||this.Compiler),r?a(void 0,r):new Promise(a);function a(u,c){const d=Pd(t),m=i.parse(d);i.run(m,d,function(v,g,w){if(v||!g||!w)return f(v);const y=g,x=i.stringify(y,w);ZU(x)?w.value=x:w.result=x,f(v,w)});function f(v,g){v||!g?c(v):u?u(g):r(void 0,g)}}}processSync(t){let r=!1,i;return this.freeze(),ff("processSync",this.parser||this.Parser),gf("processSync",this.compiler||this.Compiler),this.process(t,a),cS("processSync","process",r),i;function a(u,c){r=!0,sS(u),i=c}}run(t,r,i){lS(t),this.freeze();const a=this.transformers;return!i&&typeof r=="function"&&(i=r,r=void 0),i?u(void 0,i):new Promise(u);function u(c,d){const m=Pd(r);a.run(t,m,f);function f(v,g,w){const y=g||t;v?d(v):c?c(y):i(void 0,y,w)}}}runSync(t,r){let i=!1,a;return this.run(t,r,u),cS("runSync","run",i),a;function u(c,d){sS(c),a=d,i=!0}}stringify(t,r){this.freeze();const i=Pd(r),a=this.compiler||this.Compiler;return gf("stringify",a),lS(t),a(t,i)}use(t,...r){const i=this.attachers,a=this.namespace;if(bf("use",this.frozen),t!=null)if(typeof t=="function")m(t,r);else if(typeof t=="object")Array.isArray(t)?d(t):c(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function u(f){if(typeof f=="function")m(f,[]);else if(typeof f=="object")if(Array.isArray(f)){const[v,...g]=f;m(v,g)}else c(f);else throw new TypeError("Expected usable value, not `"+f+"`")}function c(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 v=-1;if(f!=null)if(Array.isArray(f))for(;++v<f.length;){const g=f[v];u(g)}else throw new TypeError("Expected a list of plugins, not `"+f+"`")}function m(f,v){let g=-1,w=-1;for(;++g<i.length;)if(i[g][0]===f){w=g;break}if(w===-1)i.push([f,...v]);else if(v.length>0){let[y,...x]=v;const C=i[w][1];Lg(C)&&Lg(y)&&(y=df(!0,C,y)),i[w]=[f,y,...x]}}}}const QU=new nv().freeze();function ff(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function gf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function bf(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 lS(e){if(!Lg(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function cS(e,t,r){if(!r)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Pd(e){return JU(e)?e:new VP(e)}function JU(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function ZU(e){return typeof e=="string"||eH(e)}function eH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const tH="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",uS=[],dS={allowDangerousHtml:!0},nH=/^(https?|ircs?|mailto|xmpp)$/i,rH=[{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 rv(e){const t=iH(e),r=sH(e);return aH(t.runSync(t.parse(r),r),e)}function iH(e){const t=e.rehypePlugins||uS,r=e.remarkPlugins||uS,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...dS}:dS;return QU().use(BW).use(r).use(EU,i).use(t)}function sH(e){const t=e.children||"",r=new VP;return typeof t=="string"&&(r.value=t),r}function aH(e,t){const r=t.allowedElements,i=t.allowElement,a=t.components,u=t.disallowedElements,c=t.skipHtml,d=t.unwrapDisallowed,m=t.urlTransform||oH;for(const v of rH)Object.hasOwn(t,v.from)&&(""+v.from+(v.to?"use `"+v.to+"` instead":"remove it")+tH+v.id,void 0);return tv(e,f),x2(e,{Fragment:n.Fragment,components:a,ignoreInvalidStyle:!0,jsx:n.jsx,jsxs:n.jsxs,passKeys:!0,passNode:!0});function f(v,g,w){if(v.type==="raw"&&w&&typeof g=="number")return c?w.children.splice(g,1):w.children[g]={type:"text",value:v.value},g;if(v.type==="element"){let y;for(y in of)if(Object.hasOwn(of,y)&&Object.hasOwn(v.properties,y)){const x=v.properties[y],C=of[y];(C===null||C.includes(v.tagName))&&(v.properties[y]=m(String(x||""),y,v))}}if(v.type==="element"){let y=r?!r.includes(v.tagName):u?u.includes(v.tagName):!1;if(!y&&i&&typeof g=="number"&&(y=!i(v,g,w)),y&&w&&typeof g=="number")return d&&v.children?w.children.splice(g,1,...v.children):w.children.splice(g,1),g}}}function oH(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||nH.test(e.slice(0,t))?e:""}function hS(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 lH(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function cH(e,t,r){const a=om((r||{}).ignore||[]),u=uH(t);let c=-1;for(;++c<u.length;)$P(e,"text",d);function d(f,v){let g=-1,w;for(;++g<v.length;){const y=v[g],x=w?w.children:void 0;if(a(y,x?x.indexOf(y):void 0,w))return;w=y}if(w)return m(f,v)}function m(f,v){const g=v[v.length-1],w=u[c][0],y=u[c][1];let x=0;const j=g.children.indexOf(f);let T=!1,P=[];w.lastIndex=0;let I=w.exec(f.value);for(;I;){const Z=I.index,q={index:I.index,input:I.input,stack:[...v,f]};let B=y(...I,q);if(typeof B=="string"&&(B=B.length>0?{type:"text",value:B}:void 0),B===!1?w.lastIndex=Z+1:(x!==Z&&P.push({type:"text",value:f.value.slice(x,Z)}),Array.isArray(B)?P.push(...B):B&&P.push(B),x=Z+I[0].length,T=!0),!w.global)break;I=w.exec(f.value)}return T?(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 uH(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([dH(a[0]),hH(a[1])])}return t}function dH(e){return typeof e=="string"?new RegExp(lH(e),"g"):e}function hH(e){return typeof e=="function"?e:function(){return e}}const vf="phrasing",wf=["autolink","link","image","label"];function mH(){return{transforms:[yH],enter:{literalAutolink:fH,literalAutolinkEmail:yf,literalAutolinkHttp:yf,literalAutolinkWww:yf},exit:{literalAutolink:wH,literalAutolinkEmail:vH,literalAutolinkHttp:gH,literalAutolinkWww:bH}}}function pH(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:vf,notInConstruct:wf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:vf,notInConstruct:wf},{character:":",before:"[ps]",after:"\\/",inConstruct:vf,notInConstruct:wf}]}}function fH(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function yf(e){this.config.enter.autolinkProtocol.call(this,e)}function gH(e){this.config.exit.autolinkProtocol.call(this,e)}function bH(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 vH(e){this.config.exit.autolinkEmail.call(this,e)}function wH(e){this.exit(e)}function yH(e){cH(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,kH],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),xH]],{ignore:["link","linkReference"]})}function kH(e,t,r,i,a){let u="";if(!GP(a)||(/^w/i.test(t)&&(r=t+r,t="",u="http://"),!SH(r)))return!1;const c=CH(r+i);if(!c[0])return!1;const d={type:"link",title:null,url:u+t+c[0],children:[{type:"text",value:t+c[0]}]};return c[1]?[d,{type:"text",value:c[1]}]:d}function xH(e,t,r,i){return!GP(i,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function SH(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 CH(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=hS(e,"(");let u=hS(e,")");for(;i!==-1&&a>u;)e+=r.slice(0,i+1),r=r.slice(i+1),i=r.indexOf(")"),u++;return[e,r]}function GP(e,t){const r=e.input.charCodeAt(e.index-1);return(e.index===0||So(r)||im(r))&&(!t||r!==47)}KP.peek=EH;function jH(){this.buffer()}function NH(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function TH(){this.buffer()}function PH(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function DH(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=gs(this.sliceSerialize(e)).toLowerCase(),r.label=t}function RH(e){this.exit(e)}function MH(e){const t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=gs(this.sliceSerialize(e)).toLowerCase(),r.label=t}function AH(e){this.exit(e)}function EH(){return"["}function KP(e,t,r,i){const a=r.createTracker(i);let u=a.move("[^");const c=r.enter("footnoteReference"),d=r.enter("reference");return u+=a.move(r.safe(r.associationId(e),{after:"]",before:u})),d(),c(),u+=a.move("]"),u}function IH(){return{enter:{gfmFootnoteCallString:jH,gfmFootnoteCall:NH,gfmFootnoteDefinitionLabelString:TH,gfmFootnoteDefinition:PH},exit:{gfmFootnoteCallString:DH,gfmFootnoteCall:RH,gfmFootnoteDefinitionLabelString:MH,gfmFootnoteDefinition:AH}}}function LH(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:KP},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(i,a,u,c){const d=u.createTracker(c);let m=d.move("[^");const f=u.enter("footnoteDefinition"),v=u.enter("label");return m+=d.move(u.safe(u.associationId(i),{before:m,after:"]"})),v(),m+=d.move("]:"),i.children&&i.children.length>0&&(d.shift(4),m+=d.move((t?`
|
|
83
|
+
`:" ")+u.indentLines(u.containerFlow(i,d.current()),t?YP:FH))),f(),m}}function FH(e,t,r){return t===0?e:YP(e,t,r)}function YP(e,t,r){return(r?"":" ")+e}const _H=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];XP.peek=HH;function OH(){return{canContainEols:["delete"],enter:{strikethrough:WH},exit:{strikethrough:UH}}}function BH(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:_H}],handlers:{delete:XP}}}function WH(e){this.enter({type:"delete",children:[]},e)}function UH(e){this.exit(e)}function XP(e,t,r,i){const a=r.createTracker(i),u=r.enter("strikethrough");let c=a.move("~~");return c+=r.containerPhrasing(e,{...a.current(),before:c,after:"~"}),c+=a.move("~~"),u(),c}function HH(){return"~"}function zH(e){return e.length}function qH(e,t){const r=t||{},i=(r.align||[]).concat(),a=r.stringLength||zH,u=[],c=[],d=[],m=[];let f=0,v=-1;for(;++v<e.length;){const C=[],j=[];let T=-1;for(e[v].length>f&&(f=e[v].length);++T<e[v].length;){const P=$H(e[v][T]);if(r.alignDelimiters!==!1){const I=a(P);j[T]=I,(m[T]===void 0||I>m[T])&&(m[T]=I)}C.push(P)}c[v]=C,d[v]=j}let g=-1;if(typeof i=="object"&&"length"in i)for(;++g<f;)u[g]=mS(i[g]);else{const C=mS(i);for(;++g<f;)u[g]=C}g=-1;const w=[],y=[];for(;++g<f;){const C=u[g];let j="",T="";C===99?(j=":",T=":"):C===108?j=":":C===114&&(T=":");let P=r.alignDelimiters===!1?1:Math.max(1,m[g]-j.length-T.length);const I=j+"-".repeat(P)+T;r.alignDelimiters!==!1&&(P=j.length+P+T.length,P>m[g]&&(m[g]=P),y[g]=P),w[g]=I}c.splice(1,0,w),d.splice(1,0,y),v=-1;const x=[];for(;++v<c.length;){const C=c[v],j=d[v];g=-1;const T=[];for(;++g<f;){const P=C[g]||"";let I="",Z="";if(r.alignDelimiters!==!1){const q=m[g]-(j[g]||0),B=u[g];B===114?I=" ".repeat(q):B===99?q%2?(I=" ".repeat(q/2+.5),Z=" ".repeat(q/2-.5)):(I=" ".repeat(q/2),Z=I):Z=" ".repeat(q)}r.delimiterStart!==!1&&!g&&T.push("|"),r.padding!==!1&&!(r.alignDelimiters===!1&&P==="")&&(r.delimiterStart!==!1||g)&&T.push(" "),r.alignDelimiters!==!1&&T.push(I),T.push(P),r.alignDelimiters!==!1&&T.push(Z),r.padding!==!1&&T.push(" "),(r.delimiterEnd!==!1||g!==f-1)&&T.push("|")}x.push(r.delimiterEnd===!1?T.join("").replace(/ +$/,""):T.join(""))}return x.join(`
|
|
84
|
+
`)}function $H(e){return e==null?"":String(e)}function mS(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 VH(e,t,r,i){const a=r.enter("blockquote"),u=r.createTracker(i);u.move("> "),u.shift(2);const c=r.indentLines(r.containerFlow(e,u.current()),GH);return a(),c}function GH(e,t,r){return">"+(r?"":" ")+e}function KH(e,t){return pS(e,t.inConstruct,!0)&&!pS(e,t.notInConstruct,!1)}function pS(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 fS(e,t,r,i){let a=-1;for(;++a<r.unsafe.length;)if(r.unsafe[a].character===`
|
|
85
|
+
`&&KH(r.stack,r.unsafe[a]))return/[ \t]/.test(i.before)?"":" ";return`\\
|
|
86
|
+
`}function YH(e,t){const r=String(e);let i=r.indexOf(t),a=i,u=0,c=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===a?++u>c&&(c=u):u=1,a=i+t.length,i=r.indexOf(t,a);return c}function XH(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 QH(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 JH(e,t,r,i){const a=QH(r),u=e.value||"",c=a==="`"?"GraveAccent":"Tilde";if(XH(e,r)){const g=r.enter("codeIndented"),w=r.indentLines(u,ZH);return g(),w}const d=r.createTracker(i),m=a.repeat(Math.max(YH(u,a)+1,3)),f=r.enter("codeFenced");let v=d.move(m);if(e.lang){const g=r.enter(`codeFencedLang${c}`);v+=d.move(r.safe(e.lang,{before:v,after:" ",encode:["`"],...d.current()})),g()}if(e.lang&&e.meta){const g=r.enter(`codeFencedMeta${c}`);v+=d.move(" "),v+=d.move(r.safe(e.meta,{before:v,after:`
|
|
87
|
+
`,encode:["`"],...d.current()})),g()}return v+=d.move(`
|
|
88
|
+
`),u&&(v+=d.move(u+`
|
|
89
|
+
`)),v+=d.move(m),f(),v}function ZH(e,t,r){return(r?"":" ")+e}function iv(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 e4(e,t,r,i){const a=iv(r),u=a==='"'?"Quote":"Apostrophe",c=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${u}`),f+=m.move(" "+a),f+=m.move(r.safe(e.title,{before:f,after:a,...m.current()})),f+=m.move(a),d()),c(),f}function t4(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 Kc(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Rh(e,t,r){const i=Nl(e),a=Nl(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}}QP.peek=n4;function QP(e,t,r,i){const a=t4(r),u=r.enter("emphasis"),c=r.createTracker(i),d=c.move(a);let m=c.move(r.containerPhrasing(e,{after:a,before:d,...c.current()}));const f=m.charCodeAt(0),v=Rh(i.before.charCodeAt(i.before.length-1),f,a);v.inside&&(m=Kc(f)+m.slice(1));const g=m.charCodeAt(m.length-1),w=Rh(i.after.charCodeAt(0),g,a);w.inside&&(m=m.slice(0,-1)+Kc(g));const y=c.move(a);return u(),r.attentionEncodeSurroundingInfo={after:w.outside,before:v.outside},d+m+y}function n4(e,t,r){return r.options.emphasis||"*"}function r4(e,t){let r=!1;return tv(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return r=!0,Eg}),!!((!e.depth||e.depth<3)&&Kb(e)&&(t.options.setext||r))}function i4(e,t,r,i){const a=Math.max(Math.min(6,e.depth||1),1),u=r.createTracker(i);if(r4(e,r)){const v=r.enter("headingSetext"),g=r.enter("phrasing"),w=r.containerPhrasing(e,{...u.current(),before:`
|
|
91
|
+
`,after:`
|
|
92
|
+
`});return g(),v(),w+`
|
|
93
|
+
`+(a===1?"=":"-").repeat(w.length-(Math.max(w.lastIndexOf("\r"),w.lastIndexOf(`
|
|
94
|
+
`))+1))}const c="#".repeat(a),d=r.enter("headingAtx"),m=r.enter("phrasing");u.move(c+" ");let f=r.containerPhrasing(e,{before:"# ",after:`
|
|
95
|
+
`,...u.current()});return/^[\t ]/.test(f)&&(f=Kc(f.charCodeAt(0))+f.slice(1)),f=f?c+" "+f:c,r.options.closeAtx&&(f+=" "+c),m(),d(),f}JP.peek=s4;function JP(e){return e.value||""}function s4(){return"<"}ZP.peek=a4;function ZP(e,t,r,i){const a=iv(r),u=a==='"'?"Quote":"Apostrophe",c=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${u}`),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(")"),c(),f}function a4(){return"!"}eD.peek=o4;function eD(e,t,r,i){const a=e.referenceType,u=r.enter("imageReference");let c=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+"]["),c();const v=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...d.current()});return c(),r.stack=v,u(),a==="full"||!f||f!==g?m+=d.move(g+"]"):a==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function o4(){return"!"}tD.peek=l4;function tD(e,t,r){let i=e.value||"",a="`",u=-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+" ");++u<r.unsafe.length;){const c=r.unsafe[u],d=r.compilePattern(c);let m;if(c.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 l4(){return"`"}function nD(e,t){const r=Kb(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))}rD.peek=c4;function rD(e,t,r,i){const a=iv(r),u=a==='"'?"Quote":"Apostrophe",c=r.createTracker(i);let d,m;if(nD(e,r)){const v=r.stack;r.stack=[],d=r.enter("autolink");let g=c.move("<");return g+=c.move(r.containerPhrasing(e,{before:g,after:">",...c.current()})),g+=c.move(">"),d(),r.stack=v,g}d=r.enter("link"),m=r.enter("label");let f=c.move("[");return f+=c.move(r.containerPhrasing(e,{before:f,after:"](",...c.current()})),f+=c.move("]("),m(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(m=r.enter("destinationLiteral"),f+=c.move("<"),f+=c.move(r.safe(e.url,{before:f,after:">",...c.current()})),f+=c.move(">")):(m=r.enter("destinationRaw"),f+=c.move(r.safe(e.url,{before:f,after:e.title?" ":")",...c.current()}))),m(),e.title&&(m=r.enter(`title${u}`),f+=c.move(" "+a),f+=c.move(r.safe(e.title,{before:f,after:a,...c.current()})),f+=c.move(a),m()),f+=c.move(")"),d(),f}function c4(e,t,r){return nD(e,r)?"<":"["}iD.peek=u4;function iD(e,t,r,i){const a=e.referenceType,u=r.enter("linkReference");let c=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+"]["),c();const v=r.stack;r.stack=[],c=r.enter("reference");const g=r.safe(r.associationId(e),{before:m,after:"]",...d.current()});return c(),r.stack=v,u(),a==="full"||!f||f!==g?m+=d.move(g+"]"):a==="shortcut"?m=m.slice(0,-1):m+=d.move("]"),m}function u4(){return"["}function sv(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 d4(e){const t=sv(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 h4(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 sD(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 m4(e,t,r,i){const a=r.enter("list"),u=r.bulletCurrent;let c=e.ordered?h4(r):sv(r);const d=e.ordered?c==="."?")":".":d4(r);let m=t&&r.bulletLastUsed?c===r.bulletLastUsed:!1;if(!e.ordered){const v=e.children?e.children[0]:void 0;if((c==="*"||c==="-")&&v&&(!v.children||!v.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),sD(r)===c&&v){let g=-1;for(;++g<e.children.length;){const w=e.children[g];if(w&&w.type==="listItem"&&w.children&&w.children[0]&&w.children[0].type==="thematicBreak"){m=!0;break}}}}m&&(c=d),r.bulletCurrent=c;const f=r.containerFlow(e,i);return r.bulletLastUsed=c,r.bulletCurrent=u,a(),f}function p4(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 f4(e,t,r,i){const a=p4(r);let u=r.bulletCurrent||sv(r);t&&t.type==="list"&&t.ordered&&(u=(typeof t.start=="number"&&t.start>-1?t.start:1)+(r.options.incrementListMarker===!1?0:t.children.indexOf(e))+u);let c=u.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(c=Math.ceil(c/4)*4);const d=r.createTracker(i);d.move(u+" ".repeat(c-u.length)),d.shift(c);const m=r.enter("listItem"),f=r.indentLines(r.containerFlow(e,d.current()),v);return m(),f;function v(g,w,y){return w?(y?"":" ".repeat(c))+g:(y?u:u+" ".repeat(c-u.length))+g}}function g4(e,t,r,i){const a=r.enter("paragraph"),u=r.enter("phrasing"),c=r.containerPhrasing(e,i);return u(),a(),c}const b4=om(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function v4(e,t,r,i){return(e.children.some(function(c){return b4(c)})?r.containerPhrasing:r.containerFlow).call(r,e,i)}function w4(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}aD.peek=y4;function aD(e,t,r,i){const a=w4(r),u=r.enter("strong"),c=r.createTracker(i),d=c.move(a+a);let m=c.move(r.containerPhrasing(e,{after:a,before:d,...c.current()}));const f=m.charCodeAt(0),v=Rh(i.before.charCodeAt(i.before.length-1),f,a);v.inside&&(m=Kc(f)+m.slice(1));const g=m.charCodeAt(m.length-1),w=Rh(i.after.charCodeAt(0),g,a);w.inside&&(m=m.slice(0,-1)+Kc(g));const y=c.move(a+a);return u(),r.attentionEncodeSurroundingInfo={after:w.outside,before:v.outside},d+m+y}function y4(e,t,r){return r.options.strong||"*"}function k4(e,t,r,i){return r.safe(e.value,i)}function x4(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 S4(e,t,r){const i=(sD(r)+(r.options.ruleSpaces?" ":"")).repeat(x4(r));return r.options.ruleSpaces?i.slice(0,-1):i}const oD={blockquote:VH,break:fS,code:JH,definition:e4,emphasis:QP,hardBreak:fS,heading:i4,html:JP,image:ZP,imageReference:eD,inlineCode:tD,link:rD,linkReference:iD,list:m4,listItem:f4,paragraph:g4,root:v4,strong:aD,text:k4,thematicBreak:S4};function C4(){return{enter:{table:j4,tableData:gS,tableHeader:gS,tableRow:T4},exit:{codeText:P4,table:N4,tableData:kf,tableHeader:kf,tableRow:kf}}}function j4(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 N4(e){this.exit(e),this.data.inTable=void 0}function T4(e){this.enter({type:"tableRow",children:[]},e)}function kf(e){this.exit(e)}function gS(e){this.enter({type:"tableCell",children:[]},e)}function P4(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,D4));const r=this.stack[this.stack.length-1];r.type,r.value=t,this.exit(e)}function D4(e,t){return t==="|"?t:e}function R4(e){const t=e||{},r=t.tableCellPadding,i=t.tablePipeAlign,a=t.stringLength,u=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:w,table:c,tableCell:m,tableRow:d}};function c(y,x,C,j){return f(v(y,C,j),y.align)}function d(y,x,C,j){const T=g(y,C,j),P=f([T]);return P.slice(0,P.indexOf(`
|
|
97
|
+
`))}function m(y,x,C,j){const T=C.enter("tableCell"),P=C.enter("phrasing"),I=C.containerPhrasing(y,{...j,before:u,after:u});return P(),T(),I}function f(y,x){return qH(y,{align:x,alignDelimiters:i,padding:r,stringLength:a})}function v(y,x,C){const j=y.children;let T=-1;const P=[],I=x.enter("table");for(;++T<j.length;)P[T]=g(j[T],x,C);return I(),P}function g(y,x,C){const j=y.children;let T=-1;const P=[],I=x.enter("tableRow");for(;++T<j.length;)P[T]=m(j[T],y,x,C);return I(),P}function w(y,x,C){let j=oD.inlineCode(y,x,C);return C.stack.includes("tableCell")&&(j=j.replace(/\|/g,"\\$&")),j}}function M4(){return{exit:{taskListCheckValueChecked:bS,taskListCheckValueUnchecked:bS,paragraph:E4}}}function A4(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:I4}}}function bS(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function E4(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 u=-1,c;for(;++u<a.length;){const d=a[u];if(d.type==="paragraph"){c=d;break}}c===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 I4(e,t,r,i){const a=e.children[0],u=typeof e.checked=="boolean"&&a&&a.type==="paragraph",c="["+(e.checked?"x":" ")+"] ",d=r.createTracker(i);u&&d.move(c);let m=oD.listItem(e,t,r,{...i,...d.current()});return u&&(m=m.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,f)),m;function f(v){return v+c}}function L4(){return[mH(),IH(),OH(),C4(),M4()]}function F4(e){return{extensions:[pH(),LH(e),BH(),R4(e),A4()]}}const _4={tokenize:z4,partial:!0},lD={tokenize:q4,partial:!0},cD={tokenize:$4,partial:!0},uD={tokenize:V4,partial:!0},O4={tokenize:G4,partial:!0},dD={name:"wwwAutolink",tokenize:U4,previous:mD},hD={name:"protocolAutolink",tokenize:H4,previous:pD},ia={name:"emailAutolink",tokenize:W4,previous:fD},Ls={};function B4(){return{text:Ls}}let co=48;for(;co<123;)Ls[co]=ia,co++,co===58?co=65:co===91&&(co=97);Ls[43]=ia;Ls[45]=ia;Ls[46]=ia;Ls[95]=ia;Ls[72]=[ia,hD];Ls[104]=[ia,hD];Ls[87]=[ia,dD];Ls[119]=[ia,dD];function W4(e,t,r){const i=this;let a,u;return c;function c(g){return!_g(g)||!fD.call(i,i.previous)||av(i.events)?r(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),d(g))}function d(g){return _g(g)?(e.consume(g),d):g===64?(e.consume(g),m):r(g)}function m(g){return g===46?e.check(O4,v,f)(g):g===45||g===95||ti(g)?(u=!0,e.consume(g),m):v(g)}function f(g){return e.consume(g),a=!0,m}function v(g){return u&&a&&ai(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):r(g)}}function U4(e,t,r){const i=this;return a;function a(c){return c!==87&&c!==119||!mD.call(i,i.previous)||av(i.events)?r(c):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(_4,e.attempt(lD,e.attempt(cD,u),r),r)(c))}function u(c){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(c)}}function H4(e,t,r){const i=this;let a="",u=!1;return c;function c(g){return(g===72||g===104)&&pD.call(i,i.previous)&&!av(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(g),e.consume(g),d):r(g)}function d(g){if(ai(g)&&a.length<5)return a+=String.fromCodePoint(g),e.consume(g),d;if(g===58){const w=a.toLowerCase();if(w==="http"||w==="https")return e.consume(g),m}return r(g)}function m(g){return g===47?(e.consume(g),u?f:(u=!0,m)):r(g)}function f(g){return g===null||Th(g)||zn(g)||So(g)||im(g)?r(g):e.attempt(lD,e.attempt(cD,v),r)(g)}function v(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function z4(e,t,r){let i=0;return a;function a(c){return(c===87||c===119)&&i<3?(i++,e.consume(c),a):c===46&&i===3?(e.consume(c),u):r(c)}function u(c){return c===null?r(c):t(c)}}function q4(e,t,r){let i,a,u;return c;function c(f){return f===46||f===95?e.check(uD,m,d)(f):f===null||zn(f)||So(f)||f!==45&&im(f)?m(f):(u=!0,e.consume(f),c)}function d(f){return f===95?i=!0:(a=i,i=void 0),e.consume(f),c}function m(f){return a||i||!u?r(f):t(f)}}function $4(e,t){let r=0,i=0;return a;function a(c){return c===40?(r++,e.consume(c),a):c===41&&i<r?u(c):c===33||c===34||c===38||c===39||c===41||c===42||c===44||c===46||c===58||c===59||c===60||c===63||c===93||c===95||c===126?e.check(uD,t,u)(c):c===null||zn(c)||So(c)?t(c):(e.consume(c),a)}function u(c){return c===41&&i++,e.consume(c),a}}function V4(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),u):d===93?(e.consume(d),a):d===60||d===null||zn(d)||So(d)?t(d):r(d)}function a(d){return d===null||d===40||d===91||zn(d)||So(d)?t(d):i(d)}function u(d){return ai(d)?c(d):r(d)}function c(d){return d===59?(e.consume(d),i):ai(d)?(e.consume(d),c):r(d)}}function G4(e,t,r){return i;function i(u){return e.consume(u),a}function a(u){return ti(u)?r(u):t(u)}}function mD(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||zn(e)}function pD(e){return!ai(e)}function fD(e){return!(e===47||_g(e))}function _g(e){return e===43||e===45||e===46||e===95||ti(e)}function av(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 K4={tokenize:nz,partial:!0};function Y4(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:Z4,continuation:{tokenize:ez},exit:tz}},text:{91:{name:"gfmFootnoteCall",tokenize:J4},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:X4,resolveTo:Q4}}}}function X4(e,t,r){const i=this;let a=i.events.length;const u=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c;for(;a--;){const m=i.events[a][1];if(m.type==="labelImage"){c=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(!c||!c._balanced)return r(m);const f=gs(i.sliceSerialize({start:c.end,end:i.now()}));return f.codePointAt(0)!==94||!u.includes(f.slice(1))?r(m):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),t(m))}}function Q4(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 u={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},c={type:"chunkString",contentType:"string",start:Object.assign({},u.start),end:Object.assign({},u.end)},d=[e[r+1],e[r+2],["enter",i,t],e[r+3],e[r+4],["enter",a,t],["exit",a,t],["enter",u,t],["enter",c,t],["exit",c,t],["exit",u,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(r,e.length-r+1,...d),e}function J4(e,t,r){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u=0,c;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(u>999||g===93&&!c||g===null||g===91||zn(g))return r(g);if(g===93){e.exit("chunkString");const w=e.exit("gfmFootnoteCallString");return a.includes(gs(i.sliceSerialize(w)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):r(g)}return zn(g)||(c=!0),u++,e.consume(g),g===92?v:f}function v(g){return g===91||g===92||g===93?(e.consume(g),u++,f):f(g)}}function Z4(e,t,r){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let u,c=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",v):r(x)}function v(x){if(c>999||x===93&&!d||x===null||x===91||zn(x))return r(x);if(x===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return u=gs(i.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),w}return zn(x)||(d=!0),c++,e.consume(x),x===92?g:v}function g(x){return x===91||x===92||x===93?(e.consume(x),c++,v):v(x)}function w(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),a.includes(u)||a.push(u),Cn(e,y,"gfmFootnoteDefinitionWhitespace")):r(x)}function y(x){return t(x)}}function ez(e,t,r){return e.check(bu,t,e.attempt(K4,t,r))}function tz(e){e.exit("gfmFootnoteDefinition")}function nz(e,t,r){const i=this;return Cn(e,a,"gfmFootnoteDefinitionIndent",5);function a(u){const c=i.events[i.events.length-1];return c&&c[1].type==="gfmFootnoteDefinitionIndent"&&c[2].sliceSerialize(c[1],!0).length===4?t(u):r(u)}}function rz(e){let r=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:u,resolveAll:a};return r==null&&(r=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function a(c,d){let m=-1;for(;++m<c.length;)if(c[m][0]==="enter"&&c[m][1].type==="strikethroughSequenceTemporary"&&c[m][1]._close){let f=m;for(;f--;)if(c[f][0]==="exit"&&c[f][1].type==="strikethroughSequenceTemporary"&&c[f][1]._open&&c[m][1].end.offset-c[m][1].start.offset===c[f][1].end.offset-c[f][1].start.offset){c[m][1].type="strikethroughSequence",c[f][1].type="strikethroughSequence";const v={type:"strikethrough",start:Object.assign({},c[f][1].start),end:Object.assign({},c[m][1].end)},g={type:"strikethroughText",start:Object.assign({},c[f][1].end),end:Object.assign({},c[m][1].start)},w=[["enter",v,d],["enter",c[f][1],d],["exit",c[f][1],d],["enter",g,d]],y=d.parser.constructs.insideSpan.null;y&&Ei(w,w.length,0,sm(y,c.slice(f+1,m),d)),Ei(w,w.length,0,[["exit",g,d],["enter",c[m][1],d],["exit",c[m][1],d],["exit",v,d]]),Ei(c,f-1,m-f+3,w),m=f+w.length-2;break}}for(m=-1;++m<c.length;)c[m][1].type==="strikethroughSequenceTemporary"&&(c[m][1].type="data");return c}function u(c,d,m){const f=this.previous,v=this.events;let g=0;return w;function w(x){return f===126&&v[v.length-1][1].type!=="characterEscape"?m(x):(c.enter("strikethroughSequenceTemporary"),y(x))}function y(x){const C=Nl(f);if(x===126)return g>1?m(x):(c.consume(x),g++,y);if(g<2&&!r)return m(x);const j=c.exit("strikethroughSequenceTemporary"),T=Nl(x);return j._open=!T||T===2&&!!C,j._close=!C||C===2&&!!T,d(x)}}}class iz{constructor(){this.map=[]}add(t,r,i){sz(this,t,r,i)}consume(t){if(this.map.sort(function(u,c){return u[0]-c[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 u of a)t.push(u);a=i.pop()}this.map.length=0}}function sz(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 az(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 u=i.length-1;i[u]=i[u]==="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 oz(){return{flow:{null:{name:"table",tokenize:lz,resolveAll:cz}}}}function lz(e,t,r){const i=this;let a=0,u=0,c;return d;function d(_){let Y=i.events.length-1;for(;Y>-1;){const O=i.events[Y][1].type;if(O==="lineEnding"||O==="linePrefix")Y--;else break}const z=Y>-1?i.events[Y][1].type:null,K=z==="tableHead"||z==="tableRow"?B:m;return K===B&&i.parser.lazy[i.now().line]?r(_):K(_)}function m(_){return e.enter("tableHead"),e.enter("tableRow"),f(_)}function f(_){return _===124||(c=!0,u+=1),v(_)}function v(_){return _===null?r(_):Yt(_)?u>1?(u=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),y):r(_):vn(_)?Cn(e,v,"whitespace")(_):(u+=1,c&&(c=!1,a+=1),_===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),c=!0,v):(e.enter("data"),g(_)))}function g(_){return _===null||_===124||zn(_)?(e.exit("data"),v(_)):(e.consume(_),_===92?w:g)}function w(_){return _===92||_===124?(e.consume(_),g):g(_)}function y(_){return i.interrupt=!1,i.parser.lazy[i.now().line]?r(_):(e.enter("tableDelimiterRow"),c=!1,vn(_)?Cn(e,x,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):x(_))}function x(_){return _===45||_===58?j(_):_===124?(c=!0,e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),C):q(_)}function C(_){return vn(_)?Cn(e,j,"whitespace")(_):j(_)}function j(_){return _===58?(u+=1,c=!0,e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),T):_===45?(u+=1,T(_)):_===null||Yt(_)?Z(_):q(_)}function T(_){return _===45?(e.enter("tableDelimiterFiller"),P(_)):q(_)}function P(_){return _===45?(e.consume(_),P):_===58?(c=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(_),e.exit("tableDelimiterMarker"),I):(e.exit("tableDelimiterFiller"),I(_))}function I(_){return vn(_)?Cn(e,Z,"whitespace")(_):Z(_)}function Z(_){return _===124?x(_):_===null||Yt(_)?!c||a!==u?q(_):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(_)):q(_)}function q(_){return r(_)}function B(_){return e.enter("tableRow"),E(_)}function E(_){return _===124?(e.enter("tableCellDivider"),e.consume(_),e.exit("tableCellDivider"),E):_===null||Yt(_)?(e.exit("tableRow"),t(_)):vn(_)?Cn(e,E,"whitespace")(_):(e.enter("data"),A(_))}function A(_){return _===null||_===124||zn(_)?(e.exit("data"),E(_)):(e.consume(_),_===92?H:A)}function H(_){return _===92||_===124?(e.consume(_),A):A(_)}}function cz(e,t){let r=-1,i=!0,a=0,u=[0,0,0,0],c=[0,0,0,0],d=!1,m=0,f,v,g;const w=new iz;for(;++r<e.length;){const y=e[r],x=y[1];y[0]==="enter"?x.type==="tableHead"?(d=!1,m!==0&&(vS(w,t,m,f,v),v=void 0,m=0),f={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},w.add(r,0,[["enter",f,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(i=!0,g=void 0,u=[0,0,0,0],c=[0,r+1,0,0],d&&(d=!1,v={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},w.add(r,0,[["enter",v,t]])),a=x.type==="tableDelimiterRow"?2:v?3:1):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(i=!1,c[2]===0&&(u[1]!==0&&(c[0]=c[1],g=Dd(w,t,u,a,void 0,g),u=[0,0,0,0]),c[2]=r)):x.type==="tableCellDivider"&&(i?i=!1:(u[1]!==0&&(c[0]=c[1],g=Dd(w,t,u,a,void 0,g)),u=c,c=[u[1],r,0,0])):x.type==="tableHead"?(d=!0,m=r):x.type==="tableRow"||x.type==="tableDelimiterRow"?(m=r,u[1]!==0?(c[0]=c[1],g=Dd(w,t,u,a,r,g)):c[1]!==0&&(g=Dd(w,t,c,a,r,g)),a=0):a&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(c[3]=r)}for(m!==0&&vS(w,t,m,f,v),w.consume(t.events),r=-1;++r<t.events.length;){const y=t.events[r];y[0]==="enter"&&y[1].type==="table"&&(y[1]._align=az(t.events,r))}return e}function Dd(e,t,r,i,a,u){const c=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",d="tableContent";r[0]!==0&&(u.end=Object.assign({},ml(t.events,r[0])),e.add(r[0],0,[["exit",u,t]]));const m=ml(t.events,r[1]);if(u={type:c,start:Object.assign({},m),end:Object.assign({},m)},e.add(r[1],0,[["enter",u,t]]),r[2]!==0){const f=ml(t.events,r[2]),v=ml(t.events,r[3]),g={type:d,start:Object.assign({},f),end:Object.assign({},v)};if(e.add(r[2],0,[["enter",g,t]]),i!==2){const w=t.events[r[2]],y=t.events[r[3]];if(w[1].end=Object.assign({},y[1].end),w[1].type="chunkText",w[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&&(u.end=Object.assign({},ml(t.events,a)),e.add(a,0,[["exit",u,t]]),u=void 0),u}function vS(e,t,r,i,a){const u=[],c=ml(t.events,r);a&&(a.end=Object.assign({},c),u.push(["exit",a,t])),i.end=Object.assign({},c),u.push(["exit",i,t]),e.add(r+1,0,u)}function ml(e,t){const r=e[t],i=r[0]==="enter"?"start":"end";return r[1][i]}const uz={name:"tasklistCheck",tokenize:hz};function dz(){return{text:{91:uz}}}function hz(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"),u)}function u(m){return zn(m)?(e.enter("taskListCheckValueUnchecked"),e.consume(m),e.exit("taskListCheckValueUnchecked"),c):m===88||m===120?(e.enter("taskListCheckValueChecked"),e.consume(m),e.exit("taskListCheckValueChecked"),c):r(m)}function c(m){return m===93?(e.enter("taskListCheckMarker"),e.consume(m),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),d):r(m)}function d(m){return Yt(m)?t(m):vn(m)?e.check({tokenize:mz},t,r)(m):r(m)}}function mz(e,t,r){return Cn(e,i,"whitespace");function i(a){return a===null?r(a):t(a)}}function pz(e){return NP([B4(),Y4(),rz(e),oz(),dz()])}const fz={};function ov(e){const t=this,r=e||fz,i=t.data(),a=i.micromarkExtensions||(i.micromarkExtensions=[]),u=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),c=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);a.push(pz(r)),u.push(L4()),c.push(F4(r))}const wS="*** Begin Patch",yS="*** End Patch";function gz(e){const t=e.replace(/\r\n/g,`
|
|
98
|
+
`);if(!t.includes(wS)||!t.includes(yS))return null;const r=t.split(`
|
|
99
|
+
`),i=[];let a=null,u=null;for(const c of r){if(c===wS||c===yS)continue;if(c.startsWith("*** Update File: ")){a=xf("update",c.slice(17)),i.push(a),u=null;continue}if(c.startsWith("*** Add File: ")){a=xf("add",c.slice(14)),i.push(a),u={oldLineNumber:0,newLineNumber:1};continue}if(c.startsWith("*** Delete File: ")){a=xf("delete",c.slice(17)),i.push(a),u=null;continue}if(!a)continue;if(c.startsWith("*** Move to: ")){a.nextPath=c.slice(13),a.lines.push({kind:"meta",text:c,oldLineNumber:null,newLineNumber:null});continue}if(c.startsWith("@@")){u=vz(c)??{oldLineNumber:0,newLineNumber:0},a.lines.push({kind:"hunk",text:c,oldLineNumber:null,newLineNumber:null});continue}if(c==="*** End of File"){a.lines.push({kind:"meta",text:c,oldLineNumber:null,newLineNumber:null});continue}if(a.action==="add"&&c.startsWith("+")){a.additions+=1,a.lines.push({kind:"add",text:c,oldLineNumber:null,newLineNumber:(u==null?void 0:u.newLineNumber)??a.additions}),u&&(u.newLineNumber+=1);continue}if(!u){a.lines.push({kind:"meta",text:c,oldLineNumber:null,newLineNumber:null});continue}if(c.startsWith("+")){a.additions+=1,a.lines.push({kind:"add",text:c,oldLineNumber:null,newLineNumber:u.newLineNumber}),u.newLineNumber+=1;continue}if(c.startsWith("-")){a.deletions+=1,a.lines.push({kind:"remove",text:c,oldLineNumber:u.oldLineNumber,newLineNumber:null}),u.oldLineNumber+=1;continue}if(c.startsWith(" ")||c.length===0){a.lines.push({kind:"context",text:c,oldLineNumber:u.oldLineNumber,newLineNumber:u.newLineNumber}),u.oldLineNumber+=1,u.newLineNumber+=1;continue}a.lines.push({kind:"meta",text:c,oldLineNumber:null,newLineNumber:null})}return i.length===0?null:{files:i,totalAdditions:i.reduce((c,d)=>c+d.additions,0),totalDeletions:i.reduce((c,d)=>c+d.deletions,0)}}function bz(e){return e.replace(/\\/g,"/").split("/").at(-1)||e}function xf(e,t){return{path:t,nextPath:null,action:e,additions:0,deletions:0,lines:[]}}function vz(e){const t=e.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}const wz=/data:image\/([a-zA-Z0-9.+-]+);base64,([A-Za-z0-9+/=]+)/g,yz=/!\[([^\]]*)\]\((data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)\)/g,kz=/<img\b[^>]*src=["'](data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)["'][^>]*>/gi,xz=/<image\b([^>]*)>([\s\S]*?)<\/image>/gi;function Co(e){const t=Sz(e);return t||gD(e)}function Sz(e){const t=e.trim();if(!Cz(t))return null;try{const r=JSON.parse(t),i=jz(r);return i.text||i.inlineImages.length>0?i:null}catch{return null}}function Cz(e){return e.length<2?!1:e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}")}function jz(e){const t=[],r=[];return ah(e,t,r),{text:vD(t.join(`
|
|
100
|
+
|
|
101
|
+
`)),inlineImages:bD(r)}}function ah(e,t,r){if(typeof e=="string"){const c=gD(e);c.text&&t.push(c.text),r.push(...c.inlineImages);return}if(e==null)return;if(Array.isArray(e)){e.forEach(c=>ah(c,t,r));return}if(typeof e!="object")return;const i=e,a=new Set,u=Nz(i);u&&(r.push(u),["type","source","media_type","mime_type","mimeType","data","image_url","imageUrl","url","src","alt","name"].forEach(c=>{c in i&&a.add(c)}));for(const c of["image_url","url","src","source"]){const d=i[c];typeof d!="string"||!wD(d)||(r.push(go(d,Ki(i.alt))),a.add(c))}for(const c of["text","message","content","output","result","summary","caption"])c in i&&(a.add(c),ah(i[c],t,r));a.size>0||Object.values(i).forEach(c=>{ah(c,t,r)})}function gD(e){const t=[];let r=e;return r=r.replace(xz,(i,a,u)=>{const c=Mz(a,"name"),d=Rz(u);return d!=null&&d.url&&t.push(go(d.url,d.altText||c)),""}),r=r.replace(yz,(i,a,u)=>(t.push(go(u,a)),"")),r=r.replace(kz,(i,a)=>(t.push(go(a,null)),"")),r=r.replace(wz,(i,a,u)=>(t.push(go(i,null,`image/${a}`,Mh(u))),"")),{text:vD(r),inlineImages:bD(t)}}function go(e,t,r,i){const a=r??Tz(e)??"image/png";return{url:e,mimeType:a,altText:Yc(t),estimatedBytes:i??Pz(e)}}function Nz(e){const t=Dz(e.source);if(t){const a=Ki(t.type).trim().toLowerCase(),u=xS(t.media_type??t.mime_type??t.mimeType),c=kS(t.data);if(a==="base64"&&u&&c)return go(`data:${u};base64,${c}`,Yc(Ki(t.alt)||Ki(t.name)||Ki(e.alt)||Ki(e.name)),u,Mh(c))}const r=xS(e.media_type??e.mime_type??e.mimeType),i=kS(e.data);return r&&i?go(`data:${r};base64,${i}`,Yc(Ki(e.alt)||Ki(e.name)),r,Mh(i)):null}function bD(e){const t=new Map;return e.forEach(r=>{t.has(r.url)||t.set(r.url,r)}),[...t.values()]}function vD(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 wD(e){return/^data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/.test(e.trim())}function Tz(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 Pz(e){const t=e.match(/^data:image\/[a-zA-Z0-9.+-]+;base64,([A-Za-z0-9+/=]+)$/i);return t?Mh(t[1]):null}function Mh(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 Yc(e){const t=Ki(e).trim();return t.length>0?t:null}function kS(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g,"").trim();return/^[A-Za-z0-9+/=]+$/.test(t)?t:null}function xS(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.startsWith("image/")?t:null}function Ki(e){return typeof e=="string"?e:""}function Dz(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function Rz(e){const t=e.trim();if(t.length===0)return null;try{const r=JSON.parse(t),i=Ki(r.image_url??r.imageUrl).trim(),a=Yc(Ki(r.name)||Ki(r.alt));return{url:wD(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 Mz(e,t){const r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=e.match(new RegExp(`${r}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|\\[([^\\]]*)\\]|([^\\s>]+))`,"i"));return Yc((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 yD="codingns.user-app.conversation-scroll",cl=1,Az=200,Ez=1e7;function kD(){return typeof window<"u"&&typeof window.localStorage<"u"}function xD(e){return e.trim()}function SD(e){return!Number.isFinite(e)||e<=0?0:Math.min(Math.round(e),Ez)}function CD(e){return!e||typeof e!="object"?null:{scrollTop:SD(e.scrollTop),stickToBottom:e.stickToBottom===!0,lastMessageSignature:typeof e.lastMessageSignature=="string"?e.lastMessageSignature:null,updatedAt:Number.isFinite(e.updatedAt)?e.updatedAt:0}}function jD(){if(!kD())return{schemaVersion:cl,bySessionId:{}};const e=window.localStorage.getItem(yD);if(!e)return{schemaVersion:cl,bySessionId:{}};try{const t=JSON.parse(e);if(!t||typeof t!="object"||t.schemaVersion!==cl||!t.bySessionId||typeof t.bySessionId!="object"||Array.isArray(t.bySessionId))return{schemaVersion:cl,bySessionId:{}};const r=Object.fromEntries(Object.entries(t.bySessionId).map(([i,a])=>{const u=CD(a);return u?[i,u]:null}).filter(i=>!!i));return{schemaVersion:cl,bySessionId:r}}catch{return{schemaVersion:cl,bySessionId:{}}}}function Iz(e){if(kD())try{window.localStorage.setItem(yD,JSON.stringify(e))}catch{}}function Rd(e){const t=xD(e);if(!t)return null;const r=jD().bySessionId[t],i=CD(r);return i?{scrollTop:i.scrollTop,stickToBottom:i.stickToBottom,lastMessageSignature:i.lastMessageSignature}:null}function SS(e,t){const r=xD(e);if(!r)return;const i=jD();i.bySessionId[r]={scrollTop:SD(t.scrollTop),stickToBottom:t.stickToBottom,lastMessageSignature:t.lastMessageSignature,updatedAt:Date.now()};const a=Object.entries(i.bySessionId).sort((u,c)=>c[1].updatedAt-u[1].updatedAt).slice(0,Az);i.bySessionId=Object.fromEntries(a),Iz(i)}function Lz(e){return e.replace(/(\.{3,}|…+)$/,"").trimEnd()}const Fz=480,CS=80,jS=240,_z=120,Oz=50,Bz=3500,ND=p.createContext(!1);function Og(e){return e.replace(/\\/g,"/")}function Ah(e){return/^[a-zA-Z]:\//.test(e)}function Wz(e){return e.startsWith("/")||e.startsWith("//")||Ah(e)}function Uz(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)&&!Ah(e)}function NS(e){return e.replace(/\/+$/,"")}function Hz(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 zz(e){const t=[];for(const r of Og(e).split("/"))if(!(!r||r===".")){if(r===".."){if(t.length===0)return null;t.pop();continue}t.push(r)}return t.join("/")}function lv(e){try{return decodeURIComponent(e)}catch{return e}}function qz(e,t){const r=lv(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(Uz(i))return null;if(i=Og(Hz(i.trim())),!i)return null;const a=NS(Og(t.trim()));if(!a)return null;if(Wz(i)){const u=NS(i),c=Ah(a)?a.toLowerCase():a,d=Ah(u)?u.toLowerCase():u;if(d===c)return null;const m=`${c}/`;return d.startsWith(m)?u.slice(a.length+1):null}return zz(i)}function Bg(e){return e.kind==="tool_call"||e.kind==="tool_result"}function TD(e){return e.toolCall?e.toolCall:Bg(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 $z(e){return e==="shell_command"||e==="tool"?o("conversation.roleTool"):e}function PD(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 uo(e,t){const r=e[t];return typeof r=="string"?r:""}function Vz(e){if(e.name==="apply_patch")return gz(e.input);if(e.name!=="Write"&&e.name!=="Edit"&&e.name!=="MultiEdit")return null;const t=PD(e.input);if(!t)return null;const r=uo(t,"file_path")||uo(t,"path");if(!r)return null;if(e.name==="Write"){const u=uo(t,"content"),c=u.length>0?u.split(/\r?\n/):[];return{files:[{path:r,nextPath:null,action:"add",additions:c.length,deletions:0,lines:c.map((d,m)=>({kind:"add",text:`+${d}`,oldLineNumber:null,newLineNumber:m+1}))}],totalAdditions:c.length,totalDeletions:0}}if(e.name==="Edit"){const u=uo(t,"old_string").split(/\r?\n/),c=uo(t,"new_string").split(/\r?\n/);return TS(r,[{oldLines:u,newLines:c}])}const a=(Array.isArray(t.edits)?t.edits:[]).map(u=>{if(!u||typeof u!="object"||Array.isArray(u))return null;const c=u;return{oldLines:uo(c,"old_string").split(/\r?\n/),newLines:uo(c,"new_string").split(/\r?\n/)}}).filter(u=>!!u);return a.length>0?TS(r,a):null}function TS(e,t){const r=[];let i=0,a=0;return t.forEach((u,c)=>{r.push({kind:"hunk",text:`@@ -1,${u.oldLines.length} +1,${u.newLines.length} @@`,oldLineNumber:null,newLineNumber:null}),u.oldLines.forEach((d,m)=>{d.length===0&&u.oldLines.length===1&&u.newLines.length>0||(a+=1,r.push({kind:"remove",text:`-${d}`,oldLineNumber:m+1,newLineNumber:null}))}),u.newLines.forEach((d,m)=>{d.length===0&&u.newLines.length===1&&u.oldLines.length>0||(i+=1,r.push({kind:"add",text:`+${d}`,oldLineNumber:null,newLineNumber:m+1}))}),c<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 Gz(e){const t=PD(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 Kz(e){var u;const t=e.map(c=>({message:c,tool:TD(c)})).filter(c=>!!c.tool);if(t.length===0)return null;const r={...t[0].tool};let i=!1,a=!1;for(const{message:c,tool:d}of t)c.kind==="tool_call"&&(i=!0,!r.input&&d.input&&(r.input=d.input)),c.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:c})=>c.id).join(":"),tool:r,hasRequest:i,hasResult:a,updatedAt:((u=t.at(-1))==null?void 0:u.message.timestamp)??t[0].message.timestamp}}function Yz(e){const t=new Map;for(const r of e){const i=TD(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=>Kz(r.messages)).filter(r=>!!r)}function Xz(e){const t=[];for(let r=0;r<e.length;r+=1){const i=e[r];if(!Bg(i)){t.push({type:"message",key:i.id,message:i});continue}const a=[i];let u=r+1;for(;u<e.length;){const d=e[u];if(!Bg(d))break;a.push(d),u+=1}const c=Yz(a);if(c.length===0){t.push({type:"message",key:i.id,message:i}),r=u-1;continue}c.forEach(d=>{t.push({type:"tool_group",key:d.key,group:d})}),r=u-1}return t}function Qz(e,t){if(!HL(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 Jz(e){const t=e.split(/\r?\n/).map(r=>r.trim()).find(Boolean);return t?t.replace(/^#+\s*/,""):o("conversation.rulesMessageTitle")}function Zz(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 Xc(e){var t;return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(r=>Xc(r)).join(""):e&&typeof e=="object"&&"props"in e?Xc(((t=e.props)==null?void 0:t.children)??""):""}function e5(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:Xc(r.children).replace(/\n$/,""),codeClassName:i||void 0,language:(a==null?void 0:a[1])??null}}function t5(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 cv(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(!t5(e))throw new Error(o("conversation.copyContentFailed"))}}function n5({className:e,children:t,onCopy:r}){const i=p.useContext(ND),a=Xc(t).trim();if(i||!a)return n.jsx("code",{className:e||void 0,children:t});function u(c){c.key!=="Enter"&&c.key!==" "||(c.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:u,children:t})}function r5({href:e,children:t,className:r,onInteract:i}){const a=Xc(t).trim()||(e?lv(e).trim():"");return n.jsx(ND.Provider,{value:!0,children:n.jsx("a",{href:e,className:[r,"markdown-interactive-link"].filter(Boolean).join(" "),onClick:u=>{u.preventDefault(),i(e,a)},children:t})})}function DD({language:e,codeClassName:t,content:r}){const{showToast:i}=ir(),a=cr(),u=(e==null?void 0:e.trim().toLowerCase())??null,c=u==="text",d=u||"code";async function m(){try{await cv(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${c?" 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 oh({content:e,className:t}){const{showToast:r}=ir(),i=cr(),{navigationGroups:a,currentWorkspaceId:u,revealWorkspaceFile:c}=gr(),d=p.useMemo(()=>{var v;return((v=a.find(g=>g.workspace.id===u))==null?void 0:v.workspace)??null},[u,a]);async function m(v){if(v.trim())try{await cv(v,i),r({title:o("conversation.copyContentSuccess"),tone:"success"})}catch(g){r({title:g instanceof Error?g.message:o("conversation.copyContentFailed"),tone:"error"})}}function f(v,g){const w=v&&(d!=null&&d.path)?qz(v,d.path):null;w&&c({workspaceId:(d==null?void 0:d.id)??u,filePath:w,openViewer:!1})||m(g||(v?lv(v).trim():""))}return n.jsx("div",{className:t,children:n.jsx(rv,{remarkPlugins:[ov],components:{p:({node:v,...g})=>n.jsx("p",{...g}),a(v){return n.jsx(r5,{href:typeof v.href=="string"?v.href:void 0,className:typeof v.className=="string"?v.className:void 0,onInteract:f,children:v.children})},pre(v){const g=e5(v.children);return g?n.jsx(DD,{language:g.language,codeClassName:g.codeClassName,content:g.content}):n.jsx("pre",{children:v.children})},code(v){const g=typeof v.className=="string"?v.className:"";return n.jsx(n5,{className:g||void 0,onCopy:w=>{m(w)},children:v.children})}},children:e})})}function PS(e,t){return!(t!=null&&t.contentBase64)||t.mimeType!==e.mimeType?null:`data:${t.mimeType};base64,${t.contentBase64}`}function Md({sessionId:e,attachmentPayloads:t=[],attachments:r=[],inlineImages:i=[]}){return n.jsx(i5,{sessionId:e,attachments:r,attachmentPayloads:t,inlineImages:i})}function i5({sessionId:e,attachmentPayloads:t=[],attachments:r=[],inlineImages:i=[]}){const[a,u]=p.useState({}),[c,d]=p.useState(null),m=p.useMemo(()=>r.map((w,y)=>{const x=PS(w,t==null?void 0:t[y]);if(x)return{id:w.id,fileName:w.fileName,fileSize:w.fileSize,url:x,status:"ready"};const C=a[w.id];return{id:w.id,fileName:w.fileName,fileSize:w.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((w,y)=>({id:`inline-image-${y}`,fileName:w.altText||`${o("conversation.imageAttachmentLabel")} ${y+1}`,fileSize:w.estimatedBytes,url:w.url,status:"ready"})),[i]),v=p.useMemo(()=>[...f,...m],[m,f]),g=v.find(w=>w.id===c)??null;return p.useEffect(()=>{if(!c)return;function w(y){y.key==="Escape"&&d(null)}return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[c]),p.useEffect(()=>{const w=r.filter((C,j)=>!PS(C,t==null?void 0:t[j]));if(!e||w.length===0){u({});return}let y=!1;const x=[];return u(Object.fromEntries(w.map(C=>[C.id,{id:C.id,fileName:C.fileName,fileSize:C.fileSize,url:null,status:"loading"}]))),Promise.all(w.map(async C=>{try{const j=await dL(e,C.id),T=URL.createObjectURL(j);return x.push(T),{id:C.id,fileName:C.fileName,fileSize:C.fileSize,url:T,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}u(Object.fromEntries(C.map(j=>[j.id,j])))}),()=>{y=!0,x.forEach(C=>URL.revokeObjectURL(C))}},[t,r,e]),v.length===0?null:n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"message-attachments",children:v.map(w=>{const y=w.status==="loading"?o("conversation.attachmentPreviewLoading"):w.status==="error"?o("conversation.attachmentPreviewUnavailable"):o("conversation.attachmentPreviewOpen");return n.jsx("button",{type:"button",className:"message-attachment-button",onClick:()=>w.url&&d(w.id),disabled:!w.url,"aria-label":`${w.fileName} - ${y}`,title:y,children:n.jsx("div",{className:"message-attachment-card",children:w.url?n.jsx("img",{className:"message-attachment-thumbnail",src:w.url,alt:w.fileName||o("conversation.attachmentPreviewAlt"),loading:"lazy"}):n.jsx("div",{className:"message-attachment-placeholder","aria-hidden":"true",children:w.status==="loading"?o("conversation.attachmentPreviewLoading"):o("conversation.attachmentPreviewUnavailable")})})},w.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 s5(){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 a5({tool:e,preview:t}){const[r,i]=p.useState(null);return p.useEffect(()=>{if(r===null)return;function a(u){u.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,u)=>n.jsxs("button",{type:"button",className:"apply-patch-summary-row",onClick:()=>i(u),children:[n.jsx("span",{className:"apply-patch-summary-label",children:DS(a.action)}),n.jsx("span",{className:"apply-patch-summary-file",title:Sf(a),children:bz(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]})]})]},RS(a,u)))}),r!==null&&typeof document<"u"?Xn.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:DS(a.action)}),n.jsx("strong",{children:Sf(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((u,c)=>n.jsxs("div",{className:`apply-patch-diff-line ${h5(u.kind)}`,children:[n.jsx("span",{className:"apply-patch-line-number",children:MS(u.oldLineNumber)}),n.jsx("span",{className:"apply-patch-line-number",children:MS(u.newLineNumber)}),n.jsx("span",{className:"apply-patch-line-content",children:u.text||" "})]},`${Sf(a)}:${c}`))})})]},RS(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 o5({group:e}){const[t,r]=p.useState(!1),{tool:i,hasRequest:a,hasResult:u}=e,c=$z(i.name),d=p.useMemo(()=>tO(i,null,e.updatedAt),[e.updatedAt,i]),m=p.useMemo(()=>Vz(i),[i.input,i.name]);if(m)return n.jsx(a5,{tool:i,preview:m});if(d)return n.jsx(l5,{tool:i,snapshot:d,expanded:t,hasRequest:a,hasResult:u,onToggleExpanded:()=>{r(g=>!g)}});const f=Gz(i),v=!!(i.input||i.output||i.error);return n.jsxs("div",{className:`tool-call-item ${u?"tool-result":""}`,children:[n.jsxs("button",{type:"button",className:"tool-call-header",onClick:()=>v&&r(g=>!g),children:[n.jsxs("div",{className:"tool-call-info",children:[n.jsx("span",{className:"tool-call-name",children:c}),n.jsx("span",{className:"tool-call-input-preview",children:f})]}),n.jsx("div",{className:"tool-call-meta",children:v&&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&&v&&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})]}),(u||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 l5({tool:e,snapshot:t,expanded:r,hasRequest:i,hasResult:a,onToggleExpanded:u}){const c=aP(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:c5(t,e.name)}),n.jsx("span",{className:"task-tool-summary-text",children:u5(t.items,c)})]})]}),n.jsx("button",{type:"button",className:"task-tool-raw-toggle",onClick:u,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:d5(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 c5(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 u5(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 d5(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 DS(e){return o(e==="add"?"conversation.applyPatchAddedLabel":e==="delete"?"conversation.applyPatchDeletedLabel":"conversation.applyPatchEditedLabel")}function Sf(e){return e.nextPath&&e.nextPath!==e.path?`${e.path} -> ${e.nextPath}`:e.nextPath??e.path}function RS(e,t){return`${e.path}:${e.nextPath??""}:${t}`}function h5(e){return e==="add"?"is-added":e==="remove"?"is-removed":e==="hunk"?"is-hunk":e==="meta"?"is-meta":"is-context"}function MS(e){return e===null||e<=0?"":String(e)}function m5(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function RD({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:m5(e)}),r]})]})}function vl({text:e,canCopy:t=!0,canFork:r=!1,compact:i=!1,onFork:a}){const{showToast:u}=ir(),c=cr(),[d,m]=p.useState(!1),[f,v]=p.useState(!1),g=e.trim().length>0,w=t&&g;async function y(){if(!(!w||d)){m(!0);try{await cv(e,c),u({title:o("conversation.copyContentSuccess"),tone:"success"})}catch(C){u({title:C instanceof Error?C.message:o("conversation.copyContentFailed"),tone:"error"})}finally{m(!1)}}}async function x(){if(!(!a||f)){v(!0);try{await a()}finally{v(!1)}}}return!w&&!r?null:n.jsxs("div",{className:i?"message-metadata-bar compact":"message-metadata-bar",children:[w?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(uO,{})}):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(dO,{})}):null]})}function p5({message:e,kind:t,tone:r,actionState:i,onRetry:a,onForkMessage:u}){const[c,d]=p.useState(!1),m=Jz(e.content),f=r==="user-message",v=o(t==="system_prompt"?"conversation.systemPromptTitle":"conversation.rulesMessageTitle"),g=o(t==="system_prompt"?"conversation.systemPromptHint":"conversation.rulesMessageHint"),w=o(c?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":c,onClick:()=>d(y=>!y),children:[n.jsxs("div",{className:"rules-message-heading",children:[n.jsx("span",{className:"rules-message-badge",children:v}),n.jsx("span",{className:"rules-message-summary",children:m})]}),n.jsx("span",{className:"rules-message-action",children:w})]}),n.jsx("p",{className:"rules-message-hint",children:g}),c&&n.jsx("div",{className:"rules-message-body",children:n.jsx(oh,{content:e.content,className:"message-text message-content markdown-content"})}),f?n.jsx(RD,{timestamp:e.timestamp,children:n.jsx(vl,{text:e.content,canCopy:i.canCopy,canFork:i.canFork&&!!(u&&e.deliveryState==="sent"),compact:!0,onFork:u?()=>u(e):null})}):n.jsx(vl,{text:e.content,canCopy:i.canCopy,canFork:i.canFork&&!!(u&&e.deliveryState==="sent"),onFork:u?()=>u(e):null})]}),e.deliveryState==="failed"&&e.clientRequestId&&n.jsx("button",{className:"retry-button",type:"button",onClick:()=>a(e.clientRequestId),children:o("conversation.resendButton")})]})})}function f5({message:e,provider:t,foldedPromptKind:r=null,actionState:i,onRetry:a,onForkMessage:u,assistantAvatar:c}){const d=e.role==="user",m=e.kind==="thinking",f=e.role==="assistant"&&e.kind==="text",v=r??(Qz(t,e.content)?"rules":null),g=p.useMemo(()=>Co(e.content),[e.content]),w=g.text,y=g.inlineImages,[x,C]=p.useState(!1),[j,T]=p.useState(!1),[P,I]=p.useState(null),[Z,q]=p.useState(null);if(v){const B=e.role==="user"?"user-message":e.role==="assistant"?"assistant-message":"system-message";return n.jsx(p5,{message:e,kind:v,tone:B,actionState:i,onRetry:a,onForkMessage:u})}if(d){const B=e.origin==="butler_proxy"||g5(e.clientRequestId),E=e.origin==="butler_proxy"&&typeof e.originRef=="string"&&e.originRef.trim().length>0;async function A(){if(!E)return;const _=!x;if(C(_),!(!_||Z||j)){T(!0),I(null);try{const Y=await ST(e.originRef);q(Y.task)}catch(Y){I(Y instanceof Error?Y.message:o("conversation.butlerOriginDetailLoadFailed"))}finally{T(!1)}}}const H=B?E?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:()=>{A()},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}):Z?n.jsxs(n.Fragment,{children:[n.jsxs("p",{children:[o("conversation.butlerOriginDetailObjectiveLabel"),":",Z.objective]}),n.jsxs("p",{children:[o("conversation.butlerOriginDetailStatusLabel"),":",b5(Z.status)]}),n.jsxs("p",{children:[o("conversation.butlerOriginDetailSummaryLabel"),":",Z.lastAutomationSummary||o("conversation.butlerAnalysisEmpty")]}),Z.waitingReason?n.jsxs("p",{children:[o("conversation.butlerOriginDetailWaitingReasonLabel"),":",Z.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(Md,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:y}),w?n.jsx(oh,{content:w,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(RD,{timestamp:e.timestamp,leading:H,children:n.jsx(vl,{text:w,canCopy:i.canCopy,canFork:i.canFork&&!!(u&&e.deliveryState==="sent"),compact:!0,onFork:u?()=>u(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:c??n.jsx(AS,{})}),n.jsxs("div",{className:"thinking-message-content",children:[n.jsx("div",{className:"thinking-message-label",children:o("conversation.thinkingLabel")}),n.jsx(Md,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:y}),w&&n.jsx(oh,{content:w,className:"message-text message-content markdown-content thinking-message-text"}),n.jsx(vl,{text:w,canCopy:i.canCopy,canFork:i.canFork&&!!(u&&e.deliveryState==="sent"),onFork:u?()=>u(e):null})]})]}):f?n.jsxs("article",{className:"message-item assistant-message","data-message-id":e.id,children:[n.jsx("div",{className:"message-avatar",children:c??n.jsx(AS,{})}),n.jsxs("div",{className:"message-content-wrapper",children:[n.jsx(Md,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:y}),w&&n.jsx(oh,{content:w,className:"message-text message-content markdown-content"}),n.jsx(vl,{text:w,canCopy:i.canCopy,canFork:i.canFork&&!!(u&&e.deliveryState==="sent"),onFork:u?()=>u(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(Md,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:y}),w?n.jsx("div",{className:"message-text message-content",children:n.jsx(DD,{language:"text",content:w})}):null,n.jsx(vl,{text:w,canCopy:i.canCopy,canFork:i.canFork&&!!(u&&e.deliveryState==="sent"),onFork:u?()=>u(e):null})]})})}function AS(){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 g5(e){return typeof e=="string"&&e.startsWith("butler-follow-up:")}function b5(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 uv({sessionId:e="session",messages:t,historyState:r,loadingOlderMessages:i=!1,hasOlderMessages:a=!1,onLoadOlderMessages:u=()=>{},onRetryMessage:c,onForkMessage:d,provider:m,runtimeThinkingPlaceholder:f=null,assistantAvatar:v}){var rt;const{showToast:g}=ir(),w=p.useRef(null),y=p.useRef(e),x=p.useRef(0),C=p.useRef(null),j=p.useRef(!0),T=p.useRef(null),P=p.useRef(!1),I=p.useRef(Rd(e)),Z=p.useRef(((rt=Rd(e))==null?void 0:rt.lastMessageSignature)??null),q=p.useRef(Rd(e)),B=p.useRef(null),E=p.useRef(null),A=p.useRef(null),H=p.useRef(0),_=p.useRef(!1),[Y,z]=p.useState(!1),[K,O]=p.useState(!1),F=p.useRef(!1),te=Xz(t),de=p.useMemo(()=>Zz(t,m),[t,m]),W=p.useMemo(()=>v5(t),[t]),M=r==="loading"&&t.length===0;function N(fe){const Oe=fe.scrollHeight-fe.clientHeight-fe.scrollTop<=CS;return{scrollTop:fe.scrollTop,stickToBottom:Oe,lastMessageSignature:F.current&&!Oe?Z.current:Ad(t.at(-1)??null)}}function L(fe){return q.current=N(fe),q.current}function X(fe){const ue=fe.scrollHeight-fe.clientHeight-fe.scrollTop,Oe=ue<=CS;j.current=Oe,Oe&&F.current&&(_e(),F.current=!1,Z.current=Ad(t.at(-1)??null),O(!1)),z(t.length>0&&(ue>jS||F.current)),L(fe)}function D(fe=w.current){fe&&L(fe),q.current&&SS(e,q.current)}function be(fe){q.current&&SS(fe,q.current)}function ce(){B.current!==null&&(window.clearTimeout(B.current),B.current=null)}function le(){ce(),B.current=window.setTimeout(()=>{B.current=null,D()},_z)}function ye(fe){fe.scrollTop=fe.scrollHeight}function Se(){E.current!==null&&(window.clearTimeout(E.current),E.current=null)}function _e(){Se(),_.current=!1,A.current=null,H.current=0}function Ce(fe,ue){const Oe=Math.max(0,fe.scrollHeight-fe.clientHeight),qe=Math.max(0,Math.min(ue,Oe));fe.scrollTop=qe,j.current=!1,z(t.length>0&&(Oe-qe>jS||F.current))}function Nt(){Se(),_.current&&(E.current=window.setTimeout(()=>{E.current=null;const fe=w.current,ue=A.current;if(!fe||ue===null){_e();return}if(Ce(fe,ue),Date.now()<H.current){Nt();return}_e(),X(fe)},Oz))}function ct(fe,ue){_.current=!0,A.current=fe,H.current=Date.now()+Bz,Ce(ue,fe),Nt()}function gt(fe){return P.current||!a||i||r!=="ready"||fe.scrollTop>Fz?!1:(P.current=!0,T.current=fe.scrollHeight-fe.scrollTop,u(),!0)}p.useEffect(()=>{r==="error"&&g({title:o("conversation.historyLoadFailed"),tone:"error"})},[r,g]),p.useLayoutEffect(()=>{var fe,ue;y.current!==e&&(be(y.current),y.current=e,x.current=0,C.current=null,I.current=Rd(e),Z.current=((fe=I.current)==null?void 0:fe.lastMessageSignature)??null,q.current=I.current,j.current=((ue=I.current)==null?void 0:ue.stickToBottom)??!0,T.current=null,_e(),F.current=!1,O(!1),z(!1))},[e]),p.useLayoutEffect(()=>()=>{ce(),_e(),be(y.current)},[e]),p.useLayoutEffect(()=>{const fe=w.current,ue=Ad(t.at(-1)??null);if(!fe){x.current=t.length,C.current=ue;return}const Oe=x.current,qe=C.current,nt=I.current;if(nt&&r==="ready"){const yt=!nt.stickToBottom&&nt.lastMessageSignature!==null&&ue!==null&&nt.lastMessageSignature!==ue;nt.stickToBottom?(_e(),ye(fe)):ct(nt.scrollTop,fe),F.current=yt,Z.current=nt.lastMessageSignature,O(yt),I.current=null,X(fe),x.current=t.length,C.current=ue,L(fe);return}if(nt&&r==="error"){nt.stickToBottom?(_e(),ye(fe)):ct(nt.scrollTop,fe),I.current=null,X(fe),x.current=t.length,C.current=ue,L(fe);return}if(_.current){Ce(fe,A.current??fe.scrollTop),x.current=t.length,C.current=ue,L(fe);return}T.current!==null&&t.length>=Oe?(fe.scrollTop=Math.max(0,fe.scrollHeight-T.current),T.current=null):j.current&&(Oe===0||t.length!==Oe||ue!==qe)&&ye(fe),X(fe),x.current=t.length,C.current=ue},[r,t,e]),p.useEffect(()=>{if(!a){P.current=!1;return}!i&&T.current===null&&(P.current=!1)},[a,i,t.length]);function ft(){const fe=w.current;fe&&(X(fe),le(),gt(fe))}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:w,className:"message-list",onScroll:ft,children:[M?n.jsx(s5,{}):null,i?n.jsx("div",{className:"timeline-status timeline-status-inline",children:n.jsx("span",{className:"status-text",children:o("conversation.historyLoadingOlder")})}):null,te.length===0&&r==="ready"&&n.jsx("div",{className:"timeline-empty",children:n.jsx("p",{className:"status-text",children:o("conversation.timelineEmpty")})}),te.map(fe=>fe.type==="tool_group"?n.jsx("article",{className:"message-item tool-message-row",children:n.jsx(o5,{group:fe.group})},fe.key):n.jsx(f5,{message:fe.message,provider:m,foldedPromptKind:de.has(fe.message.id)?"system_prompt":null,actionState:W.get(fe.message.id)??{canCopy:fe.message.role==="user",canFork:!1},onRetry:c,onForkMessage:d,assistantAvatar:v},fe.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:Lz(f)||f}),n.jsx("span",{className:"thinking-status-dots","aria-hidden":"true",children:"..."})]})}):null]}),Y?n.jsxs("button",{type:"button",className:"conversation-scroll-to-bottom-button","data-has-new":K?"true":"false","aria-label":o("conversation.scrollToBottomAction"),title:o("conversation.scrollToBottomAction"),onClick:()=>{const fe=w.current;fe&&(_e(),ye(fe),F.current=!1,Z.current=Ad(t.at(-1)??null),O(!1),X(fe),D(fe))},children:[K?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 Ad(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 v5(e){const t=new Map;let r=0;function i(a){let u=null;for(let c=a-1;c>=r;c-=1){const d=e[c];if(!(!d||!w5(d))){u=d.id;break}}for(let c=r;c<a;c+=1){const d=e[c];if(d){if(d.role==="user"){t.set(d.id,{canCopy:!0,canFork:!1});continue}t.set(d.id,{canCopy:d.id===u,canFork:d.id===u})}}}for(let a=0;a<e.length;a+=1){const u=e[a];u&&u.role==="user"&&a>r&&(i(a),r=a)}return i(e.length),t}function w5(e){return e.role==="user"?!1:e.kind!=="tool_call"&&e.kind!=="tool_result"}class MD{constructor(t){it(this,"socket",null);it(this,"disposed",!1);it(this,"authRecoveryInFlight",!1);it(this,"latestCursor");it(this,"connectionManager");this.options=t,this.latestCursor=t.cursor,this.connectionManager=new LN({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.socket.send(JSON.stringify({type:"session.load_older",sessionId:this.options.sessionId,cursor:t,limit:r})),!0)}close(){var t;this.disposed=!0,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var u;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const r=(u=rr.getState().session)==null?void 0:u.accessToken;if(!r){this.options.onUnauthorized();return}const i=`${Rj("/ws")}?access_token=${encodeURIComponent(r)}`,a=new WebSocket(i);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",c=>{const d=JSON.parse(c.data);if(d.type==="system.connected"){this.connectionManager.markConnected();return}if(d.type==="session.subscribed"){this.options.onSubscribed();return}if(d.type==="session.error"){if(d.error_code==="UNAUTHORIZED"){this.handleUnauthorized();return}this.options.onError(d);return}if(d.type==="session.runtime_status"){this.options.onRuntimeStatus(d);return}if(d.type==="session.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.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(),rr.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()}})}}function ES(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 cm(e,t,r="sent",i=null){const a=t.kind??(t.role==="tool"?"tool_result":"text"),u=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:u,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 AD(e,t,r,i=[],a=[],u=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:u,rawRef:`pending://${r}`,deliveryState:"sending",clientRequestId:r}}function bc(e,t,r){const i=new Map;for(const a of e)i.set(a.id,a);for(const a of r){const u=cm(t,a),c=V5(i,u);if(c&&c!==u.id)continue;const d=$5(i,u);d&&d!==u.id&&i.delete(d);const m=i.get(a.messageId)??null;i.set(a.messageId,m?P5(m,u):u)}return ED(Array.from(i.values()))}function IS(e,t,r,i){const a=i===null?null:e.find(m=>m.clientRequestId===i)??null,u=e.filter(m=>m.clientRequestId!==i),c=cm(t,r,"sent",i),d=T5(c,a);return ED([...u.filter(m=>m.id!==d.id),d])}function Wg(e,t){return e.map(r=>r.clientRequestId===t?{...r,deliveryState:"failed"}:r)}function y5(e){const t=[];for(const r of e){const i=t.at(-1);if(!i||!ID(i,r)){t.push(r);continue}t[t.length-1]=I5(i,r)}return t}function k5(e){const t=[];for(const r of e){if(!R5(r)){t.push(r);continue}let i=t.length-1;for(;i>=0&&M5(t[i]);)i-=1;const a=i>=0?t[i]:null;if(!a||!ID(a,r)){t.push(r);continue}t[i]=L5(a,r)}return t}function x5(e){const t=[];let r=null,i=!1;for(const a of e)if(!A5(r,a,i)){if(t.push(a),Qc(a)){r=a,i=!1;continue}r&&Ug(a)&&(i=!0)}return t}function S5(e){const t=[];for(const r of e){const i=t.at(-1);if(!i||!LD(i,r)){t.push(r);continue}t[t.length-1]=FD(i,r)}return t}function C5(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],u=t[t.length-2],c=t[t.length-1];E5(i,a,u,c)&&t.splice(t.length-3,3,FD(a,c))}return t}function j5(e){const t=[];for(const r of e){const i=t.at(-1);if(!i||!F5(i,r)){t.push(r);continue}t[t.length-1]=O5(i,r)}return t}function N5(e){const t=[];for(const r of e){const i=t.findIndex(a=>_5(a,r));if(i===-1){t.push(r);continue}t[i]=B5(t[i],r)}return t}function ED(e){const t=[...e].sort((r,i)=>r.sequence!==i.sequence?r.sequence-i.sequence:r.timestamp.localeCompare(i.timestamp));return N5(j5(x5(C5(S5(k5(y5(t)))))))}function T5(e,t){if(!t||!D5(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 P5(e,t){if(e.id!==t.id)return t;if(e.role!==t.role||e.kind!==t.kind||e.rawRef!==t.rawRef)return Jc(e,t);const r=W5(e.toolCall,t.toolCall),i=H5(e.content,t.content,e.timestamp,t.timestamp),a=z5(e.attachments,t.attachments);return{...Jc(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 D5(e,t){return um(e)&&t.role==="user"&&t.kind==="text"&&e.sequence>t.sequence}function ID(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=Co(e.content),i=Co(t.content);return Fl(e.timestamp,t.timestamp,30*1e3)&&Yn(r.text)===Yn(i.text)&&q5(r.inlineImages,i.inlineImages)}function R5(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("codex://")&&e.role==="assistant"&&(e.kind==="text"||e.kind==="thinking")&&e.toolCall===null}function M5(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("codex://")&&(e.kind==="tool_call"||e.kind==="tool_result")}function A5(e,t,r){return!e||r||!Qc(e)||!Qc(t)?!1:Fl(e.timestamp,t.timestamp,120*1e3)&&Yn(e.content)===Yn(t.content)}function Qc(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="user"&&e.kind==="text"}function Ug(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="assistant"&&e.kind==="text"}function LD(e,t){return Ug(e)&&Ug(t)&&Fl(e.timestamp,t.timestamp,120*1e3)&&Yn(e.content)===Yn(t.content)}function E5(e,t,r,i){return!e||!t||!r||!i||!Qc(e)||!Qc(r)?!1:LD(t,i)&&Fl(e.timestamp,r.timestamp,120*1e3)&&Yn(e.content)===Yn(r.content)}function FD(e,t){var c,d;const r=((c=e.attachments)==null?void 0:c.length)??0,i=((d=t.attachments)==null?void 0:d.length)??0;if(r!==i)return r>i?e:t;const a=Yn(e.content).length,u=Yn(t.content).length;return a!==u?a>u?e:t:Jc(e,t)}function I5(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=Co(e.content).inlineImages.length,u=Co(t.content).inlineImages.length;if(a!==u)return a>u?e:t;const c=e.content!==Yn(e.content),d=t.content!==Yn(t.content);return c!==d?c?t:e:t}function L5(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=Co(e.content).inlineImages.length,u=Co(t.content).inlineImages.length;if(a!==u)return a>u?e:t;const c=e.content!==Yn(e.content),d=t.content!==Yn(t.content);return c!==d&&c?t:e}function F5(e,t){return!LS(e)||!LS(t)?!1:e.role===t.role&&Fl(e.timestamp,t.timestamp,120*1e3)&&Yn(e.content)===Yn(t.content)}function _5(e,t){return!FS(e)||!FS(t)?!1:e.role===t.role&&Fl(e.timestamp,t.timestamp,120*1e3)&&Yn(e.content)===Yn(t.content)}function LS(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("gemini://session/")&&e.kind==="text"&&e.toolCall===null&&(e.role==="user"||e.role==="assistant")}function FS(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("kimi://session/")&&e.kind==="text"&&e.toolCall===null&&(e.role==="user"||e.role==="assistant")}function O5(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=Yn(e.content).length,u=Yn(t.content).length;if(a!==u)return a>u?e:t;const c=e.rawRef.includes("#file="),d=t.rawRef.includes("#file=");return c!==d?c?e:t:Jc(e,t)}function B5(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=Yn(e.content).length,u=Yn(t.content).length;if(a!==u)return a>u?e:t;const c=e.rawRef.includes("/context#"),d=t.rawRef.includes("/context#");return c!==d?c?e:t:Jc(e,t)}function W5(e,t){return e?t?{...U5(e,t),input:_D(e.input,t.input),output:OS(e.output,t.output),error:OS(e.error,t.error)}:e:t}function U5(e,t){const r=_S(e.status),i=_S(t.status);return i!==r?i>r?t:e:t}function _S(e){return e==="running"?0:1}function H5(e,t,r,i){const a=Yn(e),u=Yn(t);return a===u?e.length>=t.length?e:t:a.length>u.length&&a.includes(u)?e:u.length>a.length&&u.includes(a)||i.localeCompare(r)>=0?t:e}function z5(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 _D(e,t){return t.length>e.length?t:e}function OS(e,t){return e===null?t:t===null?e:_D(e,t)}function Jc(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 Yn(e){return e.replace(/\r\n/g,`
|
|
106
|
+
`).trimEnd()}function q5(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 $5(e,t){return BD(t)?OD(e,t,"optimistic"):null}function V5(e,t){return um(t)?OD(e,t,"authoritative"):null}function OD(e,t,r){const i=Eh(t.timestamp),a=Yn(t.content);let u=null,c=Number.POSITIVE_INFINITY;for(const[d,m]of e.entries()){if(!(r==="optimistic"?um(m):BD(m))||Yn(m.content)!==a)continue;const v=Eh(m.timestamp),g=Math.abs(v-i);g>300*1e3||g<c&&(u=d,c=g)}return u}function um(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 BD(e){return e.role==="user"&&e.kind==="text"&&!um(e)}function Eh(e){const t=Date.parse(e);return Number.isFinite(t)?t:0}function G5(e){return e.reduce((r,i)=>Number.isFinite(i.sequence)&&i.sequence>r?i.sequence:r,0)+1}function Fl(e,t,r){return Math.abs(Eh(e)-Eh(t))<=r}const BS=30,WD=40,WS=300*1e3,K5=600,Y5=5e3,X5=1e4;function Cf(){const e=bs.getState().profile.defaultPermissionMode;return e==="default"?null:e}class UD{constructor(t,r={}){it(this,"state");it(this,"listeners",new Set);it(this,"realtimeClient",null);it(this,"historyBootstrapFallbackTimer",null);it(this,"historyBootstrapEnvelopeReceived",!1);it(this,"markSeenTimer",null);it(this,"markSeenInFlight",!1);it(this,"lastMarkSeenRequestAt",0);it(this,"seenWatermark",null);it(this,"runtimeRefreshTimer",null);it(this,"runtimeRefreshMode",null);it(this,"replaceSnapshotSeedOnBackfill",!1);it(this,"pendingReplyDebugTraces",[]);it(this,"hasAuthoritativeBootstrapMessages");it(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));it(this,"getState",()=>this.state);var c;this.sessionId=t,this.options=r;const i=Rr(Pf(t),WS);this.hasAuthoritativeBootstrapMessages=(((c=r.bootstrapMessages)==null?void 0:c.length)??0)>0;const a=Ed(r.initialSession??null,(i==null?void 0:i.session)??null),u=bc((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=ES({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:u,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=bc(this.state.messages,this.sessionId,t),i=this.hasAuthoritativeBootstrapMessages;this.patch({messages:r,historyState:J5(this.state.session,i?r.length:0),loadingOlderMessages:!1,olderCursor:i?null:this.state.olderCursor,hasOlderMessages:ul({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=Rr(Pf(this.sessionId),WS);this.state=ES({session:Ed(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:bc((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=Ed(this.state.session,t);r!==this.state.session&&this.patch({session:r,hasOlderMessages:ul({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=$S();this.beginPendingReplyDebugTrace("send_live",i,t.length);const a=AD(this.sessionId,t,i,(r==null?void 0:r.attachmentMeta)??[],(r==null?void 0:r.attachments)??[],G5(this.state.messages));this.patch({messages:[...this.state.messages,a],session:js(this.state.session,"running"),runtimeHasActiveRun:VS(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:GS(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt});try{const u=await this.sendMessageWithFallback(t,i,r);this.markPendingReplyDebugTraceResponseReady(i,{returnedMessageId:u.message.messageId,returnedProviderSessionId:u.message.providerSessionId}),this.patch({messages:IS(this.state.messages,this.sessionId,u.message,i)})}catch(u){throw this.failPendingReplyDebugTrace(i,u),this.patch({messages:Wg(this.state.messages,i),session:js(this.state.session,"failed"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1}),u}}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:VS(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:GS(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:IS(this.state.messages,this.sessionId,i.message,t)})}catch(i){throw this.failPendingReplyDebugTrace(t,i),this.patch({messages:Wg(this.state.messages,t),session:js(this.state.session,"failed")}),i}}}async enqueueMessage(t,r){const i=$S();try{const a=await pL(this.sessionId,{content:t,clientRequestId:i,model:(r==null?void 0:r.model)??null,reasoningLevel:(r==null?void 0:r.reasoningLevel)??null,permissionMode:Cf(),attachments:(r==null?void 0:r.attachments)??[]});this.patch({queuedMessages:r6(this.state.queuedMessages,a)}),await this.refreshQueue()}catch(a){throw a}}async deleteQueuedMessage(t){await fL(this.sessionId,t),await this.refreshQueue()}async steerQueuedMessage(t){await gL(this.sessionId,t),await this.refreshRuntimeSnapshot("queue_steer")}async interrupt(){await bL(this.sessionId),this.patch({session:js(this.state.session,"interrupted"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:null,errorDetail:null})}async replyPermissionRequest(t,r){if(!(this.state.permissionRequests.find(u=>u.id===t)??null))return;const a=await vL(this.sessionId,t,r);this.patch({permissionRequests:Df(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,BS)))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=rr.getState().session)==null?void 0:r.accessToken)){rr.clear();return}this.realtimeClient=new MD({sessionId:this.sessionId,cursor:this.state.lastCursor,limit:WD,onSubscribed:()=>{tn("session_send.realtime_subscribed",{sessionId:this.sessionId,lastCursor:this.state.lastCursor}),this.patch({connectionState:"connected",hasOlderMessages:ul({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 u;const a=this.state.connectionState;if(this.patch({connectionState:i,session:i==="reconnecting"&&Xs((u=this.state.session)==null?void 0:u.runningState)?js(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 c,d;this.historyBootstrapEnvelopeReceived=!0,this.clearHistoryBootstrapFallbackTimer();const a=i.type==="session.backfill"&&this.replaceSnapshotSeedOnBackfill,u=this.mergeHistoryMessages(i.messages,i.type==="session.backfill");this.patch({messages:u,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:ul({session:this.state.session,loadedMessageCount:u.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,u.length>0?1:0):this.state.pagesLoaded,session:js(this.state.session,qS(i.type,(c=this.state.session)==null?void 0:c.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:()=>{rr.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(u=>u.deliveryState!=="sent"):this.state.messages,a=bc(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(K5,r);this.markSeenTimer=window.setTimeout(()=>{this.markSeenTimer=null;const a=this.getTargetSeenAt();a!==null&&(tn("session_seen.start",{sessionId:this.sessionId,targetSeenAt:a,seenWatermark:this.seenWatermark}),this.markSeenInFlight=!0,this.lastMarkSeenRequestAt=Date.now(),nL(this.sessionId).then(()=>{var u,c;this.bumpSeenWatermark(a),this.patch({session:US(this.state.session,a)}),(c=(u=this.options).onSeen)==null||c.call(u,this.sessionId,a),tn("session_seen.end",{sessionId:this.sessionId,seenWatermark:this.seenWatermark})}).catch(()=>{tn("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 Eb(this.sessionId,null,BS,"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:ul({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(!Xs((i=this.state.session)==null?void 0:i.runningState)){this.clearRuntimeRefreshTimer();return}t==="poll"&&this.state.connectionState==="connected"||(this.clearRuntimeRefreshTimer(),this.runtimeRefreshMode=t,tn("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 u=this.runtimeRefreshMode??t;this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null,this.refreshRuntimeState(u,r)},t==="poll"?X5:1200))}async refreshRuntimeState(t,r){var i,a,u,c,d;tn("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 wg(this.sessionId);this.patch({session:HS(this.state.session,m),runtimeHasActiveRun:m.hasActiveRun,runtimeCanInterrupt:m.canInterrupt,contextUsage:m.contextUsage,...Nf(m)}),await this.refreshQueue();const f=t==="poll"&&this.state.connectionState!=="connected"&&Xs((a=this.state.session)==null?void 0:a.runningState);tn("session_runtime.refresh.end",{sessionId:this.sessionId,mode:t,reason:r,connectionState:this.state.connectionState,runningState:((u=this.state.session)==null?void 0:u.runningState)??null,continuePolling:f}),f&&this.scheduleRuntimeRefresh("poll","connection_poll")}catch(m){tn("session_runtime.refresh.error",{sessionId:this.sessionId,mode:t,reason:r,connectionState:this.state.connectionState,runningState:((c=this.state.session)==null?void 0:c.runningState)??null,message:m instanceof Error?m.message:"unknown"}),t==="poll"&&this.state.connectionState!=="connected"&&Xs((d=this.state.session)==null?void 0:d.runningState)&&this.scheduleRuntimeRefresh("poll","connection_poll_retry")}}async refreshSessionMetadata(){const t=[];this.state.session===null&&t.push(ZN(this.sessionId).then(r=>{this.patch({session:Ed(r,this.state.session)})}).catch(()=>{})),zS(this.state.capabilities)&&t.push(lL(this.sessionId).then(r=>{this.patch({capabilities:r})}).catch(()=>{})),t.length!==0&&await Promise.allSettled(t)}async refreshPermissionRequests(){try{const t=await nT(this.sessionId);this.patch({permissionRequests:t.items})}catch{return}}shouldRefreshSessionDetail(){return this.state.session===null||zS(this.state.capabilities)||this.state.session.runningState===null}shouldRefreshRuntimeSnapshot(){return this.state.contextUsage===null}async refreshRuntimeSnapshot(t){tn("session_runtime.snapshot.start",{sessionId:this.sessionId,reason:t});try{const r=await wg(this.sessionId);this.patch({session:HS(this.state.session,r),runtimeHasActiveRun:r.hasActiveRun,runtimeCanInterrupt:r.canInterrupt,contextUsage:r.contextUsage,...Nf(r)}),await this.refreshQueue(),tn("session_runtime.snapshot.end",{sessionId:this.sessionId,reason:t,hasContextUsage:r.contextUsage!==null})}catch(r){tn("session_runtime.snapshot.error",{sessionId:this.sessionId,reason:t,message:r instanceof Error?r.message:"unknown"})}}async refreshQueue(){try{const t=await mL(this.sessionId);this.patch({queuedMessages:t.items})}catch{return}}async sendMessageWithFallback(t,r,i){var a;try{return await Ib(this.sessionId,{content:t,clientRequestId:r,model:(i==null?void 0:i.model)??null,reasoningLevel:(i==null?void 0:i.reasoningLevel)??null,permissionMode:Cf(),attachments:(i==null?void 0:i.attachments)??[]})}catch(u){if(!(u instanceof ei)||u.status!==404&&u.status!==405||(((a=i==null?void 0:i.attachments)==null?void 0:a.length)??0)>0)throw u;return tn("session_send.live_fallback",{sessionId:this.sessionId,clientRequestId:r,reason:u.message}),hL(this.sessionId,{content:t,clientRequestId:r,permissionMode:Cf()})}}handleRuntimeStatus(t){var i;const r=jf((i=this.state.session)==null?void 0:i.runningState,t.status);this.patch({session:js(this.state.session,r),runtimeHasActiveRun:Xs(r)?this.state.runtimeHasActiveRun??!0:!1,runtimeCanInterrupt:Xs(r)?this.state.runtimeCanInterrupt:!1,errorCode:null,errorDetail:r===t.status?t.detail:this.state.errorDetail}),Ih(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:e6(this.state.session,t),runtimeHasActiveRun:t.hasActiveRun,runtimeCanInterrupt:t.canInterrupt,...Nf(t)}),Ih(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=bc(this.state.messages,this.sessionId,[t.message]);this.patch({messages:r,historyState:"ready",hasOlderMessages:ul({session:this.state.session,loadedMessageCount:r.length,olderCursor:this.state.olderCursor,pagesLoaded:this.state.pagesLoaded,currentHasOlderMessages:this.state.hasOlderMessages}),session:js(this.state.session,qS("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=jf((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:js(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=jf((i=this.state.session)==null?void 0:i.runningState,"interrupted");this.completePendingReplyDebugTraceWithoutAssistant("session_send.client_interrupted",{detail:t.detail}),this.clearRuntimeRefreshTimer(),this.patch({session:js(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:Df(this.state.permissionRequests,t.request)})}handlePermissionRequestResolved(t){this.patch({permissionRequests:Df(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,Y5-(Date.now()-this.lastMarkSeenRequestAt))}applySeenWatermark(t){return!t||!this.seenWatermark?t:US(t,this.seenWatermark)}emit(){for(const t of this.listeners)t()}persistSnapshot(){Zr(Pf(this.sessionId),{session:this.state.session,capabilities:this.state.capabilities,runtimeHasActiveRun:this.state.runtimeHasActiveRun,runtimeCanInterrupt:this.state.runtimeCanInterrupt,contextUsage:this.state.contextUsage,messages:n6(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),tn(`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(),tn(`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&&(tn(`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();tn(`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&&(tn(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 gi(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 Q5(e){const t=e==null?void 0:e.messageCount;return typeof t=="number"&&Number.isFinite(t)?t:null}function J5(e,t){return t>0?"ready":"loading"}function Z5(e,t){const r=Q5(e);return r!==null?r>t:t>=WD}function ul(e){return e.olderCursor?!0:e.pagesLoaded>1?e.currentHasOlderMessages:Z5(e.session,e.loadedMessageCount)}function js(e,t){return e&&{...e,runningState:t,activityState:zD(e,t,e.completedAt??null,Xs(t))}}function US(e,t){return!e||e.lastSeenAt&&e.lastSeenAt>=t?e:{...e,lastSeenAt:t,activityState:e.activityState==="completed_unread"?"idle":e.activityState}}function HS(e,t){return HD(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 e6(e,t){return HD(e,t)}function HD(e,t){if(!e)return e;const r=t6(t.activityResolutionSource),i=Ih(t.runningState)?Tf(e.completedAt,t.updatedAt):null,a=t.runningState==="completed"||t.runningState==="interrupted"||t.runningState==="failed"?Tf(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:Tf(e.updatedAt,t.updatedAt)??t.updatedAt,activityState:zD(e,t.runningState,i,t.hasActiveRun)}}function zD(e,t,r,i){return i||Xs(t)?"running":r&&(!e.lastSeenAt||r>e.lastSeenAt)?"completed_unread":e.activityState==="running"||e.activityState==="completed_unread"?"idle":e.activityState??"idle"}function Xs(e){return e==="starting"||e==="running"||e==="reconnecting"}function Ih(e){return e==="completed"||e==="interrupted"||e==="failed"}function zS(e){if(e===null)return!0;const t=e.modelOptions??[];return t.length===0?!0:t.every(r=>r.usesProviderDefault===!0)}function qS(e,t){return e==="session.backfill"?t??"idle":t==="completed"||t==="interrupted"||t==="failed"?t:"running"}function jf(e,t){return Ih(e)?e:t}function Nf(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 t6(e){return e==="authoritative_runtime"||e==="authoritative_provider_event"?"runtime":e==="inferred_log"?"inferred":"none"}function Tf(e,t){return e?t?e>=t?e:t:e:t??null}function $S(){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 VS(e,t){return e?t&&e.provider===t.provider?!!t.canSendMessage:dT(e.provider):!1}function GS(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 Pf(e){return`session-runtime.snapshot.${e}`}function n6(e){return e.filter(t=>t.deliveryState==="sent").slice(-600)}function r6(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 Df(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 Ed(e,t){if(!e)return t;if(!t||KS(e,t))return e;if(KS(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 KS(e,t){return YS(e)&&!YS(t)&&e.lastEventAt===t.lastEventAt&&e.lastMessageAt===t.lastMessageAt&&e.completedAt===t.completedAt}function YS(e){return e.activityState==="running"||Xs(e.runningState)}const XS="butler:records-updated";function dv(e){if(typeof window>"u")return()=>{};const t=()=>{e()};return window.addEventListener(XS,t),()=>{window.removeEventListener(XS,t)}}const QS=60;class i6{constructor(t){it(this,"state");it(this,"listeners",new Set);it(this,"realtimeClient",null);it(this,"realtimeSessionId",null);it(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));it(this,"getState",()=>this.state);this.workspaceId=t,this.state={loading:!0,sending:!1,switchingProvider:!1,initialized:!1,profile:null,activeProvider:"codex",controlSession:null,capabilities:dl("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 Qh();if(!t.initialized||!t.profile){this.patch({loading:!1,initialized:!1,profile:null,activeProvider:"codex",capabilities:dl("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:dl(r.providerId)}),await this.reloadForProvider(r.providerId),this.patch({loading:!1})}catch(t){this.patch({loading:!1,error:Gs(t)})}}async initializeProfile(t){this.patch({loading:!0,error:null});try{const r=await QL(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:dl(r.profile.providerId)}),await this.reloadForProvider(r.profile.providerId)}catch(r){throw this.patch({error:Gs(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:dl(t)});try{const i=await Ok({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:Gs(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 Ok(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:Gs(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 u=await tF({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:u.controlSession})}else{const u=await eF({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:u.controlSession})}await this.reloadControlSession(),await Promise.all([this.refreshOverview(),this.refreshEvents()])}catch(a){throw this.patch({error:Gs(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 ZL()}catch(r){throw this.patch({historyState:"error",error:Gs(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 JL()).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([Eb(r.session.sessionId,null,QS,"forward"),wg(r.session.sessionId)]),u=i.messages.map(c=>cm(r.session.sessionId,c));this.ensureRealtimeSubscription(r.session.sessionId,i.cursor),this.patch({controlSession:r,messages:u,historyState:"ready",runtimeHasActiveRun:a.hasActiveRun,runtimeCanInterrupt:a.canInterrupt,contextUsage:a.contextUsage})}catch(t){this.patch({historyState:"error",error:Gs(t)})}}async refreshCapabilities(t){try{const r=await Al(t,this.workspaceId);this.patch({capabilities:r})}catch{this.patch({capabilities:dl(t)})}}async refreshOverview(){try{const t=await Jh();this.patch({overview:t.overview})}catch(t){this.patch({error:Gs(t)})}}async refreshEvents(){try{const t=await nF();this.patch({events:t.items})}catch(t){this.patch({error:Gs(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 MD({sessionId:t,cursor:r,limit:QS,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:s6(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 Jr(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 dl(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 s6(e,t,r){const i=new Map;for(const a of e)i.set(JS(a),a);for(const a of r){const u=cm(t,a);i.set(JS(u),u)}return[...i.values()].sort((a,u)=>a.sequence!==u.sequence?a.sequence-u.sequence:a.timestamp.localeCompare(u.timestamp))}function JS(e){return e.id||e.rawRef}function Gs(e){return e instanceof Error?e.message:String(e)}const Hg={"risk-first":["risk","blocker","verification"],"blocker-first":["blocker","risk","verification"],"verification-first":["verification","risk","blocker"],"progress-first":["progress","risk","blocker"]},qD=300,a6={displayName:"",providerId:"codex",agentsMode:"inline",personaTone:"direct",personaLanguage:"zh-CN",personaSummaryStyle:"brief",focusRiskPreference:"conservative",reportPriorityPreset:"risk-first"},Rf={displayName:"",agentsMode:"inline",agentsFilePath:"",agentsContent:"",personaTone:"direct",personaLanguage:"zh-CN",personaSummaryStyle:"brief",focusRiskPreference:"conservative",reportPriorityPreset:"risk-first",summaryDebounceSeconds:qD},o6=[{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"}],Ys={builder:["🧠","🤖","🦾","🛠️","⚙️","🧩","🚀","🛰️","🔧","💡"],analyst:["🦉","🧭","🔍","📚","🧪","📐","🗂️","📝","🧮","📊"],direct:["🦅","🛡️","⚡","🎯","🪓","🧱","🔨","📌","🧰","🏹"],steady:["🐢","🐘","🦬","🦫","🌲","⛰️","🪨","🧺","🧷","🕰️"],friendly:["🐼","🦊","🐻","🐶","🐱","🐹","🐰","🦄","🌼","🍀"],default:["🧠","🤖","🦉","🧩","📚","💡","🛠️","🚀","🌟","🪄","🧭","🔮"]};function l6(){var We,Ye,mt,Je,Ke;const{workspaceId:e=""}=Po(),t=dr(),{showToast:r}=ir(),{requestNavigationRefresh:i,setAuxiliaryPanel:a}=gr(),u=p.useRef(null),c=p.useRef(null),[d,m]=p.useState(a6),[f,v]=p.useState(!1),[g,w]=p.useState(Rf),[y,x]=p.useState(!1),[C,j]=p.useState(0),[T,P]=p.useState([]),[I,Z]=p.useState([]),[q,B]=p.useState([]),[E,A]=p.useState(!1),[H,_]=p.useState(!1),[Y,z]=p.useState(null),[K,O]=p.useState(null),[F,te]=p.useState(!1),[de,W]=p.useState(null);(!u.current||c.current!==e)&&(u.current=new i6(e),c.current=e);const M=u.current,N=Jr(M,re=>re.loading),L=Jr(M,re=>re.sending),X=Jr(M,re=>re.switchingProvider),D=Jr(M,re=>re.initialized),be=Jr(M,re=>re.profile),ce=Jr(M,re=>re.activeProvider),le=Jr(M,re=>re.controlSession),ye=Jr(M,re=>re.capabilities),Se=Jr(M,re=>re.overview),_e=Jr(M,re=>re.events),Ce=Jr(M,re=>re.messages),Nt=Jr(M,re=>re.historyState),ct=Jr(M,re=>re.runtimeHasActiveRun),gt=Jr(M,re=>re.runtimeCanInterrupt),ft=Jr(M,re=>re.contextUsage),rt=Jr(M,re=>re.error),fe=((We=be==null?void 0:be.displayName)==null?void 0:We.trim())||d.displayName.trim()||o("shell.butlerEntry"),ue=p.useMemo(()=>P6({displayName:fe,providerId:(be==null?void 0:be.providerId)??d.providerId,tone:(be==null?void 0:be.persona.tone)??d.personaTone}),[fe,d.personaTone,d.providerId,be==null?void 0:be.persona.tone,be==null?void 0:be.providerId]),Oe=((mt=(Ye=le==null?void 0:le.session)==null?void 0:Ye.sessionId)==null?void 0:mt.trim())||null,qe=p.useMemo(()=>!Oe||!(le!=null&&le.session)?null:new UD(Oe,{initialSession:le.session}),[Oe]),nt=A6(qe),yt=qe?nt.messages:Ce,Me=qe?nt.historyState:Nt,Le=qe?nt.runtimeHasActiveRun:ct,pt=qe?nt.runtimeCanInterrupt:gt,ut=qe?nt.contextUsage:ft,we=qe?nt.loadingOlderMessages:!1,xe=qe?nt.hasOlderMessages:!1,Qe=p.useMemo(()=>I.slice(0,3),[I]),Fe=p.useMemo(()=>((Se==null?void 0:Se.projects)??[]).map(re=>re.id).sort(),[Se==null?void 0:Se.projects]),dt=p.useCallback(()=>{_(!0)},[]),It=p.useCallback(re=>{w(Pe=>({...Pe,...re}))},[]),qt=p.useCallback(async re=>{_(!1),z(re),O(null),W(null),te(!0);try{const Pe=await ST(re);O(Pe.task)}catch(Pe){W(Pe instanceof Error?Pe.message:o("shell.butlerAutomationRoundLoadFailed"))}finally{te(!1)}},[]),Ht=p.useCallback(async()=>{if(be){if(!g.displayName.trim()){r({title:o("shell.butlerInitNameRequired"),tone:"warning"});return}x(!0);try{await M.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:{...be.focus,riskPreference:g.focusRiskPreference,reportPriority:Hg[g.reportPriorityPreset],summaryDebounceSeconds:g.summaryDebounceSeconds}}),r({title:o("shell.butlerSettingsSaved"),tone:"success"})}catch(re){r({title:o("shell.butlerSettingsSaveFailed"),description:re instanceof Error?re.message:void 0,tone:"error"})}finally{x(!1)}}},[be,g,r,M]);p.useEffect(()=>{M.initialize()},[M]),p.useEffect(()=>{if(qe)return qe.initialize(),()=>{qe.destroy()}},[qe]),p.useEffect(()=>{!qe||!(le!=null&&le.session)||qe.applyNavigationSession(le.session)},[le==null?void 0:le.session,qe]),p.useEffect(()=>{rt&&r({title:o("shell.butlerLoadFailed"),description:rt,tone:"error"})},[rt,r]),p.useEffect(()=>{if(!be){w(Rf);return}w({displayName:be.displayName,agentsMode:be.agentsMode,agentsFilePath:j6(be),agentsContent:be.agentsContent,personaTone:be.persona.tone,personaLanguage:be.persona.language,personaSummaryStyle:be.persona.summaryStyle,focusRiskPreference:be.focus.riskPreference,reportPriorityPreset:C6(be.focus.reportPriority),summaryDebounceSeconds:be.focus.summaryDebounceSeconds??Rf.summaryDebounceSeconds})},[be]),p.useEffect(()=>{if(!D){P([]),Z([]),B([]);return}let re=!1;async function Pe(){try{const[an,$t,Bt]=await Promise.all([$c(),Vc(),Promise.all(Fe.map(_t=>xT(_t)))]);re||(P(an.items),Z($t.items),B(Bt.flatMap(_t=>_t.items)))}catch(an){if(re)return;P([]),Z([]),B([]),r({title:o("shell.butlerSidebarLoadFailed"),description:an instanceof Error?an.message:void 0,tone:"error"})}}Pe();function ot(){Pe()}const kt=window.setInterval(()=>{Pe()},15e3);return window.addEventListener(xo,ot),()=>{re=!0,window.clearInterval(kt),window.removeEventListener(xo,ot)}},[D,Fe,r]),p.useEffect(()=>dv(()=>{M.reloadEventsAndOverview()}),[M]);const Ft=p.useMemo(()=>[{value:"codex",label:"Codex"}],[]),Dt=p.useMemo(()=>[{value:"inline",label:o("shell.butlerAgentsModeInline")},{value:"file",label:o("shell.butlerAgentsModeFile")}],[]),bt=p.useMemo(()=>[{value:"direct",label:o("shell.butlerToneDirect")},{value:"steady",label:o("shell.butlerToneSteady")},{value:"friendly",label:o("shell.butlerToneFriendly")}],[]),Qt=p.useMemo(()=>[{value:"zh-CN",label:o("shell.butlerLanguageZhCn")},{value:"en-US",label:o("shell.butlerLanguageEnUs")},{value:"bilingual",label:o("shell.butlerLanguageBilingual")}],[]),zt=p.useMemo(()=>[{value:"brief",label:o("shell.butlerSummaryBrief")},{value:"structured",label:o("shell.butlerSummaryStructured")},{value:"thorough",label:o("shell.butlerSummaryThorough")}],[]),on=p.useMemo(()=>[{value:"conservative",label:o("shell.butlerRiskConservative")},{value:"balanced",label:o("shell.butlerRiskBalanced")},{value:"proactive",label:o("shell.butlerRiskProactive")}],[]),ae=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")}],[]),$e=Da(Ft,d.providerId),ht=Da(Dt,d.agentsMode),Wt=Da(bt,d.personaTone),jn=Da(Qt,d.personaLanguage),ln=Da(zt,d.personaSummaryStyle),Ut=Da(on,d.focusRiskPreference),dn=Da(ae,d.reportPriorityPreset),Jt=d.agentsMode==="inline"?o("shell.butlerAgentsModeInlineDescription"):o("shell.butlerAgentsModeFileDescription"),nn=[ht,jn,Ut],hn=p.useMemo(()=>n.jsx(c6,{overview:Se,events:_e,inboxItems:T,followUpTasks:I,patrolPlans:q,settingsForm:g,savingSettings:y,onOpenFollowUpHistory:dt,onOpenFollowUpDetail:qt,onSettingsFormChange:It,onSaveSettings:()=>{Ht()}}),[_e,dt,I,qt,Ht,It,T,Se,q,y,g]);p.useEffect(()=>{if(!D){a(null);return}return a(hn),()=>{a(null)}},[D,a,hn]);async function ee(re){re.preventDefault();const Pe=d.displayName.trim();if(!Pe){r({title:o("shell.butlerInitNameRequired"),tone:"warning"});return}const ot={displayName:Pe,providerId:d.providerId,agentsMode:d.agentsMode,persona:{tone:d.personaTone,language:d.personaLanguage,summaryStyle:d.personaSummaryStyle},focus:{projectIds:[],riskPreference:d.focusRiskPreference,reportPriority:Hg[d.reportPriorityPreset],summaryDebounceSeconds:qD}};v(!0);try{await M.initializeProfile(ot),r({title:o("shell.butlerInitSuccess"),tone:"success"})}catch(kt){r({title:o("shell.butlerInitFailed"),description:kt instanceof Error?kt.message:void 0,tone:"error"})}finally{v(!1)}}async function ne(re){if(re!==ce)try{await M.switchProvider(re),ve(re),r({title:o("shell.butlerProviderSwitched"),description:o("shell.butlerProviderSwitchedDescription",{provider:Da(Ft,re)}),tone:"success"})}catch(Pe){r({title:o("shell.butlerProviderSwitchFailed"),description:Pe instanceof Error?Pe.message:void 0,tone:"error"})}}async function pe(){try{ve(ce),await M.startFreshSession(),r({title:o("shell.butlerNewSessionStarted"),tone:"success"})}catch(re){r({title:o("shell.butlerNewSessionFailed"),description:re instanceof Error?re.message:void 0,tone:"error"})}}function ve(re){j(Pe=>Pe+1),t(ko(e),{replace:!0}),re&&i()}return N&&!D&&!f?n.jsx("main",{className:"workbench-page butler-page-shell butler-loading-shell",children:n.jsx(v6,{})}):D?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:()=>{A(!0)},onMouseLeave:()=>{A(!1)},children:[n.jsx("div",{className:"butler-chat-avatar","aria-hidden":"true",children:n.jsx("span",{children:ue})}),n.jsx("div",{className:"butler-main-heading",children:n.jsx("h1",{tabIndex:0,onFocus:()=>{A(!0)},onBlur:()=>{A(!1)},children:fe})}),E?n.jsxs("div",{className:"butler-header-analysis-popover",role:"status","aria-live":"polite",children:[n.jsx("strong",{children:o("conversation.butlerAnalysisTitle")}),Qe.length>0?Qe.map(re=>n.jsxs("div",{className:"butler-header-analysis-item",children:[n.jsxs("p",{children:[o("conversation.butlerAnalysisObjectiveLabel"),":",re.objective]}),n.jsxs("p",{children:[o("conversation.butlerAnalysisStatusLabel"),":",wu(re.status)]}),n.jsxs("p",{children:[o("conversation.butlerAnalysisSummaryLabel"),":",re.lastAutomationSummary||re.waitingReason||o("conversation.butlerAnalysisEmpty")]})]},re.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:ce,disabled:Ft.length<=1||X||L,onChange:re=>{ne(re.target.value)},children:Ft.map(re=>n.jsx("option",{value:re.value,children:re.label},re.value))})}),n.jsx("button",{type:"button",className:"terminal-tab-control butler-header-icon-button","aria-label":o("shell.butlerNewSessionAction"),title:o("shell.butlerNewSessionAction"),disabled:N||L||X,onClick:()=>{pe()},children:n.jsx("span",{className:"terminal-toolbar-icon","aria-hidden":"true",children:n.jsx(R6,{})})}),n.jsx("button",{type:"button",className:"terminal-tab-control butler-header-icon-button","aria-label":o("shell.butlerRefreshAction"),title:o("shell.butlerRefreshAction"),disabled:N||L||X,onClick:()=>{Promise.all([M.refreshAll(),$c().then(re=>P(re.items)),Vc().then(re=>Z(re.items))])},children:n.jsx("span",{className:"terminal-toolbar-icon","aria-hidden":"true",children:n.jsx(M6,{})})})]})]}),n.jsx("section",{className:"butler-main-column",children:n.jsxs("div",{className:"butler-conversation-shell",children:[n.jsx(uv,{sessionId:(Je=le==null?void 0:le.session)==null?void 0:Je.sessionId,messages:yt,historyState:Me,loadingOlderMessages:we,hasOlderMessages:xe,provider:ce,assistantAvatar:n.jsx("span",{className:"butler-message-avatar","aria-hidden":"true",children:ue}),onLoadOlderMessages:()=>{qe&&qe.loadOlderMessages()},onRetryMessage:re=>{const Pe=yt.find(ot=>ot.clientRequestId===re);if(Pe!=null&&Pe.content.trim()){M.sendMessage(Pe.content);return}M.retryMessage(re)}}),n.jsx("div",{className:"butler-composer-shell",children:n.jsx(Ub,{capabilities:ye,draftStorageId:`butler:${ce}:${C}`,placeholder:o("shell.butlerComposerPlaceholder",{displayName:fe}),hasActiveRun:Le,canInterrupt:pt,contextUsage:ut,isSubmitting:L||X,isRunning:Le??!1,onSend:async(re,Pe)=>{var ot;(((ot=Pe==null?void 0:Pe.attachments)==null?void 0:ot.length)??0)>0&&r({title:o("shell.butlerAttachmentUnsupported"),tone:"warning"}),await M.sendMessage(re,{model:(Pe==null?void 0:Pe.model)??null,reasoningLevel:(Pe==null?void 0:Pe.reasoningLevel)??null,permissionMode:null}),i()}})})]},`timeline:${ce}:${C}`)})]}),n.jsx(Hn,{open:H,title:o("shell.butlerFollowUpHistoryTitle"),description:o("shell.butlerFollowUpHistoryDescription"),onClose:()=>{_(!1)},children:n.jsx(p6,{tasks:I,onOpenFollowUpDetail:qt,onClose:()=>{_(!1)}})}),n.jsx(Hn,{open:Y!==null,title:o("shell.butlerAutomationRoundDetailsTitle"),description:((Ke=K==null?void 0:K.sessionTitle)==null?void 0:Ke.trim())||(K==null?void 0:K.projectName)||o("shell.butlerAutomationRoundDetailsDescription"),onClose:()=>{z(null),O(null),W(null),te(!1)},children:n.jsx(k6,{task:K,loading:F,error:de})})]}):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:ue})}),n.jsx("strong",{children:fe})]}),n.jsx("span",{className:"butler-init-preview-provider",children:$e})]}),n.jsx("div",{className:"butler-init-chip-list",children:nn.map(re=>n.jsx("span",{className:"butler-init-chip",children:re},re))}),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:Wt})]}),n.jsxs("div",{className:"butler-init-preview-row",children:[n.jsx("span",{children:o("shell.butlerInitPreviewRuleLabel")}),n.jsx("strong",{children:ht})]}),n.jsxs("div",{className:"butler-init-preview-row",children:[n.jsx("span",{children:o("shell.butlerPersonaSummaryStyleLabel")}),n.jsx("strong",{children:ln})]}),n.jsxs("div",{className:"butler-init-preview-row",children:[n.jsx("span",{children:o("shell.butlerReportPriorityPresetLabel")}),n.jsx("strong",{children:dn})]})]})]})]}),n.jsxs("form",{className:"butler-init-form",onSubmit:ee,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:re=>m(Pe=>({...Pe,displayName:re.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:Ft.length<=1,onChange:re=>m(Pe=>({...Pe,providerId:re.target.value})),children:Ft.map(re=>n.jsx("option",{value:re.value,children:re.label},re.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:re=>m(Pe=>({...Pe,agentsMode:re.target.value})),children:Dt.map(re=>n.jsx("option",{value:re.value,children:re.label},re.value))}),n.jsx("small",{children:Jt})]})]})]}),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:re=>m(Pe=>({...Pe,personaTone:re.target.value})),children:bt.map(re=>n.jsx("option",{value:re.value,children:re.label},re.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:re=>m(Pe=>({...Pe,personaLanguage:re.target.value})),children:Qt.map(re=>n.jsx("option",{value:re.value,children:re.label},re.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:re=>m(Pe=>({...Pe,personaSummaryStyle:re.target.value})),children:zt.map(re=>n.jsx("option",{value:re.value,children:re.label},re.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:re=>m(Pe=>({...Pe,focusRiskPreference:re.target.value})),children:on.map(re=>n.jsx("option",{value:re.value,children:re.label},re.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:re=>m(Pe=>({...Pe,reportPriorityPreset:re.target.value})),children:ae.map(re=>n.jsx("option",{value:re.value,children:re.label},re.value))})]})]})]}),n.jsx("div",{className:"butler-init-actions",children:n.jsx("button",{className:"butler-init-submit",type:"submit",disabled:N||f,children:o(N||f?"shell.butlerInitSubmitting":"shell.butlerInitSubmit")})})]})]})]})}function c6(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(u6,{overview:e.overview,inboxItems:e.inboxItems,followUpTasks:e.followUpTasks,onOpenFollowUpHistory:e.onOpenFollowUpHistory,onOpenFollowUpDetail:e.onOpenFollowUpDetail}):t==="automation"?n.jsx(d6,{overview:e.overview,followUpTasks:e.followUpTasks,patrolPlans:e.patrolPlans}):n.jsx(b6,{settingsForm:e.settingsForm,savingSettings:e.savingSettings,onSettingsFormChange:e.onSettingsFormChange,onSaveSettings:e.onSaveSettings})]})}function u6(e){var i;const t=p.useMemo(()=>{var a;return x6(((a=e.overview)==null?void 0:a.verifications)??[])},[(i=e.overview)==null?void 0:i.verifications]),r=p.useMemo(()=>S6(e.inboxItems),[e.inboxItems]);return n.jsxs(n.Fragment,{children:[n.jsx(m6,{tasks:e.followUpTasks,onOpenFollowUpHistory:e.onOpenFollowUpHistory,onOpenFollowUpDetail:e.onOpenFollowUpDetail}),n.jsx(ZS,{title:o("shell.butlerInfoVerificationRecordsTitle"),items:t,emptyText:o("shell.butlerInfoVerificationRecordsEmpty")}),n.jsx(ZS,{title:o("shell.butlerInfoTodoRecordsTitle"),items:r,emptyText:o("shell.butlerInfoTodoRecordsEmpty")})]})}function d6(e){const t=p.useMemo(()=>w6(e.patrolPlans,e.followUpTasks,e.overview),[e.followUpTasks,e.overview,e.patrolPlans]),r=p.useMemo(()=>y6(e.followUpTasks,e.overview),[e.followUpTasks,e.overview]);return n.jsxs(n.Fragment,{children:[n.jsx(f6,{items:t,emptyText:o("shell.butlerAutomationTasksEmpty")}),n.jsx(g6,{items:r,emptyText:o("shell.butlerAutomationRunsEmpty")})]})}function ZS(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(h6,{title:t.title,content:t.content},`${t.title}:${t.content}`))}):n.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function h6(e){return n.jsxs("div",{className:"butler-simple-info-block",children:[n.jsx("span",{children:e.title}),n.jsx("strong",{children:e.content})]})}function m6(e){const t=p.useMemo(()=>[...e.tasks].sort((r,i)=>yi(Zc(i))-yi(Zc(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($D,{task:r,onOpenFollowUpDetail:e.onOpenFollowUpDetail},r.id))}):n.jsx("p",{className:"butler-secondary-text",children:o("shell.butlerInfoFollowUpRecordsEmpty")})]})}function p6(e){const t=p.useMemo(()=>[...e.tasks].sort((r,i)=>yi(Zc(i))-yi(Zc(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($D,{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 $D(e){var a,u,c;const{task:t}=e,r=((a=t.sessionTitle)==null?void 0:a.trim())||t.projectName,i=((u=t.waitingReason)==null?void 0:u.trim())||((c=t.lastAutomationSummary)==null?void 0:c.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:wu(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:Tl(Zc(t))}),n.jsx("button",{type:"button",className:"secondary-button butler-follow-up-status-action",onClick:()=>{e.onOpenFollowUpDetail(t.id)},children:o("shell.butlerAutomationViewRoundsAction")})]})]})}function f6(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:Tl(t.lastRunAt)})]})]}),n.jsxs("footer",{className:"butler-automation-card-footer",children:[n.jsx("span",{children:o("shell.butlerAutomationTaskNextRunLabel")}),n.jsx("strong",{children:Tl(t.nextRunAt)})]})]},t.id))}):n.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function g6(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:Tl(t.createdAt)})]})]},t.id))}):n.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function b6(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:o6.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 v6(){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 Tl(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 Zc(e){return e.updatedAt||e.lastAutomationAt||e.lastCheckedAt||e.createdAt}function w6(e,t,r){const i=new Map(((r==null?void 0:r.projects)??[]).map(c=>[c.id,c.name])),a=e.map(c=>({id:`patrol-plan:${c.id}`,title:c.name,projectName:i.get(c.projectId)??c.projectId,taskTypeLabel:tC("patrol_plan",c.triggerType),statusLabel:c.enabled?o("shell.butlerAutomationTaskEnabled"):o("shell.butlerAutomationTaskDisabled"),nextRunAt:c.nextRunAt,lastRunAt:c.lastScheduledAt})),u=t.map(c=>{var d;return{id:`follow-up:${c.id}`,title:((d=c.sessionTitle)==null?void 0:d.trim())||c.projectName,projectName:c.projectName,taskTypeLabel:tC("follow_up"),statusLabel:wu(c.status),nextRunAt:c.nextCheckAt,lastRunAt:c.lastAutomationAt||c.lastCheckedAt||c.updatedAt}});return[...a,...u].sort((c,d)=>{const m=yi(c.nextRunAt),f=yi(d.nextRunAt);return m!==f?m===0?1:f===0?-1:m-f:yi(d.lastRunAt)-yi(c.lastRunAt)}).slice(0,10)}function y6(e,t){const r=new Map(((t==null?void 0:t.projects)??[]).map(u=>[u.id,u.name])),i=((t==null?void 0:t.patrols)??[]).map(u=>{var c;return{id:`patrol-run:${u.id}`,title:o("shell.butlerAutomationPatrolRunTitle"),projectName:r.get(u.projectId)??u.projectId,sourceLabel:nC("patrol_run"),statusLabel:u.status,summary:((c=u.summary)==null?void 0:c.trim())||o("shell.butlerAutomationRunEmptySummary"),createdAt:u.finishedAt||u.startedAt||u.createdAt}}),a=e.flatMap(u=>(u.rounds??[]).map(c=>{var d,m;return{id:`follow-up-round:${u.id}:${c.roundNumber}`,title:`${((d=u.sessionTitle)==null?void 0:d.trim())||u.projectName} · ${o("shell.butlerAutomationRoundLabel",{round:c.roundNumber})}`,projectName:u.projectName,sourceLabel:nC("follow_up_round"),statusLabel:wu(c.status),summary:((m=c.summary)==null?void 0:m.trim())||o("shell.butlerAutomationRunEmptySummary"),createdAt:c.createdAt}}));return[...i,...a].sort((u,c)=>yi(c.createdAt)-yi(u.createdAt)).slice(0,12)}function k6(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)=>yi(i.createdAt)-yi(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:T6(r.kind)})]}),n.jsx("span",{children:Tl(r.createdAt)})]}),n.jsxs("div",{className:"butler-follow-up-round-body",children:[n.jsxs("p",{children:[o("shell.butlerAutomationRoundProcessedAtLabel"),":",Tl(r.createdAt)]}),n.jsxs("p",{children:[o("shell.butlerAutomationRoundStatusLabel"),":",wu(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 x6(e){return[...e].sort((t,r)=>yi(eC(r))-yi(eC(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 S6(e){return e.slice(0,5).map(t=>({title:t.title,content:`${t.projectName} · ${N6(t.status)}`}))}function eC(e){return e.finishedAt||e.startedAt||e.createdAt}function yi(e){if(!e)return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function C6(e){for(const[t,r]of Object.entries(Hg))if(r.length===e.length&&r.every((i,a)=>i===e[a]))return t;return"risk-first"}function j6(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 N6(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 wu(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 T6(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 tC(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 nC(e){return o(e==="patrol_run"?"shell.butlerAutomationRunSourcePatrol":"shell.butlerAutomationRunSourceFollowUp")}function P6(e){const r=`${e.displayName.trim()}:${e.providerId}:${e.tone}`,i=D6(e);if(!r)return Ys.default[0];const a=Array.from(r).reduce((u,c)=>{const d=c.codePointAt(0)??0;return u+d},0);return i[a%i.length]}function D6(e){const t=e.displayName.trim().toLowerCase();return/(bot|ai|智能|助手|助理|管家|buddy|helper)/.test(t)?Ys.builder:/(书|学|知|研|析|查|review|audit|scan)/.test(t)?Ys.analyst:e.tone==="friendly"?Ys.friendly:e.tone==="steady"?Ys.steady:e.tone==="direct"?e.providerId==="claude-code"?Ys.analyst:Ys.direct:e.providerId==="claude-code"?Ys.analyst:Ys.default}function Da(e,t){var r;return((r=e.find(i=>i.value===t))==null?void 0:r.label)??t}function R6(){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 M6(){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 A6(e){const[t,r]=p.useState(()=>rC());return p.useEffect(()=>{if(!e){r(rC());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 rC(){return{messages:[],historyState:"ready",loadingOlderMessages:!1,hasOlderMessages:!1,runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null}}function VD({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 Ro({currentWorkspace:e,workspaces:t,workspaceOptions:r,onSelectWorkspace:i,className:a,containerRef:u,heading:c,content:d,sheetContent:m,triggerLabel:f,triggerAriaLabel:v,onTriggerClick:g,trailing:w,gestureHandlers:y}){const[x,C]=p.useState(!1),j=ts(),T=r??t.map(P=>({workspace:P,label:P.name,subtitle:P.path,depth:0,kind:"workspace",meta:null}));return e?n.jsxs(n.Fragment,{children:[n.jsx(VD,{className:a,frameRef:u,...y,children:n.jsxs("section",{className:"mobile-workspace-home-header",children:[n.jsx("h1",{className:"mobile-workspace-switcher-heading",children:c??e.name}),n.jsxs("div",{className:"mobile-workspace-home-toolbar-top",children:[n.jsxs("button",{type:"button",className:"mobile-workspace-home-switcher","aria-label":v??o("shell.workspaceHomeSwitcherLabel"),onClick:()=>{if(g){g();return}j.trigger("selection"),C(!0)},children:[n.jsx("span",{className:"mobile-workspace-home-switcher-label",children:f??e.name}),n.jsx(L6,{})]}),n.jsx("div",{className:"mobile-workspace-home-toolbar-actions",children:w})]}),n.jsx("p",{className:"mobile-workspace-home-path",children:e.path}),d]})}),x&&!g?E6(n.jsxs(I6,{title:o("shell.workspaceHomeSwitcherTitle"),onClose:()=>C(!1),children:[n.jsx("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:T.map(P=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row","data-worktree-kind":P.kind,"data-worktree-depth":P.depth,onClick:()=>{P.workspace.id!==e.id&&(j.trigger("selection"),i==null||i(P.workspace.id)),C(!1)},children:[n.jsxs("div",{className:"mobile-workspace-home-session-main",style:{"--mobile-workspace-tree-depth":String(P.depth)},children:[n.jsxs("span",{className:"mobile-workspace-home-session-title",children:[P.kind==="worktree"?n.jsx("span",{className:"mobile-workspace-home-worktree-badge",children:o("shell.mobileWorktreeBadge")}):null,P.label]}),n.jsx("span",{className:"mobile-workspace-home-session-meta",children:P.subtitle})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:P.workspace.id===e.id?n.jsx(_6,{}):n.jsx(F6,{})})]},P.workspace.id))}),m?m(()=>C(!1)):null]})):null]}):null}function E6(e){return typeof document>"u"?null:Xn.createPortal(e,document.body)}function I6({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 L6(){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 F6(){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 _6(){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 O6(e){return e.status==="active"}function B6(e){return e.status==="queued"||e.status==="running"}function GD(e,t){return e.filter(O6).length+t.filter(B6).length}const KD="mobile.butler.active-tab",lh=["info","automation"],W6=15e3,U6=56,H6=1.2;function z6(){if(typeof window>"u")return"info";try{return window.localStorage.getItem(KD)==="automation"?"automation":"info"}catch{return"info"}}function q6(e,t){return e==="automation"?"automation":e==="info"?"info":t}function $6(e,t,r){if(!t)return e;const i=r.x-t.x,a=r.y-t.y;if(Math.abs(i)<U6||Math.abs(i)<Math.abs(a)*H6)return e;const u=lh.indexOf(e),c=i<0?Math.min(lh.length-1,u+1):Math.max(0,u-1);return lh[c]??e}function V6(){var _,Y,z,K;const{workspaceId:e=""}=Po(),t=es(),r=dr(),{showToast:i}=ir(),{navigationGroups:a,selectWorkspace:u}=gr(),c=((_=a.find(O=>O.workspace.id===e))==null?void 0:_.workspace)??null,d=new URLSearchParams(t.search).get("tab"),m=p.useRef(z6()),f=q6(d,m.current),v=p.useRef(null),[g,w]=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(KD,f)}catch{}},[f]),p.useEffect(()=>{if(d===f)return;const O=new URLSearchParams(t.search);O.set("tab",f),r({pathname:t.pathname,search:`?${O.toString()}`},{replace:!0})},[f,t.pathname,t.search,r,d]),p.useEffect(()=>{e&&u(e)},[u,e]),p.useEffect(()=>{if(!e){w({loading:!1,initialized:!1,profile:null,overview:null,followUpTasks:[],inboxItems:[],patrolPlans:[]});return}let O=!1;async function F(M){w(N=>({...N,loading:!0}));try{const N=await Qh();if(!N.initialized||!N.profile){O||w({loading:!1,initialized:!1,profile:null,overview:null,followUpTasks:[],inboxItems:[],patrolPlans:[]});return}const[L,X,D]=await Promise.all([Jh(),Vc(),$c({workspaceId:e})]),be=L.overview.projects.filter(le=>le.workspaceId===e).map(le=>le.id),ce=await Promise.all(be.map(le=>xT(le)));if(O)return;w({loading:!1,initialized:!0,profile:N.profile,overview:L.overview,followUpTasks:X.items.filter(le=>le.workspaceId===e),inboxItems:D.items.filter(le=>le.status!=="closed"),patrolPlans:ce.flatMap(le=>le.items)})}catch(N){if(O)return;w(L=>({...L,loading:!1})),M&&i({title:o("shell.butlerLoadFailed"),description:N instanceof Error?N.message:void 0,tone:"error"})}}F(!0);const te=window.setInterval(()=>{F(!1)},W6),de=dv(()=>{F(!1)}),W=()=>{F(!1)};return window.addEventListener(xo,W),()=>{O=!0,window.clearInterval(te),de(),window.removeEventListener(xo,W)}},[i,e]);const y=p.useMemo(()=>{var O;return new Set((((O=g.overview)==null?void 0:O.projects)??[]).filter(F=>F.workspaceId===e).map(F=>F.id))},[(Y=g.overview)==null?void 0:Y.projects,e]),x=p.useMemo(()=>{var O;return(((O=g.overview)==null?void 0:O.projects)??[]).filter(F=>F.workspaceId===e)},[(z=g.overview)==null?void 0:z.projects,e]),C=p.useMemo(()=>g.followUpTasks.filter(O=>O.status==="waiting_user").length,[g.followUpTasks]),j=p.useMemo(()=>{var O;return(((O=g.overview)==null?void 0:O.verifications)??[]).filter(F=>F.projectId?y.has(F.projectId):!1)},[(K=g.overview)==null?void 0:K.verifications,y]),T=p.useMemo(()=>GD(g.followUpTasks,j),[g.followUpTasks,j]),P=p.useMemo(()=>[...g.followUpTasks].sort((O,F)=>Rs(Mf(F))-Rs(Mf(O))).slice(0,4),[g.followUpTasks]),I=p.useMemo(()=>G6(j),[j]),Z=p.useMemo(()=>K6(g.inboxItems).slice(0,4),[g.inboxItems]),q=p.useMemo(()=>Y6(g.patrolPlans,g.followUpTasks,g.overview,y),[g.followUpTasks,g.overview,g.patrolPlans,y]),B=p.useMemo(()=>X6(g.followUpTasks,g.overview,y),[g.followUpTasks,g.overview,y]);function E(O){O!==f&&r(ko(e,O),{replace:!0})}function A(O){if(O.changedTouches.length!==1){v.current=null;return}const F=O.changedTouches[0];v.current={x:F.clientX,y:F.clientY}}function H(O){const F=v.current;if(v.current=null,O.changedTouches.length!==1)return;const te=O.changedTouches[0],de=$6(f,F,{x:te.clientX,y:te.clientY});de!==f&&E(de)}return c?n.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-butler-page",children:[n.jsx(Ro,{currentWorkspace:c,workspaces:a.map(O=>O.workspace),heading:o("shell.mobileButlerEntry"),triggerLabel:c.name,onSelectWorkspace:O=>{u(O),r(ko(O,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:lh.map(O=>{const F=f===O,te=o(O==="info"?"shell.butlerSidebarInfoTab":"shell.butlerSidebarAutomationTab");return n.jsx("button",{type:"button",role:"tab",className:"mobile-butler-segmented-button","aria-selected":F,onClick:()=>{E(O)},children:te},O)})})})}),n.jsx("div",{className:"mobile-page-top-body mobile-butler-body",onTouchStart:A,onTouchEnd:H,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:J6(g.profile.providerId)})]})]}),n.jsxs("div",{className:"mobile-butler-hero-grid",children:[n.jsx(Id,{label:o("shell.mobileButlerAssistantWorkspaceLabel"),value:g.profile.workspacePath}),n.jsx(Id,{label:o("shell.mobileButlerAssistantToneLabel"),value:Z6(g.profile.persona.tone)}),n.jsx(Id,{label:o("shell.mobileButlerAssistantLanguageLabel"),value:e3(g.profile.persona.language)}),n.jsx(Id,{label:o("shell.mobileButlerAssistantUpdatedAtLabel"),value:Fd(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(Ld,{label:o("shell.mobileButlerSummaryProjects"),value:x.length}),n.jsx(Ld,{label:o("shell.mobileButlerSummaryFollowUps"),value:T}),n.jsx(Ld,{label:o("shell.mobileButlerSummaryWaitingUser"),value:C}),n.jsx(Ld,{label:o("shell.mobileButlerSummaryInbox"),value:g.inboxItems.length})]})]}),n.jsx(vc,{title:o("shell.butlerInfoFollowUpRecordsTitle"),emptyText:o("shell.butlerInfoFollowUpRecordsEmpty"),items:P.map(O=>{var F,te,de;return{id:O.id,title:((F=O.sessionTitle)==null?void 0:F.trim())||O.projectName,subtitle:O.projectName,status:hv(O.status),content:((te=O.waitingReason)==null?void 0:te.trim())||((de=O.lastAutomationSummary)==null?void 0:de.trim())||O.objective,meta:Fd(Mf(O))}})}),n.jsx(vc,{title:o("shell.butlerInfoVerificationRecordsTitle"),emptyText:o("shell.butlerInfoVerificationRecordsEmpty"),items:I.map((O,F)=>({id:`${O.title}:${F}`,title:O.title,subtitle:null,status:null,content:O.content,meta:null}))}),n.jsx(vc,{title:o("shell.butlerInfoTodoRecordsTitle"),emptyText:o("shell.butlerInfoTodoRecordsEmpty"),items:Z.map((O,F)=>({id:`${O.title}:${F}`,title:O.title,subtitle:null,status:null,content:O.content,meta:null}))})]}):n.jsxs(n.Fragment,{children:[n.jsx(vc,{title:o("shell.butlerAutomationTasksTitle"),emptyText:o("shell.butlerAutomationTasksEmpty"),items:q.map(O=>({id:O.id,title:O.title,subtitle:O.projectName,status:O.statusLabel,content:`${o("shell.butlerAutomationTaskTypeLabel")} · ${O.taskTypeLabel}`,meta:`${o("shell.butlerAutomationTaskNextRunLabel")} · ${Fd(O.nextRunAt)}`}))}),n.jsx(vc,{title:o("shell.butlerAutomationRunsTitle"),emptyText:o("shell.butlerAutomationRunsEmpty"),items:B.map(O=>({id:O.id,title:O.title,subtitle:O.projectName,status:O.statusLabel,content:`${O.sourceLabel} · ${O.summary}`,meta:Fd(O.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 Id({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 Ld({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 G6(e){return[...e].sort((t,r)=>Rs(aC(r))-Rs(aC(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 K6(e){return e.map(t=>({title:t.title,content:`${t.projectName} · ${Q6(t.status)}`}))}function Y6(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])),u=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:iC("patrol_plan",d.triggerType),statusLabel:d.enabled?o("shell.butlerAutomationTaskEnabled"):o("shell.butlerAutomationTaskDisabled"),nextRunAt:d.nextRunAt,lastRunAt:d.lastScheduledAt})),c=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:iC("follow_up"),statusLabel:hv(d.status),nextRunAt:d.nextCheckAt,lastRunAt:d.lastAutomationAt||d.lastCheckedAt||d.updatedAt}});return[...u,...c].sort((d,m)=>{const f=Rs(d.nextRunAt),v=Rs(m.nextRunAt);return f!==v?f===0?1:v===0?-1:f-v:Rs(m.lastRunAt)-Rs(d.lastRunAt)}).slice(0,8)}function X6(e,t,r){const i=new Map(((t==null?void 0:t.projects)??[]).filter(c=>r.has(c.id)).map(c=>[c.id,c.name])),a=((t==null?void 0:t.patrols)??[]).filter(c=>r.has(c.projectId)).map(c=>{var d;return{id:`patrol-run:${c.id}`,title:o("shell.butlerAutomationPatrolRunTitle"),projectName:i.get(c.projectId)??c.projectId,sourceLabel:sC("patrol_run"),statusLabel:c.status,summary:((d=c.summary)==null?void 0:d.trim())||o("shell.butlerAutomationRunEmptySummary"),createdAt:c.finishedAt||c.startedAt||c.createdAt}}),u=e.flatMap(c=>(c.rounds??[]).map(d=>{var m,f;return{id:`follow-up-round:${c.id}:${d.roundNumber}`,title:`${((m=c.sessionTitle)==null?void 0:m.trim())||c.projectName} · ${o("shell.butlerAutomationRoundLabel",{round:d.roundNumber})}`,projectName:c.projectName,sourceLabel:sC("follow_up_round"),statusLabel:hv(d.status),summary:((f=d.summary)==null?void 0:f.trim())||o("shell.butlerAutomationRunEmptySummary"),createdAt:d.createdAt}}));return[...a,...u].sort((c,d)=>Rs(d.createdAt)-Rs(c.createdAt)).slice(0,10)}function Q6(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 Mf(e){return e.updatedAt||e.lastAutomationAt||e.lastCheckedAt||e.createdAt}function hv(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 iC(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 sC(e){return o(e==="patrol_run"?"shell.butlerAutomationRunSourcePatrol":"shell.butlerAutomationRunSourceFollowUp")}function aC(e){return e.finishedAt||e.startedAt||e.createdAt}function Rs(e){if(!e)return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function Fd(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 J6(e){switch(e){case"claude-code":return"Claude Code";case"codex":default:return"Codex"}}function Z6(e){switch(e){case"friendly":return o("shell.butlerToneFriendly");case"steady":return o("shell.butlerToneSteady");case"direct":default:return o("shell.butlerToneDirect")}}function e3(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 t3(){const{shellMode:e}=gr();return e==="mobile"?n.jsx(V6,{}):n.jsx(l6,{})}function YD({connectionState:e,onReconnect:t}){const{showToast:r,dismissToast:i}=ir();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 _d="provider-default",n3=420,r3=520,i3=32;function s3(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 a3(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(!s3(e))throw new Error(o("conversation.copyContentFailed"))}}function Od(e,t,r){return Math.min(Math.max(e,t),r)}function Af(e){return e&&Mc.includes(e)?e:"codex"}function zg(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function oC(e){var r,i;const t=zg(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 o3(e,t){return[t.trim()||o("conversation.selectionActionDefaultPrompt"),"",o("conversation.selectionActionQuotedLabel"),"```text",e.trim(),"```"].join(`
|
|
107
|
+
`)}function l3({containerRef:e,session:t,currentCapabilities:r}){const i=dr(),a=cr(),{showToast:u}=ir(),{shellMode:c,requestNavigationRefresh:d,selectWorkspace:m,upsertNavigationSession:f}=gr(),v=To(ue=>ue.profile.providers),[g,w]=p.useState(null),[y,x]=p.useState(!1),[C,j]=p.useState(""),[T,P]=p.useState(!1),[I,Z]=p.useState(Af(t==null?void 0:t.provider)),[q,B]=p.useState(_d),[E,A]=p.useState(null),[H,_]=p.useState({}),[Y,z]=p.useState(!1),[K,O]=p.useState(!1),[F,te]=p.useState(!1),[de,W]=p.useState(0),[M,N]=p.useState(null),[L,X]=p.useState(()=>({width:typeof window>"u"?0:window.innerWidth,height:typeof window>"u"?0:window.innerHeight})),D=p.useRef(!1),be=c==="mobile"||a.isMobile,ce=p.useMemo(()=>ue=>{var Oe,qe;return((qe=(Oe=v[ue])==null?void 0:Oe.defaultModel)==null?void 0:qe.trim())||_d},[v]),le=p.useMemo(()=>I===(t==null?void 0:t.provider)&&r?r:E??Fa(I),[r,E,I,t==null?void 0:t.provider]),ye=p.useMemo(()=>{var Oe;const ue=Fa(I).modelOptions??[];return(Oe=le.modelOptions)!=null&&Oe.length?le.modelOptions:ue},[le.modelOptions,I]),Se=p.useMemo(()=>ye.find(ue=>ue.id===q)??ye[0]??null,[ye,q]),_e=p.useMemo(()=>{const ue=H[I]??(I===(t==null?void 0:t.provider)?r:E);return!ue||ue.canStartSession!==!1?null:ue.limitations[0]??o("conversation.capabilityDenied")},[r,E,H,I,t==null?void 0:t.provider]),Ce=p.useMemo(()=>{var Le;if(!g||typeof window>"u")return null;const ue=(Le=e.current)==null?void 0:Le.getBoundingClientRect(),Oe=ue?Math.max(80,ue.left+80):96,qe=ue?Math.min(L.width-80,ue.right-80):L.width-96,nt=ue?Math.max(12,ue.top+12):12,yt=ue?Math.max(nt,ue.bottom-48):Math.max(12,L.height-48),Me=g.rect.left+g.rect.width/2;return{left:Od(Me,Oe,Math.max(Oe,qe)),top:Od(g.rect.top-48,nt,yt)}},[e,g,L.height,L.width]),Nt=p.useMemo(()=>{var It;if(!g||typeof window>"u")return null;const ue=(It=e.current)==null?void 0:It.getBoundingClientRect(),Oe=(ue==null?void 0:ue.left)??0,qe=(ue==null?void 0:ue.right)??L.width,nt=(ue==null?void 0:ue.top)??0,yt=(ue==null?void 0:ue.bottom)??L.height;if(be)return{left:L.width/2,top:L.height/2,width:Math.min(420,Math.max(280,L.width-24)),maxHeight:Math.max(260,L.height-i3),transform:"translate(-50%, -50%)"};const Me=Math.max(280,Math.min(L.width-24,qe-Oe-24)),Le=Math.min(420,Me),pt=g.rect.left+g.rect.width/2,ut=Math.max(12,Oe+12),we=Math.max(ut,Math.min(L.width-Le-12,qe-Le-12)),xe=Math.min(r3,Math.max(280,yt-nt-24),Math.max(280,L.height-24)),Qe=Math.max(12,nt+12),Fe=Math.max(Qe,Math.min(L.height-xe-12,yt-xe-12)),dt=g.rect.top-n3-18;return{left:Od(pt-Le/2,ut,we),top:Od(dt,Qe,Fe),width:Le,maxHeight:xe}},[e,be,g,L.height,L.width]);p.useEffect(()=>{if(typeof window>"u")return;const ue=()=>{X({width:window.innerWidth,height:window.innerHeight})};return ue(),window.addEventListener("resize",ue),()=>{window.removeEventListener("resize",ue)}},[]),p.useEffect(()=>{if(!t){w(null),x(!1);return}const ue=Af(t.provider);Z(ue),B(ce(ue))},[ce,t]),p.useEffect(()=>{if(!t||!e.current||typeof window>"u"){w(null);return}const ue=e.current,Oe=()=>{if(D.current)return;const nt=window.getSelection();if(!nt||nt.rangeCount===0||nt.isCollapsed){w(null);return}const yt=nt.getRangeAt(0),Me=zg(yt.startContainer),Le=zg(yt.endContainer);if(!Me||!Le||!ue.contains(Me)||!ue.contains(Le)){w(null);return}const pt=nt.toString().trim();if(!pt){w(null);return}const ut=yt.getBoundingClientRect();if(!ut.width&&!ut.height){w(null);return}const we=oC(yt.startContainer),xe=oC(yt.endContainer);w({text:pt,sourceMessageId:we&&we===xe?we:null,rect:{left:ut.left,top:ut.top,right:ut.right,bottom:ut.bottom,width:ut.width,height:ut.height}})},qe=()=>{D.current||(w(null),x(!1))};return document.addEventListener("selectionchange",Oe),window.addEventListener("resize",qe),window.addEventListener("scroll",qe,!0),()=>{document.removeEventListener("selectionchange",Oe),window.removeEventListener("resize",qe),window.removeEventListener("scroll",qe,!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 ue=!1;return I===t.provider&&r?(z(!1),A(r),()=>{ue=!0}):(z(!0),A(Fa(I)),Al(I,t.workspaceId).then(Oe=>{ue||A(Oe)}).catch(()=>{ue||A(Fa(I))}).finally(()=>{ue||z(!1)}),()=>{ue=!0})},[y,r,I,t]),p.useEffect(()=>{if(!y||!t){_({});return}let ue=!1;return Ab(Mc,t.workspaceId).then(Oe=>{ue||_(Oe)}),()=>{ue=!0}},[y,t]),p.useEffect(()=>{if(!y||!t)return;const ue=Mc.filter(qe=>{const nt=H[qe];return!nt||nt.canStartSession!==!1});if(ue.length===0||ue.includes(I))return;const Oe=ue[0];Z(Oe),B(ce(Oe))},[y,ce,H,I,t]),p.useEffect(()=>{var Oe;const ue=ce(I);if(!ye.some(qe=>qe.id===q)){if(ye.some(qe=>qe.id===ue)){B(ue);return}B(((Oe=ye[0])==null?void 0:Oe.id)??_d)}},[ye,ce,q,I]),p.useEffect(()=>{if(!y){D.current=!1;return}D.current=!0},[y]),p.useEffect(()=>{if(typeof window>"u")return;const ue=Oe=>{Oe.key==="Escape"&&(x(!1),w(null),D.current=!1)};return window.addEventListener("keydown",ue),()=>{window.removeEventListener("keydown",ue)}},[]);async function ct(){if(g)try{await a3(g.text,a),u({title:o("conversation.copyContentSuccess"),tone:"success"})}catch(ue){u({title:ue instanceof Error?ue.message:o("conversation.copyContentFailed"),tone:"error"})}}function gt(){g&&(N({title:"",content:g.text}),W(ue=>ue+1),te(!0),x(!1),w(null),D.current=!1)}function ft(){if(!g||!t)return;const ue=Af(t.provider);Z(ue),B(ce(ue)),j(""),P(!1),x(!0)}async function rt(){var ue,Oe,qe,nt;if(!(!g||!t)){if(_e){u({title:_e,tone:"error"});return}O(!0);try{const yt=o3(g.text,C),Me=(Se==null?void 0:Se.id)===_d?null:(Se==null?void 0:Se.id)??null;let Le=null;if(T&&g.sourceMessageId)Le=await rT(t.sessionId,{sourceType:"message",sourceMessageId:g.sourceMessageId,strategy:"auto",targetProvider:I,sessionKind:"annotation",annotationSourceMessageId:g.sourceMessageId,annotationSourceText:g.text}),f(Le),await Ib(Le.sessionId,{content:yt,clientRequestId:((Oe=(ue=globalThis.crypto)==null?void 0:ue.randomUUID)==null?void 0:Oe.call(ue))??`selection-action-${Date.now()}-${Math.random().toString(16).slice(2)}`,model:Me});else{const pt=await iT({workspaceId:t.workspaceId,provider:I,content:yt,clientRequestId:((nt=(qe=globalThis.crypto)==null?void 0:qe.randomUUID)==null?void 0:nt.call(qe))??`selection-action-${Date.now()}-${Math.random().toString(16).slice(2)}`,model:Me,parentSessionId:t.sessionId,sessionKind:"annotation",annotationSourceMessageId:g.sourceMessageId??null,annotationSourceText:g.text});Le=pt.session??await ZN(pt.sessionId)}f(Le),d(),m(Le.workspaceId),i(fr(Le.workspaceId,Le.sessionId)),x(!1),w(null),D.current=!1}catch(yt){u({title:yt instanceof Error?yt.message:o("conversation.selectionActionFailed"),tone:"error"})}finally{O(!1)}}}function fe(ue=!1){x(!1),D.current=!1,ue&&w(null)}return!t||!g||!Ce||typeof document>"u"?n.jsx(yg,{open:F,preferredWorkspaceId:(t==null?void 0:t.workspaceId)??null,preferredSessionId:(t==null?void 0:t.sessionId)??null,creationRequestId:de,initialDraft:M,onClose:()=>te(!1)}):n.jsxs(n.Fragment,{children:[Xn.createPortal(n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"conversation-selection-toolbar",style:Ce,onMouseDown:ue=>ue.preventDefault(),children:[n.jsx("button",{type:"button",className:"conversation-selection-action",onClick:()=>void ct(),children:o("conversation.copyAction")}),n.jsx("button",{type:"button",className:"conversation-selection-action",onClick:gt,children:o("conversation.selectionTodoAction")}),n.jsx("button",{type:"button",className:"conversation-selection-action is-primary",onClick:ft,children:o("conversation.selectionActionButton")})]}),y&&Nt?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:`conversation-selection-dialog-backdrop${be?" is-mobile":""}`,onMouseDown:()=>fe(!1)}),n.jsxs("div",{className:`conversation-selection-action-dialog${be?" is-centered":""}`,style:Nt,role:"dialog","aria-modal":"true","aria-label":o("conversation.selectionActionButton"),onMouseDown:ue=>ue.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:()=>fe(!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:ue=>j(ue.target.value)})]}),n.jsxs("label",{className:"conversation-selection-checkbox",children:[n.jsx("input",{type:"checkbox",checked:T,disabled:!g.sourceMessageId,onChange:ue=>P(ue.target.checked)}),n.jsx("span",{children:o("conversation.selectionActionIncludeContext")})]}),g.sourceMessageId?null:n.jsx("p",{className:"conversation-selection-hint",children:o("conversation.selectionActionContextUnavailable")}),_e?n.jsx("p",{className:"conversation-selection-hint",children:_e}):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:I,onChange:ue=>{const Oe=ue.target.value;Z(Oe),B(ce(Oe))},children:Mc.map(ue=>{var Oe;return n.jsx("option",{value:ue,disabled:((Oe=H[ue])==null?void 0:Oe.canStartSession)===!1,children:Zi(ue,"full")},ue)})})]}),n.jsxs("label",{className:"conversation-selection-field",children:[n.jsx("span",{children:o("conversation.forkTargetModelLabel")}),n.jsx("select",{value:q,disabled:Y||!!_e,onChange:ue=>B(ue.target.value),children:ye.map(ue=>n.jsx("option",{value:ue.id,children:ue.name},ue.id))})]})]}),n.jsxs("div",{className:"conversation-selection-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>fe(!1),children:o("common.cancel")}),n.jsx("button",{type:"button",className:"primary-button",disabled:K||!!_e,onClick:()=>void rt(),children:o(K?"conversation.sendingState":"conversation.selectionActionSubmit")})]})]})]}):null]}),document.body),n.jsx(yg,{open:F,preferredWorkspaceId:t.workspaceId,preferredSessionId:t.sessionId,creationRequestId:de,initialDraft:M,onClose:()=>te(!1)})]})}const wc=5;function XD({session:e}){const{showToast:t}=ir(),{requestNavigationRefresh:r}=gr(),[i,a]=p.useState(!1),[u,c]=p.useState(!1),[d,m]=p.useState(null),[f,v]=p.useState(null),[g,w]=p.useState(null),[y,x]=p.useState(""),[C,j]=p.useState(""),[T,P]=p.useState(wc),[I,Z]=p.useState(!1),[q,B]=p.useState(0),E=p.useMemo(()=>{var F;return((F=e==null?void 0:e.title)==null?void 0:F.trim())||null},[e==null?void 0:e.title]),A=p.useMemo(()=>d?{workspaceId:d.workspaceId,project:d.project,session:d.session}:null,[d]),H=(d==null?void 0:d.latestFollowUpTask)??null;if(p.useEffect(()=>{a(!1),Z(!1),v(null),m(null),x(""),j(""),P(wc)},[e==null?void 0:e.sessionId]),p.useEffect(()=>{if(!(e!=null&&e.sessionId)){c(!1);return}let F=!1;return c(!0),v(null),hF(e.sessionId).then(te=>{F||m(te.context)}).catch(te=>{F||(m(null),v(te instanceof Error?te.message:o("conversation.butlerActionLoadFailed")))}).finally(()=>{F||c(!1)}),()=>{F=!0}},[q,e==null?void 0:e.sessionId]),!(e!=null&&e.sessionId))return null;function _(){u||B(F=>F+1)}function Y(){!d&&!u&&_()}async function z(){if(!A){Y();return}const F=y.trim();if(!F){t({title:o("conversation.butlerFollowUpObjectiveRequired"),tone:"warning"});return}w("follow-up");try{const te=await sF({projectId:A.project.id,butlerSessionId:A.session.id,objective:F,completionCriteria:C.trim()||void 0,maxAutoContinueCount:T});m(de=>de&&{...de,latestFollowUpTask:te.task}),r(),t({title:o("conversation.butlerFollowUpStarted"),description:o("conversation.butlerFollowUpStartedDescription",{projectName:A.project.name}),tone:"success"}),x(""),j(""),P(wc),a(!1)}catch(te){t({title:o("conversation.butlerFollowUpFailed"),description:te instanceof Error?te.message:void 0,tone:"error"})}finally{w(null)}}async function K(){if(H){w("follow-up");try{const F=await aF(H.id);m(te=>te&&{...te,latestFollowUpTask:F.task}),r(),t({title:o("conversation.butlerFollowUpStopped"),description:o("conversation.butlerFollowUpStoppedDescription"),tone:"success"}),a(!1)}catch(F){t({title:o("conversation.butlerFollowUpStopFailed"),description:F instanceof Error?F.message:void 0,tone:"error"})}finally{w(null)}}}async function O(){if(!A){Y();return}w("verification");try{await mF({projectId:A.project.id,butlerSessionId:A.session.id,verificationType:"browser",targetRef:E||A.session.title||A.project.name}),r(),t({title:o("conversation.butlerVerificationStarted"),description:o("conversation.butlerVerificationStartedDescription",{projectName:A.project.name}),tone:"success"}),a(!1)}catch(F){t({title:o("conversation.butlerVerificationFailed"),description:F instanceof Error?F.message:void 0,tone:"error"})}finally{w(null)}}return n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"conversation-butler-entry",onMouseEnter:()=>{Z(!0),Y()},onMouseLeave:()=>{Z(!1)},children:[n.jsx("button",{type:"button",className:"conversation-header-ai-button","aria-label":o("conversation.butlerActionButton"),title:o("conversation.butlerActionButton"),onFocus:()=>{Z(!0),Y()},onBlur:()=>{Z(!1)},onClick:()=>{a(!0),Y()},children:n.jsx("span",{className:"conversation-header-ai-button-label","aria-hidden":"true",children:n.jsx(hO,{})})}),I?n.jsxs("div",{className:"conversation-butler-analysis-popover",role:"status","aria-live":"polite",children:[n.jsx("strong",{children:o("conversation.butlerAnalysisTitle")}),u?n.jsx("p",{children:o("conversation.butlerActionLoading")}):f?n.jsx("p",{children:f}):H?n.jsxs(n.Fragment,{children:[n.jsxs("p",{children:[o("conversation.butlerAnalysisObjectiveLabel"),":",H.objective]}),n.jsxs("p",{children:[o("conversation.butlerAnalysisStatusLabel"),":",lC(H.status)]}),n.jsxs("p",{children:[o("conversation.butlerAnalysisSummaryLabel"),":",H.lastAutomationSummary||H.waitingReason||o("conversation.butlerAnalysisEmpty")]}),H.waitingReason?n.jsxs("p",{children:[o("conversation.butlerAnalysisWaitingReasonLabel"),":",H.waitingReason]}):null]}):n.jsx("p",{children:o("conversation.butlerAnalysisEmpty")})]}):null]}),n.jsx(Hn,{open:i,title:o("conversation.butlerActionModalTitle"),description:o("conversation.butlerActionModalDescription"),onClose:()=>{g||a(!1)},children:n.jsxs("div",{className:"conversation-butler-modal",children:[u?n.jsx("p",{className:"conversation-butler-modal-hint",children:o("conversation.butlerActionLoading")}):null,!u&&f?n.jsx("p",{className:"conversation-butler-modal-error",children:f}):null,!u&&!f&&A?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:A.project.name})]}),n.jsxs("div",{className:"conversation-butler-target-card",children:[n.jsx("span",{children:o("conversation.butlerActionSessionLabel")}),n.jsx("strong",{children:A.session.title||E||A.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:F=>{x(F.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:F=>{j(F.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:T,disabled:g!==null,onChange:F=>{const te=Number.parseInt(F.target.value,10);P(Number.isFinite(te)?te:wc)}}),n.jsx("small",{children:o("conversation.butlerFollowUpRoundLimitHint")})]}),H&&(H.status==="active"||H.status==="waiting_user")?n.jsxs("div",{className:"conversation-butler-target-card",children:[n.jsx("span",{children:o("conversation.butlerCurrentFollowUpLabel")}),n.jsx("strong",{children:lC(H.status)}),n.jsx("small",{children:o("conversation.butlerCurrentFollowUpProgress",{current:H.autoContinueCount,max:H.maxAutoContinueCount??wc})}),n.jsx("button",{type:"button",className:"workbench-secondary-button",disabled:g!==null,onClick:()=>{K()},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:()=>{z()},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:()=>{O()},children:[n.jsx("strong",{children:o("conversation.butlerVerificationAction")}),n.jsx("span",{children:o("conversation.butlerVerificationActionDescription")})]})]})]}):null]})})]})}function lC(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 c3({session:e}){return e?n.jsx(n.Fragment,{children:n.jsx(XD,{session:e})}):null}function u3({requests:e,replyingRequestId:t,onReply:r}){const[i,a]=p.useState({}),u=p.useMemo(()=>e.filter(c=>c.status==="pending"),[e]);return u.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:u.length})]}),n.jsx("div",{className:"permission-request-stack",children:u.map(c=>{var w,y;const d=i[c.id]??{},m=c.paths.filter(Boolean),f=c.kind==="command"&&!!((w=c.command)!=null&&w.trim()),v=c.questions.length===0&&m.length===0&&!f&&!!((y=c.summary)!=null&&y.trim()),g=c.kind==="user_input"&&c.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:hT(c.provider),alt:"",loading:"lazy"})}),n.jsxs("div",{className:"permission-request-provider-copy",children:[n.jsx("strong",{children:c.title}),n.jsx("span",{children:Zi(c.provider,"full")})]})]}),n.jsx("span",{className:"permission-request-kind",children:d3(c.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:h3(x)}),n.jsx("span",{children:x})]},`${c.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:c.command})]}):null,v?n.jsx("p",{className:"permission-request-summary",children:c.summary}):null,c.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:c.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 T;const j=((T=d[x.id])==null?void 0:T.includes(C.label))??!1;return n.jsxs("label",{className:"permission-request-question-option",children:[n.jsx("input",{type:"radio",name:`${c.id}:${x.id}`,checked:j,onChange:()=>{a(P=>({...P,[c.id]:{...P[c.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:c.actions.map(x=>n.jsx("button",{type:"button",className:`permission-request-action permission-request-action-${x.tone}`,disabled:t===c.id||x.value==="submit"&&g,onClick:()=>void r(c.id,{action:x.value,answers:c.kind==="user_input"?d:void 0}),children:t===c.id?o("conversation.permissionRequestSubmitting"):x.label},`${c.id}:${x.value}`))})]},c.id)})})]})}function d3(e){return o(e==="command"?"conversation.permissionRequestKindCommand":e==="file_change"?"conversation.permissionRequestKindFileChange":e==="permissions"?"conversation.permissionRequestKindPermissions":e==="user_input"?"conversation.permissionRequestKindUserInput":"conversation.permissionRequestKindToolCall")}function h3(e){return e.split(/[/\\]+/).filter(Boolean).at(-1)??e}function m3({items:e,deletingQueueItemId:t=null,steeringQueueItemId:r=null,canSteer:i=!1,onDelete:a,onSteer:u}){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((c,d)=>{const m=c.status==="queued"||c.status==="failed",f=i&&typeof u=="function"&&c.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:c.content||o("conversation.queueImageOnly"),children:c.content||o("conversation.queueImageOnly")}),n.jsx("span",{className:`queued-message-item__status queued-message-item__status--${c.status}`,children:c.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 u(c.id),disabled:r===c.id,"aria-label":o("conversation.queueSteer"),title:o("conversation.queueSteer"),children:r===c.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(c.id),disabled:t===c.id,"aria-label":o("conversation.queueDelete"),title:o("conversation.queueDelete"),children:t===c.id?"…":"×"}):null]})]}),c.errorDetail?n.jsx("p",{className:"queued-message-item__error",children:c.errorDetail}):null]},c.id)})})]})}const xl=196,bo=82,cC=28,uC=24,QD=34,qg=18,p3=332,Bd=360,Lh=840,f3=520,dC=18,g3=.22,b3=2.4,v3=6;function w3(e,t){return(t.lastMessageAt??t.updatedAt).localeCompare(e.lastMessageAt??e.updatedAt)}function JD(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])),u=a.get(r)??null;if(!u)return null;const c=new Map;for(const C of i.sessions){const j=((y=C.parentSessionId)==null?void 0:y.trim())||null;if(!j)continue;const T=c.get(j)??[];c.set(j,[...T,C.sessionId])}const d=new Set,m=new Set;let f=u,v=u.sessionId;for(;f&&!m.has(f.sessionId);){d.add(f.sessionId),m.add(f.sessionId),v=f.sessionId;const C=((x=f.parentSessionId)==null?void 0:x.trim())||null;f=C?a.get(C)??null:null}const g=ZD(v,0,a,c,new Set),w=k3(g);return{root:g,current:u,currentPathIds:d,relatedSessionIds:w,sessionsById:a}}function y3(e){return((e==null?void 0:e.relatedSessionIds.size)??0)>1}function ZD(e,t,r,i,a){const u=r.get(e);if(!u)throw new Error(`Session ${e} not found`);const c=new Set(a);c.add(e);const d=[...i.get(e)??[]].filter(m=>!c.has(m)).sort((m,f)=>{const v=r.get(m),g=r.get(f);return!v||!g?0:w3(v,g)});return{session:u,depth:t,children:d.map(m=>ZD(m,t+1,r,i,c))}}function k3(e){const t=new Set;function r(i){t.add(i.session.sessionId),i.children.forEach(r)}return r(e),t}function e0(e){const t=qc(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[Zi(e.provider),i,t].filter(Boolean).join(" · ")}function t0(e){return e.isArchived===!0}function x3(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 S3(e,t){return e<=0||t<=0?1:Math.min(1,e/t)}function $g(e,t,r){return Math.min(r,Math.max(t,e))}function C3(e,t,r,i){if(e<=0||t<=0||r<=0||i<=0)return 1;const a=Math.max(1,e-dC*2),u=Math.max(1,t-dC*2);return Math.min(1,a/r,u/i)}function Fh(e,t,r,i,a){const u=i*e.scale,c=a*e.scale,d=(t-u)/2,m=(r-c)/2,f=u<=t?d:$g(e.offsetX,t-u,0),v=c<=r?m:$g(e.offsetY,r-c,0);return{scale:e.scale,offsetX:f,offsetY:v}}function Wd(e,t,r,i){const a=C3(e,t,r,i);return Fh({scale:a,offsetX:(e-r*a)/2,offsetY:(t-i*a)/2},e,t,r,i)}function j3(e,t,r,i,a,u,c,d){const m=(r-e.offsetX)/e.scale,f=(i-e.offsetY)/e.scale;return Fh({scale:t,offsetX:r-m*t,offsetY:i-f*t},a,u,c,d)}function N3(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 T3(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 Vg(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,xl),xl;const i=e.children.reduce((u,c,d)=>{const m=u+Vg(c,t);return d===0?m:m+qg},0),a=Math.max(xl,i);return t.set(e.session.sessionId,a),a}function P3(e){const t=new Map,r=[],i=new Map;function a(d,m,f){const v=Vg(d,t),g=m+v/2,w=uC+f*(bo+QD),y=g-xl/2,x=d.children.reduce((P,I,Z)=>{const q=P+Vg(I,t);return Z===0?q:q+qg},0);let C=m+Math.max(0,(v-x)/2);const j=d.children.map(P=>{const I=a(P,C,f+1);return C+=I.subtreeWidth+qg,I}),T={node:d,children:j,x:y,y:w,centerX:g,centerY:w+bo/2,subtreeWidth:v};return r.push(T),i.set(d.session.sessionId,T),T}const u=a(e,cC,0),c=r.reduce((d,m)=>Math.max(d,m.y+bo),0);return{root:u,nodes:r,bySessionId:i,width:u.subtreeWidth+cC*2,height:c+uC}}function D3(e){return Math.max(0,Math.min(255,Number.parseFloat(e)))}function R3(e){const t=e.trim();if(t.startsWith("#")){const i=t.slice(1);if(i.length===3){const[a,u,c]=i.split("").map(d=>Number.parseInt(d.repeat(2),16));return{r:a,g:u,b:c}}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,u]=r[1].split(",").map(c=>D3(c));return{r:i,g:a,b:u}}return null}function Ks(e,t,r){const i=R3(e);return i?`rgba(${i.r}, ${i.g}, ${i.b}, ${t})`:r}function M3(e,t,r,i,a,u){const c=e.getContext("2d");if(!c)return;const d=c,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),v=f.getPropertyValue("--accent").trim()||"#3b82f6",g=f.getPropertyValue("--border-primary").trim()||"#d4d8df",w=f.getPropertyValue("--bg-surface").trim()||"#ffffff";if(!u){const x=d.createLinearGradient(0,0,t.width,t.height);x.addColorStop(0,Ks(w,.38,"rgba(255, 255, 255, 0.38)")),x.addColorStop(1,Ks(v,.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),T=x.node.session.sessionId===a||C.node.session.sessionId===a;d.beginPath(),d.moveTo(x.centerX,x.y+bo-10);const P=x.y+bo+QD*.52;d.bezierCurveTo(x.centerX,P,C.centerX,P,C.centerX,C.y+10),d.lineWidth=T?3:j?2.5:1.5,d.strokeStyle=T?Ks(v,.52,"rgba(59, 130, 246, 0.52)"):j?Ks(v,.32,"rgba(59, 130, 246, 0.32)"):Ks(g,.72,"rgba(148, 163, 184, 0.72)"),d.stroke(),d.beginPath(),d.arc(C.centerX,C.y,T?4.5:3.5,0,Math.PI*2),d.fillStyle=T?Ks(v,.9,"rgba(59, 130, 246, 0.9)"):Ks(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,T=i.has(x.node.session.sessionId);if(!C&&!j&&!T)continue;const P=d.createRadialGradient(x.centerX,x.centerY,10,x.centerX,x.centerY,j?90:64);P.addColorStop(0,Ks(v,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,xl*.72,bo*.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=Ks(v,.94,"rgba(59, 130, 246, 0.94)"),d.fill())}}function A3(e,t,r){const i=Math.min(p3,t-24),a=e.left+e.width/2-i/2,u=Math.max(12,Math.min(t-i-12,a)),m=r-e.bottom-12<220&&e.top>Bd?Math.max(12,e.top-Bd-12):Math.max(12,Math.min(r-Bd-12,e.bottom+12));return{width:i,left:u,top:m,maxHeight:Math.min(Bd,r-24)}}function E3({model:e,selectedSession:t,selectedTreeNode:r,previewEntry:i,onClose:a,onOpenSession:u}){const c=Is(t.title,o("common.unknown")),d=t.sessionId===e.current.sessionId,m=t0(t),f=pu(r.session),v=Fb(r.session),g=_b(r.session),w=bT(r.session);return n.jsxs("div",{className:"conversation-branch-preview-popover",role:"dialog","aria-label":`${o("conversation.branchTreePreviewTitle")} ${c.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:c.fullTitle,children:c.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:e0(t)}),v&&f||w&&g?n.jsxs("div",{className:"conversation-branch-badge-row",children:[w&&g?n.jsx("span",{className:`session-fork-badge ${g}`,children:w}):null,v&&f?n.jsx("span",{className:`session-fork-badge ${f}`,children:v}):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:T3(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:N3(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:()=>u(t),children:o(d?"conversation.branchTreeCurrentAction":"conversation.branchTreeSwitchAction")})})]})}function I3({layout:e,model:t,selectedSessionId:r,onSelectSession:i,onBackgroundClick:a,stageScale:u,transform:c,isMobileViewport:d,viewportRef:m,onRegisterNodeElement:f,onViewportTouchStart:v,onViewportTouchMove:g,onViewportTouchEnd:w}){const y=p.useRef(null);return p.useEffect(()=>{const x=y.current;x&&M3(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":u<.999,"data-mobile":d,onClick:x=>{x.target===x.currentTarget&&(a==null||a())},onTouchStart:v,onTouchMove:g,onTouchEnd:w,onTouchCancel:w,children:n.jsx("div",{className:"conversation-branch-canvas-stage-shell",style:{width:d?"100%":e.width*u,height:d?"100%":e.height*u},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:c?`translate(${c.offsetX}px, ${c.offsetY}px) scale(${c.scale})`:`scale(${u})`,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=Is(x.node.session.title,o("common.unknown")),j=pu(x.node.session),T=Fb(x.node.session),P=_b(x.node.session),I=bT(x.node.session),Z=x.node.session.sessionId===t.current.sessionId,q=x.node.session.sessionId===r,B=t.currentPathIds.has(x.node.session.sessionId),E=t0(x.node.session);return n.jsx("button",{ref:A=>f(x.node.session.sessionId,A),type:"button",className:"conversation-branch-smart-card conversation-branch-canvas-node","data-current":Z,"data-selected":q,"data-current-path":B,"data-archived":E,style:{left:x.x,top:x.y,width:xl,minHeight:bo},"aria-pressed":q,onClick:A=>{A.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}),Z?n.jsx("span",{className:"conversation-branch-current-badge",children:o("conversation.branchTreeCurrentBadge")}):null,E?n.jsx("span",{className:"conversation-branch-archived-badge",children:o("conversation.branchTreeArchivedBadge")}):null]}),n.jsx("p",{children:e0(x.node.session)}),T&&j||I&&P?n.jsxs("div",{className:"conversation-branch-badge-row",children:[I&&P?n.jsx("span",{className:`session-fork-badge ${P}`,children:I}):null,T&&j?n.jsx("span",{className:`session-fork-badge ${j}`,children:T}):null]}):null]})},x.node.session.sessionId)})]})})})}function L3({model:e,onOpenSession:t,onClose:r,dialogLabel:i,dialogStyle:a,showResizeHandle:u,onBeginResize:c}){const d=p.useMemo(()=>P3(e.root),[e.root]),m=p.useRef(null),f=p.useRef(new Map),[v,g]=p.useState(null),[w,y]=p.useState(0),[x,C]=p.useState(0),[j,T]=p.useState(null),[P,I]=p.useState({}),Z=p.useRef(new Set),[q,B]=p.useState(typeof window<"u"?window.innerWidth<=Lh:!1),[E,A]=p.useState(null),H=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 M=m.current;if(!M)return;const N=M;function L(){y(N.clientWidth),C(N.clientHeight),B(window.innerWidth<=Lh)}if(L(),typeof ResizeObserver>"u")return window.addEventListener("resize",L),()=>window.removeEventListener("resize",L);const X=new ResizeObserver(L);return X.observe(M),()=>X.disconnect()},[]),p.useEffect(()=>{g(null)},[e.current.sessionId,e.root.session.sessionId]);const _=p.useMemo(()=>S3(w,d.width),[w,d.width]);p.useEffect(()=>{if(!q||w<=0||x<=0){A(null);return}A(M=>M?Fh(M,w,x,d.width,d.height):Wd(w,x,d.width,d.height))},[x,w,q,d.height,d.width]);const Y=v?e.sessionsById.get(v)??null:null,z=Y?d.bySessionId.get(Y.sessionId)??null:null,K=Y?P[Y.sessionId]??{status:"idle",messages:[],error:null}:null,O=q&&!!r;p.useEffect(()=>{if(!v){T(null);return}const M=v;function N(){const L=f.current.get(M);if(!L){T(null);return}T(L.getBoundingClientRect())}return N(),window.addEventListener("resize",N),window.addEventListener("scroll",N,!0),()=>{window.removeEventListener("resize",N),window.removeEventListener("scroll",N,!0)}},[v,_]),p.useEffect(()=>{if(!q)return;const M=v;if(!M)return;const N=window.requestAnimationFrame(()=>{const L=f.current.get(M);L&&T(L.getBoundingClientRect())});return()=>window.cancelAnimationFrame(N)},[q,E,v]),p.useEffect(()=>{if(!(Y!=null&&Y.sessionId)||(K==null?void 0:K.status)==="ready"||Z.current.has(Y.sessionId))return;let M=!1;return Z.current.add(Y.sessionId),I(N=>{var L;return{...N,[Y.sessionId]:{status:"loading",messages:((L=N[Y.sessionId])==null?void 0:L.messages)??[],error:null}}}),Eb(Y.sessionId,null,6,"backward").then(N=>{Z.current.delete(Y.sessionId),!M&&I(L=>({...L,[Y.sessionId]:{status:"ready",messages:x3(N.messages),error:null}}))}).catch(N=>{Z.current.delete(Y.sessionId),!M&&I(L=>{var X;return{...L,[Y.sessionId]:{status:"error",messages:((X=L[Y.sessionId])==null?void 0:X.messages)??[],error:N instanceof Error?N.message:o("conversation.branchTreePreviewFailed")}}})}),()=>{M=!0}},[Y==null?void 0:Y.sessionId]);function F(M){!q||w<=0||x<=0||A(N=>{const L=N??Wd(w,x,d.width,d.height);return Fh(M(L),w,x,d.width,d.height)})}function te(M){if(!q)return;const N=M.currentTarget.getBoundingClientRect();if(M.touches.length>=2){const D=M.touches[0],be=M.touches[1],ce=Math.hypot(be.clientX-D.clientX,be.clientY-D.clientY),le=(D.clientX+be.clientX)/2-N.left,ye=(D.clientY+be.clientY)/2-N.top,Se=E??Wd(w,x,d.width,d.height);H.current={mode:"pinch",startDistance:ce,startScale:Se.scale,startOffsetX:Se.offsetX,startOffsetY:Se.offsetY,startTouchX:le,startTouchY:ye,anchorX:le,anchorY:ye,moved:!1};return}const L=M.touches[0],X=E??Wd(w,x,d.width,d.height);H.current={mode:"pan",startDistance:0,startScale:X.scale,startOffsetX:X.offsetX,startOffsetY:X.offsetY,startTouchX:L.clientX,startTouchY:L.clientY,anchorX:0,anchorY:0,moved:!1}}function de(M){if(!q)return;const N=H.current;if(M.touches.length>=2){const ce=M.currentTarget.getBoundingClientRect(),le=M.touches[0],ye=M.touches[1],Se=Math.hypot(ye.clientX-le.clientX,ye.clientY-le.clientY);if(Se<=0||N.startDistance<=0)return;M.preventDefault();const _e=(le.clientX+ye.clientX)/2-ce.left,Ce=(le.clientY+ye.clientY)/2-ce.top,Nt=$g(N.startScale*(Se/N.startDistance),g3,b3);H.current={...N,mode:"pinch",moved:!0,anchorX:_e,anchorY:Ce},F(ct=>j3({...ct,scale:N.startScale,offsetX:N.startOffsetX,offsetY:N.startOffsetY},Nt,_e,Ce,w,x,d.width,d.height));return}if(N.mode!=="pan"||M.touches.length!==1)return;const L=M.touches[0],X=L.clientX-N.startTouchX,D=L.clientY-N.startTouchY;(N.moved||Math.hypot(X,D)>=v3)&&(M.preventDefault(),H.current={...N,moved:!0},F(ce=>({...ce,offsetX:N.startOffsetX+X,offsetY:N.startOffsetY+D})))}function W(){H.current={mode:"idle",startDistance:0,startScale:(E==null?void 0:E.scale)??1,startOffsetX:(E==null?void 0:E.offsetX)??0,startOffsetY:(E==null?void 0:E.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":""}${O?" conversation-branch-dialog-mobile-bare":""}`,role:r?"dialog":void 0,"aria-modal":r?"true":void 0,"aria-label":i,style:a,children:[O?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:[O?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,O?null:n.jsx("div",{className:"conversation-branch-canvas-tip",children:o("conversation.branchTreePreviewDescription")}),n.jsx(I3,{layout:d,model:e,selectedSessionId:v,onSelectSession:g,onBackgroundClick:O?r:void 0,stageScale:_,transform:q?E:null,isMobileViewport:q,viewportRef:m,onRegisterNodeElement:(M,N)=>{if(N){f.current.set(M,N);return}f.current.delete(M)},onViewportTouchStart:te,onViewportTouchMove:de,onViewportTouchEnd:W})]}),u?n.jsx("div",{className:"conversation-branch-dialog-resizer",role:"separator","aria-orientation":"vertical","aria-label":o("conversation.branchTreeResizeHandle"),onMouseDown:M=>c==null?void 0:c(M.clientX)}):null]}),Y&&z&&K&&j&&typeof document<"u"?Xn.createPortal(n.jsx("div",{className:"conversation-branch-preview-floating",style:A3(j,window.innerWidth,window.innerHeight),children:n.jsx(E3,{model:e,selectedSession:Y,selectedTreeNode:z.node,previewEntry:K,onClose:()=>g(null),onOpenSession:t})}),document.body):null]})}function F3({open:e,navigationGroups:t,workspaceId:r,sessionId:i,onClose:a,onOpenSession:u}){const c=p.useMemo(()=>JD(t,r,i),[t,i,r]),[d,m]=p.useState(null),[f,v]=p.useState(typeof window<"u"?window.innerWidth>Lh:!0);function g(C){const j=Math.max(420,C-32),T=Math.min(f3,j),P=Math.min(Math.max(C*.5,T),j);return{minWidth:T,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>Lh;if(v(j),!j){m(null);return}const T=g(window.innerWidth);m(P=>P===null?T.defaultWidth:Math.min(T.maxWidth,Math.max(T.minWidth,P)))}return C(),window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);function w(C){if(typeof window>"u"||!f)return;const j=g(window.innerWidth),T=d??j.defaultWidth;function P(Z){const q=Z.clientX-C;m(Math.min(j.maxWidth,Math.max(j.minWidth,T+q)))}function I(){document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",I)}document.addEventListener("mousemove",P),document.addEventListener("mouseup",I)}if(!e||!c||typeof document>"u")return null;const y=g(window.innerWidth),x=f?d??y.defaultWidth:void 0;return Xn.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(L3,{model:c,onOpenSession:u,onClose:a,dialogLabel:o("conversation.branchTreeTitle"),dialogStyle:x?{width:x,maxWidth:y.maxWidth,minWidth:y.minWidth}:void 0,showResizeHandle:f,onBeginResize:w})]}),document.body)}function _3(e){const t=e.trim().length;return t<=16?"xl":t<=26?"lg":t<=38?"md":"sm"}function n0({session:e,actions:t,workspaceContext:r=null}){const i=cr(),a=p.useCallback(d=>{!i.isDesktop||i.ui.osFamily!=="macos"||d.button!==0||Pb(d.target)&&Db()},[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 u=Is(e.title,o("conversation.titleFallback")),c=_3(u.displayTitle);return n.jsxs("header",{className:"conversation-header","data-workspace-tone":(r==null?void 0:r.tone)??"root",style:Xi(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-${c}`,title:u.fullTitle,children:u.displayTitle})}),t?n.jsx("div",{className:"conversation-header-actions",children:t}):null]})}function yu(e){return e.flatMap(t=>[{workspace:t.workspace,label:t.workspace.name,subtitle:t.workspace.path,depth:0,kind:"workspace",meta:null},...r0(t.childWorktrees??[])])}function ea(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=i0(i.childWorktrees??[],r);if(a)return a}return null}function r0(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},...r0(t.children)])}function i0(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=i0(r.children,t);if(i)return i}return null}function ku({open:e,workspaces:t,workspaceOptions:r,initialWorkspaceId:i,onClose:a,onSelect:u}){const[c,d]=p.useState(""),[m,f]=p.useState(!1),v=ts(),g=p.useMemo(()=>r??t.map(x=>({workspace:x,label:x.name,subtitle:x.path,depth:0,kind:"workspace",meta:null})),[r,t]),w=p.useMemo(()=>g.map(x=>x.workspace.id).join("|"),[g]);if(p.useEffect(()=>{e&&(d(O3(g,i)),f(!1))},[i,e,w]),!e||typeof document>"u")return null;const y=g.find(x=>x.workspace.id===c)??g[0]??null;return Xn.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:()=>{v.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(B3,{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!==c&&v.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===c?n.jsx(U3,{}):n.jsx(W3,{})})]},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(CT,{disabled:!c,workspaceId:c||null,onSelect:x=>{c&&u(c,x)}})]})]})]}),n.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:a,children:o("common.cancel")})]})}),document.body)}function O3(e,t){var r;return t&&e.some(i=>i.workspace.id===t)?t:((r=e[0])==null?void 0:r.workspace.id)??""}function B3({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 W3(){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 U3(){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 s0="mobile.conversation.preview.mode";function Ef(){if(typeof window>"u")return"preview";try{return window.localStorage.getItem(s0)==="immersive"?"immersive":"preview"}catch{return"preview"}}function fs(e){if(!(typeof window>"u"))try{window.localStorage.setItem(s0,e)}catch{}}function H3(e,t,r){if(!t)return null;const i=e.find(c=>c.workspace.id===t);if(!i)return null;const a=TN([i]).filter(c=>!c.session.isArchived&&!Ua(c.session)),u=a.findIndex(c=>c.session.sessionId===r);return u<0?null:a[u+1]??null}const z3=15e3,hC=.6,If=.6,mC=8,q3=36,$3=48,V3=96,G3=320,K3="workbench:focus-composer";function Y3(){const{sessionId:e="",workspaceId:t}=Po(),r=es(),i=dr(),a=p.useMemo(()=>new URLSearchParams(r.search),[r.search]),u=(t==null?void 0:t.trim())||null,c=p.useMemo(()=>eq(e,u,a),[u,a,e]),d=p.useMemo(()=>gq(e,r.state),[r.state,e]);return c?n.jsx(Z3,{draft:c,navigate:i}):n.jsx(X3,{sessionId:e,bootstrapMessages:d})}function X3({sessionId:e,bootstrapMessages:t}){var Tt,fn,Xt,kn;const{shellMode:r,navigationGroups:i,requestNavigationRefresh:a,selectWorkspace:u,setSessionWorkspace:c,markNavigationSessionSeen:d,favoriteSessions:m,archiveSession:f,unarchiveSession:v,startDraftSession:g,upsertNavigationSession:w}=gr(),y=dr(),x=p.useRef(null),C=p.useRef(null),[j,T]=p.useState(!1),[P,I]=p.useState(null),[Z,q]=p.useState(!1),[B,E]=p.useState(!1),[A,H]=p.useState(null),[_,Y]=p.useState(!1),[z,K]=p.useState(!1),[O,F]=p.useState(null),[te,de]=p.useState(!1),W=p.useMemo(()=>i.flatMap(Te=>Te.sessions).find(Te=>Te.sessionId===e)??null,[i,e]);(!x.current||C.current!==e)&&((Tt=x.current)==null||Tt.destroy(),x.current=new UD(e,{initialSession:W,bootstrapMessages:t,onSeen:(Te,Be)=>{d(Te,Be)}}),C.current=e);const M=x.current,{showToast:N,dismissToast:L}=ir(),X=Zs(Te=>Te.notificationPreferences.notifyOnPermissionRequest),D=cr(),be=ts(),ce=p.useRef(null),le=p.useRef(null),ye=p.useRef(null),Se=p.useRef((W==null?void 0:W.runningState)??null),_e=p.useRef(new Set),Ce=gi(M,Te=>Te.session),Nt=gi(M,Te=>Te.capabilities),ct=gi(M,Te=>Te.runtimeHasActiveRun),gt=gi(M,Te=>Te.runtimeCanInterrupt),ft=gi(M,Te=>Te.messages),rt=gi(M,Te=>Te.permissionRequests),fe=gi(M,Te=>Te.queuedMessages),ue=gi(M,Te=>Te.contextUsage),Oe=gi(M,Te=>Te.historyState),qe=gi(M,Te=>Te.errorCode),nt=gi(M,Te=>Te.errorDetail),yt=gi(M,Te=>Te.loadingOlderMessages),Me=gi(M,Te=>Te.hasOlderMessages),Le=gi(M,Te=>Te.connectionState),[pt,ut]=p.useState(!1),[we,xe]=p.useState(null),[Qe,Fe]=p.useState(null),dt=cq(Ce),It=dt&&pT(Nt)&&(Ce==null?void 0:Ce.provider)===(Nt==null?void 0:Nt.provider),qt=fe.some(Te=>Te.status==="queued"||Te.status==="dispatching"),Ht=uq({sessionId:e,provider:(Ce==null?void 0:Ce.provider)??null,runningState:(Ce==null?void 0:Ce.runningState)??null,activityState:(Ce==null?void 0:Ce.activityState)??null,runtimeHasActiveRun:ct,messages:ft})?o("conversation.runtimeThinkingPlaceholder",{provider:o("conversation.providerCodex")}):null,Ft=r!=="mobile",Dt=h0(!Ft),bt=(Ce==null?void 0:Ce.workspaceId)??(W==null?void 0:W.workspaceId)??null,Qt=p.useMemo(()=>new Set(m.map(Te=>Te.session.sessionId)),[m]),zt=p.useMemo(()=>i.map(Te=>Te.workspace),[i]),on=p.useMemo(()=>yu(i),[i]),ae=p.useMemo(()=>Xh(i),[i]),$e=p.useMemo(()=>o0(i,(Ce==null?void 0:Ce.workspaceId)??(W==null?void 0:W.workspaceId)??null,Qt),[Qt,i,W==null?void 0:W.workspaceId,Ce==null?void 0:Ce.workspaceId]),ht=p.useMemo(()=>l0(m,i),[m,i]),[Wt,jn]=p.useState([]),ln=p.useMemo(()=>[...ht,...$e],[ht,$e]),Ut=p.useMemo(()=>bt?zt.find(Te=>Te.id===bt)??null:null,[bt,zt]),dn=(bt?ae[bt]??null:null)??(Ut?fu(Ut):null),Jt=p.useMemo(()=>ea(i,bt),[bt,i]),nn=on.find(Te=>Te.workspace.id===bt)??(Jt?{workspace:Jt.workspace,label:Jt.workspace.name,subtitle:Jt.workspace.path}:null),hn=p.useMemo(()=>H3(i,bt,e),[bt,i,e]);(Ce==null?void 0:Ce.provider)??(W==null||W.provider);const ee=p.useMemo(()=>{var Te;return Is(((Te=Ce??W)==null?void 0:Te.title)??null,o("conversation.titleFallback"))},[W,Ce]),ne=Ce??W??null,pe=p.useMemo(()=>new Map(i.flatMap(Te=>Te.sessions.map(Be=>[Be.sessionId,Be]))),[i]);p.useEffect(()=>{const Te=Js(ln,e,Be=>Be.session.sessionId);Te.length!==0&&jn(Be=>{const lt=new Set(Be);let Mt=!1;for(const rn of Te)lt.has(rn)||(lt.add(rn),Mt=!0);return Mt?Array.from(lt):Be})},[ln,e]);const ve=p.useMemo(()=>wq(ne,ft),[ne,ft]),We=ve!=null&&ve.parentSessionId&&((Xt=(fn=pe.get(ve.parentSessionId))==null?void 0:fn.title)==null?void 0:Xt.trim())||o("conversation.inheritedContextParentFallback"),Ye=p.useMemo(()=>!ve||ve.hiddenMessageCount<=0?ft:pt?ve.sourceType!=="selection"?ft:[{id:`annotation-selection-${e}`,sessionId:e,role:"system",kind:"text",content:ve.hiddenSelectionText,toolCall:null,attachments:[],attachmentPayloads:null,origin:"system",originRef:ve.sourceMessageId??null,timestamp:(ne==null?void 0:ne.createdAt)??new Date(0).toISOString(),sequence:ve.hiddenSequenceBoundary,rawRef:`annotation-selection://${e}`,deliveryState:"sent",clientRequestId:null},...ft]:ft.filter(Be=>Be.sequence>ve.hiddenSequenceBoundary),[ne==null?void 0:ne.createdAt,pt,ve,ft,e]),mt=(ne==null?void 0:ne.workspaceId)??(W==null?void 0:W.workspaceId)??null,Je=p.useMemo(()=>JD(i,mt,e),[mt,i,e]),Ke=y3(Je),re=!!(ne&&mt&&Ke),Pe=p.useMemo(()=>(Jt==null?void 0:Jt.sessions.filter(Te=>Te.isArchived===!0&&!Ua(Te)))??[],[Jt]),ot=p.useRef(null),kt=p.useRef(null),an=p.useRef(null),$t=p.useRef(null),[Bt,_t]=p.useState(null),{composerPortalTarget:Sn}=AN();p.useEffect(()=>{M.applyNavigationSession(W)},[W,M]),p.useEffect(()=>(M.initialize(),()=>{M.destroy()}),[M]),p.useEffect(()=>(c(e,(Ce==null?void 0:Ce.workspaceId)??null),()=>{c(e,null)}),[Ce==null?void 0:Ce.workspaceId,e,c]),p.useEffect(()=>{K(!1),F(null),ut(!1)},[e]),p.useEffect(()=>()=>{ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null)},[]),p.useEffect(()=>{if(!qe||!nt){ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null),le.current=null,ce.current=null,L("conversation-runtime-error");return}const Te=`${qe}:${nt}`;if(!(ce.current===Te||le.current===Te)){if(ye.current!==null&&(window.clearTimeout(ye.current),ye.current=null),Q3((Ce==null?void 0:Ce.provider)??null,qe,nt)){le.current=Te,ye.current=window.setTimeout(()=>{le.current=null,ye.current=null,ce.current=Te,N({id:"conversation-runtime-error",title:o("conversation.runtimeErrorTitle"),description:nt,tone:"error",durationMs:null})},z3);return}le.current=null,ce.current=Te,N({id:"conversation-runtime-error",title:o("conversation.runtimeErrorTitle"),description:nt,tone:"error",durationMs:null})}},[L,qe,nt,Ce==null?void 0:Ce.provider,N]),p.useEffect(()=>{const Te=Se.current,Be=(Ce==null?void 0:Ce.runningState)??null;(Te==="starting"||Te==="running"||Te==="reconnecting")&&Be==="completed"&&be.trigger("success"),Se.current=Be},[be,Ce==null?void 0:Ce.runningState]),p.useEffect(()=>{const Te=rt.filter(lt=>lt.status==="pending"),Be=(Ce==null?void 0:Ce.workspaceId)??(W==null?void 0:W.workspaceId)??null;for(const lt of Te)_e.current.has(lt.id)||(_e.current.add(lt.id),X&&(N({id:`permission-request-${lt.id}`,title:o("conversation.permissionRequestToastTitle"),description:lt.title,tone:"warning",durationMs:8e3,action:Be?{label:o("shell.contextOpenSession"),onClick:()=>{y(fr(Be,e))}}:void 0}),D.bridge.showNotification(o("conversation.permissionRequestToastTitle"),lt.title)))},[W==null?void 0:W.workspaceId,y,X,rt,D.bridge,Ce==null?void 0:Ce.workspaceId,e,N]),u0(an,Bt,!Ft,e),d0(an,$t,!Ft,e);async function On(Te,Be){var rn,Nn;const lt=O;if(!lt){await M.sendMessage(Te,{model:Be==null?void 0:Be.model,reasoningLevel:Be==null?void 0:Be.reasoningLevel,attachments:Be==null?void 0:Be.attachments,attachmentMeta:Be==null?void 0:Be.attachmentMeta}),a();return}let Mt=null;try{Mt=await rT(e,{sourceType:"message",sourceMessageId:lt.sourceMessageId,sourceMessageSnapshot:lt.sourceMessageSnapshot,strategy:"auto",targetProvider:lt.targetProvider}),w(Mt),await Ib(Mt.sessionId,{content:Te,clientRequestId:((Nn=(rn=globalThis.crypto)==null?void 0:rn.randomUUID)==null?void 0:Nn.call(rn))??`fork-${Date.now()}-${Math.random().toString(16).slice(2)}`,model:lt.targetModel,reasoningLevel:(Be==null?void 0:Be.reasoningLevel)??null,attachments:(Be==null?void 0:Be.attachments)??[]}),F(null),a(),u(Mt.workspaceId),fs("preview"),y(fr(Mt.workspaceId,Mt.sessionId)),N({title:o("conversation.forkMessageSucceeded"),tone:"success"})}catch(Vt){throw Mt&&(w(Mt),a()),Vt}}function Mn(Te){u(Te),y(yo(Te))}return n.jsxs(n.Fragment,{children:[n.jsxs("main",{ref:an,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!Ft,"data-workspace-tone":(dn==null?void 0:dn.tone)??"root","data-worktree-depth":(dn==null?void 0:dn.depth)??0,"data-preview-mode":Ft?void 0:Dt.displayMode,"data-preview-dragging":Ft?void 0:Dt.isDragging,style:{...Xi(dn)??{},...Ft?{}:Dt.pageStyle},children:[Ft?n.jsx(n0,{session:Ce??W,workspaceContext:dn,actions:n.jsx(XD,{session:Ce??W})}):null,Ft?null:n.jsx(Ro,{containerRef:$t,className:"mobile-conversation-page-header",gestureHandlers:Dt.mainGestureHandlers,currentWorkspace:nn?{id:nn.workspace.id,name:nn.label,path:nn.subtitle}:zt[0]??null,workspaces:zt,workspaceOptions:on,onSelectWorkspace:Mn,heading:ee.fullTitle,trailing:n.jsxs("div",{className:"mobile-conversation-toolbar-main",children:[n.jsx("span",{className:"mobile-conversation-toolbar-title",title:ee.fullTitle,children:ee.displayTitle}),n.jsx(c3,{session:Ce??W})]})}),Ft?null:n.jsx(m0,{visible:Dt.isVisible,widthPx:Dt.previewWidthPx,isDragging:Dt.isDragging,gestureHandlers:Dt.railGestureHandlers,activeSessionId:e,createSessionActionLabel:o("shell.createSession"),favoriteItems:ht,items:$e,expandedRootIds:Wt,workspaceSectionLabel:o("shell.mobileConversationCurrentWorkspaceSection"),onCreateSession:()=>{de(!0)},archiveCurrentActionLabel:o("shell.archiveCurrentSessionAction"),archiveFolderActionLabel:o("shell.archiveFolderAction"),onArchiveActiveSession:()=>{q(!0)},onOpenArchiveFolder:()=>{E(!0)},onToggleSubsessions:Te=>{jn(Be=>Be.includes(Te)?Be.filter(lt=>lt!==Te):[...Be,Te])},onActivate:Te=>{fs("preview"),y(fr(Te.workspace.id,Te.session.sessionId))}}),n.jsx("div",{className:"mobile-conversation-stage",...Ft?{}:Dt.mainGestureHandlers,children:n.jsxs("div",{ref:ot,className:"mobile-conversation-main",children:[n.jsx(YD,{connectionState:Le,onReconnect:()=>M.reconnect()}),n.jsx(u3,{requests:rt,replyingRequestId:P,onReply:async(Te,Be)=>{I(Te);try{await M.replyPermissionRequest(Te,Be)}catch(lt){N({title:o("conversation.permissionRequestReplyFailed"),description:lt instanceof Error?lt.message:void 0,tone:"error"})}finally{I(null)}}}),ve&&ve.hiddenMessageCount>0?n.jsx(lq,{expanded:pt,hiddenMessageCount:ve.hiddenMessageCount,parentTitle:We,sourceType:ve.sourceType,onToggle:()=>{ut(Te=>!Te)},onOpenBranchTree:re?()=>K(!0):void 0}):null,n.jsx("div",{ref:kt,className:"conversation-timeline-shell",children:n.jsx(uv,{sessionId:e,messages:Ye,historyState:Oe,loadingOlderMessages:yt,hasOlderMessages:Me,provider:(Ce==null?void 0:Ce.provider)??null,runtimeThinkingPlaceholder:Ht,onLoadOlderMessages:()=>{M.loadOlderMessages()},onRetryMessage:Te=>{M.retryMessage(Te)},onForkMessage:Te=>{Ce&&(F({sourceMessageId:Te.id,sourceMessageSnapshot:{role:Te.role,kind:Te.kind??(Te.role==="tool"?"tool_result":"text"),content:Te.content},content:Te.content,sourceProvider:Ce.provider,workspaceId:Ce.workspaceId,targetProvider:Ce.provider,targetModel:null}),J3())}})}),n.jsx(l3,{containerRef:kt,session:Ce??W??null,currentCapabilities:Nt}),n.jsx(m3,{items:fe,deletingQueueItemId:we,steeringQueueItemId:Qe,canSteer:It,onDelete:async Te=>{xe(Te);try{await M.deleteQueuedMessage(Te)}finally{xe(null)}},onSteer:async Te=>{Fe(Te);try{await M.steerQueuedMessage(Te),a()}finally{Fe(null)}}}),n.jsx(Ub,{capabilities:Nt,draftStorageId:e,forkDraft:O,onClearForkDraft:()=>F(null),onForkDraftChange:Te=>F(Te),panelRef:Ft?void 0:_t,portalContainer:Ft?null:Sn,hasActiveRun:ct,contextUsage:ue,taskProvider:((kn=Ce??W)==null?void 0:kn.provider)??null,taskMessages:ft,hasPendingQueuedMessages:qt,canInterrupt:gt,isSubmitting:j,isRunning:dt,onInterrupt:async()=>{await M.interrupt(),a()},onSend:async(Te,Be)=>{T(!0);try{await On(Te,{model:Be==null?void 0:Be.model,reasoningLevel:Be==null?void 0:Be.reasoningLevel,attachments:Be==null?void 0:Be.attachments,attachmentMeta:Be==null?void 0:Be.attachmentMeta})}finally{T(!1)}},onQueueSend:async(Te,Be)=>{T(!0);try{O?await On(Te,{model:Be==null?void 0:Be.model,reasoningLevel:Be==null?void 0:Be.reasoningLevel,attachments:Be==null?void 0:Be.attachments,attachmentMeta:Be==null?void 0:Be.attachmentMeta}):await M.enqueueMessage(Te,{model:Be==null?void 0:Be.model,reasoningLevel:Be==null?void 0:Be.reasoningLevel,attachments:Be==null?void 0:Be.attachments,attachmentMeta:Be==null?void 0:Be.attachmentMeta})}finally{T(!1)}}})]})})]}),n.jsx(F3,{open:z,navigationGroups:i,workspaceId:mt,sessionId:e,onClose:()=>K(!1),onOpenSession:Te=>{K(!1),u(Te.workspaceId),fs("preview"),y(fr(Te.workspaceId,Te.sessionId))}}),n.jsx(aq,{open:Z,busy:_,onClose:()=>{_||q(!1)},onConfirm:async()=>{if(!_){Y(!0);try{if(await f(e),q(!1),N({title:o("shell.archiveAdded"),tone:"success"}),bt){if(u(bt),fs("preview"),hn){y(fr(hn.workspace.id,hn.session.sessionId));return}y(yo(bt));return}y("/workspaces")}catch(Te){N({title:Te instanceof Error?Te.message:o("shell.navigationLoadFailed"),tone:"error"})}finally{Y(!1)}}}}),n.jsx(oq,{open:B,workspaceName:(Jt==null?void 0:Jt.workspace.name)??null,sessions:Pe,restoringSessionId:A,onClose:()=>{A||E(!1)},onRestore:async Te=>{H(Te);try{await v(Te),N({title:o("shell.archiveRestored"),tone:"success"})}catch(Be){N({title:Be instanceof Error?Be.message:o("shell.navigationLoadFailed"),tone:"error"})}finally{H(null)}}}),n.jsx(ku,{open:te,workspaces:zt,workspaceOptions:on,initialWorkspaceId:bt,onClose:()=>de(!1),onSelect:(Te,Be)=>{de(!1),fs("immersive"),g(Te,Be)}})]})}function Q3(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 J3(){typeof window>"u"||window.dispatchEvent(new CustomEvent(K3))}function Z3({draft:e,navigate:t}){const{shellMode:r,navigationGroups:i,requestNavigationRefresh:a,selectWorkspace:u,setSessionWorkspace:c,upsertNavigationSession:d,favoriteSessions:m,startDraftSession:f}=gr(),[v,g]=p.useState(!1),[w,y]=p.useState([]),[x,C]=p.useState(!1),j=p.useMemo(()=>Fa(e.provider),[e.provider]),[T,P]=p.useState(j),I=r!=="mobile",Z=h0(!I),q=p.useMemo(()=>tq(e),[e]),B=p.useMemo(()=>new Set(m.map(ye=>ye.session.sessionId)),[m]),E=p.useMemo(()=>i.map(ye=>ye.workspace),[i]),A=p.useMemo(()=>yu(i),[i]),H=p.useMemo(()=>Xh(i),[i]),_=p.useMemo(()=>E.find(ye=>ye.id===e.workspaceId)??null,[e.workspaceId,E]),Y=H[e.workspaceId]??(_?fu(_):null),z=p.useMemo(()=>Is(q.title??null,o("conversation.titleFallback")),[q]),K=p.useMemo(()=>o0(i,e.workspaceId,B),[e.workspaceId,B,i]),O=p.useMemo(()=>l0(m,i),[m,i]),[F,te]=p.useState([]),de=p.useMemo(()=>[...O,...K],[O,K]),W=p.useMemo(()=>ea(i,e.workspaceId),[e.workspaceId,i]),M=A.find(ye=>ye.workspace.id===e.workspaceId)??(W?{workspace:W.workspace,label:W.workspace.name,subtitle:W.workspace.path}:null),N=p.useRef(null),L=p.useRef(null),X=p.useRef(null),[D,be]=p.useState(null),{composerPortalTarget:ce}=AN();p.useEffect(()=>{const ye=Js(de,e.sessionId,Se=>Se.session.sessionId);ye.length!==0&&te(Se=>{const _e=new Set(Se);let Ce=!1;for(const Nt of ye)_e.has(Nt)||(_e.add(Nt),Ce=!0);return Ce?Array.from(_e):Se})},[e.sessionId,de]),p.useEffect(()=>(c(e.sessionId,e.workspaceId),()=>{c(e.sessionId,null)}),[e.sessionId,e.workspaceId,c]),p.useEffect(()=>{let ye=!1;return P(j),Al(e.provider,e.workspaceId).then(Se=>{ye||P(Se)}).catch(()=>{}),()=>{ye=!0}},[e.provider,e.workspaceId,j]),u0(L,D,!I,e.sessionId),d0(L,X,!I,e.sessionId);function le(ye){u(ye),t(yo(ye))}return n.jsxs(n.Fragment,{children:[n.jsxs("main",{ref:L,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!I,"data-workspace-tone":(Y==null?void 0:Y.tone)??"root","data-worktree-depth":(Y==null?void 0:Y.depth)??0,"data-preview-mode":I?void 0:Z.displayMode,"data-preview-dragging":I?void 0:Z.isDragging,style:{...Xi(Y)??{},...I?{}:Z.pageStyle},children:[I?n.jsx(n0,{session:q,workspaceContext:Y}):null,I?null:n.jsx(Ro,{containerRef:X,className:"mobile-conversation-page-header",gestureHandlers:Z.mainGestureHandlers,currentWorkspace:M?{id:M.workspace.id,name:M.label,path:M.subtitle}:E[0]??null,workspaces:E,workspaceOptions:A,onSelectWorkspace:le,heading:z.fullTitle,trailing:n.jsx("span",{className:"mobile-conversation-toolbar-title",title:z.fullTitle,children:z.displayTitle})}),I?null:n.jsx(m0,{visible:Z.isVisible,widthPx:Z.previewWidthPx,isDragging:Z.isDragging,gestureHandlers:Z.railGestureHandlers,activeSessionId:e.sessionId,createSessionActionLabel:o("shell.createSession"),favoriteItems:O,items:K,expandedRootIds:F,workspaceSectionLabel:o("shell.mobileConversationCurrentWorkspaceSection"),onCreateSession:()=>{C(!0)},onToggleSubsessions:ye=>{te(Se=>Se.includes(ye)?Se.filter(_e=>_e!==ye):[...Se,ye])},onActivate:ye=>{fs("preview"),t(fr(ye.workspace.id,ye.session.sessionId))}}),n.jsx("div",{className:"mobile-conversation-stage",...I?{}:Z.mainGestureHandlers,children:n.jsxs("div",{ref:N,className:"mobile-conversation-main",children:[n.jsx(YD,{connectionState:"closed",onReconnect:()=>{}}),n.jsx("div",{className:"conversation-timeline-shell",children:n.jsx(uv,{sessionId:e.sessionId,messages:w,historyState:"ready",loadingOlderMessages:!1,hasOlderMessages:!1,provider:e.provider,runtimeThinkingPlaceholder:null,onLoadOlderMessages:()=>{},onRetryMessage:()=>{}})}),n.jsx(Ub,{capabilities:T,draftStorageId:e.sessionId,panelRef:I?void 0:be,portalContainer:I?null:ce,contextUsage:null,taskProvider:e.provider,taskMessages:w,isSubmitting:v,isRunning:!1,onSend:async(ye,Se)=>{var Nt,ct,gt,ft;const _e=vq();y(rt=>[...rt,AD(e.sessionId,ye,_e,(Se==null?void 0:Se.attachmentMeta)??[],(Se==null?void 0:Se.attachments)??[])]),g(!0);const Ce=performance.now();tn("session_send.start_live.client_start",{draftSessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,clientRequestId:_e,contentLength:ye.length});try{const rt=bs.getState().profile.defaultPermissionMode,fe=await iT({workspaceId:e.workspaceId,provider:e.provider,content:ye,clientRequestId:_e,model:(Se==null?void 0:Se.model)??null,reasoningLevel:(Se==null?void 0:Se.reasoningLevel)??null,permissionMode:rt==="default"?null:rt,attachments:(Se==null?void 0:Se.attachments)??[]});tn("session_send.start_live.client_response",{draftSessionId:e.sessionId,sessionId:fe.sessionId,workspaceId:((Nt=fe.session)==null?void 0:Nt.workspaceId)??e.workspaceId,provider:fe.provider,clientRequestId:_e,durationMs:Math.round(performance.now()-Ce),returnedMessageId:((ct=fe.message)==null?void 0:ct.messageId)??null}),fe.session&&d(fe.session);const ue=((ft=(gt=fe.session)==null?void 0:gt.workspaceId)==null?void 0:ft.trim())||e.workspaceId;c(fe.sessionId,ue),fs("preview"),t(fr(ue,fe.sessionId),{replace:!0,state:fe.message?{bootstrap:{sessionId:fe.sessionId,messages:[fe.message]}}:null}),a()}catch(rt){throw tn("session_send.start_live.client_error",{draftSessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,clientRequestId:_e,durationMs:Math.round(performance.now()-Ce),error:rt instanceof Error?rt.message:String(rt)}),y(fe=>Wg(fe,_e)),rt}finally{g(!1)}}})]})})]}),n.jsx(ku,{open:x,workspaces:E,workspaceOptions:A,initialWorkspaceId:e.workspaceId,onClose:()=>C(!1),onSelect:(ye,Se)=>{C(!1),fs("immersive"),f(ye,Se)}})]})}function eq(e,t,r,i=null){var c,d;if(!fq(e))return null;const a=t??((c=r.get("workspaceId"))==null?void 0:c.trim())??null,u=((d=r.get("provider"))==null?void 0:d.trim())??i??null;return!a||!dT(u)?null:{sessionId:e,workspaceId:a,provider:u}}function tq(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:FL(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 nq(e){var t;return((t=e.parentSessionId)==null?void 0:t.trim())||null}function a0(e){const t=new Map(e.map(a=>[a.sessionId,a])),r=new Map,i=a=>{const u=r.get(a.sessionId);if(typeof u=="boolean")return u;if(a.isArchived)return r.set(a.sessionId,!1),!1;const c=nq(a);if(!c)return r.set(a.sessionId,!0),!0;const d=t.get(c);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 o0(e,t,r){if(!t)return[];const i=ea(e,t);if(!i)return[];const a=a0(i.sessions).map(c=>({session:c,workspace:i.workspace}));return db(a).filter(c=>!r.has(c.item.session.sessionId)&&!qh(c.children,d=>r.has(d.session.sessionId)))}function l0(e,t){return e.filter(r=>!Ua(r.session)).flatMap(r=>{const i=ea(t,r.workspace.id);if(!i)return[];const a=db(a0(i.sessions).map(c=>({session:c,workspace:i.workspace}))),u=c0(a,r.session.sessionId);return u?[u]:[]})}function c0(e,t){for(const r of e){if(r.item.session.sessionId===t)return r;const i=c0(r.children,t);if(i)return i}return null}function u0(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 u=a,c=t;function d(){!e.current||!c.isConnected||u.style.setProperty("--mobile-conversation-composer-height",`${c.offsetHeight}px`)}d();const m=typeof ResizeObserver<"u"?new ResizeObserver(d):null;return m==null||m.observe(c),window.addEventListener("resize",d),()=>{m==null||m.disconnect(),window.removeEventListener("resize",d),a.style.removeProperty("--mobile-conversation-composer-height")}},[t,r,i,e])}function d0(e,t,r,i){p.useEffect(()=>{const a=e.current,u=t.current;if(!r||!a){a&&a.style.removeProperty("--mobile-conversation-page-header-height");return}if(!u){a.style.removeProperty("--mobile-conversation-page-header-height");return}const c=a,d=u;function m(){!e.current||!d.isConnected||c.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 h0(e){const t=ts(),[r,i]=p.useState(()=>e?Ef():"immersive"),[a,u]=p.useState(()=>pC()),[c,d]=p.useState(()=>e&&Ef()==="preview"?"default":"closed"),m=p.useRef(c),f=p.useRef(null);p.useEffect(()=>{m.current=c},[c]),p.useEffect(()=>{if(!e){f.current=null,m.current="closed",d("closed"),i("immersive");return}const A=Ef();i(A),d(A==="preview"?"default":"closed")},[e]),p.useEffect(()=>{e&&fs(r)},[e,r]),p.useEffect(()=>{if(typeof window>"u")return;function A(){u(pC())}return A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}},[]);function v(A){m.current=A,d(A)}function g(A="default"){v(A),i("preview")}function w(){v("closed"),i("immersive")}function y(){v("expanded"),i("preview")}function x(){if(m.current!=="closed"){t.trigger("gesture"),w();return}t.trigger("gesture"),g()}function C(A,H){if(!e||H.touches.length!==1){f.current=null;return}if(iq(H.target)){f.current=null;return}const _=H.touches[0];if(!_){f.current=null;return}if(A==="main"){if(m.current==="closed"&&_.clientX>V3){f.current=null;return}}else if(m.current==="closed"){f.current=null;return}f.current={source:A,intent:A==="rail"?"rail":m.current==="closed"?"open":"close",startX:_.clientX,startY:_.clientY,lastX:_.clientX,lastY:_.clientY,horizontalLocked:!1}}function j(A){const H=f.current,_=A.touches[0];if(!e||!H||!_)return;const Y=_.clientX-H.startX,z=_.clientY-H.startY;if(H.lastX=_.clientX,H.lastY=_.clientY,!H.horizontalLocked){if(Math.abs(Y)<mC&&Math.abs(z)<mC)return;if(Math.abs(Y)<=Math.abs(z)){f.current=null;return}if(H.intent==="open"&&Y<=0){f.current=null;return}if(H.intent==="close"&&Y>=0){f.current=null;return}H.horizontalLocked=!0}}function T(A){var z;const H=f.current;if(f.current=null,!(H!=null&&H.horizontalLocked))return;const _=(z=A==null?void 0:A.changedTouches)==null?void 0:z[0];_&&(H.lastX=_.clientX,H.lastY=_.clientY);const Y=H.lastX-H.startX;if(H.intent==="open"){Y>=q3&&(t.trigger("gesture"),g("default"));return}if(H.intent==="close"){Y<=-34&&(t.trigger("gesture"),w());return}if(Y<=-34){t.trigger("gesture"),w();return}Y>=$3&&m.current==="default"&&(t.trigger("gesture"),y())}const P=c==="expanded"?If:c==="default"?hC:0,I=Math.round(a*P*100)/100,Z=P===0?0:P/If,q={"--mobile-conversation-preview-default-width":`${Math.round(a*hC*100)/100}px`,"--mobile-conversation-preview-max-width":`${Math.round(a*If*100)/100}px`,"--mobile-conversation-preview-width":`${I}px`,"--mobile-conversation-preview-progress":Z.toFixed(4)};return{closePreview:w,displayMode:c==="closed"?"immersive":"preview",isDragging:!1,isVisible:c!=="closed",mainGestureHandlers:{onTouchStart:A=>C("main",A),onTouchMove:j,onTouchEnd:T,onTouchCancel:T},pageStyle:q,previewWidthPx:I,railGestureHandlers:{onTouchStart:A=>C("rail",A),onTouchMove:j,onTouchEnd:T,onTouchCancel:T},togglePreview:x}}function m0({visible:e,widthPx:t,isDragging:r,gestureHandlers:i,activeSessionId:a,createSessionActionLabel:u,favoriteItems:c,items:d,expandedRootIds:m,workspaceSectionLabel:f,onCreateSession:v,archiveCurrentActionLabel:g,archiveFolderActionLabel:w,onArchiveActiveSession:y,onOpenArchiveFolder:x,onToggleSubsessions:C,onActivate:j}){if(!e)return null;function T(P,I){const{workspaceName:Z,ancestorExpanded:q=!1,ancestorHasNextSiblings:B=[],hasNextSibling:E=!1,isFirstSibling:A=!1}=I??{},H=P.item.session.sessionId,_=P.children,Y=P.depth===0&&_.length>0,z=q||Y&&m.includes(H),K=P.depth>0?[...B,E]:[...B];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:[B.map((O,F)=>O?n.jsx("span",{className:"mobile-conversation-preview-guide-column",style:{"--mobile-preview-tree-level":F+1}},`${H}:ancestor:${F}`):null),n.jsx("span",{className:"mobile-conversation-preview-guide-branch","data-continue":E,"data-first":A,style:{"--mobile-preview-tree-level":P.depth},children:n.jsx("span",{className:"mobile-conversation-preview-guide-branch-horizontal"})})]}):null,n.jsx(rq,{entry:P.item,activeSessionId:a,hasSubsessions:Y,subsessionsExpanded:z,workspaceName:Z,onToggleSubsessions:Y?()=>{C(H)}:void 0,onActivate:j})]}),_.length>0&&z?n.jsx("div",{className:"mobile-conversation-preview-children",children:_.map((O,F)=>T(O,{workspaceName:Z,ancestorExpanded:!0,ancestorHasNextSiblings:K,hasNextSibling:F<_.length-1,isFirstSibling:F===0}))}):null]},`${P.item.workspace.id}:${H}`)}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:[u&&v?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:v,children:[n.jsx("span",{className:"workbench-import-toggle-symbol","aria-hidden":"true",children:"+"}),n.jsx("span",{className:"workbench-import-toggle-label",children:u})]})}):null,n.jsxs("div",{className:"mobile-conversation-preview-body terminal-mobile-list-body",children:[c.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:c.length})]}),n.jsx("div",{className:"mobile-conversation-preview-list mobile-conversation-preview-list-static terminal-mobile-session-list",children:c.map(P=>n.jsx("div",{children:T(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=>T(P))})]})]}),g&&y||w&&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,w&&x?n.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button workbench-import-toggle",onClick:x,children:w}):null]}):null]})}function rq({entry:e,activeSessionId:t,hasSubsessions:r=!1,subsessionsExpanded:i=!1,onActivate:a,onToggleSubsessions:u,workspaceName:c}){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(),u==null||u()},children:n.jsx("span",{className:fC(e.session,{isActive:d,hasSubsessions:r}),"aria-hidden":"true"})}):n.jsx("span",{className:fC(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:p0(e.session,c)})]})})]})}function pC(){return typeof window>"u"?390:Math.max(window.innerWidth||390,320)}function iq(e){return e instanceof Element?!!e.closest("input, textarea, select, option, label, [contenteditable='true'], [data-preview-gesture='ignore']"):!1}function fC(e,t){const r=Lb("mobile-conversation-preview-indicator",e,{hasSubagents:t.hasSubsessions});return r.endsWith(" is-idle")&&t.isActive?"mobile-conversation-preview-indicator is-active":r}function p0(e,t){const r=qc(e);return[t??null,Zi(e.provider),sq(e.lastMessageAt??e.updatedAt),r].filter(Boolean).join(" · ")}function sq(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):o("common.unknown")}function aq({open:e,busy:t,onClose:r,onConfirm:i}){return p.useEffect(()=>{if(!e)return;function a(u){u.key==="Escape"&&!t&&r()}return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[t,r,e]),!e||typeof document>"u"?null:Xn.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 oq({open:e,workspaceName:t,sessions:r,restoringSessionId:i,onClose:a,onRestore:u}){return p.useEffect(()=>{if(!e)return;function c(d){d.key==="Escape"&&!i&&a()}return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[a,e,i]),!e||typeof document>"u"?null:Xn.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(c=>{const d=Is(c.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:p0(c)})]}),n.jsx("button",{type:"button",className:"secondary-button",disabled:i===c.sessionId,onClick:()=>{u(c.sessionId)},children:o("shell.unarchiveAction")})]},c.sessionId)})}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.archiveEmpty")})})]})]}),document.body)}function lq(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(pO,{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(mO,{})})}):null]})]})}function cq(e){return e?e.activityState==="running"?!0:e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting":!1}function uq(e){const t=dq(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)},G3))},[t,r]),p.useEffect(()=>()=>{a.current!==null&&window.clearTimeout(a.current)},[]),r}function dq(e){const{provider:t,runningState:r,activityState:i,runtimeHasActiveRun:a,messages:u}=e;if(t!=="codex")return"hide_immediately";const c=pq(u);return c<0||mq(u,c)?"hide_immediately":hq(r,i,a)?"show":"hide_deferred"}function hq(e,t,r){return r===!0||t==="running"||e==="starting"||e==="running"||e==="reconnecting"}function mq(e,t){return e.slice(t+1).some(r=>r.role==="assistant"&&(r.kind==="text"||r.kind==="thinking"))}function pq(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 fq(e){return e.startsWith("draft-")}function gq(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(bq)}function bq(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 vq(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?e.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}function wq(e,t){var c,d,m;if(!e)return null;const r=((c=e.parentSessionId)==null?void 0:c.trim())||null;if(!r||Ua(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),u=t.filter(f=>f.sequence<=a).length;return u<=0?null:{parentSessionId:r,sourceType:i,hiddenMessageCount:u,hiddenSequenceBoundary:a,hiddenSelectionText:"",sourceMessageId:((m=e.forkSourceMessageId)==null?void 0:m.trim())||null}}function yq(){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"})})]})})}const kq=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"]),xq=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"]),Sq=new Set(["case","do","done","elif","else","esac","export","fi","for","function","if","in","local","readonly","return","then","until","while"]),Cq=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"]),jq=new Set(["add","arg","cmd","copy","entrypoint","env","expose","from","healthcheck","label","maintainer","onbuild","run","shell","stopsignal","user","volume","workdir","as"]),Nq=new Set(["trace","debug","info","warn","warning","error","fatal"]);function f0({workspaceId:e,filePath:t,open:r,onClose:i,onSaved:a,diffContent:u}){const[c,d]=p.useState(null),[m,f]=p.useState(""),[v,g]=p.useState(null),[w,y]=p.useState(!1),[x,C]=p.useState(!1),[j,T]=p.useState(!1),[P,I]=p.useState("preview"),[Z,q]=p.useState(0),[B,E]=p.useState(!1),{showToast:A}=ir(),H=cr(),_=p.useRef(i),Y=p.useRef(A),z=p.useMemo(()=>pv(t),[t]),K=p.useMemo(()=>Gq(u),[u]),O=z==="markdown",F=z==="html",te=!!(c!=null&&c.supported&&c.kind==="text"),de=p.useMemo(()=>v!=null&&v.previewUrl?v.previewUrl:null,[v]);if(p.useEffect(()=>{_.current=i},[i]),p.useEffect(()=>{Y.current=A},[A]),p.useEffect(()=>{if(!r){d(null),f(""),g(null),y(!1),C(!1),T(!1),I(Lf(t)),q(0),E(!1);return}if(!e||!t)return;const Se=e,_e=t;let Ce=!1;async function Nt(){y(!0),C(Gg(_e));try{const ct=await Ik(Se,_e);let gt=null;if(Gg(_e))try{gt=await Lk(Se,_e)}catch(ft){Ce||Y.current({title:Ud(ft,o("conversation.fileViewerHtmlPreviewFailed")),tone:"error"})}Ce||(d(ct),f(ct.content??""),g(gt),I(Lf(_e)),q(0),E(!1))}catch(ct){Ce||(Y.current({title:Ud(ct,o("conversation.filePanelOpenFailed")),tone:"error"}),_.current())}finally{Ce||(y(!1),C(!1))}}return Nt(),()=>{Ce=!0}},[t,r,e]),p.useEffect(()=>{if(!r)return;function Se(_e){if(_e.key==="Escape"){if(B){E(!1);return}i()}}return window.addEventListener("keydown",Se),()=>{window.removeEventListener("keydown",Se)}},[B,i,r]),!r||!t||typeof document>"u")return null;const W=t,M=e;async function N(Se=!1){if(!M||!F)return null;const _e=!Se&&Tq(v)?v:null;if(_e!=null&&_e.previewPath)return _e.previewUrl;C(!0);try{const Ce=await Lk(M,W);return g(Ce),Ce.previewUrl}catch(Ce){return A({title:Ud(Ce,o("conversation.fileViewerHtmlPreviewFailed")),tone:"error"}),null}finally{C(!1)}}async function L(){if(!(!M||!(c!=null&&c.version)||!te)){T(!0);try{await zL(M,W,m,c.version);const Se=await Ik(M,W);d(Se),f(Se.content??""),await a(W),A({title:o("conversation.filePanelSaveSuccess"),tone:"success"}),I(Lf(W)),F&&q(_e=>_e+1)}catch(Se){A({title:Ud(Se,o("conversation.filePanelSaveFailed")),tone:"error"})}finally{T(!1)}}}async function X(){const Se=await N();if(!Se)return;const _e=await H.bridge.openExternal(Se);_e.ok||A({title:_e.detail??o("conversation.fileViewerOpenInBrowserFailed"),tone:"error"})}async function D(){await N(!0)&&q(_e=>_e+1)}const be=(c==null?void 0:c.content)??"",ce=te&&m!==be,le=F&&(c==null?void 0:c.supported)!==!1,ye=de===null?null:`${de}${de.includes("?")?"&":"?"}refresh=${Z}`;return Xn.createPortal(n.jsxs("div",{className:"workbench-modal-layer","data-fullscreen":B?"true":void 0,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-fullscreen":B?"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}",v0(z))})]}),n.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":o("common.close"),onClick:i,children:n.jsx($q,{})})]}),n.jsxs("div",{className:"file-viewer-toolbar",children:[n.jsxs("div",{className:"file-viewer-tabs",role:"tablist","aria-label":o("conversation.fileViewerModeLabel"),children:[le?n.jsx("button",{type:"button",className:"file-viewer-tab","data-active":P==="preview",role:"tab","aria-selected":P==="preview",onClick:()=>I("preview"),children:o("conversation.fileViewerPreview")}):O?n.jsx("button",{type:"button",className:"file-viewer-tab","data-active":P==="preview",role:"tab","aria-selected":P==="preview",onClick:()=>I("preview"),children:o("conversation.fileViewerPreview")}):n.jsx("button",{type:"button",className:"file-viewer-tab","data-active":P==="code",role:"tab","aria-selected":P==="code",onClick:()=>I("code"),children:o("conversation.fileViewerCode")}),le?n.jsx("button",{type:"button",className:"file-viewer-tab","data-active":P==="code",role:"tab","aria-selected":P==="code",onClick:()=>I("code"),children:o("conversation.fileViewerCode")}):null,n.jsx("button",{type:"button",className:"file-viewer-tab","data-active":P==="edit",role:"tab","aria-selected":P==="edit",onClick:()=>I("edit"),disabled:!te,children:o("conversation.fileViewerEdit")})]}),n.jsxs("div",{className:"file-viewer-actions",children:[le?n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>void D(),disabled:x,children:o("conversation.fileViewerRefreshPreview")}):null,le?n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>E(Se=>!Se),children:o(B?"conversation.fileViewerExitFullscreen":"conversation.fileViewerEnterFullscreen")}):null,le?n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>void X(),disabled:x,children:o("conversation.fileViewerOpenInBrowser")}):null,n.jsx("button",{type:"button",className:"primary-button",onClick:()=>void L(),disabled:!ce||j,children:o(j?"conversation.filePanelSaving":"conversation.filePanelSave")})]})]}),n.jsx("div",{className:"workbench-modal-body file-viewer-body",children:w?n.jsx("p",{className:"status-text",children:o("common.loading")}):(c==null?void 0:c.supported)===!1?n.jsx("p",{className:"status-text",children:c.reason??o("conversation.filePanelUnsupported")}):P==="edit"?n.jsx("textarea",{className:"file-viewer-editor","data-testid":"file-viewer-editor",value:m,onChange:Se=>f(Se.target.value),spellCheck:!1}):P==="preview"&&le?ye?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:ye,sandbox:"allow-forms allow-modals allow-scripts"},`${ye}-${Z}`)}):x?n.jsx("p",{className:"status-text",children:o("conversation.fileViewerHtmlPreviewLoading")}):n.jsx("p",{className:"status-text",children:o("conversation.fileViewerHtmlPreviewUnavailable")}):P==="preview"&&O?n.jsx(Pq,{content:m}):n.jsx(g0,{content:m,language:z,overviewMarkers:K})})]})]}),document.body)}function Lf(e){return qq(e??"")||Gg(e??"")?"preview":"code"}function Tq(e){return e?Date.parse(e.expiresAt)-Date.now()>3e4:!1}function Pq({content:e}){return n.jsx("div",{className:"markdown-content file-viewer-markdown",children:n.jsx(rv,{remarkPlugins:[ov],components:{code(t){const r=typeof t.className=="string"?t.className:"",i=/language-([\w-]+)/.exec(r);return i?n.jsx(g0,{content:String(t.children).replace(/\n$/,""),language:fv(i[1]??"plain")}):n.jsx("code",{className:r||void 0,children:t.children})}},children:e})})}function g0({content:e,language:t,overviewMarkers:r=[]}){const i=e.split(/\r?\n/),a=p.useRef(null),u=p.useMemo(()=>{const c=new Map;for(const d of r)for(let m=0;m<d.span;m++)c.set(d.line+m,d.kind);return c},[r]);return n.jsxs("div",{className:"file-viewer-code-block",children:[n.jsx("div",{className:"file-viewer-code-header",children:v0(t)}),n.jsxs("div",{className:"file-viewer-scroll-shell",children:[n.jsx("div",{className:"file-viewer-code-body",ref:a,children:i.map((c,d)=>{const m=Dq(c,t),f=d+1,v=u.get(f);return n.jsxs("div",{className:`file-viewer-code-line${v?` diff-line-${v}`:""}`,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,w)=>n.jsx("span",{className:`code-token ${g.kind}`,children:g.text},`${d}-${w}-${g.text}`)):n.jsx("span",{className:"code-token plain",children:" "})})]},`${d}-${c}`)})}),n.jsx(Yq,{markers:r,totalLines:i.length,scrollContainerRef:a})]})]})}function Dq(e,t){const r=fv(t);return r==="json"?Rq(e):r==="yaml"?Iq(e):r==="toml"?Lq(e):r==="ini"?b0(e):r==="env"?Fq(e):r==="properties"?_q(e):r==="conf"?Oq(e):r==="editorconfig"?Bq(e):r==="dockerfile"?Wq(e):r==="gitignore"?Uq(e):r==="log"?Hq(e):r==="python"?Bc(e,xq,"#"):r==="shell"?Bc(e,Sq,"#"):r==="sql"?Eq(e):r==="html"||r==="xml"?Mq(e):r==="css"?Aq(e):r==="markdown"?[{text:e,kind:"plain"}]:Bc(e,kq,"//")}function Bc(e,t,r){const i=[];let a=0;for(;a<e.length;){const u=e.slice(a);if(u.startsWith(r)){i.push({text:u,kind:"comment"});break}const c=/^(?:'[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|`[^`\\]*(?:\\.[^`\\]*)*`)/.exec(u);if(c){i.push({text:c[0],kind:"string"}),a+=c[0].length;continue}const d=/^(?:0x[\da-fA-F]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/.exec(u);if(d){i.push({text:d[0],kind:"number"}),a+=d[0].length;continue}const m=/^[A-Za-z_][\w$-]*/.exec(u);if(m){const v=m[0],g=v.toLowerCase();v==="true"||v==="false"||g==="true"||g==="false"?i.push({text:v,kind:"boolean"}):v==="null"||v==="None"||g==="none"?i.push({text:v,kind:"null"}):t.has(v)||t.has(g)?i.push({text:v,kind:"keyword"}):i.push({text:v,kind:"plain"}),a+=v.length;continue}const f=/^(?:===|!==|==|!=|<=|>=|=>|&&|\|\||[+\-*/%=<>!?:|&^~]+)/.exec(u);if(f){i.push({text:f[0],kind:"operator"}),a+=f[0].length;continue}i.push({text:u[0]??"",kind:"plain"}),a+=1}return i}function Rq(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 u=/^(?:-?\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i.exec(i);if(u){t.push({text:u[0],kind:"number"}),r+=u[0].length;continue}const c=/^(?:true|false|null)\b/.exec(i);if(c){const m=c[0]==="null"?"null":"boolean";t.push({text:c[0],kind:m}),r+=c[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 Mq(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 u=/^([\w:-]+)(=)/.exec(i);if(u){t.push({text:u[1]??"",kind:"attr"}),t.push({text:u[2]??"",kind:"operator"}),r+=u[0].length;continue}const c=/^(?:'[^']*'|"[^"]*")/.exec(i);if(c){t.push({text:c[0],kind:"string"}),r+=c[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 Aq(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 u=/^([A-Za-z-]+)(\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 c=/^(?:#(?:[\da-fA-F]{3,8})|\d+(?:\.\d+)?(?:px|rem|em|vh|vw|%)?)/.exec(i);if(c){t.push({text:c[0],kind:"number"}),r+=c[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 Eq(e){return Bc(e,Cq,"--")}function Iq(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 u=/^(?:'[^']*'|"[^"]*")/.exec(i);if(u){t.push({text:u[0],kind:"string"}),r+=u[0].length;continue}const c=/^(?:-?\d+(?:\.\d+)?)/.exec(i);if(c){t.push({text:c[0],kind:"number"}),r+=c[0].length;continue}const d=/^(?:true|false|yes|no|null|~)\b/i.exec(i);if(d){const f=d[0].toLowerCase(),v=f==="null"||f==="~"?"null":"boolean";t.push({text:d[0],kind:v}),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 Lq(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 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 c=dm(i,{trueValues:["true"],falseValues:["false"],nullValues:[]});if(c){t.push(...c.tokens),r+=c.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 b0(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 u=/^(\[[^\]]+\])/.exec(i);if(u){t.push({text:u[0],kind:"tag"}),r+=u[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 d=dm(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 Fq(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 u=e.slice(i),c=/^([A-Za-z_][A-Za-z0-9_]*)(=)/.exec(u);if(!c)return b0(e);a.push({text:c[1]??"",kind:"attr"}),a.push({text:c[2]??"",kind:"operator"});const d=u.slice(c[0].length),m=dm(d,{trueValues:["true"],falseValues:["false"],nullValues:["null"]});return m?(a.push(...m.tokens),a):(a.push({text:d,kind:"plain"}),a)}function _q(e){return mv(e,{commentPrefixes:["#","!"],allowSection:!1,delimiters:["=",":"]})}function Oq(e){return mv(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["=",":"]})}function Bq(e){return mv(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["="]})}function Wq(e){return Bc(e,jq,"#")}function Uq(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 Hq(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 u=/^(?:\[(TRACE|DEBUG|INFO|WARN|WARNING|ERROR|FATAL)\])/.exec(i);if(u){t.push({text:i.slice(0,u[0].length),kind:"keyword"}),r+=u[0].length;continue}const c=/^[A-Za-z_][\w-]*/.exec(i);if(c){const m=c[0];Nq.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 mv(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 u=[{text:i[1]??"",kind:"attr"},{text:i[2]??"",kind:"operator"}],c=e.slice(i[0].length),d=zq(c);return d.length&&u.push(...d),u}function zq(e){if(!e)return[];const t=[];let r=0;for(;r<e.length;){const i=e.slice(r),a=dm(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 dm(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 u=a[0],c=u.toLowerCase();return t.trueValues.includes(c)?{tokens:[{text:u,kind:"boolean"}],length:u.length}:t.falseValues.includes(c)?{tokens:[{text:u,kind:"boolean"}],length:u.length}:t.nullValues.includes(c)?{tokens:[{text:u,kind:"null"}],length:u.length}:{tokens:[{text:u,kind:"plain"}],length:u.length}}function pv(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 fv(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 v0(e){switch(fv(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 qq(e){return pv(e)==="markdown"}function Gg(e){return pv(e)==="html"}function Ud(e,t){return e instanceof ei?e.message:t}function $q(){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 Vq(e){const t=[],r=e.replace(/\r\n/g,`
|
|
108
|
+
`).split(`
|
|
109
|
+
`);let i=0,a=0;for(const u of r){if(u.startsWith("diff --git")||u.startsWith("index ")||u.startsWith("--- ")||u.startsWith("+++ ")){t.push({kind:"meta",text:u,oldLineNo:null,newLineNo:null});continue}const c=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(u);if(c){i=parseInt(c[1],10),a=parseInt(c[2],10),t.push({kind:"hunk",text:u,oldLineNo:null,newLineNo:null});continue}if(u.startsWith(" ")||u===""){t.push({kind:"context",text:u.slice(1),oldLineNo:i,newLineNo:a}),i++,a++;continue}if(u.startsWith("+")){t.push({kind:"add",text:u.slice(1),oldLineNo:null,newLineNo:a}),a++;continue}if(u.startsWith("-")){t.push({kind:"remove",text:u.slice(1),oldLineNo:i,newLineNo:null}),i++;continue}t.push({kind:"meta",text:u,oldLineNo:null,newLineNo:null})}return t}function Gq(e){if(!(e!=null&&e.trim()))return[];const t=Vq(e),r=[];let i=0,a=[];function u(){if(a.length===0){i=0;return}const c=i>0?"modify":"add";Kq(r,a,c),i=0,a=[]}for(const c of t){if(c.kind==="remove"){i+=1;continue}if(c.kind==="add"){c.newLineNo!==null&&a.push(c.newLineNo);continue}u()}return u(),r}function Kq(e,t,r){const i=t.filter(c=>c>0);if(i.length===0)return;let a=i[0]??1,u=a;for(let c=1;c<i.length;c+=1){const d=i[c]??u;if(d===u+1){u=d;continue}e.push({line:a,span:u-a+1,kind:r}),a=d,u=d}e.push({line:a,span:u-a+1,kind:r})}function Yq({markers:e,totalLines:t,scrollContainerRef:r}){const[i,a]=p.useState({top:0,height:0});if(p.useEffect(()=>{const c=r.current;if(!c){a({top:0,height:0});return}const d=c;function m(){const{clientHeight:f,scrollHeight:v,scrollTop:g}=d;if(v<=0||f<=0||v<=f){a({top:0,height:0});return}const w=f/v,y=Math.min(100,Math.max(12,w*100)),x=v-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 u=Math.max(t,1);return n.jsxs("div",{className:"file-overview-ruler","data-testid":"file-overview-ruler","aria-hidden":"true",children:[e.map(c=>{const d=(c.line-1)/u*100,m=Math.max(2,c.span/u*100);return n.jsx("div",{className:`file-overview-marker is-${c.kind}`,"data-kind":c.kind,style:{top:`${d}%`,height:`${m}%`}},`${c.kind}-${c.line}-${c.span}`)}),i.height>0?n.jsx("div",{className:"file-overview-viewport",style:{top:`${i.top}%`,height:`${i.height}%`}}):null]})}function jo(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 No(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 Xq=new Set([".ds_store","thumbs.db","ehthumbs.db","desktop.ini",".spotlight-v100",".trashes",".fseventsd","__macosx","$recycle.bin","system volume information",".apdisk",".appledouble",".temporaryitems"]),Qq=["._"];function Ff(e){return e.split(/[/\\]/).filter(Boolean).pop()??e}function Jq(e){const t=e.trim().toLowerCase();return t?Xq.has(t)||Qq.some(r=>t.startsWith(r)):!1}function gv(e,t,r){return r?[...e]:e.filter(i=>!Jq(t(i)))}function ch(e,t){return gv(e,r=>r.name,t)}function Zq(e,t){return t?e:Object.entries(e).reduce((r,[i,a])=>(r[i]=ch(a,!1),r),{})}async function _f(e,t){const[r,i]=await Promise.all([sT(t),tL(e)]);return e$(r.changes,i.items)}function e$(e,t){const r=new Set(t.map(i=>dh(i.path)));return e.filter(i=>r.has(dh(i.path))||i.oldPath!==null&&r.has(dh(i.oldPath)))}function t$(e){const t=gC("","");for(const r of e){const i=dh(r.path),a=i.split("/").filter(Boolean);let u=t;a.forEach((c,d)=>{const m=a.slice(0,d+1).join("/");if(d===a.length-1){u.children.set(`file:${m}`,{kind:"file",name:c,path:i,change:r});return}const f=`directory:${m}`,v=u.children.get(f);if(v&&v.kind==="directory"){u=v;return}const g=gC(c,m);u.children.set(f,g),u=g})}return k0(y0([...t.children.values()]))}function w0(e,t){const r=e.oldPath?`${e.oldPath} -> ${e.path}`:e.path;return bv(e)?`${r} ${t}`:r}function bv(e){return e.status==="D"||e.stagedStatus==="D"||e.worktreeStatus==="D"}function uh(e){return e.split("/").filter(Boolean).pop()??e}function dh(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").trim()}function gC(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function y0(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:y0([...t.children.values()])}:t)}function k0(e){return e.map(t=>{var c;if(t.kind!=="directory")return t;const r=k0(t.children);let i=t.name,a=t.path,u=r;for(;u.length===1&&((c=u[0])==null?void 0:c.kind)==="directory";){const d=u[0];i=`${i}/${d.name}`,a=d.path,u=d.children}return{kind:"directory",name:i,path:a,children:u}})}const n$=450,r$=60*1e3,bC=20,vC=16;function i$({sessionId:e,workspaceId:t,showSystemFiles:r,selectedPath:i,refreshVersion:a,onCountChange:u,onSelectFile:c,onOpenFile:d}){const[m,f]=p.useState("tree"),[v,g]=p.useState([]),[w,y]=p.useState(!0),[x,C]=p.useState(!1),[j,T]=p.useState([]),P=p.useRef(null),{showToast:I}=ir();p.useEffect(()=>{const K=Rr(Hd(t,e),r$);f("tree"),g(K??[]),y(K===null),C(!1),T([]),P.current=null},[e,t]),p.useEffect(()=>{let K=!1;async function O(){y(!0);try{const F=await _f(e,t);K||(g(F),Zr(Hd(t,e),F))}catch(F){K||I({title:Of(F,o("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{K||y(!1)}}return O(),()=>{K=!0}},[a,e,I,t]);async function Z(){y(!0);try{const K=await _f(e,t);g(K),Zr(Hd(t,e),K)}catch(K){I({title:Of(K,o("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{y(!1)}}async function q(){if(_.length!==0){C(!0);try{await oT(t,_.map(O=>O.path));const K=await _f(e,t);g(K),Zr(Hd(t,e),K),I({title:o("conversation.filePanelSessionStageSuccess"),tone:"success"})}catch(K){I({title:Of(K,o("git.stageFailed")),tone:"error"})}finally{C(!1)}}}function B(K){T(O=>O.includes(K)?O.filter(F=>F!==K):[...O,K])}function E(K){const O=Date.now(),F=P.current;return P.current={filePath:K,timestamp:O},(F==null?void 0:F.filePath)===K&&O-F.timestamp<=n$}async function A(K,O){if(O&&E(K)){await d(K),P.current=null;return}O||(P.current=null),await c(K)}const H=p.useMemo(()=>gv(v,K=>uh(K.path),r),[v,r]),_=H.filter(K=>!K.staged),Y=t$(H),z=new Set(j);return p.useEffect(()=>{u==null||u(H.length)},[u,H.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 Z(),disabled:w||x,children:o("conversation.filePanelRefresh")}),n.jsx("button",{className:"primary-button",type:"button",onClick:()=>void q(),disabled:x||_.length===0,children:o("conversation.filePanelSessionStageAll")})]})]}),n.jsxs("div",{className:"file-panel-session-summary",children:[n.jsx("span",{children:`${o("conversation.filePanelSessionSummary")} ${H.length}`}),n.jsx("span",{children:`${o("conversation.filePanelSessionUnstagedSummary")} ${_.length}`})]}),n.jsx("div",{className:"file-tree",children:w?n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelSessionLoading")}):H.length===0?n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelSessionEmpty")}):m==="tree"?x0({nodes:Y,depth:0,collapsedPathSet:z,selectedPath:i,onToggleTreePath:B,onFileClick:A}):s$({items:H,selectedPath:i,onFileClick:A})})]})}function x0({nodes:e,depth:t,collapsedPathSet:r,selectedPath:i,onToggleTreePath:a,onFileClick:u}){return e.map(c=>{if(c.kind==="directory"){const d=!r.has(c.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:`${bC+t*vC}px`},onClick:()=>a(c.path),children:[n.jsx("span",{className:"file-tree-chevron","aria-hidden":"true",children:d?"v":">"}),n.jsx("span",{className:"file-tree-label",children:c.name})]}),d?n.jsx("div",{className:"file-tree-children",children:x0({nodes:c.children,depth:t+1,collapsedPathSet:r,selectedPath:i,onToggleTreePath:a,onFileClick:u})}):null]},`session-directory:${c.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===c.change.path,"data-kind":"file",style:{paddingInlineStart:`${bC+t*vC}px`},onClick:()=>void u(c.change.path,!bv(c.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":No(c.name),"aria-hidden":"true",children:jo(c.name)}),n.jsxs("span",{className:"file-tree-label",children:[n.jsx("span",{className:"file-tree-name",children:c.name}),n.jsx("span",{className:"file-tree-path",children:w0(c.change,o("conversation.filePanelSessionDeleted"))})]}),n.jsxs("span",{className:"file-session-item-meta",children:[n.jsx("span",{className:"file-session-badge","data-status":c.change.status,children:c.change.status}),n.jsx("span",{className:"file-session-badge subtle",children:c.change.staged?o("git.stagedLabel"):o("git.workingTreeLabel")})]})]})},`session-file:${c.path}`)})}function s$({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,!bv(i)),children:[n.jsx("span",{className:"git-tree-file-icon","data-kind":No(uh(i.path)),"aria-hidden":"true",children:jo(uh(i.path))}),n.jsxs("span",{className:"file-tree-label",children:[n.jsx("span",{className:"file-tree-name",children:uh(i.path)}),n.jsx("span",{className:"file-tree-path",children:w0(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 Hd(e,t){return`file-panel.session-changes.${e}.${t}`}function Of(e,t){return e instanceof ei?e.message:typeof e=="object"&&e&&"message"in e?String(e.message??t):t}const tr="",a$=450,Ns=8,zd=4,o$=176,l$=120,c$=300*1e3,u$=60*1e3,wC=1600,d$=20,h$=16;function vv({className:e,sessionId:t,workspaceId:r,hideHeading:i=!1,externalRevealRequest:a=null,externalWindowMode:u=!1,workbenchShellOverrides:c}){var Ii,Fs;const d=gr(),{navigationGroups:m,subscribeFileTree:f,requestFileTreeRefresh:v,addFileTreeSnapshotListener:g,subscribeGitSnapshot:w,requestGitRefresh:y,addGitSnapshotListener:x}={...d,...c},[C,j]=p.useState({}),[T,P]=p.useState([]),[I,Z]=p.useState([]),[q,B]=p.useState(tr),[E,A]=p.useState([]),[H,_]=p.useState(null),[Y,z]=p.useState(!1),[K,O]=p.useState(!1),[F,te]=p.useState(!1),[de,W]=p.useState(!1),[M,N]=p.useState(""),[L,X]=p.useState(null),[D,be]=p.useState(!1),[ce,le]=p.useState(null),[ye,Se]=p.useState("workspace"),[_e,Ce]=p.useState(0),[Nt,ct]=p.useState(0),[gt,ft]=p.useState(!1),[rt,fe]=p.useState(!1),[ue,Oe]=p.useState(null),[qe,nt]=p.useState(null),[yt,Me]=p.useState(null),[Le,pt]=p.useState(null),[ut,we]=p.useState([]),[xe,Qe]=p.useState(!1),[Fe,dt]=p.useState(null),It=p.useRef({}),qt=p.useRef([]),Ht=p.useRef(tr),Ft=p.useRef(!1),Dt=p.useRef(null),bt=p.useRef(null),Qt=p.useRef(null),zt=p.useRef(null),on=p.useRef(null),ae=p.useRef(null),$e=p.useRef(0),ht=p.useRef(new Map),{showToast:Wt}=ir(),jn=cr(),ln=Zs($=>$.showSystemFiles),Ut=!!(t!=null&&t.trim()),dn=i&&jn.isMobile;p.useEffect(()=>{tn("file_panel.props",{sessionId:t,workspaceId:r,externalWindowMode:u})},[u,t,r]),p.useEffect(()=>{Ht.current=q},[q]);function Jt($){j(he=>{const me=typeof $=="function"?$(he):$;return It.current=me,me})}function nn($){P(he=>{const me=typeof $=="function"?$(he):$;return qt.current=me,me})}p.useEffect(()=>{var st,xt;if(Be(),!r){Be(),Ft.current=!1,It.current={},qt.current=[],Ht.current=tr,Jt({}),nn([]),Z([]),B(tr),W(!1),N(""),X(null),be(!1),z(!1),Qe(!1),dt(null),A([]),_(null),Oe(null),nt(null),Me(null);return}Ft.current=!0;const $=Rr(CC(r),c$);tn("file_panel.workspace_snapshot",{workspaceId:r,cached:!!$,cachedRootItems:((xt=(st=$==null?void 0:$.treeCache)==null?void 0:st[tr])==null?void 0:xt.length)??0,cachedDirectoryCount:Object.keys(($==null?void 0:$.treeCache)??{}).length});const he=P$(($==null?void 0:$.activeDirectoryPath)??tr,($==null?void 0:$.treeCache)??{}),me=SC(($==null?void 0:$.expandedDirectories)??[],he),et=Vd(($==null?void 0:$.treeCache)??{},he,me);It.current=et,qt.current=me,Ht.current=he,Jt(et),nn(me),Z([]),B(he),z(!1),O(!1),W(!1),N(""),X(null),be(!1),queueMicrotask(()=>{Ft.current=!1})},[r]),p.useEffect(()=>{if(!a||a.workspaceId!==r)return;const $=()=>{if(ae.current===a.requestId)return;ae.current=a.requestId,Se("workspace"),(a.openViewer?Dn(a.filePath):En(a.filePath)).catch(me=>{Wt({title:Ts(me,o("conversation.filePanelOpenFailed")),tone:"error"})})};if(Ft.current){queueMicrotask($);return}$()},[a,Dn,En,Wt,r]),p.useEffect(()=>{if(r)return g($=>{$.workspaceId===r&&(Jt(he=>({...he,[$.path]:$.items})),$.path===tr&&z(!1),Z(he=>he.filter(me=>me!==$.path)),kn($.path,$.items))})},[g,r]),p.useEffect(()=>()=>{Be()},[]),p.useEffect(()=>{r&&f(r,Wf(qt.current,Ht.current))},[q,T,f,r]),p.useEffect(()=>{A([]),_(null),le(null),dt(null),Ce(0),ft(!1),fe(!1),Oe(null),nt(null),Me(null),Dt.current=null,$e.current+=1},[t]),p.useEffect(()=>{!Ut&&ye==="session"&&Se("workspace")},[ye,Ut]),p.useEffect(()=>{if(!gt&&!rt&&!ue)return;function $(me){var Zt,Ln,sr;if(!(me.target instanceof Node))return;const et=((Zt=bt.current)==null?void 0:Zt.contains(me.target))??!1,st=((Ln=Qt.current)==null?void 0:Ln.contains(me.target))??!1,xt=((sr=zt.current)==null?void 0:sr.contains(me.target))??!1;!et&&!st&&!xt&&(ft(!1),fe(!1),Oe(null),nt(null))}function he(me){me.key==="Escape"&&(ft(!1),fe(!1),Oe(null),nt(null))}return document.addEventListener("pointerdown",$),document.addEventListener("keydown",he),()=>{document.removeEventListener("pointerdown",$),document.removeEventListener("keydown",he)}},[gt,rt,ue]),p.useLayoutEffect(()=>{if(!ue||typeof window>"u"){nt(null);return}const $=ue;function he(){const et=zt.current;if(!et)return;const st=et.getBoundingClientRect();nt(y$({x:$.positionX,y:$.positionY},{width:st.width||o$,height:st.height||et.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}he();const me=window.requestAnimationFrame(he);return window.addEventListener("resize",he),window.addEventListener("scroll",he,!0),()=>{window.cancelAnimationFrame(me),window.removeEventListener("resize",he),window.removeEventListener("scroll",he,!0)}},[ue]),p.useEffect(()=>{if(!r)return;const $=SC(T,q),he=Vd(C,q,$);Zr(CC(r),{treeCache:he,expandedDirectories:$,activeDirectoryPath:q})},[q,T,C,r]),p.useEffect(()=>{if(Ft.current)return;const $=Vd(C,q,T);R$(C,$)||Jt($)},[q,T,C]),p.useEffect(()=>{let $=!1;const he=(r==null?void 0:r.trim())??null;async function me(st){if(!he)return;const xt=ch(It.current[tr]??[],ln),Zt=(st==null?void 0:st.silent)!==!0&&xt.length===0;Zt&&z(!0),tn("file_panel.load_root_tree.start",{sessionId:t,workspaceId:he,silent:(st==null?void 0:st.silent)===!0,cachedRootItems:xt.length});try{const Ln=await fn(tr,{force:!0});$||(tn("file_panel.load_root_tree.end",{sessionId:t,workspaceId:he,itemCount:Ln.length}),Jt(sr=>({...Vd(sr,Ht.current,qt.current),[tr]:Ln})))}catch(Ln){!$&&!jC(Ln)&&Wt({title:Ts(Ln,o("conversation.filePanelLoadFailed")),tone:"error"})}finally{!$&&Zt&&z(!1)}}if(ch(It.current[tr]??[],ln).length>0){const st=window.setTimeout(()=>{he&&(f(he,Wf(qt.current,Ht.current)),me({silent:!0}))},1500);return()=>{$=!0,window.clearTimeout(st)}}return me(),()=>{$=!0}},[t,ln,Wt,r]),p.useEffect(()=>{if(!r||!t){ct(0);return}const $=Rr(M$(r,t),u$);tn("file_panel.session_change_count.snapshot",{sessionId:t,workspaceId:r,cached:$!==null,cachedCount:$}),ct($??0)},[t,_e,r]),p.useEffect(()=>{if(!r){we([]);return}const $=r.trim();w($),y($)},[r,w,y]),p.useEffect(()=>{if(!r)return;const $=r.trim();return x(he=>{var me;he.workspaceId===$&&we(((me=he.status)==null?void 0:me.changes)??[])})},[x,r]);const hn=p.useMemo(()=>gv(ut,$=>Ff($.path),ln),[ut,ln]),ee=p.useMemo(()=>{const $=new Map,he=new Set;for(const me of hn){const et=me.path.replace(/\\/g,"/"),st=me.worktreeStatus??me.stagedStatus??me.status;$.set(et,st);const xt=et.split("/");for(let Zt=1;Zt<xt.length;Zt++)he.add(xt.slice(0,Zt).join("/"))}return{statusByPath:$,changedDirs:he}},[hn]),ne=p.useMemo(()=>Zq(C,ln),[ln,C]),pe=p.useMemo(()=>L===null?null:ch(L,ln),[L,ln]),ve=ne[tr]??[],We=de&&pe!==null,Ye=p.useMemo(()=>xe?Kg(ve,ne,ee.statusByPath,ee.changedDirs):ve,[ee.changedDirs,ee.statusByPath,ve,xe,ne]),mt=p.useMemo(()=>We?(pe??[]).map($=>hs($.path,$.kind)):S0(Ye,ne,T,xe,ee.statusByPath,ee.changedDirs),[T,ee.changedDirs,ee.statusByPath,We,xe,pe,ne,Ye]),Je=((Ii=m.find($=>$.workspace.id===r))==null?void 0:Ii.workspace)??null,Ke=xC(E),re=(Ke==null?void 0:Ke.path)??null,Pe=(Ke==null?void 0:Ke.kind)==="file"?Ke.path:null,ot=p.useMemo(()=>new Set(E.map($=>$.path)),[E]),kt=p.useMemo(()=>$d(E),[E]),an=!!(Je!=null&&Je.path&&E.length===1&&re),$t=E.length===1&&(Ke==null?void 0:Ke.kind)==="file",Bt=kt.length>0,_t=kt.length>0,Sn=!!(Le!=null&&Le.items.length&&r),On=!!((Pe?Qs(Pe):q)&&T.length);async function Mn($,he=!1){if(!r)return[];if(!he){const me=It.current[$];if(me)return me}$===tr?z(!0):Z(me=>mh(me,$));try{const me=await fn($,{force:he});return Jt(et=>({...et,[$]:me})),me}catch(me){throw jC(me)||Wt({title:Ts(me,o("conversation.filePanelLoadFailed")),tone:"error"}),me}finally{$===tr?z(!1):Z(me=>me.filter(et=>et!==$))}}async function Tt($){if(!r)return;const he=($==null?void 0:$.activeDirectoryPath)??Ht.current,me=($==null?void 0:$.expandedDirectories)??qt.current,et=D$(It.current,he,me);tn("file_panel.refresh_tree_cache.start",{sessionId:t,workspaceId:r,targetDirectories:et});const xt=(await Promise.all(et.map(async Zt=>{const Ln=await fn(Zt,{force:!0});return[Zt,Ln]}))).reduce((Zt,[Ln,sr])=>(Zt[Ln]=sr,Zt),{});tn("file_panel.refresh_tree_cache.end",{sessionId:t,workspaceId:r,targetDirectories:et,directoryCount:Object.keys(xt).length}),Jt(xt)}async function fn($,he){if(!r)return[];if(!(he!=null&&he.force)){const et=It.current[$];if(et)return et}const me=Wf(mh(qt.current,$),$||Ht.current);return f(r,me),v(r,[$]),Xt($,wC,{allowCached:(he==null?void 0:he.force)!==!0})}function Xt($,he=wC,me){const et=It.current[$];return(me==null?void 0:me.allowCached)!==!1&&et?Promise.resolve(et):new Promise((st,xt)=>{const Zt=window.setTimeout(()=>{Te($,Zt),xt(new Error(`FILE_TREE_SNAPSHOT_TIMEOUT:${$}`))},he),Ln=ht.current.get($)??[];ht.current.set($,[...Ln,{resolve:st,reject:xt,timerId:Zt}])})}function kn($,he){const me=ht.current.get($)??[];me.length!==0&&(ht.current.delete($),me.forEach(et=>{window.clearTimeout(et.timerId),et.resolve(he)}))}function Te($,he){const et=(ht.current.get($)??[]).filter(st=>st.timerId!==he);if(et.length===0){ht.current.delete($);return}ht.current.set($,et)}function Be(){for(const[$,he]of ht.current.entries())he.forEach(me=>{window.clearTimeout(me.timerId),me.reject(new Error(`FILE_TREE_ABORTED:${$}`))});ht.current.clear()}function lt($){A([$]),_($.path)}function Mt($){B($.kind==="directory"?$.path:Qs($.path))}function rn($){const he=f$(mt,H,$);A(he),_($.path),Mt($)}function Nn($){const he=p$(E,$),me=xC(he);A(he),_($.path),me&&Mt(me)}function Vt($){lt($),Mt($)}function Un($,he){if(he!=null&&he.shiftKey){rn($);return}if(qd(he)){Nn($);return}Vt($)}async function qn($,he=!1){const me=eu($,he);if(!me.length){B(tr);return}nn(et=>N0(et,me)),B(me[me.length-1]??tr);for(const et of me)try{await Mn(et)}catch{return}}async function En($){const he=hs($,"file");lt(he),Mt(he),await qn($)}async function Dn($){le($),dt(null),Dt.current=null,$e.current+=1,En($);const he=$e.current,me=$.replace(/\\/g,"/"),et=ee.statusByPath.get(me);if(r&&et&&et!=="?"&&et!=="D")try{const st=await aT(r,$,!1);$e.current===he&&dt(st.content||null)}catch{$e.current===he&&dt(null)}}function zr($){const he=Date.now(),me=Dt.current;return Dt.current={filePath:$,timestamp:he},(me==null?void 0:me.filePath)===$&&he-me.timestamp<=a$}function hr(){Dt.current=null}async function qr($,he){const me=hs($,"file");if(he!=null&&he.shiftKey||qd(he)){hr(),Un(me,he);return}if(zr($)){await Dn($);return}Un(me,he),await qn($)}function xn(){W(!1),N(""),X(null),hr()}async function $r($,he){const me=hs($.path,$.kind);if(he!=null&&he.shiftKey||qd(he)){hr(),Un(me,he);return}if($.kind==="directory"){xn(),Un(me,he),await br($.path);return}if(zr($.path)){xn(),await Dn($.path);return}await En($.path)}async function br($){if(lt(hs($,"directory")),B($),!qt.current.includes($))try{await Mn($),nn(he=>mh(he,$))}catch{}}async function In($){if(lt(hs($,"directory")),B($),qt.current.includes($)){Mr($);return}await br($)}function Mr($){nn(he=>he.filter(me=>me!==$&&!me.startsWith(`${$}/`))),B(Qs($)),A([]),_(null)}async function Bn(){if(!r)return;const $=r;try{if(y($),await Tt(),Pe&&await qn(Pe),We&&M.trim()){const he=await Cc($,M.trim());X(he.items)}}catch(he){Wt({title:Ts(he,o("conversation.filePanelLoadFailed")),tone:"error"})}}async function Q($){if($==null||$.preventDefault(),!r||!M.trim()){X(null);return}be(!0);try{const he=await Cc(r,M.trim());X(he.items)}catch(he){Wt({title:Ts(he,o("conversation.filePanelSearchFailed")),tone:"error"})}finally{be(!1)}}function je(){if(de){W(!1),N(""),X(null);return}W(!0)}function G($){fe(!1),$()}function Ee(){var $;($=on.current)==null||$.click()}async function Ge($){var xt;const he=((xt=$.target.files)==null?void 0:xt[0])??null;if($.target.value="",!he||!r)return;const me=m$(he.name);if(!me){Wt({title:o("conversation.filePanelUploadFailed"),tone:"error"});return}const et=yC(q,Ke),st=kC(et,me);te(!0);try{const Zt=await S$(he);await qL({workspaceId:r,path:st,contentBase64:Zt}),await Tt(),await En(st),Wt({title:o("conversation.filePanelUploadSuccess",{name:me}),tone:"success"})}catch(Zt){Wt({title:Ts(Zt,o("conversation.filePanelUploadFailed")),tone:"error"})}finally{te(!1)}}async function At($=Pe){if(!(!r||!$)){te(!0);try{const he=await $L(r,$),me=C$(he.contentBase64);j$(he.fileName,new Blob([me],{type:"application/octet-stream"})),Wt({title:o("conversation.filePanelDownloadSuccess",{name:he.fileName}),tone:"success"})}catch(he){Wt({title:Ts(he,o("conversation.filePanelDownloadFailed")),tone:"error"})}finally{te(!1)}}}function gn(){const $=Pe?Qs(Pe):q;!$||!qt.current.includes($)||Mr($)}async function bn($,he=yC(q,Ke)){if(!r)return;const me=he,et=me?`${me}/`:"",st=window.prompt(o($==="create_file"?"conversation.filePanelCreateFilePrompt":"conversation.filePanelCreateDirectoryPrompt"),et);if(!(st!=null&&st.trim()))return;const xt=st.trim();O(!0);try{await Vp({workspaceId:r,opType:$,dstPath:xt,content:$==="create_file"?"":void 0}),await Tt(),$==="create_directory"?(await qn(xt,!0),lt(hs(xt,"directory")),B(xt)):await En(xt)}catch(Zt){Wt({title:Ts(Zt,o("conversation.filePanelMutateFailed")),tone:"error"})}finally{O(!1)}}function wn($,he=kt){var et;if(he.length===0)return;const me=$d(he);pt({mode:$,items:me}),A(me),_(((et=me[me.length-1])==null?void 0:et.path)??null),Wt({title:$==="copy"?o("conversation.filePanelCopySelectionSuccess",{count:me.length}):o("conversation.filePanelCutSelectionSuccess",{count:me.length}),tone:"success"}),Oe(null)}async function oi($=v$(Ke,q)){if(!r||!Le||!Le.items.length)return;const he=$??tr,me=Le.items.map(et=>({source:et,destinationPath:kC(he,Ff(et.path)||et.path)}));O(!0);try{for(const xt of me)Le.mode==="cut"&&hh(xt.source.path)===hh(xt.destinationPath)||await Vp({workspaceId:r,opType:Le.mode==="copy"?"copy":"move",srcPath:xt.source.path,dstPath:xt.destinationPath});const et=me.map(xt=>hs(xt.destinationPath,xt.source.kind)),st=et[et.length-1]??null;if(Le.mode==="cut"&&pt(null),A(et),_((st==null?void 0:st.path)??null),st&&Mt(st),hr(),await Tt({activeDirectoryPath:(st==null?void 0:st.kind)==="directory"?st.path:st?Qs(st.path):Ht.current,expandedDirectories:qt.current}),We&&M.trim()){const xt=await Cc(r,M.trim());X(xt.items)}Ce(xt=>xt+1),Wt({title:o("conversation.filePanelPasteSuccess",{count:et.length}),tone:"success"}),Oe(null)}catch(et){await Tt().catch(()=>{}),Wt({title:Ts(et,o("conversation.filePanelPasteFailed")),tone:"error"})}finally{O(!1)}}function li($=kt){!$.length||K||(Me($d($)),Oe(null))}async function Ar(){var he,me;if(!r||!(yt!=null&&yt.length))return;const $=$d(yt);O(!0);try{for(const xt of $)await Vp({workspaceId:r,opType:"delete",srcPath:xt.path});const et=w$(q,$),st=qt.current.filter(xt=>!$.some(Zt=>Zt.kind==="directory"&&_h(Zt.path,xt)));if(ce&&$.some(xt=>_h(xt.path,ce))&&($e.current+=1,le(null),dt(null)),Me(null),A([]),_(null),Ht.current=et,qt.current=st,B(et),nn(st),hr(),await Tt({activeDirectoryPath:et,expandedDirectories:st}),We&&M.trim()){const xt=await Cc(r,M.trim());X(xt.items)}Ce(xt=>xt+1),Wt({title:$.length===1?o("conversation.filePanelDeleteSuccess",{name:Ff(((he=$[0])==null?void 0:he.path)??"")||((me=$[0])==null?void 0:me.path)||""}):o("conversation.filePanelDeleteSelectionSuccess",{count:$.length}),tone:"success"})}catch(et){Wt({title:Ts(et,o("conversation.filePanelMutateFailed")),tone:"error"})}finally{O(!1)}}async function Rn($,he=Ke){const me=(Je==null?void 0:Je.path)??"",et=(he==null?void 0:he.path)??null;if(et===null||!me){ft(!1);return}try{const st=x$(me),xt=$==="absolute"?k$(me,et,st):hh(et,st);await N$(xt,jn),Wt({title:o($==="absolute"?"conversation.filePanelCopyAbsolutePathSuccess":"conversation.filePanelCopyRelativePathSuccess"),tone:"success"})}catch(st){Wt({title:st instanceof Error?st.message:o("conversation.filePanelCopyPathFailed"),tone:"error"})}finally{ft(!1),Oe(null)}}function Or($,he,me){return[{id:`open-${$.path}`,label:$.kind==="directory"?T.includes($.path)?o("conversation.filePanelCollapseDirectory"):o("conversation.filePanelExpandDirectory"):o("conversation.filePanelOpenFile"),onSelect:()=>{if($.kind==="directory"){In($.path);return}Dn($.path)}},{id:`download-${$.path}`,label:o("conversation.filePanelDownload"),disabled:$.kind!=="file"||F,onSelect:()=>{At($.kind==="file"?$.path:null)}},{id:`create-file-${$.path}`,label:o("conversation.filePanelNewFile"),disabled:!r||K||F,onSelect:()=>{bn("create_file",me)}},{id:`create-directory-${$.path}`,label:o("conversation.filePanelNewDirectory"),disabled:!r||K||F,onSelect:()=>{bn("create_directory",me)}},{id:`copy-${$.path}`,label:o("conversation.filePanelCopy"),disabled:he.length===0,onSelect:()=>wn("copy",he)},{id:`cut-${$.path}`,label:o("conversation.filePanelCut"),disabled:he.length===0,onSelect:()=>wn("cut",he)},{id:`paste-${$.path}`,label:o("conversation.filePanelPaste"),disabled:!Sn,onSelect:()=>{oi(me)}},{id:`copy-relative-${$.path}`,label:o("conversation.filePanelCopyRelativePath"),onSelect:()=>{Rn("relative",$)}},{id:`copy-absolute-${$.path}`,label:o("conversation.filePanelCopyAbsolutePath"),onSelect:()=>{Rn("absolute",$)}},{id:`delete-${$.path}`,label:o("conversation.filePanelDelete"),disabled:he.length===0||K||F,onSelect:()=>li(he)}]}async function Vr($,he){if(jn.isMobile)return;$.preventDefault();const me=hs(he.path,he.kind),et=ot.has(me.path)?kt:[me],st=me.kind==="directory"?me.path:Qs(me.path);ot.has(me.path)||Vt(me);const xt=Or(me,et,st);if(jn.isDesktop){await VN(xt);return}jn.isWeb&&(ft(!1),fe(!1),Oe({positionX:$.clientX,positionY:$.clientY,items:xt}))}p.useEffect(()=>{if(ye!=="workspace")return;function $(he){if(!g$(he)||he.altKey||he.shiftKey||b$(he.target))return;const me=he.key.toLowerCase();if(me==="c"&&_t){he.preventDefault(),wn("copy");return}if(me==="x"&&_t){he.preventDefault(),wn("cut");return}me==="v"&&Sn&&(he.preventDefault(),oi())}return document.addEventListener("keydown",$),()=>{document.removeEventListener("keydown",$)}},[ye,_t,Sn,wn,oi]);function Ot($,he){return n.jsx(n.Fragment,{children:$.map(me=>{const et=hs(me.path,me.kind),st=me.kind==="directory",xt=st&&T.includes(me.path),Zt=st&&I.includes(me.path),Ln=ne[me.path]??[],sr=xe?Kg(Ln,ne,ee.statusByPath,ee.changedDirs):Ln,Sr=ot.has(me.path),sa=re===me.path,ci=ee.statusByPath.get(me.path.replace(/\\/g,"/")),Ci=st&&ee.changedDirs.has(me.path.replace(/\\/g,"/")),ns=(Le==null?void 0:Le.mode)==="cut"&&Le.items.some(Er=>Er.path===me.path);return n.jsxs("div",{className:"file-tree-node",children:[n.jsxs("button",{className:"file-tree-item",type:"button","data-active":sa,"data-selected":Sr,"data-cut-pending":ns||void 0,"data-kind":me.kind,"aria-expanded":st?xt:void 0,style:{paddingInlineStart:`${d$+he*h$}px`},onClick:Er=>{if(st){if(Er.shiftKey||qd(Er)){hr(),Un(et,Er);return}hr(),Un(et,Er),In(me.path);return}qr(me.path,Er)},onContextMenu:Er=>{Vr(Er,me)},children:[n.jsx("span",{className:`file-tree-chevron${st?"":" is-hidden"}`,"aria-hidden":"true",children:xt?"v":">"}),st?null:n.jsx("span",{className:"git-tree-file-icon","data-kind":No(me.name),"aria-hidden":"true",children:jo(me.name)}),n.jsx("span",{className:"file-tree-label","data-status":ci??void 0,"data-has-changes":Ci||void 0,children:me.name}),!st&&ci?n.jsx("span",{className:"git-status-badge","data-status":ci,"aria-label":ci,children:ci}):null,st&&Ci?n.jsx("span",{className:"file-tree-dir-badge","aria-hidden":"true"}):null,Zt?n.jsx("span",{className:"file-tree-meta",children:o("common.loading")}):null]}),st&&xt?n.jsx("div",{className:"file-tree-children",children:Zt&&!Ln.length?n.jsx("p",{className:"file-tree-empty",children:o("common.loading")}):sr.length?Ot(sr,he+1):n.jsx("p",{className:"file-tree-empty",children:o("conversation.filePanelEmptyDirectory")})}):null]},`${me.kind}-${me.path}`)})})}function Br($){return n.jsx(n.Fragment,{children:$.map(he=>{const me=he.kind==="directory",et=ot.has(he.path),st=re===he.path;return n.jsx("div",{className:"file-tree-node",children:n.jsxs("button",{className:"file-tree-item is-search-result",type:"button","data-active":st,"data-selected":et,"data-kind":he.kind,onClick:xt=>{$r(he,xt)},onContextMenu:xt=>{Vr(xt,he)},children:[n.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),me?null:n.jsx("span",{className:"git-tree-file-icon","data-kind":No(he.name),"aria-hidden":"true",children:jo(he.name)}),n.jsxs("span",{className:"file-tree-label",children:[n.jsx("span",{className:"file-tree-name",children:he.name}),n.jsx("span",{className:"file-tree-path",children:he.path})]})]})},`search-${he.kind}-${he.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(f0,{workspaceId:r,filePath:ce,open:ce!==null,onClose:()=>{$e.current+=1,le(null),dt(null)},onSaved:async $=>{await Tt(),await En($),Ce(he=>he+1)},diffContent:Fe}),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:()=>Se("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:()=>{Ut&&Se("session")},disabled:!Ut,children:[o("conversation.filePanelSessionTab"),n.jsx("span",{className:"file-panel-tab-badge","aria-label":`${o("conversation.filePanelSessionTab")} ${Nt}`,children:Nt})]})]}),ye==="workspace"?n.jsxs(n.Fragment,{children:[n.jsx("input",{ref:on,"data-testid":"file-panel-upload-input",type:"file",hidden:!0,onChange:$=>void Ge($)}),dn?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:Qt,children:[n.jsxs("button",{className:"secondary-button file-mobile-action-trigger",type:"button","aria-label":o("conversation.filePanelActionsMenu"),"aria-haspopup":"menu","aria-expanded":rt,"data-active":rt,onClick:()=>{ft(!1),fe($=>!$)},children:[n.jsx("span",{children:o("conversation.filePanelActionsMenu")}),n.jsx(z$,{})]}),rt?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:()=>G(()=>wn("copy")),disabled:!_t,children:o("conversation.filePanelCopy")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>G(()=>wn("cut")),disabled:!_t,children:o("conversation.filePanelCut")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>G(()=>oi()),disabled:!Sn||K||F,children:o("conversation.filePanelPaste")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{fe(!1),je()},children:o(de?"conversation.filePanelHideSearch":"conversation.filePanelShowSearch")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{fe(!1),Qe($=>!$)},disabled:hn.length===0,children:o(xe?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>G(Bn),disabled:Y||K||D,children:o("conversation.filePanelRefresh")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{fe(!1),gn()},disabled:!On,children:o("conversation.filePanelCollapseCurrent")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{fe(!1),Ee()},disabled:K||F,children:o("conversation.filePanelUpload")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>G(At),disabled:!$t||F,children:o("conversation.filePanelDownload")}),n.jsx("button",{className:"file-mobile-action-menu-item danger",type:"button",role:"menuitem",onClick:()=>G(li),disabled:!Bt||K||F,children:o("conversation.filePanelDelete")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>G(()=>bn("create_file")),disabled:K||F,children:o("conversation.filePanelNewFile")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>G(()=>bn("create_directory")),disabled:K||F,children:o("conversation.filePanelNewDirectory")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>G(()=>Rn("absolute")),disabled:!an,children:o("conversation.filePanelCopyAbsolutePath")}),n.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>G(()=>Rn("relative")),disabled:!an,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:()=>wn("copy"),disabled:!_t,children:n.jsx(L$,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCut"),"aria-label":o("conversation.filePanelCut"),onClick:()=>wn("cut"),disabled:!_t,children:n.jsx(F$,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelPaste"),"aria-label":o("conversation.filePanelPaste"),onClick:()=>void oi(),disabled:!Sn||K||F,children:n.jsx(_$,{})}),n.jsxs("div",{className:"file-toolbar-menu-shell",ref:bt,children:[n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelCopyPath"),"aria-label":o("conversation.filePanelCopyPath"),"aria-haspopup":"menu","aria-expanded":gt,"data-active":gt,onClick:()=>{fe(!1),ft($=>!$)},disabled:!an,children:n.jsx(I$,{})}),gt?n.jsxs("div",{className:"file-toolbar-menu",role:"menu",children:[n.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Rn("absolute"),children:o("conversation.filePanelCopyAbsolutePath")}),n.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Rn("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:gn,disabled:!On,children:n.jsx(A$,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelRefresh"),"aria-label":o("conversation.filePanelRefresh"),onClick:()=>void Bn(),disabled:Y||K||D,children:n.jsx(E$,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelSearchButton"),"aria-label":o("conversation.filePanelSearchButton"),"data-active":de,onClick:je,disabled:Y,children:n.jsx(NC,{})}),hn.length>0?n.jsx("button",{className:"file-toolbar-button",type:"button",title:o(xe?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges"),"aria-label":o(xe?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges"),"data-active":xe,onClick:()=>Qe($=>!$),children:n.jsx(q$,{})}):null,n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelUpload"),"aria-label":o("conversation.filePanelUpload"),onClick:Ee,disabled:K||F,children:n.jsx(B$,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelDownload"),"aria-label":o("conversation.filePanelDownload"),onClick:()=>void At(),disabled:!$t||F,children:n.jsx(W$,{})}),n.jsx("button",{className:"file-toolbar-button danger",type:"button",title:o("conversation.filePanelDelete"),"aria-label":o("conversation.filePanelDelete"),onClick:()=>li(),disabled:!Bt||K||F,children:n.jsx(U$,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelNewFile"),"aria-label":o("conversation.filePanelNewFile"),onClick:()=>void bn("create_file"),disabled:K||F,children:n.jsx(O$,{})}),n.jsx("button",{className:"file-toolbar-button",type:"button",title:o("conversation.filePanelNewDirectory"),"aria-label":o("conversation.filePanelNewDirectory"),onClick:()=>void bn("create_directory"),disabled:K||F,children:n.jsx(H$,{})})]}),ue&&typeof document<"u"?Xn.createPortal(n.jsx("div",{className:"file-web-context-menu",ref:zt,role:"menu","aria-label":o("conversation.filePanelActionsMenu"),style:{left:`${(qe==null?void 0:qe.left)??Math.max(8,ue.positionX)}px`,top:`${(qe==null?void 0:qe.top)??Math.max(8,ue.positionY)}px`,maxHeight:qe?`${qe.maxHeight}px`:void 0},children:ue.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:()=>{Oe(null),$.onSelect()},children:$.label},$.id))}),document.body):null,E.length>0||Le?n.jsxs("div",{className:"file-panel-selection-summary","aria-live":"polite",children:[E.length>0?n.jsx("span",{children:o("conversation.filePanelSelectionCount",{count:E.length})}):null,Le?n.jsx("span",{children:Le.mode==="copy"?o("conversation.filePanelClipboardCopyReady",{count:Le.items.length}):o("conversation.filePanelClipboardCutReady",{count:Le.items.length})}):null]}):null,de?n.jsxs("form",{className:"file-toolbar-search",onSubmit:$=>void Q($),children:[n.jsx("input",{value:M,onChange:$=>N($.target.value),placeholder:o("conversation.filePanelSearchPlaceholder")}),dn?n.jsx("button",{className:"secondary-button file-mobile-search-submit",type:"submit","aria-label":o("conversation.filePanelSearchButton"),disabled:D,children:o("conversation.filePanelSearchButton")}):n.jsx("button",{className:"file-toolbar-button",type:"submit",title:o("conversation.filePanelSearchButton"),"aria-label":o("conversation.filePanelSearchButton"),disabled:D,children:n.jsx(NC,{})})]}):null,n.jsx("div",{className:"file-tree","data-search-mode":We,children:Y&&ve.length===0?n.jsx("p",{className:"file-tree-status status-text",children:o("common.loading")}):We?pe!=null&&pe.length?Br(pe):n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelSearchEmpty")}):xe?Ye.length?Ot(Ye,0):n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelNoChanges")}):ve.length?Ot(ve,0):n.jsx("p",{className:"file-tree-status status-text",children:o("conversation.filePanelEmptyDirectory")})}),n.jsxs(Hn,{open:yt!==null,title:o("conversation.filePanelDeleteConfirmTitle"),description:o("conversation.filePanelDeleteConfirmDescription"),onClose:()=>{K||Me(null)},children:[n.jsx("p",{className:"workbench-section-empty",children:yt!=null&&yt.length?yt.length===1?((Fs=yt[0])==null?void 0:Fs.kind)==="directory"?o("conversation.filePanelDeleteDirectoryConfirm",{path:yt[0].path}):o("conversation.filePanelDeleteFileConfirm",{path:yt[0].path}):o("conversation.filePanelDeleteSelectionConfirm",{count:yt.length}):""}),n.jsxs("div",{className:"workbench-modal-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:K,onClick:()=>Me(null),children:o("common.cancel")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:K,onClick:()=>{Ar()},children:o(K?"conversation.filePanelDeleting":"conversation.filePanelDelete")})]})]})]}):Ut&&t?n.jsx(i$,{sessionId:t,workspaceId:r,showSystemFiles:ln,selectedPath:Pe,refreshVersion:_e,onCountChange:ct,onSelectFile:En,onOpenFile:Dn}):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 Qs(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):tr}function eu(e,t=!1){const r=e.split("/").filter(Boolean),i=t?r.length:r.length-1,a=[];for(let u=0;u<i;u+=1)a.push(r.slice(0,u+1).join("/"));return a}function yC(e,t){return e||((t==null?void 0:t.kind)==="directory"?t.path:t!=null&&t.path?Qs(t.path):tr)}function kC(e,t){return e?`${e}/${t}`:t}function m$(e){var t;return((t=e.split(/[/\\]/).pop())==null?void 0:t.trim())??""}function hs(e,t){return{path:e,kind:t}}function xC(e){return e[e.length-1]??null}function p$(e,t){return e.findIndex(i=>i.path===t.path)>=0?e.filter(i=>i.path!==t.path):[...e,t]}function f$(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 u=Math.min(a,i),c=Math.max(a,i);return e.slice(u,c+1)}function qd(e){return!!(e!=null&&e.ctrlKey||e!=null&&e.metaKey)}function g$(e){return e.ctrlKey||e.metaKey}function b$(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"||e.isContentEditable}function $d(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"&&_h(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?Qs(e.path):t}function w$(e,t){let r=e;for(;r&&t.some(i=>i.kind==="directory"&&_h(i.path,r));)r=Qs(r);return r}function S0(e,t,r,i,a,u){const c=[];for(const d of e){if(c.push(hs(d.path,d.kind)),d.kind!=="directory"||!r.includes(d.path))continue;const m=t[d.path]??[],f=i?Kg(m,t,a,u):m;c.push(...S0(f,t,r,i,a,u))}return c}function y$(e,t,r){const i=Math.max(0,r.width),a=Math.max(0,r.height),u=Math.max(0,a-Ns*2),c=Math.max(0,i-Ns*2),d=Math.min(Math.max(t.width,0),c),m=Math.max(0,a-e.y-zd-Ns),f=Math.max(0,e.y-zd-Ns),v=m<t.height&&f>m,w=Bf(Math.max(v?f:m,l$),0,u),y=Math.min(Math.max(t.height,0),w),x=v?e.y-zd-y:e.y+zd,C=Math.max(Ns,a-Ns-y),j=Math.max(Ns,i-Ns-d);return{top:Bf(x,Ns,C),left:Bf(e.x,Ns,j),maxHeight:Math.max(0,w)}}function Bf(e,t,r){return!Number.isFinite(e)||r<t?t:Math.min(Math.max(e,t),r)}function hh(e,t="posix"){return e?C0(e,t):"."}function k$(e,t,r){const i=C0(e,r),a=hh(t,r).replace(/^\.[/\\]?/,"");if(!a)return i;const u=j0(r),c=a.replace(/^[/\\]+/,"");return c?i.endsWith("/")||i.endsWith("\\")?`${i}${c}`:`${i}${u}${c}`:i}function x$(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.includes("\\")?"windows":"posix"}function C0(e,t){return e&&(j0(t)==="\\"?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"))}function j0(e){return e==="windows"?"\\":"/"}function _h(e,t){return t===e||t.startsWith(`${e}/`)}async function S$(e){const t=await e.arrayBuffer(),r=new Uint8Array(t),i=32768;let a="";for(let u=0;u<r.length;u+=i){const c=r.subarray(u,u+i);a+=String.fromCharCode(...c)}return btoa(a)}function C$(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 j$(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 N$(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(!T$(e))throw new Error(o("conversation.filePanelCopyPathFailed"))}}function T$(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 P$(e,t){return e&&eu(e,!0).every(a=>a in t)?e:tr}function SC(e,t){if(!t)return[];const r=eu(t,!0);return e.filter(i=>r.includes(i))}function Vd(e,t,r){const i=wv(t,r);return Object.entries(e).reduce((a,[u,c])=>(i.has(u)&&(a[u]=c),a),{})}function D$(e,t,r){const a=[...wv(t,r)].filter(u=>u===tr||u in e);return a.length?a:[tr]}function wv(e,t){const r=new Set([tr]),i=N0(t,eu(e,!0));for(const a of i){r.add(a);for(const u of eu(a,!0))r.add(u)}return r}function R$(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 mh(e,t){return e.includes(t)?e:[...e,t]}function N0(e,t){return t.reduce((r,i)=>mh(r,i),e)}function CC(e){return`file-panel.workspace-tree.${e}`}function M$(e,t){return`file-panel.session-change-count.${e}.${t}`}function Wf(e,t){return[...wv(t,e)]}function Ts(e,t){return e instanceof ei?e.message:t}function jC(e){return e instanceof Error&&(e.message.startsWith("FILE_TREE_SNAPSHOT_TIMEOUT:")||e.message.startsWith("FILE_TREE_ABORTED:"))}function A$(){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 E$(){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 NC(){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 I$(){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 L$(){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 F$(){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 _$(){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 O$(){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 B$(){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 W$(){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 U$(){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 H$(){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 z$(){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 q$(){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 Kg(e,t,r,i){const a=[];for(const u of e){const c=u.path.replace(/\\/g,"/");u.kind==="file"?r.has(c)&&a.push(u):T0(c,t,r,i)&&a.push(u)}return a}function T0(e,t,r,i,a){const u=a??new Set;if(u.has(e))return!1;u.add(e);const c=t[e];if(!c)return i.has(e);for(const d of c){const m=d.path.replace(/\\/g,"/");if(d.kind==="file"){if(r.has(m))return!0}else if(T0(m,t,r,i,u))return!0}return!1}const $$=Object.freeze(Object.defineProperty({__proto__:null,FileContextPanel:vv},Symbol.toStringTag,{value:"Module"})),Uf=56,TC=28,Hf=72,Gd=8,PC=960,DC=60*1e3,RC=20,MC=9,AC=9,zf=68,Gi=12,Kd=8,P0=260,V$=120,Oh={authMode:"none",username:"",password:"",token:"",rememberOnHost:!1};function yv({className:e,workspaceId:t,panelActive:r=!0,externalWindowMode:i=!1,workbenchShellOverrides:a}){const u=gr(),{subscribeGitSnapshot:c,requestGitRefresh:d,addGitSnapshotListener:m}={...u,...a},[f,v]=p.useState(null),[g,w]=p.useState([]),[y,x]=p.useState(0),[C,j]=p.useState(null),[T,P]=p.useState(!1),[I,Z]=p.useState(null),[q,B]=p.useState(null),[E,A]=p.useState(""),[H,_]=p.useState(!1),[Y,z]=p.useState(!1),[K,O]=p.useState([]),[F,te]=p.useState(!0),[de,W]=p.useState(!1),[M,N]=p.useState(()=>typeof window<"u"?window.innerWidth<=PC:!1),[L,X]=p.useState([]),[D,be]=p.useState(null),[ce,le]=p.useState("unstaged"),[ye,Se]=p.useState(null),[_e,Ce]=p.useState(!1),[Nt,ct]=p.useState([]),[gt,ft]=p.useState(!1),[rt,fe]=p.useState(new Set),[ue,Oe]=p.useState(new Map),[qe,nt]=p.useState(null),[yt,Me]=p.useState(!1),[Le,pt]=p.useState(Oh),[ut,we]=p.useState("generic"),[xe,Qe]=p.useState(null),[Fe,dt]=p.useState(null),[It,qt]=p.useState(Uf),[Ht,Ft]=p.useState(!1),[Dt,bt]=p.useState(null),[Qt,zt]=p.useState(null),on=p.useRef(null),ae=p.useRef(null),$e=p.useRef(null),ht=p.useRef(null),Wt=p.useRef(null),jn=p.useRef(null),ln=p.useRef(r),{showToast:Ut}=ir();p.useEffect(()=>{tn("git_sidebar.props",{workspaceId:t,externalWindowMode:i})},[i,t]),p.useEffect(()=>{O([]),te(!0),x(0),j(null),P(!1),B(null),A(""),W(!1),X([]),be(null),le("unstaged"),Se(null),Ce(!1),ct([]),fe(new Set),Oe(new Map),nt(null),Me(!1),pt(Oh),we("generic"),Qe(null),dt(null),Ft(!1),qt(Uf),bt(null),zt(null)},[t]),p.useEffect(()=>{function Q(){N(window.innerWidth<=PC)}return Q(),window.addEventListener("resize",Q),()=>{window.removeEventListener("resize",Q)}},[]),p.useEffect(()=>{if(!Ht)return;const Q=document.body.style.cursor,je=document.body.style.userSelect;document.body.style.cursor="row-resize",document.body.style.userSelect="none";function G(Ge){Mn(Ge.clientY)}function Ee(){Ft(!1)}return window.addEventListener("pointermove",G),window.addEventListener("pointerup",Ee),()=>{document.body.style.cursor=Q,document.body.style.userSelect=je,window.removeEventListener("pointermove",G),window.removeEventListener("pointerup",Ee)}},[Ht]),p.useEffect(()=>{var G,Ee;if(!(t!=null&&t.trim())){v(null),w([]),x(0),j(null),Z(null),_(!1);return}const Q=t.trim(),je=Rr($f(Q),DC);if(tn("git_sidebar.snapshot",{workspaceId:Q,cached:!!je,cachedHistoryCount:((G=je==null?void 0:je.history)==null?void 0:G.length)??0,cachedChangedCount:((Ee=je==null?void 0:je.status)==null?void 0:Ee.changes.length)??0}),je){Jt(je),_(!1);return}v(null),w([]),x(0),j(null),Z(null),_(!0)},[t]),p.useEffect(()=>{if(t!=null&&t.trim())return m(Q=>{var je,G,Ee;Q.workspaceId===t.trim()&&(tn("git_sidebar.snapshot_received",{workspaceId:Q.workspaceId,changedCount:((je=Q.status)==null?void 0:je.changes.length)??0,historyCount:Q.history.length,branchCount:(((G=Q.branches)==null?void 0:G.local.length)??0)+(((Ee=Q.branches)==null?void 0:Ee.remote.length)??0)}),Jt(Q),_(!1))})},[m,t]),p.useEffect(()=>{if(!(t!=null&&t.trim()))return;const Q=t.trim(),je=Rr($f(Q),DC)!==null;if(c(Q),je){d(Q);return}nn()},[d,c,t]),p.useEffect(()=>{const Q=ln.current;ln.current=r,t!=null&&t.trim()&&!Q&&r&&d(t.trim())},[r,d,t]),p.useEffect(()=>{t&&Zr($f(t),{status:f,history:g,historyTotalCount:y,historyNextCursor:C,branches:I})},[I,g,C,y,f,t]),p.useEffect(()=>{if(!f||!q)return;f.changes.find(je=>je.path===q)||B(null)},[q,f]),p.useEffect(()=>{X$(ht.current)},[E]),p.useEffect(()=>{M||(X([]),be(null),Se(null),Qe(null))},[M]),p.useEffect(()=>{if(!f){X([]);return}const Q=new Set(f.changes.map(je=>je.path));X(je=>je.filter(G=>Q.has(G)))},[f]);function dn(){const Q=$e.current;if(!Q)return;Q.querySelectorAll(".git-tree-shell").forEach(G=>{G.scrollTop=0})}function Jt(Q){v(Q.status),w(Array.isArray(Q.history)?Q.history:[]),x(typeof Q.historyTotalCount=="number"?Q.historyTotalCount:0),j(typeof Q.historyNextCursor=="string"?Q.historyNextCursor:null),Z(Q.branches??null)}function nn(Q){t!=null&&t.trim()&&(_(!0),tn("git_sidebar.refresh_requested",{workspaceId:t.trim(),resetTreeScroll:!1}),d(t.trim()))}async function hn(Q){if(!(t!=null&&t.trim()))return;const je=t.trim();_(!0);try{const[G,Ee,Ge]=await Promise.all([sT(je),Rk(je,RC,null),lT(je)]);Jt({status:G,history:Ee.items,historyTotalCount:Ee.totalCount,historyNextCursor:Ee.nextCursor,branches:Ge}),d(je),Q!=null&&Q.resetTreeScroll&&requestAnimationFrame(()=>{dn()})}catch(G){Ut({title:us(G,o("git.panelLoadFailed")),tone:"error"})}finally{_(!1)}}async function ee(){if(!(!t||!C||T)){P(!0);try{const Q=await Rk(t,RC,C);w(je=>{const G=new Set(je.map(Ge=>Ge.commitHash)),Ee=Q.items.filter(Ge=>!G.has(Ge.commitHash));return[...je,...Ee]}),x(Q.totalCount),j(Q.nextCursor)}catch(Q){Ut({title:us(Q,o("git.panelLoadFailed")),tone:"error"})}finally{P(!1)}}}function ne(Q){if(!F||T||!C)return;const je=Q.currentTarget;je.scrollHeight-je.scrollTop-je.clientHeight<=40&&ee()}async function pe(){if(t){z(!0);try{const Q=await kL(t,"ai");A(Q.validation.normalizedDraft.subject||Q.draft.subject)}catch(Q){Ut({title:us(Q,o("git.draftFailed")),tone:"error"})}finally{z(!1)}}}async function ve(Q,je){if(t&&Q.length){z(!0);try{const G=je?await wL(t,Q):await oT(t,Q);v(G),B(Q[Q.length-1]??null),X(Ee=>Ee.filter(Ge=>!Q.includes(Ge))),be(null),nn()}catch(G){_(!1),Ut({title:us(G,o("git.stageFailed")),tone:"error"})}finally{z(!1)}}}async function We(Q){if(t&&Q.length){z(!0);try{const je=await yL(t,Q);v(je),Q.includes(q??"")&&B(null),X(G=>G.filter(Ee=>!Q.includes(Ee))),be(null),nn()}catch(je){_(!1),Ut({title:us(je,o("git.discardFailed")),tone:"error"})}finally{z(!1)}}}async function Ye(){if(!(!t||!E.trim())){z(!0);try{await xL(t,Y$(E)),Ut({title:o("git.commitSuccess"),tone:"success"}),A(""),B(null),nn()}catch(Q){Ut({title:us(Q,o("git.commitFailed")),tone:"error"})}finally{z(!1)}}}function mt(Q){pt(J$(qe)),Me(!0),Je(Q)}async function Je(Q){const je=t==null?void 0:t.trim();if(!je){we("generic");return}try{const G=await Ak(je);if((t==null?void 0:t.trim())!==je)return;we(e8(G,Q))}catch{if((t==null?void 0:t.trim())!==je)return;we("generic")}}function Ke(){const Q=Z$(Le),je=o(ut==="github"?"git.remoteAuthGithubPatPlaceholder":"shell.clonePasswordPlaceholder");if(Le.authMode==="basic"){if(!Le.username.trim()){Ut({title:o("shell.cloneUsernamePlaceholder"),tone:"error"});return}if(!Le.password){Ut({title:je,tone:"error"});return}}if(Le.authMode==="token"&&!Le.token){Ut({title:o("shell.cloneTokenPlaceholder"),tone:"error"});return}nt(Q),Me(!1),Ut({title:o(Q?"git.remoteAuthSaved":"git.remoteAuthCleared"),description:Q&&Le.rememberOnHost?o("git.remoteAuthRememberHint"):void 0,tone:"success"})}async function re(){if(t){ft(!0);try{const Q=await Ak(t);if(Q.length===0){Ut({title:o("git.noRemotes"),tone:"error"});return}if(Q.length===1){Pe([Q[0].name]);return}ct(Q),fe(new Set),Oe(new Map),Ce(!0)}catch(Q){Ut({title:us(Q,o("git.remoteFailed")),tone:"error"})}finally{ft(!1)}}}async function Pe(Q){if(!t||Q.length===0)return;z(!0),Oe(new Map);const je=new Map;let G=!1;try{for(const Ee of Q)try{const Ge=await Mk(t,"push",Ee,qe,Le.rememberOnHost);je.set(Ee,{ok:!0,summary:Ge.summary})}catch(Ge){if(G=!0,je.set(Ee,{ok:!1,summary:us(Ge,o("git.remoteFailed"))}),Oe(new Map(je)),BC(Ge)){mt(Ee);return}}Oe(je),nn(),G||(Ut({title:o("git.pushAllSuccess",{count:String(Q.length)}),tone:"success"}),Ce(!1))}finally{z(!1)}}async function ot(Q){if(t){if(Q==="push"){W(!1),re();return}z(!0);try{const je=await Mk(t,Q,void 0,qe,Le.rememberOnHost);Ut({title:je.summary,tone:"success"}),W(!1),nn()}catch(je){if(BC(je)){mt();return}Ut({title:us(je,o("git.remoteFailed")),tone:"error"})}finally{z(!1)}}}async function kt(){if(t){z(!0);try{const Q=await SL(t);A(Q.commitSubject??""),Ut({title:Q.summary||o("git.undoLastCommitSuccess"),tone:"success"}),W(!1),nn()}catch(Q){Ut({title:us(Q,o("git.undoLastCommitFailed")),tone:"error"})}finally{z(!1)}}}async function an(Q){if(t){z(!0);try{const je=await jL(t,Q,!1);Z(je),W(!1),nn()}catch(je){Ut({title:us(je,o("git.branchFailed")),tone:"error"})}finally{z(!1)}}}function $t(Q){O(je=>je.includes(Q)?je.filter(G=>G!==Q):[...je,Q])}const Bt=450;function _t(Q){const je=Date.now(),G=on.current;return on.current={filePath:Q,timestamp:je},(G==null?void 0:G.filePath)===Q&&je-G.timestamp<=Bt}async function Sn(Q,je){if(je.binary){Ut({title:o("git.binaryDiff"),tone:"info"});return}if(je.status==="A"||je.status==="?")zt(null),bt(Q);else if(t)try{const G=await aT(t,Q,je.staged);zt(G.content),bt(Q)}catch{zt(null),bt(Q)}}function On(Q){B(Q),be(null),X(je=>je.includes(Q)?je.filter(G=>G!==Q):[...je,Q])}function Mn(Q){const je=ae.current;if(!je||!Number.isFinite(Q))return;const G=je.getBoundingClientRect(),Ee=G.height-Gd;if(!Number.isFinite(G.top)||!Number.isFinite(G.height)||Ee<=0)return;const Ge=(Q-G.top-Gd/2)/Ee*100;if(!Number.isFinite(Ge))return;const At=Math.max(TC,Math.min(Hf,Math.round(Ge)));qt(At)}function Tt(Q){Q.preventDefault(),Mn(Q.clientY),Ft(!0)}const fn=(f==null?void 0:f.changes)??[],Xt=fn.filter(Q=>Yg(Q,"staged")),kn=fn.filter(Q=>Yg(Q,"unstaged")),Te=_C(Xt,"staged"),Be=_C(kn,"unstaged"),lt=new Set(K),Mt=new Set(L),rn=OC(L,fn,"staged"),Nn=OC(L,fn,"unstaged"),Vt=fn.length===0&&((f==null?void 0:f.snapshot.ahead)??0)>0,Un=Xt.length>0&&E.trim().length>0,qn=(I==null?void 0:I.currentBranch)??(f==null?void 0:f.snapshot.branch)??o("common.unknown"),En=qe!==null,Dn=ut==="github",zr=o(Dn?"git.remoteAuthDescriptionGithub":"git.remoteAuthDescription"),hr=o(Dn?"git.remoteAuthGithubPatLabel":"shell.clonePasswordLabel"),qr=o(Dn?"git.remoteAuthGithubPatPlaceholder":"shell.clonePasswordPlaceholder"),xn=o(Dn?"git.remoteAuthGithubUsernamePlaceholder":"shell.cloneUsernamePlaceholder"),$r=Number.isFinite(It)?It:Uf,br=F?`minmax(120px, ${$r}fr) ${Gd}px minmax(140px, ${100-$r}fr)`:`minmax(120px, 1fr) ${Gd}px auto`;p.useEffect(()=>{D==="staged"&&rn.length===0&&be(null),D==="unstaged"&&Nn.length===0&&be(null)},[D,rn.length,Nn.length]),p.useEffect(()=>{if(!M)return;const Q=kn.length>0?"unstaged":Xt.length>0?"staged":"history";le(je=>je==="unstaged"&&kn.length>0||je==="staged"&&Xt.length>0?je:Q)},[M,Xt.length,kn.length]),p.useEffect(()=>{ye&&(g.some(Q=>Q.commitHash===ye)||Se(null))},[g,ye]),p.useEffect(()=>{M&&ce!=="history"&&de&&W(!1)},[M,de,ce]),p.useLayoutEffect(()=>{if(M||!de){dt(null);return}function Q(){const G=Wt.current,Ee=jn.current;!G||!Ee||typeof window>"u"||dt(F0(G.getBoundingClientRect(),{width:Ee.getBoundingClientRect().width||P0,height:Ee.getBoundingClientRect().height||Ee.scrollHeight||0},{width:window.innerWidth,height:window.innerHeight}))}Q();const je=window.requestAnimationFrame(Q);return window.addEventListener("resize",Q),window.addEventListener("scroll",Q,!0),()=>{window.cancelAnimationFrame(je),window.removeEventListener("resize",Q),window.removeEventListener("scroll",Q,!0)}},[Y,I==null?void 0:I.local.length,qn,M,de,En]);async function In(Q,je){var G;try{if(typeof navigator>"u"||!((G=navigator.clipboard)!=null&&G.writeText))throw new Error("clipboard unavailable");await navigator.clipboard.writeText(Q),Ut({title:je,tone:"success"})}catch{Ut({title:o("common.copyContentFailed"),tone:"error"})}}async function Mr(Q,je){typeof window<"u"&&!window.confirm(o("git.discardConfirm",{path:je}))||await We(Q)}function Bn(Q){const je=(Q==null?void 0:Q.desktopFloating)===!0&&!M,G=je?{top:(Fe==null?void 0:Fe.top)??Gi,left:(Fe==null?void 0:Fe.left)??Gi,maxHeight:Fe==null?void 0:Fe.maxHeight,transformOrigin:(Fe==null?void 0:Fe.transformOrigin)??"top right"}:void 0,Ee=n.jsxs("div",{ref:je?jn:void 0,className:"git-operations-menu","data-floating":je?"true":"false",style:G,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:qn})]}),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(En?"git.remoteAuthConfigured":"git.remoteAuthNotConfigured")}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:Y,onClick:()=>mt(),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(Ge=>n.jsx("button",{className:"git-menu-item",type:"button",disabled:Y||Ge.current,onClick:()=>void an(Ge.name),children:n.jsx("span",{children:Ge.current?`${o("git.switchBranch")} ${Ge.name}`:`${o("git.switchBranchTo")} ${Ge.name}`})},Ge.name))})]}),n.jsxs("div",{className:"git-menu-section",children:[n.jsx("button",{className:"git-menu-item",type:"button",disabled:Y,onClick:()=>void ot("fetch"),children:n.jsx("span",{children:o("git.fetch")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:Y,onClick:()=>void ot("pull"),children:n.jsx("span",{children:o("git.pull")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:Y,onClick:()=>void ot("push"),children:n.jsx("span",{children:o("git.push")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:Y,onClick:()=>void kt(),children:n.jsx("span",{children:o("git.undoLastCommit")})}),n.jsx("button",{className:"git-menu-item",type:"button",disabled:Y||H,onClick:()=>void hn({resetTreeScroll:!0}),children:n.jsx("span",{children:o("git.refresh")})})]})]});return je?typeof document>"u"?null:Xn.createPortal(Ee,document.body):Ee}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:ht,rows:1,value:E,onChange:Q=>A(E0(Q.target.value)),onKeyDown:Q=>{Q.key==="Enter"&&Q.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 pe(),disabled:Y||H,children:n.jsx(n8,{})})]}),n.jsxs("div",{className:"git-primary-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void hn({resetTreeScroll:!0}),disabled:Y||H||!t,children:o("git.refreshNow")}),n.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(Vt){re();return}Ye()},disabled:Y||!Vt&&!Un,children:o(Vt?"git.pushNow":"git.commitNow")})]})]}),M?n.jsxs("div",{className:"git-mobile-sections",children:[n.jsx(qf,{title:o("git.stagedChangesTitle"),count:Xt.length,expanded:ce==="staged",onToggle:()=>le("staged"),children:n.jsx(IC,{title:o("git.stagedChangesTitle"),nodes:Te,collapsedTreePathSet:lt,onToggleTreePath:$t,onToggleMobileSelection:On,selectedMobilePathSet:Mt,selectedTargets:rn,actioning:Y,variant:"staged",swipeRowState:xe,onSwipeRowChange:Qe,onStageToggle:ve,onDiscardWithConfirm:Mr,onClearSelectedTargets:()=>X(Q=>Q.filter(je=>!rn.includes(je))),onPreviewFile:Sn})}),n.jsx(qf,{title:o("git.changesTitle"),count:kn.length,expanded:ce==="unstaged",onToggle:()=>le("unstaged"),children:n.jsx(IC,{title:o("git.changesTitle"),nodes:Be,collapsedTreePathSet:lt,onToggleTreePath:$t,onToggleMobileSelection:On,selectedMobilePathSet:Mt,selectedTargets:Nn,actioning:Y,variant:"unstaged",swipeRowState:xe,onSwipeRowChange:Qe,onStageToggle:ve,onDiscardWithConfirm:Mr,onClearSelectedTargets:()=>X(Q=>Q.filter(je=>!Nn.includes(je))),onPreviewFile:Sn})}),n.jsxs(qf,{title:o("git.recentVersionsTitle"),count:y,expanded:ce==="history",onToggle:()=>le("history"),trailingContent:n.jsx("span",{className:"badge",children:qn}),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":de,onClick:()=>{le("history"),W(Q=>!Q)},disabled:Y,children:n.jsx(Bh,{})}),children:[de?n.jsx("div",{className:"git-mobile-operations-shell",children:Bn()}):null,n.jsx(G$,{history:g,historyLoadingMore:T,hasMore:!!C,actioning:Y,openCommitHash:ye,onToggleMenu:Q=>Se(je=>je===Q?null:Q),onCopyCommitHash:Q=>void In(Q,o("git.copyCommitHashSuccess")),onCopyCommitSubject:Q=>void In(Q,o("git.copyCommitSubjectSuccess")),onUndoLastCommit:()=>void kt(),onLoadMore:()=>void ee()})]})]}):n.jsxs("div",{ref:ae,className:"git-content-split",style:{gridTemplateRows:br},children:[n.jsx("section",{className:"git-card git-tree-panel",children:n.jsxs("div",{ref:$e,className:"git-tree-panel-body",children:[Xt.length>0?n.jsx(EC,{title:o("git.stagedChangesTitle"),count:Xt.length,nodes:Te,selectedPath:q,collapsedTreePathSet:lt,onToggleTreePath:$t,onSelectFile:B,onPreviewFile:(Q,je)=>{_t(Q)&&Sn(Q,je)},onToggleMobileSelection:On,onStageToggle:ve,onDiscard:We,actioning:Y,variant:"staged",isMobileViewport:M,selectedMobilePathSet:Mt,selectedTargets:rn,mobileActionMenuOpen:D==="staged",onToggleMobileActionMenu:()=>be(Q=>Q==="staged"?null:"staged"),onClearSelectedTargets:()=>X(Q=>Q.filter(je=>!rn.includes(je)))}):null,n.jsx(EC,{title:o("git.changesTitle"),count:kn.length,nodes:Be,selectedPath:q,collapsedTreePathSet:lt,onToggleTreePath:$t,onSelectFile:B,onPreviewFile:(Q,je)=>{_t(Q)&&Sn(Q,je)},onToggleMobileSelection:On,onStageToggle:ve,onDiscard:We,actioning:Y,variant:"unstaged",isMobileViewport:M,selectedMobilePathSet:Mt,selectedTargets:Nn,mobileActionMenuOpen:D==="unstaged",onToggleMobileActionMenu:()=>be(Q=>Q==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>X(Q=>Q.filter(je=>!Nn.includes(je)))})]})}),n.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":o("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":TC,"aria-valuemax":Hf,"aria-valuenow":F?$r:Hf,"data-dragging":Ht,onPointerDown:Tt,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":F,"aria-label":o(F?"git.collapseRecentVersions":"git.expandRecentVersions"),onClick:()=>te(Q=>!Q),children:[n.jsxs("span",{className:"git-section-toggle-main",children:[n.jsx(hm,{expanded:F}),n.jsx("span",{children:o("git.recentVersionsTitle")})]}),n.jsx("span",{className:"workbench-section-counter",children:y})]}),n.jsxs("div",{className:"git-history-actions",children:[n.jsx("span",{className:"badge",children:qn}),n.jsx("button",{className:"git-icon-button",type:"button",ref:Wt,"aria-label":o("git.operationMenu"),title:o("git.operationMenu"),onClick:()=>W(Q=>!Q),disabled:Y,children:n.jsx(Bh,{})}),de?Bn({desktopFloating:!0}):null]})]}),F?n.jsx("div",{className:"git-history-list",onScroll:ne,children:g.length?n.jsxs(n.Fragment,{children:[g.map(Q=>n.jsxs("article",{className:"git-history-entry","data-kind":Q.commitKind,children:[n.jsx("span",{className:"git-history-marker","data-kind":Q.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:Q.subject,children:Q.subject}),n.jsx("span",{className:"git-history-kind-badge","data-kind":Q.commitKind,children:I0(Q.commitKind)})]}),Q.refs.length>0?n.jsx("div",{className:"git-history-ref-list",children:Q.refs.map(je=>n.jsx("span",{className:"git-history-ref-pill","data-kind":je.kind,"data-remote-index":String(L0(je.remoteName)),children:je.name},`${Q.commitHash}:${je.kind}:${je.name}`))}):null,n.jsxs("div",{className:"git-history-meta",children:[n.jsx("span",{className:"git-history-hash",children:Q.commitHash.slice(0,8)}),n.jsx("span",{children:Q.authorName}),n.jsx("time",{dateTime:Q.authoredAt,children:_0(Q.authoredAt)})]})]})]},Q.commitHash)),T?n.jsxs("p",{className:"git-history-loading",children:[o("git.refreshNow"),"..."]}):null]}):n.jsx("p",{className:"status-text",children:o("git.noHistory")})}):null]})]}),n.jsxs(Hn,{open:_e,title:o("git.selectRemoteTitle"),description:o("git.selectRemoteDesc"),onClose:()=>{Y||Ce(!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(En?"git.remoteAuthConfigured":"git.remoteAuthNotConfigured")})]}),n.jsx("button",{className:"secondary-button",type:"button",disabled:Y,onClick:()=>mt(),children:o("git.remoteAuthAction")})]}),n.jsx("div",{className:"git-remote-select-list",children:Nt.map(Q=>{const je=rt.has(Q.name),G=ue.get(Q.name);return n.jsxs("label",{className:"git-remote-item",children:[n.jsx("input",{type:"checkbox",checked:je,disabled:Y,onChange:()=>{fe(Ee=>{const Ge=new Set(Ee);return Ge.has(Q.name)?Ge.delete(Q.name):Ge.add(Q.name),Ge})}}),n.jsxs("span",{className:"git-remote-item-body",children:[n.jsx("span",{className:"git-remote-name",children:Q.name}),n.jsx("span",{className:"git-remote-url",children:Q.pushUrl}),G&&n.jsx("span",{className:`git-remote-result ${G.ok?"ok":"err"}`,children:G.summary})]})]},Q.name)})}),n.jsxs("div",{className:"git-remote-actions",children:[n.jsx("button",{className:"secondary-button",type:"button",disabled:Y,onClick:()=>Ce(!1),children:o("common.close")}),n.jsx("button",{className:"primary-button",type:"button",disabled:Y||rt.size===0,onClick:()=>void Pe(Array.from(rt)),children:Y?o("git.pushing"):o("git.pushSelected",{count:String(rt.size)})})]})]}),n.jsxs(Hn,{open:yt,title:o("git.remoteAuthTitle"),description:zr,onClose:()=>{Y||Me(!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:Le.authMode,disabled:Y,onChange:Q=>pt(je=>({...je,authMode:Q.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")})]})]}),Le.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:Le.username,placeholder:xn,autoComplete:"username",onChange:Q=>pt(je=>({...je,username:Q.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:hr}),n.jsx("input",{type:"password",value:Le.password,placeholder:qr,autoComplete:"current-password",onChange:Q=>pt(je=>({...je,password:Q.target.value}))})]})]}):null,Le.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:Le.username,placeholder:o("shell.cloneTokenUsernamePlaceholder"),autoComplete:"username",onChange:Q=>pt(je=>({...je,username:Q.target.value}))})]}),n.jsxs("label",{className:"workbench-modal-field",children:[n.jsx("span",{children:o("shell.cloneTokenLabel")}),n.jsx("input",{type:"password",value:Le.token,placeholder:o("shell.cloneTokenPlaceholder"),autoComplete:"current-password",onChange:Q=>pt(je=>({...je,token:Q.target.value}))})]})]}):null,Dn?n.jsx("p",{className:"git-remote-auth-hint",children:o("git.remoteAuthGithubPatHint")}):null,Le.authMode!=="none"?n.jsxs("label",{className:"settings-checkbox git-remote-auth-remember-toggle",children:[n.jsx("input",{type:"checkbox",checked:Le.rememberOnHost,onChange:Q=>pt(je=>({...je,rememberOnHost:Q.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:Y,onClick:()=>Me(!1),children:o("common.close")}),n.jsx("button",{className:"primary-button",type:"button",disabled:Y,onClick:Ke,children:o("git.remoteAuthSave")})]})]}),n.jsx(f0,{workspaceId:t,filePath:Dt,open:Dt!==null,onClose:()=>{bt(null),zt(null)},onSaved:async()=>{await hn({resetTreeScroll:!0})},diffContent:Qt})]})}function EC({title:e,count:t,nodes:r,selectedPath:i,collapsedTreePathSet:a,onToggleTreePath:u,onSelectFile:c,onPreviewFile:d,onToggleMobileSelection:m,onStageToggle:f,onDiscard:v,actioning:g,variant:w,isMobileViewport:y,selectedMobilePathSet:x,selectedTargets:C,mobileActionMenuOpen:j,onToggleMobileActionMenu:T,onClearSelectedTargets:P}){const I=kv(r),Z=o(w==="staged"?"git.unstageAll":"git.stageAll");return n.jsxs("section",{className:"git-tree-group","data-variant":w,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&&I.length>0?n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"git-icon-button",type:"button","aria-label":Z,title:Z,onClick:()=>void f(I,w==="staged"),disabled:g,children:n.jsx(Xg,{staged:w==="staged"})}),w==="unstaged"?n.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":o("git.discardAll"),title:o("git.discardAll"),onClick:()=>void v(I),disabled:g,children:n.jsx(Qg,{})}):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:T,disabled:g,children:n.jsx(Bh,{})}):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,w==="staged"),children:n.jsx("span",{children:o(w==="staged"?"git.unstage":"git.stage")})}),w==="unstaged"?n.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:()=>void v(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?R0({nodes:r,depth:0,collapsedTreePathSet:a,selectedPath:i,onToggleTreePath:u,onSelectFile:c,onPreviewFile:d,onToggleMobileSelection:m,onStageToggle:f,onDiscard:v,actioning:g,variant:w,isMobileViewport:y,selectedMobilePathSet:x}):n.jsx("p",{className:"git-tree-status",children:o("git.noChanges")})})]})}function qf({title:e,count:t,expanded:r,onToggle:i,trailingContent:a,headerAction:u,children:c}){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(hm,{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})]})]}),u?n.jsx("div",{className:"git-mobile-section-header-action",children:u}):null]}),r?n.jsx("div",{className:"git-mobile-section-body",children:c}):null]})}function IC({title:e,nodes:t,collapsedTreePathSet:r,onToggleTreePath:i,onToggleMobileSelection:a,selectedMobilePathSet:u,selectedTargets:c,actioning:d,variant:m,swipeRowState:f,onSwipeRowChange:v,onStageToggle:g,onDiscardWithConfirm:w,onClearSelectedTargets:y,onPreviewFile:x}){return n.jsxs("div",{className:"git-mobile-record-shell",children:[c.length>0?n.jsxs("div",{className:"git-mobile-selection-toolbar",children:[n.jsxs("span",{className:"git-mobile-selection-count",children:[o("git.selectedFiles")," ",c.length]}),n.jsxs("div",{className:"git-mobile-selection-actions",children:[n.jsx("button",{type:"button",className:"secondary-button",disabled:d,onClick:()=>void g(c,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 w(c,`${c.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?D0({nodes:t,depth:0,collapsedTreePathSet:r,onToggleTreePath:i,onToggleMobileSelection:a,selectedMobilePathSet:u,actioning:d,variant:m,swipeRowState:f,onSwipeRowChange:v,onStageToggle:g,onDiscardWithConfirm:w,onPreviewFile:x}):n.jsx("p",{className:"git-tree-status",children:o("git.noChanges")})})]})}function D0({nodes:e,depth:t,collapsedTreePathSet:r,onToggleTreePath:i,onToggleMobileSelection:a,selectedMobilePathSet:u,actioning:c,variant:d,swipeRowState:m,onSwipeRowChange:f,onStageToggle:v,onDiscardWithConfirm:g,onPreviewFile:w}){return e.map(y=>{if(y.kind==="directory"){const j=!r.has(y.path),T=kv(y.children),P=`directory:${y.path}`;return n.jsxs("div",{className:"git-mobile-record-branch",children:[n.jsx(LC,{rowKey:P,openState:(m==null?void 0:m.path)===P?m.direction:null,onOpenStateChange:I=>f(I?{path:P,direction:I}:null),trailingActions:T.length>0?[{label:o(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void v(T,d==="staged")},...d==="unstaged"?[{label:o("git.discard"),tone:"danger",onPress:()=>void g(T,y.path)}]:[]]:null,children:n.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${MC+t*AC}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(hm,{expanded:j})}),n.jsx("span",{className:"git-mobile-record-title",children:y.name})]}),n.jsx("span",{className:"git-mobile-record-meta",children:T.length})]})}),j?n.jsx("div",{className:"git-mobile-record-children",role:"group",children:D0({nodes:y.children,depth:t+1,collapsedTreePathSet:r,onToggleTreePath:i,onToggleMobileSelection:a,selectedMobilePathSet:u,actioning:c,variant:d,swipeRowState:m,onSwipeRowChange:f,onStageToggle:v,onDiscardWithConfirm:g,onPreviewFile:w})}):null]},P)}const x=`file:${y.path}`,C=u.has(y.path);return n.jsx(LC,{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:()=>w(y.change.path,y.change)},{label:o(d==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void v([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:`${MC+t*AC}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":No(y.name),"aria-hidden":"true",children:jo(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 LC({rowKey:e,openState:t,onOpenStateChange:r,trailingActions:i,children:a}){const u=ts(),c=p.useRef(null),[d,m]=p.useState(0),f=((i==null?void 0:i.length)??0)*zf;p.useEffect(()=>{t||m(0)},[t,e]);const v=d!==0?d:t==="trailing"?-f:0;function g(C){var j,T;C.button===0&&(c.current={pointerId:C.pointerId,startX:C.clientX},(T=(j=C.currentTarget).setPointerCapture)==null||T.call(j,C.pointerId))}function w(C){const j=c.current;if(!j||j.pointerId!==C.pointerId)return;const T=f>0?f+10:0,P=Math.max(-T,Math.min(0,C.clientX-j.startX));m(P)}function y(C){var T,P;const j=c.current;if(!(!j||j.pointerId!==C.pointerId)){if((P=(T=C.currentTarget).releasePointerCapture)==null||P.call(T,C.pointerId),c.current=null,d<=-44&&(i!=null&&i.length)){u.trigger("gesture"),r("trailing"),m(0);return}r(null),m(0)}}function x(C){var T,P;const j=c.current;!j||j.pointerId!==C.pointerId||((P=(T=C.currentTarget).releasePointerCapture)==null||P.call(T,C.pointerId),c.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*zf,width:zf},onClick:()=>{u.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(${v}px)`},onPointerDown:g,onPointerMove:w,onPointerUp:y,onPointerCancel:x,children:a})]})}function G$({history:e,historyLoadingMore:t,hasMore:r,actioning:i,openCommitHash:a,onToggleMenu:u,onCopyCommitHash:c,onCopyCommitSubject:d,onUndoLastCommit:m,onLoadMore:f}){return e.length?n.jsxs("div",{className:"git-mobile-history-list",children:[e.map((v,g)=>{const w=a===v.commitHash,y=g===0&&v.commitKind==="local";return n.jsxs("article",{className:"git-mobile-history-entry","data-kind":v.commitKind,children:[n.jsxs("div",{className:"git-mobile-history-entry-main",children:[n.jsx("span",{className:"git-history-marker","data-kind":v.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:v.subject,children:v.subject}),n.jsx("span",{className:"git-history-kind-badge","data-kind":v.commitKind,children:I0(v.commitKind)})]}),v.refs.length>0?n.jsx("div",{className:"git-history-ref-list",children:v.refs.map(x=>n.jsx("span",{className:"git-history-ref-pill","data-kind":x.kind,"data-remote-index":String(L0(x.remoteName)),children:x.name},`${v.commitHash}:${x.kind}:${x.name}`))}):null,n.jsxs("div",{className:"git-history-meta",children:[n.jsx("span",{className:"git-history-hash",children:v.commitHash.slice(0,8)}),n.jsx("span",{children:v.authorName}),n.jsx("time",{dateTime:v.authoredAt,children:_0(v.authoredAt)})]})]}),n.jsx("button",{type:"button",className:"git-icon-button","aria-label":o("git.historyItemMenu"),onClick:()=>u(v.commitHash),children:n.jsx(Bh,{})})]}),w?n.jsxs("div",{className:"git-mobile-history-menu",children:[n.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>c(v.commitHash),children:n.jsx("span",{children:o("git.copyCommitHash")})}),n.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>d(v.subject),children:n.jsx("span",{children:o("git.copyCommitSubject")})}),y?n.jsx("button",{type:"button",className:"git-menu-item",disabled:i,onClick:m,children:n.jsx("span",{children:o("git.undoLastCommit")})}):null]}):null]},v.commitHash)}),r?n.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:t,onClick:f,children:t?`${o("git.refreshNow")}...`:o("common.loadMore")}):null]}):n.jsx("p",{className:"git-tree-status",children:o("git.noHistory")})}function R0({nodes:e,depth:t,collapsedTreePathSet:r,selectedPath:i,onToggleTreePath:a,onSelectFile:u,onPreviewFile:c,onToggleMobileSelection:d,onStageToggle:m,onDiscard:f,actioning:v,variant:g,isMobileViewport:w,selectedMobilePathSet:y}){return e.map(x=>{if(x.kind==="directory"){const T=!r.has(x.path),P=kv(x.children),I=`${o(g==="staged"?"git.unstage":"git.stage")} ${x.path}`,Z=`${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":T,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":T,children:n.jsx(hm,{expanded:T})}),n.jsx("span",{className:"git-tree-label git-tree-label-directory",children:x.name})]}),!w&&P.length>0?n.jsxs("div",{className:"git-row-actions",children:[n.jsx("button",{className:"git-icon-button",type:"button","aria-label":I,title:I,onClick:()=>void m(P,g==="staged"),disabled:v,children:n.jsx(Xg,{staged:g==="staged"})}),g==="unstaged"?n.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":Z,title:Z,onClick:()=>void f(P),disabled:v,children:n.jsx(Qg,{})}):null]}):null]}),T?n.jsx("div",{className:"git-tree-children",role:"group",children:R0({nodes:x.children,depth:t+1,collapsedTreePathSet:r,selectedPath:i,onToggleTreePath:a,onSelectFile:u,onPreviewFile:c,onToggleMobileSelection:d,onStageToggle:m,onDiscard:f,actioning:v,variant:g,isMobileViewport:w,selectedMobilePathSet:y})}):null]},`directory:${x.path}`)}const C=y.has(x.path),j=w?C:i===x.path;return w?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":No(x.name),"aria-hidden":"true",children:jo(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:()=>{u(x.change.path),c&&c(x.change.path,x.change)},children:[n.jsx("span",{className:"git-tree-file-icon","data-kind":No(x.name),"aria-hidden":"true",children:jo(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:v,children:n.jsx(Xg,{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:v,children:n.jsx(Qg,{})}):null]})]},`file:${x.path}`)})}function FC(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function _C(e,t){const r=FC("","");for(const i of e){const a=i.path.replace(/\\/g,"/"),u=a.split("/").filter(Boolean);let c=r;u.forEach((d,m)=>{const f=u.slice(0,m+1).join("/");if(m===u.length-1){c.children.set(`file:${f}`,{kind:"file",name:d,path:a,change:i,status:K$(i,t),variant:t});return}const v=`directory:${f}`,g=c.children.get(v);if(g&&g.kind==="directory"){c=g;return}const w=FC(d,f);c.children.set(v,w),c=w})}return A0(M0([...r.children.values()]))}function M0(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:M0([...t.children.values()])}:t)}function A0(e){return e.map(t=>{var c;if(t.kind!=="directory")return t;const r=A0(t.children);let i=t.name,a=t.path,u=r;for(;u.length===1&&((c=u[0])==null?void 0:c.kind)==="directory";){const d=u[0];i=`${i}/${d.name}`,a=d.path,u=d.children}return{kind:"directory",name:i,path:a,children:u}})}function OC(e,t,r){const i=new Set(e);return t.filter(a=>Yg(a,r)&&i.has(a.path)).map(a=>a.path)}function kv(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 Yg(e,t){return t==="staged"?!!e.stagedStatus:!!e.worktreeStatus}function K$(e,t){return t==="staged"?e.stagedStatus??e.status:e.worktreeStatus??e.status}function Y$(e){return{subject:E0(e).trim(),body:null,footer:null,source:"manual"}}function E0(e){return e.replace(/[\r\n]+/g," ")}function X$(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 I0(e){switch(e){case"local":return o("git.historyKindLocal");case"remote":return o("git.historyKindRemote");default:return o("git.historyKindShared")}}function L0(e){if(!e)return 0;let t=0;for(const r of e)t=t*33+r.charCodeAt(0)>>>0;return t%6}function us(e,t){return e instanceof ei?Q$(e)??e.message:typeof e=="object"&&e&&"message"in e?e.message:t}function $f(e){return`git-sidebar.snapshot.${e}`}function Q$(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 BC(e){return e instanceof ei&&e.errorCode==="GIT_REMOTE_AUTH_FAILED"}function J$(e){return!e||!e.mode||e.mode==="none"?Oh: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}:Oh}function Z$(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 e8(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 t8(i)?"github":"generic"}function t8(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 F0(e,t,r){const i=Math.max(0,r.width),a=Math.max(0,r.height),u=Math.max(0,a-Gi*2),c=Math.max(0,i-Gi*2),d=Math.min(Math.max(t.width||P0,0),c),m=Math.max(0,a-e.bottom-Kd-Gi),f=Math.max(0,e.top-Kd-Gi),v=m<t.height&&f>m,w=Vf(Math.max(v?f:m,V$),0,u),y=Math.min(Math.max(t.height,0),w),x=v?e.top-Kd-y:e.bottom+Kd,C=Math.max(Gi,a-Gi-y),j=Math.max(Gi,i-Gi-d);return{top:Vf(x,Gi,C),left:Vf(e.right-d,Gi,j),maxHeight:Math.max(0,w),transformOrigin:`${v?"bottom":"top"} right`}}function Vf(e,t,r){return!Number.isFinite(e)||r<t?t:Math.min(Math.max(e,t),r)}function hm({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 Xg({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 Qg(){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 n8(){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 Bh(){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 _0(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 r8=Object.freeze(Object.defineProperty({__proto__:null,GitSidebar:yv,resolveGitOperationsMenuPosition:F0},Symbol.toStringTag,{value:"Module"}));function SG(){return Ue.request("/api/terminals/shells")}function CG(e){return Ue.request(`/api/terminals?workspaceId=${encodeURIComponent(e)}`)}function i8(e){return Ue.request(`/api/terminals/templates/${encodeURIComponent(e)}/stop`,{method:"POST"})}function jG(e){return Ue.request("/api/terminals",{method:"POST",body:JSON.stringify(e)})}function NG(e){return Ue.request(`/api/terminals/${encodeURIComponent(e)}`,{method:"DELETE"})}function TG(e){return Ue.request(`/api/terminals/${encodeURIComponent(e)}/record`,{method:"DELETE"})}function PG(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 s8(e){return Ue.request("/api/terminals/templates",{method:"POST",body:JSON.stringify(e)})}function a8(e,t){return Ue.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function o8(e){return Ue.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"DELETE"})}function WC(e,t){return Ue.request(`/api/terminals/templates/${encodeURIComponent(e)}/run`,{method:"POST",body:JSON.stringify(t)})}function l8(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 UC(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 DG(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 c8(e){return e instanceof ei?e.errorCode==="RUNTIME_DEPENDENCY_MISSING"||e.message.includes("当前系统未安装 tmux"):!1}function u8({open:e,busy:t=!1,onClose:r,onConfirmFallback:i}){return p.useEffect(()=>{if(!e)return;function a(u){u.key==="Escape"&&!t&&r()}return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[t,r,e]),!e||typeof document>"u"?null:Xn.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 Yd={mode:"command",name:"",cwd:"",target:"",args:"",port:"",proxyEnabled:!1},HC=60*1e3;function d8(e){return e?new Date(e).toLocaleString():o("common.unknown")}function h8(e){return e.split(" ").map(t=>t.trim()).filter(Boolean)}function m8(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 p8(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 f8(e){const t=e.args.join(" ");return t?`${e.command} ${t}`:e.command}function g8(e){return{mode:O0(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 b8(e){return nb(`/proxy/${encodeURIComponent(e)}`)}function O0(e){const t=e.command.toLowerCase();return t.endsWith(".ps1")||t.endsWith(".bat")||t.endsWith(".cmd")||t.endsWith(".sh")?"script":"command"}function v8(e){const t=e.trim();if(!t)return null;const r=Number(t);return Number.isInteger(r)?r:Number.NaN}function zC(e,t){return e.get(t)??null}function w8(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 y8({open:e,title:t,description:r,onClose:i,children:a,className:u}){return p.useEffect(()=>{if(!e)return;function c(d){d.key==="Escape"&&i()}return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[i,e]),!e||typeof document>"u"?null:Xn.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",u].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 k8({open:e,busy:t,title:r,description:i,confirmLabel:a,onClose:u,onConfirm:c,className:d}){return p.useEffect(()=>{if(!e)return;function m(f){f.key==="Escape"&&!t&&u()}return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m)}},[t,u,e]),!e||typeof document>"u"?null:Xn.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:u}),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:u,children:o("common.cancel")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:t,onClick:()=>{c()},children:t?o("terminalManager.templateRemoving"):a})]})})]})]}),document.body)}function qC({label:e,value:t,options:r,open:i,onToggle:a,onChange:u}){const c=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} ${(c==null?void 0:c.label)??""}`.trim(),"aria-expanded":i?"true":"false",onClick:a,children:[n.jsxs("span",{className:"terminal-manager-mobile-picker-copy",children:[n.jsx("strong",{children:(c==null?void 0:c.label)??o("common.unknown")}),c!=null&&c.description?n.jsx("span",{children:c.description}):null]}),n.jsx(x8,{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:()=>{u(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(C8,{}):n.jsx(S8,{})})]},d.value||"__empty__")})}):null]})}function x8({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 S8(){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 C8(){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 xv({className:e,currentWorkspaceId:t,navigationGroups:r,externalWindowMode:i=!1,workbenchShellOverrides:a}){var bt,Qt,zt,on;const u=cr(),c=gr(),{subscribeTerminalManagerSnapshot:d,requestTerminalManagerRefresh:m,addTerminalManagerSnapshotListener:f}={...c,...a},v=(t==null?void 0:t.trim())||null,[g,w]=p.useState([]),[y,x]=p.useState([]),[C,j]=p.useState([]),[T,P]=p.useState([]),[I,Z]=p.useState(""),[q,B]=p.useState(""),[E,A]=p.useState(Yd),[H,_]=p.useState(null),[Y,z]=p.useState(null),[K,O]=p.useState([]),[F,te]=p.useState(!1),[de,W]=p.useState(!1),[M,N]=p.useState(null),[L,X]=p.useState(null),[D,be]=p.useState(null),[ce,le]=p.useState(null),[ye,Se]=p.useState(null),[_e,Ce]=p.useState(!1),[Nt,ct]=p.useState(null),{showToast:gt}=ir(),ft=(e==null?void 0:e.includes("mobile-tool-process-panel"))??!1,rt=H!==null,fe=H==="edit"?y.find(ae=>ae.id===Y)??null:null,ue=H==="edit";p.useEffect(()=>{tn("terminal_manager.props",{currentWorkspaceId:t,workspaceCount:r.length,externalWindowMode:i})},[t,i,r.length]);const Oe=p.useMemo(()=>T.find(ae=>ae.id===I)??null,[I,T]),qe=p.useMemo(()=>l8(u.ui.osFamily),[u.ui.osFamily]),nt=p.useMemo(()=>new Map(C.map(ae=>[ae.templateId,ae])),[C]),yt=p.useMemo(()=>C.filter(ae=>ae.occupied).length,[C]),Me=p.useMemo(()=>y.filter(ae=>ae.port!==null).length,[y]),Le=(Oe==null?void 0:Oe.available)===!1&&T.length>0;p.useEffect(()=>{Z(ae=>T.length?ae&&T.some($e=>$e.id===ae)?ae:m8(T):"")},[T]),p.useEffect(()=>{!rt||!v||T.length>0||ut(v)},[v,T.length,rt]),p.useEffect(()=>{rt||ct(null)},[rt]),p.useEffect(()=>{H==="edit"&&Y&&!fe&&(_(null),z(null),A(Yd),B(""),ct(null))},[fe,Y,H]),p.useEffect(()=>{!ce||D===ce.templateId||y.some(ae=>ae.id===ce.templateId)||le(null)},[ce,D,y]),p.useEffect(()=>{if(!v){w([]),x([]),j([]),te(!1);return}const ae=Rr(Gf(v),HC);tn("terminal_manager.snapshot",{workspaceId:v,cached:!!ae,cachedTemplateCount:(ae==null?void 0:ae.templates.length)??0,cachedStatusCount:(ae==null?void 0:ae.templateStatuses.length)??0}),ae?(w(ae.terminals),x(ae.templates),j(ae.templateStatuses),P(ae.shellOptions??[]),te(!1)):(w([]),x([]),j([]),P([]),te(!0))},[v]),p.useEffect(()=>{if(v)return f(ae=>{ae.workspaceId===v&&(tn("terminal_manager.snapshot_received",{workspaceId:ae.workspaceId,terminalCount:ae.terminals.length,templateCount:ae.templates.length,statusCount:ae.templateStatuses.length}),pt(ae),te(!1))})},[v,f]),p.useEffect(()=>{if(!v)return;const ae=Rr(Gf(v),HC)!==null;if(d(v),ae){const $e=window.setTimeout(()=>{ut(v)},1500);return()=>{window.clearTimeout($e)}}ut(v)},[v,m,d]),p.useEffect(()=>{v&&Zr(Gf(v),{terminals:g,templates:y,templateStatuses:C,shellOptions:T})},[v,T,C,y,g]);function pt(ae){w(ae.terminals),x(ae.templates),j(ae.templateStatuses),P(ae.shellOptions??[])}function ut(ae){tn("terminal_manager.refresh_requested",{workspaceId:ae}),m(ae)}function we(){_(null),z(null),A(Yd),B(""),ct(null)}function xe(){z(null),A(Yd),B(""),_("create")}function Qe(ae){z(ae.id),A(g8(ae)),B(ae.runtimeType??""),_("edit")}async function Fe(ae){if(v){X(ae);try{await i8(ae),ut(v),gt({title:o("terminalManager.stopProcessSuccess"),tone:"success"})}catch($e){gt({title:$e instanceof Error?$e.message:o("terminalManager.stopProcessFailed"),tone:"error"})}finally{X(null)}}}async function dt(){if(!v||!E.target.trim())return;const ae=v8(E.port);if(Number.isNaN(ae)){gt({title:o("terminalManager.invalidPort"),tone:"error"});return}if(E.proxyEnabled&&ae===null){gt({title:o("terminalManager.proxyPortRequired"),tone:"error"});return}W(!0);try{const $e={workspaceId:v,name:p8(E),cwd:E.cwd.trim()||void 0,command:E.target.trim(),args:h8(E.args),port:ae,proxyEnabled:E.proxyEnabled,runtimeType:q||null};if(ue&&Y){const ht=await a8(Y,$e);x(Wt=>Wt.map(jn=>jn.id===ht.id?ht:jn))}else await s8($e);we(),ut(v),gt({title:o(ue?"terminalManager.templateUpdateSuccess":"terminalManager.templateSaveSuccess"),tone:"success"})}catch($e){gt({title:$e instanceof Error?$e.message:o(ue?"terminalManager.templateUpdateFailed":"terminalManager.templateSaveFailed"),tone:"error"})}finally{W(!1)}}async function It(ae){const $e=await u.bridge.openExternal(ae);$e.ok||gt({title:$e.detail||o("terminalManager.openProxyUrlFailed"),tone:"error"})}async function qt(ae,$e){if(v){be(ae.id);try{await o8(ae.id),x(ht=>ht.filter(Wt=>Wt.id!==ae.id)),j(ht=>ht.filter(Wt=>Wt.templateId!==ae.id)),O(ht=>ht.filter(Wt=>Wt!==ae.id)),le(ht=>(ht==null?void 0:ht.templateId)===ae.id?null:ht),Y===ae.id&&we(),ut(v),gt({title:o("terminalManager.templateDeleteSuccess"),tone:"success"})}catch(ht){gt({title:ht instanceof Error?ht.message:o("terminalManager.templateDeleteFailed"),tone:"error"})}finally{be(null)}}}async function Ht(ae){if(!v)return;const $e=Oe!=null&&Oe.available?Oe.shell:void 0;N(ae);try{await WC(ae,{shell:$e}),ut(v),gt({title:o("terminalManager.templateRunSuccess"),tone:"success"})}catch(ht){if(c8(ht)){Se({templateId:ae,shell:$e});return}gt({title:ht instanceof Error?ht.message:o("terminalManager.templateRunFailed"),tone:"error"})}finally{N(null)}}async function Ft(){if(!(!v||!ye)){Ce(!0);try{await WC(ye.templateId,{shell:ye.shell,runtimeType:"embedded-pty"}),Se(null),ut(v),gt({title:o("terminalManager.templateRunSuccess"),tone:"success"})}catch(ae){gt({title:ae instanceof Error?ae.message:o("terminalManager.templateRunFailed"),tone:"error"})}finally{Ce(!1)}}}function Dt(ae){O($e=>$e.includes(ae)?$e.filter(ht=>ht!==ae):[...$e,ae])}return r.length?v?n.jsxs("section",{className:["conversation-panel","surface-card","terminal-manager-panel",e].filter(Boolean).join(" "),children:[n.jsx(u8,{open:ye!==null,busy:_e,onClose:()=>{_e||Se(null)},onConfirmFallback:()=>{Ft()}}),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:yt})]}),n.jsxs("article",{className:"terminal-manager-overview-card",children:[n.jsx("span",{children:o("terminalManager.portWatchCountLabel")}),n.jsx("strong",{children:Me})]}),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:!v||F,onClick:()=>{v&&ut(v)},children:o("terminalManager.refresh")}),n.jsx("button",{className:"primary-button",type:"button",disabled:!v,onClick:()=>{xe()},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})]}),F&&!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(ae=>{const $e=zC(nt,ae.id),ht=w8(ae,$e),Wt=K.includes(ae.id),jn=o(Wt?"terminalManager.hideDetailsAction":"terminalManager.showDetailsAction"),ln=ae.proxyEnabled&&ae.proxySlug?b8(ae.proxySlug):null;return n.jsxs("article",{className:"terminal-manager-card terminal-manager-desktop-card","data-tone":ht.tone,"data-expanded":Wt?"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:ae.name})]}),n.jsxs("div",{className:"terminal-manager-card-tools",children:[n.jsx("span",{className:"badge terminal-runtime-badge",children:UC(ae.runtimeType,u.ui.osFamily)}),n.jsx("span",{className:"badge",children:O0(ae)==="script"?o("terminalManager.scriptMode"):o("terminalManager.commandMode")}),n.jsx("button",{className:"terminal-manager-detail-toggle",type:"button","aria-label":jn,"aria-expanded":Wt,onClick:()=>{Dt(ae.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:ht.title}),n.jsx("p",{className:"status-text",children:ht.summary})]}),n.jsxs("div",{className:"terminal-manager-status-badges",children:[n.jsx("span",{className:"terminal-manager-stat-pill",children:ae.port===null?o("terminalManager.portUnset"):`${o("terminalManager.portLabel")} ${ae.port}`}),n.jsx("span",{className:"badge","data-tone":ht.badgeTone,children:ht.badgeLabel}),ae.proxyEnabled?n.jsx("span",{className:"badge",children:o("terminalManager.proxyEnabled")}):null]})]}),n.jsxs("div",{className:"terminal-manager-actions",children:[$e!=null&&$e.occupied?n.jsx("button",{className:"secondary-button",type:"button",disabled:L===ae.id,onClick:()=>{Fe(ae.id)},children:L===ae.id?o("terminalManager.stoppingProcess"):o("terminalManager.stopProcessAction")}):null,n.jsx("button",{className:"secondary-button",type:"button",disabled:M===ae.id||Le,onClick:()=>{Ht(ae.id)},children:M===ae.id?o("terminalManager.runningTemplate"):o("terminalManager.runTemplateAction")})]}),Wt?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:f8(ae)})]}),n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.cwdLabel")}),n.jsx("strong",{children:ae.cwd})]}),n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminal.runtimeField")}),n.jsx("strong",{children:UC(ae.runtimeType,u.ui.osFamily)})]}),n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.updatedAt")}),n.jsx("strong",{children:d8(ae.updatedAt)})]}),n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.portLabel")}),n.jsx("strong",{children:ae.port===null?o("terminalManager.portUnset"):ae.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:ln??o("terminalManager.proxyDisabledDescription")})]}),$e!=null&&$e.processId?n.jsxs("div",{className:"terminal-manager-detail-item",children:[n.jsx("span",{children:o("terminalManager.processIdLabel")}),n.jsx("strong",{children:$e.processId})]}):null,$e!=null&&$e.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:$e.processCommandLine})]}):null]}),n.jsxs("div",{className:"terminal-manager-actions terminal-manager-detail-actions",children:[ln?n.jsx("button",{className:"secondary-button",type:"button",onClick:()=>{It(ln)},children:o("terminalManager.openProxyUrlAction")}):null,n.jsx("button",{className:"secondary-button",type:"button",disabled:de||D===ae.id,onClick:()=>{Qe(ae)},children:o("terminalManager.editAction")}),n.jsx("button",{className:"secondary-button workbench-danger-button",type:"button",disabled:D===ae.id,onClick:()=>{le({templateId:ae.id,name:ae.name,occupied:!!($e!=null&&$e.occupied)})},children:D===ae.id?o("terminalManager.templateRemoving"):o("terminalManager.removeAction")})]})]}):null]},ae.id)})}):n.jsx("section",{className:"workbench-empty-state minimal",children:n.jsx("p",{children:o("terminalManager.emptyTemplateBody")})})]}),n.jsx(y8,{open:rt,title:o(ue?"terminalManager.editModalTitle":"terminalManager.createModalTitle"),description:o(ue?"terminalManager.editModalDescription":"terminalManager.createModalDescription"),className:ft?"terminal-manager-mobile-modal":void 0,onClose:we,children:n.jsxs("section",{className:"terminal-manager-modal-form",children:[ft?n.jsxs(n.Fragment,{children:[n.jsx(qC,{label:o("terminalManager.shellField"),value:I,open:Nt==="shell",options:T.map(ae=>({value:ae.id,label:ae.label,description:ae.available?null:ae.unavailableReason??o("terminalManager.shellUnavailable"),disabled:!ae.available})),onToggle:()=>{ct(ae=>ae==="shell"?null:"shell")},onChange:ae=>{Z(ae),ct(null)}}),(Oe==null?void 0:Oe.available)===!1&&Oe.unavailableReason?n.jsx("p",{className:"status-text",children:Oe.unavailableReason}):null,n.jsx(qC,{label:o("terminal.runtimeField"),value:q,open:Nt==="runtime",options:qe.map(ae=>({value:ae.value,label:ae.label,description:ae.description})),onToggle:()=>{ct(ae=>ae==="runtime"?null:"runtime")},onChange:ae=>{B(ae),ct(null)}}),n.jsx("p",{className:"status-text",children:((bt=qe.find(ae=>ae.value===q))==null?void 0:bt.description)??((Qt=qe[0])==null?void 0:Qt.description)})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.shellField")}),n.jsx("select",{value:I,onChange:ae=>{Z(ae.target.value)},children:T.map(ae=>n.jsx("option",{value:ae.id,disabled:!ae.available,children:ae.available?ae.label:`${ae.label} - ${o("terminalManager.shellUnavailable")}`},ae.id))}),(Oe==null?void 0:Oe.available)===!1&&Oe.unavailableReason?n.jsx("p",{className:"status-text",children:Oe.unavailableReason}):null]}),n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminal.runtimeField")}),n.jsx("select",{value:q,onChange:ae=>{B(ae.target.value)},children:qe.map(ae=>n.jsx("option",{value:ae.value,children:ae.label},ae.value||"auto"))}),n.jsx("p",{className:"status-text",children:((zt=qe.find(ae=>ae.value===q))==null?void 0:zt.description)??((on=qe[0])==null?void 0:on.description)})]})]}),n.jsxs("div",{className:"terminal-manager-mode-row",role:"tablist","aria-label":o("terminalManager.modeField"),children:[n.jsx("button",{type:"button",className:E.mode==="command"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{A(ae=>({...ae,mode:"command"}))},children:o("terminalManager.commandMode")}),n.jsx("button",{type:"button",className:E.mode==="script"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{A(ae=>({...ae,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:E.name,placeholder:o("terminalManager.templateNamePlaceholder"),onChange:ae=>{A($e=>({...$e,name:ae.target.value}))}})]}),n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.cwdField")}),n.jsx("input",{value:E.cwd,placeholder:o("terminalManager.cwdPlaceholder"),onChange:ae=>{A($e=>({...$e,cwd:ae.target.value}))}})]})]}),n.jsxs("div",{className:"terminal-manager-grid",children:[n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:E.mode==="script"?o("terminalManager.scriptPathField"):o("terminalManager.commandField")}),n.jsx("input",{value:E.target,placeholder:E.mode==="script"?o("terminalManager.scriptPathPlaceholder"):o("terminalManager.commandPlaceholder"),onChange:ae=>{A($e=>({...$e,target:ae.target.value}))}})]}),n.jsxs("div",{className:"field-group",children:[n.jsx("span",{children:o("terminalManager.argsField")}),n.jsx("input",{value:E.args,placeholder:o("terminalManager.argsPlaceholder"),onChange:ae=>{A($e=>({...$e,args:ae.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:E.port,placeholder:o("terminalManager.portPlaceholder"),onChange:ae=>{A($e=>({...$e,port:ae.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:E.proxyEnabled,onChange:ae=>{A($e=>({...$e,proxyEnabled:ae.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:we,children:o("common.close")}),n.jsx("button",{className:"primary-button",type:"button",disabled:!v||de||!E.target.trim(),onClick:()=>{dt()},children:o(de?ue?"terminalManager.templateUpdating":"terminalManager.templateSaving":ue?"terminalManager.saveTemplateChangesAction":"terminalManager.saveLaunchAction")})]})]})}),n.jsx(k8,{open:ce!==null,busy:ce!==null&&D===ce.templateId,title:o("terminalManager.removeConfirmTitle"),description:ce?o(ce.occupied?"terminalManager.removeRunningConfirmTarget":"terminalManager.removeConfirmTarget",{name:ce.name}):"",confirmLabel:o("terminalManager.removeConfirmAction"),className:ft?"terminal-manager-mobile-modal":"terminal-manager-confirm-modal",onClose:()=>{D||le(null)},onConfirm:()=>{if(!ce)return;const ae=y.find($e=>$e.id===ce.templateId);if(!ae){le(null);return}zC(nt,ae.id),qt(ae)}})]}):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 Gf(e){return`terminal-manager.snapshot.${e}`}const j8=Object.freeze(Object.defineProperty({__proto__:null,TerminalManagerPanel:xv},Symbol.toStringTag,{value:"Module"}));function $C(e){return!e||!Array.isArray(e.items)?[]:e.items.map(t=>({workspace:t.workspace,sessions:[...t.sessions].sort((r,i)=>(i.lastMessageAt??i.updatedAt).localeCompare(r.lastMessageAt??r.updatedAt)),childWorktrees:Array.isArray(t.childWorktrees)?t.childWorktrees:[]}))}function N8(e){return{navigationGroups:e,subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function T8(){return{subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function P8(){return{subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function D8(e){return e.kind==="files"?o("shell.filesEntry"):e.kind==="git"?o("shell.gitEntry"):e.kind==="processes"?o("shell.terminalManagerEntry"):e.kind}function R8(){const{windowId:e}=Po(),t=dr(),r=cr(),[i,a]=p.useState(null),[u,c]=p.useState(!0),[d,m]=p.useState(null),[f,v]=p.useState([]),[g,w]=p.useState(null);p.useEffect(()=>{let T=!1;async function P(){if(!e){a(null),c(!1),m(o("desktopWindow.invalidWindowId"));return}c(!0),m(null);const I=await r.bridge.getWindowDescriptor(e),Z=I.ok?I.value??null:r.windows.getDescriptor(e);if(!T){if(!Z){a(null),c(!1),m(I.detail??o("desktopWindow.loadDescriptorFailed"));return}r.windows.registerDescriptor(Z),r.windows.markWindowOpen(Z.windowId),a(Z),c(!1)}}return P(),()=>{T=!0}},[r,e]),p.useEffect(()=>{if(!(i!=null&&i.workspaceId)){v([]);return}let T=!1;async function P(){try{const I=await YN();if(T)return;v($C(I))}catch{if(T)return;v([])}}return P(),()=>{T=!0}},[i==null?void 0:i.workspaceId]),p.useEffect(()=>{if(!i){w(null);return}const T=new FN({onConnectionChange:()=>{},onSnapshot:P=>{v($C(P))},onUnauthorized:()=>{rr.clear(),t(`/login?returnTo=${encodeURIComponent(`/desktop-window/${i.windowId}`)}`,{replace:!0})}});return w(T),T.start(),()=>{T.close(),w(null)}},[i,t]);const y=p.useMemo(()=>g?{navigationGroups:f,subscribeFileTree:g.subscribeFileTree.bind(g),requestFileTreeRefresh:g.requestFileTreeRefresh.bind(g),addFileTreeSnapshotListener:g.addFileTreeSnapshotListener.bind(g),subscribeGitSnapshot:g.subscribeGit.bind(g),requestGitRefresh:g.requestGitRefresh.bind(g),addGitSnapshotListener:g.addGitSnapshotListener.bind(g)}:N8(f),[f,g]),x=p.useMemo(()=>g?{subscribeGitSnapshot:g.subscribeGit.bind(g),requestGitRefresh:g.requestGitRefresh.bind(g),addGitSnapshotListener:g.addGitSnapshotListener.bind(g)}:T8(),[g]),C=p.useMemo(()=>g?{subscribeTerminalManagerSnapshot:g.subscribeTerminalManager.bind(g),requestTerminalManagerRefresh:g.requestTerminalManagerRefresh.bind(g),addTerminalManagerSnapshotListener:g.addTerminalManagerSnapshotListener.bind(g)}:P8(),[g]);if(!r.isDesktop)return n.jsx(Pl,{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(d)return n.jsx("main",{className:"desktop-window-page",children:n.jsx("p",{className:"status-text",children:d})});if(!i)return n.jsx("main",{className:"desktop-window-page",children:n.jsx("p",{className:"status-text",children:o("desktopWindow.loadDescriptorFailed")})});let j=null;return i.kind==="files"?j=n.jsx(vv,{sessionId:i.sessionId,workspaceId:i.workspaceId,externalWindowMode:!0,workbenchShellOverrides:y}):i.kind==="git"?j=n.jsx(yv,{workspaceId:i.workspaceId,externalWindowMode:!0,workbenchShellOverrides:x}):i.kind==="processes"&&(j=n.jsx(xv,{currentWorkspaceId:i.workspaceId,navigationGroups:f,externalWindowMode:!0,workbenchShellOverrides:C})),j?n.jsx("main",{className:"desktop-window-page",children:n.jsx("div",{className:"desktop-window-body","data-window-kind":i.kind,"aria-label":D8(i),children:j})}):n.jsx("main",{className:"desktop-window-page",children:n.jsx("p",{className:"status-text",children:o("desktopWindow.unsupportedKind",{kind:i.kind})})})}const M8=420,ds=12,Kf=8,Yf=160,A8=156;function E8({entry:e,isFavorite:t,isActive:r=!1,depth:i=0,variant:a="default",workspaceTone:u="root",hasSubsessions:c=!1,subsessionsExpanded:d=!1,showActions:m=!0,onActivate:f,onToggleSubsessions:v,onToggleFavorite:g,onArchive:w,onUnarchive:y,onRename:x}){const[C,j]=p.useState(!1),[T,P]=p.useState(null),I=p.useRef(null),Z=p.useRef(!1),q=p.useRef(null),B=p.useRef(null),E=ts(),{session:A,workspace:H}=e,_=A.title??A.sessionId,Y=Zi(A.provider),z=[Y,I8(A.lastMessageAt??A.updatedAt??null),qc(A)].filter(Boolean).join(" · "),K=F8(A),O=K?_8(K):null,F=a==="mobile"?null:qc(A),te=F?gT("session-list-activity-badge",A):null;p.useEffect(()=>()=>{de()},[]),p.useLayoutEffect(()=>{if(!C||typeof window>"u"){P(null);return}let ce=0;const le=()=>{var we,xe;const Ce=q.current;if(!Ce)return;const Nt=Ce.getBoundingClientRect(),ct=window.innerWidth,gt=window.innerHeight,ft=Math.max(0,ct-ds*2),rt=ft>0?Math.min(Math.max(((we=B.current)==null?void 0:we.offsetWidth)??Yf,Yf),ft):Yf,fe=Math.max(((xe=B.current)==null?void 0:xe.offsetHeight)??0,A8),ue=Nt.right-rt,Oe=Math.max(ds,ct-rt-ds),qe=Math.min(Math.max(ds,ue),Oe),nt=Nt.top-ds,yt=gt-Nt.bottom-ds,Me=yt<fe+Kf&&nt>yt,Le=Me?Nt.top-fe-Kf:Nt.bottom+Kf,pt=Math.max(ds,gt-fe-ds),ut=Math.min(Math.max(ds,Le),pt);P({position:"fixed",left:`${Math.round(qe)}px`,top:`${Math.round(ut)}px`,width:`${Math.round(rt)}px`,maxWidth:`calc(100vw - ${ds*2}px)`,maxHeight:`${Math.max(96,gt-ds*2)}px`,transformOrigin:Me?"bottom right":"top right"})},ye=()=>{window.cancelAnimationFrame(ce),ce=window.requestAnimationFrame(le)},Se=Ce=>{var ct,gt;const Nt=Ce.target;Nt&&!((ct=B.current)!=null&&ct.contains(Nt))&&!((gt=q.current)!=null&>.contains(Nt))&&j(!1)},_e=Ce=>{Ce.key==="Escape"&&j(!1)};return ye(),window.addEventListener("pointerdown",Se),window.addEventListener("keydown",_e),window.addEventListener("resize",ye),window.addEventListener("scroll",ye,!0),()=>{window.cancelAnimationFrame(ce),window.removeEventListener("pointerdown",Se),window.removeEventListener("keydown",_e),window.removeEventListener("resize",ye),window.removeEventListener("scroll",ye,!0)}},[C]);function de(){I.current!==null&&(window.clearTimeout(I.current),I.current=null)}function W(ce){!c||ce.pointerType==="mouse"||(de(),I.current=window.setTimeout(()=>{Z.current=!0,E.trigger("gesture"),v==null||v()},M8))}function M(){de()}function N(){if(Z.current){Z.current=!1;return}E.trigger("selection"),f(A.sessionId)}const L=async()=>{const ce=window.prompt(o("shell.renameModalDescription"),_);ce&&(await x(A.sessionId,ce.trim()),j(!1))},X=async()=>{if(A.isArchived){await y(A.sessionId),j(!1);return}await w(A.sessionId),j(!1)},D=()=>{g(A.sessionId),j(!1)},be=C&&typeof document<"u"?Xn.createPortal(n.jsxs("div",{ref:B,className:"session-action-menu surface-card",role:"menu","aria-label":o("shell.sessionMoreAction"),style:T??{position:"fixed",top:0,left:0,visibility:"hidden"},onClick:ce=>ce.stopPropagation(),children:[n.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:D,children:o(t?"shell.unfavoriteAction":"shell.favoriteAction")}),n.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void X(),children:A.isArchived?o("shell.unarchiveAction"):o("shell.archiveAction")}),n.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void L(),children:o("shell.renameAction")})]}),document.body):null;return n.jsxs("article",{className:"session-list-item","data-depth":i,"data-active":r,"data-workspace-tone":u,"data-has-subsessions":c,"data-variant":a,children:[c?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:ce=>{ce.stopPropagation(),E.trigger("selection"),v==null||v()},children:n.jsx("span",{className:VC(A,{isActive:r,hasSubsessions:c}),"aria-hidden":"true"})}):n.jsx("span",{className:VC(A,{isActive:r,hasSubsessions:c}),"aria-hidden":"true"}),n.jsx("button",{type:"button",className:"session-list-link",onClick:N,onPointerDown:W,onPointerUp:M,onPointerCancel:M,onPointerLeave:M,children:n.jsxs("div",{className:"session-list-copy",children:[n.jsx("div",{className:"session-list-title",children:_||o("shell.searchEntry")}),n.jsx("div",{className:"session-list-meta",children:a==="mobile"?n.jsx("span",{children:z}):n.jsxs(n.Fragment,{children:[n.jsx("span",{children:H.name}),F&&te?n.jsxs(n.Fragment,{children:[n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx("span",{className:te,children:F})]}):null,n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx("span",{children:Y})]})}),O?n.jsx("div",{className:"session-list-error",title:K??void 0,children:O}):null]})}),m?n.jsx("div",{className:"session-list-actions",children:n.jsx("button",{ref:q,type:"button",className:"ghost-button","aria-expanded":C,"aria-haspopup":"menu",onClick:()=>{E.trigger("selection"),j(ce=>!ce)},children:o("shell.sessionMoreAction")})}):null,be]})}function VC(e,t){return Lb("session-list-indicator",e,{isActive:t.isActive,hasSubagents:t.hasSubsessions})}function I8(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):o("common.unknown")}function L8(e){return mu(e)||e.syncStatus==="error"}function F8(e){var i,a;if(!L8(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"&&!mu(e)?o("conversation.syncStatusError"):o("conversation.runtimeErrorTitle"))}function _8(e,t=96){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}const Xd=5;function O8(){var de;const e=dr(),{navigationGroups:t,favoriteSessionIds:r,currentWorkspaceId:i,currentSessionId:a,navigationLoading:u,selectWorkspace:c,toggleFavoriteSession:d,archiveSession:m,unarchiveSession:f,renameSession:v,startDraftSession:g}=gr(),w=yu(t),y=p.useMemo(()=>Xh(t),[t]),x=ea(t,i)??ea(t,((de=t[0])==null?void 0:de.workspace.id)??null),C=w.find(W=>W.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]),T=p.useMemo(()=>x?x.sessions.filter(W=>{var L;if(W.isArchived)return!1;const M=((L=W.parentSessionId)==null?void 0:L.trim())||null;if(!M)return!0;const N=x.sessions.find(X=>X.sessionId===M);return!N||!N.isArchived}).map(W=>({session:W,workspace:x.workspace})):[],[x]),P=p.useMemo(()=>db(T),[T]),I=(x==null?void 0:x.workspace.id)??"",Z=!!I,[q,B]=p.useState([]),[E,A]=p.useState({}),[H,_]=p.useState(!1);p.useEffect(()=>{A(W=>{const M={};for(const N of P){const L=Ji(As(N));if(L.length===0)continue;const X=L.findIndex(D=>D.item.session.sessionId===a);M[N.item.session.sessionId]=W8(L.length,Xd,W[N.item.session.sessionId],X)}return U8(W,M)?W:M})},[a,P]),p.useEffect(()=>{if(!a)return;const W=Js(P,a,M=>M.session.sessionId);W.length!==0&&B(M=>{const N=new Set(M);let L=!1;for(const X of W)N.has(X)||(N.add(X),L=!0);return L?Array.from(N):M})},[a,P]);function Y(W){B(M=>M.includes(W)?M.filter(N=>N!==W):[...M,W])}function z(W){return E[W]??Xd}function K(W){A(M=>({...M,[W]:(M[W]??Xd)+Xd}))}function O(W,M){fs("immersive"),e(fr(W,M))}function F(W,M){_(!1),fs("immersive"),g(W,M)}function te(W,M=!1,N=[],L=!1,X=!1){var ft;const D=W.item.session.sessionId,be=W.children,ce=W.depth===0&&be.length>0,le=M||ce&&q.includes(D),ye=le&&ce,Se=ye?B8(W,z(D)):W,_e=le?Se.children:[],Ce=Ji(be).length,Nt=Ji(_e).length,ct=ye&&Nt<Ce,gt=W.depth>0?[...N,L]:[...N];return n.jsxs("div",{className:"session-list-tree-node",children:[n.jsxs("div",{className:"session-list-tree-row",style:{"--session-tree-depth":W.depth},children:[W.depth>0?n.jsxs("div",{className:"session-tree-guides","aria-hidden":"true",style:{"--session-tree-depth":W.depth},children:[N.map((rt,fe)=>rt?n.jsx("span",{className:"session-tree-guide-column",style:{"--session-tree-level":fe+1}},`${D}:ancestor:${fe}`):null),n.jsx("span",{className:"session-tree-guide-branch","data-continue":L,"data-first":X,style:{"--session-tree-level":W.depth},children:n.jsx("span",{className:"session-tree-guide-branch-horizontal"})})]}):null,n.jsx(E8,{entry:W.item,isFavorite:j.has(D),isActive:a===D,depth:W.depth,variant:"mobile",workspaceTone:((ft=y[W.item.workspace.id])==null?void 0:ft.tone)??"root",hasSubsessions:ce,subsessionsExpanded:le,onActivate:rt=>O(W.item.workspace.id,rt),onToggleSubsessions:ce?()=>Y(D):void 0,onToggleFavorite:rt=>{d(rt)},onArchive:rt=>m(rt),onUnarchive:rt=>f(rt),onRename:(rt,fe)=>v(rt,fe)})]}),le&&_e.length>0?n.jsx("div",{className:"session-list-children",children:_e.map((rt,fe)=>te(rt,!0,gt,fe<_e.length-1,fe===0))}):null,ct?n.jsx("div",{className:"session-list-children",children:n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>K(D),children:o("shell.subagentExpandMore")})}):null]},`${W.item.workspace.id}:${D}`)}return n.jsxs("main",{className:"session-index-page mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header",children:[n.jsx(Ro,{currentWorkspace:C?{id:C.workspace.id,name:C.label,path:C.subtitle}:null,workspaces:t.map(W=>W.workspace),workspaceOptions:w,onSelectWorkspace:W=>{c(W),e(yo(W))},content:n.jsx("button",{type:"button",className:"primary-button mobile-session-index-create-button",disabled:u||!Z,onClick:()=>_(!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(u?"shell.searchSessionHint":"shell.emptyWorkspaceSessions")}):n.jsx("div",{className:"session-current-workspace-list",children:P.map(W=>te(W))})]})}),n.jsx(ku,{open:H,workspaces:t.map(W=>W.workspace),workspaceOptions:w,initialWorkspaceId:i??I,onClose:()=>_(!1),onSelect:F})]})}function B8(e,t){const r=new Set(Ji(As(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:B0(As(e),r)}}function B0(e,t){return e.flatMap(r=>{const i=B0(As(r),t);return!t.has(r.item.session.sessionId)&&i.length===0?[]:[{...r,children:i}]})}function W8(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 U8(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 H8(){const{currentWorkspaceId:e}=gr();return e?n.jsx(Pl,{to:Dl(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 z8(){const{currentWorkspaceId:e}=gr();return e?n.jsx(Pl,{to:Dl(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 q8(){const{currentWorkspaceId:e,navigationGroups:t}=gr();return e?n.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root mobile-tool-panel-page mobile-tool-process-page",children:n.jsx(xv,{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 W0="mobile.tools.last-primary-tool",ph=["files","git"],$8=56,V8=1.2;function GC(e,t){return e==="git"?"git":e==="files"?"files":t}function G8(e,t,r){if(!t)return e;const i=r.x-t.x,a=r.y-t.y;if(Math.abs(i)<$8||Math.abs(i)<Math.abs(a)*V8)return e;const u=ph.indexOf(e),c=i<0?Math.min(ph.length-1,u+1):Math.max(0,u-1);return ph[c]??e}function K8(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(W0)==="git"?"git":"files"}catch{return"files"}}function Y8(){var I,Z;const e=es(),t=dr(),r=ts(),{navigationGroups:i,currentWorkspaceId:a,currentSessionId:u,selectWorkspace:c}=gr(),d=((I=i.find(q=>q.workspace.id===a))==null?void 0:I.workspace)??((Z=i[0])==null?void 0:Z.workspace)??null,m=new URLSearchParams(e.search).get("tab"),f=p.useRef(K8()),v=GC(m,f.current),[g,w]=p.useState(()=>{const q=GC(m,f.current);return{files:q==="files",git:q==="git"}}),y=p.useRef(null),x=p.useMemo(()=>[{key:"files",title:o("shell.filesEntry"),render:()=>n.jsx(vv,{sessionId:u,workspaceId:a,hideHeading:!0})},{key:"git",title:o("shell.gitEntry"),render:()=>n.jsx(yv,{className:"mobile-tool-native-panel mobile-tool-git-panel",workspaceId:a,panelActive:v==="git"})}],[v,u,a]),C=ph.indexOf(v);p.useEffect(()=>{w(q=>({...q,[v]:!0}))},[v]),p.useEffect(()=>{if(f.current=v,!(typeof window>"u"))try{window.localStorage.setItem(W0,v)}catch{}},[v]),p.useEffect(()=>{if(m===v)return;const q=new URLSearchParams(e.search);q.set("tab",v),t({pathname:e.pathname,search:`?${q.toString()}`},{replace:!0})},[v,e.pathname,e.search,t,m]);function j(q,B="selection"){if(q===v)return;r.trigger(B);const E=new URLSearchParams(e.search);E.set("tab",q),t({pathname:e.pathname,search:`?${E.toString()}`},{replace:!0})}function T(q){if(q.changedTouches.length!==1){y.current=null;return}const B=q.changedTouches[0];y.current={x:B.clientX,y:B.clientY}}function P(q){const B=y.current;if(y.current=null,q.changedTouches.length!==1)return;const E=q.changedTouches[0],A=G8(v,B,{x:E.clientX,y:E.clientY});A!==v&&j(A)}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(Ro,{currentWorkspace:d,workspaces:i.map(q=>q.workspace),onSelectWorkspace:q=>{c(q),t(Dl(q,v))},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($h(d.id))},children:n.jsx(X8,{})}),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(q=>{const B=q.key===v;return n.jsx("button",{type:"button",role:"tab",className:"mobile-tools-segmented-button","data-active":B,"aria-selected":B,"aria-controls":`mobile-tool-panel-${q.key}`,onClick:()=>j(q.key,"selection"),children:q.title},q.key)})})})}),n.jsx("section",{className:"mobile-tools-stage","data-active-tool":v,"data-testid":"mobile-tools-stage",onTouchStart:T,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(q=>n.jsx("article",{id:`mobile-tool-panel-${q.key}`,role:"tabpanel","aria-label":q.title,"aria-hidden":q.key!==v,className:"mobile-tools-stage-panel",children:n.jsx("div",{className:"mobile-tools-stage-panel-shell",children:g[q.key]?q.render():null})},q.key))})})})]}):n.jsx("article",{className:"mobile-feature-empty surface-card",children:n.jsx("p",{children:o("shell.emptyNavigationBody")})})})}function X8(){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 Q8(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(Hn,{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:J8(r.kind)}),n.jsx("time",{children:Z8(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 J8(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 Z8(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 eV(e){return e.isArchived!==!0&&!Ua(e)}function U0(e){return e.activityState==="running"||e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting"}function tV(e){return e.activityState==="idle"&&U0(e)===!1}function KC(e){return e==="creating"||e==="running"}function Wh(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt}function nV(e,t){return Wh(t).localeCompare(Wh(e))}function YC(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):o("common.unknown")}function ho(e){return e!==null&&e>0}const Qd=60*1e3,rV=15e3;function iV(){var yt;const e=dr(),{showToast:t}=ir(),r=gr(),{navigationGroups:i,currentWorkspaceId:a,refreshNavigation:u,selectWorkspace:c,startDraftSession:d,subscribeGitSnapshot:m,requestGitRefresh:f,addGitSnapshotListener:v,subscribeTerminalManagerSnapshot:g,requestTerminalManagerRefresh:w,addTerminalManagerSnapshotListener:y}=r,x=r.globalNotifications??[],C=new Set(r.archivedNotificationIds??[]),j=r.showArchivedNotifications??!1,T=r.unreadNotificationCount??0,P=r.setShowArchivedNotifications??(()=>{}),I=r.archiveNotification??(()=>{}),Z=r.unarchiveNotification??(()=>{}),[q,B]=p.useState(null),[E,A]=p.useState(!1),[H,_]=p.useState(!1),[Y,z]=p.useState(!1),[K,O]=p.useState({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null}),[F,te]=p.useState({loading:!0,activeTaskCount:0,pendingInboxCount:0}),de=yu(i),W=ea(i,a)??ea(i,((yt=i[0])==null?void 0:yt.workspace.id)??null),M=(W==null?void 0:W.workspace)??null,N=de.find(Me=>Me.workspace.id===(M==null?void 0:M.id))??(M?{workspace:M,label:M.name,subtitle:M.path}:null),L=[...(W==null?void 0:W.sessions)??[]].filter(eV).sort(nV),X=L.filter(U0),D=L.filter(tV),be=L.filter(Me=>Me.isFavorite===!0),ce=X.slice(0,6),le=be.slice(0,6),ye=K.quickLaunchRunning===null?"…":K.quickLaunchRunning?o("shell.workspaceHomeQuickLaunchRunning"):o("shell.workspaceHomeQuickLaunchStopped");p.useEffect(()=>{const Me=(M==null?void 0:M.id)??null;if(!Me){O({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null});return}const Le=Rr(Xf(Me),Qd);O(pt=>{var ut,we;return{...pt,gitLoading:Le===null,branch:((ut=Le==null?void 0:Le.status)==null?void 0:ut.snapshot.branch)??null,changedFileCount:((we=Le==null?void 0:Le.status)==null?void 0:we.changes.length)??null}})},[M==null?void 0:M.id]),p.useEffect(()=>{const Me=(M==null?void 0:M.id)??null;if(Me)return v(Le=>{Le.workspaceId===Me&&(Zr(Xf(Me),Le),O(pt=>{var ut,we,xe;return{...pt,gitLoading:!1,branch:((ut=Le.status)==null?void 0:ut.snapshot.branch)??((we=Le.branches)==null?void 0:we.currentBranch)??null,changedFileCount:((xe=Le.status)==null?void 0:xe.changes.length)??null}}))})},[v,M==null?void 0:M.id]),p.useEffect(()=>{const Me=(M==null?void 0:M.id)??null;if(!Me){O(pt=>({...pt,gitLoading:!1,branch:null,changedFileCount:null}));return}const Le=Rr(Qf(Me),Qd);O(pt=>({...pt,terminalLoading:Le===null,activeTerminalCount:Le?Le.terminals.filter(ut=>KC(ut.status)).length:null,quickLaunchRunning:Le?Le.templateStatuses.some(ut=>ut.occupied):null}))},[M==null?void 0:M.id]),p.useEffect(()=>{const Me=(M==null?void 0:M.id)??null;if(!Me){O(Le=>({...Le,terminalLoading:!1,activeTerminalCount:null,quickLaunchRunning:null}));return}return y(Le=>{Le.workspaceId===Me&&(Zr(Qf(Me),{terminals:Le.terminals,templates:Le.templates,templateStatuses:Le.templateStatuses}),O(pt=>({...pt,terminalLoading:!1,activeTerminalCount:Le.terminals.filter(ut=>KC(ut.status)).length,quickLaunchRunning:Le.templateStatuses.some(ut=>ut.occupied)})))})},[y,M==null?void 0:M.id]),p.useEffect(()=>{const Me=(M==null?void 0:M.id)??null;if(!Me)return;const Le=Rr(Xf(Me),Qd)!==null;m(Me),!Le&&f(Me)},[M==null?void 0:M.id,f,m]),p.useEffect(()=>{const Me=(M==null?void 0:M.id)??null;if(!Me)return;const Le=Rr(Qf(Me),Qd)!==null;g(Me),!Le&&w(Me)},[M==null?void 0:M.id,w,g]),p.useEffect(()=>{const Me=(M==null?void 0:M.id)??null;if(!Me){te({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}let Le=!1;async function pt(Qe){te(Fe=>({...Fe,loading:!0}));try{const Fe=await Qh();if(!Fe.initialized||!Fe.profile){Le||te({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}const[dt,It,qt]=await Promise.all([Jh(),Vc(),$c({workspaceId:Me})]);if(Le)return;const Ht=new Set(dt.overview.projects.filter(Dt=>Dt.workspaceId===Me).map(Dt=>Dt.id)),Ft=dt.overview.verifications.filter(Dt=>Dt.projectId?Ht.has(Dt.projectId):!1);te({loading:!1,activeTaskCount:GD(It.items.filter(Dt=>Dt.workspaceId===Me),Ft),pendingInboxCount:qt.items.filter(Dt=>Dt.status!=="closed").length})}catch(Fe){if(Le)return;te(dt=>({...dt,loading:!1})),Qe&&t({title:o("shell.butlerLoadFailed"),description:Fe instanceof Error?Fe.message:void 0,tone:"error"})}}pt(!0);const ut=window.setInterval(()=>{pt(!1)},rV),we=dv(()=>{pt(!1)}),xe=()=>{pt(!1)};return window.addEventListener(xo,xe),()=>{Le=!0,window.clearInterval(ut),we(),window.removeEventListener(xo,xe)}},[M==null?void 0:M.id,t]);async function Se(Me){await u(),c(Me.id),B(null),e(ki(Me.id))}async function _e(Me){await u(),c(Me.id),B(null),e(ki(Me.id))}function Ce(){M&&(c(M.id),e(Dl(M.id,"git")))}function Nt(){M&&(c(M.id),e(fl(M.id)))}function ct(){M&&(c(M.id),e($h(M.id)))}function gt(){M&&(c(M.id),e(ko(M.id)))}function ft(){M&&e(yo(M.id))}function rt(){M&&A(!0)}function fe(Me,Le){A(!1),d(Me,Le)}function ue(){M&&(c(M.id),e(ki(M.id)))}function Oe(Me){c(Me)}const qe=[{label:o("shell.workspaceHomeMetricActive"),value:X.length,accent:ho(X.length),onClick:L.length>0?ft:void 0},{label:o("shell.workspaceHomeMetricUnread"),value:T,accent:ho(T),onClick:()=>z(!0)},{label:o("shell.workspaceHomeMetricTerminal"),value:K.terminalLoading?"…":K.activeTerminalCount??"—",accent:K.terminalLoading===!1&&ho(K.activeTerminalCount),onClick:M?Nt:void 0},{label:o("shell.workspaceHomeMetricChanges"),value:K.gitLoading?"…":K.changedFileCount??"—",accent:K.gitLoading===!1&&ho(K.changedFileCount),onClick:M?Ce:void 0}],nt=[{label:o("shell.workspaceHomeWaitingInputLabel"),value:D.length,accent:ho(D.length),onClick:L.length>0?ft:void 0},{label:o("shell.workspaceHomeButlerLabel"),value:F.loading?"…":F.activeTaskCount,accent:F.loading===!1&&ho(F.activeTaskCount),onClick:M?gt:void 0},{label:o("shell.workspaceHomeQuickLaunchStatusLabel"),value:ye,accent:K.quickLaunchRunning===!0,onClick:M?ct:void 0},{label:o("shell.butlerInboxAction"),value:F.loading?"…":F.pendingInboxCount,accent:F.loading===!1&&ho(F.pendingInboxCount),onClick:M?()=>_(!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:[M?n.jsxs(n.Fragment,{children:[n.jsx(Ro,{currentWorkspace:N?{id:N.workspace.id,name:N.label,path:N.subtitle}:null,workspaces:i.map(Me=>Me.workspace),workspaceOptions:de,onSelectWorkspace:Oe,sheetContent:Me=>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:()=>{Me(),B("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(Ra,{})})]}),n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{Me(),B("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(Ra,{})})]})]})}),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:qe.map(Me=>Me.onClick?n.jsxs("button",{type:"button",className:"mobile-workspace-home-toolbar-metric","data-accent":Me.accent?"true":void 0,onClick:Me.onClick,children:[n.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:Me.value}),n.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:Me.label})]},Me.label):n.jsxs("div",{className:"mobile-workspace-home-toolbar-metric","data-accent":Me.accent?"true":void 0,role:"listitem",children:[n.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:Me.value}),n.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:Me.label})]},Me.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:ue,children:o("shell.workspaceDetailTitle")}),n.jsx("button",{type:"button",className:"primary-button",onClick:rt,children:o("shell.createSession")})]})}),n.jsx("section",{className:"mobile-workspace-home-section",children:n.jsx("div",{className:"mobile-workspace-home-group",children:nt.map(Me=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row","data-accent":Me.accent?"true":void 0,onClick:Me.onClick,children:[n.jsx("span",{className:"mobile-workspace-home-row-label",children:Me.label}),n.jsxs("span",{className:"mobile-workspace-home-row-trailing",children:[n.jsx("strong",{children:Me.value}),n.jsx(Ra,{})]})]},Me.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")}),M?n.jsx("button",{type:"button",className:"mobile-workspace-home-link-button",onClick:ft,children:o("shell.workspaceHomeViewAllAction")}):null]}),n.jsx("div",{className:"mobile-workspace-home-group",children:ce.length===0?n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-empty-row",onClick:rt,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:M.name})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Ra,{})})]}):ce.map(Me=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(fr(M.id,Me.sessionId)),children:[n.jsxs("div",{className:"mobile-workspace-home-session-main",children:[n.jsx("span",{className:"mobile-workspace-home-session-title",children:Me.title||o("common.unknown")}),n.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[Zi(Me.provider,"full")," · ",YC(Wh(Me))]})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Ra,{})})]},Me.sessionId))})]}),le.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:le.map(Me=>n.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(fr(M.id,Me.sessionId)),children:[n.jsxs("div",{className:"mobile-workspace-home-session-main",children:[n.jsx("span",{className:"mobile-workspace-home-session-title",children:Me.title||o("common.unknown")}),n.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[Zi(Me.provider,"full")," · ",YC(Wh(Me))]})]}),n.jsx("span",{className:"mobile-workspace-home-row-trailing",children:n.jsx(Ra,{})})]},Me.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:()=>B("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(Ra,{})})]}),n.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>B("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(Ra,{})})]})]})]})}),n.jsx(PT,{open:q==="import",onClose:()=>B(null),onImported:Se}),n.jsx(NT,{open:q==="clone",onClose:()=>B(null),onCloned:_e}),n.jsx(ku,{open:E,workspaces:i.map(Me=>Me.workspace),workspaceOptions:de,initialWorkspaceId:(M==null?void 0:M.id)??a??null,onClose:()=>A(!1),onSelect:fe}),n.jsx(yg,{open:H,preferredWorkspaceId:(M==null?void 0:M.id)??null,compactComposer:!0,onClose:()=>_(!1)}),n.jsx(Q8,{open:Y,notifications:x,archivedNotificationIds:C,showArchivedNotifications:j,onClose:()=>z(!1),onToggleShowArchivedNotifications:P,onArchiveNotification:I,onUnarchiveNotification:Z,onSelectNotification:Me=>{z(!1),Me.routePath&&e(Me.routePath)}})]})}function Xf(e){return`git-sidebar.snapshot.${e}`}function Qf(e){return`terminal-manager.snapshot.${e}`}function Ra(){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 H0({workspace:e,state:t,variant:r,actions:i,matrixLimit:a}){return e?r==="mobile"?n.jsx(sV,{workspace:e,state:t,actions:i,matrixLimit:a}):r==="desktop-modal"?n.jsx(aV,{workspace:e,state:t,actions:i,matrixLimit:a}):n.jsx(oV,{workspace:e,state:t,actions:i,matrixLimit:a}):n.jsx("p",{className:"workbench-section-empty",children:o("shell.workspaceDetailMissingBody")})}function sV({workspace:e,state:t,actions:r,matrixLimit:i}){var v,g,w;const a=t.primaryAnalysis,u=((v=t.runtime)==null?void 0:v.runtimeSession)??null,c=i?t.matrixItems.slice(0,i):t.matrixItems,d=Sv(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:Cv(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:q0(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:vo(a.compatibilityLevel)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugInjectionLabel")}),n.jsx("strong",{children:nu(a.recommendedInjectionMode??"none")})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeStatusLabel")}),n.jsx("strong",{children:Wc((u==null?void 0:u.status)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFailureStageLabel")}),n.jsx("strong",{children:ru((u==null?void 0:u.failureStage)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceDiscoveryLabel")}),n.jsx("strong",{children:Sl(a.requiresServiceDiscoveryHandling)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugHmrLabel")}),n.jsx("strong",{children:Sl(a.requiresHmrHandling)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugCallbackLabel")}),n.jsx("strong",{children:Sl(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:jv(d)})]}),n.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugReasonsLabel")}),n.jsx("strong",{children:Uh(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:Uh(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:iu(tu(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:su(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:vo((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:Tv(y)})]})]})]},y.id)})})]}):null,(w=t.runtime)!=null&&w.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,T,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:iu(tu(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:su(y.service.cwd,e.path)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeServicePortLabel")}),n.jsx("strong",{children:V0(((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:G0(((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:K0(((T=y.processInstance)==null?void 0:T.status)??null)})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeServiceFailureLabel")}),n.jsx("strong",{children:ru(((P=y.processInstance)==null?void 0:P.failureStage)??(u==null?void 0:u.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:PV(y.aiFallbackEdits.map(I=>I.status))})]})]})]},y.service.id)})})]}):null,c.length>0?n.jsx("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:n.jsx(z0,{items:c,layout:"mobile",open:m,onOpen:()=>f(!0),onClose:()=>f(!1)})}):null]})}function aV({workspace:e,state:t,actions:r,matrixLimit:i}){var m,f,v;const a=t.primaryAnalysis,u=((m=t.runtime)==null?void 0:m.runtimeSession)??null,c=i?t.matrixItems.slice(0,i):t.matrixItems,d=Sv(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:Cv(d)}),n.jsx("p",{className:"workbench-manage-hint",children:jv(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:q0(a.confidence)})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugCompatibilityLabel")}),n.jsx("span",{children:vo(a.compatibilityLevel)})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugInjectionLabel")}),n.jsx("span",{children:nu(a.recommendedInjectionMode??"none")})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeStatusLabel")}),n.jsx("span",{children:Wc((u==null?void 0:u.status)??null)})]}),n.jsxs("div",{className:"workbench-manage-kv-item",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugFailureStageLabel")}),n.jsx("span",{children:ru((u==null?void 0:u.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 w=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," · ",iu(tu(g,w))]})}),n.jsxs("span",{title:g.cwd,children:[su(g.cwd,e.path)," · ",(w==null?void 0:w.primaryFramework)??o("common.unknown")," · ",vo((w==null?void 0:w.compatibilityLevel)??"unknown")," · ",Tv(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:Uh(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:Uh(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")}),(v=t.runtime)!=null&&v.services.length?n.jsx("div",{className:"workbench-manage-type-list",children:t.runtime.services.map(g=>{var w,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," · ",iu(tu(g.service,g.analysis))]})}),n.jsxs("span",{title:g.service.cwd,children:[su(g.service.cwd,e.path)," · ",o("shell.workspaceDetailDebugRuntimeServicePortLabel")," ",V0(((w=g.binding)==null?void 0:w.leasedPort)??((y=g.portLease)==null?void 0:y.port)??null)," · ",o("shell.workspaceDetailDebugRuntimeServiceBindingLabel")," ",G0(((x=g.binding)==null?void 0:x.status)??null)," · ",o("shell.workspaceDetailDebugRuntimeServiceProcessLabel")," ",K0(((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:c.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:[vo(g.compatibilityLevel)," · ",nu(g.recommendedInjectionMode)]})]},g.framework))})]}),r?n.jsx("div",{className:"workbench-modal-actions",children:r}):null]}):null]})}function oV({workspace:e,state:t,actions:r,matrixLimit:i}){var w,y;const a=t.primaryAnalysis,u=((w=t.runtime)==null?void 0:w.runtimeSession)??null,c=i?t.matrixItems.slice(0,i):t.matrixItems,d=Sv(t),m=$0(t),f=((y=t.analyses[0])==null?void 0:y.createdAt)??null,[v,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:jv(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:Cv(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:dV(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:Wc((u==null?void 0:u.status)??null)}),n.jsx("small",{children:ru((u==null?void 0:u.failureStage)??null)})]}),n.jsxs("article",{className:"debug-readiness-summary-card",children:[n.jsx("span",{children:o("shell.workspaceDetailDebugLastAnalyzedAtLabel")}),n.jsx("strong",{children:XC(f)}),n.jsx("small",{children:hV(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,T;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:su(x.service.cwd,e.path)})]}),n.jsx("span",{className:"debug-readiness-chip","data-tone":uV(x.category),children:iu(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:vo(((j=x.analysis)==null?void 0:j.compatibilityLevel)??"unknown")})]}),n.jsxs("div",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugInjectionLabel")}),n.jsx("strong",{children:nu(((T=x.analysis)==null?void 0:T.recommendedInjectionMode)??"none")})]}),n.jsxs("div",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugRuntimeStatusLabel")}),n.jsx("strong",{children:Wc(mV(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:Tv(x.service)})]}),n.jsxs("p",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceRequirementsLabel")}),n.jsx("strong",{children:pV(x.analysis)})]}),n.jsxs("p",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugServiceActionLabel")}),n.jsx("strong",{children:gV(x)})]}),n.jsxs("p",{children:[n.jsx("span",{children:o("shell.workspaceDetailDebugReasonsLabel")}),n.jsx("strong",{children:fV(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:bV(x)}),n.jsx("span",{children:Wc(x.runtimeSession.status)})]}),n.jsx("p",{children:vV(x)}),n.jsxs("div",{className:"debug-readiness-runtime-item-grid",children:[n.jsxs("span",{children:[o("shell.workspaceDetailDebugRuntimeHistoryTimeLabel")," ",XC(x.runtimeSession.startedAt??x.runtimeSession.createdAt)]}),n.jsxs("span",{children:[o("shell.workspaceDetailDebugRuntimeHistoryServiceLabel")," ",wV(x)]}),n.jsxs("span",{children:[o("shell.workspaceDetailDebugRuntimeServiceFailureLabel")," ",ru(x.runtimeSession.failureStage??null)]}),n.jsxs("span",{children:[o("shell.workspaceDetailDebugRuntimeHistoryResultLabel")," ",yV(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(z0,{items:c,layout:"desktop",open:v,onOpen:()=>g(!0),onClose:()=>g(!1)})})]})]})]}):null]})}function z0({items:e,layout:t,open:r,onOpen:i,onClose:a}){const u=cV(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:u.supportedCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"warn",children:[o("shell.workspaceDetailDebugCompatibilityConditional"),n.jsx("strong",{children:u.conditionalCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"danger",children:[o("shell.workspaceDetailDebugCompatibilityUnsupported"),n.jsx("strong",{children:u.unsupportedCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"neutral",children:[o("shell.workspaceDetailDebugCompatibilityUnknown"),n.jsx("strong",{children:u.unknownCount})]})]}),n.jsx("button",{type:"button",className:"secondary-button debug-readiness-matrix-open-button",onClick:i,children:o("shell.workspaceDetailDebugMatrixOpenAction")})]})]}),n.jsx(Hn,{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:u.supportedCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"warn",children:[o("shell.workspaceDetailDebugCompatibilityConditional"),n.jsx("strong",{children:u.conditionalCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"danger",children:[o("shell.workspaceDetailDebugCompatibilityUnsupported"),n.jsx("strong",{children:u.unsupportedCount})]}),n.jsxs("span",{className:"debug-readiness-matrix-summary-pill","data-tone":"neutral",children:[o("shell.workspaceDetailDebugCompatibilityUnknown"),n.jsx("strong",{children:u.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(c=>{const d=SV(c.compatibilityLevel);return n.jsxs("tr",{children:[n.jsx("th",{scope:"row",className:"debug-readiness-matrix-framework-cell",children:c.framework}),n.jsx("td",{children:n.jsx(yc,{className:"debug-readiness-matrix-badge",tone:d,icon:xV(c.compatibilityLevel),label:kV(c.compatibilityLevel),title:vo(c.compatibilityLevel)})}),n.jsx("td",{children:n.jsx("span",{className:"debug-readiness-matrix-badge debug-readiness-matrix-badge-subtle","data-tone":"neutral",title:nu(c.recommendedInjectionMode),children:CV(c.recommendedInjectionMode)})}),n.jsx("td",{children:n.jsx(yc,{className:"debug-readiness-matrix-flag",tone:c.requiresServiceDiscoveryHandling?"warn":"success",icon:c.requiresServiceDiscoveryHandling?"warn":"check",label:Jf(c.requiresServiceDiscoveryHandling),title:Sl(c.requiresServiceDiscoveryHandling)})}),n.jsx("td",{children:n.jsx(yc,{className:"debug-readiness-matrix-flag",tone:c.requiresHmrHandling?"warn":"success",icon:c.requiresHmrHandling?"warn":"check",label:Jf(c.requiresHmrHandling),title:Sl(c.requiresHmrHandling)})}),n.jsx("td",{children:n.jsx(yc,{className:"debug-readiness-matrix-flag",tone:c.requiresCallbackHandling?"warn":"success",icon:c.requiresCallbackHandling?"warn":"check",label:Jf(c.requiresCallbackHandling),title:Sl(c.requiresCallbackHandling)})}),n.jsx("td",{children:n.jsx(yc,{className:"debug-readiness-matrix-badge debug-readiness-matrix-badge-subtle",tone:NV(c.aiFallbackPolicy),icon:TV(c.aiFallbackPolicy),label:jV(c.aiFallbackPolicy),title:Nv(c.aiFallbackPolicy)})}),n.jsx("td",{className:"debug-readiness-matrix-note-cell",children:c.notes})]},c.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 yc({tone:e,icon:t,label:r,title:i,className:a}){return n.jsxs("span",{className:a,"data-tone":e,title:i,children:[n.jsx(lV,{kind:t}),n.jsx("span",{children:r})]})}function lV({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 q0(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 $0(e){return e.services.map(t=>{var a;const r=e.analyses.find(u=>u.serviceId===t.id)??null,i=((a=e.runtime)==null?void 0:a.services.find(u=>u.service.id===t.id))??null;return{service:t,analysis:r,runtimeItem:i,category:tu(t,r)}})}function Sv(e){const t=$0(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,u=a.filter(x=>x.compatibilityLevel==="supported").length,c=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,v=t.length,g=r.length,w=d>0?"danger":c>0?"warn":u>0?"success":"neutral",y=[g>0?{key:"web",label:o("shell.workspaceDetailDebugSummaryWebServicesChip",{count:g}),tone:g===u&&c===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:v,webServiceCount:g,desktopShellCount:f,supportedCount:u,conditionalCount:c,unsupportedCount:d,unknownCount:m,autoInjectionEligible:e.autoInjectionEligible,overallTone:w,categoryChips:y}}function cV(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 tu(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 uV(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 Cv(e){return e.unsupportedCount>0?o("shell.workspaceDetailDebugOverallStatusBlocked"):e.conditionalCount>0?o("shell.workspaceDetailDebugOverallStatusConditional"):e.supportedCount>0?o("shell.workspaceDetailDebugOverallStatusSupported"):o("shell.workspaceDetailDebugCompatibilityUnknown")}function jv(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 dV(e){return o("shell.workspaceDetailDebugCompatibilityBreakdown",{supported:e.supportedCount,conditional:e.conditionalCount,unsupported:e.unsupportedCount})}function hV(e){switch(e){case"repo":return o("shell.workspaceDetailDebugTargetSourceRepo");case"worktree":return o("shell.workspaceDetailDebugTargetSourceWorktree");default:return o("common.unknown")}}function mV(e){var t,r,i,a,u;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&&((u=e.runtimeItem.binding)==null?void 0:u.status)==="RELEASED"?"STOPPED":null}function pV(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 fV(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 gV(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 bV(e){return o("shell.workspaceDetailDebugRuntimeHistoryTitleWithIndex",{id:e.runtimeSession.id.slice(0,8)})}function vV(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 wV(e){return e.services.length===0?o("shell.workspaceDetailDebugRuntimeHistoryNoServices"):e.services.map(t=>t.service.name).join("、")}function yV(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 XC(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 vo(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 kV(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 xV(e){switch(e){case"supported":return"check";case"conditional":return"warn";case"unsupported":return"cross";default:return"neutral"}}function SV(e){switch(e){case"supported":return"success";case"conditional":return"warn";case"unsupported":return"danger";default:return"neutral"}}function nu(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 CV(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 Wc(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 ru(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 Sl(e){return o(e?"shell.workspaceDetailDebugRequirementRequired":"shell.workspaceDetailDebugRequirementNotRequired")}function Jf(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 jV(e){switch(e){case"never":return o("shell.workspaceDetailDebugMatrixAiNeverShort");case"conditional":return o("shell.workspaceDetailDebugMatrixAiConditionalShort");default:return o("shell.workspaceDetailDebugMatrixAiAllowedShort")}}function NV(e){switch(e){case"never":return"danger";case"conditional":return"warn";default:return"success"}}function TV(e){switch(e){case"never":return"cross";case"conditional":return"warn";default:return"check"}}function Uh(e,t){return e.length>0?e.join(", "):o(t)}function iu(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 V0(e){return e===null?o("shell.workspaceDetailDebugPortEmpty"):String(e)}function G0(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 K0(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 PV(e){return e.length===0?o("shell.workspaceDetailDebugAiEditEmpty"):e.map(t=>DV(t)).join(", ")}function DV(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 su(e,t){const r=QC(t),i=QC(e);return i===r?".":i.startsWith(`${r}/`)?i.slice(r.length+1):i}function Tv(e){return[e.command,...e.args].filter(Boolean).join(" ")}function QC(e){return e.replace(/\\/g,"/").replace(/\/+$/g,"")}function Y0(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 u=!1;return r(c=>({...c,loading:!0,error:null})),(async()=>{try{const c=await YI({workspaceId:e.id,rootPath:e.path}),[d,m]=await Promise.all([XI(c.target.id,5),QI()]),f=RV(d);if(u)return;r({loading:!1,error:null,targetId:c.target.id,targetSourceType:c.target.sourceType,autoInjectionEligible:c.autoInjectionEligible,services:c.services,analyses:c.analyses,runtime:f,runtimeHistory:d.items,matrixItems:m.items})}catch(c){if(u)return;r({loading:!1,error:c instanceof Error?c.message:o("shell.workspaceDetailDebugAnalyzeFailed"),targetId:null,targetSourceType:null,autoInjectionEligible:!1,services:[],analyses:[],runtime:null,runtimeHistory:[],matrixItems:[]})}})(),()=>{u=!0}},[e==null?void 0:e.id,e==null?void 0:e.path]);const i=p.useMemo(()=>MV(t.services,t.analyses),[t.analyses,t.services]),a=p.useMemo(()=>t.matrixItems.find(u=>u.framework===((i==null?void 0:i.primaryFramework)??"unknown"))??null,[i==null?void 0:i.primaryFramework,t.matrixItems]);return{...t,primaryAnalysis:i,currentCompatibilityItem:a}}function RV(e){return e.items[0]??null}function MV(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,u)=>AV(a,u)).map(a=>r.get(a.id)??null).find(a=>a!==null)??t[0]??null}function AV(e,t){const r=JC(e.role)-JC(t.role);return r!==0?r:e.name.localeCompare(t.name)}function JC(e){switch(e){case"frontend":return 0;case"backend":return 1;case"worker":return 2;case"mock":return 3;default:return 4}}function EV(e){return e.isArchived!==!0&&!Ua(e)}function IV(e){return e.isArchived===!0&&!Ua(e)}function ZC(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt??""}function ej(e,t){return ZC(t).localeCompare(ZC(e))}const Zf=60*1e3,eg=10;function LV(){var M;const{workspaceId:e=""}=Po(),t=dr(),{showToast:r}=ir(),{navigationGroups:i,currentWorkspaceId:a,favoriteSessionIds:u,workspaceManagementStateById:c,selectWorkspace:d,subscribeGitSnapshot:m,requestGitRefresh:f,subscribeWorkspaceManagementSnapshot:v,requestWorkspaceManagementRefresh:g,toggleFavoriteSession:w,archiveSession:y,unarchiveSession:x,startDraftSession:C}=gr(),[j,T]=p.useState(!1),[P,I]=p.useState(!1),[Z,q]=p.useState(eg),B=yu(i),E=ea(i,e),A=(E==null?void 0:E.workspace)??null,H=B.find(N=>N.workspace.id===(A==null?void 0:A.id))??(A?{workspace:A,label:A.name,subtitle:A.path}:null),_=p.useMemo(()=>[...(E==null?void 0:E.sessions)??[]].filter(EV).sort(ej),[E]),Y=p.useMemo(()=>[...(E==null?void 0:E.sessions)??[]].filter(IV).sort(ej),[E]);p.useEffect(()=>{e&&d(e)},[d,e]),p.useEffect(()=>{if(!e)return;m(e),v(e);const N=Rr(OV(e),Zf)!==null,L=Rr(tj(e),Zf)!==null;N||f(e),L||g(e)},[f,g,m,v,e]),p.useEffect(()=>{q(eg)},[e]);const z=p.useMemo(()=>{if(!e)return{loading:!1,error:null,hasMeaningfulSummary:!1,summary:null};const N=Rr(tj(e),Zf),L=c[e]??null,X=(L==null?void 0:L.detail)??(A?BV(A,N):N??null);return{loading:(L==null?void 0:L.loading)??!1,error:(L==null?void 0:L.error)??null,hasMeaningfulSummary:WV(X),summary:X}},[A,e,c]),K=p.useMemo(()=>z.summary?wT(z.summary.codeComposition.items,o("shell.manageWorkspaceCodeCompositionOther")):[],[z.summary]),O=p.useMemo(()=>K.length>0?yT(K):void 0,[K]),F=p.useMemo(()=>Y.slice(0,Z),[Y,Z]),te=Y0(A?{id:A.id,path:A.path,name:A.name}:null);async function de(){if(!(!A||!(typeof window>"u"||window.confirm(o("shell.manageWorkspaceRemoveConfirmTarget",{name:A.name}))))){T(!0);try{await XN(A.id),r({title:o("shell.manageWorkspaceRemoveSuccess"),tone:"success"}),t("/workspaces",{replace:!0})}catch(L){r({title:L instanceof Error?L.message:o("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{T(!1)}}}function W(N,L){I(!1),C(N,L)}return A?n.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-detail-page",children:[n.jsx(Ro,{currentWorkspace:H?{id:H.workspace.id,name:H.label,path:H.subtitle}:null,workspaces:i.map(N=>N.workspace),workspaceOptions:B,heading:o("shell.workspaceDetailTitle"),triggerLabel:(H==null?void 0:H.label)??A.name,onSelectWorkspace:N=>{d(N),t(ki(N))},content:n.jsxs("div",{className:"mobile-workspace-detail-header-actions",children:[n.jsx("button",{type:"button",className:"primary-button",onClick:()=>I(!0),children:o("shell.createSession")}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(A.id),t(jN(A.id))},children:o("shell.filesEntry")}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(A.id),t(fl(A.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!==A.id?n.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-switch-button",onClick:()=>d(A.id),children:o("shell.switchWorkspace")}):null]}),z.loading&&z.summary===null?n.jsx("p",{children:o("common.loading")}):null,z.error?n.jsx("p",{className:"status-text","data-tone":"error",children:z.error}):null,z.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:z.summary.path,children:z.summary.path})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.manageWorkspaceCurrentBranch")}),n.jsx("strong",{title:z.summary.git.currentBranch??o("common.unknown"),children:z.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:z.hasMeaningfulSummary?z.summary.git.commitCount??0:"—"})]}),n.jsxs("div",{className:"mobile-detail-metric",children:[n.jsx("span",{children:o("shell.manageWorkspaceCodeCompositionFiles")}),n.jsx("strong",{children:z.hasMeaningfulSummary?z.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(A.id),t(NN(A.id))},children:o("shell.gitEntry")}),n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{d(A.id),t($h(A.id))},children:o("shell.terminalManagerEntry")}),n.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:j,onClick:()=>{de()},children:o(j?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})]})]}),n.jsx(H0,{workspace:A?{id:A.id,path:A.path,name:A.name}:null,state:te,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")})}),z.summary?n.jsx("span",{className:"mobile-feature-counter",children:z.summary.codeComposition.scannedFileCount}):null]}),z.loading&&z.summary===null?n.jsx("p",{children:o("common.loading")}):null,z.summary?K.length>0?n.jsxs("div",{className:"workbench-manage-type-chart",children:[n.jsxs("div",{className:"workbench-manage-type-chart-ring",style:O,"aria-hidden":"true",children:[n.jsx("strong",{className:"workbench-manage-type-chart-total",children:z.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:K.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," · ",vT(N)]})]},N.key))})]}):n.jsx("p",{children:z.summary.codeComposition.error??o("shell.manageWorkspaceNoCodeComposition")}):null,(M=z.summary)!=null&&M.codeComposition.truncated?n.jsx("p",{className:"mobile-workspace-composition-note",children:o("shell.manageWorkspaceCodeTruncated",{count:z.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:_.length})]}),n.jsx("div",{className:"mobile-feature-stack",children:_.length===0?n.jsx("article",{className:"mobile-feature-empty surface-card",children:n.jsx("p",{children:o("shell.emptyWorkspaceSessions")})}):_.map(N=>{const L=Is(N.title,o("common.unknown")),X=u.includes(N.sessionId);return n.jsxs("article",{className:"mobile-session-row surface-card",children:[n.jsxs("button",{type:"button",className:"mobile-session-row-primary",onClick:()=>t(fr(A.id,N.sessionId)),children:[n.jsx("span",{className:"mobile-session-row-title",title:L.fullTitle,children:L.displayTitle}),n.jsx("span",{className:"mobile-session-row-provider",children:Zi(N.provider)})]}),n.jsxs("div",{className:"mobile-session-row-actions",children:[n.jsx("span",{className:"mobile-feature-badge mobile-session-row-count",children:N.messageCount}),n.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":o(X?"shell.unfavoriteAction":"shell.favoriteAction"),title:o(X?"shell.unfavoriteAction":"shell.favoriteAction"),onClick:()=>{w(N.sessionId)},children:n.jsx(FV,{active:X})}),n.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":o("shell.archiveAction"),title:o("shell.archiveAction"),onClick:()=>{y(N.sessionId)},children:n.jsx(_V,{})})]})]},N.sessionId)})})]}),Y.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:Y.length})]}),n.jsx("div",{className:"mobile-feature-stack",children:F.map(N=>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:N.title,children:N.title}),n.jsx("span",{className:"mobile-session-row-provider",children:Zi(N.provider)})]}),n.jsx("div",{className:"mobile-session-row-actions",children:n.jsx("button",{type:"button",className:"secondary-button mobile-session-row-restore",onClick:()=>{x(N.sessionId)},children:o("shell.unarchiveAction")})})]},N.sessionId))}),F.length<Y.length?n.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-expand-button",onClick:()=>{q(N=>N+eg)},children:o("shell.archiveExpandMore")}):null]}):null]}),n.jsx(ku,{open:P,workspaces:i.map(N=>N.workspace),workspaceOptions:B,initialWorkspaceId:a??A.id,onClose:()=>I(!1),onSelect:W})]}):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 FV({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 _V(){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 tj(e){return`workspace-management.summary.${e}`}function OV(e){return`git-sidebar.snapshot.${e}`}function BV(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 WV(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 UV(){var d;const{workspaceId:e=""}=Po(),t=dr(),{navigationGroups:r,selectWorkspace:i}=gr(),a=((d=r.find(m=>m.workspace.id===e))==null?void 0:d.workspace)??null;p.useEffect(()=>{e&&i(e)},[i,e]);const u=p.useMemo(()=>a?{id:a.id,path:a.path,name:a.name}:null,[a]),c=Y0(u);return a?n.jsx("main",{className:"workbench-page conversation-page-shell debug-readiness-page-shell",children:n.jsx(H0,{workspace:u,state:c,variant:"desktop-page",actions:n.jsx("button",{type:"button",className:"secondary-button",onClick:()=>t(ki(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 HV({isDesktop:e,viewportClass:t}){return e||t==="expanded"?"desktop":"mobile"}function zV(){const e=cr(),t=HV(e);return n.jsx(J_,{shellMode:t})}const qV=[{titleKey:"workbench.emptyResumeTitle",bodyKey:"workbench.emptyResumeBody"},{titleKey:"workbench.emptyNewTitle",bodyKey:"workbench.emptyNewBody"},{titleKey:"workbench.emptyCompanionTitle",bodyKey:"workbench.emptyCompanionBody"}];function $V(){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:qV.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 VV(){const{shellMode:e}=gr();return e==="mobile"?n.jsx(Pl,{to:"/workspaces",replace:!0}):n.jsx($V,{})}const nj=2e4,GV=1e3,KV=5e3;function YV({isOpen:e,onClose:t}){const[r,i]=p.useState(null),[a,u]=p.useState(null),[c,d]=p.useState(!1),[m,f]=p.useState(!1),[v,g]=p.useState(null),w=p.useRef(null);if(p.useEffect(()=>{if(!e)return;let j=!1;async function T(){d(!0),g(null),u(null);try{const P=await Ue.request("/api/observability/runtime/session",{method:"POST",body:JSON.stringify({ttlMs:nj})});if(j){await tg(P.sessionId);return}w.current=P.sessionId,i(P);const I=await rj(P.sessionId);if(j){await tg(P.sessionId);return}u(I)}catch(P){j||g(ng(P))}finally{j||d(!1)}}return T(),()=>{j=!0;const P=w.current;w.current=null,i(null),u(null),d(!1),f(!1),g(null),P&&tg(P)}},[e]),p.useEffect(()=>{const j=(r==null?void 0:r.sessionId)??null;if(!e||!j)return;const T=j;let P=!1;async function I(){f(!0);try{const q=await rj(T);P||(u(q),g(null))}catch(q){P||g(ng(q))}finally{P||f(!1)}}const Z=window.setInterval(()=>{I()},GV);return()=>{P=!0,window.clearInterval(Z)}},[e,r==null?void 0:r.sessionId]),p.useEffect(()=>{const j=(r==null?void 0:r.sessionId)??null;if(!e||!j)return;const T=j;let P=!1;async function I(){try{const q=await Ue.request(`/api/observability/runtime/session/${T}/heartbeat`,{method:"POST",body:JSON.stringify({ttlMs:nj})});P||i(q)}catch(q){P||g(ng(q))}}const Z=window.setInterval(()=>{I()},KV);return()=>{P=!0,window.clearInterval(Z)}},[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":v?"error":"active",children:o(v?"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:rg(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:rg(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:XV((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")})]})]}),c?n.jsx("div",{className:"parallel-task-debug-empty",children:o("settings.parallelTaskDebugLoading")}):null,!c&&v?n.jsx("div",{className:"parallel-task-debug-error",children:v}):null,!c&&!v&&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,T])=>n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:QV(j)}),n.jsx("strong",{children:T})]},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,T])=>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:ij(T.executionLane)})]}),n.jsxs("div",{className:"parallel-task-debug-panel-body",children:[n.jsxs("span",{children:[o("settings.parallelTaskDebugWaitAvg"),": ",Vi(T.waitMs.avg)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugRunAvg"),": ",Vi(T.runMs.avg)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugRunMax"),": ",Vi(T.runMs.max)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugStartedCount"),": ",T.counters.started??0]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugFinishedCount"),": ",T.counters.finished??0]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugFailedCount"),": ",T.counters.failed??0]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugCacheHitCount"),": ",T.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,T])=>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:T.lastIdle?o("settings.parallelTaskDebugIdle"):o("settings.parallelTaskDebugBusy")})]}),n.jsxs("div",{className:"parallel-task-debug-panel-body",children:[n.jsxs("span",{children:[o("settings.parallelTaskDebugTickTotal"),": ",T.tickTotal]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugIdleTickTotal"),": ",T.idleTickTotal]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugTaskCountTotal"),": ",T.taskCountTotal]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugSchedulerErrorTotal"),": ",T.errorTotal]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugLastDuration"),": ",Vi(T.lastDurationMs)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugNextDelay"),": ",Vi(T.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:Vi(a.eventLoop.resolutionMs)})]}),n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopMean")}),n.jsx("strong",{children:Vi(a.eventLoop.meanMs)})]}),n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopP95")}),n.jsx("strong",{children:Vi(a.eventLoop.p95Ms)})]}),n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopP99")}),n.jsx("strong",{children:Vi(a.eventLoop.p99Ms)})]}),n.jsxs("div",{className:"parallel-task-debug-counter-card",children:[n.jsx("span",{children:o("settings.parallelTaskDebugEventLoopMax")}),n.jsx("strong",{children:Vi(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:JV(j.eventType)}),n.jsx("span",{children:ij(j.executionLane)})]}),n.jsxs("p",{children:[o("settings.parallelTaskDebugTaskKey"),": ",j.key]}),n.jsxs("p",{children:[o("settings.parallelTaskDebugStatus"),": ",j.status?ZV(j.status):"-"]})]}),n.jsxs("div",{className:"parallel-task-debug-activity-meta",children:[n.jsx("span",{children:rg(j.recordedAt)}),n.jsxs("span",{children:[o("settings.parallelTaskDebugAttempt"),": ",j.attempt??"-"]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugWaitMs"),": ",Vi(j.waitMs)]}),n.jsxs("span",{children:[o("settings.parallelTaskDebugRunMs"),": ",Vi(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 rj(e){return await Ue.request(`/api/observability/runtime?sessionId=${encodeURIComponent(e)}`)}async function tg(e){try{await Ue.request(`/api/observability/runtime/session/${e}`,{method:"DELETE"})}catch{}}function ng(e){return e instanceof Error&&e.message?e.message:o("settings.parallelTaskDebugLoadFailed")}function rg(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function Vi(e){return e==null||Number.isNaN(e)?"-":`${Math.round(e*100)/100} ms`}function XV(e){return e===null||Number.isNaN(e)?"-":`${Math.round(e/1e3)} s`}function QV(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 ij(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 JV(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 ZV(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 eG(){const e=Es(),t=Dr.getState(),r=await e.bridge.checkForUpdate(t.releaseChannel);if(!r.ok||!r.value)throw new Error(r.detail??"更新检查失败。");return r.value}async function tG(e){return Es().bridge.installUpdate(e)}async function nG(){return Es().bridge.rollbackToPreviousVersion()}function X0(){const e=Es(),t=e.isDesktop,[r,i]=p.useState(!1),[a,u]=p.useState(!1),[c,d]=p.useState(!1),[m,f]=p.useState(null),[v,g]=p.useState(null),[w,y]=p.useState(null),[x,C]=p.useState(!1);async function j(){var B,E;i(!0),f(null);try{const A=await eG();y(A.manifest),g(A.currentVersion),C(A.hasUpdate),f(rG(A.manifest,A.hasUpdate)),A.hasUpdate&&await e.bridge.showNotification(o("settings.releaseUpdateReady"),((B=A.manifest)==null?void 0:B.tagName)??((E=A.manifest)==null?void 0:E.version)??"-")}catch(A){f(A instanceof Error?A.message:o("settings.releaseCheckFailed"))}finally{i(!1)}}async function T(){if(!(!(w!=null&&w.packageUrl)||!w.signature)){u(!0),f(null);try{const B=await tG(w);if(!B.ok){f(B.detail??o("settings.releaseInstallFailed"));return}f(o("settings.releaseInstallStarted")),await e.bridge.showNotification(o("settings.releaseInstallStarted"),w.version)}catch(B){f(B instanceof Error?B.message:o("settings.releaseInstallFailed"))}finally{u(!1)}}}async function P(){u(!0),f(null);try{const B=await nG();f(B.ok?o("settings.releaseRollbackStarted"):B.detail??o("settings.releaseRollbackFailed")),B.ok&&await e.bridge.showNotification(o("settings.releaseRollbackStarted"),v??o("settings.releaseUnknownVersion"))}catch(B){f(B instanceof Error?B.message:o("settings.releaseRollbackFailed"))}finally{u(!1)}}async function I(){if(w!=null&&w.htmlUrl){d(!0);try{const B=await e.bridge.openExternal(w.htmlUrl);B.ok||f(B.detail??o("settings.releasePageOpenFailed"))}catch(B){f(B instanceof Error?B.message:o("settings.releasePageOpenFailed"))}finally{d(!1)}}}const Z=!!(t&&(w!=null&&w.packageUrl)&&w.signature&&x),q=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"),": ",v??o("settings.releaseUnknownVersion")]}),n.jsxs("span",{children:[o("settings.releaseTargetVersion"),": ",(w==null?void 0:w.version)??"-"]}),n.jsxs("span",{children:[o("settings.releaseTargetTag"),": ",(w==null?void 0:w.tagName)??"-"]}),n.jsxs("span",{children:[o("settings.releasePublishedAt"),": ",iG(w==null?void 0:w.publishedAt)]})]}),w?n.jsxs("div",{className:"settings-release-notes",children:[n.jsx("strong",{children:o("settings.releaseNotes")}),w.title&&w.title!==w.tagName?n.jsx("p",{className:"settings-release-title",children:w.title}):null,w.notes?n.jsx("div",{className:"settings-release-markdown",children:n.jsx(rv,{remarkPlugins:[ov],children:w.notes})}):n.jsx("p",{children:o("settings.releaseNotesEmpty")})]}):null,q?n.jsx("p",{className:"settings-release-status",children:q}):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:!Z||a,onClick:T,children:o(a?"common.loading":"settings.releaseInstallNow")}),n.jsx("button",{className:"secondary-button",type:"button",disabled:!(w!=null&&w.htmlUrl)||r||a||c,onClick:I,children:o(c?"common.loading":"settings.releaseOpenPage")}),n.jsx("button",{className:"secondary-button",type:"button",disabled:!t||a,onClick:P,children:o("settings.releaseRollback")})]})]})}function rG(e,t){return t?e!=null&&e.packageUrl?e.signature?o("settings.releaseUpdateReady"):o("settings.releaseSignatureMissing"):o("settings.releaseInstallerMissing"):o("settings.releaseUpToDate")}function iG(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}async function sG(){const e=Dr.getState();return Ue.request(`/api/client/service-update?channel=${encodeURIComponent(e.releaseChannel)}`)}function Q0(){const e=Es(),[t,r]=p.useState(!1),[i,a]=p.useState(!1),[u,c]=p.useState(null),[d,m]=p.useState(null);async function f(){r(!0),c(null);try{const g=await sG();m(g),c(aG(g)),g.hasUpdate&&await e.bridge.showNotification(o("settings.serverUpdateReady"),`${o("settings.serverTargetVersion")}: ${g.latestVersion??"-"}`)}catch(g){c(g instanceof Error?g.message:o("settings.serverCheckFailed"))}finally{r(!1)}}async function v(){if(d!=null&&d.packagePageUrl){a(!0);try{const g=await e.bridge.openExternal(d.packagePageUrl);g.ok||c(g.detail??o("settings.serverOpenPageFailed"))}catch(g){c(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,u?n.jsx("p",{className:"settings-release-status",children:u}):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:v,children:o(i?"common.loading":"settings.serverOpenPage")})]})]})}function aG(e){return e.latestVersion?e.hasUpdate?o("settings.serverUpdateReady"):o("settings.serverUpToDate"):o("settings.serverLatestUnknown")}function sj({title:e,description:t,actions:r,content:i,className:a}){return n.jsx(VD,{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 oG(e){return e==="appearance"||e==="server-connection"||e==="security-privacy"||e==="software-update"}function aj(e){return o(e==="en-US"?"locale.enUS":"locale.zhCN")}function oj(e){return o(e==="beta"?"settings.releaseBeta":"settings.releaseStable")}function lj(e){switch(e){case"acceptEdits":return o("settings.permissionModeAcceptEdits");case"bypassPermissions":return o("settings.permissionModeBypassPermissions");default:return o("settings.permissionModeDefault")}}function lG(){const e=dr(),{theme:t,setTheme:r}=dN(),i=U1(F=>F),a=lg(F=>F.profile.language),u=lg(F=>F.profile.defaultPermissionMode),c=Zs(F=>F.showSystemFiles),d=Zs(F=>F.notificationPreferences.notifyOnPermissionRequest),m=Zs(F=>F.notificationPreferences.notifyOnSessionCompleted),f=Zs(F=>F.notificationPreferences.notifyOnSessionFailed),v={language:a,defaultPermissionMode:u},g=cr(),w=eb(i.platform),y=w,[x,C]=p.useState(i.hostBaseUrl);p.useEffect(()=>{C(i.hostBaseUrl)},[i.hostBaseUrl]);function j(){rr.clear(),bs.resetToLocalFallback(),e("/login",{replace:!0})}function T(F){r(F)}function P(F){try{return ta(F)}catch{return null}}const I=P(x),Z=I!==null&&I!==i.hostBaseUrl;function q(F){F.preventDefault(),I&&Dr.update({hostBaseUrl:I})}const B=[{value:"default",label:o("settings.permissionModeDefault")},{value:"acceptEdits",label:o("settings.permissionModeAcceptEdits")},{value:"bypassPermissions",label:o("settings.permissionModeBypassPermissions")}];function E(F){Dr.update({releaseChannel:F==="beta"?"beta":"stable"})}function A(F){Dr.update({autoReconnect:F})}function H(F){Dr.update({autoCheckUpdate:F})}function _(F){const te=F==="acceptEdits"||F==="bypassPermissions"?F:"default";bs.updateProfile({defaultPermissionMode:te}).catch(()=>{})}function Y(F){bl.setShowSystemFiles(F)}function z(F){bl.setNotificationPreferences({notifyOnPermissionRequest:F})}function K(F){bl.setNotificationPreferences({notifyOnSessionCompleted:F})}function O(F){bl.setNotificationPreferences({notifyOnSessionFailed:F})}return{platform:g,theme:t,applyTheme:T,runtimeConfig:i,accountPreferences:v,showSystemFiles:c,notifyOnPermissionRequest:d,notifyOnSessionCompleted:m,notifyOnSessionFailed:f,showServerSettings:y,canConfigureServerAddress:w,hostBaseUrlDraft:x,setHostBaseUrlDraft:C,canSaveHostBaseUrl:Z,permissionModeOptions:B,handleHostBaseUrlSubmit:q,handleLogout:j,updateReleaseChannel:E,updateAutoReconnect:A,updateAutoCheckUpdate:H,updateDefaultPermissionMode:_,updateShowSystemFiles:Y,updateNotifyOnPermissionRequest:z,updateNotifyOnSessionCompleted:K,updateNotifyOnSessionFailed:O}}function cj(){const e=lG(),t=pN();return e.platform.isMobile?n.jsx(uG,{model:e,appVersion:t}):n.jsx(cG,{model:e,appVersion:t})}function cG({model:e,appVersion:t}){const[r,i]=p.useState(!1),{theme:a,applyTheme:u,runtimeConfig:c,accountPreferences:d,showSystemFiles:m,notifyOnPermissionRequest:f,notifyOnSessionCompleted:v,notifyOnSessionFailed:g,showServerSettings:w,hostBaseUrlDraft:y,setHostBaseUrlDraft:x,canSaveHostBaseUrl:C,permissionModeOptions:j,platform:T,handleHostBaseUrlSubmit:P,handleLogout:I,updateReleaseChannel:Z,updateAutoReconnect:q,updateAutoCheckUpdate:B,updateDefaultPermissionMode:E,updateShowSystemFiles:A,updateNotifyOnPermissionRequest:H,updateNotifyOnSessionCompleted:_,updateNotifyOnSessionFailed:Y}=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(ub,{})})]}),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:cN.map(z=>n.jsxs("button",{type:"button",className:`theme-card ${a===z.id?"active":""}`,"aria-pressed":a===z.id,onClick:()=>u(z.id),children:[n.jsx("span",{className:"theme-preview",style:{background:z.color}}),n.jsx("span",{className:"theme-label",children:uN(z)}),a===z.id?n.jsx("span",{className:"theme-check",children:"✓"}):null]},z.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.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:m,onChange:z=>A(z.target.checked)}),n.jsx("span",{children:o(m?"settings.enabled":"settings.disabled")})]})})]})]})]}),w?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:P,children:[n.jsx("input",{"aria-label":o("settings.serverAddress"),className:"settings-text-input",value:y,onChange:z=>x(z.target.value)}),n.jsx("button",{className:"settings-button",disabled:!C,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:c.autoReconnect,onChange:z=>q(z.target.checked)}),n.jsx("span",{children:c.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.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:z=>E(z.target.value),children:j.map(z=>n.jsx("option",{value:z.value,children:z.label},z.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:f,onChange:z=>H(z.target.checked)}),n.jsx("span",{children:o(f?"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:v,onChange:z=>_(z.target.checked)}),n.jsx("span",{children:o(v?"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:g,onChange:z=>Y(z.target.checked)}),n.jsx("span",{children:o(g?"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:c.releaseChannel,onChange:z=>Z(z.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(Q0,{})})]}),T.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:c.autoCheckUpdate,onChange:z=>B(z.target.checked)}),n.jsx("span",{children:c.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(X0,{})})]})]})]})]}),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:I,type:"button",children:o("common.logout")})]})]}),n.jsx(YV,{isOpen:r,onClose:()=>i(!1)})]})}function uG({model:e,appVersion:t}){const r=dr(),{section:i}=Po(),a=oG(i)?i:null,u=e.showServerSettings?[{id:"appearance",title:o("settings.appearance"),description:o("settings.appearanceSectionSummary"),value:aj(e.accountPreferences.language),icon:n.jsx(dj,{})},{id:"server-connection",title:o("settings.serverConnection"),description:o("settings.serverConnectionSectionSummary"),value:e.runtimeConfig.hostBaseUrl,icon:n.jsx(fG,{})},{id:"security-privacy",title:o("settings.securityPrivacy"),description:o("settings.securityPrivacySectionSummary"),value:lj(e.accountPreferences.defaultPermissionMode),icon:n.jsx(mj,{})},{id:"software-update",title:o("settings.softwareUpdate"),description:o("settings.softwareUpdateSectionSummary"),value:oj(e.runtimeConfig.releaseChannel),icon:n.jsx(hj,{})}]:[{id:"appearance",title:o("settings.appearance"),description:o("settings.appearanceSectionSummary"),value:aj(e.accountPreferences.language),icon:n.jsx(dj,{})},{id:"security-privacy",title:o("settings.securityPrivacy"),description:o("settings.securityPrivacySectionSummary"),value:lj(e.accountPreferences.defaultPermissionMode),icon:n.jsx(mj,{})},{id:"software-update",title:o("settings.softwareUpdate"),description:o("settings.softwareUpdateSectionSummary"),value:oj(e.runtimeConfig.releaseChannel),icon:n.jsx(hj,{})}];return(a?u.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(sj,{title:o("settings.title")}),n.jsxs("div",{className:"settings-mobile-container",children:[a==="appearance"?n.jsx(dG,{model:e}):null,a==="server-connection"&&e.showServerSettings?n.jsx(hG,{model:e}):null,a==="security-privacy"?n.jsx(mG,{model:e}):null,a==="software-update"?n.jsx(pG,{model:e}):null]}),n.jsx(uj,{onLogout:e.handleLogout})]}):n.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[n.jsx(sj,{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:u.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(gG,{})]})]},d.id))})}),n.jsx("div",{className:"settings-footer settings-footer-mobile",children:n.jsxs("span",{className:"settings-version",children:["CodingNS v",t]})})]}),n.jsx(uj,{onLogout:e.handleLogout})]})}function dG({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(ub,{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:cN.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:uN(t)})]}),n.jsx("span",{className:"settings-mobile-choice-indicator","aria-hidden":"true",children:r?n.jsx(bG,{}):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.showSystemFilesDescription")}),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.showSystemFiles")}),n.jsx("span",{className:"settings-mobile-row-description",children:o("settings.showSystemFilesDescription")})]}),n.jsx(Cl,{checked:e.showSystemFiles,label:o("settings.showSystemFiles"),onChange:e.updateShowSystemFiles})]})})]})]})}function hG({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(Cl,{checked:e.runtimeConfig.autoReconnect,label:o("settings.autoReconnect"),onChange:e.updateAutoReconnect})]})})]})]})}function mG({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(Cl,{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(Cl,{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(Cl,{checked:e.notifyOnSessionFailed,label:o("settings.notifyOnSessionFailed"),onChange:e.updateNotifyOnSessionFailed})]})]})]})]})}function pG({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(Q0,{})})]}),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(Cl,{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(X0,{})})]})]})}function uj({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 Cl({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 dj(){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 fG(){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 hj(){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 mj(){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 gG(){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 bG(){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 vG(){const e=Aj(r=>r.session),t=es();if(!e){const r=`${t.pathname}${t.search}`;return n.jsx(Pl,{to:`/login?returnTo=${encodeURIComponent(r)}`,replace:!0})}return n.jsx(hg,{})}function pj(){const{shellMode:e}=gr();return n.jsx(Pl,{to:e==="mobile"?"/workspaces":"/landing",replace:!0})}const wG=[{path:"/bootstrap",element:n.jsx(RE,{})},{path:"/login",element:n.jsx(_E,{})},{path:"/desktop-window-preview",element:n.jsx(yq,{})},{path:"/",element:n.jsx(vG,{}),children:[{path:"desktop-window/:windowId",element:n.jsx(R8,{})},{element:n.jsx(zV,{}),children:[{index:!0,element:n.jsx(pj,{})},{path:"landing",element:n.jsx(VV,{})},{path:"workspaces",element:n.jsx(iV,{})},{path:"workspaces/:workspaceId",element:n.jsx(LV,{})},{path:"workspaces/:workspaceId/debug",element:n.jsx(UV,{})},{path:"workspaces/:workspaceId/sessions",element:n.jsx(O8,{})},{path:"workspaces/:workspaceId/sessions/:sessionId",element:n.jsx(Y3,{})},{path:"workspaces/:workspaceId/tools",element:n.jsx(Y8,{})},{path:"workspaces/:workspaceId/tools/files",element:n.jsx(H8,{})},{path:"workspaces/:workspaceId/tools/git",element:n.jsx(z8,{})},{path:"workspaces/:workspaceId/tools/processes",element:n.jsx(q8,{})},{path:"workspaces/:workspaceId/terminals",lazy:async()=>({Component:(await jl(()=>import("./TerminalPage-BkjqU9NG.js"),__vite__mapDeps([0,1]))).TerminalPage})},{path:"workspaces/:workspaceId/butler",element:n.jsx(t3,{})},{path:"settings",element:n.jsx(cj,{})},{path:"settings/:section",element:n.jsx(cj,{})},{path:"*",element:n.jsx(pj,{})}]}]}];function yG(){return LA(wG)}function kG(){const e=To(r=>r.profile.language),t=p.useMemo(()=>yG(),[]);return n.jsx(tE,{children:n.jsx(kE,{children:n.jsx(uE,{language:e,children:n.jsx(gE,{children:n.jsx(yE,{children:n.jsx(qA,{router:t})})})})})})}fM().finally(()=>{l1.createRoot(document.getElementById("root")).render(n.jsx(kG,{}))});export{LN as C,Ro as M,u8 as T,rr as a,ts as b,Pb as c,dr as d,Po as e,gr as f,Rj as g,ir as h,CG as i,Rr as j,n as k,l8 as l,DG as m,UC as n,NG as o,PG as p,Xn as q,p as r,Db as s,o as t,cr as u,jG as v,Zr as w,c8 as x,TG as y,SG as z};
|