dsh-code-server-app 0.3.55 → 0.3.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -109,8 +109,20 @@ This plugin registers:
109
109
  session's cwd, and posts the absolute path (plus optional `line`) to the host's
110
110
  `/api/code-server/open-file`; the bundled extension (`dshcs-open-file`) then calls `showTextDocument`
111
111
  (positioned at the line when given).
112
- - **One address = one tab** (DSH semantics: `contentId` *is* the address): three files mean three chips, but they
113
- share the single resident workbench — switching tabs just re-aims the workbench at the corresponding file.
112
+ - **A single tab (since 0.3.57)**: DSH's own semantics are "one address = one tab" (`contentId` *is* the address —
113
+ same address is idempotent, a different one always opens a new tab), and `replaceTab` can only be passed by the
114
+ **opener** (the product's own `openFile`/`openResource`) — so the plugin instead closes the older code-server tab
115
+ in the same pane when a new tab's body mounts. Clicking a second file now changes the content of **the one tab**
116
+ (its chip title follows) instead of stacking tabs.
117
+ Two deliberate boundaries: (1) only **same-pane** tabs are closed — a split layout is the user's own doing, and
118
+ the product's convention is "one page per kind in each pane" (`SidebarRightTabDefinition.multiple`);
119
+ (2) only a tab that becomes visible for the first time consolidates — tab restoration/activation order is not
120
+ ours to control, and letting every visible tab close its siblings would ping-pong (a `ref` pins "once per mount").
121
+ These tabs always shared **one resident workbench** (the IDE is a single instance), so closing one never reloads
122
+ it: the resident iframe is owned by `src/surface.js`, and a tab is merely its docking host (`Element.moveBefore`).
123
+ Regression: `scripts/test-client-bundle-tabs.mjs` renders two tabs against the **built bundle** and asserts the
124
+ old one is closed, the new one stays, other panes/hidden tabs are untouched, and an old DSH without `actions`
125
+ does not throw (negative control: dropping the consolidation call makes it FAIL).
114
126
  - **Why the bundled extension stays**: VS Code Web has no official "open this file from outside" API (the only
115
127
  entry is `?folder=`, which picks the workspace), so aiming the workbench at a file has to be done by an
116
128
  extension inside the tree. The host writes a signal file, the extension polls it and calls
@@ -311,6 +323,17 @@ of passing stale data off as fresh).
311
323
  request/response round trip every 600 ms. Polling also buys two useful properties: it is idempotent (a dropped event
312
324
  only costs one notification — the data always lives in the editor) and the cached state is inherently fresh.
313
325
 
326
+ **Event delivery contract (fixed in 0.3.56)**: `agent-edit` notifications live in a ring buffer and are fetched with
327
+ `since=<cursor>`; **the sequence is monotonic for the lifetime of one bridge endpoint (host process)**, the client's
328
+ cursor only moves forward, and a new endpoint (the pipe name carries the host pid) re-aligns with `since=0`.
329
+ From 0.3.9 through 0.3.55 the host called `reset()` after **every** `/sync`, and that call rewound the sequence
330
+ counter — so once the extension had seen `seq=1`, every later event was numbered 1 again and `seq > since` never
331
+ held: **at most one event per IDE session was ever delivered** (exactly the "a diff rarely shows up, and when it does
332
+ its old side is empty" the user reported). Now `reset()` only clears the buffer, `/sync` also returns `lastSeq` (the
333
+ high-water mark), and the extension uses it to notice a cursor that ran ahead and re-align to 0 on its own.
334
+ Regression: the "push → take → clear, twice" case in `scripts/test-bridge-routes.mjs`. This remains a
335
+ **notification channel**, not a reliable queue: 64 entries, oldest dropped, a lost event costs one notification.
336
+
314
337
  ### Security model (five invariants; read before touching `lib/bridge.mjs`)
315
338
 
316
339
  The token lives in `<extensionsDir>/.dshcs-bridge/bridge.json`, **readable by any process of the same local
package/README.md CHANGED
@@ -119,8 +119,18 @@ DSH 用**资源地址**命名文件,`openFile` 只负责把地址交给右侧栏
119
119
  (`src/address.js`,与 DSH `parseFileAddress` 同语义),相对路径按该会话 cwd 展开成绝对路径,
120
120
  再把绝对路径 + 可选 `line` 交给 host 的 `/api/code-server/open-file`;内建扩展
121
121
  (`dshcs-open-file`)在 workbench 里 `showTextDocument`(带行号时定位到该行)。
122
- - **一个地址 = 一个 tab**(官方语义,`contentId` 就是地址):打开三个文件会有三个 chip,
123
- 但它们共用同一个常驻 workbench(我们的 IDE 是单实例),切换时只是让 workbench 定位到对应文件。
122
+ - **只留一个 tab(0.3.57 起)**:官方语义本是"一个地址 = 一个 tab"(`contentId` 就是地址:同址幂等、
123
+ 异址必新开),而 `replaceTab` 只有**发起方**(产品自己的 `openFile`/`openResource`)能传 ——
124
+ 所以插件改成:新 tab 的 body 挂载时**把同窗格里旧的 code-server tab 关掉**。
125
+ 于是连点两个文件时,你看到的是**同一个 tab 在换内容**(chip 标题跟着变),而不是越开越多。
126
+ 两条刻意留的边界:① 只收**同窗格**的 —— 多窗格是用户主动切分的布局,官方自己也是"每窗格一份"
127
+ (`SidebarRightTabDefinition.multiple` 的注释:"one page per kind in each pane");
128
+ ② 只有"首次可见"的那个新 tab 负责收 —— 标签页恢复/激活顺序不可控,若每个可见的都收别人,
129
+ 关掉一个会让下一个变可见,互相收成乒乓(用 ref 钉住"每次挂载只收一次")。
130
+ 这些 tab 本来就共用**同一个常驻 workbench**(IDE 是单实例),关掉一个不会重载它:
131
+ 常驻 iframe 由 `src/surface.js` 持有,tab 只是它的停靠宿主(`Element.moveBefore`)。
132
+ 回归:`scripts/test-client-bundle-tabs.mjs` —— 对**构建产物**渲染两个 tab,断言旧的被关、新的还在、
133
+ 跨窗格不动、不可见时不动、缺 `actions` 的老 DSH 也不崩(负向对照:摘掉合并调用 → 该用例 FAIL)。
124
134
  - **为什么还留着那个内建扩展**:VS Code Web 没有"从外部打开文件"的官方 API(唯一入口是
125
135
  `?folder=` 指定工作区),所以"让 workbench 定位到某个文件"只能由树内的扩展完成;
126
136
  host 写信号文件、扩展轮询并 `showTextDocument`,失败保留重试(实例尚未就绪时也不会丢)。
@@ -296,6 +306,15 @@ host 反向请求不到它。所以编辑器状态只能在扩展主动发起的
296
306
  **为什么不用 SSE/WebSocket**:扩展宿主里没有 HTTP 服务器,而桥的形态是"每 600ms 一趟请求/响应"。
297
307
  轮询给了两条好性质:幂等(丢一次事件只是少一次提示,数据本身永远在编辑器里),以及状态天然最新(每趟都刷新)。
298
308
 
309
+ **事件的送达契约(0.3.56 修正)**:`agent-edit` 这类提示走环形缓冲,靠 `since=<游标>` 取"比我新的那些";
310
+ **seq 在一次桥端点(宿主进程)生命周期内单调递增**,客户端游标只增不减,端点换了(管道名里带宿主 pid)
311
+ 才用 `since=0` 重新对齐。0.3.9–0.3.55 的宿主在**每趟** `/sync` 后都调用 `reset()`,而它当时会把 seq 归零
312
+ ⇒ 扩展第一次收到 `seq=1` 后,新事件又从 1 开始编号,`seq > since` 永远不成立 ⇒ **每个 IDE 会话最多只送达
313
+ 第一条事件**(用户看到的现象就是"偶尔才有一条 diff,而那条还是空 old")。现在:`reset()` 只清缓冲、不回退
314
+ seq,并且 `/sync` 回应里带 `lastSeq`(高水位),扩展据此自查游标是否超前(超前就退回 0 重新对齐,自愈)。
315
+ 回归:`scripts/test-bridge-routes.mjs` 里有一条按真实调用顺序复刻"推送→取→清空"两次的用例。
316
+ 注意这仍是**提示通道**,不是可靠队列:缓冲 64 条,超出丢最旧,漏一次只是少一次提示。
317
+
299
318
  ### 安全模型(五条不变量,改 `lib/bridge.mjs` 之前先读)
300
319
 
301
320
  桥的令牌写在 `<extensionsDir>/.dshcs-bridge/bridge.json`(**对本机同用户进程可读**),所以:
@@ -488,6 +507,8 @@ pnpm test:vendored # 重打包表 ↔ 插件依赖表一致(无 npm:
488
507
  pnpm test:dsh-resolve # 部署位置表:各平台全局装布局(npm --prefix / nvm / pnpm global / %APPDATA%)都能找到 DSH 部署
489
508
  pnpm test:child-node # Electron 宿主(桌面版)下给 IDE 子进程挑真 Node:候选顺序 / 剥离 ELECTRON_RUN_AS_NODE / 找不到时如实退回
490
509
  pnpm test:package-files # 发布物白名单守卫:files 里的模块**递归**import 到的本地文件也必须在 files 里(0.3.53 漏 lib/child-node.mjs 的事故)
510
+ # 以及反向:files 每条都得存在 —— **打包期生成物除外**(vendor/VENDOR.json 在
511
+ # .gitignore 里,由 prepack 的 vendor:vscode 生成;ci.yml 不下树,干净克隆上它必然不存在)
491
512
  pnpm test:installed # 安装冒烟:对**已装进 profile 的产物**做断言(默认 <DSH_HOME>/profiles/web)
492
513
  # files 白名单每条都在 / 重打包包在当前平台齐全 / 原生模块无缺失 /
493
514
  # 已安装副本能 import / 树在位 —— 仓库回归看不出这一类
