@tom2012/cc-web 2026.4.19-t → 2026.4.19-v

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 (68) hide show
  1. package/README.md +1 -1
  2. package/backend/dist/adapters/claude-adapter.d.ts.map +1 -1
  3. package/backend/dist/adapters/claude-adapter.js +155 -6
  4. package/backend/dist/adapters/claude-adapter.js.map +1 -1
  5. package/backend/dist/adapters/gemini-adapter.js +1 -1
  6. package/backend/dist/adapters/gemini-adapter.js.map +1 -1
  7. package/backend/dist/adapters/types.d.ts +3 -0
  8. package/backend/dist/adapters/types.d.ts.map +1 -1
  9. package/backend/dist/crypto-at-rest.d.ts +8 -0
  10. package/backend/dist/crypto-at-rest.d.ts.map +1 -0
  11. package/backend/dist/crypto-at-rest.js +96 -0
  12. package/backend/dist/crypto-at-rest.js.map +1 -0
  13. package/backend/dist/hub-auth.d.ts +12 -0
  14. package/backend/dist/hub-auth.d.ts.map +1 -0
  15. package/backend/dist/hub-auth.js +123 -0
  16. package/backend/dist/hub-auth.js.map +1 -0
  17. package/backend/dist/index.d.ts.map +1 -1
  18. package/backend/dist/index.js +2 -0
  19. package/backend/dist/index.js.map +1 -1
  20. package/backend/dist/memory-prompts.d.ts +30 -0
  21. package/backend/dist/memory-prompts.d.ts.map +1 -0
  22. package/backend/dist/memory-prompts.js +163 -0
  23. package/backend/dist/memory-prompts.js.map +1 -0
  24. package/backend/dist/routes/claude.d.ts.map +1 -1
  25. package/backend/dist/routes/claude.js +98 -0
  26. package/backend/dist/routes/claude.js.map +1 -1
  27. package/backend/dist/routes/memory-prompts.d.ts +3 -0
  28. package/backend/dist/routes/memory-prompts.d.ts.map +1 -0
  29. package/backend/dist/routes/memory-prompts.js +49 -0
  30. package/backend/dist/routes/memory-prompts.js.map +1 -0
  31. package/backend/dist/routes/skillhub.d.ts +27 -0
  32. package/backend/dist/routes/skillhub.d.ts.map +1 -1
  33. package/backend/dist/routes/skillhub.js +290 -151
  34. package/backend/dist/routes/skillhub.js.map +1 -1
  35. package/backend/dist/session-manager.d.ts +12 -0
  36. package/backend/dist/session-manager.d.ts.map +1 -1
  37. package/backend/dist/session-manager.js.map +1 -1
  38. package/backend/dist/sync-service.d.ts +9 -6
  39. package/backend/dist/sync-service.d.ts.map +1 -1
  40. package/backend/dist/sync-service.js +84 -14
  41. package/backend/dist/sync-service.js.map +1 -1
  42. package/backend/package-lock.json +26 -0
  43. package/backend/package.json +2 -0
  44. package/frontend/dist/assets/AssistantMessageContent-qmMdpSdp.js +13 -0
  45. package/frontend/dist/assets/{GraphPreview-CeI4sbtV.js → GraphPreview-Cj-m26nq.js} +1 -1
  46. package/frontend/dist/assets/MobilePage-Dt7mdX_t.js +14 -0
  47. package/frontend/dist/assets/{OfficePreview-Dgs4aiYi.js → OfficePreview-CQROE6jJ.js} +2 -2
  48. package/frontend/dist/assets/{ProjectPage-DPv57nD9.js → ProjectPage-B-7RSILW.js} +5 -5
  49. package/frontend/dist/assets/SettingsPage-DrnZKm6L.js +13 -0
  50. package/frontend/dist/assets/SkillHubPage-Cr3_-Iwx.js +13 -0
  51. package/frontend/dist/assets/{chevron-down-CyDTNuVw.js → chevron-down-Ck7IYzKo.js} +1 -1
  52. package/frontend/dist/assets/chevron-up-vfhplDGO.js +13 -0
  53. package/frontend/dist/assets/index-BIaRBMD3.js +75 -0
  54. package/frontend/dist/assets/{index-z4qRGojt.js → index-CPwWf4Su.js} +1 -1
  55. package/frontend/dist/assets/index-CYvos3U3.js +13 -0
  56. package/frontend/dist/assets/index-DCiTw3F5.css +1 -0
  57. package/frontend/dist/assets/{jszip.min-CPG_u-b-.js → jszip.min-OAmm8lsw.js} +1 -1
  58. package/frontend/dist/assets/{search-CZ83atP-.js → search-B2NI-Y0J.js} +1 -1
  59. package/frontend/dist/index.html +2 -2
  60. package/package.json +1 -1
  61. package/frontend/dist/assets/AssistantMessageContent-D1-3VpWE.js +0 -13
  62. package/frontend/dist/assets/MobilePage-BP7c3W3D.js +0 -14
  63. package/frontend/dist/assets/SettingsPage-CFSmKovg.js +0 -13
  64. package/frontend/dist/assets/SkillHubPage-4g29B-Hr.js +0 -13
  65. package/frontend/dist/assets/chevron-up-BURz786o.js +0 -7
  66. package/frontend/dist/assets/index-BFWZX3Hz.js +0 -75
  67. package/frontend/dist/assets/index-D0NB3R9q.css +0 -1
  68. package/frontend/dist/assets/index-Uy-V98k3.js +0 -13
