@tom2012/cc-web 1.5.47 → 1.5.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/backend/dist/backup/engine.d.ts +1 -1
- package/backend/dist/backup/engine.d.ts.map +1 -1
- package/backend/dist/backup/engine.js +8 -4
- package/backend/dist/backup/engine.js.map +1 -1
- package/backend/dist/hooks-manager.d.ts.map +1 -1
- package/backend/dist/hooks-manager.js +8 -1
- package/backend/dist/hooks-manager.js.map +1 -1
- package/backend/dist/index.d.ts.map +1 -1
- package/backend/dist/index.js +17 -0
- package/backend/dist/index.js.map +1 -1
- package/backend/dist/notify-service.d.ts +13 -0
- package/backend/dist/notify-service.d.ts.map +1 -0
- package/backend/dist/notify-service.js +84 -0
- package/backend/dist/notify-service.js.map +1 -0
- package/backend/dist/routes/auth.d.ts.map +1 -1
- package/backend/dist/routes/auth.js +5 -2
- package/backend/dist/routes/auth.js.map +1 -1
- package/backend/dist/routes/filesystem.d.ts.map +1 -1
- package/backend/dist/routes/filesystem.js +27 -6
- package/backend/dist/routes/filesystem.js.map +1 -1
- package/backend/dist/routes/git.d.ts +3 -0
- package/backend/dist/routes/git.d.ts.map +1 -0
- package/backend/dist/routes/git.js +122 -0
- package/backend/dist/routes/git.js.map +1 -0
- package/backend/dist/routes/hooks.d.ts.map +1 -1
- package/backend/dist/routes/hooks.js +7 -0
- package/backend/dist/routes/hooks.js.map +1 -1
- package/backend/dist/routes/notify.d.ts +3 -0
- package/backend/dist/routes/notify.d.ts.map +1 -0
- package/backend/dist/routes/notify.js +27 -0
- package/backend/dist/routes/notify.js.map +1 -0
- package/backend/dist/routes/projects.d.ts.map +1 -1
- package/backend/dist/routes/projects.js +191 -2
- package/backend/dist/routes/projects.js.map +1 -1
- package/backend/dist/routes/share.d.ts +3 -0
- package/backend/dist/routes/share.d.ts.map +1 -0
- package/backend/dist/routes/share.js +152 -0
- package/backend/dist/routes/share.js.map +1 -0
- package/backend/dist/session-manager.d.ts.map +1 -1
- package/backend/dist/session-manager.js +14 -1
- package/backend/dist/session-manager.js.map +1 -1
- package/backend/dist/terminal-manager.d.ts.map +1 -1
- package/backend/dist/terminal-manager.js +2 -0
- package/backend/dist/terminal-manager.js.map +1 -1
- package/backend/dist/types.d.ts +1 -0
- package/backend/dist/types.d.ts.map +1 -1
- package/backend/package-lock.json +305 -228
- package/backend/package.json +1 -0
- package/frontend/dist/assets/{ChatView-D80LmqFy.js → ChatView-BGrHsMR9.js} +2 -2
- package/frontend/dist/assets/{GraphPreview-CjUPLOtN.js → GraphPreview-CB0_XO4r.js} +2 -2
- package/frontend/dist/assets/{OfficePreview-D2Gwj-Np.js → OfficePreview-1-i1sz5k.js} +3 -3
- package/frontend/dist/assets/{ProjectPage-DtMa7zK0.js → ProjectPage-Cur4elk1.js} +93 -60
- package/frontend/dist/assets/SettingsPage-DnAH9VWu.js +36 -0
- package/frontend/dist/assets/ShareViewPage-CcquAbhh.js +1 -0
- package/frontend/dist/assets/{SkillHubPage-BgWsoDTI.js → SkillHubPage-CoM63_GP.js} +2 -7
- package/frontend/dist/assets/bot-Bhot_xL1.js +6 -0
- package/frontend/dist/assets/{chevron-down-BhPFq7WP.js → chevron-down-BLLGZF4Q.js} +1 -1
- package/frontend/dist/assets/download-dn65Yic6.js +6 -0
- package/frontend/dist/assets/index-B13xy6Pb.css +1 -0
- package/frontend/dist/assets/index-Dc8u1vU0.js +275 -0
- package/frontend/dist/assets/{index-C6QFUMjX.js → index-DnsaxfE4.js} +1 -1
- package/frontend/dist/assets/{jszip.min-C6GvSTLx.js → jszip.min-CzfLNkw8.js} +1 -1
- package/frontend/dist/assets/{select-NwCEYkGO.js → select-Bvlmfn-y.js} +8 -3
- package/frontend/dist/assets/user-CljKCZZO.js +6 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/SettingsPage-BStIrE1x.js +0 -36
- package/frontend/dist/assets/index-CePE4wZl.js +0 -270
- package/frontend/dist/assets/index-y_u3eOve.css +0 -1
- package/frontend/dist/assets/user-DVocDDux.js +0 -11
package/backend/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as x,r as o,j as e,o as d,e as p,C as g,A as j}from"./index-
|
|
1
|
+
import{c as x,r as o,j as e,o as d,e as p,C as g,A as j}from"./index-Dc8u1vU0.js";import{M as k,r as b,B as w}from"./ProjectPage-Cur4elk1.js";import"./select-Bvlmfn-y.js";import"./chevron-down-BLLGZF4Q.js";import"./download-dn65Yic6.js";import"./bot-Bhot_xL1.js";import"./user-CljKCZZO.js";/**
|
|
2
2
|
* @license lucide-react v0.309.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -13,4 +13,4 @@ import{c as x,r as o,j as e,o as d,e as p,C as g,A as j}from"./index-CePE4wZl.js
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const M=x("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);function u({icon:s,label:r,content:n}){const[a,i]=o.useState(!1);return e.jsxs("div",{className:"border border-border rounded mt-1.5",children:[e.jsxs("button",{className:"flex items-center gap-1.5 w-full px-2.5 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(l=>!l),children:[e.jsx(g,{className:p("h-3 w-3 transition-transform",a&&"rotate-90")}),e.jsx(s,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate",children:r})]}),e.jsx(j,{children:a&&e.jsx(d.pre,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"px-3 pb-2 text-xs text-muted-foreground whitespace-pre-wrap break-words max-h-40 overflow-auto",children:n})})]})}function C({blocks:s}){return e.jsx(e.Fragment,{children:s.map((r,n)=>r.type==="text"?e.jsx("div",{className:"prose dark:prose-invert prose-sm max-w-none",children:e.jsx(k,{remarkPlugins:[b],children:r.content})},n):r.type==="thinking"?e.jsx(u,{icon:w,label:"Thinking...",content:r.content},n):r.type==="tool_use"?e.jsx(u,{icon:M,label:r.content.split("(")[0],content:r.content},n):r.type==="tool_result"?e.jsx(u,{icon:v,label:"Result",content:r.content},n):null)})}function
|
|
16
|
+
*/const M=x("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);function u({icon:s,label:r,content:n}){const[a,i]=o.useState(!1);return e.jsxs("div",{className:"border border-border rounded mt-1.5",children:[e.jsxs("button",{className:"flex items-center gap-1.5 w-full px-2.5 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(l=>!l),children:[e.jsx(g,{className:p("h-3 w-3 transition-transform",a&&"rotate-90")}),e.jsx(s,{className:"h-3 w-3"}),e.jsx("span",{className:"truncate",children:r})]}),e.jsx(j,{children:a&&e.jsx(d.pre,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"px-3 pb-2 text-xs text-muted-foreground whitespace-pre-wrap break-words max-h-40 overflow-auto",children:n})})]})}function C({blocks:s}){return e.jsx(e.Fragment,{children:s.map((r,n)=>r.type==="text"?e.jsx("div",{className:"prose dark:prose-invert prose-sm max-w-none",children:e.jsx(k,{remarkPlugins:[b],children:r.content})},n):r.type==="thinking"?e.jsx(u,{icon:w,label:"Thinking...",content:r.content},n):r.type==="tool_use"?e.jsx(u,{icon:M,label:r.content.split("(")[0],content:r.content},n):r.type==="tool_result"?e.jsx(u,{icon:v,label:"Result",content:r.content},n):null)})}function z({messages:s,onSend:r,readOnly:n}){const[a,i]=o.useState(""),l=o.useRef(null),c=o.useRef(null);o.useEffect(()=>{var t;(t=l.current)==null||t.scrollIntoView({behavior:"smooth"})},[s.length]);const h=()=>{const t=a.trim();t&&(r(t+"\r"),i(""),c.current&&(c.current.style.height="auto"))},m=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),h())},f=t=>{t.style.height="auto",t.style.height=Math.min(t.scrollHeight,120)+"px"};return e.jsxs("div",{className:"flex flex-col h-full bg-background",children:[e.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 min-h-0",children:[s.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"等待对话..."}),s.map((t,y)=>e.jsx(d.div,{initial:{opacity:0,y:10,x:t.role==="user"?12:-12},animate:{opacity:1,y:0,x:0},transition:{duration:.25,ease:"easeOut"},className:p("flex",t.role==="user"?"justify-end":"justify-start"),children:e.jsxs("div",{className:p("max-w-[85%] rounded-lg px-3 py-2 text-sm",t.role==="user"?"bg-blue-100 text-blue-900 dark:bg-blue-600 dark:text-white":"bg-muted"),children:[e.jsx(C,{blocks:t.blocks}),e.jsx("div",{className:"text-[10px] opacity-50 mt-1",children:new Date(t.timestamp).toLocaleTimeString()})]})},`${t.timestamp}-${t.role}-${y}`)),e.jsx("div",{ref:l})]}),!n&&e.jsxs("div",{className:"border-t border-border p-3 flex gap-2 items-end flex-shrink-0",children:[e.jsx("textarea",{ref:c,value:a,onChange:t=>{i(t.target.value),f(t.target)},onKeyDown:m,placeholder:"输入消息...",rows:1,className:"flex-1 resize-none bg-muted rounded-md px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring",style:{maxHeight:"120px"}}),e.jsx(d.button,{onClick:h,disabled:!a.trim(),whileTap:{scale:.93},className:"p-2 rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex-shrink-0",children:e.jsx(N,{className:"h-4 w-4"})})]})]})}export{z as ChatView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as je,r as C,d as De,j as y,K as q,l as he}from"./index-
|
|
1
|
+
import{c as je,r as C,d as De,j as y,K as q,l as he}from"./index-Dc8u1vU0.js";import{L as Ye,Z as Pe,a as Be}from"./ProjectPage-Cur4elk1.js";import"./select-Bvlmfn-y.js";import"./chevron-down-BLLGZF4Q.js";import"./download-dn65Yic6.js";import"./bot-Bhot_xL1.js";import"./user-CljKCZZO.js";/**
|
|
2
2
|
* @license lucide-react v0.309.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -19,4 +19,4 @@ import{c as je,r as C,d as De,j as y,K as q,l as he}from"./index-CePE4wZl.js";im
|
|
|
19
19
|
`,t+1)):t===0?c&&(e.result+=" "):e.result+=_.repeat(`
|
|
20
20
|
`,t):e.result+=_.repeat(`
|
|
21
21
|
`,c?1+t:t),c=!0,l=!0,t=0,i=e.position;!T(f)&&f!==0;)f=e.input.charCodeAt(++e.position);j(e,i,e.position,!1)}return!0}function Ae(e,n){var i,o=e.tag,r=e.anchor,c=[],l,u=!1,t;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=c),t=e.input.charCodeAt(e.position);t!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,a(e,"tab characters must not be used in indentation")),!(t!==45||(l=e.input.charCodeAt(e.position+1),!N(l))));){if(u=!0,e.position++,w(e,!0,-1)&&e.lineIndent<=n){c.push(null),t=e.input.charCodeAt(e.position);continue}if(i=e.line,U(e,n,Ee,!1,!0),c.push(e.result),w(e,!0,-1),t=e.input.charCodeAt(e.position),(e.line===i||e.lineIndent>n)&&t!==0)a(e,"bad indentation of a sequence entry");else if(e.lineIndent<n)break}return u?(e.tag=o,e.anchor=r,e.kind="sequence",e.result=c,!0):!1}function Ai(e,n,i){var o,r,c,l,u,t,p=e.tag,m=e.anchor,f={},A=Object.create(null),s=null,g=null,b=null,v=!1,h=!1,d;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=f),d=e.input.charCodeAt(e.position);d!==0;){if(!v&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,a(e,"tab characters must not be used in indentation")),o=e.input.charCodeAt(e.position+1),c=e.line,(d===63||d===58)&&N(o))d===63?(v&&(W(e,f,A,s,g,null,l,u,t),s=g=b=null),h=!0,v=!0,r=!0):v?(v=!1,r=!0):a(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,d=o;else{if(l=e.line,u=e.lineStart,t=e.position,!U(e,i,Ne,!1,!0))break;if(e.line===c){for(d=e.input.charCodeAt(e.position);B(d);)d=e.input.charCodeAt(++e.position);if(d===58)d=e.input.charCodeAt(++e.position),N(d)||a(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(W(e,f,A,s,g,null,l,u,t),s=g=b=null),h=!0,v=!1,r=!1,s=e.tag,g=e.result;else if(h)a(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=p,e.anchor=m,!0}else if(h)a(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=p,e.anchor=m,!0}if((e.line===c||e.lineIndent>n)&&(v&&(l=e.line,u=e.lineStart,t=e.position),U(e,n,Q,!0,r)&&(v?g=e.result:b=e.result),v||(W(e,f,A,s,g,b,l,u,t),s=g=b=null),w(e,!0,-1),d=e.input.charCodeAt(e.position)),(e.line===c||e.lineIndent>n)&&d!==0)a(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return v&&W(e,f,A,s,g,null,l,u,t),h&&(e.tag=p,e.anchor=m,e.kind="mapping",e.result=f),h}function bi(e){var n,i=!1,o=!1,r,c,l;if(l=e.input.charCodeAt(e.position),l!==33)return!1;if(e.tag!==null&&a(e,"duplication of a tag property"),l=e.input.charCodeAt(++e.position),l===60?(i=!0,l=e.input.charCodeAt(++e.position)):l===33?(o=!0,r="!!",l=e.input.charCodeAt(++e.position)):r="!",n=e.position,i){do l=e.input.charCodeAt(++e.position);while(l!==0&&l!==62);e.position<e.length?(c=e.input.slice(n,e.position),l=e.input.charCodeAt(++e.position)):a(e,"unexpected end of the stream within a verbatim tag")}else{for(;l!==0&&!N(l);)l===33&&(o?a(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(n-1,e.position+1),Ie.test(r)||a(e,"named tag handle cannot contain such characters"),o=!0,n=e.position+1)),l=e.input.charCodeAt(++e.position);c=e.input.slice(n,e.position),fi.test(c)&&a(e,"tag suffix cannot contain flow indicator characters")}c&&!Te.test(c)&&a(e,"tag name cannot contain such characters: "+c);try{c=decodeURIComponent(c)}catch{a(e,"tag name is malformed: "+c)}return i?e.tag=c:D.call(e.tagMap,r)?e.tag=e.tagMap[r]+c:r==="!"?e.tag="!"+c:r==="!!"?e.tag="tag:yaml.org,2002:"+c:a(e,'undeclared tag handle "'+r+'"'),!0}function wi(e){var n,i;if(i=e.input.charCodeAt(e.position),i!==38)return!1;for(e.anchor!==null&&a(e,"duplication of an anchor property"),i=e.input.charCodeAt(++e.position),n=e.position;i!==0&&!N(i)&&!$(i);)i=e.input.charCodeAt(++e.position);return e.position===n&&a(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(n,e.position),!0}function Ci(e){var n,i,o;if(o=e.input.charCodeAt(e.position),o!==42)return!1;for(o=e.input.charCodeAt(++e.position),n=e.position;o!==0&&!N(o)&&!$(o);)o=e.input.charCodeAt(++e.position);return e.position===n&&a(e,"name of an alias node must contain at least one character"),i=e.input.slice(n,e.position),D.call(e.anchorMap,i)||a(e,'unidentified alias "'+i+'"'),e.result=e.anchorMap[i],w(e,!0,-1),!0}function U(e,n,i,o,r){var c,l,u,t=1,p=!1,m=!1,f,A,s,g,b,v;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,c=l=u=Q===i||Ee===i,o&&w(e,!0,-1)&&(p=!0,e.lineIndent>n?t=1:e.lineIndent===n?t=0:e.lineIndent<n&&(t=-1)),t===1)for(;bi(e)||wi(e);)w(e,!0,-1)?(p=!0,u=c,e.lineIndent>n?t=1:e.lineIndent===n?t=0:e.lineIndent<n&&(t=-1)):u=!1;if(u&&(u=p||r),(t===1||Q===i)&&(V===i||Ne===i?b=n:b=n+1,v=e.position-e.lineStart,t===1?u&&(Ae(e,v)||Ai(e,v,b))||vi(e,b)?m=!0:(l&&yi(e,b)||xi(e,b)||gi(e,b)?m=!0:Ci(e)?(m=!0,(e.tag!==null||e.anchor!==null)&&a(e,"alias node should not have any properties")):mi(e,b,V===i)&&(m=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):t===0&&(m=u&&Ae(e,v))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&a(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),f=0,A=e.implicitTypes.length;f<A;f+=1)if(g=e.implicitTypes[f],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(D.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else for(g=null,s=e.typeMap.multi[e.kind||"fallback"],f=0,A=s.length;f<A;f+=1)if(e.tag.slice(0,s[f].tag.length)===s[f].tag){g=s[f];break}g||a(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&a(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):a(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||m}function ki(e){var n=e.position,i,o,r,c=!1,l;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(l=e.input.charCodeAt(e.position))!==0&&(w(e,!0,-1),l=e.input.charCodeAt(e.position),!(e.lineIndent>0||l!==37));){for(c=!0,l=e.input.charCodeAt(++e.position),i=e.position;l!==0&&!N(l);)l=e.input.charCodeAt(++e.position);for(o=e.input.slice(i,e.position),r=[],o.length<1&&a(e,"directive name must not be less than one character in length");l!==0;){for(;B(l);)l=e.input.charCodeAt(++e.position);if(l===35){do l=e.input.charCodeAt(++e.position);while(l!==0&&!T(l));break}if(T(l))break;for(i=e.position;l!==0&&!N(l);)l=e.input.charCodeAt(++e.position);r.push(e.input.slice(i,e.position))}l!==0&&ue(e),D.call(ve,o)?ve[o](e,o,r):J(e,'unknown document directive "'+o+'"')}if(w(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,w(e,!0,-1)):c&&a(e,"directives end mark is expected"),U(e,e.lineIndent-1,Q,!1,!0),w(e,!0,-1),e.checkLineBreaks&&ti.test(e.input.slice(n,e.position))&&J(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&ee(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,w(e,!0,-1));return}if(e.position<e.length-1)a(e,"end of the stream or a document separator is expected");else return}function _i(e,n){e=String(e),n=n||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
22
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var i=new di(e,n),o=e.indexOf("\0");for(o!==-1&&(i.position=o,a(i,"null byte is not allowed in input")),i.input+="\0";i.input.charCodeAt(i.position)===32;)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)ki(i);return i.documents}function Si(e,n){var i=_i(e,n);if(i.length!==0){if(i.length===1)return i[0];throw new F("expected a single document in the stream, but found more")}}var Ni=Si,Ei={load:Ni},Ii=Ei.load;function be(e){var v;const n=e.pages||[],i=e.relations||[];if(n.length===0)return{nodes:[],edges:[]};const o=new Map,r=new Map;for(const h of n)o.set(h.id,[]),r.set(h.id,0);for(const h of i)(v=o.get(h.from))==null||v.push(h.to),r.set(h.to,(r.get(h.to)||0)+1);const c=new Map,l=[];for(const h of n)(r.get(h.id)||0)===0&&(l.push(h.id),c.set(h.id,0));let u=0;for(;l.length>0;){const h=l.shift(),d=c.get(h)||0;for(const O of o.get(h)||[]){const M=d+1;M>(c.get(O)||0)&&(c.set(O,M),M>u&&(u=M));const L=(r.get(O)||1)-1;r.set(O,L),L<=0&&l.push(O)}}for(const h of n)c.has(h.id)||c.set(h.id,u+1);const t=new Map;for(const h of n){const d=c.get(h.id)||0;t.has(d)||t.set(d,[]),t.get(d).push(h.id)}const p=160,m=50,f=60,A=80,s=[],g=new Map(n.map(h=>[h.id,h]));for(const[h,d]of t){const M=-(d.length*p+(d.length-1)*f)/2;d.forEach((L,K)=>{const Y=g.get(L);s.push({id:L,title:(Y==null?void 0:Y.title)||L,x:M+K*(p+f)+p/2,y:h*(m+A),layer:h})})}const b=i.map(h=>({from:h.from,to:h.to,label:h.label}));return{nodes:s,edges:b}}const we=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#f97316","#6366f1"];function
|
|
22
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var i=new di(e,n),o=e.indexOf("\0");for(o!==-1&&(i.position=o,a(i,"null byte is not allowed in input")),i.input+="\0";i.input.charCodeAt(i.position)===32;)i.lineIndent+=1,i.position+=1;for(;i.position<i.length-1;)ki(i);return i.documents}function Si(e,n){var i=_i(e,n);if(i.length!==0){if(i.length===1)return i[0];throw new F("expected a single document in the stream, but found more")}}var Ni=Si,Ei={load:Ni},Ii=Ei.load;function be(e){var v;const n=e.pages||[],i=e.relations||[];if(n.length===0)return{nodes:[],edges:[]};const o=new Map,r=new Map;for(const h of n)o.set(h.id,[]),r.set(h.id,0);for(const h of i)(v=o.get(h.from))==null||v.push(h.to),r.set(h.to,(r.get(h.to)||0)+1);const c=new Map,l=[];for(const h of n)(r.get(h.id)||0)===0&&(l.push(h.id),c.set(h.id,0));let u=0;for(;l.length>0;){const h=l.shift(),d=c.get(h)||0;for(const O of o.get(h)||[]){const M=d+1;M>(c.get(O)||0)&&(c.set(O,M),M>u&&(u=M));const L=(r.get(O)||1)-1;r.set(O,L),L<=0&&l.push(O)}}for(const h of n)c.has(h.id)||c.set(h.id,u+1);const t=new Map;for(const h of n){const d=c.get(h.id)||0;t.has(d)||t.set(d,[]),t.get(d).push(h.id)}const p=160,m=50,f=60,A=80,s=[],g=new Map(n.map(h=>[h.id,h]));for(const[h,d]of t){const M=-(d.length*p+(d.length-1)*f)/2;d.forEach((L,K)=>{const Y=g.get(L);s.push({id:L,title:(Y==null?void 0:Y.title)||L,x:M+K*(p+f)+p/2,y:h*(m+A),layer:h})})}const b=i.map(h=>({from:h.from,to:h.to,label:h.label}));return{nodes:s,edges:b}}const we=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#f97316","#6366f1"];function Yi({folderPath:e}){const[n,i]=C.useState(null),[o,r]=C.useState(!0),[c,l]=C.useState(null),[u,t]=C.useState(1),[p,m]=C.useState({x:0,y:0}),[f,A]=C.useState(!1),[s,g]=C.useState({x:0,y:0}),b=C.useRef(null),v=C.useRef(null),h=`${e}/.notebook/graph.yaml`,d=C.useCallback(async()=>{r(!0),l(null);try{const x=await De(h);if(!x.content){l("graph.yaml is empty"),i(null);return}const I=Ii(x.content);i(I),t(1),m({x:0,y:0})}catch{l("Cannot read .notebook/graph.yaml"),i(null)}finally{r(!1)}},[h]);C.useEffect(()=>{d()},[d]);const O=C.useCallback(x=>{x.preventDefault();const I=x.deltaY>0?-.1:.1;t(S=>Math.max(.2,Math.min(3,S+I)))},[]),M=C.useCallback(x=>{x.button===0&&(A(!0),g({x:x.clientX-p.x,y:x.clientY-p.y}))},[p]),L=C.useCallback(x=>{f&&m({x:x.clientX-s.x,y:x.clientY-s.y})},[f,s]),K=C.useCallback(()=>{A(!1)},[]),Y=C.useCallback(()=>{if(!n||!v.current)return;const{nodes:x}=be(n);if(x.length===0)return;const I=Math.min(...x.map(P=>P.x))-100,S=Math.max(...x.map(P=>P.x))+100,E=Math.min(...x.map(P=>P.y))-40,G=Math.max(...x.map(P=>P.y))+60,Z=S-I,H=G-E,pe=v.current.clientWidth,se=v.current.clientHeight,ne=Math.min(pe/Z,se/H,1.5)*.9;t(ne),m({x:pe/2-(I+S)/2*ne,y:se/2-(E+G)/2*ne})},[n]),{nodes:X,edges:fe}=C.useMemo(()=>n?be(n):{nodes:[],edges:[]},[n]),ae=C.useMemo(()=>new Map(X.map(x=>[x.id,x])),[X]);return C.useEffect(()=>{n&&!o&&setTimeout(Y,50)},[n,o,Y]),o?y.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:y.jsx(Ye,{className:"h-5 w-5 animate-spin"})}):c||!n?y.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-muted-foreground text-sm px-4 text-center",children:[y.jsx("p",{children:c||"No graph data"}),y.jsxs(q,{variant:"ghost",size:"sm",onClick:()=>void d(),children:[y.jsx(he,{className:"h-3 w-3 mr-1"})," Retry"]})]}):y.jsxs("div",{className:"flex flex-col h-full",children:[y.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 border-b shrink-0",children:[y.jsxs("span",{className:"text-xs text-muted-foreground mr-auto",children:[X.length," pages, ",fe.length," relations"]}),y.jsx(q,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>t(x=>Math.min(3,x+.2)),children:y.jsx(Pe,{className:"h-3 w-3"})}),y.jsx(q,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>t(x=>Math.max(.2,x-.2)),children:y.jsx(Be,{className:"h-3 w-3"})}),y.jsx(q,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Y,children:y.jsx(Re,{className:"h-3 w-3"})}),y.jsx(q,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>void d(),children:y.jsx(he,{className:"h-3 w-3"})})]}),y.jsx("div",{ref:v,className:"flex-1 overflow-hidden cursor-grab active:cursor-grabbing bg-muted/30",onWheel:O,onMouseDown:M,onMouseMove:L,onMouseUp:K,onMouseLeave:K,children:y.jsxs("svg",{ref:b,width:"100%",height:"100%",style:{userSelect:"none"},children:[y.jsx("defs",{children:y.jsx("marker",{id:"arrowhead",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"8",markerHeight:"6",orient:"auto",children:y.jsx("polygon",{points:"0 0, 10 3.5, 0 7",className:"fill-muted-foreground/60"})})}),y.jsxs("g",{transform:`translate(${p.x}, ${p.y}) scale(${u})`,children:[fe.map((x,I)=>{const S=ae.get(x.from),E=ae.get(x.to);if(!S||!E)return null;const G=S.y+20,Z=E.y-20,H=(G+Z)/2;return y.jsxs("g",{children:[y.jsx("path",{d:`M ${S.x} ${G} C ${S.x} ${H}, ${E.x} ${H}, ${E.x} ${Z}`,fill:"none",className:"stroke-muted-foreground/40",strokeWidth:1.5,markerEnd:"url(#arrowhead)"}),x.label&&y.jsx("text",{x:(S.x+E.x)/2,y:H-4,textAnchor:"middle",className:"fill-muted-foreground/60",fontSize:9,children:x.label})]},`edge-${I}`)}),X.map(x=>{const I=we[x.layer%we.length],S=140,E=36;return y.jsxs("g",{transform:`translate(${x.x-S/2}, ${x.y-E/2})`,children:[y.jsx("rect",{width:S,height:E,rx:8,fill:I,fillOpacity:.15,stroke:I,strokeWidth:1.5}),y.jsx("text",{x:S/2,y:E/2+1,textAnchor:"middle",dominantBaseline:"middle",className:"fill-foreground",fontSize:11,fontWeight:500,children:x.title.length>14?x.title.slice(0,13)+"…":x.title})]},x.id)})]})]})})]})}export{Yi as GraphPreview};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{j as e,r as c,_ as m,b as y,h as S}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DnsaxfE4.js","assets/index-Dc8u1vU0.js","assets/index-B13xy6Pb.css","assets/jszip.min-CzfLNkw8.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as e,r as c,_ as m,b as y,h as S}from"./index-Dc8u1vU0.js";async function h(a){let l=S(a);const s=y();s&&(l+=`${l.includes("?")?"&":"?"}token=${encodeURIComponent(s)}`);const d=await fetch(l);if(!d.ok)throw new Error(`Failed to fetch file: ${d.status}`);return d.arrayBuffer()}function j({filePath:a,zoom:l}){const[s,d]=c.useState(""),[x,n]=c.useState(null),[u,i]=c.useState(!0);return c.useEffect(()=>{let t=!1;return i(!0),n(null),(async()=>{try{const r=await m(()=>import("./index-DnsaxfE4.js").then(f=>f.i),__vite__mapDeps([0,1,2,3])),o=await h(a),p=await r.convertToHtml({arrayBuffer:o});t||d(p.value)}catch(r){t||n(r instanceof Error?r.message:"Failed to render docx")}finally{t||i(!1)}})(),()=>{t=!0}},[a]),u?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):x?e.jsx("p",{className:"text-sm text-destructive p-4",children:x}):e.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:`${12*l/100}px`},dangerouslySetInnerHTML:{__html:s}})}function _({filePath:a,zoom:l}){var o;const[s,d]=c.useState([]),[x,n]=c.useState(0),[u,i]=c.useState(null),[t,r]=c.useState(!0);return c.useEffect(()=>{let p=!1;return r(!0),i(null),(async()=>{try{const f=await m(()=>import("./xlsx-D_0l8YDs.js"),[]),v=await h(a),g=f.read(v,{type:"array"}),b=g.SheetNames.map(w=>({name:w,html:f.utils.sheet_to_html(g.Sheets[w],{editable:!1})}));p||(d(b),n(0))}catch(f){p||i(f instanceof Error?f.message:"Failed to render xlsx")}finally{p||r(!1)}})(),()=>{p=!0}},[a]),t?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}):s.length===0?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsxs("div",{className:"flex flex-col h-full",children:[s.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:s.map((p,f)=>e.jsx("button",{onClick:()=>n(f),className:`px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap ${f===x?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"}`,children:p.name},f))}),e.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:`${12*l/100}px`},dangerouslySetInnerHTML:{__html:((o=s[x])==null?void 0:o.html)??""}}),e.jsx("style",{children:`
|
|
3
3
|
.xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }
|
|
4
4
|
.xlsx-preview td, .xlsx-preview th {
|
|
5
5
|
border: 1px solid hsl(var(--border));
|
|
@@ -10,4 +10,4 @@ import{j as e,r as c,_ as m,b as y,h as S}from"./index-CePE4wZl.js";async functi
|
|
|
10
10
|
}
|
|
11
11
|
.xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }
|
|
12
12
|
.xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }
|
|
13
|
-
`})]})}async function E(a){const{default:l}=await m(async()=>{const{default:n}=await import("./jszip.min-
|
|
13
|
+
`})]})}async function E(a){const{default:l}=await m(async()=>{const{default:n}=await import("./jszip.min-CzfLNkw8.js").then(u=>u.j);return{default:n}},__vite__mapDeps([3,1,2])),s=await l.loadAsync(a),d=[],x=Object.keys(s.files).filter(n=>/^ppt\/slides\/slide\d+\.xml$/i.test(n)).sort((n,u)=>{var r,o;const i=parseInt(((r=n.match(/slide(\d+)/))==null?void 0:r[1])??"0"),t=parseInt(((o=u.match(/slide(\d+)/))==null?void 0:o[1])??"0");return i-t});for(let n=0;n<x.length;n++){const u=await s.file(x[n]).async("text"),i=[],t=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let r;for(;(r=t.exec(u))!==null;){const o=r[1].replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').trim();o&&i.push(o)}d.push({index:n+1,texts:i})}return d}function N({filePath:a,zoom:l}){const[s,d]=c.useState([]),[x,n]=c.useState(null),[u,i]=c.useState(!0);return c.useEffect(()=>{let t=!1;return i(!0),n(null),(async()=>{try{const r=await h(a),o=await E(r);t||d(o)}catch(r){t||n(r instanceof Error?r.message:"Failed to render pptx")}finally{t||i(!1)}})(),()=>{t=!0}},[a]),u?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):x?e.jsx("p",{className:"text-sm text-destructive p-4",children:x}):s.length===0?e.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):e.jsx("div",{className:"p-4 space-y-4",style:{fontSize:`${12*l/100}px`},children:s.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((r,o)=>e.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:r},o))}):e.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},t.index))})}const I=new Set(["docx","xlsx","xls","pptx"]);function L({filePath:a,ext:l,zoom:s}){return l==="docx"?e.jsx(j,{filePath:a,zoom:s}):l==="xlsx"||l==="xls"?e.jsx(_,{filePath:a,zoom:s}):l==="pptx"?e.jsx(N,{filePath:a,zoom:s}):null}export{I as OFFICE_EXTS,L as OfficePreview};
|