engine7 7.1.136 → 7.1.137

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/dist/main.mjs CHANGED
@@ -2912,6 +2912,7 @@ __export(runtime_lock_exports, {
2912
2912
  inspectRuntimeWriters: () => inspectRuntimeWriters,
2913
2913
  registerRuntimeWriter: () => registerRuntimeWriter,
2914
2914
  withCheckpointLock: () => withCheckpointLock,
2915
+ withInitialBaselineAdmission: () => withInitialBaselineAdmission,
2915
2916
  withRecoveryWriterLocks: () => withRecoveryWriterLocks
2916
2917
  });
2917
2918
  import { randomUUID as randomUUID3 } from "node:crypto";
@@ -2966,6 +2967,8 @@ function assertControlPermissions(file2) {
2966
2967
  }
2967
2968
  function assertStateDirUsable(stateDir) {
2968
2969
  if (typeof stateDir !== "string" || !stateDir.trim()) throw new Error("RUNTIME_STATE_DIR_REQUIRED");
2970
+ const initial = initialBaselineAdmission.getStore();
2971
+ if (initial?.active && initial.roots.has(realpathSync2(stateDir))) return;
2969
2972
  try {
2970
2973
  lstatSync3(join5(stateDir, ".travel-restored.json"));
2971
2974
  throw new Error("TRAVEL_ACTIVATION_REQUIRED");
@@ -2974,6 +2977,28 @@ function assertStateDirUsable(stateDir) {
2974
2977
  }
2975
2978
  assertRuntimeAuthority(stateDir, "WRITE");
2976
2979
  }
2980
+ async function withInitialBaselineAdmission(stateDir, checkpointId, operation) {
2981
+ const root = realpathSync2(stateDir), file2 = join5(root, ".travel-restored.json"), info = lstatSync3(file2);
2982
+ if (!info.isFile() || info.isSymbolicLink() || info.size > 16384 || realpathSync2(file2) !== file2 || process.platform !== "win32" && (info.mode & 63 || info.uid !== process.getuid())) throw new Error("TRAVEL_INITIAL_BASELINE_GATE");
2983
+ const gate = JSON.parse(readFileSync6(file2, "utf8"));
2984
+ if (!/^[a-f0-9-]{36}$/.test(checkpointId) || gate.checkpointId !== checkpointId || gate.activationAllowed !== false) throw new Error("TRAVEL_INITIAL_BASELINE_GATE");
2985
+ for (const name of [".travel-active.json", ".travel-enrolled.json"]) {
2986
+ try {
2987
+ lstatSync3(join5(root, name));
2988
+ throw new Error("TRAVEL_INITIAL_BASELINE_GATE");
2989
+ } catch (error) {
2990
+ if (error.code !== "ENOENT") throw error;
2991
+ }
2992
+ }
2993
+ const admission = { roots: /* @__PURE__ */ new Set([root, realpathSync2(join5(root, "workspace"))]), active: true };
2994
+ return initialBaselineAdmission.run(admission, async () => {
2995
+ try {
2996
+ return await operation();
2997
+ } finally {
2998
+ admission.active = false;
2999
+ }
3000
+ });
3001
+ }
2977
3002
  function inspectRuntimeWriters(stateDir) {
2978
3003
  const writers = [];
2979
3004
  const legacy = [];
@@ -3116,7 +3141,7 @@ async function withRecoveryWriterLocks(stateDirs, operation) {
3116
3141
  }
3117
3142
  return locked();
3118
3143
  }
3119
- var sqlite, bootId, releases, checkpointHandles, exitHookInstalled, recoveryWriterLocks;
3144
+ var sqlite, bootId, releases, checkpointHandles, exitHookInstalled, recoveryWriterLocks, initialBaselineAdmission;
3120
3145
  var init_runtime_lock = __esm({
3121
3146
  "src/continuity/runtime-lock.ts"() {
3122
3147
  "use strict";
@@ -3126,6 +3151,7 @@ var init_runtime_lock = __esm({
3126
3151
  checkpointHandles = /* @__PURE__ */ new Set();
3127
3152
  exitHookInstalled = false;
3128
3153
  recoveryWriterLocks = new AsyncLocalStorage2();
3154
+ initialBaselineAdmission = new AsyncLocalStorage2();
3129
3155
  }
3130
3156
  });
3131
3157
 
@@ -33770,12 +33796,18 @@ var init_emotion_tools = __esm({
33770
33796
  });
33771
33797
 
33772
33798
  // src/config/context-window-policy.ts
33773
- var DEFAULT_CONTEXT_WINDOW, CONTEXT_WINDOW_MIGRATION_VERSION;
33799
+ var DEFAULT_CONTEXT_WINDOW, CONTEXT_WINDOW_MIGRATION_VERSION, CONTEXT_WINDOW_POLICY_MODEL_IDS;
33774
33800
  var init_context_window_policy = __esm({
33775
33801
  "src/config/context-window-policy.ts"() {
33776
33802
  "use strict";
33777
33803
  DEFAULT_CONTEXT_WINDOW = 35e4;
33778
- CONTEXT_WINDOW_MIGRATION_VERSION = 1;
33804
+ CONTEXT_WINDOW_MIGRATION_VERSION = 2;
33805
+ CONTEXT_WINDOW_POLICY_MODEL_IDS = [
33806
+ "engine7-free",
33807
+ "engine7-free-nort",
33808
+ "engine7-vis-free",
33809
+ "engine7-video"
33810
+ ];
33779
33811
  }
33780
33812
  });
33781
33813
 
@@ -34500,15 +34532,57 @@ var init_emotion_tools_fixup = __esm({
34500
34532
  });
34501
34533
 
34502
34534
  // src/startup/context-window-fixup.ts
34535
+ function normalizePolicyModelWindows(providers) {
34536
+ const undo = [];
34537
+ const touched = [];
34538
+ if (providers == null || typeof providers !== "object" || Array.isArray(providers)) return { undo, touched };
34539
+ for (const pid of Object.keys(providers)) {
34540
+ const models = providers[pid]?.models;
34541
+ if (!Array.isArray(models)) continue;
34542
+ let changed = false;
34543
+ for (const m of models) {
34544
+ if (!m || typeof m !== "object") continue;
34545
+ if (!CONTEXT_WINDOW_POLICY_MODEL_IDS.includes(m.id)) continue;
34546
+ if (typeof m.contextWindow !== "number" || !Number.isFinite(m.contextWindow)) continue;
34547
+ if (m.contextWindow === DEFAULT_CONTEXT_WINDOW) continue;
34548
+ const before = m.contextWindow;
34549
+ m.contextWindow = DEFAULT_CONTEXT_WINDOW;
34550
+ changed = true;
34551
+ undo.push(() => {
34552
+ m.contextWindow = before;
34553
+ });
34554
+ }
34555
+ if (changed) touched.push(pid);
34556
+ }
34557
+ return { undo, touched };
34558
+ }
34503
34559
  async function applyContextWindowFixup(io) {
34504
34560
  const cfg = io.all();
34505
34561
  if (!cfg || typeof cfg !== "object" || Array.isArray(cfg)) return false;
34506
34562
  const previous = cfg.compaction;
34507
34563
  if (previous != null && (typeof previous !== "object" || Array.isArray(previous))) return false;
34508
34564
  if (previous?.contextWindowMigrationVersion >= CONTEXT_WINDOW_MIGRATION_VERSION) return false;
34565
+ const { undo, touched } = normalizePolicyModelWindows(cfg.providers);
34566
+ for (const pid of touched) {
34567
+ let ok = false;
34568
+ try {
34569
+ ok = await io.set(`models.providers.${pid}.models`, cfg.providers[pid].models);
34570
+ } catch (error) {
34571
+ console.warn(`[config] Context window model migration failed (${pid}): ${error.message}`);
34572
+ }
34573
+ if (!ok) {
34574
+ for (const u of undo.reverse()) u();
34575
+ console.warn("[config] Context window model migration was not persisted; keeping prior settings for retry");
34576
+ return false;
34577
+ }
34578
+ }
34579
+ if (touched.length) {
34580
+ console.log(`[config] Free-tier model context windows normalized to ${DEFAULT_CONTEXT_WINDOW} (${touched.join(", ")})`);
34581
+ }
34582
+ const v1Ran = typeof previous?.contextWindowMigrationVersion === "number" && previous.contextWindowMigrationVersion >= 1;
34509
34583
  const next = {
34510
34584
  ...previous,
34511
- contextWindow: DEFAULT_CONTEXT_WINDOW,
34585
+ ...v1Ran ? {} : { contextWindow: DEFAULT_CONTEXT_WINDOW },
34512
34586
  contextWindowMigrationVersion: CONTEXT_WINDOW_MIGRATION_VERSION
34513
34587
  };
34514
34588
  let persisted = false;
@@ -52592,10 +52666,39 @@ var init_project_sessions = __esm({
52592
52666
  // src/cc-driver/router.ts
52593
52667
  var router_exports = {};
52594
52668
  __export(router_exports, {
52669
+ autoBindHit: () => autoBindHit,
52595
52670
  ccDriverRouter: () => ccDriverRouter,
52596
52671
  markBindSelect: () => markBindSelect
52597
52672
  });
52598
52673
  import { existsSync as existsSync48 } from "node:fs";
52674
+ function autoBindHit(inbound) {
52675
+ if (inbound.channel !== "feishu" || inbound.channelType !== "dm") return null;
52676
+ const owner = liveConfig.get("channels.feishu.ownerOpenId");
52677
+ const workDir = liveConfig.get("channels.ccDriver.autoBind.workDir");
52678
+ if (!owner || !workDir || inbound.from !== owner) return null;
52679
+ const cur = liveConfig.get("channels.ccDriver");
52680
+ if (cur?.enabled === false) return null;
52681
+ if ((cur?.bindings ?? []).length > 0) return null;
52682
+ return workDir;
52683
+ }
52684
+ async function doAutoBind(inbound, workDir) {
52685
+ if (!cmRef) return;
52686
+ const binding = {
52687
+ channel: inbound.channel,
52688
+ match: { type: "dm", chatId: inbound.channel_id, from: inbound.from },
52689
+ workDir
52690
+ };
52691
+ const cur = liveConfig.get("channels.ccDriver");
52692
+ const bindings = (cur?.bindings ?? []).filter((b) => !(b.channel === binding.channel && b.match.chatId === binding.match.chatId));
52693
+ bindings.push(binding);
52694
+ const { autoBind: _consumed, ...rest } = cur ?? {};
52695
+ const persisted = await liveConfig.set("channels.ccDriver", { ...rest, enabled: true, bindings }, { atomic: true });
52696
+ const { startCcDriver: startCcDriver2 } = await Promise.resolve().then(() => (init_cc_driver(), cc_driver_exports));
52697
+ startCcDriver2(cmRef);
52698
+ console.log(`[cc-driver] autoBind ${inbound.channel}:${inbound.channel_id} \u2192 ${workDir}\uFF08\u4E00\u6B21\u6027\uFF0C\u5DF2\u81EA\u5220\uFF1Bpersisted=${persisted}\uFF09`);
52699
+ await cmRef.send(inbound.channel, inbound.channel_id, persisted ? `\u2705 \u5DF2\u63A5\u5165 CC\uFF08${workDir}\uFF09\u2014\u2014\u518D\u8BF4\u4E00\u53E5\u8BDD\u5C31\u5F00\u59CB\u3002
52700
+ /cc-list \u770B\u4F1A\u8BDD\uFF0C/cc-switch \u6362\u7EBF\u3002` : `\u26A0\uFE0F \u5DF2\u63A5\u5165 CC\uFF0C\u4F46\u914D\u7F6E\u6CA1\u5199\u8FDB\u6587\u4EF6\uFF08\u91CD\u542F\u540E\u4F1A\u56DE\u5230\u672A\u7ED1\u5B9A\uFF09\u2014\u2014\u8BF7\u68C0\u67E5\u914D\u7F6E\u6587\u4EF6\u6743\u9650\u540E\u91CD\u8BD5\u3002`);
52701
+ }
52599
52702
  function markBindSelect(channel, chatId) {
52600
52703
  pendingBind.set(`${channel}:${chatId}`, Date.now());
52601
52704
  while (pendingBind.size > 32) {
@@ -52631,7 +52734,7 @@ async function bindByNumber(inbound) {
52631
52734
  const cur = liveConfig.get("channels.ccDriver");
52632
52735
  const bindings = (cur?.bindings ?? []).filter((b) => !(b.channel === binding.channel && b.match.chatId === binding.match.chatId));
52633
52736
  bindings.push(binding);
52634
- liveConfig.set("channels.ccDriver", { enabled: true, bindings });
52737
+ liveConfig.set("channels.ccDriver", { ...cur ?? {}, enabled: true, bindings });
52635
52738
  pendingBind.delete(`${inbound.channel}:${inbound.channel_id}`);
52636
52739
  const { startCcDriver: startCcDriver2 } = await Promise.resolve().then(() => (init_cc_driver(), cc_driver_exports));
52637
52740
  startCcDriver2(cmRef);
@@ -52664,6 +52767,7 @@ var init_router = __esm({
52664
52767
  /** 未启用秒回 false,管线零开销 */
52665
52768
  matches(inbound) {
52666
52769
  if (hub && hub.matches(inbound)) return true;
52770
+ if (autoBindHit(inbound)) return true;
52667
52771
  return peekBindNumber(inbound) !== null;
52668
52772
  },
52669
52773
  /** 永不抛——命中处理失败只打日志,消息吃掉(不回落 agent,避免同一句话两头跑) */
@@ -52673,7 +52777,12 @@ var init_router = __esm({
52673
52777
  hub.route(inbound);
52674
52778
  return;
52675
52779
  }
52676
- if (peekBindNumber(inbound) !== null) await bindByNumber(inbound);
52780
+ if (peekBindNumber(inbound) !== null) {
52781
+ await bindByNumber(inbound);
52782
+ return;
52783
+ }
52784
+ const autoWorkDir = autoBindHit(inbound);
52785
+ if (autoWorkDir) await doAutoBind(inbound, autoWorkDir);
52677
52786
  } catch (err) {
52678
52787
  console.error(`[cc-driver] route \u5931\u8D25\uFF08\u6D88\u606F\u5DF2\u5403\u6389\uFF09: ${err?.stack || err}`);
52679
52788
  }
@@ -52859,13 +52968,13 @@ function startCcDriver(channelManager) {
52859
52968
  console.warn(`[cc-driver] \u542F\u52A8\u8DF3\u8FC7\uFF1Aconfig \u65E0 stateDir\uFF08\u5F02\u5E38\u914D\u7F6E\uFF0Csession-map \u65E0\u5904\u843D\u76D8\uFF09`);
52860
52969
  return;
52861
52970
  }
52971
+ ccDriverRouter.setCm(channelManager);
52862
52972
  const parsed = parseCcDriverConfig(cfg?.channels?.ccDriver);
52863
52973
  if (!parsed.enabled) {
52864
52974
  console.log(`[cc-driver] disabled (channels.ccDriver.enabled !== true \u6216\u65E0\u6709\u6548 binding)`);
52865
52975
  return;
52866
52976
  }
52867
52977
  const hub2 = new CcDriverHub(parsed, channelManager, cfg.stateDir, stoppedWriters);
52868
- ccDriverRouter.setCm(channelManager);
52869
52978
  ccDriverRouter.setHub(hub2);
52870
52979
  try {
52871
52980
  unregisterHub = registerCcHub(hub2, cfg.stateDir, computeApiPort(cfg));
@@ -73341,7 +73450,7 @@ async function applyConfigValues(values) {
73341
73450
  }
73342
73451
 
73343
73452
  // web-console/.generated/page.ts
73344
- var page = '<!doctype html>\n<html lang="zh-CN">\n<head>\n <meta charset="utf-8">\n <title>Engine7 \u63A7\u5236\u53F0</title>\n<meta name="viewport" content="width=device-width, initial-scale=1"><style>/* wizard styles \u2014 \u7EAF CSS\uFF0C\u65E0\u6846\u67B6\u65E0 CDN\uFF08\u79BB\u7EBF\u4F18\u5148\uFF09 */\n\n:root {\n --bg: #faf8f4;\n --panel: #fffdfa;\n --border: #e8e4de;\n --text: #343535;\n --muted: #65645f;\n --brand: #bd7952;\n --primary: #a86040;\n --primary-hi: #945235;\n --green: #667d61;\n --green-bg: #edf1e9;\n --red: #b44c4c;\n --red-bg: #faeeee;\n --amber: #9b743f;\n --amber-bg: #f5eee2;\n --radius: 11px;\n --sidebar: #f0eee8;\n --selected: #f7ede4;\n --serif: \'Noto Serif SC\', \'Songti SC\', SimSun, serif;\n}\n\n* { box-sizing: border-box; }\n\nhtml, body {\n height: 100%;\n margin: 0;\n font-family: \'Segoe UI\', \'Microsoft YaHei\', sans-serif;\n font-size: 14px;\n color: var(--text);\n background: var(--bg);\n user-select: none;\n}\n\n#app { display: flex; flex-direction: column; height: 100%; }\n\n/* === \u5934\u90E8\u6B65\u9AA4\u6761 === */\n\n.wiz-header {\n flex: none;\n padding: 14px 28px 10px;\n background: var(--panel);\n border-bottom: 1px solid var(--border);\n}\n\n.wiz-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }\n\n.wiz-stepper { display: flex; gap: 6px; flex-wrap: wrap; }\n\n.stepper-item {\n display: flex; align-items: center; gap: 6px;\n font-size: 12px; color: var(--muted);\n}\n.stepper-item .dot {\n width: 18px; height: 18px; border-radius: 50%;\n display: inline-flex; align-items: center; justify-content: center;\n background: #e4e8ee; color: var(--muted); font-size: 11px;\n}\n.stepper-item.active { color: var(--text); font-weight: 600; }\n.stepper-item.active .dot { background: var(--primary); color: #fff; }\n.stepper-item.done .dot { background: var(--green); color: #fff; }\n.stepper-item.done { color: var(--green); }\n.stepper-sep { color: #c3c9d2; font-size: 12px; }\n\n/* === \u4E3B\u4F53 === */\n\n.wiz-body {\n flex: 1;\n overflow-y: auto;\n padding: 22px 28px;\n}\n\n/*\n * \u9875\u811A\u91CC\u7684\u300C\u52A8\u4F5C\u533A\u300D\u69FD\u4F4D\uFF1A\u67D0\u4E00\u6B65\u5982\u679C\u628A\u81EA\u5DF1\u7684\u4E3B\u64CD\u4F5C\u653E\u8FD9\u513F\uFF0C\u5B83\u5C31**\u6C38\u8FDC\u5728\u773C\u524D**\u3002\n *\n * \u4E3A\u4EC0\u4E48\u4E0D\u80FD\u628A\u52A8\u4F5C\u505A\u6210\u5438\u9644\u5728\u6EDA\u52A8\u533A\u5E95\u90E8\u7684\u6D6E\u5C42\uFF082026-09-23 \u8BD5\u8FC7\u3001\u5426\u4E86\uFF09\uFF1A\u6D6E\u5C42\u4E0D\u5360\u6587\u6863\u6D41\uFF0C\n * **\u4F1A\u76D6\u4F4F\u5185\u5BB9**\u2014\u2014\u5B9E\u6D4B\u628A\u300C\u6709\u9879\u76EE\u672A\u901A\u8FC7\u300D\u90A3\u5757\u7684\u6700\u540E\u4E00\u884C\u5207\u6389\u3001\u6574\u5F20\u514D\u8D39\u6863\u5347\u7EA7\u5361\u538B\u5728\u4E0B\u9762\u3002\n * \u9875\u811A\u662F flex:none\uFF0C\u5360\u81EA\u5DF1\u7684\u4F4D\u7F6E\uFF0C\u4E0D\u906E\u4EFB\u4F55\u4E1C\u897F\uFF1B\u8FD9\u6B63\u662F\u5B83\u5B58\u5728\u7684\u610F\u4E49\u3002\n *\n * \u26A0\uFE0F [hidden] \u5FC5\u987B\u663E\u5F0F\u538B\u56DE display:none\uFF1A\u4E0B\u9762\u7684 display:flex \u4F18\u5148\u7EA7\u66F4\u9AD8\uFF0C\n * \u4E0D\u5199\u8FD9\u6761\u7684\u8BDD `hidden` \u4F1A\u5931\u6548\uFF08\u69FD\u4F4D\u7A7A\u7740\u4E5F\u5360\u4E00\u5757\uFF09\u3002\n */\n.wiz-actions { display: flex; flex-direction: column; gap: 6px; }\n.wiz-actions[hidden] { display: none; }\n/* \u5217\u5E03\u5C40\u4F1A\u628A\u6309\u94AE\u62C9\u6210\u901A\u680F\uFF0C\u592A\u91CD\uFF1B\u5411\u5BFC\u5176\u5B83\u9875\u7684\u4E3B\u6309\u94AE\u90FD\u5728\u53F3\u4E0B\u89D2\uFF08\u89C1 .wiz-nav\uFF09\uFF0C\u5BF9\u9F50\u5B83\u3002\n \u53EA\u632A\u6309\u94AE\u2014\u2014\u4E24\u4E2A\u52FE\u662F\u8868\u5355\u5185\u5BB9\uFF0C\u8981\u7559\u5728\u5DE6\u8FB9\u3002 */\n.wiz-actions > .btn { align-self: flex-end; }\n\n.step { max-width: 720px; }\n\n/* \u6B22\u8FCE\u9875\u7406\u5FF5\u6761\uFF1A\u7ED9\u52A9\u624B\u4E00\u4E2A\u5BB6 \xB7 <\u8F6E\u64AD\u8BCD>\u3002\u56DB\u6761\u7406\u5FF5\u8F6E\u6D41\u5360 C \u4F4D\uFF08welcome.ts \u91CC\u7684 SLOGANS\uFF09\u3002 */\n.wiz-tagline {\n display: flex;\n align-items: baseline;\n gap: 8px;\n margin: 2px 0 2px;\n font-size: 20px;\n font-weight: 600;\n letter-spacing: 0.3px;\n}\n.wiz-tagline .tagline-lead { color: var(--accent, #2f6fed); }\n.wiz-tagline .tagline-dot { color: var(--muted); font-weight: 400; }\n.wiz-tagline .tagline-slogan {\n color: var(--primary);\n min-width: 3.2em; /* \u5B9A\u5BBD\uFF0C\u6362\u8BCD\u65F6\u4E0D\u628A\u540E\u9762\u7684\u5143\u7D20\u63A8\u6765\u63A8\u53BB */\n display: inline-block;\n}\n.tagline-gloss {\n color: var(--muted);\n font-size: 13px;\n line-height: 1.6;\n min-height: 21px; /* \u5B9A\u9AD8\uFF0C\u56DB\u6761\u7684\u6587\u6848\u957F\u5EA6\u4E0D\u4E00\u6837\u4E5F\u4E0D\u8DF3 */\n margin-bottom: 14px;\n}\n.wiz-tagline .tagline-slogan,\n.tagline-gloss { transition: opacity 0.26s ease; }\n.wiz-tagline .tagline-slogan.fading,\n.tagline-gloss.fading { opacity: 0; }\n\n.step h2 { font-size: 18px; margin: 0 0 6px; }\n.step .step-sub { color: var(--muted); margin: 0 0 16px; line-height: 1.6; }\n\n.field { margin-bottom: 14px; }\n.field > label { display: block; font-weight: 600; margin-bottom: 5px; }\n.field .hint { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }\n\n.field input[type=\'text\'],\n.field input[type=\'password\'],\n.field input[type=\'number\'],\n.field select,\n.field textarea {\n width: 100%;\n padding: 8px 10px;\n border: 1px solid var(--border);\n border-radius: var(--radius);\n font: inherit;\n background: #fff;\n color: var(--text);\n}\n.field input:focus, .field select:focus {\n outline: none;\n border-color: var(--primary);\n}\n\n.radio-row { display: flex; gap: 18px; flex-wrap: wrap; }\n.radio-row label {\n display: inline-flex; align-items: center; gap: 5px;\n font-weight: 400; cursor: pointer;\n}\n\n.inline-warn {\n background: var(--amber-bg);\n color: var(--amber);\n border-radius: var(--radius);\n padding: 8px 12px;\n font-size: 13px;\n line-height: 1.6;\n margin: 8px 0 14px;\n}\n\n.inline-error {\n background: var(--red-bg);\n color: var(--red);\n border-radius: var(--radius);\n padding: 8px 12px;\n font-size: 13px;\n line-height: 1.6;\n margin: 8px 0 14px;\n}\n\n.path-row { display: flex; gap: 8px; }\n.path-row input { flex: 1; }\n.path-row button { flex: none; }\n\n.check-row { display: flex; align-items: center; gap: 6px; margin: 6px 0; }\n.check-row.muted { color: var(--muted); font-size: 14px; }\n\n/* \u5B89\u88C5\u4F4D\u7F6E\u5EFA\u8BAE\u6761 */\n.note-box {\n background: #eef3fd;\n border-left: 3px solid var(--primary);\n border-radius: 0 var(--radius) var(--radius) 0;\n padding: 10px 14px;\n line-height: 1.7;\n margin: 12px 0;\n}\n\n/* === \u5B89\u88C5\u9875 checklist === */\n\n.checklist { list-style: none; margin: 16px 0; padding: 0; }\n.checklist li {\n display: flex; align-items: center; gap: 10px;\n padding: 8px 4px;\n border-bottom: 1px solid #edf0f4;\n color: var(--muted);\n}\n.checklist li .mark {\n width: 20px; height: 20px; border-radius: 50%;\n display: inline-flex; align-items: center; justify-content: center;\n background: #e4e8ee; color: var(--muted); font-size: 12px; flex: none;\n}\n.checklist li.doing { color: var(--text); font-weight: 600; }\n.checklist li.doing .mark { background: var(--primary); color: #fff; }\n.checklist li.ok { color: var(--text); }\n.checklist li.ok .mark { background: var(--green); color: #fff; }\n\n/* === \u81EA\u68C0\u9875\u7EA2\u7EFF\u706F === */\n\n.report-block { margin: 14px 0; }\n.report-version {\n font-size: 22px; font-weight: 700; margin-bottom: 4px;\n}\n.report-path { color: var(--muted); font-size: 12px; word-break: break-all; }\n\n.light-row {\n display: flex; align-items: center; gap: 10px;\n padding: 9px 4px;\n border-bottom: 1px solid #edf0f4;\n}\n.light {\n width: 20px; height: 20px; border-radius: 50%; flex: none;\n display: inline-flex; align-items: center; justify-content: center;\n font-size: 12px; color: #fff;\n}\n.light.green { background: var(--green); }\n.light.red { background: var(--red); }\n.light.amber { background: var(--amber); }\n.light.off { background: #c3c9d2; }\n.light-label { flex: 1; }\n.light-note { color: var(--muted); font-size: 12px; }\n\n/* === \u5B8C\u6210\u9762\u677F === */\n\n.done-panel {\n background: var(--green-bg);\n border-radius: var(--radius);\n padding: 16px 18px;\n line-height: 1.8;\n margin: 14px 0;\n}\n.done-panel .big { font-size: 17px; font-weight: 700; color: var(--green); }\n\n/* === footer / \u6309\u94AE === */\n\n.wiz-footer {\n flex: none;\n padding: 12px 28px 16px;\n background: var(--panel);\n border-top: 1px solid var(--border);\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n.wiz-error {\n background: var(--red-bg);\n color: var(--red);\n border-radius: var(--radius);\n padding: 8px 12px;\n font-size: 13px;\n line-height: 1.6;\n white-space: pre-wrap;\n user-select: text;\n}\n\n.wiz-nav { display: flex; justify-content: flex-end; gap: 10px; }\n\n.btn {\n padding: 8px 22px;\n border: 1px solid var(--border);\n border-radius: var(--radius);\n background: #fff;\n color: var(--text);\n font: inherit;\n cursor: pointer;\n}\n.btn:hover { background: #f0f2f5; }\n.btn:disabled { opacity: 0.45; cursor: default; }\n.btn:disabled:hover { background: #fff; }\n.btn-primary {\n background: var(--primary);\n border-color: var(--primary);\n color: #fff;\n}\n.btn-primary:hover { background: var(--primary-hi); }\n.btn-primary:disabled:hover { background: var(--primary); }\n.btn-danger {\n background: var(--red);\n border-color: var(--red);\n color: #fff;\n}\n\n/* === \u626B\u7801 modal === */\n\n.modal-mask {\n position: fixed; inset: 0;\n background: rgba(15, 22, 32, 0.55);\n display: flex; align-items: center; justify-content: center;\n z-index: 100;\n}\n.modal-mask[hidden] { display: none; }\n\n.modal {\n background: #fff;\n border-radius: 12px;\n padding: 24px 28px;\n width: 420px;\n max-width: calc(100vw - 60px);\n text-align: center;\n box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);\n position: relative; /* \u6D6E\u5C42\u53F3\u4E0A\u89D2 \xD7 \u7684\u5B9A\u4F4D\u57FA\u51C6\uFF08.modal-close\uFF09 */\n}\n/* \u626B\u7801\u6D6E\u5C42\u53F3\u4E0A\u89D2\u5173\u95ED\uFF1A\u9759\u97F3\u8272\uFF0Chover \u624D\u63D0\u4EAE\uFF08\u4E0E\u63A7\u5236\u53F0/\u5411\u5BFC\u65E2\u6709\u89C6\u89C9\u8BED\u8A00\u4E00\u81F4\uFF09 */\n.modal .modal-close {\n position: absolute; top: 8px; right: 10px;\n width: 28px; height: 28px; padding: 0;\n display: flex; align-items: center; justify-content: center;\n border: none; border-radius: 6px;\n background: transparent;\n color: var(--muted);\n font-size: 18px; line-height: 1;\n cursor: pointer;\n}\n.modal .modal-close:hover { background: #eef1f5; color: var(--text); }\n.modal h3 { margin: 0 0 6px; font-size: 16px; }\n.modal .modal-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }\n.modal img.qr {\n width: 260px; height: 260px;\n border: 1px solid var(--border);\n border-radius: 6px;\n background: #fff;\n}\n.modal .countdown {\n font-size: 15px; font-weight: 600; margin: 12px 0 16px;\n font-variant-numeric: tabular-nums;\n}\n.modal .modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }\n.modal .qr-error {\n color: var(--red); font-size: 14px; margin-top: 8px;\n word-break: break-all; user-select: text;\n}\n.modal form { text-align: left; }\n.modal form .field { margin-bottom: 10px; }\n\n.spinner {\n display: inline-block;\n width: 14px; height: 14px;\n border: 2px solid #c9d4e8;\n border-top-color: var(--primary);\n border-radius: 50%;\n animation: spin 0.9s linear infinite;\n vertical-align: -2px;\n margin-right: 6px;\n}\n@keyframes spin { to { transform: rotate(360deg); } }\n\n/* \u68C0\u6D4B\u5230\u5DF2\u6709\u5B89\u88C5\u9762\u677F */\n.existing-panel {\n border: 1px solid var(--border);\n border-radius: var(--radius);\n padding: 16px 18px;\n margin: 12px 0;\n line-height: 1.8;\n background: #fbfcfe;\n}\n.existing-panel .actions { display: flex; gap: 10px; margin-top: 10px; }\n\n/* \u6458\u8981\u8868 */\n.summary-table { width: 100%; border-collapse: collapse; margin: 10px 0; }\n.summary-table th, .summary-table td {\n text-align: left; padding: 7px 8px;\n border-bottom: 1px solid #edf0f4;\n font-weight: 400;\n}\n.summary-table th { color: var(--muted); width: 130px; font-weight: 600; }\n\n/* Approved installer design, applied to the existing forms and state machines.\n The native title bar remains native; only the renderer chrome lives here. */\nhtml, body {\n font-family: \'Noto Sans SC\', \'Microsoft YaHei\', \'Segoe UI\', sans-serif;\n font-size: 16px;\n line-height: 1.65;\n}\n[hidden] { display: none !important; }\nbutton, input, textarea, select { font: inherit; }\nbutton, label, summary { -webkit-tap-highlight-color: transparent; }\ninput, textarea, select { accent-color: var(--primary); }\ninput, textarea { user-select: text; }\nbutton:focus-visible, summary:focus-visible, input:focus-visible,\nselect:focus-visible, textarea:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 3px;\n}\n::-webkit-scrollbar { width: 7px; height: 7px; }\n::-webkit-scrollbar-thumb { background: #d6cfc6; border: 2px solid var(--bg); border-radius: 8px; }\n::-webkit-scrollbar-track { background: transparent; }\n\n#app {\n display: grid;\n grid-template-columns: 190px minmax(0, 1fr);\n grid-template-rows: 66px minmax(0, 1fr) auto;\n overflow: hidden;\n}\n.wiz-header {\n grid-column: 1 / -1;\n padding: 0 28px;\n display: flex;\n align-items: center;\n background: #fcfaf7;\n}\n.wiz-title { display: flex; align-items: center; gap: 12px; margin: 0; font-weight: 400; }\n.engine-mark { color: var(--brand); display: block; flex: none; width: 29px; height: 29px; }\n.engine-wordmark { font-family: Georgia, var(--serif); font-size: 28px; letter-spacing: -1.2px; }\n.window-purpose { font-size: 14px; color: var(--muted); border-left: 1px solid var(--border); padding-left: 20px; margin-left: 8px; letter-spacing: 1px; }\n.wiz-sidebar {\n grid-column: 1;\n grid-row: 2 / 4;\n min-height: 0;\n padding: 30px 21px 24px;\n background: var(--sidebar);\n border-right: 1px solid var(--border);\n display: flex;\n flex-direction: column;\n}\n.wiz-stepper { flex-direction: column; flex-wrap: nowrap; gap: 0; }\n.stepper-item { position: relative; padding: 0 0 25px; gap: 11px; font-size: 14px; font-weight: 400; }\n.stepper-item .dot { width: 24px; height: 24px; flex: none; background: transparent; border: 1px solid #ddd6cc; font-family: Georgia, serif; }\n.stepper-item:not(:last-child)::after { content: \'\'; position: absolute; left: 11.5px; top: 29px; width: 1px; height: 15px; background: #ddd6cc; }\n.stepper-item.active { color: var(--primary); }\n.stepper-item.active .dot { border-color: var(--primary); box-shadow: 0 0 0 4px #efdfd0; }\n.stepper-item.done { color: var(--muted); }\n.stepper-item.done .dot { color: var(--green); background: #e7eadf; border-color: #e7eadf; }\n.sidebar-mark { margin-top: auto; padding-top: 22px; border-top: 1px solid #e4ded5; }\n.sidebar-mark .engine-mark { width: 25px; height: 25px; opacity: .65; }\n.wiz-body { min-width: 0; min-height: 0; grid-column: 2; grid-row: 2; padding: 33px 37px; }\n.step { max-width: 850px; margin: 0 auto; }\n.step h2 { font-family: var(--serif); font-size: 27px; line-height: 1.45; font-weight: 600; margin-bottom: 12px; }\n.step h3 { font-size: 18px; font-weight: 600; }\n.step .step-sub { font-size: 14px; line-height: 1.9; margin-bottom: 25px; }\n.wiz-footer { grid-column: 2; grid-row: 3; padding: 16px 37px; gap: 9px; background: #fcfaf7; }\n.wiz-nav { gap: 10px; }\n.wiz-nav:has(> :not([hidden])) { min-height: 40px; }\n.wiz-nav:not(:has(> :not([hidden]))) { display: none; }\n.wiz-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 18px; align-items: end; }\n.wiz-actions > .field { grid-column: 1; grid-row: 1; margin: 0; font-size: 14px; color: var(--muted); }\n.wiz-actions > .field .check-row { margin: 2px 0; }\n.wiz-actions > .btn { grid-column: 2; grid-row: 1; align-self: center; }\n.wiz-actions > div:not(.field) { grid-column: 1 / -1; font-size: 14px; }\n.wiz-actions > div:not(.field):empty { display: none; }\n\n.btn { min-height: 40px; padding: 8px 20px; border-radius: 8px; background: var(--panel); transition: background .15s, border-color .15s, box-shadow .15s; }\n.btn:hover { background: #f0ece6; border-color: #d7cdc5; }\n.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 5px #bd795218; }\n.btn-primary:hover { background: var(--primary-hi); border-color: var(--primary-hi); }\n.btn-primary:disabled:hover { background: var(--primary); }\n.btn-danger { background: var(--red); border-color: var(--red); }\n.btn-danger:hover { background: #9a3c3c; border-color: #9a3c3c; }\n.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }\n.btn:disabled:hover { background: var(--panel); border-color: var(--border); }\n.btn-primary:disabled:hover { background: var(--primary); border-color: var(--primary); }\n.path-row { align-items: stretch; }\n.path-row input { min-width: 0; }\n.field { margin-bottom: 19px; }\n.field > label { font-size: 16px; margin-bottom: 7px; }\n.field .hint { margin-left: 5px; font-size: 14px; line-height: 1.7; }\n.field input[type=\'text\'], .field input[type=\'password\'], .field input[type=\'number\'],\n.field input[type=\'email\'], .field select, .field textarea {\n width: 100%; min-width: 0; border: 1px solid #ded8d0; border-radius: 8px;\n background: var(--panel); padding: 10px 12px; color: var(--text); font: inherit;\n}\n.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px #bd795210; }\n.hint { color: var(--muted); font-size: 14px; line-height: 1.8; }\n.inline-warn, .inline-error, .note-box, .wiz-error { padding: 12px 15px; border-radius: 9px; font-size: 14px; line-height: 1.85; overflow-wrap: anywhere; }\n.note-box { background: #efebe3; color: #756c60; border: 0; }\n.note-box ul { padding-left: 18px; margin: 4px 0; }\n.existing-panel { background: var(--panel); border-color: #dacbd5; }\n.existing-panel .actions { flex-wrap: wrap; }\n.wiz-tagline { font-size: 22px; flex-wrap: wrap; gap: 7px; margin: 8px 0 4px; font-family: var(--serif); }\n.wiz-tagline .tagline-lead { color: var(--primary); }\n.tagline-gloss { font-size: 14px; }\n.step-welcome > .field { padding: 19px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }\n#w-appdir { overflow-wrap: anywhere; }\n#p-free-block, #p-paid { padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); margin-bottom: 22px; }\n#p-free-block { background: var(--selected); border-color: #d7c8d2; }\n#p-paid > .field:last-child { margin-bottom: 0; }\n.step-channels > .field { padding: 18px 20px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }\n.step-channels > .field:has(input[value=\'qr\']:checked), .step-channels > .field:has(input[value=\'manual\']:checked), .step-channels > .field:has(#ch-d-enabled:checked) { background: var(--selected); border-color: #d5b5a1; }\n.channel-title { display: flex !important; align-items: center; gap: 10px; font-size: 18px !important; margin-bottom: 15px !important; }\n.chan-badge { flex: none; width: 32px; height: 32px; border-radius: 8px; background: #fff; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; }\n.chan-badge svg { width: 23px; height: 23px; }\n.chan-badge.small { width: 23px; height: 23px; border-radius: 6px; }\n.chan-badge.small svg { width: 16px; height: 16px; }\n.radio-row { gap: 10px 16px; }\n.radio-row label { flex-wrap: wrap; font-size: 16px; }\n.radio-row label .hint { font-size: 14px; }\n.persona-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }\n.mode-options { display: grid; grid-template-columns: 1fr; gap: 9px; }\n.radio-card { display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 17px; background: var(--panel); cursor: pointer; }\n.radio-card:has(input:checked) { border-color: #d5b5a1; background: var(--selected); box-shadow: 0 1px 3px #bd79520b; }\n.radio-card:hover { border-color: #c9bbc3; }\n.radio-card input { margin: 0; vertical-align: middle; }\n.radio-card > span { font-size: 16px; }\n.radio-card > .hint { margin-top: 5px; font-size: 14px; }\n.mode-options .radio-card { padding: 13px 17px; }\n.step-face > .field { padding: 19px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }\n.step-face .hint { overflow-wrap: anywhere; }\n.summary-table { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); border-spacing: 0; border-collapse: separate; overflow: hidden; }\n.summary-table th, .summary-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 14px; }\n.summary-table th { width: 105px; white-space: nowrap; }\n.summary-table tr:last-child > * { border-bottom: 0; }\n.summary-table td { overflow-wrap: anywhere; }\n.summary-table input { max-width: 100%; padding: 8px 10px; font: inherit; color: var(--text); background: var(--panel); border: 1px solid #ded8d0; border-radius: 7px; }\n.checklist { background: var(--panel); border: 1px solid var(--border); padding: 4px 18px; border-radius: var(--radius); }\n.checklist li { padding: 14px 0; border-color: var(--border); font-size: 14px; }\n.checklist li:last-child { border-bottom: 0; }\n.checklist li .mark { background: #ece7df; }\n.checklist li.doing .mark { background: var(--primary); }\n.checklist li.ok .mark { background: var(--green); }\n.report-block { background: var(--panel); border: 1px solid var(--border); padding: 16px 19px; border-radius: var(--radius); margin: 17px 0; }\n.report-version { font-size: 20px; font-weight: 500; }\n.report-path { font-size: 14px; line-height: 1.9; }\n.light-row { padding: 10px 0; border-color: var(--border); gap: 9px; flex-wrap: wrap; }\n.light-row:last-child { border-bottom: 0; }\n.light-note { font-size: 14px; overflow-wrap: anywhere; }\n.light { width: 19px; height: 19px; font-size: 13px; }\n.done-panel { padding: 17px 20px; font-size: 14px; }\n.done-panel .big { font-size: 18px; }\n.modal-mask { background: #433c4259; backdrop-filter: blur(3px); }\n.modal { background: var(--bg); border: 1px solid #d8cfc5; border-radius: 14px; max-height: calc(100vh - 40px); overflow-y: auto; padding: 25px 27px; box-shadow: 0 18px 70px #35292e22; }\n.modal h3 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin-bottom: 10px; }\n.modal .modal-sub { font-size: 14px; line-height: 1.8; }\n.modal .modal-actions { flex-wrap: wrap; }\n.modal .countdown { font-size: 16px; }\n.modal .modal-close:hover { background: #eae4dd; }\n.spinner { border-color: #ead9ca; border-top-color: var(--primary); }\n\n@media (max-width: 960px) {\n #app { grid-template-columns: 165px minmax(0, 1fr); }\n .wiz-sidebar { padding: 26px 18px 20px; }\n .wiz-body { padding: 26px 26px; }\n .wiz-footer { padding: 13px 26px; }\n .step h2 { font-size: 24px; }\n .radio-row { gap: 8px 13px; }\n}\n@media (max-height: 660px) {\n #app { grid-template-rows: 58px minmax(0, 1fr) auto; }\n .stepper-item { padding-bottom: 19px; }\n .stepper-item:not(:last-child)::after { height: 10px; }\n .wiz-sidebar { padding-top: 24px; }\n .wiz-body { padding-top: 25px; padding-bottom: 24px; }\n .wiz-footer { padding-top: 12px; padding-bottom: 12px; }\n .step .step-sub { margin-bottom: 19px; }\n}\n@media (max-width: 720px) {\n #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 56px auto minmax(0, 1fr) auto; }\n .wiz-header { padding: 0 18px; }\n .engine-wordmark { font-size: 24px; }\n .window-purpose { padding-left: 12px; margin-left: 0; }\n .wiz-sidebar { grid-column: 1; grid-row: 2; padding: 12px 15px; border-right: 0; border-bottom: 1px solid var(--border); }\n .wiz-stepper { flex-direction: row; justify-content: space-between; gap: 4px; }\n .stepper-item { flex-direction: column; gap: 4px; padding: 0; font-size: 12px; }\n .stepper-item::after { display: none; }\n .stepper-item .dot { width: 21px; height: 21px; font-size: 13px; }\n .wiz-sidebar .sidebar-mark { display: none; }\n .wiz-body { grid-column: 1; grid-row: 3; padding: 22px; }\n .wiz-footer { grid-column: 1; grid-row: 4; padding: 12px 20px; }\n .persona-options { grid-template-columns: 1fr; }\n .btn { padding: 8px 15px; }\n .summary-table th, .summary-table td { padding: 10px 12px; }\n}\n@media (prefers-reduced-motion: reduce) {\n *, *::before, *::after { animation: none !important; transition: none !important; }\n}\n\n/* console.css \u2014 \u63A7\u5236\u53F0\u5E03\u5C40\uFF08\u4FA7\u680F + \u9875\u5BB9\u5668\uFF09\u3002\u57FA\u7840\u63A7\u4EF6\u6837\u5F0F\u5728\u5171\u7528 styles.css\n \uFF08\u542B .modal / .modal-close\u2014\u2014\u626B\u7801\u6D6E\u5C42\u7684 \xD7 \u4E5F\u5728\u90A3\uFF1Bindex.html \u5148\u6302 ../styles.css \u518D\u6302\u672C\u6587\u4EF6\uFF09 */\n\n#console-app {\n display: flex;\n height: 100%;\n}\n\n/* === \u4FA7\u680F === */\n\n.sidebar {\n flex: none;\n width: 170px;\n background: var(--panel);\n border-right: 1px solid var(--border);\n padding: 14px 10px;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.sidebar-title {\n font-size: 16px;\n font-weight: 700;\n padding: 0 10px 12px;\n}\n\n.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }\n\n/* \u5F53\u524D\u5F15\u64CE\u9009\u62E9\u6846\uFF1B\u591A\u4EFD\u65F6\u663E\u793A\uFF0C\u9875\u9762\u5BFC\u822A\u4E0D\u968F\u5F15\u64CE\u6570\u91CF\u53D8\u957F\u3002 */\n.engine-picker:not(:empty) { padding-bottom: 16px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }\n.engine-picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }\n.engine-picker-heading label { font-size: 14px; font-weight: 600; color: var(--text); }\n.engine-picker-count { font-size: 14px; color: var(--muted); }\n.engine-picker select { width: 100%; min-width: 0; padding: 9px 24px 9px 10px; border: 1px solid #d5b5a1; border-radius: 8px; color: var(--text); background: var(--panel); font-size: 16px; cursor: pointer; }\n.engine-picker select:disabled { opacity: .65; cursor: wait; }\n.engine-picker-path { font-size: 14px; color: var(--muted); line-height: 1.6; margin: 7px 2px 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }\n.engine-picker-error { font-size: 14px; color: var(--red); margin: 7px 0 0; }\n\n.nav-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 9px 12px;\n border: none;\n border-radius: 6px;\n background: transparent;\n color: var(--muted);\n font: inherit;\n cursor: pointer;\n text-align: left;\n}\n.nav-item:hover { background: #f0f2f5; color: var(--text); }\n.nav-item.active {\n background: #eef3fd;\n color: var(--primary);\n font-weight: 600;\n}\n.nav-item.nav-placeholder { opacity: 0.5; cursor: default; }\n.nav-item.nav-placeholder:hover { background: transparent; color: var(--muted); }\n.nav-availability { margin-left: auto; font-size: 10px; white-space: nowrap; }\n\n.phase-badge {\n font-size: 10px;\n padding: 1px 6px;\n border-radius: 8px;\n background: #e4e8ee;\n color: var(--muted);\n}\n\n/* === \u9875\u5BB9\u5668 === */\n\n.console-body-slot {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n}\n\n.console-body {\n flex: 1;\n overflow-y: auto;\n padding: 22px 26px;\n}\n\n.page { max-width: 680px; }\n.page h2 { font-size: 18px; margin: 0 0 6px; }\n.page .page-sub { color: var(--muted); margin: 0 0 16px; line-height: 1.6; }\n\n/* \u72B6\u6001\u5FBD\u7AE0\uFF08\u72B6\u6001\u9875\u9876\u90E8\u8FD0\u884C\u6001\uFF09 */\n.state-badge {\n display: inline-block;\n margin: 6px 0 4px;\n font-size: 14px;\n font-weight: 600;\n}\n.state-badge.ok { color: var(--green); }\n.state-badge.off { color: var(--muted); }\n.state-badge.warn { color: var(--amber); }\n/* \u542F\u52A8\u4E2D\uFF1A\u84DD\uFF08--primary\uFF09+ \u547C\u5438\uFF0C\u8DDF"\u505C"\u548C"\u6545\u969C"\u90FD\u533A\u5206\u5F97\u5F00 */\n.state-badge.starting { color: var(--primary); animation: badge-pulse 1.6s ease-in-out infinite; }\n@keyframes badge-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }\n\n.btn-row { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }\n\n/* === \u72B6\u6001\u9875\u300C\u7248\u672C\u66F4\u65B0\u300D\u5361\u7247\uFF08update-card.ts\uFF09 === */\n\n/* \u53EF\u5347\u7EA7\u7684\u9AD8\u4EAE\u5757\uFF1A\u84DD\u5E95\u63CF\u8FB9\uFF08\u4E0E\u5F15\u64CE tab \u9009\u4E2D\u6001\u540C\u4E00\u7EC4\u8272\uFF09\u2014\u2014"\u6709\u65B0\u7248"\u662F\u8981\u770B\u89C1\u4F46\u4E0D\u662F\u8981\u7D27\u5F20\u7684\u4E8B\uFF0C\n \u6BD4 amber \u7684 .inline-warn \u66F4\u8D34\u5207\uFF1B\u5347\u5B8C\u7684 done \u6001\u6362\u7EFF\uFF08\u6210\u529F\u8272\uFF09\u3002 */\n.update-hint {\n display: inline-block;\n background: #eef3fd;\n border: 1px solid var(--primary);\n border-radius: var(--radius);\n color: var(--primary);\n font-weight: 600;\n padding: 7px 12px;\n margin: 6px 0;\n}\n.update-hint.done { background: var(--green-bg); border-color: var(--green); color: var(--green); }\n.up-muted { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 4px 0; }\n.update-actions { display: flex; gap: 10px; margin: 10px 0 2px; }\n.runtime-update { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 18px; padding: 14px 18px; }\n.runtime-update > :first-child { margin-bottom: 0 !important; }\n.runtime-update .update-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; flex-wrap: wrap; margin: 0; }\n.runtime-update > :nth-child(n+3):not(.update-actions) { grid-column: 1 / -1; }\n.runtime-update .update-hint { justify-self: start; margin: 0; }\n@media (max-width: 760px) {\n .runtime-update { grid-template-columns: minmax(0,1fr); }\n .runtime-update .update-actions { grid-column: 1; grid-row: auto; }\n}\n\n/* === \u901A\u9053\u5361\u7247 === */\n\n.chan-card {\n background: var(--panel);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n padding: 14px 16px;\n margin: 0 0 14px;\n max-width: 680px;\n}\n.chan-head {\n display: flex;\n align-items: center;\n gap: 10px;\n margin-bottom: 6px;\n}\n.chan-name { font-size: 15px; font-weight: 700; }\n.chan-light { font-size: 13px; color: var(--muted); }\n.chan-desc { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 10px; }\n.chan-card form { text-align: left; }\n.chan-card .field { margin-bottom: 10px; }\n\n/* === \u65E5\u5FD7\u9875 === */\n\n.log-view {\n flex: none;\n background: #14181f;\n color: #cfd8e3;\n border-radius: var(--radius);\n padding: 12px 14px;\n font: 12px/1.65 Consolas, \'Courier New\', monospace;\n white-space: pre-wrap;\n word-break: break-all;\n overflow-y: auto;\n height: calc(100vh - 210px);\n user-select: text;\n}\n\n/* === \u8BBE\u7F6E\u9875\uFF1A\u5206\u7EC4\u5BB9\u5668 === */\n/* \u26A0\uFE0F `.settings-group` \u4E4B\u524D\u53EA\u5728\u65E7\u7684 settings.ts \u91CC\u7528\u8FC7\u3001**\u4E24\u4E2A CSS \u6587\u4EF6\u91CC\u90FD\u6CA1\u5B9A\u4E49**\uFF08\u6B7B\u7C7B\uFF09\u3002\n \u8FD9\u4E00\u7248\u628A\u5B83\u8865\u6210\u771F\u7684\u3002 */\n.settings-group {\n background: var(--panel);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n padding: 14px 16px;\n margin: 0 0 14px;\n max-width: 680px;\n}\n.settings-group h3 { font-size: 15px; margin: 0 0 6px; }\n\n/* Everyday preferences use readable rows with a single accessible switch. */\n.other-preferences .settings-group { padding: 0; border: 0; background: transparent; margin-bottom: 16px; }\n.other-preferences .settings-group h3 { color: var(--muted); font-size: 14px; margin-bottom: 8px; }\n@media (min-width: 1100px) {\n .other-preferences .settings-group[data-group=chat] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }\n .other-preferences .settings-group[data-group=chat] > h3 { grid-column: 1 / -1; }\n .other-preferences .settings-group[data-group=chat] .cf-preference { column-gap: 12px; }\n}\n.other-preferences .cf-preference { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 20px; padding: 9px 14px; margin-bottom: 5px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }\n.other-preferences .cf-preference > label { grid-column: 1; margin: 0; font-size: 15px; cursor: pointer; }\n.other-preferences .cf-preference > .cf-hint { grid-column: 1; margin: 3px 0 0; font-size: 13px; line-height: 1.5; }\n.cf-preference > .check-row { grid-column: 2; grid-row: 1 / 3; align-self: center; }\n.cf-preference > .cf-error { grid-column: 1 / -1; }\n.cf-preference-choice > select { grid-column: 2; grid-row: 1 / 3; align-self: center; width: 138px; margin: 0; padding: 8px 30px 8px 12px; border-radius: 10px; border-color: rgba(167, 139, 250, .35); background-color: rgba(141, 106, 219, .12); color: var(--text); font-size: 14px; cursor: pointer; }\n.cf-preference-choice > select:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 3px; }\n@media (max-width: 600px) {\n .other-preferences .cf-preference-choice { grid-template-columns: minmax(0, 1fr); }\n .cf-preference-choice > select { grid-column: 1; grid-row: auto; width: 100%; margin-top: 8px; }\n}\n.cf-preference input[type=checkbox] { appearance: none; display: block; width: 38px; height: 22px; margin: 0; padding: 2px; border: 1px solid var(--border); border-radius: 20px; background: #35313f; cursor: pointer; transition: background .15s; }\n.cf-preference input[type=checkbox]::before { content: \'\'; display: block; width: 16px; height: 16px; border-radius: 50%; background: #eee9f5; transition: transform .15s; }\n.cf-preference input[type=checkbox]:checked { background: #8d6adb; border-color: #a78bfa; }\n.cf-preference input[type=checkbox]:checked::before { transform: translateX(16px); }\n.other-preferences .cf-preference input[type=checkbox]:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 4px; }\n@media (prefers-reduced-motion: reduce) { .cf-preference input[type=checkbox], .cf-preference input[type=checkbox]::before { transition: none; } }\n\n.subtabs {\n display: flex; gap: 6px; flex-wrap: wrap;\n border-bottom: 1px solid var(--border);\n margin-bottom: 16px;\n}\n.subtab {\n padding: 7px 14px; border: none; border-bottom: 2px solid transparent;\n background: transparent; color: var(--muted); font: inherit; cursor: pointer;\n}\n.subtab:hover { color: var(--text); }\n.subtab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }\n\n/* === \u901A\u7528\u8868\u5355\uFF08form.ts \u7684\u9009\u62E9\u5668\u5951\u7EA6\uFF1A.cf-field[data-path]\uFF09 === */\n.cf-form { max-width: 680px; }\n.cf-field { margin-bottom: 16px; }\n.cf-field > label { display: block; font-weight: 600; margin-bottom: 5px; }\n.cf-path { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 8px; font-family: Consolas, monospace; }\n.cf-hint { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 4px 0 6px; }\n.cf-error { color: var(--red); background: var(--red-bg); border-radius: var(--radius); padding: 6px 10px; font-size: 13px; line-height: 1.6; margin-top: 6px; }\n.cf-field input[type=\'text\'], .cf-field input[type=\'password\'], .cf-field input[type=\'number\'], .cf-field select, .cf-field textarea {\n width: 100%; padding: 8px 10px; border: 1px solid var(--border);\n border-radius: var(--radius); font: inherit; background: #fff; color: var(--text);\n}\n.cf-field textarea { font-family: Consolas, monospace; font-size: 12px; }\n.cf-field input:focus, .cf-field select:focus { outline: none; border-color: var(--primary); }\n/* json \u683C\u662F**\u53EA\u8BFB**\u7684\uFF08form.ts \u7EAA\u5F8B 4\uFF09\uFF1A\u80FD\u9009\u4E2D\u80FD\u590D\u5236\uFF0C\u4F46\u6539\u4E0D\u4E86 \u2014\u2014 \u89C6\u89C9\u4E0A\u4E5F\u8981\u4E00\u773C\u770B\u51FA\u6765 */\n.cf-field textarea[readonly] { background: #f4f6f9; color: var(--muted); }\n/* \u56DB\u4E2A\u9AD8\u5371\u8DEF\u5F84\uFF08stateDir / mediaDir / workspace / skills.path\uFF09\u4E5F\u662F\u53EA\u8BFB\u6863\uFF08form.ts \u7EAA\u5F8B 5\uFF09\u3002\n \u540C\u6B3E\u7070\u5E95\uFF1A\u5149\u9760 readOnly \u5728\u89C6\u89C9\u4E0A\u6CA1\u6709\u5206\u522B\uFF0C\u800C"\u8FD9\u4E00\u683C\u6539\u4E0D\u4E86"\u672C\u8EAB\u5C31\u662F\u8981\u4F20\u8FBE\u7684\u4FE1\u606F */\n.cf-field input[readonly] { background: #f4f6f9; color: var(--muted); }\n\n.fx-badge { font-size: 11px; font-weight: 400; padding: 1px 7px; border-radius: 8px; margin-left: 8px; }\n.fx-restart { background: var(--amber-bg); color: var(--amber); }\n.fx-reconnect { background: #eef3fd; color: var(--primary); }\n.fx-external { background: #e4e8ee; color: var(--muted); }\n.sec-badge { font-size: 11px; margin-left: 8px; padding: 1px 7px; border-radius: 8px; background: #e4e8ee; color: var(--muted); }\n.sec-set { background: #e8f6ee; color: var(--green); }\n.sec-unset { background: var(--amber-bg); color: var(--amber); }\n.sec-new { background: #eef3fd; color: var(--primary); }\n\n.cfg-savebar { margin-top: 18px; max-width: 680px; }\n.cfg-detail > * { margin-top: 10px; }\n.cfg-loading { color: var(--muted); }\n\n/* === \u8BBE\u7F6E\u9875\u5E95\u90E8\u90A3\u884C\u7248\u672C\u6587\u5B57\uFF08\u540C\u65F6\u662F\u5185\u90E8\u6A21\u5F0F\u624B\u52BF\u7684\u843D\u70B9\uFF09===\n \u89C1 console/internal-mode.ts\uFF1A**\u8FDE\u70B9 7 \u4E0B**\u5207\u5F00\u5185\u90E8\u6A21\u5F0F\uFF08\u5B89\u5353\u300C\u8FDE\u70B9\u7248\u672C\u53F7\u300D\u90A3\u4E2A\u624B\u611F\uFF09\u3002\n \u6837\u5F0F\u523B\u610F\u505A\u5F97**\u4E0D\u663E\u773C**\uFF08\u7070\u3001\u5C0F\u3001\u4E0D\u50CF\u80FD\u70B9\u7684\u4E1C\u897F\uFF09\u2014\u2014 \u5B83\u5C31\u662F\u4E00\u884C\u7CFB\u7EDF\u4FE1\u606F\uFF0C\n \u6CA1\u6709\u4EFB\u4F55"\u8FD9\u91CC\u80FD\u70B9"\u7684\u63D0\u793A\uFF1B\u5207\u5F00\u4E4B\u540E\u7684\u53CD\u9988\u8D70 .internal-note\u3002 */\n.settings-footer {\n margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--border);\n display: flex; align-items: center; gap: 10px; flex-wrap: wrap;\n color: var(--muted); font-size: 12px;\n}\n.settings-footer .version-line { cursor: default; user-select: none; font-family: Consolas, monospace; }\n.internal-badge { padding: 1px 8px; border-radius: 8px; background: var(--amber-bg); color: var(--amber); font-size: 11px; }\n.internal-note { color: var(--primary); }\n\n/* === \u901A\u9053\u9875\u5206\u7EC4\u6807\u5934 + \u9AD8\u7EA7\u6298\u53E0\uFF081011 \u7FC0\u54E5\uFF1A\u56FD\u5185/\u56FD\u9645\u5206\u7EC4\u4E0D\u63D2\u82B1\uFF1B\u626B\u7801\u662F\u4E3B\u8DEF\uFF0C\u8868\u5355\u6536\u8FDB\u62BD\u5C49\uFF09 === */\n.chan-advanced { margin: 10px 0 4px; }\n.chan-advanced > summary {\n cursor: pointer; font-size: 12px; color: var(--muted); user-select: none;\n}\n.chan-advanced > summary:hover { color: var(--primary); }\n.chan-advanced[open] > summary { margin-bottom: 8px; }\n\n/* === \u54C1\u724C\u5FBD\u6807 + \u5BFC\u822A\u56FE\u6807\uFF081011 \u8BBE\u8BA1\u8F6E\uFF09=== */\n.chan-badge {\n flex: none; width: 32px; height: 32px; border-radius: 8px;\n display: flex; align-items: center; justify-content: center;\n color: #fff; font-size: 14px; font-weight: 700; line-height: 1;\n background: #f3f5f9; /* logo \u5E95\u886C\uFF1A\u6D45\u7070\u74E6\u7247\uFF08\u8272\u5757+\u5B57\u515C\u5E95\u65F6\u4F1A\u88AB\u5185\u8054\u80CC\u666F\u8272\u76D6\u6389\uFF09 */\n box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.05);\n}\n.chan-badge svg { width: 20px; height: 20px; }\n.chan-badge.small svg { width: 13px; height: 13px; }\n.chan-badge.small { width: 20px; height: 20px; font-size: 10.5px; border-radius: 5px; }\n.chan-head { gap: 10px; }\n.light-row { gap: 8px; }\n\n.nav-item {\n display: flex; align-items: center; gap: 9px;\n transition: background 0.12s ease;\n}\n.nav-item svg { flex: none; width: 15px; height: 15px; opacity: 0.75; }\n.nav-item.active svg { opacity: 1; }\n\n/* \u5361\u7247\u8D28\u611F\uFF1Ahover \u8F7B\u6D6E\u8D77 */\n.chan-card { transition: box-shadow 0.15s ease; }\n.chan-card:hover { box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08); }\n\n/* Shared warm installer appearance; navigation and page contents are unchanged. */\n#console-app { display: grid; grid-template-columns: 190px minmax(0, 1fr); grid-template-rows: 66px minmax(0, 1fr); overflow: hidden; }\n.console-header { grid-column: 1 / -1; display: flex; align-items: center; padding: 0 28px; border-bottom: 1px solid var(--border); background: #fcfaf7; }\n.sidebar { grid-column: 1; grid-row: 2; width: auto; min-height: 0; overflow-y: auto; padding: 25px 15px; background: var(--sidebar); }\n.console-body-slot { grid-column: 2; grid-row: 2; min-height: 0; }\n.console-body { min-height: 0; min-width: 0; padding: 33px 37px; }\n.page, .chan-card, .settings-group, .cf-form, .cfg-savebar { max-width: 850px; }\n.page h2 { font-family: var(--serif); font-size: 27px; font-weight: 600; line-height: 1.5; margin-bottom: 13px; }\n.page .page-sub { font-size: 14px; line-height: 1.9; margin-bottom: 23px; }\n.sidebar-nav { gap: 5px; }\n.nav-item { justify-content: flex-start; padding: 11px 13px; border-radius: 8px; font-size: 14px; }\n.nav-item:hover { background: #e9e4dc; }\n.nav-item.active { color: var(--primary); background: #eddfd1; }\n.nav-item.active svg { color: var(--primary); }\n.nav-item.nav-placeholder:hover { background: transparent; }\n.phase-badge { margin-left: auto; background: #e8e3db; font-size: 12px; border-radius: 5px; }\n.sidebar .sidebar-mark { margin-left: 10px; margin-right: 10px; }\n.state-badge { font-size: 15px; margin-top: 8px; }\n.report-block:has(.state-badge) { background: #f2e7dd; border-color: #dfcbb9; padding: 23px 25px; }\n.report-block:has(.state-badge) .report-version { font-family: Georgia, var(--serif); font-size: 24px; }\n.report-block:has(.state-badge) .state-badge.ok { color: var(--primary); }\n.btn-row { gap: 10px; }\n.update-hint { background: var(--selected); border-color: #d5b5a1; }\n.update-hint.done { background: var(--green-bg); border-color: var(--green); }\n.up-muted { line-height: 1.8; }\n.chan-card { padding: 21px 23px; margin-bottom: 15px; }\n.chan-card:hover { box-shadow: 0 3px 12px #bd79520b; }\n.chan-head { margin-bottom: 13px; flex-wrap: wrap; gap: 10px; }\n.chan-name { font-size: 18px; font-weight: 600; }\n.chan-light { font-size: 14px; margin-left: auto; }\n.chan-desc { font-size: 14px; line-height: 1.9; margin-bottom: 15px; }\n.chan-card .chan-advanced { padding-top: 12px; border-top: 1px solid var(--border); margin-top: 17px; }\n.chan-advanced > summary { font-size: 14px; }\n.chan-advanced[open] > summary { margin-bottom: 15px; }\n.chan-badge { background: #fff; border: 1px solid var(--border); box-shadow: none; }\n.chan-badge svg { width: 23px; height: 23px; }\n.chan-badge.small { width: 23px; height: 23px; }\n.chan-badge.small svg { width: 16px; height: 16px; }\n.settings-group { padding: 21px 23px; margin-bottom: 18px; }\n.settings-group h3 { font-size: 18px; margin-bottom: 12px; }\n.subtabs { gap: 3px; margin-bottom: 23px; }\n.subtab { font-size: 14px; padding: 10px 12px; }\n.subtab.active { color: var(--primary); }\n.cf-field { margin-bottom: 21px; }\n.cf-field > label { font-size: 16px; margin-bottom: 8px; }\n.cf-hint { font-size: 14px; line-height: 1.85; }\n.cf-path { font-size: 14px; overflow-wrap: anywhere; }\n.cf-field input[type=\'text\'], .cf-field input[type=\'password\'], .cf-field input[type=\'number\'], .cf-field select, .cf-field textarea {\n min-width: 0; padding: 10px 12px; border-radius: 8px; border-color: #ded8d0; background: var(--panel);\n}\n.cf-field input:focus, .cf-field select:focus, .cf-field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px #bd795210; }\n.cf-field input[readonly], .cf-field textarea[readonly] { background: #efede7; }\n.fx-reconnect, .sec-new { background: var(--selected); color: var(--primary); }\n.fx-external, .sec-badge { background: #eae6dd; }\n.sec-set { background: var(--green-bg); }\n.sec-unset { background: var(--amber-bg); }\n.cfg-savebar { padding-top: 17px; border-top: 1px solid var(--border); }\n.settings-footer { margin-top: 26px; font-size: 14px; gap: 8px; }\n.cf-field textarea, .up-muted, .cf-error, .fx-badge, .sec-badge, .internal-badge { font-size: 14px; }\n.log-view { height: max(150px, calc(100vh - 265px)); background: #383336; color: #e9e2dd; border: 1px solid #4d424a; font-size: 14px; padding: 17px 20px; border-radius: 10px; }\n\n@media (max-width: 960px) {\n #console-app { grid-template-columns: 165px minmax(0, 1fr); }\n .sidebar { padding: 21px 12px; }\n .console-body { padding: 26px; }\n .page h2 { font-size: 24px; }\n .chan-card, .settings-group { padding: 18px 19px; }\n}\n@media (max-height: 660px) {\n #console-app { grid-template-rows: 58px minmax(0, 1fr); }\n .console-body { padding-top: 25px; }\n .sidebar { padding-top: 18px; }\n .nav-item { padding-top: 9px; padding-bottom: 9px; }\n}\n@media (max-width: 720px) {\n #console-app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 56px auto minmax(0, 1fr); }\n .console-header { padding: 0 18px; }\n .sidebar { grid-column: 1; grid-row: 2; padding: 9px 15px; border-right: 0; border-bottom: 1px solid var(--border); }\n .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }\n .nav-item { padding: 7px 9px; font-size: 14px; }\n .nav-item svg { display: none; }\n .engine-picker:not(:empty) { padding-bottom: 10px; margin-bottom: 6px; }\n .engine-picker-path { -webkit-line-clamp: 1; }\n .sidebar .sidebar-mark { display: none; }\n .console-body-slot { grid-column: 1; grid-row: 3; }\n .console-body { padding: 22px; }\n}\n\n/* Mail connectors share Aurora surfaces and one clear action per provider. */\n.mail-page { max-width:980px; }\n.mail-heading { display:flex;align-items:center;justify-content:space-between;gap:16px; }\n.mail-heading h2 { margin-bottom:0; }\n.mail-connected-count { flex:none;padding:8px 13px;border-radius:999px;background:rgba(176,142,255,.09);color:var(--text-muted,#b3adc5);font-size:12px; }\n.connection-list { margin:26px 0 14px;border:1px solid rgba(196,180,255,.11);border-radius:22px;overflow:hidden;background:linear-gradient(130deg,rgba(160,120,255,.045),rgba(80,130,210,.018)); }\n.connection-row { display:grid;grid-template-columns:52px minmax(0,1fr) auto;align-items:center;gap:18px;padding:25px 26px;transition:background .18s; }\n.connection-row + .connection-row { border-top:1px solid rgba(196,180,255,.08); }\n.connection-row.selected { background:rgba(169,129,250,.055); }\n.connection-icon { display:flex;width:52px;height:52px;align-items:center;justify-content:center;border:1px solid rgba(255,255,255,.12);border-radius:15px;background:rgba(255,255,255,.055);font-size:18px;font-weight:600;letter-spacing:-1px; }\n.connection-icon[data-brand=qq] { color:#88cfff;background:rgba(63,154,230,.08); }\n.connection-icon[data-brand="163"] { color:#ff999e;background:rgba(235,83,96,.08);font-size:17px; }\n.connection-icon img { width:32px;height:32px; }\n.connection-copy h3 { margin:0 0 6px;font-size:19px;font-weight:450;letter-spacing:0; }\n.connection-description { margin:0;color:var(--text-muted,#a8a3b6);font-size:13px;line-height:1.6;overflow-wrap:anywhere; }\n.connection-action { min-height:38px;min-width:100px;padding:8px 17px;border:1px solid rgba(180,142,255,.2);border-radius:999px;background:rgba(176,132,255,.11);color:#ddd0ff;font:inherit;font-size:13px;cursor:pointer; }\n.connection-action:hover:not(:disabled) { background:rgba(176,132,255,.2);border-color:rgba(196,166,255,.4); }\n.connection-action.connected { color:#b3ddca;background:rgba(99,180,143,.08);border-color:rgba(130,200,165,.15); }\n.connection-action:disabled { cursor:default;opacity:.55; }\n.connection-action:focus-visible,.mail-other-link:focus-visible,.settings-mail-link:focus-visible { outline:2px solid #b397f1;outline-offset:4px; }\n.gmail-details { grid-column:2/-1;margin-top:2px;min-width:0; }\n.gmail-details[hidden] { display:none; }\n.gmail-account { overflow-wrap:anywhere;font-size:14px; }\n.gmail-details .btn-row { flex-wrap:wrap;margin-top:14px; }\n.gmail-confirm { margin-top:16px;padding:14px 16px;border:1px solid rgba(193,150,255,.16);border-radius:12px;background:rgba(167,127,225,.04);font-size:13px; }\n.mail-other-link { border:0;background:none;color:var(--text-muted,#a8a3b6);font:inherit;font-size:12px;padding:7px 0;cursor:pointer; }\n.mail-configuration { margin-top:24px; }\n.settings-mail-link { display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:17px 20px;margin-top:22px;background:rgba(162,134,230,.04);border:1px solid rgba(188,162,240,.13);border-radius:14px;color:var(--text,#ddd8eb);font:inherit;text-align:left;cursor:pointer; }\n.settings-mail-link span { font-size:12px;color:var(--text-muted,#a8a3b6); }\n@media(max-width:800px) { .connection-row { grid-template-columns:42px minmax(0,1fr) auto;gap:12px;padding:21px 18px; }.connection-icon { width:42px;height:42px;border-radius:12px; }.connection-copy h3 { font-size:16px; }.connection-action { min-width:80px;padding:8px 11px;font-size:12px; }.mail-heading { flex-wrap:wrap; } }\n@media(prefers-reduced-motion:reduce) { .connection-row { transition:none; } }\n\n.gmail-policies { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 20px; margin:12px 0; }\n.gmail-policy { display:flex; justify-content:space-between; align-items:center; gap:8px; min-width:0; }\n.gmail-policy select { padding:5px 8px; color:var(--text); background:var(--bg); border:1px solid var(--border); border-radius:6px; }\n@media(max-width:760px) { .gmail-policies { grid-template-columns:1fr; } }\n/* One travel page for the desktop tray and independent web console. */\n.travel-page { display: flex; flex-direction: column; gap: 22px; }\n.travel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }\n.travel-heading h2 { margin: 0 0 12px; font-size: 32px; font-weight: 400; }\n.travel-eyebrow { font-size: 11px; color: #c6a6e7; letter-spacing: .2em; margin: 0 0 12px; }\n.travel-heading .page-sub { margin: 0; }\n.travel-page .page-sub { margin-bottom: 0; }\n.travel-intro, .travel-presence, .travel-peer, .travel-actions, .travel-progress, .travel-exit { border: 1px solid rgba(183,145,230,.18); border-radius: 18px; background: linear-gradient(130deg,rgba(44,29,67,.8),rgba(23,19,35,.8)); padding: 24px; min-width: 0; }\n.travel-intro { padding: 42px 32px; }\n.travel-intro h3 { font-size: 23px; font-weight: 400; margin: 12px 0; }\n.travel-intro p { color: #b9aecb; line-height: 1.8; max-width: 520px; }\n.travel-intro-mark svg { width: 38px; height: 38px; color: #c5a0ef; }\n.travel-intro .btn { margin-top: 16px; }\n.travel-presence { display: flex; align-items: center; gap: 15px; }\n.travel-presence h3, .travel-peer h3, .travel-actions h3, .travel-exit h3 { margin: 0 0 10px; font-weight: 400; }\n.travel-presence h3 { font-size: 24px; background: linear-gradient(100deg,#a4b6ff,#ce9fff,#f1b9d5,#ebd3aa); color: transparent; background-clip: text; }\n.travel-presence-dot { width: 8px; height: 8px; border-radius: 50%; background: #a5d9cb; box-shadow: 0 0 13px #a5d9cb55; flex: none; }\n.travel-presence[data-stale=true] .travel-presence-dot { background: #ceb67e; box-shadow: none; }\n.travel-presence p, .travel-peer p, .travel-actions p, .travel-exit p { margin: 0; line-height: 1.7; }\n.travel-peers { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }\n.travel-peer[data-active=true] { border-color: rgba(179,151,233,.5); }\n.travel-peer-kind { display: inline-block; font-size: 11px; letter-spacing: .15em; color: #bfa8df; margin-bottom: 16px; }\n.travel-peer h3 { font-size: 20px; overflow-wrap: anywhere; }\n.travel-peer-presence { color: #e0d7ed; padding-bottom: 12px; }\n.travel-actions .btn-row { margin-top: 20px; }\n.travel-actions .travel-auto { margin-left: auto; }\n.travel-progress p { margin-bottom: 0; line-height: 1.8; }\n.travel-exit { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: rgba(27,22,37,.7); }\n.travel-exit .btn-row { flex-wrap: wrap; flex-shrink: 0; }\n.travel-notice { margin: 0; border-left: 2px solid #c8a5df; padding: 10px 16px; color: #d0c4df; line-height: 1.8; background: #af81ce0b; }\n.travel-notice.stale { border-color: #d3ba85; }\n.travel-connect-form, .travel-confirm { width: min(520px,calc(100vw - 64px)); padding: 30px; border-radius: 18px; background: #20182d; border: 1px solid #b894da44; box-sizing: border-box; }\n.travel-connect-form h2, .travel-confirm h2 { margin-top: 0; font-size: 23px; font-weight: 400; }\n.travel-connect-form p, .travel-confirm p { color: #c8bbd6; line-height: 1.8; }\n.travel-connect-form label { display: flex; flex-direction: column; gap: 8px; margin: 20px 0; color: #dfd5ec; }\n.travel-connect-form input { width: 100%; box-sizing: border-box; min-width: 0; background: #130e1e; border: 1px solid #bda5d044; border-radius: 8px; padding: 11px 12px; color: #f0e9f6; font: inherit; }\n.travel-connect-form .btn-row, .travel-confirm .btn-row { justify-content: flex-end; margin-top: 24px; }\n@media (max-width: 1050px) { .travel-exit { align-items: flex-start; flex-direction: column; } .travel-actions .travel-auto { margin-left: 0; } }\n@media (max-width: 760px) { .travel-peers { grid-template-columns: minmax(0,1fr); } .travel-heading { align-items: flex-start; } .travel-heading h2 { font-size: 27px; } .travel-peer,.travel-presence,.travel-actions,.travel-exit { padding: 20px; } .travel-intro { padding: 28px 22px; } }\n\n/* Companion identity uses the homepage\'s thin type, quiet aurora and horizon. */\n.partner-card { position: relative; min-width: 0; padding: 13px 12px 16px; overflow: hidden; border: 1px solid #ece8e112; border-radius: 16px; background: radial-gradient(ellipse at 12% 100%, #a78bfa14, transparent 75%), linear-gradient(150deg, #161020aa, #0b0b1399); }\n.partner-card::before { content: \'\'; position: absolute; left: 12px; right: 12px; bottom: 0; height: 1px; background: var(--rainbow); opacity: .5; }\n.partner-card::after { content: \'\'; position: absolute; width: 80%; height: 24px; left: 10%; bottom: -18px; background: var(--rainbow); filter: blur(20px); opacity: .2; pointer-events: none; }\n.partner-heading { display: flex; justify-content: space-between; align-items: center; gap: 4px; min-height: 24px; margin-bottom: 9px; }\n.partner-caption { font-size: 11px; letter-spacing: .16em; color: var(--muted); font-weight: 400; }\n.partner-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }\n.partner-avatar { position: relative; display: grid; place-items: center; flex: 0 0 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 30% 20%, #a78bfa14, #0b0b1380); box-shadow: 0 0 24px #a78bfa0c; }\n.partner-avatar::before { content: \'\'; position: absolute; inset: 0; border: 1px solid #ece8e126; border-top-color: #6ecdff70; border-right-color: #a78bfa66; border-bottom-color: #ff6b9d55; border-left-color: #ffcf8a44; border-radius: 50%; }\n.partner-avatar::after { content: \'\'; position: absolute; top: 2px; right: 7px; width: 3px; height: 3px; border-radius: 50%; background: #ece8e1; box-shadow: 0 0 8px #a78bfa99; }\n.partner-glyph { font-family: var(--sans); font-size: 21px; font-weight: 200; color: var(--bone); }\n.partner-info { display: flex; flex: 1; flex-direction: column; gap: 6px; min-width: 0; }\n.partner-name { font: 300 21px/1.35 var(--sans); letter-spacing: .06em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--bone); }\n.partner-name, .partner-option-name { width: fit-content; max-width: 100%; }\n.name-edit { border: 0; padding: 0; background-color: transparent; text-align: left; cursor: pointer; }\n.companion-name.name-edit { font: inherit; letter-spacing: inherit; }\n.name-edit:hover { text-decoration: underline; text-decoration-color: #a78bfa80; text-underline-offset: .14em; }\n.name-edit:focus-visible { outline: 1px solid var(--violet); outline-offset: 3px; border-radius: 3px; }\n@supports ((background-clip: text) or (-webkit-background-clip: text)) {\n .companion-name, .partner-name, .partner-option-name { background: var(--rainbow); background-clip: text; -webkit-background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }\n}\n@media (forced-colors: active) {\n .companion-name, .partner-name, .partner-option-name { background: none; color: CanvasText; -webkit-text-fill-color: CanvasText; }\n}\n.partner-status { display: flex; align-items: center; gap: 6px; font-size: 11px; line-height: 1.6; color: var(--muted); white-space: nowrap; }\n.partner-status::before { content: \'\'; flex: 0 0 4px; height: 4px; border-radius: 50%; background: #9b91a4; }\n.partner-card[data-state=running] .partner-status::before { background: var(--green); box-shadow: 0 0 9px #5fe6c033; }\n.partner-card[data-state=starting] .partner-status::before { background: var(--violet); }\n.partner-card[data-state=warn] .partner-status::before { background: var(--gold); }\n.partner-switch { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 34px; height: 26px; border: 1px solid transparent; border-radius: 7px; padding: 0 3px; background: transparent; color: var(--muted); font: 11px var(--sans); cursor: pointer; }\n.partner-switch:hover, .partner-switch[aria-expanded=true] { color: var(--bone); background: #ffffff06; border-color: #a78bfa2e; }\n.partner-switch:disabled { opacity: .5; cursor: wait; }\n.partner-chevron { width: 5px; height: 5px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); transition: transform .2s; }\n.partner-switch[aria-expanded=true] .partner-chevron { transform: rotate(225deg); }\n.partner-switch:focus-visible, .partner-naming:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }\n.partner-naming { padding: 0; margin: 10px 0 0 51px; border: 0; background: transparent; text-align: left; font: 11px/1.6 var(--sans); color: var(--violet); cursor: pointer; }\n.partner-naming:hover { color: var(--bone); }\n.partner-renaming { position: absolute; top: 17px; right: 12px; margin: 0; }\n.partner-card[data-multi=true] .partner-renaming { right: 52px; }\n\n.partner-menu { position: fixed; inset: auto; margin: 0; padding: 0; color: var(--bone); border: 1px solid #a78bfa40; border-radius: 17px; background: radial-gradient(ellipse at 0 0, #32204360, transparent 65%), #100c19; box-shadow: 0 20px 65px #0008, 0 0 35px #a78bfa0c; }\n.partner-menu:popover-open { display: flex; flex-direction: column; }\n.partner-menu-heading { display: flex; justify-content: space-between; gap: 12px; padding: 16px 18px 13px; border-bottom: 1px solid #ece8e10c; font: 12px/1.5 var(--sans); letter-spacing: .06em; }\n.partner-menu-heading > span:last-child { color: var(--muted); font-size: 11px; letter-spacing: 0; }\n.partner-menu-list { padding: 7px; overflow-y: auto; min-height: 0; }\n.partner-option { display: flex; width: 100%; min-width: 0; gap: 12px; align-items: center; padding: 11px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--bone); text-align: left; cursor: pointer; font-family: var(--sans); }\n.partner-option:hover { background: #ffffff04; }\n.partner-option[aria-checked=true] { background: #a78bfa0d; border-color: #a78bfa25; }\n.partner-option:focus-visible { outline: 1px solid var(--violet); outline-offset: -1px; background: #a78bfa0e; }\n.partner-option:disabled { opacity: .55; cursor: wait; }\n.partner-option-avatar { display: grid; place-items: center; flex: 0 0 31px; height: 31px; border: 1px solid #ece8e11e; border-radius: 50%; font-size: 17px; font-weight: 200; color: #ded0ef; background: #a78bfa06; }\n.partner-option-copy { display: flex; flex-direction: column; flex: 1; gap: 5px; min-width: 0; }\n.partner-option-name { font-size: 14px; font-weight: 400; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }\n.partner-option-status { display: flex; align-items: center; gap: 5px; font-size: 11px; line-height: 1.5; color: var(--muted); }\n.partner-option-status::before { content: \'\'; flex: 0 0 4px; height: 4px; border-radius: 50%; background: #9b91a4; }\n.partner-option[data-state=running] .partner-option-status::before { background: var(--green); }\n.partner-option[data-state=starting] .partner-option-status::before { background: var(--violet); }\n.partner-option[data-state=warn] .partner-option-status::before { background: var(--gold); }\n.partner-option-path { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; line-height: 1.5; color: var(--muted); }\n.partner-current { flex: none; font-size: 10px; color: #c5b0e0; align-self: center; }\n.partner-menu-error { margin: 0; padding: 12px 18px; border-top: 1px solid #ece8e10c; color: var(--red); font-size: 12px; line-height: 1.6; }\n.aurora-motion-paused .partner-chevron { transition: none; }\n@media (prefers-reduced-motion: reduce) { .partner-chevron { transition: none; } }\n\n/* Current \u65E5\u5E38\u56DE\u54CD design, applied after the existing functional layouts. */\n:root {\n color-scheme: dark;\n --void: #040408; --surface: #0b0b13; --bone: #ece8e1;\n --blue: #6ecdff; --violet: #a78bfa; --pink: #ff6b9d; --gold: #ffcf8a;\n --rainbow: linear-gradient(100deg, #6ecdff 0%, #a78bfa 34%, #ff6b9d 68%, #ffcf8a 100%);\n --bg: var(--void); --panel: var(--surface); --border: rgba(236,232,225,.14);\n --text: var(--bone); --muted: rgba(236,232,225,.68); --brand: var(--violet);\n --primary: var(--violet); --primary-hi: #c4b5fd;\n --green: #5fe6c0; --green-bg: #102720; --red: #ff9ea9; --red-bg: #321621;\n --amber: var(--gold); --amber-bg: #2b221b; --radius: 14px;\n --sidebar: rgba(11,11,19,.78); --selected: #20172e;\n --sans: \'PingFang SC\', \'Microsoft YaHei\', \'Segoe UI\', sans-serif;\n}\nhtml, body { font-family: var(--sans); background: var(--void); color: var(--bone); }\n::selection { background: var(--violet); color: var(--void); }\n::-webkit-scrollbar-thumb { background: #4e465d; border-color: var(--void); }\n#app, #console-app { position: relative; z-index: 1; background: transparent; }\n.aurora-field { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse 65% 55% at 65% 73%, #38204c88, transparent 75%); }\n.aurora-field[data-scene=welcome] { background: radial-gradient(ellipse 65% 60% at 63% 69%, #4b285c99, transparent 75%); }\n.aurora-field[data-scene=install], .aurora-field[data-scene=status] { background: radial-gradient(ellipse 65% 65% at 68% 67%, #2a234d99, transparent 75%); }\n.aurora-particles { display: block; width: 100%; height: 100%; }\n.wiz-header, .console-header { justify-content: space-between; gap: 20px; background: rgba(4,4,8,.78); }\n.wiz-title { gap: 10px; min-width: 0; }\n.engine-mark { width: 29px; height: 29px; }\n.engine-wordmark { display: inline-flex; align-items: baseline; gap: .18em; white-space: nowrap; font-family: Georgia, serif; font-weight: 400; color: var(--bone); }\n.brand-separator { font-size: .5em; color: var(--muted); letter-spacing: 0; }\n.brand-qi { font: 400 .72em/1 \'Songti SC\', STSong, SimSun, serif; letter-spacing: 0; color: var(--violet); }\n@supports (background-clip: text) or (-webkit-background-clip: text) {\n .brand-qi { background: var(--rainbow); background-clip: text; -webkit-background-clip: text; color: transparent; }\n}\n.window-purpose { font-size: 12px; letter-spacing: .08em; padding-left: 14px; margin-left: 5px; }\n.chrome-actions { display: flex; align-items: center; gap: 18px; min-width: 0; }\n.window-context { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.aurora-motion { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 50%; color: var(--bone); background: transparent; font-size: 19px; cursor: pointer; }\n.aurora-motion:hover { border-color: var(--violet); background: var(--selected); }\n.aurora-motion[aria-pressed=true] { color: var(--muted); }\n.aurora-motion:disabled { opacity: .55; cursor: default; }\n.sidebar-kicker { font-size: 11px; color: var(--muted); margin: 0 0 25px; letter-spacing: .06em; }\n.sidebar-mark { border-color: var(--border); color: var(--muted); font-size: 11px; letter-spacing: .12em; }\n.sidebar-mark .engine-mark { display: inline-block; vertical-align: middle; margin-right: 10px; }\n.stepper-item .dot { border-color: var(--border); color: var(--muted); }\n.stepper-item:not(:last-child)::after { background: var(--border); }\n.stepper-item.active { color: var(--bone); font-weight: 500; }\n.stepper-item.active .dot { background: var(--selected); border-color: var(--violet); color: var(--bone); box-shadow: 0 0 0 4px #a78bfa12; }\n.stepper-item.done .dot { color: var(--green); background: var(--green-bg); border-color: #5fe6c033; }\n.step h2, .page h2, .modal h3 { font-family: var(--sans); font-weight: 200; font-size: 32px; line-height: 1.35; letter-spacing: .015em; }\n.step-welcome h2 { font-size: clamp(32px, 4.6vw, 48px); margin: 5px 0 20px; }\n.step-welcome h2 em { font-style: normal; background: var(--rainbow); background-clip: text; -webkit-background-clip: text; color: transparent; }\n.aurora-eyebrow { font-size: 10px; letter-spacing: .18em; color: var(--muted); margin: 0 0 8px; }\n.wiz-tagline { font-family: var(--sans); font-size: 16px; font-weight: 400; }\n.wiz-tagline .tagline-lead { color: var(--bone); }\n.wiz-tagline .tagline-slogan { color: var(--violet); }\n.tagline-gloss { margin-bottom: 18px; }\n.step .step-sub, .page .page-sub { color: var(--muted); line-height: 1.9; }\n.wiz-footer { background: rgba(11,11,19,.92); border-color: var(--border); }\n.btn { background: var(--panel); border-color: var(--border); border-radius: 999px; }\n.btn:hover, .btn:disabled:hover { background: var(--selected); border-color: #a78bfa66; }\n.btn-primary, .btn-primary:disabled:hover { background: var(--bone); color: var(--void); border-color: var(--bone); box-shadow: none; }\n.btn-primary:hover { background: #fff9f4; border-color: #fff9f4; box-shadow: 0 4px 25px #a78bfa2b; }\n.btn-danger, .btn-danger:hover { color: var(--red); background: var(--red-bg); border-color: #ff9ea94d; }\n.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=email], .field select, .field textarea,\n.cf-field input[type=text], .cf-field input[type=password], .cf-field input[type=number], .cf-field select, .cf-field textarea, .summary-table input,\n.engine-picker select { border-color: var(--border); background: var(--panel); color: var(--bone); border-radius: 9px; }\n.field input:focus, .field textarea:focus, .field select:focus,\n.cf-field input:focus, .cf-field select:focus, .cf-field textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px #a78bfa1c; }\ninput, textarea, select { accent-color: var(--violet); }\n.cf-field input[readonly], .cf-field textarea[readonly] { background: #090810; color: var(--muted); }\n.note-box { background: #171322; color: var(--muted); border: 1px solid var(--border); }\n.existing-panel, #p-free-block { border-color: #a78bfa55; }\n.radio-card:has(input:checked), .step-channels > .field:has(input[value=qr]:checked), .step-channels > .field:has(input[value=manual]:checked), .step-channels > .field:has(#ch-d-enabled:checked) { background: var(--selected); border-color: #a78bfa77; box-shadow: none; }\n.radio-card:hover { border-color: #a78bfa77; }\n.chan-badge { background: #12111d; border-color: var(--border); box-shadow: none; }\n.checklist li .mark, .light.off, .phase-badge, .sec-badge, .fx-external { background: #292432; color: var(--muted); }\n.checklist li.doing .mark { color: var(--void); background: var(--violet); }\n.checklist li.ok .mark, .light.green { color: var(--void); background: var(--green); }\n.light.red { background: var(--red); color: var(--void); }\n.light.amber { background: var(--gold); color: var(--void); }\n.modal-mask { background: #040408b8; }\n.modal { background: #10101a; border-color: #a78bfa40; box-shadow: 0 18px 70px #0008; }\n.modal .modal-close:hover { background: var(--selected); }\n.modal img.qr { background: #fff; color-scheme: light; }\n.spinner { border-color: #a78bfa33; border-top-color: var(--violet); }\n.nav-item:hover { background: #ffffff08; }\n.nav-item.active { background: var(--selected); color: var(--bone); box-shadow: inset 2px 0 var(--violet); }\n.nav-item.active svg { color: var(--violet); }\n.phase-badge { margin-left: auto; }\n.report-block:has(.state-badge) { background: linear-gradient(125deg, #211831, #0b0b13); border-color: #a78bfa44; }\n.update-hint { background: var(--selected); }\n.update-hint.done, .sec-set { background: var(--green-bg); color: var(--green); }\n.fx-reconnect, .sec-new { background: var(--selected); color: var(--violet); }\n.log-view { background: #090810; color: var(--bone); border-color: var(--border); }\n.step, .page { animation: aurora-enter .38s ease-out both; }\n@keyframes aurora-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }\n.aurora-motion-paused .step, .aurora-motion-paused .page { animation: none; }\n.aurora-motion-paused .tagline-slogan, .aurora-motion-paused .tagline-gloss { transition: none; opacity: 1; }\n@media (max-width: 960px) { .step h2, .page h2 { font-size: 29px; } .step-welcome h2 { font-size: 40px; } }\n@media (max-height: 660px) { .step-welcome h2 { font-size: 36px; margin-bottom: 14px; } .sidebar-kicker { margin-bottom: 18px; } }\n@media (max-width: 720px) { .sidebar-kicker { display: none; } .chrome-actions { gap: 9px; } .window-context { font-size: 11px; } }\n@media (max-width: 480px) { .window-purpose, .window-context { display: none; } .wiz-header, .console-header { gap: 10px; } }\n@media (prefers-reduced-motion: reduce) { .step, .page { animation: none; } }\n\n/* Production layout adapted from the approved installer preview. */\n:root { --muted: #b9aec6; --border: #a78bfa2e; --panel: #130e1d; --selected: #2c1e3a; }\n.wiz-header, .console-header, .wiz-footer { background: #0f0919d9; border-color: var(--border); }\n.wiz-sidebar, .console-sidebar { background: linear-gradient(180deg,#281733a6,#120c22ba); border-color: var(--border); }\n.wiz-body, .console-body { background: linear-gradient(130deg,#1d112a70,#0d0a1650); }\n.wiz-header::before, .console-header::before { content: \'\'; position: absolute; top: 0; left: 18%; right: 8%; height: 1px; background: var(--rainbow); opacity: .35; }\n.stepper-item { font-size: 13px; font-weight: 400; }\n.stepper-item.active .dot { background: #c4abea; color: var(--void); border-color: var(--violet); box-shadow: 0 0 0 4px #a78bfa18,0 0 22px #a78bfa33; }\n.stepper-item .dot { background: #1b1027; border-color: #a78bfa38; }\n.sidebar-kicker, .aurora-eyebrow { color: #b8a1d6; }\n.step { max-width: 1050px; }\n.step h2, .page h2 { font-size: 28px; font-weight: 200; }\n.step-heading { margin-bottom: 24px; }\n.step-provider .step-heading { margin-bottom: 14px; }\n.step-heading .step-sub { margin: 10px 0 0; line-height: 1.8; }\n.step-heading .aurora-eyebrow { margin-bottom: 10px; }\n.design-icon { width: 22px; height: 22px; flex: none; color: #c4abea; }\n.welcome-layout { display: grid; grid-template-columns: minmax(0,1.12fr) minmax(240px,.88fr); gap: 34px; align-items: start; }\n.welcome-copy { min-width: 0; }\n.step-welcome h2 { font-size: 39px; line-height: 1.45; margin: 14px 0 22px; }\n.step-welcome h2 em { background-image: linear-gradient(100deg,#ece8e1,#ccb7f2 55%,#f1c3db); }\n.welcome-lead { font-size: 14px; line-height: 1.95; color: var(--muted); margin: 0 0 24px; }\n.value-list { display: grid; gap: 17px; margin: 25px 0; }\n.value-item { display: flex; gap: 12px; align-items: flex-start; }\n.value-item > .design-icon { width: 18px; height: 18px; margin-top: 4px; }\n.value-item strong { font-size: 14px; font-weight: 500; }\n.value-item p { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 4px 0 0; }\n.welcome-art { padding: 25px 23px; border: 1px solid #a78bfa3d; border-radius: 13px; background: radial-gradient(ellipse at 70% 20%,#a78bfa2b,transparent 75%),linear-gradient(140deg,#38204490,#171125b3); box-shadow: 0 0 65px -22px #a78bfa40; }\n.art-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; gap: 12px; }\n.welcome-art h3 { font-size: 28px; font-weight: 200; line-height: 1.7; margin: 26px 0; }\n.example-window { padding: 15px; border: 1px solid #a78bfa35; border-radius: 10px; background: #100b1abf; box-shadow: 0 12px 40px #08040e55; transform: rotate(-1.5deg); }\n.example-title { display: flex; justify-content: space-between; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); font-size: 10px; color: var(--muted); }\n.example-title > span { font-size: 8px; white-space: nowrap; }\n.example-chat { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; }\n.example-chat.mine { justify-content: flex-end; }\n.example-bubble { padding: 9px 10px; border-radius: 8px; background: #06050c70; font-size: 11px; line-height: 1.85; }\n.mine .example-bubble { background: #a78bfa21; }\n.example-avatar { background: #a78bfa1c; color: #d2bcf5; border-radius: 5px; padding: 3px 6px; font-size: 11px; }\n.example-task { display: flex; align-items: center; gap: 7px; font-size: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 6px; margin: 15px 0 0 27px; }\n.example-task .design-icon { width: 14px; height: 14px; }\n.art-foot { color: var(--muted); font-size: 10px; line-height: 1.8; margin: 23px 0 0; }\n.design-details { border-top: 1px solid var(--border); margin: 17px 0; padding-top: 13px; font-size: 13px; }\n.design-details > summary { cursor: pointer; color: var(--muted); padding: 5px 0; overflow-wrap: anywhere; }\n.design-details > summary .chan-badge { vertical-align: middle; margin-right: 8px; }\n.design-details[open] > summary { margin-bottom: 16px; color: var(--bone); }\n.design-details .field { margin: 15px 0; }\n.welcome-settings { font-size: 11px; margin-top: 26px; }\n#w-directory-path { overflow-wrap: anywhere; margin-left: 6px; }\n.wiz-actions > .existing-panel { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 18px; align-items: center; margin: 0; padding: 12px 16px; line-height: 1.65; }\n.wiz-actions > .existing-panel > div { grid-column: 1; }\n.wiz-actions > .existing-panel > .actions { grid-column: 2; grid-row: 1 / span 2; margin: 0; }\n.wiz-actions > .existing-panel > div:nth-child(n+4) { grid-column: 1 / -1; }\n.existing-directory { overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }\n.existing-panel .actions .btn { white-space: nowrap; }\n.wiz-footer:has(.existing-panel:not([hidden])) .wiz-nav { display: none; }\n.welcome-settings .field > label { font-size: 13px; }\n.welcome-settings .hint { font-size: 12px; }\n.choice-stack { display: grid; gap: 12px; margin-bottom: 20px; }\n.choice-card, .service-option { border: 1px solid #a78bfa29; border-radius: 12px; background: linear-gradient(135deg,#251730a6,#140e2199); }\n.choice-card { padding: 19px 21px; color: var(--bone); text-align: left; width: 100%; cursor: pointer; transition: border-color .25s,background .25s; font: inherit; }\n.choice-card:hover { border-color: #a78bfa77; }\n.choice-card.selected, .service-option.selected { border-color: var(--violet); background: linear-gradient(130deg,#a78bfa26,#45254766); box-shadow: 0 0 0 1px #a78bfa18,0 0 30px #a78bfa13; }\n.service-option > .choice-card { background: transparent; border: 0; box-shadow: none; }\n.choice-top { display: flex; align-items: center; gap: 11px; font-size: 14px; }\n.choice-top strong { font-weight: 500; }\n.choice-badge { color: #d2bcf5; background: #a78bfa1c; border-radius: 5px; padding: 2px 7px; font-size: 10px; }\n.radio-mark { margin-left: auto; flex: none; width: 14px; height: 14px; border: 1px solid #a78bfa66; border-radius: 50%; }\n.selected .radio-mark { border: 4px solid var(--violet); }\n.choice-description { display: block; font-size: 12px; color: var(--muted); line-height: 1.85; margin-top: 10px; }\n.choice-description.hint { margin-top: 4px; font-size: 11px; }\n.service-option #p-free-block { padding: 0 21px 18px; border: 0; margin: 0; background: transparent; }\n.service-option #p-free-block > .hint { display: none; }\n#p-free-status { margin: 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--border); background: transparent; font-size: 12px; }\n#p-free-status[data-status=ok] { color: var(--green); }\n#p-paid { background: #130d1b99; border-color: var(--border); }\n.field > label { font-size: 14px; }\n.field .hint, .hint { font-size: 12px; }\n.field input, .field select, .field textarea { font-size: 14px; }\n.channel-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }\n.channel-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }\n.channel-options:has(details[open]) { grid-template-columns: 1fr; gap: 0; }\n.channel-options .design-details { margin-bottom: 0; }\n.channel-choice .chan-badge { background: #f3eff8; border-color: #c2b1cf; }\n.connection-preview { display: flex; align-items: center; gap: 18px; background: #a78bfa0e; padding: 17px 20px; border-radius: 9px; margin: 20px 0; }\n.connection-preview strong { font-size: 13px; font-weight: 500; }\n.connection-preview p { font-size: 12px; color: var(--muted); margin: 5px 0 0; }\n.skip-option { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); cursor: pointer; }\n.design-details .radio-row label { font-size: 13px; }\n.design-details .radio-row label .hint { font-size: 11px; }\n.persona-options { gap: 14px; }\n.persona-options .radio-card { position: relative; background: linear-gradient(135deg,#251730a6,#140e2199); padding: 16px 20px; margin-bottom: 0; }\n.persona-options .radio-card > input { position: absolute; right: 18px; top: 24px; }\n.persona-options .radio-card > .design-icon { width: 19px; height: 19px; vertical-align: middle; }\n.persona-options .radio-card > span { font-size: 14px; font-weight: 500 !important; margin-right: 18px; }\n.persona-options .radio-card > .hint { margin: 9px 0 0 !important; font-size: 12px; }\n.persona-example { border-top: 1px solid var(--border); margin: 10px 0 0; padding-top: 8px; color: #d2b5dd; font-size: 12px; line-height: 1.8; }\n.mode-section { display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--border); padding-top: 20px; margin-top: 22px; }\n.mode-section h3 { font-size: 16px; font-weight: 400; margin: 0 0 8px; }\n.mode-section p { font-size: 12px; line-height: 1.8; color: var(--muted); margin: 0; }\n.mode-section .mode-options { margin: 0; }\n.mode-options { display: flex; flex-wrap: wrap; gap: 9px; padding: 0; }\n.mode-options .radio-card { border-radius: 999px; padding: 9px 14px; }\n.mode-options .radio-card > span { font-size: 12px; }\n.mode-options .hint { display: none; }\n.face-layout { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(190px,.8fr); gap: 27px; }\n.face-aside { background: #a78bfa0e; border: 1px solid #a78bfa38; border-radius: 12px; padding: 25px; }\n.face-aside h3 { font-size: 26px; font-weight: 200; line-height: 1.8; }\n.face-aside p { font-size: 13px; color: var(--muted); line-height: 1.9; }\n.upload-choice { border-style: dashed; padding: 20px; min-width: 160px; border-radius: 10px; background: #a78bfa0a; }\n.summary-table { background: linear-gradient(135deg,#251730a6,#140e2199); }\n.summary-table td { overflow-wrap: anywhere; }\n.summary-table input { max-width: 100%; }\n.review-value { display: flex; gap: 16px; align-items: baseline; justify-content: space-between; }\n.review-value > span { min-width: 0; overflow-wrap: anywhere; }\n.text-action { border: 0; background: transparent; color: #ccb6f4; font-size: 12px; padding: 4px; cursor: pointer; flex: none; }\n.footer-note { margin-right: auto; color: var(--muted); font-size: 12px; align-self: center; }\n.wiz-nav { align-items: center; }\n.wiz-nav .btn { font-size: 14px; white-space: nowrap; }\n.first-message { background: #a78bfa10; border: 1px solid #a78bfa40; padding: 24px; border-radius: 12px; margin-bottom: 25px; }\n.first-message h3 { font-size: 19px; font-weight: 400; margin: 0 0 14px; }\n.first-message p { font-size: 13px; color: var(--muted); line-height: 1.9; }\n.copy-message { display: flex; align-items: center; gap: 12px; justify-content: space-between; background: #0d091599; border: 1px solid var(--border); padding: 12px; border-radius: 9px; }\n.message-sample { font-size: 14px; user-select: text; }\n.copy-message .btn { font-size: 12px; min-height: 32px; padding: 4px 12px; }\n#sc-details .report-version { font-size: 20px; }\n.step-install .checklist { border: 1px solid var(--border); background: #130d1b99; border-radius: 12px; padding: 20px 25px; }\n.runtime-welcome { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 24px; margin: 22px 0; background: radial-gradient(ellipse at 80% 35%,#a78bfa26,transparent 80%),linear-gradient(130deg,#33203e80,#1b102a80); border: 1px solid #a78bfa40; border-radius: 12px; }\n.runtime-welcome h3 { font-size: 18px; font-weight: 400; margin: 0 0 9px; }\n.runtime-welcome p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.9; }\n.runtime-welcome .btn { display: flex; align-items: center; gap: 10px; flex: none; white-space: nowrap; font-size: 13px; }\n.runtime-welcome .btn .design-icon { width: 17px; height: 17px; color: inherit; }\n.runtime-overview { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 24px 0; }\n.overview-card { min-width: 0; padding: 18px; background: linear-gradient(135deg,#251730a6,#140e2199); border: 1px solid #a78bfa29; border-radius: 10px; overflow-wrap: anywhere; }\n.overview-label { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); margin-bottom: 13px; }\n.overview-label .design-icon { width: 15px; height: 15px; }\n.overview-card > strong { font-size: 14px; font-weight: 500; display: block; line-height: 1.8; }\n.overview-card p { color: var(--muted); font-size: 11px; line-height: 1.8; }\n.overview-card .text-action { padding: 0; font-size: 11px; }\n.runtime-status-line { padding-top: 16px; border-top: 1px solid var(--border); }\n.runtime-status-line .state-badge { margin: 0 0 14px; }\n#runtime-details .report-version { font-size: 20px; }\n@media (max-height: 660px) and (min-width: 761px) {\n .step-welcome h2 { font-size: 32px; margin: 10px 0 15px; line-height: 1.35; }\n .welcome-lead { margin-bottom: 16px; }\n .value-list { margin: 18px 0; gap: 12px; }\n .welcome-settings { margin-top: 18px; }\n .welcome-art h3 { font-size: 24px; margin: 18px 0; line-height: 1.55; }\n .art-foot { margin-top: 16px; }\n}\n@media (max-width: 960px) {\n #app { grid-template-columns: 165px minmax(0,1fr); }\n .wiz-sidebar { padding: 26px 16px 20px; }\n .wiz-body { padding: 28px; }\n .wiz-footer { padding: 14px 28px; }\n .stepper-item { font-size: 12px; gap: 9px; }\n .welcome-layout { grid-template-columns: minmax(0,1fr) minmax(230px,.9fr); gap: 23px; }\n .step-welcome h2 { font-size: 33px; }\n .welcome-art { padding: 20px 16px; }\n .welcome-art h3 { font-size: 25px; }\n .welcome-lead { font-size: 13px; }\n .value-item strong { font-size: 13px; }\n .value-item p { font-size: 11px; }\n .choice-card { padding: 17px; }\n .choice-top { gap: 8px; }\n .footer-note { font-size: 11px; }\n}\n@media (max-width: 760px) {\n .welcome-layout, .face-layout { grid-template-columns: 1fr; }\n .welcome-art { max-width: 440px; }\n .mode-section { flex-direction: column; align-items: flex-start; }\n .channel-grid, .channel-options { grid-template-columns: 1fr; }\n .footer-note { display: none; }\n .runtime-welcome { flex-direction: column; align-items: flex-start; }\n .runtime-overview { grid-template-columns: 1fr; }\n}\n\n/* Native title-bar buttons sit inside the same 66px black-purple header. */\n[data-window-chrome] .wiz-header, [data-window-chrome] .console-header {\n background: #0f0919;\n -webkit-app-region: drag;\n user-select: none;\n}\n[data-window-chrome] .chrome-actions button, [data-window-chrome] header a {\n -webkit-app-region: no-drag;\n}\n[data-window-chrome=darwin] .wiz-header, [data-window-chrome=darwin] .console-header { padding-left: 104px; }\n[data-window-chrome=win32] .wiz-header, [data-window-chrome=win32] .console-header,\n[data-window-chrome=linux] .wiz-header, [data-window-chrome=linux] .console-header {\n padding-right: max(160px, calc(100vw - env(titlebar-area-width, 100vw) + 16px));\n}\n@media (max-width: 760px) {\n [data-window-chrome] .window-purpose { display: none; }\n}\n\n/* Existing-partner choices are always visible, including on a small window. */\n.wiz-actions > .existing-panel { display: block; padding: 10px 14px; }\n.wiz-actions > .existing-panel > .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }\n.existing-panel .existing-directory { font-size: 12px; overflow-wrap: anywhere; }\n.existing-panel .existing-directory select { max-width: 100%; margin-right: 8px; }\n.existing-panel .hint { font-size: 12px; margin-top: 5px; }\n\n.additional-platform { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; font-size: 13px; }\n.step-channels .connection-preview { margin: 8px 0; padding: 12px 18px; }\n.step-channels .channel-grid { margin-bottom: 8px; }\n\n/* Native buttons provide keyboard navigation for previously visited settings. */\nbutton.stepper-item { width: 100%; text-align: left; border: 0; border-radius: 4px; background: transparent; font-family: inherit; }\nbutton.stepper-item:disabled { cursor: default; opacity: 1; }\nbutton.stepper-item:not(:disabled) { cursor: pointer; }\nbutton.stepper-item:not(:disabled):hover { color: var(--bone); }\nbutton.stepper-item:focus-visible { outline: 2px solid var(--violet); outline-offset: 4px; }\n\n/* Chat uses final Aurora values; aliases do not alter existing pages. */\n:root {\n --mute: var(--muted);\n --teal: var(--green);\n --chat-bg: var(--void);\n --chat-surface: var(--panel);\n --chat-header: color-mix(in srgb, var(--void) 94%, transparent);\n --chat-bubble: color-mix(in srgb, var(--panel) 92%, var(--bone));\n --chat-user: color-mix(in srgb, var(--violet) 20%, var(--panel));\n --chat-line: var(--border);\n --chat-soft: color-mix(in srgb, var(--bone) 9%, transparent);\n --chat-faint: color-mix(in srgb, var(--bone) 45%, var(--void));\n --chat-elevated: color-mix(in srgb, var(--panel) 93%, var(--violet));\n --chat-avatar: color-mix(in srgb, var(--surface) 92%, var(--violet));\n --chat-glow: color-mix(in srgb, var(--violet) 10%, transparent);\n --chat-scrim: color-mix(in srgb, var(--void) 78%, transparent);\n --chat-shadow: color-mix(in srgb, var(--void) 85%, transparent);\n}\n\nhtml,body{height:100dvh} .web-login{position:fixed;inset:0;z-index:1000;background:#040408ed;display:grid;place-items:center}.web-login form{max-width:380px;padding:32px;border:1px solid var(--border);border-radius:20px;background:var(--panel)}.web-login input{width:100%;margin:20px 0;padding:12px;background:var(--void);color:var(--bone);border:1px solid var(--border);border-radius:9px}.web-terminal{max-width:850px}.web-terminal pre{height:50vh}.term-row{display:flex;gap:10px}.term-row input{flex:1;min-width:0;padding:12px;color:var(--bone);background:var(--panel);border:1px solid var(--border);border-radius:9px}</style></head>\n<body>\n <!-- \u6258\u76D8\u63A7\u5236\u53F0\uFF1A\u4FA7\u680F\uFF08\u72B6\u6001/\u901A\u9053/\u65E5\u5FD7 + \u4E8C\u671F\u5360\u4F4D\uFF09+ \u9875\u5BB9\u5668 -->\n <div id="console-app">\n <header class="console-header"><div class="wiz-title"><img class="engine-mark" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJnbG93IiB4MT0iOCIgeTE9IjgiIHgyPSI1MiIgeTI9IjUyIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agc3RvcC1jb2xvcj0iIzZlY2RmZiIvPjxzdG9wIG9mZnNldD0iLjM0IiBzdG9wLWNvbG9yPSIjYTc4YmZhIi8+PHN0b3Agb2Zmc2V0PSIuNjgiIHN0b3AtY29sb3I9IiNmZjZiOWQiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmZmNmOGEiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48Y2lyY2xlIGN4PSIxMiIgY3k9IjE3IiByPSI0LjUiIGZpbGw9InVybCgjZ2xvdykiLz48cGF0aCBkPSJNMjUgMTdoMjdMMjkgNTEiIHN0cm9rZT0idXJsKCNnbG93KSIgc3Ryb2tlLXdpZHRoPSI4IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4K" alt="" width="29" height="29"><span class="engine-wordmark" aria-label="Engine7 \xB7 \u6816">engine7<span class="brand-separator" aria-hidden="true">\xB7</span><span class="brand-qi" title="7\uFF0C\u4EA6\u662F\u300C\u6816\u300D">\u6816</span></span><span class="window-purpose">\u63A7\u5236\u53F0</span></div><div class="chrome-actions"><span class="window-context" aria-live="polite">\u4F19\u4F34\u7684\u65E5\u5E38\uFF0C\u5728\u8FD9\u91CC\u7EE7\u7EED</span><button class="aurora-motion" type="button" data-aurora-control aria-pressed="false" aria-label="\u5173\u95ED\u88C5\u9970\u52A8\u6548">\u25CC</button></div>\n </header>\n <aside class="sidebar">\n\n <!-- \u5355\u4F19\u4F34\u8EAB\u4EFD\u540D\u7247\uFF1B\u591A\u4F19\u4F34\u4F7F\u7528\u7D27\u51D1\u9009\u62E9\u5668\u3002 -->\n <div id="console-engines-slot" class="engine-picker"></div>\n <div id="console-nav-slot"></div><div class="sidebar-mark"><img class="engine-mark" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJnbG93IiB4MT0iOCIgeTE9IjgiIHgyPSI1MiIgeTI9IjUyIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agc3RvcC1jb2xvcj0iIzZlY2RmZiIvPjxzdG9wIG9mZnNldD0iLjM0IiBzdG9wLWNvbG9yPSIjYTc4YmZhIi8+PHN0b3Agb2Zmc2V0PSIuNjgiIHN0b3AtY29sb3I9IiNmZjZiOWQiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmZmNmOGEiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48Y2lyY2xlIGN4PSIxMiIgY3k9IjE3IiByPSI0LjUiIGZpbGw9InVybCgjZ2xvdykiLz48cGF0aCBkPSJNMjUgMTdoMjdMMjkgNTEiIHN0cm9rZT0idXJsKCNnbG93KSIgc3Ryb2tlLXdpZHRoPSI4IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4K" alt="" width="25" height="25">by TWINSUN</div>\n </aside>\n <div id="console-body-slot" class="console-body-slot"></div>\n </div>\n <div id="console-modal" class="modal-mask" hidden></div>\n <script>"use strict";\n(() => {\n var __create = Object.create;\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === "object" || typeof from === "function") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. "__esModule" has not been set), then set\n // "default" to the CommonJS "module.exports" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,\n mod\n ));\n\n // node_modules/qrcode/lib/can-promise.js\n var require_can_promise = __commonJS({\n "node_modules/qrcode/lib/can-promise.js"(exports, module) {\n module.exports = function() {\n return typeof Promise === "function" && Promise.prototype && Promise.prototype.then;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/utils.js\n var require_utils = __commonJS({\n "node_modules/qrcode/lib/core/utils.js"(exports) {\n var toSJISFunction;\n var CODEWORDS_COUNT = [\n 0,\n // Not used\n 26,\n 44,\n 70,\n 100,\n 134,\n 172,\n 196,\n 242,\n 292,\n 346,\n 404,\n 466,\n 532,\n 581,\n 655,\n 733,\n 815,\n 901,\n 991,\n 1085,\n 1156,\n 1258,\n 1364,\n 1474,\n 1588,\n 1706,\n 1828,\n 1921,\n 2051,\n 2185,\n 2323,\n 2465,\n 2611,\n 2761,\n 2876,\n 3034,\n 3196,\n 3362,\n 3532,\n 3706\n ];\n exports.getSymbolSize = function getSymbolSize(version) {\n if (!version) throw new Error(\'"version" cannot be null or undefined\');\n if (version < 1 || version > 40) throw new Error(\'"version" should be in range from 1 to 40\');\n return version * 4 + 17;\n };\n exports.getSymbolTotalCodewords = function getSymbolTotalCodewords(version) {\n return CODEWORDS_COUNT[version];\n };\n exports.getBCHDigit = function(data) {\n let digit = 0;\n while (data !== 0) {\n digit++;\n data >>>= 1;\n }\n return digit;\n };\n exports.setToSJISFunction = function setToSJISFunction(f) {\n if (typeof f !== "function") {\n throw new Error(\'"toSJISFunc" is not a valid function.\');\n }\n toSJISFunction = f;\n };\n exports.isKanjiModeEnabled = function() {\n return typeof toSJISFunction !== "undefined";\n };\n exports.toSJIS = function toSJIS(kanji) {\n return toSJISFunction(kanji);\n };\n }\n });\n\n // node_modules/qrcode/lib/core/error-correction-level.js\n var require_error_correction_level = __commonJS({\n "node_modules/qrcode/lib/core/error-correction-level.js"(exports) {\n exports.L = { bit: 1 };\n exports.M = { bit: 0 };\n exports.Q = { bit: 3 };\n exports.H = { bit: 2 };\n function fromString(string) {\n if (typeof string !== "string") {\n throw new Error("Param is not a string");\n }\n const lcStr = string.toLowerCase();\n switch (lcStr) {\n case "l":\n case "low":\n return exports.L;\n case "m":\n case "medium":\n return exports.M;\n case "q":\n case "quartile":\n return exports.Q;\n case "h":\n case "high":\n return exports.H;\n default:\n throw new Error("Unknown EC Level: " + string);\n }\n }\n exports.isValid = function isValid(level) {\n return level && typeof level.bit !== "undefined" && level.bit >= 0 && level.bit < 4;\n };\n exports.from = function from(value, defaultValue) {\n if (exports.isValid(value)) {\n return value;\n }\n try {\n return fromString(value);\n } catch (e) {\n return defaultValue;\n }\n };\n }\n });\n\n // node_modules/qrcode/lib/core/bit-buffer.js\n var require_bit_buffer = __commonJS({\n "node_modules/qrcode/lib/core/bit-buffer.js"(exports, module) {\n function BitBuffer() {\n this.buffer = [];\n this.length = 0;\n }\n BitBuffer.prototype = {\n get: function(index) {\n const bufIndex = Math.floor(index / 8);\n return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) === 1;\n },\n put: function(num, length) {\n for (let i = 0; i < length; i++) {\n this.putBit((num >>> length - i - 1 & 1) === 1);\n }\n },\n getLengthInBits: function() {\n return this.length;\n },\n putBit: function(bit) {\n const bufIndex = Math.floor(this.length / 8);\n if (this.buffer.length <= bufIndex) {\n this.buffer.push(0);\n }\n if (bit) {\n this.buffer[bufIndex] |= 128 >>> this.length % 8;\n }\n this.length++;\n }\n };\n module.exports = BitBuffer;\n }\n });\n\n // node_modules/qrcode/lib/core/bit-matrix.js\n var require_bit_matrix = __commonJS({\n "node_modules/qrcode/lib/core/bit-matrix.js"(exports, module) {\n function BitMatrix(size) {\n if (!size || size < 1) {\n throw new Error("BitMatrix size must be defined and greater than 0");\n }\n this.size = size;\n this.data = new Uint8Array(size * size);\n this.reservedBit = new Uint8Array(size * size);\n }\n BitMatrix.prototype.set = function(row, col, value, reserved) {\n const index = row * this.size + col;\n this.data[index] = value;\n if (reserved) this.reservedBit[index] = true;\n };\n BitMatrix.prototype.get = function(row, col) {\n return this.data[row * this.size + col];\n };\n BitMatrix.prototype.xor = function(row, col, value) {\n this.data[row * this.size + col] ^= value;\n };\n BitMatrix.prototype.isReserved = function(row, col) {\n return this.reservedBit[row * this.size + col];\n };\n module.exports = BitMatrix;\n }\n });\n\n // node_modules/qrcode/lib/core/alignment-pattern.js\n var require_alignment_pattern = __commonJS({\n "node_modules/qrcode/lib/core/alignment-pattern.js"(exports) {\n var getSymbolSize = require_utils().getSymbolSize;\n exports.getRowColCoords = function getRowColCoords(version) {\n if (version === 1) return [];\n const posCount = Math.floor(version / 7) + 2;\n const size = getSymbolSize(version);\n const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;\n const positions = [size - 7];\n for (let i = 1; i < posCount - 1; i++) {\n positions[i] = positions[i - 1] - intervals;\n }\n positions.push(6);\n return positions.reverse();\n };\n exports.getPositions = function getPositions(version) {\n const coords = [];\n const pos = exports.getRowColCoords(version);\n const posLength = pos.length;\n for (let i = 0; i < posLength; i++) {\n for (let j = 0; j < posLength; j++) {\n if (i === 0 && j === 0 || // top-left\n i === 0 && j === posLength - 1 || // bottom-left\n i === posLength - 1 && j === 0) {\n continue;\n }\n coords.push([pos[i], pos[j]]);\n }\n }\n return coords;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/finder-pattern.js\n var require_finder_pattern = __commonJS({\n "node_modules/qrcode/lib/core/finder-pattern.js"(exports) {\n var getSymbolSize = require_utils().getSymbolSize;\n var FINDER_PATTERN_SIZE = 7;\n exports.getPositions = function getPositions(version) {\n const size = getSymbolSize(version);\n return [\n // top-left\n [0, 0],\n // top-right\n [size - FINDER_PATTERN_SIZE, 0],\n // bottom-left\n [0, size - FINDER_PATTERN_SIZE]\n ];\n };\n }\n });\n\n // node_modules/qrcode/lib/core/mask-pattern.js\n var require_mask_pattern = __commonJS({\n "node_modules/qrcode/lib/core/mask-pattern.js"(exports) {\n exports.Patterns = {\n PATTERN000: 0,\n PATTERN001: 1,\n PATTERN010: 2,\n PATTERN011: 3,\n PATTERN100: 4,\n PATTERN101: 5,\n PATTERN110: 6,\n PATTERN111: 7\n };\n var PenaltyScores = {\n N1: 3,\n N2: 3,\n N3: 40,\n N4: 10\n };\n exports.isValid = function isValid(mask) {\n return mask != null && mask !== "" && !isNaN(mask) && mask >= 0 && mask <= 7;\n };\n exports.from = function from(value) {\n return exports.isValid(value) ? parseInt(value, 10) : void 0;\n };\n exports.getPenaltyN1 = function getPenaltyN1(data) {\n const size = data.size;\n let points = 0;\n let sameCountCol = 0;\n let sameCountRow = 0;\n let lastCol = null;\n let lastRow = null;\n for (let row = 0; row < size; row++) {\n sameCountCol = sameCountRow = 0;\n lastCol = lastRow = null;\n for (let col = 0; col < size; col++) {\n let module2 = data.get(row, col);\n if (module2 === lastCol) {\n sameCountCol++;\n } else {\n if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);\n lastCol = module2;\n sameCountCol = 1;\n }\n module2 = data.get(col, row);\n if (module2 === lastRow) {\n sameCountRow++;\n } else {\n if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);\n lastRow = module2;\n sameCountRow = 1;\n }\n }\n if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);\n if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);\n }\n return points;\n };\n exports.getPenaltyN2 = function getPenaltyN2(data) {\n const size = data.size;\n let points = 0;\n for (let row = 0; row < size - 1; row++) {\n for (let col = 0; col < size - 1; col++) {\n const last = data.get(row, col) + data.get(row, col + 1) + data.get(row + 1, col) + data.get(row + 1, col + 1);\n if (last === 4 || last === 0) points++;\n }\n }\n return points * PenaltyScores.N2;\n };\n exports.getPenaltyN3 = function getPenaltyN3(data) {\n const size = data.size;\n let points = 0;\n let bitsCol = 0;\n let bitsRow = 0;\n for (let row = 0; row < size; row++) {\n bitsCol = bitsRow = 0;\n for (let col = 0; col < size; col++) {\n bitsCol = bitsCol << 1 & 2047 | data.get(row, col);\n if (col >= 10 && (bitsCol === 1488 || bitsCol === 93)) points++;\n bitsRow = bitsRow << 1 & 2047 | data.get(col, row);\n if (col >= 10 && (bitsRow === 1488 || bitsRow === 93)) points++;\n }\n }\n return points * PenaltyScores.N3;\n };\n exports.getPenaltyN4 = function getPenaltyN4(data) {\n let darkCount = 0;\n const modulesCount = data.data.length;\n for (let i = 0; i < modulesCount; i++) darkCount += data.data[i];\n const k = Math.abs(Math.ceil(darkCount * 100 / modulesCount / 5) - 10);\n return k * PenaltyScores.N4;\n };\n function getMaskAt(maskPattern, i, j) {\n switch (maskPattern) {\n case exports.Patterns.PATTERN000:\n return (i + j) % 2 === 0;\n case exports.Patterns.PATTERN001:\n return i % 2 === 0;\n case exports.Patterns.PATTERN010:\n return j % 3 === 0;\n case exports.Patterns.PATTERN011:\n return (i + j) % 3 === 0;\n case exports.Patterns.PATTERN100:\n return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;\n case exports.Patterns.PATTERN101:\n return i * j % 2 + i * j % 3 === 0;\n case exports.Patterns.PATTERN110:\n return (i * j % 2 + i * j % 3) % 2 === 0;\n case exports.Patterns.PATTERN111:\n return (i * j % 3 + (i + j) % 2) % 2 === 0;\n default:\n throw new Error("bad maskPattern:" + maskPattern);\n }\n }\n exports.applyMask = function applyMask(pattern, data) {\n const size = data.size;\n for (let col = 0; col < size; col++) {\n for (let row = 0; row < size; row++) {\n if (data.isReserved(row, col)) continue;\n data.xor(row, col, getMaskAt(pattern, row, col));\n }\n }\n };\n exports.getBestMask = function getBestMask(data, setupFormatFunc) {\n const numPatterns = Object.keys(exports.Patterns).length;\n let bestPattern = 0;\n let lowerPenalty = Infinity;\n for (let p = 0; p < numPatterns; p++) {\n setupFormatFunc(p);\n exports.applyMask(p, data);\n const penalty = exports.getPenaltyN1(data) + exports.getPenaltyN2(data) + exports.getPenaltyN3(data) + exports.getPenaltyN4(data);\n exports.applyMask(p, data);\n if (penalty < lowerPenalty) {\n lowerPenalty = penalty;\n bestPattern = p;\n }\n }\n return bestPattern;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/error-correction-code.js\n var require_error_correction_code = __commonJS({\n "node_modules/qrcode/lib/core/error-correction-code.js"(exports) {\n var ECLevel = require_error_correction_level();\n var EC_BLOCKS_TABLE = [\n // L M Q H\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 2,\n 2,\n 1,\n 2,\n 2,\n 4,\n 1,\n 2,\n 4,\n 4,\n 2,\n 4,\n 4,\n 4,\n 2,\n 4,\n 6,\n 5,\n 2,\n 4,\n 6,\n 6,\n 2,\n 5,\n 8,\n 8,\n 4,\n 5,\n 8,\n 8,\n 4,\n 5,\n 8,\n 11,\n 4,\n 8,\n 10,\n 11,\n 4,\n 9,\n 12,\n 16,\n 4,\n 9,\n 16,\n 16,\n 6,\n 10,\n 12,\n 18,\n 6,\n 10,\n 17,\n 16,\n 6,\n 11,\n 16,\n 19,\n 6,\n 13,\n 18,\n 21,\n 7,\n 14,\n 21,\n 25,\n 8,\n 16,\n 20,\n 25,\n 8,\n 17,\n 23,\n 25,\n 9,\n 17,\n 23,\n 34,\n 9,\n 18,\n 25,\n 30,\n 10,\n 20,\n 27,\n 32,\n 12,\n 21,\n 29,\n 35,\n 12,\n 23,\n 34,\n 37,\n 12,\n 25,\n 34,\n 40,\n 13,\n 26,\n 35,\n 42,\n 14,\n 28,\n 38,\n 45,\n 15,\n 29,\n 40,\n 48,\n 16,\n 31,\n 43,\n 51,\n 17,\n 33,\n 45,\n 54,\n 18,\n 35,\n 48,\n 57,\n 19,\n 37,\n 51,\n 60,\n 19,\n 38,\n 53,\n 63,\n 20,\n 40,\n 56,\n 66,\n 21,\n 43,\n 59,\n 70,\n 22,\n 45,\n 62,\n 74,\n 24,\n 47,\n 65,\n 77,\n 25,\n 49,\n 68,\n 81\n ];\n var EC_CODEWORDS_TABLE = [\n // L M Q H\n 7,\n 10,\n 13,\n 17,\n 10,\n 16,\n 22,\n 28,\n 15,\n 26,\n 36,\n 44,\n 20,\n 36,\n 52,\n 64,\n 26,\n 48,\n 72,\n 88,\n 36,\n 64,\n 96,\n 112,\n 40,\n 72,\n 108,\n 130,\n 48,\n 88,\n 132,\n 156,\n 60,\n 110,\n 160,\n 192,\n 72,\n 130,\n 192,\n 224,\n 80,\n 150,\n 224,\n 264,\n 96,\n 176,\n 260,\n 308,\n 104,\n 198,\n 288,\n 352,\n 120,\n 216,\n 320,\n 384,\n 132,\n 240,\n 360,\n 432,\n 144,\n 280,\n 408,\n 480,\n 168,\n 308,\n 448,\n 532,\n 180,\n 338,\n 504,\n 588,\n 196,\n 364,\n 546,\n 650,\n 224,\n 416,\n 600,\n 700,\n 224,\n 442,\n 644,\n 750,\n 252,\n 476,\n 690,\n 816,\n 270,\n 504,\n 750,\n 900,\n 300,\n 560,\n 810,\n 960,\n 312,\n 588,\n 870,\n 1050,\n 336,\n 644,\n 952,\n 1110,\n 360,\n 700,\n 1020,\n 1200,\n 390,\n 728,\n 1050,\n 1260,\n 420,\n 784,\n 1140,\n 1350,\n 450,\n 812,\n 1200,\n 1440,\n 480,\n 868,\n 1290,\n 1530,\n 510,\n 924,\n 1350,\n 1620,\n 540,\n 980,\n 1440,\n 1710,\n 570,\n 1036,\n 1530,\n 1800,\n 570,\n 1064,\n 1590,\n 1890,\n 600,\n 1120,\n 1680,\n 1980,\n 630,\n 1204,\n 1770,\n 2100,\n 660,\n 1260,\n 1860,\n 2220,\n 720,\n 1316,\n 1950,\n 2310,\n 750,\n 1372,\n 2040,\n 2430\n ];\n exports.getBlocksCount = function getBlocksCount(version, errorCorrectionLevel) {\n switch (errorCorrectionLevel) {\n case ECLevel.L:\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 0];\n case ECLevel.M:\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 1];\n case ECLevel.Q:\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 2];\n case ECLevel.H:\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 3];\n default:\n return void 0;\n }\n };\n exports.getTotalCodewordsCount = function getTotalCodewordsCount(version, errorCorrectionLevel) {\n switch (errorCorrectionLevel) {\n case ECLevel.L:\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0];\n case ECLevel.M:\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1];\n case ECLevel.Q:\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2];\n case ECLevel.H:\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3];\n default:\n return void 0;\n }\n };\n }\n });\n\n // node_modules/qrcode/lib/core/galois-field.js\n var require_galois_field = __commonJS({\n "node_modules/qrcode/lib/core/galois-field.js"(exports) {\n var EXP_TABLE = new Uint8Array(512);\n var LOG_TABLE = new Uint8Array(256);\n (function initTables() {\n let x = 1;\n for (let i = 0; i < 255; i++) {\n EXP_TABLE[i] = x;\n LOG_TABLE[x] = i;\n x <<= 1;\n if (x & 256) {\n x ^= 285;\n }\n }\n for (let i = 255; i < 512; i++) {\n EXP_TABLE[i] = EXP_TABLE[i - 255];\n }\n })();\n exports.log = function log(n) {\n if (n < 1) throw new Error("log(" + n + ")");\n return LOG_TABLE[n];\n };\n exports.exp = function exp(n) {\n return EXP_TABLE[n];\n };\n exports.mul = function mul(x, y) {\n if (x === 0 || y === 0) return 0;\n return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]];\n };\n }\n });\n\n // node_modules/qrcode/lib/core/polynomial.js\n var require_polynomial = __commonJS({\n "node_modules/qrcode/lib/core/polynomial.js"(exports) {\n var GF = require_galois_field();\n exports.mul = function mul(p1, p2) {\n const coeff = new Uint8Array(p1.length + p2.length - 1);\n for (let i = 0; i < p1.length; i++) {\n for (let j = 0; j < p2.length; j++) {\n coeff[i + j] ^= GF.mul(p1[i], p2[j]);\n }\n }\n return coeff;\n };\n exports.mod = function mod(divident, divisor) {\n let result = new Uint8Array(divident);\n while (result.length - divisor.length >= 0) {\n const coeff = result[0];\n for (let i = 0; i < divisor.length; i++) {\n result[i] ^= GF.mul(divisor[i], coeff);\n }\n let offset = 0;\n while (offset < result.length && result[offset] === 0) offset++;\n result = result.slice(offset);\n }\n return result;\n };\n exports.generateECPolynomial = function generateECPolynomial(degree) {\n let poly = new Uint8Array([1]);\n for (let i = 0; i < degree; i++) {\n poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]));\n }\n return poly;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/reed-solomon-encoder.js\n var require_reed_solomon_encoder = __commonJS({\n "node_modules/qrcode/lib/core/reed-solomon-encoder.js"(exports, module) {\n var Polynomial = require_polynomial();\n function ReedSolomonEncoder(degree) {\n this.genPoly = void 0;\n this.degree = degree;\n if (this.degree) this.initialize(this.degree);\n }\n ReedSolomonEncoder.prototype.initialize = function initialize(degree) {\n this.degree = degree;\n this.genPoly = Polynomial.generateECPolynomial(this.degree);\n };\n ReedSolomonEncoder.prototype.encode = function encode(data) {\n if (!this.genPoly) {\n throw new Error("Encoder not initialized");\n }\n const paddedData = new Uint8Array(data.length + this.degree);\n paddedData.set(data);\n const remainder = Polynomial.mod(paddedData, this.genPoly);\n const start = this.degree - remainder.length;\n if (start > 0) {\n const buff = new Uint8Array(this.degree);\n buff.set(remainder, start);\n return buff;\n }\n return remainder;\n };\n module.exports = ReedSolomonEncoder;\n }\n });\n\n // node_modules/qrcode/lib/core/version-check.js\n var require_version_check = __commonJS({\n "node_modules/qrcode/lib/core/version-check.js"(exports) {\n exports.isValid = function isValid(version) {\n return !isNaN(version) && version >= 1 && version <= 40;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/regex.js\n var require_regex = __commonJS({\n "node_modules/qrcode/lib/core/regex.js"(exports) {\n var numeric = "[0-9]+";\n var alphanumeric = "[A-Z $%*+\\\\-./:]+";\n var kanji = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";\n kanji = kanji.replace(/u/g, "\\\\u");\n var byte = "(?:(?![A-Z0-9 $%*+\\\\-./:]|" + kanji + ")(?:.|[\\r\\n]))+";\n exports.KANJI = new RegExp(kanji, "g");\n exports.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\\\-./:]+", "g");\n exports.BYTE = new RegExp(byte, "g");\n exports.NUMERIC = new RegExp(numeric, "g");\n exports.ALPHANUMERIC = new RegExp(alphanumeric, "g");\n var TEST_KANJI = new RegExp("^" + kanji + "$");\n var TEST_NUMERIC = new RegExp("^" + numeric + "$");\n var TEST_ALPHANUMERIC = new RegExp("^[A-Z0-9 $%*+\\\\-./:]+$");\n exports.testKanji = function testKanji(str) {\n return TEST_KANJI.test(str);\n };\n exports.testNumeric = function testNumeric(str) {\n return TEST_NUMERIC.test(str);\n };\n exports.testAlphanumeric = function testAlphanumeric(str) {\n return TEST_ALPHANUMERIC.test(str);\n };\n }\n });\n\n // node_modules/qrcode/lib/core/mode.js\n var require_mode = __commonJS({\n "node_modules/qrcode/lib/core/mode.js"(exports) {\n var VersionCheck = require_version_check();\n var Regex = require_regex();\n exports.NUMERIC = {\n id: "Numeric",\n bit: 1 << 0,\n ccBits: [10, 12, 14]\n };\n exports.ALPHANUMERIC = {\n id: "Alphanumeric",\n bit: 1 << 1,\n ccBits: [9, 11, 13]\n };\n exports.BYTE = {\n id: "Byte",\n bit: 1 << 2,\n ccBits: [8, 16, 16]\n };\n exports.KANJI = {\n id: "Kanji",\n bit: 1 << 3,\n ccBits: [8, 10, 12]\n };\n exports.MIXED = {\n bit: -1\n };\n exports.getCharCountIndicator = function getCharCountIndicator(mode, version) {\n if (!mode.ccBits) throw new Error("Invalid mode: " + mode);\n if (!VersionCheck.isValid(version)) {\n throw new Error("Invalid version: " + version);\n }\n if (version >= 1 && version < 10) return mode.ccBits[0];\n else if (version < 27) return mode.ccBits[1];\n return mode.ccBits[2];\n };\n exports.getBestModeForData = function getBestModeForData(dataStr) {\n if (Regex.testNumeric(dataStr)) return exports.NUMERIC;\n else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC;\n else if (Regex.testKanji(dataStr)) return exports.KANJI;\n else return exports.BYTE;\n };\n exports.toString = function toString(mode) {\n if (mode && mode.id) return mode.id;\n throw new Error("Invalid mode");\n };\n exports.isValid = function isValid(mode) {\n return mode && mode.bit && mode.ccBits;\n };\n function fromString(string) {\n if (typeof string !== "string") {\n throw new Error("Param is not a string");\n }\n const lcStr = string.toLowerCase();\n switch (lcStr) {\n case "numeric":\n return exports.NUMERIC;\n case "alphanumeric":\n return exports.ALPHANUMERIC;\n case "kanji":\n return exports.KANJI;\n case "byte":\n return exports.BYTE;\n default:\n throw new Error("Unknown mode: " + string);\n }\n }\n exports.from = function from(value, defaultValue) {\n if (exports.isValid(value)) {\n return value;\n }\n try {\n return fromString(value);\n } catch (e) {\n return defaultValue;\n }\n };\n }\n });\n\n // node_modules/qrcode/lib/core/version.js\n var require_version = __commonJS({\n "node_modules/qrcode/lib/core/version.js"(exports) {\n var Utils = require_utils();\n var ECCode = require_error_correction_code();\n var ECLevel = require_error_correction_level();\n var Mode = require_mode();\n var VersionCheck = require_version_check();\n var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;\n var G18_BCH = Utils.getBCHDigit(G18);\n function getBestVersionForDataLength(mode, length, errorCorrectionLevel) {\n for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {\n if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {\n return currentVersion;\n }\n }\n return void 0;\n }\n function getReservedBitsCount(mode, version) {\n return Mode.getCharCountIndicator(mode, version) + 4;\n }\n function getTotalBitsFromDataArray(segments, version) {\n let totalBits = 0;\n segments.forEach(function(data) {\n const reservedBits = getReservedBitsCount(data.mode, version);\n totalBits += reservedBits + data.getBitsLength();\n });\n return totalBits;\n }\n function getBestVersionForMixedData(segments, errorCorrectionLevel) {\n for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {\n const length = getTotalBitsFromDataArray(segments, currentVersion);\n if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {\n return currentVersion;\n }\n }\n return void 0;\n }\n exports.from = function from(value, defaultValue) {\n if (VersionCheck.isValid(value)) {\n return parseInt(value, 10);\n }\n return defaultValue;\n };\n exports.getCapacity = function getCapacity(version, errorCorrectionLevel, mode) {\n if (!VersionCheck.isValid(version)) {\n throw new Error("Invalid QR Code version");\n }\n if (typeof mode === "undefined") mode = Mode.BYTE;\n const totalCodewords = Utils.getSymbolTotalCodewords(version);\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);\n const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;\n if (mode === Mode.MIXED) return dataTotalCodewordsBits;\n const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version);\n switch (mode) {\n case Mode.NUMERIC:\n return Math.floor(usableBits / 10 * 3);\n case Mode.ALPHANUMERIC:\n return Math.floor(usableBits / 11 * 2);\n case Mode.KANJI:\n return Math.floor(usableBits / 13);\n case Mode.BYTE:\n default:\n return Math.floor(usableBits / 8);\n }\n };\n exports.getBestVersionForData = function getBestVersionForData(data, errorCorrectionLevel) {\n let seg;\n const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M);\n if (Array.isArray(data)) {\n if (data.length > 1) {\n return getBestVersionForMixedData(data, ecl);\n }\n if (data.length === 0) {\n return 1;\n }\n seg = data[0];\n } else {\n seg = data;\n }\n return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl);\n };\n exports.getEncodedBits = function getEncodedBits(version) {\n if (!VersionCheck.isValid(version) || version < 7) {\n throw new Error("Invalid QR Code version");\n }\n let d = version << 12;\n while (Utils.getBCHDigit(d) - G18_BCH >= 0) {\n d ^= G18 << Utils.getBCHDigit(d) - G18_BCH;\n }\n return version << 12 | d;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/format-info.js\n var require_format_info = __commonJS({\n "node_modules/qrcode/lib/core/format-info.js"(exports) {\n var Utils = require_utils();\n var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;\n var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;\n var G15_BCH = Utils.getBCHDigit(G15);\n exports.getEncodedBits = function getEncodedBits(errorCorrectionLevel, mask) {\n const data = errorCorrectionLevel.bit << 3 | mask;\n let d = data << 10;\n while (Utils.getBCHDigit(d) - G15_BCH >= 0) {\n d ^= G15 << Utils.getBCHDigit(d) - G15_BCH;\n }\n return (data << 10 | d) ^ G15_MASK;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/numeric-data.js\n var require_numeric_data = __commonJS({\n "node_modules/qrcode/lib/core/numeric-data.js"(exports, module) {\n var Mode = require_mode();\n function NumericData(data) {\n this.mode = Mode.NUMERIC;\n this.data = data.toString();\n }\n NumericData.getBitsLength = function getBitsLength(length) {\n return 10 * Math.floor(length / 3) + (length % 3 ? length % 3 * 3 + 1 : 0);\n };\n NumericData.prototype.getLength = function getLength() {\n return this.data.length;\n };\n NumericData.prototype.getBitsLength = function getBitsLength() {\n return NumericData.getBitsLength(this.data.length);\n };\n NumericData.prototype.write = function write(bitBuffer) {\n let i, group, value;\n for (i = 0; i + 3 <= this.data.length; i += 3) {\n group = this.data.substr(i, 3);\n value = parseInt(group, 10);\n bitBuffer.put(value, 10);\n }\n const remainingNum = this.data.length - i;\n if (remainingNum > 0) {\n group = this.data.substr(i);\n value = parseInt(group, 10);\n bitBuffer.put(value, remainingNum * 3 + 1);\n }\n };\n module.exports = NumericData;\n }\n });\n\n // node_modules/qrcode/lib/core/alphanumeric-data.js\n var require_alphanumeric_data = __commonJS({\n "node_modules/qrcode/lib/core/alphanumeric-data.js"(exports, module) {\n var Mode = require_mode();\n var ALPHA_NUM_CHARS = [\n "0",\n "1",\n "2",\n "3",\n "4",\n "5",\n "6",\n "7",\n "8",\n "9",\n "A",\n "B",\n "C",\n "D",\n "E",\n "F",\n "G",\n "H",\n "I",\n "J",\n "K",\n "L",\n "M",\n "N",\n "O",\n "P",\n "Q",\n "R",\n "S",\n "T",\n "U",\n "V",\n "W",\n "X",\n "Y",\n "Z",\n " ",\n "$",\n "%",\n "*",\n "+",\n "-",\n ".",\n "/",\n ":"\n ];\n function AlphanumericData(data) {\n this.mode = Mode.ALPHANUMERIC;\n this.data = data;\n }\n AlphanumericData.getBitsLength = function getBitsLength(length) {\n return 11 * Math.floor(length / 2) + 6 * (length % 2);\n };\n AlphanumericData.prototype.getLength = function getLength() {\n return this.data.length;\n };\n AlphanumericData.prototype.getBitsLength = function getBitsLength() {\n return AlphanumericData.getBitsLength(this.data.length);\n };\n AlphanumericData.prototype.write = function write(bitBuffer) {\n let i;\n for (i = 0; i + 2 <= this.data.length; i += 2) {\n let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45;\n value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]);\n bitBuffer.put(value, 11);\n }\n if (this.data.length % 2) {\n bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6);\n }\n };\n module.exports = AlphanumericData;\n }\n });\n\n // node_modules/qrcode/lib/core/byte-data.js\n var require_byte_data = __commonJS({\n "node_modules/qrcode/lib/core/byte-data.js"(exports, module) {\n var Mode = require_mode();\n function ByteData(data) {\n this.mode = Mode.BYTE;\n if (typeof data === "string") {\n this.data = new TextEncoder().encode(data);\n } else {\n this.data = new Uint8Array(data);\n }\n }\n ByteData.getBitsLength = function getBitsLength(length) {\n return length * 8;\n };\n ByteData.prototype.getLength = function getLength() {\n return this.data.length;\n };\n ByteData.prototype.getBitsLength = function getBitsLength() {\n return ByteData.getBitsLength(this.data.length);\n };\n ByteData.prototype.write = function(bitBuffer) {\n for (let i = 0, l = this.data.length; i < l; i++) {\n bitBuffer.put(this.data[i], 8);\n }\n };\n module.exports = ByteData;\n }\n });\n\n // node_modules/qrcode/lib/core/kanji-data.js\n var require_kanji_data = __commonJS({\n "node_modules/qrcode/lib/core/kanji-data.js"(exports, module) {\n var Mode = require_mode();\n var Utils = require_utils();\n function KanjiData(data) {\n this.mode = Mode.KANJI;\n this.data = data;\n }\n KanjiData.getBitsLength = function getBitsLength(length) {\n return length * 13;\n };\n KanjiData.prototype.getLength = function getLength() {\n return this.data.length;\n };\n KanjiData.prototype.getBitsLength = function getBitsLength() {\n return KanjiData.getBitsLength(this.data.length);\n };\n KanjiData.prototype.write = function(bitBuffer) {\n let i;\n for (i = 0; i < this.data.length; i++) {\n let value = Utils.toSJIS(this.data[i]);\n if (value >= 33088 && value <= 40956) {\n value -= 33088;\n } else if (value >= 57408 && value <= 60351) {\n value -= 49472;\n } else {\n throw new Error(\n "Invalid SJIS character: " + this.data[i] + "\\nMake sure your charset is UTF-8"\n );\n }\n value = (value >>> 8 & 255) * 192 + (value & 255);\n bitBuffer.put(value, 13);\n }\n };\n module.exports = KanjiData;\n }\n });\n\n // node_modules/dijkstrajs/dijkstra.js\n var require_dijkstra = __commonJS({\n "node_modules/dijkstrajs/dijkstra.js"(exports, module) {\n "use strict";\n var dijkstra = {\n single_source_shortest_paths: function(graph, s, d) {\n var predecessors = {};\n var costs = {};\n costs[s] = 0;\n var open = dijkstra.PriorityQueue.make();\n open.push(s, 0);\n var closest, u, v, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit;\n while (!open.empty()) {\n closest = open.pop();\n u = closest.value;\n cost_of_s_to_u = closest.cost;\n adjacent_nodes = graph[u] || {};\n for (v in adjacent_nodes) {\n if (adjacent_nodes.hasOwnProperty(v)) {\n cost_of_e = adjacent_nodes[v];\n cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;\n cost_of_s_to_v = costs[v];\n first_visit = typeof costs[v] === "undefined";\n if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {\n costs[v] = cost_of_s_to_u_plus_cost_of_e;\n open.push(v, cost_of_s_to_u_plus_cost_of_e);\n predecessors[v] = u;\n }\n }\n }\n }\n if (typeof d !== "undefined" && typeof costs[d] === "undefined") {\n var msg = ["Could not find a path from ", s, " to ", d, "."].join("");\n throw new Error(msg);\n }\n return predecessors;\n },\n extract_shortest_path_from_predecessor_list: function(predecessors, d) {\n var nodes = [];\n var u = d;\n var predecessor;\n while (u) {\n nodes.push(u);\n predecessor = predecessors[u];\n u = predecessors[u];\n }\n nodes.reverse();\n return nodes;\n },\n find_path: function(graph, s, d) {\n var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);\n return dijkstra.extract_shortest_path_from_predecessor_list(\n predecessors,\n d\n );\n },\n /**\n * A very naive priority queue implementation.\n */\n PriorityQueue: {\n make: function(opts) {\n var T = dijkstra.PriorityQueue, t = {}, key;\n opts = opts || {};\n for (key in T) {\n if (T.hasOwnProperty(key)) {\n t[key] = T[key];\n }\n }\n t.queue = [];\n t.sorter = opts.sorter || T.default_sorter;\n return t;\n },\n default_sorter: function(a, b) {\n return a.cost - b.cost;\n },\n /**\n * Add a new item to the queue and ensure the highest priority element\n * is at the front of the queue.\n */\n push: function(value, cost) {\n var item = { value, cost };\n this.queue.push(item);\n this.queue.sort(this.sorter);\n },\n /**\n * Return the highest priority element in the queue.\n */\n pop: function() {\n return this.queue.shift();\n },\n empty: function() {\n return this.queue.length === 0;\n }\n }\n };\n if (typeof module !== "undefined") {\n module.exports = dijkstra;\n }\n }\n });\n\n // node_modules/qrcode/lib/core/segments.js\n var require_segments = __commonJS({\n "node_modules/qrcode/lib/core/segments.js"(exports) {\n var Mode = require_mode();\n var NumericData = require_numeric_data();\n var AlphanumericData = require_alphanumeric_data();\n var ByteData = require_byte_data();\n var KanjiData = require_kanji_data();\n var Regex = require_regex();\n var Utils = require_utils();\n var dijkstra = require_dijkstra();\n function getStringByteLength(str) {\n return unescape(encodeURIComponent(str)).length;\n }\n function getSegments(regex, mode, str) {\n const segments = [];\n let result;\n while ((result = regex.exec(str)) !== null) {\n segments.push({\n data: result[0],\n index: result.index,\n mode,\n length: result[0].length\n });\n }\n return segments;\n }\n function getSegmentsFromString(dataStr) {\n const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr);\n const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr);\n let byteSegs;\n let kanjiSegs;\n if (Utils.isKanjiModeEnabled()) {\n byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr);\n kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr);\n } else {\n byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr);\n kanjiSegs = [];\n }\n const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs);\n return segs.sort(function(s1, s2) {\n return s1.index - s2.index;\n }).map(function(obj) {\n return {\n data: obj.data,\n mode: obj.mode,\n length: obj.length\n };\n });\n }\n function getSegmentBitsLength(length, mode) {\n switch (mode) {\n case Mode.NUMERIC:\n return NumericData.getBitsLength(length);\n case Mode.ALPHANUMERIC:\n return AlphanumericData.getBitsLength(length);\n case Mode.KANJI:\n return KanjiData.getBitsLength(length);\n case Mode.BYTE:\n return ByteData.getBitsLength(length);\n }\n }\n function mergeSegments(segs) {\n return segs.reduce(function(acc, curr) {\n const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;\n if (prevSeg && prevSeg.mode === curr.mode) {\n acc[acc.length - 1].data += curr.data;\n return acc;\n }\n acc.push(curr);\n return acc;\n }, []);\n }\n function buildNodes(segs) {\n const nodes = [];\n for (let i = 0; i < segs.length; i++) {\n const seg = segs[i];\n switch (seg.mode) {\n case Mode.NUMERIC:\n nodes.push([\n seg,\n { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },\n { data: seg.data, mode: Mode.BYTE, length: seg.length }\n ]);\n break;\n case Mode.ALPHANUMERIC:\n nodes.push([\n seg,\n { data: seg.data, mode: Mode.BYTE, length: seg.length }\n ]);\n break;\n case Mode.KANJI:\n nodes.push([\n seg,\n { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }\n ]);\n break;\n case Mode.BYTE:\n nodes.push([\n { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }\n ]);\n }\n }\n return nodes;\n }\n function buildGraph(nodes, version) {\n const table = {};\n const graph = { start: {} };\n let prevNodeIds = ["start"];\n for (let i = 0; i < nodes.length; i++) {\n const nodeGroup = nodes[i];\n const currentNodeIds = [];\n for (let j = 0; j < nodeGroup.length; j++) {\n const node = nodeGroup[j];\n const key = "" + i + j;\n currentNodeIds.push(key);\n table[key] = { node, lastCount: 0 };\n graph[key] = {};\n for (let n = 0; n < prevNodeIds.length; n++) {\n const prevNodeId = prevNodeIds[n];\n if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {\n graph[prevNodeId][key] = getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) - getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);\n table[prevNodeId].lastCount += node.length;\n } else {\n if (table[prevNodeId]) table[prevNodeId].lastCount = node.length;\n graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) + 4 + Mode.getCharCountIndicator(node.mode, version);\n }\n }\n }\n prevNodeIds = currentNodeIds;\n }\n for (let n = 0; n < prevNodeIds.length; n++) {\n graph[prevNodeIds[n]].end = 0;\n }\n return { map: graph, table };\n }\n function buildSingleSegment(data, modesHint) {\n let mode;\n const bestMode = Mode.getBestModeForData(data);\n mode = Mode.from(modesHint, bestMode);\n if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {\n throw new Error(\'"\' + data + \'" cannot be encoded with mode \' + Mode.toString(mode) + ".\\n Suggested mode is: " + Mode.toString(bestMode));\n }\n if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {\n mode = Mode.BYTE;\n }\n switch (mode) {\n case Mode.NUMERIC:\n return new NumericData(data);\n case Mode.ALPHANUMERIC:\n return new AlphanumericData(data);\n case Mode.KANJI:\n return new KanjiData(data);\n case Mode.BYTE:\n return new ByteData(data);\n }\n }\n exports.fromArray = function fromArray(array) {\n return array.reduce(function(acc, seg) {\n if (typeof seg === "string") {\n acc.push(buildSingleSegment(seg, null));\n } else if (seg.data) {\n acc.push(buildSingleSegment(seg.data, seg.mode));\n }\n return acc;\n }, []);\n };\n exports.fromString = function fromString(data, version) {\n const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());\n const nodes = buildNodes(segs);\n const graph = buildGraph(nodes, version);\n const path = dijkstra.find_path(graph.map, "start", "end");\n const optimizedSegs = [];\n for (let i = 1; i < path.length - 1; i++) {\n optimizedSegs.push(graph.table[path[i]].node);\n }\n return exports.fromArray(mergeSegments(optimizedSegs));\n };\n exports.rawSplit = function rawSplit(data) {\n return exports.fromArray(\n getSegmentsFromString(data, Utils.isKanjiModeEnabled())\n );\n };\n }\n });\n\n // node_modules/qrcode/lib/core/qrcode.js\n var require_qrcode = __commonJS({\n "node_modules/qrcode/lib/core/qrcode.js"(exports) {\n var Utils = require_utils();\n var ECLevel = require_error_correction_level();\n var BitBuffer = require_bit_buffer();\n var BitMatrix = require_bit_matrix();\n var AlignmentPattern = require_alignment_pattern();\n var FinderPattern = require_finder_pattern();\n var MaskPattern = require_mask_pattern();\n var ECCode = require_error_correction_code();\n var ReedSolomonEncoder = require_reed_solomon_encoder();\n var Version = require_version();\n var FormatInfo = require_format_info();\n var Mode = require_mode();\n var Segments = require_segments();\n function setupFinderPattern(matrix, version) {\n const size = matrix.size;\n const pos = FinderPattern.getPositions(version);\n for (let i = 0; i < pos.length; i++) {\n const row = pos[i][0];\n const col = pos[i][1];\n for (let r = -1; r <= 7; r++) {\n if (row + r <= -1 || size <= row + r) continue;\n for (let c = -1; c <= 7; c++) {\n if (col + c <= -1 || size <= col + c) continue;\n if (r >= 0 && r <= 6 && (c === 0 || c === 6) || c >= 0 && c <= 6 && (r === 0 || r === 6) || r >= 2 && r <= 4 && c >= 2 && c <= 4) {\n matrix.set(row + r, col + c, true, true);\n } else {\n matrix.set(row + r, col + c, false, true);\n }\n }\n }\n }\n }\n function setupTimingPattern(matrix) {\n const size = matrix.size;\n for (let r = 8; r < size - 8; r++) {\n const value = r % 2 === 0;\n matrix.set(r, 6, value, true);\n matrix.set(6, r, value, true);\n }\n }\n function setupAlignmentPattern(matrix, version) {\n const pos = AlignmentPattern.getPositions(version);\n for (let i = 0; i < pos.length; i++) {\n const row = pos[i][0];\n const col = pos[i][1];\n for (let r = -2; r <= 2; r++) {\n for (let c = -2; c <= 2; c++) {\n if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) {\n matrix.set(row + r, col + c, true, true);\n } else {\n matrix.set(row + r, col + c, false, true);\n }\n }\n }\n }\n }\n function setupVersionInfo(matrix, version) {\n const size = matrix.size;\n const bits = Version.getEncodedBits(version);\n let row, col, mod;\n for (let i = 0; i < 18; i++) {\n row = Math.floor(i / 3);\n col = i % 3 + size - 8 - 3;\n mod = (bits >> i & 1) === 1;\n matrix.set(row, col, mod, true);\n matrix.set(col, row, mod, true);\n }\n }\n function setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) {\n const size = matrix.size;\n const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);\n let i, mod;\n for (i = 0; i < 15; i++) {\n mod = (bits >> i & 1) === 1;\n if (i < 6) {\n matrix.set(i, 8, mod, true);\n } else if (i < 8) {\n matrix.set(i + 1, 8, mod, true);\n } else {\n matrix.set(size - 15 + i, 8, mod, true);\n }\n if (i < 8) {\n matrix.set(8, size - i - 1, mod, true);\n } else if (i < 9) {\n matrix.set(8, 15 - i - 1 + 1, mod, true);\n } else {\n matrix.set(8, 15 - i - 1, mod, true);\n }\n }\n matrix.set(size - 8, 8, 1, true);\n }\n function setupData(matrix, data) {\n const size = matrix.size;\n let inc = -1;\n let row = size - 1;\n let bitIndex = 7;\n let byteIndex = 0;\n for (let col = size - 1; col > 0; col -= 2) {\n if (col === 6) col--;\n while (true) {\n for (let c = 0; c < 2; c++) {\n if (!matrix.isReserved(row, col - c)) {\n let dark = false;\n if (byteIndex < data.length) {\n dark = (data[byteIndex] >>> bitIndex & 1) === 1;\n }\n matrix.set(row, col - c, dark);\n bitIndex--;\n if (bitIndex === -1) {\n byteIndex++;\n bitIndex = 7;\n }\n }\n }\n row += inc;\n if (row < 0 || size <= row) {\n row -= inc;\n inc = -inc;\n break;\n }\n }\n }\n }\n function createData(version, errorCorrectionLevel, segments) {\n const buffer = new BitBuffer();\n segments.forEach(function(data) {\n buffer.put(data.mode.bit, 4);\n buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));\n data.write(buffer);\n });\n const totalCodewords = Utils.getSymbolTotalCodewords(version);\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);\n const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;\n if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {\n buffer.put(0, 4);\n }\n while (buffer.getLengthInBits() % 8 !== 0) {\n buffer.putBit(0);\n }\n const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;\n for (let i = 0; i < remainingByte; i++) {\n buffer.put(i % 2 ? 17 : 236, 8);\n }\n return createCodewords(buffer, version, errorCorrectionLevel);\n }\n function createCodewords(bitBuffer, version, errorCorrectionLevel) {\n const totalCodewords = Utils.getSymbolTotalCodewords(version);\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);\n const dataTotalCodewords = totalCodewords - ecTotalCodewords;\n const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);\n const blocksInGroup2 = totalCodewords % ecTotalBlocks;\n const blocksInGroup1 = ecTotalBlocks - blocksInGroup2;\n const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);\n const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);\n const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;\n const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;\n const rs = new ReedSolomonEncoder(ecCount);\n let offset = 0;\n const dcData = new Array(ecTotalBlocks);\n const ecData = new Array(ecTotalBlocks);\n let maxDataSize = 0;\n const buffer = new Uint8Array(bitBuffer.buffer);\n for (let b = 0; b < ecTotalBlocks; b++) {\n const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;\n dcData[b] = buffer.slice(offset, offset + dataSize);\n ecData[b] = rs.encode(dcData[b]);\n offset += dataSize;\n maxDataSize = Math.max(maxDataSize, dataSize);\n }\n const data = new Uint8Array(totalCodewords);\n let index = 0;\n let i, r;\n for (i = 0; i < maxDataSize; i++) {\n for (r = 0; r < ecTotalBlocks; r++) {\n if (i < dcData[r].length) {\n data[index++] = dcData[r][i];\n }\n }\n }\n for (i = 0; i < ecCount; i++) {\n for (r = 0; r < ecTotalBlocks; r++) {\n data[index++] = ecData[r][i];\n }\n }\n return data;\n }\n function createSymbol(data, version, errorCorrectionLevel, maskPattern) {\n let segments;\n if (Array.isArray(data)) {\n segments = Segments.fromArray(data);\n } else if (typeof data === "string") {\n let estimatedVersion = version;\n if (!estimatedVersion) {\n const rawSegments = Segments.rawSplit(data);\n estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);\n }\n segments = Segments.fromString(data, estimatedVersion || 40);\n } else {\n throw new Error("Invalid data");\n }\n const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);\n if (!bestVersion) {\n throw new Error("The amount of data is too big to be stored in a QR Code");\n }\n if (!version) {\n version = bestVersion;\n } else if (version < bestVersion) {\n throw new Error(\n "\\nThe chosen QR Code version cannot contain this amount of data.\\nMinimum version required to store current data is: " + bestVersion + ".\\n"\n );\n }\n const dataBits = createData(version, errorCorrectionLevel, segments);\n const moduleCount = Utils.getSymbolSize(version);\n const modules = new BitMatrix(moduleCount);\n setupFinderPattern(modules, version);\n setupTimingPattern(modules);\n setupAlignmentPattern(modules, version);\n setupFormatInfo(modules, errorCorrectionLevel, 0);\n if (version >= 7) {\n setupVersionInfo(modules, version);\n }\n setupData(modules, dataBits);\n if (isNaN(maskPattern)) {\n maskPattern = MaskPattern.getBestMask(\n modules,\n setupFormatInfo.bind(null, modules, errorCorrectionLevel)\n );\n }\n MaskPattern.applyMask(maskPattern, modules);\n setupFormatInfo(modules, errorCorrectionLevel, maskPattern);\n return {\n modules,\n version,\n errorCorrectionLevel,\n maskPattern,\n segments\n };\n }\n exports.create = function create(data, options) {\n if (typeof data === "undefined" || data === "") {\n throw new Error("No input text");\n }\n let errorCorrectionLevel = ECLevel.M;\n let version;\n let mask;\n if (typeof options !== "undefined") {\n errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M);\n version = Version.from(options.version);\n mask = MaskPattern.from(options.maskPattern);\n if (options.toSJISFunc) {\n Utils.setToSJISFunction(options.toSJISFunc);\n }\n }\n return createSymbol(data, version, errorCorrectionLevel, mask);\n };\n }\n });\n\n // node_modules/qrcode/lib/renderer/utils.js\n var require_utils2 = __commonJS({\n "node_modules/qrcode/lib/renderer/utils.js"(exports) {\n function hex2rgba(hex) {\n if (typeof hex === "number") {\n hex = hex.toString();\n }\n if (typeof hex !== "string") {\n throw new Error("Color should be defined as hex string");\n }\n let hexCode = hex.slice().replace("#", "").split("");\n if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {\n throw new Error("Invalid hex color: " + hex);\n }\n if (hexCode.length === 3 || hexCode.length === 4) {\n hexCode = Array.prototype.concat.apply([], hexCode.map(function(c) {\n return [c, c];\n }));\n }\n if (hexCode.length === 6) hexCode.push("F", "F");\n const hexValue = parseInt(hexCode.join(""), 16);\n return {\n r: hexValue >> 24 & 255,\n g: hexValue >> 16 & 255,\n b: hexValue >> 8 & 255,\n a: hexValue & 255,\n hex: "#" + hexCode.slice(0, 6).join("")\n };\n }\n exports.getOptions = function getOptions(options) {\n if (!options) options = {};\n if (!options.color) options.color = {};\n const margin = typeof options.margin === "undefined" || options.margin === null || options.margin < 0 ? 4 : options.margin;\n const width = options.width && options.width >= 21 ? options.width : void 0;\n const scale = options.scale || 4;\n return {\n width,\n scale: width ? 4 : scale,\n margin,\n color: {\n dark: hex2rgba(options.color.dark || "#000000ff"),\n light: hex2rgba(options.color.light || "#ffffffff")\n },\n type: options.type,\n rendererOpts: options.rendererOpts || {}\n };\n };\n exports.getScale = function getScale(qrSize, opts) {\n return opts.width && opts.width >= qrSize + opts.margin * 2 ? opts.width / (qrSize + opts.margin * 2) : opts.scale;\n };\n exports.getImageWidth = function getImageWidth(qrSize, opts) {\n const scale = exports.getScale(qrSize, opts);\n return Math.floor((qrSize + opts.margin * 2) * scale);\n };\n exports.qrToImageData = function qrToImageData(imgData, qr, opts) {\n const size = qr.modules.size;\n const data = qr.modules.data;\n const scale = exports.getScale(size, opts);\n const symbolSize = Math.floor((size + opts.margin * 2) * scale);\n const scaledMargin = opts.margin * scale;\n const palette = [opts.color.light, opts.color.dark];\n for (let i = 0; i < symbolSize; i++) {\n for (let j = 0; j < symbolSize; j++) {\n let posDst = (i * symbolSize + j) * 4;\n let pxColor = opts.color.light;\n if (i >= scaledMargin && j >= scaledMargin && i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {\n const iSrc = Math.floor((i - scaledMargin) / scale);\n const jSrc = Math.floor((j - scaledMargin) / scale);\n pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];\n }\n imgData[posDst++] = pxColor.r;\n imgData[posDst++] = pxColor.g;\n imgData[posDst++] = pxColor.b;\n imgData[posDst] = pxColor.a;\n }\n }\n };\n }\n });\n\n // node_modules/qrcode/lib/renderer/canvas.js\n var require_canvas = __commonJS({\n "node_modules/qrcode/lib/renderer/canvas.js"(exports) {\n var Utils = require_utils2();\n function clearCanvas(ctx, canvas, size) {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n if (!canvas.style) canvas.style = {};\n canvas.height = size;\n canvas.width = size;\n canvas.style.height = size + "px";\n canvas.style.width = size + "px";\n }\n function getCanvasElement() {\n try {\n return document.createElement("canvas");\n } catch (e) {\n throw new Error("You need to specify a canvas element");\n }\n }\n exports.render = function render(qrData, canvas, options) {\n let opts = options;\n let canvasEl = canvas;\n if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {\n opts = canvas;\n canvas = void 0;\n }\n if (!canvas) {\n canvasEl = getCanvasElement();\n }\n opts = Utils.getOptions(opts);\n const size = Utils.getImageWidth(qrData.modules.size, opts);\n const ctx = canvasEl.getContext("2d");\n const image = ctx.createImageData(size, size);\n Utils.qrToImageData(image.data, qrData, opts);\n clearCanvas(ctx, canvasEl, size);\n ctx.putImageData(image, 0, 0);\n return canvasEl;\n };\n exports.renderToDataURL = function renderToDataURL(qrData, canvas, options) {\n let opts = options;\n if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {\n opts = canvas;\n canvas = void 0;\n }\n if (!opts) opts = {};\n const canvasEl = exports.render(qrData, canvas, opts);\n const type = opts.type || "image/png";\n const rendererOpts = opts.rendererOpts || {};\n return canvasEl.toDataURL(type, rendererOpts.quality);\n };\n }\n });\n\n // node_modules/qrcode/lib/renderer/svg-tag.js\n var require_svg_tag = __commonJS({\n "node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {\n var Utils = require_utils2();\n function getColorAttrib(color, attrib) {\n const alpha = color.a / 255;\n const str = attrib + \'="\' + color.hex + \'"\';\n return alpha < 1 ? str + " " + attrib + \'-opacity="\' + alpha.toFixed(2).slice(1) + \'"\' : str;\n }\n function svgCmd(cmd, x, y) {\n let str = cmd + x;\n if (typeof y !== "undefined") str += " " + y;\n return str;\n }\n function qrToPath(data, size, margin) {\n let path = "";\n let moveBy = 0;\n let newRow = false;\n let lineLength = 0;\n for (let i = 0; i < data.length; i++) {\n const col = Math.floor(i % size);\n const row = Math.floor(i / size);\n if (!col && !newRow) newRow = true;\n if (data[i]) {\n lineLength++;\n if (!(i > 0 && col > 0 && data[i - 1])) {\n path += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);\n moveBy = 0;\n newRow = false;\n }\n if (!(col + 1 < size && data[i + 1])) {\n path += svgCmd("h", lineLength);\n lineLength = 0;\n }\n } else {\n moveBy++;\n }\n }\n return path;\n }\n exports.render = function render(qrData, options, cb) {\n const opts = Utils.getOptions(options);\n const size = qrData.modules.size;\n const data = qrData.modules.data;\n const qrcodesize = size + opts.margin * 2;\n const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + \' d="M0 0h\' + qrcodesize + "v" + qrcodesize + \'H0z"/>\';\n const path = "<path " + getColorAttrib(opts.color.dark, "stroke") + \' d="\' + qrToPath(data, size, opts.margin) + \'"/>\';\n const viewBox = \'viewBox="0 0 \' + qrcodesize + " " + qrcodesize + \'"\';\n const width = !opts.width ? "" : \'width="\' + opts.width + \'" height="\' + opts.width + \'" \';\n const svgTag = \'<svg xmlns="http://www.w3.org/2000/svg" \' + width + viewBox + \' shape-rendering="crispEdges">\' + bg + path + "</svg>\\n";\n if (typeof cb === "function") {\n cb(null, svgTag);\n }\n return svgTag;\n };\n }\n });\n\n // node_modules/qrcode/lib/browser.js\n var require_browser = __commonJS({\n "node_modules/qrcode/lib/browser.js"(exports) {\n var canPromise = require_can_promise();\n var QRCode = require_qrcode();\n var CanvasRenderer = require_canvas();\n var SvgRenderer = require_svg_tag();\n function renderCanvas(renderFunc, canvas, text, opts, cb) {\n const args = [].slice.call(arguments, 1);\n const argsNum = args.length;\n const isLastArgCb = typeof args[argsNum - 1] === "function";\n if (!isLastArgCb && !canPromise()) {\n throw new Error("Callback required as last argument");\n }\n if (isLastArgCb) {\n if (argsNum < 2) {\n throw new Error("Too few arguments provided");\n }\n if (argsNum === 2) {\n cb = text;\n text = canvas;\n canvas = opts = void 0;\n } else if (argsNum === 3) {\n if (canvas.getContext && typeof cb === "undefined") {\n cb = opts;\n opts = void 0;\n } else {\n cb = opts;\n opts = text;\n text = canvas;\n canvas = void 0;\n }\n }\n } else {\n if (argsNum < 1) {\n throw new Error("Too few arguments provided");\n }\n if (argsNum === 1) {\n text = canvas;\n canvas = opts = void 0;\n } else if (argsNum === 2 && !canvas.getContext) {\n opts = text;\n text = canvas;\n canvas = void 0;\n }\n return new Promise(function(resolve, reject) {\n try {\n const data = QRCode.create(text, opts);\n resolve(renderFunc(data, canvas, opts));\n } catch (e) {\n reject(e);\n }\n });\n }\n try {\n const data = QRCode.create(text, opts);\n cb(null, renderFunc(data, canvas, opts));\n } catch (e) {\n cb(e);\n }\n }\n exports.create = QRCode.create;\n exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render);\n exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL);\n exports.toString = renderCanvas.bind(null, function(data, _, opts) {\n return SvgRenderer.render(data, opts);\n });\n }\n });\n\n // web-console/browser.ts\n var token = sessionStorage.getItem("engine7-console-key") || "";\n var client = Array.from(\n crypto.getRandomValues(new Uint8Array(16)),\n (byte) => byte.toString(16).padStart(2, "0")\n ).join("");\n var login = null;\n async function authenticate() {\n if (login) return login;\n login = new Promise((resolve) => {\n const mask = document.createElement("div");\n mask.className = "web-login";\n mask.innerHTML = \'<form><h2>Engine7 \\u63A7\\u5236\\u53F0</h2><p>\\u8F93\\u5165\\u7BA1\\u7406\\u53E3\\u4EE4\\uFF0C\\u7EE7\\u7EED\\u4E0E\\u4F60\\u7684\\u4F19\\u4F34\\u76F8\\u4F34\\u3002</p><input type="password" autocomplete="current-password" aria-label="\\u7BA1\\u7406\\u53E3\\u4EE4" required><button class="btn btn-primary" type="submit">\\u8FDB\\u5165\\u63A7\\u5236\\u53F0</button></form>\';\n document.body.append(mask);\n mask.querySelector("form").onsubmit = (e) => {\n e.preventDefault();\n token = mask.querySelector("input").value;\n sessionStorage.setItem("engine7-console-key", token);\n mask.remove();\n login = null;\n resolve();\n };\n mask.querySelector("input").focus();\n });\n return login;\n }\n async function rpc(method, args = []) {\n const response = await fetch("/api/console/rpc", {\n method: "POST",\n headers: {\n "Content-Type": "application/json",\n "x-engine-console": "1",\n ...token ? { Authorization: "Bearer " + token } : {}\n },\n body: JSON.stringify({ method, args, client }),\n // Shared CLI/update modules own the time limits for these long operations.\n signal: ["runReconfig", "updateApply"].includes(method) ? void 0 : AbortSignal.timeout(48e4)\n });\n if (response.status === 403) {\n await authenticate();\n return rpc(method, args);\n }\n const value = await response.json();\n if (!response.ok) throw new Error(value.error || "\\u63A7\\u5236\\u53F0\\u8BF7\\u6C42\\u5931\\u8D25");\n return value;\n }\n var subscriptions = {\n engine: /* @__PURE__ */ new Set(),\n update: /* @__PURE__ */ new Set()\n };\n var since = 0;\n var polling = false;\n function subscribe(type, callback) {\n subscriptions[type].add(callback);\n if (!polling) {\n polling = true;\n void poll();\n }\n return () => subscriptions[type].delete(callback);\n }\n async function poll() {\n while (subscriptions.engine.size || subscriptions.update.size) {\n try {\n const result = await rpc("events", [since]);\n since = result.latest;\n for (const event of result.events)\n if (event.stateDir === (await api.getInstalledMarker()).stateDir)\n for (const callback of subscriptions[event.type] || [])\n callback(event.value);\n } catch {\n }\n await new Promise((resolve) => setTimeout(resolve, 500));\n }\n polling = false;\n }\n var upload = null;\n async function pickImage() {\n return new Promise((resolve) => {\n const input = document.createElement("input");\n input.type = "file";\n input.accept = ".png,.jpg,.jpeg,.webp";\n input.hidden = true;\n document.body.append(input);\n input.oncancel = () => {\n input.remove();\n resolve(null);\n };\n input.onchange = async () => {\n const file = input.files?.[0];\n input.remove();\n if (!file) return resolve(null);\n if (file.size > 8 * 1024 * 1024) {\n alert("\\u8BF7\\u9009\\u62E9\\u4E0D\\u8D85\\u8FC7 8 MB \\u7684\\u7167\\u7247");\n return resolve(null);\n }\n const bytes = new Uint8Array(await file.arrayBuffer());\n let raw = "";\n for (let i = 0; i < bytes.length; i += 16384)\n raw += String.fromCharCode(...bytes.subarray(i, i + 16384));\n upload = JSON.stringify({ name: file.name, data: btoa(raw) });\n resolve("browser-upload");\n };\n input.click();\n });\n }\n async function serviceAuth(stateDir, action, provider, payload) {\n const popup = action === "connect" || action === "continue" || action === "permissions" ? window.open("about:blank", "_blank") : null;\n if (popup) popup.opener = null;\n try {\n const result = await rpc("serviceAuth", [stateDir, action, provider, payload]);\n if (result.openUrl) {\n if (popup) popup.location.href = result.openUrl;\n else location.assign(result.openUrl);\n } else popup?.close();\n return result;\n } catch (error) {\n popup?.close();\n throw error;\n }\n }\n var api = {\n serviceAuth,\n pickImageFile: pickImage,\n pickDirectory: async () => {\n const marker = await api.getInstalledMarker();\n return new Promise((resolve) => {\n const mask = document.createElement("div");\n mask.className = "web-login";\n const box = document.createElement("form");\n const title = document.createElement("h2");\n title.textContent = "\\u9009\\u62E9\\u4E91\\u4E3B\\u673A\\u4E0A\\u7684\\u76EE\\u5F55";\n const locationLabel = document.createElement("p");\n const list = document.createElement("div");\n const choose = document.createElement("button"), cancel = document.createElement("button");\n choose.className = "btn btn-primary";\n choose.textContent = "\\u9009\\u62E9\\u8FD9\\u4E2A\\u76EE\\u5F55";\n choose.type = "submit";\n choose.disabled = true;\n cancel.className = "btn";\n cancel.textContent = "\\u53D6\\u6D88";\n cancel.type = "button";\n let current2 = "", generation = 0, active = true;\n const finish = (value) => {\n active = false;\n mask.remove();\n resolve(value);\n };\n box.onsubmit = (event) => {\n event.preventDefault();\n finish(current2);\n };\n cancel.onclick = () => finish(null);\n const load = async (directory = "") => {\n const ticket = ++generation;\n choose.disabled = true;\n try {\n const result = await rpc("listDirectories", [\n marker.stateDir,\n directory\n ]);\n if (!active || ticket !== generation) return;\n current2 = result.path;\n locationLabel.textContent = current2;\n list.replaceChildren();\n choose.disabled = false;\n for (const entry of [\n ...result.parent ? [{ name: "\\u4E0A\\u4E00\\u7EA7", path: result.parent }] : [],\n ...result.directories\n ]) {\n const button = document.createElement("button");\n button.type = "button";\n button.className = "btn";\n button.textContent = entry.name;\n button.onclick = () => {\n void load(entry.path);\n };\n list.append(button);\n }\n } catch (error) {\n if (active && ticket === generation) {\n locationLabel.textContent = String(error);\n choose.disabled = true;\n }\n }\n };\n box.append(title, locationLabel, list, choose, cancel);\n mask.append(box);\n document.body.append(mask);\n void load();\n });\n },\n copyPortrait: async (stateDir) => {\n if (!upload) throw new Error("\\u8BF7\\u5148\\u9009\\u62E9\\u7167\\u7247");\n const photo = JSON.parse(upload);\n upload = null;\n return rpc("copyPortrait", [stateDir, photo]);\n },\n consolePendingPage: async () => ({ top: "status", connections: "channels" })[location.hash.slice(1)] || location.hash.slice(1) || "status",\n onConsoleNavigate: (callback) => {\n const listener = () => callback(\n { top: "status", connections: "channels" }[location.hash.slice(1)] || location.hash.slice(1) || "status"\n );\n addEventListener("hashchange", listener);\n return () => removeEventListener("hashchange", listener);\n },\n onEngineEvent: (callback) => subscribe("engine", callback),\n onUpdateEvent: (callback) => subscribe("update", callback),\n cancelReconfig: async () => rpc("cancelReconfig", []),\n openPath: async (target) => {\n const popup = window.open("about:blank", "_blank");\n if (popup) popup.opener = null;\n try {\n const result = await rpc("openPath", [target]);\n if (!popup) return;\n const pre = popup.document.createElement("pre");\n pre.textContent = result.text;\n popup.document.body.replaceChildren(pre);\n popup.document.title = "Engine7 \\xB7 \\u6587\\u4EF6";\n } catch (e) {\n popup?.close();\n throw e;\n }\n }\n };\n for (const method of [\n "listEngines",\n "getInstalledMarker",\n "selectEngine",\n "apiStatus",\n "doctor",\n "travelControl",\n "configGet",\n "configSet",\n "configSchema",\n "configMigrate",\n "internalModeSet",\n "startEngine",\n "stopEngine",\n "isEngineAlive",\n "isEngineProcessAlive",\n "applyFreeTier",\n "updateCheck",\n "updateApply",\n "runReconfig",\n "cancelReconfig",\n "readChannelConfig",\n "updateChannelConfig",\n "readTelegramConfig",\n "updateTelegramConfig",\n "readDingtalkConfig",\n "updateDingtalkConfig",\n "readFeishuConfig",\n "updateFeishuConfig",\n "readWecomConfig",\n "updateWecomConfig",\n "readWhatsappConfig",\n "updateWhatsappConfig",\n "fetchWaStatus",\n "fetchWaQr",\n "scaffoldPersonas",\n "autostartEnable",\n "logTail"\n ])\n api[method] = (...args) => rpc(method, args);\n var getMarker = api.getInstalledMarker;\n var current = null;\n api.getInstalledMarker = async () => current || (current = await getMarker());\n api.selectEngine = async (stateDir) => {\n const engines = await api.listEngines();\n const selected = engines.engines.find(\n (entry) => entry.stateDir === stateDir\n );\n if (!selected) return { ok: false };\n current = selected;\n return { ok: true };\n };\n for (const method of ["updateCheck", "updateApply", "autostartEnable"])\n api[method] = async () => rpc(method, [(await api.getInstalledMarker()).stateDir]);\n window.engine7Api = api;\n window.engine7ConsoleRpc = rpc;\n\n // web-console/terminal.ts\n var rpc2 = window.engine7ConsoleRpc;\n function mount(body, marker) {\n body.innerHTML = \'<div class="page web-terminal"><h2>\\u7EC8\\u7AEF</h2><p class="page-sub">\\u5728\\u8FD9\\u91CC\\u4E0E\\u4F19\\u4F34\\u5BF9\\u8BDD\\uFF0C\\u4E5F\\u53EF\\u4EE5\\u8F93\\u5165\\u539F\\u6709\\u547D\\u4EE4\\u3002</p><pre class="log-view" id="term-out" role="log"></pre><form class="term-row"><input id="term-in" aria-label="\\u6D88\\u606F" autocomplete="off"><button class="btn btn-primary" id="term-send">\\u53D1\\u9001</button></form><p role="status" id="term-error"></p></div>\';\n let active = true, seq = 0;\n const out = body.querySelector("pre"), input = body.querySelector("input"), error = body.querySelector("#term-error");\n {\n body.querySelector("form").onsubmit = async (e) => {\n e.preventDefault();\n const text = input.value.trim();\n if (!text) return;\n try {\n await rpc2("terminalSend", [marker.stateDir, text]);\n if (active) input.value = "";\n } catch (e2) {\n if (active) error.textContent = String(e2);\n }\n };\n const poll2 = async () => {\n if (!active) return;\n try {\n const result = await rpc2("terminalPoll", [marker.stateDir, seq]);\n if (active) {\n for (const line of result.lines)\n out.textContent += "\\n" + (line.kind === "echo" ? "You> " : "") + line.text;\n seq = result.latest;\n out.scrollTop = out.scrollHeight;\n }\n } catch (e) {\n if (active) error.textContent = String(e);\n }\n if (active) setTimeout(poll2, 900);\n };\n void poll2();\n }\n input.focus();\n return () => {\n active = false;\n };\n }\n window.engine7ConsoleExtensions = {\n pages: (marker) => [\n {\n key: "terminal",\n label: "\\u7EC8\\u7AEF",\n mount: (body) => mount(body, marker)\n }\n ],\n onNavigate: (key) => history.replaceState(null, "", "#" + key)\n };\n\n // web-console/desktop/src/renderer/shared/aurora.ts\n var mounted = /* @__PURE__ */ new WeakMap();\n function mountAuroraChrome(root) {\n const existing = mounted.get(root);\n if (existing) return existing;\n const field = document.createElement("div");\n field.className = "aurora-field";\n field.setAttribute("aria-hidden", "true");\n const canvas = document.createElement("canvas");\n canvas.className = "aurora-particles";\n field.append(canvas);\n root.before(field);\n const ctx = canvas.getContext("2d");\n const button = root.querySelector("[data-aurora-control]");\n const reduced = matchMedia("(prefers-reduced-motion: reduce)");\n let reduceMotion = reduced.matches;\n let manualPause = false, away = false, frame = 0, previous = 0, time = 0;\n let width = 0, height = 0, dpr = 1;\n const colors = ["#a78bfa", "#6ecdff", "#ff6b9d", "#ffcf8a"];\n const random = (i) => {\n const n = Math.sin(i * 78.233 + 19.19) * 43758.5453;\n return n - Math.floor(n);\n };\n let points = [];\n const paused = () => manualPause || reduceMotion;\n function paint() {\n if (!ctx) return;\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n ctx.clearRect(0, 0, width, height);\n for (const p of points) {\n const t = (time + p.offset) % p.life / p.life;\n const fade = Math.max(0, Math.min(1, t * 8, (1 - t) * 8));\n ctx.globalAlpha = p.alpha * fade;\n ctx.fillStyle = p.color;\n ctx.fillRect(p.x + (t - 0.5) * p.span, p.y + (t - 0.5) * p.rise, p.size, p.size);\n }\n ctx.globalAlpha = 1;\n }\n function resize() {\n width = field.clientWidth;\n height = field.clientHeight;\n dpr = Math.min(devicePixelRatio || 1, 1.25);\n canvas.width = Math.max(1, Math.round(width * dpr));\n canvas.height = Math.max(1, Math.round(height * dpr));\n points = Array.from({ length: width <= 720 ? 110 : 260 }, (_, i) => ({\n x: width * (0.08 + random(i + 1) * 0.9),\n y: height * (0.2 + random(i + 10) * 0.8),\n span: (55 + random(i + 30) * 85) * (i % 3 ? 1 : -1),\n rise: (random(i + 40) - 0.5) * 40,\n life: 6 + random(i + 50) * 7,\n offset: random(i + 60) * 20,\n size: 0.7 + random(i + 70) * 1.1,\n color: colors[i % colors.length],\n alpha: 0.2 + random(i + 80) * 0.32\n }));\n paint();\n }\n function tick(now) {\n frame = 0;\n if (paused() || away || document.hidden || !canvas.isConnected || !ctx) return;\n if (!previous) previous = now;\n if (now - previous >= 1e3 / 24) {\n time += Math.min((now - previous) / 1e3, 0.1);\n previous = now;\n paint();\n }\n frame = requestAnimationFrame(tick);\n }\n function synchronize() {\n cancelAnimationFrame(frame);\n frame = 0;\n previous = 0;\n const still = paused();\n document.documentElement.classList.toggle("aurora-motion-paused", still);\n button.setAttribute("aria-pressed", String(still));\n button.disabled = reduceMotion;\n button.setAttribute("aria-label", reduceMotion ? "\\u7CFB\\u7EDF\\u5DF2\\u51CF\\u5C11\\u88C5\\u9970\\u52A8\\u6548" : still ? "\\u5F00\\u542F\\u88C5\\u9970\\u52A8\\u6548" : "\\u5173\\u95ED\\u88C5\\u9970\\u52A8\\u6548");\n button.title = button.getAttribute("aria-label");\n canvas.dataset.motion = still ? "paused" : away || document.hidden || !ctx ? "offscreen" : "playing";\n if (canvas.dataset.motion === "playing") frame = requestAnimationFrame(tick);\n }\n button.addEventListener("click", () => {\n manualPause = !manualPause;\n synchronize();\n });\n reduced.addEventListener("change", (event) => {\n reduceMotion = event.matches;\n synchronize();\n });\n document.addEventListener("visibilitychange", synchronize);\n addEventListener("pagehide", () => {\n away = true;\n synchronize();\n });\n addEventListener("pageshow", () => {\n away = false;\n synchronize();\n });\n new ResizeObserver(resize).observe(field);\n const chrome2 = { setScene(key) {\n field.dataset.scene = key;\n root.dataset.scene = key;\n } };\n mounted.set(root, chrome2);\n resize();\n synchronize();\n return chrome2;\n }\n\n // web-console/desktop/src/renderer/shared/dom.ts\n function h(tag, attrs = {}, ...children) {\n const el = document.createElement(tag);\n for (const [k, v] of Object.entries(attrs)) {\n if (v === null || v === void 0 || v === false) continue;\n if (k === "class") el.className = String(v);\n else if (k === "style") el.setAttribute("style", String(v));\n else if (k.startsWith("on") && typeof v === "function") el.addEventListener(k.slice(2), v);\n else if (k === "checked" || k === "disabled" || k === "selected" || k === "hidden" || k === "value" || k === "type") {\n ;\n el[k] = v;\n } else el.setAttribute(k, String(v));\n }\n for (const c of children) {\n if (c === null || c === void 0) continue;\n el.append(c instanceof Node ? c : document.createTextNode(String(c)));\n }\n return el;\n }\n\n // web-console/desktop/src/renderer/shared/brand.ts\n var BRAND = {\n feishu: { color: "#3370ff", char: "\\u98DE" },\n wechat: { color: "#07c160", char: "\\u5FAE" },\n dingtalk: { color: "#0089ff", char: "\\u9489" },\n wecom: { color: "#2e6be6", char: "\\u4F01" },\n whatsapp: { color: "#25d366", char: "W" },\n telegram: { color: "#2aabee", char: "T" },\n discord: { color: "#5865f2", char: "D" }\n };\n function brandBadge(name, small = false) {\n const box = h("span", { class: `chan-badge${small ? " small" : ""}` });\n const logo = CHANNEL_LOGOS[name];\n if (logo) {\n const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");\n svg.setAttribute("viewBox", `0 0 ${logo.view}`);\n svg.setAttribute("fill", "currentColor");\n svg.style.color = logo.color;\n svg.innerHTML = logo.body;\n box.appendChild(svg);\n return box;\n }\n const b = BRAND[name];\n box.textContent = b ? b.char : name[0]?.toUpperCase() ?? "?";\n box.style.background = b?.color ?? "#8a8f98";\n return box;\n }\n var CHANNEL_LOGOS = {\n dingtalk: { view: "24 24", color: "#0089ff", body: \'<path fill="currentColor" fill-rule="evenodd" d="M6.802 2.02a1 1 0 0 1 .849.22l9.751 8.359a2 2 0 0 1 .235 2.799l-1.06 1.272l.87.436a1 1 0 0 1 .134 1.708l-7 5a1 1 0 0 1-1.539-1.101l1.21-4.034c-2.363-.9-3.747-3.055-4.233-5.483A1 1 0 0 1 7.01 10c-.474-.703-.86-1.42-1.134-2.149c-.649-1.73-.658-3.523.23-5.298a1 1 0 0 1 .696-.533" clip-rule="evenodd"/>\' },\n wecom: { view: "24 24", color: "#2e6be6", body: \'<path fill="currentColor" d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12S5.925 1 12 1m3.52 15.49a.35.35 0 0 0-.24.1c-.14.13-.16.34.02.53l.07.07c.44.44.74.99.85 1.57c0 .02.04.23.04.23c.05.19.15.37.29.5c.21.21.51.34.82.34c.3 0 .59-.12.8-.33c.44-.44.44-1.16 0-1.61c-.15-.15-.34-.26-.53-.3l-.15-.03c-.61-.11-1.17-.41-1.62-.86c-.03-.03-.07-.07-.1-.11c-.06-.074-.16-.1-.25-.1M11 4.75c-2.117 0-4.264.77-5.75 2.31C4.111 8.246 3.5 9.72 3.5 11.24c0 1.06.3 2.12.88 3.06c.47.695.993 1.371 1.66 1.89l-.384 1.624a.6.6 0 0 0 .856.673L8.64 17.41c.53.166 1.08.234 1.63.3a8.3 8.3 0 0 0 1.7-.03l.38-.05q.283-.046.564-.112a2.33 2.33 0 0 1-.92-1.605l-.254.037c-.62.067-1.232.03-1.85-.04c-.43-.057-.838-.185-1.25-.31l-1.02.5l.23-.67l-.74-.6c-.513-.401-.917-.934-1.28-1.47c-.4-.65-.61-1.38-.61-2.11c0-1.08.456-2.119 1.26-2.97c1.158-1.198 2.854-1.78 4.5-1.78c1.54 0 3.108.513 4.24 1.58c.365.365.707.75.95 1.21c.177.354.338.722.424 1.107a2.34 2.34 0 0 1 1.811.123c-.075-.716-.33-1.4-.665-2.04c-.329-.62-.776-1.155-1.27-1.65c-1.468-1.38-3.471-2.08-5.47-2.08m9.37 9.77a1.136 1.136 0 0 0-1.1.86l-.03.15a3.1 3.1 0 0 1-.86 1.63c-.04.03-.07.07-.11.1c-.14.13-.14.35 0 .49c.07.06.17.1.26.1h.01c.07 0 .15-.02.26-.13l.07-.07c.44-.44.99-.74 1.57-.85c.023 0 .227-.04.23-.04c.2-.06.37-.16.5-.3c.44-.44.44-1.17 0-1.61c-.21-.21-.5-.33-.8-.33m-4.21-1.07c-.08 0-.16.03-.27.14l-.07.07c-.44.44-.99.74-1.57.85c-.02 0-.23.04-.23.04c-.2.06-.37.16-.5.3c-.44.44-.44 1.17 0 1.61c.21.21.51.34.82.34c.3 0 .59-.12.8-.33c.15-.16.25-.34.29-.53a.4.4 0 0 0 .03-.16c.11-.61.41-1.18.86-1.63c.03-.03.06-.06.1-.09c.146-.115.13-.36 0-.49a.34.34 0 0 0-.26-.12m1.18-1.97c-.3 0-.59.12-.8.33c-.44.44-.44 1.16 0 1.61c.15.15.34.26.53.3c.054.006.144.029.15.03c.61.12 1.17.41 1.62.86c.03.03.07.07.1.11c.08.08.16.1.25.1c.1 0 .16-.04.23-.11c.12-.13.14-.32-.02-.52l-.08-.08c-.44-.44-.74-.99-.85-1.57c0-.02-.04-.23-.04-.23c-.05-.19-.15-.37-.29-.5c-.21-.21-.5-.33-.8-.33"/>\' },\n feishu: { view: "48 48", color: "#3370ff", body: \'<g fill="none"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M17 29c4 0 8-2.066 11-5.593C36 14 41.424 16.817 44 18c-5.5 3-3.5 11.623-11 18c-4.618 3.926-9.506 5.014-14 5c-6.477-.02-12.138-3.236-15-5.594V17"/><path fill="currentColor" d="M5.648 15.867a2 2 0 1 0-3.296 2.266zM36.002 35.73a2 2 0 0 0-2.004-3.462zM2.352 18.133c2.892 4.206 8.447 10.011 14.535 14.09c3.047 2.044 6.33 3.723 9.562 4.51c3.246.789 6.596.71 9.553-1.002l-2.004-3.462c-1.793 1.038-4.005 1.209-6.603.577c-2.612-.636-5.454-2.05-8.282-3.945c-5.662-3.795-10.856-9.24-13.465-13.034z"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M33.595 17c-.755-2.297-2.74-7.06-6-10h-16C15.217 10.676 23 16 27 24"/></g>\' },\n wechat: { view: "24 24", color: "#07c160", body: \'<path fill="currentColor" d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213c0 .163.13.295.29.295a.33.33 0 0 0 .167-.054l1.903-1.114a.86.86 0 0 1 .717-.098a10.2 10.2 0 0 0 2.837.403c.276 0 .543-.027.811-.05c-.857-2.578.157-4.972 1.932-6.446c1.703-1.415 3.882-1.98 5.853-1.838c-.576-3.583-4.196-6.348-8.596-6.348M5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178a1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18m5.34 2.867c-1.797-.052-3.746.512-5.28 1.786c-1.72 1.428-2.687 3.72-1.78 6.22c.942 2.453 3.666 4.229 6.884 4.229c.826 0 1.622-.12 2.361-.336a.72.72 0 0 1 .598.082l1.584.926a.3.3 0 0 0 .14.047c.134 0 .24-.111.24-.247c0-.06-.023-.12-.038-.177l-.327-1.233a.6.6 0 0 1-.023-.156a.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983a.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983a.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982"/>\' },\n whatsapp: { view: "24 24", color: "#25d366", body: \'<path fill="currentColor" d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967c-.273-.099-.471-.148-.67.15c-.197.297-.767.966-.94 1.164c-.173.199-.347.223-.644.075c-.297-.15-1.255-.463-2.39-1.475c-.883-.788-1.48-1.761-1.653-2.059c-.173-.297-.018-.458.13-.606c.134-.133.298-.347.446-.52s.198-.298.298-.497c.099-.198.05-.371-.025-.52s-.669-1.612-.916-2.207c-.242-.579-.487-.5-.669-.51a13 13 0 0 0-.57-.01c-.198 0-.52.074-.792.372c-.272.297-1.04 1.016-1.04 2.479c0 1.462 1.065 2.875 1.213 3.074s2.096 3.2 5.077 4.487c.709.306 1.262.489 1.694.625c.712.227 1.36.195 1.871.118c.571-.085 1.758-.719 2.006-1.413s.248-1.289.173-1.413c-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214l-3.741.982l.998-3.648l-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884c2.64 0 5.122 1.03 6.988 2.898a9.82 9.82 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.82 11.82 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.9 11.9 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.82 11.82 0 0 0-3.48-8.413"/>\' },\n telegram: { view: "24 24", color: "#26a5e4", body: \'<path fill="currentColor" d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12a12 12 0 0 0 12-12A12 12 0 0 0 12 0zm4.962 7.224c.1-.002.321.023.465.14a.5.5 0 0 1 .171.325c.016.093.036.306.02.472c-.18 1.898-.962 6.502-1.36 8.627c-.168.9-.499 1.201-.82 1.23c-.696.065-1.225-.46-1.9-.902c-1.056-.693-1.653-1.124-2.678-1.8c-1.185-.78-.417-1.21.258-1.91c.177-.184 3.247-2.977 3.307-3.23c.007-.032.014-.15-.056-.212s-.174-.041-.249-.024q-.159.037-5.061 3.345q-.72.495-1.302.48c-.428-.008-1.252-.241-1.865-.44c-.752-.245-1.349-.374-1.297-.789q.04-.324.893-.663q5.247-2.286 6.998-3.014c3.332-1.386 4.025-1.627 4.476-1.635"/>\' },\n discord: { view: "24 24", color: "#5865f2", body: \'<path fill="currentColor" d="M20.317 4.37a19.8 19.8 0 0 0-4.885-1.515a.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.3 18.3 0 0 0-5.487 0a13 13 0 0 0-.617-1.25a.08.08 0 0 0-.079-.037A19.7 19.7 0 0 0 3.677 4.37a.1.1 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.08.08 0 0 0 .031.057a19.9 19.9 0 0 0 5.993 3.03a.08.08 0 0 0 .084-.028a14 14 0 0 0 1.226-1.994a.076.076 0 0 0-.041-.106a13 13 0 0 1-1.872-.892a.077.077 0 0 1-.008-.128a10 10 0 0 0 .372-.292a.07.07 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.07.07 0 0 1 .078.01q.181.149.373.292a.077.077 0 0 1-.006.127a12.3 12.3 0 0 1-1.873.892a.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.08.08 0 0 0 .084.028a19.8 19.8 0 0 0 6.002-3.03a.08.08 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.06.06 0 0 0-.031-.03M8.02 15.33c-1.182 0-2.157-1.085-2.157-2.419c0-1.333.956-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.956 2.418-2.157 2.418m7.975 0c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.955-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.946 2.418-2.157 2.418"/>\' }\n };\n\n // web-console/desktop/src/renderer/console/ui.ts\n function channelLabel(name) {\n if (name === "feishu") return "\\u98DE\\u4E66";\n if (name === "wechat") return "\\u5FAE\\u4FE1";\n if (name === "discord") return "Discord";\n if (name === "dingtalk") return "\\u9489\\u9489";\n if (name === "wecom") return "\\u4F01\\u4E1A\\u5FAE\\u4FE1";\n if (name === "whatsapp") return "WhatsApp";\n if (name === "telegram") return "Telegram";\n return name;\n }\n function channelLight(c) {\n if (!c.enabled) return { status: "off", text: "\\u26D4 \\u672A\\u542F\\u7528" };\n if (c.hasCredentials) return { status: "green", text: "\\u2705 \\u5DF2\\u914D\\u7F6E" };\n return { status: "amber", text: "\\u26A0\\uFE0F \\u7F3A\\u51ED\\u8BC1" };\n }\n function openModal(content) {\n const mask = document.getElementById("console-modal");\n if (!mask) throw new Error("DOM #console-modal \\u4E0D\\u5B58\\u5728");\n mask.replaceChildren(content);\n mask.hidden = false;\n return {\n root: mask,\n close: () => {\n mask.hidden = true;\n mask.replaceChildren();\n }\n };\n }\n function qrDataUrl(url, size = 260) {\n return Promise.resolve().then(() => __toESM(require_browser(), 1)).then((q) => q.toDataURL(url, { width: size, margin: 1, errorCorrectionLevel: "M" }));\n }\n function fmtUptime(sec) {\n if (sec < 60) return `${sec} \\u79D2`;\n if (sec < 3600) return `${Math.floor(sec / 60)} \\u5206\\u949F`;\n const h2 = Math.floor(sec / 3600);\n const m = Math.floor(sec % 3600 / 60);\n return m ? `${h2} \\u5C0F\\u65F6 ${m} \\u5206` : `${h2} \\u5C0F\\u65F6`;\n }\n var NAV_ICON_SVG = {\n status: \'<path d="M3 12h4l2.5-6 4 12 2.5-6h5"/>\',\n channels: \'<path d="M4 5h16v11H9l-5 4z"/>\',\n travel: \'<path d="M4 17h16M8 17l-2-5 5 1 6-8 3 2-4 8 4 2"/><path d="M6 7l3 1"/>\',\n email: \'<path d="m9 15 6-6M8 17l-2 2a4 4 0 0 1-6-6l5-5a4 4 0 0 1 6 0m2-1 2-2a4 4 0 0 1 6 6l-5 5a4 4 0 0 1-6 0"/>\',\n settings: \'<path d="M4 7h9M19 7h1M4 17h3M13 17h7"/><circle cx="16" cy="7" r="2.4"/><circle cx="10" cy="17" r="2.4"/>\',\n logs: \'<path d="M9 6h11M9 12h11M9 18h11"/><circle cx="4.5" cy="6" r="1.2"/><circle cx="4.5" cy="12" r="1.2"/><circle cx="4.5" cy="18" r="1.2"/>\'\n };\n function navIcon(key) {\n const d = NAV_ICON_SVG[key];\n if (!d) return null;\n const wrap = document.createElementNS("http://www.w3.org/2000/svg", "svg");\n wrap.setAttribute("viewBox", "0 0 24 24");\n wrap.setAttribute("fill", "none");\n wrap.setAttribute("stroke", "currentColor");\n wrap.setAttribute("stroke-width", "1.8");\n wrap.setAttribute("stroke-linecap", "round");\n wrap.setAttribute("stroke-linejoin", "round");\n wrap.innerHTML = d;\n return wrap;\n }\n\n // web-console/desktop/src/renderer/shared/setup-design.ts\n var paths = {\n heart: "M20 5a5 5 0 0 0-8 1 5 5 0 0 0-8-1c-4 5 2 10 8 15 6-5 12-10 8-15Z",\n memory: "M4 3h14v18H4zM8 7h6m-6 4h6m-6 4h4M18 6h3v16",\n chat: "M21 11a9 9 0 0 1-9 9H4l1-4a9 9 0 1 1 16-5ZM7 10h10m-10 4h6",\n work: "M3 7h18v14H3zM8 7V4h8v3M3 12a23 23 0 0 0 18 0",\n leaf: "M20 3C8 1 2 7 5 15s18 7 15-12ZM5 20 16 9M8 16v-5m5 0h5",\n key: "M12 8a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm0 4 9 9m-5-5 3-3m-6 0 3-3",\n file: "M14 2H5v20h14V7zM14 2v6h5M8 12h8m-8 4h6",\n arrow: "M4 12h16m-6-6 6 6-6 6",\n check: "m5 12 4 4L20 5",\n image: "M3 3h18v18H3zM3 17l6-6 4 4 4-4 4 4"\n };\n function designIcon(name) {\n const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");\n for (const [key, value] of Object.entries({ viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true", class: "design-icon" })) svg.setAttribute(key, value);\n const path = document.createElementNS(svg.namespaceURI, "path");\n path.setAttribute("d", paths[name]);\n svg.append(path);\n return svg;\n }\n function stepHeading(kicker, title, sub) {\n return h("div", { class: "step-heading" }, h("p", { class: "aurora-eyebrow" }, kicker), h("h2", {}, title), h("p", { class: "step-sub" }, sub));\n }\n\n // web-console/desktop/src/shared/engine-state.ts\n var STARTING_GRACE_MS = 12e4;\n function classifySilent(processAlive, silentSinceMs, nowMs, graceMs = STARTING_GRACE_MS) {\n if (!processAlive) return { state: "stopped", silentSinceMs: null };\n const since2 = silentSinceMs ?? nowMs;\n if (nowMs - since2 > graceMs) return { state: "warn", silentSinceMs: since2 };\n return { state: "starting", silentSinceMs: since2 };\n }\n var STATE_TEXT = {\n running: "\\u25CF \\u8FD0\\u884C\\u4E2D",\n starting: "\\u25CC \\u542F\\u52A8\\u4E2D",\n stopped: "\\u25CB \\u5DF2\\u505C\\u6B62",\n warn: "\\u26A0\\uFE0F \\u672A\\u54CD\\u5E94"\n };\n var STATE_DETAIL = {\n running: "",\n starting: "\\u5F15\\u64CE\\u8FDB\\u7A0B\\u5DF2\\u8D77\\uFF0C\\u6B63\\u5728\\u7B49\\u5B83\\u628A\\u63A5\\u53E3\\u5F00\\u51FA\\u6765\\u2014\\u2014\\u901A\\u5E38\\u5341\\u51E0\\u79D2\\u5230\\u534A\\u5206\\u949F\\u3002",\n stopped: "",\n warn: "\\u7AEF\\u53E3\\u88AB\\u5360\\u7528\\u6216\\u5F15\\u64CE\\u50F5\\u6B7B\\uFF0C\\u53EF\\u5C1D\\u8BD5\\u91CD\\u542F\\u5F15\\u64CE\\u3002"\n };\n\n // web-console/desktop/src/renderer/shared/free-tier-text.ts\n var FREE_TIER_PITCH = "\\u4E0D\\u7528\\u6CE8\\u518C\\u3001\\u4E0D\\u7528\\u586B\\u4EFB\\u4F55 Key\\u2014\\u2014\\u5411\\u5BFC\\u4F1A\\u81EA\\u52A8\\u9886\\u4E00\\u628A\\u4E13\\u5C5E\\u4EE4\\u724C\\uFF0C\\u88C5\\u5B8C\\u5C31\\u80FD\\u5BF9\\u8BDD\\u3001\\u80FD\\u770B\\u56FE\\u3001\\u80FD\\u81EA\\u62CD\\u3002";\n var FREE_TIER_RUNNING = "\\u23F3 \\u6B63\\u5728\\u81EA\\u52A8\\u9886\\u53D6\\u4E13\\u5C5E\\u4EE4\\u724C\\u2026\\uFF08\\u51E0\\u79D2\\u949F\\uFF0C\\u4E0D\\u7528\\u70B9\\u4EFB\\u4F55\\u6309\\u94AE\\uFF09";\n function freeTierOkText(baseUrl, tail = "\\u3002") {\n return `\\u2705 \\u5DF2\\u81EA\\u52A8\\u9886\\u53D6\\u4E13\\u5C5E\\u4EE4\\u724C${baseUrl ? `\\uFF08\\u6A21\\u578B\\u5730\\u5740 ${baseUrl}\\uFF09` : ""}\\u2014\\u2014\\u4E0D\\u7528\\u586B\\u4EFB\\u4F55 Key${tail}`;\n }\n var FREE_TIER_FAIL_HINT = "\\u53EF\\u4EE5\\u91CD\\u8BD5\\uFF0C\\u6216\\u8005\\u6539\\u7528\\u4F60\\u81EA\\u5DF1\\u7684 API Key\\uFF1A";\n var FREE_TIER_RESTART_NEEDED = "\\u26A0\\uFE0F \\u5F15\\u64CE\\u6B63\\u5728\\u8FD0\\u884C\\u2014\\u2014\\u4EE4\\u724C\\u8981\\u91CD\\u542F\\u540E\\u624D\\u52A0\\u8F7D\\uFF08\\u5BC6\\u94A5\\u6587\\u4EF6\\u7684\\u76D1\\u89C6\\u5668\\u53EA\\u5728\\u542F\\u52A8\\u65F6\\u8BE5\\u6587\\u4EF6\\u5B58\\u5728\\u65F6\\u624D\\u5EFA\\uFF09\\uFF0C\\u4E0D\\u91CD\\u542F\\u4F1A\\u4E00\\u53D1\\u6D88\\u606F\\u5C31 401\\u3002";\n var FREE_TIER_START_WHEN_READY = "\\u542F\\u52A8\\u5F15\\u64CE\\u540E\\u5C31\\u4F1A\\u7528\\u4E0A\\u514D\\u8D39\\u6863\\u3002";\n\n // web-console/desktop/src/renderer/shared/free-tier-card.ts\n function renderFreeTierCard(deps) {\n const status = h("div", { class: "inline-warn", hidden: true });\n const btn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void run();\n }\n }, "\\u5207\\u6362\\u5230\\u514D\\u8D39\\u6863");\n const run = async () => {\n btn.disabled = true;\n status.hidden = false;\n status.replaceChildren(h("div", {}, FREE_TIER_RUNNING));\n let r;\n try {\n r = await deps.applyFreeTier({ provision: !deps.tokenPresent });\n } catch (e) {\n r = { ok: false, error: e?.message || String(e) };\n }\n if (!r.ok) {\n status.replaceChildren(\n h("div", {}, `\\u274C ${r.error || "\\u5207\\u6362\\u5931\\u8D25"}`),\n h("div", { style: "margin-top:6px" }, FREE_TIER_FAIL_HINT),\n h(\n "div",\n { style: "margin-top:6px" },\n h("button", { class: "btn", type: "button", onclick: () => {\n void run();\n } }, "\\u91CD\\u8BD5"),\n h(\n "span",\n { style: "margin-left:8px;color:var(--muted);font-size:14px" },\n "\\u60F3\\u7528\\u81EA\\u5DF1\\u7684 Key\\uFF1A\\u5173\\u6389\\u672C\\u7A97\\u53E3\\u91CD\\u8DD1\\u5B89\\u88C5\\u7A0B\\u5E8F\\uFF0C\\u9009\\u300C\\u91CD\\u65B0\\u914D\\u7F6E\\u300D\\u3002"\n )\n )\n );\n btn.disabled = false;\n return;\n }\n const okRows = [h("div", {}, freeTierOkText(r.baseUrl || ""))];\n if (r.primary) okRows.push(h("div", { style: "margin-top:4px;color:var(--muted)" }, `\\u4E3B\\u6A21\\u578B\\uFF1A${r.primary}`));\n okRows.push(h(\n "div",\n { style: "margin-top:6px" },\n deps.engineRunning ? FREE_TIER_RESTART_NEEDED : FREE_TIER_START_WHEN_READY\n ));\n if (deps.engineRunning && deps.restartEngine) {\n okRows.push(h("button", {\n class: "btn btn-primary",\n type: "button",\n style: "margin-top:6px",\n onclick: () => {\n deps.restartEngine();\n deps.onRefresh?.();\n }\n }, "\\u91CD\\u542F\\u5F15\\u64CE"));\n }\n status.replaceChildren(...okRows);\n btn.hidden = true;\n deps.onApplied?.();\n };\n return h(\n "div",\n { class: "report-block", id: "free-tier-card" },\n h("div", { style: "font-weight:600;margin-bottom:4px" }, "\\u{1F4A1} \\u53EF\\u4EE5\\u7528\\u514D\\u8D39\\u989D\\u5EA6"),\n h("div", { style: "line-height:1.6" }, FREE_TIER_PITCH),\n h("div", { style: "margin:8px 0" }, btn),\n status\n );\n }\n\n // web-console/desktop/src/renderer/shared/update-card.ts\n var DOWNLOAD_PAGE_URL = "https://www.twinsun.top/download/";\n function stageText(ev) {\n switch (ev.event) {\n case "downloading":\n return `\\u6B63\\u5728\\u4E0B\\u8F7D\\u66F4\\u65B0\\u2026 ${Math.max(0, Math.min(100, Math.round(ev.pct)))}%`;\n case "verifying":\n return "\\u6B63\\u5728\\u6821\\u9A8C\\u2026";\n case "stopping":\n return "\\u6B63\\u5728\\u505C\\u6B62\\u52A9\\u624B\\u2026";\n case "applying":\n return "\\u6B63\\u5728\\u5B89\\u88C5\\u2026";\n case "starting":\n return "\\u6B63\\u5728\\u91CD\\u542F\\u52A9\\u624B\\u2026";\n default:\n return "";\n }\n }\n function renderUpdateCard(deps) {\n const root = h("div", { class: "report-block", id: "update-card" });\n let state = { s: "checking" };\n let last = null;\n const paint = () => {\n root.replaceChildren(...frame());\n };\n const frame = () => {\n switch (state.s) {\n case "checking":\n return [\n title(),\n h("p", { class: "page-sub", style: "margin:6px 0" }, h("span", { class: "spinner" }), "\\u6B63\\u5728\\u68C0\\u67E5\\u66F4\\u65B0...")\n ];\n case "latest":\n return [\n title(),\n h("div", { class: "up-muted" }, last?.current ? `\\u5DF2\\u662F\\u6700\\u65B0\\u7248\\u672C v${last.current}` : "\\u5DF2\\u662F\\u6700\\u65B0\\u7248\\u672C"),\n actions([checkBtn()])\n ];\n case "available":\n return [\n title(),\n h("div", { class: "update-hint" }, `\\u53EF\\u5347\\u7EA7\\u5230 v${last?.latest ?? ""}`),\n ...last?.notes ? [h("div", { class: "up-muted" }, last.notes)] : [],\n actions([upgradeBtn()])\n ];\n case "confirming":\n return [\n title(),\n h("div", { class: "update-hint" }, `\\u53EF\\u5347\\u7EA7\\u5230 v${last?.latest ?? ""}`),\n ...last?.notes ? [h("div", { class: "up-muted" }, last.notes)] : [],\n h("div", { class: "inline-warn" }, "\\u5347\\u7EA7\\u9700\\u8981\\u91CD\\u542F\\u52A9\\u624B\\uFF0C\\u6B63\\u5728\\u8FDB\\u884C\\u7684\\u5BF9\\u8BDD\\u4F1A\\u4E2D\\u65AD\\u3002"),\n actions([\n h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n if (state.s !== "confirming") return;\n void apply();\n }\n }, "\\u786E\\u8BA4\\u5347\\u7EA7"),\n h("button", { class: "btn", type: "button", onclick: () => {\n state = { s: "available" };\n paint();\n } }, "\\u53D6\\u6D88")\n ])\n ];\n case "available-full":\n return [\n title(),\n h("div", { class: "update-hint" }, `\\u65B0\\u7248\\u672C v${last?.latest ?? ""} \\u9700\\u4E0B\\u8F7D\\u5B8C\\u6574\\u5B89\\u88C5\\u5305`),\n actions([h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => deps.openDownloadPage()\n }, "\\u524D\\u5F80\\u4E0B\\u8F7D")])\n ];\n case "progressing":\n return [\n title(),\n h("p", { class: "page-sub", style: "margin:6px 0" }, h("span", { class: "spinner" }), state.stage),\n h("div", { class: "up-muted" }, "\\u5347\\u7EA7\\u671F\\u95F4\\u8BF7\\u52FF\\u4FEE\\u6539\\u901A\\u9053\\u914D\\u7F6E\\u3002")\n ];\n case "done":\n return [\n title(),\n h("div", { class: "update-hint done" }, `\\u5DF2\\u5347\\u7EA7\\u5230 v${state.version} \\u2705`),\n actions([checkBtn()])\n ];\n case "failed":\n return [\n title(),\n h("div", { class: "inline-error" }, `\\u5347\\u7EA7\\u5931\\u8D25\\uFF1A${state.error}`),\n actions([h("button", { class: "btn", type: "button", onclick: () => {\n void check();\n } }, "\\u91CD\\u8BD5")])\n ];\n case "error-check":\n return [\n title(),\n h(\n "div",\n { class: "inline-warn" },\n "\\u68C0\\u67E5\\u66F4\\u65B0\\u5931\\u8D25\\uFF08\\u7F51\\u7EDC\\uFF09\\uFF0C\\u8BF7\\u7A0D\\u540E\\u518D\\u8BD5\\u3002",\n ...state.error ? [h("span", { class: "up-muted" }, `\\uFF08${state.error}\\uFF09`)] : []\n ),\n actions([h("button", { class: "btn", type: "button", onclick: () => {\n void check();\n } }, "\\u91CD\\u8BD5")])\n ];\n }\n };\n const title = () => h("div", { style: "font-weight:600;margin-bottom:4px" }, "\\u7248\\u672C\\u66F4\\u65B0");\n const actions = (btns) => h("div", { class: "update-actions" }, ...btns);\n const checkBtn = () => h("button", { class: "btn", type: "button", onclick: () => {\n void check();\n } }, "\\u68C0\\u67E5\\u66F4\\u65B0");\n const upgradeBtn = () => h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n if (state.s !== "available") return;\n state = { s: "confirming" };\n paint();\n }\n }, "\\u5347\\u7EA7");\n const check = async () => {\n state = { s: "checking" };\n paint();\n let r;\n try {\n r = await deps.updateCheck();\n } catch (e) {\n state = { s: "error-check", error: e instanceof Error ? e.message : String(e) };\n paint();\n return;\n }\n last = r;\n if (r.latest === null) state = { s: "error-check", error: null };\n else if (!r.hasUpdate) state = { s: "latest" };\n else state = r.depsChanged ? { s: "available-full" } : { s: "available" };\n paint();\n };\n const apply = async () => {\n state = { s: "progressing", stage: "\\u6B63\\u5728\\u51C6\\u5907\\u5347\\u7EA7..." };\n paint();\n try {\n const r = await deps.updateApply();\n if (state.s !== "progressing") return;\n state = r.ok ? { s: "done", version: r.version } : { s: "failed", error: r.error };\n } catch (e) {\n if (state.s !== "progressing") return;\n state = { s: "failed", error: e instanceof Error ? e.message : String(e) };\n }\n paint();\n };\n const off = deps.onUpdateEvent((ev) => {\n if (state.s !== "progressing") return;\n const stage = stageText(ev);\n if (!stage) return;\n state = { s: "progressing", stage };\n paint();\n });\n void check();\n return Object.assign(root, { dispose: off });\n }\n\n // web-console/desktop/src/renderer/console/companion-name.ts\n function isUnnamedCompanion(name) {\n return !name.trim() || name.trim().toLowerCase() === "agent";\n }\n\n // web-console/desktop/src/renderer/console/pages/status.ts\n async function probeState(apiPort, deps, ourStateDir = "", silentSinceMs = null) {\n const raw = await deps.apiStatus(apiPort);\n const norm = (x) => x.split(String.fromCharCode(92)).join("/").replace(/\\/+$/, "").toLowerCase();\n const ours = !raw || !raw.stateDir || !ourStateDir ? "unknown" : norm(raw.stateDir) === norm(ourStateDir) ? "yes" : "no";\n const status = ours === "yes" ? raw : null;\n const mismatch = ours === "no" ? `\\u26A0\\uFE0F \\u7AEF\\u53E3 ${apiPort} \\u4E0A\\u7684\\u5F15\\u64CE\\u4E0D\\u662F\\u672C\\u673A\\u8FD9\\u4E2A agent\\uFF08${raw.stateDir || "\\u65E7\\u7248\\u5F15\\u64CE\\uFF0C\\u62A5\\u4E0D\\u51FA\\u8EAB\\u4EFD"}\\uFF09\\u2014\\u2014\\u5DF2\\u88AB\\u522B\\u7684\\u7A0B\\u5E8F/\\u5F15\\u64CE\\u5360\\u7528\\uFF0C\\u8BF7\\u6362\\u7AEF\\u53E3\\u3002` : null;\n if (status) return { state: "running", status, silentSinceMs: null, portWarning: null };\n if (await deps.isEngineAlive()) {\n return {\n state: "warn",\n status: null,\n silentSinceMs: null,\n portWarning: mismatch ?? `\\u26A0\\uFE0F \\u7AEF\\u53E3 ${apiPort} \\u6709\\u7A0B\\u5E8F\\u5728\\u76D1\\u542C\\uFF0C\\u4F46\\u4E0D\\u54CD\\u5E94 /api/status\\u3002`\n };\n }\n const verdict = classifySilent(await deps.isEngineProcessAlive(ourStateDir), silentSinceMs, Date.now());\n const portWarning = verdict.state !== "starting" && mismatch ? mismatch : verdict.state === "stopped" ? `\\u26A0\\uFE0F \\u7AEF\\u53E3 ${apiPort} \\u4E0A\\u6CA1\\u6709\\u53EF\\u7528\\u5F15\\u64CE` : null;\n return { state: verdict.state, status: null, silentSinceMs: verdict.silentSinceMs, portWarning };\n }\n function mountStatus(body, marker, deps, actions, navigate) {\n const wrap = h(\n "div",\n { class: "page" },\n h("h2", {}, "\\u5F15\\u64CE\\u72B6\\u6001"),\n h("p", { class: "page-sub" }, h("span", { class: "spinner" }), "\\u6B63\\u5728\\u83B7\\u53D6\\u72B6\\u6001...")\n );\n body.replaceChildren(wrap);\n const runtimeDetails = h("details", { class: "design-details", id: "runtime-details" });\n let stopped = false;\n let companionName = null;\n let travelResult;\n const DOCTOR_TTL_MS = 3e4;\n let doctorAt = 0;\n let doctorReport = null;\n let lastState = null;\n let busy = null;\n let checking = false;\n let actionError = null;\n let lastStatus = null;\n let lastPortWarning = null;\n const repaint = () => {\n if (lastState) paint(lastState, lastStatus, lastPortWarning);\n };\n const runAction = async (kind, fn) => {\n if (busy) return;\n busy = kind;\n actionError = null;\n repaint();\n try {\n await fn();\n } catch (e) {\n actionError = e instanceof Error ? e.message : String(e);\n } finally {\n busy = null;\n void render();\n }\n };\n const paint = (state, status, portWarning = null) => {\n if (stopped) return;\n lastState = state;\n lastStatus = status;\n lastPortWarning = portWarning;\n const CHANNEL_ORDER = ["feishu", "wechat", "dingtalk", "wecom", "whatsapp", "telegram", "discord"];\n const channels = (status ? status.channels ?? [] : doctorReport?.channels ?? []).filter((c) => c.name !== "emotion").sort((a, b) => {\n const ia = CHANNEL_ORDER.indexOf(a.name);\n const ib = CHANNEL_ORDER.indexOf(b.name);\n return (ia === -1 ? 99 : ia) - (ib === -1 ? 99 : ib);\n });\n const version = status ? status.engine7 : doctorReport?.version ?? "";\n const pendingDoctor = !status && !doctorReport;\n const stateBadge = {\n running: { cls: "ok", text: `\\u25CF \\u8FD0\\u884C\\u4E2D${status ? `\\uFF08\\u5DF2\\u8FD0\\u884C ${fmtUptime(status.uptimeSec)}\\uFF09` : ""}` },\n starting: { cls: "starting", text: `${STATE_TEXT.starting}\\u2026` },\n stopped: { cls: "off", text: STATE_TEXT.stopped },\n warn: { cls: "warn", text: "\\u26A0\\uFE0F \\u672A\\u54CD\\u5E94\\uFF08\\u7AEF\\u53E3\\u5360\\u7528\\u6216\\u5F15\\u64CE\\u50F5\\u6B7B\\uFF0C\\u53EF\\u5C1D\\u8BD5\\u91CD\\u542F\\uFF09" }\n }[state];\n const channelRows = channels.map((c) => {\n const light = channelLight(c);\n const mark = light.status === "green" ? "\\u2713" : light.status === "amber" ? "!" : "\\u2014";\n return h(\n "div",\n { class: "light-row" },\n h("span", { class: `light ${light.status}` }, mark),\n brandBadge(c.name, true),\n h("span", { class: "light-label" }, channelLabel(c.name)),\n h("span", { class: "light-note" }, light.text)\n );\n });\n if (!channelRows.length) {\n channelRows.push(h(\n "div",\n { class: "light-row" },\n h("span", { class: "light off" }, pendingDoctor ? "\\u2026" : "\\u2014"),\n h("span", { class: "light-label" }, "\\u804A\\u5929\\u901A\\u9053"),\n h("span", { class: "light-note" }, pendingDoctor ? "\\u6B63\\u5728\\u8BFB\\u53D6\\u901A\\u9053\\u914D\\u7F6E..." : "\\u6CA1\\u6709\\u914D\\u7F6E\\u4EFB\\u4F55\\u901A\\u9053")\n ));\n }\n const running = state === "running";\n const cloudOnline = travelResult?.ok && travelResult.snapshot?.active === "cloud";\n const localOnline = travelResult?.ok && travelResult.snapshot?.active === "local";\n const travelUnknown = travelResult && (!travelResult.ok || travelResult.connected && travelResult.snapshot?.active === "unknown");\n const starting = state === "starting";\n const configured = channels.filter((c) => c.enabled && c.hasCredentials).map((c) => channelLabel(c.name));\n const goButton = (key, label, primary = false) => navigate ? h("button", { class: primary ? "btn btn-primary" : "text-action", type: "button", "data-console-go": key, "data-layout-control": "", onclick: () => navigate(key) }, label, primary ? designIcon("arrow") : null) : null;\n const overview = (icon, label, value, detail, target) => h("div", { class: "overview-card" }, h("div", { class: "overview-label" }, designIcon(icon), label), h("strong", {}, value), h("p", {}, detail), goButton(target, "\\u67E5\\u770B\\u4E0E\\u8C03\\u6574 \\u2192"));\n runtimeDetails.replaceChildren(\n h("summary", { "data-layout-control": "" }, "\\u5F15\\u64CE\\u7248\\u672C\\u4E0E\\u5B8C\\u6574\\u901A\\u9053\\u72B6\\u6001"),\n h(\n "div",\n { class: "report-block" },\n h("div", { class: "report-version" }, version ? `Engine7 v${version}` : "Engine7\\uFF08\\u7248\\u672C\\u672A\\u77E5\\uFF09"),\n h("div", { class: "report-path" }, marker.stateDir)\n ),\n h("div", { class: "report-block" }, ...channelRows)\n );\n const heading = stepHeading(\n "YOUR COMPANION, CONNECTED",\n "",\n cloudOnline ? "\\u7535\\u8111\\u4F11\\u606F\\u65F6\\uFF0C\\u4E5F\\u53EF\\u4EE5\\u5728\\u5E38\\u7528\\u804A\\u5929\\u5E73\\u53F0\\u7EE7\\u7EED\\u76F8\\u4F34\\u3002" : travelUnknown ? "\\u6B63\\u5728\\u7B49\\u5F85\\u968F\\u884C\\u673A\\u7684\\u6700\\u65B0\\u72B6\\u6001\\u3002" : running || localOnline ? "\\u804A\\u5929\\u548C\\u5DE5\\u4F5C\\uFF0C\\u90FD\\u4ECE\\u4F60\\u5E38\\u7528\\u7684\\u5E73\\u53F0\\u5F00\\u59CB\\u3002" : starting ? "\\u6B63\\u5728\\u51C6\\u5907\\uFF0C\\u7A0D\\u7B49\\u4E00\\u4F1A\\u513F\\u3002" : "\\u51C6\\u5907\\u597D\\u540E\\uFF0C\\u518D\\u5F00\\u59CB\\u5BF9\\u8BDD\\u3002"\n );\n heading.querySelector("h2").replaceChildren(\n h("button", {\n class: "companion-name name-edit",\n type: "button",\n title: "\\u70B9\\u51FB\\u540D\\u5B57\\u53EF\\u6539\\u540D",\n "aria-label": "\\u4FEE\\u6539\\u4F19\\u4F34\\u540D\\u5B57",\n onclick: () => navigate?.("settings")\n }, companionName || "\\u4F19\\u4F34"),\n cloudOnline ? "\\u5728\\u4E91\\u7AEF\\u3002" : localOnline ? "\\u5728\\u7535\\u8111\\u4E0A\\u3002" : travelUnknown ? "\\u7684\\u968F\\u884C\\u72B6\\u6001\\u5F85\\u6838\\u9A8C\\u3002" : { running: "\\u5728\\u8FD9\\u91CC\\u3002", starting: "\\u5F88\\u5FEB\\u5C31\\u6765\\u3002", warn: "\\u6682\\u65F6\\u8054\\u7CFB\\u4E0D\\u4E0A\\u3002", stopped: "\\u6B63\\u5728\\u4F11\\u606F\\u3002" }[state]\n );\n wrap.replaceChildren(\n heading,\n ...companionName !== null && isUnnamedCompanion(companionName) ? [h(\n "div",\n { class: "inline-warn", "data-companion-name": "" },\n h("p", {}, companionName ? "\\u73B0\\u5728\\u7528\\u7684\\u662F\\u9ED8\\u8BA4\\u540D\\u5B57 Agent\\u3002\\u7ED9\\u4F19\\u4F34\\u8D77\\u4E2A\\u540D\\u5B57\\uFF0C\\u4EE5\\u540E\\u5C31\\u8FD9\\u6837\\u4ECB\\u7ECD\\u81EA\\u5DF1\\u3002" : "\\u4F19\\u4F34\\u8FD8\\u6CA1\\u6709\\u540D\\u5B57\\u3002\\u8D77\\u4E2A\\u540D\\u5B57\\uFF0C\\u4EE5\\u540E\\u5C31\\u8FD9\\u6837\\u4ECB\\u7ECD\\u81EA\\u5DF1\\u3002"),\n goButton("settings", "\\u7ED9\\u4F19\\u4F34\\u8D77\\u4E2A\\u540D\\u5B57 \\u2192")\n )] : [],\n ...portWarning && !cloudOnline ? [h("div", { class: "inline-warn", "data-port-warning": "" }, portWarning)] : [],\n ...travelResult?.connected || travelUnknown ? [h(\n "section",\n { class: "travel-presence" },\n h(\n "div",\n {},\n h("h3", {}, cloudOnline ? "\\u4F19\\u4F34\\u6B63\\u5728\\u4E91\\u7AEF\\u76F8\\u4F34" : localOnline ? "\\u4F19\\u4F34\\u6B63\\u5728\\u7535\\u8111\\u76F8\\u4F34" : travelUnknown ? "\\u968F\\u884C\\u72B6\\u6001\\u672A\\u66F4\\u65B0" : "\\u968F\\u884C\\u5DF2\\u8FDE\\u63A5"),\n h("p", { class: "page-sub" }, cloudOnline ? "\\u672C\\u673A\\u5F15\\u64CE\\u53EF\\u4EE5\\u4F11\\u606F\\uFF1B\\u63A5\\u56DE\\u7535\\u8111\\u8BF7\\u4ECE\\u968F\\u884C\\u9875\\u5B8C\\u6210\\u4EA4\\u63A5\\u3002" : "\\u67E5\\u770B\\u4E24\\u7AEF\\u8FD0\\u884C\\u4F4D\\u7F6E\\u548C\\u63A5\\u7EED\\u60C5\\u51B5\\u3002")\n ),\n goButton("travel", "\\u67E5\\u770B\\u968F\\u884C \\u2192")\n )] : [],\n h(\n "section",\n { class: "runtime-welcome" },\n h(\n "div",\n {},\n h("h3", {}, running && configured.length ? "\\u60F3\\u804A\\u804A\\uFF0C\\u6216\\u8005\\u6709\\u4EF6\\u4E8B\\u9700\\u8981\\u5E2E\\u5FD9\\uFF1F" : "\\u51C6\\u5907\\u597D\\u4E86\\uFF0C\\u5C31\\u4ECE\\u8FD9\\u91CC\\u5F00\\u59CB\\u3002"),\n h("p", {}, cloudOnline || localOnline ? "\\u5728\\u5DF2\\u7ECF\\u8FDE\\u63A5\\u7684\\u804A\\u5929\\u5E73\\u53F0\\u7ED9\\u4F19\\u4F34\\u53D1\\u6D88\\u606F\\uFF0C\\u4F19\\u4F34\\u4F1A\\u7EE7\\u7EED\\u5904\\u7406\\u3002" : !running ? "\\u542F\\u52A8\\u5F15\\u64CE\\u540E\\uFF0C\\u518D\\u5230\\u804A\\u5929\\u5E73\\u53F0\\u7ED9\\u4F19\\u4F34\\u53D1\\u6D88\\u606F\\u3002" : configured.length ? `\\u5728${configured.join("\\u3001")}\\u91CC\\u627E\\u5230\\u4F60\\u914D\\u7F6E\\u7684\\u673A\\u5668\\u4EBA\\uFF0C\\u53D1\\u4E00\\u6761\\u6D88\\u606F\\u786E\\u8BA4\\u53EF\\u4EE5\\u6536\\u5230\\u56DE\\u590D\\u3002` : "\\u5148\\u8FDE\\u63A5\\u4E00\\u4E2A\\u804A\\u5929\\u5E73\\u53F0\\uFF0C\\u5C31\\u80FD\\u5728\\u90A3\\u91CC\\u7ED9\\u4F19\\u4F34\\u53D1\\u6D88\\u606F\\u3002")\n ),\n goButton("channels", configured.length ? "\\u67E5\\u770B\\u804A\\u5929\\u5165\\u53E3" : "\\u8FDE\\u63A5\\u804A\\u5929\\u5E73\\u53F0", true)\n ),\n h(\n "div",\n { class: "runtime-status-line" },\n h("div", { class: `state-badge ${stateBadge.cls}` }, travelResult?.connected || travelUnknown ? "\\u672C\\u673A\\u5F15\\u64CE\\uFF1A" + stateBadge.text : stateBadge.text),\n STATE_DETAIL[state] ? h("div", { class: "report-path" }, STATE_DETAIL[state]) : null\n ),\n h(\n "div",\n { class: "btn-row" },\n travelResult?.connected || travelUnknown ? h("button", { class: "btn btn-primary", type: "button", onclick: () => navigate?.("travel") }, cloudOnline ? "\\u63A5\\u56DE\\u7535\\u8111\\u2026" : "\\u67E5\\u770B\\u968F\\u884C\\u72B6\\u6001\\u2026") : running ? h("button", {\n class: "btn btn-danger",\n type: "button",\n disabled: busy !== null,\n title: busy ? "\\u6709\\u52A8\\u4F5C\\u6B63\\u5728\\u6267\\u884C\\uFF0C\\u8BF7\\u7A0D\\u5019" : "",\n onclick: () => {\n void runAction("stop", actions.stop);\n }\n }, busy === "stop" ? "\\u505C\\u6B62\\u5F15\\u64CE\\uFF08\\u505C\\u6B62\\u4E2D\\u2026\\uFF09" : "\\u505C\\u6B62\\u5F15\\u64CE") : h("button", {\n class: "btn btn-primary",\n type: "button",\n disabled: starting || busy !== null,\n title: starting ? "\\u5F15\\u64CE\\u6B63\\u5728\\u542F\\u52A8\\uFF0C\\u8BF7\\u7A0D\\u5019" : busy ? "\\u6709\\u52A8\\u4F5C\\u6B63\\u5728\\u6267\\u884C\\uFF0C\\u8BF7\\u7A0D\\u5019" : "",\n onclick: () => {\n void runAction("start", actions.start);\n }\n }, starting || busy === "start" ? "\\u542F\\u52A8\\u5F15\\u64CE\\uFF08\\u542F\\u52A8\\u4E2D\\u2026\\uFF09" : "\\u542F\\u52A8\\u5F15\\u64CE"),\n h("button", {\n class: "btn",\n type: "button",\n disabled: !running || busy !== null || !!travelResult?.connected || !!travelUnknown,\n title: !running ? starting ? "\\u5F15\\u64CE\\u6B63\\u5728\\u542F\\u52A8" : "\\u5F15\\u64CE\\u672A\\u8FD0\\u884C" : busy ? "\\u6709\\u52A8\\u4F5C\\u6B63\\u5728\\u6267\\u884C\\uFF0C\\u8BF7\\u7A0D\\u5019" : "",\n onclick: () => {\n void runAction("restart", actions.restart);\n }\n }, busy === "restart" ? "\\u91CD\\u542F\\u5F15\\u64CE\\uFF08\\u91CD\\u542F\\u4E2D\\u2026\\uFF09" : "\\u91CD\\u542F\\u5F15\\u64CE"),\n h("button", {\n class: "btn",\n type: "button",\n disabled: checking,\n onclick: () => {\n void runSelfCheck();\n }\n }, checking ? "\\u8FD0\\u884C\\u81EA\\u68C0\\uFF08\\u81EA\\u68C0\\u4E2D\\u2026\\uFF09" : "\\u8FD0\\u884C\\u81EA\\u68C0")\n ),\n ...actionError ? [h("div", { class: "inline-error" }, `\\u64CD\\u4F5C\\u5931\\u8D25\\uFF1A${actionError}`)] : [],\n updateCardEl,\n selfCheckBox,\n h(\n "div",\n { class: "runtime-overview" },\n overview("chat", "\\u804A\\u5929\\u5E73\\u53F0", pendingDoctor ? "\\u6B63\\u5728\\u8BFB\\u53D6\\u914D\\u7F6E\\u2026" : configured.length ? configured.join("\\u3001") : "\\u5C1A\\u672A\\u914D\\u7F6E", "\\u914D\\u7F6E\\u72B6\\u6001\\u4E0D\\u4EE3\\u8868\\u8FDE\\u63A5\\u5DF2\\u9A8C\\u8BC1\\u3002", "channels"),\n overview("key", "\\u6A21\\u578B\\u670D\\u52A1", status?.model || "\\u542F\\u52A8\\u540E\\u53EF\\u67E5\\u770B", "\\u7528\\u4E8E\\u804A\\u5929\\u3001\\u7406\\u89E3\\u56FE\\u7247\\u548C\\u5904\\u7406\\u4EFB\\u52A1\\u3002", "settings"),\n overview("heart", "\\u4F19\\u4F34\\u8BBE\\u7F6E", "\\u6309\\u4F60\\u7684\\u65B9\\u5F0F\\u76F8\\u5904", "\\u7EE7\\u7EED\\u8C03\\u6574\\u5F62\\u8C61\\u3001\\u58F0\\u97F3\\u548C\\u76F8\\u5904\\u65B9\\u5F0F\\u3002", "settings")\n ),\n runtimeDetails\n );\n };\n let silentSinceMs = null;\n const render = async () => {\n if (stopped) return null;\n const travel = deps.travelControl?.(marker.stateDir, "status").catch(() => ({ ok: false, error: "service_unavailable" }));\n const r = await probeState(marker.apiPort, deps, marker.stateDir, silentSinceMs);\n silentSinceMs = r.silentSinceMs;\n if (stopped) return null;\n paint(r.state, r.status, r.portWarning);\n if (travel) {\n const result = await travel;\n if (stopped) return null;\n travelResult = result;\n paint(r.state, r.status, r.portWarning);\n }\n if (r.status) return r.state;\n if (Date.now() - doctorAt > DOCTOR_TTL_MS) {\n doctorAt = Date.now();\n doctorReport = await deps.doctor(marker.stateDir);\n paint(r.state, r.status, r.portWarning);\n }\n return r.state;\n };\n const updateCardEl = renderUpdateCard({\n updateCheck: () => deps.updateCheck(),\n updateApply: () => deps.updateApply(),\n onUpdateEvent: (cb) => deps.onUpdateEvent(cb),\n openDownloadPage: () => {\n window.open(DOWNLOAD_PAGE_URL, "_blank");\n }\n });\n updateCardEl.classList.add("runtime-update");\n const selfCheckBox = h("div", {});\n async function runSelfCheck() {\n if (checking) return;\n checking = true;\n repaint();\n try {\n selfCheckBox.replaceChildren(\n h("div", { class: "report-block" }, h("p", { class: "page-sub" }, h("span", { class: "spinner" }), "\\u6B63\\u5728\\u8FD0\\u884C\\u81EA\\u68C0..."))\n );\n const report = await deps.doctor(marker.stateDir);\n if (!report) {\n selfCheckBox.replaceChildren(h("div", { class: "inline-error" }, "\\u81EA\\u68C0\\u5DE5\\u5177\\u6CA1\\u6709\\u8FD4\\u56DE\\u7ED3\\u679C\\u2014\\u2014\\u8BF7\\u68C0\\u67E5\\u5B89\\u88C5\\u662F\\u5426\\u5B8C\\u6574\\u3002"));\n return;\n }\n const rows = [\n lightRow("\\u914D\\u7F6E\\u6587\\u4EF6", report.configValid, report.configValid ? "\\u914D\\u7F6E\\u6709\\u6548" : `\\u914D\\u7F6E\\u65E0\\u6548${report.configError ? `\\uFF1A${report.configError}` : ""}`),\n lightRow("\\u5BC6\\u94A5\\u6587\\u4EF6", report.secrets.exists, report.secrets.exists ? `\\u5B58\\u5728\\uFF08${report.secrets.keys.length} \\u4E2A\\u5BC6\\u94A5\\uFF09` : `\\u4E0D\\u5B58\\u5728\\uFF08${report.secrets.file}\\uFF09\\u2014\\u2014API Key \\u53EF\\u80FD\\u6CA1\\u914D`),\n lightRow("API \\u7AEF\\u53E3", true, `${report.apiPort}${report.engineAlive ? "\\uFF08\\u5F15\\u64CE\\u5B58\\u6D3B\\uFF09" : "\\uFF08\\u5F15\\u64CE\\u672A\\u8FD0\\u884C\\uFF09"}`),\n lightRow("\\u5F15\\u64CE\\u8FDB\\u7A0B", report.engineAlive, report.engineAlive ? "\\u5B58\\u6D3B" : "\\u672A\\u8FD0\\u884C")\n ];\n const ft = report.freeTier;\n const needUpgrade = !!ft && (!ft.on || !ft.tokenPresent);\n const engineRunning = lastState === "running" || lastState === "starting" || lastState === "warn";\n selfCheckBox.replaceChildren(\n h(\n "div",\n { class: "report-block" },\n h("div", { style: "font-weight:600;margin-bottom:4px" }, `\\u81EA\\u68C0\\u62A5\\u544A\\uFF08Engine7 v${report.version}\\uFF09`),\n ...rows\n ),\n ...needUpgrade ? [renderFreeTierCard({\n tokenPresent: !!ft.tokenPresent,\n engineRunning,\n applyFreeTier: (o) => deps.applyFreeTier(marker.stateDir, o),\n // \u5F15\u64CE\u5728\u8DD1\u5C31\u5FC5\u987B\u91CD\u542F\uFF1Asecrets \u7684\u76D1\u89C6\u5668\u53EA\u5728\u542F\u52A8\u65F6\u6587\u4EF6\u5DF2\u5B58\u5728\u65F6\u624D\u5EFA\uFF0C\n // \u521A\u5199\u7684\u4EE4\u724C\u70ED\u52A0\u8F7D\u63A5\u4E0D\u5230\uFF08\u5F15\u64CE src/reload/reload.ts \u7684 secrets-watch\uFF09\n // \u26A0\uFE0F \u8D70 runAction\uFF0C\u522B\u76F4\u63A5 `actions.restart()`\uFF1A\u7ED5\u8FC7\u5B83\u5C31\u7B49\u4E8E\u7ED5\u5F00"\u5728\u98DE\u7981\u7528 + \u5931\u8D25\u6709\u4EBA\u63A5"\n // \u2014\u2014 \u90A3\u6B63\u662F\u672C\u6B21\u8981\u6D88\u706D\u7684\u90A3\u7C7B\u9759\u9ED8\uFF08\u5361\u7247\u8FD9\u6761\u8DEF\u4EE5\u524D\u5C31\u662F\u8FD9\u4E48\u6F0F\u7684\uFF09\u3002\n restartEngine: engineRunning ? () => {\n void runAction("restart", actions.restart);\n } : void 0,\n // \u53EA\u5728\u91CD\u542F\u4E4B\u540E\u5237\u65B0\uFF1A\u6210\u529F\u65F6\u7ACB\u523B\u91CD\u6E32\u67D3\u4F1A\u628A\u5361\u7247\u8FDE\u300C\u91CD\u542F\u5F15\u64CE\u300D\u6309\u94AE\u4E00\u8D77\u62B9\u6389\n onRefresh: () => {\n void runSelfCheck();\n }\n })] : []\n );\n } finally {\n checking = false;\n repaint();\n }\n }\n let timer = null;\n const loop = async () => {\n const state = await render();\n if (stopped) return;\n timer = setTimeout(() => {\n void loop();\n }, state === "starting" ? 2500 : 5e3);\n };\n void loop();\n void (async () => {\n try {\n const got = await deps.configGet(marker.configPath);\n if (stopped || !got.ok) return;\n const agents = got.values.agents;\n const name = agents?.defaults?.name;\n companionName = typeof name === "string" ? name.trim() : "";\n repaint();\n } catch {\n }\n })();\n return () => {\n stopped = true;\n if (timer) clearTimeout(timer);\n updateCardEl.dispose();\n };\n }\n function lightRow(label, ok, text) {\n return h(\n "div",\n { class: "light-row" },\n h("span", { class: `light ${ok ? "green" : "red"}` }, ok ? "\\u2713" : "\\u2715"),\n h("span", { class: "light-label" }, label),\n h("span", { class: "light-note" }, text)\n );\n }\n\n // web-console/desktop/src/renderer/console/partner-menu.ts\n var PARTNER_STATE_TEXT = { running: "\\u5728\\u8FD9\\u91CC", starting: "\\u6B63\\u5728\\u51C6\\u5907", stopped: "\\u6B63\\u5728\\u4F11\\u606F", warn: "\\u6682\\u65F6\\u8054\\u7CFB\\u4E0D\\u4E0A" };\n var pathKey = (p) => p.replace(/[\\\\/]+$/, "").toLowerCase();\n function mountPartnerMenu(slot, trigger, engines, marker, deps, onPick, onError) {\n let alive = true, generation = 0, busy = false, activeReads = 0;\n let timer = null;\n let queue = [];\n const silent = /* @__PURE__ */ new Map(), probing = /* @__PURE__ */ new Set();\n const ordered = [...engines.filter((e) => pathKey(e.stateDir) === pathKey(marker.stateDir)), ...engines.filter((e) => pathKey(e.stateDir) !== pathKey(marker.stateDir))];\n const bindings = ordered.map((entry) => {\n const selected = pathKey(entry.stateDir) === pathKey(marker.stateDir);\n const nameEl = h("span", { class: "partner-option-name" }, "\\u6B63\\u5728\\u8BFB\\u53D6\\u540D\\u79F0");\n const avatar = h("span", { class: "partner-option-avatar", "aria-hidden": "true" }, "\\u6816");\n const directory = h("span", { class: "partner-option-path", hidden: true }, entry.label.replace(/^Engine7\\s*[\uFF08(](.*)[\uFF09)]$/, "$1"));\n const status = h("span", { class: "partner-option-status" }, "\\u6B63\\u5728\\u83B7\\u53D6\\u72B6\\u6001");\n const button = h(\n "button",\n {\n class: "partner-option",\n type: "button",\n role: "menuitemradio",\n "aria-checked": String(selected),\n "data-state-dir": entry.stateDir,\n "data-state": "unknown",\n title: entry.stateDir\n },\n avatar,\n h("span", { class: "partner-option-copy" }, nameEl, status, directory),\n selected ? h("span", { class: "partner-current", "aria-hidden": "true" }, "\\u5F53\\u524D") : null\n );\n return { entry, selected, button, nameEl, avatar, directory, status, name: void 0 };\n });\n const list = h("div", { class: "partner-menu-list" }, ...bindings.map((b) => b.button));\n const error = h("p", { class: "partner-menu-error", role: "status", hidden: true });\n const menu = h(\n "div",\n { id: "console-partner-menu", class: "partner-menu", popover: "auto", role: "menu", "aria-label": "\\u9009\\u62E9\\u4F19\\u4F34" },\n h("div", { class: "partner-menu-heading", "aria-hidden": "true" }, h("span", {}, "\\u9009\\u62E9\\u4F19\\u4F34"), h("span", {}, `${engines.length} \\u4F4D\\u4F19\\u4F34`)),\n list,\n error\n );\n slot.append(menu);\n trigger.setAttribute("aria-haspopup", "menu");\n trigger.setAttribute("aria-controls", menu.id);\n trigger.setAttribute("aria-expanded", "false");\n const fresh = (gen) => alive && gen === generation && menu.matches(":popover-open");\n const paintNames = () => {\n for (const b of bindings) {\n const label = b.name === void 0 ? "\\u6B63\\u5728\\u8BFB\\u53D6\\u540D\\u79F0" : b.name === null ? "\\u540D\\u79F0\\u6682\\u4E0D\\u53EF\\u7528" : b.name || "\\u672A\\u547D\\u540D\\u4F19\\u4F34";\n b.nameEl.textContent = label;\n b.nameEl.title = label;\n b.avatar.textContent = Array.from(b.name || "")[0] || "\\u6816";\n const duplicate = !!b.name && bindings.some((other) => other !== b && other.name === b.name);\n b.directory.hidden = b.name === void 0 || !!b.name && !duplicate;\n }\n };\n const drain = () => {\n while (alive && activeReads < 2 && queue.length) {\n const { entry, gen } = queue.shift();\n if (!fresh(gen)) continue;\n activeReads++;\n void deps.configGet(entry.configPath).then((got) => {\n if (!fresh(gen)) return;\n const raw = got.ok ? got.values.agents?.defaults?.name : void 0;\n bindings.find((b) => b.entry === entry).name = got.ok ? typeof raw === "string" ? raw.trim() : "" : null;\n paintNames();\n }).catch(() => {\n if (fresh(gen)) {\n bindings.find((b) => b.entry === entry).name = null;\n paintNames();\n }\n }).finally(() => {\n activeReads--;\n drain();\n });\n }\n };\n const probeAll = (gen) => {\n for (const b of bindings) {\n const key = pathKey(b.entry.stateDir);\n if (probing.has(key)) continue;\n probing.add(key);\n void probeState(b.entry.apiPort, {\n apiStatus: (p) => deps.apiStatus(p),\n isEngineAlive: () => deps.isEngineAlive(b.entry.apiPort),\n isEngineProcessAlive: (d) => deps.isEngineProcessAlive(d)\n }, b.entry.stateDir, silent.get(key) ?? null).then((result) => {\n if (!fresh(gen)) return;\n silent.set(key, result.silentSinceMs);\n b.button.dataset.state = result.state;\n b.status.textContent = PARTNER_STATE_TEXT[result.state];\n }).catch(() => {\n if (fresh(gen)) {\n b.button.dataset.state = "unknown";\n b.status.textContent = "\\u72B6\\u6001\\u6682\\u4E0D\\u53EF\\u7528";\n }\n }).finally(() => {\n probing.delete(key);\n });\n }\n };\n const focusRow = (index) => {\n const row = bindings[index]?.button;\n row?.focus();\n row?.scrollIntoView({ block: "nearest" });\n };\n const close = () => {\n menu.hidePopover();\n trigger.focus();\n };\n menu.addEventListener("beforetoggle", (event) => {\n const opening = event.newState === "open";\n trigger.setAttribute("aria-expanded", String(opening));\n const gen = ++generation;\n if (timer) {\n clearInterval(timer);\n timer = null;\n }\n queue = [];\n if (!opening) return;\n const r = trigger.closest(".partner-card").getBoundingClientRect();\n const width = Math.min(320, innerWidth - 24);\n menu.style.width = `${width}px`;\n menu.style.left = `${Math.max(12, Math.min(r.right + 12, innerWidth - width - 12))}px`;\n menu.style.top = `${Math.max(12, Math.min(r.top, innerHeight - Math.min(440, innerHeight - 24) - 12))}px`;\n menu.style.maxHeight = `${Math.min(440, innerHeight - 24)}px`;\n error.hidden = true;\n for (const b of bindings) if (!b.selected) {\n b.name = void 0;\n queue.push({ entry: b.entry, gen });\n }\n paintNames();\n queueMicrotask(() => {\n if (fresh(gen)) {\n drain();\n probeAll(gen);\n }\n });\n timer = setInterval(() => {\n if (fresh(gen)) probeAll(gen);\n }, 5e3);\n });\n menu.addEventListener("toggle", () => {\n if (menu.matches(":popover-open") && !busy) focusRow(0);\n });\n menu.addEventListener("keydown", (event) => {\n const index = bindings.findIndex((b) => b.button === document.activeElement);\n const target = event.key === "ArrowDown" ? (index + 1) % bindings.length : event.key === "ArrowUp" ? (index - 1 + bindings.length) % bindings.length : event.key === "Home" ? 0 : event.key === "End" ? bindings.length - 1 : null;\n if (target !== null) {\n event.preventDefault();\n if (!busy) focusRow(target);\n }\n if (event.key === "Escape") {\n event.preventDefault();\n event.stopPropagation();\n close();\n }\n });\n trigger.addEventListener("click", () => {\n if (!busy) menu.matches(":popover-open") ? close() : menu.showPopover();\n });\n trigger.addEventListener("keydown", (event) => {\n if (event.key === "ArrowDown" && !busy) {\n event.preventDefault();\n menu.showPopover();\n }\n });\n for (const b of bindings) b.button.addEventListener("click", () => {\n if (busy) return;\n if (b.selected) {\n close();\n return;\n }\n busy = true;\n trigger.disabled = true;\n for (const row of bindings) row.button.disabled = true;\n error.hidden = true;\n onError("");\n void (async () => {\n try {\n if (await onPick(b.entry.stateDir)) {\n document.getElementById("console-partner-switch")?.focus();\n return;\n }\n } catch {\n }\n if (alive) {\n const message = "\\u5207\\u6362\\u672A\\u6210\\u529F\\uFF0C\\u8BF7\\u91CD\\u8BD5\\u3002";\n error.textContent = message;\n error.hidden = false;\n onError(message);\n }\n })().finally(() => {\n if (!alive) return;\n busy = false;\n trigger.disabled = false;\n for (const row of bindings) row.button.disabled = false;\n });\n });\n return {\n updateCurrentName(name) {\n if (alive) {\n for (const b of bindings) if (b.selected) b.name = name;\n paintNames();\n }\n },\n dispose() {\n alive = false;\n generation++;\n queue = [];\n if (timer) clearInterval(timer);\n if (menu.matches(":popover-open")) menu.hidePopover();\n menu.remove();\n }\n };\n }\n\n // web-console/desktop/src/renderer/console/partner-card.ts\n function mountPartnerCard(slot, marker, deps, onName, options) {\n let alive = true, nameGen = 0, probing = false;\n let silentSinceMs = null;\n const glyph = h("span", { class: "partner-glyph" }, "\\u6816");\n const avatar = h("span", { class: "partner-avatar", "aria-hidden": "true" }, glyph);\n const name = h("button", {\n class: "partner-name name-edit",\n type: "button",\n title: "\\u70B9\\u51FB\\u540D\\u5B57\\u53EF\\u6539\\u540D",\n "aria-label": "\\u4FEE\\u6539\\u4F19\\u4F34\\u540D\\u5B57",\n onclick: onName\n }, "\\u4F19\\u4F34");\n const state = h("span", { class: "partner-status", role: "status" }, "\\u6B63\\u5728\\u83B7\\u53D6\\u72B6\\u6001");\n const naming = h("button", { class: "partner-naming", type: "button", "data-partner-name": "", hidden: true, onclick: onName }, "\\u7ED9\\u4F19\\u4F34\\u8D77\\u4E2A\\u540D\\u5B57");\n const error = h("p", { class: "engine-picker-error", role: "status", hidden: true });\n const multi = !!options && options.engines.length > 1;\n const trigger = multi ? h("button", {\n id: "console-partner-switch",\n class: "partner-switch",\n type: "button",\n "aria-label": `\\u5207\\u6362\\u4F19\\u4F34\\uFF0C${options.engines.length}\\u4F4D\\u4F19\\u4F34`\n }, h("span", { class: "partner-count" }, String(options.engines.length)), h("span", { class: "partner-chevron", "aria-hidden": "true" })) : null;\n const card = h(\n "section",\n {\n class: "partner-card",\n "data-state": "unknown",\n "data-state-dir": marker.stateDir,\n "data-multi": String(multi),\n "aria-label": "\\u5F53\\u524D\\u4F19\\u4F34"\n },\n h("div", { class: "partner-heading" }, h("span", { class: "partner-caption" }, "\\u4E0E\\u4F60\\u76F8\\u4F34"), trigger),\n h("div", { class: "partner-identity" }, avatar, h("div", { class: "partner-info" }, name, state)),\n naming\n );\n slot.replaceChildren(card, error);\n const menu = trigger && options ? mountPartnerMenu(slot, trigger, options.engines, marker, deps, options.onPick, (message) => {\n error.textContent = message;\n error.hidden = !message;\n }) : null;\n const refreshName = () => {\n const gen = ++nameGen;\n naming.hidden = true;\n void deps.configGet(marker.configPath).then((got) => {\n if (!alive || gen !== nameGen) return;\n const agents = got.ok ? got.values.agents : void 0;\n const raw = agents?.defaults?.name;\n const label = typeof raw === "string" ? raw.trim() : "";\n name.textContent = label || "\\u4F19\\u4F34";\n glyph.textContent = Array.from(label)[0] || "\\u6816";\n naming.textContent = isUnnamedCompanion(label) ? "\\u7ED9\\u4F19\\u4F34\\u8D77\\u4E2A\\u540D\\u5B57" : "\\u6539\\u540D";\n naming.classList.toggle("partner-renaming", !isUnnamedCompanion(label));\n naming.hidden = !got.ok;\n menu?.updateCurrentName(got.ok ? label : null);\n }).catch(() => {\n if (!alive || gen !== nameGen) return;\n name.textContent = "\\u4F19\\u4F34";\n glyph.textContent = "\\u6816";\n naming.hidden = true;\n menu?.updateCurrentName(null);\n });\n };\n const refreshState = async () => {\n if (!alive || probing) return;\n probing = true;\n try {\n const result = await probeState(marker.apiPort, {\n apiStatus: (p) => deps.apiStatus(p),\n isEngineAlive: () => deps.isEngineAlive(marker.apiPort),\n isEngineProcessAlive: (d) => deps.isEngineProcessAlive(d)\n }, marker.stateDir, silentSinceMs);\n if (!alive) return;\n silentSinceMs = result.silentSinceMs;\n card.dataset.state = result.state;\n state.textContent = PARTNER_STATE_TEXT[result.state];\n if (deps.travelControl) {\n const travel = await deps.travelControl(marker.stateDir, "status");\n if (!alive) return;\n if (travel.ok && travel.snapshot?.active === "cloud") {\n card.dataset.state = "running";\n state.textContent = "\\u5728\\u4E91\\u7AEF\\u76F8\\u4F34";\n } else if (travel.ok && travel.snapshot?.active === "local") {\n card.dataset.state = "running";\n state.textContent = "\\u5728\\u7535\\u8111\\u76F8\\u4F34";\n } else if (!travel.ok || travel.connected && travel.snapshot?.active === "unknown") {\n card.dataset.state = "unknown";\n state.textContent = "\\u968F\\u884C\\u72B6\\u6001\\u672A\\u66F4\\u65B0";\n }\n }\n } catch {\n if (alive) {\n card.dataset.state = "unknown";\n state.textContent = "\\u72B6\\u6001\\u6682\\u4E0D\\u53EF\\u7528";\n }\n } finally {\n probing = false;\n }\n };\n const refresh = () => {\n if (alive) {\n refreshName();\n void refreshState();\n }\n };\n const timer = setInterval(() => {\n void refreshState();\n }, 5e3);\n return { refresh, dispose: () => {\n alive = false;\n nameGen++;\n clearInterval(timer);\n menu?.dispose();\n } };\n }\n\n // web-console/desktop/src/renderer/console/qr-modal.ts\n var QR_COUNTDOWN_SEC = 300;\n var countdownSecOf = (channel) => channel === "dingtalk" ? null : QR_COUNTDOWN_SEC;\n function startReconfigScan(channel, deps) {\n const chanLabel = channel === "feishu" ? "\\u98DE\\u4E66" : channel === "dingtalk" ? "\\u9489\\u9489" : channel === "wecom" ? "\\u4F01\\u4E1A\\u5FAE\\u4FE1" : "\\u5FAE\\u4FE1";\n const scanHint = channel === "wechat" ? "\\u786E\\u8BA4\\u767B\\u5F55" : channel === "wecom" ? "\\u6309\\u63D0\\u793A\\u70B9\\u300C\\u4E00\\u952E\\u521B\\u5EFA\\u667A\\u80FD\\u673A\\u5668\\u4EBA\\u300D" : "\\u5B8C\\u6210\\u6388\\u6743";\n let modal = null;\n let countdownTimer = null;\n let left = 0;\n let doneCb = null;\n let stopped = false;\n const clearCountdown = () => {\n if (countdownTimer) {\n clearInterval(countdownTimer);\n countdownTimer = null;\n }\n };\n const closeModal = () => {\n if (modal) {\n modal.close();\n modal = null;\n }\n };\n const stop = () => {\n if (stopped) return;\n stopped = true;\n unsub();\n clearCountdown();\n closeModal();\n };\n const cancelAndStop = () => {\n if (stopped) return;\n void deps.cancelReconfig().catch(() => {\n });\n stop();\n };\n const tick = () => {\n if (left <= 0) return;\n left -= 1;\n const el = modal?.root.querySelector(".countdown");\n if (el) el.textContent = `\\u4E8C\\u7EF4\\u7801 ${Math.floor(left / 60)}:${String(left % 60).padStart(2, "0")} \\u5185\\u6709\\u6548\\uFF0C\\u7B49\\u5F85\\u626B\\u7801...`;\n };\n const closeX = () => h("button", {\n class: "modal-close",\n type: "button",\n title: "\\u53D6\\u6D88\\u626B\\u7801",\n "aria-label": "\\u53D6\\u6D88\\u626B\\u7801",\n onclick: () => cancelAndStop()\n }, "\\xD7");\n const showModal = (title, body) => {\n const box = h("div", { class: "modal" }, closeX(), h("h3", {}, title), ...body);\n if (modal) modal.root.replaceChildren(box);\n else modal = openModal(box);\n };\n const showQr = (url) => {\n const img = h("img", { class: "qr", alt: "\\u4E8C\\u7EF4\\u7801", width: 260, height: 260 });\n const countdown = h("div", { class: "countdown" }, "\\u7B49\\u5F85\\u626B\\u7801...");\n const secs = countdownSecOf(channel);\n showModal(`${chanLabel}\\u626B\\u7801`, [\n h("p", { class: "modal-sub" }, `\\u7528\\u624B\\u673A${chanLabel}\\u626B\\u63CF\\u4E8C\\u7EF4\\u7801${scanHint}`),\n img,\n countdown\n ]);\n qrDataUrl(url).then((data) => {\n img.src = data;\n }).catch(() => {\n countdown.textContent = "\\u4E8C\\u7EF4\\u7801\\u6E32\\u67D3\\u5931\\u8D25\\uFF0C\\u4F46\\u626B\\u7801\\u6D41\\u7A0B\\u4ECD\\u5728\\u8FDB\\u884C\\u2014\\u2014\\u8BF7\\u7B49\\u5F85\\u7ED3\\u679C";\n });\n clearCountdown();\n if (secs != null) {\n left = secs;\n countdownTimer = setInterval(tick, 1e3);\n tick();\n }\n };\n const showTimeout = () => {\n clearCountdown();\n showModal(`${chanLabel}\\u626B\\u7801\\u672A\\u5B8C\\u6210`, [\n // \u9489\u9489\uFF1A2h \u7A97\u53E3\u5185\u624D\u4F1A\u8D70\u5230\u8FD9\uFF08GUI \u5E3D\u4E4B\u4E0B\u5B9E\u9645\u6765\u6E90\u662F\u6388\u6743\u88AB\u62D2\uFF09\uFF1B\u98DE\u4E66/\u5FAE\u4FE1\uFF1A5 \u5206\u949F\u5F15\u64CE\u8D85\u65F6\u3002\n // \u4E0D\u5199\u6B7B\u5206\u949F\u6570\u2014\u2014\u5F52\u56E0\u6587\u6848\u5931\u771F\u6BD4\u4E0D\u5199\u66F4\u7CDF\uFF08review #2\uFF09\n h("p", { class: "modal-sub" }, channel === "dingtalk" ? "\\u672C\\u8F6E\\u6388\\u6743\\u672A\\u5B8C\\u6210\\uFF08\\u53EF\\u80FD\\u5DF2\\u5728\\u624B\\u673A\\u4E0A\\u62D2\\u7EDD\\uFF09\\u3002" : "\\u8D85\\u8FC7 5 \\u5206\\u949F\\u672A\\u5B8C\\u6210\\u626B\\u7801\\u3002"),\n h(\n "div",\n { class: "modal-actions" },\n h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n closeModal();\n void runOnce();\n }\n // \u540C\u4E00 session \u5185\u91CD\u8DD1\uFF08\u8BA2\u9605/\u56DE\u8C03\u90FD\u7559\u7740\uFF09\n }, "\\u91CD\\u8BD5\\uFF08\\u6362\\u65B0\\u4E8C\\u7EF4\\u7801\\uFF09"),\n h("button", { class: "btn", type: "button", onclick: () => cancelAndStop() }, "\\u53D6\\u6D88")\n )\n ]);\n };\n const showFailure = (text) => {\n showModal(`${chanLabel}\\u914D\\u7F6E\\u5931\\u8D25`, [\n h("p", { class: "modal-sub" }, text),\n h(\n "div",\n { class: "modal-actions" },\n h("button", { class: "btn", type: "button", onclick: () => cancelAndStop() }, "\\u5173\\u95ED")\n )\n ]);\n };\n async function runOnce() {\n if (stopped) return;\n showModal(`${chanLabel}\\u626B\\u7801`, [\n h("p", { class: "modal-sub" }, "\\u6B63\\u5728\\u751F\\u6210\\u4E8C\\u7EF4\\u7801\\uFF0C\\u8BF7\\u7A0D\\u5019...")\n ]);\n const r = await deps.runReconfig(channel, deps.stateDir, deps.configName);\n if (stopped) return;\n if (r.code === 2) showTimeout();\n else if (r.code !== 0 && !modal) {\n showFailure(`\\u547D\\u4EE4\\u5F02\\u5E38\\u9000\\u51FA\\uFF08\\u9000\\u51FA\\u7801 ${r.code}\\uFF09\\u3002\\u8BF7\\u67E5\\u770B\\u5F15\\u64CE\\u65E5\\u5FD7\\u3002`);\n } else if (r.code !== 0 && modal) {\n showFailure(`\\u626B\\u7801\\u6D41\\u7A0B\\u88AB\\u4E2D\\u65AD\\uFF08\\u9000\\u51FA\\u7801 ${r.code}\\uFF09\\u3002\\u8BF7\\u91CD\\u8BD5\\uFF1B\\u82E5\\u590D\\u73B0\\u8BF7\\u67E5\\u770B\\u5F15\\u64CE\\u65E5\\u5FD7\\u3002`);\n }\n }\n const unsub = deps.onEngineEvent((ev) => {\n if (stopped) return;\n if (ev.event === "qr") showQr(ev.url);\n else if (ev.event === "qr_timeout") showTimeout();\n else if (ev.event === "error") {\n showModal(`${chanLabel}\\u914D\\u7F6E\\u5931\\u8D25`, [\n h("p", { class: "modal-sub", style: "text-align:left;white-space:pre-wrap;user-select:text" }, ev.message),\n h(\n "div",\n { class: "modal-actions" },\n h("button", { class: "btn", type: "button", onclick: () => cancelAndStop() }, "\\u5173\\u95ED")\n )\n ]);\n } else if (ev.event === "done") {\n stop();\n doneCb?.(ev);\n }\n });\n void runOnce();\n return {\n stop,\n onDone(cb) {\n doneCb = cb;\n }\n };\n }\n function confirmWechatNewBot(onConfirm) {\n const box = h(\n "div",\n { class: "modal" },\n h("h3", {}, "\\u5FAE\\u4FE1\\u914D\\u7F6E\\u987B\\u77E5"),\n h(\n "div",\n { class: "note-box", style: "text-align:left" },\n h(\n "ul",\n { style: "margin:0;padding-left:20px;line-height:2" },\n h("li", {}, "\\u4E00\\u4E2A\\u5FAE\\u4FE1\\u53F7\\u53EA\\u80FD\\u7ED1\\u5B9A\\u4E00\\u4E2A bot\\u2014\\u2014\\u914D\\u7F6E\\u65B0 bot \\u4F1A\\u8986\\u76D6\\u751F\\u6210\\uFF0C\\u539F\\u7ED1\\u5B9A\\u5931\\u6548"),\n h("li", {}, "bot \\u4E0D\\u8FDB\\u7FA4\\uFF08\\u53EA\\u652F\\u6301\\u79C1\\u804A\\uFF09")\n )\n ),\n h(\n "div",\n { class: "modal-actions" },\n h("button", { class: "btn", type: "button", onclick: () => m.close() }, "\\u53D6\\u6D88"),\n h("button", { class: "btn btn-primary", type: "button", onclick: () => {\n m.close();\n onConfirm();\n } }, "\\u6211\\u5DF2\\u77E5\\u6653\\uFF0C\\u5F00\\u59CB\\u626B\\u7801")\n )\n );\n const m = openModal(box);\n }\n var WA_POLL_MS = 3e3;\n var WA_SUCCESS_AUTOCLOSE_MS = 3e3;\n function waStatusLine(status) {\n switch (status) {\n case "not-linked":\n return "\\u672A\\u914D\\u5BF9\\u2014\\u2014\\u7B49\\u5F85\\u626B\\u7801";\n case "connecting":\n return "\\u6B63\\u5728\\u8FDE\\u63A5 WhatsApp\\u2026";\n case "waiting-qr":\n return "\\u7B49\\u5F85\\u626B\\u7801\\u2026\\uFF08\\u4E8C\\u7EF4\\u7801\\u7EA6 20 \\u79D2\\u8F6E\\u6362\\u4E00\\u6B21\\uFF09";\n case "connected":\n return "\\u5DF2\\u8FDE\\u63A5";\n case "logged-out":\n return "\\u767B\\u5F55\\u5DF2\\u5931\\u6548";\n case "conflict":\n return "\\u8FDE\\u63A5\\u51B2\\u7A81";\n case "stopped":\n return "\\u901A\\u9053\\u672A\\u8FD0\\u884C\\uFF08\\u542F\\u7528\\u540E\\u9700\\u91CD\\u542F\\u5F15\\u64CE\\uFF09";\n default:\n return `\\u72B6\\u6001\\uFF1A${status}`;\n }\n }\n function startWaScan(apiPort, deps) {\n let modal = null;\n let pollTimer = null;\n let autoCloseTimer = null;\n let renderedKind = "";\n let renderedVersion = null;\n let stopped = false;\n let inFlight = false;\n const clearTimers = () => {\n if (pollTimer) {\n clearInterval(pollTimer);\n pollTimer = null;\n }\n if (autoCloseTimer) {\n clearTimeout(autoCloseTimer);\n autoCloseTimer = null;\n }\n };\n const close = () => {\n if (stopped) return;\n stopped = true;\n clearTimers();\n modal?.close();\n modal = null;\n deps.onClose?.();\n };\n const showModal = (body) => {\n const box = h(\n "div",\n { class: "modal" },\n h("button", { class: "modal-close", type: "button", title: "\\u5173\\u95ED", "aria-label": "\\u5173\\u95ED", onclick: () => close() }, "\\xD7"),\n h("h3", {}, "WhatsApp \\u626B\\u7801\\u767B\\u5F55"),\n ...body\n );\n if (modal) modal.root.replaceChildren(box);\n else modal = openModal(box);\n };\n const hints = () => [\n h("p", { class: "modal-sub" }, "\\u624B\\u673A WhatsApp \\u2192 \\u8BBE\\u7F6E \\u2192 \\u5DF2\\u5173\\u8054\\u7684\\u8BBE\\u5907 \\u2192 \\u5173\\u8054\\u8BBE\\u5907 \\u2192 \\u626B\\u4E00\\u626B"),\n h("p", { class: "countdown" }, \'\\u914D\\u5BF9\\u540E\\u7684\\u8BBE\\u5907\\u540D\\u4F1A\\u663E\\u793A\\u4E3A "Chrome"\\u2014\\u2014\\u8FD9\\u662F engine7 \\u7684\\u63A5\\u5165\\u65B9\\u5F0F\\uFF0C\\u4E0D\\u662F\\u914D\\u9519\\u4E86\')\n ];\n const renderWaiting = (line) => {\n renderedKind = "waiting";\n renderedVersion = null;\n showModal([\n ...hints(),\n h("p", { class: "countdown" }, line)\n ]);\n };\n const renderUnreachable = () => {\n renderedKind = "unreachable";\n showModal([\n h("p", { class: "modal-sub" }, "\\u6682\\u65F6\\u8FDE\\u4E0D\\u4E0A\\u5F15\\u64CE\\u7684 WhatsApp \\u63A5\\u53E3\\u2014\\u2014\\u8BF7\\u786E\\u8BA4\\u5F15\\u64CE\\u5DF2\\u542F\\u52A8\\uFF1B\\u65E7\\u7248\\u672C\\u5F15\\u64CE\\u6CA1\\u6709\\u8FD9\\u6761\\u63A5\\u53E3\\uFF0C\\u8BF7\\u5148\\u5347\\u7EA7\\u3002"),\n h("p", { class: "countdown" }, "\\u6BCF 3 \\u79D2\\u81EA\\u52A8\\u91CD\\u8BD5\\u2026")\n ]);\n };\n const renderSuccess = () => {\n renderedKind = "success";\n showModal([\n h("p", { class: "modal-sub" }, "\\u2705 \\u5DF2\\u8FDE\\u63A5\\u2014\\u2014\\u901A\\u9053\\u5DF2\\u5C31\\u7EEA\\uFF0C\\u65E0\\u9700\\u91CD\\u542F\\u5F15\\u64CE\\u3002"),\n h("p", { class: "countdown" }, "\\u7A97\\u53E3\\u5373\\u5C06\\u81EA\\u52A8\\u5173\\u95ED\\u2026")\n ]);\n autoCloseTimer = setTimeout(() => close(), WA_SUCCESS_AUTOCLOSE_MS);\n };\n const renderError = (status) => {\n renderedKind = `error:${status}`;\n const text = status === "logged-out" ? "\\u767B\\u5F55\\u5DF2\\u5931\\u6548\\uFF08\\u624B\\u673A\\u7AEF\\u89E3\\u7ED1\\u6216\\u51ED\\u8BC1\\u4F5C\\u5E9F\\uFF09\\u3002\\u70B9\\u300C\\u91CD\\u8BD5\\u300D\\u91CD\\u65B0\\u53D1\\u8D77\\u914D\\u5BF9\\u626B\\u7801\\u3002" : "\\u8FDE\\u63A5\\u51B2\\u7A81\\uFF1A\\u672C\\u673A\\u8FDE\\u63A5\\u88AB\\u5176\\u5B83\\u5DF2\\u5173\\u8054\\u8BBE\\u5907\\u53D6\\u4EE3\\u3002\\u8BF7\\u5230\\u624B\\u673A\\u300C\\u5DF2\\u5173\\u8054\\u7684\\u8BBE\\u5907\\u300D\\u68C0\\u67E5\\u6709\\u6CA1\\u6709\\u591A\\u51FA\\u6765\\u7684\\u8BBE\\u5907\\uFF0C\\u5904\\u7406\\u540E\\u91CD\\u8BD5\\u3002";\n showModal([\n h("p", { class: "modal-sub" }, text),\n h(\n "div",\n { class: "modal-actions" },\n h("button", { class: "btn btn-primary", type: "button", onclick: () => retry() }, "\\u91CD\\u8BD5"),\n h("button", { class: "btn", type: "button", onclick: () => close() }, "\\u5173\\u95ED")\n )\n ]);\n };\n const renderQr = (payload) => {\n renderedKind = "qr";\n renderedVersion = payload.version;\n const img = h("img", { class: "qr", alt: "WhatsApp \\u4E8C\\u7EF4\\u7801", width: 260, height: 260 });\n const version = payload.version;\n showModal([\n ...hints(),\n img,\n h("p", { class: "countdown" }, waStatusLine(payload.status))\n ]);\n void qrDataUrl(payload.qr ?? "").then((data) => {\n if (!stopped && renderedKind === "qr" && renderedVersion === version) img.src = data;\n }).catch(() => {\n if (!stopped && renderedKind === "qr" && renderedVersion === version) {\n img.replaceWith(h("p", { class: "modal-sub" }, "\\u4E8C\\u7EF4\\u7801\\u6E32\\u67D3\\u5931\\u8D25\\u2014\\u2014\\u70B9 \\xD7 \\u5173\\u95ED\\u540E\\u91CD\\u8BD5\\uFF0C\\u6216\\u7528\\u6D4F\\u89C8\\u5668\\u76F4\\u63A5\\u6253\\u5F00\\u5F15\\u64CE\\u7684 /api/whatsapp/qr \\u9875"));\n }\n });\n };\n const tick = async () => {\n if (stopped || inFlight) return;\n inFlight = true;\n const payload = await deps.fetchWaQr(apiPort).catch(() => null);\n inFlight = false;\n if (stopped) return;\n if (!payload) {\n if (renderedKind !== "unreachable") renderUnreachable();\n return;\n }\n if (payload.status === "connected") {\n if (renderedKind !== "success") {\n clearTimers();\n renderSuccess();\n }\n return;\n }\n if (payload.status === "logged-out" || payload.status === "conflict") {\n if (renderedKind !== `error:${payload.status}`) {\n clearTimers();\n renderError(payload.status);\n }\n return;\n }\n if (!payload.qr) {\n if (renderedKind !== "waiting") renderWaiting(waStatusLine(payload.status));\n return;\n }\n if (renderedKind !== "qr" || renderedVersion !== payload.version) renderQr(payload);\n };\n const retry = () => {\n if (stopped) return;\n renderedKind = "";\n renderedVersion = null;\n clearTimers();\n pollTimer = setInterval(() => {\n void tick();\n }, WA_POLL_MS);\n void tick();\n };\n renderWaiting("\\u6B63\\u5728\\u8FDE\\u63A5\\u5F15\\u64CE\\u2026");\n retry();\n return { stop: close };\n }\n\n // web-console/desktop/src/renderer/console/pages/channels.ts\n var splitList = (v) => v.split(",").map((s) => s.trim()).filter((s) => s.length > 0);\n var advanced = (label, ...children) => h("details", { class: "chan-advanced" }, h("summary", {}, label), ...children);\n function mountChannels(body, marker, deps, actions) {\n const banner = h("div", { class: "inline-warn", hidden: true });\n const showRestartBanner = () => {\n banner.hidden = false;\n banner.replaceChildren(\n "\\u914D\\u7F6E\\u5DF2\\u5199\\u5165\\uFF0C\\u91CD\\u542F\\u5F15\\u64CE\\u540E\\u751F\\u6548\\u3002",\n h("button", { class: "btn btn-primary", type: "button", style: "margin-left:12px", onclick: () => actions.restart() }, "\\u91CD\\u542F\\u5F15\\u64CE")\n );\n };\n const wrap = h(\n "div",\n { class: "page" },\n h("h2", {}, "\\u804A\\u5929\\u901A\\u9053"),\n h("p", { class: "page-sub" }, "\\u5404\\u901A\\u9053\\u7684\\u542F\\u7528\\u72B6\\u6001\\u4E0E\\u7BA1\\u7406\\u3002\\u626B\\u7801\\u7C7B\\u901A\\u9053\\uFF08\\u98DE\\u4E66/\\u5FAE\\u4FE1\\uFF09\\u91CD\\u914D\\u540E\\u9700\\u8981\\u91CD\\u542F\\u5F15\\u64CE\\u751F\\u6548\\u3002"),\n banner\n );\n let session = null;\n let stopped = false;\n const configFileName = () => marker.configPath.split(/[\\\\/]/).pop() || void 0;\n const startScan = (channel) => {\n if (session) {\n session.stop();\n void deps.cancelReconfig().catch(() => {\n });\n }\n session = startReconfigScan(channel, {\n runReconfig: deps.runReconfig,\n cancelReconfig: deps.cancelReconfig,\n onEngineEvent: (cb) => deps.onEngineEvent(cb),\n stateDir: marker.stateDir,\n configName: configFileName()\n });\n session.onDone((ev) => {\n showRestartBanner();\n void load();\n setTimeout(() => {\n void load(true);\n }, 2500);\n if (ev.channel === "dingtalk") {\n void deps.readDingtalkConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n dtEnabledCb.checked = cfg.enabled;\n dtClientIdInput.value = cfg.clientId;\n dtSecretInput.value = cfg.clientSecret;\n dtAllowInput.value = cfg.allowedUsers.join(", ");\n dtExtChatsInput.value = cfg.externalChannels.join(", ");\n dtPolicySel.value = cfg.groupPolicy;\n });\n }\n if (ev.channel === "wecom") {\n void deps.readWecomConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n fillWecom(cfg);\n });\n }\n });\n };\n const fsPolicySel = h(\n "select",\n {},\n h("option", { value: "mention-only" }, "mention-only \\u2014\\u2014 \\u7FA4\\u91CC\\u8981 @ \\u52A9\\u7406\\u624D\\u56DE\\u5E94\\uFF08\\u9ED8\\u8BA4\\uFF09"),\n h("option", { value: "open" }, "open \\u2014\\u2014 \\u6240\\u6709\\u7FA4\\u4E0D\\u7528 @ \\u4E5F\\u56DE\\u5E94")\n );\n const fsOpenInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684\\u7FA4 chat_id\\uFF1B\\u7B56\\u7565\\u4E3A mention-only \\u65F6\\u8FD9\\u4E9B\\u7FA4\\u514D @ \\u76F4\\u63A5\\u770B\\u5230"\n });\n const fsExtInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684\\u7FA4 chat_id\\uFF1B\\u5217\\u5165\\u7684\\u7FA4\\u6309\\u5BF9\\u5916\\u573A\\u5408\\u5BF9\\u5F85"\n });\n const fsSaveErr = h("div", { class: "qr-error", hidden: true });\n const fsSaveBtn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void onFsSave();\n }\n }, "\\u4FDD\\u5B58\\u7FA4\\u8BBE\\u7F6E");\n async function onFsSave() {\n fsSaveBtn.disabled = true;\n fsSaveErr.hidden = true;\n const r = await deps.updateFeishuConfig(marker.configPath, marker.stateDir, {\n policy: fsPolicySel.value,\n openGroups: splitList(fsOpenInput.value),\n externalChannels: splitList(fsExtInput.value)\n });\n fsSaveBtn.disabled = false;\n if (!r.ok) {\n fsSaveErr.hidden = false;\n fsSaveErr.textContent = r.error ?? "\\u4FDD\\u5B58\\u5931\\u8D25";\n return;\n }\n showRestartBanner();\n }\n void deps.readFeishuConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n fsPolicySel.value = cfg.policy;\n fsOpenInput.value = cfg.openGroups.join(", ");\n fsExtInput.value = cfg.externalChannels.join(", ");\n });\n const feishuCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("feishu"),\n h("span", { class: "chan-name" }, "\\u98DE\\u4E66"),\n h("span", { class: "chan-light", "data-chan": "feishu" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u4F01\\u4E1A\\u81EA\\u5EFA\\u5E94\\u7528\\u63A5\\u5165\\u3002\\u91CD\\u65B0\\u626B\\u7801\\u4F1A\\u8D70\\u5FEB\\u901F\\u6CE8\\u518C\\u6D41\\u7A0B\\uFF0C\\u751F\\u6210\\u65B0\\u7684\\u5E94\\u7528\\u51ED\\u8BC1\\u3002"),\n h("button", { class: "btn", type: "button", onclick: () => startScan("feishu") }, "\\u91CD\\u65B0\\u626B\\u7801"),\n h(\n "form",\n {\n onsubmit: (e) => {\n e.preventDefault();\n void onFsSave();\n }\n },\n advanced(\n "\\u7FA4\\u8BBE\\u7F6E\\uFF08\\u9AD8\\u7EA7\\uFF09",\n h("div", { class: "field" }, h("label", {}, "\\u7FA4\\u7B56\\u7565"), fsPolicySel),\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u514D @ \\u7684\\u7FA4"),\n fsOpenInput,\n h("p", { class: "cf-hint" }, "\\u7B56\\u7565\\u4E3A mention-only \\u65F6\\uFF0C\\u8FD9\\u4E9B\\u7FA4\\u91CC\\u7684\\u6D88\\u606F\\u4E0D\\u7528 @ \\u52A9\\u7406\\u5979\\u4E5F\\u80FD\\u770B\\u5230")\n ),\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u5BF9\\u5916\\u7FA4"),\n fsExtInput,\n h("p", { class: "cf-hint" }, "\\u6709\\u5916\\u4EBA\\u5728\\u7684\\u7FA4\\uFF1A\\u52A9\\u7406\\u5728\\u8FD9\\u4E9B\\u7FA4\\u91CC\\u4E0D\\u663E\\u793A\\u601D\\u8003/\\u5DE5\\u5177\\u8FC7\\u7A0B\\u3001\\u8BF4\\u8BDD\\u66F4\\u8C28\\u614E")\n ),\n fsSaveErr,\n fsSaveBtn\n )\n )\n );\n const wechatCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("wechat"),\n h("span", { class: "chan-name" }, "\\u5FAE\\u4FE1"),\n h("span", { class: "chan-light", "data-chan": "wechat" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u626B\\u7801\\u767B\\u5F55\\u751F\\u6210 bot \\u51ED\\u8BC1\\u3002"),\n // spec \u786C\u8981\u6C42\uFF1A\u4E00\u4E2A\u5FAE\u4FE1\u53F7\u53EA\u80FD\u7ED1\u4E00\u4E2A bot\uFF1Bbot \u4E0D\u8FDB\u7FA4\u2014\u2014\u8B66\u544A\u5148\u884C\uFF0C\u786E\u8BA4\u540E\u624D\u626B\u7801\n h("button", {\n class: "btn",\n type: "button",\n onclick: () => confirmWechatNewBot(() => startScan("wechat"))\n }, "\\u914D\\u7F6E\\u65B0 bot")\n );\n const enabledCb = h("input", { type: "checkbox", id: "dc-enabled" });\n const tokenInput = h("input", { type: "password", placeholder: "Bot Token" });\n const userIdInput = h("input", { type: "text", placeholder: "\\u4F60\\u7684 Discord User ID" });\n const saveErr = h("div", { class: "qr-error", hidden: true });\n const saveBtn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void onSave();\n }\n }, "\\u4FDD\\u5B58 Discord \\u914D\\u7F6E");\n const discordCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("discord"),\n h("span", { class: "chan-name" }, "Discord"),\n h("span", { class: "chan-light", "data-chan": "discord" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u76F4\\u5199\\u914D\\u7F6E\\u6587\\u4EF6\\uFF08token/userId\\uFF09\\uFF0C\\u4FDD\\u5B58\\u540E\\u91CD\\u542F\\u5F15\\u64CE\\u751F\\u6548\\u3002"),\n h(\n "form",\n {\n onsubmit: (e) => {\n e.preventDefault();\n void onSave();\n }\n },\n h("div", { class: "check-row" }, enabledCb, h("label", { for: "dc-enabled" }, "\\u542F\\u7528 Discord")),\n h("div", { class: "field" }, h("label", {}, "Bot Token"), tokenInput),\n h("div", { class: "field" }, h("label", {}, "User ID"), userIdInput),\n saveErr,\n saveBtn\n )\n );\n async function onSave() {\n saveBtn.disabled = true;\n saveErr.hidden = true;\n const r = await deps.updateChannelConfig(marker.configPath, marker.stateDir, {\n enabled: enabledCb.checked,\n token: tokenInput.value.trim(),\n userId: userIdInput.value.trim()\n });\n saveBtn.disabled = false;\n if (!r.ok) {\n saveErr.hidden = false;\n saveErr.textContent = r.error ?? "\\u4FDD\\u5B58\\u5931\\u8D25";\n return;\n }\n showRestartBanner();\n }\n const tgEnabledCb = h("input", { type: "checkbox", id: "tg-enabled" });\n const tgTokenInput = h("input", { type: "password", placeholder: "Bot Token" });\n const tgPolicySel = h(\n "select",\n {},\n h("option", { value: "open" }, "open \\u2014\\u2014 \\u6240\\u6709\\u4EBA\\u53EF\\u79C1\\u804A"),\n h("option", { value: "allowlist" }, "allowlist \\u2014\\u2014 \\u4EC5\\u767D\\u540D\\u5355\\u53EF\\u79C1\\u804A"),\n h("option", { value: "disabled" }, "disabled \\u2014\\u2014 \\u62D2\\u6536\\u79C1\\u804A")\n );\n const tgAllowInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684 Telegram \\u6570\\u5B57 ID\\uFF0C\\u7559\\u7A7A=dmPolicy open \\u65F6\\u65E0\\u9650\\u5236"\n });\n const tgSaveErr = h("div", { class: "qr-error", hidden: true });\n const tgSaveBtn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void onTgSave();\n }\n }, "\\u4FDD\\u5B58 Telegram \\u914D\\u7F6E");\n const telegramCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("telegram"),\n h("span", { class: "chan-name" }, "Telegram"),\n h("span", { class: "chan-light", "data-chan": "telegram" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u627E @BotFather \\u2192 /newbot \\u2192 \\u7C98\\u8D34 token\\u3002\\u76F4\\u5199\\u914D\\u7F6E\\u6587\\u4EF6\\uFF0C\\u4FDD\\u5B58\\u540E\\u91CD\\u542F\\u5F15\\u64CE\\u751F\\u6548\\u3002"),\n h(\n "form",\n {\n onsubmit: (e) => {\n e.preventDefault();\n void onTgSave();\n }\n },\n h("div", { class: "check-row" }, tgEnabledCb, h("label", { for: "tg-enabled" }, "\\u542F\\u7528 Telegram")),\n h("div", { class: "field" }, h("label", {}, "Bot Token"), tgTokenInput),\n advanced(\n "\\u8C01\\u80FD\\u79C1\\u804A\\u5B83\\uFF08\\u9AD8\\u7EA7\\uFF09",\n h("div", { class: "field" }, h("label", {}, "\\u79C1\\u804A\\u7B56\\u7565"), tgPolicySel),\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u5141\\u8BB8\\u79C1\\u804A\\u7684\\u4EBA"),\n tgAllowInput,\n h("p", { class: "cf-hint" }, "Telegram \\u6570\\u5B57 ID\\uFF0C\\u9017\\u53F7\\u5206\\u9694\\uFF1B\\u7B56\\u7565\\u9009\\u300C\\u4EC5\\u767D\\u540D\\u5355\\u300D\\u65F6\\u751F\\u6548")\n )\n ),\n tgSaveErr,\n tgSaveBtn\n )\n );\n async function onTgSave() {\n tgSaveBtn.disabled = true;\n tgSaveErr.hidden = true;\n const r = await deps.updateTelegramConfig(marker.configPath, marker.stateDir, {\n enabled: tgEnabledCb.checked,\n token: tgTokenInput.value.trim(),\n dmPolicy: tgPolicySel.value,\n // \u4E00\u683C\u9017\u53F7\u5206\u9694 \u2192 \u6570\u7EC4\uFF1A\u7559\u7A7A = []\uFF08\u5F15\u64CE\u8BED\u4E49\uFF1Aallowlist \u4E0B\u5168\u62D2\uFF0Copen \u4E0B\u4E0D\u53C2\u4E0E\u5224\u5B9A\u2014\u2014\u4E0E\u5360\u4F4D\u7B26\u6587\u6848\u4E00\u81F4\uFF09\n allowFrom: splitList(tgAllowInput.value)\n });\n tgSaveBtn.disabled = false;\n if (!r.ok) {\n tgSaveErr.hidden = false;\n tgSaveErr.textContent = r.error ?? "\\u4FDD\\u5B58\\u5931\\u8D25";\n return;\n }\n showRestartBanner();\n }\n const dtEnabledCb = h("input", { type: "checkbox", id: "dt-enabled" });\n const dtClientIdInput = h("input", { type: "text", placeholder: "Client ID\\uFF08AppKey\\uFF09" });\n const dtSecretInput = h("input", { type: "password", placeholder: "Client Secret\\uFF08AppSecret\\uFF09" });\n const dtAllowInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684 staffId/senderId\\uFF0C\\u7559\\u7A7A=\\u6240\\u6709\\u4EBA\\u53EF\\u79C1\\u804A"\n });\n const dtExtChatsInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684\\u7FA4 cid\\uFF0C\\u7559\\u7A7A = \\u4E0D\\u5F00\\u542F"\n });\n const dtPolicySel = h(\n "select",\n {},\n h("option", { value: "mention-only" }, "mention-only \\u2014\\u2014 \\u7FA4\\u91CC\\u8981 @ \\u52A9\\u7406\\u624D\\u56DE\\u5E94\\uFF08\\u9ED8\\u8BA4\\uFF09"),\n h("option", { value: "open" }, "open \\u2014\\u2014 \\u6240\\u6709\\u7FA4\\u4E0D\\u7528 @ \\u4E5F\\u56DE\\u5E94")\n );\n const dtSaveErr = h("div", { class: "qr-error", hidden: true });\n const dtSaveBtn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void onDtSave();\n }\n }, "\\u4FDD\\u5B58\\u9489\\u9489\\u914D\\u7F6E");\n const dtForm = h(\n "form",\n {\n onsubmit: (e) => {\n e.preventDefault();\n void onDtSave();\n }\n },\n advanced(\n "\\u5DF2\\u6709\\u5E94\\u7528\\uFF1F\\u624B\\u52A8\\u586B\\u51ED\\u8BC1\\uFF08\\u9AD8\\u7EA7\\uFF09",\n h("div", { class: "check-row" }, dtEnabledCb, h("label", { for: "dt-enabled" }, "\\u542F\\u7528\\u9489\\u9489")),\n h("div", { class: "field" }, h("label", {}, "Client ID\\uFF08AppKey\\uFF09"), dtClientIdInput),\n h("div", { class: "field" }, h("label", {}, "Client Secret"), dtSecretInput),\n h("div", { class: "field" }, h("label", {}, "\\u7FA4\\u7B56\\u7565"), dtPolicySel),\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u5BF9\\u5916\\u7FA4"),\n dtExtChatsInput,\n h("p", { class: "cf-hint" }, "\\u6709\\u5916\\u4EBA\\u5728\\u7684\\u7FA4\\u6807\\u8BB0\\u51FA\\u6765\\uFF1A\\u52A9\\u7406\\u5728\\u8FD9\\u4E9B\\u7FA4\\u91CC\\u4E0D\\u663E\\u793A\\u601D\\u8003/\\u5DE5\\u5177\\u8FC7\\u7A0B\\u3001\\u8BF4\\u8BDD\\u66F4\\u8C28\\u614E\\u3002\\u7FA4 cid \\u9017\\u53F7\\u5206\\u9694\\uFF0C\\u7559\\u7A7A = \\u6CA1\\u6709")\n ),\n dtSaveErr,\n dtSaveBtn\n )\n );\n const dtTuning = advanced(\n "\\u8C03\\u8BD5\\u53C2\\u6570\\uFF08\\u5185\\u90E8\\uFF09",\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u79C1\\u804A\\u767D\\u540D\\u5355\\uFF08staffId\\uFF09"),\n dtAllowInput,\n h("p", { class: "cf-hint" }, "staffId/senderId \\u9017\\u53F7\\u5206\\u9694\\uFF1B\\u7559\\u7A7A = \\u6240\\u6709\\u4EBA\\u53EF\\u79C1\\u804A")\n )\n );\n const dingtalkCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("dingtalk"),\n h("span", { class: "chan-name" }, "\\u9489\\u9489"),\n h("span", { class: "chan-light", "data-chan": "dingtalk" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u626B\\u7801\\u6388\\u6743\\u81EA\\u52A8\\u521B\\u5EFA\\u5E94\\u7528\\u5E76\\u63A5\\u5165\\uFF1B\\u7FA4\\u804A @\\u673A\\u5668\\u4EBA \\u89E6\\u53D1\\u3002"),\n h("button", { class: "btn", type: "button", onclick: () => startScan("dingtalk") }, "\\u626B\\u7801\\u63A5\\u5165"),\n dtForm\n );\n async function onDtSave() {\n dtSaveBtn.disabled = true;\n dtSaveErr.hidden = true;\n const r = await deps.updateDingtalkConfig(marker.configPath, marker.stateDir, {\n enabled: dtEnabledCb.checked,\n clientId: dtClientIdInput.value.trim(),\n clientSecret: dtSecretInput.value.trim(),\n // \u4E00\u683C\u9017\u53F7\u5206\u9694 \u2192 \u6570\u7EC4\uFF08telegram \u5361\u540C\u6B3E\u53E3\u5F84\uFF1A\u7559\u7A7A = [] = \u4E0D\u9650\uFF09\n allowedUsers: splitList(dtAllowInput.value),\n externalChannels: splitList(dtExtChatsInput.value),\n groupPolicy: dtPolicySel.value\n });\n dtSaveBtn.disabled = false;\n if (!r.ok) {\n dtSaveErr.hidden = false;\n dtSaveErr.textContent = r.error ?? "\\u4FDD\\u5B58\\u5931\\u8D25";\n return;\n }\n showRestartBanner();\n }\n const wcEnabledCb = h("input", { type: "checkbox", id: "wc-enabled" });\n const wcBotIdInput = h("input", { type: "text", placeholder: "BotID\\uFF08\\u626B\\u7801\\u63A5\\u5165\\u81EA\\u52A8\\u586B\\u5199\\uFF09" });\n const wcSecretInput = h("input", { type: "password", placeholder: "Secret\\uFF08\\u957F\\u8FDE\\u63A5\\u4E13\\u7528\\uFF09" });\n const wcDisplayNameInput = h("input", {\n type: "text",\n placeholder: "\\u4F01\\u5FAE\\u540E\\u53F0\\u91CC\\u7684\\u673A\\u5668\\u4EBA\\u540D\\u5B57\\uFF08\\u7FA4 @ \\u5265\\u79BB\\u7684\\u6BD4\\u5BF9\\u57FA\\u51C6\\uFF0C\\u7559\\u7A7A = \\u4E0D\\u5265\\uFF09"\n });\n const wcAllowUsersInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684\\u4F01\\u5FAE userid\\uFF0C\\u7559\\u7A7A = \\u6240\\u6709\\u4EBA\\u53EF\\u79C1\\u804A"\n });\n const wcAllowChatsInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684\\u7FA4 chatid\\uFF0C\\u7559\\u7A7A = \\u6240\\u6709\\u7FA4"\n });\n const wcFormatSel = h(\n "select",\n {},\n h("option", { value: "markdown" }, "markdown \\u2014\\u2014 \\u9ED8\\u8BA4"),\n h("option", { value: "text" }, "text \\u2014\\u2014 \\u8DDF\\u4E2A\\u4EBA\\u5FAE\\u4FE1\\u4E92\\u901A\\u3001\\u4E0D\\u6E32\\u67D3 markdown \\u65F6\\u9009")\n );\n const wcMergeInput = h("input", {\n type: "number",\n min: "0",\n placeholder: "600\\uFF08\\u9ED8\\u8BA4\\uFF09"\n });\n const wcSaveErr = h("div", { class: "qr-error", hidden: true });\n const wcSaveBtn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void onWcSave();\n }\n }, "\\u4FDD\\u5B58\\u4F01\\u4E1A\\u5FAE\\u4FE1\\u914D\\u7F6E");\n const wcForm = h(\n "form",\n {\n onsubmit: (e) => {\n e.preventDefault();\n void onWcSave();\n }\n },\n advanced(\n "\\u5DF2\\u6709\\u673A\\u5668\\u4EBA\\uFF1F\\u624B\\u52A8\\u586B\\u51ED\\u8BC1\\uFF08\\u9AD8\\u7EA7\\uFF09",\n h("div", { class: "check-row" }, wcEnabledCb, h("label", { for: "wc-enabled" }, "\\u542F\\u7528\\u4F01\\u4E1A\\u5FAE\\u4FE1")),\n h("div", { class: "field" }, h("label", {}, "BotID"), wcBotIdInput),\n h("div", { class: "field" }, h("label", {}, "Secret"), wcSecretInput),\n wcSaveErr,\n wcSaveBtn\n )\n );\n const wcTuning = advanced(\n "\\u8C03\\u8BD5\\u53C2\\u6570\\uFF08\\u5185\\u90E8\\uFF09",\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u673A\\u5668\\u4EBA\\u663E\\u793A\\u540D\\uFF08@ \\u5265\\u79BB\\u6BD4\\u5BF9\\u57FA\\u51C6\\uFF09"),\n wcDisplayNameInput,\n h("p", { class: "cf-hint" }, "\\u7FA4\\u6D88\\u606F\\u91CC @\\u673A\\u5668\\u4EBA \\u90A3\\u51E0\\u4E2A\\u5B57\\u8981\\u5265\\u6389\\u518D\\u7ED9\\u6A21\\u578B\\uFF0C\\u8FD9\\u91CC\\u586B\\u673A\\u5668\\u4EBA\\u540D\\u5B57\\u7528\\u4E8E\\u5339\\u914D\\uFF1B\\u7559\\u7A7A = \\u4E0D\\u5265")\n ),\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u5141\\u8BB8\\u79C1\\u804A\\u7684\\u4EBA"),\n wcAllowUsersInput,\n h("p", { class: "cf-hint" }, "\\u4F01\\u5FAE\\u6210\\u5458 ID\\uFF0C\\u9017\\u53F7\\u5206\\u9694\\uFF1B\\u7559\\u7A7A = \\u6240\\u6709\\u4EBA\\u90FD\\u53EF\\u79C1\\u804A")\n ),\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u54CD\\u5E94 @ \\u7684\\u7FA4"),\n wcAllowChatsInput,\n h("p", { class: "cf-hint" }, "\\u7FA4 ID\\uFF0C\\u9017\\u53F7\\u5206\\u9694\\uFF1B\\u7559\\u7A7A = \\u6240\\u6709\\u7FA4\\uFF08\\u4F01\\u5FAE\\u5E73\\u53F0\\u53EA\\u6295\\u9012 @\\u673A\\u5668\\u4EBA \\u7684\\u6D88\\u606F\\uFF09")\n ),\n h("div", { class: "field" }, h("label", {}, "\\u6D88\\u606F\\u683C\\u5F0F"), wcFormatSel),\n h("div", { class: "field" }, h("label", {}, "\\u957F\\u6D88\\u606F\\u5408\\u5E76\\u7A97\\u53E3 ms"), wcMergeInput)\n );\n const wecomCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("wecom"),\n h("span", { class: "chan-name" }, "\\u4F01\\u4E1A\\u5FAE\\u4FE1"),\n h("span", { class: "chan-light", "data-chan": "wecom" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u626B\\u7801\\u6388\\u6743\\u81EA\\u52A8\\u521B\\u5EFA\\u673A\\u5668\\u4EBA\\u5E76\\u63A5\\u5165\\uFF1B\\u7FA4\\u804A @\\u673A\\u5668\\u4EBA \\u89E6\\u53D1\\uFF0C\\u514D\\u914D\\u7F6E\\u3002"),\n h("button", { class: "btn", type: "button", onclick: () => startScan("wecom") }, "\\u626B\\u7801\\u63A5\\u5165"),\n wcForm\n );\n function fillWecom(cfg) {\n wcEnabledCb.checked = cfg.enabled;\n wcBotIdInput.value = cfg.botId;\n wcSecretInput.value = cfg.secret;\n wcDisplayNameInput.value = cfg.displayName;\n wcAllowUsersInput.value = cfg.allowedUsers.join(", ");\n wcAllowChatsInput.value = cfg.allowedChats.join(", ");\n wcFormatSel.value = cfg.textFormat;\n wcMergeInput.value = cfg.mergeWindowMs == null ? "" : String(cfg.mergeWindowMs);\n }\n async function onWcSave() {\n wcSaveBtn.disabled = true;\n wcSaveErr.hidden = true;\n const mergeRaw = wcMergeInput.value.trim();\n const r = await deps.updateWecomConfig(marker.configPath, marker.stateDir, {\n enabled: wcEnabledCb.checked,\n botId: wcBotIdInput.value.trim(),\n secret: wcSecretInput.value.trim(),\n displayName: wcDisplayNameInput.value.trim(),\n allowedUsers: splitList(wcAllowUsersInput.value),\n allowedChats: splitList(wcAllowChatsInput.value),\n textFormat: wcFormatSel.value,\n mergeWindowMs: mergeRaw === "" ? null : Number(mergeRaw)\n });\n wcSaveBtn.disabled = false;\n if (!r.ok) {\n wcSaveErr.hidden = false;\n wcSaveErr.textContent = r.error ?? "\\u4FDD\\u5B58\\u5931\\u8D25";\n return;\n }\n showRestartBanner();\n }\n const waEnabledCb = h("input", { type: "checkbox", id: "wa-enabled" });\n const waSaveErr = h("div", { class: "qr-error", hidden: true });\n const waSaveBtn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void onWaSave();\n }\n }, "\\u4FDD\\u5B58");\n const whatsappCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("whatsapp"),\n h("span", { class: "chan-name" }, "WhatsApp"),\n h("span", { class: "chan-light", "data-chan": "whatsapp" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u7528\\u4F60\\u672C\\u4EBA\\u7684\\u8D26\\u53F7\\u63A5\\u5165\\uFF08\\u7ED9\\u81EA\\u5DF1\\u53D1\\u6D88\\u606F\\u5373\\u547D\\u4EE4\\u53E3\\uFF09\\uFF0C\\u626B\\u7801\\u914D\\u5BF9\\u3002"),\n h("button", { class: "btn", type: "button", onclick: () => startWaModal() }, "\\u626B\\u7801\\u767B\\u5F55"),\n h(\n "form",\n {\n onsubmit: (e) => {\n e.preventDefault();\n void onWaSave();\n }\n },\n h("div", { class: "check-row" }, waEnabledCb, h("label", { for: "wa-enabled" }, "\\u542F\\u7528 WhatsApp")),\n advanced(\n "\\u4F7F\\u7528\\u8BF4\\u660E\\uFF08\\u9AD8\\u7EA7\\uFF09",\n h("div", {}, "\\u9996\\u6B21\\u4F7F\\u7528\\uFF1A\\u52FE\\u9009\\u542F\\u7528\\u5E76\\u4FDD\\u5B58\\uFF08\\u91CD\\u542F\\u5F15\\u64CE\\u751F\\u6548\\uFF09\\u2192 \\u70B9\\u300C\\u626B\\u7801\\u767B\\u5F55\\u300D\\u914D\\u5BF9\\u3002"),\n h("div", {}, \'\\u914D\\u5BF9\\u540E\\u7684\\u8BBE\\u5907\\u540D\\u663E\\u793A\\u4E3A "Chrome"\\uFF0C\\u5C5E\\u6B63\\u5E38\\u73B0\\u8C61\\uFF1B\\u4E00\\u53F0\\u624B\\u673A\\u6700\\u591A 4 \\u4E2A\\u4F34\\u4FA3\\u8BBE\\u5907\\u4F4D\\uFF0C\\u5360\\u6EE1\\u5148\\u9000\\u4E00\\u4E2A\\u3002\'),\n h("div", {}, "\\u56FD\\u5185\\u7F51\\u7EDC\\u9700\\u4EE3\\u7406\\uFF08\\u5EFA\\u8BAE\\u5168\\u5C40\\u6A21\\u5F0F\\uFF1B\\u5A92\\u4F53\\u6536\\u53D1\\u4E0D\\u8D70 config \\u91CC\\u7684 proxy \\u5355\\u72EC\\u901A\\u9053\\uFF09\\u3002"),\n h("div", {}, "\\u7FA4\\u6D88\\u606F\\u53EA\\u8BFB\\uFF1Aagent \\u6C38\\u4E0D\\u5728\\u7FA4\\u91CC\\u53D1\\u8A00\\uFF0C\\u7FA4\\u804A\\u53EA\\u4F5C\\u7D20\\u6750\\u6458\\u8981\\u3002"),\n h("div", {}, "\\u767D\\u540D\\u5355 / \\u7FA4\\u6458\\u8981\\u5DE1\\u68C0\\u7B49\\u9AD8\\u7EA7\\u9879\\u89C1 docs/whatsapp-telegram-setup.md\\u3002")\n ),\n waSaveErr,\n waSaveBtn\n )\n );\n async function onWaSave() {\n waSaveBtn.disabled = true;\n waSaveErr.hidden = true;\n const r = await deps.updateWhatsappConfig(marker.configPath, marker.stateDir, { enabled: waEnabledCb.checked });\n waSaveBtn.disabled = false;\n if (!r.ok) {\n waSaveErr.hidden = false;\n waSaveErr.textContent = r.error ?? "\\u4FDD\\u5B58\\u5931\\u8D25";\n return;\n }\n showRestartBanner();\n }\n let waScan = null;\n const startWaModal = () => {\n waScan?.stop();\n waScan = startWaScan(marker.apiPort, {\n fetchWaQr: deps.fetchWaQr,\n onClose: () => {\n void refreshWaLight();\n }\n });\n };\n async function refreshWaLight() {\n if (stopped) return;\n const el = body.querySelector(\'.chan-light[data-chan="whatsapp"]\');\n if (!el) return;\n const status = await deps.apiStatus(marker.apiPort);\n if (stopped) return;\n const ch = status?.channels.find((c) => c.name === "whatsapp");\n if (!status) {\n el.textContent = "\\u2014\\u2014 \\u5F15\\u64CE\\u672A\\u8FD0\\u884C";\n return;\n }\n if (!ch?.enabled) {\n el.textContent = "\\u26D4 \\u672A\\u542F\\u7528";\n return;\n }\n const conn = await deps.fetchWaStatus(marker.apiPort);\n if (stopped) return;\n if (!conn) {\n el.textContent = "\\u26A0\\uFE0F \\u5F15\\u64CE\\u7248\\u672C\\u8FC7\\u4F4E";\n return;\n }\n switch (conn.status) {\n case "connected":\n el.textContent = "\\u2705 \\u5DF2\\u8FDE\\u63A5";\n break;\n case "connecting":\n case "waiting-qr":\n el.textContent = "\\u{1F504} \\u8FDE\\u63A5\\u4E2D";\n break;\n case "not-linked":\n el.textContent = "\\u23F3 \\u5F85\\u626B\\u7801";\n break;\n case "logged-out":\n el.textContent = "\\u{1F6AA} \\u5DF2\\u767B\\u51FA";\n break;\n case "conflict":\n el.textContent = "\\u2694\\uFE0F \\u4F1A\\u8BDD\\u51B2\\u7A81";\n break;\n case "stopped":\n el.textContent = "\\u26AA \\u672A\\u8FD0\\u884C\\uFF08\\u91CD\\u542F\\u5F15\\u64CE\\u540E\\u751F\\u6548\\uFF09";\n break;\n default:\n el.textContent = `\\u2753 ${conn.status}`;\n break;\n }\n }\n const waLightTimer = setInterval(() => {\n void refreshWaLight();\n }, 5e3);\n const lightsTimer = setInterval(() => {\n void load(true);\n }, 5e3);\n async function load(fromPoll = false) {\n if (stopped) return;\n const status = await deps.apiStatus(marker.apiPort);\n if (stopped) return;\n if (fromPoll && !status) return;\n const chans = status?.channels ?? (await deps.doctor(marker.stateDir))?.channels ?? [];\n if (stopped) return;\n for (const c of chans) {\n if (c.name === "whatsapp") continue;\n const el = body.querySelector(`.chan-light[data-chan="${c.name}"]`);\n if (!el) continue;\n if (!c.enabled) el.textContent = "\\u26D4 \\u672A\\u542F\\u7528";\n else if (c.hasCredentials) el.textContent = "\\u2705 \\u5DF2\\u914D\\u7F6E";\n else el.textContent = "\\u26A0\\uFE0F \\u7F3A\\u51ED\\u8BC1";\n }\n for (const el of Array.from(body.querySelectorAll(".chan-light"))) {\n if (el.textContent === "\\u2026" && el.getAttribute("data-chan") !== "whatsapp") el.textContent = "\\u26D4 \\u672A\\u542F\\u7528";\n }\n }\n void deps.readChannelConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n enabledCb.checked = cfg.enabled;\n tokenInput.value = cfg.token;\n userIdInput.value = cfg.userId;\n });\n void deps.readTelegramConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n tgEnabledCb.checked = cfg.enabled;\n tgTokenInput.value = cfg.token;\n tgPolicySel.value = cfg.dmPolicy;\n tgAllowInput.value = cfg.allowFrom.join(", ");\n });\n void deps.readDingtalkConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n dtEnabledCb.checked = cfg.enabled;\n dtClientIdInput.value = cfg.clientId;\n dtSecretInput.value = cfg.clientSecret;\n dtAllowInput.value = cfg.allowedUsers.join(", ");\n dtExtChatsInput.value = cfg.externalChannels.join(", ");\n dtPolicySel.value = cfg.groupPolicy;\n });\n void deps.readWecomConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n fillWecom(cfg);\n });\n void deps.readWhatsappConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n waEnabledCb.checked = cfg.enabled;\n });\n body.replaceChildren(wrap, feishuCard, wechatCard, dingtalkCard, wecomCard, whatsappCard, telegramCard, discordCard);\n void deps.configSchema(marker.stateDir).then((schema) => {\n if (stopped || !schema?.internalMode) return;\n dingtalkCard.appendChild(dtTuning);\n wecomCard.appendChild(wcTuning);\n });\n void load();\n void refreshWaLight();\n return () => {\n stopped = true;\n session?.stop();\n waScan?.stop();\n clearInterval(waLightTimer);\n clearInterval(lightsTimer);\n };\n }\n\n // web-console/desktop/src/renderer/console/pages/logs.ts\n function mountLogs(body, marker, deps) {\n const logsDir = `${marker.stateDir.replace(/[\\\\/]+$/, "")}/logs`;\n const output = h("pre", { class: "log-view" }, "\\uFF08\\u8FD8\\u6CA1\\u6709\\u65E5\\u5FD7\\u8F93\\u51FA\\uFF09");\n const hint = h("p", { class: "page-sub" }, "");\n let lastText = "";\n const isInLog = (n) => {\n if (!n) return false;\n const el = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement;\n return !!el && (el === output || output.contains(el));\n };\n const selecting = () => {\n const sel = window.getSelection();\n if (!sel || sel.isCollapsed || sel.rangeCount === 0) return false;\n return isInLog(sel.anchorNode) || isInLog(sel.focusNode);\n };\n const atBottom = () => output.scrollHeight - output.scrollTop - output.clientHeight <= 4;\n async function refresh(force = false) {\n const lines = await deps.logTail(marker.stateDir);\n const hintText2 = lines.length ? "" : "\\u672C\\u4F1A\\u8BDD\\u6CA1\\u6709\\u542F\\u52A8\\u8FC7\\u5F15\\u64CE\\u2014\\u2014\\u5F15\\u64CE\\u65E5\\u5FD7\\u5728\\u5B89\\u88C5\\u76EE\\u5F55\\u7684 logs/ \\u6587\\u4EF6\\u5939\\u91CC\\u3002";\n if (hint.textContent !== hintText2) hint.textContent = hintText2;\n const text = lines.length ? lines.slice(-500).join("\\n") : "\\uFF08\\u8FD8\\u6CA1\\u6709\\u65E5\\u5FD7\\u8F93\\u51FA\\uFF09";\n if (text === lastText) return;\n if (!force && (selecting() || !atBottom())) return;\n lastText = text;\n const stick = atBottom();\n output.textContent = text;\n if (stick) output.scrollTop = output.scrollHeight;\n }\n async function copy() {\n const sel = window.getSelection();\n const picked = sel && !sel.isCollapsed ? String(sel) : "";\n const ok = await writeClipboard(picked || output.textContent || "");\n copyBtn.textContent = ok ? picked ? "\\u5DF2\\u590D\\u5236\\u9009\\u4E2D" : "\\u5DF2\\u590D\\u5236\\u5168\\u90E8" : "\\u590D\\u5236\\u5931\\u8D25";\n setTimeout(() => {\n copyBtn.textContent = "\\u590D\\u5236";\n }, 1500);\n }\n const copyBtn = h("button", { class: "btn", type: "button", onclick: () => {\n void copy();\n } }, "\\u590D\\u5236");\n body.replaceChildren(\n h(\n "div",\n { class: "page" },\n h("h2", {}, "\\u5F15\\u64CE\\u65E5\\u5FD7"),\n h(\n "div",\n { class: "btn-row", style: "margin-bottom:10px" },\n h("button", { class: "btn", type: "button", onclick: () => {\n void deps.openPath(logsDir);\n } }, "\\u6253\\u5F00\\u65E5\\u5FD7\\u6587\\u4EF6\\u5939"),\n h("button", { class: "btn", type: "button", onclick: () => {\n void refresh(true);\n } }, "\\u5237\\u65B0"),\n copyBtn\n ),\n hint,\n output\n )\n );\n let stopped = false;\n void (async () => {\n if (!stopped) await refresh(true);\n })();\n const timer = setInterval(() => {\n if (!stopped) void refresh();\n }, 2e3);\n return () => {\n stopped = true;\n clearInterval(timer);\n };\n }\n async function writeClipboard(text) {\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch {\n }\n try {\n const ta = document.createElement("textarea");\n ta.value = text;\n ta.style.position = "fixed";\n ta.style.top = "0";\n ta.style.opacity = "0";\n document.body.appendChild(ta);\n ta.select();\n const ok = document.execCommand("copy");\n ta.remove();\n return ok;\n } catch {\n return false;\n }\n }\n\n // web-console/desktop/src/renderer/console/panels/drift.ts\n function driftNotice(cliVersion, engineVersion) {\n if (!cliVersion || !engineVersion) return null;\n if (cliVersion === engineVersion) return null;\n return h(\n "div",\n { class: "inline-warn", id: "drift-notice" },\n `\\u5185\\u7F6E\\u5F15\\u64CE\\u662F ${cliVersion}\\uFF0C\\u800C\\u8FD9\\u4EFD\\u5F15\\u64CE\\u662F ${engineVersion}\\u2014\\u2014\\u4E0D\\u4E00\\u81F4\\u3002`,\n h("br"),\n "\\u4E0B\\u9762\\u8FD9\\u4E9B\\u9762\\u677F\\u6E32\\u67D3\\u7684\\u662F\\u5185\\u7F6E\\u5F15\\u64CE\\u7684\\u5B57\\u6BB5\\u6E05\\u5355\\u3002\\u7248\\u672C\\u5BF9\\u4E0D\\u4E0A\\u65F6\\uFF0C\\u53EF\\u80FD\\u51FA\\u73B0",\n "\\u300C\\u6539\\u4E86\\u4E0D\\u751F\\u6548\\u300D\\u6216\\u8005\\u300C\\u67D0\\u4E9B\\u5B57\\u6BB5\\u538B\\u6839\\u663E\\u793A\\u4E0D\\u51FA\\u6765\\u300D\\u2014\\u2014\\u8FD9\\u4E24\\u79CD\\u90FD\\u4E0D\\u4F1A\\u62A5\\u9519\\u3002",\n h("br"),\n // \u51FA\u8DEF\u5FC5\u987B**\u65B9\u5411\u4E2D\u7ACB**\uFF1A\u4E0A\u9762\u90A3\u4E24\u79CD\u6F02\u79FB\u7684\u89E3\u6CD5\u4E0D\u4E00\u6837\u2014\u2014\u5185\u7F6E\u6BD4\u76EE\u6807\u65B0\u662F\u5347\u8FD9\u4EFD\u5F15\u64CE\uFF0C\n // \u5185\u7F6E\u6BD4\u76EE\u6807\u65E7\uFF08\u76EE\u6807\u5F15\u64CE\u5DF2\u7ECF\u9AD8\u4E8E cliVersion\uFF09\u662F\u5347\u6258\u76D8\u8FD9\u4E00\u4FA7\u3002\u53EA\u5199"\u5347\u8FD9\u4EFD\u5F15\u64CE"\n // \u5728\u53CD\u65B9\u5411\u4E0A\u8F7B\u5219\u65E0\u610F\u4E49\uFF0C\u91CD\u5219\u8BFB\u8D77\u6765\u50CF\u53EB\u4EBA**\u964D\u7EA7**\n `\\u8981\\u6CBB\\u672C\\u5C31\\u8BA9\\u4E24\\u8FB9\\u7248\\u672C\\u4E00\\u81F4\\uFF1A\\u628A\\u8FD9\\u4EFD\\u5F15\\u64CE\\u5347\\u5230 ${cliVersion}\\uFF08\\u6216\\u66F4\\u9AD8\\uFF09\\uFF0C\\u6216\\u8005\\u8BA9\\u6258\\u76D8\\u8DDF\\u7740\\u8FD9\\u4EFD\\u5F15\\u64CE\\u8D70\\u3002`,\n "\\u53EA\\u662F\\u60F3\\u770B\\u770B\\u73B0\\u72B6\\u7684\\u8BDD\\uFF0C\\u9762\\u677F\\u7167\\u5E38\\u80FD\\u7528\\u3002"\n );\n }\n\n // web-console/desktop/src/renderer/console/set-detail.ts\n function setDetailBlocks(r, opts = {}) {\n const blocks = [];\n if (r.ineffective.length > 0) {\n blocks.push(h(\n "div",\n { class: "inline-error" },\n `\\u8FD9\\u51E0\\u9879\\u5199\\u8FDB\\u53BB\\u4E86\\uFF0C\\u4F46\\u4E0D\\u4F1A\\u751F\\u6548\\uFF1A${r.ineffective.join("\\u3001")}\\u3002`,\n h("br"),\n "\\u5B83\\u4EEC\\u5728 config \\u91CC\\u5B58\\u7684\\u662F\\u660E\\u6587\\uFF08\\u8001\\u88C5\\u673A\\uFF09\\uFF0C\\u5F15\\u64CE\\u8BFB\\u7684\\u662F secrets \\u6587\\u4EF6\\u2014\\u2014\\u5199 secrets \\u6539\\u4E0D\\u52A8\\u5B83\\u8BFB\\u5230\\u7684\\u503C\\u3002",\n h("br"),\n "\\u51FA\\u8DEF\\uFF1A\\u8DD1\\u4E00\\u6B21 `engine7 config migrate` \\u628A\\u660E\\u6587\\u642C\\u8FDB secrets\\uFF0C\\u4E4B\\u540E\\u8FD9\\u4E00\\u683C\\u5C31\\u80FD\\u6B63\\u5E38\\u6539\\u4E86\\u3002",\n opts.onMigrate ? h(\n "div",\n { class: "btn-row" },\n h("button", { class: "btn", type: "button", id: "cfg-migrate", onclick: opts.onMigrate }, "\\u73B0\\u5728\\u8FC1\\u79FB")\n ) : null\n ));\n }\n if (r.failed.length > 0) {\n blocks.push(h(\n "div",\n { class: "inline-error" },\n `\\u8FD9\\u51E0\\u9879\\u7684\\u5BC6\\u94A5\\u6CA1\\u80FD\\u5199\\u6210\\uFF1A${r.failed.join("\\u3001")}\\u3002config \\u5DF2\\u5199\\u5165\\uFF0C\\u4F46\\u8FD9\\u4E9B\\u5B57\\u6BB5\\u8FD8\\u662F\\u65E7\\u503C\\u3002`\n ));\n }\n if (r.needsRestart.length > 0) {\n const block = h(\n "div",\n { class: "inline-warn" },\n `\\u8FD9\\u51E0\\u9879\\u8981\\u91CD\\u542F\\u5F15\\u64CE\\u624D\\u751F\\u6548\\uFF1A${r.needsRestart.join("\\u3001")}\\u3002`\n );\n if (opts.onRestart) {\n block.append(h(\n "div",\n { class: "btn-row" },\n h("button", {\n class: "btn btn-primary",\n type: "button",\n id: "cfg-restart-now",\n onclick: opts.onRestart\n }, "\\u73B0\\u5728\\u91CD\\u542F"),\n // \u300C\u7A0D\u540E\u300D\u8981\u6709\u53CD\u5E94\uFF1A\u8FD9\u4E00\u7248\u4E4B\u524D\u5B83**\u6CA1\u6709 onclick** \u2014\u2014 \u70B9\u4E86\u4EC0\u4E48\u90FD\u4E0D\u53D1\u751F\u3001\u533A\u5757\u4E5F\u4E0D\u6536\uFF0C\n // \u800C"\u70B9\u4E86\u6CA1\u53CD\u5E94"\u6B63\u662F\u8FD9\u4E2A\u9879\u76EE\u6700\u7ECF\u5178\u7684\u5DE5\u5355\uFF0C\u5B83\u5374\u957F\u5728\u4E3B\u4FDD\u5B58\u6D41\u7A0B\u91CC\u3002\n // \u6536\u8D77\u8FD9\u4E00\u6BB5\u5C31\u662F\u300C\u7A0D\u540E\u300D\u7684\u8BED\u4E49\uFF08\u4E0B\u6B21\u4FDD\u5B58\u4F1A\u91CD\u65B0\u6E32\u67D3\u51FA\u65B0\u7684\u63D0\u793A\uFF09\u3002\n h("button", {\n class: "btn",\n type: "button",\n id: "cfg-restart-later",\n onclick: () => {\n block.hidden = true;\n }\n }, "\\u7A0D\\u540E")\n ));\n }\n blocks.push(block);\n }\n for (const w of r.warnings) {\n const note = opts.warningNotes?.find((n) => w.includes(n.mark));\n blocks.push(h("div", { class: "inline-warn" }, note ? `${w}\\u3002${note.note}` : w));\n }\n for (const e of r.errors) {\n if (opts.shownPaths?.has(e.path)) continue;\n blocks.push(h("div", { class: "inline-error" }, `${e.path}\\uFF1A${e.error}`));\n }\n return blocks;\n }\n\n // web-console/desktop/src/shared/config-form.ts\n function pickPath(obj, dotPath) {\n let cur = obj;\n for (const k of dotPath.split(".")) {\n if (cur == null || typeof cur !== "object") return void 0;\n cur = cur[k];\n }\n return cur;\n }\n var ENV_REF = /^(?:env:|{{\\s*)(?=[A-Z0-9_]*[A-Z])([A-Z0-9_]+)(?:\\s*}})?$/;\n function secretEnvNameOf(field, values) {\n const cur = pickPath(values, field.path);\n if (typeof cur === "string") {\n const m = ENV_REF.exec(cur);\n if (m) return m[1];\n }\n return field.envKey ?? field.path.split(".").pop().toUpperCase().replace(/[^A-Z0-9_]/g, "_");\n }\n function sameValue(a, b) {\n if (a === b) return true;\n if (a === null || b === null || a === void 0 || b === void 0) return false;\n if (typeof a !== typeof b) return false;\n if (typeof a === "object") {\n try {\n return JSON.stringify(a) === JSON.stringify(b);\n } catch {\n return false;\n }\n }\n return false;\n }\n var CREDENTIAL_KEY = /^(token|api[_-]?key|app[_-]?secret|client[_-]?secret|access[_-]?key|secret[_-]?key|private[_-]?key|secret|password|passwd)$/i;\n function findNullCredentials(value, prefix = "") {\n const out = [];\n if (value == null || typeof value !== "object") return out;\n for (const [k, v] of Object.entries(value)) {\n const p = prefix ? `${prefix}.${k}` : k;\n if (CREDENTIAL_KEY.test(k) && v === null) out.push(p);\n else out.push(...findNullCredentials(v, p));\n }\n return out;\n }\n function effectBadge(effect) {\n if (effect === "restart") return { text: "\\u91CD\\u542F\\u540E\\u751F\\u6548", cls: "fx-restart" };\n if (effect === "channel-reconnect") return { text: "\\u4FDD\\u5B58\\u540E\\u901A\\u9053\\u9700\\u91CD\\u8FDE", cls: "fx-reconnect" };\n if (effect === "external-service") return { text: "\\u5916\\u90E8\\u670D\\u52A1\\uFF0C\\u9700\\u624B\\u52A8\\u91CD\\u542F", cls: "fx-external" };\n return null;\n }\n function secretState(field, values, secrets) {\n const name = secretEnvNameOf(field, values);\n if (!(name in secrets)) return { kind: "unknown", text: "\\u72B6\\u6001\\u672A\\u77E5" };\n return secrets[name] === "set" ? { kind: "set", text: "\\u5DF2\\u8BBE\\u7F6E" } : { kind: "unset", text: "\\u672A\\u8BBE\\u7F6E" };\n }\n\n // web-console/desktop/src/shared/config-editors.ts\n function isPlainObject(v) {\n return v !== null && typeof v === "object" && !Array.isArray(v);\n }\n function mergeProvider(providers, providerId, patch) {\n const src = isPlainObject(providers) ? providers : {};\n const out = { ...src };\n const cur = isPlainObject(out[providerId]) ? { ...out[providerId] } : {};\n let keyDropped = false;\n if (patch.baseUrl !== void 0) cur.baseUrl = patch.baseUrl;\n if (patch.apiKey !== void 0 && patch.apiKey !== "") {\n cur.apiKey = patch.apiKey;\n } else if (cur.apiKey === null) {\n delete cur.apiKey;\n keyDropped = true;\n }\n out[providerId] = cur;\n const othersMasked = [];\n for (const [id, raw] of Object.entries(out)) {\n if (id === providerId) continue;\n if (findNullCredentials(raw).length > 0) othersMasked.push(id);\n }\n return { value: out, keyDropped, othersMasked };\n }\n function mergeMySelfie(current2, form) {\n const src = isPlainObject(current2) ? current2 : {};\n const value = { ...src };\n let keyDropped = false;\n if (form.relayProvider) value.provider = form.relayProvider;\n if (form.photoRelPath) {\n value.references = [{ name: "portrait", path: form.photoRelPath }];\n delete value.portraitDesc;\n } else {\n delete value.references;\n if (form.portraitDesc) value.portraitDesc = form.portraitDesc;\n else delete value.portraitDesc;\n }\n for (const k of Object.keys(value)) {\n if (value[k] === null) {\n delete value[k];\n keyDropped = true;\n }\n }\n return { value, keyDropped };\n }\n var VOICE_FORM_KEYS = [\n "url",\n "voice",\n "lang",\n "model",\n "workspaceId",\n "instruction",\n "pythonPath"\n // \u26A0\uFE0F relay / \u8BA1\u8D39\u6C60\u90A3\u4E94\u4E2A\u952E\uFF08relayProviderId / relayModel / billingProviderId /\n // billingModel / billingMode\uFF09**\u523B\u610F\u4E0D\u5728\u8FD9\u91CC** \u2014\u2014 \u5B83\u4EEC\u53EA\u5728**\u5185\u90E8\u6A21\u5F0F**\u4E0B\u5EFA\u6846\uFF0C\n // \u89C1\u4E0B\u9762\u7684 VOICE_INTERNAL_FORM_KEYS\u3002\u7FC0\u54E5 0927 \u770B\u56FE\uFF1A\u300C\u4F60\u8FD9\u4E9B\u90FD\u662F\u5565\u72D7\u5C4E\uFF1F\u6709\u5FC5\u8981\u4E48\uFF1F\n // \u4F60\u5C55\u793A\u7ED9\u7528\u6237\u56FE\u4E2A\u5565\u300D\u2014\u2014 relayProviderId \u7528\u6237\u53EA\u6709\u4E00\u4E2A\u6761\u76EE\u3001relayModel \u5F97\u5148\u77E5\u9053\n // \u4E2D\u8F6C\u7AD9\u6302\u4E86\u4EC0\u4E48\u6A21\u578B\u3001\u4E09\u4E2A billing* \u662F**\u672A\u6765\u8BA1\u8D39**\u7684\uFF08\u4ECA\u5929\u8BA1\u8D39\u6C60\u4E0D\u5B58\u5728\uFF09\u3002\u64A4\u3002\n //\n // **\u4E0D\u5728\u8868\u5355\u91CC \u2260 \u4F1A\u88AB\u5220\u6389**\uFF1A\u4E0B\u9762\u7684 `keep` \u6765\u81EA\u5F15\u64CE\u6E05\u5355\u7684 `requiredKeys`\n // \uFF08\u6258\u76D8\u9760\u5B83\u51B3\u5B9A"\u8FD9\u4E00\u7248 provider \u4F1A\u8BFB\u54EA\u4E9B\u952E"\uFF09\uFF0C\u4E0D\u5728 formKeys \u91CC\u5C31\u53EA\u8D70 keep\u3001\n // \u4E0D\u8FDB"\u8868\u5355\u8986\u76D6"\u90A3\u6BB5 \u21D2 \u4FDD\u5B58\u65F6\u539F\u6837\u7559\u7740\u3002\u4E0E voiceTier / fallback \u540C\u4E00\u4E2A\u5F85\u9047\u3002\n // **\u522B\u987A\u624B\u52A0\u56DE\u8FD9\u4E00\u4E2A\u6570\u7EC4** \u2014\u2014 \u52A0\u56DE\u6765\u5C31\u7B49\u4E8E"\u8868\u5355\u91CC\u6CA1\u6709 \u21D2 delete"\uFF0C\n // \u666E\u901A\u6A21\u5F0F\u4E0B\u4E00\u6B21\u4FDD\u5B58\u5C31\u628A\u5B83\u4EEC\u4ECE config \u91CC\u5220\u4E86\u3002\n ];\n var VOICE_INTERNAL_FORM_KEYS = [\n "relayProviderId",\n "relayModel",\n "billingMode",\n "billingProviderId",\n "billingModel"\n ];\n function voiceFormKeys(internalMode) {\n return internalMode ? [...VOICE_FORM_KEYS, ...VOICE_INTERNAL_FORM_KEYS] : [...VOICE_FORM_KEYS];\n }\n function voiceSchemaOf(field, internalMode = false) {\n const providers = field?.knownValues?.provider;\n const byProvider = field?.valueKeys?.provider;\n if (!Array.isArray(providers) || providers.length === 0) return null;\n if (!byProvider || typeof byProvider !== "object") return null;\n return {\n providers: [...providers],\n keysOf: (p) => Array.isArray(byProvider[p]) ? [...byProvider[p]] : void 0,\n // \u26A0\uFE0F \u8FD9\u91CC**\u4E0D\u662F** `Object.values(byProvider).flat()`\uFF08\u5F15\u64CE\u90A3\u8FB9\u6240\u6709 provider \u8BFB\u7684\u952E\u7684\u5E76\u96C6\uFF09\u3002\n // \u90A3\u4E2A\u5E76\u96C6\u91CC\u8EBA\u7740 voiceTier / fallback / \u90A3\u4E94\u4E2A relay \u952E \u2014\u2014 \u5B83\u4EEC\u662F"\u8981\u4FDD\u7559"\u7684\u952E\uFF0C\n // \u4E0D\u662F"\u9762\u677F\u4E0A\u80FD\u6539"\u7684\u952E\uFF1B\u62FF\u5B83\u5F53\u904D\u5386\u8303\u56F4 = \u8868\u5355\u91CC\u6CA1\u6709\u5C31 delete\uFF08\u4E00\u4FDD\u5B58\u5C31\u9759\u9ED8\u5220\u914D\u7F6E\uFF09\u3002\n // \u9762\u677F\u4E0A\u6709\u54EA\u4E9B\u6846\u662F**\u6258\u76D8\u81EA\u5DF1\u7684 UI \u4E8B\u5B9E**\uFF08voice.ts \u91CC\u6BCF\u4E2A fieldRow \u90FD\u5199\u660E\u7ED1\u54EA\u4E2A\u952E\uFF09\uFF0C\n // \u5F15\u64CE\u90A3\u4EFD\u6E05\u5355\u9A71\u52A8\u7684\u662F\u884C\u663E\u9690\u4E0E\u4FDD\u5B58\u65F6\u4FDD\u7559\u54EA\u4E9B\u952E\u3002\n formKeys: voiceFormKeys(internalMode),\n internalMode\n };\n }\n function voiceOptionsOf(field, provider) {\n const byProvider = field?.knownValuesByProvider?.voice;\n if (!byProvider || typeof byProvider !== "object") return null;\n const opts = byProvider[provider];\n return Array.isArray(opts) && opts.length > 0 ? [...opts] : null;\n }\n function mergeMyVoice(current2, form, schema) {\n const src = isPlainObject(current2) ? current2 : {};\n const knownKeys = schema ? schema.keysOf(form.provider) : void 0;\n const formKeys = schema?.formKeys ?? VOICE_FORM_KEYS;\n const keep = new Set(knownKeys ?? Object.keys(src).filter((k) => k !== "provider"));\n const accepts = (k) => knownKeys ? keep.has(k) : true;\n const value = { provider: form.provider };\n let keyDropped = false;\n for (const k of keep) {\n if (src[k] === void 0 || src[k] === null) continue;\n value[k] = src[k];\n }\n for (const k of formKeys) {\n if (!accepts(k)) continue;\n const v = form[k];\n if (v) value[k] = v;\n else delete value[k];\n }\n if (form.apiKey && accepts("apiKey")) value.apiKey = form.apiKey;\n for (const k of Object.keys(value)) {\n if (value[k] === null) {\n delete value[k];\n keyDropped = true;\n }\n }\n if (src.apiKey === null && value.apiKey === void 0) keyDropped = true;\n return { value, keyDropped };\n }\n function listProviders(providers) {\n if (!isPlainObject(providers)) return [];\n return Object.entries(providers).map(([id, raw]) => {\n const p = isPlainObject(raw) ? raw : {};\n const key = p.apiKey;\n const models = Array.isArray(p.models) ? p.models.map((m) => isPlainObject(m) && typeof m.id === "string" ? m.id : "").filter(Boolean) : [];\n return {\n id,\n baseUrl: typeof p.baseUrl === "string" ? p.baseUrl : "",\n apiKeyRef: typeof key === "string" ? key : "(\\u672A\\u8BBE\\u7F6E)",\n keyMasked: key === null,\n models\n };\n });\n }\n\n // web-console/desktop/src/renderer/console/panels/face.ts\n var PORTRAIT_WARNING_MARK = \'"portrait"\';\n var PORTRAIT_WARNING_NOTE = "\\u8FD9\\u6761\\u5728\\u9884\\u671F\\u4E4B\\u5185\\uFF1A\\u7167\\u7247\\u7531\\u6258\\u76D8\\u81EA\\u5DF1\\u590D\\u5236\\u5230 workspace/images/portrait.<ext>\\uFF0C\\u4E0D\\u4F9D\\u8D56\\u5F15\\u64CE\\u90A3\\u6761\\u8054\\u52A8\\u3002";\n function renderFacePanel(body, ctx) {\n const cur = pickPath(ctx.values, "tools.my_selfie") ?? {};\n const curPhoto = Array.isArray(cur.references) && cur.references[0] && typeof cur.references[0].path === "string" ? String(cur.references[0].path) : "";\n const curDesc = typeof cur.portraitDesc === "string" ? cur.portraitDesc : "";\n let photoRelPath = curPhoto;\n let savedPhoto = curPhoto;\n let savedDesc = curDesc;\n const photoLabel = h(\n "div",\n { class: "cf-hint", id: "face-photo" },\n curPhoto ? `\\u5F53\\u524D\\u7528\\u7684\\u7167\\u7247\\uFF1A${curPhoto}` : "\\u5F53\\u524D\\u6CA1\\u6709\\u53C2\\u8003\\u7167\\u7247"\n );\n const desc = h("textarea", {\n id: "face-desc",\n rows: 3,\n value: curDesc,\n placeholder: "\\u4E0D\\u9009\\u7167\\u7247\\u65F6\\uFF0C\\u7528\\u4E00\\u6BB5\\u63CF\\u8FF0\\u8BA9\\u52A9\\u624B\\u7B2C\\u4E00\\u6B21\\u81EA\\u62CD\\u65F6\\u6309\\u5B83\\u751F\\u6210",\n style: "width:100%"\n });\n const pick = h("button", {\n class: "btn",\n type: "button",\n id: "face-pick",\n onclick: () => {\n void (async () => {\n const src = await ctx.deps.pickImageFile();\n if (!src) return;\n const r = await ctx.deps.copyPortrait(ctx.stateDir, src);\n if (!r.ok) {\n bar.setStatus(`\\u7167\\u7247\\u6CA1\\u843D\\u76D8\\uFF1A${r.error}`, "err");\n return;\n }\n photoRelPath = r.relPath;\n photoLabel.textContent = `\\u5DF2\\u9009\\u7167\\u7247\\uFF1A${photoRelPath}\\uFF08\\u4FDD\\u5B58\\u540E\\u751F\\u6548\\uFF1B\\u7167\\u7247\\u4F18\\u5148\\uFF0C\\u63CF\\u8FF0\\u4F1A\\u88AB\\u5FFD\\u7565\\uFF09`;\n refreshSave();\n })();\n }\n }, "\\u9009\\u4E00\\u5F20\\u7167\\u7247");\n const clearPhoto = h("button", {\n class: "btn",\n type: "button",\n id: "face-clear",\n onclick: () => showClearConfirm()\n }, "\\u4E0D\\u7528\\u7167\\u7247");\n const photoRow = h("div", { class: "btn-row", id: "face-photo-row" }, pick, clearPhoto);\n const paintPhotoRow = () => {\n photoRow.replaceChildren(pick, clearPhoto);\n };\n const showClearConfirm = () => {\n photoRow.replaceChildren(\n h(\n "span",\n { class: "cf-hint", id: "face-clear-ask" },\n "\\u4E0D\\u518D\\u7528\\u8FD9\\u5F20\\u7167\\u7247\\uFF1F\\u7167\\u7247\\u6587\\u4EF6\\u4E0D\\u4F1A\\u88AB\\u5220\\uFF0C\\u8FD8\\u5728 workspace/images/ \\u91CC\\uFF0C\\u540E\\u6094\\u4E86\\u518D\\u9009\\u540C\\u4E00\\u5F20\\u5C31\\u80FD\\u56DE\\u6765\\uFF1B\\u8FD9\\u4E00\\u6B65\\u53EA\\u662F\\u8BA9\\u52A9\\u624B\\u4E0D\\u518D\\u7528\\u5B83\\uFF0C\\u70B9\\u300C\\u4FDD\\u5B58\\u300D\\u4E4B\\u540E\\u624D\\u751F\\u6548\\u3002"\n ),\n h("button", {\n class: "btn btn-primary",\n type: "button",\n id: "face-clear-yes",\n onclick: () => {\n photoRelPath = "";\n photoLabel.textContent = "\\u5DF2\\u6E05\\u6389\\u7167\\u7247\\u5F15\\u7528\\uFF08\\u6587\\u4EF6\\u8FD8\\u5728 workspace/images/\\uFF0C\\u672C\\u6B21\\u4FDD\\u5B58\\u540E\\u751F\\u6548\\uFF09";\n refreshSave();\n paintPhotoRow();\n }\n }, "\\u786E\\u8BA4\\u4E0D\\u7528"),\n h("button", { class: "btn", type: "button", id: "face-clear-no", onclick: () => {\n paintPhotoRow();\n } }, "\\u53D6\\u6D88")\n );\n };\n const save = h("button", { class: "btn btn-primary", type: "button", id: "cfg-save" }, "\\u4FDD\\u5B58");\n const status = h("div", { class: "inline-warn", id: "cfg-status", hidden: true });\n const detail = h("div", { class: "cfg-detail" });\n const refreshSave = () => {\n save.disabled = photoRelPath === savedPhoto && desc.value === savedDesc;\n };\n const bar = { setStatus: (m, k) => {\n status.hidden = false;\n status.textContent = m;\n status.style.color = k === "err" ? "var(--red)" : k === "ok" ? "var(--green)" : "";\n } };\n const renderDetail = (r) => {\n detail.replaceChildren(...setDetailBlocks(r, {\n warningNotes: [{ mark: PORTRAIT_WARNING_MARK, note: PORTRAIT_WARNING_NOTE }]\n }));\n };\n desc.addEventListener("input", refreshSave);\n save.addEventListener("click", () => {\n void (async () => {\n if (photoRelPath && desc.value.trim()) {\n bar.setStatus("\\u7167\\u7247\\u548C\\u63CF\\u8FF0\\u90FD\\u586B\\u4E86\\uFF1A\\u8FD9\\u6B21\\u6309\\u300C\\u7167\\u7247\\u300D\\u5B58\\uFF08\\u63CF\\u8FF0\\u4F1A\\u88AB\\u5FFD\\u7565\\uFF09\\u3002\\u60F3\\u7528\\u63CF\\u8FF0\\u8BF7\\u5148\\u70B9\\u300C\\u4E0D\\u7528\\u7167\\u7247\\u300D\\u3002", "info");\n }\n save.disabled = true;\n detail.replaceChildren();\n const merged = mergeMySelfie(cur, {\n photoRelPath,\n portraitDesc: desc.value.trim(),\n // provider \u4E0D\u6446\u5728\u8868\u5355\u91CC\uFF0C**\u4E5F\u4E0D\u66FF\u7528\u6237\u51B3\u5B9A**\uFF08cli-init-config.ts:475-481 \u7684\u53E3\u5F84\uFF09\uFF1A\n // \u8FD9\u4E00\u683C\u7F3A\u5E2D\u65F6\u4F20**\u7A7A\u4E32**\uFF0CmergeMySelfie \u8DF3\u8FC7\u5199\u5165\uFF0C\u5F15\u64CE\u843D\u56DE\u81EA\u5DF1\u7684\u9ED8\u8BA4\u503C\u3002\n // \u26A0\uFE0F \u65E9\u5148\u8FD9\u91CC\u515C\u5E95\u5199\u7684\u662F \'relay\'\uFF0C\u90A3\u662F\u9519\u7684\uFF1A\u514D\u8D39\u6863 init \u65E9\u5C31\u5199\u597D \'relay\'\uFF08\u4E0D\u9700\u8981\u515C\u5E95\uFF09\uFF0C\n // \u800C\u975E\u514D\u8D39\u6863\u88C5\u673A\u672C\u6765\u6CA1\u8FD9\u4E00\u683C\u3001\u5F15\u64CE\u9ED8\u8BA4\u662F **\'fal\'**\uFF08my-selfie.ts:90-92\uFF09\u2014\u2014\n // \u515C\u5E95\u53CD\u800C\u628A provider \u9759\u9ED8\u6539\u6210 \'relay\'\uFF0C\u4E0B\u4E00\u6B21\u81EA\u62CD\u76F4\u63A5\u62A5\u300Crelay provider \u672A\u914D\u7F6E\u300D\uFF0C\n // \u4E5F\u5C31\u662F"\u5F00\u4E00\u6B21\u5F62\u8C61\u9762\u677F\u5C31\u628A\u597D\u914D\u7F6E\u6539\u574F\u4E86"\u3002\n relayProvider: typeof cur.provider === "string" ? cur.provider : ""\n });\n const r = await ctx.deps.configSet(ctx.configPath, { "tools.my_selfie": merged.value });\n renderDetail(r);\n if (!r.ok) {\n refreshSave();\n bar.setStatus(`\\u4FDD\\u5B58\\u5931\\u8D25\\uFF1A${r.error ?? ""} ${r.errors.map((e) => e.error).join("\\uFF1B")}`, "err");\n return;\n }\n savedPhoto = photoRelPath;\n savedDesc = desc.value;\n refreshSave();\n let msg = `\\u5DF2\\u4FDD\\u5B58\\uFF1A${r.changed.join("\\u3001") || "\\uFF08\\u65E0\\u53D8\\u5316\\uFF09"}\\u3002`;\n if (merged.keyDropped) {\n msg += " \\u26A0\\uFE0F \\u8FD9\\u4E00\\u683C\\u91CC\\u6709\\u88AB\\u5F15\\u64CE\\u8131\\u654F\\u7684\\u51ED\\u636E\\uFF08config \\u91CC\\u5B58\\u7684\\u660E\\u6587\\uFF09\\uFF0C\\u5DF2\\u968F\\u8FD9\\u6B21\\u4FDD\\u5B58\\u53BB\\u6389\\u3002\\u8981\\u8865\\u56DE\\u6765\\u8BF7\\u76F4\\u63A5\\u7F16\\u8F91 config \\u91CC\\u7684 tools.my_selfie\\uFF0C\\u6216\\u53BB\\u300C\\u6A21\\u578B\\u670D\\u52A1\\u300D\\u91CC\\u6539\\u5B83\\u7528\\u7684\\u90A3\\u4E2A provider \\u7684 key\\u3002";\n }\n bar.setStatus(msg, "ok");\n })();\n });\n refreshSave();\n body.replaceChildren(\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "\\u53C2\\u8003\\u7167\\u7247\\uFF08\\u4F18\\u5148\\uFF09"),\n h(\n "p",\n { class: "page-sub" },\n "\\u9009\\u4E00\\u5F20\\u7167\\u7247\\u5F53\\u52A9\\u624B\\u81EA\\u62CD\\u7684\\u53C2\\u8003\\u56FE\\u3002\\u6211\\u4EEC\\u4F1A\\u628A\\u5B83\\u590D\\u5236\\u5230 workspace/images/portrait.<ext>\\uFF0C",\n "\\u5E76\\u5728 tools.my_selfie \\u91CC\\u8BB0\\u4E0B\\u8FD9\\u4E2A\\u5F15\\u7528\\u3002"\n ),\n photoLabel,\n photoRow\n ),\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "\\u5F62\\u8C61\\u63CF\\u8FF0\\uFF08\\u6CA1\\u6709\\u7167\\u7247\\u65F6\\u624D\\u7528\\uFF09"),\n h("p", { class: "page-sub" }, "\\u4E00\\u53E5\\u8BDD\\u63CF\\u8FF0\\u4F60\\u60F3\\u8981\\u7684\\u6837\\u5B50\\uFF1B\\u52A9\\u624B\\u7B2C\\u4E00\\u6B21\\u81EA\\u62CD\\u65F6\\u6309\\u5B83\\u751F\\u6210\\u3002"),\n desc\n ),\n h("p", { class: "cf-hint" }, "\\u6570\\u5B57\\u4EBA\\u5F62\\u8C61\\uFF08\\u4F1A\\u52A8\\u7684\\u90A3\\u4E2A\\uFF09\\u4E0D\\u5728\\u8FD9\\u91CC\\u2014\\u2014\\u5B83\\u8DD1\\u5728\\u8FDC\\u7AEF\\u7684\\u56FE\\u5F62\\u670D\\u52A1\\u4E0A\\uFF0C\\u5F52\\u540E\\u7EED\\u7248\\u672C\\u3002"),\n h("div", { class: "cfg-savebar" }, h("div", { class: "btn-row" }, save), status, detail)\n );\n return () => {\n };\n }\n\n // web-console/desktop/src/shared/zones.ts\n function detectZone() {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone || "";\n } catch {\n return "";\n }\n }\n var ALL_ZONES = (() => {\n try {\n const intl = Intl;\n return intl.supportedValuesOf?.("timeZone") || [];\n } catch {\n return [];\n }\n })();\n\n // web-console/desktop/src/renderer/shared/model-picker.ts\n function createModelPicker(opts) {\n const CUSTOM = "__custom__";\n const select = h("select", { id: opts.selectId, "aria-label": opts.label });\n const input = h("input", {\n type: "text",\n id: opts.inputId,\n placeholder: opts.placeholder,\n "aria-label": `${opts.label} \\xB7 \\u81EA\\u5B9A\\u4E49`,\n style: "display:none"\n });\n let customDraft;\n const showCustom = () => {\n input.style.display = select.value === CUSTOM ? "" : "none";\n };\n input.addEventListener("input", () => {\n if (select.value === CUSTOM) customDraft = input.value;\n });\n select.addEventListener("change", () => {\n if (select.value === CUSTOM) input.value = customDraft ?? input.value;\n else input.value = select.value;\n showCustom();\n if (select.value === CUSTOM) input.focus();\n input.dispatchEvent(new Event("input", { bubbles: true }));\n });\n return {\n root: h("div", { class: "model-picker", style: "display:grid;gap:8px" }, select, input),\n input,\n update(options, value) {\n const unique = [...new Map(options.filter((o) => o.value && o.value !== CUSTOM).map((o) => [o.value, o])).values()];\n const isCustom = !unique.some((o) => o.value === value) && !(value === "" && opts.emptyLabel !== void 0);\n input.value = value;\n customDraft = isCustom ? value : void 0;\n select.replaceChildren(\n ...opts.emptyLabel === void 0 ? [] : [h("option", { value: "", selected: value === "" }, opts.emptyLabel)],\n ...unique.map((o) => h("option", { value: o.value, selected: o.value === value }, o.label ?? o.value)),\n h("option", { value: CUSTOM, selected: isCustom }, "\\u81EA\\u5B9A\\u4E49\\u2026")\n );\n showCustom();\n }\n };\n }\n\n // web-console/desktop/src/renderer/console/form.ts\n var LOCKED_PATHS = /* @__PURE__ */ new Set([\n "stateDir",\n "mediaDir",\n "agents.defaults.workspace",\n "skills.path"\n ]);\n var LOCKED_HINT = "\\u8FD9\\u4E00\\u683C\\u6258\\u76D8\\u4E0D\\u7ED9\\u6539 \\u2014\\u2014 \\u6539\\u5B83\\u4F1A\\u628A\\u8FD9\\u4E2A\\u5F15\\u64CE\\u6307\\u5230\\u53E6\\u4E00\\u4E2A\\u76EE\\u5F55\\u3002\\u8981\\u6539\\u8BF7\\u76F4\\u63A5\\u7F16\\u8F91\\u5F15\\u64CE\\u914D\\u7F6E\\u6587\\u4EF6\\u3002";\n var JSON_LOCKED_HINT = "\\u8FD9\\u4E00\\u683C\\u6258\\u76D8\\u4E0D\\u7ED9\\u6539 \\u2014\\u2014 \\u5B83\\u662F JSON\\uFF0C\\u901A\\u7528\\u8868\\u5355\\u6CA1\\u6709\\u5B89\\u5168\\u7684\\u7F16\\u8F91\\u5668\\uFF08\\u53EF\\u7F16\\u8F91\\u4F1A\\u628A\\u5BF9\\u8C61\\u5F53\\u6210\\u5B57\\u7B26\\u4E32\\u5199\\u56DE config\\uFF09\\u3002\\u8981\\u6539\\u8BF7\\u7528\\u5BF9\\u5E94\\u7684\\u4E13\\u7528\\u9762\\u677F\\uFF0C\\u6216\\u76F4\\u63A5\\u7F16\\u8F91 config\\u3002";\n function lockedHintOf(field) {\n return LOCKED_PATHS.has(field.path) ? LOCKED_HINT : JSON_LOCKED_HINT;\n }\n function toText(v) {\n if (v === null || v === void 0) return "";\n if (typeof v === "string") return v;\n if (typeof v === "number" || typeof v === "boolean") return String(v);\n try {\n return JSON.stringify(v, null, 2);\n } catch {\n return "";\n }\n }\n function fromText(field, text) {\n if (field.type === "number") {\n const t = text.trim();\n if (t === "") return "";\n const n = Number(t);\n return Number.isFinite(n) ? n : t;\n }\n return text;\n }\n function renderForm(fields, values, secrets, deps, extras = {}) {\n const rows = [];\n const root = h("div", { class: "cf-form" });\n for (const field of fields) {\n const raw = pickPath(values, field.path);\n const ex = extras[field.path] ?? {};\n const err = h("div", { class: "cf-error", hidden: true });\n const notice = h("div", { class: "cf-error cf-notice", hidden: true });\n let input;\n let initial;\n let outside;\n let resetSecret = null;\n const locked = field.type === "json" || LOCKED_PATHS.has(field.path);\n if (field.type === "boolean") {\n const checked = raw === void 0 ? ex.booleanDefault === true : raw === true;\n input = h("input", { type: "checkbox", checked, "aria-label": ex.label ?? field.label });\n initial = checked;\n outside = h("div", { class: "check-row" }, input);\n } else if (field.type === "enum") {\n const current2 = raw === void 0 ? ex.enumDefault : raw;\n const opts = [...field.options ?? []];\n if (typeof current2 === "string" && current2 && !opts.includes(current2)) opts.unshift(current2);\n else if (current2 === void 0) opts.unshift("");\n input = h("select", { "aria-label": ex.label ?? field.label }, ...opts.map((o) => h("option", { value: o, selected: o === current2 }, ex.optionLabels?.[o] ?? o)));\n initial = current2;\n outside = input;\n } else if (field.type === "secret") {\n const st = secretState(field, values, secrets);\n const cur = typeof raw === "string" ? raw : "";\n input = h("input", {\n type: "password",\n value: "",\n autocomplete: "new-password",\n placeholder: cur ? `\\u7559\\u7A7A\\u4E0D\\u6539\\uFF08\\u5F53\\u524D\\u662F ${cur.slice(0, 24)}\\uFF09` : "\\u586B\\u4E00\\u4E2A\\u503C"\n });\n initial = "";\n const badge2 = h("span", { class: `sec-badge sec-${st.kind}` }, st.text);\n const syncBadge = () => {\n badge2.textContent = input.value ? "\\u5C06\\u5199\\u5165\\u65B0\\u503C" : st.text;\n badge2.className = `sec-badge ${input.value ? "sec-new" : `sec-${st.kind}`}`;\n };\n input.addEventListener("input", syncBadge);\n input._badge = badge2;\n resetSecret = () => {\n input.value = "";\n syncBadge();\n };\n outside = input;\n } else if (field.type === "path" && LOCKED_PATHS.has(field.path)) {\n const ro = h("input", { type: "text", value: toText(raw) });\n ro.readOnly = true;\n input = ro;\n initial = raw;\n outside = input;\n } else if (field.type === "path" || field.type === "image") {\n input = h("input", { type: "text", value: toText(raw), placeholder: ex.placeholder ?? "" });\n initial = raw;\n const btn = h("button", {\n class: "btn",\n type: "button",\n onclick: () => {\n void (async () => {\n const picked = field.type === "image" ? await deps.pickImageFile() : await deps.pickDirectory();\n if (!picked) return;\n input.value = picked;\n input.dispatchEvent(new Event("input", { bubbles: true }));\n })();\n }\n }, field.type === "image" ? "\\u9009\\u56FE\\u2026" : "\\u6D4F\\u89C8\\u2026");\n outside = h("div", { class: "path-row" }, input, btn);\n } else if (field.type === "json") {\n const ta = h("textarea", { rows: 6, value: toText(raw) });\n ta.readOnly = true;\n input = ta;\n initial = raw;\n const masked = findNullCredentials(raw);\n if (masked.length > 0) {\n notice.hidden = false;\n notice.textContent = `\\u8FD9\\u4E00\\u683C\\u91CC\\u6709\\u88AB\\u5F15\\u64CE\\u8131\\u654F\\u7684\\u51ED\\u636E\\uFF08${masked.join("\\u3001")}\\uFF09\\u2014\\u2014\\u672C\\u9762\\u677F\\u4E0D\\u4F1A\\u4FDD\\u5B58\\u8FD9\\u4E00\\u683C\\uFF08json \\u5B57\\u6BB5\\u4E00\\u5F8B\\u53EA\\u8BFB\\u3001\\u4E0D\\u8FDB\\u63D0\\u4EA4\\uFF09\\u3002\\u8981\\u6539\\u5B83\\uFF0C\\u8BF7\\u7528\\u5BF9\\u5E94\\u7684\\u4E13\\u7528\\u9762\\u677F\\uFF0C\\u6216\\u5148\\u8DD1 engine7 config migrate\\u3002`;\n }\n outside = input;\n } else if (field.type === "string" && ex.modelOptions) {\n const picker = createModelPicker({\n label: ex.label ?? field.label,\n placeholder: ex.placeholder ?? "\\u586B\\u5199\\u6A21\\u578B\\uFF0C\\u4F8B\\u5982\\uFF1A7yi/engine7-free",\n emptyLabel: ex.modelEmptyLabel ?? "\\u672A\\u8BBE\\u7F6E"\n });\n picker.update(ex.modelOptions.map((value) => ({ value })), toText(raw));\n input = picker.input;\n initial = raw;\n outside = picker.root;\n } else {\n input = h("input", { type: "text", value: toText(raw), placeholder: ex.placeholder ?? "" });\n initial = raw;\n if (ex.suggest) {\n const listId = `cfg-list-${field.path.replace(/[^a-zA-Z0-9]/g, "-")}`;\n input.setAttribute("list", listId);\n input._datalist = h("datalist", { id: listId }, ...ex.suggest.map((z) => h("option", { value: z })));\n }\n outside = input;\n }\n input.addEventListener("input", () => {\n err.hidden = true;\n });\n const badge = effectBadge(field.effect);\n const cell = h(\n "div",\n { class: "cf-field", "data-path": field.path },\n h(\n "label",\n {},\n ex.label ?? field.label,\n ex.showPath === false ? null : h("span", { class: "cf-path" }, field.path),\n badge ? h("span", { class: `fx-badge ${badge.cls}` }, badge.text) : null\n ),\n ex.hint ? h("p", { class: "cf-hint" }, ex.hint) : null,\n // \u53EA\u8BFB\u6863\u7684\u8BF4\u660E**\u5FC5\u987B\u662F\u72EC\u7ACB\u5143\u7D20**\uFF08\u4E0E json \u90A3\u6761 notice \u540C\u7406\uFF09\uFF1Aerr \u4F1A\u88AB setError(nil) /\n // clearErrors() \u53CD\u590D\u6E05\uFF0C\u63D0\u793A\u5199\u8FDB\u5B83\u91CC\u9762\u5C31\u4F1A\u5728\u7B2C\u4E00\u6B21\u4FDD\u5B58\u540E\u6C38\u4E45\u6D88\u5931\uFF0C\u800C\u8FD9\u4E00\u683C\u552F\u4E00\u7684\n // \u4FDD\u62A4\u8BF4\u660E\u5C31\u662F\u5B83\u3002\u8FD9\u91CC\u6302\u5728\u9759\u6001\u7ED3\u6784\u91CC\uFF0C\u53EA\u52A0\u4E0D\u6E05\u3002\n locked ? h("p", { class: "cf-hint cf-locked" }, lockedHintOf(field)) : null,\n outside,\n input._badge ?? null,\n input._datalist ?? null,\n err,\n notice\n );\n root.append(cell);\n const read = () => {\n if (locked) return void 0;\n if (field.type === "boolean") return input.checked;\n if (field.type === "secret") {\n const v2 = input.value;\n return v2 === "" ? void 0 : v2;\n }\n const v = fromText(field, input.value);\n if (v === "" && initial === void 0) return void 0;\n return v;\n };\n rows.push({\n field,\n el: cell,\n input,\n read,\n isChanged: () => {\n const v = read();\n if (v === void 0) return false;\n return !sameValue(v, initial);\n },\n setError: (msg) => {\n err.hidden = msg === null;\n if (msg) err.textContent = msg;\n },\n snapshot: () => {\n if (resetSecret) {\n resetSecret();\n return;\n }\n initial = read();\n }\n });\n }\n return {\n rows,\n root,\n changed() {\n const out = {};\n for (const r of rows) if (r.isChanged()) out[r.field.path] = r.read();\n return out;\n },\n markError(path, msg) {\n for (const r of rows) {\n if (r.field.path === path) {\n r.setError(msg);\n return;\n }\n }\n },\n clearErrors() {\n for (const r of rows) r.setError(null);\n }\n };\n }\n\n // web-console/desktop/src/renderer/console/save-bar.ts\n function buildSaveBar(form, ctx, opts = {}) {\n const save = h("button", { class: "btn btn-primary", type: "button", id: "cfg-save" }, "\\u4FDD\\u5B58");\n const status = h("div", { class: "inline-warn", id: "cfg-status", hidden: true });\n const detail = h("div", { class: "cfg-detail" });\n const refresh = () => {\n save.disabled = Object.keys(form.changed()).length === 0;\n };\n save.disabled = true;\n form.root.addEventListener("input", refresh);\n form.root.addEventListener("change", refresh);\n const setStatus = (msg, kind) => {\n status.hidden = false;\n status.textContent = msg;\n status.style.color = kind === "err" ? "var(--red)" : kind === "ok" ? "var(--green)" : "";\n };\n save.addEventListener("click", () => {\n void (async () => {\n const blocked = opts.beforeSave?.();\n if (blocked) {\n setStatus(blocked, "err");\n return;\n }\n const payload = form.changed();\n if (Object.keys(payload).length === 0) {\n setStatus("\\u6CA1\\u6709\\u6539\\u52A8\\uFF0C\\u6CA1\\u4EC0\\u4E48\\u8981\\u4FDD\\u5B58\\u7684", "info");\n return;\n }\n save.disabled = true;\n detail.replaceChildren();\n setStatus("\\u6B63\\u5728\\u5199\\u5165\\u2026", "info");\n const r = await ctx.deps.configSet(ctx.configPath, payload);\n form.clearErrors();\n const shown = /* @__PURE__ */ new Set();\n for (const e of r.errors) {\n const hit = form.rows.some((row) => row.field.path === e.path);\n if (hit) {\n form.markError(e.path, e.error);\n shown.add(e.path);\n }\n }\n const note = typeof opts.changedNote === "function" ? opts.changedNote(r) : opts.changedNote;\n if (r.ok) {\n form.clearErrors();\n for (const row of form.rows) row.snapshot();\n refresh();\n setStatus(`\\u5DF2\\u4FDD\\u5B58\\uFF1A${r.changed.map((p) => opts.labels?.[p] ?? p).join("\\u3001") || "\\uFF08\\u65E0\\u5B57\\u6BB5\\u53D8\\u5316\\uFF09"}\\u3002${note ?? ""}`, "ok");\n } else {\n refresh();\n setStatus(`\\u4FDD\\u5B58\\u5931\\u8D25\\uFF1A${r.error ?? "\\u672A\\u77E5\\u540D\\u539F\\u56E0"}`, "err");\n }\n detail.replaceChildren(...setDetailBlocks(r, {\n shownPaths: shown,\n onMigrate: () => {\n void runMigrate();\n },\n onRestart: () => {\n ctx.actions.restart();\n setStatus("\\u6B63\\u5728\\u91CD\\u542F\\u5F15\\u64CE\\u2026", "info");\n }\n }));\n async function runMigrate() {\n setStatus("\\u6B63\\u5728\\u8FC1\\u79FB\\u2026", "info");\n const m = await ctx.deps.configMigrate(ctx.configPath);\n setStatus(m.ok ? `\\u8FC1\\u79FB\\u5B8C\\u6210\\uFF0C\\u642C\\u4E86 ${m.changed.length} \\u9879\\uFF08\\u5907\\u4EFD ${m.backup ?? "\\u65E0"}\\uFF09\\u3002\\u91CD\\u65B0\\u4FDD\\u5B58\\u4E00\\u6B21\\u4E0A\\u9762\\u90A3\\u51E0\\u9879\\u5373\\u53EF\\u3002` : `\\u8FC1\\u79FB\\u5931\\u8D25\\uFF1A${m.error ?? m.errors.map((x) => x.error).join("\\uFF1B")}`, m.ok ? "ok" : "err");\n }\n })();\n });\n return { el: h("div", { class: "cfg-savebar" }, h("div", { class: "btn-row" }, save), status, detail), refresh, setStatus };\n }\n\n // web-console/desktop/src/renderer/console/panels/general.ts\n var PINNED_ZONES = [\n "Asia/Shanghai",\n "Asia/Hong_Kong",\n "Asia/Taipei",\n "Asia/Tokyo",\n "Asia/Seoul",\n "Asia/Singapore",\n "UTC"\n ];\n function zoneSuggestions(localZone) {\n const head = [];\n if (localZone) head.push(localZone);\n for (const z of PINNED_ZONES) if (!head.includes(z)) head.push(z);\n return head.concat(ALL_ZONES.filter((z) => !head.includes(z)));\n }\n function safeLocalZone() {\n try {\n return detectZone() || "";\n } catch {\n return "";\n }\n }\n function generalChangedNote(r) {\n return r.needsRestart.length > 0 ? "" : "\\u4FDD\\u5B58\\u540E\\u5F15\\u64CE\\u4F1A\\u70ED\\u52A0\\u8F7D\\uFF0C\\u4E0D\\u7528\\u91CD\\u542F\\u3002";\n }\n function renderGeneralPanel(body, ctx) {\n const localZone = safeLocalZone();\n const fields = ctx.fields.filter((f) => f.path === "timezone" || f.path === "agents.defaults.name");\n const form = renderForm(fields, ctx.values, ctx.secrets, ctx.deps, {\n timezone: {\n suggest: zoneSuggestions(localZone),\n // \u7070\u5B57 = \u672C\u673A\u63A2\u6D4B\u503C\u3002**\u7559\u7A7A\u65F6\u8FD9\u4E00\u683C\u672C\u6765\u5C31\u662F"\u8DDF\u968F\u672C\u673A"**\uFF08\u5F15\u64CE resolveTimezone \u628A\n // \u7A7A\u4E32/\u7F3A\u5B57\u6BB5\u90FD\u5F53\u63A2\u6D4B\u672C\u673A\uFF09\uFF0C\u539F\u6765\u53EA\u5B57\u672A\u63D0\uFF0C\u7528\u6237\u770B\u7740\u7A7A\u6846\u4EE5\u4E3A"\u6CA1\u914D"\u3002\n placeholder: localZone || "\\u4F8B\\u5982 Asia/Shanghai",\n hint: `\\u51B3\\u5B9A\\u65E5\\u5386\\u3001\\u4E3B\\u52A8\\u5524\\u9192\\u3001\\u5B9A\\u65F6\\u4EFB\\u52A1\\u6309\\u54EA\\u4E2A\\u65F6\\u533A\\u7B97\\u89E6\\u53D1\\u65F6\\u523B\\u3002\\u7559\\u7A7A = \\u8DDF\\u968F\\u672C\\u673A\\u65F6\\u533A\\uFF08\\u7070\\u5B57\\u5C31\\u662F\\u63A2\\u6D4B\\u5230\\u7684\\u90A3\\u4E2A${localZone ? `\\uFF1A${localZone}` : ""}\\uFF09\\u3002\\u5217\\u8868\\u4E5F\\u53EF\\u76F4\\u63A5\\u8F93\\u5165\\u7B5B\\u9009\\uFF0C\\u4F8B\\u5982\\u8F93\\u5165 shanghai\\u3002`\n },\n "agents.defaults.name": {\n hint: "\\u52A9\\u624B\\u5728\\u5BF9\\u8BDD\\u91CC\\u81EA\\u79F0\\u7684\\u540D\\u5B57\\u3002SOUL.md \\u6B63\\u6587\\u91CC\\u7684\\u65E7\\u540D\\u5B57\\u4E0D\\u4F1A\\u8DDF\\u7740\\u6539\\u2014\\u2014\\u6539\\u5B8C\\u8DDF\\u81EA\\u5DF1\\u7684\\u52A9\\u624B\\u8BF4\\u4E00\\u58F0\\uFF0C\\u8BA9\\u5B83\\u81EA\\u5DF1\\u6539\\u3002"\n }\n });\n const tzRow = form.rows.find((r) => r.field.path === "timezone");\n if (tzRow) {\n tzRow.el.append(h(\n "div",\n { class: "btn-row" },\n h("button", {\n class: "btn",\n type: "button",\n id: "tz-follow-local",\n onclick: () => {\n const el = tzRow.input;\n el.value = "";\n el.dispatchEvent(new Event("input", { bubbles: true }));\n }\n }, localZone ? `\\u8DDF\\u968F\\u672C\\u673A\\uFF08${localZone}\\uFF09` : "\\u8DDF\\u968F\\u672C\\u673A")\n ));\n }\n const bar = buildSaveBar(form, ctx, { changedNote: generalChangedNote });\n const autoStatus = h("div", { class: "cf-hint", id: "autostart-status" });\n const autoBtn = h("button", {\n class: "btn",\n type: "button",\n id: "autostart-enable",\n onclick: () => {\n void (async () => {\n autoStatus.textContent = "\\u6B63\\u5728\\u5199\\u5165\\u542F\\u52A8\\u9879\\u2026";\n const r = await ctx.deps.autostartEnable();\n autoStatus.textContent = r.code === 0 ? `\\u5DF2\\u8BBE\\u7F6E\\u5F00\\u673A\\u81EA\\u542F\\uFF08\\u5F00\\u673A\\u8D77\\u6765\\u7684\\u662F\\u6258\\u76D8\\uFF0C\\u4E0D\\u662F\\u5F15\\u64CE\\uFF09\\u3002\\u6587\\u4EF6\\uFF1A${r.file ?? "(\\u672A\\u77E5)"}` : `\\u8BBE\\u7F6E\\u5F00\\u673A\\u81EA\\u542F\\u5931\\u8D25\\uFF1A${r.error ?? `\\u9000\\u51FA\\u7801 ${r.code}`}`;\n })();\n }\n }, "\\u8BBE\\u7F6E\\u5F00\\u673A\\u81EA\\u542F");\n body.replaceChildren(\n form.root,\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "\\u5F00\\u673A\\u81EA\\u542F"),\n h("p", { class: "page-sub" }, "\\u5F00\\u673A\\u65F6\\u81EA\\u52A8\\u628A\\u6258\\u76D8\\u62C9\\u8D77\\u6765\\uFF1B\\u5B83\\u77E5\\u9053\\u4F60\\u88C5\\u4E86\\u51E0\\u4E2A\\u5F15\\u64CE\\u5E76\\u6309\\u4E0A\\u6B21\\u7684\\u72B6\\u6001\\u62C9\\u8D77\\uFF08\\u4F60\\u4E3B\\u52A8\\u505C\\u8FC7\\u7684\\u4E0D\\u4F1A\\u88AB\\u62C9\\u8D77\\u6765\\uFF09\\u3002"),\n h("div", { class: "btn-row" }, autoBtn),\n autoStatus\n ),\n bar.el\n );\n return () => {\n };\n }\n\n // web-console/desktop/src/renderer/console/panels/identity.ts\n var NO_PERSONA = "\\u6211\\u65B0\\u9009\\u7684\\u90A3\\u4E00\\u6863";\n var SOUL_NOTE = "SOUL.md \\u6CA1\\u6709\\u52A8\\u2014\\u2014\\u60F3\\u8BA9\\u5B83\\u4E5F\\u8DDF\\u4E0A\\uFF0C\\u628A\\u4E0B\\u9762\\u8FD9\\u6BB5\\u8BDD\\u7C98\\u7ED9\\u4F60\\u7684\\u52A9\\u624B\\u3002";\n var noteOf = (r, staleWhy) => {\n const stale = staleWhy === null ? "" : `\\uFF08\\u6CA1\\u80FD\\u73B0\\u8BFB config\\uFF1A${staleWhy}\\uFF1B\\u540D\\u5B57\\u4E0E\\u4EBA\\u8BBE\\u7528\\u7684\\u662F\\u6253\\u5F00\\u8BBE\\u7F6E\\u9875\\u65F6\\u90A3\\u4EFD\\uFF09`;\n if (!r.ok) {\n return `\\u4EBA\\u8BBE\\u5DF2\\u6539\\uFF0C\\u4F46\\u914D\\u5957\\u4EF6\\uFF08\\u60C5\\u7EEA\\u8868 / \\u5185\\u5FC3\\u620F\\u63D0\\u793A\\u8BCD\\uFF09\\u6CA1\\u6362\\u6210\\u529F\\uFF1A${r.error ?? "\\u672A\\u77E5\\u539F\\u56E0"}\\u3002${stale}${SOUL_NOTE}`;\n }\n const extra = r.warnings.length > 0 ? `\\uFF1B${r.warnings.join("\\uFF1B")}` : "";\n return r.created.length > 0 ? `\\u4EBA\\u8BBE\\u5DF2\\u6539\\uFF0C\\u56DB\\u4E2A\\u6863\\u4F4D\\u7684\\u914D\\u5957\\u4EF6\\u5DF2\\u94FA\\u597D\\uFF08\\u65B0\\u589E ${r.created.length} \\u4EFD\\uFF09${extra}\\u3002${stale}${SOUL_NOTE}` : `\\u4EBA\\u8BBE\\u5DF2\\u6539\\uFF0C\\u914D\\u5957\\u4EF6\\u5DF2\\u94FA\\u597D\\uFF08\\u6CA1\\u6709\\u65B0\\u589E\\uFF0C\\u4E4B\\u524D\\u5C31\\u6709\\u4E86\\uFF09${extra}\\u3002${stale}${SOUL_NOTE}`;\n };\n var hintText = (persona) => `\\u8BF7\\u628A\\u4EBA\\u8BBE\\uFF08SOUL.md\\uFF09\\u6539\\u6210 ${persona} \\u7684\\u98CE\\u683C\\uFF1A\\u5148\\u8BFB\\u4E00\\u904D\\u73B0\\u5728\\u7684 SOUL.md\\uFF0C\\u6309\\u4F60\\u5BF9\\u6211\\u7684\\u4E86\\u89E3\\u91CD\\u5199\\u5B83\\u2014\\u2014\\u4FDD\\u7559\\u6211\\u4EEC\\u4E4B\\u95F4\\u5DF2\\u7ECF\\u6709\\u8FC7\\u7684\\u7EA6\\u5B9A\\uFF0C\\u4E0D\\u8981\\u4ECE\\u6A21\\u677F\\u91CD\\u6284\\u4E00\\u4EFD\\u3002\\u6539\\u5B8C\\u544A\\u8BC9\\u6211\\u4F60\\u6539\\u4E86\\u4EC0\\u4E48\\u3002`;\n function renderIdentityPanel(body, ctx) {\n const fields = ctx.fields.filter((f) => f.path === "agents.defaults.persona");\n const saveOpts = { changedNote: `\\u4EBA\\u8BBE\\u5DF2\\u6539\\u3002${SOUL_NOTE}` };\n const textOf = (values, p) => {\n const v = pickPath(values, p);\n return typeof v === "string" ? v : "";\n };\n const deps = {\n ...ctx.deps,\n configSet: async (configPath, values) => {\n let cur = ctx.values;\n let staleWhy = null;\n try {\n const fresh = await ctx.deps.configGet(configPath);\n if (fresh.ok) cur = fresh.values;\n else staleWhy = fresh.error ?? "\\u672A\\u77E5\\u539F\\u56E0";\n } catch (e) {\n staleWhy = e instanceof Error ? e.message : String(e);\n }\n let r;\n try {\n r = await ctx.deps.scaffoldPersonas(\n ctx.stateDir,\n textOf(cur, "agents.defaults.name"),\n textOf(cur, "agents.defaults.persona")\n );\n } catch (e) {\n r = { ok: false, created: [], skipped: [], warnings: [], error: e instanceof Error ? e.message : String(e) };\n }\n saveOpts.changedNote = noteOf(r, staleWhy);\n return ctx.deps.configSet(configPath, values);\n }\n };\n const form = renderForm(fields, ctx.values, ctx.secrets, deps, {\n "agents.defaults.persona": {\n hint: "\\u53EA\\u6539\\u8FD9\\u4E00\\u683C\\uFF1A\\u5F15\\u64CE\\u4F1A\\u6309\\u65B0\\u7684\\u4EBA\\u8BBE\\u628A\\u60C5\\u7EEA\\u8868\\u548C\\u5185\\u5FC3\\u620F\\u63D0\\u793A\\u8BCD\\u6362\\u8FC7\\u53BB\\uFF08workspace/personas/<\\u4EBA\\u8BBE>/\\uFF09\\u3002SOUL.md \\u4E0D\\u52A8\\u2014\\u2014\\u90A3\\u662F\\u4F60\\u548C\\u4F60\\u52A9\\u624B\\u4E4B\\u95F4\\u7684\\u4E8B\\u3002"\n }\n });\n const bar = buildSaveBar(form, { ...ctx, deps }, saveOpts);\n const hintBox = h("textarea", { id: "identity-hint", rows: 4, readonly: true, style: "width:100%" });\n const setHint = (t) => {\n hintBox.value = t;\n hintBox.textContent = t;\n };\n const syncHint = () => {\n const row = form.rows[0];\n const picked = row ? row.input.value.trim() : "";\n setHint(hintText(picked || NO_PERSONA));\n };\n syncHint();\n form.root.addEventListener("input", syncHint);\n form.root.addEventListener("change", syncHint);\n const copyBtn = h("button", {\n class: "btn",\n type: "button",\n id: "identity-copy-hint",\n onclick: () => {\n void (async () => {\n hintBox.select();\n try {\n const copied = document.execCommand("copy");\n copyBtn.textContent = copied ? "\\u5DF2\\u590D\\u5236" : "\\u590D\\u5236\\u5931\\u8D25\\uFF0C\\u8BF7\\u6309 Ctrl/Cmd+C";\n if (copied) setTimeout(() => {\n copyBtn.textContent = "\\u590D\\u5236\\u8FD9\\u6BB5\\u8BDD";\n }, 1500);\n } catch {\n copyBtn.textContent = "\\u590D\\u5236\\u5931\\u8D25\\uFF0C\\u8BF7\\u6309 Ctrl/Cmd+C";\n }\n })();\n }\n }, "\\u590D\\u5236\\u8FD9\\u6BB5\\u8BDD");\n body.replaceChildren(\n form.root,\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "SOUL.md \\u4E0D\\u4F1A\\u81EA\\u52A8\\u6539"),\n h(\n "p",\n { class: "page-sub" },\n "\\u4EBA\\u8BBE\\u53D8\\u4E86\\uFF0C\\u4F46 SOUL.md \\u91CC\\u53EF\\u80FD\\u8FD8\\u5199\\u7740\\u65E7\\u7684\\u4EBA\\u8BBE\\u548C\\u65E7\\u7684\\u540D\\u5B57\\u3002\\u6211\\u4EEC\\u4E0D\\u4F1A\\u66FF\\u4F60\\u6539\\u5B83\\u2014\\u2014",\n "\\u90A3\\u662F\\u4F60\\u548C\\u4F60\\u52A9\\u624B\\u4E4B\\u95F4\\u7684\\u4E8B\\uFF0C\\u4EE3\\u6539\\u4F1A\\u628A\\u4F60\\u4EEC\\u5DF2\\u7ECF\\u5199\\u8FC7\\u7684\\u4E1C\\u897F\\u51B2\\u6389\\u3002\\u628A\\u4E0B\\u9762\\u8FD9\\u6BB5\\u7C98\\u7ED9\\u4F60\\u7684\\u52A9\\u624B\\u5C31\\u884C\\uFF1A"\n ),\n hintBox,\n h("div", { class: "btn-row" }, copyBtn)\n ),\n bar.el\n );\n return () => {\n };\n }\n\n // web-console/desktop/src/renderer/console/panels/model.ts\n var PLAIN_FIELDS = [\n "agents.defaults.model.primary",\n "agents.defaults.model.vision",\n // \u26A0\uFE0F \u964D\u7EA7\u94FE\u4E24\u9879**\u4E0D\u5728\u8FD9\u91CC**\uFF1A\u5B83\u4EEC\u662F\u6570\u7EC4\uFF0C\u8D70\u4E0B\u9762 renderChainEditor \u81EA\u5DF1\u7684\u7F16\u8F91\u5668\u3002\n // \uFF08\u66FE\u7ECF\u628A\u5B83\u4EEC\u4E22\u7ED9 renderForm \u2014\u2014 json \u5B57\u6BB5\u5728\u90A3\u91CC\u53EA\u8BFB\uFF08\u7EAA\u5F8B 4\uFF09\uFF0C\u4E8E\u662F\u9875\u9762\u4E0A\u51FA\u73B0\u4E00\u4E2A\n // **\u770B\u7740\u80FD\u586B\u3001\u5176\u5B9E\u4E0D\u80FD**\u7684\u7A7A\u6846\uFF0C\u8FD8\u53E0\u4E86\u4E24\u53E5"\u8981\u6539\u8BF7\u7528\u4E13\u7528\u9762\u677F"\u800C\u90A3\u4E2A\u9762\u677F\u5E76\u4E0D\u5B58\u5728\u3002\n // \u7FC0\u54E5 0927 \u6307\u51FA"\u7528\u6237\u5565\u4F53\u9A8C"\uFF0C\u8FD9\u91CC\u662F\u4FEE\u3002\uFF09\n "tools.my_eyes.model",\n "tools.tavily.apiKey",\n "api.port"\n ];\n function renderChainEditor(path, label, hint, ctx, bar) {\n const cur = pickPath(ctx.values, path);\n const initial = Array.isArray(cur) ? cur.map((x) => String(x)) : [];\n const ta = h("textarea", {\n rows: "3",\n style: "width:100%; font-family: inherit",\n placeholder: "\\u4E00\\u884C\\u4E00\\u4E2A\\uFF0C\\u4F8B\\u5982\\uFF1A\\n7yi/engine7-free\\nzai-anthropic/glm-5.3"\n });\n ta.value = initial.join("\\n");\n const detail = h("div", { class: "cfg-detail" });\n const btn = h("button", {\n class: "btn",\n type: "button",\n onclick: () => {\n void (async () => {\n const next = ta.value.split("\\n").map((s) => s.trim()).filter((s) => s !== "");\n if (JSON.stringify(next) === JSON.stringify(initial)) {\n bar.setStatus("\\u8FD9\\u4E00\\u683C\\u6CA1\\u6539\\u52A8", "info");\n return;\n }\n btn.disabled = true;\n detail.replaceChildren();\n const r = await ctx.deps.configSet(ctx.configPath, { [path]: next });\n btn.disabled = false;\n detail.replaceChildren(...setDetailBlocks(r));\n if (r.ok) bar.setStatus(next.length === 0 ? "\\u5DF2\\u4FDD\\u5B58\\uFF1A\\u964D\\u7EA7\\u94FE\\u5DF2\\u6E05\\u7A7A\\uFF08\\u4E3B\\u6A21\\u578B\\u6302\\u4E86\\u4E0D\\u518D\\u81EA\\u52A8\\u6362\\uFF09" : `\\u5DF2\\u4FDD\\u5B58\\uFF1A\\u964D\\u7EA7\\u94FE ${next.length} \\u6863`, "ok");\n })();\n }\n }, "\\u4FDD\\u5B58\\u8FD9\\u4E00\\u683C");\n return h(\n "div",\n { class: "cf-field", "data-path": path },\n h("label", {}, label, h("span", { class: "cf-path" }, path)),\n h("p", { class: "cf-hint" }, hint),\n ta,\n h("div", { class: "btn-row" }, btn),\n detail\n );\n }\n function renderModelPanel(body, ctx) {\n const fields = ctx.fields.filter((f) => PLAIN_FIELDS.includes(f.path));\n const providers = listProviders(pickPath(ctx.values, "models.providers"));\n const suggestions = providers.flatMap((p) => p.models.map((m) => `${p.id}/${m}`));\n const form = renderForm(fields, ctx.values, ctx.secrets, ctx.deps, {\n "agents.defaults.model.primary": {\n modelOptions: suggestions,\n hint: "\\u9009\\u62E9\\u5DF2\\u914D\\u7F6E\\u7684\\u6A21\\u578B\\uFF1B\\u5217\\u8868\\u91CC\\u6CA1\\u6709\\u5C31\\u9009\\u300C\\u81EA\\u5B9A\\u4E49\\u2026\\u300D\\uFF0C\\u586B\\u5199 `<provider \\u540D>/<\\u6A21\\u578B id>`\\u3002\\u4FDD\\u5B58\\u65F6\\u4F1A\\u68C0\\u67E5\\u6A21\\u578B\\u914D\\u7F6E\\u3002"\n },\n "agents.defaults.model.vision": { modelOptions: suggestions, modelEmptyLabel: "\\u4E0D\\u542F\\u7528\\u89C6\\u89C9", hint: "\\u9009\\u62E9\\u652F\\u6301\\u56FE\\u7247\\u7684\\u6A21\\u578B\\uFF0C\\u6216\\u9009\\u300C\\u4E0D\\u542F\\u7528\\u89C6\\u89C9\\u300D\\u3002\\u5165\\u7AD9\\u56FE\\u7247\\u4F1A\\u8D70 tools.my_eyes.model \\u90A3\\u6761\\u8DEF\\u3002" },\n "tools.my_eyes.model": { modelOptions: suggestions, hint: "\\u300C\\u770B\\u56FE\\u300D\\u5DE5\\u5177\\u7528\\u7684\\u6A21\\u578B\\uFF1B\\u5217\\u8868\\u91CC\\u6CA1\\u6709\\u5C31\\u9009\\u300C\\u81EA\\u5B9A\\u4E49\\u2026\\u300D\\u586B\\u5199\\u3002" },\n "tools.tavily.apiKey": { hint: "\\u6709\\u81EA\\u5DF1\\u914D\\u7684 key \\u5C31\\u7528\\u5B83\\uFF1B\\u7559\\u7A7A\\u5219\\u7528\\u514D\\u8D39\\u5171\\u4EAB\\u989D\\u5EA6\\uFF08\\u53EF\\u80FD\\u5DF2\\u7528\\u5C3D\\uFF09\\u3002" },\n "api.port": { hint: "\\u5F15\\u64CE\\u7684 HTTP API \\u76D1\\u542C\\u7AEF\\u53E3\\u3002\\u6539\\u5B8C\\u5FC5\\u987B\\u91CD\\u542F\\u5F15\\u64CE\\u3002" }\n });\n const bar = buildSaveBar(form, ctx, { changedNote: "" });\n const rows = providers.map((p) => {\n const baseUrl = h("input", { type: "text", value: p.baseUrl, style: "width:100%" });\n const apiKey = h("input", {\n type: "password",\n value: "",\n autocomplete: "new-password",\n placeholder: p.keyMasked ? "\\uFF08config \\u91CC\\u662F\\u660E\\u6587\\u3001\\u88AB\\u5F15\\u64CE\\u906E\\u4F4F\\u4E86\\uFF09" : `\\u7559\\u7A7A\\u4E0D\\u6539\\uFF08\\u5F53\\u524D\\u662F ${p.apiKeyRef}\\uFF09`,\n style: "width:100%"\n });\n const note = h("div", { class: "cf-hint" }, p.keyMasked ? "\\u26A0\\uFE0F \\u8FD9\\u4E2A provider \\u7684 key \\u5728 config \\u91CC\\u662F\\u660E\\u6587\\uFF08\\u5F15\\u64CE\\u8BFB\\u4E0D\\u5230\\u5B83\\u7684\\u503C\\uFF09\\u3002\\u53EA\\u6539 baseUrl \\u4F1A\\u628A\\u8FD9\\u628A key \\u4ECE config \\u91CC\\u53BB\\u6389\\u2014\\u2014\\u60F3\\u7559\\u7740\\u5C31\\u73B0\\u5728\\u91CD\\u586B\\u4E00\\u6B21\\uFF08\\u4F1A\\u539F\\u6837\\u5199\\u56DE config\\u3001\\u4ECD\\u662F\\u660E\\u6587\\uFF1A\\u8FD9\\u4E00\\u683C\\u662F json \\u5B57\\u6BB5\\uFF0C\\u5F15\\u64CE\\u7684 secrets \\u673A\\u5236\\u7BA1\\u4E0D\\u5230\\u5B83\\uFF09\\u3002" : "");\n const detail = h("div", { class: "cfg-detail" });\n const save = h("button", {\n class: "btn",\n type: "button",\n onclick: () => {\n void (async () => {\n const patch = {};\n if (baseUrl.value !== p.baseUrl) patch.baseUrl = baseUrl.value;\n if (apiKey.value !== "") patch.apiKey = apiKey.value;\n if (patch.baseUrl === void 0 && patch.apiKey === void 0) {\n bar.setStatus("\\u8FD9\\u4E2A provider \\u6CA1\\u6539\\u52A8", "info");\n return;\n }\n const merged = mergeProvider(pickPath(ctx.values, "models.providers"), p.id, patch);\n if (merged.othersMasked.length > 0) {\n bar.setStatus(`\\u6CA1\\u6709\\u63D0\\u4EA4\\uFF1A${merged.othersMasked.join("\\u3001")} \\u7684 key \\u5728 config \\u91CC\\u662F\\u660E\\u6587\\uFF08\\u88AB\\u5F15\\u64CE\\u906E\\u4F4F\\u4E86\\uFF09\\uFF0C\\u6574\\u4EFD models.providers \\u4F1A\\u88AB\\u5F15\\u64CE\\u62D2\\u6389\\u3002\\u8981\\u6539\\u8FD9\\u4E00\\u884C\\uFF0C\\u5148\\u5728 config \\u91CC\\u628A\\u90A3\\u51E0\\u628A key \\u6362\\u6210 env: \\u5F15\\u7528\\uFF08\\u8FD9\\u4E00\\u683C\\u662F json \\u5B57\\u6BB5\\uFF0C\\u6258\\u76D8\\u5199\\u4E0D\\u51FA\\u5F15\\u7528\\uFF09\\u3002`, "err");\n return;\n }\n if (merged.keyDropped && !window.confirm(\n `\\u53EA\\u6539 baseUrl \\u4F1A\\u628A ${p.id} \\u90A3\\u628A\\u660E\\u6587 key \\u4ECE config \\u91CC\\u53BB\\u6389\\uFF08\\u5F15\\u64CE\\u7684\\u8131\\u654F\\u6807\\u8BB0\\u4F1A\\u88AB\\u62D2\\u7EDD\\u56DE\\u4F20\\uFF09\\u3002\n\\u8981\\u4FDD\\u7559\\u5B83\\uFF0C\\u8BF7\\u5148\\u5728\\u4E0A\\u9762\\u90A3\\u628A key \\u91CC\\u91CD\\u586B\\u4E00\\u6B21\\uFF08\\u4F1A\\u539F\\u6837\\u5199\\u56DE config\\uFF0C\\u4ECD\\u662F\\u660E\\u6587\\uFF09\\u3002\n\n\\u4ECD\\u7136\\u7EE7\\u7EED\\uFF1F`\n )) return;\n save.disabled = true;\n detail.replaceChildren();\n const r = await ctx.deps.configSet(ctx.configPath, { "models.providers": merged.value });\n save.disabled = false;\n detail.replaceChildren(...setDetailBlocks(r));\n if (r.ok) {\n bar.setStatus(`\\u5DF2\\u4FDD\\u5B58\\uFF1A${p.id} \\u7684 ${patch.apiKey ? "key \\u4E0E " : ""}baseUrl\\u3002\\u8FD9\\u4E00\\u884C\\u7684\\u663E\\u793A\\u505C\\u5728\\u65E7\\u503C\\u4E0A\\u2014\\u2014\\u5237\\u65B0\\u63A7\\u5236\\u53F0\\uFF08\\u91CD\\u5F00\\u8BBE\\u7F6E\\u9875\\uFF09\\u540E\\u66F4\\u65B0\\u3002`, "ok");\n } else {\n bar.setStatus(`\\u4FDD\\u5B58\\u5931\\u8D25\\uFF1A${r.error ?? ""} ${r.errors.map((e) => e.error).join("\\uFF1B")}`, "err");\n }\n })();\n }\n }, "\\u4FDD\\u5B58\\u8FD9\\u4E00\\u884C");\n return h(\n "div",\n { class: "provider-row", "data-provider": p.id },\n h(\n "div",\n { class: "cf-field" },\n h("label", {}, `${p.id}\\u3000`, h("span", { class: "cf-path" }, p.apiKeyRef)),\n h("div", {}, h("label", { class: "cf-hint" }, "baseUrl"), baseUrl),\n h("div", {}, h("label", { class: "cf-hint" }, "API Key"), apiKey),\n note,\n h("div", { class: "btn-row" }, save)\n ),\n detail\n );\n });\n body.replaceChildren(\n form.root,\n // \u964D\u7EA7\u94FE**\u5355\u72EC\u4E00\u7EC4\u3001\u53EF\u7F16\u8F91**\uFF080927\uFF09\u3002\u4EE5\u524D\u5B83\u6DF7\u5728 form.root \u91CC\u5F53\u53EA\u8BFB\u7A7A\u6846\uFF0C\n // \u9875\u9762\u4E0A\u662F\u4E2A"\u770B\u7740\u80FD\u586B\u5176\u5B9E\u4E0D\u80FD"\u7684\u63A7\u4EF6\uFF0C\u8FD8\u6307\u5411\u4E00\u4E2A\u4E0D\u5B58\u5728\u7684"\u4E13\u7528\u9762\u677F"\u3002\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "\\u6A21\\u578B\\u964D\\u7EA7\\u94FE"),\n h("p", { class: "page-sub" }, "\\u4E3B\\u6A21\\u578B\\u6216\\u770B\\u56FE\\u6A21\\u578B\\u4E0D\\u53EF\\u7528\\u65F6\\uFF0C\\u6309\\u987A\\u5E8F\\u6362\\u4E0B\\u4E00\\u6863\\u3002\\u7559\\u7A7A = \\u4E0D\\u964D\\u7EA7\\u3002"),\n renderChainEditor(\n "agents.defaults.model.fallbacks",\n "\\u4E3B\\u6A21\\u578B\\u964D\\u7EA7\\u94FE",\n "\\u4E00\\u884C\\u4E00\\u4E2A\\uFF0C\\u5199\\u6210 `<provider \\u540D>/<\\u6A21\\u578B id>`\\uFF08\\u4F8B\\uFF1A7yi/engine7-free\\uFF09\\u3002\\u987A\\u5E8F\\u5C31\\u662F\\u964D\\u7EA7\\u987A\\u5E8F\\u3002",\n ctx,\n bar\n ),\n renderChainEditor(\n "agents.defaults.model.visionFallbacks",\n "\\u770B\\u56FE\\u6A21\\u578B\\u964D\\u7EA7\\u94FE",\n "\\u540C\\u4E0A\\uFF0C\\u7528\\u6765\\u964D\\u7EA7\\u300C\\u89C6\\u89C9\\u6A21\\u578B\\u300D\\u90A3\\u4E00\\u683C\\u3002",\n ctx,\n bar\n )\n ),\n // \u26A0\uFE0F \u6A21\u578B\u670D\u52A1\u5546\u90A3\u4E00\u6574\u6BB5**\u5DF2\u64A4\u4E0B**\uFF08\u7FC0\u54E5 0927\uFF1A\u300C\u529F\u80FD\u53C8\u505A\u4E0D\u5168\u4E0D\u80FD\u7528\uFF0C\u771F\u6539\u4E86\u8BEF\u5BFC\u7528\u6237\uFF0C\n // \u4E0D\u80FD\u7528\u4E86\u9A82\u4F60\u300D\uFF09\u3002\u5B83\u73B0\u5728\u8FD8**\u4F1A\u4E3B\u52A8\u5F04\u574F\u914D\u7F6E**\uFF0C\u4E09\u4EF6\u4E8B\u53E0\u5728\u4E00\u8D77\uFF1A\n // \u2460 \u53EA\u80FD\u6539\u5DF2\u6709 provider \u7684 baseUrl / \u91CD\u586B key \u2014\u2014 \u52A0\u65B0\u670D\u52A1\u5546\u3001\u6539\u6A21\u578B\u8868\u90FD\u5F97\u624B\u6539 JSON\n // \u2461 \u91CD\u586B\u7684 key **\u660E\u6587\u5199\u56DE config**\uFF08json \u5B57\u6BB5\u6CA1\u6709 secrets \u901A\u8DEF\uFF0C\u5F15\u64CE\u7684 type:\'secret\'\n // \u53EA\u8986\u76D6 4 \u4E2A\u5B57\u6BB5\uFF0Cmodels.providers.*.apiKey \u4E0D\u5728\u5176\u4E2D\uFF09\n // \u2462 \u6539 baseUrl \u4F1A\u8BA9\u6574\u6279\u88AB\u5F15\u64CE\u62D2\uFF08findMaskedCredentials\uFF1A\u6574\u4EFD\u91CC\u53EA\u8981\u8FD8\u5269\u4E00\u4E2A\u88AB\u906E\u6210\n // null \u7684 apiKey\uFF0C**\u6574\u6279**\u90FD\u88AB\u62D2\uFF09\u2014\u2014 \u5B9E\u673A\u590D\u73B0\u8FC7\uFF0C\u4EA4\u63A5\u6587\u6863 A2\n // "\u770B\u7740\u80FD\u7528\u3001\u5B9E\u9645\u4F1A\u5F04\u574F\u914D\u7F6E" \u6BD4\u6CA1\u6709\u66F4\u7CDF\u3002\n //\n // **\u7FC0\u54E5 0927 \u5B9A\u7684\u65B9\u5411\u662F\u300C\u8FD9\u4E2A\u6CA1\u5FC5\u8981\u300D\uFF0C\u4E0D\u662F\u300C\u5F85\u8865\u5168\u300D**\uFF1A\n // \xB7 \u6362 key \u5927\u4E0D\u4E86\u8BA9\u7528\u6237\u81EA\u5DF1\u7F16\u8F91 config\uFF08`models.providers` \u662F\u7ED9\u7528\u6237\u770B\u7684 JSON\uFF0C\n // \u4E0D\u662F\u5FC5\u987B\u6709\u4E2A UI\uFF09\n // \xB7 \u5C0F\u767D\u7528\u6237\u7684\u51FA\u53E3\u5728\u4E2D\u8F6C\u7AD9\uFF1A**\u514D\u8D39\u989D\u5EA6\u4E0D\u591F\u5C31\u4E70\u79EF\u5206** \u2014\u2014 \u90A3\u624D\u662F\u8FD9\u6761\u4EA7\u54C1\u7EBF\n // \u7684\u5546\u4E1A\u8DEF\u5F84\uFF0C\u800C\u4E0D\u662F\u628A provider \u7F16\u8F91\u5668\u505A\u5168\n // \u6240\u4EE5\u8FD9\u91CC**\u4E0D\u8981**\u7406\u89E3\u6210"\u7B49\u5F15\u64CE\u8865\u597D secrets \u5C31\u6062\u590D"\uFF1B\u5B83\u6CA1\u6709\u6392\u671F\u3002\n // \uFF08\u771F\u8981\u505A\u7684\u8BDD\uFF0C\u524D\u7F6E\u4ECD\u662F\u5F15\u64CE\u4FA7\u90A3\u6761 secrets \u8986\u76D6\u9762 \u2014\u2014 \u89C1 0926 \u4EA4\u63A5\u6587\u6863 A1/A2/A3\u3002\uFF09\n //\n // \u4EE3\u7801\u4E0D\u5220\u4F46\u4E5F\u4E0D\u5F53\u534A\u6210\u54C1\u7559\u7740\uFF1A`rows` \u4ECD\u7B97\u7740\uFF0C\u6CE8\u91CA\u6389\u7684\u8FD9\u4E00\u5757\u662F**\u793A\u4F8B**\uFF0C\n // \u771F\u8981\u6062\u590D\u8BF7\u8FDE e2e \u90A3\u4E09\u4E2A\u7EC4\u4E00\u8D77\u6062\u590D\uFF08\u5B83\u4EEC\u7684\u65AD\u8A00\u5DF2\u968F\u8FD9\u6BB5\u64A4\u4E0B\u800C\u5220\u9664\uFF09\u3002\n // \u5E95\u5C42\u903B\u8F91\u7684\u8986\u76D6\u6CA1\u4E22\uFF08smoke-main \u91CC mergeProvider x24 \u4ECD\u5728\u8DD1\uFF09\u3002\n // h(\'section\', { class: \'settings-group\' },\n // h(\'h3\', {}, \'\u6A21\u578B\u670D\u52A1\u5546\uFF08models.providers\uFF09\'),\n // h(\'p\', { class: \'page-sub\' }, \'\u2026\'),\n // ...rows,\n // ),\n bar.el\n );\n return () => {\n };\n }\n\n // web-console/desktop/src/renderer/console/panels/voice.ts\n var VOICE_WARNING_MARK = \'"voice-config"\';\n var VOICE_WARNING_NOTE = "\\u8FD9\\u6761\\u5728\\u9884\\u671F\\u4E4B\\u5185\\uFF1A\\u53D1\\u8BED\\u97F3\\u6761\\u8BFB\\u7684\\u5C31\\u662F config \\u91CC\\u8FD9\\u4E00\\u4EFD\\uFF0C\\u4E0D\\u4F9D\\u8D56\\u5F15\\u64CE\\u90A3\\u6761\\u8054\\u52A8\\u3002";\n var PROVIDER_TEXT = {\n relay: "relay\\uFF087yi \\u4E2D\\u8F6C\\u7AD9\\uFF0C\\u514D\\u8D39\\u6863\\u9ED8\\u8BA4\\uFF09",\n cosyvoice: "cosyvoice\\uFF08\\u767E\\u70BC\\u4E91\\u7AEF\\uFF09",\n "qwen3-3060": "qwen3-3060\\uFF08\\u672C\\u5730\\u670D\\u52A1\\uFF09",\n gptsovits: "gptsovits\\uFF08\\u672C\\u5730\\u514B\\u9686\\uFF09",\n edge: "edge-tts\\uFF08\\u515C\\u5E95\\uFF0C\\u96F6\\u914D\\u7F6E\\uFF09"\n };\n var VOICE_TEXT = {\n "Chinese (Mandarin)_Warm_Girl": "\\u6E29\\u6696\\u5973\\u5B69",\n "Chinese (Mandarin)_Crisp_Girl": "\\u6E05\\u8106\\u5973\\u5B69",\n "Chinese (Mandarin)_Soft_Girl": "\\u8F7B\\u67D4\\u5973\\u5B69",\n "Chinese (Mandarin)_Gentle_Youth": "\\u6E29\\u6DA6\\u9752\\u5E74",\n "Chinese (Mandarin)_Unrestrained_Young_Man": "\\u4E0D\\u7F81\\u9752\\u5E74",\n "Chinese (Mandarin)_Southern_Young_Man": "\\u5357\\u65B9\\u9752\\u5E74"\n };\n function renderVoicePanel(body, ctx) {\n const cur = pickPath(ctx.values, "tools.my_voice") ?? {};\n const internal = ctx.internalMode === true;\n const voiceField = ctx.fields.find((f) => f.path === "tools.my_voice");\n const vschema = voiceSchemaOf(voiceField, internal);\n const str = (k) => typeof cur[k] === "string" ? String(cur[k]) : "";\n const status = h("div", { class: "inline-warn", id: "cfg-status", hidden: true });\n const detail = h("div", { class: "cfg-detail" });\n const save = h("button", { class: "btn btn-primary", type: "button", id: "cfg-save" }, "\\u4FDD\\u5B58");\n const setStatus = (m, k) => {\n status.hidden = false;\n status.textContent = m;\n status.style.color = k === "err" ? "var(--red)" : k === "ok" ? "var(--green)" : "";\n };\n const curProvider = str("provider");\n const knownIds = vschema ? vschema.providers : [];\n const isKnownProvider = (v) => knownIds.includes(v);\n const providerOpts = knownIds.map((id) => h("option", { value: id, selected: id === (curProvider || "edge") }, PROVIDER_TEXT[id] ?? id));\n if (curProvider && !isKnownProvider(curProvider)) {\n providerOpts.unshift(h(\n "option",\n { value: curProvider, selected: true },\n `${curProvider}\\uFF08\\u5F53\\u524D\\u503C\\uFF0C\\u6258\\u76D8\\u4E0D\\u8BA4\\u8BC6\\uFF1A\\u5F15\\u64CE\\u8FD9\\u5F20\\u6E05\\u5355\\u91CC\\u6CA1\\u6709\\u5B83\\uFF09`\n ));\n }\n const provider = h("select", { id: "voice-provider" }, ...providerOpts);\n const mkInput = (id, key, placeholder = "") => h("input", { type: "text", id, value: str(key), placeholder });\n const url = mkInput("voice-url", "url", "http://127.0.0.1:18888");\n const voiceBox = h("div", { class: "cf-voice-box" });\n let voiceCtrl = mkInput("voice-voice", "voice", "");\n const rebuildVoiceCtrl = () => {\n const prev = voiceCtrl.value;\n const opts = voiceOptionsOf(voiceField, provider.value);\n if (opts) {\n const list = [...opts];\n if (prev && !list.includes(prev)) list.unshift(prev);\n voiceCtrl = h(\n "select",\n { id: "voice-voice" },\n ...list.map((o) => h("option", { value: o, selected: o === prev }, VOICE_TEXT[o] ?? o))\n );\n } else {\n voiceCtrl = mkInput("voice-voice", "voice", "\\u97F3\\u8272\\u540D\\uFF08\\u672C\\u5F15\\u64CE\\u6CA1\\u6709\\u6E05\\u5355\\uFF0C\\u9700\\u624B\\u586B ID\\uFF09");\n voiceCtrl.value = prev;\n }\n voiceCtrl.addEventListener("input", () => refreshSave());\n voiceCtrl.addEventListener("change", () => refreshSave());\n voiceBox.replaceChildren(voiceCtrl);\n };\n rebuildVoiceCtrl();\n const lang = mkInput("voice-lang", "lang", "Chinese");\n const model = mkInput("voice-model", "model", "cosyvoice-v1");\n const workspaceId = mkInput("voice-workspace", "workspaceId", "\\u767E\\u70BC workspace\\uFF08\\u53EF\\u7559\\u7A7A\\uFF09");\n const instruction = mkInput("voice-instruction", "instruction", "\\u98CE\\u683C\\u6307\\u4EE4\\uFF08\\u53EF\\u7559\\u7A7A\\uFF09");\n const pythonPath = mkInput("voice-python", "pythonPath", "python \\u53EF\\u6267\\u884C\\u6587\\u4EF6\\uFF08\\u53EF\\u7559\\u7A7A\\u8D70\\u9ED8\\u8BA4\\uFF09");\n const internalRow = (id, label, input, key, hint = null) => internal ? fieldRow(id, label, input, key, hint) : null;\n const relayProviderId = internal ? mkInput("voice-relay-provider", "relayProviderId", "7yi") : null;\n const relayModel = internal ? mkInput("voice-relay-model", "relayModel", "engine7-tts") : null;\n const billingProviderId = internal ? mkInput("voice-billing-provider", "billingProviderId", "\\uFF08\\u7559\\u7A7A = \\u672A\\u542F\\u7528\\uFF09") : null;\n const billingModel = internal ? mkInput("voice-billing-model", "billingModel", "engine7-tts") : null;\n let billingModeSel = null;\n if (internal) {\n const choices = voiceField?.knownValues?.billingMode;\n const curMode = str("billingMode") || "off";\n if (Array.isArray(choices) && choices.length > 0) {\n const opts = [...choices];\n if (!opts.includes(curMode)) opts.unshift(curMode);\n billingModeSel = h(\n "select",\n { id: "voice-billing-mode" },\n ...opts.map((o) => h("option", { value: o, selected: o === curMode }, o))\n );\n } else {\n billingModeSel = mkInput("voice-billing-mode", "billingMode", "off");\n }\n }\n const keyNow = cur.apiKey;\n const keyMasked = keyNow === null;\n const apiKey = h("input", {\n type: "password",\n id: "voice-apikey",\n value: "",\n autocomplete: "new-password",\n placeholder: keyMasked ? "\\uFF08config \\u91CC\\u662F\\u660E\\u6587\\u3001\\u88AB\\u5F15\\u64CE\\u906E\\u4F4F\\u4E86 \\u2014\\u2014 \\u91CD\\u586B\\u4E00\\u6B21\\u4F1A\\u539F\\u6837\\u5199\\u56DE\\u660E\\u6587\\uFF09" : typeof keyNow === "string" && keyNow ? `\\u7559\\u7A7A\\u4E0D\\u6539\\uFF08\\u5F53\\u524D\\u662F ${keyNow}\\uFF09` : "\\u586B\\u4E00\\u4E2A\\u503C"\n });\n const keyNote = h("div", { class: "cf-hint", id: "voice-key-note" }, keyMasked ? "\\u26A0\\uFE0F \\u8FD9\\u628A key \\u5728 config \\u91CC\\u5B58\\u7684\\u662F\\u660E\\u6587\\uFF1Aconfig get \\u4F1A\\u628A\\u5B83\\u906E\\u6210 null \\u2014\\u2014 \\u8BFB\\u4E0D\\u56DE\\u6765\\uFF0C\\u4E5F\\u4E0D\\u80FD\\u539F\\u6837\\u63D0\\u4EA4\\u3002\\u4FDD\\u5B58\\u4EFB\\u4F55\\u6539\\u52A8\\uFF08\\u54EA\\u6015\\u53EA\\u6539\\u97F3\\u8272\\uFF09\\u90FD\\u4F1A\\u628A\\u5B83\\u4ECE config \\u91CC\\u53BB\\u6389\\uFF1B\\u60F3\\u7559\\u7740\\u5C31\\u73B0\\u5728\\u91CD\\u586B\\u4E00\\u6B21\\uFF08\\u4F1A\\u539F\\u6837\\u5199\\u56DE config\\u3001\\u4ECD\\u662F\\u660E\\u6587\\uFF1A\\u8FD9\\u4E00\\u683C\\u662F json \\u5B57\\u6BB5\\uFF0C\\u5F15\\u64CE\\u7684 secrets \\u673A\\u5236\\u7BA1\\u4E0D\\u5230\\u5B83\\uFF09\\u3002" : "");\n const providersReading = (key) => {\n if (!vschema) return [];\n return vschema.providers.filter((p) => (vschema.keysOf(p) ?? []).includes(key));\n };\n const rowFor = (key) => key === "provider" ? knownIds : providersReading(key);\n const rows = [];\n const syncVisibility = () => {\n const p = provider.value;\n const unknown = !isKnownProvider(p);\n for (const r of rows) r.el.hidden = !(unknown || rowFor(r.key).includes(p));\n refreshSave();\n };\n const fieldRow = (id, label, input, key, hint = null) => {\n const row = h(\n "div",\n { class: "cf-field", id },\n h("label", {}, label),\n typeof hint === "string" ? hint ? h("p", { class: "cf-hint" }, hint) : null : hint,\n input\n );\n rows.push({ el: row, key });\n return row;\n };\n const form = () => ({\n // \u4E0D\u8F6C\u4EFB\u4F55\u5B57\u9762\u91CF union\uFF1A\u4E0B\u62C9\u91CC\u53EF\u80FD\u6709"\u5F53\u524D\u503C"\u90A3\u4E00\u9879\uFF08\u5F15\u64CE\u6E05\u5355\u91CC\u6CA1\u6709\u7684\u503C\uFF09\uFF0C\u7167\u539F\u6837\u4F20\u4E0B\u53BB\n provider: provider.value,\n url: url.value.trim(),\n voice: voiceCtrl.value.trim(),\n lang: lang.value.trim(),\n model: model.value.trim(),\n workspaceId: workspaceId.value.trim(),\n instruction: instruction.value.trim(),\n pythonPath: pythonPath.value.trim(),\n apiKey: apiKey.value,\n // relay / \u8BA1\u8D39\u6C60\u4E94\u4E2A\u952E**\u666E\u901A\u6A21\u5F0F\u4E0D\u5728\u8868\u5355\u91CC**\uFF08\u6CA1\u63A7\u4EF6\u3001\u4E0D\u8BE5\u88AB\u8868\u5355\u6539\u5199\uFF09\u2014\u2014 \u89C1\u4E0A\u9762\u90A3\u6BB5\u6CE8\uFF0C\n // \u5B83\u4EEC\u7531 mergeMyVoice \u7684 `keep` \u4FDD\u5E95\u3002\u5185\u90E8\u6A21\u5F0F\u4E0B\u8FD9\u4E94\u683C\u5728\uFF0C\u8868\u5355\u5C31\u5F97\u5E26\u7740\u5B83\u4EEC\uFF0C\n // \u5426\u5219"\u5728\u5185\u90E8\u6A21\u5F0F\u91CC\u6539\u4E86\u503C\u5374\u63D0\u4EA4\u4E0D\u4E0A\u53BB"\uFF08\u770B\u8D77\u6765\u80FD\u6539\u3001\u5B58\u4E0B\u53BB\u4E00\u4E2A\u5B57\u8282\u90FD\u6CA1\u5199\uFF09\u3002\n ...internal ? {\n relayProviderId: relayProviderId?.value.trim() ?? "",\n relayModel: relayModel?.value.trim() ?? "",\n billingProviderId: billingProviderId?.value.trim() ?? "",\n billingModel: billingModel?.value.trim() ?? "",\n billingMode: billingModeSel?.value.trim() ?? ""\n } : {}\n });\n const snap = () => JSON.stringify(form());\n let baseline = snap();\n const refreshSave = () => {\n save.disabled = snap() === baseline;\n };\n provider.addEventListener("change", () => {\n rebuildVoiceCtrl();\n syncVisibility();\n });\n for (const el of [\n url,\n lang,\n model,\n workspaceId,\n instruction,\n pythonPath,\n ...internal ? [relayProviderId, relayModel, billingProviderId, billingModel] : []\n ]) {\n if (el) el.addEventListener("input", refreshSave);\n }\n billingModeSel?.addEventListener("change", refreshSave);\n apiKey.addEventListener("input", () => {\n keyNote.hidden = apiKey.value !== "";\n refreshSave();\n });\n const renderDetail = (r) => {\n detail.replaceChildren(...setDetailBlocks(r, {\n warningNotes: [{ mark: VOICE_WARNING_MARK, note: VOICE_WARNING_NOTE }]\n }));\n };\n save.addEventListener("click", () => {\n void (async () => {\n save.disabled = true;\n detail.replaceChildren();\n const merged = mergeMyVoice(cur, form(), vschema);\n if (merged.keyDropped && !window.confirm(\n "\\u8FD9\\u4E00\\u683C\\u5728 config \\u91CC\\u5B58\\u7684\\u662F\\u660E\\u6587\\uFF0Cconfig get \\u4F1A\\u628A\\u5B83\\u906E\\u6210 null\\uFF1A\\u6258\\u76D8\\u8BFB\\u4E0D\\u56DE\\u6765\\uFF0C\\u4E5F\\u6CA1\\u6CD5\\u539F\\u6837\\u63D0\\u4EA4\\u3002\\n\\u7EE7\\u7EED\\u4FDD\\u5B58\\u4F1A\\u628A\\u5B83\\u4ECE config \\u91CC\\u53BB\\u6389\\uFF08\\u53D1\\u8BED\\u97F3\\u6761\\u4F1A\\u76F4\\u63A5\\u62A5 TTS failed: cosyvoice provider requires apiKey and voice\\uFF09\\u3002\\n\\n\\u4ECD\\u7136\\u7EE7\\u7EED\\uFF1F"\n )) {\n refreshSave();\n setStatus("\\u6CA1\\u6709\\u63D0\\u4EA4\\uFF1A\\u90A3\\u628A\\u88AB\\u8131\\u654F\\u7684\\u660E\\u6587 key \\u4F1A\\u4ECE config \\u91CC\\u53BB\\u6389\\u3002\\u60F3\\u7559\\u7740\\u5C31\\u5728\\u4E0A\\u9762\\u91CD\\u586B\\u4E00\\u6B21\\u518D\\u4FDD\\u5B58\\u3002", "info");\n return;\n }\n const r = await ctx.deps.configSet(ctx.configPath, { "tools.my_voice": merged.value });\n renderDetail(r);\n if (!r.ok) {\n refreshSave();\n setStatus(`\\u4FDD\\u5B58\\u5931\\u8D25\\uFF1A${r.error ?? ""} ${r.errors.map((e) => e.error).join("\\uFF1B")}`, "err");\n return;\n }\n baseline = snap();\n refreshSave();\n let msg = `\\u5DF2\\u4FDD\\u5B58\\uFF1A${r.changed.join("\\u3001") || "\\uFF08\\u65E0\\u53D8\\u5316\\uFF09"}\\u3002\\u8FD9\\u6761\\u914D\\u7F6E\\u7BA1\\u7684\\u662F\\u300C\\u53D1\\u8BED\\u97F3\\u6761\\u300D\\uFF1B\\u5B9E\\u65F6\\u8BED\\u97F3\\u5BF9\\u8BDD\\u662F\\u53E6\\u4E00\\u5957\\uFF0C\\u6CA1\\u53D8\\u3002`;\n if (merged.keyDropped) msg += " \\u26A0\\uFE0F \\u90A3\\u628A\\u88AB\\u5F15\\u64CE\\u8131\\u654F\\u7684\\u660E\\u6587 key \\u5DF2\\u88AB\\u53BB\\u6389\\u2014\\u2014\\u60F3\\u7559\\u7740\\u7684\\u8BDD\\uFF0C\\u8BF7\\u5728\\u4E0A\\u9762\\u91CD\\u586B\\u4E00\\u6B21\\u3002";\n setStatus(msg, "ok");\n })();\n });\n body.replaceChildren(\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "\\u53D1\\u8BED\\u97F3\\u6761\\uFF08tools.my_voice\\uFF09"),\n h("p", { class: "page-sub" }, "\\u52A9\\u624B\\u7528 my_voice \\u5DE5\\u5177\\u53D1\\u8BED\\u97F3\\u6D88\\u606F\\u65F6\\u7528\\u7684\\u5408\\u6210\\u5F15\\u64CE\\u3002\\u6539\\u5B8C\\u70ED\\u52A0\\u8F7D\\uFF0C\\u4E0D\\u7528\\u91CD\\u542F\\u5F15\\u64CE\\u3002"),\n fieldRow("voice-provider-row", "\\u5408\\u6210\\u5F15\\u64CE", provider, "provider"),\n fieldRow("voice-voice-row", "\\u97F3\\u8272", voiceBox, "voice"),\n // keyNote \u53EA\u6302\u8FD9\u4E00\u5904\uFF08\u63D0\u793A\u5C31\u957F\u5728\u8FD9\u4E00\u884C\u91CC\uFF0C\u8DDF\u7740\u5B83\u4E00\u8D77\u85CF\uFF09\u2014\u2014 \u522B\u518D\u5355\u72EC append \u4E00\u6B21\uFF0C\u4F1A\u91CD\u590D\n fieldRow("voice-key-row", "API Key", apiKey, "apiKey", keyMasked ? keyNote : null),\n fieldRow("voice-model-row", "\\u6A21\\u578B", model, "model"),\n fieldRow("voice-workspace-row", "Workspace", workspaceId, "workspaceId"),\n fieldRow("voice-instruction-row", "\\u98CE\\u683C\\u6307\\u4EE4", instruction, "instruction"),\n fieldRow("voice-url-row", "\\u670D\\u52A1\\u5730\\u5740", url, "url"),\n fieldRow("voice-lang-row", "\\u8BED\\u8A00", lang, "lang"),\n fieldRow("voice-python-row", "Python \\u8DEF\\u5F84", pythonPath, "pythonPath"),\n ...internal ? [\n h(\n "p",\n { class: "cf-hint", id: "voice-internal-note" },\n "\\u4E0B\\u9762\\u4E94\\u683C\\u662F\\u5185\\u90E8\\u6A21\\u5F0F\\uFF08\\u8C03\\u8BD5\\u7248\\uFF09\\u624D\\u663E\\u793A\\u7684\\uFF1Arelay \\u6761\\u76EE / \\u865A\\u62DF\\u6A21\\u578B / \\u8BA1\\u8D39\\u6C60\\u4E09\\u9879\\u3002",\n "\\u666E\\u901A\\u7528\\u6237\\u770B\\u4E0D\\u5230\\u5B83\\u4EEC\\uFF0C\\u914D\\u7F6E\\u672C\\u8EAB\\u7167\\u5E38\\u4FDD\\u7559\\u3002"\n )\n ] : [],\n internalRow(\n "voice-relay-provider-row",\n "Provider \\u6761\\u76EE",\n relayProviderId,\n "relayProviderId",\n "\\u9ED8\\u8BA4 7yi\\u2014\\u2014\\u514D\\u8D39\\u6863\\u88C5\\u673A\\u81EA\\u52A8\\u914D\\u597D\\uFF0C\\u4E00\\u822C\\u4E0D\\u7528\\u6539"\n ),\n internalRow(\n "voice-relay-model-row",\n "\\u865A\\u62DF\\u6A21\\u578B",\n relayModel,\n "relayModel",\n "\\u9ED8\\u8BA4 engine7-tts\\u3002\\u6362\\u8BA1\\u8D39\\u53E3\\u5F84\\u5C31\\u662F\\u6362\\u8FD9\\u4E2A\\u540D\\u5B57\\uFF08\\u6309\\u5B57\\u7B26 / \\u6309\\u5206\\u949F\\u5404\\u662F\\u4E00\\u4E2A\\u6A21\\u578B\\u540D\\uFF09"\n ),\n internalRow("voice-billing-mode-row", "\\u8BA1\\u8D39\\u6C60\\u6A21\\u5F0F", billingModeSel, "billingMode"),\n internalRow(\n "voice-billing-provider-row",\n "\\u8BA1\\u8D39\\u6C60\\u6761\\u76EE",\n billingProviderId,\n "billingProviderId",\n "\\u7559\\u7A7A = \\u8BA1\\u8D39\\u6C60\\u6CA1\\u5F00\\uFF0C\\u4E00\\u5F8B\\u8D70\\u514D\\u8D39\\u6C60"\n ),\n internalRow("voice-billing-model-row", "\\u8BA1\\u8D39\\u6C60\\u6A21\\u578B", billingModel, "billingModel"),\n h("div", { class: "cfg-savebar" }, h("div", { class: "btn-row" }, save), status, detail)\n )\n );\n syncVisibility();\n return () => {\n };\n }\n\n // web-console/desktop/src/renderer/console/panels/search.ts\n var OPT_TEXT = {\n tavily: "\\u9ED8\\u8BA4\\u641C\\u7D22\\uFF08\\u94FE\\u63A5\\u5217\\u8868\\uFF0C\\u5FEB\\uFF09",\n doubao: "\\u8C46\\u5305\\u641C\\u7D22\\uFF08\\u56FD\\u5185\\u65F6\\u4E8B\\u66F4\\u61C2\\uFF0C\\u7EFC\\u5408\\u7B54\\u6848\\uFF0C\\u7A0D\\u6162\\uFF09"\n };\n function renderSearchPanel(body, ctx) {\n const cur = pickPath(ctx.values, "tools.webSearch") ?? {};\n const providers = pickPath(ctx.values, "models.providers") ?? pickPath(ctx.values, "providers") ?? {};\n const has7yi = Boolean(providers?.["7yi"]);\n const curProvider = typeof cur.provider === "string" && cur.provider || "tavily";\n const status = h("div", { class: "inline-warn", hidden: true });\n const detail = h("div", { class: "cfg-detail" });\n const save = h("button", { class: "btn btn-primary", type: "button" }, "\\u4FDD\\u5B58");\n const setStatus = (m, k) => {\n status.hidden = false;\n status.textContent = m;\n status.style.color = k === "err" ? "var(--red)" : k === "ok" ? "var(--green)" : "";\n };\n const engineField = ctx.fields.find((f) => f.path === "tools.webSearch.provider");\n const known = engineField?.knownValues ?? ["tavily", "doubao"];\n const opts = [...known];\n if (!opts.includes(curProvider)) opts.unshift(curProvider);\n const provider = h(\n "select",\n { id: "ws-provider" },\n ...opts.map((o) => h("option", { value: o, selected: o === curProvider }, OPT_TEXT[o] ?? o))\n );\n const snap = () => provider.value;\n let baseline = snap();\n const refreshSave = () => {\n save.disabled = snap() === baseline;\n };\n provider.addEventListener("change", refreshSave);\n const renderDetail = (r) => {\n detail.replaceChildren(...setDetailBlocks(r, {}));\n };\n save.addEventListener("click", () => {\n void (async () => {\n save.disabled = true;\n detail.replaceChildren();\n const values = { "tools.webSearch.provider": provider.value };\n if (provider.value === "doubao") {\n values["tools.webSearch.doubaoModel"] = "7yi/doubao-web-search";\n }\n const r = await ctx.deps.configSet(ctx.configPath, values);\n renderDetail(r);\n if (!r.ok) {\n refreshSave();\n setStatus(`\\u4FDD\\u5B58\\u5931\\u8D25\\uFF1A${r.error ?? ""} ${r.errors.map((e) => e.error).join("\\uFF1B")}`, "err");\n return;\n }\n baseline = snap();\n refreshSave();\n setStatus(`\\u5DF2\\u4FDD\\u5B58\\uFF1A${r.changed.join("\\u3001") || "\\uFF08\\u65E0\\u53D8\\u5316\\uFF09"}\\u3002\\u7ACB\\u5373\\u751F\\u6548\\uFF0C\\u4E0B\\u6B21\\u641C\\u7D22\\u5C31\\u7528\\u65B0\\u540E\\u7AEF\\u3002`, "ok");\n })();\n });\n body.replaceChildren(\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "\\u8054\\u7F51\\u641C\\u7D22"),\n h(\n "p",\n { class: "page-sub" },\n "\\u95EE\\u65F6\\u4E8B\\u3001\\u67E5\\u8D44\\u6599\\u65F6\\u52A9\\u624B\\u4F1A\\u5148\\u641C\\u518D\\u7B54\\u3002\\u4E24\\u4E2A\\u5F15\\u64CE\\u5404\\u6709\\u957F\\u5904\\uFF0C\\u968F\\u65F6\\u53EF\\u5207\\uFF1A"\n ),\n h(\n "div",\n { class: "cf-field" },\n h("label", {}, "\\u641C\\u7D22\\u5F15\\u64CE"),\n h(\n "p",\n { class: "cf-hint" },\n "\\u9ED8\\u8BA4\\u641C\\u7D22\\uFF1A\\u8FD4\\u56DE\\u94FE\\u63A5\\u5217\\u8868\\uFF0C\\u901F\\u5EA6\\u5FEB\\uFF0C\\u901A\\u7528\\u573A\\u666F\\u3002\\u8C46\\u5305\\u641C\\u7D22\\uFF1A\\u9002\\u5408\\u56FD\\u5185\\u65F6\\u4E8B\\uFF08\\u5934\\u6761/\\u6296\\u97F3\\u7B49\\u6765\\u6E90\\uFF09\\uFF0C\\u8FD4\\u56DE\\u6574\\u7406\\u597D\\u7684\\u7EFC\\u5408\\u7B54\\u6848\\uFF0C\\u7A0D\\u6162\\u4E00\\u4E9B\\u3002"\n ),\n provider\n ),\n h(\n "p",\n { class: "cf-hint" },\n has7yi ? "\\u8C46\\u5305\\u641C\\u7D22\\u8D70\\u4E2D\\u8F6C\\u7AD9\\u7EBF\\u8DEF\\uFF0C\\u514D\\u8D39\\u989D\\u5EA6\\u6709\\u9650\\u2014\\u2014\\u7528\\u5B8C\\u4F1A\\u81EA\\u52A8\\u56DE\\u843D\\u5230\\u9ED8\\u8BA4\\u641C\\u7D22\\uFF0C\\u641C\\u7D22\\u4E0D\\u4F1A\\u4E2D\\u65AD\\u3002" : "\\uFF08\\u5F53\\u524D\\u914D\\u7F6E\\u91CC\\u6CA1\\u6709\\u4E2D\\u8F6C\\u7AD9\\u6761\\u76EE\\uFF0C\\u8C46\\u5305\\u7EBF\\u8DEF\\u53EF\\u80FD\\u4E0D\\u53EF\\u7528\\uFF1B\\u9ED8\\u8BA4\\u641C\\u7D22\\u4E0D\\u53D7\\u5F71\\u54CD\\u3002\\uFF09"\n ),\n h("div", { class: "cfg-savebar" }, h("div", { class: "btn-row" }, save), status, detail)\n )\n );\n refreshSave();\n return () => {\n };\n }\n\n // web-console/desktop/src/renderer/console/panels/registry.ts\n var PANELS = [\n { key: "general", title: "\\u901A\\u7528", claim: ["timezone", "agents.defaults.name"], render: renderGeneralPanel },\n { key: "model", title: "\\u6A21\\u578B\\u670D\\u52A1", claim: [\n "agents.defaults.model.primary",\n "agents.defaults.model.vision",\n // \u964D\u7EA7\u94FE\u4E24\u9879\uFF08spec \xA77 \u70B9\u540D\uFF09\uFF1A\u5B83\u4EEC\u662F type:\'json\' \u21D2 \u9762\u677F\u91CC**\u53EA\u8BFB\u5C55\u793A**\uFF0C\n // \u4F46\u5FC5\u987B\u8BA4\u9886 \u2014\u2014 \u4E0D\u8BA4\u9886\u7684\u8BDD\u5B83\u4EEC\u5C31\u53EA\u662F\u300C\u5176\u5B83\u300D\u91CC\u4E24\u683C\u6CA1\u6709\u5F52\u5C5E\u7684 textarea\u3002\n "agents.defaults.model.fallbacks",\n "agents.defaults.model.visionFallbacks",\n "tools.my_eyes.model",\n "tools.tavily.apiKey",\n "api.port",\n "models.providers"\n ], render: renderModelPanel },\n { key: "face", title: "\\u5F62\\u8C61", claim: ["tools.my_selfie"], render: renderFacePanel },\n { key: "identity", title: "\\u4EBA\\u8BBE", claim: ["agents.defaults.persona"], render: renderIdentityPanel },\n // \u26A0\uFE0F `voiceChat.*` \u56DB\u683C**\u4E0D\u518D\u8BA4\u9886**\uFF08\u4E5F\u4E0D\u518D\u6E32\u67D3\uFF09\uFF1A\u5F15\u64CE\u4FA7 0927 \u5DF2\u628A\u5B83\u4EEC\u4ECE\u6E05\u5355\u64A4\u4E0B\n // \uFF08\u7FC0\u54E5\uFF1A\u300CvoiceChat \u9690\u85CF\uFF0C\u4EE5\u540E\u552E\u5356\u7684\u65F6\u5019\u518D\u8BF4\u3002\u4F60\u5185\u90E8\u53EF\u4EE5\u7559\u4F4D\u300D\uFF09\u3002\n // \u58F3\u5B50\u8FD8\u5728\uFF08\u5F15\u64CE\u7167\u5E38\u8BFB\u90A3\u4E00\u6BB5\u914D\u7F6E\uFF09\uFF0C\u53EA\u662F\u4E0D\u518D\u66B4\u9732\u7ED9\u7528\u6237 \u2014\u2014 \u89C1\u5F15\u64CE registry.ts \u91CC\u90A3\u6BB5\u6CE8\u3002\n { key: "voice", title: "\\u58F0\\u97F3", claim: [\n "tools.my_voice"\n ], render: renderVoicePanel },\n // \u641C\u7D22\u8BBE\u7F6E\uFF081010\uFF09\uFF1A\u72EC\u7ACB\u5B50 tab\u2014\u2014\u4E0D\u8BA9\u7528\u6237\u5728\u300C\u5176\u5B83\u300D\u7EC4\u91CC\u624B\u6253 tavily/doubao \u88F8\u503C\n // \u548C provider/model \u590D\u5408\u4E32\uFF1B\u9009\u8C46\u5305\u81EA\u52A8\u5199\u5168\u7EBF\u8DEF\u3002\u989D\u5EA6\u5C3D\u7531 7yi wrapper \u56DE\u843D\uFF0C\u7528\u6237\u65E0\u611F\u3002\n { key: "search", title: "\\u641C\\u7D22", claim: [\n "tools.webSearch.provider",\n "tools.webSearch.doubaoModel"\n ], render: renderSearchPanel }\n ];\n function claimedPaths() {\n return new Set(PANELS.flatMap((p) => p.claim));\n }\n var GROUP_TITLES = {\n general: "\\u76EE\\u5F55\\u4E0E\\u72B6\\u6001",\n display: "\\u663E\\u793A",\n session: "\\u4F1A\\u8BDD",\n sandbox: "\\u6C99\\u7BB1",\n feature: "\\u529F\\u80FD\\u5F00\\u5173",\n prompt: "\\u63D0\\u793A\\u8BCD",\n compaction: "\\u4E0A\\u4E0B\\u6587\\u538B\\u7F29",\n skills: "\\u6280\\u80FD",\n channel: "\\u901A\\u9053",\n model: "\\u6A21\\u578B",\n identity: "\\u4EBA\\u8BBE",\n face: "\\u5F62\\u8C61",\n voice: "\\u58F0\\u97F3",\n email: "\\u90AE\\u4EF6"\n };\n function looseFields(fields) {\n const claimed = claimedPaths();\n return fields.filter((f) => !claimed.has(f.path) && f.group !== "channel" && f.group !== "email");\n }\n\n // web-console/desktop/src/renderer/console/panels/others-policy.ts\n var PREFERENCE_EXTRAS = {\n "display.typing.enabled": { label: "\\u6B63\\u5728\\u8F93\\u5165\\u63D0\\u793A", hint: "\\u5728\\u652F\\u6301\\u7684\\u5E73\\u53F0\\u4E0A\\u663E\\u793A\\u4F19\\u4F34\\u6B63\\u5728\\u8F93\\u5165\\u3002", booleanDefault: true, showPath: false },\n "display.reactions.enabled": { label: "\\u6D88\\u606F\\u8868\\u60C5\\u56DE\\u5E94", hint: "\\u5728\\u652F\\u6301\\u7684\\u5E73\\u53F0\\u4E0A\\uFF0C\\u7528\\u8868\\u60C5\\u8868\\u793A\\u5F00\\u59CB\\u5904\\u7406\\u3001\\u5B8C\\u6210\\u6216\\u51FA\\u9519\\u3002", booleanDefault: true, showPath: false },\n "display.thinking.enabled": { label: "\\u663E\\u793A\\u601D\\u8003\\u8FC7\\u7A0B", hint: "\\u5DE5\\u4F5C\\u6A21\\u5F0F\\u4E0B\\u663E\\u793A\\u601D\\u8003\\u8FC7\\u7A0B\\u3002", booleanDefault: true, showPath: false },\n "display.toolUse.enabled": { label: "\\u663E\\u793A\\u5DE5\\u5177\\u8C03\\u7528", hint: "\\u5DE5\\u4F5C\\u6A21\\u5F0F\\u4E0B\\u663E\\u793A\\u4F19\\u4F34\\u6B63\\u5728\\u4F7F\\u7528\\u7684\\u5DE5\\u5177\\u3002", booleanDefault: true, showPath: false },\n "display.toolResult.enabled": { label: "\\u663E\\u793A\\u5DE5\\u5177\\u7ED3\\u679C", hint: "\\u5DE5\\u4F5C\\u6A21\\u5F0F\\u4E0B\\u663E\\u793A\\u5DE5\\u5177\\u6267\\u884C\\u7684\\u7ED3\\u679C\\u3002", booleanDefault: true, showPath: false },\n "display.toolOutputMode": { label: "\\u5DE5\\u5177\\u8F93\\u51FA\\u65B9\\u5F0F", hint: "\\u6298\\u53E0\\u540E\\u96C6\\u4E2D\\u663E\\u793A\\u5DE5\\u5177\\u8FC7\\u7A0B\\uFF1B\\u98DE\\u4E66\\u53EF\\u70B9\\u5F00\\u67E5\\u770B\\u7ED3\\u679C\\u3002\\u4FDD\\u5B58\\u540E\\u4E0B\\u4E00\\u8F6E\\u751F\\u6548\\u3002", enumDefault: "expanded", optionLabels: { expanded: "\\u5C55\\u5F00\\uFF08\\u9ED8\\u8BA4\\uFF09", collapsed: "\\u6298\\u53E0" }, showPath: false },\n "onboarding.tips.enabled": { label: "\\u6BCF\\u65E5\\u5C0F\\u529F\\u80FD\\u4ECB\\u7ECD", hint: "\\u5B89\\u88C5\\u540E\\u7684\\u524D\\u51E0\\u5929\\uFF0C\\u901A\\u8FC7\\u5FAE\\u4FE1\\u6216\\u98DE\\u4E66\\u4ECB\\u7ECD\\u4E00\\u4E2A\\u5C0F\\u529F\\u80FD\\u3002", booleanDefault: true, showPath: false }\n };\n var PREFERENCE_GROUPS = [\n { key: "chat", title: "\\u804A\\u5929\\u53CD\\u9988", paths: ["display.typing.enabled", "display.reactions.enabled"] },\n { key: "task", title: "\\u4EFB\\u52A1\\u8FC7\\u7A0B", paths: ["display.thinking.enabled", "display.toolUse.enabled", "display.toolResult.enabled", "display.toolOutputMode"] },\n { key: "guide", title: "\\u65B0\\u624B\\u5F15\\u5BFC", paths: ["onboarding.tips.enabled"] }\n ];\n var INTERNAL_ORDER = ["display", "onboarding", "session", "feature", "skills", "sandbox", "api", "prompt", "compaction", "voice", "general"];\n var INTERNAL_TITLES = { ...GROUP_TITLES, display: "\\u663E\\u793A\\u7EC6\\u8282", onboarding: "\\u5F15\\u5BFC\\u7EC6\\u8282", api: "\\u63A5\\u53E3\\u4E0E\\u6865\\u63A5", voice: "\\u8BED\\u97F3\\u670D\\u52A1" };\n function otherSections(fields, internalMode) {\n const loose = looseFields(fields);\n const used = /* @__PURE__ */ new Set();\n const sections = PREFERENCE_GROUPS.map((g) => ({ key: g.key, title: g.title, fields: g.paths.flatMap((path) => {\n const field = loose.find((f) => f.path === path && f.type === (path === "display.toolOutputMode" ? "enum" : "boolean"));\n if (!field) return [];\n used.add(path);\n return [field];\n }) })).filter((s) => s.fields.length > 0);\n if (!internalMode) return sections;\n const remaining = /* @__PURE__ */ new Map();\n for (const f of loose) {\n if (used.has(f.path)) continue;\n if (!remaining.has(f.group)) remaining.set(f.group, []);\n remaining.get(f.group).push(f);\n }\n const order2 = [...INTERNAL_ORDER.filter((g) => remaining.has(g)), ...[...remaining.keys()].filter((g) => !INTERNAL_ORDER.includes(g))];\n for (const g of order2) sections.push({ key: g, title: INTERNAL_TITLES[g] ?? g, fields: remaining.get(g) });\n return sections;\n }\n\n // web-console/desktop/src/renderer/console/panels/others.ts\n function renderOthersPanel(body, ctx) {\n const sections = otherSections(ctx.fields, ctx.internalMode);\n if (!sections.length) {\n body.replaceChildren(h("p", { class: "page-sub" }, "\\u6CA1\\u6709\\u989D\\u5916\\u7684\\u53EF\\u914D\\u7F6E\\u9879\\u3002"));\n return () => {\n };\n }\n const extras = Object.fromEntries(Object.entries(PREFERENCE_EXTRAS).map(([path, ex]) => [path, { ...ex, showPath: ctx.internalMode }]));\n const form = renderForm(sections.flatMap((s) => s.fields), ctx.values, ctx.secrets, ctx.deps, extras);\n const labels2 = Object.fromEntries(Object.entries(PREFERENCE_EXTRAS).map(([path, ex]) => [path, ex.label]));\n const bar = buildSaveBar(form, ctx, { labels: ctx.internalMode ? void 0 : labels2 });\n if (!ctx.internalMode) {\n form.root.classList.add("other-preferences");\n for (const row of form.rows) {\n row.el.classList.add("cf-preference");\n row.input.id = `preference-${row.field.path}`;\n row.el.querySelector("label").htmlFor = row.input.id;\n if (row.field.type === "boolean") row.input.setAttribute("role", "switch");\n else row.el.classList.add("cf-preference-choice");\n }\n }\n form.root.replaceChildren(...sections.map((s) => h(\n "section",\n { class: "settings-group", "data-group": s.key },\n h("h3", {}, s.title),\n ...s.fields.map((f) => form.rows.find((r) => r.field.path === f.path).el)\n )));\n body.replaceChildren(\n h("p", { class: "page-sub" }, ctx.internalMode ? "\\u5E38\\u7528\\u504F\\u597D\\u6392\\u5728\\u524D\\u9762\\uFF0C\\u5185\\u90E8\\u53C2\\u6570\\u6309\\u7528\\u9014\\u5206\\u7EC4\\u3002" : "\\u6309\\u4F60\\u7684\\u4E60\\u60EF\\u8C03\\u6574\\u804A\\u5929\\u53CD\\u9988\\u4E0E\\u4EFB\\u52A1\\u8FC7\\u7A0B\\u3002"),\n form.root,\n bar.el\n );\n return () => {\n };\n }\n var OTHERS_PANEL = { key: "others", title: "\\u5176\\u4ED6", claim: [], render: renderOthersPanel };\n\n // web-console/desktop/src/renderer/console/internal-mode.ts\n var INTERNAL_CLICKS = 7;\n var CLICK_WINDOW_MS = 3e3;\n function settingsFooter(opts) {\n const ver = (v) => v ?? "(\\u8BFB\\u4E0D\\u5230)";\n const line = h("span", {\n class: "version-line",\n id: "settings-version-line",\n // title \u91CC\u4E0D\u5199\u624B\u52BF\uFF08\u5199\u51FA\u6765\u5C31\u4E0D\u662F\u9690\u85CF\u624B\u52BF\u4E86\uFF09\uFF1B\u53EA\u8BF4\u660E\u8FD9\u884C\u662F\u4EC0\u4E48\n title: "\\u8DD1\\u8BBE\\u7F6E\\u9875\\u7684\\u5F15\\u64CE\\uFF08\\u5B89\\u88C5\\u5305\\u5185\\u7F6E\\uFF09\\u4E0E\\u8FD9\\u4EFD\\u5F15\\u64CE\\u5404\\u81EA\\u7684\\u7248\\u672C",\n "data-internal-clicks": "0"\n }, `\\u5185\\u7F6E\\u5F15\\u64CE ${ver(opts.cliVersion)} \\xB7 \\u76EE\\u6807\\u5F15\\u64CE ${ver(opts.engineVersion)}`);\n const badge = h(\n "span",\n { class: "internal-badge", id: "internal-mode-badge", hidden: !opts.internalMode },\n "\\u5185\\u90E8\\u6A21\\u5F0F"\n );\n const note = h(\n "span",\n { class: "internal-note", id: "internal-mode-note", hidden: !opts.flash },\n opts.flash ?? ""\n );\n let clicks = 0;\n let timer = null;\n const reset = () => {\n clicks = 0;\n line.dataset.internalClicks = "0";\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n };\n let busy = false;\n line.addEventListener("click", () => {\n if (busy) return;\n clicks += 1;\n line.dataset.internalClicks = String(clicks);\n if (timer) clearTimeout(timer);\n if (clicks >= INTERNAL_CLICKS) {\n reset();\n busy = true;\n const next = !opts.internalMode;\n note.hidden = false;\n note.textContent = next ? "\\u6B63\\u5728\\u5F00\\u542F\\u5185\\u90E8\\u6A21\\u5F0F\\u2026" : "\\u6B63\\u5728\\u5173\\u95ED\\u5185\\u90E8\\u6A21\\u5F0F\\u2026";\n void opts.onToggle(next).then((r) => {\n if (!r.ok) {\n note.textContent = `\\u5185\\u90E8\\u6A21\\u5F0F\\u5207\\u6362\\u5931\\u8D25\\uFF1A${r.error ?? "\\u672A\\u77E5\\u539F\\u56E0"}\\uFF08\\u6587\\u4EF6\\u5199\\u4E0D\\u8FDB\\u53BB\\uFF0C\\u6216 IPC \\u65AD\\u4E86\\uFF09`;\n }\n }).catch((e) => {\n note.textContent = `\\u5185\\u90E8\\u6A21\\u5F0F\\u5207\\u6362\\u5931\\u8D25\\uFF1A${e instanceof Error ? e.message : String(e)}`;\n }).finally(() => {\n busy = false;\n });\n return;\n }\n timer = setTimeout(reset, CLICK_WINDOW_MS);\n });\n return h("div", { class: "settings-footer", id: "settings-footer" }, line, badge, note);\n }\n\n // web-console/desktop/src/renderer/console/pages/settings.ts\n function mountSettings(body, marker, deps, actions) {\n let alive = true;\n let panelCleanup = null;\n let showGen = 0;\n let live = { values: {}, secrets: {} };\n let base = null;\n let currentKey = "general";\n let internalFlash = null;\n const wrap = h(\n "div",\n { class: "page" },\n h("h2", {}, "\\u8BBE\\u7F6E"),\n h("p", { class: "page-sub" }, "\\u88C5\\u5B8C\\u4E4B\\u540E\\u957F\\u671F\\u53EF\\u8C03\\u7684\\u4E1C\\u897F\\u3002\\u6539\\u52A8\\u5199\\u8FDB\\u5F15\\u64CE\\u914D\\u7F6E\\uFF1B\\u6807\\u4E86\\u300C\\u91CD\\u542F\\u540E\\u751F\\u6548\\u300D\\u7684\\u9879\\u8981\\u91CD\\u542F\\u5F15\\u64CE\\u624D\\u751F\\u6548\\u3002"),\n h("div", { class: "cfg-loading" }, "\\u6B63\\u5728\\u8BFB\\u53D6\\u5F15\\u64CE\\u7684\\u5B57\\u6BB5\\u6E05\\u5355\\u2026")\n );\n body.replaceChildren(wrap);\n const nav = h("nav", { class: "subtabs" });\n const slot = h("div", { class: "settings-panel-slot" });\n let tabList = [...PANELS];\n const render = (key) => {\n const panel = tabList.find((p) => p.key === key);\n if (!panel || !base) return;\n panelCleanup = panel.render(slot, { ...base, values: live.values, secrets: live.secrets });\n };\n const markActive = (key) => {\n for (const b of Array.from(nav.children)) {\n b.classList.toggle("active", b.dataset.key === key);\n }\n };\n const show = (key) => {\n const my = ++showGen;\n currentKey = key;\n markActive(key);\n panelCleanup?.();\n panelCleanup = null;\n slot.replaceChildren(h("div", { class: "cfg-loading" }, "\\u6B63\\u5728\\u8BFB\\u53D6\\u5F53\\u524D\\u914D\\u7F6E\\u2026"));\n void (async () => {\n const got = await deps.configGet(marker.configPath).catch(\n (e) => ({\n ok: false,\n values: {},\n secrets: {},\n secretsPath: null,\n error: e instanceof Error ? e.message : String(e)\n })\n );\n if (!alive || my !== showGen) return;\n if (got.ok) live = { values: got.values, secrets: got.secrets };\n render(key);\n })();\n };\n const renderLoadFailure = (msg) => {\n wrap.replaceChildren(\n h("h2", {}, "\\u8BBE\\u7F6E"),\n h(\n "div",\n { class: "inline-error" },\n msg,\n h("div", { class: "cf-hint" }, `\\u914D\\u7F6E\\u6587\\u4EF6\\uFF1A${marker.configPath}`)\n )\n );\n };\n const boot2 = async () => {\n showGen++;\n let pair;\n try {\n pair = await Promise.all([\n deps.configSchema(marker.stateDir),\n deps.configGet(marker.configPath)\n ]);\n } catch (e) {\n if (alive) renderLoadFailure(`\\u8BFB\\u53D6\\u5F15\\u64CE\\u914D\\u7F6E\\u5931\\u8D25\\uFF1A${e instanceof Error ? e.message : String(e)}`);\n return;\n }\n const [schema, got] = pair;\n if (!alive) return;\n if (!schema.ok || !got.ok) {\n wrap.replaceChildren(\n h("h2", {}, "\\u8BBE\\u7F6E"),\n h(\n "div",\n { class: "inline-error" },\n schema.error ?? got.error ?? "\\u914D\\u7F6E\\u9762\\u677F\\u6682\\u65F6\\u4E0D\\u53EF\\u7528\\u3002",\n h(\n "div",\n { class: "cf-hint" },\n `\\u5185\\u7F6E\\u5F15\\u64CE\\u7248\\u672C\\uFF1A${schema.cliVersion ?? "(\\u8BFB\\u4E0D\\u5230)"}\\u3000\\u76EE\\u6807\\u5F15\\u64CE\\u7248\\u672C\\uFF1A${schema.engineVersion ?? "(\\u8BFB\\u4E0D\\u5230)"}\\u3000\\u914D\\u7F6E\\u6587\\u4EF6\\uFF1A${marker.configPath}`\n )\n )\n );\n return;\n }\n live = { values: got.values, secrets: got.secrets };\n base = {\n stateDir: marker.stateDir,\n configPath: marker.configPath,\n fields: schema.fields,\n cliVersion: schema.cliVersion,\n engineVersion: schema.engineVersion,\n internalMode: schema.internalMode === true,\n deps,\n actions\n };\n const tabs = [...PANELS];\n if (otherSections(schema.fields, schema.internalMode === true).length > 0) tabs.push(OTHERS_PANEL);\n tabList = tabs;\n nav.replaceChildren(...tabs.map((p) => h("button", {\n class: "subtab",\n type: "button",\n "data-key": p.key,\n onclick: () => show(p.key)\n }, p.title)));\n const notice = driftNotice(schema.cliVersion, schema.engineVersion);\n wrap.replaceChildren(\n h("h2", {}, "\\u8BBE\\u7F6E"),\n h("p", { class: "page-sub" }, "\\u88C5\\u5B8C\\u4E4B\\u540E\\u957F\\u671F\\u53EF\\u8C03\\u7684\\u4E1C\\u897F\\u3002\\u6539\\u52A8\\u5199\\u8FDB\\u5F15\\u64CE\\u914D\\u7F6E\\uFF1B\\u6807\\u4E86\\u300C\\u91CD\\u542F\\u540E\\u751F\\u6548\\u300D\\u7684\\u9879\\u8981\\u91CD\\u542F\\u5F15\\u64CE\\u624D\\u751F\\u6548\\u3002"),\n ...notice ? [notice] : [],\n nav,\n slot,\n h("button", { class: "settings-mail-link", type: "button", onclick: () => deps.openMail?.() }, "\\u90AE\\u4EF6\\u8FDE\\u63A5", h("span", {}, "QQ\\u3001163\\u3001Gmail \\u203A")),\n // \u5E95\u90E8\u90A3\u884C\u7248\u672C\u6587\u5B57**\u540C\u65F6\u662F\u5185\u90E8\u6A21\u5F0F\u7684\u624B\u52BF\u843D\u70B9**\uFF08\u8FDE\u70B9 7 \u4E0B\uFF09\u2014\u2014\n // \u89C1 console/internal-mode.ts \u7684\u5934\u6CE8\uFF08\u90A3\u662F\u7ED9\u5185\u90E8\u7528\u7684\uFF0C\u4E0D\u662F\u6F0F\u6D1E\uFF09\u3002\n settingsFooter({\n cliVersion: schema.cliVersion,\n engineVersion: schema.engineVersion,\n internalMode: schema.internalMode === true,\n flash: internalFlash,\n onToggle: async (next) => {\n const r = await deps.internalModeSet(next);\n if (!r.ok) return r;\n internalFlash = next ? "\\u5185\\u90E8\\u6A21\\u5F0F\\u5DF2\\u5F00\\u542F\\uFF1A\\u4E0B\\u9762\\u7684\\u5206\\u7EC4\\u4E0E\\u58F0\\u97F3\\u9762\\u677F\\u4F1A\\u591A\\u51FA\\u5185\\u90E8\\u5B57\\u6BB5\\u3002" : "\\u5185\\u90E8\\u6A21\\u5F0F\\u5DF2\\u5173\\u95ED\\u3002";\n await boot2();\n return r;\n }\n })\n );\n const key = tabList.some((p) => p.key === currentKey) ? currentKey : "general";\n currentKey = key;\n markActive(key);\n panelCleanup?.();\n panelCleanup = null;\n render(key);\n };\n void boot2();\n return () => {\n alive = false;\n panelCleanup?.();\n };\n }\n\n // web-console/desktop/src/renderer/console/pages/travel.ts\n var errors = {\n service_unavailable: "\\u6682\\u65F6\\u8054\\u7CFB\\u4E0D\\u4E0A\\u968F\\u884C\\u673A\\u3002\\u5DF2\\u4FDD\\u7559\\u4E0A\\u6B21\\u72B6\\u6001\\uFF0C\\u8BF7\\u7A0D\\u540E\\u5237\\u65B0\\u3002",\n invalid_connection: "\\u8BF7\\u586B\\u5199\\u6B63\\u786E\\u7684 HTTPS \\u670D\\u52A1\\u5730\\u5740\\u548C\\u8FDE\\u63A5\\u7801\\u3002",\n wrong_partner: "\\u8FD9\\u4EFD\\u8FDE\\u63A5\\u4FE1\\u606F\\u5C5E\\u4E8E\\u53E6\\u4E00\\u4F4D\\u4F19\\u4F34\\u6216\\u673A\\u4F4D\\uFF0C\\u8BF7\\u6838\\u5BF9\\u540E\\u518D\\u8FDE\\u63A5\\u3002",\n setup_required: "\\u8FD9\\u4F4D\\u4F19\\u4F34\\u7684\\u968F\\u884C\\u8D44\\u6599\\u8FD8\\u672A\\u51C6\\u5907\\u597D\\u3002\\u8BF7\\u5148\\u5B8C\\u6210\\u968F\\u884C\\u673A\\u914D\\u5BF9\\uFF0C\\u518D\\u8FDE\\u63A5\\u3002",\n invalid_profile: "\\u968F\\u884C\\u8FDE\\u63A5\\u8D44\\u6599\\u6682\\u65F6\\u4E0D\\u53EF\\u7528\\uFF0C\\u8BF7\\u68C0\\u67E5\\u6216\\u91CD\\u65B0\\u8FDE\\u63A5\\u3002",\n invalid_response: "\\u5C1A\\u672A\\u53D6\\u5F97\\u53EF\\u6838\\u9A8C\\u7684\\u968F\\u884C\\u72B6\\u6001\\uFF0C\\u8BF7\\u7A0D\\u540E\\u5237\\u65B0\\u3002",\n recovery_required: "\\u672C\\u5730\\u8D44\\u6599\\u8FD8\\u6CA1\\u6709\\u5B8C\\u6210\\u6062\\u590D\\u9A8C\\u8BC1\\uFF0C\\u4E91\\u7AEF\\u8D44\\u6599\\u5DF2\\u4FDD\\u7559\\u3002\\u8BF7\\u5148\\u5728\\u7535\\u8111\\u7AEF\\u751F\\u6210\\u672C\\u5730\\u526F\\u672C\\u3002",\n recovery_unavailable: "\\u8BF7\\u5728\\u5DF2\\u7ECF\\u63A5\\u56DE\\u7684\\u7535\\u8111\\u4E0A\\u751F\\u6210\\u672C\\u5730\\u526F\\u672C\\uFF0C\\u518D\\u56DE\\u5230\\u8FD9\\u91CC\\u7ED3\\u675F\\u968F\\u884C\\u3002",\n confirmation_required: "\\u8BF7\\u5148\\u786E\\u8BA4\\u662F\\u5426\\u7ED3\\u675F\\u968F\\u884C\\u3002",\n busy: "\\u6B63\\u5728\\u5B8C\\u6210\\u5F53\\u524D\\u64CD\\u4F5C\\uFF0C\\u8BF7\\u7A0D\\u5019\\u518D\\u8BD5\\u3002",\n not_ready: "\\u76EE\\u6807\\u673A\\u4F4D\\u8FD8\\u672A\\u51C6\\u5907\\u597D\\uFF0C\\u5F53\\u524D\\u4F19\\u4F34\\u4FDD\\u6301\\u539F\\u8FD0\\u884C\\u4F4D\\u7F6E\\u3002",\n retired: "\\u8FD9\\u6B21\\u968F\\u884C\\u5DF2\\u7ECF\\u7ED3\\u675F\\uFF0C\\u8BF7\\u8FDE\\u63A5\\u65B0\\u7684\\u968F\\u884C\\u673A\\u4F4D\\u3002"\n };\n var phases = {\n REQUESTED: "\\u5DF2\\u767B\\u8BB0\\uFF0C\\u7B49\\u5F85\\u63A5\\u7EED",\n PREPARING: "\\u6B63\\u5728\\u51C6\\u5907\\u4EA4\\u63A5",\n FROZEN_AT_H: "\\u6B63\\u5728\\u540C\\u6B65\\u5DF2\\u786E\\u8BA4\\u8D44\\u6599",\n TARGET_READY: "\\u76EE\\u6807\\u673A\\u4F4D\\u5DF2\\u51C6\\u5907\\u597D",\n COMMITTED: "\\u8FD0\\u884C\\u4F4D\\u7F6E\\u5DF2\\u4EA4\\u63A5\\uFF0C\\u6B63\\u5728\\u786E\\u8BA4\\u8FDB\\u7A0B",\n DONE: "\\u4EA4\\u63A5\\u5B8C\\u6210",\n ABORTED: "\\u672C\\u6B21\\u4EA4\\u63A5\\u5DF2\\u53D6\\u6D88",\n RETIRING: "\\u6B63\\u5728\\u505C\\u6B62\\u968F\\u884C\\u8282\\u70B9",\n RECOVERY_ONLY: "\\u7B49\\u5F85\\u672C\\u5730\\u6062\\u590D\\u5B8C\\u6210",\n PURGING: "\\u6B63\\u5728\\u6E05\\u7406\\u4E91\\u7AEF\\u8D44\\u6599",\n KEY_DELETION_PENDING: "\\u6B63\\u5728\\u64A4\\u9500\\u4E91\\u7AEF\\u6388\\u6743",\n PURGED: "\\u5DF2\\u7ED3\\u675F\\u968F\\u884C"\n };\n var labels = { to_cloud: "\\u8F6C\\u5230\\u4E91\\u7AEF", to_local: "\\u63A5\\u56DE\\u7535\\u8111", recover: "\\u751F\\u6210\\u672C\\u5730\\u526F\\u672C", finish: "\\u7ED3\\u675F\\u968F\\u884C" };\n function mountTravel(body, marker, deps) {\n let alive = true, generation = 0, snapshot, connected = false, busy = false, stale = false, message = "", name = "\\u4F19\\u4F34";\n let timer;\n let modal;\n const wrap = h("div", { class: "page travel-page" });\n body.replaceChildren(wrap);\n const allowed = (action) => !!snapshot && snapshot.allowedActions.includes(action) && !busy && !stale;\n const perform = async (action, payload) => {\n if (!alive || busy) return;\n busy = true;\n message = "";\n const gen = ++generation;\n paint();\n try {\n const result = await deps.travelControl(marker.stateDir, action, payload);\n if (!alive || gen !== generation) return;\n const incomplete = result.snapshot?.active === "unknown";\n if (result.snapshot) {\n const prior = snapshot;\n snapshot = result.snapshot;\n if (incomplete && prior) snapshot = { ...snapshot, active: prior.active, peers: prior.peers, checkedAt: prior.checkedAt };\n }\n if (result.ok) {\n connected = result.connected !== false;\n stale = incomplete;\n } else {\n message = errors[result.error || ""] || "\\u8FD9\\u6B21\\u64CD\\u4F5C\\u5C1A\\u672A\\u5B8C\\u6210\\uFF0C\\u8BF7\\u5237\\u65B0\\u540E\\u91CD\\u8BD5\\u3002";\n stale = ["service_unavailable", "invalid_response", "wrong_partner", "invalid_profile"].includes(result.error || "");\n }\n if (result.ok && !connected) snapshot = void 0;\n } catch {\n if (alive && gen === generation) {\n message = errors.service_unavailable;\n stale = true;\n }\n } finally {\n if (alive && gen === generation) {\n busy = false;\n paint();\n schedule();\n if (action !== "status") deps.onStateChanged?.();\n }\n }\n };\n const schedule = () => {\n if (timer) clearTimeout(timer);\n if (!alive || !connected) return;\n timer = setTimeout(() => {\n if (!busy) void perform("status");\n else schedule();\n }, 5e3);\n };\n const connection = () => {\n const address = h("input", { type: "url", autocomplete: "url", placeholder: "https://\\u2026/travel/console/v1", "data-travel-endpoint": "", required: true });\n const code = h("input", { type: "password", autocomplete: "off", "data-travel-code": "", required: true });\n const form = h(\n "form",\n { class: "travel-connect-form" },\n h("h2", {}, "\\u8FDE\\u63A5\\u968F\\u884C\\u673A"),\n h("p", {}, "\\u4F7F\\u7528\\u4E3A\\u8FD9\\u4F4D\\u4F19\\u4F34\\u51C6\\u5907\\u7684\\u670D\\u52A1\\u5730\\u5740\\u548C\\u8FDE\\u63A5\\u7801\\u3002\\u8FDE\\u63A5\\u4FE1\\u606F\\u4F1A\\u4FDD\\u5B58\\u5728\\u672C\\u673A\\u3002"),\n h("label", {}, "\\u670D\\u52A1\\u5730\\u5740", address),\n h("label", {}, "\\u8FDE\\u63A5\\u7801", code),\n h(\n "div",\n { class: "btn-row" },\n h("button", { class: "btn", type: "button", onclick: () => {\n modal?.close();\n modal = void 0;\n } }, "\\u53D6\\u6D88"),\n h("button", { class: "btn btn-primary", type: "submit", "data-travel-submit-connect": "" }, "\\u8FDE\\u63A5")\n )\n );\n form.onsubmit = (event) => {\n event.preventDefault();\n const payload = { endpoint: address.value.trim(), code: code.value.trim() };\n code.value = "";\n modal?.close();\n modal = void 0;\n void perform("connect", payload);\n };\n modal = openModal(form);\n address.focus();\n };\n const confirmFinish = () => {\n const content = h(\n "div",\n { class: "travel-confirm" },\n h("h2", {}, "\\u7ED3\\u675F\\u8FD9\\u4F4D\\u4F19\\u4F34\\u7684\\u968F\\u884C\\uFF1F"),\n h("p", {}, "\\u5B8C\\u6210\\u672C\\u5730\\u6062\\u590D\\u9A8C\\u8BC1\\u540E\\uFF0C\\u624D\\u4F1A\\u6E05\\u7406\\u8FD9\\u6B21\\u968F\\u884C\\u7684\\u4E91\\u7AEF\\u8D44\\u6599\\u5E76\\u64A4\\u9500\\u673A\\u4F4D\\u6388\\u6743\\u3002\\u7535\\u8111\\u4E0A\\u7684\\u666E\\u901A\\u526F\\u672C\\u4F1A\\u4FDD\\u7559\\u3002"),\n h("p", {}, snapshot?.recovery === "ready" ? "\\u666E\\u901A\\u672C\\u5730\\u526F\\u672C\\u5DF2\\u901A\\u8FC7\\u6062\\u590D\\u9A8C\\u8BC1\\u3002" : "\\u672C\\u5730\\u6062\\u590D\\u5C1A\\u672A\\u5B8C\\u6210\\uFF0C\\u4E91\\u7AEF\\u8D44\\u6599\\u4F1A\\u7EE7\\u7EED\\u4FDD\\u7559\\u3002"),\n h(\n "div",\n { class: "btn-row" },\n h("button", { class: "btn", type: "button", onclick: () => {\n modal?.close();\n modal = void 0;\n } }, "\\u7EE7\\u7EED\\u968F\\u884C"),\n h("button", { class: "btn btn-danger", type: "button", "data-travel-confirm-finish": "", onclick: () => {\n modal?.close();\n modal = void 0;\n void perform("finish", { confirmed: true });\n } }, "\\u786E\\u8BA4\\u7ED3\\u675F")\n )\n );\n modal = openModal(content);\n };\n const button = (action, primary = false) => h("button", {\n class: "btn" + (primary ? " btn-primary" : action === "finish" ? " btn-danger" : ""),\n type: "button",\n "data-travel-action": action,\n disabled: !allowed(action),\n onclick: () => action === "finish" ? confirmFinish() : void perform(action, { requestId: crypto.randomUUID() })\n }, labels[action] || action);\n const paint = () => {\n if (!alive) return;\n const ended = snapshot?.retirement?.state === "PURGED";\n const presence = ended ? "\\u5DF2\\u7ED3\\u675F\\u968F\\u884C" : snapshot?.active === "cloud" ? `${name}\\u5728\\u4E91\\u7AEF\\u3002` : snapshot?.active === "local" ? `${name}\\u5728\\u7535\\u8111\\u4E0A\\u3002` : snapshot?.active === "none" ? "\\u5F53\\u524D\\u6CA1\\u6709\\u5DF2\\u786E\\u8BA4\\u7684\\u8FD0\\u884C\\u8282\\u70B9\\u3002" : "\\u6B63\\u5728\\u6838\\u5BF9\\u8FD0\\u884C\\u4F4D\\u7F6E\\u3002";\n const heading = h(\n "div",\n { class: "travel-heading" },\n h(\n "div",\n {},\n h("p", { class: "travel-eyebrow" }, "\\u76F8\\u4F34\\uFF0C\\u968F\\u4F60\\u800C\\u884C"),\n h("h2", {}, "\\u968F\\u884C"),\n h("p", { class: "page-sub" }, "\\u7535\\u8111\\u5408\\u4E0A\\u540E\\uFF0C\\u4F19\\u4F34\\u4ECD\\u53EF\\u5728\\u4E91\\u7AEF\\u4E0E\\u4F60\\u76F8\\u4F34\\u3002")\n ),\n h("button", { class: "btn", type: "button", "data-travel-refresh": "", disabled: busy, onclick: () => {\n void perform("status");\n } }, busy ? "\\u6B63\\u5728\\u6838\\u5BF9\\u2026" : "\\u5237\\u65B0\\u72B6\\u6001")\n );\n const notices = message ? [h("p", { class: "travel-notice" + (stale ? " stale" : ""), role: "status" }, message)] : [];\n if (!connected && !snapshot) {\n wrap.replaceChildren(heading, ...notices, h(\n "section",\n { class: "travel-intro" },\n h("div", { class: "travel-intro-mark", "aria-hidden": "true" }, navIcon("travel")),\n h("h3", {}, "\\u51FA\\u5DEE\\u3001\\u65C5\\u884C\\uFF0C\\u4E5F\\u80FD\\u7EE7\\u7EED\\u76F8\\u4F34\\u3002"),\n h("p", {}, "\\u8FDE\\u63A5\\u5DF2\\u7ECF\\u51C6\\u5907\\u597D\\u7684\\u968F\\u884C\\u673A\\u3002\\u8FD0\\u884C\\u72B6\\u6001\\u548C\\u63A5\\u7EED\\u64CD\\u4F5C\\uFF0C\\u4F1A\\u51FA\\u73B0\\u5728\\u8FD9\\u91CC\\u3002"),\n h("button", { class: "btn btn-primary", type: "button", disabled: busy, "data-travel-connect": "", onclick: connection }, "\\u8FDE\\u63A5\\u968F\\u884C\\u673A")\n ));\n return;\n }\n const peers = h("div", { class: "travel-peers" }, ...(snapshot?.peers || []).map((peer) => h(\n "section",\n {\n class: "travel-peer",\n "data-travel-peer": peer.role,\n "data-running": String(peer.running),\n "data-active": String(snapshot?.active === peer.role)\n },\n h("span", { class: "travel-peer-kind" }, peer.role === "local" ? "\\u7535\\u8111" : "\\u4E91\\u7AEF"),\n h("h3", {}, peer.label),\n h("p", { class: "travel-peer-presence" }, stale ? "\\u72B6\\u6001\\u672A\\u66F4\\u65B0" : peer.running ? "\\u6B63\\u5728\\u8FD0\\u884C" : peer.connected ? "\\u5DF2\\u8FDE\\u63A5\\uFF0C\\u7B49\\u5F85\\u63A5\\u7EED" : "\\u6682\\u672A\\u8FDE\\u63A5"),\n h("p", { class: "page-sub" }, peer.busy ? "\\u6B63\\u5728\\u5904\\u7406\\u5F53\\u524D\\u5DE5\\u4F5C" : peer.role === "local" ? "\\u63A5\\u56DE\\u540E\\uFF0C\\u53EF\\u4EE5\\u7EE7\\u7EED\\u5728\\u7535\\u8111\\u4E0A\\u4F7F\\u7528\\u3002" : "\\u7535\\u8111\\u4F11\\u606F\\u65F6\\uFF0C\\u4E5F\\u53EF\\u4EE5\\u7EE7\\u7EED\\u5728\\u7EBF\\u3002")\n )));\n const auto = h("button", {\n class: "btn travel-auto",\n type: "button",\n role: "switch",\n "aria-checked": String(snapshot?.enabled === true),\n disabled: !allowed(snapshot?.enabled ? "auto_off" : "auto_on"),\n onclick: () => {\n void perform(snapshot?.enabled ? "auto_off" : "auto_on");\n }\n }, snapshot?.enabled ? "\\u81EA\\u52A8\\u63A5\\u7EED\\uFF1A\\u5DF2\\u5F00\\u542F" : "\\u81EA\\u52A8\\u63A5\\u7EED\\uFF1A\\u5DF2\\u5173\\u95ED");\n const transfer = snapshot?.transfer;\n const retirement = snapshot?.retirement;\n wrap.replaceChildren(\n heading,\n ...notices,\n h(\n "section",\n { class: "travel-presence", "data-stale": String(stale) },\n h("span", { class: "travel-presence-dot", "aria-hidden": "true" }),\n h("div", {}, h("h3", { "data-travel-presence": "", role: "status" }, presence), h("p", { class: "page-sub" }, stale ? "\\u4E0A\\u6B21\\u6838\\u9A8C\\u7684\\u72B6\\u6001\\uFF1B\\u5F53\\u524D\\u6682\\u65F6\\u65E0\\u6CD5\\u66F4\\u65B0\\u3002" : snapshot ? "\\u6700\\u8FD1\\u6838\\u9A8C\\uFF1A" + new Date(snapshot.checkedAt).toLocaleTimeString() : "\\u6B63\\u5728\\u6838\\u9A8C"))\n ),\n peers,\n h(\n "section",\n { class: "travel-actions" },\n h("div", {}, h("h3", {}, "\\u8BA9\\u76F8\\u4F34\\u7EE7\\u7EED"), h("p", { class: "page-sub" }, "\\u5148\\u786E\\u8BA4\\u8D44\\u6599\\u548C\\u5F53\\u524D\\u5DE5\\u4F5C\\uFF0C\\u518D\\u4EA4\\u63A5\\u8FD0\\u884C\\u4F4D\\u7F6E\\u3002")),\n h("div", { class: "btn-row" }, button("to_cloud", snapshot?.active !== "cloud"), button("to_local", snapshot?.active === "cloud"), auto)\n ),\n ...transfer ? [h(\n "section",\n { class: "travel-progress", "data-travel-transfer": "", role: "status" },\n h("strong", {}, transfer.target === "local" ? "\\u6B63\\u5728\\u63A5\\u56DE\\u7535\\u8111" : "\\u6B63\\u5728\\u8F6C\\u5230\\u4E91\\u7AEF"),\n h("p", {}, phases[transfer.state] || "\\u6B63\\u5728\\u6838\\u5BF9\\u4EA4\\u63A5"),\n h("p", { class: "page-sub" }, "\\u53EF\\u4EE5\\u79BB\\u5F00\\u9875\\u9762\\uFF0C\\u91CD\\u65B0\\u6253\\u5F00\\u540E\\u4F1A\\u7EE7\\u7EED\\u663E\\u793A\\u8FD9\\u6B21\\u4EA4\\u63A5\\u3002")\n )] : [],\n h("section", { class: "travel-exit" }, h(\n "div",\n {},\n h("h3", {}, "\\u7ED3\\u675F\\u968F\\u884C"),\n h("p", { "data-travel-recovery": "", class: "page-sub" }, snapshot?.recovery === "ready" ? "\\u666E\\u901A\\u672C\\u5730\\u526F\\u672C\\u5DF2\\u5B8C\\u6210\\u6062\\u590D\\u9A8C\\u8BC1\\u3002" : "\\u5148\\u63A5\\u56DE\\u7535\\u8111\\uFF0C\\u5E76\\u751F\\u6210\\u5DF2\\u9A8C\\u8BC1\\u7684\\u666E\\u901A\\u672C\\u5730\\u526F\\u672C\\u3002"),\n ...retirement ? [h("p", { role: "status" }, phases[retirement.state] || "\\u6B63\\u5728\\u6838\\u5BF9\\u6E05\\u9000\\u72B6\\u6001")] : []\n ), h("div", { class: "btn-row" }, button("recover"), button("finish")))\n );\n };\n paint();\n void deps.configGet(marker.configPath).then((result) => {\n if (!alive) return;\n const value = result.values?.agents?.defaults?.name;\n if (result.ok && typeof value === "string" && value.trim()) {\n name = value.trim();\n if (!busy) paint();\n }\n }).catch(() => {\n });\n void perform("status");\n return () => {\n alive = false;\n generation++;\n if (timer) clearTimeout(timer);\n modal?.close();\n };\n }\n\n // web-console/desktop/src/renderer/console/connection-list.ts\n var gmailIcon = "data:image/svg+xml," + encodeURIComponent(\'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#4285f4" d="M2 6v13h4V9z"/><path fill="#34a853" d="M18 9v10h4V6z"/><path fill="#ea4335" d="m6 9 6 4 6-4V4l-6 4-6-4z"/><path fill="#fbbc04" d="m18 4 4 2-4 3z"/><path fill="#c5221f" d="M2 6 6 4v5z"/></svg>\');\n function connectionRow(id, name, description) {\n return h(\n "section",\n { class: "connection-row", "data-connection": id },\n h(\n "span",\n { class: "connection-icon", "data-brand": id, "aria-hidden": "true" },\n id === "gmail" ? h("img", { src: gmailIcon, alt: "" }) : id === "qq" ? "QQ" : "163"\n ),\n h("div", { class: "connection-copy" }, h("h3", {}, name), h("p", { class: "connection-description" }, description)),\n h("button", { class: "connection-action", type: "button" }, "\\u8FDE\\u63A5")\n );\n }\n\n // web-console/desktop/src/shared/service-auth.ts\n var GMAIL_PERMISSIONS = { readMessages: "\\u8BFB\\u53D6\\u90AE\\u4EF6", searchMessages: "\\u641C\\u7D22\\u90AE\\u4EF6", readDrafts: "\\u8BFB\\u53D6\\u8349\\u7A3F", readLabelsFilters: "\\u8BFB\\u53D6\\u6807\\u7B7E\\u548C\\u7B5B\\u9009\\u6761\\u4EF6", writeDrafts: "\\u7F16\\u8F91\\u8349\\u7A3F", manageLabels: "\\u7BA1\\u7406\\u6807\\u7B7E", markRead: "\\u5DF2\\u8BFB\\uFF0F\\u672A\\u8BFB", importMessages: "\\u5BFC\\u5165\\u90AE\\u4EF6", send: "\\u53D1\\u9001\\u90AE\\u4EF6", trash: "\\u79FB\\u5165\\uFF0F\\u79FB\\u51FA\\u5783\\u573E\\u6876", unsubscribe: "\\u53D6\\u6D88\\u8BA2\\u9605", sync: "\\u540E\\u53F0\\u540C\\u6B65" };\n\n // web-console/desktop/src/renderer/console/pages/gmail-connection.ts\n var ERRORS = {\n engine_unavailable: "\\u4F19\\u4F34\\u6682\\u65F6\\u8054\\u7CFB\\u4E0D\\u4E0A\\uFF0C\\u542F\\u52A8\\u540E\\u53EF\\u8FDE\\u63A5\\u3002",\n wrong_partner: "\\u6682\\u65F6\\u65E0\\u6CD5\\u786E\\u8BA4\\u5F53\\u524D\\u4F19\\u4F34\\uFF0C\\u8BF7\\u5237\\u65B0\\u540E\\u518D\\u8BD5\\u3002",\n unknown_partner: "\\u8BF7\\u5148\\u9009\\u62E9\\u5DF2\\u5B89\\u88C5\\u7684\\u4F19\\u4F34\\u3002",\n upgrade_required: "\\u5347\\u7EA7\\u5F15\\u64CE\\u540E\\u5373\\u53EF\\u767B\\u5F55\\u8FDE\\u63A5 Gmail\\u3002",\n provider_unavailable: "Gmail \\u767B\\u5F55\\u8FDE\\u63A5\\u6682\\u672A\\u51C6\\u5907\\u597D\\uFF0C\\u8BF7\\u7A0D\\u540E\\u518D\\u8BD5\\u3002",\n platform_unavailable: "\\u6682\\u65F6\\u65E0\\u6CD5\\u6838\\u5BF9\\u8FDE\\u63A5\\uFF0C\\u8BF7\\u7A0D\\u540E\\u91CD\\u8BD5\\u3002",\n browser_open_failed: "\\u6D4F\\u89C8\\u5668\\u6682\\u65F6\\u6CA1\\u6709\\u6253\\u5F00\\uFF0C\\u70B9\\u51FB\\u7EE7\\u7EED\\u6388\\u6743\\u91CD\\u8BD5\\u3002",\n authorization_expired: "\\u6388\\u6743\\u5DF2\\u5931\\u6548\\uFF0C\\u8BF7\\u91CD\\u65B0\\u767B\\u5F55\\u3002"\n };\n function mountGmailConnection(row, stateDir, deps, onState) {\n const action = row.querySelector(".connection-action");\n const description = row.querySelector(".connection-description");\n const details = h("div", { class: "gmail-details", hidden: true });\n row.append(details);\n let alive = true, busy = false, generation = 0, timer;\n let known = { ok: true }, available, error = "", expanded = false, confirming = false, revocationPending = false;\n const revocationKey = `engine7:gmail:revocation-pending:${stateDir}`;\n try {\n revocationPending = sessionStorage.getItem(revocationKey) === "1";\n } catch {\n }\n const rememberRevocation = (result) => {\n if (result.revocationConfirmed === void 0 && result.status !== "connected") return;\n revocationPending = result.status !== "connected" && result.revocationConfirmed === false;\n try {\n if (revocationPending) sessionStorage.setItem(revocationKey, "1");\n else sessionStorage.removeItem(revocationKey);\n } catch {\n }\n };\n const invoke = async (operation, payload) => {\n if (!deps.serviceAuth) return { ok: false, error: "upgrade_required" };\n try {\n return await deps.serviceAuth(stateDir, operation, "gmail", payload);\n } catch {\n return { ok: false, error: "platform_unavailable" };\n }\n };\n const stopTimer = () => {\n if (timer) clearTimeout(timer);\n timer = void 0;\n };\n const render = () => {\n if (!alive) return;\n const connected = known.status === "connected" || known.status === "pending" && !!known.account, pending = known.status === "pending";\n row.dataset.status = known.status ?? "unknown";\n onState(known.status === void 0 ? void 0 : connected);\n const messages = { not_connected: "\\u67E5\\u770B\\u3001\\u641C\\u7D22\\u90AE\\u4EF6\\uFF0C\\u767B\\u5F55 Google \\u5373\\u53EF\\u3002", pending: "\\u7B49\\u5F85\\u4F60\\u5728\\u624B\\u673A\\u6216\\u6D4F\\u89C8\\u5668\\u4E2D\\u767B\\u5F55\\u6388\\u6743\\u3002", connected: `\\u5DF2\\u8FDE\\u63A5 \\xB7 ${known.account ?? ""}`, disconnected: "\\u5DF2\\u65AD\\u5F00\\uFF0C\\u9700\\u8981\\u65F6\\u53EF\\u4EE5\\u91CD\\u65B0\\u8FDE\\u63A5\\u3002", denied: "\\u5DF2\\u53D6\\u6D88\\u6388\\u6743\\uFF0C\\u9700\\u8981\\u65F6\\u518D\\u8FDE\\u63A5\\u3002", expired: "\\u6388\\u6743\\u5DF2\\u8FC7\\u671F\\uFF0C\\u8BF7\\u91CD\\u65B0\\u767B\\u5F55\\u3002", failed: "\\u8FDE\\u63A5\\u672A\\u5B8C\\u6210\\uFF0C\\u53EF\\u4EE5\\u91CD\\u65B0\\u5C1D\\u8BD5\\u3002" };\n description.textContent = error || messages[known.status ?? ""] || "\\u6B63\\u5728\\u6838\\u5BF9\\u8FDE\\u63A5\\u2026";\n if (revocationPending) description.textContent = "\\u672C\\u4F19\\u4F34\\u5DF2\\u505C\\u7528\\uFF0CGoogle \\u64A4\\u9500\\u5C1A\\u672A\\u786E\\u8BA4\\u3002";\n action.textContent = busy ? "\\u6B63\\u5728\\u6838\\u5BF9\\u2026" : connected ? "\\u5DF2\\u8FDE\\u63A5" : pending ? "\\u7EE7\\u7EED\\u6388\\u6743" : known.status === "expired" ? "\\u91CD\\u65B0\\u8FDE\\u63A5" : "\\u8FDE\\u63A5 Gmail";\n action.disabled = busy || available === false && !connected && !pending;\n action.setAttribute("aria-expanded", String(expanded));\n action.classList.toggle("connected", connected);\n details.hidden = !expanded && !pending && !revocationPending && !error;\n const refresh = h("button", { class: "btn btn-ghost", type: "button", "data-gmail-refresh": "", disabled: busy, onclick: () => void check() }, "\\u91CD\\u65B0\\u6838\\u5BF9");\n const children = [];\n if (connected) children.push(h("p", { class: "gmail-account" }, known.account ?? ""), h("p", { class: "cf-hint" }, known.needsAuthorization ? "\\u5F53\\u524D\\u5DF2\\u6388\\u6743\\u67E5\\u770B\\u90AE\\u4EF6\\uFF0C\\u7BA1\\u7406\\u90AE\\u4EF6\\u9700\\u589E\\u52A0\\u6388\\u6743\\u3002" : "\\u5DF2\\u6388\\u6743\\u7BA1\\u7406\\u90AE\\u4EF6\\u3002\\u5404\\u9879\\u64CD\\u4F5C\\u9075\\u5FAA\\u4E0B\\u65B9\\u8BBE\\u7F6E\\u3002"));\n if (connected && known.settings) {\n const policies = h("div", { class: "gmail-policies" });\n for (const [key, label] of Object.entries(GMAIL_PERMISSIONS)) {\n const select = h("select", { "data-gmail-policy": key, "aria-label": label, disabled: busy, onchange: (event) => {\n const mode = event.target.value;\n void perform("settings_update", { permissions: { [key]: mode } });\n } });\n for (const [value, text] of [["allow", "\\u5141\\u8BB8"], ["ask", "\\u63D0\\u95EE"], ["deny", "\\u7981\\u6B62"]]) {\n const option = h("option", { value }, text);\n option.selected = known.settings.permissions[key] === value;\n select.append(option);\n }\n policies.append(h("label", { class: "gmail-policy" }, h("span", {}, label), select));\n }\n children.push(policies);\n }\n if (connected && known.sync) children.push(h("p", { class: "cf-hint", "data-gmail-sync": "" }, `\\u540E\\u53F0\\u540C\\u6B65${known.sync.enabled ? "\\u5DF2\\u5F00\\u542F" : "\\u672A\\u81EA\\u52A8\\u5F00\\u542F"} \\xB7 \\u5DF2\\u7F13\\u5B58 ${known.sync.cachedMessages} \\u5C01\\u6982\\u8981${known.sync.running ? " \\xB7 \\u6B63\\u5728\\u540C\\u6B65" : ""}${known.sync.error ? " \\xB7 \\u6682\\u65F6\\u65E0\\u6CD5\\u540C\\u6B65\\uFF0C\\u7A0D\\u540E\\u91CD\\u8BD5" : ""}`));\n if (error) children.push(h("p", { class: "cf-hint" }, error));\n if (revocationPending) children.push(h("p", { class: "cf-hint" }, "\\u672C\\u4F19\\u4F34\\u5DF2\\u505C\\u6B62\\u8BFB\\u53D6\\u3002\\u4F60\\u4E5F\\u53EF\\u4EE5\\u5230 Google \\u8D26\\u53F7\\u67E5\\u770B\\u6216\\u79FB\\u9664\\u6388\\u6743\\u3002"));\n const buttons = [refresh];\n if (connected && known.needsAuthorization && !pending) buttons.push(h("button", { class: "btn btn-primary", type: "button", "data-gmail-upgrade": "", disabled: busy, onclick: () => void perform("connect") }, "\\u589E\\u52A0\\u6388\\u6743"));\n if (pending) buttons.push(h("button", { class: "btn btn-ghost", type: "button", "data-gmail-cancel": "", disabled: busy, onclick: () => void perform("disconnect") }, "\\u53D6\\u6D88\\u8FDE\\u63A5"));\n if (connected) buttons.push(h("button", { class: "btn btn-ghost", type: "button", "data-gmail-disconnect": "", disabled: busy, onclick: () => {\n confirming = true;\n expanded = true;\n render();\n } }, "\\u65AD\\u5F00\\u8FDE\\u63A5"));\n if (revocationPending) buttons.push(h("button", { class: "btn btn-ghost", type: "button", disabled: busy, onclick: () => void perform("disconnect") }, "\\u91CD\\u8BD5\\u64A4\\u9500"), h("button", { class: "btn btn-ghost", type: "button", onclick: () => void perform("permissions") }, "Google \\u6388\\u6743\\u7BA1\\u7406"));\n children.push(h("div", { class: "btn-row" }, ...buttons));\n if (confirming) children.push(h("div", { class: "gmail-confirm" }, h("p", {}, "\\u65AD\\u5F00\\u540E\\uFF0C\\u8FD9\\u4F4D\\u4F19\\u4F34\\u5C06\\u505C\\u6B62\\u8BFB\\u53D6 Gmail\\u3002"), h("div", { class: "btn-row" }, h("button", { class: "btn btn-primary", type: "button", "data-gmail-confirm-disconnect": "", onclick: () => {\n confirming = false;\n void perform("disconnect");\n } }, "\\u786E\\u8BA4\\u65AD\\u5F00"), h("button", { class: "btn btn-ghost", type: "button", onclick: () => {\n confirming = false;\n render();\n } }, "\\u4FDD\\u7559\\u8FDE\\u63A5"))));\n details.replaceChildren(...children);\n };\n const accept = (result) => {\n if (result.ok || result.status) {\n known = { ...known, ...result };\n error = "";\n if (result.status && result.status !== "connected" && (result.status !== "pending" || !known.account)) {\n delete known.account;\n delete known.scopes;\n delete known.needsAuthorization;\n }\n }\n if (!result.ok) error = ERRORS[result.error ?? ""] ?? "\\u6682\\u65F6\\u65E0\\u6CD5\\u6838\\u5BF9\\u8FDE\\u63A5\\uFF0C\\u8BF7\\u7A0D\\u540E\\u91CD\\u8BD5\\u3002";\n if (result.status === "failed") error = ERRORS[result.error ?? ""] ?? "\\u8FDE\\u63A5\\u672A\\u5B8C\\u6210\\uFF0C\\u8BF7\\u91CD\\u65B0\\u5C1D\\u8BD5\\u3002";\n rememberRevocation(result);\n };\n const poll2 = () => {\n stopTimer();\n if (alive && known.status === "pending") timer = setTimeout(() => void check(), 2e3);\n };\n const check = async () => {\n if (busy || !alive) return;\n const gen = ++generation;\n busy = true;\n stopTimer();\n render();\n const result = await invoke("status");\n if (!alive || gen !== generation) return;\n accept(result);\n busy = false;\n render();\n poll2();\n };\n const perform = async (operation, payload) => {\n if (busy || !alive) return;\n const gen = ++generation;\n busy = true;\n stopTimer();\n render();\n const result = await invoke(operation, payload);\n if (operation === "disconnect") rememberRevocation(result);\n if (!alive || gen !== generation) return;\n if (operation !== "permissions") accept(result);\n else if (!result.ok) error = ERRORS[result.error ?? ""] ?? "\\u8BF7\\u7A0D\\u540E\\u518D\\u8BD5\\u3002";\n busy = false;\n render();\n poll2();\n };\n action.onclick = () => {\n if (known.status === "connected") {\n expanded = !expanded;\n render();\n return;\n }\n void perform(known.status === "pending" ? "continue" : "connect");\n };\n render();\n void (async () => {\n const gen = ++generation;\n busy = true;\n render();\n const [catalog, status] = await Promise.all([invoke("catalog"), invoke("status")]);\n if (!alive || gen !== generation) return;\n if (catalog.ok) available = catalog.providers?.find((p) => p.id === "gmail")?.available ?? false;\n accept(status);\n if (available === false && known.status === "not_connected") error = ERRORS.provider_unavailable ?? "Gmail \\u6682\\u65F6\\u65E0\\u6CD5\\u8FDE\\u63A5\\u3002";\n busy = false;\n render();\n poll2();\n })();\n return () => {\n alive = false;\n generation++;\n stopTimer();\n action.onclick = null;\n };\n }\n\n // web-console/desktop/src/renderer/console/pages/email.ts\n function mountEmail(body, marker, deps) {\n let alive = true, imapCleanup, gmailConnected, imapAddress = "", imapUpdated = false;\n const count = h("span", { class: "mail-connected-count" }, "\\u8FDE\\u63A5\\u72B6\\u6001\\u5F85\\u6838\\u5BF9");\n const qq = connectionRow("qq", "QQ \\u90AE\\u7BB1", "\\u6536\\u53D1\\u3001\\u67E5\\u627E\\u90AE\\u4EF6\\uFF0C\\u4F7F\\u7528\\u90AE\\u7BB1\\u6388\\u6743\\u7801\\u8FDE\\u63A5\\u3002");\n const netease = connectionRow("163", "163 / 126 / 188", "\\u6536\\u53D1\\u3001\\u67E5\\u627E\\u90AE\\u4EF6\\uFF0C\\u4F7F\\u7528\\u5BA2\\u6237\\u7AEF\\u6388\\u6743\\u5BC6\\u7801\\u8FDE\\u63A5\\u3002");\n const gmail = connectionRow("gmail", "Gmail", "\\u67E5\\u770B\\u3001\\u641C\\u7D22\\u90AE\\u4EF6\\uFF0C\\u767B\\u5F55 Google \\u5373\\u53EF\\u3002");\n const list = h("div", { class: "connection-list" }, qq, netease, gmail);\n const form = h("div", { class: "mail-configuration", hidden: true });\n const update = () => {\n if (!alive) return;\n count.textContent = `${gmailConnected === void 0 ? "\\u8FDE\\u63A5\\u72B6\\u6001\\u5F85\\u6838\\u5BF9" : `\\u5DF2\\u8FDE\\u63A5 ${Number(gmailConnected)} \\u4E2A`}${imapAddress ? " \\xB7 \\u5DF2\\u914D\\u7F6E 1 \\u4E2A" : ""}`;\n for (const [row, domains] of [[qq, ["qq.com", "foxmail.com"]], [netease, ["163.com", "126.com", "188.com"]]]) {\n const connected = domains.some((domain) => domain === (imapAddress.split("@")[1]?.toLowerCase() ?? ""));\n const button = row.querySelector(".connection-action");\n button.textContent = connected ? "\\u5DF2\\u914D\\u7F6E" : "\\u8FDE\\u63A5";\n button.classList.toggle("connected", connected);\n }\n };\n const openImap = (provider) => {\n imapCleanup?.();\n form.hidden = false;\n for (const row of [qq, netease]) row.classList.toggle("selected", row.dataset.connection === provider);\n imapCleanup = mountImapEmail(form, marker, deps, provider, (address) => {\n imapUpdated = true;\n imapAddress = address;\n update();\n });\n form.scrollIntoView({ block: "nearest", behavior: matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth" });\n };\n qq.querySelector(".connection-action").onclick = () => openImap("qq");\n netease.querySelector(".connection-action").onclick = () => openImap("163");\n const other = h("button", { class: "mail-other-link", type: "button", onclick: () => openImap("other") }, "\\u5176\\u4ED6\\u90AE\\u7BB1\\u6216\\u5DF2\\u6709\\u5E94\\u7528\\u5BC6\\u7801\\u8FDE\\u63A5");\n const wrap = h("div", { class: "page mail-page" }, h("div", { class: "mail-heading" }, h("h2", {}, "\\u90AE\\u4EF6\\u8FDE\\u63A5"), count), h("p", { class: "page-sub" }, "\\u9009\\u62E9\\u4F60\\u7684\\u90AE\\u7BB1\\uFF0C\\u8BA9\\u4F19\\u4F34\\u5E2E\\u4F60\\u67E5\\u770B\\u548C\\u6574\\u7406\\u90AE\\u4EF6\\u3002"), list, other, form);\n body.replaceChildren(wrap);\n const gmailCleanup = mountGmailConnection(gmail, marker.stateDir, deps, (connected) => {\n gmailConnected = connected;\n update();\n });\n void deps.configGet(marker.configPath).then((r) => {\n if (alive && !imapUpdated && r.ok) {\n const address = pickPath(r.values, "tools.email.address");\n imapAddress = typeof address === "string" ? address : "";\n update();\n }\n }).catch(() => {\n });\n return () => {\n alive = false;\n gmailCleanup();\n imapCleanup?.();\n };\n }\n function mountImapEmail(body, marker, deps, provider, onSaved) {\n let alive = true;\n const wrap = h(\n "div",\n { class: "imap-setup" },\n h("div", { class: "cfg-loading" }, "\\u6B63\\u5728\\u8BFB\\u53D6\\u914D\\u7F6E\\u2026")\n );\n body.replaceChildren(wrap);\n void (async () => {\n const [schemaR, getR] = await Promise.all([\n deps.configSchema(marker.stateDir),\n deps.configGet(marker.configPath)\n ]);\n if (!alive) return;\n if (!schemaR.ok || !getR.ok) {\n wrap.replaceChildren(h("p", { class: "inline-error" }, "\\u6682\\u65F6\\u65E0\\u6CD5\\u8BFB\\u53D6\\u90AE\\u7BB1\\u914D\\u7F6E\\uFF0C\\u8BF7\\u7A0D\\u540E\\u91CD\\u65B0\\u9009\\u62E9\\u3002"));\n return;\n }\n const emailField = schemaR?.fields?.find((f) => f.path === "tools.email");\n const cur = pickPath(getR.values, "tools.email") ?? {};\n const internal = schemaR?.internalMode === true;\n const str = (k) => typeof cur[k] === "string" ? String(cur[k]) : "";\n const configured = Boolean(str("address"));\n const status = h("div", { class: "inline-warn", hidden: true });\n const detail = h("div", { class: "cfg-detail" });\n const save = h("button", { class: "btn btn-primary", type: "button" }, "\\u4FDD\\u5B58");\n const setStatus = (m, k) => {\n status.hidden = false;\n status.textContent = m;\n status.style.color = k === "err" ? "var(--red)" : k === "ok" ? "var(--green)" : "";\n };\n const address = h("input", {\n type: "text",\n id: "email-address",\n value: str("address"),\n placeholder: "\\u5B8C\\u6574\\u90AE\\u7BB1\\u5730\\u5740\\uFF0C\\u5982 xxx@qq.com\\uFF08\\u4E0D\\u80FD\\u586B QQ \\u53F7\\uFF09"\n });\n const passNow = cur.pass;\n const passMasked = passNow === null || passNow === void 0 ? configured ? "masked" : "empty" : "plain";\n const pass = h("input", {\n type: "password",\n id: "email-pass",\n value: "",\n autocomplete: "new-password",\n placeholder: passMasked === "masked" ? "\\uFF08config \\u91CC\\u5B58\\u4E86\\u660E\\u6587\\u3001\\u88AB\\u5F15\\u64CE\\u906E\\u4F4F\\u4E86 \\u2014\\u2014 \\u7559\\u7A7A\\u4FDD\\u5B58\\u4F1A\\u628A\\u5B83\\u6E05\\u6389\\uFF0C\\u91CD\\u586B\\u4E00\\u6B21\\u4F1A\\u539F\\u6837\\u5199\\u56DE\\uFF09" : passMasked === "plain" ? `\\u7559\\u7A7A\\u4E0D\\u6539\\uFF08\\u5F53\\u524D\\u5DF2\\u4FDD\\u5B58\\uFF09` : "\\u90AE\\u7BB1\\u6388\\u6743\\u7801\\uFF08\\u4E0D\\u662F\\u767B\\u5F55\\u5BC6\\u7801\\uFF09"\n });\n const smtpPass = internal ? h("input", {\n type: "password",\n id: "email-smtp-pass",\n value: "",\n autocomplete: "new-password",\n placeholder: "\\u7559\\u7A7A = \\u4E0E\\u4E0A\\u9762\\u540C\\u4E00\\u4E2A\\u6388\\u6743\\u7801\\uFF08163 \\u53EF\\u4E3A SMTP \\u5355\\u72EC\\u8BBE\\u4E00\\u4E2A\\uFF09"\n }) : null;\n const policyChoices = emailField?.knownValues?.sendPolicy ?? [];\n const curPolicy = str("sendPolicy") || "tiered";\n let policy;\n if (policyChoices.length > 0) {\n const opts = [...policyChoices];\n if (!opts.includes(curPolicy)) opts.unshift(curPolicy);\n policy = h(\n "select",\n { id: "email-policy" },\n ...opts.map((o) => h("option", { value: o, selected: o === curPolicy }, POLICY_TEXT[o] ?? o))\n );\n } else {\n policy = h("input", { type: "text", id: "email-policy", value: curPolicy });\n }\n const imapHost = internal ? h("input", { type: "text", id: "email-imap-host", value: str("imap") ? String(cur.imap?.host ?? "") : "", placeholder: "\\u7559\\u7A7A = \\u6309\\u90AE\\u7BB1\\u57DF\\u540D\\u81EA\\u52A8\\u8BC6\\u522B" }) : null;\n const smtpHost = internal ? h("input", { type: "text", id: "email-smtp-host", value: str("smtp") ? String(cur.smtp?.host ?? "") : "", placeholder: "\\u7559\\u7A7A = \\u6309\\u90AE\\u7BB1\\u57DF\\u540D\\u81EA\\u52A8\\u8BC6\\u522B" }) : null;\n const dailyLimit = internal ? h("input", { type: "text", id: "email-daily-limit", value: String(cur.dailySendLimit ?? 20), placeholder: "20" }) : null;\n const fieldRow = (label, input, hint = null) => h(\n "div",\n { class: "cf-field" },\n h("label", {}, label),\n typeof hint === "string" ? hint ? h("p", { class: "cf-hint" }, hint) : null : hint,\n input\n );\n const form = () => ({\n address: address.value.trim(),\n pass: pass.value,\n ...smtpPass ? { smtpPass: smtpPass.value } : {},\n sendPolicy: policy.value,\n ...imapHost ? { imapHost: imapHost.value.trim() } : {},\n ...smtpHost ? { smtpHost: smtpHost.value.trim() } : {},\n ...dailyLimit ? { dailySendLimit: Number(dailyLimit.value) || 20 } : {}\n });\n const snap = () => JSON.stringify(form());\n let baseline = snap();\n const refreshSave = () => {\n save.disabled = snap() === baseline;\n };\n for (const el of [address, pass, policy, ...smtpPass ? [smtpPass] : [], ...imapHost ? [imapHost] : [], ...smtpHost ? [smtpHost] : [], ...dailyLimit ? [dailyLimit] : []]) {\n el.addEventListener("input", refreshSave);\n el.addEventListener("change", refreshSave);\n }\n const mergeValue = () => {\n const f = form();\n const out = { ...cur };\n out.address = f.address;\n out.sendPolicy = f.sendPolicy;\n if (typeof f.pass === "string" && f.pass !== "") out.pass = f.pass;\n else delete out.pass;\n if (typeof f.smtpPass === "string" && f.smtpPass !== "") out.smtpPass = f.smtpPass;\n else if ("smtpPass" in out && f.smtpPass === "") delete out.smtpPass;\n if (f.imapHost !== void 0) {\n out.imap = { ...cur.imap ?? {}, ...f.imapHost ? { host: f.imapHost } : { host: void 0 } };\n }\n if (f.smtpHost !== void 0) {\n out.smtp = { ...cur.smtp ?? {}, ...f.smtpHost ? { host: f.smtpHost } : { host: void 0 } };\n }\n if (f.dailySendLimit !== void 0) out.dailySendLimit = f.dailySendLimit;\n const passDropped = passMasked === "masked" && (typeof f.pass !== "string" || f.pass === "");\n return { value: out, passDropped };\n };\n const renderDetail = (r) => {\n detail.replaceChildren(...setDetailBlocks(r, {}));\n };\n save.addEventListener("click", () => {\n void (async () => {\n const addr = address.value.trim();\n if (!addr) {\n setStatus("\\u5148\\u586B\\u90AE\\u7BB1\\u5730\\u5740\\uFF08\\u5B8C\\u6574\\u5730\\u5740\\uFF0Cxxx@qq.com\\uFF0C\\u4E0D\\u80FD\\u586B QQ \\u53F7\\uFF09\\u3002", "err");\n return;\n }\n if (!addr.includes("@")) {\n setStatus("\\u90AE\\u7BB1\\u5730\\u5740\\u8981\\u5E26 @\\uFF08xxx@qq.com \\u8FD9\\u79CD\\u5B8C\\u6574\\u5730\\u5740\\uFF09\\u3002", "err");\n return;\n }\n if (passMasked === "empty" && pass.value === "") {\n setStatus("\\u8FD8\\u5DEE\\u6388\\u6743\\u7801\\uFF1A\\u8FD9\\u4E0D\\u662F\\u767B\\u5F55\\u5BC6\\u7801 \\u2014\\u2014 QQ \\u90AE\\u7BB1\\u5728\\u7F51\\u9875\\u7248 \\u8BBE\\u7F6E \\u2192 \\u8D26\\u6237 \\u91CC\\u751F\\u6210\\u3002\\u4E0D\\u77E5\\u9053\\u600E\\u4E48\\u62FF\\uFF0C\\u76F4\\u63A5\\u5728\\u804A\\u5929\\u91CC\\u95EE\\u4F60\\u7684\\u52A9\\u624B\\u3002", "err");\n return;\n }\n save.disabled = true;\n detail.replaceChildren();\n const merged = mergeValue();\n if (merged.passDropped && !window.confirm(\n "\\u6388\\u6743\\u7801\\u5728 config \\u91CC\\u5B58\\u7684\\u662F\\u660E\\u6587\\uFF0C\\u6258\\u76D8\\u8BFB\\u4E0D\\u56DE\\u6765\\uFF08\\u88AB\\u5F15\\u64CE\\u906E\\u4F4F\\u4E86\\uFF09\\u3002\\n\\u7EE7\\u7EED\\u4FDD\\u5B58\\u4F1A\\u628A\\u5B83\\u4ECE config \\u91CC\\u53BB\\u6389\\uFF08\\u52A9\\u624B\\u5C31\\u8FDE\\u4E0D\\u4E0A\\u90AE\\u7BB1\\u4E86\\uFF09\\u3002\\n\\n\\u60F3\\u7559\\u7740\\u5C31\\u5728\\u4E0A\\u9762\\u91CD\\u586B\\u4E00\\u6B21\\u518D\\u4FDD\\u5B58\\u3002\\u4ECD\\u7136\\u7EE7\\u7EED\\uFF1F"\n )) {\n refreshSave();\n setStatus("\\u6CA1\\u6709\\u63D0\\u4EA4\\uFF1A\\u7559\\u7740\\u7684\\u8BDD\\u5728\\u4E0A\\u9762\\u91CD\\u586B\\u4E00\\u6B21\\u6388\\u6743\\u7801\\u518D\\u4FDD\\u5B58\\u3002", "info");\n return;\n }\n const r = await deps.configSet(marker.configPath, { "tools.email": merged.value });\n renderDetail(r);\n if (!r.ok) {\n refreshSave();\n setStatus(`\\u4FDD\\u5B58\\u5931\\u8D25\\uFF1A${r.error ?? ""} ${r.errors.map((e) => e.error).join("\\uFF1B")}`, "err");\n return;\n }\n baseline = snap();\n refreshSave();\n onSaved(address.value.trim());\n setStatus(`\\u5DF2\\u4FDD\\u5B58\\uFF1A${r.changed.join("\\u3001") || "\\uFF08\\u65E0\\u53D8\\u5316\\uFF09"}\\u3002\\u52A9\\u624B\\u90A3\\u8FB9\\u7ACB\\u5373\\u751F\\u6548\\uFF08\\u4E0B\\u6B21\\u5BF9\\u8BDD\\u5C31\\u80FD\\u7528\\uFF09\\u3002`, "ok");\n })();\n });\n const PROVIDER_STEPS = [\n { key: "qq", label: "QQ \\u90AE\\u7BB1", domains: ["qq.com", "foxmail.com"], paras: [\n "\\u6253\\u5F00 mail.qq.com \\u2192 \\u53F3\\u4E0A\\u89D2\\u5934\\u50CF \\u2192 \\u8D26\\u53F7\\u4E0E\\u5B89\\u5168 \\u2192 \\u5DE6\\u4FA7\\u300C\\u5B89\\u5168\\u8BBE\\u7F6E\\u300D\\u2192 \\u7FFB\\u5230\\u9875\\u9762\\u6700\\u5E95\\u90E8\\uFF0C\\u627E\\u300CPOP3/IMAP/SMTP \\u670D\\u52A1\\u300D\\u2014\\u2014\\u591A\\u534A\\u5DF2\\u7ECF\\u5F00\\u7740\\uFF0C\\u76F4\\u63A5\\u70B9\\u300C\\u751F\\u6210\\u6388\\u6743\\u7801\\u300D\\u3002",\n "\\u9A8C\\u8BC1\\u90A3\\u6B65\\u662F\\u7528\\u7ED1\\u5B9A\\u624B\\u673A\\u53D1\\u4E00\\u6761\\u77ED\\u4FE1\\uFF08\\u5FAE\\u4FE1\\u626B\\u9875\\u9762\\u4E0A\\u7684\\u4E8C\\u7EF4\\u7801\\u5C31\\u80FD\\u4EE3\\u53D1\\uFF0C\\u4E0D\\u7528\\u78B0\\u624B\\u673A\\uFF09\\uFF0C\\u53D1\\u5B8C\\u70B9\\u300C\\u6211\\u5DF2\\u53D1\\u9001\\u300D\\uFF0C\\u6388\\u6743\\u7801\\u4F1A\\u76F4\\u63A5\\u5F39\\u5728\\u7F51\\u9875\\u4E0A\\uFF08\\u77ED\\u4FE1\\u91CC\\u6CA1\\u6709\\u7801\\uFF09\\uFF0C\\u590D\\u5236\\u5B83\\u3002"\n ] },\n { key: "163", label: "163 / 126 / 188 \\u90AE\\u7BB1", domains: ["163.com", "126.com", "188.com"], paras: [\n "\\u6253\\u5F00 mail.163.com \\u2192 \\u767B\\u5F55 \\u2192 \\u9876\\u90E8\\u300C\\u8BBE\\u7F6E\\u300D\\u2192\\u300CPOP3/SMTP/IMAP\\u300D\\u2192 \\u5F00\\u542F IMAP/SMTP \\u670D\\u52A1\\uFF08\\u4E2D\\u9014\\u6709\\u5B89\\u5168\\u63D0\\u793A\\uFF0C\\u70B9\\u7EE7\\u7EED\\u5F00\\u542F\\uFF09\\u2192 \\u6309\\u63D0\\u793A\\u5B8C\\u6210\\u9A8C\\u8BC1\\uFF0C\\u9875\\u9762\\u4F1A\\u7ED9\\u51FA 16 \\u4F4D\\u6388\\u6743\\u5BC6\\u7801\\u3002",\n "\\u6CE8\\u610F\\u5927\\u5C0F\\u5199\\u6DF7\\u5408\\uFF08\\u548C QQ \\u7684\\u7EAF\\u5C0F\\u5199\\u4E0D\\u540C\\uFF09\\uFF0C\\u590D\\u5236\\u65F6\\u522B\\u6539\\u52A8\\u3002\\u8FC7\\u7A0B\\u4E2D\\u7F51\\u6613\\u53EF\\u80FD\\u7ED9\\u7ED1\\u5B9A\\u624B\\u673A\\u53D1\\u300C\\u65B0\\u8BBE\\u5907\\u767B\\u5F55\\u63D0\\u9192\\u300D\\u2014\\u2014\\u6B63\\u5E38\\u73B0\\u8C61\\uFF0C\\u4E0D\\u7528\\u7406\\u4F1A\\u3002"\n ] },\n { key: "gmail", label: "Gmail", domains: ["gmail.com", "googlemail.com"], paras: [\n "\\u524D\\u63D0\\uFF1A\\u8FD9\\u53F0\\u7535\\u8111\\u80FD\\u6B63\\u5E38\\u8BBF\\u95EE Google\\uFF08\\u8FDE\\u4E0D\\u4E0A\\u7684\\u8BDD\\u914D\\u4E86\\u4E5F\\u7528\\u4E0D\\u4E86\\uFF0C\\u5148\\u89E3\\u51B3\\u7F51\\u7EDC\\uFF09\\uFF1BGoogle \\u8D26\\u53F7\\u9700\\u5DF2\\u5F00\\u542F\\u4E24\\u6B65\\u9A8C\\u8BC1\\u3002",\n "\\u6253\\u5F00 myaccount.google.com/apppasswords \\u2192 \\u751F\\u6210\\u5E94\\u7528\\u5BC6\\u7801\\uFF0816 \\u4F4D\\uFF09\\uFF0C\\u590D\\u5236\\u5B83\\u3002"\n ] }\n ];\n const providerSel = h(\n "select",\n {},\n ...PROVIDER_STEPS.map((p) => h("option", { value: p.key }, p.label))\n );\n const pickByAddress = () => {\n const at = address.value.split("@")[1]?.toLowerCase() ?? "";\n const matched = PROVIDER_STEPS.find((p) => p.domains.some((d) => at === d || at.endsWith("." + d)));\n if (matched && providerSel.value !== matched.key) {\n providerSel.value = matched.key;\n }\n };\n const guideBody = h("div", {});\n const renderGuide = () => {\n const hit = PROVIDER_STEPS.find((p) => p.key === providerSel.value) ?? PROVIDER_STEPS[0];\n guideBody.replaceChildren(...hit.paras.map((t) => h("p", { class: "cf-hint" }, t)));\n };\n pickByAddress();\n if (provider !== "other") providerSel.value = provider;\n renderGuide();\n providerSel.addEventListener("change", renderGuide);\n address.addEventListener("input", () => {\n pickByAddress();\n renderGuide();\n });\n const guide = configured ? null : h(\n "section",\n { class: "settings-group imap-guide" },\n h("h3", {}, "\\u600E\\u4E48\\u62FF\\u5230\\u6388\\u6743\\u7801"),\n ...provider === "other" ? [fieldRow("\\u4F60\\u7684\\u90AE\\u7BB1\\u662F", providerSel)] : [],\n guideBody,\n h(\n "p",\n { class: "cf-hint" },\n "\\u5361\\u5728\\u54EA\\u4E00\\u6B65\\uFF0C\\u76F4\\u63A5\\u622A\\u56FE\\u95EE\\u4F60\\u7684\\u52A9\\u624B\\uFF08\\u53D1\\u4E4B\\u524D\\u628A\\u6388\\u6743\\u7801\\u533A\\u57DF\\u906E\\u4E00\\u4E0B\\uFF09\\u3002"\n ),\n h(\n "p",\n { class: "cf-hint" },\n "\\u62FF\\u5230\\u540E\\uFF1A\\u628A\\u5B8C\\u6574\\u90AE\\u7BB1\\u5730\\u5740\\u548C\\u6388\\u6743\\u7801\\u586B\\u5728\\u4E0B\\u9762\\uFF0C\\u70B9\\u4FDD\\u5B58\\u3002\\u4FDD\\u5B58\\u540E\\u5728\\u804A\\u5929\\u91CC\\u8BF4\\u4E00\\u58F0\\u300C\\u90AE\\u7BB1\\u914D\\u597D\\u4E86\\u300D\\uFF0C\\u52A9\\u624B\\u4F1A\\u81EA\\u5DF1\\u9A8C\\u8BC1\\u8FDE\\u901A\\u3002"\n )\n );\n wrap.replaceChildren(\n ...guide ? [guide] : [],\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, configured ? `\\u5DF2\\u6258\\u7BA1\\uFF1A${str("address")}` : "\\u90AE\\u7BB1\\u8D26\\u53F7"),\n fieldRow("\\u90AE\\u7BB1\\u5730\\u5740", address),\n fieldRow(\n "\\u6388\\u6743\\u7801",\n pass,\n h("p", { class: "cf-hint" }, "\\u4E0D\\u662F\\u767B\\u5F55\\u5BC6\\u7801\\u3002QQ\\uFF1A\\u5934\\u50CF \\u2192 \\u8D26\\u53F7\\u4E0E\\u5B89\\u5168 \\u2192 \\u5B89\\u5168\\u8BBE\\u7F6E\\uFF1B163\\uFF1A\\u8BBE\\u7F6E \\u2192 POP3/SMTP/IMAP\\u3002")\n ),\n smtpPass ? fieldRow("SMTP \\u6388\\u6743\\u7801\\uFF08\\u53EF\\u9009\\uFF09", smtpPass) : null,\n fieldRow(\n "\\u53D1\\u4FE1\\u786E\\u8BA4",\n policy,\n h("p", { class: "cf-hint" }, "\\u5206\\u7EA7\\uFF08\\u63A8\\u8350\\uFF09\\uFF1A\\u5DF2\\u786E\\u8BA4\\u7684\\u8054\\u7CFB\\u4EBA\\u76F4\\u63A5\\u53D1\\u3001\\u964C\\u751F\\u7684\\u5148\\u8FC7\\u76EE\\uFF1B\\u5168\\u90E8\\u786E\\u8BA4\\uFF1A\\u6BCF\\u5C01\\u90FD\\u8FC7\\u76EE\\uFF1B\\u5168\\u90E8\\u76F4\\u53D1\\uFF1A\\u4E0D\\u95EE\\uFF08\\u7559\\u53D1\\u9001\\u8BB0\\u5F55\\uFF09\\u3002")\n ),\n ...internal ? [\n h("p", { class: "cf-hint" }, "\\u4E0B\\u9762\\u4E09\\u683C\\u662F\\u5185\\u90E8\\u6A21\\u5F0F\\u624D\\u663E\\u793A\\u7684\\uFF1A\\u4F01\\u4E1A\\u81EA\\u5EFA\\u90AE\\u7BB1\\u7684\\u670D\\u52A1\\u5668\\u5730\\u5740\\u8986\\u76D6\\u3001\\u5355\\u65E5\\u53D1\\u4FE1\\u4E0A\\u9650\\u3002"),\n imapHost ? fieldRow("IMAP \\u670D\\u52A1\\u5668", imapHost) : null,\n smtpHost ? fieldRow("SMTP \\u670D\\u52A1\\u5668", smtpHost) : null,\n dailyLimit ? fieldRow("\\u5355\\u65E5\\u53D1\\u4FE1\\u4E0A\\u9650", dailyLimit) : null\n ] : [],\n h("div", { class: "cfg-savebar" }, h("div", { class: "btn-row" }, save), status, detail)\n )\n );\n refreshSave();\n })().catch(() => {\n if (alive) wrap.replaceChildren(h("p", { class: "inline-error" }, "\\u6682\\u65F6\\u65E0\\u6CD5\\u8BFB\\u53D6\\u90AE\\u7BB1\\u914D\\u7F6E\\uFF0C\\u8BF7\\u7A0D\\u540E\\u91CD\\u65B0\\u9009\\u62E9\\u3002"));\n });\n return () => {\n alive = false;\n };\n }\n var POLICY_TEXT = {\n tiered: "\\u5206\\u7EA7\\uFF08\\u63A8\\u8350\\uFF1A\\u719F\\u5BA2\\u76F4\\u53D1\\u3001\\u964C\\u751F\\u5148\\u8FC7\\u76EE\\uFF09",\n "confirm-all": "\\u5168\\u90E8\\u786E\\u8BA4\\uFF08\\u6BCF\\u5C01\\u90FD\\u5148\\u8FC7\\u76EE\\uFF09",\n auto: "\\u5168\\u90E8\\u76F4\\u53D1\\uFF08\\u4E0D\\u95EE\\uFF0C\\u7559\\u53D1\\u9001\\u8BB0\\u5F55\\uFF09"\n };\n\n // web-console/desktop/src/renderer/shared/connector-catalog.ts\n var connectorCatalog = [\n { id: "gmail", name: "Gmail", mark: "M", category: "\\u5DE5\\u4F5C\\u4E0E\\u6C9F\\u901A", purpose: "\\u91CD\\u8981\\u7684\\u90AE\\u4EF6\\uFF0C\\u548C\\u8FD8\\u6CA1\\u6765\\u5F97\\u53CA\\u56DE\\u7684\\u8BDD\\u3002", first: "\\u4E00\\u8D77\\u6311\\u51FA\\u8981\\u56DE\\u590D\\u7684\\u90AE\\u4EF6\\uFF0C\\u5148\\u628A\\u56DE\\u4FE1\\u60F3\\u597D\\u3002", access: "\\u767B\\u5F55 Google\\uFF0C\\u9009\\u62E9\\u5141\\u8BB8\\u8BFB\\u53D6\\u7684\\u90AE\\u4EF6\\u8303\\u56F4\\u3002", action: "\\u53D1\\u9001\\u3001\\u5220\\u9664\\u548C\\u9000\\u8BA2\\u65F6\\uFF0C\\u518D\\u5355\\u72EC\\u786E\\u8BA4\\u3002", sources: [\n { id: "inbox", label: "\\u6536\\u4EF6\\u7BB1 \\xB7 \\u6700\\u8FD1 7 \\u5929", sample: "\\u6709\\u4E00\\u5C01\\u5173\\u4E8E\\u5468\\u4E94\\u5206\\u4EAB\\u7684\\u9080\\u8BF7\\uFF0C\\u8FD8\\u6CA1\\u6709\\u56DE\\u590D\\u3002" },\n { id: "starred", label: "\\u5DF2\\u52A0\\u661F\\u6807\\u7684\\u90AE\\u4EF6", sample: "\\u7559\\u7740\\u4E24\\u5C01\\u8D44\\u6599\\u90AE\\u4EF6\\uFF0C\\u53EF\\u4EE5\\u6574\\u7406\\u8FDB\\u5206\\u4EAB\\u51C6\\u5907\\u3002" }\n ] },\n { id: "calendar", name: "\\u65E5\\u5386", mark: "31", category: "\\u6BCF\\u5929\\u7684\\u5B89\\u6392", purpose: "\\u77E5\\u9053\\u4F60\\u4EC0\\u4E48\\u65F6\\u5019\\u5FD9\\uFF0C\\u4E5F\\u7559\\u4E00\\u70B9\\u7A7A\\u767D\\u3002", first: "\\u770B\\u4E00\\u773C\\u63A5\\u4E0B\\u6765\\u7684\\u5B89\\u6392\\uFF0C\\u4E00\\u8D77\\u7559\\u51FA\\u4F11\\u606F\\u65F6\\u95F4\\u3002", access: "\\u9009\\u62E9 Google \\u65E5\\u5386\\uFF1B\\u8BBE\\u5907\\u65E5\\u5386\\u7531\\u624B\\u673A\\u5355\\u72EC\\u6388\\u6743\\u3002", action: "\\u65B0\\u5EFA\\u3001\\u4FEE\\u6539\\u6216\\u53D6\\u6D88\\u65E5\\u7A0B\\u65F6\\uFF0C\\u518D\\u95EE\\u4F60\\u3002", sources: [\n { id: "work", label: "\\u5DE5\\u4F5C\\u65E5\\u5386 \\xB7 \\u672A\\u6765 7 \\u5929", sample: "\\u5468\\u4E94\\u4E0B\\u5348\\u6709\\u4E00\\u573A\\u5206\\u4EAB\\u8BC4\\u5BA1\\uFF0C\\u53EF\\u4EE5\\u63D0\\u524D\\u7559\\u51FA\\u51C6\\u5907\\u65F6\\u95F4\\u3002" },\n { id: "personal", label: "\\u4E2A\\u4EBA\\u65E5\\u5386 \\xB7 \\u672A\\u6765 7 \\u5929", sample: "\\u5468\\u516D\\u508D\\u665A\\u7559\\u4E86\\u6563\\u6B65\\u65F6\\u95F4\\uFF0C\\u53EF\\u4EE5\\u53BB\\u6C5F\\u8FB9\\u8D70\\u8D70\\u3002" }\n ] },\n { id: "github", name: "GitHub", mark: "{ }", category: "\\u4E00\\u8D77\\u505A\\u9879\\u76EE", purpose: "\\u63A5\\u4E0A\\u4F60\\u6B63\\u5728\\u5199\\u7684\\u4EE3\\u7801\\u548C\\u6CA1\\u505A\\u5B8C\\u7684\\u4E8B\\u3002", first: "\\u4ECE\\u4E00\\u4E2A\\u4ED3\\u5E93\\u5F00\\u59CB\\uFF0C\\u63A5\\u7740\\u770B\\u672A\\u5B8C\\u6210\\u7684 Issue \\u548C PR\\u3002", access: "\\u767B\\u5F55 GitHub\\uFF0C\\u53EA\\u9009\\u62E9\\u60F3\\u4E00\\u8D77\\u770B\\u7684\\u4ED3\\u5E93\\u3002", action: "\\u63D0\\u4EA4\\u4EE3\\u7801\\u3001\\u8BC4\\u8BBA\\u548C\\u5408\\u5E76\\u8BF7\\u6C42\\u65F6\\uFF0C\\u518D\\u786E\\u8BA4\\u3002", sources: [\n { id: "app", label: "weekend-studio / app", sample: "\\u5BFC\\u822A\\u6539\\u7248\\u6709\\u4E00\\u4E2A\\u5F85\\u8BC4\\u5BA1 PR\\uFF0C\\u7A84\\u5C4F\\u9002\\u914D\\u8FD8\\u6CA1\\u9A8C\\u6536\\u3002" },\n { id: "docs", label: "weekend-studio / notes", sample: "\\u9879\\u76EE\\u8BF4\\u660E\\u6709\\u4E00\\u9879\\u5F85\\u8865\\u5145\\uFF1A\\u65B0\\u7528\\u6237\\u5982\\u4F55\\u5F00\\u59CB\\u3002" }\n ] },\n { method: "device", id: "health", name: "\\u5065\\u5EB7", mark: "\\u2661", category: "\\u751F\\u6D3B\\u7684\\u8282\\u594F", purpose: "\\u4ECE\\u7761\\u7720\\u548C\\u6D3B\\u52A8\\uFF0C\\u6162\\u6162\\u4E86\\u89E3\\u4F60\\u7684\\u65E5\\u5E38\\u3002", first: "\\u4E00\\u8D77\\u56DE\\u987E\\u6700\\u8FD1\\u7684\\u4F5C\\u606F\\uFF0C\\u804A\\u804A\\u600E\\u4E48\\u8FC7\\u5F97\\u8212\\u670D\\u4E00\\u70B9\\u3002", access: "\\u5728\\u624B\\u673A\\u4E0A\\u8FDE\\u63A5 Apple \\u5065\\u5EB7\\u6216 Health Connect\\uFF0C\\u9010\\u9879\\u9009\\u62E9\\u6570\\u636E\\u3002", action: "\\u4EC5\\u67E5\\u770B\\u4F60\\u9009\\u7684\\u8D8B\\u52BF\\uFF1B\\u4E0D\\u636E\\u6B64\\u505A\\u8BCA\\u65AD\\u6216\\u7528\\u836F\\u5EFA\\u8BAE\\u3002", sources: [\n { id: "sleep", label: "\\u7761\\u7720\\u65F6\\u957F \\xB7 \\u6700\\u8FD1 7 \\u5929", sample: "\\u793A\\u4F8B\\u91CC\\u6709\\u4E24\\u665A\\u7761\\u5F97\\u6BD4\\u8F83\\u665A\\uFF0C\\u53EF\\u4EE5\\u804A\\u804A\\u6700\\u8FD1\\u5FD9\\u4E9B\\u4EC0\\u4E48\\u3002" },\n { id: "steps", label: "\\u6BCF\\u65E5\\u6B65\\u6570 \\xB7 \\u6700\\u8FD1 7 \\u5929", sample: "\\u5468\\u672B\\u8D70\\u8DEF\\u6BD4\\u5DE5\\u4F5C\\u65E5\\u591A\\uFF0C\\u508D\\u665A\\u6563\\u6B65\\u4E5F\\u8BB8\\u662F\\u4E2A\\u597D\\u4E60\\u60EF\\u3002" }\n ] },\n { method: "import", id: "notes", name: "\\u5907\\u5FD8\\u5F55", mark: "\\u2261", category: "\\u968F\\u624B\\u8BB0\\u4E0B\\u7684\\u4F60", purpose: "\\u60E6\\u8BB0\\u7684\\u5730\\u65B9\\u3001\\u5192\\u51FA\\u7684\\u5FF5\\u5934\\uFF0C\\u90FD\\u63A5\\u5F97\\u4E0A\\u3002", first: "\\u4ECE\\u51E0\\u5219\\u4F60\\u9009\\u7684\\u7B14\\u8BB0\\uFF0C\\u6574\\u7406\\u51FA\\u60F3\\u7EE7\\u7EED\\u804A\\u7684\\u4E8B\\u3002", access: "\\u4ECE Apple \\u5907\\u5FD8\\u5F55\\u3001Keep \\u6216\\u672C\\u5730\\u7B14\\u8BB0\\u5206\\u4EAB\\uFF0F\\u5BFC\\u5165\\u6240\\u9009\\u5185\\u5BB9\\u3002", action: "\\u539F\\u7B14\\u8BB0\\u4FDD\\u6301\\u539F\\u6837\\uFF1B\\u65B0\\u5185\\u5BB9\\u5148\\u653E\\u5728\\u8349\\u7A3F\\u91CC\\u7ED9\\u4F60\\u770B\\u3002", sources: [\n { id: "ideas", label: "\\u5206\\u4EAB\\u7ED9\\u5979\\u7684\\u7075\\u611F\\u7B14\\u8BB0 \\xB7 2 \\u5219", sample: "\\u60F3\\u5728\\u5F00\\u573A\\u8BB2\\u4E00\\u4E2A\\u5C0F\\u6545\\u4E8B\\uFF0C\\u8FD8\\u6709\\u4E00\\u6B21\\u6CA1\\u6392\\u671F\\u7684\\u6D77\\u8FB9\\u65C5\\u884C\\u3002" },\n { id: "reading", label: "\\u9009\\u4E2D\\u7684\\u9605\\u8BFB\\u7B14\\u8BB0 \\xB7 1 \\u5219", sample: "\\u8BFB\\u5230\\u4E00\\u53E5\\u5173\\u4E8E\\u7559\\u767D\\u7684\\u8BDD\\uFF0C\\u60F3\\u653E\\u8FDB\\u4E0B\\u6B21\\u5206\\u4EAB\\u3002" }\n ] },\n { id: "reminders", name: "\\u63D0\\u9192\\u4E8B\\u9879", mark: "\\u2713", category: "\\u6BCF\\u5929\\u7684\\u5B89\\u6392", method: "device", purpose: "\\u7B54\\u5E94\\u81EA\\u5DF1\\u7684\\u5C0F\\u4E8B\\uFF0C\\u4E5F\\u6709\\u4EBA\\u4E00\\u8D77\\u60E6\\u8BB0\\u3002", first: "\\u4ECE\\u4F60\\u9009\\u7684\\u6E05\\u5355\\u91CC\\uFF0C\\u6311\\u51FA\\u4ECA\\u5929\\u6700\\u60F3\\u5B8C\\u6210\\u7684\\u4E00\\u4EF6\\u4E8B\\u3002", access: "\\u5728\\u624B\\u673A\\u4E0A\\u9009\\u62E9\\u63D0\\u9192\\u4E8B\\u9879\\u6E05\\u5355\\uFF0C\\u9010\\u9879\\u6388\\u6743\\u3002", action: "\\u65B0\\u5EFA\\u6216\\u5B8C\\u6210\\u63D0\\u9192\\u65F6\\uFF0C\\u518D\\u7531\\u4F60\\u786E\\u8BA4\\u3002", sources: [{ id: "today", label: "\\u4ECA\\u5929\\u6E05\\u5355", sample: "\\u8FD8\\u6709\\u4E00\\u4EF6\\u5C0F\\u4E8B\\uFF1A\\u4E0B\\u73ED\\u8DEF\\u4E0A\\u5E26\\u4E00\\u672C\\u4E66\\u56DE\\u5BB6\\u3002" }, { id: "weekend", label: "\\u5468\\u672B\\u6E05\\u5355", sample: "\\u60F3\\u6574\\u7406\\u4E66\\u67B6\\uFF0C\\u4E5F\\u60F3\\u51FA\\u53BB\\u8D70\\u8D70\\u3002" }] },\n { id: "photos", name: "\\u7167\\u7247", mark: "\\u25A7", category: "\\u5171\\u540C\\u7684\\u7247\\u6BB5", method: "device", purpose: "\\u4E00\\u5F20\\u7167\\u7247\\uFF0C\\u5C31\\u80FD\\u63A5\\u7740\\u804A\\u90A3\\u5929\\u7684\\u6545\\u4E8B\\u3002", first: "\\u6311\\u51E0\\u5F20\\u7167\\u7247\\uFF0C\\u4E00\\u8D77\\u7559\\u4F4F\\u5F53\\u65F6\\u7684\\u611F\\u53D7\\u3002", access: "\\u4F7F\\u7528\\u7CFB\\u7EDF\\u7167\\u7247\\u9009\\u62E9\\u5668\\uFF0C\\u53EA\\u5206\\u4EAB\\u4F60\\u9009\\u4E2D\\u7684\\u7167\\u7247\\u3002", action: "\\u4E0D\\u8BFB\\u53D6\\u6574\\u672C\\u76F8\\u518C\\uFF1B\\u4FDD\\u5B58\\u6216\\u5206\\u4EAB\\u65F6\\u53E6\\u884C\\u786E\\u8BA4\\u3002", sources: [{ id: "weekend", label: "\\u9009\\u4E2D\\u7684\\u5468\\u672B\\u7167\\u7247 \\xB7 3 \\u5F20", sample: "\\u8FD9\\u51E0\\u5F20\\u6C5F\\u8FB9\\u7167\\u7247\\uFF0C\\u53EF\\u4EE5\\u6574\\u7406\\u6210\\u4E00\\u6BB5\\u5468\\u672B\\u7684\\u5C0F\\u8BB0\\u3002" }, { id: "inspiration", label: "\\u9009\\u4E2D\\u7684\\u7075\\u611F\\u56FE\\u7247 \\xB7 2 \\u5F20", sample: "\\u4E24\\u5F20\\u6E29\\u6696\\u7684\\u5BA4\\u5185\\u7167\\u7247\\uFF0C\\u53EF\\u4EE5\\u7559\\u4F5C\\u4E0B\\u6B21\\u5E03\\u7F6E\\u7684\\u53C2\\u8003\\u3002" }] },\n { id: "contacts", name: "\\u901A\\u8BAF\\u5F55", mark: "\\u25CE", category: "\\u4F60\\u5728\\u610F\\u7684\\u4EBA", method: "device", purpose: "\\u4F60\\u63D0\\u8D77\\u7684\\u4EBA\\uFF0C\\u6162\\u6162\\u6709\\u4E86\\u6765\\u5904\\u3002", first: "\\u9009\\u51E0\\u4F4D\\u5E38\\u8054\\u7CFB\\u7684\\u4EBA\\uFF0C\\u8BA9\\u79F0\\u547C\\u548C\\u5173\\u7CFB\\u66F4\\u6E05\\u695A\\u3002", access: "\\u901A\\u8FC7\\u624B\\u673A\\u7CFB\\u7EDF\\u9009\\u62E9\\u8981\\u5206\\u4EAB\\u7684\\u8054\\u7CFB\\u4EBA\\u3002", action: "\\u4E0D\\u4F1A\\u81EA\\u52A8\\u8054\\u7CFB\\u4EFB\\u4F55\\u4EBA\\uFF1B\\u53D1\\u9001\\u6D88\\u606F\\u4ECD\\u9700\\u4F60\\u786E\\u8BA4\\u3002", sources: [{ id: "selected", label: "\\u9009\\u4E2D\\u7684\\u8054\\u7CFB\\u4EBA \\xB7 2 \\u4F4D", sample: "\\u793A\\u4F8B\\u91CC\\u6709\\u4E24\\u4F4D\\u5E38\\u8054\\u7CFB\\u7684\\u4EBA\\uFF0C\\u53EF\\u4EE5\\u5148\\u8BB0\\u6E05\\u4F60\\u600E\\u4E48\\u79F0\\u547C\\u4ED6\\u4EEC\\u3002" }] },\n { id: "files", name: "\\u6587\\u4EF6", mark: "\\u25A4", category: "\\u624B\\u8FB9\\u7684\\u6750\\u6599", method: "import", purpose: "\\u624B\\u8FB9\\u7684\\u6587\\u4EF6\\uFF0C\\u968F\\u65F6\\u62FF\\u51FA\\u6765\\u4E00\\u8D77\\u770B\\u3002", first: "\\u4ECE\\u4E00\\u4EFD\\u6587\\u6863\\u5F00\\u59CB\\uFF0C\\u6574\\u7406\\u91CD\\u70B9\\u548C\\u8FD8\\u6CA1\\u89E3\\u51B3\\u7684\\u95EE\\u9898\\u3002", access: "\\u4ECE\\u624B\\u673A\\u6216\\u7535\\u8111\\u9009\\u62E9\\u6587\\u4EF6\\uFF0C\\u4E0D\\u8BFB\\u53D6\\u6574\\u4E2A\\u78C1\\u76D8\\u3002", action: "\\u539F\\u6587\\u4EF6\\u4FDD\\u7559\\uFF1B\\u4FEE\\u6539\\u540E\\u7684\\u7248\\u672C\\u5148\\u7ED9\\u4F60\\u770B\\u3002", sources: [{ id: "document", label: "\\u9009\\u4E2D\\u7684\\u6587\\u6863 \\xB7 1 \\u4EFD", sample: "\\u8FD9\\u4EFD\\u5206\\u4EAB\\u63D0\\u7EB2\\u6709\\u4E09\\u4E2A\\u91CD\\u70B9\\uFF0C\\u5F00\\u5934\\u7684\\u4F8B\\u5B50\\u8FD8\\u53EF\\u4EE5\\u518D\\u63A8\\u6572\\u3002" }] },\n { id: "qq", name: "QQ \\u90AE\\u7BB1", mark: "QQ", category: "\\u90AE\\u4EF6\\u4E0E\\u6C9F\\u901A", method: "mail", purpose: "\\u719F\\u6089\\u7684\\u90AE\\u7BB1\\uFF0C\\u4E5F\\u80FD\\u4E00\\u8D77\\u6574\\u7406\\u3002", first: "\\u5148\\u6311\\u51FA\\u9700\\u8981\\u56DE\\u590D\\u7684\\u90AE\\u4EF6\\uFF0C\\u7ED9\\u5FD9\\u788C\\u7684\\u4E00\\u5929\\u51CF\\u4E00\\u70B9\\u8D1F\\u62C5\\u3002", access: "\\u4F7F\\u7528\\u90AE\\u7BB1\\u6388\\u6743\\u7801\\u8FDE\\u63A5\\uFF1B\\u539F\\u90AE\\u7BB1\\u7BA1\\u7406\\u4F1A\\u7EE7\\u7EED\\u63D0\\u4F9B\\u3002", action: "\\u53D1\\u4FE1\\u6743\\u9650\\u6CBF\\u7528\\u90AE\\u7BB1\\u8BBE\\u7F6E\\uFF0C\\u6BCF\\u6B21\\u91CD\\u8981\\u64CD\\u4F5C\\u5148\\u786E\\u8BA4\\u3002", sources: [{ id: "inbox", label: "\\u6536\\u4EF6\\u7BB1 \\xB7 \\u6700\\u8FD1 7 \\u5929", sample: "\\u6536\\u5230\\u4E00\\u5C01\\u6D3B\\u52A8\\u786E\\u8BA4\\u90AE\\u4EF6\\uFF0C\\u53EF\\u4EE5\\u5148\\u6574\\u7406\\u65F6\\u95F4\\u548C\\u5730\\u70B9\\u3002" }] },\n { id: "netease", name: "163 \\u90AE\\u7BB1", mark: "163", category: "\\u90AE\\u4EF6\\u4E0E\\u6C9F\\u901A", method: "mail", purpose: "\\u901A\\u77E5\\u3001\\u56DE\\u4FE1\\u548C\\u6750\\u6599\\uFF0C\\u6536\\u62FE\\u5F97\\u66F4\\u6E05\\u695A\\u3002", first: "\\u628A\\u6563\\u843D\\u7684\\u90AE\\u4EF6\\u6750\\u6599\\u6574\\u7406\\u6210\\u4E00\\u4EFD\\u7B80\\u77ED\\u6E05\\u5355\\u3002", access: "\\u652F\\u6301163\\uFF0F126\\uFF0F188\\u90AE\\u7BB1\\uFF0C\\u4F7F\\u7528\\u5BA2\\u6237\\u7AEF\\u6388\\u6743\\u5BC6\\u7801\\u3002", action: "\\u53D1\\u4FE1\\u6743\\u9650\\u6CBF\\u7528\\u90AE\\u7BB1\\u8BBE\\u7F6E\\uFF0C\\u6BCF\\u6B21\\u91CD\\u8981\\u64CD\\u4F5C\\u5148\\u786E\\u8BA4\\u3002", sources: [{ id: "inbox", label: "\\u6536\\u4EF6\\u7BB1 \\xB7 \\u6700\\u8FD1 7 \\u5929", sample: "\\u4E00\\u5C01\\u8D44\\u6599\\u90AE\\u4EF6\\u91CC\\u6709\\u4E09\\u4EFD\\u9644\\u4EF6\\uFF0C\\u53EF\\u4EE5\\u5148\\u770B\\u54EA\\u4E00\\u4EFD\\u6700\\u76F8\\u5173\\u3002" }] },\n { id: "notion", name: "Notion", mark: "N", category: "\\u7B14\\u8BB0\\u4E0E\\u9879\\u76EE", purpose: "\\u5DE5\\u4F5C\\u53F0\\u91CC\\u7684\\u60F3\\u6CD5\\uFF0C\\u7EE7\\u7EED\\u5F80\\u524D\\u8D70\\u3002", first: "\\u9009\\u4E00\\u4E2A\\u9879\\u76EE\\u9875\\u9762\\uFF0C\\u63A5\\u7740\\u6574\\u7406\\u5DF2\\u7ECF\\u6709\\u7684\\u6750\\u6599\\u3002", access: "\\u767B\\u5F55 Notion\\uFF0C\\u5E76\\u9009\\u62E9\\u5141\\u8BB8\\u8BBF\\u95EE\\u7684\\u9875\\u9762\\u3002", action: "\\u4FEE\\u6539\\u9875\\u9762\\u524D\\u786E\\u8BA4\\uFF0C\\u4E0D\\u9ED8\\u8BA4\\u5206\\u4EAB\\u6574\\u4E2A\\u5DE5\\u4F5C\\u533A\\u3002", sources: [{ id: "project", label: "\\u9009\\u4E2D\\u7684\\u9879\\u76EE\\u9875\\u9762", sample: "\\u9879\\u76EE\\u7B14\\u8BB0\\u91CC\\u7684\\u76EE\\u6807\\u5DF2\\u7ECF\\u6E05\\u695A\\uFF0C\\u4E0B\\u4E00\\u6B65\\u662F\\u6574\\u7406\\u9A8C\\u6536\\u6E05\\u5355\\u3002" }] },\n { id: "drive", name: "Google \\u4E91\\u7AEF\\u786C\\u76D8", mark: "\\u25B3", category: "\\u4E91\\u7AEF\\u7684\\u6750\\u6599", purpose: "\\u4E91\\u7AEF\\u7684\\u6587\\u6863\\uFF0C\\u4E5F\\u653E\\u5230\\u540C\\u4E00\\u6BB5\\u8BA8\\u8BBA\\u91CC\\u3002", first: "\\u4ECE\\u4F60\\u9009\\u7684\\u6587\\u4EF6\\u5939\\u91CC\\uFF0C\\u627E\\u51FA\\u8FD9\\u6B21\\u8BA8\\u8BBA\\u9700\\u8981\\u7684\\u6750\\u6599\\u3002", access: "\\u767B\\u5F55 Google\\uFF0C\\u9009\\u62E9\\u8981\\u5206\\u4EAB\\u7684\\u6587\\u4EF6\\u6216\\u6587\\u4EF6\\u5939\\u3002", action: "\\u4FEE\\u6539\\u3001\\u5220\\u9664\\u548C\\u5BF9\\u5916\\u5206\\u4EAB\\u65F6\\uFF0C\\u53E6\\u884C\\u786E\\u8BA4\\u3002", sources: [{ id: "folder", label: "\\u9009\\u4E2D\\u7684\\u5206\\u4EAB\\u6750\\u6599\\u6587\\u4EF6\\u5939", sample: "\\u6587\\u4EF6\\u5939\\u91CC\\u6709\\u8BB2\\u7A3F\\u548C\\u914D\\u56FE\\uFF0C\\u9002\\u5408\\u4E00\\u8D77\\u68C0\\u67E5\\u662F\\u5426\\u5BF9\\u5E94\\u3002" }] },\n { id: "outlook", name: "Outlook", mark: "O", category: "\\u90AE\\u4EF6\\u4E0E\\u6C9F\\u901A", purpose: "\\u5DE5\\u4F5C\\u90AE\\u7BB1\\u91CC\\u7684\\u4E8B\\uFF0C\\u4E5F\\u80FD\\u63A5\\u5F97\\u4E0A\\u3002", first: "\\u770B\\u770B\\u9700\\u8981\\u56DE\\u5E94\\u7684\\u5DE5\\u4F5C\\u90AE\\u4EF6\\uFF0C\\u5148\\u6574\\u7406\\u4F18\\u5148\\u987A\\u5E8F\\u3002", access: "\\u767B\\u5F55 Microsoft\\uFF0C\\u9009\\u62E9\\u90AE\\u7BB1\\u7684\\u8BFB\\u53D6\\u6743\\u9650\\u3002", action: "\\u53D1\\u9001\\u6216\\u5220\\u9664\\u90AE\\u4EF6\\u524D\\uFF0C\\u518D\\u5355\\u72EC\\u786E\\u8BA4\\u3002", sources: [{ id: "inbox", label: "\\u6536\\u4EF6\\u7BB1 \\xB7 \\u6700\\u8FD1 7 \\u5929", sample: "\\u6536\\u5230\\u4E00\\u5C01\\u8BC4\\u5BA1\\u5B89\\u6392\\uFF0C\\u53EF\\u4EE5\\u5148\\u6838\\u5BF9\\u9700\\u8981\\u51C6\\u5907\\u7684\\u5185\\u5BB9\\u3002" }] }\n ];\n var connectorGroups = [\n { id: "daily", name: "\\u65E5\\u5E38\\u5B89\\u6392", connectors: ["calendar", "reminders", "contacts"] },\n { id: "notes", name: "\\u7B14\\u8BB0\\u4E0E\\u6587\\u4EF6", connectors: ["notes", "notion", "files", "drive"] },\n { id: "life", name: "\\u751F\\u6D3B\\u4E0E\\u5065\\u5EB7", connectors: ["photos", "health"] },\n { id: "mail", name: "\\u90AE\\u7BB1", connectors: ["gmail", "qq", "netease", "outlook"] },\n { id: "development", name: "\\u5F00\\u53D1\\u5DE5\\u5177", connectors: ["github"] }\n ];\n var order = connectorGroups.flatMap((group) => group.connectors);\n connectorCatalog.sort((a, b) => order.indexOf(a.id) - order.indexOf(b.id));\n var connectorById = (id) => connectorCatalog.find((c) => c.id === id);\n\n // web-console/desktop/src/renderer/shared/connector-view.ts\n var connectorEscape = (text) => text.replace(/[&<>"\']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", \'"\': "&quot;", "\'": "&#39;" })[c]);\n var connectorMark = (c) => `<span class="cx-mark cx-${c.id}" aria-hidden="true">${c.mark}</span>`;\n function connectorHero() {\n return `<section class="cx-hero"><div><p class="cx-eyebrow">A LITTLE MORE OF YOUR WORLD</p><h1>\\u4ECE\\u4F60\\u7684\\u65E5\\u5E38\\uFF0C<br>\\u5F00\\u59CB\\u719F\\u6089\\u5F7C\\u6B64\\u3002</h1><p>\\u5E26\\u4E0A\\u6B63\\u5728\\u505A\\u7684\\u4E8B\\u3001\\u63A5\\u4E0B\\u6765\\u7684\\u5B89\\u6392\\uFF0C<br>\\u8FD8\\u6709\\u968F\\u624B\\u8BB0\\u4E0B\\u7684\\u5FF5\\u5934\\u3002</p><small>\\u5148\\u9009\\u4E00\\u4E2A\\u5C31\\u597D\\u3002\\u4E5F\\u53EF\\u4EE5\\u4E4B\\u540E\\u518D\\u6765\\u3002</small></div><div class="cx-orbit" aria-hidden="true"><span class="cx-orbit-center"><img src="../shared/aurora-mark.svg" alt="" width="52" height="52"></span>${connectorCatalog.filter((c) => ["calendar", "notes", "health", "gmail", "github"].includes(c.id)).map(connectorMark).join("")}</div></section>`;\n }\n function connectorCard(c, state, button) {\n return `<article class="cx-card" data-connector-card="${c.id}" data-search="${c.name} ${c.category} ${c.purpose}"><div class="cx-card-head">${connectorMark(c)}<span><h3>${c.name}</h3><small>${c.category}</small></span><span class="cx-state">${connectorEscape(state)}</span></div><p>${c.purpose}</p><button type="button" class="cx-link" data-connector-open="${c.id}">${connectorEscape(button)} <span aria-hidden="true">\\u2197</span></button></article>`;\n }\n function connectorDirectory(card, include = () => true) {\n return `<div class="cx-groups">${connectorGroups.map((group) => {\n const entries = connectorCatalog.filter((c) => group.connectors.includes(c.id) && include(c));\n if (!entries.length) return "";\n return `<section class="cx-group" data-connector-group="${group.id}" data-search="${group.name}" aria-labelledby="connector-group-${group.id}"><div class="cx-group-heading"><h2 id="connector-group-${group.id}">${group.name}</h2><span><span data-connector-count>${entries.length}</span> \\u4E2A\\u8FDE\\u63A5\\u5668</span></div><div class="cx-grid">${entries.map(card).join("")}</div></section>`;\n }).join("")}</div>`;\n }\n function filterConnectorDirectory(root, search) {\n const term = search.trim().toLowerCase();\n let found = false;\n for (const group of Array.from(root.querySelectorAll("[data-connector-group]"))) {\n const rows = Array.from(group.querySelectorAll("[data-connector-card]"));\n for (const row of rows) row.hidden = !`${group.dataset.search} ${row.dataset.search}`.toLowerCase().includes(term);\n const count = rows.filter((row) => !row.hidden).length;\n group.hidden = count === 0;\n group.querySelector("[data-connector-count]").textContent = String(count);\n found ||= count > 0;\n }\n return found;\n }\n function connectorIntro(c) {\n return `<div class="cx-detail-title">${connectorMark(c)}<div><p class="cx-eyebrow">${c.category}</p><h1>${c.name}</h1></div></div><p class="cx-lead">${c.purpose}</p><div class="cx-value"><span class="cx-eyebrow">\\u7B2C\\u4E00\\u4EF6\\u53EF\\u4EE5\\u4E00\\u8D77\\u505A\\u7684\\u4E8B</span><p>${c.first}</p></div>`;\n }\n\n // web-console/desktop/src/renderer/console/pages/connectors.ts\n function mountConnectors(body, marker, deps) {\n let cleanup, alive = true;\n const root = h("div", { class: "page cx-console cx-root" });\n body.replaceChildren(root);\n const release = () => {\n cleanup?.();\n cleanup = void 0;\n };\n const catalog = () => {\n release();\n root.innerHTML = `${connectorHero()}<div class="cx-toolbar"><h2 class="cx-section-title">\\u8FDE\\u63A5\\u4F60\\u719F\\u6089\\u7684\\u5E94\\u7528</h2><label class="cx-search"><input type="search" aria-label="\\u641C\\u7D22\\u8FDE\\u63A5\\u5668" placeholder="\\u641C\\u7D22\\u8FDE\\u63A5\\u5668\\u2026"></label></div>${connectorDirectory((c) => connectorCard(c, ["gmail", "qq", "netease"].includes(c.id) ? "" : "\\u5C1A\\u672A\\u5F00\\u653E", ["gmail", "qq", "netease"].includes(c.id) ? "\\u7BA1\\u7406\\u90AE\\u7BB1\\u8FDE\\u63A5" : "\\u4E86\\u89E3\\u63A5\\u5165\\u65B9\\u5F0F"))}<p class="cx-empty" hidden>\\u6CA1\\u6709\\u627E\\u5230\\uFF0C\\u6362\\u4E2A\\u540D\\u79F0\\u8BD5\\u8BD5\\u3002</p><p class="cx-footnote">\\u8FDE\\u63A5\\u7528\\u4E8E\\u5F53\\u524D\\u6240\\u9009\\u4F19\\u4F34\\u3002\\u90AE\\u4EF6\\u8D26\\u6237\\u4E0E\\u64CD\\u4F5C\\u6743\\u9650\\uFF0C\\u5728\\u90AE\\u7BB1\\u8BE6\\u60C5\\u4E2D\\u6838\\u5BF9\\u3002</p>`;\n const search = root.querySelector("input");\n search.oninput = () => {\n root.querySelector(".cx-empty").hidden = filterConnectorDirectory(root, search.value);\n };\n };\n const openMail = (provider = "gmail") => {\n release();\n const back = h("button", { class: "cx-link cx-back", type: "button", "data-connectors-back": "", onclick: catalog }, "\\u2190 \\u6240\\u6709\\u8FDE\\u63A5\\u5668");\n const host = h("div", {});\n root.replaceChildren(back, host);\n cleanup = mountEmail(host, marker, deps);\n if (provider === "qq" || provider === "netease") host.querySelector(`[data-connection="${provider === "netease" ? "163" : "qq"}"] .connection-action`)?.click();\n };\n const click = (event) => {\n if (!alive) return;\n const button = event.target.closest("[data-connector-open]");\n const id = button?.dataset.connectorOpen;\n if (!id) return;\n if (["gmail", "qq", "netease"].includes(id)) {\n openMail(id);\n return;\n }\n const c = connectorById(id);\n if (!c) return;\n release();\n root.innerHTML = `<button type="button" class="cx-link cx-back" data-connectors-back>\\u2190 \\u6240\\u6709\\u8FDE\\u63A5\\u5668</button>${connectorIntro(c)}<div class="cx-detail-grid"><section><h2 class="cx-section-title">${c.method === "device" ? "\\u624B\\u673A\\u6388\\u6743\\uFF0C\\u4E24\\u7AEF\\u67E5\\u770B" : c.method === "import" ? "\\u4ECE\\u6240\\u9009\\u5185\\u5BB9\\u5F00\\u59CB" : "\\u9009\\u62E9\\u4F60\\u60F3\\u5206\\u4EAB\\u7684\\u8303\\u56F4"}</h2><p class="cx-muted">${c.access}</p><p class="cx-footnote">\\u4EE5\\u4E0B\\u662F\\u5206\\u4EAB\\u8303\\u56F4\\u7684\\u793A\\u4F8B\\uFF0C\\u5F00\\u653E\\u540E\\u7531\\u4F60\\u9009\\u62E9\\u3002</p><div class="cx-sources">${c.sources.map((s) => `<label>${s.label}</label>`).join("")}</div><p class="cx-muted">${c.action}</p></section><aside class="cx-first-look"><p class="cx-eyebrow">\\u63A5\\u5165\\u51C6\\u5907\\u4E2D</p><h2>\\u8FD9\\u4E2A\\u8FDE\\u63A5\\u5668\\u5C1A\\u672A\\u5F00\\u653E\\u3002</h2><p>${c.method === "device" ? "\\u5F00\\u653E\\u540E\\uFF0C\\u9700\\u8981\\u5148\\u5728\\u624B\\u673A\\u5B8C\\u6210\\u7CFB\\u7EDF\\u6388\\u6743\\uFF0C\\u684C\\u9762\\u53EF\\u67E5\\u770B\\u8FDE\\u63A5\\u72B6\\u6001\\u548C\\u5206\\u4EAB\\u8303\\u56F4\\u3002" : c.method === "import" ? "\\u5F00\\u653E\\u540E\\uFF0C\\u53EF\\u4EE5\\u4ECE\\u624B\\u673A\\u5206\\u4EAB\\u6240\\u9009\\u5185\\u5BB9\\uFF0C\\u6216\\u5728\\u684C\\u9762\\u5BFC\\u5165\\u9009\\u4E2D\\u7684\\u6587\\u4EF6\\u3002" : "\\u5F00\\u653E\\u540E\\uFF0C\\u4F1A\\u5728\\u670D\\u52A1\\u65B9\\u9875\\u9762\\u767B\\u5F55\\uFF0C\\u518D\\u7531\\u4F60\\u9009\\u62E9\\u5141\\u8BB8\\u8BBF\\u95EE\\u7684\\u8D44\\u6599\\u3002"}</p></aside></div>`;\n root.querySelector("[data-connectors-back]").onclick = catalog;\n };\n root.addEventListener("click", click);\n catalog();\n return () => {\n alive = false;\n release();\n root.removeEventListener("click", click);\n };\n }\n\n // web-console/desktop/src/renderer/console/console.ts\n var api2 = window.engine7Api;\n var chrome = mountAuroraChrome(document.getElementById("console-app"));\n var extensions = window.engine7ConsoleExtensions;\n var activeCleanup = null;\n var partnerCard = null;\n var currentPageKey = "status";\n var goToRef = null;\n var renderedStateDir = null;\n var bootSequence = 0;\n var navigationSequence = 0;\n async function boot() {\n const sequence = ++bootSequence;\n goToRef = null;\n partnerCard?.dispose();\n partnerCard = null;\n activeCleanup?.();\n activeCleanup = null;\n const { engines } = await api2.listEngines();\n if (sequence !== bootSequence) return;\n const marker = await api2.getInstalledMarker();\n if (sequence !== bootSequence) return;\n renderedStateDir = marker?.stateDir ?? null;\n if (!marker) {\n document.getElementById("console-body-slot").replaceChildren(h(\n "div",\n { class: "page" },\n h("h2", {}, "\\u63A7\\u5236\\u53F0\\u4E0D\\u53EF\\u7528"),\n h("p", { class: "page-sub" }, "\\u6CA1\\u6709\\u627E\\u5230\\u4EFB\\u4F55\\u5DF2\\u88C5\\u597D\\u7684\\u5F15\\u64CE\\u2014\\u2014\\u8BF7\\u5148\\u5B8C\\u6210\\u5B89\\u88C5\\u5411\\u5BFC\\u3002")\n ));\n return;\n }\n const actions = {\n start: async () => {\n await api2.startEngine(marker.configPath);\n },\n stop: async () => {\n await api2.stopEngine(marker.stateDir);\n },\n restart: async () => {\n await api2.stopEngine(marker.stateDir);\n await api2.startEngine(marker.configPath);\n }\n };\n const pages = [\n { key: "status", label: "\\u72B6\\u6001", mount: (body) => mountStatus(body, marker, {\n apiStatus: (p) => api2.apiStatus(p),\n doctor: (d) => api2.doctor(d),\n configGet: (c) => api2.configGet(c),\n travelControl: api2.travelAvailable !== false && typeof api2.travelControl === "function" ? (d, a) => api2.travelControl(d, a) : void 0,\n startEngine: (c) => api2.startEngine(c),\n stopEngine: (d) => api2.stopEngine(d),\n isEngineAlive: () => api2.isEngineAlive(marker.apiPort),\n isEngineProcessAlive: (d) => api2.isEngineProcessAlive(d),\n applyFreeTier: (d, o) => api2.applyFreeTier(d, o),\n updateCheck: () => api2.updateCheck(),\n updateApply: () => api2.updateApply(),\n onUpdateEvent: (cb) => api2.onUpdateEvent(cb)\n }, actions, (key) => goTo(key)) },\n { key: "channels", label: "\\u804A\\u5929\\u5E73\\u53F0", mount: (body) => mountChannels(body, marker, {\n apiStatus: (p) => api2.apiStatus(p),\n doctor: (d) => api2.doctor(d),\n runReconfig: (c, d, n) => api2.runReconfig(c, d, n),\n cancelReconfig: () => api2.cancelReconfig(),\n onEngineEvent: (cb) => api2.onEngineEvent(cb),\n readChannelConfig: (c, d) => api2.readChannelConfig(c, d),\n updateChannelConfig: (c, d, cfg) => api2.updateChannelConfig(c, d, cfg),\n readTelegramConfig: (c, d) => api2.readTelegramConfig(c, d),\n updateTelegramConfig: (c, d, cfg) => api2.updateTelegramConfig(c, d, cfg),\n readDingtalkConfig: (c, d) => api2.readDingtalkConfig(c, d),\n updateDingtalkConfig: (c, d, cfg) => api2.updateDingtalkConfig(c, d, cfg),\n readFeishuConfig: (c, d) => api2.readFeishuConfig(c, d),\n updateFeishuConfig: (c, d, cfg) => api2.updateFeishuConfig(c, d, cfg),\n readWecomConfig: (c, d) => api2.readWecomConfig(c, d),\n updateWecomConfig: (c, d, cfg) => api2.updateWecomConfig(c, d, cfg),\n fetchWaStatus: (p) => api2.fetchWaStatus(p),\n fetchWaQr: (p) => api2.fetchWaQr(p),\n configSchema: (d) => api2.configSchema(d),\n readWhatsappConfig: (c, d) => api2.readWhatsappConfig(c, d),\n updateWhatsappConfig: (c, d, cfg) => api2.updateWhatsappConfig(c, d, cfg),\n openPath: (p) => api2.openPath(p)\n }, actions) },\n { key: "travel", label: "\\u968F\\u884C", mount: (body) => {\n if (api2.travelAvailable === false) {\n body.replaceChildren(h("div", { class: "page" }, h("h2", {}, "\\u968F\\u884C\\u6682\\u4E0D\\u5F00\\u653E")));\n return () => {\n };\n }\n return mountTravel(body, marker, {\n travelControl: (d, a, p) => api2.travelControl(d, a, p),\n configGet: (c) => api2.configGet(c),\n onStateChanged: () => partnerCard?.refresh()\n });\n } },\n { key: "settings", label: "\\u8BBE\\u7F6E", mount: (body) => mountSettings(body, marker, {\n openMail: () => goTo("email"),\n configSchema: (d) => api2.configSchema(d),\n configGet: (c) => api2.configGet(c),\n configSet: (c, v) => api2.configSet(c, v),\n configMigrate: (c) => api2.configMigrate(c),\n internalModeSet: (on) => api2.internalModeSet(on),\n copyPortrait: (d, p) => api2.copyPortrait(d, p),\n scaffoldPersonas: (d, n, persona) => api2.scaffoldPersonas(d, n, persona),\n autostartEnable: () => api2.autostartEnable(),\n pickDirectory: () => api2.pickDirectory(),\n pickImageFile: () => api2.pickImageFile()\n }, actions) },\n // Keep the email route for existing tray/settings links; the directory now includes all connectors.\n { key: "email", label: "\\u8FDE\\u63A5\\u5668", mount: (body) => mountConnectors(body, marker, {\n serviceAuth: (d, a, p, v) => api2.serviceAuth(d, a, p, v),\n configSchema: (d) => api2.configSchema(d),\n configGet: (c) => api2.configGet(c),\n configSet: (c, v) => api2.configSet(c, v)\n }) },\n { key: "logs", label: "\\u65E5\\u5FD7", mount: (body) => mountLogs(body, marker, {\n logTail: (d) => api2.logTail(d),\n openPath: (p) => api2.openPath(p)\n }) },\n ...extensions?.pages?.(marker) ?? []\n ];\n const nav = h("nav", { class: "sidebar-nav" });\n const pageBody = h("main", { class: "console-body" });\n const goTo = (key) => {\n const page = pages.find((p) => p.key === key);\n if (!page) return;\n currentPageKey = key;\n extensions?.onNavigate?.(key);\n chrome.setScene(key);\n document.querySelector(".window-context").textContent = page.label;\n activeCleanup?.();\n activeCleanup = null;\n for (const item of Array.from(nav.children)) {\n const el = item;\n el.classList.toggle("active", el.dataset.key === key);\n }\n activeCleanup = page.mount?.(pageBody) ?? null;\n partnerCard?.refresh();\n };\n goToRef = goTo;\n nav.replaceChildren(...pages.map((p) => h(\n "button",\n {\n class: p.key === "travel" && api2.travelAvailable === false ? "nav-item nav-placeholder" : "nav-item",\n type: "button",\n disabled: p.key === "travel" && api2.travelAvailable === false,\n "data-key": p.key,\n onclick: () => goTo(p.key)\n },\n navIcon(p.key),\n p.label,\n p.key === "travel" && api2.travelAvailable === false ? h("small", { class: "nav-availability" }, "\\u6682\\u4E0D\\u5F00\\u653E") : null\n )));\n partnerCard = mountPartnerCard(document.getElementById("console-engines-slot"), marker, {\n configGet: (c) => api2.configGet(c),\n apiStatus: (p) => api2.apiStatus(p),\n isEngineAlive: (p) => api2.isEngineAlive(p),\n isEngineProcessAlive: (d) => api2.isEngineProcessAlive(d),\n travelControl: api2.travelAvailable !== false && typeof api2.travelControl === "function" ? (d, a) => api2.travelControl(d, a) : void 0\n }, () => goTo("settings"), { engines, onPick: async (stateDir) => {\n const r = await api2.selectEngine(stateDir);\n if (!r.ok) return false;\n partnerCard?.dispose();\n partnerCard = null;\n activeCleanup?.();\n activeCleanup = null;\n await boot();\n return true;\n } });\n document.getElementById("console-body-slot")?.replaceChildren(pageBody);\n document.getElementById("console-nav-slot")?.replaceChildren(nav);\n const pendingPage = await api2.consolePendingPage();\n if (sequence === bootSequence) goTo(pendingPage || currentPageKey);\n }\n api2.onConsoleNavigate((page) => {\n const sequence = ++navigationSequence;\n void (async () => {\n const marker = await api2.getInstalledMarker();\n if (sequence !== navigationSequence) return;\n if (marker?.stateDir !== renderedStateDir || !goToRef) await boot();\n if (sequence === navigationSequence) goToRef?.(page);\n })().catch((error) => console.error("[console] \\u65E0\\u6CD5\\u6253\\u5F00\\u7BA1\\u7406\\u9875", error));\n });\n void boot();\n})();\n</script>\n</body>\n</html>\n';
73453
+ var page = '<!doctype html>\n<html lang="zh-CN">\n<head>\n <meta charset="utf-8">\n <title>Engine7 \u63A7\u5236\u53F0</title>\n<meta name="viewport" content="width=device-width, initial-scale=1"><style>/* wizard styles \u2014 \u7EAF CSS\uFF0C\u65E0\u6846\u67B6\u65E0 CDN\uFF08\u79BB\u7EBF\u4F18\u5148\uFF09 */\n\n:root {\n --bg: #faf8f4;\n --panel: #fffdfa;\n --border: #e8e4de;\n --text: #343535;\n --muted: #65645f;\n --brand: #bd7952;\n --primary: #a86040;\n --primary-hi: #945235;\n --green: #667d61;\n --green-bg: #edf1e9;\n --red: #b44c4c;\n --red-bg: #faeeee;\n --amber: #9b743f;\n --amber-bg: #f5eee2;\n --radius: 11px;\n --sidebar: #f0eee8;\n --selected: #f7ede4;\n --serif: \'Noto Serif SC\', \'Songti SC\', SimSun, serif;\n}\n\n* { box-sizing: border-box; }\n\nhtml, body {\n height: 100%;\n margin: 0;\n font-family: \'Segoe UI\', \'Microsoft YaHei\', sans-serif;\n font-size: 14px;\n color: var(--text);\n background: var(--bg);\n user-select: none;\n}\n\n#app { display: flex; flex-direction: column; height: 100%; }\n\n/* === \u5934\u90E8\u6B65\u9AA4\u6761 === */\n\n.wiz-header {\n flex: none;\n padding: 14px 28px 10px;\n background: var(--panel);\n border-bottom: 1px solid var(--border);\n}\n\n.wiz-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }\n\n.wiz-stepper { display: flex; gap: 6px; flex-wrap: wrap; }\n\n.stepper-item {\n display: flex; align-items: center; gap: 6px;\n font-size: 12px; color: var(--muted);\n}\n.stepper-item .dot {\n width: 18px; height: 18px; border-radius: 50%;\n display: inline-flex; align-items: center; justify-content: center;\n background: #e4e8ee; color: var(--muted); font-size: 11px;\n}\n.stepper-item.active { color: var(--text); font-weight: 600; }\n.stepper-item.active .dot { background: var(--primary); color: #fff; }\n.stepper-item.done .dot { background: var(--green); color: #fff; }\n.stepper-item.done { color: var(--green); }\n.stepper-sep { color: #c3c9d2; font-size: 12px; }\n\n/* === \u4E3B\u4F53 === */\n\n.wiz-body {\n flex: 1;\n overflow-y: auto;\n padding: 22px 28px;\n}\n\n/*\n * \u9875\u811A\u91CC\u7684\u300C\u52A8\u4F5C\u533A\u300D\u69FD\u4F4D\uFF1A\u67D0\u4E00\u6B65\u5982\u679C\u628A\u81EA\u5DF1\u7684\u4E3B\u64CD\u4F5C\u653E\u8FD9\u513F\uFF0C\u5B83\u5C31**\u6C38\u8FDC\u5728\u773C\u524D**\u3002\n *\n * \u4E3A\u4EC0\u4E48\u4E0D\u80FD\u628A\u52A8\u4F5C\u505A\u6210\u5438\u9644\u5728\u6EDA\u52A8\u533A\u5E95\u90E8\u7684\u6D6E\u5C42\uFF082026-09-23 \u8BD5\u8FC7\u3001\u5426\u4E86\uFF09\uFF1A\u6D6E\u5C42\u4E0D\u5360\u6587\u6863\u6D41\uFF0C\n * **\u4F1A\u76D6\u4F4F\u5185\u5BB9**\u2014\u2014\u5B9E\u6D4B\u628A\u300C\u6709\u9879\u76EE\u672A\u901A\u8FC7\u300D\u90A3\u5757\u7684\u6700\u540E\u4E00\u884C\u5207\u6389\u3001\u6574\u5F20\u514D\u8D39\u6863\u5347\u7EA7\u5361\u538B\u5728\u4E0B\u9762\u3002\n * \u9875\u811A\u662F flex:none\uFF0C\u5360\u81EA\u5DF1\u7684\u4F4D\u7F6E\uFF0C\u4E0D\u906E\u4EFB\u4F55\u4E1C\u897F\uFF1B\u8FD9\u6B63\u662F\u5B83\u5B58\u5728\u7684\u610F\u4E49\u3002\n *\n * \u26A0\uFE0F [hidden] \u5FC5\u987B\u663E\u5F0F\u538B\u56DE display:none\uFF1A\u4E0B\u9762\u7684 display:flex \u4F18\u5148\u7EA7\u66F4\u9AD8\uFF0C\n * \u4E0D\u5199\u8FD9\u6761\u7684\u8BDD `hidden` \u4F1A\u5931\u6548\uFF08\u69FD\u4F4D\u7A7A\u7740\u4E5F\u5360\u4E00\u5757\uFF09\u3002\n */\n.wiz-actions { display: flex; flex-direction: column; gap: 6px; }\n.wiz-actions[hidden] { display: none; }\n/* \u5217\u5E03\u5C40\u4F1A\u628A\u6309\u94AE\u62C9\u6210\u901A\u680F\uFF0C\u592A\u91CD\uFF1B\u5411\u5BFC\u5176\u5B83\u9875\u7684\u4E3B\u6309\u94AE\u90FD\u5728\u53F3\u4E0B\u89D2\uFF08\u89C1 .wiz-nav\uFF09\uFF0C\u5BF9\u9F50\u5B83\u3002\n \u53EA\u632A\u6309\u94AE\u2014\u2014\u4E24\u4E2A\u52FE\u662F\u8868\u5355\u5185\u5BB9\uFF0C\u8981\u7559\u5728\u5DE6\u8FB9\u3002 */\n.wiz-actions > .btn { align-self: flex-end; }\n\n.step { max-width: 720px; }\n\n/* \u6B22\u8FCE\u9875\u7406\u5FF5\u6761\uFF1A\u7ED9\u52A9\u624B\u4E00\u4E2A\u5BB6 \xB7 <\u8F6E\u64AD\u8BCD>\u3002\u56DB\u6761\u7406\u5FF5\u8F6E\u6D41\u5360 C \u4F4D\uFF08welcome.ts \u91CC\u7684 SLOGANS\uFF09\u3002 */\n.wiz-tagline {\n display: flex;\n align-items: baseline;\n gap: 8px;\n margin: 2px 0 2px;\n font-size: 20px;\n font-weight: 600;\n letter-spacing: 0.3px;\n}\n.wiz-tagline .tagline-lead { color: var(--accent, #2f6fed); }\n.wiz-tagline .tagline-dot { color: var(--muted); font-weight: 400; }\n.wiz-tagline .tagline-slogan {\n color: var(--primary);\n min-width: 3.2em; /* \u5B9A\u5BBD\uFF0C\u6362\u8BCD\u65F6\u4E0D\u628A\u540E\u9762\u7684\u5143\u7D20\u63A8\u6765\u63A8\u53BB */\n display: inline-block;\n}\n.tagline-gloss {\n color: var(--muted);\n font-size: 13px;\n line-height: 1.6;\n min-height: 21px; /* \u5B9A\u9AD8\uFF0C\u56DB\u6761\u7684\u6587\u6848\u957F\u5EA6\u4E0D\u4E00\u6837\u4E5F\u4E0D\u8DF3 */\n margin-bottom: 14px;\n}\n.wiz-tagline .tagline-slogan,\n.tagline-gloss { transition: opacity 0.26s ease; }\n.wiz-tagline .tagline-slogan.fading,\n.tagline-gloss.fading { opacity: 0; }\n\n.step h2 { font-size: 18px; margin: 0 0 6px; }\n.step .step-sub { color: var(--muted); margin: 0 0 16px; line-height: 1.6; }\n\n.field { margin-bottom: 14px; }\n.field > label { display: block; font-weight: 600; margin-bottom: 5px; }\n.field .hint { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }\n\n.field input[type=\'text\'],\n.field input[type=\'password\'],\n.field input[type=\'number\'],\n.field select,\n.field textarea {\n width: 100%;\n padding: 8px 10px;\n border: 1px solid var(--border);\n border-radius: var(--radius);\n font: inherit;\n background: #fff;\n color: var(--text);\n}\n.field input:focus, .field select:focus {\n outline: none;\n border-color: var(--primary);\n}\n\n.radio-row { display: flex; gap: 18px; flex-wrap: wrap; }\n.radio-row label {\n display: inline-flex; align-items: center; gap: 5px;\n font-weight: 400; cursor: pointer;\n}\n\n.inline-warn {\n background: var(--amber-bg);\n color: var(--amber);\n border-radius: var(--radius);\n padding: 8px 12px;\n font-size: 13px;\n line-height: 1.6;\n margin: 8px 0 14px;\n}\n\n.inline-error {\n background: var(--red-bg);\n color: var(--red);\n border-radius: var(--radius);\n padding: 8px 12px;\n font-size: 13px;\n line-height: 1.6;\n margin: 8px 0 14px;\n}\n\n.path-row { display: flex; gap: 8px; }\n.path-row input { flex: 1; }\n.path-row button { flex: none; }\n\n.check-row { display: flex; align-items: center; gap: 6px; margin: 6px 0; }\n.check-row.muted { color: var(--muted); font-size: 14px; }\n\n/* \u5B89\u88C5\u4F4D\u7F6E\u5EFA\u8BAE\u6761 */\n.note-box {\n background: #eef3fd;\n border-left: 3px solid var(--primary);\n border-radius: 0 var(--radius) var(--radius) 0;\n padding: 10px 14px;\n line-height: 1.7;\n margin: 12px 0;\n}\n\n/* === \u5B89\u88C5\u9875 checklist === */\n\n.checklist { list-style: none; margin: 16px 0; padding: 0; }\n.checklist li {\n display: flex; align-items: center; gap: 10px;\n padding: 8px 4px;\n border-bottom: 1px solid #edf0f4;\n color: var(--muted);\n}\n.checklist li .mark {\n width: 20px; height: 20px; border-radius: 50%;\n display: inline-flex; align-items: center; justify-content: center;\n background: #e4e8ee; color: var(--muted); font-size: 12px; flex: none;\n}\n.checklist li.doing { color: var(--text); font-weight: 600; }\n.checklist li.doing .mark { background: var(--primary); color: #fff; }\n.checklist li.ok { color: var(--text); }\n.checklist li.ok .mark { background: var(--green); color: #fff; }\n\n/* === \u81EA\u68C0\u9875\u7EA2\u7EFF\u706F === */\n\n.report-block { margin: 14px 0; }\n.report-version {\n font-size: 22px; font-weight: 700; margin-bottom: 4px;\n}\n.report-path { color: var(--muted); font-size: 12px; word-break: break-all; }\n\n.light-row {\n display: flex; align-items: center; gap: 10px;\n padding: 9px 4px;\n border-bottom: 1px solid #edf0f4;\n}\n.light {\n width: 20px; height: 20px; border-radius: 50%; flex: none;\n display: inline-flex; align-items: center; justify-content: center;\n font-size: 12px; color: #fff;\n}\n.light.green { background: var(--green); }\n.light.red { background: var(--red); }\n.light.amber { background: var(--amber); }\n.light.off { background: #c3c9d2; }\n.light-label { flex: 1; }\n.light-note { color: var(--muted); font-size: 12px; }\n\n/* === \u5B8C\u6210\u9762\u677F === */\n\n.done-panel {\n background: var(--green-bg);\n border-radius: var(--radius);\n padding: 16px 18px;\n line-height: 1.8;\n margin: 14px 0;\n}\n.done-panel .big { font-size: 17px; font-weight: 700; color: var(--green); }\n\n/* === footer / \u6309\u94AE === */\n\n.wiz-footer {\n flex: none;\n padding: 12px 28px 16px;\n background: var(--panel);\n border-top: 1px solid var(--border);\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n.wiz-error {\n background: var(--red-bg);\n color: var(--red);\n border-radius: var(--radius);\n padding: 8px 12px;\n font-size: 13px;\n line-height: 1.6;\n white-space: pre-wrap;\n user-select: text;\n}\n\n.wiz-nav { display: flex; justify-content: flex-end; gap: 10px; }\n\n.btn {\n padding: 8px 22px;\n border: 1px solid var(--border);\n border-radius: var(--radius);\n background: #fff;\n color: var(--text);\n font: inherit;\n cursor: pointer;\n}\n.btn:hover { background: #f0f2f5; }\n.btn:disabled { opacity: 0.45; cursor: default; }\n.btn:disabled:hover { background: #fff; }\n.btn-primary {\n background: var(--primary);\n border-color: var(--primary);\n color: #fff;\n}\n.btn-primary:hover { background: var(--primary-hi); }\n.btn-primary:disabled:hover { background: var(--primary); }\n.btn-danger {\n background: var(--red);\n border-color: var(--red);\n color: #fff;\n}\n\n/* === \u626B\u7801 modal === */\n\n.modal-mask {\n position: fixed; inset: 0;\n background: rgba(15, 22, 32, 0.55);\n display: flex; align-items: center; justify-content: center;\n z-index: 100;\n}\n.modal-mask[hidden] { display: none; }\n\n.modal {\n background: #fff;\n border-radius: 12px;\n padding: 24px 28px;\n width: 420px;\n max-width: calc(100vw - 60px);\n text-align: center;\n box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);\n position: relative; /* \u6D6E\u5C42\u53F3\u4E0A\u89D2 \xD7 \u7684\u5B9A\u4F4D\u57FA\u51C6\uFF08.modal-close\uFF09 */\n}\n/* \u626B\u7801\u6D6E\u5C42\u53F3\u4E0A\u89D2\u5173\u95ED\uFF1A\u9759\u97F3\u8272\uFF0Chover \u624D\u63D0\u4EAE\uFF08\u4E0E\u63A7\u5236\u53F0/\u5411\u5BFC\u65E2\u6709\u89C6\u89C9\u8BED\u8A00\u4E00\u81F4\uFF09 */\n.modal .modal-close {\n position: absolute; top: 8px; right: 10px;\n width: 28px; height: 28px; padding: 0;\n display: flex; align-items: center; justify-content: center;\n border: none; border-radius: 6px;\n background: transparent;\n color: var(--muted);\n font-size: 18px; line-height: 1;\n cursor: pointer;\n}\n.modal .modal-close:hover { background: #eef1f5; color: var(--text); }\n.modal h3 { margin: 0 0 6px; font-size: 16px; }\n.modal .modal-sub { color: var(--muted); font-size: 13px; margin-bottom: 14px; }\n.modal img.qr {\n width: 260px; height: 260px;\n border: 1px solid var(--border);\n border-radius: 6px;\n background: #fff;\n}\n.modal .countdown {\n font-size: 15px; font-weight: 600; margin: 12px 0 16px;\n font-variant-numeric: tabular-nums;\n}\n.modal .modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }\n.modal .qr-error {\n color: var(--red); font-size: 14px; margin-top: 8px;\n word-break: break-all; user-select: text;\n}\n.modal form { text-align: left; }\n.modal form .field { margin-bottom: 10px; }\n\n.spinner {\n display: inline-block;\n width: 14px; height: 14px;\n border: 2px solid #c9d4e8;\n border-top-color: var(--primary);\n border-radius: 50%;\n animation: spin 0.9s linear infinite;\n vertical-align: -2px;\n margin-right: 6px;\n}\n@keyframes spin { to { transform: rotate(360deg); } }\n\n/* \u68C0\u6D4B\u5230\u5DF2\u6709\u5B89\u88C5\u9762\u677F */\n.existing-panel {\n border: 1px solid var(--border);\n border-radius: var(--radius);\n padding: 16px 18px;\n margin: 12px 0;\n line-height: 1.8;\n background: #fbfcfe;\n}\n.existing-panel .actions { display: flex; gap: 10px; margin-top: 10px; }\n\n/* \u6458\u8981\u8868 */\n.summary-table { width: 100%; border-collapse: collapse; margin: 10px 0; }\n.summary-table th, .summary-table td {\n text-align: left; padding: 7px 8px;\n border-bottom: 1px solid #edf0f4;\n font-weight: 400;\n}\n.summary-table th { color: var(--muted); width: 130px; font-weight: 600; }\n\n/* Approved installer design, applied to the existing forms and state machines.\n The native title bar remains native; only the renderer chrome lives here. */\nhtml, body {\n font-family: \'Noto Sans SC\', \'Microsoft YaHei\', \'Segoe UI\', sans-serif;\n font-size: 16px;\n line-height: 1.65;\n}\n[hidden] { display: none !important; }\nbutton, input, textarea, select { font: inherit; }\nbutton, label, summary { -webkit-tap-highlight-color: transparent; }\ninput, textarea, select { accent-color: var(--primary); }\ninput, textarea { user-select: text; }\nbutton:focus-visible, summary:focus-visible, input:focus-visible,\nselect:focus-visible, textarea:focus-visible {\n outline: 2px solid var(--primary);\n outline-offset: 3px;\n}\n::-webkit-scrollbar { width: 7px; height: 7px; }\n::-webkit-scrollbar-thumb { background: #d6cfc6; border: 2px solid var(--bg); border-radius: 8px; }\n::-webkit-scrollbar-track { background: transparent; }\n\n#app {\n display: grid;\n grid-template-columns: 190px minmax(0, 1fr);\n grid-template-rows: 66px minmax(0, 1fr) auto;\n overflow: hidden;\n}\n.wiz-header {\n grid-column: 1 / -1;\n padding: 0 28px;\n display: flex;\n align-items: center;\n background: #fcfaf7;\n}\n.wiz-title { display: flex; align-items: center; gap: 12px; margin: 0; font-weight: 400; }\n.engine-mark { color: var(--brand); display: block; flex: none; width: 29px; height: 29px; }\n.engine-wordmark { font-family: Georgia, var(--serif); font-size: 28px; letter-spacing: -1.2px; }\n.window-purpose { font-size: 14px; color: var(--muted); border-left: 1px solid var(--border); padding-left: 20px; margin-left: 8px; letter-spacing: 1px; }\n.wiz-sidebar {\n grid-column: 1;\n grid-row: 2 / 4;\n min-height: 0;\n padding: 30px 21px 24px;\n background: var(--sidebar);\n border-right: 1px solid var(--border);\n display: flex;\n flex-direction: column;\n}\n.wiz-stepper { flex-direction: column; flex-wrap: nowrap; gap: 0; }\n.stepper-item { position: relative; padding: 0 0 25px; gap: 11px; font-size: 14px; font-weight: 400; }\n.stepper-item .dot { width: 24px; height: 24px; flex: none; background: transparent; border: 1px solid #ddd6cc; font-family: Georgia, serif; }\n.stepper-item:not(:last-child)::after { content: \'\'; position: absolute; left: 11.5px; top: 29px; width: 1px; height: 15px; background: #ddd6cc; }\n.stepper-item.active { color: var(--primary); }\n.stepper-item.active .dot { border-color: var(--primary); box-shadow: 0 0 0 4px #efdfd0; }\n.stepper-item.done { color: var(--muted); }\n.stepper-item.done .dot { color: var(--green); background: #e7eadf; border-color: #e7eadf; }\n.sidebar-mark { margin-top: auto; padding-top: 22px; border-top: 1px solid #e4ded5; }\n.sidebar-mark .engine-mark { width: 25px; height: 25px; opacity: .65; }\n.wiz-body { min-width: 0; min-height: 0; grid-column: 2; grid-row: 2; padding: 33px 37px; }\n.step { max-width: 850px; margin: 0 auto; }\n.step h2 { font-family: var(--serif); font-size: 27px; line-height: 1.45; font-weight: 600; margin-bottom: 12px; }\n.step h3 { font-size: 18px; font-weight: 600; }\n.step .step-sub { font-size: 14px; line-height: 1.9; margin-bottom: 25px; }\n.wiz-footer { grid-column: 2; grid-row: 3; padding: 16px 37px; gap: 9px; background: #fcfaf7; }\n.wiz-nav { gap: 10px; }\n.wiz-nav:has(> :not([hidden])) { min-height: 40px; }\n.wiz-nav:not(:has(> :not([hidden]))) { display: none; }\n.wiz-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 18px; align-items: end; }\n.wiz-actions > .field { grid-column: 1; grid-row: 1; margin: 0; font-size: 14px; color: var(--muted); }\n.wiz-actions > .field .check-row { margin: 2px 0; }\n.wiz-actions > .btn { grid-column: 2; grid-row: 1; align-self: center; }\n.wiz-actions > div:not(.field) { grid-column: 1 / -1; font-size: 14px; }\n.wiz-actions > div:not(.field):empty { display: none; }\n\n.btn { min-height: 40px; padding: 8px 20px; border-radius: 8px; background: var(--panel); transition: background .15s, border-color .15s, box-shadow .15s; }\n.btn:hover { background: #f0ece6; border-color: #d7cdc5; }\n.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 5px #bd795218; }\n.btn-primary:hover { background: var(--primary-hi); border-color: var(--primary-hi); }\n.btn-primary:disabled:hover { background: var(--primary); }\n.btn-danger { background: var(--red); border-color: var(--red); }\n.btn-danger:hover { background: #9a3c3c; border-color: #9a3c3c; }\n.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }\n.btn:disabled:hover { background: var(--panel); border-color: var(--border); }\n.btn-primary:disabled:hover { background: var(--primary); border-color: var(--primary); }\n.path-row { align-items: stretch; }\n.path-row input { min-width: 0; }\n.field { margin-bottom: 19px; }\n.field > label { font-size: 16px; margin-bottom: 7px; }\n.field .hint { margin-left: 5px; font-size: 14px; line-height: 1.7; }\n.field input[type=\'text\'], .field input[type=\'password\'], .field input[type=\'number\'],\n.field input[type=\'email\'], .field select, .field textarea {\n width: 100%; min-width: 0; border: 1px solid #ded8d0; border-radius: 8px;\n background: var(--panel); padding: 10px 12px; color: var(--text); font: inherit;\n}\n.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px #bd795210; }\n.hint { color: var(--muted); font-size: 14px; line-height: 1.8; }\n.inline-warn, .inline-error, .note-box, .wiz-error { padding: 12px 15px; border-radius: 9px; font-size: 14px; line-height: 1.85; overflow-wrap: anywhere; }\n.note-box { background: #efebe3; color: #756c60; border: 0; }\n.note-box ul { padding-left: 18px; margin: 4px 0; }\n.existing-panel { background: var(--panel); border-color: #dacbd5; }\n.existing-panel .actions { flex-wrap: wrap; }\n.wiz-tagline { font-size: 22px; flex-wrap: wrap; gap: 7px; margin: 8px 0 4px; font-family: var(--serif); }\n.wiz-tagline .tagline-lead { color: var(--primary); }\n.tagline-gloss { font-size: 14px; }\n.step-welcome > .field { padding: 19px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }\n#w-appdir { overflow-wrap: anywhere; }\n#p-free-block, #p-paid { padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); margin-bottom: 22px; }\n#p-free-block { background: var(--selected); border-color: #d7c8d2; }\n#p-paid > .field:last-child { margin-bottom: 0; }\n.step-channels > .field { padding: 18px 20px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }\n.step-channels > .field:has(input[value=\'qr\']:checked), .step-channels > .field:has(input[value=\'manual\']:checked), .step-channels > .field:has(#ch-d-enabled:checked) { background: var(--selected); border-color: #d5b5a1; }\n.channel-title { display: flex !important; align-items: center; gap: 10px; font-size: 18px !important; margin-bottom: 15px !important; }\n.chan-badge { flex: none; width: 32px; height: 32px; border-radius: 8px; background: #fff; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; }\n.chan-badge svg { width: 23px; height: 23px; }\n.chan-badge.small { width: 23px; height: 23px; border-radius: 6px; }\n.chan-badge.small svg { width: 16px; height: 16px; }\n.radio-row { gap: 10px 16px; }\n.radio-row label { flex-wrap: wrap; font-size: 16px; }\n.radio-row label .hint { font-size: 14px; }\n.persona-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }\n.mode-options { display: grid; grid-template-columns: 1fr; gap: 9px; }\n.radio-card { display: block; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 17px; background: var(--panel); cursor: pointer; }\n.radio-card:has(input:checked) { border-color: #d5b5a1; background: var(--selected); box-shadow: 0 1px 3px #bd79520b; }\n.radio-card:hover { border-color: #c9bbc3; }\n.radio-card input { margin: 0; vertical-align: middle; }\n.radio-card > span { font-size: 16px; }\n.radio-card > .hint { margin-top: 5px; font-size: 14px; }\n.mode-options .radio-card { padding: 13px 17px; }\n.step-face > .field { padding: 19px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }\n.step-face .hint { overflow-wrap: anywhere; }\n.summary-table { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); border-spacing: 0; border-collapse: separate; overflow: hidden; }\n.summary-table th, .summary-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 14px; }\n.summary-table th { width: 105px; white-space: nowrap; }\n.summary-table tr:last-child > * { border-bottom: 0; }\n.summary-table td { overflow-wrap: anywhere; }\n.summary-table input { max-width: 100%; padding: 8px 10px; font: inherit; color: var(--text); background: var(--panel); border: 1px solid #ded8d0; border-radius: 7px; }\n.checklist { background: var(--panel); border: 1px solid var(--border); padding: 4px 18px; border-radius: var(--radius); }\n.checklist li { padding: 14px 0; border-color: var(--border); font-size: 14px; }\n.checklist li:last-child { border-bottom: 0; }\n.checklist li .mark { background: #ece7df; }\n.checklist li.doing .mark { background: var(--primary); }\n.checklist li.ok .mark { background: var(--green); }\n.report-block { background: var(--panel); border: 1px solid var(--border); padding: 16px 19px; border-radius: var(--radius); margin: 17px 0; }\n.report-version { font-size: 20px; font-weight: 500; }\n.report-path { font-size: 14px; line-height: 1.9; }\n.light-row { padding: 10px 0; border-color: var(--border); gap: 9px; flex-wrap: wrap; }\n.light-row:last-child { border-bottom: 0; }\n.light-note { font-size: 14px; overflow-wrap: anywhere; }\n.light { width: 19px; height: 19px; font-size: 13px; }\n.done-panel { padding: 17px 20px; font-size: 14px; }\n.done-panel .big { font-size: 18px; }\n.modal-mask { background: #433c4259; backdrop-filter: blur(3px); }\n.modal { background: var(--bg); border: 1px solid #d8cfc5; border-radius: 14px; max-height: calc(100vh - 40px); overflow-y: auto; padding: 25px 27px; box-shadow: 0 18px 70px #35292e22; }\n.modal h3 { font-family: var(--serif); font-size: 22px; font-weight: 600; margin-bottom: 10px; }\n.modal .modal-sub { font-size: 14px; line-height: 1.8; }\n.modal .modal-actions { flex-wrap: wrap; }\n.modal .countdown { font-size: 16px; }\n.modal .modal-close:hover { background: #eae4dd; }\n.spinner { border-color: #ead9ca; border-top-color: var(--primary); }\n\n@media (max-width: 960px) {\n #app { grid-template-columns: 165px minmax(0, 1fr); }\n .wiz-sidebar { padding: 26px 18px 20px; }\n .wiz-body { padding: 26px 26px; }\n .wiz-footer { padding: 13px 26px; }\n .step h2 { font-size: 24px; }\n .radio-row { gap: 8px 13px; }\n}\n@media (max-height: 660px) {\n #app { grid-template-rows: 58px minmax(0, 1fr) auto; }\n .stepper-item { padding-bottom: 19px; }\n .stepper-item:not(:last-child)::after { height: 10px; }\n .wiz-sidebar { padding-top: 24px; }\n .wiz-body { padding-top: 25px; padding-bottom: 24px; }\n .wiz-footer { padding-top: 12px; padding-bottom: 12px; }\n .step .step-sub { margin-bottom: 19px; }\n}\n@media (max-width: 720px) {\n #app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 56px auto minmax(0, 1fr) auto; }\n .wiz-header { padding: 0 18px; }\n .engine-wordmark { font-size: 24px; }\n .window-purpose { padding-left: 12px; margin-left: 0; }\n .wiz-sidebar { grid-column: 1; grid-row: 2; padding: 12px 15px; border-right: 0; border-bottom: 1px solid var(--border); }\n .wiz-stepper { flex-direction: row; justify-content: space-between; gap: 4px; }\n .stepper-item { flex-direction: column; gap: 4px; padding: 0; font-size: 12px; }\n .stepper-item::after { display: none; }\n .stepper-item .dot { width: 21px; height: 21px; font-size: 13px; }\n .wiz-sidebar .sidebar-mark { display: none; }\n .wiz-body { grid-column: 1; grid-row: 3; padding: 22px; }\n .wiz-footer { grid-column: 1; grid-row: 4; padding: 12px 20px; }\n .persona-options { grid-template-columns: 1fr; }\n .btn { padding: 8px 15px; }\n .summary-table th, .summary-table td { padding: 10px 12px; }\n}\n@media (prefers-reduced-motion: reduce) {\n *, *::before, *::after { animation: none !important; transition: none !important; }\n}\n\n/* console.css \u2014 \u63A7\u5236\u53F0\u5E03\u5C40\uFF08\u4FA7\u680F + \u9875\u5BB9\u5668\uFF09\u3002\u57FA\u7840\u63A7\u4EF6\u6837\u5F0F\u5728\u5171\u7528 styles.css\n \uFF08\u542B .modal / .modal-close\u2014\u2014\u626B\u7801\u6D6E\u5C42\u7684 \xD7 \u4E5F\u5728\u90A3\uFF1Bindex.html \u5148\u6302 ../styles.css \u518D\u6302\u672C\u6587\u4EF6\uFF09 */\n\n#console-app {\n display: flex;\n height: 100%;\n}\n\n/* === \u4FA7\u680F === */\n\n.sidebar {\n flex: none;\n width: 170px;\n background: var(--panel);\n border-right: 1px solid var(--border);\n padding: 14px 10px;\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.sidebar-title {\n font-size: 16px;\n font-weight: 700;\n padding: 0 10px 12px;\n}\n\n.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }\n\n/* \u5F53\u524D\u5F15\u64CE\u9009\u62E9\u6846\uFF1B\u591A\u4EFD\u65F6\u663E\u793A\uFF0C\u9875\u9762\u5BFC\u822A\u4E0D\u968F\u5F15\u64CE\u6570\u91CF\u53D8\u957F\u3002 */\n.engine-picker:not(:empty) { padding-bottom: 16px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }\n.engine-picker-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }\n.engine-picker-heading label { font-size: 14px; font-weight: 600; color: var(--text); }\n.engine-picker-count { font-size: 14px; color: var(--muted); }\n.engine-picker select { width: 100%; min-width: 0; padding: 9px 24px 9px 10px; border: 1px solid #d5b5a1; border-radius: 8px; color: var(--text); background: var(--panel); font-size: 16px; cursor: pointer; }\n.engine-picker select:disabled { opacity: .65; cursor: wait; }\n.engine-picker-path { font-size: 14px; color: var(--muted); line-height: 1.6; margin: 7px 2px 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }\n.engine-picker-error { font-size: 14px; color: var(--red); margin: 7px 0 0; }\n\n.nav-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 9px 12px;\n border: none;\n border-radius: 6px;\n background: transparent;\n color: var(--muted);\n font: inherit;\n cursor: pointer;\n text-align: left;\n}\n.nav-item:hover { background: #f0f2f5; color: var(--text); }\n.nav-item.active {\n background: #eef3fd;\n color: var(--primary);\n font-weight: 600;\n}\n.nav-item.nav-placeholder { opacity: 0.5; cursor: default; }\n.nav-item.nav-placeholder:hover { background: transparent; color: var(--muted); }\n.nav-availability { margin-left: auto; font-size: 10px; white-space: nowrap; }\n\n.phase-badge {\n font-size: 10px;\n padding: 1px 6px;\n border-radius: 8px;\n background: #e4e8ee;\n color: var(--muted);\n}\n\n/* === \u9875\u5BB9\u5668 === */\n\n.console-body-slot {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n display: flex;\n flex-direction: column;\n}\n\n.console-body {\n flex: 1;\n overflow-y: auto;\n padding: 22px 26px;\n}\n\n.page { max-width: 680px; }\n.page h2 { font-size: 18px; margin: 0 0 6px; }\n.page .page-sub { color: var(--muted); margin: 0 0 16px; line-height: 1.6; }\n\n/* \u72B6\u6001\u5FBD\u7AE0\uFF08\u72B6\u6001\u9875\u9876\u90E8\u8FD0\u884C\u6001\uFF09 */\n.state-badge {\n display: inline-block;\n margin: 6px 0 4px;\n font-size: 14px;\n font-weight: 600;\n}\n.state-badge.ok { color: var(--green); }\n.state-badge.off { color: var(--muted); }\n.state-badge.warn { color: var(--amber); }\n/* \u542F\u52A8\u4E2D\uFF1A\u84DD\uFF08--primary\uFF09+ \u547C\u5438\uFF0C\u8DDF"\u505C"\u548C"\u6545\u969C"\u90FD\u533A\u5206\u5F97\u5F00 */\n.state-badge.starting { color: var(--primary); animation: badge-pulse 1.6s ease-in-out infinite; }\n@keyframes badge-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }\n\n.btn-row { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }\n\n/* === \u72B6\u6001\u9875\u300C\u7248\u672C\u66F4\u65B0\u300D\u5361\u7247\uFF08update-card.ts\uFF09 === */\n\n/* \u53EF\u5347\u7EA7\u7684\u9AD8\u4EAE\u5757\uFF1A\u84DD\u5E95\u63CF\u8FB9\uFF08\u4E0E\u5F15\u64CE tab \u9009\u4E2D\u6001\u540C\u4E00\u7EC4\u8272\uFF09\u2014\u2014"\u6709\u65B0\u7248"\u662F\u8981\u770B\u89C1\u4F46\u4E0D\u662F\u8981\u7D27\u5F20\u7684\u4E8B\uFF0C\n \u6BD4 amber \u7684 .inline-warn \u66F4\u8D34\u5207\uFF1B\u5347\u5B8C\u7684 done \u6001\u6362\u7EFF\uFF08\u6210\u529F\u8272\uFF09\u3002 */\n.update-hint {\n display: inline-block;\n background: #eef3fd;\n border: 1px solid var(--primary);\n border-radius: var(--radius);\n color: var(--primary);\n font-weight: 600;\n padding: 7px 12px;\n margin: 6px 0;\n}\n.update-hint.done { background: var(--green-bg); border-color: var(--green); color: var(--green); }\n.up-muted { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 4px 0; }\n.update-actions { display: flex; gap: 10px; margin: 10px 0 2px; }\n.runtime-update { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 18px; padding: 14px 18px; }\n.runtime-update > :first-child { margin-bottom: 0 !important; }\n.runtime-update .update-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; flex-wrap: wrap; margin: 0; }\n.runtime-update > :nth-child(n+3):not(.update-actions) { grid-column: 1 / -1; }\n.runtime-update .update-hint { justify-self: start; margin: 0; }\n@media (max-width: 760px) {\n .runtime-update { grid-template-columns: minmax(0,1fr); }\n .runtime-update .update-actions { grid-column: 1; grid-row: auto; }\n}\n\n/* === \u901A\u9053\u5361\u7247 === */\n\n.chan-card {\n background: var(--panel);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n padding: 14px 16px;\n margin: 0 0 14px;\n max-width: 680px;\n}\n.chan-head {\n display: flex;\n align-items: center;\n gap: 10px;\n margin-bottom: 6px;\n}\n.chan-name { font-size: 15px; font-weight: 700; }\n.chan-light { font-size: 13px; color: var(--muted); }\n.chan-desc { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 10px; }\n.chan-card form { text-align: left; }\n.chan-card .field { margin-bottom: 10px; }\n\n/* === \u65E5\u5FD7\u9875 === */\n\n.log-view {\n flex: none;\n background: #14181f;\n color: #cfd8e3;\n border-radius: var(--radius);\n padding: 12px 14px;\n font: 12px/1.65 Consolas, \'Courier New\', monospace;\n white-space: pre-wrap;\n word-break: break-all;\n overflow-y: auto;\n height: calc(100vh - 210px);\n user-select: text;\n}\n\n/* === \u8BBE\u7F6E\u9875\uFF1A\u5206\u7EC4\u5BB9\u5668 === */\n/* \u26A0\uFE0F `.settings-group` \u4E4B\u524D\u53EA\u5728\u65E7\u7684 settings.ts \u91CC\u7528\u8FC7\u3001**\u4E24\u4E2A CSS \u6587\u4EF6\u91CC\u90FD\u6CA1\u5B9A\u4E49**\uFF08\u6B7B\u7C7B\uFF09\u3002\n \u8FD9\u4E00\u7248\u628A\u5B83\u8865\u6210\u771F\u7684\u3002 */\n.settings-group {\n background: var(--panel);\n border: 1px solid var(--border);\n border-radius: var(--radius);\n padding: 14px 16px;\n margin: 0 0 14px;\n max-width: 680px;\n}\n.settings-group h3 { font-size: 15px; margin: 0 0 6px; }\n\n/* Everyday preferences use readable rows with a single accessible switch. */\n.other-preferences .settings-group { padding: 0; border: 0; background: transparent; margin-bottom: 16px; }\n.other-preferences .settings-group h3 { color: var(--muted); font-size: 14px; margin-bottom: 8px; }\n@media (min-width: 1100px) {\n .other-preferences .settings-group[data-group=chat] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }\n .other-preferences .settings-group[data-group=chat] > h3 { grid-column: 1 / -1; }\n .other-preferences .settings-group[data-group=chat] .cf-preference { column-gap: 12px; }\n}\n.other-preferences .cf-preference { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 20px; padding: 9px 14px; margin-bottom: 5px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }\n.other-preferences .cf-preference > label { grid-column: 1; margin: 0; font-size: 15px; cursor: pointer; }\n.other-preferences .cf-preference > .cf-hint { grid-column: 1; margin: 3px 0 0; font-size: 13px; line-height: 1.5; }\n.cf-preference > .check-row { grid-column: 2; grid-row: 1 / 3; align-self: center; }\n.cf-preference > .cf-error { grid-column: 1 / -1; }\n.cf-preference-choice > select { grid-column: 2; grid-row: 1 / 3; align-self: center; width: 138px; margin: 0; padding: 8px 30px 8px 12px; border-radius: 10px; border-color: rgba(167, 139, 250, .35); background-color: rgba(141, 106, 219, .12); color: var(--text); font-size: 14px; cursor: pointer; }\n.cf-preference-choice > select:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 3px; }\n@media (max-width: 600px) {\n .other-preferences .cf-preference-choice { grid-template-columns: minmax(0, 1fr); }\n .cf-preference-choice > select { grid-column: 1; grid-row: auto; width: 100%; margin-top: 8px; }\n}\n.cf-preference input[type=checkbox] { appearance: none; display: block; width: 38px; height: 22px; margin: 0; padding: 2px; border: 1px solid var(--border); border-radius: 20px; background: #35313f; cursor: pointer; transition: background .15s; }\n.cf-preference input[type=checkbox]::before { content: \'\'; display: block; width: 16px; height: 16px; border-radius: 50%; background: #eee9f5; transition: transform .15s; }\n.cf-preference input[type=checkbox]:checked { background: #8d6adb; border-color: #a78bfa; }\n.cf-preference input[type=checkbox]:checked::before { transform: translateX(16px); }\n.other-preferences .cf-preference input[type=checkbox]:focus-visible { outline: 2px solid #c4b5fd; outline-offset: 4px; }\n@media (prefers-reduced-motion: reduce) { .cf-preference input[type=checkbox], .cf-preference input[type=checkbox]::before { transition: none; } }\n\n.subtabs {\n display: flex; gap: 6px; flex-wrap: wrap;\n border-bottom: 1px solid var(--border);\n margin-bottom: 16px;\n}\n.subtab {\n padding: 7px 14px; border: none; border-bottom: 2px solid transparent;\n background: transparent; color: var(--muted); font: inherit; cursor: pointer;\n}\n.subtab:hover { color: var(--text); }\n.subtab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }\n\n/* === \u901A\u7528\u8868\u5355\uFF08form.ts \u7684\u9009\u62E9\u5668\u5951\u7EA6\uFF1A.cf-field[data-path]\uFF09 === */\n.cf-form { max-width: 680px; }\n.cf-field { margin-bottom: 16px; }\n.cf-field > label { display: block; font-weight: 600; margin-bottom: 5px; }\n.cf-path { color: var(--muted); font-weight: 400; font-size: 11px; margin-left: 8px; font-family: Consolas, monospace; }\n.cf-hint { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 4px 0 6px; }\n.cf-error { color: var(--red); background: var(--red-bg); border-radius: var(--radius); padding: 6px 10px; font-size: 13px; line-height: 1.6; margin-top: 6px; }\n.cf-field input[type=\'text\'], .cf-field input[type=\'password\'], .cf-field input[type=\'number\'], .cf-field select, .cf-field textarea {\n width: 100%; padding: 8px 10px; border: 1px solid var(--border);\n border-radius: var(--radius); font: inherit; background: #fff; color: var(--text);\n}\n.cf-field textarea { font-family: Consolas, monospace; font-size: 12px; }\n.cf-field input:focus, .cf-field select:focus { outline: none; border-color: var(--primary); }\n/* json \u683C\u662F**\u53EA\u8BFB**\u7684\uFF08form.ts \u7EAA\u5F8B 4\uFF09\uFF1A\u80FD\u9009\u4E2D\u80FD\u590D\u5236\uFF0C\u4F46\u6539\u4E0D\u4E86 \u2014\u2014 \u89C6\u89C9\u4E0A\u4E5F\u8981\u4E00\u773C\u770B\u51FA\u6765 */\n.cf-field textarea[readonly] { background: #f4f6f9; color: var(--muted); }\n/* \u56DB\u4E2A\u9AD8\u5371\u8DEF\u5F84\uFF08stateDir / mediaDir / workspace / skills.path\uFF09\u4E5F\u662F\u53EA\u8BFB\u6863\uFF08form.ts \u7EAA\u5F8B 5\uFF09\u3002\n \u540C\u6B3E\u7070\u5E95\uFF1A\u5149\u9760 readOnly \u5728\u89C6\u89C9\u4E0A\u6CA1\u6709\u5206\u522B\uFF0C\u800C"\u8FD9\u4E00\u683C\u6539\u4E0D\u4E86"\u672C\u8EAB\u5C31\u662F\u8981\u4F20\u8FBE\u7684\u4FE1\u606F */\n.cf-field input[readonly] { background: #f4f6f9; color: var(--muted); }\n\n.fx-badge { font-size: 11px; font-weight: 400; padding: 1px 7px; border-radius: 8px; margin-left: 8px; }\n.fx-restart { background: var(--amber-bg); color: var(--amber); }\n.fx-reconnect { background: #eef3fd; color: var(--primary); }\n.fx-external { background: #e4e8ee; color: var(--muted); }\n.sec-badge { font-size: 11px; margin-left: 8px; padding: 1px 7px; border-radius: 8px; background: #e4e8ee; color: var(--muted); }\n.sec-set { background: #e8f6ee; color: var(--green); }\n.sec-unset { background: var(--amber-bg); color: var(--amber); }\n.sec-new { background: #eef3fd; color: var(--primary); }\n\n.cfg-savebar { margin-top: 18px; max-width: 680px; }\n.cfg-detail > * { margin-top: 10px; }\n.cfg-loading { color: var(--muted); }\n\n/* === \u8BBE\u7F6E\u9875\u5E95\u90E8\u90A3\u884C\u7248\u672C\u6587\u5B57\uFF08\u540C\u65F6\u662F\u5185\u90E8\u6A21\u5F0F\u624B\u52BF\u7684\u843D\u70B9\uFF09===\n \u89C1 console/internal-mode.ts\uFF1A**\u8FDE\u70B9 7 \u4E0B**\u5207\u5F00\u5185\u90E8\u6A21\u5F0F\uFF08\u5B89\u5353\u300C\u8FDE\u70B9\u7248\u672C\u53F7\u300D\u90A3\u4E2A\u624B\u611F\uFF09\u3002\n \u6837\u5F0F\u523B\u610F\u505A\u5F97**\u4E0D\u663E\u773C**\uFF08\u7070\u3001\u5C0F\u3001\u4E0D\u50CF\u80FD\u70B9\u7684\u4E1C\u897F\uFF09\u2014\u2014 \u5B83\u5C31\u662F\u4E00\u884C\u7CFB\u7EDF\u4FE1\u606F\uFF0C\n \u6CA1\u6709\u4EFB\u4F55"\u8FD9\u91CC\u80FD\u70B9"\u7684\u63D0\u793A\uFF1B\u5207\u5F00\u4E4B\u540E\u7684\u53CD\u9988\u8D70 .internal-note\u3002 */\n.settings-footer {\n margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--border);\n display: flex; align-items: center; gap: 10px; flex-wrap: wrap;\n color: var(--muted); font-size: 12px;\n}\n.settings-footer .version-line { cursor: default; user-select: none; font-family: Consolas, monospace; }\n.internal-badge { padding: 1px 8px; border-radius: 8px; background: var(--amber-bg); color: var(--amber); font-size: 11px; }\n.internal-note { color: var(--primary); }\n\n/* === \u901A\u9053\u9875\u5206\u7EC4\u6807\u5934 + \u9AD8\u7EA7\u6298\u53E0\uFF081011 \u7FC0\u54E5\uFF1A\u56FD\u5185/\u56FD\u9645\u5206\u7EC4\u4E0D\u63D2\u82B1\uFF1B\u626B\u7801\u662F\u4E3B\u8DEF\uFF0C\u8868\u5355\u6536\u8FDB\u62BD\u5C49\uFF09 === */\n.chan-advanced { margin: 10px 0 4px; }\n.chan-advanced > summary {\n cursor: pointer; font-size: 12px; color: var(--muted); user-select: none;\n}\n.chan-advanced > summary:hover { color: var(--primary); }\n.chan-advanced[open] > summary { margin-bottom: 8px; }\n\n/* === \u54C1\u724C\u5FBD\u6807 + \u5BFC\u822A\u56FE\u6807\uFF081011 \u8BBE\u8BA1\u8F6E\uFF09=== */\n.chan-badge {\n flex: none; width: 32px; height: 32px; border-radius: 8px;\n display: flex; align-items: center; justify-content: center;\n color: #fff; font-size: 14px; font-weight: 700; line-height: 1;\n background: #f3f5f9; /* logo \u5E95\u886C\uFF1A\u6D45\u7070\u74E6\u7247\uFF08\u8272\u5757+\u5B57\u515C\u5E95\u65F6\u4F1A\u88AB\u5185\u8054\u80CC\u666F\u8272\u76D6\u6389\uFF09 */\n box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.05);\n}\n.chan-badge svg { width: 20px; height: 20px; }\n.chan-badge.small svg { width: 13px; height: 13px; }\n.chan-badge.small { width: 20px; height: 20px; font-size: 10.5px; border-radius: 5px; }\n.chan-head { gap: 10px; }\n.light-row { gap: 8px; }\n\n.nav-item {\n display: flex; align-items: center; gap: 9px;\n transition: background 0.12s ease;\n}\n.nav-item svg { flex: none; width: 15px; height: 15px; opacity: 0.75; }\n.nav-item.active svg { opacity: 1; }\n\n/* \u5361\u7247\u8D28\u611F\uFF1Ahover \u8F7B\u6D6E\u8D77 */\n.chan-card { transition: box-shadow 0.15s ease; }\n.chan-card:hover { box-shadow: 0 3px 12px rgba(15, 23, 42, 0.08); }\n\n/* Shared warm installer appearance; navigation and page contents are unchanged. */\n#console-app { display: grid; grid-template-columns: 190px minmax(0, 1fr); grid-template-rows: 66px minmax(0, 1fr); overflow: hidden; }\n.console-header { grid-column: 1 / -1; display: flex; align-items: center; padding: 0 28px; border-bottom: 1px solid var(--border); background: #fcfaf7; }\n.sidebar { grid-column: 1; grid-row: 2; width: auto; min-height: 0; overflow-y: auto; padding: 25px 15px; background: var(--sidebar); }\n.console-body-slot { grid-column: 2; grid-row: 2; min-height: 0; }\n.console-body { min-height: 0; min-width: 0; padding: 33px 37px; }\n.page, .chan-card, .settings-group, .cf-form, .cfg-savebar { max-width: 850px; }\n.page h2 { font-family: var(--serif); font-size: 27px; font-weight: 600; line-height: 1.5; margin-bottom: 13px; }\n.page .page-sub { font-size: 14px; line-height: 1.9; margin-bottom: 23px; }\n.sidebar-nav { gap: 5px; }\n.nav-item { justify-content: flex-start; padding: 11px 13px; border-radius: 8px; font-size: 14px; }\n.nav-item:hover { background: #e9e4dc; }\n.nav-item.active { color: var(--primary); background: #eddfd1; }\n.nav-item.active svg { color: var(--primary); }\n.nav-item.nav-placeholder:hover { background: transparent; }\n.phase-badge { margin-left: auto; background: #e8e3db; font-size: 12px; border-radius: 5px; }\n.sidebar .sidebar-mark { margin-left: 10px; margin-right: 10px; }\n.state-badge { font-size: 15px; margin-top: 8px; }\n.report-block:has(.state-badge) { background: #f2e7dd; border-color: #dfcbb9; padding: 23px 25px; }\n.report-block:has(.state-badge) .report-version { font-family: Georgia, var(--serif); font-size: 24px; }\n.report-block:has(.state-badge) .state-badge.ok { color: var(--primary); }\n.btn-row { gap: 10px; }\n.update-hint { background: var(--selected); border-color: #d5b5a1; }\n.update-hint.done { background: var(--green-bg); border-color: var(--green); }\n.up-muted { line-height: 1.8; }\n.chan-card { padding: 21px 23px; margin-bottom: 15px; }\n.chan-card:hover { box-shadow: 0 3px 12px #bd79520b; }\n.chan-head { margin-bottom: 13px; flex-wrap: wrap; gap: 10px; }\n.chan-name { font-size: 18px; font-weight: 600; }\n.chan-light { font-size: 14px; margin-left: auto; }\n.chan-desc { font-size: 14px; line-height: 1.9; margin-bottom: 15px; }\n.chan-card .chan-advanced { padding-top: 12px; border-top: 1px solid var(--border); margin-top: 17px; }\n.chan-advanced > summary { font-size: 14px; }\n.chan-advanced[open] > summary { margin-bottom: 15px; }\n.chan-badge { background: #fff; border: 1px solid var(--border); box-shadow: none; }\n.chan-badge svg { width: 23px; height: 23px; }\n.chan-badge.small { width: 23px; height: 23px; }\n.chan-badge.small svg { width: 16px; height: 16px; }\n.settings-group { padding: 21px 23px; margin-bottom: 18px; }\n.settings-group h3 { font-size: 18px; margin-bottom: 12px; }\n.subtabs { gap: 3px; margin-bottom: 23px; }\n.subtab { font-size: 14px; padding: 10px 12px; }\n.subtab.active { color: var(--primary); }\n.cf-field { margin-bottom: 21px; }\n.cf-field > label { font-size: 16px; margin-bottom: 8px; }\n.cf-hint { font-size: 14px; line-height: 1.85; }\n.cf-path { font-size: 14px; overflow-wrap: anywhere; }\n.cf-field input[type=\'text\'], .cf-field input[type=\'password\'], .cf-field input[type=\'number\'], .cf-field select, .cf-field textarea {\n min-width: 0; padding: 10px 12px; border-radius: 8px; border-color: #ded8d0; background: var(--panel);\n}\n.cf-field input:focus, .cf-field select:focus, .cf-field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px #bd795210; }\n.cf-field input[readonly], .cf-field textarea[readonly] { background: #efede7; }\n.fx-reconnect, .sec-new { background: var(--selected); color: var(--primary); }\n.fx-external, .sec-badge { background: #eae6dd; }\n.sec-set { background: var(--green-bg); }\n.sec-unset { background: var(--amber-bg); }\n.cfg-savebar { padding-top: 17px; border-top: 1px solid var(--border); }\n.settings-footer { margin-top: 26px; font-size: 14px; gap: 8px; }\n.cf-field textarea, .up-muted, .cf-error, .fx-badge, .sec-badge, .internal-badge { font-size: 14px; }\n.log-view { height: max(150px, calc(100vh - 265px)); background: #383336; color: #e9e2dd; border: 1px solid #4d424a; font-size: 14px; padding: 17px 20px; border-radius: 10px; }\n\n@media (max-width: 960px) {\n #console-app { grid-template-columns: 165px minmax(0, 1fr); }\n .sidebar { padding: 21px 12px; }\n .console-body { padding: 26px; }\n .page h2 { font-size: 24px; }\n .chan-card, .settings-group { padding: 18px 19px; }\n}\n@media (max-height: 660px) {\n #console-app { grid-template-rows: 58px minmax(0, 1fr); }\n .console-body { padding-top: 25px; }\n .sidebar { padding-top: 18px; }\n .nav-item { padding-top: 9px; padding-bottom: 9px; }\n}\n@media (max-width: 720px) {\n #console-app { grid-template-columns: minmax(0, 1fr); grid-template-rows: 56px auto minmax(0, 1fr); }\n .console-header { padding: 0 18px; }\n .sidebar { grid-column: 1; grid-row: 2; padding: 9px 15px; border-right: 0; border-bottom: 1px solid var(--border); }\n .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }\n .nav-item { padding: 7px 9px; font-size: 14px; }\n .nav-item svg { display: none; }\n .engine-picker:not(:empty) { padding-bottom: 10px; margin-bottom: 6px; }\n .engine-picker-path { -webkit-line-clamp: 1; }\n .sidebar .sidebar-mark { display: none; }\n .console-body-slot { grid-column: 1; grid-row: 3; }\n .console-body { padding: 22px; }\n}\n\n/* Mail connectors share Aurora surfaces and one clear action per provider. */\n.mail-page { max-width:980px; }\n.mail-heading { display:flex;align-items:center;justify-content:space-between;gap:16px; }\n.mail-heading h2 { margin-bottom:0; }\n.mail-connected-count { flex:none;padding:8px 13px;border-radius:999px;background:rgba(176,142,255,.09);color:var(--text-muted,#b3adc5);font-size:12px; }\n.connection-list { margin:26px 0 14px;border:1px solid rgba(196,180,255,.11);border-radius:22px;overflow:hidden;background:linear-gradient(130deg,rgba(160,120,255,.045),rgba(80,130,210,.018)); }\n.connection-row { display:grid;grid-template-columns:52px minmax(0,1fr) auto;align-items:center;gap:18px;padding:25px 26px;transition:background .18s; }\n.connection-row + .connection-row { border-top:1px solid rgba(196,180,255,.08); }\n.connection-row.selected { background:rgba(169,129,250,.055); }\n.connection-icon { display:flex;width:52px;height:52px;align-items:center;justify-content:center;border:1px solid rgba(255,255,255,.12);border-radius:15px;background:rgba(255,255,255,.055);font-size:18px;font-weight:600;letter-spacing:-1px; }\n.connection-icon[data-brand=qq] { color:#88cfff;background:rgba(63,154,230,.08); }\n.connection-icon[data-brand="163"] { color:#ff999e;background:rgba(235,83,96,.08);font-size:17px; }\n.connection-icon img { width:32px;height:32px; }\n.connection-copy h3 { margin:0 0 6px;font-size:19px;font-weight:450;letter-spacing:0; }\n.connection-description { margin:0;color:var(--text-muted,#a8a3b6);font-size:13px;line-height:1.6;overflow-wrap:anywhere; }\n.connection-action { min-height:38px;min-width:100px;padding:8px 17px;border:1px solid rgba(180,142,255,.2);border-radius:999px;background:rgba(176,132,255,.11);color:#ddd0ff;font:inherit;font-size:13px;cursor:pointer; }\n.connection-action:hover:not(:disabled) { background:rgba(176,132,255,.2);border-color:rgba(196,166,255,.4); }\n.connection-action.connected { color:#b3ddca;background:rgba(99,180,143,.08);border-color:rgba(130,200,165,.15); }\n.connection-action:disabled { cursor:default;opacity:.55; }\n.connection-action:focus-visible,.mail-other-link:focus-visible,.settings-mail-link:focus-visible { outline:2px solid #b397f1;outline-offset:4px; }\n.gmail-details { grid-column:2/-1;margin-top:2px;min-width:0; }\n.gmail-details[hidden] { display:none; }\n.gmail-account { overflow-wrap:anywhere;font-size:14px; }\n.gmail-details .btn-row { flex-wrap:wrap;margin-top:14px; }\n.gmail-confirm { margin-top:16px;padding:14px 16px;border:1px solid rgba(193,150,255,.16);border-radius:12px;background:rgba(167,127,225,.04);font-size:13px; }\n.mail-other-link { border:0;background:none;color:var(--text-muted,#a8a3b6);font:inherit;font-size:12px;padding:7px 0;cursor:pointer; }\n.mail-configuration { margin-top:24px; }\n.settings-mail-link { display:flex;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:17px 20px;margin-top:22px;background:rgba(162,134,230,.04);border:1px solid rgba(188,162,240,.13);border-radius:14px;color:var(--text,#ddd8eb);font:inherit;text-align:left;cursor:pointer; }\n.settings-mail-link span { font-size:12px;color:var(--text-muted,#a8a3b6); }\n@media(max-width:800px) { .connection-row { grid-template-columns:42px minmax(0,1fr) auto;gap:12px;padding:21px 18px; }.connection-icon { width:42px;height:42px;border-radius:12px; }.connection-copy h3 { font-size:16px; }.connection-action { min-width:80px;padding:8px 11px;font-size:12px; }.mail-heading { flex-wrap:wrap; } }\n@media(prefers-reduced-motion:reduce) { .connection-row { transition:none; } }\n\n.gmail-policies { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px 20px; margin:12px 0; }\n.gmail-policy { display:flex; justify-content:space-between; align-items:center; gap:8px; min-width:0; }\n.gmail-policy select { padding:5px 8px; color:var(--text); background:var(--bg); border:1px solid var(--border); border-radius:6px; }\n@media(max-width:760px) { .gmail-policies { grid-template-columns:1fr; } }\n/* One travel page for the desktop tray and independent web console. */\n.travel-page { display: flex; flex-direction: column; gap: 22px; }\n.travel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }\n.travel-heading h2 { margin: 0 0 12px; font-size: 32px; font-weight: 400; }\n.travel-eyebrow { font-size: 11px; color: #c6a6e7; letter-spacing: .2em; margin: 0 0 12px; }\n.travel-heading .page-sub { margin: 0; }\n.travel-page .page-sub { margin-bottom: 0; }\n.travel-intro, .travel-presence, .travel-peer, .travel-actions, .travel-progress, .travel-exit { border: 1px solid rgba(183,145,230,.18); border-radius: 18px; background: linear-gradient(130deg,rgba(44,29,67,.8),rgba(23,19,35,.8)); padding: 24px; min-width: 0; }\n.travel-intro { padding: 42px 32px; }\n.travel-intro h3 { font-size: 23px; font-weight: 400; margin: 12px 0; }\n.travel-intro p { color: #b9aecb; line-height: 1.8; max-width: 520px; }\n.travel-intro-mark svg { width: 38px; height: 38px; color: #c5a0ef; }\n.travel-intro .btn { margin-top: 16px; }\n.travel-presence { display: flex; align-items: center; gap: 15px; }\n.travel-presence h3, .travel-peer h3, .travel-actions h3, .travel-exit h3 { margin: 0 0 10px; font-weight: 400; }\n.travel-presence h3 { font-size: 24px; background: linear-gradient(100deg,#a4b6ff,#ce9fff,#f1b9d5,#ebd3aa); color: transparent; background-clip: text; }\n.travel-presence-dot { width: 8px; height: 8px; border-radius: 50%; background: #a5d9cb; box-shadow: 0 0 13px #a5d9cb55; flex: none; }\n.travel-presence[data-stale=true] .travel-presence-dot { background: #ceb67e; box-shadow: none; }\n.travel-presence p, .travel-peer p, .travel-actions p, .travel-exit p { margin: 0; line-height: 1.7; }\n.travel-peers { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }\n.travel-peer[data-active=true] { border-color: rgba(179,151,233,.5); }\n.travel-peer-kind { display: inline-block; font-size: 11px; letter-spacing: .15em; color: #bfa8df; margin-bottom: 16px; }\n.travel-peer h3 { font-size: 20px; overflow-wrap: anywhere; }\n.travel-peer-presence { color: #e0d7ed; padding-bottom: 12px; }\n.travel-actions .btn-row { margin-top: 20px; }\n.travel-actions .travel-auto { margin-left: auto; }\n.travel-progress p { margin-bottom: 0; line-height: 1.8; }\n.travel-exit { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: rgba(27,22,37,.7); }\n.travel-exit .btn-row { flex-wrap: wrap; flex-shrink: 0; }\n.travel-notice { margin: 0; border-left: 2px solid #c8a5df; padding: 10px 16px; color: #d0c4df; line-height: 1.8; background: #af81ce0b; }\n.travel-notice.stale { border-color: #d3ba85; }\n.travel-connect-form, .travel-confirm { width: min(520px,calc(100vw - 64px)); padding: 30px; border-radius: 18px; background: #20182d; border: 1px solid #b894da44; box-sizing: border-box; }\n.travel-connect-form h2, .travel-confirm h2 { margin-top: 0; font-size: 23px; font-weight: 400; }\n.travel-connect-form p, .travel-confirm p { color: #c8bbd6; line-height: 1.8; }\n.travel-connect-form label { display: flex; flex-direction: column; gap: 8px; margin: 20px 0; color: #dfd5ec; }\n.travel-connect-form input { width: 100%; box-sizing: border-box; min-width: 0; background: #130e1e; border: 1px solid #bda5d044; border-radius: 8px; padding: 11px 12px; color: #f0e9f6; font: inherit; }\n.travel-connect-form .btn-row, .travel-confirm .btn-row { justify-content: flex-end; margin-top: 24px; }\n.travel-onboarding-form { max-height: calc(100vh - 40px); overflow-y: auto; padding: 22px; }\n.travel-onboarding-form label { margin: 10px 0; gap: 5px; }\n.travel-onboarding-form p { margin: 10px 0; font-size: 13px; }\n.travel-onboarding-form select { width: 100%; padding: 9px; background: #130e1e; border: 1px solid #bda5d044; border-radius: 8px; color: #f0e9f6; font: inherit; }\n.travel-onboarding-form code { display: block; overflow-wrap: anywhere; font-size: 12px; }\n.ssh-address-row { display: grid; grid-template-columns: 100px minmax(0,1fr); gap: 14px; }\n.travel-onboarding-form .ssh-trust { flex-direction: row; align-items: center; font-size: 12px; }\n.travel-onboarding-form .ssh-trust input { width: auto; }\n.travel-onboarding-form [hidden] { display: none; }\n.ssh-key-row span { display: block; font-size: 12px; margin: 8px 0; overflow-wrap: anywhere; }\n.travel-onboarding-form .btn-row { flex-wrap: wrap; gap: 8px; }\n.travel-onboarding-shell { position: relative; max-width: calc(100vw - 32px); }\n.travel-onboarding-shell > [hidden] { display: none; }\n.ssh-ready-summary .btn-row { flex-wrap: wrap; gap: 8px; }\n.ssh-wait-mask { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; box-sizing: border-box; border-radius: 18px; background: #130e1edb; backdrop-filter: blur(5px); }\n.ssh-wait-mask[hidden] { display: none; }\n.ssh-wait-card { width: 100%; max-height: calc(100dvh - 72px); overflow-y: auto; box-sizing: border-box; padding: 24px; border: 1px solid #b894da66; border-radius: 16px; background: #20182d; box-shadow: 0 16px 48px #0005; }\n.ssh-wait-card h2 { margin: 0 0 14px; font-size: 22px; font-weight: 400; }\n.ssh-wait-card p { color: #c8bbd6; font-size: 13px; line-height: 1.8; }\n.ssh-wait-card progress { display: block; width: 100%; height: 10px; margin: 18px 0; border: 0; border-radius: 8px; overflow: hidden; appearance: none; background: #130e1e; accent-color: #bd9ee6; }\n.ssh-wait-card progress::-webkit-progress-bar { background: #130e1e; }\n.ssh-wait-card progress::-webkit-progress-value { background: linear-gradient(90deg,#a6b8ee,#cba6e9); transition: width .25s; }\n.ssh-wait-steps { padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; color: #91859e; font-size: 13px; }\n.ssh-wait-steps li::before { content: \'\u25CB\'; margin-right: 8px; }\n.ssh-wait-steps li[data-state=done] { color: #b9dace; }\n.ssh-wait-steps li[data-state=done]::before { content: \'\u2713\'; }\n.ssh-wait-steps li[data-state=current] { color: #eadcf8; }\n.ssh-wait-steps li[data-state=current]::before { content: \'\u25CC\'; display: inline-block; animation: ssh-wait-spin 1.5s linear infinite; }\n.ssh-wait-card .btn-row { justify-content: flex-end; margin-top: 22px; }\n.ssh-wait-card [data-error=true], .travel-onboarding-form [data-error=true] { color: #f3b1bd; padding: 10px 12px; border: 1px solid #e5889b55; border-radius: 8px; background: #de6c8610; }\n@keyframes ssh-wait-spin { to { transform: rotate(360deg); } }\n@media(prefers-reduced-motion:reduce) { .ssh-wait-steps li[data-state=current]::before { animation: none; } }\n@media(max-width:400px) { .ssh-wait-mask { padding: 10px; } .ssh-wait-card { padding: 16px; } }\n@media (max-width: 1050px) { .travel-exit { align-items: flex-start; flex-direction: column; } .travel-actions .travel-auto { margin-left: 0; } }\n@media (max-width: 760px) { .travel-peers { grid-template-columns: minmax(0,1fr); } .travel-heading { align-items: flex-start; } .travel-heading h2 { font-size: 27px; } .travel-peer,.travel-presence,.travel-actions,.travel-exit { padding: 20px; } .travel-intro { padding: 28px 22px; } }\n.travel-admin { margin-top: 24px; }\n.travel-admin summary { cursor: pointer; color: var(--ash); font-size: 13px; }\n.travel-admin[open] > button { margin-top: 12px; }\n\n/* Companion identity uses the homepage\'s thin type, quiet aurora and horizon. */\n.partner-card { position: relative; min-width: 0; padding: 13px 12px 16px; overflow: hidden; border: 1px solid #ece8e112; border-radius: 16px; background: radial-gradient(ellipse at 12% 100%, #a78bfa14, transparent 75%), linear-gradient(150deg, #161020aa, #0b0b1399); }\n.partner-card::before { content: \'\'; position: absolute; left: 12px; right: 12px; bottom: 0; height: 1px; background: var(--rainbow); opacity: .5; }\n.partner-card::after { content: \'\'; position: absolute; width: 80%; height: 24px; left: 10%; bottom: -18px; background: var(--rainbow); filter: blur(20px); opacity: .2; pointer-events: none; }\n.partner-heading { display: flex; justify-content: space-between; align-items: center; gap: 4px; min-height: 24px; margin-bottom: 9px; }\n.partner-caption { font-size: 11px; letter-spacing: .16em; color: var(--muted); font-weight: 400; }\n.partner-identity { display: flex; align-items: center; gap: 11px; min-width: 0; }\n.partner-avatar { position: relative; display: grid; place-items: center; flex: 0 0 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle at 30% 20%, #a78bfa14, #0b0b1380); box-shadow: 0 0 24px #a78bfa0c; }\n.partner-avatar::before { content: \'\'; position: absolute; inset: 0; border: 1px solid #ece8e126; border-top-color: #6ecdff70; border-right-color: #a78bfa66; border-bottom-color: #ff6b9d55; border-left-color: #ffcf8a44; border-radius: 50%; }\n.partner-avatar::after { content: \'\'; position: absolute; top: 2px; right: 7px; width: 3px; height: 3px; border-radius: 50%; background: #ece8e1; box-shadow: 0 0 8px #a78bfa99; }\n.partner-glyph { font-family: var(--sans); font-size: 21px; font-weight: 200; color: var(--bone); }\n.partner-info { display: flex; flex: 1; flex-direction: column; gap: 6px; min-width: 0; }\n.partner-name { font: 300 21px/1.35 var(--sans); letter-spacing: .06em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--bone); }\n.partner-name, .partner-option-name { width: fit-content; max-width: 100%; }\n.name-edit { border: 0; padding: 0; background-color: transparent; text-align: left; cursor: pointer; }\n.companion-name.name-edit { font: inherit; letter-spacing: inherit; }\n.name-edit:hover { text-decoration: underline; text-decoration-color: #a78bfa80; text-underline-offset: .14em; }\n.name-edit:focus-visible { outline: 1px solid var(--violet); outline-offset: 3px; border-radius: 3px; }\n@supports ((background-clip: text) or (-webkit-background-clip: text)) {\n .companion-name, .partner-name, .partner-option-name { background: var(--rainbow); background-clip: text; -webkit-background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }\n}\n@media (forced-colors: active) {\n .companion-name, .partner-name, .partner-option-name { background: none; color: CanvasText; -webkit-text-fill-color: CanvasText; }\n}\n.partner-status { display: flex; align-items: center; gap: 6px; font-size: 11px; line-height: 1.6; color: var(--muted); white-space: nowrap; }\n.partner-status::before { content: \'\'; flex: 0 0 4px; height: 4px; border-radius: 50%; background: #9b91a4; }\n.partner-card[data-state=running] .partner-status::before { background: var(--green); box-shadow: 0 0 9px #5fe6c033; }\n.partner-card[data-state=starting] .partner-status::before { background: var(--violet); }\n.partner-card[data-state=warn] .partner-status::before { background: var(--gold); }\n.partner-switch { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 34px; height: 26px; border: 1px solid transparent; border-radius: 7px; padding: 0 3px; background: transparent; color: var(--muted); font: 11px var(--sans); cursor: pointer; }\n.partner-switch:hover, .partner-switch[aria-expanded=true] { color: var(--bone); background: #ffffff06; border-color: #a78bfa2e; }\n.partner-switch:disabled { opacity: .5; cursor: wait; }\n.partner-chevron { width: 5px; height: 5px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; transform: rotate(45deg); transition: transform .2s; }\n.partner-switch[aria-expanded=true] .partner-chevron { transform: rotate(225deg); }\n.partner-switch:focus-visible, .partner-naming:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }\n.partner-naming { padding: 0; margin: 10px 0 0 51px; border: 0; background: transparent; text-align: left; font: 11px/1.6 var(--sans); color: var(--violet); cursor: pointer; }\n.partner-naming:hover { color: var(--bone); }\n.partner-renaming { position: absolute; top: 17px; right: 12px; margin: 0; }\n.partner-card[data-multi=true] .partner-renaming { right: 52px; }\n\n.partner-menu { position: fixed; inset: auto; margin: 0; padding: 0; color: var(--bone); border: 1px solid #a78bfa40; border-radius: 17px; background: radial-gradient(ellipse at 0 0, #32204360, transparent 65%), #100c19; box-shadow: 0 20px 65px #0008, 0 0 35px #a78bfa0c; }\n.partner-menu:popover-open { display: flex; flex-direction: column; }\n.partner-menu-heading { display: flex; justify-content: space-between; gap: 12px; padding: 16px 18px 13px; border-bottom: 1px solid #ece8e10c; font: 12px/1.5 var(--sans); letter-spacing: .06em; }\n.partner-menu-heading > span:last-child { color: var(--muted); font-size: 11px; letter-spacing: 0; }\n.partner-menu-list { padding: 7px; overflow-y: auto; min-height: 0; }\n.partner-option { display: flex; width: 100%; min-width: 0; gap: 12px; align-items: center; padding: 11px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--bone); text-align: left; cursor: pointer; font-family: var(--sans); }\n.partner-option:hover { background: #ffffff04; }\n.partner-option[aria-checked=true] { background: #a78bfa0d; border-color: #a78bfa25; }\n.partner-option:focus-visible { outline: 1px solid var(--violet); outline-offset: -1px; background: #a78bfa0e; }\n.partner-option:disabled { opacity: .55; cursor: wait; }\n.partner-option-avatar { display: grid; place-items: center; flex: 0 0 31px; height: 31px; border: 1px solid #ece8e11e; border-radius: 50%; font-size: 17px; font-weight: 200; color: #ded0ef; background: #a78bfa06; }\n.partner-option-copy { display: flex; flex-direction: column; flex: 1; gap: 5px; min-width: 0; }\n.partner-option-name { font-size: 14px; font-weight: 400; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }\n.partner-option-status { display: flex; align-items: center; gap: 5px; font-size: 11px; line-height: 1.5; color: var(--muted); }\n.partner-option-status::before { content: \'\'; flex: 0 0 4px; height: 4px; border-radius: 50%; background: #9b91a4; }\n.partner-option[data-state=running] .partner-option-status::before { background: var(--green); }\n.partner-option[data-state=starting] .partner-option-status::before { background: var(--violet); }\n.partner-option[data-state=warn] .partner-option-status::before { background: var(--gold); }\n.partner-option-path { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 10px; line-height: 1.5; color: var(--muted); }\n.partner-current { flex: none; font-size: 10px; color: #c5b0e0; align-self: center; }\n.partner-menu-error { margin: 0; padding: 12px 18px; border-top: 1px solid #ece8e10c; color: var(--red); font-size: 12px; line-height: 1.6; }\n.aurora-motion-paused .partner-chevron { transition: none; }\n@media (prefers-reduced-motion: reduce) { .partner-chevron { transition: none; } }\n\n/* Current \u65E5\u5E38\u56DE\u54CD design, applied after the existing functional layouts. */\n:root {\n color-scheme: dark;\n --void: #040408; --surface: #0b0b13; --bone: #ece8e1;\n --blue: #6ecdff; --violet: #a78bfa; --pink: #ff6b9d; --gold: #ffcf8a;\n --rainbow: linear-gradient(100deg, #6ecdff 0%, #a78bfa 34%, #ff6b9d 68%, #ffcf8a 100%);\n --bg: var(--void); --panel: var(--surface); --border: rgba(236,232,225,.14);\n --text: var(--bone); --muted: rgba(236,232,225,.68); --brand: var(--violet);\n --primary: var(--violet); --primary-hi: #c4b5fd;\n --green: #5fe6c0; --green-bg: #102720; --red: #ff9ea9; --red-bg: #321621;\n --amber: var(--gold); --amber-bg: #2b221b; --radius: 14px;\n --sidebar: rgba(11,11,19,.78); --selected: #20172e;\n --sans: \'PingFang SC\', \'Microsoft YaHei\', \'Segoe UI\', sans-serif;\n}\nhtml, body { font-family: var(--sans); background: var(--void); color: var(--bone); }\n::selection { background: var(--violet); color: var(--void); }\n::-webkit-scrollbar-thumb { background: #4e465d; border-color: var(--void); }\n#app, #console-app { position: relative; z-index: 1; background: transparent; }\n.aurora-field { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse 65% 55% at 65% 73%, #38204c88, transparent 75%); }\n.aurora-field[data-scene=welcome] { background: radial-gradient(ellipse 65% 60% at 63% 69%, #4b285c99, transparent 75%); }\n.aurora-field[data-scene=install], .aurora-field[data-scene=status] { background: radial-gradient(ellipse 65% 65% at 68% 67%, #2a234d99, transparent 75%); }\n.aurora-particles { display: block; width: 100%; height: 100%; }\n.wiz-header, .console-header { justify-content: space-between; gap: 20px; background: rgba(4,4,8,.78); }\n.wiz-title { gap: 10px; min-width: 0; }\n.engine-mark { width: 29px; height: 29px; }\n.engine-wordmark { display: inline-flex; align-items: baseline; gap: .18em; white-space: nowrap; font-family: Georgia, serif; font-weight: 400; color: var(--bone); }\n.brand-separator { font-size: .5em; color: var(--muted); letter-spacing: 0; }\n.brand-qi { font: 400 .72em/1 \'Songti SC\', STSong, SimSun, serif; letter-spacing: 0; color: var(--violet); }\n@supports (background-clip: text) or (-webkit-background-clip: text) {\n .brand-qi { background: var(--rainbow); background-clip: text; -webkit-background-clip: text; color: transparent; }\n}\n.window-purpose { font-size: 12px; letter-spacing: .08em; padding-left: 14px; margin-left: 5px; }\n.chrome-actions { display: flex; align-items: center; gap: 18px; min-width: 0; }\n.window-context { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.aurora-motion { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 50%; color: var(--bone); background: transparent; font-size: 19px; cursor: pointer; }\n.aurora-motion:hover { border-color: var(--violet); background: var(--selected); }\n.aurora-motion[aria-pressed=true] { color: var(--muted); }\n.aurora-motion:disabled { opacity: .55; cursor: default; }\n.sidebar-kicker { font-size: 11px; color: var(--muted); margin: 0 0 25px; letter-spacing: .06em; }\n.sidebar-mark { border-color: var(--border); color: var(--muted); font-size: 11px; letter-spacing: .12em; }\n.sidebar-mark .engine-mark { display: inline-block; vertical-align: middle; margin-right: 10px; }\n.stepper-item .dot { border-color: var(--border); color: var(--muted); }\n.stepper-item:not(:last-child)::after { background: var(--border); }\n.stepper-item.active { color: var(--bone); font-weight: 500; }\n.stepper-item.active .dot { background: var(--selected); border-color: var(--violet); color: var(--bone); box-shadow: 0 0 0 4px #a78bfa12; }\n.stepper-item.done .dot { color: var(--green); background: var(--green-bg); border-color: #5fe6c033; }\n.step h2, .page h2, .modal h3 { font-family: var(--sans); font-weight: 200; font-size: 32px; line-height: 1.35; letter-spacing: .015em; }\n.step-welcome h2 { font-size: clamp(32px, 4.6vw, 48px); margin: 5px 0 20px; }\n.step-welcome h2 em { font-style: normal; background: var(--rainbow); background-clip: text; -webkit-background-clip: text; color: transparent; }\n.aurora-eyebrow { font-size: 10px; letter-spacing: .18em; color: var(--muted); margin: 0 0 8px; }\n.wiz-tagline { font-family: var(--sans); font-size: 16px; font-weight: 400; }\n.wiz-tagline .tagline-lead { color: var(--bone); }\n.wiz-tagline .tagline-slogan { color: var(--violet); }\n.tagline-gloss { margin-bottom: 18px; }\n.step .step-sub, .page .page-sub { color: var(--muted); line-height: 1.9; }\n.wiz-footer { background: rgba(11,11,19,.92); border-color: var(--border); }\n.btn { background: var(--panel); border-color: var(--border); border-radius: 999px; }\n.btn:hover, .btn:disabled:hover { background: var(--selected); border-color: #a78bfa66; }\n.btn-primary, .btn-primary:disabled:hover { background: var(--bone); color: var(--void); border-color: var(--bone); box-shadow: none; }\n.btn-primary:hover { background: #fff9f4; border-color: #fff9f4; box-shadow: 0 4px 25px #a78bfa2b; }\n.btn-danger, .btn-danger:hover { color: var(--red); background: var(--red-bg); border-color: #ff9ea94d; }\n.field input[type=text], .field input[type=password], .field input[type=number], .field input[type=email], .field select, .field textarea,\n.cf-field input[type=text], .cf-field input[type=password], .cf-field input[type=number], .cf-field select, .cf-field textarea, .summary-table input,\n.engine-picker select { border-color: var(--border); background: var(--panel); color: var(--bone); border-radius: 9px; }\n.field input:focus, .field textarea:focus, .field select:focus,\n.cf-field input:focus, .cf-field select:focus, .cf-field textarea:focus { border-color: var(--violet); box-shadow: 0 0 0 3px #a78bfa1c; }\ninput, textarea, select { accent-color: var(--violet); }\n.cf-field input[readonly], .cf-field textarea[readonly] { background: #090810; color: var(--muted); }\n.note-box { background: #171322; color: var(--muted); border: 1px solid var(--border); }\n.existing-panel, #p-free-block { border-color: #a78bfa55; }\n.radio-card:has(input:checked), .step-channels > .field:has(input[value=qr]:checked), .step-channels > .field:has(input[value=manual]:checked), .step-channels > .field:has(#ch-d-enabled:checked) { background: var(--selected); border-color: #a78bfa77; box-shadow: none; }\n.radio-card:hover { border-color: #a78bfa77; }\n.chan-badge { background: #12111d; border-color: var(--border); box-shadow: none; }\n.checklist li .mark, .light.off, .phase-badge, .sec-badge, .fx-external { background: #292432; color: var(--muted); }\n.checklist li.doing .mark { color: var(--void); background: var(--violet); }\n.checklist li.ok .mark, .light.green { color: var(--void); background: var(--green); }\n.light.red { background: var(--red); color: var(--void); }\n.light.amber { background: var(--gold); color: var(--void); }\n.modal-mask { background: #040408b8; }\n.modal { background: #10101a; border-color: #a78bfa40; box-shadow: 0 18px 70px #0008; }\n.modal .modal-close:hover { background: var(--selected); }\n.modal img.qr { background: #fff; color-scheme: light; }\n.spinner { border-color: #a78bfa33; border-top-color: var(--violet); }\n.nav-item:hover { background: #ffffff08; }\n.nav-item.active { background: var(--selected); color: var(--bone); box-shadow: inset 2px 0 var(--violet); }\n.nav-item.active svg { color: var(--violet); }\n.phase-badge { margin-left: auto; }\n.report-block:has(.state-badge) { background: linear-gradient(125deg, #211831, #0b0b13); border-color: #a78bfa44; }\n.update-hint { background: var(--selected); }\n.update-hint.done, .sec-set { background: var(--green-bg); color: var(--green); }\n.fx-reconnect, .sec-new { background: var(--selected); color: var(--violet); }\n.log-view { background: #090810; color: var(--bone); border-color: var(--border); }\n.step, .page { animation: aurora-enter .38s ease-out both; }\n@keyframes aurora-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }\n.aurora-motion-paused .step, .aurora-motion-paused .page { animation: none; }\n.aurora-motion-paused .tagline-slogan, .aurora-motion-paused .tagline-gloss { transition: none; opacity: 1; }\n@media (max-width: 960px) { .step h2, .page h2 { font-size: 29px; } .step-welcome h2 { font-size: 40px; } }\n@media (max-height: 660px) { .step-welcome h2 { font-size: 36px; margin-bottom: 14px; } .sidebar-kicker { margin-bottom: 18px; } }\n@media (max-width: 720px) { .sidebar-kicker { display: none; } .chrome-actions { gap: 9px; } .window-context { font-size: 11px; } }\n@media (max-width: 480px) { .window-purpose, .window-context { display: none; } .wiz-header, .console-header { gap: 10px; } }\n@media (prefers-reduced-motion: reduce) { .step, .page { animation: none; } }\n\n/* Production layout adapted from the approved installer preview. */\n:root { --muted: #b9aec6; --border: #a78bfa2e; --panel: #130e1d; --selected: #2c1e3a; }\n.wiz-header, .console-header, .wiz-footer { background: #0f0919d9; border-color: var(--border); }\n.wiz-sidebar, .console-sidebar { background: linear-gradient(180deg,#281733a6,#120c22ba); border-color: var(--border); }\n.wiz-body, .console-body { background: linear-gradient(130deg,#1d112a70,#0d0a1650); }\n.wiz-header::before, .console-header::before { content: \'\'; position: absolute; top: 0; left: 18%; right: 8%; height: 1px; background: var(--rainbow); opacity: .35; }\n.stepper-item { font-size: 13px; font-weight: 400; }\n.stepper-item.active .dot { background: #c4abea; color: var(--void); border-color: var(--violet); box-shadow: 0 0 0 4px #a78bfa18,0 0 22px #a78bfa33; }\n.stepper-item .dot { background: #1b1027; border-color: #a78bfa38; }\n.sidebar-kicker, .aurora-eyebrow { color: #b8a1d6; }\n.step { max-width: 1050px; }\n.step h2, .page h2 { font-size: 28px; font-weight: 200; }\n.step-heading { margin-bottom: 24px; }\n.step-provider .step-heading { margin-bottom: 14px; }\n.step-heading .step-sub { margin: 10px 0 0; line-height: 1.8; }\n.step-heading .aurora-eyebrow { margin-bottom: 10px; }\n.design-icon { width: 22px; height: 22px; flex: none; color: #c4abea; }\n.welcome-layout { display: grid; grid-template-columns: minmax(0,1.12fr) minmax(240px,.88fr); gap: 34px; align-items: start; }\n.welcome-copy { min-width: 0; }\n.step-welcome h2 { font-size: 39px; line-height: 1.45; margin: 14px 0 22px; }\n.step-welcome h2 em { background-image: linear-gradient(100deg,#ece8e1,#ccb7f2 55%,#f1c3db); }\n.welcome-lead { font-size: 14px; line-height: 1.95; color: var(--muted); margin: 0 0 24px; }\n.value-list { display: grid; gap: 17px; margin: 25px 0; }\n.value-item { display: flex; gap: 12px; align-items: flex-start; }\n.value-item > .design-icon { width: 18px; height: 18px; margin-top: 4px; }\n.value-item strong { font-size: 14px; font-weight: 500; }\n.value-item p { color: var(--muted); font-size: 12px; line-height: 1.8; margin: 4px 0 0; }\n.welcome-art { padding: 25px 23px; border: 1px solid #a78bfa3d; border-radius: 13px; background: radial-gradient(ellipse at 70% 20%,#a78bfa2b,transparent 75%),linear-gradient(140deg,#38204490,#171125b3); box-shadow: 0 0 65px -22px #a78bfa40; }\n.art-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; gap: 12px; }\n.welcome-art h3 { font-size: 28px; font-weight: 200; line-height: 1.7; margin: 26px 0; }\n.example-window { padding: 15px; border: 1px solid #a78bfa35; border-radius: 10px; background: #100b1abf; box-shadow: 0 12px 40px #08040e55; transform: rotate(-1.5deg); }\n.example-title { display: flex; justify-content: space-between; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); font-size: 10px; color: var(--muted); }\n.example-title > span { font-size: 8px; white-space: nowrap; }\n.example-chat { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; }\n.example-chat.mine { justify-content: flex-end; }\n.example-bubble { padding: 9px 10px; border-radius: 8px; background: #06050c70; font-size: 11px; line-height: 1.85; }\n.mine .example-bubble { background: #a78bfa21; }\n.example-avatar { background: #a78bfa1c; color: #d2bcf5; border-radius: 5px; padding: 3px 6px; font-size: 11px; }\n.example-task { display: flex; align-items: center; gap: 7px; font-size: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 6px; margin: 15px 0 0 27px; }\n.example-task .design-icon { width: 14px; height: 14px; }\n.art-foot { color: var(--muted); font-size: 10px; line-height: 1.8; margin: 23px 0 0; }\n.design-details { border-top: 1px solid var(--border); margin: 17px 0; padding-top: 13px; font-size: 13px; }\n.design-details > summary { cursor: pointer; color: var(--muted); padding: 5px 0; overflow-wrap: anywhere; }\n.design-details > summary .chan-badge { vertical-align: middle; margin-right: 8px; }\n.design-details[open] > summary { margin-bottom: 16px; color: var(--bone); }\n.design-details .field { margin: 15px 0; }\n.welcome-settings { font-size: 11px; margin-top: 26px; }\n#w-directory-path { overflow-wrap: anywhere; margin-left: 6px; }\n.wiz-actions > .existing-panel { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 18px; align-items: center; margin: 0; padding: 12px 16px; line-height: 1.65; }\n.wiz-actions > .existing-panel > div { grid-column: 1; }\n.wiz-actions > .existing-panel > .actions { grid-column: 2; grid-row: 1 / span 2; margin: 0; }\n.wiz-actions > .existing-panel > div:nth-child(n+4) { grid-column: 1 / -1; }\n.existing-directory { overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }\n.existing-panel .actions .btn { white-space: nowrap; }\n.wiz-footer:has(.existing-panel:not([hidden])) .wiz-nav { display: none; }\n.welcome-settings .field > label { font-size: 13px; }\n.welcome-settings .hint { font-size: 12px; }\n.choice-stack { display: grid; gap: 12px; margin-bottom: 20px; }\n.choice-card, .service-option { border: 1px solid #a78bfa29; border-radius: 12px; background: linear-gradient(135deg,#251730a6,#140e2199); }\n.choice-card { padding: 19px 21px; color: var(--bone); text-align: left; width: 100%; cursor: pointer; transition: border-color .25s,background .25s; font: inherit; }\n.choice-card:hover { border-color: #a78bfa77; }\n.choice-card.selected, .service-option.selected { border-color: var(--violet); background: linear-gradient(130deg,#a78bfa26,#45254766); box-shadow: 0 0 0 1px #a78bfa18,0 0 30px #a78bfa13; }\n.service-option > .choice-card { background: transparent; border: 0; box-shadow: none; }\n.choice-top { display: flex; align-items: center; gap: 11px; font-size: 14px; }\n.choice-top strong { font-weight: 500; }\n.choice-badge { color: #d2bcf5; background: #a78bfa1c; border-radius: 5px; padding: 2px 7px; font-size: 10px; }\n.radio-mark { margin-left: auto; flex: none; width: 14px; height: 14px; border: 1px solid #a78bfa66; border-radius: 50%; }\n.selected .radio-mark { border: 4px solid var(--violet); }\n.choice-description { display: block; font-size: 12px; color: var(--muted); line-height: 1.85; margin-top: 10px; }\n.choice-description.hint { margin-top: 4px; font-size: 11px; }\n.service-option #p-free-block { padding: 0 21px 18px; border: 0; margin: 0; background: transparent; }\n.service-option #p-free-block > .hint { display: none; }\n#p-free-status { margin: 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--border); background: transparent; font-size: 12px; }\n#p-free-status[data-status=ok] { color: var(--green); }\n#p-paid { background: #130d1b99; border-color: var(--border); }\n.field > label { font-size: 14px; }\n.field .hint, .hint { font-size: 12px; }\n.field input, .field select, .field textarea { font-size: 14px; }\n.channel-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }\n.channel-options { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }\n.channel-options:has(details[open]) { grid-template-columns: 1fr; gap: 0; }\n.channel-options .design-details { margin-bottom: 0; }\n.channel-choice .chan-badge { background: #f3eff8; border-color: #c2b1cf; }\n.connection-preview { display: flex; align-items: center; gap: 18px; background: #a78bfa0e; padding: 17px 20px; border-radius: 9px; margin: 20px 0; }\n.connection-preview strong { font-size: 13px; font-weight: 500; }\n.connection-preview p { font-size: 12px; color: var(--muted); margin: 5px 0 0; }\n.skip-option { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); cursor: pointer; }\n.design-details .radio-row label { font-size: 13px; }\n.design-details .radio-row label .hint { font-size: 11px; }\n.persona-options { gap: 14px; }\n.persona-options .radio-card { position: relative; background: linear-gradient(135deg,#251730a6,#140e2199); padding: 16px 20px; margin-bottom: 0; }\n.persona-options .radio-card > input { position: absolute; right: 18px; top: 24px; }\n.persona-options .radio-card > .design-icon { width: 19px; height: 19px; vertical-align: middle; }\n.persona-options .radio-card > span { font-size: 14px; font-weight: 500 !important; margin-right: 18px; }\n.persona-options .radio-card > .hint { margin: 9px 0 0 !important; font-size: 12px; }\n.persona-example { border-top: 1px solid var(--border); margin: 10px 0 0; padding-top: 8px; color: #d2b5dd; font-size: 12px; line-height: 1.8; }\n.mode-section { display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--border); padding-top: 20px; margin-top: 22px; }\n.mode-section h3 { font-size: 16px; font-weight: 400; margin: 0 0 8px; }\n.mode-section p { font-size: 12px; line-height: 1.8; color: var(--muted); margin: 0; }\n.mode-section .mode-options { margin: 0; }\n.mode-options { display: flex; flex-wrap: wrap; gap: 9px; padding: 0; }\n.mode-options .radio-card { border-radius: 999px; padding: 9px 14px; }\n.mode-options .radio-card > span { font-size: 12px; }\n.mode-options .hint { display: none; }\n.face-layout { display: grid; grid-template-columns: minmax(0,1.5fr) minmax(190px,.8fr); gap: 27px; }\n.face-aside { background: #a78bfa0e; border: 1px solid #a78bfa38; border-radius: 12px; padding: 25px; }\n.face-aside h3 { font-size: 26px; font-weight: 200; line-height: 1.8; }\n.face-aside p { font-size: 13px; color: var(--muted); line-height: 1.9; }\n.upload-choice { border-style: dashed; padding: 20px; min-width: 160px; border-radius: 10px; background: #a78bfa0a; }\n.summary-table { background: linear-gradient(135deg,#251730a6,#140e2199); }\n.summary-table td { overflow-wrap: anywhere; }\n.summary-table input { max-width: 100%; }\n.review-value { display: flex; gap: 16px; align-items: baseline; justify-content: space-between; }\n.review-value > span { min-width: 0; overflow-wrap: anywhere; }\n.text-action { border: 0; background: transparent; color: #ccb6f4; font-size: 12px; padding: 4px; cursor: pointer; flex: none; }\n.footer-note { margin-right: auto; color: var(--muted); font-size: 12px; align-self: center; }\n.wiz-nav { align-items: center; }\n.wiz-nav .btn { font-size: 14px; white-space: nowrap; }\n.first-message { background: #a78bfa10; border: 1px solid #a78bfa40; padding: 24px; border-radius: 12px; margin-bottom: 25px; }\n.first-message h3 { font-size: 19px; font-weight: 400; margin: 0 0 14px; }\n.first-message p { font-size: 13px; color: var(--muted); line-height: 1.9; }\n.copy-message { display: flex; align-items: center; gap: 12px; justify-content: space-between; background: #0d091599; border: 1px solid var(--border); padding: 12px; border-radius: 9px; }\n.message-sample { font-size: 14px; user-select: text; }\n.copy-message .btn { font-size: 12px; min-height: 32px; padding: 4px 12px; }\n#sc-details .report-version { font-size: 20px; }\n.step-install .checklist { border: 1px solid var(--border); background: #130d1b99; border-radius: 12px; padding: 20px 25px; }\n.runtime-welcome { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 24px; margin: 22px 0; background: radial-gradient(ellipse at 80% 35%,#a78bfa26,transparent 80%),linear-gradient(130deg,#33203e80,#1b102a80); border: 1px solid #a78bfa40; border-radius: 12px; }\n.runtime-welcome h3 { font-size: 18px; font-weight: 400; margin: 0 0 9px; }\n.runtime-welcome p { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.9; }\n.runtime-welcome .btn { display: flex; align-items: center; gap: 10px; flex: none; white-space: nowrap; font-size: 13px; }\n.runtime-welcome .btn .design-icon { width: 17px; height: 17px; color: inherit; }\n.runtime-overview { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin: 24px 0; }\n.overview-card { min-width: 0; padding: 18px; background: linear-gradient(135deg,#251730a6,#140e2199); border: 1px solid #a78bfa29; border-radius: 10px; overflow-wrap: anywhere; }\n.overview-label { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); margin-bottom: 13px; }\n.overview-label .design-icon { width: 15px; height: 15px; }\n.overview-card > strong { font-size: 14px; font-weight: 500; display: block; line-height: 1.8; }\n.overview-card p { color: var(--muted); font-size: 11px; line-height: 1.8; }\n.overview-card .text-action { padding: 0; font-size: 11px; }\n.runtime-status-line { padding-top: 16px; border-top: 1px solid var(--border); }\n.runtime-status-line .state-badge { margin: 0 0 14px; }\n#runtime-details .report-version { font-size: 20px; }\n@media (max-height: 660px) and (min-width: 761px) {\n .step-welcome h2 { font-size: 32px; margin: 10px 0 15px; line-height: 1.35; }\n .welcome-lead { margin-bottom: 16px; }\n .value-list { margin: 18px 0; gap: 12px; }\n .welcome-settings { margin-top: 18px; }\n .welcome-art h3 { font-size: 24px; margin: 18px 0; line-height: 1.55; }\n .art-foot { margin-top: 16px; }\n}\n@media (max-width: 960px) {\n #app { grid-template-columns: 165px minmax(0,1fr); }\n .wiz-sidebar { padding: 26px 16px 20px; }\n .wiz-body { padding: 28px; }\n .wiz-footer { padding: 14px 28px; }\n .stepper-item { font-size: 12px; gap: 9px; }\n .welcome-layout { grid-template-columns: minmax(0,1fr) minmax(230px,.9fr); gap: 23px; }\n .step-welcome h2 { font-size: 33px; }\n .welcome-art { padding: 20px 16px; }\n .welcome-art h3 { font-size: 25px; }\n .welcome-lead { font-size: 13px; }\n .value-item strong { font-size: 13px; }\n .value-item p { font-size: 11px; }\n .choice-card { padding: 17px; }\n .choice-top { gap: 8px; }\n .footer-note { font-size: 11px; }\n}\n@media (max-width: 760px) {\n .welcome-layout, .face-layout { grid-template-columns: 1fr; }\n .welcome-art { max-width: 440px; }\n .mode-section { flex-direction: column; align-items: flex-start; }\n .channel-grid, .channel-options { grid-template-columns: 1fr; }\n .footer-note { display: none; }\n .runtime-welcome { flex-direction: column; align-items: flex-start; }\n .runtime-overview { grid-template-columns: 1fr; }\n}\n\n/* Native title-bar buttons sit inside the same 66px black-purple header. */\n[data-window-chrome] .wiz-header, [data-window-chrome] .console-header {\n background: #0f0919;\n -webkit-app-region: drag;\n user-select: none;\n}\n[data-window-chrome] .chrome-actions button, [data-window-chrome] header a {\n -webkit-app-region: no-drag;\n}\n[data-window-chrome=darwin] .wiz-header, [data-window-chrome=darwin] .console-header { padding-left: 104px; }\n[data-window-chrome=win32] .wiz-header, [data-window-chrome=win32] .console-header,\n[data-window-chrome=linux] .wiz-header, [data-window-chrome=linux] .console-header {\n padding-right: max(160px, calc(100vw - env(titlebar-area-width, 100vw) + 16px));\n}\n@media (max-width: 760px) {\n [data-window-chrome] .window-purpose { display: none; }\n}\n\n/* Existing-partner choices are always visible, including on a small window. */\n.wiz-actions > .existing-panel { display: block; padding: 10px 14px; }\n.wiz-actions > .existing-panel > .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }\n.existing-panel .existing-directory { font-size: 12px; overflow-wrap: anywhere; }\n.existing-panel .existing-directory select { max-width: 100%; margin-right: 8px; }\n.existing-panel .hint { font-size: 12px; margin-top: 5px; }\n\n.additional-platform { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; font-size: 13px; }\n.step-channels .connection-preview { margin: 8px 0; padding: 12px 18px; }\n.step-channels .channel-grid { margin-bottom: 8px; }\n\n/* Native buttons provide keyboard navigation for previously visited settings. */\nbutton.stepper-item { width: 100%; text-align: left; border: 0; border-radius: 4px; background: transparent; font-family: inherit; }\nbutton.stepper-item:disabled { cursor: default; opacity: 1; }\nbutton.stepper-item:not(:disabled) { cursor: pointer; }\nbutton.stepper-item:not(:disabled):hover { color: var(--bone); }\nbutton.stepper-item:focus-visible { outline: 2px solid var(--violet); outline-offset: 4px; }\n\n/* Chat uses final Aurora values; aliases do not alter existing pages. */\n:root {\n --mute: var(--muted);\n --teal: var(--green);\n --chat-bg: var(--void);\n --chat-surface: var(--panel);\n --chat-header: color-mix(in srgb, var(--void) 94%, transparent);\n --chat-bubble: color-mix(in srgb, var(--panel) 92%, var(--bone));\n --chat-user: color-mix(in srgb, var(--violet) 20%, var(--panel));\n --chat-line: var(--border);\n --chat-soft: color-mix(in srgb, var(--bone) 9%, transparent);\n --chat-faint: color-mix(in srgb, var(--bone) 45%, var(--void));\n --chat-elevated: color-mix(in srgb, var(--panel) 93%, var(--violet));\n --chat-avatar: color-mix(in srgb, var(--surface) 92%, var(--violet));\n --chat-glow: color-mix(in srgb, var(--violet) 10%, transparent);\n --chat-scrim: color-mix(in srgb, var(--void) 78%, transparent);\n --chat-shadow: color-mix(in srgb, var(--void) 85%, transparent);\n}\n\nhtml,body{height:100dvh} .web-login{position:fixed;inset:0;z-index:1000;background:#040408ed;display:grid;place-items:center}.web-login form{max-width:380px;padding:32px;border:1px solid var(--border);border-radius:20px;background:var(--panel)}.web-login input{width:100%;margin:20px 0;padding:12px;background:var(--void);color:var(--bone);border:1px solid var(--border);border-radius:9px}.web-terminal{max-width:850px}.web-terminal pre{height:50vh}.term-row{display:flex;gap:10px}.term-row input{flex:1;min-width:0;padding:12px;color:var(--bone);background:var(--panel);border:1px solid var(--border);border-radius:9px}</style></head>\n<body>\n <!-- \u6258\u76D8\u63A7\u5236\u53F0\uFF1A\u4FA7\u680F\uFF08\u72B6\u6001/\u901A\u9053/\u65E5\u5FD7 + \u4E8C\u671F\u5360\u4F4D\uFF09+ \u9875\u5BB9\u5668 -->\n <div id="console-app">\n <header class="console-header"><div class="wiz-title"><img class="engine-mark" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJnbG93IiB4MT0iOCIgeTE9IjgiIHgyPSI1MiIgeTI9IjUyIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agc3RvcC1jb2xvcj0iIzZlY2RmZiIvPjxzdG9wIG9mZnNldD0iLjM0IiBzdG9wLWNvbG9yPSIjYTc4YmZhIi8+PHN0b3Agb2Zmc2V0PSIuNjgiIHN0b3AtY29sb3I9IiNmZjZiOWQiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmZmNmOGEiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48Y2lyY2xlIGN4PSIxMiIgY3k9IjE3IiByPSI0LjUiIGZpbGw9InVybCgjZ2xvdykiLz48cGF0aCBkPSJNMjUgMTdoMjdMMjkgNTEiIHN0cm9rZT0idXJsKCNnbG93KSIgc3Ryb2tlLXdpZHRoPSI4IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4K" alt="" width="29" height="29"><span class="engine-wordmark" aria-label="Engine7 \xB7 \u6816">engine7<span class="brand-separator" aria-hidden="true">\xB7</span><span class="brand-qi" title="7\uFF0C\u4EA6\u662F\u300C\u6816\u300D">\u6816</span></span><span class="window-purpose">\u63A7\u5236\u53F0</span></div><div class="chrome-actions"><span class="window-context" aria-live="polite">\u4F19\u4F34\u7684\u65E5\u5E38\uFF0C\u5728\u8FD9\u91CC\u7EE7\u7EED</span><button class="aurora-motion" type="button" data-aurora-control aria-pressed="false" aria-label="\u5173\u95ED\u88C5\u9970\u52A8\u6548">\u25CC</button></div>\n </header>\n <aside class="sidebar">\n\n <!-- \u5355\u4F19\u4F34\u8EAB\u4EFD\u540D\u7247\uFF1B\u591A\u4F19\u4F34\u4F7F\u7528\u7D27\u51D1\u9009\u62E9\u5668\u3002 -->\n <div id="console-engines-slot" class="engine-picker"></div>\n <div id="console-nav-slot"></div><div class="sidebar-mark"><img class="engine-mark" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2NCA2NCIgZmlsbD0ibm9uZSI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJnbG93IiB4MT0iOCIgeTE9IjgiIHgyPSI1MiIgeTI9IjUyIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+PHN0b3Agc3RvcC1jb2xvcj0iIzZlY2RmZiIvPjxzdG9wIG9mZnNldD0iLjM0IiBzdG9wLWNvbG9yPSIjYTc4YmZhIi8+PHN0b3Agb2Zmc2V0PSIuNjgiIHN0b3AtY29sb3I9IiNmZjZiOWQiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmZmNmOGEiLz48L2xpbmVhckdyYWRpZW50PjwvZGVmcz48Y2lyY2xlIGN4PSIxMiIgY3k9IjE3IiByPSI0LjUiIGZpbGw9InVybCgjZ2xvdykiLz48cGF0aCBkPSJNMjUgMTdoMjdMMjkgNTEiIHN0cm9rZT0idXJsKCNnbG93KSIgc3Ryb2tlLXdpZHRoPSI4IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4K" alt="" width="25" height="25">by TWINSUN</div>\n </aside>\n <div id="console-body-slot" class="console-body-slot"></div>\n </div>\n <div id="console-modal" class="modal-mask" hidden></div>\n <script>"use strict";\n(() => {\n var __create = Object.create;\n var __defProp = Object.defineProperty;\n var __getOwnPropDesc = Object.getOwnPropertyDescriptor;\n var __getOwnPropNames = Object.getOwnPropertyNames;\n var __getProtoOf = Object.getPrototypeOf;\n var __hasOwnProp = Object.prototype.hasOwnProperty;\n var __commonJS = (cb, mod) => function __require() {\n return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;\n };\n var __copyProps = (to, from, except, desc) => {\n if (from && typeof from === "object" || typeof from === "function") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n };\n var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(\n // If the importer is in node compatibility mode or this is not an ESM\n // file that has been converted to a CommonJS file using a Babel-\n // compatible transform (i.e. "__esModule" has not been set), then set\n // "default" to the CommonJS "module.exports" for node compatibility.\n isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,\n mod\n ));\n\n // node_modules/qrcode/lib/can-promise.js\n var require_can_promise = __commonJS({\n "node_modules/qrcode/lib/can-promise.js"(exports, module) {\n module.exports = function() {\n return typeof Promise === "function" && Promise.prototype && Promise.prototype.then;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/utils.js\n var require_utils = __commonJS({\n "node_modules/qrcode/lib/core/utils.js"(exports) {\n var toSJISFunction;\n var CODEWORDS_COUNT = [\n 0,\n // Not used\n 26,\n 44,\n 70,\n 100,\n 134,\n 172,\n 196,\n 242,\n 292,\n 346,\n 404,\n 466,\n 532,\n 581,\n 655,\n 733,\n 815,\n 901,\n 991,\n 1085,\n 1156,\n 1258,\n 1364,\n 1474,\n 1588,\n 1706,\n 1828,\n 1921,\n 2051,\n 2185,\n 2323,\n 2465,\n 2611,\n 2761,\n 2876,\n 3034,\n 3196,\n 3362,\n 3532,\n 3706\n ];\n exports.getSymbolSize = function getSymbolSize(version) {\n if (!version) throw new Error(\'"version" cannot be null or undefined\');\n if (version < 1 || version > 40) throw new Error(\'"version" should be in range from 1 to 40\');\n return version * 4 + 17;\n };\n exports.getSymbolTotalCodewords = function getSymbolTotalCodewords(version) {\n return CODEWORDS_COUNT[version];\n };\n exports.getBCHDigit = function(data) {\n let digit = 0;\n while (data !== 0) {\n digit++;\n data >>>= 1;\n }\n return digit;\n };\n exports.setToSJISFunction = function setToSJISFunction(f) {\n if (typeof f !== "function") {\n throw new Error(\'"toSJISFunc" is not a valid function.\');\n }\n toSJISFunction = f;\n };\n exports.isKanjiModeEnabled = function() {\n return typeof toSJISFunction !== "undefined";\n };\n exports.toSJIS = function toSJIS(kanji) {\n return toSJISFunction(kanji);\n };\n }\n });\n\n // node_modules/qrcode/lib/core/error-correction-level.js\n var require_error_correction_level = __commonJS({\n "node_modules/qrcode/lib/core/error-correction-level.js"(exports) {\n exports.L = { bit: 1 };\n exports.M = { bit: 0 };\n exports.Q = { bit: 3 };\n exports.H = { bit: 2 };\n function fromString(string) {\n if (typeof string !== "string") {\n throw new Error("Param is not a string");\n }\n const lcStr = string.toLowerCase();\n switch (lcStr) {\n case "l":\n case "low":\n return exports.L;\n case "m":\n case "medium":\n return exports.M;\n case "q":\n case "quartile":\n return exports.Q;\n case "h":\n case "high":\n return exports.H;\n default:\n throw new Error("Unknown EC Level: " + string);\n }\n }\n exports.isValid = function isValid(level) {\n return level && typeof level.bit !== "undefined" && level.bit >= 0 && level.bit < 4;\n };\n exports.from = function from(value, defaultValue) {\n if (exports.isValid(value)) {\n return value;\n }\n try {\n return fromString(value);\n } catch (e) {\n return defaultValue;\n }\n };\n }\n });\n\n // node_modules/qrcode/lib/core/bit-buffer.js\n var require_bit_buffer = __commonJS({\n "node_modules/qrcode/lib/core/bit-buffer.js"(exports, module) {\n function BitBuffer() {\n this.buffer = [];\n this.length = 0;\n }\n BitBuffer.prototype = {\n get: function(index) {\n const bufIndex = Math.floor(index / 8);\n return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) === 1;\n },\n put: function(num, length) {\n for (let i = 0; i < length; i++) {\n this.putBit((num >>> length - i - 1 & 1) === 1);\n }\n },\n getLengthInBits: function() {\n return this.length;\n },\n putBit: function(bit) {\n const bufIndex = Math.floor(this.length / 8);\n if (this.buffer.length <= bufIndex) {\n this.buffer.push(0);\n }\n if (bit) {\n this.buffer[bufIndex] |= 128 >>> this.length % 8;\n }\n this.length++;\n }\n };\n module.exports = BitBuffer;\n }\n });\n\n // node_modules/qrcode/lib/core/bit-matrix.js\n var require_bit_matrix = __commonJS({\n "node_modules/qrcode/lib/core/bit-matrix.js"(exports, module) {\n function BitMatrix(size) {\n if (!size || size < 1) {\n throw new Error("BitMatrix size must be defined and greater than 0");\n }\n this.size = size;\n this.data = new Uint8Array(size * size);\n this.reservedBit = new Uint8Array(size * size);\n }\n BitMatrix.prototype.set = function(row, col, value, reserved) {\n const index = row * this.size + col;\n this.data[index] = value;\n if (reserved) this.reservedBit[index] = true;\n };\n BitMatrix.prototype.get = function(row, col) {\n return this.data[row * this.size + col];\n };\n BitMatrix.prototype.xor = function(row, col, value) {\n this.data[row * this.size + col] ^= value;\n };\n BitMatrix.prototype.isReserved = function(row, col) {\n return this.reservedBit[row * this.size + col];\n };\n module.exports = BitMatrix;\n }\n });\n\n // node_modules/qrcode/lib/core/alignment-pattern.js\n var require_alignment_pattern = __commonJS({\n "node_modules/qrcode/lib/core/alignment-pattern.js"(exports) {\n var getSymbolSize = require_utils().getSymbolSize;\n exports.getRowColCoords = function getRowColCoords(version) {\n if (version === 1) return [];\n const posCount = Math.floor(version / 7) + 2;\n const size = getSymbolSize(version);\n const intervals = size === 145 ? 26 : Math.ceil((size - 13) / (2 * posCount - 2)) * 2;\n const positions = [size - 7];\n for (let i = 1; i < posCount - 1; i++) {\n positions[i] = positions[i - 1] - intervals;\n }\n positions.push(6);\n return positions.reverse();\n };\n exports.getPositions = function getPositions(version) {\n const coords = [];\n const pos = exports.getRowColCoords(version);\n const posLength = pos.length;\n for (let i = 0; i < posLength; i++) {\n for (let j = 0; j < posLength; j++) {\n if (i === 0 && j === 0 || // top-left\n i === 0 && j === posLength - 1 || // bottom-left\n i === posLength - 1 && j === 0) {\n continue;\n }\n coords.push([pos[i], pos[j]]);\n }\n }\n return coords;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/finder-pattern.js\n var require_finder_pattern = __commonJS({\n "node_modules/qrcode/lib/core/finder-pattern.js"(exports) {\n var getSymbolSize = require_utils().getSymbolSize;\n var FINDER_PATTERN_SIZE = 7;\n exports.getPositions = function getPositions(version) {\n const size = getSymbolSize(version);\n return [\n // top-left\n [0, 0],\n // top-right\n [size - FINDER_PATTERN_SIZE, 0],\n // bottom-left\n [0, size - FINDER_PATTERN_SIZE]\n ];\n };\n }\n });\n\n // node_modules/qrcode/lib/core/mask-pattern.js\n var require_mask_pattern = __commonJS({\n "node_modules/qrcode/lib/core/mask-pattern.js"(exports) {\n exports.Patterns = {\n PATTERN000: 0,\n PATTERN001: 1,\n PATTERN010: 2,\n PATTERN011: 3,\n PATTERN100: 4,\n PATTERN101: 5,\n PATTERN110: 6,\n PATTERN111: 7\n };\n var PenaltyScores = {\n N1: 3,\n N2: 3,\n N3: 40,\n N4: 10\n };\n exports.isValid = function isValid(mask) {\n return mask != null && mask !== "" && !isNaN(mask) && mask >= 0 && mask <= 7;\n };\n exports.from = function from(value) {\n return exports.isValid(value) ? parseInt(value, 10) : void 0;\n };\n exports.getPenaltyN1 = function getPenaltyN1(data) {\n const size = data.size;\n let points = 0;\n let sameCountCol = 0;\n let sameCountRow = 0;\n let lastCol = null;\n let lastRow = null;\n for (let row = 0; row < size; row++) {\n sameCountCol = sameCountRow = 0;\n lastCol = lastRow = null;\n for (let col = 0; col < size; col++) {\n let module2 = data.get(row, col);\n if (module2 === lastCol) {\n sameCountCol++;\n } else {\n if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);\n lastCol = module2;\n sameCountCol = 1;\n }\n module2 = data.get(col, row);\n if (module2 === lastRow) {\n sameCountRow++;\n } else {\n if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);\n lastRow = module2;\n sameCountRow = 1;\n }\n }\n if (sameCountCol >= 5) points += PenaltyScores.N1 + (sameCountCol - 5);\n if (sameCountRow >= 5) points += PenaltyScores.N1 + (sameCountRow - 5);\n }\n return points;\n };\n exports.getPenaltyN2 = function getPenaltyN2(data) {\n const size = data.size;\n let points = 0;\n for (let row = 0; row < size - 1; row++) {\n for (let col = 0; col < size - 1; col++) {\n const last = data.get(row, col) + data.get(row, col + 1) + data.get(row + 1, col) + data.get(row + 1, col + 1);\n if (last === 4 || last === 0) points++;\n }\n }\n return points * PenaltyScores.N2;\n };\n exports.getPenaltyN3 = function getPenaltyN3(data) {\n const size = data.size;\n let points = 0;\n let bitsCol = 0;\n let bitsRow = 0;\n for (let row = 0; row < size; row++) {\n bitsCol = bitsRow = 0;\n for (let col = 0; col < size; col++) {\n bitsCol = bitsCol << 1 & 2047 | data.get(row, col);\n if (col >= 10 && (bitsCol === 1488 || bitsCol === 93)) points++;\n bitsRow = bitsRow << 1 & 2047 | data.get(col, row);\n if (col >= 10 && (bitsRow === 1488 || bitsRow === 93)) points++;\n }\n }\n return points * PenaltyScores.N3;\n };\n exports.getPenaltyN4 = function getPenaltyN4(data) {\n let darkCount = 0;\n const modulesCount = data.data.length;\n for (let i = 0; i < modulesCount; i++) darkCount += data.data[i];\n const k = Math.abs(Math.ceil(darkCount * 100 / modulesCount / 5) - 10);\n return k * PenaltyScores.N4;\n };\n function getMaskAt(maskPattern, i, j) {\n switch (maskPattern) {\n case exports.Patterns.PATTERN000:\n return (i + j) % 2 === 0;\n case exports.Patterns.PATTERN001:\n return i % 2 === 0;\n case exports.Patterns.PATTERN010:\n return j % 3 === 0;\n case exports.Patterns.PATTERN011:\n return (i + j) % 3 === 0;\n case exports.Patterns.PATTERN100:\n return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 === 0;\n case exports.Patterns.PATTERN101:\n return i * j % 2 + i * j % 3 === 0;\n case exports.Patterns.PATTERN110:\n return (i * j % 2 + i * j % 3) % 2 === 0;\n case exports.Patterns.PATTERN111:\n return (i * j % 3 + (i + j) % 2) % 2 === 0;\n default:\n throw new Error("bad maskPattern:" + maskPattern);\n }\n }\n exports.applyMask = function applyMask(pattern, data) {\n const size = data.size;\n for (let col = 0; col < size; col++) {\n for (let row = 0; row < size; row++) {\n if (data.isReserved(row, col)) continue;\n data.xor(row, col, getMaskAt(pattern, row, col));\n }\n }\n };\n exports.getBestMask = function getBestMask(data, setupFormatFunc) {\n const numPatterns = Object.keys(exports.Patterns).length;\n let bestPattern = 0;\n let lowerPenalty = Infinity;\n for (let p = 0; p < numPatterns; p++) {\n setupFormatFunc(p);\n exports.applyMask(p, data);\n const penalty = exports.getPenaltyN1(data) + exports.getPenaltyN2(data) + exports.getPenaltyN3(data) + exports.getPenaltyN4(data);\n exports.applyMask(p, data);\n if (penalty < lowerPenalty) {\n lowerPenalty = penalty;\n bestPattern = p;\n }\n }\n return bestPattern;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/error-correction-code.js\n var require_error_correction_code = __commonJS({\n "node_modules/qrcode/lib/core/error-correction-code.js"(exports) {\n var ECLevel = require_error_correction_level();\n var EC_BLOCKS_TABLE = [\n // L M Q H\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 1,\n 2,\n 2,\n 1,\n 2,\n 2,\n 4,\n 1,\n 2,\n 4,\n 4,\n 2,\n 4,\n 4,\n 4,\n 2,\n 4,\n 6,\n 5,\n 2,\n 4,\n 6,\n 6,\n 2,\n 5,\n 8,\n 8,\n 4,\n 5,\n 8,\n 8,\n 4,\n 5,\n 8,\n 11,\n 4,\n 8,\n 10,\n 11,\n 4,\n 9,\n 12,\n 16,\n 4,\n 9,\n 16,\n 16,\n 6,\n 10,\n 12,\n 18,\n 6,\n 10,\n 17,\n 16,\n 6,\n 11,\n 16,\n 19,\n 6,\n 13,\n 18,\n 21,\n 7,\n 14,\n 21,\n 25,\n 8,\n 16,\n 20,\n 25,\n 8,\n 17,\n 23,\n 25,\n 9,\n 17,\n 23,\n 34,\n 9,\n 18,\n 25,\n 30,\n 10,\n 20,\n 27,\n 32,\n 12,\n 21,\n 29,\n 35,\n 12,\n 23,\n 34,\n 37,\n 12,\n 25,\n 34,\n 40,\n 13,\n 26,\n 35,\n 42,\n 14,\n 28,\n 38,\n 45,\n 15,\n 29,\n 40,\n 48,\n 16,\n 31,\n 43,\n 51,\n 17,\n 33,\n 45,\n 54,\n 18,\n 35,\n 48,\n 57,\n 19,\n 37,\n 51,\n 60,\n 19,\n 38,\n 53,\n 63,\n 20,\n 40,\n 56,\n 66,\n 21,\n 43,\n 59,\n 70,\n 22,\n 45,\n 62,\n 74,\n 24,\n 47,\n 65,\n 77,\n 25,\n 49,\n 68,\n 81\n ];\n var EC_CODEWORDS_TABLE = [\n // L M Q H\n 7,\n 10,\n 13,\n 17,\n 10,\n 16,\n 22,\n 28,\n 15,\n 26,\n 36,\n 44,\n 20,\n 36,\n 52,\n 64,\n 26,\n 48,\n 72,\n 88,\n 36,\n 64,\n 96,\n 112,\n 40,\n 72,\n 108,\n 130,\n 48,\n 88,\n 132,\n 156,\n 60,\n 110,\n 160,\n 192,\n 72,\n 130,\n 192,\n 224,\n 80,\n 150,\n 224,\n 264,\n 96,\n 176,\n 260,\n 308,\n 104,\n 198,\n 288,\n 352,\n 120,\n 216,\n 320,\n 384,\n 132,\n 240,\n 360,\n 432,\n 144,\n 280,\n 408,\n 480,\n 168,\n 308,\n 448,\n 532,\n 180,\n 338,\n 504,\n 588,\n 196,\n 364,\n 546,\n 650,\n 224,\n 416,\n 600,\n 700,\n 224,\n 442,\n 644,\n 750,\n 252,\n 476,\n 690,\n 816,\n 270,\n 504,\n 750,\n 900,\n 300,\n 560,\n 810,\n 960,\n 312,\n 588,\n 870,\n 1050,\n 336,\n 644,\n 952,\n 1110,\n 360,\n 700,\n 1020,\n 1200,\n 390,\n 728,\n 1050,\n 1260,\n 420,\n 784,\n 1140,\n 1350,\n 450,\n 812,\n 1200,\n 1440,\n 480,\n 868,\n 1290,\n 1530,\n 510,\n 924,\n 1350,\n 1620,\n 540,\n 980,\n 1440,\n 1710,\n 570,\n 1036,\n 1530,\n 1800,\n 570,\n 1064,\n 1590,\n 1890,\n 600,\n 1120,\n 1680,\n 1980,\n 630,\n 1204,\n 1770,\n 2100,\n 660,\n 1260,\n 1860,\n 2220,\n 720,\n 1316,\n 1950,\n 2310,\n 750,\n 1372,\n 2040,\n 2430\n ];\n exports.getBlocksCount = function getBlocksCount(version, errorCorrectionLevel) {\n switch (errorCorrectionLevel) {\n case ECLevel.L:\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 0];\n case ECLevel.M:\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 1];\n case ECLevel.Q:\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 2];\n case ECLevel.H:\n return EC_BLOCKS_TABLE[(version - 1) * 4 + 3];\n default:\n return void 0;\n }\n };\n exports.getTotalCodewordsCount = function getTotalCodewordsCount(version, errorCorrectionLevel) {\n switch (errorCorrectionLevel) {\n case ECLevel.L:\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 0];\n case ECLevel.M:\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 1];\n case ECLevel.Q:\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 2];\n case ECLevel.H:\n return EC_CODEWORDS_TABLE[(version - 1) * 4 + 3];\n default:\n return void 0;\n }\n };\n }\n });\n\n // node_modules/qrcode/lib/core/galois-field.js\n var require_galois_field = __commonJS({\n "node_modules/qrcode/lib/core/galois-field.js"(exports) {\n var EXP_TABLE = new Uint8Array(512);\n var LOG_TABLE = new Uint8Array(256);\n (function initTables() {\n let x = 1;\n for (let i = 0; i < 255; i++) {\n EXP_TABLE[i] = x;\n LOG_TABLE[x] = i;\n x <<= 1;\n if (x & 256) {\n x ^= 285;\n }\n }\n for (let i = 255; i < 512; i++) {\n EXP_TABLE[i] = EXP_TABLE[i - 255];\n }\n })();\n exports.log = function log(n) {\n if (n < 1) throw new Error("log(" + n + ")");\n return LOG_TABLE[n];\n };\n exports.exp = function exp(n) {\n return EXP_TABLE[n];\n };\n exports.mul = function mul(x, y) {\n if (x === 0 || y === 0) return 0;\n return EXP_TABLE[LOG_TABLE[x] + LOG_TABLE[y]];\n };\n }\n });\n\n // node_modules/qrcode/lib/core/polynomial.js\n var require_polynomial = __commonJS({\n "node_modules/qrcode/lib/core/polynomial.js"(exports) {\n var GF = require_galois_field();\n exports.mul = function mul(p1, p2) {\n const coeff = new Uint8Array(p1.length + p2.length - 1);\n for (let i = 0; i < p1.length; i++) {\n for (let j = 0; j < p2.length; j++) {\n coeff[i + j] ^= GF.mul(p1[i], p2[j]);\n }\n }\n return coeff;\n };\n exports.mod = function mod(divident, divisor) {\n let result = new Uint8Array(divident);\n while (result.length - divisor.length >= 0) {\n const coeff = result[0];\n for (let i = 0; i < divisor.length; i++) {\n result[i] ^= GF.mul(divisor[i], coeff);\n }\n let offset = 0;\n while (offset < result.length && result[offset] === 0) offset++;\n result = result.slice(offset);\n }\n return result;\n };\n exports.generateECPolynomial = function generateECPolynomial(degree) {\n let poly = new Uint8Array([1]);\n for (let i = 0; i < degree; i++) {\n poly = exports.mul(poly, new Uint8Array([1, GF.exp(i)]));\n }\n return poly;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/reed-solomon-encoder.js\n var require_reed_solomon_encoder = __commonJS({\n "node_modules/qrcode/lib/core/reed-solomon-encoder.js"(exports, module) {\n var Polynomial = require_polynomial();\n function ReedSolomonEncoder(degree) {\n this.genPoly = void 0;\n this.degree = degree;\n if (this.degree) this.initialize(this.degree);\n }\n ReedSolomonEncoder.prototype.initialize = function initialize(degree) {\n this.degree = degree;\n this.genPoly = Polynomial.generateECPolynomial(this.degree);\n };\n ReedSolomonEncoder.prototype.encode = function encode(data) {\n if (!this.genPoly) {\n throw new Error("Encoder not initialized");\n }\n const paddedData = new Uint8Array(data.length + this.degree);\n paddedData.set(data);\n const remainder = Polynomial.mod(paddedData, this.genPoly);\n const start = this.degree - remainder.length;\n if (start > 0) {\n const buff = new Uint8Array(this.degree);\n buff.set(remainder, start);\n return buff;\n }\n return remainder;\n };\n module.exports = ReedSolomonEncoder;\n }\n });\n\n // node_modules/qrcode/lib/core/version-check.js\n var require_version_check = __commonJS({\n "node_modules/qrcode/lib/core/version-check.js"(exports) {\n exports.isValid = function isValid(version) {\n return !isNaN(version) && version >= 1 && version <= 40;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/regex.js\n var require_regex = __commonJS({\n "node_modules/qrcode/lib/core/regex.js"(exports) {\n var numeric = "[0-9]+";\n var alphanumeric = "[A-Z $%*+\\\\-./:]+";\n var kanji = "(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";\n kanji = kanji.replace(/u/g, "\\\\u");\n var byte = "(?:(?![A-Z0-9 $%*+\\\\-./:]|" + kanji + ")(?:.|[\\r\\n]))+";\n exports.KANJI = new RegExp(kanji, "g");\n exports.BYTE_KANJI = new RegExp("[^A-Z0-9 $%*+\\\\-./:]+", "g");\n exports.BYTE = new RegExp(byte, "g");\n exports.NUMERIC = new RegExp(numeric, "g");\n exports.ALPHANUMERIC = new RegExp(alphanumeric, "g");\n var TEST_KANJI = new RegExp("^" + kanji + "$");\n var TEST_NUMERIC = new RegExp("^" + numeric + "$");\n var TEST_ALPHANUMERIC = new RegExp("^[A-Z0-9 $%*+\\\\-./:]+$");\n exports.testKanji = function testKanji(str) {\n return TEST_KANJI.test(str);\n };\n exports.testNumeric = function testNumeric(str) {\n return TEST_NUMERIC.test(str);\n };\n exports.testAlphanumeric = function testAlphanumeric(str) {\n return TEST_ALPHANUMERIC.test(str);\n };\n }\n });\n\n // node_modules/qrcode/lib/core/mode.js\n var require_mode = __commonJS({\n "node_modules/qrcode/lib/core/mode.js"(exports) {\n var VersionCheck = require_version_check();\n var Regex = require_regex();\n exports.NUMERIC = {\n id: "Numeric",\n bit: 1 << 0,\n ccBits: [10, 12, 14]\n };\n exports.ALPHANUMERIC = {\n id: "Alphanumeric",\n bit: 1 << 1,\n ccBits: [9, 11, 13]\n };\n exports.BYTE = {\n id: "Byte",\n bit: 1 << 2,\n ccBits: [8, 16, 16]\n };\n exports.KANJI = {\n id: "Kanji",\n bit: 1 << 3,\n ccBits: [8, 10, 12]\n };\n exports.MIXED = {\n bit: -1\n };\n exports.getCharCountIndicator = function getCharCountIndicator(mode, version) {\n if (!mode.ccBits) throw new Error("Invalid mode: " + mode);\n if (!VersionCheck.isValid(version)) {\n throw new Error("Invalid version: " + version);\n }\n if (version >= 1 && version < 10) return mode.ccBits[0];\n else if (version < 27) return mode.ccBits[1];\n return mode.ccBits[2];\n };\n exports.getBestModeForData = function getBestModeForData(dataStr) {\n if (Regex.testNumeric(dataStr)) return exports.NUMERIC;\n else if (Regex.testAlphanumeric(dataStr)) return exports.ALPHANUMERIC;\n else if (Regex.testKanji(dataStr)) return exports.KANJI;\n else return exports.BYTE;\n };\n exports.toString = function toString(mode) {\n if (mode && mode.id) return mode.id;\n throw new Error("Invalid mode");\n };\n exports.isValid = function isValid(mode) {\n return mode && mode.bit && mode.ccBits;\n };\n function fromString(string) {\n if (typeof string !== "string") {\n throw new Error("Param is not a string");\n }\n const lcStr = string.toLowerCase();\n switch (lcStr) {\n case "numeric":\n return exports.NUMERIC;\n case "alphanumeric":\n return exports.ALPHANUMERIC;\n case "kanji":\n return exports.KANJI;\n case "byte":\n return exports.BYTE;\n default:\n throw new Error("Unknown mode: " + string);\n }\n }\n exports.from = function from(value, defaultValue) {\n if (exports.isValid(value)) {\n return value;\n }\n try {\n return fromString(value);\n } catch (e) {\n return defaultValue;\n }\n };\n }\n });\n\n // node_modules/qrcode/lib/core/version.js\n var require_version = __commonJS({\n "node_modules/qrcode/lib/core/version.js"(exports) {\n var Utils = require_utils();\n var ECCode = require_error_correction_code();\n var ECLevel = require_error_correction_level();\n var Mode = require_mode();\n var VersionCheck = require_version_check();\n var G18 = 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0;\n var G18_BCH = Utils.getBCHDigit(G18);\n function getBestVersionForDataLength(mode, length, errorCorrectionLevel) {\n for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {\n if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, mode)) {\n return currentVersion;\n }\n }\n return void 0;\n }\n function getReservedBitsCount(mode, version) {\n return Mode.getCharCountIndicator(mode, version) + 4;\n }\n function getTotalBitsFromDataArray(segments, version) {\n let totalBits = 0;\n segments.forEach(function(data) {\n const reservedBits = getReservedBitsCount(data.mode, version);\n totalBits += reservedBits + data.getBitsLength();\n });\n return totalBits;\n }\n function getBestVersionForMixedData(segments, errorCorrectionLevel) {\n for (let currentVersion = 1; currentVersion <= 40; currentVersion++) {\n const length = getTotalBitsFromDataArray(segments, currentVersion);\n if (length <= exports.getCapacity(currentVersion, errorCorrectionLevel, Mode.MIXED)) {\n return currentVersion;\n }\n }\n return void 0;\n }\n exports.from = function from(value, defaultValue) {\n if (VersionCheck.isValid(value)) {\n return parseInt(value, 10);\n }\n return defaultValue;\n };\n exports.getCapacity = function getCapacity(version, errorCorrectionLevel, mode) {\n if (!VersionCheck.isValid(version)) {\n throw new Error("Invalid QR Code version");\n }\n if (typeof mode === "undefined") mode = Mode.BYTE;\n const totalCodewords = Utils.getSymbolTotalCodewords(version);\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);\n const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;\n if (mode === Mode.MIXED) return dataTotalCodewordsBits;\n const usableBits = dataTotalCodewordsBits - getReservedBitsCount(mode, version);\n switch (mode) {\n case Mode.NUMERIC:\n return Math.floor(usableBits / 10 * 3);\n case Mode.ALPHANUMERIC:\n return Math.floor(usableBits / 11 * 2);\n case Mode.KANJI:\n return Math.floor(usableBits / 13);\n case Mode.BYTE:\n default:\n return Math.floor(usableBits / 8);\n }\n };\n exports.getBestVersionForData = function getBestVersionForData(data, errorCorrectionLevel) {\n let seg;\n const ecl = ECLevel.from(errorCorrectionLevel, ECLevel.M);\n if (Array.isArray(data)) {\n if (data.length > 1) {\n return getBestVersionForMixedData(data, ecl);\n }\n if (data.length === 0) {\n return 1;\n }\n seg = data[0];\n } else {\n seg = data;\n }\n return getBestVersionForDataLength(seg.mode, seg.getLength(), ecl);\n };\n exports.getEncodedBits = function getEncodedBits(version) {\n if (!VersionCheck.isValid(version) || version < 7) {\n throw new Error("Invalid QR Code version");\n }\n let d = version << 12;\n while (Utils.getBCHDigit(d) - G18_BCH >= 0) {\n d ^= G18 << Utils.getBCHDigit(d) - G18_BCH;\n }\n return version << 12 | d;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/format-info.js\n var require_format_info = __commonJS({\n "node_modules/qrcode/lib/core/format-info.js"(exports) {\n var Utils = require_utils();\n var G15 = 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0;\n var G15_MASK = 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1;\n var G15_BCH = Utils.getBCHDigit(G15);\n exports.getEncodedBits = function getEncodedBits(errorCorrectionLevel, mask) {\n const data = errorCorrectionLevel.bit << 3 | mask;\n let d = data << 10;\n while (Utils.getBCHDigit(d) - G15_BCH >= 0) {\n d ^= G15 << Utils.getBCHDigit(d) - G15_BCH;\n }\n return (data << 10 | d) ^ G15_MASK;\n };\n }\n });\n\n // node_modules/qrcode/lib/core/numeric-data.js\n var require_numeric_data = __commonJS({\n "node_modules/qrcode/lib/core/numeric-data.js"(exports, module) {\n var Mode = require_mode();\n function NumericData(data) {\n this.mode = Mode.NUMERIC;\n this.data = data.toString();\n }\n NumericData.getBitsLength = function getBitsLength(length) {\n return 10 * Math.floor(length / 3) + (length % 3 ? length % 3 * 3 + 1 : 0);\n };\n NumericData.prototype.getLength = function getLength() {\n return this.data.length;\n };\n NumericData.prototype.getBitsLength = function getBitsLength() {\n return NumericData.getBitsLength(this.data.length);\n };\n NumericData.prototype.write = function write(bitBuffer) {\n let i, group, value;\n for (i = 0; i + 3 <= this.data.length; i += 3) {\n group = this.data.substr(i, 3);\n value = parseInt(group, 10);\n bitBuffer.put(value, 10);\n }\n const remainingNum = this.data.length - i;\n if (remainingNum > 0) {\n group = this.data.substr(i);\n value = parseInt(group, 10);\n bitBuffer.put(value, remainingNum * 3 + 1);\n }\n };\n module.exports = NumericData;\n }\n });\n\n // node_modules/qrcode/lib/core/alphanumeric-data.js\n var require_alphanumeric_data = __commonJS({\n "node_modules/qrcode/lib/core/alphanumeric-data.js"(exports, module) {\n var Mode = require_mode();\n var ALPHA_NUM_CHARS = [\n "0",\n "1",\n "2",\n "3",\n "4",\n "5",\n "6",\n "7",\n "8",\n "9",\n "A",\n "B",\n "C",\n "D",\n "E",\n "F",\n "G",\n "H",\n "I",\n "J",\n "K",\n "L",\n "M",\n "N",\n "O",\n "P",\n "Q",\n "R",\n "S",\n "T",\n "U",\n "V",\n "W",\n "X",\n "Y",\n "Z",\n " ",\n "$",\n "%",\n "*",\n "+",\n "-",\n ".",\n "/",\n ":"\n ];\n function AlphanumericData(data) {\n this.mode = Mode.ALPHANUMERIC;\n this.data = data;\n }\n AlphanumericData.getBitsLength = function getBitsLength(length) {\n return 11 * Math.floor(length / 2) + 6 * (length % 2);\n };\n AlphanumericData.prototype.getLength = function getLength() {\n return this.data.length;\n };\n AlphanumericData.prototype.getBitsLength = function getBitsLength() {\n return AlphanumericData.getBitsLength(this.data.length);\n };\n AlphanumericData.prototype.write = function write(bitBuffer) {\n let i;\n for (i = 0; i + 2 <= this.data.length; i += 2) {\n let value = ALPHA_NUM_CHARS.indexOf(this.data[i]) * 45;\n value += ALPHA_NUM_CHARS.indexOf(this.data[i + 1]);\n bitBuffer.put(value, 11);\n }\n if (this.data.length % 2) {\n bitBuffer.put(ALPHA_NUM_CHARS.indexOf(this.data[i]), 6);\n }\n };\n module.exports = AlphanumericData;\n }\n });\n\n // node_modules/qrcode/lib/core/byte-data.js\n var require_byte_data = __commonJS({\n "node_modules/qrcode/lib/core/byte-data.js"(exports, module) {\n var Mode = require_mode();\n function ByteData(data) {\n this.mode = Mode.BYTE;\n if (typeof data === "string") {\n this.data = new TextEncoder().encode(data);\n } else {\n this.data = new Uint8Array(data);\n }\n }\n ByteData.getBitsLength = function getBitsLength(length) {\n return length * 8;\n };\n ByteData.prototype.getLength = function getLength() {\n return this.data.length;\n };\n ByteData.prototype.getBitsLength = function getBitsLength() {\n return ByteData.getBitsLength(this.data.length);\n };\n ByteData.prototype.write = function(bitBuffer) {\n for (let i = 0, l = this.data.length; i < l; i++) {\n bitBuffer.put(this.data[i], 8);\n }\n };\n module.exports = ByteData;\n }\n });\n\n // node_modules/qrcode/lib/core/kanji-data.js\n var require_kanji_data = __commonJS({\n "node_modules/qrcode/lib/core/kanji-data.js"(exports, module) {\n var Mode = require_mode();\n var Utils = require_utils();\n function KanjiData(data) {\n this.mode = Mode.KANJI;\n this.data = data;\n }\n KanjiData.getBitsLength = function getBitsLength(length) {\n return length * 13;\n };\n KanjiData.prototype.getLength = function getLength() {\n return this.data.length;\n };\n KanjiData.prototype.getBitsLength = function getBitsLength() {\n return KanjiData.getBitsLength(this.data.length);\n };\n KanjiData.prototype.write = function(bitBuffer) {\n let i;\n for (i = 0; i < this.data.length; i++) {\n let value = Utils.toSJIS(this.data[i]);\n if (value >= 33088 && value <= 40956) {\n value -= 33088;\n } else if (value >= 57408 && value <= 60351) {\n value -= 49472;\n } else {\n throw new Error(\n "Invalid SJIS character: " + this.data[i] + "\\nMake sure your charset is UTF-8"\n );\n }\n value = (value >>> 8 & 255) * 192 + (value & 255);\n bitBuffer.put(value, 13);\n }\n };\n module.exports = KanjiData;\n }\n });\n\n // node_modules/dijkstrajs/dijkstra.js\n var require_dijkstra = __commonJS({\n "node_modules/dijkstrajs/dijkstra.js"(exports, module) {\n "use strict";\n var dijkstra = {\n single_source_shortest_paths: function(graph, s, d) {\n var predecessors = {};\n var costs = {};\n costs[s] = 0;\n var open = dijkstra.PriorityQueue.make();\n open.push(s, 0);\n var closest, u, v, cost_of_s_to_u, adjacent_nodes, cost_of_e, cost_of_s_to_u_plus_cost_of_e, cost_of_s_to_v, first_visit;\n while (!open.empty()) {\n closest = open.pop();\n u = closest.value;\n cost_of_s_to_u = closest.cost;\n adjacent_nodes = graph[u] || {};\n for (v in adjacent_nodes) {\n if (adjacent_nodes.hasOwnProperty(v)) {\n cost_of_e = adjacent_nodes[v];\n cost_of_s_to_u_plus_cost_of_e = cost_of_s_to_u + cost_of_e;\n cost_of_s_to_v = costs[v];\n first_visit = typeof costs[v] === "undefined";\n if (first_visit || cost_of_s_to_v > cost_of_s_to_u_plus_cost_of_e) {\n costs[v] = cost_of_s_to_u_plus_cost_of_e;\n open.push(v, cost_of_s_to_u_plus_cost_of_e);\n predecessors[v] = u;\n }\n }\n }\n }\n if (typeof d !== "undefined" && typeof costs[d] === "undefined") {\n var msg = ["Could not find a path from ", s, " to ", d, "."].join("");\n throw new Error(msg);\n }\n return predecessors;\n },\n extract_shortest_path_from_predecessor_list: function(predecessors, d) {\n var nodes = [];\n var u = d;\n var predecessor;\n while (u) {\n nodes.push(u);\n predecessor = predecessors[u];\n u = predecessors[u];\n }\n nodes.reverse();\n return nodes;\n },\n find_path: function(graph, s, d) {\n var predecessors = dijkstra.single_source_shortest_paths(graph, s, d);\n return dijkstra.extract_shortest_path_from_predecessor_list(\n predecessors,\n d\n );\n },\n /**\n * A very naive priority queue implementation.\n */\n PriorityQueue: {\n make: function(opts) {\n var T = dijkstra.PriorityQueue, t = {}, key;\n opts = opts || {};\n for (key in T) {\n if (T.hasOwnProperty(key)) {\n t[key] = T[key];\n }\n }\n t.queue = [];\n t.sorter = opts.sorter || T.default_sorter;\n return t;\n },\n default_sorter: function(a, b) {\n return a.cost - b.cost;\n },\n /**\n * Add a new item to the queue and ensure the highest priority element\n * is at the front of the queue.\n */\n push: function(value, cost) {\n var item = { value, cost };\n this.queue.push(item);\n this.queue.sort(this.sorter);\n },\n /**\n * Return the highest priority element in the queue.\n */\n pop: function() {\n return this.queue.shift();\n },\n empty: function() {\n return this.queue.length === 0;\n }\n }\n };\n if (typeof module !== "undefined") {\n module.exports = dijkstra;\n }\n }\n });\n\n // node_modules/qrcode/lib/core/segments.js\n var require_segments = __commonJS({\n "node_modules/qrcode/lib/core/segments.js"(exports) {\n var Mode = require_mode();\n var NumericData = require_numeric_data();\n var AlphanumericData = require_alphanumeric_data();\n var ByteData = require_byte_data();\n var KanjiData = require_kanji_data();\n var Regex = require_regex();\n var Utils = require_utils();\n var dijkstra = require_dijkstra();\n function getStringByteLength(str) {\n return unescape(encodeURIComponent(str)).length;\n }\n function getSegments(regex, mode, str) {\n const segments = [];\n let result;\n while ((result = regex.exec(str)) !== null) {\n segments.push({\n data: result[0],\n index: result.index,\n mode,\n length: result[0].length\n });\n }\n return segments;\n }\n function getSegmentsFromString(dataStr) {\n const numSegs = getSegments(Regex.NUMERIC, Mode.NUMERIC, dataStr);\n const alphaNumSegs = getSegments(Regex.ALPHANUMERIC, Mode.ALPHANUMERIC, dataStr);\n let byteSegs;\n let kanjiSegs;\n if (Utils.isKanjiModeEnabled()) {\n byteSegs = getSegments(Regex.BYTE, Mode.BYTE, dataStr);\n kanjiSegs = getSegments(Regex.KANJI, Mode.KANJI, dataStr);\n } else {\n byteSegs = getSegments(Regex.BYTE_KANJI, Mode.BYTE, dataStr);\n kanjiSegs = [];\n }\n const segs = numSegs.concat(alphaNumSegs, byteSegs, kanjiSegs);\n return segs.sort(function(s1, s2) {\n return s1.index - s2.index;\n }).map(function(obj) {\n return {\n data: obj.data,\n mode: obj.mode,\n length: obj.length\n };\n });\n }\n function getSegmentBitsLength(length, mode) {\n switch (mode) {\n case Mode.NUMERIC:\n return NumericData.getBitsLength(length);\n case Mode.ALPHANUMERIC:\n return AlphanumericData.getBitsLength(length);\n case Mode.KANJI:\n return KanjiData.getBitsLength(length);\n case Mode.BYTE:\n return ByteData.getBitsLength(length);\n }\n }\n function mergeSegments(segs) {\n return segs.reduce(function(acc, curr) {\n const prevSeg = acc.length - 1 >= 0 ? acc[acc.length - 1] : null;\n if (prevSeg && prevSeg.mode === curr.mode) {\n acc[acc.length - 1].data += curr.data;\n return acc;\n }\n acc.push(curr);\n return acc;\n }, []);\n }\n function buildNodes(segs) {\n const nodes = [];\n for (let i = 0; i < segs.length; i++) {\n const seg = segs[i];\n switch (seg.mode) {\n case Mode.NUMERIC:\n nodes.push([\n seg,\n { data: seg.data, mode: Mode.ALPHANUMERIC, length: seg.length },\n { data: seg.data, mode: Mode.BYTE, length: seg.length }\n ]);\n break;\n case Mode.ALPHANUMERIC:\n nodes.push([\n seg,\n { data: seg.data, mode: Mode.BYTE, length: seg.length }\n ]);\n break;\n case Mode.KANJI:\n nodes.push([\n seg,\n { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }\n ]);\n break;\n case Mode.BYTE:\n nodes.push([\n { data: seg.data, mode: Mode.BYTE, length: getStringByteLength(seg.data) }\n ]);\n }\n }\n return nodes;\n }\n function buildGraph(nodes, version) {\n const table = {};\n const graph = { start: {} };\n let prevNodeIds = ["start"];\n for (let i = 0; i < nodes.length; i++) {\n const nodeGroup = nodes[i];\n const currentNodeIds = [];\n for (let j = 0; j < nodeGroup.length; j++) {\n const node = nodeGroup[j];\n const key = "" + i + j;\n currentNodeIds.push(key);\n table[key] = { node, lastCount: 0 };\n graph[key] = {};\n for (let n = 0; n < prevNodeIds.length; n++) {\n const prevNodeId = prevNodeIds[n];\n if (table[prevNodeId] && table[prevNodeId].node.mode === node.mode) {\n graph[prevNodeId][key] = getSegmentBitsLength(table[prevNodeId].lastCount + node.length, node.mode) - getSegmentBitsLength(table[prevNodeId].lastCount, node.mode);\n table[prevNodeId].lastCount += node.length;\n } else {\n if (table[prevNodeId]) table[prevNodeId].lastCount = node.length;\n graph[prevNodeId][key] = getSegmentBitsLength(node.length, node.mode) + 4 + Mode.getCharCountIndicator(node.mode, version);\n }\n }\n }\n prevNodeIds = currentNodeIds;\n }\n for (let n = 0; n < prevNodeIds.length; n++) {\n graph[prevNodeIds[n]].end = 0;\n }\n return { map: graph, table };\n }\n function buildSingleSegment(data, modesHint) {\n let mode;\n const bestMode = Mode.getBestModeForData(data);\n mode = Mode.from(modesHint, bestMode);\n if (mode !== Mode.BYTE && mode.bit < bestMode.bit) {\n throw new Error(\'"\' + data + \'" cannot be encoded with mode \' + Mode.toString(mode) + ".\\n Suggested mode is: " + Mode.toString(bestMode));\n }\n if (mode === Mode.KANJI && !Utils.isKanjiModeEnabled()) {\n mode = Mode.BYTE;\n }\n switch (mode) {\n case Mode.NUMERIC:\n return new NumericData(data);\n case Mode.ALPHANUMERIC:\n return new AlphanumericData(data);\n case Mode.KANJI:\n return new KanjiData(data);\n case Mode.BYTE:\n return new ByteData(data);\n }\n }\n exports.fromArray = function fromArray(array) {\n return array.reduce(function(acc, seg) {\n if (typeof seg === "string") {\n acc.push(buildSingleSegment(seg, null));\n } else if (seg.data) {\n acc.push(buildSingleSegment(seg.data, seg.mode));\n }\n return acc;\n }, []);\n };\n exports.fromString = function fromString(data, version) {\n const segs = getSegmentsFromString(data, Utils.isKanjiModeEnabled());\n const nodes = buildNodes(segs);\n const graph = buildGraph(nodes, version);\n const path = dijkstra.find_path(graph.map, "start", "end");\n const optimizedSegs = [];\n for (let i = 1; i < path.length - 1; i++) {\n optimizedSegs.push(graph.table[path[i]].node);\n }\n return exports.fromArray(mergeSegments(optimizedSegs));\n };\n exports.rawSplit = function rawSplit(data) {\n return exports.fromArray(\n getSegmentsFromString(data, Utils.isKanjiModeEnabled())\n );\n };\n }\n });\n\n // node_modules/qrcode/lib/core/qrcode.js\n var require_qrcode = __commonJS({\n "node_modules/qrcode/lib/core/qrcode.js"(exports) {\n var Utils = require_utils();\n var ECLevel = require_error_correction_level();\n var BitBuffer = require_bit_buffer();\n var BitMatrix = require_bit_matrix();\n var AlignmentPattern = require_alignment_pattern();\n var FinderPattern = require_finder_pattern();\n var MaskPattern = require_mask_pattern();\n var ECCode = require_error_correction_code();\n var ReedSolomonEncoder = require_reed_solomon_encoder();\n var Version = require_version();\n var FormatInfo = require_format_info();\n var Mode = require_mode();\n var Segments = require_segments();\n function setupFinderPattern(matrix, version) {\n const size = matrix.size;\n const pos = FinderPattern.getPositions(version);\n for (let i = 0; i < pos.length; i++) {\n const row = pos[i][0];\n const col = pos[i][1];\n for (let r = -1; r <= 7; r++) {\n if (row + r <= -1 || size <= row + r) continue;\n for (let c = -1; c <= 7; c++) {\n if (col + c <= -1 || size <= col + c) continue;\n if (r >= 0 && r <= 6 && (c === 0 || c === 6) || c >= 0 && c <= 6 && (r === 0 || r === 6) || r >= 2 && r <= 4 && c >= 2 && c <= 4) {\n matrix.set(row + r, col + c, true, true);\n } else {\n matrix.set(row + r, col + c, false, true);\n }\n }\n }\n }\n }\n function setupTimingPattern(matrix) {\n const size = matrix.size;\n for (let r = 8; r < size - 8; r++) {\n const value = r % 2 === 0;\n matrix.set(r, 6, value, true);\n matrix.set(6, r, value, true);\n }\n }\n function setupAlignmentPattern(matrix, version) {\n const pos = AlignmentPattern.getPositions(version);\n for (let i = 0; i < pos.length; i++) {\n const row = pos[i][0];\n const col = pos[i][1];\n for (let r = -2; r <= 2; r++) {\n for (let c = -2; c <= 2; c++) {\n if (r === -2 || r === 2 || c === -2 || c === 2 || r === 0 && c === 0) {\n matrix.set(row + r, col + c, true, true);\n } else {\n matrix.set(row + r, col + c, false, true);\n }\n }\n }\n }\n }\n function setupVersionInfo(matrix, version) {\n const size = matrix.size;\n const bits = Version.getEncodedBits(version);\n let row, col, mod;\n for (let i = 0; i < 18; i++) {\n row = Math.floor(i / 3);\n col = i % 3 + size - 8 - 3;\n mod = (bits >> i & 1) === 1;\n matrix.set(row, col, mod, true);\n matrix.set(col, row, mod, true);\n }\n }\n function setupFormatInfo(matrix, errorCorrectionLevel, maskPattern) {\n const size = matrix.size;\n const bits = FormatInfo.getEncodedBits(errorCorrectionLevel, maskPattern);\n let i, mod;\n for (i = 0; i < 15; i++) {\n mod = (bits >> i & 1) === 1;\n if (i < 6) {\n matrix.set(i, 8, mod, true);\n } else if (i < 8) {\n matrix.set(i + 1, 8, mod, true);\n } else {\n matrix.set(size - 15 + i, 8, mod, true);\n }\n if (i < 8) {\n matrix.set(8, size - i - 1, mod, true);\n } else if (i < 9) {\n matrix.set(8, 15 - i - 1 + 1, mod, true);\n } else {\n matrix.set(8, 15 - i - 1, mod, true);\n }\n }\n matrix.set(size - 8, 8, 1, true);\n }\n function setupData(matrix, data) {\n const size = matrix.size;\n let inc = -1;\n let row = size - 1;\n let bitIndex = 7;\n let byteIndex = 0;\n for (let col = size - 1; col > 0; col -= 2) {\n if (col === 6) col--;\n while (true) {\n for (let c = 0; c < 2; c++) {\n if (!matrix.isReserved(row, col - c)) {\n let dark = false;\n if (byteIndex < data.length) {\n dark = (data[byteIndex] >>> bitIndex & 1) === 1;\n }\n matrix.set(row, col - c, dark);\n bitIndex--;\n if (bitIndex === -1) {\n byteIndex++;\n bitIndex = 7;\n }\n }\n }\n row += inc;\n if (row < 0 || size <= row) {\n row -= inc;\n inc = -inc;\n break;\n }\n }\n }\n }\n function createData(version, errorCorrectionLevel, segments) {\n const buffer = new BitBuffer();\n segments.forEach(function(data) {\n buffer.put(data.mode.bit, 4);\n buffer.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version));\n data.write(buffer);\n });\n const totalCodewords = Utils.getSymbolTotalCodewords(version);\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);\n const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;\n if (buffer.getLengthInBits() + 4 <= dataTotalCodewordsBits) {\n buffer.put(0, 4);\n }\n while (buffer.getLengthInBits() % 8 !== 0) {\n buffer.putBit(0);\n }\n const remainingByte = (dataTotalCodewordsBits - buffer.getLengthInBits()) / 8;\n for (let i = 0; i < remainingByte; i++) {\n buffer.put(i % 2 ? 17 : 236, 8);\n }\n return createCodewords(buffer, version, errorCorrectionLevel);\n }\n function createCodewords(bitBuffer, version, errorCorrectionLevel) {\n const totalCodewords = Utils.getSymbolTotalCodewords(version);\n const ecTotalCodewords = ECCode.getTotalCodewordsCount(version, errorCorrectionLevel);\n const dataTotalCodewords = totalCodewords - ecTotalCodewords;\n const ecTotalBlocks = ECCode.getBlocksCount(version, errorCorrectionLevel);\n const blocksInGroup2 = totalCodewords % ecTotalBlocks;\n const blocksInGroup1 = ecTotalBlocks - blocksInGroup2;\n const totalCodewordsInGroup1 = Math.floor(totalCodewords / ecTotalBlocks);\n const dataCodewordsInGroup1 = Math.floor(dataTotalCodewords / ecTotalBlocks);\n const dataCodewordsInGroup2 = dataCodewordsInGroup1 + 1;\n const ecCount = totalCodewordsInGroup1 - dataCodewordsInGroup1;\n const rs = new ReedSolomonEncoder(ecCount);\n let offset = 0;\n const dcData = new Array(ecTotalBlocks);\n const ecData = new Array(ecTotalBlocks);\n let maxDataSize = 0;\n const buffer = new Uint8Array(bitBuffer.buffer);\n for (let b = 0; b < ecTotalBlocks; b++) {\n const dataSize = b < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;\n dcData[b] = buffer.slice(offset, offset + dataSize);\n ecData[b] = rs.encode(dcData[b]);\n offset += dataSize;\n maxDataSize = Math.max(maxDataSize, dataSize);\n }\n const data = new Uint8Array(totalCodewords);\n let index = 0;\n let i, r;\n for (i = 0; i < maxDataSize; i++) {\n for (r = 0; r < ecTotalBlocks; r++) {\n if (i < dcData[r].length) {\n data[index++] = dcData[r][i];\n }\n }\n }\n for (i = 0; i < ecCount; i++) {\n for (r = 0; r < ecTotalBlocks; r++) {\n data[index++] = ecData[r][i];\n }\n }\n return data;\n }\n function createSymbol(data, version, errorCorrectionLevel, maskPattern) {\n let segments;\n if (Array.isArray(data)) {\n segments = Segments.fromArray(data);\n } else if (typeof data === "string") {\n let estimatedVersion = version;\n if (!estimatedVersion) {\n const rawSegments = Segments.rawSplit(data);\n estimatedVersion = Version.getBestVersionForData(rawSegments, errorCorrectionLevel);\n }\n segments = Segments.fromString(data, estimatedVersion || 40);\n } else {\n throw new Error("Invalid data");\n }\n const bestVersion = Version.getBestVersionForData(segments, errorCorrectionLevel);\n if (!bestVersion) {\n throw new Error("The amount of data is too big to be stored in a QR Code");\n }\n if (!version) {\n version = bestVersion;\n } else if (version < bestVersion) {\n throw new Error(\n "\\nThe chosen QR Code version cannot contain this amount of data.\\nMinimum version required to store current data is: " + bestVersion + ".\\n"\n );\n }\n const dataBits = createData(version, errorCorrectionLevel, segments);\n const moduleCount = Utils.getSymbolSize(version);\n const modules = new BitMatrix(moduleCount);\n setupFinderPattern(modules, version);\n setupTimingPattern(modules);\n setupAlignmentPattern(modules, version);\n setupFormatInfo(modules, errorCorrectionLevel, 0);\n if (version >= 7) {\n setupVersionInfo(modules, version);\n }\n setupData(modules, dataBits);\n if (isNaN(maskPattern)) {\n maskPattern = MaskPattern.getBestMask(\n modules,\n setupFormatInfo.bind(null, modules, errorCorrectionLevel)\n );\n }\n MaskPattern.applyMask(maskPattern, modules);\n setupFormatInfo(modules, errorCorrectionLevel, maskPattern);\n return {\n modules,\n version,\n errorCorrectionLevel,\n maskPattern,\n segments\n };\n }\n exports.create = function create(data, options) {\n if (typeof data === "undefined" || data === "") {\n throw new Error("No input text");\n }\n let errorCorrectionLevel = ECLevel.M;\n let version;\n let mask;\n if (typeof options !== "undefined") {\n errorCorrectionLevel = ECLevel.from(options.errorCorrectionLevel, ECLevel.M);\n version = Version.from(options.version);\n mask = MaskPattern.from(options.maskPattern);\n if (options.toSJISFunc) {\n Utils.setToSJISFunction(options.toSJISFunc);\n }\n }\n return createSymbol(data, version, errorCorrectionLevel, mask);\n };\n }\n });\n\n // node_modules/qrcode/lib/renderer/utils.js\n var require_utils2 = __commonJS({\n "node_modules/qrcode/lib/renderer/utils.js"(exports) {\n function hex2rgba(hex) {\n if (typeof hex === "number") {\n hex = hex.toString();\n }\n if (typeof hex !== "string") {\n throw new Error("Color should be defined as hex string");\n }\n let hexCode = hex.slice().replace("#", "").split("");\n if (hexCode.length < 3 || hexCode.length === 5 || hexCode.length > 8) {\n throw new Error("Invalid hex color: " + hex);\n }\n if (hexCode.length === 3 || hexCode.length === 4) {\n hexCode = Array.prototype.concat.apply([], hexCode.map(function(c) {\n return [c, c];\n }));\n }\n if (hexCode.length === 6) hexCode.push("F", "F");\n const hexValue = parseInt(hexCode.join(""), 16);\n return {\n r: hexValue >> 24 & 255,\n g: hexValue >> 16 & 255,\n b: hexValue >> 8 & 255,\n a: hexValue & 255,\n hex: "#" + hexCode.slice(0, 6).join("")\n };\n }\n exports.getOptions = function getOptions(options) {\n if (!options) options = {};\n if (!options.color) options.color = {};\n const margin = typeof options.margin === "undefined" || options.margin === null || options.margin < 0 ? 4 : options.margin;\n const width = options.width && options.width >= 21 ? options.width : void 0;\n const scale = options.scale || 4;\n return {\n width,\n scale: width ? 4 : scale,\n margin,\n color: {\n dark: hex2rgba(options.color.dark || "#000000ff"),\n light: hex2rgba(options.color.light || "#ffffffff")\n },\n type: options.type,\n rendererOpts: options.rendererOpts || {}\n };\n };\n exports.getScale = function getScale(qrSize, opts) {\n return opts.width && opts.width >= qrSize + opts.margin * 2 ? opts.width / (qrSize + opts.margin * 2) : opts.scale;\n };\n exports.getImageWidth = function getImageWidth(qrSize, opts) {\n const scale = exports.getScale(qrSize, opts);\n return Math.floor((qrSize + opts.margin * 2) * scale);\n };\n exports.qrToImageData = function qrToImageData(imgData, qr, opts) {\n const size = qr.modules.size;\n const data = qr.modules.data;\n const scale = exports.getScale(size, opts);\n const symbolSize = Math.floor((size + opts.margin * 2) * scale);\n const scaledMargin = opts.margin * scale;\n const palette = [opts.color.light, opts.color.dark];\n for (let i = 0; i < symbolSize; i++) {\n for (let j = 0; j < symbolSize; j++) {\n let posDst = (i * symbolSize + j) * 4;\n let pxColor = opts.color.light;\n if (i >= scaledMargin && j >= scaledMargin && i < symbolSize - scaledMargin && j < symbolSize - scaledMargin) {\n const iSrc = Math.floor((i - scaledMargin) / scale);\n const jSrc = Math.floor((j - scaledMargin) / scale);\n pxColor = palette[data[iSrc * size + jSrc] ? 1 : 0];\n }\n imgData[posDst++] = pxColor.r;\n imgData[posDst++] = pxColor.g;\n imgData[posDst++] = pxColor.b;\n imgData[posDst] = pxColor.a;\n }\n }\n };\n }\n });\n\n // node_modules/qrcode/lib/renderer/canvas.js\n var require_canvas = __commonJS({\n "node_modules/qrcode/lib/renderer/canvas.js"(exports) {\n var Utils = require_utils2();\n function clearCanvas(ctx, canvas, size) {\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n if (!canvas.style) canvas.style = {};\n canvas.height = size;\n canvas.width = size;\n canvas.style.height = size + "px";\n canvas.style.width = size + "px";\n }\n function getCanvasElement() {\n try {\n return document.createElement("canvas");\n } catch (e) {\n throw new Error("You need to specify a canvas element");\n }\n }\n exports.render = function render(qrData, canvas, options) {\n let opts = options;\n let canvasEl = canvas;\n if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {\n opts = canvas;\n canvas = void 0;\n }\n if (!canvas) {\n canvasEl = getCanvasElement();\n }\n opts = Utils.getOptions(opts);\n const size = Utils.getImageWidth(qrData.modules.size, opts);\n const ctx = canvasEl.getContext("2d");\n const image = ctx.createImageData(size, size);\n Utils.qrToImageData(image.data, qrData, opts);\n clearCanvas(ctx, canvasEl, size);\n ctx.putImageData(image, 0, 0);\n return canvasEl;\n };\n exports.renderToDataURL = function renderToDataURL(qrData, canvas, options) {\n let opts = options;\n if (typeof opts === "undefined" && (!canvas || !canvas.getContext)) {\n opts = canvas;\n canvas = void 0;\n }\n if (!opts) opts = {};\n const canvasEl = exports.render(qrData, canvas, opts);\n const type = opts.type || "image/png";\n const rendererOpts = opts.rendererOpts || {};\n return canvasEl.toDataURL(type, rendererOpts.quality);\n };\n }\n });\n\n // node_modules/qrcode/lib/renderer/svg-tag.js\n var require_svg_tag = __commonJS({\n "node_modules/qrcode/lib/renderer/svg-tag.js"(exports) {\n var Utils = require_utils2();\n function getColorAttrib(color, attrib) {\n const alpha = color.a / 255;\n const str = attrib + \'="\' + color.hex + \'"\';\n return alpha < 1 ? str + " " + attrib + \'-opacity="\' + alpha.toFixed(2).slice(1) + \'"\' : str;\n }\n function svgCmd(cmd, x, y) {\n let str = cmd + x;\n if (typeof y !== "undefined") str += " " + y;\n return str;\n }\n function qrToPath(data, size, margin) {\n let path = "";\n let moveBy = 0;\n let newRow = false;\n let lineLength = 0;\n for (let i = 0; i < data.length; i++) {\n const col = Math.floor(i % size);\n const row = Math.floor(i / size);\n if (!col && !newRow) newRow = true;\n if (data[i]) {\n lineLength++;\n if (!(i > 0 && col > 0 && data[i - 1])) {\n path += newRow ? svgCmd("M", col + margin, 0.5 + row + margin) : svgCmd("m", moveBy, 0);\n moveBy = 0;\n newRow = false;\n }\n if (!(col + 1 < size && data[i + 1])) {\n path += svgCmd("h", lineLength);\n lineLength = 0;\n }\n } else {\n moveBy++;\n }\n }\n return path;\n }\n exports.render = function render(qrData, options, cb) {\n const opts = Utils.getOptions(options);\n const size = qrData.modules.size;\n const data = qrData.modules.data;\n const qrcodesize = size + opts.margin * 2;\n const bg = !opts.color.light.a ? "" : "<path " + getColorAttrib(opts.color.light, "fill") + \' d="M0 0h\' + qrcodesize + "v" + qrcodesize + \'H0z"/>\';\n const path = "<path " + getColorAttrib(opts.color.dark, "stroke") + \' d="\' + qrToPath(data, size, opts.margin) + \'"/>\';\n const viewBox = \'viewBox="0 0 \' + qrcodesize + " " + qrcodesize + \'"\';\n const width = !opts.width ? "" : \'width="\' + opts.width + \'" height="\' + opts.width + \'" \';\n const svgTag = \'<svg xmlns="http://www.w3.org/2000/svg" \' + width + viewBox + \' shape-rendering="crispEdges">\' + bg + path + "</svg>\\n";\n if (typeof cb === "function") {\n cb(null, svgTag);\n }\n return svgTag;\n };\n }\n });\n\n // node_modules/qrcode/lib/browser.js\n var require_browser = __commonJS({\n "node_modules/qrcode/lib/browser.js"(exports) {\n var canPromise = require_can_promise();\n var QRCode = require_qrcode();\n var CanvasRenderer = require_canvas();\n var SvgRenderer = require_svg_tag();\n function renderCanvas(renderFunc, canvas, text, opts, cb) {\n const args = [].slice.call(arguments, 1);\n const argsNum = args.length;\n const isLastArgCb = typeof args[argsNum - 1] === "function";\n if (!isLastArgCb && !canPromise()) {\n throw new Error("Callback required as last argument");\n }\n if (isLastArgCb) {\n if (argsNum < 2) {\n throw new Error("Too few arguments provided");\n }\n if (argsNum === 2) {\n cb = text;\n text = canvas;\n canvas = opts = void 0;\n } else if (argsNum === 3) {\n if (canvas.getContext && typeof cb === "undefined") {\n cb = opts;\n opts = void 0;\n } else {\n cb = opts;\n opts = text;\n text = canvas;\n canvas = void 0;\n }\n }\n } else {\n if (argsNum < 1) {\n throw new Error("Too few arguments provided");\n }\n if (argsNum === 1) {\n text = canvas;\n canvas = opts = void 0;\n } else if (argsNum === 2 && !canvas.getContext) {\n opts = text;\n text = canvas;\n canvas = void 0;\n }\n return new Promise(function(resolve, reject) {\n try {\n const data = QRCode.create(text, opts);\n resolve(renderFunc(data, canvas, opts));\n } catch (e) {\n reject(e);\n }\n });\n }\n try {\n const data = QRCode.create(text, opts);\n cb(null, renderFunc(data, canvas, opts));\n } catch (e) {\n cb(e);\n }\n }\n exports.create = QRCode.create;\n exports.toCanvas = renderCanvas.bind(null, CanvasRenderer.render);\n exports.toDataURL = renderCanvas.bind(null, CanvasRenderer.renderToDataURL);\n exports.toString = renderCanvas.bind(null, function(data, _, opts) {\n return SvgRenderer.render(data, opts);\n });\n }\n });\n\n // web-console/browser.ts\n var token = sessionStorage.getItem("engine7-console-key") || "";\n var client = Array.from(\n crypto.getRandomValues(new Uint8Array(16)),\n (byte) => byte.toString(16).padStart(2, "0")\n ).join("");\n var login = null;\n async function authenticate() {\n if (login) return login;\n login = new Promise((resolve) => {\n const mask = document.createElement("div");\n mask.className = "web-login";\n mask.innerHTML = \'<form><h2>Engine7 \\u63A7\\u5236\\u53F0</h2><p>\\u8F93\\u5165\\u7BA1\\u7406\\u53E3\\u4EE4\\uFF0C\\u7EE7\\u7EED\\u4E0E\\u4F60\\u7684\\u4F19\\u4F34\\u76F8\\u4F34\\u3002</p><input type="password" autocomplete="current-password" aria-label="\\u7BA1\\u7406\\u53E3\\u4EE4" required><button class="btn btn-primary" type="submit">\\u8FDB\\u5165\\u63A7\\u5236\\u53F0</button></form>\';\n document.body.append(mask);\n mask.querySelector("form").onsubmit = (e) => {\n e.preventDefault();\n token = mask.querySelector("input").value;\n sessionStorage.setItem("engine7-console-key", token);\n mask.remove();\n login = null;\n resolve();\n };\n mask.querySelector("input").focus();\n });\n return login;\n }\n async function rpc(method, args = []) {\n const response = await fetch("/api/console/rpc", {\n method: "POST",\n headers: {\n "Content-Type": "application/json",\n "x-engine-console": "1",\n ...token ? { Authorization: "Bearer " + token } : {}\n },\n body: JSON.stringify({ method, args, client }),\n // Shared CLI/update modules own the time limits for these long operations.\n signal: ["runReconfig", "updateApply"].includes(method) ? void 0 : AbortSignal.timeout(48e4)\n });\n if (response.status === 403) {\n await authenticate();\n return rpc(method, args);\n }\n const value = await response.json();\n if (!response.ok) throw new Error(value.error || "\\u63A7\\u5236\\u53F0\\u8BF7\\u6C42\\u5931\\u8D25");\n return value;\n }\n var subscriptions = {\n engine: /* @__PURE__ */ new Set(),\n update: /* @__PURE__ */ new Set()\n };\n var since = 0;\n var polling = false;\n function subscribe(type, callback) {\n subscriptions[type].add(callback);\n if (!polling) {\n polling = true;\n void poll();\n }\n return () => subscriptions[type].delete(callback);\n }\n async function poll() {\n while (subscriptions.engine.size || subscriptions.update.size) {\n try {\n const result = await rpc("events", [since]);\n since = result.latest;\n for (const event of result.events)\n if (event.stateDir === (await api.getInstalledMarker()).stateDir)\n for (const callback of subscriptions[event.type] || [])\n callback(event.value);\n } catch {\n }\n await new Promise((resolve) => setTimeout(resolve, 500));\n }\n polling = false;\n }\n var upload = null;\n async function pickImage() {\n return new Promise((resolve) => {\n const input = document.createElement("input");\n input.type = "file";\n input.accept = ".png,.jpg,.jpeg,.webp";\n input.hidden = true;\n document.body.append(input);\n input.oncancel = () => {\n input.remove();\n resolve(null);\n };\n input.onchange = async () => {\n const file = input.files?.[0];\n input.remove();\n if (!file) return resolve(null);\n if (file.size > 8 * 1024 * 1024) {\n alert("\\u8BF7\\u9009\\u62E9\\u4E0D\\u8D85\\u8FC7 8 MB \\u7684\\u7167\\u7247");\n return resolve(null);\n }\n const bytes = new Uint8Array(await file.arrayBuffer());\n let raw = "";\n for (let i = 0; i < bytes.length; i += 16384)\n raw += String.fromCharCode(...bytes.subarray(i, i + 16384));\n upload = JSON.stringify({ name: file.name, data: btoa(raw) });\n resolve("browser-upload");\n };\n input.click();\n });\n }\n async function serviceAuth(stateDir, action, provider, payload) {\n const popup = action === "connect" || action === "continue" || action === "permissions" ? window.open("about:blank", "_blank") : null;\n if (popup) popup.opener = null;\n try {\n const result = await rpc("serviceAuth", [stateDir, action, provider, payload]);\n if (result.openUrl) {\n if (popup) popup.location.href = result.openUrl;\n else location.assign(result.openUrl);\n } else popup?.close();\n return result;\n } catch (error) {\n popup?.close();\n throw error;\n }\n }\n var api = {\n serviceAuth,\n pickImageFile: pickImage,\n pickDirectory: async () => {\n const marker = await api.getInstalledMarker();\n return new Promise((resolve) => {\n const mask = document.createElement("div");\n mask.className = "web-login";\n const box = document.createElement("form");\n const title = document.createElement("h2");\n title.textContent = "\\u9009\\u62E9\\u4E91\\u4E3B\\u673A\\u4E0A\\u7684\\u76EE\\u5F55";\n const locationLabel = document.createElement("p");\n const list = document.createElement("div");\n const choose = document.createElement("button"), cancel = document.createElement("button");\n choose.className = "btn btn-primary";\n choose.textContent = "\\u9009\\u62E9\\u8FD9\\u4E2A\\u76EE\\u5F55";\n choose.type = "submit";\n choose.disabled = true;\n cancel.className = "btn";\n cancel.textContent = "\\u53D6\\u6D88";\n cancel.type = "button";\n let current2 = "", generation = 0, active = true;\n const finish = (value) => {\n active = false;\n mask.remove();\n resolve(value);\n };\n box.onsubmit = (event) => {\n event.preventDefault();\n finish(current2);\n };\n cancel.onclick = () => finish(null);\n const load = async (directory = "") => {\n const ticket = ++generation;\n choose.disabled = true;\n try {\n const result = await rpc("listDirectories", [\n marker.stateDir,\n directory\n ]);\n if (!active || ticket !== generation) return;\n current2 = result.path;\n locationLabel.textContent = current2;\n list.replaceChildren();\n choose.disabled = false;\n for (const entry of [\n ...result.parent ? [{ name: "\\u4E0A\\u4E00\\u7EA7", path: result.parent }] : [],\n ...result.directories\n ]) {\n const button = document.createElement("button");\n button.type = "button";\n button.className = "btn";\n button.textContent = entry.name;\n button.onclick = () => {\n void load(entry.path);\n };\n list.append(button);\n }\n } catch (error) {\n if (active && ticket === generation) {\n locationLabel.textContent = String(error);\n choose.disabled = true;\n }\n }\n };\n box.append(title, locationLabel, list, choose, cancel);\n mask.append(box);\n document.body.append(mask);\n void load();\n });\n },\n copyPortrait: async (stateDir) => {\n if (!upload) throw new Error("\\u8BF7\\u5148\\u9009\\u62E9\\u7167\\u7247");\n const photo = JSON.parse(upload);\n upload = null;\n return rpc("copyPortrait", [stateDir, photo]);\n },\n consolePendingPage: async () => ({ top: "status", connections: "channels" })[location.hash.slice(1)] || location.hash.slice(1) || "status",\n onConsoleNavigate: (callback) => {\n const listener = () => callback(\n { top: "status", connections: "channels" }[location.hash.slice(1)] || location.hash.slice(1) || "status"\n );\n addEventListener("hashchange", listener);\n return () => removeEventListener("hashchange", listener);\n },\n onEngineEvent: (callback) => subscribe("engine", callback),\n onUpdateEvent: (callback) => subscribe("update", callback),\n cancelReconfig: async () => rpc("cancelReconfig", []),\n openPath: async (target) => {\n const popup = window.open("about:blank", "_blank");\n if (popup) popup.opener = null;\n try {\n const result = await rpc("openPath", [target]);\n if (!popup) return;\n const pre = popup.document.createElement("pre");\n pre.textContent = result.text;\n popup.document.body.replaceChildren(pre);\n popup.document.title = "Engine7 \\xB7 \\u6587\\u4EF6";\n } catch (e) {\n popup?.close();\n throw e;\n }\n }\n };\n for (const method of [\n "listEngines",\n "getInstalledMarker",\n "selectEngine",\n "apiStatus",\n "doctor",\n "travelControl",\n "configGet",\n "configSet",\n "configSchema",\n "configMigrate",\n "internalModeSet",\n "startEngine",\n "stopEngine",\n "isEngineAlive",\n "isEngineProcessAlive",\n "applyFreeTier",\n "updateCheck",\n "updateApply",\n "runReconfig",\n "cancelReconfig",\n "readChannelConfig",\n "updateChannelConfig",\n "readTelegramConfig",\n "updateTelegramConfig",\n "readDingtalkConfig",\n "updateDingtalkConfig",\n "readFeishuConfig",\n "updateFeishuConfig",\n "readWecomConfig",\n "updateWecomConfig",\n "readWhatsappConfig",\n "updateWhatsappConfig",\n "fetchWaStatus",\n "fetchWaQr",\n "ccPairStatus",\n "ccPairProvision",\n "ccPairStart",\n "ccPairScanStart",\n "ccPairScanPoll",\n "ccPairScanCancel",\n "scaffoldPersonas",\n "autostartEnable",\n "logTail"\n ])\n api[method] = (...args) => rpc(method, args);\n var getMarker = api.getInstalledMarker;\n var current = null;\n api.getInstalledMarker = async () => {\n if (!current) {\n current = await getMarker();\n if (current.travelOnboardingAvailable === true) {\n api.travelOnboarding = (stateDir, action, input) => rpc(\n "travelOnboarding",\n input === void 0 ? [stateDir, action] : [stateDir, action, input]\n );\n api.pickTravelKey = async () => rpc("pickTravelKey", [(await api.getInstalledMarker()).stateDir]);\n }\n }\n return current;\n };\n api.selectEngine = async (stateDir) => {\n const engines = await api.listEngines();\n const selected = engines.engines.find(\n (entry) => entry.stateDir === stateDir\n );\n if (!selected) return { ok: false };\n current = selected;\n return { ok: true };\n };\n for (const method of ["updateCheck", "updateApply", "autostartEnable"])\n api[method] = async () => rpc(method, [(await api.getInstalledMarker()).stateDir]);\n window.engine7Api = api;\n window.engine7ConsoleRpc = rpc;\n\n // web-console/terminal.ts\n var rpc2 = window.engine7ConsoleRpc;\n function mount(body, marker) {\n body.innerHTML = \'<div class="page web-terminal"><h2>\\u7EC8\\u7AEF</h2><p class="page-sub">\\u5728\\u8FD9\\u91CC\\u4E0E\\u4F19\\u4F34\\u5BF9\\u8BDD\\uFF0C\\u4E5F\\u53EF\\u4EE5\\u8F93\\u5165\\u539F\\u6709\\u547D\\u4EE4\\u3002</p><pre class="log-view" id="term-out" role="log"></pre><form class="term-row"><input id="term-in" aria-label="\\u6D88\\u606F" autocomplete="off"><button class="btn btn-primary" id="term-send">\\u53D1\\u9001</button></form><p role="status" id="term-error"></p></div>\';\n let active = true, seq = 0;\n const out = body.querySelector("pre"), input = body.querySelector("input"), error = body.querySelector("#term-error");\n {\n body.querySelector("form").onsubmit = async (e) => {\n e.preventDefault();\n const text = input.value.trim();\n if (!text) return;\n try {\n await rpc2("terminalSend", [marker.stateDir, text]);\n if (active) input.value = "";\n } catch (e2) {\n if (active) error.textContent = String(e2);\n }\n };\n const poll2 = async () => {\n if (!active) return;\n try {\n const result = await rpc2("terminalPoll", [marker.stateDir, seq]);\n if (active) {\n for (const line of result.lines)\n out.textContent += "\\n" + (line.kind === "echo" ? "You> " : "") + line.text;\n seq = result.latest;\n out.scrollTop = out.scrollHeight;\n }\n } catch (e) {\n if (active) error.textContent = String(e);\n }\n if (active) setTimeout(poll2, 900);\n };\n void poll2();\n }\n input.focus();\n return () => {\n active = false;\n };\n }\n window.engine7ConsoleExtensions = {\n pages: (marker) => [\n {\n key: "terminal",\n label: "\\u7EC8\\u7AEF",\n mount: (body) => mount(body, marker)\n }\n ],\n onNavigate: (key) => history.replaceState(null, "", "#" + key)\n };\n\n // web-console/desktop/src/renderer/shared/aurora.ts\n var mounted = /* @__PURE__ */ new WeakMap();\n function mountAuroraChrome(root) {\n const existing = mounted.get(root);\n if (existing) return existing;\n const field = document.createElement("div");\n field.className = "aurora-field";\n field.setAttribute("aria-hidden", "true");\n const canvas = document.createElement("canvas");\n canvas.className = "aurora-particles";\n field.append(canvas);\n root.before(field);\n const ctx = canvas.getContext("2d");\n const button = root.querySelector("[data-aurora-control]");\n const reduced = matchMedia("(prefers-reduced-motion: reduce)");\n let reduceMotion = reduced.matches;\n let manualPause = false, away = false, frame = 0, previous = 0, time = 0;\n let width = 0, height = 0, dpr = 1;\n const colors = ["#a78bfa", "#6ecdff", "#ff6b9d", "#ffcf8a"];\n const random = (i) => {\n const n = Math.sin(i * 78.233 + 19.19) * 43758.5453;\n return n - Math.floor(n);\n };\n let points = [];\n const paused = () => manualPause || reduceMotion;\n function paint() {\n if (!ctx) return;\n ctx.setTransform(dpr, 0, 0, dpr, 0, 0);\n ctx.clearRect(0, 0, width, height);\n for (const p of points) {\n const t = (time + p.offset) % p.life / p.life;\n const fade = Math.max(0, Math.min(1, t * 8, (1 - t) * 8));\n ctx.globalAlpha = p.alpha * fade;\n ctx.fillStyle = p.color;\n ctx.fillRect(p.x + (t - 0.5) * p.span, p.y + (t - 0.5) * p.rise, p.size, p.size);\n }\n ctx.globalAlpha = 1;\n }\n function resize() {\n width = field.clientWidth;\n height = field.clientHeight;\n dpr = Math.min(devicePixelRatio || 1, 1.25);\n canvas.width = Math.max(1, Math.round(width * dpr));\n canvas.height = Math.max(1, Math.round(height * dpr));\n points = Array.from({ length: width <= 720 ? 110 : 260 }, (_, i) => ({\n x: width * (0.08 + random(i + 1) * 0.9),\n y: height * (0.2 + random(i + 10) * 0.8),\n span: (55 + random(i + 30) * 85) * (i % 3 ? 1 : -1),\n rise: (random(i + 40) - 0.5) * 40,\n life: 6 + random(i + 50) * 7,\n offset: random(i + 60) * 20,\n size: 0.7 + random(i + 70) * 1.1,\n color: colors[i % colors.length],\n alpha: 0.2 + random(i + 80) * 0.32\n }));\n paint();\n }\n function tick(now) {\n frame = 0;\n if (paused() || away || document.hidden || !canvas.isConnected || !ctx) return;\n if (!previous) previous = now;\n if (now - previous >= 1e3 / 24) {\n time += Math.min((now - previous) / 1e3, 0.1);\n previous = now;\n paint();\n }\n frame = requestAnimationFrame(tick);\n }\n function synchronize() {\n cancelAnimationFrame(frame);\n frame = 0;\n previous = 0;\n const still = paused();\n document.documentElement.classList.toggle("aurora-motion-paused", still);\n button.setAttribute("aria-pressed", String(still));\n button.disabled = reduceMotion;\n button.setAttribute("aria-label", reduceMotion ? "\\u7CFB\\u7EDF\\u5DF2\\u51CF\\u5C11\\u88C5\\u9970\\u52A8\\u6548" : still ? "\\u5F00\\u542F\\u88C5\\u9970\\u52A8\\u6548" : "\\u5173\\u95ED\\u88C5\\u9970\\u52A8\\u6548");\n button.title = button.getAttribute("aria-label");\n canvas.dataset.motion = still ? "paused" : away || document.hidden || !ctx ? "offscreen" : "playing";\n if (canvas.dataset.motion === "playing") frame = requestAnimationFrame(tick);\n }\n button.addEventListener("click", () => {\n manualPause = !manualPause;\n synchronize();\n });\n reduced.addEventListener("change", (event) => {\n reduceMotion = event.matches;\n synchronize();\n });\n document.addEventListener("visibilitychange", synchronize);\n addEventListener("pagehide", () => {\n away = true;\n synchronize();\n });\n addEventListener("pageshow", () => {\n away = false;\n synchronize();\n });\n new ResizeObserver(resize).observe(field);\n const chrome2 = { setScene(key) {\n field.dataset.scene = key;\n root.dataset.scene = key;\n } };\n mounted.set(root, chrome2);\n resize();\n synchronize();\n return chrome2;\n }\n\n // web-console/desktop/src/renderer/shared/dom.ts\n function h(tag, attrs = {}, ...children) {\n const el = document.createElement(tag);\n for (const [k, v] of Object.entries(attrs)) {\n if (v === null || v === void 0 || v === false) continue;\n if (k === "class") el.className = String(v);\n else if (k === "style") el.setAttribute("style", String(v));\n else if (k.startsWith("on") && typeof v === "function") el.addEventListener(k.slice(2), v);\n else if (k === "checked" || k === "disabled" || k === "selected" || k === "hidden" || k === "value" || k === "type") {\n ;\n el[k] = v;\n } else el.setAttribute(k, String(v));\n }\n for (const c of children) {\n if (c === null || c === void 0) continue;\n el.append(c instanceof Node ? c : document.createTextNode(String(c)));\n }\n return el;\n }\n\n // web-console/desktop/src/renderer/shared/brand.ts\n var BRAND = {\n feishu: { color: "#3370ff", char: "\\u98DE" },\n wechat: { color: "#07c160", char: "\\u5FAE" },\n dingtalk: { color: "#0089ff", char: "\\u9489" },\n wecom: { color: "#2e6be6", char: "\\u4F01" },\n whatsapp: { color: "#25d366", char: "W" },\n telegram: { color: "#2aabee", char: "T" },\n discord: { color: "#5865f2", char: "D" }\n };\n function brandBadge(name, small = false) {\n const box = h("span", { class: `chan-badge${small ? " small" : ""}` });\n const logo = CHANNEL_LOGOS[name];\n if (logo) {\n const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");\n svg.setAttribute("viewBox", `0 0 ${logo.view}`);\n svg.setAttribute("fill", "currentColor");\n svg.style.color = logo.color;\n svg.innerHTML = logo.body;\n box.appendChild(svg);\n return box;\n }\n const b = BRAND[name];\n box.textContent = b ? b.char : name[0]?.toUpperCase() ?? "?";\n box.style.background = b?.color ?? "#8a8f98";\n return box;\n }\n var CHANNEL_LOGOS = {\n dingtalk: { view: "24 24", color: "#0089ff", body: \'<path fill="currentColor" fill-rule="evenodd" d="M6.802 2.02a1 1 0 0 1 .849.22l9.751 8.359a2 2 0 0 1 .235 2.799l-1.06 1.272l.87.436a1 1 0 0 1 .134 1.708l-7 5a1 1 0 0 1-1.539-1.101l1.21-4.034c-2.363-.9-3.747-3.055-4.233-5.483A1 1 0 0 1 7.01 10c-.474-.703-.86-1.42-1.134-2.149c-.649-1.73-.658-3.523.23-5.298a1 1 0 0 1 .696-.533" clip-rule="evenodd"/>\' },\n wecom: { view: "24 24", color: "#2e6be6", body: \'<path fill="currentColor" d="M12 1c6.075 0 11 4.925 11 11s-4.925 11-11 11S1 18.075 1 12S5.925 1 12 1m3.52 15.49a.35.35 0 0 0-.24.1c-.14.13-.16.34.02.53l.07.07c.44.44.74.99.85 1.57c0 .02.04.23.04.23c.05.19.15.37.29.5c.21.21.51.34.82.34c.3 0 .59-.12.8-.33c.44-.44.44-1.16 0-1.61c-.15-.15-.34-.26-.53-.3l-.15-.03c-.61-.11-1.17-.41-1.62-.86c-.03-.03-.07-.07-.1-.11c-.06-.074-.16-.1-.25-.1M11 4.75c-2.117 0-4.264.77-5.75 2.31C4.111 8.246 3.5 9.72 3.5 11.24c0 1.06.3 2.12.88 3.06c.47.695.993 1.371 1.66 1.89l-.384 1.624a.6.6 0 0 0 .856.673L8.64 17.41c.53.166 1.08.234 1.63.3a8.3 8.3 0 0 0 1.7-.03l.38-.05q.283-.046.564-.112a2.33 2.33 0 0 1-.92-1.605l-.254.037c-.62.067-1.232.03-1.85-.04c-.43-.057-.838-.185-1.25-.31l-1.02.5l.23-.67l-.74-.6c-.513-.401-.917-.934-1.28-1.47c-.4-.65-.61-1.38-.61-2.11c0-1.08.456-2.119 1.26-2.97c1.158-1.198 2.854-1.78 4.5-1.78c1.54 0 3.108.513 4.24 1.58c.365.365.707.75.95 1.21c.177.354.338.722.424 1.107a2.34 2.34 0 0 1 1.811.123c-.075-.716-.33-1.4-.665-2.04c-.329-.62-.776-1.155-1.27-1.65c-1.468-1.38-3.471-2.08-5.47-2.08m9.37 9.77a1.136 1.136 0 0 0-1.1.86l-.03.15a3.1 3.1 0 0 1-.86 1.63c-.04.03-.07.07-.11.1c-.14.13-.14.35 0 .49c.07.06.17.1.26.1h.01c.07 0 .15-.02.26-.13l.07-.07c.44-.44.99-.74 1.57-.85c.023 0 .227-.04.23-.04c.2-.06.37-.16.5-.3c.44-.44.44-1.17 0-1.61c-.21-.21-.5-.33-.8-.33m-4.21-1.07c-.08 0-.16.03-.27.14l-.07.07c-.44.44-.99.74-1.57.85c-.02 0-.23.04-.23.04c-.2.06-.37.16-.5.3c-.44.44-.44 1.17 0 1.61c.21.21.51.34.82.34c.3 0 .59-.12.8-.33c.15-.16.25-.34.29-.53a.4.4 0 0 0 .03-.16c.11-.61.41-1.18.86-1.63c.03-.03.06-.06.1-.09c.146-.115.13-.36 0-.49a.34.34 0 0 0-.26-.12m1.18-1.97c-.3 0-.59.12-.8.33c-.44.44-.44 1.16 0 1.61c.15.15.34.26.53.3c.054.006.144.029.15.03c.61.12 1.17.41 1.62.86c.03.03.07.07.1.11c.08.08.16.1.25.1c.1 0 .16-.04.23-.11c.12-.13.14-.32-.02-.52l-.08-.08c-.44-.44-.74-.99-.85-1.57c0-.02-.04-.23-.04-.23c-.05-.19-.15-.37-.29-.5c-.21-.21-.5-.33-.8-.33"/>\' },\n feishu: { view: "48 48", color: "#3370ff", body: \'<g fill="none"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M17 29c4 0 8-2.066 11-5.593C36 14 41.424 16.817 44 18c-5.5 3-3.5 11.623-11 18c-4.618 3.926-9.506 5.014-14 5c-6.477-.02-12.138-3.236-15-5.594V17"/><path fill="currentColor" d="M5.648 15.867a2 2 0 1 0-3.296 2.266zM36.002 35.73a2 2 0 0 0-2.004-3.462zM2.352 18.133c2.892 4.206 8.447 10.011 14.535 14.09c3.047 2.044 6.33 3.723 9.562 4.51c3.246.789 6.596.71 9.553-1.002l-2.004-3.462c-1.793 1.038-4.005 1.209-6.603.577c-2.612-.636-5.454-2.05-8.282-3.945c-5.662-3.795-10.856-9.24-13.465-13.034z"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M33.595 17c-.755-2.297-2.74-7.06-6-10h-16C15.217 10.676 23 16 27 24"/></g>\' },\n wechat: { view: "24 24", color: "#07c160", body: \'<path fill="currentColor" d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 0 1 .213.665l-.39 1.48c-.019.07-.048.141-.048.213c0 .163.13.295.29.295a.33.33 0 0 0 .167-.054l1.903-1.114a.86.86 0 0 1 .717-.098a10.2 10.2 0 0 0 2.837.403c.276 0 .543-.027.811-.05c-.857-2.578.157-4.972 1.932-6.446c1.703-1.415 3.882-1.98 5.853-1.838c-.576-3.583-4.196-6.348-8.596-6.348M5.785 5.991c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178A1.17 1.17 0 0 1 4.623 7.17c0-.651.52-1.18 1.162-1.18zm5.813 0c.642 0 1.162.529 1.162 1.18a1.17 1.17 0 0 1-1.162 1.178a1.17 1.17 0 0 1-1.162-1.178c0-.651.52-1.18 1.162-1.18m5.34 2.867c-1.797-.052-3.746.512-5.28 1.786c-1.72 1.428-2.687 3.72-1.78 6.22c.942 2.453 3.666 4.229 6.884 4.229c.826 0 1.622-.12 2.361-.336a.72.72 0 0 1 .598.082l1.584.926a.3.3 0 0 0 .14.047c.134 0 .24-.111.24-.247c0-.06-.023-.12-.038-.177l-.327-1.233a.6.6 0 0 1-.023-.156a.49.49 0 0 1 .201-.398C23.024 18.48 24 16.82 24 14.98c0-3.21-2.931-5.837-6.656-6.088V8.89c-.135-.01-.27-.027-.407-.03zm-2.53 3.274c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983a.976.976 0 0 1-.969-.983c0-.542.434-.982.97-.982zm4.844 0c.535 0 .969.44.969.982a.976.976 0 0 1-.969.983a.976.976 0 0 1-.969-.983c0-.542.434-.982.969-.982"/>\' },\n whatsapp: { view: "24 24", color: "#25d366", body: \'<path fill="currentColor" d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967c-.273-.099-.471-.148-.67.15c-.197.297-.767.966-.94 1.164c-.173.199-.347.223-.644.075c-.297-.15-1.255-.463-2.39-1.475c-.883-.788-1.48-1.761-1.653-2.059c-.173-.297-.018-.458.13-.606c.134-.133.298-.347.446-.52s.198-.298.298-.497c.099-.198.05-.371-.025-.52s-.669-1.612-.916-2.207c-.242-.579-.487-.5-.669-.51a13 13 0 0 0-.57-.01c-.198 0-.52.074-.792.372c-.272.297-1.04 1.016-1.04 2.479c0 1.462 1.065 2.875 1.213 3.074s2.096 3.2 5.077 4.487c.709.306 1.262.489 1.694.625c.712.227 1.36.195 1.871.118c.571-.085 1.758-.719 2.006-1.413s.248-1.289.173-1.413c-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214l-3.741.982l.998-3.648l-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884c2.64 0 5.122 1.03 6.988 2.898a9.82 9.82 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.82 11.82 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.9 11.9 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.82 11.82 0 0 0-3.48-8.413"/>\' },\n telegram: { view: "24 24", color: "#26a5e4", body: \'<path fill="currentColor" d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12a12 12 0 0 0 12-12A12 12 0 0 0 12 0zm4.962 7.224c.1-.002.321.023.465.14a.5.5 0 0 1 .171.325c.016.093.036.306.02.472c-.18 1.898-.962 6.502-1.36 8.627c-.168.9-.499 1.201-.82 1.23c-.696.065-1.225-.46-1.9-.902c-1.056-.693-1.653-1.124-2.678-1.8c-1.185-.78-.417-1.21.258-1.91c.177-.184 3.247-2.977 3.307-3.23c.007-.032.014-.15-.056-.212s-.174-.041-.249-.024q-.159.037-5.061 3.345q-.72.495-1.302.48c-.428-.008-1.252-.241-1.865-.44c-.752-.245-1.349-.374-1.297-.789q.04-.324.893-.663q5.247-2.286 6.998-3.014c3.332-1.386 4.025-1.627 4.476-1.635"/>\' },\n discord: { view: "24 24", color: "#5865f2", body: \'<path fill="currentColor" d="M20.317 4.37a19.8 19.8 0 0 0-4.885-1.515a.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.3 18.3 0 0 0-5.487 0a13 13 0 0 0-.617-1.25a.08.08 0 0 0-.079-.037A19.7 19.7 0 0 0 3.677 4.37a.1.1 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.08.08 0 0 0 .031.057a19.9 19.9 0 0 0 5.993 3.03a.08.08 0 0 0 .084-.028a14 14 0 0 0 1.226-1.994a.076.076 0 0 0-.041-.106a13 13 0 0 1-1.872-.892a.077.077 0 0 1-.008-.128a10 10 0 0 0 .372-.292a.07.07 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.07.07 0 0 1 .078.01q.181.149.373.292a.077.077 0 0 1-.006.127a12.3 12.3 0 0 1-1.873.892a.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.08.08 0 0 0 .084.028a19.8 19.8 0 0 0 6.002-3.03a.08.08 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.06.06 0 0 0-.031-.03M8.02 15.33c-1.182 0-2.157-1.085-2.157-2.419c0-1.333.956-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.956 2.418-2.157 2.418m7.975 0c-1.183 0-2.157-1.085-2.157-2.419c0-1.333.955-2.419 2.157-2.419c1.21 0 2.176 1.096 2.157 2.42c0 1.333-.946 2.418-2.157 2.418"/>\' }\n };\n\n // web-console/desktop/src/renderer/console/ui.ts\n function channelLabel(name) {\n if (name === "feishu") return "\\u98DE\\u4E66";\n if (name === "wechat") return "\\u5FAE\\u4FE1";\n if (name === "discord") return "Discord";\n if (name === "dingtalk") return "\\u9489\\u9489";\n if (name === "wecom") return "\\u4F01\\u4E1A\\u5FAE\\u4FE1";\n if (name === "whatsapp") return "WhatsApp";\n if (name === "telegram") return "Telegram";\n return name;\n }\n function channelLight(c) {\n if (!c.enabled) return { status: "off", text: "\\u26D4 \\u672A\\u542F\\u7528" };\n if (c.hasCredentials) return { status: "green", text: "\\u2705 \\u5DF2\\u914D\\u7F6E" };\n return { status: "amber", text: "\\u26A0\\uFE0F \\u7F3A\\u51ED\\u8BC1" };\n }\n function openModal(content) {\n const mask = document.getElementById("console-modal");\n if (!mask) throw new Error("DOM #console-modal \\u4E0D\\u5B58\\u5728");\n mask.replaceChildren(content);\n mask.hidden = false;\n return {\n root: mask,\n close: () => {\n mask.hidden = true;\n mask.replaceChildren();\n }\n };\n }\n function qrDataUrl(url, size = 260) {\n return Promise.resolve().then(() => __toESM(require_browser(), 1)).then((q) => q.toDataURL(url, { width: size, margin: 1, errorCorrectionLevel: "M" }));\n }\n function fmtUptime(sec) {\n if (sec < 60) return `${sec} \\u79D2`;\n if (sec < 3600) return `${Math.floor(sec / 60)} \\u5206\\u949F`;\n const h2 = Math.floor(sec / 3600);\n const m = Math.floor(sec % 3600 / 60);\n return m ? `${h2} \\u5C0F\\u65F6 ${m} \\u5206` : `${h2} \\u5C0F\\u65F6`;\n }\n var NAV_ICON_SVG = {\n status: \'<path d="M3 12h4l2.5-6 4 12 2.5-6h5"/>\',\n channels: \'<path d="M4 5h16v11H9l-5 4z"/>\',\n travel: \'<path d="M4 17h16M8 17l-2-5 5 1 6-8 3 2-4 8 4 2"/><path d="M6 7l3 1"/>\',\n email: \'<path d="m9 15 6-6M8 17l-2 2a4 4 0 0 1-6-6l5-5a4 4 0 0 1 6 0m2-1 2-2a4 4 0 0 1 6 6l-5 5a4 4 0 0 1-6 0"/>\',\n settings: \'<path d="M4 7h9M19 7h1M4 17h3M13 17h7"/><circle cx="16" cy="7" r="2.4"/><circle cx="10" cy="17" r="2.4"/>\',\n logs: \'<path d="M9 6h11M9 12h11M9 18h11"/><circle cx="4.5" cy="6" r="1.2"/><circle cx="4.5" cy="12" r="1.2"/><circle cx="4.5" cy="18" r="1.2"/>\'\n };\n function navIcon(key) {\n const d = NAV_ICON_SVG[key];\n if (!d) return null;\n const wrap = document.createElementNS("http://www.w3.org/2000/svg", "svg");\n wrap.setAttribute("viewBox", "0 0 24 24");\n wrap.setAttribute("fill", "none");\n wrap.setAttribute("stroke", "currentColor");\n wrap.setAttribute("stroke-width", "1.8");\n wrap.setAttribute("stroke-linecap", "round");\n wrap.setAttribute("stroke-linejoin", "round");\n wrap.innerHTML = d;\n return wrap;\n }\n\n // web-console/desktop/src/renderer/shared/setup-design.ts\n var paths = {\n heart: "M20 5a5 5 0 0 0-8 1 5 5 0 0 0-8-1c-4 5 2 10 8 15 6-5 12-10 8-15Z",\n memory: "M4 3h14v18H4zM8 7h6m-6 4h6m-6 4h4M18 6h3v16",\n chat: "M21 11a9 9 0 0 1-9 9H4l1-4a9 9 0 1 1 16-5ZM7 10h10m-10 4h6",\n work: "M3 7h18v14H3zM8 7V4h8v3M3 12a23 23 0 0 0 18 0",\n leaf: "M20 3C8 1 2 7 5 15s18 7 15-12ZM5 20 16 9M8 16v-5m5 0h5",\n key: "M12 8a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm0 4 9 9m-5-5 3-3m-6 0 3-3",\n file: "M14 2H5v20h14V7zM14 2v6h5M8 12h8m-8 4h6",\n arrow: "M4 12h16m-6-6 6 6-6 6",\n check: "m5 12 4 4L20 5",\n image: "M3 3h18v18H3zM3 17l6-6 4 4 4-4 4 4"\n };\n function designIcon(name) {\n const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");\n for (const [key, value] of Object.entries({ viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "1.5", "stroke-linecap": "round", "stroke-linejoin": "round", "aria-hidden": "true", class: "design-icon" })) svg.setAttribute(key, value);\n const path = document.createElementNS(svg.namespaceURI, "path");\n path.setAttribute("d", paths[name]);\n svg.append(path);\n return svg;\n }\n function stepHeading(kicker, title, sub) {\n return h("div", { class: "step-heading" }, h("p", { class: "aurora-eyebrow" }, kicker), h("h2", {}, title), h("p", { class: "step-sub" }, sub));\n }\n\n // web-console/desktop/src/shared/engine-state.ts\n var STARTING_GRACE_MS = 12e4;\n function classifySilent(processAlive, silentSinceMs, nowMs, graceMs = STARTING_GRACE_MS) {\n if (!processAlive) return { state: "stopped", silentSinceMs: null };\n const since2 = silentSinceMs ?? nowMs;\n if (nowMs - since2 > graceMs) return { state: "warn", silentSinceMs: since2 };\n return { state: "starting", silentSinceMs: since2 };\n }\n var STATE_TEXT = {\n running: "\\u25CF \\u8FD0\\u884C\\u4E2D",\n starting: "\\u25CC \\u542F\\u52A8\\u4E2D",\n stopped: "\\u25CB \\u5DF2\\u505C\\u6B62",\n warn: "\\u26A0\\uFE0F \\u672A\\u54CD\\u5E94"\n };\n var STATE_DETAIL = {\n running: "",\n starting: "\\u5F15\\u64CE\\u8FDB\\u7A0B\\u5DF2\\u8D77\\uFF0C\\u6B63\\u5728\\u7B49\\u5B83\\u628A\\u63A5\\u53E3\\u5F00\\u51FA\\u6765\\u2014\\u2014\\u901A\\u5E38\\u5341\\u51E0\\u79D2\\u5230\\u534A\\u5206\\u949F\\u3002",\n stopped: "",\n warn: "\\u7AEF\\u53E3\\u88AB\\u5360\\u7528\\u6216\\u5F15\\u64CE\\u50F5\\u6B7B\\uFF0C\\u53EF\\u5C1D\\u8BD5\\u91CD\\u542F\\u5F15\\u64CE\\u3002"\n };\n\n // web-console/desktop/src/renderer/shared/free-tier-text.ts\n var FREE_TIER_PITCH = "\\u4E0D\\u7528\\u6CE8\\u518C\\u3001\\u4E0D\\u7528\\u586B\\u4EFB\\u4F55 Key\\u2014\\u2014\\u5411\\u5BFC\\u4F1A\\u81EA\\u52A8\\u9886\\u4E00\\u628A\\u4E13\\u5C5E\\u4EE4\\u724C\\uFF0C\\u88C5\\u5B8C\\u5C31\\u80FD\\u5BF9\\u8BDD\\u3001\\u80FD\\u770B\\u56FE\\u3001\\u80FD\\u81EA\\u62CD\\u3002";\n var FREE_TIER_RUNNING = "\\u23F3 \\u6B63\\u5728\\u81EA\\u52A8\\u9886\\u53D6\\u4E13\\u5C5E\\u4EE4\\u724C\\u2026\\uFF08\\u51E0\\u79D2\\u949F\\uFF0C\\u4E0D\\u7528\\u70B9\\u4EFB\\u4F55\\u6309\\u94AE\\uFF09";\n function freeTierOkText(baseUrl, tail = "\\u3002") {\n return `\\u2705 \\u5DF2\\u81EA\\u52A8\\u9886\\u53D6\\u4E13\\u5C5E\\u4EE4\\u724C${baseUrl ? `\\uFF08\\u6A21\\u578B\\u5730\\u5740 ${baseUrl}\\uFF09` : ""}\\u2014\\u2014\\u4E0D\\u7528\\u586B\\u4EFB\\u4F55 Key${tail}`;\n }\n var FREE_TIER_FAIL_HINT = "\\u53EF\\u4EE5\\u91CD\\u8BD5\\uFF0C\\u6216\\u8005\\u6539\\u7528\\u4F60\\u81EA\\u5DF1\\u7684 API Key\\uFF1A";\n var FREE_TIER_RESTART_NEEDED = "\\u26A0\\uFE0F \\u5F15\\u64CE\\u6B63\\u5728\\u8FD0\\u884C\\u2014\\u2014\\u4EE4\\u724C\\u8981\\u91CD\\u542F\\u540E\\u624D\\u52A0\\u8F7D\\uFF08\\u5BC6\\u94A5\\u6587\\u4EF6\\u7684\\u76D1\\u89C6\\u5668\\u53EA\\u5728\\u542F\\u52A8\\u65F6\\u8BE5\\u6587\\u4EF6\\u5B58\\u5728\\u65F6\\u624D\\u5EFA\\uFF09\\uFF0C\\u4E0D\\u91CD\\u542F\\u4F1A\\u4E00\\u53D1\\u6D88\\u606F\\u5C31 401\\u3002";\n var FREE_TIER_START_WHEN_READY = "\\u542F\\u52A8\\u5F15\\u64CE\\u540E\\u5C31\\u4F1A\\u7528\\u4E0A\\u514D\\u8D39\\u6863\\u3002";\n\n // web-console/desktop/src/renderer/shared/free-tier-card.ts\n function renderFreeTierCard(deps) {\n const status = h("div", { class: "inline-warn", hidden: true });\n const btn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void run();\n }\n }, "\\u5207\\u6362\\u5230\\u514D\\u8D39\\u6863");\n const run = async () => {\n btn.disabled = true;\n status.hidden = false;\n status.replaceChildren(h("div", {}, FREE_TIER_RUNNING));\n let r;\n try {\n r = await deps.applyFreeTier({ provision: !deps.tokenPresent });\n } catch (e) {\n r = { ok: false, error: e?.message || String(e) };\n }\n if (!r.ok) {\n status.replaceChildren(\n h("div", {}, `\\u274C ${r.error || "\\u5207\\u6362\\u5931\\u8D25"}`),\n h("div", { style: "margin-top:6px" }, FREE_TIER_FAIL_HINT),\n h(\n "div",\n { style: "margin-top:6px" },\n h("button", { class: "btn", type: "button", onclick: () => {\n void run();\n } }, "\\u91CD\\u8BD5"),\n h(\n "span",\n { style: "margin-left:8px;color:var(--muted);font-size:14px" },\n "\\u60F3\\u7528\\u81EA\\u5DF1\\u7684 Key\\uFF1A\\u5173\\u6389\\u672C\\u7A97\\u53E3\\u91CD\\u8DD1\\u5B89\\u88C5\\u7A0B\\u5E8F\\uFF0C\\u9009\\u300C\\u91CD\\u65B0\\u914D\\u7F6E\\u300D\\u3002"\n )\n )\n );\n btn.disabled = false;\n return;\n }\n const okRows = [h("div", {}, freeTierOkText(r.baseUrl || ""))];\n if (r.primary) okRows.push(h("div", { style: "margin-top:4px;color:var(--muted)" }, `\\u4E3B\\u6A21\\u578B\\uFF1A${r.primary}`));\n okRows.push(h(\n "div",\n { style: "margin-top:6px" },\n deps.engineRunning ? FREE_TIER_RESTART_NEEDED : FREE_TIER_START_WHEN_READY\n ));\n if (deps.engineRunning && deps.restartEngine) {\n okRows.push(h("button", {\n class: "btn btn-primary",\n type: "button",\n style: "margin-top:6px",\n onclick: () => {\n deps.restartEngine();\n deps.onRefresh?.();\n }\n }, "\\u91CD\\u542F\\u5F15\\u64CE"));\n }\n status.replaceChildren(...okRows);\n btn.hidden = true;\n deps.onApplied?.();\n };\n return h(\n "div",\n { class: "report-block", id: "free-tier-card" },\n h("div", { style: "font-weight:600;margin-bottom:4px" }, "\\u{1F4A1} \\u53EF\\u4EE5\\u7528\\u514D\\u8D39\\u989D\\u5EA6"),\n h("div", { style: "line-height:1.6" }, FREE_TIER_PITCH),\n h("div", { style: "margin:8px 0" }, btn),\n status\n );\n }\n\n // web-console/desktop/src/renderer/shared/update-card.ts\n var DOWNLOAD_PAGE_URL = "https://www.twinsun.top/download/";\n function stageText(ev) {\n switch (ev.event) {\n case "downloading":\n return `\\u6B63\\u5728\\u4E0B\\u8F7D\\u66F4\\u65B0\\u2026 ${Math.max(0, Math.min(100, Math.round(ev.pct)))}%`;\n case "verifying":\n return "\\u6B63\\u5728\\u6821\\u9A8C\\u2026";\n case "stopping":\n return "\\u6B63\\u5728\\u505C\\u6B62\\u52A9\\u624B\\u2026";\n case "applying":\n return "\\u6B63\\u5728\\u5B89\\u88C5\\u2026";\n case "starting":\n return "\\u6B63\\u5728\\u91CD\\u542F\\u52A9\\u624B\\u2026";\n default:\n return "";\n }\n }\n function renderUpdateCard(deps) {\n const root = h("div", { class: "report-block", id: "update-card" });\n let state = { s: "checking" };\n let last = null;\n const paint = () => {\n root.replaceChildren(...frame());\n };\n const frame = () => {\n switch (state.s) {\n case "checking":\n return [\n title(),\n h("p", { class: "page-sub", style: "margin:6px 0" }, h("span", { class: "spinner" }), "\\u6B63\\u5728\\u68C0\\u67E5\\u66F4\\u65B0...")\n ];\n case "latest":\n return [\n title(),\n h("div", { class: "up-muted" }, last?.current ? `\\u5DF2\\u662F\\u6700\\u65B0\\u7248\\u672C v${last.current}` : "\\u5DF2\\u662F\\u6700\\u65B0\\u7248\\u672C"),\n actions([checkBtn()])\n ];\n case "available":\n return [\n title(),\n h("div", { class: "update-hint" }, `\\u53EF\\u5347\\u7EA7\\u5230 v${last?.latest ?? ""}`),\n ...last?.notes ? [h("div", { class: "up-muted" }, last.notes)] : [],\n actions([upgradeBtn()])\n ];\n case "confirming":\n return [\n title(),\n h("div", { class: "update-hint" }, `\\u53EF\\u5347\\u7EA7\\u5230 v${last?.latest ?? ""}`),\n ...last?.notes ? [h("div", { class: "up-muted" }, last.notes)] : [],\n h("div", { class: "inline-warn" }, "\\u5347\\u7EA7\\u9700\\u8981\\u91CD\\u542F\\u52A9\\u624B\\uFF0C\\u6B63\\u5728\\u8FDB\\u884C\\u7684\\u5BF9\\u8BDD\\u4F1A\\u4E2D\\u65AD\\u3002"),\n actions([\n h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n if (state.s !== "confirming") return;\n void apply();\n }\n }, "\\u786E\\u8BA4\\u5347\\u7EA7"),\n h("button", { class: "btn", type: "button", onclick: () => {\n state = { s: "available" };\n paint();\n } }, "\\u53D6\\u6D88")\n ])\n ];\n case "available-full":\n return [\n title(),\n h("div", { class: "update-hint" }, `\\u65B0\\u7248\\u672C v${last?.latest ?? ""} \\u9700\\u4E0B\\u8F7D\\u5B8C\\u6574\\u5B89\\u88C5\\u5305`),\n actions([h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => deps.openDownloadPage()\n }, "\\u524D\\u5F80\\u4E0B\\u8F7D")])\n ];\n case "progressing":\n return [\n title(),\n h("p", { class: "page-sub", style: "margin:6px 0" }, h("span", { class: "spinner" }), state.stage),\n h("div", { class: "up-muted" }, "\\u5347\\u7EA7\\u671F\\u95F4\\u8BF7\\u52FF\\u4FEE\\u6539\\u901A\\u9053\\u914D\\u7F6E\\u3002")\n ];\n case "done":\n return [\n title(),\n h("div", { class: "update-hint done" }, `\\u5DF2\\u5347\\u7EA7\\u5230 v${state.version} \\u2705`),\n actions([checkBtn()])\n ];\n case "failed":\n return [\n title(),\n h("div", { class: "inline-error" }, `\\u5347\\u7EA7\\u5931\\u8D25\\uFF1A${state.error}`),\n actions([h("button", { class: "btn", type: "button", onclick: () => {\n void check();\n } }, "\\u91CD\\u8BD5")])\n ];\n case "error-check":\n return [\n title(),\n h(\n "div",\n { class: "inline-warn" },\n "\\u68C0\\u67E5\\u66F4\\u65B0\\u5931\\u8D25\\uFF08\\u7F51\\u7EDC\\uFF09\\uFF0C\\u8BF7\\u7A0D\\u540E\\u518D\\u8BD5\\u3002",\n ...state.error ? [h("span", { class: "up-muted" }, `\\uFF08${state.error}\\uFF09`)] : []\n ),\n actions([h("button", { class: "btn", type: "button", onclick: () => {\n void check();\n } }, "\\u91CD\\u8BD5")])\n ];\n }\n };\n const title = () => h("div", { style: "font-weight:600;margin-bottom:4px" }, "\\u7248\\u672C\\u66F4\\u65B0");\n const actions = (btns) => h("div", { class: "update-actions" }, ...btns);\n const checkBtn = () => h("button", { class: "btn", type: "button", onclick: () => {\n void check();\n } }, "\\u68C0\\u67E5\\u66F4\\u65B0");\n const upgradeBtn = () => h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n if (state.s !== "available") return;\n state = { s: "confirming" };\n paint();\n }\n }, "\\u5347\\u7EA7");\n const check = async () => {\n state = { s: "checking" };\n paint();\n let r;\n try {\n r = await deps.updateCheck();\n } catch (e) {\n state = { s: "error-check", error: e instanceof Error ? e.message : String(e) };\n paint();\n return;\n }\n last = r;\n if (r.latest === null) state = { s: "error-check", error: null };\n else if (!r.hasUpdate) state = { s: "latest" };\n else state = r.depsChanged ? { s: "available-full" } : { s: "available" };\n paint();\n };\n const apply = async () => {\n state = { s: "progressing", stage: "\\u6B63\\u5728\\u51C6\\u5907\\u5347\\u7EA7..." };\n paint();\n try {\n const r = await deps.updateApply();\n if (state.s !== "progressing") return;\n state = r.ok ? { s: "done", version: r.version } : { s: "failed", error: r.error };\n } catch (e) {\n if (state.s !== "progressing") return;\n state = { s: "failed", error: e instanceof Error ? e.message : String(e) };\n }\n paint();\n };\n const off = deps.onUpdateEvent((ev) => {\n if (state.s !== "progressing") return;\n const stage = stageText(ev);\n if (!stage) return;\n state = { s: "progressing", stage };\n paint();\n });\n void check();\n return Object.assign(root, { dispose: off });\n }\n\n // web-console/desktop/src/renderer/console/companion-name.ts\n function isUnnamedCompanion(name) {\n return !name.trim() || name.trim().toLowerCase() === "agent";\n }\n\n // web-console/desktop/src/renderer/console/pages/status.ts\n async function probeState(apiPort, deps, ourStateDir = "", silentSinceMs = null) {\n const raw = await deps.apiStatus(apiPort);\n const norm = (x) => x.split(String.fromCharCode(92)).join("/").replace(/\\/+$/, "").toLowerCase();\n const ours = !raw || !raw.stateDir || !ourStateDir ? "unknown" : norm(raw.stateDir) === norm(ourStateDir) ? "yes" : "no";\n const status = ours === "yes" ? raw : null;\n const mismatch = ours === "no" ? `\\u26A0\\uFE0F \\u7AEF\\u53E3 ${apiPort} \\u4E0A\\u7684\\u5F15\\u64CE\\u4E0D\\u662F\\u672C\\u673A\\u8FD9\\u4E2A agent\\uFF08${raw.stateDir || "\\u65E7\\u7248\\u5F15\\u64CE\\uFF0C\\u62A5\\u4E0D\\u51FA\\u8EAB\\u4EFD"}\\uFF09\\u2014\\u2014\\u5DF2\\u88AB\\u522B\\u7684\\u7A0B\\u5E8F/\\u5F15\\u64CE\\u5360\\u7528\\uFF0C\\u8BF7\\u6362\\u7AEF\\u53E3\\u3002` : null;\n if (status) return { state: "running", status, silentSinceMs: null, portWarning: null };\n if (await deps.isEngineAlive()) {\n return {\n state: "warn",\n status: null,\n silentSinceMs: null,\n portWarning: mismatch ?? `\\u26A0\\uFE0F \\u7AEF\\u53E3 ${apiPort} \\u6709\\u7A0B\\u5E8F\\u5728\\u76D1\\u542C\\uFF0C\\u4F46\\u4E0D\\u54CD\\u5E94 /api/status\\u3002`\n };\n }\n const verdict = classifySilent(await deps.isEngineProcessAlive(ourStateDir), silentSinceMs, Date.now());\n const portWarning = verdict.state !== "starting" && mismatch ? mismatch : verdict.state === "stopped" ? `\\u26A0\\uFE0F \\u7AEF\\u53E3 ${apiPort} \\u4E0A\\u6CA1\\u6709\\u53EF\\u7528\\u5F15\\u64CE` : null;\n return { state: verdict.state, status: null, silentSinceMs: verdict.silentSinceMs, portWarning };\n }\n function mountStatus(body, marker, deps, actions, navigate) {\n const wrap = h(\n "div",\n { class: "page" },\n h("h2", {}, "\\u5F15\\u64CE\\u72B6\\u6001"),\n h("p", { class: "page-sub" }, h("span", { class: "spinner" }), "\\u6B63\\u5728\\u83B7\\u53D6\\u72B6\\u6001...")\n );\n body.replaceChildren(wrap);\n const runtimeDetails = h("details", { class: "design-details", id: "runtime-details" });\n let stopped = false;\n let companionName = null;\n let travelResult;\n const DOCTOR_TTL_MS = 3e4;\n let doctorAt = 0;\n let doctorReport = null;\n let lastState = null;\n let busy = null;\n let checking = false;\n let actionError = null;\n let lastStatus = null;\n let lastPortWarning = null;\n const repaint = () => {\n if (lastState) paint(lastState, lastStatus, lastPortWarning);\n };\n const runAction = async (kind, fn) => {\n if (busy) return;\n busy = kind;\n actionError = null;\n repaint();\n try {\n await fn();\n } catch (e) {\n actionError = e instanceof Error ? e.message : String(e);\n } finally {\n busy = null;\n void render();\n }\n };\n const paint = (state, status, portWarning = null) => {\n if (stopped) return;\n lastState = state;\n lastStatus = status;\n lastPortWarning = portWarning;\n const CHANNEL_ORDER = ["feishu", "wechat", "dingtalk", "wecom", "whatsapp", "telegram", "discord"];\n const channels = (status ? status.channels ?? [] : doctorReport?.channels ?? []).filter((c) => c.name !== "emotion").sort((a, b) => {\n const ia = CHANNEL_ORDER.indexOf(a.name);\n const ib = CHANNEL_ORDER.indexOf(b.name);\n return (ia === -1 ? 99 : ia) - (ib === -1 ? 99 : ib);\n });\n const version = status ? status.engine7 : doctorReport?.version ?? "";\n const pendingDoctor = !status && !doctorReport;\n const stateBadge = {\n running: { cls: "ok", text: `\\u25CF \\u8FD0\\u884C\\u4E2D${status ? `\\uFF08\\u5DF2\\u8FD0\\u884C ${fmtUptime(status.uptimeSec)}\\uFF09` : ""}` },\n starting: { cls: "starting", text: `${STATE_TEXT.starting}\\u2026` },\n stopped: { cls: "off", text: STATE_TEXT.stopped },\n warn: { cls: "warn", text: "\\u26A0\\uFE0F \\u672A\\u54CD\\u5E94\\uFF08\\u7AEF\\u53E3\\u5360\\u7528\\u6216\\u5F15\\u64CE\\u50F5\\u6B7B\\uFF0C\\u53EF\\u5C1D\\u8BD5\\u91CD\\u542F\\uFF09" }\n }[state];\n const channelRows = channels.map((c) => {\n const light = channelLight(c);\n const mark = light.status === "green" ? "\\u2713" : light.status === "amber" ? "!" : "\\u2014";\n return h(\n "div",\n { class: "light-row" },\n h("span", { class: `light ${light.status}` }, mark),\n brandBadge(c.name, true),\n h("span", { class: "light-label" }, channelLabel(c.name)),\n h("span", { class: "light-note" }, light.text)\n );\n });\n if (!channelRows.length) {\n channelRows.push(h(\n "div",\n { class: "light-row" },\n h("span", { class: "light off" }, pendingDoctor ? "\\u2026" : "\\u2014"),\n h("span", { class: "light-label" }, "\\u804A\\u5929\\u901A\\u9053"),\n h("span", { class: "light-note" }, pendingDoctor ? "\\u6B63\\u5728\\u8BFB\\u53D6\\u901A\\u9053\\u914D\\u7F6E..." : "\\u6CA1\\u6709\\u914D\\u7F6E\\u4EFB\\u4F55\\u901A\\u9053")\n ));\n }\n const running = state === "running";\n const cloudOnline = travelResult?.ok && travelResult.snapshot?.active === "cloud";\n const localOnline = travelResult?.ok && travelResult.snapshot?.active === "local";\n const travelUnknown = travelResult && (!travelResult.ok || travelResult.connected && travelResult.snapshot?.active === "unknown");\n const starting = state === "starting";\n const configured = channels.filter((c) => c.enabled && c.hasCredentials).map((c) => channelLabel(c.name));\n const goButton = (key, label, primary = false) => navigate ? h("button", { class: primary ? "btn btn-primary" : "text-action", type: "button", "data-console-go": key, "data-layout-control": "", onclick: () => navigate(key) }, label, primary ? designIcon("arrow") : null) : null;\n const overview = (icon, label, value, detail, target) => h("div", { class: "overview-card" }, h("div", { class: "overview-label" }, designIcon(icon), label), h("strong", {}, value), h("p", {}, detail), goButton(target, "\\u67E5\\u770B\\u4E0E\\u8C03\\u6574 \\u2192"));\n runtimeDetails.replaceChildren(\n h("summary", { "data-layout-control": "" }, "\\u5F15\\u64CE\\u7248\\u672C\\u4E0E\\u5B8C\\u6574\\u901A\\u9053\\u72B6\\u6001"),\n h(\n "div",\n { class: "report-block" },\n h("div", { class: "report-version" }, version ? `Engine7 v${version}` : "Engine7\\uFF08\\u7248\\u672C\\u672A\\u77E5\\uFF09"),\n h("div", { class: "report-path" }, marker.stateDir)\n ),\n h("div", { class: "report-block" }, ...channelRows)\n );\n const heading = stepHeading(\n "YOUR COMPANION, CONNECTED",\n "",\n cloudOnline ? "\\u7535\\u8111\\u4F11\\u606F\\u65F6\\uFF0C\\u4E5F\\u53EF\\u4EE5\\u5728\\u5E38\\u7528\\u804A\\u5929\\u5E73\\u53F0\\u7EE7\\u7EED\\u76F8\\u4F34\\u3002" : travelUnknown ? "\\u6B63\\u5728\\u7B49\\u5F85\\u968F\\u884C\\u673A\\u7684\\u6700\\u65B0\\u72B6\\u6001\\u3002" : running || localOnline ? "\\u804A\\u5929\\u548C\\u5DE5\\u4F5C\\uFF0C\\u90FD\\u4ECE\\u4F60\\u5E38\\u7528\\u7684\\u5E73\\u53F0\\u5F00\\u59CB\\u3002" : starting ? "\\u6B63\\u5728\\u51C6\\u5907\\uFF0C\\u7A0D\\u7B49\\u4E00\\u4F1A\\u513F\\u3002" : "\\u51C6\\u5907\\u597D\\u540E\\uFF0C\\u518D\\u5F00\\u59CB\\u5BF9\\u8BDD\\u3002"\n );\n heading.querySelector("h2").replaceChildren(\n h("button", {\n class: "companion-name name-edit",\n type: "button",\n title: "\\u70B9\\u51FB\\u540D\\u5B57\\u53EF\\u6539\\u540D",\n "aria-label": "\\u4FEE\\u6539\\u4F19\\u4F34\\u540D\\u5B57",\n onclick: () => navigate?.("settings")\n }, companionName || "\\u4F19\\u4F34"),\n cloudOnline ? "\\u5728\\u4E91\\u7AEF\\u3002" : localOnline ? "\\u5728\\u7535\\u8111\\u4E0A\\u3002" : travelUnknown ? "\\u7684\\u968F\\u884C\\u72B6\\u6001\\u5F85\\u6838\\u9A8C\\u3002" : { running: "\\u5728\\u8FD9\\u91CC\\u3002", starting: "\\u5F88\\u5FEB\\u5C31\\u6765\\u3002", warn: "\\u6682\\u65F6\\u8054\\u7CFB\\u4E0D\\u4E0A\\u3002", stopped: "\\u6B63\\u5728\\u4F11\\u606F\\u3002" }[state]\n );\n wrap.replaceChildren(\n heading,\n ...companionName !== null && isUnnamedCompanion(companionName) ? [h(\n "div",\n { class: "inline-warn", "data-companion-name": "" },\n h("p", {}, companionName ? "\\u73B0\\u5728\\u7528\\u7684\\u662F\\u9ED8\\u8BA4\\u540D\\u5B57 Agent\\u3002\\u7ED9\\u4F19\\u4F34\\u8D77\\u4E2A\\u540D\\u5B57\\uFF0C\\u4EE5\\u540E\\u5C31\\u8FD9\\u6837\\u4ECB\\u7ECD\\u81EA\\u5DF1\\u3002" : "\\u4F19\\u4F34\\u8FD8\\u6CA1\\u6709\\u540D\\u5B57\\u3002\\u8D77\\u4E2A\\u540D\\u5B57\\uFF0C\\u4EE5\\u540E\\u5C31\\u8FD9\\u6837\\u4ECB\\u7ECD\\u81EA\\u5DF1\\u3002"),\n goButton("settings", "\\u7ED9\\u4F19\\u4F34\\u8D77\\u4E2A\\u540D\\u5B57 \\u2192")\n )] : [],\n ...portWarning && !cloudOnline ? [h("div", { class: "inline-warn", "data-port-warning": "" }, portWarning)] : [],\n ...travelResult?.connected || travelUnknown ? [h(\n "section",\n { class: "travel-presence" },\n h(\n "div",\n {},\n h("h3", {}, cloudOnline ? "\\u4F19\\u4F34\\u6B63\\u5728\\u4E91\\u7AEF\\u76F8\\u4F34" : localOnline ? "\\u4F19\\u4F34\\u6B63\\u5728\\u7535\\u8111\\u76F8\\u4F34" : travelUnknown ? "\\u968F\\u884C\\u72B6\\u6001\\u672A\\u66F4\\u65B0" : "\\u968F\\u884C\\u5DF2\\u8FDE\\u63A5"),\n h("p", { class: "page-sub" }, cloudOnline ? "\\u672C\\u673A\\u5F15\\u64CE\\u53EF\\u4EE5\\u4F11\\u606F\\uFF1B\\u63A5\\u56DE\\u7535\\u8111\\u8BF7\\u4ECE\\u968F\\u884C\\u9875\\u5B8C\\u6210\\u4EA4\\u63A5\\u3002" : "\\u67E5\\u770B\\u4E24\\u7AEF\\u8FD0\\u884C\\u4F4D\\u7F6E\\u548C\\u63A5\\u7EED\\u60C5\\u51B5\\u3002")\n ),\n goButton("travel", "\\u67E5\\u770B\\u968F\\u884C \\u2192")\n )] : [],\n h(\n "section",\n { class: "runtime-welcome" },\n h(\n "div",\n {},\n h("h3", {}, running && configured.length ? "\\u60F3\\u804A\\u804A\\uFF0C\\u6216\\u8005\\u6709\\u4EF6\\u4E8B\\u9700\\u8981\\u5E2E\\u5FD9\\uFF1F" : "\\u51C6\\u5907\\u597D\\u4E86\\uFF0C\\u5C31\\u4ECE\\u8FD9\\u91CC\\u5F00\\u59CB\\u3002"),\n h("p", {}, cloudOnline || localOnline ? "\\u5728\\u5DF2\\u7ECF\\u8FDE\\u63A5\\u7684\\u804A\\u5929\\u5E73\\u53F0\\u7ED9\\u4F19\\u4F34\\u53D1\\u6D88\\u606F\\uFF0C\\u4F19\\u4F34\\u4F1A\\u7EE7\\u7EED\\u5904\\u7406\\u3002" : !running ? "\\u542F\\u52A8\\u5F15\\u64CE\\u540E\\uFF0C\\u518D\\u5230\\u804A\\u5929\\u5E73\\u53F0\\u7ED9\\u4F19\\u4F34\\u53D1\\u6D88\\u606F\\u3002" : configured.length ? `\\u5728${configured.join("\\u3001")}\\u91CC\\u627E\\u5230\\u4F60\\u914D\\u7F6E\\u7684\\u673A\\u5668\\u4EBA\\uFF0C\\u53D1\\u4E00\\u6761\\u6D88\\u606F\\u786E\\u8BA4\\u53EF\\u4EE5\\u6536\\u5230\\u56DE\\u590D\\u3002` : "\\u5148\\u8FDE\\u63A5\\u4E00\\u4E2A\\u804A\\u5929\\u5E73\\u53F0\\uFF0C\\u5C31\\u80FD\\u5728\\u90A3\\u91CC\\u7ED9\\u4F19\\u4F34\\u53D1\\u6D88\\u606F\\u3002")\n ),\n goButton("channels", configured.length ? "\\u67E5\\u770B\\u804A\\u5929\\u5165\\u53E3" : "\\u8FDE\\u63A5\\u804A\\u5929\\u5E73\\u53F0", true)\n ),\n h(\n "div",\n { class: "runtime-status-line" },\n h("div", { class: `state-badge ${stateBadge.cls}` }, travelResult?.connected || travelUnknown ? "\\u672C\\u673A\\u5F15\\u64CE\\uFF1A" + stateBadge.text : stateBadge.text),\n STATE_DETAIL[state] ? h("div", { class: "report-path" }, STATE_DETAIL[state]) : null\n ),\n h(\n "div",\n { class: "btn-row" },\n travelResult?.connected || travelUnknown ? h("button", { class: "btn btn-primary", type: "button", onclick: () => navigate?.("travel") }, cloudOnline ? "\\u63A5\\u56DE\\u7535\\u8111\\u2026" : "\\u67E5\\u770B\\u968F\\u884C\\u72B6\\u6001\\u2026") : running ? h("button", {\n class: "btn btn-danger",\n type: "button",\n disabled: busy !== null,\n title: busy ? "\\u6709\\u52A8\\u4F5C\\u6B63\\u5728\\u6267\\u884C\\uFF0C\\u8BF7\\u7A0D\\u5019" : "",\n onclick: () => {\n void runAction("stop", actions.stop);\n }\n }, busy === "stop" ? "\\u505C\\u6B62\\u5F15\\u64CE\\uFF08\\u505C\\u6B62\\u4E2D\\u2026\\uFF09" : "\\u505C\\u6B62\\u5F15\\u64CE") : h("button", {\n class: "btn btn-primary",\n type: "button",\n disabled: starting || busy !== null,\n title: starting ? "\\u5F15\\u64CE\\u6B63\\u5728\\u542F\\u52A8\\uFF0C\\u8BF7\\u7A0D\\u5019" : busy ? "\\u6709\\u52A8\\u4F5C\\u6B63\\u5728\\u6267\\u884C\\uFF0C\\u8BF7\\u7A0D\\u5019" : "",\n onclick: () => {\n void runAction("start", actions.start);\n }\n }, starting || busy === "start" ? "\\u542F\\u52A8\\u5F15\\u64CE\\uFF08\\u542F\\u52A8\\u4E2D\\u2026\\uFF09" : "\\u542F\\u52A8\\u5F15\\u64CE"),\n h("button", {\n class: "btn",\n type: "button",\n disabled: !running || busy !== null || !!travelResult?.connected || !!travelUnknown,\n title: !running ? starting ? "\\u5F15\\u64CE\\u6B63\\u5728\\u542F\\u52A8" : "\\u5F15\\u64CE\\u672A\\u8FD0\\u884C" : busy ? "\\u6709\\u52A8\\u4F5C\\u6B63\\u5728\\u6267\\u884C\\uFF0C\\u8BF7\\u7A0D\\u5019" : "",\n onclick: () => {\n void runAction("restart", actions.restart);\n }\n }, busy === "restart" ? "\\u91CD\\u542F\\u5F15\\u64CE\\uFF08\\u91CD\\u542F\\u4E2D\\u2026\\uFF09" : "\\u91CD\\u542F\\u5F15\\u64CE"),\n h("button", {\n class: "btn",\n type: "button",\n disabled: checking,\n onclick: () => {\n void runSelfCheck();\n }\n }, checking ? "\\u8FD0\\u884C\\u81EA\\u68C0\\uFF08\\u81EA\\u68C0\\u4E2D\\u2026\\uFF09" : "\\u8FD0\\u884C\\u81EA\\u68C0")\n ),\n ...actionError ? [h("div", { class: "inline-error" }, `\\u64CD\\u4F5C\\u5931\\u8D25\\uFF1A${actionError}`)] : [],\n updateCardEl,\n selfCheckBox,\n h(\n "div",\n { class: "runtime-overview" },\n overview("chat", "\\u804A\\u5929\\u5E73\\u53F0", pendingDoctor ? "\\u6B63\\u5728\\u8BFB\\u53D6\\u914D\\u7F6E\\u2026" : configured.length ? configured.join("\\u3001") : "\\u5C1A\\u672A\\u914D\\u7F6E", "\\u914D\\u7F6E\\u72B6\\u6001\\u4E0D\\u4EE3\\u8868\\u8FDE\\u63A5\\u5DF2\\u9A8C\\u8BC1\\u3002", "channels"),\n overview("key", "\\u6A21\\u578B\\u670D\\u52A1", status?.model || "\\u542F\\u52A8\\u540E\\u53EF\\u67E5\\u770B", "\\u7528\\u4E8E\\u804A\\u5929\\u3001\\u7406\\u89E3\\u56FE\\u7247\\u548C\\u5904\\u7406\\u4EFB\\u52A1\\u3002", "settings"),\n overview("heart", "\\u4F19\\u4F34\\u8BBE\\u7F6E", "\\u6309\\u4F60\\u7684\\u65B9\\u5F0F\\u76F8\\u5904", "\\u7EE7\\u7EED\\u8C03\\u6574\\u5F62\\u8C61\\u3001\\u58F0\\u97F3\\u548C\\u76F8\\u5904\\u65B9\\u5F0F\\u3002", "settings")\n ),\n runtimeDetails\n );\n };\n let silentSinceMs = null;\n const render = async () => {\n if (stopped) return null;\n const travel = deps.travelControl?.(marker.stateDir, "status").catch(() => ({ ok: false, error: "service_unavailable" }));\n const r = await probeState(marker.apiPort, deps, marker.stateDir, silentSinceMs);\n silentSinceMs = r.silentSinceMs;\n if (stopped) return null;\n paint(r.state, r.status, r.portWarning);\n if (travel) {\n const result = await travel;\n if (stopped) return null;\n travelResult = result;\n paint(r.state, r.status, r.portWarning);\n }\n if (r.status) return r.state;\n if (Date.now() - doctorAt > DOCTOR_TTL_MS) {\n doctorAt = Date.now();\n doctorReport = await deps.doctor(marker.stateDir);\n paint(r.state, r.status, r.portWarning);\n }\n return r.state;\n };\n const updateCardEl = renderUpdateCard({\n updateCheck: () => deps.updateCheck(),\n updateApply: () => deps.updateApply(),\n onUpdateEvent: (cb) => deps.onUpdateEvent(cb),\n openDownloadPage: () => {\n window.open(DOWNLOAD_PAGE_URL, "_blank");\n }\n });\n updateCardEl.classList.add("runtime-update");\n const selfCheckBox = h("div", {});\n async function runSelfCheck() {\n if (checking) return;\n checking = true;\n repaint();\n try {\n selfCheckBox.replaceChildren(\n h("div", { class: "report-block" }, h("p", { class: "page-sub" }, h("span", { class: "spinner" }), "\\u6B63\\u5728\\u8FD0\\u884C\\u81EA\\u68C0..."))\n );\n const report = await deps.doctor(marker.stateDir);\n if (!report) {\n selfCheckBox.replaceChildren(h("div", { class: "inline-error" }, "\\u81EA\\u68C0\\u5DE5\\u5177\\u6CA1\\u6709\\u8FD4\\u56DE\\u7ED3\\u679C\\u2014\\u2014\\u8BF7\\u68C0\\u67E5\\u5B89\\u88C5\\u662F\\u5426\\u5B8C\\u6574\\u3002"));\n return;\n }\n const rows = [\n lightRow("\\u914D\\u7F6E\\u6587\\u4EF6", report.configValid, report.configValid ? "\\u914D\\u7F6E\\u6709\\u6548" : `\\u914D\\u7F6E\\u65E0\\u6548${report.configError ? `\\uFF1A${report.configError}` : ""}`),\n lightRow("\\u5BC6\\u94A5\\u6587\\u4EF6", report.secrets.exists, report.secrets.exists ? `\\u5B58\\u5728\\uFF08${report.secrets.keys.length} \\u4E2A\\u5BC6\\u94A5\\uFF09` : `\\u4E0D\\u5B58\\u5728\\uFF08${report.secrets.file}\\uFF09\\u2014\\u2014API Key \\u53EF\\u80FD\\u6CA1\\u914D`),\n lightRow("API \\u7AEF\\u53E3", true, `${report.apiPort}${report.engineAlive ? "\\uFF08\\u5F15\\u64CE\\u5B58\\u6D3B\\uFF09" : "\\uFF08\\u5F15\\u64CE\\u672A\\u8FD0\\u884C\\uFF09"}`),\n lightRow("\\u5F15\\u64CE\\u8FDB\\u7A0B", report.engineAlive, report.engineAlive ? "\\u5B58\\u6D3B" : "\\u672A\\u8FD0\\u884C")\n ];\n const ft = report.freeTier;\n const needUpgrade = !!ft && (!ft.on || !ft.tokenPresent);\n const engineRunning = lastState === "running" || lastState === "starting" || lastState === "warn";\n selfCheckBox.replaceChildren(\n h(\n "div",\n { class: "report-block" },\n h("div", { style: "font-weight:600;margin-bottom:4px" }, `\\u81EA\\u68C0\\u62A5\\u544A\\uFF08Engine7 v${report.version}\\uFF09`),\n ...rows\n ),\n ...needUpgrade ? [renderFreeTierCard({\n tokenPresent: !!ft.tokenPresent,\n engineRunning,\n applyFreeTier: (o) => deps.applyFreeTier(marker.stateDir, o),\n // \u5F15\u64CE\u5728\u8DD1\u5C31\u5FC5\u987B\u91CD\u542F\uFF1Asecrets \u7684\u76D1\u89C6\u5668\u53EA\u5728\u542F\u52A8\u65F6\u6587\u4EF6\u5DF2\u5B58\u5728\u65F6\u624D\u5EFA\uFF0C\n // \u521A\u5199\u7684\u4EE4\u724C\u70ED\u52A0\u8F7D\u63A5\u4E0D\u5230\uFF08\u5F15\u64CE src/reload/reload.ts \u7684 secrets-watch\uFF09\n // \u26A0\uFE0F \u8D70 runAction\uFF0C\u522B\u76F4\u63A5 `actions.restart()`\uFF1A\u7ED5\u8FC7\u5B83\u5C31\u7B49\u4E8E\u7ED5\u5F00"\u5728\u98DE\u7981\u7528 + \u5931\u8D25\u6709\u4EBA\u63A5"\n // \u2014\u2014 \u90A3\u6B63\u662F\u672C\u6B21\u8981\u6D88\u706D\u7684\u90A3\u7C7B\u9759\u9ED8\uFF08\u5361\u7247\u8FD9\u6761\u8DEF\u4EE5\u524D\u5C31\u662F\u8FD9\u4E48\u6F0F\u7684\uFF09\u3002\n restartEngine: engineRunning ? () => {\n void runAction("restart", actions.restart);\n } : void 0,\n // \u53EA\u5728\u91CD\u542F\u4E4B\u540E\u5237\u65B0\uFF1A\u6210\u529F\u65F6\u7ACB\u523B\u91CD\u6E32\u67D3\u4F1A\u628A\u5361\u7247\u8FDE\u300C\u91CD\u542F\u5F15\u64CE\u300D\u6309\u94AE\u4E00\u8D77\u62B9\u6389\n onRefresh: () => {\n void runSelfCheck();\n }\n })] : []\n );\n } finally {\n checking = false;\n repaint();\n }\n }\n let timer = null;\n const loop = async () => {\n const state = await render();\n if (stopped) return;\n timer = setTimeout(() => {\n void loop();\n }, state === "starting" ? 2500 : 5e3);\n };\n void loop();\n void (async () => {\n try {\n const got = await deps.configGet(marker.configPath);\n if (stopped || !got.ok) return;\n const agents = got.values.agents;\n const name = agents?.defaults?.name;\n companionName = typeof name === "string" ? name.trim() : "";\n repaint();\n } catch {\n }\n })();\n return () => {\n stopped = true;\n if (timer) clearTimeout(timer);\n updateCardEl.dispose();\n };\n }\n function lightRow(label, ok, text) {\n return h(\n "div",\n { class: "light-row" },\n h("span", { class: `light ${ok ? "green" : "red"}` }, ok ? "\\u2713" : "\\u2715"),\n h("span", { class: "light-label" }, label),\n h("span", { class: "light-note" }, text)\n );\n }\n\n // web-console/desktop/src/renderer/console/partner-menu.ts\n var PARTNER_STATE_TEXT = { running: "\\u5728\\u8FD9\\u91CC", starting: "\\u6B63\\u5728\\u51C6\\u5907", stopped: "\\u6B63\\u5728\\u4F11\\u606F", warn: "\\u6682\\u65F6\\u8054\\u7CFB\\u4E0D\\u4E0A" };\n var pathKey = (p) => p.replace(/[\\\\/]+$/, "").toLowerCase();\n function mountPartnerMenu(slot, trigger, engines, marker, deps, onPick, onError) {\n let alive = true, generation = 0, busy = false, activeReads = 0;\n let timer = null;\n let queue = [];\n const silent = /* @__PURE__ */ new Map(), probing = /* @__PURE__ */ new Set();\n const ordered = [...engines.filter((e) => pathKey(e.stateDir) === pathKey(marker.stateDir)), ...engines.filter((e) => pathKey(e.stateDir) !== pathKey(marker.stateDir))];\n const bindings = ordered.map((entry) => {\n const selected = pathKey(entry.stateDir) === pathKey(marker.stateDir);\n const nameEl = h("span", { class: "partner-option-name" }, "\\u6B63\\u5728\\u8BFB\\u53D6\\u540D\\u79F0");\n const avatar = h("span", { class: "partner-option-avatar", "aria-hidden": "true" }, "\\u6816");\n const directory = h("span", { class: "partner-option-path", hidden: true }, entry.label.replace(/^Engine7\\s*[\uFF08(](.*)[\uFF09)]$/, "$1"));\n const status = h("span", { class: "partner-option-status" }, "\\u6B63\\u5728\\u83B7\\u53D6\\u72B6\\u6001");\n const button = h(\n "button",\n {\n class: "partner-option",\n type: "button",\n role: "menuitemradio",\n "aria-checked": String(selected),\n "data-state-dir": entry.stateDir,\n "data-state": "unknown",\n title: entry.stateDir\n },\n avatar,\n h("span", { class: "partner-option-copy" }, nameEl, status, directory),\n selected ? h("span", { class: "partner-current", "aria-hidden": "true" }, "\\u5F53\\u524D") : null\n );\n return { entry, selected, button, nameEl, avatar, directory, status, name: void 0 };\n });\n const list = h("div", { class: "partner-menu-list" }, ...bindings.map((b) => b.button));\n const error = h("p", { class: "partner-menu-error", role: "status", hidden: true });\n const menu = h(\n "div",\n { id: "console-partner-menu", class: "partner-menu", popover: "auto", role: "menu", "aria-label": "\\u9009\\u62E9\\u4F19\\u4F34" },\n h("div", { class: "partner-menu-heading", "aria-hidden": "true" }, h("span", {}, "\\u9009\\u62E9\\u4F19\\u4F34"), h("span", {}, `${engines.length} \\u4F4D\\u4F19\\u4F34`)),\n list,\n error\n );\n slot.append(menu);\n trigger.setAttribute("aria-haspopup", "menu");\n trigger.setAttribute("aria-controls", menu.id);\n trigger.setAttribute("aria-expanded", "false");\n const fresh = (gen) => alive && gen === generation && menu.matches(":popover-open");\n const paintNames = () => {\n for (const b of bindings) {\n const label = b.name === void 0 ? "\\u6B63\\u5728\\u8BFB\\u53D6\\u540D\\u79F0" : b.name === null ? "\\u540D\\u79F0\\u6682\\u4E0D\\u53EF\\u7528" : b.name || "\\u672A\\u547D\\u540D\\u4F19\\u4F34";\n b.nameEl.textContent = label;\n b.nameEl.title = label;\n b.avatar.textContent = Array.from(b.name || "")[0] || "\\u6816";\n const duplicate = !!b.name && bindings.some((other) => other !== b && other.name === b.name);\n b.directory.hidden = b.name === void 0 || !!b.name && !duplicate;\n }\n };\n const drain = () => {\n while (alive && activeReads < 2 && queue.length) {\n const { entry, gen } = queue.shift();\n if (!fresh(gen)) continue;\n activeReads++;\n void deps.configGet(entry.configPath).then((got) => {\n if (!fresh(gen)) return;\n const raw = got.ok ? got.values.agents?.defaults?.name : void 0;\n bindings.find((b) => b.entry === entry).name = got.ok ? typeof raw === "string" ? raw.trim() : "" : null;\n paintNames();\n }).catch(() => {\n if (fresh(gen)) {\n bindings.find((b) => b.entry === entry).name = null;\n paintNames();\n }\n }).finally(() => {\n activeReads--;\n drain();\n });\n }\n };\n const probeAll = (gen) => {\n for (const b of bindings) {\n const key = pathKey(b.entry.stateDir);\n if (probing.has(key)) continue;\n probing.add(key);\n void probeState(b.entry.apiPort, {\n apiStatus: (p) => deps.apiStatus(p),\n isEngineAlive: () => deps.isEngineAlive(b.entry.apiPort),\n isEngineProcessAlive: (d) => deps.isEngineProcessAlive(d)\n }, b.entry.stateDir, silent.get(key) ?? null).then((result) => {\n if (!fresh(gen)) return;\n silent.set(key, result.silentSinceMs);\n b.button.dataset.state = result.state;\n b.status.textContent = PARTNER_STATE_TEXT[result.state];\n }).catch(() => {\n if (fresh(gen)) {\n b.button.dataset.state = "unknown";\n b.status.textContent = "\\u72B6\\u6001\\u6682\\u4E0D\\u53EF\\u7528";\n }\n }).finally(() => {\n probing.delete(key);\n });\n }\n };\n const focusRow = (index) => {\n const row = bindings[index]?.button;\n row?.focus();\n row?.scrollIntoView({ block: "nearest" });\n };\n const close = () => {\n menu.hidePopover();\n trigger.focus();\n };\n menu.addEventListener("beforetoggle", (event) => {\n const opening = event.newState === "open";\n trigger.setAttribute("aria-expanded", String(opening));\n const gen = ++generation;\n if (timer) {\n clearInterval(timer);\n timer = null;\n }\n queue = [];\n if (!opening) return;\n const r = trigger.closest(".partner-card").getBoundingClientRect();\n const width = Math.min(320, innerWidth - 24);\n menu.style.width = `${width}px`;\n menu.style.left = `${Math.max(12, Math.min(r.right + 12, innerWidth - width - 12))}px`;\n menu.style.top = `${Math.max(12, Math.min(r.top, innerHeight - Math.min(440, innerHeight - 24) - 12))}px`;\n menu.style.maxHeight = `${Math.min(440, innerHeight - 24)}px`;\n error.hidden = true;\n for (const b of bindings) if (!b.selected) {\n b.name = void 0;\n queue.push({ entry: b.entry, gen });\n }\n paintNames();\n queueMicrotask(() => {\n if (fresh(gen)) {\n drain();\n probeAll(gen);\n }\n });\n timer = setInterval(() => {\n if (fresh(gen)) probeAll(gen);\n }, 5e3);\n });\n menu.addEventListener("toggle", () => {\n if (menu.matches(":popover-open") && !busy) focusRow(0);\n });\n menu.addEventListener("keydown", (event) => {\n const index = bindings.findIndex((b) => b.button === document.activeElement);\n const target = event.key === "ArrowDown" ? (index + 1) % bindings.length : event.key === "ArrowUp" ? (index - 1 + bindings.length) % bindings.length : event.key === "Home" ? 0 : event.key === "End" ? bindings.length - 1 : null;\n if (target !== null) {\n event.preventDefault();\n if (!busy) focusRow(target);\n }\n if (event.key === "Escape") {\n event.preventDefault();\n event.stopPropagation();\n close();\n }\n });\n trigger.addEventListener("click", () => {\n if (!busy) menu.matches(":popover-open") ? close() : menu.showPopover();\n });\n trigger.addEventListener("keydown", (event) => {\n if (event.key === "ArrowDown" && !busy) {\n event.preventDefault();\n menu.showPopover();\n }\n });\n for (const b of bindings) b.button.addEventListener("click", () => {\n if (busy) return;\n if (b.selected) {\n close();\n return;\n }\n busy = true;\n trigger.disabled = true;\n for (const row of bindings) row.button.disabled = true;\n error.hidden = true;\n onError("");\n void (async () => {\n try {\n if (await onPick(b.entry.stateDir)) {\n document.getElementById("console-partner-switch")?.focus();\n return;\n }\n } catch {\n }\n if (alive) {\n const message = "\\u5207\\u6362\\u672A\\u6210\\u529F\\uFF0C\\u8BF7\\u91CD\\u8BD5\\u3002";\n error.textContent = message;\n error.hidden = false;\n onError(message);\n }\n })().finally(() => {\n if (!alive) return;\n busy = false;\n trigger.disabled = false;\n for (const row of bindings) row.button.disabled = false;\n });\n });\n return {\n updateCurrentName(name) {\n if (alive) {\n for (const b of bindings) if (b.selected) b.name = name;\n paintNames();\n }\n },\n dispose() {\n alive = false;\n generation++;\n queue = [];\n if (timer) clearInterval(timer);\n if (menu.matches(":popover-open")) menu.hidePopover();\n menu.remove();\n }\n };\n }\n\n // web-console/desktop/src/renderer/console/partner-card.ts\n function mountPartnerCard(slot, marker, deps, onName, options) {\n let alive = true, nameGen = 0, probing = false;\n let silentSinceMs = null;\n const glyph = h("span", { class: "partner-glyph" }, "\\u6816");\n const avatar = h("span", { class: "partner-avatar", "aria-hidden": "true" }, glyph);\n const name = h("button", {\n class: "partner-name name-edit",\n type: "button",\n title: "\\u70B9\\u51FB\\u540D\\u5B57\\u53EF\\u6539\\u540D",\n "aria-label": "\\u4FEE\\u6539\\u4F19\\u4F34\\u540D\\u5B57",\n onclick: onName\n }, "\\u4F19\\u4F34");\n const state = h("span", { class: "partner-status", role: "status" }, "\\u6B63\\u5728\\u83B7\\u53D6\\u72B6\\u6001");\n const naming = h("button", { class: "partner-naming", type: "button", "data-partner-name": "", hidden: true, onclick: onName }, "\\u7ED9\\u4F19\\u4F34\\u8D77\\u4E2A\\u540D\\u5B57");\n const error = h("p", { class: "engine-picker-error", role: "status", hidden: true });\n const multi = !!options && options.engines.length > 1;\n const trigger = multi ? h("button", {\n id: "console-partner-switch",\n class: "partner-switch",\n type: "button",\n "aria-label": `\\u5207\\u6362\\u4F19\\u4F34\\uFF0C${options.engines.length}\\u4F4D\\u4F19\\u4F34`\n }, h("span", { class: "partner-count" }, String(options.engines.length)), h("span", { class: "partner-chevron", "aria-hidden": "true" })) : null;\n const card = h(\n "section",\n {\n class: "partner-card",\n "data-state": "unknown",\n "data-state-dir": marker.stateDir,\n "data-multi": String(multi),\n "aria-label": "\\u5F53\\u524D\\u4F19\\u4F34"\n },\n h("div", { class: "partner-heading" }, h("span", { class: "partner-caption" }, "\\u4E0E\\u4F60\\u76F8\\u4F34"), trigger),\n h("div", { class: "partner-identity" }, avatar, h("div", { class: "partner-info" }, name, state)),\n naming\n );\n slot.replaceChildren(card, error);\n const menu = trigger && options ? mountPartnerMenu(slot, trigger, options.engines, marker, deps, options.onPick, (message) => {\n error.textContent = message;\n error.hidden = !message;\n }) : null;\n const refreshName = () => {\n const gen = ++nameGen;\n naming.hidden = true;\n void deps.configGet(marker.configPath).then((got) => {\n if (!alive || gen !== nameGen) return;\n const agents = got.ok ? got.values.agents : void 0;\n const raw = agents?.defaults?.name;\n const label = typeof raw === "string" ? raw.trim() : "";\n name.textContent = label || "\\u4F19\\u4F34";\n glyph.textContent = Array.from(label)[0] || "\\u6816";\n naming.textContent = isUnnamedCompanion(label) ? "\\u7ED9\\u4F19\\u4F34\\u8D77\\u4E2A\\u540D\\u5B57" : "\\u6539\\u540D";\n naming.classList.toggle("partner-renaming", !isUnnamedCompanion(label));\n naming.hidden = !got.ok;\n menu?.updateCurrentName(got.ok ? label : null);\n }).catch(() => {\n if (!alive || gen !== nameGen) return;\n name.textContent = "\\u4F19\\u4F34";\n glyph.textContent = "\\u6816";\n naming.hidden = true;\n menu?.updateCurrentName(null);\n });\n };\n const refreshState = async () => {\n if (!alive || probing) return;\n probing = true;\n try {\n const result = await probeState(marker.apiPort, {\n apiStatus: (p) => deps.apiStatus(p),\n isEngineAlive: () => deps.isEngineAlive(marker.apiPort),\n isEngineProcessAlive: (d) => deps.isEngineProcessAlive(d)\n }, marker.stateDir, silentSinceMs);\n if (!alive) return;\n silentSinceMs = result.silentSinceMs;\n card.dataset.state = result.state;\n state.textContent = PARTNER_STATE_TEXT[result.state];\n if (deps.travelControl) {\n const travel = await deps.travelControl(marker.stateDir, "status");\n if (!alive) return;\n if (travel.ok && travel.snapshot?.active === "cloud") {\n card.dataset.state = "running";\n state.textContent = "\\u5728\\u4E91\\u7AEF\\u76F8\\u4F34";\n } else if (travel.ok && travel.snapshot?.active === "local") {\n card.dataset.state = "running";\n state.textContent = "\\u5728\\u7535\\u8111\\u76F8\\u4F34";\n } else if (!travel.ok || travel.connected && travel.snapshot?.active === "unknown") {\n card.dataset.state = "unknown";\n state.textContent = "\\u968F\\u884C\\u72B6\\u6001\\u672A\\u66F4\\u65B0";\n }\n }\n } catch {\n if (alive) {\n card.dataset.state = "unknown";\n state.textContent = "\\u72B6\\u6001\\u6682\\u4E0D\\u53EF\\u7528";\n }\n } finally {\n probing = false;\n }\n };\n const refresh = () => {\n if (alive) {\n refreshName();\n void refreshState();\n }\n };\n const timer = setInterval(() => {\n void refreshState();\n }, 5e3);\n return { refresh, dispose: () => {\n alive = false;\n nameGen++;\n clearInterval(timer);\n menu?.dispose();\n } };\n }\n\n // web-console/desktop/src/renderer/console/qr-modal.ts\n var QR_COUNTDOWN_SEC = 300;\n var countdownSecOf = (channel) => channel === "dingtalk" ? null : QR_COUNTDOWN_SEC;\n function startReconfigScan(channel, deps) {\n const chanLabel = channel === "feishu" ? "\\u98DE\\u4E66" : channel === "dingtalk" ? "\\u9489\\u9489" : channel === "wecom" ? "\\u4F01\\u4E1A\\u5FAE\\u4FE1" : "\\u5FAE\\u4FE1";\n const scanHint = channel === "wechat" ? "\\u786E\\u8BA4\\u767B\\u5F55" : channel === "wecom" ? "\\u6309\\u63D0\\u793A\\u70B9\\u300C\\u4E00\\u952E\\u521B\\u5EFA\\u667A\\u80FD\\u673A\\u5668\\u4EBA\\u300D" : "\\u5B8C\\u6210\\u6388\\u6743";\n let modal = null;\n let countdownTimer = null;\n let left = 0;\n let doneCb = null;\n let stopped = false;\n const clearCountdown = () => {\n if (countdownTimer) {\n clearInterval(countdownTimer);\n countdownTimer = null;\n }\n };\n const closeModal = () => {\n if (modal) {\n modal.close();\n modal = null;\n }\n };\n const stop = () => {\n if (stopped) return;\n stopped = true;\n unsub();\n clearCountdown();\n closeModal();\n };\n const cancelAndStop = () => {\n if (stopped) return;\n void deps.cancelReconfig().catch(() => {\n });\n stop();\n };\n const tick = () => {\n if (left <= 0) return;\n left -= 1;\n const el = modal?.root.querySelector(".countdown");\n if (el) el.textContent = `\\u4E8C\\u7EF4\\u7801 ${Math.floor(left / 60)}:${String(left % 60).padStart(2, "0")} \\u5185\\u6709\\u6548\\uFF0C\\u7B49\\u5F85\\u626B\\u7801...`;\n };\n const closeX = () => h("button", {\n class: "modal-close",\n type: "button",\n title: "\\u53D6\\u6D88\\u626B\\u7801",\n "aria-label": "\\u53D6\\u6D88\\u626B\\u7801",\n onclick: () => cancelAndStop()\n }, "\\xD7");\n const showModal = (title, body) => {\n const box = h("div", { class: "modal" }, closeX(), h("h3", {}, title), ...body);\n if (modal) modal.root.replaceChildren(box);\n else modal = openModal(box);\n };\n const showQr = (url) => {\n const img = h("img", { class: "qr", alt: "\\u4E8C\\u7EF4\\u7801", width: 260, height: 260 });\n const countdown = h("div", { class: "countdown" }, "\\u7B49\\u5F85\\u626B\\u7801...");\n const secs = countdownSecOf(channel);\n showModal(`${chanLabel}\\u626B\\u7801`, [\n h("p", { class: "modal-sub" }, `\\u7528\\u624B\\u673A${chanLabel}\\u626B\\u63CF\\u4E8C\\u7EF4\\u7801${scanHint}`),\n img,\n countdown\n ]);\n qrDataUrl(url).then((data) => {\n img.src = data;\n }).catch(() => {\n countdown.textContent = "\\u4E8C\\u7EF4\\u7801\\u6E32\\u67D3\\u5931\\u8D25\\uFF0C\\u4F46\\u626B\\u7801\\u6D41\\u7A0B\\u4ECD\\u5728\\u8FDB\\u884C\\u2014\\u2014\\u8BF7\\u7B49\\u5F85\\u7ED3\\u679C";\n });\n clearCountdown();\n if (secs != null) {\n left = secs;\n countdownTimer = setInterval(tick, 1e3);\n tick();\n }\n };\n const showTimeout = () => {\n clearCountdown();\n showModal(`${chanLabel}\\u626B\\u7801\\u672A\\u5B8C\\u6210`, [\n // \u9489\u9489\uFF1A2h \u7A97\u53E3\u5185\u624D\u4F1A\u8D70\u5230\u8FD9\uFF08GUI \u5E3D\u4E4B\u4E0B\u5B9E\u9645\u6765\u6E90\u662F\u6388\u6743\u88AB\u62D2\uFF09\uFF1B\u98DE\u4E66/\u5FAE\u4FE1\uFF1A5 \u5206\u949F\u5F15\u64CE\u8D85\u65F6\u3002\n // \u4E0D\u5199\u6B7B\u5206\u949F\u6570\u2014\u2014\u5F52\u56E0\u6587\u6848\u5931\u771F\u6BD4\u4E0D\u5199\u66F4\u7CDF\uFF08review #2\uFF09\n h("p", { class: "modal-sub" }, channel === "dingtalk" ? "\\u672C\\u8F6E\\u6388\\u6743\\u672A\\u5B8C\\u6210\\uFF08\\u53EF\\u80FD\\u5DF2\\u5728\\u624B\\u673A\\u4E0A\\u62D2\\u7EDD\\uFF09\\u3002" : "\\u8D85\\u8FC7 5 \\u5206\\u949F\\u672A\\u5B8C\\u6210\\u626B\\u7801\\u3002"),\n h(\n "div",\n { class: "modal-actions" },\n h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n closeModal();\n void runOnce();\n }\n // \u540C\u4E00 session \u5185\u91CD\u8DD1\uFF08\u8BA2\u9605/\u56DE\u8C03\u90FD\u7559\u7740\uFF09\n }, "\\u91CD\\u8BD5\\uFF08\\u6362\\u65B0\\u4E8C\\u7EF4\\u7801\\uFF09"),\n h("button", { class: "btn", type: "button", onclick: () => cancelAndStop() }, "\\u53D6\\u6D88")\n )\n ]);\n };\n const showFailure = (text) => {\n showModal(`${chanLabel}\\u914D\\u7F6E\\u5931\\u8D25`, [\n h("p", { class: "modal-sub" }, text),\n h(\n "div",\n { class: "modal-actions" },\n h("button", { class: "btn", type: "button", onclick: () => cancelAndStop() }, "\\u5173\\u95ED")\n )\n ]);\n };\n async function runOnce() {\n if (stopped) return;\n showModal(`${chanLabel}\\u626B\\u7801`, [\n h("p", { class: "modal-sub" }, "\\u6B63\\u5728\\u751F\\u6210\\u4E8C\\u7EF4\\u7801\\uFF0C\\u8BF7\\u7A0D\\u5019...")\n ]);\n const r = await deps.runReconfig(channel, deps.stateDir, deps.configName);\n if (stopped) return;\n if (r.code === 2) showTimeout();\n else if (r.code !== 0 && !modal) {\n showFailure(`\\u547D\\u4EE4\\u5F02\\u5E38\\u9000\\u51FA\\uFF08\\u9000\\u51FA\\u7801 ${r.code}\\uFF09\\u3002\\u8BF7\\u67E5\\u770B\\u5F15\\u64CE\\u65E5\\u5FD7\\u3002`);\n } else if (r.code !== 0 && modal) {\n showFailure(`\\u626B\\u7801\\u6D41\\u7A0B\\u88AB\\u4E2D\\u65AD\\uFF08\\u9000\\u51FA\\u7801 ${r.code}\\uFF09\\u3002\\u8BF7\\u91CD\\u8BD5\\uFF1B\\u82E5\\u590D\\u73B0\\u8BF7\\u67E5\\u770B\\u5F15\\u64CE\\u65E5\\u5FD7\\u3002`);\n }\n }\n const unsub = deps.onEngineEvent((ev) => {\n if (stopped) return;\n if (ev.event === "qr") showQr(ev.url);\n else if (ev.event === "qr_timeout") showTimeout();\n else if (ev.event === "error") {\n showModal(`${chanLabel}\\u914D\\u7F6E\\u5931\\u8D25`, [\n h("p", { class: "modal-sub", style: "text-align:left;white-space:pre-wrap;user-select:text" }, ev.message),\n h(\n "div",\n { class: "modal-actions" },\n h("button", { class: "btn", type: "button", onclick: () => cancelAndStop() }, "\\u5173\\u95ED")\n )\n ]);\n } else if (ev.event === "done") {\n stop();\n doneCb?.(ev);\n }\n });\n void runOnce();\n return {\n stop,\n onDone(cb) {\n doneCb = cb;\n }\n };\n }\n function confirmWechatNewBot(onConfirm) {\n const box = h(\n "div",\n { class: "modal" },\n h("h3", {}, "\\u5FAE\\u4FE1\\u914D\\u7F6E\\u987B\\u77E5"),\n h(\n "div",\n { class: "note-box", style: "text-align:left" },\n h(\n "ul",\n { style: "margin:0;padding-left:20px;line-height:2" },\n h("li", {}, "\\u4E00\\u4E2A\\u5FAE\\u4FE1\\u53F7\\u53EA\\u80FD\\u7ED1\\u5B9A\\u4E00\\u4E2A bot\\u2014\\u2014\\u914D\\u7F6E\\u65B0 bot \\u4F1A\\u8986\\u76D6\\u751F\\u6210\\uFF0C\\u539F\\u7ED1\\u5B9A\\u5931\\u6548"),\n h("li", {}, "bot \\u4E0D\\u8FDB\\u7FA4\\uFF08\\u53EA\\u652F\\u6301\\u79C1\\u804A\\uFF09")\n )\n ),\n h(\n "div",\n { class: "modal-actions" },\n h("button", { class: "btn", type: "button", onclick: () => m.close() }, "\\u53D6\\u6D88"),\n h("button", { class: "btn btn-primary", type: "button", onclick: () => {\n m.close();\n onConfirm();\n } }, "\\u6211\\u5DF2\\u77E5\\u6653\\uFF0C\\u5F00\\u59CB\\u626B\\u7801")\n )\n );\n const m = openModal(box);\n }\n var WA_POLL_MS = 3e3;\n var WA_SUCCESS_AUTOCLOSE_MS = 3e3;\n function waStatusLine(status) {\n switch (status) {\n case "not-linked":\n return "\\u672A\\u914D\\u5BF9\\u2014\\u2014\\u7B49\\u5F85\\u626B\\u7801";\n case "connecting":\n return "\\u6B63\\u5728\\u8FDE\\u63A5 WhatsApp\\u2026";\n case "waiting-qr":\n return "\\u7B49\\u5F85\\u626B\\u7801\\u2026\\uFF08\\u4E8C\\u7EF4\\u7801\\u7EA6 20 \\u79D2\\u8F6E\\u6362\\u4E00\\u6B21\\uFF09";\n case "connected":\n return "\\u5DF2\\u8FDE\\u63A5";\n case "logged-out":\n return "\\u767B\\u5F55\\u5DF2\\u5931\\u6548";\n case "conflict":\n return "\\u8FDE\\u63A5\\u51B2\\u7A81";\n case "stopped":\n return "\\u901A\\u9053\\u672A\\u8FD0\\u884C\\uFF08\\u542F\\u7528\\u540E\\u9700\\u91CD\\u542F\\u5F15\\u64CE\\uFF09";\n default:\n return `\\u72B6\\u6001\\uFF1A${status}`;\n }\n }\n function startWaScan(apiPort, deps) {\n let modal = null;\n let pollTimer = null;\n let autoCloseTimer = null;\n let renderedKind = "";\n let renderedVersion = null;\n let stopped = false;\n let inFlight = false;\n const clearTimers = () => {\n if (pollTimer) {\n clearInterval(pollTimer);\n pollTimer = null;\n }\n if (autoCloseTimer) {\n clearTimeout(autoCloseTimer);\n autoCloseTimer = null;\n }\n };\n const close = () => {\n if (stopped) return;\n stopped = true;\n clearTimers();\n modal?.close();\n modal = null;\n deps.onClose?.();\n };\n const showModal = (body) => {\n const box = h(\n "div",\n { class: "modal" },\n h("button", { class: "modal-close", type: "button", title: "\\u5173\\u95ED", "aria-label": "\\u5173\\u95ED", onclick: () => close() }, "\\xD7"),\n h("h3", {}, "WhatsApp \\u626B\\u7801\\u767B\\u5F55"),\n ...body\n );\n if (modal) modal.root.replaceChildren(box);\n else modal = openModal(box);\n };\n const hints = () => [\n h("p", { class: "modal-sub" }, "\\u624B\\u673A WhatsApp \\u2192 \\u8BBE\\u7F6E \\u2192 \\u5DF2\\u5173\\u8054\\u7684\\u8BBE\\u5907 \\u2192 \\u5173\\u8054\\u8BBE\\u5907 \\u2192 \\u626B\\u4E00\\u626B"),\n h("p", { class: "countdown" }, \'\\u914D\\u5BF9\\u540E\\u7684\\u8BBE\\u5907\\u540D\\u4F1A\\u663E\\u793A\\u4E3A "Chrome"\\u2014\\u2014\\u8FD9\\u662F engine7 \\u7684\\u63A5\\u5165\\u65B9\\u5F0F\\uFF0C\\u4E0D\\u662F\\u914D\\u9519\\u4E86\')\n ];\n const renderWaiting = (line) => {\n renderedKind = "waiting";\n renderedVersion = null;\n showModal([\n ...hints(),\n h("p", { class: "countdown" }, line)\n ]);\n };\n const renderUnreachable = () => {\n renderedKind = "unreachable";\n showModal([\n h("p", { class: "modal-sub" }, "\\u6682\\u65F6\\u8FDE\\u4E0D\\u4E0A\\u5F15\\u64CE\\u7684 WhatsApp \\u63A5\\u53E3\\u2014\\u2014\\u8BF7\\u786E\\u8BA4\\u5F15\\u64CE\\u5DF2\\u542F\\u52A8\\uFF1B\\u65E7\\u7248\\u672C\\u5F15\\u64CE\\u6CA1\\u6709\\u8FD9\\u6761\\u63A5\\u53E3\\uFF0C\\u8BF7\\u5148\\u5347\\u7EA7\\u3002"),\n h("p", { class: "countdown" }, "\\u6BCF 3 \\u79D2\\u81EA\\u52A8\\u91CD\\u8BD5\\u2026")\n ]);\n };\n const renderSuccess = () => {\n renderedKind = "success";\n showModal([\n h("p", { class: "modal-sub" }, "\\u2705 \\u5DF2\\u8FDE\\u63A5\\u2014\\u2014\\u901A\\u9053\\u5DF2\\u5C31\\u7EEA\\uFF0C\\u65E0\\u9700\\u91CD\\u542F\\u5F15\\u64CE\\u3002"),\n h("p", { class: "countdown" }, "\\u7A97\\u53E3\\u5373\\u5C06\\u81EA\\u52A8\\u5173\\u95ED\\u2026")\n ]);\n autoCloseTimer = setTimeout(() => close(), WA_SUCCESS_AUTOCLOSE_MS);\n };\n const renderError = (status) => {\n renderedKind = `error:${status}`;\n const text = status === "logged-out" ? "\\u767B\\u5F55\\u5DF2\\u5931\\u6548\\uFF08\\u624B\\u673A\\u7AEF\\u89E3\\u7ED1\\u6216\\u51ED\\u8BC1\\u4F5C\\u5E9F\\uFF09\\u3002\\u70B9\\u300C\\u91CD\\u8BD5\\u300D\\u91CD\\u65B0\\u53D1\\u8D77\\u914D\\u5BF9\\u626B\\u7801\\u3002" : "\\u8FDE\\u63A5\\u51B2\\u7A81\\uFF1A\\u672C\\u673A\\u8FDE\\u63A5\\u88AB\\u5176\\u5B83\\u5DF2\\u5173\\u8054\\u8BBE\\u5907\\u53D6\\u4EE3\\u3002\\u8BF7\\u5230\\u624B\\u673A\\u300C\\u5DF2\\u5173\\u8054\\u7684\\u8BBE\\u5907\\u300D\\u68C0\\u67E5\\u6709\\u6CA1\\u6709\\u591A\\u51FA\\u6765\\u7684\\u8BBE\\u5907\\uFF0C\\u5904\\u7406\\u540E\\u91CD\\u8BD5\\u3002";\n showModal([\n h("p", { class: "modal-sub" }, text),\n h(\n "div",\n { class: "modal-actions" },\n h("button", { class: "btn btn-primary", type: "button", onclick: () => retry() }, "\\u91CD\\u8BD5"),\n h("button", { class: "btn", type: "button", onclick: () => close() }, "\\u5173\\u95ED")\n )\n ]);\n };\n const renderQr = (payload) => {\n renderedKind = "qr";\n renderedVersion = payload.version;\n const img = h("img", { class: "qr", alt: "WhatsApp \\u4E8C\\u7EF4\\u7801", width: 260, height: 260 });\n const version = payload.version;\n showModal([\n ...hints(),\n img,\n h("p", { class: "countdown" }, waStatusLine(payload.status))\n ]);\n void qrDataUrl(payload.qr ?? "").then((data) => {\n if (!stopped && renderedKind === "qr" && renderedVersion === version) img.src = data;\n }).catch(() => {\n if (!stopped && renderedKind === "qr" && renderedVersion === version) {\n img.replaceWith(h("p", { class: "modal-sub" }, "\\u4E8C\\u7EF4\\u7801\\u6E32\\u67D3\\u5931\\u8D25\\u2014\\u2014\\u70B9 \\xD7 \\u5173\\u95ED\\u540E\\u91CD\\u8BD5\\uFF0C\\u6216\\u7528\\u6D4F\\u89C8\\u5668\\u76F4\\u63A5\\u6253\\u5F00\\u5F15\\u64CE\\u7684 /api/whatsapp/qr \\u9875"));\n }\n });\n };\n const tick = async () => {\n if (stopped || inFlight) return;\n inFlight = true;\n const payload = await deps.fetchWaQr(apiPort).catch(() => null);\n inFlight = false;\n if (stopped) return;\n if (!payload) {\n if (renderedKind !== "unreachable") renderUnreachable();\n return;\n }\n if (payload.status === "connected") {\n if (renderedKind !== "success") {\n clearTimers();\n renderSuccess();\n }\n return;\n }\n if (payload.status === "logged-out" || payload.status === "conflict") {\n if (renderedKind !== `error:${payload.status}`) {\n clearTimers();\n renderError(payload.status);\n }\n return;\n }\n if (!payload.qr) {\n if (renderedKind !== "waiting") renderWaiting(waStatusLine(payload.status));\n return;\n }\n if (renderedKind !== "qr" || renderedVersion !== payload.version) renderQr(payload);\n };\n const retry = () => {\n if (stopped) return;\n renderedKind = "";\n renderedVersion = null;\n clearTimers();\n pollTimer = setInterval(() => {\n void tick();\n }, WA_POLL_MS);\n void tick();\n };\n renderWaiting("\\u6B63\\u5728\\u8FDE\\u63A5\\u5F15\\u64CE\\u2026");\n retry();\n return { stop: close };\n }\n\n // web-console/desktop/src/renderer/console/pages/channels.ts\n var splitList = (v) => v.split(",").map((s) => s.trim()).filter((s) => s.length > 0);\n var advanced = (label, ...children) => h("details", { class: "chan-advanced" }, h("summary", {}, label), ...children);\n function mountChannels(body, marker, deps, actions) {\n const banner = h("div", { class: "inline-warn", hidden: true });\n const showRestartBanner = () => {\n banner.hidden = false;\n banner.replaceChildren(\n "\\u914D\\u7F6E\\u5DF2\\u5199\\u5165\\uFF0C\\u91CD\\u542F\\u5F15\\u64CE\\u540E\\u751F\\u6548\\u3002",\n h("button", { class: "btn btn-primary", type: "button", style: "margin-left:12px", onclick: () => actions.restart() }, "\\u91CD\\u542F\\u5F15\\u64CE")\n );\n };\n const wrap = h(\n "div",\n { class: "page" },\n h("h2", {}, "\\u804A\\u5929\\u901A\\u9053"),\n h("p", { class: "page-sub" }, "\\u5404\\u901A\\u9053\\u7684\\u542F\\u7528\\u72B6\\u6001\\u4E0E\\u7BA1\\u7406\\u3002\\u626B\\u7801\\u7C7B\\u901A\\u9053\\uFF08\\u98DE\\u4E66/\\u5FAE\\u4FE1\\uFF09\\u91CD\\u914D\\u540E\\u9700\\u8981\\u91CD\\u542F\\u5F15\\u64CE\\u751F\\u6548\\u3002"),\n banner\n );\n let session = null;\n let stopped = false;\n const configFileName = () => marker.configPath.split(/[\\\\/]/).pop() || void 0;\n const startScan = (channel) => {\n if (session) {\n session.stop();\n void deps.cancelReconfig().catch(() => {\n });\n }\n session = startReconfigScan(channel, {\n runReconfig: deps.runReconfig,\n cancelReconfig: deps.cancelReconfig,\n onEngineEvent: (cb) => deps.onEngineEvent(cb),\n stateDir: marker.stateDir,\n configName: configFileName()\n });\n session.onDone((ev) => {\n showRestartBanner();\n void load();\n setTimeout(() => {\n void load(true);\n }, 2500);\n if (ev.channel === "dingtalk") {\n void deps.readDingtalkConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n dtEnabledCb.checked = cfg.enabled;\n dtClientIdInput.value = cfg.clientId;\n dtSecretInput.value = cfg.clientSecret;\n dtAllowInput.value = cfg.allowedUsers.join(", ");\n dtExtChatsInput.value = cfg.externalChannels.join(", ");\n dtPolicySel.value = cfg.groupPolicy;\n });\n }\n if (ev.channel === "wecom") {\n void deps.readWecomConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n fillWecom(cfg);\n });\n }\n });\n };\n const fsPolicySel = h(\n "select",\n {},\n h("option", { value: "mention-only" }, "mention-only \\u2014\\u2014 \\u7FA4\\u91CC\\u8981 @ \\u52A9\\u7406\\u624D\\u56DE\\u5E94\\uFF08\\u9ED8\\u8BA4\\uFF09"),\n h("option", { value: "open" }, "open \\u2014\\u2014 \\u6240\\u6709\\u7FA4\\u4E0D\\u7528 @ \\u4E5F\\u56DE\\u5E94")\n );\n const fsOpenInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684\\u7FA4 chat_id\\uFF1B\\u7B56\\u7565\\u4E3A mention-only \\u65F6\\u8FD9\\u4E9B\\u7FA4\\u514D @ \\u76F4\\u63A5\\u770B\\u5230"\n });\n const fsExtInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684\\u7FA4 chat_id\\uFF1B\\u5217\\u5165\\u7684\\u7FA4\\u6309\\u5BF9\\u5916\\u573A\\u5408\\u5BF9\\u5F85"\n });\n const fsSaveErr = h("div", { class: "qr-error", hidden: true });\n const fsSaveBtn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void onFsSave();\n }\n }, "\\u4FDD\\u5B58\\u7FA4\\u8BBE\\u7F6E");\n async function onFsSave() {\n fsSaveBtn.disabled = true;\n fsSaveErr.hidden = true;\n const r = await deps.updateFeishuConfig(marker.configPath, marker.stateDir, {\n policy: fsPolicySel.value,\n openGroups: splitList(fsOpenInput.value),\n externalChannels: splitList(fsExtInput.value)\n });\n fsSaveBtn.disabled = false;\n if (!r.ok) {\n fsSaveErr.hidden = false;\n fsSaveErr.textContent = r.error ?? "\\u4FDD\\u5B58\\u5931\\u8D25";\n return;\n }\n showRestartBanner();\n }\n void deps.readFeishuConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n fsPolicySel.value = cfg.policy;\n fsOpenInput.value = cfg.openGroups.join(", ");\n fsExtInput.value = cfg.externalChannels.join(", ");\n });\n const feishuCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("feishu"),\n h("span", { class: "chan-name" }, "\\u98DE\\u4E66"),\n h("span", { class: "chan-light", "data-chan": "feishu" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u4F01\\u4E1A\\u81EA\\u5EFA\\u5E94\\u7528\\u63A5\\u5165\\u3002\\u91CD\\u65B0\\u626B\\u7801\\u4F1A\\u8D70\\u5FEB\\u901F\\u6CE8\\u518C\\u6D41\\u7A0B\\uFF0C\\u751F\\u6210\\u65B0\\u7684\\u5E94\\u7528\\u51ED\\u8BC1\\u3002"),\n h("button", { class: "btn", type: "button", onclick: () => startScan("feishu") }, "\\u91CD\\u65B0\\u626B\\u7801"),\n h(\n "form",\n {\n onsubmit: (e) => {\n e.preventDefault();\n void onFsSave();\n }\n },\n advanced(\n "\\u7FA4\\u8BBE\\u7F6E\\uFF08\\u9AD8\\u7EA7\\uFF09",\n h("div", { class: "field" }, h("label", {}, "\\u7FA4\\u7B56\\u7565"), fsPolicySel),\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u514D @ \\u7684\\u7FA4"),\n fsOpenInput,\n h("p", { class: "cf-hint" }, "\\u7B56\\u7565\\u4E3A mention-only \\u65F6\\uFF0C\\u8FD9\\u4E9B\\u7FA4\\u91CC\\u7684\\u6D88\\u606F\\u4E0D\\u7528 @ \\u52A9\\u7406\\u5979\\u4E5F\\u80FD\\u770B\\u5230")\n ),\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u5BF9\\u5916\\u7FA4"),\n fsExtInput,\n h("p", { class: "cf-hint" }, "\\u6709\\u5916\\u4EBA\\u5728\\u7684\\u7FA4\\uFF1A\\u52A9\\u7406\\u5728\\u8FD9\\u4E9B\\u7FA4\\u91CC\\u4E0D\\u663E\\u793A\\u601D\\u8003/\\u5DE5\\u5177\\u8FC7\\u7A0B\\u3001\\u8BF4\\u8BDD\\u66F4\\u8C28\\u614E")\n ),\n fsSaveErr,\n fsSaveBtn\n )\n )\n );\n const wechatCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("wechat"),\n h("span", { class: "chan-name" }, "\\u5FAE\\u4FE1"),\n h("span", { class: "chan-light", "data-chan": "wechat" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u626B\\u7801\\u767B\\u5F55\\u751F\\u6210 bot \\u51ED\\u8BC1\\u3002"),\n // spec \u786C\u8981\u6C42\uFF1A\u4E00\u4E2A\u5FAE\u4FE1\u53F7\u53EA\u80FD\u7ED1\u4E00\u4E2A bot\uFF1Bbot \u4E0D\u8FDB\u7FA4\u2014\u2014\u8B66\u544A\u5148\u884C\uFF0C\u786E\u8BA4\u540E\u624D\u626B\u7801\n h("button", {\n class: "btn",\n type: "button",\n onclick: () => confirmWechatNewBot(() => startScan("wechat"))\n }, "\\u914D\\u7F6E\\u65B0 bot")\n );\n const enabledCb = h("input", { type: "checkbox", id: "dc-enabled" });\n const tokenInput = h("input", { type: "password", placeholder: "Bot Token" });\n const userIdInput = h("input", { type: "text", placeholder: "\\u4F60\\u7684 Discord User ID" });\n const saveErr = h("div", { class: "qr-error", hidden: true });\n const saveBtn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void onSave();\n }\n }, "\\u4FDD\\u5B58 Discord \\u914D\\u7F6E");\n const discordCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("discord"),\n h("span", { class: "chan-name" }, "Discord"),\n h("span", { class: "chan-light", "data-chan": "discord" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u76F4\\u5199\\u914D\\u7F6E\\u6587\\u4EF6\\uFF08token/userId\\uFF09\\uFF0C\\u4FDD\\u5B58\\u540E\\u91CD\\u542F\\u5F15\\u64CE\\u751F\\u6548\\u3002"),\n h(\n "form",\n {\n onsubmit: (e) => {\n e.preventDefault();\n void onSave();\n }\n },\n h("div", { class: "check-row" }, enabledCb, h("label", { for: "dc-enabled" }, "\\u542F\\u7528 Discord")),\n h("div", { class: "field" }, h("label", {}, "Bot Token"), tokenInput),\n h("div", { class: "field" }, h("label", {}, "User ID"), userIdInput),\n saveErr,\n saveBtn\n )\n );\n async function onSave() {\n saveBtn.disabled = true;\n saveErr.hidden = true;\n const r = await deps.updateChannelConfig(marker.configPath, marker.stateDir, {\n enabled: enabledCb.checked,\n token: tokenInput.value.trim(),\n userId: userIdInput.value.trim()\n });\n saveBtn.disabled = false;\n if (!r.ok) {\n saveErr.hidden = false;\n saveErr.textContent = r.error ?? "\\u4FDD\\u5B58\\u5931\\u8D25";\n return;\n }\n showRestartBanner();\n }\n const tgEnabledCb = h("input", { type: "checkbox", id: "tg-enabled" });\n const tgTokenInput = h("input", { type: "password", placeholder: "Bot Token" });\n const tgPolicySel = h(\n "select",\n {},\n h("option", { value: "open" }, "open \\u2014\\u2014 \\u6240\\u6709\\u4EBA\\u53EF\\u79C1\\u804A"),\n h("option", { value: "allowlist" }, "allowlist \\u2014\\u2014 \\u4EC5\\u767D\\u540D\\u5355\\u53EF\\u79C1\\u804A"),\n h("option", { value: "disabled" }, "disabled \\u2014\\u2014 \\u62D2\\u6536\\u79C1\\u804A")\n );\n const tgAllowInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684 Telegram \\u6570\\u5B57 ID\\uFF0C\\u7559\\u7A7A=dmPolicy open \\u65F6\\u65E0\\u9650\\u5236"\n });\n const tgSaveErr = h("div", { class: "qr-error", hidden: true });\n const tgSaveBtn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void onTgSave();\n }\n }, "\\u4FDD\\u5B58 Telegram \\u914D\\u7F6E");\n const telegramCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("telegram"),\n h("span", { class: "chan-name" }, "Telegram"),\n h("span", { class: "chan-light", "data-chan": "telegram" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u627E @BotFather \\u2192 /newbot \\u2192 \\u7C98\\u8D34 token\\u3002\\u76F4\\u5199\\u914D\\u7F6E\\u6587\\u4EF6\\uFF0C\\u4FDD\\u5B58\\u540E\\u91CD\\u542F\\u5F15\\u64CE\\u751F\\u6548\\u3002"),\n h(\n "form",\n {\n onsubmit: (e) => {\n e.preventDefault();\n void onTgSave();\n }\n },\n h("div", { class: "check-row" }, tgEnabledCb, h("label", { for: "tg-enabled" }, "\\u542F\\u7528 Telegram")),\n h("div", { class: "field" }, h("label", {}, "Bot Token"), tgTokenInput),\n advanced(\n "\\u8C01\\u80FD\\u79C1\\u804A\\u5B83\\uFF08\\u9AD8\\u7EA7\\uFF09",\n h("div", { class: "field" }, h("label", {}, "\\u79C1\\u804A\\u7B56\\u7565"), tgPolicySel),\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u5141\\u8BB8\\u79C1\\u804A\\u7684\\u4EBA"),\n tgAllowInput,\n h("p", { class: "cf-hint" }, "Telegram \\u6570\\u5B57 ID\\uFF0C\\u9017\\u53F7\\u5206\\u9694\\uFF1B\\u7B56\\u7565\\u9009\\u300C\\u4EC5\\u767D\\u540D\\u5355\\u300D\\u65F6\\u751F\\u6548")\n )\n ),\n tgSaveErr,\n tgSaveBtn\n )\n );\n async function onTgSave() {\n tgSaveBtn.disabled = true;\n tgSaveErr.hidden = true;\n const r = await deps.updateTelegramConfig(marker.configPath, marker.stateDir, {\n enabled: tgEnabledCb.checked,\n token: tgTokenInput.value.trim(),\n dmPolicy: tgPolicySel.value,\n // \u4E00\u683C\u9017\u53F7\u5206\u9694 \u2192 \u6570\u7EC4\uFF1A\u7559\u7A7A = []\uFF08\u5F15\u64CE\u8BED\u4E49\uFF1Aallowlist \u4E0B\u5168\u62D2\uFF0Copen \u4E0B\u4E0D\u53C2\u4E0E\u5224\u5B9A\u2014\u2014\u4E0E\u5360\u4F4D\u7B26\u6587\u6848\u4E00\u81F4\uFF09\n allowFrom: splitList(tgAllowInput.value)\n });\n tgSaveBtn.disabled = false;\n if (!r.ok) {\n tgSaveErr.hidden = false;\n tgSaveErr.textContent = r.error ?? "\\u4FDD\\u5B58\\u5931\\u8D25";\n return;\n }\n showRestartBanner();\n }\n const dtEnabledCb = h("input", { type: "checkbox", id: "dt-enabled" });\n const dtClientIdInput = h("input", { type: "text", placeholder: "Client ID\\uFF08AppKey\\uFF09" });\n const dtSecretInput = h("input", { type: "password", placeholder: "Client Secret\\uFF08AppSecret\\uFF09" });\n const dtAllowInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684 staffId/senderId\\uFF0C\\u7559\\u7A7A=\\u6240\\u6709\\u4EBA\\u53EF\\u79C1\\u804A"\n });\n const dtExtChatsInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684\\u7FA4 cid\\uFF0C\\u7559\\u7A7A = \\u4E0D\\u5F00\\u542F"\n });\n const dtPolicySel = h(\n "select",\n {},\n h("option", { value: "mention-only" }, "mention-only \\u2014\\u2014 \\u7FA4\\u91CC\\u8981 @ \\u52A9\\u7406\\u624D\\u56DE\\u5E94\\uFF08\\u9ED8\\u8BA4\\uFF09"),\n h("option", { value: "open" }, "open \\u2014\\u2014 \\u6240\\u6709\\u7FA4\\u4E0D\\u7528 @ \\u4E5F\\u56DE\\u5E94")\n );\n const dtSaveErr = h("div", { class: "qr-error", hidden: true });\n const dtSaveBtn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void onDtSave();\n }\n }, "\\u4FDD\\u5B58\\u9489\\u9489\\u914D\\u7F6E");\n const dtForm = h(\n "form",\n {\n onsubmit: (e) => {\n e.preventDefault();\n void onDtSave();\n }\n },\n advanced(\n "\\u5DF2\\u6709\\u5E94\\u7528\\uFF1F\\u624B\\u52A8\\u586B\\u51ED\\u8BC1\\uFF08\\u9AD8\\u7EA7\\uFF09",\n h("div", { class: "check-row" }, dtEnabledCb, h("label", { for: "dt-enabled" }, "\\u542F\\u7528\\u9489\\u9489")),\n h("div", { class: "field" }, h("label", {}, "Client ID\\uFF08AppKey\\uFF09"), dtClientIdInput),\n h("div", { class: "field" }, h("label", {}, "Client Secret"), dtSecretInput),\n h("div", { class: "field" }, h("label", {}, "\\u7FA4\\u7B56\\u7565"), dtPolicySel),\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u5BF9\\u5916\\u7FA4"),\n dtExtChatsInput,\n h("p", { class: "cf-hint" }, "\\u6709\\u5916\\u4EBA\\u5728\\u7684\\u7FA4\\u6807\\u8BB0\\u51FA\\u6765\\uFF1A\\u52A9\\u7406\\u5728\\u8FD9\\u4E9B\\u7FA4\\u91CC\\u4E0D\\u663E\\u793A\\u601D\\u8003/\\u5DE5\\u5177\\u8FC7\\u7A0B\\u3001\\u8BF4\\u8BDD\\u66F4\\u8C28\\u614E\\u3002\\u7FA4 cid \\u9017\\u53F7\\u5206\\u9694\\uFF0C\\u7559\\u7A7A = \\u6CA1\\u6709")\n ),\n dtSaveErr,\n dtSaveBtn\n )\n );\n const dtTuning = advanced(\n "\\u8C03\\u8BD5\\u53C2\\u6570\\uFF08\\u5185\\u90E8\\uFF09",\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u79C1\\u804A\\u767D\\u540D\\u5355\\uFF08staffId\\uFF09"),\n dtAllowInput,\n h("p", { class: "cf-hint" }, "staffId/senderId \\u9017\\u53F7\\u5206\\u9694\\uFF1B\\u7559\\u7A7A = \\u6240\\u6709\\u4EBA\\u53EF\\u79C1\\u804A")\n )\n );\n const dingtalkCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("dingtalk"),\n h("span", { class: "chan-name" }, "\\u9489\\u9489"),\n h("span", { class: "chan-light", "data-chan": "dingtalk" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u626B\\u7801\\u6388\\u6743\\u81EA\\u52A8\\u521B\\u5EFA\\u5E94\\u7528\\u5E76\\u63A5\\u5165\\uFF1B\\u7FA4\\u804A @\\u673A\\u5668\\u4EBA \\u89E6\\u53D1\\u3002"),\n h("button", { class: "btn", type: "button", onclick: () => startScan("dingtalk") }, "\\u626B\\u7801\\u63A5\\u5165"),\n dtForm\n );\n async function onDtSave() {\n dtSaveBtn.disabled = true;\n dtSaveErr.hidden = true;\n const r = await deps.updateDingtalkConfig(marker.configPath, marker.stateDir, {\n enabled: dtEnabledCb.checked,\n clientId: dtClientIdInput.value.trim(),\n clientSecret: dtSecretInput.value.trim(),\n // \u4E00\u683C\u9017\u53F7\u5206\u9694 \u2192 \u6570\u7EC4\uFF08telegram \u5361\u540C\u6B3E\u53E3\u5F84\uFF1A\u7559\u7A7A = [] = \u4E0D\u9650\uFF09\n allowedUsers: splitList(dtAllowInput.value),\n externalChannels: splitList(dtExtChatsInput.value),\n groupPolicy: dtPolicySel.value\n });\n dtSaveBtn.disabled = false;\n if (!r.ok) {\n dtSaveErr.hidden = false;\n dtSaveErr.textContent = r.error ?? "\\u4FDD\\u5B58\\u5931\\u8D25";\n return;\n }\n showRestartBanner();\n }\n const wcEnabledCb = h("input", { type: "checkbox", id: "wc-enabled" });\n const wcBotIdInput = h("input", { type: "text", placeholder: "BotID\\uFF08\\u626B\\u7801\\u63A5\\u5165\\u81EA\\u52A8\\u586B\\u5199\\uFF09" });\n const wcSecretInput = h("input", { type: "password", placeholder: "Secret\\uFF08\\u957F\\u8FDE\\u63A5\\u4E13\\u7528\\uFF09" });\n const wcDisplayNameInput = h("input", {\n type: "text",\n placeholder: "\\u4F01\\u5FAE\\u540E\\u53F0\\u91CC\\u7684\\u673A\\u5668\\u4EBA\\u540D\\u5B57\\uFF08\\u7FA4 @ \\u5265\\u79BB\\u7684\\u6BD4\\u5BF9\\u57FA\\u51C6\\uFF0C\\u7559\\u7A7A = \\u4E0D\\u5265\\uFF09"\n });\n const wcAllowUsersInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684\\u4F01\\u5FAE userid\\uFF0C\\u7559\\u7A7A = \\u6240\\u6709\\u4EBA\\u53EF\\u79C1\\u804A"\n });\n const wcAllowChatsInput = h("input", {\n type: "text",\n placeholder: "\\u9017\\u53F7\\u5206\\u9694\\u7684\\u7FA4 chatid\\uFF0C\\u7559\\u7A7A = \\u6240\\u6709\\u7FA4"\n });\n const wcFormatSel = h(\n "select",\n {},\n h("option", { value: "markdown" }, "markdown \\u2014\\u2014 \\u9ED8\\u8BA4"),\n h("option", { value: "text" }, "text \\u2014\\u2014 \\u8DDF\\u4E2A\\u4EBA\\u5FAE\\u4FE1\\u4E92\\u901A\\u3001\\u4E0D\\u6E32\\u67D3 markdown \\u65F6\\u9009")\n );\n const wcMergeInput = h("input", {\n type: "number",\n min: "0",\n placeholder: "600\\uFF08\\u9ED8\\u8BA4\\uFF09"\n });\n const wcSaveErr = h("div", { class: "qr-error", hidden: true });\n const wcSaveBtn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void onWcSave();\n }\n }, "\\u4FDD\\u5B58\\u4F01\\u4E1A\\u5FAE\\u4FE1\\u914D\\u7F6E");\n const wcForm = h(\n "form",\n {\n onsubmit: (e) => {\n e.preventDefault();\n void onWcSave();\n }\n },\n advanced(\n "\\u5DF2\\u6709\\u673A\\u5668\\u4EBA\\uFF1F\\u624B\\u52A8\\u586B\\u51ED\\u8BC1\\uFF08\\u9AD8\\u7EA7\\uFF09",\n h("div", { class: "check-row" }, wcEnabledCb, h("label", { for: "wc-enabled" }, "\\u542F\\u7528\\u4F01\\u4E1A\\u5FAE\\u4FE1")),\n h("div", { class: "field" }, h("label", {}, "BotID"), wcBotIdInput),\n h("div", { class: "field" }, h("label", {}, "Secret"), wcSecretInput),\n wcSaveErr,\n wcSaveBtn\n )\n );\n const wcTuning = advanced(\n "\\u8C03\\u8BD5\\u53C2\\u6570\\uFF08\\u5185\\u90E8\\uFF09",\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u673A\\u5668\\u4EBA\\u663E\\u793A\\u540D\\uFF08@ \\u5265\\u79BB\\u6BD4\\u5BF9\\u57FA\\u51C6\\uFF09"),\n wcDisplayNameInput,\n h("p", { class: "cf-hint" }, "\\u7FA4\\u6D88\\u606F\\u91CC @\\u673A\\u5668\\u4EBA \\u90A3\\u51E0\\u4E2A\\u5B57\\u8981\\u5265\\u6389\\u518D\\u7ED9\\u6A21\\u578B\\uFF0C\\u8FD9\\u91CC\\u586B\\u673A\\u5668\\u4EBA\\u540D\\u5B57\\u7528\\u4E8E\\u5339\\u914D\\uFF1B\\u7559\\u7A7A = \\u4E0D\\u5265")\n ),\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u5141\\u8BB8\\u79C1\\u804A\\u7684\\u4EBA"),\n wcAllowUsersInput,\n h("p", { class: "cf-hint" }, "\\u4F01\\u5FAE\\u6210\\u5458 ID\\uFF0C\\u9017\\u53F7\\u5206\\u9694\\uFF1B\\u7559\\u7A7A = \\u6240\\u6709\\u4EBA\\u90FD\\u53EF\\u79C1\\u804A")\n ),\n h(\n "div",\n { class: "field" },\n h("label", {}, "\\u54CD\\u5E94 @ \\u7684\\u7FA4"),\n wcAllowChatsInput,\n h("p", { class: "cf-hint" }, "\\u7FA4 ID\\uFF0C\\u9017\\u53F7\\u5206\\u9694\\uFF1B\\u7559\\u7A7A = \\u6240\\u6709\\u7FA4\\uFF08\\u4F01\\u5FAE\\u5E73\\u53F0\\u53EA\\u6295\\u9012 @\\u673A\\u5668\\u4EBA \\u7684\\u6D88\\u606F\\uFF09")\n ),\n h("div", { class: "field" }, h("label", {}, "\\u6D88\\u606F\\u683C\\u5F0F"), wcFormatSel),\n h("div", { class: "field" }, h("label", {}, "\\u957F\\u6D88\\u606F\\u5408\\u5E76\\u7A97\\u53E3 ms"), wcMergeInput)\n );\n const wecomCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("wecom"),\n h("span", { class: "chan-name" }, "\\u4F01\\u4E1A\\u5FAE\\u4FE1"),\n h("span", { class: "chan-light", "data-chan": "wecom" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u626B\\u7801\\u6388\\u6743\\u81EA\\u52A8\\u521B\\u5EFA\\u673A\\u5668\\u4EBA\\u5E76\\u63A5\\u5165\\uFF1B\\u7FA4\\u804A @\\u673A\\u5668\\u4EBA \\u89E6\\u53D1\\uFF0C\\u514D\\u914D\\u7F6E\\u3002"),\n h("button", { class: "btn", type: "button", onclick: () => startScan("wecom") }, "\\u626B\\u7801\\u63A5\\u5165"),\n wcForm\n );\n function fillWecom(cfg) {\n wcEnabledCb.checked = cfg.enabled;\n wcBotIdInput.value = cfg.botId;\n wcSecretInput.value = cfg.secret;\n wcDisplayNameInput.value = cfg.displayName;\n wcAllowUsersInput.value = cfg.allowedUsers.join(", ");\n wcAllowChatsInput.value = cfg.allowedChats.join(", ");\n wcFormatSel.value = cfg.textFormat;\n wcMergeInput.value = cfg.mergeWindowMs == null ? "" : String(cfg.mergeWindowMs);\n }\n async function onWcSave() {\n wcSaveBtn.disabled = true;\n wcSaveErr.hidden = true;\n const mergeRaw = wcMergeInput.value.trim();\n const r = await deps.updateWecomConfig(marker.configPath, marker.stateDir, {\n enabled: wcEnabledCb.checked,\n botId: wcBotIdInput.value.trim(),\n secret: wcSecretInput.value.trim(),\n displayName: wcDisplayNameInput.value.trim(),\n allowedUsers: splitList(wcAllowUsersInput.value),\n allowedChats: splitList(wcAllowChatsInput.value),\n textFormat: wcFormatSel.value,\n mergeWindowMs: mergeRaw === "" ? null : Number(mergeRaw)\n });\n wcSaveBtn.disabled = false;\n if (!r.ok) {\n wcSaveErr.hidden = false;\n wcSaveErr.textContent = r.error ?? "\\u4FDD\\u5B58\\u5931\\u8D25";\n return;\n }\n showRestartBanner();\n }\n const waEnabledCb = h("input", { type: "checkbox", id: "wa-enabled" });\n const waSaveErr = h("div", { class: "qr-error", hidden: true });\n const waSaveBtn = h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n void onWaSave();\n }\n }, "\\u4FDD\\u5B58");\n const whatsappCard = h(\n "div",\n { class: "chan-card" },\n h(\n "div",\n { class: "chan-head" },\n brandBadge("whatsapp"),\n h("span", { class: "chan-name" }, "WhatsApp"),\n h("span", { class: "chan-light", "data-chan": "whatsapp" }, "\\u2026")\n ),\n h("div", { class: "chan-desc" }, "\\u7528\\u4F60\\u672C\\u4EBA\\u7684\\u8D26\\u53F7\\u63A5\\u5165\\uFF08\\u7ED9\\u81EA\\u5DF1\\u53D1\\u6D88\\u606F\\u5373\\u547D\\u4EE4\\u53E3\\uFF09\\uFF0C\\u626B\\u7801\\u914D\\u5BF9\\u3002"),\n h("button", { class: "btn", type: "button", onclick: () => startWaModal() }, "\\u626B\\u7801\\u767B\\u5F55"),\n h(\n "form",\n {\n onsubmit: (e) => {\n e.preventDefault();\n void onWaSave();\n }\n },\n h("div", { class: "check-row" }, waEnabledCb, h("label", { for: "wa-enabled" }, "\\u542F\\u7528 WhatsApp")),\n advanced(\n "\\u4F7F\\u7528\\u8BF4\\u660E\\uFF08\\u9AD8\\u7EA7\\uFF09",\n h("div", {}, "\\u9996\\u6B21\\u4F7F\\u7528\\uFF1A\\u52FE\\u9009\\u542F\\u7528\\u5E76\\u4FDD\\u5B58\\uFF08\\u91CD\\u542F\\u5F15\\u64CE\\u751F\\u6548\\uFF09\\u2192 \\u70B9\\u300C\\u626B\\u7801\\u767B\\u5F55\\u300D\\u914D\\u5BF9\\u3002"),\n h("div", {}, \'\\u914D\\u5BF9\\u540E\\u7684\\u8BBE\\u5907\\u540D\\u663E\\u793A\\u4E3A "Chrome"\\uFF0C\\u5C5E\\u6B63\\u5E38\\u73B0\\u8C61\\uFF1B\\u4E00\\u53F0\\u624B\\u673A\\u6700\\u591A 4 \\u4E2A\\u4F34\\u4FA3\\u8BBE\\u5907\\u4F4D\\uFF0C\\u5360\\u6EE1\\u5148\\u9000\\u4E00\\u4E2A\\u3002\'),\n h("div", {}, "\\u56FD\\u5185\\u7F51\\u7EDC\\u9700\\u4EE3\\u7406\\uFF08\\u5EFA\\u8BAE\\u5168\\u5C40\\u6A21\\u5F0F\\uFF1B\\u5A92\\u4F53\\u6536\\u53D1\\u4E0D\\u8D70 config \\u91CC\\u7684 proxy \\u5355\\u72EC\\u901A\\u9053\\uFF09\\u3002"),\n h("div", {}, "\\u7FA4\\u6D88\\u606F\\u53EA\\u8BFB\\uFF1Aagent \\u6C38\\u4E0D\\u5728\\u7FA4\\u91CC\\u53D1\\u8A00\\uFF0C\\u7FA4\\u804A\\u53EA\\u4F5C\\u7D20\\u6750\\u6458\\u8981\\u3002"),\n h("div", {}, "\\u767D\\u540D\\u5355 / \\u7FA4\\u6458\\u8981\\u5DE1\\u68C0\\u7B49\\u9AD8\\u7EA7\\u9879\\u89C1 docs/whatsapp-telegram-setup.md\\u3002")\n ),\n waSaveErr,\n waSaveBtn\n )\n );\n async function onWaSave() {\n waSaveBtn.disabled = true;\n waSaveErr.hidden = true;\n const r = await deps.updateWhatsappConfig(marker.configPath, marker.stateDir, { enabled: waEnabledCb.checked });\n waSaveBtn.disabled = false;\n if (!r.ok) {\n waSaveErr.hidden = false;\n waSaveErr.textContent = r.error ?? "\\u4FDD\\u5B58\\u5931\\u8D25";\n return;\n }\n showRestartBanner();\n }\n let waScan = null;\n const startWaModal = () => {\n waScan?.stop();\n waScan = startWaScan(marker.apiPort, {\n fetchWaQr: deps.fetchWaQr,\n onClose: () => {\n void refreshWaLight();\n }\n });\n };\n async function refreshWaLight() {\n if (stopped) return;\n const el = body.querySelector(\'.chan-light[data-chan="whatsapp"]\');\n if (!el) return;\n const status = await deps.apiStatus(marker.apiPort);\n if (stopped) return;\n const ch = status?.channels.find((c) => c.name === "whatsapp");\n if (!status) {\n el.textContent = "\\u2014\\u2014 \\u5F15\\u64CE\\u672A\\u8FD0\\u884C";\n return;\n }\n if (!ch?.enabled) {\n el.textContent = "\\u26D4 \\u672A\\u542F\\u7528";\n return;\n }\n const conn = await deps.fetchWaStatus(marker.apiPort);\n if (stopped) return;\n if (!conn) {\n el.textContent = "\\u26A0\\uFE0F \\u5F15\\u64CE\\u7248\\u672C\\u8FC7\\u4F4E";\n return;\n }\n switch (conn.status) {\n case "connected":\n el.textContent = "\\u2705 \\u5DF2\\u8FDE\\u63A5";\n break;\n case "connecting":\n case "waiting-qr":\n el.textContent = "\\u{1F504} \\u8FDE\\u63A5\\u4E2D";\n break;\n case "not-linked":\n el.textContent = "\\u23F3 \\u5F85\\u626B\\u7801";\n break;\n case "logged-out":\n el.textContent = "\\u{1F6AA} \\u5DF2\\u767B\\u51FA";\n break;\n case "conflict":\n el.textContent = "\\u2694\\uFE0F \\u4F1A\\u8BDD\\u51B2\\u7A81";\n break;\n case "stopped":\n el.textContent = "\\u26AA \\u672A\\u8FD0\\u884C\\uFF08\\u91CD\\u542F\\u5F15\\u64CE\\u540E\\u751F\\u6548\\uFF09";\n break;\n default:\n el.textContent = `\\u2753 ${conn.status}`;\n break;\n }\n }\n const waLightTimer = setInterval(() => {\n void refreshWaLight();\n }, 5e3);\n const lightsTimer = setInterval(() => {\n void load(true);\n }, 5e3);\n async function load(fromPoll = false) {\n if (stopped) return;\n const status = await deps.apiStatus(marker.apiPort);\n if (stopped) return;\n if (fromPoll && !status) return;\n const chans = status?.channels ?? (await deps.doctor(marker.stateDir))?.channels ?? [];\n if (stopped) return;\n for (const c of chans) {\n if (c.name === "whatsapp") continue;\n const el = body.querySelector(`.chan-light[data-chan="${c.name}"]`);\n if (!el) continue;\n if (!c.enabled) el.textContent = "\\u26D4 \\u672A\\u542F\\u7528";\n else if (c.hasCredentials) el.textContent = "\\u2705 \\u5DF2\\u914D\\u7F6E";\n else el.textContent = "\\u26A0\\uFE0F \\u7F3A\\u51ED\\u8BC1";\n }\n for (const el of Array.from(body.querySelectorAll(".chan-light"))) {\n if (el.textContent === "\\u2026" && el.getAttribute("data-chan") !== "whatsapp") el.textContent = "\\u26D4 \\u672A\\u542F\\u7528";\n }\n }\n void deps.readChannelConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n enabledCb.checked = cfg.enabled;\n tokenInput.value = cfg.token;\n userIdInput.value = cfg.userId;\n });\n void deps.readTelegramConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n tgEnabledCb.checked = cfg.enabled;\n tgTokenInput.value = cfg.token;\n tgPolicySel.value = cfg.dmPolicy;\n tgAllowInput.value = cfg.allowFrom.join(", ");\n });\n void deps.readDingtalkConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n dtEnabledCb.checked = cfg.enabled;\n dtClientIdInput.value = cfg.clientId;\n dtSecretInput.value = cfg.clientSecret;\n dtAllowInput.value = cfg.allowedUsers.join(", ");\n dtExtChatsInput.value = cfg.externalChannels.join(", ");\n dtPolicySel.value = cfg.groupPolicy;\n });\n void deps.readWecomConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n fillWecom(cfg);\n });\n void deps.readWhatsappConfig(marker.configPath, marker.stateDir).then((cfg) => {\n if (stopped) return;\n waEnabledCb.checked = cfg.enabled;\n });\n body.replaceChildren(wrap, feishuCard, wechatCard, dingtalkCard, wecomCard, whatsappCard, telegramCard, discordCard);\n void deps.configSchema(marker.stateDir).then((schema) => {\n if (stopped || !schema?.internalMode) return;\n dingtalkCard.appendChild(dtTuning);\n wecomCard.appendChild(wcTuning);\n });\n void load();\n void refreshWaLight();\n return () => {\n stopped = true;\n session?.stop();\n waScan?.stop();\n clearInterval(waLightTimer);\n clearInterval(lightsTimer);\n };\n }\n\n // web-console/desktop/src/renderer/console/pages/logs.ts\n function mountLogs(body, marker, deps) {\n const logsDir = `${marker.stateDir.replace(/[\\\\/]+$/, "")}/logs`;\n const output = h("pre", { class: "log-view" }, "\\uFF08\\u8FD8\\u6CA1\\u6709\\u65E5\\u5FD7\\u8F93\\u51FA\\uFF09");\n const hint = h("p", { class: "page-sub" }, "");\n let lastText = "";\n const isInLog = (n) => {\n if (!n) return false;\n const el = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement;\n return !!el && (el === output || output.contains(el));\n };\n const selecting = () => {\n const sel = window.getSelection();\n if (!sel || sel.isCollapsed || sel.rangeCount === 0) return false;\n return isInLog(sel.anchorNode) || isInLog(sel.focusNode);\n };\n const atBottom = () => output.scrollHeight - output.scrollTop - output.clientHeight <= 4;\n async function refresh(force = false) {\n const lines = await deps.logTail(marker.stateDir);\n const hintText2 = lines.length ? "" : "\\u672C\\u4F1A\\u8BDD\\u6CA1\\u6709\\u542F\\u52A8\\u8FC7\\u5F15\\u64CE\\u2014\\u2014\\u5F15\\u64CE\\u65E5\\u5FD7\\u5728\\u5B89\\u88C5\\u76EE\\u5F55\\u7684 logs/ \\u6587\\u4EF6\\u5939\\u91CC\\u3002";\n if (hint.textContent !== hintText2) hint.textContent = hintText2;\n const text = lines.length ? lines.slice(-500).join("\\n") : "\\uFF08\\u8FD8\\u6CA1\\u6709\\u65E5\\u5FD7\\u8F93\\u51FA\\uFF09";\n if (text === lastText) return;\n if (!force && (selecting() || !atBottom())) return;\n lastText = text;\n const stick = atBottom();\n output.textContent = text;\n if (stick) output.scrollTop = output.scrollHeight;\n }\n async function copy() {\n const sel = window.getSelection();\n const picked = sel && !sel.isCollapsed ? String(sel) : "";\n const ok = await writeClipboard(picked || output.textContent || "");\n copyBtn.textContent = ok ? picked ? "\\u5DF2\\u590D\\u5236\\u9009\\u4E2D" : "\\u5DF2\\u590D\\u5236\\u5168\\u90E8" : "\\u590D\\u5236\\u5931\\u8D25";\n setTimeout(() => {\n copyBtn.textContent = "\\u590D\\u5236";\n }, 1500);\n }\n const copyBtn = h("button", { class: "btn", type: "button", onclick: () => {\n void copy();\n } }, "\\u590D\\u5236");\n body.replaceChildren(\n h(\n "div",\n { class: "page" },\n h("h2", {}, "\\u5F15\\u64CE\\u65E5\\u5FD7"),\n h(\n "div",\n { class: "btn-row", style: "margin-bottom:10px" },\n h("button", { class: "btn", type: "button", onclick: () => {\n void deps.openPath(logsDir);\n } }, "\\u6253\\u5F00\\u65E5\\u5FD7\\u6587\\u4EF6\\u5939"),\n h("button", { class: "btn", type: "button", onclick: () => {\n void refresh(true);\n } }, "\\u5237\\u65B0"),\n copyBtn\n ),\n hint,\n output\n )\n );\n let stopped = false;\n void (async () => {\n if (!stopped) await refresh(true);\n })();\n const timer = setInterval(() => {\n if (!stopped) void refresh();\n }, 2e3);\n return () => {\n stopped = true;\n clearInterval(timer);\n };\n }\n async function writeClipboard(text) {\n try {\n await navigator.clipboard.writeText(text);\n return true;\n } catch {\n }\n try {\n const ta = document.createElement("textarea");\n ta.value = text;\n ta.style.position = "fixed";\n ta.style.top = "0";\n ta.style.opacity = "0";\n document.body.appendChild(ta);\n ta.select();\n const ok = document.execCommand("copy");\n ta.remove();\n return ok;\n } catch {\n return false;\n }\n }\n\n // web-console/desktop/src/renderer/console/panels/drift.ts\n function driftNotice(cliVersion, engineVersion) {\n if (!cliVersion || !engineVersion) return null;\n if (cliVersion === engineVersion) return null;\n return h(\n "div",\n { class: "inline-warn", id: "drift-notice" },\n `\\u5185\\u7F6E\\u5F15\\u64CE\\u662F ${cliVersion}\\uFF0C\\u800C\\u8FD9\\u4EFD\\u5F15\\u64CE\\u662F ${engineVersion}\\u2014\\u2014\\u4E0D\\u4E00\\u81F4\\u3002`,\n h("br"),\n "\\u4E0B\\u9762\\u8FD9\\u4E9B\\u9762\\u677F\\u6E32\\u67D3\\u7684\\u662F\\u5185\\u7F6E\\u5F15\\u64CE\\u7684\\u5B57\\u6BB5\\u6E05\\u5355\\u3002\\u7248\\u672C\\u5BF9\\u4E0D\\u4E0A\\u65F6\\uFF0C\\u53EF\\u80FD\\u51FA\\u73B0",\n "\\u300C\\u6539\\u4E86\\u4E0D\\u751F\\u6548\\u300D\\u6216\\u8005\\u300C\\u67D0\\u4E9B\\u5B57\\u6BB5\\u538B\\u6839\\u663E\\u793A\\u4E0D\\u51FA\\u6765\\u300D\\u2014\\u2014\\u8FD9\\u4E24\\u79CD\\u90FD\\u4E0D\\u4F1A\\u62A5\\u9519\\u3002",\n h("br"),\n // \u51FA\u8DEF\u5FC5\u987B**\u65B9\u5411\u4E2D\u7ACB**\uFF1A\u4E0A\u9762\u90A3\u4E24\u79CD\u6F02\u79FB\u7684\u89E3\u6CD5\u4E0D\u4E00\u6837\u2014\u2014\u5185\u7F6E\u6BD4\u76EE\u6807\u65B0\u662F\u5347\u8FD9\u4EFD\u5F15\u64CE\uFF0C\n // \u5185\u7F6E\u6BD4\u76EE\u6807\u65E7\uFF08\u76EE\u6807\u5F15\u64CE\u5DF2\u7ECF\u9AD8\u4E8E cliVersion\uFF09\u662F\u5347\u6258\u76D8\u8FD9\u4E00\u4FA7\u3002\u53EA\u5199"\u5347\u8FD9\u4EFD\u5F15\u64CE"\n // \u5728\u53CD\u65B9\u5411\u4E0A\u8F7B\u5219\u65E0\u610F\u4E49\uFF0C\u91CD\u5219\u8BFB\u8D77\u6765\u50CF\u53EB\u4EBA**\u964D\u7EA7**\n `\\u8981\\u6CBB\\u672C\\u5C31\\u8BA9\\u4E24\\u8FB9\\u7248\\u672C\\u4E00\\u81F4\\uFF1A\\u628A\\u8FD9\\u4EFD\\u5F15\\u64CE\\u5347\\u5230 ${cliVersion}\\uFF08\\u6216\\u66F4\\u9AD8\\uFF09\\uFF0C\\u6216\\u8005\\u8BA9\\u6258\\u76D8\\u8DDF\\u7740\\u8FD9\\u4EFD\\u5F15\\u64CE\\u8D70\\u3002`,\n "\\u53EA\\u662F\\u60F3\\u770B\\u770B\\u73B0\\u72B6\\u7684\\u8BDD\\uFF0C\\u9762\\u677F\\u7167\\u5E38\\u80FD\\u7528\\u3002"\n );\n }\n\n // web-console/desktop/src/renderer/console/set-detail.ts\n function setDetailBlocks(r, opts = {}) {\n const blocks = [];\n if (r.ineffective.length > 0) {\n blocks.push(h(\n "div",\n { class: "inline-error" },\n `\\u8FD9\\u51E0\\u9879\\u5199\\u8FDB\\u53BB\\u4E86\\uFF0C\\u4F46\\u4E0D\\u4F1A\\u751F\\u6548\\uFF1A${r.ineffective.join("\\u3001")}\\u3002`,\n h("br"),\n "\\u5B83\\u4EEC\\u5728 config \\u91CC\\u5B58\\u7684\\u662F\\u660E\\u6587\\uFF08\\u8001\\u88C5\\u673A\\uFF09\\uFF0C\\u5F15\\u64CE\\u8BFB\\u7684\\u662F secrets \\u6587\\u4EF6\\u2014\\u2014\\u5199 secrets \\u6539\\u4E0D\\u52A8\\u5B83\\u8BFB\\u5230\\u7684\\u503C\\u3002",\n h("br"),\n "\\u51FA\\u8DEF\\uFF1A\\u8DD1\\u4E00\\u6B21 `engine7 config migrate` \\u628A\\u660E\\u6587\\u642C\\u8FDB secrets\\uFF0C\\u4E4B\\u540E\\u8FD9\\u4E00\\u683C\\u5C31\\u80FD\\u6B63\\u5E38\\u6539\\u4E86\\u3002",\n opts.onMigrate ? h(\n "div",\n { class: "btn-row" },\n h("button", { class: "btn", type: "button", id: "cfg-migrate", onclick: opts.onMigrate }, "\\u73B0\\u5728\\u8FC1\\u79FB")\n ) : null\n ));\n }\n if (r.failed.length > 0) {\n blocks.push(h(\n "div",\n { class: "inline-error" },\n `\\u8FD9\\u51E0\\u9879\\u7684\\u5BC6\\u94A5\\u6CA1\\u80FD\\u5199\\u6210\\uFF1A${r.failed.join("\\u3001")}\\u3002config \\u5DF2\\u5199\\u5165\\uFF0C\\u4F46\\u8FD9\\u4E9B\\u5B57\\u6BB5\\u8FD8\\u662F\\u65E7\\u503C\\u3002`\n ));\n }\n if (r.needsRestart.length > 0) {\n const block = h(\n "div",\n { class: "inline-warn" },\n `\\u8FD9\\u51E0\\u9879\\u8981\\u91CD\\u542F\\u5F15\\u64CE\\u624D\\u751F\\u6548\\uFF1A${r.needsRestart.join("\\u3001")}\\u3002`\n );\n if (opts.onRestart) {\n block.append(h(\n "div",\n { class: "btn-row" },\n h("button", {\n class: "btn btn-primary",\n type: "button",\n id: "cfg-restart-now",\n onclick: opts.onRestart\n }, "\\u73B0\\u5728\\u91CD\\u542F"),\n // \u300C\u7A0D\u540E\u300D\u8981\u6709\u53CD\u5E94\uFF1A\u8FD9\u4E00\u7248\u4E4B\u524D\u5B83**\u6CA1\u6709 onclick** \u2014\u2014 \u70B9\u4E86\u4EC0\u4E48\u90FD\u4E0D\u53D1\u751F\u3001\u533A\u5757\u4E5F\u4E0D\u6536\uFF0C\n // \u800C"\u70B9\u4E86\u6CA1\u53CD\u5E94"\u6B63\u662F\u8FD9\u4E2A\u9879\u76EE\u6700\u7ECF\u5178\u7684\u5DE5\u5355\uFF0C\u5B83\u5374\u957F\u5728\u4E3B\u4FDD\u5B58\u6D41\u7A0B\u91CC\u3002\n // \u6536\u8D77\u8FD9\u4E00\u6BB5\u5C31\u662F\u300C\u7A0D\u540E\u300D\u7684\u8BED\u4E49\uFF08\u4E0B\u6B21\u4FDD\u5B58\u4F1A\u91CD\u65B0\u6E32\u67D3\u51FA\u65B0\u7684\u63D0\u793A\uFF09\u3002\n h("button", {\n class: "btn",\n type: "button",\n id: "cfg-restart-later",\n onclick: () => {\n block.hidden = true;\n }\n }, "\\u7A0D\\u540E")\n ));\n }\n blocks.push(block);\n }\n for (const w of r.warnings) {\n const note = opts.warningNotes?.find((n) => w.includes(n.mark));\n blocks.push(h("div", { class: "inline-warn" }, note ? `${w}\\u3002${note.note}` : w));\n }\n for (const e of r.errors) {\n if (opts.shownPaths?.has(e.path)) continue;\n blocks.push(h("div", { class: "inline-error" }, `${e.path}\\uFF1A${e.error}`));\n }\n return blocks;\n }\n\n // web-console/desktop/src/shared/config-form.ts\n function pickPath(obj, dotPath) {\n let cur = obj;\n for (const k of dotPath.split(".")) {\n if (cur == null || typeof cur !== "object") return void 0;\n cur = cur[k];\n }\n return cur;\n }\n var ENV_REF = /^(?:env:|{{\\s*)(?=[A-Z0-9_]*[A-Z])([A-Z0-9_]+)(?:\\s*}})?$/;\n function secretEnvNameOf(field, values) {\n const cur = pickPath(values, field.path);\n if (typeof cur === "string") {\n const m = ENV_REF.exec(cur);\n if (m) return m[1];\n }\n return field.envKey ?? field.path.split(".").pop().toUpperCase().replace(/[^A-Z0-9_]/g, "_");\n }\n function sameValue(a, b) {\n if (a === b) return true;\n if (a === null || b === null || a === void 0 || b === void 0) return false;\n if (typeof a !== typeof b) return false;\n if (typeof a === "object") {\n try {\n return JSON.stringify(a) === JSON.stringify(b);\n } catch {\n return false;\n }\n }\n return false;\n }\n var CREDENTIAL_KEY = /^(token|api[_-]?key|app[_-]?secret|client[_-]?secret|access[_-]?key|secret[_-]?key|private[_-]?key|secret|password|passwd)$/i;\n function findNullCredentials(value, prefix = "") {\n const out = [];\n if (value == null || typeof value !== "object") return out;\n for (const [k, v] of Object.entries(value)) {\n const p = prefix ? `${prefix}.${k}` : k;\n if (CREDENTIAL_KEY.test(k) && v === null) out.push(p);\n else out.push(...findNullCredentials(v, p));\n }\n return out;\n }\n function effectBadge(effect) {\n if (effect === "restart") return { text: "\\u91CD\\u542F\\u540E\\u751F\\u6548", cls: "fx-restart" };\n if (effect === "channel-reconnect") return { text: "\\u4FDD\\u5B58\\u540E\\u901A\\u9053\\u9700\\u91CD\\u8FDE", cls: "fx-reconnect" };\n if (effect === "external-service") return { text: "\\u5916\\u90E8\\u670D\\u52A1\\uFF0C\\u9700\\u624B\\u52A8\\u91CD\\u542F", cls: "fx-external" };\n return null;\n }\n function secretState(field, values, secrets) {\n const name = secretEnvNameOf(field, values);\n if (!(name in secrets)) return { kind: "unknown", text: "\\u72B6\\u6001\\u672A\\u77E5" };\n return secrets[name] === "set" ? { kind: "set", text: "\\u5DF2\\u8BBE\\u7F6E" } : { kind: "unset", text: "\\u672A\\u8BBE\\u7F6E" };\n }\n\n // web-console/desktop/src/shared/config-editors.ts\n function isPlainObject(v) {\n return v !== null && typeof v === "object" && !Array.isArray(v);\n }\n function mergeProvider(providers, providerId, patch) {\n const src = isPlainObject(providers) ? providers : {};\n const out = { ...src };\n const cur = isPlainObject(out[providerId]) ? { ...out[providerId] } : {};\n let keyDropped = false;\n if (patch.baseUrl !== void 0) cur.baseUrl = patch.baseUrl;\n if (patch.apiKey !== void 0 && patch.apiKey !== "") {\n cur.apiKey = patch.apiKey;\n } else if (cur.apiKey === null) {\n delete cur.apiKey;\n keyDropped = true;\n }\n out[providerId] = cur;\n const othersMasked = [];\n for (const [id, raw] of Object.entries(out)) {\n if (id === providerId) continue;\n if (findNullCredentials(raw).length > 0) othersMasked.push(id);\n }\n return { value: out, keyDropped, othersMasked };\n }\n function mergeMySelfie(current2, form) {\n const src = isPlainObject(current2) ? current2 : {};\n const value = { ...src };\n let keyDropped = false;\n if (form.relayProvider) value.provider = form.relayProvider;\n if (form.photoRelPath) {\n value.references = [{ name: "portrait", path: form.photoRelPath }];\n delete value.portraitDesc;\n } else {\n delete value.references;\n if (form.portraitDesc) value.portraitDesc = form.portraitDesc;\n else delete value.portraitDesc;\n }\n for (const k of Object.keys(value)) {\n if (value[k] === null) {\n delete value[k];\n keyDropped = true;\n }\n }\n return { value, keyDropped };\n }\n var VOICE_FORM_KEYS = [\n "url",\n "voice",\n "lang",\n "model",\n "workspaceId",\n "instruction",\n "pythonPath"\n // \u26A0\uFE0F relay / \u8BA1\u8D39\u6C60\u90A3\u4E94\u4E2A\u952E\uFF08relayProviderId / relayModel / billingProviderId /\n // billingModel / billingMode\uFF09**\u523B\u610F\u4E0D\u5728\u8FD9\u91CC** \u2014\u2014 \u5B83\u4EEC\u53EA\u5728**\u5185\u90E8\u6A21\u5F0F**\u4E0B\u5EFA\u6846\uFF0C\n // \u89C1\u4E0B\u9762\u7684 VOICE_INTERNAL_FORM_KEYS\u3002\u7FC0\u54E5 0927 \u770B\u56FE\uFF1A\u300C\u4F60\u8FD9\u4E9B\u90FD\u662F\u5565\u72D7\u5C4E\uFF1F\u6709\u5FC5\u8981\u4E48\uFF1F\n // \u4F60\u5C55\u793A\u7ED9\u7528\u6237\u56FE\u4E2A\u5565\u300D\u2014\u2014 relayProviderId \u7528\u6237\u53EA\u6709\u4E00\u4E2A\u6761\u76EE\u3001relayModel \u5F97\u5148\u77E5\u9053\n // \u4E2D\u8F6C\u7AD9\u6302\u4E86\u4EC0\u4E48\u6A21\u578B\u3001\u4E09\u4E2A billing* \u662F**\u672A\u6765\u8BA1\u8D39**\u7684\uFF08\u4ECA\u5929\u8BA1\u8D39\u6C60\u4E0D\u5B58\u5728\uFF09\u3002\u64A4\u3002\n //\n // **\u4E0D\u5728\u8868\u5355\u91CC \u2260 \u4F1A\u88AB\u5220\u6389**\uFF1A\u4E0B\u9762\u7684 `keep` \u6765\u81EA\u5F15\u64CE\u6E05\u5355\u7684 `requiredKeys`\n // \uFF08\u6258\u76D8\u9760\u5B83\u51B3\u5B9A"\u8FD9\u4E00\u7248 provider \u4F1A\u8BFB\u54EA\u4E9B\u952E"\uFF09\uFF0C\u4E0D\u5728 formKeys \u91CC\u5C31\u53EA\u8D70 keep\u3001\n // \u4E0D\u8FDB"\u8868\u5355\u8986\u76D6"\u90A3\u6BB5 \u21D2 \u4FDD\u5B58\u65F6\u539F\u6837\u7559\u7740\u3002\u4E0E voiceTier / fallback \u540C\u4E00\u4E2A\u5F85\u9047\u3002\n // **\u522B\u987A\u624B\u52A0\u56DE\u8FD9\u4E00\u4E2A\u6570\u7EC4** \u2014\u2014 \u52A0\u56DE\u6765\u5C31\u7B49\u4E8E"\u8868\u5355\u91CC\u6CA1\u6709 \u21D2 delete"\uFF0C\n // \u666E\u901A\u6A21\u5F0F\u4E0B\u4E00\u6B21\u4FDD\u5B58\u5C31\u628A\u5B83\u4EEC\u4ECE config \u91CC\u5220\u4E86\u3002\n ];\n var VOICE_INTERNAL_FORM_KEYS = [\n "relayProviderId",\n "relayModel",\n "billingMode",\n "billingProviderId",\n "billingModel"\n ];\n function voiceFormKeys(internalMode) {\n return internalMode ? [...VOICE_FORM_KEYS, ...VOICE_INTERNAL_FORM_KEYS] : [...VOICE_FORM_KEYS];\n }\n function voiceSchemaOf(field, internalMode = false) {\n const providers = field?.knownValues?.provider;\n const byProvider = field?.valueKeys?.provider;\n if (!Array.isArray(providers) || providers.length === 0) return null;\n if (!byProvider || typeof byProvider !== "object") return null;\n return {\n providers: [...providers],\n keysOf: (p) => Array.isArray(byProvider[p]) ? [...byProvider[p]] : void 0,\n // \u26A0\uFE0F \u8FD9\u91CC**\u4E0D\u662F** `Object.values(byProvider).flat()`\uFF08\u5F15\u64CE\u90A3\u8FB9\u6240\u6709 provider \u8BFB\u7684\u952E\u7684\u5E76\u96C6\uFF09\u3002\n // \u90A3\u4E2A\u5E76\u96C6\u91CC\u8EBA\u7740 voiceTier / fallback / \u90A3\u4E94\u4E2A relay \u952E \u2014\u2014 \u5B83\u4EEC\u662F"\u8981\u4FDD\u7559"\u7684\u952E\uFF0C\n // \u4E0D\u662F"\u9762\u677F\u4E0A\u80FD\u6539"\u7684\u952E\uFF1B\u62FF\u5B83\u5F53\u904D\u5386\u8303\u56F4 = \u8868\u5355\u91CC\u6CA1\u6709\u5C31 delete\uFF08\u4E00\u4FDD\u5B58\u5C31\u9759\u9ED8\u5220\u914D\u7F6E\uFF09\u3002\n // \u9762\u677F\u4E0A\u6709\u54EA\u4E9B\u6846\u662F**\u6258\u76D8\u81EA\u5DF1\u7684 UI \u4E8B\u5B9E**\uFF08voice.ts \u91CC\u6BCF\u4E2A fieldRow \u90FD\u5199\u660E\u7ED1\u54EA\u4E2A\u952E\uFF09\uFF0C\n // \u5F15\u64CE\u90A3\u4EFD\u6E05\u5355\u9A71\u52A8\u7684\u662F\u884C\u663E\u9690\u4E0E\u4FDD\u5B58\u65F6\u4FDD\u7559\u54EA\u4E9B\u952E\u3002\n formKeys: voiceFormKeys(internalMode),\n internalMode\n };\n }\n function voiceOptionsOf(field, provider) {\n const byProvider = field?.knownValuesByProvider?.voice;\n if (!byProvider || typeof byProvider !== "object") return null;\n const opts = byProvider[provider];\n return Array.isArray(opts) && opts.length > 0 ? [...opts] : null;\n }\n function mergeMyVoice(current2, form, schema) {\n const src = isPlainObject(current2) ? current2 : {};\n const knownKeys = schema ? schema.keysOf(form.provider) : void 0;\n const formKeys = schema?.formKeys ?? VOICE_FORM_KEYS;\n const keep = new Set(knownKeys ?? Object.keys(src).filter((k) => k !== "provider"));\n const accepts = (k) => knownKeys ? keep.has(k) : true;\n const value = { provider: form.provider };\n let keyDropped = false;\n for (const k of keep) {\n if (src[k] === void 0 || src[k] === null) continue;\n value[k] = src[k];\n }\n for (const k of formKeys) {\n if (!accepts(k)) continue;\n const v = form[k];\n if (v) value[k] = v;\n else delete value[k];\n }\n if (form.apiKey && accepts("apiKey")) value.apiKey = form.apiKey;\n for (const k of Object.keys(value)) {\n if (value[k] === null) {\n delete value[k];\n keyDropped = true;\n }\n }\n if (src.apiKey === null && value.apiKey === void 0) keyDropped = true;\n return { value, keyDropped };\n }\n function listProviders(providers) {\n if (!isPlainObject(providers)) return [];\n return Object.entries(providers).map(([id, raw]) => {\n const p = isPlainObject(raw) ? raw : {};\n const key = p.apiKey;\n const models = Array.isArray(p.models) ? p.models.map((m) => isPlainObject(m) && typeof m.id === "string" ? m.id : "").filter(Boolean) : [];\n return {\n id,\n baseUrl: typeof p.baseUrl === "string" ? p.baseUrl : "",\n apiKeyRef: typeof key === "string" ? key : "(\\u672A\\u8BBE\\u7F6E)",\n keyMasked: key === null,\n models\n };\n });\n }\n\n // web-console/desktop/src/renderer/console/panels/face.ts\n var PORTRAIT_WARNING_MARK = \'"portrait"\';\n var PORTRAIT_WARNING_NOTE = "\\u8FD9\\u6761\\u5728\\u9884\\u671F\\u4E4B\\u5185\\uFF1A\\u7167\\u7247\\u7531\\u6258\\u76D8\\u81EA\\u5DF1\\u590D\\u5236\\u5230 workspace/images/portrait.<ext>\\uFF0C\\u4E0D\\u4F9D\\u8D56\\u5F15\\u64CE\\u90A3\\u6761\\u8054\\u52A8\\u3002";\n function renderFacePanel(body, ctx) {\n const cur = pickPath(ctx.values, "tools.my_selfie") ?? {};\n const curPhoto = Array.isArray(cur.references) && cur.references[0] && typeof cur.references[0].path === "string" ? String(cur.references[0].path) : "";\n const curDesc = typeof cur.portraitDesc === "string" ? cur.portraitDesc : "";\n let photoRelPath = curPhoto;\n let savedPhoto = curPhoto;\n let savedDesc = curDesc;\n const photoLabel = h(\n "div",\n { class: "cf-hint", id: "face-photo" },\n curPhoto ? `\\u5F53\\u524D\\u7528\\u7684\\u7167\\u7247\\uFF1A${curPhoto}` : "\\u5F53\\u524D\\u6CA1\\u6709\\u53C2\\u8003\\u7167\\u7247"\n );\n const desc = h("textarea", {\n id: "face-desc",\n rows: 3,\n value: curDesc,\n placeholder: "\\u4E0D\\u9009\\u7167\\u7247\\u65F6\\uFF0C\\u7528\\u4E00\\u6BB5\\u63CF\\u8FF0\\u8BA9\\u52A9\\u624B\\u7B2C\\u4E00\\u6B21\\u81EA\\u62CD\\u65F6\\u6309\\u5B83\\u751F\\u6210",\n style: "width:100%"\n });\n const pick = h("button", {\n class: "btn",\n type: "button",\n id: "face-pick",\n onclick: () => {\n void (async () => {\n const src = await ctx.deps.pickImageFile();\n if (!src) return;\n const r = await ctx.deps.copyPortrait(ctx.stateDir, src);\n if (!r.ok) {\n bar.setStatus(`\\u7167\\u7247\\u6CA1\\u843D\\u76D8\\uFF1A${r.error}`, "err");\n return;\n }\n photoRelPath = r.relPath;\n photoLabel.textContent = `\\u5DF2\\u9009\\u7167\\u7247\\uFF1A${photoRelPath}\\uFF08\\u4FDD\\u5B58\\u540E\\u751F\\u6548\\uFF1B\\u7167\\u7247\\u4F18\\u5148\\uFF0C\\u63CF\\u8FF0\\u4F1A\\u88AB\\u5FFD\\u7565\\uFF09`;\n refreshSave();\n })();\n }\n }, "\\u9009\\u4E00\\u5F20\\u7167\\u7247");\n const clearPhoto = h("button", {\n class: "btn",\n type: "button",\n id: "face-clear",\n onclick: () => showClearConfirm()\n }, "\\u4E0D\\u7528\\u7167\\u7247");\n const photoRow = h("div", { class: "btn-row", id: "face-photo-row" }, pick, clearPhoto);\n const paintPhotoRow = () => {\n photoRow.replaceChildren(pick, clearPhoto);\n };\n const showClearConfirm = () => {\n photoRow.replaceChildren(\n h(\n "span",\n { class: "cf-hint", id: "face-clear-ask" },\n "\\u4E0D\\u518D\\u7528\\u8FD9\\u5F20\\u7167\\u7247\\uFF1F\\u7167\\u7247\\u6587\\u4EF6\\u4E0D\\u4F1A\\u88AB\\u5220\\uFF0C\\u8FD8\\u5728 workspace/images/ \\u91CC\\uFF0C\\u540E\\u6094\\u4E86\\u518D\\u9009\\u540C\\u4E00\\u5F20\\u5C31\\u80FD\\u56DE\\u6765\\uFF1B\\u8FD9\\u4E00\\u6B65\\u53EA\\u662F\\u8BA9\\u52A9\\u624B\\u4E0D\\u518D\\u7528\\u5B83\\uFF0C\\u70B9\\u300C\\u4FDD\\u5B58\\u300D\\u4E4B\\u540E\\u624D\\u751F\\u6548\\u3002"\n ),\n h("button", {\n class: "btn btn-primary",\n type: "button",\n id: "face-clear-yes",\n onclick: () => {\n photoRelPath = "";\n photoLabel.textContent = "\\u5DF2\\u6E05\\u6389\\u7167\\u7247\\u5F15\\u7528\\uFF08\\u6587\\u4EF6\\u8FD8\\u5728 workspace/images/\\uFF0C\\u672C\\u6B21\\u4FDD\\u5B58\\u540E\\u751F\\u6548\\uFF09";\n refreshSave();\n paintPhotoRow();\n }\n }, "\\u786E\\u8BA4\\u4E0D\\u7528"),\n h("button", { class: "btn", type: "button", id: "face-clear-no", onclick: () => {\n paintPhotoRow();\n } }, "\\u53D6\\u6D88")\n );\n };\n const save = h("button", { class: "btn btn-primary", type: "button", id: "cfg-save" }, "\\u4FDD\\u5B58");\n const status = h("div", { class: "inline-warn", id: "cfg-status", hidden: true });\n const detail = h("div", { class: "cfg-detail" });\n const refreshSave = () => {\n save.disabled = photoRelPath === savedPhoto && desc.value === savedDesc;\n };\n const bar = { setStatus: (m, k) => {\n status.hidden = false;\n status.textContent = m;\n status.style.color = k === "err" ? "var(--red)" : k === "ok" ? "var(--green)" : "";\n } };\n const renderDetail = (r) => {\n detail.replaceChildren(...setDetailBlocks(r, {\n warningNotes: [{ mark: PORTRAIT_WARNING_MARK, note: PORTRAIT_WARNING_NOTE }]\n }));\n };\n desc.addEventListener("input", refreshSave);\n save.addEventListener("click", () => {\n void (async () => {\n if (photoRelPath && desc.value.trim()) {\n bar.setStatus("\\u7167\\u7247\\u548C\\u63CF\\u8FF0\\u90FD\\u586B\\u4E86\\uFF1A\\u8FD9\\u6B21\\u6309\\u300C\\u7167\\u7247\\u300D\\u5B58\\uFF08\\u63CF\\u8FF0\\u4F1A\\u88AB\\u5FFD\\u7565\\uFF09\\u3002\\u60F3\\u7528\\u63CF\\u8FF0\\u8BF7\\u5148\\u70B9\\u300C\\u4E0D\\u7528\\u7167\\u7247\\u300D\\u3002", "info");\n }\n save.disabled = true;\n detail.replaceChildren();\n const merged = mergeMySelfie(cur, {\n photoRelPath,\n portraitDesc: desc.value.trim(),\n // provider \u4E0D\u6446\u5728\u8868\u5355\u91CC\uFF0C**\u4E5F\u4E0D\u66FF\u7528\u6237\u51B3\u5B9A**\uFF08cli-init-config.ts:475-481 \u7684\u53E3\u5F84\uFF09\uFF1A\n // \u8FD9\u4E00\u683C\u7F3A\u5E2D\u65F6\u4F20**\u7A7A\u4E32**\uFF0CmergeMySelfie \u8DF3\u8FC7\u5199\u5165\uFF0C\u5F15\u64CE\u843D\u56DE\u81EA\u5DF1\u7684\u9ED8\u8BA4\u503C\u3002\n // \u26A0\uFE0F \u65E9\u5148\u8FD9\u91CC\u515C\u5E95\u5199\u7684\u662F \'relay\'\uFF0C\u90A3\u662F\u9519\u7684\uFF1A\u514D\u8D39\u6863 init \u65E9\u5C31\u5199\u597D \'relay\'\uFF08\u4E0D\u9700\u8981\u515C\u5E95\uFF09\uFF0C\n // \u800C\u975E\u514D\u8D39\u6863\u88C5\u673A\u672C\u6765\u6CA1\u8FD9\u4E00\u683C\u3001\u5F15\u64CE\u9ED8\u8BA4\u662F **\'fal\'**\uFF08my-selfie.ts:90-92\uFF09\u2014\u2014\n // \u515C\u5E95\u53CD\u800C\u628A provider \u9759\u9ED8\u6539\u6210 \'relay\'\uFF0C\u4E0B\u4E00\u6B21\u81EA\u62CD\u76F4\u63A5\u62A5\u300Crelay provider \u672A\u914D\u7F6E\u300D\uFF0C\n // \u4E5F\u5C31\u662F"\u5F00\u4E00\u6B21\u5F62\u8C61\u9762\u677F\u5C31\u628A\u597D\u914D\u7F6E\u6539\u574F\u4E86"\u3002\n relayProvider: typeof cur.provider === "string" ? cur.provider : ""\n });\n const r = await ctx.deps.configSet(ctx.configPath, { "tools.my_selfie": merged.value });\n renderDetail(r);\n if (!r.ok) {\n refreshSave();\n bar.setStatus(`\\u4FDD\\u5B58\\u5931\\u8D25\\uFF1A${r.error ?? ""} ${r.errors.map((e) => e.error).join("\\uFF1B")}`, "err");\n return;\n }\n savedPhoto = photoRelPath;\n savedDesc = desc.value;\n refreshSave();\n let msg = `\\u5DF2\\u4FDD\\u5B58\\uFF1A${r.changed.join("\\u3001") || "\\uFF08\\u65E0\\u53D8\\u5316\\uFF09"}\\u3002`;\n if (merged.keyDropped) {\n msg += " \\u26A0\\uFE0F \\u8FD9\\u4E00\\u683C\\u91CC\\u6709\\u88AB\\u5F15\\u64CE\\u8131\\u654F\\u7684\\u51ED\\u636E\\uFF08config \\u91CC\\u5B58\\u7684\\u660E\\u6587\\uFF09\\uFF0C\\u5DF2\\u968F\\u8FD9\\u6B21\\u4FDD\\u5B58\\u53BB\\u6389\\u3002\\u8981\\u8865\\u56DE\\u6765\\u8BF7\\u76F4\\u63A5\\u7F16\\u8F91 config \\u91CC\\u7684 tools.my_selfie\\uFF0C\\u6216\\u53BB\\u300C\\u6A21\\u578B\\u670D\\u52A1\\u300D\\u91CC\\u6539\\u5B83\\u7528\\u7684\\u90A3\\u4E2A provider \\u7684 key\\u3002";\n }\n bar.setStatus(msg, "ok");\n })();\n });\n refreshSave();\n body.replaceChildren(\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "\\u53C2\\u8003\\u7167\\u7247\\uFF08\\u4F18\\u5148\\uFF09"),\n h(\n "p",\n { class: "page-sub" },\n "\\u9009\\u4E00\\u5F20\\u7167\\u7247\\u5F53\\u52A9\\u624B\\u81EA\\u62CD\\u7684\\u53C2\\u8003\\u56FE\\u3002\\u6211\\u4EEC\\u4F1A\\u628A\\u5B83\\u590D\\u5236\\u5230 workspace/images/portrait.<ext>\\uFF0C",\n "\\u5E76\\u5728 tools.my_selfie \\u91CC\\u8BB0\\u4E0B\\u8FD9\\u4E2A\\u5F15\\u7528\\u3002"\n ),\n photoLabel,\n photoRow\n ),\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "\\u5F62\\u8C61\\u63CF\\u8FF0\\uFF08\\u6CA1\\u6709\\u7167\\u7247\\u65F6\\u624D\\u7528\\uFF09"),\n h("p", { class: "page-sub" }, "\\u4E00\\u53E5\\u8BDD\\u63CF\\u8FF0\\u4F60\\u60F3\\u8981\\u7684\\u6837\\u5B50\\uFF1B\\u52A9\\u624B\\u7B2C\\u4E00\\u6B21\\u81EA\\u62CD\\u65F6\\u6309\\u5B83\\u751F\\u6210\\u3002"),\n desc\n ),\n h("p", { class: "cf-hint" }, "\\u6570\\u5B57\\u4EBA\\u5F62\\u8C61\\uFF08\\u4F1A\\u52A8\\u7684\\u90A3\\u4E2A\\uFF09\\u4E0D\\u5728\\u8FD9\\u91CC\\u2014\\u2014\\u5B83\\u8DD1\\u5728\\u8FDC\\u7AEF\\u7684\\u56FE\\u5F62\\u670D\\u52A1\\u4E0A\\uFF0C\\u5F52\\u540E\\u7EED\\u7248\\u672C\\u3002"),\n h("div", { class: "cfg-savebar" }, h("div", { class: "btn-row" }, save), status, detail)\n );\n return () => {\n };\n }\n\n // web-console/desktop/src/shared/zones.ts\n function detectZone() {\n try {\n return Intl.DateTimeFormat().resolvedOptions().timeZone || "";\n } catch {\n return "";\n }\n }\n var ALL_ZONES = (() => {\n try {\n const intl = Intl;\n return intl.supportedValuesOf?.("timeZone") || [];\n } catch {\n return [];\n }\n })();\n\n // web-console/desktop/src/renderer/shared/model-picker.ts\n function createModelPicker(opts) {\n const CUSTOM = "__custom__";\n const select = h("select", { id: opts.selectId, "aria-label": opts.label });\n const input = h("input", {\n type: "text",\n id: opts.inputId,\n placeholder: opts.placeholder,\n "aria-label": `${opts.label} \\xB7 \\u81EA\\u5B9A\\u4E49`,\n style: "display:none"\n });\n let customDraft;\n const showCustom = () => {\n input.style.display = select.value === CUSTOM ? "" : "none";\n };\n input.addEventListener("input", () => {\n if (select.value === CUSTOM) customDraft = input.value;\n });\n select.addEventListener("change", () => {\n if (select.value === CUSTOM) input.value = customDraft ?? input.value;\n else input.value = select.value;\n showCustom();\n if (select.value === CUSTOM) input.focus();\n input.dispatchEvent(new Event("input", { bubbles: true }));\n });\n return {\n root: h("div", { class: "model-picker", style: "display:grid;gap:8px" }, select, input),\n input,\n update(options, value) {\n const unique = [...new Map(options.filter((o) => o.value && o.value !== CUSTOM).map((o) => [o.value, o])).values()];\n const isCustom = !unique.some((o) => o.value === value) && !(value === "" && opts.emptyLabel !== void 0);\n input.value = value;\n customDraft = isCustom ? value : void 0;\n select.replaceChildren(\n ...opts.emptyLabel === void 0 ? [] : [h("option", { value: "", selected: value === "" }, opts.emptyLabel)],\n ...unique.map((o) => h("option", { value: o.value, selected: o.value === value }, o.label ?? o.value)),\n h("option", { value: CUSTOM, selected: isCustom }, "\\u81EA\\u5B9A\\u4E49\\u2026")\n );\n showCustom();\n }\n };\n }\n\n // web-console/desktop/src/renderer/console/form.ts\n var LOCKED_PATHS = /* @__PURE__ */ new Set([\n "stateDir",\n "mediaDir",\n "agents.defaults.workspace",\n "skills.path"\n ]);\n var LOCKED_HINT = "\\u8FD9\\u4E00\\u683C\\u6258\\u76D8\\u4E0D\\u7ED9\\u6539 \\u2014\\u2014 \\u6539\\u5B83\\u4F1A\\u628A\\u8FD9\\u4E2A\\u5F15\\u64CE\\u6307\\u5230\\u53E6\\u4E00\\u4E2A\\u76EE\\u5F55\\u3002\\u8981\\u6539\\u8BF7\\u76F4\\u63A5\\u7F16\\u8F91\\u5F15\\u64CE\\u914D\\u7F6E\\u6587\\u4EF6\\u3002";\n var JSON_LOCKED_HINT = "\\u8FD9\\u4E00\\u683C\\u6258\\u76D8\\u4E0D\\u7ED9\\u6539 \\u2014\\u2014 \\u5B83\\u662F JSON\\uFF0C\\u901A\\u7528\\u8868\\u5355\\u6CA1\\u6709\\u5B89\\u5168\\u7684\\u7F16\\u8F91\\u5668\\uFF08\\u53EF\\u7F16\\u8F91\\u4F1A\\u628A\\u5BF9\\u8C61\\u5F53\\u6210\\u5B57\\u7B26\\u4E32\\u5199\\u56DE config\\uFF09\\u3002\\u8981\\u6539\\u8BF7\\u7528\\u5BF9\\u5E94\\u7684\\u4E13\\u7528\\u9762\\u677F\\uFF0C\\u6216\\u76F4\\u63A5\\u7F16\\u8F91 config\\u3002";\n function lockedHintOf(field) {\n return LOCKED_PATHS.has(field.path) ? LOCKED_HINT : JSON_LOCKED_HINT;\n }\n function toText(v) {\n if (v === null || v === void 0) return "";\n if (typeof v === "string") return v;\n if (typeof v === "number" || typeof v === "boolean") return String(v);\n try {\n return JSON.stringify(v, null, 2);\n } catch {\n return "";\n }\n }\n function fromText(field, text) {\n if (field.type === "number") {\n const t = text.trim();\n if (t === "") return "";\n const n = Number(t);\n return Number.isFinite(n) ? n : t;\n }\n return text;\n }\n function renderForm(fields, values, secrets, deps, extras = {}) {\n const rows = [];\n const root = h("div", { class: "cf-form" });\n for (const field of fields) {\n const raw = pickPath(values, field.path);\n const ex = extras[field.path] ?? {};\n const err = h("div", { class: "cf-error", hidden: true });\n const notice = h("div", { class: "cf-error cf-notice", hidden: true });\n let input;\n let initial;\n let outside;\n let resetSecret = null;\n const locked = field.type === "json" || LOCKED_PATHS.has(field.path);\n if (field.type === "boolean") {\n const checked = raw === void 0 ? ex.booleanDefault === true : raw === true;\n input = h("input", { type: "checkbox", checked, "aria-label": ex.label ?? field.label });\n initial = checked;\n outside = h("div", { class: "check-row" }, input);\n } else if (field.type === "enum") {\n const current2 = raw === void 0 ? ex.enumDefault : raw;\n const opts = [...field.options ?? []];\n if (typeof current2 === "string" && current2 && !opts.includes(current2)) opts.unshift(current2);\n else if (current2 === void 0) opts.unshift("");\n input = h("select", { "aria-label": ex.label ?? field.label }, ...opts.map((o) => h("option", { value: o, selected: o === current2 }, ex.optionLabels?.[o] ?? o)));\n initial = current2;\n outside = input;\n } else if (field.type === "secret") {\n const st = secretState(field, values, secrets);\n const cur = typeof raw === "string" ? raw : "";\n input = h("input", {\n type: "password",\n value: "",\n autocomplete: "new-password",\n placeholder: cur ? `\\u7559\\u7A7A\\u4E0D\\u6539\\uFF08\\u5F53\\u524D\\u662F ${cur.slice(0, 24)}\\uFF09` : "\\u586B\\u4E00\\u4E2A\\u503C"\n });\n initial = "";\n const badge2 = h("span", { class: `sec-badge sec-${st.kind}` }, st.text);\n const syncBadge = () => {\n badge2.textContent = input.value ? "\\u5C06\\u5199\\u5165\\u65B0\\u503C" : st.text;\n badge2.className = `sec-badge ${input.value ? "sec-new" : `sec-${st.kind}`}`;\n };\n input.addEventListener("input", syncBadge);\n input._badge = badge2;\n resetSecret = () => {\n input.value = "";\n syncBadge();\n };\n outside = input;\n } else if (field.type === "path" && LOCKED_PATHS.has(field.path)) {\n const ro = h("input", { type: "text", value: toText(raw) });\n ro.readOnly = true;\n input = ro;\n initial = raw;\n outside = input;\n } else if (field.type === "path" || field.type === "image") {\n input = h("input", { type: "text", value: toText(raw), placeholder: ex.placeholder ?? "" });\n initial = raw;\n const btn = h("button", {\n class: "btn",\n type: "button",\n onclick: () => {\n void (async () => {\n const picked = field.type === "image" ? await deps.pickImageFile() : await deps.pickDirectory();\n if (!picked) return;\n input.value = picked;\n input.dispatchEvent(new Event("input", { bubbles: true }));\n })();\n }\n }, field.type === "image" ? "\\u9009\\u56FE\\u2026" : "\\u6D4F\\u89C8\\u2026");\n outside = h("div", { class: "path-row" }, input, btn);\n } else if (field.type === "json") {\n const ta = h("textarea", { rows: 6, value: toText(raw) });\n ta.readOnly = true;\n input = ta;\n initial = raw;\n const masked = findNullCredentials(raw);\n if (masked.length > 0) {\n notice.hidden = false;\n notice.textContent = `\\u8FD9\\u4E00\\u683C\\u91CC\\u6709\\u88AB\\u5F15\\u64CE\\u8131\\u654F\\u7684\\u51ED\\u636E\\uFF08${masked.join("\\u3001")}\\uFF09\\u2014\\u2014\\u672C\\u9762\\u677F\\u4E0D\\u4F1A\\u4FDD\\u5B58\\u8FD9\\u4E00\\u683C\\uFF08json \\u5B57\\u6BB5\\u4E00\\u5F8B\\u53EA\\u8BFB\\u3001\\u4E0D\\u8FDB\\u63D0\\u4EA4\\uFF09\\u3002\\u8981\\u6539\\u5B83\\uFF0C\\u8BF7\\u7528\\u5BF9\\u5E94\\u7684\\u4E13\\u7528\\u9762\\u677F\\uFF0C\\u6216\\u5148\\u8DD1 engine7 config migrate\\u3002`;\n }\n outside = input;\n } else if (field.type === "string" && ex.modelOptions) {\n const picker = createModelPicker({\n label: ex.label ?? field.label,\n placeholder: ex.placeholder ?? "\\u586B\\u5199\\u6A21\\u578B\\uFF0C\\u4F8B\\u5982\\uFF1A7yi/engine7-free",\n emptyLabel: ex.modelEmptyLabel ?? "\\u672A\\u8BBE\\u7F6E"\n });\n picker.update(ex.modelOptions.map((value) => ({ value })), toText(raw));\n input = picker.input;\n initial = raw;\n outside = picker.root;\n } else {\n input = h("input", { type: "text", value: toText(raw), placeholder: ex.placeholder ?? "" });\n initial = raw;\n if (ex.suggest) {\n const listId = `cfg-list-${field.path.replace(/[^a-zA-Z0-9]/g, "-")}`;\n input.setAttribute("list", listId);\n input._datalist = h("datalist", { id: listId }, ...ex.suggest.map((z) => h("option", { value: z })));\n }\n outside = input;\n }\n input.addEventListener("input", () => {\n err.hidden = true;\n });\n const badge = effectBadge(field.effect);\n const cell = h(\n "div",\n { class: "cf-field", "data-path": field.path },\n h(\n "label",\n {},\n ex.label ?? field.label,\n ex.showPath === false ? null : h("span", { class: "cf-path" }, field.path),\n badge ? h("span", { class: `fx-badge ${badge.cls}` }, badge.text) : null\n ),\n ex.hint ? h("p", { class: "cf-hint" }, ex.hint) : null,\n // \u53EA\u8BFB\u6863\u7684\u8BF4\u660E**\u5FC5\u987B\u662F\u72EC\u7ACB\u5143\u7D20**\uFF08\u4E0E json \u90A3\u6761 notice \u540C\u7406\uFF09\uFF1Aerr \u4F1A\u88AB setError(nil) /\n // clearErrors() \u53CD\u590D\u6E05\uFF0C\u63D0\u793A\u5199\u8FDB\u5B83\u91CC\u9762\u5C31\u4F1A\u5728\u7B2C\u4E00\u6B21\u4FDD\u5B58\u540E\u6C38\u4E45\u6D88\u5931\uFF0C\u800C\u8FD9\u4E00\u683C\u552F\u4E00\u7684\n // \u4FDD\u62A4\u8BF4\u660E\u5C31\u662F\u5B83\u3002\u8FD9\u91CC\u6302\u5728\u9759\u6001\u7ED3\u6784\u91CC\uFF0C\u53EA\u52A0\u4E0D\u6E05\u3002\n locked ? h("p", { class: "cf-hint cf-locked" }, lockedHintOf(field)) : null,\n outside,\n input._badge ?? null,\n input._datalist ?? null,\n err,\n notice\n );\n root.append(cell);\n const read = () => {\n if (locked) return void 0;\n if (field.type === "boolean") return input.checked;\n if (field.type === "secret") {\n const v2 = input.value;\n return v2 === "" ? void 0 : v2;\n }\n const v = fromText(field, input.value);\n if (v === "" && initial === void 0) return void 0;\n return v;\n };\n rows.push({\n field,\n el: cell,\n input,\n read,\n isChanged: () => {\n const v = read();\n if (v === void 0) return false;\n return !sameValue(v, initial);\n },\n setError: (msg) => {\n err.hidden = msg === null;\n if (msg) err.textContent = msg;\n },\n snapshot: () => {\n if (resetSecret) {\n resetSecret();\n return;\n }\n initial = read();\n }\n });\n }\n return {\n rows,\n root,\n changed() {\n const out = {};\n for (const r of rows) if (r.isChanged()) out[r.field.path] = r.read();\n return out;\n },\n markError(path, msg) {\n for (const r of rows) {\n if (r.field.path === path) {\n r.setError(msg);\n return;\n }\n }\n },\n clearErrors() {\n for (const r of rows) r.setError(null);\n }\n };\n }\n\n // web-console/desktop/src/renderer/console/save-bar.ts\n function buildSaveBar(form, ctx, opts = {}) {\n const save = h("button", { class: "btn btn-primary", type: "button", id: "cfg-save" }, "\\u4FDD\\u5B58");\n const status = h("div", { class: "inline-warn", id: "cfg-status", hidden: true });\n const detail = h("div", { class: "cfg-detail" });\n const refresh = () => {\n save.disabled = Object.keys(form.changed()).length === 0;\n };\n save.disabled = true;\n form.root.addEventListener("input", refresh);\n form.root.addEventListener("change", refresh);\n const setStatus = (msg, kind) => {\n status.hidden = false;\n status.textContent = msg;\n status.style.color = kind === "err" ? "var(--red)" : kind === "ok" ? "var(--green)" : "";\n };\n save.addEventListener("click", () => {\n void (async () => {\n const blocked = opts.beforeSave?.();\n if (blocked) {\n setStatus(blocked, "err");\n return;\n }\n const payload = form.changed();\n if (Object.keys(payload).length === 0) {\n setStatus("\\u6CA1\\u6709\\u6539\\u52A8\\uFF0C\\u6CA1\\u4EC0\\u4E48\\u8981\\u4FDD\\u5B58\\u7684", "info");\n return;\n }\n save.disabled = true;\n detail.replaceChildren();\n setStatus("\\u6B63\\u5728\\u5199\\u5165\\u2026", "info");\n const r = await ctx.deps.configSet(ctx.configPath, payload);\n form.clearErrors();\n const shown = /* @__PURE__ */ new Set();\n for (const e of r.errors) {\n const hit = form.rows.some((row) => row.field.path === e.path);\n if (hit) {\n form.markError(e.path, e.error);\n shown.add(e.path);\n }\n }\n const note = typeof opts.changedNote === "function" ? opts.changedNote(r) : opts.changedNote;\n if (r.ok) {\n form.clearErrors();\n for (const row of form.rows) row.snapshot();\n refresh();\n setStatus(`\\u5DF2\\u4FDD\\u5B58\\uFF1A${r.changed.map((p) => opts.labels?.[p] ?? p).join("\\u3001") || "\\uFF08\\u65E0\\u5B57\\u6BB5\\u53D8\\u5316\\uFF09"}\\u3002${note ?? ""}`, "ok");\n } else {\n refresh();\n setStatus(`\\u4FDD\\u5B58\\u5931\\u8D25\\uFF1A${r.error ?? "\\u672A\\u77E5\\u540D\\u539F\\u56E0"}`, "err");\n }\n detail.replaceChildren(...setDetailBlocks(r, {\n shownPaths: shown,\n onMigrate: () => {\n void runMigrate();\n },\n onRestart: () => {\n ctx.actions.restart();\n setStatus("\\u6B63\\u5728\\u91CD\\u542F\\u5F15\\u64CE\\u2026", "info");\n }\n }));\n async function runMigrate() {\n setStatus("\\u6B63\\u5728\\u8FC1\\u79FB\\u2026", "info");\n const m = await ctx.deps.configMigrate(ctx.configPath);\n setStatus(m.ok ? `\\u8FC1\\u79FB\\u5B8C\\u6210\\uFF0C\\u642C\\u4E86 ${m.changed.length} \\u9879\\uFF08\\u5907\\u4EFD ${m.backup ?? "\\u65E0"}\\uFF09\\u3002\\u91CD\\u65B0\\u4FDD\\u5B58\\u4E00\\u6B21\\u4E0A\\u9762\\u90A3\\u51E0\\u9879\\u5373\\u53EF\\u3002` : `\\u8FC1\\u79FB\\u5931\\u8D25\\uFF1A${m.error ?? m.errors.map((x) => x.error).join("\\uFF1B")}`, m.ok ? "ok" : "err");\n }\n })();\n });\n return { el: h("div", { class: "cfg-savebar" }, h("div", { class: "btn-row" }, save), status, detail), refresh, setStatus };\n }\n\n // web-console/desktop/src/renderer/console/panels/general.ts\n var PINNED_ZONES = [\n "Asia/Shanghai",\n "Asia/Hong_Kong",\n "Asia/Taipei",\n "Asia/Tokyo",\n "Asia/Seoul",\n "Asia/Singapore",\n "UTC"\n ];\n function zoneSuggestions(localZone) {\n const head = [];\n if (localZone) head.push(localZone);\n for (const z of PINNED_ZONES) if (!head.includes(z)) head.push(z);\n return head.concat(ALL_ZONES.filter((z) => !head.includes(z)));\n }\n function safeLocalZone() {\n try {\n return detectZone() || "";\n } catch {\n return "";\n }\n }\n function generalChangedNote(r) {\n return r.needsRestart.length > 0 ? "" : "\\u4FDD\\u5B58\\u540E\\u5F15\\u64CE\\u4F1A\\u70ED\\u52A0\\u8F7D\\uFF0C\\u4E0D\\u7528\\u91CD\\u542F\\u3002";\n }\n function renderGeneralPanel(body, ctx) {\n const localZone = safeLocalZone();\n const fields = ctx.fields.filter((f) => f.path === "timezone" || f.path === "agents.defaults.name");\n const form = renderForm(fields, ctx.values, ctx.secrets, ctx.deps, {\n timezone: {\n suggest: zoneSuggestions(localZone),\n // \u7070\u5B57 = \u672C\u673A\u63A2\u6D4B\u503C\u3002**\u7559\u7A7A\u65F6\u8FD9\u4E00\u683C\u672C\u6765\u5C31\u662F"\u8DDF\u968F\u672C\u673A"**\uFF08\u5F15\u64CE resolveTimezone \u628A\n // \u7A7A\u4E32/\u7F3A\u5B57\u6BB5\u90FD\u5F53\u63A2\u6D4B\u672C\u673A\uFF09\uFF0C\u539F\u6765\u53EA\u5B57\u672A\u63D0\uFF0C\u7528\u6237\u770B\u7740\u7A7A\u6846\u4EE5\u4E3A"\u6CA1\u914D"\u3002\n placeholder: localZone || "\\u4F8B\\u5982 Asia/Shanghai",\n hint: `\\u51B3\\u5B9A\\u65E5\\u5386\\u3001\\u4E3B\\u52A8\\u5524\\u9192\\u3001\\u5B9A\\u65F6\\u4EFB\\u52A1\\u6309\\u54EA\\u4E2A\\u65F6\\u533A\\u7B97\\u89E6\\u53D1\\u65F6\\u523B\\u3002\\u7559\\u7A7A = \\u8DDF\\u968F\\u672C\\u673A\\u65F6\\u533A\\uFF08\\u7070\\u5B57\\u5C31\\u662F\\u63A2\\u6D4B\\u5230\\u7684\\u90A3\\u4E2A${localZone ? `\\uFF1A${localZone}` : ""}\\uFF09\\u3002\\u5217\\u8868\\u4E5F\\u53EF\\u76F4\\u63A5\\u8F93\\u5165\\u7B5B\\u9009\\uFF0C\\u4F8B\\u5982\\u8F93\\u5165 shanghai\\u3002`\n },\n "agents.defaults.name": {\n hint: "\\u52A9\\u624B\\u5728\\u5BF9\\u8BDD\\u91CC\\u81EA\\u79F0\\u7684\\u540D\\u5B57\\u3002SOUL.md \\u6B63\\u6587\\u91CC\\u7684\\u65E7\\u540D\\u5B57\\u4E0D\\u4F1A\\u8DDF\\u7740\\u6539\\u2014\\u2014\\u6539\\u5B8C\\u8DDF\\u81EA\\u5DF1\\u7684\\u52A9\\u624B\\u8BF4\\u4E00\\u58F0\\uFF0C\\u8BA9\\u5B83\\u81EA\\u5DF1\\u6539\\u3002"\n }\n });\n const tzRow = form.rows.find((r) => r.field.path === "timezone");\n if (tzRow) {\n tzRow.el.append(h(\n "div",\n { class: "btn-row" },\n h("button", {\n class: "btn",\n type: "button",\n id: "tz-follow-local",\n onclick: () => {\n const el = tzRow.input;\n el.value = "";\n el.dispatchEvent(new Event("input", { bubbles: true }));\n }\n }, localZone ? `\\u8DDF\\u968F\\u672C\\u673A\\uFF08${localZone}\\uFF09` : "\\u8DDF\\u968F\\u672C\\u673A")\n ));\n }\n const bar = buildSaveBar(form, ctx, { changedNote: generalChangedNote });\n const autoStatus = h("div", { class: "cf-hint", id: "autostart-status" });\n const autoBtn = h("button", {\n class: "btn",\n type: "button",\n id: "autostart-enable",\n onclick: () => {\n void (async () => {\n autoStatus.textContent = "\\u6B63\\u5728\\u5199\\u5165\\u542F\\u52A8\\u9879\\u2026";\n const r = await ctx.deps.autostartEnable();\n autoStatus.textContent = r.code === 0 ? `\\u5DF2\\u8BBE\\u7F6E\\u5F00\\u673A\\u81EA\\u542F\\uFF08\\u5F00\\u673A\\u8D77\\u6765\\u7684\\u662F\\u6258\\u76D8\\uFF0C\\u4E0D\\u662F\\u5F15\\u64CE\\uFF09\\u3002\\u6587\\u4EF6\\uFF1A${r.file ?? "(\\u672A\\u77E5)"}` : `\\u8BBE\\u7F6E\\u5F00\\u673A\\u81EA\\u542F\\u5931\\u8D25\\uFF1A${r.error ?? `\\u9000\\u51FA\\u7801 ${r.code}`}`;\n })();\n }\n }, "\\u8BBE\\u7F6E\\u5F00\\u673A\\u81EA\\u542F");\n body.replaceChildren(\n form.root,\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "\\u5F00\\u673A\\u81EA\\u542F"),\n h("p", { class: "page-sub" }, "\\u5F00\\u673A\\u65F6\\u81EA\\u52A8\\u628A\\u6258\\u76D8\\u62C9\\u8D77\\u6765\\uFF1B\\u5B83\\u77E5\\u9053\\u4F60\\u88C5\\u4E86\\u51E0\\u4E2A\\u5F15\\u64CE\\u5E76\\u6309\\u4E0A\\u6B21\\u7684\\u72B6\\u6001\\u62C9\\u8D77\\uFF08\\u4F60\\u4E3B\\u52A8\\u505C\\u8FC7\\u7684\\u4E0D\\u4F1A\\u88AB\\u62C9\\u8D77\\u6765\\uFF09\\u3002"),\n h("div", { class: "btn-row" }, autoBtn),\n autoStatus\n ),\n bar.el\n );\n return () => {\n };\n }\n\n // web-console/desktop/src/renderer/console/panels/identity.ts\n var NO_PERSONA = "\\u6211\\u65B0\\u9009\\u7684\\u90A3\\u4E00\\u6863";\n var SOUL_NOTE = "SOUL.md \\u6CA1\\u6709\\u52A8\\u2014\\u2014\\u60F3\\u8BA9\\u5B83\\u4E5F\\u8DDF\\u4E0A\\uFF0C\\u628A\\u4E0B\\u9762\\u8FD9\\u6BB5\\u8BDD\\u7C98\\u7ED9\\u4F60\\u7684\\u52A9\\u624B\\u3002";\n var noteOf = (r, staleWhy) => {\n const stale = staleWhy === null ? "" : `\\uFF08\\u6CA1\\u80FD\\u73B0\\u8BFB config\\uFF1A${staleWhy}\\uFF1B\\u540D\\u5B57\\u4E0E\\u4EBA\\u8BBE\\u7528\\u7684\\u662F\\u6253\\u5F00\\u8BBE\\u7F6E\\u9875\\u65F6\\u90A3\\u4EFD\\uFF09`;\n if (!r.ok) {\n return `\\u4EBA\\u8BBE\\u5DF2\\u6539\\uFF0C\\u4F46\\u914D\\u5957\\u4EF6\\uFF08\\u60C5\\u7EEA\\u8868 / \\u5185\\u5FC3\\u620F\\u63D0\\u793A\\u8BCD\\uFF09\\u6CA1\\u6362\\u6210\\u529F\\uFF1A${r.error ?? "\\u672A\\u77E5\\u539F\\u56E0"}\\u3002${stale}${SOUL_NOTE}`;\n }\n const extra = r.warnings.length > 0 ? `\\uFF1B${r.warnings.join("\\uFF1B")}` : "";\n return r.created.length > 0 ? `\\u4EBA\\u8BBE\\u5DF2\\u6539\\uFF0C\\u56DB\\u4E2A\\u6863\\u4F4D\\u7684\\u914D\\u5957\\u4EF6\\u5DF2\\u94FA\\u597D\\uFF08\\u65B0\\u589E ${r.created.length} \\u4EFD\\uFF09${extra}\\u3002${stale}${SOUL_NOTE}` : `\\u4EBA\\u8BBE\\u5DF2\\u6539\\uFF0C\\u914D\\u5957\\u4EF6\\u5DF2\\u94FA\\u597D\\uFF08\\u6CA1\\u6709\\u65B0\\u589E\\uFF0C\\u4E4B\\u524D\\u5C31\\u6709\\u4E86\\uFF09${extra}\\u3002${stale}${SOUL_NOTE}`;\n };\n var hintText = (persona) => `\\u8BF7\\u628A\\u4EBA\\u8BBE\\uFF08SOUL.md\\uFF09\\u6539\\u6210 ${persona} \\u7684\\u98CE\\u683C\\uFF1A\\u5148\\u8BFB\\u4E00\\u904D\\u73B0\\u5728\\u7684 SOUL.md\\uFF0C\\u6309\\u4F60\\u5BF9\\u6211\\u7684\\u4E86\\u89E3\\u91CD\\u5199\\u5B83\\u2014\\u2014\\u4FDD\\u7559\\u6211\\u4EEC\\u4E4B\\u95F4\\u5DF2\\u7ECF\\u6709\\u8FC7\\u7684\\u7EA6\\u5B9A\\uFF0C\\u4E0D\\u8981\\u4ECE\\u6A21\\u677F\\u91CD\\u6284\\u4E00\\u4EFD\\u3002\\u6539\\u5B8C\\u544A\\u8BC9\\u6211\\u4F60\\u6539\\u4E86\\u4EC0\\u4E48\\u3002`;\n function renderIdentityPanel(body, ctx) {\n const fields = ctx.fields.filter((f) => f.path === "agents.defaults.persona");\n const saveOpts = { changedNote: `\\u4EBA\\u8BBE\\u5DF2\\u6539\\u3002${SOUL_NOTE}` };\n const textOf = (values, p) => {\n const v = pickPath(values, p);\n return typeof v === "string" ? v : "";\n };\n const deps = {\n ...ctx.deps,\n configSet: async (configPath, values) => {\n let cur = ctx.values;\n let staleWhy = null;\n try {\n const fresh = await ctx.deps.configGet(configPath);\n if (fresh.ok) cur = fresh.values;\n else staleWhy = fresh.error ?? "\\u672A\\u77E5\\u539F\\u56E0";\n } catch (e) {\n staleWhy = e instanceof Error ? e.message : String(e);\n }\n let r;\n try {\n r = await ctx.deps.scaffoldPersonas(\n ctx.stateDir,\n textOf(cur, "agents.defaults.name"),\n textOf(cur, "agents.defaults.persona")\n );\n } catch (e) {\n r = { ok: false, created: [], skipped: [], warnings: [], error: e instanceof Error ? e.message : String(e) };\n }\n saveOpts.changedNote = noteOf(r, staleWhy);\n return ctx.deps.configSet(configPath, values);\n }\n };\n const form = renderForm(fields, ctx.values, ctx.secrets, deps, {\n "agents.defaults.persona": {\n hint: "\\u53EA\\u6539\\u8FD9\\u4E00\\u683C\\uFF1A\\u5F15\\u64CE\\u4F1A\\u6309\\u65B0\\u7684\\u4EBA\\u8BBE\\u628A\\u60C5\\u7EEA\\u8868\\u548C\\u5185\\u5FC3\\u620F\\u63D0\\u793A\\u8BCD\\u6362\\u8FC7\\u53BB\\uFF08workspace/personas/<\\u4EBA\\u8BBE>/\\uFF09\\u3002SOUL.md \\u4E0D\\u52A8\\u2014\\u2014\\u90A3\\u662F\\u4F60\\u548C\\u4F60\\u52A9\\u624B\\u4E4B\\u95F4\\u7684\\u4E8B\\u3002"\n }\n });\n const bar = buildSaveBar(form, { ...ctx, deps }, saveOpts);\n const hintBox = h("textarea", { id: "identity-hint", rows: 4, readonly: true, style: "width:100%" });\n const setHint = (t) => {\n hintBox.value = t;\n hintBox.textContent = t;\n };\n const syncHint = () => {\n const row = form.rows[0];\n const picked = row ? row.input.value.trim() : "";\n setHint(hintText(picked || NO_PERSONA));\n };\n syncHint();\n form.root.addEventListener("input", syncHint);\n form.root.addEventListener("change", syncHint);\n const copyBtn = h("button", {\n class: "btn",\n type: "button",\n id: "identity-copy-hint",\n onclick: () => {\n void (async () => {\n hintBox.select();\n try {\n const copied = document.execCommand("copy");\n copyBtn.textContent = copied ? "\\u5DF2\\u590D\\u5236" : "\\u590D\\u5236\\u5931\\u8D25\\uFF0C\\u8BF7\\u6309 Ctrl/Cmd+C";\n if (copied) setTimeout(() => {\n copyBtn.textContent = "\\u590D\\u5236\\u8FD9\\u6BB5\\u8BDD";\n }, 1500);\n } catch {\n copyBtn.textContent = "\\u590D\\u5236\\u5931\\u8D25\\uFF0C\\u8BF7\\u6309 Ctrl/Cmd+C";\n }\n })();\n }\n }, "\\u590D\\u5236\\u8FD9\\u6BB5\\u8BDD");\n body.replaceChildren(\n form.root,\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "SOUL.md \\u4E0D\\u4F1A\\u81EA\\u52A8\\u6539"),\n h(\n "p",\n { class: "page-sub" },\n "\\u4EBA\\u8BBE\\u53D8\\u4E86\\uFF0C\\u4F46 SOUL.md \\u91CC\\u53EF\\u80FD\\u8FD8\\u5199\\u7740\\u65E7\\u7684\\u4EBA\\u8BBE\\u548C\\u65E7\\u7684\\u540D\\u5B57\\u3002\\u6211\\u4EEC\\u4E0D\\u4F1A\\u66FF\\u4F60\\u6539\\u5B83\\u2014\\u2014",\n "\\u90A3\\u662F\\u4F60\\u548C\\u4F60\\u52A9\\u624B\\u4E4B\\u95F4\\u7684\\u4E8B\\uFF0C\\u4EE3\\u6539\\u4F1A\\u628A\\u4F60\\u4EEC\\u5DF2\\u7ECF\\u5199\\u8FC7\\u7684\\u4E1C\\u897F\\u51B2\\u6389\\u3002\\u628A\\u4E0B\\u9762\\u8FD9\\u6BB5\\u7C98\\u7ED9\\u4F60\\u7684\\u52A9\\u624B\\u5C31\\u884C\\uFF1A"\n ),\n hintBox,\n h("div", { class: "btn-row" }, copyBtn)\n ),\n bar.el\n );\n return () => {\n };\n }\n\n // web-console/desktop/src/renderer/console/panels/model.ts\n var PLAIN_FIELDS = [\n "agents.defaults.model.primary",\n "agents.defaults.model.vision",\n // \u26A0\uFE0F \u964D\u7EA7\u94FE\u4E24\u9879**\u4E0D\u5728\u8FD9\u91CC**\uFF1A\u5B83\u4EEC\u662F\u6570\u7EC4\uFF0C\u8D70\u4E0B\u9762 renderChainEditor \u81EA\u5DF1\u7684\u7F16\u8F91\u5668\u3002\n // \uFF08\u66FE\u7ECF\u628A\u5B83\u4EEC\u4E22\u7ED9 renderForm \u2014\u2014 json \u5B57\u6BB5\u5728\u90A3\u91CC\u53EA\u8BFB\uFF08\u7EAA\u5F8B 4\uFF09\uFF0C\u4E8E\u662F\u9875\u9762\u4E0A\u51FA\u73B0\u4E00\u4E2A\n // **\u770B\u7740\u80FD\u586B\u3001\u5176\u5B9E\u4E0D\u80FD**\u7684\u7A7A\u6846\uFF0C\u8FD8\u53E0\u4E86\u4E24\u53E5"\u8981\u6539\u8BF7\u7528\u4E13\u7528\u9762\u677F"\u800C\u90A3\u4E2A\u9762\u677F\u5E76\u4E0D\u5B58\u5728\u3002\n // \u7FC0\u54E5 0927 \u6307\u51FA"\u7528\u6237\u5565\u4F53\u9A8C"\uFF0C\u8FD9\u91CC\u662F\u4FEE\u3002\uFF09\n "tools.my_eyes.model",\n "tools.tavily.apiKey",\n "api.port"\n ];\n function renderChainEditor(path, label, hint, ctx, bar) {\n const cur = pickPath(ctx.values, path);\n const initial = Array.isArray(cur) ? cur.map((x) => String(x)) : [];\n const ta = h("textarea", {\n rows: "3",\n style: "width:100%; font-family: inherit",\n placeholder: "\\u4E00\\u884C\\u4E00\\u4E2A\\uFF0C\\u4F8B\\u5982\\uFF1A\\n7yi/engine7-free\\nzai-anthropic/glm-5.3"\n });\n ta.value = initial.join("\\n");\n const detail = h("div", { class: "cfg-detail" });\n const btn = h("button", {\n class: "btn",\n type: "button",\n onclick: () => {\n void (async () => {\n const next = ta.value.split("\\n").map((s) => s.trim()).filter((s) => s !== "");\n if (JSON.stringify(next) === JSON.stringify(initial)) {\n bar.setStatus("\\u8FD9\\u4E00\\u683C\\u6CA1\\u6539\\u52A8", "info");\n return;\n }\n btn.disabled = true;\n detail.replaceChildren();\n const r = await ctx.deps.configSet(ctx.configPath, { [path]: next });\n btn.disabled = false;\n detail.replaceChildren(...setDetailBlocks(r));\n if (r.ok) bar.setStatus(next.length === 0 ? "\\u5DF2\\u4FDD\\u5B58\\uFF1A\\u964D\\u7EA7\\u94FE\\u5DF2\\u6E05\\u7A7A\\uFF08\\u4E3B\\u6A21\\u578B\\u6302\\u4E86\\u4E0D\\u518D\\u81EA\\u52A8\\u6362\\uFF09" : `\\u5DF2\\u4FDD\\u5B58\\uFF1A\\u964D\\u7EA7\\u94FE ${next.length} \\u6863`, "ok");\n })();\n }\n }, "\\u4FDD\\u5B58\\u8FD9\\u4E00\\u683C");\n return h(\n "div",\n { class: "cf-field", "data-path": path },\n h("label", {}, label, h("span", { class: "cf-path" }, path)),\n h("p", { class: "cf-hint" }, hint),\n ta,\n h("div", { class: "btn-row" }, btn),\n detail\n );\n }\n function renderModelPanel(body, ctx) {\n const fields = ctx.fields.filter((f) => PLAIN_FIELDS.includes(f.path));\n const providers = listProviders(pickPath(ctx.values, "models.providers"));\n const suggestions = providers.flatMap((p) => p.models.map((m) => `${p.id}/${m}`));\n const form = renderForm(fields, ctx.values, ctx.secrets, ctx.deps, {\n "agents.defaults.model.primary": {\n modelOptions: suggestions,\n hint: "\\u9009\\u62E9\\u5DF2\\u914D\\u7F6E\\u7684\\u6A21\\u578B\\uFF1B\\u5217\\u8868\\u91CC\\u6CA1\\u6709\\u5C31\\u9009\\u300C\\u81EA\\u5B9A\\u4E49\\u2026\\u300D\\uFF0C\\u586B\\u5199 `<provider \\u540D>/<\\u6A21\\u578B id>`\\u3002\\u4FDD\\u5B58\\u65F6\\u4F1A\\u68C0\\u67E5\\u6A21\\u578B\\u914D\\u7F6E\\u3002"\n },\n "agents.defaults.model.vision": { modelOptions: suggestions, modelEmptyLabel: "\\u4E0D\\u542F\\u7528\\u89C6\\u89C9", hint: "\\u9009\\u62E9\\u652F\\u6301\\u56FE\\u7247\\u7684\\u6A21\\u578B\\uFF0C\\u6216\\u9009\\u300C\\u4E0D\\u542F\\u7528\\u89C6\\u89C9\\u300D\\u3002\\u5165\\u7AD9\\u56FE\\u7247\\u4F1A\\u8D70 tools.my_eyes.model \\u90A3\\u6761\\u8DEF\\u3002" },\n "tools.my_eyes.model": { modelOptions: suggestions, hint: "\\u300C\\u770B\\u56FE\\u300D\\u5DE5\\u5177\\u7528\\u7684\\u6A21\\u578B\\uFF1B\\u5217\\u8868\\u91CC\\u6CA1\\u6709\\u5C31\\u9009\\u300C\\u81EA\\u5B9A\\u4E49\\u2026\\u300D\\u586B\\u5199\\u3002" },\n "tools.tavily.apiKey": { hint: "\\u6709\\u81EA\\u5DF1\\u914D\\u7684 key \\u5C31\\u7528\\u5B83\\uFF1B\\u7559\\u7A7A\\u5219\\u7528\\u514D\\u8D39\\u5171\\u4EAB\\u989D\\u5EA6\\uFF08\\u53EF\\u80FD\\u5DF2\\u7528\\u5C3D\\uFF09\\u3002" },\n "api.port": { hint: "\\u5F15\\u64CE\\u7684 HTTP API \\u76D1\\u542C\\u7AEF\\u53E3\\u3002\\u6539\\u5B8C\\u5FC5\\u987B\\u91CD\\u542F\\u5F15\\u64CE\\u3002" }\n });\n const bar = buildSaveBar(form, ctx, { changedNote: "" });\n const rows = providers.map((p) => {\n const baseUrl = h("input", { type: "text", value: p.baseUrl, style: "width:100%" });\n const apiKey = h("input", {\n type: "password",\n value: "",\n autocomplete: "new-password",\n placeholder: p.keyMasked ? "\\uFF08config \\u91CC\\u662F\\u660E\\u6587\\u3001\\u88AB\\u5F15\\u64CE\\u906E\\u4F4F\\u4E86\\uFF09" : `\\u7559\\u7A7A\\u4E0D\\u6539\\uFF08\\u5F53\\u524D\\u662F ${p.apiKeyRef}\\uFF09`,\n style: "width:100%"\n });\n const note = h("div", { class: "cf-hint" }, p.keyMasked ? "\\u26A0\\uFE0F \\u8FD9\\u4E2A provider \\u7684 key \\u5728 config \\u91CC\\u662F\\u660E\\u6587\\uFF08\\u5F15\\u64CE\\u8BFB\\u4E0D\\u5230\\u5B83\\u7684\\u503C\\uFF09\\u3002\\u53EA\\u6539 baseUrl \\u4F1A\\u628A\\u8FD9\\u628A key \\u4ECE config \\u91CC\\u53BB\\u6389\\u2014\\u2014\\u60F3\\u7559\\u7740\\u5C31\\u73B0\\u5728\\u91CD\\u586B\\u4E00\\u6B21\\uFF08\\u4F1A\\u539F\\u6837\\u5199\\u56DE config\\u3001\\u4ECD\\u662F\\u660E\\u6587\\uFF1A\\u8FD9\\u4E00\\u683C\\u662F json \\u5B57\\u6BB5\\uFF0C\\u5F15\\u64CE\\u7684 secrets \\u673A\\u5236\\u7BA1\\u4E0D\\u5230\\u5B83\\uFF09\\u3002" : "");\n const detail = h("div", { class: "cfg-detail" });\n const save = h("button", {\n class: "btn",\n type: "button",\n onclick: () => {\n void (async () => {\n const patch = {};\n if (baseUrl.value !== p.baseUrl) patch.baseUrl = baseUrl.value;\n if (apiKey.value !== "") patch.apiKey = apiKey.value;\n if (patch.baseUrl === void 0 && patch.apiKey === void 0) {\n bar.setStatus("\\u8FD9\\u4E2A provider \\u6CA1\\u6539\\u52A8", "info");\n return;\n }\n const merged = mergeProvider(pickPath(ctx.values, "models.providers"), p.id, patch);\n if (merged.othersMasked.length > 0) {\n bar.setStatus(`\\u6CA1\\u6709\\u63D0\\u4EA4\\uFF1A${merged.othersMasked.join("\\u3001")} \\u7684 key \\u5728 config \\u91CC\\u662F\\u660E\\u6587\\uFF08\\u88AB\\u5F15\\u64CE\\u906E\\u4F4F\\u4E86\\uFF09\\uFF0C\\u6574\\u4EFD models.providers \\u4F1A\\u88AB\\u5F15\\u64CE\\u62D2\\u6389\\u3002\\u8981\\u6539\\u8FD9\\u4E00\\u884C\\uFF0C\\u5148\\u5728 config \\u91CC\\u628A\\u90A3\\u51E0\\u628A key \\u6362\\u6210 env: \\u5F15\\u7528\\uFF08\\u8FD9\\u4E00\\u683C\\u662F json \\u5B57\\u6BB5\\uFF0C\\u6258\\u76D8\\u5199\\u4E0D\\u51FA\\u5F15\\u7528\\uFF09\\u3002`, "err");\n return;\n }\n if (merged.keyDropped && !window.confirm(\n `\\u53EA\\u6539 baseUrl \\u4F1A\\u628A ${p.id} \\u90A3\\u628A\\u660E\\u6587 key \\u4ECE config \\u91CC\\u53BB\\u6389\\uFF08\\u5F15\\u64CE\\u7684\\u8131\\u654F\\u6807\\u8BB0\\u4F1A\\u88AB\\u62D2\\u7EDD\\u56DE\\u4F20\\uFF09\\u3002\n\\u8981\\u4FDD\\u7559\\u5B83\\uFF0C\\u8BF7\\u5148\\u5728\\u4E0A\\u9762\\u90A3\\u628A key \\u91CC\\u91CD\\u586B\\u4E00\\u6B21\\uFF08\\u4F1A\\u539F\\u6837\\u5199\\u56DE config\\uFF0C\\u4ECD\\u662F\\u660E\\u6587\\uFF09\\u3002\n\n\\u4ECD\\u7136\\u7EE7\\u7EED\\uFF1F`\n )) return;\n save.disabled = true;\n detail.replaceChildren();\n const r = await ctx.deps.configSet(ctx.configPath, { "models.providers": merged.value });\n save.disabled = false;\n detail.replaceChildren(...setDetailBlocks(r));\n if (r.ok) {\n bar.setStatus(`\\u5DF2\\u4FDD\\u5B58\\uFF1A${p.id} \\u7684 ${patch.apiKey ? "key \\u4E0E " : ""}baseUrl\\u3002\\u8FD9\\u4E00\\u884C\\u7684\\u663E\\u793A\\u505C\\u5728\\u65E7\\u503C\\u4E0A\\u2014\\u2014\\u5237\\u65B0\\u63A7\\u5236\\u53F0\\uFF08\\u91CD\\u5F00\\u8BBE\\u7F6E\\u9875\\uFF09\\u540E\\u66F4\\u65B0\\u3002`, "ok");\n } else {\n bar.setStatus(`\\u4FDD\\u5B58\\u5931\\u8D25\\uFF1A${r.error ?? ""} ${r.errors.map((e) => e.error).join("\\uFF1B")}`, "err");\n }\n })();\n }\n }, "\\u4FDD\\u5B58\\u8FD9\\u4E00\\u884C");\n return h(\n "div",\n { class: "provider-row", "data-provider": p.id },\n h(\n "div",\n { class: "cf-field" },\n h("label", {}, `${p.id}\\u3000`, h("span", { class: "cf-path" }, p.apiKeyRef)),\n h("div", {}, h("label", { class: "cf-hint" }, "baseUrl"), baseUrl),\n h("div", {}, h("label", { class: "cf-hint" }, "API Key"), apiKey),\n note,\n h("div", { class: "btn-row" }, save)\n ),\n detail\n );\n });\n body.replaceChildren(\n form.root,\n // \u964D\u7EA7\u94FE**\u5355\u72EC\u4E00\u7EC4\u3001\u53EF\u7F16\u8F91**\uFF080927\uFF09\u3002\u4EE5\u524D\u5B83\u6DF7\u5728 form.root \u91CC\u5F53\u53EA\u8BFB\u7A7A\u6846\uFF0C\n // \u9875\u9762\u4E0A\u662F\u4E2A"\u770B\u7740\u80FD\u586B\u5176\u5B9E\u4E0D\u80FD"\u7684\u63A7\u4EF6\uFF0C\u8FD8\u6307\u5411\u4E00\u4E2A\u4E0D\u5B58\u5728\u7684"\u4E13\u7528\u9762\u677F"\u3002\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "\\u6A21\\u578B\\u964D\\u7EA7\\u94FE"),\n h("p", { class: "page-sub" }, "\\u4E3B\\u6A21\\u578B\\u6216\\u770B\\u56FE\\u6A21\\u578B\\u4E0D\\u53EF\\u7528\\u65F6\\uFF0C\\u6309\\u987A\\u5E8F\\u6362\\u4E0B\\u4E00\\u6863\\u3002\\u7559\\u7A7A = \\u4E0D\\u964D\\u7EA7\\u3002"),\n renderChainEditor(\n "agents.defaults.model.fallbacks",\n "\\u4E3B\\u6A21\\u578B\\u964D\\u7EA7\\u94FE",\n "\\u4E00\\u884C\\u4E00\\u4E2A\\uFF0C\\u5199\\u6210 `<provider \\u540D>/<\\u6A21\\u578B id>`\\uFF08\\u4F8B\\uFF1A7yi/engine7-free\\uFF09\\u3002\\u987A\\u5E8F\\u5C31\\u662F\\u964D\\u7EA7\\u987A\\u5E8F\\u3002",\n ctx,\n bar\n ),\n renderChainEditor(\n "agents.defaults.model.visionFallbacks",\n "\\u770B\\u56FE\\u6A21\\u578B\\u964D\\u7EA7\\u94FE",\n "\\u540C\\u4E0A\\uFF0C\\u7528\\u6765\\u964D\\u7EA7\\u300C\\u89C6\\u89C9\\u6A21\\u578B\\u300D\\u90A3\\u4E00\\u683C\\u3002",\n ctx,\n bar\n )\n ),\n // \u26A0\uFE0F \u6A21\u578B\u670D\u52A1\u5546\u90A3\u4E00\u6574\u6BB5**\u5DF2\u64A4\u4E0B**\uFF08\u7FC0\u54E5 0927\uFF1A\u300C\u529F\u80FD\u53C8\u505A\u4E0D\u5168\u4E0D\u80FD\u7528\uFF0C\u771F\u6539\u4E86\u8BEF\u5BFC\u7528\u6237\uFF0C\n // \u4E0D\u80FD\u7528\u4E86\u9A82\u4F60\u300D\uFF09\u3002\u5B83\u73B0\u5728\u8FD8**\u4F1A\u4E3B\u52A8\u5F04\u574F\u914D\u7F6E**\uFF0C\u4E09\u4EF6\u4E8B\u53E0\u5728\u4E00\u8D77\uFF1A\n // \u2460 \u53EA\u80FD\u6539\u5DF2\u6709 provider \u7684 baseUrl / \u91CD\u586B key \u2014\u2014 \u52A0\u65B0\u670D\u52A1\u5546\u3001\u6539\u6A21\u578B\u8868\u90FD\u5F97\u624B\u6539 JSON\n // \u2461 \u91CD\u586B\u7684 key **\u660E\u6587\u5199\u56DE config**\uFF08json \u5B57\u6BB5\u6CA1\u6709 secrets \u901A\u8DEF\uFF0C\u5F15\u64CE\u7684 type:\'secret\'\n // \u53EA\u8986\u76D6 4 \u4E2A\u5B57\u6BB5\uFF0Cmodels.providers.*.apiKey \u4E0D\u5728\u5176\u4E2D\uFF09\n // \u2462 \u6539 baseUrl \u4F1A\u8BA9\u6574\u6279\u88AB\u5F15\u64CE\u62D2\uFF08findMaskedCredentials\uFF1A\u6574\u4EFD\u91CC\u53EA\u8981\u8FD8\u5269\u4E00\u4E2A\u88AB\u906E\u6210\n // null \u7684 apiKey\uFF0C**\u6574\u6279**\u90FD\u88AB\u62D2\uFF09\u2014\u2014 \u5B9E\u673A\u590D\u73B0\u8FC7\uFF0C\u4EA4\u63A5\u6587\u6863 A2\n // "\u770B\u7740\u80FD\u7528\u3001\u5B9E\u9645\u4F1A\u5F04\u574F\u914D\u7F6E" \u6BD4\u6CA1\u6709\u66F4\u7CDF\u3002\n //\n // **\u7FC0\u54E5 0927 \u5B9A\u7684\u65B9\u5411\u662F\u300C\u8FD9\u4E2A\u6CA1\u5FC5\u8981\u300D\uFF0C\u4E0D\u662F\u300C\u5F85\u8865\u5168\u300D**\uFF1A\n // \xB7 \u6362 key \u5927\u4E0D\u4E86\u8BA9\u7528\u6237\u81EA\u5DF1\u7F16\u8F91 config\uFF08`models.providers` \u662F\u7ED9\u7528\u6237\u770B\u7684 JSON\uFF0C\n // \u4E0D\u662F\u5FC5\u987B\u6709\u4E2A UI\uFF09\n // \xB7 \u5C0F\u767D\u7528\u6237\u7684\u51FA\u53E3\u5728\u4E2D\u8F6C\u7AD9\uFF1A**\u514D\u8D39\u989D\u5EA6\u4E0D\u591F\u5C31\u4E70\u79EF\u5206** \u2014\u2014 \u90A3\u624D\u662F\u8FD9\u6761\u4EA7\u54C1\u7EBF\n // \u7684\u5546\u4E1A\u8DEF\u5F84\uFF0C\u800C\u4E0D\u662F\u628A provider \u7F16\u8F91\u5668\u505A\u5168\n // \u6240\u4EE5\u8FD9\u91CC**\u4E0D\u8981**\u7406\u89E3\u6210"\u7B49\u5F15\u64CE\u8865\u597D secrets \u5C31\u6062\u590D"\uFF1B\u5B83\u6CA1\u6709\u6392\u671F\u3002\n // \uFF08\u771F\u8981\u505A\u7684\u8BDD\uFF0C\u524D\u7F6E\u4ECD\u662F\u5F15\u64CE\u4FA7\u90A3\u6761 secrets \u8986\u76D6\u9762 \u2014\u2014 \u89C1 0926 \u4EA4\u63A5\u6587\u6863 A1/A2/A3\u3002\uFF09\n //\n // \u4EE3\u7801\u4E0D\u5220\u4F46\u4E5F\u4E0D\u5F53\u534A\u6210\u54C1\u7559\u7740\uFF1A`rows` \u4ECD\u7B97\u7740\uFF0C\u6CE8\u91CA\u6389\u7684\u8FD9\u4E00\u5757\u662F**\u793A\u4F8B**\uFF0C\n // \u771F\u8981\u6062\u590D\u8BF7\u8FDE e2e \u90A3\u4E09\u4E2A\u7EC4\u4E00\u8D77\u6062\u590D\uFF08\u5B83\u4EEC\u7684\u65AD\u8A00\u5DF2\u968F\u8FD9\u6BB5\u64A4\u4E0B\u800C\u5220\u9664\uFF09\u3002\n // \u5E95\u5C42\u903B\u8F91\u7684\u8986\u76D6\u6CA1\u4E22\uFF08smoke-main \u91CC mergeProvider x24 \u4ECD\u5728\u8DD1\uFF09\u3002\n // h(\'section\', { class: \'settings-group\' },\n // h(\'h3\', {}, \'\u6A21\u578B\u670D\u52A1\u5546\uFF08models.providers\uFF09\'),\n // h(\'p\', { class: \'page-sub\' }, \'\u2026\'),\n // ...rows,\n // ),\n bar.el\n );\n return () => {\n };\n }\n\n // web-console/desktop/src/renderer/console/panels/voice.ts\n var VOICE_WARNING_MARK = \'"voice-config"\';\n var VOICE_WARNING_NOTE = "\\u8FD9\\u6761\\u5728\\u9884\\u671F\\u4E4B\\u5185\\uFF1A\\u53D1\\u8BED\\u97F3\\u6761\\u8BFB\\u7684\\u5C31\\u662F config \\u91CC\\u8FD9\\u4E00\\u4EFD\\uFF0C\\u4E0D\\u4F9D\\u8D56\\u5F15\\u64CE\\u90A3\\u6761\\u8054\\u52A8\\u3002";\n var PROVIDER_TEXT = {\n relay: "relay\\uFF087yi \\u4E2D\\u8F6C\\u7AD9\\uFF0C\\u514D\\u8D39\\u6863\\u9ED8\\u8BA4\\uFF09",\n cosyvoice: "cosyvoice\\uFF08\\u767E\\u70BC\\u4E91\\u7AEF\\uFF09",\n "qwen3-3060": "qwen3-3060\\uFF08\\u672C\\u5730\\u670D\\u52A1\\uFF09",\n gptsovits: "gptsovits\\uFF08\\u672C\\u5730\\u514B\\u9686\\uFF09",\n edge: "edge-tts\\uFF08\\u515C\\u5E95\\uFF0C\\u96F6\\u914D\\u7F6E\\uFF09"\n };\n var VOICE_TEXT = {\n "Chinese (Mandarin)_Warm_Girl": "\\u6E29\\u6696\\u5973\\u5B69",\n "Chinese (Mandarin)_Crisp_Girl": "\\u6E05\\u8106\\u5973\\u5B69",\n "Chinese (Mandarin)_Soft_Girl": "\\u8F7B\\u67D4\\u5973\\u5B69",\n "Chinese (Mandarin)_Gentle_Youth": "\\u6E29\\u6DA6\\u9752\\u5E74",\n "Chinese (Mandarin)_Unrestrained_Young_Man": "\\u4E0D\\u7F81\\u9752\\u5E74",\n "Chinese (Mandarin)_Southern_Young_Man": "\\u5357\\u65B9\\u9752\\u5E74"\n };\n function renderVoicePanel(body, ctx) {\n const cur = pickPath(ctx.values, "tools.my_voice") ?? {};\n const internal = ctx.internalMode === true;\n const voiceField = ctx.fields.find((f) => f.path === "tools.my_voice");\n const vschema = voiceSchemaOf(voiceField, internal);\n const str = (k) => typeof cur[k] === "string" ? String(cur[k]) : "";\n const status = h("div", { class: "inline-warn", id: "cfg-status", hidden: true });\n const detail = h("div", { class: "cfg-detail" });\n const save = h("button", { class: "btn btn-primary", type: "button", id: "cfg-save" }, "\\u4FDD\\u5B58");\n const setStatus = (m, k) => {\n status.hidden = false;\n status.textContent = m;\n status.style.color = k === "err" ? "var(--red)" : k === "ok" ? "var(--green)" : "";\n };\n const curProvider = str("provider");\n const knownIds = vschema ? vschema.providers : [];\n const isKnownProvider = (v) => knownIds.includes(v);\n const providerOpts = knownIds.map((id) => h("option", { value: id, selected: id === (curProvider || "edge") }, PROVIDER_TEXT[id] ?? id));\n if (curProvider && !isKnownProvider(curProvider)) {\n providerOpts.unshift(h(\n "option",\n { value: curProvider, selected: true },\n `${curProvider}\\uFF08\\u5F53\\u524D\\u503C\\uFF0C\\u6258\\u76D8\\u4E0D\\u8BA4\\u8BC6\\uFF1A\\u5F15\\u64CE\\u8FD9\\u5F20\\u6E05\\u5355\\u91CC\\u6CA1\\u6709\\u5B83\\uFF09`\n ));\n }\n const provider = h("select", { id: "voice-provider" }, ...providerOpts);\n const mkInput = (id, key, placeholder = "") => h("input", { type: "text", id, value: str(key), placeholder });\n const url = mkInput("voice-url", "url", "http://127.0.0.1:18888");\n const voiceBox = h("div", { class: "cf-voice-box" });\n let voiceCtrl = mkInput("voice-voice", "voice", "");\n const rebuildVoiceCtrl = () => {\n const prev = voiceCtrl.value;\n const opts = voiceOptionsOf(voiceField, provider.value);\n if (opts) {\n const list = [...opts];\n if (prev && !list.includes(prev)) list.unshift(prev);\n voiceCtrl = h(\n "select",\n { id: "voice-voice" },\n ...list.map((o) => h("option", { value: o, selected: o === prev }, VOICE_TEXT[o] ?? o))\n );\n } else {\n voiceCtrl = mkInput("voice-voice", "voice", "\\u97F3\\u8272\\u540D\\uFF08\\u672C\\u5F15\\u64CE\\u6CA1\\u6709\\u6E05\\u5355\\uFF0C\\u9700\\u624B\\u586B ID\\uFF09");\n voiceCtrl.value = prev;\n }\n voiceCtrl.addEventListener("input", () => refreshSave());\n voiceCtrl.addEventListener("change", () => refreshSave());\n voiceBox.replaceChildren(voiceCtrl);\n };\n rebuildVoiceCtrl();\n const lang = mkInput("voice-lang", "lang", "Chinese");\n const model = mkInput("voice-model", "model", "cosyvoice-v1");\n const workspaceId = mkInput("voice-workspace", "workspaceId", "\\u767E\\u70BC workspace\\uFF08\\u53EF\\u7559\\u7A7A\\uFF09");\n const instruction = mkInput("voice-instruction", "instruction", "\\u98CE\\u683C\\u6307\\u4EE4\\uFF08\\u53EF\\u7559\\u7A7A\\uFF09");\n const pythonPath = mkInput("voice-python", "pythonPath", "python \\u53EF\\u6267\\u884C\\u6587\\u4EF6\\uFF08\\u53EF\\u7559\\u7A7A\\u8D70\\u9ED8\\u8BA4\\uFF09");\n const internalRow = (id, label, input, key, hint = null) => internal ? fieldRow(id, label, input, key, hint) : null;\n const relayProviderId = internal ? mkInput("voice-relay-provider", "relayProviderId", "7yi") : null;\n const relayModel = internal ? mkInput("voice-relay-model", "relayModel", "engine7-tts") : null;\n const billingProviderId = internal ? mkInput("voice-billing-provider", "billingProviderId", "\\uFF08\\u7559\\u7A7A = \\u672A\\u542F\\u7528\\uFF09") : null;\n const billingModel = internal ? mkInput("voice-billing-model", "billingModel", "engine7-tts") : null;\n let billingModeSel = null;\n if (internal) {\n const choices = voiceField?.knownValues?.billingMode;\n const curMode = str("billingMode") || "off";\n if (Array.isArray(choices) && choices.length > 0) {\n const opts = [...choices];\n if (!opts.includes(curMode)) opts.unshift(curMode);\n billingModeSel = h(\n "select",\n { id: "voice-billing-mode" },\n ...opts.map((o) => h("option", { value: o, selected: o === curMode }, o))\n );\n } else {\n billingModeSel = mkInput("voice-billing-mode", "billingMode", "off");\n }\n }\n const keyNow = cur.apiKey;\n const keyMasked = keyNow === null;\n const apiKey = h("input", {\n type: "password",\n id: "voice-apikey",\n value: "",\n autocomplete: "new-password",\n placeholder: keyMasked ? "\\uFF08config \\u91CC\\u662F\\u660E\\u6587\\u3001\\u88AB\\u5F15\\u64CE\\u906E\\u4F4F\\u4E86 \\u2014\\u2014 \\u91CD\\u586B\\u4E00\\u6B21\\u4F1A\\u539F\\u6837\\u5199\\u56DE\\u660E\\u6587\\uFF09" : typeof keyNow === "string" && keyNow ? `\\u7559\\u7A7A\\u4E0D\\u6539\\uFF08\\u5F53\\u524D\\u662F ${keyNow}\\uFF09` : "\\u586B\\u4E00\\u4E2A\\u503C"\n });\n const keyNote = h("div", { class: "cf-hint", id: "voice-key-note" }, keyMasked ? "\\u26A0\\uFE0F \\u8FD9\\u628A key \\u5728 config \\u91CC\\u5B58\\u7684\\u662F\\u660E\\u6587\\uFF1Aconfig get \\u4F1A\\u628A\\u5B83\\u906E\\u6210 null \\u2014\\u2014 \\u8BFB\\u4E0D\\u56DE\\u6765\\uFF0C\\u4E5F\\u4E0D\\u80FD\\u539F\\u6837\\u63D0\\u4EA4\\u3002\\u4FDD\\u5B58\\u4EFB\\u4F55\\u6539\\u52A8\\uFF08\\u54EA\\u6015\\u53EA\\u6539\\u97F3\\u8272\\uFF09\\u90FD\\u4F1A\\u628A\\u5B83\\u4ECE config \\u91CC\\u53BB\\u6389\\uFF1B\\u60F3\\u7559\\u7740\\u5C31\\u73B0\\u5728\\u91CD\\u586B\\u4E00\\u6B21\\uFF08\\u4F1A\\u539F\\u6837\\u5199\\u56DE config\\u3001\\u4ECD\\u662F\\u660E\\u6587\\uFF1A\\u8FD9\\u4E00\\u683C\\u662F json \\u5B57\\u6BB5\\uFF0C\\u5F15\\u64CE\\u7684 secrets \\u673A\\u5236\\u7BA1\\u4E0D\\u5230\\u5B83\\uFF09\\u3002" : "");\n const providersReading = (key) => {\n if (!vschema) return [];\n return vschema.providers.filter((p) => (vschema.keysOf(p) ?? []).includes(key));\n };\n const rowFor = (key) => key === "provider" ? knownIds : providersReading(key);\n const rows = [];\n const syncVisibility = () => {\n const p = provider.value;\n const unknown = !isKnownProvider(p);\n for (const r of rows) r.el.hidden = !(unknown || rowFor(r.key).includes(p));\n refreshSave();\n };\n const fieldRow = (id, label, input, key, hint = null) => {\n const row = h(\n "div",\n { class: "cf-field", id },\n h("label", {}, label),\n typeof hint === "string" ? hint ? h("p", { class: "cf-hint" }, hint) : null : hint,\n input\n );\n rows.push({ el: row, key });\n return row;\n };\n const form = () => ({\n // \u4E0D\u8F6C\u4EFB\u4F55\u5B57\u9762\u91CF union\uFF1A\u4E0B\u62C9\u91CC\u53EF\u80FD\u6709"\u5F53\u524D\u503C"\u90A3\u4E00\u9879\uFF08\u5F15\u64CE\u6E05\u5355\u91CC\u6CA1\u6709\u7684\u503C\uFF09\uFF0C\u7167\u539F\u6837\u4F20\u4E0B\u53BB\n provider: provider.value,\n url: url.value.trim(),\n voice: voiceCtrl.value.trim(),\n lang: lang.value.trim(),\n model: model.value.trim(),\n workspaceId: workspaceId.value.trim(),\n instruction: instruction.value.trim(),\n pythonPath: pythonPath.value.trim(),\n apiKey: apiKey.value,\n // relay / \u8BA1\u8D39\u6C60\u4E94\u4E2A\u952E**\u666E\u901A\u6A21\u5F0F\u4E0D\u5728\u8868\u5355\u91CC**\uFF08\u6CA1\u63A7\u4EF6\u3001\u4E0D\u8BE5\u88AB\u8868\u5355\u6539\u5199\uFF09\u2014\u2014 \u89C1\u4E0A\u9762\u90A3\u6BB5\u6CE8\uFF0C\n // \u5B83\u4EEC\u7531 mergeMyVoice \u7684 `keep` \u4FDD\u5E95\u3002\u5185\u90E8\u6A21\u5F0F\u4E0B\u8FD9\u4E94\u683C\u5728\uFF0C\u8868\u5355\u5C31\u5F97\u5E26\u7740\u5B83\u4EEC\uFF0C\n // \u5426\u5219"\u5728\u5185\u90E8\u6A21\u5F0F\u91CC\u6539\u4E86\u503C\u5374\u63D0\u4EA4\u4E0D\u4E0A\u53BB"\uFF08\u770B\u8D77\u6765\u80FD\u6539\u3001\u5B58\u4E0B\u53BB\u4E00\u4E2A\u5B57\u8282\u90FD\u6CA1\u5199\uFF09\u3002\n ...internal ? {\n relayProviderId: relayProviderId?.value.trim() ?? "",\n relayModel: relayModel?.value.trim() ?? "",\n billingProviderId: billingProviderId?.value.trim() ?? "",\n billingModel: billingModel?.value.trim() ?? "",\n billingMode: billingModeSel?.value.trim() ?? ""\n } : {}\n });\n const snap = () => JSON.stringify(form());\n let baseline = snap();\n const refreshSave = () => {\n save.disabled = snap() === baseline;\n };\n provider.addEventListener("change", () => {\n rebuildVoiceCtrl();\n syncVisibility();\n });\n for (const el of [\n url,\n lang,\n model,\n workspaceId,\n instruction,\n pythonPath,\n ...internal ? [relayProviderId, relayModel, billingProviderId, billingModel] : []\n ]) {\n if (el) el.addEventListener("input", refreshSave);\n }\n billingModeSel?.addEventListener("change", refreshSave);\n apiKey.addEventListener("input", () => {\n keyNote.hidden = apiKey.value !== "";\n refreshSave();\n });\n const renderDetail = (r) => {\n detail.replaceChildren(...setDetailBlocks(r, {\n warningNotes: [{ mark: VOICE_WARNING_MARK, note: VOICE_WARNING_NOTE }]\n }));\n };\n save.addEventListener("click", () => {\n void (async () => {\n save.disabled = true;\n detail.replaceChildren();\n const merged = mergeMyVoice(cur, form(), vschema);\n if (merged.keyDropped && !window.confirm(\n "\\u8FD9\\u4E00\\u683C\\u5728 config \\u91CC\\u5B58\\u7684\\u662F\\u660E\\u6587\\uFF0Cconfig get \\u4F1A\\u628A\\u5B83\\u906E\\u6210 null\\uFF1A\\u6258\\u76D8\\u8BFB\\u4E0D\\u56DE\\u6765\\uFF0C\\u4E5F\\u6CA1\\u6CD5\\u539F\\u6837\\u63D0\\u4EA4\\u3002\\n\\u7EE7\\u7EED\\u4FDD\\u5B58\\u4F1A\\u628A\\u5B83\\u4ECE config \\u91CC\\u53BB\\u6389\\uFF08\\u53D1\\u8BED\\u97F3\\u6761\\u4F1A\\u76F4\\u63A5\\u62A5 TTS failed: cosyvoice provider requires apiKey and voice\\uFF09\\u3002\\n\\n\\u4ECD\\u7136\\u7EE7\\u7EED\\uFF1F"\n )) {\n refreshSave();\n setStatus("\\u6CA1\\u6709\\u63D0\\u4EA4\\uFF1A\\u90A3\\u628A\\u88AB\\u8131\\u654F\\u7684\\u660E\\u6587 key \\u4F1A\\u4ECE config \\u91CC\\u53BB\\u6389\\u3002\\u60F3\\u7559\\u7740\\u5C31\\u5728\\u4E0A\\u9762\\u91CD\\u586B\\u4E00\\u6B21\\u518D\\u4FDD\\u5B58\\u3002", "info");\n return;\n }\n const r = await ctx.deps.configSet(ctx.configPath, { "tools.my_voice": merged.value });\n renderDetail(r);\n if (!r.ok) {\n refreshSave();\n setStatus(`\\u4FDD\\u5B58\\u5931\\u8D25\\uFF1A${r.error ?? ""} ${r.errors.map((e) => e.error).join("\\uFF1B")}`, "err");\n return;\n }\n baseline = snap();\n refreshSave();\n let msg = `\\u5DF2\\u4FDD\\u5B58\\uFF1A${r.changed.join("\\u3001") || "\\uFF08\\u65E0\\u53D8\\u5316\\uFF09"}\\u3002\\u8FD9\\u6761\\u914D\\u7F6E\\u7BA1\\u7684\\u662F\\u300C\\u53D1\\u8BED\\u97F3\\u6761\\u300D\\uFF1B\\u5B9E\\u65F6\\u8BED\\u97F3\\u5BF9\\u8BDD\\u662F\\u53E6\\u4E00\\u5957\\uFF0C\\u6CA1\\u53D8\\u3002`;\n if (merged.keyDropped) msg += " \\u26A0\\uFE0F \\u90A3\\u628A\\u88AB\\u5F15\\u64CE\\u8131\\u654F\\u7684\\u660E\\u6587 key \\u5DF2\\u88AB\\u53BB\\u6389\\u2014\\u2014\\u60F3\\u7559\\u7740\\u7684\\u8BDD\\uFF0C\\u8BF7\\u5728\\u4E0A\\u9762\\u91CD\\u586B\\u4E00\\u6B21\\u3002";\n setStatus(msg, "ok");\n })();\n });\n body.replaceChildren(\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "\\u53D1\\u8BED\\u97F3\\u6761\\uFF08tools.my_voice\\uFF09"),\n h("p", { class: "page-sub" }, "\\u52A9\\u624B\\u7528 my_voice \\u5DE5\\u5177\\u53D1\\u8BED\\u97F3\\u6D88\\u606F\\u65F6\\u7528\\u7684\\u5408\\u6210\\u5F15\\u64CE\\u3002\\u6539\\u5B8C\\u70ED\\u52A0\\u8F7D\\uFF0C\\u4E0D\\u7528\\u91CD\\u542F\\u5F15\\u64CE\\u3002"),\n fieldRow("voice-provider-row", "\\u5408\\u6210\\u5F15\\u64CE", provider, "provider"),\n fieldRow("voice-voice-row", "\\u97F3\\u8272", voiceBox, "voice"),\n // keyNote \u53EA\u6302\u8FD9\u4E00\u5904\uFF08\u63D0\u793A\u5C31\u957F\u5728\u8FD9\u4E00\u884C\u91CC\uFF0C\u8DDF\u7740\u5B83\u4E00\u8D77\u85CF\uFF09\u2014\u2014 \u522B\u518D\u5355\u72EC append \u4E00\u6B21\uFF0C\u4F1A\u91CD\u590D\n fieldRow("voice-key-row", "API Key", apiKey, "apiKey", keyMasked ? keyNote : null),\n fieldRow("voice-model-row", "\\u6A21\\u578B", model, "model"),\n fieldRow("voice-workspace-row", "Workspace", workspaceId, "workspaceId"),\n fieldRow("voice-instruction-row", "\\u98CE\\u683C\\u6307\\u4EE4", instruction, "instruction"),\n fieldRow("voice-url-row", "\\u670D\\u52A1\\u5730\\u5740", url, "url"),\n fieldRow("voice-lang-row", "\\u8BED\\u8A00", lang, "lang"),\n fieldRow("voice-python-row", "Python \\u8DEF\\u5F84", pythonPath, "pythonPath"),\n ...internal ? [\n h(\n "p",\n { class: "cf-hint", id: "voice-internal-note" },\n "\\u4E0B\\u9762\\u4E94\\u683C\\u662F\\u5185\\u90E8\\u6A21\\u5F0F\\uFF08\\u8C03\\u8BD5\\u7248\\uFF09\\u624D\\u663E\\u793A\\u7684\\uFF1Arelay \\u6761\\u76EE / \\u865A\\u62DF\\u6A21\\u578B / \\u8BA1\\u8D39\\u6C60\\u4E09\\u9879\\u3002",\n "\\u666E\\u901A\\u7528\\u6237\\u770B\\u4E0D\\u5230\\u5B83\\u4EEC\\uFF0C\\u914D\\u7F6E\\u672C\\u8EAB\\u7167\\u5E38\\u4FDD\\u7559\\u3002"\n )\n ] : [],\n internalRow(\n "voice-relay-provider-row",\n "Provider \\u6761\\u76EE",\n relayProviderId,\n "relayProviderId",\n "\\u9ED8\\u8BA4 7yi\\u2014\\u2014\\u514D\\u8D39\\u6863\\u88C5\\u673A\\u81EA\\u52A8\\u914D\\u597D\\uFF0C\\u4E00\\u822C\\u4E0D\\u7528\\u6539"\n ),\n internalRow(\n "voice-relay-model-row",\n "\\u865A\\u62DF\\u6A21\\u578B",\n relayModel,\n "relayModel",\n "\\u9ED8\\u8BA4 engine7-tts\\u3002\\u6362\\u8BA1\\u8D39\\u53E3\\u5F84\\u5C31\\u662F\\u6362\\u8FD9\\u4E2A\\u540D\\u5B57\\uFF08\\u6309\\u5B57\\u7B26 / \\u6309\\u5206\\u949F\\u5404\\u662F\\u4E00\\u4E2A\\u6A21\\u578B\\u540D\\uFF09"\n ),\n internalRow("voice-billing-mode-row", "\\u8BA1\\u8D39\\u6C60\\u6A21\\u5F0F", billingModeSel, "billingMode"),\n internalRow(\n "voice-billing-provider-row",\n "\\u8BA1\\u8D39\\u6C60\\u6761\\u76EE",\n billingProviderId,\n "billingProviderId",\n "\\u7559\\u7A7A = \\u8BA1\\u8D39\\u6C60\\u6CA1\\u5F00\\uFF0C\\u4E00\\u5F8B\\u8D70\\u514D\\u8D39\\u6C60"\n ),\n internalRow("voice-billing-model-row", "\\u8BA1\\u8D39\\u6C60\\u6A21\\u578B", billingModel, "billingModel"),\n h("div", { class: "cfg-savebar" }, h("div", { class: "btn-row" }, save), status, detail)\n )\n );\n syncVisibility();\n return () => {\n };\n }\n\n // web-console/desktop/src/renderer/console/panels/search.ts\n var OPT_TEXT = {\n tavily: "\\u9ED8\\u8BA4\\u641C\\u7D22\\uFF08\\u94FE\\u63A5\\u5217\\u8868\\uFF0C\\u5FEB\\uFF09",\n doubao: "\\u8C46\\u5305\\u641C\\u7D22\\uFF08\\u56FD\\u5185\\u65F6\\u4E8B\\u66F4\\u61C2\\uFF0C\\u7EFC\\u5408\\u7B54\\u6848\\uFF0C\\u7A0D\\u6162\\uFF09"\n };\n function renderSearchPanel(body, ctx) {\n const cur = pickPath(ctx.values, "tools.webSearch") ?? {};\n const providers = pickPath(ctx.values, "models.providers") ?? pickPath(ctx.values, "providers") ?? {};\n const has7yi = Boolean(providers?.["7yi"]);\n const curProvider = typeof cur.provider === "string" && cur.provider || "tavily";\n const status = h("div", { class: "inline-warn", hidden: true });\n const detail = h("div", { class: "cfg-detail" });\n const save = h("button", { class: "btn btn-primary", type: "button" }, "\\u4FDD\\u5B58");\n const setStatus = (m, k) => {\n status.hidden = false;\n status.textContent = m;\n status.style.color = k === "err" ? "var(--red)" : k === "ok" ? "var(--green)" : "";\n };\n const engineField = ctx.fields.find((f) => f.path === "tools.webSearch.provider");\n const known = engineField?.knownValues ?? ["tavily", "doubao"];\n const opts = [...known];\n if (!opts.includes(curProvider)) opts.unshift(curProvider);\n const provider = h(\n "select",\n { id: "ws-provider" },\n ...opts.map((o) => h("option", { value: o, selected: o === curProvider }, OPT_TEXT[o] ?? o))\n );\n const snap = () => provider.value;\n let baseline = snap();\n const refreshSave = () => {\n save.disabled = snap() === baseline;\n };\n provider.addEventListener("change", refreshSave);\n const renderDetail = (r) => {\n detail.replaceChildren(...setDetailBlocks(r, {}));\n };\n save.addEventListener("click", () => {\n void (async () => {\n save.disabled = true;\n detail.replaceChildren();\n const values = { "tools.webSearch.provider": provider.value };\n if (provider.value === "doubao") {\n values["tools.webSearch.doubaoModel"] = "7yi/doubao-web-search";\n }\n const r = await ctx.deps.configSet(ctx.configPath, values);\n renderDetail(r);\n if (!r.ok) {\n refreshSave();\n setStatus(`\\u4FDD\\u5B58\\u5931\\u8D25\\uFF1A${r.error ?? ""} ${r.errors.map((e) => e.error).join("\\uFF1B")}`, "err");\n return;\n }\n baseline = snap();\n refreshSave();\n setStatus(`\\u5DF2\\u4FDD\\u5B58\\uFF1A${r.changed.join("\\u3001") || "\\uFF08\\u65E0\\u53D8\\u5316\\uFF09"}\\u3002\\u7ACB\\u5373\\u751F\\u6548\\uFF0C\\u4E0B\\u6B21\\u641C\\u7D22\\u5C31\\u7528\\u65B0\\u540E\\u7AEF\\u3002`, "ok");\n })();\n });\n body.replaceChildren(\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, "\\u8054\\u7F51\\u641C\\u7D22"),\n h(\n "p",\n { class: "page-sub" },\n "\\u95EE\\u65F6\\u4E8B\\u3001\\u67E5\\u8D44\\u6599\\u65F6\\u52A9\\u624B\\u4F1A\\u5148\\u641C\\u518D\\u7B54\\u3002\\u4E24\\u4E2A\\u5F15\\u64CE\\u5404\\u6709\\u957F\\u5904\\uFF0C\\u968F\\u65F6\\u53EF\\u5207\\uFF1A"\n ),\n h(\n "div",\n { class: "cf-field" },\n h("label", {}, "\\u641C\\u7D22\\u5F15\\u64CE"),\n h(\n "p",\n { class: "cf-hint" },\n "\\u9ED8\\u8BA4\\u641C\\u7D22\\uFF1A\\u8FD4\\u56DE\\u94FE\\u63A5\\u5217\\u8868\\uFF0C\\u901F\\u5EA6\\u5FEB\\uFF0C\\u901A\\u7528\\u573A\\u666F\\u3002\\u8C46\\u5305\\u641C\\u7D22\\uFF1A\\u9002\\u5408\\u56FD\\u5185\\u65F6\\u4E8B\\uFF08\\u5934\\u6761/\\u6296\\u97F3\\u7B49\\u6765\\u6E90\\uFF09\\uFF0C\\u8FD4\\u56DE\\u6574\\u7406\\u597D\\u7684\\u7EFC\\u5408\\u7B54\\u6848\\uFF0C\\u7A0D\\u6162\\u4E00\\u4E9B\\u3002"\n ),\n provider\n ),\n h(\n "p",\n { class: "cf-hint" },\n has7yi ? "\\u8C46\\u5305\\u641C\\u7D22\\u8D70\\u4E2D\\u8F6C\\u7AD9\\u7EBF\\u8DEF\\uFF0C\\u514D\\u8D39\\u989D\\u5EA6\\u6709\\u9650\\u2014\\u2014\\u7528\\u5B8C\\u4F1A\\u81EA\\u52A8\\u56DE\\u843D\\u5230\\u9ED8\\u8BA4\\u641C\\u7D22\\uFF0C\\u641C\\u7D22\\u4E0D\\u4F1A\\u4E2D\\u65AD\\u3002" : "\\uFF08\\u5F53\\u524D\\u914D\\u7F6E\\u91CC\\u6CA1\\u6709\\u4E2D\\u8F6C\\u7AD9\\u6761\\u76EE\\uFF0C\\u8C46\\u5305\\u7EBF\\u8DEF\\u53EF\\u80FD\\u4E0D\\u53EF\\u7528\\uFF1B\\u9ED8\\u8BA4\\u641C\\u7D22\\u4E0D\\u53D7\\u5F71\\u54CD\\u3002\\uFF09"\n ),\n h("div", { class: "cfg-savebar" }, h("div", { class: "btn-row" }, save), status, detail)\n )\n );\n refreshSave();\n return () => {\n };\n }\n\n // web-console/desktop/src/renderer/console/cc-pair-card.ts\n var POLL_MS = 3e3;\n var DONE_AUTOCLOSE_MS = 6e3;\n function mountCcPairCard(deps) {\n const status = h("div", { class: "cf-hint", id: "ccpair-status" }, "\\u8BFB\\u53D6\\u4E2D\\u2026");\n const err = h("div", { class: "qr-error", hidden: true });\n const btn = h("button", { class: "btn btn-primary", type: "button", onclick: () => {\n void onPrimary();\n } }, "\\u4E00\\u952E\\u5F00\\u901A");\n const card = h(\n "section",\n { class: "settings-group" },\n h("p", { class: "page-sub" }, "\\u98DE\\u4E66\\u91CC\\u591A\\u4E00\\u4E2A\\u4E13\\u5C5E\\u673A\\u5668\\u4EBA\\uFF08CC \\u7EC8\\u7AEF\\uFF09\\uFF1A\\u5BB6\\u91CC\\u7684\\u4F19\\u4F34\\u501F\\u5B83\\u7684\\u8111\\u5E72\\u6D3B\\uFF0C\\u8FD9\\u4E2A\\u79C1\\u804A\\u91CC\\u5168\\u7A0B\\u53EF\\u89C1\\uFF1B\\u684C\\u9762 cc-desktop \\u5F00\\u7684\\u662F\\u540C\\u4E00\\u4E2A\\u4F1A\\u8BDD\\u3002"),\n h("div", { class: "btn-row" }, btn),\n err,\n status\n );\n let stopped = false;\n let modal = null;\n let pollTimer = null;\n let autoCloseTimer = null;\n let renderedKind = "";\n let renderedUrl = "";\n const clearTimers = () => {\n if (pollTimer) {\n clearInterval(pollTimer);\n pollTimer = null;\n }\n if (autoCloseTimer) {\n clearTimeout(autoCloseTimer);\n autoCloseTimer = null;\n }\n };\n const closeModal = () => {\n clearTimers();\n if (modal) {\n modal.close();\n modal = null;\n }\n renderedKind = "";\n renderedUrl = "";\n btn.disabled = false;\n };\n const showModal = (body) => {\n const box = h(\n "div",\n { class: "modal" },\n h("button", {\n class: "modal-close",\n type: "button",\n title: "\\u53D6\\u6D88",\n "aria-label": "\\u53D6\\u6D88",\n onclick: () => {\n void deps.ccPairScanCancel().catch(() => {\n });\n closeModal();\n }\n }, "\\xD7"),\n h("h3", {}, "CC \\u673A\\u5668\\u4EBA\\u626B\\u7801"),\n ...body\n );\n if (modal) modal.root.replaceChildren(box);\n else modal = openModal(box);\n };\n const renderWaiting = (line) => {\n renderedKind = "waiting";\n showModal([h("p", { class: "modal-sub" }, "\\u6B63\\u5728\\u751F\\u6210\\u4E8C\\u7EF4\\u7801\\uFF0C\\u8BF7\\u7A0D\\u5019\\u2026"), h("p", { class: "countdown" }, line)]);\n };\n const renderQr = (url) => {\n renderedKind = "qr";\n renderedUrl = url;\n const img = h("img", { class: "qr", alt: "\\u4E8C\\u7EF4\\u7801", width: 260, height: 260 });\n showModal([\n h("p", { class: "modal-sub" }, "\\u7528\\u624B\\u673A\\u98DE\\u4E66\\u626B\\u63CF\\u2014\\u2014\\u6CE8\\u518C\\u51FA\\u7684\\u673A\\u5668\\u4EBA\\u5F52\\u4F60\\uFF0C\\u4F60\\u7684\\u4F19\\u4F34\\u5C31\\u7528\\u5B83"),\n img,\n h("p", { class: "countdown" }, "\\u7B49\\u5F85\\u626B\\u7801\\u2026\\u626B\\u5B8C\\u5728\\u624B\\u673A\\u4E0A\\u786E\\u8BA4\\u6388\\u6743")\n ]);\n void qrDataUrl(url).then((data) => {\n if (!stopped && renderedKind === "qr" && renderedUrl === url && modal) img.src = data;\n }).catch(() => {\n if (!stopped && renderedKind === "qr" && renderedUrl === url) {\n showModal([h("p", { class: "modal-sub" }, "\\u4E8C\\u7EF4\\u7801\\u6E32\\u67D3\\u5931\\u8D25\\uFF0C\\u4F46\\u626B\\u7801\\u6D41\\u7A0B\\u4ECD\\u5728\\u8FDB\\u884C\\u2014\\u2014\\u8BF7\\u7B49\\u5F85\\u7ED3\\u679C")]);\n }\n });\n };\n const renderTimeout = () => {\n renderedKind = "timeout";\n showModal([\n h("p", { class: "modal-sub" }, "\\u8D85\\u8FC7 5 \\u5206\\u949F\\u672A\\u5B8C\\u6210\\u626B\\u7801\\u3002"),\n h(\n "div",\n { class: "modal-actions" },\n h("button", {\n class: "btn btn-primary",\n type: "button",\n onclick: () => {\n renderedKind = "";\n void startScan();\n }\n }, "\\u91CD\\u8BD5\\uFF08\\u6362\\u65B0\\u4E8C\\u7EF4\\u7801\\uFF09"),\n h("button", {\n class: "btn",\n type: "button",\n onclick: () => {\n void deps.ccPairScanCancel().catch(() => {\n });\n closeModal();\n }\n }, "\\u53D6\\u6D88")\n )\n ]);\n };\n const renderError = (message) => {\n renderedKind = `error:${message}`;\n showModal([\n h("p", { class: "modal-sub", style: "text-align:left;white-space:pre-wrap;user-select:text" }, message),\n h(\n "div",\n { class: "modal-actions" },\n h("button", {\n class: "btn",\n type: "button",\n onclick: () => {\n void deps.ccPairScanCancel().catch(() => {\n });\n closeModal();\n }\n }, "\\u5173\\u95ED")\n )\n ]);\n };\n const renderDone = () => {\n renderedKind = "done";\n showModal([\n h("p", { class: "modal-sub" }, "\\u2705 \\u673A\\u5668\\u4EBA\\u5DF2\\u5C31\\u7EEA\\u2014\\u2014\\u6700\\u540E\\u4E00\\u6B65\\uFF1A\\u53BB\\u98DE\\u4E66\\u627E\\u5230\\u65B0\\u673A\\u5668\\u4EBA\\uFF0C\\u7ED9\\u5B83\\u53D1\\u7B2C\\u4E00\\u53E5\\u8BDD\\uFF08\\u6BD4\\u5982\\u300C\\u4F60\\u597D\\u300D\\uFF09\\uFF0C\\u53D1\\u5B8C\\u8FD9\\u6761\\u5C31\\u5168\\u90E8\\u5B8C\\u6210\\u3002"),\n h("p", { class: "countdown" }, "\\u7A97\\u53E3\\u5373\\u5C06\\u81EA\\u52A8\\u5173\\u95ED\\u2026")\n ]);\n autoCloseTimer = setTimeout(() => {\n closeModal();\n void refresh();\n }, DONE_AUTOCLOSE_MS);\n };\n const tick = async () => {\n if (stopped) return;\n const r = await deps.ccPairScanPoll().catch(() => null);\n if (stopped || !modal || !r) return;\n const state = r.last?.state;\n if (!r.running && (state === "starting" || state === "qr")) {\n if (renderedKind !== "error:interrupted") {\n renderError("\\u626B\\u7801\\u6D41\\u7A0B\\u4E2D\\u65AD\\u2014\\u2014\\u8BF7\\u91CD\\u8BD5\\uFF1B\\u82E5\\u590D\\u73B0\\u8BF7\\u67E5\\u770B\\u5F15\\u64CE\\u65E5\\u5FD7\\u3002");\n }\n return;\n }\n const last = r.last;\n switch (state) {\n case "starting":\n if (renderedKind !== "waiting") renderWaiting("\\u6B63\\u5728\\u751F\\u6210\\u4E8C\\u7EF4\\u7801\\u2026");\n break;\n case "qr":\n if (last && (renderedKind !== "qr" || renderedUrl !== last.url)) renderQr(last.url ?? "");\n break;\n case "timeout":\n if (renderedKind !== "timeout") renderTimeout();\n break;\n case "error":\n if (last && renderedKind !== `error:${last.message}`) renderError(last.message ?? "\\u626B\\u7801\\u6D41\\u7A0B\\u5931\\u8D25\\uFF0C\\u8BF7\\u67E5\\u770B\\u5F15\\u64CE\\u65E5\\u5FD7");\n break;\n case "done":\n if (renderedKind !== "done") renderDone();\n break;\n default:\n break;\n }\n };\n const startScan = async () => {\n if (stopped) return;\n renderedKind = "";\n renderWaiting("\\u6B63\\u5728\\u8FDE\\u63A5\\u2026");\n const r = await deps.ccPairScanStart().catch((e) => ({ ok: false, error: e?.message ?? String(e) }));\n if (stopped) return;\n if (!r.ok) {\n renderError(r.error ?? "\\u65E0\\u6CD5\\u53D1\\u8D77\\u626B\\u7801");\n return;\n }\n clearTimers();\n pollTimer = setInterval(() => {\n void tick();\n }, POLL_MS);\n void tick();\n };\n const onPrimary = async () => {\n if (stopped) return;\n btn.disabled = true;\n err.hidden = true;\n const r = await deps.ccPairProvision().catch((e) => ({ ok: false, error: e?.message ?? String(e) }));\n if (stopped) return;\n if (!r.ok) {\n btn.disabled = false;\n err.hidden = false;\n err.textContent = r.error ?? "\\u5F00\\u901A\\u5931\\u8D25\\uFF0C\\u8BF7\\u67E5\\u770B\\u5F15\\u64CE\\u65E5\\u5FD7";\n return;\n }\n void startScan();\n };\n const refresh = async () => {\n if (stopped) return;\n const s = await deps.ccPairStatus().catch(() => null);\n if (stopped) return;\n btn.disabled = false;\n btn.hidden = false;\n btn.classList.remove("btn-primary");\n btn.onclick = () => {\n void onPrimary();\n };\n err.hidden = true;\n if (!s || s.state === "none") {\n status.textContent = "\\u26D4 \\u672A\\u5F00\\u901A\\u2014\\u2014\\u98DE\\u4E66\\u91CC\\u8FD8\\u6CA1\\u6709\\u8FD9\\u4E2A\\u4E13\\u5C5E\\u673A\\u5668\\u4EBA\\u3002";\n btn.textContent = "\\u4E00\\u952E\\u5F00\\u901A";\n btn.classList.add("btn-primary");\n return;\n }\n if (!s.hasApp) {\n status.textContent = "\\u23F3 \\u5B9E\\u4F8B\\u5DF2\\u5C31\\u7EEA\\uFF0C\\u8FD8\\u5DEE\\u626B\\u4E00\\u6B21\\u7801\\uFF1A\\u6CE8\\u518C\\u51FA\\u7684\\u673A\\u5668\\u4EBA\\u5F52\\u4F60\\uFF0C\\u4F19\\u4F34\\u5C31\\u7528\\u5B83\\u3002";\n btn.textContent = "\\u7EE7\\u7EED\\u5F00\\u901A\\uFF08\\u626B\\u7801\\uFF09";\n btn.classList.add("btn-primary");\n return;\n }\n if (!s.running) {\n status.textContent = "\\u26AA \\u673A\\u5668\\u4EBA\\u5DF2\\u914D\\u7F6E\\uFF0C\\u5B9E\\u4F8B\\u6CA1\\u5728\\u8DD1\\u3002";\n btn.textContent = "\\u542F\\u52A8 CC \\u5B9E\\u4F8B";\n btn.onclick = () => {\n void deps.ccPairStart().then(() => refresh());\n };\n return;\n }\n status.textContent = s.bound ? "\\u2705 \\u5DF2\\u5F00\\u901A\\u2014\\u2014\\u8FD9\\u4E2A\\u79C1\\u804A\\u91CC\\u76F4\\u63A5\\u8BF4\\u8BDD\\u5C31\\u662F CC\\uFF1B/cc-list \\u770B\\u4F1A\\u8BDD\\u3001/cc-switch \\u6362\\u7EBF\\u3002" : "\\u2705 \\u673A\\u5668\\u4EBA\\u5DF2\\u5C31\\u7EEA\\u2014\\u2014\\u5C31\\u5DEE\\u6700\\u540E\\u4E00\\u6B65\\uFF1A\\u53BB\\u98DE\\u4E66\\u7ED9\\u5B83\\u53D1\\u7B2C\\u4E00\\u53E5\\u8BDD\\uFF0C\\u53D1\\u5B8C\\u5373\\u63A5\\u5165\\u3002";\n btn.hidden = true;\n };\n void refresh();\n return {\n el: card,\n refresh,\n dispose() {\n stopped = true;\n closeModal();\n }\n };\n }\n function renderCcPairPanel(body, ctx) {\n const card = mountCcPairCard(ctx.deps.ccPair);\n body.replaceChildren(card.el);\n return () => {\n card.dispose();\n };\n }\n\n // web-console/desktop/src/renderer/console/panels/registry.ts\n var PANELS = [\n { key: "general", title: "\\u901A\\u7528", claim: ["timezone", "agents.defaults.name"], render: renderGeneralPanel },\n { key: "model", title: "\\u6A21\\u578B\\u670D\\u52A1", claim: [\n "agents.defaults.model.primary",\n "agents.defaults.model.vision",\n // \u964D\u7EA7\u94FE\u4E24\u9879\uFF08spec \xA77 \u70B9\u540D\uFF09\uFF1A\u5B83\u4EEC\u662F type:\'json\' \u21D2 \u9762\u677F\u91CC**\u53EA\u8BFB\u5C55\u793A**\uFF0C\n // \u4F46\u5FC5\u987B\u8BA4\u9886 \u2014\u2014 \u4E0D\u8BA4\u9886\u7684\u8BDD\u5B83\u4EEC\u5C31\u53EA\u662F\u300C\u5176\u5B83\u300D\u91CC\u4E24\u683C\u6CA1\u6709\u5F52\u5C5E\u7684 textarea\u3002\n "agents.defaults.model.fallbacks",\n "agents.defaults.model.visionFallbacks",\n "tools.my_eyes.model",\n "tools.tavily.apiKey",\n "api.port",\n "models.providers"\n ], render: renderModelPanel },\n { key: "face", title: "\\u5F62\\u8C61", claim: ["tools.my_selfie"], render: renderFacePanel },\n { key: "identity", title: "\\u4EBA\\u8BBE", claim: ["agents.defaults.persona"], render: renderIdentityPanel },\n // \u26A0\uFE0F `voiceChat.*` \u56DB\u683C**\u4E0D\u518D\u8BA4\u9886**\uFF08\u4E5F\u4E0D\u518D\u6E32\u67D3\uFF09\uFF1A\u5F15\u64CE\u4FA7 0927 \u5DF2\u628A\u5B83\u4EEC\u4ECE\u6E05\u5355\u64A4\u4E0B\n // \uFF08\u7FC0\u54E5\uFF1A\u300CvoiceChat \u9690\u85CF\uFF0C\u4EE5\u540E\u552E\u5356\u7684\u65F6\u5019\u518D\u8BF4\u3002\u4F60\u5185\u90E8\u53EF\u4EE5\u7559\u4F4D\u300D\uFF09\u3002\n // \u58F3\u5B50\u8FD8\u5728\uFF08\u5F15\u64CE\u7167\u5E38\u8BFB\u90A3\u4E00\u6BB5\u914D\u7F6E\uFF09\uFF0C\u53EA\u662F\u4E0D\u518D\u66B4\u9732\u7ED9\u7528\u6237 \u2014\u2014 \u89C1\u5F15\u64CE registry.ts \u91CC\u90A3\u6BB5\u6CE8\u3002\n { key: "voice", title: "\\u58F0\\u97F3", claim: [\n "tools.my_voice"\n ], render: renderVoicePanel },\n // \u641C\u7D22\u8BBE\u7F6E\uFF081010\uFF09\uFF1A\u72EC\u7ACB\u5B50 tab\u2014\u2014\u4E0D\u8BA9\u7528\u6237\u5728\u300C\u5176\u5B83\u300D\u7EC4\u91CC\u624B\u6253 tavily/doubao \u88F8\u503C\n // \u548C provider/model \u590D\u5408\u4E32\uFF1B\u9009\u8C46\u5305\u81EA\u52A8\u5199\u5168\u7EBF\u8DEF\u3002\u989D\u5EA6\u5C3D\u7531 7yi wrapper \u56DE\u843D\uFF0C\u7528\u6237\u65E0\u611F\u3002\n { key: "search", title: "\\u641C\\u7D22", claim: [\n "tools.webSearch.provider",\n "tools.webSearch.doubaoModel"\n ], render: renderSearchPanel },\n // CC \u4F19\u4F34\u4F4D\uFF081113 \u7FC0\u54E5\u5B9A\u7EA7\uFF1A\u8F85\u52A9\u529F\u80FD=\u8BBE\u7F6E\u91CC**\u5355\u72EC\u4E00\u4E2A\u5B50 tab**\uFF0C\u4E0D\u5360\u4E00\u7EA7\u9875\u9762\u4E5F\u4E0D\u585E\u8FDB\u901A\u7528\uFF09\n { key: "ccpair", title: "CC \\u4F19\\u4F34\\u4F4D", claim: [], render: renderCcPairPanel }\n ];\n function claimedPaths() {\n return new Set(PANELS.flatMap((p) => p.claim));\n }\n var GROUP_TITLES = {\n general: "\\u76EE\\u5F55\\u4E0E\\u72B6\\u6001",\n display: "\\u663E\\u793A",\n session: "\\u4F1A\\u8BDD",\n sandbox: "\\u6C99\\u7BB1",\n feature: "\\u529F\\u80FD\\u5F00\\u5173",\n prompt: "\\u63D0\\u793A\\u8BCD",\n compaction: "\\u4E0A\\u4E0B\\u6587\\u538B\\u7F29",\n skills: "\\u6280\\u80FD",\n channel: "\\u901A\\u9053",\n model: "\\u6A21\\u578B",\n identity: "\\u4EBA\\u8BBE",\n face: "\\u5F62\\u8C61",\n voice: "\\u58F0\\u97F3",\n email: "\\u90AE\\u4EF6"\n };\n function looseFields(fields) {\n const claimed = claimedPaths();\n return fields.filter((f) => !claimed.has(f.path) && f.group !== "channel" && f.group !== "email");\n }\n\n // web-console/desktop/src/renderer/console/panels/others-policy.ts\n var PREFERENCE_EXTRAS = {\n "display.typing.enabled": { label: "\\u6B63\\u5728\\u8F93\\u5165\\u63D0\\u793A", hint: "\\u5728\\u652F\\u6301\\u7684\\u5E73\\u53F0\\u4E0A\\u663E\\u793A\\u4F19\\u4F34\\u6B63\\u5728\\u8F93\\u5165\\u3002", booleanDefault: true, showPath: false },\n "display.reactions.enabled": { label: "\\u6D88\\u606F\\u8868\\u60C5\\u56DE\\u5E94", hint: "\\u5728\\u652F\\u6301\\u7684\\u5E73\\u53F0\\u4E0A\\uFF0C\\u7528\\u8868\\u60C5\\u8868\\u793A\\u5F00\\u59CB\\u5904\\u7406\\u3001\\u5B8C\\u6210\\u6216\\u51FA\\u9519\\u3002", booleanDefault: true, showPath: false },\n "display.thinking.enabled": { label: "\\u663E\\u793A\\u601D\\u8003\\u8FC7\\u7A0B", hint: "\\u5DE5\\u4F5C\\u6A21\\u5F0F\\u4E0B\\u663E\\u793A\\u601D\\u8003\\u8FC7\\u7A0B\\u3002", booleanDefault: true, showPath: false },\n "display.toolUse.enabled": { label: "\\u663E\\u793A\\u5DE5\\u5177\\u8C03\\u7528", hint: "\\u5DE5\\u4F5C\\u6A21\\u5F0F\\u4E0B\\u663E\\u793A\\u4F19\\u4F34\\u6B63\\u5728\\u4F7F\\u7528\\u7684\\u5DE5\\u5177\\u3002", booleanDefault: true, showPath: false },\n "display.toolResult.enabled": { label: "\\u663E\\u793A\\u5DE5\\u5177\\u7ED3\\u679C", hint: "\\u5DE5\\u4F5C\\u6A21\\u5F0F\\u4E0B\\u663E\\u793A\\u5DE5\\u5177\\u6267\\u884C\\u7684\\u7ED3\\u679C\\u3002", booleanDefault: true, showPath: false },\n "display.toolOutputMode": { label: "\\u5DE5\\u5177\\u8F93\\u51FA\\u65B9\\u5F0F", hint: "\\u6298\\u53E0\\u540E\\u96C6\\u4E2D\\u663E\\u793A\\u5DE5\\u5177\\u8FC7\\u7A0B\\uFF1B\\u98DE\\u4E66\\u53EF\\u70B9\\u5F00\\u67E5\\u770B\\u7ED3\\u679C\\u3002\\u4FDD\\u5B58\\u540E\\u4E0B\\u4E00\\u8F6E\\u751F\\u6548\\u3002", enumDefault: "expanded", optionLabels: { expanded: "\\u5C55\\u5F00\\uFF08\\u9ED8\\u8BA4\\uFF09", collapsed: "\\u6298\\u53E0" }, showPath: false },\n "onboarding.tips.enabled": { label: "\\u6BCF\\u65E5\\u5C0F\\u529F\\u80FD\\u4ECB\\u7ECD", hint: "\\u5B89\\u88C5\\u540E\\u7684\\u524D\\u51E0\\u5929\\uFF0C\\u901A\\u8FC7\\u5FAE\\u4FE1\\u6216\\u98DE\\u4E66\\u4ECB\\u7ECD\\u4E00\\u4E2A\\u5C0F\\u529F\\u80FD\\u3002", booleanDefault: true, showPath: false }\n };\n var PREFERENCE_GROUPS = [\n { key: "chat", title: "\\u804A\\u5929\\u53CD\\u9988", paths: ["display.typing.enabled", "display.reactions.enabled"] },\n { key: "task", title: "\\u4EFB\\u52A1\\u8FC7\\u7A0B", paths: ["display.thinking.enabled", "display.toolUse.enabled", "display.toolResult.enabled", "display.toolOutputMode"] },\n { key: "guide", title: "\\u65B0\\u624B\\u5F15\\u5BFC", paths: ["onboarding.tips.enabled"] }\n ];\n var INTERNAL_ORDER = ["display", "onboarding", "session", "feature", "skills", "sandbox", "api", "prompt", "compaction", "voice", "general"];\n var INTERNAL_TITLES = { ...GROUP_TITLES, display: "\\u663E\\u793A\\u7EC6\\u8282", onboarding: "\\u5F15\\u5BFC\\u7EC6\\u8282", api: "\\u63A5\\u53E3\\u4E0E\\u6865\\u63A5", voice: "\\u8BED\\u97F3\\u670D\\u52A1" };\n function otherSections(fields, internalMode) {\n const loose = looseFields(fields);\n const used = /* @__PURE__ */ new Set();\n const sections = PREFERENCE_GROUPS.map((g) => ({ key: g.key, title: g.title, fields: g.paths.flatMap((path) => {\n const field = loose.find((f) => f.path === path && f.type === (path === "display.toolOutputMode" ? "enum" : "boolean"));\n if (!field) return [];\n used.add(path);\n return [field];\n }) })).filter((s) => s.fields.length > 0);\n if (!internalMode) return sections;\n const remaining = /* @__PURE__ */ new Map();\n for (const f of loose) {\n if (used.has(f.path)) continue;\n if (!remaining.has(f.group)) remaining.set(f.group, []);\n remaining.get(f.group).push(f);\n }\n const order2 = [...INTERNAL_ORDER.filter((g) => remaining.has(g)), ...[...remaining.keys()].filter((g) => !INTERNAL_ORDER.includes(g))];\n for (const g of order2) sections.push({ key: g, title: INTERNAL_TITLES[g] ?? g, fields: remaining.get(g) });\n return sections;\n }\n\n // web-console/desktop/src/renderer/console/panels/others.ts\n function renderOthersPanel(body, ctx) {\n const sections = otherSections(ctx.fields, ctx.internalMode);\n if (!sections.length) {\n body.replaceChildren(h("p", { class: "page-sub" }, "\\u6CA1\\u6709\\u989D\\u5916\\u7684\\u53EF\\u914D\\u7F6E\\u9879\\u3002"));\n return () => {\n };\n }\n const extras = Object.fromEntries(Object.entries(PREFERENCE_EXTRAS).map(([path, ex]) => [path, { ...ex, showPath: ctx.internalMode }]));\n const form = renderForm(sections.flatMap((s) => s.fields), ctx.values, ctx.secrets, ctx.deps, extras);\n const labels2 = Object.fromEntries(Object.entries(PREFERENCE_EXTRAS).map(([path, ex]) => [path, ex.label]));\n const bar = buildSaveBar(form, ctx, { labels: ctx.internalMode ? void 0 : labels2 });\n if (!ctx.internalMode) {\n form.root.classList.add("other-preferences");\n for (const row of form.rows) {\n row.el.classList.add("cf-preference");\n row.input.id = `preference-${row.field.path}`;\n row.el.querySelector("label").htmlFor = row.input.id;\n if (row.field.type === "boolean") row.input.setAttribute("role", "switch");\n else row.el.classList.add("cf-preference-choice");\n }\n }\n form.root.replaceChildren(...sections.map((s) => h(\n "section",\n { class: "settings-group", "data-group": s.key },\n h("h3", {}, s.title),\n ...s.fields.map((f) => form.rows.find((r) => r.field.path === f.path).el)\n )));\n body.replaceChildren(\n h("p", { class: "page-sub" }, ctx.internalMode ? "\\u5E38\\u7528\\u504F\\u597D\\u6392\\u5728\\u524D\\u9762\\uFF0C\\u5185\\u90E8\\u53C2\\u6570\\u6309\\u7528\\u9014\\u5206\\u7EC4\\u3002" : "\\u6309\\u4F60\\u7684\\u4E60\\u60EF\\u8C03\\u6574\\u804A\\u5929\\u53CD\\u9988\\u4E0E\\u4EFB\\u52A1\\u8FC7\\u7A0B\\u3002"),\n form.root,\n bar.el\n );\n return () => {\n };\n }\n var OTHERS_PANEL = { key: "others", title: "\\u5176\\u4ED6", claim: [], render: renderOthersPanel };\n\n // web-console/desktop/src/renderer/console/internal-mode.ts\n var INTERNAL_CLICKS = 7;\n var CLICK_WINDOW_MS = 3e3;\n function settingsFooter(opts) {\n const ver = (v) => v ?? "(\\u8BFB\\u4E0D\\u5230)";\n const line = h("span", {\n class: "version-line",\n id: "settings-version-line",\n // title \u91CC\u4E0D\u5199\u624B\u52BF\uFF08\u5199\u51FA\u6765\u5C31\u4E0D\u662F\u9690\u85CF\u624B\u52BF\u4E86\uFF09\uFF1B\u53EA\u8BF4\u660E\u8FD9\u884C\u662F\u4EC0\u4E48\n title: "\\u8DD1\\u8BBE\\u7F6E\\u9875\\u7684\\u5F15\\u64CE\\uFF08\\u5B89\\u88C5\\u5305\\u5185\\u7F6E\\uFF09\\u4E0E\\u8FD9\\u4EFD\\u5F15\\u64CE\\u5404\\u81EA\\u7684\\u7248\\u672C",\n "data-internal-clicks": "0"\n }, `\\u5185\\u7F6E\\u5F15\\u64CE ${ver(opts.cliVersion)} \\xB7 \\u76EE\\u6807\\u5F15\\u64CE ${ver(opts.engineVersion)}`);\n const badge = h(\n "span",\n { class: "internal-badge", id: "internal-mode-badge", hidden: !opts.internalMode },\n "\\u5185\\u90E8\\u6A21\\u5F0F"\n );\n const note = h(\n "span",\n { class: "internal-note", id: "internal-mode-note", hidden: !opts.flash },\n opts.flash ?? ""\n );\n let clicks = 0;\n let timer = null;\n const reset = () => {\n clicks = 0;\n line.dataset.internalClicks = "0";\n if (timer) {\n clearTimeout(timer);\n timer = null;\n }\n };\n let busy = false;\n line.addEventListener("click", () => {\n if (busy) return;\n clicks += 1;\n line.dataset.internalClicks = String(clicks);\n if (timer) clearTimeout(timer);\n if (clicks >= INTERNAL_CLICKS) {\n reset();\n busy = true;\n const next = !opts.internalMode;\n note.hidden = false;\n note.textContent = next ? "\\u6B63\\u5728\\u5F00\\u542F\\u5185\\u90E8\\u6A21\\u5F0F\\u2026" : "\\u6B63\\u5728\\u5173\\u95ED\\u5185\\u90E8\\u6A21\\u5F0F\\u2026";\n void opts.onToggle(next).then((r) => {\n if (!r.ok) {\n note.textContent = `\\u5185\\u90E8\\u6A21\\u5F0F\\u5207\\u6362\\u5931\\u8D25\\uFF1A${r.error ?? "\\u672A\\u77E5\\u539F\\u56E0"}\\uFF08\\u6587\\u4EF6\\u5199\\u4E0D\\u8FDB\\u53BB\\uFF0C\\u6216 IPC \\u65AD\\u4E86\\uFF09`;\n }\n }).catch((e) => {\n note.textContent = `\\u5185\\u90E8\\u6A21\\u5F0F\\u5207\\u6362\\u5931\\u8D25\\uFF1A${e instanceof Error ? e.message : String(e)}`;\n }).finally(() => {\n busy = false;\n });\n return;\n }\n timer = setTimeout(reset, CLICK_WINDOW_MS);\n });\n return h("div", { class: "settings-footer", id: "settings-footer" }, line, badge, note);\n }\n\n // web-console/desktop/src/renderer/console/pages/settings.ts\n function mountSettings(body, marker, deps, actions) {\n let alive = true;\n let panelCleanup = null;\n let showGen = 0;\n let live = { values: {}, secrets: {} };\n let base = null;\n let currentKey = "general";\n let internalFlash = null;\n const wrap = h(\n "div",\n { class: "page" },\n h("h2", {}, "\\u8BBE\\u7F6E"),\n h("p", { class: "page-sub" }, "\\u88C5\\u5B8C\\u4E4B\\u540E\\u957F\\u671F\\u53EF\\u8C03\\u7684\\u4E1C\\u897F\\u3002\\u6539\\u52A8\\u5199\\u8FDB\\u5F15\\u64CE\\u914D\\u7F6E\\uFF1B\\u6807\\u4E86\\u300C\\u91CD\\u542F\\u540E\\u751F\\u6548\\u300D\\u7684\\u9879\\u8981\\u91CD\\u542F\\u5F15\\u64CE\\u624D\\u751F\\u6548\\u3002"),\n h("div", { class: "cfg-loading" }, "\\u6B63\\u5728\\u8BFB\\u53D6\\u5F15\\u64CE\\u7684\\u5B57\\u6BB5\\u6E05\\u5355\\u2026")\n );\n body.replaceChildren(wrap);\n const nav = h("nav", { class: "subtabs" });\n const slot = h("div", { class: "settings-panel-slot" });\n let tabList = [...PANELS];\n const render = (key) => {\n const panel = tabList.find((p) => p.key === key);\n if (!panel || !base) return;\n panelCleanup = panel.render(slot, { ...base, values: live.values, secrets: live.secrets });\n };\n const markActive = (key) => {\n for (const b of Array.from(nav.children)) {\n b.classList.toggle("active", b.dataset.key === key);\n }\n };\n const show = (key) => {\n const my = ++showGen;\n currentKey = key;\n markActive(key);\n panelCleanup?.();\n panelCleanup = null;\n slot.replaceChildren(h("div", { class: "cfg-loading" }, "\\u6B63\\u5728\\u8BFB\\u53D6\\u5F53\\u524D\\u914D\\u7F6E\\u2026"));\n void (async () => {\n const got = await deps.configGet(marker.configPath).catch(\n (e) => ({\n ok: false,\n values: {},\n secrets: {},\n secretsPath: null,\n error: e instanceof Error ? e.message : String(e)\n })\n );\n if (!alive || my !== showGen) return;\n if (got.ok) live = { values: got.values, secrets: got.secrets };\n render(key);\n })();\n };\n const renderLoadFailure = (msg) => {\n wrap.replaceChildren(\n h("h2", {}, "\\u8BBE\\u7F6E"),\n h(\n "div",\n { class: "inline-error" },\n msg,\n h("div", { class: "cf-hint" }, `\\u914D\\u7F6E\\u6587\\u4EF6\\uFF1A${marker.configPath}`)\n )\n );\n };\n const boot2 = async () => {\n showGen++;\n let pair;\n try {\n pair = await Promise.all([\n deps.configSchema(marker.stateDir),\n deps.configGet(marker.configPath)\n ]);\n } catch (e) {\n if (alive) renderLoadFailure(`\\u8BFB\\u53D6\\u5F15\\u64CE\\u914D\\u7F6E\\u5931\\u8D25\\uFF1A${e instanceof Error ? e.message : String(e)}`);\n return;\n }\n const [schema, got] = pair;\n if (!alive) return;\n if (!schema.ok || !got.ok) {\n wrap.replaceChildren(\n h("h2", {}, "\\u8BBE\\u7F6E"),\n h(\n "div",\n { class: "inline-error" },\n schema.error ?? got.error ?? "\\u914D\\u7F6E\\u9762\\u677F\\u6682\\u65F6\\u4E0D\\u53EF\\u7528\\u3002",\n h(\n "div",\n { class: "cf-hint" },\n `\\u5185\\u7F6E\\u5F15\\u64CE\\u7248\\u672C\\uFF1A${schema.cliVersion ?? "(\\u8BFB\\u4E0D\\u5230)"}\\u3000\\u76EE\\u6807\\u5F15\\u64CE\\u7248\\u672C\\uFF1A${schema.engineVersion ?? "(\\u8BFB\\u4E0D\\u5230)"}\\u3000\\u914D\\u7F6E\\u6587\\u4EF6\\uFF1A${marker.configPath}`\n )\n )\n );\n return;\n }\n live = { values: got.values, secrets: got.secrets };\n base = {\n stateDir: marker.stateDir,\n configPath: marker.configPath,\n fields: schema.fields,\n cliVersion: schema.cliVersion,\n engineVersion: schema.engineVersion,\n internalMode: schema.internalMode === true,\n deps,\n actions\n };\n const tabs = [...PANELS];\n if (otherSections(schema.fields, schema.internalMode === true).length > 0) tabs.push(OTHERS_PANEL);\n tabList = tabs;\n nav.replaceChildren(...tabs.map((p) => h("button", {\n class: "subtab",\n type: "button",\n "data-key": p.key,\n onclick: () => show(p.key)\n }, p.title)));\n const notice = driftNotice(schema.cliVersion, schema.engineVersion);\n wrap.replaceChildren(\n h("h2", {}, "\\u8BBE\\u7F6E"),\n h("p", { class: "page-sub" }, "\\u88C5\\u5B8C\\u4E4B\\u540E\\u957F\\u671F\\u53EF\\u8C03\\u7684\\u4E1C\\u897F\\u3002\\u6539\\u52A8\\u5199\\u8FDB\\u5F15\\u64CE\\u914D\\u7F6E\\uFF1B\\u6807\\u4E86\\u300C\\u91CD\\u542F\\u540E\\u751F\\u6548\\u300D\\u7684\\u9879\\u8981\\u91CD\\u542F\\u5F15\\u64CE\\u624D\\u751F\\u6548\\u3002"),\n ...notice ? [notice] : [],\n nav,\n slot,\n h("button", { class: "settings-mail-link", type: "button", onclick: () => deps.openMail?.() }, "\\u90AE\\u4EF6\\u8FDE\\u63A5", h("span", {}, "QQ\\u3001163\\u3001Gmail \\u203A")),\n // \u5E95\u90E8\u90A3\u884C\u7248\u672C\u6587\u5B57**\u540C\u65F6\u662F\u5185\u90E8\u6A21\u5F0F\u7684\u624B\u52BF\u843D\u70B9**\uFF08\u8FDE\u70B9 7 \u4E0B\uFF09\u2014\u2014\n // \u89C1 console/internal-mode.ts \u7684\u5934\u6CE8\uFF08\u90A3\u662F\u7ED9\u5185\u90E8\u7528\u7684\uFF0C\u4E0D\u662F\u6F0F\u6D1E\uFF09\u3002\n settingsFooter({\n cliVersion: schema.cliVersion,\n engineVersion: schema.engineVersion,\n internalMode: schema.internalMode === true,\n flash: internalFlash,\n onToggle: async (next) => {\n const r = await deps.internalModeSet(next);\n if (!r.ok) return r;\n internalFlash = next ? "\\u5185\\u90E8\\u6A21\\u5F0F\\u5DF2\\u5F00\\u542F\\uFF1A\\u4E0B\\u9762\\u7684\\u5206\\u7EC4\\u4E0E\\u58F0\\u97F3\\u9762\\u677F\\u4F1A\\u591A\\u51FA\\u5185\\u90E8\\u5B57\\u6BB5\\u3002" : "\\u5185\\u90E8\\u6A21\\u5F0F\\u5DF2\\u5173\\u95ED\\u3002";\n await boot2();\n return r;\n }\n })\n );\n const key = tabList.some((p) => p.key === currentKey) ? currentKey : "general";\n currentKey = key;\n markActive(key);\n panelCleanup?.();\n panelCleanup = null;\n render(key);\n };\n void boot2();\n return () => {\n alive = false;\n panelCleanup?.();\n };\n }\n\n // web-console/desktop/src/renderer/console/pages/travel-onboarding.ts\n var errors = {\n invalid_request: "\\u8BF7\\u6838\\u5BF9\\u5730\\u5740\\u3001\\u7AEF\\u53E3\\u548C\\u767B\\u5F55\\u8D44\\u6599\\u3002",\n credentials_required: "\\u8BF7\\u586B\\u5199\\u672C\\u6B21\\u767B\\u5F55\\u5BC6\\u7801\\u6216\\u9009\\u62E9\\u79C1\\u94A5\\u3002",\n ssh_failed: "SSH \\u767B\\u5F55\\u672A\\u6210\\u529F\\uFF0C\\u8BF7\\u6838\\u5BF9\\u5730\\u5740\\u3001\\u8D26\\u53F7\\u548C\\u767B\\u5F55\\u8D44\\u6599\\u3002",\n ssh_timeout: "\\u8FDE\\u63A5\\u8D85\\u65F6\\uFF0C\\u8BF7\\u6838\\u5BF9 SSH \\u7AEF\\u53E3\\u548C\\u7F51\\u7EDC\\u3002",\n ssh_unavailable: "\\u672C\\u673A\\u7F3A\\u5C11 OpenSSH \\u5DE5\\u5177\\u3002",\n host_key_changed: "\\u4E3B\\u673A\\u6307\\u7EB9\\u4E0E\\u5DF2\\u786E\\u8BA4\\u8BB0\\u5F55\\u4E0D\\u540C\\uFF0C\\u8BF7\\u5148\\u6838\\u5BF9\\u4E91\\u673A\\u8EAB\\u4EFD\\u3002",\n unsupported_system: "\\u76EE\\u524D\\u652F\\u6301 Ubuntu 24.04 x64\\u3002",\n unsupported_client: "\\u76EE\\u524D\\u8BF7\\u5728 Mac \\u6D4B\\u8BD5\\u7248\\u63A5\\u5165\\u3002",\n administrator_required: "\\u51C6\\u5907\\u73AF\\u5883\\u9700\\u8981 root \\u6216\\u65E0\\u9700\\u518D\\u6B21\\u8F93\\u5165\\u5BC6\\u7801\\u7684 sudo \\u6743\\u9650\\u3002",\n invalid_key: "\\u79C1\\u94A5\\u6587\\u4EF6\\u4E0D\\u53EF\\u7528\\uFF0C\\u8BF7\\u68C0\\u67E5\\u6587\\u4EF6\\u548C\\u79C1\\u6709\\u6743\\u9650\\u3002",\n directory_conflict: "\\u76EE\\u6807\\u76EE\\u5F55\\u5DF2\\u6709\\u5176\\u4ED6\\u8D44\\u6599\\uFF0C\\u5DF2\\u505C\\u6B62\\u51C6\\u5907\\u3002",\n machine_already_bound: "\\u8FD9\\u4F4D\\u4F19\\u4F34\\u5DF2\\u6709\\u81EA\\u5907\\u4E91\\u673A\\u8BB0\\u5F55\\uFF0C\\u8BF7\\u5148\\u6838\\u5BF9\\u539F\\u673A\\u5668\\u3002",\n artifact_missing: "\\u672C\\u673A\\u5F15\\u64CE\\u5305\\u7F3A\\u5C11\\u51C6\\u5907\\u6240\\u9700\\u6587\\u4EF6\\u3002",\n artifact_mismatch: "\\u8FD0\\u884C\\u73AF\\u5883\\u4E0E\\u56FA\\u5B9A\\u5F15\\u64CE\\u5305\\u4E0D\\u5339\\u914D\\uFF0C\\u5DF2\\u505C\\u6B62\\u51C6\\u5907\\u3002",\n preparation_failed: "\\u4E91\\u673A\\u51C6\\u5907\\u672A\\u5B8C\\u6210\\uFF0C\\u8BF7\\u91CD\\u8BD5\\uFF1B\\u5DF2\\u5B8C\\u6210\\u7684\\u6B65\\u9AA4\\u4F1A\\u4FDD\\u7559\\u3002",\n native_verification_failed: "\\u4E91\\u673A\\u8FD0\\u884C\\u73AF\\u5883\\u9A8C\\u8BC1\\u672A\\u901A\\u8FC7\\uFF0C\\u8BF7\\u91CD\\u8BD5\\u51C6\\u5907\\u3002",\n interrupted: "\\u4E0A\\u6B21\\u51C6\\u5907\\u4E2D\\u65AD\\uFF0C\\u586B\\u5199\\u767B\\u5F55\\u8D44\\u6599\\u540E\\u53EF\\u7EE7\\u7EED\\u539F\\u4EFB\\u52A1\\u3002",\n busy: "\\u6B63\\u5728\\u51C6\\u5907\\u539F\\u4EFB\\u52A1\\uFF0C\\u8BF7\\u7A0D\\u5019\\u3002",\n check_required: "\\u8FDE\\u63A5\\u6838\\u9A8C\\u672A\\u5B8C\\u6210\\uFF0C\\u8BF7\\u91CD\\u8BD5\\u51C6\\u5907\\u4E91\\u673A\\u3002"\n };\n function preparationText(task) {\n if (task.phase === "environment_ready") return "\\u73AF\\u5883\\u5DF2\\u51C6\\u5907\\u3002\\u914D\\u5BF9\\u548C\\u9996\\u6B21\\u8D44\\u6599\\u9A8C\\u8BC1\\u5C1A\\u672A\\u5B8C\\u6210\\uFF0C\\u4F19\\u4F34\\u672A\\u8FC1\\u79FB\\u3002";\n if (task.phase === "failed") return errors[task.error || ""] || "\\u51C6\\u5907\\u672A\\u5B8C\\u6210\\uFF0C\\u539F\\u4EFB\\u52A1\\u5DF2\\u4FDD\\u7559\\uFF0C\\u53EF\\u91CD\\u8BD5\\u3002";\n if (task.phase === "cancelled") return "\\u5DF2\\u505C\\u6B62\\u672C\\u673A\\u540E\\u7EED\\u51C6\\u5907\\u3002\\u4E91\\u7AEF\\u5DF2\\u5F00\\u59CB\\u7684\\u6B65\\u9AA4\\u548C\\u539F\\u4EFB\\u52A1\\u53EF\\u5728\\u91CD\\u8BD5\\u65F6\\u6838\\u9A8C\\u3002";\n return task.phase === "installing" ? "\\u6B63\\u5728\\u5B89\\u88C5\\u4E91\\u673A\\u8FD0\\u884C\\u73AF\\u5883\\u2026" : task.phase === "verifying" ? "\\u6B63\\u5728\\u9A8C\\u8BC1\\u4E91\\u673A\\u662F\\u5426\\u51C6\\u5907\\u5B8C\\u6210\\u2026" : "\\u6B63\\u5728\\u4E0A\\u4F20\\u8FD0\\u884C\\u6587\\u4EF6\\u2026";\n }\n function openTravelOnboarding(stateDir, name, deps, changed) {\n let alive = true, busy = false, keyFile = "", pristine = true, task;\n let attempt = 0, startedAt = 0, cancelling = false, cancelRequested = false, errorShown = false;\n let loading = true, reconfiguring = false, originalReady;\n let timer;\n const host = h("input", { type: "text", autocomplete: "off", placeholder: "IP \\u6216\\u57DF\\u540D", "data-ssh-host": "" });\n const port = h("input", { type: "number", min: 1, max: 65535, value: "22", "data-ssh-port": "" });\n const username = h("input", { type: "text", autocomplete: "off", value: "root", "data-ssh-user": "" });\n const auth = h("select", { "data-ssh-auth": "" }, h("option", { value: "password" }, "\\u767B\\u5F55\\u5BC6\\u7801"), h("option", { value: "key" }, "\\u79C1\\u94A5\\u6587\\u4EF6"));\n const password = h("input", { type: "password", autocomplete: "new-password", "data-ssh-password": "" });\n const passphrase = h("input", { type: "password", autocomplete: "new-password", placeholder: "\\u672A\\u52A0\\u5BC6\\u53EF\\u7559\\u7A7A", "data-ssh-passphrase": "" });\n const keyLabel = h("span", { "data-ssh-key-label": "" }, "\\u5C1A\\u672A\\u9009\\u62E9\\u79C1\\u94A5");\n const keyButton = h("button", { class: "btn", type: "button", onclick: async () => {\n if (busy) return;\n const selected = await deps.pickTravelKey?.();\n if (alive && selected) {\n keyFile = selected;\n keyLabel.textContent = selected.split(/[\\\\/]/).at(-1) || "\\u5DF2\\u9009\\u62E9\\u79C1\\u94A5";\n }\n } }, "\\u9009\\u62E9\\u79C1\\u94A5");\n const passwordRow = h("label", {}, "\\u767B\\u5F55\\u5BC6\\u7801", password);\n const keyRow = h("div", { class: "ssh-key-row", hidden: true }, keyButton, keyLabel, h("label", {}, "\\u79C1\\u94A5\\u89E3\\u9501\\u53E3\\u4EE4", passphrase));\n const status = h("p", { role: "status", "data-ssh-status": "" }, "\\u586B\\u5199\\u767B\\u5F55\\u8D44\\u6599\\u540E\\uFF0C\\u70B9\\u51FB\\u51C6\\u5907\\u4E91\\u673A\\u3002\\u5BC6\\u7801\\u548C\\u89E3\\u9501\\u53E3\\u4EE4\\u4EC5\\u672C\\u6B21\\u4F7F\\u7528\\u3002");\n const estimate = "\\u9996\\u6B21\\u51C6\\u5907\\u8BF7\\u9884\\u7559\\u7EA6 5\\u201315 \\u5206\\u949F\\uFF0C\\u7F51\\u7EDC\\u8F83\\u6162\\u65F6\\u53EF\\u80FD\\u66F4\\u4E45\\u3002\\u91CD\\u8BD5\\u4F1A\\u590D\\u7528\\u5DF2\\u5B8C\\u6210\\u6B65\\u9AA4\\u3002";\n const waitStatus = h("p", { role: "status", "data-ssh-wait-status": "" });\n const elapsed = h("p", { class: "ssh-elapsed", "data-ssh-elapsed": "" });\n const progress = h("progress", { max: 4, value: 0, "aria-label": "\\u5DF2\\u5B8C\\u6210\\u7684\\u51C6\\u5907\\u9636\\u6BB5", "data-ssh-progress": "" });\n const steps = ["\\u8FDE\\u63A5\\u4E91\\u673A", "\\u4E0A\\u4F20\\u6587\\u4EF6", "\\u5B89\\u88C5\\u73AF\\u5883", "\\u9A8C\\u8BC1\\u7ED3\\u679C"].map((label) => h("li", {}, label));\n const prepare = h("button", { class: "btn btn-primary", type: "submit", "data-ssh-prepare": "" }, "\\u51C6\\u5907\\u4E91\\u673A");\n const cancel = h("button", { class: "btn", type: "button", "data-ssh-cancel": "", onclick: async () => {\n if (!alive || cancelling || cancelRequested) return;\n attempt++;\n cancelling = true;\n cancelRequested = true;\n busy = false;\n password.value = "";\n passphrase.value = "";\n report("\\u6B63\\u5728\\u53D6\\u6D88\\u51C6\\u5907\\u2026");\n try {\n const r = await deps.travelOnboarding(stateDir, "cancel");\n if (!alive) return;\n if (!r?.ok) {\n cancelRequested = false;\n report("\\u53D6\\u6D88\\u672A\\u6210\\u529F\\uFF0C\\u8BF7\\u518D\\u8BD5\\u4E00\\u6B21\\u3002", true);\n return;\n }\n task = r.task;\n if (task?.phase === "environment_ready") {\n reconfiguring = false;\n originalReady = void 0;\n }\n if (isActive()) report("\\u6B63\\u5728\\u53D6\\u6D88\\u51C6\\u5907\\uFF0C\\u7B49\\u5F85\\u5F53\\u524D\\u6B65\\u9AA4\\u9000\\u51FA\\u2026");\n else {\n cancelRequested = false;\n report(task?.phase === "environment_ready" ? preparationText(task) : "\\u5DF2\\u53D6\\u6D88\\u51C6\\u5907\\u3002\\u5DF2\\u5B8C\\u6210\\u7684\\u6B65\\u9AA4\\u4F1A\\u4FDD\\u7559\\u3002");\n }\n schedule();\n } catch {\n if (alive) {\n cancelRequested = false;\n report("\\u6682\\u65F6\\u65E0\\u6CD5\\u53D6\\u6D88\\u51C6\\u5907\\uFF0C\\u8BF7\\u68C0\\u67E5\\u8FDE\\u63A5\\u540E\\u91CD\\u8BD5\\u3002", true);\n }\n } finally {\n if (alive) {\n cancelling = false;\n update();\n }\n }\n } }, "\\u53D6\\u6D88\\u51C6\\u5907");\n const waiting = h(\n "div",\n { class: "ssh-wait-mask", hidden: true, "data-ssh-wait": "" },\n h(\n "section",\n { class: "ssh-wait-card", role: "dialog", "aria-modal": "true", "aria-labelledby": "ssh-wait-title" },\n h("h2", { id: "ssh-wait-title" }, "\\u6B63\\u5728\\u51C6\\u5907\\u4E91\\u673A"),\n waitStatus,\n progress,\n h("ol", { class: "ssh-wait-steps" }, ...steps),\n h("p", { "data-ssh-estimate": "" }, estimate),\n elapsed,\n h("div", { class: "btn-row" }, cancel)\n )\n );\n const close = () => {\n alive = false;\n attempt++;\n password.value = "";\n passphrase.value = "";\n keyFile = "";\n if (timer) clearTimeout(timer);\n clearInterval(elapsedTimer);\n modal.close();\n changed();\n };\n const closeButton = h("button", { class: "btn", type: "button", "data-ssh-close": "", onclick: () => {\n if (reconfiguring && !busy && !isActive()) {\n task = originalReady;\n originalReady = void 0;\n reconfiguring = false;\n password.value = "";\n passphrase.value = "";\n keyFile = "";\n update();\n } else close();\n } }, "\\u5173\\u95ED");\n const form = h(\n "form",\n { class: "travel-connect-form travel-onboarding-form", "data-ssh-form": "" },\n h("h2", {}, `\\u4E3A${name}\\u63A5\\u5165\\u81EA\\u5907\\u4E91\\u673A`),\n h("p", { class: "page-sub" }, "\\u6D4B\\u8BD5\\u7248 \\xB7 Ubuntu 24.04 x64\\u3002\\u51C6\\u5907\\u5B8C\\u6210\\u540E\\uFF0C\\u4F19\\u4F34\\u4ECD\\u5728\\u5F53\\u524D\\u8FD0\\u884C\\u4F4D\\u7F6E\\u3002"),\n h("label", {}, "\\u4E91\\u673A\\u5730\\u5740", host),\n h("div", { class: "ssh-address-row" }, h("label", {}, "SSH \\u7AEF\\u53E3", port), h("label", {}, "\\u7528\\u6237\\u540D", username)),\n h("label", {}, "\\u767B\\u5F55\\u65B9\\u5F0F", auth),\n passwordRow,\n keyRow,\n status,\n h("p", { class: "ssh-estimate" }, estimate),\n h("div", { class: "btn-row" }, closeButton, prepare)\n );\n const readyHost = h("p", { "data-ssh-ready-host": "" });\n const readyVersion = h("p", { "data-ssh-ready-version": "" });\n const ready = h(\n "section",\n { class: "travel-connect-form ssh-ready-summary", hidden: true, "data-ssh-ready": "" },\n h("h2", {}, "\\u73AF\\u5883\\u5DF2\\u51C6\\u5907"),\n h("p", {}, `${name}\\u7684\\u81EA\\u5907\\u4E91\\u673A`),\n readyHost,\n readyVersion,\n h("p", { role: "status" }, "\\u914D\\u5BF9\\u548C\\u9996\\u6B21\\u8D44\\u6599\\u9A8C\\u8BC1\\u5C1A\\u672A\\u5B8C\\u6210\\uFF0C\\u4F19\\u4F34\\u672A\\u8FC1\\u79FB\\u3002"),\n h(\n "div",\n { class: "btn-row" },\n h("button", { class: "btn", type: "button", "data-ssh-reprepare": "", onclick: () => {\n if (!alive || task?.phase !== "environment_ready") return;\n originalReady = task;\n reconfiguring = true;\n password.value = "";\n passphrase.value = "";\n keyFile = "";\n keyLabel.textContent = "\\u5C1A\\u672A\\u9009\\u62E9\\u79C1\\u94A5";\n update();\n password.focus();\n } }, "\\u91CD\\u65B0\\u51C6\\u5907\\u73AF\\u5883"),\n h("button", { class: "btn btn-primary", type: "button", "data-ssh-ready-close": "", onclick: close }, "\\u5173\\u95ED")\n )\n );\n const loadingView = h("section", { class: "travel-connect-form", role: "status" }, "\\u6B63\\u5728\\u8BFB\\u53D6\\u4E91\\u673A\\u72B6\\u6001\\u2026");\n const modal = openModal(h("div", { class: "travel-onboarding-shell" }, loadingView, ready, form, waiting));\n const isActive = () => !!task && ["preparing", "installing", "verifying"].includes(task.phase);\n const updateElapsed = () => {\n if (!startedAt) {\n elapsed.textContent = "";\n return;\n }\n const seconds = Math.max(0, Math.floor((Date.now() - startedAt) / 1e3));\n elapsed.textContent = `\\u5DF2\\u7B49\\u5F85 ${seconds >= 60 ? `${Math.floor(seconds / 60)} \\u5206 ${seconds % 60} \\u79D2` : `${seconds} \\u79D2`}`;\n if (seconds >= 900) elapsed.textContent += " \\xB7 \\u6BD4\\u9884\\u7559\\u65F6\\u95F4\\u66F4\\u4E45\\uFF0C\\u4ECD\\u5728\\u7B49\\u5F85\\u5F53\\u524D\\u6B65\\u9AA4\\u3002";\n };\n const elapsedTimer = setInterval(updateElapsed, 1e3);\n const update = () => {\n const locked = busy || isActive() || cancelling;\n const completedView = task?.phase === "environment_ready" && !reconfiguring;\n form.hidden = loading || completedView;\n ready.hidden = !completedView;\n loadingView.hidden = !loading;\n for (const element of [host, port, username, auth, password, passphrase, keyButton]) element.disabled = loading || locked || completedView;\n for (const element of [host, port, username]) element.readOnly = reconfiguring;\n prepare.disabled = loading || locked || completedView;\n prepare.textContent = locked ? "\\u6B63\\u5728\\u51C6\\u5907\\u2026" : reconfiguring ? "\\u91CD\\u65B0\\u51C6\\u5907\\u73AF\\u5883" : "\\u51C6\\u5907\\u4E91\\u673A";\n closeButton.textContent = reconfiguring ? "\\u8FD4\\u56DE" : "\\u5173\\u95ED";\n if (completedView && task) {\n password.value = "";\n passphrase.value = "";\n keyFile = "";\n keyLabel.textContent = "\\u5C1A\\u672A\\u9009\\u62E9\\u79C1\\u94A5";\n readyHost.textContent = `\\u4E91\\u673A\\uFF1A${task.host} \\xB7 SSH ${task.port}`;\n readyVersion.textContent = task.version ? `\\u8FD0\\u884C\\u73AF\\u5883\\uFF1A${task.version}` : "";\n }\n form.setAttribute("aria-busy", String(locked));\n form.inert = locked;\n waiting.hidden = !locked;\n status.dataset.error = String(errorShown);\n status.setAttribute("role", errorShown ? "alert" : "status");\n waitStatus.textContent = status.textContent;\n waitStatus.dataset.error = String(errorShown);\n waitStatus.setAttribute("role", errorShown ? "alert" : "status");\n cancel.disabled = cancelling || cancelRequested;\n cancel.textContent = cancel.disabled ? "\\u6B63\\u5728\\u53D6\\u6D88\\u2026" : "\\u53D6\\u6D88\\u51C6\\u5907";\n const completed = busy ? 0 : task?.phase === "environment_ready" ? 4 : task?.phase === "verifying" ? 3 : task?.phase === "installing" ? 2 : task ? 1 : 0;\n progress.value = completed;\n progress.setAttribute("aria-valuetext", `\\u5DF2\\u5B8C\\u6210 ${completed} / 4 \\u4E2A\\u9636\\u6BB5`);\n steps.forEach((step, i) => {\n step.dataset.state = i < completed ? "done" : i === completed ? "current" : "pending";\n step.setAttribute("aria-current", String(i === completed && locked));\n });\n updateElapsed();\n if (locked) {\n form.scrollTop = 0;\n if (!cancel.disabled) cancel.focus({ preventScroll: true });\n }\n };\n const report = (message, failed = false) => {\n status.textContent = message;\n errorShown = failed;\n update();\n };\n const fields = () => ({ host: host.value.trim(), port: Number(port.value), username: username.value.trim(), auth: auth.value });\n const changedFields = () => {\n pristine = false;\n update();\n };\n for (const field of [host, port, username]) field.addEventListener("input", changedFields);\n auth.onchange = () => {\n password.value = "";\n passphrase.value = "";\n keyFile = "";\n keyLabel.textContent = "\\u5C1A\\u672A\\u9009\\u62E9\\u79C1\\u94A5";\n passwordRow.hidden = auth.value === "key";\n keyRow.hidden = auth.value !== "key";\n pristine = false;\n };\n form.onsubmit = (event) => {\n event.preventDefault();\n if (!alive || busy || prepare.disabled) return;\n const target = fields();\n if (!target.host || !target.username || !Number.isInteger(target.port) || target.port < 1 || target.port > 65535) {\n report(errors.invalid_request, true);\n (!target.host ? host : !target.username ? username : port).focus();\n return;\n }\n if (auth.value === "key" ? !keyFile : !password.value) {\n report(errors.credentials_required, true);\n (auth.value === "key" ? keyButton : password).focus();\n return;\n }\n const input = { ...target, ...auth.value === "key" ? { keyFile, passphrase: passphrase.value } : { password: password.value } };\n const preparationAction = reconfiguring ? "reprepare" : "prepare";\n const currentAttempt = ++attempt;\n task = void 0;\n startedAt = Date.now();\n cancelRequested = false;\n password.value = "";\n passphrase.value = "";\n busy = true;\n pristine = false;\n report("\\u6B63\\u5728\\u8FDE\\u63A5\\u4E91\\u673A\\u2026");\n void (async () => {\n try {\n const inspected = await deps.travelOnboarding(stateDir, "check", target);\n if (!alive || currentAttempt !== attempt) return;\n if (!inspected.ok || !inspected.fingerprint) {\n report(errors[inspected.error || ""] || "\\u8FDE\\u63A5\\u672A\\u6210\\u529F\\uFF0C\\u8BF7\\u91CD\\u8BD5\\u51C6\\u5907\\u4E91\\u673A\\u3002", true);\n return;\n }\n input.fingerprint = inspected.fingerprint;\n const checked = await deps.travelOnboarding(stateDir, "check", input);\n if (!alive || currentAttempt !== attempt) return;\n if (!checked.ok || checked.phase !== "checked") {\n report(errors[checked.error || ""] || "\\u8FDE\\u63A5\\u672A\\u6210\\u529F\\uFF0C\\u8BF7\\u91CD\\u8BD5\\u51C6\\u5907\\u4E91\\u673A\\u3002", true);\n return;\n }\n const result = await deps.travelOnboarding(stateDir, preparationAction, input);\n if (!alive || currentAttempt !== attempt) return;\n if (!result.ok) {\n report(errors[result.error || ""] || "\\u51C6\\u5907\\u672A\\u5B8C\\u6210\\uFF0C\\u8BF7\\u91CD\\u8BD5\\u3002", true);\n return;\n }\n task = result.task;\n reconfiguring = false;\n originalReady = void 0;\n if (task) {\n startedAt = task.startedAt || startedAt;\n report(preparationText(task), task.phase === "failed");\n }\n ;\n changed();\n schedule();\n } catch {\n if (alive && currentAttempt === attempt) report("\\u51C6\\u5907\\u672A\\u5B8C\\u6210\\uFF0C\\u539F\\u4EFB\\u52A1\\u53EF\\u5728\\u91CD\\u65B0\\u6253\\u5F00\\u540E\\u67E5\\u770B\\u3002", true);\n } finally {\n input.password = void 0;\n input.passphrase = void 0;\n if (alive && currentAttempt === attempt) {\n busy = false;\n update();\n }\n }\n })();\n };\n const schedule = () => {\n if (timer) clearTimeout(timer);\n if (alive && task && ["preparing", "installing", "verifying"].includes(task.phase)) timer = setTimeout(() => {\n void refresh();\n }, 1e3);\n };\n const refresh = async () => {\n const currentAttempt = attempt;\n try {\n const r = await deps.travelOnboarding(stateDir, "status");\n if (!alive || currentAttempt !== attempt || busy) return;\n loading = false;\n if (!r.ok) {\n report("\\u6682\\u65F6\\u65E0\\u6CD5\\u8BFB\\u53D6\\u51C6\\u5907\\u8FDB\\u5EA6\\uFF0C\\u6B63\\u5728\\u91CD\\u65B0\\u8FDE\\u63A5\\u3002\\u4F60\\u53EF\\u4EE5\\u53D6\\u6D88\\u51C6\\u5907\\u3002", true);\n schedule();\n return;\n }\n if (!r.task) {\n update();\n return;\n }\n task = r.task;\n if (task.startedAt) startedAt = task.startedAt;\n else if (isActive() && !startedAt) startedAt = Date.now();\n if (!isActive()) cancelRequested = false;\n if (pristine) {\n host.value = task.host;\n port.value = String(task.port);\n username.value = task.username;\n }\n report(cancelRequested && isActive() ? "\\u6B63\\u5728\\u53D6\\u6D88\\u51C6\\u5907\\uFF0C\\u7B49\\u5F85\\u5F53\\u524D\\u6B65\\u9AA4\\u9000\\u51FA\\u2026" : preparationText(task), task.phase === "failed");\n schedule();\n } catch {\n if (alive && currentAttempt === attempt && !busy) {\n loading = false;\n report("\\u6682\\u65F6\\u65E0\\u6CD5\\u8BFB\\u53D6\\u51C6\\u5907\\u8FDB\\u5EA6\\uFF0C\\u6B63\\u5728\\u91CD\\u65B0\\u8FDE\\u63A5\\u3002\\u4F60\\u53EF\\u4EE5\\u53D6\\u6D88\\u51C6\\u5907\\u3002", true);\n schedule();\n }\n }\n };\n update();\n void refresh();\n host.focus();\n return { close };\n }\n\n // web-console/desktop/src/renderer/console/pages/travel.ts\n var errors2 = {\n service_unavailable: "\\u6682\\u65F6\\u8054\\u7CFB\\u4E0D\\u4E0A\\u968F\\u884C\\u673A\\u3002\\u5DF2\\u4FDD\\u7559\\u4E0A\\u6B21\\u72B6\\u6001\\uFF0C\\u8BF7\\u7A0D\\u540E\\u5237\\u65B0\\u3002",\n invalid_connection: "\\u8BF7\\u586B\\u5199\\u6B63\\u786E\\u7684 HTTPS \\u670D\\u52A1\\u5730\\u5740\\u548C\\u8FDE\\u63A5\\u7801\\u3002",\n wrong_partner: "\\u8FD9\\u4EFD\\u8FDE\\u63A5\\u4FE1\\u606F\\u5C5E\\u4E8E\\u53E6\\u4E00\\u4F4D\\u4F19\\u4F34\\u6216\\u673A\\u4F4D\\uFF0C\\u8BF7\\u6838\\u5BF9\\u540E\\u518D\\u8FDE\\u63A5\\u3002",\n setup_required: "\\u8FD9\\u4F4D\\u4F19\\u4F34\\u7684\\u968F\\u884C\\u8D44\\u6599\\u8FD8\\u672A\\u51C6\\u5907\\u597D\\u3002\\u8BF7\\u5148\\u5B8C\\u6210\\u968F\\u884C\\u673A\\u914D\\u5BF9\\uFF0C\\u518D\\u8FDE\\u63A5\\u3002",\n invalid_profile: "\\u968F\\u884C\\u8FDE\\u63A5\\u8D44\\u6599\\u6682\\u65F6\\u4E0D\\u53EF\\u7528\\uFF0C\\u8BF7\\u68C0\\u67E5\\u6216\\u91CD\\u65B0\\u8FDE\\u63A5\\u3002",\n invalid_response: "\\u5C1A\\u672A\\u53D6\\u5F97\\u53EF\\u6838\\u9A8C\\u7684\\u968F\\u884C\\u72B6\\u6001\\uFF0C\\u8BF7\\u7A0D\\u540E\\u5237\\u65B0\\u3002",\n recovery_required: "\\u672C\\u5730\\u8D44\\u6599\\u8FD8\\u6CA1\\u6709\\u5B8C\\u6210\\u6062\\u590D\\u9A8C\\u8BC1\\uFF0C\\u4E91\\u7AEF\\u8D44\\u6599\\u5DF2\\u4FDD\\u7559\\u3002\\u8BF7\\u5148\\u5728\\u7535\\u8111\\u7AEF\\u751F\\u6210\\u672C\\u5730\\u526F\\u672C\\u3002",\n recovery_unavailable: "\\u8BF7\\u5728\\u5DF2\\u7ECF\\u63A5\\u56DE\\u7684\\u7535\\u8111\\u4E0A\\u751F\\u6210\\u672C\\u5730\\u526F\\u672C\\uFF0C\\u518D\\u56DE\\u5230\\u8FD9\\u91CC\\u7ED3\\u675F\\u968F\\u884C\\u3002",\n confirmation_required: "\\u8BF7\\u5148\\u786E\\u8BA4\\u662F\\u5426\\u7ED3\\u675F\\u968F\\u884C\\u3002",\n busy: "\\u6B63\\u5728\\u5B8C\\u6210\\u5F53\\u524D\\u64CD\\u4F5C\\uFF0C\\u8BF7\\u7A0D\\u5019\\u518D\\u8BD5\\u3002",\n not_ready: "\\u76EE\\u6807\\u673A\\u4F4D\\u8FD8\\u672A\\u51C6\\u5907\\u597D\\uFF0C\\u5F53\\u524D\\u4F19\\u4F34\\u4FDD\\u6301\\u539F\\u8FD0\\u884C\\u4F4D\\u7F6E\\u3002",\n retired: "\\u8FD9\\u6B21\\u968F\\u884C\\u5DF2\\u7ECF\\u7ED3\\u675F\\uFF0C\\u8BF7\\u8FDE\\u63A5\\u65B0\\u7684\\u968F\\u884C\\u673A\\u4F4D\\u3002"\n };\n var phases = {\n REQUESTED: "\\u5DF2\\u767B\\u8BB0\\uFF0C\\u7B49\\u5F85\\u63A5\\u7EED",\n PREPARING: "\\u6B63\\u5728\\u51C6\\u5907\\u4EA4\\u63A5",\n FROZEN_AT_H: "\\u6B63\\u5728\\u540C\\u6B65\\u5DF2\\u786E\\u8BA4\\u8D44\\u6599",\n TARGET_READY: "\\u76EE\\u6807\\u673A\\u4F4D\\u5DF2\\u51C6\\u5907\\u597D",\n COMMITTED: "\\u8FD0\\u884C\\u4F4D\\u7F6E\\u5DF2\\u4EA4\\u63A5\\uFF0C\\u6B63\\u5728\\u786E\\u8BA4\\u8FDB\\u7A0B",\n DONE: "\\u4EA4\\u63A5\\u5B8C\\u6210",\n ABORTED: "\\u672C\\u6B21\\u4EA4\\u63A5\\u5DF2\\u53D6\\u6D88",\n RETIRING: "\\u6B63\\u5728\\u505C\\u6B62\\u968F\\u884C\\u8282\\u70B9",\n RECOVERY_ONLY: "\\u7B49\\u5F85\\u672C\\u5730\\u6062\\u590D\\u5B8C\\u6210",\n PURGING: "\\u6B63\\u5728\\u6E05\\u7406\\u4E91\\u7AEF\\u8D44\\u6599",\n KEY_DELETION_PENDING: "\\u6B63\\u5728\\u64A4\\u9500\\u4E91\\u7AEF\\u6388\\u6743",\n PURGED: "\\u5DF2\\u7ED3\\u675F\\u968F\\u884C"\n };\n var labels = { to_cloud: "\\u8F6C\\u5230\\u4E91\\u7AEF", to_local: "\\u63A5\\u56DE\\u7535\\u8111", recover: "\\u751F\\u6210\\u672C\\u5730\\u526F\\u672C", finish: "\\u7ED3\\u675F\\u968F\\u884C" };\n function mountTravel(body, marker, deps) {\n let alive = true, generation = 0, snapshot, connected = false, busy = false, stale = false, message = "", name = "\\u4F19\\u4F34";\n let timer;\n let modal;\n let onboarding, preparation;\n let preparationTimer, preparationGeneration = 0;\n const wrap = h("div", { class: "page travel-page" });\n body.replaceChildren(wrap);\n const allowed = (action) => !!snapshot && snapshot.allowedActions.includes(action) && !busy && !stale;\n const refreshPreparation = async () => {\n if (!alive || !deps.travelOnboarding) return;\n if (preparationTimer) clearTimeout(preparationTimer);\n const gen = ++preparationGeneration;\n try {\n const r = await deps.travelOnboarding(marker.stateDir, "status");\n if (!alive || gen !== preparationGeneration || !r.ok) return;\n preparation = r.task;\n if (!busy) paint();\n } catch {\n }\n if (alive && gen === preparationGeneration && preparation && ["preparing", "installing", "verifying"].includes(preparation.phase)) preparationTimer = setTimeout(() => {\n void refreshPreparation();\n }, 2e3);\n };\n const onboardingButton = (primary = false) => deps.travelOnboarding ? h("button", { class: "btn" + (primary ? " btn-primary" : ""), type: "button", "data-travel-onboard": "", onclick: () => {\n onboarding?.close();\n onboarding = openTravelOnboarding(marker.stateDir, name, { travelOnboarding: deps.travelOnboarding, pickTravelKey: deps.pickTravelKey }, () => {\n if (alive) void refreshPreparation();\n });\n } }, preparation ? "\\u67E5\\u770B\\u81EA\\u5907\\u4E91\\u673A" : "\\u63A5\\u5165\\u81EA\\u5907\\u4E91\\u673A") : null;\n const perform = async (action, payload) => {\n if (!alive || busy) return;\n busy = true;\n message = "";\n const gen = ++generation;\n paint();\n try {\n const result = await deps.travelControl(marker.stateDir, action, payload);\n if (!alive || gen !== generation) return;\n const incomplete = result.snapshot?.active === "unknown";\n if (result.snapshot) {\n const prior = snapshot;\n snapshot = result.snapshot;\n if (incomplete && prior) snapshot = { ...snapshot, active: prior.active, peers: prior.peers, checkedAt: prior.checkedAt };\n }\n if (result.ok) {\n connected = result.connected !== false;\n stale = incomplete;\n } else {\n message = errors2[result.error || ""] || "\\u8FD9\\u6B21\\u64CD\\u4F5C\\u5C1A\\u672A\\u5B8C\\u6210\\uFF0C\\u8BF7\\u5237\\u65B0\\u540E\\u91CD\\u8BD5\\u3002";\n stale = ["service_unavailable", "invalid_response", "wrong_partner", "invalid_profile"].includes(result.error || "");\n }\n if (result.ok && !connected) snapshot = void 0;\n } catch {\n if (alive && gen === generation) {\n message = errors2.service_unavailable;\n stale = true;\n }\n } finally {\n if (alive && gen === generation) {\n busy = false;\n paint();\n schedule();\n if (action !== "status") deps.onStateChanged?.();\n }\n }\n };\n const schedule = () => {\n if (timer) clearTimeout(timer);\n if (!alive || !connected) return;\n timer = setTimeout(() => {\n if (!busy) void perform("status");\n else schedule();\n }, 5e3);\n };\n const connection = () => {\n const address = h("input", { type: "url", autocomplete: "url", placeholder: "https://\\u2026/travel/console/v1", "data-travel-endpoint": "", required: true });\n const code = h("input", { type: "password", autocomplete: "off", "data-travel-code": "", required: true });\n const form = h(\n "form",\n { class: "travel-connect-form" },\n h("h2", {}, "\\u8FDE\\u63A5\\u5DF2\\u914D\\u5BF9\\u7684\\u968F\\u884C\\u673A"),\n h("p", {}, "\\u7BA1\\u7406\\u5458\\u4F7F\\u7528\\u5DF2\\u90E8\\u7F72\\u3001\\u5DF2\\u914D\\u5BF9\\u7684\\u8FDE\\u63A5\\u4FE1\\u606F\\u3002\\u9996\\u6B21\\u63A5\\u5165\\u4E91\\u673A\\u8BF7\\u4F7F\\u7528\\u201C\\u63A5\\u5165\\u81EA\\u5907\\u4E91\\u673A\\u201D\\u3002"),\n h("label", {}, "\\u670D\\u52A1\\u5730\\u5740", address),\n h("label", {}, "\\u8FDE\\u63A5\\u7801", code),\n h(\n "div",\n { class: "btn-row" },\n h("button", { class: "btn", type: "button", onclick: () => {\n modal?.close();\n modal = void 0;\n } }, "\\u53D6\\u6D88"),\n h("button", { class: "btn btn-primary", type: "submit", "data-travel-submit-connect": "" }, "\\u8FDE\\u63A5")\n )\n );\n form.onsubmit = (event) => {\n event.preventDefault();\n const payload = { endpoint: address.value.trim(), code: code.value.trim() };\n code.value = "";\n modal?.close();\n modal = void 0;\n void perform("connect", payload);\n };\n modal = openModal(form);\n address.focus();\n };\n const confirmFinish = () => {\n const content = h(\n "div",\n { class: "travel-confirm" },\n h("h2", {}, "\\u7ED3\\u675F\\u8FD9\\u4F4D\\u4F19\\u4F34\\u7684\\u968F\\u884C\\uFF1F"),\n h("p", {}, "\\u5B8C\\u6210\\u672C\\u5730\\u6062\\u590D\\u9A8C\\u8BC1\\u540E\\uFF0C\\u624D\\u4F1A\\u6E05\\u7406\\u8FD9\\u6B21\\u968F\\u884C\\u7684\\u4E91\\u7AEF\\u8D44\\u6599\\u5E76\\u64A4\\u9500\\u673A\\u4F4D\\u6388\\u6743\\u3002\\u7535\\u8111\\u4E0A\\u7684\\u666E\\u901A\\u526F\\u672C\\u4F1A\\u4FDD\\u7559\\u3002"),\n h("p", {}, snapshot?.recovery === "ready" ? "\\u666E\\u901A\\u672C\\u5730\\u526F\\u672C\\u5DF2\\u901A\\u8FC7\\u6062\\u590D\\u9A8C\\u8BC1\\u3002" : "\\u672C\\u5730\\u6062\\u590D\\u5C1A\\u672A\\u5B8C\\u6210\\uFF0C\\u4E91\\u7AEF\\u8D44\\u6599\\u4F1A\\u7EE7\\u7EED\\u4FDD\\u7559\\u3002"),\n h(\n "div",\n { class: "btn-row" },\n h("button", { class: "btn", type: "button", onclick: () => {\n modal?.close();\n modal = void 0;\n } }, "\\u7EE7\\u7EED\\u968F\\u884C"),\n h("button", { class: "btn btn-danger", type: "button", "data-travel-confirm-finish": "", onclick: () => {\n modal?.close();\n modal = void 0;\n void perform("finish", { confirmed: true });\n } }, "\\u786E\\u8BA4\\u7ED3\\u675F")\n )\n );\n modal = openModal(content);\n };\n const button = (action, primary = false) => h("button", {\n class: "btn" + (primary ? " btn-primary" : action === "finish" ? " btn-danger" : ""),\n type: "button",\n "data-travel-action": action,\n disabled: !allowed(action),\n onclick: () => action === "finish" ? confirmFinish() : void perform(action, { requestId: crypto.randomUUID() })\n }, labels[action] || action);\n const paint = () => {\n if (!alive) return;\n const ended = snapshot?.retirement?.state === "PURGED";\n const presence = ended ? "\\u5DF2\\u7ED3\\u675F\\u968F\\u884C" : snapshot?.active === "cloud" ? `${name}\\u5728\\u4E91\\u7AEF\\u3002` : snapshot?.active === "local" ? `${name}\\u5728\\u7535\\u8111\\u4E0A\\u3002` : snapshot?.active === "none" ? "\\u5F53\\u524D\\u6CA1\\u6709\\u5DF2\\u786E\\u8BA4\\u7684\\u8FD0\\u884C\\u8282\\u70B9\\u3002" : "\\u6B63\\u5728\\u6838\\u5BF9\\u8FD0\\u884C\\u4F4D\\u7F6E\\u3002";\n const heading = h(\n "div",\n { class: "travel-heading" },\n h(\n "div",\n {},\n h("p", { class: "travel-eyebrow" }, "\\u76F8\\u4F34\\uFF0C\\u968F\\u4F60\\u800C\\u884C"),\n h("h2", {}, "\\u968F\\u884C"),\n h("p", { class: "page-sub" }, "\\u7535\\u8111\\u5408\\u4E0A\\u540E\\uFF0C\\u4F19\\u4F34\\u4ECD\\u53EF\\u5728\\u4E91\\u7AEF\\u4E0E\\u4F60\\u76F8\\u4F34\\u3002")\n ),\n h("button", { class: "btn", type: "button", "data-travel-refresh": "", disabled: busy, onclick: () => {\n void perform("status");\n } }, busy ? "\\u6B63\\u5728\\u6838\\u5BF9\\u2026" : "\\u5237\\u65B0\\u72B6\\u6001")\n );\n const notices = message ? [h("p", { class: "travel-notice" + (stale ? " stale" : ""), role: "status" }, message)] : [];\n if (!connected && !snapshot) {\n wrap.replaceChildren(heading, ...notices, h(\n "section",\n { class: "travel-intro" },\n h("div", { class: "travel-intro-mark", "aria-hidden": "true" }, navIcon("travel")),\n h("h3", {}, "\\u51FA\\u5DEE\\u3001\\u65C5\\u884C\\uFF0C\\u4E5F\\u80FD\\u7EE7\\u7EED\\u76F8\\u4F34\\u3002"),\n h("p", {}, deps.travelOnboarding ? "\\u586B\\u5199\\u4E91\\u673A IP \\u548C SSH \\u767B\\u5F55\\u8D44\\u6599\\uFF0C\\u5148\\u51C6\\u5907\\u4E91\\u673A\\u3002\\u4F19\\u4F34\\u7EE7\\u7EED\\u5728\\u5F53\\u524D\\u7684\\u4F4D\\u7F6E\\u8FD0\\u884C\\u3002" : "\\u968F\\u884C\\u9996\\u6B21\\u63A5\\u5165\\u5C1A\\u672A\\u5F00\\u653E\\u3002\\u5DF2\\u7ECF\\u7531\\u7BA1\\u7406\\u5458\\u5B8C\\u6210\\u914D\\u5BF9\\u7684\\u673A\\u4F4D\\u53EF\\u5728\\u4E0B\\u65B9\\u8FDE\\u63A5\\u3002"),\n ...preparation ? [h("p", { role: "status", "data-travel-preparation": "" }, preparationText(preparation))] : [],\n h("div", { class: "btn-row" }, onboardingButton(true)),\n h(\n "details",\n { class: "travel-admin" },\n h("summary", {}, "\\u7BA1\\u7406\\u5458\\uFF1A\\u8FDE\\u63A5\\u5DF2\\u914D\\u5BF9\\u673A\\u4F4D"),\n h("button", { class: "btn", type: "button", disabled: busy, "data-travel-connect": "", onclick: connection }, "\\u8FDE\\u63A5\\u5DF2\\u914D\\u5BF9\\u7684\\u968F\\u884C\\u673A")\n )\n ));\n return;\n }\n const peers = h("div", { class: "travel-peers" }, ...(snapshot?.peers || []).map((peer) => h(\n "section",\n {\n class: "travel-peer",\n "data-travel-peer": peer.role,\n "data-running": String(peer.running),\n "data-active": String(snapshot?.active === peer.role)\n },\n h("span", { class: "travel-peer-kind" }, peer.role === "local" ? "\\u7535\\u8111" : "\\u4E91\\u7AEF"),\n h("h3", {}, peer.label),\n h("p", { class: "travel-peer-presence" }, stale ? "\\u72B6\\u6001\\u672A\\u66F4\\u65B0" : peer.running ? "\\u6B63\\u5728\\u8FD0\\u884C" : peer.connected ? "\\u5DF2\\u8FDE\\u63A5\\uFF0C\\u7B49\\u5F85\\u63A5\\u7EED" : "\\u6682\\u672A\\u8FDE\\u63A5"),\n h("p", { class: "page-sub" }, peer.busy ? "\\u6B63\\u5728\\u5904\\u7406\\u5F53\\u524D\\u5DE5\\u4F5C" : peer.role === "local" ? "\\u63A5\\u56DE\\u540E\\uFF0C\\u53EF\\u4EE5\\u7EE7\\u7EED\\u5728\\u7535\\u8111\\u4E0A\\u4F7F\\u7528\\u3002" : "\\u7535\\u8111\\u4F11\\u606F\\u65F6\\uFF0C\\u4E5F\\u53EF\\u4EE5\\u7EE7\\u7EED\\u5728\\u7EBF\\u3002")\n )));\n const auto = h("button", {\n class: "btn travel-auto",\n type: "button",\n role: "switch",\n "aria-checked": String(snapshot?.enabled === true),\n disabled: !allowed(snapshot?.enabled ? "auto_off" : "auto_on"),\n onclick: () => {\n void perform(snapshot?.enabled ? "auto_off" : "auto_on");\n }\n }, snapshot?.enabled ? "\\u81EA\\u52A8\\u63A5\\u7EED\\uFF1A\\u5DF2\\u5F00\\u542F" : "\\u81EA\\u52A8\\u63A5\\u7EED\\uFF1A\\u5DF2\\u5173\\u95ED");\n const transfer = snapshot?.transfer;\n const retirement = snapshot?.retirement;\n wrap.replaceChildren(\n heading,\n ...notices,\n h(\n "section",\n { class: "travel-presence", "data-stale": String(stale) },\n h("span", { class: "travel-presence-dot", "aria-hidden": "true" }),\n h("div", {}, h("h3", { "data-travel-presence": "", role: "status" }, presence), h("p", { class: "page-sub" }, stale ? "\\u4E0A\\u6B21\\u6838\\u9A8C\\u7684\\u72B6\\u6001\\uFF1B\\u5F53\\u524D\\u6682\\u65F6\\u65E0\\u6CD5\\u66F4\\u65B0\\u3002" : snapshot ? "\\u6700\\u8FD1\\u6838\\u9A8C\\uFF1A" + new Date(snapshot.checkedAt).toLocaleTimeString() : "\\u6B63\\u5728\\u6838\\u9A8C"))\n ),\n peers,\n h(\n "section",\n { class: "travel-actions" },\n h("div", {}, h("h3", {}, "\\u8BA9\\u76F8\\u4F34\\u7EE7\\u7EED"), h("p", { class: "page-sub" }, "\\u5148\\u786E\\u8BA4\\u8D44\\u6599\\u548C\\u5F53\\u524D\\u5DE5\\u4F5C\\uFF0C\\u518D\\u4EA4\\u63A5\\u8FD0\\u884C\\u4F4D\\u7F6E\\u3002")),\n h("div", { class: "btn-row" }, button("to_cloud", snapshot?.active !== "cloud"), button("to_local", snapshot?.active === "cloud"), auto, onboardingButton())\n ),\n ...transfer ? [h(\n "section",\n { class: "travel-progress", "data-travel-transfer": "", role: "status" },\n h("strong", {}, transfer.target === "local" ? "\\u6B63\\u5728\\u63A5\\u56DE\\u7535\\u8111" : "\\u6B63\\u5728\\u8F6C\\u5230\\u4E91\\u7AEF"),\n h("p", {}, phases[transfer.state] || "\\u6B63\\u5728\\u6838\\u5BF9\\u4EA4\\u63A5"),\n h("p", { class: "page-sub" }, "\\u53EF\\u4EE5\\u79BB\\u5F00\\u9875\\u9762\\uFF0C\\u91CD\\u65B0\\u6253\\u5F00\\u540E\\u4F1A\\u7EE7\\u7EED\\u663E\\u793A\\u8FD9\\u6B21\\u4EA4\\u63A5\\u3002")\n )] : [],\n h("section", { class: "travel-exit" }, h(\n "div",\n {},\n h("h3", {}, "\\u7ED3\\u675F\\u968F\\u884C"),\n h("p", { "data-travel-recovery": "", class: "page-sub" }, snapshot?.recovery === "ready" ? "\\u666E\\u901A\\u672C\\u5730\\u526F\\u672C\\u5DF2\\u5B8C\\u6210\\u6062\\u590D\\u9A8C\\u8BC1\\u3002" : "\\u5148\\u63A5\\u56DE\\u7535\\u8111\\uFF0C\\u5E76\\u751F\\u6210\\u5DF2\\u9A8C\\u8BC1\\u7684\\u666E\\u901A\\u672C\\u5730\\u526F\\u672C\\u3002"),\n ...retirement ? [h("p", { role: "status" }, phases[retirement.state] || "\\u6B63\\u5728\\u6838\\u5BF9\\u6E05\\u9000\\u72B6\\u6001")] : []\n ), h("div", { class: "btn-row" }, button("recover"), button("finish")))\n );\n };\n paint();\n void deps.configGet(marker.configPath).then((result) => {\n if (!alive) return;\n const value = result.values?.agents?.defaults?.name;\n if (result.ok && typeof value === "string" && value.trim()) {\n name = value.trim();\n if (!busy) paint();\n }\n }).catch(() => {\n });\n void perform("status");\n void refreshPreparation();\n return () => {\n alive = false;\n generation++;\n if (timer) clearTimeout(timer);\n if (preparationTimer) clearTimeout(preparationTimer);\n modal?.close();\n onboarding?.close();\n };\n }\n\n // web-console/desktop/src/renderer/console/connection-list.ts\n var gmailIcon = "data:image/svg+xml," + encodeURIComponent(\'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="#4285f4" d="M2 6v13h4V9z"/><path fill="#34a853" d="M18 9v10h4V6z"/><path fill="#ea4335" d="m6 9 6 4 6-4V4l-6 4-6-4z"/><path fill="#fbbc04" d="m18 4 4 2-4 3z"/><path fill="#c5221f" d="M2 6 6 4v5z"/></svg>\');\n function connectionRow(id, name, description) {\n return h(\n "section",\n { class: "connection-row", "data-connection": id },\n h(\n "span",\n { class: "connection-icon", "data-brand": id, "aria-hidden": "true" },\n id === "gmail" ? h("img", { src: gmailIcon, alt: "" }) : id === "qq" ? "QQ" : "163"\n ),\n h("div", { class: "connection-copy" }, h("h3", {}, name), h("p", { class: "connection-description" }, description)),\n h("button", { class: "connection-action", type: "button" }, "\\u8FDE\\u63A5")\n );\n }\n\n // web-console/desktop/src/shared/service-auth.ts\n var GMAIL_PERMISSIONS = { readMessages: "\\u8BFB\\u53D6\\u90AE\\u4EF6", searchMessages: "\\u641C\\u7D22\\u90AE\\u4EF6", readDrafts: "\\u8BFB\\u53D6\\u8349\\u7A3F", readLabelsFilters: "\\u8BFB\\u53D6\\u6807\\u7B7E\\u548C\\u7B5B\\u9009\\u6761\\u4EF6", writeDrafts: "\\u7F16\\u8F91\\u8349\\u7A3F", manageLabels: "\\u7BA1\\u7406\\u6807\\u7B7E", markRead: "\\u5DF2\\u8BFB\\uFF0F\\u672A\\u8BFB", importMessages: "\\u5BFC\\u5165\\u90AE\\u4EF6", send: "\\u53D1\\u9001\\u90AE\\u4EF6", trash: "\\u79FB\\u5165\\uFF0F\\u79FB\\u51FA\\u5783\\u573E\\u6876", unsubscribe: "\\u53D6\\u6D88\\u8BA2\\u9605", sync: "\\u540E\\u53F0\\u540C\\u6B65" };\n\n // web-console/desktop/src/renderer/console/pages/gmail-connection.ts\n var ERRORS = {\n engine_unavailable: "\\u4F19\\u4F34\\u6682\\u65F6\\u8054\\u7CFB\\u4E0D\\u4E0A\\uFF0C\\u542F\\u52A8\\u540E\\u53EF\\u8FDE\\u63A5\\u3002",\n wrong_partner: "\\u6682\\u65F6\\u65E0\\u6CD5\\u786E\\u8BA4\\u5F53\\u524D\\u4F19\\u4F34\\uFF0C\\u8BF7\\u5237\\u65B0\\u540E\\u518D\\u8BD5\\u3002",\n unknown_partner: "\\u8BF7\\u5148\\u9009\\u62E9\\u5DF2\\u5B89\\u88C5\\u7684\\u4F19\\u4F34\\u3002",\n upgrade_required: "\\u5347\\u7EA7\\u5F15\\u64CE\\u540E\\u5373\\u53EF\\u767B\\u5F55\\u8FDE\\u63A5 Gmail\\u3002",\n provider_unavailable: "Gmail \\u767B\\u5F55\\u8FDE\\u63A5\\u6682\\u672A\\u51C6\\u5907\\u597D\\uFF0C\\u8BF7\\u7A0D\\u540E\\u518D\\u8BD5\\u3002",\n platform_unavailable: "\\u6682\\u65F6\\u65E0\\u6CD5\\u6838\\u5BF9\\u8FDE\\u63A5\\uFF0C\\u8BF7\\u7A0D\\u540E\\u91CD\\u8BD5\\u3002",\n browser_open_failed: "\\u6D4F\\u89C8\\u5668\\u6682\\u65F6\\u6CA1\\u6709\\u6253\\u5F00\\uFF0C\\u70B9\\u51FB\\u7EE7\\u7EED\\u6388\\u6743\\u91CD\\u8BD5\\u3002",\n authorization_expired: "\\u6388\\u6743\\u5DF2\\u5931\\u6548\\uFF0C\\u8BF7\\u91CD\\u65B0\\u767B\\u5F55\\u3002"\n };\n function mountGmailConnection(row, stateDir, deps, onState) {\n const action = row.querySelector(".connection-action");\n const description = row.querySelector(".connection-description");\n const details = h("div", { class: "gmail-details", hidden: true });\n row.append(details);\n let alive = true, busy = false, generation = 0, timer;\n let known = { ok: true }, available, error = "", expanded = false, confirming = false, revocationPending = false;\n const revocationKey = `engine7:gmail:revocation-pending:${stateDir}`;\n try {\n revocationPending = sessionStorage.getItem(revocationKey) === "1";\n } catch {\n }\n const rememberRevocation = (result) => {\n if (result.revocationConfirmed === void 0 && result.status !== "connected") return;\n revocationPending = result.status !== "connected" && result.revocationConfirmed === false;\n try {\n if (revocationPending) sessionStorage.setItem(revocationKey, "1");\n else sessionStorage.removeItem(revocationKey);\n } catch {\n }\n };\n const invoke = async (operation, payload) => {\n if (!deps.serviceAuth) return { ok: false, error: "upgrade_required" };\n try {\n return await deps.serviceAuth(stateDir, operation, "gmail", payload);\n } catch {\n return { ok: false, error: "platform_unavailable" };\n }\n };\n const stopTimer = () => {\n if (timer) clearTimeout(timer);\n timer = void 0;\n };\n const render = () => {\n if (!alive) return;\n const connected = known.status === "connected" || known.status === "pending" && !!known.account, pending = known.status === "pending";\n row.dataset.status = known.status ?? "unknown";\n onState(known.status === void 0 ? void 0 : connected);\n const messages = { not_connected: "\\u67E5\\u770B\\u3001\\u641C\\u7D22\\u90AE\\u4EF6\\uFF0C\\u767B\\u5F55 Google \\u5373\\u53EF\\u3002", pending: "\\u7B49\\u5F85\\u4F60\\u5728\\u624B\\u673A\\u6216\\u6D4F\\u89C8\\u5668\\u4E2D\\u767B\\u5F55\\u6388\\u6743\\u3002", connected: `\\u5DF2\\u8FDE\\u63A5 \\xB7 ${known.account ?? ""}`, disconnected: "\\u5DF2\\u65AD\\u5F00\\uFF0C\\u9700\\u8981\\u65F6\\u53EF\\u4EE5\\u91CD\\u65B0\\u8FDE\\u63A5\\u3002", denied: "\\u5DF2\\u53D6\\u6D88\\u6388\\u6743\\uFF0C\\u9700\\u8981\\u65F6\\u518D\\u8FDE\\u63A5\\u3002", expired: "\\u6388\\u6743\\u5DF2\\u8FC7\\u671F\\uFF0C\\u8BF7\\u91CD\\u65B0\\u767B\\u5F55\\u3002", failed: "\\u8FDE\\u63A5\\u672A\\u5B8C\\u6210\\uFF0C\\u53EF\\u4EE5\\u91CD\\u65B0\\u5C1D\\u8BD5\\u3002" };\n description.textContent = error || messages[known.status ?? ""] || "\\u6B63\\u5728\\u6838\\u5BF9\\u8FDE\\u63A5\\u2026";\n if (revocationPending) description.textContent = "\\u672C\\u4F19\\u4F34\\u5DF2\\u505C\\u7528\\uFF0CGoogle \\u64A4\\u9500\\u5C1A\\u672A\\u786E\\u8BA4\\u3002";\n action.textContent = busy ? "\\u6B63\\u5728\\u6838\\u5BF9\\u2026" : connected ? "\\u5DF2\\u8FDE\\u63A5" : pending ? "\\u7EE7\\u7EED\\u6388\\u6743" : known.status === "expired" ? "\\u91CD\\u65B0\\u8FDE\\u63A5" : "\\u8FDE\\u63A5 Gmail";\n action.disabled = busy || available === false && !connected && !pending;\n action.setAttribute("aria-expanded", String(expanded));\n action.classList.toggle("connected", connected);\n details.hidden = !expanded && !pending && !revocationPending && !error;\n const refresh = h("button", { class: "btn btn-ghost", type: "button", "data-gmail-refresh": "", disabled: busy, onclick: () => void check() }, "\\u91CD\\u65B0\\u6838\\u5BF9");\n const children = [];\n if (connected) children.push(h("p", { class: "gmail-account" }, known.account ?? ""), h("p", { class: "cf-hint" }, known.needsAuthorization ? "\\u5F53\\u524D\\u5DF2\\u6388\\u6743\\u67E5\\u770B\\u90AE\\u4EF6\\uFF0C\\u7BA1\\u7406\\u90AE\\u4EF6\\u9700\\u589E\\u52A0\\u6388\\u6743\\u3002" : "\\u5DF2\\u6388\\u6743\\u7BA1\\u7406\\u90AE\\u4EF6\\u3002\\u5404\\u9879\\u64CD\\u4F5C\\u9075\\u5FAA\\u4E0B\\u65B9\\u8BBE\\u7F6E\\u3002"));\n if (connected && known.settings) {\n const policies = h("div", { class: "gmail-policies" });\n for (const [key, label] of Object.entries(GMAIL_PERMISSIONS)) {\n const select = h("select", { "data-gmail-policy": key, "aria-label": label, disabled: busy, onchange: (event) => {\n const mode = event.target.value;\n void perform("settings_update", { permissions: { [key]: mode } });\n } });\n for (const [value, text] of [["allow", "\\u5141\\u8BB8"], ["ask", "\\u63D0\\u95EE"], ["deny", "\\u7981\\u6B62"]]) {\n const option = h("option", { value }, text);\n option.selected = known.settings.permissions[key] === value;\n select.append(option);\n }\n policies.append(h("label", { class: "gmail-policy" }, h("span", {}, label), select));\n }\n children.push(policies);\n }\n if (connected && known.sync) children.push(h("p", { class: "cf-hint", "data-gmail-sync": "" }, `\\u540E\\u53F0\\u540C\\u6B65${known.sync.enabled ? "\\u5DF2\\u5F00\\u542F" : "\\u672A\\u81EA\\u52A8\\u5F00\\u542F"} \\xB7 \\u5DF2\\u7F13\\u5B58 ${known.sync.cachedMessages} \\u5C01\\u6982\\u8981${known.sync.running ? " \\xB7 \\u6B63\\u5728\\u540C\\u6B65" : ""}${known.sync.error ? " \\xB7 \\u6682\\u65F6\\u65E0\\u6CD5\\u540C\\u6B65\\uFF0C\\u7A0D\\u540E\\u91CD\\u8BD5" : ""}`));\n if (error) children.push(h("p", { class: "cf-hint" }, error));\n if (revocationPending) children.push(h("p", { class: "cf-hint" }, "\\u672C\\u4F19\\u4F34\\u5DF2\\u505C\\u6B62\\u8BFB\\u53D6\\u3002\\u4F60\\u4E5F\\u53EF\\u4EE5\\u5230 Google \\u8D26\\u53F7\\u67E5\\u770B\\u6216\\u79FB\\u9664\\u6388\\u6743\\u3002"));\n const buttons = [refresh];\n if (connected && known.needsAuthorization && !pending) buttons.push(h("button", { class: "btn btn-primary", type: "button", "data-gmail-upgrade": "", disabled: busy, onclick: () => void perform("connect") }, "\\u589E\\u52A0\\u6388\\u6743"));\n if (pending) buttons.push(h("button", { class: "btn btn-ghost", type: "button", "data-gmail-cancel": "", disabled: busy, onclick: () => void perform("disconnect") }, "\\u53D6\\u6D88\\u8FDE\\u63A5"));\n if (connected) buttons.push(h("button", { class: "btn btn-ghost", type: "button", "data-gmail-disconnect": "", disabled: busy, onclick: () => {\n confirming = true;\n expanded = true;\n render();\n } }, "\\u65AD\\u5F00\\u8FDE\\u63A5"));\n if (revocationPending) buttons.push(h("button", { class: "btn btn-ghost", type: "button", disabled: busy, onclick: () => void perform("disconnect") }, "\\u91CD\\u8BD5\\u64A4\\u9500"), h("button", { class: "btn btn-ghost", type: "button", onclick: () => void perform("permissions") }, "Google \\u6388\\u6743\\u7BA1\\u7406"));\n children.push(h("div", { class: "btn-row" }, ...buttons));\n if (confirming) children.push(h("div", { class: "gmail-confirm" }, h("p", {}, "\\u65AD\\u5F00\\u540E\\uFF0C\\u8FD9\\u4F4D\\u4F19\\u4F34\\u5C06\\u505C\\u6B62\\u8BFB\\u53D6 Gmail\\u3002"), h("div", { class: "btn-row" }, h("button", { class: "btn btn-primary", type: "button", "data-gmail-confirm-disconnect": "", onclick: () => {\n confirming = false;\n void perform("disconnect");\n } }, "\\u786E\\u8BA4\\u65AD\\u5F00"), h("button", { class: "btn btn-ghost", type: "button", onclick: () => {\n confirming = false;\n render();\n } }, "\\u4FDD\\u7559\\u8FDE\\u63A5"))));\n details.replaceChildren(...children);\n };\n const accept = (result) => {\n if (result.ok || result.status) {\n known = { ...known, ...result };\n error = "";\n if (result.status && result.status !== "connected" && (result.status !== "pending" || !known.account)) {\n delete known.account;\n delete known.scopes;\n delete known.needsAuthorization;\n }\n }\n if (!result.ok) error = ERRORS[result.error ?? ""] ?? "\\u6682\\u65F6\\u65E0\\u6CD5\\u6838\\u5BF9\\u8FDE\\u63A5\\uFF0C\\u8BF7\\u7A0D\\u540E\\u91CD\\u8BD5\\u3002";\n if (result.status === "failed") error = ERRORS[result.error ?? ""] ?? "\\u8FDE\\u63A5\\u672A\\u5B8C\\u6210\\uFF0C\\u8BF7\\u91CD\\u65B0\\u5C1D\\u8BD5\\u3002";\n rememberRevocation(result);\n };\n const poll2 = () => {\n stopTimer();\n if (alive && known.status === "pending") timer = setTimeout(() => void check(), 2e3);\n };\n const check = async () => {\n if (busy || !alive) return;\n const gen = ++generation;\n busy = true;\n stopTimer();\n render();\n const result = await invoke("status");\n if (!alive || gen !== generation) return;\n accept(result);\n busy = false;\n render();\n poll2();\n };\n const perform = async (operation, payload) => {\n if (busy || !alive) return;\n const gen = ++generation;\n busy = true;\n stopTimer();\n render();\n const result = await invoke(operation, payload);\n if (operation === "disconnect") rememberRevocation(result);\n if (!alive || gen !== generation) return;\n if (operation !== "permissions") accept(result);\n else if (!result.ok) error = ERRORS[result.error ?? ""] ?? "\\u8BF7\\u7A0D\\u540E\\u518D\\u8BD5\\u3002";\n busy = false;\n render();\n poll2();\n };\n action.onclick = () => {\n if (known.status === "connected") {\n expanded = !expanded;\n render();\n return;\n }\n void perform(known.status === "pending" ? "continue" : "connect");\n };\n render();\n void (async () => {\n const gen = ++generation;\n busy = true;\n render();\n const [catalog, status] = await Promise.all([invoke("catalog"), invoke("status")]);\n if (!alive || gen !== generation) return;\n if (catalog.ok) available = catalog.providers?.find((p) => p.id === "gmail")?.available ?? false;\n accept(status);\n if (available === false && known.status === "not_connected") error = ERRORS.provider_unavailable ?? "Gmail \\u6682\\u65F6\\u65E0\\u6CD5\\u8FDE\\u63A5\\u3002";\n busy = false;\n render();\n poll2();\n })();\n return () => {\n alive = false;\n generation++;\n stopTimer();\n action.onclick = null;\n };\n }\n\n // web-console/desktop/src/renderer/console/pages/email.ts\n function mountEmail(body, marker, deps) {\n let alive = true, imapCleanup, gmailConnected, imapAddress = "", imapUpdated = false;\n const count = h("span", { class: "mail-connected-count" }, "\\u8FDE\\u63A5\\u72B6\\u6001\\u5F85\\u6838\\u5BF9");\n const qq = connectionRow("qq", "QQ \\u90AE\\u7BB1", "\\u6536\\u53D1\\u3001\\u67E5\\u627E\\u90AE\\u4EF6\\uFF0C\\u4F7F\\u7528\\u90AE\\u7BB1\\u6388\\u6743\\u7801\\u8FDE\\u63A5\\u3002");\n const netease = connectionRow("163", "163 / 126 / 188", "\\u6536\\u53D1\\u3001\\u67E5\\u627E\\u90AE\\u4EF6\\uFF0C\\u4F7F\\u7528\\u5BA2\\u6237\\u7AEF\\u6388\\u6743\\u5BC6\\u7801\\u8FDE\\u63A5\\u3002");\n const gmail = connectionRow("gmail", "Gmail", "\\u67E5\\u770B\\u3001\\u641C\\u7D22\\u90AE\\u4EF6\\uFF0C\\u767B\\u5F55 Google \\u5373\\u53EF\\u3002");\n const list = h("div", { class: "connection-list" }, qq, netease, gmail);\n const form = h("div", { class: "mail-configuration", hidden: true });\n const update = () => {\n if (!alive) return;\n count.textContent = `${gmailConnected === void 0 ? "\\u8FDE\\u63A5\\u72B6\\u6001\\u5F85\\u6838\\u5BF9" : `\\u5DF2\\u8FDE\\u63A5 ${Number(gmailConnected)} \\u4E2A`}${imapAddress ? " \\xB7 \\u5DF2\\u914D\\u7F6E 1 \\u4E2A" : ""}`;\n for (const [row, domains] of [[qq, ["qq.com", "foxmail.com"]], [netease, ["163.com", "126.com", "188.com"]]]) {\n const connected = domains.some((domain) => domain === (imapAddress.split("@")[1]?.toLowerCase() ?? ""));\n const button = row.querySelector(".connection-action");\n button.textContent = connected ? "\\u5DF2\\u914D\\u7F6E" : "\\u8FDE\\u63A5";\n button.classList.toggle("connected", connected);\n }\n };\n const openImap = (provider) => {\n imapCleanup?.();\n form.hidden = false;\n for (const row of [qq, netease]) row.classList.toggle("selected", row.dataset.connection === provider);\n imapCleanup = mountImapEmail(form, marker, deps, provider, (address) => {\n imapUpdated = true;\n imapAddress = address;\n update();\n });\n form.scrollIntoView({ block: "nearest", behavior: matchMedia("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth" });\n };\n qq.querySelector(".connection-action").onclick = () => openImap("qq");\n netease.querySelector(".connection-action").onclick = () => openImap("163");\n const other = h("button", { class: "mail-other-link", type: "button", onclick: () => openImap("other") }, "\\u5176\\u4ED6\\u90AE\\u7BB1\\u6216\\u5DF2\\u6709\\u5E94\\u7528\\u5BC6\\u7801\\u8FDE\\u63A5");\n const wrap = h("div", { class: "page mail-page" }, h("div", { class: "mail-heading" }, h("h2", {}, "\\u90AE\\u4EF6\\u8FDE\\u63A5"), count), h("p", { class: "page-sub" }, "\\u9009\\u62E9\\u4F60\\u7684\\u90AE\\u7BB1\\uFF0C\\u8BA9\\u4F19\\u4F34\\u5E2E\\u4F60\\u67E5\\u770B\\u548C\\u6574\\u7406\\u90AE\\u4EF6\\u3002"), list, other, form);\n body.replaceChildren(wrap);\n const gmailCleanup = mountGmailConnection(gmail, marker.stateDir, deps, (connected) => {\n gmailConnected = connected;\n update();\n });\n void deps.configGet(marker.configPath).then((r) => {\n if (alive && !imapUpdated && r.ok) {\n const address = pickPath(r.values, "tools.email.address");\n imapAddress = typeof address === "string" ? address : "";\n update();\n }\n }).catch(() => {\n });\n return () => {\n alive = false;\n gmailCleanup();\n imapCleanup?.();\n };\n }\n function mountImapEmail(body, marker, deps, provider, onSaved) {\n let alive = true;\n const wrap = h(\n "div",\n { class: "imap-setup" },\n h("div", { class: "cfg-loading" }, "\\u6B63\\u5728\\u8BFB\\u53D6\\u914D\\u7F6E\\u2026")\n );\n body.replaceChildren(wrap);\n void (async () => {\n const [schemaR, getR] = await Promise.all([\n deps.configSchema(marker.stateDir),\n deps.configGet(marker.configPath)\n ]);\n if (!alive) return;\n if (!schemaR.ok || !getR.ok) {\n wrap.replaceChildren(h("p", { class: "inline-error" }, "\\u6682\\u65F6\\u65E0\\u6CD5\\u8BFB\\u53D6\\u90AE\\u7BB1\\u914D\\u7F6E\\uFF0C\\u8BF7\\u7A0D\\u540E\\u91CD\\u65B0\\u9009\\u62E9\\u3002"));\n return;\n }\n const emailField = schemaR?.fields?.find((f) => f.path === "tools.email");\n const cur = pickPath(getR.values, "tools.email") ?? {};\n const internal = schemaR?.internalMode === true;\n const str = (k) => typeof cur[k] === "string" ? String(cur[k]) : "";\n const configured = Boolean(str("address"));\n const status = h("div", { class: "inline-warn", hidden: true });\n const detail = h("div", { class: "cfg-detail" });\n const save = h("button", { class: "btn btn-primary", type: "button" }, "\\u4FDD\\u5B58");\n const setStatus = (m, k) => {\n status.hidden = false;\n status.textContent = m;\n status.style.color = k === "err" ? "var(--red)" : k === "ok" ? "var(--green)" : "";\n };\n const address = h("input", {\n type: "text",\n id: "email-address",\n value: str("address"),\n placeholder: "\\u5B8C\\u6574\\u90AE\\u7BB1\\u5730\\u5740\\uFF0C\\u5982 xxx@qq.com\\uFF08\\u4E0D\\u80FD\\u586B QQ \\u53F7\\uFF09"\n });\n const passNow = cur.pass;\n const passMasked = passNow === null || passNow === void 0 ? configured ? "masked" : "empty" : "plain";\n const pass = h("input", {\n type: "password",\n id: "email-pass",\n value: "",\n autocomplete: "new-password",\n placeholder: passMasked === "masked" ? "\\uFF08config \\u91CC\\u5B58\\u4E86\\u660E\\u6587\\u3001\\u88AB\\u5F15\\u64CE\\u906E\\u4F4F\\u4E86 \\u2014\\u2014 \\u7559\\u7A7A\\u4FDD\\u5B58\\u4F1A\\u628A\\u5B83\\u6E05\\u6389\\uFF0C\\u91CD\\u586B\\u4E00\\u6B21\\u4F1A\\u539F\\u6837\\u5199\\u56DE\\uFF09" : passMasked === "plain" ? `\\u7559\\u7A7A\\u4E0D\\u6539\\uFF08\\u5F53\\u524D\\u5DF2\\u4FDD\\u5B58\\uFF09` : "\\u90AE\\u7BB1\\u6388\\u6743\\u7801\\uFF08\\u4E0D\\u662F\\u767B\\u5F55\\u5BC6\\u7801\\uFF09"\n });\n const smtpPass = internal ? h("input", {\n type: "password",\n id: "email-smtp-pass",\n value: "",\n autocomplete: "new-password",\n placeholder: "\\u7559\\u7A7A = \\u4E0E\\u4E0A\\u9762\\u540C\\u4E00\\u4E2A\\u6388\\u6743\\u7801\\uFF08163 \\u53EF\\u4E3A SMTP \\u5355\\u72EC\\u8BBE\\u4E00\\u4E2A\\uFF09"\n }) : null;\n const policyChoices = emailField?.knownValues?.sendPolicy ?? [];\n const curPolicy = str("sendPolicy") || "tiered";\n let policy;\n if (policyChoices.length > 0) {\n const opts = [...policyChoices];\n if (!opts.includes(curPolicy)) opts.unshift(curPolicy);\n policy = h(\n "select",\n { id: "email-policy" },\n ...opts.map((o) => h("option", { value: o, selected: o === curPolicy }, POLICY_TEXT[o] ?? o))\n );\n } else {\n policy = h("input", { type: "text", id: "email-policy", value: curPolicy });\n }\n const imapHost = internal ? h("input", { type: "text", id: "email-imap-host", value: str("imap") ? String(cur.imap?.host ?? "") : "", placeholder: "\\u7559\\u7A7A = \\u6309\\u90AE\\u7BB1\\u57DF\\u540D\\u81EA\\u52A8\\u8BC6\\u522B" }) : null;\n const smtpHost = internal ? h("input", { type: "text", id: "email-smtp-host", value: str("smtp") ? String(cur.smtp?.host ?? "") : "", placeholder: "\\u7559\\u7A7A = \\u6309\\u90AE\\u7BB1\\u57DF\\u540D\\u81EA\\u52A8\\u8BC6\\u522B" }) : null;\n const dailyLimit = internal ? h("input", { type: "text", id: "email-daily-limit", value: String(cur.dailySendLimit ?? 20), placeholder: "20" }) : null;\n const fieldRow = (label, input, hint = null) => h(\n "div",\n { class: "cf-field" },\n h("label", {}, label),\n typeof hint === "string" ? hint ? h("p", { class: "cf-hint" }, hint) : null : hint,\n input\n );\n const form = () => ({\n address: address.value.trim(),\n pass: pass.value,\n ...smtpPass ? { smtpPass: smtpPass.value } : {},\n sendPolicy: policy.value,\n ...imapHost ? { imapHost: imapHost.value.trim() } : {},\n ...smtpHost ? { smtpHost: smtpHost.value.trim() } : {},\n ...dailyLimit ? { dailySendLimit: Number(dailyLimit.value) || 20 } : {}\n });\n const snap = () => JSON.stringify(form());\n let baseline = snap();\n const refreshSave = () => {\n save.disabled = snap() === baseline;\n };\n for (const el of [address, pass, policy, ...smtpPass ? [smtpPass] : [], ...imapHost ? [imapHost] : [], ...smtpHost ? [smtpHost] : [], ...dailyLimit ? [dailyLimit] : []]) {\n el.addEventListener("input", refreshSave);\n el.addEventListener("change", refreshSave);\n }\n const mergeValue = () => {\n const f = form();\n const out = { ...cur };\n out.address = f.address;\n out.sendPolicy = f.sendPolicy;\n if (typeof f.pass === "string" && f.pass !== "") out.pass = f.pass;\n else delete out.pass;\n if (typeof f.smtpPass === "string" && f.smtpPass !== "") out.smtpPass = f.smtpPass;\n else if ("smtpPass" in out && f.smtpPass === "") delete out.smtpPass;\n if (f.imapHost !== void 0) {\n out.imap = { ...cur.imap ?? {}, ...f.imapHost ? { host: f.imapHost } : { host: void 0 } };\n }\n if (f.smtpHost !== void 0) {\n out.smtp = { ...cur.smtp ?? {}, ...f.smtpHost ? { host: f.smtpHost } : { host: void 0 } };\n }\n if (f.dailySendLimit !== void 0) out.dailySendLimit = f.dailySendLimit;\n const passDropped = passMasked === "masked" && (typeof f.pass !== "string" || f.pass === "");\n return { value: out, passDropped };\n };\n const renderDetail = (r) => {\n detail.replaceChildren(...setDetailBlocks(r, {}));\n };\n save.addEventListener("click", () => {\n void (async () => {\n const addr = address.value.trim();\n if (!addr) {\n setStatus("\\u5148\\u586B\\u90AE\\u7BB1\\u5730\\u5740\\uFF08\\u5B8C\\u6574\\u5730\\u5740\\uFF0Cxxx@qq.com\\uFF0C\\u4E0D\\u80FD\\u586B QQ \\u53F7\\uFF09\\u3002", "err");\n return;\n }\n if (!addr.includes("@")) {\n setStatus("\\u90AE\\u7BB1\\u5730\\u5740\\u8981\\u5E26 @\\uFF08xxx@qq.com \\u8FD9\\u79CD\\u5B8C\\u6574\\u5730\\u5740\\uFF09\\u3002", "err");\n return;\n }\n if (passMasked === "empty" && pass.value === "") {\n setStatus("\\u8FD8\\u5DEE\\u6388\\u6743\\u7801\\uFF1A\\u8FD9\\u4E0D\\u662F\\u767B\\u5F55\\u5BC6\\u7801 \\u2014\\u2014 QQ \\u90AE\\u7BB1\\u5728\\u7F51\\u9875\\u7248 \\u8BBE\\u7F6E \\u2192 \\u8D26\\u6237 \\u91CC\\u751F\\u6210\\u3002\\u4E0D\\u77E5\\u9053\\u600E\\u4E48\\u62FF\\uFF0C\\u76F4\\u63A5\\u5728\\u804A\\u5929\\u91CC\\u95EE\\u4F60\\u7684\\u52A9\\u624B\\u3002", "err");\n return;\n }\n save.disabled = true;\n detail.replaceChildren();\n const merged = mergeValue();\n if (merged.passDropped && !window.confirm(\n "\\u6388\\u6743\\u7801\\u5728 config \\u91CC\\u5B58\\u7684\\u662F\\u660E\\u6587\\uFF0C\\u6258\\u76D8\\u8BFB\\u4E0D\\u56DE\\u6765\\uFF08\\u88AB\\u5F15\\u64CE\\u906E\\u4F4F\\u4E86\\uFF09\\u3002\\n\\u7EE7\\u7EED\\u4FDD\\u5B58\\u4F1A\\u628A\\u5B83\\u4ECE config \\u91CC\\u53BB\\u6389\\uFF08\\u52A9\\u624B\\u5C31\\u8FDE\\u4E0D\\u4E0A\\u90AE\\u7BB1\\u4E86\\uFF09\\u3002\\n\\n\\u60F3\\u7559\\u7740\\u5C31\\u5728\\u4E0A\\u9762\\u91CD\\u586B\\u4E00\\u6B21\\u518D\\u4FDD\\u5B58\\u3002\\u4ECD\\u7136\\u7EE7\\u7EED\\uFF1F"\n )) {\n refreshSave();\n setStatus("\\u6CA1\\u6709\\u63D0\\u4EA4\\uFF1A\\u7559\\u7740\\u7684\\u8BDD\\u5728\\u4E0A\\u9762\\u91CD\\u586B\\u4E00\\u6B21\\u6388\\u6743\\u7801\\u518D\\u4FDD\\u5B58\\u3002", "info");\n return;\n }\n const r = await deps.configSet(marker.configPath, { "tools.email": merged.value });\n renderDetail(r);\n if (!r.ok) {\n refreshSave();\n setStatus(`\\u4FDD\\u5B58\\u5931\\u8D25\\uFF1A${r.error ?? ""} ${r.errors.map((e) => e.error).join("\\uFF1B")}`, "err");\n return;\n }\n baseline = snap();\n refreshSave();\n onSaved(address.value.trim());\n setStatus(`\\u5DF2\\u4FDD\\u5B58\\uFF1A${r.changed.join("\\u3001") || "\\uFF08\\u65E0\\u53D8\\u5316\\uFF09"}\\u3002\\u52A9\\u624B\\u90A3\\u8FB9\\u7ACB\\u5373\\u751F\\u6548\\uFF08\\u4E0B\\u6B21\\u5BF9\\u8BDD\\u5C31\\u80FD\\u7528\\uFF09\\u3002`, "ok");\n })();\n });\n const PROVIDER_STEPS = [\n { key: "qq", label: "QQ \\u90AE\\u7BB1", domains: ["qq.com", "foxmail.com"], paras: [\n "\\u6253\\u5F00 mail.qq.com \\u2192 \\u53F3\\u4E0A\\u89D2\\u5934\\u50CF \\u2192 \\u8D26\\u53F7\\u4E0E\\u5B89\\u5168 \\u2192 \\u5DE6\\u4FA7\\u300C\\u5B89\\u5168\\u8BBE\\u7F6E\\u300D\\u2192 \\u7FFB\\u5230\\u9875\\u9762\\u6700\\u5E95\\u90E8\\uFF0C\\u627E\\u300CPOP3/IMAP/SMTP \\u670D\\u52A1\\u300D\\u2014\\u2014\\u591A\\u534A\\u5DF2\\u7ECF\\u5F00\\u7740\\uFF0C\\u76F4\\u63A5\\u70B9\\u300C\\u751F\\u6210\\u6388\\u6743\\u7801\\u300D\\u3002",\n "\\u9A8C\\u8BC1\\u90A3\\u6B65\\u662F\\u7528\\u7ED1\\u5B9A\\u624B\\u673A\\u53D1\\u4E00\\u6761\\u77ED\\u4FE1\\uFF08\\u5FAE\\u4FE1\\u626B\\u9875\\u9762\\u4E0A\\u7684\\u4E8C\\u7EF4\\u7801\\u5C31\\u80FD\\u4EE3\\u53D1\\uFF0C\\u4E0D\\u7528\\u78B0\\u624B\\u673A\\uFF09\\uFF0C\\u53D1\\u5B8C\\u70B9\\u300C\\u6211\\u5DF2\\u53D1\\u9001\\u300D\\uFF0C\\u6388\\u6743\\u7801\\u4F1A\\u76F4\\u63A5\\u5F39\\u5728\\u7F51\\u9875\\u4E0A\\uFF08\\u77ED\\u4FE1\\u91CC\\u6CA1\\u6709\\u7801\\uFF09\\uFF0C\\u590D\\u5236\\u5B83\\u3002"\n ] },\n { key: "163", label: "163 / 126 / 188 \\u90AE\\u7BB1", domains: ["163.com", "126.com", "188.com"], paras: [\n "\\u6253\\u5F00 mail.163.com \\u2192 \\u767B\\u5F55 \\u2192 \\u9876\\u90E8\\u300C\\u8BBE\\u7F6E\\u300D\\u2192\\u300CPOP3/SMTP/IMAP\\u300D\\u2192 \\u5F00\\u542F IMAP/SMTP \\u670D\\u52A1\\uFF08\\u4E2D\\u9014\\u6709\\u5B89\\u5168\\u63D0\\u793A\\uFF0C\\u70B9\\u7EE7\\u7EED\\u5F00\\u542F\\uFF09\\u2192 \\u6309\\u63D0\\u793A\\u5B8C\\u6210\\u9A8C\\u8BC1\\uFF0C\\u9875\\u9762\\u4F1A\\u7ED9\\u51FA 16 \\u4F4D\\u6388\\u6743\\u5BC6\\u7801\\u3002",\n "\\u6CE8\\u610F\\u5927\\u5C0F\\u5199\\u6DF7\\u5408\\uFF08\\u548C QQ \\u7684\\u7EAF\\u5C0F\\u5199\\u4E0D\\u540C\\uFF09\\uFF0C\\u590D\\u5236\\u65F6\\u522B\\u6539\\u52A8\\u3002\\u8FC7\\u7A0B\\u4E2D\\u7F51\\u6613\\u53EF\\u80FD\\u7ED9\\u7ED1\\u5B9A\\u624B\\u673A\\u53D1\\u300C\\u65B0\\u8BBE\\u5907\\u767B\\u5F55\\u63D0\\u9192\\u300D\\u2014\\u2014\\u6B63\\u5E38\\u73B0\\u8C61\\uFF0C\\u4E0D\\u7528\\u7406\\u4F1A\\u3002"\n ] },\n { key: "gmail", label: "Gmail", domains: ["gmail.com", "googlemail.com"], paras: [\n "\\u524D\\u63D0\\uFF1A\\u8FD9\\u53F0\\u7535\\u8111\\u80FD\\u6B63\\u5E38\\u8BBF\\u95EE Google\\uFF08\\u8FDE\\u4E0D\\u4E0A\\u7684\\u8BDD\\u914D\\u4E86\\u4E5F\\u7528\\u4E0D\\u4E86\\uFF0C\\u5148\\u89E3\\u51B3\\u7F51\\u7EDC\\uFF09\\uFF1BGoogle \\u8D26\\u53F7\\u9700\\u5DF2\\u5F00\\u542F\\u4E24\\u6B65\\u9A8C\\u8BC1\\u3002",\n "\\u6253\\u5F00 myaccount.google.com/apppasswords \\u2192 \\u751F\\u6210\\u5E94\\u7528\\u5BC6\\u7801\\uFF0816 \\u4F4D\\uFF09\\uFF0C\\u590D\\u5236\\u5B83\\u3002"\n ] }\n ];\n const providerSel = h(\n "select",\n {},\n ...PROVIDER_STEPS.map((p) => h("option", { value: p.key }, p.label))\n );\n const pickByAddress = () => {\n const at = address.value.split("@")[1]?.toLowerCase() ?? "";\n const matched = PROVIDER_STEPS.find((p) => p.domains.some((d) => at === d || at.endsWith("." + d)));\n if (matched && providerSel.value !== matched.key) {\n providerSel.value = matched.key;\n }\n };\n const guideBody = h("div", {});\n const renderGuide = () => {\n const hit = PROVIDER_STEPS.find((p) => p.key === providerSel.value) ?? PROVIDER_STEPS[0];\n guideBody.replaceChildren(...hit.paras.map((t) => h("p", { class: "cf-hint" }, t)));\n };\n pickByAddress();\n if (provider !== "other") providerSel.value = provider;\n renderGuide();\n providerSel.addEventListener("change", renderGuide);\n address.addEventListener("input", () => {\n pickByAddress();\n renderGuide();\n });\n const guide = configured ? null : h(\n "section",\n { class: "settings-group imap-guide" },\n h("h3", {}, "\\u600E\\u4E48\\u62FF\\u5230\\u6388\\u6743\\u7801"),\n ...provider === "other" ? [fieldRow("\\u4F60\\u7684\\u90AE\\u7BB1\\u662F", providerSel)] : [],\n guideBody,\n h(\n "p",\n { class: "cf-hint" },\n "\\u5361\\u5728\\u54EA\\u4E00\\u6B65\\uFF0C\\u76F4\\u63A5\\u622A\\u56FE\\u95EE\\u4F60\\u7684\\u52A9\\u624B\\uFF08\\u53D1\\u4E4B\\u524D\\u628A\\u6388\\u6743\\u7801\\u533A\\u57DF\\u906E\\u4E00\\u4E0B\\uFF09\\u3002"\n ),\n h(\n "p",\n { class: "cf-hint" },\n "\\u62FF\\u5230\\u540E\\uFF1A\\u628A\\u5B8C\\u6574\\u90AE\\u7BB1\\u5730\\u5740\\u548C\\u6388\\u6743\\u7801\\u586B\\u5728\\u4E0B\\u9762\\uFF0C\\u70B9\\u4FDD\\u5B58\\u3002\\u4FDD\\u5B58\\u540E\\u5728\\u804A\\u5929\\u91CC\\u8BF4\\u4E00\\u58F0\\u300C\\u90AE\\u7BB1\\u914D\\u597D\\u4E86\\u300D\\uFF0C\\u52A9\\u624B\\u4F1A\\u81EA\\u5DF1\\u9A8C\\u8BC1\\u8FDE\\u901A\\u3002"\n )\n );\n wrap.replaceChildren(\n ...guide ? [guide] : [],\n h(\n "section",\n { class: "settings-group" },\n h("h3", {}, configured ? `\\u5DF2\\u6258\\u7BA1\\uFF1A${str("address")}` : "\\u90AE\\u7BB1\\u8D26\\u53F7"),\n fieldRow("\\u90AE\\u7BB1\\u5730\\u5740", address),\n fieldRow(\n "\\u6388\\u6743\\u7801",\n pass,\n h("p", { class: "cf-hint" }, "\\u4E0D\\u662F\\u767B\\u5F55\\u5BC6\\u7801\\u3002QQ\\uFF1A\\u5934\\u50CF \\u2192 \\u8D26\\u53F7\\u4E0E\\u5B89\\u5168 \\u2192 \\u5B89\\u5168\\u8BBE\\u7F6E\\uFF1B163\\uFF1A\\u8BBE\\u7F6E \\u2192 POP3/SMTP/IMAP\\u3002")\n ),\n smtpPass ? fieldRow("SMTP \\u6388\\u6743\\u7801\\uFF08\\u53EF\\u9009\\uFF09", smtpPass) : null,\n fieldRow(\n "\\u53D1\\u4FE1\\u786E\\u8BA4",\n policy,\n h("p", { class: "cf-hint" }, "\\u5206\\u7EA7\\uFF08\\u63A8\\u8350\\uFF09\\uFF1A\\u5DF2\\u786E\\u8BA4\\u7684\\u8054\\u7CFB\\u4EBA\\u76F4\\u63A5\\u53D1\\u3001\\u964C\\u751F\\u7684\\u5148\\u8FC7\\u76EE\\uFF1B\\u5168\\u90E8\\u786E\\u8BA4\\uFF1A\\u6BCF\\u5C01\\u90FD\\u8FC7\\u76EE\\uFF1B\\u5168\\u90E8\\u76F4\\u53D1\\uFF1A\\u4E0D\\u95EE\\uFF08\\u7559\\u53D1\\u9001\\u8BB0\\u5F55\\uFF09\\u3002")\n ),\n ...internal ? [\n h("p", { class: "cf-hint" }, "\\u4E0B\\u9762\\u4E09\\u683C\\u662F\\u5185\\u90E8\\u6A21\\u5F0F\\u624D\\u663E\\u793A\\u7684\\uFF1A\\u4F01\\u4E1A\\u81EA\\u5EFA\\u90AE\\u7BB1\\u7684\\u670D\\u52A1\\u5668\\u5730\\u5740\\u8986\\u76D6\\u3001\\u5355\\u65E5\\u53D1\\u4FE1\\u4E0A\\u9650\\u3002"),\n imapHost ? fieldRow("IMAP \\u670D\\u52A1\\u5668", imapHost) : null,\n smtpHost ? fieldRow("SMTP \\u670D\\u52A1\\u5668", smtpHost) : null,\n dailyLimit ? fieldRow("\\u5355\\u65E5\\u53D1\\u4FE1\\u4E0A\\u9650", dailyLimit) : null\n ] : [],\n h("div", { class: "cfg-savebar" }, h("div", { class: "btn-row" }, save), status, detail)\n )\n );\n refreshSave();\n })().catch(() => {\n if (alive) wrap.replaceChildren(h("p", { class: "inline-error" }, "\\u6682\\u65F6\\u65E0\\u6CD5\\u8BFB\\u53D6\\u90AE\\u7BB1\\u914D\\u7F6E\\uFF0C\\u8BF7\\u7A0D\\u540E\\u91CD\\u65B0\\u9009\\u62E9\\u3002"));\n });\n return () => {\n alive = false;\n };\n }\n var POLICY_TEXT = {\n tiered: "\\u5206\\u7EA7\\uFF08\\u63A8\\u8350\\uFF1A\\u719F\\u5BA2\\u76F4\\u53D1\\u3001\\u964C\\u751F\\u5148\\u8FC7\\u76EE\\uFF09",\n "confirm-all": "\\u5168\\u90E8\\u786E\\u8BA4\\uFF08\\u6BCF\\u5C01\\u90FD\\u5148\\u8FC7\\u76EE\\uFF09",\n auto: "\\u5168\\u90E8\\u76F4\\u53D1\\uFF08\\u4E0D\\u95EE\\uFF0C\\u7559\\u53D1\\u9001\\u8BB0\\u5F55\\uFF09"\n };\n\n // web-console/desktop/src/renderer/shared/connector-catalog.ts\n var connectorCatalog = [\n { id: "gmail", name: "Gmail", mark: "M", category: "\\u5DE5\\u4F5C\\u4E0E\\u6C9F\\u901A", purpose: "\\u91CD\\u8981\\u7684\\u90AE\\u4EF6\\uFF0C\\u548C\\u8FD8\\u6CA1\\u6765\\u5F97\\u53CA\\u56DE\\u7684\\u8BDD\\u3002", first: "\\u4E00\\u8D77\\u6311\\u51FA\\u8981\\u56DE\\u590D\\u7684\\u90AE\\u4EF6\\uFF0C\\u5148\\u628A\\u56DE\\u4FE1\\u60F3\\u597D\\u3002", access: "\\u767B\\u5F55 Google\\uFF0C\\u9009\\u62E9\\u5141\\u8BB8\\u8BFB\\u53D6\\u7684\\u90AE\\u4EF6\\u8303\\u56F4\\u3002", action: "\\u53D1\\u9001\\u3001\\u5220\\u9664\\u548C\\u9000\\u8BA2\\u65F6\\uFF0C\\u518D\\u5355\\u72EC\\u786E\\u8BA4\\u3002", sources: [\n { id: "inbox", label: "\\u6536\\u4EF6\\u7BB1 \\xB7 \\u6700\\u8FD1 7 \\u5929", sample: "\\u6709\\u4E00\\u5C01\\u5173\\u4E8E\\u5468\\u4E94\\u5206\\u4EAB\\u7684\\u9080\\u8BF7\\uFF0C\\u8FD8\\u6CA1\\u6709\\u56DE\\u590D\\u3002" },\n { id: "starred", label: "\\u5DF2\\u52A0\\u661F\\u6807\\u7684\\u90AE\\u4EF6", sample: "\\u7559\\u7740\\u4E24\\u5C01\\u8D44\\u6599\\u90AE\\u4EF6\\uFF0C\\u53EF\\u4EE5\\u6574\\u7406\\u8FDB\\u5206\\u4EAB\\u51C6\\u5907\\u3002" }\n ] },\n { id: "calendar", name: "\\u65E5\\u5386", mark: "31", category: "\\u6BCF\\u5929\\u7684\\u5B89\\u6392", purpose: "\\u77E5\\u9053\\u4F60\\u4EC0\\u4E48\\u65F6\\u5019\\u5FD9\\uFF0C\\u4E5F\\u7559\\u4E00\\u70B9\\u7A7A\\u767D\\u3002", first: "\\u770B\\u4E00\\u773C\\u63A5\\u4E0B\\u6765\\u7684\\u5B89\\u6392\\uFF0C\\u4E00\\u8D77\\u7559\\u51FA\\u4F11\\u606F\\u65F6\\u95F4\\u3002", access: "\\u9009\\u62E9 Google \\u65E5\\u5386\\uFF1B\\u8BBE\\u5907\\u65E5\\u5386\\u7531\\u624B\\u673A\\u5355\\u72EC\\u6388\\u6743\\u3002", action: "\\u65B0\\u5EFA\\u3001\\u4FEE\\u6539\\u6216\\u53D6\\u6D88\\u65E5\\u7A0B\\u65F6\\uFF0C\\u518D\\u95EE\\u4F60\\u3002", sources: [\n { id: "work", label: "\\u5DE5\\u4F5C\\u65E5\\u5386 \\xB7 \\u672A\\u6765 7 \\u5929", sample: "\\u5468\\u4E94\\u4E0B\\u5348\\u6709\\u4E00\\u573A\\u5206\\u4EAB\\u8BC4\\u5BA1\\uFF0C\\u53EF\\u4EE5\\u63D0\\u524D\\u7559\\u51FA\\u51C6\\u5907\\u65F6\\u95F4\\u3002" },\n { id: "personal", label: "\\u4E2A\\u4EBA\\u65E5\\u5386 \\xB7 \\u672A\\u6765 7 \\u5929", sample: "\\u5468\\u516D\\u508D\\u665A\\u7559\\u4E86\\u6563\\u6B65\\u65F6\\u95F4\\uFF0C\\u53EF\\u4EE5\\u53BB\\u6C5F\\u8FB9\\u8D70\\u8D70\\u3002" }\n ] },\n { id: "github", name: "GitHub", mark: "{ }", category: "\\u4E00\\u8D77\\u505A\\u9879\\u76EE", purpose: "\\u63A5\\u4E0A\\u4F60\\u6B63\\u5728\\u5199\\u7684\\u4EE3\\u7801\\u548C\\u6CA1\\u505A\\u5B8C\\u7684\\u4E8B\\u3002", first: "\\u4ECE\\u4E00\\u4E2A\\u4ED3\\u5E93\\u5F00\\u59CB\\uFF0C\\u63A5\\u7740\\u770B\\u672A\\u5B8C\\u6210\\u7684 Issue \\u548C PR\\u3002", access: "\\u767B\\u5F55 GitHub\\uFF0C\\u53EA\\u9009\\u62E9\\u60F3\\u4E00\\u8D77\\u770B\\u7684\\u4ED3\\u5E93\\u3002", action: "\\u63D0\\u4EA4\\u4EE3\\u7801\\u3001\\u8BC4\\u8BBA\\u548C\\u5408\\u5E76\\u8BF7\\u6C42\\u65F6\\uFF0C\\u518D\\u786E\\u8BA4\\u3002", sources: [\n { id: "app", label: "weekend-studio / app", sample: "\\u5BFC\\u822A\\u6539\\u7248\\u6709\\u4E00\\u4E2A\\u5F85\\u8BC4\\u5BA1 PR\\uFF0C\\u7A84\\u5C4F\\u9002\\u914D\\u8FD8\\u6CA1\\u9A8C\\u6536\\u3002" },\n { id: "docs", label: "weekend-studio / notes", sample: "\\u9879\\u76EE\\u8BF4\\u660E\\u6709\\u4E00\\u9879\\u5F85\\u8865\\u5145\\uFF1A\\u65B0\\u7528\\u6237\\u5982\\u4F55\\u5F00\\u59CB\\u3002" }\n ] },\n { method: "device", id: "health", name: "\\u5065\\u5EB7", mark: "\\u2661", category: "\\u751F\\u6D3B\\u7684\\u8282\\u594F", purpose: "\\u4ECE\\u7761\\u7720\\u548C\\u6D3B\\u52A8\\uFF0C\\u6162\\u6162\\u4E86\\u89E3\\u4F60\\u7684\\u65E5\\u5E38\\u3002", first: "\\u4E00\\u8D77\\u56DE\\u987E\\u6700\\u8FD1\\u7684\\u4F5C\\u606F\\uFF0C\\u804A\\u804A\\u600E\\u4E48\\u8FC7\\u5F97\\u8212\\u670D\\u4E00\\u70B9\\u3002", access: "\\u5728\\u624B\\u673A\\u4E0A\\u8FDE\\u63A5 Apple \\u5065\\u5EB7\\u6216 Health Connect\\uFF0C\\u9010\\u9879\\u9009\\u62E9\\u6570\\u636E\\u3002", action: "\\u4EC5\\u67E5\\u770B\\u4F60\\u9009\\u7684\\u8D8B\\u52BF\\uFF1B\\u4E0D\\u636E\\u6B64\\u505A\\u8BCA\\u65AD\\u6216\\u7528\\u836F\\u5EFA\\u8BAE\\u3002", sources: [\n { id: "sleep", label: "\\u7761\\u7720\\u65F6\\u957F \\xB7 \\u6700\\u8FD1 7 \\u5929", sample: "\\u793A\\u4F8B\\u91CC\\u6709\\u4E24\\u665A\\u7761\\u5F97\\u6BD4\\u8F83\\u665A\\uFF0C\\u53EF\\u4EE5\\u804A\\u804A\\u6700\\u8FD1\\u5FD9\\u4E9B\\u4EC0\\u4E48\\u3002" },\n { id: "steps", label: "\\u6BCF\\u65E5\\u6B65\\u6570 \\xB7 \\u6700\\u8FD1 7 \\u5929", sample: "\\u5468\\u672B\\u8D70\\u8DEF\\u6BD4\\u5DE5\\u4F5C\\u65E5\\u591A\\uFF0C\\u508D\\u665A\\u6563\\u6B65\\u4E5F\\u8BB8\\u662F\\u4E2A\\u597D\\u4E60\\u60EF\\u3002" }\n ] },\n { method: "import", id: "notes", name: "\\u5907\\u5FD8\\u5F55", mark: "\\u2261", category: "\\u968F\\u624B\\u8BB0\\u4E0B\\u7684\\u4F60", purpose: "\\u60E6\\u8BB0\\u7684\\u5730\\u65B9\\u3001\\u5192\\u51FA\\u7684\\u5FF5\\u5934\\uFF0C\\u90FD\\u63A5\\u5F97\\u4E0A\\u3002", first: "\\u4ECE\\u51E0\\u5219\\u4F60\\u9009\\u7684\\u7B14\\u8BB0\\uFF0C\\u6574\\u7406\\u51FA\\u60F3\\u7EE7\\u7EED\\u804A\\u7684\\u4E8B\\u3002", access: "\\u4ECE Apple \\u5907\\u5FD8\\u5F55\\u3001Keep \\u6216\\u672C\\u5730\\u7B14\\u8BB0\\u5206\\u4EAB\\uFF0F\\u5BFC\\u5165\\u6240\\u9009\\u5185\\u5BB9\\u3002", action: "\\u539F\\u7B14\\u8BB0\\u4FDD\\u6301\\u539F\\u6837\\uFF1B\\u65B0\\u5185\\u5BB9\\u5148\\u653E\\u5728\\u8349\\u7A3F\\u91CC\\u7ED9\\u4F60\\u770B\\u3002", sources: [\n { id: "ideas", label: "\\u5206\\u4EAB\\u7ED9\\u5979\\u7684\\u7075\\u611F\\u7B14\\u8BB0 \\xB7 2 \\u5219", sample: "\\u60F3\\u5728\\u5F00\\u573A\\u8BB2\\u4E00\\u4E2A\\u5C0F\\u6545\\u4E8B\\uFF0C\\u8FD8\\u6709\\u4E00\\u6B21\\u6CA1\\u6392\\u671F\\u7684\\u6D77\\u8FB9\\u65C5\\u884C\\u3002" },\n { id: "reading", label: "\\u9009\\u4E2D\\u7684\\u9605\\u8BFB\\u7B14\\u8BB0 \\xB7 1 \\u5219", sample: "\\u8BFB\\u5230\\u4E00\\u53E5\\u5173\\u4E8E\\u7559\\u767D\\u7684\\u8BDD\\uFF0C\\u60F3\\u653E\\u8FDB\\u4E0B\\u6B21\\u5206\\u4EAB\\u3002" }\n ] },\n { id: "reminders", name: "\\u63D0\\u9192\\u4E8B\\u9879", mark: "\\u2713", category: "\\u6BCF\\u5929\\u7684\\u5B89\\u6392", method: "device", purpose: "\\u7B54\\u5E94\\u81EA\\u5DF1\\u7684\\u5C0F\\u4E8B\\uFF0C\\u4E5F\\u6709\\u4EBA\\u4E00\\u8D77\\u60E6\\u8BB0\\u3002", first: "\\u4ECE\\u4F60\\u9009\\u7684\\u6E05\\u5355\\u91CC\\uFF0C\\u6311\\u51FA\\u4ECA\\u5929\\u6700\\u60F3\\u5B8C\\u6210\\u7684\\u4E00\\u4EF6\\u4E8B\\u3002", access: "\\u5728\\u624B\\u673A\\u4E0A\\u9009\\u62E9\\u63D0\\u9192\\u4E8B\\u9879\\u6E05\\u5355\\uFF0C\\u9010\\u9879\\u6388\\u6743\\u3002", action: "\\u65B0\\u5EFA\\u6216\\u5B8C\\u6210\\u63D0\\u9192\\u65F6\\uFF0C\\u518D\\u7531\\u4F60\\u786E\\u8BA4\\u3002", sources: [{ id: "today", label: "\\u4ECA\\u5929\\u6E05\\u5355", sample: "\\u8FD8\\u6709\\u4E00\\u4EF6\\u5C0F\\u4E8B\\uFF1A\\u4E0B\\u73ED\\u8DEF\\u4E0A\\u5E26\\u4E00\\u672C\\u4E66\\u56DE\\u5BB6\\u3002" }, { id: "weekend", label: "\\u5468\\u672B\\u6E05\\u5355", sample: "\\u60F3\\u6574\\u7406\\u4E66\\u67B6\\uFF0C\\u4E5F\\u60F3\\u51FA\\u53BB\\u8D70\\u8D70\\u3002" }] },\n { id: "photos", name: "\\u7167\\u7247", mark: "\\u25A7", category: "\\u5171\\u540C\\u7684\\u7247\\u6BB5", method: "device", purpose: "\\u4E00\\u5F20\\u7167\\u7247\\uFF0C\\u5C31\\u80FD\\u63A5\\u7740\\u804A\\u90A3\\u5929\\u7684\\u6545\\u4E8B\\u3002", first: "\\u6311\\u51E0\\u5F20\\u7167\\u7247\\uFF0C\\u4E00\\u8D77\\u7559\\u4F4F\\u5F53\\u65F6\\u7684\\u611F\\u53D7\\u3002", access: "\\u4F7F\\u7528\\u7CFB\\u7EDF\\u7167\\u7247\\u9009\\u62E9\\u5668\\uFF0C\\u53EA\\u5206\\u4EAB\\u4F60\\u9009\\u4E2D\\u7684\\u7167\\u7247\\u3002", action: "\\u4E0D\\u8BFB\\u53D6\\u6574\\u672C\\u76F8\\u518C\\uFF1B\\u4FDD\\u5B58\\u6216\\u5206\\u4EAB\\u65F6\\u53E6\\u884C\\u786E\\u8BA4\\u3002", sources: [{ id: "weekend", label: "\\u9009\\u4E2D\\u7684\\u5468\\u672B\\u7167\\u7247 \\xB7 3 \\u5F20", sample: "\\u8FD9\\u51E0\\u5F20\\u6C5F\\u8FB9\\u7167\\u7247\\uFF0C\\u53EF\\u4EE5\\u6574\\u7406\\u6210\\u4E00\\u6BB5\\u5468\\u672B\\u7684\\u5C0F\\u8BB0\\u3002" }, { id: "inspiration", label: "\\u9009\\u4E2D\\u7684\\u7075\\u611F\\u56FE\\u7247 \\xB7 2 \\u5F20", sample: "\\u4E24\\u5F20\\u6E29\\u6696\\u7684\\u5BA4\\u5185\\u7167\\u7247\\uFF0C\\u53EF\\u4EE5\\u7559\\u4F5C\\u4E0B\\u6B21\\u5E03\\u7F6E\\u7684\\u53C2\\u8003\\u3002" }] },\n { id: "contacts", name: "\\u901A\\u8BAF\\u5F55", mark: "\\u25CE", category: "\\u4F60\\u5728\\u610F\\u7684\\u4EBA", method: "device", purpose: "\\u4F60\\u63D0\\u8D77\\u7684\\u4EBA\\uFF0C\\u6162\\u6162\\u6709\\u4E86\\u6765\\u5904\\u3002", first: "\\u9009\\u51E0\\u4F4D\\u5E38\\u8054\\u7CFB\\u7684\\u4EBA\\uFF0C\\u8BA9\\u79F0\\u547C\\u548C\\u5173\\u7CFB\\u66F4\\u6E05\\u695A\\u3002", access: "\\u901A\\u8FC7\\u624B\\u673A\\u7CFB\\u7EDF\\u9009\\u62E9\\u8981\\u5206\\u4EAB\\u7684\\u8054\\u7CFB\\u4EBA\\u3002", action: "\\u4E0D\\u4F1A\\u81EA\\u52A8\\u8054\\u7CFB\\u4EFB\\u4F55\\u4EBA\\uFF1B\\u53D1\\u9001\\u6D88\\u606F\\u4ECD\\u9700\\u4F60\\u786E\\u8BA4\\u3002", sources: [{ id: "selected", label: "\\u9009\\u4E2D\\u7684\\u8054\\u7CFB\\u4EBA \\xB7 2 \\u4F4D", sample: "\\u793A\\u4F8B\\u91CC\\u6709\\u4E24\\u4F4D\\u5E38\\u8054\\u7CFB\\u7684\\u4EBA\\uFF0C\\u53EF\\u4EE5\\u5148\\u8BB0\\u6E05\\u4F60\\u600E\\u4E48\\u79F0\\u547C\\u4ED6\\u4EEC\\u3002" }] },\n { id: "files", name: "\\u6587\\u4EF6", mark: "\\u25A4", category: "\\u624B\\u8FB9\\u7684\\u6750\\u6599", method: "import", purpose: "\\u624B\\u8FB9\\u7684\\u6587\\u4EF6\\uFF0C\\u968F\\u65F6\\u62FF\\u51FA\\u6765\\u4E00\\u8D77\\u770B\\u3002", first: "\\u4ECE\\u4E00\\u4EFD\\u6587\\u6863\\u5F00\\u59CB\\uFF0C\\u6574\\u7406\\u91CD\\u70B9\\u548C\\u8FD8\\u6CA1\\u89E3\\u51B3\\u7684\\u95EE\\u9898\\u3002", access: "\\u4ECE\\u624B\\u673A\\u6216\\u7535\\u8111\\u9009\\u62E9\\u6587\\u4EF6\\uFF0C\\u4E0D\\u8BFB\\u53D6\\u6574\\u4E2A\\u78C1\\u76D8\\u3002", action: "\\u539F\\u6587\\u4EF6\\u4FDD\\u7559\\uFF1B\\u4FEE\\u6539\\u540E\\u7684\\u7248\\u672C\\u5148\\u7ED9\\u4F60\\u770B\\u3002", sources: [{ id: "document", label: "\\u9009\\u4E2D\\u7684\\u6587\\u6863 \\xB7 1 \\u4EFD", sample: "\\u8FD9\\u4EFD\\u5206\\u4EAB\\u63D0\\u7EB2\\u6709\\u4E09\\u4E2A\\u91CD\\u70B9\\uFF0C\\u5F00\\u5934\\u7684\\u4F8B\\u5B50\\u8FD8\\u53EF\\u4EE5\\u518D\\u63A8\\u6572\\u3002" }] },\n { id: "qq", name: "QQ \\u90AE\\u7BB1", mark: "QQ", category: "\\u90AE\\u4EF6\\u4E0E\\u6C9F\\u901A", method: "mail", purpose: "\\u719F\\u6089\\u7684\\u90AE\\u7BB1\\uFF0C\\u4E5F\\u80FD\\u4E00\\u8D77\\u6574\\u7406\\u3002", first: "\\u5148\\u6311\\u51FA\\u9700\\u8981\\u56DE\\u590D\\u7684\\u90AE\\u4EF6\\uFF0C\\u7ED9\\u5FD9\\u788C\\u7684\\u4E00\\u5929\\u51CF\\u4E00\\u70B9\\u8D1F\\u62C5\\u3002", access: "\\u4F7F\\u7528\\u90AE\\u7BB1\\u6388\\u6743\\u7801\\u8FDE\\u63A5\\uFF1B\\u539F\\u90AE\\u7BB1\\u7BA1\\u7406\\u4F1A\\u7EE7\\u7EED\\u63D0\\u4F9B\\u3002", action: "\\u53D1\\u4FE1\\u6743\\u9650\\u6CBF\\u7528\\u90AE\\u7BB1\\u8BBE\\u7F6E\\uFF0C\\u6BCF\\u6B21\\u91CD\\u8981\\u64CD\\u4F5C\\u5148\\u786E\\u8BA4\\u3002", sources: [{ id: "inbox", label: "\\u6536\\u4EF6\\u7BB1 \\xB7 \\u6700\\u8FD1 7 \\u5929", sample: "\\u6536\\u5230\\u4E00\\u5C01\\u6D3B\\u52A8\\u786E\\u8BA4\\u90AE\\u4EF6\\uFF0C\\u53EF\\u4EE5\\u5148\\u6574\\u7406\\u65F6\\u95F4\\u548C\\u5730\\u70B9\\u3002" }] },\n { id: "netease", name: "163 \\u90AE\\u7BB1", mark: "163", category: "\\u90AE\\u4EF6\\u4E0E\\u6C9F\\u901A", method: "mail", purpose: "\\u901A\\u77E5\\u3001\\u56DE\\u4FE1\\u548C\\u6750\\u6599\\uFF0C\\u6536\\u62FE\\u5F97\\u66F4\\u6E05\\u695A\\u3002", first: "\\u628A\\u6563\\u843D\\u7684\\u90AE\\u4EF6\\u6750\\u6599\\u6574\\u7406\\u6210\\u4E00\\u4EFD\\u7B80\\u77ED\\u6E05\\u5355\\u3002", access: "\\u652F\\u6301163\\uFF0F126\\uFF0F188\\u90AE\\u7BB1\\uFF0C\\u4F7F\\u7528\\u5BA2\\u6237\\u7AEF\\u6388\\u6743\\u5BC6\\u7801\\u3002", action: "\\u53D1\\u4FE1\\u6743\\u9650\\u6CBF\\u7528\\u90AE\\u7BB1\\u8BBE\\u7F6E\\uFF0C\\u6BCF\\u6B21\\u91CD\\u8981\\u64CD\\u4F5C\\u5148\\u786E\\u8BA4\\u3002", sources: [{ id: "inbox", label: "\\u6536\\u4EF6\\u7BB1 \\xB7 \\u6700\\u8FD1 7 \\u5929", sample: "\\u4E00\\u5C01\\u8D44\\u6599\\u90AE\\u4EF6\\u91CC\\u6709\\u4E09\\u4EFD\\u9644\\u4EF6\\uFF0C\\u53EF\\u4EE5\\u5148\\u770B\\u54EA\\u4E00\\u4EFD\\u6700\\u76F8\\u5173\\u3002" }] },\n { id: "notion", name: "Notion", mark: "N", category: "\\u7B14\\u8BB0\\u4E0E\\u9879\\u76EE", purpose: "\\u5DE5\\u4F5C\\u53F0\\u91CC\\u7684\\u60F3\\u6CD5\\uFF0C\\u7EE7\\u7EED\\u5F80\\u524D\\u8D70\\u3002", first: "\\u9009\\u4E00\\u4E2A\\u9879\\u76EE\\u9875\\u9762\\uFF0C\\u63A5\\u7740\\u6574\\u7406\\u5DF2\\u7ECF\\u6709\\u7684\\u6750\\u6599\\u3002", access: "\\u767B\\u5F55 Notion\\uFF0C\\u5E76\\u9009\\u62E9\\u5141\\u8BB8\\u8BBF\\u95EE\\u7684\\u9875\\u9762\\u3002", action: "\\u4FEE\\u6539\\u9875\\u9762\\u524D\\u786E\\u8BA4\\uFF0C\\u4E0D\\u9ED8\\u8BA4\\u5206\\u4EAB\\u6574\\u4E2A\\u5DE5\\u4F5C\\u533A\\u3002", sources: [{ id: "project", label: "\\u9009\\u4E2D\\u7684\\u9879\\u76EE\\u9875\\u9762", sample: "\\u9879\\u76EE\\u7B14\\u8BB0\\u91CC\\u7684\\u76EE\\u6807\\u5DF2\\u7ECF\\u6E05\\u695A\\uFF0C\\u4E0B\\u4E00\\u6B65\\u662F\\u6574\\u7406\\u9A8C\\u6536\\u6E05\\u5355\\u3002" }] },\n { id: "drive", name: "Google \\u4E91\\u7AEF\\u786C\\u76D8", mark: "\\u25B3", category: "\\u4E91\\u7AEF\\u7684\\u6750\\u6599", purpose: "\\u4E91\\u7AEF\\u7684\\u6587\\u6863\\uFF0C\\u4E5F\\u653E\\u5230\\u540C\\u4E00\\u6BB5\\u8BA8\\u8BBA\\u91CC\\u3002", first: "\\u4ECE\\u4F60\\u9009\\u7684\\u6587\\u4EF6\\u5939\\u91CC\\uFF0C\\u627E\\u51FA\\u8FD9\\u6B21\\u8BA8\\u8BBA\\u9700\\u8981\\u7684\\u6750\\u6599\\u3002", access: "\\u767B\\u5F55 Google\\uFF0C\\u9009\\u62E9\\u8981\\u5206\\u4EAB\\u7684\\u6587\\u4EF6\\u6216\\u6587\\u4EF6\\u5939\\u3002", action: "\\u4FEE\\u6539\\u3001\\u5220\\u9664\\u548C\\u5BF9\\u5916\\u5206\\u4EAB\\u65F6\\uFF0C\\u53E6\\u884C\\u786E\\u8BA4\\u3002", sources: [{ id: "folder", label: "\\u9009\\u4E2D\\u7684\\u5206\\u4EAB\\u6750\\u6599\\u6587\\u4EF6\\u5939", sample: "\\u6587\\u4EF6\\u5939\\u91CC\\u6709\\u8BB2\\u7A3F\\u548C\\u914D\\u56FE\\uFF0C\\u9002\\u5408\\u4E00\\u8D77\\u68C0\\u67E5\\u662F\\u5426\\u5BF9\\u5E94\\u3002" }] },\n { id: "outlook", name: "Outlook", mark: "O", category: "\\u90AE\\u4EF6\\u4E0E\\u6C9F\\u901A", purpose: "\\u5DE5\\u4F5C\\u90AE\\u7BB1\\u91CC\\u7684\\u4E8B\\uFF0C\\u4E5F\\u80FD\\u63A5\\u5F97\\u4E0A\\u3002", first: "\\u770B\\u770B\\u9700\\u8981\\u56DE\\u5E94\\u7684\\u5DE5\\u4F5C\\u90AE\\u4EF6\\uFF0C\\u5148\\u6574\\u7406\\u4F18\\u5148\\u987A\\u5E8F\\u3002", access: "\\u767B\\u5F55 Microsoft\\uFF0C\\u9009\\u62E9\\u90AE\\u7BB1\\u7684\\u8BFB\\u53D6\\u6743\\u9650\\u3002", action: "\\u53D1\\u9001\\u6216\\u5220\\u9664\\u90AE\\u4EF6\\u524D\\uFF0C\\u518D\\u5355\\u72EC\\u786E\\u8BA4\\u3002", sources: [{ id: "inbox", label: "\\u6536\\u4EF6\\u7BB1 \\xB7 \\u6700\\u8FD1 7 \\u5929", sample: "\\u6536\\u5230\\u4E00\\u5C01\\u8BC4\\u5BA1\\u5B89\\u6392\\uFF0C\\u53EF\\u4EE5\\u5148\\u6838\\u5BF9\\u9700\\u8981\\u51C6\\u5907\\u7684\\u5185\\u5BB9\\u3002" }] }\n ];\n var connectorGroups = [\n { id: "daily", name: "\\u65E5\\u5E38\\u5B89\\u6392", connectors: ["calendar", "reminders", "contacts"] },\n { id: "notes", name: "\\u7B14\\u8BB0\\u4E0E\\u6587\\u4EF6", connectors: ["notes", "notion", "files", "drive"] },\n { id: "life", name: "\\u751F\\u6D3B\\u4E0E\\u5065\\u5EB7", connectors: ["photos", "health"] },\n { id: "mail", name: "\\u90AE\\u7BB1", connectors: ["gmail", "qq", "netease", "outlook"] },\n { id: "development", name: "\\u5F00\\u53D1\\u5DE5\\u5177", connectors: ["github"] }\n ];\n var order = connectorGroups.flatMap((group) => group.connectors);\n connectorCatalog.sort((a, b) => order.indexOf(a.id) - order.indexOf(b.id));\n var connectorById = (id) => connectorCatalog.find((c) => c.id === id);\n\n // web-console/desktop/src/renderer/shared/connector-view.ts\n var connectorEscape = (text) => text.replace(/[&<>"\']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", \'"\': "&quot;", "\'": "&#39;" })[c]);\n var connectorMark = (c) => `<span class="cx-mark cx-${c.id}" aria-hidden="true">${c.mark}</span>`;\n function connectorHero() {\n return `<section class="cx-hero"><div><p class="cx-eyebrow">A LITTLE MORE OF YOUR WORLD</p><h1>\\u4ECE\\u4F60\\u7684\\u65E5\\u5E38\\uFF0C<br>\\u5F00\\u59CB\\u719F\\u6089\\u5F7C\\u6B64\\u3002</h1><p>\\u5E26\\u4E0A\\u6B63\\u5728\\u505A\\u7684\\u4E8B\\u3001\\u63A5\\u4E0B\\u6765\\u7684\\u5B89\\u6392\\uFF0C<br>\\u8FD8\\u6709\\u968F\\u624B\\u8BB0\\u4E0B\\u7684\\u5FF5\\u5934\\u3002</p><small>\\u5148\\u9009\\u4E00\\u4E2A\\u5C31\\u597D\\u3002\\u4E5F\\u53EF\\u4EE5\\u4E4B\\u540E\\u518D\\u6765\\u3002</small></div><div class="cx-orbit" aria-hidden="true"><span class="cx-orbit-center"><img src="../shared/aurora-mark.svg" alt="" width="52" height="52"></span>${connectorCatalog.filter((c) => ["calendar", "notes", "health", "gmail", "github"].includes(c.id)).map(connectorMark).join("")}</div></section>`;\n }\n function connectorCard(c, state, button) {\n return `<article class="cx-card" data-connector-card="${c.id}" data-search="${c.name} ${c.category} ${c.purpose}"><div class="cx-card-head">${connectorMark(c)}<span><h3>${c.name}</h3><small>${c.category}</small></span><span class="cx-state">${connectorEscape(state)}</span></div><p>${c.purpose}</p><button type="button" class="cx-link" data-connector-open="${c.id}">${connectorEscape(button)} <span aria-hidden="true">\\u2197</span></button></article>`;\n }\n function connectorDirectory(card, include = () => true) {\n return `<div class="cx-groups">${connectorGroups.map((group) => {\n const entries = connectorCatalog.filter((c) => group.connectors.includes(c.id) && include(c));\n if (!entries.length) return "";\n return `<section class="cx-group" data-connector-group="${group.id}" data-search="${group.name}" aria-labelledby="connector-group-${group.id}"><div class="cx-group-heading"><h2 id="connector-group-${group.id}">${group.name}</h2><span><span data-connector-count>${entries.length}</span> \\u4E2A\\u8FDE\\u63A5\\u5668</span></div><div class="cx-grid">${entries.map(card).join("")}</div></section>`;\n }).join("")}</div>`;\n }\n function filterConnectorDirectory(root, search) {\n const term = search.trim().toLowerCase();\n let found = false;\n for (const group of Array.from(root.querySelectorAll("[data-connector-group]"))) {\n const rows = Array.from(group.querySelectorAll("[data-connector-card]"));\n for (const row of rows) row.hidden = !`${group.dataset.search} ${row.dataset.search}`.toLowerCase().includes(term);\n const count = rows.filter((row) => !row.hidden).length;\n group.hidden = count === 0;\n group.querySelector("[data-connector-count]").textContent = String(count);\n found ||= count > 0;\n }\n return found;\n }\n function connectorIntro(c) {\n return `<div class="cx-detail-title">${connectorMark(c)}<div><p class="cx-eyebrow">${c.category}</p><h1>${c.name}</h1></div></div><p class="cx-lead">${c.purpose}</p><div class="cx-value"><span class="cx-eyebrow">\\u7B2C\\u4E00\\u4EF6\\u53EF\\u4EE5\\u4E00\\u8D77\\u505A\\u7684\\u4E8B</span><p>${c.first}</p></div>`;\n }\n\n // web-console/desktop/src/renderer/console/pages/connectors.ts\n function mountConnectors(body, marker, deps) {\n let cleanup, alive = true;\n const root = h("div", { class: "page cx-console cx-root" });\n body.replaceChildren(root);\n const release = () => {\n cleanup?.();\n cleanup = void 0;\n };\n const catalog = () => {\n release();\n root.innerHTML = `${connectorHero()}<div class="cx-toolbar"><h2 class="cx-section-title">\\u8FDE\\u63A5\\u4F60\\u719F\\u6089\\u7684\\u5E94\\u7528</h2><label class="cx-search"><input type="search" aria-label="\\u641C\\u7D22\\u8FDE\\u63A5\\u5668" placeholder="\\u641C\\u7D22\\u8FDE\\u63A5\\u5668\\u2026"></label></div>${connectorDirectory((c) => connectorCard(c, ["gmail", "qq", "netease"].includes(c.id) ? "" : "\\u5C1A\\u672A\\u5F00\\u653E", ["gmail", "qq", "netease"].includes(c.id) ? "\\u7BA1\\u7406\\u90AE\\u7BB1\\u8FDE\\u63A5" : "\\u4E86\\u89E3\\u63A5\\u5165\\u65B9\\u5F0F"))}<p class="cx-empty" hidden>\\u6CA1\\u6709\\u627E\\u5230\\uFF0C\\u6362\\u4E2A\\u540D\\u79F0\\u8BD5\\u8BD5\\u3002</p><p class="cx-footnote">\\u8FDE\\u63A5\\u7528\\u4E8E\\u5F53\\u524D\\u6240\\u9009\\u4F19\\u4F34\\u3002\\u90AE\\u4EF6\\u8D26\\u6237\\u4E0E\\u64CD\\u4F5C\\u6743\\u9650\\uFF0C\\u5728\\u90AE\\u7BB1\\u8BE6\\u60C5\\u4E2D\\u6838\\u5BF9\\u3002</p>`;\n const search = root.querySelector("input");\n search.oninput = () => {\n root.querySelector(".cx-empty").hidden = filterConnectorDirectory(root, search.value);\n };\n };\n const openMail = (provider = "gmail") => {\n release();\n const back = h("button", { class: "cx-link cx-back", type: "button", "data-connectors-back": "", onclick: catalog }, "\\u2190 \\u6240\\u6709\\u8FDE\\u63A5\\u5668");\n const host = h("div", {});\n root.replaceChildren(back, host);\n cleanup = mountEmail(host, marker, deps);\n if (provider === "qq" || provider === "netease") host.querySelector(`[data-connection="${provider === "netease" ? "163" : "qq"}"] .connection-action`)?.click();\n };\n const click = (event) => {\n if (!alive) return;\n const button = event.target.closest("[data-connector-open]");\n const id = button?.dataset.connectorOpen;\n if (!id) return;\n if (["gmail", "qq", "netease"].includes(id)) {\n openMail(id);\n return;\n }\n const c = connectorById(id);\n if (!c) return;\n release();\n root.innerHTML = `<button type="button" class="cx-link cx-back" data-connectors-back>\\u2190 \\u6240\\u6709\\u8FDE\\u63A5\\u5668</button>${connectorIntro(c)}<div class="cx-detail-grid"><section><h2 class="cx-section-title">${c.method === "device" ? "\\u624B\\u673A\\u6388\\u6743\\uFF0C\\u4E24\\u7AEF\\u67E5\\u770B" : c.method === "import" ? "\\u4ECE\\u6240\\u9009\\u5185\\u5BB9\\u5F00\\u59CB" : "\\u9009\\u62E9\\u4F60\\u60F3\\u5206\\u4EAB\\u7684\\u8303\\u56F4"}</h2><p class="cx-muted">${c.access}</p><p class="cx-footnote">\\u4EE5\\u4E0B\\u662F\\u5206\\u4EAB\\u8303\\u56F4\\u7684\\u793A\\u4F8B\\uFF0C\\u5F00\\u653E\\u540E\\u7531\\u4F60\\u9009\\u62E9\\u3002</p><div class="cx-sources">${c.sources.map((s) => `<label>${s.label}</label>`).join("")}</div><p class="cx-muted">${c.action}</p></section><aside class="cx-first-look"><p class="cx-eyebrow">\\u63A5\\u5165\\u51C6\\u5907\\u4E2D</p><h2>\\u8FD9\\u4E2A\\u8FDE\\u63A5\\u5668\\u5C1A\\u672A\\u5F00\\u653E\\u3002</h2><p>${c.method === "device" ? "\\u5F00\\u653E\\u540E\\uFF0C\\u9700\\u8981\\u5148\\u5728\\u624B\\u673A\\u5B8C\\u6210\\u7CFB\\u7EDF\\u6388\\u6743\\uFF0C\\u684C\\u9762\\u53EF\\u67E5\\u770B\\u8FDE\\u63A5\\u72B6\\u6001\\u548C\\u5206\\u4EAB\\u8303\\u56F4\\u3002" : c.method === "import" ? "\\u5F00\\u653E\\u540E\\uFF0C\\u53EF\\u4EE5\\u4ECE\\u624B\\u673A\\u5206\\u4EAB\\u6240\\u9009\\u5185\\u5BB9\\uFF0C\\u6216\\u5728\\u684C\\u9762\\u5BFC\\u5165\\u9009\\u4E2D\\u7684\\u6587\\u4EF6\\u3002" : "\\u5F00\\u653E\\u540E\\uFF0C\\u4F1A\\u5728\\u670D\\u52A1\\u65B9\\u9875\\u9762\\u767B\\u5F55\\uFF0C\\u518D\\u7531\\u4F60\\u9009\\u62E9\\u5141\\u8BB8\\u8BBF\\u95EE\\u7684\\u8D44\\u6599\\u3002"}</p></aside></div>`;\n root.querySelector("[data-connectors-back]").onclick = catalog;\n };\n root.addEventListener("click", click);\n catalog();\n return () => {\n alive = false;\n release();\n root.removeEventListener("click", click);\n };\n }\n\n // web-console/desktop/src/renderer/console/console.ts\n var api2 = window.engine7Api;\n var chrome = mountAuroraChrome(document.getElementById("console-app"));\n var extensions = window.engine7ConsoleExtensions;\n var activeCleanup = null;\n var partnerCard = null;\n var currentPageKey = "status";\n var goToRef = null;\n var renderedStateDir = null;\n var bootSequence = 0;\n var navigationSequence = 0;\n async function boot() {\n const sequence = ++bootSequence;\n goToRef = null;\n partnerCard?.dispose();\n partnerCard = null;\n activeCleanup?.();\n activeCleanup = null;\n const { engines } = await api2.listEngines();\n if (sequence !== bootSequence) return;\n const marker = await api2.getInstalledMarker();\n if (sequence !== bootSequence) return;\n renderedStateDir = marker?.stateDir ?? null;\n if (!marker) {\n document.getElementById("console-body-slot").replaceChildren(h(\n "div",\n { class: "page" },\n h("h2", {}, "\\u63A7\\u5236\\u53F0\\u4E0D\\u53EF\\u7528"),\n h("p", { class: "page-sub" }, "\\u6CA1\\u6709\\u627E\\u5230\\u4EFB\\u4F55\\u5DF2\\u88C5\\u597D\\u7684\\u5F15\\u64CE\\u2014\\u2014\\u8BF7\\u5148\\u5B8C\\u6210\\u5B89\\u88C5\\u5411\\u5BFC\\u3002")\n ));\n return;\n }\n const actions = {\n start: async () => {\n await api2.startEngine(marker.configPath);\n },\n stop: async () => {\n await api2.stopEngine(marker.stateDir);\n },\n restart: async () => {\n await api2.stopEngine(marker.stateDir);\n await api2.startEngine(marker.configPath);\n }\n };\n const pages = [\n { key: "status", label: "\\u72B6\\u6001", mount: (body) => mountStatus(body, marker, {\n apiStatus: (p) => api2.apiStatus(p),\n doctor: (d) => api2.doctor(d),\n configGet: (c) => api2.configGet(c),\n travelControl: api2.travelAvailable !== false && typeof api2.travelControl === "function" ? (d, a) => api2.travelControl(d, a) : void 0,\n startEngine: (c) => api2.startEngine(c),\n stopEngine: (d) => api2.stopEngine(d),\n isEngineAlive: () => api2.isEngineAlive(marker.apiPort),\n isEngineProcessAlive: (d) => api2.isEngineProcessAlive(d),\n applyFreeTier: (d, o) => api2.applyFreeTier(d, o),\n updateCheck: () => api2.updateCheck(),\n updateApply: () => api2.updateApply(),\n onUpdateEvent: (cb) => api2.onUpdateEvent(cb)\n }, actions, (key) => goTo(key)) },\n { key: "channels", label: "\\u804A\\u5929\\u5E73\\u53F0", mount: (body) => mountChannels(body, marker, {\n apiStatus: (p) => api2.apiStatus(p),\n doctor: (d) => api2.doctor(d),\n runReconfig: (c, d, n) => api2.runReconfig(c, d, n),\n cancelReconfig: () => api2.cancelReconfig(),\n onEngineEvent: (cb) => api2.onEngineEvent(cb),\n readChannelConfig: (c, d) => api2.readChannelConfig(c, d),\n updateChannelConfig: (c, d, cfg) => api2.updateChannelConfig(c, d, cfg),\n readTelegramConfig: (c, d) => api2.readTelegramConfig(c, d),\n updateTelegramConfig: (c, d, cfg) => api2.updateTelegramConfig(c, d, cfg),\n readDingtalkConfig: (c, d) => api2.readDingtalkConfig(c, d),\n updateDingtalkConfig: (c, d, cfg) => api2.updateDingtalkConfig(c, d, cfg),\n readFeishuConfig: (c, d) => api2.readFeishuConfig(c, d),\n updateFeishuConfig: (c, d, cfg) => api2.updateFeishuConfig(c, d, cfg),\n readWecomConfig: (c, d) => api2.readWecomConfig(c, d),\n updateWecomConfig: (c, d, cfg) => api2.updateWecomConfig(c, d, cfg),\n fetchWaStatus: (p) => api2.fetchWaStatus(p),\n fetchWaQr: (p) => api2.fetchWaQr(p),\n configSchema: (d) => api2.configSchema(d),\n readWhatsappConfig: (c, d) => api2.readWhatsappConfig(c, d),\n updateWhatsappConfig: (c, d, cfg) => api2.updateWhatsappConfig(c, d, cfg),\n openPath: (p) => api2.openPath(p)\n }, actions) },\n { key: "travel", label: "\\u968F\\u884C", mount: (body) => {\n if (api2.travelAvailable === false) {\n body.replaceChildren(h("div", { class: "page" }, h("h2", {}, "\\u968F\\u884C\\u6682\\u4E0D\\u5F00\\u653E")));\n return () => {\n };\n }\n return mountTravel(body, marker, {\n travelControl: (d, a, p) => api2.travelControl(d, a, p),\n configGet: (c) => api2.configGet(c),\n travelOnboarding: typeof api2.travelOnboarding === "function" ? (d, a, p) => api2.travelOnboarding(d, a, p) : void 0,\n pickTravelKey: typeof api2.pickTravelKey === "function" ? () => api2.pickTravelKey() : void 0,\n onStateChanged: () => partnerCard?.refresh()\n });\n } },\n { key: "settings", label: "\\u8BBE\\u7F6E", mount: (body) => mountSettings(body, marker, {\n openMail: () => goTo("email"),\n configSchema: (d) => api2.configSchema(d),\n configGet: (c) => api2.configGet(c),\n configSet: (c, v) => api2.configSet(c, v),\n configMigrate: (c) => api2.configMigrate(c),\n internalModeSet: (on) => api2.internalModeSet(on),\n copyPortrait: (d, p) => api2.copyPortrait(d, p),\n scaffoldPersonas: (d, n, persona) => api2.scaffoldPersonas(d, n, persona),\n autostartEnable: () => api2.autostartEnable(),\n pickDirectory: () => api2.pickDirectory(),\n pickImageFile: () => api2.pickImageFile(),\n ccPair: {\n ccPairStatus: () => api2.ccPairStatus(),\n ccPairProvision: () => api2.ccPairProvision(),\n ccPairStart: () => api2.ccPairStart(),\n ccPairScanStart: () => api2.ccPairScanStart(),\n ccPairScanPoll: () => api2.ccPairScanPoll(),\n ccPairScanCancel: () => api2.ccPairScanCancel()\n }\n }, actions) },\n // Keep the email route for existing tray/settings links; the directory now includes all connectors.\n { key: "email", label: "\\u8FDE\\u63A5\\u5668", mount: (body) => mountConnectors(body, marker, {\n serviceAuth: (d, a, p, v) => api2.serviceAuth(d, a, p, v),\n configSchema: (d) => api2.configSchema(d),\n configGet: (c) => api2.configGet(c),\n configSet: (c, v) => api2.configSet(c, v)\n }) },\n { key: "logs", label: "\\u65E5\\u5FD7", mount: (body) => mountLogs(body, marker, {\n logTail: (d) => api2.logTail(d),\n openPath: (p) => api2.openPath(p)\n }) },\n ...extensions?.pages?.(marker) ?? []\n ];\n const nav = h("nav", { class: "sidebar-nav" });\n const pageBody = h("main", { class: "console-body" });\n const goTo = (key) => {\n const page = pages.find((p) => p.key === key);\n if (!page) return;\n currentPageKey = key;\n extensions?.onNavigate?.(key);\n chrome.setScene(key);\n document.querySelector(".window-context").textContent = page.label;\n activeCleanup?.();\n activeCleanup = null;\n for (const item of Array.from(nav.children)) {\n const el = item;\n el.classList.toggle("active", el.dataset.key === key);\n }\n activeCleanup = page.mount?.(pageBody) ?? null;\n partnerCard?.refresh();\n };\n goToRef = goTo;\n nav.replaceChildren(...pages.map((p) => h(\n "button",\n {\n class: p.key === "travel" && api2.travelAvailable === false ? "nav-item nav-placeholder" : "nav-item",\n type: "button",\n disabled: p.key === "travel" && api2.travelAvailable === false,\n "data-key": p.key,\n onclick: () => goTo(p.key)\n },\n navIcon(p.key),\n p.label,\n p.key === "travel" && api2.travelAvailable === false ? h("small", { class: "nav-availability" }, "\\u6682\\u4E0D\\u5F00\\u653E") : null\n )));\n partnerCard = mountPartnerCard(document.getElementById("console-engines-slot"), marker, {\n configGet: (c) => api2.configGet(c),\n apiStatus: (p) => api2.apiStatus(p),\n isEngineAlive: (p) => api2.isEngineAlive(p),\n isEngineProcessAlive: (d) => api2.isEngineProcessAlive(d),\n travelControl: api2.travelAvailable !== false && typeof api2.travelControl === "function" ? (d, a) => api2.travelControl(d, a) : void 0\n }, () => goTo("settings"), { engines, onPick: async (stateDir) => {\n const r = await api2.selectEngine(stateDir);\n if (!r.ok) return false;\n partnerCard?.dispose();\n partnerCard = null;\n activeCleanup?.();\n activeCleanup = null;\n await boot();\n return true;\n } });\n document.getElementById("console-body-slot")?.replaceChildren(pageBody);\n document.getElementById("console-nav-slot")?.replaceChildren(nav);\n const pendingPage = await api2.consolePendingPage();\n if (sequence === bootSequence) goTo(pendingPage || currentPageKey);\n }\n api2.onConsoleNavigate((page) => {\n const sequence = ++navigationSequence;\n void (async () => {\n const marker = await api2.getInstalledMarker();\n if (sequence !== navigationSequence) return;\n if (marker?.stateDir !== renderedStateDir || !goToRef) await boot();\n if (sequence === navigationSequence) goToRef?.(page);\n })().catch((error) => console.error("[console] \\u65E0\\u6CD5\\u6253\\u5F00\\u7BA1\\u7406\\u9875", error));\n });\n void boot();\n})();\n</script>\n</body>\n</html>\n';
73345
73454
 
73346
73455
  // src/startup/console-page.ts
73347
73456
  function consolePageHtml(_port) {
@@ -95084,7 +95193,8 @@ registerCommand({
95084
95193
  const bindings = Array.isArray(section.bindings) ? section.bindings : [];
95085
95194
  const filtered = bindings.filter((b) => !(b?.channel === channel && b?.match?.chatId === chatId));
95086
95195
  filtered.push({ channel, match: { type: "dm", chatId, from: from || void 0 }, workDir });
95087
- const persisted = await liveConfig.set("channels.ccDriver", { enabled: true, bindings: filtered });
95196
+ const { autoBind: _consumed, ...rest } = section;
95197
+ const persisted = await liveConfig.set("channels.ccDriver", { ...rest, enabled: true, bindings: filtered });
95088
95198
  console.log(`[cc-driver] /cc-bind ${channel}:${chatId} \u2192 ${workDir} (persisted=${persisted})`);
95089
95199
  const { startCcDriver: startCcDriver2 } = await Promise.resolve().then(() => (init_cc_driver(), cc_driver_exports));
95090
95200
  startCcDriver2(deps.channelManager);
@@ -95105,7 +95215,7 @@ registerCommand({
95105
95215
  await ctx.reply("\u8FD9\u4E2A\u4F1A\u8BDD\u672C\u6765\u5C31\u6CA1\u7ED1\u5B9A");
95106
95216
  return;
95107
95217
  }
95108
- const persisted = await liveConfig.set("channels.ccDriver", { enabled: section.enabled === true, bindings: rest });
95218
+ const persisted = await liveConfig.set("channels.ccDriver", { ...section, enabled: section.enabled === true, bindings: rest });
95109
95219
  console.log(`[cc-driver] /cc-unbind ${channel}:${chatId} (persisted=${persisted})`);
95110
95220
  const { startCcDriver: startCcDriver2 } = await Promise.resolve().then(() => (init_cc_driver(), cc_driver_exports));
95111
95221
  startCcDriver2(deps.channelManager);