@tom2012/cc-web 2026.5.6-a → 2026.5.8-a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. package/backend/dist/memory-watcher.d.ts +4 -0
  2. package/backend/dist/memory-watcher.d.ts.map +1 -0
  3. package/backend/dist/memory-watcher.js +168 -0
  4. package/backend/dist/memory-watcher.js.map +1 -0
  5. package/backend/dist/terminal-manager.d.ts.map +1 -1
  6. package/backend/dist/terminal-manager.js +8 -0
  7. package/backend/dist/terminal-manager.js.map +1 -1
  8. package/frontend/dist/assets/{ChatOverlay-Cn2UDvPJ.js → ChatOverlay-Dewml63P.js} +1 -1
  9. package/frontend/dist/assets/{GraphPreview-ClFllaES.js → GraphPreview-DKqon8iY.js} +1 -1
  10. package/frontend/dist/assets/{MobilePage-C4plFLQR.js → MobilePage-0yihNWS5.js} +3 -3
  11. package/frontend/dist/assets/{OfficePreview-BUPUjmJy.js → OfficePreview-CLoz-Kzs.js} +2 -2
  12. package/frontend/dist/assets/{PdfPreview-qolp4W3P.js → PdfPreview-ceFK86bz.js} +1 -1
  13. package/frontend/dist/assets/{ProjectPage-UKMecARF.js → ProjectPage-Dx8ti9Xg.js} +3 -3
  14. package/frontend/dist/assets/{SettingsPage-BtaPOVzv.js → SettingsPage-DqXMFZN7.js} +1 -1
  15. package/frontend/dist/assets/{SkillHubPage-D27a49yH.js → SkillHubPage-0i_Vbges.js} +1 -1
  16. package/frontend/dist/assets/{chevron-down-Cft5PBzF.js → chevron-down-CabXIthZ.js} +1 -1
  17. package/frontend/dist/assets/{index-CgTG_5WK.js → index-DFmoROkt.js} +1 -1
  18. package/frontend/dist/assets/{index-0MbCUjQg.js → index-DKiLzICV.js} +1 -1
  19. package/frontend/dist/assets/{index-CihceaVm.js → index-PkEuCOb6.js} +2 -2
  20. package/frontend/dist/assets/{index-xa0BN4Wr.js → index-QPAdq047.js} +1 -1
  21. package/frontend/dist/assets/{jszip.min-DOkAo0GA.js → jszip.min-C5eqdtGO.js} +1 -1
  22. package/frontend/dist/assets/pdf.worker.min-qwK7q_zL.mjs +28 -0
  23. package/frontend/dist/assets/{search-5tU7yM2g.js → search-CO9hGSbE.js} +1 -1
  24. package/frontend/dist/index.html +1 -1
  25. package/package.json +1 -1
  26. package/frontend/dist/assets/pdf.worker.min-iDqQPrd3.mjs +0 -31
@@ -0,0 +1,4 @@
1
+ import type { CliTool } from './types';
2
+ export declare function startMemoryWatcher(projectId: string, folderPath: string, cliTool?: CliTool): void;
3
+ export declare function stopMemoryWatcher(projectId: string): void;
4
+ //# sourceMappingURL=memory-watcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-watcher.d.ts","sourceRoot":"","sources":["../src/memory-watcher.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAuCvC,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,GAChB,IAAI,CAyCN;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAYzD"}
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.startMemoryWatcher = startMemoryWatcher;
37
+ exports.stopMemoryWatcher = stopMemoryWatcher;
38
+ const fs = __importStar(require("fs"));
39
+ const path = __importStar(require("path"));
40
+ const memory_prompts_1 = require("./memory-prompts");
41
+ const logger_1 = require("./logger");
42
+ /**
43
+ * Memory watcher — keeps CLAUDE.md / AGENTS.md in sync with edits to
44
+ * `<folderPath>/.ccweb/memory/*.md` files. Wired to TerminalManager
45
+ * lifecycle so a watcher exists exactly when a project's terminal is up.
46
+ *
47
+ * Trigger semantics:
48
+ * - File modified, currently inserted → refresh block (idempotent)
49
+ * - File modified, not inserted → no-op (no auto-insert of new files)
50
+ * - File deleted, was inserted → remove block
51
+ * - File deleted, not inserted → no-op
52
+ *
53
+ * Event handler is lstat-driven (not eventType-driven) because the LLM tools
54
+ * (writeFileSync) and editor save patterns (write-tmp + rename) produce
55
+ * different fs.watch event types — but both converge on a deterministic
56
+ * post-write state we can read.
57
+ */
58
+ const log = (0, logger_1.modLogger)('memory-watcher');
59
+ // Short enough that an LLM same-turn `Write memory → Read CLAUDE.md` reads
60
+ // fresh content; long enough to coalesce the 5-10ms double-fire some
61
+ // editors produce on save (macOS FSEvents).
62
+ const DEBOUNCE_MS = 50;
63
+ const watchers = new Map();
64
+ function memoryDir(folderPath) {
65
+ return path.join(folderPath, '.ccweb', 'memory');
66
+ }
67
+ function startMemoryWatcher(projectId, folderPath, cliTool) {
68
+ // Idempotent — auto-restart cycle re-enters startTerminal for the same
69
+ // project; we don't want to stack watchers on the same dir.
70
+ if (watchers.has(projectId))
71
+ return;
72
+ const dir = memoryDir(folderPath);
73
+ if (!fs.existsSync(dir)) {
74
+ log.debug({ projectId, dir }, 'memory dir missing — skip watcher');
75
+ return;
76
+ }
77
+ let watcher;
78
+ try {
79
+ watcher = fs.watch(dir, { persistent: false }, (_event, filename) => {
80
+ if (!filename || typeof filename !== 'string')
81
+ return;
82
+ if (!filename.endsWith('.md'))
83
+ return;
84
+ const state = watchers.get(projectId);
85
+ if (!state)
86
+ return;
87
+ const existing = state.timers.get(filename);
88
+ if (existing)
89
+ clearTimeout(existing);
90
+ state.timers.set(filename, setTimeout(() => {
91
+ state.timers.delete(filename);
92
+ handleMemoryEvent(projectId, filename);
93
+ }, DEBOUNCE_MS));
94
+ });
95
+ }
96
+ catch (err) {
97
+ log.warn({ err, projectId, dir }, 'memory watcher attach failed');
98
+ return;
99
+ }
100
+ watcher.on('error', (err) => {
101
+ log.warn({ err, projectId }, 'memory watcher errored');
102
+ });
103
+ watchers.set(projectId, { watcher, folderPath, cliTool, timers: new Map() });
104
+ log.info({ projectId, dir }, 'memory watcher attached');
105
+ }
106
+ function stopMemoryWatcher(projectId) {
107
+ const state = watchers.get(projectId);
108
+ if (!state)
109
+ return;
110
+ for (const t of state.timers.values())
111
+ clearTimeout(t);
112
+ state.timers.clear();
113
+ try {
114
+ state.watcher.close();
115
+ }
116
+ catch {
117
+ /* ignore */
118
+ }
119
+ watchers.delete(projectId);
120
+ log.debug({ projectId }, 'memory watcher detached');
121
+ }
122
+ function handleMemoryEvent(projectId, filename) {
123
+ const state = watchers.get(projectId);
124
+ if (!state)
125
+ return;
126
+ const { folderPath, cliTool } = state;
127
+ const filePath = path.join(memoryDir(folderPath), filename);
128
+ let stat;
129
+ try {
130
+ stat = fs.lstatSync(filePath);
131
+ }
132
+ catch {
133
+ stat = undefined;
134
+ }
135
+ if (!stat) {
136
+ // File missing: remove block (idempotent for not-present case).
137
+ try {
138
+ const result = (0, memory_prompts_1.toggleMemoryPrompt)(folderPath, filename, 'remove', cliTool);
139
+ if (result.changed) {
140
+ log.info({ projectId, filename }, 'memory file removed → block removed');
141
+ }
142
+ }
143
+ catch (err) {
144
+ log.warn({ err, projectId, filename }, 'memory remove failed');
145
+ }
146
+ return;
147
+ }
148
+ // Symlink guard mirrors memory-prompts.ts:88,152 — never resolve a memory
149
+ // symlink, even via the watcher path.
150
+ if (!stat.isFile())
151
+ return;
152
+ // File exists → refresh ONLY if currently inserted. Newly created files
153
+ // require explicit user opt-in via SettingsPage toggle.
154
+ try {
155
+ const list = (0, memory_prompts_1.listMemoryPrompts)(folderPath, cliTool);
156
+ const item = list.items.find((i) => i.filename === filename);
157
+ if (!item?.inserted)
158
+ return;
159
+ const result = (0, memory_prompts_1.toggleMemoryPrompt)(folderPath, filename, 'insert', cliTool);
160
+ if (result.changed) {
161
+ log.info({ projectId, filename }, 'memory file changed → block refreshed');
162
+ }
163
+ }
164
+ catch (err) {
165
+ log.warn({ err, projectId, filename }, 'memory refresh failed');
166
+ }
167
+ }
168
+ //# sourceMappingURL=memory-watcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-watcher.js","sourceRoot":"","sources":["../src/memory-watcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,gDA6CC;AAED,8CAYC;AAtGD,uCAAyB;AACzB,2CAA6B;AAC7B,qDAAyE;AACzE,qCAAqC;AAGrC;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,GAAG,GAAG,IAAA,kBAAS,EAAC,gBAAgB,CAAC,CAAC;AAExC,2EAA2E;AAC3E,qEAAqE;AACrE,4CAA4C;AAC5C,MAAM,WAAW,GAAG,EAAE,CAAC;AASvB,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;AAEnD,SAAS,S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,CAAC;IAUxC,4FAA4F;IAC5F,gBAAgB,IAAI,MAAM,EAAE;IAI5B,SAAS,IAAI,IAAI;IAkBjB,OAAO,CAAC,aAAa;IAuGrB,OAAO,CAAC,UAAU;CAsFnB;AAED,eAAO,MAAM,eAAe,iBAAwB,CAAC"}
@@ -41,6 +41,7 @@ const config_1 = require("./config");
41
41
  const session_manager_1 = require("./session-manager");
42
42
  const adapters_1 = require("./adapters");
43
43
  const logger_1 = require("./logger");
44
+ const memory_watcher_1 = require("./memory-watcher");
44
45
  // RED LINE (logger.ts rule #1): PTY byte streams — both input (writeRaw) and