@@ -279,6 +279,12 @@ function createClient(options) {
279
279
  for (const event of events) {
280
280
  if (Number.isSafeInteger(event.seq) && event.seq > since) since = event.seq;
281
281
  }
282
+ // 自查:宿主报的 seq 高水位若**低于**我的游标,说明两边序号错位了(宿主重启过,或我手里这份
283
+ // 游标是上一任宿主留下的 —— adopt 场景里 IDE 的 pid 没变,restore() 就会把旧游标装回来)。
284
+ // 不对齐的话 `seq > since` 永远为假 ⇒ 事件永久收不到(0.3.55 及以前的宿主还每趟把 seq 归零,
285
+ // 症状就是"每个 IDE 会话只收到第一条 diff")。退回 0 重新对齐即可自愈。
286
+ const lastSeq = body !== null && Number.isSafeInteger(body.lastSeq) ? body.lastSeq : null;
287
+ if (lastSeq !== null && lastSeq < since) since = 0;
282
288
  // 0.2.3 起面板像 DSH 对话一样显示内容,数据走这三个字段(见 host 侧 lib/bridge-thread.mjs
283
289
  // 与 lib/bridge-approval.mjs):
284
290
  // - thread:被面板观看的会话的**新内容**条目(旧版宿主没有这个字段 → 面板明确报错);
@@ -2,7 +2,7 @@
2
2
  "name": "dshcs-editor-bridge",
3
3
  "displayName": "DSH Editor Bridge",
4
4
  "description": "只读地把编辑器状态(未保存缓冲区、诊断、活动选区)提供给 DSH;右键提问打开 DSH 页面里的悬浮对话对话框(0.2.5;老宿主退回编辑器面板),正文/思考/上下文都用 DSH 官方渲染器,并可就地回答授权请求。由 dsh-code-server-app 插件安装,可禁用。",
5
- "version": "0.2.16",
5
+ "version": "0.2.17",
6
6
  "publisher": "dsh-code-server-app",
7
7
  "license": "MIT",
8
8
  "private": true,
@@ -12,7 +12,7 @@
12
12
  | react | 18.3.1 | MIT |
13
13
  | react-dom | 18.3.1 | MIT |
14
14
 
15
- 生成时间:2026-09-19T09:11:10.701Z
15
+ 生成时间:2026-09-19T12:45:33.924Z
16
16
  渲染器:@deepseek-ai/dsh-client-ui-primitives@0.1.6-alpha.1(DSH 部署的界面版本:未知)
17
17
  设计令牌:@deepseek-ai/dsh-client-ui-theme@0.1.6-alpha.1(11 段)
18
18
  KaTeX:已打包(公式排版与 DSH 界面一致)
package/lib/bridge.mjs CHANGED
@@ -252,7 +252,13 @@ export async function callBridge(target, route, options = {}) {
252
252
  * 事件环形缓冲。host 侧唯一的事件源是 `ctx.on('tools/result')`。
253
253
  *
254
254
  * 语义:**不是可靠队列**。60/64 条只是让扩展在下一次轮询时"追上",超出即丢最旧的;
255
- * host 重启后 seq 归零,扩展用 `since=0` 重新对齐(不承诺断点续传)。
255
+ * **seq 在一次桥端点(宿主进程)生命周期内必须单调**,客户端(扩展)的游标只增不减 ——
256
+ * 端点换了(管道名含宿主 pid)客户端用 `since=0` 重新对齐,不承诺断点续传。
257
+ *
258
+ * **0.3.56 修的坑(别再退回去)**:`reset()` 以前把 `nextSeq` 也归零,而 `/sync` 每趟都调用它 ⇒
259
+ * 扩展第一次收到 `seq=1` 后游标就是 1,之后每条新事件又从 1 开始编号,`since(1)` 的
260
+ * `e.seq > 1` 永远为假 ⇒ **每个 IDE 会话最多只送达第一条事件**(0.3.9 起就带着这个缺陷,
261
+ * 用户"只偶尔看到 diff、且那条还是空 old"就是这个现象)。清空缓冲时**不许动 seq**。
256
262
  */
257
263
  export function createEventRing(max = EVENT_RING_MAX) {
258
264
  /** @type {{seq: number, kind: string, time: number}[]} */
@@ -280,10 +286,15 @@ export function createEventRing(max = EVENT_RING_MAX) {
280
286
  size() {
281
287
  return items.length;
282
288
  },
283
- /** 清空(IDE 进程换掉时调用)。 */
289
+ /**
290
+ * 清空缓冲(**不重置 seq**)。
291
+ *
292
+ * 调用点:`/sync` 每趟取完事件后清空(事件是提示,取过就不必留着 —— 否则客户端重新对齐时
293
+ * 会把一堆陈旧提示重放成一片 diff 窗口),以及 IDE 实例换掉时的 `clearBridgeRuntime`。
294
+ * 两类调用都**不能**让 seq 回退,理由见文件头。
295
+ */
284
296
  reset() {
285
297
  items = [];
286
- nextSeq = 1;
287
298
  },
288
299
  };
289
300
  }
package/lib/client.js CHANGED
@@ -1,6 +1,6 @@
1
1
  window.__ModuleLoader__.load({id:'dsh-code-server-app',factory:function(require){var module={exports:{}};var exports=module.exports;
2
- var Q=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Fe=Object.prototype.hasOwnProperty;var Be=(e,r)=>{for(var n in r)Q(e,n,{get:r[n],enumerable:!0})},We=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of He(r))!Fe.call(e,a)&&a!==n&&Q(e,a,{get:()=>r[a],enumerable:!(t=Ue(r,a))||t.enumerable});return e};var Ye=e=>We(Q({},"__esModule",{value:!0}),e);var Wr={};Be(Wr,{apply:()=>Ur,inject:()=>Fr,name:()=>Br});module.exports=Ye(Wr);var ce="dsh-resource://file/",Ge="sidebar://";function J(e){return typeof e=="string"&&e.startsWith(Ge)}function U(e){if(typeof e!="string"||!e.startsWith(ce))return null;for(var r=e.length,n=0;n<e.length;n+=1){var t=e.charAt(n);if(t==="?"||t==="#"){r=n;break}}var a=e.slice(ce.length,r).split("/"),l=a.shift();try{if(l==="session"){var o=a.shift();return o===void 0||o===""||a.length===0?null:{scope:"session",sessionId:decodeURIComponent(o),path:de(a)}}if(l==="absolute"){var c=a[0]===""&&a.length>1,p=c?a.slice(1):a,f=de(p);return(f===""||f.charAt(0)==="/")&&!c?null:c?{scope:"absolute",path:"//"+f}:f===""?null:{scope:"absolute",path:ue(f)?f:"/"+f}}}catch(x){return null}return null}function de(e){for(var r=[],n=0;n<e.length;n+=1)r.push(decodeURIComponent(e[n]));return r.join("/")}function ue(e){return/^[A-Za-z]:($|\/)/.test(e)}function Xe(e){return typeof e!="string"||e===""?!1:e.charAt(0)==="/"?!0:ue(e)}function fe(e){var r=U(e);if(r===null)return"";var n=r.path.replace(/[/\\]+$/,""),t=Math.max(n.lastIndexOf("/"),n.lastIndexOf("\\")),a=t===-1?n:n.slice(t+1);return a}function pe(e,r){if(e===null||e==null)return null;var n=typeof e.path=="string"?e.path:"";if(n==="")return null;if(Xe(n))return n;if(typeof r!="string"||r==="")return null;var t=r.indexOf("\\")!==-1?"\\":"/",a=r.replace(/[\\/]+$/,"");return a+t+(t==="\\"?n.replace(/\//g,"\\"):n)}var V=["md","markdown","html","htm","png","jpg","jpeg","gif","webp","bmp","ico","svg","pdf"],H=["exe","com","msi","msix","msixbundle","appx","appxbundle","dll","sys","scr","cpl","ocx","drv","efi","mui","obj","o","a","lib","pdb","class","jar","pyc","pyo","wasm","node","so","dylib","ko","elf","bin","out","apk","ipa","deb","rpm","dmg","iso","img","cab"],F=["doc","docx","docm","dot","dotx","dotm","docb","rtf","odt","xls","xlsx","xlsm","xlsb","xlt","xltx","xltm","xla","xlam","ods","ppt","pptx","pptm","pot","potx","potm","pps","ppsx","ppam","odp","vsd","vsdx","vssx","vstx","vsdm","vssm","vstm","one","onetoc2","mpt","mpp","pub","msg","xps","oxps","odg"],Z=["*"].concat(V).concat(H).concat(F).map(function(e,r){return r===0?e:"!"+e}).join(";"),Qe=/[;,\s]+/;function Je(e){return String(e).replace(/!\s+/g,"!").split(Qe)}function Ve(e){var r=typeof e=="string"?e.trim():"";if(r==="")return"";var n=r.charAt(0)==="!",t=n?r.slice(1).trim():r;return t==="*"?n?"!*":"*":(t.slice(0,2)==="*."?t=t.slice(2):t.charAt(0)==="."&&(t=t.slice(1)),t=t.toLowerCase(),t===""?"":n?"!"+t:t)}function T(e){if(typeof e!="string")return"";for(var r=Je(e),n=[],t=0;t<r.length;t+=1){var a=Ve(r[t]);a===""||a==="!*"||n.indexOf(a)===-1&&n.push(a)}return n.join(";")}function B(e){for(var r=T(e),n=r===""?[]:r.split(";"),t=!1,a=[],l=[],o=0;o<n.length;o+=1){var c=n[o];if(c==="*"){t=!0;continue}c.charAt(0)==="!"?l.push(c.slice(1)):a.push(c)}return{all:t,allow:a,deny:l}}function Ze(e){if(typeof e!="string"||e==="")return"";var r=e.replace(/[/\\]+$/,""),n=Math.max(r.lastIndexOf("/"),r.lastIndexOf("\\"));n!==-1&&(r=r.slice(n+1));var t=r.lastIndexOf(".");return t<=0?"":r.slice(t+1).toLowerCase()}function Ke(e,r){if(r==null)return!1;var n=Ze(e);return n!==""&&r.deny.indexOf(n)!==-1?!1:n!==""&&r.allow.indexOf(n)!==-1?!0:r.all===!0}function me(e,r){return e===null||e==null?!1:Ke(e.path,r)}function he(e){var r=B(e),n=[];if(r.all&&n.push("\u5176\u4F59\u7C7B\u578B\u5168\u90E8\u8BA4\u9886"),r.allow.length>0&&n.push("\u6307\u5B9A\u8BA4\u9886 "+r.allow.length+" \u9879"),r.deny.length>0){var t=[];ve(r.deny,H)&&t.push("\u53EF\u6267\u884C\u6587\u4EF6"),ve(r.deny,F)&&t.push("Office \u6587\u6863"),n.push("\u6392\u9664 "+r.deny.length+" \u9879"+(t.length>0?"(\u542B"+t.join("\u3001")+")":""))}return n.length===0?"\u4E0D\u8BA4\u9886\u4EFB\u4F55\u6587\u4EF6(\u53EA\u6709\u9875\u9762\u6807\u7B7E)":n.join(" \xB7 ")}function ve(e,r){for(var n=new Set(r),t=0;t<e.length;t+=1)if(n.has(e[t]))return!0;return!1}var qe="[data-sidebar-right-panel]",$e='[data-sidebar-right-mode="fullscreen"]';function ge(e){if(e==null||typeof e.closest!="function")return"no-root";var r,n;try{if(r=e.closest(qe),r==null||typeof r.querySelector!="function")return"no-panel";n=r.querySelector($e)}catch(t){return"lookup-failed"}if(n==null||typeof n.click!="function")return"no-control";try{n.click()}catch(t){return"click-failed"}return"clicked"}function be(e,r){if(!(e==null||e.byId==null)&&!(typeof r!="string"||r==="")){var n=e.byId[r];if(n!=null)return typeof n.cwd=="string"&&n.cwd!==""?n.cwd:void 0}}function K(e,r){if(!(e==null||!Array.isArray(e.items))&&!(typeof r!="string"||r===""))for(var n=0;n<e.items.length;n+=1){var t=e.items[n];if(!(t==null||!Array.isArray(t.sessionIds))&&t.sessionIds.indexOf(r)!==-1&&typeof t.path=="string"&&t.path!=="")return t.path}}function q(e){var r=e==null?{}:e,n=r.sessions==null?null:r.sessions,t=r.workspaces==null?null:r.workspaces,a=typeof r.sessionId=="string"&&r.sessionId!==""?r.sessionId:void 0,l=be(n,a);if(l!==void 0)return l;var o=n==null?void 0:n.current,c=be(n,o);if(c!==void 0)return c;var p=K(t,a);if(p!==void 0)return p;var f=K(t,typeof o=="string"?o:void 0);if(f!==void 0)return f;var x=n!=null&&Array.isArray(n.ids)?n.ids[0]:void 0,v=K(t,typeof x=="string"?x:void 0);if(v!==void 0)return v;if(t!=null&&Array.isArray(t.items)&&t.recentWorkspaceId!==void 0)for(var w=0;w<t.items.length;w+=1){var d=t.items[w];if(!(d==null||d.workspaceId!==t.recentWorkspaceId)&&typeof d.path=="string"&&d.path!=="")return d.path}if(t!=null&&Array.isArray(t.items)&&t.items.length>0){var m=t.items[0];if(m!=null&&typeof m.path=="string"&&m.path!=="")return m.path}}var M=typeof Element!="undefined"&&typeof Element.prototype.moveBefore=="function",er=-2e4,s={park:null,frame:null,currentSrc:null,sameOrigin:null,owner:null,lastRect:null,parkStrategy:"offscreen",degraded:!1,preloaded:!1,nudgeCount:0,nudgeEnabled:!0,lastNudgeAt:0,listeners:new Set};function $(){return{ready:s.frame!==null,docked:s.owner!==null,owner:s.owner,src:s.currentSrc,sameOrigin:s.sameOrigin,parkStrategy:s.parkStrategy,degraded:s.degraded,preloaded:s.preloaded,supportsMoveBefore:M,nudgeCount:s.nudgeCount,lastNudgeAt:s.lastNudgeAt}}function R(){var e=$();s.listeners.forEach(function(r){try{r(e)}catch(n){}})}function ye(e){return s.listeners.add(e),function(){s.listeners.delete(e)}}function xe(){return $()}function rr(e){e!=="offscreen"&&e!=="behind"||s.parkStrategy!==e&&(s.parkStrategy=e,s.frame!==null&&s.owner===null&&ee(),R())}function nr(){return s.parkStrategy}function tr(){var e=s.lastRect;e!==null&&(s.park.style.width=Math.max(1,Math.round(e.width))+"px",s.park.style.height=Math.max(1,Math.round(e.height))+"px")}function ee(){if(s.park!==null){if(tr(),s.parkStrategy==="behind"&&s.lastRect!==null){s.park.style.left=Math.round(s.lastRect.left)+"px",s.park.style.top=Math.round(s.lastRect.top)+"px",s.park.style.visibility="visible",s.park.style.zIndex="0";return}s.park.style.left=er+"px",s.park.style.top="0px",s.park.style.visibility="hidden",s.park.style.zIndex="0"}}function we(){s.frame!==null&&(s.frame.setAttribute("inert",""),s.frame.setAttribute("aria-hidden","true"))}function ar(){s.frame!==null&&(s.frame.removeAttribute("inert"),s.frame.removeAttribute("aria-hidden"))}function sr(){var e=document.createElement("div");e.className="dshcs-park",e.setAttribute("data-dshcs-park",""),e.setAttribute("aria-hidden","true");var r=document.createElement("iframe");return r.className="dshcs-frame",r.setAttribute("title","code-server"),r.setAttribute("allow","clipboard-read; clipboard-write"),r.setAttribute("data-dshcs-resident",""),r.src="about:blank",e.appendChild(r),document.body.appendChild(e),s.park=e,s.frame=r,s.currentSrc="about:blank",s.owner=null,ee(),we(),r}function ir(e){var r=s.frame;if(r!==null){var n=s.sameOrigin!==e;!n&&r.hasAttribute("data-dshcs-attrs")||(e===!0?r.removeAttribute("sandbox"):e===!1&&r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock allow-clipboard-read allow-clipboard-write"),r.setAttribute("data-dshcs-attrs",e===!0?"same-origin":"cross-origin"),s.sameOrigin=e)}}function re(e){var r=e||{};return s.frame===null&&sr(),typeof r.sameOrigin=="boolean"&&ir(r.sameOrigin),typeof r.src=="string"&&r.src!==""&&r.src!==s.currentSrc&&lr(r.src),s.frame}function lr(e){s.frame===null||typeof e!="string"||e===""||e===s.currentSrc||(s.currentSrc=e,s.frame.src=e,R())}function ke(){var e=s.frame;if(s.nudgeEnabled!==!0||e===null||e.isConnected!==!0)return!1;var r=e.style.display;return e.style.display="none",e.offsetHeight,e.style.display=r,s.nudgeCount+=1,s.lastNudgeAt=Date.now(),!0}function or(e){return s.nudgeEnabled=e!==!1,s.nudgeEnabled}function Ee(e){if(s.frame!==null){if(M)try{e.moveBefore(s.frame,null);return}catch(r){s.degraded=!0,s.lastMoveError=(r&&r.name?r.name+": ":"")+(r&&r.message?r.message:String(r))}else s.degraded=!0;e.appendChild(s.frame)}}function ne(e,r){if(!(s.frame===null||e==null)){var n=s.owner===null,t=e.getBoundingClientRect();t.width>=1&&t.height>=1&&(s.lastRect={left:t.left,top:t.top,width:t.width,height:t.height}),s.owner=r===void 0?null:r,ar(),s.park.setAttribute("aria-hidden","true"),Ee(e),n&&ke(),R()}}function j(e){s.frame!==null&&(e!==void 0&&s.owner!==e||(s.owner=null,ee(),we(),s.park.setAttribute("aria-hidden","true"),Ee(s.park),R()))}function te(e){var r=e||{};return re(r),s.owner===null&&(typeof r.src=="string"&&r.src!==""&&(s.preloaded=!0),j()),s.frame}function cr(){s.park!==null&&s.park.parentNode!==null&&s.park.parentNode.removeChild(s.park),s.park=null,s.frame=null,s.currentSrc=null,s.sameOrigin=null,s.owner=null,s.lastRect=null,s.degraded=!1,s.preloaded=!1,s.nudgeCount=0,s.lastNudgeAt=0,R()}typeof window!="undefined"&&(window.__dshcsSurface={snapshot:$,setParkStrategy:rr,getParkStrategy:nr,preload:te,dock:ne,park:j,nudge:ke,setNudgeEnabled:or,destroy:cr});var i=require("react"),ie=new Set,D={status:null,busy:!1,sidebarUi:"unknown",sidebarRegisterFailed:!1};function L(e){D=Object.assign({},D,e),ie.forEach(function(r){r()})}function dr(e){return ie.add(e),function(){ie.delete(e)}}function ur(){return D}function oe(){return i.useSyncExternalStore(dr,ur)}var fr="/api",pr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTQ3IDE0NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+QG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgeyogeyBmaWxsOiB3aGl0ZTsgfX08L3N0eWxlPgogIDxwYXRoIGQ9Im00Mi40MjE0LDM5LjY1NWMtMjQuNDA1NywwIC00Mi4xNTU0LDEzLjE3MjEgLTQyLjE1NTQsMzMuODQ1YzAsMjAuNTgxNCAxOC40ODkyLDMzLjg0NSA0Mi4xNTU0LDMzLjg0NWMyMy42NjYyLDAgMzguMTgwMywtMTEuNjE3MSAzOC43MzQ5LC0yOC43MjI1bC0yMS4wNzc3LC0wLjQ1NzRjLTAuOTI0NCw5LjMzMDMgLTkuMTA1OSwxNS4xODQ1IC0xNy42NTcyLDE1LjE4NDVjLTExLjc0MDYsMCAtMjAuNDMwNiwtNy41OTIyIC0yMC40MzA2LC0xOS44NDk2YzAsLTEyLjI1NzQgOC42OSwtMTkuOTg2OCAyMC40MzA2LC0yMC4yMTU1YzguNTUxMywtMC4xODMgMTYuOTE3Nyw1Ljk0NTcgMTcuNDcyMywxNS4yNzZsMjEuMDc3NywtMC42NDAzYy0wLjQ2MjIsLTE2LjgzMTEgLTE0LjE0NDIsLTI4LjI2NTIgLTM4LjU1LC0yOC4yNjUyem00OC44NDQ2LDJsNTUuNDY4LDBsMCw2NC4wMzExbC01NS40NjgsMGwwLC02NC4wMzExeiIgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz4KPC9zdmc+Cg==";async function y(e,r){var n={method:r===void 0?"GET":"POST",headers:{}};r!==void 0&&(n.headers["content-type"]="application/json",n.body=JSON.stringify(r));var t=await fetch(fr+e,n),a=await t.text(),l=null;try{l=a===""?null:JSON.parse(a)}catch(o){l=null}return t.ok?l!==null?l:{ok:!1,error:"invalid JSON response"}:{ok:!1,error:"HTTP "+t.status+(l!==null&&l.error!==void 0?": "+l.error:"")}}function Se(){}function Me(e){var r=typeof e.useSessions=="function"?e.useSessions:Se,n=typeof e.useWorkspaces=="function"?e.useWorkspaces:Se;return{sessions:r(function(t){return t}),workspaces:n(function(t){return t})}}function Re(e,r){if(e==null||typeof e.url!="string"||e.url==="")return null;var n=e.pid!=null?String(e.pid):e.startedAt!=null?String(e.startedAt):"0",t=e.url+"?s="+encodeURIComponent(n),a=typeof r=="string"&&r!==""?r:e!=null&&e.cwd!=null?e.cwd:null;if(a==null||a==="")return t;var l=a.replace(/\\/g,"/"),o=l;return(/^[A-Za-z]:\//.test(l)||l.charCodeAt(0)!==47)&&(o="/"+l),t+"&folder="+encodeURIComponent(o)}function vr(e){var r=e.status,n=e.pageUrl,t=e.reloadTick,a=e.owner,l=i.useRef(null),o=r!=null&&r.ok===!0&&r.running===!0,c=r!=null&&r.status==="starting",p=r!=null&&r.ok===!1,f=r!=null&&r.serve==="dsh";if(i.useLayoutEffect(function(){if(!o||n===null){j(a);return}re({src:n,sameOrigin:f}),l.current!==null&&ne(l.current,a)},[o,n,f,t,a]),i.useLayoutEffect(function(){return function(){j(a)}},[a]),o&&n!==null)return i.createElement("div",{ref:l,className:"dshcs-slot","data-code-server-slot":a!=null?a:"code-server"});if(c)return i.createElement("div",{className:"dshcs-loading"},"\u6B63\u5728\u542F\u52A8 code-server\u2026");var x=p&&r!=null&&r.error?r.error:"code-server \u672A\u8FD0\u884C",v=f?"\u5F53\u524D\u4EE5 DSH \u540C\u6E90\u8DEF\u5F84 "+(r!=null&&r.url||"/code-server/")+" \u63D0\u4F9B(\u65E0\u72EC\u7ACB\u7AEF\u53E3)\u3002":"\u5F53\u524D\u4EE5\u72EC\u7ACB\u56DE\u73AF\u7AEF\u53E3\u63D0\u4F9B(\u7AEF\u53E3 "+(r!=null&&r.port!=null?r.port:"\u968F\u673A")+" + \u8DEF\u5F84\u4EE4\u724C;\u8981\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00,\u590D\u5236\u8BBE\u7F6E\u5361\u91CC\u7684\u5B8C\u6574\u5730\u5740 \u2014\u2014 \u7F3A\u4E86\u4EE4\u724C\u90A3\u6BB5\u4F1A 404)\u3002",w=M?"\u5E38\u9A7B\u9762:\u53EF\u7528(\u5207\u6807\u7B7E/\u6536\u8D77\u4FA7\u680F\u4E0D\u91CD\u8F7D)\u3002":"\u5E38\u9A7B\u9762:\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore \u2014\u2014 \u5207\u6807\u7B7E\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u53EF\u7528)\u3002";return i.createElement("div",{className:"dshcs-empty"},i.createElement("div",{className:"dshcs-emptybox"},i.createElement("div",null,p?"code-server \u542F\u52A8\u5931\u8D25":"code-server \u672A\u8FD0\u884C"),i.createElement("pre",{className:"dshcs-error"},x),i.createElement("p",{className:"dshcs-hint"},"VS Code \u6811\u968F\u63D2\u4EF6\u5305\u5185\u7F6E\u3001\u5C31\u5730\u8FD0\u884C(\u65E0\u9700\u5168\u5C40\u5B89\u88C5\u3001\u65E0\u9700\u8054\u7F51\u5B89\u88C5\u3001\u65E0\u300C\u5B89\u88C5\u73AF\u5883\u300D\u6B65\u9AA4);\u5185\u90E8\u4F9D\u8D56\u4E0E\u9884\u7F16\u8BD1\u539F\u751F\u6A21\u5757\u7531\u5305\u7BA1\u7406\u5668\u5728\u5B89\u88C5\u63D2\u4EF6\u65F6\u4E00\u5E76\u88C5\u597D(\u65E0\u9700 C++ \u5DE5\u5177\u94FE)\u3002\u82E5\u6B64\u5904\u957F\u671F\u672A\u8FD0\u884C,\u8BF7\u67E5\u770B DSH host \u65E5\u5FD7\u91CC\u7684 [code-server] \u8F93\u51FA(\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u91CC\u5207\u6362\u300C\u540E\u53F0\u5E38\u9A7B\u300D\u89E6\u53D1\u4E00\u6B21\u542F\u52A8)\u3002"+v+w)))}function mr(e){var r=oe(),n=r.status,t=n!=null&&n.ok===!0&&n.running===!0,a=n!=null&&n.keepResident===!0,l=Me(e!=null?e:{}),o=q({sessions:l.sessions,workspaces:l.workspaces}),c=t?Re(n,o):null;return i.useEffect(function(){!a||!t||c===null||te({src:c,sameOrigin:n!=null&&n.serve==="dsh"})},[a,t,c,n!=null?n.serve:null]),null}var hr=".dshcs-frame{display:block;position:absolute;inset:0;z-index:1;width:100%;height:100%;border:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-tabroot{position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-slot{position:relative;display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;background:var(--dsw-alias-bg-base,#fff)}.dshcs-park{position:fixed;left:-20000px;top:0;width:320px;height:200px;overflow:hidden;pointer-events:none;z-index:0;visibility:hidden;contain:strict}.dshcs-loading{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-tertiary,#7d8798);font-size:13px}.dshcs-empty{position:relative;z-index:2;flex:1;display:flex;align-items:center;justify-content:center;padding:44px 24px 24px}.dshcs-emptybox{max-width:560px;text-align:left;background:var(--dsw-alias-bg-layer-2,#f7f8fb);border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:12px;padding:16px 18px}.dshcs-error{color:var(--dsw-alias-label-error,#d92d20);white-space:pre-wrap;word-break:break-all;font-family:ui-monospace,Consolas,monospace;font-size:12px;margin:8px 0 0}.dshcs-hint{color:var(--dsw-alias-label-tertiary,#7d8798);font-size:12px;margin:6px 0 0}.dshcs-legacy{color:var(--dsw-alias-label-warning,#b54708);font-size:12px;font-weight:600;margin:0 0 6px}",Ce="dsh-code-server/styles";typeof document!="undefined"&&document.querySelector("style[data-dshcs="+JSON.stringify(Ce)+"]")===null&&(W=document.createElement("style"),W.setAttribute("data-dshcs",Ce),W.textContent=hr,document.head.appendChild(W));var W,Ne="code-server",Oe="dsh-code-server-app",gr="dsh-code-server-app",br="\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC\u8FD0\u884C VS Code \u7F51\u9875\u7248,\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u533A;\u8BA4\u9886\u7C7B\u578B\u3001\u6253\u5F00\u5373\u5168\u5C4F\u3001\u540E\u53F0\u5E38\u9A7B\u90FD\u5728\u8FD9\u91CC\u8BBE\u3002",yr=2500,xr=1e4,wr=1500;function kr(e){var r=e!=null&&typeof e.size=="number"?e.size:16;return i.createElement("img",{src:pr,alt:"","aria-hidden":!0,draggable:!1,className:e!=null?e.className:void 0,style:{width:r,height:r,display:"block",objectFit:"contain",WebkitUserDrag:"none",userSelect:"none"}})}var Er=B("");function Sr(){var e=D.status;return e==null||typeof e.claimExtensions!="string"?Er:B(e.claimExtensions)}function Cr(){for(var e=["*"],r=[V,H,F],n=0;n<r.length;n+=1){for(var t=[],a=0;a<r[n].length;a+=1)t.push("!"+r[n][a]);e.push(t.join(";"))}return e.join(`
3
- `)}function Nr(e){var r=e.useTabInfo(),n=r.tab,t=oe(),a=t.status,l=n.navigation,o=l!=null&&typeof l.revision=="number"?l.revision:0,c=l!=null&&typeof l.address=="string"?l.address:"",p=J(c)?null:U(c),f=Me(e),x=p!=null&&typeof p.sessionId=="string"?p.sessionId:void 0,v=q({sessions:f.sessions,workspaces:f.workspaces,sessionId:x!==void 0?x:e.sessionId}),w=i.useRef(!1),d=pe(p,v),m=l!=null&&l.params!=null&&typeof l.params.line=="number"?l.params.line:null,h=i.useRef(void 0),[E,X]=i.useState(0),z=i.useRef(null),C=i.useRef(!1),P=r.tab!=null&&r.tab.visible===!0,_=r.sidebar!=null&&r.sidebar.fullscreen===!0,I=a!=null&&a.fullscreenOnOpen!==!1;return i.useLayoutEffect(function(){if(!P){C.current=!1;return}if(!(!I||_||C.current)){C.current=!0;var b=ge(z.current);b!=="clicked"&&console.warn("[code-server] \u672A\u80FD\u81EA\u52A8\u5207\u5230\u5168\u5C4F\u53F3\u4FA7\u680F("+b+");\u672C\u6B21\u6253\u5F00\u4FDD\u6301\u539F\u6A21\u5F0F")}},[P,_,I]),i.useEffect(function(){if(!(typeof v!="string"||v==="")&&h.current!==v){var b=h.current!==void 0;h.current=v;var S=!1;return y("/code-server/start",{cwd:v}).then(function(N){S||(L({status:N}),b&&N!=null&&N.ok===!0&&N.running===!0&&X(function(g){return g+1}))}).catch(function(){}),function(){S=!0}}},[v]),i.useEffect(function(){typeof v=="string"&&v!==""||w.current||(w.current=!0,console.warn("[code-server] \u672A\u80FD\u89E3\u6790\u5F53\u524D\u5DE5\u4F5C\u533A\u76EE\u5F55(\u4F1A\u8BDD\u65E0 cwd / \u6807\u51C6 prop \u65E0 sessionId / \u5DE5\u4F5C\u533A\u8868\u4E5F\u6CA1\u5339\u914D\u4E0A):\u672C\u6B21\u4E0D\u5411\u5BBF\u4E3B\u53D1\u9001 cwd,IDE \u4F1A\u4EE5\u7A7A\u5DE5\u4F5C\u533A\u6253\u5F00"))},[v]),i.useEffect(function(){y("/code-server/status").then(function(S){S!=null&&L({status:S})}).catch(function(){});var b=window.setInterval(function(){y("/code-server/status").then(function(S){L({status:S})}).catch(function(){})},3e3);return function(){window.clearInterval(b)}},[]),i.useEffect(function(){d!==null&&y("/code-server/open-file",m===null?{file:d}:{file:d,line:m}).catch(function(){})},[o,d,m]),i.createElement("div",{className:"dshcs-tabroot","data-code-server-tab":"body",ref:z},i.createElement(vr,{status:a,pageUrl:Re(a,v),reloadTick:E,owner:"tab:"+n.id}))}function ae(e,r){if(e==null)return null;var n=e[r];if(n!=null)return n;if(typeof e.get=="function"){var t=e.get(r);if(t!=null)return t}return null}function Or(e){var r=ae(e,"sidebarRightTabs"),n=ae(e,"sidebarRight");if(r==null||n==null)return console.error("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u4E0A\u4E0B\u6587\u4E0D\u53EF\u89C1(sidebarRightTabs="+(r!=null)+", sidebarRight="+(n!=null)+"):\u8DF3\u8FC7\u4FA7\u680F\u6CE8\u518C"),!1;var t=ae(e,"slots");if(e.effect(function(){return r.register({id:Oe,kind:Ne,priority:"extension",patterns:["dsh-resource://file/**"],canOpen:function(a){return me(U(a),Sr())},title:function(a){if(J(a)||a===void 0||a===null||a==="")return"Code Server";var l=fe(a);return l===""?"Code Server":l},guide:[{order:20,title:function(){return"Code Server"},description:function(){return"\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC\u8FD0\u884C VS Code \u7F51\u9875\u7248,\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u533A;\u4EA7\u7269/\u4EA4\u4ED8\u6587\u4EF6\u70B9\u51FB\u540E\u5728\u6B64\u6253\u5F00\u3002"},icon:kr}]})},"code-server: sidebar tab type"),t!=null)e.effect(function(){return t.inject("sidebar.right.pane.tab",function(){return t.register({name:"sidebar.right.pane.tab",key:Oe},Nr)})},"code-server: sidebar tab body");else return console.error("[code-server] slots \u670D\u52A1\u4E0D\u53EF\u89C1:\u4FA7\u680F\u6807\u7B7E body \u672A\u6CE8\u518C"),!1;return e.effect(function(){return function(){L({sidebarUi:"unknown"})}},"code-server: sidebar mode reset"),console.log("[code-server] right-sidebar tab registered (kind="+Ne+")"),!0}var Lr=".dshcs-card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dshcs-card:hover{border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dshcs-cardHeader:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.dshcs-cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dshcs-cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.dshcs-cardDescription{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-size:13px;line-height:1.5}.dshcs-cardChevron{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));flex:none;transition:transform .16s;display:inline-flex}.dshcs-cardChevronOpen{transform:rotate(180deg)}.dshcs-cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.dshcs-cardReadOnly{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:12px 0 0;font-size:12px;line-height:1.5}.dshcs-pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-cardFooter{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}.dshcs-cardFailed{min-width:0;color:var(--dsw-alias-label-error,var(--dsw-alias-state-error-primary));flex:1;margin:0;font-size:12px;line-height:1.5}.dshcs-cbtn{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;border:1px solid transparent;transition:color .12s ease,background .12s ease}.dshcs-cbtn:disabled{opacity:.4;cursor:default}.dshcs-cbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.dshcs-cbtnOutline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.dshcs-cbtnOutline:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover,transparent)}.dshcs-cbtnPrimary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border-color:var(--dsw-alias-label-primary);font-weight:600}.dshcs-cbtnPrimary:hover:not(:disabled){filter:brightness(.95)}.dshcs-cbtnPrimary:active:not(:disabled){filter:brightness(.9)}.dshcs-field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.dshcs-field+.dshcs-field{border-top:1px solid var(--dsw-alias-border-l2)}.dshcs-fieldHead{align-items:center;gap:8px;display:flex}.dshcs-fieldLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.dshcs-card .dshcs-hint{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:0;font-size:12px;line-height:1.5}.dshcs-check{display:flex;align-items:center;gap:8px;cursor:pointer}.dshcs-check input{accent-color:var(--dsw-alias-brand-primary);width:15px;height:15px;margin:0;flex:none}.dshcs-check input:disabled{cursor:default}.dshcs-text{display:flex}.dshcs-text input,.dshcs-text textarea{font:12px/1.5 ui-monospace,Consolas,monospace;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:5px 8px;width:100%;min-width:0}.dshcs-text textarea{display:block;box-sizing:border-box;resize:vertical;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}.dshcs-text input:disabled,.dshcs-text textarea:disabled{opacity:.5;cursor:default}.dshcs-text input:focus-visible,.dshcs-text textarea:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-1px}.dshcs-code{display:block;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;font:11.5px/1.55 ui-monospace,Consolas,monospace;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-2,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:6px 8px;margin:4px 0 0;max-width:100%}.dshcs-badges{align-items:center;gap:8px;display:inline-flex}.dshcs-badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.dshcs-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.dshcs-reset:disabled{cursor:default}.dshcs-cfgpage{display:flex;flex-direction:column;gap:0}.dshcs-cfgfoot{justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}",Tr="dsh-code-server/Card.module.css";function Ar(e,r){if(typeof document!="undefined"&&document.querySelector("style[data-plugin-css="+JSON.stringify(e)+"]")===null){var n=document.createElement("style");n.dataset.plugin="dsh-code-server",n.dataset.pluginCss=e,n.textContent=r,document.head.appendChild(n)}}Ar(Tr,Lr);function Ir(e){return i.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,className:e.className},i.createElement("path",{d:"M3.5 5.25L7 8.75L10.5 5.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))}function Y(e){return i.createElement("button",{type:"button",className:"dshcs-cbtn "+(e.variant==="primary"?"dshcs-cbtnPrimary":"dshcs-cbtnOutline"),disabled:e.disabled===!0,onClick:e.onClick},e.children)}function Le(e){return i.createElement("label",{className:"dshcs-check"},i.createElement("input",{type:"checkbox",checked:e.checked===!0,disabled:e.disabled===!0,onChange:function(r){e.onChange(r.target.checked)}}),i.createElement("span",{className:"dshcs-hint"},e.children))}function Mr(e){var r=typeof e.value=="string"?e.value:"",n=Math.min(12,Math.max(3,Math.ceil(r.length/64)));return i.createElement("label",{className:"dshcs-text"},i.createElement("textarea",{value:e.value,disabled:e.disabled===!0,rows:n,spellCheck:!1,autoComplete:"off",wrap:"soft",placeholder:e.placeholder,onChange:function(t){e.onChange(t.target.value)}}))}function se(e){var r=[];return e.overridden===!0&&(r.push(i.createElement("span",{className:"dshcs-badge"},e.overriddenLabel)),r.push(i.createElement("button",{type:"button",className:"dshcs-reset",disabled:e.disabled===!0,onClick:e.onReset},e.resetLabel))),r.length===0?null:i.createElement("span",{className:"dshcs-badges"},...r)}function Te(e){var[r,n]=i.useState(e.defaultOpen===!0),t=e.state;if(t==null||t.available!==!0)return null;var a=e.title,l=e.noticeOnly===!0,o=t.dirty!==!0||t.invalid===!0||t.saving===!0;return i.createElement("li",{className:"dshcs-card"+(r?" dshcs-cardOpen":"")},i.createElement("button",{type:"button",className:"dshcs-cardHeader","aria-expanded":r,onClick:function(){n(!r)}},i.createElement("span",{className:"dshcs-cardHeadText"},i.createElement("span",{className:"dshcs-cardName"},a),i.createElement("span",{className:"dshcs-cardDescription"},e.description)),t.dirty===!0?i.createElement("span",{className:"dshcs-pending"},e.unsavedLabel):null,i.createElement(Ir,{className:"dshcs-cardChevron"+(r?" dshcs-cardChevronOpen":"")})),r===!0?i.createElement("div",{className:"dshcs-cardBody"},l===!0?null:t.writable!==!0?i.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},e.readOnlyLabel):null,e.children,l===!0?null:i.createElement("div",{className:"dshcs-cardFooter"},t.failed===!0?i.createElement("p",{className:"dshcs-cardFailed",role:"status"},e.saveFailedLabel):null,i.createElement(Y,{disabled:t.dirty!==!0||t.saving===!0,onClick:e.onDiscard},e.discardLabel),i.createElement(Y,{variant:"primary",disabled:o,onClick:e.onSave},t.saving===!0?e.savingLabel:e.saveLabel))):null)}function je(e){try{let b=function(){y("/code-server/status").then(function(g){g!=null&&typeof g=="object"&&L({status:g})}).catch(function(){})};var r=e.scope,[n,t]=i.useState(function(){return r!==void 0?r.getSnapshot():null}),[a,l]=i.useState(null),[o,c]=i.useState(!1),[p,f]=i.useState(!1),x=oe(),[v,w]=i.useState(xe());if(i.useEffect(function(){return ye(function(g){w(g)})},[]),i.useEffect(function(){if(r===void 0||typeof r.subscribe!="function")return;function g(){try{t(r.getSnapshot())}catch(Yr){}}var k=r.subscribe(g);return function(){typeof k=="function"&&k()}},[r]),r===void 0)return console.error("[code-server] card scope missing"),null;if(n==null||n.status!=="ready")return n!=null&&n.status==="unavailable"&&console.warn("[code-server] settings scope unavailable:",n.status),null;var d=n.value!==void 0&&n.value!==null?n.value:{},m=n.user,h={keepResident:d.keepResident!==!1,claimExtensions:typeof d.claimExtensions=="string"?d.claimExtensions:Z,fullscreenOnOpen:d.fullscreenOnOpen!==!1};if(x!=null&&x.sidebarUi==="legacy")return i.createElement(Te,{title:"Code Server",description:"\u5F53\u524D DSH \u7248\u672C\u4E0D\u53D7\u652F\u6301(\u7F3A\u5C11\u53F3\u4FA7\u680F\u670D\u52A1)",defaultOpen:!0,noticeOnly:!0,state:{available:!0,writable:!1,dirty:!1,invalid:!1,saving:!1,failed:!1}},i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-legacy"},"\u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH\u3002"),i.createElement("div",{className:"dshcs-hint",style:{marginTop:0}},`\u672A\u68C0\u6D4B\u5230\u53F3\u4FA7\u680F\u63D2\u4EF6\u670D\u52A1 sidebarRightTabs / sidebarRight,\u56E0\u6B64\u63D2\u4EF6\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3(\u65E7\u7248\u7684\u60AC\u6D6E\u7403\u4E0E\u6D6E\u52A8\u7A97\u53E3\u5DF2\u79FB\u9664),\u4E5F\u4E0D\u4F1A\u540E\u53F0\u542F\u52A8 IDE\u3002
4
- \u5347\u7EA7 DSH \u5230\u5E26\u53F3\u4FA7\u680F\u7684\u7248\u672C(\u2265 0.1.5-alpha.1)\u540E,Code Server \u4F1A\u51FA\u73B0\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC,\u672C\u9875\u540C\u65F6\u663E\u793A\u5B8C\u6574\u8BBE\u7F6E\u9879;\u5347\u7EA7\u540E\u65E0\u9700\u91CD\u88C5\u672C\u63D2\u4EF6,\u5237\u65B0\u9875\u9762\u5373\u53EF\u3002`)));var E=m!=null&&Object.prototype.hasOwnProperty.call(m,"keepResident"),X=m!=null&&Object.prototype.hasOwnProperty.call(m,"claimExtensions"),z=m!=null&&Object.prototype.hasOwnProperty.call(m,"fullscreenOnOpen"),C=a!==null&&(a.keepResident!==h.keepResident||T(a.claimExtensions)!==T(h.claimExtensions)||a.fullscreenOnOpen!==h.fullscreenOnOpen),P=!C||o,_={available:!0,writable:n.writable,dirty:C,invalid:!1,saving:o,failed:p};async function S(){if(C&&!o){c(!0),f(!1);try{var g=a!==null?a:h;await e.scope.set("keepResident",g.keepResident===!0),await e.scope.set("claimExtensions",T(g.claimExtensions)),await e.scope.set("fullscreenOnOpen",g.fullscreenOnOpen===!0),l(null),b()}catch(k){f(!0)}c(!1)}}async function N(){if(!(o||n.writable!==!0)){c(!0),f(!1);try{typeof e.scope.unset=="function"?(await e.scope.unset("keepResident"),await e.scope.unset("claimExtensions"),await e.scope.unset("fullscreenOnOpen")):(await e.scope.set("keepResident",d.keepResident===void 0||d.keepResident===null?!0:d.keepResident),await e.scope.set("claimExtensions",typeof d.claimExtensions=="string"?T(d.claimExtensions):Z),await e.scope.set("fullscreenOnOpen",d.fullscreenOnOpen===void 0||d.fullscreenOnOpen===null?!0:d.fullscreenOnOpen)),l(null),b()}catch(g){f(!0)}c(!1)}}var I=[i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-fieldHead"},i.createElement("span",{className:"dshcs-fieldLabel"},"\u8BA4\u9886\u7C7B\u578B(\u6309\u6269\u5C55\u540D,\u5206\u53F7\u5206\u9694)"),X===!0?i.createElement(se,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){N()}}):null),i.createElement(Mr,{value:a!==null?a.claimExtensions:h.claimExtensions,disabled:n.writable!==!0,placeholder:"\u4F8B\u5982 py;ts;!md(\u7559\u7A7A = \u4E0D\u8BA4\u9886\u4EFB\u4F55\u6587\u4EF6)",onChange:function(g){l(function(k){return Object.assign({},k!==null?k:h,{claimExtensions:g})}),f(!1)}}),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u5199\u6269\u5C55\u540D(\u4E0D\u5E26\u70B9,\u5927\u5C0F\u5199\u968F\u610F);`*` = \u5176\u4F59\u7C7B\u578B\u4E5F\u8BA4\u9886;`!ext` = \u4E0D\u8BA4\u9886(\u6392\u9664\u4F18\u5148)\u3002\u4E0D\u518D\u533A\u5206\u4F1A\u8BDD\u5185/\u7EDD\u5BF9\u8DEF\u5F84 \u2014\u2014 \u6240\u6709 `dsh-resource://file/**` \u4E00\u89C6\u540C\u4EC1,\u672A\u8BA4\u9886\u7684\u843D\u56DE DSH \u81EA\u5E26\u9884\u89C8\u3002"),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u5B9E\u9645\u89C4\u5219:"+he(a!==null?a.claimExtensions:h.claimExtensions)+(T(a!==null?a.claimExtensions:h.claimExtensions)!==(a!==null?a.claimExtensions:h.claimExtensions)?"(\u4FDD\u5B58\u540E\u5F52\u4E00\u5316)":"")),i.createElement("div",{className:"dshcs-hint",style:{marginTop:6}},"\u9ED8\u8BA4\u6392\u9664\u4E09\u7C7B:\u2460 DSH \u9884\u89C8\u6E32\u67D3\u5F97\u597D\u7684 markdown/html/\u56FE\u7247/PDF;\u2461 \u53EF\u6267\u884C\u6587\u4EF6\u4E0E\u4E8C\u8FDB\u5236\u4EA7\u7269(exe/dll/msi/jar/so\u2026);\u2462 Office \u4E0E\u7248\u5F0F\u6587\u6863(docx/xlsx/pptx/vsdx\u2026)\u3002\u6587\u672C\u811A\u672C(bat/cmd/ps1/sh/py)\u4E0E csv/tsv \u4ECD\u8FDB IDE\u3002\u60F3\u6574\u7EC4\u653E\u5F00,\u628A\u4E0B\u9762\u8FD9\u6BB5\u6362\u6210 `*;!md;!html;!png;!jpg;!pdf` \u4E4B\u7C7B\u7684\u77ED\u6E05\u5355\u5373\u53EF\u3002"),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u9ED8\u8BA4\u503C(\u53EF\u6574\u6BB5\u590D\u5236;\u6362\u884C\u4E0E\u5206\u53F7\u7B49\u4EF7):",i.createElement("code",{className:"dshcs-code","data-claim-default":"lines"},Cr()))),i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-fieldHead"},i.createElement("span",{className:"dshcs-fieldLabel"},"\u6253\u5F00\u5373\u5168\u5C4F(\u53F3\u4FA7\u680F\u94FA\u6EE1\u7A97\u53E3)"),z===!0?i.createElement(se,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){N()}}):null),i.createElement(Le,{checked:a!==null?a.fullscreenOnOpen:h.fullscreenOnOpen,disabled:n.writable!==!0,onChange:function(g){l(function(k){return Object.assign({},k!==null?k:h,{fullscreenOnOpen:g===!0})}),f(!1)}},'\u6253\u5F00 Code Server \u6807\u7B7E(\u542B\u70B9\u5F00\u4EA7\u7269/\u4EA4\u4ED8\u6587\u4EF6)\u65F6,\u81EA\u52A8\u628A\u53F3\u4FA7\u680F\u4ECE"\u4E0E\u5BF9\u8BDD\u5E76\u6392"\u5207\u5230\u5168\u5C4F;\u60F3\u540C\u65F6\u770B\u5BF9\u8BDD\u5C31\u5173\u6389\u5B83,\u6216\u968F\u65F6\u70B9\u53F3\u4FA7\u680F\u7684\u300C\u9000\u51FA\u5168\u5C4F\u300D\u2014\u2014 \u672C\u6B21\u6253\u5F00\u4E0D\u4F1A\u88AB\u62A2\u56DE\u53BB'),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},'\u53EA\u5F71\u54CD"\u6253\u5F00\u90A3\u4E00\u523B":\u5207\u8D70\u518D\u5207\u56DE\u3001\u518D\u6B21\u6253\u5F00\u6587\u4EF6 tab \u4F1A\u91CD\u65B0\u5207\u5168\u5C4F;DSH \u672A\u5411\u63D2\u4EF6\u5F00\u653E\u6A21\u5F0F\u63A5\u53E3,\u672C\u9879\u7531\u70B9\u51FB\u53F3\u4FA7\u680F\u81EA\u8EAB\u7684\u300C\u5168\u5C4F\u300D\u6309\u94AE\u5B9E\u73B0\u3002')),i.createElement("div",{className:"dshcs-field"},i.createElement("div",{className:"dshcs-fieldHead"},i.createElement("span",{className:"dshcs-fieldLabel"},"\u540E\u53F0\u5E38\u9A7B(\u5207\u6807\u7B7E\u4E0D\u91CD\u8F7D)"),E===!0?i.createElement(se,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){N()}}):null),i.createElement(Le,{checked:a!==null?a.keepResident:h.keepResident,disabled:n.writable!==!0,onChange:function(g){l(function(k){return Object.assign({},k!==null?k:h,{keepResident:g===!0})}),f(!1)}},'\u5F00\u542F\u540E\u5BBF\u4E3B\u542F\u52A8\u5373\u628A IDE \u52A0\u8F7D\u5230\u540E\u53F0"\u505C\u653E\u533A":\u5207\u6362\u53F3\u4FA7\u680F\u6807\u7B7E\u3001\u6536\u8D77/\u5C55\u5F00\u4FA7\u680F\u3001\u62D6\u6210\u6D6E\u52A8\u7A97\u53E3\u90FD\u4E0D\u518D\u91CD\u8F7D,\u9996\u6B21\u6253\u5F00\u514D\u7B49\u5F85;\u5173\u95ED\u5219\u53EA\u5728\u6253\u5F00\u9762\u677F\u65F6\u52A0\u8F7D(\u7701\u5185\u5B58)'),i.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},M?"\u5E38\u9A7B\u9762:"+(v.docked?"\u5DF2\u505C\u9760":v.ready?"\u5DF2\u505C\u653E(\u540E\u53F0\u8FD0\u884C\u4E2D)":"\u672A\u542F\u52A8")+(v.degraded?" \xB7 \u672C\u6B21\u53D1\u751F\u8FC7\u964D\u7EA7\u91CD\u8F7D":""):"\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore(Chromium <133)\u2192 \u5E38\u9A7B\u4E0D\u53EF\u7528,\u5207\u6807\u7B7E\u4ECD\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u751F\u6548)"))];return e.seat==="bundle-config"?i.createElement("div",{className:"dshcs-cfgpage","data-code-server-config":"page"},n.writable!==!0?i.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},"\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002"):null,...I,p===!0?i.createElement("p",{className:"dshcs-cardFailed",role:"status"},"\u672C\u90E8\u7F72\u6CA1\u6709\u63A5\u53D7\u8FD9\u4E9B\u503C\uFF0C\u5DF2\u4FDD\u7559\u4F9B\u4F60\u4FEE\u6539\u3002"):null,i.createElement("div",{className:"dshcs-cfgfoot"},i.createElement(Y,{disabled:!C||o,onClick:function(){l(null),f(!1)}},"\u653E\u5F03\u4FEE\u6539"),i.createElement(Y,{variant:"primary",disabled:P,onClick:function(){S()}},o===!0?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"))):i.createElement(Te,{title:"Code Server",description:"\u5165\u53E3:\u53F3\u4FA7\u680F\u6807\u7B7E(DSH \u2265 0.1.5-alpha.1);\u8BA4\u9886\u7C7B\u578B\u51B3\u5B9A\u54EA\u4E9B\u6587\u4EF6\u4EA4\u7ED9 Code Server \u6253\u5F00",state:_,unsavedLabel:"\u672A\u4FDD\u5B58",readOnlyLabel:"\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002",saveFailedLabel:"\u672C\u90E8\u7F72\u6CA1\u6709\u63A5\u53D7\u8FD9\u4E9B\u503C\uFF0C\u5DF2\u4FDD\u7559\u4F9B\u4F60\u4FEE\u6539\u3002",discardLabel:"\u653E\u5F03\u4FEE\u6539",saveLabel:"\u4FDD\u5B58",savingLabel:"\u4FDD\u5B58\u4E2D\u2026",onSave:S,onDiscard:function(){l(null),f(!1)}},...I)}catch(b){return console.error("[code-server] card render error:",b!=null&&b.message!==void 0?b.message:String(b)),null}}function Rr(e){return e!=null&&e.view==="summary"?br:i.createElement(je,Object.assign({},e,{seat:"bundle-config"}))}var Ae=900,u={rev:-1,open:!1,mounted:!1,pending:null,el:null,body:null,title:null,timer:null,loading:!1};function jr(e){if(!(e===null||typeof e!="object")){if(e.type==="ready"){A(!0);return}if(e.type==="ask"&&typeof e.text=="string"){y("/code-server/ask/send",{text:e.text,mode:u.pending===null?void 0:u.pending.mode}).then(function(r){u.rev=-1,A(!0)}).catch(function(){});return}if(e.type==="approve"&&typeof e.id=="string"){y("/code-server/ask/approve",{id:e.id,outcome:e.outcome}).then(function(r){r!=null&&r.ok===!1&&G(r.error||"\u6388\u6743\u63D0\u4EA4\u5931\u8D25"),u.rev=-1,A(!0)}).catch(function(r){G("\u6388\u6743\u63D0\u4EA4\u5931\u8D25:"+String(r&&r.message?r.message:r))});return}e.type==="close"&&De()}}function A(e){if(u.el!==null){var r=window.__DSHCS_ASK_PUSH__;typeof r=="function"?r(u.pending):e===!0&&setTimeout(function(){A(!1)},120)}}function G(e){console.warn("[code-server] ask dialog:",e)}function De(){u.open=!1,u.el!==null&&(u.el.style.display="none"),y("/code-server/ask/close",{}).catch(function(){})}function ze(){if(u.el===null){var e=document.createElement("div");e.className="dshcs-dialog",e.setAttribute("data-dshcs-dialog","ask"),e.style.cssText=["position:fixed","right:24px","bottom:24px","width:460px","height:600px","min-width:320px","min-height:280px","max-width:96vw","max-height:92vh","resize:both","overflow:hidden","display:none","z-index:2147483000","border-radius:10px","box-shadow:0 18px 48px rgba(0,0,0,.45)","border:1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.4))","background:var(--dsw-alias-bg-base, var(--vscode-editor-background, #1e1e1e))"].join(";");var r=document.createElement("div");r.style.cssText="display:flex;align-items:center;gap:8px;padding:6px 10px;cursor:move;border-bottom:1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.3));font:var(--dsw-font-markdown-base, 13px/20px sans-serif)";var n=document.createElement("span");n.textContent="DSH \u5BF9\u8BDD",n.style.cssText="font-weight:600;flex:none";var t=document.createElement("span");t.style.cssText="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary, rgba(128,128,128,.9));font-size:12px";var a=document.createElement("button");a.type="button",a.textContent="\u2715",a.title="\u5173\u95ED",a.setAttribute("aria-label","\u5173\u95ED"),a.style.cssText="flex:none;border:0;background:transparent;color:inherit;cursor:pointer;font-size:13px;line-height:1;padding:2px 6px;border-radius:4px",a.addEventListener("click",function(){De()}),r.appendChild(n),r.appendChild(t),r.appendChild(a);var l=document.createElement("div");l.className="dshcs-panel",l.setAttribute("data-dshcs-ask-root",""),l.style.cssText="height:calc(100% - 33px);overflow:hidden",e.appendChild(r),e.appendChild(l),document.body.appendChild(e),u.el=e,u.body=l,u.title=t;var o=null;r.addEventListener("pointerdown",function(c){if(c.target!==a){var p=e.getBoundingClientRect();o={x:c.clientX,y:c.clientY,left:p.left,top:p.top},e.style.right="auto",e.style.bottom="auto",e.style.left=p.left+"px",e.style.top=p.top+"px";try{r.setPointerCapture(c.pointerId)}catch(f){}}}),r.addEventListener("pointermove",function(c){o!==null&&(e.style.left=Math.max(0,Math.min(window.innerWidth-80,o.left+(c.clientX-o.x)))+"px",e.style.top=Math.max(0,Math.min(window.innerHeight-40,o.top+(c.clientY-o.y)))+"px")}),r.addEventListener("pointerup",function(){o=null})}}var Pe="dshcs.ask.bundle",Dr=900*1e3,O=null;function le(){try{var e=window.sessionStorage.getItem(Pe);if(e==null)return null;var r=JSON.parse(e);return r==null||typeof r.js!="string"||typeof r.css!="string"||Date.now()-Number(r.at||0)>Dr?null:{css:r.css,js:r.js}}catch(n){return null}}function _e(e){try{window.sessionStorage.setItem(Pe,JSON.stringify({at:Date.now(),css:e.css,js:e.js}))}catch(r){}}function zr(){if(!(O!==null||u.mounted)){var e=le();if(e!==null){O=e;return}y("/code-server/ask/bundle").then(function(r){r==null||r.ok!==!0||(O={css:r.css,js:r.js},_e(O),console.log("[code-server] ask bundle preloaded ("+Math.round((r.js.length+r.css.length)/1024)+"KB)"))}).catch(function(){})}}function Pr(){if(!(u.mounted||u.loading)){u.loading=!0;var e=O!==null?Promise.resolve(O):le()!==null?Promise.resolve(le()):y("/code-server/ask/bundle");e.then(function(r){u.loading=!1;var n=r;if(O===null&&r!=null&&r.ok===!0&&(n={css:r.css,js:r.js},O=n,_e(n)),n==null||typeof n.js!="string"){G(n!=null&&n.error?n.error:"\u9762\u677F\u4EA7\u7269\u4E0D\u53EF\u7528");return}if(ze(),document.getElementById("dshcs-ask-style")===null){var t=document.createElement("style");t.id="dshcs-ask-style",t.textContent=n.css,document.head.appendChild(t)}window.__DSHCS_HOST__="dsh",window.__DSHCS_MOUNT__=u.body,window.acquireVsCodeApi=function(){return{postMessage:jr}};var a=document.createElement("script");a.textContent=n.js,document.head.appendChild(a),u.mounted=!0,setTimeout(function(){A(!0)},60)}).catch(function(r){u.loading=!1,G("\u9762\u677F\u4EA7\u7269\u52A0\u8F7D\u5931\u8D25:"+String(r&&r.message?r.message:r))})}}function Ie(){y("/code-server/ask/state?rev="+u.rev).then(function(e){e==null||e.ok!==!0||e.changed===!0&&(u.rev=typeof e.rev=="number"?e.rev:-1,u.pending=e,e.open===!0?(ze(),u.el.style.display="block",u.title!==null&&(u.title.textContent=e.contextText||"\u6765\u81EA\u7F16\u8F91\u5668"),u.open=!0,Pr(),u.mounted&&A(!0)):u.el!==null&&(u.el.style.display="none",u.open=!1))}).catch(function(){})}function _r(){u.timer===null&&(u.timer=setInterval(Ie,Ae),setTimeout(Ie,800),setTimeout(zr,3e3),console.log("[code-server] ask dialog poller started (every "+Ae+"ms)"))}function Ur(e){try{Hr(e),_r()}catch(r){console.error("[code-server] apply failed:",r&&r.stack?r.stack:String(r));try{document.title="CS-ERR "+(r&&r.message||String(r))}catch(n){}}}function Hr(e){var r=e.get("slots");if(r===void 0){console.error("[code-server] slots service unavailable");return}var n=e.settingsScope,t=null;if(n!==void 0&&typeof n.bind=="function")t=n.bind({namespace:"code-server"});else{console.error("[code-server] settingsScope unavailable (inject missing?); settings card disabled");return}y("/code-server/status").then(function(d){L({status:d})}).catch(function(){}),r.inject("plugins.bundle.config",()=>r.register({name:"plugins.bundle.config",key:gr,inject:function(){return{scope:t}}},Rr)),r.inject("settings.plugin.item",()=>r.register({name:"settings.plugin.item",key:"code-server",label:"Code Server",inject:function(){return{scope:t}}},je));var a=!1;function l(d,m){if(!a){a=!0,x();var h=!1;try{h=Or(d)}catch(E){console.error("[code-server] sidebar tab registration failed:",E!=null&&E.message!=null?E.message:String(E))}D.sidebarUi==="legacy"&&(console.log("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u665A\u5230(\u7ECF "+m+"):\u64A4\u9500\u65E7\u7248 DSH \u5224\u5B9A"),y("/code-server/ui-mode",{sidebar:!0}).catch(function(){})),L({sidebarUi:"modern",sidebarRegisterFailed:h!==!0}),r.inject("shell.overlay",()=>r.register({name:"shell.overlay",id:"code-server",order:70,label:"Code Server"},E=>i.createElement(mr,E))),console.log("[code-server] client registered via "+m+": sidebar tab="+h+"(claims dsh-resource://file/**) + resident preload + settings card")}}function o(d){L({sidebarUi:"legacy"}),console.warn("[code-server] \u672A\u63A2\u6D4B\u5230\u53F3\u4FA7\u680F\u670D\u52A1(sidebarRightTabs/sidebarRight): \u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH \u2014\u2014 \u9664\u300C\u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Code Server\u300D\u7684\u63D0\u793A\u5916\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3,\u4E5F\u4E0D\u9884\u70ED IDE\u3002\u8BF7\u5347\u7EA7 DSH\u3002"),d===!0&&y("/code-server/ui-mode",{sidebar:!1}).catch(function(){})}var c=null,p=null,f=null;function x(){c!==null&&(clearTimeout(c),c=null),p!==null&&(clearTimeout(p),p=null),f!==null&&(clearTimeout(f),f=null)}var v=!1;try{typeof e.inject=="function"&&(v=!0,e.inject(["sidebarRightTabs","sidebarRight"],function(d){l(d,"inject")}))}catch(d){console.warn("[code-server] sidebar inject failed:",d!=null&&d.message!=null?d.message:String(d))}var w=typeof e.get=="function"&&e.get("sidebarRightTabs")!==void 0&&e.get("sidebarRight")!==void 0;if(w){f=setTimeout(function(){a||(console.warn("[code-server] ctx.inject \u672A\u5728 1.5s \u5185\u56DE\u8C03,\u6539\u7528\u540C\u6B65\u670D\u52A1\u6CE8\u518C\u4FA7\u680F"),l(e,"sync-fallback"))},wr);return}if(v!==!0){o(!0);return}c=setTimeout(function(){a||o(!1)},yr),p=setTimeout(function(){a||o(!0)},xr)}var Fr=["slots","settingsScope"],Br="code-server";
2
+ var Z=Object.defineProperty;var We=Object.getOwnPropertyDescriptor;var Ye=Object.getOwnPropertyNames;var Ge=Object.prototype.hasOwnProperty;var Xe=(e,r)=>{for(var n in r)Z(e,n,{get:r[n],enumerable:!0})},Qe=(e,r,n,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of Ye(r))!Ge.call(e,a)&&a!==n&&Z(e,a,{get:()=>r[a],enumerable:!(t=We(r,a))||t.enumerable});return e};var Je=e=>Qe(Z({},"__esModule",{value:!0}),e);var Jr={};Xe(Jr,{apply:()=>Yr,inject:()=>Xr,name:()=>Qr});module.exports=Je(Jr);var fe="dsh-resource://file/",Ve="sidebar://";function K(e){return typeof e=="string"&&e.startsWith(Ve)}function F(e){if(typeof e!="string"||!e.startsWith(fe))return null;for(var r=e.length,n=0;n<e.length;n+=1){var t=e.charAt(n);if(t==="?"||t==="#"){r=n;break}}var a=e.slice(fe.length,r).split("/"),i=a.shift();try{if(i==="session"){var o=a.shift();return o===void 0||o===""||a.length===0?null:{scope:"session",sessionId:decodeURIComponent(o),path:pe(a)}}if(i==="absolute"){var c=a[0]===""&&a.length>1,p=c?a.slice(1):a,f=pe(p);return(f===""||f.charAt(0)==="/")&&!c?null:c?{scope:"absolute",path:"//"+f}:f===""?null:{scope:"absolute",path:ve(f)?f:"/"+f}}}catch(w){return null}return null}function pe(e){for(var r=[],n=0;n<e.length;n+=1)r.push(decodeURIComponent(e[n]));return r.join("/")}function ve(e){return/^[A-Za-z]:($|\/)/.test(e)}function Ze(e){return typeof e!="string"||e===""?!1:e.charAt(0)==="/"?!0:ve(e)}function me(e){var r=F(e);if(r===null)return"";var n=r.path.replace(/[/\\]+$/,""),t=Math.max(n.lastIndexOf("/"),n.lastIndexOf("\\")),a=t===-1?n:n.slice(t+1);return a}function he(e,r){if(e===null||e==null)return null;var n=typeof e.path=="string"?e.path:"";if(n==="")return null;if(Ze(n))return n;if(typeof r!="string"||r==="")return null;var t=r.indexOf("\\")!==-1?"\\":"/",a=r.replace(/[\\/]+$/,"");return a+t+(t==="\\"?n.replace(/\//g,"\\"):n)}var q=["md","markdown","html","htm","png","jpg","jpeg","gif","webp","bmp","ico","svg","pdf"],B=["exe","com","msi","msix","msixbundle","appx","appxbundle","dll","sys","scr","cpl","ocx","drv","efi","mui","obj","o","a","lib","pdb","class","jar","pyc","pyo","wasm","node","so","dylib","ko","elf","bin","out","apk","ipa","deb","rpm","dmg","iso","img","cab"],W=["doc","docx","docm","dot","dotx","dotm","docb","rtf","odt","xls","xlsx","xlsm","xlsb","xlt","xltx","xltm","xla","xlam","ods","ppt","pptx","pptm","pot","potx","potm","pps","ppsx","ppam","odp","vsd","vsdx","vssx","vstx","vsdm","vssm","vstm","one","onetoc2","mpt","mpp","pub","msg","xps","oxps","odg"],$=["*"].concat(q).concat(B).concat(W).map(function(e,r){return r===0?e:"!"+e}).join(";"),Ke=/[;,\s]+/;function qe(e){return String(e).replace(/!\s+/g,"!").split(Ke)}function $e(e){var r=typeof e=="string"?e.trim():"";if(r==="")return"";var n=r.charAt(0)==="!",t=n?r.slice(1).trim():r;return t==="*"?n?"!*":"*":(t.slice(0,2)==="*."?t=t.slice(2):t.charAt(0)==="."&&(t=t.slice(1)),t=t.toLowerCase(),t===""?"":n?"!"+t:t)}function A(e){if(typeof e!="string")return"";for(var r=qe(e),n=[],t=0;t<r.length;t+=1){var a=$e(r[t]);a===""||a==="!*"||n.indexOf(a)===-1&&n.push(a)}return n.join(";")}function Y(e){for(var r=A(e),n=r===""?[]:r.split(";"),t=!1,a=[],i=[],o=0;o<n.length;o+=1){var c=n[o];if(c==="*"){t=!0;continue}c.charAt(0)==="!"?i.push(c.slice(1)):a.push(c)}return{all:t,allow:a,deny:i}}function er(e){if(typeof e!="string"||e==="")return"";var r=e.replace(/[/\\]+$/,""),n=Math.max(r.lastIndexOf("/"),r.lastIndexOf("\\"));n!==-1&&(r=r.slice(n+1));var t=r.lastIndexOf(".");return t<=0?"":r.slice(t+1).toLowerCase()}function rr(e,r){if(r==null)return!1;var n=er(e);return n!==""&&r.deny.indexOf(n)!==-1?!1:n!==""&&r.allow.indexOf(n)!==-1?!0:r.all===!0}function be(e,r){return e===null||e==null?!1:rr(e.path,r)}function ye(e){var r=Y(e),n=[];if(r.all&&n.push("\u5176\u4F59\u7C7B\u578B\u5168\u90E8\u8BA4\u9886"),r.allow.length>0&&n.push("\u6307\u5B9A\u8BA4\u9886 "+r.allow.length+" \u9879"),r.deny.length>0){var t=[];ge(r.deny,B)&&t.push("\u53EF\u6267\u884C\u6587\u4EF6"),ge(r.deny,W)&&t.push("Office \u6587\u6863"),n.push("\u6392\u9664 "+r.deny.length+" \u9879"+(t.length>0?"(\u542B"+t.join("\u3001")+")":""))}return n.length===0?"\u4E0D\u8BA4\u9886\u4EFB\u4F55\u6587\u4EF6(\u53EA\u6709\u9875\u9762\u6807\u7B7E)":n.join(" \xB7 ")}function ge(e,r){for(var n=new Set(r),t=0;t<e.length;t+=1)if(n.has(e[t]))return!0;return!1}var nr="[data-sidebar-right-panel]",tr='[data-sidebar-right-mode="fullscreen"]';function xe(e){if(e==null||typeof e.closest!="function")return"no-root";var r,n;try{if(r=e.closest(nr),r==null||typeof r.querySelector!="function")return"no-panel";n=r.querySelector(tr)}catch(t){return"lookup-failed"}if(n==null||typeof n.click!="function")return"no-control";try{n.click()}catch(t){return"click-failed"}return"clicked"}function we(e,r){if(!(e==null||e.byId==null)&&!(typeof r!="string"||r==="")){var n=e.byId[r];if(n!=null)return typeof n.cwd=="string"&&n.cwd!==""?n.cwd:void 0}}function ee(e,r){if(!(e==null||!Array.isArray(e.items))&&!(typeof r!="string"||r===""))for(var n=0;n<e.items.length;n+=1){var t=e.items[n];if(!(t==null||!Array.isArray(t.sessionIds))&&t.sessionIds.indexOf(r)!==-1&&typeof t.path=="string"&&t.path!=="")return t.path}}function re(e){var r=e==null?{}:e,n=r.sessions==null?null:r.sessions,t=r.workspaces==null?null:r.workspaces,a=typeof r.sessionId=="string"&&r.sessionId!==""?r.sessionId:void 0,i=we(n,a);if(i!==void 0)return i;var o=n==null?void 0:n.current,c=we(n,o);if(c!==void 0)return c;var p=ee(t,a);if(p!==void 0)return p;var f=ee(t,typeof o=="string"?o:void 0);if(f!==void 0)return f;var w=n!=null&&Array.isArray(n.ids)?n.ids[0]:void 0,v=ee(t,typeof w=="string"?w:void 0);if(v!==void 0)return v;if(t!=null&&Array.isArray(t.items)&&t.recentWorkspaceId!==void 0)for(var E=0;E<t.items.length;E+=1){var d=t.items[E];if(!(d==null||d.workspaceId!==t.recentWorkspaceId)&&typeof d.path=="string"&&d.path!=="")return d.path}if(t!=null&&Array.isArray(t.items)&&t.items.length>0){var m=t.items[0];if(m!=null&&typeof m.path=="string"&&m.path!=="")return m.path}}var j=typeof Element!="undefined"&&typeof Element.prototype.moveBefore=="function",ar=-2e4,l={park:null,frame:null,currentSrc:null,sameOrigin:null,owner:null,lastRect:null,parkStrategy:"offscreen",degraded:!1,preloaded:!1,nudgeCount:0,nudgeEnabled:!0,lastNudgeAt:0,listeners:new Set};function ne(){return{ready:l.frame!==null,docked:l.owner!==null,owner:l.owner,src:l.currentSrc,sameOrigin:l.sameOrigin,parkStrategy:l.parkStrategy,degraded:l.degraded,preloaded:l.preloaded,supportsMoveBefore:j,nudgeCount:l.nudgeCount,lastNudgeAt:l.lastNudgeAt}}function D(){var e=ne();l.listeners.forEach(function(r){try{r(e)}catch(n){}})}function Ee(e){return l.listeners.add(e),function(){l.listeners.delete(e)}}function ke(){return ne()}function sr(e){e!=="offscreen"&&e!=="behind"||l.parkStrategy!==e&&(l.parkStrategy=e,l.frame!==null&&l.owner===null&&te(),D())}function lr(){return l.parkStrategy}function ir(){var e=l.lastRect;e!==null&&(l.park.style.width=Math.max(1,Math.round(e.width))+"px",l.park.style.height=Math.max(1,Math.round(e.height))+"px")}function te(){if(l.park!==null){if(ir(),l.parkStrategy==="behind"&&l.lastRect!==null){l.park.style.left=Math.round(l.lastRect.left)+"px",l.park.style.top=Math.round(l.lastRect.top)+"px",l.park.style.visibility="visible",l.park.style.zIndex="0";return}l.park.style.left=ar+"px",l.park.style.top="0px",l.park.style.visibility="hidden",l.park.style.zIndex="0"}}function Se(){l.frame!==null&&(l.frame.setAttribute("inert",""),l.frame.setAttribute("aria-hidden","true"))}function or(){l.frame!==null&&(l.frame.removeAttribute("inert"),l.frame.removeAttribute("aria-hidden"))}function cr(){var e=document.createElement("div");e.className="dshcs-park",e.setAttribute("data-dshcs-park",""),e.setAttribute("aria-hidden","true");var r=document.createElement("iframe");return r.className="dshcs-frame",r.setAttribute("title","code-server"),r.setAttribute("allow","clipboard-read; clipboard-write"),r.setAttribute("data-dshcs-resident",""),r.src="about:blank",e.appendChild(r),document.body.appendChild(e),l.park=e,l.frame=r,l.currentSrc="about:blank",l.owner=null,te(),Se(),r}function dr(e){var r=l.frame;if(r!==null){var n=l.sameOrigin!==e;!n&&r.hasAttribute("data-dshcs-attrs")||(e===!0?r.removeAttribute("sandbox"):e===!1&&r.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms allow-modals allow-popups allow-pointer-lock allow-clipboard-read allow-clipboard-write"),r.setAttribute("data-dshcs-attrs",e===!0?"same-origin":"cross-origin"),l.sameOrigin=e)}}function ae(e){var r=e||{};return l.frame===null&&cr(),typeof r.sameOrigin=="boolean"&&dr(r.sameOrigin),typeof r.src=="string"&&r.src!==""&&r.src!==l.currentSrc&&ur(r.src),l.frame}function ur(e){l.frame===null||typeof e!="string"||e===""||e===l.currentSrc||(l.currentSrc=e,l.frame.src=e,D())}function Ce(){var e=l.frame;if(l.nudgeEnabled!==!0||e===null||e.isConnected!==!0)return!1;var r=e.style.display;return e.style.display="none",e.offsetHeight,e.style.display=r,l.nudgeCount+=1,l.lastNudgeAt=Date.now(),!0}function fr(e){return l.nudgeEnabled=e!==!1,l.nudgeEnabled}function Ne(e){if(l.frame!==null){if(j)try{e.moveBefore(l.frame,null);return}catch(r){l.degraded=!0,l.lastMoveError=(r&&r.name?r.name+": ":"")+(r&&r.message?r.message:String(r))}else l.degraded=!0;e.appendChild(l.frame)}}function se(e,r){if(!(l.frame===null||e==null)){var n=l.owner===null,t=e.getBoundingClientRect();t.width>=1&&t.height>=1&&(l.lastRect={left:t.left,top:t.top,width:t.width,height:t.height}),l.owner=r===void 0?null:r,or(),l.park.setAttribute("aria-hidden","true"),Ne(e),n&&Ce(),D()}}function z(e){l.frame!==null&&(e!==void 0&&l.owner!==e||(l.owner=null,te(),Se(),l.park.setAttribute("aria-hidden","true"),Ne(l.park),D()))}function le(e){var r=e||{};return ae(r),l.owner===null&&(typeof r.src=="string"&&r.src!==""&&(l.preloaded=!0),z()),l.frame}function pr(){l.park!==null&&l.park.parentNode!==null&&l.park.parentNode.removeChild(l.park),l.park=null,l.frame=null,l.currentSrc=null,l.sameOrigin=null,l.owner=null,l.lastRect=null,l.degraded=!1,l.preloaded=!1,l.nudgeCount=0,l.lastNudgeAt=0,D()}typeof window!="undefined"&&(window.__dshcsSurface={snapshot:ne,setParkStrategy:sr,getParkStrategy:lr,preload:le,dock:se,park:z,nudge:Ce,setNudgeEnabled:fr,destroy:pr});var s=require("react"),ce=new Set,P={status:null,busy:!1,sidebarUi:"unknown",sidebarRegisterFailed:!1};function L(e){P=Object.assign({},P,e),ce.forEach(function(r){r()})}function vr(e){return ce.add(e),function(){ce.delete(e)}}function mr(){return P}function ue(){return s.useSyncExternalStore(vr,mr)}var hr="/api",gr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiB2aWV3Qm94PSIwIDAgMTQ3IDE0NyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8c3R5bGU+QG1lZGlhIChwcmVmZXJzLWNvbG9yLXNjaGVtZTogZGFyaykgeyogeyBmaWxsOiB3aGl0ZTsgfX08L3N0eWxlPgogIDxwYXRoIGQ9Im00Mi40MjE0LDM5LjY1NWMtMjQuNDA1NywwIC00Mi4xNTU0LDEzLjE3MjEgLTQyLjE1NTQsMzMuODQ1YzAsMjAuNTgxNCAxOC40ODkyLDMzLjg0NSA0Mi4xNTU0LDMzLjg0NWMyMy42NjYyLDAgMzguMTgwMywtMTEuNjE3MSAzOC43MzQ5LC0yOC43MjI1bC0yMS4wNzc3LC0wLjQ1NzRjLTAuOTI0NCw5LjMzMDMgLTkuMTA1OSwxNS4xODQ1IC0xNy42NTcyLDE1LjE4NDVjLTExLjc0MDYsMCAtMjAuNDMwNiwtNy41OTIyIC0yMC40MzA2LC0xOS44NDk2YzAsLTEyLjI1NzQgOC42OSwtMTkuOTg2OCAyMC40MzA2LC0yMC4yMTU1YzguNTUxMywtMC4xODMgMTYuOTE3Nyw1Ljk0NTcgMTcuNDcyMywxNS4yNzZsMjEuMDc3NywtMC42NDAzYy0wLjQ2MjIsLTE2LjgzMTEgLTE0LjE0NDIsLTI4LjI2NTIgLTM4LjU1LC0yOC4yNjUyem00OC44NDQ2LDJsNTUuNDY4LDBsMCw2NC4wMzExbC01NS40NjgsMGwwLC02NC4wMzExeiIgY2xpcC1ydWxlPSJldmVub2RkIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz4KPC9zdmc+Cg==";async function x(e,r){var n={method:r===void 0?"GET":"POST",headers:{}};r!==void 0&&(n.headers["content-type"]="application/json",n.body=JSON.stringify(r));var t=await fetch(hr+e,n),a=await t.text(),i=null;try{i=a===""?null:JSON.parse(a)}catch(o){i=null}return t.ok?i!==null?i:{ok:!1,error:"invalid JSON response"}:{ok:!1,error:"HTTP "+t.status+(i!==null&&i.error!==void 0?": "+i.error:"")}}function Oe(){}function De(e){var r=typeof e.useSessions=="function"?e.useSessions:Oe,n=typeof e.useWorkspaces=="function"?e.useWorkspaces:Oe;return{sessions:r(function(t){return t}),workspaces:n(function(t){return t})}}function ze(e,r){if(e==null||typeof e.url!="string"||e.url==="")return null;var n=e.pid!=null?String(e.pid):e.startedAt!=null?String(e.startedAt):"0",t=e.url+"?s="+encodeURIComponent(n),a=typeof r=="string"&&r!==""?r:e!=null&&e.cwd!=null?e.cwd:null;if(a==null||a==="")return t;var i=a.replace(/\\/g,"/"),o=i;return(/^[A-Za-z]:\//.test(i)||i.charCodeAt(0)!==47)&&(o="/"+i),t+"&folder="+encodeURIComponent(o)}function br(e){var r=e.status,n=e.pageUrl,t=e.reloadTick,a=e.owner,i=s.useRef(null),o=r!=null&&r.ok===!0&&r.running===!0,c=r!=null&&r.status==="starting",p=r!=null&&r.ok===!1,f=r!=null&&r.serve==="dsh";if(s.useLayoutEffect(function(){if(!o||n===null){z(a);return}ae({src:n,sameOrigin:f}),i.current!==null&&se(i.current,a)},[o,n,f,t,a]),s.useLayoutEffect(function(){return function(){z(a)}},[a]),o&&n!==null)return s.createElement("div",{ref:i,className:"dshcs-slot","data-code-server-slot":a!=null?a:"code-server"});if(c)return s.createElement("div",{className:"dshcs-loading"},"\u6B63\u5728\u542F\u52A8 code-server\u2026");var w=p&&r!=null&&r.error?r.error:"code-server \u672A\u8FD0\u884C",v=f?"\u5F53\u524D\u4EE5 DSH \u540C\u6E90\u8DEF\u5F84 "+(r!=null&&r.url||"/code-server/")+" \u63D0\u4F9B(\u65E0\u72EC\u7ACB\u7AEF\u53E3)\u3002":"\u5F53\u524D\u4EE5\u72EC\u7ACB\u56DE\u73AF\u7AEF\u53E3\u63D0\u4F9B(\u7AEF\u53E3 "+(r!=null&&r.port!=null?r.port:"\u968F\u673A")+" + \u8DEF\u5F84\u4EE4\u724C;\u8981\u5728\u65B0\u6807\u7B7E\u9875\u6253\u5F00,\u590D\u5236\u8BBE\u7F6E\u5361\u91CC\u7684\u5B8C\u6574\u5730\u5740 \u2014\u2014 \u7F3A\u4E86\u4EE4\u724C\u90A3\u6BB5\u4F1A 404)\u3002",E=j?"\u5E38\u9A7B\u9762:\u53EF\u7528(\u5207\u6807\u7B7E/\u6536\u8D77\u4FA7\u680F\u4E0D\u91CD\u8F7D)\u3002":"\u5E38\u9A7B\u9762:\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore \u2014\u2014 \u5207\u6807\u7B7E\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u53EF\u7528)\u3002";return s.createElement("div",{className:"dshcs-empty"},s.createElement("div",{className:"dshcs-emptybox"},s.createElement("div",null,p?"code-server \u542F\u52A8\u5931\u8D25":"code-server \u672A\u8FD0\u884C"),s.createElement("pre",{className:"dshcs-error"},w),s.createElement("p",{className:"dshcs-hint"},"VS Code \u6811\u968F\u63D2\u4EF6\u5305\u5185\u7F6E\u3001\u5C31\u5730\u8FD0\u884C(\u65E0\u9700\u5168\u5C40\u5B89\u88C5\u3001\u65E0\u9700\u8054\u7F51\u5B89\u88C5\u3001\u65E0\u300C\u5B89\u88C5\u73AF\u5883\u300D\u6B65\u9AA4);\u5185\u90E8\u4F9D\u8D56\u4E0E\u9884\u7F16\u8BD1\u539F\u751F\u6A21\u5757\u7531\u5305\u7BA1\u7406\u5668\u5728\u5B89\u88C5\u63D2\u4EF6\u65F6\u4E00\u5E76\u88C5\u597D(\u65E0\u9700 C++ \u5DE5\u5177\u94FE)\u3002\u82E5\u6B64\u5904\u957F\u671F\u672A\u8FD0\u884C,\u8BF7\u67E5\u770B DSH host \u65E5\u5FD7\u91CC\u7684 [code-server] \u8F93\u51FA(\u6216\u5728\u8BBE\u7F6E\u5361\u7247\u91CC\u5207\u6362\u300C\u540E\u53F0\u5E38\u9A7B\u300D\u89E6\u53D1\u4E00\u6B21\u542F\u52A8)\u3002"+v+E)))}function yr(e){var r=ue(),n=r.status,t=n!=null&&n.ok===!0&&n.running===!0,a=n!=null&&n.keepResident===!0,i=De(e!=null?e:{}),o=re({sessions:i.sessions,workspaces:i.workspaces}),c=t?ze(n,o):null;return s.useEffect(function(){!a||!t||c===null||le({src:c,sameOrigin:n!=null&&n.serve==="dsh"})},[a,t,c,n!=null?n.serve:null]),null}var xr=".dshcs-frame{display:block;position:absolute;inset:0;z-index:1;width:100%;height:100%;border:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-tabroot{position:relative;display:flex;flex-direction:column;width:100%;height:100%;min-width:0;min-height:0;background:var(--dsw-alias-bg-base,#fff)}.dshcs-slot{position:relative;display:block;width:100%;height:100%;min-width:0;min-height:0;overflow:hidden;background:var(--dsw-alias-bg-base,#fff)}.dshcs-park{position:fixed;left:-20000px;top:0;width:320px;height:200px;overflow:hidden;pointer-events:none;z-index:0;visibility:hidden;contain:strict}.dshcs-loading{position:absolute;inset:0;z-index:2;display:grid;place-items:center;background:var(--dsw-alias-bg-base,#fff);color:var(--dsw-alias-label-tertiary,#7d8798);font-size:13px}.dshcs-empty{position:relative;z-index:2;flex:1;display:flex;align-items:center;justify-content:center;padding:44px 24px 24px}.dshcs-emptybox{max-width:560px;text-align:left;background:var(--dsw-alias-bg-layer-2,#f7f8fb);border:1px solid var(--dsw-alias-border-l2,#dfe3eb);border-radius:12px;padding:16px 18px}.dshcs-error{color:var(--dsw-alias-label-error,#d92d20);white-space:pre-wrap;word-break:break-all;font-family:ui-monospace,Consolas,monospace;font-size:12px;margin:8px 0 0}.dshcs-hint{color:var(--dsw-alias-label-tertiary,#7d8798);font-size:12px;margin:6px 0 0}.dshcs-legacy{color:var(--dsw-alias-label-warning,#b54708);font-size:12px;font-weight:600;margin:0 0 6px}",Le="dsh-code-server/styles";typeof document!="undefined"&&document.querySelector("style[data-dshcs="+JSON.stringify(Le)+"]")===null&&(G=document.createElement("style"),G.setAttribute("data-dshcs",Le),G.textContent=xr,document.head.appendChild(G));var G,Te="code-server",Ae="dsh-code-server-app",wr="dsh-code-server-app",Er="\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC\u8FD0\u884C VS Code \u7F51\u9875\u7248,\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u533A;\u8BA4\u9886\u7C7B\u578B\u3001\u6253\u5F00\u5373\u5168\u5C4F\u3001\u540E\u53F0\u5E38\u9A7B\u90FD\u5728\u8FD9\u91CC\u8BBE\u3002",kr=2500,Sr=1e4,Cr=1500;function Nr(e){var r=e!=null&&typeof e.size=="number"?e.size:16;return s.createElement("img",{src:gr,alt:"","aria-hidden":!0,draggable:!1,className:e!=null?e.className:void 0,style:{width:r,height:r,display:"block",objectFit:"contain",WebkitUserDrag:"none",userSelect:"none"}})}var Or=Y("");function Lr(){var e=P.status;return e==null||typeof e.claimExtensions!="string"?Or:Y(e.claimExtensions)}function Tr(){for(var e=["*"],r=[q,B,W],n=0;n<r.length;n+=1){for(var t=[],a=0;a<r[n].length;a+=1)t.push("!"+r[n][a]);e.push(t.join(";"))}return e.join(`
3
+ `)}var X=new Map;function Ar(e,r){var n=0;return X.forEach(function(t,a){if(a!==e&&!(r!==null&&t.pane!==null&&t.pane!==r))try{t.close(),X.delete(a),n+=1}catch(i){console.warn("[code-server] \u6536\u8D77\u65E7\u7684 code-server \u6807\u7B7E\u9875\u5931\u8D25:"+(i!=null&&i.message!=null?i.message:i))}}),n}function Ir(e){var r=e.useTabInfo(),n=r.tab,t=ue(),a=t.status,i=n.navigation,o=i!=null&&typeof i.revision=="number"?i.revision:0,c=i!=null&&typeof i.address=="string"?i.address:"",p=K(c)?null:F(c),f=De(e),w=p!=null&&typeof p.sessionId=="string"?p.sessionId:void 0,v=re({sessions:f.sessions,workspaces:f.workspaces,sessionId:w!==void 0?w:e.sessionId}),E=s.useRef(!1),d=he(p,v),m=i!=null&&i.params!=null&&typeof i.params.line=="number"?i.params.line:null,h=s.useRef(void 0),[k,V]=s.useState(0),_=s.useRef(null),S=s.useRef(!1),I=r.tab!=null&&r.tab.visible===!0,U=r.sidebar!=null&&r.sidebar.fullscreen===!0,T=r.panel!=null&&r.panel.id!==void 0?r.panel.id:null,y=n.actions!=null?n.actions:null,C=n.id,M=s.useRef(!1);s.useLayoutEffect(function(){if(y!==null)return X.set(C,{pane:T,close:y.close}),function(){X.delete(C)}},[C,T,y]),s.useLayoutEffect(function(){M.current||I!==!0||y===null||(M.current=!0,Ar(C,T))},[I,C,T,y]);var g=a!=null&&a.fullscreenOnOpen!==!1;return s.useLayoutEffect(function(){if(!I){S.current=!1;return}if(!(!g||U||S.current)){S.current=!0;var b=xe(_.current);b!=="clicked"&&console.warn("[code-server] \u672A\u80FD\u81EA\u52A8\u5207\u5230\u5168\u5C4F\u53F3\u4FA7\u680F("+b+");\u672C\u6B21\u6253\u5F00\u4FDD\u6301\u539F\u6A21\u5F0F")}},[I,U,g]),s.useEffect(function(){if(!(typeof v!="string"||v==="")&&h.current!==v){var b=h.current!==void 0;h.current=v;var N=!1;return x("/code-server/start",{cwd:v}).then(function(H){N||(L({status:H}),b&&H!=null&&H.ok===!0&&H.running===!0&&V(function(Be){return Be+1}))}).catch(function(){}),function(){N=!0}}},[v]),s.useEffect(function(){typeof v=="string"&&v!==""||E.current||(E.current=!0,console.warn("[code-server] \u672A\u80FD\u89E3\u6790\u5F53\u524D\u5DE5\u4F5C\u533A\u76EE\u5F55(\u4F1A\u8BDD\u65E0 cwd / \u6807\u51C6 prop \u65E0 sessionId / \u5DE5\u4F5C\u533A\u8868\u4E5F\u6CA1\u5339\u914D\u4E0A):\u672C\u6B21\u4E0D\u5411\u5BBF\u4E3B\u53D1\u9001 cwd,IDE \u4F1A\u4EE5\u7A7A\u5DE5\u4F5C\u533A\u6253\u5F00"))},[v]),s.useEffect(function(){x("/code-server/status").then(function(N){N!=null&&L({status:N})}).catch(function(){});var b=window.setInterval(function(){x("/code-server/status").then(function(N){L({status:N})}).catch(function(){})},3e3);return function(){window.clearInterval(b)}},[]),s.useEffect(function(){d!==null&&x("/code-server/open-file",m===null?{file:d}:{file:d,line:m}).catch(function(){})},[o,d,m]),s.createElement("div",{className:"dshcs-tabroot","data-code-server-tab":"body",ref:_},s.createElement(br,{status:a,pageUrl:ze(a,v),reloadTick:k,owner:"tab:"+n.id}))}function ie(e,r){if(e==null)return null;var n=e[r];if(n!=null)return n;if(typeof e.get=="function"){var t=e.get(r);if(t!=null)return t}return null}function Mr(e){var r=ie(e,"sidebarRightTabs"),n=ie(e,"sidebarRight");if(r==null||n==null)return console.error("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u4E0A\u4E0B\u6587\u4E0D\u53EF\u89C1(sidebarRightTabs="+(r!=null)+", sidebarRight="+(n!=null)+"):\u8DF3\u8FC7\u4FA7\u680F\u6CE8\u518C"),!1;var t=ie(e,"slots");if(e.effect(function(){return r.register({id:Ae,kind:Te,priority:"extension",patterns:["dsh-resource://file/**"],canOpen:function(a){return be(F(a),Lr())},title:function(a){if(K(a)||a===void 0||a===null||a==="")return"Code Server";var i=me(a);return i===""?"Code Server":i},guide:[{order:20,title:function(){return"Code Server"},description:function(){return"\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC\u8FD0\u884C VS Code \u7F51\u9875\u7248,\u8DDF\u968F\u5F53\u524D\u4F1A\u8BDD\u5DE5\u4F5C\u533A;\u4EA7\u7269/\u4EA4\u4ED8\u6587\u4EF6\u70B9\u51FB\u540E\u5728\u6B64\u6253\u5F00\u3002"},icon:Nr}]})},"code-server: sidebar tab type"),t!=null)e.effect(function(){return t.inject("sidebar.right.pane.tab",function(){return t.register({name:"sidebar.right.pane.tab",key:Ae},Ir)})},"code-server: sidebar tab body");else return console.error("[code-server] slots \u670D\u52A1\u4E0D\u53EF\u89C1:\u4FA7\u680F\u6807\u7B7E body \u672A\u6CE8\u518C"),!1;return e.effect(function(){return function(){L({sidebarUi:"unknown"})}},"code-server: sidebar mode reset"),console.log("[code-server] right-sidebar tab registered (kind="+Te+")"),!0}var Rr=".dshcs-card{border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-3);border-radius:12px;list-style:none;transition:border-color .16s,background .16s}.dshcs-card:hover{border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardOpen{background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-label-dimmed,var(--dsw-alias-border-l2))}.dshcs-cardHeader{appearance:none;width:100%;font:inherit;color:inherit;text-align:left;cursor:pointer;background:0 0;border:0;border-radius:12px;align-items:center;gap:12px;padding:14px 16px;display:flex}.dshcs-cardHeader:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-2px}.dshcs-cardHeadText{flex-direction:column;flex:1;gap:4px;min-width:0;display:flex}.dshcs-cardName{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:1.4}.dshcs-cardDescription{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));font-size:13px;line-height:1.5}.dshcs-cardChevron{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));flex:none;transition:transform .16s;display:inline-flex}.dshcs-cardChevronOpen{transform:rotate(180deg)}.dshcs-cardBody{border-top:1px solid var(--dsw-alias-border-l2);margin:0 16px;padding-bottom:8px}.dshcs-cardReadOnly{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:12px 0 0;font-size:12px;line-height:1.5}.dshcs-pending{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;flex:none;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-cardFooter{border-top:1px solid var(--dsw-alias-border-l2);justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}.dshcs-cardFailed{min-width:0;color:var(--dsw-alias-label-error,var(--dsw-alias-state-error-primary));flex:1;margin:0;font-size:12px;line-height:1.5}.dshcs-cbtn{appearance:none;font:inherit;cursor:pointer;border-radius:8px;padding:5px 14px;font-size:13px;line-height:1.5;border:1px solid transparent;transition:color .12s ease,background .12s ease}.dshcs-cbtn:disabled{opacity:.4;cursor:default}.dshcs-cbtn:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:1px}.dshcs-cbtnOutline{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-label-secondary);background:0 0}.dshcs-cbtnOutline:hover:not(:disabled){color:var(--dsw-alias-label-primary);background:var(--dsw-alias-interactive-bg-hover,transparent)}.dshcs-cbtnPrimary{background:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3);border-color:var(--dsw-alias-label-primary);font-weight:600}.dshcs-cbtnPrimary:hover:not(:disabled){filter:brightness(.95)}.dshcs-cbtnPrimary:active:not(:disabled){filter:brightness(.9)}.dshcs-field{flex-direction:column;gap:6px;padding:12px 0;display:flex}.dshcs-field+.dshcs-field{border-top:1px solid var(--dsw-alias-border-l2)}.dshcs-fieldHead{align-items:center;gap:8px;display:flex}.dshcs-fieldLabel{min-width:0;color:var(--dsw-alias-label-primary);flex:1;font-size:13px;font-weight:500;line-height:1.5}.dshcs-card .dshcs-hint{color:var(--dsw-alias-label-tertiary,var(--dsw-alias-label-secondary));margin:0;font-size:12px;line-height:1.5}.dshcs-check{display:flex;align-items:center;gap:8px;cursor:pointer}.dshcs-check input{accent-color:var(--dsw-alias-brand-primary);width:15px;height:15px;margin:0;flex:none}.dshcs-check input:disabled{cursor:default}.dshcs-text{display:flex}.dshcs-text input,.dshcs-text textarea{font:12px/1.5 ui-monospace,Consolas,monospace;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-3,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:5px 8px;width:100%;min-width:0}.dshcs-text textarea{display:block;box-sizing:border-box;resize:vertical;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}.dshcs-text input:disabled,.dshcs-text textarea:disabled{opacity:.5;cursor:default}.dshcs-text input:focus-visible,.dshcs-text textarea:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:-1px}.dshcs-code{display:block;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word;font:11.5px/1.55 ui-monospace,Consolas,monospace;color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-bg-layer-2,transparent);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;padding:6px 8px;margin:4px 0 0;max-width:100%}.dshcs-badges{align-items:center;gap:8px;display:inline-flex}.dshcs-badge{white-space:nowrap;background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-2));color:var(--dsw-alias-label-secondary);border-radius:999px;padding:1px 8px;font-size:11px;font-weight:500;line-height:17px}.dshcs-reset{font:inherit;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;padding:0;font-size:12px;line-height:1.5}.dshcs-reset:hover:not(:disabled){color:var(--dsw-alias-label-primary)}.dshcs-reset:disabled{cursor:default}.dshcs-cfgpage{display:flex;flex-direction:column;gap:0}.dshcs-cfgfoot{justify-content:flex-end;align-items:center;gap:8px;padding:12px 0 4px;display:flex}",jr="dsh-code-server/Card.module.css";function Dr(e,r){if(typeof document!="undefined"&&document.querySelector("style[data-plugin-css="+JSON.stringify(e)+"]")===null){var n=document.createElement("style");n.dataset.plugin="dsh-code-server",n.dataset.pluginCss=e,n.textContent=r,document.head.appendChild(n)}}Dr(jr,Rr);function zr(e){return s.createElement("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":!0,className:e.className},s.createElement("path",{d:"M3.5 5.25L7 8.75L10.5 5.25",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}))}function Q(e){return s.createElement("button",{type:"button",className:"dshcs-cbtn "+(e.variant==="primary"?"dshcs-cbtnPrimary":"dshcs-cbtnOutline"),disabled:e.disabled===!0,onClick:e.onClick},e.children)}function Ie(e){return s.createElement("label",{className:"dshcs-check"},s.createElement("input",{type:"checkbox",checked:e.checked===!0,disabled:e.disabled===!0,onChange:function(r){e.onChange(r.target.checked)}}),s.createElement("span",{className:"dshcs-hint"},e.children))}function Pr(e){var r=typeof e.value=="string"?e.value:"",n=Math.min(12,Math.max(3,Math.ceil(r.length/64)));return s.createElement("label",{className:"dshcs-text"},s.createElement("textarea",{value:e.value,disabled:e.disabled===!0,rows:n,spellCheck:!1,autoComplete:"off",wrap:"soft",placeholder:e.placeholder,onChange:function(t){e.onChange(t.target.value)}}))}function oe(e){var r=[];return e.overridden===!0&&(r.push(s.createElement("span",{className:"dshcs-badge"},e.overriddenLabel)),r.push(s.createElement("button",{type:"button",className:"dshcs-reset",disabled:e.disabled===!0,onClick:e.onReset},e.resetLabel))),r.length===0?null:s.createElement("span",{className:"dshcs-badges"},...r)}function Me(e){var[r,n]=s.useState(e.defaultOpen===!0),t=e.state;if(t==null||t.available!==!0)return null;var a=e.title,i=e.noticeOnly===!0,o=t.dirty!==!0||t.invalid===!0||t.saving===!0;return s.createElement("li",{className:"dshcs-card"+(r?" dshcs-cardOpen":"")},s.createElement("button",{type:"button",className:"dshcs-cardHeader","aria-expanded":r,onClick:function(){n(!r)}},s.createElement("span",{className:"dshcs-cardHeadText"},s.createElement("span",{className:"dshcs-cardName"},a),s.createElement("span",{className:"dshcs-cardDescription"},e.description)),t.dirty===!0?s.createElement("span",{className:"dshcs-pending"},e.unsavedLabel):null,s.createElement(zr,{className:"dshcs-cardChevron"+(r?" dshcs-cardChevronOpen":"")})),r===!0?s.createElement("div",{className:"dshcs-cardBody"},i===!0?null:t.writable!==!0?s.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},e.readOnlyLabel):null,e.children,i===!0?null:s.createElement("div",{className:"dshcs-cardFooter"},t.failed===!0?s.createElement("p",{className:"dshcs-cardFailed",role:"status"},e.saveFailedLabel):null,s.createElement(Q,{disabled:t.dirty!==!0||t.saving===!0,onClick:e.onDiscard},e.discardLabel),s.createElement(Q,{variant:"primary",disabled:o,onClick:e.onSave},t.saving===!0?e.savingLabel:e.saveLabel))):null)}function Pe(e){try{let y=function(){x("/code-server/status").then(function(g){g!=null&&typeof g=="object"&&L({status:g})}).catch(function(){})};var r=e.scope,[n,t]=s.useState(function(){return r!==void 0?r.getSnapshot():null}),[a,i]=s.useState(null),[o,c]=s.useState(!1),[p,f]=s.useState(!1),w=ue(),[v,E]=s.useState(ke());if(s.useEffect(function(){return Ee(function(g){E(g)})},[]),s.useEffect(function(){if(r===void 0||typeof r.subscribe!="function")return;function g(){try{t(r.getSnapshot())}catch(N){}}var b=r.subscribe(g);return function(){typeof b=="function"&&b()}},[r]),r===void 0)return console.error("[code-server] card scope missing"),null;if(n==null||n.status!=="ready")return n!=null&&n.status==="unavailable"&&console.warn("[code-server] settings scope unavailable:",n.status),null;var d=n.value!==void 0&&n.value!==null?n.value:{},m=n.user,h={keepResident:d.keepResident!==!1,claimExtensions:typeof d.claimExtensions=="string"?d.claimExtensions:$,fullscreenOnOpen:d.fullscreenOnOpen!==!1};if(w!=null&&w.sidebarUi==="legacy")return s.createElement(Me,{title:"Code Server",description:"\u5F53\u524D DSH \u7248\u672C\u4E0D\u53D7\u652F\u6301(\u7F3A\u5C11\u53F3\u4FA7\u680F\u670D\u52A1)",defaultOpen:!0,noticeOnly:!0,state:{available:!0,writable:!1,dirty:!1,invalid:!1,saving:!1,failed:!1}},s.createElement("div",{className:"dshcs-field"},s.createElement("div",{className:"dshcs-legacy"},"\u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH\u3002"),s.createElement("div",{className:"dshcs-hint",style:{marginTop:0}},`\u672A\u68C0\u6D4B\u5230\u53F3\u4FA7\u680F\u63D2\u4EF6\u670D\u52A1 sidebarRightTabs / sidebarRight,\u56E0\u6B64\u63D2\u4EF6\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3(\u65E7\u7248\u7684\u60AC\u6D6E\u7403\u4E0E\u6D6E\u52A8\u7A97\u53E3\u5DF2\u79FB\u9664),\u4E5F\u4E0D\u4F1A\u540E\u53F0\u542F\u52A8 IDE\u3002
4
+ \u5347\u7EA7 DSH \u5230\u5E26\u53F3\u4FA7\u680F\u7684\u7248\u672C(\u2265 0.1.5-alpha.1)\u540E,Code Server \u4F1A\u51FA\u73B0\u5728\u53F3\u4FA7\u680F\u6807\u7B7E\u91CC,\u672C\u9875\u540C\u65F6\u663E\u793A\u5B8C\u6574\u8BBE\u7F6E\u9879;\u5347\u7EA7\u540E\u65E0\u9700\u91CD\u88C5\u672C\u63D2\u4EF6,\u5237\u65B0\u9875\u9762\u5373\u53EF\u3002`)));var k=m!=null&&Object.prototype.hasOwnProperty.call(m,"keepResident"),V=m!=null&&Object.prototype.hasOwnProperty.call(m,"claimExtensions"),_=m!=null&&Object.prototype.hasOwnProperty.call(m,"fullscreenOnOpen"),S=a!==null&&(a.keepResident!==h.keepResident||A(a.claimExtensions)!==A(h.claimExtensions)||a.fullscreenOnOpen!==h.fullscreenOnOpen),I=!S||o,U={available:!0,writable:n.writable,dirty:S,invalid:!1,saving:o,failed:p};async function C(){if(S&&!o){c(!0),f(!1);try{var g=a!==null?a:h;await e.scope.set("keepResident",g.keepResident===!0),await e.scope.set("claimExtensions",A(g.claimExtensions)),await e.scope.set("fullscreenOnOpen",g.fullscreenOnOpen===!0),i(null),y()}catch(b){f(!0)}c(!1)}}async function M(){if(!(o||n.writable!==!0)){c(!0),f(!1);try{typeof e.scope.unset=="function"?(await e.scope.unset("keepResident"),await e.scope.unset("claimExtensions"),await e.scope.unset("fullscreenOnOpen")):(await e.scope.set("keepResident",d.keepResident===void 0||d.keepResident===null?!0:d.keepResident),await e.scope.set("claimExtensions",typeof d.claimExtensions=="string"?A(d.claimExtensions):$),await e.scope.set("fullscreenOnOpen",d.fullscreenOnOpen===void 0||d.fullscreenOnOpen===null?!0:d.fullscreenOnOpen)),i(null),y()}catch(g){f(!0)}c(!1)}}var T=[s.createElement("div",{className:"dshcs-field"},s.createElement("div",{className:"dshcs-fieldHead"},s.createElement("span",{className:"dshcs-fieldLabel"},"\u8BA4\u9886\u7C7B\u578B(\u6309\u6269\u5C55\u540D,\u5206\u53F7\u5206\u9694)"),V===!0?s.createElement(oe,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){M()}}):null),s.createElement(Pr,{value:a!==null?a.claimExtensions:h.claimExtensions,disabled:n.writable!==!0,placeholder:"\u4F8B\u5982 py;ts;!md(\u7559\u7A7A = \u4E0D\u8BA4\u9886\u4EFB\u4F55\u6587\u4EF6)",onChange:function(g){i(function(b){return Object.assign({},b!==null?b:h,{claimExtensions:g})}),f(!1)}}),s.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u5199\u6269\u5C55\u540D(\u4E0D\u5E26\u70B9,\u5927\u5C0F\u5199\u968F\u610F);`*` = \u5176\u4F59\u7C7B\u578B\u4E5F\u8BA4\u9886;`!ext` = \u4E0D\u8BA4\u9886(\u6392\u9664\u4F18\u5148)\u3002\u4E0D\u518D\u533A\u5206\u4F1A\u8BDD\u5185/\u7EDD\u5BF9\u8DEF\u5F84 \u2014\u2014 \u6240\u6709 `dsh-resource://file/**` \u4E00\u89C6\u540C\u4EC1,\u672A\u8BA4\u9886\u7684\u843D\u56DE DSH \u81EA\u5E26\u9884\u89C8\u3002"),s.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u5B9E\u9645\u89C4\u5219:"+ye(a!==null?a.claimExtensions:h.claimExtensions)+(A(a!==null?a.claimExtensions:h.claimExtensions)!==(a!==null?a.claimExtensions:h.claimExtensions)?"(\u4FDD\u5B58\u540E\u5F52\u4E00\u5316)":"")),s.createElement("div",{className:"dshcs-hint",style:{marginTop:6}},"\u9ED8\u8BA4\u6392\u9664\u4E09\u7C7B:\u2460 DSH \u9884\u89C8\u6E32\u67D3\u5F97\u597D\u7684 markdown/html/\u56FE\u7247/PDF;\u2461 \u53EF\u6267\u884C\u6587\u4EF6\u4E0E\u4E8C\u8FDB\u5236\u4EA7\u7269(exe/dll/msi/jar/so\u2026);\u2462 Office \u4E0E\u7248\u5F0F\u6587\u6863(docx/xlsx/pptx/vsdx\u2026)\u3002\u6587\u672C\u811A\u672C(bat/cmd/ps1/sh/py)\u4E0E csv/tsv \u4ECD\u8FDB IDE\u3002\u60F3\u6574\u7EC4\u653E\u5F00,\u628A\u4E0B\u9762\u8FD9\u6BB5\u6362\u6210 `*;!md;!html;!png;!jpg;!pdf` \u4E4B\u7C7B\u7684\u77ED\u6E05\u5355\u5373\u53EF\u3002"),s.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},"\u9ED8\u8BA4\u503C(\u53EF\u6574\u6BB5\u590D\u5236;\u6362\u884C\u4E0E\u5206\u53F7\u7B49\u4EF7):",s.createElement("code",{className:"dshcs-code","data-claim-default":"lines"},Tr()))),s.createElement("div",{className:"dshcs-field"},s.createElement("div",{className:"dshcs-fieldHead"},s.createElement("span",{className:"dshcs-fieldLabel"},"\u6253\u5F00\u5373\u5168\u5C4F(\u53F3\u4FA7\u680F\u94FA\u6EE1\u7A97\u53E3)"),_===!0?s.createElement(oe,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){M()}}):null),s.createElement(Ie,{checked:a!==null?a.fullscreenOnOpen:h.fullscreenOnOpen,disabled:n.writable!==!0,onChange:function(g){i(function(b){return Object.assign({},b!==null?b:h,{fullscreenOnOpen:g===!0})}),f(!1)}},'\u6253\u5F00 Code Server \u6807\u7B7E(\u542B\u70B9\u5F00\u4EA7\u7269/\u4EA4\u4ED8\u6587\u4EF6)\u65F6,\u81EA\u52A8\u628A\u53F3\u4FA7\u680F\u4ECE"\u4E0E\u5BF9\u8BDD\u5E76\u6392"\u5207\u5230\u5168\u5C4F;\u60F3\u540C\u65F6\u770B\u5BF9\u8BDD\u5C31\u5173\u6389\u5B83,\u6216\u968F\u65F6\u70B9\u53F3\u4FA7\u680F\u7684\u300C\u9000\u51FA\u5168\u5C4F\u300D\u2014\u2014 \u672C\u6B21\u6253\u5F00\u4E0D\u4F1A\u88AB\u62A2\u56DE\u53BB'),s.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},'\u53EA\u5F71\u54CD"\u6253\u5F00\u90A3\u4E00\u523B":\u5207\u8D70\u518D\u5207\u56DE\u3001\u518D\u6B21\u6253\u5F00\u6587\u4EF6 tab \u4F1A\u91CD\u65B0\u5207\u5168\u5C4F;DSH \u672A\u5411\u63D2\u4EF6\u5F00\u653E\u6A21\u5F0F\u63A5\u53E3,\u672C\u9879\u7531\u70B9\u51FB\u53F3\u4FA7\u680F\u81EA\u8EAB\u7684\u300C\u5168\u5C4F\u300D\u6309\u94AE\u5B9E\u73B0\u3002')),s.createElement("div",{className:"dshcs-field"},s.createElement("div",{className:"dshcs-fieldHead"},s.createElement("span",{className:"dshcs-fieldLabel"},"\u540E\u53F0\u5E38\u9A7B(\u5207\u6807\u7B7E\u4E0D\u91CD\u8F7D)"),k===!0?s.createElement(oe,{overridden:!0,disabled:n.writable!==!0,overriddenLabel:"\u5DF2\u8986\u76D6",resetLabel:"\u6062\u590D\u9ED8\u8BA4",onReset:function(){M()}}):null),s.createElement(Ie,{checked:a!==null?a.keepResident:h.keepResident,disabled:n.writable!==!0,onChange:function(g){i(function(b){return Object.assign({},b!==null?b:h,{keepResident:g===!0})}),f(!1)}},'\u5F00\u542F\u540E\u5BBF\u4E3B\u542F\u52A8\u5373\u628A IDE \u52A0\u8F7D\u5230\u540E\u53F0"\u505C\u653E\u533A":\u5207\u6362\u53F3\u4FA7\u680F\u6807\u7B7E\u3001\u6536\u8D77/\u5C55\u5F00\u4FA7\u680F\u3001\u62D6\u6210\u6D6E\u52A8\u7A97\u53E3\u90FD\u4E0D\u518D\u91CD\u8F7D,\u9996\u6B21\u6253\u5F00\u514D\u7B49\u5F85;\u5173\u95ED\u5219\u53EA\u5728\u6253\u5F00\u9762\u677F\u65F6\u52A0\u8F7D(\u7701\u5185\u5B58)'),s.createElement("div",{className:"dshcs-hint",style:{marginTop:4}},j?"\u5E38\u9A7B\u9762:"+(v.docked?"\u5DF2\u505C\u9760":v.ready?"\u5DF2\u505C\u653E(\u540E\u53F0\u8FD0\u884C\u4E2D)":"\u672A\u542F\u52A8")+(v.degraded?" \xB7 \u672C\u6B21\u53D1\u751F\u8FC7\u964D\u7EA7\u91CD\u8F7D":""):"\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 Element.moveBefore(Chromium <133)\u2192 \u5E38\u9A7B\u4E0D\u53EF\u7528,\u5207\u6807\u7B7E\u4ECD\u4F1A\u6574\u9875\u91CD\u8F7D(\u5347\u7EA7\u6D4F\u89C8\u5668\u540E\u81EA\u52A8\u751F\u6548)"))];return e.seat==="bundle-config"?s.createElement("div",{className:"dshcs-cfgpage","data-code-server-config":"page"},n.writable!==!0?s.createElement("p",{className:"dshcs-cardReadOnly",role:"status"},"\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002"):null,...T,p===!0?s.createElement("p",{className:"dshcs-cardFailed",role:"status"},"\u672C\u90E8\u7F72\u6CA1\u6709\u63A5\u53D7\u8FD9\u4E9B\u503C\uFF0C\u5DF2\u4FDD\u7559\u4F9B\u4F60\u4FEE\u6539\u3002"):null,s.createElement("div",{className:"dshcs-cfgfoot"},s.createElement(Q,{disabled:!S||o,onClick:function(){i(null),f(!1)}},"\u653E\u5F03\u4FEE\u6539"),s.createElement(Q,{variant:"primary",disabled:I,onClick:function(){C()}},o===!0?"\u4FDD\u5B58\u4E2D\u2026":"\u4FDD\u5B58"))):s.createElement(Me,{title:"Code Server",description:"\u5165\u53E3:\u53F3\u4FA7\u680F\u6807\u7B7E(DSH \u2265 0.1.5-alpha.1);\u8BA4\u9886\u7C7B\u578B\u51B3\u5B9A\u54EA\u4E9B\u6587\u4EF6\u4EA4\u7ED9 Code Server \u6253\u5F00",state:U,unsavedLabel:"\u672A\u4FDD\u5B58",readOnlyLabel:"\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002",saveFailedLabel:"\u672C\u90E8\u7F72\u6CA1\u6709\u63A5\u53D7\u8FD9\u4E9B\u503C\uFF0C\u5DF2\u4FDD\u7559\u4F9B\u4F60\u4FEE\u6539\u3002",discardLabel:"\u653E\u5F03\u4FEE\u6539",saveLabel:"\u4FDD\u5B58",savingLabel:"\u4FDD\u5B58\u4E2D\u2026",onSave:C,onDiscard:function(){i(null),f(!1)}},...T)}catch(y){return console.error("[code-server] card render error:",y!=null&&y.message!==void 0?y.message:String(y)),null}}function _r(e){return e!=null&&e.view==="summary"?Er:s.createElement(Pe,Object.assign({},e,{seat:"bundle-config"}))}var Re=900,u={rev:-1,open:!1,mounted:!1,pending:null,el:null,body:null,title:null,timer:null,loading:!1};function Ur(e){if(!(e===null||typeof e!="object")){if(e.type==="ready"){R(!0);return}if(e.type==="ask"&&typeof e.text=="string"){x("/code-server/ask/send",{text:e.text,mode:u.pending===null?void 0:u.pending.mode}).then(function(r){u.rev=-1,R(!0)}).catch(function(){});return}if(e.type==="approve"&&typeof e.id=="string"){x("/code-server/ask/approve",{id:e.id,outcome:e.outcome}).then(function(r){r!=null&&r.ok===!1&&J(r.error||"\u6388\u6743\u63D0\u4EA4\u5931\u8D25"),u.rev=-1,R(!0)}).catch(function(r){J("\u6388\u6743\u63D0\u4EA4\u5931\u8D25:"+String(r&&r.message?r.message:r))});return}e.type==="close"&&_e()}}function R(e){if(u.el!==null){var r=window.__DSHCS_ASK_PUSH__;typeof r=="function"?r(u.pending):e===!0&&setTimeout(function(){R(!1)},120)}}function J(e){console.warn("[code-server] ask dialog:",e)}function _e(){u.open=!1,u.el!==null&&(u.el.style.display="none"),x("/code-server/ask/close",{}).catch(function(){})}function Ue(){if(u.el===null){var e=document.createElement("div");e.className="dshcs-dialog",e.setAttribute("data-dshcs-dialog","ask"),e.style.cssText=["position:fixed","right:24px","bottom:24px","width:460px","height:600px","min-width:320px","min-height:280px","max-width:96vw","max-height:92vh","resize:both","overflow:hidden","display:none","z-index:2147483000","border-radius:10px","box-shadow:0 18px 48px rgba(0,0,0,.45)","border:1px solid var(--dsw-alias-border-l2, rgba(128,128,128,.4))","background:var(--dsw-alias-bg-base, var(--vscode-editor-background, #1e1e1e))"].join(";");var r=document.createElement("div");r.style.cssText="display:flex;align-items:center;gap:8px;padding:6px 10px;cursor:move;border-bottom:1px solid var(--dsw-alias-border-l1, rgba(128,128,128,.3));font:var(--dsw-font-markdown-base, 13px/20px sans-serif)";var n=document.createElement("span");n.textContent="DSH \u5BF9\u8BDD",n.style.cssText="font-weight:600;flex:none";var t=document.createElement("span");t.style.cssText="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-tertiary, rgba(128,128,128,.9));font-size:12px";var a=document.createElement("button");a.type="button",a.textContent="\u2715",a.title="\u5173\u95ED",a.setAttribute("aria-label","\u5173\u95ED"),a.style.cssText="flex:none;border:0;background:transparent;color:inherit;cursor:pointer;font-size:13px;line-height:1;padding:2px 6px;border-radius:4px",a.addEventListener("click",function(){_e()}),r.appendChild(n),r.appendChild(t),r.appendChild(a);var i=document.createElement("div");i.className="dshcs-panel",i.setAttribute("data-dshcs-ask-root",""),i.style.cssText="height:calc(100% - 33px);overflow:hidden",e.appendChild(r),e.appendChild(i),document.body.appendChild(e),u.el=e,u.body=i,u.title=t;var o=null;r.addEventListener("pointerdown",function(c){if(c.target!==a){var p=e.getBoundingClientRect();o={x:c.clientX,y:c.clientY,left:p.left,top:p.top},e.style.right="auto",e.style.bottom="auto",e.style.left=p.left+"px",e.style.top=p.top+"px";try{r.setPointerCapture(c.pointerId)}catch(f){}}}),r.addEventListener("pointermove",function(c){o!==null&&(e.style.left=Math.max(0,Math.min(window.innerWidth-80,o.left+(c.clientX-o.x)))+"px",e.style.top=Math.max(0,Math.min(window.innerHeight-40,o.top+(c.clientY-o.y)))+"px")}),r.addEventListener("pointerup",function(){o=null})}}var He="dshcs.ask.bundle",Hr=900*1e3,O=null;function de(){try{var e=window.sessionStorage.getItem(He);if(e==null)return null;var r=JSON.parse(e);return r==null||typeof r.js!="string"||typeof r.css!="string"||Date.now()-Number(r.at||0)>Hr?null:{css:r.css,js:r.js}}catch(n){return null}}function Fe(e){try{window.sessionStorage.setItem(He,JSON.stringify({at:Date.now(),css:e.css,js:e.js}))}catch(r){}}function Fr(){if(!(O!==null||u.mounted)){var e=de();if(e!==null){O=e;return}x("/code-server/ask/bundle").then(function(r){r==null||r.ok!==!0||(O={css:r.css,js:r.js},Fe(O),console.log("[code-server] ask bundle preloaded ("+Math.round((r.js.length+r.css.length)/1024)+"KB)"))}).catch(function(){})}}function Br(){if(!(u.mounted||u.loading)){u.loading=!0;var e=O!==null?Promise.resolve(O):de()!==null?Promise.resolve(de()):x("/code-server/ask/bundle");e.then(function(r){u.loading=!1;var n=r;if(O===null&&r!=null&&r.ok===!0&&(n={css:r.css,js:r.js},O=n,Fe(n)),n==null||typeof n.js!="string"){J(n!=null&&n.error?n.error:"\u9762\u677F\u4EA7\u7269\u4E0D\u53EF\u7528");return}if(Ue(),document.getElementById("dshcs-ask-style")===null){var t=document.createElement("style");t.id="dshcs-ask-style",t.textContent=n.css,document.head.appendChild(t)}window.__DSHCS_HOST__="dsh",window.__DSHCS_MOUNT__=u.body,window.acquireVsCodeApi=function(){return{postMessage:Ur}};var a=document.createElement("script");a.textContent=n.js,document.head.appendChild(a),u.mounted=!0,setTimeout(function(){R(!0)},60)}).catch(function(r){u.loading=!1,J("\u9762\u677F\u4EA7\u7269\u52A0\u8F7D\u5931\u8D25:"+String(r&&r.message?r.message:r))})}}function je(){x("/code-server/ask/state?rev="+u.rev).then(function(e){e==null||e.ok!==!0||e.changed===!0&&(u.rev=typeof e.rev=="number"?e.rev:-1,u.pending=e,e.open===!0?(Ue(),u.el.style.display="block",u.title!==null&&(u.title.textContent=e.contextText||"\u6765\u81EA\u7F16\u8F91\u5668"),u.open=!0,Br(),u.mounted&&R(!0)):u.el!==null&&(u.el.style.display="none",u.open=!1))}).catch(function(){})}function Wr(){u.timer===null&&(u.timer=setInterval(je,Re),setTimeout(je,800),setTimeout(Fr,3e3),console.log("[code-server] ask dialog poller started (every "+Re+"ms)"))}function Yr(e){try{Gr(e),Wr()}catch(r){console.error("[code-server] apply failed:",r&&r.stack?r.stack:String(r));try{document.title="CS-ERR "+(r&&r.message||String(r))}catch(n){}}}function Gr(e){var r=e.get("slots");if(r===void 0){console.error("[code-server] slots service unavailable");return}var n=e.settingsScope,t=null;if(n!==void 0&&typeof n.bind=="function")t=n.bind({namespace:"code-server"});else{console.error("[code-server] settingsScope unavailable (inject missing?); settings card disabled");return}x("/code-server/status").then(function(d){L({status:d})}).catch(function(){}),r.inject("plugins.bundle.config",()=>r.register({name:"plugins.bundle.config",key:wr,inject:function(){return{scope:t}}},_r)),r.inject("settings.plugin.item",()=>r.register({name:"settings.plugin.item",key:"code-server",label:"Code Server",inject:function(){return{scope:t}}},Pe));var a=!1;function i(d,m){if(!a){a=!0,w();var h=!1;try{h=Mr(d)}catch(k){console.error("[code-server] sidebar tab registration failed:",k!=null&&k.message!=null?k.message:String(k))}P.sidebarUi==="legacy"&&(console.log("[code-server] \u53F3\u4FA7\u680F\u670D\u52A1\u665A\u5230(\u7ECF "+m+"):\u64A4\u9500\u65E7\u7248 DSH \u5224\u5B9A"),x("/code-server/ui-mode",{sidebar:!0}).catch(function(){})),L({sidebarUi:"modern",sidebarRegisterFailed:h!==!0}),r.inject("shell.overlay",()=>r.register({name:"shell.overlay",id:"code-server",order:70,label:"Code Server"},k=>s.createElement(yr,k))),console.log("[code-server] client registered via "+m+": sidebar tab="+h+"(claims dsh-resource://file/**) + resident preload + settings card")}}function o(d){L({sidebarUi:"legacy"}),console.warn("[code-server] \u672A\u63A2\u6D4B\u5230\u53F3\u4FA7\u680F\u670D\u52A1(sidebarRightTabs/sidebarRight): \u672C\u63D2\u4EF6\u81EA 0.2.3 \u8D77\u4E0D\u518D\u517C\u5BB9\u65E7\u7248 DSH \u2014\u2014 \u9664\u300C\u8BBE\u7F6E \u2192 \u63D2\u4EF6 \u2192 Code Server\u300D\u7684\u63D0\u793A\u5916\u4E0D\u63D0\u4F9B\u4EFB\u4F55\u5165\u53E3,\u4E5F\u4E0D\u9884\u70ED IDE\u3002\u8BF7\u5347\u7EA7 DSH\u3002"),d===!0&&x("/code-server/ui-mode",{sidebar:!1}).catch(function(){})}var c=null,p=null,f=null;function w(){c!==null&&(clearTimeout(c),c=null),p!==null&&(clearTimeout(p),p=null),f!==null&&(clearTimeout(f),f=null)}var v=!1;try{typeof e.inject=="function"&&(v=!0,e.inject(["sidebarRightTabs","sidebarRight"],function(d){i(d,"inject")}))}catch(d){console.warn("[code-server] sidebar inject failed:",d!=null&&d.message!=null?d.message:String(d))}var E=typeof e.get=="function"&&e.get("sidebarRightTabs")!==void 0&&e.get("sidebarRight")!==void 0;if(E){f=setTimeout(function(){a||(console.warn("[code-server] ctx.inject \u672A\u5728 1.5s \u5185\u56DE\u8C03,\u6539\u7528\u540C\u6B65\u670D\u52A1\u6CE8\u518C\u4FA7\u680F"),i(e,"sync-fallback"))},Cr);return}if(v!==!0){o(!0);return}c=setTimeout(function(){a||o(!1)},kr),p=setTimeout(function(){a||o(!0)},Sr)}var Xr=["slots","settingsScope"],Qr="code-server";
5
5
  return module.exports;}});
6
6
 
package/lib/index.js CHANGED
@@ -2014,7 +2014,13 @@ export async function apply(ctx, config) {
2014
2014
  since = 0;
2015
2015
  }
2016
2016
  const events = bridgeEvents.since(since);
2017
+ // 取完就清空(事件是提示,取过不必留着 —— 否则客户端重新对齐时会把陈旧提示重放成一片 diff 窗口)。
2018
+ // **注意 `reset()` 不再回退 seq**(0.3.56 修):以前它把 seq 归零,而这里每趟都调 ⇒ 扩展的游标
2019
+ // (单调递增)从此永远大于新 seq,`seq > since` 全被过滤 ⇒ 每个 IDE 会话只送达第一条事件。
2017
2020
  bridgeEvents.reset();
2021
+ // 把当前最大 seq 一并回去:客户端据此自查"我的游标是不是跑到宿主前面去了"(跨版本升级、
2022
+ // 接管了别的宿主留下的游标文件等),发现后退回 since=0 重新对齐,免得永久失聪。
2023
+ const lastSeq = bridgeEvents.lastSeq();
2018
2024
  // 面板声明它要看哪些会话(数组;空 = 关掉了)。据此对齐订阅 + 判断"面板在不在看"
2019
2025
  // (授权拦截只在面板看着的时候才抢答,否则一律交给官方链路)。
2020
2026
  const watch = Array.isArray(body.watch) ? body.watch.filter((id) => typeof id === 'string' && id !== '') : [];
@@ -2062,6 +2068,8 @@ export async function apply(ctx, config) {
2062
2068
  return jsonResponse({
2063
2069
  ok: true,
2064
2070
  events,
2071
+ // 事件序号的高水位:扩展用它自查游标是否超前(超前 ⇒ 退回 since=0 重新对齐,避免永久失聪)。
2072
+ lastSeq,
2065
2073
  // thread 缺省 = 没变化(扩展沿用上一份);threadRev 用来区分"没变化"与"旧宿主没有这个字段"。
2066
2074
  threadRev,
2067
2075
  thread: threadChanged ? snapshot : undefined,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-code-server-app",
3
- "version": "0.3.55",
4
- "description": "VS Code (from a code-server release) inside DSH: a right-sidebar tab driven by the plugin's own launcher over the in-process VS Code server (lib/launcher.mjs). Since 0.3.0 the bundle also ships an editor bridge (assets/extensions/dshcs-editor-bridge): a read-only channel between the in-tree VS Code extension host and DSH, giving the agent what only the editor knows (unsaved buffers, language-server diagnostics, the active selection) and letting editor gestures drive the session. Since 0.3.22 the ask panel renders that session's new content with DSH's own Markdown renderer (pinned to the deployed DSH UI version); since 0.3.23 it is a full-width dialog with collapsible thinking rows and can answer approval requests in place — the bridge's only non-read-only route (POST /approve, constrained to pending in-process requests and the outcomes allowed-once/rejected; panel-first for 5 minutes, handed back to the official card the moment the panel closes). The tab claims DSH file addresses (dsh-resource://file/**) by file type (setting claimExtensions), so the product's own produced-file chips, delivered-file previews and inline prose mentions open in the workbench. The IDE is a resident surface moved with Element.moveBefore instead of being remounted, so switching sidebar tabs no longer reloads it. Opening the tab switches the right sidebar to fullscreen by default (setting fullscreenOnOpen). Following a workspace switch is lightweight: the workbench re-navigates with the new ?folder= and the IDE process is not restarted (since 0.2.12). Requires a DSH with the right-sidebar services (sidebarRightTabs/sidebarRight, >= 0.1.5-alpha.1); older DSH versions get a single upgrade notice on the settings page and no other UI. Two serving modes: loopback port (default) or same-origin mount on DSH's own webServer (/code-server, protected by ctx.connection.requestRejection). Since 0.3.55 the diff the bridge opens always has the real pre-write text on the left, even for files that are not open in the editor: the host reads the execution-local result.value.before in tools/post-execute (the durable tools/result projection deliberately omits value) into a bounded snapshot cache and the extension fetches it by opaque key over the read-only GET /old route; paths are resolved against the session cwd first, so relative file_path arguments are no longer dropped by the editor's workspace check. No code-server Node layer, no argon2, no C++ toolchain.",
3
+ "version": "0.3.57",
4
+ "description": "VS Code (from a code-server release) inside DSH: a right-sidebar tab driven by the plugin's own launcher over the in-process VS Code server (lib/launcher.mjs). Since 0.3.0 the bundle also ships an editor bridge (assets/extensions/dshcs-editor-bridge): a read-only channel between the in-tree VS Code extension host and DSH, giving the agent what only the editor knows (unsaved buffers, language-server diagnostics, the active selection) and letting editor gestures drive the session. Since 0.3.22 the ask panel renders that session's new content with DSH's own Markdown renderer (pinned to the deployed DSH UI version); since 0.3.23 it is a full-width dialog with collapsible thinking rows and can answer approval requests in place — the bridge's only non-read-only route (POST /approve, constrained to pending in-process requests and the outcomes allowed-once/rejected; panel-first for 5 minutes, handed back to the official card the moment the panel closes). The tab claims DSH file addresses (dsh-resource://file/**) by file type (setting claimExtensions), so the product's own produced-file chips, delivered-file previews and inline prose mentions open in the workbench. The IDE is a resident surface moved with Element.moveBefore instead of being remounted, so switching sidebar tabs no longer reloads it. Opening the tab switches the right sidebar to fullscreen by default (setting fullscreenOnOpen). Following a workspace switch is lightweight: the workbench re-navigates with the new ?folder= and the IDE process is not restarted (since 0.2.12). Requires a DSH with the right-sidebar services (sidebarRightTabs/sidebarRight, >= 0.1.5-alpha.1); older DSH versions get a single upgrade notice on the settings page and no other UI. Two serving modes: loopback port (default) or same-origin mount on DSH's own webServer (/code-server, protected by ctx.connection.requestRejection). Since 0.3.55 the diff the bridge opens always has the real pre-write text on the left, even for files that are not open in the editor: the host reads the execution-local result.value.before in tools/post-execute (the durable tools/result projection deliberately omits value) into a bounded snapshot cache and the extension fetches it by opaque key over the read-only GET /old route; paths are resolved against the session cwd first, so relative file_path arguments are no longer dropped by the editor's workspace check. Since 0.3.56 the bridge actually delivers every diff: the event ring's sequence is monotonic for the lifetime of a host process (0.3.9-0.3.55 rewound it after every /sync, so at most one agent-edit per IDE session was ever delivered), /sync returns lastSeq, and the extension re-aligns its cursor by itself when it notices it ran ahead. No code-server Node layer, no argon2, no C++ toolchain.",
5
5
  "homepage": "https://github.com/jinsiyu/dsh-code-server-app",
6
6
  "repository": {
7
7
  "type": "git",
@@ -192,6 +192,7 @@
192
192
  "test:workspace-switch": "node scripts/test-workspace-switch.mjs",
193
193
  "test:workspace-cwd": "node scripts/test-workspace-cwd.mjs",
194
194
  "test:client-cwd": "node scripts/test-client-bundle-cwd.mjs",
195
+ "test:client-tabs": "node scripts/test-client-bundle-tabs.mjs",
195
196
  "test:client-seat": "node scripts/test-client-settings-seat.mjs",
196
197
  "test:dsh-resolve": "node scripts/test-dsh-resolve.mjs",
197
198
  "test:child-node": "node scripts/test-child-node.mjs",
@@ -3,7 +3,7 @@
3
3
  "vscodeVersion": "1.137.0",
4
4
  "productPath": "stable-b11dabdaca0d3369986975be285db92c8795cea5",
5
5
  "layout": "vscode-only",
6
- "preparedAt": "2026-09-19T09:11:10.218Z",
6
+ "preparedAt": "2026-09-19T12:45:33.503Z",
7
7
  "source": "registry",
8
8
  "node": "v24.20.0",
9
9
  "platform": "linux",