dsh-dock 0.21.2 → 0.23.1

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/client.js CHANGED
@@ -2126,7 +2126,7 @@ __export(client_exports, {
2126
2126
  inject: () => inject
2127
2127
  });
2128
2128
  module.exports = __toCommonJS(client_exports);
2129
- var import_react24 = __toESM(require("react"), 1);
2129
+ var import_react22 = __toESM(require("react"), 1);
2130
2130
 
2131
2131
  // src/shared.js
2132
2132
  var import_react = __toESM(require("react"), 1);
@@ -2319,6 +2319,7 @@ function taskActivityAt(task) {
2319
2319
  }
2320
2320
  function taskBusy(task, now, capMs) {
2321
2321
  if (!task) return false;
2322
+ if (task.ptcProgram === true) return true;
2322
2323
  const at = typeof now === "number" ? now : Date.now();
2323
2324
  const cap = typeof capMs === "number" && capMs > 0 ? capMs : TASK_BUSY_MS;
2324
2325
  if (task.compacting === true) {
@@ -2418,6 +2419,10 @@ function hourOf(ts) {
2418
2419
  var EXPORT_COLUMNS = [
2419
2420
  ["\u65F6\u95F4", (r) => fmtTime(r.time)],
2420
2421
  ["\u4F1A\u8BDDID", (r) => r.sessionId || ""],
2422
+ ["\u76F4\u63A5\u7236\u4F1A\u8BDDID", (r) => r.parentSessionId || ""],
2423
+ ["\u6839\u4F1A\u8BDDID", (r) => r.rootSessionId || r.sessionId || ""],
2424
+ ["\u4F1A\u8BDD\u5C42\u7EA7", (r) => String(r.sessionDepth || 0)],
2425
+ ["\u4F1A\u8BDD\u7C7B\u578B", (r) => r.isSubtask ? "\u5B50\u4EFB\u52A1" : "\u4E3B\u4F1A\u8BDD"],
2421
2426
  ["\u63D0\u4F9B\u5546", (r) => r.provider || "\u2014"],
2422
2427
  ["\u6A21\u578B", (r) => r.model || "\u2014"],
2423
2428
  ["\u8F93\u5165(\u547D\u4E2D)", (r) => fmtNum(r.cacheReadTokens)],
@@ -2461,7 +2466,7 @@ function buildExportCsv(rows, rate) {
2461
2466
  return lines.join("\r\n");
2462
2467
  }
2463
2468
  var STORE_KEY = "dsh-dock/tokenlog/filters/v1";
2464
- var FILTER_FIELDS = ["fromStr", "toStr", "provider", "model", "status", "effort", "sessionId", "dim"];
2469
+ var FILTER_FIELDS = ["fromStr", "toStr", "provider", "model", "status", "effort", "sessionId", "sessionScope", "dim"];
2465
2470
  function loadSavedFilters() {
2466
2471
  try {
2467
2472
  if (typeof localStorage === "undefined") return null;
@@ -2488,6 +2493,9 @@ function shortId(sid) {
2488
2493
  if (sid.length <= 16) return sid;
2489
2494
  return sid.slice(0, 8) + "\u2026" + sid.slice(-6);
2490
2495
  }
2496
+ function sessionType(r) {
2497
+ return r && r.isSubtask ? "\u5B50\u4EFB\u52A1" : "\u4E3B\u4F1A\u8BDD";
2498
+ }
2491
2499
  function statusInfo(r) {
2492
2500
  if (r.status === "completed") return { code: 200, label: "200", cls: "ok", title: "\u6210\u529F" };
2493
2501
  if (r.status === "max-tokens") return { code: 200, label: "200", cls: "warn", title: "\u5B8C\u6210(\u8FBE\u5230\u8F93\u51FA\u4E0A\u9650)" };
@@ -2723,6 +2731,9 @@ var css = `
2723
2731
  .dtok-empty{text-align:center;color:var(--dsw-alias-label-secondary);padding:32px 0;font-size:13px;}
2724
2732
  .dtok-sid{color:var(--dk-accent);cursor:pointer;text-decoration:underline dotted;}
2725
2733
  .dtok-sid:hover{filter:brightness(1.25);}
2734
+ .dtok-scope-note{font-size:12px;color:var(--dsw-alias-label-secondary);padding:7px 10px;border-left:3px solid var(--dk-accent);background:var(--dsw-alias-bg-layer-1);border-radius:4px;line-height:1.5;}
2735
+ .dtok-session-kind{display:inline-block;margin-left:5px;padding:1px 5px;border-radius:4px;font-size:10px;color:var(--dk-accent);background:rgb(96 165 250 / .12);vertical-align:middle;}
2736
+ .dtok-session-tree{font-family:ui-monospace,monospace;}
2726
2737
  .dtok-code{font-weight:700;font-family:ui-monospace,monospace;}
2727
2738
  .dtok-code.ok{color:var(--dsw-alias-state-success-primary,#4ade80);}
2728
2739
  .dtok-code.warn{color:var(--dk-warn);}
@@ -2863,6 +2874,10 @@ function Detail({ rec, onClose, rate }) {
2863
2874
  const rateCny = Number(rate) > 0 ? Number(rate) : 7.2;
2864
2875
  const rows = [
2865
2876
  ["\u4F1A\u8BDD ID", rec.sessionId],
2877
+ ["\u4F1A\u8BDD\u7C7B\u578B", sessionType(rec)],
2878
+ ["\u76F4\u63A5\u7236\u4F1A\u8BDD ID", rec.parentSessionId || "\u2014"],
2879
+ ["\u6839\u4F1A\u8BDD ID", rec.rootSessionId || rec.sessionId],
2880
+ ["\u4F1A\u8BDD\u5C42\u7EA7", String(rec.sessionDepth || 0)],
2866
2881
  ["\u65F6\u95F4", fmtTime(rec.time)],
2867
2882
  ["\u63D0\u4F9B\u5546", rec.provider],
2868
2883
  ["\u6A21\u578B", rec.model],
@@ -3310,6 +3325,8 @@ function TokenLogView(props) {
3310
3325
  const [status, setStatus] = (0, import_react2.useState)(() => savedFilters && savedFilters.status || "");
3311
3326
  const [effort, setEffort] = (0, import_react2.useState)(() => savedFilters && savedFilters.effort || "");
3312
3327
  const [sessionId, setSessionId] = (0, import_react2.useState)(() => navSession || savedFilters && savedFilters.sessionId || "");
3328
+ const [sessionScope, setSessionScope] = (0, import_react2.useState)(() => savedFilters && savedFilters.sessionScope || "tree");
3329
+ const scopeTouchedRef = (0, import_react2.useRef)(!!(savedFilters && savedFilters.sessionScope));
3313
3330
  const [dim, setDim] = (0, import_react2.useState)(() => savedFilters && savedFilters.dim || "");
3314
3331
  const [sortKey, setSortKey] = (0, import_react2.useState)("time");
3315
3332
  const [sortDir, setSortDir] = (0, import_react2.useState)("desc");
@@ -3335,8 +3352,8 @@ function TokenLogView(props) {
3335
3352
  }, [fetchedAt]);
3336
3353
  const pageSize = 100;
3337
3354
  (0, import_react2.useEffect)(() => {
3338
- saveFilters({ fromStr, toStr, provider, model, status, effort, sessionId, dim });
3339
- }, [fromStr, toStr, provider, model, status, effort, sessionId, dim]);
3355
+ saveFilters({ fromStr, toStr, provider, model, status, effort, sessionId, sessionScope, dim });
3356
+ }, [fromStr, toStr, provider, model, status, effort, sessionId, sessionScope, dim]);
3340
3357
  (0, import_react2.useEffect)(() => {
3341
3358
  let cancel = false;
3342
3359
  setLoading(true);
@@ -3350,12 +3367,14 @@ function TokenLogView(props) {
3350
3367
  if (savedFilters.status) q.status = savedFilters.status;
3351
3368
  if (savedFilters.effort) q.effort = savedFilters.effort;
3352
3369
  if (savedFilters.sessionId) q.sessionId = savedFilters.sessionId;
3370
+ if (savedFilters.sessionScope) q.sessionScope = savedFilters.sessionScope;
3353
3371
  if (savedFilters.dim) q.dim = savedFilters.dim;
3354
3372
  }
3355
3373
  if (navSession) q.sessionId = navSession;
3356
3374
  rpcCall("scan", {}).then(() => cancel ? null : rpcCall("query", q)).then((d) => {
3357
3375
  if (cancel) return;
3358
3376
  setData(d);
3377
+ if (!scopeTouchedRef.current && d && (d.defaultSessionScope === "tree" || d.defaultSessionScope === "session")) setSessionScope(d.defaultSessionScope);
3359
3378
  }).catch((e) => {
3360
3379
  if (!cancel) setErr(String(e && e.message || e));
3361
3380
  }).finally(() => {
@@ -3374,10 +3393,11 @@ function TokenLogView(props) {
3374
3393
  if (status) q.status = status;
3375
3394
  if (effort) q.effort = effort;
3376
3395
  if (sessionId) q.sessionId = sessionId;
3396
+ if (sessionId) q.sessionScope = sessionScope;
3377
3397
  const dimNow = dimOverride !== void 0 ? dimOverride : dim;
3378
3398
  if (withDim && dimNow) q.dim = dimNow;
3379
3399
  return q;
3380
- }, [fromStr, toStr, provider, model, status, effort, sessionId, dim]);
3400
+ }, [fromStr, toStr, provider, model, status, effort, sessionId, sessionScope, dim]);
3381
3401
  const runQuery = (0, import_react2.useCallback)((dimOverride) => {
3382
3402
  setLoading(true);
3383
3403
  setErr("");
@@ -3387,17 +3407,19 @@ function TokenLogView(props) {
3387
3407
  }).catch((e) => setErr(String(e && e.message || e))).finally(() => setLoading(false));
3388
3408
  }, [buildQ]);
3389
3409
  const navAppliedRef = (0, import_react2.useRef)(navAt);
3410
+ const lastNavSessionRef = (0, import_react2.useRef)(navSession);
3390
3411
  (0, import_react2.useEffect)(() => {
3391
- if (!navSession || navAppliedRef.current === navAt) return;
3412
+ if (!navSession || navAppliedRef.current === navAt && lastNavSessionRef.current === navSession) return;
3392
3413
  navAppliedRef.current = navAt;
3414
+ lastNavSessionRef.current = navSession;
3393
3415
  setSessionId(navSession);
3394
3416
  setLoading(true);
3395
3417
  setErr("");
3396
- rpcCall("query", Object.assign({}, buildQ(true), { sessionId: navSession })).then((d) => {
3418
+ rpcCall("query", Object.assign({}, buildQ(true), { sessionId: navSession, sessionScope })).then((d) => {
3397
3419
  setData(d);
3398
3420
  setPage(0);
3399
3421
  }).catch((e) => setErr(String(e && e.message || e))).finally(() => setLoading(false));
3400
- }, [navAt]);
3422
+ }, [navAt, navSession]);
3401
3423
  const rateCny = data && data.rateUsdCny || 7.2;
3402
3424
  const resetFilters = (0, import_react2.useCallback)(() => {
3403
3425
  setFromStr("");
@@ -3407,7 +3429,9 @@ function TokenLogView(props) {
3407
3429
  setStatus("");
3408
3430
  setEffort("");
3409
3431
  setSessionId("");
3432
+ setSessionScope("tree");
3410
3433
  setDim("");
3434
+ scopeTouchedRef.current = false;
3411
3435
  setLoading(true);
3412
3436
  setErr("");
3413
3437
  rpcCall("query", {}).then((d) => {
@@ -3446,6 +3470,14 @@ function TokenLogView(props) {
3446
3470
  }, [sortKey, sortDir]);
3447
3471
  const records = data && data.records || [];
3448
3472
  const totals = data && data.totals;
3473
+ const scopeInfo = data && data.sessionScope;
3474
+ const directTotals = data && data.directTotals;
3475
+ const breakdown = data && data.sessionBreakdown || [];
3476
+ const childTotals = scopeInfo && scopeInfo.scope === "tree" ? {
3477
+ calls: Math.max(0, (totals && totals.calls || 0) - (directTotals && directTotals.calls || 0)),
3478
+ totalTokens: Math.max(0, (totals && totals.totalTokens || 0) - (directTotals && directTotals.totalTokens || 0)),
3479
+ cost: Math.max(0, (totals && totals.cost || 0) - (directTotals && directTotals.cost || 0))
3480
+ } : null;
3449
3481
  const sessionIds = data && data.sessionIds || [];
3450
3482
  const sorted = (0, import_react2.useMemo)(() => {
3451
3483
  const arr = records.slice();
@@ -3466,16 +3498,28 @@ function TokenLogView(props) {
3466
3498
  const pageRows = sorted.slice(pageSafe * pageSize, (pageSafe + 1) * pageSize);
3467
3499
  const cards = totals ? [
3468
3500
  { v: fmtNum(totals.calls), l: "\u8C03\u7528\u6B21\u6570" },
3469
- { v: fmtCompact(totals.totalTokens), l: "\u603B Token" },
3501
+ { v: fmtCompact(totals.totalTokens), l: scopeInfo && scopeInfo.scope === "tree" ? "\u7D2F\u8BA1 Token\uFF08\u542B\u5B50\u4EFB\u52A1\uFF09" : "\u603B Token" },
3470
3502
  { v: fmtCompact(totals.cacheReadTokens), l: "\u8F93\u5165(\u547D\u4E2D)" },
3471
3503
  { v: fmtCompact(totals.inputTokens), l: "\u8F93\u5165(\u672A\u547D\u4E2D)" },
3472
3504
  { v: totals.cacheHitPct + "%", l: "\u7F13\u5B58\u547D\u4E2D\u7387" },
3473
3505
  { v: fmtCompact(totals.outputTokens), l: "\u8F93\u51FA" },
3474
- { v: fmtCostCny(totals.cost, rateCny), l: "\u6D88\u8017\u91D1\u989D(\u4F30\u7B97\xB7\u4EBA\u6C11\u5E01)" },
3506
+ { v: fmtCostCny(totals.cost, rateCny), l: (scopeInfo && scopeInfo.scope === "tree" ? "\u7D2F\u8BA1\u91D1\u989D" : "\u6D88\u8017\u91D1\u989D") + "(\u4F30\u7B97\xB7\u4EBA\u6C11\u5E01)" },
3475
3507
  { v: fmtDuration(totals.llmMs), l: "\u7D2F\u8BA1\u8017\u65F6" + (totals.timed ? " (" + totals.timed + "\u6B65)" : "") }
3476
3508
  ] : [];
3477
3509
  const opts = (arr) => (arr || []).map((x) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: x, children: x || "(\u7A7A)" }, x || "(none)"));
3478
3510
  const modelChoices = provider && data && data.modelsByProvider ? data.modelsByProvider[provider] || [] : data && data.models || [];
3511
+ const changeScope = (next) => {
3512
+ scopeTouchedRef.current = true;
3513
+ setSessionScope(next);
3514
+ setLoading(true);
3515
+ setErr("");
3516
+ rpcCall("config", { sessionScope: next }).catch((e) => {
3517
+ setErr(String(e && e.message || e));
3518
+ }).then(() => rpcCall("query", Object.assign({}, buildQ(true), { sessionScope: next }))).then((d) => {
3519
+ setData(d);
3520
+ setPage(0);
3521
+ }).catch((e) => setErr(String(e && e.message || e))).finally(() => setLoading(false));
3522
+ };
3479
3523
  const summaryRows = (data && data.summary || []).map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
3480
3524
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: r.key }),
3481
3525
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtNum(r.calls) }),
@@ -3495,10 +3539,18 @@ function TokenLogView(props) {
3495
3539
  const st = statusInfo(r);
3496
3540
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
3497
3541
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtTime(r.time) }),
3498
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dtok-sid", title: "\u70B9\u51FB\u6309\u6B64\u4F1A\u8BDD\u7B5B\u9009", onClick: () => {
3499
- setSessionId(r.sessionId);
3500
- runQuery();
3501
- }, children: shortId(r.sessionId) }) }),
3542
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { children: [
3543
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dtok-sid", title: "\u4F1A\u8BDD\uFF1A" + r.sessionId + (r.parentSessionId ? "\n\u76F4\u63A5\u7236\u4F1A\u8BDD\uFF1A" + r.parentSessionId : "") + "\n\u70B9\u51FB\u6309\u6B64\u4F1A\u8BDD\u7B5B\u9009", onClick: () => {
3544
+ setSessionId(r.sessionId);
3545
+ setLoading(true);
3546
+ setErr("");
3547
+ rpcCall("query", Object.assign({}, buildQ(true), { sessionId: r.sessionId })).then((d) => {
3548
+ setData(d);
3549
+ setPage(0);
3550
+ }).catch((e) => setErr(String(e && e.message || e))).finally(() => setLoading(false));
3551
+ }, children: shortId(r.sessionId) }),
3552
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dtok-session-kind", children: sessionType(r) })
3553
+ ] }),
3502
3554
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: r.provider || "\u2014" }),
3503
3555
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: r.model || "\u2014" }),
3504
3556
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtNum(r.cacheReadTokens) }),
@@ -3538,6 +3590,14 @@ function TokenLogView(props) {
3538
3590
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChartsPanel, { records, rate: rateCny }, "charts-" + fetchedAt)
3539
3591
  );
3540
3592
  } else {
3593
+ if (scopeInfo && scopeInfo.sessionId) bodyNodes.push(
3594
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dtok-scope-note", children: [
3595
+ scopeInfo.scope === "tree" ? "\u4EFB\u52A1\u7D2F\u8BA1 = \u672C\u4F1A\u8BDD + \u5168\u90E8\u540E\u4EE3\u5B50\u4EFB\u52A1\uFF1B\u6309\u5B9E\u9645\u8C03\u7528 ID \u53BB\u91CD\uFF0C\u5B50\u4EFB\u52A1\u7EE7\u627F\u7684\u5386\u53F2\u4E0D\u4F1A\u91CD\u590D\u8BA1\u7B97\u3002" : "\u4EC5\u7EDF\u8BA1\u5F53\u524D\u4F1A\u8BDD\u81EA\u5DF1\u7684\u8C03\u7528\uFF0C\u4E0D\u5305\u542B\u6D3E\u53D1\u7684\u5B50\u4EFB\u52A1\u3002",
3596
+ " \u672C\u4F1A\u8BDD " + fmtCompact(directTotals && directTotals.totalTokens || 0) + " Token",
3597
+ childTotals ? " \xB7 \u5B50\u4EFB\u52A1 " + fmtCompact(childTotals.totalTokens) + " Token / " + fmtCostCny(childTotals.cost, rateCny) + "\uFF08" + scopeInfo.descendantCount + " \u4E2A\u4F1A\u8BDD\uFF09" : "",
3598
+ scopeInfo.complete === false ? " \xB7 \u8C31\u7CFB\u90E8\u5206\u7F3A\u5931\uFF0C\u4EC5\u7D2F\u8BA1\u5DF2\u77E5\u4F1A\u8BDD" : ""
3599
+ ] }, "scope-note")
3600
+ );
3541
3601
  if (cards.length) bodyNodes.push(
3542
3602
  // key 带 fetchedAt:每次「手动查询 / 首次加载」拿到新数据时重建一次,KPI 卡重播回弹动画
3543
3603
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dtok-cards" + (fetchedAt ? " dtok-pop" : ""), children: cards.map((c, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dtok-card", style: { "--i": String(i) }, children: [
@@ -3545,6 +3605,32 @@ function TokenLogView(props) {
3545
3605
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "l", children: c.l })
3546
3606
  ] }, c.l)) }, "cards-" + fetchedAt)
3547
3607
  );
3608
+ if (breakdown.length) bodyNodes.push(
3609
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dtok-section-title", children: [
3610
+ "\u4F1A\u8BDD\u7528\u91CF\u62C6\u5206\uFF08",
3611
+ breakdown.length,
3612
+ " \u4E2A\u6709\u7528\u91CF\u7684\u4F1A\u8BDD\uFF09"
3613
+ ] }, "session-sum"),
3614
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "dtok-table-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", { className: "dtok-table", children: [
3615
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
3616
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u4F1A\u8BDD" }),
3617
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u7C7B\u578B" }),
3618
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u8C03\u7528" }),
3619
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u603B Token" }),
3620
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "\u91D1\u989D\uFF08\u4EBA\u6C11\u5E01\uFF09" })
3621
+ ] }) }),
3622
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: breakdown.map((r) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
3623
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("td", { className: "dtok-session-tree", title: "\u4F1A\u8BDD\uFF1A" + r.sessionId + (r.parentSessionId ? "\n\u76F4\u63A5\u7236\u4F1A\u8BDD\uFF1A" + r.parentSessionId : ""), children: [
3624
+ r.sessionDepth ? "\u2514 ".repeat(Math.min(r.sessionDepth, 4)) : "",
3625
+ shortId(r.sessionId)
3626
+ ] }),
3627
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: r.sessionId === scopeInfo.sessionId ? "\u5F53\u524D\u4F1A\u8BDD" : sessionType(r) }),
3628
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtNum(r.calls) }),
3629
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtCompact(r.totalTokens) }),
3630
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: fmtCostCny(r.cost, rateCny) })
3631
+ ] }, r.sessionId)) })
3632
+ ] }) }, "session-sum-table")
3633
+ );
3548
3634
  if (summaryRows.length) bodyNodes.push(
3549
3635
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "dtok-section-title", children: [
3550
3636
  "\u7EDF\u8BA1\u5206\u7EC4: ",
@@ -3641,6 +3727,13 @@ function TokenLogView(props) {
3641
3727
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "", children: "\u5168\u90E8" }),
3642
3728
  opts(sessionIds)
3643
3729
  ] }),
3730
+ sessionId ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
3731
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { children: "\u4F1A\u8BDD\u53E3\u5F84" }),
3732
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { className: "dtok-select", value: sessionScope, "aria-label": "\u4F1A\u8BDD\u7528\u91CF\u53E3\u5F84", onChange: (e) => changeScope(e.target.value), children: [
3733
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "tree", children: "\u4EFB\u52A1\u7D2F\u8BA1\uFF08\u542B\u5B50\u4EFB\u52A1\uFF09" }),
3734
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "session", children: "\u4EC5\u672C\u4F1A\u8BDD" })
3735
+ ] })
3736
+ ] }) : null,
3644
3737
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { children: "\u63D0\u4F9B\u5546" }),
3645
3738
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { className: "dtok-select", value: provider, onChange: (e) => {
3646
3739
  setProvider(e.target.value);
@@ -3720,7 +3813,7 @@ function TokenLogHomeStat() {
3720
3813
  }
3721
3814
  function TokenLogChip(props) {
3722
3815
  const sid = props && props.sessionId || props && props.session && props.session.sessionId || null;
3723
- const [snap, setSnap] = (0, import_react2.useState)({ totals: null, rate: 7.2, err: "" });
3816
+ const [snap, setSnap] = (0, import_react2.useState)({ totals: null, directTotals: null, scope: null, rate: 7.2, err: "" });
3724
3817
  (0, import_react2.useEffect)(() => {
3725
3818
  if (!sid) return;
3726
3819
  let cancel = false;
@@ -3728,9 +3821,9 @@ function TokenLogChip(props) {
3728
3821
  const load = () => {
3729
3822
  if (cancel || isTokenlogRouteGone()) return null;
3730
3823
  return rpcCall("query", { sessionId: sid }).then((d) => {
3731
- if (!cancel) setSnap({ totals: d && d.totals, rate: d && d.rateUsdCny || 7.2, err: "" });
3824
+ if (!cancel) setSnap({ totals: d && d.totals, directTotals: d && d.directTotals, scope: d && d.sessionScope, rate: d && d.rateUsdCny || 7.2, err: "" });
3732
3825
  }).catch((e) => {
3733
- if (!cancel) setSnap((s) => ({ totals: s.totals, rate: s.rate, err: String(e && e.message || e) }));
3826
+ if (!cancel) setSnap((s) => ({ ...s, err: String(e && e.message || e) }));
3734
3827
  });
3735
3828
  };
3736
3829
  load();
@@ -3742,19 +3835,23 @@ function TokenLogChip(props) {
3742
3835
  }, [sid]);
3743
3836
  if (!sid) return null;
3744
3837
  const t = snap.totals;
3838
+ const cumulative = snap.scope && snap.scope.scope === "tree";
3839
+ const own = snap.directTotals;
3840
+ const childTokens = cumulative ? Math.max(0, (t && t.totalTokens || 0) - (own && own.totalTokens || 0)) : 0;
3841
+ const childCost = cumulative ? Math.max(0, (t && t.cost || 0) - (own && own.cost || 0)) : 0;
3745
3842
  const gone = isTokenlogRouteGone();
3746
3843
  const hasData = !!t && !gone && !(snap.err && !t);
3747
3844
  const labelIcon = hasData ? "\u26C1 " : "";
3748
3845
  const labelMain = gone ? "\u7528\u91CF\xB7\u672A\u542F\u7528" : snap.err && !t ? snap.err.includes("\u91CD\u542F") || snap.err.includes("\u542F\u7528") ? "\u7528\u91CF\xB7\u672A\u542F\u7528" : "\u7528\u91CF\xB7\u5931\u8D25" : t ? fmtCompact(t.totalTokens) : "\u2026";
3749
3846
  const labelExtra = hasData && t.cost > 0 ? " \xB7 " + fmtCostCny(t.cost, snap.rate) : "";
3750
- const title = gone ? routeGoneMessage() + "\n\uFF08\u53EF\u5728\u529F\u80FD\u575E\u91CC\u542F\u7528\u300C\u7528\u91CF\u8BB0\u5F55\u300D\uFF09" : t ? "\u672C\u4F1A\u8BDD " + fmtNum(t.calls) + " \u6B21\u8C03\u7528 \xB7 " + fmtNum(t.totalTokens) + " Token \xB7 " + fmtCostCny(t.cost, snap.rate) + "\uFF08\u4F30\u7B97\uFF09\n\u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u7528\u91CF\u8BB0\u5F55" : (snap.err ? snap.err + "\n" : "") + "\u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u7528\u91CF\u8BB0\u5F55";
3847
+ const title = gone ? routeGoneMessage() + "\n\uFF08\u53EF\u5728\u529F\u80FD\u575E\u91CC\u542F\u7528\u300C\u7528\u91CF\u8BB0\u5F55\u300D\uFF09" : t ? (cumulative ? "\u4EFB\u52A1\u7D2F\u8BA1\uFF08\u542B\u5B50\u4EFB\u52A1\uFF09" : "\u4EC5\u672C\u4F1A\u8BDD") + " " + fmtNum(t.calls) + " \u6B21\u8C03\u7528 \xB7 " + fmtNum(t.totalTokens) + " Token \xB7 " + fmtCostCny(t.cost, snap.rate) + "\uFF08\u4F30\u7B97\uFF09" + (cumulative ? "\n\u672C\u4F1A\u8BDD " + fmtCompact(own && own.totalTokens || 0) + " Token / " + fmtCostCny(own && own.cost || 0, snap.rate) + " \xB7 \u5B50\u4EFB\u52A1 " + fmtCompact(childTokens) + " Token / " + fmtCostCny(childCost, snap.rate) + "\uFF08" + snap.scope.descendantCount + " \u4E2A\u4F1A\u8BDD\uFF09" : "") + (cumulative && snap.scope.complete === false ? "\n\u8C31\u7CFB\u90E8\u5206\u7F3A\u5931\uFF0C\u4EC5\u7D2F\u8BA1\u5DF2\u77E5\u4F1A\u8BDD" : "") + "\n\u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u7528\u91CF\u8BB0\u5F55" : (snap.err ? snap.err + "\n" : "") + "\u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u7528\u91CF\u8BB0\u5F55";
3751
3848
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
3752
3849
  "button",
3753
3850
  {
3754
3851
  type: "button",
3755
3852
  className: "dockchip" + (snap.err && !t && !gone ? " err" : ""),
3756
3853
  title,
3757
- "aria-label": "\u4F1A\u8BDD\u7528\u91CF",
3854
+ "aria-label": cumulative ? "\u4EFB\u52A1\u7D2F\u8BA1\u7528\u91CF\uFF08\u542B\u5B50\u4EFB\u52A1\uFF09" : "\u672C\u4F1A\u8BDD\u7528\u91CF",
3758
3855
  onClick: () => openPanel("tokenlog", { sessionId: sid, navAt: Date.now() }),
3759
3856
  children: [
3760
3857
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-svg", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { viewBox: "0 0 16 16", width: "13", height: "13", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", children: [
@@ -3764,7 +3861,7 @@ function TokenLogChip(props) {
3764
3861
  ] }) }),
3765
3862
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-dot", style: { background: gone ? "var(--dsw-alias-label-tertiary,#8b95ab)" : "var(--dk-warn)" } }),
3766
3863
  labelIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-ic", children: labelIcon }) : null,
3767
- hasData ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-pre-s", children: "\u7528\u91CF " }) : null,
3864
+ hasData ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-pre-s", children: cumulative ? "\u7D2F\u8BA1 " : "\u7528\u91CF " }) : null,
3768
3865
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-val", children: labelMain }),
3769
3866
  labelExtra ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "dockchip-x", children: labelExtra }) : null
3770
3867
  ]
@@ -3776,7 +3873,7 @@ var feature = {
3776
3873
  name: "\u7528\u91CF\u8BB0\u5F55",
3777
3874
  order: 110,
3778
3875
  accent: "#fbbf24",
3779
- description: "\u8BB0\u5F55\u5168\u90E8 LLM API \u8C03\u7528\uFF1A\u79D2\u7EA7\u65F6\u95F4\u7B5B\u9009\u3001Token/\u8D39\u7528\u7EDF\u8BA1\uFF08\u53EF\u914D\u7F6E\u5404\u6A21\u578B\u5355\u4EF7\uFF0C\u6301\u4E45\u4FDD\u5B58\u5E76\u6309\u81EA\u586B\u5355\u4EF7\u8BA1\u8D39\uFF1B\u591A\u6BB5\u5206\u65F6\u4EF7\u53EF\u9650\u5B9A\u5DE5\u4F5C\u65E5/\u5468\u672B\u8282\u5047\u65E5\uFF0C\u5185\u7F6E\u5CF0\u8C37\u8BA1\u4EF7+\u5B98\u7F51\u4EF7\u76EE\u81EA\u52A8\u540C\u6B65\u4F5C\u515C\u5E95\uFF09\u3001\u5206\u7EC4\u6C47\u603B\u3001\u660E\u7EC6\u68C0\u7D22\u4E0E CSV \u5BFC\u51FA",
3876
+ description: "\u8BB0\u5F55\u5168\u90E8 LLM API \u8C03\u7528\uFF1A\u79D2\u7EA7\u7B5B\u9009\u3001\u4E3B\u4EFB\u52A1+\u540E\u4EE3\u5B50\u4EFB\u52A1\u7D2F\u8BA1/\u4EC5\u672C\u4F1A\u8BDD\u5207\u6362\u3001\u4F1A\u8BDD\u7528\u91CF\u62C6\u5206\u3001Token/\u8D39\u7528\u7EDF\u8BA1\uFF08\u81EA\u5B9A\u4E49\u5355\u4EF7\u4E0E\u5CF0\u8C37\u4EF7\uFF09\u3001\u5206\u7EC4\u6C47\u603B\u3001\u660E\u7EC6\u68C0\u7D22\u4E0E CSV \u5BFC\u51FA",
3780
3877
  css,
3781
3878
  View: TokenLogView,
3782
3879
  HomeStat: TokenLogHomeStat,
@@ -4344,10 +4441,10 @@ function ModelsStat() {
4344
4441
  }
4345
4442
  var feature2 = {
4346
4443
  id: "modelconfig",
4347
- name: "\u6A21\u578B\u8BBE\u7F6E",
4444
+ name: "\u6A21\u578B\u80FD\u529B",
4348
4445
  order: 100,
4349
4446
  accent: "#22d3ee",
4350
- description: "\u7F16\u8F91\u5404 Provider \u6A21\u578B\u7684\u8F93\u5165\u7C7B\u578B\u4E0E\u601D\u8003\u5F3A\u5EA6\u6863\u4F4D\uFF0C\u5199\u56DE\u5B98\u65B9\u914D\u7F6E\u70ED\u751F\u6548\uFF1BProvider \u81EA\u8EAB\u7684\u589E\u5220\u6539\u5728\u300C\u6A21\u578B\u63D0\u4F9B\u5546\u300D\u91CC\u7BA1\u7406",
4447
+ description: "\u7F16\u8F91\u5404 Provider \u6A21\u578B\u7684\u8F93\u5165\u7C7B\u578B\u4E0E\u601D\u8003\u5F3A\u5EA6\u6863\u4F4D\uFF0C\u5199\u56DE\u5B98\u65B9\u914D\u7F6E\u70ED\u751F\u6548\uFF1BProvider \u81EA\u8EAB\u7684\u589E\u5220\u6539\u5728\u300C\u6A21\u578B\u7BA1\u7406\u300D\u91CC\u7BA1\u7406",
4351
4448
  css: [
4352
4449
  ".dkm-note{color:var(--dsw-alias-label-secondary);font-size:12px;}",
4353
4450
  ".dkm-warn{color:var(--dk-warn);}",
@@ -4883,11 +4980,11 @@ function ProvidersView(props) {
4883
4980
  );
4884
4981
  const piProviders = providers.filter((p) => p.kind === "pi-ai");
4885
4982
  const body = [
4886
- import_react4.default.createElement("h2", { key: "title", className: "dkp-title" }, "\u6A21\u578B\u63D0\u4F9B\u5546"),
4983
+ import_react4.default.createElement("h2", { key: "title", className: "dkp-title" }, "\u6A21\u578B\u7BA1\u7406"),
4887
4984
  import_react4.default.createElement(
4888
4985
  "p",
4889
4986
  { key: "intro", className: "dkp-intro" },
4890
- "\u65B0\u589E / \u7F16\u8F91 / \u5220\u9664\u81EA\u5B9A\u4E49\u6A21\u578B Provider\uFF08OpenAI \u517C\u5BB9\u3001Anthropic \u7B49\uFF09\uFF0C\u5199\u5165\u5B98\u65B9\u914D\u7F6E\u5E76\u70ED\u751F\u6548\uFF1BAPI Key \u5B58\u672C\u673A\u51ED\u636E\u5E93\uFF08\u6587\u4EF6\u4EC5 root \u53EF\u8BFB\uFF09\u3002\u5185\u7F6E DeepSeek \u5B98\u65B9 Provider \u5728\u672C\u9875\u53EA\u8BFB\uFF0C\u5176\u6A21\u578B\u76EE\u5F55\u5728\u300C\u6A21\u578B\u8BBE\u7F6E\u300D\u91CC\u7F16\u8F91\u3002\u672C\u529F\u80FD\u53EF\u5355\u72EC\u505C\u7528\uFF1A\u505C\u7528\u540E\u8FD9\u4E9B\u5199\u914D\u7F6E\u4E0E\u51FA\u7AD9\u8BF7\u6C42\u7684\u8DEF\u7531\u4E00\u5E76\u5173\u95ED\u3002"
4987
+ "\u65B0\u589E / \u7F16\u8F91 / \u5220\u9664\u81EA\u5B9A\u4E49\u6A21\u578B Provider\uFF08OpenAI \u517C\u5BB9\u3001Anthropic \u7B49\uFF09\uFF0C\u5199\u5165\u5B98\u65B9\u914D\u7F6E\u5E76\u70ED\u751F\u6548\uFF1BAPI Key \u5B58\u672C\u673A\u51ED\u636E\u5E93\uFF08\u6587\u4EF6\u4EC5 root \u53EF\u8BFB\uFF09\u3002\u5185\u7F6E DeepSeek \u5B98\u65B9 Provider \u5728\u672C\u9875\u53EA\u8BFB\uFF0C\u5176\u6A21\u578B\u76EE\u5F55\u5728\u300C\u6A21\u578B\u80FD\u529B\u300D\u91CC\u7F16\u8F91\u3002\u672C\u529F\u80FD\u53EF\u5355\u72EC\u505C\u7528\uFF1A\u505C\u7528\u540E\u8FD9\u4E9B\u5199\u914D\u7F6E\u4E0E\u51FA\u7AD9\u8BF7\u6C42\u7684\u8DEF\u7531\u4E00\u5E76\u5173\u95ED\u3002"
4891
4988
  )
4892
4989
  ];
4893
4990
  if (snap.error) {
@@ -4974,8 +5071,8 @@ function ProvidersStat() {
4974
5071
  }
4975
5072
  var feature3 = {
4976
5073
  id: "providerconfig",
4977
- name: "\u6A21\u578B\u63D0\u4F9B\u5546",
4978
- order: 101,
5074
+ name: "\u6A21\u578B\u7BA1\u7406",
5075
+ order: 99,
4979
5076
  accent: "#8b5cf6",
4980
5077
  description: "\u7BA1\u7406\u81EA\u5B9A\u4E49\u6A21\u578B Provider\uFF1A\u65B0\u589E/\u7F16\u8F91/\u5220\u9664\u3001\u62C9\u53D6\u4E0A\u6E38\u6A21\u578B\u5217\u8868\u3001\u5199\u5165 API Key\uFF08\u53EF\u5355\u72EC\u505C\u7528\uFF09",
4981
5078
  css: [
@@ -5074,98 +5171,8 @@ var feature3 = {
5074
5171
  HomeStat: ProvidersStat
5075
5172
  };
5076
5173
 
5077
- // features/heartbeat/view.js
5078
- var import_react5 = __toESM(require("react"), 1);
5079
- var loadedAt = Date.now();
5080
- function uptimeText() {
5081
- const sec = Math.max(0, Math.floor((Date.now() - loadedAt) / 1e3));
5082
- const m = Math.floor(sec / 60);
5083
- return "\u9762\u677F\u5DF2\u8FD0\u884C " + (m > 0 ? m + " \u5206 " : "") + sec % 60 + " \u79D2";
5084
- }
5085
- function HeartbeatView(props) {
5086
- const ctx = props && props.ctx;
5087
- const [txt, setTxt] = import_react5.default.useState(uptimeText());
5088
- import_react5.default.useEffect(() => ctx && typeof ctx.interval === "function" ? ctx.interval(() => setTxt(uptimeText()), 1e3) : void 0, []);
5089
- return import_react5.default.createElement("div", null, txt);
5090
- }
5091
- function HeartbeatStat(props) {
5092
- const ctx = props && props.ctx;
5093
- const [txt, setTxt] = import_react5.default.useState(uptimeText());
5094
- import_react5.default.useEffect(() => ctx && typeof ctx.interval === "function" ? ctx.interval(() => setTxt(uptimeText()), 1e3) : void 0, []);
5095
- return import_react5.default.createElement("span", null, txt);
5096
- }
5097
- var feature4 = {
5098
- id: "heartbeat",
5099
- name: "\u5FC3\u8DF3\u76D1\u89C6",
5100
- order: 140,
5101
- accent: "#34d399",
5102
- description: "\u793A\u4F8B\u529F\u80FD\uFF1A\u9762\u677F\u4FA7\u8FD0\u884C\u65F6\u957F\u5FC3\u8DF3\uFF08\u7EAF Client\uFF09",
5103
- defaultEnabled: false,
5104
- View: HeartbeatView,
5105
- HomeStat: HeartbeatStat
5106
- };
5107
-
5108
- // features/theme/view.js
5109
- var import_react6 = __toESM(require("react"), 1);
5110
- var import_react7 = require("react");
5111
- var PREFERENCE_LABELS = { light: "\u4EAE\u8272", dark: "\u6697\u8272", system: "\u8DDF\u968F\u7CFB\u7EDF" };
5112
- var THEME_LABELS = { light: "\u4EAE\u8272", dark: "\u6697\u8272" };
5113
- function readThemeInfo(ctx) {
5114
- const theme = ctx && ctx.get ? ctx.get("theme") : void 0;
5115
- if (!theme || typeof theme.getTheme !== "function") return { err: "theme \u670D\u52A1\u4E0D\u53EF\u7528" };
5116
- let snap = null;
5117
- try {
5118
- snap = theme.getTheme();
5119
- } catch (err) {
5120
- return { err: "\u8BFB\u53D6\u5931\u8D25\uFF1A" + String(err && err.message || err) };
5121
- }
5122
- const preference = snap && typeof snap.preference === "string" ? snap.preference : "";
5123
- const activeId = snap && snap.active && typeof snap.active.id === "string" ? snap.active.id : "";
5124
- const label = (PREFERENCE_LABELS[preference] || preference || "\u672A\u77E5") + (activeId && activeId !== preference && THEME_LABELS[activeId] ? "\uFF08\u5B9E\u9645" + THEME_LABELS[activeId] + "\uFF09" : "");
5125
- return { label };
5126
- }
5127
- function useThemeInfo(ctx) {
5128
- const [info, setInfo] = (0, import_react7.useState)(() => readThemeInfo(ctx));
5129
- (0, import_react7.useEffect)(() => {
5130
- let off = null;
5131
- try {
5132
- if (ctx && typeof ctx.on === "function") {
5133
- off = ctx.on("theme/change", () => setInfo(readThemeInfo(ctx)));
5134
- }
5135
- } catch {
5136
- }
5137
- return () => {
5138
- try {
5139
- if (typeof off === "function") off();
5140
- } catch {
5141
- }
5142
- };
5143
- }, [ctx]);
5144
- return info;
5145
- }
5146
- function ThemeView(props) {
5147
- const r = useThemeInfo(props && props.ctx);
5148
- if (r.err) return import_react6.default.createElement("div", null, r.err);
5149
- return import_react6.default.createElement("div", null, "\u5F53\u524D\u4E3B\u9898\uFF1A" + r.label);
5150
- }
5151
- function ThemeStat(props) {
5152
- const r = useThemeInfo(props && props.ctx);
5153
- if (r.err) return import_react6.default.createElement("span", null, r.err);
5154
- return import_react6.default.createElement("span", null, "\u4E3B\u9898\uFF1A" + r.label);
5155
- }
5156
- var feature5 = {
5157
- id: "theme",
5158
- name: "\u4E3B\u9898\u4FE1\u606F",
5159
- order: 150,
5160
- accent: "#a78bfa",
5161
- description: "\u8BFB\u53D6\u5F53\u524D\u4E3B\u9898\u5FEB\u7167\uFF1A\u504F\u597D\u4E0E\u5B9E\u9645\u751F\u6548\u4E3B\u9898\uFF08\u7EAF Client\uFF0C\u4E3B\u9898\u5207\u6362\u5B9E\u65F6\u5237\u65B0\uFF09",
5162
- defaultEnabled: false,
5163
- View: ThemeView,
5164
- HomeStat: ThemeStat
5165
- };
5166
-
5167
5174
  // features/balance/view.js
5168
- var import_react8 = __toESM(require("react"), 1);
5175
+ var import_react5 = __toESM(require("react"), 1);
5169
5176
  var ACCENT_PALETTE = ["#2563eb", "#0d9488", "#b45309", "#7c3aed", "#be185d", "#0369a1", "#c2410c", "#15803d", "#a21caf", "#0e7490"];
5170
5177
  var CURATED_ACCENTS = {
5171
5178
  "deepseek-official": "#2563eb",
@@ -5232,8 +5239,8 @@ var balanceStore = {
5232
5239
  }
5233
5240
  };
5234
5241
  function useBalance(ctx) {
5235
- const [snap, setSnap] = import_react8.default.useState(balanceStore.snap);
5236
- import_react8.default.useEffect(() => {
5242
+ const [snap, setSnap] = import_react5.default.useState(balanceStore.snap);
5243
+ import_react5.default.useEffect(() => {
5237
5244
  const off = balanceStore.subscribe(() => setSnap(balanceStore.snap));
5238
5245
  if (!balanceStore.snap.data && !balanceStore.snap.loading) balanceStore.load();
5239
5246
  const disposer = ctx && typeof ctx.interval === "function" ? ctx.interval(() => balanceStore.load(), 5 * 60 * 1e3) : null;
@@ -5247,7 +5254,7 @@ function useBalance(ctx) {
5247
5254
  function BalanceView(props) {
5248
5255
  const snap = useBalance(props && props.ctx);
5249
5256
  const load = () => balanceStore.load();
5250
- import_react8.default.useEffect(() => {
5257
+ import_react5.default.useEffect(() => {
5251
5258
  const pid = props && props.params && props.params.provider;
5252
5259
  if (!pid || typeof document === "undefined") return;
5253
5260
  const t = setTimeout(() => {
@@ -5270,15 +5277,15 @@ function BalanceView(props) {
5270
5277
  const def = data && data.default ? data.default.provider : null;
5271
5278
  const body = [];
5272
5279
  if (snap.error) {
5273
- body.push(import_react8.default.createElement("div", { key: "err", className: "dkb-note dkb-error" }, "\u4F59\u989D\u67E5\u8BE2\u5931\u8D25\uFF1A" + snap.error));
5280
+ body.push(import_react5.default.createElement("div", { key: "err", className: "dkb-note dkb-error" }, "\u4F59\u989D\u67E5\u8BE2\u5931\u8D25\uFF1A" + snap.error));
5274
5281
  } else if (!data) {
5275
- body.push(import_react8.default.createElement("div", { key: "loading", className: "dkb-note" }, snap.loading ? "\u6B63\u5728\u62C9\u53D6\u4F59\u989D\u2026" : "\u8FD8\u6CA1\u6709\u6570\u636E\uFF0C\u70B9\u51FB\u4E0B\u65B9\u5237\u65B0"));
5282
+ body.push(import_react5.default.createElement("div", { key: "loading", className: "dkb-note" }, snap.loading ? "\u6B63\u5728\u62C9\u53D6\u4F59\u989D\u2026" : "\u8FD8\u6CA1\u6709\u6570\u636E\uFF0C\u70B9\u51FB\u4E0B\u65B9\u5237\u65B0"));
5276
5283
  } else if (providers.length === 0) {
5277
- body.push(import_react8.default.createElement("div", { key: "empty", className: "dkb-note" }, "\u6CA1\u6709\u627E\u5230\u5DF2\u914D\u7F6E\u7684\u6A21\u578B Provider"));
5284
+ body.push(import_react5.default.createElement("div", { key: "empty", className: "dkb-note" }, "\u6CA1\u6709\u627E\u5230\u5DF2\u914D\u7F6E\u7684\u6A21\u578B Provider"));
5278
5285
  } else {
5279
5286
  const rank = (p) => p.balance && p.balance.status === "ok" ? 0 : p.balance && p.balance.status === "login-required" ? 1 : 2;
5280
5287
  const sorted = providers.slice().sort((a, b) => rank(a) - rank(b));
5281
- body.push(import_react8.default.createElement(
5288
+ body.push(import_react5.default.createElement(
5282
5289
  "div",
5283
5290
  { key: "rows", className: "dkb-rows" },
5284
5291
  sorted.map((p) => {
@@ -5295,76 +5302,76 @@ function BalanceView(props) {
5295
5302
  let balBody = null;
5296
5303
  if (b && b.status === "ok" && b.kind === "quota") {
5297
5304
  const dims = Array.isArray(b.dims) ? b.dims : [];
5298
- balBody = import_react8.default.createElement(
5299
- import_react8.default.Fragment,
5305
+ balBody = import_react5.default.createElement(
5306
+ import_react5.default.Fragment,
5300
5307
  null,
5301
- import_react8.default.createElement(
5308
+ import_react5.default.createElement(
5302
5309
  "div",
5303
5310
  { className: "dkb-main" },
5304
- import_react8.default.createElement("span", { className: "dkb-main-label" }, "\u5269\u4F59\u989D\u5EA6"),
5305
- import_react8.default.createElement("span", { className: "dkb-main-value" }, fmt(b.remaining) + (b.unit ? " " + b.unit : "")),
5306
- import_react8.default.createElement(
5311
+ import_react5.default.createElement("span", { className: "dkb-main-label" }, "\u5269\u4F59\u989D\u5EA6"),
5312
+ import_react5.default.createElement("span", { className: "dkb-main-value" }, fmt(b.remaining) + (b.unit ? " " + b.unit : "")),
5313
+ import_react5.default.createElement(
5307
5314
  "span",
5308
5315
  { className: "dkb-main-part" },
5309
5316
  "\u5DF2\u7528 " + fmt(b.used) + " / \u603B " + fmt(b.limit),
5310
- b.resetTime ? import_react8.default.createElement("span", null, " \xB7 \u91CD\u7F6E " + String(b.resetTime).slice(0, 10)) : null
5317
+ b.resetTime ? import_react5.default.createElement("span", null, " \xB7 \u91CD\u7F6E " + String(b.resetTime).slice(0, 10)) : null
5311
5318
  )
5312
5319
  ),
5313
- dims.map((d, i) => import_react8.default.createElement(
5320
+ dims.map((d, i) => import_react5.default.createElement(
5314
5321
  "div",
5315
5322
  { key: "d" + i, className: "dkb-dim" },
5316
- import_react8.default.createElement("span", { className: "dkb-dim-label" }, d.window === "weekly" ? "\u5468\u989D\u5EA6" : "\u5C0F\u65F6\u989D\u5EA6"),
5317
- import_react8.default.createElement(
5323
+ import_react5.default.createElement("span", { className: "dkb-dim-label" }, d.window === "weekly" ? "\u5468\u989D\u5EA6" : "\u5C0F\u65F6\u989D\u5EA6"),
5324
+ import_react5.default.createElement(
5318
5325
  "span",
5319
5326
  { className: "dkb-dim-bar" },
5320
- import_react8.default.createElement("span", { className: "dkb-dim-fill", style: { width: (d.limit > 0 ? Math.min(100, Math.round(d.remaining / d.limit * 100)) : 0) + "%" } })
5327
+ import_react5.default.createElement("span", { className: "dkb-dim-fill", style: { width: (d.limit > 0 ? Math.min(100, Math.round(d.remaining / d.limit * 100)) : 0) + "%" } })
5321
5328
  ),
5322
- import_react8.default.createElement("span", { className: "dkb-dim-text" }, "\u5269 " + fmt(d.remaining) + " / " + fmt(d.limit))
5329
+ import_react5.default.createElement("span", { className: "dkb-dim-text" }, "\u5269 " + fmt(d.remaining) + " / " + fmt(d.limit))
5323
5330
  ))
5324
5331
  );
5325
5332
  } else if (b && b.status === "ok") {
5326
5333
  const infos = Array.isArray(b.infos) ? b.infos : [];
5327
- balBody = import_react8.default.createElement(
5334
+ balBody = import_react5.default.createElement(
5328
5335
  "div",
5329
5336
  { className: "dkb-mains" },
5330
5337
  infos.map((rawInfo, idx) => {
5331
5338
  const i = cnyBalanceInfo(rawInfo);
5332
- return import_react8.default.createElement(
5339
+ return import_react5.default.createElement(
5333
5340
  "div",
5334
5341
  { key: idx, className: "dkb-main" },
5335
- import_react8.default.createElement("span", { className: "dkb-main-label", style: { color: accent } }, i.currency),
5336
- import_react8.default.createElement("span", { className: "dkb-main-value" }, moneyText(i.totalBalance)),
5337
- import_react8.default.createElement(
5342
+ import_react5.default.createElement("span", { className: "dkb-main-label", style: { color: accent } }, i.currency),
5343
+ import_react5.default.createElement("span", { className: "dkb-main-value" }, moneyText(i.totalBalance)),
5344
+ import_react5.default.createElement(
5338
5345
  "span",
5339
5346
  { className: "dkb-main-parts" },
5340
- i.grantedBalance != null ? import_react8.default.createElement("span", { className: "dkb-main-part", style: { color: C_GRANTED } }, "\u8D60\u9001 " + moneyText(i.grantedBalance)) : null,
5341
- i.toppedUpBalance != null ? import_react8.default.createElement("span", { className: "dkb-main-part", style: { color: C_TOPUP } }, "\u5145\u503C " + moneyText(i.toppedUpBalance)) : null
5347
+ i.grantedBalance != null ? import_react5.default.createElement("span", { className: "dkb-main-part", style: { color: C_GRANTED } }, "\u8D60\u9001 " + moneyText(i.grantedBalance)) : null,
5348
+ i.toppedUpBalance != null ? import_react5.default.createElement("span", { className: "dkb-main-part", style: { color: C_TOPUP } }, "\u5145\u503C " + moneyText(i.toppedUpBalance)) : null
5342
5349
  )
5343
5350
  );
5344
5351
  })
5345
5352
  );
5346
5353
  } else if (b && b.status === "login-required" && b.consoleUrl) {
5347
- balBody = import_react8.default.createElement(
5354
+ balBody = import_react5.default.createElement(
5348
5355
  "div",
5349
5356
  { className: "dkb-main" },
5350
- import_react8.default.createElement("a", { href: b.consoleUrl, target: "_blank", rel: "noreferrer", className: "dkb-link", style: { color: accent } }, "\u53BB\u63A7\u5236\u53F0\u67E5\u770B\u4F59\u989D \u2192")
5357
+ import_react5.default.createElement("a", { href: b.consoleUrl, target: "_blank", rel: "noreferrer", className: "dkb-link", style: { color: accent } }, "\u53BB\u63A7\u5236\u53F0\u67E5\u770B\u4F59\u989D \u2192")
5351
5358
  );
5352
5359
  } else {
5353
- balBody = b && b.message ? import_react8.default.createElement("div", { className: "dkb-note" }, b.message) : import_react8.default.createElement("div", { className: "dkb-note" }, "\u8BE5 Provider \u6CA1\u6709\u5DF2\u77E5\u7684\u4F59\u989D\u67E5\u8BE2\u63A5\u53E3");
5360
+ balBody = b && b.message ? import_react5.default.createElement("div", { className: "dkb-note" }, b.message) : import_react5.default.createElement("div", { className: "dkb-note" }, "\u8BE5 Provider \u6CA1\u6709\u5DF2\u77E5\u7684\u4F59\u989D\u67E5\u8BE2\u63A5\u53E3");
5354
5361
  }
5355
5362
  const sub = ["ID " + p.id, p.api, p.baseURL ? p.baseURL.replace(/^https?:\/\//, "") : null].filter(Boolean).join(" \xB7 ");
5356
- return import_react8.default.createElement(
5363
+ return import_react5.default.createElement(
5357
5364
  "div",
5358
5365
  { key: p.id, className: "dkb-row", "data-dock-provider": p.id },
5359
- import_react8.default.createElement(
5366
+ import_react5.default.createElement(
5360
5367
  "div",
5361
5368
  { className: "dkb-row-head" },
5362
- import_react8.default.createElement("span", { className: "dkb-dot", style: { background: accent } }),
5363
- import_react8.default.createElement("span", { className: "dkb-name", style: { color: accent } }, p.displayName),
5364
- def === p.id ? import_react8.default.createElement("span", { className: "dkb-default" }, "\u9ED8\u8BA4") : null,
5365
- import_react8.default.createElement("span", { className: "dkb-badge" + (badge[1] ? " " + badge[1] : ""), style: badge[1] === "err" ? { color: C_ERR, borderColor: C_ERR } : null }, badge[0]),
5369
+ import_react5.default.createElement("span", { className: "dkb-dot", style: { background: accent } }),
5370
+ import_react5.default.createElement("span", { className: "dkb-name", style: { color: accent } }, p.displayName),
5371
+ def === p.id ? import_react5.default.createElement("span", { className: "dkb-default" }, "\u9ED8\u8BA4") : null,
5372
+ import_react5.default.createElement("span", { className: "dkb-badge" + (badge[1] ? " " + badge[1] : ""), style: badge[1] === "err" ? { color: C_ERR, borderColor: C_ERR } : null }, badge[0]),
5366
5373
  // 模型数折叠提示(点开展开 chips)
5367
- p.models && p.models.length > 0 ? import_react8.default.createElement("button", {
5374
+ p.models && p.models.length > 0 ? import_react5.default.createElement("button", {
5368
5375
  type: "button",
5369
5376
  className: "dkb-models-toggle",
5370
5377
  title: p.models.join(", "),
@@ -5374,13 +5381,13 @@ function BalanceView(props) {
5374
5381
  }
5375
5382
  }, p.models.length + " \u4E2A\u6A21\u578B \u25BE") : null
5376
5383
  ),
5377
- sub ? import_react8.default.createElement("div", { className: "dkb-sub" }, sub) : null,
5378
- p.apiKeyEnv ? import_react8.default.createElement("div", { className: "dkb-sub" }, "\u5BC6\u94A5: " + p.apiKeyEnv + (p.credentialConfigured ? " \u2713" : " \u2717")) : null,
5379
- p.models && p.models.length > 0 ? import_react8.default.createElement(
5384
+ sub ? import_react5.default.createElement("div", { className: "dkb-sub" }, sub) : null,
5385
+ p.apiKeyEnv ? import_react5.default.createElement("div", { className: "dkb-sub" }, "\u5BC6\u94A5: " + p.apiKeyEnv + (p.credentialConfigured ? " \u2713" : " \u2717")) : null,
5386
+ p.models && p.models.length > 0 ? import_react5.default.createElement(
5380
5387
  "div",
5381
5388
  { className: "dkb-chips" },
5382
- p.models.slice(0, 8).map((m) => import_react8.default.createElement("span", { key: m, className: "dkb-chip", style: { border: "1px solid " + accent, color: accent, background: accent + "1a" } }, m)),
5383
- p.models.length > 8 ? import_react8.default.createElement("span", { key: "more", className: "dkb-chip" }, "+" + (p.models.length - 8)) : null
5389
+ p.models.slice(0, 8).map((m) => import_react5.default.createElement("span", { key: m, className: "dkb-chip", style: { border: "1px solid " + accent, color: accent, background: accent + "1a" } }, m)),
5390
+ p.models.length > 8 ? import_react5.default.createElement("span", { key: "more", className: "dkb-chip" }, "+" + (p.models.length - 8)) : null
5384
5391
  ) : null,
5385
5392
  balBody
5386
5393
  );
@@ -5388,20 +5395,20 @@ function BalanceView(props) {
5388
5395
  ));
5389
5396
  }
5390
5397
  const now = new Date(data && data.generatedAt ? data.generatedAt : Date.now());
5391
- return import_react8.default.createElement(
5398
+ return import_react5.default.createElement(
5392
5399
  "div",
5393
5400
  { className: "dkb-rows" },
5394
- import_react8.default.createElement(
5401
+ import_react5.default.createElement(
5395
5402
  "div",
5396
5403
  { className: "dkb-note" },
5397
5404
  data && !snap.error && providers.length > 0 ? okCount + "/" + providers.length + " \u4E2A Provider \u53EF\u67E5\u4F59\u989D\uFF08\u53EF\u67E5\u7684\u6392\u524D\u9762\uFF09" : "\u6A21\u578B\u4F59\u989D \xB7 Host \u534A\u90E8\u5B9E\u65F6\u62C9\u53D6"
5398
5405
  ),
5399
5406
  body,
5400
- import_react8.default.createElement(
5407
+ import_react5.default.createElement(
5401
5408
  "div",
5402
5409
  { className: "dkb-foot" },
5403
- import_react8.default.createElement("span", null, snap.loading ? "\u5237\u65B0\u4E2D\u2026" : "\u66F4\u65B0\u4E8E " + now.toLocaleTimeString()),
5404
- import_react8.default.createElement("button", { type: "button", className: "dkb-refresh", onClick: load }, "\u5237\u65B0")
5410
+ import_react5.default.createElement("span", null, snap.loading ? "\u5237\u65B0\u4E2D\u2026" : "\u66F4\u65B0\u4E8E " + now.toLocaleTimeString()),
5411
+ import_react5.default.createElement("button", { type: "button", className: "dkb-refresh", onClick: load }, "\u5237\u65B0")
5405
5412
  )
5406
5413
  );
5407
5414
  }
@@ -5409,14 +5416,14 @@ function BalanceStat(props) {
5409
5416
  const snap = useBalance(props && props.ctx);
5410
5417
  const data = snap.data;
5411
5418
  const providers = data && Array.isArray(data.providers) ? data.providers : [];
5412
- if (snap.error) return import_react8.default.createElement("span", { className: "dockm-err" }, "\u4F59\u989D\u67E5\u8BE2\u5931\u8D25\uFF08\u70B9\u51FB\u8FDB\u5165\u67E5\u770B\u8BE6\u60C5\uFF09");
5413
- if (!data) return import_react8.default.createElement("span", null, snap.loading ? "\u6B63\u5728\u62C9\u53D6\u4F59\u989D\u2026" : "\u7B49\u5F85\u62C9\u53D6\u4F59\u989D");
5419
+ if (snap.error) return import_react5.default.createElement("span", { className: "dockm-err" }, "\u4F59\u989D\u67E5\u8BE2\u5931\u8D25\uFF08\u70B9\u51FB\u8FDB\u5165\u67E5\u770B\u8BE6\u60C5\uFF09");
5420
+ if (!data) return import_react5.default.createElement("span", null, snap.loading ? "\u6B63\u5728\u62C9\u53D6\u4F59\u989D\u2026" : "\u7B49\u5F85\u62C9\u53D6\u4F59\u989D");
5414
5421
  const ok = providers.filter((p) => p.balance && p.balance.status === "ok").length;
5415
- return import_react8.default.createElement("span", null, providers.length + " \u4E2A Provider \xB7 " + ok + " \u4E2A\u53EF\u67E5\u4F59\u989D");
5422
+ return import_react5.default.createElement("span", null, providers.length + " \u4E2A Provider \xB7 " + ok + " \u4E2A\u53EF\u67E5\u4F59\u989D");
5416
5423
  }
5417
5424
  function useCurrentProvider(ctx, sessionId) {
5418
- const [cur, setCur] = import_react8.default.useState(null);
5419
- import_react8.default.useEffect(() => {
5425
+ const [cur, setCur] = import_react5.default.useState(null);
5426
+ import_react5.default.useEffect(() => {
5420
5427
  let alive = true, off = null;
5421
5428
  try {
5422
5429
  const models = ctx && ctx.get ? ctx.get("modelDirectories") : void 0;
@@ -5479,7 +5486,7 @@ function BalanceChip(props) {
5479
5486
  const selModel = sel && (sel.model || sel.selected && sel.selected.model) || null;
5480
5487
  const title = cur ? (cur.displayName || cur.id) + (selModel ? " \xB7 \u5F53\u524D\u6A21\u578B " + selModel : "") + " \xB7 \u70B9\u51FB\u5728\u529F\u80FD\u575E\u67E5\u770B\u4F59\u989D\u8BE6\u60C5" : "\u70B9\u51FB\u6253\u5F00\u529F\u80FD\u575E \xB7 \u6A21\u578B\u4F59\u989D";
5481
5488
  const mm = /^(余额 )([\s\S]*)$/.exec(text);
5482
- return import_react8.default.createElement(
5489
+ return import_react5.default.createElement(
5483
5490
  "button",
5484
5491
  {
5485
5492
  type: "button",
@@ -5489,23 +5496,23 @@ function BalanceChip(props) {
5489
5496
  onClick: () => openPanel("balance", def ? { provider: def } : null)
5490
5497
  },
5491
5498
  // 窄屏只显示这枚小图标:点它进功能坞看余额详情(title 里是完整数值)
5492
- import_react8.default.createElement(
5499
+ import_react5.default.createElement(
5493
5500
  "span",
5494
5501
  { className: "dockchip-svg", "aria-hidden": "true" },
5495
- import_react8.default.createElement(
5502
+ import_react5.default.createElement(
5496
5503
  "svg",
5497
5504
  { viewBox: "0 0 16 16", width: 13, height: 13, fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round" },
5498
- import_react8.default.createElement("path", { d: "M2.8 6.2h10.4v6.3a1 1 0 0 1-1 1H3.8a1 1 0 0 1-1-1z" }),
5499
- import_react8.default.createElement("path", { d: "M5.4 6.2V4.6a2.6 2.6 0 0 1 5.2 0v1.6" })
5505
+ import_react5.default.createElement("path", { d: "M2.8 6.2h10.4v6.3a1 1 0 0 1-1 1H3.8a1 1 0 0 1-1-1z" }),
5506
+ import_react5.default.createElement("path", { d: "M5.4 6.2V4.6a2.6 2.6 0 0 1 5.2 0v1.6" })
5500
5507
  )
5501
5508
  ),
5502
- import_react8.default.createElement("span", { className: "dockchip-dot", style: { background: accent } }),
5503
- mm ? import_react8.default.createElement("span", { className: "dockchip-pre" }, mm[1]) : null,
5504
- mm ? import_react8.default.createElement("span", { className: "dockchip-pre-s" }, "\u4F59\u989D ") : null,
5505
- import_react8.default.createElement("span", { className: "dockchip-val" }, mm ? mm[2] : text)
5509
+ import_react5.default.createElement("span", { className: "dockchip-dot", style: { background: accent } }),
5510
+ mm ? import_react5.default.createElement("span", { className: "dockchip-pre" }, mm[1]) : null,
5511
+ mm ? import_react5.default.createElement("span", { className: "dockchip-pre-s" }, "\u4F59\u989D ") : null,
5512
+ import_react5.default.createElement("span", { className: "dockchip-val" }, mm ? mm[2] : text)
5506
5513
  );
5507
5514
  }
5508
- var feature6 = {
5515
+ var feature4 = {
5509
5516
  id: "balance",
5510
5517
  name: "\u6A21\u578B\u4F59\u989D",
5511
5518
  order: 120,
@@ -5562,7 +5569,7 @@ var feature6 = {
5562
5569
  };
5563
5570
 
5564
5571
  // features/animation/view.jsx
5565
- var import_react9 = require("react");
5572
+ var import_react6 = require("react");
5566
5573
  var import_jsx_runtime2 = require("react/jsx-runtime");
5567
5574
  function rpcCall2(method, args) {
5568
5575
  return fetch("dsh-dock/animation/" + method, {
@@ -5660,13 +5667,13 @@ var animationStore = {
5660
5667
  }
5661
5668
  };
5662
5669
  function useAnimation() {
5663
- const [snap, setSnap] = (0, import_react9.useState)(animationStore.snap);
5664
- (0, import_react9.useEffect)(() => animationStore.subscribe(() => setSnap(animationStore.snap)), []);
5670
+ const [snap, setSnap] = (0, import_react6.useState)(animationStore.snap);
5671
+ (0, import_react6.useEffect)(() => animationStore.subscribe(() => setSnap(animationStore.snap)), []);
5665
5672
  return snap;
5666
5673
  }
5667
5674
  function useTicker(ctx, active) {
5668
- const [, bump] = (0, import_react9.useState)(0);
5669
- (0, import_react9.useEffect)(() => {
5675
+ const [, bump] = (0, import_react6.useState)(0);
5676
+ (0, import_react6.useEffect)(() => {
5670
5677
  if (!active) return;
5671
5678
  if (ctx && typeof ctx.interval === "function") return ctx.interval(bump, 1e3);
5672
5679
  const t = setInterval(bump, 1e3);
@@ -5841,7 +5848,7 @@ var MATRIX_CHARS = "01</>;{}=+*#";
5841
5848
  function AmbientLayer(props) {
5842
5849
  const mode = props.mode;
5843
5850
  const speed = props.speed;
5844
- const particles = (0, import_react9.useMemo)(() => {
5851
+ const particles = (0, import_react6.useMemo)(() => {
5845
5852
  if (mode === "matrix") return { matrix: makeBits(34, () => ({
5846
5853
  l: Math.random() * 100,
5847
5854
  d: 4 + Math.random() * 6,
@@ -6089,8 +6096,8 @@ function composerDockPoint(side = "right") {
6089
6096
  };
6090
6097
  }
6091
6098
  function useSpaceDocks(enabled) {
6092
- const [docks, setDocks] = (0, import_react9.useState)(null);
6093
- (0, import_react9.useEffect)(() => {
6099
+ const [docks, setDocks] = (0, import_react6.useState)(null);
6100
+ (0, import_react6.useEffect)(() => {
6094
6101
  if (!enabled || typeof window === "undefined") {
6095
6102
  setDocks(null);
6096
6103
  return void 0;
@@ -6285,25 +6292,25 @@ function ProgrammingStuck(props) {
6285
6292
  function AnimationOverlay(props) {
6286
6293
  const ctx = props && props.ctx;
6287
6294
  const snap = useAnimation();
6288
- const [flourish, setFlourish] = (0, import_react9.useState)(null);
6289
- const [bursts, setBursts] = (0, import_react9.useState)([]);
6290
- const [deliveries, setDeliveries] = (0, import_react9.useState)([]);
6291
- const [departures, setDepartures] = (0, import_react9.useState)([]);
6292
- const prevActiveRef = (0, import_react9.useRef)(null);
6293
- const burstIdRef = (0, import_react9.useRef)(0);
6294
- const deliveryIdRef = (0, import_react9.useRef)(0);
6295
- const departureTimersRef = (0, import_react9.useRef)(/* @__PURE__ */ new Map());
6296
- const lastImmediateDepartureRef = (0, import_react9.useRef)(0);
6297
- (0, import_react9.useEffect)(() => () => {
6295
+ const [flourish, setFlourish] = (0, import_react6.useState)(null);
6296
+ const [bursts, setBursts] = (0, import_react6.useState)([]);
6297
+ const [deliveries, setDeliveries] = (0, import_react6.useState)([]);
6298
+ const [departures, setDepartures] = (0, import_react6.useState)([]);
6299
+ const prevActiveRef = (0, import_react6.useRef)(null);
6300
+ const burstIdRef = (0, import_react6.useRef)(0);
6301
+ const deliveryIdRef = (0, import_react6.useRef)(0);
6302
+ const departureTimersRef = (0, import_react6.useRef)(/* @__PURE__ */ new Map());
6303
+ const lastImmediateDepartureRef = (0, import_react6.useRef)(0);
6304
+ (0, import_react6.useEffect)(() => () => {
6298
6305
  for (const timer of departureTimersRef.current.values()) clearTimeout(timer);
6299
6306
  departureTimersRef.current.clear();
6300
6307
  }, []);
6301
- const pushBurst = (0, import_react9.useCallback)((type, x, y, bits) => {
6308
+ const pushBurst = (0, import_react6.useCallback)((type, x, y, bits) => {
6302
6309
  const id = ++burstIdRef.current;
6303
6310
  setBursts((prev) => prev.concat([{ id, type, x, y, bits }]).slice(-6));
6304
6311
  setTimeout(() => setBursts((prev) => prev.filter((b) => b.id !== id)), 2600);
6305
6312
  }, []);
6306
- const launchMission = (0, import_react9.useCallback)(() => {
6313
+ const launchMission = (0, import_react6.useCallback)(() => {
6307
6314
  const cfg2 = animationStore.snap.status && animationStore.snap.status.config;
6308
6315
  if (!cfg2 || !cfg2.animationEnabled || cfg2.effectMode !== "space") return false;
6309
6316
  const id = ++deliveryIdRef.current;
@@ -6326,7 +6333,7 @@ function AnimationOverlay(props) {
6326
6333
  }, departure.duration));
6327
6334
  return true;
6328
6335
  }, []);
6329
- (0, import_react9.useEffect)(() => {
6336
+ (0, import_react6.useEffect)(() => {
6330
6337
  if (typeof document === "undefined") return;
6331
6338
  const onClick = (e) => {
6332
6339
  const t = e.target;
@@ -6353,8 +6360,8 @@ function AnimationOverlay(props) {
6353
6360
  document.addEventListener("click", onClick, true);
6354
6361
  return () => document.removeEventListener("click", onClick, true);
6355
6362
  }, [pushBurst, launchMission]);
6356
- const taskCountRef = (0, import_react9.useRef)(0);
6357
- (0, import_react9.useEffect)(() => {
6363
+ const taskCountRef = (0, import_react6.useRef)(0);
6364
+ (0, import_react6.useEffect)(() => {
6358
6365
  const st2 = snap.status;
6359
6366
  if (!st2 || !st2.active) return;
6360
6367
  const n = st2.active.length;
@@ -6365,7 +6372,7 @@ function AnimationOverlay(props) {
6365
6372
  }
6366
6373
  taskCountRef.current = n;
6367
6374
  }, [snap.status, pushBurst, launchMission]);
6368
- (0, import_react9.useEffect)(() => {
6375
+ (0, import_react6.useEffect)(() => {
6369
6376
  let stopped = false;
6370
6377
  let timer = null;
6371
6378
  const loop = async () => {
@@ -6385,7 +6392,7 @@ function AnimationOverlay(props) {
6385
6392
  document.removeEventListener("visibilitychange", onVisible);
6386
6393
  };
6387
6394
  }, []);
6388
- (0, import_react9.useEffect)(() => {
6395
+ (0, import_react6.useEffect)(() => {
6389
6396
  const st2 = snap.status;
6390
6397
  if (!st2 || !st2.active) return;
6391
6398
  const prev = prevActiveRef.current;
@@ -6433,8 +6440,8 @@ function AnimationOverlay(props) {
6433
6440
  const phase = active.length > 0 ? active.reduce((best, x) => !best || (x.phaseAt || 0) > (best.phaseAt || 0) ? x : best, null).phase : "think";
6434
6441
  const waitingTask = active.find((x) => taskWaiting(x)) || null;
6435
6442
  const waitWord = waitingTask && taskApprovals(waitingTask).length === 0 ? "\u7B49\u5F85\u56DE\u7B54" : "\u7B49\u5F85\u786E\u8BA4";
6436
- const sessionTitleRef = (0, import_react9.useRef)({ at: 0, title: "" });
6437
- const currentTitle = (0, import_react9.useMemo)(() => {
6443
+ const sessionTitleRef = (0, import_react6.useRef)({ at: 0, title: "" });
6444
+ const currentTitle = (0, import_react6.useMemo)(() => {
6438
6445
  const c = sessionTitleRef.current;
6439
6446
  if (typeof window === "undefined") return "";
6440
6447
  if (Date.now() - c.at < 1e3) return c.title;
@@ -6442,19 +6449,19 @@ function AnimationOverlay(props) {
6442
6449
  c.title = currentSessionTitle();
6443
6450
  return c.title;
6444
6451
  }, [snap.status]);
6445
- const onScreenTasks = (0, import_react9.useMemo)(() => active.filter((x) => taskOnScreen(x, currentTitle)), [active, currentTitle]);
6452
+ const onScreenTasks = (0, import_react6.useMemo)(() => active.filter((x) => taskOnScreen(x, currentTitle)), [active, currentTitle]);
6446
6453
  const waitingTaskOnScreen = onScreenTasks.find((x) => taskWaiting(x)) || null;
6447
6454
  useTicker(ctx, animOn);
6448
6455
  const now = Date.now();
6449
6456
  const elapsed = active.length > 0 ? fmtClock(now - Math.min(...active.map((x) => x.startTime || now))) : "";
6450
- const [panelOpen, setPanelOpen2] = (0, import_react9.useState)(false);
6451
- (0, import_react9.useEffect)(() => {
6457
+ const [panelOpen, setPanelOpen2] = (0, import_react6.useState)(false);
6458
+ (0, import_react6.useEffect)(() => {
6452
6459
  setPanelOpen2(panelNav.open);
6453
6460
  return subscribePanel(() => setPanelOpen2(panelNav.open));
6454
6461
  }, []);
6455
- const [speed, setSpeed] = (0, import_react9.useState)(1);
6456
- const speedRef = (0, import_react9.useRef)({ ticks: -1, at: 0 });
6457
- (0, import_react9.useEffect)(() => {
6462
+ const [speed, setSpeed] = (0, import_react6.useState)(1);
6463
+ const speedRef = (0, import_react6.useRef)({ ticks: -1, at: 0 });
6464
+ (0, import_react6.useEffect)(() => {
6458
6465
  if (!st || active.length === 0) {
6459
6466
  speedRef.current = { ticks: -1, at: 0 };
6460
6467
  setSpeed(1);
@@ -6480,17 +6487,17 @@ function AnimationOverlay(props) {
6480
6487
  const stuckTask = onScreenTasks.find((task) => task.phase === "code" && taskStalled(task, now, 18e3)) || null;
6481
6488
  const robotScaleFromConfig = Math.max(0.85, Math.min(2.2, Number(cfg && cfg.robotScale) || 1.35));
6482
6489
  const speedStyle = { "--dkan-speed": Number(speed).toFixed(2) };
6483
- const saveRobotScale = (0, import_react9.useCallback)((robotScale) => {
6490
+ const saveRobotScale = (0, import_react6.useCallback)((robotScale) => {
6484
6491
  rpcCall2("config", { robotScale }).then((d) => animationStore.applyConfig(d && d.config)).catch(() => {
6485
6492
  });
6486
6493
  }, []);
6487
- const [botPos, setBotPos] = (0, import_react9.useState)(null);
6488
- const botPosRef = (0, import_react9.useRef)(null);
6489
- const botDragRef = (0, import_react9.useRef)(null);
6490
- const botResizeRef = (0, import_react9.useRef)(null);
6491
- const [botScaleDraft, setBotScaleDraft] = (0, import_react9.useState)(null);
6492
- const botClickBlockRef = (0, import_react9.useRef)(false);
6493
- (0, import_react9.useEffect)(() => {
6494
+ const [botPos, setBotPos] = (0, import_react6.useState)(null);
6495
+ const botPosRef = (0, import_react6.useRef)(null);
6496
+ const botDragRef = (0, import_react6.useRef)(null);
6497
+ const botResizeRef = (0, import_react6.useRef)(null);
6498
+ const [botScaleDraft, setBotScaleDraft] = (0, import_react6.useState)(null);
6499
+ const botClickBlockRef = (0, import_react6.useRef)(false);
6500
+ (0, import_react6.useEffect)(() => {
6494
6501
  try {
6495
6502
  if (typeof localStorage === "undefined") return;
6496
6503
  const raw = localStorage.getItem("dsh-dock/anim/robot-pos/v1");
@@ -6542,11 +6549,11 @@ function AnimationOverlay(props) {
6542
6549
  }, 0);
6543
6550
  }
6544
6551
  };
6545
- const [badgePos, setBadgePos] = (0, import_react9.useState)(null);
6546
- const badgePosRef = (0, import_react9.useRef)(null);
6547
- const badgeDragRef = (0, import_react9.useRef)(null);
6548
- const badgeClickBlockRef = (0, import_react9.useRef)(false);
6549
- (0, import_react9.useEffect)(() => {
6552
+ const [badgePos, setBadgePos] = (0, import_react6.useState)(null);
6553
+ const badgePosRef = (0, import_react6.useRef)(null);
6554
+ const badgeDragRef = (0, import_react6.useRef)(null);
6555
+ const badgeClickBlockRef = (0, import_react6.useRef)(false);
6556
+ (0, import_react6.useEffect)(() => {
6550
6557
  try {
6551
6558
  if (typeof localStorage === "undefined") return;
6552
6559
  const raw = localStorage.getItem("dsh-dock/anim/badge-pos/v1");
@@ -6606,7 +6613,7 @@ function AnimationOverlay(props) {
6606
6613
  badgePosRef.current = null;
6607
6614
  setBadgePos(null);
6608
6615
  };
6609
- const badgeClickTimer = (0, import_react9.useRef)(null);
6616
+ const badgeClickTimer = (0, import_react6.useRef)(null);
6610
6617
  const onBadgeClick = () => {
6611
6618
  if (badgeClickBlockRef.current) return;
6612
6619
  if (badgeClickTimer.current) {
@@ -6824,11 +6831,11 @@ function ModePreview({ id }) {
6824
6831
  function AnimationView(props) {
6825
6832
  const ctx = props && props.ctx;
6826
6833
  const snap = useAnimation(ctx);
6827
- const [cfg, setCfg] = (0, import_react9.useState)(null);
6828
- const [saveErr, setSaveErr] = (0, import_react9.useState)("");
6829
- const cfgRef = (0, import_react9.useRef)(null);
6830
- const pendingSavesRef = (0, import_react9.useRef)(0);
6831
- (0, import_react9.useEffect)(() => {
6834
+ const [cfg, setCfg] = (0, import_react6.useState)(null);
6835
+ const [saveErr, setSaveErr] = (0, import_react6.useState)("");
6836
+ const cfgRef = (0, import_react6.useRef)(null);
6837
+ const pendingSavesRef = (0, import_react6.useRef)(0);
6838
+ (0, import_react6.useEffect)(() => {
6832
6839
  const c = snap.status && snap.status.config;
6833
6840
  if (!c) return;
6834
6841
  if (pendingSavesRef.current > 0) return;
@@ -6837,7 +6844,7 @@ function AnimationView(props) {
6837
6844
  setCfg(Object.assign({}, c));
6838
6845
  }
6839
6846
  }, [snap.status]);
6840
- (0, import_react9.useEffect)(() => {
6847
+ (0, import_react6.useEffect)(() => {
6841
6848
  if (!animationStore.snap.status) animationStore.refresh();
6842
6849
  }, []);
6843
6850
  const patch = (p) => {
@@ -7312,7 +7319,7 @@ var css2 = [
7312
7319
  // 减少动态时停止空间位移,保留屏幕亮暗与思考状态的淡入反馈。
7313
7320
  "@media (prefers-reduced-motion:reduce){.dkan-amb *,.dkan-prev *,.dkan-space-system,.dkan-space-dust,.dkan-space-runner,.dkan-delivery,.dkan-departure,.dkan-freighter-engine i,.dkan-stuck-code::after,.dkan-stuck-code i{animation:none!important}.dkan-space-runner,.dkan-departure{display:none}.dkan-delivery{opacity:1;transform:translate3d(var(--dkan-to-x),var(--dkan-to-y),0)}.dkan-delivery-trail{display:none}.dk3-person,.dk3-upper3,.dk3-head3,.dk3-arm3,.dk3-elbow,.dk3-wrist3,.dk3-wheel,.dk3-code,.dk3-search-results{animation:none!important;transition:none!important}.dk3-screen,.dkan-bubble{transition:opacity .2s cubic-bezier(.23,1,.32,1)!important}}"
7314
7321
  ].join("\n");
7315
- var feature7 = {
7322
+ var feature5 = {
7316
7323
  id: "animation",
7317
7324
  name: "\u4EFB\u52A1\u52A8\u753B",
7318
7325
  order: 130,
@@ -7325,7 +7332,7 @@ var feature7 = {
7325
7332
  };
7326
7333
 
7327
7334
  // features/notify/view.jsx
7328
- var import_react10 = require("react");
7335
+ var import_react7 = require("react");
7329
7336
  var import_jsx_runtime3 = require("react/jsx-runtime");
7330
7337
  function rpcCall3(method, args) {
7331
7338
  return fetch("dsh-dock/notify/" + method, {
@@ -7470,8 +7477,8 @@ function voiceAllowed(cfg) {
7470
7477
  return !!cfg && cfg.voiceNotify === true && voiceClientEnabled();
7471
7478
  }
7472
7479
  function useVoiceClientEnabled() {
7473
- const [on, setOn] = (0, import_react10.useState)(() => voiceClientEnabled());
7474
- (0, import_react10.useEffect)(() => {
7480
+ const [on, setOn] = (0, import_react7.useState)(() => voiceClientEnabled());
7481
+ (0, import_react7.useEffect)(() => {
7475
7482
  const sync = () => setOn(voiceClientEnabled());
7476
7483
  if (typeof window === "undefined" || typeof window.addEventListener !== "function") return void 0;
7477
7484
  window.addEventListener("storage", sync);
@@ -7479,7 +7486,7 @@ function useVoiceClientEnabled() {
7479
7486
  if (typeof window.removeEventListener === "function") window.removeEventListener("storage", sync);
7480
7487
  };
7481
7488
  }, []);
7482
- const set = (0, import_react10.useCallback)((next) => {
7489
+ const set = (0, import_react7.useCallback)((next) => {
7483
7490
  const v = next !== false;
7484
7491
  setVoiceClientEnabled(v);
7485
7492
  setOn(v);
@@ -7587,8 +7594,8 @@ function effectiveNotifyConfig(serverCfg) {
7587
7594
  return mergeClientNotifyConfig(server, local);
7588
7595
  }
7589
7596
  function useNotifyConfigSource() {
7590
- const [source, setSource] = (0, import_react10.useState)(() => notifyConfigSource());
7591
- const set = (0, import_react10.useCallback)((next) => {
7597
+ const [source, setSource] = (0, import_react7.useState)(() => notifyConfigSource());
7598
+ const set = (0, import_react7.useCallback)((next) => {
7592
7599
  const value = next === "client" ? "client" : "server";
7593
7600
  setNotifyConfigSource(value);
7594
7601
  setSource(value);
@@ -7648,10 +7655,10 @@ function pickVoice(cfg, text) {
7648
7655
  return null;
7649
7656
  }
7650
7657
  function useLocalVoices() {
7651
- const [, force] = (0, import_react10.useState)(0);
7652
- const ref = (0, import_react10.useRef)(null);
7658
+ const [, force] = (0, import_react7.useState)(0);
7659
+ const ref = (0, import_react7.useRef)(null);
7653
7660
  if (ref.current === null) ref.current = localVoices();
7654
- (0, import_react10.useEffect)(() => {
7661
+ (0, import_react7.useEffect)(() => {
7655
7662
  const s = synthOf();
7656
7663
  const onChange = () => {
7657
7664
  ref.current = localVoices();
@@ -7751,11 +7758,14 @@ function endBroadcastText(success, record, task, cfg) {
7751
7758
  const mode = voiceTone(cfg);
7752
7759
  const reason = record && record.endReason || "";
7753
7760
  const title = record && record.title || task && task.title || "";
7761
+ const sub = !!(record && record.isSubtask || task && task.isSubtask);
7762
+ const parentTitle = record && record.parentTitle || task && task.parentTitle || "";
7754
7763
  if (mode === "brief") {
7764
+ if (sub) return success ? "\u5B50\u4EFB\u52A1\u5B8C\u6210" : "\u5B50\u4EFB\u52A1\u505C\u6B62\u4E86";
7755
7765
  return success ? "\u4EFB\u52A1\u5B8C\u6210" : "\u4EFB\u52A1\u505C\u6B62\u4E86";
7756
7766
  }
7757
7767
  if (mode === "medium") {
7758
- const who = title ? "\u4EFB\u52A1\u300C" + truncate2(title, 30) + "\u300D" : "\u4EFB\u52A1";
7768
+ const who = sub ? (parentTitle ? "\u4E3B\u4EFB\u52A1\u300C" + truncate2(parentTitle, 20) + "\u300D\u7684" : "") + (title ? "\u5B50\u4EFB\u52A1\u300C" + truncate2(title, 30) + "\u300D" : "\u5B50\u4EFB\u52A1") : title ? "\u4EFB\u52A1\u300C" + truncate2(title, 30) + "\u300D" : "\u4EFB\u52A1";
7759
7769
  const parts2 = [success ? who + "\u5B8C\u6210\u4E86" : who + "\u505C\u6B62\u4E86"];
7760
7770
  if (!success) parts2.push("\uFF0C\u539F\u56E0\uFF1A" + endReasonSpeech(reason));
7761
7771
  const dur2 = record && record.duration || 0;
@@ -7764,7 +7774,8 @@ function endBroadcastText(success, record, task, cfg) {
7764
7774
  return parts2.join("");
7765
7775
  }
7766
7776
  const parts = [];
7767
- if (title) parts.push("\u4EFB\u52A1\uFF1A" + truncate2(title, 30) + "\u3002");
7777
+ if (sub && parentTitle) parts.push("\u4E3B\u4EFB\u52A1\uFF1A" + truncate2(parentTitle, 30) + "\u3002");
7778
+ if (title) parts.push((sub ? "\u5B50\u4EFB\u52A1\uFF1A" : "\u4EFB\u52A1\uFF1A") + truncate2(title, 30) + "\u3002");
7768
7779
  parts.push(success ? "\u5DF2\u5B8C\u6210\u3002" : "\u7ED3\u675F\uFF0C\u539F\u56E0\uFF1A" + endReasonSpeech(reason) + "\u3002");
7769
7780
  const dur = record && record.duration || 0;
7770
7781
  if (dur > 0) parts.push("\u8017\u65F6" + fmtDur(dur) + "\u3002");
@@ -7870,8 +7881,8 @@ var notifyStore = {
7870
7881
  }
7871
7882
  };
7872
7883
  function useNotify() {
7873
- const [snap, setSnap] = (0, import_react10.useState)(notifyStore.snap);
7874
- (0, import_react10.useEffect)(() => notifyStore.subscribe(() => setSnap(notifyStore.snap)), []);
7884
+ const [snap, setSnap] = (0, import_react7.useState)(notifyStore.snap);
7885
+ (0, import_react7.useEffect)(() => notifyStore.subscribe(() => setSnap(notifyStore.snap)), []);
7875
7886
  return snap;
7876
7887
  }
7877
7888
  function pageVisible() {
@@ -7940,19 +7951,19 @@ function openSessionByTitle(title) {
7940
7951
  }
7941
7952
  function Toast(props) {
7942
7953
  const t = props.t;
7943
- const [closing, setClosing] = (0, import_react10.useState)(!!t.closing);
7944
- const close = (0, import_react10.useCallback)(() => {
7954
+ const [closing, setClosing] = (0, import_react7.useState)(!!t.closing);
7955
+ const close = (0, import_react7.useCallback)(() => {
7945
7956
  setClosing(true);
7946
7957
  }, []);
7947
- const jump = (0, import_react10.useCallback)(() => {
7958
+ const jump = (0, import_react7.useCallback)(() => {
7948
7959
  if (!t.sessionTitle && !t.sessionId) return;
7949
7960
  const ok = openSessionById(t.sessionId) || (t.fallbackSessionId ? openSessionById(t.fallbackSessionId) : false) || (t.sessionTitle ? openSessionByTitle(t.sessionTitle) : false);
7950
7961
  if (ok && t.kind !== "confirm" && t.kind !== "stuck") setClosing(true);
7951
7962
  }, [t.sessionId, t.sessionTitle, t.fallbackSessionId, t.kind]);
7952
- (0, import_react10.useEffect)(() => {
7963
+ (0, import_react7.useEffect)(() => {
7953
7964
  if (t.closing && !closing) setClosing(true);
7954
7965
  }, [t.closing, closing]);
7955
- (0, import_react10.useEffect)(() => {
7966
+ (0, import_react7.useEffect)(() => {
7956
7967
  if (!closing) return;
7957
7968
  const timer = setTimeout(() => props.onClose(t.id), 240);
7958
7969
  return () => clearTimeout(timer);
@@ -7993,23 +8004,23 @@ function Toast(props) {
7993
8004
  function NotifyOverlay(props) {
7994
8005
  if (props && props.ctx) overlayCtx = props.ctx;
7995
8006
  const snap = useNotify();
7996
- const [toasts, setToasts] = (0, import_react10.useState)([]);
7997
- const [stackHover, setStackHover] = (0, import_react10.useState)(false);
7998
- const prevActiveRef = (0, import_react10.useRef)(null);
7999
- const remindedApprovalsRef = (0, import_react10.useRef)(/* @__PURE__ */ new Map());
8000
- const remindedQuestionsRef = (0, import_react10.useRef)(/* @__PURE__ */ new Map());
8001
- const toastSeqRef = (0, import_react10.useRef)(0);
8002
- const pushToast = (0, import_react10.useCallback)((toast) => {
8007
+ const [toasts, setToasts] = (0, import_react7.useState)([]);
8008
+ const [stackHover, setStackHover] = (0, import_react7.useState)(false);
8009
+ const prevActiveRef = (0, import_react7.useRef)(null);
8010
+ const remindedApprovalsRef = (0, import_react7.useRef)(/* @__PURE__ */ new Map());
8011
+ const remindedQuestionsRef = (0, import_react7.useRef)(/* @__PURE__ */ new Map());
8012
+ const toastSeqRef = (0, import_react7.useRef)(0);
8013
+ const pushToast = (0, import_react7.useCallback)((toast) => {
8003
8014
  const st = notifyStore.snap.status;
8004
8015
  const cfg = st ? effectiveNotifyConfig(st.config) : null;
8005
8016
  if (cfg && cfg.notifyCards === false) return;
8006
8017
  setToasts((prev) => prev.concat([toast]).slice(-12));
8007
8018
  }, []);
8008
- (0, import_react10.useEffect)(() => {
8019
+ (0, import_react7.useEffect)(() => {
8009
8020
  const cfg = snap.status ? effectiveNotifyConfig(snap.status.config) : null;
8010
8021
  if (cfg && cfg.notifyCards === false) setToasts((prev) => prev.length ? [] : prev);
8011
8022
  }, [snap.status]);
8012
- (0, import_react10.useEffect)(() => {
8023
+ (0, import_react7.useEffect)(() => {
8013
8024
  let stopped = false;
8014
8025
  let timer = null;
8015
8026
  const loop = async () => {
@@ -8029,7 +8040,7 @@ function NotifyOverlay(props) {
8029
8040
  document.removeEventListener("visibilitychange", onVisible);
8030
8041
  };
8031
8042
  }, []);
8032
- (0, import_react10.useEffect)(() => {
8043
+ (0, import_react7.useEffect)(() => {
8033
8044
  const st = snap.status;
8034
8045
  if (!st || !st.active) return;
8035
8046
  const prev = prevActiveRef.current;
@@ -8043,7 +8054,7 @@ function NotifyOverlay(props) {
8043
8054
  }
8044
8055
  prevActiveRef.current = st.active.slice();
8045
8056
  }, [snap.status]);
8046
- (0, import_react10.useEffect)(() => {
8057
+ (0, import_react7.useEffect)(() => {
8047
8058
  const st = snap.status;
8048
8059
  if (!st || !st.active) return;
8049
8060
  const cfg = effectiveNotifyConfig(st.config || {});
@@ -8103,7 +8114,7 @@ function NotifyOverlay(props) {
8103
8114
  }
8104
8115
  }
8105
8116
  }, [snap.status]);
8106
- (0, import_react10.useEffect)(() => {
8117
+ (0, import_react7.useEffect)(() => {
8107
8118
  const st = snap.status;
8108
8119
  if (!st || !st.active) return;
8109
8120
  const cfg = effectiveNotifyConfig(st.config || {});
@@ -8158,7 +8169,7 @@ function NotifyOverlay(props) {
8158
8169
  }
8159
8170
  }
8160
8171
  }, [snap.status]);
8161
- (0, import_react10.useEffect)(() => {
8172
+ (0, import_react7.useEffect)(() => {
8162
8173
  const st = snap.status;
8163
8174
  if (!st || !st.active) return;
8164
8175
  const live = /* @__PURE__ */ new Set();
@@ -8178,7 +8189,7 @@ function NotifyOverlay(props) {
8178
8189
  return changed ? next : prev;
8179
8190
  });
8180
8191
  }, [snap.status]);
8181
- (0, import_react10.useEffect)(() => {
8192
+ (0, import_react7.useEffect)(() => {
8182
8193
  const timer = setInterval(() => {
8183
8194
  if (!pageVisible()) return;
8184
8195
  const cur = currentSelectedSession();
@@ -8198,8 +8209,8 @@ function NotifyOverlay(props) {
8198
8209
  }, 500);
8199
8210
  return () => clearInterval(timer);
8200
8211
  }, []);
8201
- const stuckSeenRef = (0, import_react10.useRef)(/* @__PURE__ */ new Map());
8202
- (0, import_react10.useEffect)(() => {
8212
+ const stuckSeenRef = (0, import_react7.useRef)(/* @__PURE__ */ new Map());
8213
+ (0, import_react7.useEffect)(() => {
8203
8214
  const st = snap.status;
8204
8215
  if (!st || !st.active) return;
8205
8216
  const cfg = effectiveNotifyConfig(st.config || {});
@@ -8255,7 +8266,7 @@ function NotifyOverlay(props) {
8255
8266
  });
8256
8267
  }
8257
8268
  }, [snap.status]);
8258
- (0, import_react10.useEffect)(() => {
8269
+ (0, import_react7.useEffect)(() => {
8259
8270
  const st = snap.status;
8260
8271
  if (!st || !st.active) return;
8261
8272
  const byId = new Map(st.active.map((x) => [x.sessionId, x]));
@@ -8273,26 +8284,46 @@ function NotifyOverlay(props) {
8273
8284
  });
8274
8285
  }, [snap.status]);
8275
8286
  const handleTaskEnd = (task, record, cfg) => {
8287
+ setToasts((prev) => {
8288
+ let changed = false;
8289
+ const next = prev.map((x) => {
8290
+ if (x.kind === "stuck" && !x.closing && x.sessionId && task && x.sessionId === task.sessionId) {
8291
+ changed = true;
8292
+ return Object.assign({}, x, { closing: true });
8293
+ }
8294
+ return x;
8295
+ });
8296
+ return changed ? next : prev;
8297
+ });
8276
8298
  const reason = record && record.endReason || "";
8277
8299
  const success = isSuccessReason2(reason);
8278
8300
  const info = endInfo(reason);
8279
8301
  const event = success ? "complete" : "error";
8302
+ const sub = !!(record && record.isSubtask || task.isSubtask);
8303
+ const parentId = record && record.parentSessionId || task.parentSessionId || "";
8304
+ let parentTitle = record && record.parentTitle || task.parentTitle || "";
8305
+ if (sub && !parentTitle && parentId) {
8306
+ const p = (snap.status && snap.status.active || []).find((x) => x.sessionId === parentId);
8307
+ if (p && p.title) parentTitle = p.title;
8308
+ }
8309
+ const endRecord = Object.assign({}, record || {}, { isSubtask: sub, parentTitle });
8280
8310
  const cardWanted = eventEnabled(cfg, "card", event);
8281
8311
  const soundWanted = cfg.soundNotify !== false && eventEnabled(cfg, "sound", event);
8282
8312
  const systemWanted = !!cfg.systemNotify && eventEnabled(cfg, "system", event);
8283
8313
  if (voiceAllowed(cfg) && eventEnabled(cfg, "voice", event)) {
8284
- speakVoice(endBroadcastText(success, record, task, cfg), cfg);
8314
+ speakVoice(endBroadcastText(success, endRecord, task, cfg), cfg);
8285
8315
  }
8286
8316
  const models = record && record.models && record.models.length ? record.models.join(", ") : task.models && task.models.length ? task.models.join(", ") : "\u672A\u77E5\u6A21\u578B";
8287
8317
  const provider = record && record.provider || task.provider || "";
8288
8318
  const startTs = record && record.startTime || task.startTime;
8289
8319
  const endTs = record && record.endTime || Date.now();
8290
8320
  const durText = fmtDur(record && record.duration || endTs - startTs);
8291
- const title = success ? "\u4EFB\u52A1\u5B8C\u6210" : "\u4EFB\u52A1" + info.label;
8321
+ const title = success ? sub ? "\u5B50\u4EFB\u52A1\u5B8C\u6210" : "\u4EFB\u52A1\u5B8C\u6210" : (sub ? "\u5B50\u4EFB\u52A1" : "\u4EFB\u52A1") + info.label;
8292
8322
  const showTitle = record && record.title || task.title || "(\u65E0\u6807\u9898)";
8293
8323
  if (cardWanted) {
8294
8324
  const tone = cardTone(cfg);
8295
- const lines = ["\u4EFB\u52A1\uFF1A" + showTitle];
8325
+ const lines = [(sub ? "\u5B50\u4EFB\u52A1\uFF1A" : "\u4EFB\u52A1\uFF1A") + showTitle];
8326
+ if (sub) lines.push("\u4E3B\u4EFB\u52A1\uFF1A" + (parentTitle || "\uFF08\u672A\u77E5\uFF09"));
8296
8327
  if (tone !== "brief") lines.push("\u6A21\u578B\uFF1A" + models + (provider ? "\uFF08" + provider + "\uFF09" : ""));
8297
8328
  lines.push(tone === "brief" ? "\u8017\u65F6\uFF1A" + durText : "\u8017\u65F6\uFF1A" + durText + "\uFF08" + fmtTime2(startTs) + " \u2192 " + fmtTime2(endTs) + "\uFF09");
8298
8329
  if (tone === "detailed") {
@@ -8310,14 +8341,16 @@ function NotifyOverlay(props) {
8310
8341
  // 看到了结果,巡检 effect 据此自动收起卡片。没看过就一直挂着。
8311
8342
  // sessionId 是权威标识(跳转/对账都用它),标题只作旧宿主回退。
8312
8343
  sessionId: task.sessionId || "",
8313
- sessionTitle: showTitle
8344
+ sessionTitle: showTitle,
8345
+ // 子任务会话通常不在侧栏里:跳不到自己时回退到父会话(与卡住卡同款)
8346
+ fallbackSessionId: sub && parentId ? parentId : ""
8314
8347
  });
8315
8348
  }
8316
8349
  if (soundWanted) playDoneSound(success, cfg.soundEffect);
8317
8350
  if (systemWanted && typeof document !== "undefined" && document.hidden && typeof Notification !== "undefined" && Notification.permission === "granted") {
8318
8351
  try {
8319
8352
  new Notification("dsh " + title, {
8320
- body: showTitle + " \xB7 " + durText,
8353
+ body: (sub ? (parentTitle ? "\u4E3B\u4EFB\u52A1\u300C" + truncate2(parentTitle, 20) + "\u300D\u7684" : "") + "\u5B50\u4EFB\u52A1\u300C" + showTitle + "\u300D" : showTitle) + " \xB7 " + durText,
8321
8354
  tag: "dsh-dock-notify-" + task.sessionId
8322
8355
  });
8323
8356
  } catch {
@@ -8451,20 +8484,20 @@ function NotifyView(props) {
8451
8484
  const voices = useLocalVoices();
8452
8485
  const [voiceClientOn, setVoiceClientOn] = useVoiceClientEnabled();
8453
8486
  const [source, setSource] = useNotifyConfigSource();
8454
- const [tab, setTab] = (0, import_react10.useState)("events");
8455
- const [clientCfg, setClientCfg] = (0, import_react10.useState)(() => readClientNotifyConfig());
8456
- const [serverDraft, setServerDraft] = (0, import_react10.useState)(null);
8457
- const [saveErr, setSaveErr] = (0, import_react10.useState)("");
8458
- const [testing, setTesting] = (0, import_react10.useState)(false);
8459
- const [testState, setTestState] = (0, import_react10.useState)(null);
8460
- const [feishuTesting, setFeishuTesting] = (0, import_react10.useState)(false);
8461
- const [feishuTestState, setFeishuTestState] = (0, import_react10.useState)(null);
8462
- const cfgRef = (0, import_react10.useRef)(null);
8463
- const pendingSavesRef = (0, import_react10.useRef)(0);
8464
- const editingWebhookRef = (0, import_react10.useRef)(false);
8465
- const editingFeishuRef = (0, import_react10.useRef)(false);
8487
+ const [tab, setTab] = (0, import_react7.useState)("events");
8488
+ const [clientCfg, setClientCfg] = (0, import_react7.useState)(() => readClientNotifyConfig());
8489
+ const [serverDraft, setServerDraft] = (0, import_react7.useState)(null);
8490
+ const [saveErr, setSaveErr] = (0, import_react7.useState)("");
8491
+ const [testing, setTesting] = (0, import_react7.useState)(false);
8492
+ const [testState, setTestState] = (0, import_react7.useState)(null);
8493
+ const [feishuTesting, setFeishuTesting] = (0, import_react7.useState)(false);
8494
+ const [feishuTestState, setFeishuTestState] = (0, import_react7.useState)(null);
8495
+ const cfgRef = (0, import_react7.useRef)(null);
8496
+ const pendingSavesRef = (0, import_react7.useRef)(0);
8497
+ const editingWebhookRef = (0, import_react7.useRef)(false);
8498
+ const editingFeishuRef = (0, import_react7.useRef)(false);
8466
8499
  const serverCfg = snap.status && snap.status.config;
8467
- (0, import_react10.useEffect)(() => {
8500
+ (0, import_react7.useEffect)(() => {
8468
8501
  if (!serverCfg) return;
8469
8502
  if (pendingSavesRef.current > 0 || editingWebhookRef.current || editingFeishuRef.current) return;
8470
8503
  if (serverCfg !== cfgRef.current) {
@@ -8472,13 +8505,13 @@ function NotifyView(props) {
8472
8505
  setServerDraft(Object.assign({}, serverCfg));
8473
8506
  }
8474
8507
  }, [snap.status]);
8475
- (0, import_react10.useEffect)(() => {
8508
+ (0, import_react7.useEffect)(() => {
8476
8509
  if (source !== "client" || clientCfg || !serverCfg) return;
8477
8510
  const clone = pickClientConfig(serverCfg);
8478
8511
  writeClientNotifyConfig(clone);
8479
8512
  setClientCfg(clone);
8480
8513
  }, [source, clientCfg, serverCfg]);
8481
- (0, import_react10.useEffect)(() => {
8514
+ (0, import_react7.useEffect)(() => {
8482
8515
  if (!notifyStore.snap.status) notifyStore.refresh();
8483
8516
  }, []);
8484
8517
  const cfg = source === "client" ? clientCfg ? mergeClientNotifyConfig(serverCfg, clientCfg) : null : serverDraft || serverCfg;
@@ -8685,7 +8718,7 @@ function NotifyView(props) {
8685
8718
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row", children: [
8686
8719
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "\u6B63\u6587\u53E3\u5F84" }),
8687
8720
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ModePicker, { value: cardTone(cfg), title: "\u9875\u5185\u5361\u7247\u6B63\u6587", onChange: (v) => patch({ cardMode: v }) }),
8688
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1D\u4EFB\u52A1\u4E0E\u8017\u65F6 / \u8C01\u5361\u4F4F\uFF1B\u9002\u4E2D\uFF1D\u52A0\u6A21\u578B\u3001\u8D77\u6B62\u65F6\u95F4\u3001\u505C\u6EDE\u65F6\u957F\uFF1B\u8BE6\u7EC6\uFF1D\u5168\u90E8\uFF08\u56DE\u5408\u6B65\u9AA4\u3001Token\u3001\u6458\u8981\u6216\u9519\u8BEF\u3001\u6700\u540E\u52A8\u4F5C\uFF09" })
8721
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1D\u4EFB\u52A1\u4E0E\u8017\u65F6 / \u8C01\u5361\u4F4F\uFF1B\u9002\u4E2D\uFF1D\u52A0\u6A21\u578B\u3001\u8D77\u6B62\u65F6\u95F4\u3001\u505C\u6EDE\u65F6\u957F\uFF1B\u8BE6\u7EC6\uFF1D\u5168\u90E8\uFF08\u56DE\u5408\u6B65\u9AA4\u3001Token\u3001\u6458\u8981\u6216\u9519\u8BEF\u3001\u6700\u540E\u52A8\u4F5C\uFF09\u3002\u5B50\u4EFB\u52A1\u7ED3\u675F\u6807\u300C\u5B50\u4EFB\u52A1\u300D\u5E76\u70B9\u540D\u4E3B\u4EFB\u52A1\uFF08\u4E09\u6321\u90FD\u5E26\u5F52\u5C5E\uFF09" })
8689
8722
  ] }),
8690
8723
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row", children: [
8691
8724
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "\u5361\u7247\u6536\u7EB3" }),
@@ -8834,7 +8867,7 @@ function NotifyView(props) {
8834
8867
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row", children: [
8835
8868
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "\u64AD\u62A5\u53E3\u5F84" }),
8836
8869
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ModePicker, { value: voiceTone(cfg), title: "\u8BED\u97F3\u64AD\u62A5", onChange: (v) => patch({ voiceMode: v }) }),
8837
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1A\u4E00\u53E5\u300C\u4EFB\u52A1\u5B8C\u6210 / \u4EFB\u52A1\u505C\u6B62\u4E86 / \u4EFB\u52A1\u9700\u8981\u6388\u6743 / \u4E3B\u4EFB\u52A1\uFF08\u6216\u5B50\u4EFB\u52A1\uFF09\xB7\u6807\u9898 \u5361\u4F4F\u4E86\u300D\uFF1B\u9002\u4E2D\uFF1A\u70B9\u540D\u4EFB\u52A1\uFF0C\u7ED3\u675F\u5E26\u539F\u56E0\u4E0E\u8017\u65F6\u3001\u5361\u4F4F\u5E26\u505C\u6EDE\u65F6\u957F\uFF1B\u8BE6\u7EC6\uFF1A\u7ED3\u675F\u5E26\u56DE\u5408\u7EDF\u8BA1\u4E0E\u56DE\u590D\u6458\u8981\uFF0C\u9700\u6388\u6743\u5E26\u5DE5\u5177\u540D\uFF0C\u5361\u4F4F\u5E26\u6700\u540E\u52A8\u4F5C\u3002" })
8870
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1A\u4E00\u53E5\u300C\u4EFB\u52A1\u5B8C\u6210 / \u5B50\u4EFB\u52A1\u5B8C\u6210 / \u4EFB\u52A1\u505C\u6B62\u4E86 / \u4EFB\u52A1\u9700\u8981\u6388\u6743 / \u4E3B\u4EFB\u52A1\uFF08\u6216\u5B50\u4EFB\u52A1\uFF09\xB7\u6807\u9898 \u5361\u4F4F\u4E86\u300D\uFF1B\u9002\u4E2D\uFF1A\u70B9\u540D\u4EFB\u52A1\uFF08\u5B50\u4EFB\u52A1\u8FDE\u4E3B\u4EFB\u52A1\u4E00\u8D77\u70B9\u540D\uFF09\uFF0C\u7ED3\u675F\u5E26\u539F\u56E0\u4E0E\u8017\u65F6\u3001\u5361\u4F4F\u5E26\u505C\u6EDE\u65F6\u957F\uFF1B\u8BE6\u7EC6\uFF1A\u7ED3\u675F\u5E26\u56DE\u5408\u7EDF\u8BA1\u4E0E\u56DE\u590D\u6458\u8981\uFF0C\u9700\u6388\u6743\u5E26\u5DE5\u5177\u540D\uFF0C\u5361\u4F4F\u5E26\u6700\u540E\u52A8\u4F5C\u3002" })
8838
8871
  ] }),
8839
8872
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row", children: [
8840
8873
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "\u64AD\u62A5\u4E8B\u4EF6" }),
@@ -8994,7 +9027,7 @@ function NotifyView(props) {
8994
9027
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row", children: [
8995
9028
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "\u6D88\u606F\u53E3\u5F84" }),
8996
9029
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ModePicker, { value: cfg.pushMode || "detailed", title: "\u9489\u9489\u6D88\u606F", onChange: (v) => patch({ pushMode: v }) }),
8997
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1D\u4EFB\u52A1\u4E0E\u7ED3\u679C\uFF1B\u9002\u4E2D\uFF1D\u52A0\u6A21\u578B/\u8017\u65F6\uFF1B\u8BE6\u7EC6\uFF1D\u518D\u52A0\u56DE\u5408\u3001Token \u4E0E\u6458\u8981\u3002" })
9030
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1D\u4EFB\u52A1\u4E0E\u7ED3\u679C\uFF1B\u9002\u4E2D\uFF1D\u52A0\u6A21\u578B/\u8017\u65F6\uFF1B\u8BE6\u7EC6\uFF1D\u518D\u52A0\u56DE\u5408\u3001Token \u4E0E\u6458\u8981\u3002\u5B50\u4EFB\u52A1\u7ED3\u675F\u6807\u300C\u5B50\u4EFB\u52A1\u300D\u5E76\u70B9\u540D\u4E3B\u4EFB\u52A1\uFF08\u4E09\u6321\u90FD\u5E26\u5F52\u5C5E\uFF09\u3002" })
8998
9031
  ] }),
8999
9032
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row dknt-row-webhook", children: [
9000
9033
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "Webhook" }),
@@ -9062,7 +9095,7 @@ function NotifyView(props) {
9062
9095
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row", children: [
9063
9096
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "\u6D88\u606F\u53E3\u5F84" }),
9064
9097
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ModePicker, { value: cfg.pushMode || "detailed", title: "\u98DE\u4E66\u6D88\u606F", onChange: (v) => patch({ pushMode: v }) }),
9065
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1D\u4EFB\u52A1\u4E0E\u7ED3\u679C\uFF1B\u9002\u4E2D\uFF1D\u52A0\u6A21\u578B/\u8017\u65F6\uFF1B\u8BE6\u7EC6\uFF1D\u518D\u52A0\u56DE\u5408\u3001Token \u4E0E\u6458\u8981\u3002" })
9098
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-sub", children: "\u7B80\u6D01\uFF1D\u4EFB\u52A1\u4E0E\u7ED3\u679C\uFF1B\u9002\u4E2D\uFF1D\u52A0\u6A21\u578B/\u8017\u65F6\uFF1B\u8BE6\u7EC6\uFF1D\u518D\u52A0\u56DE\u5408\u3001Token \u4E0E\u6458\u8981\u3002\u5B50\u4EFB\u52A1\u7ED3\u675F\u6807\u300C\u5B50\u4EFB\u52A1\u300D\u5E76\u70B9\u540D\u4E3B\u4EFB\u52A1\uFF08\u4E09\u6321\u90FD\u5E26\u5F52\u5C5E\uFF09\u3002" })
9066
9099
  ] }),
9067
9100
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "dknt-row dknt-row-webhook", children: [
9068
9101
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "dknt-row-label", children: "Webhook" }),
@@ -9232,7 +9265,7 @@ var css3 = [
9232
9265
  ".dknt-btn:hover{background:var(--dsw-alias-interactive-bg-hover);}",
9233
9266
  ".dknt-btn[disabled]{opacity:.5;cursor:default;}"
9234
9267
  ].join("\n");
9235
- var feature8 = {
9268
+ var feature6 = {
9236
9269
  id: "notify",
9237
9270
  name: "\u4EFB\u52A1\u901A\u77E5",
9238
9271
  order: 140,
@@ -9245,7 +9278,7 @@ var feature8 = {
9245
9278
  };
9246
9279
 
9247
9280
  // features/runstate/view.jsx
9248
- var import_react11 = require("react");
9281
+ var import_react8 = require("react");
9249
9282
  var import_jsx_runtime4 = require("react/jsx-runtime");
9250
9283
  function rpcCall4(method, args) {
9251
9284
  return fetch("dsh-dock/runstate/" + method, {
@@ -9332,8 +9365,8 @@ var runStateStore = {
9332
9365
  }
9333
9366
  };
9334
9367
  function useRunState() {
9335
- const [snap, setSnap] = (0, import_react11.useState)(runStateStore.snap);
9336
- (0, import_react11.useEffect)(() => runStateStore.subscribe(() => setSnap(runStateStore.snap)), []);
9368
+ const [snap, setSnap] = (0, import_react8.useState)(runStateStore.snap);
9369
+ (0, import_react8.useEffect)(() => runStateStore.subscribe(() => setSnap(runStateStore.snap)), []);
9337
9370
  return snap;
9338
9371
  }
9339
9372
  function waitingOf(active) {
@@ -9372,7 +9405,7 @@ function RunStateView() {
9372
9405
  const waitApprovals = (active || []).reduce((n, t) => n + taskApprovals(t).length, 0);
9373
9406
  const waitQuestions = (active || []).reduce((n, t) => n + taskQuestions(t).length, 0);
9374
9407
  const waitBannerHint = waitApprovals > 0 && waitQuestions > 0 ? waitApprovals + " \u9879\u7B49\u6279\u51C6\u3001" + waitQuestions + " \u9879\u7B49\u4F60\u56DE\u7B54" : waitApprovals > 0 ? "\u4EFB\u52A1\u505C\u5728\u9700\u8981\u4F60\u6279\u51C6\u7684\u6B65\u9AA4\u4E0A" : "\u4EFB\u52A1\u5728\u7B49\u4F60\u56DE\u7B54\u95EE\u9898";
9375
- (0, import_react11.useEffect)(() => {
9408
+ (0, import_react8.useEffect)(() => {
9376
9409
  let stopped = false;
9377
9410
  let timer = null;
9378
9411
  const loop = async () => {
@@ -9413,7 +9446,7 @@ function RunStateView() {
9413
9446
  }
9414
9447
  function RunStateStat(props) {
9415
9448
  const snap = useRunState();
9416
- (0, import_react11.useEffect)(() => {
9449
+ (0, import_react8.useEffect)(() => {
9417
9450
  if (!runStateStore.snap.status) runStateStore.refresh();
9418
9451
  }, []);
9419
9452
  const st = snap.status;
@@ -9464,7 +9497,7 @@ var css4 = [
9464
9497
  ".dkrs-tag.err{color:var(--dsw-alias-state-error-primary);border-color:currentColor;}",
9465
9498
  ".dkrs-tag.warn{color:var(--dk-warn);border-color:currentColor;}"
9466
9499
  ].join("\n");
9467
- var feature9 = {
9500
+ var feature7 = {
9468
9501
  id: "runstate",
9469
9502
  name: "\u8FD0\u884C\u72B6\u6001",
9470
9503
  order: 150,
@@ -9476,7 +9509,7 @@ var feature9 = {
9476
9509
  };
9477
9510
 
9478
9511
  // features/tts/view.jsx
9479
- var import_react12 = __toESM(require("react"), 1);
9512
+ var import_react9 = __toESM(require("react"), 1);
9480
9513
  function synth() {
9481
9514
  try {
9482
9515
  const g = typeof globalThis !== "undefined" ? globalThis : null;
@@ -9576,8 +9609,8 @@ function subscribeConfig(fn) {
9576
9609
  };
9577
9610
  }
9578
9611
  function useConfig() {
9579
- const [, force] = (0, import_react12.useState)(0);
9580
- (0, import_react12.useEffect)(() => subscribeConfig(() => force((n) => n + 1)), []);
9612
+ const [, force] = (0, import_react9.useState)(0);
9613
+ (0, import_react9.useEffect)(() => subscribeConfig(() => force((n) => n + 1)), []);
9581
9614
  return configStore.value;
9582
9615
  }
9583
9616
  var HOST_SAVE_DEBOUNCE_MS = 400;
@@ -9798,8 +9831,8 @@ function subscribeEngine(fn) {
9798
9831
  };
9799
9832
  }
9800
9833
  function useEngineState() {
9801
- const [snap, setSnap] = (0, import_react12.useState)(engineSnapshot());
9802
- (0, import_react12.useEffect)(() => subscribeEngine(() => setSnap(engineSnapshot())), []);
9834
+ const [snap, setSnap] = (0, import_react9.useState)(engineSnapshot());
9835
+ (0, import_react9.useEffect)(() => subscribeEngine(() => setSnap(engineSnapshot())), []);
9803
9836
  return snap;
9804
9837
  }
9805
9838
  function setEngineState(next) {
@@ -9978,7 +10011,7 @@ function closingMarkdown(owner) {
9978
10011
  for (const b of blocks) if (b && b.kind === "text" && typeof b.text === "string") parts.push(b.text);
9979
10012
  return parts.join("");
9980
10013
  }
9981
- var ICON_SPEAKER = import_react12.default.createElement(
10014
+ var ICON_SPEAKER = import_react9.default.createElement(
9982
10015
  "svg",
9983
10016
  {
9984
10017
  viewBox: "0 0 24 24",
@@ -9989,11 +10022,11 @@ var ICON_SPEAKER = import_react12.default.createElement(
9989
10022
  strokeLinejoin: "round",
9990
10023
  "aria-hidden": "true"
9991
10024
  },
9992
- import_react12.default.createElement("path", { d: "M11 5 6 9H3v6h3l5 4z" }),
9993
- import_react12.default.createElement("path", { d: "M15.5 8.5a5 5 0 0 1 0 7" }),
9994
- import_react12.default.createElement("path", { d: "M18.5 5.5a9 9 0 0 1 0 13" })
10025
+ import_react9.default.createElement("path", { d: "M11 5 6 9H3v6h3l5 4z" }),
10026
+ import_react9.default.createElement("path", { d: "M15.5 8.5a5 5 0 0 1 0 7" }),
10027
+ import_react9.default.createElement("path", { d: "M18.5 5.5a9 9 0 0 1 0 13" })
9995
10028
  );
9996
- var ICON_PAUSE = import_react12.default.createElement(
10029
+ var ICON_PAUSE = import_react9.default.createElement(
9997
10030
  "svg",
9998
10031
  {
9999
10032
  viewBox: "0 0 24 24",
@@ -10003,10 +10036,10 @@ var ICON_PAUSE = import_react12.default.createElement(
10003
10036
  strokeLinecap: "round",
10004
10037
  "aria-hidden": "true"
10005
10038
  },
10006
- import_react12.default.createElement("path", { d: "M9 6v12" }),
10007
- import_react12.default.createElement("path", { d: "M15 6v12" })
10039
+ import_react9.default.createElement("path", { d: "M9 6v12" }),
10040
+ import_react9.default.createElement("path", { d: "M15 6v12" })
10008
10041
  );
10009
- var ICON_RESUME = import_react12.default.createElement(
10042
+ var ICON_RESUME = import_react9.default.createElement(
10010
10043
  "svg",
10011
10044
  {
10012
10045
  viewBox: "0 0 24 24",
@@ -10017,9 +10050,9 @@ var ICON_RESUME = import_react12.default.createElement(
10017
10050
  strokeLinejoin: "round",
10018
10051
  "aria-hidden": "true"
10019
10052
  },
10020
- import_react12.default.createElement("path", { d: "M8 5.5v13l11-6.5z" })
10053
+ import_react9.default.createElement("path", { d: "M8 5.5v13l11-6.5z" })
10021
10054
  );
10022
- var ICON_RESTART = import_react12.default.createElement(
10055
+ var ICON_RESTART = import_react9.default.createElement(
10023
10056
  "svg",
10024
10057
  {
10025
10058
  viewBox: "0 0 24 24",
@@ -10030,11 +10063,11 @@ var ICON_RESTART = import_react12.default.createElement(
10030
10063
  strokeLinejoin: "round",
10031
10064
  "aria-hidden": "true"
10032
10065
  },
10033
- import_react12.default.createElement("path", { d: "M3.5 8.5V4.5" }),
10034
- import_react12.default.createElement("path", { d: "M3.5 8.5h4" }),
10035
- import_react12.default.createElement("path", { d: "M5.6 5.1a8.5 8.5 0 1 1-2.1 5.4" })
10066
+ import_react9.default.createElement("path", { d: "M3.5 8.5V4.5" }),
10067
+ import_react9.default.createElement("path", { d: "M3.5 8.5h4" }),
10068
+ import_react9.default.createElement("path", { d: "M5.6 5.1a8.5 8.5 0 1 1-2.1 5.4" })
10036
10069
  );
10037
- var ICON_STOP = import_react12.default.createElement(
10070
+ var ICON_STOP = import_react9.default.createElement(
10038
10071
  "svg",
10039
10072
  {
10040
10073
  viewBox: "0 0 24 24",
@@ -10044,9 +10077,9 @@ var ICON_STOP = import_react12.default.createElement(
10044
10077
  strokeLinejoin: "round",
10045
10078
  "aria-hidden": "true"
10046
10079
  },
10047
- import_react12.default.createElement("rect", { x: "6.5", y: "6.5", width: "11", height: "11", rx: "2" })
10080
+ import_react9.default.createElement("rect", { x: "6.5", y: "6.5", width: "11", height: "11", rx: "2" })
10048
10081
  );
10049
- var ICON_GEAR = import_react12.default.createElement(
10082
+ var ICON_GEAR = import_react9.default.createElement(
10050
10083
  "svg",
10051
10084
  {
10052
10085
  viewBox: "0 0 24 24",
@@ -10057,14 +10090,14 @@ var ICON_GEAR = import_react12.default.createElement(
10057
10090
  strokeLinejoin: "round",
10058
10091
  "aria-hidden": "true"
10059
10092
  },
10060
- import_react12.default.createElement("circle", { cx: "12", cy: "12", r: "3.2" }),
10061
- import_react12.default.createElement("path", { d: "M12 2.8v3M12 18.2v3M2.8 12h3M18.2 12h3M5.5 5.5l2.1 2.1M16.4 16.4l2.1 2.1M18.5 5.5l-2.1 2.1M7.6 16.4l-2.1 2.1" })
10093
+ import_react9.default.createElement("circle", { cx: "12", cy: "12", r: "3.2" }),
10094
+ import_react9.default.createElement("path", { d: "M12 2.8v3M12 18.2v3M2.8 12h3M18.2 12h3M5.5 5.5l2.1 2.1M16.4 16.4l2.1 2.1M18.5 5.5l-2.1 2.1M7.6 16.4l-2.1 2.1" })
10062
10095
  );
10063
10096
  function TtsQuickPop(props) {
10064
10097
  const cfg = useConfig();
10065
10098
  const anchor = props.anchor || { x: 120, y: 120 };
10066
- const boxRef = (0, import_react12.useRef)(null);
10067
- (0, import_react12.useEffect)(() => {
10099
+ const boxRef = (0, import_react9.useRef)(null);
10100
+ (0, import_react9.useEffect)(() => {
10068
10101
  if (typeof document === "undefined") return void 0;
10069
10102
  const onDown = (e) => {
10070
10103
  if (boxRef.current && !boxRef.current.contains(e.target)) props.onClose();
@@ -10082,7 +10115,7 @@ function TtsQuickPop(props) {
10082
10115
  const vw = typeof globalThis !== "undefined" && globalThis.innerWidth ? globalThis.innerWidth : 1440;
10083
10116
  const left = Math.max(8, Math.min(anchor.x - 4, vw - 256));
10084
10117
  const portalTarget = typeof document !== "undefined" && document.body ? document.body : null;
10085
- const pop = import_react12.default.createElement(
10118
+ const pop = import_react9.default.createElement(
10086
10119
  "div",
10087
10120
  {
10088
10121
  ref: boxRef,
@@ -10091,11 +10124,11 @@ function TtsQuickPop(props) {
10091
10124
  role: "dialog",
10092
10125
  "aria-label": "\u6717\u8BFB\u5FEB\u901F\u8BBE\u7F6E"
10093
10126
  },
10094
- import_react12.default.createElement(
10127
+ import_react9.default.createElement(
10095
10128
  "div",
10096
10129
  { className: "dktts-pop-h" },
10097
- import_react12.default.createElement("b", null, "\u6717\u8BFB\u8BBE\u7F6E"),
10098
- import_react12.default.createElement("button", {
10130
+ import_react9.default.createElement("b", null, "\u6717\u8BFB\u8BBE\u7F6E"),
10131
+ import_react9.default.createElement("button", {
10099
10132
  type: "button",
10100
10133
  className: "dktts-pop-x",
10101
10134
  "aria-label": "\u5173\u95ED",
@@ -10103,11 +10136,11 @@ function TtsQuickPop(props) {
10103
10136
  onClick: props.onClose
10104
10137
  }, "\u2715")
10105
10138
  ),
10106
- import_react12.default.createElement(
10139
+ import_react9.default.createElement(
10107
10140
  "div",
10108
10141
  { className: "dktts-pop-row" },
10109
- import_react12.default.createElement("span", null, "\u8BED\u901F"),
10110
- import_react12.default.createElement("input", {
10142
+ import_react9.default.createElement("span", null, "\u8BED\u901F"),
10143
+ import_react9.default.createElement("input", {
10111
10144
  type: "range",
10112
10145
  min: "0.5",
10113
10146
  max: "2",
@@ -10116,13 +10149,13 @@ function TtsQuickPop(props) {
10116
10149
  "aria-label": "\u8BED\u901F",
10117
10150
  onChange: (e) => setConfig({ rate: Number(e.target.value) || 1 })
10118
10151
  }),
10119
- import_react12.default.createElement("span", { className: "dktts-pop-val" }, cfg.rate.toFixed(2) + "\xD7")
10152
+ import_react9.default.createElement("span", { className: "dktts-pop-val" }, cfg.rate.toFixed(2) + "\xD7")
10120
10153
  ),
10121
- import_react12.default.createElement(
10154
+ import_react9.default.createElement(
10122
10155
  "div",
10123
10156
  { className: "dktts-pop-row" },
10124
- import_react12.default.createElement("span", null, "\u97F3\u91CF"),
10125
- import_react12.default.createElement("input", {
10157
+ import_react9.default.createElement("span", null, "\u97F3\u91CF"),
10158
+ import_react9.default.createElement("input", {
10126
10159
  type: "range",
10127
10160
  min: "0",
10128
10161
  max: "1",
@@ -10131,13 +10164,13 @@ function TtsQuickPop(props) {
10131
10164
  "aria-label": "\u97F3\u91CF",
10132
10165
  onChange: (e) => setConfig({ volume: Number(e.target.value) })
10133
10166
  }),
10134
- import_react12.default.createElement("span", { className: "dktts-pop-val" }, Math.round(cfg.volume * 100) + "%")
10167
+ import_react9.default.createElement("span", { className: "dktts-pop-val" }, Math.round(cfg.volume * 100) + "%")
10135
10168
  ),
10136
- import_react12.default.createElement(
10169
+ import_react9.default.createElement(
10137
10170
  "div",
10138
10171
  { className: "dktts-pop-foot" },
10139
- import_react12.default.createElement("span", { className: "dktts-pop-tip" }, "\u4E0B\u4E00\u53E5\u8D77\u751F\u6548"),
10140
- import_react12.default.createElement("button", {
10172
+ import_react9.default.createElement("span", { className: "dktts-pop-tip" }, "\u4E0B\u4E00\u53E5\u8D77\u751F\u6548"),
10173
+ import_react9.default.createElement("button", {
10141
10174
  type: "button",
10142
10175
  className: "dktts-pop-more",
10143
10176
  onClick: () => {
@@ -10147,7 +10180,7 @@ function TtsQuickPop(props) {
10147
10180
  }, "\u66F4\u591A\u8BBE\u7F6E \u2192")
10148
10181
  )
10149
10182
  );
10150
- return portalTarget && typeof import_react12.default.createPortal === "function" ? import_react12.default.createPortal(pop, portalTarget) : pop;
10183
+ return portalTarget && typeof import_react9.default.createPortal === "function" ? import_react9.default.createPortal(pop, portalTarget) : pop;
10151
10184
  }
10152
10185
  var AUTO_PLAY_FRESH_MS = 8e3;
10153
10186
  var BAD_END = { error: 1, aborted: 1, blocked: 1, "max-tokens": 1, interrupted: 1 };
@@ -10177,7 +10210,7 @@ function TtsTurnTail(props) {
10177
10210
  const active = hasText && eng.phase !== "idle" && eng.key === key;
10178
10211
  const paused = active && eng.phase === "paused";
10179
10212
  const playing = active && eng.phase === "playing";
10180
- (0, import_react12.useEffect)(() => {
10213
+ (0, import_react9.useEffect)(() => {
10181
10214
  ensureConfigLoaded();
10182
10215
  }, []);
10183
10216
  const startThis = () => {
@@ -10185,9 +10218,9 @@ function TtsTurnTail(props) {
10185
10218
  const plain = capSpeechText(plainForSpeech(md, configStore.value), configStore.value);
10186
10219
  speak({ key, text: plain, cfg: configStore.value, label: "\u7B2C " + (turnNo + 1) + " \u56DE\u5408" });
10187
10220
  };
10188
- const autoDoneRef = (0, import_react12.useRef)(false);
10189
- const [quick, setQuick] = (0, import_react12.useState)(null);
10190
- (0, import_react12.useEffect)(() => {
10221
+ const autoDoneRef = (0, import_react9.useRef)(false);
10222
+ const [quick, setQuick] = (0, import_react9.useState)(null);
10223
+ (0, import_react9.useEffect)(() => {
10191
10224
  if (autoDoneRef.current) return;
10192
10225
  autoDoneRef.current = true;
10193
10226
  if (!hasText || !supported) return;
@@ -10235,10 +10268,10 @@ function TtsTurnTail(props) {
10235
10268
  ensureConfigLoaded();
10236
10269
  setQuick(rect2 ? { x: rect2.left, y: rect2.bottom } : { x: 120, y: 120 });
10237
10270
  };
10238
- return import_react12.default.createElement(
10271
+ return import_react9.default.createElement(
10239
10272
  "div",
10240
10273
  { className: "dktts-tail" },
10241
- import_react12.default.createElement("button", {
10274
+ import_react9.default.createElement("button", {
10242
10275
  type: "button",
10243
10276
  className: "dktts-btn" + (active ? " on" : "") + (supported ? "" : " off"),
10244
10277
  "aria-label": mainTitle,
@@ -10246,7 +10279,7 @@ function TtsTurnTail(props) {
10246
10279
  title: mainTitle,
10247
10280
  onClick: onMain
10248
10281
  }, playing ? ICON_PAUSE : paused ? ICON_RESUME : ICON_SPEAKER),
10249
- active ? import_react12.default.createElement("button", {
10282
+ active ? import_react9.default.createElement("button", {
10250
10283
  type: "button",
10251
10284
  className: "dktts-btn",
10252
10285
  "aria-label": "\u91CD\u65B0\u6717\u8BFB",
@@ -10255,7 +10288,7 @@ function TtsTurnTail(props) {
10255
10288
  restartSpeech();
10256
10289
  }
10257
10290
  }, ICON_RESTART) : null,
10258
- active ? import_react12.default.createElement("button", {
10291
+ active ? import_react9.default.createElement("button", {
10259
10292
  type: "button",
10260
10293
  className: "dktts-btn",
10261
10294
  "aria-label": "\u505C\u6B62",
@@ -10264,7 +10297,7 @@ function TtsTurnTail(props) {
10264
10297
  stopSpeech();
10265
10298
  }
10266
10299
  }, ICON_STOP) : null,
10267
- import_react12.default.createElement("button", {
10300
+ import_react9.default.createElement("button", {
10268
10301
  type: "button",
10269
10302
  className: "dktts-btn" + (quick ? " on" : ""),
10270
10303
  "aria-label": "\u6717\u8BFB\u8BBE\u7F6E\uFF08\u8BED\u901F / \u97F3\u91CF\uFF09",
@@ -10272,22 +10305,22 @@ function TtsTurnTail(props) {
10272
10305
  title: "\u6717\u8BFB\u8BBE\u7F6E\uFF08\u8BED\u901F / \u97F3\u91CF\uFF09",
10273
10306
  onClick: openQuick
10274
10307
  }, ICON_GEAR),
10275
- import_react12.default.createElement(
10308
+ import_react9.default.createElement(
10276
10309
  "span",
10277
10310
  { className: "dktts-state" + (active ? " on" : "") },
10278
10311
  playing ? "\u6B63\u5728\u6717\u8BFB\u672C\u56DE\u5408" : paused ? "\u5DF2\u6682\u505C \xB7 \u70B9 \u25B6 \u7EE7\u7EED\uFF0C\u4E0D\u91CD\u5934" : ""
10279
10312
  ),
10280
- quick ? import_react12.default.createElement(TtsQuickPop, { anchor: quick, onClose: () => setQuick(null) }) : null
10313
+ quick ? import_react9.default.createElement(TtsQuickPop, { anchor: quick, onClose: () => setQuick(null) }) : null
10281
10314
  );
10282
10315
  }
10283
10316
  function TtsOverlay() {
10284
10317
  const cfg = useConfig();
10285
- const seenRef = (0, import_react12.useRef)(null);
10286
- const primedRef = (0, import_react12.useRef)(false);
10287
- (0, import_react12.useEffect)(() => {
10318
+ const seenRef = (0, import_react9.useRef)(null);
10319
+ const primedRef = (0, import_react9.useRef)(false);
10320
+ (0, import_react9.useEffect)(() => {
10288
10321
  ensureConfigLoaded();
10289
10322
  }, []);
10290
- (0, import_react12.useEffect)(() => {
10323
+ (0, import_react9.useEffect)(() => {
10291
10324
  if (!cfg.autoPlay) return void 0;
10292
10325
  if (!ttsSupported()) return void 0;
10293
10326
  if (seenRef.current === null) seenRef.current = /* @__PURE__ */ new Set();
@@ -10350,17 +10383,17 @@ function TtsOverlay() {
10350
10383
  return null;
10351
10384
  }
10352
10385
  function TtsRow(props) {
10353
- return import_react12.default.createElement(
10386
+ return import_react9.default.createElement(
10354
10387
  "div",
10355
10388
  { className: "dktts-row" },
10356
- import_react12.default.createElement("span", { className: "dktts-label" }, props.label),
10357
- import_react12.default.createElement("span", { className: "dktts-ctl" }, props.children),
10358
- props.note ? import_react12.default.createElement("span", { className: "dktts-note" }, props.note) : null
10389
+ import_react9.default.createElement("span", { className: "dktts-label" }, props.label),
10390
+ import_react9.default.createElement("span", { className: "dktts-ctl" }, props.children),
10391
+ props.note ? import_react9.default.createElement("span", { className: "dktts-note" }, props.note) : null
10359
10392
  );
10360
10393
  }
10361
10394
  function TtsSwitch(props) {
10362
10395
  const on = props.value === true;
10363
- return import_react12.default.createElement(
10396
+ return import_react9.default.createElement(
10364
10397
  "button",
10365
10398
  {
10366
10399
  type: "button",
@@ -10371,17 +10404,17 @@ function TtsSwitch(props) {
10371
10404
  title: on ? "\u5DF2\u542F\u7528\uFF08\u70B9\u51FB\u505C\u7528\uFF09" : "\u5DF2\u505C\u7528\uFF08\u70B9\u51FB\u542F\u7528\uFF09",
10372
10405
  onClick: () => props.onChange(!on)
10373
10406
  },
10374
- import_react12.default.createElement("span", { className: "dktts-sw-dot" }),
10407
+ import_react9.default.createElement("span", { className: "dktts-sw-dot" }),
10375
10408
  on ? "\u542F\u7528" : "\u505C\u7528"
10376
10409
  );
10377
10410
  }
10378
10411
  function TtsView() {
10379
10412
  const cfg = useConfig();
10380
10413
  const eng = useEngineState();
10381
- const [, force] = (0, import_react12.useState)(0);
10382
- const [saved, setSaved] = (0, import_react12.useState)("");
10383
- const voices = (0, import_react12.useRef)(localVoices2());
10384
- (0, import_react12.useEffect)(() => {
10414
+ const [, force] = (0, import_react9.useState)(0);
10415
+ const [saved, setSaved] = (0, import_react9.useState)("");
10416
+ const voices = (0, import_react9.useRef)(localVoices2());
10417
+ (0, import_react9.useEffect)(() => {
10385
10418
  ensureConfigLoaded();
10386
10419
  const s = synth();
10387
10420
  if (!s || typeof s.addEventListener !== "function") return;
@@ -10401,7 +10434,7 @@ function TtsView() {
10401
10434
  }
10402
10435
  };
10403
10436
  }, []);
10404
- (0, import_react12.useEffect)(() => {
10437
+ (0, import_react9.useEffect)(() => {
10405
10438
  if (voices.current.length === 0) {
10406
10439
  voices.current = localVoices2();
10407
10440
  force((n) => n + 1);
@@ -10438,101 +10471,101 @@ function TtsView() {
10438
10471
  if (zh.length) grouped.push(["\u4E2D\u6587\u97F3\u8272", zh]);
10439
10472
  if (other.length) grouped.push(["\u5176\u4ED6\u97F3\u8272", other]);
10440
10473
  }
10441
- return import_react12.default.createElement(
10474
+ return import_react9.default.createElement(
10442
10475
  "div",
10443
10476
  { className: "dktts-root" },
10444
- import_react12.default.createElement(
10477
+ import_react9.default.createElement(
10445
10478
  "div",
10446
10479
  { className: "dktts-intro" },
10447
10480
  "\u773C\u775B\u4E0D\u8212\u670D\u65F6\u8BA9 dsh \u628A\u56DE\u590D\u8BFB\u51FA\u6765\u3002\u7528\u7684\u662F",
10448
- import_react12.default.createElement("b", null, "\u6D4F\u89C8\u5668\u81EA\u5E26\u7684\u8BED\u97F3\u5408\u6210"),
10481
+ import_react9.default.createElement("b", null, "\u6D4F\u89C8\u5668\u81EA\u5E26\u7684\u8BED\u97F3\u5408\u6210"),
10449
10482
  "\uFF08Web Speech API\uFF09\uFF0C\u58F0\u97F3\u4ECE\u4F60\u5F53\u524D\u8FD9\u53F0\u8BBE\u5907\u7684\u626C\u58F0\u5668\u51FA\u6765\uFF0C\u4E0D\u6D88\u8017 token\u3001\u4E0D\u7ECF\u8FC7\u670D\u52A1\u5668\u3002",
10450
10483
  "\u6BCF\u6761\u56DE\u590D\u4E0B\u65B9\u4F1A\u51FA\u73B0\u4E00\u4E2A",
10451
- import_react12.default.createElement("b", null, " \u{1F50A} \u5587\u53ED"),
10484
+ import_react9.default.createElement("b", null, " \u{1F50A} \u5587\u53ED"),
10452
10485
  "\uFF0C\u70B9\u4E00\u4E0B\u5C31\u8BFB\u8FD9\u6761\uFF1B\u4E5F\u53EF\u4EE5\u6253\u5F00\u300C\u81EA\u52A8\u6717\u8BFB\u300D\uFF0C\u56DE\u5408\u7ED3\u675F\u540E\u76F4\u63A5\u8BFB\u6700\u540E\u4E00\u6761\u56DE\u590D\u3002"
10453
10486
  ),
10454
- !supported ? import_react12.default.createElement(
10487
+ !supported ? import_react9.default.createElement(
10455
10488
  "div",
10456
10489
  { className: "dktts-warn" },
10457
10490
  "\u8FD9\u4E2A\u6D4F\u89C8\u5668\u4E0D\u63D0\u4F9B\u8BED\u97F3\u5408\u6210\u80FD\u529B\uFF08speechSynthesis \u4E0D\u53EF\u7528\uFF09\u3002\u6362 Chrome / Edge / Safari \u5373\u53EF\uFF1BLinux \u4E0A\u7684 Chromium \u9700\u8981\u88C5\u8BED\u97F3\u5305\uFF08\u5982 espeak-ng\uFF09\uFF0C\u6216\u5728\u7CFB\u7EDF\u8BBE\u7F6E\u91CC\u6DFB\u52A0\u8BED\u97F3\u3002"
10458
10491
  ) : null,
10459
- supported && list.length === 0 ? import_react12.default.createElement(
10492
+ supported && list.length === 0 ? import_react9.default.createElement(
10460
10493
  "div",
10461
10494
  { className: "dktts-warn" },
10462
10495
  "\u672C\u673A\u6682\u65F6\u8BFB\u4E0D\u5230\u4EFB\u4F55\u97F3\u8272\u3002\u901A\u5E38\u662F\u7CFB\u7EDF\u8FD8\u6CA1\u88C5/\u6CA1\u542F\u7528\u8BED\u97F3\uFF1AWindows \u5230\u300C\u8BBE\u7F6E \u2192 \u65F6\u95F4\u548C\u8BED\u8A00 \u2192 \u8BED\u97F3\u300D\u6DFB\u52A0\u4E2D\u6587\u8BED\u97F3\uFF0CmacOS \u5230\u300C\u7CFB\u7EDF\u8BBE\u7F6E \u2192 \u65E0\u969C\u788D \u2192 \u6717\u8BFB\u5185\u5BB9\u300D\u6DFB\u52A0\u97F3\u8272\uFF0C\u7136\u540E\u5237\u65B0\u9875\u9762\u3002"
10463
10496
  ) : null,
10464
- import_react12.default.createElement(
10497
+ import_react9.default.createElement(
10465
10498
  "div",
10466
10499
  { className: "dktts-card" },
10467
- import_react12.default.createElement("div", { className: "dktts-card-h" }, "\u6717\u8BFB\u65F6\u673A"),
10468
- import_react12.default.createElement(TtsRow, {
10500
+ import_react9.default.createElement("div", { className: "dktts-card-h" }, "\u6717\u8BFB\u65F6\u673A"),
10501
+ import_react9.default.createElement(TtsRow, {
10469
10502
  label: "\u81EA\u52A8\u6717\u8BFB",
10470
10503
  note: "\u56DE\u5408\u7ED3\u675F\u540E\u81EA\u52A8\u8BFB\u6700\u540E\u4E00\u6761\u56DE\u590D\uFF1B\u4F60\u6B63\u5728\u770B\u7684\u8FD9\u6761\u4F1A\u8BDD\u624D\u8BFB\uFF0C\u540E\u53F0\u4F1A\u8BDD\u4E0D\u8BFB\u3002"
10471
- }, import_react12.default.createElement(TtsSwitch, {
10504
+ }, import_react9.default.createElement(TtsSwitch, {
10472
10505
  label: "\u81EA\u52A8\u6717\u8BFB",
10473
10506
  value: cfg.autoPlay,
10474
10507
  onChange: (v) => patch({ autoPlay: v })
10475
10508
  })),
10476
- import_react12.default.createElement(TtsRow, {
10509
+ import_react9.default.createElement(TtsRow, {
10477
10510
  label: "\u51FA\u9519 / \u4E2D\u6B62\u4E5F\u8BFB",
10478
10511
  note: "\u5173\u95ED\u540E\u53EA\u5728\u6B63\u5E38\u5B8C\u6210\u65F6\u8BFB\u3002"
10479
- }, import_react12.default.createElement(TtsSwitch, {
10512
+ }, import_react9.default.createElement(TtsSwitch, {
10480
10513
  label: "\u51FA\u9519\u4E5F\u8BFB",
10481
10514
  value: cfg.autoPlayOnFinish,
10482
10515
  onChange: (v) => patch({ autoPlayOnFinish: v })
10483
10516
  })),
10484
- import_react12.default.createElement(TtsRow, {
10517
+ import_react9.default.createElement(TtsRow, {
10485
10518
  label: "\u65B0\u5185\u5BB9\u6253\u65AD\u5F53\u524D\u6717\u8BFB",
10486
10519
  note: "\u5173\u95ED\u5219\u6392\u961F\uFF1A\u65B0\u7684\u90A3\u6761\u7B49\u5F53\u524D\u8BFB\u5B8C\u518D\u8BFB\uFF08\u53EA\u4FDD\u7559\u6700\u65B0\u4E00\u6761\uFF09\u3002"
10487
- }, import_react12.default.createElement(TtsSwitch, {
10520
+ }, import_react9.default.createElement(TtsSwitch, {
10488
10521
  label: "\u6253\u65AD",
10489
10522
  value: cfg.interruptOnNew,
10490
10523
  onChange: (v) => patch({ interruptOnNew: v })
10491
10524
  }))
10492
10525
  ),
10493
- import_react12.default.createElement(
10526
+ import_react9.default.createElement(
10494
10527
  "div",
10495
10528
  { className: "dktts-card" },
10496
- import_react12.default.createElement("div", { className: "dktts-card-h" }, "\u58F0\u97F3"),
10497
- import_react12.default.createElement(
10529
+ import_react9.default.createElement("div", { className: "dktts-card-h" }, "\u58F0\u97F3"),
10530
+ import_react9.default.createElement(
10498
10531
  TtsRow,
10499
10532
  { label: "\u97F3\u8272", note: "\u97F3\u8272\u662F\u672C\u673A\u6D4F\u89C8\u5668\u7ED9\u7684\uFF0C\u6362\u8BBE\u5907\u53EF\u80FD\u8981\u91CD\u9009\u3002" },
10500
- import_react12.default.createElement(
10533
+ import_react9.default.createElement(
10501
10534
  "select",
10502
10535
  {
10503
10536
  className: "dktts-select",
10504
10537
  value: cfg.voiceURI,
10505
10538
  onChange: (e) => patch({ voiceURI: e.target.value })
10506
10539
  },
10507
- import_react12.default.createElement("option", { value: "" }, "\u81EA\u52A8\uFF08\u6309\u8BED\u8A00\u6311\uFF09"),
10508
- grouped.map(([gname, vs]) => import_react12.default.createElement(
10540
+ import_react9.default.createElement("option", { value: "" }, "\u81EA\u52A8\uFF08\u6309\u8BED\u8A00\u6311\uFF09"),
10541
+ grouped.map(([gname, vs]) => import_react9.default.createElement(
10509
10542
  "optgroup",
10510
10543
  { key: gname, label: gname },
10511
- vs.map((v) => import_react12.default.createElement("option", {
10544
+ vs.map((v) => import_react9.default.createElement("option", {
10512
10545
  key: v.voiceURI,
10513
10546
  value: v.voiceURI
10514
10547
  }, (v.name || v.voiceURI) + "\uFF08" + (v.lang || "?") + "\uFF09"))
10515
10548
  ))
10516
10549
  )
10517
10550
  ),
10518
- import_react12.default.createElement(
10551
+ import_react9.default.createElement(
10519
10552
  TtsRow,
10520
10553
  { label: "\u5F3A\u5236\u8BED\u8A00", note: "\u7559\u7A7A\u5219\u4E2D\u6587\u6587\u672C\u4F18\u5148\u6311\u4E2D\u6587\u97F3\u8272\u3002" },
10521
- import_react12.default.createElement(
10554
+ import_react9.default.createElement(
10522
10555
  "select",
10523
10556
  {
10524
10557
  className: "dktts-select",
10525
10558
  value: cfg.lang,
10526
10559
  onChange: (e) => patch({ lang: e.target.value })
10527
10560
  },
10528
- import_react12.default.createElement("option", { value: "" }, "\u81EA\u52A8"),
10529
- ["zh-CN", "zh-TW", "en-US", "en-GB", "ja-JP", "ko-KR"].map((l) => import_react12.default.createElement("option", {
10561
+ import_react9.default.createElement("option", { value: "" }, "\u81EA\u52A8"),
10562
+ ["zh-CN", "zh-TW", "en-US", "en-GB", "ja-JP", "ko-KR"].map((l) => import_react9.default.createElement("option", {
10530
10563
  key: l,
10531
10564
  value: l
10532
10565
  }, l))
10533
10566
  )
10534
10567
  ),
10535
- import_react12.default.createElement(TtsSlider, {
10568
+ import_react9.default.createElement(TtsSlider, {
10536
10569
  label: "\u8BED\u901F",
10537
10570
  suffix: cfg.rate.toFixed(2) + "\xD7",
10538
10571
  min: "0.5",
@@ -10542,7 +10575,7 @@ function TtsView() {
10542
10575
  aria: "\u8BED\u901F",
10543
10576
  onChange: (v) => patch({ rate: v })
10544
10577
  }),
10545
- import_react12.default.createElement(TtsSlider, {
10578
+ import_react9.default.createElement(TtsSlider, {
10546
10579
  label: "\u97F3\u8C03",
10547
10580
  suffix: cfg.pitch.toFixed(2),
10548
10581
  min: "0",
@@ -10552,7 +10585,7 @@ function TtsView() {
10552
10585
  aria: "\u97F3\u8C03",
10553
10586
  onChange: (v) => patch({ pitch: v })
10554
10587
  }),
10555
- import_react12.default.createElement(TtsSlider, {
10588
+ import_react9.default.createElement(TtsSlider, {
10556
10589
  label: "\u97F3\u91CF",
10557
10590
  suffix: Math.round(cfg.volume * 100) + "%",
10558
10591
  min: "0",
@@ -10563,24 +10596,24 @@ function TtsView() {
10563
10596
  onChange: (v) => patch({ volume: v })
10564
10597
  })
10565
10598
  ),
10566
- import_react12.default.createElement(
10599
+ import_react9.default.createElement(
10567
10600
  "div",
10568
10601
  { className: "dktts-card" },
10569
- import_react12.default.createElement("div", { className: "dktts-card-h" }, "\u5FF5\u4EC0\u4E48\uFF08\u56DE\u590D\u6B63\u6587\u7684\u6E05\u6D17\uFF09"),
10570
- import_react12.default.createElement(
10602
+ import_react9.default.createElement("div", { className: "dktts-card-h" }, "\u5FF5\u4EC0\u4E48\uFF08\u56DE\u590D\u6B63\u6587\u7684\u6E05\u6D17\uFF09"),
10603
+ import_react9.default.createElement(
10571
10604
  TtsRow,
10572
10605
  { label: "\u8DF3\u8FC7\u4EE3\u7801\u5757", note: "\u5173\u95ED\u5219\u8FDE\u4EE3\u7801\u4E00\u8D77\u5FF5\uFF08\u53EA\u53BB\u7B26\u53F7\uFF09\u3002" },
10573
- import_react12.default.createElement(TtsSwitch, { label: "\u8DF3\u8FC7\u4EE3\u7801\u5757", value: cfg.skipCode, onChange: (v) => patch({ skipCode: v }) })
10606
+ import_react9.default.createElement(TtsSwitch, { label: "\u8DF3\u8FC7\u4EE3\u7801\u5757", value: cfg.skipCode, onChange: (v) => patch({ skipCode: v }) })
10574
10607
  ),
10575
- import_react12.default.createElement(
10608
+ import_react9.default.createElement(
10576
10609
  TtsRow,
10577
10610
  { label: "\u8DF3\u8FC7\u8868\u683C", note: "\u8868\u683C\u9010\u683C\u5FF5\u51FA\u6765\u6CA1\u6709\u610F\u4E49\uFF0C\u9ED8\u8BA4\u8DF3\u8FC7\u3002" },
10578
- import_react12.default.createElement(TtsSwitch, { label: "\u8DF3\u8FC7\u8868\u683C", value: cfg.skipTables, onChange: (v) => patch({ skipTables: v }) })
10611
+ import_react9.default.createElement(TtsSwitch, { label: "\u8DF3\u8FC7\u8868\u683C", value: cfg.skipTables, onChange: (v) => patch({ skipTables: v }) })
10579
10612
  ),
10580
- import_react12.default.createElement(
10613
+ import_react9.default.createElement(
10581
10614
  TtsRow,
10582
10615
  { label: "\u53EA\u8BFB\u524D N \u53E5", note: "0 = \u4E0D\u9650\u3002\u60F3\u53EA\u542C\u7ED3\u8BBA\u65F6\u8BBE 3~5 \u53E5\u3002" },
10583
- import_react12.default.createElement("input", {
10616
+ import_react9.default.createElement("input", {
10584
10617
  type: "number",
10585
10618
  className: "dktts-num",
10586
10619
  min: "0",
@@ -10591,10 +10624,10 @@ function TtsView() {
10591
10624
  onChange: (e) => patch({ maxSentences: Math.max(0, Math.round(Number(e.target.value) || 0)) })
10592
10625
  })
10593
10626
  ),
10594
- import_react12.default.createElement(
10627
+ import_react9.default.createElement(
10595
10628
  TtsRow,
10596
10629
  { label: "\u5B57\u6570\u4E0A\u9650", note: "0 = \u4E0D\u9650\uFF1B\u8D85\u51FA\u90E8\u5206\u5FF5\u300C\u4EE5\u4E0B\u7565\u300D\u3002" },
10597
- import_react12.default.createElement("input", {
10630
+ import_react9.default.createElement("input", {
10598
10631
  type: "number",
10599
10632
  className: "dktts-num",
10600
10633
  min: "0",
@@ -10607,20 +10640,20 @@ function TtsView() {
10607
10640
  )
10608
10641
  ),
10609
10642
  // —— 播放控制:试听 + 正在读时的 暂停/继续 · 重新朗读 · 停止 ——
10610
- import_react12.default.createElement(
10643
+ import_react9.default.createElement(
10611
10644
  "div",
10612
10645
  { className: "dktts-card" },
10613
- import_react12.default.createElement("div", { className: "dktts-card-h" }, "\u64AD\u653E\u63A7\u5236"),
10614
- import_react12.default.createElement(
10646
+ import_react9.default.createElement("div", { className: "dktts-card-h" }, "\u64AD\u653E\u63A7\u5236"),
10647
+ import_react9.default.createElement(
10615
10648
  "div",
10616
10649
  { className: "dktts-transport" },
10617
- import_react12.default.createElement("button", {
10650
+ import_react9.default.createElement("button", {
10618
10651
  type: "button",
10619
10652
  className: "dktts-primary",
10620
10653
  onClick: preview,
10621
10654
  disabled: !supported
10622
10655
  }, "\u8BD5\u542C"),
10623
- active ? import_react12.default.createElement("button", {
10656
+ active ? import_react9.default.createElement("button", {
10624
10657
  type: "button",
10625
10658
  className: "dktts-ghost",
10626
10659
  onClick: () => {
@@ -10628,38 +10661,38 @@ function TtsView() {
10628
10661
  else resumeSpeech();
10629
10662
  }
10630
10663
  }, playing ? "\u6682\u505C" : "\u7EE7\u7EED") : null,
10631
- active ? import_react12.default.createElement("button", {
10664
+ active ? import_react9.default.createElement("button", {
10632
10665
  type: "button",
10633
10666
  className: "dktts-ghost",
10634
10667
  onClick: () => {
10635
10668
  restartSpeech();
10636
10669
  }
10637
10670
  }, "\u91CD\u65B0\u6717\u8BFB") : null,
10638
- active ? import_react12.default.createElement("button", {
10671
+ active ? import_react9.default.createElement("button", {
10639
10672
  type: "button",
10640
10673
  className: "dktts-ghost",
10641
10674
  onClick: () => {
10642
10675
  stopSpeech();
10643
10676
  }
10644
10677
  }, "\u505C\u6B62") : null,
10645
- import_react12.default.createElement(
10678
+ import_react9.default.createElement(
10646
10679
  "span",
10647
10680
  { className: "dktts-playing" },
10648
10681
  playing ? "\u6B63\u5728\u6717\u8BFB\uFF1A" + (eng.label || "\u5185\u5BB9") : paused ? "\u5DF2\u6682\u505C\uFF1A" + (eng.label || "\u5185\u5BB9") + "\uFF08\u70B9\u300C\u7EE7\u7EED\u300D\u4E0D\u91CD\u5934\uFF09" : saved ? "\u2713 " + saved : "\u3000"
10649
10682
  )
10650
10683
  )
10651
10684
  ),
10652
- import_react12.default.createElement(
10685
+ import_react9.default.createElement(
10653
10686
  "div",
10654
10687
  { className: "dktts-note-line" },
10655
10688
  "\u63D0\u793A\uFF1A\u6D4F\u89C8\u5668\u8981\u6C42\u300C\u5148\u6709\u7528\u6237\u624B\u52BF\u624D\u5141\u8BB8\u51FA\u58F0\u300D\u3002\u521A\u6253\u5F00\u9875\u9762\u5C31\u81EA\u52A8\u6717\u8BFB\u53EF\u80FD\u88AB\u6D4F\u89C8\u5668\u62E6\u6389\u2014\u2014",
10656
10689
  "\u70B9\u4E00\u4E0B\u9875\u9762\u4E0A\u4EFB\u610F\u4F4D\u7F6E\uFF0C\u6216\u76F4\u63A5\u7528\u56DE\u590D\u4E0B\u65B9\u7684\u5587\u53ED\u6309\u94AE\u3002"
10657
10690
  ),
10658
- configStore.note ? import_react12.default.createElement("div", { className: "dktts-warn" }, configStore.note) : null,
10659
- configStore.routeGone ? import_react12.default.createElement(
10691
+ configStore.note ? import_react9.default.createElement("div", { className: "dktts-warn" }, configStore.note) : null,
10692
+ configStore.routeGone ? import_react9.default.createElement(
10660
10693
  "div",
10661
10694
  { className: "dktts-links" },
10662
- import_react12.default.createElement("button", {
10695
+ import_react9.default.createElement("button", {
10663
10696
  type: "button",
10664
10697
  className: "dktts-ghost",
10665
10698
  onClick: () => {
@@ -10673,14 +10706,14 @@ function TtsView() {
10673
10706
  );
10674
10707
  }
10675
10708
  function TtsSlider(props) {
10676
- return import_react12.default.createElement(
10709
+ return import_react9.default.createElement(
10677
10710
  "div",
10678
10711
  { className: "dktts-row" },
10679
- import_react12.default.createElement("span", { className: "dktts-label" }, props.label),
10680
- import_react12.default.createElement(
10712
+ import_react9.default.createElement("span", { className: "dktts-label" }, props.label),
10713
+ import_react9.default.createElement(
10681
10714
  "span",
10682
10715
  { className: "dktts-slider" },
10683
- import_react12.default.createElement("input", {
10716
+ import_react9.default.createElement("input", {
10684
10717
  type: "range",
10685
10718
  min: props.min,
10686
10719
  max: props.max,
@@ -10689,17 +10722,17 @@ function TtsSlider(props) {
10689
10722
  "aria-label": props.aria,
10690
10723
  onChange: (e) => props.onChange(Number(e.target.value))
10691
10724
  }),
10692
- import_react12.default.createElement("span", { className: "dktts-slider-val" }, props.suffix)
10725
+ import_react9.default.createElement("span", { className: "dktts-slider-val" }, props.suffix)
10693
10726
  ),
10694
10727
  null
10695
10728
  );
10696
10729
  }
10697
10730
  function TtsStat() {
10698
10731
  const cfg = useConfig();
10699
- (0, import_react12.useEffect)(() => {
10732
+ (0, import_react9.useEffect)(() => {
10700
10733
  ensureConfigLoaded();
10701
10734
  }, []);
10702
- return import_react12.default.createElement(
10735
+ return import_react9.default.createElement(
10703
10736
  "span",
10704
10737
  null,
10705
10738
  "\u81EA\u52A8\u6717\u8BFB\uFF1A",
@@ -10769,7 +10802,7 @@ var CSS = [
10769
10802
  ".dktts-pop-more{border:none;background:transparent;color:var(--dk-accent);cursor:pointer;font-size:12px;padding:2px 0;}",
10770
10803
  ".dktts-pop-more:hover{text-decoration:underline;}"
10771
10804
  ].join("\n");
10772
- var feature10 = {
10805
+ var feature8 = {
10773
10806
  id: "tts",
10774
10807
  name: "\u8BED\u97F3\u6717\u8BFB",
10775
10808
  order: 160,
@@ -10786,10 +10819,10 @@ var feature10 = {
10786
10819
  };
10787
10820
 
10788
10821
  // features/games/view.jsx
10789
- var import_react22 = require("react");
10822
+ var import_react19 = require("react");
10790
10823
 
10791
10824
  // features/games/games/shared.jsx
10792
- var import_react13 = require("react");
10825
+ var import_react10 = require("react");
10793
10826
  function isTypingTarget(event) {
10794
10827
  const tag = event.target && event.target.tagName || "";
10795
10828
  if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return true;
@@ -10797,9 +10830,9 @@ function isTypingTarget(event) {
10797
10830
  return false;
10798
10831
  }
10799
10832
  function useGameControls(stageRef, paused, onKeyDown, onKeyUp) {
10800
- const pausedRef = (0, import_react13.useRef)(!!paused);
10833
+ const pausedRef = (0, import_react10.useRef)(!!paused);
10801
10834
  pausedRef.current = !!paused;
10802
- (0, import_react13.useEffect)(() => {
10835
+ (0, import_react10.useEffect)(() => {
10803
10836
  if (pausedRef.current) return;
10804
10837
  const el = stageRef && stageRef.current;
10805
10838
  if (!el) return;
@@ -10811,7 +10844,7 @@ function useGameControls(stageRef, paused, onKeyDown, onKeyUp) {
10811
10844
  }, 60);
10812
10845
  return () => clearTimeout(t);
10813
10846
  }, [paused]);
10814
- (0, import_react13.useEffect)(() => {
10847
+ (0, import_react10.useEffect)(() => {
10815
10848
  const inStage = (event) => {
10816
10849
  const el = stageRef && stageRef.current;
10817
10850
  return !!el && (el === event.target || el.contains(event.target));
@@ -10904,7 +10937,7 @@ function playSfx(name) {
10904
10937
  }
10905
10938
 
10906
10939
  // features/games/games/tetris.jsx
10907
- var import_react14 = require("react");
10940
+ var import_react11 = require("react");
10908
10941
  var import_jsx_runtime5 = require("react/jsx-runtime");
10909
10942
  var COLS = 10;
10910
10943
  var ROWS = 20;
@@ -11065,12 +11098,12 @@ var KEY_ACTIONS = {
11065
11098
  "Enter": "drop"
11066
11099
  };
11067
11100
  function TetrisGame(props) {
11068
- const [state, setState] = (0, import_react14.useState)(initial);
11069
- const [manualPause, setManualPause] = (0, import_react14.useState)(false);
11070
- const pausedRef = (0, import_react14.useRef)(!!(props && props.paused));
11101
+ const [state, setState] = (0, import_react11.useState)(initial);
11102
+ const [manualPause, setManualPause] = (0, import_react11.useState)(false);
11103
+ const pausedRef = (0, import_react11.useRef)(!!(props && props.paused));
11071
11104
  pausedRef.current = !!(props && props.paused) || manualPause;
11072
- const stageRef = (0, import_react14.useRef)(null);
11073
- const act = (0, import_react14.useCallback)((action) => setState((s) => {
11105
+ const stageRef = (0, import_react11.useRef)(null);
11106
+ const act = (0, import_react11.useCallback)((action) => setState((s) => {
11074
11107
  if (pausedRef.current) return s;
11075
11108
  if (action === "left") {
11076
11109
  playSfx("move");
@@ -11092,21 +11125,21 @@ function TetrisGame(props) {
11092
11125
  }
11093
11126
  return s;
11094
11127
  }), []);
11095
- const softRef = (0, import_react14.useRef)(null);
11096
- const stateRef = (0, import_react14.useRef)(state);
11128
+ const softRef = (0, import_react11.useRef)(null);
11129
+ const stateRef = (0, import_react11.useRef)(state);
11097
11130
  stateRef.current = state;
11098
- const holdIdRef = (0, import_react14.useRef)(null);
11099
- const stopSoft = (0, import_react14.useCallback)(() => {
11131
+ const holdIdRef = (0, import_react11.useRef)(null);
11132
+ const stopSoft = (0, import_react11.useCallback)(() => {
11100
11133
  if (softRef.current) {
11101
11134
  clearInterval(softRef.current);
11102
11135
  softRef.current = null;
11103
11136
  }
11104
11137
  }, []);
11105
- (0, import_react14.useEffect)(() => {
11138
+ (0, import_react11.useEffect)(() => {
11106
11139
  if (state.over || manualPause || props.paused) stopSoft();
11107
11140
  return stopSoft;
11108
11141
  }, [state.over, manualPause, props.paused, stopSoft]);
11109
- const onKeyDown = (0, import_react14.useCallback)((event) => {
11142
+ const onKeyDown = (0, import_react11.useCallback)((event) => {
11110
11143
  const action = KEY_ACTIONS[event.key];
11111
11144
  if (action) {
11112
11145
  event.preventDefault();
@@ -11138,13 +11171,13 @@ function TetrisGame(props) {
11138
11171
  setManualPause(false);
11139
11172
  }
11140
11173
  }, [act, stopSoft]);
11141
- const onKeyUp = (0, import_react14.useCallback)((event) => {
11174
+ const onKeyUp = (0, import_react11.useCallback)((event) => {
11142
11175
  if (KEY_ACTIONS[event.key] === "down") stopSoft();
11143
11176
  }, [stopSoft]);
11144
- (0, import_react14.useEffect)(() => {
11177
+ (0, import_react11.useEffect)(() => {
11145
11178
  if (state.over) playSfx("over");
11146
11179
  }, [state.over]);
11147
- (0, import_react14.useEffect)(() => {
11180
+ (0, import_react11.useEffect)(() => {
11148
11181
  if (pausedRef.current || state.over) return;
11149
11182
  const speed = Math.max(80, 720 - (state.level - 1) * 70);
11150
11183
  const timer = setInterval(() => act("down"), speed);
@@ -11250,7 +11283,7 @@ var tetrisGame = { Game: TetrisGame, Preview: TetrisPreview, css: `
11250
11283
  ` };
11251
11284
 
11252
11285
  // features/games/games/sokoban.jsx
11253
- var import_react15 = require("react");
11286
+ var import_react12 = require("react");
11254
11287
  var import_jsx_runtime6 = require("react/jsx-runtime");
11255
11288
  var LEVELS = [
11256
11289
  ["######", "# #", "#@$ .#", "# #", "######"],
@@ -11345,28 +11378,28 @@ function undo(state) {
11345
11378
  }
11346
11379
  var DIRS = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1], w: [-1, 0], s: [1, 0], a: [0, -1], d: [0, 1], W: [-1, 0], S: [1, 0], A: [0, -1], D: [0, 1] };
11347
11380
  function SokobanGame(props) {
11348
- const [level, setLevel] = (0, import_react15.useState)(0);
11349
- const [state, setState] = (0, import_react15.useState)(() => makeInitial(0));
11350
- const stageRef = (0, import_react15.useRef)(null);
11351
- const levelRef = (0, import_react15.useRef)(level);
11381
+ const [level, setLevel] = (0, import_react12.useState)(0);
11382
+ const [state, setState] = (0, import_react12.useState)(() => makeInitial(0));
11383
+ const stageRef = (0, import_react12.useRef)(null);
11384
+ const levelRef = (0, import_react12.useRef)(level);
11352
11385
  levelRef.current = level;
11353
- const move = (0, import_react15.useCallback)((dr, dc) => setState((s) => step(s, dr, dc)), []);
11354
- const prevWon = (0, import_react15.useRef)(false);
11355
- (0, import_react15.useEffect)(() => {
11386
+ const move = (0, import_react12.useCallback)((dr, dc) => setState((s) => step(s, dr, dc)), []);
11387
+ const prevWon = (0, import_react12.useRef)(false);
11388
+ (0, import_react12.useEffect)(() => {
11356
11389
  if (state.wonNew && !prevWon.current) playSfx("win");
11357
11390
  prevWon.current = state.wonNew;
11358
11391
  }, [state.wonNew]);
11359
- const nextLevel = (0, import_react15.useCallback)(() => {
11392
+ const nextLevel = (0, import_react12.useCallback)(() => {
11360
11393
  const n = (levelRef.current + 1) % LEVELS.length;
11361
11394
  setLevel(n);
11362
11395
  setState(makeInitial(n));
11363
11396
  }, []);
11364
- const pickLevel = (0, import_react15.useCallback)((i) => {
11397
+ const pickLevel = (0, import_react12.useCallback)((i) => {
11365
11398
  setLevel(i);
11366
11399
  setState(makeInitial(i));
11367
11400
  }, []);
11368
- const reset = (0, import_react15.useCallback)(() => setState(makeInitial(levelRef.current)), []);
11369
- const onKeyDown = (0, import_react15.useCallback)((event) => {
11401
+ const reset = (0, import_react12.useCallback)(() => setState(makeInitial(levelRef.current)), []);
11402
+ const onKeyDown = (0, import_react12.useCallback)((event) => {
11370
11403
  const d = DIRS[event.key];
11371
11404
  if (d) {
11372
11405
  event.preventDefault();
@@ -11451,7 +11484,7 @@ var sokobanGame = { Game: SokobanGame, Preview: SokobanPreview, css: `
11451
11484
  ` };
11452
11485
 
11453
11486
  // features/games/games/gomoku.jsx
11454
- var import_react16 = require("react");
11487
+ var import_react13 = require("react");
11455
11488
  var import_jsx_runtime7 = require("react/jsx-runtime");
11456
11489
  var GOMOKU_LINES = (() => {
11457
11490
  const P = (n) => n * 100 + 50;
@@ -11568,22 +11601,22 @@ function aiMove(board) {
11568
11601
  return best || [7, 7];
11569
11602
  }
11570
11603
  function GomokuGame(props) {
11571
- const [board, setBoard] = (0, import_react16.useState)(emptyBoard2);
11572
- const [turn, setTurn] = (0, import_react16.useState)("b");
11573
- const [winner, setWinner] = (0, import_react16.useState)(null);
11574
- const [winCells, setWinCells] = (0, import_react16.useState)(null);
11575
- const [showResult, setShowResult] = (0, import_react16.useState)(false);
11576
- const [last, setLast] = (0, import_react16.useState)(null);
11577
- const [history, setHistory] = (0, import_react16.useState)([]);
11578
- const [thinking, setThinking] = (0, import_react16.useState)(false);
11579
- const boardRef = (0, import_react16.useRef)(board);
11580
- const stageRef = (0, import_react16.useRef)(null);
11604
+ const [board, setBoard] = (0, import_react13.useState)(emptyBoard2);
11605
+ const [turn, setTurn] = (0, import_react13.useState)("b");
11606
+ const [winner, setWinner] = (0, import_react13.useState)(null);
11607
+ const [winCells, setWinCells] = (0, import_react13.useState)(null);
11608
+ const [showResult, setShowResult] = (0, import_react13.useState)(false);
11609
+ const [last, setLast] = (0, import_react13.useState)(null);
11610
+ const [history, setHistory] = (0, import_react13.useState)([]);
11611
+ const [thinking, setThinking] = (0, import_react13.useState)(false);
11612
+ const boardRef = (0, import_react13.useRef)(board);
11613
+ const stageRef = (0, import_react13.useRef)(null);
11581
11614
  boardRef.current = board;
11582
- const turnRef = (0, import_react16.useRef)(turn);
11615
+ const turnRef = (0, import_react13.useRef)(turn);
11583
11616
  turnRef.current = turn;
11584
- const winRef = (0, import_react16.useRef)(winner);
11617
+ const winRef = (0, import_react13.useRef)(winner);
11585
11618
  winRef.current = winner;
11586
- const finish = (0, import_react16.useCallback)((b, r, c, color) => {
11619
+ const finish = (0, import_react13.useCallback)((b, r, c, color) => {
11587
11620
  const line = winLine(b, r, c, color);
11588
11621
  if (line) {
11589
11622
  setWinner(color);
@@ -11597,7 +11630,7 @@ function GomokuGame(props) {
11597
11630
  playSfx("clear");
11598
11631
  } else playSfx("stone");
11599
11632
  }, []);
11600
- const place = (0, import_react16.useCallback)((r, c, color) => {
11633
+ const place = (0, import_react13.useCallback)((r, c, color) => {
11601
11634
  if (boardRef.current[r][c]) return false;
11602
11635
  const next = boardRef.current.map((row) => row.slice());
11603
11636
  next[r][c] = color;
@@ -11608,7 +11641,7 @@ function GomokuGame(props) {
11608
11641
  finish(next, r, c, color);
11609
11642
  return true;
11610
11643
  }, [finish]);
11611
- (0, import_react16.useEffect)(() => {
11644
+ (0, import_react13.useEffect)(() => {
11612
11645
  if (turn !== "w" || winner || props.paused) return;
11613
11646
  setThinking(true);
11614
11647
  const t = setTimeout(() => {
@@ -11619,12 +11652,12 @@ function GomokuGame(props) {
11619
11652
  }, 260);
11620
11653
  return () => clearTimeout(t);
11621
11654
  }, [turn, winner, props.paused, place]);
11622
- const onCell = (0, import_react16.useCallback)((r, c) => {
11655
+ const onCell = (0, import_react13.useCallback)((r, c) => {
11623
11656
  if (winRef.current || turnRef.current !== "b" || thinking || boardRef.current[r][c]) return;
11624
11657
  place(r, c, "b");
11625
11658
  setTurn("w");
11626
11659
  }, [thinking, place]);
11627
- const reset = (0, import_react16.useCallback)(() => {
11660
+ const reset = (0, import_react13.useCallback)(() => {
11628
11661
  setBoard(emptyBoard2());
11629
11662
  setTurn("b");
11630
11663
  setWinner(null);
@@ -11634,7 +11667,7 @@ function GomokuGame(props) {
11634
11667
  setHistory([]);
11635
11668
  setThinking(false);
11636
11669
  }, []);
11637
- const undo2 = (0, import_react16.useCallback)(() => {
11670
+ const undo2 = (0, import_react13.useCallback)(() => {
11638
11671
  if (thinking || history.length < 2) return;
11639
11672
  const h = history.slice(0, -2);
11640
11673
  const next = emptyBoard2();
@@ -11648,7 +11681,7 @@ function GomokuGame(props) {
11648
11681
  setShowResult(false);
11649
11682
  setLast(h.length ? h[h.length - 1] : null);
11650
11683
  }, [history, thinking]);
11651
- const onKeyDown = (0, import_react16.useCallback)((event) => {
11684
+ const onKeyDown = (0, import_react13.useCallback)((event) => {
11652
11685
  if (event.key.toLowerCase() === "r") {
11653
11686
  event.preventDefault();
11654
11687
  reset();
@@ -11747,7 +11780,7 @@ var gomokuGame = { Game: GomokuGame, Preview: GomokuPreview, css: `
11747
11780
  ` };
11748
11781
 
11749
11782
  // features/games/games/xiangqi.jsx
11750
- var import_react17 = require("react");
11783
+ var import_react14 = require("react");
11751
11784
 
11752
11785
  // features/games/xiangqi-core.js
11753
11786
  var ROWS2 = 10;
@@ -12112,35 +12145,35 @@ function moveNotation(board, fr, fc, tr, tc) {
12112
12145
  return pieceChar(p) + num(file(fc)) + verb + num(to);
12113
12146
  }
12114
12147
  function XiangqiGame(props) {
12115
- const [board, setBoard] = (0, import_react17.useState)(initialBoard);
12116
- const [turn, setTurn] = (0, import_react17.useState)("r");
12117
- const [sel, setSel] = (0, import_react17.useState)(null);
12118
- const [targets, setTargets] = (0, import_react17.useState)([]);
12119
- const [over, setOver] = (0, import_react17.useState)(null);
12120
- const [check, setCheck] = (0, import_react17.useState)(false);
12121
- const [last, setLast] = (0, import_react17.useState)(null);
12122
- const [lastMove, setLastMove] = (0, import_react17.useState)(null);
12123
- const [moveLog, setMoveLog] = (0, import_react17.useState)([]);
12124
- const [moving, setMoving] = (0, import_react17.useState)(null);
12125
- const [thinking, setThinking] = (0, import_react17.useState)(false);
12126
- const [history, setHistory] = (0, import_react17.useState)([]);
12127
- const [repKeys, setRepKeys] = (0, import_react17.useState)(() => [posKey(initialBoard())]);
12128
- const pushKey = (0, import_react17.useCallback)((b) => setRepKeys((ks) => ks[ks.length - 1] === posKey(b) ? ks : ks.concat(posKey(b))), []);
12129
- const stageRef = (0, import_react17.useRef)(null);
12130
- const boardRef = (0, import_react17.useRef)(board);
12148
+ const [board, setBoard] = (0, import_react14.useState)(initialBoard);
12149
+ const [turn, setTurn] = (0, import_react14.useState)("r");
12150
+ const [sel, setSel] = (0, import_react14.useState)(null);
12151
+ const [targets, setTargets] = (0, import_react14.useState)([]);
12152
+ const [over, setOver] = (0, import_react14.useState)(null);
12153
+ const [check, setCheck] = (0, import_react14.useState)(false);
12154
+ const [last, setLast] = (0, import_react14.useState)(null);
12155
+ const [lastMove, setLastMove] = (0, import_react14.useState)(null);
12156
+ const [moveLog, setMoveLog] = (0, import_react14.useState)([]);
12157
+ const [moving, setMoving] = (0, import_react14.useState)(null);
12158
+ const [thinking, setThinking] = (0, import_react14.useState)(false);
12159
+ const [history, setHistory] = (0, import_react14.useState)([]);
12160
+ const [repKeys, setRepKeys] = (0, import_react14.useState)(() => [posKey(initialBoard())]);
12161
+ const pushKey = (0, import_react14.useCallback)((b) => setRepKeys((ks) => ks[ks.length - 1] === posKey(b) ? ks : ks.concat(posKey(b))), []);
12162
+ const stageRef = (0, import_react14.useRef)(null);
12163
+ const boardRef = (0, import_react14.useRef)(board);
12131
12164
  boardRef.current = board;
12132
- const turnRef = (0, import_react17.useRef)(turn);
12165
+ const turnRef = (0, import_react14.useRef)(turn);
12133
12166
  turnRef.current = turn;
12134
- const overRef = (0, import_react17.useRef)(over);
12167
+ const overRef = (0, import_react14.useRef)(over);
12135
12168
  overRef.current = over;
12136
- const thinkingRef = (0, import_react17.useRef)(thinking);
12169
+ const thinkingRef = (0, import_react14.useRef)(thinking);
12137
12170
  thinkingRef.current = thinking;
12138
- const historyRef = (0, import_react17.useRef)(history);
12171
+ const historyRef = (0, import_react14.useRef)(history);
12139
12172
  historyRef.current = history;
12140
- const movingRef = (0, import_react17.useRef)(false);
12141
- const pendingRef = (0, import_react17.useRef)(null);
12142
- const animTimerRef = (0, import_react17.useRef)(null);
12143
- const animateMove = (0, import_react17.useCallback)((b, fr, fc, tr, tc, after) => {
12173
+ const movingRef = (0, import_react14.useRef)(false);
12174
+ const pendingRef = (0, import_react14.useRef)(null);
12175
+ const animTimerRef = (0, import_react14.useRef)(null);
12176
+ const animateMove = (0, import_react14.useCallback)((b, fr, fc, tr, tc, after) => {
12144
12177
  const piece = boardRef.current[fr][fc];
12145
12178
  const capture = !!boardRef.current[tr][tc];
12146
12179
  pendingRef.current = { board: b, after };
@@ -12167,7 +12200,7 @@ function XiangqiGame(props) {
12167
12200
  }
12168
12201
  }, 260);
12169
12202
  }, []);
12170
- const restart = (0, import_react17.useCallback)(() => {
12203
+ const restart = (0, import_react14.useCallback)(() => {
12171
12204
  if (animTimerRef.current) {
12172
12205
  clearTimeout(animTimerRef.current);
12173
12206
  animTimerRef.current = null;
@@ -12190,7 +12223,7 @@ function XiangqiGame(props) {
12190
12223
  setMoving(null);
12191
12224
  setRepKeys([posKey(b)]);
12192
12225
  }, []);
12193
- const undo2 = (0, import_react17.useCallback)(() => {
12226
+ const undo2 = (0, import_react14.useCallback)(() => {
12194
12227
  if (thinkingRef.current || overRef.current || turnRef.current !== "r" || movingRef.current) return;
12195
12228
  const h = historyRef.current;
12196
12229
  if (h.length < 2) return;
@@ -12208,7 +12241,7 @@ function XiangqiGame(props) {
12208
12241
  setCheck(inCheck(b, "r"));
12209
12242
  setRepKeys(hist.map(posKey).concat(posKey(b)));
12210
12243
  }, []);
12211
- const moveRed = (0, import_react17.useCallback)((tr, tc) => {
12244
+ const moveRed = (0, import_react14.useCallback)((tr, tc) => {
12212
12245
  if (turnRef.current !== "r" || overRef.current || !sel || movingRef.current) return;
12213
12246
  const fr = sel[0], fc = sel[1];
12214
12247
  const nb = applyMove(boardRef.current, fr, fc, tr, tc);
@@ -12222,7 +12255,7 @@ function XiangqiGame(props) {
12222
12255
  } else setCheck(inCheck(nb, "b"));
12223
12256
  });
12224
12257
  }, [sel, pushKey, animateMove]);
12225
- const select = (0, import_react17.useCallback)((r, c) => {
12258
+ const select = (0, import_react14.useCallback)((r, c) => {
12226
12259
  if (overRef.current || turnRef.current !== "r" || thinkingRef.current || movingRef.current) return;
12227
12260
  const p = boardRef.current[r][c];
12228
12261
  if (p && p.c === "r") {
@@ -12238,7 +12271,7 @@ function XiangqiGame(props) {
12238
12271
  setSel(null);
12239
12272
  setTargets([]);
12240
12273
  }, [sel, targets, moveRed]);
12241
- (0, import_react17.useEffect)(() => {
12274
+ (0, import_react14.useEffect)(() => {
12242
12275
  if (turn !== "b" || over || props.paused || movingRef.current) return;
12243
12276
  const t = setTimeout(() => {
12244
12277
  const seenCounts = /* @__PURE__ */ new Map();
@@ -12262,7 +12295,7 @@ function XiangqiGame(props) {
12262
12295
  setThinking(true);
12263
12296
  return () => clearTimeout(t);
12264
12297
  }, [turn, over, props.paused, repKeys, pushKey, animateMove]);
12265
- const onKeyDown = (0, import_react17.useCallback)((event) => {
12298
+ const onKeyDown = (0, import_react14.useCallback)((event) => {
12266
12299
  if (event.key.toLowerCase() === "r") {
12267
12300
  event.preventDefault();
12268
12301
  restart();
@@ -12273,14 +12306,14 @@ function XiangqiGame(props) {
12273
12306
  }, [restart, undo2]);
12274
12307
  useGameControls(stageRef, props.paused, onKeyDown);
12275
12308
  const status = over === "r" ? "\u7EA2\u65B9\u80DC \xB7 \u606D\u559C" : over === "b" ? "\u9ED1\u65B9\u80DC \xB7 AI \u8D62" : moving ? moving.piece.c === "r" ? "\u7EA2\u65B9\u8D70\u5B50\u2026" : "AI \u8D70\u5B50\u2026" : thinking ? "AI \u601D\u8003\u4E2D\u2026" : check ? "\u5C06\u519B\uFF01" : turn === "r" ? "\u8F6E\u5230\u4F60\uFF08\u7EA2\u65B9\uFF09" : "\u8F6E\u5230 AI\uFF08\u9ED1\u65B9\uFF09";
12276
- const prevCheck = (0, import_react17.useRef)(false);
12277
- (0, import_react17.useEffect)(() => {
12309
+ const prevCheck = (0, import_react14.useRef)(false);
12310
+ (0, import_react14.useEffect)(() => {
12278
12311
  if (over === "r") playSfx("win");
12279
12312
  else if (over === "b") playSfx("over");
12280
12313
  else if (!thinking && check && !prevCheck.current) playSfx("check");
12281
12314
  prevCheck.current = !thinking && check;
12282
12315
  }, [check, thinking, over]);
12283
- (0, import_react17.useEffect)(() => () => {
12316
+ (0, import_react14.useEffect)(() => () => {
12284
12317
  if (animTimerRef.current) clearTimeout(animTimerRef.current);
12285
12318
  }, []);
12286
12319
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("section", { className: "dgame-game", "aria-label": "\u8C61\u68CB", children: [
@@ -12385,7 +12418,7 @@ var xiangqiGame = { Game: XiangqiGame, Preview: XiangqiPreview, css: `
12385
12418
  ` };
12386
12419
 
12387
12420
  // features/games/games/snake.jsx
12388
- var import_react18 = require("react");
12421
+ var import_react15 = require("react");
12389
12422
  var import_jsx_runtime9 = require("react/jsx-runtime");
12390
12423
  var SIZE2 = 16;
12391
12424
  var DIRS3 = { ArrowUp: [-1, 0], ArrowDown: [1, 0], ArrowLeft: [0, -1], ArrowRight: [0, 1], w: [-1, 0], s: [1, 0], a: [0, -1], d: [0, 1], W: [-1, 0], S: [1, 0], A: [0, -1], D: [0, 1] };
@@ -12430,26 +12463,26 @@ function step2(state, dir) {
12430
12463
  return Object.assign({}, state, { snake });
12431
12464
  }
12432
12465
  function SnakeGame(props) {
12433
- const [state, setState] = (0, import_react18.useState)(initial2);
12434
- const [paused, setPaused] = (0, import_react18.useState)(false);
12435
- const [speedMode, setSpeedMode] = (0, import_react18.useState)(loadSpeedMode);
12436
- const stageRef = (0, import_react18.useRef)(null);
12437
- const dirRef = (0, import_react18.useRef)(state.dir);
12438
- const overRef = (0, import_react18.useRef)(state.over);
12466
+ const [state, setState] = (0, import_react15.useState)(initial2);
12467
+ const [paused, setPaused] = (0, import_react15.useState)(false);
12468
+ const [speedMode, setSpeedMode] = (0, import_react15.useState)(loadSpeedMode);
12469
+ const stageRef = (0, import_react15.useRef)(null);
12470
+ const dirRef = (0, import_react15.useRef)(state.dir);
12471
+ const overRef = (0, import_react15.useRef)(state.over);
12439
12472
  overRef.current = state.over;
12440
- const pausedRef = (0, import_react18.useRef)(!!(props && props.paused) || paused);
12473
+ const pausedRef = (0, import_react15.useRef)(!!(props && props.paused) || paused);
12441
12474
  pausedRef.current = !!(props && props.paused) || paused;
12442
- const start = (0, import_react18.useCallback)(() => {
12475
+ const start = (0, import_react15.useCallback)(() => {
12443
12476
  const init = initial2();
12444
12477
  init.started = true;
12445
12478
  dirRef.current = init.dir;
12446
12479
  setState(init);
12447
12480
  setPaused(false);
12448
12481
  }, []);
12449
- const begin = (0, import_react18.useCallback)(() => {
12482
+ const begin = (0, import_react15.useCallback)(() => {
12450
12483
  setState((s) => s.started || s.over ? s : Object.assign({}, s, { started: true }));
12451
12484
  }, []);
12452
- const changeDir = (0, import_react18.useCallback)((nv) => {
12485
+ const changeDir = (0, import_react15.useCallback)((nv) => {
12453
12486
  if (overRef.current || pausedRef.current) return;
12454
12487
  const cur = dirRef.current;
12455
12488
  const opp = OPPOSITE[cur[0] + "," + cur[1]];
@@ -12457,24 +12490,24 @@ function SnakeGame(props) {
12457
12490
  dirRef.current = nv;
12458
12491
  begin();
12459
12492
  }, [begin]);
12460
- (0, import_react18.useEffect)(() => {
12493
+ (0, import_react15.useEffect)(() => {
12461
12494
  if (state.over) playSfx("over");
12462
12495
  }, [state.over]);
12463
- (0, import_react18.useEffect)(() => {
12496
+ (0, import_react15.useEffect)(() => {
12464
12497
  if (!state.started || state.over || pausedRef.current) return;
12465
12498
  const mode = SPEED_MODES[speedMode] || SPEED_MODES.slow;
12466
12499
  const speed = Math.max(mode.min, mode.base - state.score * mode.stepMs);
12467
12500
  const timer = setInterval(() => setState((s) => s.over || !s.started || pausedRef.current ? s : step2(s, dirRef.current)), speed);
12468
12501
  return () => clearInterval(timer);
12469
12502
  }, [state.started, state.over, state.score, props.paused, paused, speedMode]);
12470
- const pickSpeed = (0, import_react18.useCallback)((m) => {
12503
+ const pickSpeed = (0, import_react15.useCallback)((m) => {
12471
12504
  setSpeedMode(m);
12472
12505
  try {
12473
12506
  localStorage.setItem("dsh-dock.snake.speed", m);
12474
12507
  } catch {
12475
12508
  }
12476
12509
  }, []);
12477
- const onKeyDown = (0, import_react18.useCallback)((event) => {
12510
+ const onKeyDown = (0, import_react15.useCallback)((event) => {
12478
12511
  const d = DIRS3[event.key];
12479
12512
  if (d) {
12480
12513
  event.preventDefault();
@@ -12574,7 +12607,7 @@ var snakeGame = { Game: SnakeGame, Preview: SnakePreview, css: `
12574
12607
  ` };
12575
12608
 
12576
12609
  // features/games/games/breakout.jsx
12577
- var import_react19 = require("react");
12610
+ var import_react16 = require("react");
12578
12611
  var import_jsx_runtime10 = require("react/jsx-runtime");
12579
12612
  var W = 320;
12580
12613
  var H = 360;
@@ -12654,22 +12687,22 @@ function collideRect(x, y, r, bx, by, bw, bh) {
12654
12687
  return dx * dx + dy * dy < r * r;
12655
12688
  }
12656
12689
  function BreakoutGame(props) {
12657
- const canvasRef = (0, import_react19.useRef)(null);
12658
- const [score, setScore] = (0, import_react19.useState)(0);
12659
- const [lives, setLives] = (0, import_react19.useState)(3);
12660
- const [level, setLevel] = (0, import_react19.useState)(1);
12661
- const [status, setStatus] = (0, import_react19.useState)("play");
12662
- const keys = (0, import_react19.useRef)({});
12663
- const pausedRef = (0, import_react19.useRef)(!!(props && props.paused));
12690
+ const canvasRef = (0, import_react16.useRef)(null);
12691
+ const [score, setScore] = (0, import_react16.useState)(0);
12692
+ const [lives, setLives] = (0, import_react16.useState)(3);
12693
+ const [level, setLevel] = (0, import_react16.useState)(1);
12694
+ const [status, setStatus] = (0, import_react16.useState)("play");
12695
+ const keys = (0, import_react16.useRef)({});
12696
+ const pausedRef = (0, import_react16.useRef)(!!(props && props.paused));
12664
12697
  pausedRef.current = !!(props && props.paused);
12665
- const game = (0, import_react19.useRef)(null);
12666
- const scoreRef = (0, import_react19.useRef)(0);
12698
+ const game = (0, import_react16.useRef)(null);
12699
+ const scoreRef = (0, import_react16.useRef)(0);
12667
12700
  scoreRef.current = score;
12668
- const statusRef = (0, import_react19.useRef)("play");
12701
+ const statusRef = (0, import_react16.useRef)("play");
12669
12702
  statusRef.current = status;
12670
- const livesRef = (0, import_react19.useRef)(3);
12703
+ const livesRef = (0, import_react16.useRef)(3);
12671
12704
  livesRef.current = lives;
12672
- const start = (0, import_react19.useCallback)((lvl) => {
12705
+ const start = (0, import_react16.useCallback)((lvl) => {
12673
12706
  const bricks = makeBricks(lvl);
12674
12707
  game.current = {
12675
12708
  stars: Array.from({ length: 46 }, () => ({ x: Math.random() * W, y: Math.random() * H, a: 0.25 + Math.random() * 0.5 })),
@@ -12679,20 +12712,20 @@ function BreakoutGame(props) {
12679
12712
  speed: SPEED * (1 + (lvl - 1) * 0.09)
12680
12713
  };
12681
12714
  }, []);
12682
- (0, import_react19.useEffect)(() => {
12715
+ (0, import_react16.useEffect)(() => {
12683
12716
  start(1);
12684
12717
  setScore(0);
12685
12718
  setLives(3);
12686
12719
  setStatus("play");
12687
12720
  }, [start]);
12688
- const launchBall = (0, import_react19.useCallback)(() => {
12721
+ const launchBall = (0, import_react16.useCallback)(() => {
12689
12722
  const g = game.current;
12690
12723
  if (!g) return;
12691
12724
  g.ball.vx = (Math.random() > 0.5 ? 1 : -1) * SPEED;
12692
12725
  g.ball.vy = -SPEED;
12693
12726
  g.launched = true;
12694
12727
  }, []);
12695
- const resetBall = (0, import_react19.useCallback)(() => {
12728
+ const resetBall = (0, import_react16.useCallback)(() => {
12696
12729
  const g = game.current;
12697
12730
  if (g) {
12698
12731
  g.ball.x = W / 2;
@@ -12702,7 +12735,7 @@ function BreakoutGame(props) {
12702
12735
  g.launched = false;
12703
12736
  }
12704
12737
  }, []);
12705
- (0, import_react19.useEffect)(() => {
12738
+ (0, import_react16.useEffect)(() => {
12706
12739
  const frame = () => {
12707
12740
  const g = game.current;
12708
12741
  const ctx = canvasRef.current && canvasRef.current.getContext("2d");
@@ -12788,7 +12821,7 @@ function BreakoutGame(props) {
12788
12821
  });
12789
12822
  return () => cancelAnimationFrame(raf);
12790
12823
  }, [resetBall]);
12791
- const onKeyDown = (0, import_react19.useCallback)((event) => {
12824
+ const onKeyDown = (0, import_react16.useCallback)((event) => {
12792
12825
  if (pausedRef.current) return;
12793
12826
  if (event.key === "ArrowLeft") {
12794
12827
  event.preventDefault();
@@ -12809,11 +12842,11 @@ function BreakoutGame(props) {
12809
12842
  livesRef.current = 3;
12810
12843
  }
12811
12844
  }, [launchBall, start]);
12812
- const onKeyUp = (0, import_react19.useCallback)((event) => {
12845
+ const onKeyUp = (0, import_react16.useCallback)((event) => {
12813
12846
  if (event.key === "ArrowLeft") keys.current.left = false;
12814
12847
  else if (event.key === "ArrowRight") keys.current.right = false;
12815
12848
  }, []);
12816
- const onPointerMove = (0, import_react19.useCallback)((e) => {
12849
+ const onPointerMove = (0, import_react16.useCallback)((e) => {
12817
12850
  const g = game.current, cv = canvasRef.current;
12818
12851
  if (!g || !cv) return;
12819
12852
  const rect2 = cv.getBoundingClientRect();
@@ -12905,7 +12938,7 @@ var breakoutGame = { Game: BreakoutGame, Preview: BreakoutPreview, css: `
12905
12938
  ` };
12906
12939
 
12907
12940
  // features/games/games/racer.jsx
12908
- var import_react20 = require("react");
12941
+ var import_react17 = require("react");
12909
12942
  var import_jsx_runtime11 = require("react/jsx-runtime");
12910
12943
  var W2 = 300;
12911
12944
  var H2 = 420;
@@ -12932,15 +12965,15 @@ function rect(ctx, x, y, w, h, r, fill) {
12932
12965
  ctx.fill();
12933
12966
  }
12934
12967
  function RacerGame(props) {
12935
- const canvasRef = (0, import_react20.useRef)(null);
12936
- const [status, setStatus] = (0, import_react20.useState)("play");
12937
- const game = (0, import_react20.useRef)(null);
12938
- const keys = (0, import_react20.useRef)({});
12939
- const statusRef = (0, import_react20.useRef)("play");
12968
+ const canvasRef = (0, import_react17.useRef)(null);
12969
+ const [status, setStatus] = (0, import_react17.useState)("play");
12970
+ const game = (0, import_react17.useRef)(null);
12971
+ const keys = (0, import_react17.useRef)({});
12972
+ const statusRef = (0, import_react17.useRef)("play");
12940
12973
  statusRef.current = status;
12941
- const pausedRef = (0, import_react20.useRef)(!!(props && props.paused));
12974
+ const pausedRef = (0, import_react17.useRef)(!!(props && props.paused));
12942
12975
  pausedRef.current = !!(props && props.paused);
12943
- const reset = (0, import_react20.useCallback)(() => {
12976
+ const reset = (0, import_react17.useCallback)(() => {
12944
12977
  game.current = {
12945
12978
  stars: Array.from({ length: 50 }, () => ({ x: Math.random() * W2, y: Math.random() * H2, a: 0.2 + Math.random() * 0.5 })),
12946
12979
  player: { x: laneX(1), y: H2 - CAR_H - 16, w: CAR_W, h: CAR_H },
@@ -12954,15 +12987,15 @@ function RacerGame(props) {
12954
12987
  over: false
12955
12988
  };
12956
12989
  }, []);
12957
- (0, import_react20.useEffect)(() => {
12990
+ (0, import_react17.useEffect)(() => {
12958
12991
  reset();
12959
12992
  setStatus("play");
12960
12993
  }, [reset]);
12961
- const launch = (0, import_react20.useCallback)(() => {
12994
+ const launch = (0, import_react17.useCallback)(() => {
12962
12995
  reset();
12963
12996
  setStatus("play");
12964
12997
  }, [reset]);
12965
- (0, import_react20.useEffect)(() => {
12998
+ (0, import_react17.useEffect)(() => {
12966
12999
  const draw2 = () => {
12967
13000
  const g = game.current, ctx = canvasRef.current && canvasRef.current.getContext("2d");
12968
13001
  if (!g || !ctx) return;
@@ -13064,7 +13097,7 @@ function RacerGame(props) {
13064
13097
  });
13065
13098
  return () => cancelAnimationFrame(raf);
13066
13099
  }, []);
13067
- const onKeyDown = (0, import_react20.useCallback)((event) => {
13100
+ const onKeyDown = (0, import_react17.useCallback)((event) => {
13068
13101
  if (pausedRef.current) return;
13069
13102
  if (event.key === "ArrowLeft") {
13070
13103
  event.preventDefault();
@@ -13077,11 +13110,11 @@ function RacerGame(props) {
13077
13110
  launch();
13078
13111
  }
13079
13112
  }, [launch]);
13080
- const onKeyUp = (0, import_react20.useCallback)((event) => {
13113
+ const onKeyUp = (0, import_react17.useCallback)((event) => {
13081
13114
  if (event.key === "ArrowLeft") keys.current.left = false;
13082
13115
  else if (event.key === "ArrowRight") keys.current.right = false;
13083
13116
  }, []);
13084
- const onPointerMove = (0, import_react20.useCallback)((e) => {
13117
+ const onPointerMove = (0, import_react17.useCallback)((e) => {
13085
13118
  const g = game.current, cv = canvasRef.current;
13086
13119
  if (!g || !cv) return;
13087
13120
  const rect0 = cv.getBoundingClientRect();
@@ -13142,7 +13175,7 @@ var racerGame = { Game: RacerGame, Preview: RacerPreview, css: `
13142
13175
  ` };
13143
13176
 
13144
13177
  // features/games/games/tank.jsx
13145
- var import_react21 = require("react");
13178
+ var import_react18 = require("react");
13146
13179
 
13147
13180
  // features/games/tank-core.js
13148
13181
  var GRID = 15;
@@ -13350,27 +13383,27 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
13350
13383
  var DIR_ANGLE = { up: 0, right: 90, down: 180, left: 270 };
13351
13384
  var ENEMY_COLORS = ["#f87171", "#fb923c", "#c084fc", "#4ade80", "#38bdf8"];
13352
13385
  function TankGame(props) {
13353
- const [snap, setSnap] = (0, import_react21.useState)(initialState);
13354
- const [status, setStatus] = (0, import_react21.useState)("play");
13355
- const snapRef = (0, import_react21.useRef)(snap);
13386
+ const [snap, setSnap] = (0, import_react18.useState)(initialState);
13387
+ const [status, setStatus] = (0, import_react18.useState)("play");
13388
+ const snapRef = (0, import_react18.useRef)(snap);
13356
13389
  snapRef.current = snap;
13357
- const keys = (0, import_react21.useRef)({ dir: null, shoot: false });
13358
- const pausedRef = (0, import_react21.useRef)(!!(props && props.paused));
13390
+ const keys = (0, import_react18.useRef)({ dir: null, shoot: false });
13391
+ const pausedRef = (0, import_react18.useRef)(!!(props && props.paused));
13359
13392
  pausedRef.current = !!(props && props.paused);
13360
- const statusRef = (0, import_react21.useRef)("play");
13393
+ const statusRef = (0, import_react18.useRef)("play");
13361
13394
  statusRef.current = status;
13362
- const boardRef = (0, import_react21.useRef)(null);
13363
- const start = (0, import_react21.useCallback)(() => {
13395
+ const boardRef = (0, import_react18.useRef)(null);
13396
+ const start = (0, import_react18.useCallback)(() => {
13364
13397
  setSnap(initialState());
13365
13398
  setStatus("play");
13366
13399
  statusRef.current = "play";
13367
13400
  }, []);
13368
- const nextLvl = (0, import_react21.useCallback)(() => {
13401
+ const nextLvl = (0, import_react18.useCallback)(() => {
13369
13402
  setSnap((s) => nextWave(s));
13370
13403
  setStatus("play");
13371
13404
  statusRef.current = "play";
13372
13405
  }, []);
13373
- (0, import_react21.useEffect)(() => {
13406
+ (0, import_react18.useEffect)(() => {
13374
13407
  const timer = setInterval(() => {
13375
13408
  if (pausedRef.current) return;
13376
13409
  setSnap((s) => {
@@ -13389,8 +13422,8 @@ function TankGame(props) {
13389
13422
  }, 120);
13390
13423
  return () => clearInterval(timer);
13391
13424
  }, []);
13392
- const stageRef = (0, import_react21.useRef)(null);
13393
- const onKeyDown = (0, import_react21.useCallback)((event) => {
13425
+ const stageRef = (0, import_react18.useRef)(null);
13426
+ const onKeyDown = (0, import_react18.useCallback)((event) => {
13394
13427
  if (pausedRef.current) return;
13395
13428
  const map = { ArrowUp: "up", ArrowDown: "down", ArrowLeft: "left", ArrowRight: "right", w: "up", s: "down", a: "left", d: "right", W: "up", S: "down", A: "left", D: "right" };
13396
13429
  const dir = map[event.key];
@@ -13407,7 +13440,7 @@ function TankGame(props) {
13407
13440
  start();
13408
13441
  }
13409
13442
  }, [start]);
13410
- const onKeyUp = (0, import_react21.useCallback)((event) => {
13443
+ const onKeyUp = (0, import_react18.useCallback)((event) => {
13411
13444
  const map = { ArrowUp: "up", ArrowDown: "down", ArrowLeft: "left", ArrowRight: "right", w: "up", s: "down", a: "left", d: "right", W: "up", S: "down", A: "left", D: "right" };
13412
13445
  const dir = map[event.key];
13413
13446
  if (dir && keys.current.dir === dir) keys.current.dir = null;
@@ -13549,8 +13582,8 @@ function initialDash() {
13549
13582
  return { lane: 1, rocks: [], score: 0, shield: 3, running: true, nextId: 1 };
13550
13583
  }
13551
13584
  function useTaskPulse() {
13552
- const [status, setStatus] = (0, import_react22.useState)({ loading: true, active: [], error: false });
13553
- const refresh = (0, import_react22.useCallback)(() => fetch("dsh-dock/animation/status", {
13585
+ const [status, setStatus] = (0, import_react19.useState)({ loading: true, active: [], error: false });
13586
+ const refresh = (0, import_react19.useCallback)(() => fetch("dsh-dock/animation/status", {
13554
13587
  method: "POST",
13555
13588
  headers: { "content-type": "application/json" },
13556
13589
  body: "{}"
@@ -13558,7 +13591,7 @@ function useTaskPulse() {
13558
13591
  if (!payload || !payload.ok) throw new Error("status unavailable");
13559
13592
  setStatus({ loading: false, active: Array.isArray(payload.data && payload.data.active) ? payload.data.active : [], error: false });
13560
13593
  }).catch(() => setStatus((current) => ({ loading: false, active: current.active || [], error: true }))), []);
13561
- (0, import_react22.useEffect)(() => {
13594
+ (0, import_react19.useEffect)(() => {
13562
13595
  refresh();
13563
13596
  const timer = setInterval(refresh, 2600);
13564
13597
  return () => clearInterval(timer);
@@ -13566,14 +13599,14 @@ function useTaskPulse() {
13566
13599
  return status;
13567
13600
  }
13568
13601
  function DashGame(props) {
13569
- const [dash, setDash] = (0, import_react22.useState)(initialDash);
13570
- const pausedRef = (0, import_react22.useRef)(!!(props && props.paused));
13602
+ const [dash, setDash] = (0, import_react19.useState)(initialDash);
13603
+ const pausedRef = (0, import_react19.useRef)(!!(props && props.paused));
13571
13604
  pausedRef.current = !!(props && props.paused);
13572
- const move = (0, import_react22.useCallback)((delta) => setDash((current) => Object.assign({}, current, {
13605
+ const move = (0, import_react19.useCallback)((delta) => setDash((current) => Object.assign({}, current, {
13573
13606
  lane: Math.max(0, Math.min(LANES - 1, current.lane + delta))
13574
13607
  })), []);
13575
- const stageRef = (0, import_react22.useRef)(null);
13576
- const onKeyDown = (0, import_react22.useCallback)((event) => {
13608
+ const stageRef = (0, import_react19.useRef)(null);
13609
+ const onKeyDown = (0, import_react19.useCallback)((event) => {
13577
13610
  if (event.key === "ArrowLeft" || event.key.toLowerCase() === "a") {
13578
13611
  event.preventDefault();
13579
13612
  move(-1);
@@ -13586,7 +13619,7 @@ function DashGame(props) {
13586
13619
  }
13587
13620
  }, [move, dash.running]);
13588
13621
  useGameControls(stageRef, props.paused, onKeyDown);
13589
- (0, import_react22.useEffect)(() => {
13622
+ (0, import_react19.useEffect)(() => {
13590
13623
  const timer = setInterval(() => {
13591
13624
  if (pausedRef.current || typeof document !== "undefined" && document.hidden) return;
13592
13625
  setDash((current) => {
@@ -13663,10 +13696,10 @@ function DashGame(props) {
13663
13696
  ] });
13664
13697
  }
13665
13698
  function ReactorGame(props) {
13666
- const [cells, setCells] = (0, import_react22.useState)(makeReactor);
13667
- const [moves, setMoves] = (0, import_react22.useState)(0);
13668
- const [cursor, setCursor] = (0, import_react22.useState)(4);
13669
- const gridRef = (0, import_react22.useRef)(null);
13699
+ const [cells, setCells] = (0, import_react19.useState)(makeReactor);
13700
+ const [moves, setMoves] = (0, import_react19.useState)(0);
13701
+ const [cursor, setCursor] = (0, import_react19.useState)(4);
13702
+ const gridRef = (0, import_react19.useRef)(null);
13670
13703
  const solved = cells.every(Boolean);
13671
13704
  const toggle = (index) => {
13672
13705
  if (solved) return;
@@ -13876,8 +13909,8 @@ var gamesBus = {
13876
13909
  }
13877
13910
  };
13878
13911
  function useGameWin() {
13879
- const [state, setState] = (0, import_react22.useState)(gamesBus.state);
13880
- (0, import_react22.useEffect)(() => gamesBus.subscribe(() => setState(gamesBus.state)), []);
13912
+ const [state, setState] = (0, import_react19.useState)(gamesBus.state);
13913
+ (0, import_react19.useEffect)(() => gamesBus.subscribe(() => setState(gamesBus.state)), []);
13881
13914
  return state;
13882
13915
  }
13883
13916
  var CATS = [
@@ -13993,12 +14026,12 @@ function snapFabX(side) {
13993
14026
  function GameWindow(props) {
13994
14027
  const game = props.game;
13995
14028
  const status = useTaskPulse();
13996
- const [win, setWin] = (0, import_react22.useState)(() => typeof window === "undefined" ? { mode: "normal", x: 14, y: 14, w: 470, h: 600 } : restoreWinGeom());
13997
- const winRef = (0, import_react22.useRef)(win);
14029
+ const [win, setWin] = (0, import_react19.useState)(() => typeof window === "undefined" ? { mode: "normal", x: 14, y: 14, w: 470, h: 600 } : restoreWinGeom());
14030
+ const winRef = (0, import_react19.useRef)(win);
13998
14031
  winRef.current = win;
13999
- const pickerRef = (0, import_react22.useRef)(props.picker);
14032
+ const pickerRef = (0, import_react19.useRef)(props.picker);
14000
14033
  pickerRef.current = props.picker;
14001
- (0, import_react22.useEffect)(() => {
14034
+ (0, import_react19.useEffect)(() => {
14002
14035
  const onKey = (e) => {
14003
14036
  if (e.key !== "Escape") return;
14004
14037
  if (pickerRef.current) gamesBus.closePicker();
@@ -14086,12 +14119,12 @@ function GameWindow(props) {
14086
14119
  ] });
14087
14120
  }
14088
14121
  function GameFab(props) {
14089
- const [pos, setPos] = (0, import_react22.useState)(null);
14090
- const [dragging, setDragging] = (0, import_react22.useState)(false);
14091
- const dragRef = (0, import_react22.useRef)(null);
14092
- const clickBlockRef = (0, import_react22.useRef)(false);
14093
- const sideRef = (0, import_react22.useRef)("left");
14094
- (0, import_react22.useEffect)(() => {
14122
+ const [pos, setPos] = (0, import_react19.useState)(null);
14123
+ const [dragging, setDragging] = (0, import_react19.useState)(false);
14124
+ const dragRef = (0, import_react19.useRef)(null);
14125
+ const clickBlockRef = (0, import_react19.useRef)(false);
14126
+ const sideRef = (0, import_react19.useRef)("left");
14127
+ (0, import_react19.useEffect)(() => {
14095
14128
  if (typeof window === "undefined") return;
14096
14129
  let next = { side: "left", y: Math.round(window.innerHeight * 0.34) };
14097
14130
  try {
@@ -14106,7 +14139,7 @@ function GameFab(props) {
14106
14139
  y: Math.min(Math.max(8, next.y), Math.max(8, window.innerHeight - FAB_H - 8))
14107
14140
  });
14108
14141
  }, []);
14109
- (0, import_react22.useEffect)(() => {
14142
+ (0, import_react19.useEffect)(() => {
14110
14143
  if (typeof window === "undefined") return;
14111
14144
  const update = () => {
14112
14145
  if (dragRef.current) return;
@@ -14201,8 +14234,8 @@ function GamepadIcon(props) {
14201
14234
  }
14202
14235
  function GamesOverlay() {
14203
14236
  const winState = useGameWin();
14204
- const [panelOpen, setPanelOpen2] = (0, import_react22.useState)(panelNav.open);
14205
- (0, import_react22.useEffect)(() => {
14237
+ const [panelOpen, setPanelOpen2] = (0, import_react19.useState)(panelNav.open);
14238
+ (0, import_react19.useEffect)(() => {
14206
14239
  setPanelOpen2(panelNav.open);
14207
14240
  return subscribePanel(() => setPanelOpen2(panelNav.open));
14208
14241
  }, []);
@@ -14305,7 +14338,7 @@ var dgcovGroupCss = `
14305
14338
 
14306
14339
  `;
14307
14340
  var css5 = [baseCss, tetrisGame.css, sokobanGame.css, gomokuGame.css, xiangqiGame.css, snakeGame.css, breakoutGame.css, racerGame.css, tankGame.css, dgcovGroupCss].filter(Boolean).join("\n");
14308
- var feature11 = {
14341
+ var feature9 = {
14309
14342
  id: "games",
14310
14343
  name: "\u8DA3\u5473\u6E38\u620F",
14311
14344
  order: 135,
@@ -14319,7 +14352,7 @@ var feature11 = {
14319
14352
  };
14320
14353
 
14321
14354
  // features/mobile-relay/view.jsx
14322
- var import_react23 = require("react");
14355
+ var import_react20 = require("react");
14323
14356
  var import_qrcode = __toESM(require_browser(), 1);
14324
14357
  var import_jsx_runtime14 = require("react/jsx-runtime");
14325
14358
  function rpc(method, payload) {
@@ -14356,8 +14389,8 @@ function RelayIcon({ name, size = 18 }) {
14356
14389
  ] });
14357
14390
  }
14358
14391
  function useCompact() {
14359
- const [compact, setCompact] = (0, import_react23.useState)(() => typeof window !== "undefined" && window.matchMedia("(max-width: 680px)").matches);
14360
- (0, import_react23.useEffect)(() => {
14392
+ const [compact, setCompact] = (0, import_react20.useState)(() => typeof window !== "undefined" && window.matchMedia("(max-width: 680px)").matches);
14393
+ (0, import_react20.useEffect)(() => {
14361
14394
  const media = window.matchMedia("(max-width: 680px)");
14362
14395
  const update = () => setCompact(media.matches);
14363
14396
  update();
@@ -14368,23 +14401,23 @@ function useCompact() {
14368
14401
  }
14369
14402
  function RemoteCard() {
14370
14403
  const compact = useCompact();
14371
- const [lan, setLan] = (0, import_react23.useState)(null);
14372
- const [username, setUsername] = (0, import_react23.useState)("");
14373
- const [password, setPassword] = (0, import_react23.useState)("");
14374
- const [newPassword, setNewPassword] = (0, import_react23.useState)("");
14375
- const [port, setPort] = (0, import_react23.useState)("");
14376
- const [address, setAddress] = (0, import_react23.useState)("");
14377
- const [qr, setQr] = (0, import_react23.useState)("");
14378
- const [busy, setBusy] = (0, import_react23.useState)("");
14379
- const [message, setMessage] = (0, import_react23.useState)("");
14380
- const [messageKind, setMessageKind] = (0, import_react23.useState)("error");
14381
- const [changing, setChanging] = (0, import_react23.useState)(false);
14382
- const [remote, setRemote] = (0, import_react23.useState)(false);
14383
- const notify = (0, import_react23.useCallback)((text, kind) => {
14404
+ const [lan, setLan] = (0, import_react20.useState)(null);
14405
+ const [username, setUsername] = (0, import_react20.useState)("");
14406
+ const [password, setPassword] = (0, import_react20.useState)("");
14407
+ const [newPassword, setNewPassword] = (0, import_react20.useState)("");
14408
+ const [port, setPort] = (0, import_react20.useState)("");
14409
+ const [address, setAddress] = (0, import_react20.useState)("");
14410
+ const [qr, setQr] = (0, import_react20.useState)("");
14411
+ const [busy, setBusy] = (0, import_react20.useState)("");
14412
+ const [message, setMessage] = (0, import_react20.useState)("");
14413
+ const [messageKind, setMessageKind] = (0, import_react20.useState)("error");
14414
+ const [changing, setChanging] = (0, import_react20.useState)(false);
14415
+ const [remote, setRemote] = (0, import_react20.useState)(false);
14416
+ const notify = (0, import_react20.useCallback)((text, kind) => {
14384
14417
  setMessage(text);
14385
14418
  setMessageKind(kind || "error");
14386
14419
  }, []);
14387
- const refresh = (0, import_react23.useCallback)(async () => {
14420
+ const refresh = (0, import_react20.useCallback)(async () => {
14388
14421
  try {
14389
14422
  const data = await rpc("lan");
14390
14423
  setLan(data);
@@ -14394,19 +14427,19 @@ function RemoteCard() {
14394
14427
  notify(e && e.message ? e.message : String(e));
14395
14428
  }
14396
14429
  }, [notify]);
14397
- (0, import_react23.useEffect)(() => {
14430
+ (0, import_react20.useEffect)(() => {
14398
14431
  refresh();
14399
14432
  const timer = setInterval(refresh, 3e3);
14400
14433
  return () => clearInterval(timer);
14401
14434
  }, [refresh]);
14402
- (0, import_react23.useEffect)(() => {
14435
+ (0, import_react20.useEffect)(() => {
14403
14436
  fetch("/__dsh_auth/health", { method: "POST" }).then((r) => setRemote(Boolean(r.ok))).catch(() => setRemote(false));
14404
14437
  }, []);
14405
14438
  const active = Boolean(lan && lan.gatewayActive);
14406
14439
  const gatewayPort = lan && lan.gatewayPort ? lan.gatewayPort : 3081;
14407
14440
  const suggestedPort = lan && lan.mainPort ? lan.mainPort + 1 : gatewayPort;
14408
- const lanLink = (0, import_react23.useMemo)(() => address && active ? "http://" + address + ":" + gatewayPort : "", [address, active, gatewayPort]);
14409
- (0, import_react23.useEffect)(() => {
14441
+ const lanLink = (0, import_react20.useMemo)(() => address && active ? "http://" + address + ":" + gatewayPort : "", [address, active, gatewayPort]);
14442
+ (0, import_react20.useEffect)(() => {
14410
14443
  let live = true;
14411
14444
  if (!lanLink) {
14412
14445
  setQr("");
@@ -14623,8 +14656,8 @@ function MobileRelayView() {
14623
14656
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RemoteCard, {});
14624
14657
  }
14625
14658
  function MobileRelayHomeStat() {
14626
- const [summary, setSummary] = (0, import_react23.useState)("\u672A\u5F00\u542F\uFF0C\u5F00\u542F\u540E\u53EF\u8FDC\u7A0B\u767B\u5F55");
14627
- (0, import_react23.useEffect)(() => {
14659
+ const [summary, setSummary] = (0, import_react20.useState)("\u672A\u5F00\u542F\uFF0C\u5F00\u542F\u540E\u53EF\u8FDC\u7A0B\u767B\u5F55");
14660
+ (0, import_react20.useEffect)(() => {
14628
14661
  const refresh = () => {
14629
14662
  rpc("lan").then((data) => {
14630
14663
  const devices = typeof data.devices === "number" && data.devices > 0 ? " \xB7 " + data.devices + " \u53F0\u8BBE\u5907\u5728\u7EBF" : "";
@@ -14638,7 +14671,7 @@ function MobileRelayHomeStat() {
14638
14671
  }, []);
14639
14672
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: summary });
14640
14673
  }
14641
- var feature12 = {
14674
+ var feature10 = {
14642
14675
  id: "mobile-relay",
14643
14676
  name: "\u8FDC\u7A0B\u8BBF\u95EE",
14644
14677
  order: 80,
@@ -14652,9 +14685,726 @@ var feature12 = {
14652
14685
  HomeStat: MobileRelayHomeStat
14653
14686
  };
14654
14687
 
14688
+ // features/mcpconfig/view.js
14689
+ var import_react21 = __toESM(require("react"), 1);
14690
+ var ENDPOINT = "dsh-dock/mcpconfig";
14691
+ var SERVER_NAME_RE = /^[A-Za-z0-9_-]{1,32}$/;
14692
+ var ENV_KEY_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
14693
+ var DEFAULT_TOOL_TIMEOUT_MS = 6e4;
14694
+ var TRANSPORTS = [
14695
+ { value: "stdio", label: "stdio\uFF08\u672C\u673A\u5B50\u8FDB\u7A0B\uFF09" },
14696
+ { value: "streamable-http", label: "streamable-http\uFF08\u8FDC\u7AEF HTTP\uFF09" }
14697
+ ];
14698
+ var STATE_TEXT = { active: "\u8FD0\u884C\u4E2D", inactive: "\u672A\u8FDE\u63A5", failed: "\u5931\u8D25", disabled: "\u5DF2\u505C\u7528", unknown: "\u672A\u77E5" };
14699
+ function timeoutSignal(ms) {
14700
+ try {
14701
+ if (typeof AbortSignal !== "undefined" && typeof AbortSignal.timeout === "function") return AbortSignal.timeout(ms);
14702
+ } catch (e) {
14703
+ }
14704
+ return void 0;
14705
+ }
14706
+ function errorText(body, fallback) {
14707
+ if (body && typeof body.error === "string" && body.error) return body.error;
14708
+ if (body && body.error && typeof body.error.message === "string" && body.error.message) return body.error.message;
14709
+ return fallback;
14710
+ }
14711
+ function messageOf(e) {
14712
+ return e && e.message || String(e);
14713
+ }
14714
+ function linesToEnv(text) {
14715
+ const out = {};
14716
+ for (const line of String(text || "").split(/\r?\n/)) {
14717
+ const raw = line.trim();
14718
+ if (!raw) continue;
14719
+ const at = raw.indexOf("=");
14720
+ if (at < 0) {
14721
+ out[raw] = "";
14722
+ continue;
14723
+ }
14724
+ const key = raw.slice(0, at).trim();
14725
+ if (key) out[key] = raw.slice(at + 1).trim();
14726
+ }
14727
+ return out;
14728
+ }
14729
+ function linesToHeaders(text) {
14730
+ const out = {};
14731
+ for (const line of String(text || "").split(/\r?\n/)) {
14732
+ const raw = line.trim();
14733
+ if (!raw) continue;
14734
+ const at = raw.indexOf(":");
14735
+ if (at < 0) {
14736
+ out[raw] = "";
14737
+ continue;
14738
+ }
14739
+ const key = raw.slice(0, at).trim();
14740
+ if (key) out[key] = raw.slice(at + 1).trim();
14741
+ }
14742
+ return out;
14743
+ }
14744
+ function mapToEnvText(map) {
14745
+ return Object.keys(map || {}).map((k) => {
14746
+ const v = map[k];
14747
+ return k + "=" + (typeof v === "string" ? v : v === void 0 || v === null ? "" : JSON.stringify(v));
14748
+ }).join("\n");
14749
+ }
14750
+ function mapToHeadersText(map) {
14751
+ return Object.keys(map || {}).map((k) => {
14752
+ const v = map[k];
14753
+ return k + ": " + (typeof v === "string" ? v : v === void 0 || v === null ? "" : JSON.stringify(v));
14754
+ }).join("\n");
14755
+ }
14756
+ function argsToText(args) {
14757
+ return (Array.isArray(args) ? args : []).map((x) => typeof x === "string" ? x : String(x)).join("\n");
14758
+ }
14759
+ function textToArgs(text) {
14760
+ return String(text || "").split(/\r?\n/).map((x) => x.trim()).filter(Boolean);
14761
+ }
14762
+ function toDraft(server) {
14763
+ const s = server && typeof server === "object" ? server : {};
14764
+ return {
14765
+ serverName: typeof s.serverName === "string" ? s.serverName : "",
14766
+ transport: s.transport === "streamable-http" ? "streamable-http" : "stdio",
14767
+ command: typeof s.command === "string" ? s.command : "",
14768
+ args: Array.isArray(s.args) ? s.args.filter((x) => typeof x === "string") : [],
14769
+ env: s.env && typeof s.env === "object" && !Array.isArray(s.env) ? s.env : {},
14770
+ cwd: typeof s.cwd === "string" ? s.cwd : "",
14771
+ url: typeof s.url === "string" ? s.url : "",
14772
+ headers: s.headers && typeof s.headers === "object" && !Array.isArray(s.headers) ? s.headers : {},
14773
+ enabled: s.enabled !== false,
14774
+ failOnStartupError: s.failOnStartupError === true,
14775
+ toolCallTimeoutMs: Number.isFinite(s.toolCallTimeoutMs) && s.toolCallTimeoutMs > 0 ? s.toolCallTimeoutMs : DEFAULT_TOOL_TIMEOUT_MS,
14776
+ // 只读展示字段(POST 不含这些)
14777
+ state: typeof s.state === "string" ? s.state : "unknown",
14778
+ error: typeof s.error === "string" && s.error ? s.error : null,
14779
+ tools: Array.isArray(s.tools) ? s.tools.filter((x) => typeof x === "string") : [],
14780
+ toolCount: Number.isFinite(s.toolCount) ? s.toolCount : Array.isArray(s.tools) ? s.tools.length : 0
14781
+ };
14782
+ }
14783
+ function toSaveShape(draft) {
14784
+ const base = {
14785
+ serverName: draft.serverName,
14786
+ transport: draft.transport === "streamable-http" ? "streamable-http" : "stdio",
14787
+ enabled: draft.enabled !== false,
14788
+ failOnStartupError: draft.failOnStartupError === true,
14789
+ toolCallTimeoutMs: draft.toolCallTimeoutMs || DEFAULT_TOOL_TIMEOUT_MS
14790
+ };
14791
+ if (base.transport === "streamable-http") {
14792
+ return Object.assign(base, { url: draft.url || "", headers: draft.headers || {} });
14793
+ }
14794
+ return Object.assign(base, {
14795
+ command: draft.command || "",
14796
+ args: Array.isArray(draft.args) ? draft.args : [],
14797
+ env: draft.env || {},
14798
+ cwd: draft.cwd || ""
14799
+ });
14800
+ }
14801
+ function emptyForm() {
14802
+ return {
14803
+ mode: "create",
14804
+ index: -1,
14805
+ serverName: "",
14806
+ transport: "stdio",
14807
+ command: "",
14808
+ argsText: "",
14809
+ envText: "",
14810
+ cwd: "",
14811
+ url: "",
14812
+ headersText: "",
14813
+ toolCallTimeoutMs: String(DEFAULT_TOOL_TIMEOUT_MS),
14814
+ failOnStartupError: false,
14815
+ enabled: true
14816
+ };
14817
+ }
14818
+ function formFrom(draft, index) {
14819
+ return {
14820
+ mode: "edit",
14821
+ index,
14822
+ serverName: draft.serverName,
14823
+ transport: draft.transport,
14824
+ command: draft.command || "",
14825
+ argsText: argsToText(draft.args),
14826
+ envText: mapToEnvText(draft.env),
14827
+ cwd: draft.cwd || "",
14828
+ url: draft.url || "",
14829
+ headersText: mapToHeadersText(draft.headers),
14830
+ toolCallTimeoutMs: String(draft.toolCallTimeoutMs || DEFAULT_TOOL_TIMEOUT_MS),
14831
+ failOnStartupError: !!draft.failOnStartupError,
14832
+ enabled: draft.enabled !== false
14833
+ };
14834
+ }
14835
+ function formToDraft(form, drafts) {
14836
+ const serverName = String(form.serverName || "").trim();
14837
+ if (!SERVER_NAME_RE.test(serverName)) {
14838
+ return { error: "serverName \u975E\u6CD5\uFF1A\u987B\u5339\u914D " + SERVER_NAME_RE + "\uFF081~32 \u4F4D\u5B57\u6BCD\u3001\u6570\u5B57\u3001_ \u6216 -\uFF09" };
14839
+ }
14840
+ const duplicate = drafts.some((d, i) => i !== form.index && d.serverName === serverName);
14841
+ if (duplicate) return { error: "serverName\u300C" + serverName + "\u300D\u5DF2\u5B58\u5728\uFF0C\u8BF7\u6362\u4E00\u4E2A\u540D\u5B57" };
14842
+ const transport = form.transport === "streamable-http" ? "streamable-http" : "stdio";
14843
+ const timeoutRaw = String(form.toolCallTimeoutMs === void 0 ? "" : form.toolCallTimeoutMs).trim();
14844
+ const timeout = timeoutRaw === "" ? DEFAULT_TOOL_TIMEOUT_MS : Number(timeoutRaw);
14845
+ if (!Number.isFinite(timeout) || timeout <= 0) return { error: "toolCallTimeoutMs \u987B\u4E3A\u6B63\u6574\u6570\uFF08\u6BEB\u79D2\uFF09\uFF0C\u9ED8\u8BA4 " + DEFAULT_TOOL_TIMEOUT_MS };
14846
+ const base = {
14847
+ serverName,
14848
+ transport,
14849
+ enabled: form.mode === "create" ? form.enabled !== false : drafts[form.index] ? drafts[form.index].enabled !== false : true,
14850
+ failOnStartupError: !!form.failOnStartupError,
14851
+ toolCallTimeoutMs: Math.floor(timeout)
14852
+ };
14853
+ if (transport === "streamable-http") {
14854
+ const url = String(form.url || "").trim();
14855
+ if (!/^https?:\/\//i.test(url)) return { error: "url \u975E\u6CD5\uFF1A\u987B\u4EE5 http:// \u6216 https:// \u5F00\u5934" };
14856
+ const headers = linesToHeaders(form.headersText);
14857
+ for (const key of Object.keys(headers)) {
14858
+ if (!/^[A-Za-z0-9-]+$/.test(key)) return { error: "header \u540D\u975E\u6CD5\uFF1A" + key };
14859
+ }
14860
+ return { draft: Object.assign(base, { url, headers, command: "", args: [], env: {}, cwd: "" }) };
14861
+ }
14862
+ const command = String(form.command || "").trim();
14863
+ if (!command) return { error: "stdio \u4F20\u8F93\u5FC5\u987B\u586B\u5199 command\uFF08\u53EF\u6267\u884C\u6587\u4EF6\u8DEF\u5F84\uFF09" };
14864
+ const env = linesToEnv(form.envText);
14865
+ for (const key of Object.keys(env)) {
14866
+ if (!ENV_KEY_RE.test(key)) return { error: "\u73AF\u5883\u53D8\u91CF\u540D\u975E\u6CD5\uFF1A" + key + "\uFF08\u987B\u5339\u914D " + ENV_KEY_RE + "\uFF09" };
14867
+ }
14868
+ return { draft: Object.assign(base, { command, args: textToArgs(form.argsText), env, cwd: String(form.cwd || "").trim(), url: "", headers: {} }) };
14869
+ }
14870
+ function stateDotClass(state) {
14871
+ if (state === "active") return "dkmc-dot ok";
14872
+ if (state === "failed") return "dkmc-dot err";
14873
+ if (state === "inactive") return "dkmc-dot idle";
14874
+ return "dkmc-dot off";
14875
+ }
14876
+ function stateClass(state) {
14877
+ if (state === "active") return "dkmc-state ok";
14878
+ if (state === "failed") return "dkmc-state err";
14879
+ return "dkmc-state";
14880
+ }
14881
+ function Field(props) {
14882
+ return import_react21.default.createElement(
14883
+ "div",
14884
+ { className: "dkmc-field" },
14885
+ import_react21.default.createElement("label", { className: "dkmc-flabel" }, props.label),
14886
+ props.children,
14887
+ props.hint ? import_react21.default.createElement("p", { className: "dkmc-hint" }, props.hint) : null
14888
+ );
14889
+ }
14890
+ function ServerForm(props) {
14891
+ const form = props.form;
14892
+ const patch = props.patch;
14893
+ const onSave = props.onSave;
14894
+ const onCancel = props.onCancel;
14895
+ const saving = props.saving;
14896
+ const onExample = props.onExample;
14897
+ const input = (p) => import_react21.default.createElement("input", Object.assign({ className: "dkmc-input" }, p));
14898
+ const isEdit = form.mode === "edit";
14899
+ return import_react21.default.createElement(
14900
+ "div",
14901
+ { className: "dkmc-editor" },
14902
+ import_react21.default.createElement(
14903
+ "div",
14904
+ { className: "dkmc-editor-head" },
14905
+ import_react21.default.createElement("span", { className: "dkmc-editor-title" }, isEdit ? "\u7F16\u8F91 MCP \u670D\u52A1\u5668" : "\u65B0\u589E MCP \u670D\u52A1\u5668"),
14906
+ import_react21.default.createElement("span", { className: "dkmc-editor-sub" }, isEdit ? form.serverName : "\u5199\u56DE cordis.patch.yml \u7684\u6258\u7BA1\u5757\u5E76\u70ED\u5E94\u7528"),
14907
+ !isEdit && typeof onExample === "function" ? import_react21.default.createElement("button", {
14908
+ type: "button",
14909
+ className: "dkmc-btn ghost sm dkmc-example",
14910
+ title: "\u4E00\u952E\u586B\u5165\u672C\u673A Xiaomi-OCR MCP \u670D\u52A1\u5668\u914D\u7F6E",
14911
+ disabled: saving,
14912
+ onClick: onExample
14913
+ }, "\u586B\u5165\u672C\u673A Xiaomi-OCR \u793A\u4F8B") : null
14914
+ ),
14915
+ props.error ? import_react21.default.createElement("p", { className: "dkmc-error" }, props.error) : null,
14916
+ Field({
14917
+ label: "serverName",
14918
+ hint: "\u5DE5\u5177\u540D\u524D\u7F00\uFF1A\u6A21\u578B\u770B\u5230\u7684\u662F mcp__<serverName>__<tool>\uFF1B\u987B\u5339\u914D " + SERVER_NAME_RE
14919
+ }, input({
14920
+ value: form.serverName,
14921
+ placeholder: "xiaomi_ocr",
14922
+ disabled: isEdit,
14923
+ onChange: (e) => patch({ serverName: e.target.value })
14924
+ })),
14925
+ Field({ label: "\u4F20\u8F93\u65B9\u5F0F" }, import_react21.default.createElement(
14926
+ "select",
14927
+ {
14928
+ className: "dkmc-input dkmc-select",
14929
+ value: form.transport,
14930
+ onChange: (e) => patch({ transport: e.target.value })
14931
+ },
14932
+ TRANSPORTS.map((t) => import_react21.default.createElement("option", { key: t.value, value: t.value }, t.label))
14933
+ )),
14934
+ form.transport === "streamable-http" ? Field(
14935
+ { label: "url", hint: "MCP \u7AEF\u70B9\uFF08Streamable HTTP\uFF09\uFF0C\u987B\u4EE5 http:// \u6216 https:// \u5F00\u5934" },
14936
+ input({ value: form.url, placeholder: "http://127.0.0.1:3000/mcp", onChange: (e) => patch({ url: e.target.value }) })
14937
+ ) : Field(
14938
+ { label: "command", hint: "\u53EF\u6267\u884C\u6587\u4EF6\u7EDD\u5BF9\u8DEF\u5F84\u6216 PATH \u4E2D\u7684\u547D\u4EE4" },
14939
+ input({ value: form.command, placeholder: "/usr/bin/python3", onChange: (e) => patch({ command: e.target.value }) })
14940
+ ),
14941
+ form.transport === "streamable-http" ? Field(
14942
+ { label: "headers\uFF08\u6BCF\u884C\u4E00\u4E2A KEY: VALUE\uFF09", hint: "\u5982 Authorization: Bearer xxx\uFF1B\u503C\u4E3A\u7A7A\u7684\u884C\u5FFD\u7565" },
14943
+ import_react21.default.createElement("textarea", {
14944
+ className: "dkmc-input dkmc-textarea",
14945
+ rows: 4,
14946
+ spellCheck: false,
14947
+ value: form.headersText,
14948
+ placeholder: "Authorization: Bearer xxxxx",
14949
+ onChange: (e) => patch({ headersText: e.target.value })
14950
+ })
14951
+ ) : import_react21.default.createElement(
14952
+ import_react21.default.Fragment,
14953
+ null,
14954
+ Field(
14955
+ { label: "args\uFF08\u6BCF\u884C\u4E00\u4E2A\u53C2\u6570\uFF09" },
14956
+ import_react21.default.createElement("textarea", {
14957
+ className: "dkmc-input dkmc-textarea",
14958
+ rows: 4,
14959
+ spellCheck: false,
14960
+ value: form.argsText,
14961
+ placeholder: "/www/wwwroot/xiaomi-ocr/mcp_ocr.py",
14962
+ onChange: (e) => patch({ argsText: e.target.value })
14963
+ })
14964
+ ),
14965
+ Field(
14966
+ { label: "env\uFF08\u6BCF\u884C\u4E00\u4E2A KEY=VALUE\uFF09", hint: "\u73AF\u5883\u53D8\u91CF\u4F1A\u660E\u6587\u5199\u8FDB profile \u8865\u4E01\u5C42\uFF08\u6587\u4EF6 0600\uFF0C\u4EC5\u672C\u673A\u53EF\u8BFB\uFF09\uFF1B\u6CA1\u6709\u53EF\u7559\u7A7A" },
14967
+ import_react21.default.createElement("textarea", {
14968
+ className: "dkmc-input dkmc-textarea",
14969
+ rows: 3,
14970
+ spellCheck: false,
14971
+ value: form.envText,
14972
+ placeholder: "PYTHONUNBUFFERED=1",
14973
+ onChange: (e) => patch({ envText: e.target.value })
14974
+ })
14975
+ ),
14976
+ Field(
14977
+ { label: "cwd\uFF08\u53EF\u9009\uFF09" },
14978
+ input({ value: form.cwd, placeholder: "/www/wwwroot/xiaomi-ocr", onChange: (e) => patch({ cwd: e.target.value }) })
14979
+ )
14980
+ ),
14981
+ import_react21.default.createElement(
14982
+ "details",
14983
+ { className: "dkmc-advanced" },
14984
+ import_react21.default.createElement("summary", { className: "dkmc-summary" }, "\u9AD8\u7EA7"),
14985
+ import_react21.default.createElement(
14986
+ "div",
14987
+ { className: "dkmc-advanced-body" },
14988
+ Field(
14989
+ { label: "toolCallTimeoutMs", hint: "\u5355\u6B21 MCP \u5DE5\u5177\u8C03\u7528\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09\uFF0C\u9ED8\u8BA4 " + DEFAULT_TOOL_TIMEOUT_MS },
14990
+ input({ value: form.toolCallTimeoutMs, inputMode: "numeric", placeholder: String(DEFAULT_TOOL_TIMEOUT_MS), onChange: (e) => patch({ toolCallTimeoutMs: e.target.value }) })
14991
+ ),
14992
+ import_react21.default.createElement(
14993
+ "label",
14994
+ { className: "dkmc-check" },
14995
+ import_react21.default.createElement("input", {
14996
+ type: "checkbox",
14997
+ checked: !!form.failOnStartupError,
14998
+ onChange: () => patch({ failOnStartupError: !form.failOnStartupError })
14999
+ }),
15000
+ "\u9996\u6B21\u8FDE\u63A5\u5931\u8D25\u65F6\u62D2\u7EDD\u542F\u7528\u8BE5\u884C\uFF08failOnStartupError\uFF09"
15001
+ )
15002
+ )
15003
+ ),
15004
+ import_react21.default.createElement(
15005
+ "div",
15006
+ { className: "dkmc-editor-actions" },
15007
+ import_react21.default.createElement("button", { type: "button", className: "dkmc-btn ghost", disabled: saving, onClick: onCancel }, "\u53D6\u6D88"),
15008
+ import_react21.default.createElement(
15009
+ "button",
15010
+ { type: "button", className: "dkmc-btn primary", disabled: saving, onClick: onSave },
15011
+ saving ? "\u4FDD\u5B58\u4E2D\u2026" : isEdit ? "\u4FDD\u5B58\u4FEE\u6539" : "\u65B0\u589E\u5E76\u4FDD\u5B58"
15012
+ )
15013
+ )
15014
+ );
15015
+ }
15016
+ function McpConfigView() {
15017
+ const [snap, setSnap] = import_react21.default.useState({ loading: true, error: null, data: null });
15018
+ const [drafts, setDrafts] = import_react21.default.useState([]);
15019
+ const [form, setForm] = import_react21.default.useState(null);
15020
+ const [formError, setFormError] = import_react21.default.useState(null);
15021
+ const [saving, setSaving] = import_react21.default.useState(false);
15022
+ const [msg, setMsg] = import_react21.default.useState(null);
15023
+ const [delArm, setDelArm] = import_react21.default.useState(null);
15024
+ const refresh = async () => {
15025
+ setSnap((s) => Object.assign({}, s, { loading: true, error: null }));
15026
+ try {
15027
+ if (typeof fetch !== "function") throw new Error("\u5F53\u524D\u73AF\u5883\u6CA1\u6709 fetch\uFF0C\u65E0\u6CD5\u8BFB\u53D6 MCP \u914D\u7F6E");
15028
+ const res = await fetch(ENDPOINT, { cache: "no-store", signal: timeoutSignal(6e4) });
15029
+ const body2 = await res.json().catch(() => null);
15030
+ if (!res.ok) throw new Error(errorText(body2, "MCP \u914D\u7F6E\u63A5\u53E3 HTTP " + res.status));
15031
+ if (!body2 || body2.ok === false) throw new Error(errorText(body2, "MCP \u914D\u7F6E\u63A5\u53E3\u8FD4\u56DE\u5F02\u5E38"));
15032
+ const list = Array.isArray(body2.servers) ? body2.servers : body2.data && Array.isArray(body2.data.servers) ? body2.data.servers : [];
15033
+ setSnap({ loading: false, error: null, data: body2 });
15034
+ setDrafts(list.map(toDraft));
15035
+ } catch (e) {
15036
+ setSnap({ loading: false, error: messageOf(e), data: null });
15037
+ }
15038
+ };
15039
+ import_react21.default.useEffect(() => {
15040
+ refresh();
15041
+ }, []);
15042
+ const commit = async (nextDrafts, successText) => {
15043
+ if (saving) return false;
15044
+ const previous = drafts;
15045
+ setSaving(true);
15046
+ setFormError(null);
15047
+ setMsg(null);
15048
+ setDrafts(nextDrafts);
15049
+ try {
15050
+ if (typeof fetch !== "function") throw new Error("\u5F53\u524D\u73AF\u5883\u6CA1\u6709 fetch\uFF0C\u65E0\u6CD5\u4FDD\u5B58 MCP \u914D\u7F6E");
15051
+ const res = await fetch(ENDPOINT, {
15052
+ method: "POST",
15053
+ headers: { "content-type": "application/json" },
15054
+ body: JSON.stringify({ action: "save", servers: nextDrafts.map(toSaveShape) }),
15055
+ cache: "no-store",
15056
+ signal: timeoutSignal(6e4)
15057
+ });
15058
+ const body2 = await res.json().catch(() => null);
15059
+ if (!res.ok || !body2 || body2.ok === false) {
15060
+ const extra = body2 && body2.rolledBack ? "\uFF08\u5DF2\u56DE\u6EDA\u5230\u4FDD\u5B58\u524D\u7684\u914D\u7F6E\uFF09" : body2 && body2.needsRestart ? "\uFF08\u914D\u7F6E\u53EF\u80FD\u5DF2\u5199\u5165\uFF0C\u9700\u91CD\u542F DSH \u68C0\u67E5\uFF09" : "";
15061
+ throw new Error(errorText(body2, "\u4FDD\u5B58\u5931\u8D25\uFF1AHTTP " + res.status) + extra);
15062
+ }
15063
+ const notes = [];
15064
+ if (body2.restartRequired) notes.push("\u5DF2\u4FDD\u5B58\uFF0C\u91CD\u542F DSH \u540E\u751F\u6548");
15065
+ else if (body2.applied === false) notes.push("\u5DF2\u4FDD\u5B58\uFF0C\u7B49\u5F85 DSH \u5E94\u7528");
15066
+ else notes.push(body2.changed === false ? "\u914D\u7F6E\u6CA1\u6709\u53D8\u5316" : "\u5DF2\u5E94\u7528");
15067
+ for (const w of Array.isArray(body2.warnings) ? body2.warnings : []) notes.push(String(w));
15068
+ setMsg({ tone: "ok", text: successText + "\uFF1B" + notes.join("\uFF1B") });
15069
+ setForm(null);
15070
+ setFormError(null);
15071
+ setDelArm(null);
15072
+ await refresh();
15073
+ return true;
15074
+ } catch (e) {
15075
+ setDrafts(previous);
15076
+ setFormError(messageOf(e));
15077
+ return false;
15078
+ } finally {
15079
+ setSaving(false);
15080
+ }
15081
+ };
15082
+ const openCreate = () => {
15083
+ setForm(emptyForm());
15084
+ setFormError(null);
15085
+ setMsg(null);
15086
+ setDelArm(null);
15087
+ };
15088
+ const openEdit = (draft, index) => {
15089
+ setForm(formFrom(draft, index));
15090
+ setFormError(null);
15091
+ setMsg(null);
15092
+ setDelArm(null);
15093
+ };
15094
+ const closeForm = () => {
15095
+ setForm(null);
15096
+ setFormError(null);
15097
+ };
15098
+ const patchForm = (patch) => {
15099
+ setForm((f) => Object.assign({}, f, patch));
15100
+ setFormError(null);
15101
+ };
15102
+ const saveForm = () => {
15103
+ if (!form || saving) return;
15104
+ const result = formToDraft(form, drafts);
15105
+ if (result.error) {
15106
+ setFormError(result.error);
15107
+ return;
15108
+ }
15109
+ const draft = result.draft;
15110
+ const next = form.mode === "edit" ? drafts.map((d, i) => i === form.index ? Object.assign({}, d, draft) : d) : drafts.concat([draft]);
15111
+ const text = (form.mode === "edit" ? "\u5DF2\u66F4\u65B0\u300C" : "\u5DF2\u65B0\u589E\u300C") + draft.serverName + "\u300D";
15112
+ commit(next, text);
15113
+ };
15114
+ const toggle = (draft) => {
15115
+ const next = drafts.map((d) => d.serverName === draft.serverName ? Object.assign({}, d, { enabled: !d.enabled }) : d);
15116
+ commit(next, "\u5DF2" + (draft.enabled ? "\u505C\u7528\u300C" : "\u542F\u7528\u300C") + draft.serverName + "\u300D");
15117
+ };
15118
+ const remove = (draft) => {
15119
+ if (delArm !== draft.serverName) {
15120
+ setDelArm(draft.serverName);
15121
+ setMsg(null);
15122
+ setFormError(null);
15123
+ return;
15124
+ }
15125
+ setDelArm(null);
15126
+ const next = drafts.filter((d) => d.serverName !== draft.serverName);
15127
+ if (form && form.mode === "edit" && form.serverName === draft.serverName) closeForm();
15128
+ commit(next, "\u5DF2\u5220\u9664\u300C" + draft.serverName + "\u300D");
15129
+ };
15130
+ const fillXiaomiExample = () => {
15131
+ if (drafts.some((d) => d.serverName === "xiaomi_ocr")) {
15132
+ setMsg({ tone: "warn", text: "\u5217\u8868\u91CC\u5DF2\u7ECF\u6709 xiaomi_ocr\uFF08\u53EF\u76F4\u63A5\u70B9\u8BE5\u5361\u7247\u7684\u300C\u7F16\u8F91\u300D\u67E5\u770B/\u4FEE\u6539\uFF09" });
15133
+ return;
15134
+ }
15135
+ setForm(Object.assign(emptyForm(), {
15136
+ serverName: "xiaomi_ocr",
15137
+ transport: "stdio",
15138
+ command: "/usr/bin/python3",
15139
+ argsText: "/www/wwwroot/xiaomi-ocr/mcp_ocr.py",
15140
+ cwd: "/www/wwwroot/xiaomi-ocr",
15141
+ envText: "",
15142
+ toolCallTimeoutMs: "300000",
15143
+ failOnStartupError: false
15144
+ }));
15145
+ setFormError(null);
15146
+ setMsg(null);
15147
+ };
15148
+ const data = snap.data;
15149
+ const patchPath = data && typeof data.patchPath === "string" ? data.patchPath : "";
15150
+ const hmrAvailable = !!(data && data.hmrAvailable);
15151
+ const warnings = data ? Array.isArray(data.warnings) ? data.warnings.filter((w) => typeof w === "string" && w) : typeof data.warning === "string" && data.warning ? [data.warning] : [] : [];
15152
+ const serverCount = drafts.length;
15153
+ const enabledCount = drafts.filter((d) => d.enabled).length;
15154
+ const toolsTotal = drafts.reduce((n, d) => n + (Number.isFinite(d.toolCount) ? d.toolCount : 0), 0);
15155
+ const body = [
15156
+ import_react21.default.createElement(
15157
+ "div",
15158
+ { key: "head", className: "dkmc-head" },
15159
+ import_react21.default.createElement(
15160
+ "div",
15161
+ { className: "dkmc-head-title" },
15162
+ import_react21.default.createElement("h2", { className: "dkmc-title" }, "MCP\u7BA1\u7406"),
15163
+ import_react21.default.createElement(
15164
+ "span",
15165
+ { className: "dkmc-badge " + (hmrAvailable ? "ok" : "warn"), title: hmrAvailable ? "\u4FDD\u5B58\u540E\u7531 dsh-hmr \u539F\u5730\u91CD\u8F7D\uFF0C\u65E0\u9700\u91CD\u542F" : "\u5F53\u524D profile \u672A\u542F\u7528 HMR\uFF1A\u4FDD\u5B58\u540E\u9700\u91CD\u542F DSH \u751F\u6548" },
15166
+ hmrAvailable ? "\u5373\u65F6\u751F\u6548" : "\u9700\u91CD\u542F DSH \u751F\u6548"
15167
+ )
15168
+ ),
15169
+ import_react21.default.createElement(
15170
+ "p",
15171
+ { className: "dkmc-intro" },
15172
+ "\u7BA1\u7406 DSH \u4F7F\u7528\u7684 MCP \u670D\u52A1\u5668\uFF08\u65B0\u589E / \u7F16\u8F91 / \u5220\u9664 / \u542F\u505C\uFF09\uFF0C\u4FDD\u5B58\u540E\u5199\u56DE\u5F53\u524D profile \u7684 cordis \u8865\u4E01\u5C42\u6258\u7BA1\u5757\uFF1B\u8FDE\u63A5\u6210\u529F\u540E\u6A21\u578B\u5DE5\u5177\u5217\u8868\u51FA\u73B0 mcp__<serverName>__<tool>\u3002"
15173
+ )
15174
+ ),
15175
+ import_react21.default.createElement(
15176
+ "div",
15177
+ { key: "meta", className: "dkmc-meta" },
15178
+ import_react21.default.createElement("span", { className: "dkmc-meta-label" }, "\u8865\u4E01\u6587\u4EF6"),
15179
+ import_react21.default.createElement("code", { className: "dkmc-path", title: patchPath || void 0 }, patchPath || "\uFF08\u5C1A\u672A\u8BFB\u53D6\uFF09"),
15180
+ import_react21.default.createElement(
15181
+ "button",
15182
+ { type: "button", className: "dkmc-btn ghost sm", disabled: snap.loading || saving, onClick: () => {
15183
+ setMsg(null);
15184
+ refresh();
15185
+ } },
15186
+ snap.loading ? "\u5237\u65B0\u4E2D\u2026" : "\u5237\u65B0"
15187
+ )
15188
+ )
15189
+ ];
15190
+ if (warnings.length > 0) {
15191
+ body.push(import_react21.default.createElement(
15192
+ "ul",
15193
+ { key: "warnings", className: "dkmc-warnings" },
15194
+ warnings.map((w, i) => import_react21.default.createElement("li", { key: i, className: "dkmc-warning" }, w))
15195
+ ));
15196
+ }
15197
+ if (snap.error) {
15198
+ body.push(import_react21.default.createElement("p", { key: "loaderr", className: "dkmc-error" }, "MCP \u914D\u7F6E\u8BFB\u53D6\u5931\u8D25\uFF1A" + snap.error));
15199
+ }
15200
+ if (msg) {
15201
+ body.push(import_react21.default.createElement("p", {
15202
+ key: "msg",
15203
+ className: "dkmc-msg " + (msg.tone === "ok" ? "ok" : msg.tone === "warn" ? "warn" : "err"),
15204
+ role: "status"
15205
+ }, msg.text));
15206
+ }
15207
+ if (!data) {
15208
+ body.push(import_react21.default.createElement(
15209
+ "div",
15210
+ { key: "empty-loading", className: "dkmc-empty" },
15211
+ snap.loading ? "\u6B63\u5728\u8BFB\u53D6 MCP \u670D\u52A1\u5668\u2026" : "\u6682\u65F6\u8BFB\u4E0D\u5230 MCP \u914D\u7F6E\uFF0C\u70B9\u4E0A\u65B9\u300C\u5237\u65B0\u300D\u91CD\u8BD5"
15212
+ ));
15213
+ } else {
15214
+ body.push(import_react21.default.createElement(
15215
+ "div",
15216
+ { key: "summary", className: "dkmc-summary-line" },
15217
+ "\u5171 " + serverCount + " \u53F0\u670D\u52A1\u5668 \xB7 " + enabledCount + " \u53F0\u542F\u7528 \xB7 \u5DF2\u6CE8\u518C\u5DE5\u5177 " + toolsTotal + " \u4E2A"
15218
+ ));
15219
+ if (drafts.length === 0) {
15220
+ body.push(import_react21.default.createElement("div", { key: "empty", className: "dkmc-empty" }, "\u8FD8\u6CA1\u6709 MCP \u670D\u52A1\u5668\u2014\u2014\u70B9\u4E0B\u65B9\u300C\u65B0\u589E MCP \u670D\u52A1\u5668\u300D\u6DFB\u52A0\uFF0C\u6216\u5148\u586B\u5165\u672C\u673A Xiaomi-OCR \u793A\u4F8B\u3002"));
15221
+ } else {
15222
+ body.push(import_react21.default.createElement(
15223
+ "ul",
15224
+ { key: "cards", className: "dkmc-cards" },
15225
+ drafts.map((draft, index) => {
15226
+ const editing = !!form && form.mode === "edit" && form.index === index;
15227
+ const state = draft.state || "unknown";
15228
+ const stateText = STATE_TEXT[state] || STATE_TEXT.unknown;
15229
+ const toolTitle = draft.tools && draft.tools.length > 0 ? draft.tools.join("\n") : "\u5C1A\u672A\u6CE8\u518C\u5DE5\u5177";
15230
+ return import_react21.default.createElement(
15231
+ "li",
15232
+ { key: draft.serverName + ":" + index, className: "dkmc-card" + (editing ? " editing" : "") },
15233
+ import_react21.default.createElement(
15234
+ "div",
15235
+ { className: "dkmc-rowhead" },
15236
+ import_react21.default.createElement("span", { className: "dkmc-name" }, draft.serverName || "\uFF08\u672A\u547D\u540D\uFF09"),
15237
+ import_react21.default.createElement("span", { className: "dkmc-tag" }, draft.transport === "streamable-http" ? "HTTP" : "stdio"),
15238
+ import_react21.default.createElement(
15239
+ "span",
15240
+ { className: stateClass(state), title: stateText },
15241
+ import_react21.default.createElement("span", { className: stateDotClass(state), "aria-hidden": true }),
15242
+ stateText
15243
+ ),
15244
+ import_react21.default.createElement("span", { className: "dkmc-tools", title: toolTitle }, (Number.isFinite(draft.toolCount) ? draft.toolCount : 0) + " \u4E2A\u5DE5\u5177"),
15245
+ import_react21.default.createElement(
15246
+ "span",
15247
+ { className: "dkmc-actions" },
15248
+ import_react21.default.createElement("button", {
15249
+ type: "button",
15250
+ className: "dkmc-switch" + (draft.enabled ? " on" : ""),
15251
+ role: "switch",
15252
+ "aria-checked": draft.enabled,
15253
+ "aria-label": (draft.enabled ? "\u505C\u7528" : "\u542F\u7528") + draft.serverName,
15254
+ title: draft.enabled ? "\u505C\u7528\uFF08\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\uFF09" : "\u542F\u7528\uFF08\u4FDD\u5B58\u540E\u7ACB\u5373\u751F\u6548\uFF09",
15255
+ disabled: saving,
15256
+ onClick: () => toggle(draft)
15257
+ }, draft.enabled ? "\u5DF2\u542F\u7528" : "\u5DF2\u505C\u7528"),
15258
+ import_react21.default.createElement("button", {
15259
+ type: "button",
15260
+ className: "dkmc-btn ghost sm",
15261
+ "aria-expanded": editing,
15262
+ disabled: saving,
15263
+ onClick: () => editing ? closeForm() : openEdit(draft, index)
15264
+ }, editing ? "\u6536\u8D77" : "\u7F16\u8F91"),
15265
+ import_react21.default.createElement("button", {
15266
+ type: "button",
15267
+ className: "dkmc-btn danger sm" + (delArm === draft.serverName ? " arm" : ""),
15268
+ title: delArm === draft.serverName ? "\u518D\u70B9\u4E00\u6B21\u786E\u8BA4\u5220\u9664" : "\u5220\u9664\u8BE5 MCP \u670D\u52A1\u5668",
15269
+ disabled: saving,
15270
+ onClick: () => remove(draft)
15271
+ }, delArm === draft.serverName ? "\u786E\u8BA4\u5220\u9664\uFF1F" : "\u5220\u9664")
15272
+ )
15273
+ ),
15274
+ draft.error ? import_react21.default.createElement("p", { className: "dkmc-error dkmc-error-line", title: draft.error }, draft.error) : null,
15275
+ editing ? import_react21.default.createElement(ServerForm, {
15276
+ form,
15277
+ patch: patchForm,
15278
+ error: formError,
15279
+ saving,
15280
+ onSave: saveForm,
15281
+ onCancel: closeForm
15282
+ }) : null
15283
+ );
15284
+ })
15285
+ ));
15286
+ }
15287
+ }
15288
+ body.push(import_react21.default.createElement(
15289
+ "div",
15290
+ { key: "add", className: "dkmc-addblock" },
15291
+ form && form.mode === "create" ? import_react21.default.createElement(
15292
+ "div",
15293
+ { className: "dkmc-card dkmc-addcard" },
15294
+ import_react21.default.createElement(ServerForm, {
15295
+ form,
15296
+ patch: patchForm,
15297
+ error: formError,
15298
+ saving,
15299
+ onExample: fillXiaomiExample,
15300
+ onSave: saveForm,
15301
+ onCancel: closeForm
15302
+ })
15303
+ ) : import_react21.default.createElement(
15304
+ "div",
15305
+ { className: "dkmc-addrow" },
15306
+ import_react21.default.createElement("button", { type: "button", className: "dkmc-addbtn", disabled: saving, onClick: openCreate }, "\uFF0B \u65B0\u589E MCP \u670D\u52A1\u5668"),
15307
+ import_react21.default.createElement("button", { type: "button", className: "dkmc-btn ghost", disabled: saving, onClick: fillXiaomiExample }, "\u586B\u5165\u672C\u673A Xiaomi-OCR \u793A\u4F8B")
15308
+ )
15309
+ ));
15310
+ return import_react21.default.createElement("div", { className: "dkmc-page" }, body);
15311
+ }
15312
+ var feature11 = {
15313
+ id: "mcpconfig",
15314
+ name: "MCP\u7BA1\u7406",
15315
+ order: 101,
15316
+ accent: "#a855f7",
15317
+ description: "\u7BA1\u7406 DSH \u4F7F\u7528\u7684 MCP \u670D\u52A1\u5668\uFF08\u589E\u5220\u6539/\u542F\u505C/\u5DE5\u5177\u72B6\u6001\uFF09",
15318
+ defaultEnabled: false,
15319
+ View: McpConfigView,
15320
+ css: [
15321
+ // ---- MCP 管理页(dkmc- 前缀;排版/尺寸对齐 providerconfig 的 dkp- 页) ----
15322
+ ".dkmc-page{width:100%;max-width:760px;display:flex;flex-direction:column;gap:12px;color:var(--dsw-alias-label-primary);font-size:13px;}",
15323
+ ".dkmc-head{display:flex;flex-direction:column;gap:6px;}",
15324
+ ".dkmc-head-title{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}",
15325
+ ".dkmc-title{margin:0;font-size:16px;font-weight:500;line-height:24px;}",
15326
+ ".dkmc-intro{margin:0;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:20px;}",
15327
+ ".dkmc-badge{flex:none;border-radius:999px;padding:2px 9px;font-size:11px;line-height:16px;border:1px solid currentColor;}",
15328
+ ".dkmc-badge.ok{color:var(--dsw-alias-state-success-primary);}",
15329
+ ".dkmc-badge.warn{color:var(--dk-warn);}",
15330
+ ".dkmc-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:8px 10px;border:.5px solid var(--dsw-alias-border-l2);border-radius:var(--dsw-radius-lg,10px);background:var(--dsw-alias-bg-layer-1);}",
15331
+ ".dkmc-meta-label{flex:none;color:var(--dsw-alias-label-tertiary);font-size:12px;}",
15332
+ ".dkmc-path{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--dsw-alias-label-secondary);font-family:var(--ds-font-family-code,ui-monospace,monospace);font-size:12px;}",
15333
+ ".dkmc-warnings{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px;}",
15334
+ ".dkmc-warning{color:var(--dk-warn);font-size:12px;line-height:18px;}",
15335
+ ".dkmc-error{margin:0;color:var(--dsw-alias-state-error-primary);font-size:12px;line-height:18px;word-break:break-word;}",
15336
+ ".dkmc-error-line{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}",
15337
+ ".dkmc-msg{margin:0;font-size:12px;line-height:18px;word-break:break-word;}",
15338
+ ".dkmc-msg.ok{color:var(--dsw-alias-state-success-primary);}",
15339
+ ".dkmc-msg.warn{color:var(--dk-warn);}",
15340
+ ".dkmc-msg.err{color:var(--dsw-alias-state-error-primary);}",
15341
+ ".dkmc-summary-line{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px;}",
15342
+ ".dkmc-empty{border:1px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg,10px);padding:16px 12px;text-align:center;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px;}",
15343
+ ".dkmc-cards{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px;}",
15344
+ ".dkmc-card{box-sizing:border-box;margin:0;border:.5px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-settings-card-fill,var(--dsw-alias-bg-layer-1));border-radius:var(--dsw-radius-lg,10px);padding:10px 12px;display:flex;flex-direction:column;gap:8px;}",
15345
+ ".dkmc-card.editing{border-color:color-mix(in srgb,var(--dk-accent) 45%,var(--dsw-alias-border-l2));}",
15346
+ ".dkmc-rowhead{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}",
15347
+ ".dkmc-name{font-size:14px;font-weight:600;line-height:22px;overflow:hidden;text-overflow:ellipsis;max-width:100%;}",
15348
+ ".dkmc-tag{flex:none;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-xs,4px);color:var(--dsw-alias-label-secondary);padding:1px 6px;font-size:11px;line-height:16px;}",
15349
+ ".dkmc-state{flex:none;display:inline-flex;align-items:center;gap:5px;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;white-space:nowrap;}",
15350
+ ".dkmc-state.ok{color:var(--dsw-alias-state-success-primary);}",
15351
+ ".dkmc-state.err{color:var(--dsw-alias-state-error-primary);}",
15352
+ ".dkmc-dot{width:7px;height:7px;border-radius:50%;flex:none;background:var(--dsw-alias-label-tertiary);}",
15353
+ ".dkmc-dot.ok{background:var(--dsw-alias-state-success-primary);box-shadow:0 0 4px color-mix(in srgb,var(--dsw-alias-state-success-primary) 55%,transparent);}",
15354
+ ".dkmc-dot.err{background:var(--dsw-alias-state-error-primary);}",
15355
+ ".dkmc-dot.idle{background:transparent;border:1.5px solid var(--dsw-alias-label-secondary);}",
15356
+ ".dkmc-dot.off{background:transparent;border:1.5px solid var(--dsw-alias-label-tertiary);opacity:.75;}",
15357
+ ".dkmc-tools{flex:none;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;white-space:nowrap;cursor:default;}",
15358
+ ".dkmc-actions{flex:none;margin-left:auto;display:inline-flex;align-items:center;gap:4px;flex-wrap:wrap;}",
15359
+ ".dkmc-switch{cursor:pointer;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);border-radius:999px;padding:3px 10px;font-family:inherit;font-size:11px;line-height:16px;}",
15360
+ ".dkmc-switch.on{color:var(--dsw-alias-state-success-primary);border-color:currentColor;}",
15361
+ ".dkmc-switch[disabled]{opacity:.45;cursor:default;}",
15362
+ ".dkmc-btn{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;gap:4px;height:32px;padding:0 12px;border:none;border-radius:var(--dsw-radius-md,8px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:20px;cursor:pointer;}",
15363
+ ".dkmc-btn.ghost{border:.5px solid var(--dsw-alias-border-l3);}",
15364
+ ".dkmc-btn.ghost:hover{background:var(--dsw-alias-interactive-bg-hover);}",
15365
+ ".dkmc-btn.primary{background:var(--dsw-alias-button-primary-fill,var(--dk-accent));color:var(--dsw-alias-label-primary-foreground,#fff);}",
15366
+ ".dkmc-btn.danger{color:var(--dsw-alias-state-error-primary);}",
15367
+ ".dkmc-btn.danger:hover{background:var(--dsw-alias-interactive-bg-hover-danger,rgba(220,38,38,.1));}",
15368
+ ".dkmc-btn.arm{color:var(--dsw-alias-state-error-primary);border:.5px solid currentColor;}",
15369
+ ".dkmc-btn.sm{height:26px;padding:0 9px;border-radius:var(--dsw-radius-sm,6px);font-size:11px;line-height:16px;}",
15370
+ ".dkmc-btn[disabled]{opacity:.4;cursor:default;}",
15371
+ ".dkmc-editor{border-radius:var(--dsw-radius-lg,10px);background:var(--dsw-alias-bg-module-platform,var(--dsw-alias-bg-layer-1));padding:12px 14px;display:flex;flex-direction:column;gap:12px;}",
15372
+ ".dkmc-editor-head{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap;}",
15373
+ ".dkmc-editor-title{font-size:13px;font-weight:600;line-height:20px;}",
15374
+ ".dkmc-editor-sub{color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;}",
15375
+ ".dkmc-example{margin-left:auto;flex:none;}",
15376
+ ".dkmc-field{display:flex;flex-direction:column;gap:5px;min-width:0;}",
15377
+ ".dkmc-flabel{display:inline-flex;align-items:center;gap:8px;color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px;}",
15378
+ ".dkmc-hint{margin:0;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;word-break:break-word;}",
15379
+ ".dkmc-input{box-sizing:border-box;width:100%;height:32px;padding:0 10px;border:.5px solid var(--dsw-alias-border-l4,var(--dsw-alias-border-l2));border-radius:var(--dsw-radius-md,8px);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:20px;}",
15380
+ ".dkmc-input:focus{border-color:var(--dsw-alias-state-business-primary,var(--dk-accent));outline:none;}",
15381
+ ".dkmc-input::placeholder{color:var(--dsw-alias-label-dimmed,var(--dsw-alias-label-tertiary));}",
15382
+ ".dkmc-input:disabled{opacity:.6;cursor:default;}",
15383
+ ".dkmc-textarea{height:auto;min-height:64px;padding:8px 10px;resize:vertical;line-height:1.5;font-family:var(--ds-font-family-code,ui-monospace,monospace);font-size:12px;}",
15384
+ "select.dkmc-input{appearance:auto;cursor:pointer;max-width:280px;}",
15385
+ ".dkmc-check{display:inline-flex;align-items:center;gap:6px;cursor:pointer;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:18px;}",
15386
+ ".dkmc-check input{accent-color:var(--dk-accent);margin:0;}",
15387
+ ".dkmc-advanced{border-top:.5px solid var(--dsw-alias-border-l2);padding-top:10px;}",
15388
+ ".dkmc-summary{display:flex;align-items:center;gap:6px;width:fit-content;margin-left:-4px;padding:2px 4px;border-radius:var(--dsw-radius-sm,6px);list-style:none;cursor:pointer;color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:500;line-height:18px;}",
15389
+ ".dkmc-summary::-webkit-details-marker{display:none;}",
15390
+ '.dkmc-summary::before{content:"";width:5px;height:5px;border-right:1.5px solid;border-bottom:1.5px solid;transform:rotate(-45deg);transition:transform .12s;}',
15391
+ ".dkmc-advanced[open]>.dkmc-summary::before{transform:rotate(45deg);}",
15392
+ ".dkmc-advanced-body{display:flex;flex-direction:column;gap:12px;padding-top:12px;}",
15393
+ ".dkmc-editor-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap;border-top:.5px solid var(--dsw-alias-border-l2);padding-top:10px;}",
15394
+ ".dkmc-addblock{display:flex;align-items:stretch;}",
15395
+ ".dkmc-addrow{display:flex;align-items:stretch;gap:8px;flex-wrap:wrap;}",
15396
+ ".dkmc-addbtn{box-sizing:border-box;flex:1 1 220px;min-width:180px;height:44px;display:inline-flex;align-items:center;justify-content:center;gap:6px;border:1px dashed var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-lg,10px);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:14px;line-height:22px;cursor:pointer;}",
15397
+ ".dkmc-addbtn:hover{background:var(--dsw-alias-interactive-bg-hover);}",
15398
+ ".dkmc-addbtn[disabled]{opacity:.4;cursor:default;}",
15399
+ ".dkmc-addcard{flex:1 1 auto;padding:12px 14px;}",
15400
+ ".dkmc-addcard .dkmc-editor{background:transparent;padding:0;}",
15401
+ "@media (max-width:680px){.dkmc-page{max-width:none;gap:14px}.dkmc-intro{font-size:13px;line-height:20px}.dkmc-editor{padding:12px}.dkmc-addcard{padding:12px 14px}.dkmc-btn{height:40px}.dkmc-btn.sm{height:34px}.dkmc-addbtn{height:48px;flex:1 1 100%}.dkmc-actions{width:100%;margin-left:0;justify-content:flex-end}.dkmc-name{font-size:15px}}"
15402
+ ].join("\n")
15403
+ };
15404
+
14655
15405
  // src/client.jsx
14656
- var DOCK_VERSION = "0.21.2";
14657
- var BUILTIN_FEATURES = [feature, feature2, feature3, feature4, feature5, feature6, feature7, feature8, feature9, feature10, feature11, feature12];
15406
+ var DOCK_VERSION = "0.23.1";
15407
+ var BUILTIN_FEATURES = [feature, feature2, feature3, feature11, feature4, feature5, feature6, feature7, feature8, feature9, feature10];
14658
15408
  var PLANNED_FEATURES = [];
14659
15409
  var PLANNED_NOTES = {};
14660
15410
  var externalDefs = [];
@@ -14774,8 +15524,10 @@ var SHELL_CSS = [
14774
15524
  ".dockm-page-wide-btn{flex:none;margin-left:auto;display:inline-flex;align-items:center;gap:4px;height:28px;padding:0 10px;border-radius:8px;border:1px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-secondary);font-family:inherit;font-size:12px;cursor:pointer;}",
14775
15525
  ".dockm-page-wide-btn:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);}",
14776
15526
  /* 面板页的左侧菜单收窄:给右侧列表/表格让出宽度,别留大片空白 */
14777
- ".dockm-page .dockm-nav{width:140px;padding:8px 6px;}",
14778
- ".dockm-page .dockm-nav-item{padding:7px 8px;font-size:12.5px;gap:6px;}",
15527
+ // 左侧菜单列:内容只有 8px 圆点 + 4 字标签,140px 会留一大条空白(用户反馈「这个宽度可以缩小点」)。
15528
+ // 用 border-box 收到 110px(含内距):既够放最长标签「MCP管理 / 远程访问」,又把右侧死区收掉,正文区更宽。
15529
+ ".dockm-page .dockm-nav{box-sizing:border-box;width:110px;padding:8px 7px;}",
15530
+ ".dockm-page .dockm-nav-item{padding:7px 8px;font-size:12.5px;gap:6px;overflow:hidden;}",
14779
15531
  ".dockm-page-body>.dockm-body{flex:1;min-height:0;}",
14780
15532
  ".dockm-page-icon{flex:none;display:flex;align-items:center;justify-content:center;width:34px;height:34px;border-radius:10px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);}",
14781
15533
  ".dockm-page-titles{min-width:0;}",
@@ -14895,8 +15647,8 @@ function ensureCss() {
14895
15647
  }
14896
15648
  }
14897
15649
  function useExternalVersion() {
14898
- const [, bump] = import_react24.default.useReducer((n) => n + 1, 0);
14899
- import_react24.default.useEffect(() => {
15650
+ const [, bump] = import_react22.default.useReducer((n) => n + 1, 0);
15651
+ import_react22.default.useEffect(() => {
14900
15652
  externalListeners.add(bump);
14901
15653
  return () => {
14902
15654
  externalListeners.delete(bump);
@@ -14906,25 +15658,25 @@ function useExternalVersion() {
14906
15658
  var lastGeom = { x: null, y: null, w: null, h: null };
14907
15659
  function DockIcon(props) {
14908
15660
  const size = props && props.size || 16;
14909
- return import_react24.default.createElement(
15661
+ return import_react22.default.createElement(
14910
15662
  "svg",
14911
15663
  { width: size, height: size, viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.3, "aria-hidden": true },
14912
- import_react24.default.createElement("rect", { x: 2.5, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
14913
- import_react24.default.createElement("rect", { x: 9, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
14914
- import_react24.default.createElement("rect", { x: 2.5, y: 9, width: 4.4, height: 4.4, rx: 1.2 }),
14915
- import_react24.default.createElement("rect", { x: 9, y: 9, width: 4.4, height: 4.4, rx: 1.2 })
15664
+ import_react22.default.createElement("rect", { x: 2.5, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
15665
+ import_react22.default.createElement("rect", { x: 9, y: 2.5, width: 4.4, height: 4.4, rx: 1.2 }),
15666
+ import_react22.default.createElement("rect", { x: 2.5, y: 9, width: 4.4, height: 4.4, rx: 1.2 }),
15667
+ import_react22.default.createElement("rect", { x: 9, y: 9, width: 4.4, height: 4.4, rx: 1.2 })
14916
15668
  );
14917
15669
  }
14918
15670
  function DockWorkspace() {
14919
- const [nav, setNav] = import_react24.default.useState({ open: panelNav.open, active: panelNav.active, params: panelNav.params });
14920
- import_react24.default.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open, active: panelNav.active, params: panelNav.params })), []);
15671
+ const [nav, setNav] = import_react22.default.useState({ open: panelNav.open, active: panelNav.active, params: panelNav.params });
15672
+ import_react22.default.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open, active: panelNav.active, params: panelNav.params })), []);
14921
15673
  const active = nav.active;
14922
15674
  const navParams = nav.params;
14923
15675
  const setActive = navigatePanel;
14924
- const [, force] = import_react24.default.useReducer((n) => n + 1, 0);
15676
+ const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
14925
15677
  useExternalVersion();
14926
- const contentRef = import_react24.default.useRef(null);
14927
- import_react24.default.useEffect(() => {
15678
+ const contentRef = import_react22.default.useRef(null);
15679
+ import_react22.default.useEffect(() => {
14928
15680
  if (contentRef.current) contentRef.current.scrollTop = 0;
14929
15681
  }, [active]);
14930
15682
  const MODULES = allModules();
@@ -14932,26 +15684,26 @@ function DockWorkspace() {
14932
15684
  const mod = isHome ? null : MODULES.find((m) => m.id === active) || MODULES[0];
14933
15685
  const st = mod ? stateOf(mod.id) : null;
14934
15686
  const View = mod ? mod.View : null;
14935
- const viewNode = mod && View ? import_react24.default.createElement(
15687
+ const viewNode = mod && View ? import_react22.default.createElement(
14936
15688
  "div",
14937
15689
  { className: "dockm-view" },
14938
- import_react24.default.createElement(
15690
+ import_react22.default.createElement(
14939
15691
  FeatureBoundary,
14940
15692
  { key: mod.id, label: mod.name },
14941
- import_react24.default.createElement(View, { ctx: ctxRef.current, feature: mod, params: navParams })
15693
+ import_react22.default.createElement(View, { ctx: ctxRef.current, feature: mod, params: navParams })
14942
15694
  )
14943
15695
  ) : null;
14944
15696
  const enabledCount = MODULES.filter((m) => {
14945
15697
  const s = stateOf(m.id);
14946
15698
  return !!(s && s.enabled);
14947
15699
  }).length;
14948
- return import_react24.default.createElement(
15700
+ return import_react22.default.createElement(
14949
15701
  "div",
14950
15702
  { className: "dockm-body" },
14951
- import_react24.default.createElement(
15703
+ import_react22.default.createElement(
14952
15704
  "nav",
14953
15705
  { className: "dockm-nav", "aria-label": "\u529F\u80FD\u6A21\u5757" },
14954
- import_react24.default.createElement(
15706
+ import_react22.default.createElement(
14955
15707
  "button",
14956
15708
  {
14957
15709
  type: "button",
@@ -14959,10 +15711,10 @@ function DockWorkspace() {
14959
15711
  className: "dockm-nav-item" + (isHome ? " on" : ""),
14960
15712
  onClick: () => setActive("home")
14961
15713
  },
14962
- import_react24.default.createElement("span", { className: "dockm-navhome" }, import_react24.default.createElement(DockIcon, null)),
14963
- import_react24.default.createElement("span", null, "\u9996\u9875")
15714
+ import_react22.default.createElement("span", { className: "dockm-navhome" }, import_react22.default.createElement(DockIcon, null)),
15715
+ import_react22.default.createElement("span", null, "\u9996\u9875")
14964
15716
  ),
14965
- MODULES.map((m) => import_react24.default.createElement(
15717
+ MODULES.map((m) => import_react22.default.createElement(
14966
15718
  "button",
14967
15719
  {
14968
15720
  type: "button",
@@ -14970,42 +15722,42 @@ function DockWorkspace() {
14970
15722
  className: "dockm-nav-item" + (m.id === active ? " on" : ""),
14971
15723
  onClick: () => setActive(m.id)
14972
15724
  },
14973
- import_react24.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
14974
- import_react24.default.createElement("span", null, m.name),
14975
- m.planned ? import_react24.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
14976
- m.external ? import_react24.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8") : null
15725
+ import_react22.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
15726
+ import_react22.default.createElement("span", null, m.name),
15727
+ m.planned ? import_react22.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
15728
+ m.external ? import_react22.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8") : null
14977
15729
  ))
14978
15730
  ),
14979
- import_react24.default.createElement(
15731
+ import_react22.default.createElement(
14980
15732
  "div",
14981
15733
  { className: "dockm-content", ref: contentRef },
14982
- import_react24.default.createElement(
15734
+ import_react22.default.createElement(
14983
15735
  "div",
14984
15736
  { className: "dockm-content-head" },
14985
- import_react24.default.createElement(
15737
+ import_react22.default.createElement(
14986
15738
  "div",
14987
15739
  { className: "dockm-name" },
14988
- isHome ? import_react24.default.createElement("span", { className: "dockm-navhome" }, import_react24.default.createElement(DockIcon, null)) : import_react24.default.createElement("span", { className: "dockm-dot", style: { background: mod.accent } }),
15740
+ isHome ? import_react22.default.createElement("span", { className: "dockm-navhome" }, import_react22.default.createElement(DockIcon, null)) : import_react22.default.createElement("span", { className: "dockm-dot", style: { background: mod.accent } }),
14989
15741
  isHome ? "\u9996\u9875" : mod.name,
14990
- !isHome && mod.planned ? import_react24.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
14991
- !isHome && mod.external ? import_react24.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8\u5305" + (mod.package ? " \xB7 " + mod.package : "")) : null
15742
+ !isHome && mod.planned ? import_react22.default.createElement("span", { className: "dockm-badge" }, "\u89C4\u5212\u4E2D") : null,
15743
+ !isHome && mod.external ? import_react22.default.createElement("span", { className: "dockm-badge" }, "\u5916\u90E8\u5305" + (mod.package ? " \xB7 " + mod.package : "")) : null
14992
15744
  ),
14993
- import_react24.default.createElement(
15745
+ import_react22.default.createElement(
14994
15746
  "div",
14995
15747
  { className: "dockm-desc" },
14996
15748
  isHome ? "\u6240\u6709\u5B50\u529F\u80FD\u603B\u63FD\uFF1A\u8FD0\u884C\u72B6\u6001\u3001\u6982\u8981\u4E0E\u5FEB\u6377\u5F00\u5173\uFF0C\u70B9\u51FB\u5361\u7247\u8FDB\u5165\u5BF9\u5E94\u529F\u80FD\u9875\u3002" : mod.description
14997
15749
  )
14998
15750
  ),
14999
- isHome ? import_react24.default.createElement("div", { className: "dockm-view" }, import_react24.default.createElement(HomeView, { ctx: ctxRef.current, onOpen: setActive, onToggle: force })) : mod.planned ? import_react24.default.createElement("div", { className: "dockm-note" }, PLANNED_NOTES[mod.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : st && st.enabled && viewNode ? viewNode : st && st.error ? import_react24.default.createElement("div", { className: "dockm-note dockm-err" }, "\u529F\u80FD\u51FA\u9519\uFF1A" + st.error) : import_react24.default.createElement("div", { className: "dockm-note" }, "\u8BE5\u529F\u80FD\u5F53\u524D\u4E3A\u505C\u7528\u72B6\u6001\uFF08\u5F00\u5173\u5DF2\u6301\u4E45\u5316\uFF0C\u91CD\u542F\u540E\u4FDD\u6301\uFF09"),
15000
- import_react24.default.createElement(
15751
+ isHome ? import_react22.default.createElement("div", { className: "dockm-view" }, import_react22.default.createElement(HomeView, { ctx: ctxRef.current, onOpen: setActive, onToggle: force })) : mod.planned ? import_react22.default.createElement("div", { className: "dockm-note" }, PLANNED_NOTES[mod.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : st && st.enabled && viewNode ? viewNode : st && st.error ? import_react22.default.createElement("div", { className: "dockm-note dockm-err" }, "\u529F\u80FD\u51FA\u9519\uFF1A" + st.error) : import_react22.default.createElement("div", { className: "dockm-note" }, "\u8BE5\u529F\u80FD\u5F53\u524D\u4E3A\u505C\u7528\u72B6\u6001\uFF08\u5F00\u5173\u5DF2\u6301\u4E45\u5316\uFF0C\u91CD\u542F\u540E\u4FDD\u6301\uFF09"),
15752
+ import_react22.default.createElement(
15001
15753
  "div",
15002
15754
  { className: "dockm-foot" },
15003
- import_react24.default.createElement("span", null, isHome ? "\u529F\u80FD\u575E v" + DOCK_VERSION + " \xB7 \u5171 " + MODULES.length + " \u4E2A\u529F\u80FD\u6A21\u5757\uFF0C" + enabledCount + " \u4E2A\u5DF2\u542F\u7528" : "\u529F\u80FD\u575E v" + DOCK_VERSION + " \xB7 \u65B0\u529F\u80FD\u6309\u8DEF\u7EBF\u56FE\u8FFD\u52A0"),
15004
- !isHome && mod && !mod.planned && st ? import_react24.default.createElement(
15755
+ import_react22.default.createElement("span", null, isHome ? "\u529F\u80FD\u575E v" + DOCK_VERSION + " \xB7 \u5171 " + MODULES.length + " \u4E2A\u529F\u80FD\u6A21\u5757\uFF0C" + enabledCount + " \u4E2A\u5DF2\u542F\u7528" : "\u529F\u80FD\u575E v" + DOCK_VERSION + " \xB7 \u65B0\u529F\u80FD\u6309\u8DEF\u7EBF\u56FE\u8FFD\u52A0"),
15756
+ !isHome && mod && !mod.planned && st ? import_react22.default.createElement(
15005
15757
  "span",
15006
15758
  { className: "dockm-foot-sw" },
15007
- import_react24.default.createElement("span", { className: "dockm-foot-swlabel" + (st.enabled ? " on" : "") }, st.enabled ? "\u5DF2\u542F\u7528" : "\u5DF2\u505C\u7528"),
15008
- import_react24.default.createElement("button", {
15759
+ import_react22.default.createElement("span", { className: "dockm-foot-swlabel" + (st.enabled ? " on" : "") }, st.enabled ? "\u5DF2\u542F\u7528" : "\u5DF2\u505C\u7528"),
15760
+ import_react22.default.createElement("button", {
15009
15761
  type: "button",
15010
15762
  className: "dock-sw" + (st.enabled ? " on" : ""),
15011
15763
  role: "switch",
@@ -15018,11 +15770,11 @@ function DockWorkspace() {
15018
15770
  }
15019
15771
  })
15020
15772
  ) : null,
15021
- !isHome && mod && typeof mod.Chip === "function" ? import_react24.default.createElement(
15773
+ !isHome && mod && typeof mod.Chip === "function" ? import_react22.default.createElement(
15022
15774
  "span",
15023
15775
  { className: "dockm-foot-sw" },
15024
- import_react24.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(mod.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
15025
- import_react24.default.createElement("button", {
15776
+ import_react22.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(mod.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
15777
+ import_react22.default.createElement("button", {
15026
15778
  type: "button",
15027
15779
  className: "dock-sw" + (chipShown(mod.id) ? " on" : ""),
15028
15780
  role: "switch",
@@ -15040,12 +15792,12 @@ function DockWorkspace() {
15040
15792
  );
15041
15793
  }
15042
15794
  function DockModal() {
15043
- const [nav, setNav] = import_react24.default.useState({ open: panelNav.open });
15044
- import_react24.default.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open })), []);
15795
+ const [nav, setNav] = import_react22.default.useState({ open: panelNav.open });
15796
+ import_react22.default.useEffect(() => subscribePanel(() => setNav({ open: panelNav.open })), []);
15045
15797
  const open = nav.open || typeof document === "undefined";
15046
- const [win, setWin] = import_react24.default.useState(() => ({ mode: "normal", x: null, y: null, w: null, h: null }));
15047
- const dlgRef = import_react24.default.useRef(null);
15048
- import_react24.default.useEffect(() => {
15798
+ const [win, setWin] = import_react22.default.useState(() => ({ mode: "normal", x: null, y: null, w: null, h: null }));
15799
+ const dlgRef = import_react22.default.useRef(null);
15800
+ import_react22.default.useEffect(() => {
15049
15801
  if (lastGeom.w) setWin({ mode: "normal", x: lastGeom.x, y: lastGeom.y, w: lastGeom.w, h: lastGeom.h });
15050
15802
  }, []);
15051
15803
  function beginDrag(e, type) {
@@ -15085,10 +15837,10 @@ function DockModal() {
15085
15837
  width: win.w != null ? win.w : void 0,
15086
15838
  height: win.mode === "min" ? "auto" : win.h != null ? win.h : void 0
15087
15839
  } : null;
15088
- return import_react24.default.createElement(
15840
+ return import_react22.default.createElement(
15089
15841
  "div",
15090
15842
  { className: "dockm-backdrop", onClick: () => setPanelOpen(false) },
15091
- import_react24.default.createElement(
15843
+ import_react22.default.createElement(
15092
15844
  "div",
15093
15845
  {
15094
15846
  className: "dockm-dialog" + (win.mode === "max" ? " dockm-max" : "") + (win.mode === "min" ? " dockm-min" : ""),
@@ -15096,59 +15848,59 @@ function DockModal() {
15096
15848
  ref: dlgRef,
15097
15849
  onClick: (e) => e.stopPropagation()
15098
15850
  },
15099
- import_react24.default.createElement(
15851
+ import_react22.default.createElement(
15100
15852
  "div",
15101
15853
  {
15102
15854
  className: "dockm-head",
15103
15855
  onPointerDown: (e) => beginDrag(e, "move"),
15104
15856
  onDoubleClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "max" ? "normal" : "max" }))
15105
15857
  },
15106
- import_react24.default.createElement(DockIcon, null),
15107
- import_react24.default.createElement("span", { className: "dockm-title" }, "\u529F\u80FD\u575E"),
15108
- import_react24.default.createElement("span", { className: "dockm-sub" }, "dsh-dock \xB7 \u4E5F\u53EF\u5728 \u8BBE\u7F6E \u2192 \u529F\u80FD\u575E \u6253\u5F00\u7BA1\u7406\u9875"),
15109
- import_react24.default.createElement(
15858
+ import_react22.default.createElement(DockIcon, null),
15859
+ import_react22.default.createElement("span", { className: "dockm-title" }, "\u529F\u80FD\u575E"),
15860
+ import_react22.default.createElement("span", { className: "dockm-sub" }, "dsh-dock \xB7 \u4E5F\u53EF\u5728 \u8BBE\u7F6E \u2192 \u529F\u80FD\u575E \u6253\u5F00\u7BA1\u7406\u9875"),
15861
+ import_react22.default.createElement(
15110
15862
  "span",
15111
15863
  { className: "dockm-ctrls" },
15112
- import_react24.default.createElement("button", {
15864
+ import_react22.default.createElement("button", {
15113
15865
  type: "button",
15114
15866
  className: "dockm-win",
15115
15867
  title: win.mode === "min" ? "\u8FD8\u539F" : "\u6700\u5C0F\u5316",
15116
15868
  onClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "min" ? "normal" : "min" }))
15117
15869
  }, "\u2581"),
15118
- import_react24.default.createElement("button", {
15870
+ import_react22.default.createElement("button", {
15119
15871
  type: "button",
15120
15872
  className: "dockm-win",
15121
15873
  title: win.mode === "max" ? "\u8FD8\u539F" : "\u6700\u5927\u5316",
15122
15874
  onClick: () => setWin((s) => Object.assign({}, s, { mode: s.mode === "max" ? "normal" : "max" }))
15123
15875
  }, win.mode === "max" ? "\u2750" : "\u25A2"),
15124
- import_react24.default.createElement("button", { type: "button", className: "dockm-close", "aria-label": "\u5173\u95ED", title: "\u5173\u95ED", onClick: () => setPanelOpen(false) }, "\u2715")
15876
+ import_react22.default.createElement("button", { type: "button", className: "dockm-close", "aria-label": "\u5173\u95ED", title: "\u5173\u95ED", onClick: () => setPanelOpen(false) }, "\u2715")
15125
15877
  )
15126
15878
  ),
15127
- import_react24.default.createElement(DockWorkspace, null),
15128
- win.mode === "normal" ? import_react24.default.createElement("div", { className: "dockm-resize", onPointerDown: (e) => beginDrag(e, "size") }) : null
15879
+ import_react22.default.createElement(DockWorkspace, null),
15880
+ win.mode === "normal" ? import_react22.default.createElement("div", { className: "dockm-resize", onPointerDown: (e) => beginDrag(e, "size") }) : null
15129
15881
  )
15130
15882
  );
15131
15883
  }
15132
15884
  function HomeView(props) {
15133
15885
  const ctx = props && props.ctx;
15134
- const [, force] = import_react24.default.useReducer((n) => n + 1, 0);
15886
+ const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
15135
15887
  useExternalVersion();
15136
15888
  const open = (id) => {
15137
15889
  if (props && typeof props.onOpen === "function") props.onOpen(id);
15138
15890
  };
15139
- return import_react24.default.createElement(
15891
+ return import_react22.default.createElement(
15140
15892
  "div",
15141
15893
  { className: "dockh-grid" },
15142
15894
  allModules().map((m) => {
15143
15895
  const st = stateOf(m.id);
15144
15896
  const enabled = !!(st && st.enabled);
15145
15897
  const Stat = m.HomeStat;
15146
- const statNode = m.planned ? import_react24.default.createElement("span", null, PLANNED_NOTES[m.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : enabled && Stat ? import_react24.default.createElement(
15898
+ const statNode = m.planned ? import_react22.default.createElement("span", null, PLANNED_NOTES[m.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : enabled && Stat ? import_react22.default.createElement(
15147
15899
  FeatureBoundary,
15148
15900
  { key: m.id, label: m.name },
15149
- import_react24.default.createElement(Stat, { ctx })
15150
- ) : import_react24.default.createElement("span", null, "\u5DF2\u505C\u7528\uFF0C\u542F\u7528\u540E\u5728\u6B64\u5C55\u793A\u8FD0\u884C\u6982\u8981");
15151
- return import_react24.default.createElement(
15901
+ import_react22.default.createElement(Stat, { ctx })
15902
+ ) : import_react22.default.createElement("span", null, "\u5DF2\u505C\u7528\uFF0C\u542F\u7528\u540E\u5728\u6B64\u5C55\u793A\u8FD0\u884C\u6982\u8981");
15903
+ return import_react22.default.createElement(
15152
15904
  "div",
15153
15905
  {
15154
15906
  key: m.id,
@@ -15163,21 +15915,21 @@ function HomeView(props) {
15163
15915
  }
15164
15916
  }
15165
15917
  },
15166
- import_react24.default.createElement(
15918
+ import_react22.default.createElement(
15167
15919
  "div",
15168
15920
  { className: "dockh-head" },
15169
- import_react24.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
15170
- import_react24.default.createElement("span", { className: "dockh-name" }, m.name),
15171
- m.external ? import_react24.default.createElement("span", { className: "dockh-badge", title: m.package || void 0 }, "\u5916\u90E8") : null,
15921
+ import_react22.default.createElement("span", { className: "dockm-dot", style: { background: m.accent } }),
15922
+ import_react22.default.createElement("span", { className: "dockh-name" }, m.name),
15923
+ m.external ? import_react22.default.createElement("span", { className: "dockh-badge", title: m.package || void 0 }, "\u5916\u90E8") : null,
15172
15924
  // 状态标识:圆点 + 文字(纯展示,与开关视觉区分)
15173
- import_react24.default.createElement(
15925
+ import_react22.default.createElement(
15174
15926
  "span",
15175
15927
  { className: "dockh-status" + (m.planned ? " plan" : enabled ? "" : " off") },
15176
- import_react24.default.createElement("span", { className: "dockh-sdot" }),
15177
- import_react24.default.createElement("span", null, m.planned ? "\u89C4\u5212\u4E2D" : enabled ? "\u8FD0\u884C\u4E2D" : "\u5DF2\u505C\u7528")
15928
+ import_react22.default.createElement("span", { className: "dockh-sdot" }),
15929
+ import_react22.default.createElement("span", null, m.planned ? "\u89C4\u5212\u4E2D" : enabled ? "\u8FD0\u884C\u4E2D" : "\u5DF2\u505C\u7528")
15178
15930
  ),
15179
15931
  // 启停开关(规划中的功能不显示)
15180
- m.planned ? null : import_react24.default.createElement("button", {
15932
+ m.planned ? null : import_react22.default.createElement("button", {
15181
15933
  type: "button",
15182
15934
  className: "dock-sw" + (enabled ? " on" : ""),
15183
15935
  role: "switch",
@@ -15192,12 +15944,12 @@ function HomeView(props) {
15192
15944
  }
15193
15945
  })
15194
15946
  ),
15195
- import_react24.default.createElement("div", { className: "dockh-desc" }, m.description),
15196
- import_react24.default.createElement("div", { className: "dockh-stat" }, statNode),
15197
- import_react24.default.createElement(
15947
+ import_react22.default.createElement("div", { className: "dockh-desc" }, m.description),
15948
+ import_react22.default.createElement("div", { className: "dockh-stat" }, statNode),
15949
+ import_react22.default.createElement(
15198
15950
  "div",
15199
15951
  { className: "dockh-foot" },
15200
- import_react24.default.createElement("span", { className: "dockh-go" }, "\u67E5\u770B\u8BE6\u60C5 \u2192")
15952
+ import_react22.default.createElement("span", { className: "dockh-go" }, "\u67E5\u770B\u8BE6\u60C5 \u2192")
15201
15953
  )
15202
15954
  );
15203
15955
  })
@@ -15205,16 +15957,16 @@ function HomeView(props) {
15205
15957
  }
15206
15958
  function DockPanel(props) {
15207
15959
  const ctx = ctxRef.current;
15208
- const [, force] = import_react24.default.useReducer((n) => n + 1, 0);
15960
+ const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
15209
15961
  useExternalVersion();
15210
15962
  const toggle = (id) => {
15211
15963
  toggleFeature(id);
15212
15964
  force();
15213
15965
  };
15214
- return import_react24.default.createElement(
15966
+ return import_react22.default.createElement(
15215
15967
  "div",
15216
15968
  { className: "dock-root" },
15217
- import_react24.default.createElement(
15969
+ import_react22.default.createElement(
15218
15970
  "div",
15219
15971
  { className: "dock-intro" },
15220
15972
  "\u529F\u80FD\u575E\uFF08dsh-dock\uFF09\xB7 \u6240\u6709\u5C0F\u529F\u80FD\u96C6\u4E2D\u5728\u8FD9\u4E00\u4E2A\u9762\u677F\u91CC\u7BA1\u7406\u3002v0.4.0 \u8D77\u6BCF\u4E2A\u529F\u80FD\u662F\u72EC\u7ACB\u6A21\u5757\uFF08features/<id>/\uFF09\uFF0C",
@@ -15223,25 +15975,25 @@ function DockPanel(props) {
15223
15975
  allModules().map((f) => {
15224
15976
  const st = stateOf(f.id);
15225
15977
  const View = f.View;
15226
- const viewNode = !f.planned && st.enabled && View ? import_react24.default.createElement(
15978
+ const viewNode = !f.planned && st.enabled && View ? import_react22.default.createElement(
15227
15979
  "div",
15228
15980
  { className: "dock-body" },
15229
- import_react24.default.createElement(
15981
+ import_react22.default.createElement(
15230
15982
  FeatureBoundary,
15231
15983
  { key: f.id, label: f.name },
15232
- import_react24.default.createElement(View, { ctx, feature: f, params: props && props.params })
15984
+ import_react22.default.createElement(View, { ctx, feature: f, params: props && props.params })
15233
15985
  )
15234
15986
  ) : null;
15235
- return import_react24.default.createElement(
15987
+ return import_react22.default.createElement(
15236
15988
  "div",
15237
15989
  { className: "dock-card", key: f.id },
15238
- import_react24.default.createElement(
15990
+ import_react22.default.createElement(
15239
15991
  "div",
15240
15992
  { className: "dock-card-head" },
15241
- import_react24.default.createElement("span", { className: "dock-dot" + (st.error ? " err" : st.enabled ? " on" : "") }),
15242
- import_react24.default.createElement("span", { className: "dock-name" }, f.name),
15243
- import_react24.default.createElement("span", { className: "dock-desc" }, f.description + (f.external ? "\uFF08\u6765\u81EA\u5916\u90E8\u5305" + (f.package ? " " + f.package : "") + "\uFF09" : "")),
15244
- f.planned ? import_react24.default.createElement("span", { className: "dock-badge" }, "\u89C4\u5212\u4E2D") : import_react24.default.createElement("button", {
15993
+ import_react22.default.createElement("span", { className: "dock-dot" + (st.error ? " err" : st.enabled ? " on" : "") }),
15994
+ import_react22.default.createElement("span", { className: "dock-name" }, f.name),
15995
+ import_react22.default.createElement("span", { className: "dock-desc" }, f.description + (f.external ? "\uFF08\u6765\u81EA\u5916\u90E8\u5305" + (f.package ? " " + f.package : "") + "\uFF09" : "")),
15996
+ f.planned ? import_react22.default.createElement("span", { className: "dock-badge" }, "\u89C4\u5212\u4E2D") : import_react22.default.createElement("button", {
15245
15997
  type: "button",
15246
15998
  className: "dock-sw" + (st.enabled ? " on" : ""),
15247
15999
  role: "switch",
@@ -15250,11 +16002,11 @@ function DockPanel(props) {
15250
16002
  title: st.enabled ? "\u505C\u7528\u300C" + f.name + "\u300D" : "\u542F\u7528\u300C" + f.name + "\u300D",
15251
16003
  onClick: () => toggle(f.id)
15252
16004
  }),
15253
- !f.planned && typeof f.Chip === "function" ? import_react24.default.createElement(
16005
+ !f.planned && typeof f.Chip === "function" ? import_react22.default.createElement(
15254
16006
  "span",
15255
16007
  { className: "dockm-foot-sw" },
15256
- import_react24.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(f.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
15257
- import_react24.default.createElement("button", {
16008
+ import_react22.default.createElement("span", { className: "dockm-foot-swlabel" + (chipShown(f.id) ? " on" : "") }, "\u4F1A\u8BDD\u9875\u5C0F\u63A7\u4EF6"),
16009
+ import_react22.default.createElement("button", {
15258
16010
  type: "button",
15259
16011
  className: "dock-sw" + (chipShown(f.id) ? " on" : ""),
15260
16012
  role: "switch",
@@ -15268,7 +16020,7 @@ function DockPanel(props) {
15268
16020
  })
15269
16021
  ) : null
15270
16022
  ),
15271
- f.planned ? import_react24.default.createElement("div", { className: "dock-body" }, PLANNED_NOTES[f.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : st.error ? import_react24.default.createElement("div", { className: "dock-body dockm-err" }, "\u529F\u80FD\u51FA\u9519\uFF1A" + st.error) : null,
16023
+ f.planned ? import_react22.default.createElement("div", { className: "dock-body" }, PLANNED_NOTES[f.id] || "\u5F85\u63A5\u5165\uFF1A\u89C1 README \u8DEF\u7EBF\u56FE") : st.error ? import_react22.default.createElement("div", { className: "dock-body dockm-err" }, "\u529F\u80FD\u51FA\u9519\uFF1A" + st.error) : null,
15272
16024
  viewNode
15273
16025
  );
15274
16026
  })
@@ -15276,7 +16028,7 @@ function DockPanel(props) {
15276
16028
  }
15277
16029
  function DockPage() {
15278
16030
  const ctx = ctxRef.current;
15279
- const [wide, setWide] = import_react24.default.useState(false);
16031
+ const [wide, setWide] = import_react22.default.useState(false);
15280
16032
  const toggleWide = () => {
15281
16033
  try {
15282
16034
  const layout = ctx && typeof ctx.get === "function" ? ctx.get("layout") : null;
@@ -15287,20 +16039,20 @@ function DockPage() {
15287
16039
  } catch (e) {
15288
16040
  }
15289
16041
  };
15290
- return import_react24.default.createElement(
16042
+ return import_react22.default.createElement(
15291
16043
  "div",
15292
16044
  { className: "dockm-page" + (wide ? " dockm-page-wide" : "") },
15293
- import_react24.default.createElement(
16045
+ import_react22.default.createElement(
15294
16046
  "div",
15295
16047
  { className: "dockm-page-head" },
15296
- import_react24.default.createElement("span", { className: "dockm-page-icon" }, import_react24.default.createElement(DockIcon, { size: 20 })),
15297
- import_react24.default.createElement(
16048
+ import_react22.default.createElement("span", { className: "dockm-page-icon" }, import_react22.default.createElement(DockIcon, { size: 20 })),
16049
+ import_react22.default.createElement(
15298
16050
  "div",
15299
16051
  { className: "dockm-page-titles" },
15300
- import_react24.default.createElement("div", { className: "dockm-page-title" }, "\u529F\u80FD\u575E"),
15301
- import_react24.default.createElement("div", { className: "dockm-page-sub" }, "\u6240\u6709\u5C0F\u529F\u80FD\u96C6\u4E2D\u5728\u8FD9\u91CC\u7BA1\u7406\u3002\u4FA7\u680F\u56FE\u6807\u53EF\u5728\u300C\u66F4\u591A\u300D\u83DC\u5355\u91CC Pin \u5230\u9876\u90E8\uFF0C\u6216\u53D6\u6D88\u56FA\u5B9A\u6536\u8FDB\u66F4\u591A\u3002")
16052
+ import_react22.default.createElement("div", { className: "dockm-page-title" }, "\u529F\u80FD\u575E"),
16053
+ import_react22.default.createElement("div", { className: "dockm-page-sub" }, "\u6240\u6709\u5C0F\u529F\u80FD\u96C6\u4E2D\u5728\u8FD9\u91CC\u7BA1\u7406\u3002\u4FA7\u680F\u56FE\u6807\u53EF\u5728\u300C\u66F4\u591A\u300D\u83DC\u5355\u91CC Pin \u5230\u9876\u90E8\uFF0C\u6216\u53D6\u6D88\u56FA\u5B9A\u6536\u8FDB\u66F4\u591A\u3002")
15302
16054
  ),
15303
- import_react24.default.createElement("button", {
16055
+ import_react22.default.createElement("button", {
15304
16056
  type: "button",
15305
16057
  className: "dockm-page-wide-btn",
15306
16058
  title: wide ? "\u8FD8\u539F\u4FA7\u680F\u5BBD\u5EA6" : "\u6536\u8D77\u5DE6\u4FA7\u680F\uFF0C\u5168\u5C4F\u663E\u793A\u529F\u80FD\u575E",
@@ -15308,19 +16060,19 @@ function DockPage() {
15308
16060
  onClick: toggleWide
15309
16061
  }, wide ? "\u2750 \u8FD8\u539F" : "\u25A2 \u5168\u5C4F")
15310
16062
  ),
15311
- import_react24.default.createElement("div", { className: "dockm-page-body" }, import_react24.default.createElement(DockWorkspace, null))
16063
+ import_react22.default.createElement("div", { className: "dockm-page-body" }, import_react22.default.createElement(DockWorkspace, null))
15312
16064
  );
15313
16065
  }
15314
16066
  function DockChips(props) {
15315
- const [, force] = import_react24.default.useReducer((n) => n + 1, 0);
15316
- import_react24.default.useEffect(() => subscribeFeatureState(() => force()), []);
16067
+ const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
16068
+ import_react22.default.useEffect(() => subscribeFeatureState(() => force()), []);
15317
16069
  const items = [];
15318
16070
  for (const f of allModules()) {
15319
16071
  if (f.planned || !stateOf(f.id).enabled || !chipShown(f.id) || typeof f.Chip !== "function") continue;
15320
- items.push(import_react24.default.createElement(
16072
+ items.push(import_react22.default.createElement(
15321
16073
  FeatureBoundary,
15322
16074
  { key: f.id, label: f.name },
15323
- import_react24.default.createElement(f.Chip, {
16075
+ import_react22.default.createElement(f.Chip, {
15324
16076
  ctx: props.ctx,
15325
16077
  feature: f,
15326
16078
  session: props.session,
@@ -15330,38 +16082,38 @@ function DockChips(props) {
15330
16082
  ));
15331
16083
  }
15332
16084
  if (items.length === 0) return null;
15333
- return import_react24.default.createElement("div", { className: "dockchip-row" }, items);
16085
+ return import_react22.default.createElement("div", { className: "dockchip-row" }, items);
15334
16086
  }
15335
16087
  function FeatureOverlays() {
15336
- const [, force] = import_react24.default.useReducer((n) => n + 1, 0);
16088
+ const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
15337
16089
  useExternalVersion();
15338
- import_react24.default.useEffect(() => subscribeFeatureState(() => force()), []);
16090
+ import_react22.default.useEffect(() => subscribeFeatureState(() => force()), []);
15339
16091
  const items = [];
15340
16092
  for (const f of allModules()) {
15341
16093
  if (f.planned || !stateOf(f.id).enabled || typeof f.Overlay !== "function") continue;
15342
- items.push(import_react24.default.createElement(
16094
+ items.push(import_react22.default.createElement(
15343
16095
  FeatureBoundary,
15344
16096
  { key: f.id, label: f.name },
15345
- import_react24.default.createElement(f.Overlay, { ctx: ctxRef.current, feature: f })
16097
+ import_react22.default.createElement(f.Overlay, { ctx: ctxRef.current, feature: f })
15346
16098
  ));
15347
16099
  }
15348
16100
  if (items.length === 0) return null;
15349
- return import_react24.default.createElement(import_react24.default.Fragment, null, items);
16101
+ return import_react22.default.createElement(import_react22.default.Fragment, null, items);
15350
16102
  }
15351
16103
  function FeatureTurnTail(props) {
15352
- const [, force] = import_react24.default.useReducer((n) => n + 1, 0);
15353
- import_react24.default.useEffect(() => subscribeFeatureState(() => force()), []);
16104
+ const [, force] = import_react22.default.useReducer((n) => n + 1, 0);
16105
+ import_react22.default.useEffect(() => subscribeFeatureState(() => force()), []);
15354
16106
  const items = [];
15355
16107
  for (const f of allModules()) {
15356
16108
  if (f.planned || !stateOf(f.id).enabled || typeof f.TurnTail !== "function") continue;
15357
- items.push(import_react24.default.createElement(
16109
+ items.push(import_react22.default.createElement(
15358
16110
  FeatureBoundary,
15359
16111
  { key: f.id, label: f.name },
15360
- import_react24.default.createElement(f.TurnTail, Object.assign({}, props, { ctx: ctxRef.current, feature: f }))
16112
+ import_react22.default.createElement(f.TurnTail, Object.assign({}, props, { ctx: ctxRef.current, feature: f }))
15361
16113
  ));
15362
16114
  }
15363
16115
  if (items.length === 0) return null;
15364
- return import_react24.default.createElement(import_react24.default.Fragment, null, items);
16116
+ return import_react22.default.createElement(import_react22.default.Fragment, null, items);
15365
16117
  }
15366
16118
  var ctxRef = { current: null };
15367
16119
  function apply(ctx) {
@@ -15372,31 +16124,31 @@ function apply(ctx) {
15372
16124
  if (slots === void 0) return;
15373
16125
  slots.inject("sidebar.panellist", () => slots.register(
15374
16126
  { name: "sidebar.panellist", id: "dsh-dock", order: 30, label: "\u529F\u80FD\u575E" },
15375
- (props) => import_react24.default.createElement(DockIcon, { size: props && props.size || 18 })
16127
+ (props) => import_react22.default.createElement(DockIcon, { size: props && props.size || 18 })
15376
16128
  ));
15377
16129
  slots.inject("main", () => slots.register(
15378
16130
  { name: "main", key: "dsh-dock", label: "\u529F\u80FD\u575E" },
15379
- () => import_react24.default.createElement(DockPage, null)
16131
+ () => import_react22.default.createElement(DockPage, null)
15380
16132
  ));
15381
16133
  slots.inject("shell.overlay", () => slots.register(
15382
16134
  { name: "shell.overlay", id: "dsh-dock-panel", order: 21, label: "\u529F\u80FD\u575E\u9762\u677F" },
15383
- () => import_react24.default.createElement(DockModal, null)
16135
+ () => import_react22.default.createElement(DockModal, null)
15384
16136
  ));
15385
16137
  slots.inject("shell.overlay", () => slots.register(
15386
16138
  { name: "shell.overlay", id: "dsh-dock-feature-overlays", order: 22, label: "\u529F\u80FD\u575E\u5168\u5C40\u6D6E\u5C42" },
15387
- () => import_react24.default.createElement(FeatureOverlays, null)
16139
+ () => import_react22.default.createElement(FeatureOverlays, null)
15388
16140
  ));
15389
16141
  slots.inject("settings.section", () => slots.register(
15390
16142
  { name: "settings.section", id: "dsh-dock", order: 90, label: "\u529F\u80FD\u575E" },
15391
- (props) => import_react24.default.createElement(DockPanel, props)
16143
+ (props) => import_react22.default.createElement(DockPanel, props)
15392
16144
  ));
15393
16145
  slots.inject("conversation.input.left", () => slots.register(
15394
16146
  { name: "conversation.input.left", id: "dsh-dock-chips", order: 10, label: "\u529F\u80FD\u575E" },
15395
- (zone) => import_react24.default.createElement(DockChips, Object.assign({}, zone, { ctx: ctxRef.current }))
16147
+ (zone) => import_react22.default.createElement(DockChips, Object.assign({}, zone, { ctx: ctxRef.current }))
15396
16148
  ));
15397
16149
  slots.inject("conversation.chat.turnTail", () => slots.register(
15398
16150
  { name: "conversation.chat.turnTail", id: "dsh-dock-turn-tail", order: 40, label: "\u529F\u80FD\u575E" },
15399
- (owner) => import_react24.default.createElement(FeatureTurnTail, owner)
16151
+ (owner) => import_react22.default.createElement(FeatureTurnTail, owner)
15400
16152
  ));
15401
16153
  }
15402
16154
  var inject = ["timer"];