45
46
  // output (onData) — NEVER enter log events, not even truncated or as preview.
46
47
  // Users paste API keys / tokens / session secrets into Claude TUI; the PTY
@@ -125,6 +126,7 @@ class TerminalManager extends events_1.EventEmitter {
125
126
  this.activityThrottles.delete(projectId);
126
127
  // Clean up session watcher to prevent orphaned polling intervals
127
128
  session_manager_1.sessionManager.stopWatcherForProject(projectId);
129
+ (0, memory_watcher_1.stopMemoryWatcher)(projectId);
128
130
  instance.project.status = 'stopped';
129
131
  (0, config_1.saveProject)(instance.project);
130
132
  }
@@ -156,6 +158,7 @@ class TerminalManager extends events_1.EventEmitter {
156
158
  this.terminals.delete(projectId);
157
159
  this.activityThrottles.delete(projectId);
158
160
  session_manager_1.sessionManager.stopWatcherForProject(projectId);
161
+ (0, memory_watcher_1.stopMemoryWatcher)(projectId);
159
162
  }
160
163
  this.crashCounts.delete(projectId);
161
164
  this.continueFallbackDone.delete(projectId);
@@ -181,6 +184,7 @@ class TerminalManager extends events_1.EventEmitter {
181
184
  this.activityThrottles.delete(projectId);
182
185
  this.continueFallbackDone.delete(projectId);
183
186
  session_manager_1.sessionManager.stopWatcherForProject(projectId);
187
+ (0, memory_watcher_1.stopMemoryWatcher)(projectId);
184
188
  // Deliberately do NOT change project.status — keep it as 'running'
185
189
  }