@@ -1,4 +1,4 @@
1
- import{c as e,r as t,b as n,j as i,ai as r,B as o,l as a}from"./index-BFWZX3Hz.js";import{Z as s,a as l}from"./ProjectPage-DPv57nD9.js";import"./purify.es-CgRAQgUo.js";import"./AssistantMessageContent-D1-3VpWE.js";import"./chevron-down-CyDTNuVw.js";import"./chevron-up-BURz786o.js";import"./index-Uy-V98k3.js";import"./search-CZ83atP-.js";
1
+ import{c as e,r as t,b as n,j as i,aC as r,B as o,l as a}from"./index-BIaRBMD3.js";import{Z as s,a as l}from"./ProjectPage-B-7RSILW.js";import"./purify.es-CgRAQgUo.js";import"./AssistantMessageContent-qmMdpSdp.js";import"./chevron-down-Ck7IYzKo.js";import"./chevron-up-vfhplDGO.js";import"./index-CYvos3U3.js";import"./search-B2NI-Y0J.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -0,0 +1,14 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/OfficePreview-CQROE6jJ.js","assets/index-BIaRBMD3.js","assets/index-DCiTw3F5.css","assets/purify.es-CgRAQgUo.js"])))=>i.map(i=>d[i]);
2
+ import{c as e,ax as t,aU as s,r as a,bt as n,bu as r,j as l,bv as o,l as c,d as i,bw as d,bx as x,aK as u,aL as m,a5 as h,a4 as p,by as f,ay as g,aS as j,a as b,b as v,g as y,D as N,aC as w,f as k,R as C,_ as S,k as I,X as M,o as z,bz as P,bA as U,C as T,A,p as $}from"./index-BIaRBMD3.js";import{A as D,d as E,G as L,M as R,r as H,a as O,b as _,h as q,o as F,c as B,I as W,F as K}from"./AssistantMessageContent-qmMdpSdp.js";import{C as V}from"./chevron-up-vfhplDGO.js";import{C as G}from"./chevron-down-Ck7IYzKo.js";
3
+ /**
4
+ * @license lucide-react v0.309.0 - ISC
5
+ *
6
+ * This source code is licensed under the ISC license.
7
+ * See the LICENSE file in the root directory of this source tree.
8
+ */const J=e("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]),Q=e("FileCode",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"m10 13-2 2 2 2",key:"17smn8"}],["path",{d:"m14 17 2-2-2-2",key:"14mezr"}]]),X=e("FileJson",[["path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z",key:"1nnpy2"}],["polyline",{points:"14 2 14 8 20 8",key:"1ew0cm"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]),Y=e("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]),Z=window.matchMedia("(pointer: coarse)").matches&&window.innerWidth<768;
9
+ /**
10
+ * @license lucide-react v0.309.0 - ISC
11
+ *
12
+ * This source code is licensed under the ISC license.
13
+ * See the LICENSE file in the root directory of this source tree.
14
+ */function ee({onSelectProject:e}){const x=t(),{projects:u,fetchProjects:m,hasFetched:h,loading:p}=s(),[f,g]=a.useState(new Map),[j,b]=a.useState(new Set),[v,y]=a.useState(!1);a.useEffect(()=>{m()},[m]);const N=a.useCallback(e=>{e.status&&g(t=>{const s=new Map(t);return s.set(e.projectId,e.status),s}),void 0!==e.active&&b(t=>{const s=new Set(t);return e.active?s.add(e.projectId):s.delete(e.projectId),s})},[]);n({onActivityUpdate:N});const{applyOrder:w}=r(),k=w(u.filter(e=>!e.archived));return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center gap-3 px-4 h-12 border-b border-border shrink-0",children:[l.jsx("span",{className:"font-semibold text-base flex-1",children:"CC Web"}),l.jsx(o,{}),l.jsx("button",{onClick:()=>{(async()=>{y(!0);try{await m()}finally{y(!1)}})()},className:"text-muted-foreground active:text-foreground",disabled:v,children:l.jsx(c,{className:i("h-4 w-4",v&&"animate-spin")})}),!Z&&l.jsx("button",{onClick:()=>x("/"),className:"text-muted-foreground active:text-foreground",title:"桌面模式",children:l.jsx(d,{className:"h-4 w-4"})})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[p&&!h&&l.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"加载中..."}),h&&0===k.length&&l.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"暂无项目"}),l.jsx("div",{className:"grid grid-cols-2 gap-2",children:k.map(t=>{var s;const a="running"===(s=t,f.get(s.id)??s.status??"stopped"),n=j.has(t.id),r=l.jsxs("button",{onClick:()=>e(t.id),className:i("w-full text-left rounded-lg border bg-card p-2.5 active:bg-accent transition-colors",n?"border-transparent":"border-border"),children:[l.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[l.jsx("span",{className:i("w-2 h-2 rounded-full shrink-0",a?"bg-green-500":"bg-zinc-400")}),l.jsx("span",{className:"font-medium text-sm truncate flex-1",children:t.name})]}),l.jsx("div",{className:"text-[10px] text-muted-foreground font-mono truncate",children:t.cliTool??"claude"})]});return l.jsx("div",{className:n?"card-active-glow rounded-lg":void 0,children:r},t.id)})})]})]})}function te({project:e,onBack:t,onOpenPanel:s,onContextUpdate:n}){const[r,o]=a.useState(""),c=a.useRef(null),d=a.useRef(null),[b,v]=a.useState([]),y=a.useCallback(e=>{v(t=>{const s=[...t,e];return s.length>200?s.slice(-200):s})},[]),N=a.useRef(null),w=a.useCallback(e=>{var t;"stopped"===e&&(null==(t=N.current)||t.call(N,"stopped"))},[]),[k,C]=a.useState([]),S=a.useRef(new Set),I=a.useCallback(e=>{S.current.has(e.toolUseId)||C(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}])},[]),M=a.useCallback(e=>{S.current.add(e.toolUseId),C(t=>t.filter(t=>t.toolUseId!==e.toolUseId))},[]),z=a.useCallback(e=>{S.current.add(e),C(t=>t.filter(t=>t.toolUseId!==e))},[]),{sendInput:P,connected:U}=x({projectId:e.id,enabled:!0,onChatMessage:y,onStatusChange:w,onContextUpdate:n,onApprovalRequest:I,onApprovalResolved:M});a.useEffect(()=>{if(!U)return;if("claude"!==e.cliTool)return;let t=!1;return u(e.id).then(e=>{if(t)return;const s=e.pending.filter(e=>!S.current.has(e.toolUseId));C(e=>{const t=new Map;for(const a of s)t.set(a.toolUseId,a);for(const s of e)t.has(s.toolUseId)||S.current.has(s.toolUseId)||t.set(s.toolUseId,s);return[...t.values()]})}).catch(()=>{}),()=>{t=!0}},[e.id,e.cliTool,U]);const{state:T,setState:A,messages:$,hasMoreHistory:R,loadMoreHistory:H,sendMessage:O,isWaking:_}=m({project:e,liveMessages:b,ws:{send:P,connected:U},historyLimit:20});N.current=A;const q=a.useRef(U);a.useEffect(()=>{!q.current&&U&&v([]),q.current=U},[U]);const F=(()=>{for(let e=$.length-1;e>=0;e--)if("assistant"===$[e].role)return e;return-1})(),[B,W]=a.useState([]),[K,Q]=a.useState([]),[X,Z]=a.useState(null);a.useEffect(()=>{h().then(W).catch(()=>{}),p(e.id).then(Q).catch(()=>{})},[e.id]);const ee=a.useCallback(async()=>{const e=c.current,t=(null==e?void 0:e.scrollHeight)??0;await H(),requestAnimationFrame(()=>{e&&(e.scrollTop+=e.scrollHeight-t)})},[H]),te=a.useRef(0);a.useEffect(()=>{const e=c.current;if(!e)return;const t=$.length>te.current,s=0===te.current&&$.length>0;te.current=$.length,s?e.scrollTo({top:e.scrollHeight}):t&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[$,k.length]);const se=a.useCallback(()=>{const e=r.trim();e&&(o(""),d.current&&(d.current.style.height="auto"),O(e))},[r,O]),ae=f(se,"shift"),ne=a.useCallback(e=>{Z(null),O(e)},[O]),re="live"===T;return l.jsxs("div",{className:"flex flex-col h-full bg-background",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[l.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(g,{className:"h-5 w-5"})}),l.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0",children:[l.jsx("span",{className:"font-medium text-sm truncate",children:e.name}),l.jsx("span",{className:i("w-2 h-2 rounded-full shrink-0",re?"bg-green-500":_?"bg-yellow-400 animate-pulse":"bg-zinc-400")})]}),l.jsx("button",{onClick:s,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(Y,{className:"h-5 w-5"})})]}),l.jsxs("div",{ref:c,className:"flex-1 overflow-y-auto px-3 py-3 space-y-3 min-h-0",children:[R&&l.jsx("div",{className:"flex justify-center pb-1",children:l.jsxs("button",{onClick:()=>{ee()},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:[l.jsx(V,{className:"h-3 w-3"}),"加载更早消息"]})}),$.map((e,t)=>{const s="user"===e.role;return l.jsx("div",{className:i("flex",s?"justify-end":"justify-start"),children:l.jsx("div",{className:i("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:l.jsx(D,{content:e.content,blocks:e.blocks,isLatest:t===F})})},e.id)}),k.map(e=>l.jsx(E,{approval:e,onResolved:z},e.toolUseId)),0===$.length&&0===k.length&&"stopped"===T&&l.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground/40 text-sm",children:"暂无对话记录"}),_&&l.jsx("div",{className:"flex items-center justify-center py-4 text-yellow-400 text-sm animate-pulse",children:"启动中..."})]}),X&&l.jsx("div",{className:"border-t border-border max-h-48 overflow-y-auto shrink-0",children:l.jsxs("div",{className:"px-3 py-2 space-y-1",children:[("global"===X?B:K).map(e=>l.jsxs("button",{onClick:()=>ne(e.command),disabled:_,className:i("w-full text-left rounded-md px-2.5 py-2 text-sm active:bg-accent transition-colors border border-border/50",_&&"opacity-50 cursor-not-allowed"),children:[l.jsx("div",{className:"font-medium text-xs",children:e.label}),l.jsx("div",{className:"text-[11px] text-muted-foreground font-mono truncate",children:e.command})]},e.id)),0===("global"===X?B:K).length&&l.jsx("div",{className:"text-center text-muted-foreground text-xs py-3",children:"暂无快捷 Prompts"})]})}),(B.length>0||K.length>0)&&l.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-1.5 border-t border-border shrink-0",children:[l.jsxs("button",{onClick:()=>Z(e=>"global"===e?null:"global"),className:i("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","global"===X?"bg-blue-500/15 text-blue-500":"text-muted-foreground active:bg-accent"),children:[l.jsx(L,{className:"h-3 w-3"}),"全局","global"===X&&l.jsx(G,{className:"h-3 w-3"})]}),l.jsxs("button",{onClick:()=>Z(e=>"project"===e?null:"project"),className:i("flex items-center gap-1 px-2 py-1 rounded-md text-xs transition-colors","project"===X?"bg-blue-500/15 text-blue-500":"text-muted-foreground active:bg-accent"),children:[l.jsx(J,{className:"h-3 w-3"}),"项目","project"===X&&l.jsx(G,{className:"h-3 w-3"})]})]}),l.jsx("div",{className:"border-t border-border px-3 py-2 shrink-0",style:{paddingBottom:"max(0.5rem, env(safe-area-inset-bottom))"},children:l.jsxs("div",{className:"flex items-end gap-2",children:[l.jsx("textarea",{ref:d,value:r,onChange:e=>o(e.target.value),onKeyDown:ae,disabled:_,placeholder:_?"启动中...":"stopped"===T?"输入消息(自动启动)...":"输入消息...",rows:1,className:i("flex-1 resize-none rounded-lg 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",_&&"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"}}),l.jsx("button",{onClick:se,disabled:_||!r.trim(),className:i("shrink-0 p-2 rounded-lg transition-colors",r.trim()?"text-blue-500 active:bg-blue-500/10":"text-muted-foreground/30"),children:l.jsx(j,{className:"h-5 w-5"})})]})})]})}const se=C.lazy(()=>S(()=>import("./OfficePreview-CQROE6jJ.js"),__vite__mapDeps([0,1,2,3])).then(e=>({default:e.OfficePreview}))),ae=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ne=new Set(["docx","xlsx","xls","pptx"]),re={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 le(e){return e.split("/").pop()??e}function oe({filePath:e,onBack:t}){const[s,n]=a.useState(null),[r,o]=a.useState(!0),[c,i]=a.useState(null),{resolved:d}=b(),x=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),u=ae.has(x),m=ne.has(x),h=re[x],p="dark"===d;a.useEffect(()=>{u||m?o(!1):(o(!0),i(null),v(e).then(n).catch(e=>i(e instanceof Error?e.message:"Failed to load")).finally(()=>o(!1)))},[e,u,m]);const f=k(e),j=a.useMemo(()=>{const e=y();return e?`${f}&token=${encodeURIComponent(e)}`:f},[f]),C=a.useMemo(()=>u?`${j}&t=${Date.now()}`:"",[j,u]);return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[l.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(g,{className:"h-5 w-5"})}),l.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:le(e)}),l.jsx("a",{href:j,download:!0,className:"text-muted-foreground active:text-foreground p-1",onClick:e=>e.stopPropagation(),children:l.jsx(N,{className:"h-4 w-4"})})]}),l.jsxs("div",{className:"flex-1 overflow-auto min-h-0",children:[r&&l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),c&&l.jsx("div",{className:"text-center text-destructive text-sm py-12 px-4",children:c}),u&&l.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:l.jsx("img",{src:C,alt:le(e),className:"max-w-full max-h-full object-contain rounded",style:{touchAction:"pinch-zoom"}})}),m&&l.jsx(a.Suspense,{fallback:l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),children:l.jsx(se,{filePath:e,ext:x,zoom:100})}),s&&(s.binary||s.tooLarge)&&l.jsxs("div",{className:"text-center py-12 px-4 space-y-3",children:[l.jsxs("p",{className:"text-muted-foreground text-sm",children:[s.binary?"二进制文件":"文件过大",s.size>0&&` (${S=s.size,S<1024?`${S} B`:S<1048576?`${(S/1024).toFixed(1)} KB`:`${(S/1048576).toFixed(1)} MB`})`]}),l.jsxs("a",{href:j,download:!0,className:"inline-flex items-center gap-1.5 text-sm text-blue-500 active:text-blue-400",children:[l.jsx(N,{className:"h-4 w-4"}),"下载文件"]})]}),s&&!s.binary&&!s.tooLarge&&null!=s.content&&l.jsxs(l.Fragment,{children:["md"===x&&l.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none px-4 py-3",children:l.jsx(R,{remarkPlugins:[O,_],rehypePlugins:[H],children:s.content})}),"md"!==x&&h&&l.jsx(q,{language:h,style:p?F:B,customStyle:{margin:0,fontSize:"12px",borderRadius:0},showLineNumbers:!0,children:s.content}),"md"!==x&&!h&&l.jsx("pre",{className:"p-4 text-xs font-mono whitespace-pre-wrap break-words",children:s.content})]})]})]});var S}const ce=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif"]),ie=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"]),de=new Set(["json","yaml","yml","toml","csv","tsv"]);function xe({entry:e}){if("dir"===e.type)return l.jsx(z,{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 ce.has(t)?l.jsx(W,{className:"h-8 w-8 text-emerald-400"}):ie.has(t)?l.jsx(Q,{className:"h-8 w-8 text-orange-400"}):de.has(t)?l.jsx(X,{className:"h-8 w-8 text-yellow-400"}):"md"===t?l.jsx(K,{className:"h-8 w-8 text-sky-400"}):l.jsx(P,{className:"h-8 w-8 text-muted-foreground"})}function ue({rootPath:e,onClose:t}){const[s,n]=a.useState(e),[r,o]=a.useState([]),[c,i]=a.useState(!0),[d,x]=a.useState(null),u=a.useCallback(async e=>{i(!0);try{const t=[...(await I(e)).entries].sort((e,t)=>e.type!==t.type?"dir"===e.type?-1:1:e.name.localeCompare(t.name));o(t),n(e)}catch{o([])}finally{i(!1)}},[]);a.useEffect(()=>{u(e)},[e,u]);const m=s!==e,h=s.startsWith(e)?s.slice(e.length)||"/":s;return d?l.jsx(oe,{filePath:d,onBack:()=>x(null)}):l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[l.jsx("button",{onClick:t,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(M,{className:"h-5 w-5"})}),l.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0 text-sm",children:[m&&l.jsx("button",{onClick:()=>{if(s===e)return;const t=s.replace(/\/[^/]+$/,"")||"/";t.startsWith(e)&&u(t)},className:"text-muted-foreground active:text-foreground p-0.5 shrink-0",children:l.jsx(g,{className:"h-4 w-4"})}),l.jsx("span",{className:"truncate text-muted-foreground font-mono text-xs",children:h})]})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto px-3 py-3",children:[c&&l.jsx("div",{className:"flex items-center justify-center py-12",children:l.jsx(w,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!c&&0===r.length&&l.jsx("div",{className:"text-center text-muted-foreground text-sm py-12",children:"空目录"}),!c&&l.jsx("div",{className:"grid grid-cols-3 gap-1",children:r.map(e=>l.jsxs("button",{onClick:()=>(e=>{"dir"===e.type?u(e.path):x(e.path)})(e),className:"flex flex-col items-center gap-1 p-2 rounded-lg active:bg-accent transition-colors",children:[l.jsx(xe,{entry:e}),l.jsx("span",{className:"text-[11px] text-center leading-tight w-full line-clamp-2 break-all",children:e.name})]},e.path))})]})]})}function me(e){return e<50?"text-green-400":e<80?"text-yellow-400":"text-red-400"}function he(e){return e<50?"bg-green-500":e<80?"bg-yellow-500":"bg-red-500"}function pe({projectName:e,cliTool:t,folderPath:s,contextData:n,onClose:r}){const[o,d]=a.useState(new Set(["context","usage","files"])),[x,u]=a.useState(null),[m,h]=a.useState(!1),p=e=>{d(t=>{const s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})};a.useEffect(()=>{h(!0),U(t).then(u).catch(()=>u(null)).finally(()=>h(!1))},[t]);const f=n?Math.round(n.usedPercentage):null;return l.jsxs("div",{className:"flex flex-col h-full",children:[l.jsxs("div",{className:"flex items-center gap-2 px-3 h-12 border-b border-border shrink-0",children:[l.jsx("button",{onClick:r,className:"text-muted-foreground active:text-foreground p-1",children:l.jsx(M,{className:"h-5 w-5"})}),l.jsx("span",{className:"flex-1 font-medium text-sm truncate",children:e})]}),l.jsxs("div",{className:"flex-1 overflow-y-auto",children:[l.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:[o.has("context")?l.jsx(G,{className:"h-3.5 w-3.5 text-muted-foreground"}):l.jsx(T,{className:"h-3.5 w-3.5 text-muted-foreground"}),l.jsx("span",{className:"text-sm font-medium",children:"上下文"}),null!==f&&l.jsxs("span",{className:i("text-xs font-mono ml-auto",me(f)),children:[f,"%"]})]}),o.has("context")&&l.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:null!==f&&n?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"flex-1 h-2 bg-secondary rounded-full overflow-hidden",children:l.jsx("div",{className:i("h-full rounded-full transition-all",he(f)),style:{width:`${Math.min(f,100)}%`}})}),l.jsxs("span",{className:i("text-xs font-mono w-10 text-right",me(f)),children:[f,"%"]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-[11px] text-muted-foreground",children:[l.jsx("span",{children:"窗口大小"}),l.jsx("span",{className:"text-right font-mono",children:n.contextWindowSize>=1e6?`${(n.contextWindowSize/1e6).toFixed(1)}M`:`${Math.round(n.contextWindowSize/1e3)}K`}),l.jsx("span",{children:"输入 tokens"}),l.jsx("span",{className:"text-right font-mono",children:n.inputTokens.toLocaleString()}),l.jsx("span",{children:"输出 tokens"}),l.jsx("span",{className:"text-right font-mono",children:n.outputTokens.toLocaleString()})]})]}):l.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:"暂无数据"})}),l.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:[o.has("usage")?l.jsx(G,{className:"h-3.5 w-3.5 text-muted-foreground"}):l.jsx(T,{className:"h-3.5 w-3.5 text-muted-foreground"}),l.jsx("span",{className:"text-sm font-medium",children:"用量"}),l.jsx("button",{onClick:e=>{e.stopPropagation(),(async()=>{h(!0);try{const{refreshUsage:e}=await S(async()=>{const{refreshUsage:e}=await import("./index-BIaRBMD3.js").then(e=>e.bI);return{refreshUsage:e}},__vite__mapDeps([1,2]));u(await e(t))}catch{}finally{h(!1)}})()},className:"ml-auto text-muted-foreground active:text-foreground",children:l.jsx(c,{className:i("h-3 w-3",m&&"animate-spin")})})]}),o.has("usage")&&l.jsx("div",{className:"px-4 py-3 border-b border-border/50",children:x?l.jsxs("div",{className:"space-y-2",children:[x.planName&&l.jsxs("div",{className:"text-[11px] text-muted-foreground",children:["Plan: ",l.jsx("span",{className:"font-medium text-foreground",children:x.planName})]}),l.jsx(fe,{label:"5h",bucket:x.fiveHour}),l.jsx(fe,{label:"7d",bucket:x.sevenDay}),x.sevenDaySonnet&&l.jsx(fe,{label:"7d Sonnet",bucket:x.sevenDaySonnet}),x.sevenDayOpus&&l.jsx(fe,{label:"7d Opus",bucket:x.sevenDayOpus}),!x.fiveHour&&!x.sevenDay&&l.jsx("div",{className:"text-xs text-muted-foreground/50 text-center",children:"暂无数据"})]}):l.jsx("div",{className:"text-xs text-muted-foreground/50 text-center py-2",children:m?"加载中...":"暂无数据"})}),l.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:[o.has("files")?l.jsx(G,{className:"h-3.5 w-3.5 text-muted-foreground"}):l.jsx(T,{className:"h-3.5 w-3.5 text-muted-foreground"}),l.jsx("span",{className:"text-sm font-medium",children:"文件"})]}),o.has("files")&&l.jsx("div",{className:"h-[60vh]",children:l.jsx(ue,{rootPath:s,onClose:()=>p("files")})})]})]})}function fe({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 l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-xs text-muted-foreground w-16",children:e}),l.jsx("div",{className:"flex-1 h-1.5 bg-secondary rounded-full overflow-hidden",children:l.jsx("div",{className:i("h-full rounded-full",he(s)),style:{width:`${Math.min(s,100)}%`}})}),l.jsxs("span",{className:i("text-xs font-mono w-8 text-right",me(s)),children:[s,"%"]}),a&&l.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:a})]})}function ge(){a.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]=a.useState({screen:"list"}),[n,r]=a.useState(null),o=s(e=>e.projects),c=a.useCallback(e=>{t({screen:"chat",projectId:e}),r(null)},[]),i=a.useCallback(e=>{t({screen:"panel",projectId:e})},[]),d=a.useCallback(()=>{t(e=>"panel"===e.screen?{screen:"chat",projectId:e.projectId}:{screen:"list"})},[]),x="list"!==e.screen?o.find(t=>t.id===e.projectId):void 0;return l.jsxs("div",{className:"fixed inset-0 bg-background overflow-hidden",children:[l.jsxs(A,{mode:"wait",children:["list"===e.screen&&l.jsx($.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:l.jsx(ee,{onSelectProject:c})},"list"),"chat"===e.screen&&x&&l.jsx($.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:l.jsx(te,{project:x,onBack:d,onOpenPanel:()=>i(e.projectId),onContextUpdate:r})},`chat-${e.projectId}`)]}),l.jsx(A,{children:"panel"===e.screen&&x&&l.jsx($.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:l.jsx(pe,{projectName:x.name,cliTool:x.cliTool??"claude",folderPath:x.folderPath,contextData:n,onClose:d})},"panel")})]})}export{ge as MobilePage};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-z4qRGojt.js","assets/index-BFWZX3Hz.js","assets/index-D0NB3R9q.css","assets/jszip.min-CPG_u-b-.js"])))=>i.map(i=>d[i]);
2
- import{j as e,r as t,_ as s,g as r,f as a}from"./index-BFWZX3Hz.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-z4qRGojt.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-CPG_u-b-.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-lg 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-CPwWf4Su.js","assets/index-BIaRBMD3.js","assets/index-DCiTw3F5.css","assets/jszip.min-OAmm8lsw.js"])))=>i.map(i=>d[i]);
2
+ import{j as e,r as t,_ as s,g as r,f as a}from"./index-BIaRBMD3.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-CPwWf4Su.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-OAmm8lsw.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-lg 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};