@jingyi0605/codingns 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/public/assets/{TerminalPage-4ulgBhv9.js → TerminalPage-4p6EBqrR.js} +1 -1
  2. package/dist/public/assets/gemini-D4G1NbrE.png +0 -0
  3. package/dist/public/assets/index-CxeghocY.css +1 -0
  4. package/dist/public/assets/index-DXusStl0.js +108 -0
  5. package/dist/public/assets/kimi-BWNNSh7e.png +0 -0
  6. package/dist/public/index.html +2 -2
  7. package/dist/server/config/env.d.ts +6 -0
  8. package/dist/server/config/env.js +145 -0
  9. package/dist/server/config/env.js.map +1 -1
  10. package/dist/server/config/opencode-system-probe-helper-process.d.ts +24 -0
  11. package/dist/server/config/opencode-system-probe-helper-process.js +70 -5
  12. package/dist/server/config/opencode-system-probe-helper-process.js.map +1 -1
  13. package/dist/server/modules/butler/butler-action-context-service.d.ts +30 -0
  14. package/dist/server/modules/butler/butler-action-context-service.js +108 -0
  15. package/dist/server/modules/butler/butler-action-context-service.js.map +1 -0
  16. package/dist/server/modules/butler/butler-auth-service.d.ts +17 -0
  17. package/dist/server/modules/butler/butler-auth-service.js +91 -0
  18. package/dist/server/modules/butler/butler-auth-service.js.map +1 -0
  19. package/dist/server/modules/butler/butler-control-action-service.d.ts +65 -0
  20. package/dist/server/modules/butler/butler-control-action-service.js +296 -0
  21. package/dist/server/modules/butler/butler-control-action-service.js.map +1 -0
  22. package/dist/server/modules/butler/butler-control-session-service.d.ts +55 -0
  23. package/dist/server/modules/butler/butler-control-session-service.js +367 -0
  24. package/dist/server/modules/butler/butler-control-session-service.js.map +1 -0
  25. package/dist/server/modules/butler/butler-controller.d.ts +367 -0
  26. package/dist/server/modules/butler/butler-controller.js +475 -0
  27. package/dist/server/modules/butler/butler-controller.js.map +1 -0
  28. package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.d.ts +34 -0
  29. package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.js +77 -0
  30. package/dist/server/modules/butler/butler-follow-up-evaluation-instruction-adapter.js.map +1 -0
  31. package/dist/server/modules/butler/butler-follow-up-scheduler.d.ts +23 -0
  32. package/dist/server/modules/butler/butler-follow-up-scheduler.js +57 -0
  33. package/dist/server/modules/butler/butler-follow-up-scheduler.js.map +1 -0
  34. package/dist/server/modules/butler/butler-follow-up-service.d.ts +86 -0
  35. package/dist/server/modules/butler/butler-follow-up-service.js +948 -0
  36. package/dist/server/modules/butler/butler-follow-up-service.js.map +1 -0
  37. package/dist/server/modules/butler/butler-inbox-service.d.ts +35 -0
  38. package/dist/server/modules/butler/butler-inbox-service.js +136 -0
  39. package/dist/server/modules/butler/butler-inbox-service.js.map +1 -0
  40. package/dist/server/modules/butler/butler-notification-service.d.ts +12 -0
  41. package/dist/server/modules/butler/butler-notification-service.js +45 -0
  42. package/dist/server/modules/butler/butler-notification-service.js.map +1 -0
  43. package/dist/server/modules/butler/butler-profile-service.d.ts +26 -0
  44. package/dist/server/modules/butler/butler-profile-service.js +529 -0
  45. package/dist/server/modules/butler/butler-profile-service.js.map +1 -0
  46. package/dist/server/modules/butler/butler-project-service.d.ts +48 -0
  47. package/dist/server/modules/butler/butler-project-service.js +253 -0
  48. package/dist/server/modules/butler/butler-project-service.js.map +1 -0
  49. package/dist/server/modules/butler/butler-session-service.d.ts +79 -0
  50. package/dist/server/modules/butler/butler-session-service.js +503 -0
  51. package/dist/server/modules/butler/butler-session-service.js.map +1 -0
  52. package/dist/server/modules/butler/butler-session-summary-service.d.ts +55 -0
  53. package/dist/server/modules/butler/butler-session-summary-service.js +382 -0
  54. package/dist/server/modules/butler/butler-session-summary-service.js.map +1 -0
  55. package/dist/server/modules/butler/context-aggregator.d.ts +187 -0
  56. package/dist/server/modules/butler/context-aggregator.js +807 -0
  57. package/dist/server/modules/butler/context-aggregator.js.map +1 -0
  58. package/dist/server/modules/butler/instruction-adapter.d.ts +28 -0
  59. package/dist/server/modules/butler/instruction-adapter.js +101 -0
  60. package/dist/server/modules/butler/instruction-adapter.js.map +1 -0
  61. package/dist/server/modules/butler/patrol-execution-service.d.ts +47 -0
  62. package/dist/server/modules/butler/patrol-execution-service.js +347 -0
  63. package/dist/server/modules/butler/patrol-execution-service.js.map +1 -0
  64. package/dist/server/modules/butler/patrol-plan-service.d.ts +54 -0
  65. package/dist/server/modules/butler/patrol-plan-service.js +272 -0
  66. package/dist/server/modules/butler/patrol-plan-service.js.map +1 -0
  67. package/dist/server/modules/butler/patrol-run-service.d.ts +60 -0
  68. package/dist/server/modules/butler/patrol-run-service.js +185 -0
  69. package/dist/server/modules/butler/patrol-run-service.js.map +1 -0
  70. package/dist/server/modules/butler/patrol-scheduler.d.ts +36 -0
  71. package/dist/server/modules/butler/patrol-scheduler.js +99 -0
  72. package/dist/server/modules/butler/patrol-scheduler.js.map +1 -0
  73. package/dist/server/modules/butler/project-memory-service.d.ts +30 -0
  74. package/dist/server/modules/butler/project-memory-service.js +103 -0
  75. package/dist/server/modules/butler/project-memory-service.js.map +1 -0
  76. package/dist/server/modules/butler/provider-adapter-registry.d.ts +61 -0
  77. package/dist/server/modules/butler/provider-adapter-registry.js +430 -0
  78. package/dist/server/modules/butler/provider-adapter-registry.js.map +1 -0
  79. package/dist/server/modules/butler/session-summary-instruction-adapter.d.ts +28 -0
  80. package/dist/server/modules/butler/session-summary-instruction-adapter.js +79 -0
  81. package/dist/server/modules/butler/session-summary-instruction-adapter.js.map +1 -0
  82. package/dist/server/modules/butler/session-summary-scheduler.d.ts +23 -0
  83. package/dist/server/modules/butler/session-summary-scheduler.js +57 -0
  84. package/dist/server/modules/butler/session-summary-scheduler.js.map +1 -0
  85. package/dist/server/modules/butler/verification-run-service.d.ts +73 -0
  86. package/dist/server/modules/butler/verification-run-service.js +633 -0
  87. package/dist/server/modules/butler/verification-run-service.js.map +1 -0
  88. package/dist/server/modules/preferences/profile-service.js +8 -2
  89. package/dist/server/modules/preferences/profile-service.js.map +1 -1
  90. package/dist/server/modules/sessions/claude-runtime-helper-process.js +1 -1
  91. package/dist/server/modules/sessions/claude-runtime-helper-process.js.map +1 -1
  92. package/dist/server/modules/sessions/codex-app-server-helper-client.d.ts +5 -1
  93. package/dist/server/modules/sessions/codex-app-server-helper-client.js +10 -2
  94. package/dist/server/modules/sessions/codex-app-server-helper-client.js.map +1 -1
  95. package/dist/server/modules/sessions/session-controller.d.ts +3 -1
  96. package/dist/server/modules/sessions/session-controller.js +11 -2
  97. package/dist/server/modules/sessions/session-controller.js.map +1 -1
  98. package/dist/server/modules/sessions/session-history-service.d.ts +14 -1
  99. package/dist/server/modules/sessions/session-history-service.js +291 -30
  100. package/dist/server/modules/sessions/session-history-service.js.map +1 -1
  101. package/dist/server/modules/sessions/session-live-runtime-service.d.ts +25 -2
  102. package/dist/server/modules/sessions/session-live-runtime-service.js +526 -158
  103. package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
  104. package/dist/server/modules/sessions/session-provider-error-mapper.js +28 -0
  105. package/dist/server/modules/sessions/session-provider-error-mapper.js.map +1 -1
  106. package/dist/server/modules/workbench/workbench-service.d.ts +7 -1
  107. package/dist/server/modules/workbench/workbench-service.js +31 -7
  108. package/dist/server/modules/workbench/workbench-service.js.map +1 -1
  109. package/dist/server/routes/butler.d.ts +3 -0
  110. package/dist/server/routes/butler.js +54 -0
  111. package/dist/server/routes/butler.js.map +1 -0
  112. package/dist/server/server/create-server.d.ts +61 -0
  113. package/dist/server/server/create-server.js +148 -4
  114. package/dist/server/server/create-server.js.map +1 -1
  115. package/dist/server/storage/repositories/butler-control-event-repository.d.ts +8 -0
  116. package/dist/server/storage/repositories/butler-control-event-repository.js +78 -0
  117. package/dist/server/storage/repositories/butler-control-event-repository.js.map +1 -0
  118. package/dist/server/storage/repositories/butler-control-session-repository.d.ts +11 -0
  119. package/dist/server/storage/repositories/butler-control-session-repository.js +86 -0
  120. package/dist/server/storage/repositories/butler-control-session-repository.js.map +1 -0
  121. package/dist/server/storage/repositories/butler-follow-up-task-repository.d.ts +16 -0
  122. package/dist/server/storage/repositories/butler-follow-up-task-repository.js +252 -0
  123. package/dist/server/storage/repositories/butler-follow-up-task-repository.js.map +1 -0
  124. package/dist/server/storage/repositories/butler-inbox-item-repository.d.ts +15 -0
  125. package/dist/server/storage/repositories/butler-inbox-item-repository.js +111 -0
  126. package/dist/server/storage/repositories/butler-inbox-item-repository.js.map +1 -0
  127. package/dist/server/storage/repositories/butler-notification-archive-repository.d.ts +9 -0
  128. package/dist/server/storage/repositories/butler-notification-archive-repository.js +48 -0
  129. package/dist/server/storage/repositories/butler-notification-archive-repository.js.map +1 -0
  130. package/dist/server/storage/repositories/butler-profile-repository.d.ts +9 -0
  131. package/dist/server/storage/repositories/butler-profile-repository.js +86 -0
  132. package/dist/server/storage/repositories/butler-profile-repository.js.map +1 -0
  133. package/dist/server/storage/repositories/butler-project-repository.d.ts +14 -0
  134. package/dist/server/storage/repositories/butler-project-repository.js +140 -0
  135. package/dist/server/storage/repositories/butler-project-repository.js.map +1 -0
  136. package/dist/server/storage/repositories/butler-session-repository.d.ts +11 -0
  137. package/dist/server/storage/repositories/butler-session-repository.js +106 -0
  138. package/dist/server/storage/repositories/butler-session-repository.js.map +1 -0
  139. package/dist/server/storage/repositories/butler-session-summary-state-repository.d.ts +8 -0
  140. package/dist/server/storage/repositories/butler-session-summary-state-repository.js +62 -0
  141. package/dist/server/storage/repositories/butler-session-summary-state-repository.js.map +1 -0
  142. package/dist/server/storage/repositories/patrol-plan-repository.d.ts +27 -0
  143. package/dist/server/storage/repositories/patrol-plan-repository.js +119 -0
  144. package/dist/server/storage/repositories/patrol-plan-repository.js.map +1 -0
  145. package/dist/server/storage/repositories/patrol-run-repository.d.ts +28 -0
  146. package/dist/server/storage/repositories/patrol-run-repository.js +121 -0
  147. package/dist/server/storage/repositories/patrol-run-repository.js.map +1 -0
  148. package/dist/server/storage/repositories/project-memory-repository.d.ts +15 -0
  149. package/dist/server/storage/repositories/project-memory-repository.js +150 -0
  150. package/dist/server/storage/repositories/project-memory-repository.js.map +1 -0
  151. package/dist/server/storage/repositories/session-checkpoint-repository.d.ts +9 -0
  152. package/dist/server/storage/repositories/session-checkpoint-repository.js +72 -0
  153. package/dist/server/storage/repositories/session-checkpoint-repository.js.map +1 -0
  154. package/dist/server/storage/repositories/session-message-origin-repository.d.ts +10 -0
  155. package/dist/server/storage/repositories/session-message-origin-repository.js +93 -0
  156. package/dist/server/storage/repositories/session-message-origin-repository.js.map +1 -0
  157. package/dist/server/storage/repositories/verification-run-repository.d.ts +29 -0
  158. package/dist/server/storage/repositories/verification-run-repository.js +125 -0
  159. package/dist/server/storage/repositories/verification-run-repository.js.map +1 -0
  160. package/dist/server/storage/sqlite/client.js +39 -0
  161. package/dist/server/storage/sqlite/client.js.map +1 -1
  162. package/dist/server/storage/sqlite/schema.sql +324 -0
  163. package/dist/server/types/domain.d.ts +261 -1
  164. package/dist/server/ws/ws-server.d.ts +2 -1
  165. package/dist/server/ws/ws-server.js +2 -1
  166. package/dist/server/ws/ws-server.js.map +1 -1
  167. package/node_modules/@codingns/session-sync-core/dist/index.d.ts +4 -0
  168. package/node_modules/@codingns/session-sync-core/dist/index.js +4 -0
  169. package/node_modules/@codingns/session-sync-core/dist/index.js.map +1 -1
  170. package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.d.ts +18 -0
  171. package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js +659 -0
  172. package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js.map +1 -0
  173. package/node_modules/@codingns/session-sync-core/dist/kimi-shared.d.ts +11 -0
  174. package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js +72 -0
  175. package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js.map +1 -0
  176. package/node_modules/@codingns/session-sync-core/dist/patch-builder.d.ts +8 -0
  177. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js +89 -0
  178. package/node_modules/@codingns/session-sync-core/dist/patch-builder.js.map +1 -1
  179. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +4 -1
  180. package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +1 -1
  181. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.d.ts +41 -0
  182. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js +1086 -0
  183. package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js.map +1 -0
  184. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.d.ts +29 -0
  185. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js +578 -0
  186. package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js.map +1 -0
  187. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +2 -1
  188. package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +1 -1
  189. package/node_modules/@codingns/session-sync-core/dist/providers/utils.js +30 -2
  190. package/node_modules/@codingns/session-sync-core/dist/providers/utils.js.map +1 -1
  191. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.d.ts +2 -0
  192. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js +43 -5
  193. package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js.map +1 -1
  194. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +2 -0
  195. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +320 -69
  196. package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +1 -1
  197. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.d.ts +21 -0
  198. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js +537 -0
  199. package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js.map +1 -0
  200. package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.d.ts +38 -0
  201. package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js +911 -0
  202. package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js.map +1 -0
  203. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.d.ts +6 -0
  204. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js +9 -0
  205. package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js.map +1 -0
  206. package/node_modules/@codingns/session-sync-core/package.json +8 -0
  207. package/package.json +1 -1
  208. package/dist/public/assets/index-C5lu52cQ.css +0 -1
  209. package/dist/public/assets/index-WpdUo_Vs.js +0 -108
@@ -0,0 +1,108 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPage-4p6EBqrR.js","assets/TerminalPage-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
2
+ var PP=Object.defineProperty;var TP=(e,t,n)=>t in e?PP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var He=(e,t,n)=>TP(e,typeof t!="symbol"?t+"":t,n);function Ak(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&&!Array.isArray(i)){for(const a in i)if(a!=="default"&&!(a in e)){const c=Object.getOwnPropertyDescriptor(i,a);c&&Object.defineProperty(e,a,c.get?c:{enumerable:!0,get:()=>i[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const l of c.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function n(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function i(a){if(a.ep)return;a.ep=!0;const c=n(a);fetch(a.href,c)}})();function Ll(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var zh={exports:{}},Qa={},Hh={exports:{}},Jt={};/**
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 wy;function RP(){if(wy)return Jt;wy=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.provider"),l=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.iterator;function w($){return $===null||typeof $!="object"?null:($=g&&$[g]||$["@@iterator"],typeof $=="function"?$:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,C={};function P($,Z,F){this.props=$,this.context=Z,this.refs=C,this.updater=F||x}P.prototype.isReactComponent={},P.prototype.setState=function($,Z){if(typeof $!="object"&&typeof $!="function"&&$!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,$,Z,"setState")},P.prototype.forceUpdate=function($){this.updater.enqueueForceUpdate(this,$,"forceUpdate")};function A(){}A.prototype=P.prototype;function L($,Z,F){this.props=$,this.context=Z,this.refs=C,this.updater=F||x}var O=L.prototype=new A;O.constructor=L,S(O,P.prototype),O.isPureReactComponent=!0;var ee=Array.isArray,q=Object.prototype.hasOwnProperty,_={current:null},E={key:!0,ref:!0,__self:!0,__source:!0};function M($,Z,F){var we,ce={},be=null,Ve=null;if(Z!=null)for(we in Z.ref!==void 0&&(Ve=Z.ref),Z.key!==void 0&&(be=""+Z.key),Z)q.call(Z,we)&&!E.hasOwnProperty(we)&&(ce[we]=Z[we]);var ze=arguments.length-2;if(ze===1)ce.children=F;else if(1<ze){for(var yt=Array(ze),ft=0;ft<ze;ft++)yt[ft]=arguments[ft+2];ce.children=yt}if($&&$.defaultProps)for(we in ze=$.defaultProps,ze)ce[we]===void 0&&(ce[we]=ze[we]);return{$$typeof:e,type:$,key:be,ref:Ve,props:ce,_owner:_.current}}function I($,Z){return{$$typeof:e,type:$.type,key:Z,ref:$.ref,props:$.props,_owner:$._owner}}function N($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function z($){var Z={"=":"=0",":":"=2"};return"$"+$.replace(/[=:]/g,function(F){return Z[F]})}var G=/\/+/g;function J($,Z){return typeof $=="object"&&$!==null&&$.key!=null?z(""+$.key):Z.toString(36)}function B($,Z,F,we,ce){var be=typeof $;(be==="undefined"||be==="boolean")&&($=null);var Ve=!1;if($===null)Ve=!0;else switch(be){case"string":case"number":Ve=!0;break;case"object":switch($.$$typeof){case e:case t:Ve=!0}}if(Ve)return Ve=$,ce=ce(Ve),$=we===""?"."+J(Ve,0):we,ee(ce)?(F="",$!=null&&(F=$.replace(G,"$&/")+"/"),B(ce,Z,F,"",function(ft){return ft})):ce!=null&&(N(ce)&&(ce=I(ce,F+(!ce.key||Ve&&Ve.key===ce.key?"":(""+ce.key).replace(G,"$&/")+"/")+$)),Z.push(ce)),1;if(Ve=0,we=we===""?".":we+":",ee($))for(var ze=0;ze<$.length;ze++){be=$[ze];var yt=we+J(be,ze);Ve+=B(be,Z,F,yt,ce)}else if(yt=w($),typeof yt=="function")for($=yt.call($),ze=0;!(be=$.next()).done;)be=be.value,yt=we+J(be,ze++),Ve+=B(be,Z,F,yt,ce);else if(be==="object")throw Z=String($),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys($).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.");return Ve}function W($,Z,F){if($==null)return $;var we=[],ce=0;return B($,we,"","",function(be){return Z.call(F,be,ce++)}),we}function Y($){if($._status===-1){var Z=$._result;Z=Z(),Z.then(function(F){($._status===0||$._status===-1)&&($._status=1,$._result=F)},function(F){($._status===0||$._status===-1)&&($._status=2,$._result=F)}),$._status===-1&&($._status=0,$._result=Z)}if($._status===1)return $._result.default;throw $._result}var Q={current:null},D={transition:null},re={ReactCurrentDispatcher:Q,ReactCurrentBatchConfig:D,ReactCurrentOwner:_};function R(){throw Error("act(...) is not supported in production builds of React.")}return Jt.Children={map:W,forEach:function($,Z,F){W($,function(){Z.apply(this,arguments)},F)},count:function($){var Z=0;return W($,function(){Z++}),Z},toArray:function($){return W($,function(Z){return Z})||[]},only:function($){if(!N($))throw Error("React.Children.only expected to receive a single React element child.");return $}},Jt.Component=P,Jt.Fragment=n,Jt.Profiler=a,Jt.PureComponent=L,Jt.StrictMode=i,Jt.Suspense=f,Jt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=re,Jt.act=R,Jt.cloneElement=function($,Z,F){if($==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+$+".");var we=S({},$.props),ce=$.key,be=$.ref,Ve=$._owner;if(Z!=null){if(Z.ref!==void 0&&(be=Z.ref,Ve=_.current),Z.key!==void 0&&(ce=""+Z.key),$.type&&$.type.defaultProps)var ze=$.type.defaultProps;for(yt in Z)q.call(Z,yt)&&!E.hasOwnProperty(yt)&&(we[yt]=Z[yt]===void 0&&ze!==void 0?ze[yt]:Z[yt])}var yt=arguments.length-2;if(yt===1)we.children=F;else if(1<yt){ze=Array(yt);for(var ft=0;ft<yt;ft++)ze[ft]=arguments[ft+2];we.children=ze}return{$$typeof:e,type:$.type,key:ce,ref:be,props:we,_owner:Ve}},Jt.createContext=function($){return $={$$typeof:l,_currentValue:$,_currentValue2:$,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},$.Provider={$$typeof:c,_context:$},$.Consumer=$},Jt.createElement=M,Jt.createFactory=function($){var Z=M.bind(null,$);return Z.type=$,Z},Jt.createRef=function(){return{current:null}},Jt.forwardRef=function($){return{$$typeof:h,render:$}},Jt.isValidElement=N,Jt.lazy=function($){return{$$typeof:y,_payload:{_status:-1,_result:$},_init:Y}},Jt.memo=function($,Z){return{$$typeof:p,type:$,compare:Z===void 0?null:Z}},Jt.startTransition=function($){var Z=D.transition;D.transition={};try{$()}finally{D.transition=Z}},Jt.unstable_act=R,Jt.useCallback=function($,Z){return Q.current.useCallback($,Z)},Jt.useContext=function($){return Q.current.useContext($)},Jt.useDebugValue=function(){},Jt.useDeferredValue=function($){return Q.current.useDeferredValue($)},Jt.useEffect=function($,Z){return Q.current.useEffect($,Z)},Jt.useId=function(){return Q.current.useId()},Jt.useImperativeHandle=function($,Z,F){return Q.current.useImperativeHandle($,Z,F)},Jt.useInsertionEffect=function($,Z){return Q.current.useInsertionEffect($,Z)},Jt.useLayoutEffect=function($,Z){return Q.current.useLayoutEffect($,Z)},Jt.useMemo=function($,Z){return Q.current.useMemo($,Z)},Jt.useReducer=function($,Z,F){return Q.current.useReducer($,Z,F)},Jt.useRef=function($){return Q.current.useRef($)},Jt.useState=function($){return Q.current.useState($)},Jt.useSyncExternalStore=function($,Z,F){return Q.current.useSyncExternalStore($,Z,F)},Jt.useTransition=function(){return Q.current.useTransition()},Jt.version="18.3.1",Jt}var xy;function $m(){return xy||(xy=1,Hh.exports=RP()),Hh.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 ky;function EP(){if(ky)return Qa;ky=1;var e=$m(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function l(h,f,p){var y,g={},w=null,x=null;p!==void 0&&(w=""+p),f.key!==void 0&&(w=""+f.key),f.ref!==void 0&&(x=f.ref);for(y in f)i.call(f,y)&&!c.hasOwnProperty(y)&&(g[y]=f[y]);if(h&&h.defaultProps)for(y in f=h.defaultProps,f)g[y]===void 0&&(g[y]=f[y]);return{$$typeof:t,type:h,key:w,ref:x,props:g,_owner:a.current}}return Qa.Fragment=n,Qa.jsx=l,Qa.jsxs=l,Qa}var Sy;function AP(){return Sy||(Sy=1,zh.exports=EP()),zh.exports}var r=AP(),qc={},qh={exports:{}},xr={},$h={exports:{}},Vh={};/**
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 Cy;function IP(){return Cy||(Cy=1,(function(e){function t(D,re){var R=D.length;D.push(re);e:for(;0<R;){var $=R-1>>>1,Z=D[$];if(0<a(Z,re))D[$]=re,D[R]=Z,R=$;else break e}}function n(D){return D.length===0?null:D[0]}function i(D){if(D.length===0)return null;var re=D[0],R=D.pop();if(R!==re){D[0]=R;e:for(var $=0,Z=D.length,F=Z>>>1;$<F;){var we=2*($+1)-1,ce=D[we],be=we+1,Ve=D[be];if(0>a(ce,R))be<Z&&0>a(Ve,ce)?(D[$]=Ve,D[be]=R,$=be):(D[$]=ce,D[we]=R,$=we);else if(be<Z&&0>a(Ve,R))D[$]=Ve,D[be]=R,$=be;else break e}}return re}function a(D,re){var R=D.sortIndex-re.sortIndex;return R!==0?R:D.id-re.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var l=Date,h=l.now();e.unstable_now=function(){return l.now()-h}}var f=[],p=[],y=1,g=null,w=3,x=!1,S=!1,C=!1,P=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function O(D){for(var re=n(p);re!==null;){if(re.callback===null)i(p);else if(re.startTime<=D)i(p),re.sortIndex=re.expirationTime,t(f,re);else break;re=n(p)}}function ee(D){if(C=!1,O(D),!S)if(n(f)!==null)S=!0,Y(q);else{var re=n(p);re!==null&&Q(ee,re.startTime-D)}}function q(D,re){S=!1,C&&(C=!1,A(M),M=-1),x=!0;var R=w;try{for(O(re),g=n(f);g!==null&&(!(g.expirationTime>re)||D&&!z());){var $=g.callback;if(typeof $=="function"){g.callback=null,w=g.priorityLevel;var Z=$(g.expirationTime<=re);re=e.unstable_now(),typeof Z=="function"?g.callback=Z:g===n(f)&&i(f),O(re)}else i(f);g=n(f)}if(g!==null)var F=!0;else{var we=n(p);we!==null&&Q(ee,we.startTime-re),F=!1}return F}finally{g=null,w=R,x=!1}}var _=!1,E=null,M=-1,I=5,N=-1;function z(){return!(e.unstable_now()-N<I)}function G(){if(E!==null){var D=e.unstable_now();N=D;var re=!0;try{re=E(!0,D)}finally{re?J():(_=!1,E=null)}}else _=!1}var J;if(typeof L=="function")J=function(){L(G)};else if(typeof MessageChannel<"u"){var B=new MessageChannel,W=B.port2;B.port1.onmessage=G,J=function(){W.postMessage(null)}}else J=function(){P(G,0)};function Y(D){E=D,_||(_=!0,J())}function Q(D,re){M=P(function(){D(e.unstable_now())},re)}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(D){D.callback=null},e.unstable_continueExecution=function(){S||x||(S=!0,Y(q))},e.unstable_forceFrameRate=function(D){0>D||125<D?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<D?Math.floor(1e3/D):5},e.unstable_getCurrentPriorityLevel=function(){return w},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(D){switch(w){case 1:case 2:case 3:var re=3;break;default:re=w}var R=w;w=re;try{return D()}finally{w=R}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(D,re){switch(D){case 1:case 2:case 3:case 4:case 5:break;default:D=3}var R=w;w=D;try{return re()}finally{w=R}},e.unstable_scheduleCallback=function(D,re,R){var $=e.unstable_now();switch(typeof R=="object"&&R!==null?(R=R.delay,R=typeof R=="number"&&0<R?$+R:$):R=$,D){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=R+Z,D={id:y++,callback:re,priorityLevel:D,startTime:R,expirationTime:Z,sortIndex:-1},R>$?(D.sortIndex=R,t(p,D),n(f)===null&&D===n(p)&&(C?(A(M),M=-1):C=!0,Q(ee,R-$))):(D.sortIndex=Z,t(f,D),S||x||(S=!0,Y(q))),D},e.unstable_shouldYield=z,e.unstable_wrapCallback=function(D){var re=w;return function(){var R=w;w=re;try{return D.apply(this,arguments)}finally{w=R}}}})(Vh)),Vh}var jy;function LP(){return jy||(jy=1,$h.exports=IP()),$h.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 Ny;function MP(){if(Ny)return xr;Ny=1;var e=$m(),t=LP();function n(s){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+s,d=1;d<arguments.length;d++)o+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+s+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var i=new Set,a={};function c(s,o){l(s,o),l(s+"Capture",o)}function l(s,o){for(a[s]=o,s=0;s<o.length;s++)i.add(o[s])}var h=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,y={},g={};function w(s){return f.call(g,s)?!0:f.call(y,s)?!1:p.test(s)?g[s]=!0:(y[s]=!0,!1)}function x(s,o,d,m){if(d!==null&&d.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return m?!1:d!==null?!d.acceptsBooleans:(s=s.toLowerCase().slice(0,5),s!=="data-"&&s!=="aria-");default:return!1}}function S(s,o,d,m){if(o===null||typeof o>"u"||x(s,o,d,m))return!0;if(m)return!1;if(d!==null)switch(d.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function C(s,o,d,m,v,k,T){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=m,this.attributeNamespace=v,this.mustUseProperty=d,this.propertyName=s,this.type=o,this.sanitizeURL=k,this.removeEmptyString=T}var P={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(s){P[s]=new C(s,0,!1,s,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(s){var o=s[0];P[o]=new C(o,1,!1,s[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(s){P[s]=new C(s,2,!1,s.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(s){P[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){P[s]=new C(s,3,!1,s.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(s){P[s]=new C(s,3,!0,s,null,!1,!1)}),["capture","download"].forEach(function(s){P[s]=new C(s,4,!1,s,null,!1,!1)}),["cols","rows","size","span"].forEach(function(s){P[s]=new C(s,6,!1,s,null,!1,!1)}),["rowSpan","start"].forEach(function(s){P[s]=new C(s,5,!1,s.toLowerCase(),null,!1,!1)});var A=/[\-:]([a-z])/g;function L(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 o=s.replace(A,L);P[o]=new C(o,1,!1,s,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(s){var o=s.replace(A,L);P[o]=new C(o,1,!1,s,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(s){var o=s.replace(A,L);P[o]=new C(o,1,!1,s,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(s){P[s]=new C(s,1,!1,s.toLowerCase(),null,!1,!1)}),P.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(s){P[s]=new C(s,1,!1,s.toLowerCase(),null,!0,!0)});function O(s,o,d,m){var v=P.hasOwnProperty(o)?P[o]:null;(v!==null?v.type!==0:m||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(S(o,d,v,m)&&(d=null),m||v===null?w(o)&&(d===null?s.removeAttribute(o):s.setAttribute(o,""+d)):v.mustUseProperty?s[v.propertyName]=d===null?v.type===3?!1:"":d:(o=v.attributeName,m=v.attributeNamespace,d===null?s.removeAttribute(o):(v=v.type,d=v===3||v===4&&d===!0?"":""+d,m?s.setAttributeNS(m,o,d):s.setAttribute(o,d))))}var ee=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,q=Symbol.for("react.element"),_=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),I=Symbol.for("react.profiler"),N=Symbol.for("react.provider"),z=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),W=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),Q=Symbol.for("react.offscreen"),D=Symbol.iterator;function re(s){return s===null||typeof s!="object"?null:(s=D&&s[D]||s["@@iterator"],typeof s=="function"?s:null)}var R=Object.assign,$;function Z(s){if($===void 0)try{throw Error()}catch(d){var o=d.stack.trim().match(/\n( *(at )?)/);$=o&&o[1]||""}return`
35
+ `+$+s}var F=!1;function we(s,o){if(!s||F)return"";F=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(pe){var m=pe}Reflect.construct(s,[],o)}else{try{o.call()}catch(pe){m=pe}s.call(o.prototype)}else{try{throw Error()}catch(pe){m=pe}s()}}catch(pe){if(pe&&m&&typeof pe.stack=="string"){for(var v=pe.stack.split(`
36
+ `),k=m.stack.split(`
37
+ `),T=v.length-1,H=k.length-1;1<=T&&0<=H&&v[T]!==k[H];)H--;for(;1<=T&&0<=H;T--,H--)if(v[T]!==k[H]){if(T!==1||H!==1)do if(T--,H--,0>H||v[T]!==k[H]){var te=`
38
+ `+v[T].replace(" at new "," at ");return s.displayName&&te.includes("<anonymous>")&&(te=te.replace("<anonymous>",s.displayName)),te}while(1<=T&&0<=H);break}}}finally{F=!1,Error.prepareStackTrace=d}return(s=s?s.displayName||s.name:"")?Z(s):""}function ce(s){switch(s.tag){case 5:return Z(s.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return s=we(s.type,!1),s;case 11:return s=we(s.type.render,!1),s;case 1:return s=we(s.type,!0),s;default:return""}}function be(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 _:return"Portal";case I:return"Profiler";case M:return"StrictMode";case J:return"Suspense";case B:return"SuspenseList"}if(typeof s=="object")switch(s.$$typeof){case z:return(s.displayName||"Context")+".Consumer";case N:return(s._context.displayName||"Context")+".Provider";case G:var o=s.render;return s=s.displayName,s||(s=o.displayName||o.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case W:return o=s.displayName||null,o!==null?o:be(s.type)||"Memo";case Y:o=s._payload,s=s._init;try{return be(s(o))}catch{}}return null}function Ve(s){var o=s.type;switch(s.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return s=o.render,s=s.displayName||s.name||"",o.displayName||(s!==""?"ForwardRef("+s+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return be(o);case 8:return o===M?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function ze(s){switch(typeof s){case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function yt(s){var o=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function ft(s){var o=yt(s)?"checked":"value",d=Object.getOwnPropertyDescriptor(s.constructor.prototype,o),m=""+s[o];if(!s.hasOwnProperty(o)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,k=d.set;return Object.defineProperty(s,o,{configurable:!0,get:function(){return v.call(this)},set:function(T){m=""+T,k.call(this,T)}}),Object.defineProperty(s,o,{enumerable:d.enumerable}),{getValue:function(){return m},setValue:function(T){m=""+T},stopTracking:function(){s._valueTracker=null,delete s[o]}}}}function Ot(s){s._valueTracker||(s._valueTracker=ft(s))}function Ke(s){if(!s)return!1;var o=s._valueTracker;if(!o)return!0;var d=o.getValue(),m="";return s&&(m=yt(s)?s.checked?"true":"false":s.value),s=m,s!==d?(o.setValue(s),!0):!1}function jt(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 pt(s,o){var d=o.checked;return R({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??s._wrapperState.initialChecked})}function Mt(s,o){var d=o.defaultValue==null?"":o.defaultValue,m=o.checked!=null?o.checked:o.defaultChecked;d=ze(o.value!=null?o.value:d),s._wrapperState={initialChecked:m,initialValue:d,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function xt(s,o){o=o.checked,o!=null&&O(s,"checked",o,!1)}function Dt(s,o){xt(s,o);var d=ze(o.value),m=o.type;if(d!=null)m==="number"?(d===0&&s.value===""||s.value!=d)&&(s.value=""+d):s.value!==""+d&&(s.value=""+d);else if(m==="submit"||m==="reset"){s.removeAttribute("value");return}o.hasOwnProperty("value")?ye(s,o.type,d):o.hasOwnProperty("defaultValue")&&ye(s,o.type,ze(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(s.defaultChecked=!!o.defaultChecked)}function wt(s,o,d){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var m=o.type;if(!(m!=="submit"&&m!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+s._wrapperState.initialValue,d||o===s.value||(s.value=o),s.defaultValue=o}d=s.name,d!==""&&(s.name=""),s.defaultChecked=!!s._wrapperState.initialChecked,d!==""&&(s.name=d)}function ye(s,o,d){(o!=="number"||jt(s.ownerDocument)!==s)&&(d==null?s.defaultValue=""+s._wrapperState.initialValue:s.defaultValue!==""+d&&(s.defaultValue=""+d))}var Fe=Array.isArray;function kt(s,o,d,m){if(s=s.options,o){o={};for(var v=0;v<d.length;v++)o["$"+d[v]]=!0;for(d=0;d<s.length;d++)v=o.hasOwnProperty("$"+s[d].value),s[d].selected!==v&&(s[d].selected=v),v&&m&&(s[d].defaultSelected=!0)}else{for(d=""+ze(d),o=null,v=0;v<s.length;v++){if(s[v].value===d){s[v].selected=!0,m&&(s[v].defaultSelected=!0);return}o!==null||s[v].disabled||(o=s[v])}o!==null&&(o.selected=!0)}}function lt(s,o){if(o.dangerouslySetInnerHTML!=null)throw Error(n(91));return R({},o,{value:void 0,defaultValue:void 0,children:""+s._wrapperState.initialValue})}function gt(s,o){var d=o.value;if(d==null){if(d=o.children,o=o.defaultValue,d!=null){if(o!=null)throw Error(n(92));if(Fe(d)){if(1<d.length)throw Error(n(93));d=d[0]}o=d}o==null&&(o=""),d=o}s._wrapperState={initialValue:ze(d)}}function Lt(s,o){var d=ze(o.value),m=ze(o.defaultValue);d!=null&&(d=""+d,d!==s.value&&(s.value=d),o.defaultValue==null&&s.defaultValue!==d&&(s.defaultValue=d)),m!=null&&(s.defaultValue=""+m)}function nt(s){var o=s.textContent;o===s._wrapperState.initialValue&&o!==""&&o!==null&&(s.value=o)}function fe(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 ge(s,o){return s==null||s==="http://www.w3.org/1999/xhtml"?fe(o):s==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":s}var Te,qe=(function(s){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,d,m,v){MSApp.execUnsafeLocalFunction(function(){return s(o,d,m,v)})}:s})(function(s,o){if(s.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in s)s.innerHTML=o;else{for(Te=Te||document.createElement("div"),Te.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=Te.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;o.firstChild;)s.appendChild(o.firstChild)}});function dt(s,o){if(o){var d=s.firstChild;if(d&&d===s.lastChild&&d.nodeType===3){d.nodeValue=o;return}}s.textContent=o}var St={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},rt=["Webkit","ms","Moz","O"];Object.keys(St).forEach(function(s){rt.forEach(function(o){o=o+s.charAt(0).toUpperCase()+s.substring(1),St[o]=St[s]})});function Ut(s,o,d){return o==null||typeof o=="boolean"||o===""?"":d||typeof o!="number"||o===0||St.hasOwnProperty(s)&&St[s]?(""+o).trim():o+"px"}function mt(s,o){s=s.style;for(var d in o)if(o.hasOwnProperty(d)){var m=d.indexOf("--")===0,v=Ut(d,o[d],m);d==="float"&&(d="cssFloat"),m?s.setProperty(d,v):s[d]=v}}var Bt=R({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 At(s,o){if(o){if(Bt[s]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(n(137,s));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(n(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(n(61))}if(o.style!=null&&typeof o.style!="object")throw Error(n(62))}}function vt(s,o){if(s.indexOf("-")===-1)return typeof o.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 Nt=null;function Zt(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ie=null,Ie=null,ct=null;function zt(s){if(s=Ma(s)){if(typeof ie!="function")throw Error(n(280));var o=s.stateNode;o&&(o=sc(o),ie(s.stateNode,s.type,o))}}function nn(s){Ie?ct?ct.push(s):ct=[s]:Ie=s}function ke(){if(Ie){var s=Ie,o=ct;if(ct=Ie=null,zt(s),o)for(s=0;s<o.length;s++)zt(o[s])}}function it(s,o){return s(o)}function Qt(){}var rn=!1;function Tn(s,o,d){if(rn)return s(o,d);rn=!0;try{return it(s,o,d)}finally{rn=!1,(Ie!==null||ct!==null)&&(Qt(),ke())}}function un(s,o){var d=s.stateNode;if(d===null)return null;var m=sc(d);if(m===null)return null;d=m[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(m=!m.disabled)||(s=s.type,m=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!m;break e;default:s=!1}if(s)return null;if(d&&typeof d!="function")throw Error(n(231,o,typeof d));return d}var X=!1;if(h)try{var oe={};Object.defineProperty(oe,"passive",{get:function(){X=!0}}),window.addEventListener("test",oe,oe),window.removeEventListener("test",oe,oe)}catch{X=!1}function de(s,o,d,m,v,k,T,H,te){var pe=Array.prototype.slice.call(arguments,3);try{o.apply(d,pe)}catch(Re){this.onError(Re)}}var Se=!1,je=null,$e=!1,Ye=null,Ee={onError:function(s){Se=!0,je=s}};function Ue(s,o,d,m,v,k,T,H,te){Se=!1,je=null,de.apply(Ee,arguments)}function ne(s,o,d,m,v,k,T,H,te){if(Ue.apply(this,arguments),Se){if(Se){var pe=je;Se=!1,je=null}else throw Error(n(198));$e||($e=!0,Ye=pe)}}function xe(s){var o=s,d=s;if(s.alternate)for(;o.return;)o=o.return;else{s=o;do o=s,(o.flags&4098)!==0&&(d=o.return),s=o.return;while(s)}return o.tag===3?d:null}function Ze(s){if(s.tag===13){var o=s.memoizedState;if(o===null&&(s=s.alternate,s!==null&&(o=s.memoizedState)),o!==null)return o.dehydrated}return null}function ot(s){if(xe(s)!==s)throw Error(n(188))}function It(s){var o=s.alternate;if(!o){if(o=xe(s),o===null)throw Error(n(188));return o!==s?null:s}for(var d=s,m=o;;){var v=d.return;if(v===null)break;var k=v.alternate;if(k===null){if(m=v.return,m!==null){d=m;continue}break}if(v.child===k.child){for(k=v.child;k;){if(k===d)return ot(v),s;if(k===m)return ot(v),o;k=k.sibling}throw Error(n(188))}if(d.return!==m.return)d=v,m=k;else{for(var T=!1,H=v.child;H;){if(H===d){T=!0,d=v,m=k;break}if(H===m){T=!0,m=v,d=k;break}H=H.sibling}if(!T){for(H=k.child;H;){if(H===d){T=!0,d=k,m=v;break}if(H===m){T=!0,m=k,d=v;break}H=H.sibling}if(!T)throw Error(n(189))}}if(d.alternate!==m)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?s:o}function Ct(s){return s=It(s),s!==null?Pt(s):null}function Pt(s){if(s.tag===5||s.tag===6)return s;for(s=s.child;s!==null;){var o=Pt(s);if(o!==null)return o;s=s.sibling}return null}var $t=t.unstable_scheduleCallback,me=t.unstable_cancelCallback,We=t.unstable_shouldYield,Qe=t.unstable_requestPaint,Be=t.unstable_now,Xt=t.unstable_getCurrentPriorityLevel,Ht=t.unstable_ImmediatePriority,K=t.unstable_UserBlockingPriority,Ce=t.unstable_NormalPriority,Xe=t.unstable_LowPriority,Ge=t.unstable_IdlePriority,ut=null,dn=null;function An(s){if(dn&&typeof dn.onCommitFiberRoot=="function")try{dn.onCommitFiberRoot(ut,s,void 0,(s.current.flags&128)===128)}catch{}}var j=Math.clz32?Math.clz32:Ne,se=Math.log,V=Math.LN2;function Ne(s){return s>>>=0,s===0?32:31-(se(s)/V|0)|0}var Le=64,et=4194304;function Wt(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 qt(s,o){var d=s.pendingLanes;if(d===0)return 0;var m=0,v=s.suspendedLanes,k=s.pingedLanes,T=d&268435455;if(T!==0){var H=T&~v;H!==0?m=Wt(H):(k&=T,k!==0&&(m=Wt(k)))}else T=d&~v,T!==0?m=Wt(T):k!==0&&(m=Wt(k));if(m===0)return 0;if(o!==0&&o!==m&&(o&v)===0&&(v=m&-m,k=o&-o,v>=k||v===16&&(k&4194240)!==0))return o;if((m&4)!==0&&(m|=d&16),o=s.entangledLanes,o!==0)for(s=s.entanglements,o&=m;0<o;)d=31-j(o),v=1<<d,m|=s[d],o&=~v;return m}function Xn(s,o){switch(s){case 1:case 2:case 4:return o+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 o+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 on(s,o){for(var d=s.suspendedLanes,m=s.pingedLanes,v=s.expirationTimes,k=s.pendingLanes;0<k;){var T=31-j(k),H=1<<T,te=v[T];te===-1?((H&d)===0||(H&m)!==0)&&(v[T]=Xn(H,o)):te<=o&&(s.expiredLanes|=H),k&=~H}}function Xr(s){return s=s.pendingLanes&-1073741825,s!==0?s:s&1073741824?1073741824:0}function bo(){var s=Le;return Le<<=1,(Le&4194240)===0&&(Le=64),s}function Vt(s){for(var o=[],d=0;31>d;d++)o.push(s);return o}function di(s,o,d){s.pendingLanes|=o,o!==536870912&&(s.suspendedLanes=0,s.pingedLanes=0),s=s.eventTimes,o=31-j(o),s[o]=d}function Rs(s,o){var d=s.pendingLanes&~o;s.pendingLanes=o,s.suspendedLanes=0,s.pingedLanes=0,s.expiredLanes&=o,s.mutableReadLanes&=o,s.entangledLanes&=o,o=s.entanglements;var m=s.eventTimes;for(s=s.expirationTimes;0<d;){var v=31-j(d),k=1<<v;o[v]=0,m[v]=-1,s[v]=-1,d&=~k}}function ba(s,o){var d=s.entangledLanes|=o;for(s=s.entanglements;d;){var m=31-j(d),v=1<<m;v&o|s[m]&o&&(s[m]|=o),d&=~v}}var sn=0;function Or(s){return s&=-s,1<s?4<s?(s&268435455)!==0?16:536870912:4:1}var Cn,ji,ya,Es,yo,va=!1,vo=[],Jr=null,hi=null,fi=null,As=new Map,Is=new Map,mi=[],vd="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 Gl(s,o){switch(s){case"focusin":case"focusout":Jr=null;break;case"dragenter":case"dragleave":hi=null;break;case"mouseover":case"mouseout":fi=null;break;case"pointerover":case"pointerout":As.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Is.delete(o.pointerId)}}function Ls(s,o,d,m,v,k){return s===null||s.nativeEvent!==k?(s={blockedOn:o,domEventName:d,eventSystemFlags:m,nativeEvent:k,targetContainers:[v]},o!==null&&(o=Ma(o),o!==null&&ji(o)),s):(s.eventSystemFlags|=m,o=s.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),s)}function Ni(s,o,d,m,v){switch(o){case"focusin":return Jr=Ls(Jr,s,o,d,m,v),!0;case"dragenter":return hi=Ls(hi,s,o,d,m,v),!0;case"mouseover":return fi=Ls(fi,s,o,d,m,v),!0;case"pointerover":var k=v.pointerId;return As.set(k,Ls(As.get(k)||null,s,o,d,m,v)),!0;case"gotpointercapture":return k=v.pointerId,Is.set(k,Ls(Is.get(k)||null,s,o,d,m,v)),!0}return!1}function Ms(s){var o=Bs(s.target);if(o!==null){var d=xe(o);if(d!==null){if(o=d.tag,o===13){if(o=Ze(d),o!==null){s.blockedOn=o,yo(s.priority,function(){ya(d)});return}}else if(o===3&&d.stateNode.current.memoizedState.isDehydrated){s.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Pi(s){if(s.blockedOn!==null)return!1;for(var o=s.targetContainers;0<o.length;){var d=ka(s.domEventName,s.eventSystemFlags,o[0],s.nativeEvent);if(d===null){d=s.nativeEvent;var m=new d.constructor(d.type,d);Nt=m,d.target.dispatchEvent(m),Nt=null}else return o=Ma(d),o!==null&&ji(o),s.blockedOn=d,!1;o.shift()}return!0}function wa(s,o,d){Pi(s)&&d.delete(o)}function Kl(){va=!1,Jr!==null&&Pi(Jr)&&(Jr=null),hi!==null&&Pi(hi)&&(hi=null),fi!==null&&Pi(fi)&&(fi=null),As.forEach(wa),Is.forEach(wa)}function Yi(s,o){s.blockedOn===o&&(s.blockedOn=null,va||(va=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Kl)))}function Ti(s){function o(v){return Yi(v,s)}if(0<vo.length){Yi(vo[0],s);for(var d=1;d<vo.length;d++){var m=vo[d];m.blockedOn===s&&(m.blockedOn=null)}}for(Jr!==null&&Yi(Jr,s),hi!==null&&Yi(hi,s),fi!==null&&Yi(fi,s),As.forEach(o),Is.forEach(o),d=0;d<mi.length;d++)m=mi[d],m.blockedOn===s&&(m.blockedOn=null);for(;0<mi.length&&(d=mi[0],d.blockedOn===null);)Ms(d),d.blockedOn===null&&mi.shift()}var Ri=ee.ReactCurrentBatchConfig,wo=!0;function Ql(s,o,d,m){var v=sn,k=Ri.transition;Ri.transition=null;try{sn=1,xa(s,o,d,m)}finally{sn=v,Ri.transition=k}}function xo(s,o,d,m){var v=sn,k=Ri.transition;Ri.transition=null;try{sn=4,xa(s,o,d,m)}finally{sn=v,Ri.transition=k}}function xa(s,o,d,m){if(wo){var v=ka(s,o,d,m);if(v===null)Id(s,o,m,Ds,d),Gl(s,m);else if(Ni(v,s,o,d,m))m.stopPropagation();else if(Gl(s,m),o&4&&-1<vd.indexOf(s)){for(;v!==null;){var k=Ma(v);if(k!==null&&Cn(k),k=ka(s,o,d,m),k===null&&Id(s,o,m,Ds,d),k===v)break;v=k}v!==null&&m.stopPropagation()}else Id(s,o,m,null,d)}}var Ds=null;function ka(s,o,d,m){if(Ds=null,s=Zt(m),s=Bs(s),s!==null)if(o=xe(s),o===null)s=null;else if(d=o.tag,d===13){if(s=Ze(o),s!==null)return s;s=null}else if(d===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;s=null}else o!==s&&(s=null);return Ds=s,null}function Yl(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(Xt()){case Ht:return 1;case K:return 4;case Ce:case Xe:return 16;case Ge:return 536870912;default:return 16}default:return 16}}var Zr=null,Xi=null,Fs=null;function Sa(){if(Fs)return Fs;var s,o=Xi,d=o.length,m,v="value"in Zr?Zr.value:Zr.textContent,k=v.length;for(s=0;s<d&&o[s]===v[s];s++);var T=d-s;for(m=1;m<=T&&o[d-m]===v[k-m];m++);return Fs=v.slice(s,1<m?1-m:void 0)}function _s(s){var o=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&o===13&&(s=13)):s=o,s===10&&(s=13),32<=s||s===13?s:0}function Os(){return!0}function Ca(){return!1}function U(s){function o(d,m,v,k,T){this._reactName=d,this._targetInst=v,this.type=m,this.nativeEvent=k,this.target=T,this.currentTarget=null;for(var H in s)s.hasOwnProperty(H)&&(d=s[H],this[H]=d?d(k):k[H]);return this.isDefaultPrevented=(k.defaultPrevented!=null?k.defaultPrevented:k.returnValue===!1)?Os:Ca,this.isPropagationStopped=Ca,this}return R(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=Os)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=Os)},persist:function(){},isPersistent:Os}),o}var le={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_e=U(le),tt=R({},le,{view:0,detail:0}),Yt=U(tt),bn,ir,tr,hn=R({},tt,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xd,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!==tr&&(tr&&s.type==="mousemove"?(bn=s.screenX-tr.screenX,ir=s.screenY-tr.screenY):ir=bn=0,tr=s),bn)},movementY:function(s){return"movementY"in s?s.movementY:ir}}),Gt=U(hn),Hn=R({},hn,{dataTransfer:0}),Ei=U(Hn),Rr=R({},tt,{relatedTarget:0}),Ai=U(Rr),Xl=R({},le,{animationName:0,elapsedTime:0,pseudoElement:0}),wd=U(Xl),o0=R({},le,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),a0=U(o0),l0=R({},le,{data:0}),ug=U(l0),c0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},u0={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"},d0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function h0(s){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(s):(s=d0[s])?!!o[s]:!1}function xd(){return h0}var f0=R({},tt,{key:function(s){if(s.key){var o=c0[s.key]||s.key;if(o!=="Unidentified")return o}return s.type==="keypress"?(s=_s(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?u0[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xd,charCode:function(s){return s.type==="keypress"?_s(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?_s(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),m0=U(f0),p0=R({},hn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dg=U(p0),g0=R({},tt,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xd}),b0=U(g0),y0=R({},le,{propertyName:0,elapsedTime:0,pseudoElement:0}),v0=U(y0),w0=R({},hn,{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}),x0=U(w0),k0=[9,13,27,32],kd=h&&"CompositionEvent"in window,ja=null;h&&"documentMode"in document&&(ja=document.documentMode);var S0=h&&"TextEvent"in window&&!ja,hg=h&&(!kd||ja&&8<ja&&11>=ja),fg=" ",mg=!1;function pg(s,o){switch(s){case"keyup":return k0.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function gg(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ko=!1;function C0(s,o){switch(s){case"compositionend":return gg(o);case"keypress":return o.which!==32?null:(mg=!0,fg);case"textInput":return s=o.data,s===fg&&mg?null:s;default:return null}}function j0(s,o){if(ko)return s==="compositionend"||!kd&&pg(s,o)?(s=Sa(),Fs=Xi=Zr=null,ko=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return hg&&o.locale!=="ko"?null:o.data;default:return null}}var N0={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 bg(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o==="input"?!!N0[s.type]:o==="textarea"}function yg(s,o,d,m){nn(m),o=nc(o,"onChange"),0<o.length&&(d=new _e("onChange","change",null,d,m),s.push({event:d,listeners:o}))}var Na=null,Pa=null;function P0(s){Fg(s,0)}function Jl(s){var o=Po(s);if(Ke(o))return s}function T0(s,o){if(s==="change")return o}var vg=!1;if(h){var Sd;if(h){var Cd="oninput"in document;if(!Cd){var wg=document.createElement("div");wg.setAttribute("oninput","return;"),Cd=typeof wg.oninput=="function"}Sd=Cd}else Sd=!1;vg=Sd&&(!document.documentMode||9<document.documentMode)}function xg(){Na&&(Na.detachEvent("onpropertychange",kg),Pa=Na=null)}function kg(s){if(s.propertyName==="value"&&Jl(Pa)){var o=[];yg(o,Pa,s,Zt(s)),Tn(P0,o)}}function R0(s,o,d){s==="focusin"?(xg(),Na=o,Pa=d,Na.attachEvent("onpropertychange",kg)):s==="focusout"&&xg()}function E0(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Jl(Pa)}function A0(s,o){if(s==="click")return Jl(o)}function I0(s,o){if(s==="input"||s==="change")return Jl(o)}function L0(s,o){return s===o&&(s!==0||1/s===1/o)||s!==s&&o!==o}var ei=typeof Object.is=="function"?Object.is:L0;function Ta(s,o){if(ei(s,o))return!0;if(typeof s!="object"||s===null||typeof o!="object"||o===null)return!1;var d=Object.keys(s),m=Object.keys(o);if(d.length!==m.length)return!1;for(m=0;m<d.length;m++){var v=d[m];if(!f.call(o,v)||!ei(s[v],o[v]))return!1}return!0}function Sg(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Cg(s,o){var d=Sg(s);s=0;for(var m;d;){if(d.nodeType===3){if(m=s+d.textContent.length,s<=o&&m>=o)return{node:d,offset:o-s};s=m}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=Sg(d)}}function jg(s,o){return s&&o?s===o?!0:s&&s.nodeType===3?!1:o&&o.nodeType===3?jg(s,o.parentNode):"contains"in s?s.contains(o):s.compareDocumentPosition?!!(s.compareDocumentPosition(o)&16):!1:!1}function Ng(){for(var s=window,o=jt();o instanceof s.HTMLIFrameElement;){try{var d=typeof o.contentWindow.location.href=="string"}catch{d=!1}if(d)s=o.contentWindow;else break;o=jt(s.document)}return o}function jd(s){var o=s&&s.nodeName&&s.nodeName.toLowerCase();return o&&(o==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||o==="textarea"||s.contentEditable==="true")}function M0(s){var o=Ng(),d=s.focusedElem,m=s.selectionRange;if(o!==d&&d&&d.ownerDocument&&jg(d.ownerDocument.documentElement,d)){if(m!==null&&jd(d)){if(o=m.start,s=m.end,s===void 0&&(s=o),"selectionStart"in d)d.selectionStart=o,d.selectionEnd=Math.min(s,d.value.length);else if(s=(o=d.ownerDocument||document)&&o.defaultView||window,s.getSelection){s=s.getSelection();var v=d.textContent.length,k=Math.min(m.start,v);m=m.end===void 0?k:Math.min(m.end,v),!s.extend&&k>m&&(v=m,m=k,k=v),v=Cg(d,k);var T=Cg(d,m);v&&T&&(s.rangeCount!==1||s.anchorNode!==v.node||s.anchorOffset!==v.offset||s.focusNode!==T.node||s.focusOffset!==T.offset)&&(o=o.createRange(),o.setStart(v.node,v.offset),s.removeAllRanges(),k>m?(s.addRange(o),s.extend(T.node,T.offset)):(o.setEnd(T.node,T.offset),s.addRange(o)))}}for(o=[],s=d;s=s.parentNode;)s.nodeType===1&&o.push({element:s,left:s.scrollLeft,top:s.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<o.length;d++)s=o[d],s.element.scrollLeft=s.left,s.element.scrollTop=s.top}}var D0=h&&"documentMode"in document&&11>=document.documentMode,So=null,Nd=null,Ra=null,Pd=!1;function Pg(s,o,d){var m=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Pd||So==null||So!==jt(m)||(m=So,"selectionStart"in m&&jd(m)?m={start:m.selectionStart,end:m.selectionEnd}:(m=(m.ownerDocument&&m.ownerDocument.defaultView||window).getSelection(),m={anchorNode:m.anchorNode,anchorOffset:m.anchorOffset,focusNode:m.focusNode,focusOffset:m.focusOffset}),Ra&&Ta(Ra,m)||(Ra=m,m=nc(Nd,"onSelect"),0<m.length&&(o=new _e("onSelect","select",null,o,d),s.push({event:o,listeners:m}),o.target=So)))}function Zl(s,o){var d={};return d[s.toLowerCase()]=o.toLowerCase(),d["Webkit"+s]="webkit"+o,d["Moz"+s]="moz"+o,d}var Co={animationend:Zl("Animation","AnimationEnd"),animationiteration:Zl("Animation","AnimationIteration"),animationstart:Zl("Animation","AnimationStart"),transitionend:Zl("Transition","TransitionEnd")},Td={},Tg={};h&&(Tg=document.createElement("div").style,"AnimationEvent"in window||(delete Co.animationend.animation,delete Co.animationiteration.animation,delete Co.animationstart.animation),"TransitionEvent"in window||delete Co.transitionend.transition);function ec(s){if(Td[s])return Td[s];if(!Co[s])return s;var o=Co[s],d;for(d in o)if(o.hasOwnProperty(d)&&d in Tg)return Td[s]=o[d];return s}var Rg=ec("animationend"),Eg=ec("animationiteration"),Ag=ec("animationstart"),Ig=ec("transitionend"),Lg=new Map,Mg="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 Ji(s,o){Lg.set(s,o),c(o,[s])}for(var Rd=0;Rd<Mg.length;Rd++){var Ed=Mg[Rd],F0=Ed.toLowerCase(),_0=Ed[0].toUpperCase()+Ed.slice(1);Ji(F0,"on"+_0)}Ji(Rg,"onAnimationEnd"),Ji(Eg,"onAnimationIteration"),Ji(Ag,"onAnimationStart"),Ji("dblclick","onDoubleClick"),Ji("focusin","onFocus"),Ji("focusout","onBlur"),Ji(Ig,"onTransitionEnd"),l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ea="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),O0=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ea));function Dg(s,o,d){var m=s.type||"unknown-event";s.currentTarget=d,ne(m,o,void 0,s),s.currentTarget=null}function Fg(s,o){o=(o&4)!==0;for(var d=0;d<s.length;d++){var m=s[d],v=m.event;m=m.listeners;e:{var k=void 0;if(o)for(var T=m.length-1;0<=T;T--){var H=m[T],te=H.instance,pe=H.currentTarget;if(H=H.listener,te!==k&&v.isPropagationStopped())break e;Dg(v,H,pe),k=te}else for(T=0;T<m.length;T++){if(H=m[T],te=H.instance,pe=H.currentTarget,H=H.listener,te!==k&&v.isPropagationStopped())break e;Dg(v,H,pe),k=te}}}if($e)throw s=Ye,$e=!1,Ye=null,s}function yn(s,o){var d=o[Od];d===void 0&&(d=o[Od]=new Set);var m=s+"__bubble";d.has(m)||(_g(o,s,2,!1),d.add(m))}function Ad(s,o,d){var m=0;o&&(m|=4),_g(d,s,m,o)}var tc="_reactListening"+Math.random().toString(36).slice(2);function Aa(s){if(!s[tc]){s[tc]=!0,i.forEach(function(d){d!=="selectionchange"&&(O0.has(d)||Ad(d,!1,s),Ad(d,!0,s))});var o=s.nodeType===9?s:s.ownerDocument;o===null||o[tc]||(o[tc]=!0,Ad("selectionchange",!1,o))}}function _g(s,o,d,m){switch(Yl(o)){case 1:var v=Ql;break;case 4:v=xo;break;default:v=xa}d=v.bind(null,o,d,s),v=void 0,!X||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),m?v!==void 0?s.addEventListener(o,d,{capture:!0,passive:v}):s.addEventListener(o,d,!0):v!==void 0?s.addEventListener(o,d,{passive:v}):s.addEventListener(o,d,!1)}function Id(s,o,d,m,v){var k=m;if((o&1)===0&&(o&2)===0&&m!==null)e:for(;;){if(m===null)return;var T=m.tag;if(T===3||T===4){var H=m.stateNode.containerInfo;if(H===v||H.nodeType===8&&H.parentNode===v)break;if(T===4)for(T=m.return;T!==null;){var te=T.tag;if((te===3||te===4)&&(te=T.stateNode.containerInfo,te===v||te.nodeType===8&&te.parentNode===v))return;T=T.return}for(;H!==null;){if(T=Bs(H),T===null)return;if(te=T.tag,te===5||te===6){m=k=T;continue e}H=H.parentNode}}m=m.return}Tn(function(){var pe=k,Re=Zt(d),Ae=[];e:{var Pe=Lg.get(s);if(Pe!==void 0){var Je=_e,at=s;switch(s){case"keypress":if(_s(d)===0)break e;case"keydown":case"keyup":Je=m0;break;case"focusin":at="focus",Je=Ai;break;case"focusout":at="blur",Je=Ai;break;case"beforeblur":case"afterblur":Je=Ai;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Je=Gt;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Je=Ei;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Je=b0;break;case Rg:case Eg:case Ag:Je=wd;break;case Ig:Je=v0;break;case"scroll":Je=Yt;break;case"wheel":Je=x0;break;case"copy":case"cut":case"paste":Je=a0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Je=dg}var ht=(o&4)!==0,In=!ht&&s==="scroll",ue=ht?Pe!==null?Pe+"Capture":null:Pe;ht=[];for(var ae=pe,he;ae!==null;){he=ae;var Oe=he.stateNode;if(he.tag===5&&Oe!==null&&(he=Oe,ue!==null&&(Oe=un(ae,ue),Oe!=null&&ht.push(Ia(ae,Oe,he)))),In)break;ae=ae.return}0<ht.length&&(Pe=new Je(Pe,at,null,d,Re),Ae.push({event:Pe,listeners:ht}))}}if((o&7)===0){e:{if(Pe=s==="mouseover"||s==="pointerover",Je=s==="mouseout"||s==="pointerout",Pe&&d!==Nt&&(at=d.relatedTarget||d.fromElement)&&(Bs(at)||at[Ii]))break e;if((Je||Pe)&&(Pe=Re.window===Re?Re:(Pe=Re.ownerDocument)?Pe.defaultView||Pe.parentWindow:window,Je?(at=d.relatedTarget||d.toElement,Je=pe,at=at?Bs(at):null,at!==null&&(In=xe(at),at!==In||at.tag!==5&&at.tag!==6)&&(at=null)):(Je=null,at=pe),Je!==at)){if(ht=Gt,Oe="onMouseLeave",ue="onMouseEnter",ae="mouse",(s==="pointerout"||s==="pointerover")&&(ht=dg,Oe="onPointerLeave",ue="onPointerEnter",ae="pointer"),In=Je==null?Pe:Po(Je),he=at==null?Pe:Po(at),Pe=new ht(Oe,ae+"leave",Je,d,Re),Pe.target=In,Pe.relatedTarget=he,Oe=null,Bs(Re)===pe&&(ht=new ht(ue,ae+"enter",at,d,Re),ht.target=he,ht.relatedTarget=In,Oe=ht),In=Oe,Je&&at)t:{for(ht=Je,ue=at,ae=0,he=ht;he;he=jo(he))ae++;for(he=0,Oe=ue;Oe;Oe=jo(Oe))he++;for(;0<ae-he;)ht=jo(ht),ae--;for(;0<he-ae;)ue=jo(ue),he--;for(;ae--;){if(ht===ue||ue!==null&&ht===ue.alternate)break t;ht=jo(ht),ue=jo(ue)}ht=null}else ht=null;Je!==null&&Og(Ae,Pe,Je,ht,!1),at!==null&&In!==null&&Og(Ae,In,at,ht,!0)}}e:{if(Pe=pe?Po(pe):window,Je=Pe.nodeName&&Pe.nodeName.toLowerCase(),Je==="select"||Je==="input"&&Pe.type==="file")var bt=T0;else if(bg(Pe))if(vg)bt=I0;else{bt=E0;var Tt=R0}else(Je=Pe.nodeName)&&Je.toLowerCase()==="input"&&(Pe.type==="checkbox"||Pe.type==="radio")&&(bt=A0);if(bt&&(bt=bt(s,pe))){yg(Ae,bt,d,Re);break e}Tt&&Tt(s,Pe,pe),s==="focusout"&&(Tt=Pe._wrapperState)&&Tt.controlled&&Pe.type==="number"&&ye(Pe,"number",Pe.value)}switch(Tt=pe?Po(pe):window,s){case"focusin":(bg(Tt)||Tt.contentEditable==="true")&&(So=Tt,Nd=pe,Ra=null);break;case"focusout":Ra=Nd=So=null;break;case"mousedown":Pd=!0;break;case"contextmenu":case"mouseup":case"dragend":Pd=!1,Pg(Ae,d,Re);break;case"selectionchange":if(D0)break;case"keydown":case"keyup":Pg(Ae,d,Re)}var Rt;if(kd)e:{switch(s){case"compositionstart":var Ft="onCompositionStart";break e;case"compositionend":Ft="onCompositionEnd";break e;case"compositionupdate":Ft="onCompositionUpdate";break e}Ft=void 0}else ko?pg(s,d)&&(Ft="onCompositionEnd"):s==="keydown"&&d.keyCode===229&&(Ft="onCompositionStart");Ft&&(hg&&d.locale!=="ko"&&(ko||Ft!=="onCompositionStart"?Ft==="onCompositionEnd"&&ko&&(Rt=Sa()):(Zr=Re,Xi="value"in Zr?Zr.value:Zr.textContent,ko=!0)),Tt=nc(pe,Ft),0<Tt.length&&(Ft=new ug(Ft,s,null,d,Re),Ae.push({event:Ft,listeners:Tt}),Rt?Ft.data=Rt:(Rt=gg(d),Rt!==null&&(Ft.data=Rt)))),(Rt=S0?C0(s,d):j0(s,d))&&(pe=nc(pe,"onBeforeInput"),0<pe.length&&(Re=new ug("onBeforeInput","beforeinput",null,d,Re),Ae.push({event:Re,listeners:pe}),Re.data=Rt))}Fg(Ae,o)})}function Ia(s,o,d){return{instance:s,listener:o,currentTarget:d}}function nc(s,o){for(var d=o+"Capture",m=[];s!==null;){var v=s,k=v.stateNode;v.tag===5&&k!==null&&(v=k,k=un(s,d),k!=null&&m.unshift(Ia(s,k,v)),k=un(s,o),k!=null&&m.push(Ia(s,k,v))),s=s.return}return m}function jo(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5);return s||null}function Og(s,o,d,m,v){for(var k=o._reactName,T=[];d!==null&&d!==m;){var H=d,te=H.alternate,pe=H.stateNode;if(te!==null&&te===m)break;H.tag===5&&pe!==null&&(H=pe,v?(te=un(d,k),te!=null&&T.unshift(Ia(d,te,H))):v||(te=un(d,k),te!=null&&T.push(Ia(d,te,H)))),d=d.return}T.length!==0&&s.push({event:o,listeners:T})}var B0=/\r\n?/g,U0=/\u0000|\uFFFD/g;function Bg(s){return(typeof s=="string"?s:""+s).replace(B0,`
39
+ `).replace(U0,"")}function rc(s,o,d){if(o=Bg(o),Bg(s)!==o&&d)throw Error(n(425))}function ic(){}var Ld=null,Md=null;function Dd(s,o){return s==="textarea"||s==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var Fd=typeof setTimeout=="function"?setTimeout:void 0,W0=typeof clearTimeout=="function"?clearTimeout:void 0,Ug=typeof Promise=="function"?Promise:void 0,z0=typeof queueMicrotask=="function"?queueMicrotask:typeof Ug<"u"?function(s){return Ug.resolve(null).then(s).catch(H0)}:Fd;function H0(s){setTimeout(function(){throw s})}function _d(s,o){var d=o,m=0;do{var v=d.nextSibling;if(s.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"){if(m===0){s.removeChild(v),Ti(o);return}m--}else d!=="$"&&d!=="$?"&&d!=="$!"||m++;d=v}while(d);Ti(o)}function Zi(s){for(;s!=null;s=s.nextSibling){var o=s.nodeType;if(o===1||o===3)break;if(o===8){if(o=s.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return s}function Wg(s){s=s.previousSibling;for(var o=0;s;){if(s.nodeType===8){var d=s.data;if(d==="$"||d==="$!"||d==="$?"){if(o===0)return s;o--}else d==="/$"&&o++}s=s.previousSibling}return null}var No=Math.random().toString(36).slice(2),pi="__reactFiber$"+No,La="__reactProps$"+No,Ii="__reactContainer$"+No,Od="__reactEvents$"+No,q0="__reactListeners$"+No,$0="__reactHandles$"+No;function Bs(s){var o=s[pi];if(o)return o;for(var d=s.parentNode;d;){if(o=d[Ii]||d[pi]){if(d=o.alternate,o.child!==null||d!==null&&d.child!==null)for(s=Wg(s);s!==null;){if(d=s[pi])return d;s=Wg(s)}return o}s=d,d=s.parentNode}return null}function Ma(s){return s=s[pi]||s[Ii],!s||s.tag!==5&&s.tag!==6&&s.tag!==13&&s.tag!==3?null:s}function Po(s){if(s.tag===5||s.tag===6)return s.stateNode;throw Error(n(33))}function sc(s){return s[La]||null}var Bd=[],To=-1;function es(s){return{current:s}}function vn(s){0>To||(s.current=Bd[To],Bd[To]=null,To--)}function pn(s,o){To++,Bd[To]=s.current,s.current=o}var ts={},sr=es(ts),gr=es(!1),Us=ts;function Ro(s,o){var d=s.type.contextTypes;if(!d)return ts;var m=s.stateNode;if(m&&m.__reactInternalMemoizedUnmaskedChildContext===o)return m.__reactInternalMemoizedMaskedChildContext;var v={},k;for(k in d)v[k]=o[k];return m&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=o,s.__reactInternalMemoizedMaskedChildContext=v),v}function br(s){return s=s.childContextTypes,s!=null}function oc(){vn(gr),vn(sr)}function zg(s,o,d){if(sr.current!==ts)throw Error(n(168));pn(sr,o),pn(gr,d)}function Hg(s,o,d){var m=s.stateNode;if(o=o.childContextTypes,typeof m.getChildContext!="function")return d;m=m.getChildContext();for(var v in m)if(!(v in o))throw Error(n(108,Ve(s)||"Unknown",v));return R({},d,m)}function ac(s){return s=(s=s.stateNode)&&s.__reactInternalMemoizedMergedChildContext||ts,Us=sr.current,pn(sr,s),pn(gr,gr.current),!0}function qg(s,o,d){var m=s.stateNode;if(!m)throw Error(n(169));d?(s=Hg(s,o,Us),m.__reactInternalMemoizedMergedChildContext=s,vn(gr),vn(sr),pn(sr,s)):vn(gr),pn(gr,d)}var Li=null,lc=!1,Ud=!1;function $g(s){Li===null?Li=[s]:Li.push(s)}function V0(s){lc=!0,$g(s)}function ns(){if(!Ud&&Li!==null){Ud=!0;var s=0,o=sn;try{var d=Li;for(sn=1;s<d.length;s++){var m=d[s];do m=m(!0);while(m!==null)}Li=null,lc=!1}catch(v){throw Li!==null&&(Li=Li.slice(s+1)),$t(Ht,ns),v}finally{sn=o,Ud=!1}}return null}var Eo=[],Ao=0,cc=null,uc=0,Br=[],Ur=0,Ws=null,Mi=1,Di="";function zs(s,o){Eo[Ao++]=uc,Eo[Ao++]=cc,cc=s,uc=o}function Vg(s,o,d){Br[Ur++]=Mi,Br[Ur++]=Di,Br[Ur++]=Ws,Ws=s;var m=Mi;s=Di;var v=32-j(m)-1;m&=~(1<<v),d+=1;var k=32-j(o)+v;if(30<k){var T=v-v%5;k=(m&(1<<T)-1).toString(32),m>>=T,v-=T,Mi=1<<32-j(o)+v|d<<v|m,Di=k+s}else Mi=1<<k|d<<v|m,Di=s}function Wd(s){s.return!==null&&(zs(s,1),Vg(s,1,0))}function zd(s){for(;s===cc;)cc=Eo[--Ao],Eo[Ao]=null,uc=Eo[--Ao],Eo[Ao]=null;for(;s===Ws;)Ws=Br[--Ur],Br[Ur]=null,Di=Br[--Ur],Br[Ur]=null,Mi=Br[--Ur],Br[Ur]=null}var Er=null,Ar=null,wn=!1,ti=null;function Gg(s,o){var d=qr(5,null,null,0);d.elementType="DELETED",d.stateNode=o,d.return=s,o=s.deletions,o===null?(s.deletions=[d],s.flags|=16):o.push(d)}function Kg(s,o){switch(s.tag){case 5:var d=s.type;return o=o.nodeType!==1||d.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(s.stateNode=o,Er=s,Ar=Zi(o.firstChild),!0):!1;case 6:return o=s.pendingProps===""||o.nodeType!==3?null:o,o!==null?(s.stateNode=o,Er=s,Ar=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(d=Ws!==null?{id:Mi,overflow:Di}:null,s.memoizedState={dehydrated:o,treeContext:d,retryLane:1073741824},d=qr(18,null,null,0),d.stateNode=o,d.return=s,s.child=d,Er=s,Ar=null,!0):!1;default:return!1}}function Hd(s){return(s.mode&1)!==0&&(s.flags&128)===0}function qd(s){if(wn){var o=Ar;if(o){var d=o;if(!Kg(s,o)){if(Hd(s))throw Error(n(418));o=Zi(d.nextSibling);var m=Er;o&&Kg(s,o)?Gg(m,d):(s.flags=s.flags&-4097|2,wn=!1,Er=s)}}else{if(Hd(s))throw Error(n(418));s.flags=s.flags&-4097|2,wn=!1,Er=s}}}function Qg(s){for(s=s.return;s!==null&&s.tag!==5&&s.tag!==3&&s.tag!==13;)s=s.return;Er=s}function dc(s){if(s!==Er)return!1;if(!wn)return Qg(s),wn=!0,!1;var o;if((o=s.tag!==3)&&!(o=s.tag!==5)&&(o=s.type,o=o!=="head"&&o!=="body"&&!Dd(s.type,s.memoizedProps)),o&&(o=Ar)){if(Hd(s))throw Yg(),Error(n(418));for(;o;)Gg(s,o),o=Zi(o.nextSibling)}if(Qg(s),s.tag===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));e:{for(s=s.nextSibling,o=0;s;){if(s.nodeType===8){var d=s.data;if(d==="/$"){if(o===0){Ar=Zi(s.nextSibling);break e}o--}else d!=="$"&&d!=="$!"&&d!=="$?"||o++}s=s.nextSibling}Ar=null}}else Ar=Er?Zi(s.stateNode.nextSibling):null;return!0}function Yg(){for(var s=Ar;s;)s=Zi(s.nextSibling)}function Io(){Ar=Er=null,wn=!1}function $d(s){ti===null?ti=[s]:ti.push(s)}var G0=ee.ReactCurrentBatchConfig;function Da(s,o,d){if(s=d.ref,s!==null&&typeof s!="function"&&typeof s!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var m=d.stateNode}if(!m)throw Error(n(147,s));var v=m,k=""+s;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===k?o.ref:(o=function(T){var H=v.refs;T===null?delete H[k]:H[k]=T},o._stringRef=k,o)}if(typeof s!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,s))}return s}function hc(s,o){throw s=Object.prototype.toString.call(o),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":s))}function Xg(s){var o=s._init;return o(s._payload)}function Jg(s){function o(ue,ae){if(s){var he=ue.deletions;he===null?(ue.deletions=[ae],ue.flags|=16):he.push(ae)}}function d(ue,ae){if(!s)return null;for(;ae!==null;)o(ue,ae),ae=ae.sibling;return null}function m(ue,ae){for(ue=new Map;ae!==null;)ae.key!==null?ue.set(ae.key,ae):ue.set(ae.index,ae),ae=ae.sibling;return ue}function v(ue,ae){return ue=us(ue,ae),ue.index=0,ue.sibling=null,ue}function k(ue,ae,he){return ue.index=he,s?(he=ue.alternate,he!==null?(he=he.index,he<ae?(ue.flags|=2,ae):he):(ue.flags|=2,ae)):(ue.flags|=1048576,ae)}function T(ue){return s&&ue.alternate===null&&(ue.flags|=2),ue}function H(ue,ae,he,Oe){return ae===null||ae.tag!==6?(ae=Fh(he,ue.mode,Oe),ae.return=ue,ae):(ae=v(ae,he),ae.return=ue,ae)}function te(ue,ae,he,Oe){var bt=he.type;return bt===E?Re(ue,ae,he.props.children,Oe,he.key):ae!==null&&(ae.elementType===bt||typeof bt=="object"&&bt!==null&&bt.$$typeof===Y&&Xg(bt)===ae.type)?(Oe=v(ae,he.props),Oe.ref=Da(ue,ae,he),Oe.return=ue,Oe):(Oe=Fc(he.type,he.key,he.props,null,ue.mode,Oe),Oe.ref=Da(ue,ae,he),Oe.return=ue,Oe)}function pe(ue,ae,he,Oe){return ae===null||ae.tag!==4||ae.stateNode.containerInfo!==he.containerInfo||ae.stateNode.implementation!==he.implementation?(ae=_h(he,ue.mode,Oe),ae.return=ue,ae):(ae=v(ae,he.children||[]),ae.return=ue,ae)}function Re(ue,ae,he,Oe,bt){return ae===null||ae.tag!==7?(ae=Ys(he,ue.mode,Oe,bt),ae.return=ue,ae):(ae=v(ae,he),ae.return=ue,ae)}function Ae(ue,ae,he){if(typeof ae=="string"&&ae!==""||typeof ae=="number")return ae=Fh(""+ae,ue.mode,he),ae.return=ue,ae;if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case q:return he=Fc(ae.type,ae.key,ae.props,null,ue.mode,he),he.ref=Da(ue,null,ae),he.return=ue,he;case _:return ae=_h(ae,ue.mode,he),ae.return=ue,ae;case Y:var Oe=ae._init;return Ae(ue,Oe(ae._payload),he)}if(Fe(ae)||re(ae))return ae=Ys(ae,ue.mode,he,null),ae.return=ue,ae;hc(ue,ae)}return null}function Pe(ue,ae,he,Oe){var bt=ae!==null?ae.key:null;if(typeof he=="string"&&he!==""||typeof he=="number")return bt!==null?null:H(ue,ae,""+he,Oe);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case q:return he.key===bt?te(ue,ae,he,Oe):null;case _:return he.key===bt?pe(ue,ae,he,Oe):null;case Y:return bt=he._init,Pe(ue,ae,bt(he._payload),Oe)}if(Fe(he)||re(he))return bt!==null?null:Re(ue,ae,he,Oe,null);hc(ue,he)}return null}function Je(ue,ae,he,Oe,bt){if(typeof Oe=="string"&&Oe!==""||typeof Oe=="number")return ue=ue.get(he)||null,H(ae,ue,""+Oe,bt);if(typeof Oe=="object"&&Oe!==null){switch(Oe.$$typeof){case q:return ue=ue.get(Oe.key===null?he:Oe.key)||null,te(ae,ue,Oe,bt);case _:return ue=ue.get(Oe.key===null?he:Oe.key)||null,pe(ae,ue,Oe,bt);case Y:var Tt=Oe._init;return Je(ue,ae,he,Tt(Oe._payload),bt)}if(Fe(Oe)||re(Oe))return ue=ue.get(he)||null,Re(ae,ue,Oe,bt,null);hc(ae,Oe)}return null}function at(ue,ae,he,Oe){for(var bt=null,Tt=null,Rt=ae,Ft=ae=0,er=null;Rt!==null&&Ft<he.length;Ft++){Rt.index>Ft?(er=Rt,Rt=null):er=Rt.sibling;var cn=Pe(ue,Rt,he[Ft],Oe);if(cn===null){Rt===null&&(Rt=er);break}s&&Rt&&cn.alternate===null&&o(ue,Rt),ae=k(cn,ae,Ft),Tt===null?bt=cn:Tt.sibling=cn,Tt=cn,Rt=er}if(Ft===he.length)return d(ue,Rt),wn&&zs(ue,Ft),bt;if(Rt===null){for(;Ft<he.length;Ft++)Rt=Ae(ue,he[Ft],Oe),Rt!==null&&(ae=k(Rt,ae,Ft),Tt===null?bt=Rt:Tt.sibling=Rt,Tt=Rt);return wn&&zs(ue,Ft),bt}for(Rt=m(ue,Rt);Ft<he.length;Ft++)er=Je(Rt,ue,Ft,he[Ft],Oe),er!==null&&(s&&er.alternate!==null&&Rt.delete(er.key===null?Ft:er.key),ae=k(er,ae,Ft),Tt===null?bt=er:Tt.sibling=er,Tt=er);return s&&Rt.forEach(function(ds){return o(ue,ds)}),wn&&zs(ue,Ft),bt}function ht(ue,ae,he,Oe){var bt=re(he);if(typeof bt!="function")throw Error(n(150));if(he=bt.call(he),he==null)throw Error(n(151));for(var Tt=bt=null,Rt=ae,Ft=ae=0,er=null,cn=he.next();Rt!==null&&!cn.done;Ft++,cn=he.next()){Rt.index>Ft?(er=Rt,Rt=null):er=Rt.sibling;var ds=Pe(ue,Rt,cn.value,Oe);if(ds===null){Rt===null&&(Rt=er);break}s&&Rt&&ds.alternate===null&&o(ue,Rt),ae=k(ds,ae,Ft),Tt===null?bt=ds:Tt.sibling=ds,Tt=ds,Rt=er}if(cn.done)return d(ue,Rt),wn&&zs(ue,Ft),bt;if(Rt===null){for(;!cn.done;Ft++,cn=he.next())cn=Ae(ue,cn.value,Oe),cn!==null&&(ae=k(cn,ae,Ft),Tt===null?bt=cn:Tt.sibling=cn,Tt=cn);return wn&&zs(ue,Ft),bt}for(Rt=m(ue,Rt);!cn.done;Ft++,cn=he.next())cn=Je(Rt,ue,Ft,cn.value,Oe),cn!==null&&(s&&cn.alternate!==null&&Rt.delete(cn.key===null?Ft:cn.key),ae=k(cn,ae,Ft),Tt===null?bt=cn:Tt.sibling=cn,Tt=cn);return s&&Rt.forEach(function(NP){return o(ue,NP)}),wn&&zs(ue,Ft),bt}function In(ue,ae,he,Oe){if(typeof he=="object"&&he!==null&&he.type===E&&he.key===null&&(he=he.props.children),typeof he=="object"&&he!==null){switch(he.$$typeof){case q:e:{for(var bt=he.key,Tt=ae;Tt!==null;){if(Tt.key===bt){if(bt=he.type,bt===E){if(Tt.tag===7){d(ue,Tt.sibling),ae=v(Tt,he.props.children),ae.return=ue,ue=ae;break e}}else if(Tt.elementType===bt||typeof bt=="object"&&bt!==null&&bt.$$typeof===Y&&Xg(bt)===Tt.type){d(ue,Tt.sibling),ae=v(Tt,he.props),ae.ref=Da(ue,Tt,he),ae.return=ue,ue=ae;break e}d(ue,Tt);break}else o(ue,Tt);Tt=Tt.sibling}he.type===E?(ae=Ys(he.props.children,ue.mode,Oe,he.key),ae.return=ue,ue=ae):(Oe=Fc(he.type,he.key,he.props,null,ue.mode,Oe),Oe.ref=Da(ue,ae,he),Oe.return=ue,ue=Oe)}return T(ue);case _:e:{for(Tt=he.key;ae!==null;){if(ae.key===Tt)if(ae.tag===4&&ae.stateNode.containerInfo===he.containerInfo&&ae.stateNode.implementation===he.implementation){d(ue,ae.sibling),ae=v(ae,he.children||[]),ae.return=ue,ue=ae;break e}else{d(ue,ae);break}else o(ue,ae);ae=ae.sibling}ae=_h(he,ue.mode,Oe),ae.return=ue,ue=ae}return T(ue);case Y:return Tt=he._init,In(ue,ae,Tt(he._payload),Oe)}if(Fe(he))return at(ue,ae,he,Oe);if(re(he))return ht(ue,ae,he,Oe);hc(ue,he)}return typeof he=="string"&&he!==""||typeof he=="number"?(he=""+he,ae!==null&&ae.tag===6?(d(ue,ae.sibling),ae=v(ae,he),ae.return=ue,ue=ae):(d(ue,ae),ae=Fh(he,ue.mode,Oe),ae.return=ue,ue=ae),T(ue)):d(ue,ae)}return In}var Lo=Jg(!0),Zg=Jg(!1),fc=es(null),mc=null,Mo=null,Vd=null;function Gd(){Vd=Mo=mc=null}function Kd(s){var o=fc.current;vn(fc),s._currentValue=o}function Qd(s,o,d){for(;s!==null;){var m=s.alternate;if((s.childLanes&o)!==o?(s.childLanes|=o,m!==null&&(m.childLanes|=o)):m!==null&&(m.childLanes&o)!==o&&(m.childLanes|=o),s===d)break;s=s.return}}function Do(s,o){mc=s,Vd=Mo=null,s=s.dependencies,s!==null&&s.firstContext!==null&&((s.lanes&o)!==0&&(yr=!0),s.firstContext=null)}function Wr(s){var o=s._currentValue;if(Vd!==s)if(s={context:s,memoizedValue:o,next:null},Mo===null){if(mc===null)throw Error(n(308));Mo=s,mc.dependencies={lanes:0,firstContext:s}}else Mo=Mo.next=s;return o}var Hs=null;function Yd(s){Hs===null?Hs=[s]:Hs.push(s)}function eb(s,o,d,m){var v=o.interleaved;return v===null?(d.next=d,Yd(o)):(d.next=v.next,v.next=d),o.interleaved=d,Fi(s,m)}function Fi(s,o){s.lanes|=o;var d=s.alternate;for(d!==null&&(d.lanes|=o),d=s,s=s.return;s!==null;)s.childLanes|=o,d=s.alternate,d!==null&&(d.childLanes|=o),d=s,s=s.return;return d.tag===3?d.stateNode:null}var rs=!1;function Xd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function tb(s,o){s=s.updateQueue,o.updateQueue===s&&(o.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,effects:s.effects})}function _i(s,o){return{eventTime:s,lane:o,tag:0,payload:null,callback:null,next:null}}function is(s,o,d){var m=s.updateQueue;if(m===null)return null;if(m=m.shared,(ln&2)!==0){var v=m.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),m.pending=o,Fi(s,d)}return v=m.interleaved,v===null?(o.next=o,Yd(m)):(o.next=v.next,v.next=o),m.interleaved=o,Fi(s,d)}function pc(s,o,d){if(o=o.updateQueue,o!==null&&(o=o.shared,(d&4194240)!==0)){var m=o.lanes;m&=s.pendingLanes,d|=m,o.lanes=d,ba(s,d)}}function nb(s,o){var d=s.updateQueue,m=s.alternate;if(m!==null&&(m=m.updateQueue,d===m)){var v=null,k=null;if(d=d.firstBaseUpdate,d!==null){do{var T={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};k===null?v=k=T:k=k.next=T,d=d.next}while(d!==null);k===null?v=k=o:k=k.next=o}else v=k=o;d={baseState:m.baseState,firstBaseUpdate:v,lastBaseUpdate:k,shared:m.shared,effects:m.effects},s.updateQueue=d;return}s=d.lastBaseUpdate,s===null?d.firstBaseUpdate=o:s.next=o,d.lastBaseUpdate=o}function gc(s,o,d,m){var v=s.updateQueue;rs=!1;var k=v.firstBaseUpdate,T=v.lastBaseUpdate,H=v.shared.pending;if(H!==null){v.shared.pending=null;var te=H,pe=te.next;te.next=null,T===null?k=pe:T.next=pe,T=te;var Re=s.alternate;Re!==null&&(Re=Re.updateQueue,H=Re.lastBaseUpdate,H!==T&&(H===null?Re.firstBaseUpdate=pe:H.next=pe,Re.lastBaseUpdate=te))}if(k!==null){var Ae=v.baseState;T=0,Re=pe=te=null,H=k;do{var Pe=H.lane,Je=H.eventTime;if((m&Pe)===Pe){Re!==null&&(Re=Re.next={eventTime:Je,lane:0,tag:H.tag,payload:H.payload,callback:H.callback,next:null});e:{var at=s,ht=H;switch(Pe=o,Je=d,ht.tag){case 1:if(at=ht.payload,typeof at=="function"){Ae=at.call(Je,Ae,Pe);break e}Ae=at;break e;case 3:at.flags=at.flags&-65537|128;case 0:if(at=ht.payload,Pe=typeof at=="function"?at.call(Je,Ae,Pe):at,Pe==null)break e;Ae=R({},Ae,Pe);break e;case 2:rs=!0}}H.callback!==null&&H.lane!==0&&(s.flags|=64,Pe=v.effects,Pe===null?v.effects=[H]:Pe.push(H))}else Je={eventTime:Je,lane:Pe,tag:H.tag,payload:H.payload,callback:H.callback,next:null},Re===null?(pe=Re=Je,te=Ae):Re=Re.next=Je,T|=Pe;if(H=H.next,H===null){if(H=v.shared.pending,H===null)break;Pe=H,H=Pe.next,Pe.next=null,v.lastBaseUpdate=Pe,v.shared.pending=null}}while(!0);if(Re===null&&(te=Ae),v.baseState=te,v.firstBaseUpdate=pe,v.lastBaseUpdate=Re,o=v.shared.interleaved,o!==null){v=o;do T|=v.lane,v=v.next;while(v!==o)}else k===null&&(v.shared.lanes=0);Vs|=T,s.lanes=T,s.memoizedState=Ae}}function rb(s,o,d){if(s=o.effects,o.effects=null,s!==null)for(o=0;o<s.length;o++){var m=s[o],v=m.callback;if(v!==null){if(m.callback=null,m=d,typeof v!="function")throw Error(n(191,v));v.call(m)}}}var Fa={},gi=es(Fa),_a=es(Fa),Oa=es(Fa);function qs(s){if(s===Fa)throw Error(n(174));return s}function Jd(s,o){switch(pn(Oa,o),pn(_a,s),pn(gi,Fa),s=o.nodeType,s){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:ge(null,"");break;default:s=s===8?o.parentNode:o,o=s.namespaceURI||null,s=s.tagName,o=ge(o,s)}vn(gi),pn(gi,o)}function Fo(){vn(gi),vn(_a),vn(Oa)}function ib(s){qs(Oa.current);var o=qs(gi.current),d=ge(o,s.type);o!==d&&(pn(_a,s),pn(gi,d))}function Zd(s){_a.current===s&&(vn(gi),vn(_a))}var jn=es(0);function bc(s){for(var o=s;o!==null;){if(o.tag===13){var d=o.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var eh=[];function th(){for(var s=0;s<eh.length;s++)eh[s]._workInProgressVersionPrimary=null;eh.length=0}var yc=ee.ReactCurrentDispatcher,nh=ee.ReactCurrentBatchConfig,$s=0,Nn=null,qn=null,Jn=null,vc=!1,Ba=!1,Ua=0,K0=0;function or(){throw Error(n(321))}function rh(s,o){if(o===null)return!1;for(var d=0;d<o.length&&d<s.length;d++)if(!ei(s[d],o[d]))return!1;return!0}function ih(s,o,d,m,v,k){if($s=k,Nn=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,yc.current=s===null||s.memoizedState===null?J0:Z0,s=d(m,v),Ba){k=0;do{if(Ba=!1,Ua=0,25<=k)throw Error(n(301));k+=1,Jn=qn=null,o.updateQueue=null,yc.current=eP,s=d(m,v)}while(Ba)}if(yc.current=kc,o=qn!==null&&qn.next!==null,$s=0,Jn=qn=Nn=null,vc=!1,o)throw Error(n(300));return s}function sh(){var s=Ua!==0;return Ua=0,s}function bi(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jn===null?Nn.memoizedState=Jn=s:Jn=Jn.next=s,Jn}function zr(){if(qn===null){var s=Nn.alternate;s=s!==null?s.memoizedState:null}else s=qn.next;var o=Jn===null?Nn.memoizedState:Jn.next;if(o!==null)Jn=o,qn=s;else{if(s===null)throw Error(n(310));qn=s,s={memoizedState:qn.memoizedState,baseState:qn.baseState,baseQueue:qn.baseQueue,queue:qn.queue,next:null},Jn===null?Nn.memoizedState=Jn=s:Jn=Jn.next=s}return Jn}function Wa(s,o){return typeof o=="function"?o(s):o}function oh(s){var o=zr(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=s;var m=qn,v=m.baseQueue,k=d.pending;if(k!==null){if(v!==null){var T=v.next;v.next=k.next,k.next=T}m.baseQueue=v=k,d.pending=null}if(v!==null){k=v.next,m=m.baseState;var H=T=null,te=null,pe=k;do{var Re=pe.lane;if(($s&Re)===Re)te!==null&&(te=te.next={lane:0,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null}),m=pe.hasEagerState?pe.eagerState:s(m,pe.action);else{var Ae={lane:Re,action:pe.action,hasEagerState:pe.hasEagerState,eagerState:pe.eagerState,next:null};te===null?(H=te=Ae,T=m):te=te.next=Ae,Nn.lanes|=Re,Vs|=Re}pe=pe.next}while(pe!==null&&pe!==k);te===null?T=m:te.next=H,ei(m,o.memoizedState)||(yr=!0),o.memoizedState=m,o.baseState=T,o.baseQueue=te,d.lastRenderedState=m}if(s=d.interleaved,s!==null){v=s;do k=v.lane,Nn.lanes|=k,Vs|=k,v=v.next;while(v!==s)}else v===null&&(d.lanes=0);return[o.memoizedState,d.dispatch]}function ah(s){var o=zr(),d=o.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=s;var m=d.dispatch,v=d.pending,k=o.memoizedState;if(v!==null){d.pending=null;var T=v=v.next;do k=s(k,T.action),T=T.next;while(T!==v);ei(k,o.memoizedState)||(yr=!0),o.memoizedState=k,o.baseQueue===null&&(o.baseState=k),d.lastRenderedState=k}return[k,m]}function sb(){}function ob(s,o){var d=Nn,m=zr(),v=o(),k=!ei(m.memoizedState,v);if(k&&(m.memoizedState=v,yr=!0),m=m.queue,lh(cb.bind(null,d,m,s),[s]),m.getSnapshot!==o||k||Jn!==null&&Jn.memoizedState.tag&1){if(d.flags|=2048,za(9,lb.bind(null,d,m,v,o),void 0,null),Zn===null)throw Error(n(349));($s&30)!==0||ab(d,o,v)}return v}function ab(s,o,d){s.flags|=16384,s={getSnapshot:o,value:d},o=Nn.updateQueue,o===null?(o={lastEffect:null,stores:null},Nn.updateQueue=o,o.stores=[s]):(d=o.stores,d===null?o.stores=[s]:d.push(s))}function lb(s,o,d,m){o.value=d,o.getSnapshot=m,ub(o)&&db(s)}function cb(s,o,d){return d(function(){ub(o)&&db(s)})}function ub(s){var o=s.getSnapshot;s=s.value;try{var d=o();return!ei(s,d)}catch{return!0}}function db(s){var o=Fi(s,1);o!==null&&si(o,s,1,-1)}function hb(s){var o=bi();return typeof s=="function"&&(s=s()),o.memoizedState=o.baseState=s,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Wa,lastRenderedState:s},o.queue=s,s=s.dispatch=X0.bind(null,Nn,s),[o.memoizedState,s]}function za(s,o,d,m){return s={tag:s,create:o,destroy:d,deps:m,next:null},o=Nn.updateQueue,o===null?(o={lastEffect:null,stores:null},Nn.updateQueue=o,o.lastEffect=s.next=s):(d=o.lastEffect,d===null?o.lastEffect=s.next=s:(m=d.next,d.next=s,s.next=m,o.lastEffect=s)),s}function fb(){return zr().memoizedState}function wc(s,o,d,m){var v=bi();Nn.flags|=s,v.memoizedState=za(1|o,d,void 0,m===void 0?null:m)}function xc(s,o,d,m){var v=zr();m=m===void 0?null:m;var k=void 0;if(qn!==null){var T=qn.memoizedState;if(k=T.destroy,m!==null&&rh(m,T.deps)){v.memoizedState=za(o,d,k,m);return}}Nn.flags|=s,v.memoizedState=za(1|o,d,k,m)}function mb(s,o){return wc(8390656,8,s,o)}function lh(s,o){return xc(2048,8,s,o)}function pb(s,o){return xc(4,2,s,o)}function gb(s,o){return xc(4,4,s,o)}function bb(s,o){if(typeof o=="function")return s=s(),o(s),function(){o(null)};if(o!=null)return s=s(),o.current=s,function(){o.current=null}}function yb(s,o,d){return d=d!=null?d.concat([s]):null,xc(4,4,bb.bind(null,o,s),d)}function ch(){}function vb(s,o){var d=zr();o=o===void 0?null:o;var m=d.memoizedState;return m!==null&&o!==null&&rh(o,m[1])?m[0]:(d.memoizedState=[s,o],s)}function wb(s,o){var d=zr();o=o===void 0?null:o;var m=d.memoizedState;return m!==null&&o!==null&&rh(o,m[1])?m[0]:(s=s(),d.memoizedState=[s,o],s)}function xb(s,o,d){return($s&21)===0?(s.baseState&&(s.baseState=!1,yr=!0),s.memoizedState=d):(ei(d,o)||(d=bo(),Nn.lanes|=d,Vs|=d,s.baseState=!0),o)}function Q0(s,o){var d=sn;sn=d!==0&&4>d?d:4,s(!0);var m=nh.transition;nh.transition={};try{s(!1),o()}finally{sn=d,nh.transition=m}}function kb(){return zr().memoizedState}function Y0(s,o,d){var m=ls(s);if(d={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null},Sb(s))Cb(o,d);else if(d=eb(s,o,d,m),d!==null){var v=fr();si(d,s,m,v),jb(d,o,m)}}function X0(s,o,d){var m=ls(s),v={lane:m,action:d,hasEagerState:!1,eagerState:null,next:null};if(Sb(s))Cb(o,v);else{var k=s.alternate;if(s.lanes===0&&(k===null||k.lanes===0)&&(k=o.lastRenderedReducer,k!==null))try{var T=o.lastRenderedState,H=k(T,d);if(v.hasEagerState=!0,v.eagerState=H,ei(H,T)){var te=o.interleaved;te===null?(v.next=v,Yd(o)):(v.next=te.next,te.next=v),o.interleaved=v;return}}catch{}finally{}d=eb(s,o,v,m),d!==null&&(v=fr(),si(d,s,m,v),jb(d,o,m))}}function Sb(s){var o=s.alternate;return s===Nn||o!==null&&o===Nn}function Cb(s,o){Ba=vc=!0;var d=s.pending;d===null?o.next=o:(o.next=d.next,d.next=o),s.pending=o}function jb(s,o,d){if((d&4194240)!==0){var m=o.lanes;m&=s.pendingLanes,d|=m,o.lanes=d,ba(s,d)}}var kc={readContext:Wr,useCallback:or,useContext:or,useEffect:or,useImperativeHandle:or,useInsertionEffect:or,useLayoutEffect:or,useMemo:or,useReducer:or,useRef:or,useState:or,useDebugValue:or,useDeferredValue:or,useTransition:or,useMutableSource:or,useSyncExternalStore:or,useId:or,unstable_isNewReconciler:!1},J0={readContext:Wr,useCallback:function(s,o){return bi().memoizedState=[s,o===void 0?null:o],s},useContext:Wr,useEffect:mb,useImperativeHandle:function(s,o,d){return d=d!=null?d.concat([s]):null,wc(4194308,4,bb.bind(null,o,s),d)},useLayoutEffect:function(s,o){return wc(4194308,4,s,o)},useInsertionEffect:function(s,o){return wc(4,2,s,o)},useMemo:function(s,o){var d=bi();return o=o===void 0?null:o,s=s(),d.memoizedState=[s,o],s},useReducer:function(s,o,d){var m=bi();return o=d!==void 0?d(o):o,m.memoizedState=m.baseState=o,s={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:o},m.queue=s,s=s.dispatch=Y0.bind(null,Nn,s),[m.memoizedState,s]},useRef:function(s){var o=bi();return s={current:s},o.memoizedState=s},useState:hb,useDebugValue:ch,useDeferredValue:function(s){return bi().memoizedState=s},useTransition:function(){var s=hb(!1),o=s[0];return s=Q0.bind(null,s[1]),bi().memoizedState=s,[o,s]},useMutableSource:function(){},useSyncExternalStore:function(s,o,d){var m=Nn,v=bi();if(wn){if(d===void 0)throw Error(n(407));d=d()}else{if(d=o(),Zn===null)throw Error(n(349));($s&30)!==0||ab(m,o,d)}v.memoizedState=d;var k={value:d,getSnapshot:o};return v.queue=k,mb(cb.bind(null,m,k,s),[s]),m.flags|=2048,za(9,lb.bind(null,m,k,d,o),void 0,null),d},useId:function(){var s=bi(),o=Zn.identifierPrefix;if(wn){var d=Di,m=Mi;d=(m&~(1<<32-j(m)-1)).toString(32)+d,o=":"+o+"R"+d,d=Ua++,0<d&&(o+="H"+d.toString(32)),o+=":"}else d=K0++,o=":"+o+"r"+d.toString(32)+":";return s.memoizedState=o},unstable_isNewReconciler:!1},Z0={readContext:Wr,useCallback:vb,useContext:Wr,useEffect:lh,useImperativeHandle:yb,useInsertionEffect:pb,useLayoutEffect:gb,useMemo:wb,useReducer:oh,useRef:fb,useState:function(){return oh(Wa)},useDebugValue:ch,useDeferredValue:function(s){var o=zr();return xb(o,qn.memoizedState,s)},useTransition:function(){var s=oh(Wa)[0],o=zr().memoizedState;return[s,o]},useMutableSource:sb,useSyncExternalStore:ob,useId:kb,unstable_isNewReconciler:!1},eP={readContext:Wr,useCallback:vb,useContext:Wr,useEffect:lh,useImperativeHandle:yb,useInsertionEffect:pb,useLayoutEffect:gb,useMemo:wb,useReducer:ah,useRef:fb,useState:function(){return ah(Wa)},useDebugValue:ch,useDeferredValue:function(s){var o=zr();return qn===null?o.memoizedState=s:xb(o,qn.memoizedState,s)},useTransition:function(){var s=ah(Wa)[0],o=zr().memoizedState;return[s,o]},useMutableSource:sb,useSyncExternalStore:ob,useId:kb,unstable_isNewReconciler:!1};function ni(s,o){if(s&&s.defaultProps){o=R({},o),s=s.defaultProps;for(var d in s)o[d]===void 0&&(o[d]=s[d]);return o}return o}function uh(s,o,d,m){o=s.memoizedState,d=d(m,o),d=d==null?o:R({},o,d),s.memoizedState=d,s.lanes===0&&(s.updateQueue.baseState=d)}var Sc={isMounted:function(s){return(s=s._reactInternals)?xe(s)===s:!1},enqueueSetState:function(s,o,d){s=s._reactInternals;var m=fr(),v=ls(s),k=_i(m,v);k.payload=o,d!=null&&(k.callback=d),o=is(s,k,v),o!==null&&(si(o,s,v,m),pc(o,s,v))},enqueueReplaceState:function(s,o,d){s=s._reactInternals;var m=fr(),v=ls(s),k=_i(m,v);k.tag=1,k.payload=o,d!=null&&(k.callback=d),o=is(s,k,v),o!==null&&(si(o,s,v,m),pc(o,s,v))},enqueueForceUpdate:function(s,o){s=s._reactInternals;var d=fr(),m=ls(s),v=_i(d,m);v.tag=2,o!=null&&(v.callback=o),o=is(s,v,m),o!==null&&(si(o,s,m,d),pc(o,s,m))}};function Nb(s,o,d,m,v,k,T){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(m,k,T):o.prototype&&o.prototype.isPureReactComponent?!Ta(d,m)||!Ta(v,k):!0}function Pb(s,o,d){var m=!1,v=ts,k=o.contextType;return typeof k=="object"&&k!==null?k=Wr(k):(v=br(o)?Us:sr.current,m=o.contextTypes,k=(m=m!=null)?Ro(s,v):ts),o=new o(d,k),s.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=Sc,s.stateNode=o,o._reactInternals=s,m&&(s=s.stateNode,s.__reactInternalMemoizedUnmaskedChildContext=v,s.__reactInternalMemoizedMaskedChildContext=k),o}function Tb(s,o,d,m){s=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(d,m),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(d,m),o.state!==s&&Sc.enqueueReplaceState(o,o.state,null)}function dh(s,o,d,m){var v=s.stateNode;v.props=d,v.state=s.memoizedState,v.refs={},Xd(s);var k=o.contextType;typeof k=="object"&&k!==null?v.context=Wr(k):(k=br(o)?Us:sr.current,v.context=Ro(s,k)),v.state=s.memoizedState,k=o.getDerivedStateFromProps,typeof k=="function"&&(uh(s,o,k,d),v.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(o=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),o!==v.state&&Sc.enqueueReplaceState(v,v.state,null),gc(s,d,v,m),v.state=s.memoizedState),typeof v.componentDidMount=="function"&&(s.flags|=4194308)}function _o(s,o){try{var d="",m=o;do d+=ce(m),m=m.return;while(m);var v=d}catch(k){v=`
40
+ Error generating stack: `+k.message+`
41
+ `+k.stack}return{value:s,source:o,stack:v,digest:null}}function hh(s,o,d){return{value:s,source:null,stack:d??null,digest:o??null}}function fh(s,o){try{console.error(o.value)}catch(d){setTimeout(function(){throw d})}}var tP=typeof WeakMap=="function"?WeakMap:Map;function Rb(s,o,d){d=_i(-1,d),d.tag=3,d.payload={element:null};var m=o.value;return d.callback=function(){Ec||(Ec=!0,Th=m),fh(s,o)},d}function Eb(s,o,d){d=_i(-1,d),d.tag=3;var m=s.type.getDerivedStateFromError;if(typeof m=="function"){var v=o.value;d.payload=function(){return m(v)},d.callback=function(){fh(s,o)}}var k=s.stateNode;return k!==null&&typeof k.componentDidCatch=="function"&&(d.callback=function(){fh(s,o),typeof m!="function"&&(os===null?os=new Set([this]):os.add(this));var T=o.stack;this.componentDidCatch(o.value,{componentStack:T!==null?T:""})}),d}function Ab(s,o,d){var m=s.pingCache;if(m===null){m=s.pingCache=new tP;var v=new Set;m.set(o,v)}else v=m.get(o),v===void 0&&(v=new Set,m.set(o,v));v.has(d)||(v.add(d),s=pP.bind(null,s,o,d),o.then(s,s))}function Ib(s){do{var o;if((o=s.tag===13)&&(o=s.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return s;s=s.return}while(s!==null);return null}function Lb(s,o,d,m,v){return(s.mode&1)===0?(s===o?s.flags|=65536:(s.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(o=_i(-1,1),o.tag=2,is(d,o,1))),d.lanes|=1),s):(s.flags|=65536,s.lanes=v,s)}var nP=ee.ReactCurrentOwner,yr=!1;function hr(s,o,d,m){o.child=s===null?Zg(o,null,d,m):Lo(o,s.child,d,m)}function Mb(s,o,d,m,v){d=d.render;var k=o.ref;return Do(o,v),m=ih(s,o,d,m,k,v),d=sh(),s!==null&&!yr?(o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~v,Oi(s,o,v)):(wn&&d&&Wd(o),o.flags|=1,hr(s,o,m,v),o.child)}function Db(s,o,d,m,v){if(s===null){var k=d.type;return typeof k=="function"&&!Dh(k)&&k.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(o.tag=15,o.type=k,Fb(s,o,k,m,v)):(s=Fc(d.type,null,m,o,o.mode,v),s.ref=o.ref,s.return=o,o.child=s)}if(k=s.child,(s.lanes&v)===0){var T=k.memoizedProps;if(d=d.compare,d=d!==null?d:Ta,d(T,m)&&s.ref===o.ref)return Oi(s,o,v)}return o.flags|=1,s=us(k,m),s.ref=o.ref,s.return=o,o.child=s}function Fb(s,o,d,m,v){if(s!==null){var k=s.memoizedProps;if(Ta(k,m)&&s.ref===o.ref)if(yr=!1,o.pendingProps=m=k,(s.lanes&v)!==0)(s.flags&131072)!==0&&(yr=!0);else return o.lanes=s.lanes,Oi(s,o,v)}return mh(s,o,d,m,v)}function _b(s,o,d){var m=o.pendingProps,v=m.children,k=s!==null?s.memoizedState:null;if(m.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},pn(Bo,Ir),Ir|=d;else{if((d&1073741824)===0)return s=k!==null?k.baseLanes|d:d,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:s,cachePool:null,transitions:null},o.updateQueue=null,pn(Bo,Ir),Ir|=s,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},m=k!==null?k.baseLanes:d,pn(Bo,Ir),Ir|=m}else k!==null?(m=k.baseLanes|d,o.memoizedState=null):m=d,pn(Bo,Ir),Ir|=m;return hr(s,o,v,d),o.child}function Ob(s,o){var d=o.ref;(s===null&&d!==null||s!==null&&s.ref!==d)&&(o.flags|=512,o.flags|=2097152)}function mh(s,o,d,m,v){var k=br(d)?Us:sr.current;return k=Ro(o,k),Do(o,v),d=ih(s,o,d,m,k,v),m=sh(),s!==null&&!yr?(o.updateQueue=s.updateQueue,o.flags&=-2053,s.lanes&=~v,Oi(s,o,v)):(wn&&m&&Wd(o),o.flags|=1,hr(s,o,d,v),o.child)}function Bb(s,o,d,m,v){if(br(d)){var k=!0;ac(o)}else k=!1;if(Do(o,v),o.stateNode===null)jc(s,o),Pb(o,d,m),dh(o,d,m,v),m=!0;else if(s===null){var T=o.stateNode,H=o.memoizedProps;T.props=H;var te=T.context,pe=d.contextType;typeof pe=="object"&&pe!==null?pe=Wr(pe):(pe=br(d)?Us:sr.current,pe=Ro(o,pe));var Re=d.getDerivedStateFromProps,Ae=typeof Re=="function"||typeof T.getSnapshotBeforeUpdate=="function";Ae||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(H!==m||te!==pe)&&Tb(o,T,m,pe),rs=!1;var Pe=o.memoizedState;T.state=Pe,gc(o,m,T,v),te=o.memoizedState,H!==m||Pe!==te||gr.current||rs?(typeof Re=="function"&&(uh(o,d,Re,m),te=o.memoizedState),(H=rs||Nb(o,d,H,m,Pe,te,pe))?(Ae||typeof T.UNSAFE_componentWillMount!="function"&&typeof T.componentWillMount!="function"||(typeof T.componentWillMount=="function"&&T.componentWillMount(),typeof T.UNSAFE_componentWillMount=="function"&&T.UNSAFE_componentWillMount()),typeof T.componentDidMount=="function"&&(o.flags|=4194308)):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=m,o.memoizedState=te),T.props=m,T.state=te,T.context=pe,m=H):(typeof T.componentDidMount=="function"&&(o.flags|=4194308),m=!1)}else{T=o.stateNode,tb(s,o),H=o.memoizedProps,pe=o.type===o.elementType?H:ni(o.type,H),T.props=pe,Ae=o.pendingProps,Pe=T.context,te=d.contextType,typeof te=="object"&&te!==null?te=Wr(te):(te=br(d)?Us:sr.current,te=Ro(o,te));var Je=d.getDerivedStateFromProps;(Re=typeof Je=="function"||typeof T.getSnapshotBeforeUpdate=="function")||typeof T.UNSAFE_componentWillReceiveProps!="function"&&typeof T.componentWillReceiveProps!="function"||(H!==Ae||Pe!==te)&&Tb(o,T,m,te),rs=!1,Pe=o.memoizedState,T.state=Pe,gc(o,m,T,v);var at=o.memoizedState;H!==Ae||Pe!==at||gr.current||rs?(typeof Je=="function"&&(uh(o,d,Je,m),at=o.memoizedState),(pe=rs||Nb(o,d,pe,m,Pe,at,te)||!1)?(Re||typeof T.UNSAFE_componentWillUpdate!="function"&&typeof T.componentWillUpdate!="function"||(typeof T.componentWillUpdate=="function"&&T.componentWillUpdate(m,at,te),typeof T.UNSAFE_componentWillUpdate=="function"&&T.UNSAFE_componentWillUpdate(m,at,te)),typeof T.componentDidUpdate=="function"&&(o.flags|=4),typeof T.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof T.componentDidUpdate!="function"||H===s.memoizedProps&&Pe===s.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||H===s.memoizedProps&&Pe===s.memoizedState||(o.flags|=1024),o.memoizedProps=m,o.memoizedState=at),T.props=m,T.state=at,T.context=te,m=pe):(typeof T.componentDidUpdate!="function"||H===s.memoizedProps&&Pe===s.memoizedState||(o.flags|=4),typeof T.getSnapshotBeforeUpdate!="function"||H===s.memoizedProps&&Pe===s.memoizedState||(o.flags|=1024),m=!1)}return ph(s,o,d,m,k,v)}function ph(s,o,d,m,v,k){Ob(s,o);var T=(o.flags&128)!==0;if(!m&&!T)return v&&qg(o,d,!1),Oi(s,o,k);m=o.stateNode,nP.current=o;var H=T&&typeof d.getDerivedStateFromError!="function"?null:m.render();return o.flags|=1,s!==null&&T?(o.child=Lo(o,s.child,null,k),o.child=Lo(o,null,H,k)):hr(s,o,H,k),o.memoizedState=m.state,v&&qg(o,d,!0),o.child}function Ub(s){var o=s.stateNode;o.pendingContext?zg(s,o.pendingContext,o.pendingContext!==o.context):o.context&&zg(s,o.context,!1),Jd(s,o.containerInfo)}function Wb(s,o,d,m,v){return Io(),$d(v),o.flags|=256,hr(s,o,d,m),o.child}var gh={dehydrated:null,treeContext:null,retryLane:0};function bh(s){return{baseLanes:s,cachePool:null,transitions:null}}function zb(s,o,d){var m=o.pendingProps,v=jn.current,k=!1,T=(o.flags&128)!==0,H;if((H=T)||(H=s!==null&&s.memoizedState===null?!1:(v&2)!==0),H?(k=!0,o.flags&=-129):(s===null||s.memoizedState!==null)&&(v|=1),pn(jn,v&1),s===null)return qd(o),s=o.memoizedState,s!==null&&(s=s.dehydrated,s!==null)?((o.mode&1)===0?o.lanes=1:s.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(T=m.children,s=m.fallback,k?(m=o.mode,k=o.child,T={mode:"hidden",children:T},(m&1)===0&&k!==null?(k.childLanes=0,k.pendingProps=T):k=_c(T,m,0,null),s=Ys(s,m,d,null),k.return=o,s.return=o,k.sibling=s,o.child=k,o.child.memoizedState=bh(d),o.memoizedState=gh,s):yh(o,T));if(v=s.memoizedState,v!==null&&(H=v.dehydrated,H!==null))return rP(s,o,T,m,H,v,d);if(k){k=m.fallback,T=o.mode,v=s.child,H=v.sibling;var te={mode:"hidden",children:m.children};return(T&1)===0&&o.child!==v?(m=o.child,m.childLanes=0,m.pendingProps=te,o.deletions=null):(m=us(v,te),m.subtreeFlags=v.subtreeFlags&14680064),H!==null?k=us(H,k):(k=Ys(k,T,d,null),k.flags|=2),k.return=o,m.return=o,m.sibling=k,o.child=m,m=k,k=o.child,T=s.child.memoizedState,T=T===null?bh(d):{baseLanes:T.baseLanes|d,cachePool:null,transitions:T.transitions},k.memoizedState=T,k.childLanes=s.childLanes&~d,o.memoizedState=gh,m}return k=s.child,s=k.sibling,m=us(k,{mode:"visible",children:m.children}),(o.mode&1)===0&&(m.lanes=d),m.return=o,m.sibling=null,s!==null&&(d=o.deletions,d===null?(o.deletions=[s],o.flags|=16):d.push(s)),o.child=m,o.memoizedState=null,m}function yh(s,o){return o=_c({mode:"visible",children:o},s.mode,0,null),o.return=s,s.child=o}function Cc(s,o,d,m){return m!==null&&$d(m),Lo(o,s.child,null,d),s=yh(o,o.pendingProps.children),s.flags|=2,o.memoizedState=null,s}function rP(s,o,d,m,v,k,T){if(d)return o.flags&256?(o.flags&=-257,m=hh(Error(n(422))),Cc(s,o,T,m)):o.memoizedState!==null?(o.child=s.child,o.flags|=128,null):(k=m.fallback,v=o.mode,m=_c({mode:"visible",children:m.children},v,0,null),k=Ys(k,v,T,null),k.flags|=2,m.return=o,k.return=o,m.sibling=k,o.child=m,(o.mode&1)!==0&&Lo(o,s.child,null,T),o.child.memoizedState=bh(T),o.memoizedState=gh,k);if((o.mode&1)===0)return Cc(s,o,T,null);if(v.data==="$!"){if(m=v.nextSibling&&v.nextSibling.dataset,m)var H=m.dgst;return m=H,k=Error(n(419)),m=hh(k,m,void 0),Cc(s,o,T,m)}if(H=(T&s.childLanes)!==0,yr||H){if(m=Zn,m!==null){switch(T&-T){case 4:v=2;break;case 16:v=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:v=32;break;case 536870912:v=268435456;break;default:v=0}v=(v&(m.suspendedLanes|T))!==0?0:v,v!==0&&v!==k.retryLane&&(k.retryLane=v,Fi(s,v),si(m,s,v,-1))}return Mh(),m=hh(Error(n(421))),Cc(s,o,T,m)}return v.data==="$?"?(o.flags|=128,o.child=s.child,o=gP.bind(null,s),v._reactRetry=o,null):(s=k.treeContext,Ar=Zi(v.nextSibling),Er=o,wn=!0,ti=null,s!==null&&(Br[Ur++]=Mi,Br[Ur++]=Di,Br[Ur++]=Ws,Mi=s.id,Di=s.overflow,Ws=o),o=yh(o,m.children),o.flags|=4096,o)}function Hb(s,o,d){s.lanes|=o;var m=s.alternate;m!==null&&(m.lanes|=o),Qd(s.return,o,d)}function vh(s,o,d,m,v){var k=s.memoizedState;k===null?s.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:m,tail:d,tailMode:v}:(k.isBackwards=o,k.rendering=null,k.renderingStartTime=0,k.last=m,k.tail=d,k.tailMode=v)}function qb(s,o,d){var m=o.pendingProps,v=m.revealOrder,k=m.tail;if(hr(s,o,m.children,d),m=jn.current,(m&2)!==0)m=m&1|2,o.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=o.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Hb(s,d,o);else if(s.tag===19)Hb(s,d,o);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===o)break e;for(;s.sibling===null;){if(s.return===null||s.return===o)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}m&=1}if(pn(jn,m),(o.mode&1)===0)o.memoizedState=null;else switch(v){case"forwards":for(d=o.child,v=null;d!==null;)s=d.alternate,s!==null&&bc(s)===null&&(v=d),d=d.sibling;d=v,d===null?(v=o.child,o.child=null):(v=d.sibling,d.sibling=null),vh(o,!1,v,d,k);break;case"backwards":for(d=null,v=o.child,o.child=null;v!==null;){if(s=v.alternate,s!==null&&bc(s)===null){o.child=v;break}s=v.sibling,v.sibling=d,d=v,v=s}vh(o,!0,d,null,k);break;case"together":vh(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function jc(s,o){(o.mode&1)===0&&s!==null&&(s.alternate=null,o.alternate=null,o.flags|=2)}function Oi(s,o,d){if(s!==null&&(o.dependencies=s.dependencies),Vs|=o.lanes,(d&o.childLanes)===0)return null;if(s!==null&&o.child!==s.child)throw Error(n(153));if(o.child!==null){for(s=o.child,d=us(s,s.pendingProps),o.child=d,d.return=o;s.sibling!==null;)s=s.sibling,d=d.sibling=us(s,s.pendingProps),d.return=o;d.sibling=null}return o.child}function iP(s,o,d){switch(o.tag){case 3:Ub(o),Io();break;case 5:ib(o);break;case 1:br(o.type)&&ac(o);break;case 4:Jd(o,o.stateNode.containerInfo);break;case 10:var m=o.type._context,v=o.memoizedProps.value;pn(fc,m._currentValue),m._currentValue=v;break;case 13:if(m=o.memoizedState,m!==null)return m.dehydrated!==null?(pn(jn,jn.current&1),o.flags|=128,null):(d&o.child.childLanes)!==0?zb(s,o,d):(pn(jn,jn.current&1),s=Oi(s,o,d),s!==null?s.sibling:null);pn(jn,jn.current&1);break;case 19:if(m=(d&o.childLanes)!==0,(s.flags&128)!==0){if(m)return qb(s,o,d);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),pn(jn,jn.current),m)break;return null;case 22:case 23:return o.lanes=0,_b(s,o,d)}return Oi(s,o,d)}var $b,wh,Vb,Gb;$b=function(s,o){for(var d=o.child;d!==null;){if(d.tag===5||d.tag===6)s.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===o)break;for(;d.sibling===null;){if(d.return===null||d.return===o)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},wh=function(){},Vb=function(s,o,d,m){var v=s.memoizedProps;if(v!==m){s=o.stateNode,qs(gi.current);var k=null;switch(d){case"input":v=pt(s,v),m=pt(s,m),k=[];break;case"select":v=R({},v,{value:void 0}),m=R({},m,{value:void 0}),k=[];break;case"textarea":v=lt(s,v),m=lt(s,m),k=[];break;default:typeof v.onClick!="function"&&typeof m.onClick=="function"&&(s.onclick=ic)}At(d,m);var T;d=null;for(pe in v)if(!m.hasOwnProperty(pe)&&v.hasOwnProperty(pe)&&v[pe]!=null)if(pe==="style"){var H=v[pe];for(T in H)H.hasOwnProperty(T)&&(d||(d={}),d[T]="")}else pe!=="dangerouslySetInnerHTML"&&pe!=="children"&&pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&pe!=="autoFocus"&&(a.hasOwnProperty(pe)?k||(k=[]):(k=k||[]).push(pe,null));for(pe in m){var te=m[pe];if(H=v!=null?v[pe]:void 0,m.hasOwnProperty(pe)&&te!==H&&(te!=null||H!=null))if(pe==="style")if(H){for(T in H)!H.hasOwnProperty(T)||te&&te.hasOwnProperty(T)||(d||(d={}),d[T]="");for(T in te)te.hasOwnProperty(T)&&H[T]!==te[T]&&(d||(d={}),d[T]=te[T])}else d||(k||(k=[]),k.push(pe,d)),d=te;else pe==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,H=H?H.__html:void 0,te!=null&&H!==te&&(k=k||[]).push(pe,te)):pe==="children"?typeof te!="string"&&typeof te!="number"||(k=k||[]).push(pe,""+te):pe!=="suppressContentEditableWarning"&&pe!=="suppressHydrationWarning"&&(a.hasOwnProperty(pe)?(te!=null&&pe==="onScroll"&&yn("scroll",s),k||H===te||(k=[])):(k=k||[]).push(pe,te))}d&&(k=k||[]).push("style",d);var pe=k;(o.updateQueue=pe)&&(o.flags|=4)}},Gb=function(s,o,d,m){d!==m&&(o.flags|=4)};function Ha(s,o){if(!wn)switch(s.tailMode){case"hidden":o=s.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?s.tail=null:d.sibling=null;break;case"collapsed":d=s.tail;for(var m=null;d!==null;)d.alternate!==null&&(m=d),d=d.sibling;m===null?o||s.tail===null?s.tail=null:s.tail.sibling=null:m.sibling=null}}function ar(s){var o=s.alternate!==null&&s.alternate.child===s.child,d=0,m=0;if(o)for(var v=s.child;v!==null;)d|=v.lanes|v.childLanes,m|=v.subtreeFlags&14680064,m|=v.flags&14680064,v.return=s,v=v.sibling;else for(v=s.child;v!==null;)d|=v.lanes|v.childLanes,m|=v.subtreeFlags,m|=v.flags,v.return=s,v=v.sibling;return s.subtreeFlags|=m,s.childLanes=d,o}function sP(s,o,d){var m=o.pendingProps;switch(zd(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ar(o),null;case 1:return br(o.type)&&oc(),ar(o),null;case 3:return m=o.stateNode,Fo(),vn(gr),vn(sr),th(),m.pendingContext&&(m.context=m.pendingContext,m.pendingContext=null),(s===null||s.child===null)&&(dc(o)?o.flags|=4:s===null||s.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,ti!==null&&(Ah(ti),ti=null))),wh(s,o),ar(o),null;case 5:Zd(o);var v=qs(Oa.current);if(d=o.type,s!==null&&o.stateNode!=null)Vb(s,o,d,m,v),s.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!m){if(o.stateNode===null)throw Error(n(166));return ar(o),null}if(s=qs(gi.current),dc(o)){m=o.stateNode,d=o.type;var k=o.memoizedProps;switch(m[pi]=o,m[La]=k,s=(o.mode&1)!==0,d){case"dialog":yn("cancel",m),yn("close",m);break;case"iframe":case"object":case"embed":yn("load",m);break;case"video":case"audio":for(v=0;v<Ea.length;v++)yn(Ea[v],m);break;case"source":yn("error",m);break;case"img":case"image":case"link":yn("error",m),yn("load",m);break;case"details":yn("toggle",m);break;case"input":Mt(m,k),yn("invalid",m);break;case"select":m._wrapperState={wasMultiple:!!k.multiple},yn("invalid",m);break;case"textarea":gt(m,k),yn("invalid",m)}At(d,k),v=null;for(var T in k)if(k.hasOwnProperty(T)){var H=k[T];T==="children"?typeof H=="string"?m.textContent!==H&&(k.suppressHydrationWarning!==!0&&rc(m.textContent,H,s),v=["children",H]):typeof H=="number"&&m.textContent!==""+H&&(k.suppressHydrationWarning!==!0&&rc(m.textContent,H,s),v=["children",""+H]):a.hasOwnProperty(T)&&H!=null&&T==="onScroll"&&yn("scroll",m)}switch(d){case"input":Ot(m),wt(m,k,!0);break;case"textarea":Ot(m),nt(m);break;case"select":case"option":break;default:typeof k.onClick=="function"&&(m.onclick=ic)}m=v,o.updateQueue=m,m!==null&&(o.flags|=4)}else{T=v.nodeType===9?v:v.ownerDocument,s==="http://www.w3.org/1999/xhtml"&&(s=fe(d)),s==="http://www.w3.org/1999/xhtml"?d==="script"?(s=T.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild)):typeof m.is=="string"?s=T.createElement(d,{is:m.is}):(s=T.createElement(d),d==="select"&&(T=s,m.multiple?T.multiple=!0:m.size&&(T.size=m.size))):s=T.createElementNS(s,d),s[pi]=o,s[La]=m,$b(s,o,!1,!1),o.stateNode=s;e:{switch(T=vt(d,m),d){case"dialog":yn("cancel",s),yn("close",s),v=m;break;case"iframe":case"object":case"embed":yn("load",s),v=m;break;case"video":case"audio":for(v=0;v<Ea.length;v++)yn(Ea[v],s);v=m;break;case"source":yn("error",s),v=m;break;case"img":case"image":case"link":yn("error",s),yn("load",s),v=m;break;case"details":yn("toggle",s),v=m;break;case"input":Mt(s,m),v=pt(s,m),yn("invalid",s);break;case"option":v=m;break;case"select":s._wrapperState={wasMultiple:!!m.multiple},v=R({},m,{value:void 0}),yn("invalid",s);break;case"textarea":gt(s,m),v=lt(s,m),yn("invalid",s);break;default:v=m}At(d,v),H=v;for(k in H)if(H.hasOwnProperty(k)){var te=H[k];k==="style"?mt(s,te):k==="dangerouslySetInnerHTML"?(te=te?te.__html:void 0,te!=null&&qe(s,te)):k==="children"?typeof te=="string"?(d!=="textarea"||te!=="")&&dt(s,te):typeof te=="number"&&dt(s,""+te):k!=="suppressContentEditableWarning"&&k!=="suppressHydrationWarning"&&k!=="autoFocus"&&(a.hasOwnProperty(k)?te!=null&&k==="onScroll"&&yn("scroll",s):te!=null&&O(s,k,te,T))}switch(d){case"input":Ot(s),wt(s,m,!1);break;case"textarea":Ot(s),nt(s);break;case"option":m.value!=null&&s.setAttribute("value",""+ze(m.value));break;case"select":s.multiple=!!m.multiple,k=m.value,k!=null?kt(s,!!m.multiple,k,!1):m.defaultValue!=null&&kt(s,!!m.multiple,m.defaultValue,!0);break;default:typeof v.onClick=="function"&&(s.onclick=ic)}switch(d){case"button":case"input":case"select":case"textarea":m=!!m.autoFocus;break e;case"img":m=!0;break e;default:m=!1}}m&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return ar(o),null;case 6:if(s&&o.stateNode!=null)Gb(s,o,s.memoizedProps,m);else{if(typeof m!="string"&&o.stateNode===null)throw Error(n(166));if(d=qs(Oa.current),qs(gi.current),dc(o)){if(m=o.stateNode,d=o.memoizedProps,m[pi]=o,(k=m.nodeValue!==d)&&(s=Er,s!==null))switch(s.tag){case 3:rc(m.nodeValue,d,(s.mode&1)!==0);break;case 5:s.memoizedProps.suppressHydrationWarning!==!0&&rc(m.nodeValue,d,(s.mode&1)!==0)}k&&(o.flags|=4)}else m=(d.nodeType===9?d:d.ownerDocument).createTextNode(m),m[pi]=o,o.stateNode=m}return ar(o),null;case 13:if(vn(jn),m=o.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(wn&&Ar!==null&&(o.mode&1)!==0&&(o.flags&128)===0)Yg(),Io(),o.flags|=98560,k=!1;else if(k=dc(o),m!==null&&m.dehydrated!==null){if(s===null){if(!k)throw Error(n(318));if(k=o.memoizedState,k=k!==null?k.dehydrated:null,!k)throw Error(n(317));k[pi]=o}else Io(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;ar(o),k=!1}else ti!==null&&(Ah(ti),ti=null),k=!0;if(!k)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=d,o):(m=m!==null,m!==(s!==null&&s.memoizedState!==null)&&m&&(o.child.flags|=8192,(o.mode&1)!==0&&(s===null||(jn.current&1)!==0?$n===0&&($n=3):Mh())),o.updateQueue!==null&&(o.flags|=4),ar(o),null);case 4:return Fo(),wh(s,o),s===null&&Aa(o.stateNode.containerInfo),ar(o),null;case 10:return Kd(o.type._context),ar(o),null;case 17:return br(o.type)&&oc(),ar(o),null;case 19:if(vn(jn),k=o.memoizedState,k===null)return ar(o),null;if(m=(o.flags&128)!==0,T=k.rendering,T===null)if(m)Ha(k,!1);else{if($n!==0||s!==null&&(s.flags&128)!==0)for(s=o.child;s!==null;){if(T=bc(s),T!==null){for(o.flags|=128,Ha(k,!1),m=T.updateQueue,m!==null&&(o.updateQueue=m,o.flags|=4),o.subtreeFlags=0,m=d,d=o.child;d!==null;)k=d,s=m,k.flags&=14680066,T=k.alternate,T===null?(k.childLanes=0,k.lanes=s,k.child=null,k.subtreeFlags=0,k.memoizedProps=null,k.memoizedState=null,k.updateQueue=null,k.dependencies=null,k.stateNode=null):(k.childLanes=T.childLanes,k.lanes=T.lanes,k.child=T.child,k.subtreeFlags=0,k.deletions=null,k.memoizedProps=T.memoizedProps,k.memoizedState=T.memoizedState,k.updateQueue=T.updateQueue,k.type=T.type,s=T.dependencies,k.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),d=d.sibling;return pn(jn,jn.current&1|2),o.child}s=s.sibling}k.tail!==null&&Be()>Uo&&(o.flags|=128,m=!0,Ha(k,!1),o.lanes=4194304)}else{if(!m)if(s=bc(T),s!==null){if(o.flags|=128,m=!0,d=s.updateQueue,d!==null&&(o.updateQueue=d,o.flags|=4),Ha(k,!0),k.tail===null&&k.tailMode==="hidden"&&!T.alternate&&!wn)return ar(o),null}else 2*Be()-k.renderingStartTime>Uo&&d!==1073741824&&(o.flags|=128,m=!0,Ha(k,!1),o.lanes=4194304);k.isBackwards?(T.sibling=o.child,o.child=T):(d=k.last,d!==null?d.sibling=T:o.child=T,k.last=T)}return k.tail!==null?(o=k.tail,k.rendering=o,k.tail=o.sibling,k.renderingStartTime=Be(),o.sibling=null,d=jn.current,pn(jn,m?d&1|2:d&1),o):(ar(o),null);case 22:case 23:return Lh(),m=o.memoizedState!==null,s!==null&&s.memoizedState!==null!==m&&(o.flags|=8192),m&&(o.mode&1)!==0?(Ir&1073741824)!==0&&(ar(o),o.subtreeFlags&6&&(o.flags|=8192)):ar(o),null;case 24:return null;case 25:return null}throw Error(n(156,o.tag))}function oP(s,o){switch(zd(o),o.tag){case 1:return br(o.type)&&oc(),s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 3:return Fo(),vn(gr),vn(sr),th(),s=o.flags,(s&65536)!==0&&(s&128)===0?(o.flags=s&-65537|128,o):null;case 5:return Zd(o),null;case 13:if(vn(jn),s=o.memoizedState,s!==null&&s.dehydrated!==null){if(o.alternate===null)throw Error(n(340));Io()}return s=o.flags,s&65536?(o.flags=s&-65537|128,o):null;case 19:return vn(jn),null;case 4:return Fo(),null;case 10:return Kd(o.type._context),null;case 22:case 23:return Lh(),null;case 24:return null;default:return null}}var Nc=!1,lr=!1,aP=typeof WeakSet=="function"?WeakSet:Set,st=null;function Oo(s,o){var d=s.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(m){Rn(s,o,m)}else d.current=null}function xh(s,o,d){try{d()}catch(m){Rn(s,o,m)}}var Kb=!1;function lP(s,o){if(Ld=wo,s=Ng(),jd(s)){if("selectionStart"in s)var d={start:s.selectionStart,end:s.selectionEnd};else e:{d=(d=s.ownerDocument)&&d.defaultView||window;var m=d.getSelection&&d.getSelection();if(m&&m.rangeCount!==0){d=m.anchorNode;var v=m.anchorOffset,k=m.focusNode;m=m.focusOffset;try{d.nodeType,k.nodeType}catch{d=null;break e}var T=0,H=-1,te=-1,pe=0,Re=0,Ae=s,Pe=null;t:for(;;){for(var Je;Ae!==d||v!==0&&Ae.nodeType!==3||(H=T+v),Ae!==k||m!==0&&Ae.nodeType!==3||(te=T+m),Ae.nodeType===3&&(T+=Ae.nodeValue.length),(Je=Ae.firstChild)!==null;)Pe=Ae,Ae=Je;for(;;){if(Ae===s)break t;if(Pe===d&&++pe===v&&(H=T),Pe===k&&++Re===m&&(te=T),(Je=Ae.nextSibling)!==null)break;Ae=Pe,Pe=Ae.parentNode}Ae=Je}d=H===-1||te===-1?null:{start:H,end:te}}else d=null}d=d||{start:0,end:0}}else d=null;for(Md={focusedElem:s,selectionRange:d},wo=!1,st=o;st!==null;)if(o=st,s=o.child,(o.subtreeFlags&1028)!==0&&s!==null)s.return=o,st=s;else for(;st!==null;){o=st;try{var at=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(at!==null){var ht=at.memoizedProps,In=at.memoizedState,ue=o.stateNode,ae=ue.getSnapshotBeforeUpdate(o.elementType===o.type?ht:ni(o.type,ht),In);ue.__reactInternalSnapshotBeforeUpdate=ae}break;case 3:var he=o.stateNode.containerInfo;he.nodeType===1?he.textContent="":he.nodeType===9&&he.documentElement&&he.removeChild(he.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(Oe){Rn(o,o.return,Oe)}if(s=o.sibling,s!==null){s.return=o.return,st=s;break}st=o.return}return at=Kb,Kb=!1,at}function qa(s,o,d){var m=o.updateQueue;if(m=m!==null?m.lastEffect:null,m!==null){var v=m=m.next;do{if((v.tag&s)===s){var k=v.destroy;v.destroy=void 0,k!==void 0&&xh(o,d,k)}v=v.next}while(v!==m)}}function Pc(s,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var d=o=o.next;do{if((d.tag&s)===s){var m=d.create;d.destroy=m()}d=d.next}while(d!==o)}}function kh(s){var o=s.ref;if(o!==null){var d=s.stateNode;switch(s.tag){case 5:s=d;break;default:s=d}typeof o=="function"?o(s):o.current=s}}function Qb(s){var o=s.alternate;o!==null&&(s.alternate=null,Qb(o)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(o=s.stateNode,o!==null&&(delete o[pi],delete o[La],delete o[Od],delete o[q0],delete o[$0])),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 Yb(s){return s.tag===5||s.tag===3||s.tag===4}function Xb(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||Yb(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 Sh(s,o,d){var m=s.tag;if(m===5||m===6)s=s.stateNode,o?d.nodeType===8?d.parentNode.insertBefore(s,o):d.insertBefore(s,o):(d.nodeType===8?(o=d.parentNode,o.insertBefore(s,d)):(o=d,o.appendChild(s)),d=d._reactRootContainer,d!=null||o.onclick!==null||(o.onclick=ic));else if(m!==4&&(s=s.child,s!==null))for(Sh(s,o,d),s=s.sibling;s!==null;)Sh(s,o,d),s=s.sibling}function Ch(s,o,d){var m=s.tag;if(m===5||m===6)s=s.stateNode,o?d.insertBefore(s,o):d.appendChild(s);else if(m!==4&&(s=s.child,s!==null))for(Ch(s,o,d),s=s.sibling;s!==null;)Ch(s,o,d),s=s.sibling}var nr=null,ri=!1;function ss(s,o,d){for(d=d.child;d!==null;)Jb(s,o,d),d=d.sibling}function Jb(s,o,d){if(dn&&typeof dn.onCommitFiberUnmount=="function")try{dn.onCommitFiberUnmount(ut,d)}catch{}switch(d.tag){case 5:lr||Oo(d,o);case 6:var m=nr,v=ri;nr=null,ss(s,o,d),nr=m,ri=v,nr!==null&&(ri?(s=nr,d=d.stateNode,s.nodeType===8?s.parentNode.removeChild(d):s.removeChild(d)):nr.removeChild(d.stateNode));break;case 18:nr!==null&&(ri?(s=nr,d=d.stateNode,s.nodeType===8?_d(s.parentNode,d):s.nodeType===1&&_d(s,d),Ti(s)):_d(nr,d.stateNode));break;case 4:m=nr,v=ri,nr=d.stateNode.containerInfo,ri=!0,ss(s,o,d),nr=m,ri=v;break;case 0:case 11:case 14:case 15:if(!lr&&(m=d.updateQueue,m!==null&&(m=m.lastEffect,m!==null))){v=m=m.next;do{var k=v,T=k.destroy;k=k.tag,T!==void 0&&((k&2)!==0||(k&4)!==0)&&xh(d,o,T),v=v.next}while(v!==m)}ss(s,o,d);break;case 1:if(!lr&&(Oo(d,o),m=d.stateNode,typeof m.componentWillUnmount=="function"))try{m.props=d.memoizedProps,m.state=d.memoizedState,m.componentWillUnmount()}catch(H){Rn(d,o,H)}ss(s,o,d);break;case 21:ss(s,o,d);break;case 22:d.mode&1?(lr=(m=lr)||d.memoizedState!==null,ss(s,o,d),lr=m):ss(s,o,d);break;default:ss(s,o,d)}}function Zb(s){var o=s.updateQueue;if(o!==null){s.updateQueue=null;var d=s.stateNode;d===null&&(d=s.stateNode=new aP),o.forEach(function(m){var v=bP.bind(null,s,m);d.has(m)||(d.add(m),m.then(v,v))})}}function ii(s,o){var d=o.deletions;if(d!==null)for(var m=0;m<d.length;m++){var v=d[m];try{var k=s,T=o,H=T;e:for(;H!==null;){switch(H.tag){case 5:nr=H.stateNode,ri=!1;break e;case 3:nr=H.stateNode.containerInfo,ri=!0;break e;case 4:nr=H.stateNode.containerInfo,ri=!0;break e}H=H.return}if(nr===null)throw Error(n(160));Jb(k,T,v),nr=null,ri=!1;var te=v.alternate;te!==null&&(te.return=null),v.return=null}catch(pe){Rn(v,o,pe)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)ey(o,s),o=o.sibling}function ey(s,o){var d=s.alternate,m=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:if(ii(o,s),yi(s),m&4){try{qa(3,s,s.return),Pc(3,s)}catch(ht){Rn(s,s.return,ht)}try{qa(5,s,s.return)}catch(ht){Rn(s,s.return,ht)}}break;case 1:ii(o,s),yi(s),m&512&&d!==null&&Oo(d,d.return);break;case 5:if(ii(o,s),yi(s),m&512&&d!==null&&Oo(d,d.return),s.flags&32){var v=s.stateNode;try{dt(v,"")}catch(ht){Rn(s,s.return,ht)}}if(m&4&&(v=s.stateNode,v!=null)){var k=s.memoizedProps,T=d!==null?d.memoizedProps:k,H=s.type,te=s.updateQueue;if(s.updateQueue=null,te!==null)try{H==="input"&&k.type==="radio"&&k.name!=null&&xt(v,k),vt(H,T);var pe=vt(H,k);for(T=0;T<te.length;T+=2){var Re=te[T],Ae=te[T+1];Re==="style"?mt(v,Ae):Re==="dangerouslySetInnerHTML"?qe(v,Ae):Re==="children"?dt(v,Ae):O(v,Re,Ae,pe)}switch(H){case"input":Dt(v,k);break;case"textarea":Lt(v,k);break;case"select":var Pe=v._wrapperState.wasMultiple;v._wrapperState.wasMultiple=!!k.multiple;var Je=k.value;Je!=null?kt(v,!!k.multiple,Je,!1):Pe!==!!k.multiple&&(k.defaultValue!=null?kt(v,!!k.multiple,k.defaultValue,!0):kt(v,!!k.multiple,k.multiple?[]:"",!1))}v[La]=k}catch(ht){Rn(s,s.return,ht)}}break;case 6:if(ii(o,s),yi(s),m&4){if(s.stateNode===null)throw Error(n(162));v=s.stateNode,k=s.memoizedProps;try{v.nodeValue=k}catch(ht){Rn(s,s.return,ht)}}break;case 3:if(ii(o,s),yi(s),m&4&&d!==null&&d.memoizedState.isDehydrated)try{Ti(o.containerInfo)}catch(ht){Rn(s,s.return,ht)}break;case 4:ii(o,s),yi(s);break;case 13:ii(o,s),yi(s),v=s.child,v.flags&8192&&(k=v.memoizedState!==null,v.stateNode.isHidden=k,!k||v.alternate!==null&&v.alternate.memoizedState!==null||(Ph=Be())),m&4&&Zb(s);break;case 22:if(Re=d!==null&&d.memoizedState!==null,s.mode&1?(lr=(pe=lr)||Re,ii(o,s),lr=pe):ii(o,s),yi(s),m&8192){if(pe=s.memoizedState!==null,(s.stateNode.isHidden=pe)&&!Re&&(s.mode&1)!==0)for(st=s,Re=s.child;Re!==null;){for(Ae=st=Re;st!==null;){switch(Pe=st,Je=Pe.child,Pe.tag){case 0:case 11:case 14:case 15:qa(4,Pe,Pe.return);break;case 1:Oo(Pe,Pe.return);var at=Pe.stateNode;if(typeof at.componentWillUnmount=="function"){m=Pe,d=Pe.return;try{o=m,at.props=o.memoizedProps,at.state=o.memoizedState,at.componentWillUnmount()}catch(ht){Rn(m,d,ht)}}break;case 5:Oo(Pe,Pe.return);break;case 22:if(Pe.memoizedState!==null){ry(Ae);continue}}Je!==null?(Je.return=Pe,st=Je):ry(Ae)}Re=Re.sibling}e:for(Re=null,Ae=s;;){if(Ae.tag===5){if(Re===null){Re=Ae;try{v=Ae.stateNode,pe?(k=v.style,typeof k.setProperty=="function"?k.setProperty("display","none","important"):k.display="none"):(H=Ae.stateNode,te=Ae.memoizedProps.style,T=te!=null&&te.hasOwnProperty("display")?te.display:null,H.style.display=Ut("display",T))}catch(ht){Rn(s,s.return,ht)}}}else if(Ae.tag===6){if(Re===null)try{Ae.stateNode.nodeValue=pe?"":Ae.memoizedProps}catch(ht){Rn(s,s.return,ht)}}else if((Ae.tag!==22&&Ae.tag!==23||Ae.memoizedState===null||Ae===s)&&Ae.child!==null){Ae.child.return=Ae,Ae=Ae.child;continue}if(Ae===s)break e;for(;Ae.sibling===null;){if(Ae.return===null||Ae.return===s)break e;Re===Ae&&(Re=null),Ae=Ae.return}Re===Ae&&(Re=null),Ae.sibling.return=Ae.return,Ae=Ae.sibling}}break;case 19:ii(o,s),yi(s),m&4&&Zb(s);break;case 21:break;default:ii(o,s),yi(s)}}function yi(s){var o=s.flags;if(o&2){try{e:{for(var d=s.return;d!==null;){if(Yb(d)){var m=d;break e}d=d.return}throw Error(n(160))}switch(m.tag){case 5:var v=m.stateNode;m.flags&32&&(dt(v,""),m.flags&=-33);var k=Xb(s);Ch(s,k,v);break;case 3:case 4:var T=m.stateNode.containerInfo,H=Xb(s);Sh(s,H,T);break;default:throw Error(n(161))}}catch(te){Rn(s,s.return,te)}s.flags&=-3}o&4096&&(s.flags&=-4097)}function cP(s,o,d){st=s,ty(s)}function ty(s,o,d){for(var m=(s.mode&1)!==0;st!==null;){var v=st,k=v.child;if(v.tag===22&&m){var T=v.memoizedState!==null||Nc;if(!T){var H=v.alternate,te=H!==null&&H.memoizedState!==null||lr;H=Nc;var pe=lr;if(Nc=T,(lr=te)&&!pe)for(st=v;st!==null;)T=st,te=T.child,T.tag===22&&T.memoizedState!==null?iy(v):te!==null?(te.return=T,st=te):iy(v);for(;k!==null;)st=k,ty(k),k=k.sibling;st=v,Nc=H,lr=pe}ny(s)}else(v.subtreeFlags&8772)!==0&&k!==null?(k.return=v,st=k):ny(s)}}function ny(s){for(;st!==null;){var o=st;if((o.flags&8772)!==0){var d=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:lr||Pc(5,o);break;case 1:var m=o.stateNode;if(o.flags&4&&!lr)if(d===null)m.componentDidMount();else{var v=o.elementType===o.type?d.memoizedProps:ni(o.type,d.memoizedProps);m.componentDidUpdate(v,d.memoizedState,m.__reactInternalSnapshotBeforeUpdate)}var k=o.updateQueue;k!==null&&rb(o,k,m);break;case 3:var T=o.updateQueue;if(T!==null){if(d=null,o.child!==null)switch(o.child.tag){case 5:d=o.child.stateNode;break;case 1:d=o.child.stateNode}rb(o,T,d)}break;case 5:var H=o.stateNode;if(d===null&&o.flags&4){d=H;var te=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":te.autoFocus&&d.focus();break;case"img":te.src&&(d.src=te.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var pe=o.alternate;if(pe!==null){var Re=pe.memoizedState;if(Re!==null){var Ae=Re.dehydrated;Ae!==null&&Ti(Ae)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}lr||o.flags&512&&kh(o)}catch(Pe){Rn(o,o.return,Pe)}}if(o===s){st=null;break}if(d=o.sibling,d!==null){d.return=o.return,st=d;break}st=o.return}}function ry(s){for(;st!==null;){var o=st;if(o===s){st=null;break}var d=o.sibling;if(d!==null){d.return=o.return,st=d;break}st=o.return}}function iy(s){for(;st!==null;){var o=st;try{switch(o.tag){case 0:case 11:case 15:var d=o.return;try{Pc(4,o)}catch(te){Rn(o,d,te)}break;case 1:var m=o.stateNode;if(typeof m.componentDidMount=="function"){var v=o.return;try{m.componentDidMount()}catch(te){Rn(o,v,te)}}var k=o.return;try{kh(o)}catch(te){Rn(o,k,te)}break;case 5:var T=o.return;try{kh(o)}catch(te){Rn(o,T,te)}}}catch(te){Rn(o,o.return,te)}if(o===s){st=null;break}var H=o.sibling;if(H!==null){H.return=o.return,st=H;break}st=o.return}}var uP=Math.ceil,Tc=ee.ReactCurrentDispatcher,jh=ee.ReactCurrentOwner,Hr=ee.ReactCurrentBatchConfig,ln=0,Zn=null,Mn=null,rr=0,Ir=0,Bo=es(0),$n=0,$a=null,Vs=0,Rc=0,Nh=0,Va=null,vr=null,Ph=0,Uo=1/0,Bi=null,Ec=!1,Th=null,os=null,Ac=!1,as=null,Ic=0,Ga=0,Rh=null,Lc=-1,Mc=0;function fr(){return(ln&6)!==0?Be():Lc!==-1?Lc:Lc=Be()}function ls(s){return(s.mode&1)===0?1:(ln&2)!==0&&rr!==0?rr&-rr:G0.transition!==null?(Mc===0&&(Mc=bo()),Mc):(s=sn,s!==0||(s=window.event,s=s===void 0?16:Yl(s.type)),s)}function si(s,o,d,m){if(50<Ga)throw Ga=0,Rh=null,Error(n(185));di(s,d,m),((ln&2)===0||s!==Zn)&&(s===Zn&&((ln&2)===0&&(Rc|=d),$n===4&&cs(s,rr)),wr(s,m),d===1&&ln===0&&(o.mode&1)===0&&(Uo=Be()+500,lc&&ns()))}function wr(s,o){var d=s.callbackNode;on(s,o);var m=qt(s,s===Zn?rr:0);if(m===0)d!==null&&me(d),s.callbackNode=null,s.callbackPriority=0;else if(o=m&-m,s.callbackPriority!==o){if(d!=null&&me(d),o===1)s.tag===0?V0(oy.bind(null,s)):$g(oy.bind(null,s)),z0(function(){(ln&6)===0&&ns()}),d=null;else{switch(Or(m)){case 1:d=Ht;break;case 4:d=K;break;case 16:d=Ce;break;case 536870912:d=Ge;break;default:d=Ce}d=my(d,sy.bind(null,s))}s.callbackPriority=o,s.callbackNode=d}}function sy(s,o){if(Lc=-1,Mc=0,(ln&6)!==0)throw Error(n(327));var d=s.callbackNode;if(Wo()&&s.callbackNode!==d)return null;var m=qt(s,s===Zn?rr:0);if(m===0)return null;if((m&30)!==0||(m&s.expiredLanes)!==0||o)o=Dc(s,m);else{o=m;var v=ln;ln|=2;var k=ly();(Zn!==s||rr!==o)&&(Bi=null,Uo=Be()+500,Ks(s,o));do try{fP();break}catch(H){ay(s,H)}while(!0);Gd(),Tc.current=k,ln=v,Mn!==null?o=0:(Zn=null,rr=0,o=$n)}if(o!==0){if(o===2&&(v=Xr(s),v!==0&&(m=v,o=Eh(s,v))),o===1)throw d=$a,Ks(s,0),cs(s,m),wr(s,Be()),d;if(o===6)cs(s,m);else{if(v=s.current.alternate,(m&30)===0&&!dP(v)&&(o=Dc(s,m),o===2&&(k=Xr(s),k!==0&&(m=k,o=Eh(s,k))),o===1))throw d=$a,Ks(s,0),cs(s,m),wr(s,Be()),d;switch(s.finishedWork=v,s.finishedLanes=m,o){case 0:case 1:throw Error(n(345));case 2:Qs(s,vr,Bi);break;case 3:if(cs(s,m),(m&130023424)===m&&(o=Ph+500-Be(),10<o)){if(qt(s,0)!==0)break;if(v=s.suspendedLanes,(v&m)!==m){fr(),s.pingedLanes|=s.suspendedLanes&v;break}s.timeoutHandle=Fd(Qs.bind(null,s,vr,Bi),o);break}Qs(s,vr,Bi);break;case 4:if(cs(s,m),(m&4194240)===m)break;for(o=s.eventTimes,v=-1;0<m;){var T=31-j(m);k=1<<T,T=o[T],T>v&&(v=T),m&=~k}if(m=v,m=Be()-m,m=(120>m?120:480>m?480:1080>m?1080:1920>m?1920:3e3>m?3e3:4320>m?4320:1960*uP(m/1960))-m,10<m){s.timeoutHandle=Fd(Qs.bind(null,s,vr,Bi),m);break}Qs(s,vr,Bi);break;case 5:Qs(s,vr,Bi);break;default:throw Error(n(329))}}}return wr(s,Be()),s.callbackNode===d?sy.bind(null,s):null}function Eh(s,o){var d=Va;return s.current.memoizedState.isDehydrated&&(Ks(s,o).flags|=256),s=Dc(s,o),s!==2&&(o=vr,vr=d,o!==null&&Ah(o)),s}function Ah(s){vr===null?vr=s:vr.push.apply(vr,s)}function dP(s){for(var o=s;;){if(o.flags&16384){var d=o.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var m=0;m<d.length;m++){var v=d[m],k=v.getSnapshot;v=v.value;try{if(!ei(k(),v))return!1}catch{return!1}}}if(d=o.child,o.subtreeFlags&16384&&d!==null)d.return=o,o=d;else{if(o===s)break;for(;o.sibling===null;){if(o.return===null||o.return===s)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function cs(s,o){for(o&=~Nh,o&=~Rc,s.suspendedLanes|=o,s.pingedLanes&=~o,s=s.expirationTimes;0<o;){var d=31-j(o),m=1<<d;s[d]=-1,o&=~m}}function oy(s){if((ln&6)!==0)throw Error(n(327));Wo();var o=qt(s,0);if((o&1)===0)return wr(s,Be()),null;var d=Dc(s,o);if(s.tag!==0&&d===2){var m=Xr(s);m!==0&&(o=m,d=Eh(s,m))}if(d===1)throw d=$a,Ks(s,0),cs(s,o),wr(s,Be()),d;if(d===6)throw Error(n(345));return s.finishedWork=s.current.alternate,s.finishedLanes=o,Qs(s,vr,Bi),wr(s,Be()),null}function Ih(s,o){var d=ln;ln|=1;try{return s(o)}finally{ln=d,ln===0&&(Uo=Be()+500,lc&&ns())}}function Gs(s){as!==null&&as.tag===0&&(ln&6)===0&&Wo();var o=ln;ln|=1;var d=Hr.transition,m=sn;try{if(Hr.transition=null,sn=1,s)return s()}finally{sn=m,Hr.transition=d,ln=o,(ln&6)===0&&ns()}}function Lh(){Ir=Bo.current,vn(Bo)}function Ks(s,o){s.finishedWork=null,s.finishedLanes=0;var d=s.timeoutHandle;if(d!==-1&&(s.timeoutHandle=-1,W0(d)),Mn!==null)for(d=Mn.return;d!==null;){var m=d;switch(zd(m),m.tag){case 1:m=m.type.childContextTypes,m!=null&&oc();break;case 3:Fo(),vn(gr),vn(sr),th();break;case 5:Zd(m);break;case 4:Fo();break;case 13:vn(jn);break;case 19:vn(jn);break;case 10:Kd(m.type._context);break;case 22:case 23:Lh()}d=d.return}if(Zn=s,Mn=s=us(s.current,null),rr=Ir=o,$n=0,$a=null,Nh=Rc=Vs=0,vr=Va=null,Hs!==null){for(o=0;o<Hs.length;o++)if(d=Hs[o],m=d.interleaved,m!==null){d.interleaved=null;var v=m.next,k=d.pending;if(k!==null){var T=k.next;k.next=v,m.next=T}d.pending=m}Hs=null}return s}function ay(s,o){do{var d=Mn;try{if(Gd(),yc.current=kc,vc){for(var m=Nn.memoizedState;m!==null;){var v=m.queue;v!==null&&(v.pending=null),m=m.next}vc=!1}if($s=0,Jn=qn=Nn=null,Ba=!1,Ua=0,jh.current=null,d===null||d.return===null){$n=1,$a=o,Mn=null;break}e:{var k=s,T=d.return,H=d,te=o;if(o=rr,H.flags|=32768,te!==null&&typeof te=="object"&&typeof te.then=="function"){var pe=te,Re=H,Ae=Re.tag;if((Re.mode&1)===0&&(Ae===0||Ae===11||Ae===15)){var Pe=Re.alternate;Pe?(Re.updateQueue=Pe.updateQueue,Re.memoizedState=Pe.memoizedState,Re.lanes=Pe.lanes):(Re.updateQueue=null,Re.memoizedState=null)}var Je=Ib(T);if(Je!==null){Je.flags&=-257,Lb(Je,T,H,k,o),Je.mode&1&&Ab(k,pe,o),o=Je,te=pe;var at=o.updateQueue;if(at===null){var ht=new Set;ht.add(te),o.updateQueue=ht}else at.add(te);break e}else{if((o&1)===0){Ab(k,pe,o),Mh();break e}te=Error(n(426))}}else if(wn&&H.mode&1){var In=Ib(T);if(In!==null){(In.flags&65536)===0&&(In.flags|=256),Lb(In,T,H,k,o),$d(_o(te,H));break e}}k=te=_o(te,H),$n!==4&&($n=2),Va===null?Va=[k]:Va.push(k),k=T;do{switch(k.tag){case 3:k.flags|=65536,o&=-o,k.lanes|=o;var ue=Rb(k,te,o);nb(k,ue);break e;case 1:H=te;var ae=k.type,he=k.stateNode;if((k.flags&128)===0&&(typeof ae.getDerivedStateFromError=="function"||he!==null&&typeof he.componentDidCatch=="function"&&(os===null||!os.has(he)))){k.flags|=65536,o&=-o,k.lanes|=o;var Oe=Eb(k,H,o);nb(k,Oe);break e}}k=k.return}while(k!==null)}uy(d)}catch(bt){o=bt,Mn===d&&d!==null&&(Mn=d=d.return);continue}break}while(!0)}function ly(){var s=Tc.current;return Tc.current=kc,s===null?kc:s}function Mh(){($n===0||$n===3||$n===2)&&($n=4),Zn===null||(Vs&268435455)===0&&(Rc&268435455)===0||cs(Zn,rr)}function Dc(s,o){var d=ln;ln|=2;var m=ly();(Zn!==s||rr!==o)&&(Bi=null,Ks(s,o));do try{hP();break}catch(v){ay(s,v)}while(!0);if(Gd(),ln=d,Tc.current=m,Mn!==null)throw Error(n(261));return Zn=null,rr=0,$n}function hP(){for(;Mn!==null;)cy(Mn)}function fP(){for(;Mn!==null&&!We();)cy(Mn)}function cy(s){var o=fy(s.alternate,s,Ir);s.memoizedProps=s.pendingProps,o===null?uy(s):Mn=o,jh.current=null}function uy(s){var o=s;do{var d=o.alternate;if(s=o.return,(o.flags&32768)===0){if(d=sP(d,o,Ir),d!==null){Mn=d;return}}else{if(d=oP(d,o),d!==null){d.flags&=32767,Mn=d;return}if(s!==null)s.flags|=32768,s.subtreeFlags=0,s.deletions=null;else{$n=6,Mn=null;return}}if(o=o.sibling,o!==null){Mn=o;return}Mn=o=s}while(o!==null);$n===0&&($n=5)}function Qs(s,o,d){var m=sn,v=Hr.transition;try{Hr.transition=null,sn=1,mP(s,o,d,m)}finally{Hr.transition=v,sn=m}return null}function mP(s,o,d,m){do Wo();while(as!==null);if((ln&6)!==0)throw Error(n(327));d=s.finishedWork;var v=s.finishedLanes;if(d===null)return null;if(s.finishedWork=null,s.finishedLanes=0,d===s.current)throw Error(n(177));s.callbackNode=null,s.callbackPriority=0;var k=d.lanes|d.childLanes;if(Rs(s,k),s===Zn&&(Mn=Zn=null,rr=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Ac||(Ac=!0,my(Ce,function(){return Wo(),null})),k=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||k){k=Hr.transition,Hr.transition=null;var T=sn;sn=1;var H=ln;ln|=4,jh.current=null,lP(s,d),ey(d,s),M0(Md),wo=!!Ld,Md=Ld=null,s.current=d,cP(d),Qe(),ln=H,sn=T,Hr.transition=k}else s.current=d;if(Ac&&(Ac=!1,as=s,Ic=v),k=s.pendingLanes,k===0&&(os=null),An(d.stateNode),wr(s,Be()),o!==null)for(m=s.onRecoverableError,d=0;d<o.length;d++)v=o[d],m(v.value,{componentStack:v.stack,digest:v.digest});if(Ec)throw Ec=!1,s=Th,Th=null,s;return(Ic&1)!==0&&s.tag!==0&&Wo(),k=s.pendingLanes,(k&1)!==0?s===Rh?Ga++:(Ga=0,Rh=s):Ga=0,ns(),null}function Wo(){if(as!==null){var s=Or(Ic),o=Hr.transition,d=sn;try{if(Hr.transition=null,sn=16>s?16:s,as===null)var m=!1;else{if(s=as,as=null,Ic=0,(ln&6)!==0)throw Error(n(331));var v=ln;for(ln|=4,st=s.current;st!==null;){var k=st,T=k.child;if((st.flags&16)!==0){var H=k.deletions;if(H!==null){for(var te=0;te<H.length;te++){var pe=H[te];for(st=pe;st!==null;){var Re=st;switch(Re.tag){case 0:case 11:case 15:qa(8,Re,k)}var Ae=Re.child;if(Ae!==null)Ae.return=Re,st=Ae;else for(;st!==null;){Re=st;var Pe=Re.sibling,Je=Re.return;if(Qb(Re),Re===pe){st=null;break}if(Pe!==null){Pe.return=Je,st=Pe;break}st=Je}}}var at=k.alternate;if(at!==null){var ht=at.child;if(ht!==null){at.child=null;do{var In=ht.sibling;ht.sibling=null,ht=In}while(ht!==null)}}st=k}}if((k.subtreeFlags&2064)!==0&&T!==null)T.return=k,st=T;else e:for(;st!==null;){if(k=st,(k.flags&2048)!==0)switch(k.tag){case 0:case 11:case 15:qa(9,k,k.return)}var ue=k.sibling;if(ue!==null){ue.return=k.return,st=ue;break e}st=k.return}}var ae=s.current;for(st=ae;st!==null;){T=st;var he=T.child;if((T.subtreeFlags&2064)!==0&&he!==null)he.return=T,st=he;else e:for(T=ae;st!==null;){if(H=st,(H.flags&2048)!==0)try{switch(H.tag){case 0:case 11:case 15:Pc(9,H)}}catch(bt){Rn(H,H.return,bt)}if(H===T){st=null;break e}var Oe=H.sibling;if(Oe!==null){Oe.return=H.return,st=Oe;break e}st=H.return}}if(ln=v,ns(),dn&&typeof dn.onPostCommitFiberRoot=="function")try{dn.onPostCommitFiberRoot(ut,s)}catch{}m=!0}return m}finally{sn=d,Hr.transition=o}}return!1}function dy(s,o,d){o=_o(d,o),o=Rb(s,o,1),s=is(s,o,1),o=fr(),s!==null&&(di(s,1,o),wr(s,o))}function Rn(s,o,d){if(s.tag===3)dy(s,s,d);else for(;o!==null;){if(o.tag===3){dy(o,s,d);break}else if(o.tag===1){var m=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof m.componentDidCatch=="function"&&(os===null||!os.has(m))){s=_o(d,s),s=Eb(o,s,1),o=is(o,s,1),s=fr(),o!==null&&(di(o,1,s),wr(o,s));break}}o=o.return}}function pP(s,o,d){var m=s.pingCache;m!==null&&m.delete(o),o=fr(),s.pingedLanes|=s.suspendedLanes&d,Zn===s&&(rr&d)===d&&($n===4||$n===3&&(rr&130023424)===rr&&500>Be()-Ph?Ks(s,0):Nh|=d),wr(s,o)}function hy(s,o){o===0&&((s.mode&1)===0?o=1:(o=et,et<<=1,(et&130023424)===0&&(et=4194304)));var d=fr();s=Fi(s,o),s!==null&&(di(s,o,d),wr(s,d))}function gP(s){var o=s.memoizedState,d=0;o!==null&&(d=o.retryLane),hy(s,d)}function bP(s,o){var d=0;switch(s.tag){case 13:var m=s.stateNode,v=s.memoizedState;v!==null&&(d=v.retryLane);break;case 19:m=s.stateNode;break;default:throw Error(n(314))}m!==null&&m.delete(o),hy(s,d)}var fy;fy=function(s,o,d){if(s!==null)if(s.memoizedProps!==o.pendingProps||gr.current)yr=!0;else{if((s.lanes&d)===0&&(o.flags&128)===0)return yr=!1,iP(s,o,d);yr=(s.flags&131072)!==0}else yr=!1,wn&&(o.flags&1048576)!==0&&Vg(o,uc,o.index);switch(o.lanes=0,o.tag){case 2:var m=o.type;jc(s,o),s=o.pendingProps;var v=Ro(o,sr.current);Do(o,d),v=ih(null,o,m,s,v,d);var k=sh();return o.flags|=1,typeof v=="object"&&v!==null&&typeof v.render=="function"&&v.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,br(m)?(k=!0,ac(o)):k=!1,o.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,Xd(o),v.updater=Sc,o.stateNode=v,v._reactInternals=o,dh(o,m,s,d),o=ph(null,o,m,!0,k,d)):(o.tag=0,wn&&k&&Wd(o),hr(null,o,v,d),o=o.child),o;case 16:m=o.elementType;e:{switch(jc(s,o),s=o.pendingProps,v=m._init,m=v(m._payload),o.type=m,v=o.tag=vP(m),s=ni(m,s),v){case 0:o=mh(null,o,m,s,d);break e;case 1:o=Bb(null,o,m,s,d);break e;case 11:o=Mb(null,o,m,s,d);break e;case 14:o=Db(null,o,m,ni(m.type,s),d);break e}throw Error(n(306,m,""))}return o;case 0:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:ni(m,v),mh(s,o,m,v,d);case 1:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:ni(m,v),Bb(s,o,m,v,d);case 3:e:{if(Ub(o),s===null)throw Error(n(387));m=o.pendingProps,k=o.memoizedState,v=k.element,tb(s,o),gc(o,m,null,d);var T=o.memoizedState;if(m=T.element,k.isDehydrated)if(k={element:m,isDehydrated:!1,cache:T.cache,pendingSuspenseBoundaries:T.pendingSuspenseBoundaries,transitions:T.transitions},o.updateQueue.baseState=k,o.memoizedState=k,o.flags&256){v=_o(Error(n(423)),o),o=Wb(s,o,m,d,v);break e}else if(m!==v){v=_o(Error(n(424)),o),o=Wb(s,o,m,d,v);break e}else for(Ar=Zi(o.stateNode.containerInfo.firstChild),Er=o,wn=!0,ti=null,d=Zg(o,null,m,d),o.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(Io(),m===v){o=Oi(s,o,d);break e}hr(s,o,m,d)}o=o.child}return o;case 5:return ib(o),s===null&&qd(o),m=o.type,v=o.pendingProps,k=s!==null?s.memoizedProps:null,T=v.children,Dd(m,v)?T=null:k!==null&&Dd(m,k)&&(o.flags|=32),Ob(s,o),hr(s,o,T,d),o.child;case 6:return s===null&&qd(o),null;case 13:return zb(s,o,d);case 4:return Jd(o,o.stateNode.containerInfo),m=o.pendingProps,s===null?o.child=Lo(o,null,m,d):hr(s,o,m,d),o.child;case 11:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:ni(m,v),Mb(s,o,m,v,d);case 7:return hr(s,o,o.pendingProps,d),o.child;case 8:return hr(s,o,o.pendingProps.children,d),o.child;case 12:return hr(s,o,o.pendingProps.children,d),o.child;case 10:e:{if(m=o.type._context,v=o.pendingProps,k=o.memoizedProps,T=v.value,pn(fc,m._currentValue),m._currentValue=T,k!==null)if(ei(k.value,T)){if(k.children===v.children&&!gr.current){o=Oi(s,o,d);break e}}else for(k=o.child,k!==null&&(k.return=o);k!==null;){var H=k.dependencies;if(H!==null){T=k.child;for(var te=H.firstContext;te!==null;){if(te.context===m){if(k.tag===1){te=_i(-1,d&-d),te.tag=2;var pe=k.updateQueue;if(pe!==null){pe=pe.shared;var Re=pe.pending;Re===null?te.next=te:(te.next=Re.next,Re.next=te),pe.pending=te}}k.lanes|=d,te=k.alternate,te!==null&&(te.lanes|=d),Qd(k.return,d,o),H.lanes|=d;break}te=te.next}}else if(k.tag===10)T=k.type===o.type?null:k.child;else if(k.tag===18){if(T=k.return,T===null)throw Error(n(341));T.lanes|=d,H=T.alternate,H!==null&&(H.lanes|=d),Qd(T,d,o),T=k.sibling}else T=k.child;if(T!==null)T.return=k;else for(T=k;T!==null;){if(T===o){T=null;break}if(k=T.sibling,k!==null){k.return=T.return,T=k;break}T=T.return}k=T}hr(s,o,v.children,d),o=o.child}return o;case 9:return v=o.type,m=o.pendingProps.children,Do(o,d),v=Wr(v),m=m(v),o.flags|=1,hr(s,o,m,d),o.child;case 14:return m=o.type,v=ni(m,o.pendingProps),v=ni(m.type,v),Db(s,o,m,v,d);case 15:return Fb(s,o,o.type,o.pendingProps,d);case 17:return m=o.type,v=o.pendingProps,v=o.elementType===m?v:ni(m,v),jc(s,o),o.tag=1,br(m)?(s=!0,ac(o)):s=!1,Do(o,d),Pb(o,m,v),dh(o,m,v,d),ph(null,o,m,!0,s,d);case 19:return qb(s,o,d);case 22:return _b(s,o,d)}throw Error(n(156,o.tag))};function my(s,o){return $t(s,o)}function yP(s,o,d,m){this.tag=s,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=m,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function qr(s,o,d,m){return new yP(s,o,d,m)}function Dh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function vP(s){if(typeof s=="function")return Dh(s)?1:0;if(s!=null){if(s=s.$$typeof,s===G)return 11;if(s===W)return 14}return 2}function us(s,o){var d=s.alternate;return d===null?(d=qr(s.tag,o,s.key,s.mode),d.elementType=s.elementType,d.type=s.type,d.stateNode=s.stateNode,d.alternate=s,s.alternate=d):(d.pendingProps=o,d.type=s.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=s.flags&14680064,d.childLanes=s.childLanes,d.lanes=s.lanes,d.child=s.child,d.memoizedProps=s.memoizedProps,d.memoizedState=s.memoizedState,d.updateQueue=s.updateQueue,o=s.dependencies,d.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},d.sibling=s.sibling,d.index=s.index,d.ref=s.ref,d}function Fc(s,o,d,m,v,k){var T=2;if(m=s,typeof s=="function")Dh(s)&&(T=1);else if(typeof s=="string")T=5;else e:switch(s){case E:return Ys(d.children,v,k,o);case M:T=8,v|=8;break;case I:return s=qr(12,d,o,v|2),s.elementType=I,s.lanes=k,s;case J:return s=qr(13,d,o,v),s.elementType=J,s.lanes=k,s;case B:return s=qr(19,d,o,v),s.elementType=B,s.lanes=k,s;case Q:return _c(d,v,k,o);default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case N:T=10;break e;case z:T=9;break e;case G:T=11;break e;case W:T=14;break e;case Y:T=16,m=null;break e}throw Error(n(130,s==null?s:typeof s,""))}return o=qr(T,d,o,v),o.elementType=s,o.type=m,o.lanes=k,o}function Ys(s,o,d,m){return s=qr(7,s,m,o),s.lanes=d,s}function _c(s,o,d,m){return s=qr(22,s,m,o),s.elementType=Q,s.lanes=d,s.stateNode={isHidden:!1},s}function Fh(s,o,d){return s=qr(6,s,null,o),s.lanes=d,s}function _h(s,o,d){return o=qr(4,s.children!==null?s.children:[],s.key,o),o.lanes=d,o.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},o}function wP(s,o,d,m,v){this.tag=o,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=Vt(0),this.expirationTimes=Vt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vt(0),this.identifierPrefix=m,this.onRecoverableError=v,this.mutableSourceEagerHydrationData=null}function Oh(s,o,d,m,v,k,T,H,te){return s=new wP(s,o,d,H,te),o===1?(o=1,k===!0&&(o|=8)):o=0,k=qr(3,null,null,o),s.current=k,k.stateNode=s,k.memoizedState={element:m,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xd(k),s}function xP(s,o,d){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:_,key:m==null?null:""+m,children:s,containerInfo:o,implementation:d}}function py(s){if(!s)return ts;s=s._reactInternals;e:{if(xe(s)!==s||s.tag!==1)throw Error(n(170));var o=s;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(br(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(n(171))}if(s.tag===1){var d=s.type;if(br(d))return Hg(s,d,o)}return o}function gy(s,o,d,m,v,k,T,H,te){return s=Oh(d,m,!0,s,v,k,T,H,te),s.context=py(null),d=s.current,m=fr(),v=ls(d),k=_i(m,v),k.callback=o??null,is(d,k,v),s.current.lanes=v,di(s,v,m),wr(s,m),s}function Oc(s,o,d,m){var v=o.current,k=fr(),T=ls(v);return d=py(d),o.context===null?o.context=d:o.pendingContext=d,o=_i(k,T),o.payload={element:s},m=m===void 0?null:m,m!==null&&(o.callback=m),s=is(v,o,T),s!==null&&(si(s,v,T,k),pc(s,v,T)),T}function Bc(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 by(s,o){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var d=s.retryLane;s.retryLane=d!==0&&d<o?d:o}}function Bh(s,o){by(s,o),(s=s.alternate)&&by(s,o)}function kP(){return null}var yy=typeof reportError=="function"?reportError:function(s){console.error(s)};function Uh(s){this._internalRoot=s}Uc.prototype.render=Uh.prototype.render=function(s){var o=this._internalRoot;if(o===null)throw Error(n(409));Oc(s,o,null,null)},Uc.prototype.unmount=Uh.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var o=s.containerInfo;Gs(function(){Oc(null,s,null,null)}),o[Ii]=null}};function Uc(s){this._internalRoot=s}Uc.prototype.unstable_scheduleHydration=function(s){if(s){var o=Es();s={blockedOn:null,target:s,priority:o};for(var d=0;d<mi.length&&o!==0&&o<mi[d].priority;d++);mi.splice(d,0,s),d===0&&Ms(s)}};function Wh(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function Wc(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11&&(s.nodeType!==8||s.nodeValue!==" react-mount-point-unstable "))}function vy(){}function SP(s,o,d,m,v){if(v){if(typeof m=="function"){var k=m;m=function(){var pe=Bc(T);k.call(pe)}}var T=gy(o,m,s,0,null,!1,!1,"",vy);return s._reactRootContainer=T,s[Ii]=T.current,Aa(s.nodeType===8?s.parentNode:s),Gs(),T}for(;v=s.lastChild;)s.removeChild(v);if(typeof m=="function"){var H=m;m=function(){var pe=Bc(te);H.call(pe)}}var te=Oh(s,0,!1,null,null,!1,!1,"",vy);return s._reactRootContainer=te,s[Ii]=te.current,Aa(s.nodeType===8?s.parentNode:s),Gs(function(){Oc(o,te,d,m)}),te}function zc(s,o,d,m,v){var k=d._reactRootContainer;if(k){var T=k;if(typeof v=="function"){var H=v;v=function(){var te=Bc(T);H.call(te)}}Oc(o,T,s,v)}else T=SP(d,o,s,v,m);return Bc(T)}Cn=function(s){switch(s.tag){case 3:var o=s.stateNode;if(o.current.memoizedState.isDehydrated){var d=Wt(o.pendingLanes);d!==0&&(ba(o,d|1),wr(o,Be()),(ln&6)===0&&(Uo=Be()+500,ns()))}break;case 13:Gs(function(){var m=Fi(s,1);if(m!==null){var v=fr();si(m,s,1,v)}}),Bh(s,1)}},ji=function(s){if(s.tag===13){var o=Fi(s,134217728);if(o!==null){var d=fr();si(o,s,134217728,d)}Bh(s,134217728)}},ya=function(s){if(s.tag===13){var o=ls(s),d=Fi(s,o);if(d!==null){var m=fr();si(d,s,o,m)}Bh(s,o)}},Es=function(){return sn},yo=function(s,o){var d=sn;try{return sn=s,o()}finally{sn=d}},ie=function(s,o,d){switch(o){case"input":if(Dt(s,d),o=d.name,d.type==="radio"&&o!=null){for(d=s;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<d.length;o++){var m=d[o];if(m!==s&&m.form===s.form){var v=sc(m);if(!v)throw Error(n(90));Ke(m),Dt(m,v)}}}break;case"textarea":Lt(s,d);break;case"select":o=d.value,o!=null&&kt(s,!!d.multiple,o,!1)}},it=Ih,Qt=Gs;var CP={usingClientEntryPoint:!1,Events:[Ma,Po,sc,nn,ke,Ih]},Ka={findFiberByHostInstance:Bs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},jP={bundleType:Ka.bundleType,version:Ka.version,rendererPackageName:Ka.rendererPackageName,rendererConfig:Ka.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:ee.ReactCurrentDispatcher,findHostInstanceByFiber:function(s){return s=Ct(s),s===null?null:s.stateNode},findFiberByHostInstance:Ka.findFiberByHostInstance||kP,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 Hc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hc.isDisabled&&Hc.supportsFiber)try{ut=Hc.inject(jP),dn=Hc}catch{}}return xr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=CP,xr.createPortal=function(s,o){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Wh(o))throw Error(n(200));return xP(s,o,null,d)},xr.createRoot=function(s,o){if(!Wh(s))throw Error(n(299));var d=!1,m="",v=yy;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onRecoverableError!==void 0&&(v=o.onRecoverableError)),o=Oh(s,1,!1,null,null,d,!1,m,v),s[Ii]=o.current,Aa(s.nodeType===8?s.parentNode:s),new Uh(o)},xr.findDOMNode=function(s){if(s==null)return null;if(s.nodeType===1)return s;var o=s._reactInternals;if(o===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=Ct(o),s=s===null?null:s.stateNode,s},xr.flushSync=function(s){return Gs(s)},xr.hydrate=function(s,o,d){if(!Wc(o))throw Error(n(200));return zc(null,s,o,!0,d)},xr.hydrateRoot=function(s,o,d){if(!Wh(s))throw Error(n(405));var m=d!=null&&d.hydratedSources||null,v=!1,k="",T=yy;if(d!=null&&(d.unstable_strictMode===!0&&(v=!0),d.identifierPrefix!==void 0&&(k=d.identifierPrefix),d.onRecoverableError!==void 0&&(T=d.onRecoverableError)),o=gy(o,null,s,1,d??null,v,!1,k,T),s[Ii]=o.current,Aa(s),m)for(s=0;s<m.length;s++)d=m[s],v=d._getVersion,v=v(d._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[d,v]:o.mutableSourceEagerHydrationData.push(d,v);return new Uc(o)},xr.render=function(s,o,d){if(!Wc(o))throw Error(n(200));return zc(null,s,o,!1,d)},xr.unmountComponentAtNode=function(s){if(!Wc(s))throw Error(n(40));return s._reactRootContainer?(Gs(function(){zc(null,null,s,!1,function(){s._reactRootContainer=null,s[Ii]=null})}),!0):!1},xr.unstable_batchedUpdates=Ih,xr.unstable_renderSubtreeIntoContainer=function(s,o,d,m){if(!Wc(d))throw Error(n(200));if(s==null||s._reactInternals===void 0)throw Error(n(38));return zc(s,o,d,!1,m)},xr.version="18.3.1-next-f1338f8080-20240426",xr}var Py;function Ik(){if(Py)return qh.exports;Py=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(),qh.exports=MP(),qh.exports}var Ty;function DP(){if(Ty)return qc;Ty=1;var e=Ik();return qc.createRoot=e.createRoot,qc.hydrateRoot=e.hydrateRoot,qc}var FP=DP();const _P=Ll(FP);var b=$m();const OP=Ll(b),BP=Ak({__proto__:null,default:OP},[b]);function UP(e){return e==="http:"||e==="https:"}function Vi(e){const t=e.trim();if(!t)throw new Error("EMPTY_SERVER_URL");const n=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//.test(t)?t:`http://${t}`,i=new URL(n);if(!UP(i.protocol))throw new Error("INVALID_SERVER_PROTOCOL");i.hash="",i.search="";const a=i.pathname.replace(/\/+$/,"");return`${i.origin}${a==="/"?"":a}`}const Jo="codingns.auth.remembered-login";function Vm(){return typeof window<"u"&&typeof window.localStorage<"u"}function WP(e){return e.isNativeMobile?!0:e.isDesktop?e.ui.osFamily==="windows"||e.ui.osFamily==="macos":!1}function Lk(){if(!Vm())return null;const e=window.localStorage.getItem(Jo);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(Jo),null;const n=t.username.trim(),i=t.password,a=Vi(t.serverBaseUrl);return!n||!i?(window.localStorage.removeItem(Jo),null):{username:n,password:i,serverBaseUrl:a}}catch{return window.localStorage.removeItem(Jo),null}}function Mk(e){if(!Vm())return;const t={username:e.username.trim(),password:e.password,serverBaseUrl:Vi(e.serverBaseUrl)};window.localStorage.setItem(Jo,JSON.stringify(t))}function zP(e){const t=Lk();t&&Mk({...t,serverBaseUrl:e})}function HP(){Vm()&&window.localStorage.removeItem(Jo)}function Dk(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 qP(e){return{windowId:e.windowId,kind:e.kind,workspaceId:e.workspaceId??null,sessionId:e.sessionId??null,mode:e.mode??"docked",bounds:Dk(e.bounds),focusOwner:e.focusOwner??null}}function Yo(e){return{...e,bounds:{...e.bounds}}}function $P(e){return{descriptors:Object.fromEntries(Object.entries(e.descriptors).map(([n,i])=>[n,Yo(i)])),openWindowIds:[...e.openWindowIds],lastActiveWindowId:e.lastActiveWindowId}}function Ry(){return{descriptors:{},openWindowIds:[],lastActiveWindowId:null}}function VP(e,t){return{...e,...t,windowId:e.windowId,bounds:Dk({...e.bounds,...t.bounds})}}class GP{constructor(){He(this,"state",Ry());He(this,"listeners",new Set);He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>$P(this.state))}registerDescriptor(t){const n=Yo(t),i=this.state.openWindowIds.includes(n.windowId);return this.state={...this.state,descriptors:{...this.state.descriptors,[n.windowId]:n},lastActiveWindowId:i?n.windowId:this.state.lastActiveWindowId},this.emit(),Yo(n)}updateDescriptor(t,n){const i=this.state.descriptors[t];if(!i)return null;const a=VP(i,n);return this.state={...this.state,descriptors:{...this.state.descriptors,[t]:a}},this.emit(),Yo(a)}getDescriptor(t){const n=this.state.descriptors[t];return n?Yo(n):null}getWindows(){return Object.values(this.state.descriptors).map(t=>({descriptor:Yo(t),isOpen:this.state.openWindowIds.includes(t.windowId)}))}markWindowOpen(t){if(!this.state.descriptors[t])return!1;const n=this.state.openWindowIds.filter(i=>i!==t);return this.state={...this.state,openWindowIds:[...n,t],lastActiveWindowId:t},this.emit(),!0}markWindowClosed(t){if(!this.state.openWindowIds.includes(t))return!1;const n=this.state.openWindowIds.filter(i=>i!==t);return this.state={...this.state,openWindowIds:n,lastActiveWindowId:this.state.lastActiveWindowId===t?n.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 n={...this.state.descriptors};delete n[t];const i=this.state.openWindowIds.filter(a=>a!==t);return this.state={descriptors:n,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=Ry(),t&&this.emit()}emit(){for(const t of this.listeners)t()}}function KP(){return new GP}const QP=KP();function YP(){return QP}const XP=YP();function Fk(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function _k(){var c,l;if(typeof navigator>"u")return"unknown";const e=navigator.userAgent.toLowerCase(),t=navigator.userAgentData,n=((c=t==null?void 0:t.platform)==null?void 0:c.toLowerCase())??((l=navigator.platform)==null?void 0:l.toLowerCase())??"",i=`${n} ${e}`,a=n.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 JP(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 ZP(e){const t=JP(e);return t<768?"compact":t<1024?"medium":"expanded"}function eT(e){const t=_k();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 Ln(e){return{ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:e}}async function Dn(e,t){return Ok(e,t)}async function Ok(e,t){if(!Fk())return Ln("当前运行环境不支持桌面壳能力。");try{return{ok:!0,value:await window.__TAURI_INTERNALS__.invoke(e,t)}}catch(n){return{ok:!1,errorCode:"SHELL_BRIDGE_ERROR",detail:n instanceof Error?n.message:"桌面壳调用失败。"}}}function tT(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 Bk(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}async function Uk(e){if(Bk())try{navigator.vibrate(tT(e))}catch{return}}async function Wk(e,t){if(typeof window>"u"||typeof Notification>"u")return Ln("当前环境不支持系统通知。");try{if(Notification.permission==="default"&&await Notification.requestPermission()!=="granted"||Notification.permission!=="granted")return Ln("系统通知权限未授予。");const n=new Notification(e,{body:t});return n.onerror=()=>{},{ok:!0}}catch(n){return{ok:!1,errorCode:"NOTIFICATION_FAILED",detail:n instanceof Error?n.message:"系统通知发送失败。"}}}class nT{constructor(){He(this,"supported",!1)}openExternal(t){return typeof window>"u"?Promise.resolve(Ln("当前环境无法打开外部链接。")):(window.open(t,"_blank","noopener,noreferrer"),Promise.resolve({ok:!0}))}showNotification(t,n){return Wk(t,n)}writeClipboardText(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}setWindowState(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}readDesktopConfig(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}writeDesktopConfig(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}getRuntimeInfo(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}checkForUpdate(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}installUpdate(){return Promise.resolve({ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前不是桌面端运行环境。"})}rollbackToPreviousVersion(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}pickDirectory(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}createWindow(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}closeWindow(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}focusWindow(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}listWindows(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}isWindowOpen(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}getWindowDescriptor(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}syncWindowDescriptor(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}updateWindowBounds(){return Promise.resolve(Ln("当前不是桌面端运行环境。"))}}class rT{constructor(){He(this,"supported",Bk())}trigger(t){return Uk(t)}}class iT{constructor(){He(this,"supported",!0)}openExternal(t){return Dn("open_external",{url:t})}async showNotification(t,n){const i=await Wk(t,n);return i.ok?i:Dn("show_notification",{title:t,body:n})}writeClipboardText(t){return Dn("copy_text",{text:t})}setWindowState(t){return Dn("set_window_state",{state:t})}readDesktopConfig(){return Dn("read_desktop_config")}writeDesktopConfig(t){return Dn("write_desktop_config",{patch:t})}getRuntimeInfo(){return Dn("get_runtime_info")}checkForUpdate(t){return Dn("check_for_update",{channel:t})}async installUpdate(t){const n=await Dn("install_update",{manifest:t});return n.ok?n.value??{ok:!0}:{ok:!1,errorCode:n.errorCode,detail:n.detail}}rollbackToPreviousVersion(){return Dn("rollback_to_previous_version")}pickDirectory(){return Dn("pick_directory")}createWindow(t){return Dn("create_window",{descriptor:t})}closeWindow(t){return Dn("close_window",{windowId:t})}focusWindow(t){return Dn("focus_window",{windowId:t})}listWindows(){return Dn("list_windows")}isWindowOpen(t){return Dn("is_window_open",{windowId:t})}getWindowDescriptor(t){return typeof t=="string"?Dn("get_window_descriptor",{windowId:t}):Dn("get_window_descriptor")}syncWindowDescriptor(t){return Dn("sync_window_descriptor",{descriptor:t})}updateWindowBounds(t,n){return Dn("update_window_bounds",{windowId:t,bounds:n})}}class sT{constructor(){He(this,"supported",!0)}async trigger(t){(await Ok("perform_haptic_feedback",{kind:t})).ok||await Uk(t)}}function zk(){if(!Fk())return"web";const e=_k();return e==="ios"?"ios":e==="android"?"android":"desktop"}function Si(e={}){const t=zk(),n=ZP(e.viewportWidth),i=t==="ios"||t==="android";return{platform:t,isDesktop:t==="desktop",isWeb:t==="web",isMobile:n!=="expanded",isNativeMobile:i,viewportClass:n,ui:eT(t),bridge:t==="desktop"?new iT:new nT,windows:XP,haptics:i?new sT:new rT}}const rm="codingns.client.runtime-config";function Gm(e){return e==="desktop"||e==="ios"||e==="android"}function Hk(e){return e==="en"||e==="en-US"?"en-US":"zh-CN"}function oT(){return typeof navigator>"u"?"zh-CN":Hk(navigator.language)}function aT(e){return e==="acceptEdits"||e==="bypassPermissions"?e:"default"}function qk(){return typeof window<"u"&&typeof window.localStorage<"u"}function lT(){if(!qk())return null;const e=window.localStorage.getItem(rm);if(!e)return null;try{return JSON.parse(e)}catch{return window.localStorage.removeItem(rm),null}}function $k(e){qk()&&window.localStorage.setItem(rm,JSON.stringify(e))}function cT(){var e;return typeof window>"u"||!((e=window.location)!=null&&e.origin)?null:window.location.origin}function uT(e){if(!e)return null;try{return Vi(e)}catch{return null}}function Km(e){if(e==="web"){const t=uT(cT());if(t)return t}return Vi("http://127.0.0.1:3002")}function dT(e){return{platform:e,hostBaseUrl:Km(e),releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:oT(),defaultPermissionMode:"default"}}function im(e,t){if(!t)return e;const n=t.platform??e.platform;return{...e,...t,hostBaseUrl:Gm(n)?t.hostBaseUrl?Vi(t.hostBaseUrl):e.hostBaseUrl:Km(n),platform:n,releaseChannel:t.releaseChannel??e.releaseChannel,autoReconnect:t.autoReconnect??e.autoReconnect,autoCheckUpdate:t.autoCheckUpdate??e.autoCheckUpdate,language:Hk(t.language??e.language),defaultPermissionMode:aT(t.defaultPermissionMode??e.defaultPermissionMode)}}async function hT(){const e=Si(),t=dT(e.platform),n=lT();let i=null;if(e.isDesktop){const c=await e.bridge.readDesktopConfig();c.ok&&c.value&&(i=c.value)}const a=im(im(t,n),i);return $k(a),a}async function fT(e,t){const n=im(e,t);$k(n),zP(n.hostBaseUrl);const i=Si();return i.isDesktop&&await i.bridge.writeDesktopConfig(n),n}function mT(){const e=zk();return{platform:e,hostBaseUrl:Km(e),releaseChannel:"stable",autoReconnect:!0,autoCheckUpdate:e==="desktop",language:"zh-CN",defaultPermissionMode:"default"}}class pT{constructor(){He(this,"state",mT());He(this,"listeners",new Set);He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state)}hydrate(t){this.state=t,this.emit()}async initialize(){const t=await hT();return this.hydrate(t),t}async update(t){const n=await fT(this.state,t);return this.hydrate(n),n}emit(){for(const t of this.listeners)t()}}const Gn=new pT;function gT(e){return b.useSyncExternalStore(Gn.subscribe,()=>e(Gn.getState()))}function bT(e){return e.endsWith("/")?e:`${e}/`}function yT(e){return e.replace(/^\/+/,"")}function vl(){return Gn.getState().hostBaseUrl}function Qm(e,t=vl()){return new URL(yT(e),bT(t)).toString()}function Vk(e,t=vl()){const n=new URL(Qm(e,t));return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.toString()}class mr extends Error{constructor(n,i){super(i.detail);He(this,"status");He(this,"errorCode");He(this,"field");this.name="ApiError",this.status=n,this.errorCode=i.error_code,this.field=i.field}}class vT{async request(t,n={}){const i=await this.performRequest(t,n);if(i.status===204||i.status===205)return;const a=await i.text();if(a)return JSON.parse(a)}async requestBlob(t,n={}){return(await this.performRequest(t,n)).blob()}async performRequest(t,n){var h;const i=new Headers(n.headers),a=n.body!==void 0&&n.body!==null,c=Qm(t,n.baseUrl??vl());if(a&&!i.has("Content-Type")&&i.set("Content-Type","application/json"),!n.skipAuth){const f=(h=kn.getState().session)==null?void 0:h.accessToken;if(!f)throw kn.clear(),new mr(401,{detail:"当前没有可用的登录态",error_code:"UNAUTHORIZED"});i.set("Authorization",`Bearer ${f}`)}let l;try{l=await fetch(c,{...n,headers:i})}catch(f){const p=f instanceof Error?f.message:"未知网络错误";throw new mr(0,{detail:`请求 ${c} 失败:${p}`,error_code:"NETWORK_ERROR"})}if(!l.ok){const f=await wT(l);if(Gk(l.status,f.error_code)&&!n.skipAuth&&!n.retryAfterRefresh){const p=await kn.refresh();if(p.status==="refreshed")return this.performRequest(t,{...n,retryAfterRefresh:!0});throw p.status==="invalid"?new mr(401,{detail:"登录态已经失效,请重新登录",error_code:"UNAUTHORIZED"}):new mr(0,{detail:"登录态暂时无法恢复,请稍后重试",error_code:"AUTH_REFRESH_UNAVAILABLE"})}throw!n.skipAuth&&xT(l.status,f.error_code)&&(sessionStorage.setItem(sm,String(Date.now())),kn.clear()),new mr(l.status,f)}return l}}const De=new vT;async function wT(e){const t=await e.text();if(!t)return Ey(e.status);try{const n=JSON.parse(t);if(typeof n.detail=="string"&&typeof n.error_code=="string")return{detail:n.detail,error_code:n.error_code,field:typeof n.field=="string"?n.field:void 0,timestamp:typeof n.timestamp=="string"?n.timestamp:void 0}}catch{}return Ey(e.status,t)}function Ey(e,t){return{detail:(t==null?void 0:t.trim())||`请求失败(HTTP ${e})`,error_code:e===401?"UNAUTHORIZED":"HTTP_ERROR"}}function Gk(e,t){return e!==401?!1:t==="UNAUTHORIZED"||t==="TOKEN_EXPIRED"||t==="TOKEN_INVALID"}function xT(e,t){return e===403&&t==="BOOTSTRAP_REQUIRED"?!0:Gk(e,t)}const sm="codingns.auth_expired_at";function kT(){const e=sessionStorage.getItem(sm);return e?(sessionStorage.removeItem(sm),Date.now()-Number(e)<5e3):!1}function ST(e){return De.request("/api/public/bootstrap-status",{baseUrl:e,skipAuth:!0})}function CT(e,t){return De.request("/api/public/setup",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function jT(e,t){return De.request("/api/auth/login",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}function NT(e,t){return De.request("/api/auth/refresh",{method:"POST",body:JSON.stringify(e),baseUrl:t,skipAuth:!0})}const Ya="codingns.auth.session";class PT{constructor(){He(this,"state",{status:"anonymous",session:this.readSession()});He(this,"listeners",new Set);He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state);this.state.session&&(this.state={status:"authenticated",session:this.state.session})}async login(t,n,i){const a=await jT({username:t,password:n},i);return this.setSession(a),a}async bootstrap(t,n,i){await CT({username:t,password:n},i)}hydrate(t){if(!t){this.clear();return}this.setSession(t)}async refresh(){const t=this.state.session,n=t==null?void 0:t.refreshToken;if(!n)return this.clear(),{status:"invalid",session:null};this.state={...this.state,status:"refreshing"},this.emit();try{const i=await NT({refreshToken:n});return this.setSession(i),{status:"refreshed",session:i}}catch(i){return RT(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(Ya),this.emit()}setSession(t){this.state={status:"authenticated",session:t};const n={serverBaseUrl:vl(),session:t};window.localStorage.setItem(Ya,JSON.stringify(n)),this.emit()}readSession(){const t=window.localStorage.getItem(Ya);if(!t)return null;try{const n=JSON.parse(t),i=vl();return TT(n)?(n.serverBaseUrl&&n.serverBaseUrl!==i,n.session):Qk(n)?n:(window.localStorage.removeItem(Ya),null)}catch{return window.localStorage.removeItem(Ya),null}}emit(){for(const t of this.listeners)t()}}const kn=new PT;function Kk(e){return b.useSyncExternalStore(kn.subscribe,()=>e(kn.getState()))}function TT(e){return typeof e!="object"||e===null?!1:"session"in e&&Qk(e.session)}function Qk(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 RT(e){return e instanceof mr?e.status===401?!0:e.status===403&&e.errorCode==="BOOTSTRAP_REQUIRED":!1}const Yk="/api/preferences/profile";async function ET(){return De.request(Yk)}async function Xk(e){return De.request(Yk,{method:"PUT",body:JSON.stringify(e)})}const td=["claude-code","codex","opencode","gemini","kimi"],Jk="codingns.account.preferences.shadow",AT="codingns.client.runtime-config",IT="codingns-theme",LT="composer-selected-model:",MT="composer-reasoning-level:";function Ml(){return typeof window<"u"&&typeof window.localStorage<"u"}function Ym(e){return e==="en-US"||e==="en"?"en-US":e==="zh-CN"?"zh-CN":null}function DT(){return typeof navigator>"u"?"zh-CN":Ym(navigator.language)??"zh-CN"}function Zk(e){return e==="light"||e==="dark"||e==="sky-blue"||e==="eye-green"?e:null}function FT(){return typeof window>"u"||typeof window.matchMedia!="function"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function eS(e){return e==="acceptEdits"||e==="bypassPermissions"||e==="default"?e:null}function tS(e){return e==="low"||e==="medium"||e==="high"||e==="xhigh"?e:null}function nS(){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 rS(){return{initialized:!0,profile:{language:DT(),theme:FT(),defaultPermissionMode:"default"},providers:nS(),updatedAt:null,source:"default"}}function _T(){const e=Gn.getState(),t={language:e.language,defaultPermissionMode:e.defaultPermissionMode};if(!Ml())return t;const n=window.localStorage.getItem(AT);if(!n)return t;try{const i=JSON.parse(n);return{language:Ym(i.language)??t.language,defaultPermissionMode:eS(i.defaultPermissionMode)??t.defaultPermissionMode}}catch{return t}}function OT(){return Ml()?Zk(window.localStorage.getItem(IT)):null}function BT(){var t;if(!Ml())return;const e={};for(const n of td){const i=((t=window.localStorage.getItem(`${LT}${n}`))==null?void 0:t.trim())||null,a=tS(window.localStorage.getItem(`${MT}${n}`));i===null&&a===null||(e[n]={defaultModel:i,defaultReasoningLevel:a})}return Object.keys(e).length>0?e:void 0}function iS(){const e=_T(),t=OT(),n=BT(),i={};return e.language&&(i.language=e.language),t&&(i.theme=t),e.defaultPermissionMode&&(i.defaultPermissionMode=e.defaultPermissionMode),n&&(i.providers=n),sS(i)?i:null}function sS(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 Au(e){var i;const t=rS(),n=nS();for(const a of td){const c=(i=e==null?void 0:e.providers)==null?void 0:i[a];n[a]={defaultModel:typeof(c==null?void 0:c.defaultModel)=="string"&&c.defaultModel.trim()||null,defaultReasoningLevel:tS(c==null?void 0:c.defaultReasoningLevel)??null}}return{language:Ym(e==null?void 0:e.language)??t.profile.language,theme:Zk(e==null?void 0:e.theme)??t.profile.theme,defaultPermissionMode:eS(e==null?void 0:e.defaultPermissionMode)??t.profile.defaultPermissionMode,providers:n,updatedAt:typeof(e==null?void 0:e.updatedAt)=="string"?e.updatedAt:null}}function UT(){var t,n,i;if(!Ml())return null;const e=window.localStorage.getItem(Jk);if(!e)return null;try{const a=JSON.parse(e),c=Au({language:(t=a.profile)==null?void 0:t.language,theme:(n=a.profile)==null?void 0:n.theme,defaultPermissionMode:(i=a.profile)==null?void 0:i.defaultPermissionMode,providers:a.providers,updatedAt:a.updatedAt});return{profile:{language:c.language,theme:c.theme,defaultPermissionMode:c.defaultPermissionMode},providers:c.providers,updatedAt:c.updatedAt}}catch{return null}}function Iu(e){if(!Ml())return;const t={profile:e.profile,providers:e.providers,updatedAt:e.updatedAt};window.localStorage.setItem(Jk,JSON.stringify(t))}function zo(){const e=rS(),t=iS(),n=t?oS(e,t,"default"):e,i=UT();return i?{initialized:!0,profile:i.profile,providers:i.providers,updatedAt:i.updatedAt,source:"shadow"}:n}function om(e,t){return{initialized:!0,profile:{language:e.language,theme:e.theme,defaultPermissionMode:e.defaultPermissionMode},providers:e.providers,updatedAt:e.updatedAt,source:t}}function oS(e,t,n){const i={...e.providers};if(t.providers)for(const a of td){const c=t.providers[a];c&&(i[a]={defaultModel:c.defaultModel!==void 0?c.defaultModel??null:e.providers[a].defaultModel,defaultReasoningLevel:c.defaultReasoningLevel!==void 0?c.defaultReasoningLevel??null:e.providers[a].defaultReasoningLevel})}return{initialized:!0,profile:{language:t.language??e.profile.language,theme:t.theme??e.profile.theme,defaultPermissionMode:t.defaultPermissionMode??e.profile.defaultPermissionMode},providers:i,updatedAt:e.updatedAt,source:n}}async function WT(){const e=Au(await ET());if(e.updatedAt===null){const n=iS();if(sS(n)){const i=Au(await Xk(n)),a=om(i,"remote");return Iu(a),a}}const t=om(e,"remote");return Iu(t),t}class zT{constructor(){He(this,"state",zo());He(this,"listeners",new Set);He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state);Gn.subscribe(()=>{kn.getState().session||this.state.source==="remote"||this.hydrate(zo())})}hydrate(t){this.state=t,this.emit()}resetToLocalFallback(){this.hydrate(zo())}async initialize(){if(!kn.getState().session){const t=zo();return this.hydrate(t),t}return this.refreshForAuthenticatedUser()}async refreshForAuthenticatedUser(){if(!kn.getState().session){const t=zo();return this.hydrate(t),t}try{const t=await WT();return this.hydrate(t),t}catch{const t=zo();return this.hydrate(t),t}}async updateProfile(t){const n=this.state,i=oS(n,t,n.source);if(this.hydrate(i),!kn.getState().session)return Iu(i),i;try{const a=Au(await Xk(t)),c=om(a,"remote");return Iu(c),this.hydrate(c),c}catch(a){throw this.hydrate(n),a}}async updateProviderPreference(t,n){return this.updateProfile({providers:{[t]:n}})}emit(){for(const t of this.listeners)t()}}const ui=new zT;function am(e){return b.useSyncExternalStore(ui.subscribe,()=>e(ui.getState()))}function Gh(e){return td.includes(e)}function HT(){return ui.initialize()}function Lu(e){return ui.updateProfile(e)}function la(e){return am(t=>e({profile:{...t.profile,providers:t.providers,updatedAt:t.updatedAt},isFetching:!1,error:null}))}async function qT(){const e=Si();return await Gn.initialize(),await HT(),{platform:e.platform}}var Qn=Ik();const $T=Ll(Qn),VT=Ak({__proto__:null,default:$T},[Qn]);/**
42
+ * @remix-run/router v1.23.2
43
+ *
44
+ * Copyright (c) Remix Software Inc.
45
+ *
46
+ * This source code is licensed under the MIT license found in the
47
+ * LICENSE.md file in the root directory of this source tree.
48
+ *
49
+ * @license MIT
50
+ */function xn(){return xn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},xn.apply(this,arguments)}var _n;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(_n||(_n={}));const Ay="popstate";function GT(e){e===void 0&&(e={});function t(i,a){let{pathname:c,search:l,hash:h}=i.location;return wl("",{pathname:c,search:l,hash:h},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}function n(i,a){return typeof a=="string"?a:Dl(a)}return QT(t,n,null,e)}function tn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function lo(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function KT(){return Math.random().toString(36).substr(2,8)}function Iy(e,t){return{usr:e.state,key:e.key,idx:t}}function wl(e,t,n,i){return n===void 0&&(n=null),xn({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ns(t):t,{state:n,key:t&&t.key||i||KT()})}function Dl(e){let{pathname:t="/",search:n="",hash:i=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),i&&i!=="#"&&(t+=i.charAt(0)==="#"?i:"#"+i),t}function Ns(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let i=e.indexOf("?");i>=0&&(t.search=e.substr(i),e=e.substr(0,i)),e&&(t.pathname=e)}return t}function QT(e,t,n,i){i===void 0&&(i={});let{window:a=document.defaultView,v5Compat:c=!1}=i,l=a.history,h=_n.Pop,f=null,p=y();p==null&&(p=0,l.replaceState(xn({},l.state,{idx:p}),""));function y(){return(l.state||{idx:null}).idx}function g(){h=_n.Pop;let P=y(),A=P==null?null:P-p;p=P,f&&f({action:h,location:C.location,delta:A})}function w(P,A){h=_n.Push;let L=wl(C.location,P,A);p=y()+1;let O=Iy(L,p),ee=C.createHref(L);try{l.pushState(O,"",ee)}catch(q){if(q instanceof DOMException&&q.name==="DataCloneError")throw q;a.location.assign(ee)}c&&f&&f({action:h,location:C.location,delta:1})}function x(P,A){h=_n.Replace;let L=wl(C.location,P,A);p=y();let O=Iy(L,p),ee=C.createHref(L);l.replaceState(O,"",ee),c&&f&&f({action:h,location:C.location,delta:0})}function S(P){let A=a.location.origin!=="null"?a.location.origin:a.location.href,L=typeof P=="string"?P:Dl(P);return L=L.replace(/ $/,"%20"),tn(A,"No window.location.(origin|href) available to create URL for href: "+L),new URL(L,A)}let C={get action(){return h},get location(){return e(a,l)},listen(P){if(f)throw new Error("A history only accepts one active listener");return a.addEventListener(Ay,g),f=P,()=>{a.removeEventListener(Ay,g),f=null}},createHref(P){return t(a,P)},createURL:S,encodeLocation(P){let A=S(P);return{pathname:A.pathname,search:A.search,hash:A.hash}},push:w,replace:x,go(P){return l.go(P)}};return C}var fn;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(fn||(fn={}));const YT=new Set(["lazy","caseSensitive","path","id","index","children"]);function XT(e){return e.index===!0}function Mu(e,t,n,i){return n===void 0&&(n=[]),i===void 0&&(i={}),e.map((a,c)=>{let l=[...n,String(c)],h=typeof a.id=="string"?a.id:l.join("-");if(tn(a.index!==!0||!a.children,"Cannot specify children on an index route"),tn(!i[h],'Found a route id collision on id "'+h+`". Route id's must be globally unique within Data Router usages`),XT(a)){let f=xn({},a,t(a),{id:h});return i[h]=f,f}else{let f=xn({},a,t(a),{id:h,children:void 0});return i[h]=f,a.children&&(f.children=Mu(a.children,t,l,i)),f}})}function ro(e,t,n){return n===void 0&&(n="/"),pu(e,t,n,!1)}function pu(e,t,n,i){let a=typeof t=="string"?Ns(t):t,c=Fl(a.pathname||"/",n);if(c==null)return null;let l=aS(e);ZT(l);let h=null;for(let f=0;h==null&&f<l.length;++f){let p=u1(c);h=l1(l[f],p,i)}return h}function JT(e,t){let{route:n,pathname:i,params:a}=e;return{id:n.id,pathname:i,params:a,data:t[n.id],handle:n.handle}}function aS(e,t,n,i){t===void 0&&(t=[]),n===void 0&&(n=[]),i===void 0&&(i="");let a=(c,l,h)=>{let f={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:l,route:c};f.relativePath.startsWith("/")&&(tn(f.relativePath.startsWith(i),'Absolute route path "'+f.relativePath+'" nested under path '+('"'+i+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),f.relativePath=f.relativePath.slice(i.length));let p=Cs([i,f.relativePath]),y=n.concat(f);c.children&&c.children.length>0&&(tn(c.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),aS(c.children,t,y,p)),!(c.path==null&&!c.index)&&t.push({path:p,score:o1(p,c.index),routesMeta:y})};return e.forEach((c,l)=>{var h;if(c.path===""||!((h=c.path)!=null&&h.includes("?")))a(c,l);else for(let f of lS(c.path))a(c,l,f)}),t}function lS(e){let t=e.split("/");if(t.length===0)return[];let[n,...i]=t,a=n.endsWith("?"),c=n.replace(/\?$/,"");if(i.length===0)return a?[c,""]:[c];let l=lS(i.join("/")),h=[];return h.push(...l.map(f=>f===""?c:[c,f].join("/"))),a&&h.push(...l),h.map(f=>e.startsWith("/")&&f===""?"/":f)}function ZT(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:a1(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}const e1=/^:[\w-]+$/,t1=3,n1=2,r1=1,i1=10,s1=-2,Ly=e=>e==="*";function o1(e,t){let n=e.split("/"),i=n.length;return n.some(Ly)&&(i+=s1),t&&(i+=n1),n.filter(a=>!Ly(a)).reduce((a,c)=>a+(e1.test(c)?t1:c===""?r1:i1),i)}function a1(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 l1(e,t,n){n===void 0&&(n=!1);let{routesMeta:i}=e,a={},c="/",l=[];for(let h=0;h<i.length;++h){let f=i[h],p=h===i.length-1,y=c==="/"?t:t.slice(c.length)||"/",g=On({path:f.relativePath,caseSensitive:f.caseSensitive,end:p},y),w=f.route;if(!g&&p&&n&&!i[i.length-1].route.index&&(g=On({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},y)),!g)return null;Object.assign(a,g.params),l.push({params:a,pathname:Cs([c,g.pathname]),pathnameBase:m1(Cs([c,g.pathnameBase])),route:w}),g.pathnameBase!=="/"&&(c=Cs([c,g.pathnameBase]))}return l}function On(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=c1(e.path,e.caseSensitive,e.end),a=t.match(n);if(!a)return null;let c=a[0],l=c.replace(/(.)\/+$/,"$1"),h=a.slice(1);return{params:i.reduce((p,y,g)=>{let{paramName:w,isOptional:x}=y;if(w==="*"){let C=h[g]||"";l=c.slice(0,c.length-C.length).replace(/(.)\/+$/,"$1")}const S=h[g];return x&&!S?p[w]=void 0:p[w]=(S||"").replace(/%2F/g,"/"),p},{}),pathname:c,pathnameBase:l,pattern:e}}function c1(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),lo(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,(l,h,f)=>(i.push({paramName:h,isOptional:f!=null}),f?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(i.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),i]}function u1(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return lo(!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 Fl(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,i=e.charAt(n);return i&&i!=="/"?null:e.slice(n)||"/"}const d1=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,h1=e=>d1.test(e);function f1(e,t){t===void 0&&(t="/");let{pathname:n,search:i="",hash:a=""}=typeof e=="string"?Ns(e):e,c;if(n)if(h1(n))c=n;else{if(n.includes("//")){let l=n;n=n.replace(/\/\/+/g,"/"),lo(!1,"Pathnames cannot have embedded double slashes - normalizing "+(l+" -> "+n))}n.startsWith("/")?c=My(n.substring(1),"/"):c=My(n,t)}else c=t;return{pathname:c,search:p1(i),hash:g1(a)}}function My(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function Kh(e,t,n,i){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(i)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function cS(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Xm(e,t){let n=cS(e);return t?n.map((i,a)=>a===n.length-1?i.pathname:i.pathnameBase):n.map(i=>i.pathnameBase)}function Jm(e,t,n,i){i===void 0&&(i=!1);let a;typeof e=="string"?a=Ns(e):(a=xn({},e),tn(!a.pathname||!a.pathname.includes("?"),Kh("?","pathname","search",a)),tn(!a.pathname||!a.pathname.includes("#"),Kh("#","pathname","hash",a)),tn(!a.search||!a.search.includes("#"),Kh("#","search","hash",a)));let c=e===""||a.pathname==="",l=c?"/":a.pathname,h;if(l==null)h=n;else{let g=t.length-1;if(!i&&l.startsWith("..")){let w=l.split("/");for(;w[0]==="..";)w.shift(),g-=1;a.pathname=w.join("/")}h=g>=0?t[g]:"/"}let f=f1(a,h),p=l&&l!=="/"&&l.endsWith("/"),y=(c||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(p||y)&&(f.pathname+="/"),f}const Cs=e=>e.join("/").replace(/\/\/+/g,"/"),m1=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),p1=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,g1=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Du{constructor(t,n,i,a){a===void 0&&(a=!1),this.status=t,this.statusText=n||"",this.internal=a,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}}function xl(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const uS=["post","put","patch","delete"],b1=new Set(uS),y1=["get",...uS],v1=new Set(y1),w1=new Set([301,302,303,307,308]),x1=new Set([307,308]),Qh={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},k1={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Xa={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Zm=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,S1=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),dS="remix-router-transitions";function C1(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",i=!n;tn(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 X=e.detectErrorBoundary;a=oe=>({hasErrorBoundary:X(oe)})}else a=S1;let c={},l=Mu(e.routes,a,void 0,c),h,f=e.basename||"/",p=e.dataStrategy||T1,y=e.patchRoutesOnNavigation,g=xn({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),w=null,x=new Set,S=null,C=null,P=null,A=e.hydrationData!=null,L=ro(l,e.history.location,f),O=!1,ee=null;if(L==null&&!y){let X=jr(404,{pathname:e.history.location.pathname}),{matches:oe,route:de}=$y(l);L=oe,ee={[de.id]:X}}L&&!e.hydrationData&&Qt(L,l,e.history.location.pathname).active&&(L=null);let q;if(L)if(L.some(X=>X.route.lazy))q=!1;else if(!L.some(X=>X.route.loader))q=!0;else if(g.v7_partialHydration){let X=e.hydrationData?e.hydrationData.loaderData:null,oe=e.hydrationData?e.hydrationData.errors:null;if(oe){let de=L.findIndex(Se=>oe[Se.route.id]!==void 0);q=L.slice(0,de+1).every(Se=>!cm(Se.route,X,oe))}else q=L.every(de=>!cm(de.route,X,oe))}else q=e.hydrationData!=null;else if(q=!1,L=[],g.v7_partialHydration){let X=Qt(null,l,e.history.location.pathname);X.active&&X.matches&&(O=!0,L=X.matches)}let _,E={historyAction:e.history.action,location:e.history.location,matches:L,initialized:q,navigation:Qh,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||ee,fetchers:new Map,blockers:new Map},M=_n.Pop,I=!1,N,z=!1,G=new Map,J=null,B=!1,W=!1,Y=[],Q=new Set,D=new Map,re=0,R=-1,$=new Map,Z=new Set,F=new Map,we=new Map,ce=new Set,be=new Map,Ve=new Map,ze;function yt(){if(w=e.history.listen(X=>{let{action:oe,location:de,delta:Se}=X;if(ze){ze(),ze=void 0;return}lo(Ve.size===0||Se!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let je=ie({currentLocation:E.location,nextLocation:de,historyAction:oe});if(je&&Se!=null){let $e=new Promise(Ye=>{ze=Ye});e.history.go(Se*-1),Zt(je,{state:"blocked",location:de,proceed(){Zt(je,{state:"proceeding",proceed:void 0,reset:void 0,location:de}),$e.then(()=>e.history.go(Se))},reset(){let Ye=new Map(E.blockers);Ye.set(je,Xa),Ke({blockers:Ye})}});return}return xt(oe,de)}),n){z1(t,G);let X=()=>H1(t,G);t.addEventListener("pagehide",X),J=()=>t.removeEventListener("pagehide",X)}return E.initialized||xt(_n.Pop,E.location,{initialHydration:!0}),_}function ft(){w&&w(),J&&J(),x.clear(),N&&N.abort(),E.fetchers.forEach((X,oe)=>St(oe)),E.blockers.forEach((X,oe)=>Nt(oe))}function Ot(X){return x.add(X),()=>x.delete(X)}function Ke(X,oe){oe===void 0&&(oe={}),E=xn({},E,X);let de=[],Se=[];g.v7_fetcherPersist&&E.fetchers.forEach((je,$e)=>{je.state==="idle"&&(ce.has($e)?Se.push($e):de.push($e))}),ce.forEach(je=>{!E.fetchers.has(je)&&!D.has(je)&&Se.push(je)}),[...x].forEach(je=>je(E,{deletedFetchers:Se,viewTransitionOpts:oe.viewTransitionOpts,flushSync:oe.flushSync===!0})),g.v7_fetcherPersist?(de.forEach(je=>E.fetchers.delete(je)),Se.forEach(je=>St(je))):Se.forEach(je=>ce.delete(je))}function jt(X,oe,de){var Se,je;let{flushSync:$e}=de===void 0?{}:de,Ye=E.actionData!=null&&E.navigation.formMethod!=null&&ai(E.navigation.formMethod)&&E.navigation.state==="loading"&&((Se=X.state)==null?void 0:Se._isRedirect)!==!0,Ee;oe.actionData?Object.keys(oe.actionData).length>0?Ee=oe.actionData:Ee=null:Ye?Ee=E.actionData:Ee=null;let Ue=oe.loaderData?Hy(E.loaderData,oe.loaderData,oe.matches||[],oe.errors):E.loaderData,ne=E.blockers;ne.size>0&&(ne=new Map(ne),ne.forEach((ot,It)=>ne.set(It,Xa)));let xe=I===!0||E.navigation.formMethod!=null&&ai(E.navigation.formMethod)&&((je=X.state)==null?void 0:je._isRedirect)!==!0;h&&(l=h,h=void 0),B||M===_n.Pop||(M===_n.Push?e.history.push(X,X.state):M===_n.Replace&&e.history.replace(X,X.state));let Ze;if(M===_n.Pop){let ot=G.get(E.location.pathname);ot&&ot.has(X.pathname)?Ze={currentLocation:E.location,nextLocation:X}:G.has(X.pathname)&&(Ze={currentLocation:X,nextLocation:E.location})}else if(z){let ot=G.get(E.location.pathname);ot?ot.add(X.pathname):(ot=new Set([X.pathname]),G.set(E.location.pathname,ot)),Ze={currentLocation:E.location,nextLocation:X}}Ke(xn({},oe,{actionData:Ee,loaderData:Ue,historyAction:M,location:X,initialized:!0,navigation:Qh,revalidation:"idle",restoreScrollPosition:it(X,oe.matches||E.matches),preventScrollReset:xe,blockers:ne}),{viewTransitionOpts:Ze,flushSync:$e===!0}),M=_n.Pop,I=!1,z=!1,B=!1,W=!1,Y=[]}async function pt(X,oe){if(typeof X=="number"){e.history.go(X);return}let de=lm(E.location,E.matches,f,g.v7_prependBasename,X,g.v7_relativeSplatPath,oe==null?void 0:oe.fromRouteId,oe==null?void 0:oe.relative),{path:Se,submission:je,error:$e}=Dy(g.v7_normalizeFormMethod,!1,de,oe),Ye=E.location,Ee=wl(E.location,Se,oe&&oe.state);Ee=xn({},Ee,e.history.encodeLocation(Ee));let Ue=oe&&oe.replace!=null?oe.replace:void 0,ne=_n.Push;Ue===!0?ne=_n.Replace:Ue===!1||je!=null&&ai(je.formMethod)&&je.formAction===E.location.pathname+E.location.search&&(ne=_n.Replace);let xe=oe&&"preventScrollReset"in oe?oe.preventScrollReset===!0:void 0,Ze=(oe&&oe.flushSync)===!0,ot=ie({currentLocation:Ye,nextLocation:Ee,historyAction:ne});if(ot){Zt(ot,{state:"blocked",location:Ee,proceed(){Zt(ot,{state:"proceeding",proceed:void 0,reset:void 0,location:Ee}),pt(X,oe)},reset(){let It=new Map(E.blockers);It.set(ot,Xa),Ke({blockers:It})}});return}return await xt(ne,Ee,{submission:je,pendingError:$e,preventScrollReset:xe,replace:oe&&oe.replace,enableViewTransition:oe&&oe.viewTransition,flushSync:Ze})}function Mt(){if(ge(),Ke({revalidation:"loading"}),E.navigation.state!=="submitting"){if(E.navigation.state==="idle"){xt(E.historyAction,E.location,{startUninterruptedRevalidation:!0});return}xt(M||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation,enableViewTransition:z===!0})}}async function xt(X,oe,de){N&&N.abort(),N=null,M=X,B=(de&&de.startUninterruptedRevalidation)===!0,ke(E.location,E.matches),I=(de&&de.preventScrollReset)===!0,z=(de&&de.enableViewTransition)===!0;let Se=h||l,je=de&&de.overrideNavigation,$e=de!=null&&de.initialHydration&&E.matches&&E.matches.length>0&&!O?E.matches:ro(Se,oe,f),Ye=(de&&de.flushSync)===!0;if($e&&E.initialized&&!W&&M1(E.location,oe)&&!(de&&de.submission&&ai(de.submission.formMethod))){jt(oe,{matches:$e},{flushSync:Ye});return}let Ee=Qt($e,Se,oe.pathname);if(Ee.active&&Ee.matches&&($e=Ee.matches),!$e){let{error:Ct,notFoundMatches:Pt,route:$t}=Ie(oe.pathname);jt(oe,{matches:Pt,loaderData:{},errors:{[$t.id]:Ct}},{flushSync:Ye});return}N=new AbortController;let Ue=Ho(e.history,oe,N.signal,de&&de.submission),ne;if(de&&de.pendingError)ne=[io($e).route.id,{type:fn.error,error:de.pendingError}];else if(de&&de.submission&&ai(de.submission.formMethod)){let Ct=await Dt(Ue,oe,de.submission,$e,Ee.active,{replace:de.replace,flushSync:Ye});if(Ct.shortCircuited)return;if(Ct.pendingActionResult){let[Pt,$t]=Ct.pendingActionResult;if(Dr($t)&&xl($t.error)&&$t.error.status===404){N=null,jt(oe,{matches:Ct.matches,loaderData:{},errors:{[Pt]:$t.error}});return}}$e=Ct.matches||$e,ne=Ct.pendingActionResult,je=Yh(oe,de.submission),Ye=!1,Ee.active=!1,Ue=Ho(e.history,Ue.url,Ue.signal)}let{shortCircuited:xe,matches:Ze,loaderData:ot,errors:It}=await wt(Ue,oe,$e,Ee.active,je,de&&de.submission,de&&de.fetcherSubmission,de&&de.replace,de&&de.initialHydration===!0,Ye,ne);xe||(N=null,jt(oe,xn({matches:Ze||$e},qy(ne),{loaderData:ot,errors:It})))}async function Dt(X,oe,de,Se,je,$e){$e===void 0&&($e={}),ge();let Ye=U1(oe,de);if(Ke({navigation:Ye},{flushSync:$e.flushSync===!0}),je){let ne=await rn(Se,oe.pathname,X.signal);if(ne.type==="aborted")return{shortCircuited:!0};if(ne.type==="error"){let xe=io(ne.partialMatches).route.id;return{matches:ne.partialMatches,pendingActionResult:[xe,{type:fn.error,error:ne.error}]}}else if(ne.matches)Se=ne.matches;else{let{notFoundMatches:xe,error:Ze,route:ot}=Ie(oe.pathname);return{matches:xe,pendingActionResult:[ot.id,{type:fn.error,error:Ze}]}}}let Ee,Ue=ll(Se,oe);if(!Ue.route.action&&!Ue.route.lazy)Ee={type:fn.error,error:jr(405,{method:X.method,pathname:oe.pathname,routeId:Ue.route.id})};else if(Ee=(await nt("action",E,X,[Ue],Se,null))[Ue.route.id],X.signal.aborted)return{shortCircuited:!0};if(oo(Ee)){let ne;return $e&&$e.replace!=null?ne=$e.replace:ne=Uy(Ee.response.headers.get("Location"),new URL(X.url),f,e.history)===E.location.pathname+E.location.search,await Lt(X,Ee,!0,{submission:de,replace:ne}),{shortCircuited:!0}}if(ws(Ee))throw jr(400,{type:"defer-action"});if(Dr(Ee)){let ne=io(Se,Ue.route.id);return($e&&$e.replace)!==!0&&(M=_n.Push),{matches:Se,pendingActionResult:[ne.route.id,Ee]}}return{matches:Se,pendingActionResult:[Ue.route.id,Ee]}}async function wt(X,oe,de,Se,je,$e,Ye,Ee,Ue,ne,xe){let Ze=je||Yh(oe,$e),ot=$e||Ye||Gy(Ze),It=!B&&(!g.v7_partialHydration||!Ue);if(Se){if(It){let ut=ye(xe);Ke(xn({navigation:Ze},ut!==void 0?{actionData:ut}:{}),{flushSync:ne})}let Ge=await rn(de,oe.pathname,X.signal);if(Ge.type==="aborted")return{shortCircuited:!0};if(Ge.type==="error"){let ut=io(Ge.partialMatches).route.id;return{matches:Ge.partialMatches,loaderData:{},errors:{[ut]:Ge.error}}}else if(Ge.matches)de=Ge.matches;else{let{error:ut,notFoundMatches:dn,route:An}=Ie(oe.pathname);return{matches:dn,loaderData:{},errors:{[An.id]:ut}}}}let Ct=h||l,[Pt,$t]=_y(e.history,E,de,ot,oe,g.v7_partialHydration&&Ue===!0,g.v7_skipActionErrorRevalidation,W,Y,Q,ce,F,Z,Ct,f,xe);if(ct(Ge=>!(de&&de.some(ut=>ut.route.id===Ge))||Pt&&Pt.some(ut=>ut.route.id===Ge)),R=++re,Pt.length===0&&$t.length===0){let Ge=Bt();return jt(oe,xn({matches:de,loaderData:{},errors:xe&&Dr(xe[1])?{[xe[0]]:xe[1].error}:null},qy(xe),Ge?{fetchers:new Map(E.fetchers)}:{}),{flushSync:ne}),{shortCircuited:!0}}if(It){let Ge={};if(!Se){Ge.navigation=Ze;let ut=ye(xe);ut!==void 0&&(Ge.actionData=ut)}$t.length>0&&(Ge.fetchers=Fe($t)),Ke(Ge,{flushSync:ne})}$t.forEach(Ge=>{Ut(Ge.key),Ge.controller&&D.set(Ge.key,Ge.controller)});let me=()=>$t.forEach(Ge=>Ut(Ge.key));N&&N.signal.addEventListener("abort",me);let{loaderResults:We,fetcherResults:Qe}=await fe(E,de,Pt,$t,X);if(X.signal.aborted)return{shortCircuited:!0};N&&N.signal.removeEventListener("abort",me),$t.forEach(Ge=>D.delete(Ge.key));let Be=$c(We);if(Be)return await Lt(X,Be.result,!0,{replace:Ee}),{shortCircuited:!0};if(Be=$c(Qe),Be)return Z.add(Be.key),await Lt(X,Be.result,!0,{replace:Ee}),{shortCircuited:!0};let{loaderData:Xt,errors:Ht}=zy(E,de,We,xe,$t,Qe,be);be.forEach((Ge,ut)=>{Ge.subscribe(dn=>{(dn||Ge.done)&&be.delete(ut)})}),g.v7_partialHydration&&Ue&&E.errors&&(Ht=xn({},E.errors,Ht));let K=Bt(),Ce=At(R),Xe=K||Ce||$t.length>0;return xn({matches:de,loaderData:Xt,errors:Ht},Xe?{fetchers:new Map(E.fetchers)}:{})}function ye(X){if(X&&!Dr(X[1]))return{[X[0]]:X[1].data};if(E.actionData)return Object.keys(E.actionData).length===0?null:E.actionData}function Fe(X){return X.forEach(oe=>{let de=E.fetchers.get(oe.key),Se=Ja(void 0,de?de.data:void 0);E.fetchers.set(oe.key,Se)}),new Map(E.fetchers)}function kt(X,oe,de,Se){if(i)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");Ut(X);let je=(Se&&Se.flushSync)===!0,$e=h||l,Ye=lm(E.location,E.matches,f,g.v7_prependBasename,de,g.v7_relativeSplatPath,oe,Se==null?void 0:Se.relative),Ee=ro($e,Ye,f),Ue=Qt(Ee,$e,Ye);if(Ue.active&&Ue.matches&&(Ee=Ue.matches),!Ee){qe(X,oe,jr(404,{pathname:Ye}),{flushSync:je});return}let{path:ne,submission:xe,error:Ze}=Dy(g.v7_normalizeFormMethod,!0,Ye,Se);if(Ze){qe(X,oe,Ze,{flushSync:je});return}let ot=ll(Ee,ne),It=(Se&&Se.preventScrollReset)===!0;if(xe&&ai(xe.formMethod)){lt(X,oe,ne,ot,Ee,Ue.active,je,It,xe);return}F.set(X,{routeId:oe,path:ne}),gt(X,oe,ne,ot,Ee,Ue.active,je,It,xe)}async function lt(X,oe,de,Se,je,$e,Ye,Ee,Ue){ge(),F.delete(X);function ne(j){if(!j.route.action&&!j.route.lazy){let se=jr(405,{method:Ue.formMethod,pathname:de,routeId:oe});return qe(X,oe,se,{flushSync:Ye}),!0}return!1}if(!$e&&ne(Se))return;let xe=E.fetchers.get(X);Te(X,W1(Ue,xe),{flushSync:Ye});let Ze=new AbortController,ot=Ho(e.history,de,Ze.signal,Ue);if($e){let j=await rn(je,new URL(ot.url).pathname,ot.signal,X);if(j.type==="aborted")return;if(j.type==="error"){qe(X,oe,j.error,{flushSync:Ye});return}else if(j.matches){if(je=j.matches,Se=ll(je,de),ne(Se))return}else{qe(X,oe,jr(404,{pathname:de}),{flushSync:Ye});return}}D.set(X,Ze);let It=re,Pt=(await nt("action",E,ot,[Se],je,X))[Se.route.id];if(ot.signal.aborted){D.get(X)===Ze&&D.delete(X);return}if(g.v7_fetcherPersist&&ce.has(X)){if(oo(Pt)||Dr(Pt)){Te(X,bs(void 0));return}}else{if(oo(Pt))if(D.delete(X),R>It){Te(X,bs(void 0));return}else return Z.add(X),Te(X,Ja(Ue)),Lt(ot,Pt,!1,{fetcherSubmission:Ue,preventScrollReset:Ee});if(Dr(Pt)){qe(X,oe,Pt.error);return}}if(ws(Pt))throw jr(400,{type:"defer-action"});let $t=E.navigation.location||E.location,me=Ho(e.history,$t,Ze.signal),We=h||l,Qe=E.navigation.state!=="idle"?ro(We,E.navigation.location,f):E.matches;tn(Qe,"Didn't find any matches after fetcher action");let Be=++re;$.set(X,Be);let Xt=Ja(Ue,Pt.data);E.fetchers.set(X,Xt);let[Ht,K]=_y(e.history,E,Qe,Ue,$t,!1,g.v7_skipActionErrorRevalidation,W,Y,Q,ce,F,Z,We,f,[Se.route.id,Pt]);K.filter(j=>j.key!==X).forEach(j=>{let se=j.key,V=E.fetchers.get(se),Ne=Ja(void 0,V?V.data:void 0);E.fetchers.set(se,Ne),Ut(se),j.controller&&D.set(se,j.controller)}),Ke({fetchers:new Map(E.fetchers)});let Ce=()=>K.forEach(j=>Ut(j.key));Ze.signal.addEventListener("abort",Ce);let{loaderResults:Xe,fetcherResults:Ge}=await fe(E,Qe,Ht,K,me);if(Ze.signal.aborted)return;Ze.signal.removeEventListener("abort",Ce),$.delete(X),D.delete(X),K.forEach(j=>D.delete(j.key));let ut=$c(Xe);if(ut)return Lt(me,ut.result,!1,{preventScrollReset:Ee});if(ut=$c(Ge),ut)return Z.add(ut.key),Lt(me,ut.result,!1,{preventScrollReset:Ee});let{loaderData:dn,errors:An}=zy(E,Qe,Xe,void 0,K,Ge,be);if(E.fetchers.has(X)){let j=bs(Pt.data);E.fetchers.set(X,j)}At(Be),E.navigation.state==="loading"&&Be>R?(tn(M,"Expected pending action"),N&&N.abort(),jt(E.navigation.location,{matches:Qe,loaderData:dn,errors:An,fetchers:new Map(E.fetchers)})):(Ke({errors:An,loaderData:Hy(E.loaderData,dn,Qe,An),fetchers:new Map(E.fetchers)}),W=!1)}async function gt(X,oe,de,Se,je,$e,Ye,Ee,Ue){let ne=E.fetchers.get(X);Te(X,Ja(Ue,ne?ne.data:void 0),{flushSync:Ye});let xe=new AbortController,Ze=Ho(e.history,de,xe.signal);if($e){let Pt=await rn(je,new URL(Ze.url).pathname,Ze.signal,X);if(Pt.type==="aborted")return;if(Pt.type==="error"){qe(X,oe,Pt.error,{flushSync:Ye});return}else if(Pt.matches)je=Pt.matches,Se=ll(je,de);else{qe(X,oe,jr(404,{pathname:de}),{flushSync:Ye});return}}D.set(X,xe);let ot=re,Ct=(await nt("loader",E,Ze,[Se],je,X))[Se.route.id];if(ws(Ct)&&(Ct=await ep(Ct,Ze.signal,!0)||Ct),D.get(X)===xe&&D.delete(X),!Ze.signal.aborted){if(ce.has(X)){Te(X,bs(void 0));return}if(oo(Ct))if(R>ot){Te(X,bs(void 0));return}else{Z.add(X),await Lt(Ze,Ct,!1,{preventScrollReset:Ee});return}if(Dr(Ct)){qe(X,oe,Ct.error);return}tn(!ws(Ct),"Unhandled fetcher deferred data"),Te(X,bs(Ct.data))}}async function Lt(X,oe,de,Se){let{submission:je,fetcherSubmission:$e,preventScrollReset:Ye,replace:Ee}=Se===void 0?{}:Se;oe.response.headers.has("X-Remix-Revalidate")&&(W=!0);let Ue=oe.response.headers.get("Location");tn(Ue,"Expected a Location header on the redirect Response"),Ue=Uy(Ue,new URL(X.url),f,e.history);let ne=wl(E.location,Ue,{_isRedirect:!0});if(n){let Pt=!1;if(oe.response.headers.has("X-Remix-Reload-Document"))Pt=!0;else if(Zm.test(Ue)){const $t=e.history.createURL(Ue);Pt=$t.origin!==t.location.origin||Fl($t.pathname,f)==null}if(Pt){Ee?t.location.replace(Ue):t.location.assign(Ue);return}}N=null;let xe=Ee===!0||oe.response.headers.has("X-Remix-Replace")?_n.Replace:_n.Push,{formMethod:Ze,formAction:ot,formEncType:It}=E.navigation;!je&&!$e&&Ze&&ot&&It&&(je=Gy(E.navigation));let Ct=je||$e;if(x1.has(oe.response.status)&&Ct&&ai(Ct.formMethod))await xt(xe,ne,{submission:xn({},Ct,{formAction:Ue}),preventScrollReset:Ye||I,enableViewTransition:de?z:void 0});else{let Pt=Yh(ne,je);await xt(xe,ne,{overrideNavigation:Pt,fetcherSubmission:$e,preventScrollReset:Ye||I,enableViewTransition:de?z:void 0})}}async function nt(X,oe,de,Se,je,$e){let Ye,Ee={};try{Ye=await R1(p,X,oe,de,Se,je,$e,c,a)}catch(Ue){return Se.forEach(ne=>{Ee[ne.route.id]={type:fn.error,error:Ue}}),Ee}for(let[Ue,ne]of Object.entries(Ye))if(D1(ne)){let xe=ne.result;Ee[Ue]={type:fn.redirect,response:I1(xe,de,Ue,je,f,g.v7_relativeSplatPath)}}else Ee[Ue]=await A1(ne);return Ee}async function fe(X,oe,de,Se,je){let $e=X.matches,Ye=nt("loader",X,je,de,oe,null),Ee=Promise.all(Se.map(async xe=>{if(xe.matches&&xe.match&&xe.controller){let ot=(await nt("loader",X,Ho(e.history,xe.path,xe.controller.signal),[xe.match],xe.matches,xe.key))[xe.match.route.id];return{[xe.key]:ot}}else return Promise.resolve({[xe.key]:{type:fn.error,error:jr(404,{pathname:xe.path})}})})),Ue=await Ye,ne=(await Ee).reduce((xe,Ze)=>Object.assign(xe,Ze),{});return await Promise.all([O1(oe,Ue,je.signal,$e,X.loaderData),B1(oe,ne,Se)]),{loaderResults:Ue,fetcherResults:ne}}function ge(){W=!0,Y.push(...ct()),F.forEach((X,oe)=>{D.has(oe)&&Q.add(oe),Ut(oe)})}function Te(X,oe,de){de===void 0&&(de={}),E.fetchers.set(X,oe),Ke({fetchers:new Map(E.fetchers)},{flushSync:(de&&de.flushSync)===!0})}function qe(X,oe,de,Se){Se===void 0&&(Se={});let je=io(E.matches,oe);St(X),Ke({errors:{[je.route.id]:de},fetchers:new Map(E.fetchers)},{flushSync:(Se&&Se.flushSync)===!0})}function dt(X){return we.set(X,(we.get(X)||0)+1),ce.has(X)&&ce.delete(X),E.fetchers.get(X)||k1}function St(X){let oe=E.fetchers.get(X);D.has(X)&&!(oe&&oe.state==="loading"&&$.has(X))&&Ut(X),F.delete(X),$.delete(X),Z.delete(X),g.v7_fetcherPersist&&ce.delete(X),Q.delete(X),E.fetchers.delete(X)}function rt(X){let oe=(we.get(X)||0)-1;oe<=0?(we.delete(X),ce.add(X),g.v7_fetcherPersist||St(X)):we.set(X,oe),Ke({fetchers:new Map(E.fetchers)})}function Ut(X){let oe=D.get(X);oe&&(oe.abort(),D.delete(X))}function mt(X){for(let oe of X){let de=dt(oe),Se=bs(de.data);E.fetchers.set(oe,Se)}}function Bt(){let X=[],oe=!1;for(let de of Z){let Se=E.fetchers.get(de);tn(Se,"Expected fetcher: "+de),Se.state==="loading"&&(Z.delete(de),X.push(de),oe=!0)}return mt(X),oe}function At(X){let oe=[];for(let[de,Se]of $)if(Se<X){let je=E.fetchers.get(de);tn(je,"Expected fetcher: "+de),je.state==="loading"&&(Ut(de),$.delete(de),oe.push(de))}return mt(oe),oe.length>0}function vt(X,oe){let de=E.blockers.get(X)||Xa;return Ve.get(X)!==oe&&Ve.set(X,oe),de}function Nt(X){E.blockers.delete(X),Ve.delete(X)}function Zt(X,oe){let de=E.blockers.get(X)||Xa;tn(de.state==="unblocked"&&oe.state==="blocked"||de.state==="blocked"&&oe.state==="blocked"||de.state==="blocked"&&oe.state==="proceeding"||de.state==="blocked"&&oe.state==="unblocked"||de.state==="proceeding"&&oe.state==="unblocked","Invalid blocker state transition: "+de.state+" -> "+oe.state);let Se=new Map(E.blockers);Se.set(X,oe),Ke({blockers:Se})}function ie(X){let{currentLocation:oe,nextLocation:de,historyAction:Se}=X;if(Ve.size===0)return;Ve.size>1&&lo(!1,"A router only supports one blocker at a time");let je=Array.from(Ve.entries()),[$e,Ye]=je[je.length-1],Ee=E.blockers.get($e);if(!(Ee&&Ee.state==="proceeding")&&Ye({currentLocation:oe,nextLocation:de,historyAction:Se}))return $e}function Ie(X){let oe=jr(404,{pathname:X}),de=h||l,{matches:Se,route:je}=$y(de);return ct(),{notFoundMatches:Se,route:je,error:oe}}function ct(X){let oe=[];return be.forEach((de,Se)=>{(!X||X(Se))&&(de.cancel(),oe.push(Se),be.delete(Se))}),oe}function zt(X,oe,de){if(S=X,P=oe,C=de||null,!A&&E.navigation===Qh){A=!0;let Se=it(E.location,E.matches);Se!=null&&Ke({restoreScrollPosition:Se})}return()=>{S=null,P=null,C=null}}function nn(X,oe){return C&&C(X,oe.map(Se=>JT(Se,E.loaderData)))||X.key}function ke(X,oe){if(S&&P){let de=nn(X,oe);S[de]=P()}}function it(X,oe){if(S){let de=nn(X,oe),Se=S[de];if(typeof Se=="number")return Se}return null}function Qt(X,oe,de){if(y)if(X){if(Object.keys(X[0].params).length>0)return{active:!0,matches:pu(oe,de,f,!0)}}else return{active:!0,matches:pu(oe,de,f,!0)||[]};return{active:!1,matches:null}}async function rn(X,oe,de,Se){if(!y)return{type:"success",matches:X};let je=X;for(;;){let $e=h==null,Ye=h||l,Ee=c;try{await y({signal:de,path:oe,matches:je,fetcherKey:Se,patch:(xe,Ze)=>{de.aborted||By(xe,Ze,Ye,Ee,a)}})}catch(xe){return{type:"error",error:xe,partialMatches:je}}finally{$e&&!de.aborted&&(l=[...l])}if(de.aborted)return{type:"aborted"};let Ue=ro(Ye,oe,f);if(Ue)return{type:"success",matches:Ue};let ne=pu(Ye,oe,f,!0);if(!ne||je.length===ne.length&&je.every((xe,Ze)=>xe.route.id===ne[Ze].route.id))return{type:"success",matches:null};je=ne}}function Tn(X){c={},h=Mu(X,a,void 0,c)}function un(X,oe){let de=h==null;By(X,oe,h||l,c,a),de&&(l=[...l],Ke({}))}return _={get basename(){return f},get future(){return g},get state(){return E},get routes(){return l},get window(){return t},initialize:yt,subscribe:Ot,enableScrollRestoration:zt,navigate:pt,fetch:kt,revalidate:Mt,createHref:X=>e.history.createHref(X),encodeLocation:X=>e.history.encodeLocation(X),getFetcher:dt,deleteFetcher:rt,dispose:ft,getBlocker:vt,deleteBlocker:Nt,patchRoutes:un,_internalFetchControllers:D,_internalActiveDeferreds:be,_internalSetRoutes:Tn},_}function j1(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function lm(e,t,n,i,a,c,l,h){let f,p;if(l){f=[];for(let g of t)if(f.push(g),g.route.id===l){p=g;break}}else f=t,p=t[t.length-1];let y=Jm(a||".",Xm(f,c),Fl(e.pathname,n)||e.pathname,h==="path");if(a==null&&(y.search=e.search,y.hash=e.hash),(a==null||a===""||a===".")&&p){let g=tp(y.search);if(p.route.index&&!g)y.search=y.search?y.search.replace(/^\?/,"?index&"):"?index";else if(!p.route.index&&g){let w=new URLSearchParams(y.search),x=w.getAll("index");w.delete("index"),x.filter(C=>C).forEach(C=>w.append("index",C));let S=w.toString();y.search=S?"?"+S:""}}return i&&n!=="/"&&(y.pathname=y.pathname==="/"?n:Cs([n,y.pathname])),Dl(y)}function Dy(e,t,n,i){if(!i||!j1(i))return{path:n};if(i.formMethod&&!_1(i.formMethod))return{path:n,error:jr(405,{method:i.formMethod})};let a=()=>({path:n,error:jr(400,{type:"invalid-body"})}),c=i.formMethod||"get",l=e?c.toUpperCase():c.toLowerCase(),h=mS(n);if(i.body!==void 0){if(i.formEncType==="text/plain"){if(!ai(l))return a();let w=typeof i.body=="string"?i.body:i.body instanceof FormData||i.body instanceof URLSearchParams?Array.from(i.body.entries()).reduce((x,S)=>{let[C,P]=S;return""+x+C+"="+P+`
51
+ `},""):String(i.body);return{path:n,submission:{formMethod:l,formAction:h,formEncType:i.formEncType,formData:void 0,json:void 0,text:w}}}else if(i.formEncType==="application/json"){if(!ai(l))return a();try{let w=typeof i.body=="string"?JSON.parse(i.body):i.body;return{path:n,submission:{formMethod:l,formAction:h,formEncType:i.formEncType,formData:void 0,json:w,text:void 0}}}catch{return a()}}}tn(typeof FormData=="function","FormData is not available in this environment");let f,p;if(i.formData)f=um(i.formData),p=i.formData;else if(i.body instanceof FormData)f=um(i.body),p=i.body;else if(i.body instanceof URLSearchParams)f=i.body,p=Wy(f);else if(i.body==null)f=new URLSearchParams,p=new FormData;else try{f=new URLSearchParams(i.body),p=Wy(f)}catch{return a()}let y={formMethod:l,formAction:h,formEncType:i&&i.formEncType||"application/x-www-form-urlencoded",formData:p,json:void 0,text:void 0};if(ai(y.formMethod))return{path:n,submission:y};let g=Ns(n);return t&&g.search&&tp(g.search)&&f.append("index",""),g.search="?"+f,{path:Dl(g),submission:y}}function Fy(e,t,n){n===void 0&&(n=!1);let i=e.findIndex(a=>a.route.id===t);return i>=0?e.slice(0,n?i+1:i):e}function _y(e,t,n,i,a,c,l,h,f,p,y,g,w,x,S,C){let P=C?Dr(C[1])?C[1].error:C[1].data:void 0,A=e.createURL(t.location),L=e.createURL(a),O=n;c&&t.errors?O=Fy(n,Object.keys(t.errors)[0],!0):C&&Dr(C[1])&&(O=Fy(n,C[0]));let ee=C?C[1].statusCode:void 0,q=l&&ee&&ee>=400,_=O.filter((M,I)=>{let{route:N}=M;if(N.lazy)return!0;if(N.loader==null)return!1;if(c)return cm(N,t.loaderData,t.errors);if(N1(t.loaderData,t.matches[I],M)||f.some(J=>J===M.route.id))return!0;let z=t.matches[I],G=M;return Oy(M,xn({currentUrl:A,currentParams:z.params,nextUrl:L,nextParams:G.params},i,{actionResult:P,actionStatus:ee,defaultShouldRevalidate:q?!1:h||A.pathname+A.search===L.pathname+L.search||A.search!==L.search||hS(z,G)}))}),E=[];return g.forEach((M,I)=>{if(c||!n.some(B=>B.route.id===M.routeId)||y.has(I))return;let N=ro(x,M.path,S);if(!N){E.push({key:I,routeId:M.routeId,path:M.path,matches:null,match:null,controller:null});return}let z=t.fetchers.get(I),G=ll(N,M.path),J=!1;w.has(I)?J=!1:p.has(I)?(p.delete(I),J=!0):z&&z.state!=="idle"&&z.data===void 0?J=h:J=Oy(G,xn({currentUrl:A,currentParams:t.matches[t.matches.length-1].params,nextUrl:L,nextParams:n[n.length-1].params},i,{actionResult:P,actionStatus:ee,defaultShouldRevalidate:q?!1:h})),J&&E.push({key:I,routeId:M.routeId,path:M.path,matches:N,match:G,controller:new AbortController})}),[_,E]}function cm(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let i=t!=null&&t[e.id]!==void 0,a=n!=null&&n[e.id]!==void 0;return!i&&a?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!i&&!a}function N1(e,t,n){let i=!t||n.route.id!==t.route.id,a=e[n.route.id]===void 0;return i||a}function hS(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Oy(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function By(e,t,n,i,a){var c;let l;if(e){let p=i[e];tn(p,"No route found to patch children into: routeId = "+e),p.children||(p.children=[]),l=p.children}else l=n;let h=t.filter(p=>!l.some(y=>fS(p,y))),f=Mu(h,a,[e||"_","patch",String(((c=l)==null?void 0:c.length)||"0")],i);l.push(...f)}function fS(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,i)=>{var a;return(a=t.children)==null?void 0:a.some(c=>fS(n,c))}):!1}async function P1(e,t,n){if(!e.lazy)return;let i=await e.lazy();if(!e.lazy)return;let a=n[e.id];tn(a,"No route found in manifest");let c={};for(let l in i){let f=a[l]!==void 0&&l!=="hasErrorBoundary";lo(!f,'Route "'+a.id+'" has a static property "'+l+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+l+'" will be ignored.')),!f&&!YT.has(l)&&(c[l]=i[l])}Object.assign(a,c),Object.assign(a,xn({},t(a),{lazy:void 0}))}async function T1(e){let{matches:t}=e,n=t.filter(a=>a.shouldLoad);return(await Promise.all(n.map(a=>a.resolve()))).reduce((a,c,l)=>Object.assign(a,{[n[l].route.id]:c}),{})}async function R1(e,t,n,i,a,c,l,h,f,p){let y=c.map(x=>x.route.lazy?P1(x.route,f,h):void 0),g=c.map((x,S)=>{let C=y[S],P=a.some(L=>L.route.id===x.route.id);return xn({},x,{shouldLoad:P,resolve:async L=>(L&&i.method==="GET"&&(x.route.lazy||x.route.loader)&&(P=!0),P?E1(t,i,x,C,L,p):Promise.resolve({type:fn.data,result:void 0}))})}),w=await e({matches:g,request:i,params:c[0].params,fetcherKey:l,context:p});try{await Promise.all(y)}catch{}return w}async function E1(e,t,n,i,a,c){let l,h,f=p=>{let y,g=new Promise((S,C)=>y=C);h=()=>y(),t.signal.addEventListener("abort",h);let w=S=>typeof p!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):p({request:t,params:n.params,context:c},...S!==void 0?[S]:[]),x=(async()=>{try{return{type:"data",result:await(a?a(C=>w(C)):w())}}catch(S){return{type:"error",result:S}}})();return Promise.race([x,g])};try{let p=n.route[e];if(i)if(p){let y,[g]=await Promise.all([f(p).catch(w=>{y=w}),i]);if(y!==void 0)throw y;l=g}else if(await i,p=n.route[e],p)l=await f(p);else if(e==="action"){let y=new URL(t.url),g=y.pathname+y.search;throw jr(405,{method:t.method,pathname:g,routeId:n.route.id})}else return{type:fn.data,result:void 0};else if(p)l=await f(p);else{let y=new URL(t.url),g=y.pathname+y.search;throw jr(404,{pathname:g})}tn(l.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(p){return{type:fn.error,result:p}}finally{h&&t.signal.removeEventListener("abort",h)}return l}async function A1(e){let{result:t,type:n}=e;if(pS(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:fn.error,error:w}}return n===fn.error?{type:fn.error,error:new Du(t.status,t.statusText,g),statusCode:t.status,headers:t.headers}:{type:fn.data,data:g,statusCode:t.status,headers:t.headers}}if(n===fn.error){if(Vy(t)){var i,a;if(t.data instanceof Error){var c,l;return{type:fn.error,error:t.data,statusCode:(c=t.init)==null?void 0:c.status,headers:(l=t.init)!=null&&l.headers?new Headers(t.init.headers):void 0}}return{type:fn.error,error:new Du(((i=t.init)==null?void 0:i.status)||500,void 0,t.data),statusCode:xl(t)?t.status:void 0,headers:(a=t.init)!=null&&a.headers?new Headers(t.init.headers):void 0}}return{type:fn.error,error:t,statusCode:xl(t)?t.status:void 0}}if(F1(t)){var h,f;return{type:fn.deferred,deferredData:t,statusCode:(h=t.init)==null?void 0:h.status,headers:((f=t.init)==null?void 0:f.headers)&&new Headers(t.init.headers)}}if(Vy(t)){var p,y;return{type:fn.data,data:t.data,statusCode:(p=t.init)==null?void 0:p.status,headers:(y=t.init)!=null&&y.headers?new Headers(t.init.headers):void 0}}return{type:fn.data,data:t}}function I1(e,t,n,i,a,c){let l=e.headers.get("Location");if(tn(l,"Redirects returned/thrown from loaders/actions must have a Location header"),!Zm.test(l)){let h=i.slice(0,i.findIndex(f=>f.route.id===n)+1);l=lm(new URL(t.url),h,a,!0,l,c),e.headers.set("Location",l)}return e}function Uy(e,t,n,i){let a=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];if(Zm.test(e)){let c=e,l=c.startsWith("//")?new URL(t.protocol+c):new URL(c);if(a.includes(l.protocol))throw new Error("Invalid redirect location");let h=Fl(l.pathname,n)!=null;if(l.origin===t.origin&&h)return l.pathname+l.search+l.hash}try{let c=i.createURL(e);if(a.includes(c.protocol))throw new Error("Invalid redirect location")}catch{}return e}function Ho(e,t,n,i){let a=e.createURL(mS(t)).toString(),c={signal:n};if(i&&ai(i.formMethod)){let{formMethod:l,formEncType:h}=i;c.method=l.toUpperCase(),h==="application/json"?(c.headers=new Headers({"Content-Type":h}),c.body=JSON.stringify(i.json)):h==="text/plain"?c.body=i.text:h==="application/x-www-form-urlencoded"&&i.formData?c.body=um(i.formData):c.body=i.formData}return new Request(a,c)}function um(e){let t=new URLSearchParams;for(let[n,i]of e.entries())t.append(n,typeof i=="string"?i:i.name);return t}function Wy(e){let t=new FormData;for(let[n,i]of e.entries())t.append(n,i);return t}function L1(e,t,n,i,a){let c={},l=null,h,f=!1,p={},y=n&&Dr(n[1])?n[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let w=g.route.id,x=t[w];if(tn(!oo(x),"Cannot handle redirect results in processLoaderData"),Dr(x)){let S=x.error;y!==void 0&&(S=y,y=void 0),l=l||{};{let C=io(e,w);l[C.route.id]==null&&(l[C.route.id]=S)}c[w]=void 0,f||(f=!0,h=xl(x.error)?x.error.status:500),x.headers&&(p[w]=x.headers)}else ws(x)?(i.set(w,x.deferredData),c[w]=x.deferredData.data,x.statusCode!=null&&x.statusCode!==200&&!f&&(h=x.statusCode),x.headers&&(p[w]=x.headers)):(c[w]=x.data,x.statusCode&&x.statusCode!==200&&!f&&(h=x.statusCode),x.headers&&(p[w]=x.headers))}),y!==void 0&&n&&(l={[n[0]]:y},c[n[0]]=void 0),{loaderData:c,errors:l,statusCode:h||200,loaderHeaders:p}}function zy(e,t,n,i,a,c,l){let{loaderData:h,errors:f}=L1(t,n,i,l);return a.forEach(p=>{let{key:y,match:g,controller:w}=p,x=c[y];if(tn(x,"Did not find corresponding fetcher result"),!(w&&w.signal.aborted))if(Dr(x)){let S=io(e.matches,g==null?void 0:g.route.id);f&&f[S.route.id]||(f=xn({},f,{[S.route.id]:x.error})),e.fetchers.delete(y)}else if(oo(x))tn(!1,"Unhandled fetcher revalidation redirect");else if(ws(x))tn(!1,"Unhandled fetcher deferred data");else{let S=bs(x.data);e.fetchers.set(y,S)}}),{loaderData:h,errors:f}}function Hy(e,t,n,i){let a=xn({},t);for(let c of n){let l=c.route.id;if(t.hasOwnProperty(l)?t[l]!==void 0&&(a[l]=t[l]):e[l]!==void 0&&c.route.loader&&(a[l]=e[l]),i&&i.hasOwnProperty(l))break}return a}function qy(e){return e?Dr(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function io(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 $y(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function jr(e,t){let{pathname:n,routeId:i,method:a,type:c,message:l}=t===void 0?{}:t,h="Unknown Server Error",f="Unknown @remix-run/router error";return e===400?(h="Bad Request",a&&n&&i?f="You made a "+a+' request to "'+n+'" but '+('did not provide a `loader` for route "'+i+'", ')+"so there is no way to handle the request.":c==="defer-action"?f="defer() is not supported in actions":c==="invalid-body"&&(f="Unable to encode submission body")):e===403?(h="Forbidden",f='Route "'+i+'" does not match URL "'+n+'"'):e===404?(h="Not Found",f='No route matches URL "'+n+'"'):e===405&&(h="Method Not Allowed",a&&n&&i?f="You made a "+a.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+i+'", ')+"so there is no way to handle the request.":a&&(f='Invalid request method "'+a.toUpperCase()+'"')),new Du(e||500,h,new Error(f),!0)}function $c(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[i,a]=t[n];if(oo(a))return{key:i,result:a}}}function mS(e){let t=typeof e=="string"?Ns(e):e;return Dl(xn({},t,{hash:""}))}function M1(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function D1(e){return pS(e.result)&&w1.has(e.result.status)}function ws(e){return e.type===fn.deferred}function Dr(e){return e.type===fn.error}function oo(e){return(e&&e.type)===fn.redirect}function Vy(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function F1(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 pS(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function _1(e){return v1.has(e.toLowerCase())}function ai(e){return b1.has(e.toLowerCase())}async function O1(e,t,n,i,a){let c=Object.entries(t);for(let l=0;l<c.length;l++){let[h,f]=c[l],p=e.find(w=>(w==null?void 0:w.route.id)===h);if(!p)continue;let y=i.find(w=>w.route.id===p.route.id),g=y!=null&&!hS(y,p)&&(a&&a[p.route.id])!==void 0;ws(f)&&g&&await ep(f,n,!1).then(w=>{w&&(t[h]=w)})}}async function B1(e,t,n){for(let i=0;i<n.length;i++){let{key:a,routeId:c,controller:l}=n[i],h=t[a];e.find(p=>(p==null?void 0:p.route.id)===c)&&ws(h)&&(tn(l,"Expected an AbortController for revalidating fetcher deferred result"),await ep(h,l.signal,!0).then(p=>{p&&(t[a]=p)}))}}async function ep(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:fn.data,data:e.deferredData.unwrappedData}}catch(a){return{type:fn.error,error:a}}return{type:fn.data,data:e.deferredData.data}}}function tp(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function ll(e,t){let n=typeof t=="string"?Ns(t).search:t.search;if(e[e.length-1].route.index&&tp(n||""))return e[e.length-1];let i=cS(e);return i[i.length-1]}function Gy(e){let{formMethod:t,formAction:n,formEncType:i,text:a,formData:c,json:l}=e;if(!(!t||!n||!i)){if(a!=null)return{formMethod:t,formAction:n,formEncType:i,formData:void 0,json:void 0,text:a};if(c!=null)return{formMethod:t,formAction:n,formEncType:i,formData:c,json:void 0,text:void 0};if(l!==void 0)return{formMethod:t,formAction:n,formEncType:i,formData:void 0,json:l,text:void 0}}}function Yh(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 U1(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 Ja(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 W1(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 bs(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 z1(e,t){try{let n=e.sessionStorage.getItem(dS);if(n){let i=JSON.parse(n);for(let[a,c]of Object.entries(i||{}))c&&Array.isArray(c)&&t.set(a,new Set(c||[]))}}catch{}}function H1(e,t){if(t.size>0){let n={};for(let[i,a]of t)n[i]=[...a];try{e.sessionStorage.setItem(dS,JSON.stringify(n))}catch(i){lo(!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 Fu(){return Fu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Fu.apply(this,arguments)}const nd=b.createContext(null),gS=b.createContext(null),_l=b.createContext(null),np=b.createContext(null),Gi=b.createContext({outlet:null,matches:[],isDataRoute:!1}),bS=b.createContext(null);function Ol(){return b.useContext(np)!=null}function Qr(){return Ol()||tn(!1),b.useContext(np).location}function yS(e){b.useContext(_l).static||b.useLayoutEffect(e)}function Wn(){let{isDataRoute:e}=b.useContext(Gi);return e?rR():q1()}function q1(){Ol()||tn(!1);let e=b.useContext(nd),{basename:t,future:n,navigator:i}=b.useContext(_l),{matches:a}=b.useContext(Gi),{pathname:c}=Qr(),l=JSON.stringify(Xm(a,n.v7_relativeSplatPath)),h=b.useRef(!1);return yS(()=>{h.current=!0}),b.useCallback(function(p,y){if(y===void 0&&(y={}),!h.current)return;if(typeof p=="number"){i.go(p);return}let g=Jm(p,JSON.parse(l),c,y.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Cs([t,g.pathname])),(y.replace?i.replace:i.push)(g,y.state,y)},[t,i,l,c,e])}const $1=b.createContext(null);function V1(e){let t=b.useContext(Gi).outlet;return t&&b.createElement($1.Provider,{value:e},t)}function ca(){let{matches:e}=b.useContext(Gi),t=e[e.length-1];return t?t.params:{}}function G1(e,t,n,i){Ol()||tn(!1);let{navigator:a}=b.useContext(_l),{matches:c}=b.useContext(Gi),l=c[c.length-1],h=l?l.params:{};l&&l.pathname;let f=l?l.pathnameBase:"/";l&&l.route;let p=Qr(),y;y=p;let g=y.pathname||"/",w=g;if(f!=="/"){let C=f.replace(/^\//,"").split("/");w="/"+g.replace(/^\//,"").split("/").slice(C.length).join("/")}let x=ro(e,{pathname:w});return J1(x&&x.map(C=>Object.assign({},C,{params:Object.assign({},h,C.params),pathname:Cs([f,a.encodeLocation?a.encodeLocation(C.pathname).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?f:Cs([f,a.encodeLocation?a.encodeLocation(C.pathnameBase).pathname:C.pathnameBase])})),c,n,i)}function K1(){let e=nR(),t=xl(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},t),n?b.createElement("pre",{style:a},n):null,null)}const Q1=b.createElement(K1,null);class Y1 extends b.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?b.createElement(Gi.Provider,{value:this.props.routeContext},b.createElement(bS.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function X1(e){let{routeContext:t,match:n,children:i}=e,a=b.useContext(nd);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(Gi.Provider,{value:t},i)}function J1(e,t,n,i){var a;if(t===void 0&&(t=[]),n===void 0&&(n=null),i===void 0&&(i=null),e==null){var c;if(!n)return null;if(n.errors)e=n.matches;else if((c=i)!=null&&c.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,h=(a=n)==null?void 0:a.errors;if(h!=null){let y=l.findIndex(g=>g.route.id&&(h==null?void 0:h[g.route.id])!==void 0);y>=0||tn(!1),l=l.slice(0,Math.min(l.length,y+1))}let f=!1,p=-1;if(n&&i&&i.v7_partialHydration)for(let y=0;y<l.length;y++){let g=l[y];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(p=y),g.route.id){let{loaderData:w,errors:x}=n,S=g.route.loader&&w[g.route.id]===void 0&&(!x||x[g.route.id]===void 0);if(g.route.lazy||S){f=!0,p>=0?l=l.slice(0,p+1):l=[l[0]];break}}}return l.reduceRight((y,g,w)=>{let x,S=!1,C=null,P=null;n&&(x=h&&g.route.id?h[g.route.id]:void 0,C=g.route.errorElement||Q1,f&&(p<0&&w===0?(iR("route-fallback"),S=!0,P=null):p===w&&(S=!0,P=g.route.hydrateFallbackElement||null)));let A=t.concat(l.slice(0,w+1)),L=()=>{let O;return x?O=C:S?O=P:g.route.Component?O=b.createElement(g.route.Component,null):g.route.element?O=g.route.element:O=y,b.createElement(X1,{match:g,routeContext:{outlet:y,matches:A,isDataRoute:n!=null},children:O})};return n&&(g.route.ErrorBoundary||g.route.errorElement||w===0)?b.createElement(Y1,{location:n.location,revalidation:n.revalidation,component:C,error:x,children:L(),routeContext:{outlet:null,matches:A,isDataRoute:!0}}):L()},null)}var vS=(function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e})(vS||{}),wS=(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})(wS||{});function Z1(e){let t=b.useContext(nd);return t||tn(!1),t}function eR(e){let t=b.useContext(gS);return t||tn(!1),t}function tR(e){let t=b.useContext(Gi);return t||tn(!1),t}function xS(e){let t=tR(),n=t.matches[t.matches.length-1];return n.route.id||tn(!1),n.route.id}function nR(){var e;let t=b.useContext(bS),n=eR(wS.UseRouteError),i=xS();return t!==void 0?t:(e=n.errors)==null?void 0:e[i]}function rR(){let{router:e}=Z1(vS.UseNavigateStable),t=xS(),n=b.useRef(!1);return yS(()=>{n.current=!0}),b.useCallback(function(a,c){c===void 0&&(c={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,Fu({fromRouteId:t},c)))},[e,t])}const Ky={};function iR(e,t,n){Ky[e]||(Ky[e]=!0)}function sR(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 ua(e){let{to:t,replace:n,state:i,relative:a}=e;Ol()||tn(!1);let{future:c,static:l}=b.useContext(_l),{matches:h}=b.useContext(Gi),{pathname:f}=Qr(),p=Wn(),y=Jm(t,Xm(h,c.v7_relativeSplatPath),f,a==="path"),g=JSON.stringify(y);return b.useEffect(()=>p(JSON.parse(g),{replace:n,state:i,relative:a}),[p,g,a,n,i]),null}function dm(e){return V1(e.context)}function oR(e){let{basename:t="/",children:n=null,location:i,navigationType:a=_n.Pop,navigator:c,static:l=!1,future:h}=e;Ol()&&tn(!1);let f=t.replace(/^\/*/,"/"),p=b.useMemo(()=>({basename:f,navigator:c,static:l,future:Fu({v7_relativeSplatPath:!1},h)}),[f,h,c,l]);typeof i=="string"&&(i=Ns(i));let{pathname:y="/",search:g="",hash:w="",state:x=null,key:S="default"}=i,C=b.useMemo(()=>{let P=Fl(y,f);return P==null?null:{location:{pathname:P,search:g,hash:w,state:x,key:S},navigationType:a}},[f,y,g,w,x,S,a]);return C==null?null:b.createElement(_l.Provider,{value:p},b.createElement(np.Provider,{children:n,value:C}))}new Promise(()=>{});function aR(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:b.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:b.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:b.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 _u(){return _u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},_u.apply(this,arguments)}function hm(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let i=e[n];return t.concat(Array.isArray(i)?i.map(a=>[n,a]):[[n,i]])},[]))}function lR(e,t){let n=hm(e);return t&&t.forEach((i,a)=>{n.has(a)||t.getAll(a).forEach(c=>{n.append(a,c)})}),n}const cR="6";try{window.__reactRouterVersion=cR}catch{}function uR(e,t){return C1({basename:void 0,future:_u({},void 0,{v7_prependBasename:!0}),history:GT({window:void 0}),hydrationData:dR(),routes:e,mapRouteProperties:aR,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function dR(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=_u({},t,{errors:hR(t.errors)})),t}function hR(e){if(!e)return null;let t=Object.entries(e),n={};for(let[i,a]of t)if(a&&a.__type==="RouteErrorResponse")n[i]=new Du(a.status,a.statusText,a.data,a.internal===!0);else if(a&&a.__type==="Error"){if(a.__subType){let c=window[a.__subType];if(typeof c=="function")try{let l=new c(a.message);l.stack="",n[i]=l}catch{}}if(n[i]==null){let c=new Error(a.message);c.stack="",n[i]=c}}else n[i]=a;return n}const fR=b.createContext({isTransitioning:!1}),mR=b.createContext(new Map),pR="startTransition",Qy=BP[pR],gR="flushSync",Yy=VT[gR];function bR(e){Qy?Qy(e):e()}function Za(e){Yy?Yy(e):e()}class yR{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=i=>{this.status==="pending"&&(this.status="resolved",t(i))},this.reject=i=>{this.status==="pending"&&(this.status="rejected",n(i))}})}}function vR(e){let{fallbackElement:t,router:n,future:i}=e,[a,c]=b.useState(n.state),[l,h]=b.useState(),[f,p]=b.useState({isTransitioning:!1}),[y,g]=b.useState(),[w,x]=b.useState(),[S,C]=b.useState(),P=b.useRef(new Map),{v7_startTransition:A}=i||{},L=b.useCallback(M=>{A?bR(M):M()},[A]),O=b.useCallback((M,I)=>{let{deletedFetchers:N,flushSync:z,viewTransitionOpts:G}=I;M.fetchers.forEach((B,W)=>{B.data!==void 0&&P.current.set(W,B.data)}),N.forEach(B=>P.current.delete(B));let J=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!G||J){z?Za(()=>c(M)):L(()=>c(M));return}if(z){Za(()=>{w&&(y&&y.resolve(),w.skipTransition()),p({isTransitioning:!0,flushSync:!0,currentLocation:G.currentLocation,nextLocation:G.nextLocation})});let B=n.window.document.startViewTransition(()=>{Za(()=>c(M))});B.finished.finally(()=>{Za(()=>{g(void 0),x(void 0),h(void 0),p({isTransitioning:!1})})}),Za(()=>x(B));return}w?(y&&y.resolve(),w.skipTransition(),C({state:M,currentLocation:G.currentLocation,nextLocation:G.nextLocation})):(h(M),p({isTransitioning:!0,flushSync:!1,currentLocation:G.currentLocation,nextLocation:G.nextLocation}))},[n.window,w,y,P,L]);b.useLayoutEffect(()=>n.subscribe(O),[n,O]),b.useEffect(()=>{f.isTransitioning&&!f.flushSync&&g(new yR)},[f]),b.useEffect(()=>{if(y&&l&&n.window){let M=l,I=y.promise,N=n.window.document.startViewTransition(async()=>{L(()=>c(M)),await I});N.finished.finally(()=>{g(void 0),x(void 0),h(void 0),p({isTransitioning:!1})}),x(N)}},[L,l,y,n.window]),b.useEffect(()=>{y&&l&&a.location.key===l.location.key&&y.resolve()},[y,w,a.location,l]),b.useEffect(()=>{!f.isTransitioning&&S&&(h(S.state),p({isTransitioning:!0,flushSync:!1,currentLocation:S.currentLocation,nextLocation:S.nextLocation}),C(void 0))},[f.isTransitioning,S]),b.useEffect(()=>{},[]);let ee=b.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:M=>n.navigate(M),push:(M,I,N)=>n.navigate(M,{state:I,preventScrollReset:N==null?void 0:N.preventScrollReset}),replace:(M,I,N)=>n.navigate(M,{replace:!0,state:I,preventScrollReset:N==null?void 0:N.preventScrollReset})}),[n]),q=n.basename||"/",_=b.useMemo(()=>({router:n,navigator:ee,static:!1,basename:q}),[n,ee,q]),E=b.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return b.useEffect(()=>sR(i,n.future),[i,n.future]),b.createElement(b.Fragment,null,b.createElement(nd.Provider,{value:_},b.createElement(gS.Provider,{value:a},b.createElement(mR.Provider,{value:P.current},b.createElement(fR.Provider,{value:f},b.createElement(oR,{basename:q,location:a.location,navigationType:a.historyAction,navigator:ee,future:E},a.initialized||n.future.v7_partialHydration?b.createElement(wR,{routes:n.routes,future:n.future,state:a}):t))))),null)}const wR=b.memo(xR);function xR(e){let{routes:t,future:n,state:i}=e;return G1(t,void 0,i,n)}var Xy;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Xy||(Xy={}));var Jy;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Jy||(Jy={}));function kR(e){let t=b.useRef(hm(e)),n=b.useRef(!1),i=Qr(),a=b.useMemo(()=>lR(i.search,n.current?null:t.current),[i.search]),c=Wn(),l=b.useCallback((h,f)=>{const p=hm(typeof h=="function"?h(a):h);n.current=!0,c("?"+p,f)},[c,a]);return[a,l]}const SR="modulepreload",CR=function(e){return"/"+e},Zy={},sa=function(t,n,i){let a=Promise.resolve();if(n&&n.length>0){let l=function(p){return Promise.all(p.map(y=>Promise.resolve(y).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),f=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));a=l(n.map(p=>{if(p=CR(p),p in Zy)return;Zy[p]=!0;const y=p.endsWith(".css"),g=y?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const w=document.createElement("link");if(w.rel=y?"stylesheet":SR,y||(w.as="script"),w.crossOrigin="",w.href=p,f&&w.setAttribute("nonce",f),document.head.appendChild(w),y)return new Promise((x,S)=>{w.addEventListener("load",x),w.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(l){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=l,window.dispatchEvent(h),!h.defaultPrevented)throw l}return a.then(l=>{for(const h of l||[])h.status==="rejected"&&c(h.reason);return t().catch(c)})},jR="desktop://window-lifecycle",kS=b.createContext(null),NR=["--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 PR(e){if(typeof document>"u")return;const{documentElement:t,body:n}=document;t.dataset.runtimePlatform=e.platform,t.dataset.osFamily=e.ui.osFamily,t.dataset.windowControls=e.ui.windowControlsStyle,t.dataset.viewportClass=e.viewportClass,t.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar),n&&(n.dataset.runtimePlatform=e.platform,n.dataset.osFamily=e.ui.osFamily,n.dataset.windowControls=e.ui.windowControlsStyle,n.dataset.viewportClass=e.viewportClass,n.dataset.overlayTitlebar=String(e.ui.prefersOverlayTitlebar))}function fm(){var e;if(!(typeof document>"u"))for(const t of NR)document.documentElement.style.removeProperty(t),(e=document.body)==null||e.style.removeProperty(t)}function TR(e){if(typeof document>"u")return;if(!e){fm();return}const t=[document.documentElement,document.body].filter(i=>!!i),n=[["--desktop-macos-traffic-light-center-y",`${e.trafficLightCenterY}px`],["--desktop-macos-traffic-light-leading-inset",`${e.trafficLightLeadingInset}px`],["--desktop-macos-traffic-light-safe-zone-width",`${e.trafficLightSafeZoneWidth}px`],["--desktop-macos-titlebar-height",`${e.titlebarHeight}px`],["--desktop-macos-traffic-light-button-diameter",`${e.trafficLightButtonDiameter}px`]];for(const i of t)for(const[a,c]of n)i.style.setProperty(a,c)}function RR(){if(!(typeof window>"u"))return window.innerWidth}function ER({children:e}){const[t,n]=b.useState(()=>RR()),i=b.useMemo(()=>Si({viewportWidth:t}),[t]);return b.useEffect(()=>{if(typeof window>"u")return;function a(){n(window.innerWidth)}return a(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a)}},[]),b.useEffect(()=>{PR(i)},[i]),b.useEffect(()=>()=>{fm()},[]),b.useEffect(()=>{let a=!1,c=null;return!i.isDesktop||!i.bridge.supported?()=>{a=!0}:(sa(()=>Promise.resolve().then(()=>YE),void 0).then(async({listen:l})=>{const h=await l(jR,f=>{const p=f.payload,y=p==null?void 0:p.descriptor;y!=null&&y.windowId&&(i.windows.registerDescriptor(y),p.isOpen?i.windows.markWindowOpen(y.windowId):i.windows.markWindowClosed(y.windowId))});if(a){h();return}c=h}).catch(()=>{}),()=>{a=!0,c==null||c()})},[i]),b.useEffect(()=>{let a=!1,c=null;async function l(){var f,p;const h=await i.bridge.getRuntimeInfo();a||TR(h.ok?(p=(f=h.value)==null?void 0:f.windowChrome)==null?void 0:p.macosTitlebar:null)}return!i.isDesktop||i.ui.osFamily!=="macos"||!i.ui.prefersOverlayTitlebar?(fm(),()=>{a=!0}):(l(),sa(()=>Promise.resolve().then(()=>nA),void 0).then(async({getCurrentWindow:h})=>{const f=await h().onScaleChanged(()=>{l()});if(a){f();return}c=f}).catch(()=>{}),()=>{a=!0,c==null||c()})},[i]),r.jsx(kS.Provider,{value:i,children:e})}function zn(){return b.useContext(kS)??Si()}const AR={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.",rawRefLabel:"Source",copyAction:"Copy",copyContentSuccess:"Content copied.",copyContentFailed:"Failed to copy the content.",loadMore:"Load More",composerPlaceholder:"State the next step clearly. Let the rest continue inside this session.",sendButton:"Send Message",queueTitle:"Queued Messages",queueDescription:"After the current run finishes, these messages will be processed automatically in order.",queueOrderPrefix:"Queue Position",queueStatusQueued:"Queued",queueStatusFailed:"Dispatch Failed",queueDelete:"Delete",queueDeleting:"Deleting",queueImageOnly:"Image attachments only",sendGuidanceButton:"Add Guidance",queueGuidanceButton:"Queue Guidance",queueSteer:"Steer",queueSteering:"Steering",resendButton:"Resend",quickPhraseTrigger:"Quick Phrases",quickPhraseModalTitle:"Quick Phrases",quickPhraseModalDescription:"Keep the prompts you reuse often in one place and drop them straight into the current composer.",quickPhraseCreateLabel:"New Phrase",quickPhraseOpenCreateAction:"Add Phrase",quickPhraseCreateModalTitle:"Create Quick Phrase",quickPhraseCreateModalDescription:"Save a reusable prompt on its own so it is ready across devices whenever you need it.",quickPhraseCreatePlaceholder:"Write a phrase you want to reuse later.",quickPhraseCreateAction:"Add Phrase",quickPhraseListLabel:"Quick phrase list",quickPhraseEmpty:"There are no quick phrases yet. Add the first one you actually reuse.",quickPhraseOrderLabel:"Item {index}",quickPhraseMoveUp:"Move phrase up",quickPhraseMoveDown:"Move phrase down",quickPhraseDelete:"Delete phrase",quickPhraseSaveFailed:"Failed to save quick phrases. Try again later.",sendingState:"Sending",sentState:"Synced",failedState:"Send failed",contextUsageTitle:"Context Usage",contextUsageUnavailable:"Context usage is not available yet",contextUsageEstimated:"Window is estimated",contextUsageCachedTokens:"{count} cached",contextUsageSourceProviderLog:"window from provider log",contextUsageSourceProviderRuntime:"window from provider runtime",contextUsageSourceProviderConfig:"window from provider config",contextUsageSourceModelMap:"window from model map",headerWorkspace:"Workspace",headerProvider:"Provider",headerCapability:"Capability Summary",connectionConnected:"Connected",connectionReconnecting:"Reconnecting",connectionReconnectFailed:"Reconnect failed",connectionClosed:"Connection closed",runtimeErrorTitle:"Session run failed",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.",filePanelActionsMenu:"File Actions",filePanelSearchPlaceholder:"Enter a file name or path fragment",filePanelSearchButton:"Search",filePanelShowSearch:"Open Search",filePanelHideSearch:"Hide Search",filePanelSearchEmpty:"No matching files found.",filePanelSearchResults:"Search Results",filePanelSearchFailed:"File search failed. Try again later.",filePanelBrowse:"Workspace Files",filePanelCollapseCurrent:"Collapse Current",filePanelCollapseAll:"Collapse All",filePanelBackDirectory:"Go to Parent",filePanelEmptyDirectory:"There are no files to show in this directory.",filePanelRecentTitle:"Recently Opened",filePanelEmptyRecent:"There is no recently opened file yet.",filePanelContextTitle:"Attached Files",filePanelEmptyContexts:"No file is attached to the current session yet.",filePanelEditorTitle:"Preview & Editor",filePanelEditorPlaceholder:"This is a lightweight text editor, not a full IDE.",filePanelSelectHint:"Pick a file first from browse, search, or recent items.",filePanelUnsupported:"This file cannot be edited directly in the sidebar right now.",filePanelAttach:"Attach to Session",filePanelAttached:"Attached",filePanelDetach:"Detach",filePanelSave:"Save",filePanelSaving:"Saving...",filePanelLoadFailed:"Failed to load the file panel.",filePanelOpenFailed:"Failed to open the file.",filePanelSaveSuccess:"File saved.",filePanelSaveFailed:"Failed to save the file.",fileViewerHint:"Opened in {language} mode. Preview and save after editing are supported.",fileViewerModeLabel:"File View Mode",fileViewerPreview:"Preview",fileViewerCode:"Code",fileViewerEdit:"Edit",fileViewerPlainText:"Plain Text",filePanelAttachSuccess:"The file has been attached to the current session.",filePanelAttachFailed:"Failed to attach the file.",filePanelDetachSuccess:"The file has been detached from the current session.",filePanelDetachFailed:"Failed to detach the file.",filePanelNewFile:"New File",filePanelNewDirectory:"New Directory",filePanelUpload:"Upload File",filePanelDownload:"Download File",filePanelUploadSuccess:"{name} uploaded.",filePanelUploadFailed:"Failed to upload the file.",filePanelDownloadSuccess:"Started downloading {name}.",filePanelDownloadFailed:"Failed to download the file.",filePanelDelete:"Delete",filePanelRenameMove:"Rename / Move",filePanelMutateFailed:"File operation failed. Check the path and current state.",filePanelCreateFilePrompt:"Enter the relative path of the file to create",filePanelCreateDirectoryPrompt:"Enter the relative path of the directory to create",filePanelFilterChanges:"Changes Only",filePanelShowAll:"Show All",filePanelNoChanges:"No changed files.",filePanelBinaryPreview:"Binary files cannot be previewed.",filePanelDeleteConfirm:"Delete this file? {path}",filePanelRenameMovePrompt:"Enter the new relative path",unavailableAction:"Unavailable",roleUser:"User",roleAssistant:"Assistant",roleTool:"Tool",roleSystem:"System"},git:{title:"Git Context",subtitle:"This is the session-side support area. It only handles Git facts inside the current workspace.",loading:"Loading Git context for the current workspace...",refresh:"Refresh",panelLoadFailed:"Git context is not available right now.",ahead:"Ahead",behind:"Behind",dirty:"Dirty",clean:"Clean",changeCount:"{count} changed files in the current workspace",noChanges:"There are no pending changes right now.",changesTitle:"Current Changes",rulesFirstHint:"Rules come first. Drafts must not bypass validation.",stage:"Stage",unstage:"Unstage",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.",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"}},IR={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 链路。",rawRefLabel:"来源",copyAction:"复制",copyContentSuccess:"内容已复制。",copyContentFailed:"内容复制失败。",loadMore:"加载更多消息",composerPlaceholder:"把下一步交代清楚,剩下的交给这条会话继续跑。",sendButton:"发送消息",queueTitle:"待发队列",queueDescription:"当前这轮结束后,队列里的消息会按顺序自动继续处理。",queueOrderPrefix:"队列序号",queueStatusQueued:"等待中",queueStatusFailed:"发送失败",queueDelete:"删除",queueDeleting:"删除中",queueImageOnly:"仅图片附件",sendGuidanceButton:"追加引导",queueGuidanceButton:"加入队列",queueSteer:"引导",queueSteering:"引导中",resendButton:"重试发送",quickPhraseTrigger:"快捷短语",quickPhraseModalTitle:"快捷短语",quickPhraseModalDescription:"这里集中管理你常用的会话指令,点一下就能直接填回当前输入框。",quickPhraseCreateLabel:"新增短语",quickPhraseOpenCreateAction:"新增短语",quickPhraseCreateModalTitle:"新增快捷短语",quickPhraseCreateModalDescription:"把常用指令单独存起来,后面在任何设备上都能直接复用。",quickPhraseCreatePlaceholder:"输入一条常用短语,保存后下次可以直接复用。",quickPhraseCreateAction:"添加短语",quickPhraseListLabel:"快捷短语列表",quickPhraseEmpty:"还没有可用的快捷短语,先加一条最常用的。",quickPhraseOrderLabel:"第 {index} 条",quickPhraseMoveUp:"上移短语",quickPhraseMoveDown:"下移短语",quickPhraseDelete:"删除短语",quickPhraseSaveFailed:"快捷短语保存失败,请稍后再试。",sendingState:"发送中",sentState:"已同步",failedState:"发送失败",contextUsageTitle:"当前上下文占用",contextUsageUnavailable:"当前上下文占用暂时不可用",contextUsageEstimated:"上限为估算值",contextUsageCachedTokens:"缓存命中 {count}",contextUsageSourceProviderLog:"上限来自 provider 运行日志",contextUsageSourceProviderRuntime:"上限来自 provider runtime",contextUsageSourceProviderConfig:"上限来自 provider 配置",contextUsageSourceModelMap:"上限来自模型映射",headerWorkspace:"工作区",headerProvider:"Provider",headerCapability:"能力摘要",connectionConnected:"已连接",connectionReconnecting:"正在重连",connectionReconnectFailed:"重连失败",connectionClosed:"连接已关闭",runtimeErrorTitle:"会话运行失败",reconnectExplain:"实时链路断开了,系统正在补回缺失消息。",reconnectFailedExplain:"自动恢复没有成功。你可以手动重试,或者稍后重新进入会话。",capabilityDenied:"当前会话不支持这个动作",capabilitySendDisabled:"当前 provider 不支持发送新消息",capabilityAttachmentDisabled:"当前会话还不支持附件输入",capabilityInterruptDisabled:"当前会话不支持中断运行",sidebarTitle:"当前会话上下文",sidebarSubtitle:"这里只保留最小能力摘要,不把页面做成后台控制台。",reconnectButton:"手动恢复实时同步",headerResumedAt:"最近续接",headerLastSyncAt:"最近同步",historyPages:"历史分页",syncStatusIdle:"同步空闲",syncStatusSyncing:"同步中",syncStatusError:"同步异常",capabilityResume:"可续接",capabilitySend:"可发送",capabilityInterrupt:"可中断",capabilityTools:"工具调用",attachmentsLabel:"附件",filePanelTitle:"文件管理",filePanelSubtitle:"这里的文件能力只服务当前会话,不把页面拉成重型 IDE。",filePanelNoWorkspace:"当前还没有选中项目,暂时不能浏览或挂载文件。",filePanelRefresh:"刷新",filePanelCopyPath:"复制路径",filePanelCopyAbsolutePath:"复制绝对路径",filePanelCopyRelativePath:"复制相对路径",filePanelCopyAbsolutePathSuccess:"绝对路径已复制。",filePanelCopyRelativePathSuccess:"相对路径已复制。",filePanelCopyPathFailed:"路径复制失败。",filePanelActionsMenu:"文件操作",filePanelSearchPlaceholder:"输入文件名或路径片段",filePanelSearchButton:"搜索",filePanelShowSearch:"打开搜索",filePanelHideSearch:"收起搜索",filePanelSearchEmpty:"没有找到匹配的文件。",filePanelSearchResults:"搜索结果",filePanelSearchFailed:"文件搜索失败,请稍后再试。",filePanelBrowse:"工作区文件",filePanelCollapseCurrent:"折叠当前选中",filePanelCollapseAll:"全部折叠",filePanelBackDirectory:"返回上级",filePanelEmptyDirectory:"这个目录里暂时没有可显示的文件。",filePanelRecentTitle:"最近打开",filePanelEmptyRecent:"最近还没有打开记录。",filePanelContextTitle:"已挂载文件",filePanelEmptyContexts:"当前会话还没有挂载文件管理。",filePanelEditorTitle:"预览与编辑",filePanelEditorPlaceholder:"这里只做轻量文本编辑,不在这里做完整 IDE。",filePanelSelectHint:"先从目录、搜索或最近打开里选一个文件。",filePanelUnsupported:"这个文件当前不能在侧栏里直接编辑。",filePanelAttach:"挂到会话",filePanelAttached:"已挂载",filePanelDetach:"解绑",filePanelSave:"保存",filePanelSaving:"保存中",filePanelLoadFailed:"文件管理面板加载失败。",filePanelOpenFailed:"文件打开失败。",filePanelSaveSuccess:"文件已经保存。",filePanelSaveFailed:"文件保存失败。",fileViewerHint:"当前以 {language} 模式打开,支持预览与编辑保存。",fileViewerModeLabel:"文件查看模式",fileViewerPreview:"预览",fileViewerCode:"代码",fileViewerEdit:"编辑",fileViewerPlainText:"纯文本",filePanelAttachSuccess:"文件已经挂到当前会话。",filePanelAttachFailed:"文件挂载失败。",filePanelDetachSuccess:"文件已经从当前会话解绑。",filePanelDetachFailed:"文件解绑失败。",filePanelNewFile:"新建文件",filePanelNewDirectory:"新建目录",filePanelUpload:"上传文件",filePanelDownload:"下载文件",filePanelUploadSuccess:"已上传 {name}。",filePanelUploadFailed:"文件上传失败。",filePanelDownloadSuccess:"已开始下载 {name}。",filePanelDownloadFailed:"文件下载失败。",filePanelDelete:"删除",filePanelRenameMove:"重命名/移动",filePanelMutateFailed:"文件操作失败,请检查路径和当前状态。",filePanelCreateFilePrompt:"输入要创建的相对文件路径",filePanelCreateDirectoryPrompt:"输入要创建的相对目录路径",filePanelFilterChanges:"仅显示变更",filePanelShowAll:"显示全部",filePanelNoChanges:"当前没有变更文件。",filePanelBinaryPreview:"二进制文件不支持预览。",filePanelDeleteConfirm:"确认删除这个文件吗?{path}",filePanelRenameMovePrompt:"输入新的相对路径",unavailableAction:"当前不可用",roleUser:"你",roleAssistant:"助手",roleTool:"工具",roleSystem:"系统"},git:{title:"Git 上下文",subtitle:"这里是会话侧边的辅助区,只处理当前工作区里的 Git 事实。",loading:"正在读取当前工作区的 Git 上下文。",refresh:"刷新",panelLoadFailed:"Git 上下文暂时没有加载出来。",ahead:"领先",behind:"落后",dirty:"有改动",clean:"已干净",changeCount:"当前有 {count} 个变更文件",noChanges:"当前没有待处理改动。",changesTitle:"当前变更",rulesFirstHint:"规则先于生成,草稿不能绕过校验。",stage:"暂存",unstage:"取消暂存",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:"远程同步失败。",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 操作超时了,先确认仓库状态和网络环境。"}}},LR=[{id:"zh-CN",labelKey:"locale.zhCN"},{id:"en-US",labelKey:"locale.enUS"}];function rp({variant:e="default",className:t}){const n=la(a=>a.profile.language);function i(a){a!==n&&Lu({language:a}).catch(()=>{})}return r.jsxs("label",{className:`language-switcher language-switcher-${e}${t?` ${t}`:""}`,children:[r.jsx("span",{className:"language-switcher-label",children:u("common.language")}),r.jsx("div",{className:"language-switcher-options",role:"group","aria-label":u("common.language"),children:LR.map(a=>r.jsx("button",{type:"button",className:`language-switcher-option${n===a.id?" active":""}`,"aria-pressed":n===a.id,onClick:()=>i(a.id),children:u(a.labelKey)},a.id))})]})}const MR={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:"退出当前账号并返回登录页面"},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} 个可识别文件。",manageWorkspaceRemoveAction:"移除项目",manageWorkspaceRemoving:"移除中...",manageWorkspaceRemoveSuccess:"项目已从当前工作台移除",manageWorkspaceRemoveFailed:"移除项目失败",manageWorkspaceRemoveConfirmTitle:"确认移除项目",manageWorkspaceRemoveConfirmDescription:"这只会把项目从当前工作台列表移除,不会删除任何磁盘数据或历史记录。后续重新加载同一路径时,旧记录会直接恢复显示。",manageWorkspaceRemoveConfirmTarget:"确定移除「{name}」吗?",manageWorkspaceRemoveConfirmAction:"确认移除",importWorkspaceTitle:"添加项目",importWorkspaceHint:"导入本地代码目录",importExpand:"展开",importCollapse:"收起",importPathLabel:"项目路径",importPathPlaceholder:"输入项目文件夹路径",importNameLabel:"项目名称",importNamePlaceholder:"可选",importSubmit:"添加项目",importSubmitting:"添加中...",importChooseFolder:"选择文件夹",importPickFolderFailed:"打开文件夹选择器失败",importDesktopDropHint:"支持把本地项目文件夹直接拖到这个区域",importHint:"输入本地代码目录后就能开始工作",importServerDirectoryHint:"浏览并选择运行服务器上的项目目录",importBrowserTitle:"选择服务器目录",importBrowserDescription:"这里浏览的是项目运行所在服务器上的目录,不是当前设备的本地目录。",importBrowserCurrentPath:"当前目录",importBrowserRoots:"根目录",importBrowserOpenParent:"返回上一级",importBrowserOpenPath:"打开路径",importBrowserCreateDirectory:"新建文件夹",importBrowserCreateDirectoryTitle:"新建文件夹",importBrowserCreateDirectoryDescription:"只在当前服务器目录下新建一层子文件夹,不接受带路径的输入。",importBrowserCreateDirectoryLabel:"文件夹名称",importBrowserCreateDirectoryPlaceholder:"输入新文件夹名称",importBrowserCreateDirectorySuccess:"文件夹已创建",importBrowserCreateDirectoryFailed:"新建文件夹失败",importBrowserCreateDirectorySubmit:"确认新建",importBrowserCreatingDirectory:"新建中...",importBrowserEmpty:"当前目录下没有可选的子目录",importBrowserBrowseFailed:"加载服务器目录失败",importBrowserSubmit:"导入当前目录",importPathRequired:"请输入项目路径",importSuccess:"项目已添加",importFailed:"添加失败",cloneWorkspaceTitle:"Clone项目",cloneWorkspaceHint:"从 Git 仓库拉取代码到服务端目录,完成后直接加入项目列表。",cloneSubmit:"Clone项目",cloneSubmitting:"Clone 中...",cloneRepositoryLabel:"Git 仓库地址",cloneRepositoryPlaceholder:"例如:https://github.com/org/repo.git",cloneParentPathLabel:"目标父目录",cloneParentPathPlaceholder:"选择后端服务上已存在的目录",cloneDirectoryNameLabel:"新项目目录名",cloneDirectoryNamePlaceholder:"留空时默认使用仓库名",clonePickDirectory:"选择目录",cloneAuthModeLabel:"认证方式",cloneAuthModeNone:"无认证",cloneAuthModeBasic:"用户名 + 密码",cloneAuthModeToken:"Token",cloneUsernameLabel:"用户名",cloneUsernamePlaceholder:"输入 Git 用户名",clonePasswordLabel:"密码",clonePasswordPlaceholder:"输入 Git 密码",cloneTokenLabel:"Token",cloneTokenPlaceholder:"输入 access token",cloneTokenUsernamePlaceholder:"可选,留空时默认使用 git",cloneRepoRequired:"请输入 Git 仓库地址",clonePathRequired:"请选择目标父目录",cloneSuccess:"项目已成功 Clone",cloneFailed:"Clone 失败",cloneHint:"目标父目录必须已经存在,Clone 时会在这个目录下新建仓库文件夹。",cloneBrowserTitle:"选择 Clone 目标父目录",cloneBrowserDescription:"这里选的是服务端已存在的父目录,Clone 时会在其下新建一个项目文件夹。",cloneBrowserSubmit:"使用当前目录",refreshNavigation:"刷新",desktopChromeLabel:"桌面工作台",windowMinimize:"最小化窗口",windowMaximize:"最大化或还原窗口",windowClose:"关闭窗口",contextOpenSession:"打开会话",navigationLoadFailed:"加载失败,请重试",emptyNavigationTitle:"还没有项目",emptyNavigationBody:"添加本地代码目录开始工作",emptyWorkspaceSessions:"暂无会话",favoriteSectionTitle:"收藏会话",favoriteSectionEmpty:"收藏后的会话会固定放在这里,方便你快速回到常用链路。",favoriteAction:"收藏会话",unfavoriteAction:"取消收藏",favoriteAdded:"会话已加入收藏",favoriteRemoved:"会话已取消收藏",favoriteToggleFailed:"收藏状态更新失败",sessionMoreAction:"更多操作",sessionStateInferred:"推断",renameAction:"重命名",renameSuccess:"会话名称已更新",renameFailed:"会话重命名失败",renameModalTitle:"重命名会话",renameModalDescription:"改成你自己能一眼认出来的名字,只改标题,不改消息内容。",renameInputLabel:"会话名称",renameInputPlaceholder:"输入新的会话名称",renamingSession:"保存中...",archiveFolderLabel:"归档会话",archiveFolderAction:"打开归档文件夹",archiveAction:"归档会话",archiveCurrentSessionAction:"归档当前会话",archiveAdded:"会话已归档",archiveConfirmTitle:"确认归档会话",archiveConfirmDescription:"归档后,这条会话会从当前工作区主列表里隐藏,你仍然可以在归档区恢复它。",unarchiveAction:"取消归档",archiveRestored:"会话已恢复到主列表",archiveModalTitle:"归档会话",archiveModalDescription:"这里列出当前项目暂时隐藏的会话,需要时可以恢复到主列表。",archiveEmpty:"这个项目还没有归档会话。",subagentBadge:"子代理",subagentExpand:"展开子代理列表",subagentCollapse:"收起子代理列表",subagentExpandMore:"展开更多子代理",favoriteExpandMore:"显示更多收藏",sessionExpandMore:"显示更多会话",archiveExpandMore:"查看更多归档会话",workspaceCollapse:"收起项目",workspaceExpand:"展开项目",switchWorkspace:"切换到此项目",workspaceHomeSwitcherLabel:"切换工作区",workspaceHomeSwitcherTitle:"工作区",workspaceHomeStatusSectionTitle:"当前工作区",workspaceHomeViewAllAction:"查看全部会话",workspaceHomeMetricActive:"活动",workspaceHomeMetricUnread:"通知",workspaceHomeMetricTerminal:"终端",workspaceHomeMetricChanges:"变更",workspaceHomeActiveSessionsSectionTitle:"活动会话",workspaceHomeQuickLaunchStatusLabel:"快捷启动进程",workspaceHomeQuickLaunchRunning:"运行中",workspaceHomeQuickLaunchStopped:"未运行",workspaceHomeWaitingInputLabel:"等待输入",workspaceHomeButlerLabel:"代码助手",mobileButlerEntry:"代码助手",mobileButlerEmptyTitle:"代码助手还没准备好",mobileButlerEmptyBody:"当前还没有完成代码助手初始化,先在桌面端做完首轮初始化,再回到手机端看跟进和自动化。",mobileButlerSummaryTitle:"当前工作区摘要",mobileButlerSummaryProjects:"项目",mobileButlerSummaryFollowUps:"进行中任务",mobileButlerSummaryWaitingUser:"待你处理",mobileButlerSummaryInbox:"未完成代办",mobileButlerAssistantWorkspaceLabel:"助手工作目录",mobileButlerAssistantToneLabel:"沟通风格",mobileButlerAssistantLanguageLabel:"工作语言",mobileButlerAssistantUpdatedAtLabel:"最近更新",workspaceOverviewTitle:"把项目入口放到看得见的地方",workspaceOverviewBody:"先选项目,再决定是继续已有会话,还是开一条新的工作链路。",workspaceListBody:"这里保留当前工作台里的全部项目,并把高频操作直接放到首页。",workspaceDetailTitle:"项目详情",workspaceDetailSummaryTitle:"项目概览",workspaceDetailSummaryBody:"先看当前项目路径、Git 摘要和代码规模,再决定下一步去哪做事。",workspaceDetailMissingTitle:"没找到这个项目",workspaceDetailMissingBody:"这个项目可能已经被移除,或者当前快照还没加载到它。",workspaceSessionListBody:"项目里的会话、收藏和归档操作都收在这里,不再让你先去翻侧栏。",recentSessionsSectionTitle:"最近会话",recentSessionsSectionBody:"先回到最近在做的事情,别让手机端还要你猜入口。",currentWorkspaceSectionTitle:"当前项目会话",currentWorkspaceSectionBody:"当前项目下的会话都集中在这里,方便继续刚才的上下文。",sessionIndexTitle:"会话入口单独成页",sessionIndexBody:"最近、收藏、当前项目三块分开看,手机上找会话别再靠侧栏折叠。",toolsMoreAction:"更多",toolsSwipeHint:"左右滑动切换文件管理和 Git 管理",toolsSwipePosition:"{current} / {total}",toolFilesBody:"查看项目文件、变更文件和代码上下文,不再靠桌面右栏概念。",toolGitBody:"把当前项目的 Git 状态、提交和分支操作收进一个明确入口。",toolTerminalsBody:"进入终端主页面,处理输入密集和滚动密集的操作。",toolProcessesBody:"查看当前项目的终端模板、运行状态和进程入口。",toolsWorkspaceRequiredBody:"先选一个项目,再打开对应的工具页。",createSession:"新建会话",createSessionModalTitle:"选择新会话类型",createSessionModalDescription:"先选会话类型,再启动真正的会话进程。",createSessionWorkspaceLabel:"选择工作区",createSessionProviderLabel:"选择供应商",createSessionTarget:"当前项目",providerClaudeCode:"Claude Code",providerCodexDescription:"创建 Codex 会话,适合继续当前默认工作流。",providerClaudeDescription:"创建 Claude Code 会话,适合切换另一条会话链路。",providerOpenCodeDescription:"创建 OpenCode 会话,适合通过 OpenCode server 延续当前上下文。",providerGeminiDescription:"创建 Gemini 会话,适合接入 Gemini CLI 的原生工作流。",providerKimiDescription:"创建 Kimi 会话,适合接入 Kimi CLI 的原生工作流。",providerOptionHint:"选择后会立即创建会话",startClaude:"Claude",startCodex:"Codex",startingSession:"创建中...",startClaudeSuccess:"Claude 会话已创建",startCodexSuccess:"Codex 会话已创建",startSessionFailed:"创建失败",auxiliaryTitle:"信息",auxiliarySubtitle:"文件与 Git 状态",expandAuxiliary:"展开",collapseAuxiliary:"收起",auxiliaryEmptyTitle:"选择一个会话",auxiliaryEmptyBody:"会话文件和 Git 信息将显示在这里",batchSelectSessions:"批量选择会话",batchSelectionMode:"批量选择",selectAllSessions:"全选",clearSelectedSessions:"清空选择",batchArchiveAction:"归档已选",batchArchiving:"归档中...",batchArchiveSuccess:"已归档选中的会话",batchArchivePartialFailed:"部分会话归档失败,请重试",batchArchiveFailed:"批量归档失败",hideSessionSidebar:"隐藏会话列表",showSessionSidebar:"显示会话列表",hideInfoSidebar:"隐藏信息栏",showInfoSidebar:"显示信息栏",centerTabsLabel:"中间区域标签",infoTabsLabel:"信息栏标签",leftResizerLabel:"调整左侧宽度",rightResizerLabel:"调整右侧宽度",filesPanelEmpty:"先导入或选中一个项目,文件管理才能显示。",gitPanelEmpty:"先导入或选中一个工作区,Git 信息才能显示。",infoPanelDeferred:"左侧会话列表优先加载,右侧附属面板稍后再挂载。"},workbench:{emptyEyebrow:"开始",emptyTitle:"先选一个会话",emptyBody:"从左侧继续之前的内容,或新建一个会话。",emptyResumeTitle:"继续",emptyResumeBody:"回到上次停下的地方。",emptyNewTitle:"新建",emptyNewBody:"把新问题放进新会话。",emptyCompanionTitle:"查看辅助信息",emptyCompanionBody:"需要文件、Git 或终端时,再看右侧。",emptyTip:"准备好后,从左侧选一个会话开始。"},conversation:{resendButton:"重发",historyLoading:"加载中...",historyLoadingOlder:"加载更早的消息...",historyLoadFailed:"加载失败",timelineEmpty:"开始对话",composerPlaceholder:"把下一步交代清楚,剩下的交给这条会话继续跑。",sendButton:"发送消息",attachFiles:"附加文件",attachmentSourceSheetTitle:"添加图片",attachmentSourceSheetDescription:"选择直接拍照,或从相册里挑一张现有图片。",attachmentTakePhoto:"拍照",attachmentTakePhotoHint:"直接打开相机拍一张新图片",attachmentChooseFromLibrary:"从相册选择",attachmentChooseFromLibraryHint:"从手机相册或图片库里挑选",pasteImagesHint:"支持直接粘贴图片",attachmentImageOnly:"目前只支持图片附件",attachmentReadFailed:"图片读取失败,请重试",attachmentPreviewAlt:"已选图片预览",attachmentPreviewOpen:"点击查看大图",attachmentPreviewClose:"关闭图片预览",attachmentPreviewLoading:"图片加载中",attachmentPreviewUnavailable:"图片暂时不可预览",imageAttachmentLabel:"图片附件",imagePreviewTitle:"图片预览",imagePreviewHint:"点击遮罩或按 Esc 可以关闭预览",removeAttachment:"移除附件",modelSelectorLabel:"选择模型",modelUseCliDefault:"默认",modelUseCodexConfig:"跟随当前 Codex 配置",modelUseOpenCodeConfig:"跟随当前 OpenCode 配置",reasoningSelectorLabel:"选择推理强度",reasoningLow:"低",reasoningMedium:"中",reasoningHigh:"高",reasoningMaximum:"极高",slashMenu:"命令",slashMenuTitle:"快捷命令",slashCommandPlan:"先让对方给出执行路线",slashCommandReview:"直接进入代码审查模式",slashCommandExplain:"要求用更清楚的方式解释",toolInputLabel:"输入",toolResultLabel:"结果",toolResultEmpty:"暂无输出",toolPreviewCommand:"命令",toolPreviewTerminal:"终端",toolStatusRunning:"运行中",toolStatusFailed:"已失败",toolStatusCompleted:"已完成",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",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:"收起提示词",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:"主题"}},DR={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."},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 available project can be bound in the current workspace.",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 only shows todos in the current workspace so unrelated projects do not get mixed in.",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.",manageWorkspaceRemoveAction:"Remove Project",manageWorkspaceRemoving:"Removing...",manageWorkspaceRemoveSuccess:"Project removed from the current workbench list",manageWorkspaceRemoveFailed:"Failed to remove the project",manageWorkspaceRemoveConfirmTitle:"Confirm Project Removal",manageWorkspaceRemoveConfirmDescription:"This only removes the project from the current workbench list. It does not delete any files on disk or historical records. If you load the same path again later, the old records will appear again.",manageWorkspaceRemoveConfirmTarget:'Remove "{name}" from the current workbench?',manageWorkspaceRemoveConfirmAction:"Remove Project",importWorkspaceTitle:"Add Project",importWorkspaceHint:"Import a local code directory",importExpand:"Expand",importCollapse:"Collapse",importPathLabel:"Project Path",importPathPlaceholder:"Enter the project folder path",importNameLabel:"Project Name",importNamePlaceholder:"Optional",importSubmit:"Add Project",importSubmitting:"Adding...",importChooseFolder:"Choose Folder",importPickFolderFailed:"Failed to open the folder picker",importDesktopDropHint:"You can drag a local project folder directly into this area",importHint:"Enter a local code directory and start working",importServerDirectoryHint:"Browse and select the project directory on the server",importBrowserTitle:"Select Server Directory",importBrowserDescription:"You are browsing directories on the server, not on the current device.",importBrowserCurrentPath:"Current Path",importBrowserRoots:"Root Directories",importBrowserOpenParent:"Go Up",importBrowserOpenPath:"Open Path",importBrowserCreateDirectory:"New Folder",importBrowserCreateDirectoryTitle:"New Folder",importBrowserCreateDirectoryDescription:"Create a single child folder in the current server path. Path separators are not accepted.",importBrowserCreateDirectoryLabel:"Folder Name",importBrowserCreateDirectoryPlaceholder:"Enter the new folder name",importBrowserCreateDirectorySuccess:"Folder created",importBrowserCreateDirectoryFailed:"Failed to create folder",importBrowserCreateDirectorySubmit:"Create Folder",importBrowserCreatingDirectory:"Creating...",importBrowserEmpty:"No subdirectory is available in the current path",importBrowserBrowseFailed:"Failed to load server directories",importBrowserSubmit:"Import Current Directory",importPathRequired:"Enter the project path",importSuccess:"Project added",importFailed:"Failed to add project",cloneWorkspaceTitle:"Clone Project",cloneWorkspaceHint:"Clone a Git repository into a server directory and add it to the project list.",cloneSubmit:"Clone Project",cloneSubmitting:"Cloning...",cloneRepositoryLabel:"Git Repository URL",cloneRepositoryPlaceholder:"For example: https://github.com/org/repo.git",cloneParentPathLabel:"Target Parent Directory",cloneParentPathPlaceholder:"Choose an existing directory on the backend server",cloneDirectoryNameLabel:"New Project Directory Name",cloneDirectoryNamePlaceholder:"Defaults to the repository name when left empty",clonePickDirectory:"Choose Directory",cloneAuthModeLabel:"Authentication",cloneAuthModeNone:"No Authentication",cloneAuthModeBasic:"Username + Password",cloneAuthModeToken:"Token",cloneUsernameLabel:"Username",cloneUsernamePlaceholder:"Enter Git username",clonePasswordLabel:"Password",clonePasswordPlaceholder:"Enter Git password",cloneTokenLabel:"Token",cloneTokenPlaceholder:"Enter access token",cloneTokenUsernamePlaceholder:"Optional, defaults to git when left empty",cloneRepoRequired:"Enter the Git repository URL",clonePathRequired:"Select the target parent directory",cloneSuccess:"Project cloned successfully",cloneFailed:"Clone failed",cloneHint:"The target parent directory must already exist. Clone creates a new repository folder under it.",cloneBrowserTitle:"Select Clone Parent Directory",cloneBrowserDescription:"Choose an existing server-side parent directory. Clone will create a new project folder under it.",cloneBrowserSubmit:"Use Current Directory",refreshNavigation:"Refresh",desktopChromeLabel:"Desktop Workbench",windowMinimize:"Minimize Window",windowMaximize:"Maximize or Restore Window",windowClose:"Close Window",contextOpenSession:"Open Session",navigationLoadFailed:"Load failed. Retry.",emptyNavigationTitle:"No project yet",emptyNavigationBody:"Add a local code directory to start working",emptyWorkspaceSessions:"No sessions",favoriteSectionTitle:"Pinned Sessions",favoriteSectionEmpty:"Pinned sessions stay here for quick access.",favoriteAction:"Pin Session",unfavoriteAction:"Unpin",favoriteAdded:"Session pinned",favoriteRemoved:"Session unpinned",favoriteToggleFailed:"Failed to update pinned state",sessionMoreAction:"More Actions",sessionStateInferred:"Inferred",renameAction:"Rename",renameSuccess:"Session name updated",renameFailed:"Failed to rename session",renameModalTitle:"Rename Session",renameModalDescription:"Use a name you can recognize at a glance. This changes only the title, not the content.",renameInputLabel:"Session Name",renameInputPlaceholder:"Enter a new session name",renamingSession:"Saving...",archiveFolderLabel:"Archived Sessions",archiveFolderAction:"Open Archive Folder",archiveAction:"Archive Session",archiveCurrentSessionAction:"Archive Current Session",archiveAdded:"Session archived",archiveConfirmTitle:"Archive This Session",archiveConfirmDescription:"After archiving, this session will be hidden from the main list for the current workspace, and you can still restore it from archive.",unarchiveAction:"Restore from Archive",archiveRestored:"Session restored to the main list",archiveModalTitle:"Archived Sessions",archiveModalDescription:"This list shows sessions temporarily hidden in the current project. Restore them when needed.",archiveEmpty:"There are no archived sessions in this project yet.",subagentBadge:"Sub-agent",subagentExpand:"Expand Sub-agent List",subagentCollapse:"Collapse Sub-agent List",subagentExpandMore:"Show More Sub-agents",favoriteExpandMore:"Show More Pinned",sessionExpandMore:"Show More Sessions",archiveExpandMore:"Show More Archived Sessions",workspaceCollapse:"Collapse Project",workspaceExpand:"Expand Project",switchWorkspace:"Switch to Project",workspaceHomeSwitcherLabel:"Switch Workspace",workspaceHomeSwitcherTitle:"Workspace",workspaceHomeStatusSectionTitle:"Current Workspace",workspaceHomeViewAllAction:"View All Sessions",workspaceHomeMetricActive:"Active",workspaceHomeMetricUnread:"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.",workspaceSessionListBody:"Project sessions, favorites, and archive actions live here instead of hiding in a sidebar.",recentSessionsSectionTitle:"Recent Sessions",recentSessionsSectionBody:"Jump back into the work you touched most recently.",currentWorkspaceSectionTitle:"Current Project Sessions",currentWorkspaceSectionBody:"Keep the sessions for the current project together so the context stays obvious.",sessionIndexTitle:"Sessions deserve their own page",sessionIndexBody:"Recent, favorites, and current-project sessions are split into clear sections for mobile.",toolsMoreAction:"More",toolsSwipeHint:"Swipe left or right to switch between files and Git",toolsSwipePosition:"{current} / {total}",toolFilesBody:"Browse project files, changed files, and code context without relying on a desktop sidebar.",toolGitBody:"Open a clear Git entry for status, commits, and branches in the current project.",toolTerminalsBody:"Open the full terminal page for input-heavy and scroll-heavy tasks.",toolProcessesBody:"Review terminal templates, runtime status, and process entry points for the current project.",toolsWorkspaceRequiredBody:"Pick a project before opening this tool page.",createSession:"New Session",createSessionModalTitle:"Choose Session Type",createSessionModalDescription:"Pick the session type first, then start the actual session process.",createSessionWorkspaceLabel:"Choose Workspace",createSessionProviderLabel:"Choose Provider",createSessionTarget:"Current Project",providerClaudeCode:"Claude Code",providerCodexDescription:"Create a Codex session for the current default workflow.",providerClaudeDescription:"Create a Claude Code session when you want to switch to another conversation chain.",providerOpenCodeDescription:"Create an OpenCode session to continue context via the OpenCode service.",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",startClaude:"Claude",startCodex:"Codex",startingSession:"Creating...",startClaudeSuccess:"Claude session created",startCodexSuccess:"Codex session created",startSessionFailed:"Failed to create session",auxiliaryTitle:"Info",auxiliarySubtitle:"Files and Git status",expandAuxiliary:"Expand",collapseAuxiliary:"Collapse",auxiliaryEmptyTitle:"Select a session",auxiliaryEmptyBody:"Session files and Git info will appear here",batchSelectSessions:"Select Sessions in Bulk",batchSelectionMode:"Batch Selection",selectAllSessions:"Select All",clearSelectedSessions:"Clear Selection",batchArchiveAction:"Archive Selected",batchArchiving:"Archiving...",batchArchiveSuccess:"Selected sessions archived",batchArchivePartialFailed:"Some sessions failed to archive. Retry.",batchArchiveFailed:"Batch archive failed",hideSessionSidebar:"Hide Session List",showSessionSidebar:"Show Session List",hideInfoSidebar:"Hide Info Sidebar",showInfoSidebar:"Show Info Sidebar",centerTabsLabel:"Center Area Tabs",infoTabsLabel:"Info Sidebar Tabs",leftResizerLabel:"Resize Left Sidebar",rightResizerLabel:"Resize Right Sidebar",filesPanelEmpty:"Import or select a workspace first to use file management.",gitPanelEmpty:"Import or select a workspace first to view Git info.",infoPanelDeferred:"The left session list loads first. The right auxiliary panel mounts slightly later."},workbench:{emptyEyebrow:"Start",emptyTitle:"Choose a session first",emptyBody:"Continue from the left, or create a new session.",emptyResumeTitle:"Continue",emptyResumeBody:"Go back to where you stopped.",emptyNewTitle:"New session",emptyNewBody:"Put a new question into a clean session.",emptyCompanionTitle:"Side details",emptyCompanionBody:"Open files, Git, or terminal on the right when needed.",emptyTip:"When you are ready, pick a session from the left."},conversation:{resendButton:"Resend",historyLoading:"Loading...",historyLoadingOlder:"Loading older messages...",historyLoadFailed:"Load failed",timelineEmpty:"Start Conversation",composerPlaceholder:"State the next step clearly. Let the session continue from there.",sendButton:"Send Message",attachFiles:"Attach File",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",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",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",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"}},SS={"zh-CN":IR,"en-US":AR},FR={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:"请先填写助手名称"},_R={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 ev(e,t){const n=e.shell;return{...e,shell:{...n&&typeof n=="object"?n:{},...t}}}const CS={"zh-CN":ev(MR,FR),"en-US":ev(DR,_R)};function Ou(e,t){const n=e.split(".");let i=t;for(const a of n){if(!i||typeof i=="string")return e;const c=i[a];if(c==null)return e;i=c}return typeof i=="string"?i:e}function OR(){return ui.getState().profile.language??"zh-CN"}function u(e,t){const i=OR()==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const a of i){const c=Ou(e,CS[a]);if(c!==e)return Xh(c,t);const l=Ou(e,SS[a]);if(l!==e)return Xh(l,t)}return Xh(e,t)}function Xh(e,t){return t?e.replace(/\{([^}]+)\}/g,(n,i)=>{const a=t[i];return a==null?n:String(a)}):e}function BR({children:e,language:t}){return b.useEffect(()=>{document.documentElement.setAttribute("lang",t)},[t]),e}function UR(){const e=la(t=>t.profile.language);return t=>{const n=e==="en-US"?["en-US","zh-CN"]:["zh-CN"];for(const i of n){const a=Ou(t,CS[i]);if(a!==t)return a;const c=Ou(t,SS[i]);if(c!==t)return c}return t}}const jS=[{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 NS(e){return u(e.labelKey)}function WR(){return typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function zR(){return ui.getState().profile.theme??WR()}function HR(e){typeof window>"u"||(document.documentElement.setAttribute("data-theme",e),Lu({theme:e}).catch(()=>{}))}function PS(){return{theme:la(t=>t.profile.theme),setTheme:HR}}function qR(){typeof window>"u"||document.documentElement.setAttribute("data-theme",zR())}function $R({children:e}){const t=la(n=>n.profile.theme);return b.useEffect(()=>{qR()},[t]),r.jsx(r.Fragment,{children:e})}const VR={showToast:()=>"",dismissToast:()=>{}},TS=b.createContext(VR);function GR(){return`toast-${Math.random().toString(36).slice(2,10)}`}function KR({toast:e,onDismiss:t}){const{id:n,title:i,description:a,tone:c,durationMs:l,action:h}=e;return b.useEffect(()=>{if(l===null)return;const f=window.setTimeout(()=>{t(n)},l);return()=>{window.clearTimeout(f)}},[l,n,t,i,a,c]),r.jsxs("article",{className:"toast-card","data-tone":c,role:c==="error"?"alert":"status",children:[r.jsxs("div",{className:"toast-body",children:[r.jsx("strong",{className:"toast-title",children:i}),a?r.jsx("p",{className:"toast-description",children:a}):null]}),r.jsxs("div",{className:"toast-actions",children:[h?r.jsx("button",{className:"toast-action",type:"button",onClick:()=>{h.onClick(),t(n)},children:h.label}):null,r.jsx("button",{className:"toast-dismiss",type:"button","aria-label":"关闭通知",onClick:()=>t(n),children:"×"})]})]})}function QR({children:e}){const[t,n]=b.useState([]),i=b.useCallback(l=>{n(h=>h.filter(f=>f.id!==l))},[]),a=b.useCallback(l=>{const h=l.id??GR(),f={id:h,title:l.title,description:l.description,tone:l.tone??"info",durationMs:l.durationMs===void 0?4200:l.durationMs,action:l.action};return n(p=>{const y=p.findIndex(w=>w.id===h);if(y===-1)return[...p,f];const g=[...p];return g[y]=f,g}),h},[]),c=b.useMemo(()=>({showToast:a,dismissToast:i}),[i,a]);return r.jsxs(TS.Provider,{value:c,children:[e,r.jsx("div",{className:"toast-viewport","aria-live":"polite","aria-atomic":"false",children:t.map(l=>r.jsx(KR,{toast:l,onDismiss:i},l.id))})]})}function En(){return b.useContext(TS)}const gu="0.1.5",RS=b.createContext(gu);function YR({children:e}){const t=zn(),[n,i]=b.useState(gu);return b.useEffect(()=>{let a=!1;return t.isDesktop?(t.bridge.getRuntimeInfo().then(c=>{var h,f;if(a)return;const l=c.ok?(f=(h=c.value)==null?void 0:h.version)==null?void 0:f.trim():"";i(l||gu)}),()=>{a=!0}):(i(gu),()=>{a=!0})},[t]),r.jsx(RS.Provider,{value:n,children:e})}function ES(){return b.useContext(RS)}const AS="codingns.server.base-url.history",IS=6,LS="__custom__";function MS(){return typeof window<"u"&&typeof window.localStorage<"u"}function XR(){return typeof window>"u"||!window.location.origin?null:window.location.origin}function DS(e){if(!e)return null;try{return Vi(e)}catch{return null}}function JR(){if(!MS())return[];const e=window.localStorage.getItem(AS);if(!e)return[];try{const t=JSON.parse(e);return Array.isArray(t)?t.map(n=>typeof n=="string"?DS(n):null).filter(n=>!!n):[]}catch{return[]}}function ZR(e){const t=new Set,n=[];for(const i of e)!i||t.has(i)||(t.add(i),n.push(i));return n}function eE(e){const t=JR();return ZR([e,...t,DS(XR())]).slice(0,IS)}function tE(e){MS()&&window.localStorage.setItem(AS,JSON.stringify(e.slice(0,IS)))}class nE{constructor(){He(this,"state",this.createState(Gn.getState().hostBaseUrl));He(this,"listeners",new Set);He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state);Gn.subscribe(()=>{const t=this.createState(Gn.getState().hostBaseUrl);t.baseUrl===this.state.baseUrl&&t.options.length===this.state.options.length&&t.options.every((n,i)=>n===this.state.options[i])||(this.state=t,this.emit())})}setBaseUrl(t){const n=Vi(t),i=n!==Gn.getState().hostBaseUrl;return this.state=this.createState(n),this.emit(),Gn.update({hostBaseUrl:n}),i}reset(){this.state=this.createState(Gn.getState().hostBaseUrl),this.emit()}createState(t){const n=eE(t);return tE(n),{baseUrl:t,options:n}}emit(){for(const t of this.listeners)t()}}const Bu=new nE;function Uu(e){return b.useSyncExternalStore(Bu.subscribe,()=>e(Bu.getState()))}function rE(e,t){return t.includes(e)?e:LS}function iE(){return LS}const FS={login(e,t,n){return kn.login(e,t,n)},bootstrap(e,t,n){return kn.bootstrap(e,t,n)},refresh(){return kn.refresh()},logout(){kn.clear()}};function sE(){const e=Wn(),t=Uu(C=>C.baseUrl),[n,i]=b.useState("admin"),[a,c]=b.useState(""),[l,h]=b.useState(""),[f,p]=b.useState(null),[y,g]=b.useState("error"),[w,x]=b.useState(!1);async function S(C){if(C.preventDefault(),a!==l){g("error"),p(u("auth.bootstrapMismatch"));return}x(!0),p(null);try{await FS.bootstrap(n,a),g("success"),p(u("auth.bootstrapSuccess")),window.setTimeout(()=>e("/login",{replace:!0}),500)}catch(P){g("error"),P instanceof mr?p(P.message):p(u("auth.authUnavailable"))}finally{x(!1)}}return r.jsx("main",{className:"page-center app-shell",children:r.jsxs("section",{className:"auth-card surface-card",children:[r.jsx("h1",{children:u("auth.bootstrapTitle")}),r.jsx("p",{className:"status-text",children:u("auth.bootstrapSubtitle")}),r.jsxs("div",{className:"field-group",children:[r.jsx("span",{children:u("auth.serverCurrent")}),r.jsx("span",{className:"auth-server-value",children:t})]}),r.jsxs("form",{className:"auth-form",onSubmit:S,children:[r.jsxs("label",{className:"field-group",children:[r.jsx("span",{children:u("auth.username")}),r.jsx("input",{value:n,onChange:C=>i(C.target.value)})]}),r.jsxs("label",{className:"field-group",children:[r.jsx("span",{children:u("auth.password")}),r.jsx("input",{type:"password",value:a,onChange:C=>c(C.target.value)})]}),r.jsxs("label",{className:"field-group",children:[r.jsx("span",{children:u("auth.confirmPassword")}),r.jsx("input",{type:"password",value:l,onChange:C=>h(C.target.value)})]}),f?r.jsx("p",{className:"status-text","data-tone":y,children:f}):null,r.jsx("button",{className:"primary-button",type:"submit",disabled:w,children:u(w?"common.loading":"auth.submitBootstrap")})]})]})})}async function oE(e){try{return{...await ST(e),reachable:!0}}catch{return{initialized:!1,reachable:!1}}}function aE({isOpen:e,onClose:t,onSave:n,theme:i="dark"}){const a=Uu(L=>L.baseUrl),c=Uu(L=>L.options),l=iE(),[h,f]=b.useState(a),[p,y]=b.useState(null),g=b.useMemo(()=>{try{return Vi(h)}catch{return null}},[h]),w=rE(g??h,c),x="server-settings-preset",S="server-settings-address";if(b.useEffect(()=>{e&&(f(a),y(null))},[e,a]),!e)return null;function C(){if(!g){y(u("auth.serverInvalid"));return}Bu.setBaseUrl(g),n==null||n(g),t()}function P(L){L.target===L.currentTarget&&t()}function A(){g&&f(g)}return r.jsx("div",{className:"server-settings-modal-backdrop","data-theme":i,onClick:P,role:"dialog","aria-modal":"true","aria-labelledby":"server-settings-title",children:r.jsxs("div",{className:"server-settings-modal",children:[r.jsxs("div",{className:"server-settings-modal-header",children:[r.jsx("div",{className:"cyber-header-line"}),r.jsxs("h2",{id:"server-settings-title",className:"cyber-title",children:[r.jsx("span",{className:"cyber-title-icon",children:"◈"}),u("auth.serverSettingsTitle")]}),r.jsx("div",{className:"cyber-header-line"}),r.jsx("button",{className:"server-settings-close",onClick:t,"aria-label":u("common.close"),children:"×"})]}),r.jsxs("div",{className:"server-settings-modal-content",children:[r.jsxs("label",{className:"field-group cyber-field",htmlFor:x,children:[r.jsx("span",{className:"cyber-label",children:u("auth.serverPreset")}),r.jsxs("div",{className:"cyber-select-wrapper",children:[r.jsxs("select",{id:x,"aria-label":u("auth.serverPreset"),className:"cyber-select",value:w,onChange:L=>{const O=L.target.value;O!==l&&(f(O),y(null))},children:[c.map(L=>r.jsx("option",{value:L,children:L},L)),r.jsx("option",{value:l,children:u("auth.serverCustomOption")})]}),r.jsx("span",{className:"cyber-select-arrow",children:"▼"})]})]}),r.jsxs("label",{className:"field-group cyber-field",htmlFor:S,children:[r.jsx("span",{className:"cyber-label",children:u("auth.serverAddress")}),r.jsxs("div",{className:"cyber-input-wrapper",children:[r.jsx("input",{id:S,"aria-label":u("auth.serverAddress"),className:"cyber-input",value:h,placeholder:u("auth.serverPlaceholder"),onBlur:A,onChange:L=>{f(L.target.value),y(null)}}),r.jsx("div",{className:"cyber-input-glow"})]})]}),r.jsxs("p",{className:"cyber-hint",children:[r.jsx("span",{className:"cyber-hint-icon",children:"ℹ"}),u("auth.serverHint")]}),p?r.jsxs("p",{className:"cyber-status","data-tone":"error",children:[r.jsx("span",{className:"cyber-status-icon",children:"⚠"}),p]}):null]}),r.jsxs("div",{className:"server-settings-modal-footer",children:[r.jsx("button",{className:"cyber-button cyber-button-secondary",onClick:t,children:u("common.cancel")}),r.jsxs("button",{className:"cyber-button cyber-button-primary",onClick:C,children:[r.jsx("span",{className:"cyber-button-glow"}),r.jsx("span",{className:"cyber-button-text",children:u("auth.saveServerSettings")})]})]})]})})}const tv="width=device-width, initial-scale=1.0, viewport-fit=cover",lE="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover";function cE(){const e=b.useRef(null);return b.useEffect(()=>{const t=e.current;if(!t)return;const n=t.getContext("2d");if(!n)return;let i;const a=()=>{l(),h()};let c=[];const l=()=>{t.width=window.innerWidth,t.height=window.innerHeight},h=()=>{c=[];const p=Math.min(50,Math.floor(t.width*t.height/25e3));for(let y=0;y<p;y++)c.push({x:Math.random()*t.width,y:Math.random()*t.height,vx:(Math.random()-.5)*.5,vy:(Math.random()-.5)*.5,size:Math.random()*2+1,opacity:Math.random()*.5+.2})},f=()=>{n.clearRect(0,0,t.width,t.height),c.forEach((p,y)=>{p.x+=p.vx,p.y+=p.vy,p.x<0&&(p.x=t.width),p.x>t.width&&(p.x=0),p.y<0&&(p.y=t.height),p.y>t.height&&(p.y=0),n.beginPath(),n.arc(p.x,p.y,p.size,0,Math.PI*2),n.fillStyle=`rgba(10, 132, 255, ${p.opacity})`,n.fill(),c.slice(y+1).forEach(g=>{const w=p.x-g.x,x=p.y-g.y,S=Math.sqrt(w*w+x*x);S<150&&(n.beginPath(),n.moveTo(p.x,p.y),n.lineTo(g.x,g.y),n.strokeStyle=`rgba(10, 132, 255, ${.1*(1-S/150)})`,n.stroke())})}),i=requestAnimationFrame(f)};return l(),h(),f(),window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),cancelAnimationFrame(i)}},[]),r.jsx("canvas",{ref:e,className:"particle-canvas"})}function uE({text:e}){return r.jsx("span",{className:"glitch-text","data-text":e,children:e})}function dE({text:e}){const[t,n]=b.useState(""),[i,a]=b.useState(!0);return b.useEffect(()=>{let c=0,l=null;const h=setInterval(()=>{c<=e.length?(n(e.slice(0,c)),c++):(clearInterval(h),l=window.setTimeout(()=>a(!1),1e3))},50);return()=>{clearInterval(h),l!==null&&window.clearTimeout(l)}},[e]),r.jsxs("span",{className:"typewriter-text",children:[t,i&&r.jsx("span",{className:"typewriter-cursor",children:"_"})]})}function hE(){const e=Wn(),t=UR(),[n]=kR(),i=zn(),a=ES(),c=Gm(i.platform),l=b.useMemo(()=>WP(i),[i]),h=b.useMemo(()=>l?Lk():null,[l]),f=(h==null?void 0:h.serverBaseUrl)??null,[p,y]=b.useState(()=>(h==null?void 0:h.username)??"admin"),[g,w]=b.useState(()=>(h==null?void 0:h.password)??""),[x,S]=b.useState(()=>!!h),C=Uu(Z=>Z.baseUrl),[P,A]=b.useState(C),[L,O]=b.useState(null),[ee,q]=b.useState(!1),[_,E]=b.useState(!1),[M,I]=b.useState(null),[N,z]=b.useState(!1),G=Kk(Z=>Z.session),J=b.useMemo(()=>n.get("returnTo")??"/",[n]),{theme:B}=PS(),W=b.useRef(!1),Y=i.isNativeMobile,Q=b.useMemo(()=>B==="light"?"light":"dark",[B]);b.useEffect(()=>{if(typeof document>"u")return;const Z=document.querySelector('meta[name="viewport"]');if(!(Z instanceof HTMLMetaElement))return;const F=Z.getAttribute("content")??tv;return Y?Z.setAttribute("content",lE):Z.setAttribute("content",tv),()=>{Z.setAttribute("content",F)}},[Y]),b.useEffect(()=>{W.current||(W.current=!0,!(!l||!f||f===C)&&(Bu.setBaseUrl(f),A(f)))},[C,l,f]),b.useEffect(()=>{if(G){e(J,{replace:!0});return}if(!P)return;let Z=!1;return oE(P).then(F=>{Z||(F.demoMode&&(z(!0),kT()&&O(t("auth.demoSessionExpired"))),F.reachable&&!F.initialized&&e("/bootstrap",{replace:!0}))}).catch(()=>{Z||O(t("auth.authUnavailable"))}),()=>{Z=!0}},[G,e,P,J,t]);async function D(Z){Z.preventDefault(),q(!0),O(null),A(C),l&&!x&&HP();try{await FS.login(p,g,C),await ui.refreshForAuthenticatedUser(),l&&x&&Mk({username:p,password:g,serverBaseUrl:C}),e(J,{replace:!0})}catch(F){if(F instanceof mr){if(F.errorCode==="BOOTSTRAP_REQUIRED"){e("/bootstrap",{replace:!0});return}O(F.message)}else O(t("auth.authUnavailable"))}finally{q(!1)}}function re(Z){A(Z),O(null)}const R="login-username",$="login-password";return r.jsxs("main",{className:"cyber-login-page","data-theme":Q,"data-native-mobile":Y?"true":"false",children:[r.jsxs("div",{className:"cyber-bg",children:[r.jsx("div",{className:"cyber-grid"}),r.jsx("div",{className:"cyber-glow cyber-glow-1"}),r.jsx("div",{className:"cyber-glow cyber-glow-2"}),r.jsx(cE,{})]}),r.jsx("div",{className:"scanlines"}),r.jsxs("div",{className:"cyber-login-container",children:[r.jsx("div",{className:"cyber-login-toolbar",children:r.jsx(rp,{variant:"compact"})}),r.jsxs("div",{className:"cyber-login-content",children:[r.jsxs("div",{className:"cyber-brand",children:[r.jsx("div",{className:"cyber-logo",children:r.jsx("img",{src:"/logo.png",alt:"CodingNS",className:"cyber-logo-svg"})}),r.jsx("h1",{className:"cyber-brand-title",children:r.jsx(uE,{text:"CodingNS"})}),r.jsx("p",{className:"cyber-brand-subtitle",children:r.jsx(dE,{text:t("auth.loginSubtitle")})})]}),r.jsxs("div",{className:"cyber-card",children:[r.jsx("div",{className:"cyber-corner corner-tl"}),r.jsx("div",{className:"cyber-corner corner-tr"}),r.jsx("div",{className:"cyber-corner corner-bl"}),r.jsx("div",{className:"cyber-corner corner-br"}),r.jsxs("div",{className:"cyber-card-header",children:[r.jsx("div",{className:"cyber-line"}),r.jsx("span",{className:"cyber-card-label",children:t("auth.loginTitle").toUpperCase()}),r.jsx("div",{className:"cyber-line"})]}),N?r.jsxs("div",{className:"cyber-demo-banner",children:[r.jsx("span",{className:"cyber-demo-icon",children:"⚠"}),r.jsx("span",{children:t("auth.demoBanner")})]}):null,r.jsxs("form",{className:"cyber-form",onSubmit:D,children:[r.jsxs("div",{className:`cyber-field ${M==="username"?"focused":""}`,children:[r.jsx("div",{className:"cyber-field-border",children:r.jsx("div",{className:"cyber-field-border-glow"})}),r.jsxs("label",{className:"cyber-field-label",htmlFor:R,children:[r.jsx("span",{className:"cyber-field-icon",children:"❯"}),t("auth.username")]}),r.jsx("input",{id:R,"aria-label":t("auth.username"),className:"cyber-input",value:p,onChange:Z=>y(Z.target.value),onFocus:()=>I("username"),onBlur:()=>I(null),autoComplete:"username"})]}),r.jsxs("div",{className:`cyber-field ${M==="password"?"focused":""}`,children:[r.jsx("div",{className:"cyber-field-border",children:r.jsx("div",{className:"cyber-field-border-glow"})}),r.jsxs("label",{className:"cyber-field-label",htmlFor:$,children:[r.jsx("span",{className:"cyber-field-icon",children:"⚷"}),t("auth.password")]}),r.jsx("input",{id:$,"aria-label":t("auth.password"),className:"cyber-input",type:"password",value:g,onChange:Z=>w(Z.target.value),onFocus:()=>I("password"),onBlur:()=>I(null),autoComplete:"current-password"})]}),l?r.jsxs("label",{className:"cyber-remember-toggle",children:[r.jsx("input",{"aria-label":t("auth.rememberPassword"),type:"checkbox",checked:x,onChange:Z=>S(Z.target.checked)}),r.jsx("span",{children:t("auth.rememberPassword")})]}):null,L?r.jsxs("div",{className:"cyber-status","data-tone":"error",children:[r.jsx("span",{className:"cyber-status-icon",children:"⚠"}),r.jsx("span",{children:L})]}):null,r.jsxs("button",{className:`cyber-submit ${ee?"loading":""}`,type:"submit",disabled:ee,children:[r.jsx("span",{className:"cyber-submit-glow"}),r.jsx("span",{className:"cyber-submit-border"}),r.jsx("span",{className:"cyber-submit-text",children:ee?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"cyber-spinner"}),t("common.loading")]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"cyber-submit-icon",children:"➤"}),t("auth.submitLogin")]})})]})]}),c?r.jsxs("div",{className:"cyber-footer",children:[r.jsxs("div",{className:"cyber-divider",children:[r.jsx("span",{className:"cyber-divider-line"}),r.jsx("span",{className:"cyber-divider-text",children:"//"}),r.jsx("span",{className:"cyber-divider-line"})]}),r.jsxs("button",{className:"cyber-server-btn",onClick:()=>E(!0),type:"button",children:[r.jsx("span",{className:"cyber-server-icon",children:"⚙"}),r.jsx("span",{className:"cyber-server-text",children:t("auth.serverSettings")}),r.jsx("span",{className:"cyber-server-current",children:C})]})]}):null]})]}),r.jsxs("div",{className:"cyber-version",children:[r.jsxs("span",{className:"cyber-version-text",children:["v",a]}),r.jsx("span",{className:"cyber-version-divider",children:"|"}),r.jsx("span",{className:"cyber-version-text",children:"SYSTEM READY"})]})]}),c?r.jsx(aE,{isOpen:_,onClose:()=>E(!1),onSave:re,theme:Q}):null]})}function Yr(){return zn().haptics}function Lr(){return"/workspaces"}function li(e){return`/workspaces/${encodeURIComponent(e)}`}function Bl(e){return`${li(e)}/sessions`}function Bn(e,t){return`${Bl(e)}/${encodeURIComponent(t)}`}function da(e,t){const n=`${li(e)}/tools`;if(!t)return n;const i=new URLSearchParams({tab:t});return`${n}?${i.toString()}`}function _S(e){return`${li(e)}/tools/files`}function OS(e){return`${li(e)}/tools/git`}function rd(e){return`${li(e)}/tools/processes`}function Zo(e){return`${li(e)}/terminals`}function co(e,t){const n=`${li(e)}/butler`;if(!t)return n;const i=new URLSearchParams({tab:t});return`${n}?${i.toString()}`}function ip(e){return e.flatMap(t=>t.sessions.map(n=>({session:n,workspace:t.workspace}))).sort((t,n)=>(n.session.lastMessageAt??n.session.updatedAt).localeCompare(t.session.lastMessageAt??t.session.updatedAt))}function fE(e){const t=new Map(e.map(a=>[a.session.sessionId,a])),n=new Map,i=[];for(const a of e){const c=pE(a,t);if(c===a.session.sessionId){i.push(a);continue}const l=n.get(c)??[];n.set(c,[...l,a])}return[...i].sort(nv).map(a=>({entry:a,children:[...n.get(a.session.sessionId)??[]].sort(nv)}))}function BS(e,t){const n=mE(),i=new URLSearchParams({provider:t});return`${Bn(e,n)}?${i.toString()}`}function mE(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?`draft-${e.randomUUID()}`:`draft-${Date.now()}-${Math.random().toString(16).slice(2)}`}function nv(e,t){return(t.session.lastMessageAt??t.session.updatedAt).localeCompare(e.session.lastMessageAt??e.session.updatedAt)}function pE(e,t){var a;let n=e;const i=new Set([e.session.sessionId]);for(;;){const c=((a=n.session.parentSessionId)==null?void 0:a.trim())||null;if(!c)return n.session.sessionId;const l=t.get(c);if(!l)return n.session.sessionId;if(i.has(l.session.sessionId))return e.session.sessionId;i.add(l.session.sessionId),n=l}}const gE="mobile.tools.last-primary-tool";function US(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(gE)==="git"?"git":"files"}catch{return"files"}}function sp(e){var i;const t=[{pattern:"/workspaces/:workspaceId/tools/processes",routeKind:"processes"},{pattern:"/workspaces/:workspaceId/tools/files",routeKind:"files"},{pattern:"/workspaces/:workspaceId/tools/git",routeKind:"git"},{pattern:"/workspaces/:workspaceId/tools",routeKind:"home"}];for(const a of t){const c=On(a.pattern,e),l=((i=c==null?void 0:c.params.workspaceId)==null?void 0:i.trim())??null;if(l)return{workspaceId:l,routeKind:a.routeKind,legacy:!1}}const n=[{pattern:"/tools/processes",routeKind:"processes"},{pattern:"/tools/files",routeKind:"files"},{pattern:"/tools/git",routeKind:"git"},{pattern:"/tools",routeKind:"home"}];for(const a of n)if(On(a.pattern,e))return{workspaceId:null,routeKind:a.routeKind,legacy:!0};return null}function bE(e,t){const n=sp(e);if((n==null?void 0:n.routeKind)==="git")return"git";if((n==null?void 0:n.routeKind)==="files")return"files";const i=new URLSearchParams(t).get("tab");return i==="git"?"git":i==="files"?"files":US()}function op(e,t){const n=sp(e);return n!=null&&n.workspaceId?da(n.workspaceId,bE(e,t)):n!=null&&n.legacy?US()==="git"?"/tools?tab=git":"/tools?tab=files":null}function ap({activeEntry:e,presentation:t,pathname:n,search:i,moreButtonLabel:a}){if(t==="conversation-focus"||e!=="tools")return null;const c=sp(n);return c?c.routeKind==="processes"?{title:u("shell.terminalManagerEntry"),showBackButton:!0,showMoreButton:!1,moreButtonLabel:a}:(c.routeKind==="home"||c.routeKind==="files"||c.routeKind==="git",null):null}const WS=b.createContext({composerPortalTarget:null});function lp({composerPortalTarget:e,children:t}){return r.jsx(WS.Provider,{value:{composerPortalTarget:e},children:t})}function zS(){return b.useContext(WS)}function cp(e,t,n){const[i,a]=b.useState(void 0);return b.useEffect(()=>{const c=e.current,l=t.current;if(!n||!c||!l){a(void 0),c&&c.style.removeProperty("--mobile-conversation-tabbar-height");return}const h=c,f=l;function p(){if(!e.current||!f.isConnected)return;const g=`${Math.round(f.getBoundingClientRect().height)}px`;h.style.setProperty("--mobile-conversation-tabbar-height",g),a(g)}p();const y=typeof ResizeObserver<"u"?new ResizeObserver(p):null;return y==null||y.observe(f),window.addEventListener("resize",p),()=>{y==null||y.disconnect(),window.removeEventListener("resize",p),h.style.removeProperty("--mobile-conversation-tabbar-height")}},[n,e,t]),i}const yE=3e3,Vc=10,rv=84,iv=.36;function up({enabled:e,rootRef:t,suspended:n=!1,resetKey:i}){const a=b.useRef(null),c=b.useRef(null),l=b.useRef("visible"),h=b.useRef(1),[f,p]=b.useState("visible"),[y,g]=b.useState(1);b.useEffect(()=>{l.current=f},[f]),b.useEffect(()=>{h.current=y},[y]);function w(){Xs(a),a.current=window.setTimeout(()=>{x()},yE)}function x(){p("hidden"),g(0)}function S(){p("visible"),g(1),w()}b.useEffect(()=>{if(Xs(a),!e){Xs(a),p("visible"),g(1);return}if(n){p("hidden"),g(0);return}return S(),()=>{Xs(a)}},[e,i,n]),b.useEffect(()=>()=>{Xs(a)},[]),b.useEffect(()=>{if(!e||n){c.current=null;return}const P=t.current;if(!P)return;function A(M){if(M.touches.length!==1){c.current=null;return}const I=M.touches[0],N=av(M.target);if(!I||!N){c.current=null;return}c.current={surface:N,startX:I.clientX,startY:I.clientY,pointerType:"touch",initialState:l.current==="visible"?"visible":"hidden",touchId:I.identifier,dragging:!1,latestProgress:h.current},l.current==="visible"&&Xs(a)}function L(M){const I=c.current;if(!I||I.pointerType!=="touch")return;const N=Jh(M.touches,I.touchId);if(!N)return;const z=N.clientX-I.startX,G=N.clientY-I.startY;if(I.surface==="conversation"){if(Math.abs(G)<=Vc||Math.abs(G)<=Math.abs(z))return;c.current=null,I.initialState==="visible"&&x();return}const J=I.initialState==="hidden"?-G:G;J<=Vc&&!I.dragging||(cv(M),I.dragging=!0,I.latestProgress=sv(I.initialState,J),p("dragging"),g(I.latestProgress))}function O(M){const I=c.current;if(!(!I||I.pointerType!=="touch"||!Jh(M.changedTouches,I.touchId))){if(c.current=null,!I.dragging){I.initialState==="visible"&&w();return}ov(I.initialState,I.latestProgress,S,p,g)}}function ee(M){const I=c.current;if(!(!I||I.pointerType!=="touch"||!Jh(M.changedTouches,I.touchId))){if(c.current=null,!I.dragging){I.initialState==="visible"&&w();return}if(I.initialState==="visible"){S();return}p("hidden"),g(0)}}function q(M){if(M.pointerType!=="touch")return;const I=av(M.target);if(!I){c.current=null;return}if(c.current={surface:I,startX:M.clientX,startY:M.clientY,pointerType:"pointer",initialState:l.current==="visible"?"visible":"hidden",pointerId:M.pointerId,captureTarget:M.target instanceof Element?M.target:null,dragging:!1,latestProgress:h.current},M.target instanceof Element)try{M.target.setPointerCapture(M.pointerId)}catch{}l.current==="visible"&&Xs(a)}function _(M){const I=c.current;if(!I||I.pointerType!=="pointer")return;const N=M.clientX-I.startX,z=M.clientY-I.startY;if(I.surface==="conversation"){if(Math.abs(z)<=Vc||Math.abs(z)<=Math.abs(N))return;c.current=null,I.initialState==="visible"&&x();return}const G=I.initialState==="hidden"?-z:z;G<=Vc&&!I.dragging||(cv(M),I.dragging=!0,I.latestProgress=sv(I.initialState,G),p("dragging"),g(I.latestProgress))}function E(M){const I=c.current;if(!(!I||I.pointerType!=="pointer"||I.pointerId!==M.pointerId)){if(c.current=null,vE(I),!I.dragging){I.initialState==="visible"&&w();return}ov(I.initialState,I.latestProgress,S,p,g)}}return P.addEventListener("touchstart",A,{passive:!0}),P.addEventListener("pointerdown",q,{passive:!0}),window.addEventListener("touchmove",L,{passive:!1}),window.addEventListener("touchend",O),window.addEventListener("touchcancel",ee),window.addEventListener("pointermove",_,{passive:!1}),window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E),()=>{P.removeEventListener("touchstart",A),P.removeEventListener("pointerdown",q),window.removeEventListener("touchmove",L),window.removeEventListener("touchend",O),window.removeEventListener("touchcancel",ee),window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E)}},[e,t,n]);const C=e&&!n?y:e?0:1;return{state:n&&e?"hidden":f,progress:C,isOpen:C>.01}}function Xs(e){e.current!==null&&(window.clearTimeout(e.current),e.current=null)}function sv(e,t){return lv(e==="hidden"?t/rv:1-t/rv,0,1)}function ov(e,t,n,i,a){if(e==="hidden"){if(t>=iv){n();return}i("hidden"),a(0);return}if(t<=1-iv){i("hidden"),a(0);return}n()}function vE(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 Jh(e,t){if(typeof t!="number")return e[0]??null;for(let n=0;n<e.length;n+=1){const i=e[n];if((i==null?void 0:i.identifier)===t)return i}return null}function av(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 lv(e,t,n){return Math.min(Math.max(e,t),n)}function cv(e){e.cancelable&&e.preventDefault()}function Ul({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:i,preferCompactLayout:a=!1}){return a||e==="compact"?"compact":e==="expanded"&&n&&i?"expanded":t==="tools"&&i?"medium-auxiliary":n?"medium-navigation":i?"medium-auxiliary":"compact"}function id(e){return!e.isNativeMobile||e.viewportClass==="expanded"||typeof window>"u"?!1:window.innerHeight>window.innerWidth}function HS(e){return e==="medium-navigation"||e==="expanded"}function qS(e){return e==="medium-auxiliary"||e==="expanded"}function dp({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:i,preferCompactLayout:a=!1,children:c,navigationPanel:l,auxiliaryPanel:h}){const f=Ul({viewportClass:e,activeEntry:t,hasNavigationPanel:n,hasAuxiliaryPanel:i,preferCompactLayout:a}),p=HS(f)&&l,y=qS(f)&&h;return r.jsxs("div",{className:"mobile-adaptive-pane-layout","data-pane-layout":f,children:[p?r.jsx("aside",{className:"workbench-nav surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-navigation",children:l}):null,r.jsx("div",{className:"mobile-adaptive-pane-main",children:c}),y?r.jsx("aside",{className:"workbench-auxiliary surface-card mobile-adaptive-pane-panel mobile-adaptive-pane-panel-auxiliary",children:h}):null]})}function wE({activeEntry:e,presentation:t="default",children:n,navigationPanel:i,auxiliaryPanel:a,onNavigateWorkspaces:c,onNavigateTerminals:l,onNavigateSessions:h,onNavigateTools:f,onNavigateToolFiles:p,onNavigateToolGit:y,onNavigateToolProcesses:g,onNavigateSettings:w}){const x=zn(),S=Yr(),C=Qr(),P=Wn(),A=b.useRef(null),L=b.useRef(null),[O,ee]=b.useState(null),q=t==="conversation-focus",_=id({isNativeMobile:x.isNativeMobile,viewportClass:x.viewportClass}),E=up({enabled:q,rootRef:A,resetKey:`${C.pathname}${C.search}`}),M=Ul({viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:_}),I=ap({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:u("shell.androidMoreAction")}),N=[{key:"workspaces",label:u("shell.mobileWorkspacesEntry"),icon:r.jsx(SE,{}),onClick:c},{key:"sessions",label:u("shell.mobileSessionsEntry"),icon:r.jsx(CE,{}),onClick:h},{key:"terminals",label:u("shell.mobileTerminalsEntry"),icon:r.jsx(jE,{}),onClick:l},{key:"tools",label:u("shell.mobileToolsEntry"),icon:r.jsx(NE,{}),onClick:f},{key:"settings",label:u("shell.mobileSettingsEntry"),icon:r.jsx(PE,{}),onClick:w}],z=q?{"--mobile-conversation-tabbar-progress":E.progress.toFixed(4)}:void 0;cp(A,L,q);function G(){const B=op(C.pathname,C.search);if(!B){f();return}P(B,{replace:!0})}const J=r.jsx("nav",{ref:L,className:"android-workbench-bottom-nav","aria-label":u("shell.title"),children:N.map(B=>r.jsxs("button",{type:"button",className:"android-workbench-bottom-nav-item","data-active":B.key===e,"aria-current":B.key===e?"page":void 0,onClick:()=>{B.key!==e&&S.trigger("selection"),B.onClick()},children:[r.jsx("span",{className:"android-workbench-bottom-nav-icon","aria-hidden":"true",children:B.icon}),r.jsx("span",{className:"android-workbench-bottom-nav-label",children:B.label})]},B.key))});return r.jsx(lp,{composerPortalTarget:q?O:null,children:r.jsxs("div",{ref:A,className:"android-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":M,"data-tabbar-open":q?E.isOpen:!0,"data-conversation-tabbar-state":q?E.state:"default",style:z,children:[I?r.jsxs("header",{className:"android-workbench-topbar","data-header-kind":"tools",children:[r.jsxs("div",{className:"android-workbench-topbar-leading",children:[I.showBackButton?r.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":u("common.back"),onClick:G,children:r.jsx(xE,{})}):null,r.jsx("div",{className:"android-workbench-topbar-copy",children:r.jsx("h1",{children:I.title})})]}),r.jsx("div",{className:"android-workbench-topbar-actions",children:I.showMoreButton?r.jsx("button",{type:"button",className:"android-workbench-icon-button","aria-label":I.moreButtonLabel,onClick:g,children:r.jsx(kE,{})}):null})]}):null,r.jsx("div",{className:"android-workbench-content",children:r.jsx(dp,{viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:_,navigationPanel:i,auxiliaryPanel:a,children:n})}),q?r.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[r.jsx("div",{ref:ee,className:"mobile-conversation-bottom-layer-composer-slot"}),r.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:J})]}):J]})})}function xE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("path",{d:"m15 18-6-6 6-6"}),r.jsx("path",{d:"M21 12H9"})]})}function kE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[r.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),r.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),r.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function SE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.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"}),r.jsx("path",{d:"M8 13h8"})]})}function CE(){return r.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:r.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 jE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),r.jsx("path",{d:"m7.5 9 3 3-3 3"}),r.jsx("path",{d:"M12.5 15H17"})]})}function NE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.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"}),r.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),r.jsx("path",{d:"M3 12h18"}),r.jsx("path",{d:"M10 11.5h4"})]})}function PE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.jsx("circle",{cx:"12",cy:"12",r:"3"}),r.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 TE=120,cl={viewportHeight:null,keyboardInset:0,keyboardOpen:!1};function mm(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function RE(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 EE(){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(mm);return e.length>0?Math.max(...e):0}function uv(){if(typeof window>"u")return cl;const e=window.visualViewport,t=EE(),n=(e==null?void 0:e.height)??t,i=mm(n)?Math.round(n):null,a=mm(e==null?void 0:e.offsetTop)?(e==null?void 0:e.offsetTop)??0:0,c=i===null?0:Math.max(0,Math.round(t-i-a));return{viewportHeight:i,keyboardInset:c,keyboardOpen:RE(typeof document<"u"?document.activeElement:null)&&c>=TE}}function Zh(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 AE(e){const[t,n]=b.useState(()=>e?uv():cl),i=b.useRef(null);return b.useEffect(()=>{if(!e){n(cl),Zh(!1,cl);return}function a(){n(uv())}function c(){i.current!==null&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{i.current=null,a()},0)}a();const l=window.visualViewport;return window.addEventListener("resize",a),window.addEventListener("orientationchange",a),l==null||l.addEventListener("resize",a),l==null||l.addEventListener("scroll",a),document.addEventListener("focusin",a),document.addEventListener("focusout",c),()=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null),window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a),l==null||l.removeEventListener("resize",a),l==null||l.removeEventListener("scroll",a),document.removeEventListener("focusin",a),document.removeEventListener("focusout",c),Zh(!1,cl)}},[e]),b.useEffect(()=>{Zh(e,t)},[e,t]),t}function IE({activeEntry:e,presentation:t="default",children:n,navigationPanel:i,auxiliaryPanel:a,onNavigateWorkspaces:c,onNavigateTerminals:l,onNavigateSessions:h,onNavigateTools:f,onNavigateToolFiles:p,onNavigateToolGit:y,onNavigateToolProcesses:g,onNavigateSettings:w}){const x=zn(),S=Yr(),C=Qr(),P=Wn(),A=b.useRef(null),L=b.useRef(null),[O,ee]=b.useState(null),q=t==="conversation-focus",_=id({isNativeMobile:x.isNativeMobile,viewportClass:x.viewportClass}),E=up({enabled:q,rootRef:A,resetKey:`${C.pathname}${C.search}`}),M=Ul({viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:_}),I=ap({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:u("shell.iosMoreAction")}),N=[{key:"workspaces",label:u("shell.mobileWorkspacesEntry"),icon:r.jsx(DE,{}),onClick:c},{key:"sessions",label:u("shell.mobileSessionsEntry"),icon:r.jsx(FE,{}),onClick:h},{key:"terminals",label:u("shell.mobileTerminalsEntry"),icon:r.jsx(_E,{}),onClick:l},{key:"tools",label:u("shell.mobileToolsEntry"),icon:r.jsx(OE,{}),onClick:f},{key:"settings",label:u("shell.mobileSettingsEntry"),icon:r.jsx(BE,{}),onClick:w}],z=q?{"--mobile-conversation-tabbar-progress":E.progress.toFixed(4)}:void 0;cp(A,L,q);function G(){const B=op(C.pathname,C.search);if(!B){f();return}P(B,{replace:!0})}const J=r.jsx("nav",{ref:L,className:"ios-workbench-tabbar","aria-label":u("shell.title"),children:N.map(B=>r.jsxs("button",{type:"button",className:"ios-workbench-tabbar-item","data-active":B.key===e,"aria-current":B.key===e?"page":void 0,onClick:()=>{B.key!==e&&S.trigger("selection"),B.onClick()},children:[r.jsx("span",{className:"ios-workbench-tabbar-icon","aria-hidden":"true",children:B.icon}),r.jsx("span",{className:"ios-workbench-tabbar-label",children:B.label})]},B.key))});return r.jsx(lp,{composerPortalTarget:q?O:null,children:r.jsxs("div",{ref:A,className:"ios-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-pane-layout":M,"data-tabbar-open":q?E.isOpen:!0,"data-conversation-tabbar-state":q?E.state:"default",style:z,children:[I?r.jsxs("header",{className:"ios-workbench-nav","data-header-kind":"tools",children:[r.jsx("div",{className:"ios-workbench-nav-leading",children:I.showBackButton?r.jsxs("button",{type:"button",className:"ios-workbench-back-button","aria-label":u("common.back"),onClick:G,children:[r.jsx(LE,{}),r.jsx("span",{children:u("common.back")})]}):null}),r.jsx("div",{className:"ios-workbench-nav-copy",children:r.jsx("h1",{children:I.title})}),r.jsx("div",{className:"ios-workbench-nav-actions",children:I.showMoreButton?r.jsx("button",{type:"button",className:"ios-workbench-icon-button","aria-label":I.moreButtonLabel,onClick:g,children:r.jsx(ME,{})}):null})]}):null,r.jsx("div",{className:"ios-workbench-content",children:r.jsx(dp,{viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:_,navigationPanel:i,auxiliaryPanel:a,children:n})}),q?r.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[r.jsx("div",{ref:ee,className:"mobile-conversation-bottom-layer-composer-slot"}),r.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:J})]}):J]})})}function LE(){return r.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:r.jsx("path",{d:"m15 18-6-6 6-6"})})}function ME(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[r.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),r.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),r.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function DE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[r.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"}),r.jsx("path",{d:"M8 13h8"})]})}function FE(){return r.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:r.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 _E(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[r.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),r.jsx("path",{d:"m7.5 9 3 3-3 3"}),r.jsx("path",{d:"M12.5 15H17"})]})}function OE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.85",children:[r.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"}),r.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),r.jsx("path",{d:"M3 12h18"}),r.jsx("path",{d:"M10 11.5h4"})]})}function BE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",children:[r.jsx("circle",{cx:"12",cy:"12",r:"3"}),r.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 UE(e){const t=zn();return t.platform==="ios"?r.jsx(IE,{...e}):t.platform==="android"?r.jsx(wE,{...e}):r.jsx(WE,{...e})}function WE({activeEntry:e,presentation:t="default",children:n,navigationPanel:i,auxiliaryPanel:a,onNavigateWorkspaces:c,onNavigateTerminals:l,onNavigateSessions:h,onNavigateTools:f,onNavigateToolFiles:p,onNavigateToolGit:y,onNavigateToolProcesses:g,onNavigateSettings:w}){const x=zn(),S=Yr(),C=Qr(),P=Wn(),A=b.useRef(null),L=b.useRef(null),[O,ee]=b.useState(null),q=AE(x.platform==="web"),_=x.platform==="web"&&q.keyboardOpen,E=t==="conversation-focus",M=id({isNativeMobile:x.isNativeMobile,viewportClass:x.viewportClass}),I=up({enabled:E,rootRef:A,suspended:_,resetKey:`${C.pathname}${C.search}`}),N=Ul({viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:M}),z=ap({activeEntry:e,presentation:t,pathname:C.pathname,search:C.search,moreButtonLabel:u("shell.iosMoreAction")}),G=[{key:"workspaces",label:u("shell.mobileWorkspacesEntry"),icon:r.jsx(qE,{}),onClick:c},{key:"sessions",label:u("shell.mobileSessionsEntry"),icon:r.jsx($E,{}),onClick:h},{key:"terminals",label:u("shell.mobileTerminalsEntry"),icon:r.jsx(VE,{}),onClick:l},{key:"tools",label:u("shell.mobileToolsEntry"),icon:r.jsx(GE,{}),onClick:f},{key:"settings",label:u("shell.mobileSettingsEntry"),icon:r.jsx(KE,{}),onClick:w}],J=E?{"--mobile-conversation-tabbar-progress":I.progress.toFixed(4)}:void 0;cp(A,L,E);function B(){const Y=op(C.pathname,C.search);if(!Y){f();return}P(Y,{replace:!0})}const W=r.jsx("nav",{ref:L,className:"mobile-workbench-tabbar","aria-label":u("shell.title"),hidden:_,children:G.map(Y=>r.jsxs("button",{type:"button",className:"mobile-workbench-tabbar-item","data-active":Y.key===e,"aria-current":Y.key===e?"page":void 0,onClick:()=>{Y.key!==e&&S.trigger("selection"),Y.onClick()},children:[r.jsx("span",{className:"mobile-workbench-tabbar-icon","aria-hidden":"true",children:Y.icon}),r.jsx("span",{className:"mobile-workbench-tabbar-label",children:Y.label})]},Y.key))});return r.jsx(lp,{composerPortalTarget:E?O:null,children:r.jsxs("div",{ref:A,className:"mobile-workbench-shell","data-active-entry":e,"data-mobile-presentation":t,"data-mobile-runtime":x.platform,"data-mobile-keyboard-open":_,"data-pane-layout":N,"data-tabbar-open":_?!1:E?I.isOpen:!0,"data-conversation-tabbar-state":E?I.state:"default",style:J,children:[z?r.jsxs("header",{className:"mobile-workbench-header","data-header-kind":"tools",children:[r.jsxs("div",{className:"mobile-workbench-header-leading",children:[z.showBackButton?r.jsx("button",{type:"button",className:"mobile-workbench-header-button","aria-label":u("common.back"),onClick:B,children:r.jsx(zE,{})}):null,r.jsx("div",{className:"mobile-workbench-header-copy",children:r.jsx("h1",{children:z.title})})]}),r.jsx("div",{className:"mobile-workbench-header-actions",children:z.showMoreButton?r.jsx("button",{type:"button",className:"mobile-workbench-header-button mobile-tools-more-button","aria-label":z.moreButtonLabel,onClick:g,children:r.jsx(HE,{})}):null})]}):null,r.jsx("div",{className:"mobile-workbench-content",children:r.jsx(dp,{viewportClass:x.viewportClass,activeEntry:e,hasNavigationPanel:!!i,hasAuxiliaryPanel:!!a,preferCompactLayout:M,navigationPanel:i,auxiliaryPanel:a,children:n})}),E?r.jsxs("div",{className:"mobile-conversation-bottom-layer",children:[r.jsx("div",{ref:ee,className:"mobile-conversation-bottom-layer-composer-slot"}),r.jsx("div",{className:"mobile-conversation-bottom-layer-tabbar-shell",children:W})]}):W]})})}function zE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[r.jsx("path",{d:"m15 18-6-6 6-6"}),r.jsx("path",{d:"M21 12H9"})]})}function HE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[r.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),r.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),r.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function qE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[r.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"}),r.jsx("path",{d:"M8 13h8"})]})}function $E(){return r.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:r.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 VE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[r.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2.5"}),r.jsx("path",{d:"m7.5 9 3 3-3 3"}),r.jsx("path",{d:"M12.5 15H17"})]})}function GE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[r.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"}),r.jsx("rect",{x:"3",y:"6",width:"18",height:"13",rx:"2"}),r.jsx("path",{d:"M3 12h18"}),r.jsx("path",{d:"M10 11.5h4"})]})}function KE(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.jsx("circle",{cx:"12",cy:"12",r:"3"}),r.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 $S{constructor(t){He(this,"maxAttempts");He(this,"baseDelayMs");He(this,"reconnectAttempts",0);He(this,"reconnectTimer",null);He(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(!Gn.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 VS{constructor(t){He(this,"socket",null);He(this,"disposed",!1);He(this,"authRecoveryInFlight",!1);He(this,"pendingRefresh",!1);He(this,"fileTreeSubscription",null);He(this,"gitWorkspaceId",null);He(this,"terminalManagerWorkspaceId",null);He(this,"workspaceManagementWorkspaceId",null);He(this,"pendingFileTreeRefresh",null);He(this,"pendingGitRefreshWorkspaceId",null);He(this,"pendingTerminalManagerRefreshWorkspaceId",null);He(this,"pendingWorkspaceManagementRefreshWorkspaceId",null);He(this,"fileTreeListeners",new Set);He(this,"gitListeners",new Set);He(this,"terminalManagerListeners",new Set);He(this,"workspaceManagementListeners",new Set);He(this,"connectionManager");this.options=t,this.connectionManager=new $S({onReconnect:n=>{this.connect(n)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}requestRefresh(){const t=this.socket;if(!dv(t)){this.pendingRefresh=!0;return}t.send(JSON.stringify({type:"workbench.refresh"})),this.pendingRefresh=!1}subscribeFileTree(t,n){this.fileTreeSubscription={workspaceId:t,paths:hv(n)},this.sendWhenReady({type:"fileTree.subscribe",workspaceId:t,paths:this.fileTreeSubscription.paths})}requestFileTreeRefresh(t,n){const i=hv(n),a={type:"fileTree.refresh",workspaceId:t,paths:i};this.sendWhenReady(a)?this.pendingFileTreeRefresh=null:this.pendingFileTreeRefresh={workspaceId:t,paths:i}}subscribeGit(t){this.gitWorkspaceId=t,this.sendWhenReady({type:"git.subscribe",workspaceId:t})}requestGitRefresh(t){this.sendWhenReady({type:"git.refresh",workspaceId:t})?this.pendingGitRefreshWorkspaceId=null:this.pendingGitRefreshWorkspaceId=t}subscribeTerminalManager(t){this.terminalManagerWorkspaceId=t,this.sendWhenReady({type:"terminalManager.subscribe",workspaceId:t})}requestTerminalManagerRefresh(t){this.sendWhenReady({type:"terminalManager.refresh",workspaceId:t})?this.pendingTerminalManagerRefreshWorkspaceId=null:this.pendingTerminalManagerRefreshWorkspaceId=t}subscribeWorkspaceManagement(t){this.workspaceManagementWorkspaceId=t,this.sendWhenReady({type:"workspaceManagement.subscribe",workspaceId:t})}requestWorkspaceManagementRefresh(t){this.sendWhenReady({type:"workspaceManagement.refresh",workspaceId:t})?this.pendingWorkspaceManagementRefreshWorkspaceId=null:this.pendingWorkspaceManagementRefreshWorkspaceId=t}addFileTreeSnapshotListener(t){return this.fileTreeListeners.add(t),()=>{this.fileTreeListeners.delete(t)}}addGitSnapshotListener(t){return this.gitListeners.add(t),()=>{this.gitListeners.delete(t)}}addTerminalManagerSnapshotListener(t){return this.terminalManagerListeners.add(t),()=>{this.terminalManagerListeners.delete(t)}}addWorkspaceManagementSnapshotListener(t){return this.workspaceManagementListeners.add(t),()=>{this.workspaceManagementListeners.delete(t)}}close(){var t;this.disposed=!0,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var c;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const n=(c=kn.getState().session)==null?void 0:c.accessToken;if(!n){this.options.onUnauthorized();return}const i=`${Vk("/ws")}?access_token=${encodeURIComponent(n)}`,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",l=>{var f,p,y,g,w,x,S,C;const h=JSON.parse(l.data);if(h.type==="system.connected"){this.connectionManager.markConnected();return}if(h.type==="session.error"){h.error_code==="UNAUTHORIZED"&&this.handleUnauthorized();return}if(h.type==="fileTree.snapshot"){(p=(f=this.options).onFileTreeSnapshot)==null||p.call(f,h.snapshot),this.fileTreeListeners.forEach(P=>P(h.snapshot));return}if(h.type==="git.snapshot"){(g=(y=this.options).onGitSnapshot)==null||g.call(y,h.snapshot),this.gitListeners.forEach(P=>P(h.snapshot));return}if(h.type==="terminalManager.snapshot"){(x=(w=this.options).onTerminalManagerSnapshot)==null||x.call(w,h.snapshot),this.terminalManagerListeners.forEach(P=>P(h.snapshot));return}if(h.type==="workspaceManagement.snapshot"){(C=(S=this.options).onWorkspaceManagementSnapshot)==null||C.call(S,h.snapshot),this.workspaceManagementListeners.forEach(P=>P(h.snapshot));return}h.type==="workbench.snapshot"&&QE(h.snapshot)&&this.options.onSnapshot(h.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(),kn.refresh().then(n=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(n.status==="refreshed"){this.connectionManager.reconnectNow();return}if(n.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}sendWhenReady(t){const n=this.socket;return dv(n)?(n.send(JSON.stringify(t)),!0):!1}}function dv(e){const t=typeof WebSocket.OPEN=="number"?WebSocket.OPEN:1;return e!==null&&e.readyState===t}function QE(e){return typeof e!="object"||e===null?!1:Array.isArray(e.items)}function hv(e){const t=new Set;for(const n of e??[""])t.add(n.trim().replace(/\\/g,"/").replace(/^\/+|\/+$/g,""));return[...t]}function Vn(e,t,n,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 n==="m"?i:n==="a"?i.call(e):i?i.value:t.get(e)}function vs(e,t,n,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,n),n}var Js,$r,qo,Gc,bu;const Pr="__TAURI_TO_IPC_KEY__";function GS(e,t=!1){return window.__TAURI_INTERNALS__.transformCallback(e,t)}class KS{constructor(t){Js.set(this,void 0),$r.set(this,0),qo.set(this,[]),Gc.set(this,void 0),vs(this,Js,t||(()=>{})),this.id=GS(n=>{const i=n.index;if("end"in n){i==Vn(this,$r,"f")?this.cleanupCallback():vs(this,Gc,i);return}const a=n.message;if(i==Vn(this,$r,"f")){for(Vn(this,Js,"f").call(this,a),vs(this,$r,Vn(this,$r,"f")+1);Vn(this,$r,"f")in Vn(this,qo,"f");){const c=Vn(this,qo,"f")[Vn(this,$r,"f")];Vn(this,Js,"f").call(this,c),delete Vn(this,qo,"f")[Vn(this,$r,"f")],vs(this,$r,Vn(this,$r,"f")+1)}Vn(this,$r,"f")===Vn(this,Gc,"f")&&this.cleanupCallback()}else Vn(this,qo,"f")[i]=a})}cleanupCallback(){window.__TAURI_INTERNALS__.unregisterCallback(this.id)}set onmessage(t){vs(this,Js,t)}get onmessage(){return Vn(this,Js,"f")}[(Js=new WeakMap,$r=new WeakMap,qo=new WeakMap,Gc=new WeakMap,Pr)](){return`__CHANNEL__:${this.id}`}toJSON(){return this[Pr]()}}async function ve(e,t={},n){return window.__TAURI_INTERNALS__.invoke(e,t,n)}class QS{get rid(){return Vn(this,bu,"f")}constructor(t){bu.set(this,void 0),vs(this,bu,t)}async close(){return ve("plugin:resources|close",{rid:this.rid})}}bu=new WeakMap;class hl extends QS{constructor(t){super(t)}static async new(t,n,i){return ve("plugin:image|new",{rgba:xi(t),width:n,height:i}).then(a=>new hl(a))}static async fromBytes(t){return ve("plugin:image|from_bytes",{bytes:xi(t)}).then(n=>new hl(n))}static async fromPath(t){return ve("plugin:image|from_path",{path:t}).then(n=>new hl(n))}async rgba(){return ve("plugin:image|rgba",{rid:this.rid}).then(t=>new Uint8Array(t))}async size(){return ve("plugin:image|size",{rid:this.rid})}}function xi(e){return e==null?null:typeof e=="string"?e:e instanceof hl?e.rid:e}var yu,vu;function YS(e){var t;if("items"in e)e.items=(t=e.items)===null||t===void 0?void 0:t.map(n=>"rid"in n?n:YS(n));else if("action"in e&&e.action){const n=new KS;return n.onmessage=e.action,delete e.action,{...e,handler:n}}return e}async function ha(e,t){const n=new KS;if(t&&typeof t=="object"&&("action"in t&&t.action&&(n.onmessage=t.action,delete t.action),"item"in t&&t.item&&typeof t.item=="object"&&"About"in t.item&&t.item.About&&typeof t.item.About=="object"&&"icon"in t.item.About&&t.item.About.icon&&(t.item.About.icon=xi(t.item.About.icon)),"icon"in t&&t.icon&&(t.icon=xi(t.icon)),"items"in t&&t.items)){let i=function(a){var c;return"rid"in a?[a.rid,a.kind]:("item"in a&&typeof a.item=="object"&&(!((c=a.item.About)===null||c===void 0)&&c.icon)&&(a.item.About.icon=xi(a.item.About.icon)),"icon"in a&&a.icon&&(a.icon=xi(a.icon)),"items"in a&&a.items&&(a.items=a.items.map(i)),YS(a))};t.items=t.items.map(i)}return ve("plugin:menu|new",{kind:e,options:t,handler:n})}class fa extends QS{get id(){return Vn(this,yu,"f")}get kind(){return Vn(this,vu,"f")}constructor(t,n,i){super(t),yu.set(this,void 0),vu.set(this,void 0),vs(this,yu,n),vs(this,vu,i)}}yu=new WeakMap,vu=new WeakMap;class hp extends fa{constructor(t,n){super(t,n,"MenuItem")}static async new(t){return ha("MenuItem",t).then(([n,i])=>new hp(n,i))}async text(){return ve("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ve("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ve("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ve("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return ve("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}}class fp extends fa{constructor(t,n){super(t,n,"Check")}static async new(t){return ha("Check",t).then(([n,i])=>new fp(n,i))}async text(){return ve("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ve("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ve("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ve("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return ve("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async isChecked(){return ve("plugin:menu|is_checked",{rid:this.rid})}async setChecked(t){return ve("plugin:menu|set_checked",{rid:this.rid,checked:t})}}var fv;(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"})(fv||(fv={}));class mp extends fa{constructor(t,n){super(t,n,"Icon")}static async new(t){return ha("Icon",t).then(([n,i])=>new mp(n,i))}async text(){return ve("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ve("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ve("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ve("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async setAccelerator(t){return ve("plugin:menu|set_accelerator",{rid:this.rid,kind:this.kind,accelerator:t})}async setIcon(t){return ve("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:xi(t)})}}class pp extends fa{constructor(t,n){super(t,n,"Predefined")}static async new(t){return ha("Predefined",t).then(([n,i])=>new pp(n,i))}async text(){return ve("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ve("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}}class gp{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 js(this.width*t,this.height*t)}[Pr](){return{width:this.width,height:this.height}}toJSON(){return this[Pr]()}}class js{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 gp(this.width/t,this.height/t)}[Pr](){return{width:this.width,height:this.height}}toJSON(){return this[Pr]()}}class $o{constructor(t){this.size=t}toLogical(t){return this.size instanceof gp?this.size:this.size.toLogical(t)}toPhysical(t){return this.size instanceof js?this.size:this.size.toPhysical(t)}[Pr](){return{[`${this.size.type}`]:{width:this.size.width,height:this.size.height}}}toJSON(){return this[Pr]()}}class bp{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 Gr(this.x*t,this.y*t)}[Pr](){return{x:this.x,y:this.y}}toJSON(){return this[Pr]()}}class Gr{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 bp(this.x/t,this.y/t)}[Pr](){return{x:this.x,y:this.y}}toJSON(){return this[Pr]()}}class xs{constructor(t){this.position=t}toLogical(t){return this.position instanceof bp?this.position:this.position.toLogical(t)}toPhysical(t){return this.position instanceof Gr?this.position:this.position.toPhysical(t)}[Pr](){return{[`${this.position.type}`]:{x:this.position.x,y:this.position.y}}}toJSON(){return this[Pr]()}}function na([e,t,n]){switch(n){case"Submenu":return new yp(e,t);case"Predefined":return new pp(e,t);case"Check":return new fp(e,t);case"Icon":return new mp(e,t);case"MenuItem":default:return new hp(e,t)}}class yp extends fa{constructor(t,n){super(t,n,"Submenu")}static async new(t){return ha("Submenu",t).then(([n,i])=>new yp(n,i))}async text(){return ve("plugin:menu|text",{rid:this.rid,kind:this.kind})}async setText(t){return ve("plugin:menu|set_text",{rid:this.rid,kind:this.kind,text:t})}async isEnabled(){return ve("plugin:menu|is_enabled",{rid:this.rid,kind:this.kind})}async setEnabled(t){return ve("plugin:menu|set_enabled",{rid:this.rid,kind:this.kind,enabled:t})}async append(t){return ve("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async prepend(t){return ve("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async insert(t,n){return ve("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:n})}async remove(t){return ve("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return ve("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(na)}async items(){return ve("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(na))}async get(t){return ve("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(n=>n?na(n):null)}async popup(t,n){var i;return ve("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(i=n==null?void 0:n.label)!==null&&i!==void 0?i:null,at:t instanceof xs?t:t?new xs(t):null})}async setAsWindowsMenuForNSApp(){return ve("plugin:menu|set_as_windows_menu_for_nsapp",{rid:this.rid})}async setAsHelpMenuForNSApp(){return ve("plugin:menu|set_as_help_menu_for_nsapp",{rid:this.rid})}async setIcon(t){return ve("plugin:menu|set_icon",{rid:this.rid,kind:this.kind,icon:xi(t)})}}class ea extends fa{constructor(t,n){super(t,n,"Menu")}static async new(t){return ha("Menu",t).then(([n,i])=>new ea(n,i))}static async default(){return ve("plugin:menu|create_default").then(([t,n])=>new ea(t,n))}async append(t){return ve("plugin:menu|append",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async prepend(t){return ve("plugin:menu|prepend",{rid:this.rid,kind:this.kind,items:(Array.isArray(t)?t:[t]).map(n=>"rid"in n?[n.rid,n.kind]:n)})}async insert(t,n){return ve("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:n})}async remove(t){return ve("plugin:menu|remove",{rid:this.rid,kind:this.kind,item:[t.rid,t.kind]})}async removeAt(t){return ve("plugin:menu|remove_at",{rid:this.rid,kind:this.kind,position:t}).then(na)}async items(){return ve("plugin:menu|items",{rid:this.rid,kind:this.kind}).then(t=>t.map(na))}async get(t){return ve("plugin:menu|get",{rid:this.rid,kind:this.kind,id:t}).then(n=>n?na(n):null)}async popup(t,n){var i;return ve("plugin:menu|popup",{rid:this.rid,kind:this.kind,window:(i=n==null?void 0:n.label)!==null&&i!==void 0?i:null,at:t instanceof xs?t:t?new xs(t):null})}async setAsAppMenu(){return ve("plugin:menu|set_as_app_menu",{rid:this.rid}).then(t=>t?new ea(t[0],t[1]):null)}async setAsWindowMenu(t){var n;return ve("plugin:menu|set_as_window_menu",{rid:this.rid,window:(n=t==null?void 0:t.label)!==null&&n!==void 0?n:null}).then(i=>i?new ea(i[0],i[1]):null)}}var Cr;(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"})(Cr||(Cr={}));async function XS(e,t){window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(e,t),await ve("plugin:event|unlisten",{event:e,eventId:t})}async function vp(e,t,n){var i;const a=typeof(n==null?void 0:n.target)=="string"?{kind:"AnyLabel",label:n.target}:(i=n==null?void 0:n.target)!==null&&i!==void 0?i:{kind:"Any"};return ve("plugin:event|listen",{event:e,target:a,handler:GS(t)}).then(c=>async()=>XS(e,c))}async function JS(e,t,n){return vp(e,i=>{XS(e,i.id),t(i)},n)}async function ZS(e,t){await ve("plugin:event|emit",{event:e,payload:t})}async function eC(e,t,n){await ve("plugin:event|emit_to",{target:typeof e=="string"?{kind:"AnyLabel",label:e}:e,event:t,payload:n})}const YE=Object.freeze(Object.defineProperty({__proto__:null,get TauriEvent(){return Cr},emit:ZS,emitTo:eC,listen:vp,once:JS},Symbol.toStringTag,{value:"Module"}));var Wu;(function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"})(Wu||(Wu={}));class tC{constructor(t){this._preventDefault=!1,this.event=t.event,this.id=t.id}preventDefault(){this._preventDefault=!0}isPreventDefault(){return this._preventDefault}}var pm;(function(e){e.None="none",e.Normal="normal",e.Indeterminate="indeterminate",e.Paused="paused",e.Error="error"})(pm||(pm={}));function sd(){return new wp(window.__TAURI_INTERNALS__.metadata.currentWindow.label,{skip:!0})}async function wu(){return ve("plugin:window|get_all_windows").then(e=>e.map(t=>new wp(t,{skip:!0})))}const ef=["tauri://created","tauri://error"];class wp{constructor(t,n={}){var i;this.label=t,this.listeners=Object.create(null),n!=null&&n.skip||ve("plugin:window|create",{options:{...n,parent:typeof n.parent=="string"?n.parent:(i=n.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 n;return(n=(await wu()).find(i=>i.label===t))!==null&&n!==void 0?n:null}static getCurrent(){return sd()}static async getAll(){return wu()}static async getFocusedWindow(){for(const t of await wu())if(await t.isFocused())return t;return null}async listen(t,n){return this._handleTauriEvent(t,n)?()=>{const i=this.listeners[t];i.splice(i.indexOf(n),1)}:vp(t,n,{target:{kind:"Window",label:this.label}})}async once(t,n){return this._handleTauriEvent(t,n)?()=>{const i=this.listeners[t];i.splice(i.indexOf(n),1)}:JS(t,n,{target:{kind:"Window",label:this.label}})}async emit(t,n){if(ef.includes(t)){for(const i of this.listeners[t]||[])i({event:t,id:-1,payload:n});return}return ZS(t,n)}async emitTo(t,n,i){if(ef.includes(n)){for(const a of this.listeners[n]||[])a({event:n,id:-1,payload:i});return}return eC(t,n,i)}_handleTauriEvent(t,n){return ef.includes(t)?(t in this.listeners?this.listeners[t].push(n):this.listeners[t]=[n],!0):!1}async scaleFactor(){return ve("plugin:window|scale_factor",{label:this.label})}async innerPosition(){return ve("plugin:window|inner_position",{label:this.label}).then(t=>new Gr(t))}async outerPosition(){return ve("plugin:window|outer_position",{label:this.label}).then(t=>new Gr(t))}async innerSize(){return ve("plugin:window|inner_size",{label:this.label}).then(t=>new js(t))}async outerSize(){return ve("plugin:window|outer_size",{label:this.label}).then(t=>new js(t))}async isFullscreen(){return ve("plugin:window|is_fullscreen",{label:this.label})}async isMinimized(){return ve("plugin:window|is_minimized",{label:this.label})}async isMaximized(){return ve("plugin:window|is_maximized",{label:this.label})}async isFocused(){return ve("plugin:window|is_focused",{label:this.label})}async isDecorated(){return ve("plugin:window|is_decorated",{label:this.label})}async isResizable(){return ve("plugin:window|is_resizable",{label:this.label})}async isMaximizable(){return ve("plugin:window|is_maximizable",{label:this.label})}async isMinimizable(){return ve("plugin:window|is_minimizable",{label:this.label})}async isClosable(){return ve("plugin:window|is_closable",{label:this.label})}async isVisible(){return ve("plugin:window|is_visible",{label:this.label})}async title(){return ve("plugin:window|title",{label:this.label})}async theme(){return ve("plugin:window|theme",{label:this.label})}async isAlwaysOnTop(){return ve("plugin:window|is_always_on_top",{label:this.label})}async center(){return ve("plugin:window|center",{label:this.label})}async requestUserAttention(t){let n=null;return t&&(t===Wu.Critical?n={type:"Critical"}:n={type:"Informational"}),ve("plugin:window|request_user_attention",{label:this.label,value:n})}async setResizable(t){return ve("plugin:window|set_resizable",{label:this.label,value:t})}async setEnabled(t){return ve("plugin:window|set_enabled",{label:this.label,value:t})}async isEnabled(){return ve("plugin:window|is_enabled",{label:this.label})}async setMaximizable(t){return ve("plugin:window|set_maximizable",{label:this.label,value:t})}async setMinimizable(t){return ve("plugin:window|set_minimizable",{label:this.label,value:t})}async setClosable(t){return ve("plugin:window|set_closable",{label:this.label,value:t})}async setTitle(t){return ve("plugin:window|set_title",{label:this.label,value:t})}async maximize(){return ve("plugin:window|maximize",{label:this.label})}async unmaximize(){return ve("plugin:window|unmaximize",{label:this.label})}async toggleMaximize(){return ve("plugin:window|toggle_maximize",{label:this.label})}async minimize(){return ve("plugin:window|minimize",{label:this.label})}async unminimize(){return ve("plugin:window|unminimize",{label:this.label})}async show(){return ve("plugin:window|show",{label:this.label})}async hide(){return ve("plugin:window|hide",{label:this.label})}async close(){return ve("plugin:window|close",{label:this.label})}async destroy(){return ve("plugin:window|destroy",{label:this.label})}async setDecorations(t){return ve("plugin:window|set_decorations",{label:this.label,value:t})}async setShadow(t){return ve("plugin:window|set_shadow",{label:this.label,value:t})}async setEffects(t){return ve("plugin:window|set_effects",{label:this.label,value:t})}async clearEffects(){return ve("plugin:window|set_effects",{label:this.label,value:null})}async setAlwaysOnTop(t){return ve("plugin:window|set_always_on_top",{label:this.label,value:t})}async setAlwaysOnBottom(t){return ve("plugin:window|set_always_on_bottom",{label:this.label,value:t})}async setContentProtected(t){return ve("plugin:window|set_content_protected",{label:this.label,value:t})}async setSize(t){return ve("plugin:window|set_size",{label:this.label,value:t instanceof $o?t:new $o(t)})}async setMinSize(t){return ve("plugin:window|set_min_size",{label:this.label,value:t instanceof $o?t:t?new $o(t):null})}async setMaxSize(t){return ve("plugin:window|set_max_size",{label:this.label,value:t instanceof $o?t:t?new $o(t):null})}async setSizeConstraints(t){function n(i){return i?{Logical:i}:null}return ve("plugin:window|set_size_constraints",{label:this.label,value:{minWidth:n(t==null?void 0:t.minWidth),minHeight:n(t==null?void 0:t.minHeight),maxWidth:n(t==null?void 0:t.maxWidth),maxHeight:n(t==null?void 0:t.maxHeight)}})}async setPosition(t){return ve("plugin:window|set_position",{label:this.label,value:t instanceof xs?t:new xs(t)})}async setFullscreen(t){return ve("plugin:window|set_fullscreen",{label:this.label,value:t})}async setSimpleFullscreen(t){return ve("plugin:window|set_simple_fullscreen",{label:this.label,value:t})}async setFocus(){return ve("plugin:window|set_focus",{label:this.label})}async setFocusable(t){return ve("plugin:window|set_focusable",{label:this.label,value:t})}async setIcon(t){return ve("plugin:window|set_icon",{label:this.label,value:xi(t)})}async setSkipTaskbar(t){return ve("plugin:window|set_skip_taskbar",{label:this.label,value:t})}async setCursorGrab(t){return ve("plugin:window|set_cursor_grab",{label:this.label,value:t})}async setCursorVisible(t){return ve("plugin:window|set_cursor_visible",{label:this.label,value:t})}async setCursorIcon(t){return ve("plugin:window|set_cursor_icon",{label:this.label,value:t})}async setBackgroundColor(t){return ve("plugin:window|set_background_color",{color:t})}async setCursorPosition(t){return ve("plugin:window|set_cursor_position",{label:this.label,value:t instanceof xs?t:new xs(t)})}async setIgnoreCursorEvents(t){return ve("plugin:window|set_ignore_cursor_events",{label:this.label,value:t})}async startDragging(){return ve("plugin:window|start_dragging",{label:this.label})}async startResizeDragging(t){return ve("plugin:window|start_resize_dragging",{label:this.label,value:t})}async setBadgeCount(t){return ve("plugin:window|set_badge_count",{label:this.label,value:t})}async setBadgeLabel(t){return ve("plugin:window|set_badge_label",{label:this.label,value:t})}async setOverlayIcon(t){return ve("plugin:window|set_overlay_icon",{label:this.label,value:t?xi(t):void 0})}async setProgressBar(t){return ve("plugin:window|set_progress_bar",{label:this.label,value:t})}async setVisibleOnAllWorkspaces(t){return ve("plugin:window|set_visible_on_all_workspaces",{label:this.label,value:t})}async setTitleBarStyle(t){return ve("plugin:window|set_title_bar_style",{label:this.label,value:t})}async setTheme(t){return ve("plugin:window|set_theme",{label:this.label,value:t})}async onResized(t){return this.listen(Cr.WINDOW_RESIZED,n=>{n.payload=new js(n.payload),t(n)})}async onMoved(t){return this.listen(Cr.WINDOW_MOVED,n=>{n.payload=new Gr(n.payload),t(n)})}async onCloseRequested(t){return this.listen(Cr.WINDOW_CLOSE_REQUESTED,async n=>{const i=new tC(n);await t(i),i.isPreventDefault()||await this.destroy()})}async onDragDropEvent(t){const n=await this.listen(Cr.DRAG_ENTER,l=>{t({...l,payload:{type:"enter",paths:l.payload.paths,position:new Gr(l.payload.position)}})}),i=await this.listen(Cr.DRAG_OVER,l=>{t({...l,payload:{type:"over",position:new Gr(l.payload.position)}})}),a=await this.listen(Cr.DRAG_DROP,l=>{t({...l,payload:{type:"drop",paths:l.payload.paths,position:new Gr(l.payload.position)}})}),c=await this.listen(Cr.DRAG_LEAVE,l=>{t({...l,payload:{type:"leave"}})});return()=>{n(),a(),i(),c()}}async onFocusChanged(t){const n=await this.listen(Cr.WINDOW_FOCUS,a=>{t({...a,payload:!0})}),i=await this.listen(Cr.WINDOW_BLUR,a=>{t({...a,payload:!1})});return()=>{n(),i()}}async onScaleChanged(t){return this.listen(Cr.WINDOW_SCALE_FACTOR_CHANGED,t)}async onThemeChanged(t){return this.listen(Cr.WINDOW_THEME_CHANGED,t)}}var mv;(function(e){e.Disabled="disabled",e.Throttle="throttle",e.Suspend="suspend"})(mv||(mv={}));var pv;(function(e){e.Default="default",e.FluentOverlay="fluentOverlay"})(pv||(pv={}));var gm;(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"})(gm||(gm={}));var bm;(function(e){e.FollowsWindowActiveState="followsWindowActiveState",e.Active="active",e.Inactive="inactive"})(bm||(bm={}));function od(e){return e===null?null:{name:e.name,scaleFactor:e.scaleFactor,position:new Gr(e.position),size:new js(e.size),workArea:{position:new Gr(e.workArea.position),size:new js(e.workArea.size)}}}async function XE(){return ve("plugin:window|current_monitor").then(od)}async function JE(){return ve("plugin:window|primary_monitor").then(od)}async function ZE(e,t){return ve("plugin:window|monitor_from_point",{x:e,y:t}).then(od)}async function eA(){return ve("plugin:window|available_monitors").then(e=>e.map(od))}async function tA(){return ve("plugin:window|cursor_position").then(e=>new Gr(e))}const nA=Object.freeze(Object.defineProperty({__proto__:null,CloseRequestedEvent:tC,get Effect(){return gm},get EffectState(){return bm},LogicalPosition:bp,LogicalSize:gp,PhysicalPosition:Gr,PhysicalSize:js,get ProgressBarStatus(){return pm},get UserAttentionType(){return Wu},Window:wp,availableMonitors:eA,currentMonitor:XE,cursorPosition:tA,getAllWindows:wu,getCurrentWindow:sd,monitorFromPoint:ZE,primaryMonitor:JE},Symbol.toStringTag,{value:"Module"}));async function rA(e){if(e.length===0)return;await(await ea.new({items:e.map(n=>({id:n.id,text:n.label,enabled:!n.disabled,accelerator:n.accelerator,action:()=>{n.onSelect()}}))})).popup(void 0,sd())}const iA=["button","a","input","textarea","select","summary","[role='button']","[role='link']","[role='tab']","[role='menuitem']","[contenteditable='true']","[data-window-drag='ignore']"].join(", ");function xp(e){return e instanceof HTMLElement?!e.closest(iA):!0}async function kp(){typeof window>"u"||typeof window.__TAURI_INTERNALS__>"u"||await sd().startDragging()}const zu=.78,sA=1;function oA(){return typeof window<"u"&&typeof window.__TAURI_INTERNALS__<"u"}function nC(e,t,n,i){const a=Math.hypot(n-e,i-t),c=Math.min(1,a/120);return zu+(sA-zu)*c}function ks(e){return Math.round(Number.isFinite(e)?e:0)}function aA(e){if(!oA())return null;const t=ks(e.x),n=ks(e.y);let i=!1,a=Promise.resolve();const c=(h,f)=>(a=a.then(async()=>{await window.__TAURI_INTERNALS__.invoke(h,f)}).catch(()=>{}),a),l=async()=>{i||(i=!0,await c("close_detach_preview"))};return c("show_detach_preview",{title:e.title,x:t,y:n,scale:zu}),{updatePosition(h,f){if(i)return;const p=ks(h),y=ks(f);c("update_detach_preview_position",{x:p,y,scale:nC(t,n,p,y)})},complete(){return l()},cancel(){return l()}}}function lA(e){if(typeof document>"u")return null;const t=ks(e.x),n=ks(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=`${n}px`,i.style.setProperty("--detach-preview-scale",zu.toFixed(3));const a=document.createElement("div");a.className="desktop-window-detach-animation-bar";const c=document.createElement("strong");c.className="desktop-window-detach-animation-title",c.textContent=e.title;const l=document.createElement("div");l.className="desktop-window-detach-animation-body",a.append(c),i.append(a,l),document.body.append(i);let h=!1;const f=()=>{h||(h=!0,i.remove())};return{updatePosition(p,y){if(h)return;const g=ks(p),w=ks(y),x=nC(t,n,g,w);i.style.left=`${g}px`,i.style.top=`${w}px`,i.style.setProperty("--detach-preview-scale",x.toFixed(3))},async complete(){f()},async cancel(){f()}}}function gv(e){return aA(e)??lA(e)}const cA={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 uA(e){return{...e,bounds:{...e.bounds}}}function dA(e,t,n){t&&(e.windows.registerDescriptor(t),n?e.windows.markWindowOpen(t.windowId):e.windows.markWindowClosed(t.windowId))}function hA(e){return cA[e]}function fA(e,t){return`${e}-${t}`}async function Sp(e,t,n){const i=n.workspaceId.trim(),a=hA(t);if(!e.isDesktop||!e.bridge.supported)return{ok:!1,errorCode:"PLATFORM_NOT_SUPPORTED",detail:"当前运行环境不支持桌面外部窗口。"};if(!i)return{ok:!1,errorCode:"WINDOW_WORKSPACE_REQUIRED",detail:`${a.label}外部窗口必须绑定工作区。`};const c=fA(t,i),l=e.windows.getDescriptor(c),h=l?uA(l):null,f=e.windows.isWindowOpen(c),p=qP({windowId:c,kind:t,workspaceId:i,sessionId:n.sessionId??(h==null?void 0:h.sessionId)??null,mode:"external",bounds:h==null?void 0:h.bounds,focusOwner:n.focusOwner??a.defaultFocusOwner});e.windows.registerDescriptor(p);const y=await e.bridge.createWindow(p);return y.ok?(e.windows.markWindowOpen(c),{ok:!0,value:p}):(h?dA(e,h,f):e.windows.removeWindow(c),{ok:!1,errorCode:y.errorCode,detail:y.detail})}function mA(e,t){return Sp(e,"files",t)}function pA(e,t){return Sp(e,"git",t)}function gA(e,t){return Sp(e,"processes",t)}const xu="codingns.file-panel.show-system-files",Cp="codingns.notification.preferences",Vo={notifyOnPermissionRequest:!0,notifyOnSessionCompleted:!0,notifyOnSessionFailed:!0};function ad(){return typeof window<"u"&&typeof window.localStorage<"u"}function bv(){return ad()?window.localStorage.getItem(xu)==="1":!1}function tf(e){return typeof e=="boolean"}function yv(){if(!ad())return Vo;const e=window.localStorage.getItem(Cp);if(!e)return Vo;try{const t=JSON.parse(e);return{notifyOnPermissionRequest:tf(t.notifyOnPermissionRequest)?t.notifyOnPermissionRequest:Vo.notifyOnPermissionRequest,notifyOnSessionCompleted:tf(t.notifyOnSessionCompleted)?t.notifyOnSessionCompleted:Vo.notifyOnSessionCompleted,notifyOnSessionFailed:tf(t.notifyOnSessionFailed)?t.notifyOnSessionFailed:Vo.notifyOnSessionFailed}}catch{return Vo}}function vv(e,t){return e.notifyOnPermissionRequest===t.notifyOnPermissionRequest&&e.notifyOnSessionCompleted===t.notifyOnSessionCompleted&&e.notifyOnSessionFailed===t.notifyOnSessionFailed}function bA(e){ad()&&window.localStorage.setItem(Cp,JSON.stringify(e))}class yA{constructor(){He(this,"state",{showSystemFiles:bv(),notificationPreferences:yv()});He(this,"listeners",new Set);He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state);He(this,"handleStorage",t=>{if(t.key!==null&&t.key!==xu&&t.key!==Cp)return;const n=bv(),i=yv(),a=this.state.showSystemFiles===n,c=vv(this.state.notificationPreferences,i);a&&c||(this.state={showSystemFiles:n,notificationPreferences:i},this.emit())});typeof window<"u"&&window.addEventListener("storage",this.handleStorage)}setShowSystemFiles(t){ad()&&(t?window.localStorage.setItem(xu,"1"):window.localStorage.removeItem(xu)),this.state.showSystemFiles!==t&&(this.state={...this.state,showSystemFiles:t},this.emit())}setNotificationPreferences(t){const n={...this.state.notificationPreferences,...t};vv(this.state.notificationPreferences,n)||(bA(n),this.state={...this.state,notificationPreferences:n},this.emit())}emit(){for(const t of this.listeners)t()}}const ta=new yA;function Hi(e){return b.useSyncExternalStore(ta.subscribe,()=>e(ta.getState()))}const ul=new Map;function rC(){return typeof window<"u"&&typeof window.sessionStorage<"u"}function wv(e,t){return!Number.isFinite(e)||Date.now()-e>t}function Kn(e,t){const n=ul.get(e);if(n&&!wv(n.savedAt,t))return n.value;if(!rC())return null;const i=window.sessionStorage.getItem(e);if(!i)return null;try{const a=JSON.parse(i);return!a||wv(a.savedAt,t)?(window.sessionStorage.removeItem(e),ul.delete(e),null):(ul.set(e,a),a.value)}catch{return window.sessionStorage.removeItem(e),ul.delete(e),null}}function Fr(e,t){const n={savedAt:Date.now(),value:t};if(ul.set(e,n),!!rC())try{window.sessionStorage.setItem(e,JSON.stringify(n))}catch{}}const vA="codingns.debug.perf";function wA(){if(typeof window>"u")return!1;try{return window.localStorage.getItem(vA)==="1"}catch{return!1}}function _t(e,t){if(!wA()||typeof performance>"u")return;const n=Math.round(performance.now());if(t&&Object.keys(t).length>0){console.info(`[perf-ui] ${e} ${n}ms`,t);return}console.info(`[perf-ui] ${e} ${n}ms`)}function xA(){return De.request("/api/workspaces")}async function iC(){try{return await De.request("/api/workbench")}catch(e){if(!(e instanceof mr)||e.status!==404)throw e;const t=await xA();return{items:await Promise.all(t.items.map(async i=>({workspace:i,sessions:(await jA(i.id)).items})))}}}function kA(e){return De.request("/api/workspaces/import",{method:"POST",body:JSON.stringify(e)})}function SA(e){return De.request("/api/workspaces/clone",{method:"POST",body:JSON.stringify(e)})}function sC(e){return De.request(`/api/workspaces/${encodeURIComponent(e)}`,{method:"DELETE"})}function oC(e){const t=new URLSearchParams;return e!=null&&e.trim()&&t.set("path",e.trim()),De.request(`/api/workspaces/browse${t.size>0?`?${t.toString()}`:""}`)}function CA(e){return De.request("/api/workspaces/directories",{method:"POST",body:JSON.stringify(e)})}function jA(e){return De.request(`/api/sessions?workspaceId=${encodeURIComponent(e)}`)}function NA(e){return De.request(`/api/sessions/${encodeURIComponent(e)}`)}function PA(e){return De.request(`/api/sessions/${encodeURIComponent(e)}/changed-files`)}function TA(e){return De.request(`/api/sessions/${encodeURIComponent(e)}/seen`,{method:"POST"})}function aC(e,t){return De.request(`/api/sessions/${encodeURIComponent(e)}/title`,{method:"PATCH",body:JSON.stringify({title:t})})}function lC(e,t){return De.request(`/api/sessions/${encodeURIComponent(e)}/archive`,{method:"PATCH",body:JSON.stringify({archived:t})})}function RA(e,t){return De.request(`/api/sessions/${encodeURIComponent(e)}/favorite`,{method:"PATCH",body:JSON.stringify({favorite:t})})}function EA(e){return De.request(`/api/sessions/${encodeURIComponent(e)}/capabilities`)}function cC(e){return De.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests`)}function AA(){return De.request("/api/preferences/quick-phrases")}function IA(e){return De.request("/api/preferences/quick-phrases",{method:"PUT",body:JSON.stringify({items:e})})}function uC(e,t){const n=new URLSearchParams;return t!=null&&t.trim()&&n.set("workspaceId",t.trim()),De.request(`/api/providers/${encodeURIComponent(e)}/capabilities${n.size>0?`?${n.toString()}`:""}`)}function dC(e,t,n,i="forward"){const a=new URLSearchParams;return a.set("limit",String(n)),a.set("direction",i),De.request(`/api/sessions/${encodeURIComponent(e)}/messages?${a.toString()}`)}function LA(e,t){return De.requestBlob(`/api/sessions/${encodeURIComponent(e)}/attachments/${encodeURIComponent(t)}/content`)}function MA(e,t){return De.request(`/api/sessions/${encodeURIComponent(e)}/messages`,{method:"POST",body:JSON.stringify(t)})}function DA(e){return De.request("/api/sessions/start-live",{method:"POST",body:JSON.stringify(e)})}function FA(e,t){return De.request(`/api/sessions/${encodeURIComponent(e)}/messages/live`,{method:"POST",body:JSON.stringify(t)})}function _A(e){return De.request(`/api/sessions/${encodeURIComponent(e)}/queue`)}function OA(e,t){return De.request(`/api/sessions/${encodeURIComponent(e)}/queue`,{method:"POST",body:JSON.stringify(t)})}function BA(e,t){return De.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}`,{method:"DELETE"})}function UA(e,t){return De.request(`/api/sessions/${encodeURIComponent(e)}/queue/${encodeURIComponent(t)}/steer`,{method:"POST"})}function ym(e){return De.request(`/api/sessions/${encodeURIComponent(e)}/runtime`)}function WA(e){return De.request(`/api/sessions/${encodeURIComponent(e)}/interrupt`,{method:"POST"})}function zA(e,t,n){return De.request(`/api/sessions/${encodeURIComponent(e)}/permission-requests/${encodeURIComponent(t)}/reply`,{method:"POST",body:JSON.stringify(n)})}const HA="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==",hC="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=",qA="/assets/gemini-D4G1NbrE.png",$A="/assets/kimi-BWNNSh7e.png",VA="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAYAAADimHc4AAABzUlEQVR4AeycQQrCQBAEF1+g6J/0o5LPCXmCnnNx0E2nNqGEPciw024VffV0PZ/fHo7BqflBCSgAxd+aAhQAE4DjbYACYAJwvA1QAEwAjrcBCgAIDBRpA2AZClAATACOtwEKgAnA8TZAATABOD7egNc8tz2ftJ+4gPQD9r5fAbDBDQXALx00XgGwGAUoACYAx9sABcAE4HgboACYABxvAxSwJHC7XFryLNP4bzYg7KBar4CKUHiugDDgar0CKkLhuQLCgKv1CqgIhecKCAOu1iugIhSeKyAMuFqvgIpQeK6AMOBq/XAC7o9H6z5fdlRAtp4PJ2BrAHSeAmADClAATACOtwEKgAnA8TZAATABON4GKAAmAMev2AD4JTuNVwAsTgEKgAnA8TZAATABON4GKAAmAMfbAAXABOB4G9ApoPe6AnoJdt5XQCfA3uvDCXhOU0ueXmBr3x9OwNoPHH2fAmBDClAATACOtwEKgAnA8TZAAX8QONAVGwDLVIACYAJwfLwByf/+2WJ32k9cQPoBe9+vANigAhQAE4DjbYACYAJw/A8NgH/pQeMVAItVgAJgAnC8DVAATACOtwEKgAnA8TZAATABON4GFALS4w8AAAD//x7wkLQAAAAGSURBVAMAKj5LkLSa6SQAAAAASUVORK5CYII=",GA=new Set(["low","medium","high","xhigh"]),KA=["claude-code","codex","opencode","gemini","kimi"],QA=["codex","claude-code","opencode","gemini","kimi"],fC={"claude-code":{displayNameKey:"conversation.providerClaude",fullDisplayNameKey:"shell.providerClaudeCode",draftTitleKey:"conversation.draftTitleClaude",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:HA,defaultRunInputMode:"streaming_guidance",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!0,foldRulesMessagesByDefault:!1},codex:{displayNameKey:"conversation.providerCodex",draftTitleKey:"conversation.draftTitleCodex",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:hC,defaultRunInputMode:"none",reasoningLevelPersists:!0,defaultReasoningLevel:null,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!0},opencode:{displayNameKey:"conversation.providerOpenCode",draftTitleKey:"conversation.draftTitleOpenCode",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:VA,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:void 0,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!1},gemini:{displayNameKey:"conversation.providerGemini",draftTitleKey:"conversation.draftTitleGemini",defaultModelLabelKey:"conversation.modelUseCliDefault",icon:qA,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:$A,defaultRunInputMode:"none",reasoningLevelPersists:!1,defaultReasoningLevel:null,supportsInterrupt:!0,supportsAttachments:!1,supportsPermissionPrompt:!1,supportsSlashMenuByDefault:!1,foldRulesMessagesByDefault:!0}},YA=Array.from(new Set(Object.values(fC).map(e=>e.icon)));let xv=!1;function XA(e){return KA.includes(e)}function Ki(e){return!e||!XA(e)?null:fC[e]}function JA(e){return[{id:"provider-default",name:u(e),usesProviderDefault:!0}]}function ZA(e){const t=Ki(e);return JA((t==null?void 0:t.defaultModelLabelKey)??"conversation.modelUseCliDefault")}function mC(e){return!!(e&&Ki(e))}function eI(e){const t=Ki(e);return u((t==null?void 0:t.draftTitleKey)??"conversation.draftTitleCodex")}function $i(e,t="compact"){const n=Ki(e);return n?t==="full"&&n.fullDisplayNameKey?u(n.fullDisplayNameKey):u(n.displayNameKey):(e==null?void 0:e.trim())||u("conversation.providerCodex")}function pC(e){const t=Ki(e);return(t==null?void 0:t.icon)??hC}function gC(){xv||typeof window>"u"||(xv=!0,YA.forEach(e=>{const t=new window.Image;t.decoding="async",t.src=e,typeof t.decode=="function"&&t.decode().catch(()=>{})}))}function tI(e){const t=Ki(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:ZA(e),defaultReasoningLevel:t==null?void 0:t.defaultReasoningLevel,limitations:[]}}function nI(e){return(e==null?void 0:e.provider)??"claude-code"}function rI(e){var n;if((e==null?void 0:e.supportsSlashMenu)!==void 0)return e.supportsSlashMenu;const t=(e==null?void 0:e.provider)??null;return((n=Ki(t))==null?void 0:n.supportsSlashMenuByDefault)??!1}function iI(e){var t;return(e==null?void 0:e.supportsReasoningSelector)!==void 0?e.supportsReasoningSelector:!!((t=e==null?void 0:e.modelOptions)!=null&&t.some(n=>{var i;return((i=n.supportedReasoningEfforts)==null?void 0:i.some(a=>GA.has(a)))??!1}))}function sI(e,t){if((e==null?void 0:e.supportsQueueWhileRunning)!==void 0)return e.supportsQueueWhileRunning;const n=(e==null?void 0:e.inRunInputMode)??"none";return n==="queued_guidance"||n==="none"||n==="streaming_guidance"&&t===!1}function bC(e){return(e==null?void 0:e.supportsRunSteering)!==void 0?e.supportsRunSteering:(e==null?void 0:e.inRunInputMode)==="streaming_guidance"}function oI(e){const t=Ki(e);return(t==null?void 0:t.reasoningLevelPersists)??!1}function aI(e,t){var i;return((i=Ki(t??null))==null?void 0:i.foldRulesMessagesByDefault)??!1}typeof window<"u"&&gC();function lI(e,t,n,i){return De.request("/api/files/content",{method:"PUT",body:JSON.stringify({workspaceId:e,path:t,content:n,expectedVersion:i??void 0})})}function cI(e){return De.request("/api/files/ops",{method:"POST",body:JSON.stringify(e)})}function uI(e){return De.request("/api/files/upload",{method:"POST",body:JSON.stringify(e)})}function dI(e,t){const n=new URLSearchParams({workspaceId:e,path:t});return De.request(`/api/files/download?${n.toString()}`)}function vm(e,t,n=1,i=20){const a=new URLSearchParams({workspaceId:e,keyword:t,page:String(n),pageSize:String(i)});return De.request(`/api/files/search?${a.toString()}`)}function kv(e,t){const n=new URLSearchParams({workspaceId:e,path:t});return De.request(`/api/files/preview?${n.toString()}`)}function Wl(e){var t,n;return e.runningState==="failed"||!!((t=e.lastErrorCode)!=null&&t.trim())||!!((n=e.lastErrorDetail)!=null&&n.trim())}function jp(e,t,n){const i=hI(t);return i==="running_inferred"?`${e} is-running-inferred`:`${e} is-${i.replace("_","-")}`}function Hu(e){return e.runningState==="stale"?u("conversation.runtimeStale"):e.runningState==="unknown"?u("conversation.runtimeUnknown"):null}function yC(e,t){return t.runningState==="stale"?`${e} is-stale`:t.runningState==="unknown"?`${e} is-unknown`:null}function hI(e){return Wl(e)?"error":e.runningState==="stale"?"stale":e.runningState==="unknown"?"unknown":e.activityState==="running"?fI(e)?"running_inferred":"running":e.activityState==="completed_unread"?"unread":"idle"}function fI(e){return e.activityResolutionSource==="inferred_log"||e.activitySource==="inferred"}const Sv=48;function mI(e){return typeof e=="string"?e.replace(/\s+/g," ").trim():""}function Ps(e,t){const n=mI(e)||t,i=n.length>Sv?n.slice(0,Sv).trimEnd():n;return{fullTitle:n,displayTitle:i}}const nf=5,rf=["#2563eb","#0891b2","#16a34a","#d97706","#dc2626","#64748b"];function vC(e){const t=Math.round(e.ratio*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}function wC(e,t){const n=e.reduce((h,f)=>h+f.count,0);if(n<=0)return[];const a=e.slice(0,nf).map((h,f)=>({...h,key:h.type,ratio:h.count/n,color:rf[f]??rf[0]})),c=e.slice(nf);if(c.length===0)return a;const l=c.reduce((h,f)=>h+f.count,0);return a.push({key:"other",type:t,count:l,ratio:l/n,color:rf[nf]}),a}function pI(e){if(e.length===0)return"conic-gradient(color-mix(in srgb, var(--border-primary) 78%, transparent) 0% 100%)";let t=0;return`conic-gradient(${e.map((i,a)=>{const c=t,l=a===e.length-1?1:Math.min(1,t+i.ratio);return t=l,`${i.color} ${Cv(c)} ${Cv(l)}`}).join(", ")})`}function xC(e){return{"--workbench-manage-chart-background":pI(e)}}function Cv(e){const t=Math.round(e*1e3)/10;return`${t.toFixed(t%1===0?0:1)}%`}function ld(){return De.request("/api/butler/profile")}function gI(e){return De.request("/api/butler/profile/init",{method:"POST",body:JSON.stringify(e)})}function jv(e){return De.request("/api/butler/profile",{method:"PATCH",body:JSON.stringify(e)})}function bI(){return De.request("/api/butler/control-session")}function yI(){return De.request("/api/butler/control-session/reset",{method:"POST"})}function vI(e={}){return De.request("/api/butler/control-session/start",{method:"POST",body:JSON.stringify(e)})}function wI(e){return De.request("/api/butler/control-session/messages",{method:"POST",body:JSON.stringify(e)})}function xI(){return De.request("/api/butler/control-session/events")}function cd(){return De.request("/api/butler/overview")}function kI(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 n=t.toString(),i=n?`/api/butler/projects?${n}`:"/api/butler/projects";return De.request(i)}function kC(e,t={}){const n=new URLSearchParams;t.enabled!==null&&t.enabled!==void 0&&n.set("enabled",String(t.enabled)),t.executionMode&&n.set("executionMode",t.executionMode);const i=n.toString(),a=i?`/api/butler/projects/${encodeURIComponent(e)}/patrol-plans?${i}`:`/api/butler/projects/${encodeURIComponent(e)}/patrol-plans`;return De.request(a)}function kl(e={}){var a,c;const t=new URLSearchParams;(a=e.workspaceId)!=null&&a.trim()&&t.set("workspaceId",e.workspaceId.trim()),(c=e.projectId)!=null&&c.trim()&&t.set("projectId",e.projectId.trim()),e.status&&t.set("status",e.status),e.itemType&&t.set("itemType",e.itemType);const n=t.toString(),i=n?`/api/butler/inbox?${n}`:"/api/butler/inbox";return De.request(i)}function SI(e){return De.request("/api/butler/inbox",{method:"POST",body:JSON.stringify(e)})}function Sl(e={}){var a,c;const t=new URLSearchParams;e.status&&t.set("status",e.status),(a=e.projectId)!=null&&a.trim()&&t.set("projectId",e.projectId.trim()),(c=e.sessionId)!=null&&c.trim()&&t.set("sessionId",e.sessionId.trim());const n=t.toString(),i=n?`/api/butler/follow-up-tasks?${n}`:"/api/butler/follow-up-tasks";return De.request(i)}function CI(e){return De.request("/api/butler/follow-up-tasks",{method:"POST",body:JSON.stringify(e)})}function SC(e){return De.request(`/api/butler/follow-up-tasks/${encodeURIComponent(e)}`)}function jI(e){return De.request(`/api/butler/follow-up-tasks/${encodeURIComponent(e)}/cancel`,{method:"POST"})}function NI(e,t){return De.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 PI(e){return De.request(`/api/butler/inbox/${encodeURIComponent(e)}`,{method:"DELETE"})}function TI(){return De.request("/api/butler/notifications/archives")}function RI(e,t){return De.request(`/api/butler/notifications/archives/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify({archived:t})})}function EI(e){const t=new URLSearchParams;return t.set("sessionId",e),De.request(`/api/butler/session-action-context?${t.toString()}`)}function AI(e){return De.request("/api/butler/actions/start-verification",{method:"POST",body:JSON.stringify(e)})}const II=QA.map(e=>({provider:e}));function CC({disabled:e=!1,pendingProvider:t=null,onSelect:n}){const i=Yr();return b.useEffect(()=>{gC()},[]),r.jsx("div",{className:"session-provider-grid",children:II.map(a=>{const c=$i(a.provider,"full"),l=t===a.provider;return r.jsxs("button",{type:"button",className:"session-provider-card","data-provider":a.provider,"data-pending":l?"true":"false","aria-label":c,disabled:e,onClick:()=>{i.trigger("action"),n(a.provider)},children:[r.jsx("span",{className:"session-provider-card-icon","aria-hidden":"true",children:r.jsx("img",{src:pC(a.provider),alt:"",loading:"eager",decoding:"async"})}),r.jsxs("span",{className:"session-provider-card-copy",children:[r.jsx("strong",{children:c}),l?r.jsx("span",{className:"session-provider-card-status",children:u("shell.startingSession")}):null]})]},a.provider)})})}function LI(){return r.jsx("svg",{viewBox:"0 0 24 24","aria-hidden":"true",children:r.jsx("path",{d:"M7 7L17 17M17 7L7 17",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"1.8"})})}function Un({open:e,title:t,description:n,className:i,headerActions:a,showCloseButton:c=!0,onClose:l,children:h}){return b.useEffect(()=>{if(!e)return;function f(p){p.key==="Escape"&&l()}return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f)}},[l,e]),!e||typeof document>"u"?null:Qn.createPortal(r.jsxs("div",{className:"workbench-modal-layer",children:[r.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":u("common.close"),onClick:l}),r.jsxs("section",{className:`workbench-modal-card surface-card${i?` ${i}`:""}`,role:"dialog","aria-modal":"true","aria-label":t,children:[r.jsxs("div",{className:"workbench-modal-header",children:[r.jsxs("div",{className:"workbench-modal-title-wrap",children:[r.jsx("h2",{children:t}),r.jsx("p",{children:n})]}),a||c?r.jsxs("div",{className:"workbench-modal-header-actions",children:[a,c?r.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":u("common.close"),onClick:l,children:r.jsx(LI,{})}):null]}):null]}),r.jsx("div",{className:"workbench-modal-body",children:h})]})]}),document.body)}const Kc={repositoryUrl:"",parentPath:"",directoryName:"",name:"",authMode:"none",username:"",password:"",token:""};function jC({open:e,onClose:t,onCloned:n}){const{showToast:i}=En(),[a,c]=b.useState(!1),[l,h]=b.useState(Kc),[f,p]=b.useState(!1),[y,g]=b.useState(!1),[w,x]=b.useState(null),[S,C]=b.useState(""),[P,A]=b.useState(""),[L,O]=b.useState(null),[ee,q]=b.useState([]),[_,E]=b.useState([]),M=a||y;b.useEffect(()=>{!e&&!a&&(h(Kc),p(!1),x(null))},[a,e]);const I=b.useCallback(async Y=>{g(!0),x(null);try{const Q=await oC(Y);C(Q.currentPath),A(Q.currentPath),O(Q.parentPath),q(Q.roots),E(Q.items),h(D=>({...D,parentPath:Q.currentPath}))}catch(Q){C(""),O(null),E([]),x(Q instanceof Error?Q.message:u("shell.importBrowserBrowseFailed"))}finally{g(!1)}},[]);function N(){a||(p(!1),x(null),h(Kc),t())}function z(){p(!0),I(l.parentPath||void 0)}function G(){a||(p(!1),x(null))}async function J(Y){Y.preventDefault(),await I(P)}function B(){h(Y=>({...Y,parentPath:S})),p(!1),x(null)}async function W(Y){Y.preventDefault();const Q=l.repositoryUrl.trim(),D=l.parentPath.trim();if(!Q){i({title:u("shell.cloneRepoRequired"),tone:"error"});return}if(!D){i({title:u("shell.clonePathRequired"),tone:"error"});return}c(!0);try{const re=await SA({repositoryUrl:Q,parentPath:D,directoryName:l.directoryName.trim()||void 0,name:l.name.trim()||void 0,auth:l.authMode==="none"?{mode:"none"}:l.authMode==="basic"?{mode:"basic",username:l.username.trim(),password:l.password}:{mode:"token",username:l.username.trim()||void 0,token:l.token}});await(n==null?void 0:n(re)),h(Kc),p(!1),i({title:u("shell.cloneSuccess"),description:re.path,tone:"success"}),t()}catch(re){i({title:re instanceof Error?re.message:u("shell.cloneFailed"),tone:"error"})}finally{c(!1)}}return r.jsxs(r.Fragment,{children:[r.jsx(Un,{open:e,title:u("shell.cloneWorkspaceTitle"),description:u("shell.cloneWorkspaceHint"),onClose:N,children:r.jsxs("form",{className:"workbench-clone-form",onSubmit:Y=>void W(Y),children:[r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.cloneRepositoryLabel")}),r.jsx("input",{type:"text",value:l.repositoryUrl,placeholder:u("shell.cloneRepositoryPlaceholder"),onChange:Y=>h(Q=>({...Q,repositoryUrl:Y.target.value}))})]}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.cloneParentPathLabel")}),r.jsxs("div",{className:"workbench-modal-inline-field",children:[r.jsx("input",{type:"text",value:l.parentPath,placeholder:u("shell.cloneParentPathPlaceholder"),onChange:Y=>h(Q=>({...Q,parentPath:Y.target.value}))}),r.jsx("button",{type:"button",className:"secondary-button",disabled:a,onClick:z,children:u("shell.clonePickDirectory")})]})]}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.cloneDirectoryNameLabel")}),r.jsx("input",{type:"text",value:l.directoryName,placeholder:u("shell.cloneDirectoryNamePlaceholder"),onChange:Y=>h(Q=>({...Q,directoryName:Y.target.value}))})]}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.importNameLabel")}),r.jsx("input",{type:"text",value:l.name,placeholder:u("shell.importNamePlaceholder"),onChange:Y=>h(Q=>({...Q,name:Y.target.value}))})]}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.cloneAuthModeLabel")}),r.jsxs("select",{value:l.authMode,onChange:Y=>h(Q=>({...Q,authMode:Y.target.value})),children:[r.jsx("option",{value:"none",children:u("shell.cloneAuthModeNone")}),r.jsx("option",{value:"basic",children:u("shell.cloneAuthModeBasic")}),r.jsx("option",{value:"token",children:u("shell.cloneAuthModeToken")})]})]}),l.authMode==="basic"?r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.cloneUsernameLabel")}),r.jsx("input",{type:"text",value:l.username,placeholder:u("shell.cloneUsernamePlaceholder"),autoComplete:"username",onChange:Y=>h(Q=>({...Q,username:Y.target.value}))})]}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.clonePasswordLabel")}),r.jsx("input",{type:"password",value:l.password,placeholder:u("shell.clonePasswordPlaceholder"),autoComplete:"current-password",onChange:Y=>h(Q=>({...Q,password:Y.target.value}))})]})]}):null,l.authMode==="token"?r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.cloneUsernameLabel")}),r.jsx("input",{type:"text",value:l.username,placeholder:u("shell.cloneTokenUsernamePlaceholder"),onChange:Y=>h(Q=>({...Q,username:Y.target.value}))})]}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.cloneTokenLabel")}),r.jsx("input",{type:"password",value:l.token,placeholder:u("shell.cloneTokenPlaceholder"),onChange:Y=>h(Q=>({...Q,token:Y.target.value}))})]})]}):null,r.jsx("p",{className:"workbench-import-hint",children:u("shell.cloneHint")}),r.jsxs("div",{className:"workbench-modal-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:a,onClick:N,children:u("common.cancel")}),r.jsx("button",{type:"submit",className:"primary-button",disabled:a,children:u(a?"shell.cloneSubmitting":"shell.cloneSubmit")})]})]})}),r.jsxs(Un,{open:e&&f,title:u("shell.cloneBrowserTitle"),description:u("shell.cloneBrowserDescription"),onClose:G,children:[r.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:J,children:[r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.importBrowserCurrentPath")}),r.jsx("input",{type:"text",value:P,placeholder:u("shell.importPathPlaceholder"),onChange:Y=>A(Y.target.value)})]}),r.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:M||!L,onClick:()=>{L&&I(L)},children:u("shell.importBrowserOpenParent")}),r.jsx("button",{type:"submit",className:"secondary-button",disabled:M,children:u("shell.importBrowserOpenPath")})]})]}),r.jsxs("section",{className:"workbench-directory-browser-panel",children:[r.jsxs("div",{className:"workbench-directory-browser-section",children:[r.jsx("span",{className:"workbench-directory-browser-section-title",children:u("shell.importBrowserRoots")}),r.jsx("div",{className:"workbench-directory-browser-root-list",children:ee.map(Y=>r.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:M,onClick:()=>{I(Y.path)},children:Y.name},Y.path))})]}),r.jsx("div",{className:"workbench-directory-browser-current-path",children:S}),w?r.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:w}):null,y?r.jsx("p",{className:"workbench-directory-browser-status status-text",children:u("common.loading")}):_.length>0?r.jsx("div",{className:"workbench-directory-browser-list",children:_.map(Y=>r.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:M,onClick:()=>{I(Y.path)},children:[r.jsx("span",{className:"workbench-directory-browser-item-name",children:Y.name}),r.jsx("span",{className:"workbench-directory-browser-item-path",children:Y.path})]},Y.path))}):r.jsx("p",{className:"workbench-directory-browser-status status-text",children:u("shell.importBrowserEmpty")})]}),r.jsxs("div",{className:"workbench-modal-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:a,onClick:G,children:u("common.cancel")}),r.jsx("button",{type:"button",className:"primary-button",disabled:M||!S,onClick:B,children:u("shell.cloneBrowserSubmit")})]})]})]})}const uo="butler:inbox-updated";function Nv(){typeof window>"u"||window.dispatchEvent(new Event(uo))}const Pv={projectId:"",itemType:"task",title:"",content:"",status:"pending"};function NC({active:e,preferredWorkspaceId:t,creationRequestId:n=0,compactComposer:i=!1,composerOpen:a=!0,onComposerOpenChange:c}){const{showToast:l}=En(),[h,f]=b.useState(!1),[p,y]=b.useState(!1),[g,w]=b.useState([]),[x,S]=b.useState([]),[C,P]=b.useState(null),[A,L]=b.useState(Pv),O=b.useMemo(()=>g.filter(I=>I.lifecycleStatus!=="archived"&&(!t||I.workspaceId===t)),[t,g]);b.useEffect(()=>{e&&ee()},[e,t]),b.useEffect(()=>{!e||C||L(I=>{var N;return{...I,projectId:I.projectId||((N=O[0])==null?void 0:N.id)||""}})},[e,C,O]),b.useEffect(()=>{!e||n<=0||(q(),c==null||c(!0))},[e,n,c]);async function ee(){f(!0);try{const[I,N]=await Promise.all([kI({workspaceId:t??null}),kl({workspaceId:t??null})]);w(I.items),S(N.items),C||q(I.items,t)}catch(I){l({title:u("shell.butlerInboxLoadFailed"),description:I instanceof Error?I.message:void 0,tone:"error"})}finally{f(!1)}}function q(I=g,N=t){const z=I.find(G=>G.lifecycleStatus!=="archived"&&(!N||G.workspaceId===N));P(null),L({...Pv,projectId:(z==null?void 0:z.id)||""})}function _(I){P(I.id),L({projectId:I.projectId,itemType:I.itemType,title:I.title,content:I.content,status:I.status}),i&&(c==null||c(!0))}async function E(I){I.preventDefault(),y(!0);try{C?(await NI(C,{projectId:A.projectId,itemType:A.itemType,title:A.title,content:A.content,status:A.status,priority:"medium"}),l({title:u("shell.butlerInboxUpdated"),tone:"success"})):(await SI({projectId:A.projectId,itemType:A.itemType,title:A.title,content:A.content,status:A.status,priority:"medium"}),l({title:u("shell.butlerInboxCreated"),tone:"success"})),Nv(),await ee(),q(),i&&(c==null||c(!1))}catch(N){l({title:u("shell.butlerInboxSaveFailed"),description:N instanceof Error?N.message:void 0,tone:"error"})}finally{y(!1)}}async function M(I){y(!0);try{await PI(I),l({title:u("shell.butlerInboxDeleted"),tone:"success"}),Nv(),await ee(),C===I&&q()}catch(N){l({title:u("shell.butlerInboxDeleteFailed"),description:N instanceof Error?N.message:void 0,tone:"error"})}finally{y(!1)}}return r.jsxs("div",{className:"workspace-inbox-modal",children:[i?null:r.jsx("section",{className:"workspace-inbox-panel",children:r.jsx(Tv,{visibleProjects:O,formState:A,saving:p,editingItemId:C,useMobilePicker:!1,onProjectChange:I=>{L(N=>({...N,projectId:I}))},onItemTypeChange:I=>{L(N=>({...N,itemType:I}))},onStatusChange:I=>{L(N=>({...N,status:I}))},onTitleChange:I=>{L(N=>({...N,title:I}))},onContentChange:I=>{L(N=>({...N,content:I}))},onCancel:()=>q(),onSubmit:E})}),r.jsxs("section",{className:"workspace-inbox-panel",children:[r.jsxs("header",{className:"workspace-inbox-panel-header",children:[r.jsx("h3",{children:u("shell.butlerInboxListTitle")}),r.jsx("p",{children:u("shell.butlerInboxListDescription")})]}),h?r.jsx("p",{className:"workspace-inbox-status",children:u("shell.butlerInboxLoading")}):null,!h&&x.length===0?r.jsx("p",{className:"workspace-inbox-status",children:u("shell.butlerInboxEmpty")}):null,!h&&x.length>0?r.jsx("div",{className:"workspace-inbox-list",children:x.map(I=>r.jsxs("article",{className:"workspace-inbox-item",children:[r.jsxs("div",{className:"workspace-inbox-item-header",children:[r.jsxs("div",{children:[r.jsx("strong",{children:I.title}),r.jsx("p",{children:I.projectName})]}),r.jsxs("div",{className:"workspace-inbox-item-badges",children:[r.jsx("span",{className:"workspace-inbox-badge",children:UI(I.status)}),r.jsx("span",{className:"workspace-inbox-badge",children:BI(I.itemType)})]})]}),r.jsx("p",{className:"workspace-inbox-item-content",children:I.content}),r.jsxs("div",{className:"workspace-inbox-item-footer",children:[r.jsx("span",{children:WI(I.updatedAt)}),r.jsxs("div",{className:"workspace-inbox-item-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:p,onClick:()=>_(I),children:u("shell.butlerInboxEditAction")}),r.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:p,onClick:()=>{M(I.id)},children:u("shell.butlerInboxDeleteAction")})]})]})]},I.id))}):null]}),i?r.jsx(Un,{open:e&&a,title:u(C?"shell.butlerInboxEditingTitle":"shell.butlerInboxCreateTitle"),description:u("shell.butlerInboxFormDescription"),className:"workspace-inbox-modal-card workspace-inbox-composer-modal-card",onClose:()=>{c==null||c(!1),q()},children:r.jsx("div",{className:"workspace-inbox-composer-modal-body",children:r.jsx(Tv,{visibleProjects:O,formState:A,saving:p,editingItemId:C,useMobilePicker:!0,onProjectChange:I=>{L(N=>({...N,projectId:I}))},onItemTypeChange:I=>{L(N=>({...N,itemType:I}))},onStatusChange:I=>{L(N=>({...N,status:I}))},onTitleChange:I=>{L(N=>({...N,title:I}))},onContentChange:I=>{L(N=>({...N,content:I}))},onCancel:()=>{c==null||c(!1),q()},onSubmit:E})})}):null]})}function Tv(e){const t=e.visibleProjects.map(a=>({value:a.id,label:a.name})),n=[{value:"task",label:u("shell.butlerInboxTypeTask")},{value:"bug",label:u("shell.butlerInboxTypeBug")},{value:"feature",label:u("shell.butlerInboxTypeFeature")},{value:"change",label:u("shell.butlerInboxTypeChange")}],i=[{value:"pending",label:u("shell.butlerInboxStatusPending")},{value:"in_progress",label:u("shell.butlerInboxStatusInProgress")},{value:"closed",label:u("shell.butlerInboxStatusClosed")}];return r.jsxs(r.Fragment,{children:[r.jsxs("header",{className:"workspace-inbox-panel-header",children:[r.jsx("h3",{children:e.editingItemId?u("shell.butlerInboxEditingTitle"):u("shell.butlerInboxCreateTitle")}),r.jsx("p",{children:u("shell.butlerInboxFormDescription")})]}),e.visibleProjects.length===0?r.jsx("p",{className:"workspace-inbox-status",children:u("shell.butlerInboxProjectsEmpty")}):r.jsxs("form",{className:"workspace-inbox-form",onSubmit:e.onSubmit,children:[r.jsx("div",{className:"workspace-inbox-form-grid",children:e.useMobilePicker?r.jsxs(r.Fragment,{children:[r.jsx(sf,{label:u("shell.butlerInboxProjectLabel"),value:e.formState.projectId,options:t,disabled:e.saving,onChange:e.onProjectChange}),r.jsx(sf,{label:u("shell.butlerInboxTypeLabel"),value:e.formState.itemType,options:n,disabled:e.saving,onChange:e.onItemTypeChange}),r.jsx(sf,{label:u("shell.butlerInboxStatusLabel"),value:e.formState.status,options:i,disabled:e.saving,onChange:e.onStatusChange})]}):r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.butlerInboxProjectLabel")}),r.jsx("select",{value:e.formState.projectId,disabled:e.saving,onChange:a=>e.onProjectChange(a.target.value),children:e.visibleProjects.map(a=>r.jsx("option",{value:a.id,children:a.name},a.id))})]}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.butlerInboxTypeLabel")}),r.jsxs("select",{value:e.formState.itemType,disabled:e.saving,onChange:a=>e.onItemTypeChange(a.target.value),children:[r.jsx("option",{value:"task",children:u("shell.butlerInboxTypeTask")}),r.jsx("option",{value:"bug",children:u("shell.butlerInboxTypeBug")}),r.jsx("option",{value:"feature",children:u("shell.butlerInboxTypeFeature")}),r.jsx("option",{value:"change",children:u("shell.butlerInboxTypeChange")})]})]}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.butlerInboxStatusLabel")}),r.jsxs("select",{value:e.formState.status,disabled:e.saving,onChange:a=>e.onStatusChange(a.target.value),children:[r.jsx("option",{value:"pending",children:u("shell.butlerInboxStatusPending")}),r.jsx("option",{value:"in_progress",children:u("shell.butlerInboxStatusInProgress")}),r.jsx("option",{value:"closed",children:u("shell.butlerInboxStatusClosed")})]})]})]})}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.butlerInboxTitleLabel")}),r.jsx("input",{value:e.formState.title,placeholder:u("shell.butlerInboxTitlePlaceholder"),disabled:e.saving,onChange:a=>e.onTitleChange(a.target.value)})]}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.butlerInboxContentLabel")}),r.jsx("textarea",{rows:4,value:e.formState.content,placeholder:u("shell.butlerInboxContentPlaceholder"),disabled:e.saving,onChange:a=>e.onContentChange(a.target.value)})]}),r.jsxs("div",{className:"workbench-modal-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:e.saving,onClick:e.onCancel,children:e.editingItemId?u("shell.butlerInboxCancelEditAction"):u("common.cancel")}),r.jsx("button",{type:"submit",className:"primary-button",disabled:e.saving||!e.formState.projectId,children:e.editingItemId?u("shell.butlerInboxUpdateAction"):u("shell.butlerInboxCreateAction")})]})]})]})}function sf({label:e,value:t,options:n,disabled:i,onChange:a}){const[c,l]=b.useState(!1),h=n.find(f=>f.value===t)??n[0]??null;return b.useEffect(()=>{if(!c)return;function f(p){p.key==="Escape"&&l(!1)}return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f)}},[c]),r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"workbench-modal-field workspace-inbox-mobile-picker",children:[r.jsx("span",{children:e}),r.jsxs("button",{type:"button",className:"workspace-inbox-mobile-picker-trigger","aria-label":e,"aria-haspopup":"dialog","aria-expanded":c,disabled:i||n.length===0,onClick:()=>l(!0),children:[r.jsx("span",{className:"workspace-inbox-mobile-picker-trigger-value",children:(h==null?void 0:h.label)??""}),r.jsx("span",{className:"workspace-inbox-mobile-picker-trigger-icon",children:r.jsx(_I,{expanded:c})})]})]}),r.jsx(MI,{open:c,title:e,options:n,selectedValue:t,onClose:()=>l(!1),onSelect:f=>{a(f),l(!1)}})]})}function MI({open:e,title:t,options:n,selectedValue:i,onClose:a,onSelect:c}){return!e||typeof document>"u"?null:Qn.createPortal(r.jsx("div",{className:"ios-action-sheet-overlay workspace-inbox-picker-sheet-overlay",role:"presentation",onClick:a,children:r.jsxs("div",{className:"mobile-workspace-home-sheet workspace-inbox-picker-sheet",role:"dialog","aria-modal":"true","aria-label":t,onClick:l=>l.stopPropagation(),children:[r.jsxs("div",{className:"mobile-workspace-home-sheet-card workspace-inbox-picker-sheet-card",children:[r.jsx("div",{className:"mobile-workspace-home-sheet-header workspace-inbox-picker-sheet-header",children:r.jsx("strong",{children:t})}),r.jsx("div",{className:"mobile-workspace-home-group workspace-inbox-picker-sheet-options",role:"listbox","aria-label":t,children:n.map(l=>{const h=l.value===i;return r.jsxs("button",{type:"button",className:"mobile-workspace-home-row workspace-inbox-picker-option",role:"option","aria-selected":h,onClick:()=>c(l.value),children:[r.jsxs("span",{className:"workspace-inbox-picker-option-copy",children:[r.jsx("strong",{children:l.label}),l.description?r.jsx("span",{children:l.description}):null]}),r.jsx("span",{className:"workspace-inbox-picker-option-indicator","aria-hidden":"true",children:h?r.jsx(OI,{}):null})]},l.value)})})]}),r.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:a,children:u("common.cancel")})]})}),document.body)}function DI({open:e,preferredWorkspaceId:t,onClose:n,compactComposer:i=!1}){const[a,c]=b.useState(0),[l,h]=b.useState(!i);return b.useEffect(()=>{e||h(!i)},[i,e]),r.jsx(Un,{open:e,title:u("shell.butlerInboxModalTitle"),description:u("shell.butlerInboxModalDescription"),className:"workspace-inbox-modal-card",showCloseButton:!i,headerActions:i?r.jsx("button",{type:"button",className:"workspace-inbox-modal-create-button","aria-label":u("shell.butlerInboxCreateAction"),title:u("shell.butlerInboxCreateAction"),onClick:()=>{c(f=>f+1),h(!0)},children:r.jsx(FI,{})}):void 0,onClose:n,children:r.jsx(NC,{active:e,preferredWorkspaceId:t,creationRequestId:a,compactComposer:i,composerOpen:l,onComposerOpenChange:h})})}function FI(){return r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[r.jsx("path",{d:"M12 5v14"}),r.jsx("path",{d:"M5 12h14"})]})}function _I({expanded:e}){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true","data-expanded":e?"true":void 0,children:r.jsx("path",{d:"M3.5 6 8 10l4.5-4",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function OI(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.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 BI(e){switch(e){case"bug":return u("shell.butlerInboxTypeBug");case"feature":return u("shell.butlerInboxTypeFeature");case"change":return u("shell.butlerInboxTypeChange");case"task":default:return u("shell.butlerInboxTypeTask")}}function UI(e){switch(e){case"in_progress":return u("shell.butlerInboxStatusInProgress");case"closed":return u("shell.butlerInboxStatusClosed");case"pending":default:return u("shell.butlerInboxStatusPending")}}function WI(e){return new Date(e).toLocaleString()}function PC({open:e,onClose:t,onImported:n}){const{showToast:i}=En(),[a,c]=b.useState(!1),[l,h]=b.useState(!1),[f,p]=b.useState(!1),[y,g]=b.useState(null),[w,x]=b.useState(""),[S,C]=b.useState(""),[P,A]=b.useState(null),[L,O]=b.useState([]),[ee,q]=b.useState([]),[_,E]=b.useState(!1),[M,I]=b.useState(""),N=a||l||f,z=b.useCallback(async D=>{c(!0),g(null);try{const re=await oC(D);x(re.currentPath),C(re.currentPath),A(re.parentPath),O(re.roots),q(re.items)}catch(re){x(""),A(null),q([]),g(re instanceof Error?re.message:u("shell.importBrowserBrowseFailed"))}finally{c(!1)}},[]);b.useEffect(()=>{if(!e){E(!1),I(""),g(null);return}z(w||void 0)},[z,e]);function G(){N||(E(!1),I(""),t())}async function J(D){D.preventDefault(),await z(S)}function B(){!w||N||(I(""),E(!0))}function W(){l||(E(!1),I(""))}async function Y(D){D==null||D.preventDefault();const re=M.trim();if(!(!w||!re||N)){h(!0),g(null);try{const R=await CA({parentPath:w,directoryName:re});i({title:u("shell.importBrowserCreateDirectorySuccess"),description:R.path,tone:"success"}),E(!1),I(""),await z(R.path)}catch(R){const $=R instanceof Error?R.message:u("shell.importBrowserCreateDirectoryFailed");g($),i({title:$,tone:"error"})}finally{h(!1)}}}async function Q(){const D=w.trim();if(!(!D||N)){p(!0),g(null);try{const re=await kA({path:D});i({title:u("shell.importSuccess"),description:re.path,tone:"success"}),t(),Promise.resolve().then(()=>n==null?void 0:n(re)).catch(R=>{i({title:R instanceof Error?R.message:u("shell.navigationLoadFailed"),tone:"error"})})}catch(re){i({title:re instanceof Error?re.message:u("shell.importFailed"),tone:"error"})}finally{p(!1)}}}return r.jsxs(r.Fragment,{children:[r.jsxs(Un,{open:e,title:u("shell.importBrowserTitle"),description:u("shell.importBrowserDescription"),onClose:G,children:[r.jsxs("form",{className:"workbench-directory-browser-form",onSubmit:J,children:[r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.importBrowserCurrentPath")}),r.jsx("input",{type:"text",value:S,placeholder:u("shell.importPathPlaceholder"),onChange:D=>C(D.target.value)})]}),r.jsxs("div",{className:"workbench-directory-browser-toolbar",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:N||!P,onClick:()=>{P&&z(P)},children:u("shell.importBrowserOpenParent")}),r.jsx("button",{type:"submit",className:"secondary-button",disabled:N,children:u("shell.importBrowserOpenPath")}),r.jsx("button",{type:"button",className:"secondary-button",disabled:N||!w,onClick:B,children:u("shell.importBrowserCreateDirectory")})]})]}),r.jsxs("section",{className:"workbench-directory-browser-panel",children:[r.jsxs("div",{className:"workbench-directory-browser-section",children:[r.jsx("span",{className:"workbench-directory-browser-section-title",children:u("shell.importBrowserRoots")}),r.jsx("div",{className:"workbench-directory-browser-root-list",children:L.map(D=>r.jsx("button",{type:"button",className:"workbench-directory-browser-chip",disabled:N,onClick:()=>{z(D.path)},children:D.name},D.path))})]}),r.jsx("div",{className:"workbench-directory-browser-current-path",children:w}),y?r.jsx("p",{className:"workbench-directory-browser-status status-text","data-tone":"error",children:y}):null,a?r.jsx("p",{className:"workbench-directory-browser-status status-text",children:u("common.loading")}):ee.length>0?r.jsx("div",{className:"workbench-directory-browser-list",children:ee.map(D=>r.jsxs("button",{type:"button",className:"workbench-directory-browser-item",disabled:N,onClick:()=>{z(D.path)},children:[r.jsx("span",{className:"workbench-directory-browser-item-name",children:D.name}),r.jsx("span",{className:"workbench-directory-browser-item-path",children:D.path})]},D.path))}):r.jsx("p",{className:"workbench-directory-browser-status status-text",children:u("shell.importBrowserEmpty")})]}),r.jsxs("div",{className:"workbench-modal-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:N,onClick:G,children:u("common.cancel")}),r.jsx("button",{type:"button",className:"primary-button",disabled:N||!w,onClick:()=>{Q()},children:u(f?"shell.importSubmitting":"shell.importBrowserSubmit")})]})]}),r.jsx(Un,{open:e&&_,title:u("shell.importBrowserCreateDirectoryTitle"),description:u("shell.importBrowserCreateDirectoryDescription"),onClose:W,children:r.jsxs("form",{className:"workbench-rename-form",onSubmit:D=>void Y(D),children:[r.jsx("div",{className:"workbench-directory-browser-current-path",children:w}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.importBrowserCreateDirectoryLabel")}),r.jsx("input",{type:"text",value:M,placeholder:u("shell.importBrowserCreateDirectoryPlaceholder"),autoFocus:!0,onChange:D=>I(D.target.value)})]}),r.jsxs("div",{className:"workbench-modal-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:l,onClick:W,children:u("common.cancel")}),r.jsx("button",{type:"submit",className:"primary-button",disabled:l||!M.trim(),children:u(l?"shell.importBrowserCreatingDirectory":"shell.importBrowserCreateDirectorySubmit")})]})]})})]})}const Rv="workbench.left.width",Ev="workbench.right.width",Av="workbench.left.collapsed",Iv="workbench.right.collapsed",of="workbench.last.session.path",Lv="workbench.workspace.collapsed.ids",af="workbench.workspace.selected.id",TC="workbench.navigation.snapshot",Mv="workbench.notifications.seen_at",zI=280,HI=320,Qc=208,Dv=520,Fv=560,qI=200,lf=20,Yc=40,Xc=5,$I=3e4,VI=12,GI=1800*1e3,_v=60*1e3,KI=4e3,Ov=220,Bv=18,QI="workbench:focus-composer",YI=new Set(["starting","running","reconnecting","stale","unknown"]);function XI(e){return YI.has(e.runningState??"idle")||e.activityState==="running"}function JI(e){var a,c;const t=((a=e.lastErrorCode)==null?void 0:a.trim())??"",n=((c=e.lastErrorDetail)==null?void 0:c.trim())??"",i=[t,n].filter(l=>l.length>0).join(" · ");return i?i.length<=Ov?i:`${i.slice(0,Ov-3)}...`:null}function ZI(e,t){var a,c,l,h,f,p,y,g;const n=new Map(e.projects.map(w=>[w.id,w.workspaceId])),i=[];for(const w of t){const x=((a=w.sessionTitle)==null?void 0:a.trim())||w.projectName,S=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:u("shell.globalNotificationFollowUpWaitingTitle",{title:x}),body:((c=w.waitingReason)==null?void 0:c.trim())||((l=w.lastAutomationSummary)==null?void 0:l.trim())||w.objective,routePath:Bn(w.workspaceId,w.sessionId),workspaceId:w.workspaceId,createdAt:S});continue}if(w.status==="completed"){i.push({id:`follow-up-completed:${w.id}`,kind:"follow_up_completed",title:u("shell.globalNotificationFollowUpCompletedTitle",{title:x}),body:((h=w.lastAutomationSummary)==null?void 0:h.trim())||w.objective,routePath:Bn(w.workspaceId,w.sessionId),workspaceId:w.workspaceId,createdAt:S});continue}w.status==="failed"&&i.push({id:`follow-up-failed:${w.id}`,kind:"follow_up_failed",title:u("shell.globalNotificationFollowUpFailedTitle",{title:x}),body:((f=w.lastAutomationSummary)==null?void 0:f.trim())||((p=w.waitingReason)==null?void 0:p.trim())||w.objective,routePath:Bn(w.workspaceId,w.sessionId),workspaceId:w.workspaceId,createdAt:S})}for(const w of e.verifications){if(w.status!=="failed")continue;const x=w.projectId?n.get(w.projectId)??null:null,S=((y=w.targetRef)==null?void 0:y.trim())||w.verificationType;i.push({id:`verification-failed:${w.id}`,kind:"verification_failed",title:u("shell.globalNotificationVerificationFailedTitle",{title:S}),body:((g=w.summary)==null?void 0:g.trim())||u("shell.globalNotificationVerificationFailedFallback"),routePath:x?co(x):null,workspaceId:x,createdAt:w.finishedAt||w.startedAt||w.createdAt})}return i.sort((w,x)=>{const S=Uv(w.kind)-Uv(x.kind);return S!==0?S:Ss(x.createdAt)-Ss(w.createdAt)}).slice(0,VI)}function Uv(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 eL(e){switch(e){case"follow_up_waiting_user":return u("shell.globalNotificationKindWaitingUser");case"follow_up_completed":return u("shell.globalNotificationKindFollowUpCompleted");case"follow_up_failed":return u("shell.globalNotificationKindFollowUpFailed");case"verification_failed":return u("shell.globalNotificationKindVerificationFailed");default:return u("shell.globalNotificationsPanelTitle")}}function Ss(e){if(!e)return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function tL(e,t){return t?Ss(e.createdAt)>Ss(t):!0}function nL(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 Wv(e,t){var l,h;const n=["/workspaces/:workspaceId","/workspaces/:workspaceId/sessions","/workspaces/:workspaceId/sessions/:sessionId","/workspaces/:workspaceId/tools","/workspaces/:workspaceId/tools/files","/workspaces/:workspaceId/tools/git","/workspaces/:workspaceId/tools/processes","/workspaces/:workspaceId/terminals","/workspaces/:workspaceId/butler"];for(const f of n){const p=On(f,e),y=(l=p==null?void 0:p.params.workspaceId)==null?void 0:l.trim();if(y)return y}const i=fl(e),a=(i==null?void 0:i.sessionId)??null;return!a||!zC(a)?null:((h=new URLSearchParams(t).get("workspaceId"))==null?void 0:h.trim())||null}function rL(e){return e.startsWith("/sessions")||e.startsWith("/terminals")||e.startsWith("/tools")}function iL(e){return e==="mobile"?Lr():"/landing"}function fl(e){var c,l,h;const t=On("/workspaces/:workspaceId/sessions/:sessionId",e),n=(c=t==null?void 0:t.params.sessionId)==null?void 0:c.trim();if(n)return{sessionId:n,workspaceId:((l=t==null?void 0:t.params.workspaceId)==null?void 0:l.trim())??null};const i=On("/sessions/:sessionId",e),a=(h=i==null?void 0:i.params.sessionId)==null?void 0:h.trim();return a?{sessionId:a,workspaceId:null}:null}function sL(e){return!!(On("/sessions",e)||On("/workspaces/:workspaceId/sessions",e))}function zv(e){return!!fl(e)}function oL(e){return!!(On("/tools",e)||On("/tools/files",e)||On("/tools/git",e)||On("/tools/processes",e)||On("/workspaces/:workspaceId/tools",e)||On("/workspaces/:workspaceId/tools/files",e)||On("/workspaces/:workspaceId/tools/git",e)||On("/workspaces/:workspaceId/tools/processes",e))}function Hv(e){return!!(On("/terminals",e)||On("/workspaces/:workspaceId/terminals",e))}function aL(e){return!!On("/workspaces/:workspaceId/butler",e)}function lL(e){return e.trim().replace(/\\/g,"/").replace(/^(?:\.\/)+/,"").replace(/^\/+/,"")}const cL=b.lazy(async()=>({default:(await sa(()=>Promise.resolve().then(()=>p5),void 0)).FileContextPanel})),uL=b.lazy(async()=>({default:(await sa(()=>Promise.resolve().then(()=>k5),void 0)).GitSidebar})),dL=b.lazy(async()=>({default:(await sa(()=>Promise.resolve().then(()=>q5),void 0)).TerminalManagerPanel}));function hL(e){return!!(e!=null&&e.session)}function so(e){return Array.isArray(e==null?void 0:e.children)?e.children:[]}function el(e){return Array.isArray(e==null?void 0:e.visibleSessionTree)?e.visibleSessionTree.filter(hL):[]}const RC=b.createContext(null);function qu(e,t){return(t.lastMessageAt??t.updatedAt).localeCompare(e.lastMessageAt??e.updatedAt)}function wm(e){return e.isSubagent===!0}function ys(e){return e.isArchived===!0}function xm(e){var t;return((t=e.parentSessionId)==null?void 0:t.trim())||null}function fL(e,t){let n=e;const i=new Set([e.sessionId]);for(;;){const a=xm(n);if(!a)return n.sessionId;const c=t.get(a);if(!c)return n.sessionId;if(i.has(c.sessionId))return e.sessionId;i.add(c.sessionId),n=c}}function EC(e){const t=new Map(e.map(a=>[a.sessionId,a])),n=new Map,i=[];for(const a of e){const c=fL(a,t);if(c===a.sessionId){i.push(a);continue}const l=n.get(c)??[];n.set(c,[...l,a])}return[...i].sort(qu).map(a=>({session:a,children:[...n.get(a.sessionId)??[]].sort(qu)}))}function mL(e){return e.flatMap(t=>[t.session,...so(t)])}function cf(e,t,n,i=-1){if(e<=0)return 0;const a=i>=0?Math.max(t,i+1):t;return Math.min(e,Math.max(n??0,a))}function qv(e,t){const n=Object.keys(e),i=Object.keys(t);return n.length!==i.length?!1:n.every(a=>e[a]===t[a])}function pL(e){const t=e.lastMessageAt??e.updatedAt;return t?new Date(t).toLocaleDateString():""}function gL(e){return Wl(e)||e.syncStatus==="error"}function bL(e){var i,a;if(!gL(e))return null;const t=((i=e.lastErrorCode)==null?void 0:i.trim())??"",n=((a=e.lastErrorDetail)==null?void 0:a.replace(/\s+/g," ").trim())??"";return t&&n&&!n.includes(t)?`${t} · ${n}`:n||t||(e.syncStatus==="error"&&!Wl(e)?u("conversation.syncStatusError"):u("conversation.runtimeErrorTitle"))}function yL(e,t=110){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}function ud(e,t="compact"){return $i(e,t)}const vL={position:"relative",zIndex:0},wL={zIndex:1};function AC(e,t,n){const i=[];n&&i.push(t.name);const a=pL(e);return a&&i.push(a),i.join(" · ")||t.name}function $v(e,t){return jp("session-state-indicator",e)}function Vv(e,t){try{const n=window.localStorage.getItem(e),i=n?Number(n):Number.NaN;return Number.isFinite(i)?i:t}catch{return t}}function Gv(e,t){try{const n=window.localStorage.getItem(e);return n===null?t:n==="true"}catch{return t}}function xL(e){try{const t=window.localStorage.getItem(e);if(!t)return[];const n=JSON.parse(t);if(!Array.isArray(n))return[];const i=[];for(const a of n)typeof a=="string"&&!i.includes(a)&&i.push(a);return i}catch{return[]}}function Kv(e){var t;try{const n=(t=window.localStorage.getItem(e))==null?void 0:t.trim();return n||null}catch{return null}}function hs(e,t){try{window.localStorage.setItem(e,t)}catch{}}function kL(e){try{window.localStorage.removeItem(e)}catch{}}function Jc(e,t,n){return Math.max(t,Math.min(n,e))}function SL(e){return e instanceof HTMLElement?e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||!!e.closest("[contenteditable='true']"):!1}function CL(){typeof window>"u"||window.dispatchEvent(new CustomEvent(QI))}function Qv(e){return!e||!Array.isArray(e.items)?[]:e.items.map(t=>({workspace:t.workspace,sessions:[...t.sessions].sort(qu)}))}function jL(e,t){if(!Array.isArray(e.items)||t.size===0)return e;let n=!1;const i=e.items.map(a=>{let c=!1;const l=a.sessions.map(h=>{const f=t.get(h.sessionId);return f===void 0||ys(h)===f?h:(n=!0,c=!0,{...h,isArchived:f})});return c?{...a,sessions:l}:a});return n?{...e,items:i}:e}function NL(e,t){if(!(!Array.isArray(t.items)||e.size===0))for(const n of t.items)for(const i of n.sessions){const a=e.get(i.sessionId);a!==void 0&&ys(i)===a&&e.delete(i.sessionId)}}function PL(){return Kn(TC,GI)}function TL(e,t){let n=!1;const i=e.map(a=>{if(a.workspace.id!==t.workspaceId)return a;const c=a.sessions.findIndex(h=>h.sessionId===t.sessionId),l=c>=0?a.sessions.map((h,f)=>f===c?t:h):[t,...a.sessions];return n=!0,{...a,sessions:[...l].sort(qu)}});return n?i:e}function RL(e,t,n){let i=!1;const a=e.map(c=>{let l=!1;const h=c.sessions.map(f=>f.sessionId!==t?f:(i=!0,l=!0,{...f,lastSeenAt:f.lastSeenAt&&f.lastSeenAt>n?f.lastSeenAt:n,activityState:f.activityState==="completed_unread"?"idle":f.activityState}));return l?{...c,sessions:h}:c});return i?a:e}function Yv(e,t,n){let i=!1;const a=e.map(c=>{let l=!1;const h=c.sessions.map(f=>f.sessionId!==t||f.isArchived===n?f:(i=!0,l=!0,{...f,isArchived:n}));return l?{...c,sessions:h}:c});return i?a:e}function Xv(e,t,n){let i=!1;const a=e.map(c=>{let l=!1;const h=c.sessions.map(f=>f.sessionId!==t||f.isFavorite===!0===n?f:(i=!0,l=!0,{...f,isFavorite:n}));return l?{...c,sessions:h}:c});return i?a:e}function km(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function IC(e,t){const n=e.filter(i=>t.has(i));return n.length===e.length?e:n}function Sm(e){return`workspace-management.summary.${e}`}function LC(e){return`git-sidebar.snapshot.${e}`}function MC(e,t){const n=e.repoRoot??null;return{workspaceId:e.id,name:e.name,path:e.path,git:{isRepository:!!n,repoRoot:n,currentBranch:null,commitCount:null,remotes:[],error:null},codeComposition:{scannedFileCount:0,truncated:!1,items:[],error:null}}}function DC(e,t){const n=e.git.repoRoot??t.repoRoot??null;return{...e,workspaceId:t.id,name:t.name,path:t.path,git:{...e.git,isRepository:e.git.isRepository||!!n,repoRoot:n}}}function FC(e,t){var a,c,l;const n=((a=t.status)==null?void 0:a.snapshot.repoRoot)??e.git.repoRoot,i=((c=t.status)==null?void 0:c.snapshot.branch)??((l=t.branches)==null?void 0:l.currentBranch)??e.git.currentBranch??null;return{...e,git:{...e.git,isRepository:e.git.isRepository||!!n,repoRoot:n,currentBranch:i,error:null}}}function _C({count:e,className:t="workbench-skeleton-lines"}){return r.jsx("div",{className:t,"aria-hidden":"true",children:Array.from({length:e},(n,i)=>r.jsx("span",{className:"skeleton-line"},i))})}function EL(){return r.jsx("div",{className:"workbench-nav-loading","aria-hidden":"true",children:Array.from({length:3},(e,t)=>r.jsxs("section",{className:"workbench-skeleton-card",children:[r.jsxs("div",{className:"workbench-skeleton-heading",children:[r.jsx("span",{className:"skeleton-line short"}),r.jsx("span",{className:"skeleton-line tiny"})]}),r.jsx("div",{className:"workbench-skeleton-list",children:Array.from({length:3},(n,i)=>r.jsxs("div",{className:"workbench-skeleton-session",children:[r.jsx("span",{className:"workbench-skeleton-dot"}),r.jsx(_C,{count:2,className:"workbench-skeleton-lines compact"})]},i))})]},t))})}function Zc(){return r.jsx("section",{className:"workbench-info-skeleton","aria-hidden":"true",children:Array.from({length:4},(e,t)=>r.jsxs("article",{className:"workbench-info-skeleton-card",children:[r.jsx("span",{className:"skeleton-line short"}),r.jsx(_C,{count:3})]},t))})}function AL({side:e,collapsed:t}){const n=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 r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),r.jsx("line",{x1:n,y1:"4",x2:n,y2:"20"}),r.jsx("polyline",{points:i})]})}function Jv({ariaLabel:e,side:t,collapsed:n,className:i="panel-icon-button",onClick:a}){return r.jsx("button",{className:i,type:"button","aria-label":e,title:e,onClick:a,children:r.jsx(AL,{side:t,collapsed:n})})}function Zv({expanded:e}){return r.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:r.jsx("polyline",{points:"6 9 12 15 18 9"})})}function IL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),r.jsx("polyline",{points:"7 10 12 15 17 10"}),r.jsx("line",{x1:"12",y1:"15",x2:"12",y2:"3"})]})}function LL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.jsx("rect",{x:"4",y:"5",width:"16",height:"14",rx:"2"}),r.jsx("line",{x1:"8",y1:"10",x2:"16",y2:"10"}),r.jsx("line",{x1:"8",y1:"14",x2:"12",y2:"14"}),r.jsx("circle",{cx:"17.5",cy:"15.5",r:"2.5"})]})}function ML(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.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"}),r.jsx("path",{d:"M10 18.5a2 2 0 0 0 4 0",strokeLinecap:"round"})]})}function OC(e){return r.jsx("div",{className:"workbench-notification-anchor",children:r.jsxs("button",{type:"button",className:e.collapsed?"workbench-nav-toolbar-button workbench-collapsed-button":"workbench-nav-toolbar-button","aria-label":u("shell.globalNotificationsAction"),title:u("shell.globalNotificationsAction"),"aria-expanded":e.open,onClick:e.onToggle,children:[r.jsx(ML,{}),e.unreadCount>0?r.jsx("span",{className:"workbench-notification-badge","aria-label":u("shell.globalNotificationsUnreadAria",{count:String(e.unreadCount)}),children:e.unreadCount>99?"99+":e.unreadCount}):null]})})}function DL(e){const[t,n]=b.useState("notifications");b.useEffect(()=>{e.open&&n("notifications")},[e.open]);const i=b.useMemo(()=>e.notifications.filter(a=>e.showArchivedNotifications||!e.archivedNotificationIds.has(a.id)),[e.archivedNotificationIds,e.notifications,e.showArchivedNotifications]);return r.jsxs(Un,{open:e.open,title:u("shell.globalNotificationsPanelTitle"),description:u("shell.globalNotificationsPanelDescription"),className:"workbench-notification-modal-card workspace-inbox-modal-card",showCloseButton:!1,onClose:e.onClose,children:[r.jsxs("div",{className:"workbench-notification-tabs",role:"tablist","aria-label":u("shell.globalNotificationsPanelTitle"),children:[r.jsx("button",{type:"button",className:t==="notifications"?"workbench-notification-tab active":"workbench-notification-tab",role:"tab","aria-selected":t==="notifications",onClick:()=>n("notifications"),children:u("shell.globalNotificationsAction")}),r.jsx("button",{type:"button",className:t==="inbox"?"workbench-notification-tab active":"workbench-notification-tab",role:"tab","aria-selected":t==="inbox",onClick:()=>n("inbox"),children:u("shell.butlerInboxAction")})]}),r.jsx("div",{className:"workbench-notification-content","data-tab":t,children:t==="notifications"?r.jsxs("div",{className:"workbench-notification-pane",role:"tabpanel","aria-label":u("shell.globalNotificationsAction"),children:[r.jsx("div",{className:"workbench-notification-toolbar",children:r.jsxs("label",{className:"workbench-notification-filter",children:[r.jsx("input",{type:"checkbox",checked:e.showArchivedNotifications,onChange:a=>e.onToggleShowArchivedNotifications(a.target.checked)}),r.jsx("span",{children:u("shell.globalNotificationsShowArchived")})]})}),i.length>0?r.jsx("div",{className:"workbench-notification-list",children:i.map(a=>{const c=e.archivedNotificationIds.has(a.id);return r.jsxs("article",{className:"workbench-notification-item","data-archived":c,children:[r.jsxs("button",{type:"button",className:"workbench-notification-item-content",onClick:()=>{e.onSelectNotification(a)},children:[r.jsxs("div",{className:"workbench-notification-item-header",children:[r.jsx("span",{className:"workbench-notification-item-kind",children:eL(a.kind)}),r.jsx("time",{children:nL(a.createdAt)})]}),r.jsx("strong",{children:a.title}),r.jsx("p",{children:a.body})]}),r.jsx("div",{className:"workbench-notification-item-actions",children:r.jsx("button",{type:"button",className:"secondary-button",onClick:l=>{if(l.stopPropagation(),c){e.onUnarchiveNotification(a.id);return}e.onArchiveNotification(a.id)},children:u(c?"shell.globalNotificationsRemoveArchiveAction":"shell.globalNotificationsArchiveAction")})})]},a.id)})}):r.jsx("p",{className:"workbench-notification-empty",children:u("shell.globalNotificationsEmpty")})]}):r.jsx("div",{className:"workbench-notification-pane",role:"tabpanel","aria-label":u("shell.butlerInboxAction"),children:r.jsx(NC,{active:e.open&&t==="inbox",preferredWorkspaceId:e.preferredWorkspaceId})})}),r.jsx("div",{className:"workbench-modal-actions workbench-notification-footer-actions",children:r.jsx("button",{type:"button",className:"secondary-button",onClick:e.onClose,children:u("common.close")})})]})}function FL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function _L(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("circle",{cx:"11",cy:"11",r:"7"}),r.jsx("line",{x1:"20",y1:"20",x2:"16.65",y2:"16.65"})]})}function OL(){return r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:r.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 BL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[r.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),r.jsx("path",{d:"M7 9l3 3-3 3"}),r.jsx("path",{d:"M13 15h4"})]})}function UL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.9",children:[r.jsx("rect",{x:"4",y:"5",width:"16",height:"14",rx:"3"}),r.jsx("circle",{cx:"9",cy:"11",r:"1"}),r.jsx("circle",{cx:"15",cy:"11",r:"1"}),r.jsx("path",{d:"M8 15h8"}),r.jsx("path",{d:"M12 5V3"})]})}function BC(){return r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:r.jsx("polyline",{points:"15 18 9 12 15 6"})})}function Np(){return r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:r.jsx("polyline",{points:"9 18 15 12 9 6"})})}function UC(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),r.jsx("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),r.jsx("polyline",{points:"14 9 11 12 14 15"})]})}function WL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.jsx("circle",{cx:"18",cy:"6",r:"3"}),r.jsx("circle",{cx:"6",cy:"6",r:"3"}),r.jsx("circle",{cx:"18",cy:"18",r:"3"}),r.jsx("path",{d:"M6 9v6a3 3 0 0 0 3 3h3"}),r.jsx("line",{x1:"18",y1:"9",x2:"18",y2:"15"})]})}function zL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.jsx("circle",{cx:"12",cy:"12",r:"3"}),r.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 HL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.jsx("rect",{x:"4",y:"5",width:"6",height:"6",rx:"1.5"}),r.jsx("rect",{x:"14",y:"5",width:"6",height:"6",rx:"1.5"}),r.jsx("rect",{x:"4",y:"13",width:"6",height:"6",rx:"1.5"}),r.jsx("path",{d:"M14 16l2 2 4-4"})]})}function qL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.jsx("rect",{x:"4",y:"6",width:"10",height:"12",rx:"2"}),r.jsx("path",{d:"M10 12h8"}),r.jsx("path",{d:"M15 8l4 4-4 4"})]})}function $L({selected:e}){return e?r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"}),r.jsx("path",{d:"M8 12.5l2.8 2.8L16.5 9.5"})]}):r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:r.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"4"})})}function WC({active:e}){return e?r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"1.5",children:r.jsx("polygon",{points:"12 3 15 9 22 10 17 15 18 22 12 18 6 22 7 15 2 10 9 9"})}):r.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:r.jsx("polygon",{points:"12 3 15 9 22 10 17 15 18 22 12 18 6 22 7 15 2 10 9 9"})})}function VL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.jsx("path",{d:"M3 7h18"}),r.jsx("path",{d:"M5 7l1 12h12l1-12"}),r.jsx("path",{d:"M9 11h6"}),r.jsx("path",{d:"M8 4h8l1 3H7l1-3z"})]})}function GL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.jsx("path",{d:"M12 20h9"}),r.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 KL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.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"}),r.jsx("path",{d:"M9 13h6"})]})}function QL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"}),r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"})]})}function YL(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:[r.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),r.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),r.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function XL({open:e,mode:t,keyword:n,codeWorkspaceId:i,codeResults:a,codeLoading:c,codeError:l,workspaceOptions:h,sessionResults:f,onClose:p,onModeChange:y,onKeywordChange:g,onCodeWorkspaceChange:w,onCodeSearch:x,onOpenSession:S}){const C=n.trim().length>0&&i.trim().length>0;return r.jsx(Un,{open:e,title:u("shell.searchModalTitle"),description:u("shell.searchModalDescription"),onClose:p,children:r.jsxs("div",{className:"workbench-search-modal",children:[r.jsxs("div",{className:"workbench-search-mode-switch",role:"tablist","aria-label":u("shell.searchModeLabel"),children:[r.jsx("button",{type:"button",className:t==="sessions"?"workbench-search-mode-button active":"workbench-search-mode-button",role:"tab","aria-selected":t==="sessions",onClick:()=>y("sessions"),children:u("shell.searchModeSessions")}),r.jsx("button",{type:"button",className:t==="code"?"workbench-search-mode-button active":"workbench-search-mode-button",role:"tab","aria-selected":t==="code",onClick:()=>y("code"),children:u("shell.searchModeCode")})]}),t==="sessions"?r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.searchKeywordLabel")}),r.jsx("input",{type:"text",value:n,placeholder:u("shell.searchSessionPlaceholder"),autoFocus:!0,onChange:P=>g(P.target.value)})]}),r.jsx("div",{className:"workbench-search-results",children:n.trim().length===0?r.jsx("p",{className:"workbench-search-empty",children:u("shell.searchSessionHint")}):f.length>0?f.map(P=>{const A=Ps(P.session.title,u("common.unknown"));return r.jsxs("button",{type:"button",className:"workbench-search-result-item",onClick:()=>S(P.session.sessionId),children:[r.jsx("span",{className:"workbench-search-result-title",title:A.fullTitle,children:A.displayTitle}),r.jsxs("span",{className:"workbench-search-result-meta",children:[P.workspace.name," · ",ud(P.session.provider,"full")]})]},P.session.sessionId)}):r.jsx("p",{className:"workbench-search-empty",children:u("shell.searchSessionEmpty")})})]}):r.jsxs(r.Fragment,{children:[r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.searchWorkspaceLabel")}),r.jsx("select",{value:i,onChange:P=>w(P.target.value),children:h.map(P=>r.jsx("option",{value:P.id,children:P.name},P.id))})]}),r.jsxs("form",{className:"workbench-search-code-form",onSubmit:P=>{P.preventDefault(),x()},children:[r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.searchKeywordLabel")}),r.jsx("input",{type:"text",value:n,placeholder:u("shell.searchCodePlaceholder"),autoFocus:!0,onChange:P=>g(P.target.value)})]}),r.jsx("button",{type:"submit",className:"primary-button",disabled:!C||c,children:u(c?"common.loading":"shell.searchSubmit")})]}),r.jsxs("div",{className:"workbench-search-results",children:[l?r.jsx("p",{className:"status-text","data-tone":"error",children:l}):null,!l&&n.trim().length===0?r.jsx("p",{className:"workbench-search-empty",children:u("shell.searchCodeHint")}):null,!l&&n.trim().length>0&&!c&&a.length===0?r.jsx("p",{className:"workbench-search-empty",children:u("shell.searchCodeEmpty")}):null,a.map(P=>r.jsxs("div",{className:"workbench-search-result-item static",children:[r.jsx("span",{className:"workbench-search-result-title",children:P.name}),r.jsx("span",{className:"workbench-search-result-meta",children:P.path})]},`${P.path}-${P.kind}`))]})]})]})})}function eu({menuKey:e,session:t,workspace:n,isActive:i,isFavorite:a,menuOpen:c,showWorkspaceName:l,depth:h=0,showActions:f=!0,hasSubagents:p=!1,subagentListExpanded:y=!1,selectionMode:g=!1,selected:w=!1,onToggleSelect:x,onToggleSubagents:S,onOpen:C,onRename:P,onToggleMenu:A,onToggleFavorite:L,onArchive:O,onCloseMenu:ee,onContextMenu:q}){var Y;const _=((Y=t.subagentLabel)==null?void 0:Y.trim())||(wm(t)?u("shell.subagentBadge"):null),E=Ps(t.title,u("common.unknown")),M=bL(t),I=M?yL(M):null,N=Hu(t),z=N?yC("session-activity-badge",t):null,G=b.useRef(null),[J,B]=b.useState(null);b.useLayoutEffect(()=>{if(!c){B(null);return}const Q=()=>{const D=G.current;if(!D)return;const re=D.getBoundingClientRect();B({top:`${re.bottom}px`,left:`${re.right}px`})};return Q(),window.addEventListener("resize",Q),window.addEventListener("scroll",Q,!0),()=>{window.removeEventListener("resize",Q),window.removeEventListener("scroll",Q,!0)}},[c]);const W=c&&typeof document<"u"&&J?Qn.createPortal(r.jsxs("div",{className:"workbench-session-menu","data-menu-key":e,onClick:Q=>Q.stopPropagation(),style:J,children:[r.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{P(),ee()},children:[r.jsx(GL,{}),r.jsx("span",{children:u("shell.renameAction")})]}),r.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{L(),ee()},children:[r.jsx(WC,{active:a}),r.jsx("span",{children:u(a?"shell.unfavoriteAction":"shell.favoriteAction")})]}),r.jsxs("button",{type:"button",className:"workbench-session-menu-item",onClick:()=>{O(),ee()},children:[r.jsx(VL,{}),r.jsx("span",{children:u("shell.archiveAction")})]})]}),document.body):null;return r.jsxs("article",{className:"workbench-session-card","data-active":i,"data-depth":h,"data-subagent":wm(t),"data-has-subagents":p,"data-selecting":g,"data-selected":w,onContextMenu:Q=>{g||!q||(Q.preventDefault(),q())},children:[r.jsxs("div",{className:"workbench-session-main",children:[g?r.jsx("span",{className:"workbench-session-selection-indicator","data-selected":w,"aria-hidden":"true",children:r.jsx($L,{selected:w})}):p?r.jsxs("button",{type:"button",className:"workbench-session-subagent-toggle",style:wL,"aria-label":u(y?"shell.subagentCollapse":"shell.subagentExpand"),title:u(y?"shell.subagentCollapse":"shell.subagentExpand"),"aria-expanded":y,onClick:Q=>{Q.stopPropagation(),S==null||S()},children:[r.jsx("span",{className:$v(t),"data-activity-source":t.activitySource,"aria-hidden":"true"}),r.jsx("span",{className:"workbench-session-subagent-toggle-icon","aria-hidden":"true",children:y?r.jsx(QL,{}):r.jsx(Np,{})})]}):r.jsx("span",{className:$v(t),"data-activity-source":t.activitySource,"aria-hidden":"true"}),r.jsx("button",{type:"button",className:"workbench-session-link",style:p?vL:void 0,"data-active":i,"aria-pressed":g?w:void 0,onClick:g?x:C,children:r.jsxs("div",{className:"workbench-session-link-copy",children:[r.jsxs("div",{className:"session-title-row",children:[r.jsx("span",{className:"session-title",title:E.fullTitle,children:E.displayTitle}),_?r.jsx("span",{className:"session-subagent-badge",children:_}):null]}),r.jsxs("div",{className:"session-meta-row",children:[r.jsx("span",{className:"session-meta",children:AC(t,n,l)}),N&&z?r.jsx("span",{className:z,children:N}):null,r.jsx("span",{className:`session-provider-badge ${t.provider}`,children:ud(t.provider)})]}),I?r.jsx("div",{className:"session-error-row",title:M??void 0,children:r.jsx("span",{className:"session-error-text",children:I})}):null]})})]}),f&&!g?r.jsx("div",{className:"workbench-session-actions","data-open":c,children:r.jsx("button",{ref:G,type:"button",className:"workbench-session-menu-trigger","data-open":c,"aria-label":u("shell.sessionMoreAction"),title:u("shell.sessionMoreAction"),"aria-expanded":c,onClick:Q=>{Q.stopPropagation(),A()},children:r.jsx(YL,{})})}):null,W]})}function ew({workspaceGroups:e,favoriteSessions:t,favoriteSessionIds:n,activeWorkspaceId:i,isConversationActive:a,isTerminalActive:c,isButlerActive:l,isSearchOpen:h,navigationLoading:f,navigationError:p,activeSessionId:y,onRefreshNavigation:g,onSessionUpdated:w,onNavigateConversation:x,onNavigateTerminals:S,onNavigateButler:C,onOpenSearch:P,onOpenSettings:A,onSelectWorkspace:L,onToggleWorkspaceCollapse:O,subscribeGitSnapshot:ee,requestGitRefresh:q,subscribeWorkspaceManagementSnapshot:_,requestWorkspaceManagementRefresh:E,onToggleFavoriteSession:M,onArchiveSession:I,onUnarchiveSession:N,workspaceManagementStateById:z,setWorkspaceManagementStateById:G,unreadNotificationCount:J,notificationPanelOpen:B,onToggleNotificationPanel:W,onClose:Y,onToggleCollapse:Q}){var An;const D=Wn(),re=zn(),{showToast:R}=En(),$=b.useCallback(j=>{!re.isDesktop||re.ui.osFamily!=="macos"||j.button!==0||xp(j.target)&&kp()},[re.isDesktop,re.ui.osFamily]),[Z,F]=b.useState(!1),[we,ce]=b.useState(!1),[be,Ve]=b.useState(!1),[ze,yt]=b.useState([]),[ft,Ot]=b.useState(null),[Ke,jt]=b.useState(null),[pt,Mt]=b.useState(null),[xt,Dt]=b.useState(null),[wt,ye]=b.useState(null),[Fe,kt]=b.useState(null),[lt,gt]=b.useState(null),[Lt,nt]=b.useState(lf),[fe,ge]=b.useState({}),[Te,qe]=b.useState({}),[dt,St]=b.useState([]),[rt,Ut]=b.useState(null),[mt,Bt]=b.useState(""),[At,vt]=b.useState(null),[Nt,Zt]=b.useState(null),[ie,Ie]=b.useState([]),[ct,zt]=b.useState(!1),nn=((An=e.find(j=>j.workspace.id===wt))==null?void 0:An.workspace)??null,ke=e.find(j=>j.workspace.id===Fe)??null,it=e.find(j=>j.workspace.id===Nt)??null,Qt=b.useMemo(()=>it?mL(el(it)):[],[it]),rn=b.useMemo(()=>Qt.map(j=>j.sessionId),[Qt]),Tn=b.useMemo(()=>new Set(rn),[rn]),un=b.useMemo(()=>new Set(ie),[ie]),X=rn.length>0&&ie.length===rn.length;b.useEffect(()=>{G(j=>{const se=new Set(e.map(et=>et.workspace.id)),V={};Object.entries(j).forEach(([et,Wt])=>{se.has(et)&&(V[et]=Wt)}),e.forEach(et=>{const Wt=Kn(Sm(et.workspace.id),_v),qt=Kn(LC(et.workspace.id),_v),Xn=V[et.workspace.id];let on=DC((Xn==null?void 0:Xn.detail)??Wt??MC(et.workspace),et.workspace);(qt!=null&&qt.status||qt!=null&&qt.branches)&&(on=FC(on,{workspaceId:et.workspace.id,status:qt.status??null,branches:qt.branches??null})),V[et.workspace.id]={detail:on,loading:!1,error:null}});const Ne=Object.keys(j),Le=Object.keys(V);return Ne.length===Le.length&&Le.every(et=>j[et]===V[et])?j:V})},[e]);const oe=b.useCallback(async j=>{await g(),await re.bridge.showNotification(u("shell.importSuccess"),j.path)},[g,re.bridge]),de=b.useCallback(async j=>{await g(),await re.bridge.showNotification(u("shell.cloneSuccess"),j.path)},[g,re.bridge]);function Se(j){if(ze.includes(j)){yt(V=>V.filter(Ne=>Ne!==j));return}yt(V=>[...V,j]),ee(j),q(j),_(j),E(j)}async function je(){if(!(!ft||Ke)){jt(ft.id);try{await sC(ft.id),yt(j=>j.filter(se=>se!==ft.id)),G(j=>{const se={...j};return delete se[ft.id],se}),Ot(null),await g(),R({title:u("shell.manageWorkspaceRemoveSuccess"),tone:"success"})}catch(j){R({title:j instanceof Error?j.message:u("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{jt(null)}}}b.useEffect(()=>{if(!lt)return;function j(se){const V=se.target;V instanceof HTMLElement&&(V.closest(".workbench-session-actions")||V.closest(".workbench-session-menu"))||gt(null)}return window.addEventListener("pointerdown",j),()=>{window.removeEventListener("pointerdown",j)}},[lt]),b.useEffect(()=>{if(!Nt){ie.length>0&&Ie([]);return}if(!it){Zt(null),Ie([]);return}Ie(j=>IC(j,Tn))},[it,Tn,Nt,ie.length]),b.useEffect(()=>{Nt&&rn.length===0&&(Zt(null),Ie([]))},[rn.length,Nt]),b.useEffect(()=>{const j=new Set(e.map(se=>se.workspace.id));yt(se=>se.filter(V=>j.has(V))),Ot(se=>se&&j.has(se.id)?se:null)},[e]),b.useEffect(()=>{const j=t.findIndex(se=>se.session.sessionId===y);nt(se=>{const V=cf(t.length,lf,se,j);return V===se?se:V})},[y,t]),b.useEffect(()=>{ge(j=>{const se={};for(const V of e){const Ne=el(V),Le=Ne.findIndex(et=>et.session.sessionId===y||so(et).some(Wt=>Wt.sessionId===y));se[V.workspace.id]=cf(Ne.length,Yc,j[V.workspace.id],Le)}return qv(j,se)?j:se})},[y,e]),b.useEffect(()=>{qe(j=>{const se={};for(const V of e)for(const Ne of el(V)){const Le=so(Ne);if(Le.length===0)continue;const et=Le.findIndex(Wt=>Wt.sessionId===y);se[Ne.session.sessionId]=cf(Le.length,Xc,j[Ne.session.sessionId],et)}return qv(j,se)?j:se})},[y,e]),b.useEffect(()=>{if(!y)return;const j=e.flatMap(se=>el(se).filter(V=>so(V).some(Ne=>Ne.sessionId===y)).map(V=>V.session.sessionId));j.length!==0&&St(se=>{const V=new Set(se);let Ne=!1;for(const Le of j)V.has(Le)||(V.add(Le),Ne=!0);return Ne?Array.from(V):se})},[y,e]);function $e(){F(!0)}function Ye(){ce(!0)}function Ee(j){return Te[j]??Xc}function Ue(j){return dt.includes(j)}function ne(j){return fe[j]??Yc}function xe(){nt(j=>Math.min(t.length,j+lf))}function Ze(j,se){ge(V=>({...V,[j]:Math.min(se,(V[j]??Yc)+Yc)}))}function ot(j){qe(se=>({...se,[j]:(se[j]??Xc)+Xc}))}function It(j){St(se=>se.includes(j)?se.filter(V=>V!==j):[...se,j])}function Ct(j){for(const se of e){const V=EC(se.visibleSessions).find(Ne=>Ne.session.sessionId===j);if(V)return so(V)}return[]}function Pt(j){gt(null),Zt(j),Ie([])}function $t(){Zt(null),Ie([])}function me(j){Ie(se=>km(se,j))}function We(){Ie(j=>j.length===rn.length?[]:rn)}async function Qe(j,se){Mt(j),Dt(se);try{ye(null),D(BS(j,se)),Y==null||Y()}catch(V){R({title:V instanceof Error?V.message:u("shell.startSessionFailed"),tone:"error"})}finally{Mt(null),Dt(null)}}async function Be(j){const se=n.has(j);gt(null);try{await M(j),R({title:u(se?"shell.favoriteRemoved":"shell.favoriteAdded"),tone:"success"})}catch(V){R({title:V instanceof Error?V.message:u("shell.favoriteToggleFailed"),tone:"error"})}}async function Xt(j){gt(null);try{await I(j),R({title:u("shell.archiveAdded"),tone:"success"})}catch(se){R({title:se instanceof Error?se.message:u("shell.navigationLoadFailed"),tone:"error"})}}async function Ht(){if(!(ie.length===0||ct)){gt(null),zt(!0);try{const j=[...ie],se=await Promise.allSettled(j.map(async Le=>({sessionId:Le,session:await lC(Le,!0)}))),V=[];let Ne=0;for(const Le of se){if(Le.status==="fulfilled"){V.push(Le.value.sessionId),w(Le.value.session);continue}Ne+=1}V.length>0&&(await g(),Ie(Le=>Le.filter(et=>!V.includes(et)))),Ne>0?R({title:V.length>0?u("shell.batchArchivePartialFailed"):u("shell.batchArchiveFailed"),tone:"error"}):R({title:u("shell.batchArchiveSuccess"),tone:"success"})}catch(j){R({title:j instanceof Error?j.message:u("shell.batchArchiveFailed"),tone:"error"})}finally{zt(!1)}}}async function K(j){gt(null);try{await N(j),R({title:u("shell.archiveRestored"),tone:"success"})}catch(se){R({title:se instanceof Error?se.message:u("shell.navigationLoadFailed"),tone:"error"})}}function Ce(j,se){gt(null),Ut({session:j,workspace:se}),Bt(j.title)}async function Xe(j){if(j.preventDefault(),!rt)return;const se=mt.trim();if(se){vt(rt.session.sessionId);try{const V=await aC(rt.session.sessionId,se);w(V),Ut(null),Bt(""),R({title:u("shell.renameSuccess"),tone:"success"})}catch(V){R({title:V instanceof Error?V.message:u("shell.renameFailed"),tone:"error"})}finally{vt(null)}}}async function Ge(j){if(!re.isDesktop)return;const se=n.has(j.session.sessionId);await rA([{id:`open-${j.session.sessionId}`,label:u("shell.contextOpenSession"),onSelect:()=>{D(Bn(j.workspace.id,j.session.sessionId)),Y==null||Y()}},{id:`rename-${j.session.sessionId}`,label:u("shell.renameAction"),onSelect:()=>Ce(j.session,j.workspace)},{id:`favorite-${j.session.sessionId}`,label:u(se?"shell.unfavoriteAction":"shell.favoriteAction"),onSelect:()=>Be(j.session.sessionId)},{id:`archive-${j.session.sessionId}`,label:u("shell.archiveAction"),onSelect:()=>{Xt(j.session.sessionId)}}])}const ut=t.slice(0,Lt),dn=ut.length<t.length;return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"workbench-nav-header","data-window-drag-handle":"workbench-nav-header",onMouseDownCapture:$,children:r.jsxs("div",{className:"workbench-nav-toolbar",children:[Q?r.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":u("shell.hideSessionSidebar"),title:u("shell.hideSessionSidebar"),onClick:Q,children:r.jsx(UC,{})}):null,r.jsx(OC,{unreadCount:J,open:B,onToggle:W}),r.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":u("shell.goBack"),title:u("shell.goBack"),onClick:()=>D(-1),children:r.jsx(BC,{})}),r.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":u("shell.goForward"),title:u("shell.goForward"),onClick:()=>D(1),children:r.jsx(Np,{})})]})}),r.jsxs("div",{className:"workbench-nav-body",children:[r.jsxs("div",{className:"workbench-nav-segment",role:"tablist","aria-label":u("shell.centerTabsLabel"),children:[r.jsxs("button",{type:"button",className:a?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":a,onClick:x,children:[r.jsx(OL,{}),u("shell.conversationEntry")]}),r.jsxs("button",{type:"button",className:c?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":c,onClick:S,children:[r.jsx(BL,{}),u("shell.terminalsEntry")]}),r.jsxs("button",{type:"button",className:l?"workbench-nav-segment-button active":"workbench-nav-segment-button",role:"tab","aria-selected":l,onClick:C,children:[r.jsx(UL,{}),u("shell.butlerEntry")]}),r.jsxs("button",{type:"button",className:"workbench-nav-segment-button","data-open":h,"aria-haspopup":"dialog","aria-expanded":h,onClick:P,children:[r.jsx(_L,{}),r.jsx("span",{children:u("shell.searchEntry")})]})]}),p?r.jsx("div",{className:"workbench-status-row",children:r.jsx("p",{className:"status-text","data-tone":"error",children:p})}):null,t.length>0?r.jsxs("section",{className:"workbench-section-block",children:[r.jsxs("div",{className:"workbench-section-heading",children:[r.jsxs("div",{className:"workbench-section-heading-main",children:[r.jsx(WC,{active:!0}),r.jsx("span",{children:u("shell.favoriteSectionTitle")})]}),r.jsx("span",{className:"workbench-section-counter",children:t.length})]}),r.jsxs("div",{className:"workbench-session-list",children:[ut.map(j=>{const se=Ct(j.session.sessionId),V=Ue(j.session.sessionId),Ne=V?se.slice(0,Ee(j.session.sessionId)):[],Le=V&&Ne.length<se.length;return r.jsxs("div",{className:"workbench-session-tree-node",children:[r.jsx(eu,{menuKey:`favorite:${j.session.sessionId}`,session:j.session,workspace:j.workspace,isActive:j.session.sessionId===y,isFavorite:n.has(j.session.sessionId),menuOpen:lt===`favorite:${j.session.sessionId}`,showWorkspaceName:!0,hasSubagents:se.length>0,subagentListExpanded:V,onToggleSubagents:()=>It(j.session.sessionId),onOpen:()=>{D(Bn(j.workspace.id,j.session.sessionId)),Y==null||Y()},onRename:()=>Ce(j.session,j.workspace),onToggleMenu:()=>gt(et=>et===`favorite:${j.session.sessionId}`?null:`favorite:${j.session.sessionId}`),onToggleFavorite:()=>Be(j.session.sessionId),onArchive:()=>Xt(j.session.sessionId),onCloseMenu:()=>gt(null),onContextMenu:re.isDesktop?()=>{Ge(j)}:void 0}),se.length>0&&V?r.jsxs("div",{className:"workbench-subsession-list",children:[Ne.map(et=>r.jsx(eu,{menuKey:`favorite:${et.sessionId}`,session:et,workspace:j.workspace,isActive:et.sessionId===y,isFavorite:!1,menuOpen:!1,showWorkspaceName:!0,depth:1,showActions:!1,onOpen:()=>{D(Bn(j.workspace.id,et.sessionId)),Y==null||Y()},onRename:()=>{},onToggleMenu:()=>{},onToggleFavorite:()=>{},onArchive:()=>{},onCloseMenu:()=>{},onContextMenu:re.isDesktop?()=>{Ge({session:et,workspace:j.workspace})}:void 0},et.sessionId)),Le?r.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>ot(j.session.sessionId),children:u("shell.subagentExpandMore")}):null]}):null]},j.session.sessionId)}),dn?r.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:xe,children:u("shell.favoriteExpandMore")}):null]})]}):null,f&&e.length===0?r.jsx(EL,{}):null,!f&&!p&&e.length===0?r.jsx("div",{className:"workbench-empty-state minimal",children:r.jsx("p",{children:u("shell.emptyNavigationBody")})}):null,r.jsxs("section",{className:"workbench-section-block workbench-workspace-section",children:[r.jsxs("div",{className:"workbench-section-heading",children:[r.jsx("div",{className:"workbench-section-heading-main",children:r.jsx("span",{children:u("shell.workspaceSectionTitle")})}),r.jsxs("div",{className:"workbench-section-actions",children:[r.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":u("shell.manageWorkspaceAction"),title:u("shell.manageWorkspaceAction"),onClick:()=>Ve(!0),children:r.jsx(LL,{})}),r.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":u("shell.importWorkspaceTitle"),title:u("shell.importWorkspaceTitle"),onClick:$e,children:r.jsx(IL,{})}),r.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":u("shell.cloneWorkspaceTitle"),title:u("shell.cloneWorkspaceTitle"),onClick:Ye,children:r.jsx(WL,{})})]})]}),e.map(j=>{const se=el(j);return r.jsxs("section",{className:"workbench-workspace-group","data-batch-active":Nt===j.workspace.id,children:[r.jsxs("div",{className:"workbench-workspace-header minimal",children:[r.jsxs("button",{type:"button",className:"workbench-workspace-toggle","aria-label":j.isCollapsed?u("shell.workspaceExpand"):u("shell.workspaceCollapse"),onClick:()=>O(j.workspace.id),children:[r.jsx(Zv,{expanded:!j.isCollapsed}),r.jsx("strong",{children:j.workspace.name})]}),Nt===j.workspace.id?r.jsxs("div",{className:"workbench-workspace-batch-toolbar",children:[r.jsx("span",{className:"workbench-workspace-batch-label",children:u("shell.batchSelectionMode")}),r.jsxs("span",{className:"workbench-workspace-batch-counter",children:[ie.length,"/",rn.length]}),r.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:We,children:u(X?"shell.clearSelectedSessions":"shell.selectAllSessions")}),r.jsx("button",{type:"button",className:"workbench-workspace-batch-action primary",disabled:ie.length===0||ct,onClick:()=>{Ht()},children:u(ct?"shell.batchArchiving":"shell.batchArchiveAction")}),r.jsx("button",{type:"button",className:"workbench-workspace-batch-action",onClick:$t,children:u("common.cancel")})]}):r.jsxs("div",{className:"workbench-workspace-actions",children:[r.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":u("shell.switchWorkspace"),title:u("shell.switchWorkspace"),"aria-pressed":i===j.workspace.id,onClick:()=>{L(j.workspace.id),Y==null||Y()},children:r.jsx(qL,{})}),r.jsx("button",{type:"button",className:"workbench-workspace-icon-button","aria-label":u("shell.batchSelectSessions"),title:u("shell.batchSelectSessions"),onClick:()=>Pt(j.workspace.id),children:r.jsx(HL,{})}),r.jsx("button",{type:"button",className:"workbench-workspace-icon-button workbench-workspace-create","aria-label":u("shell.createSession"),title:u("shell.createSession"),onClick:()=>ye(j.workspace.id),children:r.jsx(FL,{})})]})]}),j.isCollapsed?null:r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"workbench-session-list",children:[se.length===0?r.jsx("p",{className:"workbench-session-empty",children:u("shell.emptyWorkspaceSessions")}):se.slice(0,ne(j.workspace.id)).map(V=>{const Ne=so(V),Le=Ue(V.session.sessionId),et=Le?Ne.slice(0,Ee(V.session.sessionId)):[],Wt=Le&&et.length<Ne.length;return r.jsxs("div",{className:"workbench-session-tree-node",children:[r.jsx(eu,{menuKey:`workspace:${j.workspace.id}:${V.session.sessionId}`,session:V.session,workspace:j.workspace,isActive:V.session.sessionId===y,isFavorite:n.has(V.session.sessionId),menuOpen:lt===`workspace:${j.workspace.id}:${V.session.sessionId}`,showWorkspaceName:!1,hasSubagents:Ne.length>0,subagentListExpanded:Le,selectionMode:Nt===j.workspace.id,selected:un.has(V.session.sessionId),onToggleSelect:()=>me(V.session.sessionId),onToggleSubagents:()=>It(V.session.sessionId),onOpen:()=>{D(Bn(j.workspace.id,V.session.sessionId)),Y==null||Y()},onRename:()=>Ce(V.session,j.workspace),onToggleMenu:()=>gt(qt=>qt===`workspace:${j.workspace.id}:${V.session.sessionId}`?null:`workspace:${j.workspace.id}:${V.session.sessionId}`),onToggleFavorite:()=>Be(V.session.sessionId),onArchive:()=>Xt(V.session.sessionId),onCloseMenu:()=>gt(null),onContextMenu:re.isDesktop?()=>{Ge({session:V.session,workspace:j.workspace})}:void 0}),Ne.length>0&&Le?r.jsxs("div",{className:"workbench-subsession-list",children:[et.map(qt=>r.jsx(eu,{menuKey:`workspace:${j.workspace.id}:${qt.sessionId}`,session:qt,workspace:j.workspace,isActive:qt.sessionId===y,isFavorite:!1,menuOpen:!1,showWorkspaceName:!1,depth:1,showActions:!1,selectionMode:Nt===j.workspace.id,selected:un.has(qt.sessionId),onToggleSelect:()=>me(qt.sessionId),onOpen:()=>{D(Bn(j.workspace.id,qt.sessionId)),Y==null||Y()},onRename:()=>{},onToggleMenu:()=>{},onToggleFavorite:()=>{},onArchive:()=>{},onCloseMenu:()=>{},onContextMenu:re.isDesktop?()=>{Ge({session:qt,workspace:j.workspace})}:void 0},qt.sessionId)),Wt?r.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>ot(V.session.sessionId),children:u("shell.subagentExpandMore")}):null]}):null]},V.session.sessionId)}),se.length>ne(j.workspace.id)?r.jsx("button",{type:"button",className:"workbench-subsession-expand ghost-button",onClick:()=>Ze(j.workspace.id,se.length),children:u("shell.sessionExpandMore")}):null]}),r.jsxs("button",{type:"button",className:"workbench-archive-folder",onClick:()=>kt(j.workspace.id),children:[r.jsxs("span",{className:"workbench-archive-folder-main",children:[r.jsx(KL,{}),r.jsx("span",{children:u("shell.archiveFolderLabel")})]}),r.jsx("span",{className:"workbench-section-counter",children:j.archivedSessions.length})]})]})]},j.workspace.id)})]})]}),r.jsx("div",{className:"workbench-nav-footer minimal",children:r.jsxs("button",{className:"settings-entry-button workbench-nav-settings-button",type:"button",onClick:A,title:u("settings.title"),children:[r.jsx(zL,{}),r.jsx("span",{className:"settings-entry-label",children:u("settings.title")})]})}),r.jsx(Un,{open:be,title:u("shell.manageWorkspaceTitle"),description:u("shell.manageWorkspaceDescription"),onClose:()=>{Ke||Ve(!1)},children:e.length>0?r.jsx("div",{className:"workbench-manage-list",children:e.map(j=>{var Xn;const se=ze.includes(j.workspace.id),V=z[j.workspace.id]??{detail:null,loading:!1,error:null},Ne=Ke===j.workspace.id,Le=(Xn=V.detail)!=null&&Xn.git.remotes.length?V.detail.git.remotes.map(on=>`${on.name}: ${on.url}`).join(" · "):u("shell.manageWorkspaceNoRemote"),et=j.visibleSessions.length+j.archivedSessions.length,Wt=V.detail?wC(V.detail.codeComposition.items,u("shell.manageWorkspaceCodeCompositionOther")):[],qt=Wt.length>0?xC(Wt):void 0;return r.jsxs("article",{className:"workbench-manage-item",children:[r.jsxs("button",{type:"button",className:"workbench-manage-item-toggle","aria-expanded":se,onClick:()=>Se(j.workspace.id),children:[r.jsxs("span",{className:"workbench-manage-item-heading",children:[r.jsx(Zv,{expanded:se}),r.jsx("strong",{children:j.workspace.name})]}),r.jsx("span",{className:"workbench-section-counter",children:et})]}),se?r.jsxs("div",{className:"workbench-manage-item-body",children:[r.jsxs("div",{className:"workbench-manage-detail-block",children:[r.jsx("span",{className:"workbench-manage-detail-label",children:u("shell.manageWorkspacePathLabel")}),r.jsx("p",{className:"workbench-manage-detail-value",children:j.workspace.path})]}),V.loading&&V.detail===null?r.jsx("p",{className:"workbench-manage-status status-text",children:u("shell.manageWorkspaceLoading")}):null,V.error?r.jsx("p",{className:"workbench-manage-status status-text","data-tone":"error",children:V.error}):null,V.detail?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"workbench-manage-detail-block",children:r.jsxs("div",{className:"workbench-manage-detail-header",children:[r.jsx("span",{className:"workbench-manage-detail-label",children:u("shell.manageWorkspaceGitCommitCount")}),r.jsx("strong",{className:"workbench-manage-detail-accent",children:V.detail.git.commitCount??"--"})]})}),r.jsxs("div",{className:"workbench-manage-detail-block",children:[r.jsx("span",{className:"workbench-manage-detail-label",children:u("shell.manageWorkspaceGitInfoLabel")}),V.detail.git.isRepository?r.jsxs("div",{className:"workbench-manage-kv-list",children:[r.jsxs("div",{className:"workbench-manage-kv-item",children:[r.jsx("span",{children:u("shell.manageWorkspaceRepoRoot")}),r.jsx("span",{children:V.detail.git.repoRoot??"--"})]}),r.jsxs("div",{className:"workbench-manage-kv-item",children:[r.jsx("span",{children:u("shell.manageWorkspaceCurrentBranch")}),r.jsx("span",{children:V.detail.git.currentBranch??"--"})]}),r.jsxs("div",{className:"workbench-manage-kv-item",children:[r.jsx("span",{children:u("shell.manageWorkspaceRemoteLabel")}),r.jsx("span",{children:Le})]})]}):r.jsx("p",{className:"workbench-section-empty",children:V.detail.git.error??u("shell.manageWorkspaceNotGit")})]}),r.jsxs("div",{className:"workbench-manage-detail-block",children:[r.jsx("span",{className:"workbench-manage-detail-label",children:u("shell.manageWorkspaceCodeCompositionLabel")}),Wt.length>0?r.jsxs("div",{className:"workbench-manage-type-chart",children:[r.jsxs("div",{className:"workbench-manage-type-chart-ring",style:qt,"aria-hidden":"true",children:[r.jsx("strong",{className:"workbench-manage-type-chart-total",children:V.detail.codeComposition.scannedFileCount}),r.jsx("span",{className:"workbench-manage-type-chart-caption",children:u("shell.manageWorkspaceCodeCompositionFiles")})]}),r.jsx("div",{className:"workbench-manage-type-list",children:Wt.map(on=>r.jsxs("div",{className:"workbench-manage-type-item",children:[r.jsxs("span",{className:"workbench-manage-type-meta",children:[r.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:on.color},"aria-hidden":"true"}),r.jsx("span",{className:"workbench-manage-type-name",children:on.type})]}),r.jsxs("span",{children:[on.count," · ",vC(on)]})]},on.key))})]}):r.jsx("p",{className:"workbench-section-empty",children:V.detail.codeComposition.error??u("shell.manageWorkspaceNoCodeComposition")}),V.detail.codeComposition.truncated?r.jsx("p",{className:"workbench-manage-hint",children:u("shell.manageWorkspaceCodeTruncated",{count:V.detail.codeComposition.scannedFileCount})}):null]})]}):null,r.jsx("div",{className:"workbench-modal-actions",children:r.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!Ke,onClick:()=>Ot(j.workspace),children:u(Ne?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})})]}):null]},j.workspace.id)})}):r.jsx("p",{className:"workbench-section-empty",children:u("shell.manageWorkspaceEmpty")})}),r.jsxs(Un,{open:ft!==null,title:u("shell.manageWorkspaceRemoveConfirmTitle"),description:u("shell.manageWorkspaceRemoveConfirmDescription"),onClose:()=>{Ke||Ot(null)},children:[r.jsx("p",{className:"workbench-section-empty",children:ft?u("shell.manageWorkspaceRemoveConfirmTarget",{name:ft.name}):""}),r.jsxs("div",{className:"workbench-modal-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:!!Ke,onClick:()=>Ot(null),children:u("common.cancel")}),r.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:!!Ke,onClick:()=>{je()},children:u(Ke?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveConfirmAction")})]})]}),r.jsx(jC,{open:we,onClose:()=>ce(!1),onCloned:de}),r.jsx(PC,{open:Z,onClose:()=>F(!1),onImported:oe}),r.jsx(Un,{open:nn!==null,title:u("shell.createSessionModalTitle"),className:"workbench-create-session-modal",description:nn?`${u("shell.createSessionTarget")} · ${nn.name}`:u("shell.createSessionModalDescription"),onClose:()=>ye(null),children:r.jsx(CC,{disabled:!!pt,pendingProvider:pt===(nn==null?void 0:nn.id)?xt??null:null,onSelect:j=>{nn&&Qe(nn.id,j)}})}),r.jsx(Un,{open:ke!==null,title:u("shell.archiveModalTitle"),description:ke?`${ke.workspace.name} · ${u("shell.archiveModalDescription")}`:u("shell.archiveModalDescription"),onClose:()=>kt(null),children:ke&&ke.archivedSessions.length>0?r.jsx("div",{className:"workbench-archive-list",children:ke.archivedSessions.map(j=>{const se=Ps(j.title,u("common.unknown"));return r.jsxs("article",{className:"workbench-archive-item",children:[r.jsxs("div",{className:"workbench-archive-item-main",children:[r.jsx("strong",{title:se.fullTitle,children:se.displayTitle}),r.jsxs("p",{children:[AC(j,ke.workspace,!1)," ·"," ",ud(j.provider)]})]}),r.jsx("button",{type:"button",className:"secondary-button",onClick:()=>K(j.sessionId),children:u("shell.unarchiveAction")})]},j.sessionId)})}):r.jsx("p",{className:"workbench-section-empty",children:u("shell.archiveEmpty")})}),r.jsx(Un,{open:rt!==null,title:u("shell.renameModalTitle"),description:u("shell.renameModalDescription"),onClose:()=>{At||(Ut(null),Bt(""))},children:r.jsxs("form",{className:"workbench-rename-form",onSubmit:Xe,children:[r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("shell.renameInputLabel")}),r.jsx("input",{type:"text",value:mt,placeholder:u("shell.renameInputPlaceholder"),maxLength:120,autoFocus:!0,onChange:j=>Bt(j.target.value)})]}),r.jsxs("div",{className:"workbench-modal-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:!!At,onClick:()=>{Ut(null),Bt("")},children:u("common.cancel")}),r.jsx("button",{type:"submit",className:"primary-button",disabled:!mt.trim()||At===(rt==null?void 0:rt.session.sessionId),children:At===(rt==null?void 0:rt.session.sessionId)?u("shell.renamingSession"):u("common.save")})]})]})})]})}function tw({panelReady:e,activeTab:t,fileRevealRequest:n,onTabChange:i,onToggleCollapse:a,currentSessionId:c,activeWorkspaceId:l,navigationGroups:h}){var E;const f=l??((E=h[0])==null?void 0:E.workspace.id)??null,p=zn(),{showToast:y}=En(),g=b.useRef(null),w=b.useRef(null),x=p.isDesktop&&p.bridge.supported,S=x&&!!l,C=x&&!!f,P=x&&!!f,A=typeof globalThis<"u"&&"PointerEvent"in globalThis,L=b.useCallback(async(M,I,N)=>{if(M==="files"){const G=await mA(p,{workspaceId:I,sessionId:N,focusOwner:"file-context-panel"});G.ok||y({title:G.detail??u("conversation.filePanelOpenExternalFailed"),tone:"error"});return}if(M==="git"){const G=await pA(p,{workspaceId:I,focusOwner:"git-sidebar"});G.ok||y({title:G.detail??u("git.openExternalFailed"),tone:"error"});return}const z=await gA(p,{workspaceId:I,focusOwner:"terminal-manager-panel"});z.ok||y({title:z.detail??u("terminalManager.openExternalFailed"),tone:"error"})},[p,y]),O=b.useCallback((M,I)=>{if(M.button!==0||!x)return;const N=I==="files"?l:I==="git"||I==="terminals"?f:null;if(!N)return;const z=I==="files"?c:null;g.current={tab:I,startX:M.clientX,startY:M.clientY,workspaceId:N,sessionId:z,detached:!1,preview:null};const G=Y=>{var R;const Q=g.current;if(!Q)return;const D=Math.abs(Y.clientX-Q.startX),re=Math.abs(Y.clientY-Q.startY);!Q.detached&&Math.max(D,re)<Bv||(Q.detached||(Q.detached=!0,w.current=Q.tab,Q.preview=gv({title:Q.tab==="files"?u("shell.filesEntry"):Q.tab==="git"?u("shell.gitEntry"):u("shell.terminalManagerEntry"),x:Y.clientX,y:Y.clientY})),(R=Q.preview)==null||R.updatePosition(Y.clientX,Y.clientY))},J=Y=>{var D;const Q=(D=g.current)==null?void 0:D.preview;Y&&(Q==null||Q.cancel()),window.removeEventListener("mousemove",G),window.removeEventListener("mouseup",B),window.removeEventListener("blur",W),g.current=null},B=async()=>{var Q;const Y=g.current;J(!1),Y!=null&&Y.detached&&(await((Q=Y.preview)==null?void 0:Q.complete()),await L(Y.tab,Y.workspaceId,Y.sessionId))},W=()=>{J(!0)};window.addEventListener("mousemove",G),window.addEventListener("mouseup",B),window.addEventListener("blur",W)},[l,x,c,f,L]),ee=b.useCallback((M,I)=>{if(M.button!==0||!x)return;const N=I==="files"?l:I==="git"||I==="terminals"?f:null;if(!N)return;const z=M.currentTarget,G=M.pointerId;z.setPointerCapture(G);const J=I==="files"?c:null;g.current={tab:I,startX:M.clientX,startY:M.clientY,workspaceId:N,sessionId:J,detached:!1,preview:null};const B=re=>{var F;if(re.pointerId!==G)return;const R=g.current;if(!R)return;const $=Math.abs(re.clientX-R.startX),Z=Math.abs(re.clientY-R.startY);!R.detached&&Math.max($,Z)<Bv||(R.detached||(R.detached=!0,w.current=R.tab,R.preview=gv({title:R.tab==="files"?u("shell.filesEntry"):R.tab==="git"?u("shell.gitEntry"):u("shell.terminalManagerEntry"),x:re.clientX,y:re.clientY})),(F=R.preview)==null||F.updatePosition(re.clientX,re.clientY))},W=re=>{var $;const R=($=g.current)==null?void 0:$.preview;re&&(R==null||R.cancel()),z.removeEventListener("pointermove",B),z.removeEventListener("pointerup",Y),z.removeEventListener("pointercancel",Q),z.removeEventListener("lostpointercapture",Q),window.removeEventListener("blur",D),g.current=null,z.hasPointerCapture(G)&&z.releasePointerCapture(G)},Y=async re=>{var $;if(re.pointerId!==G)return;const R=g.current;W(!1),R!=null&&R.detached&&(await(($=R.preview)==null?void 0:$.complete()),await L(R.tab,R.workspaceId,R.sessionId))},Q=re=>{re.pointerId===G&&W(!0)},D=()=>{W(!0)};z.addEventListener("pointermove",B),z.addEventListener("pointerup",Y),z.addEventListener("pointercancel",Q),z.addEventListener("lostpointercapture",Q),window.addEventListener("blur",D)},[l,x,c,f,L]),q=b.useCallback(M=>{if(w.current===M){w.current=null;return}i(M)},[i]),_=b.useCallback(M=>{!p.isDesktop||p.ui.osFamily!=="macos"||M.button!==0||xp(M.target)&&kp()},[p.isDesktop,p.ui.osFamily]);return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"workbench-auxiliary-header","data-window-drag-handle":"workbench-auxiliary-header",onMouseDownCapture:_,children:[a?r.jsx("button",{type:"button",className:"workbench-nav-toolbar-button","aria-label":u("shell.hideInfoSidebar"),title:u("shell.hideInfoSidebar"),onClick:a,children:r.jsx(UC,{})}):null,r.jsxs("div",{className:"workbench-info-tabs",role:"tablist","aria-label":u("shell.infoTabsLabel"),children:[r.jsx("button",{className:t==="files"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="files",title:S?"拖拽标签到独立窗口":void 0,onPointerDown:M=>ee(M,"files"),onMouseDown:A?void 0:M=>O(M,"files"),onClick:()=>q("files"),children:u("shell.filesEntry")}),r.jsx("button",{className:t==="git"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="git",title:C?"拖拽标签到独立窗口":void 0,onPointerDown:M=>ee(M,"git"),onMouseDown:A?void 0:M=>O(M,"git"),onClick:()=>q("git"),children:u("shell.gitEntry")}),r.jsx("button",{className:t==="terminals"?"workbench-info-tab active":"workbench-info-tab",type:"button",role:"tab","aria-selected":t==="terminals",title:P?"拖拽标签到独立窗口":void 0,onPointerDown:M=>ee(M,"terminals"),onMouseDown:A?void 0:M=>O(M,"terminals"),onClick:()=>q("terminals"),children:u("shell.terminalManagerEntry")})]})]}),r.jsxs("div",{className:"workbench-auxiliary-body",children:[e?null:r.jsx(Zc,{}),e&&t==="files"?l?r.jsx(b.Suspense,{fallback:r.jsx(Zc,{}),children:r.jsx(cL,{sessionId:c,workspaceId:l,externalRevealRequest:n})}):r.jsx("section",{className:"workbench-empty-state minimal",children:r.jsx("p",{children:u("shell.filesPanelEmpty")})}):null,e&&t==="git"?f?r.jsx(b.Suspense,{fallback:r.jsx(Zc,{}),children:r.jsx(uL,{workspaceId:f})}):r.jsx("section",{className:"workbench-empty-state minimal",children:r.jsx("p",{children:u("shell.gitPanelEmpty")})}):null,e&&t==="terminals"?r.jsx(b.Suspense,{fallback:r.jsx(Zc,{}),children:r.jsx(dL,{currentWorkspaceId:l,navigationGroups:h})}):null]})]})}function JL({shellMode:e="desktop"}){var _s,Os,Ca;const t=Qr(),n=Wn(),i=zn(),{showToast:a}=En(),c=Hi(U=>U.notificationPreferences.notifyOnPermissionRequest),l=Hi(U=>U.notificationPreferences.notifyOnSessionCompleted),h=Hi(U=>U.notificationPreferences.notifyOnSessionFailed),f=b.useRef(PL()),p=b.useRef(0),y=b.useRef((((Os=(_s=f.current)==null?void 0:_s.items)==null?void 0:Os.length)??0)>0),g=b.useRef(new Map),w=b.useRef(!1),x=b.useRef(null),S=b.useRef(0),C=b.useRef(null),P=b.useRef(null),A=b.useRef(new Set),L=b.useRef(new Set),O=b.useRef(new Set),ee=b.useRef(new Set),q=b.useRef(null),_=b.useRef(null),E=b.useRef(null),M=b.useRef(null),I=b.useRef(null),N=b.useRef(null),z=b.useRef(null),G=b.useRef(null),J=b.useRef(0),B=b.useRef(0),W=b.useRef(a),Y=b.useRef(i.bridge),Q=b.useRef(!1),D=b.useRef(new Map),re=b.useRef(!1),R=b.useRef(new Map),$=b.useRef([]),[Z,F]=b.useState(()=>Qv(f.current)),[we,ce]=b.useState(()=>{var U,le;return(((le=(U=f.current)==null?void 0:U.items)==null?void 0:le.length)??0)===0}),[be,Ve]=b.useState(null),[ze,yt]=b.useState(()=>Jc(Vv(Rv,zI),Qc,Dv)),[ft,Ot]=b.useState(()=>Jc(Vv(Ev,HI),Qc,Fv)),[Ke,jt]=b.useState(()=>Gv(Av,!1)),[pt,Mt]=b.useState(()=>Gv(Iv,!1)),[xt,Dt]=b.useState(()=>xL(Lv)),[wt,ye]=b.useState(()=>Kv(af)),[Fe,kt]=b.useState(!1),[lt,gt]=b.useState("files"),[Lt,nt]=b.useState(!1),[fe,ge]=b.useState(!1),[Te,qe]=b.useState(null),[dt,St]=b.useState({}),[rt,Ut]=b.useState(!1),[mt,Bt]=b.useState("sessions"),[At,vt]=b.useState(""),[Nt,Zt]=b.useState(""),[ie,Ie]=b.useState(!1),[ct,zt]=b.useState(null),[nn,ke]=b.useState([]),[it,Qt]=b.useState(null),[rn,Tn]=b.useState({}),[un,X]=b.useState([]),[oe,de]=b.useState(()=>new Set),[Se,je]=b.useState(!1),[$e,Ye]=b.useState(!1),[Ee,Ue]=b.useState(()=>Kv(Mv));b.useEffect(()=>{W.current=a},[a]),b.useEffect(()=>{Y.current=i.bridge},[i.bridge]);const ne=b.useCallback(async()=>{const U=J.current+1;J.current=U;try{const le=await ld();if(U!==J.current)return;if(!le.initialized){X([]),de(new Set);return}const[_e,tt,Yt]=await Promise.all([cd(),Sl(),TI()]);if(U!==J.current)return;X(ZI(_e.overview,tt.items)),de(new Set(Yt.items.map(bn=>bn.notificationId)))}catch{if(U!==J.current)return;X([]),de(new Set)}},[]),xe=b.useCallback(U=>{const le=U.map(_e=>_e.createdAt).sort((_e,tt)=>Ss(tt)-Ss(_e))[0]??null;le&&Ue(_e=>_e&&Ss(_e)>=Ss(le)?_e:le)},[]);b.useEffect(()=>{Ee&&hs(Mv,Ee)},[Ee]),b.useEffect(()=>{ne();const U=window.setInterval(()=>{ne()},$I);return()=>{window.clearInterval(U)}},[ne]),b.useEffect(()=>{_t("workbench.layout_mounted",{path:t.pathname,search:t.search})},[t.pathname,t.search]),b.useEffect(()=>{var U,le;_t("workbench.cached_snapshot_loaded",{cached:!!f.current,workspaceCount:((U=f.current)==null?void 0:U.items.length)??0,sessionCount:((le=f.current)==null?void 0:le.items.reduce((_e,tt)=>_e+tt.sessions.length,0))??0})},[]);function Ze(U){var _e;if(!U||!Array.isArray(U.items))return;NL(g.current,U);const le=jL(U,g.current);_t("workbench.apply_snapshot",{workspaceCount:le.items.length,sessionCount:le.items.reduce((tt,Yt)=>tt+Yt.sessions.length,0),currentSessionId:((_e=fl(t.pathname))==null?void 0:_e.sessionId)??null}),Fr(TC,le),F(Qv(le)),Ve(null)}const ot=b.useCallback(async()=>{const U=p.current+1;p.current=U,ce(le=>le||!y.current),_t("workbench.refresh_navigation.start",{requestId:U,hasNavigationData:y.current});try{const le=await iC();if(U!==p.current){_t("workbench.refresh_navigation.stale",{requestId:U});return}Ze(le)}catch(le){if(U!==p.current)return;Ve(le instanceof Error?le.message:u("shell.navigationLoadFailed")),W.current({title:le instanceof Error?le.message:u("shell.navigationLoadFailed"),tone:"error"})}finally{_t("workbench.refresh_navigation.end",{requestId:U,success:U===p.current}),U===p.current&&ce(!1)}},[]),It=b.useCallback(U=>{F(le=>TL(le,U))},[]),Ct=b.useCallback(()=>{var U;(U=P.current)==null||U.requestRefresh()},[]),Pt=b.useCallback((U,le)=>{n(Bn(U,le))},[n]),$t=b.useCallback((U,le)=>{var _e;q.current={workspaceId:U,paths:le},(_e=P.current)==null||_e.subscribeFileTree(U,le)},[]),me=b.useCallback((U,le)=>{var _e;_.current={workspaceId:U,paths:le},(_e=P.current)==null||_e.requestFileTreeRefresh(U,le)},[]),We=b.useCallback(U=>(A.current.add(U),()=>{A.current.delete(U)}),[]),Qe=b.useCallback(U=>{var le;E.current=U,(le=P.current)==null||le.subscribeGit(U)},[]),Be=b.useCallback(U=>{var le;M.current=U,(le=P.current)==null||le.requestGitRefresh(U)},[]),Xt=b.useCallback(U=>(L.current.add(U),()=>{L.current.delete(U)}),[]),Ht=b.useCallback(U=>{var le;I.current=U,(le=P.current)==null||le.subscribeWorkspaceManagement(U)},[]),K=b.useCallback(U=>{var le;N.current=U,Tn(_e=>{var tt;return{..._e,[U]:{detail:((tt=_e[U])==null?void 0:tt.detail)??null,loading:!0,error:null}}}),(le=P.current)==null||le.requestWorkspaceManagementRefresh(U)},[]),Ce=b.useCallback(U=>(O.current.add(U),()=>{O.current.delete(U)}),[]),Xe=b.useCallback(U=>{var le;z.current=U,(le=P.current)==null||le.subscribeTerminalManager(U)},[]),Ge=b.useCallback(U=>{var le;G.current=U,(le=P.current)==null||le.requestTerminalManagerRefresh(U)},[]),ut=b.useCallback(U=>(ee.current.add(U),()=>{ee.current.delete(U)}),[]),dn=b.useCallback((U,le)=>{F(_e=>RL(_e,U,le??new Date().toISOString()))},[]),An=b.useCallback(async(U,le)=>{g.current.set(U,le),F(_e=>Yv(_e,U,le));try{const _e=await lC(U,le),tt=ys(_e);tt===le?g.current.set(U,tt):g.current.delete(U),It(_e),Ct(),ot()}catch(_e){throw g.current.delete(U),F(tt=>Yv(tt,U,!le)),_e}},[ot,Ct,It]),j=b.useCallback((U,le)=>{_t("workbench.set_session_workspace",{sessionId:U,workspaceId:le}),St(_e=>{if(!le){if(!(U in _e))return _e;const tt={..._e};return delete tt[U],tt}return _e[U]===le?_e:{..._e,[U]:le}})},[]);b.useEffect(()=>{y.current=Z.length>0},[Z]),b.useEffect(()=>{_t("workbench.navigation_state",{navigationLoading:we,workspaceCount:Z.length,sessionCount:Z.reduce((U,le)=>U+le.sessions.length,0)})},[Z,we]),b.useEffect(()=>{C.current!==null&&window.clearTimeout(C.current),C.current=window.setTimeout(()=>{var Gt;C.current=null,!(w.current||y.current)&&(_t("workbench.refresh_navigation.ws_fallback_triggered"),(Gt=P.current)==null||Gt.requestRefresh())},1200);const U=new VS({onConnectionChange:Gt=>{Gt==="reconnect_failed"&&!y.current&&(Ve(u("shell.navigationLoadFailed")),W.current({id:"workbench-navigation-connection",title:u("shell.navigationLoadFailed"),tone:"warning",durationMs:3600}))},onSnapshot:Gt=>{w.current=!0,_t("workbench.ws_snapshot_received",{workspaceCount:Gt.items.length,sessionCount:Gt.items.reduce((Hn,Ei)=>Hn+Ei.sessions.length,0)}),C.current!==null&&(window.clearTimeout(C.current),C.current=null),Ze(Gt),ce(!1)},onFileTreeSnapshot:Gt=>{A.current.forEach(Hn=>Hn(Gt))},onGitSnapshot:Gt=>{Fr(LC(Gt.workspaceId),{status:Gt.status,history:Gt.history,historyTotalCount:Gt.historyTotalCount,historyNextCursor:Gt.historyNextCursor,branches:Gt.branches}),Tn(Hn=>{var Xl;const Ei=((Xl=Z.find(wd=>wd.workspace.id===Gt.workspaceId))==null?void 0:Xl.workspace)??null;if(!Ei)return Hn;const Rr=Hn[Gt.workspaceId],Ai=FC(DC((Rr==null?void 0:Rr.detail)??MC(Ei),Ei),Gt);return Fr(Sm(Gt.workspaceId),Ai),{...Hn,[Gt.workspaceId]:{detail:Ai,loading:!1,error:null}}}),L.current.forEach(Hn=>Hn(Gt))},onWorkspaceManagementSnapshot:Gt=>{Fr(Sm(Gt.workspaceId),Gt),Tn(Hn=>({...Hn,[Gt.workspaceId]:{detail:Gt,loading:!1,error:null}})),O.current.forEach(Hn=>Hn(Gt))},onTerminalManagerSnapshot:Gt=>{ee.current.forEach(Hn=>Hn(Gt))},onUnauthorized:()=>{kn.clear(),n("/login",{replace:!0})}});P.current=U;const le=q.current,_e=_.current,tt=E.current,Yt=M.current,bn=I.current,ir=N.current,tr=z.current,hn=G.current;return le&&U.subscribeFileTree(le.workspaceId,le.paths),tt&&U.subscribeGit(tt),bn&&U.subscribeWorkspaceManagement(bn),tr&&U.subscribeTerminalManager(tr),_e&&U.requestFileTreeRefresh(_e.workspaceId,_e.paths),Yt&&U.requestGitRefresh(Yt),ir&&U.requestWorkspaceManagementRefresh(ir),hn&&U.requestTerminalManagerRefresh(hn),U.start(),()=>{C.current!==null&&(window.clearTimeout(C.current),C.current=null),P.current===U&&(P.current=null),U.close()}},[n]),b.useEffect(()=>{hs(Rv,String(ze))},[ze]),b.useEffect(()=>{hs(Ev,String(ft))},[ft]),b.useEffect(()=>{hs(Av,String(Ke))},[Ke]),b.useEffect(()=>{hs(Iv,String(pt))},[pt]),b.useEffect(()=>{hs(Lv,JSON.stringify(xt))},[xt]),b.useEffect(()=>{if(!wt){kL(af);return}hs(af,wt)},[wt]),b.useEffect(()=>{if(Fe||pt)return;const U=window.setTimeout(()=>{kt(!0)},qI);return()=>{window.clearTimeout(U)}},[Fe,pt]);const se=fl(t.pathname),V=(se==null?void 0:se.sessionId)??null,Ne=V?zC(V):!1,Le=b.useMemo(()=>ip(Z),[Z]),et=b.useMemo(()=>new Set(xt),[xt]),Wt=b.useMemo(()=>Le.filter(U=>U.session.isFavorite===!0).map(U=>U.session.sessionId),[Le]),qt=b.useMemo(()=>new Set(Wt),[Wt]);b.useEffect(()=>{const U=new Map;if(Le.forEach(({session:le})=>{U.set(le.sessionId,{activityState:le.activityState,completedAt:le.completedAt??null,runningState:le.runningState??null})}),!Q.current){Q.current=!0,D.current=U;return}Le.forEach(({session:le})=>{var ir;if(le.sessionId===V)return;const _e=D.current.get(le.sessionId);if(!_e)return;const tt=_e.activityState!=="completed_unread"&&le.activityState==="completed_unread",Yt=((ir=le.title)==null?void 0:ir.trim())||u("common.unknown");if(l&&tt){const tr=u("conversation.backgroundCompletionToastDescription",{title:Yt});W.current({id:`workbench-session-completed-${le.sessionId}-${le.completedAt??"unknown"}`,title:u("conversation.backgroundCompletionToastTitle"),description:tr,tone:"success",durationMs:8e3,action:{label:u("shell.contextOpenSession"),onClick:()=>Pt(le.workspaceId,le.sessionId)}}),Y.current.showNotification(u("conversation.backgroundCompletionToastTitle"),tr)}const bn=_e.runningState!=="failed"&&(le.runningState??null)==="failed";if(h&&bn){const tr=JI(le)??u("conversation.runtimeFailed"),hn=u("conversation.backgroundFailureToastDescription",{title:Yt,detail:tr});W.current({id:`workbench-session-failed-${le.sessionId}-${le.updatedAt}`,title:u("conversation.backgroundFailureToastTitle"),description:hn,tone:"error",durationMs:8e3,action:{label:u("shell.contextOpenSession"),onClick:()=>Pt(le.workspaceId,le.sessionId)}}),Y.current.showNotification(u("conversation.backgroundFailureToastTitle"),hn)}}),D.current=U},[V,Le,l,h,Pt]),b.useEffect(()=>{$.current=Le.map(U=>U.session).filter(U=>U.sessionId!==V&&XI(U)).map(U=>{var le;return{sessionId:U.sessionId,workspaceId:U.workspaceId,title:((le=U.title)==null?void 0:le.trim())||u("common.unknown")}})},[V,Le]),b.useEffect(()=>{let U=!1,le=null;const _e=()=>{le=window.setTimeout(()=>{tt().finally(()=>{U||_e()})},KI)},tt=async()=>{var tr;const Yt=$.current;if(Yt.length===0){re.current||(re.current=!0);return}(tr=P.current)==null||tr.requestRefresh();const bn=new Set(Yt.map(hn=>hn.sessionId)),ir=await Promise.all(Yt.map(async hn=>{try{const Gt=await cC(hn.sessionId);return{session:hn,items:Gt.items}}catch{return{session:hn,items:null}}}));if(!U){for(const hn of ir){if(!hn.items)continue;const Gt=hn.items.filter(Rr=>Rr.status==="pending"),Hn=new Set(Gt.map(Rr=>Rr.id)),Ei=R.current.get(hn.session.sessionId)??new Set;re.current&&Gt.forEach(Rr=>{if(Ei.has(Rr.id)||!c)return;const Ai=u("conversation.backgroundPermissionToastDescription",{title:hn.session.title,requestTitle:Rr.title});W.current({id:`workbench-permission-request-${Rr.id}`,title:u("conversation.permissionRequestToastTitle"),description:Ai,tone:"warning",durationMs:8e3,action:{label:u("shell.contextOpenSession"),onClick:()=>Pt(hn.session.workspaceId,hn.session.sessionId)}}),Y.current.showNotification(u("conversation.permissionRequestToastTitle"),Ai)}),R.current.set(hn.session.sessionId,Hn)}for(const[hn,Gt]of R.current.entries())!bn.has(hn)&&Gt.size===0&&R.current.delete(hn);re.current=!0}};return tt().finally(()=>{U||_e()}),()=>{U=!0,le!==null&&window.clearTimeout(le)}},[c,Pt]),b.useEffect(()=>{if(we&&Z.length===0)return;const U=new Set(Z.map(le=>le.workspace.id));Dt(le=>IC(le,U)),ye(le=>le&&U.has(le)?le:null)},[Z,we]);const Xn=Le.find(U=>U.session.sessionId===V)??null,on=(Xn==null?void 0:Xn.workspace.id)??(V?dt[V]??null:null),Xr=Wv(t.pathname,t.search),bo=on??Xr??wt??null,Vt=bo??((Ca=Z[0])==null?void 0:Ca.workspace.id)??null,di=b.useMemo(()=>un.filter(U=>!oe.has(U.id)),[oe,un]),Rs=b.useMemo(()=>di.filter(U=>tL(U,Ee)).length,[di,Ee]);b.useEffect(()=>{Se&&xe(di)},[di,xe,Se]);const ba=b.useCallback(U=>{je(!1),U.routePath&&n(U.routePath)},[n]),sn=b.useCallback(async(U,le)=>{const _e=B.current+1;B.current=_e;try{const tt=await RI(U,le);if(_e!==B.current)return;de(Yt=>{const bn=new Set(Yt);return tt.item?bn.add(tt.item.notificationId):bn.delete(U),bn})}catch(tt){if(_e!==B.current)return;W.current({title:u("shell.globalNotificationsArchiveFailed"),description:tt instanceof Error?tt.message:void 0,tone:"error"})}},[]);b.useEffect(()=>{on&&ye(U=>U===on?U:on)},[on]),b.useEffect(()=>{_t("workbench.current_workspace_resolved",{currentSessionId:V,sessionWorkspaceId:on,routeWorkspaceId:Xr,currentWorkspaceId:Vt,source:on?Xn?"navigation":"sessionWorkspaceMap":Xr?"route":wt?"workspaceSelection":"navigationFallback"})},[Xn,V,Vt,Xr,wt,on]),b.useEffect(()=>{_t("workbench.info_panel_state",{infoPanelReady:Fe,rightCollapsed:pt,currentWorkspaceId:Vt,sessionWorkspaceId:on,currentSessionId:V})},[V,Vt,Fe,pt,on]);const Or=Hv(t.pathname)?"terminals":aL(t.pathname)?"butler":"conversation",Cn=e==="mobile",ji=iL(e),ya=b.useMemo(()=>Z.map(U=>({workspace:U.workspace,visibleSessions:U.sessions.filter(le=>!ys(le)),archivedSessions:U.sessions.filter(le=>ys(le)&&!xm(le)),visibleSessionTree:EC(U.sessions.filter(le=>{if(ys(le))return!1;const _e=xm(le);if(!_e)return!0;const tt=U.sessions.find(Yt=>Yt.sessionId===_e);return!tt||!ys(tt)})).filter(le=>!qt.has(le.session.sessionId)&&!so(le).some(_e=>qt.has(_e.sessionId))),isCollapsed:et.has(U.workspace.id)})),[et,qt,Z]),Es=b.useMemo(()=>Le.filter(U=>qt.has(U.session.sessionId)&&!ys(U.session)&&!wm(U.session)),[qt,Le]),yo=t.pathname.startsWith("/settings")?"settings":Hv(t.pathname)?"terminals":oL(t.pathname)?"tools":sL(t.pathname)||zv(t.pathname)?"sessions":"workspaces",va=Cn&&yo==="sessions"&&zv(t.pathname),vo=id({isNativeMobile:i.isNativeMobile,viewportClass:i.viewportClass}),Jr=Ul({viewportClass:i.viewportClass,activeEntry:yo,hasNavigationPanel:Cn,hasAuxiliaryPanel:Cn,preferCompactLayout:vo}),hi=Cn&&HS(Jr),fi=Cn&&qS(Jr),As=b.useMemo(()=>Z.map(U=>U.workspace),[Z]),Is=b.useMemo(()=>{const U=At.trim().toLowerCase();return U?Le.filter(le=>{const _e=(le.session.title||"").toLowerCase(),tt=le.workspace.name.toLowerCase(),Yt=ud(le.session.provider,"full").toLowerCase();return _e.includes(U)||tt.includes(U)||Yt.includes(U)}):[]},[Le,At]);b.useEffect(()=>{var le;const U=Vt??((le=Z[0])==null?void 0:le.workspace.id)??"";U&&Zt(_e=>_e&&Z.some(Yt=>Yt.workspace.id===_e)?_e:U)},[Vt,Z]),b.useEffect(()=>{V&&!Ne&&hs(of,`${t.pathname}${t.search}`)},[V,Ne,t.pathname,t.search]),b.useEffect(()=>{if(V&&Ne){x.current=`${t.pathname}${t.search}`;return}V&&!Ne&&(x.current=null)},[V,Ne,t.pathname,t.search]),b.useEffect(()=>{Cn||(nt(!1),ge(!1))},[Cn]),b.useEffect(()=>{!Cn||we||!rL(t.pathname)||bo||(nt(!1),ge(!1),n(ji,{replace:!0}))},[bo,Cn,t.pathname,n,we,ji]);function mi(){if(Cn){nt(!0);return}jt(!1)}function vd(){if(Ni(),Cn){ge(!0);return}Mt(!1)}function Gl(){if(Cn){nt(U=>!U);return}jt(U=>!U)}function Ls(){if(Ni(),Cn){ge(U=>!U);return}Mt(U=>!U)}function Ni(){kt(!0)}function Ms(U){ye(U),Ni(),V&&on!==U&&n(ji)}const Pi=b.useCallback(async U=>{var tt;const le=((tt=Le.find(Yt=>Yt.session.sessionId===U))==null?void 0:tt.session)??null,_e=(le==null?void 0:le.isFavorite)!==!0;F(Yt=>Xv(Yt,U,_e));try{const Yt=await RA(U,_e);It(Yt),Ct()}catch(Yt){throw F(bn=>Xv(bn,U,!_e)),Yt}},[Le,Ct,It]),wa=b.useCallback((U,le)=>{n(BS(U,le))},[n]),Kl=b.useCallback(U=>{var tt;const le=((tt=U.workspaceId)==null?void 0:tt.trim())||Vt,_e=lL(U.filePath);return!le||!_e?!1:(Ni(),gt("files"),Cn?(nt(!1),ge(!0)):Mt(!1),Qt({requestId:S.current+1,workspaceId:le,filePath:_e,openViewer:U.openViewer===!0}),S.current+=1,!0)},[Vt,Cn]),Yi=b.useCallback(async(U,le)=>{const _e=await aC(U,le.trim());return It(_e),_e},[It]);function Ti(U){Ut(!0)}function Ri(){Ut(!1),Bt("sessions"),vt(""),zt(null),ke([]),Ie(!1)}async function wo(){const U=At.trim();if(!U||!Nt.trim()){ke([]),zt(null);return}Ie(!0),zt(null);try{const le=await vm(Nt,U);ke(le.items)}catch(le){ke([]),zt(le instanceof Error?le.message:u("shell.searchCodeFailed"))}finally{Ie(!1)}}function Ql(U,le){const _e=U==="left"?ze:ft;function tt(bn){const ir=bn.clientX-le;if(U==="left"){yt(Jc(_e+ir,Qc,Dv));return}Ot(Jc(_e-ir,Qc,Fv))}function Yt(){document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",Yt)}document.addEventListener("mousemove",tt),document.addEventListener("mouseup",Yt)}function xo(){if(Ds())return;if(Le.length===0){n(ji);return}const U=Bn(Le[0].workspace.id,Le[0].session.sessionId);n(U)}function xa(){if(!Ds(Vt)){if(Vt){n(Bl(Vt));return}n(ji)}}function Ds(U){if(V)return U&&on&&on!==U?!1:(n(`${t.pathname}${t.search}`),!0);if(x.current){if(U){const[_e,tt=""]=x.current.split("?"),Yt=Wv(_e??x.current,tt?`?${tt}`:"");if(Yt&&Yt!==U)return!1}return n(x.current),!0}const le=typeof window>"u"?null:window.localStorage.getItem(of);if(le){const _e=le.split("?")[0]??le,tt=fl(_e);if(tt){const Yt=tt.sessionId,bn=Le.find(hn=>hn.session.sessionId===Yt)??null,ir=tt.workspaceId??(bn==null?void 0:bn.workspace.id)??null;if(bn!==null&&(!U||ir===U))return n(le),!0}window.localStorage.removeItem(of)}return!1}b.useEffect(()=>{if(typeof window>"u")return;function U(le){if(!(le.metaKey||le.ctrlKey)){le.key==="Escape"&&(nt(!1),ge(!1));return}if(SL(le.target))return;const tt=le.key.toLowerCase();if(!le.shiftKey&&tt==="b"){le.preventDefault(),Gl();return}if(le.shiftKey&&tt==="i"){le.preventDefault(),Ls();return}if(!le.shiftKey&&tt===","){le.preventDefault(),n("/settings");return}if(!le.shiftKey&&tt==="1"){le.preventDefault(),xo();return}if(!le.shiftKey&&tt==="2"){le.preventDefault(),n(Vt?Zo(Vt):Lr());return}if(!le.shiftKey&&tt==="k"){le.preventDefault(),CL();return}le.shiftKey&&tt==="r"&&(le.preventDefault(),ot())}return window.addEventListener("keydown",U),()=>{window.removeEventListener("keydown",U)}},[n,ot,Cn,xo]);const ka=b.useMemo(()=>({shellMode:e,navigationGroups:Z,navigationLoading:we,navigationError:be,currentWorkspaceId:Vt,currentSessionId:V,favoriteSessionIds:Wt,favoriteSessions:Es,globalNotifications:un,archivedNotificationIds:Array.from(oe),showArchivedNotifications:$e,unreadNotificationCount:Rs,refreshNavigation:ot,requestNavigationRefresh:Ct,openNotificationPanel:()=>{je(!0)},closeNotificationPanel:()=>{je(!1)},setShowArchivedNotifications:Ye,archiveNotification:U=>{sn(U,!0)},unarchiveNotification:U=>{sn(U,!1)},setAuxiliaryPanel:qe,subscribeFileTree:$t,requestFileTreeRefresh:me,addFileTreeSnapshotListener:We,subscribeGitSnapshot:Qe,requestGitRefresh:Be,addGitSnapshotListener:Xt,subscribeWorkspaceManagementSnapshot:Ht,requestWorkspaceManagementRefresh:K,addWorkspaceManagementSnapshotListener:Ce,workspaceManagementStateById:rn,subscribeTerminalManagerSnapshot:Xe,requestTerminalManagerRefresh:Ge,addTerminalManagerSnapshotListener:ut,selectWorkspace:Ms,toggleFavoriteSession:Pi,archiveSession:U=>An(U,!0),unarchiveSession:U=>An(U,!1),renameSession:Yi,startDraftSession:wa,markNavigationSessionSeen:dn,upsertNavigationSession:It,setSessionWorkspace:j,revealWorkspaceFile:Kl}),[We,Xt,Ce,ut,An,V,Vt,un,Wt,Es,Ms,oe,dn,be,Z,we,Rs,me,Be,K,ot,Ct,Ye,qe,Ge,Yi,$e,rn,e,wa,j,$t,Qe,Ht,Xe,sn,Pi,It,Kl]),Yl={"--workbench-left-width":`${ze}px`,"--workbench-left-current-width":Ke?"0px":`${ze}px`,"--workbench-right-width":`${ft}px`,"--workbench-right-current-width":pt?"0px":`${ft}px`},Zr=Or==="butler"?Te:r.jsx(tw,{panelReady:Fe,activeTab:lt,fileRevealRequest:it,onTabChange:U=>{Ni(),gt(U)},currentSessionId:Ne?null:V,activeWorkspaceId:Vt,navigationGroups:Z}),Xi=Zr!==null,Fs=Cn?r.jsx(ew,{workspaceGroups:ya,favoriteSessions:Es,favoriteSessionIds:qt,activeWorkspaceId:Vt,isConversationActive:Or==="conversation",isTerminalActive:Or==="terminals",isButlerActive:Or==="butler",isSearchOpen:rt,navigationLoading:we,navigationError:be,activeSessionId:V,onRefreshNavigation:ot,onSessionUpdated:It,onNavigateConversation:xo,onNavigateTerminals:()=>{nt(!1),n(Vt?Zo(Vt):Lr())},onNavigateButler:()=>{nt(!1),n(Vt?co(Vt):Lr())},onOpenSearch:()=>{nt(!1),Ti()},onOpenSettings:()=>{nt(!1),n("/settings")},onSelectWorkspace:Ms,onToggleWorkspaceCollapse:U=>Dt(le=>km(le,U)),subscribeGitSnapshot:Qe,requestGitRefresh:Be,subscribeWorkspaceManagementSnapshot:Ht,requestWorkspaceManagementRefresh:K,onToggleFavoriteSession:Pi,onArchiveSession:U=>An(U,!0),onUnarchiveSession:U=>An(U,!1),workspaceManagementStateById:rn,setWorkspaceManagementStateById:Tn,unreadNotificationCount:Rs,notificationPanelOpen:Se,onToggleNotificationPanel:()=>{je(U=>!U)},onClose:()=>nt(!1)}):null,Sa=Cn&&Xi?Zr:null;return r.jsxs(RC.Provider,{value:ka,children:[Cn?r.jsx(r.Fragment,{children:r.jsx(UE,{activeEntry:yo,presentation:va?"conversation-focus":"default",navigationPanel:Fs,auxiliaryPanel:Sa,onOpenNavigation:()=>{ge(!1),nt(!0)},onOpenSearch:()=>{nt(!1),ge(!1),Ti()},onOpenAuxiliary:()=>{Xi&&(Ni(),nt(!1),ge(!0))},onNavigateWorkspaces:()=>{nt(!1),ge(!1),n(Lr())},onNavigateTerminals:()=>{nt(!1),ge(!1),n(Vt?Zo(Vt):Lr())},onNavigateSessions:()=>{nt(!1),ge(!1),xa()},onNavigateTools:()=>{nt(!1),ge(!1),n(Vt?da(Vt):Lr())},onNavigateToolFiles:()=>{nt(!1),ge(!1),n(Vt?_S(Vt):Lr())},onNavigateToolGit:()=>{nt(!1),ge(!1),n(Vt?OS(Vt):Lr())},onNavigateToolProcesses:()=>{nt(!1),ge(!1),n(Vt?rd(Vt):Lr())},onNavigateSettings:()=>{nt(!1),ge(!1),n("/settings")},children:r.jsx(dm,{})})}):r.jsx("div",{className:"workbench-shell",style:Yl,"data-nav-loading":we,"data-left-collapsed":Ke,"data-right-collapsed":pt,"data-info-ready":Fe,"data-runtime-platform":i.platform,"data-os-family":i.ui.osFamily,"data-overlay-titlebar":i.ui.prefersOverlayTitlebar,children:r.jsxs("div",{className:"workbench-body-shell",children:[r.jsx("aside",{className:"workbench-nav surface-card","data-collapsed":Ke,children:r.jsx(ew,{workspaceGroups:ya,favoriteSessions:Es,favoriteSessionIds:qt,activeWorkspaceId:Vt,isConversationActive:Or==="conversation",isTerminalActive:Or==="terminals",isButlerActive:Or==="butler",isSearchOpen:rt,navigationLoading:we,navigationError:be,activeSessionId:V,onRefreshNavigation:ot,onSessionUpdated:It,onNavigateConversation:xo,onNavigateTerminals:()=>n(Vt?Zo(Vt):Lr()),onNavigateButler:()=>n(Vt?co(Vt):Lr()),onOpenSearch:()=>Ti(),onOpenSettings:()=>n("/settings"),onSelectWorkspace:Ms,onToggleWorkspaceCollapse:U=>Dt(le=>km(le,U)),subscribeGitSnapshot:Qe,requestGitRefresh:Be,subscribeWorkspaceManagementSnapshot:Ht,requestWorkspaceManagementRefresh:K,onToggleFavoriteSession:Pi,onArchiveSession:U=>An(U,!0),onUnarchiveSession:U=>An(U,!1),workspaceManagementStateById:rn,setWorkspaceManagementStateById:Tn,unreadNotificationCount:Rs,notificationPanelOpen:Se,onToggleNotificationPanel:()=>{je(U=>!U)},onToggleCollapse:()=>jt(!0)})}),r.jsx("div",{className:"workbench-side-resizer","data-side":"left","data-collapsed":Ke,role:"separator","aria-label":u("shell.leftResizerLabel"),onMouseDown:Ke?void 0:U=>Ql("left",U.clientX)}),r.jsxs("div",{className:"workbench-main-shell",children:[r.jsxs("div",{className:"workbench-collapsed-rail","aria-hidden":!Ke&&!pt,children:[r.jsxs("div",{className:"workbench-collapsed-controls left","data-visible":Ke,children:[r.jsx(Jv,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:u("shell.showSessionSidebar"),side:"left",collapsed:!0,onClick:mi}),r.jsx(OC,{unreadCount:Rs,open:Se,onToggle:()=>{je(U=>!U)},collapsed:!0}),r.jsx("button",{type:"button",className:"workbench-nav-toolbar-button workbench-collapsed-button","aria-label":u("shell.goBack"),title:u("shell.goBack"),onClick:()=>n(-1),children:r.jsx(BC,{})}),r.jsx("button",{type:"button",className:"workbench-nav-toolbar-button workbench-collapsed-button","aria-label":u("shell.goForward"),title:u("shell.goForward"),onClick:()=>n(1),children:r.jsx(Np,{})})]}),Xi?r.jsx("div",{className:"workbench-collapsed-controls right","data-visible":pt,children:r.jsx(Jv,{className:"workbench-nav-toolbar-button workbench-collapsed-button",ariaLabel:u("shell.showInfoSidebar"),side:"right",collapsed:!0,onClick:vd})}):null]}),r.jsx(dm,{})]}),Xi?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"workbench-side-resizer","data-side":"right","data-collapsed":pt,role:"separator","aria-label":u("shell.rightResizerLabel"),onMouseDown:pt?void 0:U=>Ql("right",U.clientX)}),r.jsx("aside",{className:"workbench-auxiliary surface-card","data-collapsed":pt,"data-custom-panel":Or==="butler",children:Or==="butler"?r.jsx("div",{className:"workbench-auxiliary-custom-panel",children:Te}):r.jsx(tw,{panelReady:Fe,activeTab:lt,fileRevealRequest:it,onTabChange:U=>{Ni(),gt(U)},onToggleCollapse:()=>Mt(!0),currentSessionId:Ne?null:V,activeWorkspaceId:Vt,navigationGroups:Z})})]}):null]})}),r.jsx(DL,{open:Se,notifications:un,archivedNotificationIds:oe,showArchivedNotifications:$e,onClose:()=>je(!1),onToggleShowArchivedNotifications:Ye,onArchiveNotification:U=>{sn(U,!0)},onUnarchiveNotification:U=>{sn(U,!1)},onSelectNotification:ba,preferredWorkspaceId:Vt}),r.jsx(XL,{open:rt,mode:mt,keyword:At,codeWorkspaceId:Nt,codeResults:nn,codeLoading:ie,codeError:ct,workspaceOptions:As,sessionResults:Is,onClose:Ri,onModeChange:U=>{Bt(U),zt(null),ke([])},onKeywordChange:U=>{vt(U),mt==="code"&&!U.trim()&&(ke([]),zt(null))},onCodeWorkspaceChange:U=>Zt(U),onCodeSearch:()=>{wo()},onOpenSession:U=>{Ri();const le=Le.find(_e=>_e.session.sessionId===U)??null;n(le?Bn(le.workspace.id,U):Lr())}}),Cn?r.jsxs(r.Fragment,{children:[hi?null:r.jsx(nw,{isOpen:Lt,side:"left",onClose:()=>nt(!1),children:Fs}),fi?null:r.jsx(nw,{isOpen:fe,side:"right",onClose:()=>ge(!1),children:Sa})]}):null]})}function nw({isOpen:e,side:t,onClose:n,children:i,className:a,overlayClassName:c}){if(!e)return null;const l=r.jsxs(r.Fragment,{children:[r.jsx("div",{className:["mobile-nav-overlay","open",c].filter(Boolean).join(" "),onClick:n,role:"button",tabIndex:0,"aria-label":u("common.back"),onKeyDown:h=>{h.key==="Escape"&&n()}}),r.jsx("div",{className:["mobile-nav-drawer",t,"open",a].filter(Boolean).join(" "),children:i})]});return typeof document>"u"?l:Qn.createPortal(l,document.body)}function Yn(){return b.useContext(RC)??{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 zC(e){return e.startsWith("draft-")}function uf(e,t){if(!e)return{allowed:!1,hidden:!1,reason:u("conversation.capabilityDenied")};switch(t){case"send_message":return e.canSendMessage===!1?{allowed:!1,hidden:!1,reason:u("conversation.capabilitySendDisabled")}:{allowed:!0,hidden:!1,reason:null};case"attachments":return e.supportsAttachments?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:u("conversation.capabilityAttachmentDisabled")};case"interrupt":return e.supportsInterrupt?{allowed:!0,hidden:!1,reason:null}:{allowed:!1,hidden:!1,reason:u("conversation.capabilityInterruptDisabled")};default:return{allowed:!1,hidden:!1,reason:u("conversation.capabilityDenied")}}}const ZL="codingns.conversation.composer-draft:",eM=1,tM=[{id:"builtin-stage-and-summarize",text:"请将本次会话变更的所有代码提交到git暂存区,然后总结一条中文的提交信息"},{id:"builtin-review-module",text:"分析本项目 模块的代码实现,并分析存在的问题"},{id:"builtin-group-commits",text:"分析当前项目中的未提交文件,按照功能模块进行分类提交,提交信息格式请参考我最近的提交记录"}];function Pp(){return typeof window<"u"&&typeof window.localStorage<"u"}function nM(e){if(!e||typeof e!="object")return null;const t="id"in e?e.id:null,n="fileName"in e?e.fileName:null,i="mimeType"in e?e.mimeType:null,a="fileSize"in e?e.fileSize:null,c="lastModified"in e?e.lastModified:null,l="contentBase64"in e?e.contentBase64:null;if(typeof t!="string"||typeof n!="string"||typeof i!="string"||typeof a!="number"||typeof c!="number"||typeof l!="string")return null;const h=t.trim(),f=n.trim(),p=i.trim(),y=l.trim();return!h||!f||!p||a<0||c<0||!y?null:{id:h,fileName:f,mimeType:p,fileSize:a,lastModified:c,contentBase64:y}}function rM(e){if(!e||typeof e!="object")return null;const t="content"in e?e.content:null,n="attachments"in e?e.attachments:null;if(typeof t!="string"||!Array.isArray(n))return null;const i=n.map(a=>nM(a)).filter(a=>a!==null);return i.length!==n.length||t.length===0&&i.length===0?null:{content:t,attachments:i}}function ml(e){return`${ZL}${e}`}function iM(e){var t,n;return{id:((n=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:n.call(t))??`phrase-${Date.now()}-${Math.random().toString(16).slice(2)}`,text:e.trim()}}function sM(e){if(!Pp())return null;const t=e.trim();if(!t)return null;const n=window.localStorage.getItem(ml(t));if(!n)return null;try{const i=JSON.parse(n),a=i&&typeof i=="object"&&"draft"in i&&i.draft&&typeof i.draft=="object"?i.draft:i,c=rM(a);return c||(window.localStorage.removeItem(ml(t)),null)}catch{return window.localStorage.removeItem(ml(t)),null}}function oM(e,t){if(!Pp())return!1;const n=e.trim();if(!n)return!1;if(t.content.length===0&&t.attachments.length===0)return HC(n),!0;try{return window.localStorage.setItem(ml(n),JSON.stringify({schemaVersion:eM,draft:t})),!0}catch{return!1}}function HC(e){if(!Pp())return;const t=e.trim();t&&window.localStorage.removeItem(ml(t))}const rw="workbench:focus-composer",qC="provider-default",iw={position:"absolute",width:"1px",height:"1px",padding:0,margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",border:0};function aM(e){return[{id:qC,name:u("conversation.modelUseCliDefault"),provider:e,usesProviderDefault:!0}]}function lM(e){return aM(e)}function cM(e){return e.usesProviderDefault===!0||e.id===qC}function uM(){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 sw(e){if(e){e.value="";try{const t=e.showPicker;if(typeof t=="function"){t.call(e);return}}catch{}e.click()}}function dM(e,t,n,i){const a=globalThis.atob(n),c=Uint8Array.from(a,l=>l.charCodeAt(0));return new File([c],e,{type:t,lastModified:i})}function hM(e){const t=dM(e.fileName,e.mimeType,e.contentBase64,e.lastModified);return{id:e.id,file:t,previewUrl:URL.createObjectURL(t)}}function fM(e,t){return{id:t,kind:"image",fileName:e.name,mimeType:e.type||"image/png",fileSize:e.size}}function ow(e){return new Promise((t,n)=>{const i=new FileReader;i.onerror=()=>{n(i.error??new Error("FILE_READ_FAILED"))},i.onload=()=>{const a=typeof i.result=="string"?i.result:"",c=a.includes(",")?a.split(",").at(-1)??"":a;t(c)},i.readAsDataURL(e)})}function mM(e){e.forEach(t=>{URL.revokeObjectURL(t.previewUrl)})}function pM(e){const t=[];let n=0;for(const i of e){if(i.type.startsWith("image/")){t.push(i);continue}n+=1}return{accepted:t,rejectedCount:n}}function gM(e,t){const n=new Set(e.map(a=>`${a.file.name}:${a.file.size}:${a.file.lastModified}`)),i=[...e];return t.forEach(a=>{const c=`${a.name}:${a.size}:${a.lastModified}`;n.has(c)||(n.add(c),i.push({id:uM(),file:a,previewUrl:URL.createObjectURL(a)}))}),i}function Tp({capabilities:e,placeholder:t,draftStorageId:n,panelRef:i,portalContainer:a=null,hasActiveRun:c=null,canInterrupt:l=null,contextUsage:h=null,hasPendingQueuedMessages:f=!1,isSubmitting:p,isRunning:y=!1,onInterrupt:g,onQueueSend:w,onSend:x}){const S=zn(),C=b.useId(),P=b.useId(),[A,L]=b.useState(""),[O,ee]=b.useState(""),[q,_]=b.useState("medium"),[E,M]=b.useState([]),[I,N]=b.useState(!1),[z,G]=b.useState(tM),[J,B]=b.useState(!1),[W,Y]=b.useState(!1),[Q,D]=b.useState(""),[re,R]=b.useState(!1),[$,Z]=b.useState(!1),[F,we]=b.useState(!1),[ce,be]=b.useState(!1),Ve=b.useRef(null),ze=b.useRef(null),yt=b.useRef(null),ft=b.useRef(!1),Ot=b.useRef(new Set),Ke=b.useRef(new Map),jt=b.useRef(0),{showToast:pt}=En(),Mt=Yr(),xt=nI(e),Dt=la(me=>Gh(xt)?me.profile.providers[xt]:null),wt=(Dt==null?void 0:Dt.defaultModel)??null,ye=(Dt==null?void 0:Dt.defaultReasoningLevel)??null,Fe=b.useMemo(()=>uf(e,"send_message"),[e]),kt=b.useMemo(()=>uf(e,"interrupt"),[e]),lt=b.useMemo(()=>uf(e,"attachments"),[e]),gt=b.useMemo(()=>{var We;const me=(We=e==null?void 0:e.modelOptions)==null?void 0:We.map(Qe=>{var Be;return{...Qe,provider:xt,supportedReasoningEfforts:(Be=Qe.supportedReasoningEfforts)==null?void 0:Be.filter(Xt=>Xt==="low"||Xt==="medium"||Xt==="high"||Xt==="xhigh")}});return me!=null&&me.length?me:lM(xt)},[e==null?void 0:e.modelOptions,xt]),Lt=b.useMemo(()=>gt.find(me=>me.id===O)??null,[gt,O]),nt=iI(e),fe=rI(e),ge=b.useMemo(()=>[{value:"low",label:u("conversation.reasoningLow")},{value:"medium",label:u("conversation.reasoningMedium")},{value:"high",label:u("conversation.reasoningHigh")},{value:"xhigh",label:u("conversation.reasoningMaximum")}],[]),Te=b.useMemo(()=>{if(!nt)return[];const me=Lt==null?void 0:Lt.supportedReasoningEfforts;return!me||me.length===0?ge:ge.filter(We=>me.includes(We.value))},[nt,ge,Lt==null?void 0:Lt.supportedReasoningEfforts]),qe=b.useMemo(()=>gt.map(me=>({value:me.id,label:cM(me)?u("conversation.modelUseCliDefault"):me.name})),[gt]),dt=b.useMemo(()=>Te.map(me=>({value:me.value,label:me.label})),[Te]),St=b.useMemo(()=>[{command:"/plan",label:u("conversation.slashCommandPlan")},{command:"/review",label:u("conversation.slashCommandReview")},{command:"/explain",label:u("conversation.slashCommandExplain")}],[]),rt=(e==null?void 0:e.inRunInputMode)??"none",Ut=c??null,mt=y&&rt==="streaming_guidance"&&Ut===!1&&!bC(e),Bt=y&&rt==="streaming_guidance"&&!mt,At=y&&typeof w=="function"&&sI(e,Ut),vt=y&&!Bt&&!At,Nt=A.trim().length>0||E.length>0,Zt=l??kt.allowed,Ie=y&&Zt&&!!g&&!F&&!Nt&&!ce&&!p,ct=!Ie&&!Nt&&(ce||p||y||!y&&f),zt=u(ce||p||f?"conversation.sendingState":"conversation.runtimeRunning"),nn=u(y?At?"conversation.queueGuidanceButton":Bt?"conversation.sendGuidanceButton":"conversation.sendButton":"conversation.sendButton"),ke=b.useCallback(me=>{ee(me),Gh(xt)&&Lu({providers:{[xt]:{defaultModel:me}}}).catch(()=>{})},[xt]),it=b.useCallback(me=>{_(me),Gh(xt)&&Lu({providers:{[xt]:{defaultReasoningLevel:me}}}).catch(()=>{})},[xt]),Qt=b.useCallback(me=>{Ot.current.forEach(We=>{URL.revokeObjectURL(We)}),Ot.current.clear(),me.forEach(We=>{Ot.current.add(We.previewUrl)}),M(me)},[]),rn=b.useCallback(me=>{const{accepted:We,rejectedCount:Qe}=pM(me);Qe>0&&pt({title:u("conversation.attachmentImageOnly"),tone:"error"}),We.length!==0&&M(Be=>{const Xt=gM(Be,We);return Xt.forEach(Ht=>{Ot.current.add(Ht.previewUrl)}),Xt})},[pt]),Tn=b.useCallback(me=>{Ke.current.delete(me),M(We=>{const Qe=We.find(Be=>Be.id===me);return Qe&&(Ot.current.delete(Qe.previewUrl),URL.revokeObjectURL(Qe.previewUrl)),We.filter(Be=>Be.id!==me)})},[]),un=b.useCallback(me=>{const We=Array.from(me.target.files??[]);We.length>0&&rn(We),me.target.value=""},[rn]),X=b.useCallback(me=>{if(!lt.allowed||vt)return;const We=me==="camera"?yt.current:ze.current;sw(We),N(!1)},[lt.allowed,vt]),oe=b.useCallback(()=>{if(!(!lt.allowed||vt)){if(Z(!1),S.isNativeMobile){Mt.trigger("selection"),N(!0);return}sw(ze.current)}},[lt.allowed,Mt,vt,S.isNativeMobile]),de=b.useCallback(()=>{Z(me=>!me)},[]),Se=b.useCallback(me=>{var We;L(Qe=>Qe.trimStart().startsWith(me)?Qe:Qe.trim()?`${me} ${Qe.trim()}`:`${me} `),Z(!1),(We=Ve.current)==null||We.focus()},[]),je=b.useCallback(async me=>{const We=z;jt.current+=1,G(me),R(!0);try{const Qe=await IA(me.map(Be=>({id:Be.id,text:Be.text})));return G(Qe.items.map(Be=>({id:Be.id,text:Be.text}))),!0}catch(Qe){return G(We),pt({title:Qe instanceof Error?Qe.message:u("conversation.quickPhraseSaveFailed"),tone:"error"}),!1}finally{R(!1)}},[z,pt]),$e=b.useCallback(async()=>{const me=Q.trim();!me||!await je([...z,iM(me)])||(D(""),Y(!1))},[je,Q,z]),Ye=b.useCallback(me=>{je(z.filter(We=>We.id!==me))},[je,z]),Ee=b.useCallback((me,We)=>{const Qe=z.findIndex(K=>K.id===me);if(Qe<0)return;const Be=Qe+We;if(Be<0||Be>=z.length)return;const Xt=[...z],[Ht]=Xt.splice(Qe,1);Xt.splice(Be,0,Ht),je(Xt)},[je,z]),Ue=b.useCallback(me=>{var We;L(me),B(!1),(We=Ve.current)==null||We.focus()},[]),ne=b.useCallback(me=>{const We=me?sM(me):null,Qe=(We==null?void 0:We.attachments.map(Be=>hM(Be)))??[];Ke.current=new Map(((We==null?void 0:We.attachments)??[]).map(Be=>[Be.id,Be])),Qt(Qe),L((We==null?void 0:We.content)??""),Z(!1)},[Qt]);b.useEffect(()=>{if(!gt.length)return;if(wt&&gt.some(We=>We.id===wt)){O!==wt&&ee(wt);return}if(gt.some(We=>We.id===O))return;const me=gt[0].id;ee(me)},[gt,xt,O,wt]),b.useEffect(()=>{if(!oI(xt)||Te.length===0)return;if(ye&&Te.some(Qe=>Qe.value===ye)){q!==ye&&_(ye);return}const me=e==null?void 0:e.defaultReasoningLevel;if(me&&Te.some(Qe=>Qe.value===me)){q!==me&&_(me);return}if(Te.some(Qe=>Qe.value===q))return;const We=Te[0].value;_(We)},[Te,e==null?void 0:e.defaultReasoningLevel,xt,q,ye]),b.useEffect(()=>{let me=!1;const We=jt.current;return AA().then(Qe=>{me||jt.current!==We||G(Qe.items.map(Be=>({id:Be.id,text:Be.text})))}).catch(()=>{}),()=>{me=!0}},[]),b.useEffect(()=>{ne(n)},[n,ne]),b.useEffect(()=>{if(!n)return;const me=n,We=new Set(E.map(Xt=>Xt.id));Ke.current.forEach((Xt,Ht)=>{We.has(Ht)||Ke.current.delete(Ht)});let Qe=!1;async function Be(){if(A.length===0&&E.length===0){HC(me);return}const Xt=await Promise.all(E.map(async Ht=>{const K=Ke.current.get(Ht.id);return K&&K.fileName===Ht.file.name&&K.fileSize===Ht.file.size&&K.lastModified===Ht.file.lastModified&&K.mimeType===(Ht.file.type||"image/png")?K:{id:Ht.id,fileName:Ht.file.name,mimeType:Ht.file.type||"image/png",fileSize:Ht.file.size,lastModified:Ht.file.lastModified,contentBase64:await ow(Ht.file)}}));Qe||(Ke.current=new Map(Xt.map(Ht=>[Ht.id,Ht])),oM(me,{content:A,attachments:Xt}))}return Be(),()=>{Qe=!0}},[E,A,n]),b.useEffect(()=>{const me=Ve.current;me&&(me.style.height="0px",me.style.height=`${Math.min(me.scrollHeight,120)}px`)},[A]),b.useEffect(()=>{lt.allowed||(Ke.current.clear(),N(!1),Qt([]))},[lt.allowed,Qt]),b.useEffect(()=>{S.isMobile||N(!1)},[S.isMobile]),b.useEffect(()=>()=>{Ot.current.forEach(me=>{URL.revokeObjectURL(me)}),Ot.current.clear()},[]),b.useEffect(()=>{function me(){var We;(We=Ve.current)==null||We.focus()}return window.addEventListener(rw,me),()=>{window.removeEventListener(rw,me)}},[]);async function xe(me){if(ft.current)return;const We=A.trim(),Qe=E;if(We.length===0&&Qe.length===0||!Fe.allowed||vt){pt({title:vt?u("conversation.runtimeRunning"):Fe.reason??u("conversation.capabilityDenied"),tone:"error"});return}ft.current=!0,Mt.trigger(me==="queue"?"selection":"action"),be(!0),L(""),M([]),N(!1),B(!1),Y(!1),Z(!1);try{const Be=await Promise.all(Qe.map(async K=>({fileName:K.file.name,mimeType:K.file.type||"image/png",fileSize:K.file.size,contentBase64:await ow(K.file)}))),Xt=Qe.map(K=>fM(K.file,K.id));await(me==="queue"&&w?w:x)(We,{model:Lt!=null&&Lt.usesProviderDefault?void 0:O||void 0,reasoningLevel:nt&&Te.length>0?q:void 0,attachments:Be,attachmentMeta:Xt}),mM(Qe),Qe.forEach(K=>{Ot.current.delete(K.previewUrl)})}catch(Be){L(We),M(Qe),pt({title:Be instanceof Error&&Be.message==="FILE_READ_FAILED"?u("conversation.attachmentReadFailed"):Be instanceof Error?Be.message:u("conversation.capabilityDenied"),tone:"error"})}finally{be(!1),ft.current=!1}}async function Ze(me){me.preventDefault(),await xe(At?"queue":"send")}async function ot(){if(!(!Zt||!g||F))try{we(!0),Mt.trigger("action"),await g()}catch(me){pt({title:me instanceof Error?me.message:u("conversation.capabilityInterruptDisabled"),tone:"error"})}finally{we(!1)}}const It=ce||p||vt||!Fe.allowed||!Nt,Ct=ce||p||vt||!lt.allowed,Pt=A.length===0&&!vt,$t=r.jsxs("section",{ref:i,className:"composer-panel",children:[r.jsxs("form",{className:"composer-form",onSubmit:Ze,children:[r.jsx("input",{id:C,ref:ze,type:"file",accept:"image/*",multiple:!0,tabIndex:-1,"aria-hidden":"true",style:iw,onChange:un}),r.jsx("input",{id:P,ref:yt,type:"file",accept:"image/*",capture:"environment",tabIndex:-1,"aria-hidden":"true",style:iw,onChange:un}),r.jsxs("div",{className:"composer-input-container",children:[E.length>0?r.jsx("div",{className:"composer-attachments",children:E.map(me=>r.jsxs("div",{className:"composer-attachment-card",children:[r.jsx("img",{src:me.previewUrl,alt:u("conversation.attachmentPreviewAlt"),className:"composer-attachment-preview"}),r.jsxs("div",{className:"composer-attachment-meta",children:[r.jsx("span",{className:"attachment-name",title:me.file.name,children:me.file.name}),r.jsxs("span",{className:"attachment-size",children:[(me.file.size/1024).toFixed(1)," KB"]})]}),r.jsx("button",{type:"button",className:"attachment-remove",onClick:()=>Tn(me.id),"aria-label":u("conversation.removeAttachment"),children:r.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},me.id))}):null,r.jsxs("div",{className:"composer-input-wrapper",children:[r.jsx("textarea",{ref:Ve,className:"composer-input",value:A,placeholder:t??u("conversation.composerPlaceholder"),readOnly:vt,"aria-readonly":vt,onChange:me=>L(me.target.value),rows:1,onFocus:()=>Z(!1),onPaste:me=>{if(vt||!lt.allowed)return;const We=Array.from(me.clipboardData.items).filter(Qe=>Qe.kind==="file").map(Qe=>Qe.getAsFile()).filter(Qe=>!!Qe);We.length!==0&&(me.preventDefault(),rn(We))},onKeyDown:me=>{me.key==="Escape"&&Z(!1),me.key==="Enter"&&!me.shiftKey&&(me.preventDefault(),It||Ze(me))}}),Pt?r.jsx("button",{type:"button",className:"composer-quick-phrase-trigger","aria-label":u("conversation.quickPhraseTrigger"),title:u("conversation.quickPhraseTrigger"),onClick:()=>{B(!0),Z(!1)},children:r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("path",{d:"M7 8h10"}),r.jsx("path",{d:"M7 12h8"}),r.jsx("path",{d:"M7 16h5"}),r.jsx("path",{d:"M5 5h14v14H9l-4 4V5z"})]})}):null]}),$?r.jsx("div",{className:"composer-slash-menu",role:"menu","aria-label":u("conversation.slashMenuTitle"),children:St.map(me=>r.jsxs("button",{type:"button",className:"composer-slash-item",onClick:()=>Se(me.command),children:[r.jsx("span",{className:"composer-slash-command",children:me.command}),r.jsx("span",{className:"composer-slash-label",children:me.label})]},me.command))}):null,r.jsxs("div",{className:"composer-controls",children:[r.jsxs("div",{className:"composer-controls-left",children:[lt.allowed?S.isNativeMobile?r.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":u("conversation.attachFiles"),title:u("conversation.attachFiles"),disabled:Ct,onClick:oe,children:r.jsx(df,{})}):Ct?r.jsx("button",{type:"button",className:"composer-attach-btn","aria-label":u("conversation.attachFiles"),title:u("conversation.attachFiles"),disabled:!0,children:r.jsx(df,{})}):r.jsx("label",{htmlFor:C,className:"composer-attach-btn","aria-label":u("conversation.attachFiles"),title:u("conversation.attachFiles"),onClick:()=>{Z(!1)},children:r.jsx(df,{})}):null,r.jsx(aw,{ariaLabel:u("conversation.modelSelectorLabel"),value:O,options:qe,onChange:ke}),nt&&Te.length>0?r.jsx(aw,{ariaLabel:u("conversation.reasoningSelectorLabel"),value:q,options:dt,onChange:me=>it(me),compact:!0}):null,fe?r.jsxs("button",{type:"button",className:"composer-slash-btn",onClick:de,title:u("conversation.slashMenu"),children:[r.jsx("span",{className:"slash-icon",children:"/"}),r.jsx("span",{children:u("conversation.slashMenu")})]}):null,r.jsx(wM,{contextUsage:h})]}),ct?r.jsx("div",{className:"composer-send-group",children:r.jsx("button",{className:"composer-send composer-send-busy",type:"button",disabled:!0,"aria-label":zt,title:zt,children:r.jsxs("svg",{className:"composer-send-spinner",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",children:[r.jsx("circle",{cx:"12",cy:"12",r:"8",stroke:"currentColor",strokeOpacity:"0.28",strokeWidth:"2.5"}),r.jsx("path",{d:"M20 12a8 8 0 0 0-8-8",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})]})})}):r.jsx("div",{className:"composer-send-group",children:Ie?r.jsx("button",{className:"composer-send composer-send-busy",type:"button",onClick:()=>{ot()},"aria-label":u("conversation.capabilityInterrupt"),title:u("conversation.capabilityInterrupt"),children:r.jsx("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:r.jsx("rect",{x:"6",y:"6",width:"12",height:"12"})})}):r.jsx("button",{className:"composer-send",type:"submit",disabled:It,"aria-label":nn,title:nn,children:r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[r.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),r.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})})]})]})]}),r.jsx(Un,{open:J,title:u("conversation.quickPhraseModalTitle"),description:u("conversation.quickPhraseModalDescription"),className:"composer-quick-phrase-modal",onClose:()=>{B(!1),Y(!1)},children:r.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[r.jsxs("div",{className:"composer-quick-phrase-toolbar",children:[r.jsx("div",{className:"composer-quick-phrase-toolbar-copy",children:r.jsx("span",{children:u("conversation.quickPhraseListLabel")})}),r.jsx("button",{type:"button",className:"primary-button",disabled:re,onClick:()=>Y(!0),children:u("conversation.quickPhraseOpenCreateAction")})]}),r.jsx("div",{className:"composer-quick-phrase-list",role:"list","aria-label":u("conversation.quickPhraseListLabel"),children:z.length===0?r.jsx("div",{className:"composer-quick-phrase-empty",children:u("conversation.quickPhraseEmpty")}):z.map((me,We)=>r.jsxs("div",{className:"composer-quick-phrase-item",role:"listitem",children:[r.jsxs("button",{type:"button",className:"composer-quick-phrase-select",onClick:()=>Ue(me.text),children:[r.jsx("span",{className:"composer-quick-phrase-order",children:u("conversation.quickPhraseOrderLabel",{index:We+1})}),r.jsx("span",{className:"composer-quick-phrase-text",children:me.text})]}),r.jsxs("div",{className:"composer-quick-phrase-actions",children:[r.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:re||We===0,"aria-label":u("conversation.quickPhraseMoveUp"),title:u("conversation.quickPhraseMoveUp"),onClick:()=>Ee(me.id,-1),children:"↑"}),r.jsx("button",{type:"button",className:"composer-quick-phrase-action",disabled:re||We===z.length-1,"aria-label":u("conversation.quickPhraseMoveDown"),title:u("conversation.quickPhraseMoveDown"),onClick:()=>Ee(me.id,1),children:"↓"}),r.jsx("button",{type:"button",className:"composer-quick-phrase-action is-danger",disabled:re,"aria-label":u("conversation.quickPhraseDelete"),title:u("conversation.quickPhraseDelete"),onClick:()=>Ye(me.id),children:"×"})]})]},me.id))})]})}),r.jsx(Un,{open:W,title:u("conversation.quickPhraseCreateModalTitle"),description:u("conversation.quickPhraseCreateModalDescription"),className:"composer-quick-phrase-create-modal",onClose:()=>Y(!1),children:r.jsxs("div",{className:"composer-quick-phrase-modal-body",children:[r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("conversation.quickPhraseCreateLabel")}),r.jsx("textarea",{className:"composer-quick-phrase-textarea",value:Q,placeholder:u("conversation.quickPhraseCreatePlaceholder"),rows:4,onChange:me=>D(me.target.value)})]}),r.jsxs("div",{className:"workbench-modal-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",onClick:()=>Y(!1),children:u("common.cancel")}),r.jsx("button",{type:"button",className:"primary-button",disabled:re||Q.trim().length===0,onClick:()=>{$e()},children:u("conversation.quickPhraseCreateAction")})]})]})}),r.jsx(bM,{open:I&&S.isNativeMobile,onClose:()=>N(!1),onSelectCamera:()=>X("camera"),onSelectLibrary:()=>X("library")})]});return a?Qn.createPortal($t,a):$t}function bM({open:e,onClose:t,onSelectCamera:n,onSelectLibrary:i}){return!e||typeof document>"u"?null:Qn.createPortal(r.jsx("div",{className:"ios-action-sheet-overlay composer-attachment-sheet-overlay",role:"presentation",onClick:t,children:r.jsxs("div",{className:"mobile-workspace-home-sheet composer-attachment-sheet",role:"dialog","aria-modal":"true","aria-label":u("conversation.attachmentSourceSheetTitle"),onClick:a=>a.stopPropagation(),children:[r.jsxs("div",{className:"mobile-workspace-home-sheet-card composer-attachment-sheet-card",children:[r.jsxs("div",{className:"mobile-workspace-home-sheet-header",children:[r.jsx("strong",{children:u("conversation.attachmentSourceSheetTitle")}),r.jsx("span",{children:u("conversation.attachmentSourceSheetDescription")})]}),r.jsxs("div",{className:"mobile-workspace-home-group composer-attachment-sheet-actions",children:[r.jsxs("button",{type:"button",className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":u("conversation.attachmentTakePhoto"),onClick:n,children:[r.jsxs("span",{className:"composer-attachment-sheet-option-copy",children:[r.jsx("strong",{children:u("conversation.attachmentTakePhoto")}),r.jsx("span",{children:u("conversation.attachmentTakePhotoHint")})]}),r.jsx(yM,{})]}),r.jsxs("button",{type:"button",className:"mobile-workspace-home-row composer-attachment-sheet-option","aria-label":u("conversation.attachmentChooseFromLibrary"),onClick:i,children:[r.jsxs("span",{className:"composer-attachment-sheet-option-copy",children:[r.jsx("strong",{children:u("conversation.attachmentChooseFromLibrary")}),r.jsx("span",{children:u("conversation.attachmentChooseFromLibraryHint")})]}),r.jsx(vM,{})]})]})]}),r.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:t,children:u("common.cancel")})]})}),document.body)}function yM(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.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"}),r.jsx("circle",{cx:"12",cy:"13",r:"4"})]})}function df(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4"}),r.jsx("path",{d:"M8 12h8M12 8v8"})]})}function vM(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.jsx("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2.5"}),r.jsx("path",{d:"m7.5 15 3-3 2.5 2.5 3-4L18 13.5"}),r.jsx("circle",{cx:"8.75",cy:"8.75",r:"1.25",fill:"currentColor",stroke:"none"})]})}function aw({ariaLabel:e,value:t,options:n,onChange:i,compact:a=!1}){const[c,l]=b.useState(!1),h=b.useRef(null),f=b.useRef(null),p=b.useRef(null),[y,g]=b.useState(null),w=b.useId(),x=n.find(C=>C.value===t)??n[0]??null,S=b.useCallback(()=>{const C=f.current;if(!C||typeof window>"u")return;const P=C.getBoundingClientRect(),A=window.innerWidth,L=window.innerHeight,O=12,ee=10,q=Math.max(160,A-O*2),_=a?140:220,E=Math.min(q,Math.max(P.width,_)),M=Math.min(Math.max(O,P.left),Math.max(O,A-E-O)),I=P.top-O,N=L-P.bottom-O,z=I>=180||I>=N;g({position:"fixed",left:M,width:E,maxWidth:q,top:z?void 0:P.bottom+ee,bottom:z?L-P.top+ee:void 0})},[a]);return b.useEffect(()=>{if(!c)return;function C(A){var O,ee;const L=A.target;!((O=h.current)!=null&&O.contains(L))&&!((ee=p.current)!=null&&ee.contains(L))&&l(!1)}function P(A){A.key==="Escape"&&l(!1)}return window.addEventListener("pointerdown",C),window.addEventListener("keydown",P),window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),S(),()=>{window.removeEventListener("pointerdown",C),window.removeEventListener("keydown",P),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0)}},[c,S]),x?r.jsxs("div",{ref:h,className:`composer-mac-select ${a?"is-compact":""}`,"data-open":c?"true":"false",children:[r.jsxs("button",{ref:f,type:"button",className:"composer-mac-select-trigger","aria-label":e,"aria-haspopup":"listbox","aria-expanded":c,"aria-controls":w,onClick:()=>l(C=>!C),children:[r.jsx("span",{className:"composer-mac-select-label",children:x.label}),r.jsx("svg",{className:"composer-mac-select-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:r.jsx("polyline",{points:"6 14 12 8 18 14"})})]}),c&&y&&typeof document<"u"?Qn.createPortal(r.jsx("div",{ref:p,className:"composer-mac-select-popover",style:y,role:"presentation",children:r.jsx("div",{id:w,className:"composer-mac-select-list",role:"listbox","aria-label":e,children:n.map(C=>{const P=C.value===t;return r.jsxs("button",{type:"button",role:"option","aria-selected":P,className:`composer-mac-select-option ${P?"is-selected":""}`,onClick:()=>{i(C.value),l(!1)},children:[r.jsx("span",{className:"composer-mac-select-option-check","aria-hidden":"true",children:P?"✓":""}),r.jsx("span",{className:"composer-mac-select-option-label",children:C.label})]},C.value)})})}),document.body):null]}):null}function wM({contextUsage:e}){const[t,n]=b.useState(!1),i=b.useRef(null),a=b.useRef(null),[c,l]=b.useState(null),h=b.useId(),f=e?Math.round(e.usageRatio*100):null,p=e?Math.max(0,Math.min(e.usageRatio,1)):0,y=xM(p),g=e?kM(e.contextWindowSource):null,w=e?`${u("conversation.contextUsageTitle")} ${f}%`:u("conversation.contextUsageUnavailable"),x=b.useCallback(()=>{const S=i.current;if(!S||typeof window>"u")return;const C=S.getBoundingClientRect(),P=window.innerWidth,A=window.innerHeight,L=12,O=10,ee=Math.min(240,Math.max(188,P-L*2)),q=Math.min(Math.max(L,C.left+C.width/2-ee/2),Math.max(L,P-ee-L)),_=C.top-L,E=A-C.bottom-L,M=_>=140||_>=E;l({position:"fixed",left:q,width:ee,maxWidth:P-L*2,top:M?void 0:C.bottom+O,bottom:M?A-C.top+O:void 0})},[]);return b.useEffect(()=>{if(!t)return;function S(P){var L,O;const A=P.target;!((L=i.current)!=null&&L.contains(A))&&!((O=a.current)!=null&&O.contains(A))&&n(!1)}function C(P){P.key==="Escape"&&n(!1)}return window.addEventListener("pointerdown",S),window.addEventListener("keydown",C),window.addEventListener("resize",x),window.addEventListener("scroll",x,!0),x(),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",C),window.removeEventListener("resize",x),window.removeEventListener("scroll",x,!0)}},[t,x]),r.jsxs(r.Fragment,{children:[r.jsx("button",{ref:i,type:"button",className:`composer-context-ring ${y}`,style:{"--context-usage-progress":`${p}`},"aria-label":w,"aria-expanded":t,"aria-describedby":t?h:void 0,onClick:()=>n(S=>!S),onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),onFocus:()=>n(!0),onBlur:()=>n(!1),children:r.jsx("span",{className:"composer-context-ring-value",children:f===null?"--":r.jsxs(r.Fragment,{children:[r.jsx("span",{children:f}),r.jsx("span",{className:"composer-context-ring-suffix",children:"%"})]})})}),t&&c&&typeof document<"u"?Qn.createPortal(r.jsx("div",{ref:a,id:h,className:"composer-context-tooltip",style:c,role:"tooltip",children:e?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"composer-context-tooltip-title",children:u("conversation.contextUsageTitle")}),r.jsxs("div",{className:"composer-context-tooltip-line",children:[f,"% · ",hf(e.promptTokens)," /"," ",hf(e.contextWindow)," tokens"]}),e.cachedInputTokens>0?r.jsx("div",{className:"composer-context-tooltip-line",children:u("conversation.contextUsageCachedTokens").replace("{count}",hf(e.cachedInputTokens))}):null,g?r.jsx("div",{className:"composer-context-tooltip-meta",children:g}):null,e.isEstimated?r.jsx("div",{className:"composer-context-tooltip-meta",children:u("conversation.contextUsageEstimated")}):null]}):r.jsx("div",{className:"composer-context-tooltip-line",children:u("conversation.contextUsageUnavailable")})}),document.body):null]})}function xM(e){return e>=.95?"is-critical":e>=.8?"is-warning":"is-normal"}function kM(e){switch(e){case"provider-log":return u("conversation.contextUsageSourceProviderLog");case"provider-runtime":return u("conversation.contextUsageSourceProviderRuntime");case"provider-config":return u("conversation.contextUsageSourceProviderConfig");case"model-map":return u("conversation.contextUsageSourceModelMap");default:return""}}function hf(e){return new Intl.NumberFormat().format(e)}function SM(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const CM=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,jM=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,NM={};function lw(e,t){return(NM.jsx?jM:CM).test(e)}const PM=/[ \t\n\f\r]/g;function TM(e){return typeof e=="object"?e.type==="text"?cw(e.value):!1:cw(e)}function cw(e){return e.replace(PM,"")===""}class zl{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}zl.prototype.normal={};zl.prototype.property={};zl.prototype.space=void 0;function $C(e,t){const n={},i={};for(const a of e)Object.assign(n,a.property),Object.assign(i,a.normal);return new zl(n,i,t)}function Cm(e){return e.toLowerCase()}class Tr{constructor(t,n){this.attribute=n,this.property=t}}Tr.prototype.attribute="";Tr.prototype.booleanish=!1;Tr.prototype.boolean=!1;Tr.prototype.commaOrSpaceSeparated=!1;Tr.prototype.commaSeparated=!1;Tr.prototype.defined=!1;Tr.prototype.mustUseProperty=!1;Tr.prototype.number=!1;Tr.prototype.overloadedBoolean=!1;Tr.prototype.property="";Tr.prototype.spaceSeparated=!1;Tr.prototype.space=void 0;let RM=0;const Kt=po(),Fn=po(),jm=po(),Me=po(),gn=po(),ra=po(),Mr=po();function po(){return 2**++RM}const Nm=Object.freeze(Object.defineProperty({__proto__:null,boolean:Kt,booleanish:Fn,commaOrSpaceSeparated:Mr,commaSeparated:ra,number:Me,overloadedBoolean:jm,spaceSeparated:gn},Symbol.toStringTag,{value:"Module"})),ff=Object.keys(Nm);class Rp extends Tr{constructor(t,n,i,a){let c=-1;if(super(t,n),uw(this,"space",a),typeof i=="number")for(;++c<ff.length;){const l=ff[c];uw(this,ff[c],(i&Nm[l])===Nm[l])}}}Rp.prototype.defined=!0;function uw(e,t,n){n&&(e[t]=n)}function ma(e){const t={},n={};for(const[i,a]of Object.entries(e.properties)){const c=new Rp(i,e.transform(e.attributes||{},i),a,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(c.mustUseProperty=!0),t[i]=c,n[Cm(i)]=i,n[Cm(c.attribute)]=i}return new zl(t,n,e.space)}const VC=ma({properties:{ariaActiveDescendant:null,ariaAtomic:Fn,ariaAutoComplete:null,ariaBusy:Fn,ariaChecked:Fn,ariaColCount:Me,ariaColIndex:Me,ariaColSpan:Me,ariaControls:gn,ariaCurrent:null,ariaDescribedBy:gn,ariaDetails:null,ariaDisabled:Fn,ariaDropEffect:gn,ariaErrorMessage:null,ariaExpanded:Fn,ariaFlowTo:gn,ariaGrabbed:Fn,ariaHasPopup:null,ariaHidden:Fn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:gn,ariaLevel:Me,ariaLive:null,ariaModal:Fn,ariaMultiLine:Fn,ariaMultiSelectable:Fn,ariaOrientation:null,ariaOwns:gn,ariaPlaceholder:null,ariaPosInSet:Me,ariaPressed:Fn,ariaReadOnly:Fn,ariaRelevant:null,ariaRequired:Fn,ariaRoleDescription:gn,ariaRowCount:Me,ariaRowIndex:Me,ariaRowSpan:Me,ariaSelected:Fn,ariaSetSize:Me,ariaSort:null,ariaValueMax:Me,ariaValueMin:Me,ariaValueNow:Me,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function GC(e,t){return t in e?e[t]:t}function KC(e,t){return GC(e,t.toLowerCase())}const EM=ma({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ra,acceptCharset:gn,accessKey:gn,action:null,allow:null,allowFullScreen:Kt,allowPaymentRequest:Kt,allowUserMedia:Kt,alt:null,as:null,async:Kt,autoCapitalize:null,autoComplete:gn,autoFocus:Kt,autoPlay:Kt,blocking:gn,capture:null,charSet:null,checked:Kt,cite:null,className:gn,cols:Me,colSpan:null,content:null,contentEditable:Fn,controls:Kt,controlsList:gn,coords:Me|ra,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Kt,defer:Kt,dir:null,dirName:null,disabled:Kt,download:jm,draggable:Fn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Kt,formTarget:null,headers:gn,height:Me,hidden:jm,high:Me,href:null,hrefLang:null,htmlFor:gn,httpEquiv:gn,id:null,imageSizes:null,imageSrcSet:null,inert:Kt,inputMode:null,integrity:null,is:null,isMap:Kt,itemId:null,itemProp:gn,itemRef:gn,itemScope:Kt,itemType:gn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Kt,low:Me,manifest:null,max:null,maxLength:Me,media:null,method:null,min:null,minLength:Me,multiple:Kt,muted:Kt,name:null,nonce:null,noModule:Kt,noValidate:Kt,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:Kt,optimum:Me,pattern:null,ping:gn,placeholder:null,playsInline:Kt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Kt,referrerPolicy:null,rel:gn,required:Kt,reversed:Kt,rows:Me,rowSpan:Me,sandbox:gn,scope:null,scoped:Kt,seamless:Kt,selected:Kt,shadowRootClonable:Kt,shadowRootDelegatesFocus:Kt,shadowRootMode:null,shape:null,size:Me,sizes:null,slot:null,span:Me,spellCheck:Fn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Me,step:null,style:null,tabIndex:Me,target:null,title:null,translate:null,type:null,typeMustMatch:Kt,useMap:null,value:Fn,width:Me,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:gn,axis:null,background:null,bgColor:null,border:Me,borderColor:null,bottomMargin:Me,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Kt,declare:Kt,event:null,face:null,frame:null,frameBorder:null,hSpace:Me,leftMargin:Me,link:null,longDesc:null,lowSrc:null,marginHeight:Me,marginWidth:Me,noResize:Kt,noHref:Kt,noShade:Kt,noWrap:Kt,object:null,profile:null,prompt:null,rev:null,rightMargin:Me,rules:null,scheme:null,scrolling:Fn,standby:null,summary:null,text:null,topMargin:Me,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Me,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Kt,disableRemotePlayback:Kt,prefix:null,property:null,results:Me,security:null,unselectable:null},space:"html",transform:KC}),AM=ma({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:Mr,accentHeight:Me,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Me,amplitude:Me,arabicForm:null,ascent:Me,attributeName:null,attributeType:null,azimuth:Me,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Me,by:null,calcMode:null,capHeight:Me,className:gn,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:Me,diffuseConstant:Me,direction:null,display:null,dur:null,divisor:Me,dominantBaseline:null,download:Kt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Me,enableBackground:null,end:null,event:null,exponent:Me,externalResourcesRequired:null,fill:null,fillOpacity:Me,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:ra,g2:ra,glyphName:ra,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Me,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Me,horizOriginX:Me,horizOriginY:Me,id:null,ideographic:Me,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Me,k:Me,k1:Me,k2:Me,k3:Me,k4:Me,kernelMatrix:Mr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Me,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:Me,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:Me,overlineThickness:Me,paintOrder:null,panose1:null,path:null,pathLength:Me,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:gn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Me,pointsAtY:Me,pointsAtZ:Me,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Mr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Mr,rev:Mr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Mr,requiredFeatures:Mr,requiredFonts:Mr,requiredFormats:Mr,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:Me,specularExponent:Me,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Me,strikethroughThickness:Me,string:null,stroke:null,strokeDashArray:Mr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Me,strokeOpacity:Me,strokeWidth:null,style:null,surfaceScale:Me,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Mr,tabIndex:Me,tableValues:null,target:null,targetX:Me,targetY:Me,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Mr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Me,underlineThickness:Me,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Me,values:null,vAlphabetic:Me,vMathematical:Me,vectorEffect:null,vHanging:Me,vIdeographic:Me,version:null,vertAdvY:Me,vertOriginX:Me,vertOriginY:Me,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Me,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:GC}),QC=ma({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()}}),YC=ma({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:KC}),XC=ma({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),IM={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"},LM=/[A-Z]/g,dw=/-[a-z]/g,MM=/^data[-\w.:]+$/i;function DM(e,t){const n=Cm(t);let i=t,a=Tr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&MM.test(t)){if(t.charAt(4)==="-"){const c=t.slice(5).replace(dw,_M);i="data"+c.charAt(0).toUpperCase()+c.slice(1)}else{const c=t.slice(4);if(!dw.test(c)){let l=c.replace(LM,FM);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}a=Rp}return new a(i,t)}function FM(e){return"-"+e.toLowerCase()}function _M(e){return e.charAt(1).toUpperCase()}const OM=$C([VC,EM,QC,YC,XC],"html"),Ep=$C([VC,AM,QC,YC,XC],"svg");function BM(e){return e.join(" ").trim()}var Go={},mf,hw;function UM(){if(hw)return mf;hw=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,i=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,c=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,h=/^\s+|\s+$/g,f=`
70
+ `,p="/",y="*",g="",w="comment",x="declaration";function S(P,A){if(typeof P!="string")throw new TypeError("First argument must be a string");if(!P)return[];A=A||{};var L=1,O=1;function ee(B){var W=B.match(t);W&&(L+=W.length);var Y=B.lastIndexOf(f);O=~Y?B.length-Y:O+B.length}function q(){var B={line:L,column:O};return function(W){return W.position=new _(B),I(),W}}function _(B){this.start=B,this.end={line:L,column:O},this.source=A.source}_.prototype.content=P;function E(B){var W=new Error(A.source+":"+L+":"+O+": "+B);if(W.reason=B,W.filename=A.source,W.line=L,W.column=O,W.source=P,!A.silent)throw W}function M(B){var W=B.exec(P);if(W){var Y=W[0];return ee(Y),P=P.slice(Y.length),W}}function I(){M(n)}function N(B){var W;for(B=B||[];W=z();)W!==!1&&B.push(W);return B}function z(){var B=q();if(!(p!=P.charAt(0)||y!=P.charAt(1))){for(var W=2;g!=P.charAt(W)&&(y!=P.charAt(W)||p!=P.charAt(W+1));)++W;if(W+=2,g===P.charAt(W-1))return E("End of comment missing");var Y=P.slice(2,W-2);return O+=2,ee(Y),P=P.slice(W),O+=2,B({type:w,comment:Y})}}function G(){var B=q(),W=M(i);if(W){if(z(),!M(a))return E("property missing ':'");var Y=M(c),Q=B({type:x,property:C(W[0].replace(e,g)),value:Y?C(Y[0].replace(e,g)):g});return M(l),Q}}function J(){var B=[];N(B);for(var W;W=G();)W!==!1&&(B.push(W),N(B));return B}return I(),J()}function C(P){return P?P.replace(h,g):g}return mf=S,mf}var fw;function WM(){if(fw)return Go;fw=1;var e=Go&&Go.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Go,"__esModule",{value:!0}),Go.default=n;const t=e(UM());function n(i,a){let c=null;if(!i||typeof i!="string")return c;const l=(0,t.default)(i),h=typeof a=="function";return l.forEach(f=>{if(f.type!=="declaration")return;const{property:p,value:y}=f;h?a(p,y,f):y&&(c=c||{},c[p]=y)}),c}return Go}var tl={},mw;function zM(){if(mw)return tl;mw=1,Object.defineProperty(tl,"__esModule",{value:!0}),tl.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,c=function(p){return!p||n.test(p)||e.test(p)},l=function(p,y){return y.toUpperCase()},h=function(p,y){return"".concat(y,"-")},f=function(p,y){return y===void 0&&(y={}),c(p)?p:(p=p.toLowerCase(),y.reactCompat?p=p.replace(a,h):p=p.replace(i,h),p.replace(t,l))};return tl.camelCase=f,tl}var nl,pw;function HM(){if(pw)return nl;pw=1;var e=nl&&nl.__importDefault||function(a){return a&&a.__esModule?a:{default:a}},t=e(WM()),n=zM();function i(a,c){var l={};return!a||typeof a!="string"||(0,t.default)(a,function(h,f){h&&f&&(l[(0,n.camelCase)(h,c)]=f)}),l}return i.default=i,nl=i,nl}var qM=HM();const $M=Ll(qM),JC=ZC("end"),Ap=ZC("start");function ZC(e){return t;function t(n){const i=n&&n.position&&n.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 VM(e){const t=Ap(e),n=JC(e);if(t&&n)return{start:t,end:n}}function pl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?gw(e.position):"start"in e||"end"in e?gw(e):"line"in e||"column"in e?Pm(e):""}function Pm(e){return bw(e&&e.line)+":"+bw(e&&e.column)}function gw(e){return Pm(e&&e.start)+"-"+Pm(e&&e.end)}function bw(e){return e&&typeof e=="number"?e:1}class dr extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let a="",c={},l=!1;if(n&&("line"in n&&"column"in n?c={place:n}:"start"in n&&"end"in n?c={place:n}:"type"in n?c={ancestors:[n],place:n.position}:c={...n}),typeof t=="string"?a=t:!c.cause&&t&&(l=!0,a=t.message,c.cause=t),!c.ruleId&&!c.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?c.ruleId=i:(c.source=i.slice(0,f),c.ruleId=i.slice(f+1))}if(!c.place&&c.ancestors&&c.ancestors){const f=c.ancestors[c.ancestors.length-1];f&&(c.place=f.position)}const h=c.place&&"start"in c.place?c.place.start:c.place;this.ancestors=c.ancestors||void 0,this.cause=c.cause||void 0,this.column=h?h.column:void 0,this.fatal=void 0,this.file="",this.message=a,this.line=h?h.line:void 0,this.name=pl(c.place)||"1:1",this.place=c.place||void 0,this.reason=this.message,this.ruleId=c.ruleId||void 0,this.source=c.source||void 0,this.stack=l&&c.cause&&typeof c.cause.stack=="string"?c.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}dr.prototype.file="";dr.prototype.name="";dr.prototype.reason="";dr.prototype.message="";dr.prototype.stack="";dr.prototype.column=void 0;dr.prototype.line=void 0;dr.prototype.ancestors=void 0;dr.prototype.cause=void 0;dr.prototype.fatal=void 0;dr.prototype.place=void 0;dr.prototype.ruleId=void 0;dr.prototype.source=void 0;const Ip={}.hasOwnProperty,GM=new Map,KM=/[A-Z]/g,QM=new Set(["table","tbody","thead","tfoot","tr"]),YM=new Set(["td","th"]),ej="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function XM(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=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=sD(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=iD(n,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:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Ep:OM,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},c=tj(a,e,void 0);return c&&typeof c!="string"?c:a.create(e,a.Fragment,{children:c||void 0},void 0)}function tj(e,t,n){if(t.type==="element")return JM(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ZM(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return tD(e,t,n);if(t.type==="mdxjsEsm")return eD(e,t);if(t.type==="root")return nD(e,t,n);if(t.type==="text")return rD(e,t)}function JM(e,t,n){const i=e.schema;let a=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(a=Ep,e.schema=a),e.ancestors.push(t);const c=rj(e,t.tagName,!1),l=oD(e,t);let h=Mp(e,t);return QM.has(t.tagName)&&(h=h.filter(function(f){return typeof f=="string"?!TM(f):!0})),nj(e,l,c,t),Lp(l,h),e.ancestors.pop(),e.schema=i,e.create(t,c,l,n)}function ZM(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)}Cl(e,t.position)}function eD(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Cl(e,t.position)}function tD(e,t,n){const i=e.schema;let a=i;t.name==="svg"&&i.space==="html"&&(a=Ep,e.schema=a),e.ancestors.push(t);const c=t.name===null?e.Fragment:rj(e,t.name,!0),l=aD(e,t),h=Mp(e,t);return nj(e,l,c,t),Lp(l,h),e.ancestors.pop(),e.schema=i,e.create(t,c,l,n)}function nD(e,t,n){const i={};return Lp(i,Mp(e,t)),e.create(t,e.Fragment,i,n)}function rD(e,t){return t.value}function nj(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function Lp(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function iD(e,t,n){return i;function i(a,c,l,h){const p=Array.isArray(l.children)?n:t;return h?p(c,l,h):p(c,l)}}function sD(e,t){return n;function n(i,a,c,l){const h=Array.isArray(c.children),f=Ap(i);return t(a,c,l,h,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function oD(e,t){const n={};let i,a;for(a in t.properties)if(a!=="children"&&Ip.call(t.properties,a)){const c=lD(e,a,t.properties[a]);if(c){const[l,h]=c;e.tableCellAlignToStyle&&l==="align"&&typeof h=="string"&&YM.has(t.tagName)?i=h:n[l]=h}}if(i){const c=n.style||(n.style={});c[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function aD(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const c=i.data.estree.body[0];c.type;const l=c.expression;l.type;const h=l.properties[0];h.type,Object.assign(n,e.evaluater.evaluateExpression(h.argument))}else Cl(e,t.position);else{const a=i.name;let c;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const h=i.value.data.estree.body[0];h.type,c=e.evaluater.evaluateExpression(h.expression)}else Cl(e,t.position);else c=i.value===null?!0:i.value;n[a]=c}return n}function Mp(e,t){const n=[];let i=-1;const a=e.passKeys?new Map:GM;for(;++i<t.children.length;){const c=t.children[i];let l;if(e.passKeys){const f=c.type==="element"?c.tagName:c.type==="mdxJsxFlowElement"||c.type==="mdxJsxTextElement"?c.name:void 0;if(f){const p=a.get(f)||0;l=f+"-"+p,a.set(f,p+1)}}const h=tj(e,c,l);h!==void 0&&n.push(h)}return n}function lD(e,t,n){const i=DM(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=i.commaSeparated?SM(n):BM(n)),i.property==="style"){let a=typeof n=="object"?n:cD(e,String(n));return e.stylePropertyNameCase==="css"&&(a=uD(a)),["style",a]}return[e.elementAttributeNameCase==="react"&&i.space?IM[i.property]||i.property:i.attribute,n]}}function cD(e,t){try{return $M(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const i=n,a=new dr("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=ej+"#cannot-parse-style-attribute",a}}function rj(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const a=t.split(".");let c=-1,l;for(;++c<a.length;){const h=lw(a[c])?{type:"Identifier",name:a[c]}:{type:"Literal",value:a[c]};l=l?{type:"MemberExpression",object:l,property:h,computed:!!(c&&h.type==="Literal"),optional:!1}:h}i=l}else i=lw(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const a=i.value;return Ip.call(e.components,a)?e.components[a]:a}if(e.evaluater)return e.evaluater.evaluateExpression(i);Cl(e)}function Cl(e,t){const n=new dr("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=ej+"#cannot-handle-mdx-estrees-without-createevaluater",n}function uD(e){const t={};let n;for(n in e)Ip.call(e,n)&&(t[dD(n)]=e[n]);return t}function dD(e){let t=e.replace(KM,hD);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function hD(e){return"-"+e.toLowerCase()}const pf={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"]},fD={};function Dp(e,t){const n=fD,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,a=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ij(e,i,a)}function ij(e,t,n){if(mD(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return yw(e.children,t,n)}return Array.isArray(e)?yw(e,t,n):""}function yw(e,t,n){const i=[];let a=-1;for(;++a<e.length;)i[a]=ij(e[a],t,n);return i.join("")}function mD(e){return!!(e&&typeof e=="object")}const vw=document.createElement("i");function Fp(e){const t="&"+e+";";vw.innerHTML=t;const n=vw.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function _r(e,t,n,i){const a=e.length;let c=0,l;if(t<0?t=-t>a?0:a+t:t=t>a?a:t,n=n>0?n:0,i.length<1e4)l=Array.from(i),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);c<i.length;)l=i.slice(c,c+1e4),l.unshift(t,0),e.splice(...l),c+=1e4,t+=1e4}function Kr(e,t){return e.length>0?(_r(e,e.length,0,t),e):t}const ww={}.hasOwnProperty;function sj(e){const t={};let n=-1;for(;++n<e.length;)pD(t,e[n]);return t}function pD(e,t){let n;for(n in t){const a=(ww.call(e,n)?e[n]:void 0)||(e[n]={}),c=t[n];let l;if(c)for(l in c){ww.call(a,l)||(a[l]=[]);const h=c[l];gD(a[l],Array.isArray(h)?h:h?[h]:[])}}}function gD(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);_r(e,0,0,i)}function oj(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function ci(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const pr=Ts(/[A-Za-z]/),ur=Ts(/[\dA-Za-z]/),bD=Ts(/[#-'*+\--9=?A-Z^-~]/);function $u(e){return e!==null&&(e<32||e===127)}const Tm=Ts(/\d/),yD=Ts(/[\dA-Fa-f]/),vD=Ts(/[!-/:-@[-`{-~]/);function Et(e){return e!==null&&e<-2}function mn(e){return e!==null&&(e<0||e===32)}function en(e){return e===-2||e===-1||e===32}const dd=Ts(new RegExp("\\p{P}|\\p{S}","u")),ho=Ts(/\s/);function Ts(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function pa(e){const t=[];let n=-1,i=0,a=0;for(;++n<e.length;){const c=e.charCodeAt(n);let l="";if(c===37&&ur(e.charCodeAt(n+1))&&ur(e.charCodeAt(n+2)))a=2;else if(c<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(c))||(l=String.fromCharCode(c));else if(c>55295&&c<57344){const h=e.charCodeAt(n+1);c<56320&&h>56319&&h<57344?(l=String.fromCharCode(c,h),a=1):l="�"}else l=String.fromCharCode(c);l&&(t.push(e.slice(i,n),encodeURIComponent(l)),i=n+a+1,l=""),a&&(n+=a,a=0)}return t.join("")+e.slice(i)}function an(e,t,n,i){const a=i?i-1:Number.POSITIVE_INFINITY;let c=0;return l;function l(f){return en(f)?(e.enter(n),h(f)):t(f)}function h(f){return en(f)&&c++<a?(e.consume(f),h):(e.exit(n),t(f))}}const wD={tokenize:xD};function xD(e){const t=e.attempt(this.parser.constructs.contentInitial,i,a);let n;return t;function i(h){if(h===null){e.consume(h);return}return e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),an(e,t,"linePrefix")}function a(h){return e.enter("paragraph"),c(h)}function c(h){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(h)}function l(h){if(h===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(h);return}return Et(h)?(e.consume(h),e.exit("chunkText"),c):(e.consume(h),l)}}const kD={tokenize:SD},xw={tokenize:CD};function SD(e){const t=this,n=[];let i=0,a,c,l;return h;function h(O){if(i<n.length){const ee=n[i];return t.containerState=ee[1],e.attempt(ee[0].continuation,f,p)(O)}return p(O)}function f(O){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,a&&L();const ee=t.events.length;let q=ee,_;for(;q--;)if(t.events[q][0]==="exit"&&t.events[q][1].type==="chunkFlow"){_=t.events[q][1].end;break}A(i);let E=ee;for(;E<t.events.length;)t.events[E][1].end={..._},E++;return _r(t.events,q+1,0,t.events.slice(ee)),t.events.length=E,p(O)}return h(O)}function p(O){if(i===n.length){if(!a)return w(O);if(a.currentConstruct&&a.currentConstruct.concrete)return S(O);t.interrupt=!!(a.currentConstruct&&!a._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(xw,y,g)(O)}function y(O){return a&&L(),A(i),w(O)}function g(O){return t.parser.lazy[t.now().line]=i!==n.length,l=t.now().offset,S(O)}function w(O){return t.containerState={},e.attempt(xw,x,S)(O)}function x(O){return i++,n.push([t.currentConstruct,t.containerState]),w(O)}function S(O){if(O===null){a&&L(),A(0),e.consume(O);return}return a=a||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:a,contentType:"flow",previous:c}),C(O)}function C(O){if(O===null){P(e.exit("chunkFlow"),!0),A(0),e.consume(O);return}return Et(O)?(e.consume(O),P(e.exit("chunkFlow")),i=0,t.interrupt=void 0,h):(e.consume(O),C)}function P(O,ee){const q=t.sliceStream(O);if(ee&&q.push(null),O.previous=c,c&&(c.next=O),c=O,a.defineSkip(O.start),a.write(q),t.parser.lazy[O.start.line]){let _=a.events.length;for(;_--;)if(a.events[_][1].start.offset<l&&(!a.events[_][1].end||a.events[_][1].end.offset>l))return;const E=t.events.length;let M=E,I,N;for(;M--;)if(t.events[M][0]==="exit"&&t.events[M][1].type==="chunkFlow"){if(I){N=t.events[M][1].end;break}I=!0}for(A(i),_=E;_<t.events.length;)t.events[_][1].end={...N},_++;_r(t.events,M+1,0,t.events.slice(E)),t.events.length=_}}function A(O){let ee=n.length;for(;ee-- >O;){const q=n[ee];t.containerState=q[1],q[0].exit.call(t,e)}n.length=O}function L(){a.write([null]),c=void 0,a=void 0,t.containerState._closeFlow=void 0}}function CD(e,t,n){return an(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function oa(e){if(e===null||mn(e)||ho(e))return 1;if(dd(e))return 2}function hd(e,t,n){const i=[];let a=-1;for(;++a<e.length;){const c=e[a].resolveAll;c&&!i.includes(c)&&(t=c(t,n),i.push(c))}return t}const Rm={name:"attention",resolveAll:jD,tokenize:ND};function jD(e,t){let n=-1,i,a,c,l,h,f,p,y;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(i=n;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[n][1]).charCodeAt(0)){if((e[i][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[i][1].end.offset-e[i][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;f=e[i][1].end.offset-e[i][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const g={...e[i][1].end},w={...e[n][1].start};kw(g,-f),kw(w,f),l={type:f>1?"strongSequence":"emphasisSequence",start:g,end:{...e[i][1].end}},h={type:f>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:w},c={type:f>1?"strongText":"emphasisText",start:{...e[i][1].end},end:{...e[n][1].start}},a={type:f>1?"strong":"emphasis",start:{...l.start},end:{...h.end}},e[i][1].end={...l.start},e[n][1].start={...h.end},p=[],e[i][1].end.offset-e[i][1].start.offset&&(p=Kr(p,[["enter",e[i][1],t],["exit",e[i][1],t]])),p=Kr(p,[["enter",a,t],["enter",l,t],["exit",l,t],["enter",c,t]]),p=Kr(p,hd(t.parser.constructs.insideSpan.null,e.slice(i+1,n),t)),p=Kr(p,[["exit",c,t],["enter",h,t],["exit",h,t],["exit",a,t]]),e[n][1].end.offset-e[n][1].start.offset?(y=2,p=Kr(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):y=0,_r(e,i-1,n-i+3,p),n=i+p.length-y-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function ND(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,a=oa(i);let c;return l;function l(f){return c=f,e.enter("attentionSequence"),h(f)}function h(f){if(f===c)return e.consume(f),h;const p=e.exit("attentionSequence"),y=oa(f),g=!y||y===2&&a||n.includes(f),w=!a||a===2&&y||n.includes(i);return p._open=!!(c===42?g:g&&(a||!w)),p._close=!!(c===42?w:w&&(y||!g)),t(f)}}function kw(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const PD={name:"autolink",tokenize:TD};function TD(e,t,n){let i=0;return a;function a(x){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),c}function c(x){return pr(x)?(e.consume(x),l):x===64?n(x):p(x)}function l(x){return x===43||x===45||x===46||ur(x)?(i=1,h(x)):p(x)}function h(x){return x===58?(e.consume(x),i=0,f):(x===43||x===45||x===46||ur(x))&&i++<32?(e.consume(x),h):(i=0,p(x))}function f(x){return x===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):x===null||x===32||x===60||$u(x)?n(x):(e.consume(x),f)}function p(x){return x===64?(e.consume(x),y):bD(x)?(e.consume(x),p):n(x)}function y(x){return ur(x)?g(x):n(x)}function g(x){return x===46?(e.consume(x),i=0,y):x===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(x),e.exit("autolinkMarker"),e.exit("autolink"),t):w(x)}function w(x){if((x===45||ur(x))&&i++<63){const S=x===45?w:g;return e.consume(x),S}return n(x)}}const Hl={partial:!0,tokenize:RD};function RD(e,t,n){return i;function i(c){return en(c)?an(e,a,"linePrefix")(c):a(c)}function a(c){return c===null||Et(c)?t(c):n(c)}}const aj={continuation:{tokenize:AD},exit:ID,name:"blockQuote",tokenize:ED};function ED(e,t,n){const i=this;return a;function a(l){if(l===62){const h=i.containerState;return h.open||(e.enter("blockQuote",{_container:!0}),h.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),c}return n(l)}function c(l){return en(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function AD(e,t,n){const i=this;return a;function a(l){return en(l)?an(e,c,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):c(l)}function c(l){return e.attempt(aj,t,n)(l)}}function ID(e){e.exit("blockQuote")}const lj={name:"characterEscape",tokenize:LD};function LD(e,t,n){return i;function i(c){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(c),e.exit("escapeMarker"),a}function a(c){return vD(c)?(e.enter("characterEscapeValue"),e.consume(c),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(c)}}const cj={name:"characterReference",tokenize:MD};function MD(e,t,n){const i=this;let a=0,c,l;return h;function h(g){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),f}function f(g){return g===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(g),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),c=31,l=ur,y(g))}function p(g){return g===88||g===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(g),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),c=6,l=yD,y):(e.enter("characterReferenceValue"),c=7,l=Tm,y(g))}function y(g){if(g===59&&a){const w=e.exit("characterReferenceValue");return l===ur&&!Fp(i.sliceSerialize(w))?n(g):(e.enter("characterReferenceMarker"),e.consume(g),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(g)&&a++<c?(e.consume(g),y):n(g)}}const Sw={partial:!0,tokenize:FD},Cw={concrete:!0,name:"codeFenced",tokenize:DD};function DD(e,t,n){const i=this,a={partial:!0,tokenize:q};let c=0,l=0,h;return f;function f(_){return p(_)}function p(_){const E=i.events[i.events.length-1];return c=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,h=_,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),y(_)}function y(_){return _===h?(l++,e.consume(_),y):l<3?n(_):(e.exit("codeFencedFenceSequence"),en(_)?an(e,g,"whitespace")(_):g(_))}function g(_){return _===null||Et(_)?(e.exit("codeFencedFence"),i.interrupt?t(_):e.check(Sw,C,ee)(_)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),w(_))}function w(_){return _===null||Et(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),g(_)):en(_)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),an(e,x,"whitespace")(_)):_===96&&_===h?n(_):(e.consume(_),w)}function x(_){return _===null||Et(_)?g(_):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),S(_))}function S(_){return _===null||Et(_)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),g(_)):_===96&&_===h?n(_):(e.consume(_),S)}function C(_){return e.attempt(a,ee,P)(_)}function P(_){return e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),A}function A(_){return c>0&&en(_)?an(e,L,"linePrefix",c+1)(_):L(_)}function L(_){return _===null||Et(_)?e.check(Sw,C,ee)(_):(e.enter("codeFlowValue"),O(_))}function O(_){return _===null||Et(_)?(e.exit("codeFlowValue"),L(_)):(e.consume(_),O)}function ee(_){return e.exit("codeFenced"),t(_)}function q(_,E,M){let I=0;return N;function N(W){return _.enter("lineEnding"),_.consume(W),_.exit("lineEnding"),z}function z(W){return _.enter("codeFencedFence"),en(W)?an(_,G,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(W):G(W)}function G(W){return W===h?(_.enter("codeFencedFenceSequence"),J(W)):M(W)}function J(W){return W===h?(I++,_.consume(W),J):I>=l?(_.exit("codeFencedFenceSequence"),en(W)?an(_,B,"whitespace")(W):B(W)):M(W)}function B(W){return W===null||Et(W)?(_.exit("codeFencedFence"),E(W)):M(W)}}}function FD(e,t,n){const i=this;return a;function a(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),c)}function c(l){return i.parser.lazy[i.now().line]?n(l):t(l)}}const gf={name:"codeIndented",tokenize:OD},_D={partial:!0,tokenize:BD};function OD(e,t,n){const i=this;return a;function a(p){return e.enter("codeIndented"),an(e,c,"linePrefix",5)(p)}function c(p){const y=i.events[i.events.length-1];return y&&y[1].type==="linePrefix"&&y[2].sliceSerialize(y[1],!0).length>=4?l(p):n(p)}function l(p){return p===null?f(p):Et(p)?e.attempt(_D,l,f)(p):(e.enter("codeFlowValue"),h(p))}function h(p){return p===null||Et(p)?(e.exit("codeFlowValue"),l(p)):(e.consume(p),h)}function f(p){return e.exit("codeIndented"),t(p)}}function BD(e,t,n){const i=this;return a;function a(l){return i.parser.lazy[i.now().line]?n(l):Et(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):an(e,c,"linePrefix",5)(l)}function c(l){const h=i.events[i.events.length-1];return h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(l):Et(l)?a(l):n(l)}}const UD={name:"codeText",previous:zD,resolve:WD,tokenize:HD};function WD(e){let t=e.length-4,n=3,i,a;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-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 zD(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function HD(e,t,n){let i=0,a,c;return l;function l(g){return e.enter("codeText"),e.enter("codeTextSequence"),h(g)}function h(g){return g===96?(e.consume(g),i++,h):(e.exit("codeTextSequence"),f(g))}function f(g){return g===null?n(g):g===32?(e.enter("space"),e.consume(g),e.exit("space"),f):g===96?(c=e.enter("codeTextSequence"),a=0,y(g)):Et(g)?(e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),f):(e.enter("codeTextData"),p(g))}function p(g){return g===null||g===32||g===96||Et(g)?(e.exit("codeTextData"),f(g)):(e.consume(g),p)}function y(g){return g===96?(e.consume(g),a++,y):a===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(g)):(c.type="codeTextData",p(g))}}class qD{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??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,n,i){const a=n||0;this.setCursor(Math.trunc(t));const c=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);return i&&rl(this.left,i),c.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),rl(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),rl(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);rl(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);rl(this.left,n.reverse())}}}function rl(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function uj(e){const t={};let n=-1,i,a,c,l,h,f,p;const y=new qD(e);for(;++n<y.length;){for(;n in t;)n=t[n];if(i=y.get(n),n&&i[1].type==="chunkFlow"&&y.get(n-1)[1].type==="listItemPrefix"&&(f=i[1]._tokenizer.events,c=0,c<f.length&&f[c][1].type==="lineEndingBlank"&&(c+=2),c<f.length&&f[c][1].type==="content"))for(;++c<f.length&&f[c][1].type!=="content";)f[c][1].type==="chunkText"&&(f[c][1]._isInFirstContentOfListItem=!0,c++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,$D(y,n)),n=t[n],p=!0);else if(i[1]._container){for(c=n,a=void 0;c--;)if(l=y.get(c),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(a&&(y.get(a)[1].type="lineEndingBlank"),l[1].type="lineEnding",a=c);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;a&&(i[1].end={...y.get(a)[1].start},h=y.slice(a,n),h.unshift(i),y.splice(a,n-a+1,h))}}return _r(e,0,Number.POSITIVE_INFINITY,y.slice(0)),!p}function $D(e,t){const n=e.get(t)[1],i=e.get(t)[2];let a=t-1;const c=[];let l=n._tokenizer;l||(l=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const h=l.events,f=[],p={};let y,g,w=-1,x=n,S=0,C=0;const P=[C];for(;x;){for(;e.get(++a)[1]!==x;);c.push(a),x._tokenizer||(y=i.sliceStream(x),x.next||y.push(null),g&&l.defineSkip(x.start),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(y),x._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),g=x,x=x.next}for(x=n;++w<h.length;)h[w][0]==="exit"&&h[w-1][0]==="enter"&&h[w][1].type===h[w-1][1].type&&h[w][1].start.line!==h[w][1].end.line&&(C=w+1,P.push(C),x._tokenizer=void 0,x.previous=void 0,x=x.next);for(l.events=[],x?(x._tokenizer=void 0,x.previous=void 0):P.pop(),w=P.length;w--;){const A=h.slice(P[w],P[w+1]),L=c.pop();f.push([L,L+A.length-1]),e.splice(L,2,A)}for(f.reverse(),w=-1;++w<f.length;)p[S+f[w][0]]=S+f[w][1],S+=f[w][1]-f[w][0]-1;return p}const VD={resolve:KD,tokenize:QD},GD={partial:!0,tokenize:YD};function KD(e){return uj(e),e}function QD(e,t){let n;return i;function i(h){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),a(h)}function a(h){return h===null?c(h):Et(h)?e.check(GD,l,c)(h):(e.consume(h),a)}function c(h){return e.exit("chunkContent"),e.exit("content"),t(h)}function l(h){return e.consume(h),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,a}}function YD(e,t,n){const i=this;return a;function a(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),an(e,c,"linePrefix")}function c(l){if(l===null||Et(l))return n(l);const h=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&h&&h[1].type==="linePrefix"&&h[2].sliceSerialize(h[1],!0).length>=4?t(l):e.interrupt(i.parser.constructs.flow,n,t)(l)}}function dj(e,t,n,i,a,c,l,h,f){const p=f||Number.POSITIVE_INFINITY;let y=0;return g;function g(A){return A===60?(e.enter(i),e.enter(a),e.enter(c),e.consume(A),e.exit(c),w):A===null||A===32||A===41||$u(A)?n(A):(e.enter(i),e.enter(l),e.enter(h),e.enter("chunkString",{contentType:"string"}),C(A))}function w(A){return A===62?(e.enter(c),e.consume(A),e.exit(c),e.exit(a),e.exit(i),t):(e.enter(h),e.enter("chunkString",{contentType:"string"}),x(A))}function x(A){return A===62?(e.exit("chunkString"),e.exit(h),w(A)):A===null||A===60||Et(A)?n(A):(e.consume(A),A===92?S:x)}function S(A){return A===60||A===62||A===92?(e.consume(A),x):x(A)}function C(A){return!y&&(A===null||A===41||mn(A))?(e.exit("chunkString"),e.exit(h),e.exit(l),e.exit(i),t(A)):y<p&&A===40?(e.consume(A),y++,C):A===41?(e.consume(A),y--,C):A===null||A===32||A===40||$u(A)?n(A):(e.consume(A),A===92?P:C)}function P(A){return A===40||A===41||A===92?(e.consume(A),C):C(A)}}function hj(e,t,n,i,a,c){const l=this;let h=0,f;return p;function p(x){return e.enter(i),e.enter(a),e.consume(x),e.exit(a),e.enter(c),y}function y(x){return h>999||x===null||x===91||x===93&&!f||x===94&&!h&&"_hiddenFootnoteSupport"in l.parser.constructs?n(x):x===93?(e.exit(c),e.enter(a),e.consume(x),e.exit(a),e.exit(i),t):Et(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),y):(e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||x===91||x===93||Et(x)||h++>999?(e.exit("chunkString"),y(x)):(e.consume(x),f||(f=!en(x)),x===92?w:g)}function w(x){return x===91||x===92||x===93?(e.consume(x),h++,g):g(x)}}function fj(e,t,n,i,a,c){let l;return h;function h(w){return w===34||w===39||w===40?(e.enter(i),e.enter(a),e.consume(w),e.exit(a),l=w===40?41:w,f):n(w)}function f(w){return w===l?(e.enter(a),e.consume(w),e.exit(a),e.exit(i),t):(e.enter(c),p(w))}function p(w){return w===l?(e.exit(c),f(l)):w===null?n(w):Et(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),an(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===l||w===null||Et(w)?(e.exit("chunkString"),p(w)):(e.consume(w),w===92?g:y)}function g(w){return w===l||w===92?(e.consume(w),y):y(w)}}function gl(e,t){let n;return i;function i(a){return Et(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),n=!0,i):en(a)?an(e,i,n?"linePrefix":"lineSuffix")(a):t(a)}}const XD={name:"definition",tokenize:ZD},JD={partial:!0,tokenize:eF};function ZD(e,t,n){const i=this;let a;return c;function c(x){return e.enter("definition"),l(x)}function l(x){return hj.call(i,e,h,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function h(x){return a=ci(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),f):n(x)}function f(x){return mn(x)?gl(e,p)(x):p(x)}function p(x){return dj(e,y,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function y(x){return e.attempt(JD,g,g)(x)}function g(x){return en(x)?an(e,w,"whitespace")(x):w(x)}function w(x){return x===null||Et(x)?(e.exit("definition"),i.parser.defined.push(a),t(x)):n(x)}}function eF(e,t,n){return i;function i(h){return mn(h)?gl(e,a)(h):n(h)}function a(h){return fj(e,c,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(h)}function c(h){return en(h)?an(e,l,"whitespace")(h):l(h)}function l(h){return h===null||Et(h)?t(h):n(h)}}const tF={name:"hardBreakEscape",tokenize:nF};function nF(e,t,n){return i;function i(c){return e.enter("hardBreakEscape"),e.consume(c),a}function a(c){return Et(c)?(e.exit("hardBreakEscape"),t(c)):n(c)}}const rF={name:"headingAtx",resolve:iF,tokenize:sF};function iF(e,t){let n=e.length-2,i=3,a,c;return e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i&&(a={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},c={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"},_r(e,i,n-i+1,[["enter",a,t],["enter",c,t],["exit",c,t],["exit",a,t]])),e}function sF(e,t,n){let i=0;return a;function a(y){return e.enter("atxHeading"),c(y)}function c(y){return e.enter("atxHeadingSequence"),l(y)}function l(y){return y===35&&i++<6?(e.consume(y),l):y===null||mn(y)?(e.exit("atxHeadingSequence"),h(y)):n(y)}function h(y){return y===35?(e.enter("atxHeadingSequence"),f(y)):y===null||Et(y)?(e.exit("atxHeading"),t(y)):en(y)?an(e,h,"whitespace")(y):(e.enter("atxHeadingText"),p(y))}function f(y){return y===35?(e.consume(y),f):(e.exit("atxHeadingSequence"),h(y))}function p(y){return y===null||y===35||mn(y)?(e.exit("atxHeadingText"),h(y)):(e.consume(y),p)}}const oF=["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"],jw=["pre","script","style","textarea"],aF={concrete:!0,name:"htmlFlow",resolveTo:uF,tokenize:dF},lF={partial:!0,tokenize:fF},cF={partial:!0,tokenize:hF};function uF(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 dF(e,t,n){const i=this;let a,c,l,h,f;return p;function p(F){return y(F)}function y(F){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(F),g}function g(F){return F===33?(e.consume(F),w):F===47?(e.consume(F),c=!0,C):F===63?(e.consume(F),a=3,i.interrupt?t:R):pr(F)?(e.consume(F),l=String.fromCharCode(F),P):n(F)}function w(F){return F===45?(e.consume(F),a=2,x):F===91?(e.consume(F),a=5,h=0,S):pr(F)?(e.consume(F),a=4,i.interrupt?t:R):n(F)}function x(F){return F===45?(e.consume(F),i.interrupt?t:R):n(F)}function S(F){const we="CDATA[";return F===we.charCodeAt(h++)?(e.consume(F),h===we.length?i.interrupt?t:G:S):n(F)}function C(F){return pr(F)?(e.consume(F),l=String.fromCharCode(F),P):n(F)}function P(F){if(F===null||F===47||F===62||mn(F)){const we=F===47,ce=l.toLowerCase();return!we&&!c&&jw.includes(ce)?(a=1,i.interrupt?t(F):G(F)):oF.includes(l.toLowerCase())?(a=6,we?(e.consume(F),A):i.interrupt?t(F):G(F)):(a=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(F):c?L(F):O(F))}return F===45||ur(F)?(e.consume(F),l+=String.fromCharCode(F),P):n(F)}function A(F){return F===62?(e.consume(F),i.interrupt?t:G):n(F)}function L(F){return en(F)?(e.consume(F),L):N(F)}function O(F){return F===47?(e.consume(F),N):F===58||F===95||pr(F)?(e.consume(F),ee):en(F)?(e.consume(F),O):N(F)}function ee(F){return F===45||F===46||F===58||F===95||ur(F)?(e.consume(F),ee):q(F)}function q(F){return F===61?(e.consume(F),_):en(F)?(e.consume(F),q):O(F)}function _(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(e.consume(F),f=F,E):en(F)?(e.consume(F),_):M(F)}function E(F){return F===f?(e.consume(F),f=null,I):F===null||Et(F)?n(F):(e.consume(F),E)}function M(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||mn(F)?q(F):(e.consume(F),M)}function I(F){return F===47||F===62||en(F)?O(F):n(F)}function N(F){return F===62?(e.consume(F),z):n(F)}function z(F){return F===null||Et(F)?G(F):en(F)?(e.consume(F),z):n(F)}function G(F){return F===45&&a===2?(e.consume(F),Y):F===60&&a===1?(e.consume(F),Q):F===62&&a===4?(e.consume(F),$):F===63&&a===3?(e.consume(F),R):F===93&&a===5?(e.consume(F),re):Et(F)&&(a===6||a===7)?(e.exit("htmlFlowData"),e.check(lF,Z,J)(F)):F===null||Et(F)?(e.exit("htmlFlowData"),J(F)):(e.consume(F),G)}function J(F){return e.check(cF,B,Z)(F)}function B(F){return e.enter("lineEnding"),e.consume(F),e.exit("lineEnding"),W}function W(F){return F===null||Et(F)?J(F):(e.enter("htmlFlowData"),G(F))}function Y(F){return F===45?(e.consume(F),R):G(F)}function Q(F){return F===47?(e.consume(F),l="",D):G(F)}function D(F){if(F===62){const we=l.toLowerCase();return jw.includes(we)?(e.consume(F),$):G(F)}return pr(F)&&l.length<8?(e.consume(F),l+=String.fromCharCode(F),D):G(F)}function re(F){return F===93?(e.consume(F),R):G(F)}function R(F){return F===62?(e.consume(F),$):F===45&&a===2?(e.consume(F),R):G(F)}function $(F){return F===null||Et(F)?(e.exit("htmlFlowData"),Z(F)):(e.consume(F),$)}function Z(F){return e.exit("htmlFlow"),t(F)}}function hF(e,t,n){const i=this;return a;function a(l){return Et(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),c):n(l)}function c(l){return i.parser.lazy[i.now().line]?n(l):t(l)}}function fF(e,t,n){return i;function i(a){return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),e.attempt(Hl,t,n)}}const mF={name:"htmlText",tokenize:pF};function pF(e,t,n){const i=this;let a,c,l;return h;function h(R){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(R),f}function f(R){return R===33?(e.consume(R),p):R===47?(e.consume(R),q):R===63?(e.consume(R),O):pr(R)?(e.consume(R),M):n(R)}function p(R){return R===45?(e.consume(R),y):R===91?(e.consume(R),c=0,S):pr(R)?(e.consume(R),L):n(R)}function y(R){return R===45?(e.consume(R),x):n(R)}function g(R){return R===null?n(R):R===45?(e.consume(R),w):Et(R)?(l=g,Q(R)):(e.consume(R),g)}function w(R){return R===45?(e.consume(R),x):g(R)}function x(R){return R===62?Y(R):R===45?w(R):g(R)}function S(R){const $="CDATA[";return R===$.charCodeAt(c++)?(e.consume(R),c===$.length?C:S):n(R)}function C(R){return R===null?n(R):R===93?(e.consume(R),P):Et(R)?(l=C,Q(R)):(e.consume(R),C)}function P(R){return R===93?(e.consume(R),A):C(R)}function A(R){return R===62?Y(R):R===93?(e.consume(R),A):C(R)}function L(R){return R===null||R===62?Y(R):Et(R)?(l=L,Q(R)):(e.consume(R),L)}function O(R){return R===null?n(R):R===63?(e.consume(R),ee):Et(R)?(l=O,Q(R)):(e.consume(R),O)}function ee(R){return R===62?Y(R):O(R)}function q(R){return pr(R)?(e.consume(R),_):n(R)}function _(R){return R===45||ur(R)?(e.consume(R),_):E(R)}function E(R){return Et(R)?(l=E,Q(R)):en(R)?(e.consume(R),E):Y(R)}function M(R){return R===45||ur(R)?(e.consume(R),M):R===47||R===62||mn(R)?I(R):n(R)}function I(R){return R===47?(e.consume(R),Y):R===58||R===95||pr(R)?(e.consume(R),N):Et(R)?(l=I,Q(R)):en(R)?(e.consume(R),I):Y(R)}function N(R){return R===45||R===46||R===58||R===95||ur(R)?(e.consume(R),N):z(R)}function z(R){return R===61?(e.consume(R),G):Et(R)?(l=z,Q(R)):en(R)?(e.consume(R),z):I(R)}function G(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(e.consume(R),a=R,J):Et(R)?(l=G,Q(R)):en(R)?(e.consume(R),G):(e.consume(R),B)}function J(R){return R===a?(e.consume(R),a=void 0,W):R===null?n(R):Et(R)?(l=J,Q(R)):(e.consume(R),J)}function B(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||mn(R)?I(R):(e.consume(R),B)}function W(R){return R===47||R===62||mn(R)?I(R):n(R)}function Y(R){return R===62?(e.consume(R),e.exit("htmlTextData"),e.exit("htmlText"),t):n(R)}function Q(R){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(R),e.exit("lineEnding"),D}function D(R){return en(R)?an(e,re,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):re(R)}function re(R){return e.enter("htmlTextData"),l(R)}}const _p={name:"labelEnd",resolveAll:vF,resolveTo:wF,tokenize:xF},gF={tokenize:kF},bF={tokenize:SF},yF={tokenize:CF};function vF(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.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!==n.length&&_r(e,0,e.length,n),e}function wF(e,t){let n=e.length,i=0,a,c,l,h;for(;n--;)if(a=e[n][1],c){if(a.type==="link"||a.type==="labelLink"&&a._inactive)break;e[n][0]==="enter"&&a.type==="labelLink"&&(a._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(a.type==="labelImage"||a.type==="labelLink")&&!a._balanced&&(c=n,a.type!=="labelLink")){i=2;break}}else a.type==="labelEnd"&&(l=n);const f={type:e[c][1].type==="labelLink"?"link":"image",start:{...e[c][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[c][1].start},end:{...e[l][1].end}},y={type:"labelText",start:{...e[c+i+2][1].end},end:{...e[l-2][1].start}};return h=[["enter",f,t],["enter",p,t]],h=Kr(h,e.slice(c+1,c+i+3)),h=Kr(h,[["enter",y,t]]),h=Kr(h,hd(t.parser.constructs.insideSpan.null,e.slice(c+i+4,l-3),t)),h=Kr(h,[["exit",y,t],e[l-2],e[l-1],["exit",p,t]]),h=Kr(h,e.slice(l+1)),h=Kr(h,[["exit",f,t]]),_r(e,c,e.length,h),e}function xF(e,t,n){const i=this;let a=i.events.length,c,l;for(;a--;)if((i.events[a][1].type==="labelImage"||i.events[a][1].type==="labelLink")&&!i.events[a][1]._balanced){c=i.events[a][1];break}return h;function h(w){return c?c._inactive?g(w):(l=i.parser.defined.includes(ci(i.sliceSerialize({start:c.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(w),e.exit("labelMarker"),e.exit("labelEnd"),f):n(w)}function f(w){return w===40?e.attempt(gF,y,l?y:g)(w):w===91?e.attempt(bF,y,l?p:g)(w):l?y(w):g(w)}function p(w){return e.attempt(yF,y,g)(w)}function y(w){return t(w)}function g(w){return c._balanced=!0,n(w)}}function kF(e,t,n){return i;function i(g){return e.enter("resource"),e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),a}function a(g){return mn(g)?gl(e,c)(g):c(g)}function c(g){return g===41?y(g):dj(e,l,h,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function l(g){return mn(g)?gl(e,f)(g):y(g)}function h(g){return n(g)}function f(g){return g===34||g===39||g===40?fj(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):y(g)}function p(g){return mn(g)?gl(e,y)(g):y(g)}function y(g){return g===41?(e.enter("resourceMarker"),e.consume(g),e.exit("resourceMarker"),e.exit("resource"),t):n(g)}}function SF(e,t,n){const i=this;return a;function a(h){return hj.call(i,e,c,l,"reference","referenceMarker","referenceString")(h)}function c(h){return i.parser.defined.includes(ci(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(h):n(h)}function l(h){return n(h)}}function CF(e,t,n){return i;function i(c){return e.enter("reference"),e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),a}function a(c){return c===93?(e.enter("referenceMarker"),e.consume(c),e.exit("referenceMarker"),e.exit("reference"),t):n(c)}}const jF={name:"labelStartImage",resolveAll:_p.resolveAll,tokenize:NF};function NF(e,t,n){const i=this;return a;function a(h){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(h),e.exit("labelImageMarker"),c}function c(h){return h===91?(e.enter("labelMarker"),e.consume(h),e.exit("labelMarker"),e.exit("labelImage"),l):n(h)}function l(h){return h===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(h):t(h)}}const PF={name:"labelStartLink",resolveAll:_p.resolveAll,tokenize:TF};function TF(e,t,n){const i=this;return a;function a(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),c}function c(l){return l===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(l):t(l)}}const bf={name:"lineEnding",tokenize:RF};function RF(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),an(e,t,"linePrefix")}}const ku={name:"thematicBreak",tokenize:EF};function EF(e,t,n){let i=0,a;return c;function c(p){return e.enter("thematicBreak"),l(p)}function l(p){return a=p,h(p)}function h(p){return p===a?(e.enter("thematicBreakSequence"),f(p)):i>=3&&(p===null||Et(p))?(e.exit("thematicBreak"),t(p)):n(p)}function f(p){return p===a?(e.consume(p),i++,f):(e.exit("thematicBreakSequence"),en(p)?an(e,h,"whitespace")(p):h(p))}}const Sr={continuation:{tokenize:MF},exit:FF,name:"list",tokenize:LF},AF={partial:!0,tokenize:_F},IF={partial:!0,tokenize:DF};function LF(e,t,n){const i=this,a=i.events[i.events.length-1];let c=a&&a[1].type==="linePrefix"?a[2].sliceSerialize(a[1],!0).length:0,l=0;return h;function h(x){const S=i.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(S==="listUnordered"?!i.containerState.marker||x===i.containerState.marker:Tm(x)){if(i.containerState.type||(i.containerState.type=S,e.enter(S,{_container:!0})),S==="listUnordered")return e.enter("listItemPrefix"),x===42||x===45?e.check(ku,n,p)(x):p(x);if(!i.interrupt||x===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(x)}return n(x)}function f(x){return Tm(x)&&++l<10?(e.consume(x),f):(!i.interrupt||l<2)&&(i.containerState.marker?x===i.containerState.marker:x===41||x===46)?(e.exit("listItemValue"),p(x)):n(x)}function p(x){return e.enter("listItemMarker"),e.consume(x),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||x,e.check(Hl,i.interrupt?n:y,e.attempt(AF,w,g))}function y(x){return i.containerState.initialBlankLine=!0,c++,w(x)}function g(x){return en(x)?(e.enter("listItemPrefixWhitespace"),e.consume(x),e.exit("listItemPrefixWhitespace"),w):n(x)}function w(x){return i.containerState.size=c+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(x)}}function MF(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(Hl,a,c);function a(h){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,an(e,t,"listItemIndent",i.containerState.size+1)(h)}function c(h){return i.containerState.furtherBlankLines||!en(h)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,l(h)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(IF,t,l)(h))}function l(h){return i.containerState._closeFlow=!0,i.interrupt=void 0,an(e,e.attempt(Sr,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(h)}}function DF(e,t,n){const i=this;return an(e,a,"listItemIndent",i.containerState.size+1);function a(c){const l=i.events[i.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===i.containerState.size?t(c):n(c)}}function FF(e){e.exit(this.containerState.type)}function _F(e,t,n){const i=this;return an(e,a,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function a(c){const l=i.events[i.events.length-1];return!en(c)&&l&&l[1].type==="listItemPrefixWhitespace"?t(c):n(c)}}const Nw={name:"setextUnderline",resolveTo:OF,tokenize:BF};function OF(e,t){let n=e.length,i,a,c;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){i=n;break}e[n][1].type==="paragraph"&&(a=n)}else e[n][1].type==="content"&&e.splice(n,1),!c&&e[n][1].type==="definition"&&(c=n);const l={type:"setextHeading",start:{...e[i][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",c?(e.splice(a,0,["enter",l,t]),e.splice(c+1,0,["exit",e[i][1],t]),e[i][1].end={...e[c][1].end}):e[i][1]=l,e.push(["exit",l,t]),e}function BF(e,t,n){const i=this;let a;return c;function c(p){let y=i.events.length,g;for(;y--;)if(i.events[y][1].type!=="lineEnding"&&i.events[y][1].type!=="linePrefix"&&i.events[y][1].type!=="content"){g=i.events[y][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(e.enter("setextHeadingLine"),a=p,l(p)):n(p)}function l(p){return e.enter("setextHeadingLineSequence"),h(p)}function h(p){return p===a?(e.consume(p),h):(e.exit("setextHeadingLineSequence"),en(p)?an(e,f,"lineSuffix")(p):f(p))}function f(p){return p===null||Et(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const UF={tokenize:WF};function WF(e){const t=this,n=e.attempt(Hl,i,e.attempt(this.parser.constructs.flowInitial,a,an(e,e.attempt(this.parser.constructs.flow,a,e.attempt(VD,a)),"linePrefix")));return n;function i(c){if(c===null){e.consume(c);return}return e.enter("lineEndingBlank"),e.consume(c),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function a(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const zF={resolveAll:pj()},HF=mj("string"),qF=mj("text");function mj(e){return{resolveAll:pj(e==="text"?$F:void 0),tokenize:t};function t(n){const i=this,a=this.parser.constructs[e],c=n.attempt(a,l,h);return l;function l(y){return p(y)?c(y):h(y)}function h(y){if(y===null){n.consume(y);return}return n.enter("data"),n.consume(y),f}function f(y){return p(y)?(n.exit("data"),c(y)):(n.consume(y),f)}function p(y){if(y===null)return!0;const g=a[y];let w=-1;if(g)for(;++w<g.length;){const x=g[w];if(!x.previous||x.previous.call(i,i.previous))return!0}return!1}}}function pj(e){return t;function t(n,i){let a=-1,c;for(;++a<=n.length;)c===void 0?n[a]&&n[a][1].type==="data"&&(c=a,a++):(!n[a]||n[a][1].type!=="data")&&(a!==c+2&&(n[c][1].end=n[a-1][1].end,n.splice(c+2,a-c-2),a=c+2),c=void 0);return e?e(n,i):n}}function $F(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const i=e[n-1][1],a=t.sliceStream(i);let c=a.length,l=-1,h=0,f;for(;c--;){const p=a[c];if(typeof p=="string"){for(l=p.length;p.charCodeAt(l-1)===32;)h++,l--;if(l)break;l=-1}else if(p===-2)f=!0,h++;else if(p!==-1){c++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(h=0),h){const p={type:n===e.length||f||h<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:c?l:i.start._bufferIndex+l,_index:i.start._index+c,line:i.end.line,column:i.end.column-h,offset:i.end.offset-h},end:{...i.end}};i.end={...p.start},i.start.offset===i.end.offset?Object.assign(i,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const VF={42:Sr,43:Sr,45:Sr,48:Sr,49:Sr,50:Sr,51:Sr,52:Sr,53:Sr,54:Sr,55:Sr,56:Sr,57:Sr,62:aj},GF={91:XD},KF={[-2]:gf,[-1]:gf,32:gf},QF={35:rF,42:ku,45:[Nw,ku],60:aF,61:Nw,95:ku,96:Cw,126:Cw},YF={38:cj,92:lj},XF={[-5]:bf,[-4]:bf,[-3]:bf,33:jF,38:cj,42:Rm,60:[PD,mF],91:PF,92:[tF,lj],93:_p,95:Rm,96:UD},JF={null:[Rm,zF]},ZF={null:[42,95]},e_={null:[]},t_=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:ZF,contentInitial:GF,disable:e_,document:VF,flow:QF,flowInitial:KF,insideSpan:JF,string:YF,text:XF},Symbol.toStringTag,{value:"Module"}));function n_(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const a={},c=[];let l=[],h=[];const f={attempt:E(q),check:E(_),consume:L,enter:O,exit:ee,interrupt:E(_,{interrupt:!0})},p={code:null,containerState:{},defineSkip:C,events:[],now:S,parser:e,previous:null,sliceSerialize:w,sliceStream:x,write:g};let y=t.tokenize.call(p,f);return t.resolveAll&&c.push(t),p;function g(z){return l=Kr(l,z),P(),l[l.length-1]!==null?[]:(M(t,0),p.events=hd(c,p.events,p),p.events)}function w(z,G){return i_(x(z),G)}function x(z){return r_(l,z)}function S(){const{_bufferIndex:z,_index:G,line:J,column:B,offset:W}=i;return{_bufferIndex:z,_index:G,line:J,column:B,offset:W}}function C(z){a[z.line]=z.column,N()}function P(){let z;for(;i._index<l.length;){const G=l[i._index];if(typeof G=="string")for(z=i._index,i._bufferIndex<0&&(i._bufferIndex=0);i._index===z&&i._bufferIndex<G.length;)A(G.charCodeAt(i._bufferIndex));else A(G)}}function A(z){y=y(z)}function L(z){Et(z)?(i.line++,i.column=1,i.offset+=z===-3?2:1,N()):z!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===l[i._index].length&&(i._bufferIndex=-1,i._index++)),p.previous=z}function O(z,G){const J=G||{};return J.type=z,J.start=S(),p.events.push(["enter",J,p]),h.push(J),J}function ee(z){const G=h.pop();return G.end=S(),p.events.push(["exit",G,p]),G}function q(z,G){M(z,G.from)}function _(z,G){G.restore()}function E(z,G){return J;function J(B,W,Y){let Q,D,re,R;return Array.isArray(B)?Z(B):"tokenize"in B?Z([B]):$(B);function $(be){return Ve;function Ve(ze){const yt=ze!==null&&be[ze],ft=ze!==null&&be.null,Ot=[...Array.isArray(yt)?yt:yt?[yt]:[],...Array.isArray(ft)?ft:ft?[ft]:[]];return Z(Ot)(ze)}}function Z(be){return Q=be,D=0,be.length===0?Y:F(be[D])}function F(be){return Ve;function Ve(ze){return R=I(),re=be,be.partial||(p.currentConstruct=be),be.name&&p.parser.constructs.disable.null.includes(be.name)?ce():be.tokenize.call(G?Object.assign(Object.create(p),G):p,f,we,ce)(ze)}}function we(be){return z(re,R),W}function ce(be){return R.restore(),++D<Q.length?F(Q[D]):Y}}}function M(z,G){z.resolveAll&&!c.includes(z)&&c.push(z),z.resolve&&_r(p.events,G,p.events.length-G,z.resolve(p.events.slice(G),p)),z.resolveTo&&(p.events=z.resolveTo(p.events,p))}function I(){const z=S(),G=p.previous,J=p.currentConstruct,B=p.events.length,W=Array.from(h);return{from:B,restore:Y};function Y(){i=z,p.previous=G,p.currentConstruct=J,p.events.length=B,h=W,N()}}function N(){i.line in a&&i.column<2&&(i.column=a[i.line],i.offset+=a[i.line]-1)}}function r_(e,t){const n=t.start._index,i=t.start._bufferIndex,a=t.end._index,c=t.end._bufferIndex;let l;if(n===a)l=[e[n].slice(i,c)];else{if(l=e.slice(n,a),i>-1){const h=l[0];typeof h=="string"?l[0]=h.slice(i):l.shift()}c>0&&l.push(e[a].slice(0,c))}return l}function i_(e,t){let n=-1;const i=[];let a;for(;++n<e.length;){const c=e[n];let l;if(typeof c=="string")l=c;else switch(c){case-5:{l="\r";break}case-4:{l=`
71
+ `;break}case-3:{l=`\r
72
+ `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&a)continue;l=" ";break}default:l=String.fromCharCode(c)}a=c===-2,i.push(l)}return i.join("")}function s_(e){const i={constructs:sj([t_,...(e||{}).extensions||[]]),content:a(wD),defined:[],document:a(kD),flow:a(UF),lazy:{},string:a(HF),text:a(qF)};return i;function a(c){return l;function l(h){return n_(i,c,h)}}}function o_(e){for(;!uj(e););return e}const Pw=/[\0\t\n\r]/g;function a_(){let e=1,t="",n=!0,i;return a;function a(c,l,h){const f=[];let p,y,g,w,x;for(c=t+(typeof c=="string"?c.toString():new TextDecoder(l||void 0).decode(c)),g=0,t="",n&&(c.charCodeAt(0)===65279&&g++,n=void 0);g<c.length;){if(Pw.lastIndex=g,p=Pw.exec(c),w=p&&p.index!==void 0?p.index:c.length,x=c.charCodeAt(w),!p){t=c.slice(g);break}if(x===10&&g===w&&i)f.push(-3),i=void 0;else switch(i&&(f.push(-5),i=void 0),g<w&&(f.push(c.slice(g,w)),e+=w-g),x){case 0:{f.push(65533),e++;break}case 9:{for(y=Math.ceil(e/4)*4,f.push(-2);e++<y;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:i=!0,e=1}g=w+1}return h&&(i&&f.push(-5),t&&f.push(t),f.push(null)),f}}const l_=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function c_(e){return e.replace(l_,u_)}function u_(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const a=n.charCodeAt(1),c=a===120||a===88;return oj(n.slice(c?2:1),c?16:10)}return Fp(n)||e}const gj={}.hasOwnProperty;function d_(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),h_(n)(o_(s_(n).document().write(a_()(e,t,!0))))}function h_(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:c(ye),autolinkProtocol:I,autolinkEmail:I,atxHeading:c(Mt),blockQuote:c(ft),characterEscape:I,characterReference:I,codeFenced:c(Ot),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:c(Ot,l),codeText:c(Ke,l),codeTextData:I,data:I,codeFlowValue:I,definition:c(jt),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:c(pt),hardBreakEscape:c(xt),hardBreakTrailing:c(xt),htmlFlow:c(Dt,l),htmlFlowData:I,htmlText:c(Dt,l),htmlTextData:I,image:c(wt),label:l,link:c(ye),listItem:c(kt),listItemValue:w,listOrdered:c(Fe,g),listUnordered:c(Fe),paragraph:c(lt),reference:F,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:c(Mt),strong:c(gt),thematicBreak:c(nt)},exit:{atxHeading:f(),atxHeadingSequence:q,autolink:f(),autolinkEmail:yt,autolinkProtocol:ze,blockQuote:f(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:be,characterReference:Ve,codeFenced:f(P),codeFencedFence:C,codeFencedFenceInfo:x,codeFencedFenceMeta:S,codeFlowValue:N,codeIndented:f(A),codeText:f(W),codeTextData:N,data:N,definition:f(),definitionDestinationString:ee,definitionLabelString:L,definitionTitleString:O,emphasis:f(),hardBreakEscape:f(G),hardBreakTrailing:f(G),htmlFlow:f(J),htmlFlowData:N,htmlText:f(B),htmlTextData:N,image:f(Q),label:re,labelText:D,lineEnding:z,link:f(Y),listItem:f(),listOrdered:f(),listUnordered:f(),paragraph:f(),referenceString:we,resourceDestinationString:R,resourceTitleString:$,resource:Z,setextHeading:f(M),setextHeadingLineSequence:E,setextHeadingText:_,strong:f(),thematicBreak:f()}};bj(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(fe){let ge={type:"root",children:[]};const Te={stack:[ge],tokenStack:[],config:t,enter:h,exit:p,buffer:l,resume:y,data:n},qe=[];let dt=-1;for(;++dt<fe.length;)if(fe[dt][1].type==="listOrdered"||fe[dt][1].type==="listUnordered")if(fe[dt][0]==="enter")qe.push(dt);else{const St=qe.pop();dt=a(fe,St,dt)}for(dt=-1;++dt<fe.length;){const St=t[fe[dt][0]];gj.call(St,fe[dt][1].type)&&St[fe[dt][1].type].call(Object.assign({sliceSerialize:fe[dt][2].sliceSerialize},Te),fe[dt][1])}if(Te.tokenStack.length>0){const St=Te.tokenStack[Te.tokenStack.length-1];(St[1]||Tw).call(Te,void 0,St[0])}for(ge.position={start:fs(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:fs(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},dt=-1;++dt<t.transforms.length;)ge=t.transforms[dt](ge)||ge;return ge}function a(fe,ge,Te){let qe=ge-1,dt=-1,St=!1,rt,Ut,mt,Bt;for(;++qe<=Te;){const At=fe[qe];switch(At[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{At[0]==="enter"?dt++:dt--,Bt=void 0;break}case"lineEndingBlank":{At[0]==="enter"&&(rt&&!Bt&&!dt&&!mt&&(mt=qe),Bt=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Bt=void 0}if(!dt&&At[0]==="enter"&&At[1].type==="listItemPrefix"||dt===-1&&At[0]==="exit"&&(At[1].type==="listUnordered"||At[1].type==="listOrdered")){if(rt){let vt=qe;for(Ut=void 0;vt--;){const Nt=fe[vt];if(Nt[1].type==="lineEnding"||Nt[1].type==="lineEndingBlank"){if(Nt[0]==="exit")continue;Ut&&(fe[Ut][1].type="lineEndingBlank",St=!0),Nt[1].type="lineEnding",Ut=vt}else if(!(Nt[1].type==="linePrefix"||Nt[1].type==="blockQuotePrefix"||Nt[1].type==="blockQuotePrefixWhitespace"||Nt[1].type==="blockQuoteMarker"||Nt[1].type==="listItemIndent"))break}mt&&(!Ut||mt<Ut)&&(rt._spread=!0),rt.end=Object.assign({},Ut?fe[Ut][1].start:At[1].end),fe.splice(Ut||qe,0,["exit",rt,At[2]]),qe++,Te++}if(At[1].type==="listItemPrefix"){const vt={type:"listItem",_spread:!1,start:Object.assign({},At[1].start),end:void 0};rt=vt,fe.splice(qe,0,["enter",vt,At[2]]),qe++,Te++,mt=void 0,Bt=!0}}}return fe[ge][1]._spread=St,Te}function c(fe,ge){return Te;function Te(qe){h.call(this,fe(qe),qe),ge&&ge.call(this,qe)}}function l(){this.stack.push({type:"fragment",children:[]})}function h(fe,ge,Te){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([ge,Te||void 0]),fe.position={start:fs(ge.start),end:void 0}}function f(fe){return ge;function ge(Te){fe&&fe.call(this,Te),p.call(this,Te)}}function p(fe,ge){const Te=this.stack.pop(),qe=this.tokenStack.pop();if(qe)qe[0].type!==fe.type&&(ge?ge.call(this,fe,qe[0]):(qe[1]||Tw).call(this,fe,qe[0]));else throw new Error("Cannot close `"+fe.type+"` ("+pl({start:fe.start,end:fe.end})+"): it’s not open");Te.position.end=fs(fe.end)}function y(){return Dp(this.stack.pop())}function g(){this.data.expectingFirstListItemValue=!0}function w(fe){if(this.data.expectingFirstListItemValue){const ge=this.stack[this.stack.length-2];ge.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function x(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.lang=fe}function S(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.meta=fe}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function P(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function A(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe.replace(/(\r?\n|\r)$/g,"")}function L(fe){const ge=this.resume(),Te=this.stack[this.stack.length-1];Te.label=ge,Te.identifier=ci(this.sliceSerialize(fe)).toLowerCase()}function O(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.title=fe}function ee(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.url=fe}function q(fe){const ge=this.stack[this.stack.length-1];if(!ge.depth){const Te=this.sliceSerialize(fe).length;ge.depth=Te}}function _(){this.data.setextHeadingSlurpLineEnding=!0}function E(fe){const ge=this.stack[this.stack.length-1];ge.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function M(){this.data.setextHeadingSlurpLineEnding=void 0}function I(fe){const Te=this.stack[this.stack.length-1].children;let qe=Te[Te.length-1];(!qe||qe.type!=="text")&&(qe=Lt(),qe.position={start:fs(fe.start),end:void 0},Te.push(qe)),this.stack.push(qe)}function N(fe){const ge=this.stack.pop();ge.value+=this.sliceSerialize(fe),ge.position.end=fs(fe.end)}function z(fe){const ge=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Te=ge.children[ge.children.length-1];Te.position.end=fs(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ge.type)&&(I.call(this,fe),N.call(this,fe))}function G(){this.data.atHardBreak=!0}function J(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe}function B(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe}function W(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.value=fe}function Y(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ge,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function Q(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ge=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ge,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function D(fe){const ge=this.sliceSerialize(fe),Te=this.stack[this.stack.length-2];Te.label=c_(ge),Te.identifier=ci(ge).toLowerCase()}function re(){const fe=this.stack[this.stack.length-1],ge=this.resume(),Te=this.stack[this.stack.length-1];if(this.data.inReference=!0,Te.type==="link"){const qe=fe.children;Te.children=qe}else Te.alt=ge}function R(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.url=fe}function $(){const fe=this.resume(),ge=this.stack[this.stack.length-1];ge.title=fe}function Z(){this.data.inReference=void 0}function F(){this.data.referenceType="collapsed"}function we(fe){const ge=this.resume(),Te=this.stack[this.stack.length-1];Te.label=ge,Te.identifier=ci(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function ce(fe){this.data.characterReferenceType=fe.type}function be(fe){const ge=this.sliceSerialize(fe),Te=this.data.characterReferenceType;let qe;Te?(qe=oj(ge,Te==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):qe=Fp(ge);const dt=this.stack[this.stack.length-1];dt.value+=qe}function Ve(fe){const ge=this.stack.pop();ge.position.end=fs(fe.end)}function ze(fe){N.call(this,fe);const ge=this.stack[this.stack.length-1];ge.url=this.sliceSerialize(fe)}function yt(fe){N.call(this,fe);const ge=this.stack[this.stack.length-1];ge.url="mailto:"+this.sliceSerialize(fe)}function ft(){return{type:"blockquote",children:[]}}function Ot(){return{type:"code",lang:null,meta:null,value:""}}function Ke(){return{type:"inlineCode",value:""}}function jt(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function pt(){return{type:"emphasis",children:[]}}function Mt(){return{type:"heading",depth:0,children:[]}}function xt(){return{type:"break"}}function Dt(){return{type:"html",value:""}}function wt(){return{type:"image",title:null,url:"",alt:null}}function ye(){return{type:"link",title:null,url:"",children:[]}}function Fe(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function kt(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function lt(){return{type:"paragraph",children:[]}}function gt(){return{type:"strong",children:[]}}function Lt(){return{type:"text",value:""}}function nt(){return{type:"thematicBreak"}}}function fs(e){return{line:e.line,column:e.column,offset:e.offset}}function bj(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?bj(e,i):f_(e,i)}}function f_(e,t){let n;for(n in t)if(gj.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function Tw(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+pl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+pl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+pl({start:t.start,end:t.end})+") is still open")}function m_(e){const t=this;t.parser=n;function n(i){return d_(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function p_(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function g_(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
73
+ `}]}function b_(e,t){const n=t.value?t.value+`
74
+ `:"",i={},a=t.lang?t.lang.split(/\s+/):[];a.length>0&&(i.className=["language-"+a[0]]);let c={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};return t.meta&&(c.data={meta:t.meta}),e.patch(t,c),c=e.applyData(t,c),c={type:"element",tagName:"pre",properties:{},children:[c]},e.patch(t,c),c}function y_(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function v_(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function w_(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),a=pa(i.toLowerCase()),c=e.footnoteOrder.indexOf(i);let l,h=e.footnoteCounts.get(i);h===void 0?(h=0,e.footnoteOrder.push(i),l=e.footnoteOrder.length):l=c+1,h+=1,e.footnoteCounts.set(i,h);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+a,id:n+"fnref-"+a+(h>1?"-"+h:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,f);const p={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,p),e.applyData(t,p)}function x_(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function k_(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function yj(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const a=e.all(t),c=a[0];c&&c.type==="text"?c.value="["+c.value:a.unshift({type:"text",value:"["});const l=a[a.length-1];return l&&l.type==="text"?l.value+=i:a.push({type:"text",value:i}),a}function S_(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return yj(e,t);const a={src:pa(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(a.title=i.title);const c={type:"element",tagName:"img",properties:a,children:[]};return e.patch(t,c),e.applyData(t,c)}function C_(e,t){const n={src:pa(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function j_(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function N_(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return yj(e,t);const a={href:pa(i.url||"")};i.title!==null&&i.title!==void 0&&(a.title=i.title);const c={type:"element",tagName:"a",properties:a,children:e.all(t)};return e.patch(t,c),e.applyData(t,c)}function P_(e,t){const n={href:pa(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function T_(e,t,n){const i=e.all(t),a=n?R_(n):vj(t),c={},l=[];if(typeof t.checked=="boolean"){const y=i[0];let g;y&&y.type==="element"&&y.tagName==="p"?g=y:(g={type:"element",tagName:"p",properties:{},children:[]},i.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),c.className=["task-list-item"]}let h=-1;for(;++h<i.length;){const y=i[h];(a||h!==0||y.type!=="element"||y.tagName!=="p")&&l.push({type:"text",value:`
75
+ `}),y.type==="element"&&y.tagName==="p"&&!a?l.push(...y.children):l.push(y)}const f=i[i.length-1];f&&(a||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
76
+ `});const p={type:"element",tagName:"li",properties:c,children:l};return e.patch(t,p),e.applyData(t,p)}function R_(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i<n.length;)t=vj(n[i])}return t}function vj(e){const t=e.spread;return t??e.children.length>1}function E_(e,t){const n={},i=e.all(t);let a=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++a<i.length;){const l=i[a];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const c={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,c),e.applyData(t,c)}function A_(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function I_(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function L_(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function M_(e,t){const n=e.all(t),i=n.shift(),a=[];if(i){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],l),a.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},h=Ap(t.children[1]),f=JC(t.children[t.children.length-1]);h&&f&&(l.position={start:h,end:f}),a.push(l)}const c={type:"element",tagName:"table",properties:{},children:e.wrap(a,!0)};return e.patch(t,c),e.applyData(t,c)}function D_(e,t,n){const i=n?n.children:void 0,c=(i?i.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,h=l?l.length:t.children.length;let f=-1;const p=[];for(;++f<h;){const g=t.children[f],w={},x=l?l[f]:void 0;x&&(w.align=x);let S={type:"element",tagName:c,properties:w,children:[]};g&&(S.children=e.all(g),e.patch(g,S),S=e.applyData(g,S)),p.push(S)}const y={type:"element",tagName:"tr",properties:{},children:e.wrap(p,!0)};return e.patch(t,y),e.applyData(t,y)}function F_(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const Rw=9,Ew=32;function __(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),a=0;const c=[];for(;i;)c.push(Aw(t.slice(a,i.index),a>0,!0),i[0]),a=i.index+i[0].length,i=n.exec(t);return c.push(Aw(t.slice(a),a>0,!1)),c.join("")}function Aw(e,t,n){let i=0,a=e.length;if(t){let c=e.codePointAt(i);for(;c===Rw||c===Ew;)i++,c=e.codePointAt(i)}if(n){let c=e.codePointAt(a-1);for(;c===Rw||c===Ew;)a--,c=e.codePointAt(a-1)}return a>i?e.slice(i,a):""}function O_(e,t){const n={type:"text",value:__(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function B_(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const U_={blockquote:p_,break:g_,code:b_,delete:y_,emphasis:v_,footnoteReference:w_,heading:x_,html:k_,imageReference:S_,image:C_,inlineCode:j_,linkReference:N_,link:P_,listItem:T_,list:E_,paragraph:A_,root:I_,strong:L_,table:M_,tableCell:F_,tableRow:D_,text:O_,thematicBreak:B_,toml:tu,yaml:tu,definition:tu,footnoteDefinition:tu};function tu(){}const wj=-1,fd=0,bl=1,Vu=2,Op=3,Bp=4,Up=5,Wp=6,xj=7,kj=8,Iw=typeof self=="object"?self:globalThis,W_=(e,t)=>{const n=(a,c)=>(e.set(c,a),a),i=a=>{if(e.has(a))return e.get(a);const[c,l]=t[a];switch(c){case fd:case wj:return n(l,a);case bl:{const h=n([],a);for(const f of l)h.push(i(f));return h}case Vu:{const h=n({},a);for(const[f,p]of l)h[i(f)]=i(p);return h}case Op:return n(new Date(l),a);case Bp:{const{source:h,flags:f}=l;return n(new RegExp(h,f),a)}case Up:{const h=n(new Map,a);for(const[f,p]of l)h.set(i(f),i(p));return h}case Wp:{const h=n(new Set,a);for(const f of l)h.add(i(f));return h}case xj:{const{name:h,message:f}=l;return n(new Iw[h](f),a)}case kj:return n(BigInt(l),a);case"BigInt":return n(Object(BigInt(l)),a);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:h}=new Uint8Array(l);return n(new DataView(h),l)}}return n(new Iw[c](l),a)};return i},Lw=e=>W_(new Map,e)(0),Ko="",{toString:z_}={},{keys:H_}=Object,il=e=>{const t=typeof e;if(t!=="object"||!e)return[fd,t];const n=z_.call(e).slice(8,-1);switch(n){case"Array":return[bl,Ko];case"Object":return[Vu,Ko];case"Date":return[Op,Ko];case"RegExp":return[Bp,Ko];case"Map":return[Up,Ko];case"Set":return[Wp,Ko];case"DataView":return[bl,n]}return n.includes("Array")?[bl,n]:n.includes("Error")?[xj,n]:[Vu,n]},nu=([e,t])=>e===fd&&(t==="function"||t==="symbol"),q_=(e,t,n,i)=>{const a=(l,h)=>{const f=i.push(l)-1;return n.set(h,f),f},c=l=>{if(n.has(l))return n.get(l);let[h,f]=il(l);switch(h){case fd:{let y=l;switch(f){case"bigint":h=kj,y=l.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);y=null;break;case"undefined":return a([wj],l)}return a([h,y],l)}case bl:{if(f){let w=l;return f==="DataView"?w=new Uint8Array(l.buffer):f==="ArrayBuffer"&&(w=new Uint8Array(l)),a([f,[...w]],l)}const y=[],g=a([h,y],l);for(const w of l)y.push(c(w));return g}case Vu:{if(f)switch(f){case"BigInt":return a([f,l.toString()],l);case"Boolean":case"Number":case"String":return a([f,l.valueOf()],l)}if(t&&"toJSON"in l)return c(l.toJSON());const y=[],g=a([h,y],l);for(const w of H_(l))(e||!nu(il(l[w])))&&y.push([c(w),c(l[w])]);return g}case Op:return a([h,l.toISOString()],l);case Bp:{const{source:y,flags:g}=l;return a([h,{source:y,flags:g}],l)}case Up:{const y=[],g=a([h,y],l);for(const[w,x]of l)(e||!(nu(il(w))||nu(il(x))))&&y.push([c(w),c(x)]);return g}case Wp:{const y=[],g=a([h,y],l);for(const w of l)(e||!nu(il(w)))&&y.push(c(w));return g}}const{message:p}=l;return a([h,{name:f,message:p}],l)};return c},Mw=(e,{json:t,lossy:n}={})=>{const i=[];return q_(!(t||n),!!t,new Map,i)(e),i},Gu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Lw(Mw(e,t)):structuredClone(e):(e,t)=>Lw(Mw(e,t));function $_(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function V_(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function G_(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||$_,i=e.options.footnoteBackLabel||V_,a=e.options.footnoteLabel||"Footnotes",c=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},h=[];let f=-1;for(;++f<e.footnoteOrder.length;){const p=e.footnoteById.get(e.footnoteOrder[f]);if(!p)continue;const y=e.all(p),g=String(p.identifier).toUpperCase(),w=pa(g.toLowerCase());let x=0;const S=[],C=e.footnoteCounts.get(g);for(;C!==void 0&&++x<=C;){S.length>0&&S.push({type:"text",value:" "});let L=typeof n=="string"?n:n(f,x);typeof L=="string"&&(L={type:"text",value:L}),S.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+w+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(f,x),className:["data-footnote-backref"]},children:Array.isArray(L)?L:[L]})}const P=y[y.length-1];if(P&&P.type==="element"&&P.tagName==="p"){const L=P.children[P.children.length-1];L&&L.type==="text"?L.value+=" ":P.children.push({type:"text",value:" "}),P.children.push(...S)}else y.push(...S);const A={type:"element",tagName:"li",properties:{id:t+"fn-"+w},children:e.wrap(y,!0)};e.patch(p,A),h.push(A)}if(h.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:c,properties:{...Gu(l),id:"footnote-label"},children:[{type:"text",value:a}]},{type:"text",value:`
77
+ `},{type:"element",tagName:"ol",properties:{},children:e.wrap(h,!0)},{type:"text",value:`
78
+ `}]}}const md=(function(e){if(e==null)return X_;if(typeof e=="function")return pd(e);if(typeof e=="object")return Array.isArray(e)?K_(e):Q_(e);if(typeof e=="string")return Y_(e);throw new Error("Expected function, string, or object as test")});function K_(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=md(e[n]);return pd(i);function i(...a){let c=-1;for(;++c<t.length;)if(t[c].apply(this,a))return!0;return!1}}function Q_(e){const t=e;return pd(n);function n(i){const a=i;let c;for(c in e)if(a[c]!==t[c])return!1;return!0}}function Y_(e){return pd(t);function t(n){return n&&n.type===e}}function pd(e){return t;function t(n,i,a){return!!(J_(n)&&e.call(this,n,typeof i=="number"?i:void 0,a||void 0))}}function X_(){return!0}function J_(e){return e!==null&&typeof e=="object"&&"type"in e}const Sj=[],Z_=!0,Em=!1,eO="skip";function Cj(e,t,n,i){let a;typeof t=="function"&&typeof n!="function"?(i=n,n=t):a=t;const c=md(a),l=i?-1:1;h(e,void 0,[])();function h(f,p,y){const g=f&&typeof f=="object"?f:{};if(typeof g.type=="string"){const x=typeof g.tagName=="string"?g.tagName:typeof g.name=="string"?g.name:void 0;Object.defineProperty(w,"name",{value:"node ("+(f.type+(x?"<"+x+">":""))+")"})}return w;function w(){let x=Sj,S,C,P;if((!t||c(f,p,y[y.length-1]||void 0))&&(x=tO(n(f,y)),x[0]===Em))return x;if("children"in f&&f.children){const A=f;if(A.children&&x[0]!==eO)for(C=(i?A.children.length:-1)+l,P=y.concat(A);C>-1&&C<A.children.length;){const L=A.children[C];if(S=h(L,C,P)(),S[0]===Em)return S;C=typeof S[1]=="number"?S[1]:C+l}}return x}}}function tO(e){return Array.isArray(e)?e:typeof e=="number"?[Z_,e]:e==null?Sj:[e]}function zp(e,t,n,i){let a,c,l;typeof t=="function"&&typeof n!="function"?(c=void 0,l=t,a=n):(c=t,l=n,a=i),Cj(e,c,h,a);function h(f,p){const y=p[p.length-1],g=y?y.children.indexOf(f):void 0;return l(f,g,y)}}const Am={}.hasOwnProperty,nO={};function rO(e,t){const n=t||nO,i=new Map,a=new Map,c=new Map,l={...U_,...n.handlers},h={all:p,applyData:sO,definitionById:i,footnoteById:a,footnoteCounts:c,footnoteOrder:[],handlers:l,one:f,options:n,patch:iO,wrap:aO};return zp(e,function(y){if(y.type==="definition"||y.type==="footnoteDefinition"){const g=y.type==="definition"?i:a,w=String(y.identifier).toUpperCase();g.has(w)||g.set(w,y)}}),h;function f(y,g){const w=y.type,x=h.handlers[w];if(Am.call(h.handlers,w)&&x)return x(h,y,g);if(h.options.passThrough&&h.options.passThrough.includes(w)){if("children"in y){const{children:C,...P}=y,A=Gu(P);return A.children=h.all(y),A}return Gu(y)}return(h.options.unknownHandler||oO)(h,y,g)}function p(y){const g=[];if("children"in y){const w=y.children;let x=-1;for(;++x<w.length;){const S=h.one(w[x],y);if(S){if(x&&w[x-1].type==="break"&&(!Array.isArray(S)&&S.type==="text"&&(S.value=Dw(S.value)),!Array.isArray(S)&&S.type==="element")){const C=S.children[0];C&&C.type==="text"&&(C.value=Dw(C.value))}Array.isArray(S)?g.push(...S):g.push(S)}}}return g}}function iO(e,t){e.position&&(t.position=VM(e))}function sO(e,t){let n=t;if(e&&e.data){const i=e.data.hName,a=e.data.hChildren,c=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const l="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:l}}n.type==="element"&&c&&Object.assign(n.properties,Gu(c)),"children"in n&&n.children&&a!==null&&a!==void 0&&(n.children=a)}return n}function oO(e,t){const n=t.data||{},i="value"in t&&!(Am.call(n,"hProperties")||Am.call(n,"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 aO(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
79
+ `});++i<e.length;)i&&n.push({type:"text",value:`
80
+ `}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
81
+ `}),n}function Dw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Fw(e,t){const n=rO(e,t),i=n.one(e,void 0),a=G_(n),c=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return a&&c.children.push({type:"text",value:`
82
+ `},a),c}function lO(e,t){return e&&"run"in e?async function(n,i){const a=Fw(n,{file:i,...t});await e.run(a,i)}:function(n,i){return Fw(n,{file:i,...e||t})}}function _w(e){if(e)throw e}var yf,Ow;function cO(){if(Ow)return yf;Ow=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},c=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var y=e.call(p,"constructor"),g=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!y&&!g)return!1;var w;for(w in p);return typeof w>"u"||e.call(p,w)},l=function(p,y){n&&y.name==="__proto__"?n(p,y.name,{enumerable:!0,configurable:!0,value:y.newValue,writable:!0}):p[y.name]=y.newValue},h=function(p,y){if(y==="__proto__")if(e.call(p,y)){if(i)return i(p,y).value}else return;return p[y]};return yf=function f(){var p,y,g,w,x,S,C=arguments[0],P=1,A=arguments.length,L=!1;for(typeof C=="boolean"&&(L=C,C=arguments[1]||{},P=2),(C==null||typeof C!="object"&&typeof C!="function")&&(C={});P<A;++P)if(p=arguments[P],p!=null)for(y in p)g=h(C,y),w=h(p,y),C!==w&&(L&&w&&(c(w)||(x=a(w)))?(x?(x=!1,S=g&&a(g)?g:[]):S=g&&c(g)?g:{},l(C,{name:y,newValue:f(L,S,w)})):typeof w<"u"&&l(C,{name:y,newValue:w}));return C},yf}var uO=cO();const vf=Ll(uO);function Im(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 dO(){const e=[],t={run:n,use:i};return t;function n(...a){let c=-1;const l=a.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);h(null,...a);function h(f,...p){const y=e[++c];let g=-1;if(f){l(f);return}for(;++g<a.length;)(p[g]===null||p[g]===void 0)&&(p[g]=a[g]);a=p,y?hO(y,h)(...p):l(null,...p)}}function i(a){if(typeof a!="function")throw new TypeError("Expected `middelware` to be a function, not "+a);return e.push(a),t}}function hO(e,t){let n;return i;function i(...l){const h=e.length>l.length;let f;h&&l.push(a);try{f=e.apply(this,l)}catch(p){const y=p;if(h&&n)throw y;return a(y)}h||(f&&f.then&&typeof f.then=="function"?f.then(c,a):f instanceof Error?a(f):c(f))}function a(l,...h){n||(n=!0,t(l,...h))}function c(l){a(null,l)}}const wi={basename:fO,dirname:mO,extname:pO,join:gO,sep:"/"};function fO(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ql(e);let n=0,i=-1,a=e.length,c;if(t===void 0||t.length===0||t.length>e.length){for(;a--;)if(e.codePointAt(a)===47){if(c){n=a+1;break}}else i<0&&(c=!0,i=a+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let l=-1,h=t.length-1;for(;a--;)if(e.codePointAt(a)===47){if(c){n=a+1;break}}else l<0&&(c=!0,l=a+1),h>-1&&(e.codePointAt(a)===t.codePointAt(h--)?h<0&&(i=a):(h=-1,i=l));return n===i?i=l:i<0&&(i=e.length),e.slice(n,i)}function mO(e){if(ql(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function pO(e){ql(e);let t=e.length,n=-1,i=0,a=-1,c=0,l;for(;t--;){const h=e.codePointAt(t);if(h===47){if(l){i=t+1;break}continue}n<0&&(l=!0,n=t+1),h===46?a<0?a=t:c!==1&&(c=1):a>-1&&(c=-1)}return a<0||n<0||c===0||c===1&&a===n-1&&a===i+1?"":e.slice(a,n)}function gO(...e){let t=-1,n;for(;++t<e.length;)ql(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":bO(n)}function bO(e){ql(e);const t=e.codePointAt(0)===47;let n=yO(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function yO(e,t){let n="",i=0,a=-1,c=0,l=-1,h,f;for(;++l<=e.length;){if(l<e.length)h=e.codePointAt(l);else{if(h===47)break;h=47}if(h===47){if(!(a===l-1||c===1))if(a!==l-1&&c===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",i=0):(n=n.slice(0,f),i=n.length-1-n.lastIndexOf("/")),a=l,c=0;continue}}else if(n.length>0){n="",i=0,a=l,c=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(a+1,l):n=e.slice(a+1,l),i=l-a-1;a=l,c=0}else h===46&&c>-1?c++:c=-1}return n}function ql(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const vO={cwd:wO};function wO(){return"/"}function Lm(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function xO(e){if(typeof e=="string")e=new URL(e);else if(!Lm(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 kO(e)}function kO(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 n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+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 wf=["history","path","basename","stem","extname","dirname"];class jj{constructor(t){let n;t?Lm(t)?n={path:t}:typeof t=="string"||SO(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":vO.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<wf.length;){const c=wf[i];c in n&&n[c]!==void 0&&n[c]!==null&&(this[c]=c==="history"?[...n[c]]:n[c])}let a;for(a in n)wf.includes(a)||(this[a]=n[a])}get basename(){return typeof this.path=="string"?wi.basename(this.path):void 0}set basename(t){kf(t,"basename"),xf(t,"basename"),this.path=wi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?wi.dirname(this.path):void 0}set dirname(t){Bw(this.basename,"dirname"),this.path=wi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?wi.extname(this.path):void 0}set extname(t){if(xf(t,"extname"),Bw(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=wi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Lm(t)&&(t=xO(t)),kf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?wi.basename(this.path,this.extname):void 0}set stem(t){kf(t,"stem"),xf(t,"stem"),this.path=wi.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const a=this.message(t,n,i);throw a.fatal=!0,a}info(t,n,i){const a=this.message(t,n,i);return a.fatal=void 0,a}message(t,n,i){const a=new dr(t,n,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 xf(e,t){if(e&&e.includes(wi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+wi.sep+"`")}function kf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Bw(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function SO(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const CO=(function(e){const i=this.constructor.prototype,a=i[e],c=function(){return a.apply(c,arguments)};return Object.setPrototypeOf(c,i),c}),jO={}.hasOwnProperty;class Hp extends CO{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=dO()}copy(){const t=new Hp;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(vf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(jf("data",this.frozen),this.namespace[t]=n,this):jO.call(this.namespace,t)&&this.namespace[t]||void 0:t?(jf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const a=n.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 n=ru(t),i=this.parser||this.Parser;return Sf("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),Sf("process",this.parser||this.Parser),Cf("process",this.compiler||this.Compiler),n?a(void 0,n):new Promise(a);function a(c,l){const h=ru(t),f=i.parse(h);i.run(f,h,function(y,g,w){if(y||!g||!w)return p(y);const x=g,S=i.stringify(x,w);TO(S)?w.value=S:w.result=S,p(y,w)});function p(y,g){y||!g?l(y):c?c(g):n(void 0,g)}}}processSync(t){let n=!1,i;return this.freeze(),Sf("processSync",this.parser||this.Parser),Cf("processSync",this.compiler||this.Compiler),this.process(t,a),Ww("processSync","process",n),i;function a(c,l){n=!0,_w(c),i=l}}run(t,n,i){Uw(t),this.freeze();const a=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?c(void 0,i):new Promise(c);function c(l,h){const f=ru(n);a.run(t,f,p);function p(y,g,w){const x=g||t;y?h(y):l?l(x):i(void 0,x,w)}}}runSync(t,n){let i=!1,a;return this.run(t,n,c),Ww("runSync","run",i),a;function c(l,h){_w(l),a=h,i=!0}}stringify(t,n){this.freeze();const i=ru(n),a=this.compiler||this.Compiler;return Cf("stringify",a),Uw(t),a(t,i)}use(t,...n){const i=this.attachers,a=this.namespace;if(jf("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?h(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function c(p){if(typeof p=="function")f(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[y,...g]=p;f(y,g)}else l(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function l(p){if(!("plugins"in p)&&!("settings"in p))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");h(p.plugins),p.settings&&(a.settings=vf(!0,a.settings,p.settings))}function h(p){let y=-1;if(p!=null)if(Array.isArray(p))for(;++y<p.length;){const g=p[y];c(g)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function f(p,y){let g=-1,w=-1;for(;++g<i.length;)if(i[g][0]===p){w=g;break}if(w===-1)i.push([p,...y]);else if(y.length>0){let[x,...S]=y;const C=i[w][1];Im(C)&&Im(x)&&(x=vf(!0,C,x)),i[w]=[p,x,...S]}}}}const NO=new Hp().freeze();function Sf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Cf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function jf(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 Uw(e){if(!Im(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ww(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function ru(e){return PO(e)?e:new jj(e)}function PO(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function TO(e){return typeof e=="string"||RO(e)}function RO(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const EO="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",zw=[],Hw={allowDangerousHtml:!0},AO=/^(https?|ircs?|mailto|xmpp)$/i,IO=[{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 qp(e){const t=LO(e),n=MO(e);return DO(t.runSync(t.parse(n),n),e)}function LO(e){const t=e.rehypePlugins||zw,n=e.remarkPlugins||zw,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Hw}:Hw;return NO().use(m_).use(n).use(lO,i).use(t)}function MO(e){const t=e.children||"",n=new jj;return typeof t=="string"&&(n.value=t),n}function DO(e,t){const n=t.allowedElements,i=t.allowElement,a=t.components,c=t.disallowedElements,l=t.skipHtml,h=t.unwrapDisallowed,f=t.urlTransform||FO;for(const y of IO)Object.hasOwn(t,y.from)&&(""+y.from+(y.to?"use `"+y.to+"` instead":"remove it")+EO+y.id,void 0);return zp(e,p),XM(e,{Fragment:r.Fragment,components:a,ignoreInvalidStyle:!0,jsx:r.jsx,jsxs:r.jsxs,passKeys:!0,passNode:!0});function p(y,g,w){if(y.type==="raw"&&w&&typeof g=="number")return l?w.children.splice(g,1):w.children[g]={type:"text",value:y.value},g;if(y.type==="element"){let x;for(x in pf)if(Object.hasOwn(pf,x)&&Object.hasOwn(y.properties,x)){const S=y.properties[x],C=pf[x];(C===null||C.includes(y.tagName))&&(y.properties[x]=f(String(S||""),x,y))}}if(y.type==="element"){let x=n?!n.includes(y.tagName):c?c.includes(y.tagName):!1;if(!x&&i&&typeof g=="number"&&(x=!i(y,g,w)),x&&w&&typeof g=="number")return h&&y.children?w.children.splice(g,1,...y.children):w.children.splice(g,1),g}}}function FO(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),a=e.indexOf("/");return t===-1||a!==-1&&t>a||n!==-1&&t>n||i!==-1&&t>i||AO.test(e.slice(0,t))?e:""}function qw(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,a=n.indexOf(t);for(;a!==-1;)i++,a=n.indexOf(t,a+t.length);return i}function _O(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function OO(e,t,n){const a=md((n||{}).ignore||[]),c=BO(t);let l=-1;for(;++l<c.length;)Cj(e,"text",h);function h(p,y){let g=-1,w;for(;++g<y.length;){const x=y[g],S=w?w.children:void 0;if(a(x,S?S.indexOf(x):void 0,w))return;w=x}if(w)return f(p,y)}function f(p,y){const g=y[y.length-1],w=c[l][0],x=c[l][1];let S=0;const P=g.children.indexOf(p);let A=!1,L=[];w.lastIndex=0;let O=w.exec(p.value);for(;O;){const ee=O.index,q={index:O.index,input:O.input,stack:[...y,p]};let _=x(...O,q);if(typeof _=="string"&&(_=_.length>0?{type:"text",value:_}:void 0),_===!1?w.lastIndex=ee+1:(S!==ee&&L.push({type:"text",value:p.value.slice(S,ee)}),Array.isArray(_)?L.push(..._):_&&L.push(_),S=ee+O[0].length,A=!0),!w.global)break;O=w.exec(p.value)}return A?(S<p.value.length&&L.push({type:"text",value:p.value.slice(S)}),g.children.splice(P,1,...L)):L=[p],P+L.length}}function BO(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<n.length;){const a=n[i];t.push([UO(a[0]),WO(a[1])])}return t}function UO(e){return typeof e=="string"?new RegExp(_O(e),"g"):e}function WO(e){return typeof e=="function"?e:function(){return e}}const Nf="phrasing",Pf=["autolink","link","image","label"];function zO(){return{transforms:[QO],enter:{literalAutolink:qO,literalAutolinkEmail:Tf,literalAutolinkHttp:Tf,literalAutolinkWww:Tf},exit:{literalAutolink:KO,literalAutolinkEmail:GO,literalAutolinkHttp:$O,literalAutolinkWww:VO}}}function HO(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Nf,notInConstruct:Pf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Nf,notInConstruct:Pf},{character:":",before:"[ps]",after:"\\/",inConstruct:Nf,notInConstruct:Pf}]}}function qO(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function Tf(e){this.config.enter.autolinkProtocol.call(this,e)}function $O(e){this.config.exit.autolinkProtocol.call(this,e)}function VO(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 GO(e){this.config.exit.autolinkEmail.call(this,e)}function KO(e){this.exit(e)}function QO(e){OO(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,YO],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),XO]],{ignore:["link","linkReference"]})}function YO(e,t,n,i,a){let c="";if(!Nj(a)||(/^w/i.test(t)&&(n=t+n,t="",c="http://"),!JO(n)))return!1;const l=ZO(n+i);if(!l[0])return!1;const h={type:"link",title:null,url:c+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[h,{type:"text",value:l[1]}]:h}function XO(e,t,n,i){return!Nj(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function JO(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 ZO(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")");const a=qw(e,"(");let c=qw(e,")");for(;i!==-1&&a>c;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),c++;return[e,n]}function Nj(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ho(n)||dd(n))&&(!t||n!==47)}Pj.peek=l2;function e2(){this.buffer()}function t2(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function n2(){this.buffer()}function r2(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function i2(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ci(this.sliceSerialize(e)).toLowerCase(),n.label=t}function s2(e){this.exit(e)}function o2(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=ci(this.sliceSerialize(e)).toLowerCase(),n.label=t}function a2(e){this.exit(e)}function l2(){return"["}function Pj(e,t,n,i){const a=n.createTracker(i);let c=a.move("[^");const l=n.enter("footnoteReference"),h=n.enter("reference");return c+=a.move(n.safe(n.associationId(e),{after:"]",before:c})),h(),l(),c+=a.move("]"),c}function c2(){return{enter:{gfmFootnoteCallString:e2,gfmFootnoteCall:t2,gfmFootnoteDefinitionLabelString:n2,gfmFootnoteDefinition:r2},exit:{gfmFootnoteCallString:i2,gfmFootnoteCall:s2,gfmFootnoteDefinitionLabelString:o2,gfmFootnoteDefinition:a2}}}function u2(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:Pj},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,a,c,l){const h=c.createTracker(l);let f=h.move("[^");const p=c.enter("footnoteDefinition"),y=c.enter("label");return f+=h.move(c.safe(c.associationId(i),{before:f,after:"]"})),y(),f+=h.move("]:"),i.children&&i.children.length>0&&(h.shift(4),f+=h.move((t?`
83
+ `:" ")+c.indentLines(c.containerFlow(i,h.current()),t?Tj:d2))),p(),f}}function d2(e,t,n){return t===0?e:Tj(e,t,n)}function Tj(e,t,n){return(n?"":" ")+e}const h2=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];Rj.peek=b2;function f2(){return{canContainEols:["delete"],enter:{strikethrough:p2},exit:{strikethrough:g2}}}function m2(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:h2}],handlers:{delete:Rj}}}function p2(e){this.enter({type:"delete",children:[]},e)}function g2(e){this.exit(e)}function Rj(e,t,n,i){const a=n.createTracker(i),c=n.enter("strikethrough");let l=a.move("~~");return l+=n.containerPhrasing(e,{...a.current(),before:l,after:"~"}),l+=a.move("~~"),c(),l}function b2(){return"~"}function y2(e){return e.length}function v2(e,t){const n=t||{},i=(n.align||[]).concat(),a=n.stringLength||y2,c=[],l=[],h=[],f=[];let p=0,y=-1;for(;++y<e.length;){const C=[],P=[];let A=-1;for(e[y].length>p&&(p=e[y].length);++A<e[y].length;){const L=w2(e[y][A]);if(n.alignDelimiters!==!1){const O=a(L);P[A]=O,(f[A]===void 0||O>f[A])&&(f[A]=O)}C.push(L)}l[y]=C,h[y]=P}let g=-1;if(typeof i=="object"&&"length"in i)for(;++g<p;)c[g]=$w(i[g]);else{const C=$w(i);for(;++g<p;)c[g]=C}g=-1;const w=[],x=[];for(;++g<p;){const C=c[g];let P="",A="";C===99?(P=":",A=":"):C===108?P=":":C===114&&(A=":");let L=n.alignDelimiters===!1?1:Math.max(1,f[g]-P.length-A.length);const O=P+"-".repeat(L)+A;n.alignDelimiters!==!1&&(L=P.length+L+A.length,L>f[g]&&(f[g]=L),x[g]=L),w[g]=O}l.splice(1,0,w),h.splice(1,0,x),y=-1;const S=[];for(;++y<l.length;){const C=l[y],P=h[y];g=-1;const A=[];for(;++g<p;){const L=C[g]||"";let O="",ee="";if(n.alignDelimiters!==!1){const q=f[g]-(P[g]||0),_=c[g];_===114?O=" ".repeat(q):_===99?q%2?(O=" ".repeat(q/2+.5),ee=" ".repeat(q/2-.5)):(O=" ".repeat(q/2),ee=O):ee=" ".repeat(q)}n.delimiterStart!==!1&&!g&&A.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&L==="")&&(n.delimiterStart!==!1||g)&&A.push(" "),n.alignDelimiters!==!1&&A.push(O),A.push(L),n.alignDelimiters!==!1&&A.push(ee),n.padding!==!1&&A.push(" "),(n.delimiterEnd!==!1||g!==p-1)&&A.push("|")}S.push(n.delimiterEnd===!1?A.join("").replace(/ +$/,""):A.join(""))}return S.join(`
84
+ `)}function w2(e){return e==null?"":String(e)}function $w(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 x2(e,t,n,i){const a=n.enter("blockquote"),c=n.createTracker(i);c.move("> "),c.shift(2);const l=n.indentLines(n.containerFlow(e,c.current()),k2);return a(),l}function k2(e,t,n){return">"+(n?"":" ")+e}function S2(e,t){return Vw(e,t.inConstruct,!0)&&!Vw(e,t.notInConstruct,!1)}function Vw(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++i<t.length;)if(e.includes(t[i]))return!0;return!1}function Gw(e,t,n,i){let a=-1;for(;++a<n.unsafe.length;)if(n.unsafe[a].character===`
85
+ `&&S2(n.stack,n.unsafe[a]))return/[ \t]/.test(i.before)?"":" ";return`\\
86
+ `}function C2(e,t){const n=String(e);let i=n.indexOf(t),a=i,c=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===a?++c>l&&(l=c):c=1,a=i+t.length,i=n.indexOf(t,a);return l}function j2(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 N2(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 P2(e,t,n,i){const a=N2(n),c=e.value||"",l=a==="`"?"GraveAccent":"Tilde";if(j2(e,n)){const g=n.enter("codeIndented"),w=n.indentLines(c,T2);return g(),w}const h=n.createTracker(i),f=a.repeat(Math.max(C2(c,a)+1,3)),p=n.enter("codeFenced");let y=h.move(f);if(e.lang){const g=n.enter(`codeFencedLang${l}`);y+=h.move(n.safe(e.lang,{before:y,after:" ",encode:["`"],...h.current()})),g()}if(e.lang&&e.meta){const g=n.enter(`codeFencedMeta${l}`);y+=h.move(" "),y+=h.move(n.safe(e.meta,{before:y,after:`
87
+ `,encode:["`"],...h.current()})),g()}return y+=h.move(`
88
+ `),c&&(y+=h.move(c+`
89
+ `)),y+=h.move(f),p(),y}function T2(e,t,n){return(n?"":" ")+e}function $p(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 R2(e,t,n,i){const a=$p(n),c=a==='"'?"Quote":"Apostrophe",l=n.enter("definition");let h=n.enter("label");const f=n.createTracker(i);let p=f.move("[");return p+=f.move(n.safe(n.associationId(e),{before:p,after:"]",...f.current()})),p+=f.move("]: "),h(),!e.url||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(h=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":`
90
+ `,...f.current()}))),h(),e.title&&(h=n.enter(`title${c}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),h()),l(),p}function E2(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 jl(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Ku(e,t,n){const i=oa(e),a=oa(t);return i===void 0?a===void 0?n==="_"?{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}}Ej.peek=A2;function Ej(e,t,n,i){const a=E2(n),c=n.enter("emphasis"),l=n.createTracker(i),h=l.move(a);let f=l.move(n.containerPhrasing(e,{after:a,before:h,...l.current()}));const p=f.charCodeAt(0),y=Ku(i.before.charCodeAt(i.before.length-1),p,a);y.inside&&(f=jl(p)+f.slice(1));const g=f.charCodeAt(f.length-1),w=Ku(i.after.charCodeAt(0),g,a);w.inside&&(f=f.slice(0,-1)+jl(g));const x=l.move(a);return c(),n.attentionEncodeSurroundingInfo={after:w.outside,before:y.outside},h+f+x}function A2(e,t,n){return n.options.emphasis||"*"}function I2(e,t){let n=!1;return zp(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,Em}),!!((!e.depth||e.depth<3)&&Dp(e)&&(t.options.setext||n))}function L2(e,t,n,i){const a=Math.max(Math.min(6,e.depth||1),1),c=n.createTracker(i);if(I2(e,n)){const y=n.enter("headingSetext"),g=n.enter("phrasing"),w=n.containerPhrasing(e,{...c.current(),before:`
91
+ `,after:`
92
+ `});return g(),y(),w+`
93
+ `+(a===1?"=":"-").repeat(w.length-(Math.max(w.lastIndexOf("\r"),w.lastIndexOf(`
94
+ `))+1))}const l="#".repeat(a),h=n.enter("headingAtx"),f=n.enter("phrasing");c.move(l+" ");let p=n.containerPhrasing(e,{before:"# ",after:`
95
+ `,...c.current()});return/^[\t ]/.test(p)&&(p=jl(p.charCodeAt(0))+p.slice(1)),p=p?l+" "+p:l,n.options.closeAtx&&(p+=" "+l),f(),h(),p}Aj.peek=M2;function Aj(e){return e.value||""}function M2(){return"<"}Ij.peek=D2;function Ij(e,t,n,i){const a=$p(n),c=a==='"'?"Quote":"Apostrophe",l=n.enter("image");let h=n.enter("label");const f=n.createTracker(i);let p=f.move("![");return p+=f.move(n.safe(e.alt,{before:p,after:"]",...f.current()})),p+=f.move("]("),h(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(h=n.enter("destinationLiteral"),p+=f.move("<"),p+=f.move(n.safe(e.url,{before:p,after:">",...f.current()})),p+=f.move(">")):(h=n.enter("destinationRaw"),p+=f.move(n.safe(e.url,{before:p,after:e.title?" ":")",...f.current()}))),h(),e.title&&(h=n.enter(`title${c}`),p+=f.move(" "+a),p+=f.move(n.safe(e.title,{before:p,after:a,...f.current()})),p+=f.move(a),h()),p+=f.move(")"),l(),p}function D2(){return"!"}Lj.peek=F2;function Lj(e,t,n,i){const a=e.referenceType,c=n.enter("imageReference");let l=n.enter("label");const h=n.createTracker(i);let f=h.move("![");const p=n.safe(e.alt,{before:f,after:"]",...h.current()});f+=h.move(p+"]["),l();const y=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return l(),n.stack=y,c(),a==="full"||!p||p!==g?f+=h.move(g+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function F2(){return"!"}Mj.peek=_2;function Mj(e,t,n){let i=e.value||"",a="`",c=-1;for(;new RegExp("(^|[^`])"+a+"([^`]|$)").test(i);)a+="`";for(/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++c<n.unsafe.length;){const l=n.unsafe[c],h=n.compilePattern(l);let f;if(l.atBreak)for(;f=h.exec(i);){let p=f.index;i.charCodeAt(p)===10&&i.charCodeAt(p-1)===13&&p--,i=i.slice(0,p)+" "+i.slice(f.index+1)}}return a+i+a}function _2(){return"`"}function Dj(e,t){const n=Dp(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}Fj.peek=O2;function Fj(e,t,n,i){const a=$p(n),c=a==='"'?"Quote":"Apostrophe",l=n.createTracker(i);let h,f;if(Dj(e,n)){const y=n.stack;n.stack=[],h=n.enter("autolink");let g=l.move("<");return g+=l.move(n.containerPhrasing(e,{before:g,after:">",...l.current()})),g+=l.move(">"),h(),n.stack=y,g}h=n.enter("link"),f=n.enter("label");let p=l.move("[");return p+=l.move(n.containerPhrasing(e,{before:p,after:"](",...l.current()})),p+=l.move("]("),f(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(f=n.enter("destinationLiteral"),p+=l.move("<"),p+=l.move(n.safe(e.url,{before:p,after:">",...l.current()})),p+=l.move(">")):(f=n.enter("destinationRaw"),p+=l.move(n.safe(e.url,{before:p,after:e.title?" ":")",...l.current()}))),f(),e.title&&(f=n.enter(`title${c}`),p+=l.move(" "+a),p+=l.move(n.safe(e.title,{before:p,after:a,...l.current()})),p+=l.move(a),f()),p+=l.move(")"),h(),p}function O2(e,t,n){return Dj(e,n)?"<":"["}_j.peek=B2;function _j(e,t,n,i){const a=e.referenceType,c=n.enter("linkReference");let l=n.enter("label");const h=n.createTracker(i);let f=h.move("[");const p=n.containerPhrasing(e,{before:f,after:"]",...h.current()});f+=h.move(p+"]["),l();const y=n.stack;n.stack=[],l=n.enter("reference");const g=n.safe(n.associationId(e),{before:f,after:"]",...h.current()});return l(),n.stack=y,c(),a==="full"||!p||p!==g?f+=h.move(g+"]"):a==="shortcut"?f=f.slice(0,-1):f+=h.move("]"),f}function B2(){return"["}function Vp(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 U2(e){const t=Vp(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function W2(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 Oj(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 z2(e,t,n,i){const a=n.enter("list"),c=n.bulletCurrent;let l=e.ordered?W2(n):Vp(n);const h=e.ordered?l==="."?")":".":U2(n);let f=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const y=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&y&&(!y.children||!y.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),Oj(n)===l&&y){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"){f=!0;break}}}}f&&(l=h),n.bulletCurrent=l;const p=n.containerFlow(e,i);return n.bulletLastUsed=l,n.bulletCurrent=c,a(),p}function H2(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 q2(e,t,n,i){const a=H2(n);let c=n.bulletCurrent||Vp(n);t&&t.type==="list"&&t.ordered&&(c=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+c);let l=c.length+1;(a==="tab"||a==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const h=n.createTracker(i);h.move(c+" ".repeat(l-c.length)),h.shift(l);const f=n.enter("listItem"),p=n.indentLines(n.containerFlow(e,h.current()),y);return f(),p;function y(g,w,x){return w?(x?"":" ".repeat(l))+g:(x?c:c+" ".repeat(l-c.length))+g}}function $2(e,t,n,i){const a=n.enter("paragraph"),c=n.enter("phrasing"),l=n.containerPhrasing(e,i);return c(),a(),l}const V2=md(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function G2(e,t,n,i){return(e.children.some(function(l){return V2(l)})?n.containerPhrasing:n.containerFlow).call(n,e,i)}function K2(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Bj.peek=Q2;function Bj(e,t,n,i){const a=K2(n),c=n.enter("strong"),l=n.createTracker(i),h=l.move(a+a);let f=l.move(n.containerPhrasing(e,{after:a,before:h,...l.current()}));const p=f.charCodeAt(0),y=Ku(i.before.charCodeAt(i.before.length-1),p,a);y.inside&&(f=jl(p)+f.slice(1));const g=f.charCodeAt(f.length-1),w=Ku(i.after.charCodeAt(0),g,a);w.inside&&(f=f.slice(0,-1)+jl(g));const x=l.move(a+a);return c(),n.attentionEncodeSurroundingInfo={after:w.outside,before:y.outside},h+f+x}function Q2(e,t,n){return n.options.strong||"*"}function Y2(e,t,n,i){return n.safe(e.value,i)}function X2(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 J2(e,t,n){const i=(Oj(n)+(n.options.ruleSpaces?" ":"")).repeat(X2(n));return n.options.ruleSpaces?i.slice(0,-1):i}const Uj={blockquote:x2,break:Gw,code:P2,definition:R2,emphasis:Ej,hardBreak:Gw,heading:L2,html:Aj,image:Ij,imageReference:Lj,inlineCode:Mj,link:Fj,linkReference:_j,list:z2,listItem:q2,paragraph:$2,root:G2,strong:Bj,text:Y2,thematicBreak:J2};function Z2(){return{enter:{table:eB,tableData:Kw,tableHeader:Kw,tableRow:nB},exit:{codeText:rB,table:tB,tableData:Rf,tableHeader:Rf,tableRow:Rf}}}function eB(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function tB(e){this.exit(e),this.data.inTable=void 0}function nB(e){this.enter({type:"tableRow",children:[]},e)}function Rf(e){this.exit(e)}function Kw(e){this.enter({type:"tableCell",children:[]},e)}function rB(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,iB));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function iB(e,t){return t==="|"?t:e}function sB(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,a=t.stringLength,c=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
96
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:w,table:l,tableCell:f,tableRow:h}};function l(x,S,C,P){return p(y(x,C,P),x.align)}function h(x,S,C,P){const A=g(x,C,P),L=p([A]);return L.slice(0,L.indexOf(`
97
+ `))}function f(x,S,C,P){const A=C.enter("tableCell"),L=C.enter("phrasing"),O=C.containerPhrasing(x,{...P,before:c,after:c});return L(),A(),O}function p(x,S){return v2(x,{align:S,alignDelimiters:i,padding:n,stringLength:a})}function y(x,S,C){const P=x.children;let A=-1;const L=[],O=S.enter("table");for(;++A<P.length;)L[A]=g(P[A],S,C);return O(),L}function g(x,S,C){const P=x.children;let A=-1;const L=[],O=S.enter("tableRow");for(;++A<P.length;)L[A]=f(P[A],x,S,C);return O(),L}function w(x,S,C){let P=Uj.inlineCode(x,S,C);return C.stack.includes("tableCell")&&(P=P.replace(/\|/g,"\\$&")),P}}function oB(){return{exit:{taskListCheckValueChecked:Qw,taskListCheckValueUnchecked:Qw,paragraph:lB}}}function aB(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:cB}}}function Qw(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function lB(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const a=t.children;let c=-1,l;for(;++c<a.length;){const h=a[c];if(h.type==="paragraph"){l=h;break}}l===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function cB(e,t,n,i){const a=e.children[0],c=typeof e.checked=="boolean"&&a&&a.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",h=n.createTracker(i);c&&h.move(l);let f=Uj.listItem(e,t,n,{...i,...h.current()});return c&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,p)),f;function p(y){return y+l}}function uB(){return[zO(),c2(),f2(),Z2(),oB()]}function dB(e){return{extensions:[HO(),u2(e),m2(),sB(e),aB()]}}const hB={tokenize:yB,partial:!0},Wj={tokenize:vB,partial:!0},zj={tokenize:wB,partial:!0},Hj={tokenize:xB,partial:!0},fB={tokenize:kB,partial:!0},qj={name:"wwwAutolink",tokenize:gB,previous:Vj},$j={name:"protocolAutolink",tokenize:bB,previous:Gj},Qi={name:"emailAutolink",tokenize:pB,previous:Kj},Ci={};function mB(){return{text:Ci}}let Zs=48;for(;Zs<123;)Ci[Zs]=Qi,Zs++,Zs===58?Zs=65:Zs===91&&(Zs=97);Ci[43]=Qi;Ci[45]=Qi;Ci[46]=Qi;Ci[95]=Qi;Ci[72]=[Qi,$j];Ci[104]=[Qi,$j];Ci[87]=[Qi,qj];Ci[119]=[Qi,qj];function pB(e,t,n){const i=this;let a,c;return l;function l(g){return!Mm(g)||!Kj.call(i,i.previous)||Gp(i.events)?n(g):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),h(g))}function h(g){return Mm(g)?(e.consume(g),h):g===64?(e.consume(g),f):n(g)}function f(g){return g===46?e.check(fB,y,p)(g):g===45||g===95||ur(g)?(c=!0,e.consume(g),f):y(g)}function p(g){return e.consume(g),a=!0,f}function y(g){return c&&a&&pr(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(g)):n(g)}}function gB(e,t,n){const i=this;return a;function a(l){return l!==87&&l!==119||!Vj.call(i,i.previous)||Gp(i.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(hB,e.attempt(Wj,e.attempt(zj,c),n),n)(l))}function c(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function bB(e,t,n){const i=this;let a="",c=!1;return l;function l(g){return(g===72||g===104)&&Gj.call(i,i.previous)&&!Gp(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),a+=String.fromCodePoint(g),e.consume(g),h):n(g)}function h(g){if(pr(g)&&a.length<5)return a+=String.fromCodePoint(g),e.consume(g),h;if(g===58){const w=a.toLowerCase();if(w==="http"||w==="https")return e.consume(g),f}return n(g)}function f(g){return g===47?(e.consume(g),c?p:(c=!0,f)):n(g)}function p(g){return g===null||$u(g)||mn(g)||ho(g)||dd(g)?n(g):e.attempt(Wj,e.attempt(zj,y),n)(g)}function y(g){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(g)}}function yB(e,t,n){let i=0;return a;function a(l){return(l===87||l===119)&&i<3?(i++,e.consume(l),a):l===46&&i===3?(e.consume(l),c):n(l)}function c(l){return l===null?n(l):t(l)}}function vB(e,t,n){let i,a,c;return l;function l(p){return p===46||p===95?e.check(Hj,f,h)(p):p===null||mn(p)||ho(p)||p!==45&&dd(p)?f(p):(c=!0,e.consume(p),l)}function h(p){return p===95?i=!0:(a=i,i=void 0),e.consume(p),l}function f(p){return a||i||!c?n(p):t(p)}}function wB(e,t){let n=0,i=0;return a;function a(l){return l===40?(n++,e.consume(l),a):l===41&&i<n?c(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(Hj,t,c)(l):l===null||mn(l)||ho(l)?t(l):(e.consume(l),a)}function c(l){return l===41&&i++,e.consume(l),a}}function xB(e,t,n){return i;function i(h){return h===33||h===34||h===39||h===41||h===42||h===44||h===46||h===58||h===59||h===63||h===95||h===126?(e.consume(h),i):h===38?(e.consume(h),c):h===93?(e.consume(h),a):h===60||h===null||mn(h)||ho(h)?t(h):n(h)}function a(h){return h===null||h===40||h===91||mn(h)||ho(h)?t(h):i(h)}function c(h){return pr(h)?l(h):n(h)}function l(h){return h===59?(e.consume(h),i):pr(h)?(e.consume(h),l):n(h)}}function kB(e,t,n){return i;function i(c){return e.consume(c),a}function a(c){return ur(c)?n(c):t(c)}}function Vj(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||mn(e)}function Gj(e){return!pr(e)}function Kj(e){return!(e===47||Mm(e))}function Mm(e){return e===43||e===45||e===46||e===95||ur(e)}function Gp(e){let t=e.length,n=!1;for(;t--;){const i=e[t][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const SB={tokenize:AB,partial:!0};function CB(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:TB,continuation:{tokenize:RB},exit:EB}},text:{91:{name:"gfmFootnoteCall",tokenize:PB},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:jB,resolveTo:NB}}}}function jB(e,t,n){const i=this;let a=i.events.length;const c=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let l;for(;a--;){const f=i.events[a][1];if(f.type==="labelImage"){l=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return h;function h(f){if(!l||!l._balanced)return n(f);const p=ci(i.sliceSerialize({start:l.end,end:i.now()}));return p.codePointAt(0)!==94||!c.includes(p.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function NB(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;const c={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},c.start),end:Object.assign({},c.end)},h=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",c,t],["enter",l,t],["exit",l,t],["exit",c,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...h),e}function PB(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c=0,l;return h;function h(g){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),f}function f(g){return g!==94?n(g):(e.enter("gfmFootnoteCallMarker"),e.consume(g),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",p)}function p(g){if(c>999||g===93&&!l||g===null||g===91||mn(g))return n(g);if(g===93){e.exit("chunkString");const w=e.exit("gfmFootnoteCallString");return a.includes(ci(i.sliceSerialize(w)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(g),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(g)}return mn(g)||(l=!0),c++,e.consume(g),g===92?y:p}function y(g){return g===91||g===92||g===93?(e.consume(g),c++,p):p(g)}}function TB(e,t,n){const i=this,a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let c,l=0,h;return f;function f(S){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),p}function p(S){return S===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",y):n(S)}function y(S){if(l>999||S===93&&!h||S===null||S===91||mn(S))return n(S);if(S===93){e.exit("chunkString");const C=e.exit("gfmFootnoteDefinitionLabelString");return c=ci(i.sliceSerialize(C)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(S),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),w}return mn(S)||(h=!0),l++,e.consume(S),S===92?g:y}function g(S){return S===91||S===92||S===93?(e.consume(S),l++,y):y(S)}function w(S){return S===58?(e.enter("definitionMarker"),e.consume(S),e.exit("definitionMarker"),a.includes(c)||a.push(c),an(e,x,"gfmFootnoteDefinitionWhitespace")):n(S)}function x(S){return t(S)}}function RB(e,t,n){return e.check(Hl,t,e.attempt(SB,t,n))}function EB(e){e.exit("gfmFootnoteDefinition")}function AB(e,t,n){const i=this;return an(e,a,"gfmFootnoteDefinitionIndent",5);function a(c){const l=i.events[i.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(c):n(c)}}function IB(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:c,resolveAll:a};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function a(l,h){let f=-1;for(;++f<l.length;)if(l[f][0]==="enter"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._close){let p=f;for(;p--;)if(l[p][0]==="exit"&&l[p][1].type==="strikethroughSequenceTemporary"&&l[p][1]._open&&l[f][1].end.offset-l[f][1].start.offset===l[p][1].end.offset-l[p][1].start.offset){l[f][1].type="strikethroughSequence",l[p][1].type="strikethroughSequence";const y={type:"strikethrough",start:Object.assign({},l[p][1].start),end:Object.assign({},l[f][1].end)},g={type:"strikethroughText",start:Object.assign({},l[p][1].end),end:Object.assign({},l[f][1].start)},w=[["enter",y,h],["enter",l[p][1],h],["exit",l[p][1],h],["enter",g,h]],x=h.parser.constructs.insideSpan.null;x&&_r(w,w.length,0,hd(x,l.slice(p+1,f),h)),_r(w,w.length,0,[["exit",g,h],["enter",l[f][1],h],["exit",l[f][1],h],["exit",y,h]]),_r(l,p-1,f-p+3,w),f=p+w.length-2;break}}for(f=-1;++f<l.length;)l[f][1].type==="strikethroughSequenceTemporary"&&(l[f][1].type="data");return l}function c(l,h,f){const p=this.previous,y=this.events;let g=0;return w;function w(S){return p===126&&y[y.length-1][1].type!=="characterEscape"?f(S):(l.enter("strikethroughSequenceTemporary"),x(S))}function x(S){const C=oa(p);if(S===126)return g>1?f(S):(l.consume(S),g++,x);if(g<2&&!n)return f(S);const P=l.exit("strikethroughSequenceTemporary"),A=oa(S);return P._open=!A||A===2&&!!C,P._close=!C||C===2&&!!A,h(S)}}}class LB{constructor(){this.map=[]}add(t,n,i){MB(this,t,n,i)}consume(t){if(this.map.sort(function(c,l){return c[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let a=i.pop();for(;a;){for(const c of a)t.push(c);a=i.pop()}this.map.length=0}}function MB(e,t,n,i){let a=0;if(!(n===0&&i.length===0)){for(;a<e.map.length;){if(e.map[a][0]===t){e.map[a][1]+=n,e.map[a][2].push(...i);return}a+=1}e.map.push([t,n,i])}}function DB(e,t){let n=!1;const i=[];for(;t<e.length;){const a=e[t];if(n){if(a[0]==="enter")a[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(a[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const c=i.length-1;i[c]=i[c]==="left"?"center":"right"}}else if(a[1].type==="tableDelimiterRow")break}else a[0]==="enter"&&a[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return i}function FB(){return{flow:{null:{name:"table",tokenize:_B,resolveAll:OB}}}}function _B(e,t,n){const i=this;let a=0,c=0,l;return h;function h(N){let z=i.events.length-1;for(;z>-1;){const B=i.events[z][1].type;if(B==="lineEnding"||B==="linePrefix")z--;else break}const G=z>-1?i.events[z][1].type:null,J=G==="tableHead"||G==="tableRow"?_:f;return J===_&&i.parser.lazy[i.now().line]?n(N):J(N)}function f(N){return e.enter("tableHead"),e.enter("tableRow"),p(N)}function p(N){return N===124||(l=!0,c+=1),y(N)}function y(N){return N===null?n(N):Et(N)?c>1?(c=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),x):n(N):en(N)?an(e,y,"whitespace")(N):(c+=1,l&&(l=!1,a+=1),N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),l=!0,y):(e.enter("data"),g(N)))}function g(N){return N===null||N===124||mn(N)?(e.exit("data"),y(N)):(e.consume(N),N===92?w:g)}function w(N){return N===92||N===124?(e.consume(N),g):g(N)}function x(N){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(N):(e.enter("tableDelimiterRow"),l=!1,en(N)?an(e,S,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):S(N))}function S(N){return N===45||N===58?P(N):N===124?(l=!0,e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),C):q(N)}function C(N){return en(N)?an(e,P,"whitespace")(N):P(N)}function P(N){return N===58?(c+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),A):N===45?(c+=1,A(N)):N===null||Et(N)?ee(N):q(N)}function A(N){return N===45?(e.enter("tableDelimiterFiller"),L(N)):q(N)}function L(N){return N===45?(e.consume(N),L):N===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(N),e.exit("tableDelimiterMarker"),O):(e.exit("tableDelimiterFiller"),O(N))}function O(N){return en(N)?an(e,ee,"whitespace")(N):ee(N)}function ee(N){return N===124?S(N):N===null||Et(N)?!l||a!==c?q(N):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(N)):q(N)}function q(N){return n(N)}function _(N){return e.enter("tableRow"),E(N)}function E(N){return N===124?(e.enter("tableCellDivider"),e.consume(N),e.exit("tableCellDivider"),E):N===null||Et(N)?(e.exit("tableRow"),t(N)):en(N)?an(e,E,"whitespace")(N):(e.enter("data"),M(N))}function M(N){return N===null||N===124||mn(N)?(e.exit("data"),E(N)):(e.consume(N),N===92?I:M)}function I(N){return N===92||N===124?(e.consume(N),M):M(N)}}function OB(e,t){let n=-1,i=!0,a=0,c=[0,0,0,0],l=[0,0,0,0],h=!1,f=0,p,y,g;const w=new LB;for(;++n<e.length;){const x=e[n],S=x[1];x[0]==="enter"?S.type==="tableHead"?(h=!1,f!==0&&(Yw(w,t,f,p,y),y=void 0,f=0),p={type:"table",start:Object.assign({},S.start),end:Object.assign({},S.end)},w.add(n,0,[["enter",p,t]])):S.type==="tableRow"||S.type==="tableDelimiterRow"?(i=!0,g=void 0,c=[0,0,0,0],l=[0,n+1,0,0],h&&(h=!1,y={type:"tableBody",start:Object.assign({},S.start),end:Object.assign({},S.end)},w.add(n,0,[["enter",y,t]])),a=S.type==="tableDelimiterRow"?2:y?3:1):a&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")?(i=!1,l[2]===0&&(c[1]!==0&&(l[0]=l[1],g=iu(w,t,c,a,void 0,g),c=[0,0,0,0]),l[2]=n)):S.type==="tableCellDivider"&&(i?i=!1:(c[1]!==0&&(l[0]=l[1],g=iu(w,t,c,a,void 0,g)),c=l,l=[c[1],n,0,0])):S.type==="tableHead"?(h=!0,f=n):S.type==="tableRow"||S.type==="tableDelimiterRow"?(f=n,c[1]!==0?(l[0]=l[1],g=iu(w,t,c,a,n,g)):l[1]!==0&&(g=iu(w,t,l,a,n,g)),a=0):a&&(S.type==="data"||S.type==="tableDelimiterMarker"||S.type==="tableDelimiterFiller")&&(l[3]=n)}for(f!==0&&Yw(w,t,f,p,y),w.consume(t.events),n=-1;++n<t.events.length;){const x=t.events[n];x[0]==="enter"&&x[1].type==="table"&&(x[1]._align=DB(t.events,n))}return e}function iu(e,t,n,i,a,c){const l=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",h="tableContent";n[0]!==0&&(c.end=Object.assign({},Xo(t.events,n[0])),e.add(n[0],0,[["exit",c,t]]));const f=Xo(t.events,n[1]);if(c={type:l,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",c,t]]),n[2]!==0){const p=Xo(t.events,n[2]),y=Xo(t.events,n[3]),g={type:h,start:Object.assign({},p),end:Object.assign({},y)};if(e.add(n[2],0,[["enter",g,t]]),i!==2){const w=t.events[n[2]],x=t.events[n[3]];if(w[1].end=Object.assign({},x[1].end),w[1].type="chunkText",w[1].contentType="text",n[3]>n[2]+1){const S=n[2]+1,C=n[3]-n[2]-1;e.add(S,C,[])}}e.add(n[3]+1,0,[["exit",g,t]])}return a!==void 0&&(c.end=Object.assign({},Xo(t.events,a)),e.add(a,0,[["exit",c,t]]),c=void 0),c}function Yw(e,t,n,i,a){const c=[],l=Xo(t.events,n);a&&(a.end=Object.assign({},l),c.push(["exit",a,t])),i.end=Object.assign({},l),c.push(["exit",i,t]),e.add(n+1,0,c)}function Xo(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const BB={name:"tasklistCheck",tokenize:WB};function UB(){return{text:{91:BB}}}function WB(e,t,n){const i=this;return a;function a(f){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),c)}function c(f){return mn(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),l):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),l):n(f)}function l(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),h):n(f)}function h(f){return Et(f)?t(f):en(f)?e.check({tokenize:zB},t,n)(f):n(f)}}function zB(e,t,n){return an(e,i,"whitespace");function i(a){return a===null?n(a):t(a)}}function HB(e){return sj([mB(),CB(),IB(e),FB(),UB()])}const qB={};function Kp(e){const t=this,n=e||qB,i=t.data(),a=i.micromarkExtensions||(i.micromarkExtensions=[]),c=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),l=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);a.push(HB(n)),c.push(uB()),l.push(dB(n))}const Xw="*** Begin Patch",Jw="*** End Patch";function $B(e){const t=e.replace(/\r\n/g,`
98
+ `);if(!t.includes(Xw)||!t.includes(Jw))return null;const n=t.split(`
99
+ `),i=[];let a=null,c=null;for(const l of n){if(l===Xw||l===Jw)continue;if(l.startsWith("*** Update File: ")){a=Ef("update",l.slice(17)),i.push(a),c=null;continue}if(l.startsWith("*** Add File: ")){a=Ef("add",l.slice(14)),i.push(a),c={oldLineNumber:0,newLineNumber:1};continue}if(l.startsWith("*** Delete File: ")){a=Ef("delete",l.slice(17)),i.push(a),c=null;continue}if(!a)continue;if(l.startsWith("*** Move to: ")){a.nextPath=l.slice(13),a.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l.startsWith("@@")){c=GB(l)??{oldLineNumber:0,newLineNumber:0},a.lines.push({kind:"hunk",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l==="*** End of File"){a.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(a.action==="add"&&l.startsWith("+")){a.additions+=1,a.lines.push({kind:"add",text:l,oldLineNumber:null,newLineNumber:(c==null?void 0:c.newLineNumber)??a.additions}),c&&(c.newLineNumber+=1);continue}if(!c){a.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null});continue}if(l.startsWith("+")){a.additions+=1,a.lines.push({kind:"add",text:l,oldLineNumber:null,newLineNumber:c.newLineNumber}),c.newLineNumber+=1;continue}if(l.startsWith("-")){a.deletions+=1,a.lines.push({kind:"remove",text:l,oldLineNumber:c.oldLineNumber,newLineNumber:null}),c.oldLineNumber+=1;continue}if(l.startsWith(" ")||l.length===0){a.lines.push({kind:"context",text:l,oldLineNumber:c.oldLineNumber,newLineNumber:c.newLineNumber}),c.oldLineNumber+=1,c.newLineNumber+=1;continue}a.lines.push({kind:"meta",text:l,oldLineNumber:null,newLineNumber:null})}return i.length===0?null:{files:i,totalAdditions:i.reduce((l,h)=>l+h.additions,0),totalDeletions:i.reduce((l,h)=>l+h.deletions,0)}}function VB(e){return e.replace(/\\/g,"/").split("/").at(-1)||e}function Ef(e,t){return{path:t,nextPath:null,action:e,additions:0,deletions:0,lines:[]}}function GB(e){const t=e.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);return t?{oldLineNumber:Number(t[1]),newLineNumber:Number(t[2])}:null}const KB=/data:image\/([a-zA-Z0-9.+-]+);base64,([A-Za-z0-9+/=]+)/g,QB=/!\[([^\]]*)\]\((data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)\)/g,YB=/<img\b[^>]*src=["'](data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)["'][^>]*>/gi,XB=/<image\b([^>]*)>([\s\S]*?)<\/image>/gi;function Nl(e){const t=JB(e);return t||Qj(e)}function JB(e){const t=e.trim();if(!ZB(t))return null;try{const n=JSON.parse(t),i=eU(n);return i.text||i.inlineImages.length>0?i:null}catch{return null}}function ZB(e){return e.length<2?!1:e.startsWith("[")&&e.endsWith("]")||e.startsWith("{")&&e.endsWith("}")}function eU(e){const t=[],n=[];return Su(e,t,n),{text:Xj(t.join(`
100
+
101
+ `)),inlineImages:Yj(n)}}function Su(e,t,n){if(typeof e=="string"){const l=Qj(e);l.text&&t.push(l.text),n.push(...l.inlineImages);return}if(e==null)return;if(Array.isArray(e)){e.forEach(l=>Su(l,t,n));return}if(typeof e!="object")return;const i=e,a=new Set,c=tU(i);c&&(n.push(c),["type","source","media_type","mime_type","mimeType","data","image_url","imageUrl","url","src","alt","name"].forEach(l=>{l in i&&a.add(l)}));for(const l of["image_url","url","src","source"]){const h=i[l];typeof h!="string"||!Jj(h)||(n.push(ao(h,Vr(i.alt))),a.add(l))}for(const l of["text","message","content","output","result","summary","caption"])l in i&&(a.add(l),Su(i[l],t,n));a.size>0||Object.values(i).forEach(l=>{Su(l,t,n)})}function Qj(e){const t=[];let n=e;return n=n.replace(XB,(i,a,c)=>{const l=oU(a,"name"),h=sU(c);return h!=null&&h.url&&t.push(ao(h.url,h.altText||l)),""}),n=n.replace(QB,(i,a,c)=>(t.push(ao(c,a)),"")),n=n.replace(YB,(i,a)=>(t.push(ao(a,null)),"")),n=n.replace(KB,(i,a,c)=>(t.push(ao(i,null,`image/${a}`,Qu(c))),"")),{text:Xj(n),inlineImages:Yj(t)}}function ao(e,t,n,i){const a=n??nU(e)??"image/png";return{url:e,mimeType:a,altText:Pl(t),estimatedBytes:i??rU(e)}}function tU(e){const t=iU(e.source);if(t){const a=Vr(t.type).trim().toLowerCase(),c=ex(t.media_type??t.mime_type??t.mimeType),l=Zw(t.data);if(a==="base64"&&c&&l)return ao(`data:${c};base64,${l}`,Pl(Vr(t.alt)||Vr(t.name)||Vr(e.alt)||Vr(e.name)),c,Qu(l))}const n=ex(e.media_type??e.mime_type??e.mimeType),i=Zw(e.data);return n&&i?ao(`data:${n};base64,${i}`,Pl(Vr(e.alt)||Vr(e.name)),n,Qu(i)):null}function Yj(e){const t=new Map;return e.forEach(n=>{t.has(n.url)||t.set(n.url,n)}),[...t.values()]}function Xj(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 Jj(e){return/^data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+$/.test(e.trim())}function nU(e){var n;const t=e.match(/^data:(image\/[a-zA-Z0-9.+-]+);base64,/i);return((n=t==null?void 0:t[1])==null?void 0:n.toLowerCase())??null}function rU(e){const t=e.match(/^data:image\/[a-zA-Z0-9.+-]+;base64,([A-Za-z0-9+/=]+)$/i);return t?Qu(t[1]):null}function Qu(e){const t=e.trim(),n=t.endsWith("==")?2:t.endsWith("=")?1:0;return Math.max(0,Math.floor(t.length*3/4)-n)}function Pl(e){const t=Vr(e).trim();return t.length>0?t:null}function Zw(e){if(typeof e!="string")return null;const t=e.replace(/\s+/g,"").trim();return/^[A-Za-z0-9+/=]+$/.test(t)?t:null}function ex(e){if(typeof e!="string")return null;const t=e.trim().toLowerCase();return t.startsWith("image/")?t:null}function Vr(e){return typeof e=="string"?e:""}function iU(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function sU(e){const t=e.trim();if(t.length===0)return null;try{const n=JSON.parse(t),i=Vr(n.image_url??n.imageUrl).trim(),a=Pl(Vr(n.name)||Vr(n.alt));return{url:Jj(i)?i:null,altText:a}}catch{const n=t.match(/(data:image\/[a-zA-Z0-9.+-]+;base64,[A-Za-z0-9+/=]+)/i);return n?{url:n[1],altText:null}:null}}function oU(e,t){const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=e.match(new RegExp(`${n}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|\\[([^\\]]*)\\]|([^\\s>]+))`,"i"));return Pl((i==null?void 0:i[1])??(i==null?void 0:i[2])??(i==null?void 0:i[3])??(i==null?void 0:i[4])??"")}function aU(e){return e.replace(/(\.{3,}|…+)$/,"").trimEnd()}const lU=480,Zj=b.createContext(!1);function Dm(e){return e.replace(/\\/g,"/")}function Yu(e){return/^[a-zA-Z]:\//.test(e)}function cU(e){return e.startsWith("/")||e.startsWith("//")||Yu(e)}function uU(e){return/^[a-zA-Z][a-zA-Z\d+.-]*:/.test(e)&&!Yu(e)}function tx(e){return e.replace(/\/+$/,"")}function dU(e){const t=e.indexOf("#"),n=t>=0?e.slice(0,t):e,i=n.indexOf("?");return(i>=0?n.slice(0,i):n).replace(/:(\d+)(?::(\d+))?$/,"")}function hU(e){const t=[];for(const n of Dm(e).split("/"))if(!(!n||n===".")){if(n===".."){if(t.length===0)return null;t.pop();continue}t.push(n)}return t.join("/")}function Qp(e){try{return decodeURIComponent(e)}catch{return e}}function fU(e,t){const n=Qp(e).trim();if(!n||n.startsWith("#"))return null;let i=n;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(uU(i))return null;if(i=Dm(dU(i.trim())),!i)return null;const a=tx(Dm(t.trim()));if(!a)return null;if(cU(i)){const c=tx(i),l=Yu(a)?a.toLowerCase():a,h=Yu(c)?c.toLowerCase():c;if(h===l)return null;const f=`${l}/`;return h.startsWith(f)?c.slice(a.length+1):null}return hU(i)}function Fm(e){return e.kind==="tool_call"||e.kind==="tool_result"}function eN(e){return e.toolCall?e.toolCall:Fm(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 mU(e){return e==="shell_command"||e==="tool"?u("conversation.roleTool"):e}function tN(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 eo(e,t){const n=e[t];return typeof n=="string"?n:""}function pU(e){if(e.name==="apply_patch")return $B(e.input);if(e.name!=="Write"&&e.name!=="Edit"&&e.name!=="MultiEdit")return null;const t=tN(e.input);if(!t)return null;const n=eo(t,"file_path")||eo(t,"path");if(!n)return null;if(e.name==="Write"){const c=eo(t,"content"),l=c.length>0?c.split(/\r?\n/):[];return{files:[{path:n,nextPath:null,action:"add",additions:l.length,deletions:0,lines:l.map((h,f)=>({kind:"add",text:`+${h}`,oldLineNumber:null,newLineNumber:f+1}))}],totalAdditions:l.length,totalDeletions:0}}if(e.name==="Edit"){const c=eo(t,"old_string").split(/\r?\n/),l=eo(t,"new_string").split(/\r?\n/);return nx(n,[{oldLines:c,newLines:l}])}const a=(Array.isArray(t.edits)?t.edits:[]).map(c=>{if(!c||typeof c!="object"||Array.isArray(c))return null;const l=c;return{oldLines:eo(l,"old_string").split(/\r?\n/),newLines:eo(l,"new_string").split(/\r?\n/)}}).filter(c=>!!c);return a.length>0?nx(n,a):null}function nx(e,t){const n=[];let i=0,a=0;return t.forEach((c,l)=>{n.push({kind:"hunk",text:`@@ -1,${c.oldLines.length} +1,${c.newLines.length} @@`,oldLineNumber:null,newLineNumber:null}),c.oldLines.forEach((h,f)=>{h.length===0&&c.oldLines.length===1&&c.newLines.length>0||(a+=1,n.push({kind:"remove",text:`-${h}`,oldLineNumber:f+1,newLineNumber:null}))}),c.newLines.forEach((h,f)=>{h.length===0&&c.newLines.length===1&&c.oldLines.length>0||(i+=1,n.push({kind:"add",text:`+${h}`,oldLineNumber:null,newLineNumber:f+1}))}),l<t.length-1&&n.push({kind:"meta",text:"***",oldLineNumber:null,newLineNumber:null})}),{files:[{path:e,nextPath:null,action:"update",additions:i,deletions:a,lines:n}],totalAdditions:i,totalDeletions:a}}function gU(e){const t=tN(e.input),n=t&&typeof t.command=="string"?t.command.trim():"";if(n)return`${u("conversation.toolPreviewCommand")}:${n}`;if(e.name==="read_thread_terminal")return u("conversation.toolPreviewTerminal");const i=e.input||e.error||e.output||u("conversation.toolResultEmpty");return i.length>60?`${i.slice(0,60)}...`:i}function bU(e){const t=e.map(c=>({message:c,tool:eN(c)})).filter(c=>!!c.tool);if(t.length===0)return null;const n={...t[0].tool};let i=!1,a=!1;for(const{message:c,tool:l}of t)c.kind==="tool_call"&&(i=!0,!n.input&&l.input&&(n.input=l.input)),c.kind==="tool_result"&&(a=!0,n.output=l.output,n.error=l.error,n.status=l.status,!n.input&&l.input&&(n.input=l.input)),!n.name&&l.name&&(n.name=l.name);return{key:t.map(({message:c})=>c.id).join(":"),tool:n,hasRequest:i,hasResult:a}}function yU(e){const t=new Map;for(const n of e){const i=eN(n);if(!i)continue;const a=t.get(i.callId);if(a){a.messages.push(n);continue}t.set(i.callId,{messages:[n],firstSequence:n.sequence})}return Array.from(t.values()).sort((n,i)=>n.firstSequence-i.firstSequence).map(n=>bU(n.messages)).filter(n=>!!n)}function vU(e){const t=[];for(let n=0;n<e.length;n+=1){const i=e[n];if(!Fm(i)){t.push({type:"message",key:i.id,message:i});continue}const a=[i];let c=n+1;for(;c<e.length;){const h=e[c];if(!Fm(h))break;a.push(h),c+=1}const l=yU(a);if(l.length===0){t.push({type:"message",key:i.id,message:i}),n=c-1;continue}l.forEach(h=>{t.push({type:"tool_group",key:h.key,group:h})}),n=c-1}return t}function wU(e,t){if(!aI(null,e))return!1;const n=t.trim();return/AGENTS\.md instructions for/i.test(n)&&/<INSTRUCTIONS>/i.test(n)&&/<\/INSTRUCTIONS>/i.test(n)}function xU(e){const t=e.split(/\r?\n/).map(n=>n.trim()).find(Boolean);return t?t.replace(/^#+\s*/,""):u("conversation.rulesMessageTitle")}function kU(e,t){const n=new Set;if(t!=="kimi")return n;for(const i of e){if(i.role==="system"&&i.kind==="text"){n.add(i.id);continue}break}return n}function Tl(e){var t;return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(n=>Tl(n)).join(""):e&&typeof e=="object"&&"props"in e?Tl(((t=e.props)==null?void 0:t.children)??""):""}function SU(e){const t=Array.isArray(e)?e[0]:e;if(!b.isValidElement(t))return null;const n=t.props,i=typeof n.className=="string"?n.className:"",a=/language-([^\s]+)/.exec(i);return{content:Tl(n.children).replace(/\n$/,""),codeClassName:i||void 0,language:(a==null?void 0:a[1])??null}}function CU(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 nN(e,t){var n;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!CU(e))throw new Error(u("conversation.copyContentFailed"))}}function jU({className:e,children:t,onCopy:n}){const i=b.useContext(Zj),a=Tl(t).trim();if(i||!a)return r.jsx("code",{className:e||void 0,children:t});function c(l){l.key!=="Enter"&&l.key!==" "||(l.preventDefault(),n(a))}return r.jsx("code",{className:[e,"markdown-inline-copy"].filter(Boolean).join(" "),role:"button",tabIndex:0,"aria-label":u("conversation.copyAction"),onClick:()=>n(a),onKeyDown:c,children:t})}function NU({href:e,children:t,className:n,onInteract:i}){const a=Tl(t).trim()||(e?Qp(e).trim():"");return r.jsx(Zj.Provider,{value:!0,children:r.jsx("a",{href:e,className:[n,"markdown-interactive-link"].filter(Boolean).join(" "),onClick:c=>{c.preventDefault(),i(e,a)},children:t})})}function rN({language:e,codeClassName:t,content:n}){const{showToast:i}=En(),a=zn(),c=(e==null?void 0:e.trim().toLowerCase())??null,l=c==="text",h=c||"code";async function f(){try{await nN(n,a),i({title:u("conversation.copyContentSuccess"),tone:"success"})}catch(p){i({title:p instanceof Error?p.message:u("conversation.copyContentFailed"),tone:"error"})}}return r.jsxs("div",{className:`code-block${l?" text-code-block":""}`,children:[r.jsxs("div",{className:"code-header",children:[r.jsx("span",{className:"code-header-label",children:h}),r.jsx("button",{className:"code-copy-button",type:"button",onClick:()=>void f(),children:u("conversation.copyAction")})]}),r.jsx("pre",{className:t,children:r.jsx("code",{children:n})})]})}function Cu({content:e,className:t}){const{showToast:n}=En(),i=zn(),{navigationGroups:a,currentWorkspaceId:c,revealWorkspaceFile:l}=Yn(),h=b.useMemo(()=>{var y;return((y=a.find(g=>g.workspace.id===c))==null?void 0:y.workspace)??null},[c,a]);async function f(y){if(y.trim())try{await nN(y,i),n({title:u("conversation.copyContentSuccess"),tone:"success"})}catch(g){n({title:g instanceof Error?g.message:u("conversation.copyContentFailed"),tone:"error"})}}function p(y,g){const w=y&&(h!=null&&h.path)?fU(y,h.path):null;w&&l({workspaceId:(h==null?void 0:h.id)??c,filePath:w,openViewer:!1})||f(g||(y?Qp(y).trim():""))}return r.jsx("div",{className:t,children:r.jsx(qp,{remarkPlugins:[Kp],components:{p:({node:y,...g})=>r.jsx("p",{...g}),a(y){return r.jsx(NU,{href:typeof y.href=="string"?y.href:void 0,className:typeof y.className=="string"?y.className:void 0,onInteract:p,children:y.children})},pre(y){const g=SU(y.children);return g?r.jsx(rN,{language:g.language,codeClassName:g.codeClassName,content:g.content}):r.jsx("pre",{children:y.children})},code(y){const g=typeof y.className=="string"?y.className:"";return r.jsx(jU,{className:g||void 0,onCopy:w=>{f(w)},children:y.children})}},children:e})})}function rx(e,t){return!(t!=null&&t.contentBase64)||t.mimeType!==e.mimeType?null:`data:${t.mimeType};base64,${t.contentBase64}`}function su({sessionId:e,attachmentPayloads:t=[],attachments:n=[],inlineImages:i=[]}){return r.jsx(PU,{sessionId:e,attachments:n,attachmentPayloads:t,inlineImages:i})}function PU({sessionId:e,attachmentPayloads:t=[],attachments:n=[],inlineImages:i=[]}){const[a,c]=b.useState({}),[l,h]=b.useState(null),f=b.useMemo(()=>n.map((w,x)=>{const S=rx(w,t==null?void 0:t[x]);if(S)return{id:w.id,fileName:w.fileName,fileSize:w.fileSize,url:S,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,n,a,e]),p=b.useMemo(()=>i.map((w,x)=>({id:`inline-image-${x}`,fileName:w.altText||`${u("conversation.imageAttachmentLabel")} ${x+1}`,fileSize:w.estimatedBytes,url:w.url,status:"ready"})),[i]),y=b.useMemo(()=>[...p,...f],[f,p]),g=y.find(w=>w.id===l)??null;return b.useEffect(()=>{if(!l)return;function w(x){x.key==="Escape"&&h(null)}return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[l]),b.useEffect(()=>{const w=n.filter((C,P)=>!rx(C,t==null?void 0:t[P]));if(!e||w.length===0){c({});return}let x=!1;const S=[];return c(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 P=await LA(e,C.id),A=URL.createObjectURL(P);return S.push(A),{id:C.id,fileName:C.fileName,fileSize:C.fileSize,url:A,status:"ready"}}catch{return{id:C.id,fileName:C.fileName,fileSize:C.fileSize,url:null,status:"error"}}})).then(C=>{if(x){S.forEach(P=>URL.revokeObjectURL(P));return}c(Object.fromEntries(C.map(P=>[P.id,P])))}),()=>{x=!0,S.forEach(C=>URL.revokeObjectURL(C))}},[t,n,e]),y.length===0?null:r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"message-attachments",children:y.map(w=>{const x=w.status==="loading"?u("conversation.attachmentPreviewLoading"):w.status==="error"?u("conversation.attachmentPreviewUnavailable"):u("conversation.attachmentPreviewOpen");return r.jsx("button",{type:"button",className:"message-attachment-button",onClick:()=>w.url&&h(w.id),disabled:!w.url,"aria-label":`${w.fileName} - ${x}`,title:x,children:r.jsx("div",{className:"message-attachment-card",children:w.url?r.jsx("img",{className:"message-attachment-thumbnail",src:w.url,alt:w.fileName||u("conversation.attachmentPreviewAlt"),loading:"lazy"}):r.jsx("div",{className:"message-attachment-placeholder","aria-hidden":"true",children:w.status==="loading"?u("conversation.attachmentPreviewLoading"):u("conversation.attachmentPreviewUnavailable")})})},w.id)})}),g!=null&&g.url?r.jsxs("div",{className:"workbench-modal-layer message-image-modal",role:"dialog","aria-modal":"true",children:[r.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":u("conversation.attachmentPreviewClose"),onClick:()=>h(null)}),r.jsxs("div",{className:"workbench-modal-card surface-card message-image-modal-card",children:[r.jsxs("div",{className:"workbench-modal-header message-image-modal-header",children:[r.jsxs("div",{className:"workbench-modal-title-wrap",children:[r.jsx("h2",{children:u("conversation.imagePreviewTitle")}),r.jsx("p",{children:g.fileName})]}),r.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":u("conversation.attachmentPreviewClose"),onClick:()=>h(null),children:"x"})]}),r.jsxs("div",{className:"message-image-modal-body",children:[r.jsx("div",{className:"message-image-modal-stage",children:r.jsx("img",{className:"message-image-modal-image",src:g.url,alt:g.fileName||u("conversation.attachmentPreviewAlt")})}),r.jsx("p",{className:"message-image-modal-hint",children:u("conversation.imagePreviewHint")})]})]})]}):null]})}function TU(){return r.jsx("div",{className:"timeline-skeleton","aria-hidden":"true",children:Array.from({length:5},(e,t)=>r.jsxs("article",{className:`timeline-skeleton-item ${t%2===0?"assistant":"user"}`,children:[r.jsx("div",{className:"timeline-skeleton-avatar"}),r.jsxs("div",{className:"timeline-skeleton-bubble",children:[r.jsx("span",{className:"timeline-skeleton-line long"}),r.jsx("span",{className:"timeline-skeleton-line medium"}),r.jsx("span",{className:"timeline-skeleton-line short"})]})]},t))})}function RU({tool:e,preview:t}){const[n,i]=b.useState(null);return b.useEffect(()=>{if(n===null)return;function a(c){c.key==="Escape"&&i(null)}return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[n]),r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"tool-call-item apply-patch-item",children:t.files.map((a,c)=>r.jsxs("button",{type:"button",className:"apply-patch-summary-row",onClick:()=>i(c),children:[r.jsx("span",{className:"apply-patch-summary-label",children:ix(a.action)}),r.jsx("span",{className:"apply-patch-summary-file",title:Af(a),children:VB(a.nextPath??a.path)}),r.jsxs("span",{className:"apply-patch-summary-stats",children:[r.jsxs("span",{className:"apply-patch-summary-added",children:["+",a.additions]}),r.jsxs("span",{className:"apply-patch-summary-removed",children:["-",a.deletions]})]})]},sx(a,c)))}),n!==null&&typeof document<"u"?Qn.createPortal(r.jsxs("div",{className:"workbench-modal-layer apply-patch-modal",role:"dialog","aria-modal":"true",children:[r.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":u("common.close"),onClick:()=>i(null)}),r.jsxs("div",{className:"workbench-modal-card surface-card apply-patch-modal-card",children:[r.jsxs("div",{className:"workbench-modal-header",children:[r.jsxs("div",{className:"workbench-modal-title-wrap",children:[r.jsx("h2",{children:u("conversation.applyPatchDialogTitle")}),r.jsx("p",{children:u("conversation.applyPatchDialogDescription")})]}),r.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":u("common.close"),onClick:()=>i(null),children:"x"})]}),(()=>{const a=t.files[n];return a?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"apply-patch-modal-totals",children:[r.jsxs("span",{className:"apply-patch-stat-pill positive",children:[u("conversation.applyPatchAddedStat")," +",a.additions]}),r.jsxs("span",{className:"apply-patch-stat-pill negative",children:[u("conversation.applyPatchRemovedStat")," -",a.deletions]})]}),r.jsxs("div",{className:"apply-patch-modal-body",children:[r.jsxs("section",{className:"apply-patch-file-panel",children:[r.jsxs("div",{className:"apply-patch-file-panel-header",children:[r.jsxs("div",{className:"apply-patch-file-panel-title",children:[r.jsx("span",{className:"apply-patch-summary-label",children:ix(a.action)}),r.jsx("strong",{children:Af(a)})]}),r.jsxs("div",{className:"apply-patch-summary-stats",children:[r.jsxs("span",{className:"apply-patch-summary-added",children:["+",a.additions]}),r.jsxs("span",{className:"apply-patch-summary-removed",children:["-",a.deletions]})]})]}),r.jsx("div",{className:"apply-patch-diff-view",children:r.jsx("div",{className:"apply-patch-diff-scroll",children:a.lines.map((c,l)=>r.jsxs("div",{className:`apply-patch-diff-line ${AU(c.kind)}`,children:[r.jsx("span",{className:"apply-patch-line-number",children:ox(c.oldLineNumber)}),r.jsx("span",{className:"apply-patch-line-number",children:ox(c.newLineNumber)}),r.jsx("span",{className:"apply-patch-line-content",children:c.text||" "})]},`${Af(a)}:${l}`))})})]},sx(a,n)),e.error?r.jsxs("section",{className:"apply-patch-error-panel",children:[r.jsx("div",{className:"tool-call-section-label",children:u("conversation.toolResultLabel")}),r.jsx("pre",{className:"tool-call-error",children:e.error})]}):null]})]}):null})()]})]}),document.body):null]})}function EU({group:e}){const[t,n]=b.useState(!1),{tool:i,hasRequest:a,hasResult:c}=e,l=mU(i.name),h=b.useMemo(()=>pU(i),[i.input,i.name]);if(h)return r.jsx(RU,{tool:i,preview:h});const f=gU(i),p=!!(i.input||i.output||i.error);return r.jsxs("div",{className:`tool-call-item ${c?"tool-result":""}`,children:[r.jsxs("button",{type:"button",className:"tool-call-header",onClick:()=>p&&n(y=>!y),children:[r.jsxs("div",{className:"tool-call-info",children:[r.jsx("span",{className:"tool-call-name",children:l}),r.jsx("span",{className:"tool-call-input-preview",children:f})]}),r.jsx("div",{className:"tool-call-meta",children:p&&r.jsx("span",{className:`tool-call-toggle ${t?"expanded":""}`,children:r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:r.jsx("polyline",{points:"6 9 12 15 18 9"})})})})]}),t&&p&&r.jsxs("div",{className:"tool-call-output",children:[a&&i.input&&r.jsxs("div",{className:"tool-call-section",children:[r.jsx("div",{className:"tool-call-section-label",children:u("conversation.toolInputLabel")}),r.jsx("pre",{children:i.input})]}),(c||i.error||i.output)&&r.jsxs("div",{className:"tool-call-section",children:[r.jsx("div",{className:"tool-call-section-label",children:u("conversation.toolResultLabel")}),r.jsx("pre",{className:i.error?"tool-call-error":void 0,children:i.error||i.output||u("conversation.toolResultEmpty")})]})]})]})}function ix(e){return u(e==="add"?"conversation.applyPatchAddedLabel":e==="delete"?"conversation.applyPatchDeletedLabel":"conversation.applyPatchEditedLabel")}function Af(e){return e.nextPath&&e.nextPath!==e.path?`${e.path} -> ${e.nextPath}`:e.nextPath??e.path}function sx(e,t){return`${e.path}:${e.nextPath??""}:${t}`}function AU(e){return e==="add"?"is-added":e==="remove"?"is-removed":e==="hunk"?"is-hunk":e==="meta"?"is-meta":"is-context"}function ox(e){return e===null||e<=0?"":String(e)}function IU(e){return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function iN({timestamp:e,children:t}){return r.jsxs("div",{className:"message-meta",children:[t,r.jsx("time",{className:"message-time",dateTime:e,children:IU(e)})]})}function LU({message:e,kind:t,tone:n,onRetry:i}){const[a,c]=b.useState(!1),l=xU(e.content),h=n==="user-message",f=u(t==="system_prompt"?"conversation.systemPromptTitle":"conversation.rulesMessageTitle"),p=u(t==="system_prompt"?"conversation.systemPromptHint":"conversation.rulesMessageHint"),y=u(a?t==="system_prompt"?"conversation.systemPromptCollapse":"conversation.rulesMessageCollapse":t==="system_prompt"?"conversation.systemPromptExpand":"conversation.rulesMessageExpand");return r.jsxs("article",{className:`message-item ${n} rules-message-row`,children:[r.jsxs("div",{className:"message-content-wrapper",children:[r.jsxs("div",{className:"rules-message-card",children:[r.jsxs("button",{type:"button",className:"rules-message-toggle","aria-expanded":a,onClick:()=>c(g=>!g),children:[r.jsxs("div",{className:"rules-message-heading",children:[r.jsx("span",{className:"rules-message-badge",children:f}),r.jsx("span",{className:"rules-message-summary",children:l})]}),r.jsx("span",{className:"rules-message-action",children:y})]}),r.jsx("p",{className:"rules-message-hint",children:p}),a&&r.jsx("div",{className:"rules-message-body",children:r.jsx(Cu,{content:e.content,className:"message-text message-content markdown-content"})})]}),e.deliveryState==="failed"&&e.clientRequestId&&r.jsx("button",{className:"retry-button",type:"button",onClick:()=>i(e.clientRequestId),children:u("conversation.resendButton")})]}),h?r.jsx(iN,{timestamp:e.timestamp}):null]})}function MU({message:e,provider:t,foldedPromptKind:n=null,onRetry:i,assistantAvatar:a}){const c=e.role==="user",l=e.kind==="thinking",h=e.role==="assistant"&&e.kind==="text",f=n??(wU(t,e.content)?"rules":null),p=b.useMemo(()=>Nl(e.content),[e.content]),y=p.text,g=p.inlineImages,[w,x]=b.useState(!1),[S,C]=b.useState(!1),[P,A]=b.useState(null),[L,O]=b.useState(null);if(f){const ee=e.role==="user"?"user-message":e.role==="assistant"?"assistant-message":"system-message";return r.jsx(LU,{message:e,kind:f,tone:ee,onRetry:i})}if(c){const ee=e.origin==="butler_proxy"||DU(e.clientRequestId),q=e.origin==="butler_proxy"&&typeof e.originRef=="string"&&e.originRef.trim().length>0;async function _(){if(!q)return;const E=!w;if(x(E),!(!E||L||S)){C(!0),A(null);try{const M=await SC(e.originRef);O(M.task)}catch(M){A(M instanceof Error?M.message:u("conversation.butlerOriginDetailLoadFailed"))}finally{C(!1)}}}return r.jsxs("article",{className:"message-item user-message",children:[r.jsxs("div",{className:"message-content-wrapper",children:[r.jsx(su,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:g}),y?r.jsx(Cu,{content:y,className:"message-text message-content markdown-content"}):null,e.deliveryState==="failed"&&e.clientRequestId&&r.jsx("button",{className:"retry-button",type:"button",onClick:()=>i(e.clientRequestId),children:u("conversation.resendButton")})]}),r.jsx(iN,{timestamp:e.timestamp,children:ee?q?r.jsxs("div",{className:"message-origin-detail-anchor",children:[r.jsx("button",{type:"button",className:"message-origin-badge message-origin-badge-button","aria-expanded":w,onClick:()=>{_()},children:u("conversation.butlerProxyMessageBadge")}),w?r.jsxs("div",{className:"message-origin-detail-popover",role:"dialog","aria-live":"polite",children:[r.jsx("strong",{children:u("conversation.butlerOriginDetailTitle")}),S?r.jsx("p",{children:u("conversation.butlerOriginDetailLoading")}):P?r.jsx("p",{children:P}):L?r.jsxs(r.Fragment,{children:[r.jsxs("p",{children:[u("conversation.butlerOriginDetailObjectiveLabel"),":",L.objective]}),r.jsxs("p",{children:[u("conversation.butlerOriginDetailStatusLabel"),":",FU(L.status)]}),r.jsxs("p",{children:[u("conversation.butlerOriginDetailSummaryLabel"),":",L.lastAutomationSummary||u("conversation.butlerAnalysisEmpty")]}),L.waitingReason?r.jsxs("p",{children:[u("conversation.butlerOriginDetailWaitingReasonLabel"),":",L.waitingReason]}):null]}):r.jsx("p",{children:u("conversation.butlerAnalysisEmpty")})]}):null]}):r.jsx("span",{className:"message-origin-badge",children:u("conversation.butlerProxyMessageBadge")}):null})]})}return l?r.jsxs("article",{className:"message-item assistant-message thinking-message-row",children:[r.jsx("div",{className:"message-avatar",children:a??r.jsx(ax,{})}),r.jsxs("div",{className:"thinking-message-content",children:[r.jsx("div",{className:"thinking-message-label",children:u("conversation.thinkingLabel")}),r.jsx(su,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:g}),y&&r.jsx(Cu,{content:y,className:"message-text message-content markdown-content thinking-message-text"})]})]}):h?r.jsxs("article",{className:"message-item assistant-message",children:[r.jsx("div",{className:"message-avatar",children:a??r.jsx(ax,{})}),r.jsxs("div",{className:"message-content-wrapper",children:[r.jsx(su,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:g}),y&&r.jsx(Cu,{content:y,className:"message-text message-content markdown-content"})]})]}):r.jsx("article",{className:"message-item system-message",children:r.jsxs("div",{className:"message-content-wrapper",children:[r.jsx(su,{sessionId:e.sessionId,attachments:e.attachments,attachmentPayloads:e.attachmentPayloads,inlineImages:g}),y?r.jsx("div",{className:"message-text message-content",children:r.jsx(rN,{language:"text",content:y})}):null]})})}function ax(){return r.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("circle",{cx:"12",cy:"12",r:"10"}),r.jsx("path",{d:"M12 16v-4M12 8h.01"})]})}function DU(e){return typeof e=="string"&&e.startsWith("butler-follow-up:")}function FU(e){switch(e){case"waiting_user":return u("shell.butlerAutomationStatusWaitingUser");case"completed":return u("shell.butlerAutomationStatusCompleted");case"failed":return u("shell.butlerAutomationStatusFailed");case"cancelled":return u("shell.butlerAutomationStatusCancelled");case"active":default:return u("shell.butlerAutomationStatusActive")}}function Yp({sessionId:e="session",messages:t,historyState:n,loadingOlderMessages:i=!1,hasOlderMessages:a=!1,onLoadOlderMessages:c=()=>{},onRetryMessage:l,provider:h,runtimeThinkingPlaceholder:f=null,assistantAvatar:p}){const{showToast:y}=En(),g=b.useRef(null),w=b.useRef(e),x=b.useRef(t.length),S=b.useRef(If(t.at(-1)??null)),C=b.useRef(!0),P=b.useRef(null),A=b.useRef(!1),L=vU(t),O=b.useMemo(()=>kU(t,h),[t,h]),ee=n==="loading"&&t.length===0;function q(E){return A.current||!a||i||n!=="ready"||E.scrollTop>lU?!1:(A.current=!0,P.current=E.scrollHeight-E.scrollTop,c(),!0)}b.useEffect(()=>{n==="error"&&y({title:u("conversation.historyLoadFailed"),tone:"error"})},[n,y]),b.useEffect(()=>{w.current!==e&&(w.current=e,x.current=0,S.current=null,C.current=!0,P.current=null)},[e]),b.useLayoutEffect(()=>{const E=g.current;if(!E){x.current=t.length,S.current=If(t.at(-1)??null);return}const M=x.current,I=S.current,N=If(t.at(-1)??null);P.current!==null&&t.length>=M?(E.scrollTop=Math.max(0,E.scrollHeight-P.current),P.current=null):C.current&&(M===0||t.length!==M||N!==I)&&(E.scrollTop=E.scrollHeight),x.current=t.length,S.current=N},[t,e]),b.useEffect(()=>{if(!a){A.current=!1;return}!i&&P.current===null&&(A.current=!1)},[a,i,t.length]);function _(){const E=g.current;if(!E)return;const M=E.scrollHeight-E.clientHeight-E.scrollTop;C.current=M<=80,q(E)}return b.useEffect(()=>{const E=g.current;E&&q(E)},[a,n,i,t.length,c]),r.jsxs("section",{className:"message-timeline",children:[n==="loading"&&r.jsx("div",{className:"timeline-status",children:r.jsx("span",{className:"status-text",children:u("conversation.historyLoading")})}),r.jsxs("div",{ref:g,className:"message-list",onScroll:_,children:[ee?r.jsx(TU,{}):null,i?r.jsx("div",{className:"timeline-status timeline-status-inline",children:r.jsx("span",{className:"status-text",children:u("conversation.historyLoadingOlder")})}):null,L.length===0&&n==="ready"&&r.jsx("div",{className:"timeline-empty",children:r.jsx("p",{className:"status-text",children:u("conversation.timelineEmpty")})}),L.map(E=>E.type==="tool_group"?r.jsx("article",{className:"message-item tool-message-row",children:r.jsx(EU,{group:E.group})},E.key):r.jsx(MU,{message:E.message,provider:h,foldedPromptKind:O.has(E.message.id)?"system_prompt":null,onRetry:l,assistantAvatar:p},E.key)),f?r.jsx("div",{className:"timeline-status timeline-status-inline thinking-status-inline",children:r.jsxs("span",{className:"status-text thinking-status-text","aria-label":f,children:[r.jsx("span",{children:aU(f)||f}),r.jsx("span",{className:"thinking-status-dots","aria-hidden":"true",children:"..."})]})}):null]})]})}function If(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}class _U{constructor(t){He(this,"socket",null);He(this,"disposed",!1);He(this,"authRecoveryInFlight",!1);He(this,"latestCursor");He(this,"connectionManager");this.options=t,this.latestCursor=t.cursor,this.connectionManager=new $S({onReconnect:n=>{this.connect(n)},onStateChange:t.onConnectionChange})}start(){this.connectionManager.start()}updateCursor(t){this.latestCursor=t}reconnectNow(){this.connectionManager.reconnectNow()}requestOlderMessages(t,n){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:n})),!0)}close(){var t;this.disposed=!0,this.connectionManager.close(),(t=this.socket)==null||t.close(),this.socket=null}connect(t){var c;if(this.disposed)return;t&&this.socket&&(this.socket.close(),this.socket=null);const n=(c=kn.getState().session)==null?void 0:c.accessToken;if(!n){this.options.onUnauthorized();return}const i=`${Vk("/ws")}?access_token=${encodeURIComponent(n)}`,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",l=>{const h=JSON.parse(l.data);if(h.type==="system.connected"){this.connectionManager.markConnected();return}if(h.type==="session.subscribed"){this.options.onSubscribed();return}if(h.type==="session.error"){if(h.error_code==="UNAUTHORIZED"){this.handleUnauthorized();return}this.options.onError(h);return}if(h.type==="session.runtime_status"){this.options.onRuntimeStatus(h);return}if(h.type==="session.activity"){this.options.onActivity(h);return}if(h.type==="session.history_older"){this.options.onOlderHistory(h);return}if(h.type==="session.runtime_message"){this.options.onRuntimeMessage(h);return}if(h.type==="session.runtime_error"){this.options.onRuntimeError(h);return}if(h.type==="session.interrupted"){this.options.onInterrupted(h);return}if(h.type==="session.permission_request"){this.options.onPermissionRequest(h);return}if(h.type==="session.permission_request_resolved"){this.options.onPermissionRequestResolved(h);return}this.latestCursor=h.cursor,this.options.onEnvelope(h)}),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(),kn.refresh().then(n=>{if(this.authRecoveryInFlight=!1,!this.disposed){if(n.status==="refreshed"){this.connectionManager.reconnectNow();return}if(n.status==="deferred"){this.connectionManager.markDisconnected();return}this.options.onUnauthorized()}})}}function lx(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:null,hasOlderMessages:!1,connectionState:"closed",lastCursor:null,pagesLoaded:0,errorCode:null,errorDetail:null}}function Xp(e,t,n="sent",i=null){const a=t.kind??(t.role==="tool"?"tool_result":"text"),c=t.toolCall??(a==="tool_call"||a==="tool_result"?{callId:t.rawRef||t.messageId,name:"tool",input:a==="tool_call"?t.content:"",output:a==="tool_result"&&t.content?t.content:null,error:null,status:a==="tool_call"?"running":"completed"}:null);return{id:t.messageId,sessionId:e,role:t.role,kind:a,content:t.content,toolCall:c,attachments:t.attachments??[],attachmentPayloads:null,origin:t.origin??null,originRef:t.originRef??null,timestamp:t.timestamp,sequence:t.sequence,rawRef:t.rawRef,deliveryState:n,clientRequestId:i}}function sN(e,t,n,i=[],a=[],c=Number.MAX_SAFE_INTEGER){return{id:`pending-${n}`,sessionId:e,role:"user",kind:"text",content:t,toolCall:null,attachments:i,attachmentPayloads:a,origin:null,originRef:null,timestamp:new Date().toISOString(),sequence:c,rawRef:`pending://${n}`,deliveryState:"sending",clientRequestId:n}}function sl(e,t,n){const i=new Map;for(const a of e)i.set(a.id,a);for(const a of n){const c=Xp(t,a),l=aW(i,c);if(l&&l!==c.id)continue;const h=oW(i,c);h&&h!==c.id&&i.delete(h);const f=i.get(a.messageId)??null;i.set(a.messageId,f?$U(f,c):c)}return oN(Array.from(i.values()))}function cx(e,t,n,i){const a=i===null?null:e.find(f=>f.clientRequestId===i)??null,c=e.filter(f=>f.clientRequestId!==i),l=Xp(t,n,"sent",i),h=qU(l,a);return oN([...c.filter(f=>f.id!==h.id),h])}function _m(e,t){return e.map(n=>n.clientRequestId===t?{...n,deliveryState:"failed"}:n)}function OU(e){const t=[];for(const n of e){const i=t.at(-1);if(!i||!GU(i,n)){t.push(n);continue}t[t.length-1]=YU(i,n)}return t}function BU(e){const t=[];let n=null,i=!1;for(const a of e)if(!KU(n,a,i)){if(t.push(a),Rl(a)){n=a,i=!1;continue}n&&Om(a)&&(i=!0)}return t}function UU(e){const t=[];for(const n of e){const i=t.at(-1);if(!i||!aN(i,n)){t.push(n);continue}t[t.length-1]=lN(i,n)}return t}function WU(e){const t=[];for(const n of e){if(t.push(n),t.length<4)continue;const i=t[t.length-4],a=t[t.length-3],c=t[t.length-2],l=t[t.length-1];QU(i,a,c,l)&&t.splice(t.length-3,3,lN(a,l))}return t}function zU(e){const t=[];for(const n of e){const i=t.at(-1);if(!i||!XU(i,n)){t.push(n);continue}t[t.length-1]=ZU(i,n)}return t}function HU(e){const t=[];for(const n of e){const i=t.findIndex(a=>JU(a,n));if(i===-1){t.push(n);continue}t[i]=eW(t[i],n)}return t}function oN(e){const t=[...e].sort((n,i)=>n.sequence!==i.sequence?n.sequence-i.sequence:n.timestamp.localeCompare(i.timestamp));return HU(zU(BU(WU(UU(OU(t))))))}function qU(e,t){if(!t||!VU(t,e))return e;const n=e.attachments??[];return{...e,sequence:t.sequence,timestamp:t.timestamp,attachments:n.length>0?n:t.attachments??[],attachmentPayloads:t.attachmentPayloads??null}}function $U(e,t){if(e.id!==t.id)return t;if(e.role!==t.role||e.kind!==t.kind||e.rawRef!==t.rawRef)return El(e,t);const n=tW(e.toolCall,t.toolCall),i=rW(e.content,t.content,e.timestamp,t.timestamp),a=iW(e.attachments,t.attachments);return{...El(e,t),content:i,toolCall:n,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 VU(e,t){return gd(e)&&t.role==="user"&&t.kind==="text"&&e.sequence>t.sequence}function GU(e,t){if(e.deliveryState!=="sent"||t.deliveryState!=="sent"||!e.rawRef.startsWith("codex://")||!t.rawRef.startsWith("codex://")||e.role!==t.role||e.kind!==t.kind||e.toolCall!==null||t.toolCall!==null||e.kind!=="text"&&e.kind!=="thinking")return!1;const n=Nl(e.content),i=Nl(t.content);return ga(e.timestamp,t.timestamp,30*1e3)&&Sn(n.text)===Sn(i.text)&&sW(n.inlineImages,i.inlineImages)}function KU(e,t,n){return!e||n||!Rl(e)||!Rl(t)?!1:ga(e.timestamp,t.timestamp,120*1e3)&&Sn(e.content)===Sn(t.content)}function Rl(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="user"&&e.kind==="text"}function Om(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("opencode://")&&e.role==="assistant"&&e.kind==="text"}function aN(e,t){return Om(e)&&Om(t)&&ga(e.timestamp,t.timestamp,120*1e3)&&Sn(e.content)===Sn(t.content)}function QU(e,t,n,i){return!e||!t||!n||!i||!Rl(e)||!Rl(n)?!1:aN(t,i)&&ga(e.timestamp,n.timestamp,120*1e3)&&Sn(e.content)===Sn(n.content)}function lN(e,t){var l,h;const n=((l=e.attachments)==null?void 0:l.length)??0,i=((h=t.attachments)==null?void 0:h.length)??0;if(n!==i)return n>i?e:t;const a=Sn(e.content).length,c=Sn(t.content).length;return a!==c?a>c?e:t:El(e,t)}function YU(e,t){var f,p;const n=((f=e.attachments)==null?void 0:f.length)??0,i=((p=t.attachments)==null?void 0:p.length)??0;if(n!==i)return n>i?e:t;const a=Nl(e.content).inlineImages.length,c=Nl(t.content).inlineImages.length;if(a!==c)return a>c?e:t;const l=e.content!==Sn(e.content),h=t.content!==Sn(t.content);return l!==h?l?t:e:t}function XU(e,t){return!ux(e)||!ux(t)?!1:e.role===t.role&&ga(e.timestamp,t.timestamp,120*1e3)&&Sn(e.content)===Sn(t.content)}function JU(e,t){return!dx(e)||!dx(t)?!1:e.role===t.role&&ga(e.timestamp,t.timestamp,120*1e3)&&Sn(e.content)===Sn(t.content)}function ux(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("gemini://session/")&&e.kind==="text"&&e.toolCall===null&&(e.role==="user"||e.role==="assistant")}function dx(e){return e.deliveryState==="sent"&&e.rawRef.startsWith("kimi://session/")&&e.kind==="text"&&e.toolCall===null&&(e.role==="user"||e.role==="assistant")}function ZU(e,t){var f,p;const n=((f=e.attachments)==null?void 0:f.length)??0,i=((p=t.attachments)==null?void 0:p.length)??0;if(n!==i)return n>i?e:t;const a=Sn(e.content).length,c=Sn(t.content).length;if(a!==c)return a>c?e:t;const l=e.rawRef.includes("#file="),h=t.rawRef.includes("#file=");return l!==h?l?e:t:El(e,t)}function eW(e,t){var f,p;const n=((f=e.attachments)==null?void 0:f.length)??0,i=((p=t.attachments)==null?void 0:p.length)??0;if(n!==i)return n>i?e:t;const a=Sn(e.content).length,c=Sn(t.content).length;if(a!==c)return a>c?e:t;const l=e.rawRef.includes("/context#"),h=t.rawRef.includes("/context#");return l!==h?l?e:t:El(e,t)}function tW(e,t){return e?t?{...nW(e,t),input:cN(e.input,t.input),output:fx(e.output,t.output),error:fx(e.error,t.error)}:e:t}function nW(e,t){const n=hx(e.status),i=hx(t.status);return i!==n?i>n?t:e:t}function hx(e){return e==="running"?0:1}function rW(e,t,n,i){const a=Sn(e),c=Sn(t);return a===c?e.length>=t.length?e:t:a.length>c.length&&a.includes(c)?e:c.length>a.length&&c.includes(a)||i.localeCompare(n)>=0?t:e}function iW(e,t){const n=(e==null?void 0:e.length)??0,i=(t==null?void 0:t.length)??0;return i!==n?i>n?t:e:t??e}function cN(e,t){return t.length>e.length?t:e}function fx(e,t){return e===null?t:t===null?e:cN(e,t)}function El(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 Sn(e){return e.replace(/\r\n/g,`
106
+ `).trimEnd()}function sW(e,t){return e.length===0||t.length===0?!0:e.length!==t.length?!1:e.every((n,i)=>{var a;return n.url===((a=t[i])==null?void 0:a.url)})}function oW(e,t){return dN(t)?uN(e,t,"optimistic"):null}function aW(e,t){return gd(t)?uN(e,t,"authoritative"):null}function uN(e,t,n){const i=Xu(t.timestamp),a=Sn(t.content);let c=null,l=Number.POSITIVE_INFINITY;for(const[h,f]of e.entries()){if(!(n==="optimistic"?gd(f):dN(f))||Sn(f.content)!==a)continue;const y=Xu(f.timestamp),g=Math.abs(y-i);g>300*1e3||g<l&&(c=h,l=g)}return c}function gd(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 dN(e){return e.role==="user"&&e.kind==="text"&&!gd(e)}function Xu(e){const t=Date.parse(e);return Number.isFinite(t)?t:0}function lW(e){return e.reduce((n,i)=>Number.isFinite(i.sequence)&&i.sequence>n?i.sequence:n,0)+1}function ga(e,t,n){return Math.abs(Xu(e)-Xu(t))<=n}const Bm=30,hN=40,mx=300*1e3,cW=600,uW=5e3,dW=1e4;function Lf(){const e=ui.getState().profile.defaultPermissionMode;return e==="default"?null:e}class fN{constructor(t,n={}){He(this,"state");He(this,"listeners",new Set);He(this,"realtimeClient",null);He(this,"historyBootstrapReadyTimer",null);He(this,"historyBootstrapFallbackTimer",null);He(this,"historyBootstrapEnvelopeReceived",!1);He(this,"markSeenTimer",null);He(this,"markSeenInFlight",!1);He(this,"lastMarkSeenRequestAt",0);He(this,"seenWatermark",null);He(this,"runtimeRefreshTimer",null);He(this,"runtimeRefreshMode",null);He(this,"replaceSnapshotSeedOnBackfill",!1);He(this,"pendingReplyDebugTraces",[]);He(this,"hasAuthoritativeBootstrapMessages");He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state);var l;this.sessionId=t,this.options=n;const i=Kn(_f(t),mx);this.hasAuthoritativeBootstrapMessages=(((l=n.bootstrapMessages)==null?void 0:l.length)??0)>0;const a=ou(n.initialSession??null,(i==null?void 0:i.session)??null),c=sl((i==null?void 0:i.messages)??[],this.sessionId,n.bootstrapMessages??[]);this.replaceSnapshotSeedOnBackfill=!this.hasAuthoritativeBootstrapMessages&&((i==null?void 0:i.messages.length)??0)>0,this.state=lx({session:a,capabilities:(i==null?void 0:i.capabilities)??null,runtimeHasActiveRun:(i==null?void 0:i.runtimeHasActiveRun)??null,runtimeCanInterrupt:(i==null?void 0:i.runtimeCanInterrupt)??null,contextUsage:(i==null?void 0:i.contextUsage)??null,messages:c,permissionRequests:(i==null?void 0:i.permissionRequests)??[],queuedMessages:(i==null?void 0:i.queuedMessages)??[]}),this.seenWatermark=(a==null?void 0:a.lastSeenAt)??null}async initialize(){this.historyBootstrapEnvelopeReceived=!1,this.clearHistoryBootstrapFallbackTimer();const t=this.options.bootstrapMessages??[],n=sl(this.state.messages,this.sessionId,t),i=this.hasAuthoritativeBootstrapMessages;this.patch({messages:n,historyState:hW(this.state.session,i?n.length:0),loadingOlderMessages:!1,olderCursor:null,hasOlderMessages:to(this.state.session,n.length),pagesLoaded:i?Math.max(this.state.pagesLoaded,1):0,errorCode:null,errorDetail:null}),this.shouldRefreshSessionDetail()&&this.refreshSessionMetadata(),this.shouldRefreshRuntimeSnapshot()&&this.refreshRuntimeSnapshot("bootstrap"),this.refreshPermissionRequests(),this.refreshQueue();try{this.startRealtime(),i?this.scheduleMarkSeen():this.state.historyState==="loading"&&this.scheduleHistoryBootstrapReady()}catch(a){this.handleError(a)}}async reload(){var n,i;this.clearHistoryBootstrapReadyTimer(),this.clearHistoryBootstrapFallbackTimer(),this.historyBootstrapEnvelopeReceived=!1,(n=this.realtimeClient)==null||n.close(),this.realtimeClient=null;const t=Kn(_f(this.sessionId),mx);this.state=lx({session:ou(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:sl((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)??[]}),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,this.emit(),await this.initialize()}applyNavigationSession(t){if(!t||t.sessionId!==this.sessionId)return;const n=ou(this.state.session,t);n!==this.state.session&&this.patch({session:n,hasOlderMessages:to(n,this.state.messages.length)})}async sendMessage(t,n){const i=vx();this.beginPendingReplyDebugTrace("send_live",i,t.length);const a=sN(this.sessionId,t,i,(n==null?void 0:n.attachmentMeta)??[],(n==null?void 0:n.attachments)??[],lW(this.state.messages));this.patch({messages:[...this.state.messages,a],session:vi(this.state.session,"running"),runtimeHasActiveRun:wx(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:xx(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt});try{const c=await this.sendMessageWithFallback(t,i,n);this.markPendingReplyDebugTraceResponseReady(i,{returnedMessageId:c.message.messageId,returnedProviderSessionId:c.message.providerSessionId}),this.patch({messages:cx(this.state.messages,this.sessionId,c.message,i)})}catch(c){throw this.failPendingReplyDebugTrace(i,c),this.patch({messages:_m(this.state.messages,i),session:vi(this.state.session,"failed"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1}),c}}async retryMessage(t){const n=this.state.messages.find(i=>i.clientRequestId===t);if(n){this.patch({messages:this.state.messages.map(i=>i.clientRequestId===t?{...i,deliveryState:"sending"}:i),runtimeHasActiveRun:wx(this.state.session,this.state.capabilities)?!0:this.state.runtimeHasActiveRun,runtimeCanInterrupt:xx(this.state.session,this.state.capabilities)?!0:this.state.runtimeCanInterrupt}),this.beginPendingReplyDebugTrace("retry_live",t,n.content.length);try{const i=await this.sendMessageWithFallback(n.content,t,{attachments:n.attachmentPayloads??[],attachmentMeta:n.attachments});this.markPendingReplyDebugTraceResponseReady(t,{returnedMessageId:i.message.messageId,returnedProviderSessionId:i.message.providerSessionId}),this.patch({messages:cx(this.state.messages,this.sessionId,i.message,t)})}catch(i){throw this.failPendingReplyDebugTrace(t,i),this.patch({messages:_m(this.state.messages,t),session:vi(this.state.session,"failed")}),i}}}async enqueueMessage(t,n){const i=vx();try{const a=await OA(this.sessionId,{content:t,clientRequestId:i,model:(n==null?void 0:n.model)??null,reasoningLevel:(n==null?void 0:n.reasoningLevel)??null,permissionMode:Lf(),attachments:(n==null?void 0:n.attachments)??[]});this.patch({queuedMessages:gW(this.state.queuedMessages,a)}),await this.refreshQueue()}catch(a){throw a}}async deleteQueuedMessage(t){await BA(this.sessionId,t),await this.refreshQueue()}async steerQueuedMessage(t){await UA(this.sessionId,t),await this.refreshRuntimeSnapshot("queue_steer")}async interrupt(){await WA(this.sessionId),this.patch({session:vi(this.state.session,"interrupted"),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:null,errorDetail:null})}async replyPermissionRequest(t,n){if(!(this.state.permissionRequests.find(c=>c.id===t)??null))return;const a=await zA(this.sessionId,t,n);this.patch({permissionRequests:Of(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,Bm)))throw new Error("REALTIME_NOT_CONNECTED")}catch(n){const i=n instanceof Error?n.message:"unknown";this.patch({loadingOlderMessages:!1,errorCode:"HISTORY_LOAD_MORE_FAILED",errorDetail:i})}}}destroy(){var t;this.clearHistoryBootstrapReadyTimer(),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 n;if(!((n=kn.getState().session)==null?void 0:n.accessToken)){kn.clear();return}this.realtimeClient=new _U({sessionId:this.sessionId,cursor:this.state.lastCursor,limit:hN,onSubscribed:()=>{_t("session_send.realtime_subscribed",{sessionId:this.sessionId,lastCursor:this.state.lastCursor}),this.patch({connectionState:"connected",historyState:this.state.historyState==="loading"&&Jp(this.state.session)===0?"ready":this.state.historyState,hasOlderMessages:to(this.state.session,this.state.messages.length)}),this.scheduleHistoryBootstrapReady(),this.scheduleHistoryBootstrapFallback()},onConnectionChange:i=>{var c;const a=this.state.connectionState;if(this.patch({connectionState:i,session:i==="reconnecting"&&zi((c=this.state.session)==null?void 0:c.runningState)?vi(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,l;this.historyBootstrapEnvelopeReceived=!0,this.clearHistoryBootstrapFallbackTimer(),this.clearHistoryBootstrapReadyTimer();const a=this.mergeHistoryMessages(i.messages,i.type==="session.backfill");this.patch({messages:a,lastCursor:i.cursor,historyState:"ready",olderCursor:i.olderCursor??this.state.olderCursor,hasOlderMessages:i.type==="session.backfill"?!!i.olderCursor:to(this.state.session,a.length),pagesLoaded:i.type==="session.backfill"?Math.max(this.state.pagesLoaded,a.length>0?1:0):this.state.pagesLoaded,session:vi(this.state.session,yx(i.type,(c=this.state.session)==null?void 0:c.runningState))}),(l=this.realtimeClient)==null||l.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:()=>{kn.clear()}}),this.realtimeClient.start()}patch(t){let n=t;Object.prototype.hasOwnProperty.call(t,"session")&&(this.syncSeenWatermark(t.session??null),n={...t,session:this.applySeenWatermark(t.session??null)}),this.state={...this.state,...n},(Object.prototype.hasOwnProperty.call(n,"session")||Object.prototype.hasOwnProperty.call(n,"capabilities")||Object.prototype.hasOwnProperty.call(n,"contextUsage")||Object.prototype.hasOwnProperty.call(n,"messages")||Object.prototype.hasOwnProperty.call(n,"permissionRequests")||Object.prototype.hasOwnProperty.call(n,"queuedMessages"))&&this.persistSnapshot(),this.emit()}mergeHistoryMessages(t,n){const i=n&&this.replaceSnapshotSeedOnBackfill?this.state.messages.filter(c=>c.deliveryState!=="sent"):this.state.messages,a=sl(i,this.sessionId,t);return n&&(this.replaceSnapshotSeedOnBackfill=!1),a}handleError(t){this.clearHistoryBootstrapReadyTimer(),this.clearHistoryBootstrapFallbackTimer();const n=t instanceof Error?t.message:"unknown";this.patch({historyState:"error",errorCode:"RUNTIME_INIT_FAILED",errorDetail:n})}scheduleMarkSeen(){if(this.markSeenTimer!==null)return;const t=this.getTargetSeenAt();if(this.markSeenInFlight||t===null)return;const n=this.getMarkSeenThrottleDelayMs(),i=Math.max(cW,n);this.markSeenTimer=window.setTimeout(()=>{this.markSeenTimer=null;const a=this.getTargetSeenAt();a!==null&&(_t("session_seen.start",{sessionId:this.sessionId,targetSeenAt:a,seenWatermark:this.seenWatermark}),this.markSeenInFlight=!0,this.lastMarkSeenRequestAt=Date.now(),TA(this.sessionId).then(()=>{var c,l;this.bumpSeenWatermark(a),this.patch({session:px(this.state.session,a)}),(l=(c=this.options).onSeen)==null||l.call(c,this.sessionId,a),_t("session_seen.end",{sessionId:this.sessionId,seenWatermark:this.seenWatermark})}).catch(()=>{_t("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))}scheduleHistoryBootstrapReady(){if(this.state.historyState!=="loading"){this.clearHistoryBootstrapReadyTimer();return}this.historyBootstrapReadyTimer===null&&(this.historyBootstrapReadyTimer=window.setTimeout(()=>{this.historyBootstrapReadyTimer=null,this.state.historyState==="loading"&&this.patch({historyState:"ready",hasOlderMessages:to(this.state.session,this.state.messages.length),pagesLoaded:this.state.messages.length>0?Math.max(this.state.pagesLoaded,1):0})},500))}clearHistoryBootstrapReadyTimer(){this.historyBootstrapReadyTimer!==null&&(window.clearTimeout(this.historyBootstrapReadyTimer),this.historyBootstrapReadyTimer=null)}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 dC(this.sessionId,null,Bm,"backward");if(this.historyBootstrapEnvelopeReceived)return;this.historyBootstrapEnvelopeReceived=!0;const n=this.mergeHistoryMessages(t.messages,!0);this.patch({messages:n,historyState:"ready",olderCursor:t.nextCursor,hasOlderMessages:t.nextCursor!==null?!0:to(this.state.session,n.length),lastCursor:t.cursor??this.state.lastCursor,pagesLoaded:n.length>0?Math.max(this.state.pagesLoaded,1):this.state.pagesLoaded,errorCode:null,errorDetail:null}),this.scheduleMarkSeen()}catch{}}scheduleRuntimeRefresh(t,n){var i,a;if(!zi((i=this.state.session)==null?void 0:i.runningState)){this.clearRuntimeRefreshTimer();return}t==="poll"&&this.state.connectionState==="connected"||(this.clearRuntimeRefreshTimer(),this.runtimeRefreshMode=t,_t("session_runtime.refresh.schedule",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((a=this.state.session)==null?void 0:a.runningState)??null}),this.runtimeRefreshTimer=window.setTimeout(()=>{const c=this.runtimeRefreshMode??t;this.runtimeRefreshTimer=null,this.runtimeRefreshMode=null,this.refreshRuntimeState(c,n)},t==="poll"?dW:1200))}async refreshRuntimeState(t,n){var i,a,c,l,h;_t("session_runtime.refresh.start",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((i=this.state.session)==null?void 0:i.runningState)??null});try{const f=await ym(this.sessionId);this.patch({session:gx(this.state.session,f),runtimeHasActiveRun:f.hasActiveRun,runtimeCanInterrupt:f.canInterrupt,contextUsage:f.contextUsage,...Df(f)}),await this.refreshQueue();const p=t==="poll"&&this.state.connectionState!=="connected"&&zi((a=this.state.session)==null?void 0:a.runningState);_t("session_runtime.refresh.end",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((c=this.state.session)==null?void 0:c.runningState)??null,continuePolling:p}),p&&this.scheduleRuntimeRefresh("poll","connection_poll")}catch(f){_t("session_runtime.refresh.error",{sessionId:this.sessionId,mode:t,reason:n,connectionState:this.state.connectionState,runningState:((l=this.state.session)==null?void 0:l.runningState)??null,message:f instanceof Error?f.message:"unknown"}),t==="poll"&&this.state.connectionState!=="connected"&&zi((h=this.state.session)==null?void 0:h.runningState)&&this.scheduleRuntimeRefresh("poll","connection_poll_retry")}}async refreshSessionMetadata(){const t=[];this.state.session===null&&t.push(NA(this.sessionId).then(n=>{this.patch({session:ou(n,this.state.session)})}).catch(()=>{})),bx(this.state.capabilities)&&t.push(EA(this.sessionId).then(n=>{this.patch({capabilities:n})}).catch(()=>{})),t.length!==0&&await Promise.allSettled(t)}async refreshPermissionRequests(){try{const t=await cC(this.sessionId);this.patch({permissionRequests:t.items})}catch{return}}shouldRefreshSessionDetail(){return this.state.session===null||bx(this.state.capabilities)||this.state.session.runningState===null}shouldRefreshRuntimeSnapshot(){return this.state.contextUsage===null}async refreshRuntimeSnapshot(t){_t("session_runtime.snapshot.start",{sessionId:this.sessionId,reason:t});try{const n=await ym(this.sessionId);this.patch({session:gx(this.state.session,n),runtimeHasActiveRun:n.hasActiveRun,runtimeCanInterrupt:n.canInterrupt,contextUsage:n.contextUsage,...Df(n)}),await this.refreshQueue(),_t("session_runtime.snapshot.end",{sessionId:this.sessionId,reason:t,hasContextUsage:n.contextUsage!==null})}catch(n){_t("session_runtime.snapshot.error",{sessionId:this.sessionId,reason:t,message:n instanceof Error?n.message:"unknown"})}}async refreshQueue(){try{const t=await _A(this.sessionId);this.patch({queuedMessages:t.items})}catch{return}}async sendMessageWithFallback(t,n,i){var a;try{return await FA(this.sessionId,{content:t,clientRequestId:n,model:(i==null?void 0:i.model)??null,reasoningLevel:(i==null?void 0:i.reasoningLevel)??null,permissionMode:Lf(),attachments:(i==null?void 0:i.attachments)??[]})}catch(c){if(!(c instanceof mr)||c.status!==404&&c.status!==405||(((a=i==null?void 0:i.attachments)==null?void 0:a.length)??0)>0)throw c;return _t("session_send.live_fallback",{sessionId:this.sessionId,clientRequestId:n,reason:c.message}),MA(this.sessionId,{content:t,clientRequestId:n,permissionMode:Lf()})}}handleRuntimeStatus(t){var i;const n=Mf((i=this.state.session)==null?void 0:i.runningState,t.status);this.patch({session:vi(this.state.session,n),runtimeHasActiveRun:zi(n)?this.state.runtimeHasActiveRun??!0:!1,runtimeCanInterrupt:zi(n)?this.state.runtimeCanInterrupt:!1,errorCode:null,errorDetail:n===t.status?t.detail:this.state.errorDetail}),Ju(n)&&(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:fW(this.state.session,t),runtimeHasActiveRun:t.hasActiveRun,runtimeCanInterrupt:t.canInterrupt,...Df(t)}),Ju(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),this.clearHistoryBootstrapReadyTimer();const n=sl(this.state.messages,this.sessionId,[t.message]);this.patch({messages:n,historyState:"ready",hasOlderMessages:to(this.state.session,n.length),session:vi(this.state.session,yx("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 n=Mf((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:vi(this.state.session,n),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:n==="failed"?t.error_code:this.state.errorCode,errorDetail:n==="failed"?t.detail:this.state.errorDetail}),this.refreshQueue()}handleInterrupted(t){var i;const n=Mf((i=this.state.session)==null?void 0:i.runningState,"interrupted");this.completePendingReplyDebugTraceWithoutAssistant("session_send.client_interrupted",{detail:t.detail}),this.clearRuntimeRefreshTimer(),this.patch({session:vi(this.state.session,n),runtimeHasActiveRun:!1,runtimeCanInterrupt:!1,errorCode:n==="interrupted"?null:this.state.errorCode,errorDetail:n==="interrupted"?t.detail:this.state.errorDetail}),this.refreshQueue()}handlePermissionRequest(t){this.patch({permissionRequests:Of(this.state.permissionRequests,t.request)})}handlePermissionRequestResolved(t){this.patch({permissionRequests:Of(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 n=this.seenWatermark;return n?t.timestamp>n?t.timestamp:null:t.timestamp}syncSeenWatermark(t){t!=null&&t.lastSeenAt&&this.bumpSeenWatermark(t.lastSeenAt)}bumpSeenWatermark(t){this.seenWatermark&&this.seenWatermark>=t||(this.seenWatermark=t)}getMarkSeenThrottleDelayMs(){return this.lastMarkSeenRequestAt<=0?0:Math.max(0,uW-(Date.now()-this.lastMarkSeenRequestAt))}applySeenWatermark(t){return!t||!this.seenWatermark?t:px(t,this.seenWatermark)}emit(){for(const t of this.listeners)t()}persistSnapshot(){Fr(_f(this.sessionId),{session:this.state.session,capabilities:this.state.capabilities,runtimeHasActiveRun:this.state.runtimeHasActiveRun,runtimeCanInterrupt:this.state.runtimeCanInterrupt,contextUsage:this.state.contextUsage,messages:pW(this.state.messages),permissionRequests:this.state.permissionRequests,queuedMessages:this.state.queuedMessages})}beginPendingReplyDebugTrace(t,n,i){const a={mode:t,clientRequestId:n,startedAtMs:performance.now(),responseReadyAtMs:null,contentLength:i};this.pendingReplyDebugTraces.push(a),_t(`session_send.${t}.client_start`,{sessionId:this.sessionId,clientRequestId:n,contentLength:i})}markPendingReplyDebugTraceResponseReady(t,n={}){const i=this.pendingReplyDebugTraces.find(a=>a.clientRequestId===t);!i||i.responseReadyAtMs!==null||(i.responseReadyAtMs=performance.now(),_t(`session_send.${i.mode}.client_response`,{sessionId:this.sessionId,clientRequestId:t,durationMs:Math.round(i.responseReadyAtMs-i.startedAtMs),...n}))}failPendingReplyDebugTrace(t,n){const i=this.pendingReplyDebugTraces.find(a=>a.clientRequestId===t);i&&(_t(`session_send.${i.mode}.client_error`,{sessionId:this.sessionId,clientRequestId:t,durationMs:Math.round(performance.now()-i.startedAtMs),error:n instanceof Error?n.message:String(n)}),this.removePendingReplyDebugTrace(i.clientRequestId))}completePendingReplyDebugTrace(t){const n=this.pendingReplyDebugTraces[0];if(!n)return;const i=performance.now();_t(`session_send.${n.mode}.first_assistant_message`,{sessionId:this.sessionId,clientRequestId:n.clientRequestId,durationMs:Math.round(i-n.startedAtMs),responseToAssistantMs:n.responseReadyAtMs===null?null:Math.round(i-n.responseReadyAtMs),messageId:t.message.messageId,kind:t.message.kind,contentLength:t.message.content.length}),this.removePendingReplyDebugTrace(n.clientRequestId)}completePendingReplyDebugTraceWithoutAssistant(t,n={}){const i=this.pendingReplyDebugTraces[0];i&&(_t(t,{sessionId:this.sessionId,clientRequestId:i.clientRequestId,durationMs:Math.round(performance.now()-i.startedAtMs),responseReady:i.responseReadyAtMs!==null,...n}),this.removePendingReplyDebugTrace(i.clientRequestId))}removePendingReplyDebugTrace(t){const n=this.pendingReplyDebugTraces.findIndex(i=>i.clientRequestId===t);n<0||this.pendingReplyDebugTraces.splice(n,1)}}function kr(e,t){const[n,i]=b.useState(()=>t(e.getState()));return b.useEffect(()=>(i(t(e.getState())),e.subscribe(()=>{i(t(e.getState()))})),[t,e]),n}function Jp(e){const t=e==null?void 0:e.messageCount;return typeof t=="number"&&Number.isFinite(t)?t:null}function hW(e,t){return t>0||Jp(e)===0?"ready":"loading"}function to(e,t){const n=Jp(e);return n!==null?n>t:t>=hN}function vi(e,t){return e&&{...e,runningState:t,activityState:pN(e,t,e.completedAt??null,zi(t))}}function px(e,t){return!e||e.lastSeenAt&&e.lastSeenAt>=t?e:{...e,lastSeenAt:t,activityState:e.activityState==="completed_unread"?"idle":e.activityState}}function gx(e,t){return mN(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 fW(e,t){return mN(e,t)}function mN(e,t){if(!e)return e;const n=mW(t.activityResolutionSource),i=Ju(t.runningState)?Ff(e.completedAt,t.updatedAt):null,a=t.runningState==="completed"||t.runningState==="interrupted"||t.runningState==="failed"?Ff(e.lastEventAt,t.updatedAt):t.updatedAt;return{...e,runningState:t.runningState,activitySource:n,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:Ff(e.updatedAt,t.updatedAt)??t.updatedAt,activityState:pN(e,t.runningState,i,t.hasActiveRun)}}function pN(e,t,n,i){return i||zi(t)?"running":n&&(!e.lastSeenAt||n>e.lastSeenAt)?"completed_unread":e.activityState==="running"||e.activityState==="completed_unread"?"idle":e.activityState??"idle"}function zi(e){return e==="starting"||e==="running"||e==="reconnecting"}function Ju(e){return e==="completed"||e==="interrupted"||e==="failed"}function bx(e){if(e===null)return!0;const t=e.modelOptions??[];return t.length===0?!0:t.every(n=>n.usesProviderDefault===!0)}function yx(e,t){return e==="session.backfill"?t??"idle":t==="completed"||t==="interrupted"||t==="failed"?t:"running"}function Mf(e,t){return Ju(e)?e:t}function Df(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 mW(e){return e==="authoritative_runtime"||e==="authoritative_provider_event"?"runtime":e==="inferred_log"?"inferred":"none"}function Ff(e,t){return e?t?e>=t?e:t:e:t??null}function vx(){var e,t;if(typeof((e=globalThis.crypto)==null?void 0:e.randomUUID)=="function")return globalThis.crypto.randomUUID();if(typeof((t=globalThis.crypto)==null?void 0:t.getRandomValues)=="function"){const n=new Uint8Array(16);globalThis.crypto.getRandomValues(n),n[6]=n[6]&15|64,n[8]=n[8]&63|128;const i=Array.from(n,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 wx(e,t){return e?t&&e.provider===t.provider?!!t.canSendMessage:mC(e.provider):!1}function xx(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 _f(e){return`session-runtime.snapshot.${e}`}function pW(e){return e.filter(t=>t.deliveryState==="sent").slice(-Bm)}function gW(e,t){const n=e.filter(i=>i.id!==t.id);return n.push(t),n.sort((i,a)=>i.orderIndex-a.orderIndex),n}function Of(e,t){const n=e.filter(i=>i.id!==t.id);return n.push(t),n.sort((i,a)=>i.status!==a.status?i.status==="pending"?-1:1:a.createdAt.localeCompare(i.createdAt)),n}function ou(e,t){if(!e)return t;if(!t||kx(e,t))return e;if(kx(t,e))return t;const n=Date.parse(e.updatedAt||e.lastMessageAt||e.createdAt),i=Date.parse(t.updatedAt||t.lastMessageAt||t.createdAt);return!Number.isFinite(n)||!Number.isFinite(i)?t:n>=i?e:t}function kx(e,t){return Sx(e)&&!Sx(t)&&e.lastEventAt===t.lastEventAt&&e.lastMessageAt===t.lastMessageAt&&e.completedAt===t.completedAt}function Sx(e){return e.activityState==="running"||zi(e.runningState)}const Cx="butler:records-updated";function Zp(e){if(typeof window>"u")return()=>{};const t=()=>{e()};return window.addEventListener(Cx,t),()=>{window.removeEventListener(Cx,t)}}const bW=60;class yW{constructor(t){He(this,"state");He(this,"listeners",new Set);He(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));He(this,"getState",()=>this.state);this.workspaceId=t,this.state={loading:!0,sending:!1,switchingProvider:!1,initialized:!1,profile:null,activeProvider:"codex",controlSession:null,capabilities:Qo("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 ld();if(!t.initialized||!t.profile){this.patch({loading:!1,initialized:!1,profile:null,activeProvider:"codex",capabilities:Qo("codex"),controlSession:null,messages:[],historyState:"idle",overview:null,events:[],runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null});return}const n=t.profile;this.patch({initialized:!0,profile:n,activeProvider:n.providerId,capabilities:Qo(n.providerId)}),await this.reloadForProvider(n.providerId),this.patch({loading:!1})}catch(t){this.patch({loading:!1,error:Ui(t)})}}async initializeProfile(t){this.patch({loading:!0,error:null});try{const n=await gI(t);if(!n.initialized||!n.profile)throw new Error("BUTLER_PROFILE_INIT_FAILED");this.patch({initialized:!0,profile:n.profile,activeProvider:n.profile.providerId,capabilities:Qo(n.profile.providerId)}),await this.reloadForProvider(n.profile.providerId)}catch(n){throw this.patch({error:Ui(n)}),n}finally{this.patch({loading:!1})}}async switchProvider(t){if(!this.state.initialized||!this.state.profile||this.state.activeProvider===t)return;const n={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:Qo(t)});try{const i=await jv({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({...n,error:Ui(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 n=await jv(t);if(!n.initialized||!n.profile)throw new Error("BUTLER_PROFILE_UPDATE_FAILED");this.patch({initialized:!0,profile:n.profile,activeProvider:n.profile.providerId})}catch(n){throw this.patch({error:Ui(n)}),n}finally{this.patch({loading:!1})}}}async sendMessage(t,n){const i=t.trim();if(!(!i||!this.state.initialized)){this.patch({sending:!0,error:null});try{if(this.state.controlSession){const c=await wI({content:i,model:(n==null?void 0:n.model)??null,reasoningLevel:(n==null?void 0:n.reasoningLevel)??null,permissionMode:(n==null?void 0:n.permissionMode)??null});this.patch({controlSession:c.controlSession})}else{const c=await vI({content:i,model:(n==null?void 0:n.model)??null,reasoningLevel:(n==null?void 0:n.reasoningLevel)??null,permissionMode:(n==null?void 0:n.permissionMode)??null});this.patch({controlSession:c.controlSession})}await this.reloadControlSession(),await Promise.all([this.refreshOverview(),this.refreshEvents()])}catch(a){throw this.patch({error:Ui(a)}),a}finally{this.patch({sending:!1})}}}async retryMessage(t){const n=this.state.messages.find(i=>i.clientRequestId===t);!n||!n.content.trim()||await this.sendMessage(n.content)}async startFreshSession(t){if(this.state.initialized){this.patch({sending:!1,error:null,controlSession:null,messages:[],historyState:"ready",runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null});try{await yI()}catch(n){throw this.patch({historyState:"error",error:Ui(n)}),n}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 n=(await bI()).controlSession;if(!n){this.patch({controlSession:null,messages:[],historyState:"ready",runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null});return}const[i,a]=await Promise.all([dC(n.session.sessionId,null,bW,"forward"),ym(n.session.sessionId)]),c=i.messages.map(l=>Xp(n.session.sessionId,l));this.patch({controlSession:n,messages:c,historyState:"ready",runtimeHasActiveRun:a.hasActiveRun,runtimeCanInterrupt:a.canInterrupt,contextUsage:a.contextUsage})}catch(t){this.patch({historyState:"error",error:Ui(t)})}}async refreshCapabilities(t){try{const n=await uC(t,this.workspaceId);this.patch({capabilities:n})}catch{this.patch({capabilities:Qo(t)})}}async refreshOverview(){try{const t=await cd();this.patch({overview:t.overview})}catch(t){this.patch({error:Ui(t)})}}async refreshEvents(){try{const t=await xI();this.patch({events:t.items})}catch(t){this.patch({error:Ui(t)})}}patch(t){this.state={...this.state,...t},this.emit()}emit(){for(const t of this.listeners)t()}}function cr(e,t){const[n,i]=b.useState(()=>t(e.getState()));return b.useEffect(()=>(i(t(e.getState())),e.subscribe(()=>{i(t(e.getState()))})),[t,e]),n}function Qo(e){const t=[{id:"provider-default",name:u("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 Ui(e){return e instanceof Error?e.message:String(e)}const Um={"risk-first":["risk","blocker","verification"],"blocker-first":["blocker","risk","verification"],"verification-first":["verification","risk","blocker"],"progress-first":["progress","risk","blocker"]},gN=300,vW={displayName:"",providerId:"codex",agentsMode:"inline",personaTone:"direct",personaLanguage:"zh-CN",personaSummaryStyle:"brief",focusRiskPreference:"conservative",reportPriorityPreset:"risk-first"},Bf={displayName:"",agentsMode:"inline",agentsFilePath:"",agentsContent:"",personaTone:"direct",personaLanguage:"zh-CN",personaSummaryStyle:"brief",focusRiskPreference:"conservative",reportPriorityPreset:"risk-first",summaryDebounceSeconds:gN},wW=[{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"}],Wi={builder:["🧠","🤖","🦾","🛠️","⚙️","🧩","🚀","🛰️","🔧","💡"],analyst:["🦉","🧭","🔍","📚","🧪","📐","🗂️","📝","🧮","📊"],direct:["🦅","🛡️","⚡","🎯","🪓","🧱","🔨","📌","🧰","🏹"],steady:["🐢","🐘","🦬","🦫","🌲","⛰️","🪨","🧺","🧷","🕰️"],friendly:["🐼","🦊","🐻","🐶","🐱","🐹","🐰","🦄","🌼","🍀"],default:["🧠","🤖","🦉","🧩","📚","💡","🛠️","🚀","🌟","🪄","🧭","🔮"]};function xW(){var je,$e,Ye,Ee,Ue;const{workspaceId:e=""}=ca(),t=Wn(),{showToast:n}=En(),{requestNavigationRefresh:i,setAuxiliaryPanel:a}=Yn(),c=b.useRef(null),l=b.useRef(null),[h,f]=b.useState(vW),[p,y]=b.useState(!1),[g,w]=b.useState(Bf),[x,S]=b.useState(!1),[C,P]=b.useState(0),[A,L]=b.useState([]),[O,ee]=b.useState([]),[q,_]=b.useState([]),[E,M]=b.useState(!1),[I,N]=b.useState(!1),[z,G]=b.useState(null),[J,B]=b.useState(null),[W,Y]=b.useState(!1),[Q,D]=b.useState(null);(!c.current||l.current!==e)&&(c.current=new yW(e),l.current=e);const re=c.current,R=cr(re,ne=>ne.loading),$=cr(re,ne=>ne.sending),Z=cr(re,ne=>ne.switchingProvider),F=cr(re,ne=>ne.initialized),we=cr(re,ne=>ne.profile),ce=cr(re,ne=>ne.activeProvider),be=cr(re,ne=>ne.controlSession),Ve=cr(re,ne=>ne.capabilities),ze=cr(re,ne=>ne.overview),yt=cr(re,ne=>ne.events),ft=cr(re,ne=>ne.messages),Ot=cr(re,ne=>ne.historyState),Ke=cr(re,ne=>ne.runtimeHasActiveRun),jt=cr(re,ne=>ne.runtimeCanInterrupt),pt=cr(re,ne=>ne.contextUsage),Mt=cr(re,ne=>ne.error),xt=((je=we==null?void 0:we.displayName)==null?void 0:je.trim())||h.displayName.trim()||u("shell.butlerEntry"),Dt=b.useMemo(()=>WW({displayName:xt,providerId:(we==null?void 0:we.providerId)??h.providerId,tone:(we==null?void 0:we.persona.tone)??h.personaTone}),[xt,h.personaTone,h.providerId,we==null?void 0:we.persona.tone,we==null?void 0:we.providerId]),wt=((Ye=($e=be==null?void 0:be.session)==null?void 0:$e.sessionId)==null?void 0:Ye.trim())||null,ye=b.useMemo(()=>!wt||!(be!=null&&be.session)?null:new fN(wt,{initialSession:be.session}),[wt]),Fe=$W(ye),kt=ye?Fe.messages:ft,lt=ye?Fe.historyState:Ot,gt=ye?Fe.runtimeHasActiveRun:Ke,Lt=ye?Fe.runtimeCanInterrupt:jt,nt=ye?Fe.contextUsage:pt,fe=ye?Fe.loadingOlderMessages:!1,ge=ye?Fe.hasOlderMessages:!1,Te=b.useMemo(()=>O.slice(0,3),[O]),qe=b.useMemo(()=>((ze==null?void 0:ze.projects)??[]).map(ne=>ne.id).sort(),[ze==null?void 0:ze.projects]),dt=b.useCallback(()=>{N(!0)},[]),St=b.useCallback(ne=>{w(xe=>({...xe,...ne}))},[]),rt=b.useCallback(async ne=>{N(!1),G(ne),B(null),D(null),Y(!0);try{const xe=await SC(ne);B(xe.task)}catch(xe){D(xe instanceof Error?xe.message:u("shell.butlerAutomationRoundLoadFailed"))}finally{Y(!1)}},[]),Ut=b.useCallback(async()=>{if(we){if(!g.displayName.trim()){n({title:u("shell.butlerInitNameRequired"),tone:"warning"});return}S(!0);try{await re.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:{...we.focus,riskPreference:g.focusRiskPreference,reportPriority:Um[g.reportPriorityPreset],summaryDebounceSeconds:g.summaryDebounceSeconds}}),n({title:u("shell.butlerSettingsSaved"),tone:"success"})}catch(ne){n({title:u("shell.butlerSettingsSaveFailed"),description:ne instanceof Error?ne.message:void 0,tone:"error"})}finally{S(!1)}}},[we,g,n,re]);b.useEffect(()=>{re.initialize()},[re]),b.useEffect(()=>{if(ye)return ye.initialize(),()=>{ye.destroy()}},[ye]),b.useEffect(()=>{!ye||!(be!=null&&be.session)||ye.applyNavigationSession(be.session)},[be==null?void 0:be.session,ye]),b.useEffect(()=>{Mt&&n({title:u("shell.butlerLoadFailed"),description:Mt,tone:"error"})},[Mt,n]),b.useEffect(()=>{if(!we){w(Bf);return}w({displayName:we.displayName,agentsMode:we.agentsMode,agentsFilePath:OW(we),agentsContent:we.agentsContent,personaTone:we.persona.tone,personaLanguage:we.persona.language,personaSummaryStyle:we.persona.summaryStyle,focusRiskPreference:we.focus.riskPreference,reportPriorityPreset:_W(we.focus.reportPriority),summaryDebounceSeconds:we.focus.summaryDebounceSeconds??Bf.summaryDebounceSeconds})},[we]),b.useEffect(()=>{if(!F){L([]),ee([]),_([]);return}let ne=!1;async function xe(){try{const[It,Ct,Pt]=await Promise.all([kl(),Sl(),Promise.all(qe.map($t=>kC($t)))]);ne||(L(It.items),ee(Ct.items),_(Pt.flatMap($t=>$t.items)))}catch(It){if(ne)return;L([]),ee([]),_([]),n({title:u("shell.butlerSidebarLoadFailed"),description:It instanceof Error?It.message:void 0,tone:"error"})}}xe();function Ze(){xe()}const ot=window.setInterval(()=>{xe()},15e3);return window.addEventListener(uo,Ze),()=>{ne=!0,window.clearInterval(ot),window.removeEventListener(uo,Ze)}},[F,qe,n]),b.useEffect(()=>Zp(()=>{re.reloadEventsAndOverview()}),[re]);const mt=b.useMemo(()=>[{value:"codex",label:"Codex"}],[]),Bt=b.useMemo(()=>[{value:"inline",label:u("shell.butlerAgentsModeInline")},{value:"file",label:u("shell.butlerAgentsModeFile")}],[]),At=b.useMemo(()=>[{value:"direct",label:u("shell.butlerToneDirect")},{value:"steady",label:u("shell.butlerToneSteady")},{value:"friendly",label:u("shell.butlerToneFriendly")}],[]),vt=b.useMemo(()=>[{value:"zh-CN",label:u("shell.butlerLanguageZhCn")},{value:"en-US",label:u("shell.butlerLanguageEnUs")},{value:"bilingual",label:u("shell.butlerLanguageBilingual")}],[]),Nt=b.useMemo(()=>[{value:"brief",label:u("shell.butlerSummaryBrief")},{value:"structured",label:u("shell.butlerSummaryStructured")},{value:"thorough",label:u("shell.butlerSummaryThorough")}],[]),Zt=b.useMemo(()=>[{value:"conservative",label:u("shell.butlerRiskConservative")},{value:"balanced",label:u("shell.butlerRiskBalanced")},{value:"proactive",label:u("shell.butlerRiskProactive")}],[]),ie=b.useMemo(()=>[{value:"risk-first",label:u("shell.butlerReportRiskFirst")},{value:"blocker-first",label:u("shell.butlerReportBlockerFirst")},{value:"verification-first",label:u("shell.butlerReportVerificationFirst")},{value:"progress-first",label:u("shell.butlerReportProgressFirst")}],[]),Ie=ms(mt,h.providerId),ct=ms(Bt,h.agentsMode),zt=ms(At,h.personaTone),nn=ms(vt,h.personaLanguage),ke=ms(Nt,h.personaSummaryStyle),it=ms(Zt,h.focusRiskPreference),Qt=ms(ie,h.reportPriorityPreset),rn=h.agentsMode==="inline"?u("shell.butlerAgentsModeInlineDescription"):u("shell.butlerAgentsModeFileDescription"),Tn=[ct,nn,it],un=b.useMemo(()=>r.jsx(kW,{overview:ze,events:yt,inboxItems:A,followUpTasks:O,patrolPlans:q,settingsForm:g,savingSettings:x,onOpenFollowUpHistory:dt,onOpenFollowUpDetail:rt,onSettingsFormChange:St,onSaveSettings:()=>{Ut()}}),[yt,dt,O,rt,Ut,St,A,ze,q,x,g]);b.useEffect(()=>{if(!F){a(null);return}return a(un),()=>{a(null)}},[F,a,un]);async function X(ne){ne.preventDefault();const xe=h.displayName.trim();if(!xe){n({title:u("shell.butlerInitNameRequired"),tone:"warning"});return}const Ze={displayName:xe,providerId:h.providerId,agentsMode:h.agentsMode,persona:{tone:h.personaTone,language:h.personaLanguage,summaryStyle:h.personaSummaryStyle},focus:{projectIds:[],riskPreference:h.focusRiskPreference,reportPriority:Um[h.reportPriorityPreset],summaryDebounceSeconds:gN}};y(!0);try{await re.initializeProfile(Ze),n({title:u("shell.butlerInitSuccess"),tone:"success"})}catch(ot){n({title:u("shell.butlerInitFailed"),description:ot instanceof Error?ot.message:void 0,tone:"error"})}finally{y(!1)}}async function oe(ne){if(ne!==ce)try{await re.switchProvider(ne),Se(ne),n({title:u("shell.butlerProviderSwitched"),description:u("shell.butlerProviderSwitchedDescription",{provider:ms(mt,ne)}),tone:"success"})}catch(xe){n({title:u("shell.butlerProviderSwitchFailed"),description:xe instanceof Error?xe.message:void 0,tone:"error"})}}async function de(){try{Se(ce),await re.startFreshSession(),n({title:u("shell.butlerNewSessionStarted"),tone:"success"})}catch(ne){n({title:u("shell.butlerNewSessionFailed"),description:ne instanceof Error?ne.message:void 0,tone:"error"})}}function Se(ne){P(xe=>xe+1),t(co(e),{replace:!0}),ne&&i()}return R&&!F&&!p?r.jsx("main",{className:"workbench-page butler-page-shell butler-loading-shell",children:r.jsx(AW,{})}):F?r.jsxs(r.Fragment,{children:[r.jsxs("main",{className:"workbench-page conversation-page-shell butler-page-shell butler-chat-workspace",children:[r.jsxs("header",{className:"workbench-auxiliary-header butler-main-header","data-window-drag-handle":"conversation-header",children:[r.jsx("div",{className:"butler-header-main",children:r.jsxs("div",{className:"butler-header-analysis-anchor",onMouseEnter:()=>{M(!0)},onMouseLeave:()=>{M(!1)},children:[r.jsx("div",{className:"butler-chat-avatar","aria-hidden":"true",children:r.jsx("span",{children:Dt})}),r.jsx("div",{className:"butler-main-heading",children:r.jsx("h1",{tabIndex:0,onFocus:()=>{M(!0)},onBlur:()=>{M(!1)},children:xt})}),E?r.jsxs("div",{className:"butler-header-analysis-popover",role:"status","aria-live":"polite",children:[r.jsx("strong",{children:u("conversation.butlerAnalysisTitle")}),Te.length>0?Te.map(ne=>r.jsxs("div",{className:"butler-header-analysis-item",children:[r.jsxs("p",{children:[u("conversation.butlerAnalysisObjectiveLabel"),":",ne.objective]}),r.jsxs("p",{children:[u("conversation.butlerAnalysisStatusLabel"),":",$l(ne.status)]}),r.jsxs("p",{children:[u("conversation.butlerAnalysisSummaryLabel"),":",ne.lastAutomationSummary||ne.waitingReason||u("conversation.butlerAnalysisEmpty")]})]},ne.id)):r.jsx("p",{children:u("conversation.butlerAnalysisEmpty")})]}):null]})}),r.jsxs("div",{className:"butler-toolbar-cluster",children:[r.jsx("div",{className:"butler-provider-switcher",children:r.jsx("select",{"aria-label":u("shell.butlerProviderLabel"),value:ce,disabled:mt.length<=1||Z||$,onChange:ne=>{oe(ne.target.value)},children:mt.map(ne=>r.jsx("option",{value:ne.value,children:ne.label},ne.value))})}),r.jsx("button",{type:"button",className:"terminal-tab-control butler-header-icon-button","aria-label":u("shell.butlerNewSessionAction"),title:u("shell.butlerNewSessionAction"),disabled:R||$||Z,onClick:()=>{de()},children:r.jsx("span",{className:"terminal-toolbar-icon","aria-hidden":"true",children:r.jsx(HW,{})})}),r.jsx("button",{type:"button",className:"terminal-tab-control butler-header-icon-button","aria-label":u("shell.butlerRefreshAction"),title:u("shell.butlerRefreshAction"),disabled:R||$||Z,onClick:()=>{Promise.all([re.refreshAll(),kl().then(ne=>L(ne.items)),Sl().then(ne=>ee(ne.items))])},children:r.jsx("span",{className:"terminal-toolbar-icon","aria-hidden":"true",children:r.jsx(qW,{})})})]})]}),r.jsx("section",{className:"butler-main-column",children:r.jsxs("div",{className:"butler-conversation-shell",children:[r.jsx(Yp,{sessionId:(Ee=be==null?void 0:be.session)==null?void 0:Ee.sessionId,messages:kt,historyState:lt,loadingOlderMessages:fe,hasOlderMessages:ge,provider:ce,assistantAvatar:r.jsx("span",{className:"butler-message-avatar","aria-hidden":"true",children:Dt}),onLoadOlderMessages:()=>{ye&&ye.loadOlderMessages()},onRetryMessage:ne=>{const xe=kt.find(Ze=>Ze.clientRequestId===ne);if(xe!=null&&xe.content.trim()){re.sendMessage(xe.content);return}re.retryMessage(ne)}}),r.jsx("div",{className:"butler-composer-shell",children:r.jsx(Tp,{capabilities:Ve,draftStorageId:`butler:${ce}:${C}`,placeholder:u("shell.butlerComposerPlaceholder",{displayName:xt}),hasActiveRun:gt,canInterrupt:Lt,contextUsage:nt,isSubmitting:$||Z,isRunning:gt??!1,onSend:async(ne,xe)=>{var Ze;(((Ze=xe==null?void 0:xe.attachments)==null?void 0:Ze.length)??0)>0&&n({title:u("shell.butlerAttachmentUnsupported"),tone:"warning"}),await re.sendMessage(ne,{model:(xe==null?void 0:xe.model)??null,reasoningLevel:(xe==null?void 0:xe.reasoningLevel)??null,permissionMode:null}),i()}})})]},`timeline:${ce}:${C}`)})]}),r.jsx(Un,{open:I,title:u("shell.butlerFollowUpHistoryTitle"),description:u("shell.butlerFollowUpHistoryDescription"),onClose:()=>{N(!1)},children:r.jsx(PW,{tasks:O,onOpenFollowUpDetail:rt,onClose:()=>{N(!1)}})}),r.jsx(Un,{open:z!==null,title:u("shell.butlerAutomationRoundDetailsTitle"),description:((Ue=J==null?void 0:J.sessionTitle)==null?void 0:Ue.trim())||(J==null?void 0:J.projectName)||u("shell.butlerAutomationRoundDetailsDescription"),onClose:()=>{G(null),B(null),D(null),Y(!1)},children:r.jsx(MW,{task:J,loading:W,error:Q})})]}):r.jsxs("main",{className:"workbench-page butler-page-shell butler-init-shell",children:[r.jsxs("div",{className:"butler-init-backdrop","aria-hidden":"true",children:[r.jsx("span",{className:"butler-init-glow butler-init-glow-primary"}),r.jsx("span",{className:"butler-init-glow butler-init-glow-secondary"})]}),r.jsxs("div",{className:"butler-init-layout",children:[r.jsxs("aside",{className:"butler-init-sidebar",children:[r.jsx("section",{className:"butler-init-hero-card",children:r.jsxs("div",{className:"butler-init-hero-copy",children:[r.jsx("h1",{children:u("shell.butlerInitTitle")}),r.jsx("p",{children:u("shell.butlerInitDescription")})]})}),r.jsxs("section",{className:"butler-init-preview-card",children:[r.jsx("header",{className:"butler-init-section-header",children:r.jsx("div",{children:r.jsx("h2",{children:u("shell.butlerInitPreviewTitle")})})}),r.jsxs("div",{className:"butler-init-preview-identity",children:[r.jsxs("div",{className:"butler-init-preview-nameplate",children:[r.jsx("div",{className:"butler-chat-avatar butler-init-preview-avatar",children:r.jsx("span",{children:Dt})}),r.jsx("strong",{children:xt})]}),r.jsx("span",{className:"butler-init-preview-provider",children:Ie})]}),r.jsx("div",{className:"butler-init-chip-list",children:Tn.map(ne=>r.jsx("span",{className:"butler-init-chip",children:ne},ne))}),r.jsxs("div",{className:"butler-init-preview-rows",children:[r.jsxs("div",{className:"butler-init-preview-row",children:[r.jsx("span",{children:u("shell.butlerPersonaToneLabel")}),r.jsx("strong",{children:zt})]}),r.jsxs("div",{className:"butler-init-preview-row",children:[r.jsx("span",{children:u("shell.butlerInitPreviewRuleLabel")}),r.jsx("strong",{children:ct})]}),r.jsxs("div",{className:"butler-init-preview-row",children:[r.jsx("span",{children:u("shell.butlerPersonaSummaryStyleLabel")}),r.jsx("strong",{children:ke})]}),r.jsxs("div",{className:"butler-init-preview-row",children:[r.jsx("span",{children:u("shell.butlerReportPriorityPresetLabel")}),r.jsx("strong",{children:Qt})]})]})]})]}),r.jsxs("form",{className:"butler-init-form",onSubmit:X,children:[r.jsxs("section",{className:"butler-init-form-section",children:[r.jsx("header",{className:"butler-init-section-header",children:r.jsx("div",{children:r.jsx("h2",{children:u("shell.butlerInitBasicsTitle")})})}),r.jsxs("div",{className:"butler-init-basic-grid",children:[r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerDisplayNameLabel")}),r.jsx("input",{className:"butler-form-control",value:h.displayName,onChange:ne=>f(xe=>({...xe,displayName:ne.target.value})),placeholder:u("shell.butlerDisplayNamePlaceholder")}),r.jsx("small",{children:u("shell.butlerDisplayNameHint")})]}),r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerProviderLabel")}),r.jsx("select",{className:"butler-form-control",value:h.providerId,disabled:mt.length<=1,onChange:ne=>f(xe=>({...xe,providerId:ne.target.value})),children:mt.map(ne=>r.jsx("option",{value:ne.value,children:ne.label},ne.value))})]}),r.jsxs("label",{className:"butler-form-field butler-form-field-wide",children:[r.jsx("span",{children:u("shell.butlerAgentsModeLabel")}),r.jsx("select",{className:"butler-form-control",value:h.agentsMode,onChange:ne=>f(xe=>({...xe,agentsMode:ne.target.value})),children:Bt.map(ne=>r.jsx("option",{value:ne.value,children:ne.label},ne.value))}),r.jsx("small",{children:rn})]})]})]}),r.jsxs("section",{className:"butler-init-form-section",children:[r.jsx("header",{className:"butler-init-section-header",children:r.jsx("div",{children:r.jsx("h2",{children:u("shell.butlerInitPersonaTitle")})})}),r.jsxs("div",{className:"butler-init-persona-grid",children:[r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerPersonaToneLabel")}),r.jsx("select",{className:"butler-form-control",value:h.personaTone,onChange:ne=>f(xe=>({...xe,personaTone:ne.target.value})),children:At.map(ne=>r.jsx("option",{value:ne.value,children:ne.label},ne.value))})]}),r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerPersonaLanguageLabel")}),r.jsx("select",{className:"butler-form-control",value:h.personaLanguage,onChange:ne=>f(xe=>({...xe,personaLanguage:ne.target.value})),children:vt.map(ne=>r.jsx("option",{value:ne.value,children:ne.label},ne.value))})]}),r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerPersonaSummaryStyleLabel")}),r.jsx("select",{className:"butler-form-control",value:h.personaSummaryStyle,onChange:ne=>f(xe=>({...xe,personaSummaryStyle:ne.target.value})),children:Nt.map(ne=>r.jsx("option",{value:ne.value,children:ne.label},ne.value))})]})]})]}),r.jsxs("section",{className:"butler-init-form-section",children:[r.jsx("header",{className:"butler-init-section-header",children:r.jsx("div",{children:r.jsx("h2",{children:u("shell.butlerInitPreferenceTitle")})})}),r.jsxs("div",{className:"butler-init-preferences-grid",children:[r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerFocusRiskPreferenceLabel")}),r.jsx("select",{className:"butler-form-control",value:h.focusRiskPreference,onChange:ne=>f(xe=>({...xe,focusRiskPreference:ne.target.value})),children:Zt.map(ne=>r.jsx("option",{value:ne.value,children:ne.label},ne.value))})]}),r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerReportPriorityPresetLabel")}),r.jsx("select",{className:"butler-form-control",value:h.reportPriorityPreset,onChange:ne=>f(xe=>({...xe,reportPriorityPreset:ne.target.value})),children:ie.map(ne=>r.jsx("option",{value:ne.value,children:ne.label},ne.value))})]})]})]}),r.jsx("div",{className:"butler-init-actions",children:r.jsx("button",{className:"butler-init-submit",type:"submit",disabled:R||p,children:u(R||p?"shell.butlerInitSubmitting":"shell.butlerInitSubmit")})})]})]})]})}function kW(e){const[t,n]=b.useState("info"),i=[{id:"info",label:u("shell.butlerSidebarInfoTab")},{id:"automation",label:u("shell.butlerSidebarAutomationTab")},{id:"settings",label:u("shell.butlerSidebarSettingsTab")}];return r.jsxs("div",{className:"butler-side-column",children:[r.jsx("div",{className:"workbench-auxiliary-header butler-side-header",children:r.jsx("div",{className:"workbench-info-tabs butler-side-tabs",role:"tablist","aria-label":u("shell.butlerSidebarTabsLabel"),children:i.map(a=>r.jsx("button",{type:"button",role:"tab","aria-selected":t===a.id,className:t===a.id?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{n(a.id)},children:a.label},a.id))})}),t==="info"?r.jsx(SW,{overview:e.overview,inboxItems:e.inboxItems,followUpTasks:e.followUpTasks,onOpenFollowUpHistory:e.onOpenFollowUpHistory,onOpenFollowUpDetail:e.onOpenFollowUpDetail}):t==="automation"?r.jsx(CW,{overview:e.overview,followUpTasks:e.followUpTasks,patrolPlans:e.patrolPlans}):r.jsx(EW,{settingsForm:e.settingsForm,savingSettings:e.savingSettings,onSettingsFormChange:e.onSettingsFormChange,onSaveSettings:e.onSaveSettings})]})}function SW(e){var i;const t=b.useMemo(()=>{var a;return DW(((a=e.overview)==null?void 0:a.verifications)??[])},[(i=e.overview)==null?void 0:i.verifications]),n=b.useMemo(()=>FW(e.inboxItems),[e.inboxItems]);return r.jsxs(r.Fragment,{children:[r.jsx(NW,{tasks:e.followUpTasks,onOpenFollowUpHistory:e.onOpenFollowUpHistory,onOpenFollowUpDetail:e.onOpenFollowUpDetail}),r.jsx(jx,{title:u("shell.butlerInfoVerificationRecordsTitle"),items:t,emptyText:u("shell.butlerInfoVerificationRecordsEmpty")}),r.jsx(jx,{title:u("shell.butlerInfoTodoRecordsTitle"),items:n,emptyText:u("shell.butlerInfoTodoRecordsEmpty")})]})}function CW(e){const t=b.useMemo(()=>IW(e.patrolPlans,e.followUpTasks,e.overview),[e.followUpTasks,e.overview,e.patrolPlans]),n=b.useMemo(()=>LW(e.followUpTasks,e.overview),[e.followUpTasks,e.overview]);return r.jsxs(r.Fragment,{children:[r.jsx(TW,{items:t,emptyText:u("shell.butlerAutomationTasksEmpty")}),r.jsx(RW,{items:n,emptyText:u("shell.butlerAutomationRunsEmpty")})]})}function jx(e){return r.jsxs("section",{className:"butler-side-card",children:[r.jsx("header",{children:r.jsx("h2",{children:e.title})}),e.items.length>0?r.jsx("div",{className:"butler-record-list",children:e.items.map(t=>r.jsx(jW,{title:t.title,content:t.content},`${t.title}:${t.content}`))}):r.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function jW(e){return r.jsxs("div",{className:"butler-simple-info-block",children:[r.jsx("span",{children:e.title}),r.jsx("strong",{children:e.content})]})}function NW(e){const t=b.useMemo(()=>[...e.tasks].sort((n,i)=>Nr(Al(i))-Nr(Al(n))).slice(0,5),[e.tasks]);return r.jsxs("section",{className:"butler-side-card",children:[r.jsxs("header",{children:[r.jsx("div",{className:"butler-card-header-copy",children:r.jsx("h2",{children:u("shell.butlerInfoFollowUpRecordsTitle")})}),r.jsx("button",{type:"button",className:"secondary-button butler-side-header-action",onClick:e.onOpenFollowUpHistory,children:u("shell.butlerFollowUpHistoryAction")})]}),t.length>0?r.jsx("div",{className:"butler-record-list",children:t.map(n=>r.jsx(bN,{task:n,onOpenFollowUpDetail:e.onOpenFollowUpDetail},n.id))}):r.jsx("p",{className:"butler-secondary-text",children:u("shell.butlerInfoFollowUpRecordsEmpty")})]})}function PW(e){const t=b.useMemo(()=>[...e.tasks].sort((n,i)=>Nr(Al(i))-Nr(Al(n))),[e.tasks]);return r.jsx("div",{className:"butler-follow-up-history-panel",children:t.length>0?r.jsx("div",{className:"butler-record-list",children:t.map(n=>r.jsx(bN,{task:n,onOpenFollowUpDetail:async i=>{e.onClose(),await e.onOpenFollowUpDetail(i)}},n.id))}):r.jsx("p",{className:"butler-secondary-text",children:u("shell.butlerInfoFollowUpRecordsEmpty")})})}function bN(e){var a,c,l;const{task:t}=e,n=((a=t.sessionTitle)==null?void 0:a.trim())||t.projectName,i=((c=t.waitingReason)==null?void 0:c.trim())||((l=t.lastAutomationSummary)==null?void 0:l.trim())||t.objective;return r.jsxs("article",{className:"butler-follow-up-status-card",children:[r.jsxs("header",{className:"butler-follow-up-status-header",children:[r.jsxs("div",{className:"butler-follow-up-status-title-group",children:[r.jsx("strong",{children:n}),r.jsx("span",{children:t.projectName})]}),r.jsx("span",{className:"butler-automation-status-badge","data-status":t.status,children:$l(t.status)})]}),r.jsx("div",{className:"butler-follow-up-status-body",children:r.jsx("p",{children:i})}),r.jsxs("footer",{className:"butler-follow-up-status-footer",children:[r.jsx("span",{children:aa(Al(t))}),r.jsx("button",{type:"button",className:"secondary-button butler-follow-up-status-action",onClick:()=>{e.onOpenFollowUpDetail(t.id)},children:u("shell.butlerAutomationViewRoundsAction")})]})]})}function TW(e){return r.jsxs("section",{className:"butler-side-card",children:[r.jsx("header",{children:r.jsx("h2",{children:u("shell.butlerAutomationTasksTitle")})}),e.items.length>0?r.jsx("div",{className:"butler-record-list",children:e.items.map(t=>r.jsxs("article",{className:"butler-automation-card",children:[r.jsxs("header",{className:"butler-automation-card-header",children:[r.jsxs("div",{className:"butler-automation-card-title-group",children:[r.jsx("strong",{children:t.title}),r.jsx("span",{children:t.projectName})]}),r.jsx("span",{className:"butler-automation-status-badge","data-status":"active",children:t.statusLabel})]}),r.jsxs("div",{className:"butler-automation-card-body",children:[r.jsxs("div",{className:"butler-automation-row",children:[r.jsx("span",{children:u("shell.butlerAutomationTaskTypeLabel")}),r.jsx("strong",{children:t.taskTypeLabel})]}),r.jsxs("div",{className:"butler-automation-row",children:[r.jsx("span",{children:u("shell.butlerAutomationTaskLastRunLabel")}),r.jsx("strong",{children:aa(t.lastRunAt)})]})]}),r.jsxs("footer",{className:"butler-automation-card-footer",children:[r.jsx("span",{children:u("shell.butlerAutomationTaskNextRunLabel")}),r.jsx("strong",{children:aa(t.nextRunAt)})]})]},t.id))}):r.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function RW(e){return r.jsxs("section",{className:"butler-side-card",children:[r.jsx("header",{children:r.jsx("h2",{children:u("shell.butlerAutomationRunsTitle")})}),e.items.length>0?r.jsx("div",{className:"butler-record-list",children:e.items.map(t=>r.jsxs("article",{className:"butler-automation-card",children:[r.jsxs("header",{className:"butler-automation-card-header",children:[r.jsxs("div",{className:"butler-automation-card-title-group",children:[r.jsx("strong",{children:t.title}),r.jsx("span",{children:t.projectName})]}),r.jsx("span",{className:"butler-automation-status-badge","data-status":"active",children:t.statusLabel})]}),r.jsxs("div",{className:"butler-automation-card-body",children:[r.jsxs("div",{className:"butler-automation-row",children:[r.jsx("span",{children:u("shell.butlerAutomationRunSourceLabel")}),r.jsx("strong",{children:t.sourceLabel})]}),r.jsxs("div",{className:"butler-automation-row",children:[r.jsx("span",{children:u("shell.butlerAutomationRunSummaryLabel")}),r.jsx("strong",{children:t.summary})]})]}),r.jsxs("footer",{className:"butler-automation-card-footer",children:[r.jsx("span",{children:u("shell.butlerAutomationRunProcessedAtLabel")}),r.jsx("strong",{children:aa(t.createdAt)})]})]},t.id))}):r.jsx("p",{className:"butler-secondary-text",children:e.emptyText})]})}function EW(e){return r.jsxs("section",{className:"butler-side-card butler-settings-panel",children:[r.jsx("header",{children:r.jsx("h2",{children:u("shell.butlerSettingsTitle")})}),r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerDisplayNameLabel")}),r.jsx("input",{"aria-label":u("shell.butlerDisplayNameLabel"),className:"butler-form-control",value:e.settingsForm.displayName,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({displayName:t.target.value})}})]}),r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerAgentsModeLabel")}),r.jsxs("select",{"aria-label":u("shell.butlerAgentsModeLabel"),className:"butler-form-control",value:e.settingsForm.agentsMode,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({agentsMode:t.target.value})},children:[r.jsx("option",{value:"inline",children:u("shell.butlerAgentsModeInline")}),r.jsx("option",{value:"file",children:u("shell.butlerAgentsModeFile")})]}),r.jsx("small",{children:e.settingsForm.agentsMode==="file"?u("shell.butlerAgentsModeFileDescription"):u("shell.butlerAgentsModeInlineDescription")})]}),e.settingsForm.agentsMode==="file"?r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerAgentsFilePathLabel")}),r.jsx("input",{"aria-label":u("shell.butlerAgentsFilePathLabel"),className:"butler-form-control butler-settings-file-path",value:e.settingsForm.agentsFilePath,readOnly:!0,disabled:e.savingSettings})]}):null,r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerAgentsContentLabel")}),r.jsx("textarea",{"aria-label":u("shell.butlerAgentsContentLabel"),className:"butler-form-control butler-settings-agents-editor",rows:10,value:e.settingsForm.agentsContent,disabled:e.savingSettings,placeholder:u("shell.butlerAgentsContentPlaceholder"),onChange:t=>{e.onSettingsFormChange({agentsContent:t.target.value})}}),r.jsx("small",{children:u("shell.butlerAgentsContentHint")})]}),r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerPersonaToneLabel")}),r.jsxs("select",{"aria-label":u("shell.butlerPersonaToneLabel"),className:"butler-form-control",value:e.settingsForm.personaTone,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({personaTone:t.target.value})},children:[r.jsx("option",{value:"direct",children:u("shell.butlerToneDirect")}),r.jsx("option",{value:"steady",children:u("shell.butlerToneSteady")}),r.jsx("option",{value:"friendly",children:u("shell.butlerToneFriendly")})]})]}),r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerPersonaLanguageLabel")}),r.jsxs("select",{"aria-label":u("shell.butlerPersonaLanguageLabel"),className:"butler-form-control",value:e.settingsForm.personaLanguage,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({personaLanguage:t.target.value})},children:[r.jsx("option",{value:"zh-CN",children:u("shell.butlerLanguageZhCn")}),r.jsx("option",{value:"en-US",children:u("shell.butlerLanguageEnUs")}),r.jsx("option",{value:"bilingual",children:u("shell.butlerLanguageBilingual")})]})]}),r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerPersonaSummaryStyleLabel")}),r.jsxs("select",{"aria-label":u("shell.butlerPersonaSummaryStyleLabel"),className:"butler-form-control",value:e.settingsForm.personaSummaryStyle,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({personaSummaryStyle:t.target.value})},children:[r.jsx("option",{value:"brief",children:u("shell.butlerSummaryBrief")}),r.jsx("option",{value:"structured",children:u("shell.butlerSummaryStructured")}),r.jsx("option",{value:"thorough",children:u("shell.butlerSummaryThorough")})]})]}),r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerFocusRiskPreferenceLabel")}),r.jsxs("select",{"aria-label":u("shell.butlerFocusRiskPreferenceLabel"),className:"butler-form-control",value:e.settingsForm.focusRiskPreference,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({focusRiskPreference:t.target.value})},children:[r.jsx("option",{value:"conservative",children:u("shell.butlerRiskConservative")}),r.jsx("option",{value:"balanced",children:u("shell.butlerRiskBalanced")}),r.jsx("option",{value:"proactive",children:u("shell.butlerRiskProactive")})]})]}),r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerReportPriorityPresetLabel")}),r.jsxs("select",{"aria-label":u("shell.butlerReportPriorityPresetLabel"),className:"butler-form-control",value:e.settingsForm.reportPriorityPreset,disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({reportPriorityPreset:t.target.value})},children:[r.jsx("option",{value:"risk-first",children:u("shell.butlerReportRiskFirst")}),r.jsx("option",{value:"blocker-first",children:u("shell.butlerReportBlockerFirst")}),r.jsx("option",{value:"verification-first",children:u("shell.butlerReportVerificationFirst")}),r.jsx("option",{value:"progress-first",children:u("shell.butlerReportProgressFirst")})]})]}),r.jsxs("label",{className:"butler-form-field",children:[r.jsx("span",{children:u("shell.butlerSummaryDebounceLabel")}),r.jsx("select",{"aria-label":u("shell.butlerSummaryDebounceLabel"),className:"butler-form-control",value:String(e.settingsForm.summaryDebounceSeconds),disabled:e.savingSettings,onChange:t=>{e.onSettingsFormChange({summaryDebounceSeconds:Number(t.target.value)})},children:wW.map(t=>r.jsx("option",{value:t.value,children:u(t.labelKey)},t.value))})]}),r.jsx("div",{className:"butler-inline-actions",children:r.jsx("button",{type:"button",className:"primary-button",disabled:e.savingSettings,onClick:e.onSaveSettings,children:e.savingSettings?u("shell.butlerSettingsSaving"):u("shell.butlerSettingsSaveAction")})})]})}function AW(){return r.jsxs("section",{className:"butler-loading-panel",role:"status","aria-live":"polite",children:[r.jsxs("div",{className:"butler-loading-orb","aria-hidden":"true",children:[r.jsx("span",{className:"butler-loading-ring butler-loading-ring-primary"}),r.jsx("span",{className:"butler-loading-ring butler-loading-ring-secondary"}),r.jsx("span",{className:"butler-loading-core"})]}),r.jsxs("div",{className:"butler-loading-copy",children:[r.jsx("h1",{children:u("shell.butlerLoadingTitle")}),r.jsx("p",{children:u("shell.butlerLoadingDescription")})]})]})}function aa(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 Al(e){return e.updatedAt||e.lastAutomationAt||e.lastCheckedAt||e.createdAt}function IW(e,t,n){const i=new Map(((n==null?void 0:n.projects)??[]).map(l=>[l.id,l.name])),a=e.map(l=>({id:`patrol-plan:${l.id}`,title:l.name,projectName:i.get(l.projectId)??l.projectId,taskTypeLabel:Px("patrol_plan",l.triggerType),statusLabel:l.enabled?u("shell.butlerAutomationTaskEnabled"):u("shell.butlerAutomationTaskDisabled"),nextRunAt:l.nextRunAt,lastRunAt:l.lastScheduledAt})),c=t.map(l=>{var h;return{id:`follow-up:${l.id}`,title:((h=l.sessionTitle)==null?void 0:h.trim())||l.projectName,projectName:l.projectName,taskTypeLabel:Px("follow_up"),statusLabel:$l(l.status),nextRunAt:l.nextCheckAt,lastRunAt:l.lastAutomationAt||l.lastCheckedAt||l.updatedAt}});return[...a,...c].sort((l,h)=>{const f=Nr(l.nextRunAt),p=Nr(h.nextRunAt);return f!==p?f===0?1:p===0?-1:f-p:Nr(h.lastRunAt)-Nr(l.lastRunAt)}).slice(0,10)}function LW(e,t){const n=new Map(((t==null?void 0:t.projects)??[]).map(c=>[c.id,c.name])),i=((t==null?void 0:t.patrols)??[]).map(c=>{var l;return{id:`patrol-run:${c.id}`,title:u("shell.butlerAutomationPatrolRunTitle"),projectName:n.get(c.projectId)??c.projectId,sourceLabel:Tx("patrol_run"),statusLabel:c.status,summary:((l=c.summary)==null?void 0:l.trim())||u("shell.butlerAutomationRunEmptySummary"),createdAt:c.finishedAt||c.startedAt||c.createdAt}}),a=e.flatMap(c=>(c.rounds??[]).map(l=>{var h,f;return{id:`follow-up-round:${c.id}:${l.roundNumber}`,title:`${((h=c.sessionTitle)==null?void 0:h.trim())||c.projectName} · ${u("shell.butlerAutomationRoundLabel",{round:l.roundNumber})}`,projectName:c.projectName,sourceLabel:Tx("follow_up_round"),statusLabel:$l(l.status),summary:((f=l.summary)==null?void 0:f.trim())||u("shell.butlerAutomationRunEmptySummary"),createdAt:l.createdAt}}));return[...i,...a].sort((c,l)=>Nr(l.createdAt)-Nr(c.createdAt)).slice(0,12)}function MW(e){if(e.loading)return r.jsx("p",{className:"butler-secondary-text",children:u("shell.butlerAutomationRoundLoading")});if(e.error)return r.jsx("p",{className:"butler-secondary-text",children:e.error});if(!e.task)return r.jsx("p",{className:"butler-secondary-text",children:u("shell.butlerAutomationRoundEmpty")});const t=[...e.task.rounds??[]].sort((n,i)=>Nr(i.createdAt)-Nr(n.createdAt));return r.jsxs("div",{className:"butler-follow-up-rounds",children:[r.jsxs("div",{className:"butler-follow-up-round-summary",children:[r.jsx("strong",{children:e.task.objective}),r.jsx("span",{children:u("conversation.butlerCurrentFollowUpProgress",{current:e.task.autoContinueCount,max:e.task.maxAutoContinueCount??5})})]}),t.length>0?r.jsx("div",{className:"butler-follow-up-round-list",children:t.map(n=>r.jsxs("article",{className:"butler-follow-up-round-card",children:[r.jsxs("header",{className:"butler-follow-up-round-header",children:[r.jsxs("div",{children:[r.jsx("strong",{children:u("shell.butlerAutomationRoundLabel",{round:n.roundNumber})}),r.jsx("span",{children:UW(n.kind)})]}),r.jsx("span",{children:aa(n.createdAt)})]}),r.jsxs("div",{className:"butler-follow-up-round-body",children:[r.jsxs("p",{children:[u("shell.butlerAutomationRoundProcessedAtLabel"),":",aa(n.createdAt)]}),r.jsxs("p",{children:[u("shell.butlerAutomationRoundStatusLabel"),":",$l(n.status)]}),n.observedRunningState?r.jsxs("p",{children:[u("shell.butlerAutomationRoundObservedStateLabel"),":",n.observedRunningState]}):null,r.jsxs("p",{children:[u("shell.butlerAutomationRoundSummaryLabel"),":",n.summary||u("conversation.butlerAnalysisEmpty")]}),n.waitingReason?r.jsxs("p",{children:[u("shell.butlerAutomationRoundWaitingReasonLabel"),":",n.waitingReason]}):null,n.continuePrompt?r.jsxs("p",{children:[u("shell.butlerAutomationRoundPromptLabel"),":",n.continuePrompt]}):null]})]},`${n.roundNumber}:${n.createdAt}`))}):r.jsx("p",{className:"butler-secondary-text",children:u("shell.butlerAutomationRoundEmpty")})]})}function DW(e){return[...e].sort((t,n)=>Nr(Nx(n))-Nr(Nx(t))).slice(0,5).map(t=>{var n,i;return{title:((n=t.targetRef)==null?void 0:n.trim())||t.verificationType,content:((i=t.summary)==null?void 0:i.trim())||u("shell.butlerInfoVerificationFallback",{status:t.status})}})}function FW(e){return e.slice(0,5).map(t=>({title:t.title,content:`${t.projectName} · ${BW(t.status)}`}))}function Nx(e){return e.finishedAt||e.startedAt||e.createdAt}function Nr(e){if(!e)return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function _W(e){for(const[t,n]of Object.entries(Um))if(n.length===e.length&&n.every((i,a)=>i===e[a]))return t;return"risk-first"}function OW(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 BW(e){switch(e){case"pending":return u("shell.butlerInfoTodoPending");case"in_progress":return u("shell.butlerInfoTodoInProgress");case"closed":return u("shell.butlerInfoTodoClosed");default:return u("shell.butlerInfoTodoPending")}}function $l(e){switch(e){case"active":return u("shell.butlerAutomationStatusActive");case"waiting_user":return u("shell.butlerAutomationStatusWaitingUser");case"completed":return u("shell.butlerAutomationStatusCompleted");case"failed":return u("shell.butlerAutomationStatusFailed");case"cancelled":return u("shell.butlerAutomationStatusCancelled");default:return u("shell.butlerAutomationStatusActive")}}function UW(e){switch(e){case"started":return u("shell.butlerAutomationRoundKindStarted");case"continue":return u("shell.butlerAutomationRoundKindContinue");case"queued":return u("shell.butlerAutomationRoundKindQueued");case"waiting_user":return u("shell.butlerAutomationRoundKindWaitingUser");case"completed":return u("shell.butlerAutomationRoundKindCompleted");case"failed":return u("shell.butlerAutomationRoundKindFailed");case"cancelled":return u("shell.butlerAutomationRoundKindCancelled");case"limit_reached":return u("shell.butlerAutomationRoundKindLimitReached");default:return e}}function Px(e,t){if(e==="follow_up")return u("shell.butlerAutomationTaskTypeFollowUp");switch(t){case"interval":return u("shell.butlerAutomationTaskTypeInterval");case"cron":return u("shell.butlerAutomationTaskTypeCron");case"manual":default:return u("shell.butlerAutomationTaskTypeManual")}}function Tx(e){return u(e==="patrol_run"?"shell.butlerAutomationRunSourcePatrol":"shell.butlerAutomationRunSourceFollowUp")}function WW(e){const n=`${e.displayName.trim()}:${e.providerId}:${e.tone}`,i=zW(e);if(!n)return Wi.default[0];const a=Array.from(n).reduce((c,l)=>{const h=l.codePointAt(0)??0;return c+h},0);return i[a%i.length]}function zW(e){const t=e.displayName.trim().toLowerCase();return/(bot|ai|智能|助手|助理|管家|buddy|helper)/.test(t)?Wi.builder:/(书|学|知|研|析|查|review|audit|scan)/.test(t)?Wi.analyst:e.tone==="friendly"?Wi.friendly:e.tone==="steady"?Wi.steady:e.tone==="direct"?e.providerId==="claude-code"?Wi.analyst:Wi.direct:e.providerId==="claude-code"?Wi.analyst:Wi.default}function ms(e,t){var n;return((n=e.find(i=>i.value===t))==null?void 0:n.label)??t}function HW(){return r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[r.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function qW(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.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 $W(e){const[t,n]=b.useState(()=>Rx());return b.useEffect(()=>{if(!e){n(Rx());return}const i=()=>{const a=e.getState();n({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 Rx(){return{messages:[],historyState:"ready",loadingOlderMessages:!1,hasOlderMessages:!1,runtimeHasActiveRun:null,runtimeCanInterrupt:null,contextUsage:null}}function yN({children:e,className:t,frameRef:n,...i}){return r.jsx("div",{ref:n,className:["mobile-top-header-frame",t].filter(Boolean).join(" "),...i,children:e})}function go({currentWorkspace:e,workspaces:t,onSelectWorkspace:n,className:i,containerRef:a,heading:c,content:l,sheetContent:h,triggerLabel:f,triggerAriaLabel:p,onTriggerClick:y,trailing:g,gestureHandlers:w}){const[x,S]=b.useState(!1),C=Yr();return e?r.jsxs(r.Fragment,{children:[r.jsx(yN,{className:i,frameRef:a,...w,children:r.jsxs("section",{className:"mobile-workspace-home-header",children:[r.jsx("h1",{className:"mobile-workspace-switcher-heading",children:c??e.name}),r.jsxs("div",{className:"mobile-workspace-home-toolbar-top",children:[r.jsxs("button",{type:"button",className:"mobile-workspace-home-switcher","aria-label":p??u("shell.workspaceHomeSwitcherLabel"),onClick:()=>{if(y){y();return}C.trigger("selection"),S(!0)},children:[r.jsx("span",{className:"mobile-workspace-home-switcher-label",children:f??e.name}),r.jsx(KW,{})]}),r.jsx("div",{className:"mobile-workspace-home-toolbar-actions",children:g})]}),r.jsx("p",{className:"mobile-workspace-home-path",children:e.path}),l]})}),x&&!y?VW(r.jsxs(GW,{title:u("shell.workspaceHomeSwitcherTitle"),onClose:()=>S(!1),children:[r.jsx("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:t.map(P=>r.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{P.id!==e.id&&C.trigger("selection"),n==null||n(P.id),S(!1)},children:[r.jsxs("div",{className:"mobile-workspace-home-session-main",children:[r.jsx("span",{className:"mobile-workspace-home-session-title",children:P.name}),r.jsx("span",{className:"mobile-workspace-home-session-meta",children:P.path})]}),r.jsx("span",{className:"mobile-workspace-home-row-trailing",children:P.id===e.id?r.jsx(YW,{}):r.jsx(QW,{})})]},P.id))}),h?h(()=>S(!1)):null]})):null]}):null}function VW(e){return typeof document>"u"?null:Qn.createPortal(e,document.body)}function GW({title:e,onClose:t,children:n}){return r.jsx("div",{className:"ios-action-sheet-overlay",role:"presentation",onClick:t,children:r.jsxs("div",{className:"mobile-workspace-home-sheet",role:"dialog","aria-modal":"true","aria-label":e,onClick:i=>i.stopPropagation(),children:[r.jsxs("div",{className:"mobile-workspace-home-sheet-card",children:[r.jsx("div",{className:"mobile-workspace-home-sheet-header",children:r.jsx("strong",{children:e})}),n]}),r.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:t,children:u("common.cancel")})]})})}function KW(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function QW(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function YW(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.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 XW(e){return e.status==="active"}function JW(e){return e.status==="queued"||e.status==="running"}function vN(e,t){return e.filter(XW).length+t.filter(JW).length}const wN="mobile.butler.active-tab",ju=["info","automation"],ZW=15e3,ez=56,tz=1.2;function nz(){if(typeof window>"u")return"info";try{return window.localStorage.getItem(wN)==="automation"?"automation":"info"}catch{return"info"}}function rz(e,t){return e==="automation"?"automation":e==="info"?"info":t}function iz(e,t,n){if(!t)return e;const i=n.x-t.x,a=n.y-t.y;if(Math.abs(i)<ez||Math.abs(i)<Math.abs(a)*tz)return e;const c=ju.indexOf(e),l=i<0?Math.min(ju.length-1,c+1):Math.max(0,c-1);return ju[l]??e}function sz(){var N,z,G,J;const{workspaceId:e=""}=ca(),t=Qr(),n=Wn(),{showToast:i}=En(),{navigationGroups:a,selectWorkspace:c}=Yn(),l=((N=a.find(B=>B.workspace.id===e))==null?void 0:N.workspace)??null,h=new URLSearchParams(t.search).get("tab"),f=b.useRef(nz()),p=rz(h,f.current),y=b.useRef(null),[g,w]=b.useState({loading:!0,initialized:!1,profile:null,overview:null,followUpTasks:[],inboxItems:[],patrolPlans:[]});b.useEffect(()=>{if(f.current=p,!(typeof window>"u"))try{window.localStorage.setItem(wN,p)}catch{}},[p]),b.useEffect(()=>{if(h===p)return;const B=new URLSearchParams(t.search);B.set("tab",p),n({pathname:t.pathname,search:`?${B.toString()}`},{replace:!0})},[p,t.pathname,t.search,n,h]),b.useEffect(()=>{e&&c(e)},[c,e]),b.useEffect(()=>{if(!e){w({loading:!1,initialized:!1,profile:null,overview:null,followUpTasks:[],inboxItems:[],patrolPlans:[]});return}let B=!1;async function W(re){w(R=>({...R,loading:!0}));try{const R=await ld();if(!R.initialized||!R.profile){B||w({loading:!1,initialized:!1,profile:null,overview:null,followUpTasks:[],inboxItems:[],patrolPlans:[]});return}const[$,Z,F]=await Promise.all([cd(),Sl(),kl({workspaceId:e})]),we=$.overview.projects.filter(be=>be.workspaceId===e).map(be=>be.id),ce=await Promise.all(we.map(be=>kC(be)));if(B)return;w({loading:!1,initialized:!0,profile:R.profile,overview:$.overview,followUpTasks:Z.items.filter(be=>be.workspaceId===e),inboxItems:F.items.filter(be=>be.status!=="closed"),patrolPlans:ce.flatMap(be=>be.items)})}catch(R){if(B)return;w($=>({...$,loading:!1})),re&&i({title:u("shell.butlerLoadFailed"),description:R instanceof Error?R.message:void 0,tone:"error"})}}W(!0);const Y=window.setInterval(()=>{W(!1)},ZW),Q=Zp(()=>{W(!1)}),D=()=>{W(!1)};return window.addEventListener(uo,D),()=>{B=!0,window.clearInterval(Y),Q(),window.removeEventListener(uo,D)}},[i,e]);const x=b.useMemo(()=>{var B;return new Set((((B=g.overview)==null?void 0:B.projects)??[]).filter(W=>W.workspaceId===e).map(W=>W.id))},[(z=g.overview)==null?void 0:z.projects,e]),S=b.useMemo(()=>{var B;return(((B=g.overview)==null?void 0:B.projects)??[]).filter(W=>W.workspaceId===e)},[(G=g.overview)==null?void 0:G.projects,e]),C=b.useMemo(()=>g.followUpTasks.filter(B=>B.status==="waiting_user").length,[g.followUpTasks]),P=b.useMemo(()=>{var B;return(((B=g.overview)==null?void 0:B.verifications)??[]).filter(W=>W.projectId?x.has(W.projectId):!1)},[(J=g.overview)==null?void 0:J.verifications,x]),A=b.useMemo(()=>vN(g.followUpTasks,P),[g.followUpTasks,P]),L=b.useMemo(()=>[...g.followUpTasks].sort((B,W)=>ki(Uf(W))-ki(Uf(B))).slice(0,4),[g.followUpTasks]),O=b.useMemo(()=>oz(P),[P]),ee=b.useMemo(()=>az(g.inboxItems).slice(0,4),[g.inboxItems]),q=b.useMemo(()=>lz(g.patrolPlans,g.followUpTasks,g.overview,x),[g.followUpTasks,g.overview,g.patrolPlans,x]),_=b.useMemo(()=>cz(g.followUpTasks,g.overview,x),[g.followUpTasks,g.overview,x]);function E(B){B!==p&&n(co(e,B),{replace:!0})}function M(B){if(B.changedTouches.length!==1){y.current=null;return}const W=B.changedTouches[0];y.current={x:W.clientX,y:W.clientY}}function I(B){const W=y.current;if(y.current=null,B.changedTouches.length!==1)return;const Y=B.changedTouches[0],Q=iz(p,W,{x:Y.clientX,y:Y.clientY});Q!==p&&E(Q)}return l?r.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-butler-page",children:[r.jsx(go,{currentWorkspace:l,workspaces:a.map(B=>B.workspace),heading:u("shell.mobileButlerEntry"),triggerLabel:l.name,onSelectWorkspace:B=>{c(B),n(co(B,p))},content:r.jsx("div",{className:"mobile-butler-segmented-shell",children:r.jsx("div",{className:"mobile-butler-segmented-control",role:"tablist","aria-label":u("shell.mobileButlerEntry"),children:ju.map(B=>{const W=p===B,Y=u(B==="info"?"shell.butlerSidebarInfoTab":"shell.butlerSidebarAutomationTab");return r.jsx("button",{type:"button",role:"tab",className:"mobile-butler-segmented-button","aria-selected":W,onClick:()=>{E(B)},children:Y},B)})})})}),r.jsx("div",{className:"mobile-page-top-body mobile-butler-body",onTouchStart:M,onTouchEnd:I,children:g.loading?r.jsx("section",{className:"mobile-feature-panel surface-card mobile-butler-empty-panel",children:r.jsx("p",{children:u("common.loading")})}):!g.initialized||!g.profile?r.jsxs("section",{className:"mobile-feature-panel surface-card mobile-butler-empty-panel",children:[r.jsx("h2",{children:u("shell.mobileButlerEmptyTitle")}),r.jsx("p",{children:u("shell.mobileButlerEmptyBody")})]}):p==="info"?r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"mobile-feature-panel surface-card mobile-butler-hero-card",children:[r.jsxs("div",{className:"mobile-butler-hero-top",children:[r.jsx("div",{className:"mobile-butler-hero-badge",children:"AI"}),r.jsxs("div",{className:"mobile-butler-hero-copy",children:[r.jsx("strong",{children:g.profile.displayName||u("shell.mobileButlerEntry")}),r.jsx("span",{children:dz(g.profile.providerId)})]})]}),r.jsxs("div",{className:"mobile-butler-hero-grid",children:[r.jsx(au,{label:u("shell.mobileButlerAssistantWorkspaceLabel"),value:g.profile.workspacePath}),r.jsx(au,{label:u("shell.mobileButlerAssistantToneLabel"),value:hz(g.profile.persona.tone)}),r.jsx(au,{label:u("shell.mobileButlerAssistantLanguageLabel"),value:fz(g.profile.persona.language)}),r.jsx(au,{label:u("shell.mobileButlerAssistantUpdatedAtLabel"),value:cu(g.profile.updatedAt)})]})]}),r.jsxs("section",{className:"mobile-feature-panel surface-card mobile-butler-summary-card",children:[r.jsxs("div",{className:"mobile-feature-section-header",children:[r.jsx("div",{children:r.jsx("h2",{children:u("shell.mobileButlerSummaryTitle")})}),r.jsx("span",{className:"mobile-feature-counter",children:S.length})]}),r.jsxs("div",{className:"mobile-butler-summary-grid",children:[r.jsx(lu,{label:u("shell.mobileButlerSummaryProjects"),value:S.length}),r.jsx(lu,{label:u("shell.mobileButlerSummaryFollowUps"),value:A}),r.jsx(lu,{label:u("shell.mobileButlerSummaryWaitingUser"),value:C}),r.jsx(lu,{label:u("shell.mobileButlerSummaryInbox"),value:g.inboxItems.length})]})]}),r.jsx(ol,{title:u("shell.butlerInfoFollowUpRecordsTitle"),emptyText:u("shell.butlerInfoFollowUpRecordsEmpty"),items:L.map(B=>{var W,Y,Q;return{id:B.id,title:((W=B.sessionTitle)==null?void 0:W.trim())||B.projectName,subtitle:B.projectName,status:eg(B.status),content:((Y=B.waitingReason)==null?void 0:Y.trim())||((Q=B.lastAutomationSummary)==null?void 0:Q.trim())||B.objective,meta:cu(Uf(B))}})}),r.jsx(ol,{title:u("shell.butlerInfoVerificationRecordsTitle"),emptyText:u("shell.butlerInfoVerificationRecordsEmpty"),items:O.map((B,W)=>({id:`${B.title}:${W}`,title:B.title,subtitle:null,status:null,content:B.content,meta:null}))}),r.jsx(ol,{title:u("shell.butlerInfoTodoRecordsTitle"),emptyText:u("shell.butlerInfoTodoRecordsEmpty"),items:ee.map((B,W)=>({id:`${B.title}:${W}`,title:B.title,subtitle:null,status:null,content:B.content,meta:null}))})]}):r.jsxs(r.Fragment,{children:[r.jsx(ol,{title:u("shell.butlerAutomationTasksTitle"),emptyText:u("shell.butlerAutomationTasksEmpty"),items:q.map(B=>({id:B.id,title:B.title,subtitle:B.projectName,status:B.statusLabel,content:`${u("shell.butlerAutomationTaskTypeLabel")} · ${B.taskTypeLabel}`,meta:`${u("shell.butlerAutomationTaskNextRunLabel")} · ${cu(B.nextRunAt)}`}))}),r.jsx(ol,{title:u("shell.butlerAutomationRunsTitle"),emptyText:u("shell.butlerAutomationRunsEmpty"),items:_.map(B=>({id:B.id,title:B.title,subtitle:B.projectName,status:B.statusLabel,content:`${B.sourceLabel} · ${B.summary}`,meta:cu(B.createdAt)}))})]})})]}):r.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:r.jsxs("article",{className:"mobile-feature-empty surface-card",children:[r.jsx("h1",{children:u("shell.workspaceDetailMissingTitle")}),r.jsx("p",{children:u("shell.workspaceDetailMissingBody")})]})})}function au({label:e,value:t}){return r.jsxs("div",{className:"mobile-butler-info-metric",children:[r.jsx("span",{children:e}),r.jsx("strong",{title:t,children:t})]})}function lu({label:e,value:t}){return r.jsxs("div",{className:"mobile-butler-summary-pill",children:[r.jsx("strong",{children:t}),r.jsx("span",{children:e})]})}function ol(e){return r.jsxs("section",{className:"mobile-feature-panel surface-card mobile-butler-record-section",children:[r.jsxs("div",{className:"mobile-feature-section-header",children:[r.jsx("div",{children:r.jsx("h2",{children:e.title})}),r.jsx("span",{className:"mobile-feature-counter",children:e.items.length})]}),e.items.length>0?r.jsx("div",{className:"mobile-butler-record-list",children:e.items.map(t=>r.jsxs("article",{className:"mobile-butler-record-card",children:[r.jsxs("header",{className:"mobile-butler-record-header",children:[r.jsxs("div",{className:"mobile-butler-record-copy",children:[r.jsx("strong",{children:t.title}),t.subtitle?r.jsx("span",{children:t.subtitle}):null]}),t.status?r.jsx("span",{className:"mobile-butler-record-badge",children:t.status}):null]}),r.jsx("p",{children:t.content}),t.meta?r.jsx("footer",{children:t.meta}):null]},t.id))}):r.jsx("p",{className:"mobile-butler-empty-text",children:e.emptyText})]})}function oz(e){return[...e].sort((t,n)=>ki(Ix(n))-ki(Ix(t))).slice(0,4).map(t=>{var n,i;return{title:((n=t.targetRef)==null?void 0:n.trim())||t.verificationType,content:((i=t.summary)==null?void 0:i.trim())||u("shell.butlerInfoVerificationFallback",{status:t.status})}})}function az(e){return e.map(t=>({title:t.title,content:`${t.projectName} · ${uz(t.status)}`}))}function lz(e,t,n,i){const a=new Map(((n==null?void 0:n.projects)??[]).filter(h=>i.has(h.id)).map(h=>[h.id,h.name])),c=e.filter(h=>i.has(h.projectId)).map(h=>({id:`patrol-plan:${h.id}`,title:h.name,projectName:a.get(h.projectId)??h.projectId,taskTypeLabel:Ex("patrol_plan",h.triggerType),statusLabel:h.enabled?u("shell.butlerAutomationTaskEnabled"):u("shell.butlerAutomationTaskDisabled"),nextRunAt:h.nextRunAt,lastRunAt:h.lastScheduledAt})),l=t.map(h=>{var f;return{id:`follow-up:${h.id}`,title:((f=h.sessionTitle)==null?void 0:f.trim())||h.projectName,projectName:h.projectName,taskTypeLabel:Ex("follow_up"),statusLabel:eg(h.status),nextRunAt:h.nextCheckAt,lastRunAt:h.lastAutomationAt||h.lastCheckedAt||h.updatedAt}});return[...c,...l].sort((h,f)=>{const p=ki(h.nextRunAt),y=ki(f.nextRunAt);return p!==y?p===0?1:y===0?-1:p-y:ki(f.lastRunAt)-ki(h.lastRunAt)}).slice(0,8)}function cz(e,t,n){const i=new Map(((t==null?void 0:t.projects)??[]).filter(l=>n.has(l.id)).map(l=>[l.id,l.name])),a=((t==null?void 0:t.patrols)??[]).filter(l=>n.has(l.projectId)).map(l=>{var h;return{id:`patrol-run:${l.id}`,title:u("shell.butlerAutomationPatrolRunTitle"),projectName:i.get(l.projectId)??l.projectId,sourceLabel:Ax("patrol_run"),statusLabel:l.status,summary:((h=l.summary)==null?void 0:h.trim())||u("shell.butlerAutomationRunEmptySummary"),createdAt:l.finishedAt||l.startedAt||l.createdAt}}),c=e.flatMap(l=>(l.rounds??[]).map(h=>{var f,p;return{id:`follow-up-round:${l.id}:${h.roundNumber}`,title:`${((f=l.sessionTitle)==null?void 0:f.trim())||l.projectName} · ${u("shell.butlerAutomationRoundLabel",{round:h.roundNumber})}`,projectName:l.projectName,sourceLabel:Ax("follow_up_round"),statusLabel:eg(h.status),summary:((p=h.summary)==null?void 0:p.trim())||u("shell.butlerAutomationRunEmptySummary"),createdAt:h.createdAt}}));return[...a,...c].sort((l,h)=>ki(h.createdAt)-ki(l.createdAt)).slice(0,10)}function uz(e){switch(e){case"pending":return u("shell.butlerInfoTodoPending");case"in_progress":return u("shell.butlerInfoTodoInProgress");case"closed":return u("shell.butlerInfoTodoClosed");default:return u("shell.butlerInfoTodoPending")}}function Uf(e){return e.updatedAt||e.lastAutomationAt||e.lastCheckedAt||e.createdAt}function eg(e){switch(e){case"active":return u("shell.butlerAutomationStatusActive");case"waiting_user":return u("shell.butlerAutomationStatusWaitingUser");case"completed":return u("shell.butlerAutomationStatusCompleted");case"failed":return u("shell.butlerAutomationStatusFailed");case"cancelled":return u("shell.butlerAutomationStatusCancelled");default:return u("shell.butlerAutomationStatusActive")}}function Ex(e,t){if(e==="follow_up")return u("shell.butlerAutomationTaskTypeFollowUp");switch(t){case"interval":return u("shell.butlerAutomationTaskTypeInterval");case"cron":return u("shell.butlerAutomationTaskTypeCron");case"manual":default:return u("shell.butlerAutomationTaskTypeManual")}}function Ax(e){return u(e==="patrol_run"?"shell.butlerAutomationRunSourcePatrol":"shell.butlerAutomationRunSourceFollowUp")}function Ix(e){return e.finishedAt||e.startedAt||e.createdAt}function ki(e){if(!e)return 0;const t=new Date(e).getTime();return Number.isNaN(t)?0:t}function cu(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 dz(e){switch(e){case"claude-code":return"Claude Code";case"codex":default:return"Codex"}}function hz(e){switch(e){case"friendly":return u("shell.butlerToneFriendly");case"steady":return u("shell.butlerToneSteady");case"direct":default:return u("shell.butlerToneDirect")}}function fz(e){switch(e){case"en-US":return u("shell.butlerLanguageEnUs");case"bilingual":return u("shell.butlerLanguageBilingual");case"zh-CN":default:return u("shell.butlerLanguageZhCn")}}function mz(){const{shellMode:e}=Yn();return e==="mobile"?r.jsx(sz,{}):r.jsx(xW,{})}function xN({connectionState:e,onReconnect:t}){const{showToast:n,dismissToast:i}=En();return b.useEffect(()=>{if(e==="connected"||e==="closed"){i("conversation-connection-state");return}if(e==="reconnect_failed"){n({id:"conversation-connection-state",title:u("conversation.connectionReconnectFailed"),description:u("conversation.reconnectFailedExplain"),tone:"warning",durationMs:null,action:{label:u("conversation.reconnectButton"),onClick:t}});return}n({id:"conversation-connection-state",title:u("conversation.connectionReconnecting"),description:u("conversation.reconnectExplain"),tone:"info",durationMs:3200})},[e,i,t,n]),null}function pz({requests:e,replyingRequestId:t,onReply:n}){const[i,a]=b.useState({}),c=b.useMemo(()=>e.filter(l=>l.status==="pending"),[e]);return c.length===0?null:r.jsxs("section",{className:"permission-request-list",children:[r.jsxs("div",{className:"permission-request-list-header",children:[r.jsx("div",{children:r.jsx("strong",{children:u("conversation.permissionRequestSectionTitle")})}),r.jsx("span",{className:"permission-request-count",children:c.length})]}),r.jsx("div",{className:"permission-request-stack",children:c.map(l=>{var w,x;const h=i[l.id]??{},f=l.paths.filter(Boolean),p=l.kind==="command"&&!!((w=l.command)!=null&&w.trim()),y=l.questions.length===0&&f.length===0&&!p&&!!((x=l.summary)!=null&&x.trim()),g=l.kind==="user_input"&&l.questions.some(S=>{var C;return(((C=h[S.id])==null?void 0:C.filter(Boolean).length)??0)===0});return r.jsxs("article",{className:"permission-request-card",children:[r.jsxs("header",{className:"permission-request-card-header",children:[r.jsxs("div",{className:"permission-request-provider",children:[r.jsx("span",{className:"permission-request-provider-icon","aria-hidden":"true",children:r.jsx("img",{src:pC(l.provider),alt:"",loading:"lazy"})}),r.jsxs("div",{className:"permission-request-provider-copy",children:[r.jsx("strong",{children:l.title}),r.jsx("span",{children:$i(l.provider,"full")})]})]}),r.jsx("span",{className:"permission-request-kind",children:gz(l.kind)})]}),r.jsxs("div",{className:"permission-request-card-body",children:[f.length>0?r.jsx("div",{className:"permission-request-block",children:r.jsx("ul",{className:"permission-request-target-list",children:f.map(S=>r.jsxs("li",{className:"permission-request-target-item",children:[r.jsx("strong",{children:bz(S)}),r.jsx("span",{children:S})]},`${l.id}:${S}`))})}):null,p?r.jsxs("div",{className:"permission-request-block",children:[r.jsx("div",{className:"permission-request-block-label",children:u("conversation.permissionRequestCommandLabel")}),r.jsx("pre",{children:l.command})]}):null,y?r.jsx("p",{className:"permission-request-summary",children:l.summary}):null,l.questions.length>0?r.jsxs("div",{className:"permission-request-block",children:[r.jsx("div",{className:"permission-request-block-label",children:u("conversation.permissionRequestQuestionsLabel")}),r.jsx("div",{className:"permission-request-question-list",children:l.questions.map(S=>r.jsxs("div",{className:"permission-request-question",children:[r.jsx("div",{className:"permission-request-question-header",children:S.header}),r.jsx("p",{children:S.question}),r.jsx("div",{className:"permission-request-question-options",children:S.options.map(C=>{var A;const P=((A=h[S.id])==null?void 0:A.includes(C.label))??!1;return r.jsxs("label",{className:"permission-request-question-option",children:[r.jsx("input",{type:"radio",name:`${l.id}:${S.id}`,checked:P,onChange:()=>{a(L=>({...L,[l.id]:{...L[l.id]??{},[S.id]:[C.label]}}))}}),r.jsxs("span",{children:[r.jsx("strong",{children:C.label}),C.description?r.jsx("small",{children:C.description}):null]})]},`${S.id}:${C.label}`)})})]},S.id))})]}):null]}),r.jsx("footer",{className:"permission-request-card-footer",children:l.actions.map(S=>r.jsx("button",{type:"button",className:`permission-request-action permission-request-action-${S.tone}`,disabled:t===l.id||S.value==="submit"&&g,onClick:()=>void n(l.id,{action:S.value,answers:l.kind==="user_input"?h:void 0}),children:t===l.id?u("conversation.permissionRequestSubmitting"):S.label},`${l.id}:${S.value}`))})]},l.id)})})]})}function gz(e){return u(e==="command"?"conversation.permissionRequestKindCommand":e==="file_change"?"conversation.permissionRequestKindFileChange":e==="permissions"?"conversation.permissionRequestKindPermissions":e==="user_input"?"conversation.permissionRequestKindUserInput":"conversation.permissionRequestKindToolCall")}function bz(e){return e.split(/[/\\]+/).filter(Boolean).at(-1)??e}function yz({items:e,deletingQueueItemId:t=null,steeringQueueItemId:n=null,canSteer:i=!1,onDelete:a,onSteer:c}){return e.length===0?null:r.jsxs("section",{className:"queued-message-list","aria-label":u("conversation.queueTitle"),children:[r.jsx("div",{className:"queued-message-list__header",children:r.jsx("h2",{children:`${u("conversation.queueTitle")} · ${e.length}`})}),r.jsx("div",{className:"queued-message-list__items",children:e.map((l,h)=>{const f=l.status==="queued"||l.status==="failed",p=i&&typeof c=="function"&&l.status==="queued";return r.jsxs("article",{className:"queued-message-item",children:[r.jsxs("div",{className:"queued-message-item__main",children:[r.jsx("span",{className:"queued-message-item__order","aria-hidden":"true",children:h+1}),r.jsx("p",{className:"queued-message-item__content",title:l.content||u("conversation.queueImageOnly"),children:l.content||u("conversation.queueImageOnly")}),r.jsx("span",{className:`queued-message-item__status queued-message-item__status--${l.status}`,children:l.status==="failed"?u("conversation.queueStatusFailed"):u("conversation.queueStatusQueued")}),r.jsxs("div",{className:"queued-message-item__actions",children:[p?r.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--steer",onClick:()=>void c(l.id),disabled:n===l.id,"aria-label":u("conversation.queueSteer"),title:u("conversation.queueSteer"),children:n===l.id?u("conversation.queueSteering"):u("conversation.queueSteer")}):null,f?r.jsx("button",{type:"button",className:"queued-message-item__action queued-message-item__action--delete",onClick:()=>void a(l.id),disabled:t===l.id,"aria-label":u("conversation.queueDelete"),title:u("conversation.queueDelete"),children:t===l.id?"…":"×"}):null]})]}),l.errorDetail?r.jsx("p",{className:"queued-message-item__error",children:l.errorDetail}):null]},l.id)})})]})}function vz(e){const t=e.trim().length;return t<=16?"xl":t<=26?"lg":t<=38?"md":"sm"}function kN({session:e,actions:t}){const n=zn(),i=b.useCallback(l=>{!n.isDesktop||n.ui.osFamily!=="macos"||l.button!==0||xp(l.target)&&kp()},[n.isDesktop,n.ui.osFamily]);if(!e)return r.jsxs("header",{className:"conversation-header conversation-header-skeleton","aria-hidden":"true","data-window-drag-handle":"conversation-header",onMouseDownCapture:i,children:[r.jsxs("div",{className:"conversation-header-main",children:[r.jsx("span",{className:"skeleton-line short"}),r.jsx("span",{className:"skeleton-line long"})]}),t?r.jsx("div",{className:"conversation-header-actions",children:t}):null]});const a=Ps(e.title,u("conversation.titleFallback")),c=vz(a.displayTitle);return r.jsxs("header",{className:"conversation-header","data-window-drag-handle":"conversation-header",onMouseDownCapture:i,children:[r.jsx("div",{className:"conversation-header-main",children:r.jsx("h1",{className:`conversation-title is-${c}`,title:a.fullTitle,children:a.displayTitle})}),t?r.jsx("div",{className:"conversation-header-actions",children:t}):null]})}const al=5;function Lx({session:e}){const{showToast:t}=En(),{requestNavigationRefresh:n}=Yn(),[i,a]=b.useState(!1),[c,l]=b.useState(!1),[h,f]=b.useState(null),[p,y]=b.useState(null),[g,w]=b.useState(null),[x,S]=b.useState(""),[C,P]=b.useState(""),[A,L]=b.useState(al),[O,ee]=b.useState(!1),[q,_]=b.useState(0),E=b.useMemo(()=>{var W;return((W=e==null?void 0:e.title)==null?void 0:W.trim())||null},[e==null?void 0:e.title]),M=b.useMemo(()=>h?{workspaceId:h.workspaceId,project:h.project,session:h.session}:null,[h]),I=(h==null?void 0:h.latestFollowUpTask)??null;if(b.useEffect(()=>{a(!1),ee(!1),y(null),f(null),S(""),P(""),L(al)},[e==null?void 0:e.sessionId]),b.useEffect(()=>{if(!(e!=null&&e.sessionId)){l(!1);return}let W=!1;return l(!0),y(null),EI(e.sessionId).then(Y=>{W||f(Y.context)}).catch(Y=>{W||(f(null),y(Y instanceof Error?Y.message:u("conversation.butlerActionLoadFailed")))}).finally(()=>{W||l(!1)}),()=>{W=!0}},[q,e==null?void 0:e.sessionId]),!(e!=null&&e.sessionId))return null;function N(){c||_(W=>W+1)}function z(){!h&&!c&&N()}async function G(){if(!M){z();return}const W=x.trim();if(!W){t({title:u("conversation.butlerFollowUpObjectiveRequired"),tone:"warning"});return}w("follow-up");try{const Y=await CI({projectId:M.project.id,butlerSessionId:M.session.id,objective:W,completionCriteria:C.trim()||void 0,maxAutoContinueCount:A});f(Q=>Q&&{...Q,latestFollowUpTask:Y.task}),n(),t({title:u("conversation.butlerFollowUpStarted"),description:u("conversation.butlerFollowUpStartedDescription",{projectName:M.project.name}),tone:"success"}),S(""),P(""),L(al),a(!1)}catch(Y){t({title:u("conversation.butlerFollowUpFailed"),description:Y instanceof Error?Y.message:void 0,tone:"error"})}finally{w(null)}}async function J(){if(I){w("follow-up");try{const W=await jI(I.id);f(Y=>Y&&{...Y,latestFollowUpTask:W.task}),n(),t({title:u("conversation.butlerFollowUpStopped"),description:u("conversation.butlerFollowUpStoppedDescription"),tone:"success"}),a(!1)}catch(W){t({title:u("conversation.butlerFollowUpStopFailed"),description:W instanceof Error?W.message:void 0,tone:"error"})}finally{w(null)}}}async function B(){if(!M){z();return}w("verification");try{await AI({projectId:M.project.id,butlerSessionId:M.session.id,verificationType:"browser",targetRef:E||M.session.title||M.project.name}),n(),t({title:u("conversation.butlerVerificationStarted"),description:u("conversation.butlerVerificationStartedDescription",{projectName:M.project.name}),tone:"success"}),a(!1)}catch(W){t({title:u("conversation.butlerVerificationFailed"),description:W instanceof Error?W.message:void 0,tone:"error"})}finally{w(null)}}return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"conversation-butler-entry",onMouseEnter:()=>{ee(!0),z()},onMouseLeave:()=>{ee(!1)},children:[r.jsx("button",{type:"button",className:"conversation-header-ai-button","aria-label":u("conversation.butlerActionButton"),title:u("conversation.butlerActionButton"),onFocus:()=>{ee(!0),z()},onBlur:()=>{ee(!1)},onClick:()=>{a(!0),z()},children:r.jsx("span",{className:"conversation-header-ai-button-label",children:"AI"})}),O?r.jsxs("div",{className:"conversation-butler-analysis-popover",role:"status","aria-live":"polite",children:[r.jsx("strong",{children:u("conversation.butlerAnalysisTitle")}),c?r.jsx("p",{children:u("conversation.butlerActionLoading")}):p?r.jsx("p",{children:p}):I?r.jsxs(r.Fragment,{children:[r.jsxs("p",{children:[u("conversation.butlerAnalysisObjectiveLabel"),":",I.objective]}),r.jsxs("p",{children:[u("conversation.butlerAnalysisStatusLabel"),":",Mx(I.status)]}),r.jsxs("p",{children:[u("conversation.butlerAnalysisSummaryLabel"),":",I.lastAutomationSummary||I.waitingReason||u("conversation.butlerAnalysisEmpty")]}),I.waitingReason?r.jsxs("p",{children:[u("conversation.butlerAnalysisWaitingReasonLabel"),":",I.waitingReason]}):null]}):r.jsx("p",{children:u("conversation.butlerAnalysisEmpty")})]}):null]}),r.jsx(Un,{open:i,title:u("conversation.butlerActionModalTitle"),description:u("conversation.butlerActionModalDescription"),onClose:()=>{g||a(!1)},children:r.jsxs("div",{className:"conversation-butler-modal",children:[c?r.jsx("p",{className:"conversation-butler-modal-hint",children:u("conversation.butlerActionLoading")}):null,!c&&p?r.jsx("p",{className:"conversation-butler-modal-error",children:p}):null,!c&&!p&&M?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"conversation-butler-target-card",children:[r.jsx("span",{children:u("conversation.butlerActionProjectLabel")}),r.jsx("strong",{children:M.project.name})]}),r.jsxs("div",{className:"conversation-butler-target-card",children:[r.jsx("span",{children:u("conversation.butlerActionSessionLabel")}),r.jsx("strong",{children:M.session.title||E||M.session.sessionId})]}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("conversation.butlerFollowUpObjectiveLabel")}),r.jsx("textarea",{rows:4,value:x,placeholder:u("conversation.butlerFollowUpObjectivePlaceholder"),disabled:g!==null,onChange:W=>{S(W.target.value)}})]}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("conversation.butlerFollowUpCompletionCriteriaLabel")}),r.jsx("textarea",{rows:3,value:C,placeholder:u("conversation.butlerFollowUpCompletionCriteriaPlaceholder"),disabled:g!==null,onChange:W=>{P(W.target.value)}})]}),r.jsxs("label",{className:"workbench-modal-field",children:[r.jsx("span",{children:u("conversation.butlerFollowUpRoundLimitLabel")}),r.jsx("input",{type:"number",min:1,max:20,value:A,disabled:g!==null,onChange:W=>{const Y=Number.parseInt(W.target.value,10);L(Number.isFinite(Y)?Y:al)}}),r.jsx("small",{children:u("conversation.butlerFollowUpRoundLimitHint")})]}),I&&(I.status==="active"||I.status==="waiting_user")?r.jsxs("div",{className:"conversation-butler-target-card",children:[r.jsx("span",{children:u("conversation.butlerCurrentFollowUpLabel")}),r.jsx("strong",{children:Mx(I.status)}),r.jsx("small",{children:u("conversation.butlerCurrentFollowUpProgress",{current:I.autoContinueCount,max:I.maxAutoContinueCount??al})}),r.jsx("button",{type:"button",className:"workbench-secondary-button",disabled:g!==null,onClick:()=>{J()},children:u("conversation.butlerStopFollowUpAction")})]}):null,r.jsxs("div",{className:"conversation-butler-action-grid",children:[r.jsxs("button",{type:"button",className:"conversation-butler-action-card",disabled:g!==null,onClick:()=>{G()},children:[r.jsx("strong",{children:u("conversation.butlerFollowUpAction")}),r.jsx("span",{children:u("conversation.butlerFollowUpActionDescription")})]}),r.jsxs("button",{type:"button",className:"conversation-butler-action-card",disabled:g!==null,onClick:()=>{B()},children:[r.jsx("strong",{children:u("conversation.butlerVerificationAction")}),r.jsx("span",{children:u("conversation.butlerVerificationActionDescription")})]})]})]}):null]})})]})}function Mx(e){switch(e){case"waiting_user":return u("shell.butlerAutomationStatusWaitingUser");case"completed":return u("shell.butlerAutomationStatusCompleted");case"failed":return u("shell.butlerAutomationStatusFailed");case"cancelled":return u("shell.butlerAutomationStatusCancelled");case"active":default:return u("shell.butlerAutomationStatusActive")}}function Vl({open:e,workspaces:t,initialWorkspaceId:n,onClose:i,onSelect:a}){const[c,l]=b.useState(""),[h,f]=b.useState(!1),p=Yr();if(b.useEffect(()=>{e&&(l(wz(t,n)),f(!1))},[n,e,t]),!e||typeof document>"u")return null;const y=t.find(g=>g.id===c)??t[0]??null;return Qn.createPortal(r.jsx("div",{className:"ios-action-sheet-overlay",role:"presentation",onClick:i,children:r.jsxs("div",{className:"mobile-workspace-home-sheet",role:"dialog","aria-modal":"true","aria-label":u("shell.createSessionModalTitle"),onClick:g=>g.stopPropagation(),children:[r.jsxs("div",{className:"mobile-workspace-home-sheet-card",children:[r.jsx("div",{className:"mobile-workspace-home-sheet-header",children:r.jsx("strong",{children:u("shell.createSessionModalTitle")})}),r.jsxs("div",{className:"mobile-feature-form mobile-workspace-home-form mobile-create-session-form",children:[r.jsx("p",{className:"mobile-create-session-description",children:u("shell.createSessionModalDescription")}),r.jsxs("div",{className:"mobile-feature-field",children:[r.jsx("span",{children:u("shell.createSessionWorkspaceLabel")}),r.jsxs("button",{type:"button",className:"mobile-create-session-workspace-trigger","aria-label":`${u("shell.createSessionWorkspaceLabel")} ${(y==null?void 0:y.name)??""}`.trim(),"aria-expanded":h?"true":"false",disabled:t.length===0,onClick:()=>{p.trigger("selection"),f(g=>!g)},children:[r.jsxs("span",{className:"mobile-create-session-workspace-copy",children:[r.jsx("strong",{children:(y==null?void 0:y.name)??u("common.unknown")}),r.jsx("span",{children:(y==null?void 0:y.path)??u("common.unknown")})]}),r.jsx(xz,{expanded:h})]}),h?r.jsx("div",{className:"mobile-workspace-home-group mobile-create-session-workspace-list",role:"list",children:t.map(g=>r.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-create-session-workspace-row",onClick:()=>{g.id!==c&&p.trigger("selection"),l(g.id),f(!1)},children:[r.jsxs("span",{className:"mobile-create-session-workspace-option-copy",children:[r.jsx("strong",{children:g.name}),r.jsx("span",{children:g.path})]}),r.jsx("span",{className:"mobile-workspace-home-row-trailing",children:g.id===c?r.jsx(Sz,{}):r.jsx(kz,{})})]},g.id))}):null]}),r.jsxs("div",{className:"mobile-create-session-provider-block",children:[r.jsxs("div",{className:"mobile-create-session-provider-header",children:[r.jsx("span",{className:"mobile-create-session-provider-label",children:u("shell.createSessionProviderLabel")}),r.jsx("span",{className:"mobile-create-session-provider-hint",children:u("shell.providerOptionHint")})]}),r.jsx(CC,{disabled:!c,onSelect:g=>{c&&a(c,g)}})]})]})]}),r.jsx("button",{type:"button",className:"ios-action-sheet-cancel",onClick:i,children:u("common.cancel")})]})}),document.body)}function wz(e,t){var n;return t&&e.some(i=>i.id===t)?t:((n=e[0])==null?void 0:n.id)??""}function xz({expanded:e}){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"mobile-create-session-workspace-chevron","data-expanded":e?"true":"false",children:r.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function kz(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function Sz(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.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 SN="mobile.conversation.preview.mode";function Wf(){if(typeof window>"u")return"preview";try{return window.localStorage.getItem(SN)==="immersive"?"immersive":"preview"}catch{return"preview"}}function qi(e){if(!(typeof window>"u"))try{window.localStorage.setItem(SN,e)}catch{}}const Cz=15e3,Dx=.6,zf=.6,Fx=8,jz=36,Nz=48,Pz=96;function Tz(){const{sessionId:e="",workspaceId:t}=ca(),n=Qr(),i=Wn(),a=b.useMemo(()=>new URLSearchParams(n.search),[n.search]),c=(t==null?void 0:t.trim())||null,l=b.useMemo(()=>Iz(e,c,a),[c,a,e]),h=b.useMemo(()=>Hz(e,n.state),[n.state,e]);return l?r.jsx(Az,{draft:l,navigate:i}):r.jsx(Rz,{sessionId:e,bootstrapMessages:h})}function Rz({sessionId:e,bootstrapMessages:t}){var nn;const{shellMode:n,navigationGroups:i,requestNavigationRefresh:a,selectWorkspace:c,setSessionWorkspace:l,markNavigationSessionSeen:h,favoriteSessions:f,archiveSession:p,unarchiveSession:y,startDraftSession:g}=Yn(),w=Wn(),x=b.useRef(null),S=b.useRef(null),[C,P]=b.useState(!1),[A,L]=b.useState(null),[O,ee]=b.useState(!1),[q,_]=b.useState(!1),[E,M]=b.useState(null),[I,N]=b.useState(!1),[z,G]=b.useState(!1),J=b.useMemo(()=>i.flatMap(ke=>ke.sessions).find(ke=>ke.sessionId===e)??null,[i,e]);(!x.current||S.current!==e)&&((nn=x.current)==null||nn.destroy(),x.current=new fN(e,{initialSession:J,bootstrapMessages:t,onSeen:(ke,it)=>{h(ke,it)}}),S.current=e);const B=x.current,{showToast:W,dismissToast:Y}=En(),Q=Hi(ke=>ke.notificationPreferences.notifyOnPermissionRequest),D=zn(),re=Yr(),R=b.useRef(null),$=b.useRef(null),Z=b.useRef(null),F=b.useRef((J==null?void 0:J.runningState)??null),we=b.useRef(new Set),ce=kr(B,ke=>ke.session),be=kr(B,ke=>ke.capabilities),Ve=kr(B,ke=>ke.runtimeHasActiveRun),ze=kr(B,ke=>ke.runtimeCanInterrupt),yt=kr(B,ke=>ke.messages),ft=kr(B,ke=>ke.permissionRequests),Ot=kr(B,ke=>ke.queuedMessages),Ke=kr(B,ke=>ke.contextUsage),jt=kr(B,ke=>ke.historyState),pt=kr(B,ke=>ke.errorCode),Mt=kr(B,ke=>ke.errorDetail),xt=kr(B,ke=>ke.loadingOlderMessages),Dt=kr(B,ke=>ke.hasOlderMessages),wt=kr(B,ke=>ke.connectionState),[ye,Fe]=b.useState(null),[kt,lt]=b.useState(null),gt=Uz(ce),Lt=gt&&bC(be)&&(ce==null?void 0:ce.provider)===(be==null?void 0:be.provider),nt=Ot.some(ke=>ke.status==="queued"||ke.status==="dispatching"),fe=Wz((ce==null?void 0:ce.provider)??null,(ce==null?void 0:ce.runningState)??null,yt)?u("conversation.runtimeThinkingPlaceholder",{provider:u("conversation.providerCodex")}):null,ge=n!=="mobile",Te=TN(!ge),qe=(ce==null?void 0:ce.workspaceId)??(J==null?void 0:J.workspaceId)??null,dt=b.useMemo(()=>new Set(f.map(ke=>ke.session.sessionId)),[f]),St=b.useMemo(()=>i.map(ke=>ke.workspace),[i]),rt=b.useMemo(()=>Mz(i,qe,e),[qe,i,e]),Ut=b.useMemo(()=>CN(i,(ce==null?void 0:ce.workspaceId)??(J==null?void 0:J.workspaceId)??null,dt),[dt,i,J==null?void 0:J.workspaceId,ce==null?void 0:ce.workspaceId]),mt=b.useMemo(()=>jN(f),[f]),Bt=b.useMemo(()=>qe?i.find(ke=>ke.workspace.id===qe)??null:null,[qe,i]);(ce==null?void 0:ce.provider)??(J==null||J.provider);const At=b.useMemo(()=>{var ke;return Ps(((ke=ce??J)==null?void 0:ke.title)??null,u("conversation.titleFallback"))},[J,ce]),vt=b.useMemo(()=>(Bt==null?void 0:Bt.sessions.filter(ke=>ke.isArchived===!0&&ke.isSubagent!==!0))??[],[Bt]),Nt=b.useRef(null),Zt=b.useRef(null),ie=b.useRef(null),[Ie,ct]=b.useState(null),{composerPortalTarget:zt}=zS();return b.useEffect(()=>{B.applyNavigationSession(J)},[J,B]),b.useEffect(()=>(B.initialize(),()=>{B.destroy()}),[B]),b.useEffect(()=>(l(e,(ce==null?void 0:ce.workspaceId)??null),()=>{l(e,null)}),[ce==null?void 0:ce.workspaceId,e,l]),b.useEffect(()=>()=>{Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null)},[]),b.useEffect(()=>{if(!pt||!Mt){Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null),$.current=null,R.current=null,Y("conversation-runtime-error");return}const ke=`${pt}:${Mt}`;if(!(R.current===ke||$.current===ke)){if(Z.current!==null&&(window.clearTimeout(Z.current),Z.current=null),Ez((ce==null?void 0:ce.provider)??null,pt,Mt)){$.current=ke,Z.current=window.setTimeout(()=>{$.current=null,Z.current=null,R.current=ke,W({id:"conversation-runtime-error",title:u("conversation.runtimeErrorTitle"),description:Mt,tone:"error",durationMs:null})},Cz);return}$.current=null,R.current=ke,W({id:"conversation-runtime-error",title:u("conversation.runtimeErrorTitle"),description:Mt,tone:"error",durationMs:null})}},[Y,pt,Mt,ce==null?void 0:ce.provider,W]),b.useEffect(()=>{const ke=F.current,it=(ce==null?void 0:ce.runningState)??null;(ke==="starting"||ke==="running"||ke==="reconnecting")&&it==="completed"&&re.trigger("success"),F.current=it},[re,ce==null?void 0:ce.runningState]),b.useEffect(()=>{const ke=ft.filter(Qt=>Qt.status==="pending"),it=(ce==null?void 0:ce.workspaceId)??(J==null?void 0:J.workspaceId)??null;for(const Qt of ke)we.current.has(Qt.id)||(we.current.add(Qt.id),Q&&(W({id:`permission-request-${Qt.id}`,title:u("conversation.permissionRequestToastTitle"),description:Qt.title,tone:"warning",durationMs:8e3,action:it?{label:u("shell.contextOpenSession"),onClick:()=>{w(Bn(it,e))}}:void 0}),D.bridge.showNotification(u("conversation.permissionRequestToastTitle"),Qt.title)))},[J==null?void 0:J.workspaceId,w,Q,ft,D.bridge,ce==null?void 0:ce.workspaceId,e,W]),NN(Zt,Ie,!ge,e),PN(Zt,ie,!ge,e),r.jsxs(r.Fragment,{children:[r.jsxs("main",{ref:Zt,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!ge,"data-preview-mode":ge?void 0:Te.displayMode,"data-preview-dragging":ge?void 0:Te.isDragging,style:ge?void 0:Te.pageStyle,children:[ge?r.jsx(kN,{session:ce??J,actions:r.jsx(Lx,{session:ce??J})}):null,ge?null:r.jsx(go,{containerRef:ie,className:"mobile-conversation-page-header",gestureHandlers:Te.mainGestureHandlers,currentWorkspace:(Bt==null?void 0:Bt.workspace)??St[0]??null,workspaces:St,heading:At.fullTitle,triggerAriaLabel:Te.displayMode==="preview"?u("shell.hideSessionSidebar"):u("shell.showSessionSidebar"),onTriggerClick:()=>{Te.togglePreview()},trailing:r.jsxs("div",{className:"mobile-conversation-toolbar-main",children:[r.jsx("span",{className:"mobile-conversation-toolbar-title",title:At.fullTitle,children:At.displayTitle}),r.jsx(Lx,{session:ce??J})]})}),ge?null:r.jsx(RN,{visible:Te.isVisible,widthPx:Te.previewWidthPx,isDragging:Te.isDragging,gestureHandlers:Te.railGestureHandlers,activeSessionId:rt,createSessionActionLabel:u("shell.createSession"),favoriteItems:mt,items:Ut,workspaceSectionLabel:u("shell.mobileConversationCurrentWorkspaceSection"),onCreateSession:()=>{G(!0)},archiveCurrentActionLabel:u("shell.archiveCurrentSessionAction"),archiveFolderActionLabel:u("shell.archiveFolderAction"),onArchiveActiveSession:()=>{ee(!0)},onOpenArchiveFolder:()=>{_(!0)},onActivate:ke=>{qi("preview"),w(Bn(ke.workspace.id,ke.session.sessionId))}}),r.jsx("div",{className:"mobile-conversation-stage",...ge?{}:Te.mainGestureHandlers,children:r.jsxs("div",{ref:Nt,className:"mobile-conversation-main",children:[r.jsx(xN,{connectionState:wt,onReconnect:()=>B.reconnect()}),r.jsx(pz,{requests:ft,replyingRequestId:A,onReply:async(ke,it)=>{L(ke);try{await B.replyPermissionRequest(ke,it)}catch(Qt){W({title:u("conversation.permissionRequestReplyFailed"),description:Qt instanceof Error?Qt.message:void 0,tone:"error"})}finally{L(null)}}}),r.jsx(Yp,{sessionId:e,messages:yt,historyState:jt,loadingOlderMessages:xt,hasOlderMessages:Dt,provider:(ce==null?void 0:ce.provider)??null,runtimeThinkingPlaceholder:fe,onLoadOlderMessages:()=>{B.loadOlderMessages()},onRetryMessage:ke=>{B.retryMessage(ke)}}),r.jsx(yz,{items:Ot,deletingQueueItemId:ye,steeringQueueItemId:kt,canSteer:Lt,onDelete:async ke=>{Fe(ke);try{await B.deleteQueuedMessage(ke)}finally{Fe(null)}},onSteer:async ke=>{lt(ke);try{await B.steerQueuedMessage(ke),a()}finally{lt(null)}}}),r.jsx(Tp,{capabilities:be,draftStorageId:e,panelRef:ge?void 0:ct,portalContainer:ge?null:zt,hasActiveRun:Ve,contextUsage:Ke,hasPendingQueuedMessages:nt,canInterrupt:ze,isSubmitting:C,isRunning:gt,onInterrupt:async()=>{await B.interrupt(),a()},onSend:async(ke,it)=>{P(!0);try{await B.sendMessage(ke,{model:it==null?void 0:it.model,reasoningLevel:it==null?void 0:it.reasoningLevel,attachments:it==null?void 0:it.attachments,attachmentMeta:it==null?void 0:it.attachmentMeta}),a()}finally{P(!1)}},onQueueSend:async(ke,it)=>{P(!0);try{await B.enqueueMessage(ke,{model:it==null?void 0:it.model,reasoningLevel:it==null?void 0:it.reasoningLevel,attachments:it==null?void 0:it.attachments,attachmentMeta:it==null?void 0:it.attachmentMeta})}finally{P(!1)}}})]})})]}),r.jsx(Oz,{open:O,busy:I,onClose:()=>{I||ee(!1)},onConfirm:async()=>{if(!I){N(!0);try{if(await p(e),ee(!1),W({title:u("shell.archiveAdded"),tone:"success"}),qe){c(qe),qi("preview"),w(Bl(qe));return}w("/workspaces")}catch(ke){W({title:ke instanceof Error?ke.message:u("shell.navigationLoadFailed"),tone:"error"})}finally{N(!1)}}}}),r.jsx(Bz,{open:q,workspaceName:(Bt==null?void 0:Bt.workspace.name)??null,sessions:vt,restoringSessionId:E,onClose:()=>{E||_(!1)},onRestore:async ke=>{M(ke);try{await y(ke),W({title:u("shell.archiveRestored"),tone:"success"})}catch(it){W({title:it instanceof Error?it.message:u("shell.navigationLoadFailed"),tone:"error"})}finally{M(null)}}}),r.jsx(Vl,{open:z,workspaces:St,initialWorkspaceId:qe,onClose:()=>G(!1),onSelect:(ke,it)=>{G(!1),qi("immersive"),g(ke,it)}})]})}function Ez(e,t,n){return e!=="opencode"?!1:t==="OPENCODE_REQUEST_TIMEOUT"||t==="PROVIDER_RUNTIME_TIMEOUT"||/\bSERVER_TIMEOUT\b/i.test(n)||/timeout/i.test(n)||/超时/.test(n)}function Az({draft:e,navigate:t}){const{shellMode:n,navigationGroups:i,requestNavigationRefresh:a,selectWorkspace:c,setSessionWorkspace:l,upsertNavigationSession:h,favoriteSessions:f,startDraftSession:p}=Yn(),[y,g]=b.useState(!1),[w,x]=b.useState([]),[S,C]=b.useState(!1),P=b.useMemo(()=>tI(e.provider),[e.provider]),[A,L]=b.useState(P),O=n!=="mobile",ee=TN(!O),q=b.useMemo(()=>Lz(e),[e]),_=b.useMemo(()=>new Set(f.map(Q=>Q.session.sessionId)),[f]),E=b.useMemo(()=>i.map(Q=>Q.workspace),[i]),M=b.useMemo(()=>Ps(q.title??null,u("conversation.titleFallback")),[q]),I=b.useMemo(()=>CN(i,e.workspaceId,_),[e.workspaceId,_,i]),N=b.useMemo(()=>jN(f),[f]),z=b.useRef(null),G=b.useRef(null),J=b.useRef(null),[B,W]=b.useState(null),{composerPortalTarget:Y}=zS();return b.useEffect(()=>(l(e.sessionId,e.workspaceId),()=>{l(e.sessionId,null)}),[e.sessionId,e.workspaceId,l]),b.useEffect(()=>{let Q=!1;return L(P),uC(e.provider,e.workspaceId).then(D=>{Q||L(D)}).catch(()=>{}),()=>{Q=!0}},[e.provider,e.workspaceId,P]),NN(G,B,!O,e.sessionId),PN(G,J,!O,e.sessionId),r.jsxs(r.Fragment,{children:[r.jsxs("main",{ref:G,className:"workbench-page conversation-page-shell mobile-page-fixed-root mobile-conversation-page","data-mobile-shell":!O,"data-preview-mode":O?void 0:ee.displayMode,"data-preview-dragging":O?void 0:ee.isDragging,style:O?void 0:ee.pageStyle,children:[O?r.jsx(kN,{session:q}):null,O?null:r.jsx(go,{containerRef:J,className:"mobile-conversation-page-header",gestureHandlers:ee.mainGestureHandlers,currentWorkspace:E.find(Q=>Q.id===e.workspaceId)??E[0]??null,workspaces:E,heading:M.fullTitle,triggerAriaLabel:ee.displayMode==="preview"?u("shell.hideSessionSidebar"):u("shell.showSessionSidebar"),onTriggerClick:()=>{ee.togglePreview()},trailing:r.jsx("span",{className:"mobile-conversation-toolbar-title",title:M.fullTitle,children:M.displayTitle})}),O?null:r.jsx(RN,{visible:ee.isVisible,widthPx:ee.previewWidthPx,isDragging:ee.isDragging,gestureHandlers:ee.railGestureHandlers,activeSessionId:e.sessionId,createSessionActionLabel:u("shell.createSession"),favoriteItems:N,items:I,workspaceSectionLabel:u("shell.mobileConversationCurrentWorkspaceSection"),onCreateSession:()=>{C(!0)},onActivate:Q=>{qi("preview"),t(Bn(Q.workspace.id,Q.session.sessionId))}}),r.jsx("div",{className:"mobile-conversation-stage",...O?{}:ee.mainGestureHandlers,children:r.jsxs("div",{ref:z,className:"mobile-conversation-main",children:[r.jsx(xN,{connectionState:"closed",onReconnect:()=>{}}),r.jsx(Yp,{sessionId:e.sessionId,messages:w,historyState:"ready",loadingOlderMessages:!1,hasOlderMessages:!1,provider:e.provider,runtimeThinkingPlaceholder:null,onLoadOlderMessages:()=>{},onRetryMessage:()=>{}}),r.jsx(Tp,{capabilities:A,draftStorageId:e.sessionId,panelRef:O?void 0:W,portalContainer:O?null:Y,contextUsage:null,isSubmitting:y,isRunning:!1,onSend:async(Q,D)=>{var $,Z,F,we;const re=$z();x(ce=>[...ce,sN(e.sessionId,Q,re,(D==null?void 0:D.attachmentMeta)??[],(D==null?void 0:D.attachments)??[])]),g(!0);const R=performance.now();_t("session_send.start_live.client_start",{draftSessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,clientRequestId:re,contentLength:Q.length});try{const ce=ui.getState().profile.defaultPermissionMode,be=await DA({workspaceId:e.workspaceId,provider:e.provider,content:Q,clientRequestId:re,model:(D==null?void 0:D.model)??null,reasoningLevel:(D==null?void 0:D.reasoningLevel)??null,permissionMode:ce==="default"?null:ce,attachments:(D==null?void 0:D.attachments)??[]});_t("session_send.start_live.client_response",{draftSessionId:e.sessionId,sessionId:be.sessionId,workspaceId:(($=be.session)==null?void 0:$.workspaceId)??e.workspaceId,provider:be.provider,clientRequestId:re,durationMs:Math.round(performance.now()-R),returnedMessageId:((Z=be.message)==null?void 0:Z.messageId)??null}),be.session&&h(be.session);const Ve=((we=(F=be.session)==null?void 0:F.workspaceId)==null?void 0:we.trim())||e.workspaceId;l(be.sessionId,Ve),qi("preview"),t(Bn(Ve,be.sessionId),{replace:!0,state:be.message?{bootstrap:{sessionId:be.sessionId,messages:[be.message]}}:null}),a()}catch(ce){throw _t("session_send.start_live.client_error",{draftSessionId:e.sessionId,workspaceId:e.workspaceId,provider:e.provider,clientRequestId:re,durationMs:Math.round(performance.now()-R),error:ce instanceof Error?ce.message:String(ce)}),x(be=>_m(be,re)),ce}finally{g(!1)}}})]})})]}),r.jsx(Vl,{open:S,workspaces:E,initialWorkspaceId:e.workspaceId,onClose:()=>C(!1),onSelect:(Q,D)=>{C(!1),qi("immersive"),p(Q,D)}})]})}function Iz(e,t,n,i=null){var l,h;if(!zz(e))return null;const a=t??((l=n.get("workspaceId"))==null?void 0:l.trim())??null,c=((h=n.get("provider"))==null?void 0:h.trim())??i??null;return!a||!mC(c)?null:{sessionId:e,workspaceId:a,provider:c}}function Lz(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:eI(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 CN(e,t,n){if(!t)return[];const i=e.find(a=>a.workspace.id===t);return i?ip([i]).filter(a=>!a.session.isArchived&&a.session.isSubagent!==!0&&!n.has(a.session.sessionId)).map(a=>({entry:a,depth:0})):[]}function jN(e){return e.filter(t=>t.session.isSubagent!==!0).map(t=>({entry:t,depth:0}))}function Mz(e,t,n){var h;if(!t)return n;const i=e.find(f=>f.workspace.id===t);if(!i)return n;const a=new Map(i.sessions.map(f=>[f.sessionId,f]));let c=a.get(n);if(!c)return n;const l=new Set([c.sessionId]);for(;;){const f=((h=c.parentSessionId)==null?void 0:h.trim())||null;if(!f)return c.sessionId;const p=a.get(f);if(!p||l.has(p.sessionId))return c.sessionId;l.add(p.sessionId),c=p}}function NN(e,t,n,i){b.useEffect(()=>{const a=e.current;if(!n||!a){a&&a.style.removeProperty("--mobile-conversation-composer-height");return}if(!t){a.style.removeProperty("--mobile-conversation-composer-height");return}const c=a,l=t;function h(){!e.current||!l.isConnected||c.style.setProperty("--mobile-conversation-composer-height",`${l.offsetHeight}px`)}h();const f=typeof ResizeObserver<"u"?new ResizeObserver(h):null;return f==null||f.observe(l),window.addEventListener("resize",h),()=>{f==null||f.disconnect(),window.removeEventListener("resize",h),a.style.removeProperty("--mobile-conversation-composer-height")}},[t,n,i,e])}function PN(e,t,n,i){b.useEffect(()=>{const a=e.current,c=t.current;if(!n||!a){a&&a.style.removeProperty("--mobile-conversation-page-header-height");return}if(!c){a.style.removeProperty("--mobile-conversation-page-header-height");return}const l=a,h=c;function f(){!e.current||!h.isConnected||l.style.setProperty("--mobile-conversation-page-header-height",`${h.offsetHeight}px`)}f();const p=typeof ResizeObserver<"u"?new ResizeObserver(f):null;return p==null||p.observe(h),window.addEventListener("resize",f),()=>{p==null||p.disconnect(),window.removeEventListener("resize",f),a.style.removeProperty("--mobile-conversation-page-header-height")}},[n,t,i,e])}function TN(e){const t=Yr(),[n,i]=b.useState(()=>e?Wf():"immersive"),[a,c]=b.useState(()=>Ox()),[l,h]=b.useState(()=>e&&Wf()==="preview"?"default":"closed"),f=b.useRef(l),p=b.useRef(null);b.useEffect(()=>{f.current=l},[l]),b.useEffect(()=>{if(!e){p.current=null,f.current="closed",h("closed"),i("immersive");return}const M=Wf();i(M),h(M==="preview"?"default":"closed")},[e]),b.useEffect(()=>{e&&qi(n)},[e,n]),b.useEffect(()=>{if(typeof window>"u")return;function M(){c(Ox())}return M(),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M)}},[]);function y(M){f.current=M,h(M)}function g(M="default"){y(M),i("preview")}function w(){y("closed"),i("immersive")}function x(){y("expanded"),i("preview")}function S(){if(f.current!=="closed"){t.trigger("gesture"),w();return}t.trigger("gesture"),g()}function C(M,I){if(!e||I.touches.length!==1){p.current=null;return}if(Dz(I.target)){p.current=null;return}const N=I.touches[0];if(!N){p.current=null;return}if(M==="main"){if(f.current==="closed"&&N.clientX>Pz){p.current=null;return}}else if(f.current==="closed"){p.current=null;return}p.current={source:M,intent:M==="rail"?"rail":f.current==="closed"?"open":"close",startX:N.clientX,startY:N.clientY,lastX:N.clientX,lastY:N.clientY,horizontalLocked:!1}}function P(M){const I=p.current,N=M.touches[0];if(!e||!I||!N)return;const z=N.clientX-I.startX,G=N.clientY-I.startY;if(I.lastX=N.clientX,I.lastY=N.clientY,!I.horizontalLocked){if(Math.abs(z)<Fx&&Math.abs(G)<Fx)return;if(Math.abs(z)<=Math.abs(G)){p.current=null;return}if(I.intent==="open"&&z<=0){p.current=null;return}if(I.intent==="close"&&z>=0){p.current=null;return}I.horizontalLocked=!0}}function A(M){var G;const I=p.current;if(p.current=null,!(I!=null&&I.horizontalLocked))return;const N=(G=M==null?void 0:M.changedTouches)==null?void 0:G[0];N&&(I.lastX=N.clientX,I.lastY=N.clientY);const z=I.lastX-I.startX;if(I.intent==="open"){z>=jz&&(t.trigger("gesture"),g("default"));return}if(I.intent==="close"){z<=-34&&(t.trigger("gesture"),w());return}if(z<=-34){t.trigger("gesture"),w();return}z>=Nz&&f.current==="default"&&(t.trigger("gesture"),x())}const L=l==="expanded"?zf:l==="default"?Dx:0,O=Math.round(a*L*100)/100,ee=L===0?0:L/zf,q={"--mobile-conversation-preview-default-width":`${Math.round(a*Dx*100)/100}px`,"--mobile-conversation-preview-max-width":`${Math.round(a*zf*100)/100}px`,"--mobile-conversation-preview-width":`${O}px`,"--mobile-conversation-preview-progress":ee.toFixed(4)};return{closePreview:w,displayMode:l==="closed"?"immersive":"preview",isDragging:!1,isVisible:l!=="closed",mainGestureHandlers:{onTouchStart:M=>C("main",M),onTouchMove:P,onTouchEnd:A,onTouchCancel:A},pageStyle:q,previewWidthPx:O,railGestureHandlers:{onTouchStart:M=>C("rail",M),onTouchMove:P,onTouchEnd:A,onTouchCancel:A},togglePreview:S}}function RN({visible:e,widthPx:t,isDragging:n,gestureHandlers:i,activeSessionId:a,createSessionActionLabel:c,favoriteItems:l,items:h,workspaceSectionLabel:f,onCreateSession:p,archiveCurrentActionLabel:y,archiveFolderActionLabel:g,onArchiveActiveSession:w,onOpenArchiveFolder:x,onActivate:S}){return e?r.jsxs("aside",{className:"mobile-conversation-preview-rail terminal-mobile-list-rail surface-card","data-dragging":n,style:{width:`${t}px`,maxWidth:`${t}px`},...i,children:[c&&p?r.jsx("div",{className:"mobile-conversation-preview-topbar terminal-mobile-list-footer",children:r.jsxs("button",{type:"button",className:"mobile-conversation-preview-create-button workbench-import-toggle terminal-mobile-list-create",onClick:p,children:[r.jsx("span",{className:"workbench-import-toggle-symbol","aria-hidden":"true",children:"+"}),r.jsx("span",{className:"workbench-import-toggle-label",children:c})]})}):null,r.jsxs("div",{className:"mobile-conversation-preview-body terminal-mobile-list-body",children:[l.length>0?r.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-list-favorites terminal-mobile-list-group terminal-mobile-list-group-pinned",children:[r.jsxs("div",{className:"mobile-conversation-preview-group-heading terminal-mobile-list-group-heading",children:[r.jsx("span",{children:u("shell.favoriteSectionTitle")}),r.jsx("span",{className:"workbench-section-counter",children:l.length})]}),r.jsx("div",{className:"mobile-conversation-preview-list mobile-conversation-preview-list-static terminal-mobile-session-list",children:l.map(C=>r.jsx(_x,{entry:C.entry,depth:C.depth,activeSessionId:a,onActivate:S,workspaceName:C.entry.workspace.name},`favorite:${C.entry.workspace.id}:${C.entry.session.sessionId}`))})]}):null,r.jsxs("section",{className:"mobile-conversation-preview-group mobile-conversation-preview-group-workspace terminal-mobile-list-group terminal-mobile-list-group-workspace",children:[r.jsxs("div",{className:"mobile-conversation-preview-group-heading terminal-mobile-list-group-heading",children:[r.jsx("span",{children:f}),r.jsx("span",{className:"workbench-section-counter",children:h.length})]}),h.length===0?r.jsx("div",{className:"workbench-session-empty",children:u("shell.emptyWorkspaceSessions")}):r.jsx("div",{className:"mobile-conversation-preview-list terminal-mobile-session-list","data-preview-gesture":"ignore",children:h.map(C=>r.jsx(_x,{entry:C.entry,depth:C.depth,activeSessionId:a,onActivate:S},`${C.entry.workspace.id}:${C.entry.session.sessionId}`))})]})]}),y&&w||g&&x?r.jsxs("div",{className:"mobile-conversation-preview-actions terminal-mobile-list-footer",children:[y&&w?r.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button workbench-import-toggle",onClick:()=>{w()},children:y}):null,g&&x?r.jsx("button",{type:"button",className:"mobile-conversation-preview-archive-button workbench-import-toggle",onClick:x,children:g}):null]}):null]}):null}function _x({entry:e,depth:t,activeSessionId:n,onActivate:i,workspaceName:a}){const c=e.session.sessionId===n;return r.jsx("article",{className:"mobile-conversation-preview-entry terminal-mobile-session-card","data-active":c,children:r.jsxs("button",{type:"button",className:"mobile-conversation-preview-item terminal-mobile-session-primary","data-active":c,"data-depth":t,onClick:()=>i(e),children:[r.jsx("span",{className:Fz(e.session,c),"aria-hidden":"true"}),r.jsxs("div",{className:"mobile-conversation-preview-item-body",children:[r.jsx("span",{className:"mobile-conversation-preview-item-title",children:e.session.title||u("common.unknown")}),r.jsx("span",{className:"mobile-conversation-preview-item-meta",children:EN(e.session,a)})]})]})})}function Ox(){return typeof window>"u"?390:Math.max(window.innerWidth||390,320)}function Dz(e){return e instanceof Element?!!e.closest("input, textarea, select, option, label, [contenteditable='true'], [data-preview-gesture='ignore']"):!1}function Fz(e,t){const n=jp("mobile-conversation-preview-indicator",e);return n.endsWith(" is-idle")&&t?"mobile-conversation-preview-indicator is-active":n}function EN(e,t){const n=Hu(e);return[t??null,$i(e.provider),_z(e.lastMessageAt??e.updatedAt),n].filter(Boolean).join(" · ")}function _z(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):u("common.unknown")}function Oz({open:e,busy:t,onClose:n,onConfirm:i}){return b.useEffect(()=>{if(!e)return;function a(c){c.key==="Escape"&&!t&&n()}return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[t,n,e]),!e||typeof document>"u"?null:Qn.createPortal(r.jsxs("div",{className:"workbench-modal-layer",children:[r.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":u("common.close"),disabled:t,onClick:n}),r.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":u("shell.archiveConfirmTitle"),children:[r.jsx("div",{className:"workbench-modal-header",children:r.jsxs("div",{className:"workbench-modal-title-wrap",children:[r.jsx("h2",{children:u("shell.archiveConfirmTitle")}),r.jsx("p",{children:u("shell.archiveConfirmDescription")})]})}),r.jsx("div",{className:"workbench-modal-body",children:r.jsxs("div",{className:"workbench-modal-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:n,children:u("common.cancel")}),r.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:t,onClick:()=>{i()},children:u("shell.archiveAction")})]})})]})]}),document.body)}function Bz({open:e,workspaceName:t,sessions:n,restoringSessionId:i,onClose:a,onRestore:c}){return b.useEffect(()=>{if(!e)return;function l(h){h.key==="Escape"&&!i&&a()}return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[a,e,i]),!e||typeof document>"u"?null:Qn.createPortal(r.jsxs("div",{className:"workbench-modal-layer",children:[r.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":u("common.close"),disabled:!!i,onClick:a}),r.jsxs("section",{className:"workbench-modal-card surface-card",role:"dialog","aria-modal":"true","aria-label":u("shell.archiveModalTitle"),children:[r.jsx("div",{className:"workbench-modal-header",children:r.jsxs("div",{className:"workbench-modal-title-wrap",children:[r.jsx("h2",{children:u("shell.archiveModalTitle")}),r.jsx("p",{children:t?`${t} · ${u("shell.archiveModalDescription")}`:u("shell.archiveModalDescription")})]})}),r.jsx("div",{className:"workbench-modal-body",children:n.length>0?r.jsx("div",{className:"workbench-archive-list",children:n.map(l=>{const h=Ps(l.title,u("common.unknown"));return r.jsxs("article",{className:"workbench-archive-item",children:[r.jsxs("div",{className:"workbench-archive-item-main",children:[r.jsx("strong",{title:h.fullTitle,children:h.displayTitle}),r.jsx("p",{children:EN(l)})]}),r.jsx("button",{type:"button",className:"secondary-button",disabled:i===l.sessionId,onClick:()=>{c(l.sessionId)},children:u("shell.unarchiveAction")})]},l.sessionId)})}):r.jsx("p",{className:"workbench-section-empty",children:u("shell.archiveEmpty")})})]})]}),document.body)}function Uz(e){return e?e.activityState==="running"?!0:e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting":!1}function Wz(e,t,n){if(e!=="codex"||t!=="starting"&&t!=="running")return!1;let i=-1;for(let a=n.length-1;a>=0;a-=1){const c=n[a];if(c.role==="user"&&c.kind==="text"){i=a;break}}return i<0?!1:!n.slice(i+1).some(a=>a.role==="assistant"&&(a.kind==="text"||a.kind==="thinking"))}function zz(e){return e.startsWith("draft-")}function Hz(e,t){if(!t||typeof t!="object")return[];const n=t.bootstrap;if(!n||typeof n!="object")return[];const i=n.sessionId,a=n.messages;return i!==e||!Array.isArray(a)?[]:a.filter(qz)}function qz(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 $z(){const e=globalThis.crypto;return e&&typeof e.randomUUID=="function"?e.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`}function Vz(){return b.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}},[]),r.jsx("main",{className:"desktop-detach-preview-page","aria-hidden":"true",children:r.jsxs("section",{className:"desktop-detach-preview-card",children:[r.jsx("header",{className:"desktop-detach-preview-bar",children:r.jsx("strong",{className:"desktop-detach-preview-title",children:"小窗口"})}),r.jsx("div",{className:"desktop-detach-preview-body",children:r.jsx("span",{className:"desktop-detach-preview-badge"})})]})})}function AN(e){return De.request(`/api/git/status?workspaceId=${encodeURIComponent(e)}`)}function IN(e,t,n){const i=new URLSearchParams({workspaceId:e,path:t,staged:String(n)});return De.request(`/api/git/diff?${i.toString()}`)}function LN(e,t){return De.request("/api/git/stage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function Gz(e,t){return De.request("/api/git/unstage",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function Kz(e,t){return De.request("/api/git/discard",{method:"POST",body:JSON.stringify({workspaceId:e,targets:t})})}function Qz(e,t){return De.request("/api/git/commit/draft",{method:"POST",body:JSON.stringify({workspaceId:e,mode:t})})}function Yz(e,t){return De.request("/api/git/commit",{method:"POST",body:JSON.stringify({workspaceId:e,draft:t})})}function Xz(e){return De.request("/api/git/commit/undo",{method:"POST",body:JSON.stringify({workspaceId:e})})}function Bx(e,t=5,n=null){const i=new URLSearchParams({workspaceId:e,limit:String(t)});return n&&i.set("cursor",n),De.request(`/api/git/history?${i.toString()}`)}function Jz(e){return De.request(`/api/git/branches?workspaceId=${encodeURIComponent(e)}`)}function Zz(e,t,n){return De.request("/api/git/branches/switch",{method:"POST",body:JSON.stringify({workspaceId:e,branchName:t,create:n})})}function Ux(e,t,n){return De.request("/api/git/remote/sync",{method:"POST",body:JSON.stringify({workspaceId:e,action:t,...n?{remote:n}:{}})})}function e4(e){return De.request(`/api/git/remotes?workspaceId=${encodeURIComponent(e)}`)}const t4=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"]),n4=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"]),r4=new Set(["case","do","done","elif","else","esac","export","fi","for","function","if","in","local","readonly","return","then","until","while"]),i4=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"]),s4=new Set(["add","arg","cmd","copy","entrypoint","env","expose","from","healthcheck","label","maintainer","onbuild","run","shell","stopsignal","user","volume","workdir","as"]),o4=new Set(["trace","debug","info","warn","warning","error","fatal"]);function MN({workspaceId:e,filePath:t,open:n,onClose:i,onSaved:a,diffContent:c}){const[l,h]=b.useState(null),[f,p]=b.useState(""),[y,g]=b.useState(!1),[w,x]=b.useState(!1),[S,C]=b.useState("preview"),{showToast:P}=En(),A=b.useRef(i),L=b.useRef(P),O=b.useMemo(()=>_N(t),[t]),ee=b.useMemo(()=>N4(c),[c]),q=O==="markdown",_=!!(l!=null&&l.supported&&l.kind==="text");if(b.useEffect(()=>{A.current=i},[i]),b.useEffect(()=>{L.current=P},[P]),b.useEffect(()=>{if(!n){h(null),p(""),g(!1),x(!1),C("preview");return}if(!e||!t)return;const G=e,J=t;let B=!1;async function W(){g(!0);try{const Y=await kv(G,J);B||(h(Y),p(Y.content??""),C((S4(J),"preview")))}catch(Y){B||(L.current({title:Wx(Y,u("conversation.filePanelOpenFailed")),tone:"error"}),A.current())}finally{B||g(!1)}}return W(),()=>{B=!0}},[t,n,e]),b.useEffect(()=>{if(!n)return;function G(J){J.key==="Escape"&&i()}return window.addEventListener("keydown",G),()=>{window.removeEventListener("keydown",G)}},[i,n]),!n||!t||typeof document>"u")return null;const E=t,M=e;async function I(){if(!(!M||!(l!=null&&l.version)||!_)){x(!0);try{await lI(M,E,f,l.version);const G=await kv(M,E);h(G),p(G.content??""),await a(E),P({title:u("conversation.filePanelSaveSuccess"),tone:"success"}),C("preview")}catch(G){P({title:Wx(G,u("conversation.filePanelSaveFailed")),tone:"error"})}finally{x(!1)}}}const N=(l==null?void 0:l.content)??"",z=_&&f!==N;return Qn.createPortal(r.jsxs("div",{className:"workbench-modal-layer",children:[r.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":u("common.close"),onClick:i}),r.jsxs("section",{className:"workbench-modal-card surface-card file-viewer-modal",role:"dialog","aria-modal":"true","aria-label":t,children:[r.jsxs("div",{className:"workbench-modal-header",children:[r.jsxs("div",{className:"workbench-modal-title-wrap",children:[r.jsx("h2",{children:t}),r.jsx("p",{children:u("conversation.fileViewerHint").replace("{language}",Wm(O))})]}),r.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":u("common.close"),onClick:i,children:r.jsx(C4,{})})]}),r.jsxs("div",{className:"file-viewer-toolbar",children:[r.jsxs("div",{className:"file-viewer-tabs",role:"tablist","aria-label":u("conversation.fileViewerModeLabel"),children:[r.jsx("button",{type:"button",className:"file-viewer-tab","data-active":S==="preview",role:"tab","aria-selected":S==="preview",onClick:()=>C("preview"),children:u(q?"conversation.fileViewerPreview":"conversation.fileViewerCode")}),r.jsx("button",{type:"button",className:"file-viewer-tab","data-active":S==="edit",role:"tab","aria-selected":S==="edit",onClick:()=>C("edit"),disabled:!_,children:u("conversation.fileViewerEdit")})]}),r.jsxs("div",{className:"file-viewer-actions",children:[r.jsx("span",{className:"file-viewer-language",children:Wm(O)}),r.jsx("button",{type:"button",className:"primary-button",onClick:()=>void I(),disabled:!z||w,children:u(w?"conversation.filePanelSaving":"conversation.filePanelSave")})]})]}),r.jsx("div",{className:"workbench-modal-body file-viewer-body",children:y?r.jsx("p",{className:"status-text",children:u("common.loading")}):(l==null?void 0:l.supported)===!1?r.jsx("p",{className:"status-text",children:l.reason??u("conversation.filePanelUnsupported")}):S==="edit"?r.jsx("textarea",{className:"file-viewer-editor","data-testid":"file-viewer-editor",value:f,onChange:G=>p(G.target.value),spellCheck:!1}):q?r.jsx(a4,{content:f}):r.jsx(DN,{content:f,language:O,overviewMarkers:ee})})]})]}),document.body)}function a4({content:e}){return r.jsx("div",{className:"markdown-content file-viewer-markdown",children:r.jsx(qp,{remarkPlugins:[Kp],components:{code(t){const n=typeof t.className=="string"?t.className:"",i=/language-([\w-]+)/.exec(n);return i?r.jsx(DN,{content:String(t.children).replace(/\n$/,""),language:ng(i[1]??"plain")}):r.jsx("code",{className:n||void 0,children:t.children})}},children:e})})}function DN({content:e,language:t,overviewMarkers:n=[]}){const i=e.split(/\r?\n/),a=b.useRef(null),c=b.useMemo(()=>{const l=new Map;for(const h of n)for(let f=0;f<h.span;f++)l.set(h.line+f,h.kind);return l},[n]);return r.jsxs("div",{className:"file-viewer-code-block",children:[r.jsx("div",{className:"file-viewer-code-header",children:Wm(t)}),r.jsxs("div",{className:"file-viewer-scroll-shell",children:[r.jsx("div",{className:"file-viewer-code-body",ref:a,children:i.map((l,h)=>{const f=l4(l,t),p=h+1,y=c.get(p);return r.jsxs("div",{className:`file-viewer-code-line${y?` diff-line-${y}`:""}`,children:[r.jsx("span",{className:"file-viewer-code-gutter",children:p}),r.jsx("code",{className:"file-viewer-code-content",children:f.length?f.map((g,w)=>r.jsx("span",{className:`code-token ${g.kind}`,children:g.text},`${h}-${w}-${g.text}`)):r.jsx("span",{className:"code-token plain",children:" "})})]},`${h}-${l}`)})}),r.jsx(T4,{markers:n,totalLines:i.length,scrollContainerRef:a})]})]})}function l4(e,t){const n=ng(t);return n==="json"?c4(e):n==="yaml"?f4(e):n==="toml"?m4(e):n==="ini"?FN(e):n==="env"?p4(e):n==="properties"?g4(e):n==="conf"?b4(e):n==="editorconfig"?y4(e):n==="dockerfile"?v4(e):n==="gitignore"?w4(e):n==="log"?x4(e):n==="python"?yl(e,n4,"#"):n==="shell"?yl(e,r4,"#"):n==="sql"?h4(e):n==="html"||n==="xml"?u4(e):n==="css"?d4(e):n==="markdown"?[{text:e,kind:"plain"}]:yl(e,t4,"//")}function yl(e,t,n){const i=[];let a=0;for(;a<e.length;){const c=e.slice(a);if(c.startsWith(n)){i.push({text:c,kind:"comment"});break}const l=/^(?:'[^'\\]*(?:\\.[^'\\]*)*'|"[^"\\]*(?:\\.[^"\\]*)*"|`[^`\\]*(?:\\.[^`\\]*)*`)/.exec(c);if(l){i.push({text:l[0],kind:"string"}),a+=l[0].length;continue}const h=/^(?:0x[\da-fA-F]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/.exec(c);if(h){i.push({text:h[0],kind:"number"}),a+=h[0].length;continue}const f=/^[A-Za-z_][\w$-]*/.exec(c);if(f){const y=f[0],g=y.toLowerCase();y==="true"||y==="false"||g==="true"||g==="false"?i.push({text:y,kind:"boolean"}):y==="null"||y==="None"||g==="none"?i.push({text:y,kind:"null"}):t.has(y)||t.has(g)?i.push({text:y,kind:"keyword"}):i.push({text:y,kind:"plain"}),a+=y.length;continue}const p=/^(?:===|!==|==|!=|<=|>=|=>|&&|\|\||[+\-*/%=<>!?:|&^~]+)/.exec(c);if(p){i.push({text:p[0],kind:"operator"}),a+=p[0].length;continue}i.push({text:c[0]??"",kind:"plain"}),a+=1}return i}function c4(e){const t=[];let n=0;for(;n<e.length;){const i=e.slice(n),a=/^"(?:[^"\\]|\\.)*"/.exec(i);if(a){const f=e.slice(n+a[0].length).trimStart()[0];t.push({text:a[0],kind:f===":"?"attr":"string"}),n+=a[0].length;continue}const c=/^(?:-?\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i.exec(i);if(c){t.push({text:c[0],kind:"number"}),n+=c[0].length;continue}const l=/^(?:true|false|null)\b/.exec(i);if(l){const f=l[0]==="null"?"null":"boolean";t.push({text:l[0],kind:f}),n+=l[0].length;continue}const h=/^(?::|,|\{|\}|\[|\])/.exec(i);if(h){t.push({text:h[0],kind:"operator"}),n+=h[0].length;continue}t.push({text:i[0]??"",kind:"plain"}),n+=1}return t}function u4(e){const t=[];let n=0;for(;n<e.length;){const i=e.slice(n);if(i.startsWith("<!--")){t.push({text:i,kind:"comment"});break}const a=/^(<\/?[\w:-]+)/.exec(i);if(a){t.push({text:a[0],kind:"tag"}),n+=a[0].length;continue}const c=/^([\w:-]+)(=)/.exec(i);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),n+=c[0].length;continue}const l=/^(?:'[^']*'|"[^"]*")/.exec(i);if(l){t.push({text:l[0],kind:"string"}),n+=l[0].length;continue}const h=/^(?:\/?>)/.exec(i);if(h){t.push({text:h[0],kind:"operator"}),n+=h[0].length;continue}t.push({text:i[0]??"",kind:"plain"}),n+=1}return t}function d4(e){const t=[];let n=0;for(;n<e.length;){const i=e.slice(n);if(i.startsWith("/*")){t.push({text:i,kind:"comment"});break}const a=/^(?:'[^']*'|"[^"]*")/.exec(i);if(a){t.push({text:a[0],kind:"string"}),n+=a[0].length;continue}const c=/^([A-Za-z-]+)(\s*:)/.exec(i);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),n+=c[0].length;continue}const l=/^(?:#(?:[\da-fA-F]{3,8})|\d+(?:\.\d+)?(?:px|rem|em|vh|vw|%)?)/.exec(i);if(l){t.push({text:l[0],kind:"number"}),n+=l[0].length;continue}const h=/^(?:@media|@supports|@import|@keyframes)\b/.exec(i);if(h){t.push({text:h[0],kind:"keyword"}),n+=h[0].length;continue}const f=/^(?:[{}:;(),.>])/.exec(i);if(f){t.push({text:f[0],kind:"operator"}),n+=f[0].length;continue}t.push({text:i[0]??"",kind:"plain"}),n+=1}return t}function h4(e){return yl(e,i4,"--")}function f4(e){const t=[];let n=0;for(;n<e.length;){const i=e.slice(n);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"}),n+=a[0].length;continue}const c=/^(?:'[^']*'|"[^"]*")/.exec(i);if(c){t.push({text:c[0],kind:"string"}),n+=c[0].length;continue}const l=/^(?:-?\d+(?:\.\d+)?)/.exec(i);if(l){t.push({text:l[0],kind:"number"}),n+=l[0].length;continue}const h=/^(?:true|false|yes|no|null|~)\b/i.exec(i);if(h){const p=h[0].toLowerCase(),y=p==="null"||p==="~"?"null":"boolean";t.push({text:h[0],kind:y}),n+=h[0].length;continue}const f=/^(?:[-?:,[\]{}|>])/.exec(i);if(f){t.push({text:f[0],kind:"operator"}),n+=f[0].length;continue}t.push({text:i[0]??"",kind:"plain"}),n+=1}return t}function m4(e){const t=[];let n=0;for(;n<e.length;){const i=e.slice(n);if(i.startsWith("#")){t.push({text:i,kind:"comment"});break}const a=/^(\[\[?[^\]]+\]?\])/.exec(i);if(a){t.push({text:a[0],kind:"tag"}),n+=a[0].length;continue}const c=/^([A-Za-z0-9_.-]+)(\s*=)/.exec(i);if(c){t.push({text:c[1]??"",kind:"attr"}),t.push({text:c[2]??"",kind:"operator"}),n+=c[0].length;continue}const l=bd(i,{trueValues:["true"],falseValues:["false"],nullValues:[]});if(l){t.push(...l.tokens),n+=l.length;continue}const h=/^(?:[,[\]{}])/.exec(i);if(h){t.push({text:h[0],kind:"operator"}),n+=h[0].length;continue}t.push({text:i[0]??"",kind:"plain"}),n+=1}return t}function FN(e){const t=[];let n=0;for(;n<e.length;){const i=e.slice(n),a=i.trimStart();if(a.startsWith(";")||a.startsWith("#")){t.push({text:i,kind:"comment"});break}const c=/^(\[[^\]]+\])/.exec(i);if(c){t.push({text:c[0],kind:"tag"}),n+=c[0].length;continue}const l=/^([A-Za-z0-9_.-]+)(\s*[=:])/.exec(i);if(l){t.push({text:l[1]??"",kind:"attr"}),t.push({text:l[2]??"",kind:"operator"}),n+=l[0].length;continue}const h=bd(i,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(h){t.push(...h.tokens),n+=h.length;continue}t.push({text:i[0]??"",kind:"plain"}),n+=1}return t}function p4(e){if(e.trimStart().startsWith("#"))return[{text:e,kind:"comment"}];const n=/^(\s*)(export)(\s+)/.exec(e),i=n?n[0].length:0,a=[];n&&(a.push({text:n[1]??"",kind:"plain"}),a.push({text:n[2]??"",kind:"keyword"}),a.push({text:n[3]??"",kind:"plain"}));const c=e.slice(i),l=/^([A-Za-z_][A-Za-z0-9_]*)(=)/.exec(c);if(!l)return FN(e);a.push({text:l[1]??"",kind:"attr"}),a.push({text:l[2]??"",kind:"operator"});const h=c.slice(l[0].length),f=bd(h,{trueValues:["true"],falseValues:["false"],nullValues:["null"]});return f?(a.push(...f.tokens),a):(a.push({text:h,kind:"plain"}),a)}function g4(e){return tg(e,{commentPrefixes:["#","!"],allowSection:!1,delimiters:["=",":"]})}function b4(e){return tg(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["=",":"]})}function y4(e){return tg(e,{commentPrefixes:["#",";"],allowSection:!0,delimiters:["="]})}function v4(e){return yl(e,s4,"#")}function w4(e){const t=e.trimStart();if(!t)return[];if(t.startsWith("#"))return[{text:e,kind:"comment"}];if(t.startsWith("!")){const n=e.length-t.length,i=e.slice(0,n),a=t.slice(1);return[{text:i,kind:"plain"},{text:"!",kind:"operator"},{text:a,kind:"string"}]}return[{text:e,kind:"string"}]}function x4(e){const t=[];let n=0;for(;n<e.length;){const i=e.slice(n);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"}),n+=a[0].length;continue}const c=/^(?:\[(TRACE|DEBUG|INFO|WARN|WARNING|ERROR|FATAL)\])/.exec(i);if(c){t.push({text:i.slice(0,c[0].length),kind:"keyword"}),n+=c[0].length;continue}const l=/^[A-Za-z_][\w-]*/.exec(i);if(l){const f=l[0];o4.has(f.toLowerCase())?t.push({text:f,kind:"keyword"}):t.push({text:f,kind:"plain"}),n+=f.length;continue}const h=/^(?:\d+(?:\.\d+)?)/.exec(i);if(h){t.push({text:h[0],kind:"number"}),n+=h[0].length;continue}t.push({text:i[0]??"",kind:"plain"}),n+=1}return t}function tg(e,t){const n=e.trimStart();if(t.commentPrefixes.some(f=>n.startsWith(f)))return[{text:e,kind:"comment"}];if(t.allowSection){const f=/^(\[[^\]]+\])/.exec(e);if(f)return[{text:f[0],kind:"tag"}]}const i=/^([A-Za-z0-9_.\-*?]+)(\s*(?:=|:))/.exec(e);if(!i)return[{text:e,kind:"plain"}];const a=(i[2]??"").trim();if(!t.delimiters.includes(a))return[{text:e,kind:"plain"}];const c=[{text:i[1]??"",kind:"attr"},{text:i[2]??"",kind:"operator"}],l=e.slice(i[0].length),h=k4(l);return h.length&&c.push(...h),c}function k4(e){if(!e)return[];const t=[];let n=0;for(;n<e.length;){const i=e.slice(n),a=bd(i,{trueValues:["true","yes","on"],falseValues:["false","no","off"],nullValues:["null"]});if(a){t.push(...a.tokens),n+=a.length;continue}if(i.startsWith("#")||i.startsWith(";")){t.push({text:i,kind:"comment"});break}t.push({text:i[0]??"",kind:"plain"}),n+=1}return t}function bd(e,t){const n=/^(?:'[^']*'|"[^"]*")/.exec(e);if(n)return{tokens:[{text:n[0],kind:"string"}],length:n[0].length};const i=/^(?:-?\d+(?:\.\d+)?)/.exec(e);if(i)return{tokens:[{text:i[0],kind:"number"}],length:i[0].length};const a=/^[A-Za-z0-9_.:+/-]+/.exec(e);if(!a)return null;const c=a[0],l=c.toLowerCase();return t.trueValues.includes(l)?{tokens:[{text:c,kind:"boolean"}],length:c.length}:t.falseValues.includes(l)?{tokens:[{text:c,kind:"boolean"}],length:c.length}:t.nullValues.includes(l)?{tokens:[{text:c,kind:"null"}],length:c.length}:{tokens:[{text:c,kind:"plain"}],length:c.length}}function _N(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 ng(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 Wm(e){switch(ng(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 u("conversation.fileViewerPlainText")}}function S4(e){return _N(e)==="markdown"}function Wx(e,t){return e instanceof mr?e.message:t}function C4(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.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 j4(e){const t=[],n=e.replace(/\r\n/g,`
107
+ `).split(`
108
+ `);let i=0,a=0;for(const c of n){if(c.startsWith("diff --git")||c.startsWith("index ")||c.startsWith("--- ")||c.startsWith("+++ ")){t.push({kind:"meta",text:c,oldLineNo:null,newLineNo:null});continue}const l=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(c);if(l){i=parseInt(l[1],10),a=parseInt(l[2],10),t.push({kind:"hunk",text:c,oldLineNo:null,newLineNo:null});continue}if(c.startsWith(" ")||c===""){t.push({kind:"context",text:c.slice(1),oldLineNo:i,newLineNo:a}),i++,a++;continue}if(c.startsWith("+")){t.push({kind:"add",text:c.slice(1),oldLineNo:null,newLineNo:a}),a++;continue}if(c.startsWith("-")){t.push({kind:"remove",text:c.slice(1),oldLineNo:i,newLineNo:null}),i++;continue}t.push({kind:"meta",text:c,oldLineNo:null,newLineNo:null})}return t}function N4(e){if(!(e!=null&&e.trim()))return[];const t=j4(e),n=[];let i=0,a=[];function c(){if(a.length===0){i=0;return}const l=i>0?"modify":"add";P4(n,a,l),i=0,a=[]}for(const l of t){if(l.kind==="remove"){i+=1;continue}if(l.kind==="add"){l.newLineNo!==null&&a.push(l.newLineNo);continue}c()}return c(),n}function P4(e,t,n){const i=t.filter(l=>l>0);if(i.length===0)return;let a=i[0]??1,c=a;for(let l=1;l<i.length;l+=1){const h=i[l]??c;if(h===c+1){c=h;continue}e.push({line:a,span:c-a+1,kind:n}),a=h,c=h}e.push({line:a,span:c-a+1,kind:n})}function T4({markers:e,totalLines:t,scrollContainerRef:n}){const[i,a]=b.useState({top:0,height:0});if(b.useEffect(()=>{const l=n.current;if(!l){a({top:0,height:0});return}const h=l;function f(){const{clientHeight:p,scrollHeight:y,scrollTop:g}=h;if(y<=0||p<=0||y<=p){a({top:0,height:0});return}const w=p/y,x=Math.min(100,Math.max(12,w*100)),S=y-p,C=Math.max(0,100-x),P=S<=0?0:g/S*C;a({top:P,height:x})}return f(),h.addEventListener("scroll",f,{passive:!0}),window.addEventListener("resize",f),()=>{h.removeEventListener("scroll",f),window.removeEventListener("resize",f)}},[n]),e.length===0&&i.height===0)return null;const c=Math.max(t,1);return r.jsxs("div",{className:"file-overview-ruler","data-testid":"file-overview-ruler","aria-hidden":"true",children:[e.map(l=>{const h=(l.line-1)/c*100,f=Math.max(2,l.span/c*100);return r.jsx("div",{className:`file-overview-marker is-${l.kind}`,"data-kind":l.kind,style:{top:`${h}%`,height:`${f}%`}},`${l.kind}-${l.line}-${l.span}`)}),i.height>0?r.jsx("div",{className:"file-overview-viewport",style:{top:`${i.top}%`,height:`${i.height}%`}}):null]})}function fo(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 mo(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 R4=new Set([".ds_store","thumbs.db","ehthumbs.db","desktop.ini",".spotlight-v100",".trashes",".fseventsd","__macosx","$recycle.bin","system volume information",".apdisk",".appledouble",".temporaryitems"]),E4=["._"];function A4(e){return e.split(/[/\\]/).filter(Boolean).pop()??e}function I4(e){const t=e.trim().toLowerCase();return t?R4.has(t)||E4.some(n=>t.startsWith(n)):!1}function rg(e,t,n){return n?[...e]:e.filter(i=>!I4(t(i)))}function Nu(e,t){return rg(e,n=>n.name,t)}function L4(e,t){return t?e:Object.entries(e).reduce((n,[i,a])=>(n[i]=Nu(a,!1),n),{})}async function Hf(e,t){const[n,i]=await Promise.all([AN(t),PA(e)]);return M4(n.changes,i.items)}function M4(e,t){const n=new Set(t.map(i=>Tu(i.path)));return e.filter(i=>n.has(Tu(i.path))||i.oldPath!==null&&n.has(Tu(i.oldPath)))}function D4(e){const t=zx("","");for(const n of e){const i=Tu(n.path),a=i.split("/").filter(Boolean);let c=t;a.forEach((l,h)=>{const f=a.slice(0,h+1).join("/");if(h===a.length-1){c.children.set(`file:${f}`,{kind:"file",name:l,path:i,change:n});return}const p=`directory:${f}`,y=c.children.get(p);if(y&&y.kind==="directory"){c=y;return}const g=zx(l,f);c.children.set(p,g),c=g})}return UN(BN([...t.children.values()]))}function ON(e,t){const n=e.oldPath?`${e.oldPath} -> ${e.path}`:e.path;return ig(e)?`${n} ${t}`:n}function ig(e){return e.status==="D"||e.stagedStatus==="D"||e.worktreeStatus==="D"}function Pu(e){return e.split("/").filter(Boolean).pop()??e}function Tu(e){return e.replace(/\\/g,"/").replace(/^\.\//,"").trim()}function zx(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function BN(e){return[...e].sort((t,n)=>t.kind!==n.kind?t.kind==="directory"?-1:1:t.name.localeCompare(n.name,"zh-CN")).map(t=>t.kind==="directory"?{kind:"directory",name:t.name,path:t.path,children:BN([...t.children.values()])}:t)}function UN(e){return e.map(t=>{var l;if(t.kind!=="directory")return t;const n=UN(t.children);let i=t.name,a=t.path,c=n;for(;c.length===1&&((l=c[0])==null?void 0:l.kind)==="directory";){const h=c[0];i=`${i}/${h.name}`,a=h.path,c=h.children}return{kind:"directory",name:i,path:a,children:c}})}const F4=450,_4=60*1e3,Hx=20,qx=16;function O4({sessionId:e,workspaceId:t,showSystemFiles:n,selectedPath:i,refreshVersion:a,onCountChange:c,onSelectFile:l,onOpenFile:h}){const[f,p]=b.useState("tree"),[y,g]=b.useState([]),[w,x]=b.useState(!0),[S,C]=b.useState(!1),[P,A]=b.useState([]),L=b.useRef(null),{showToast:O}=En();b.useEffect(()=>{const J=Kn(uu(t,e),_4);p("tree"),g(J??[]),x(J===null),C(!1),A([]),L.current=null},[e,t]),b.useEffect(()=>{let J=!1;async function B(){x(!0);try{const W=await Hf(e,t);J||(g(W),Fr(uu(t,e),W))}catch(W){J||O({title:qf(W,u("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{J||x(!1)}}return B(),()=>{J=!0}},[a,e,O,t]);async function ee(){x(!0);try{const J=await Hf(e,t);g(J),Fr(uu(t,e),J)}catch(J){O({title:qf(J,u("conversation.filePanelSessionLoadFailed")),tone:"error"})}finally{x(!1)}}async function q(){if(N.length!==0){C(!0);try{await LN(t,N.map(B=>B.path));const J=await Hf(e,t);g(J),Fr(uu(t,e),J),O({title:u("conversation.filePanelSessionStageSuccess"),tone:"success"})}catch(J){O({title:qf(J,u("git.stageFailed")),tone:"error"})}finally{C(!1)}}}function _(J){A(B=>B.includes(J)?B.filter(W=>W!==J):[...B,J])}function E(J){const B=Date.now(),W=L.current;return L.current={filePath:J,timestamp:B},(W==null?void 0:W.filePath)===J&&B-W.timestamp<=F4}async function M(J,B){if(B&&E(J)){await h(J),L.current=null;return}B||(L.current=null),await l(J)}const I=b.useMemo(()=>rg(y,J=>Pu(J.path),n),[y,n]),N=I.filter(J=>!J.staged),z=D4(I),G=new Set(P);return b.useEffect(()=>{c==null||c(I.length)},[c,I.length]),r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"file-panel-session-toolbar",children:[r.jsxs("div",{className:"file-panel-view-modes",role:"tablist","aria-label":u("conversation.filePanelSessionViewLabel"),children:[r.jsx("button",{className:f==="tree"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":f==="tree",onClick:()=>p("tree"),children:u("conversation.filePanelSessionTreeView")}),r.jsx("button",{className:f==="list"?"file-panel-view-button active":"file-panel-view-button",type:"button",role:"tab","aria-selected":f==="list",onClick:()=>p("list"),children:u("conversation.filePanelSessionListView")})]}),r.jsxs("div",{className:"file-panel-session-actions",children:[r.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void ee(),disabled:w||S,children:u("conversation.filePanelRefresh")}),r.jsx("button",{className:"primary-button",type:"button",onClick:()=>void q(),disabled:S||N.length===0,children:u("conversation.filePanelSessionStageAll")})]})]}),r.jsxs("div",{className:"file-panel-session-summary",children:[r.jsx("span",{children:`${u("conversation.filePanelSessionSummary")} ${I.length}`}),r.jsx("span",{children:`${u("conversation.filePanelSessionUnstagedSummary")} ${N.length}`})]}),r.jsx("div",{className:"file-tree",children:w?r.jsx("p",{className:"file-tree-status status-text",children:u("conversation.filePanelSessionLoading")}):I.length===0?r.jsx("p",{className:"file-tree-status status-text",children:u("conversation.filePanelSessionEmpty")}):f==="tree"?WN({nodes:z,depth:0,collapsedPathSet:G,selectedPath:i,onToggleTreePath:_,onFileClick:M}):B4({items:I,selectedPath:i,onFileClick:M})})]})}function WN({nodes:e,depth:t,collapsedPathSet:n,selectedPath:i,onToggleTreePath:a,onFileClick:c}){return e.map(l=>{if(l.kind==="directory"){const h=!n.has(l.path);return r.jsxs("div",{className:"file-tree-node",children:[r.jsxs("button",{className:"file-tree-item",type:"button","data-kind":"directory","aria-expanded":h,style:{paddingInlineStart:`${Hx+t*qx}px`},onClick:()=>a(l.path),children:[r.jsx("span",{className:"file-tree-chevron","aria-hidden":"true",children:h?"v":">"}),r.jsx("span",{className:"file-tree-label",children:l.name})]}),h?r.jsx("div",{className:"file-tree-children",children:WN({nodes:l.children,depth:t+1,collapsedPathSet:n,selectedPath:i,onToggleTreePath:a,onFileClick:c})}):null]},`session-directory:${l.path}`)}return r.jsx("div",{className:"file-tree-node",children:r.jsxs("button",{className:"file-tree-item is-session-change",type:"button","data-active":i===l.change.path,"data-kind":"file",style:{paddingInlineStart:`${Hx+t*qx}px`},onClick:()=>void c(l.change.path,!ig(l.change)),children:[r.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),r.jsx("span",{className:"git-tree-file-icon","data-kind":mo(l.name),"aria-hidden":"true",children:fo(l.name)}),r.jsxs("span",{className:"file-tree-label",children:[r.jsx("span",{className:"file-tree-name",children:l.name}),r.jsx("span",{className:"file-tree-path",children:ON(l.change,u("conversation.filePanelSessionDeleted"))})]}),r.jsxs("span",{className:"file-session-item-meta",children:[r.jsx("span",{className:"file-session-badge","data-status":l.change.status,children:l.change.status}),r.jsx("span",{className:"file-session-badge subtle",children:l.change.staged?u("git.stagedLabel"):u("git.workingTreeLabel")})]})]})},`session-file:${l.path}`)})}function B4({items:e,selectedPath:t,onFileClick:n}){return e.map(i=>r.jsx("div",{className:"file-session-list-item",children:r.jsxs("button",{className:"file-session-list-button",type:"button","data-active":t===i.path,onClick:()=>void n(i.path,!ig(i)),children:[r.jsx("span",{className:"git-tree-file-icon","data-kind":mo(Pu(i.path)),"aria-hidden":"true",children:fo(Pu(i.path))}),r.jsxs("span",{className:"file-tree-label",children:[r.jsx("span",{className:"file-tree-name",children:Pu(i.path)}),r.jsx("span",{className:"file-tree-path",children:ON(i,u("conversation.filePanelSessionDeleted"))})]}),r.jsxs("span",{className:"file-session-item-meta",children:[r.jsx("span",{className:"file-session-badge","data-status":i.status,children:i.status}),r.jsx("span",{className:"file-session-badge subtle",children:i.staged?u("git.stagedLabel"):u("git.workingTreeLabel")})]})]})},`session-list:${i.path}`))}function uu(e,t){return`file-panel.session-changes.${e}.${t}`}function qf(e,t){return e instanceof mr?e.message:typeof e=="object"&&e&&"message"in e?String(e.message??t):t}const Pn="",U4=450,W4=300*1e3,z4=60*1e3,H4=1600,q4=20,$4=16;function sg({className:e,sessionId:t,workspaceId:n,hideHeading:i=!1,externalRevealRequest:a=null,externalWindowMode:c=!1,workbenchShellOverrides:l}){var An;const h=Yn(),{navigationGroups:f,subscribeFileTree:p,requestFileTreeRefresh:y,addFileTreeSnapshotListener:g,subscribeGitSnapshot:w,requestGitRefresh:x,addGitSnapshotListener:S}={...h,...l},[C,P]=b.useState({}),[A,L]=b.useState([]),[O,ee]=b.useState([]),[q,_]=b.useState(Pn),[E,M]=b.useState(null),[I,N]=b.useState(!1),[z,G]=b.useState(!1),[J,B]=b.useState(!1),[W,Y]=b.useState(!1),[Q,D]=b.useState(""),[re,R]=b.useState(null),[$,Z]=b.useState(!1),[F,we]=b.useState(null),[ce,be]=b.useState("workspace"),[Ve,ze]=b.useState(0),[yt,ft]=b.useState(0),[Ot,Ke]=b.useState(!1),[jt,pt]=b.useState(!1),[Mt,xt]=b.useState([]),[Dt,wt]=b.useState(!1),[ye,Fe]=b.useState(null),kt=b.useRef({}),lt=b.useRef([]),gt=b.useRef(Pn),Lt=b.useRef(!1),nt=b.useRef(null),fe=b.useRef(null),ge=b.useRef(null),Te=b.useRef(null),qe=b.useRef(null),dt=b.useRef(0),St=b.useRef(new Map),{showToast:rt}=En(),Ut=zn(),mt=Hi(j=>j.showSystemFiles),Bt=!!(t!=null&&t.trim()),At=i&&Ut.isMobile;b.useEffect(()=>{_t("file_panel.props",{sessionId:t,workspaceId:n,externalWindowMode:c})},[c,t,n]),b.useEffect(()=>{gt.current=q},[q]);function vt(j){P(se=>{const V=typeof j=="function"?j(se):j;return kt.current=V,V})}function Nt(j){L(se=>{const V=typeof j=="function"?j(se):j;return lt.current=V,V})}b.useEffect(()=>{var Le,et;if($e(),!n){$e(),Lt.current=!1,kt.current={},lt.current=[],gt.current=Pn,vt({}),Nt([]),ee([]),_(Pn),Y(!1),D(""),R(null),Z(!1),N(!1),wt(!1),Fe(null);return}Lt.current=!0;const j=Kn(Gx(n),W4);_t("file_panel.workspace_snapshot",{workspaceId:n,cached:!!j,cachedRootItems:((et=(Le=j==null?void 0:j.treeCache)==null?void 0:Le[Pn])==null?void 0:et.length)??0,cachedDirectoryCount:Object.keys((j==null?void 0:j.treeCache)??{}).length});const se=n5((j==null?void 0:j.activeDirectoryPath)??Pn,(j==null?void 0:j.treeCache)??{}),V=Vx((j==null?void 0:j.expandedDirectories)??[],se),Ne=du((j==null?void 0:j.treeCache)??{},se,V);kt.current=Ne,lt.current=V,gt.current=se,vt(Ne),Nt(V),ee([]),_(se),N(!1),G(!1),Y(!1),D(""),R(null),Z(!1),queueMicrotask(()=>{Lt.current=!1})},[n]),b.useEffect(()=>{if(!a||a.workspaceId!==n)return;const j=()=>{if(qe.current===a.requestId)return;qe.current=a.requestId,be("workspace"),(a.openViewer?Ue(a.filePath):Ee(a.filePath)).catch(V=>{rt({title:ps(V,u("conversation.filePanelOpenFailed")),tone:"error"})})};if(Lt.current){queueMicrotask(j);return}j()},[a,Ue,Ee,rt,n]),b.useEffect(()=>{if(n)return g(j=>{j.workspaceId===n&&(vt(se=>({...se,[j.path]:j.items})),j.path===Pn&&N(!1),ee(se=>se.filter(V=>V!==j.path)),Se(j.path,j.items))})},[g,n]),b.useEffect(()=>()=>{$e()},[]),b.useEffect(()=>{n&&p(n,$f(lt.current,gt.current))},[q,A,p,n]),b.useEffect(()=>{M(null),we(null),Fe(null),ze(0),Ke(!1),pt(!1),nt.current=null,dt.current+=1},[t]),b.useEffect(()=>{!Bt&&ce==="session"&&be("workspace")},[ce,Bt]),b.useEffect(()=>{if(!Ot&&!jt)return;function j(V){var et,Wt;if(!(V.target instanceof Node))return;const Ne=((et=fe.current)==null?void 0:et.contains(V.target))??!1,Le=((Wt=ge.current)==null?void 0:Wt.contains(V.target))??!1;!Ne&&!Le&&(Ke(!1),pt(!1))}function se(V){V.key==="Escape"&&(Ke(!1),pt(!1))}return document.addEventListener("pointerdown",j),document.addEventListener("keydown",se),()=>{document.removeEventListener("pointerdown",j),document.removeEventListener("keydown",se)}},[Ot,jt]),b.useEffect(()=>{if(!n)return;const j=Vx(A,q),se=du(C,q,j);Fr(Gx(n),{treeCache:se,expandedDirectories:j,activeDirectoryPath:q})},[q,A,C,n]),b.useEffect(()=>{if(Lt.current)return;const j=du(C,q,A);i5(C,j)||vt(j)},[q,A,C]),b.useEffect(()=>{let j=!1;const se=(n==null?void 0:n.trim())??null;async function V(Le){if(!se)return;const et=Nu(kt.current[Pn]??[],mt),Wt=(Le==null?void 0:Le.silent)!==!0&&et.length===0;Wt&&N(!0),_t("file_panel.load_root_tree.start",{sessionId:t,workspaceId:se,silent:(Le==null?void 0:Le.silent)===!0,cachedRootItems:et.length});try{const qt=await oe(Pn,{force:!0});j||(_t("file_panel.load_root_tree.end",{sessionId:t,workspaceId:se,itemCount:qt.length}),vt(Xn=>({...du(Xn,gt.current,lt.current),[Pn]:qt})))}catch(qt){!j&&!Kx(qt)&&rt({title:ps(qt,u("conversation.filePanelLoadFailed")),tone:"error"})}finally{!j&&Wt&&N(!1)}}if(Nu(kt.current[Pn]??[],mt).length>0){const Le=window.setTimeout(()=>{se&&(p(se,$f(lt.current,gt.current)),V({silent:!0}))},1500);return()=>{j=!0,window.clearTimeout(Le)}}return V(),()=>{j=!0}},[t,mt,rt,n]),b.useEffect(()=>{if(!n||!t){ft(0);return}const j=Kn(s5(n,t),z4);_t("file_panel.session_change_count.snapshot",{sessionId:t,workspaceId:n,cached:j!==null,cachedCount:j}),ft(j??0)},[t,Ve,n]),b.useEffect(()=>{if(!n){xt([]);return}const j=n.trim();w(j),x(j)},[n,w,x]),b.useEffect(()=>{if(!n)return;const j=n.trim();return S(se=>{var V;se.workspaceId===j&&xt(((V=se.status)==null?void 0:V.changes)??[])})},[S,n]);const Zt=b.useMemo(()=>rg(Mt,j=>A4(j.path),mt),[Mt,mt]),ie=b.useMemo(()=>{const j=new Map,se=new Set;for(const V of Zt){const Ne=V.path.replace(/\\/g,"/"),Le=V.worktreeStatus??V.stagedStatus??V.status;j.set(Ne,Le);const et=Ne.split("/");for(let Wt=1;Wt<et.length;Wt++)se.add(et.slice(0,Wt).join("/"))}return{statusByPath:j,changedDirs:se}},[Zt]),Ie=b.useMemo(()=>L4(C,mt),[mt,C]),ct=b.useMemo(()=>re===null?null:Nu(re,mt),[re,mt]),zt=Ie[Pn]??[],nn=W&&ct!==null,ke=((An=f.find(j=>j.workspace.id===n))==null?void 0:An.workspace)??null,it=K4(E,q),Qt=!!(ke!=null&&ke.path&&it!==null),rn=!!E,Tn=!!((E?dl(E):q)&&A.length);async function un(j,se=!1){if(!n)return[];if(!se){const V=kt.current[j];if(V)return V}j===Pn?N(!0):ee(V=>Ru(V,j));try{const V=await oe(j,{force:se});return vt(Ne=>({...Ne,[j]:V})),V}catch(V){throw Kx(V)||rt({title:ps(V,u("conversation.filePanelLoadFailed")),tone:"error"}),V}finally{j===Pn?N(!1):ee(V=>V.filter(Ne=>Ne!==j))}}async function X(){if(!n)return;const j=r5(kt.current,q,lt.current);_t("file_panel.refresh_tree_cache.start",{sessionId:t,workspaceId:n,targetDirectories:j});const V=(await Promise.all(j.map(async Ne=>{const Le=await oe(Ne,{force:!0});return[Ne,Le]}))).reduce((Ne,[Le,et])=>(Ne[Le]=et,Ne),{});_t("file_panel.refresh_tree_cache.end",{sessionId:t,workspaceId:n,targetDirectories:j,directoryCount:Object.keys(V).length}),vt(V)}async function oe(j,se){if(!n)return[];if(!(se!=null&&se.force)){const Ne=kt.current[j];if(Ne)return Ne}const V=$f(Ru(lt.current,j),j||gt.current);return p(n,V),y(n,[j]),de(j)}function de(j,se=H4){const V=kt.current[j];return V?Promise.resolve(V):new Promise((Ne,Le)=>{const et=window.setTimeout(()=>{je(j,et),Le(new Error(`FILE_TREE_SNAPSHOT_TIMEOUT:${j}`))},se),Wt=St.current.get(j)??[];St.current.set(j,[...Wt,{resolve:Ne,reject:Le,timerId:et}])})}function Se(j,se){const V=St.current.get(j)??[];V.length!==0&&(St.current.delete(j),V.forEach(Ne=>{window.clearTimeout(Ne.timerId),Ne.resolve(se)}))}function je(j,se){const Ne=(St.current.get(j)??[]).filter(Le=>Le.timerId!==se);if(Ne.length===0){St.current.delete(j);return}St.current.set(j,Ne)}function $e(){for(const[j,se]of St.current.entries())se.forEach(V=>{window.clearTimeout(V.timerId),V.reject(new Error(`FILE_TREE_ABORTED:${j}`))});St.current.clear()}async function Ye(j,se=!1){const V=Il(j,se);if(!V.length){_(Pn);return}Nt(Ne=>$N(Ne,V)),_(V[V.length-1]??Pn);for(const Ne of V)try{await un(Ne)}catch{return}}async function Ee(j){M(j),_(dl(j)),await Ye(j)}async function Ue(j){we(j),Fe(null),nt.current=null,dt.current+=1,Ee(j);const se=dt.current,V=j.replace(/\\/g,"/"),Ne=ie.statusByPath.get(V);if(n&&Ne&&Ne!=="?"&&Ne!=="D")try{const Le=await IN(n,j,!1);dt.current===se&&Fe(Le.content||null)}catch{dt.current===se&&Fe(null)}}function ne(j){const se=Date.now(),V=nt.current;return nt.current={filePath:j,timestamp:se},(V==null?void 0:V.filePath)===j&&se-V.timestamp<=U4}function xe(){nt.current=null}async function Ze(j){if(ne(j)){await Ue(j);return}await Ee(j)}function ot(){Y(!1),D(""),R(null),xe()}async function It(j){if(j.kind==="directory"){ot(),await Ct(j.path);return}if(ne(j.path)){ot(),await Ue(j.path);return}await Ee(j.path)}async function Ct(j){if(M(null),_(j),!lt.current.includes(j))try{await un(j),Nt(se=>Ru(se,j))}catch{}}async function Pt(j){if(M(null),_(j),lt.current.includes(j)){$t(j);return}await Ct(j)}function $t(j){Nt(se=>se.filter(V=>V!==j&&!V.startsWith(`${j}/`))),_(dl(j)),M(null)}async function me(){if(!n)return;const j=n;try{if(x(j),await X(),E&&await Ye(E),nn&&Q.trim()){const se=await vm(j,Q.trim());R(se.items)}}catch(se){rt({title:ps(se,u("conversation.filePanelLoadFailed")),tone:"error"})}}async function We(j){if(j==null||j.preventDefault(),!n||!Q.trim()){R(null);return}Z(!0);try{const se=await vm(n,Q.trim());R(se.items)}catch(se){rt({title:ps(se,u("conversation.filePanelSearchFailed")),tone:"error"})}finally{Z(!1)}}function Qe(){if(W){Y(!1),D(""),R(null);return}Y(!0)}function Be(j){pt(!1),j()}function Xt(){var j;(j=Te.current)==null||j.click()}async function Ht(j){var et;const se=((et=j.target.files)==null?void 0:et[0])??null;if(j.target.value="",!se||!n)return;const V=G4(se.name);if(!V){rt({title:u("conversation.filePanelUploadFailed"),tone:"error"});return}const Ne=$x(q,E),Le=V4(Ne,V);B(!0);try{const Wt=await X4(se);await uI({workspaceId:n,path:Le,contentBase64:Wt}),await X(),await Ee(Le),rt({title:u("conversation.filePanelUploadSuccess",{name:V}),tone:"success"})}catch(Wt){rt({title:ps(Wt,u("conversation.filePanelUploadFailed")),tone:"error"})}finally{B(!1)}}async function K(){if(!(!n||!E)){B(!0);try{const j=await dI(n,E),se=J4(j.contentBase64);Z4(j.fileName,new Blob([se],{type:"application/octet-stream"})),rt({title:u("conversation.filePanelDownloadSuccess",{name:j.fileName}),tone:"success"})}catch(j){rt({title:ps(j,u("conversation.filePanelDownloadFailed")),tone:"error"})}finally{B(!1)}}}function Ce(){const j=E?dl(E):q;!j||!lt.current.includes(j)||$t(j)}async function Xe(j){if(!n)return;const se=$x(q,E),V=se?`${se}/`:"",Ne=window.prompt(u(j==="create_file"?"conversation.filePanelCreateFilePrompt":"conversation.filePanelCreateDirectoryPrompt"),V);if(!(Ne!=null&&Ne.trim()))return;const Le=Ne.trim();G(!0);try{await cI({workspaceId:n,opType:j,dstPath:Le,content:j==="create_file"?"":void 0}),await X(),j==="create_directory"?(await Ye(Le,!0),M(null)):await Ee(Le)}catch(et){rt({title:ps(et,u("conversation.filePanelMutateFailed")),tone:"error"})}finally{G(!1)}}async function Ge(j){const se=(ke==null?void 0:ke.path)??"";if(it===null||!se){Ke(!1);return}try{const V=Y4(se),Ne=j==="absolute"?Q4(se,it,V):zN(it,V);await e5(Ne,Ut),rt({title:u(j==="absolute"?"conversation.filePanelCopyAbsolutePathSuccess":"conversation.filePanelCopyRelativePathSuccess"),tone:"success"})}catch(V){rt({title:V instanceof Error?V.message:u("conversation.filePanelCopyPathFailed"),tone:"error"})}finally{Ke(!1)}}function ut(j,se){return r.jsx(r.Fragment,{children:j.map(V=>{const Ne=V.kind==="directory",Le=Ne&&A.includes(V.path),et=Ne&&O.includes(V.path),Wt=Ie[V.path]??[],qt=Dt?Vf(Wt,Ie,ie.statusByPath,ie.changedDirs):Wt,Xn=E===V.path||E===null&&Ne&&q===V.path,on=ie.statusByPath.get(V.path.replace(/\\/g,"/")),Xr=Ne&&ie.changedDirs.has(V.path.replace(/\\/g,"/"));return r.jsxs("div",{className:"file-tree-node",children:[r.jsxs("button",{className:"file-tree-item",type:"button","data-active":Xn,"data-kind":V.kind,"aria-expanded":Ne?Le:void 0,style:{paddingInlineStart:`${q4+se*$4}px`},onClick:()=>{if(Ne){xe(),Pt(V.path);return}Ze(V.path)},children:[r.jsx("span",{className:`file-tree-chevron${Ne?"":" is-hidden"}`,"aria-hidden":"true",children:Le?"v":">"}),Ne?null:r.jsx("span",{className:"git-tree-file-icon","data-kind":mo(V.name),"aria-hidden":"true",children:fo(V.name)}),r.jsx("span",{className:"file-tree-label","data-status":on??void 0,"data-has-changes":Xr||void 0,children:V.name}),!Ne&&on?r.jsx("span",{className:"git-status-badge","data-status":on,"aria-label":on,children:on}):null,Ne&&Xr?r.jsx("span",{className:"file-tree-dir-badge","aria-hidden":"true"}):null,et?r.jsx("span",{className:"file-tree-meta",children:u("common.loading")}):null]}),Ne&&Le?r.jsx("div",{className:"file-tree-children",children:et&&!Wt.length?r.jsx("p",{className:"file-tree-empty",children:u("common.loading")}):qt.length?ut(qt,se+1):r.jsx("p",{className:"file-tree-empty",children:u("conversation.filePanelEmptyDirectory")})}):null]},`${V.kind}-${V.path}`)})})}function dn(j){return r.jsx(r.Fragment,{children:j.map(se=>{const V=se.kind==="directory",Ne=E===se.path;return r.jsx("div",{className:"file-tree-node",children:r.jsxs("button",{className:"file-tree-item is-search-result",type:"button","data-active":Ne,"data-kind":se.kind,onClick:()=>{It(se)},children:[r.jsx("span",{className:"file-tree-chevron is-hidden","aria-hidden":"true",children:">"}),V?null:r.jsx("span",{className:"git-tree-file-icon","data-kind":mo(se.name),"aria-hidden":"true",children:fo(se.name)}),r.jsxs("span",{className:"file-tree-label",children:[r.jsx("span",{className:"file-tree-name",children:se.name}),r.jsx("span",{className:"file-tree-path",children:se.path})]})]})},`search-${se.kind}-${se.path}`)})})}return r.jsx("section",{className:["conversation-panel","surface-card","file-panel",e].filter(Boolean).join(" "),"data-testid":"file-context-panel",children:n?r.jsxs(r.Fragment,{children:[r.jsx(MN,{workspaceId:n,filePath:F,open:F!==null,onClose:()=>{dt.current+=1,we(null),Fe(null)},onSaved:async j=>{await X(),await Ee(j),ze(se=>se+1)},diffContent:ye}),i?null:r.jsx("div",{className:"file-panel-heading-row",children:r.jsx("h2",{className:"file-panel-heading",children:u("conversation.filePanelTitle")})}),r.jsxs("div",{className:"file-panel-tabs",role:"tablist","aria-label":u("conversation.filePanelTitle"),children:[r.jsx("button",{className:ce==="workspace"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":ce==="workspace",onClick:()=>be("workspace"),children:u("conversation.filePanelWorkspaceTab")}),r.jsxs("button",{className:ce==="session"?"file-panel-tab active":"file-panel-tab",type:"button",role:"tab","aria-selected":ce==="session",onClick:()=>{Bt&&be("session")},disabled:!Bt,children:[u("conversation.filePanelSessionTab"),r.jsx("span",{className:"file-panel-tab-badge","aria-label":`${u("conversation.filePanelSessionTab")} ${yt}`,children:yt})]})]}),ce==="workspace"?r.jsxs(r.Fragment,{children:[r.jsx("input",{ref:Te,"data-testid":"file-panel-upload-input",type:"file",hidden:!0,onChange:j=>void Ht(j)}),At?r.jsx("div",{className:"file-panel-toolbar file-panel-toolbar-mobile","aria-label":u("conversation.filePanelTitle"),children:r.jsxs("div",{className:"file-mobile-action-shell",ref:ge,children:[r.jsxs("button",{className:"secondary-button file-mobile-action-trigger",type:"button","aria-label":u("conversation.filePanelActionsMenu"),"aria-haspopup":"menu","aria-expanded":jt,"data-active":jt,onClick:()=>{Ke(!1),pt(j=>!j)},children:[r.jsx("span",{children:u("conversation.filePanelActionsMenu")}),r.jsx(f5,{})]}),jt?r.jsxs("div",{className:"file-mobile-action-menu",role:"menu","aria-label":u("conversation.filePanelActionsMenu"),children:[r.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{pt(!1),Qe()},children:u(W?"conversation.filePanelHideSearch":"conversation.filePanelShowSearch")}),r.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{pt(!1),wt(j=>!j)},disabled:Zt.length===0,children:u(Dt?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges")}),r.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Be(me),disabled:I||z||$,children:u("conversation.filePanelRefresh")}),r.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{pt(!1),Ce()},disabled:!Tn,children:u("conversation.filePanelCollapseCurrent")}),r.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>{pt(!1),Xt()},disabled:z||J,children:u("conversation.filePanelUpload")}),r.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Be(K),disabled:!rn||J,children:u("conversation.filePanelDownload")}),r.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Be(()=>Xe("create_file")),disabled:z||J,children:u("conversation.filePanelNewFile")}),r.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Be(()=>Xe("create_directory")),disabled:z||J,children:u("conversation.filePanelNewDirectory")}),r.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Be(()=>Ge("absolute")),disabled:!Qt,children:u("conversation.filePanelCopyAbsolutePath")}),r.jsx("button",{className:"file-mobile-action-menu-item",type:"button",role:"menuitem",onClick:()=>Be(()=>Ge("relative")),disabled:!Qt,children:u("conversation.filePanelCopyRelativePath")})]}):null]})}):r.jsxs("div",{className:"file-panel-toolbar","aria-label":u("conversation.filePanelTitle"),children:[r.jsxs("div",{className:"file-toolbar-menu-shell",ref:fe,children:[r.jsx("button",{className:"file-toolbar-button",type:"button",title:u("conversation.filePanelCopyPath"),"aria-label":u("conversation.filePanelCopyPath"),"aria-haspopup":"menu","aria-expanded":Ot,"data-active":Ot,onClick:()=>{pt(!1),Ke(j=>!j)},disabled:!Qt,children:r.jsx(l5,{})}),Ot?r.jsxs("div",{className:"file-toolbar-menu",role:"menu",children:[r.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Ge("absolute"),children:u("conversation.filePanelCopyAbsolutePath")}),r.jsx("button",{className:"file-toolbar-menu-item",type:"button",role:"menuitem",onClick:()=>void Ge("relative"),children:u("conversation.filePanelCopyRelativePath")})]}):null]}),r.jsx("button",{className:"file-toolbar-button",type:"button",title:u("conversation.filePanelCollapseCurrent"),"aria-label":u("conversation.filePanelCollapseCurrent"),onClick:Ce,disabled:!Tn,children:r.jsx(o5,{})}),r.jsx("button",{className:"file-toolbar-button",type:"button",title:u("conversation.filePanelRefresh"),"aria-label":u("conversation.filePanelRefresh"),onClick:()=>void me(),disabled:I||z||$,children:r.jsx(a5,{})}),r.jsx("button",{className:"file-toolbar-button",type:"button",title:u("conversation.filePanelSearchButton"),"aria-label":u("conversation.filePanelSearchButton"),"data-active":W,onClick:Qe,disabled:I,children:r.jsx(Qx,{})}),Zt.length>0?r.jsx("button",{className:"file-toolbar-button",type:"button",title:u(Dt?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges"),"aria-label":u(Dt?"conversation.filePanelShowAll":"conversation.filePanelFilterChanges"),"data-active":Dt,onClick:()=>wt(j=>!j),children:r.jsx(m5,{})}):null,r.jsx("button",{className:"file-toolbar-button",type:"button",title:u("conversation.filePanelUpload"),"aria-label":u("conversation.filePanelUpload"),onClick:Xt,disabled:z||J,children:r.jsx(u5,{})}),r.jsx("button",{className:"file-toolbar-button",type:"button",title:u("conversation.filePanelDownload"),"aria-label":u("conversation.filePanelDownload"),onClick:()=>void K(),disabled:!rn||J,children:r.jsx(d5,{})}),r.jsx("button",{className:"file-toolbar-button",type:"button",title:u("conversation.filePanelNewFile"),"aria-label":u("conversation.filePanelNewFile"),onClick:()=>void Xe("create_file"),disabled:z||J,children:r.jsx(c5,{})}),r.jsx("button",{className:"file-toolbar-button",type:"button",title:u("conversation.filePanelNewDirectory"),"aria-label":u("conversation.filePanelNewDirectory"),onClick:()=>void Xe("create_directory"),disabled:z||J,children:r.jsx(h5,{})})]}),W?r.jsxs("form",{className:"file-toolbar-search",onSubmit:j=>void We(j),children:[r.jsx("input",{value:Q,onChange:j=>D(j.target.value),placeholder:u("conversation.filePanelSearchPlaceholder")}),At?r.jsx("button",{className:"secondary-button file-mobile-search-submit",type:"submit","aria-label":u("conversation.filePanelSearchButton"),disabled:$,children:u("conversation.filePanelSearchButton")}):r.jsx("button",{className:"file-toolbar-button",type:"submit",title:u("conversation.filePanelSearchButton"),"aria-label":u("conversation.filePanelSearchButton"),disabled:$,children:r.jsx(Qx,{})})]}):null,r.jsx("div",{className:"file-tree","data-search-mode":nn,children:I&&zt.length===0?r.jsx("p",{className:"file-tree-status status-text",children:u("common.loading")}):nn?ct!=null&&ct.length?dn(ct):r.jsx("p",{className:"file-tree-status status-text",children:u("conversation.filePanelSearchEmpty")}):Dt?Vf(zt,Ie,ie.statusByPath,ie.changedDirs).length?ut(Vf(zt,Ie,ie.statusByPath,ie.changedDirs),0):r.jsx("p",{className:"file-tree-status status-text",children:u("conversation.filePanelNoChanges")}):zt.length?ut(zt,0):r.jsx("p",{className:"file-tree-status status-text",children:u("conversation.filePanelEmptyDirectory")})})]}):Bt&&t?r.jsx(O4,{sessionId:t,workspaceId:n,showSystemFiles:mt,selectedPath:E,refreshVersion:Ve,onCountChange:ft,onSelectFile:Ee,onOpenFile:Ue}):r.jsx("section",{className:"file-panel-section",children:r.jsx("p",{className:"status-text",children:u("conversation.filePanelSessionNoSession")})})]}):r.jsx("section",{className:"file-panel-section",children:r.jsx("p",{className:"status-text",children:u("conversation.filePanelNoWorkspace")})})})}function dl(e){return e.includes("/")?e.split("/").slice(0,-1).join("/"):Pn}function Il(e,t=!1){const n=e.split("/").filter(Boolean),i=t?n.length:n.length-1,a=[];for(let c=0;c<i;c+=1)a.push(n.slice(0,c+1).join("/"));return a}function $x(e,t){return e||(t?dl(t):Pn)}function V4(e,t){return e?`${e}/${t}`:t}function G4(e){var t;return((t=e.split(/[/\\]/).pop())==null?void 0:t.trim())??""}function K4(e,t){return e||t||null}function zN(e,t="posix"){return e?HN(e,t):"."}function Q4(e,t,n){const i=HN(e,n),a=zN(t,n).replace(/^\.[/\\]?/,"");if(!a)return i;const c=qN(n),l=a.replace(/^[/\\]+/,"");return l?i.endsWith("/")||i.endsWith("\\")?`${i}${l}`:`${i}${c}${l}`:i}function Y4(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.includes("\\")?"windows":"posix"}function HN(e,t){return e&&(qN(t)==="\\"?e.replace(/\//g,"\\"):e.replace(/\\/g,"/"))}function qN(e){return e==="windows"?"\\":"/"}async function X4(e){const t=await e.arrayBuffer(),n=new Uint8Array(t),i=32768;let a="";for(let c=0;c<n.length;c+=i){const l=n.subarray(c,c+i);a+=String.fromCharCode(...l)}return btoa(a)}function J4(e){const t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i+=1)n[i]=t.charCodeAt(i);return n.buffer.slice(n.byteOffset,n.byteOffset+n.byteLength)}function Z4(e,t){if(typeof document>"u")throw new Error(u("conversation.filePanelDownloadFailed"));const n=window.URL.createObjectURL(t),i=document.createElement("a");i.href=n,i.download=e,document.body.append(i),i.click(),i.remove(),window.URL.revokeObjectURL(n)}async function e5(e,t){var n;if(!(t.isDesktop&&(await t.bridge.writeClipboardText(e)).ok)){if(typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText))try{await navigator.clipboard.writeText(e);return}catch{}if(!t5(e))throw new Error(u("conversation.filePanelCopyPathFailed"))}}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)}}function n5(e,t){return e&&Il(e,!0).every(a=>a in t)?e:Pn}function Vx(e,t){if(!t)return[];const n=Il(t,!0);return e.filter(i=>n.includes(i))}function du(e,t,n){const i=og(t,n);return Object.entries(e).reduce((a,[c,l])=>(i.has(c)&&(a[c]=l),a),{})}function r5(e,t,n){const a=[...og(t,n)].filter(c=>c===Pn||c in e);return a.length?a:[Pn]}function og(e,t){const n=new Set([Pn]),i=$N(t,Il(e,!0));for(const a of i){n.add(a);for(const c of Il(a,!0))n.add(c)}return n}function i5(e,t){const n=Object.keys(e),i=Object.keys(t);return n.length!==i.length?!1:n.every(a=>e[a]===t[a])}function Ru(e,t){return e.includes(t)?e:[...e,t]}function $N(e,t){return t.reduce((n,i)=>Ru(n,i),e)}function Gx(e){return`file-panel.workspace-tree.${e}`}function s5(e,t){return`file-panel.session-change-count.${e}.${t}`}function $f(e,t){return[...og(t,e)]}function ps(e,t){return e instanceof mr?e.message:t}function Kx(e){return e instanceof Error&&(e.message.startsWith("FILE_TREE_SNAPSHOT_TIMEOUT:")||e.message.startsWith("FILE_TREE_ABORTED:"))}function o5(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.jsx("path",{d:"M2.5 4.5h11v2h-11zM2.5 7.5h7v2h-7zM2.5 10.5h4v2h-4z",fill:"currentColor"})})}function a5(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.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 Qx(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.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 l5(){return r.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[r.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"}),r.jsx("path",{d:"M5.7 10.8h4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function c5(){return r.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[r.jsx("path",{d:"M4 1.5h5l3 3v10H4z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),r.jsx("path",{d:"M9 1.5v3h3",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),r.jsx("path",{d:"M8 6.5v5M5.5 9h5",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function u5(){return r.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[r.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),r.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),r.jsx("path",{d:"m5.5 5 2.5-2.5L10.5 5",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})]})}function d5(){return r.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[r.jsx("path",{d:"M3 11.5v2h10v-2",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),r.jsx("path",{d:"M8 2.5v8",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),r.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 h5(){return r.jsxs("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:[r.jsx("path",{d:"M1.8 4.5h4l1.2 1.3h7.2v6.7H1.8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2"}),r.jsx("path",{d:"M8.5 7.2v4M6.5 9.2h4",fill:"none",stroke:"currentColor",strokeWidth:"1.2"})]})}function f5(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.jsx("path",{d:"m4 6 4 4 4-4",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})})}function m5(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.jsx("path",{d:"M1.5 2h13l-5 6v5l-3 1.5V8z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})})}function Vf(e,t,n,i){const a=[];for(const c of e){const l=c.path.replace(/\\/g,"/");c.kind==="file"?n.has(l)&&a.push(c):VN(l,t,n,i)&&a.push(c)}return a}function VN(e,t,n,i,a){const c=a??new Set;if(c.has(e))return!1;c.add(e);const l=t[e];if(!l)return i.has(e);for(const h of l){const f=h.path.replace(/\\/g,"/");if(h.kind==="file"){if(n.has(f))return!0}else if(VN(f,t,n,i,c))return!0}return!1}const p5=Object.freeze(Object.defineProperty({__proto__:null,FileContextPanel:sg},Symbol.toStringTag,{value:"Module"})),Gf=56,Yx=28,Kf=72,hu=8,Xx=960,Jx=60*1e3,Zx=20,ek=9,tk=9,Qf=68;function ag({className:e,workspaceId:t,panelActive:n=!0,externalWindowMode:i=!1,workbenchShellOverrides:a}){const c=Yn(),{subscribeGitSnapshot:l,requestGitRefresh:h,addGitSnapshotListener:f}={...c,...a},[p,y]=b.useState(null),[g,w]=b.useState([]),[x,S]=b.useState(0),[C,P]=b.useState(null),[A,L]=b.useState(!1),[O,ee]=b.useState(null),[q,_]=b.useState(null),[E,M]=b.useState(""),[I,N]=b.useState(!1),[z,G]=b.useState(!1),[J,B]=b.useState([]),[W,Y]=b.useState(!0),[Q,D]=b.useState(!1),[re,R]=b.useState(()=>typeof window<"u"?window.innerWidth<=Xx:!1),[$,Z]=b.useState([]),[F,we]=b.useState(null),[ce,be]=b.useState("unstaged"),[Ve,ze]=b.useState(null),[yt,ft]=b.useState(!1),[Ot,Ke]=b.useState([]),[jt,pt]=b.useState(!1),[Mt,xt]=b.useState(new Set),[Dt,wt]=b.useState(new Map),[ye,Fe]=b.useState(null),[kt,lt]=b.useState(Gf),[gt,Lt]=b.useState(!1),[nt,fe]=b.useState(null),[ge,Te]=b.useState(null),qe=b.useRef(null),dt=b.useRef(null),St=b.useRef(null),rt=b.useRef(null),Ut=b.useRef(n),{showToast:mt}=En();b.useEffect(()=>{_t("git_sidebar.props",{workspaceId:t,externalWindowMode:i})},[i,t]),b.useEffect(()=>{B([]),Y(!0),S(0),P(null),L(!1),_(null),M(""),D(!1),Z([]),we(null),be("unstaged"),ze(null),Fe(null),Lt(!1),lt(Gf),fe(null),Te(null)},[t]),b.useEffect(()=>{function K(){R(window.innerWidth<=Xx)}return K(),window.addEventListener("resize",K),()=>{window.removeEventListener("resize",K)}},[]),b.useEffect(()=>{if(!gt)return;const K=document.body.style.cursor,Ce=document.body.style.userSelect;document.body.style.cursor="row-resize",document.body.style.userSelect="none";function Xe(ut){je(ut.clientY)}function Ge(){Lt(!1)}return window.addEventListener("pointermove",Xe),window.addEventListener("pointerup",Ge),()=>{document.body.style.cursor=K,document.body.style.userSelect=Ce,window.removeEventListener("pointermove",Xe),window.removeEventListener("pointerup",Ge)}},[gt]),b.useEffect(()=>{var Xe,Ge;if(!(t!=null&&t.trim())){y(null),w([]),S(0),P(null),ee(null),N(!1);return}const K=t.trim(),Ce=Kn(Xf(K),Jx);if(_t("git_sidebar.snapshot",{workspaceId:K,cached:!!Ce,cachedHistoryCount:((Xe=Ce==null?void 0:Ce.history)==null?void 0:Xe.length)??0,cachedChangedCount:((Ge=Ce==null?void 0:Ce.status)==null?void 0:Ge.changes.length)??0}),Ce){At(Ce),N(!1);return}y(null),w([]),S(0),P(null),ee(null),N(!0)},[t]),b.useEffect(()=>{if(t!=null&&t.trim())return f(K=>{var Ce,Xe,Ge;K.workspaceId===t.trim()&&(_t("git_sidebar.snapshot_received",{workspaceId:K.workspaceId,changedCount:((Ce=K.status)==null?void 0:Ce.changes.length)??0,historyCount:K.history.length,branchCount:(((Xe=K.branches)==null?void 0:Xe.local.length)??0)+(((Ge=K.branches)==null?void 0:Ge.remote.length)??0)}),At(K),N(!1))})},[f,t]),b.useEffect(()=>{if(!(t!=null&&t.trim()))return;const K=t.trim(),Ce=Kn(Xf(K),Jx)!==null;if(l(K),Ce){h(K);return}vt()},[h,l,t]),b.useEffect(()=>{const K=Ut.current;Ut.current=n,t!=null&&t.trim()&&!K&&n&&h(t.trim())},[n,h,t]),b.useEffect(()=>{t&&Fr(Xf(t),{status:p,history:g,historyTotalCount:x,historyNextCursor:C,branches:O})},[O,g,C,x,p,t]),b.useEffect(()=>{if(!p||!q)return;p.changes.find(Ce=>Ce.path===q)||_(null)},[q,p]),b.useEffect(()=>{v5(rt.current)},[E]),b.useEffect(()=>{re||(Z([]),we(null),ze(null),Fe(null))},[re]),b.useEffect(()=>{if(!p){Z([]);return}const K=new Set(p.changes.map(Ce=>Ce.path));Z(Ce=>Ce.filter(Xe=>K.has(Xe)))},[p]);function Bt(){const K=St.current;if(!K)return;K.querySelectorAll(".git-tree-shell").forEach(Xe=>{Xe.scrollTop=0})}function At(K){y(K.status),w(Array.isArray(K.history)?K.history:[]),S(typeof K.historyTotalCount=="number"?K.historyTotalCount:0),P(typeof K.historyNextCursor=="string"?K.historyNextCursor:null),ee(K.branches??null)}function vt(K){t!=null&&t.trim()&&(N(!0),_t("git_sidebar.refresh_requested",{workspaceId:t.trim(),resetTreeScroll:!1}),h(t.trim()))}async function Nt(K){if(!(t!=null&&t.trim()))return;const Ce=t.trim();N(!0);try{const[Xe,Ge,ut]=await Promise.all([AN(Ce),Bx(Ce,Zx,null),Jz(Ce)]);At({status:Xe,history:Ge.items,historyTotalCount:Ge.totalCount,historyNextCursor:Ge.nextCursor,branches:ut}),h(Ce),K!=null&&K.resetTreeScroll&&requestAnimationFrame(()=>{Bt()})}catch(Xe){mt({title:oi(Xe,u("git.panelLoadFailed")),tone:"error"})}finally{N(!1)}}async function Zt(){if(!(!t||!C||A)){L(!0);try{const K=await Bx(t,Zx,C);w(Ce=>{const Xe=new Set(Ce.map(ut=>ut.commitHash)),Ge=K.items.filter(ut=>!Xe.has(ut.commitHash));return[...Ce,...Ge]}),S(K.totalCount),P(K.nextCursor)}catch(K){mt({title:oi(K,u("git.panelLoadFailed")),tone:"error"})}finally{L(!1)}}}function ie(K){if(!W||A||!C)return;const Ce=K.currentTarget;Ce.scrollHeight-Ce.scrollTop-Ce.clientHeight<=40&&Zt()}async function Ie(){if(t){G(!0);try{const K=await Qz(t,"ai");M(K.validation.normalizedDraft.subject||K.draft.subject)}catch(K){mt({title:oi(K,u("git.draftFailed")),tone:"error"})}finally{G(!1)}}}async function ct(K,Ce){if(t&&K.length){G(!0);try{const Xe=Ce?await Gz(t,K):await LN(t,K);y(Xe),_(K[K.length-1]??null),Z(Ge=>Ge.filter(ut=>!K.includes(ut))),we(null),vt()}catch(Xe){N(!1),mt({title:oi(Xe,u("git.stageFailed")),tone:"error"})}finally{G(!1)}}}async function zt(K){if(t&&K.length){G(!0);try{const Ce=await Kz(t,K);y(Ce),K.includes(q??"")&&_(null),Z(Xe=>Xe.filter(Ge=>!K.includes(Ge))),we(null),vt()}catch(Ce){N(!1),mt({title:oi(Ce,u("git.discardFailed")),tone:"error"})}finally{G(!1)}}}async function nn(){if(!(!t||!E.trim())){G(!0);try{await Yz(t,y5(E)),mt({title:u("git.commitSuccess"),tone:"success"}),M(""),_(null),vt()}catch(K){mt({title:oi(K,u("git.commitFailed")),tone:"error"})}finally{G(!1)}}}async function ke(){if(t){pt(!0);try{const K=await e4(t);if(K.length===0){mt({title:u("git.noRemotes"),tone:"error"});return}if(K.length===1){it([K[0].name]);return}Ke(K),xt(new Set),wt(new Map),ft(!0)}catch(K){mt({title:oi(K,u("git.remoteFailed")),tone:"error"})}finally{pt(!1)}}}async function it(K){if(!t||K.length===0)return;G(!0),wt(new Map);const Ce=await Promise.allSettled(K.map(async ut=>{const dn=await Ux(t,"push",ut);return{name:ut,summary:dn.summary}})),Xe=new Map;let Ge=!1;for(const ut of Ce)if(ut.status==="fulfilled")Xe.set(ut.value.name,{ok:!0,summary:ut.value.summary});else{Ge=!0;const dn=K[Xe.size];Xe.set(dn,{ok:!1,summary:oi(ut.reason,u("git.remoteFailed"))})}wt(Xe),vt(),G(!1),Ge||(mt({title:u("git.pushAllSuccess",{count:String(K.length)}),tone:"success"}),ft(!1))}async function Qt(K){if(t){if(K==="push"){D(!1),ke();return}G(!0);try{const Ce=await Ux(t,K);mt({title:Ce.summary,tone:"success"}),D(!1),vt()}catch(Ce){mt({title:oi(Ce,u("git.remoteFailed")),tone:"error"})}finally{G(!1)}}}async function rn(){if(t){G(!0);try{const K=await Xz(t);M(K.commitSubject??""),mt({title:K.summary||u("git.undoLastCommitSuccess"),tone:"success"}),D(!1),vt()}catch(K){mt({title:oi(K,u("git.undoLastCommitFailed")),tone:"error"})}finally{G(!1)}}}async function Tn(K){if(t){G(!0);try{const Ce=await Zz(t,K,!1);ee(Ce),D(!1),vt()}catch(Ce){mt({title:oi(Ce,u("git.branchFailed")),tone:"error"})}finally{G(!1)}}}function un(K){B(Ce=>Ce.includes(K)?Ce.filter(Xe=>Xe!==K):[...Ce,K])}const X=450;function oe(K){const Ce=Date.now(),Xe=qe.current;return qe.current={filePath:K,timestamp:Ce},(Xe==null?void 0:Xe.filePath)===K&&Ce-Xe.timestamp<=X}async function de(K,Ce){if(Ce.binary){mt({title:u("git.binaryDiff"),tone:"info"});return}if(Ce.status==="A"||Ce.status==="?")Te(null),fe(K);else if(t)try{const Xe=await IN(t,K,Ce.staged);Te(Xe.content),fe(K)}catch{Te(null),fe(K)}}function Se(K){_(K),we(null),Z(Ce=>Ce.includes(K)?Ce.filter(Xe=>Xe!==K):[...Ce,K])}function je(K){const Ce=dt.current;if(!Ce||!Number.isFinite(K))return;const Xe=Ce.getBoundingClientRect(),Ge=Xe.height-hu;if(!Number.isFinite(Xe.top)||!Number.isFinite(Xe.height)||Ge<=0)return;const ut=(K-Xe.top-hu/2)/Ge*100;if(!Number.isFinite(ut))return;const dn=Math.max(Yx,Math.min(Kf,Math.round(ut)));lt(dn)}function $e(K){K.preventDefault(),je(K.clientY),Lt(!0)}const Ye=(p==null?void 0:p.changes)??[],Ee=Ye.filter(K=>zm(K,"staged")),Ue=Ye.filter(K=>zm(K,"unstaged")),ne=ok(Ee,"staged"),xe=ok(Ue,"unstaged"),Ze=new Set(J),ot=new Set($),It=ak($,Ye,"staged"),Ct=ak($,Ye,"unstaged"),Pt=Ye.length===0&&((p==null?void 0:p.snapshot.ahead)??0)>0,$t=Ee.length>0&&E.trim().length>0,me=(O==null?void 0:O.currentBranch)??(p==null?void 0:p.snapshot.branch)??u("common.unknown"),We=Number.isFinite(kt)?kt:Gf,Qe=W?`minmax(120px, ${We}fr) ${hu}px minmax(140px, ${100-We}fr)`:`minmax(120px, 1fr) ${hu}px auto`;b.useEffect(()=>{F==="staged"&&It.length===0&&we(null),F==="unstaged"&&Ct.length===0&&we(null)},[F,It.length,Ct.length]),b.useEffect(()=>{if(!re)return;const K=Ue.length>0?"unstaged":Ee.length>0?"staged":"history";be(Ce=>Ce==="unstaged"&&Ue.length>0||Ce==="staged"&&Ee.length>0?Ce:K)},[re,Ee.length,Ue.length]),b.useEffect(()=>{Ve&&(g.some(K=>K.commitHash===Ve)||ze(null))},[g,Ve]),b.useEffect(()=>{re&&ce!=="history"&&Q&&D(!1)},[re,Q,ce]);async function Be(K,Ce){var Xe;try{if(typeof navigator>"u"||!((Xe=navigator.clipboard)!=null&&Xe.writeText))throw new Error("clipboard unavailable");await navigator.clipboard.writeText(K),mt({title:Ce,tone:"success"})}catch{mt({title:u("common.copyContentFailed"),tone:"error"})}}async function Xt(K,Ce){typeof window<"u"&&!window.confirm(u("git.discardConfirm",{path:Ce}))||await zt(K)}function Ht(){return r.jsxs("div",{className:"git-operations-menu",children:[r.jsxs("div",{className:"git-menu-section",children:[r.jsx("span",{className:"git-menu-caption",children:u("git.currentBranch")}),r.jsx("strong",{className:"git-menu-branch",children:me})]}),r.jsxs("div",{className:"git-menu-section",children:[r.jsx("span",{className:"git-menu-caption",children:u("git.branchTitle")}),r.jsx("div",{className:"git-menu-branch-list",children:O==null?void 0:O.local.map(K=>r.jsx("button",{className:"git-menu-item",type:"button",disabled:z||K.current,onClick:()=>void Tn(K.name),children:r.jsx("span",{children:K.current?`${u("git.switchBranch")} ${K.name}`:`${u("git.switchBranchTo")} ${K.name}`})},K.name))})]}),r.jsxs("div",{className:"git-menu-section",children:[r.jsx("button",{className:"git-menu-item",type:"button",disabled:z,onClick:()=>void Qt("fetch"),children:r.jsx("span",{children:u("git.fetch")})}),r.jsx("button",{className:"git-menu-item",type:"button",disabled:z,onClick:()=>void Qt("pull"),children:r.jsx("span",{children:u("git.pull")})}),r.jsx("button",{className:"git-menu-item",type:"button",disabled:z,onClick:()=>void Qt("push"),children:r.jsx("span",{children:u("git.push")})}),r.jsx("button",{className:"git-menu-item",type:"button",disabled:z,onClick:()=>void rn(),children:r.jsx("span",{children:u("git.undoLastCommit")})}),r.jsx("button",{className:"git-menu-item",type:"button",disabled:z||I,onClick:()=>void Nt({resetTreeScroll:!0}),children:r.jsx("span",{children:u("git.refresh")})})]})]})}return r.jsxs("section",{className:["conversation-panel","surface-card","git-sidebar",e].filter(Boolean).join(" "),"data-testid":"git-sidebar",children:[r.jsxs("section",{className:"git-card git-scaffold-section",children:[r.jsxs("div",{className:"git-editor-row",children:[r.jsx("textarea",{ref:rt,rows:1,value:E,onChange:K=>M(XN(K.target.value)),onKeyDown:K=>{K.key==="Enter"&&K.preventDefault()},placeholder:u("git.commitSubjectPlaceholder")}),r.jsx("button",{className:"git-icon-button",type:"button","aria-label":u("git.generateDraft"),title:u("git.generateDraft"),onClick:()=>void Ie(),disabled:z||I,children:r.jsx(x5,{})})]}),r.jsxs("div",{className:"git-primary-actions",children:[r.jsx("button",{className:"secondary-button",type:"button",onClick:()=>void Nt({resetTreeScroll:!0}),disabled:z||I||!t,children:u("git.refreshNow")}),r.jsx("button",{className:"primary-button git-primary-submit",type:"button",onClick:()=>{if(Pt){ke();return}nn()},disabled:z||!Pt&&!$t,children:u(Pt?"git.pushNow":"git.commitNow")})]})]}),re?r.jsxs("div",{className:"git-mobile-sections",children:[r.jsx(Yf,{title:u("git.stagedChangesTitle"),count:Ee.length,expanded:ce==="staged",onToggle:()=>be("staged"),children:r.jsx(rk,{title:u("git.stagedChangesTitle"),nodes:ne,collapsedTreePathSet:Ze,onToggleTreePath:un,onToggleMobileSelection:Se,selectedMobilePathSet:ot,selectedTargets:It,actioning:z,variant:"staged",swipeRowState:ye,onSwipeRowChange:Fe,onStageToggle:ct,onDiscardWithConfirm:Xt,onClearSelectedTargets:()=>Z(K=>K.filter(Ce=>!It.includes(Ce))),onPreviewFile:de})}),r.jsx(Yf,{title:u("git.changesTitle"),count:Ue.length,expanded:ce==="unstaged",onToggle:()=>be("unstaged"),children:r.jsx(rk,{title:u("git.changesTitle"),nodes:xe,collapsedTreePathSet:Ze,onToggleTreePath:un,onToggleMobileSelection:Se,selectedMobilePathSet:ot,selectedTargets:Ct,actioning:z,variant:"unstaged",swipeRowState:ye,onSwipeRowChange:Fe,onStageToggle:ct,onDiscardWithConfirm:Xt,onClearSelectedTargets:()=>Z(K=>K.filter(Ce=>!Ct.includes(Ce))),onPreviewFile:de})}),r.jsxs(Yf,{title:u("git.recentVersionsTitle"),count:x,expanded:ce==="history",onToggle:()=>be("history"),trailingContent:r.jsx("span",{className:"badge",children:me}),headerAction:r.jsx("button",{className:"git-icon-button git-mobile-section-action",type:"button","aria-label":u("git.operationMenu"),title:u("git.operationMenu"),"aria-expanded":Q,onClick:()=>{be("history"),D(K=>!K)},disabled:z,children:r.jsx(Zu,{})}),children:[Q?r.jsx("div",{className:"git-mobile-operations-shell",children:Ht()}):null,r.jsx(g5,{history:g,historyLoadingMore:A,hasMore:!!C,actioning:z,openCommitHash:Ve,onToggleMenu:K=>ze(Ce=>Ce===K?null:K),onCopyCommitHash:K=>void Be(K,u("git.copyCommitHashSuccess")),onCopyCommitSubject:K=>void Be(K,u("git.copyCommitSubjectSuccess")),onUndoLastCommit:()=>void rn(),onLoadMore:()=>void Zt()})]})]}):r.jsxs("div",{ref:dt,className:"git-content-split",style:{gridTemplateRows:Qe},children:[r.jsx("section",{className:"git-card git-tree-panel",children:r.jsxs("div",{ref:St,className:"git-tree-panel-body",children:[Ee.length>0?r.jsx(nk,{title:u("git.stagedChangesTitle"),count:Ee.length,nodes:ne,selectedPath:q,collapsedTreePathSet:Ze,onToggleTreePath:un,onSelectFile:_,onPreviewFile:(K,Ce)=>{oe(K)&&de(K,Ce)},onToggleMobileSelection:Se,onStageToggle:ct,onDiscard:zt,actioning:z,variant:"staged",isMobileViewport:re,selectedMobilePathSet:ot,selectedTargets:It,mobileActionMenuOpen:F==="staged",onToggleMobileActionMenu:()=>we(K=>K==="staged"?null:"staged"),onClearSelectedTargets:()=>Z(K=>K.filter(Ce=>!It.includes(Ce)))}):null,r.jsx(nk,{title:u("git.changesTitle"),count:Ue.length,nodes:xe,selectedPath:q,collapsedTreePathSet:Ze,onToggleTreePath:un,onSelectFile:_,onPreviewFile:(K,Ce)=>{oe(K)&&de(K,Ce)},onToggleMobileSelection:Se,onStageToggle:ct,onDiscard:zt,actioning:z,variant:"unstaged",isMobileViewport:re,selectedMobilePathSet:ot,selectedTargets:Ct,mobileActionMenuOpen:F==="unstaged",onToggleMobileActionMenu:()=>we(K=>K==="unstaged"?null:"unstaged"),onClearSelectedTargets:()=>Z(K=>K.filter(Ce=>!Ct.includes(Ce)))})]})}),r.jsx("button",{className:"git-panel-divider",type:"button",role:"separator","aria-label":u("git.resizePanels"),"aria-orientation":"horizontal","aria-valuemin":Yx,"aria-valuemax":Kf,"aria-valuenow":W?We:Kf,"data-dragging":gt,onPointerDown:$e,children:r.jsx("span",{className:"git-panel-divider-handle","aria-hidden":"true"})}),r.jsxs("section",{className:"git-card git-history-section",children:[r.jsxs("div",{className:"git-history-topbar",children:[r.jsxs("button",{className:"git-section-toggle",type:"button","aria-expanded":W,"aria-label":u(W?"git.collapseRecentVersions":"git.expandRecentVersions"),onClick:()=>Y(K=>!K),children:[r.jsxs("span",{className:"git-section-toggle-main",children:[r.jsx(yd,{expanded:W}),r.jsx("span",{children:u("git.recentVersionsTitle")})]}),r.jsx("span",{className:"workbench-section-counter",children:x})]}),r.jsxs("div",{className:"git-history-actions",children:[r.jsx("span",{className:"badge",children:me}),r.jsx("button",{className:"git-icon-button",type:"button","aria-label":u("git.operationMenu"),title:u("git.operationMenu"),onClick:()=>D(K=>!K),disabled:z,children:r.jsx(Zu,{})}),Q?Ht():null]})]}),W?r.jsx("div",{className:"git-history-list",onScroll:ie,children:g.length?r.jsxs(r.Fragment,{children:[g.map(K=>r.jsxs("article",{className:"git-history-entry","data-kind":K.commitKind,children:[r.jsx("span",{className:"git-history-marker","data-kind":K.commitKind,"aria-hidden":"true"}),r.jsxs("div",{className:"git-history-body",children:[r.jsxs("div",{className:"git-history-title-row",children:[r.jsx("strong",{title:K.subject,children:K.subject}),r.jsx("span",{className:"git-history-kind-badge","data-kind":K.commitKind,children:JN(K.commitKind)})]}),K.refs.length>0?r.jsx("div",{className:"git-history-ref-list",children:K.refs.map(Ce=>r.jsx("span",{className:"git-history-ref-pill","data-kind":Ce.kind,"data-remote-index":String(ZN(Ce.remoteName)),children:Ce.name},`${K.commitHash}:${Ce.kind}:${Ce.name}`))}):null,r.jsxs("div",{className:"git-history-meta",children:[r.jsx("span",{className:"git-history-hash",children:K.commitHash.slice(0,8)}),r.jsx("span",{children:K.authorName}),r.jsx("time",{dateTime:K.authoredAt,children:e0(K.authoredAt)})]})]})]},K.commitHash)),A?r.jsxs("p",{className:"git-history-loading",children:[u("git.refreshNow"),"..."]}):null]}):r.jsx("p",{className:"status-text",children:u("git.noHistory")})}):null]})]}),r.jsxs(Un,{open:yt,title:u("git.selectRemoteTitle"),description:u("git.selectRemoteDesc"),onClose:()=>{z||ft(!1)},children:[r.jsx("div",{className:"git-remote-select-list",children:Ot.map(K=>{const Ce=Mt.has(K.name),Xe=Dt.get(K.name);return r.jsxs("label",{className:"git-remote-item",children:[r.jsx("input",{type:"checkbox",checked:Ce,disabled:z,onChange:()=>{xt(Ge=>{const ut=new Set(Ge);return ut.has(K.name)?ut.delete(K.name):ut.add(K.name),ut})}}),r.jsxs("span",{className:"git-remote-item-body",children:[r.jsx("span",{className:"git-remote-name",children:K.name}),r.jsx("span",{className:"git-remote-url",children:K.pushUrl}),Xe&&r.jsx("span",{className:`git-remote-result ${Xe.ok?"ok":"err"}`,children:Xe.summary})]})]},K.name)})}),r.jsxs("div",{className:"git-remote-actions",children:[r.jsx("button",{className:"secondary-button",type:"button",disabled:z,onClick:()=>ft(!1),children:u("common.close")}),r.jsx("button",{className:"primary-button",type:"button",disabled:z||Mt.size===0,onClick:()=>void it(Array.from(Mt)),children:z?u("git.pushing"):u("git.pushSelected",{count:String(Mt.size)})})]})]}),r.jsx(MN,{workspaceId:t,filePath:nt,open:nt!==null,onClose:()=>{fe(null),Te(null)},onSaved:async()=>{await Nt({resetTreeScroll:!0})},diffContent:ge})]})}function nk({title:e,count:t,nodes:n,selectedPath:i,collapsedTreePathSet:a,onToggleTreePath:c,onSelectFile:l,onPreviewFile:h,onToggleMobileSelection:f,onStageToggle:p,onDiscard:y,actioning:g,variant:w,isMobileViewport:x,selectedMobilePathSet:S,selectedTargets:C,mobileActionMenuOpen:P,onToggleMobileActionMenu:A,onClearSelectedTargets:L}){const O=lg(n),ee=u(w==="staged"?"git.unstageAll":"git.stageAll");return r.jsxs("section",{className:"git-tree-group","data-variant":w,children:[r.jsxs("div",{className:"git-section-header git-tree-group-header",children:[r.jsx("h3",{children:e}),r.jsxs("div",{className:"git-tree-group-actions",children:[r.jsx("span",{className:"workbench-section-counter",children:t}),!x&&O.length>0?r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"git-icon-button",type:"button","aria-label":ee,title:ee,onClick:()=>void p(O,w==="staged"),disabled:g,children:r.jsx(Hm,{staged:w==="staged"})}),w==="unstaged"?r.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":u("git.discardAll"),title:u("git.discardAll"),onClick:()=>void y(O),disabled:g,children:r.jsx(qm,{})}):null]}):null,x&&C.length>0?r.jsx("button",{className:"git-icon-button",type:"button","aria-label":u("git.operationMenu"),title:u("git.operationMenu"),onClick:A,disabled:g,children:r.jsx(Zu,{})}):null]}),x&&P?r.jsxs("div",{className:"git-selection-menu",children:[r.jsxs("div",{className:"git-menu-section",children:[r.jsx("span",{className:"git-menu-caption",children:u("git.selectedFiles")}),r.jsx("strong",{className:"git-menu-branch",children:C.length})]}),r.jsxs("div",{className:"git-menu-section",children:[r.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:()=>void p(C,w==="staged"),children:r.jsx("span",{children:u(w==="staged"?"git.unstage":"git.stage")})}),w==="unstaged"?r.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:()=>void y(C),children:r.jsx("span",{children:u("git.discard")})}):null,r.jsx("button",{className:"git-menu-item",type:"button",disabled:g,onClick:L,children:r.jsx("span",{children:u("git.clearSelection")})})]})]}):null]}),r.jsx("div",{className:"git-tree-shell",role:"tree","aria-label":e,children:n.length?KN({nodes:n,depth:0,collapsedTreePathSet:a,selectedPath:i,onToggleTreePath:c,onSelectFile:l,onPreviewFile:h,onToggleMobileSelection:f,onStageToggle:p,onDiscard:y,actioning:g,variant:w,isMobileViewport:x,selectedMobilePathSet:S}):r.jsx("p",{className:"git-tree-status",children:u("git.noChanges")})})]})}function Yf({title:e,count:t,expanded:n,onToggle:i,trailingContent:a,headerAction:c,children:l}){return r.jsxs("section",{className:"git-mobile-section","data-expanded":n,children:[r.jsxs("div",{className:"git-mobile-section-header",children:[r.jsxs("button",{className:"git-mobile-section-toggle",type:"button","aria-expanded":n,onClick:i,children:[r.jsxs("span",{className:"git-mobile-section-toggle-main",children:[r.jsx(yd,{expanded:n}),r.jsx("h3",{children:e})]}),r.jsxs("span",{className:"git-mobile-section-toggle-meta",children:[a,r.jsx("span",{className:"workbench-section-counter",children:t})]})]}),c?r.jsx("div",{className:"git-mobile-section-header-action",children:c}):null]}),n?r.jsx("div",{className:"git-mobile-section-body",children:l}):null]})}function rk({title:e,nodes:t,collapsedTreePathSet:n,onToggleTreePath:i,onToggleMobileSelection:a,selectedMobilePathSet:c,selectedTargets:l,actioning:h,variant:f,swipeRowState:p,onSwipeRowChange:y,onStageToggle:g,onDiscardWithConfirm:w,onClearSelectedTargets:x,onPreviewFile:S}){return r.jsxs("div",{className:"git-mobile-record-shell",children:[l.length>0?r.jsxs("div",{className:"git-mobile-selection-toolbar",children:[r.jsxs("span",{className:"git-mobile-selection-count",children:[u("git.selectedFiles")," ",l.length]}),r.jsxs("div",{className:"git-mobile-selection-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:h,onClick:()=>void g(l,f==="staged"),children:u(f==="staged"?"git.unstage":"git.stage")}),f==="unstaged"?r.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:h,onClick:()=>void w(l,`${l.length}`),children:u("git.discard")}):null,r.jsx("button",{type:"button",className:"secondary-button",disabled:h,onClick:x,children:u("git.clearSelection")})]})]}):null,r.jsx("div",{className:"git-mobile-record-list",role:"tree","aria-label":e,children:t.length?GN({nodes:t,depth:0,collapsedTreePathSet:n,onToggleTreePath:i,onToggleMobileSelection:a,selectedMobilePathSet:c,actioning:h,variant:f,swipeRowState:p,onSwipeRowChange:y,onStageToggle:g,onDiscardWithConfirm:w,onPreviewFile:S}):r.jsx("p",{className:"git-tree-status",children:u("git.noChanges")})})]})}function GN({nodes:e,depth:t,collapsedTreePathSet:n,onToggleTreePath:i,onToggleMobileSelection:a,selectedMobilePathSet:c,actioning:l,variant:h,swipeRowState:f,onSwipeRowChange:p,onStageToggle:y,onDiscardWithConfirm:g,onPreviewFile:w}){return e.map(x=>{if(x.kind==="directory"){const P=!n.has(x.path),A=lg(x.children),L=`directory:${x.path}`;return r.jsxs("div",{className:"git-mobile-record-branch",children:[r.jsx(ik,{rowKey:L,openState:(f==null?void 0:f.path)===L?f.direction:null,onOpenStateChange:O=>p(O?{path:L,direction:O}:null),trailingActions:A.length>0?[{label:u(h==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void y(A,h==="staged")},...h==="unstaged"?[{label:u("git.discard"),tone:"danger",onPress:()=>void g(A,x.path)}]:[]]:null,children:r.jsxs("button",{className:"git-mobile-record git-mobile-record-directory",type:"button",style:{paddingInlineStart:`${ek+t*tk}px`},onClick:()=>i(x.path),children:[r.jsxs("span",{className:"git-mobile-record-leading",children:[r.jsx("span",{className:"git-tree-chevron","data-expanded":P,children:r.jsx(yd,{expanded:P})}),r.jsx("span",{className:"git-mobile-record-title",children:x.name})]}),r.jsx("span",{className:"git-mobile-record-meta",children:A.length})]})}),P?r.jsx("div",{className:"git-mobile-record-children",role:"group",children:GN({nodes:x.children,depth:t+1,collapsedTreePathSet:n,onToggleTreePath:i,onToggleMobileSelection:a,selectedMobilePathSet:c,actioning:l,variant:h,swipeRowState:f,onSwipeRowChange:p,onStageToggle:y,onDiscardWithConfirm:g,onPreviewFile:w})}):null]},L)}const S=`file:${x.path}`,C=c.has(x.path);return r.jsx(ik,{rowKey:S,openState:(f==null?void 0:f.path)===S?f.direction:null,onOpenStateChange:P=>p(P?{path:S,direction:P}:null),trailingActions:[{label:u("git.preview"),tone:"neutral",onPress:()=>w(x.change.path,x.change)},{label:u(h==="staged"?"git.unstage":"git.stage"),tone:"accent",onPress:()=>void y([x.change.path],h==="staged")},...h==="unstaged"?[{label:u("git.discard"),tone:"danger",onPress:()=>void g([x.change.path],x.path)}]:[]],children:r.jsxs("div",{className:"git-mobile-record git-mobile-record-file","data-active":C,style:{paddingInlineStart:`${ek+t*tk}px`},children:[r.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:C,"aria-label":`${u("git.selectFile")} ${x.name}`,onChange:()=>a(x.change.path)}),r.jsxs("button",{className:"git-mobile-record-file-main",type:"button",onClick:()=>a(x.change.path),children:[r.jsx("span",{className:"git-tree-file-icon","data-kind":mo(x.name),"aria-hidden":"true",children:fo(x.name)}),r.jsxs("span",{className:"git-mobile-record-copy",children:[r.jsx("span",{className:"git-mobile-record-title",children:x.name}),r.jsx("span",{className:"git-mobile-record-path",children:x.path})]}),r.jsx("span",{className:"git-status-badge","data-status":x.status,children:x.status})]})]})},S)})}function ik({rowKey:e,openState:t,onOpenStateChange:n,trailingActions:i,children:a}){const c=Yr(),l=b.useRef(null),[h,f]=b.useState(0),p=((i==null?void 0:i.length)??0)*Qf;b.useEffect(()=>{t||f(0)},[t,e]);const y=h!==0?h:t==="trailing"?-p:0;function g(C){var P,A;C.button===0&&(l.current={pointerId:C.pointerId,startX:C.clientX},(A=(P=C.currentTarget).setPointerCapture)==null||A.call(P,C.pointerId))}function w(C){const P=l.current;if(!P||P.pointerId!==C.pointerId)return;const A=p>0?p+10:0,L=Math.max(-A,Math.min(0,C.clientX-P.startX));f(L)}function x(C){var A,L;const P=l.current;if(!(!P||P.pointerId!==C.pointerId)){if((L=(A=C.currentTarget).releasePointerCapture)==null||L.call(A,C.pointerId),l.current=null,h<=-44&&(i!=null&&i.length)){c.trigger("gesture"),n("trailing"),f(0);return}n(null),f(0)}}function S(C){var A,L;const P=l.current;!P||P.pointerId!==C.pointerId||((L=(A=C.currentTarget).releasePointerCapture)==null||L.call(A,C.pointerId),l.current=null,f(0))}return r.jsxs("div",{className:"git-mobile-swipe-row","data-open-state":t??"closed","data-dragging":h!==0,children:[i==null?void 0:i.map((C,P)=>r.jsx("button",{type:"button",className:"git-mobile-swipe-action trailing","data-tone":C.tone,style:{right:P*Qf,width:Qf},onClick:()=>{c.trigger(C.tone==="danger"?"warning":"action"),n(null),C.onPress()},children:C.label},`trailing-${P}`)),r.jsx("div",{className:"git-mobile-swipe-content",style:{transform:`translateX(${y}px)`},onPointerDown:g,onPointerMove:w,onPointerUp:x,onPointerCancel:S,children:a})]})}function g5({history:e,historyLoadingMore:t,hasMore:n,actioning:i,openCommitHash:a,onToggleMenu:c,onCopyCommitHash:l,onCopyCommitSubject:h,onUndoLastCommit:f,onLoadMore:p}){return e.length?r.jsxs("div",{className:"git-mobile-history-list",children:[e.map((y,g)=>{const w=a===y.commitHash,x=g===0&&y.commitKind==="local";return r.jsxs("article",{className:"git-mobile-history-entry","data-kind":y.commitKind,children:[r.jsxs("div",{className:"git-mobile-history-entry-main",children:[r.jsx("span",{className:"git-history-marker","data-kind":y.commitKind,"aria-hidden":"true"}),r.jsxs("div",{className:"git-mobile-history-copy",children:[r.jsxs("div",{className:"git-history-title-row",children:[r.jsx("strong",{title:y.subject,children:y.subject}),r.jsx("span",{className:"git-history-kind-badge","data-kind":y.commitKind,children:JN(y.commitKind)})]}),y.refs.length>0?r.jsx("div",{className:"git-history-ref-list",children:y.refs.map(S=>r.jsx("span",{className:"git-history-ref-pill","data-kind":S.kind,"data-remote-index":String(ZN(S.remoteName)),children:S.name},`${y.commitHash}:${S.kind}:${S.name}`))}):null,r.jsxs("div",{className:"git-history-meta",children:[r.jsx("span",{className:"git-history-hash",children:y.commitHash.slice(0,8)}),r.jsx("span",{children:y.authorName}),r.jsx("time",{dateTime:y.authoredAt,children:e0(y.authoredAt)})]})]}),r.jsx("button",{type:"button",className:"git-icon-button","aria-label":u("git.historyItemMenu"),onClick:()=>c(y.commitHash),children:r.jsx(Zu,{})})]}),w?r.jsxs("div",{className:"git-mobile-history-menu",children:[r.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>l(y.commitHash),children:r.jsx("span",{children:u("git.copyCommitHash")})}),r.jsx("button",{type:"button",className:"git-menu-item",onClick:()=>h(y.subject),children:r.jsx("span",{children:u("git.copyCommitSubject")})}),x?r.jsx("button",{type:"button",className:"git-menu-item",disabled:i,onClick:f,children:r.jsx("span",{children:u("git.undoLastCommit")})}):null]}):null]},y.commitHash)}),n?r.jsx("button",{type:"button",className:"secondary-button git-mobile-history-more",disabled:t,onClick:p,children:t?`${u("git.refreshNow")}...`:u("common.loadMore")}):null]}):r.jsx("p",{className:"git-tree-status",children:u("git.noHistory")})}function KN({nodes:e,depth:t,collapsedTreePathSet:n,selectedPath:i,onToggleTreePath:a,onSelectFile:c,onPreviewFile:l,onToggleMobileSelection:h,onStageToggle:f,onDiscard:p,actioning:y,variant:g,isMobileViewport:w,selectedMobilePathSet:x}){return e.map(S=>{if(S.kind==="directory"){const A=!n.has(S.path),L=lg(S.children),O=`${u(g==="staged"?"git.unstage":"git.stage")} ${S.path}`,ee=`${u("git.discard")} ${S.path}`;return r.jsxs("div",{className:"git-tree-node",children:[r.jsxs("div",{className:"git-tree-row",role:"treeitem","aria-expanded":A,children:[r.jsxs("button",{className:"git-tree-trigger",type:"button",style:{paddingInlineStart:`${6+t*8}px`},onClick:()=>a(S.path),children:[r.jsx("span",{className:"git-tree-chevron","data-expanded":A,children:r.jsx(yd,{expanded:A})}),r.jsx("span",{className:"git-tree-label git-tree-label-directory",children:S.name})]}),!w&&L.length>0?r.jsxs("div",{className:"git-row-actions",children:[r.jsx("button",{className:"git-icon-button",type:"button","aria-label":O,title:O,onClick:()=>void f(L,g==="staged"),disabled:y,children:r.jsx(Hm,{staged:g==="staged"})}),g==="unstaged"?r.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":ee,title:ee,onClick:()=>void p(L),disabled:y,children:r.jsx(qm,{})}):null]}):null]}),A?r.jsx("div",{className:"git-tree-children",role:"group",children:KN({nodes:S.children,depth:t+1,collapsedTreePathSet:n,selectedPath:i,onToggleTreePath:a,onSelectFile:c,onPreviewFile:l,onToggleMobileSelection:h,onStageToggle:f,onDiscard:p,actioning:y,variant:g,isMobileViewport:w,selectedMobilePathSet:x})}):null]},`directory:${S.path}`)}const C=x.has(S.path),P=w?C:i===S.path;return w?r.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":P,"data-mobile":"true",children:[r.jsx("input",{className:"git-tree-select-checkbox",type:"checkbox",checked:C,"aria-label":`${u("git.selectFile")} ${S.name}`,onChange:()=>h(S.change.path)}),r.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":P,"data-mobile":"true",style:{paddingInlineStart:`${18+t*8}px`},onClick:()=>h(S.change.path),children:[r.jsx("span",{className:"git-tree-file-icon","data-kind":mo(S.name),"aria-hidden":"true",children:fo(S.name)}),r.jsx("span",{className:"git-tree-label-wrap",children:r.jsx("span",{className:"git-tree-label",children:S.name})}),r.jsx("span",{className:"git-tree-file-meta",children:r.jsx("span",{className:"git-status-badge","data-status":S.status,children:S.status})})]})]},`file:${S.path}`):r.jsxs("div",{className:"git-tree-row",role:"treeitem","data-active":P,children:[r.jsxs("button",{className:"git-tree-file-button",type:"button","data-active":P,style:{paddingInlineStart:`${18+t*8}px`},onClick:()=>{c(S.change.path),l&&l(S.change.path,S.change)},children:[r.jsx("span",{className:"git-tree-file-icon","data-kind":mo(S.name),"aria-hidden":"true",children:fo(S.name)}),r.jsx("span",{className:"git-tree-label-wrap",children:r.jsx("span",{className:"git-tree-label",children:S.name})}),r.jsx("span",{className:"git-tree-file-meta",children:r.jsx("span",{className:"git-status-badge","data-status":S.status,children:S.status})})]}),r.jsxs("div",{className:"git-row-actions",children:[r.jsx("button",{className:"git-icon-button",type:"button","aria-label":S.variant==="staged"?u("git.unstage"):u("git.stage"),title:S.variant==="staged"?u("git.unstage"):u("git.stage"),onClick:()=>void f([S.change.path],S.variant==="staged"),disabled:y,children:r.jsx(Hm,{staged:S.variant==="staged"})}),g==="unstaged"?r.jsx("button",{className:"git-icon-button danger",type:"button","aria-label":u("git.discard"),title:u("git.discard"),onClick:()=>void p([S.change.path]),disabled:y,children:r.jsx(qm,{})}):null]})]},`file:${S.path}`)})}function sk(e,t){return{kind:"directory",name:e,path:t,children:new Map}}function ok(e,t){const n=sk("","");for(const i of e){const a=i.path.replace(/\\/g,"/"),c=a.split("/").filter(Boolean);let l=n;c.forEach((h,f)=>{const p=c.slice(0,f+1).join("/");if(f===c.length-1){l.children.set(`file:${p}`,{kind:"file",name:h,path:a,change:i,status:b5(i,t),variant:t});return}const y=`directory:${p}`,g=l.children.get(y);if(g&&g.kind==="directory"){l=g;return}const w=sk(h,p);l.children.set(y,w),l=w})}return YN(QN([...n.children.values()]))}function QN(e){return[...e].sort((t,n)=>t.kind!==n.kind?t.kind==="directory"?-1:1:t.name.localeCompare(n.name,"zh-CN")).map(t=>t.kind==="directory"?{kind:"directory",name:t.name,path:t.path,children:QN([...t.children.values()])}:t)}function YN(e){return e.map(t=>{var l;if(t.kind!=="directory")return t;const n=YN(t.children);let i=t.name,a=t.path,c=n;for(;c.length===1&&((l=c[0])==null?void 0:l.kind)==="directory";){const h=c[0];i=`${i}/${h.name}`,a=h.path,c=h.children}return{kind:"directory",name:i,path:a,children:c}})}function ak(e,t,n){const i=new Set(e);return t.filter(a=>zm(a,n)&&i.has(a.path)).map(a=>a.path)}function lg(e){const t=[],n=new Set;function i(a){if(a.kind==="file"){n.has(a.path)||(n.add(a.path),t.push(a.path));return}a.children.forEach(i)}return e.forEach(i),t}function zm(e,t){return t==="staged"?!!e.stagedStatus:!!e.worktreeStatus}function b5(e,t){return t==="staged"?e.stagedStatus??e.status:e.worktreeStatus??e.status}function y5(e){return{subject:XN(e).trim(),body:null,footer:null,source:"manual"}}function XN(e){return e.replace(/[\r\n]+/g," ")}function v5(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 JN(e){switch(e){case"local":return u("git.historyKindLocal");case"remote":return u("git.historyKindRemote");default:return u("git.historyKindShared")}}function ZN(e){if(!e)return 0;let t=0;for(const n of e)t=t*33+n.charCodeAt(0)>>>0;return t%6}function oi(e,t){return e instanceof mr?w5(e)??e.message:typeof e=="object"&&e&&"message"in e?e.message:t}function Xf(e){return`git-sidebar.snapshot.${e}`}function w5(e){switch(e.errorCode){case"UNAUTHORIZED":return u("git.errors.unauthorized");case"WORKSPACE_NOT_FOUND":return u("git.errors.workspaceNotFound");case"INVALID_WORKSPACE":return u("git.errors.invalidWorkspace");case"NOT_GIT_REPOSITORY":return u("git.errors.notGitRepository");case"GIT_REPO_NOT_FOUND":return u("git.errors.repoNotFound");case"PATH_OUT_OF_WORKSPACE":return u("git.errors.pathOutOfWorkspace");case"INVALID_TARGET":return u("git.errors.invalidTarget");case"NOT_STAGED":return u("git.errors.notStaged");case"EMPTY_STAGED_CHANGES":return u("git.errors.emptyStagedChanges");case"BRANCH_CONFLICT":return u("git.errors.branchConflict");case"BRANCH_NOT_FOUND":return u("git.errors.branchNotFound");case"REMOTE_NOT_FOUND":return u("git.errors.remoteNotFound");case"GIT_REMOTE_AUTH_FAILED":return u("git.errors.remoteAuthFailed");case"GIT_PUSH_FAILED":return u("git.errors.pushFailed");case"GIT_PULL_FAILED":return u("git.errors.pullFailed");case"GIT_REMOTE_FAILED":return u("git.errors.remoteFailed");case"GIT_COMMAND_TIMEOUT":return u("git.errors.commandTimeout");case"GIT_DISCARD_FAILED":return u("git.discardFailed");case"GIT_UNDO_FAILED":return u("git.undoLastCommitFailed");default:return null}}function yd({expanded:e}){return r.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:r.jsx("polyline",{points:"6 9 12 15 18 9"})})}function Hm({staged:e}){return e?r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:r.jsx("path",{d:"M5 12h14"})}):r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[r.jsx("path",{d:"M12 5v14"}),r.jsx("path",{d:"M5 12h14"})]})}function qm(){return r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:[r.jsx("path",{d:"M10 7L6 11l4 4",strokeLinecap:"round",strokeLinejoin:"round"}),r.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 x5(){return r.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:r.jsx("path",{d:"M12 3l1.9 5.1L19 10l-5.1 1.9L12 17l-1.9-5.1L5 10l5.1-1.9L12 3z"})})}function Zu(){return r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[r.jsx("circle",{cx:"5",cy:"12",r:"1.8"}),r.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),r.jsx("circle",{cx:"19",cy:"12",r:"1.8"})]})}function e0(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 k5=Object.freeze(Object.defineProperty({__proto__:null,GitSidebar:ag},Symbol.toStringTag,{value:"Module"}));function nH(){return De.request("/api/terminals/shells")}function rH(e){return De.request(`/api/terminals?workspaceId=${encodeURIComponent(e)}`)}function S5(e){return De.request(`/api/terminals/templates/${encodeURIComponent(e)}/stop`,{method:"POST"})}function iH(e){return De.request("/api/terminals",{method:"POST",body:JSON.stringify(e)})}function sH(e){return De.request(`/api/terminals/${encodeURIComponent(e)}`,{method:"DELETE"})}function oH(e){return De.request(`/api/terminals/${encodeURIComponent(e)}/record`,{method:"DELETE"})}function aH(e,t={}){const n=new URLSearchParams;typeof t.beforeSeq=="number"&&n.set("beforeSeq",String(t.beforeSeq)),typeof t.limit=="number"&&n.set("limit",String(t.limit));const i=n.toString();return De.request(`/api/terminals/${encodeURIComponent(e)}/history${i?`?${i}`:""}`)}function C5(e){return De.request("/api/terminals/templates",{method:"POST",body:JSON.stringify(e)})}function j5(e,t){return De.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function N5(e){return De.request(`/api/terminals/templates/${encodeURIComponent(e)}`,{method:"DELETE"})}function lk(e,t){return De.request(`/api/terminals/templates/${encodeURIComponent(e)}/run`,{method:"POST",body:JSON.stringify(t)})}function P5(e){return[{value:"",label:u("terminal.runtimeAutoOption"),description:u("terminal.runtimeAutoDescription")},{value:"tmux",label:e==="windows"?u("terminal.runtimePersistentLabel"):"tmux",description:u(e==="windows"?"terminal.runtimeWindowsPersistentDescription":"terminal.runtimeTmuxDescription")},{value:"embedded-pty",label:"embedded-pty",description:u("terminal.runtimeEmbeddedDescription")}]}function ck(e,t){return e?e==="conpty-powershell"?u("terminal.runtimeConptyPowerShellLabel"):e==="conpty-cmd"?u("terminal.runtimeConptyCmdLabel"):e==="conpty-git-bash"?u("terminal.runtimeConptyGitBashLabel"):e==="tmux"&&t==="windows"?u("terminal.runtimePersistentLabel"):e:u("terminal.runtimeAutoOption")}function lH(e,t){return e?e==="embedded-pty"?"pty":e==="conpty-powershell"||e==="conpty-cmd"||e==="conpty-git-bash"||e==="tmux"&&t==="windows"?u("terminal.runtimePersistentShortLabel"):e:u("terminal.runtimeAutoShortLabel")}function T5(e){return e instanceof mr?e.errorCode==="RUNTIME_DEPENDENCY_MISSING"||e.message.includes("当前系统未安装 tmux"):!1}function R5({open:e,busy:t=!1,onClose:n,onConfirmFallback:i}){return b.useEffect(()=>{if(!e)return;function a(c){c.key==="Escape"&&!t&&n()}return window.addEventListener("keydown",a),()=>{window.removeEventListener("keydown",a)}},[t,n,e]),!e||typeof document>"u"?null:Qn.createPortal(r.jsxs("div",{className:"workbench-modal-layer",children:[r.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":u("common.close"),onClick:()=>{t||n()}}),r.jsxs("section",{className:"workbench-modal-card surface-card terminal-runtime-fallback-modal",role:"dialog","aria-modal":"true","aria-label":u("terminal.runtimeMissingDialogTitle"),children:[r.jsxs("div",{className:"workbench-modal-header",children:[r.jsxs("div",{className:"workbench-modal-title-wrap",children:[r.jsx("h2",{children:u("terminal.runtimeMissingDialogTitle")}),r.jsx("p",{children:u("terminal.runtimeMissingDialogDescription")})]}),r.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":u("common.close"),onClick:()=>{t||n()},children:"x"})]}),r.jsxs("div",{className:"workbench-modal-body terminal-runtime-fallback-body",children:[r.jsxs("section",{className:"terminal-runtime-fallback-section",children:[r.jsx("span",{className:"badge","data-tone":"error",children:"tmux"}),r.jsx("p",{className:"status-text",children:u("terminal.runtimeMissingInstallDescription")}),r.jsxs("ul",{className:"terminal-runtime-fallback-list",children:[r.jsx("li",{children:u("terminal.runtimeMissingInstallMacArm")}),r.jsx("li",{children:u("terminal.runtimeMissingInstallMacIntel")}),r.jsx("li",{children:u("terminal.runtimeMissingInstallDebian")}),r.jsx("li",{children:u("terminal.runtimeMissingInstallFedora")})]})]}),r.jsxs("section",{className:"terminal-runtime-fallback-section",children:[r.jsx("span",{className:"badge",children:"embedded-pty"}),r.jsx("p",{className:"status-text",children:u("terminal.runtimeMissingFallbackDescription")})]}),r.jsxs("div",{className:"workbench-modal-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:n,children:u("terminal.runtimeMissingKeepAction")}),r.jsx("button",{type:"button",className:"primary-button",disabled:t,onClick:i,children:u(t?"terminal.runtimeMissingFallbackPending":"terminal.runtimeMissingFallbackAction")})]})]})]})]}),document.body)}const fu={mode:"command",name:"",cwd:"",target:"",args:"",port:"",proxyEnabled:!1},uk=60*1e3;function E5(e){return e?new Date(e).toLocaleString():u("common.unknown")}function A5(e){return e.split(" ").map(t=>t.trim()).filter(Boolean)}function I5(e){var t,n,i;return((t=e.find(a=>a.id==="cmd"&&a.available))==null?void 0:t.id)??((n=e.find(a=>a.available))==null?void 0:n.id)??((i=e[0])==null?void 0:i.id)??""}function L5(e){const t=e.name.trim();if(t)return t;const n=e.target.trim(),i=e.args.trim();return n?i?`${n} ${i}`:n:e.mode==="script"?u("terminalManager.defaultScriptName"):u("terminalManager.defaultCommandName")}function M5(e){const t=e.args.join(" ");return t?`${e.command} ${t}`:e.command}function D5(e){return{mode:t0(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 F5(e){return Qm(`/proxy/${encodeURIComponent(e)}`)}function t0(e){const t=e.command.toLowerCase();return t.endsWith(".ps1")||t.endsWith(".bat")||t.endsWith(".cmd")||t.endsWith(".sh")?"script":"command"}function _5(e){const t=e.trim();if(!t)return null;const n=Number(t);return Number.isInteger(n)?n:Number.NaN}function dk(e,t){return e.get(t)??null}function O5(e,t){return e.port===null?{tone:"untracked",title:u("terminalManager.portUnset"),summary:u("terminalManager.portUnsetDescription"),badgeLabel:u("terminalManager.portUnset")}:t!=null&&t.occupied?{tone:"running",title:u("terminalManager.portOccupied"),summary:t.processName||u("terminalManager.processCommandFallback"),badgeLabel:t.processId?`PID ${t.processId}`:u("terminalManager.statusRunning"),badgeTone:"success"}:{tone:"idle",title:u("terminalManager.portAvailable"),summary:u("terminalManager.portAvailableDescription"),badgeLabel:u("terminalManager.statusStopped")}}function B5({open:e,title:t,description:n,onClose:i,children:a,className:c}){return b.useEffect(()=>{if(!e)return;function l(h){h.key==="Escape"&&i()}return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[i,e]),!e||typeof document>"u"?null:Qn.createPortal(r.jsxs("div",{className:"workbench-modal-layer",children:[r.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":u("common.close"),onClick:i}),r.jsxs("section",{className:["workbench-modal-card","surface-card","terminal-manager-modal-card",c].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-label":t,children:[r.jsxs("div",{className:"workbench-modal-header",children:[r.jsxs("div",{className:"workbench-modal-title-wrap",children:[r.jsx("h2",{children:t}),r.jsx("p",{children:n})]}),r.jsx("button",{type:"button",className:"workbench-modal-close","aria-label":u("common.close"),onClick:i,children:"x"})]}),r.jsx("div",{className:"workbench-modal-body",children:a})]})]}),document.body)}function U5({open:e,busy:t,title:n,description:i,confirmLabel:a,onClose:c,onConfirm:l,className:h}){return b.useEffect(()=>{if(!e)return;function f(p){p.key==="Escape"&&!t&&c()}return window.addEventListener("keydown",f),()=>{window.removeEventListener("keydown",f)}},[t,c,e]),!e||typeof document>"u"?null:Qn.createPortal(r.jsxs("div",{className:"workbench-modal-layer",children:[r.jsx("button",{type:"button",className:"workbench-modal-backdrop","aria-label":u("common.close"),disabled:t,onClick:c}),r.jsxs("section",{className:["workbench-modal-card","surface-card",h].filter(Boolean).join(" "),role:"dialog","aria-modal":"true","aria-label":n,children:[r.jsx("div",{className:"workbench-modal-header",children:r.jsxs("div",{className:"workbench-modal-title-wrap",children:[r.jsx("h2",{children:n}),r.jsx("p",{children:i})]})}),r.jsx("div",{className:"workbench-modal-body",children:r.jsxs("div",{className:"workbench-modal-actions terminal-manager-confirm-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",disabled:t,onClick:c,children:u("common.cancel")}),r.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:t,onClick:()=>{l()},children:t?u("terminalManager.templateRemoving"):a})]})})]})]}),document.body)}function hk({label:e,value:t,options:n,open:i,onToggle:a,onChange:c}){const l=n.find(h=>h.value===t)??n[0]??null;return r.jsxs("div",{className:"field-group terminal-manager-mobile-picker",children:[r.jsx("span",{children:e}),r.jsxs("button",{type:"button",className:"terminal-manager-mobile-picker-trigger","aria-label":`${e} ${(l==null?void 0:l.label)??""}`.trim(),"aria-expanded":i?"true":"false",onClick:a,children:[r.jsxs("span",{className:"terminal-manager-mobile-picker-copy",children:[r.jsx("strong",{children:(l==null?void 0:l.label)??u("common.unknown")}),l!=null&&l.description?r.jsx("span",{children:l.description}):null]}),r.jsx(W5,{expanded:i})]}),i?r.jsx("div",{className:"terminal-manager-mobile-picker-list",role:"listbox","aria-label":e,children:n.map(h=>{const f=h.value===t;return r.jsxs("button",{type:"button",role:"option",className:"terminal-manager-mobile-picker-option","aria-selected":f,disabled:h.disabled,onClick:()=>{c(h.value)},children:[r.jsxs("span",{className:"terminal-manager-mobile-picker-option-copy",children:[r.jsx("strong",{children:h.label}),h.description?r.jsx("span",{children:h.description}):null]}),r.jsx("span",{className:"terminal-manager-mobile-picker-option-indicator","aria-hidden":"true",children:f?r.jsx(H5,{}):r.jsx(z5,{})})]},h.value||"__empty__")})}):null]})}function W5({expanded:e}){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",className:"terminal-manager-mobile-picker-chevron","data-expanded":e?"true":"false",children:r.jsx("path",{d:"M4 6.5L8 10l4-3.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.7"})})}function z5(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function H5(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.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 cg({className:e,currentWorkspaceId:t,navigationGroups:n,externalWindowMode:i=!1,workbenchShellOverrides:a}){var At,vt,Nt,Zt;const c=zn(),l=Yn(),{subscribeTerminalManagerSnapshot:h,requestTerminalManagerRefresh:f,addTerminalManagerSnapshotListener:p}={...l,...a},y=(t==null?void 0:t.trim())||null,[g,w]=b.useState([]),[x,S]=b.useState([]),[C,P]=b.useState([]),[A,L]=b.useState([]),[O,ee]=b.useState(""),[q,_]=b.useState(""),[E,M]=b.useState(fu),[I,N]=b.useState(null),[z,G]=b.useState(null),[J,B]=b.useState([]),[W,Y]=b.useState(!1),[Q,D]=b.useState(!1),[re,R]=b.useState(null),[$,Z]=b.useState(null),[F,we]=b.useState(null),[ce,be]=b.useState(null),[Ve,ze]=b.useState(null),[yt,ft]=b.useState(!1),[Ot,Ke]=b.useState(null),{showToast:jt}=En(),pt=(e==null?void 0:e.includes("mobile-tool-process-panel"))??!1,Mt=I!==null,xt=I==="edit"?x.find(ie=>ie.id===z)??null:null,Dt=I==="edit";b.useEffect(()=>{_t("terminal_manager.props",{currentWorkspaceId:t,workspaceCount:n.length,externalWindowMode:i})},[t,i,n.length]);const wt=b.useMemo(()=>A.find(ie=>ie.id===O)??null,[O,A]),ye=b.useMemo(()=>P5(c.ui.osFamily),[c.ui.osFamily]),Fe=b.useMemo(()=>new Map(C.map(ie=>[ie.templateId,ie])),[C]),kt=b.useMemo(()=>C.filter(ie=>ie.occupied).length,[C]),lt=b.useMemo(()=>x.filter(ie=>ie.port!==null).length,[x]),gt=(wt==null?void 0:wt.available)===!1&&A.length>0;b.useEffect(()=>{ee(ie=>A.length?ie&&A.some(Ie=>Ie.id===ie)?ie:I5(A):"")},[A]),b.useEffect(()=>{!Mt||!y||A.length>0||nt(y)},[y,A.length,Mt]),b.useEffect(()=>{Mt||Ke(null)},[Mt]),b.useEffect(()=>{I==="edit"&&z&&!xt&&(N(null),G(null),M(fu),_(""),Ke(null))},[xt,z,I]),b.useEffect(()=>{!ce||F===ce.templateId||x.some(ie=>ie.id===ce.templateId)||be(null)},[ce,F,x]),b.useEffect(()=>{if(!y){w([]),S([]),P([]),Y(!1);return}const ie=Kn(Jf(y),uk);_t("terminal_manager.snapshot",{workspaceId:y,cached:!!ie,cachedTemplateCount:(ie==null?void 0:ie.templates.length)??0,cachedStatusCount:(ie==null?void 0:ie.templateStatuses.length)??0}),ie?(w(ie.terminals),S(ie.templates),P(ie.templateStatuses),L(ie.shellOptions??[]),Y(!1)):(w([]),S([]),P([]),L([]),Y(!0))},[y]),b.useEffect(()=>{if(y)return p(ie=>{ie.workspaceId===y&&(_t("terminal_manager.snapshot_received",{workspaceId:ie.workspaceId,terminalCount:ie.terminals.length,templateCount:ie.templates.length,statusCount:ie.templateStatuses.length}),Lt(ie),Y(!1))})},[y,p]),b.useEffect(()=>{if(!y)return;const ie=Kn(Jf(y),uk)!==null;if(h(y),ie){const Ie=window.setTimeout(()=>{nt(y)},1500);return()=>{window.clearTimeout(Ie)}}nt(y)},[y,f,h]),b.useEffect(()=>{y&&Fr(Jf(y),{terminals:g,templates:x,templateStatuses:C,shellOptions:A})},[y,A,C,x,g]);function Lt(ie){w(ie.terminals),S(ie.templates),P(ie.templateStatuses),L(ie.shellOptions??[])}function nt(ie){_t("terminal_manager.refresh_requested",{workspaceId:ie}),f(ie)}function fe(){N(null),G(null),M(fu),_(""),Ke(null)}function ge(){G(null),M(fu),_(""),N("create")}function Te(ie){G(ie.id),M(D5(ie)),_(ie.runtimeType??""),N("edit")}async function qe(ie){if(y){Z(ie);try{await S5(ie),nt(y),jt({title:u("terminalManager.stopProcessSuccess"),tone:"success"})}catch(Ie){jt({title:Ie instanceof Error?Ie.message:u("terminalManager.stopProcessFailed"),tone:"error"})}finally{Z(null)}}}async function dt(){if(!y||!E.target.trim())return;const ie=_5(E.port);if(Number.isNaN(ie)){jt({title:u("terminalManager.invalidPort"),tone:"error"});return}if(E.proxyEnabled&&ie===null){jt({title:u("terminalManager.proxyPortRequired"),tone:"error"});return}D(!0);try{const Ie={workspaceId:y,name:L5(E),cwd:E.cwd.trim()||void 0,command:E.target.trim(),args:A5(E.args),port:ie,proxyEnabled:E.proxyEnabled,runtimeType:q||null};if(Dt&&z){const ct=await j5(z,Ie);S(zt=>zt.map(nn=>nn.id===ct.id?ct:nn))}else await C5(Ie);fe(),nt(y),jt({title:u(Dt?"terminalManager.templateUpdateSuccess":"terminalManager.templateSaveSuccess"),tone:"success"})}catch(Ie){jt({title:Ie instanceof Error?Ie.message:u(Dt?"terminalManager.templateUpdateFailed":"terminalManager.templateSaveFailed"),tone:"error"})}finally{D(!1)}}async function St(ie){const Ie=await c.bridge.openExternal(ie);Ie.ok||jt({title:Ie.detail||u("terminalManager.openProxyUrlFailed"),tone:"error"})}async function rt(ie,Ie){if(y){we(ie.id);try{await N5(ie.id),S(ct=>ct.filter(zt=>zt.id!==ie.id)),P(ct=>ct.filter(zt=>zt.templateId!==ie.id)),B(ct=>ct.filter(zt=>zt!==ie.id)),be(ct=>(ct==null?void 0:ct.templateId)===ie.id?null:ct),z===ie.id&&fe(),nt(y),jt({title:u("terminalManager.templateDeleteSuccess"),tone:"success"})}catch(ct){jt({title:ct instanceof Error?ct.message:u("terminalManager.templateDeleteFailed"),tone:"error"})}finally{we(null)}}}async function Ut(ie){if(!y)return;const Ie=wt!=null&&wt.available?wt.shell:void 0;R(ie);try{await lk(ie,{shell:Ie}),nt(y),jt({title:u("terminalManager.templateRunSuccess"),tone:"success"})}catch(ct){if(T5(ct)){ze({templateId:ie,shell:Ie});return}jt({title:ct instanceof Error?ct.message:u("terminalManager.templateRunFailed"),tone:"error"})}finally{R(null)}}async function mt(){if(!(!y||!Ve)){ft(!0);try{await lk(Ve.templateId,{shell:Ve.shell,runtimeType:"embedded-pty"}),ze(null),nt(y),jt({title:u("terminalManager.templateRunSuccess"),tone:"success"})}catch(ie){jt({title:ie instanceof Error?ie.message:u("terminalManager.templateRunFailed"),tone:"error"})}finally{ft(!1)}}}function Bt(ie){B(Ie=>Ie.includes(ie)?Ie.filter(ct=>ct!==ie):[...Ie,ie])}return n.length?y?r.jsxs("section",{className:["conversation-panel","surface-card","terminal-manager-panel",e].filter(Boolean).join(" "),children:[r.jsx(R5,{open:Ve!==null,busy:yt,onClose:()=>{yt||ze(null)},onConfirmFallback:()=>{mt()}}),r.jsxs("div",{className:"terminal-manager-header terminal-manager-desktop-header",children:[r.jsxs("div",{className:"terminal-manager-panel-heading",children:[r.jsx("span",{className:"terminal-manager-panel-eyebrow",children:u("terminalManager.quickLaunchTitle")}),r.jsxs("div",{children:[r.jsx("h2",{children:u("terminalManager.templateSectionTitle")}),r.jsx("p",{className:"status-text",children:u("terminalManager.desktopPanelDescription")})]})]}),r.jsxs("div",{className:"terminal-manager-overview",children:[r.jsxs("article",{className:"terminal-manager-overview-card",children:[r.jsx("span",{children:u("terminalManager.runningCountLabel")}),r.jsx("strong",{children:kt})]}),r.jsxs("article",{className:"terminal-manager-overview-card",children:[r.jsx("span",{children:u("terminalManager.portWatchCountLabel")}),r.jsx("strong",{children:lt})]}),r.jsxs("article",{className:"terminal-manager-overview-card",children:[r.jsx("span",{children:u("terminalManager.terminalCountLabel")}),r.jsx("strong",{children:g.length})]})]}),r.jsxs("div",{className:"terminal-manager-toolbar terminal-manager-toolbar-header",children:[r.jsx("button",{className:"ghost-button",type:"button",disabled:!y||W,onClick:()=>{y&&nt(y)},children:u("terminalManager.refresh")}),r.jsx("button",{className:"primary-button",type:"button",disabled:!y,onClick:()=>{ge()},children:u("terminalManager.openCreateModalAction")})]})]}),r.jsxs("section",{className:"terminal-manager-section",children:[r.jsxs("div",{className:"terminal-manager-section-header",children:[r.jsxs("div",{children:[r.jsx("h3",{children:u("terminalManager.templateSectionTitle")}),r.jsx("p",{className:"status-text",children:u("terminalManager.templateSectionDescription")})]}),r.jsx("span",{className:"workbench-section-counter",children:x.length})]}),W&&!x.length?r.jsx("p",{className:"status-text",children:u("common.loading")}):null,x.length?r.jsx("div",{className:"terminal-manager-list",children:x.map(ie=>{const Ie=dk(Fe,ie.id),ct=O5(ie,Ie),zt=J.includes(ie.id),nn=u(zt?"terminalManager.hideDetailsAction":"terminalManager.showDetailsAction"),ke=ie.proxyEnabled&&ie.proxySlug?F5(ie.proxySlug):null;return r.jsxs("article",{className:"terminal-manager-card terminal-manager-desktop-card","data-tone":ct.tone,"data-expanded":zt?"true":"false",children:[r.jsxs("div",{className:"terminal-manager-card-header",children:[r.jsxs("div",{className:"terminal-manager-card-title",children:[r.jsx("span",{className:"terminal-manager-card-indicator","aria-hidden":"true"}),r.jsx("strong",{children:ie.name})]}),r.jsxs("div",{className:"terminal-manager-card-tools",children:[r.jsx("span",{className:"badge terminal-runtime-badge",children:ck(ie.runtimeType,c.ui.osFamily)}),r.jsx("span",{className:"badge",children:t0(ie)==="script"?u("terminalManager.scriptMode"):u("terminalManager.commandMode")}),r.jsx("button",{className:"terminal-manager-detail-toggle",type:"button","aria-label":nn,"aria-expanded":zt,onClick:()=>{Bt(ie.id)},children:"i"})]})]}),r.jsxs("div",{className:"terminal-manager-status-panel",children:[r.jsxs("div",{className:"terminal-manager-status-copy",children:[r.jsx("p",{className:"terminal-manager-status-title",children:ct.title}),r.jsx("p",{className:"status-text",children:ct.summary})]}),r.jsxs("div",{className:"terminal-manager-status-badges",children:[r.jsx("span",{className:"terminal-manager-stat-pill",children:ie.port===null?u("terminalManager.portUnset"):`${u("terminalManager.portLabel")} ${ie.port}`}),r.jsx("span",{className:"badge","data-tone":ct.badgeTone,children:ct.badgeLabel}),ie.proxyEnabled?r.jsx("span",{className:"badge",children:u("terminalManager.proxyEnabled")}):null]})]}),r.jsxs("div",{className:"terminal-manager-actions",children:[Ie!=null&&Ie.occupied?r.jsx("button",{className:"secondary-button",type:"button",disabled:$===ie.id,onClick:()=>{qe(ie.id)},children:$===ie.id?u("terminalManager.stoppingProcess"):u("terminalManager.stopProcessAction")}):null,r.jsx("button",{className:"secondary-button",type:"button",disabled:re===ie.id||gt,onClick:()=>{Ut(ie.id)},children:re===ie.id?u("terminalManager.runningTemplate"):u("terminalManager.runTemplateAction")})]}),zt?r.jsxs("section",{className:"terminal-manager-details","aria-label":u("terminalManager.detailsSectionTitle"),children:[r.jsxs("div",{className:"terminal-manager-detail-grid",children:[r.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[r.jsx("span",{children:u("terminalManager.commandPreviewLabel")}),r.jsx("strong",{children:M5(ie)})]}),r.jsxs("div",{className:"terminal-manager-detail-item",children:[r.jsx("span",{children:u("terminalManager.cwdLabel")}),r.jsx("strong",{children:ie.cwd})]}),r.jsxs("div",{className:"terminal-manager-detail-item",children:[r.jsx("span",{children:u("terminal.runtimeField")}),r.jsx("strong",{children:ck(ie.runtimeType,c.ui.osFamily)})]}),r.jsxs("div",{className:"terminal-manager-detail-item",children:[r.jsx("span",{children:u("terminalManager.updatedAt")}),r.jsx("strong",{children:E5(ie.updatedAt)})]}),r.jsxs("div",{className:"terminal-manager-detail-item",children:[r.jsx("span",{children:u("terminalManager.portLabel")}),r.jsx("strong",{children:ie.port===null?u("terminalManager.portUnset"):ie.port})]}),r.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[r.jsx("span",{children:u("terminalManager.proxyField")}),r.jsx("strong",{children:ke??u("terminalManager.proxyDisabledDescription")})]}),Ie!=null&&Ie.processId?r.jsxs("div",{className:"terminal-manager-detail-item",children:[r.jsx("span",{children:u("terminalManager.processIdLabel")}),r.jsx("strong",{children:Ie.processId})]}):null,Ie!=null&&Ie.processCommandLine?r.jsxs("div",{className:"terminal-manager-detail-item terminal-manager-detail-item-wide",children:[r.jsx("span",{children:u("terminalManager.processCommandLabel")}),r.jsx("strong",{children:Ie.processCommandLine})]}):null]}),r.jsxs("div",{className:"terminal-manager-actions terminal-manager-detail-actions",children:[ke?r.jsx("button",{className:"secondary-button",type:"button",onClick:()=>{St(ke)},children:u("terminalManager.openProxyUrlAction")}):null,r.jsx("button",{className:"secondary-button",type:"button",disabled:Q||F===ie.id,onClick:()=>{Te(ie)},children:u("terminalManager.editAction")}),r.jsx("button",{className:"secondary-button workbench-danger-button",type:"button",disabled:F===ie.id,onClick:()=>{be({templateId:ie.id,name:ie.name,occupied:!!(Ie!=null&&Ie.occupied)})},children:F===ie.id?u("terminalManager.templateRemoving"):u("terminalManager.removeAction")})]})]}):null]},ie.id)})}):r.jsx("section",{className:"workbench-empty-state minimal",children:r.jsx("p",{children:u("terminalManager.emptyTemplateBody")})})]}),r.jsx(B5,{open:Mt,title:u(Dt?"terminalManager.editModalTitle":"terminalManager.createModalTitle"),description:u(Dt?"terminalManager.editModalDescription":"terminalManager.createModalDescription"),className:pt?"terminal-manager-mobile-modal":void 0,onClose:fe,children:r.jsxs("section",{className:"terminal-manager-modal-form",children:[pt?r.jsxs(r.Fragment,{children:[r.jsx(hk,{label:u("terminalManager.shellField"),value:O,open:Ot==="shell",options:A.map(ie=>({value:ie.id,label:ie.label,description:ie.available?null:ie.unavailableReason??u("terminalManager.shellUnavailable"),disabled:!ie.available})),onToggle:()=>{Ke(ie=>ie==="shell"?null:"shell")},onChange:ie=>{ee(ie),Ke(null)}}),(wt==null?void 0:wt.available)===!1&&wt.unavailableReason?r.jsx("p",{className:"status-text",children:wt.unavailableReason}):null,r.jsx(hk,{label:u("terminal.runtimeField"),value:q,open:Ot==="runtime",options:ye.map(ie=>({value:ie.value,label:ie.label,description:ie.description})),onToggle:()=>{Ke(ie=>ie==="runtime"?null:"runtime")},onChange:ie=>{_(ie),Ke(null)}}),r.jsx("p",{className:"status-text",children:((At=ye.find(ie=>ie.value===q))==null?void 0:At.description)??((vt=ye[0])==null?void 0:vt.description)})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"field-group",children:[r.jsx("span",{children:u("terminalManager.shellField")}),r.jsx("select",{value:O,onChange:ie=>{ee(ie.target.value)},children:A.map(ie=>r.jsx("option",{value:ie.id,disabled:!ie.available,children:ie.available?ie.label:`${ie.label} - ${u("terminalManager.shellUnavailable")}`},ie.id))}),(wt==null?void 0:wt.available)===!1&&wt.unavailableReason?r.jsx("p",{className:"status-text",children:wt.unavailableReason}):null]}),r.jsxs("div",{className:"field-group",children:[r.jsx("span",{children:u("terminal.runtimeField")}),r.jsx("select",{value:q,onChange:ie=>{_(ie.target.value)},children:ye.map(ie=>r.jsx("option",{value:ie.value,children:ie.label},ie.value||"auto"))}),r.jsx("p",{className:"status-text",children:((Nt=ye.find(ie=>ie.value===q))==null?void 0:Nt.description)??((Zt=ye[0])==null?void 0:Zt.description)})]})]}),r.jsxs("div",{className:"terminal-manager-mode-row",role:"tablist","aria-label":u("terminalManager.modeField"),children:[r.jsx("button",{type:"button",className:E.mode==="command"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{M(ie=>({...ie,mode:"command"}))},children:u("terminalManager.commandMode")}),r.jsx("button",{type:"button",className:E.mode==="script"?"workbench-info-tab active":"workbench-info-tab",onClick:()=>{M(ie=>({...ie,mode:"script"}))},children:u("terminalManager.scriptMode")})]}),r.jsxs("div",{className:"terminal-manager-grid",children:[r.jsxs("div",{className:"field-group",children:[r.jsx("span",{children:u("terminalManager.templateNameField")}),r.jsx("input",{value:E.name,placeholder:u("terminalManager.templateNamePlaceholder"),onChange:ie=>{M(Ie=>({...Ie,name:ie.target.value}))}})]}),r.jsxs("div",{className:"field-group",children:[r.jsx("span",{children:u("terminalManager.cwdField")}),r.jsx("input",{value:E.cwd,placeholder:u("terminalManager.cwdPlaceholder"),onChange:ie=>{M(Ie=>({...Ie,cwd:ie.target.value}))}})]})]}),r.jsxs("div",{className:"terminal-manager-grid",children:[r.jsxs("div",{className:"field-group",children:[r.jsx("span",{children:E.mode==="script"?u("terminalManager.scriptPathField"):u("terminalManager.commandField")}),r.jsx("input",{value:E.target,placeholder:E.mode==="script"?u("terminalManager.scriptPathPlaceholder"):u("terminalManager.commandPlaceholder"),onChange:ie=>{M(Ie=>({...Ie,target:ie.target.value}))}})]}),r.jsxs("div",{className:"field-group",children:[r.jsx("span",{children:u("terminalManager.argsField")}),r.jsx("input",{value:E.args,placeholder:u("terminalManager.argsPlaceholder"),onChange:ie=>{M(Ie=>({...Ie,args:ie.target.value}))}})]})]}),r.jsxs("div",{className:"terminal-manager-grid",children:[r.jsxs("div",{className:"field-group",children:[r.jsx("span",{children:u("terminalManager.portField")}),r.jsx("input",{value:E.port,placeholder:u("terminalManager.portPlaceholder"),onChange:ie=>{M(Ie=>({...Ie,port:ie.target.value}))}})]}),r.jsxs("div",{className:"field-group terminal-manager-proxy-field",children:[r.jsx("span",{children:u("terminalManager.proxyField")}),r.jsxs("div",{className:"terminal-manager-proxy-control",children:[r.jsx("span",{children:u("terminalManager.proxyToggleLabel")}),r.jsxs("label",{className:"terminal-manager-proxy-switch",children:[r.jsx("input",{type:"checkbox",role:"switch","aria-label":u("terminalManager.proxyField"),checked:E.proxyEnabled,onChange:ie=>{M(Ie=>({...Ie,proxyEnabled:ie.target.checked}))}}),r.jsx("span",{className:"terminal-manager-proxy-track","aria-hidden":"true",children:r.jsx("span",{className:"terminal-manager-proxy-thumb"})})]})]})]})]}),r.jsxs("div",{className:"terminal-manager-actions",children:[r.jsx("button",{className:"secondary-button",type:"button",onClick:fe,children:u("common.close")}),r.jsx("button",{className:"primary-button",type:"button",disabled:!y||Q||!E.target.trim(),onClick:()=>{dt()},children:u(Q?Dt?"terminalManager.templateUpdating":"terminalManager.templateSaving":Dt?"terminalManager.saveTemplateChangesAction":"terminalManager.saveLaunchAction")})]})]})}),r.jsx(U5,{open:ce!==null,busy:ce!==null&&F===ce.templateId,title:u("terminalManager.removeConfirmTitle"),description:ce?u(ce.occupied?"terminalManager.removeRunningConfirmTarget":"terminalManager.removeConfirmTarget",{name:ce.name}):"",confirmLabel:u("terminalManager.removeConfirmAction"),className:pt?"terminal-manager-mobile-modal":"terminal-manager-confirm-modal",onClose:()=>{F||be(null)},onConfirm:()=>{if(!ce)return;const ie=x.find(Ie=>Ie.id===ce.templateId);if(!ie){be(null);return}dk(Fe,ie.id),rt(ie)}})]}):r.jsx("section",{className:"workbench-empty-state minimal",children:r.jsx("p",{children:u("terminalManager.noCurrentWorkspaceBody")})}):r.jsx("section",{className:"workbench-empty-state minimal",children:r.jsx("p",{children:u("terminalManager.emptyWorkspaceBody")})})}function Jf(e){return`terminal-manager.snapshot.${e}`}const q5=Object.freeze(Object.defineProperty({__proto__:null,TerminalManagerPanel:cg},Symbol.toStringTag,{value:"Module"}));function fk(e){return!e||!Array.isArray(e.items)?[]:e.items.map(t=>({workspace:t.workspace,sessions:[...t.sessions].sort((n,i)=>(i.lastMessageAt??i.updatedAt).localeCompare(n.lastMessageAt??n.updatedAt))}))}function $5(e){return{navigationGroups:e,subscribeFileTree:()=>{},requestFileTreeRefresh:()=>{},addFileTreeSnapshotListener:()=>()=>{},subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function V5(){return{subscribeGitSnapshot:()=>{},requestGitRefresh:()=>{},addGitSnapshotListener:()=>()=>{}}}function G5(){return{subscribeTerminalManagerSnapshot:()=>{},requestTerminalManagerRefresh:()=>{},addTerminalManagerSnapshotListener:()=>()=>{}}}function K5(e){return e.kind==="files"?u("shell.filesEntry"):e.kind==="git"?u("shell.gitEntry"):e.kind==="processes"?u("shell.terminalManagerEntry"):e.kind}function Q5(){const{windowId:e}=ca(),t=Wn(),n=zn(),[i,a]=b.useState(null),[c,l]=b.useState(!0),[h,f]=b.useState(null),[p,y]=b.useState([]),[g,w]=b.useState(null);b.useEffect(()=>{let A=!1;async function L(){if(!e){a(null),l(!1),f(u("desktopWindow.invalidWindowId"));return}l(!0),f(null);const O=await n.bridge.getWindowDescriptor(e),ee=O.ok?O.value??null:n.windows.getDescriptor(e);if(!A){if(!ee){a(null),l(!1),f(O.detail??u("desktopWindow.loadDescriptorFailed"));return}n.windows.registerDescriptor(ee),n.windows.markWindowOpen(ee.windowId),a(ee),l(!1)}}return L(),()=>{A=!0}},[n,e]),b.useEffect(()=>{if(!(i!=null&&i.workspaceId)){y([]);return}let A=!1;async function L(){try{const O=await iC();if(A)return;y(fk(O))}catch{if(A)return;y([])}}return L(),()=>{A=!0}},[i==null?void 0:i.workspaceId]),b.useEffect(()=>{if(!i){w(null);return}const A=new VS({onConnectionChange:()=>{},onSnapshot:L=>{y(fk(L))},onUnauthorized:()=>{kn.clear(),t(`/login?returnTo=${encodeURIComponent(`/desktop-window/${i.windowId}`)}`,{replace:!0})}});return w(A),A.start(),()=>{A.close(),w(null)}},[i,t]);const x=b.useMemo(()=>g?{navigationGroups:p,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)}:$5(p),[p,g]),S=b.useMemo(()=>g?{subscribeGitSnapshot:g.subscribeGit.bind(g),requestGitRefresh:g.requestGitRefresh.bind(g),addGitSnapshotListener:g.addGitSnapshotListener.bind(g)}:V5(),[g]),C=b.useMemo(()=>g?{subscribeTerminalManagerSnapshot:g.subscribeTerminalManager.bind(g),requestTerminalManagerRefresh:g.requestTerminalManagerRefresh.bind(g),addTerminalManagerSnapshotListener:g.addTerminalManagerSnapshotListener.bind(g)}:G5(),[g]);if(!n.isDesktop)return r.jsx(ua,{to:"/",replace:!0});if(c)return r.jsx("main",{className:"desktop-window-page",children:r.jsx("p",{className:"status-text",children:u("common.loading")})});if(h)return r.jsx("main",{className:"desktop-window-page",children:r.jsx("p",{className:"status-text",children:h})});if(!i)return r.jsx("main",{className:"desktop-window-page",children:r.jsx("p",{className:"status-text",children:u("desktopWindow.loadDescriptorFailed")})});let P=null;return i.kind==="files"?P=r.jsx(sg,{sessionId:i.sessionId,workspaceId:i.workspaceId,externalWindowMode:!0,workbenchShellOverrides:x}):i.kind==="git"?P=r.jsx(ag,{workspaceId:i.workspaceId,externalWindowMode:!0,workbenchShellOverrides:S}):i.kind==="processes"&&(P=r.jsx(cg,{currentWorkspaceId:i.workspaceId,navigationGroups:p,externalWindowMode:!0,workbenchShellOverrides:C})),P?r.jsx("main",{className:"desktop-window-page",children:r.jsx("div",{className:"desktop-window-body","data-window-kind":i.kind,"aria-label":K5(i),children:P})}):r.jsx("main",{className:"desktop-window-page",children:r.jsx("p",{className:"status-text",children:u("desktopWindow.unsupportedKind",{kind:i.kind})})})}const Y5=420;function mk({entry:e,isFavorite:t,isActive:n=!1,depth:i=0,variant:a="default",hasSubsessions:c=!1,showActions:l=!0,onActivate:h,onToggleSubsessions:f,onToggleFavorite:p,onArchive:y,onUnarchive:g,onRename:w}){const[x,S]=b.useState(!1),C=b.useRef(null),P=b.useRef(!1),A=Yr(),{session:L,workspace:O}=e,ee=L.title??L.sessionId,q=$i(L.provider),_=[q,J5(L.lastMessageAt??L.updatedAt??null),Hu(L)].filter(Boolean).join(" · "),E=e6(L),M=E?t6(E):null,I=a==="mobile"?null:Hu(L),N=I?yC("session-list-activity-badge",L):null;b.useEffect(()=>()=>{z()},[]);function z(){C.current!==null&&(window.clearTimeout(C.current),C.current=null)}function G(D){!c||D.pointerType==="mouse"||(z(),C.current=window.setTimeout(()=>{P.current=!0,A.trigger("gesture"),f==null||f()},Y5))}function J(){z()}function B(){if(P.current){P.current=!1;return}A.trigger("selection"),h(L.sessionId)}const W=async()=>{const D=window.prompt(u("shell.renameModalDescription"),ee);D&&(await w(L.sessionId,D.trim()),S(!1))},Y=async()=>{if(L.isArchived){await g(L.sessionId),S(!1);return}await y(L.sessionId),S(!1)},Q=()=>{p(L.sessionId),S(!1)};return r.jsxs("article",{className:"session-list-item","data-depth":i,"data-active":n,"data-has-subsessions":c,"data-variant":a,children:[r.jsxs("button",{type:"button",className:"session-list-link",onClick:B,onPointerDown:G,onPointerUp:J,onPointerCancel:J,onPointerLeave:J,children:[r.jsx("span",{className:X5(L),"aria-hidden":"true"}),r.jsxs("div",{className:"session-list-copy",children:[r.jsx("div",{className:"session-list-title",children:ee||u("shell.searchEntry")}),r.jsx("div",{className:"session-list-meta",children:a==="mobile"?r.jsx("span",{children:_}):r.jsxs(r.Fragment,{children:[r.jsx("span",{children:O.name}),I&&N?r.jsxs(r.Fragment,{children:[r.jsx("span",{"aria-hidden":"true",children:"·"}),r.jsx("span",{className:N,children:I})]}):null,r.jsx("span",{"aria-hidden":"true",children:"·"}),r.jsx("span",{children:q})]})}),M?r.jsx("div",{className:"session-list-error",title:E??void 0,children:M}):null]})]}),l?r.jsxs("div",{className:"session-list-actions",children:[r.jsx("button",{type:"button",className:"ghost-button","aria-expanded":x,onClick:()=>{A.trigger("selection"),S(D=>!D)},children:u("shell.sessionMoreAction")}),x?r.jsxs("div",{className:"session-action-menu surface-card",role:"menu","aria-label":u("shell.sessionMoreAction"),children:[r.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:Q,children:u(t?"shell.unfavoriteAction":"shell.favoriteAction")}),r.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void Y(),children:L.isArchived?u("shell.unarchiveAction"):u("shell.archiveAction")}),r.jsx("button",{type:"button",className:"session-action-menu-item",role:"menuitem",onClick:()=>void W(),children:u("shell.renameAction")})]}):null]}):null]})}function X5(e,t){return jp("session-list-indicator",e)}function J5(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):u("common.unknown")}function Z5(e){return Wl(e)||e.syncStatus==="error"}function e6(e){var i,a;if(!Z5(e))return null;const t=((i=e.lastErrorCode)==null?void 0:i.trim())??"",n=((a=e.lastErrorDetail)==null?void 0:a.replace(/\s+/g," ").trim())??"";return t&&n&&!n.includes(t)?`${t} · ${n}`:n||t||(e.syncStatus==="error"&&!Wl(e)?u("conversation.syncStatusError"):u("conversation.runtimeErrorTitle"))}function t6(e,t=96){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}function n6(){const e=Wn(),{navigationGroups:t,favoriteSessionIds:n,currentWorkspaceId:i,currentSessionId:a,navigationLoading:c,selectWorkspace:l,toggleFavoriteSession:h,archiveSession:f,unarchiveSession:p,renameSession:y,startDraftSession:g}=Yn(),w=t.find(I=>I.workspace.id===i)??t[0]??null,x=b.useMemo(()=>new Set(n),[n]),S=b.useMemo(()=>w?ip([w]).filter(I=>!I.session.isArchived&&!I.session.isSubagent):[],[w]),C=b.useMemo(()=>fE(S),[S]),P=(w==null?void 0:w.workspace.id)??"",A=!!P,[L,O]=b.useState([]),[ee,q]=b.useState(!1);b.useEffect(()=>{if(!a)return;const I=C.filter(N=>N.children.some(z=>z.session.sessionId===a)).map(N=>N.entry.session.sessionId);I.length!==0&&O(N=>{const z=new Set(N);let G=!1;for(const J of I)z.has(J)||(z.add(J),G=!0);return G?Array.from(z):N})},[a,C]);function _(I){O(N=>N.includes(I)?N.filter(z=>z!==I):[...N,I])}function E(I,N){qi("immersive"),e(Bn(I,N))}function M(I,N){q(!1),qi("immersive"),g(I,N)}return r.jsxs("main",{className:"session-index-page mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header",children:[r.jsx(go,{currentWorkspace:(w==null?void 0:w.workspace)??null,workspaces:t.map(I=>I.workspace),onSelectWorkspace:I=>{l(I),e(Bl(I))},content:r.jsx("button",{type:"button",className:"primary-button mobile-session-index-create-button",disabled:c||!A,onClick:()=>q(!0),children:u("shell.createSession")})}),r.jsx("div",{className:"mobile-page-top-body",children:r.jsxs("section",{className:"session-section session-section-sheet",children:[r.jsxs("header",{className:"session-section-heading",children:[r.jsx("div",{children:r.jsx("h2",{children:u("shell.mobileConversationCurrentWorkspaceSection")})}),r.jsx("span",{className:"session-section-count",children:C.length})]}),C.length===0?r.jsx("p",{className:"session-section-empty",children:u(c?"shell.searchSessionHint":"shell.emptyWorkspaceSessions")}):r.jsx("div",{className:"session-current-workspace-list",children:C.map(I=>{const N=I.entry.session.sessionId,z=L.includes(N);return r.jsxs("div",{className:"session-list-tree-node",children:[r.jsx(mk,{entry:I.entry,isFavorite:x.has(N),isActive:a===N,variant:"mobile",hasSubsessions:I.children.length>0,onActivate:G=>E(I.entry.workspace.id,G),onToggleSubsessions:()=>_(N),onToggleFavorite:G=>{h(G)},onArchive:G=>f(G),onUnarchive:G=>p(G),onRename:(G,J)=>y(G,J)}),z&&I.children.length>0?r.jsx("div",{className:"session-list-children",children:I.children.map(G=>r.jsx(mk,{entry:G,isFavorite:x.has(G.session.sessionId),isActive:a===G.session.sessionId,depth:1,variant:"mobile",onActivate:J=>E(G.workspace.id,J),onToggleFavorite:J=>{h(J)},onArchive:J=>f(J),onUnarchive:J=>p(J),onRename:(J,B)=>y(J,B)},`${G.workspace.id}:${G.session.sessionId}`))}):null]},`${I.entry.workspace.id}:${N}`)})})]})}),r.jsx(Vl,{open:ee,workspaces:t.map(I=>I.workspace),initialWorkspaceId:i??P,onClose:()=>q(!1),onSelect:M})]})}function r6(){const{currentWorkspaceId:e}=Yn();return e?r.jsx(ua,{to:da(e,"files"),replace:!0}):r.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:r.jsxs("article",{className:"mobile-feature-empty surface-card",children:[r.jsx("h1",{children:u("shell.filesEntry")}),r.jsx("p",{children:u("shell.toolsWorkspaceRequiredBody")})]})})}function i6(){const{currentWorkspaceId:e}=Yn();return e?r.jsx(ua,{to:da(e,"git"),replace:!0}):r.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:r.jsxs("article",{className:"mobile-feature-empty surface-card",children:[r.jsx("h1",{children:u("shell.gitEntry")}),r.jsx("p",{children:u("shell.toolsWorkspaceRequiredBody")})]})})}function s6(){const{currentWorkspaceId:e,navigationGroups:t}=Yn();return e?r.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root mobile-tool-panel-page mobile-tool-process-page",children:r.jsx(cg,{className:"mobile-panel-scroll-root mobile-tool-native-panel mobile-tool-process-panel",currentWorkspaceId:e,navigationGroups:t})}):r.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:r.jsxs("article",{className:"mobile-feature-empty surface-card",children:[r.jsx("h1",{children:u("shell.terminalManagerEntry")}),r.jsx("p",{children:u("shell.toolsWorkspaceRequiredBody")})]})})}const n0="mobile.tools.last-primary-tool",Eu=["files","git"],o6=56,a6=1.2;function pk(e,t){return e==="git"?"git":e==="files"?"files":t}function l6(e,t,n){if(!t)return e;const i=n.x-t.x,a=n.y-t.y;if(Math.abs(i)<o6||Math.abs(i)<Math.abs(a)*a6)return e;const c=Eu.indexOf(e),l=i<0?Math.min(Eu.length-1,c+1):Math.max(0,c-1);return Eu[l]??e}function c6(){if(typeof window>"u")return"files";try{return window.localStorage.getItem(n0)==="git"?"git":"files"}catch{return"files"}}function u6(){var O,ee;const e=Qr(),t=Wn(),n=Yr(),{navigationGroups:i,currentWorkspaceId:a,currentSessionId:c,selectWorkspace:l}=Yn(),h=((O=i.find(q=>q.workspace.id===a))==null?void 0:O.workspace)??((ee=i[0])==null?void 0:ee.workspace)??null,f=new URLSearchParams(e.search).get("tab"),p=b.useRef(c6()),y=pk(f,p.current),[g,w]=b.useState(()=>{const q=pk(f,p.current);return{files:q==="files",git:q==="git"}}),x=b.useRef(null),S=b.useMemo(()=>[{key:"files",title:u("shell.filesEntry"),render:()=>r.jsx(sg,{sessionId:c,workspaceId:a,hideHeading:!0})},{key:"git",title:u("shell.gitEntry"),render:()=>r.jsx(ag,{className:"mobile-tool-native-panel mobile-tool-git-panel",workspaceId:a,panelActive:y==="git"})}],[y,c,a]),C=Eu.indexOf(y);b.useEffect(()=>{w(q=>({...q,[y]:!0}))},[y]),b.useEffect(()=>{if(p.current=y,!(typeof window>"u"))try{window.localStorage.setItem(n0,y)}catch{}},[y]),b.useEffect(()=>{if(f===y)return;const q=new URLSearchParams(e.search);q.set("tab",y),t({pathname:e.pathname,search:`?${q.toString()}`},{replace:!0})},[y,e.pathname,e.search,t,f]);function P(q,_="selection"){if(q===y)return;n.trigger(_);const E=new URLSearchParams(e.search);E.set("tab",q),t({pathname:e.pathname,search:`?${E.toString()}`},{replace:!0})}function A(q){if(q.changedTouches.length!==1){x.current=null;return}const _=q.changedTouches[0];x.current={x:_.clientX,y:_.clientY}}function L(q){const _=x.current;if(x.current=null,q.changedTouches.length!==1)return;const E=q.changedTouches[0],M=l6(y,_,{x:E.clientX,y:E.clientY});M!==y&&P(M)}return r.jsx("main",{className:"mobile-feature-page mobile-page-fixed-root mobile-tools-workspace-page",children:h?r.jsxs(r.Fragment,{children:[r.jsx(go,{currentWorkspace:h,workspaces:i.map(q=>q.workspace),onSelectWorkspace:q=>{l(q),t(da(q,y))},trailing:r.jsx("button",{type:"button",className:"secondary-button mobile-tools-more-button","aria-label":u("shell.toolsMoreAction"),title:u("shell.toolsMoreAction"),onClick:()=>{n.trigger("action"),t(rd(h.id))},children:r.jsx(d6,{})}),content:r.jsx("div",{className:"mobile-tools-switcher","aria-label":u("shell.mobileToolsEntry"),children:r.jsx("div",{className:"mobile-tools-segmented-control",role:"tablist","aria-label":u("shell.mobileToolsEntry"),children:S.map(q=>{const _=q.key===y;return r.jsx("button",{type:"button",role:"tab",className:"mobile-tools-segmented-button","data-active":_,"aria-selected":_,"aria-controls":`mobile-tool-panel-${q.key}`,onClick:()=>P(q.key,"selection"),children:q.title},q.key)})})})}),r.jsx("section",{className:"mobile-tools-stage","data-active-tool":y,"data-testid":"mobile-tools-stage",onTouchStart:A,onTouchEnd:L,onTouchCancel:()=>{x.current=null},children:r.jsx("div",{className:"mobile-tools-stage-viewport",children:r.jsx("div",{className:"mobile-tools-stage-track",style:{transform:`translateX(-${C*100}%)`},children:S.map(q=>r.jsx("article",{id:`mobile-tool-panel-${q.key}`,role:"tabpanel","aria-label":q.title,"aria-hidden":q.key!==y,className:"mobile-tools-stage-panel",children:r.jsx("div",{className:"mobile-tools-stage-panel-shell",children:g[q.key]?q.render():null})},q.key))})})})]}):r.jsx("article",{className:"mobile-feature-empty surface-card",children:r.jsx("p",{children:u("shell.emptyNavigationBody")})})})}function d6(){return r.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[r.jsx("circle",{cx:"12",cy:"5",r:"1.8"}),r.jsx("circle",{cx:"12",cy:"12",r:"1.8"}),r.jsx("circle",{cx:"12",cy:"19",r:"1.8"})]})}function h6(e){const t=b.useMemo(()=>e.notifications.filter(n=>e.showArchivedNotifications||!e.archivedNotificationIds.has(n.id)),[e.archivedNotificationIds,e.notifications,e.showArchivedNotifications]);return r.jsx(Un,{open:e.open,title:u("shell.globalNotificationsPanelTitle"),description:u("shell.globalNotificationsPanelDescription"),className:"workbench-notification-modal-card mobile-notification-modal-card",onClose:e.onClose,children:r.jsxs("div",{className:"workbench-notification-pane mobile-notification-pane",role:"tabpanel","aria-label":u("shell.globalNotificationsAction"),children:[r.jsx("div",{className:"workbench-notification-toolbar",children:r.jsxs("label",{className:"workbench-notification-filter",children:[r.jsx("input",{type:"checkbox",checked:e.showArchivedNotifications,onChange:n=>e.onToggleShowArchivedNotifications(n.target.checked)}),r.jsx("span",{children:u("shell.globalNotificationsShowArchived")})]})}),t.length>0?r.jsx("div",{className:"workbench-notification-list",children:t.map(n=>{const i=e.archivedNotificationIds.has(n.id);return r.jsxs("article",{className:"workbench-notification-item","data-archived":i,children:[r.jsxs("button",{type:"button",className:"workbench-notification-item-content",onClick:()=>{e.onSelectNotification(n)},children:[r.jsxs("div",{className:"workbench-notification-item-header",children:[r.jsx("span",{className:"workbench-notification-item-kind",children:f6(n.kind)}),r.jsx("time",{children:m6(n.createdAt)})]}),r.jsx("strong",{children:n.title}),r.jsx("p",{children:n.body})]}),r.jsx("div",{className:"workbench-notification-item-actions",children:r.jsx("button",{type:"button",className:"secondary-button",onClick:a=>{if(a.stopPropagation(),i){e.onUnarchiveNotification(n.id);return}e.onArchiveNotification(n.id)},children:u(i?"shell.globalNotificationsRemoveArchiveAction":"shell.globalNotificationsArchiveAction")})})]},n.id)})}):r.jsx("p",{className:"workbench-notification-empty",children:u("shell.globalNotificationsEmpty")})]})})}function f6(e){switch(e){case"follow_up_waiting_user":return u("shell.globalNotificationKindWaitingUser");case"follow_up_completed":return u("shell.globalNotificationKindFollowUpCompleted");case"follow_up_failed":return u("shell.globalNotificationKindFollowUpFailed");case"verification_failed":return u("shell.globalNotificationKindVerificationFailed");default:return u("shell.globalNotificationsPanelTitle")}}function m6(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 p6(e){return e.isArchived!==!0&&e.isSubagent!==!0}function r0(e){return e.activityState==="running"||e.runningState==="starting"||e.runningState==="running"||e.runningState==="reconnecting"}function g6(e){return e.activityState==="idle"&&r0(e)===!1}function gk(e){return e==="creating"||e==="running"}function ed(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt}function b6(e,t){return ed(t).localeCompare(ed(e))}function bk(e){return e?new Date(e).toLocaleString(void 0,{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}):u("common.unknown")}function no(e){return e!==null&&e>0}const mu=60*1e3,y6=15e3;function v6(){const e=Wn(),{showToast:t}=En(),n=Yn(),{navigationGroups:i,currentWorkspaceId:a,refreshNavigation:c,selectWorkspace:l,startDraftSession:h,subscribeGitSnapshot:f,requestGitRefresh:p,addGitSnapshotListener:y,subscribeTerminalManagerSnapshot:g,requestTerminalManagerRefresh:w,addTerminalManagerSnapshotListener:x}=n,S=n.globalNotifications??[],C=new Set(n.archivedNotificationIds??[]),P=n.showArchivedNotifications??!1,A=n.unreadNotificationCount??0,L=n.setShowArchivedNotifications??(()=>{}),O=n.archiveNotification??(()=>{}),ee=n.unarchiveNotification??(()=>{}),[q,_]=b.useState(null),[E,M]=b.useState(!1),[I,N]=b.useState(!1),[z,G]=b.useState(!1),[J,B]=b.useState({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null}),[W,Y]=b.useState({loading:!0,activeTaskCount:0,pendingInboxCount:0}),Q=i.find(ye=>ye.workspace.id===a)??i[0]??null,D=(Q==null?void 0:Q.workspace)??null,re=[...(Q==null?void 0:Q.sessions)??[]].filter(p6).sort(b6),R=re.filter(r0),$=re.filter(g6),Z=re.filter(ye=>ye.isFavorite===!0),F=R.slice(0,6),we=Z.slice(0,6),ce=J.quickLaunchRunning===null?"…":J.quickLaunchRunning?u("shell.workspaceHomeQuickLaunchRunning"):u("shell.workspaceHomeQuickLaunchStopped");b.useEffect(()=>{const ye=(D==null?void 0:D.id)??null;if(!ye){B({gitLoading:!1,terminalLoading:!1,branch:null,activeTerminalCount:null,changedFileCount:null,quickLaunchRunning:null});return}const Fe=Kn(Zf(ye),mu);B(kt=>{var lt,gt;return{...kt,gitLoading:Fe===null,branch:((lt=Fe==null?void 0:Fe.status)==null?void 0:lt.snapshot.branch)??null,changedFileCount:((gt=Fe==null?void 0:Fe.status)==null?void 0:gt.changes.length)??null}})},[D==null?void 0:D.id]),b.useEffect(()=>{const ye=(D==null?void 0:D.id)??null;if(ye)return y(Fe=>{Fe.workspaceId===ye&&(Fr(Zf(ye),Fe),B(kt=>{var lt,gt,Lt;return{...kt,gitLoading:!1,branch:((lt=Fe.status)==null?void 0:lt.snapshot.branch)??((gt=Fe.branches)==null?void 0:gt.currentBranch)??null,changedFileCount:((Lt=Fe.status)==null?void 0:Lt.changes.length)??null}}))})},[y,D==null?void 0:D.id]),b.useEffect(()=>{const ye=(D==null?void 0:D.id)??null;if(!ye){B(kt=>({...kt,gitLoading:!1,branch:null,changedFileCount:null}));return}const Fe=Kn(em(ye),mu);B(kt=>({...kt,terminalLoading:Fe===null,activeTerminalCount:Fe?Fe.terminals.filter(lt=>gk(lt.status)).length:null,quickLaunchRunning:Fe?Fe.templateStatuses.some(lt=>lt.occupied):null}))},[D==null?void 0:D.id]),b.useEffect(()=>{const ye=(D==null?void 0:D.id)??null;if(!ye){B(Fe=>({...Fe,terminalLoading:!1,activeTerminalCount:null,quickLaunchRunning:null}));return}return x(Fe=>{Fe.workspaceId===ye&&(Fr(em(ye),{terminals:Fe.terminals,templates:Fe.templates,templateStatuses:Fe.templateStatuses}),B(kt=>({...kt,terminalLoading:!1,activeTerminalCount:Fe.terminals.filter(lt=>gk(lt.status)).length,quickLaunchRunning:Fe.templateStatuses.some(lt=>lt.occupied)})))})},[x,D==null?void 0:D.id]),b.useEffect(()=>{const ye=(D==null?void 0:D.id)??null;if(!ye)return;const Fe=Kn(Zf(ye),mu)!==null;f(ye),!Fe&&p(ye)},[D==null?void 0:D.id,p,f]),b.useEffect(()=>{const ye=(D==null?void 0:D.id)??null;if(!ye)return;const Fe=Kn(em(ye),mu)!==null;g(ye),!Fe&&w(ye)},[D==null?void 0:D.id,w,g]),b.useEffect(()=>{const ye=(D==null?void 0:D.id)??null;if(!ye){Y({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}let Fe=!1;async function kt(nt){Y(fe=>({...fe,loading:!0}));try{const fe=await ld();if(!fe.initialized||!fe.profile){Fe||Y({loading:!1,activeTaskCount:0,pendingInboxCount:0});return}const[ge,Te,qe]=await Promise.all([cd(),Sl(),kl({workspaceId:ye})]);if(Fe)return;const dt=new Set(ge.overview.projects.filter(rt=>rt.workspaceId===ye).map(rt=>rt.id)),St=ge.overview.verifications.filter(rt=>rt.projectId?dt.has(rt.projectId):!1);Y({loading:!1,activeTaskCount:vN(Te.items.filter(rt=>rt.workspaceId===ye),St),pendingInboxCount:qe.items.filter(rt=>rt.status!=="closed").length})}catch(fe){if(Fe)return;Y(ge=>({...ge,loading:!1})),nt&&t({title:u("shell.butlerLoadFailed"),description:fe instanceof Error?fe.message:void 0,tone:"error"})}}kt(!0);const lt=window.setInterval(()=>{kt(!1)},y6),gt=Zp(()=>{kt(!1)}),Lt=()=>{kt(!1)};return window.addEventListener(uo,Lt),()=>{Fe=!0,window.clearInterval(lt),gt(),window.removeEventListener(uo,Lt)}},[D==null?void 0:D.id,t]);async function be(ye){await c(),l(ye.id),_(null),e(li(ye.id))}async function Ve(ye){await c(),l(ye.id),_(null),e(li(ye.id))}function ze(){D&&(l(D.id),e(da(D.id,"git")))}function yt(){D&&(l(D.id),e(Zo(D.id)))}function ft(){D&&(l(D.id),e(rd(D.id)))}function Ot(){D&&(l(D.id),e(co(D.id)))}function Ke(){D&&e(Bl(D.id))}function jt(){D&&M(!0)}function pt(ye,Fe){M(!1),h(ye,Fe)}function Mt(){D&&(l(D.id),e(li(D.id)))}function xt(ye){l(ye)}const Dt=[{label:u("shell.workspaceHomeMetricActive"),value:R.length,accent:no(R.length),onClick:re.length>0?Ke:void 0},{label:u("shell.workspaceHomeMetricUnread"),value:A,accent:no(A),onClick:()=>G(!0)},{label:u("shell.workspaceHomeMetricTerminal"),value:J.terminalLoading?"…":J.activeTerminalCount??"—",accent:J.terminalLoading===!1&&no(J.activeTerminalCount),onClick:D?yt:void 0},{label:u("shell.workspaceHomeMetricChanges"),value:J.gitLoading?"…":J.changedFileCount??"—",accent:J.gitLoading===!1&&no(J.changedFileCount),onClick:D?ze:void 0}],wt=[{label:u("shell.workspaceHomeWaitingInputLabel"),value:$.length,accent:no($.length),onClick:re.length>0?Ke:void 0},{label:u("shell.workspaceHomeButlerLabel"),value:W.loading?"…":W.activeTaskCount,accent:W.loading===!1&&no(W.activeTaskCount),onClick:D?Ot:void 0},{label:u("shell.workspaceHomeQuickLaunchStatusLabel"),value:ce,accent:J.quickLaunchRunning===!0,onClick:D?ft:void 0},{label:u("shell.butlerInboxAction"),value:W.loading?"…":W.pendingInboxCount,accent:W.loading===!1&&no(W.pendingInboxCount),onClick:D?()=>N(!0):void 0}];return r.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-home-page",children:[D?r.jsxs(r.Fragment,{children:[r.jsx(go,{currentWorkspace:D,workspaces:i.map(ye=>ye.workspace),onSelectWorkspace:xt,sheetContent:ye=>r.jsxs("div",{className:"mobile-workspace-home-group mobile-workspace-home-sheet-group",children:[r.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{ye(),_("import")},children:[r.jsx("span",{className:"mobile-workspace-home-row-label",children:u("shell.importWorkspaceTitle")}),r.jsx("span",{className:"mobile-workspace-home-row-trailing",children:r.jsx(gs,{})})]}),r.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-sheet-row",onClick:()=>{ye(),_("clone")},children:[r.jsx("span",{className:"mobile-workspace-home-row-label",children:u("shell.cloneWorkspaceTitle")}),r.jsx("span",{className:"mobile-workspace-home-row-trailing",children:r.jsx(gs,{})})]})]})}),r.jsxs("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:[r.jsx("section",{className:"mobile-workspace-home-section",children:r.jsx("div",{className:"mobile-workspace-home-metrics-card","aria-label":u("shell.workspaceHomeStatusSectionTitle"),children:r.jsx("div",{className:"mobile-workspace-home-toolbar-summary",children:Dt.map(ye=>ye.onClick?r.jsxs("button",{type:"button",className:"mobile-workspace-home-toolbar-metric","data-accent":ye.accent?"true":void 0,onClick:ye.onClick,children:[r.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:ye.value}),r.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:ye.label})]},ye.label):r.jsxs("div",{className:"mobile-workspace-home-toolbar-metric","data-accent":ye.accent?"true":void 0,role:"listitem",children:[r.jsx("strong",{className:"mobile-workspace-home-toolbar-metric-value",children:ye.value}),r.jsx("span",{className:"mobile-workspace-home-toolbar-metric-label",children:ye.label})]},ye.label))})})}),r.jsx("section",{className:"mobile-workspace-home-section",children:r.jsxs("div",{className:"mobile-workspace-home-primary-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",onClick:Mt,children:u("shell.workspaceDetailTitle")}),r.jsx("button",{type:"button",className:"primary-button",onClick:jt,children:u("shell.createSession")})]})}),r.jsx("section",{className:"mobile-workspace-home-section",children:r.jsx("div",{className:"mobile-workspace-home-group",children:wt.map(ye=>r.jsxs("button",{type:"button",className:"mobile-workspace-home-row","data-accent":ye.accent?"true":void 0,onClick:ye.onClick,children:[r.jsx("span",{className:"mobile-workspace-home-row-label",children:ye.label}),r.jsxs("span",{className:"mobile-workspace-home-row-trailing",children:[r.jsx("strong",{children:ye.value}),r.jsx(gs,{})]})]},ye.label))})}),r.jsxs("section",{className:"mobile-workspace-home-section",children:[r.jsxs("div",{className:"mobile-workspace-home-section-header",children:[r.jsx("p",{className:"mobile-workspace-home-section-title",children:u("shell.workspaceHomeActiveSessionsSectionTitle")}),D?r.jsx("button",{type:"button",className:"mobile-workspace-home-link-button",onClick:Ke,children:u("shell.workspaceHomeViewAllAction")}):null]}),r.jsx("div",{className:"mobile-workspace-home-group",children:F.length===0?r.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-empty-row",onClick:jt,children:[r.jsxs("div",{className:"mobile-workspace-home-session-main",children:[r.jsx("span",{className:"mobile-workspace-home-session-title",children:u("shell.createSession")}),r.jsx("span",{className:"mobile-workspace-home-session-meta",children:D.name})]}),r.jsx("span",{className:"mobile-workspace-home-row-trailing",children:r.jsx(gs,{})})]}):F.map(ye=>r.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Bn(D.id,ye.sessionId)),children:[r.jsxs("div",{className:"mobile-workspace-home-session-main",children:[r.jsx("span",{className:"mobile-workspace-home-session-title",children:ye.title||u("common.unknown")}),r.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[$i(ye.provider,"full")," · ",bk(ed(ye))]})]}),r.jsx("span",{className:"mobile-workspace-home-row-trailing",children:r.jsx(gs,{})})]},ye.sessionId))})]}),we.length>0?r.jsxs("section",{className:"mobile-workspace-home-section",children:[r.jsx("div",{className:"mobile-workspace-home-section-header",children:r.jsx("p",{className:"mobile-workspace-home-section-title",children:u("shell.favoriteSectionTitle")})}),r.jsx("div",{className:"mobile-workspace-home-group",children:we.map(ye=>r.jsxs("button",{type:"button",className:"mobile-workspace-home-row mobile-workspace-home-session-row",onClick:()=>e(Bn(D.id,ye.sessionId)),children:[r.jsxs("div",{className:"mobile-workspace-home-session-main",children:[r.jsx("span",{className:"mobile-workspace-home-session-title",children:ye.title||u("common.unknown")}),r.jsxs("span",{className:"mobile-workspace-home-session-meta",children:[$i(ye.provider,"full")," · ",bk(ed(ye))]})]}),r.jsx("span",{className:"mobile-workspace-home-row-trailing",children:r.jsx(gs,{})})]},ye.sessionId))})]}):null]})]}):r.jsx("div",{className:"mobile-page-top-body mobile-workspace-home-body",children:r.jsxs("section",{className:"mobile-workspace-home-section mobile-workspace-home-empty",children:[r.jsx("p",{className:"mobile-workspace-home-section-title",children:u("shell.workspaceHomeSwitcherTitle")}),r.jsxs("div",{className:"mobile-workspace-home-group",children:[r.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>_("import"),children:[r.jsx("span",{className:"mobile-workspace-home-row-label",children:u("shell.importWorkspaceTitle")}),r.jsx("span",{className:"mobile-workspace-home-row-trailing",children:r.jsx(gs,{})})]}),r.jsxs("button",{type:"button",className:"mobile-workspace-home-row",onClick:()=>_("clone"),children:[r.jsx("span",{className:"mobile-workspace-home-row-label",children:u("shell.cloneWorkspaceTitle")}),r.jsx("span",{className:"mobile-workspace-home-row-trailing",children:r.jsx(gs,{})})]})]})]})}),r.jsx(PC,{open:q==="import",onClose:()=>_(null),onImported:be}),r.jsx(jC,{open:q==="clone",onClose:()=>_(null),onCloned:Ve}),r.jsx(Vl,{open:E,workspaces:i.map(ye=>ye.workspace),initialWorkspaceId:(D==null?void 0:D.id)??a??null,onClose:()=>M(!1),onSelect:pt}),r.jsx(DI,{open:I,preferredWorkspaceId:(D==null?void 0:D.id)??null,compactComposer:!0,onClose:()=>N(!1)}),r.jsx(h6,{open:z,notifications:S,archivedNotificationIds:C,showArchivedNotifications:P,onClose:()=>G(!1),onToggleShowArchivedNotifications:L,onArchiveNotification:O,onUnarchiveNotification:ee,onSelectNotification:ye=>{G(!1),ye.routePath&&e(ye.routePath)}})]})}function Zf(e){return`git-sidebar.snapshot.${e}`}function em(e){return`terminal-manager.snapshot.${e}`}function gs(){return r.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:r.jsx("path",{d:"M6 3.5L10.5 8 6 12.5",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.6"})})}function w6(e){return e.isArchived!==!0&&e.isSubagent!==!0}function x6(e){return e.isArchived===!0&&e.isSubagent!==!0}function yk(e){return e.lastEventAt??e.lastMessageAt??e.updatedAt??e.createdAt??""}function vk(e,t){return yk(t).localeCompare(yk(e))}const tm=60*1e3,nm=10;function k6(){var Y;const{workspaceId:e=""}=ca(),t=Wn(),{showToast:n}=En(),{navigationGroups:i,currentWorkspaceId:a,favoriteSessionIds:c,workspaceManagementStateById:l,selectWorkspace:h,subscribeGitSnapshot:f,requestGitRefresh:p,subscribeWorkspaceManagementSnapshot:y,requestWorkspaceManagementRefresh:g,toggleFavoriteSession:w,archiveSession:x,unarchiveSession:S,startDraftSession:C}=Yn(),[P,A]=b.useState(!1),[L,O]=b.useState(!1),[ee,q]=b.useState(nm),_=i.find(Q=>Q.workspace.id===e)??null,E=(_==null?void 0:_.workspace)??null,M=b.useMemo(()=>[...(_==null?void 0:_.sessions)??[]].filter(w6).sort(vk),[_]),I=b.useMemo(()=>[...(_==null?void 0:_.sessions)??[]].filter(x6).sort(vk),[_]);b.useEffect(()=>{e&&h(e)},[h,e]),b.useEffect(()=>{if(!e)return;f(e),y(e);const Q=Kn(j6(e),tm)!==null,D=Kn(wk(e),tm)!==null;Q||p(e),D||g(e)},[p,g,f,y,e]),b.useEffect(()=>{q(nm)},[e]);const N=b.useMemo(()=>{if(!e)return{loading:!1,error:null,hasMeaningfulSummary:!1,summary:null};const Q=Kn(wk(e),tm),D=l[e]??null,re=(D==null?void 0:D.detail)??(E?N6(E,Q):Q??null);return{loading:(D==null?void 0:D.loading)??!1,error:(D==null?void 0:D.error)??null,hasMeaningfulSummary:P6(re),summary:re}},[E,e,l]),z=b.useMemo(()=>N.summary?wC(N.summary.codeComposition.items,u("shell.manageWorkspaceCodeCompositionOther")):[],[N.summary]),G=b.useMemo(()=>z.length>0?xC(z):void 0,[z]),J=b.useMemo(()=>I.slice(0,ee),[I,ee]);async function B(){if(!(!E||!(typeof window>"u"||window.confirm(u("shell.manageWorkspaceRemoveConfirmTarget",{name:E.name}))))){A(!0);try{await sC(E.id),n({title:u("shell.manageWorkspaceRemoveSuccess"),tone:"success"}),t("/workspaces",{replace:!0})}catch(D){n({title:D instanceof Error?D.message:u("shell.manageWorkspaceRemoveFailed"),tone:"error"})}finally{A(!1)}}}function W(Q,D){O(!1),C(Q,D)}return E?r.jsxs("main",{className:"mobile-feature-page mobile-page-scroll-root mobile-page-with-top-header mobile-workspace-detail-page",children:[r.jsx(go,{currentWorkspace:E,workspaces:i.map(Q=>Q.workspace),heading:u("shell.workspaceDetailTitle"),triggerLabel:E.name,onSelectWorkspace:Q=>{h(Q),t(li(Q))},content:r.jsxs("div",{className:"mobile-workspace-detail-header-actions",children:[r.jsx("button",{type:"button",className:"primary-button",onClick:()=>O(!0),children:u("shell.createSession")}),r.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{h(E.id),t(_S(E.id))},children:u("shell.filesEntry")}),r.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{h(E.id),t(Zo(E.id))},children:u("shell.terminalsEntry")})]})}),r.jsxs("div",{className:"mobile-page-top-body mobile-workspace-detail-body",children:[r.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-detail-summary-panel",children:[r.jsxs("div",{className:"mobile-feature-section-header",children:[r.jsx("div",{children:r.jsx("h2",{children:u("shell.workspaceDetailSummaryTitle")})}),a!==E.id?r.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-switch-button",onClick:()=>h(E.id),children:u("shell.switchWorkspace")}):null]}),N.loading&&N.summary===null?r.jsx("p",{children:u("common.loading")}):null,N.error?r.jsx("p",{className:"status-text","data-tone":"error",children:N.error}):null,N.summary?r.jsxs("div",{className:"mobile-detail-grid mobile-workspace-detail-grid",children:[r.jsxs("div",{className:"mobile-detail-metric mobile-detail-metric-wide",children:[r.jsx("span",{children:u("shell.manageWorkspacePathLabel")}),r.jsx("strong",{title:N.summary.path,children:N.summary.path})]}),r.jsxs("div",{className:"mobile-detail-metric",children:[r.jsx("span",{children:u("shell.manageWorkspaceCurrentBranch")}),r.jsx("strong",{title:N.summary.git.currentBranch??u("common.unknown"),children:N.summary.git.currentBranch??u("common.unknown")})]}),r.jsxs("div",{className:"mobile-detail-metric",children:[r.jsx("span",{children:u("shell.manageWorkspaceGitCommitCount")}),r.jsx("strong",{children:N.hasMeaningfulSummary?N.summary.git.commitCount??0:"—"})]}),r.jsxs("div",{className:"mobile-detail-metric",children:[r.jsx("span",{children:u("shell.manageWorkspaceCodeCompositionFiles")}),r.jsx("strong",{children:N.hasMeaningfulSummary?N.summary.codeComposition.scannedFileCount:"—"})]})]}):null,r.jsxs("div",{className:"mobile-feature-inline-actions mobile-workspace-detail-summary-actions",children:[r.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{h(E.id),t(OS(E.id))},children:u("shell.gitEntry")}),r.jsx("button",{type:"button",className:"secondary-button",onClick:()=>{h(E.id),t(rd(E.id))},children:u("shell.terminalManagerEntry")}),r.jsx("button",{type:"button",className:"secondary-button workbench-danger-button",disabled:P,onClick:()=>{B()},children:u(P?"shell.manageWorkspaceRemoving":"shell.manageWorkspaceRemoveAction")})]})]}),r.jsxs("section",{className:"mobile-feature-panel surface-card mobile-workspace-composition-panel",children:[r.jsxs("div",{className:"mobile-feature-section-header",children:[r.jsx("div",{children:r.jsx("h2",{children:u("shell.manageWorkspaceCodeCompositionLabel")})}),N.summary?r.jsx("span",{className:"mobile-feature-counter",children:N.summary.codeComposition.scannedFileCount}):null]}),N.loading&&N.summary===null?r.jsx("p",{children:u("common.loading")}):null,N.summary?z.length>0?r.jsxs("div",{className:"workbench-manage-type-chart",children:[r.jsxs("div",{className:"workbench-manage-type-chart-ring",style:G,"aria-hidden":"true",children:[r.jsx("strong",{className:"workbench-manage-type-chart-total",children:N.summary.codeComposition.scannedFileCount}),r.jsx("span",{className:"workbench-manage-type-chart-caption",children:u("shell.manageWorkspaceCodeCompositionFiles")})]}),r.jsx("div",{className:"workbench-manage-type-list",children:z.map(Q=>r.jsxs("div",{className:"workbench-manage-type-item",children:[r.jsxs("span",{className:"workbench-manage-type-meta",children:[r.jsx("span",{className:"workbench-manage-type-swatch",style:{backgroundColor:Q.color},"aria-hidden":"true"}),r.jsx("span",{className:"workbench-manage-type-name",children:Q.type})]}),r.jsxs("span",{children:[Q.count," · ",vC(Q)]})]},Q.key))})]}):r.jsx("p",{children:N.summary.codeComposition.error??u("shell.manageWorkspaceNoCodeComposition")}):null,(Y=N.summary)!=null&&Y.codeComposition.truncated?r.jsx("p",{className:"mobile-workspace-composition-note",children:u("shell.manageWorkspaceCodeTruncated",{count:N.summary.codeComposition.scannedFileCount})}):null]}),r.jsxs("section",{className:"mobile-feature-section",children:[r.jsxs("div",{className:"mobile-feature-section-header",children:[r.jsx("div",{children:r.jsx("h2",{children:u("shell.recentSessionsSectionTitle")})}),r.jsx("span",{className:"mobile-feature-counter",children:M.length})]}),r.jsx("div",{className:"mobile-feature-stack",children:M.length===0?r.jsx("article",{className:"mobile-feature-empty surface-card",children:r.jsx("p",{children:u("shell.emptyWorkspaceSessions")})}):M.map(Q=>{const D=Ps(Q.title,u("common.unknown")),re=c.includes(Q.sessionId);return r.jsxs("article",{className:"mobile-session-row surface-card",children:[r.jsxs("button",{type:"button",className:"mobile-session-row-primary",onClick:()=>t(Bn(E.id,Q.sessionId)),children:[r.jsx("span",{className:"mobile-session-row-title",title:D.fullTitle,children:D.displayTitle}),r.jsx("span",{className:"mobile-session-row-provider",children:$i(Q.provider)})]}),r.jsxs("div",{className:"mobile-session-row-actions",children:[r.jsx("span",{className:"mobile-feature-badge mobile-session-row-count",children:Q.messageCount}),r.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":u(re?"shell.unfavoriteAction":"shell.favoriteAction"),title:u(re?"shell.unfavoriteAction":"shell.favoriteAction"),onClick:()=>{w(Q.sessionId)},children:r.jsx(S6,{active:re})}),r.jsx("button",{type:"button",className:"mobile-session-row-action","aria-label":u("shell.archiveAction"),title:u("shell.archiveAction"),onClick:()=>{x(Q.sessionId)},children:r.jsx(C6,{})})]})]},Q.sessionId)})})]}),I.length>0?r.jsxs("section",{className:"mobile-feature-section",children:[r.jsxs("div",{className:"mobile-feature-section-header",children:[r.jsx("div",{children:r.jsx("h2",{children:u("shell.archiveModalTitle")})}),r.jsx("span",{className:"mobile-feature-counter",children:I.length})]}),r.jsx("div",{className:"mobile-feature-stack",children:J.map(Q=>r.jsxs("article",{className:"mobile-session-row surface-card",children:[r.jsxs("div",{className:"mobile-session-row-primary mobile-session-row-primary-static",children:[r.jsx("span",{className:"mobile-session-row-title",title:Q.title,children:Q.title}),r.jsx("span",{className:"mobile-session-row-provider",children:$i(Q.provider)})]}),r.jsx("div",{className:"mobile-session-row-actions",children:r.jsx("button",{type:"button",className:"secondary-button mobile-session-row-restore",onClick:()=>{S(Q.sessionId)},children:u("shell.unarchiveAction")})})]},Q.sessionId))}),J.length<I.length?r.jsx("button",{type:"button",className:"secondary-button mobile-workspace-detail-expand-button",onClick:()=>{q(Q=>Q+nm)},children:u("shell.archiveExpandMore")}):null]}):null]}),r.jsx(Vl,{open:L,workspaces:i.map(Q=>Q.workspace),initialWorkspaceId:a??E.id,onClose:()=>O(!1),onSelect:W})]}):r.jsx("main",{className:"mobile-feature-page mobile-page-scroll-root",children:r.jsxs("article",{className:"mobile-feature-empty surface-card",children:[r.jsx("h1",{children:u("shell.workspaceDetailMissingTitle")}),r.jsx("p",{children:u("shell.workspaceDetailMissingBody")}),r.jsx("button",{type:"button",className:"secondary-button",onClick:()=>t("/workspaces"),children:u("shell.mobileWorkspacesEntry")})]})})}function S6({active:e}){return r.jsx("svg",{viewBox:"0 0 24 24",fill:e?"currentColor":"none",stroke:"currentColor",strokeWidth:"1.8",children:r.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 C6(){return r.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[r.jsx("path",{d:"M4 7.5h16"}),r.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"}),r.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"}),r.jsx("path",{d:"M10 11.5h4"})]})}function wk(e){return`workspace-management.summary.${e}`}function j6(e){return`git-sidebar.snapshot.${e}`}function N6(e,t){const n=(t==null?void 0:t.git.repoRoot)??e.repoRoot??null;return{workspaceId:e.id,name:e.name,path:e.path,git:{isRepository:(t==null?void 0:t.git.isRepository)??!!n,repoRoot:n,currentBranch:(t==null?void 0:t.git.currentBranch)??null,commitCount:(t==null?void 0:t.git.commitCount)??null,remotes:(t==null?void 0:t.git.remotes)??[],error:(t==null?void 0:t.git.error)??null},codeComposition:(t==null?void 0:t.codeComposition)??{scannedFileCount:0,truncated:!1,items:[],error:null}}}function P6(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 T6({isDesktop:e,viewportClass:t}){return e||t==="expanded"?"desktop":"mobile"}function R6(){const e=zn(),t=T6(e);return r.jsx(JL,{shellMode:t})}const E6=[{titleKey:"workbench.emptyResumeTitle",bodyKey:"workbench.emptyResumeBody"},{titleKey:"workbench.emptyNewTitle",bodyKey:"workbench.emptyNewBody"},{titleKey:"workbench.emptyCompanionTitle",bodyKey:"workbench.emptyCompanionBody"}];function A6(){return r.jsx("main",{className:"workbench-page conversation-page-shell",children:r.jsx("section",{className:"workbench-center-placeholder",children:r.jsxs("div",{className:"workbench-empty-guide surface-card",children:[r.jsx("p",{className:"workbench-empty-eyebrow",children:u("workbench.emptyEyebrow")}),r.jsx("div",{className:"workbench-empty-main",children:r.jsxs("div",{className:"workbench-empty-copy",children:[r.jsx("h1",{children:u("workbench.emptyTitle")}),r.jsx("p",{className:"workbench-empty-body",children:u("workbench.emptyBody")})]})}),r.jsx("ol",{className:"workbench-empty-steps",children:E6.map((e,t)=>r.jsxs("li",{className:"workbench-empty-step",children:[r.jsx("span",{className:"workbench-empty-step-index",children:t+1}),r.jsxs("div",{className:"workbench-empty-step-copy",children:[r.jsx("h2",{children:u(e.titleKey)}),r.jsx("p",{children:u(e.bodyKey)})]})]},e.titleKey))}),r.jsx("p",{className:"workbench-empty-tip",children:u("workbench.emptyTip")})]})})})}function I6(){const{shellMode:e}=Yn();return e==="mobile"?r.jsx(ua,{to:"/workspaces",replace:!0}):r.jsx(A6,{})}async function L6(){const e=Si(),t=Gn.getState(),n=await e.bridge.checkForUpdate(t.releaseChannel);if(!n.ok||!n.value)throw new Error(n.detail??"更新检查失败。");return n.value}async function M6(e){return Si().bridge.installUpdate(e)}async function D6(){return Si().bridge.rollbackToPreviousVersion()}function i0(){const e=Si(),t=e.isDesktop,[n,i]=b.useState(!1),[a,c]=b.useState(!1),[l,h]=b.useState(!1),[f,p]=b.useState(null),[y,g]=b.useState(null),[w,x]=b.useState(null),[S,C]=b.useState(!1);async function P(){var _,E;i(!0),p(null);try{const M=await L6();x(M.manifest),g(M.currentVersion),C(M.hasUpdate),p(F6(M.manifest,M.hasUpdate)),M.hasUpdate&&await e.bridge.showNotification(u("settings.releaseUpdateReady"),((_=M.manifest)==null?void 0:_.tagName)??((E=M.manifest)==null?void 0:E.version)??"-")}catch(M){p(M instanceof Error?M.message:u("settings.releaseCheckFailed"))}finally{i(!1)}}async function A(){if(!(!(w!=null&&w.packageUrl)||!w.signature)){c(!0),p(null);try{const _=await M6(w);if(!_.ok){p(_.detail??u("settings.releaseInstallFailed"));return}p(u("settings.releaseInstallStarted")),await e.bridge.showNotification(u("settings.releaseInstallStarted"),w.version)}catch(_){p(_ instanceof Error?_.message:u("settings.releaseInstallFailed"))}finally{c(!1)}}}async function L(){c(!0),p(null);try{const _=await D6();p(_.ok?u("settings.releaseRollbackStarted"):_.detail??u("settings.releaseRollbackFailed")),_.ok&&await e.bridge.showNotification(u("settings.releaseRollbackStarted"),y??u("settings.releaseUnknownVersion"))}catch(_){p(_ instanceof Error?_.message:u("settings.releaseRollbackFailed"))}finally{c(!1)}}async function O(){if(w!=null&&w.htmlUrl){h(!0);try{const _=await e.bridge.openExternal(w.htmlUrl);_.ok||p(_.detail??u("settings.releasePageOpenFailed"))}catch(_){p(_ instanceof Error?_.message:u("settings.releasePageOpenFailed"))}finally{h(!1)}}}const ee=!!(t&&(w!=null&&w.packageUrl)&&w.signature&&S),q=f??(t?null:u("settings.clientUpdateUnsupported"));return r.jsxs("div",{className:"settings-release-card",children:[r.jsxs("div",{className:"settings-release-meta",children:[r.jsxs("span",{children:[u("settings.releaseCurrentVersion"),": ",y??u("settings.releaseUnknownVersion")]}),r.jsxs("span",{children:[u("settings.releaseTargetVersion"),": ",(w==null?void 0:w.version)??"-"]}),r.jsxs("span",{children:[u("settings.releaseTargetTag"),": ",(w==null?void 0:w.tagName)??"-"]}),r.jsxs("span",{children:[u("settings.releasePublishedAt"),": ",_6(w==null?void 0:w.publishedAt)]})]}),w?r.jsxs("div",{className:"settings-release-notes",children:[r.jsx("strong",{children:u("settings.releaseNotes")}),w.title&&w.title!==w.tagName?r.jsx("p",{className:"settings-release-title",children:w.title}):null,w.notes?r.jsx("div",{className:"settings-release-markdown",children:r.jsx(qp,{remarkPlugins:[Kp],children:w.notes})}):r.jsx("p",{children:u("settings.releaseNotesEmpty")})]}):null,q?r.jsx("p",{className:"settings-release-status",children:q}):null,r.jsxs("div",{className:"settings-release-actions",children:[r.jsx("button",{className:"secondary-button",type:"button",disabled:!t||n||a,onClick:P,children:u(n?"common.loading":"settings.releaseCheckNow")}),r.jsx("button",{className:"primary-button",type:"button",disabled:!ee||a,onClick:A,children:u(a?"common.loading":"settings.releaseInstallNow")}),r.jsx("button",{className:"secondary-button",type:"button",disabled:!(w!=null&&w.htmlUrl)||n||a||l,onClick:O,children:u(l?"common.loading":"settings.releaseOpenPage")}),r.jsx("button",{className:"secondary-button",type:"button",disabled:!t||a,onClick:L,children:u("settings.releaseRollback")})]})]})}function F6(e,t){return t?e!=null&&e.packageUrl?e.signature?u("settings.releaseUpdateReady"):u("settings.releaseSignatureMissing"):u("settings.releaseInstallerMissing"):u("settings.releaseUpToDate")}function _6(e){if(!e)return"-";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}async function O6(){const e=Gn.getState();return De.request(`/api/client/service-update?channel=${encodeURIComponent(e.releaseChannel)}`)}function s0(){const e=Si(),[t,n]=b.useState(!1),[i,a]=b.useState(!1),[c,l]=b.useState(null),[h,f]=b.useState(null);async function p(){n(!0),l(null);try{const g=await O6();f(g),l(B6(g)),g.hasUpdate&&await e.bridge.showNotification(u("settings.serverUpdateReady"),`${u("settings.serverTargetVersion")}: ${g.latestVersion??"-"}`)}catch(g){l(g instanceof Error?g.message:u("settings.serverCheckFailed"))}finally{n(!1)}}async function y(){if(h!=null&&h.packagePageUrl){a(!0);try{const g=await e.bridge.openExternal(h.packagePageUrl);g.ok||l(g.detail??u("settings.serverOpenPageFailed"))}catch(g){l(g instanceof Error?g.message:u("settings.serverOpenPageFailed"))}finally{a(!1)}}}return r.jsxs("div",{className:"settings-release-card",children:[r.jsxs("div",{className:"settings-release-meta",children:[r.jsxs("span",{children:[u("settings.serverCurrentVersion"),": ",(h==null?void 0:h.currentVersion)??"-"]}),r.jsxs("span",{children:[u("settings.serverTargetVersion"),": ",(h==null?void 0:h.latestVersion)??u("settings.serverLatestUnknown")]}),r.jsxs("span",{children:[u("settings.serverPackageName"),": ",(h==null?void 0:h.packageName)??"-"]})]}),h?r.jsxs("div",{className:"settings-release-notes",children:[r.jsx("strong",{children:u("settings.serverUpdateCommand")}),r.jsx("p",{className:"settings-release-command",children:h.updateCommand})]}):null,c?r.jsx("p",{className:"settings-release-status",children:c}):null,r.jsxs("div",{className:"settings-release-actions",children:[r.jsx("button",{className:"secondary-button",type:"button",disabled:t,onClick:p,children:u(t?"common.loading":"settings.serverCheckNow")}),r.jsx("button",{className:"secondary-button",type:"button",disabled:!(h!=null&&h.packagePageUrl)||t||i,onClick:y,children:u(i?"common.loading":"settings.serverOpenPage")})]})]})}function B6(e){return e.latestVersion?e.hasUpdate?u("settings.serverUpdateReady"):u("settings.serverUpToDate"):u("settings.serverLatestUnknown")}function xk({title:e,description:t,actions:n,content:i,className:a}){return r.jsx(yN,{className:a,children:r.jsxs("section",{className:"mobile-workspace-home-header mobile-page-header",children:[r.jsx("h1",{className:"mobile-workspace-switcher-heading",children:e}),r.jsxs("div",{className:"mobile-workspace-home-toolbar-top mobile-page-header-main",children:[r.jsx("div",{className:"mobile-page-header-copy",children:r.jsx("div",{className:"mobile-workspace-home-switcher mobile-page-header-static-title",children:r.jsx("span",{className:"mobile-workspace-home-switcher-label",children:e})})}),n?r.jsx("div",{className:"mobile-workspace-home-toolbar-actions mobile-page-header-actions",children:n}):null]}),t?r.jsx("p",{className:"mobile-workspace-home-path mobile-page-header-description",children:t}):null,i?r.jsx("div",{className:"mobile-page-header-content",children:i}):null]})})}function U6(e){return e==="appearance"||e==="server-connection"||e==="security-privacy"||e==="software-update"}function kk(e){return u(e==="en-US"?"locale.enUS":"locale.zhCN")}function Sk(e){return u(e==="beta"?"settings.releaseBeta":"settings.releaseStable")}function Ck(e){switch(e){case"acceptEdits":return u("settings.permissionModeAcceptEdits");case"bypassPermissions":return u("settings.permissionModeBypassPermissions");default:return u("settings.permissionModeDefault")}}function W6(){const e=Wn(),{theme:t,setTheme:n}=PS(),i=gT(W=>W),a=am(W=>W.profile.language),c=am(W=>W.profile.defaultPermissionMode),l=Hi(W=>W.showSystemFiles),h=Hi(W=>W.notificationPreferences.notifyOnPermissionRequest),f=Hi(W=>W.notificationPreferences.notifyOnSessionCompleted),p=Hi(W=>W.notificationPreferences.notifyOnSessionFailed),y={language:a,defaultPermissionMode:c},g=zn(),w=Gm(i.platform),x=w,[S,C]=b.useState(i.hostBaseUrl);b.useEffect(()=>{C(i.hostBaseUrl)},[i.hostBaseUrl]);function P(){kn.clear(),ui.resetToLocalFallback(),e("/login",{replace:!0})}function A(W){n(W)}function L(W){try{return Vi(W)}catch{return null}}const O=L(S),ee=O!==null&&O!==i.hostBaseUrl;function q(W){W.preventDefault(),O&&Gn.update({hostBaseUrl:O})}const _=[{value:"default",label:u("settings.permissionModeDefault")},{value:"acceptEdits",label:u("settings.permissionModeAcceptEdits")},{value:"bypassPermissions",label:u("settings.permissionModeBypassPermissions")}];function E(W){Gn.update({releaseChannel:W==="beta"?"beta":"stable"})}function M(W){Gn.update({autoReconnect:W})}function I(W){Gn.update({autoCheckUpdate:W})}function N(W){const Y=W==="acceptEdits"||W==="bypassPermissions"?W:"default";ui.updateProfile({defaultPermissionMode:Y}).catch(()=>{})}function z(W){ta.setShowSystemFiles(W)}function G(W){ta.setNotificationPreferences({notifyOnPermissionRequest:W})}function J(W){ta.setNotificationPreferences({notifyOnSessionCompleted:W})}function B(W){ta.setNotificationPreferences({notifyOnSessionFailed:W})}return{platform:g,theme:t,applyTheme:A,runtimeConfig:i,accountPreferences:y,showSystemFiles:l,notifyOnPermissionRequest:h,notifyOnSessionCompleted:f,notifyOnSessionFailed:p,showServerSettings:x,canConfigureServerAddress:w,hostBaseUrlDraft:S,setHostBaseUrlDraft:C,canSaveHostBaseUrl:ee,permissionModeOptions:_,handleHostBaseUrlSubmit:q,handleLogout:P,updateReleaseChannel:E,updateAutoReconnect:M,updateAutoCheckUpdate:I,updateDefaultPermissionMode:N,updateShowSystemFiles:z,updateNotifyOnPermissionRequest:G,updateNotifyOnSessionCompleted:J,updateNotifyOnSessionFailed:B}}function jk(){const e=W6(),t=ES();return e.platform.isMobile?r.jsx(H6,{model:e,appVersion:t}):r.jsx(z6,{model:e,appVersion:t})}function z6({model:e,appVersion:t}){const{theme:n,applyTheme:i,runtimeConfig:a,accountPreferences:c,showSystemFiles:l,notifyOnPermissionRequest:h,notifyOnSessionCompleted:f,notifyOnSessionFailed:p,showServerSettings:y,hostBaseUrlDraft:g,setHostBaseUrlDraft:w,canSaveHostBaseUrl:x,permissionModeOptions:S,platform:C,handleHostBaseUrlSubmit:P,handleLogout:A,updateReleaseChannel:L,updateAutoReconnect:O,updateAutoCheckUpdate:ee,updateDefaultPermissionMode:q,updateShowSystemFiles:_,updateNotifyOnPermissionRequest:E,updateNotifyOnSessionCompleted:M,updateNotifyOnSessionFailed:I}=e;return r.jsx("div",{className:"settings-page",children:r.jsxs("div",{className:"settings-container",children:[r.jsx("h1",{className:"settings-title",children:u("settings.title")}),r.jsxs("section",{className:"settings-section",children:[r.jsx("h2",{className:"settings-section-title",children:u("settings.appearance")}),r.jsxs("div",{className:"settings-card",children:[r.jsxs("div",{className:"settings-row",children:[r.jsxs("div",{className:"settings-row-label",children:[r.jsx("span",{className:"settings-row-title",children:u("settings.language")}),r.jsx("span",{className:"settings-row-description",children:u("settings.languageDescription")})]}),r.jsx("div",{className:"settings-row-control",children:r.jsx(rp,{})})]}),r.jsxs("div",{className:"settings-row settings-row-theme",children:[r.jsx("div",{className:"settings-row-label",children:r.jsx("span",{className:"settings-row-title",children:u("settings.theme")})}),r.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:r.jsx("div",{className:"theme-selector",children:jS.map(N=>r.jsxs("button",{type:"button",className:`theme-card ${n===N.id?"active":""}`,"aria-pressed":n===N.id,onClick:()=>i(N.id),children:[r.jsx("span",{className:"theme-preview",style:{background:N.color}}),r.jsx("span",{className:"theme-label",children:NS(N)}),n===N.id?r.jsx("span",{className:"theme-check",children:"✓"}):null]},N.id))})})]}),r.jsxs("div",{className:"settings-row",children:[r.jsxs("div",{className:"settings-row-label",children:[r.jsx("span",{className:"settings-row-title",children:u("settings.showSystemFiles")}),r.jsx("span",{className:"settings-row-description",children:u("settings.showSystemFilesDescription")})]}),r.jsx("div",{className:"settings-row-control",children:r.jsxs("label",{className:"settings-checkbox",children:[r.jsx("input",{type:"checkbox","aria-label":u("settings.showSystemFiles"),checked:l,onChange:N=>_(N.target.checked)}),r.jsx("span",{children:u(l?"settings.enabled":"settings.disabled")})]})})]})]})]}),y?r.jsxs("section",{className:"settings-section",children:[r.jsx("h2",{className:"settings-section-title",children:u("settings.serverConnection")}),r.jsxs("div",{className:"settings-card",children:[r.jsxs("div",{className:"settings-row",children:[r.jsxs("div",{className:"settings-row-label",children:[r.jsx("span",{className:"settings-row-title",children:u("settings.serverAddress")}),r.jsx("span",{className:"settings-row-description",children:u("settings.serverDescription")})]}),r.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:r.jsxs("form",{className:"settings-inline-form",onSubmit:P,children:[r.jsx("input",{"aria-label":u("settings.serverAddress"),className:"settings-text-input",value:g,onChange:N=>w(N.target.value)}),r.jsx("button",{className:"settings-button",disabled:!x,type:"submit",children:u("common.save")})]})})]}),r.jsxs("div",{className:"settings-row",children:[r.jsxs("div",{className:"settings-row-label",children:[r.jsx("span",{className:"settings-row-title",children:u("settings.autoReconnect")}),r.jsx("span",{className:"settings-row-description",children:u("settings.autoReconnectDescription")})]}),r.jsx("div",{className:"settings-row-control",children:r.jsxs("label",{className:"settings-checkbox",children:[r.jsx("input",{type:"checkbox",checked:a.autoReconnect,onChange:N=>O(N.target.checked)}),r.jsx("span",{children:a.autoReconnect?u("settings.enabled"):u("settings.disabled")})]})})]})]})]}):null,r.jsxs("section",{className:"settings-section",children:[r.jsx("h2",{className:"settings-section-title",children:u("settings.securityPrivacy")}),r.jsxs("div",{className:"settings-card",children:[r.jsxs("div",{className:"settings-row",children:[r.jsxs("div",{className:"settings-row-label",children:[r.jsx("span",{className:"settings-row-title",children:u("settings.defaultPermissionMode")}),r.jsx("span",{className:"settings-row-description",children:u("settings.defaultPermissionModeDescription")})]}),r.jsx("div",{className:"settings-row-control",children:r.jsx("select",{"aria-label":u("settings.defaultPermissionMode"),className:"settings-select",value:c.defaultPermissionMode,onChange:N=>q(N.target.value),children:S.map(N=>r.jsx("option",{value:N.value,children:N.label},N.value))})})]}),r.jsxs("div",{className:"settings-row",children:[r.jsxs("div",{className:"settings-row-label",children:[r.jsx("span",{className:"settings-row-title",children:u("settings.notifyOnPermissionRequest")}),r.jsx("span",{className:"settings-row-description",children:u("settings.notifyOnPermissionRequestDescription")})]}),r.jsx("div",{className:"settings-row-control",children:r.jsxs("label",{className:"settings-checkbox",children:[r.jsx("input",{type:"checkbox","aria-label":u("settings.notifyOnPermissionRequest"),checked:h,onChange:N=>E(N.target.checked)}),r.jsx("span",{children:u(h?"settings.enabled":"settings.disabled")})]})})]}),r.jsxs("div",{className:"settings-row",children:[r.jsxs("div",{className:"settings-row-label",children:[r.jsx("span",{className:"settings-row-title",children:u("settings.notifyOnSessionCompleted")}),r.jsx("span",{className:"settings-row-description",children:u("settings.notifyOnSessionCompletedDescription")})]}),r.jsx("div",{className:"settings-row-control",children:r.jsxs("label",{className:"settings-checkbox",children:[r.jsx("input",{type:"checkbox","aria-label":u("settings.notifyOnSessionCompleted"),checked:f,onChange:N=>M(N.target.checked)}),r.jsx("span",{children:u(f?"settings.enabled":"settings.disabled")})]})})]}),r.jsxs("div",{className:"settings-row",children:[r.jsxs("div",{className:"settings-row-label",children:[r.jsx("span",{className:"settings-row-title",children:u("settings.notifyOnSessionFailed")}),r.jsx("span",{className:"settings-row-description",children:u("settings.notifyOnSessionFailedDescription")})]}),r.jsx("div",{className:"settings-row-control",children:r.jsxs("label",{className:"settings-checkbox",children:[r.jsx("input",{type:"checkbox","aria-label":u("settings.notifyOnSessionFailed"),checked:p,onChange:N=>I(N.target.checked)}),r.jsx("span",{children:u(p?"settings.enabled":"settings.disabled")})]})})]})]})]}),r.jsxs("section",{className:"settings-section",children:[r.jsx("h2",{className:"settings-section-title",children:u("settings.softwareUpdate")}),r.jsxs("div",{className:"settings-card",children:[r.jsxs("div",{className:"settings-row",children:[r.jsxs("div",{className:"settings-row-label",children:[r.jsx("span",{className:"settings-row-title",children:u("settings.releaseChannel")}),r.jsx("span",{className:"settings-row-description",children:u("settings.releaseChannelDescription")})]}),r.jsx("div",{className:"settings-row-control",children:r.jsxs("select",{"aria-label":u("settings.releaseChannel"),className:"settings-select",value:a.releaseChannel,onChange:N=>L(N.target.value),children:[r.jsx("option",{value:"stable",children:u("settings.releaseStable")}),r.jsx("option",{value:"beta",children:u("settings.releaseBeta")})]})})]}),r.jsxs("div",{className:"settings-row",children:[r.jsx("div",{className:"settings-row-label",children:r.jsx("span",{className:"settings-row-title",children:u("settings.serverUpdate")})}),r.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:r.jsx(s0,{})})]}),C.isWeb?null:r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"settings-row",children:[r.jsx("div",{className:"settings-row-label",children:r.jsx("span",{className:"settings-row-title",children:u("settings.autoCheckUpdate")})}),r.jsx("div",{className:"settings-row-control",children:r.jsxs("label",{className:"settings-checkbox",children:[r.jsx("input",{type:"checkbox",checked:a.autoCheckUpdate,onChange:N=>ee(N.target.checked)}),r.jsx("span",{children:a.autoCheckUpdate?u("settings.enabled"):u("settings.disabled")})]})})]}),r.jsxs("div",{className:"settings-row",children:[r.jsx("div",{className:"settings-row-label",children:r.jsx("span",{className:"settings-row-title",children:u("settings.clientUpdate")})}),r.jsx("div",{className:"settings-row-control settings-row-control-stretch",children:r.jsx(i0,{})})]})]})]})]}),r.jsxs("div",{className:"settings-footer settings-footer-with-logout",children:[r.jsxs("span",{className:"settings-version",children:["CodingNS v",t]}),r.jsx("button",{className:"settings-button settings-button-danger settings-button-sticky",onClick:A,type:"button",children:u("common.logout")})]})]})})}function H6({model:e,appVersion:t}){const n=Wn(),{section:i}=ca(),a=U6(i)?i:null,c=e.showServerSettings?[{id:"appearance",title:u("settings.appearance"),description:u("settings.appearanceSectionSummary"),value:kk(e.accountPreferences.language),icon:r.jsx(Pk,{})},{id:"server-connection",title:u("settings.serverConnection"),description:u("settings.serverConnectionSectionSummary"),value:e.runtimeConfig.hostBaseUrl,icon:r.jsx(K6,{})},{id:"security-privacy",title:u("settings.securityPrivacy"),description:u("settings.securityPrivacySectionSummary"),value:Ck(e.accountPreferences.defaultPermissionMode),icon:r.jsx(Rk,{})},{id:"software-update",title:u("settings.softwareUpdate"),description:u("settings.softwareUpdateSectionSummary"),value:Sk(e.runtimeConfig.releaseChannel),icon:r.jsx(Tk,{})}]:[{id:"appearance",title:u("settings.appearance"),description:u("settings.appearanceSectionSummary"),value:kk(e.accountPreferences.language),icon:r.jsx(Pk,{})},{id:"security-privacy",title:u("settings.securityPrivacy"),description:u("settings.securityPrivacySectionSummary"),value:Ck(e.accountPreferences.defaultPermissionMode),icon:r.jsx(Rk,{})},{id:"software-update",title:u("settings.softwareUpdate"),description:u("settings.softwareUpdateSectionSummary"),value:Sk(e.runtimeConfig.releaseChannel),icon:r.jsx(Tk,{})}];return(a?c.find(h=>h.id===a)??null:null)?r.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[r.jsx(xk,{title:u("settings.title")}),r.jsxs("div",{className:"settings-mobile-container",children:[a==="appearance"?r.jsx(q6,{model:e}):null,a==="server-connection"&&e.showServerSettings?r.jsx($6,{model:e}):null,a==="security-privacy"?r.jsx(V6,{model:e}):null,a==="software-update"?r.jsx(G6,{model:e}):null]}),r.jsx(Nk,{onLogout:e.handleLogout})]}):r.jsxs("div",{className:"settings-page settings-page-mobile mobile-page-scroll-root mobile-page-with-top-header",children:[r.jsx(xk,{title:u("settings.title")}),r.jsxs("div",{className:"settings-mobile-container",children:[r.jsx("section",{className:"settings-mobile-group-section",children:r.jsx("div",{className:"settings-mobile-card",children:c.map(h=>r.jsxs("button",{type:"button",className:"settings-mobile-nav-row",onClick:()=>n(`/settings/${h.id}`),children:[r.jsx("span",{className:"settings-mobile-nav-icon",children:h.icon}),r.jsxs("span",{className:"settings-mobile-nav-copy",children:[r.jsx("span",{className:"settings-mobile-nav-title",children:h.title}),r.jsx("span",{className:"settings-mobile-nav-description",children:h.description})]}),r.jsxs("span",{className:"settings-mobile-nav-trailing",children:[h.value?r.jsx("span",{className:"settings-mobile-nav-value",children:h.value}):null,r.jsx(Q6,{})]})]},h.id))})}),r.jsx("div",{className:"settings-footer settings-footer-mobile",children:r.jsxs("span",{className:"settings-version",children:["CodingNS v",t]})})]}),r.jsx(Nk,{onLogout:e.handleLogout})]})}function q6({model:e}){return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"settings-mobile-group-section",children:[r.jsx("h2",{className:"settings-mobile-group-title",children:u("settings.language")}),r.jsx("p",{className:"settings-mobile-group-note",children:u("settings.languageDescription")}),r.jsx("div",{className:"settings-mobile-card",children:r.jsxs("div",{className:"settings-mobile-form-row",children:[r.jsx("div",{className:"settings-mobile-row-copy",children:r.jsx("span",{className:"settings-mobile-row-title",children:u("settings.language")})}),r.jsx(rp,{variant:"compact",className:"settings-mobile-language-switcher"})]})})]}),r.jsxs("section",{className:"settings-mobile-group-section",children:[r.jsx("h2",{className:"settings-mobile-group-title",children:u("settings.theme")}),r.jsx("p",{className:"settings-mobile-group-note",children:u("settings.themeDescription")}),r.jsx("div",{className:"settings-mobile-card",children:jS.map(t=>{const n=e.theme===t.id;return r.jsxs("button",{type:"button",className:`settings-mobile-choice-row${n?" active":""}`,"aria-pressed":n,onClick:()=>e.applyTheme(t.id),children:[r.jsxs("span",{className:"settings-mobile-choice-leading",children:[r.jsx("span",{className:"settings-mobile-choice-dot",style:{background:t.color},"aria-hidden":"true"}),r.jsx("span",{className:"settings-mobile-choice-label",children:NS(t)})]}),r.jsx("span",{className:"settings-mobile-choice-indicator","aria-hidden":"true",children:n?r.jsx(Y6,{}):null})]},t.id)})})]}),r.jsxs("section",{className:"settings-mobile-group-section",children:[r.jsx("h2",{className:"settings-mobile-group-title",children:u("settings.fileManager")}),r.jsx("p",{className:"settings-mobile-group-note",children:u("settings.showSystemFilesDescription")}),r.jsx("div",{className:"settings-mobile-card",children:r.jsxs("div",{className:"settings-mobile-form-row",children:[r.jsxs("div",{className:"settings-mobile-row-copy",children:[r.jsx("span",{className:"settings-mobile-row-title",children:u("settings.showSystemFiles")}),r.jsx("span",{className:"settings-mobile-row-description",children:u("settings.showSystemFilesDescription")})]}),r.jsx(ia,{checked:e.showSystemFiles,label:u("settings.showSystemFiles"),onChange:e.updateShowSystemFiles})]})})]})]})}function $6({model:e}){return r.jsxs(r.Fragment,{children:[e.canConfigureServerAddress?r.jsxs("section",{className:"settings-mobile-group-section",children:[r.jsx("h2",{className:"settings-mobile-group-title",children:u("settings.serverAddress")}),r.jsx("p",{className:"settings-mobile-group-note",children:u("settings.serverDescription")}),r.jsx("div",{className:"settings-mobile-card",children:r.jsxs("form",{className:"settings-mobile-form-stack",onSubmit:e.handleHostBaseUrlSubmit,children:[r.jsx("input",{"aria-label":u("settings.serverAddress"),className:"settings-text-input settings-mobile-input",value:e.hostBaseUrlDraft,onChange:t=>e.setHostBaseUrlDraft(t.target.value)}),r.jsx("button",{className:"settings-mobile-primary-button",disabled:!e.canSaveHostBaseUrl,type:"submit",children:u("common.save")})]})})]}):null,r.jsxs("section",{className:"settings-mobile-group-section",children:[r.jsx("h2",{className:"settings-mobile-group-title",children:u("settings.serverConnection")}),r.jsx("div",{className:"settings-mobile-card",children:r.jsxs("div",{className:"settings-mobile-form-row",children:[r.jsxs("div",{className:"settings-mobile-row-copy",children:[r.jsx("span",{className:"settings-mobile-row-title",children:u("settings.autoReconnect")}),r.jsx("span",{className:"settings-mobile-row-description",children:u("settings.autoReconnectDescription")})]}),r.jsx(ia,{checked:e.runtimeConfig.autoReconnect,label:u("settings.autoReconnect"),onChange:e.updateAutoReconnect})]})})]})]})}function V6({model:e}){return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"settings-mobile-group-section",children:[r.jsx("h2",{className:"settings-mobile-group-title",children:u("settings.securityPrivacy")}),r.jsx("p",{className:"settings-mobile-group-note",children:u("settings.securityPrivacySectionSummary")}),r.jsx("div",{className:"settings-mobile-card",children:r.jsxs("div",{className:"settings-mobile-form-row",children:[r.jsxs("div",{className:"settings-mobile-row-copy",children:[r.jsx("span",{className:"settings-mobile-row-title",children:u("settings.defaultPermissionMode")}),r.jsx("span",{className:"settings-mobile-row-description",children:u("settings.defaultPermissionModeDescription")})]}),r.jsx("select",{"aria-label":u("settings.defaultPermissionMode"),className:"settings-select settings-mobile-select",value:e.accountPreferences.defaultPermissionMode,onChange:t=>e.updateDefaultPermissionMode(t.target.value),children:e.permissionModeOptions.map(t=>r.jsx("option",{value:t.value,children:t.label},t.value))})]})})]}),r.jsxs("section",{className:"settings-mobile-group-section",children:[r.jsx("h2",{className:"settings-mobile-group-title",children:u("settings.notificationSettings")}),r.jsx("p",{className:"settings-mobile-group-note",children:u("settings.notificationSettingsDescription")}),r.jsxs("div",{className:"settings-mobile-card",children:[r.jsxs("div",{className:"settings-mobile-form-row",children:[r.jsxs("div",{className:"settings-mobile-row-copy",children:[r.jsx("span",{className:"settings-mobile-row-title",children:u("settings.notifyOnPermissionRequest")}),r.jsx("span",{className:"settings-mobile-row-description",children:u("settings.notifyOnPermissionRequestDescription")})]}),r.jsx(ia,{checked:e.notifyOnPermissionRequest,label:u("settings.notifyOnPermissionRequest"),onChange:e.updateNotifyOnPermissionRequest})]}),r.jsxs("div",{className:"settings-mobile-form-row",children:[r.jsxs("div",{className:"settings-mobile-row-copy",children:[r.jsx("span",{className:"settings-mobile-row-title",children:u("settings.notifyOnSessionCompleted")}),r.jsx("span",{className:"settings-mobile-row-description",children:u("settings.notifyOnSessionCompletedDescription")})]}),r.jsx(ia,{checked:e.notifyOnSessionCompleted,label:u("settings.notifyOnSessionCompleted"),onChange:e.updateNotifyOnSessionCompleted})]}),r.jsxs("div",{className:"settings-mobile-form-row",children:[r.jsxs("div",{className:"settings-mobile-row-copy",children:[r.jsx("span",{className:"settings-mobile-row-title",children:u("settings.notifyOnSessionFailed")}),r.jsx("span",{className:"settings-mobile-row-description",children:u("settings.notifyOnSessionFailedDescription")})]}),r.jsx(ia,{checked:e.notifyOnSessionFailed,label:u("settings.notifyOnSessionFailed"),onChange:e.updateNotifyOnSessionFailed})]})]})]})]})}function G6({model:e}){return r.jsxs(r.Fragment,{children:[r.jsxs("section",{className:"settings-mobile-group-section",children:[r.jsx("h2",{className:"settings-mobile-group-title",children:u("settings.softwareUpdate")}),r.jsx("p",{className:"settings-mobile-group-note",children:u("settings.softwareUpdateSectionSummary")}),r.jsx("div",{className:"settings-mobile-card",children:r.jsxs("div",{className:"settings-mobile-form-row",children:[r.jsxs("div",{className:"settings-mobile-row-copy",children:[r.jsx("span",{className:"settings-mobile-row-title",children:u("settings.releaseChannel")}),r.jsx("span",{className:"settings-mobile-row-description",children:u("settings.releaseChannelDescription")})]}),r.jsxs("select",{"aria-label":u("settings.releaseChannel"),className:"settings-select settings-mobile-select",value:e.runtimeConfig.releaseChannel,onChange:t=>e.updateReleaseChannel(t.target.value),children:[r.jsx("option",{value:"stable",children:u("settings.releaseStable")}),r.jsx("option",{value:"beta",children:u("settings.releaseBeta")})]})]})})]}),r.jsxs("section",{className:"settings-mobile-group-section",children:[r.jsx("h2",{className:"settings-mobile-group-title",children:u("settings.serverUpdate")}),r.jsx("div",{className:"settings-mobile-card settings-mobile-release-card",children:r.jsx(s0,{})})]}),e.platform.isWeb?null:r.jsxs("section",{className:"settings-mobile-group-section",children:[r.jsx("h2",{className:"settings-mobile-group-title",children:u("settings.clientUpdate")}),r.jsx("div",{className:"settings-mobile-card",children:r.jsxs("div",{className:"settings-mobile-form-row",children:[r.jsx("div",{className:"settings-mobile-row-copy",children:r.jsx("span",{className:"settings-mobile-row-title",children:u("settings.autoCheckUpdate")})}),r.jsx(ia,{checked:e.runtimeConfig.autoCheckUpdate,label:u("settings.autoCheckUpdate"),onChange:e.updateAutoCheckUpdate})]})}),r.jsx("div",{className:"settings-mobile-card settings-mobile-release-card",children:r.jsx(i0,{})})]})]})}function Nk({onLogout:e}){return r.jsx("div",{className:"settings-mobile-sticky-footer",children:r.jsx("button",{type:"button",className:"settings-mobile-danger-button settings-mobile-danger-button-sticky",onClick:e,children:u("common.logout")})})}function ia({checked:e,label:t,onChange:n}){return r.jsxs("label",{className:"settings-mobile-switch","aria-label":t,children:[r.jsx("input",{type:"checkbox",checked:e,onChange:i=>n(i.target.checked)}),r.jsx("span",{className:"settings-mobile-switch-track","aria-hidden":"true",children:r.jsx("span",{className:"settings-mobile-switch-thumb"})})]})}function Pk(){return r.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[r.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"}),r.jsx("circle",{cx:"6.6",cy:"9.2",r:".8",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"8.8",cy:"6.8",r:".8",fill:"currentColor",stroke:"none"}),r.jsx("circle",{cx:"12.1",cy:"6.6",r:".8",fill:"currentColor",stroke:"none"})]})}function K6(){return r.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[r.jsx("path",{d:"M4 7.5 10 4l6 3.5v5L10 16l-6-3.5v-5Z"}),r.jsx("path",{d:"M10 9.5V16"}),r.jsx("path",{d:"M4 7.5 10 11l6-3.5"})]})}function Tk(){return r.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[r.jsx("rect",{x:"3.5",y:"4",width:"13",height:"9.5",rx:"2.2"}),r.jsx("path",{d:"M7 16h6"}),r.jsx("path",{d:"M10 13.5V16"}),r.jsx("path",{d:"m8 8 2 2 3-3"})]})}function Rk(){return r.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[r.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"}),r.jsx("path",{d:"m8.3 9.8 1.2 1.2 2.4-2.5"})]})}function Q6(){return r.jsx("svg",{viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:r.jsx("path",{d:"m4 2 4 4-4 4"})})}function Y6(){return r.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:r.jsx("path",{d:"m3.5 8.2 2.6 2.6 6-6"})})}function X6(){const e=Kk(n=>n.session),t=Qr();if(!e){const n=`${t.pathname}${t.search}`;return r.jsx(ua,{to:`/login?returnTo=${encodeURIComponent(n)}`,replace:!0})}return r.jsx(dm,{})}function Ek(){const{shellMode:e}=Yn();return r.jsx(ua,{to:e==="mobile"?"/workspaces":"/landing",replace:!0})}const J6=[{path:"/bootstrap",element:r.jsx(sE,{})},{path:"/login",element:r.jsx(hE,{})},{path:"/desktop-window-preview",element:r.jsx(Vz,{})},{path:"/",element:r.jsx(X6,{}),children:[{path:"desktop-window/:windowId",element:r.jsx(Q5,{})},{element:r.jsx(R6,{}),children:[{index:!0,element:r.jsx(Ek,{})},{path:"landing",element:r.jsx(I6,{})},{path:"workspaces",element:r.jsx(v6,{})},{path:"workspaces/:workspaceId",element:r.jsx(k6,{})},{path:"workspaces/:workspaceId/sessions",element:r.jsx(n6,{})},{path:"workspaces/:workspaceId/sessions/:sessionId",element:r.jsx(Tz,{})},{path:"workspaces/:workspaceId/tools",element:r.jsx(u6,{})},{path:"workspaces/:workspaceId/tools/files",element:r.jsx(r6,{})},{path:"workspaces/:workspaceId/tools/git",element:r.jsx(i6,{})},{path:"workspaces/:workspaceId/tools/processes",element:r.jsx(s6,{})},{path:"workspaces/:workspaceId/terminals",lazy:async()=>({Component:(await sa(()=>import("./TerminalPage-4p6EBqrR.js"),__vite__mapDeps([0,1]))).TerminalPage})},{path:"workspaces/:workspaceId/butler",element:r.jsx(mz,{})},{path:"settings",element:r.jsx(jk,{})},{path:"settings/:section",element:r.jsx(jk,{})},{path:"*",element:r.jsx(Ek,{})}]}]}];function Z6(){return uR(J6)}function eH(){const e=la(n=>n.profile.language),t=b.useMemo(()=>Z6(),[]);return r.jsx(ER,{children:r.jsx(YR,{children:r.jsx(BR,{language:e,children:r.jsx($R,{children:r.jsx(QR,{children:r.jsx(vR,{router:t})})})})})})}qT().finally(()=>{_P.createRoot(document.getElementById("root")).render(r.jsx(eH,{}))});export{$S as C,go as M,R5 as T,kn as a,Yr as b,xp as c,Wn as d,ca as e,Yn as f,Vk as g,En as h,rH as i,Kn as j,r as k,P5 as l,lH as m,ck as n,sH as o,aH as p,Qn as q,b as r,kp as s,u as t,zn as u,iH as v,Fr as w,T5 as x,oH as y,nH as z};