186
190
  hasTerminal(projectId) {
@@ -294,6 +298,9 @@ class TerminalManager extends events_1.EventEmitter {
294
298
  if (project.cliTool !== 'terminal') {
295
299
  session_manager_1.sessionManager.startSession(project.id, project.folderPath, project.cliTool ?? 'claude');
296
300
  }
301
+ // Auto-sync .ccweb/memory/*.md into CLAUDE.md / AGENTS.md. Idempotent —
302
+ // safe across auto-restart cycles where startTerminal re-enters.
303
+ (0, memory_watcher_1.startMemoryWatcher)(project.id, project.folderPath, project.cliTool);
297
304
  ptyProcess.onData((data) => {
298
305
  // RED LINE: `data` is PTY output — NEVER log. In-memory scrollback and
299
306
  // WS broadcast are the only legitimate consumers. See top-of-file.
@@ -372,6 +379,7 @@ class TerminalManager extends events_1.EventEmitter {
372
379
  (0, config_1.saveProject)(project);
373
380
  rawBroadcast(`\r\n\x1b[31m[Terminal crashed ${crashes} times — auto-restart disabled. Please restart manually.]\x1b[0m\r\n`);
374
381
  this.crashCounts.delete(projectId);
382
+ (0, memory_watcher_1.stopMemoryWatcher)(projectId);
375
383
  return;
376
384
  }
377
385
  const adapter = (0, adapters_1.getAdapter)(project.cliTool ?? 'claude');
@@ -1 +1 @@
1
- {"version":3,"file":"terminal-manager.js","sourceRoot":"","sources":["../src/terminal-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAgC;AAChC,uCAAyB;AACzB,mCAAsC;AAEtC,qCAAoD;AACpD,uDAAmD;AACnD,yCAAwC;AACxC,qCAAqC;AAErC,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,6EAA6E;AAC7E,MAAM,GAAG,GAAG,IAAA,kBAAS,EAAC,UAAU,CAAC,CAAC;AAIlC,+DAA+D;AAC/D,MAAM,oBAAoB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAiB7C,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAEnC,MAAM,eAAgB,SAAQ,qBAAY;IAiBxC;QACE,KAAK,EAAE,CAAC;QAjBF,cAAS,GAAG,IAAI,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I,mBAAmB,eAAe,CAAC,CAAC;QAElJ,GAAG,CAAC,IAAI,CACN;YACE,SAAS;YACT,QAAQ;YACR,OAAO;YACP,UAAU,EAAE,mBAAmB;YAC/B,WAAW,EAAE,OAAO,CAAC,gBAAgB,EAAE;SACxC,EACD,0BAA0B,CAC3B,CAAC;QACF,+EAA+E;QAC/E,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACnD,IAAI,QAAQ;YAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;QACrC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;YACrC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;gBACnC,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;YAClD,CAAC;QACH,CAAC,EAAE,KAAK,CAAC,CAAC;QACV,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;CACF;AAEY,QAAA,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import{bz as e,bA as t,r as n,bB as r,c as a,f as i,bC as o,bD as s,j as l,R as c,d as u,aM as d,bE as p,t as m,A as g,p as h,aW as f,bF as b,a as y,$ as E,a1 as v,Y as S,W as w,a0 as k,V as x,aZ as T,aE as A,bs as _,bt as I,h as N,bG as R,bH as C,s as O,bI as L,bJ as D,bu as M,bK as P,bw as F,S as B,k as U,o as z}from"./index-CihceaVm.js";import{C as $}from"./chevron-down-Cft5PBzF.js";import{C as G,a as j,u as H,c as q}from"./index-xa0BN4Wr.js";function V(){!e.current&&t();const[a]=n.useState(r.current);return a}
1
+ import{bz as e,bA as t,r as n,bB as r,c as a,f as i,bC as o,bD as s,j as l,R as c,d as u,aM as d,bE as p,t as m,A as g,p as h,aW as f,bF as b,a as y,$ as E,a1 as v,Y as S,W as w,a0 as k,V as x,aZ as T,aE as A,bs as _,bt as I,h as N,bG as R,bH as C,s as O,bI as L,bJ as D,bu as M,bK as P,bw as F,S as B,k as U,o as z}from"./index-PkEuCOb6.js";import{C as $}from"./chevron-down-CabXIthZ.js";import{C as G,a as j,u as H,c as q}from"./index-QPAdq047.js";function V(){!e.current&&t();const[a]=n.useState(r.current);return a}
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -1,4 +1,4 @@
1
- import{c as e,r as t,b as n,j as i,aM as r,B as o,l as a}from"./index-CihceaVm.js";import{Z as l,a as s}from"./ProjectPage-UKMecARF.js";import"./purify.es-CgRAQgUo.js";import"./ChatOverlay-Cn2UDvPJ.js";import"./chevron-down-Cft5PBzF.js";import"./index-xa0BN4Wr.js";import"./index-CgTG_5WK.js";import"./search-5tU7yM2g.js";
1
+ import{c as e,r as t,b as n,j as i,aM as r,B as o,l as a}from"./index-PkEuCOb6.js";import{Z as l,a as s}from"./ProjectPage-Dx8ti9Xg.js";import"./purify.es-CgRAQgUo.js";import"./ChatOverlay-Dewml63P.js";import"./chevron-down-CabXIthZ.js";import"./index-QPAdq047.js";import"./index-DFmoROkt.js";import"./search-CO9hGSbE.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OfficePreview-BUPUjmJy.js","assets/index-CihceaVm.js","assets/index-BJDTvhqr.css","assets/purify.es-CgRAQgUo.js"])))=>i.map(i=>d[i]);
2
- import{c as e,aF as t,bk as s,aH as a,r as n,bl as r,bm as l,j as o,bn as c,l as i,d,bo as u,bp as x,bq as m,br as h,bs as p,bt as f,ab as g,aa as b,bu as j,bv as v,t as y,a9 as N,aI as w,aM as k,bw as C,a as S,b as I,g as P,D as M,f as z,R as U,_ as T,k as $,X as R,o as D,bx as A,by as E,C as L,A as H,p as F}from"./index-CihceaVm.js";import{A as O,g as _,T as q,i as W,j as B,G as V,M as K,r as G,a as J,b as Q,c as X,e as Y,h as Z,o as ee,d as te,I as se,F as ae}from"./ChatOverlay-Cn2UDvPJ.js";import{C as ne}from"./index-xa0BN4Wr.js";import{C as re}from"./chevron-down-Cft5PBzF.js";
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OfficePreview-CLoz-Kzs.js","assets/index-PkEuCOb6.js","assets/index-BJDTvhqr.css","assets/purify.es-CgRAQgUo.js"])))=>i.map(i=>d[i]);
2
+ import{c as e,aF as t,bk as s,aH as a,r as n,bl as r,bm as l,j as o,bn as c,l as i,d,bo as u,bp as x,bq as m,br as h,bs as p,bt as f,ab as g,aa as b,bu as j,bv as v,t as y,a9 as N,aI as w,aM as k,bw as C,a as S,b as I,g as P,D as M,f as z,R as U,_ as T,k as $,X as R,o as D,bx as A,by as E,C as L,A as H,p as F}from"./index-PkEuCOb6.js";import{A as O,g as _,T as q,i as W,j as B,G as V,M as K,r as G,a as J,b as Q,c as X,e as Y,h as Z,o as ee,d as te,I as se,F as ae}from"./ChatOverlay-Dewml63P.js";import{C as ne}from"./index-QPAdq047.js";import{C as re}from"./chevron-down-CabXIthZ.js";
3
3
  /**
4
4
  * @license lucide-react v0.309.0 - ISC
5
5
  *
@@ -11,4 +11,4 @@ import{c as e,aF as t,bk as s,aH as a,r as n,bl as r,bm as l,j as o,bn as c,l as
11
11
  *
12
12
  * This source code is licensed under the ISC license.
13
13
  * See the LICENSE file in the root directory of this source tree.
14
- */function ue({onSelectProject:e}){const h=t(),p=s(e=>e.clearToken),{projects:f,fetchProjects:g,hasFetched:b,loading:j}=a(),v=n.useCallback(()=>{a.getState().setProjects([]),p(),h("/login")},[p,h]),[y,N]=n.useState(new Map),[w,k]=n.useState(new Set),[C,S]=n.useState(!1);n.useEffect(()=>{g()},[g]);const I=n.useCallback(e=>{e.status&&N(t=>{const s=new Map(t);return s.set(e.projectId,e.status),s}),void 0!==e.active&&k(t=>{const s=new Set(t);return e.active?s.add(e.projectId):s.delete(e.projectId),s})},[]);r({onActivityUpdate:I});const{applyOrder:P}=l(),M=P(f.filter(e=>!e.archived));return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-3 px-4 h-12 border-b border-border shrink-0",children:[o.jsx("span",{className:"font-semibold text-base flex-1",children:"CC Web"}),o.jsx(c,{}),o.jsx("button",{onClick:()=>{(async()=>{S(!0);try{await g()}finally{S(!1)}})()},className:"text-muted-foreground active:text-foreground",disabled:C,"aria-label":"Refresh",children:o.jsx(i,{className:d("h-4 w-4",C&&"animate-spin")})}),o.jsx("button",{onClick:()=>h("/settings"),className:"text-muted-foreground active:text-foreground","aria-label":"Settings",children:o.jsx(u,{className:"h-4 w-4"})}),o.jsx("button",{onClick:v,className:"text-muted-foreground active:text-foreground","aria-label":"Logout",children:o.jsx(x,{className:"h-4 w-4"})}),!de&&o.jsx("button",{onClick:()=>h("/"),className:"text-muted-foreground active:text-foreground","aria-label":"Desktop mode",children:o.jsx(m,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[j&&!b&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"加载中..."}),b&&0===M.length&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"暂无项目"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:M.map(t=>{var s;const a="running"===(s=t,y.get(s.id)??s.status??"stopped"),n=w.has(t.id),r=o.jsxs("button",{onClick:()=>e(t.id),className:d("w-full text-left rounded-xl border bg-card p-2.5 active:bg-accent transition-colors",n?"border-transparent":"border-border"),children:[o.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[o.jsx("span",{className:d("w-2 h-2 rounded-full shrink-0",a?"bg-green-500":"bg-zinc-400")}),o.jsx("span",{className:"font-medium text-sm truncate flex-1",children:t.name})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground font-mono truncate",children:t.cliTool??"claude"})]});return o.jsx("div",{className:n?"card-active-glow rounded-xl":void 0,children:r},t.id)})})]})]})}function xe(e){if(!e.phase)return null;if("thinking"===e.phase)return"思考中";if("tool_result"===e.phase)return"处理结果";if("tool_use"===e.phase){const t=(e.detail||"").toLowerCase();return"bash"===t?"执行命令":"read"===t?"读取文件":"edit"===t||"multiedit"===t?"编辑文件":"write"===t?"写入文件":"grep"===t?"搜索内容":"glob"===t?"匹配文件":"webfetch"===t||"websearch"===t?"访问网络":"task"===t?"调度子任务":"todowrite"===t?"更新任务列表":"notebookedit"===t?"编辑 Notebook":e.detail?`调用 ${e.detail}`:"调用工具"}return null}function me({project:e,onBack:t,onOpenPanel:s,onContextUpdate:a}){const[r,l]=n.useState(""),c=n.useRef(null),i=n.useRef(null),[u,x]=n.useState([]),m=n.useCallback(e=>{x(t=>{const s=[...t,e];return s.length>200?s.slice(-200):s})},[]),S=n.useRef(null),I=n.useCallback(e=>{var t;"stopped"===e&&(null==(t=S.current)||t.call(S,"stopped"))},[]),[P,M]=n.useState([]),z=n.useRef(new Set),U=n.useCallback(e=>{z.current.has(e.toolUseId)||M(t=>t.some(t=>t.toolUseId===e.toolUseId)?t:[...t,{projectId:e.projectId,toolUseId:e.toolUseId,toolName:e.toolName,toolInput:e.toolInput,sessionId:e.sessionId,createdAt:e.createdAt}])},[]),T=n.useCallback(e=>{z.current.add(e.toolUseId),M(t=>t.filter(t=>t.toolUseId!==e.toolUseId))},[]),$=n.useCallback(e=>{z.current.add(e),M(t=>t.filter(t=>t.toolUseId!==e))},[]),[R,D]=n.useState(null),A=n.useRef(0),E=n.useCallback(e=>{var t,s,a;if(!e.active)return void D(null);if("text"===(null==(t=e.semantic)?void 0:t.phase))return void D(null);const n=null==(s=e.semantic)?void 0:s.phase,r=null==(a=e.semantic)?void 0:a.detail;D(e=>e?e.phase===n&&e.detail===r?e:{...e,phase:n,detail:r}:{id:"mab"+ ++A.current,phase:n,detail:r})},[]),{sendInput:L,connected:H}=h({projectId:e.id,enabled:!0,onChatMessage:m,onStatusChange:I,onContextUpdate:a,onApprovalRequest:U,onApprovalResolved:T,onSemanticUpdate:E});n.useEffect(()=>{if(!H)return;if("claude"!==e.cliTool)return;let t=!1;return p(e.id).then(e=>{if(t)return;const s=e.pending.filter(e=>!z.current.has(e.toolUseId));M(e=>{const t=new Map;for(const a of s)t.set(a.toolUseId,a);for(const s of e)t.has(s.toolUseId)||z.current.has(s.toolUseId)||t.set(s.toolUseId,s);return[...t.values()]})}).catch(()=>{}),()=>{t=!0}},[e.id,e.cliTool,H]);const{state:F,setState:K,messages:G,hasMoreHistory:J,loadMoreHistory:Q,sendMessage:X,isWaking:Y}=f({project:e,liveMessages:u,ws:{send:L,connected:H},historyLimit:20});S.current=K;const Z=n.useRef(H);n.useEffect(()=>{!Z.current&&H&&x([]),Z.current=H},[H]);const ee=(()=>{for(let e=G.length-1;e>=0;e--)if("assistant"===G[e].role)return e;return-1})(),[te,se]=n.useState([]),[ae,oe]=n.useState([]),[ce,de]=n.useState(null),[ue,me]=n.useState(null),he=n.useRef(!1);n.useEffect(()=>{g().then(se).catch(()=>{}),b(e.id).then(oe).catch(()=>{})},[e.id]);const pe=n.useCallback(e=>{const t=i.current;if(!t)return void l(t=>t+e);const s=t.selectionStart??r.length,a=t.selectionEnd??r.length,n=r.slice(0,s)+e+r.slice(a);l(n),requestAnimationFrame(()=>{t.focus();const a=s+e.length;t.setSelectionRange(a,a),t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"})},[r]),fe=n.useCallback(e=>{de(null),pe(e+" ")},[pe]),ge=n.useCallback(t=>{const s=e.folderPath;let a=t;s&&(t===s||t.startsWith(s+"/")||t.startsWith(s+"\\"))&&(a=t.slice(s.length).replace(/^[/\\]+/,"")),de(null),pe(`@${a} `)},[e.folderPath,pe]),be=n.useCallback(async()=>{if("skills"!==ce){if(!he.current){he.current=!0;try{const t=await j(e.cliTool??"claude",e.id);me(t)}catch{me({builtin:[],custom:[],plugins:[],mcp:[]})}finally{he.current=!1}}de("skills")}else de(null)},[ce,e.cliTool,e.id]),je=n.useCallback(async()=>{const e=c.current,t=(null==e?void 0:e.scrollHeight)??0;await Q(),requestAnimationFrame(()=>{e&&(e.scrollTop+=e.scrollHeight-t)})},[Q]),ve=n.useRef(0);n.useEffect(()=>{const e=c.current;if(!e)return;const t=G.length>ve.current,s=0===ve.current&&G.length>0;ve.current=G.length,s?e.scrollTo({top:e.scrollHeight}):t&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[G,P.length]);const[ye,Ne]=n.useState(!1),we=n.useCallback(async()=>{const e=r.trim();if(!e||ye)return;Ne(!0);const t=await X(e);Ne(!1),"delivered"===t&&(l(""),i.current&&(i.current.style.height="auto"))},[r,ye,X]),ke=v(we,"shift"),Ce=n.useCallback(async(t,s)=>{de(null);try{"failed"===await X(t.command)?y.error("快捷命令未送达,请重试或检查会话"):"project"===s&&N(e.id,t.id,!0).catch(e=>{console.error("Failed to mark shortcut used:",e)})}catch(a){console.error("Shortcut send error:",a),y.error("快捷命令发送失败")}},[X,e.id]),Se="live"===F;return o.jsxs("div",{className:"flex flex-col h-full bg-background",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[o.jsx("span",{className:"font-medium text-sm truncate",children:e.name}),o.jsx("span",{className:d("w-2 h-2 rounded-full shrink-0",Se?"bg-green-500":Y?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),o.jsx("button",{onClick:s,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(ie,{className:"h-5 w-5"})})]}),o.jsxs("div",{ref:c,className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 min-h-0",children:[J&&o.jsx("div",{className:"flex justify-center pb-1",children:o.jsxs("button",{onClick:()=>{je()},className:"flex items-center gap-1 px-3 py-1.5 rounded-full text-xs text-muted-foreground border border-border active:bg-accent transition-colors",children:[o.jsx(ne,{className:"h-3 w-3"}),"加载更早消息"]})}),G.map((e,t)=>{const s="user"===e.role;return o.jsx("div",{className:d("flex",s?"justify-end":"justify-start"),children:o.jsx("div",{className:d("max-w-[85%] rounded-xl px-3 py-2 break-words text-sm leading-relaxed",s?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm whitespace-pre-wrap":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:s?e.content:o.jsx(O,{content:e.content,blocks:e.blocks,isLatest:t===ee})})},e.id)}),P.map(e=>o.jsx(_,{approval:e,onResolved:$},e.toolUseId)),R&&0===P.length&&o.jsx("div",{className:"flex justify-start",children:o.jsxs("div",{className:"rounded-2xl rounded-bl-md px-3 py-1.5 bg-black/5 dark:bg-white/10 border border-black/10 dark:border-white/15 flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx(q,{}),xe(R)&&o.jsx("span",{children:xe(R)})]})},R.id),0===G.length&&0===P.length&&!R&&"stopped"===F&&o.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-sm",children:"暂无对话记录"}),Y&&o.jsx("div",{className:"flex items-center justify-center py-4 text-yellow-400 text-sm animate-pulse",children:"启动中..."})]}),"global"===ce||"project"===ce?o.jsx("div",{className:"border-t border-border max-h-48 overflow-y-auto shrink-0",children:o.jsxs("div",{className:"px-3 py-2 space-y-1",children:[("global"===ce?te:ae).map(e=>o.jsxs("button",{onClick:()=>Ce(e,ce),disabled:Y,className:d("w-full text-left rounded-md px-2.5 py-2 text-sm active:bg-accent transition-colors border border-border/50",Y&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:"font-medium text-xs",children:e.label}),o.jsx("div",{className:"text-[11px] text-muted-foreground font-mono truncate",children:e.command})]},e.id)),0===("global"===ce?te:ae).length&&o.jsx("div",{className:"text-center text-muted-foreground text-xs py-3",children:"暂无快捷 Prompts"})]})}):"skills"===ce&&ue?o.jsx("div",{className:"border-t border-border shrink-0",children:o.jsx(W,{data:ue,onCommand:fe})}):"files"===ce&&e.folderPath?o.jsx("div",{className:"border-t border-border shrink-0",children:o.jsx(B,{projectPath:e.folderPath,onSelect:ge})}):null,o.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-t border-border shrink-0",children:[o.jsx("button",{onClick:()=>{be()},title:"斜杠命令",className:d("flex items-center justify-center w-7 h-7 rounded font-mono text-base transition-colors","skills"===ce?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:"/"}),o.jsx("button",{onClick:()=>de(e=>"files"===e?null:"files"),disabled:!e.folderPath,title:"引用文件",className:d("flex items-center justify-center w-7 h-7 rounded font-mono text-base transition-colors","files"===ce?"bg-accent text-foreground font-medium":e.folderPath?"text-muted-foreground active:bg-accent":"text-muted-foreground/30 cursor-not-allowed"),children:"@"}),te.length>0&&o.jsxs("button",{onClick:()=>de(e=>"global"===e?null:"global"),className:d("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","global"===ce?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:[o.jsx(V,{className:"h-3 w-3"}),"全局","global"===ce&&o.jsx(re,{className:"h-3 w-3"})]}),ae.length>0&&o.jsxs("button",{onClick:()=>de(e=>"project"===e?null:"project"),className:d("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","project"===ce?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:[o.jsx(le,{className:"h-3 w-3"}),"项目","project"===ce&&o.jsx(re,{className:"h-3 w-3"})]})]}),o.jsx("div",{className:"border-t border-border px-3 py-2 shrink-0",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom))"},children:o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsx("textarea",{ref:i,value:r,onChange:e=>l(e.target.value),onKeyDown:ke,disabled:Y||ye,placeholder:Y?"启动中...":ye?"发送中…":"stopped"===F?"输入消息(自动启动)...":"输入消息...",rows:1,className:d("flex-1 resize-none rounded-md border border-input bg-transparent px-3 py-2 text-sm outline-none","focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50","max-h-32 overflow-y-auto",(Y||ye)&&"opacity-50 cursor-not-allowed"),style:{minHeight:"2.5rem"},onInput:e=>{const t=e.currentTarget;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"}}),o.jsx("button",{onClick:we,disabled:Y||ye||!r.trim(),className:d("shrink-0 p-2 rounded-md transition-colors",r.trim()&&!ye?"text-blue-500 active:bg-blue-500/10":"text-muted-foreground/30"),children:ye?o.jsx(k,{className:"h-5 w-5 animate-spin"}):o.jsx(C,{className:"h-5 w-5"})})]})})]})}const he=U.lazy(()=>T(()=>import("./OfficePreview-BUPUjmJy.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.OfficePreview}))),pe=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),fe=new Set(["docx","xlsx","xls","pptx"]),ge={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function be(e){return e.split("/").pop()??e}function je({filePath:e,onBack:t}){const[s,a]=n.useState(null),[r,l]=n.useState(!0),[c,i]=n.useState(null),{resolved:d}=S(),u=function(e){const t=e.split("/").pop()??"",s=t.toLowerCase();if("dockerfile"===s)return"dockerfile";if("makefile"===s)return"makefile";const a=t.lastIndexOf(".");return a>=0?t.slice(a+1).toLowerCase():""}(e),x=pe.has(u),m=fe.has(u),h=ge[u],p="dark"===d;n.useEffect(()=>{x||m?l(!1):(l(!0),i(null),I(e).then(a).catch(e=>i(e instanceof Error?e.message:"Failed to load")).finally(()=>l(!1)))},[e,x,m]);const f=z(e),g=n.useMemo(()=>{const e=P();return e?`${f}&token=${encodeURIComponent(e)}`:f},[f]),b=n.useMemo(()=>x?`${g}&t=${Date.now()}`:"",[g,x]);return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(w,{className:"h-5 w-5"})}),o.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:be(e)}),o.jsx("a",{href:g,download:!0,className:"text-muted-foreground active:text-foreground p-1",onClick:e=>e.stopPropagation(),children:o.jsx(M,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex-1 overflow-auto min-h-0",children:[r&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(k,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),c&&o.jsx("div",{className:"text-center text-destructive text-sm py-12 px-4",children:c}),x&&o.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:o.jsx("img",{src:b,alt:be(e),className:"max-w-full max-h-full object-contain rounded",style:{touchAction:"pinch-zoom"}})}),m&&o.jsx(n.Suspense,{fallback:o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(k,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),children:o.jsx(he,{filePath:e,ext:u,zoom:100})}),s&&(s.binary||s.tooLarge)&&o.jsxs("div",{className:"text-center py-12 px-4 space-y-3",children:[o.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.binary?"二进制文件":"文件过大",s.size>0&&` (${j=s.size,j<1024?`${j} B`:j<1048576?`${(j/1024).toFixed(1)} KB`:`${(j/1048576).toFixed(1)} MB`})`]}),o.jsxs("a",{href:g,download:!0,className:"inline-flex items-center gap-1.5 text-sm text-blue-500 active:text-blue-400",children:[o.jsx(M,{className:"h-4 w-4"}),"下载文件"]})]}),s&&!s.binary&&!s.tooLarge&&null!=s.content&&o.jsxs(o.Fragment,{children:["md"===u&&o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none px-4 py-3",children:o.jsx(K,{remarkPlugins:[J,Q],rehypePlugins:[G],urlTransform:(e,t,s)=>"src"===t&&"img"===s.tagName?e:Y(e),components:{img:({src:t,alt:s,...a})=>o.jsx("img",{...a,src:X(e,t,P()),alt:s??"",loading:"lazy",style:{maxWidth:"100%",height:"auto"}})},children:s.content})}),"md"!==u&&h&&o.jsx(Z,{language:h,style:p?ee:te,customStyle:{margin:0,fontSize:"12px",borderRadius:0},showLineNumbers:!0,children:s.content}),"md"!==u&&!h&&o.jsx("pre",{className:"p-4 text-xs font-mono whitespace-pre-wrap break-words",children:s.content})]})]})]});var j}const ve=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ye=new Set(["js","jsx","ts","tsx","py","rb","go","rs","java","c","cpp","h","swift","kt","cs","php","sh","bash","zsh","r","lua","dart","zig","css","scss","less","html","htm","xml","sql"]),Ne=new Set(["json","yaml","yml","toml","csv","tsv"]);function we({entry:e}){if("dir"===e.type)return o.jsx(D,{className:"h-8 w-8 text-blue-400"});const t=function(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}(e.name);return ve.has(t)?o.jsx(se,{className:"h-8 w-8 text-emerald-400"}):ye.has(t)?o.jsx(oe,{className:"h-8 w-8 text-orange-400"}):Ne.has(t)?o.jsx(ce,{className:"h-8 w-8 text-yellow-400"}):"md"===t?o.jsx(ae,{className:"h-8 w-8 text-sky-400"}):o.jsx(A,{className:"h-8 w-8 text-muted-foreground"})}function ke({rootPath:e,onClose:t}){const[s,a]=n.useState(e),[r,l]=n.useState([]),[c,i]=n.useState(!0),[d,u]=n.useState(null),x=n.useCallback(async e=>{i(!0);try{const t=[...(await $(e)).entries].sort((e,t)=>e.type!==t.type?"dir"===e.type?-1:1:e.name.localeCompare(t.name));l(t),a(e)}catch{l([])}finally{i(!1)}},[]);n.useEffect(()=>{x(e)},[e,x]);const m=s!==e,h=s.startsWith(e)?s.slice(e.length)||"/":s;return d?o.jsx(je,{filePath:d,onBack:()=>u(null)}):o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(R,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0 text-sm",children:[m&&o.jsx("button",{onClick:()=>{if(s===e)return;const t=s.replace(/\/[^/]+$/,"")||"/";t.startsWith(e)&&x(t)},className:"text-muted-foreground active:text-foreground p-0.5 shrink-0",children:o.jsx(w,{className:"h-4 w-4"})}),o.jsx("span",{className:"truncate text-muted-foreground font-mono text-xs",children:h})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[c&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(k,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!c&&0===r.length&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"空目录"}),!c&&o.jsx("div",{className:"grid grid-cols-3 gap-1",children:r.map(e=>o.jsxs("button",{onClick:()=>(e=>{"dir"===e.type?x(e.path):u(e.path)})(e),className:"flex flex-col items-center gap-1 p-2 rounded-md active:bg-accent transition-colors",children:[o.jsx(we,{entry:e}),o.jsx("span",{className:"text-[11px] text-center leading-tight w-full line-clamp-2 break-all",children:e.name})]},e.path))})]})]})}function Ce(e){return e<50?"text-green-400":e<80?"text-yellow-400":"text-red-400"}function Se(e){return e<50?"bg-green-500":e<80?"bg-yellow-500":"bg-red-500"}function Ie({projectName:e,cliTool:t,folderPath:s,contextData:a,onClose:r}){const[l,c]=n.useState(new Set(["context","usage","files"])),[u,x]=n.useState(null),[m,h]=n.useState(!1),p=e=>{c(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};n.useEffect(()=>{h(!0),E(t).then(x).catch(()=>x(null)).finally(()=>h(!1))},[t]);const f=a?Math.round(a.usedPercentage):null;return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:r,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(R,{className:"h-5 w-5"})}),o.jsx("span",{className:"flex-1 font-medium text-sm truncate",children:e})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o.jsxs("button",{onClick:()=>p("context"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[l.has("context")?o.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(L,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"上下文"}),null!==f&&o.jsxs("span",{className:d("text-xs font-mono ml-auto",Ce(f)),children:[f,"%"]})]}),l.has("context")&&o.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:null!==f&&a?o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex-1 h-2 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:d("h-full rounded-full transition-all",Se(f)),style:{width:`${Math.min(f,100)}%`}})}),o.jsxs("span",{className:d("text-xs font-mono w-10 text-right",Ce(f)),children:[f,"%"]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[o.jsx("span",{children:"窗口大小"}),o.jsx("span",{className:"text-right font-mono",children:a.contextWindowSize>=1e6?`${(a.contextWindowSize/1e6).toFixed(1)}M`:`${Math.round(a.contextWindowSize/1e3)}K`}),o.jsx("span",{children:"输入 tokens"}),o.jsx("span",{className:"text-right font-mono",children:a.inputTokens.toLocaleString()}),o.jsx("span",{children:"输出 tokens"}),o.jsx("span",{className:"text-right font-mono",children:a.outputTokens.toLocaleString()})]})]}):o.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:"暂无数据"})}),o.jsxs("div",{className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 cursor-pointer",role:"button",tabIndex:0,onClick:()=>p("usage"),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||p("usage")},children:[l.has("usage")?o.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(L,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"用量"}),o.jsx("button",{onClick:e=>{e.stopPropagation(),(async()=>{h(!0);try{const{refreshUsage:e}=await T(async()=>{const{refreshUsage:e}=await import("./index-CihceaVm.js").then(e=>e.bN);return{refreshUsage:e}},__vite__mapDeps([1,2]));x(await e(t))}catch{}finally{h(!1)}})()},className:"ml-auto text-muted-foreground active:text-foreground",children:o.jsx(i,{className:d("h-3 w-3",m&&"animate-spin")})})]}),l.has("usage")&&o.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:u?o.jsxs("div",{className:"space-y-2",children:[u.planName&&o.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Plan: ",o.jsx("span",{className:"font-medium text-foreground",children:u.planName})]}),o.jsx(Pe,{label:"5h",bucket:u.fiveHour}),o.jsx(Pe,{label:"7d",bucket:u.sevenDay}),u.sevenDaySonnet&&o.jsx(Pe,{label:"7d Sonnet",bucket:u.sevenDaySonnet}),u.sevenDayOpus&&o.jsx(Pe,{label:"7d Opus",bucket:u.sevenDayOpus}),!u.fiveHour&&!u.sevenDay&&o.jsx("div",{className:"text-xs text-muted-foreground/50 text-center",children:"暂无数据"})]}):o.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:m?"加载中...":"暂无数据"})}),o.jsxs("button",{onClick:()=>p("files"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[l.has("files")?o.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(L,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"文件"})]}),l.has("files")&&o.jsx("div",{className:"h-[60vh]",children:o.jsx(ke,{rootPath:s,onClose:()=>p("files")})})]})]})}function Pe({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const s=t.utilization,a=function(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4);return s>0?`${s}h${a}m`:`${a}m`}(t.resetAt);return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground w-16",children:e}),o.jsx("div",{className:"flex-1 h-1.5 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:d("h-full rounded-full",Se(s)),style:{width:`${Math.min(s,100)}%`}})}),o.jsxs("span",{className:d("text-xs font-mono w-8 text-right",Ce(s)),children:[s,"%"]}),a&&o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:a})]})}function Me(){n.useEffect(()=>{const e=document.querySelector('meta[name="viewport"]');if(!e)return;const t=e.getAttribute("content")??"";return e.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"),()=>{e.setAttribute("content",t)}},[]);const[e,t]=n.useState({screen:"list"}),[s,r]=n.useState(null),l=a(e=>e.projects),c=n.useCallback(e=>{t({screen:"chat",projectId:e}),r(null)},[]),i=n.useCallback(e=>{t({screen:"panel",projectId:e})},[]),d=n.useCallback(()=>{t(e=>"panel"===e.screen?{screen:"chat",projectId:e.projectId}:{screen:"list"})},[]),u="list"!==e.screen?l.find(t=>t.id===e.projectId):void 0;return o.jsxs("div",{className:"fixed inset-0 bg-background overflow-hidden",children:[o.jsxs(H,{mode:"wait",children:["list"===e.screen&&o.jsx(F.div,{className:"absolute inset-0",initial:{opacity:0},animate:{opacity:1},exit:{x:"-30%",opacity:0},transition:{duration:.2},style:{paddingTop:"env(safe-area-inset-top)"},children:o.jsx(ue,{onSelectProject:c})},"list"),"chat"===e.screen&&u&&o.jsx(F.div,{className:"absolute inset-0",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:o.jsx(me,{project:u,onBack:d,onOpenPanel:()=>i(e.projectId),onContextUpdate:r})},`chat-${e.projectId}`)]}),o.jsx(H,{children:"panel"===e.screen&&u&&o.jsx(F.div,{className:"absolute inset-0 z-50 bg-background",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:o.jsx(Ie,{projectName:u.name,cliTool:u.cliTool??"claude",folderPath:u.folderPath,contextData:s,onClose:d})},"panel")})]})}export{Me as MobilePage};
14
+ */function ue({onSelectProject:e}){const h=t(),p=s(e=>e.clearToken),{projects:f,fetchProjects:g,hasFetched:b,loading:j}=a(),v=n.useCallback(()=>{a.getState().setProjects([]),p(),h("/login")},[p,h]),[y,N]=n.useState(new Map),[w,k]=n.useState(new Set),[C,S]=n.useState(!1);n.useEffect(()=>{g()},[g]);const I=n.useCallback(e=>{e.status&&N(t=>{const s=new Map(t);return s.set(e.projectId,e.status),s}),void 0!==e.active&&k(t=>{const s=new Set(t);return e.active?s.add(e.projectId):s.delete(e.projectId),s})},[]);r({onActivityUpdate:I});const{applyOrder:P}=l(),M=P(f.filter(e=>!e.archived));return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-3 px-4 h-12 border-b border-border shrink-0",children:[o.jsx("span",{className:"font-semibold text-base flex-1",children:"CC Web"}),o.jsx(c,{}),o.jsx("button",{onClick:()=>{(async()=>{S(!0);try{await g()}finally{S(!1)}})()},className:"text-muted-foreground active:text-foreground",disabled:C,"aria-label":"Refresh",children:o.jsx(i,{className:d("h-4 w-4",C&&"animate-spin")})}),o.jsx("button",{onClick:()=>h("/settings"),className:"text-muted-foreground active:text-foreground","aria-label":"Settings",children:o.jsx(u,{className:"h-4 w-4"})}),o.jsx("button",{onClick:v,className:"text-muted-foreground active:text-foreground","aria-label":"Logout",children:o.jsx(x,{className:"h-4 w-4"})}),!de&&o.jsx("button",{onClick:()=>h("/"),className:"text-muted-foreground active:text-foreground","aria-label":"Desktop mode",children:o.jsx(m,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[j&&!b&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"加载中..."}),b&&0===M.length&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"暂无项目"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:M.map(t=>{var s;const a="running"===(s=t,y.get(s.id)??s.status??"stopped"),n=w.has(t.id),r=o.jsxs("button",{onClick:()=>e(t.id),className:d("w-full text-left rounded-xl border bg-card p-2.5 active:bg-accent transition-colors",n?"border-transparent":"border-border"),children:[o.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[o.jsx("span",{className:d("w-2 h-2 rounded-full shrink-0",a?"bg-green-500":"bg-zinc-400")}),o.jsx("span",{className:"font-medium text-sm truncate flex-1",children:t.name})]}),o.jsx("div",{className:"text-[10px] text-muted-foreground font-mono truncate",children:t.cliTool??"claude"})]});return o.jsx("div",{className:n?"card-active-glow rounded-xl":void 0,children:r},t.id)})})]})]})}function xe(e){if(!e.phase)return null;if("thinking"===e.phase)return"思考中";if("tool_result"===e.phase)return"处理结果";if("tool_use"===e.phase){const t=(e.detail||"").toLowerCase();return"bash"===t?"执行命令":"read"===t?"读取文件":"edit"===t||"multiedit"===t?"编辑文件":"write"===t?"写入文件":"grep"===t?"搜索内容":"glob"===t?"匹配文件":"webfetch"===t||"websearch"===t?"访问网络":"task"===t?"调度子任务":"todowrite"===t?"更新任务列表":"notebookedit"===t?"编辑 Notebook":e.detail?`调用 ${e.detail}`:"调用工具"}return null}function me({project:e,onBack:t,onOpenPanel:s,onContextUpdate:a}){const[r,l]=n.useState(""),c=n.useRef(null),i=n.useRef(null),[u,x]=n.useState([]),m=n.useCallback(e=>{x(t=>{const s=[...t,e];return s.length>200?s.slice(-200):s})},[]),S=n.useRef(null),I=n.useCallback(e=>{var t;"stopped"===e&&(null==(t=S.current)||t.call(S,"stopped"))},[]),[P,M]=n.useState([]),z=n.useRef(new Set),U=n.useCallback(e=>{z.current.has(e.toolUseId)||M(t=>t.some(t=>t.toolUseId===e.toolUseId)?t:[...t,{projectId:e.projectId,toolUseId:e.toolUseId,toolName:e.toolName,toolInput:e.toolInput,sessionId:e.sessionId,createdAt:e.createdAt}])},[]),T=n.useCallback(e=>{z.current.add(e.toolUseId),M(t=>t.filter(t=>t.toolUseId!==e.toolUseId))},[]),$=n.useCallback(e=>{z.current.add(e),M(t=>t.filter(t=>t.toolUseId!==e))},[]),[R,D]=n.useState(null),A=n.useRef(0),E=n.useCallback(e=>{var t,s,a;if(!e.active)return void D(null);if("text"===(null==(t=e.semantic)?void 0:t.phase))return void D(null);const n=null==(s=e.semantic)?void 0:s.phase,r=null==(a=e.semantic)?void 0:a.detail;D(e=>e?e.phase===n&&e.detail===r?e:{...e,phase:n,detail:r}:{id:"mab"+ ++A.current,phase:n,detail:r})},[]),{sendInput:L,connected:H}=h({projectId:e.id,enabled:!0,onChatMessage:m,onStatusChange:I,onContextUpdate:a,onApprovalRequest:U,onApprovalResolved:T,onSemanticUpdate:E});n.useEffect(()=>{if(!H)return;if("claude"!==e.cliTool)return;let t=!1;return p(e.id).then(e=>{if(t)return;const s=e.pending.filter(e=>!z.current.has(e.toolUseId));M(e=>{const t=new Map;for(const a of s)t.set(a.toolUseId,a);for(const s of e)t.has(s.toolUseId)||z.current.has(s.toolUseId)||t.set(s.toolUseId,s);return[...t.values()]})}).catch(()=>{}),()=>{t=!0}},[e.id,e.cliTool,H]);const{state:F,setState:K,messages:G,hasMoreHistory:J,loadMoreHistory:Q,sendMessage:X,isWaking:Y}=f({project:e,liveMessages:u,ws:{send:L,connected:H},historyLimit:20});S.current=K;const Z=n.useRef(H);n.useEffect(()=>{!Z.current&&H&&x([]),Z.current=H},[H]);const ee=(()=>{for(let e=G.length-1;e>=0;e--)if("assistant"===G[e].role)return e;return-1})(),[te,se]=n.useState([]),[ae,oe]=n.useState([]),[ce,de]=n.useState(null),[ue,me]=n.useState(null),he=n.useRef(!1);n.useEffect(()=>{g().then(se).catch(()=>{}),b(e.id).then(oe).catch(()=>{})},[e.id]);const pe=n.useCallback(e=>{const t=i.current;if(!t)return void l(t=>t+e);const s=t.selectionStart??r.length,a=t.selectionEnd??r.length,n=r.slice(0,s)+e+r.slice(a);l(n),requestAnimationFrame(()=>{t.focus();const a=s+e.length;t.setSelectionRange(a,a),t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"})},[r]),fe=n.useCallback(e=>{de(null),pe(e+" ")},[pe]),ge=n.useCallback(t=>{const s=e.folderPath;let a=t;s&&(t===s||t.startsWith(s+"/")||t.startsWith(s+"\\"))&&(a=t.slice(s.length).replace(/^[/\\]+/,"")),de(null),pe(`@${a} `)},[e.folderPath,pe]),be=n.useCallback(async()=>{if("skills"!==ce){if(!he.current){he.current=!0;try{const t=await j(e.cliTool??"claude",e.id);me(t)}catch{me({builtin:[],custom:[],plugins:[],mcp:[]})}finally{he.current=!1}}de("skills")}else de(null)},[ce,e.cliTool,e.id]),je=n.useCallback(async()=>{const e=c.current,t=(null==e?void 0:e.scrollHeight)??0;await Q(),requestAnimationFrame(()=>{e&&(e.scrollTop+=e.scrollHeight-t)})},[Q]),ve=n.useRef(0);n.useEffect(()=>{const e=c.current;if(!e)return;const t=G.length>ve.current,s=0===ve.current&&G.length>0;ve.current=G.length,s?e.scrollTo({top:e.scrollHeight}):t&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[G,P.length]);const[ye,Ne]=n.useState(!1),we=n.useCallback(async()=>{const e=r.trim();if(!e||ye)return;Ne(!0);const t=await X(e);Ne(!1),"delivered"===t&&(l(""),i.current&&(i.current.style.height="auto"))},[r,ye,X]),ke=v(we,"shift"),Ce=n.useCallback(async(t,s)=>{de(null);try{"failed"===await X(t.command)?y.error("快捷命令未送达,请重试或检查会话"):"project"===s&&N(e.id,t.id,!0).catch(e=>{console.error("Failed to mark shortcut used:",e)})}catch(a){console.error("Shortcut send error:",a),y.error("快捷命令发送失败")}},[X,e.id]),Se="live"===F;return o.jsxs("div",{className:"flex flex-col h-full bg-background",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(w,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[o.jsx("span",{className:"font-medium text-sm truncate",children:e.name}),o.jsx("span",{className:d("w-2 h-2 rounded-full shrink-0",Se?"bg-green-500":Y?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),o.jsx("button",{onClick:s,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(ie,{className:"h-5 w-5"})})]}),o.jsxs("div",{ref:c,className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 min-h-0",children:[J&&o.jsx("div",{className:"flex justify-center pb-1",children:o.jsxs("button",{onClick:()=>{je()},className:"flex items-center gap-1 px-3 py-1.5 rounded-full text-xs text-muted-foreground border border-border active:bg-accent transition-colors",children:[o.jsx(ne,{className:"h-3 w-3"}),"加载更早消息"]})}),G.map((e,t)=>{const s="user"===e.role;return o.jsx("div",{className:d("flex",s?"justify-end":"justify-start"),children:o.jsx("div",{className:d("max-w-[85%] rounded-xl px-3 py-2 break-words text-sm leading-relaxed",s?"bg-blue-500/15 text-foreground border border-blue-500/20 rounded-br-sm whitespace-pre-wrap":"bg-secondary text-secondary-foreground border border-border rounded-bl-sm"),children:s?e.content:o.jsx(O,{content:e.content,blocks:e.blocks,isLatest:t===ee})})},e.id)}),P.map(e=>o.jsx(_,{approval:e,onResolved:$},e.toolUseId)),R&&0===P.length&&o.jsx("div",{className:"flex justify-start",children:o.jsxs("div",{className:"rounded-2xl rounded-bl-md px-3 py-1.5 bg-black/5 dark:bg-white/10 border border-black/10 dark:border-white/15 flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx(q,{}),xe(R)&&o.jsx("span",{children:xe(R)})]})},R.id),0===G.length&&0===P.length&&!R&&"stopped"===F&&o.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-sm",children:"暂无对话记录"}),Y&&o.jsx("div",{className:"flex items-center justify-center py-4 text-yellow-400 text-sm animate-pulse",children:"启动中..."})]}),"global"===ce||"project"===ce?o.jsx("div",{className:"border-t border-border max-h-48 overflow-y-auto shrink-0",children:o.jsxs("div",{className:"px-3 py-2 space-y-1",children:[("global"===ce?te:ae).map(e=>o.jsxs("button",{onClick:()=>Ce(e,ce),disabled:Y,className:d("w-full text-left rounded-md px-2.5 py-2 text-sm active:bg-accent transition-colors border border-border/50",Y&&"opacity-50 cursor-not-allowed"),children:[o.jsx("div",{className:"font-medium text-xs",children:e.label}),o.jsx("div",{className:"text-[11px] text-muted-foreground font-mono truncate",children:e.command})]},e.id)),0===("global"===ce?te:ae).length&&o.jsx("div",{className:"text-center text-muted-foreground text-xs py-3",children:"暂无快捷 Prompts"})]})}):"skills"===ce&&ue?o.jsx("div",{className:"border-t border-border shrink-0",children:o.jsx(W,{data:ue,onCommand:fe})}):"files"===ce&&e.folderPath?o.jsx("div",{className:"border-t border-border shrink-0",children:o.jsx(B,{projectPath:e.folderPath,onSelect:ge})}):null,o.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-t border-border shrink-0",children:[o.jsx("button",{onClick:()=>{be()},title:"斜杠命令",className:d("flex items-center justify-center w-7 h-7 rounded font-mono text-base transition-colors","skills"===ce?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:"/"}),o.jsx("button",{onClick:()=>de(e=>"files"===e?null:"files"),disabled:!e.folderPath,title:"引用文件",className:d("flex items-center justify-center w-7 h-7 rounded font-mono text-base transition-colors","files"===ce?"bg-accent text-foreground font-medium":e.folderPath?"text-muted-foreground active:bg-accent":"text-muted-foreground/30 cursor-not-allowed"),children:"@"}),te.length>0&&o.jsxs("button",{onClick:()=>de(e=>"global"===e?null:"global"),className:d("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","global"===ce?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:[o.jsx(V,{className:"h-3 w-3"}),"全局","global"===ce&&o.jsx(re,{className:"h-3 w-3"})]}),ae.length>0&&o.jsxs("button",{onClick:()=>de(e=>"project"===e?null:"project"),className:d("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","project"===ce?"bg-accent text-foreground font-medium":"text-muted-foreground active:bg-accent"),children:[o.jsx(le,{className:"h-3 w-3"}),"项目","project"===ce&&o.jsx(re,{className:"h-3 w-3"})]})]}),o.jsx("div",{className:"border-t border-border px-3 py-2 shrink-0",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom))"},children:o.jsxs("div",{className:"flex items-end gap-2",children:[o.jsx("textarea",{ref:i,value:r,onChange:e=>l(e.target.value),onKeyDown:ke,disabled:Y||ye,placeholder:Y?"启动中...":ye?"发送中…":"stopped"===F?"输入消息(自动启动)...":"输入消息...",rows:1,className:d("flex-1 resize-none rounded-md border border-input bg-transparent px-3 py-2 text-sm outline-none","focus:ring-1 focus:ring-ring placeholder:text-muted-foreground/50","max-h-32 overflow-y-auto",(Y||ye)&&"opacity-50 cursor-not-allowed"),style:{minHeight:"2.5rem"},onInput:e=>{const t=e.currentTarget;t.style.height="auto",t.style.height=Math.min(t.scrollHeight,128)+"px"}}),o.jsx("button",{onClick:we,disabled:Y||ye||!r.trim(),className:d("shrink-0 p-2 rounded-md transition-colors",r.trim()&&!ye?"text-blue-500 active:bg-blue-500/10":"text-muted-foreground/30"),children:ye?o.jsx(k,{className:"h-5 w-5 animate-spin"}):o.jsx(C,{className:"h-5 w-5"})})]})})]})}const he=U.lazy(()=>T(()=>import("./OfficePreview-CLoz-Kzs.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.OfficePreview}))),pe=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),fe=new Set(["docx","xlsx","xls","pptx"]),ge={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function be(e){return e.split("/").pop()??e}function je({filePath:e,onBack:t}){const[s,a]=n.useState(null),[r,l]=n.useState(!0),[c,i]=n.useState(null),{resolved:d}=S(),u=function(e){const t=e.split("/").pop()??"",s=t.toLowerCase();if("dockerfile"===s)return"dockerfile";if("makefile"===s)return"makefile";const a=t.lastIndexOf(".");return a>=0?t.slice(a+1).toLowerCase():""}(e),x=pe.has(u),m=fe.has(u),h=ge[u],p="dark"===d;n.useEffect(()=>{x||m?l(!1):(l(!0),i(null),I(e).then(a).catch(e=>i(e instanceof Error?e.message:"Failed to load")).finally(()=>l(!1)))},[e,x,m]);const f=z(e),g=n.useMemo(()=>{const e=P();return e?`${f}&token=${encodeURIComponent(e)}`:f},[f]),b=n.useMemo(()=>x?`${g}&t=${Date.now()}`:"",[g,x]);return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(w,{className:"h-5 w-5"})}),o.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:be(e)}),o.jsx("a",{href:g,download:!0,className:"text-muted-foreground active:text-foreground p-1",onClick:e=>e.stopPropagation(),children:o.jsx(M,{className:"h-4 w-4"})})]}),o.jsxs("div",{className:"flex-1 overflow-auto min-h-0",children:[r&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(k,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),c&&o.jsx("div",{className:"text-center text-destructive text-sm py-12 px-4",children:c}),x&&o.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:o.jsx("img",{src:b,alt:be(e),className:"max-w-full max-h-full object-contain rounded",style:{touchAction:"pinch-zoom"}})}),m&&o.jsx(n.Suspense,{fallback:o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(k,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),children:o.jsx(he,{filePath:e,ext:u,zoom:100})}),s&&(s.binary||s.tooLarge)&&o.jsxs("div",{className:"text-center py-12 px-4 space-y-3",children:[o.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.binary?"二进制文件":"文件过大",s.size>0&&` (${j=s.size,j<1024?`${j} B`:j<1048576?`${(j/1024).toFixed(1)} KB`:`${(j/1048576).toFixed(1)} MB`})`]}),o.jsxs("a",{href:g,download:!0,className:"inline-flex items-center gap-1.5 text-sm text-blue-500 active:text-blue-400",children:[o.jsx(M,{className:"h-4 w-4"}),"下载文件"]})]}),s&&!s.binary&&!s.tooLarge&&null!=s.content&&o.jsxs(o.Fragment,{children:["md"===u&&o.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none px-4 py-3",children:o.jsx(K,{remarkPlugins:[J,Q],rehypePlugins:[G],urlTransform:(e,t,s)=>"src"===t&&"img"===s.tagName?e:Y(e),components:{img:({src:t,alt:s,...a})=>o.jsx("img",{...a,src:X(e,t,P()),alt:s??"",loading:"lazy",style:{maxWidth:"100%",height:"auto"}})},children:s.content})}),"md"!==u&&h&&o.jsx(Z,{language:h,style:p?ee:te,customStyle:{margin:0,fontSize:"12px",borderRadius:0},showLineNumbers:!0,children:s.content}),"md"!==u&&!h&&o.jsx("pre",{className:"p-4 text-xs font-mono whitespace-pre-wrap break-words",children:s.content})]})]})]});var j}const ve=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ye=new Set(["js","jsx","ts","tsx","py","rb","go","rs","java","c","cpp","h","swift","kt","cs","php","sh","bash","zsh","r","lua","dart","zig","css","scss","less","html","htm","xml","sql"]),Ne=new Set(["json","yaml","yml","toml","csv","tsv"]);function we({entry:e}){if("dir"===e.type)return o.jsx(D,{className:"h-8 w-8 text-blue-400"});const t=function(e){const t=e.lastIndexOf(".");return t>=0?e.slice(t+1).toLowerCase():""}(e.name);return ve.has(t)?o.jsx(se,{className:"h-8 w-8 text-emerald-400"}):ye.has(t)?o.jsx(oe,{className:"h-8 w-8 text-orange-400"}):Ne.has(t)?o.jsx(ce,{className:"h-8 w-8 text-yellow-400"}):"md"===t?o.jsx(ae,{className:"h-8 w-8 text-sky-400"}):o.jsx(A,{className:"h-8 w-8 text-muted-foreground"})}function ke({rootPath:e,onClose:t}){const[s,a]=n.useState(e),[r,l]=n.useState([]),[c,i]=n.useState(!0),[d,u]=n.useState(null),x=n.useCallback(async e=>{i(!0);try{const t=[...(await $(e)).entries].sort((e,t)=>e.type!==t.type?"dir"===e.type?-1:1:e.name.localeCompare(t.name));l(t),a(e)}catch{l([])}finally{i(!1)}},[]);n.useEffect(()=>{x(e)},[e,x]);const m=s!==e,h=s.startsWith(e)?s.slice(e.length)||"/":s;return d?o.jsx(je,{filePath:d,onBack:()=>u(null)}):o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(R,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0 text-sm",children:[m&&o.jsx("button",{onClick:()=>{if(s===e)return;const t=s.replace(/\/[^/]+$/,"")||"/";t.startsWith(e)&&x(t)},className:"text-muted-foreground active:text-foreground p-0.5 shrink-0",children:o.jsx(w,{className:"h-4 w-4"})}),o.jsx("span",{className:"truncate text-muted-foreground font-mono text-xs",children:h})]})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[c&&o.jsx("div",{className:"flex items-center justify-center py-12",children:o.jsx(k,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!c&&0===r.length&&o.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"空目录"}),!c&&o.jsx("div",{className:"grid grid-cols-3 gap-1",children:r.map(e=>o.jsxs("button",{onClick:()=>(e=>{"dir"===e.type?x(e.path):u(e.path)})(e),className:"flex flex-col items-center gap-1 p-2 rounded-md active:bg-accent transition-colors",children:[o.jsx(we,{entry:e}),o.jsx("span",{className:"text-[11px] text-center leading-tight w-full line-clamp-2 break-all",children:e.name})]},e.path))})]})]})}function Ce(e){return e<50?"text-green-400":e<80?"text-yellow-400":"text-red-400"}function Se(e){return e<50?"bg-green-500":e<80?"bg-yellow-500":"bg-red-500"}function Ie({projectName:e,cliTool:t,folderPath:s,contextData:a,onClose:r}){const[l,c]=n.useState(new Set(["context","usage","files"])),[u,x]=n.useState(null),[m,h]=n.useState(!1),p=e=>{c(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};n.useEffect(()=>{h(!0),E(t).then(x).catch(()=>x(null)).finally(()=>h(!1))},[t]);const f=a?Math.round(a.usedPercentage):null;return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[o.jsx("button",{onClick:r,className:"text-muted-foreground active:text-foreground p-1",children:o.jsx(R,{className:"h-5 w-5"})}),o.jsx("span",{className:"flex-1 font-medium text-sm truncate",children:e})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto",children:[o.jsxs("button",{onClick:()=>p("context"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[l.has("context")?o.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(L,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"上下文"}),null!==f&&o.jsxs("span",{className:d("text-xs font-mono ml-auto",Ce(f)),children:[f,"%"]})]}),l.has("context")&&o.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:null!==f&&a?o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"flex-1 h-2 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:d("h-full rounded-full transition-all",Se(f)),style:{width:`${Math.min(f,100)}%`}})}),o.jsxs("span",{className:d("text-xs font-mono w-10 text-right",Ce(f)),children:[f,"%"]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[o.jsx("span",{children:"窗口大小"}),o.jsx("span",{className:"text-right font-mono",children:a.contextWindowSize>=1e6?`${(a.contextWindowSize/1e6).toFixed(1)}M`:`${Math.round(a.contextWindowSize/1e3)}K`}),o.jsx("span",{children:"输入 tokens"}),o.jsx("span",{className:"text-right font-mono",children:a.inputTokens.toLocaleString()}),o.jsx("span",{children:"输出 tokens"}),o.jsx("span",{className:"text-right font-mono",children:a.outputTokens.toLocaleString()})]})]}):o.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:"暂无数据"})}),o.jsxs("div",{className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 cursor-pointer",role:"button",tabIndex:0,onClick:()=>p("usage"),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||p("usage")},children:[l.has("usage")?o.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(L,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"用量"}),o.jsx("button",{onClick:e=>{e.stopPropagation(),(async()=>{h(!0);try{const{refreshUsage:e}=await T(async()=>{const{refreshUsage:e}=await import("./index-PkEuCOb6.js").then(e=>e.bN);return{refreshUsage:e}},__vite__mapDeps([1,2]));x(await e(t))}catch{}finally{h(!1)}})()},className:"ml-auto text-muted-foreground active:text-foreground",children:o.jsx(i,{className:d("h-3 w-3",m&&"animate-spin")})})]}),l.has("usage")&&o.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:u?o.jsxs("div",{className:"space-y-2",children:[u.planName&&o.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Plan: ",o.jsx("span",{className:"font-medium text-foreground",children:u.planName})]}),o.jsx(Pe,{label:"5h",bucket:u.fiveHour}),o.jsx(Pe,{label:"7d",bucket:u.sevenDay}),u.sevenDaySonnet&&o.jsx(Pe,{label:"7d Sonnet",bucket:u.sevenDaySonnet}),u.sevenDayOpus&&o.jsx(Pe,{label:"7d Opus",bucket:u.sevenDayOpus}),!u.fiveHour&&!u.sevenDay&&o.jsx("div",{className:"text-xs text-muted-foreground/50 text-center",children:"暂无数据"})]}):o.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:m?"加载中...":"暂无数据"})}),o.jsxs("button",{onClick:()=>p("files"),className:"w-full flex items-center gap-2 px-4 py-2.5 border-b border-border/50 active:bg-accent",children:[l.has("files")?o.jsx(re,{className:"h-3.5 w-3.5 text-muted-foreground"}):o.jsx(L,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.jsx("span",{className:"text-sm font-medium",children:"文件"})]}),l.has("files")&&o.jsx("div",{className:"h-[60vh]",children:o.jsx(ke,{rootPath:s,onClose:()=>p("files")})})]})]})}function Pe({label:e,bucket:t}){if(!t||void 0===t.utilization)return null;const s=t.utilization,a=function(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const s=Math.floor(t/36e5),a=Math.floor(t%36e5/6e4);return s>0?`${s}h${a}m`:`${a}m`}(t.resetAt);return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-muted-foreground w-16",children:e}),o.jsx("div",{className:"flex-1 h-1.5 bg-secondary rounded-full overflow-hidden",children:o.jsx("div",{className:d("h-full rounded-full",Se(s)),style:{width:`${Math.min(s,100)}%`}})}),o.jsxs("span",{className:d("text-xs font-mono w-8 text-right",Ce(s)),children:[s,"%"]}),a&&o.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:a})]})}function Me(){n.useEffect(()=>{const e=document.querySelector('meta[name="viewport"]');if(!e)return;const t=e.getAttribute("content")??"";return e.setAttribute("content","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"),()=>{e.setAttribute("content",t)}},[]);const[e,t]=n.useState({screen:"list"}),[s,r]=n.useState(null),l=a(e=>e.projects),c=n.useCallback(e=>{t({screen:"chat",projectId:e}),r(null)},[]),i=n.useCallback(e=>{t({screen:"panel",projectId:e})},[]),d=n.useCallback(()=>{t(e=>"panel"===e.screen?{screen:"chat",projectId:e.projectId}:{screen:"list"})},[]),u="list"!==e.screen?l.find(t=>t.id===e.projectId):void 0;return o.jsxs("div",{className:"fixed inset-0 bg-background overflow-hidden",children:[o.jsxs(H,{mode:"wait",children:["list"===e.screen&&o.jsx(F.div,{className:"absolute inset-0",initial:{opacity:0},animate:{opacity:1},exit:{x:"-30%",opacity:0},transition:{duration:.2},style:{paddingTop:"env(safe-area-inset-top)"},children:o.jsx(ue,{onSelectProject:c})},"list"),"chat"===e.screen&&u&&o.jsx(F.div,{className:"absolute inset-0",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:o.jsx(me,{project:u,onBack:d,onOpenPanel:()=>i(e.projectId),onContextUpdate:r})},`chat-${e.projectId}`)]}),o.jsx(H,{children:"panel"===e.screen&&u&&o.jsx(F.div,{className:"absolute inset-0 z-50 bg-background",initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.25},style:{paddingTop:"env(safe-area-inset-top)"},children:o.jsx(Ie,{projectName:u.name,cliTool:u.cliTool??"claude",folderPath:u.folderPath,contextData:s,onClose:d})},"panel")})]})}export{Me as MobilePage};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-0MbCUjQg.js","assets/index-CihceaVm.js","assets/index-BJDTvhqr.css","assets/jszip.min-DOkAo0GA.js"])))=>i.map(i=>d[i]);
2
- import{j as e,r as t,_ as s,g as r,f as a}from"./index-CihceaVm.js";import{p as n}from"./purify.es-CgRAQgUo.js";async function l(e){let t=a(e);const s=r();s&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch file: ${n.status}`);return n.arrayBuffer()}function o({filePath:r,zoom:a}){const[o,i]=t.useState(""),[d,c]=t.useState(null),[x,u]=t.useState(!0);return t.useEffect(()=>{let e=!1;return u(!0),c(null),(async()=>{try{const t=await s(()=>import("./index-0MbCUjQg.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])),a=await l(r),n=await t.convertToHtml({arrayBuffer:a});e||i(n.value)}catch(t){e||c(t instanceof Error?t.message:"Failed to render docx")}finally{e||u(!1)}})(),()=>{e=!0}},[r]),x?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):d?e.jsx("p",{className:"text-sm text-destructive p-4",children:d}):e.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize(o)}})}function i({filePath:r,zoom:a}){var o;const[i,d]=t.useState([]),[c,x]=t.useState(0),[u,p]=t.useState(null),[m,f]=t.useState(!0);return t.useEffect(()=>{let e=!1;return f(!0),p(null),(async()=>{try{const t=await s(()=>import("./xlsx-DfDjAMCE.js"),[]),a=await l(r),n=t.read(a,{type:"array"}),o=n.SheetNames.map(e=>({name:e,html:t.utils.sheet_to_html(n.Sheets[e],{editable:!1})}));e||(d(o),x(0))}catch(t){e||p(t instanceof Error?t.message:"Failed to render xlsx")}finally{e||f(!1)}})(),()=>{e=!0}},[r]),m?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Excel 文件中..."}):u?e.jsx("p",{className:"text-sm text-destructive p-4",children:u}):0===i.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsxs("div",{className:"flex flex-col h-full",children:[i.length>1&&e.jsx("div",{className:"flex gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30 flex-shrink-0 overflow-x-auto",children:i.map((t,s)=>e.jsx("button",{onClick:()=>x(s),className:"px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap "+(s===c?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:t.name},s))}),e.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize((null==(o=i[c])?void 0:o.html)??"")}}),e.jsx("style",{children:"\n .xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }\n .xlsx-preview td, .xlsx-preview th {\n border: 1px solid hsl(var(--border));\n padding: 4px 8px;\n text-align: left;\n white-space: nowrap;\n font-size: inherit;\n }\n .xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }\n .xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }\n "})]})}function d({filePath:r,zoom:a}){const[n,o]=t.useState([]),[i,d]=t.useState(null),[c,x]=t.useState(!0);return t.useEffect(()=>{let e=!1;return x(!0),d(null),(async()=>{try{const t=await l(r),a=await async function(e){const{default:t}=await s(async()=>{const{default:e}=await import("./jszip.min-DOkAo0GA.js").then(e=>e.j);return{default:e}},__vite__mapDeps([3,1,2])),r=await t.loadAsync(e),a=[],n=Object.keys(r.files).filter(e=>/^ppt\/slides\/slide\d+\.xml$/i.test(e)).sort((e,t)=>{var s,r;return parseInt((null==(s=e.match(/slide(\d+)/))?void 0:s[1])??"0")-parseInt((null==(r=t.match(/slide(\d+)/))?void 0:r[1])??"0")});for(let s=0;s<n.length;s++){const e=await r.file(n[s]).async("text"),t=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let o;for(;null!==(o=l.exec(e));){const e=o[1].replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').trim();e&&t.push(e)}a.push({index:s+1,texts:t})}return a}(t);e||o(a)}catch(t){e||d(t instanceof Error?t.message:"Failed to render pptx")}finally{e||x(!1)}})(),()=>{e=!0}},[r]),c?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?e.jsx("p",{className:"text-sm text-destructive p-4",children:i}):0===n.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsx("div",{className:"p-4 space-y-4",style:{fontSize:12*a/100+"px"},children:n.map(t=>e.jsxs("div",{className:"border border-border rounded-xl p-5 bg-muted/20",children:[e.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",t.index]}),t.texts.length>0?e.jsx("div",{className:"space-y-1.5",children:t.texts.map((t,s)=>e.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:t},s))}):e.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},t.index))})}const c=new Set(["docx","xlsx","xls","pptx"]);function x({filePath:t,ext:s,zoom:r}){return"docx"===s?e.jsx(o,{filePath:t,zoom:r}):"xlsx"===s||"xls"===s?e.jsx(i,{filePath:t,zoom:r}):"pptx"===s?e.jsx(d,{filePath:t,zoom:r}):null}export{c as OFFICE_EXTS,x as OfficePreview};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DKiLzICV.js","assets/index-PkEuCOb6.js","assets/index-BJDTvhqr.css","assets/jszip.min-C5eqdtGO.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as t,_ as s,g as r,f as a}from"./index-PkEuCOb6.js";import{p as n}from"./purify.es-CgRAQgUo.js";async function l(e){let t=a(e);const s=r();s&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch file: ${n.status}`);return n.arrayBuffer()}function o({filePath:r,zoom:a}){const[o,i]=t.useState(""),[d,c]=t.useState(null),[x,u]=t.useState(!0);return t.useEffect(()=>{let e=!1;return u(!0),c(null),(async()=>{try{const t=await s(()=>import("./index-DKiLzICV.js").then(e=>e.i),__vite__mapDeps([0,1,2,3])),a=await l(r),n=await t.convertToHtml({arrayBuffer:a});e||i(n.value)}catch(t){e||c(t instanceof Error?t.message:"Failed to render docx")}finally{e||u(!1)}})(),()=>{e=!0}},[r]),x?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):d?e.jsx("p",{className:"text-sm text-destructive p-4",children:d}):e.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize(o)}})}function i({filePath:r,zoom:a}){var o;const[i,d]=t.useState([]),[c,x]=t.useState(0),[u,p]=t.useState(null),[m,f]=t.useState(!0);return t.useEffect(()=>{let e=!1;return f(!0),p(null),(async()=>{try{const t=await s(()=>import("./xlsx-DfDjAMCE.js"),[]),a=await l(r),n=t.read(a,{type:"array"}),o=n.SheetNames.map(e=>({name:e,html:t.utils.sheet_to_html(n.Sheets[e],{editable:!1})}));e||(d(o),x(0))}catch(t){e||p(t instanceof Error?t.message:"Failed to render xlsx")}finally{e||f(!1)}})(),()=>{e=!0}},[r]),m?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Excel 文件中..."}):u?e.jsx("p",{className:"text-sm text-destructive p-4",children:u}):0===i.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsxs("div",{className:"flex flex-col h-full",children:[i.length>1&&e.jsx("div",{className:"flex gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30 flex-shrink-0 overflow-x-auto",children:i.map((t,s)=>e.jsx("button",{onClick:()=>x(s),className:"px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap "+(s===c?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"),children:t.name},s))}),e.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:12*a/100+"px"},dangerouslySetInnerHTML:{__html:n.sanitize((null==(o=i[c])?void 0:o.html)??"")}}),e.jsx("style",{children:"\n .xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }\n .xlsx-preview td, .xlsx-preview th {\n border: 1px solid hsl(var(--border));\n padding: 4px 8px;\n text-align: left;\n white-space: nowrap;\n font-size: inherit;\n }\n .xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }\n .xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }\n "})]})}function d({filePath:r,zoom:a}){const[n,o]=t.useState([]),[i,d]=t.useState(null),[c,x]=t.useState(!0);return t.useEffect(()=>{let e=!1;return x(!0),d(null),(async()=>{try{const t=await l(r),a=await async function(e){const{default:t}=await s(async()=>{const{default:e}=await import("./jszip.min-C5eqdtGO.js").then(e=>e.j);return{default:e}},__vite__mapDeps([3,1,2])),r=await t.loadAsync(e),a=[],n=Object.keys(r.files).filter(e=>/^ppt\/slides\/slide\d+\.xml$/i.test(e)).sort((e,t)=>{var s,r;return parseInt((null==(s=e.match(/slide(\d+)/))?void 0:s[1])??"0")-parseInt((null==(r=t.match(/slide(\d+)/))?void 0:r[1])??"0")});for(let s=0;s<n.length;s++){const e=await r.file(n[s]).async("text"),t=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let o;for(;null!==(o=l.exec(e));){const e=o[1].replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').trim();e&&t.push(e)}a.push({index:s+1,texts:t})}return a}(t);e||o(a)}catch(t){e||d(t instanceof Error?t.message:"Failed to render pptx")}finally{e||x(!1)}})(),()=>{e=!0}},[r]),c?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?e.jsx("p",{className:"text-sm text-destructive p-4",children:i}):0===n.length?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsx("div",{className:"p-4 space-y-4",style:{fontSize:12*a/100+"px"},children:n.map(t=>e.jsxs("div",{className:"border border-border rounded-xl p-5 bg-muted/20",children:[e.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",t.index]}),t.texts.length>0?e.jsx("div",{className:"space-y-1.5",children:t.texts.map((t,s)=>e.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:t},s))}):e.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},t.index))})}const c=new Set(["docx","xlsx","xls","pptx"]);function x({filePath:t,ext:s,zoom:r}){return"docx"===s?e.jsx(o,{filePath:t,zoom:r}):"xlsx"===s||"xls"===s?e.jsx(i,{filePath:t,zoom:r}):"pptx"===s?e.jsx(d,{filePath:t,zoom:r}):null}export{c as OFFICE_EXTS,x as OfficePreview};