@tom2012/cc-web 2026.4.20-b → 2026.4.20-d

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 (32) hide show
  1. package/README.md +1 -1
  2. package/backend/dist/index.d.ts.map +1 -1
  3. package/backend/dist/index.js +2 -6
  4. package/backend/dist/index.js.map +1 -1
  5. package/backend/dist/routes/filesystem.d.ts.map +1 -1
  6. package/backend/dist/routes/filesystem.js +0 -1
  7. package/backend/dist/routes/filesystem.js.map +1 -1
  8. package/backend/dist/routes/user-prefs.d.ts +11 -0
  9. package/backend/dist/routes/user-prefs.d.ts.map +1 -0
  10. package/backend/dist/routes/user-prefs.js +43 -0
  11. package/backend/dist/routes/user-prefs.js.map +1 -0
  12. package/frontend/dist/assets/AssistantMessageContent-BhfKqZ7C.js +13 -0
  13. package/frontend/dist/assets/{GraphPreview-Ch_3lozG.js → GraphPreview-BzH3Wak5.js} +1 -1
  14. package/frontend/dist/assets/{MobilePage-BUyBZIGk.js → MobilePage-BQRuj2Cs.js} +4 -4
  15. package/frontend/dist/assets/{OfficePreview-DvPUEwFE.js → OfficePreview-B-VYapp6.js} +2 -2
  16. package/frontend/dist/assets/{ProjectPage-DEXix3V3.js → ProjectPage-CsiEfciU.js} +5 -5
  17. package/frontend/dist/assets/SettingsPage-oMXzGZc9.js +13 -0
  18. package/frontend/dist/assets/{SkillHubPage-Cqip4-le.js → SkillHubPage-Bl50eKHR.js} +3 -3
  19. package/frontend/dist/assets/{chevron-down-B7gSUQDO.js → chevron-down-WeK3LuVf.js} +1 -1
  20. package/frontend/dist/assets/{chevron-up-CzlZZUvo.js → chevron-up-CJDXUdmI.js} +1 -1
  21. package/frontend/dist/assets/index-BrqN6Jet.js +75 -0
  22. package/frontend/dist/assets/index-Bu3s8sE1.js +1 -0
  23. package/frontend/dist/assets/{index-CXWm66yF.js → index-c0ovO67g.js} +1 -1
  24. package/frontend/dist/assets/{index-C_UILLvR.css → index-vHzDarwZ.css} +1 -1
  25. package/frontend/dist/assets/{jszip.min-CQA8ZeOj.js → jszip.min-BwsPvdp_.js} +1 -1
  26. package/frontend/dist/assets/{search-BqD4Nj-c.js → search-0gpkXlAu.js} +1 -1
  27. package/frontend/dist/index.html +2 -2
  28. package/package.json +1 -1
  29. package/frontend/dist/assets/AssistantMessageContent-CDu_OO0W.js +0 -13
  30. package/frontend/dist/assets/SettingsPage-BD5u0Nov.js +0 -13
  31. package/frontend/dist/assets/index-C0RwSVk6.js +0 -75
  32. package/frontend/dist/assets/index-CWOuXpJO.js +0 -13
@@ -1,13 +0,0 @@
1
- import{c as e,r as s,U as t,aW as a,j as n,W as r,V as l,N as o,d as i,K as c,aX as d,aJ as u,Q as h,aY as x,L as m,Y as p,$ as f,a0 as v,a1 as g,a2 as j,x as y,aZ as b,aa as w,ab as N,ac as k,ad as S,ae as C,B as R,af as _,I as P,ag as T,a_ as E,a$ as I,b0 as D,b1 as M,b2 as O,az as A,b3 as H,l as L,T as V,b4 as z,t as F,aC as W,D as B,b5 as $,b6 as K,b7 as U,u as q,b8 as G,b9 as Z,ba as X,ax as Q,bb as Y,bc as J,h as ee,S as se,bd as te,ay as ae,be as ne,y as re,A as le,p as oe,X as ie,s as ce,bf as de,bg as ue,bh as he,bi as xe,bj as me,bk as pe,bl as fe,bm as ve}from"./index-C0RwSVk6.js";import{k as ge,u as je,R as ye,d as be,f as we,A as Ne,C as ke,j as Se,h as Ce,S as Re,U as _e,T as Pe,a as Te,b as Ee,i as Ie,c as De}from"./index-CWOuXpJO.js";import{C as Me}from"./chevron-down-B7gSUQDO.js";import{C as Oe,a as Ae}from"./chevron-up-CzlZZUvo.js";
2
- /**
3
- * @license lucide-react v0.309.0 - ISC
4
- *
5
- * This source code is licensed under the ISC license.
6
- * See the LICENSE file in the root directory of this source tree.
7
- */const He=e("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]),Le=e("AlertTriangle",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"c3ski4"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),Ve=e("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]),ze=e("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]),Fe=e("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]),We=e("ExternalLink",[["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}],["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["line",{x1:"10",x2:"21",y1:"14",y2:"3",key:"18c3s4"}]]),Be=e("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),$e=e("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]),Ke=e("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]),Ue=e("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]),qe=e("XCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);
8
- /**
9
- * @license lucide-react v0.309.0 - ISC
10
- *
11
- * This source code is licensed under the ISC license.
12
- * See the LICENSE file in the root directory of this source tree.
13
- */function Ge(e){const t=s.useRef({value:e,previous:e});return s.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Ze="Switch",[Xe]=o(Ze),[Qe,Ye]=Xe(Ze),Je=s.forwardRef((e,o)=>{const{__scopeSwitch:i,name:c,checked:d,defaultChecked:u,required:h,disabled:x,value:m="on",onCheckedChange:p,form:f,...v}=e,[g,j]=s.useState(null),y=t(o,e=>j(e)),b=s.useRef(!1),w=!g||(f||!!g.closest("form")),[N,k]=a({prop:d,defaultProp:u??!1,onChange:p,caller:Ze});return n.jsxs(Qe,{scope:i,checked:N,disabled:x,children:[n.jsx(r.button,{type:"button",role:"switch","aria-checked":N,"aria-required":h,"data-state":as(N),"data-disabled":x?"":void 0,disabled:x,value:m,...v,ref:y,onClick:l(e.onClick,e=>{k(e=>!e),w&&(b.current=e.isPropagationStopped(),b.current||e.stopPropagation())})}),w&&n.jsx(ts,{control:g,bubbles:!b.current,name:c,value:m,checked:N,required:h,disabled:x,form:f,style:{transform:"translateX(-100%)"}})]})});Je.displayName=Ze;var es="SwitchThumb",ss=s.forwardRef((e,s)=>{const{__scopeSwitch:t,...a}=e,l=Ye(es,t);return n.jsx(r.span,{"data-state":as(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:s})});ss.displayName=es;var ts=s.forwardRef(({__scopeSwitch:e,control:a,checked:r,bubbles:l=!0,...o},i)=>{const c=s.useRef(null),d=t(c,i),u=Ge(r),h=ge(a);return s.useEffect(()=>{const e=c.current;if(!e)return;const s=window.HTMLInputElement.prototype,t=Object.getOwnPropertyDescriptor(s,"checked").set;if(u!==r&&t){const s=new Event("click",{bubbles:l});t.call(e,r),e.dispatchEvent(s)}},[u,r,l]),n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...o,tabIndex:-1,ref:d,style:{...o.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function as(e){return e?"checked":"unchecked"}ts.displayName="SwitchBubbleInput";var ns=Je,rs=ss;const ls=s.forwardRef(({className:e,...s},t)=>n.jsx(ns,{className:i("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...s,ref:t,children:n.jsx(rs,{className:i("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));function os(e){const t=is(e),a=s.forwardRef((e,a)=>{const{children:r,...l}=e,o=s.Children.toArray(r),i=o.find(ds);if(i){const e=i.props.children,r=o.map(t=>t===i?s.Children.count(e)>1?s.Children.only(null):s.isValidElement(e)?e.props.children:null:t);return n.jsx(t,{...l,ref:a,children:s.isValidElement(e)?s.cloneElement(e,void 0,r):null})}return n.jsx(t,{...l,ref:a,children:r})});return a.displayName=`${e}.Slot`,a}function is(e){const t=s.forwardRef((e,t)=>{const{children:a,...n}=e;if(s.isValidElement(a)){const e=function(e){var s,t;let a=null==(s=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:s.get,n=a&&"isReactWarning"in a&&a.isReactWarning;if(n)return e.ref;if(a=null==(t=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n)return e.props.ref;return e.props.ref||e.ref}(a),r=function(e,s){const t={...s};for(const a in s){const n=e[a],r=s[a];/^on[A-Z]/.test(a)?n&&r?t[a]=(...e)=>{const s=r(...e);return n(...e),s}:n&&(t[a]=n):"style"===a?t[a]={...n,...r}:"className"===a&&(t[a]=[n,r].filter(Boolean).join(" "))}return{...e,...t}}(n,a.props);return a.type!==s.Fragment&&(r.ref=t?c(t,e):e),s.cloneElement(a,r)}return s.Children.count(a)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}ls.displayName=ns.displayName;var cs=Symbol("radix.slottable");function ds(e){return s.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===cs}var us=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"});s.forwardRef((e,s)=>n.jsx(r.span,{...e,ref:s,style:{...us,...e.style}})).displayName="VisuallyHidden";var hs=[" ","Enter","ArrowUp","ArrowDown"],xs=[" ","Enter"],ms="Select",[ps,fs,vs]=we(ms),[gs]=o(ms,[vs,be]),js=be(),[ys,bs]=gs(ms),[ws,Ns]=gs(ms),ks=e=>{const{__scopeSelect:t,children:r,open:l,defaultOpen:o,onOpenChange:i,value:c,defaultValue:u,onValueChange:h,dir:x,name:m,autoComplete:p,disabled:f,required:v,form:g}=e,j=js(t),[y,b]=s.useState(null),[w,N]=s.useState(null),[k,S]=s.useState(!1),C=je(x),[R,_]=a({prop:l,defaultProp:o??!1,onChange:i,caller:ms}),[P,T]=a({prop:c,defaultProp:u,onChange:h,caller:ms}),E=s.useRef(null),I=!y||(g||!!y.closest("form")),[D,M]=s.useState(new Set),O=Array.from(D).map(e=>e.props.value).join(";");return n.jsx(ye,{...j,children:n.jsxs(ys,{required:v,scope:t,trigger:y,onTriggerChange:b,valueNode:w,onValueNodeChange:N,valueNodeHasChildren:k,onValueNodeHasChildrenChange:S,contentId:d(),value:P,onValueChange:T,open:R,onOpenChange:_,dir:C,triggerPointerDownPosRef:E,disabled:f,children:[n.jsx(ps.Provider,{scope:t,children:n.jsx(ws,{scope:e.__scopeSelect,onNativeOptionAdd:s.useCallback(e=>{M(s=>new Set(s).add(e))},[]),onNativeOptionRemove:s.useCallback(e=>{M(s=>{const t=new Set(s);return t.delete(e),t})},[]),children:r})}),I?n.jsxs(dt,{"aria-hidden":!0,required:v,tabIndex:-1,name:m,autoComplete:p,value:P,onChange:e=>T(e.target.value),disabled:f,form:g,children:[void 0===P?n.jsx("option",{value:""}):null,Array.from(D)]},O):null]})})};ks.displayName=ms;var Ss="SelectTrigger",Cs=s.forwardRef((e,a)=>{const{__scopeSelect:o,disabled:i=!1,...c}=e,d=js(o),u=bs(Ss,o),h=u.disabled||i,x=t(a,u.onTriggerChange),m=fs(o),p=s.useRef("touch"),[f,v,g]=ht(e=>{const s=m().filter(e=>!e.disabled),t=s.find(e=>e.value===u.value),a=xt(s,e,t);void 0!==a&&u.onValueChange(a.value)}),j=e=>{h||(u.onOpenChange(!0),g()),e&&(u.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return n.jsx(Ne,{asChild:!0,...d,children:n.jsx(r.button,{type:"button",role:"combobox","aria-controls":u.contentId,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:h,"data-disabled":h?"":void 0,"data-placeholder":ut(u.value)?"":void 0,...c,ref:x,onClick:l(c.onClick,e=>{e.currentTarget.focus(),"mouse"!==p.current&&j(e)}),onPointerDown:l(c.onPointerDown,e=>{p.current=e.pointerType;const s=e.target;s.hasPointerCapture(e.pointerId)&&s.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(j(e),e.preventDefault())}),onKeyDown:l(c.onKeyDown,e=>{const s=""!==f.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||v(e.key),s&&" "===e.key||hs.includes(e.key)&&(j(),e.preventDefault())})})})});Cs.displayName=Ss;var Rs="SelectValue",_s=s.forwardRef((e,s)=>{const{__scopeSelect:a,className:l,style:o,children:i,placeholder:c="",...d}=e,h=bs(Rs,a),{onValueNodeHasChildrenChange:x}=h,m=void 0!==i,p=t(s,h.onValueNodeChange);return u(()=>{x(m)},[x,m]),n.jsx(r.span,{...d,ref:p,style:{pointerEvents:"none"},children:ut(h.value)?n.jsx(n.Fragment,{children:c}):i})});_s.displayName=Rs;var Ps=s.forwardRef((e,s)=>{const{__scopeSelect:t,children:a,...l}=e;return n.jsx(r.span,{"aria-hidden":!0,...l,ref:s,children:a||"▼"})});Ps.displayName="SelectIcon";var Ts=e=>n.jsx(h,{asChild:!0,...e});Ts.displayName="SelectPortal";var Es="SelectContent",Is=s.forwardRef((e,t)=>{const a=bs(Es,e.__scopeSelect),[r,l]=s.useState();if(u(()=>{l(new DocumentFragment)},[]),!a.open){const s=r;return s?x.createPortal(n.jsx(Ms,{scope:e.__scopeSelect,children:n.jsx(ps.Slot,{scope:e.__scopeSelect,children:n.jsx("div",{children:e.children})})}),s):null}return n.jsx(Hs,{...e,ref:t})});Is.displayName=Es;var Ds=10,[Ms,Os]=gs(Es),As=os("SelectContent.RemoveScroll"),Hs=s.forwardRef((e,a)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:c,onPointerDownOutside:d,side:u,sideOffset:h,align:x,alignOffset:m,arrowPadding:y,collisionBoundary:b,collisionPadding:w,sticky:N,hideWhenDetached:k,avoidCollisions:S,...C}=e,R=bs(Es,r),[_,P]=s.useState(null),[T,E]=s.useState(null),I=t(a,e=>P(e)),[D,M]=s.useState(null),[O,A]=s.useState(null),H=fs(r),[L,V]=s.useState(!1),z=s.useRef(!1);s.useEffect(()=>{if(_)return p(_)},[_]),f();const F=s.useCallback(e=>{const[s,...t]=H().map(e=>e.ref.current),[a]=t.slice(-1),n=document.activeElement;for(const r of e){if(r===n)return;if(null==r||r.scrollIntoView({block:"nearest"}),r===s&&T&&(T.scrollTop=0),r===a&&T&&(T.scrollTop=T.scrollHeight),null==r||r.focus(),document.activeElement!==n)return}},[H,T]),W=s.useCallback(()=>F([D,_]),[F,D,_]);s.useEffect(()=>{L&&W()},[L,W]);const{onOpenChange:B,triggerPointerDownPosRef:$}=R;s.useEffect(()=>{if(_){let e={x:0,y:0};const s=s=>{var t,a;e={x:Math.abs(Math.round(s.pageX)-((null==(t=$.current)?void 0:t.x)??0)),y:Math.abs(Math.round(s.pageY)-((null==(a=$.current)?void 0:a.y)??0))}},t=t=>{e.x<=10&&e.y<=10?t.preventDefault():_.contains(t.target)||B(!1),document.removeEventListener("pointermove",s),$.current=null};return null!==$.current&&(document.addEventListener("pointermove",s),document.addEventListener("pointerup",t,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",t,{capture:!0})}}},[_,B,$]),s.useEffect(()=>{const e=()=>B(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[B]);const[K,U]=ht(e=>{const s=H().filter(e=>!e.disabled),t=s.find(e=>e.ref.current===document.activeElement),a=xt(s,e,t);a&&setTimeout(()=>a.ref.current.focus())}),q=s.useCallback((e,s,t)=>{const a=!z.current&&!t;(void 0!==R.value&&R.value===s||a)&&(M(e),a&&(z.current=!0))},[R.value]),G=s.useCallback(()=>null==_?void 0:_.focus(),[_]),Z=s.useCallback((e,s,t)=>{const a=!z.current&&!t;(void 0!==R.value&&R.value===s||a)&&A(e)},[R.value]),X="popper"===o?Vs:Ls,Q=X===Vs?{side:u,sideOffset:h,align:x,alignOffset:m,arrowPadding:y,collisionBoundary:b,collisionPadding:w,sticky:N,hideWhenDetached:k,avoidCollisions:S}:{};return n.jsx(Ms,{scope:r,content:_,viewport:T,onViewportChange:E,itemRefCallback:q,selectedItem:D,onItemLeave:G,itemTextRefCallback:Z,focusSelectedItem:W,selectedItemText:O,position:o,isPositioned:L,searchRef:K,children:n.jsx(v,{as:As,allowPinchZoom:!0,children:n.jsx(g,{asChild:!0,trapped:R.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:l(i,e=>{var s;null==(s=R.trigger)||s.focus({preventScroll:!0}),e.preventDefault()}),children:n.jsx(j,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>R.onOpenChange(!1),children:n.jsx(X,{role:"listbox",id:R.contentId,"data-state":R.open?"open":"closed",dir:R.dir,onContextMenu:e=>e.preventDefault(),...C,...Q,onPlaced:()=>V(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...C.style},onKeyDown:l(C.onKeyDown,e=>{const s=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),s||1!==e.key.length||U(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let s=H().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(s=s.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){const t=e.target,a=s.indexOf(t);s=s.slice(a+1)}setTimeout(()=>F(s)),e.preventDefault()}})})})})})})});Hs.displayName="SelectContentImpl";var Ls=s.forwardRef((e,a)=>{const{__scopeSelect:l,onPlaced:o,...i}=e,c=bs(Es,l),d=Os(Es,l),[h,x]=s.useState(null),[m,p]=s.useState(null),f=t(a,e=>p(e)),v=fs(l),g=s.useRef(!1),j=s.useRef(!0),{viewport:y,selectedItem:b,selectedItemText:w,focusSelectedItem:N}=d,k=s.useCallback(()=>{if(c.trigger&&c.valueNode&&h&&m&&y&&b&&w){const e=c.trigger.getBoundingClientRect(),s=m.getBoundingClientRect(),t=c.valueNode.getBoundingClientRect(),a=w.getBoundingClientRect();if("rtl"!==c.dir){const n=a.left-s.left,r=t.left-n,l=e.left-r,o=e.width+l,i=Math.max(o,s.width),c=window.innerWidth-Ds,d=Se(r,[Ds,Math.max(Ds,c-i)]);h.style.minWidth=o+"px",h.style.left=d+"px"}else{const n=s.right-a.right,r=window.innerWidth-t.right-n,l=window.innerWidth-e.right-r,o=e.width+l,i=Math.max(o,s.width),c=window.innerWidth-Ds,d=Se(r,[Ds,Math.max(Ds,c-i)]);h.style.minWidth=o+"px",h.style.right=d+"px"}const n=v(),r=window.innerHeight-2*Ds,l=y.scrollHeight,i=window.getComputedStyle(m),d=parseInt(i.borderTopWidth,10),u=parseInt(i.paddingTop,10),x=parseInt(i.borderBottomWidth,10),p=d+u+l+parseInt(i.paddingBottom,10)+x,f=Math.min(5*b.offsetHeight,p),j=window.getComputedStyle(y),N=parseInt(j.paddingTop,10),k=parseInt(j.paddingBottom,10),S=e.top+e.height/2-Ds,C=r-S,R=b.offsetHeight/2,_=d+u+(b.offsetTop+R),P=p-_;if(_<=S){const e=n.length>0&&b===n[n.length-1].ref.current;h.style.bottom="0px";const s=m.clientHeight-y.offsetTop-y.offsetHeight,t=_+Math.max(C,R+(e?k:0)+s+x);h.style.height=t+"px"}else{const e=n.length>0&&b===n[0].ref.current;h.style.top="0px";const s=Math.max(S,d+y.offsetTop+(e?N:0)+R)+P;h.style.height=s+"px",y.scrollTop=_-S+y.offsetTop}h.style.margin=`${Ds}px 0`,h.style.minHeight=f+"px",h.style.maxHeight=r+"px",null==o||o(),requestAnimationFrame(()=>g.current=!0)}},[v,c.trigger,c.valueNode,h,m,y,b,w,c.dir,o]);u(()=>k(),[k]);const[S,C]=s.useState();u(()=>{m&&C(window.getComputedStyle(m).zIndex)},[m]);const R=s.useCallback(e=>{e&&!0===j.current&&(k(),null==N||N(),j.current=!1)},[k,N]);return n.jsx(zs,{scope:l,contentWrapper:h,shouldExpandOnScrollRef:g,onScrollButtonChange:R,children:n.jsx("div",{ref:x,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:n.jsx(r.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Ls.displayName="SelectItemAlignedPosition";var Vs=s.forwardRef((e,s)=>{const{__scopeSelect:t,align:a="start",collisionPadding:r=Ds,...l}=e,o=js(t);return n.jsx(ke,{...o,...l,ref:s,align:a,collisionPadding:r,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Vs.displayName="SelectPopperPosition";var[zs,Fs]=gs(Es,{}),Ws="SelectViewport",Bs=s.forwardRef((e,a)=>{const{__scopeSelect:o,nonce:i,...c}=e,d=Os(Ws,o),u=Fs(Ws,o),h=t(a,d.onViewportChange),x=s.useRef(0);return n.jsxs(n.Fragment,{children:[n.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),n.jsx(ps.Slot,{scope:o,children:n.jsx(r.div,{"data-radix-select-viewport":"",role:"presentation",...c,ref:h,style:{position:"relative",flex:1,overflow:"hidden auto",...c.style},onScroll:l(c.onScroll,e=>{const s=e.currentTarget,{contentWrapper:t,shouldExpandOnScrollRef:a}=u;if((null==a?void 0:a.current)&&t){const e=Math.abs(x.current-s.scrollTop);if(e>0){const a=window.innerHeight-2*Ds,n=parseFloat(t.style.minHeight),r=parseFloat(t.style.height),l=Math.max(n,r);if(l<a){const n=l+e,r=Math.min(a,n),o=n-r;t.style.height=r+"px","0px"===t.style.bottom&&(s.scrollTop=o>0?o:0,t.style.justifyContent="flex-end")}}}x.current=s.scrollTop})})})]})});Bs.displayName=Ws;var $s="SelectGroup",[Ks,Us]=gs($s);s.forwardRef((e,s)=>{const{__scopeSelect:t,...a}=e,l=d();return n.jsx(Ks,{scope:t,id:l,children:n.jsx(r.div,{role:"group","aria-labelledby":l,...a,ref:s})})}).displayName=$s;var qs="SelectLabel",Gs=s.forwardRef((e,s)=>{const{__scopeSelect:t,...a}=e,l=Us(qs,t);return n.jsx(r.div,{id:l.id,...a,ref:s})});Gs.displayName=qs;var Zs="SelectItem",[Xs,Qs]=gs(Zs),Ys=s.forwardRef((e,a)=>{const{__scopeSelect:o,value:i,disabled:c=!1,textValue:u,...h}=e,x=bs(Zs,o),m=Os(Zs,o),p=x.value===i,[f,v]=s.useState(u??""),[g,j]=s.useState(!1),y=t(a,e=>{var s;return null==(s=m.itemRefCallback)?void 0:s.call(m,e,i,c)}),b=d(),w=s.useRef("touch"),N=()=>{c||(x.onValueChange(i),x.onOpenChange(!1))};if(""===i)throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return n.jsx(Xs,{scope:o,value:i,disabled:c,textId:b,isSelected:p,onItemTextChange:s.useCallback(e=>{v(s=>s||((null==e?void 0:e.textContent)??"").trim())},[]),children:n.jsx(ps.ItemSlot,{scope:o,value:i,disabled:c,textValue:f,children:n.jsx(r.div,{role:"option","aria-labelledby":b,"data-highlighted":g?"":void 0,"aria-selected":p&&g,"data-state":p?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...h,ref:y,onFocus:l(h.onFocus,()=>j(!0)),onBlur:l(h.onBlur,()=>j(!1)),onClick:l(h.onClick,()=>{"mouse"!==w.current&&N()}),onPointerUp:l(h.onPointerUp,()=>{"mouse"===w.current&&N()}),onPointerDown:l(h.onPointerDown,e=>{w.current=e.pointerType}),onPointerMove:l(h.onPointerMove,e=>{var s;w.current=e.pointerType,c?null==(s=m.onItemLeave)||s.call(m):"mouse"===w.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:l(h.onPointerLeave,e=>{var s;e.currentTarget===document.activeElement&&(null==(s=m.onItemLeave)||s.call(m))}),onKeyDown:l(h.onKeyDown,e=>{var s;""!==(null==(s=m.searchRef)?void 0:s.current)&&" "===e.key||(xs.includes(e.key)&&N()," "===e.key&&e.preventDefault())})})})})});Ys.displayName=Zs;var Js="SelectItemText",et=s.forwardRef((e,a)=>{const{__scopeSelect:l,className:o,style:i,...c}=e,d=bs(Js,l),h=Os(Js,l),m=Qs(Js,l),p=Ns(Js,l),[f,v]=s.useState(null),g=t(a,e=>v(e),m.onItemTextChange,e=>{var s;return null==(s=h.itemTextRefCallback)?void 0:s.call(h,e,m.value,m.disabled)}),j=null==f?void 0:f.textContent,y=s.useMemo(()=>n.jsx("option",{value:m.value,disabled:m.disabled,children:j},m.value),[m.disabled,m.value,j]),{onNativeOptionAdd:b,onNativeOptionRemove:w}=p;return u(()=>(b(y),()=>w(y)),[b,w,y]),n.jsxs(n.Fragment,{children:[n.jsx(r.span,{id:m.textId,...c,ref:g}),m.isSelected&&d.valueNode&&!d.valueNodeHasChildren?x.createPortal(c.children,d.valueNode):null]})});et.displayName=Js;var st="SelectItemIndicator",tt=s.forwardRef((e,s)=>{const{__scopeSelect:t,...a}=e;return Qs(st,t).isSelected?n.jsx(r.span,{"aria-hidden":!0,...a,ref:s}):null});tt.displayName=st;var at="SelectScrollUpButton",nt=s.forwardRef((e,a)=>{const r=Os(at,e.__scopeSelect),l=Fs(at,e.__scopeSelect),[o,i]=s.useState(!1),c=t(a,l.onScrollButtonChange);return u(()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=s.scrollTop>0;i(e)};const s=r.viewport;return e(),s.addEventListener("scroll",e),()=>s.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),o?n.jsx(ot,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:s}=r;e&&s&&(e.scrollTop=e.scrollTop-s.offsetHeight)}}):null});nt.displayName=at;var rt="SelectScrollDownButton",lt=s.forwardRef((e,a)=>{const r=Os(rt,e.__scopeSelect),l=Fs(rt,e.__scopeSelect),[o,i]=s.useState(!1),c=t(a,l.onScrollButtonChange);return u(()=>{if(r.viewport&&r.isPositioned){let e=function(){const e=s.scrollHeight-s.clientHeight,t=Math.ceil(s.scrollTop)<e;i(t)};const s=r.viewport;return e(),s.addEventListener("scroll",e),()=>s.removeEventListener("scroll",e)}},[r.viewport,r.isPositioned]),o?n.jsx(ot,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:s}=r;e&&s&&(e.scrollTop=e.scrollTop+s.offsetHeight)}}):null});lt.displayName=rt;var ot=s.forwardRef((e,t)=>{const{__scopeSelect:a,onAutoScroll:o,...i}=e,c=Os("SelectScrollButton",a),d=s.useRef(null),h=fs(a),x=s.useCallback(()=>{null!==d.current&&(window.clearInterval(d.current),d.current=null)},[]);return s.useEffect(()=>()=>x(),[x]),u(()=>{var e;const s=h().find(e=>e.ref.current===document.activeElement);null==(e=null==s?void 0:s.ref.current)||e.scrollIntoView({block:"nearest"})},[h]),n.jsx(r.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:l(i.onPointerDown,()=>{null===d.current&&(d.current=window.setInterval(o,50))}),onPointerMove:l(i.onPointerMove,()=>{var e;null==(e=c.onItemLeave)||e.call(c),null===d.current&&(d.current=window.setInterval(o,50))}),onPointerLeave:l(i.onPointerLeave,()=>{x()})})}),it=s.forwardRef((e,s)=>{const{__scopeSelect:t,...a}=e;return n.jsx(r.div,{"aria-hidden":!0,...a,ref:s})});it.displayName="SelectSeparator";var ct="SelectArrow";s.forwardRef((e,s)=>{const{__scopeSelect:t,...a}=e,r=js(t),l=bs(ct,t),o=Os(ct,t);return l.open&&"popper"===o.position?n.jsx(Ce,{...r,...a,ref:s}):null}).displayName=ct;var dt=s.forwardRef(({__scopeSelect:e,value:a,...l},o)=>{const i=s.useRef(null),c=t(o,i),d=Ge(a);return s.useEffect(()=>{const e=i.current;if(!e)return;const s=window.HTMLSelectElement.prototype,t=Object.getOwnPropertyDescriptor(s,"value").set;if(d!==a&&t){const s=new Event("change",{bubbles:!0});t.call(e,a),e.dispatchEvent(s)}},[d,a]),n.jsx(r.select,{...l,style:{...us,...l.style},ref:c,defaultValue:a})});function ut(e){return""===e||void 0===e}function ht(e){const t=m(e),a=s.useRef(""),n=s.useRef(0),r=s.useCallback(e=>{const s=a.current+e;t(s),function e(s){a.current=s,window.clearTimeout(n.current),""!==s&&(n.current=window.setTimeout(()=>e(""),1e3))}(s)},[t]),l=s.useCallback(()=>{a.current="",window.clearTimeout(n.current)},[]);return s.useEffect(()=>()=>window.clearTimeout(n.current),[]),[a,r,l]}function xt(e,s,t){const a=s.length>1&&Array.from(s).every(e=>e===s[0])?s[0]:s,n=t?e.indexOf(t):-1;let r=(l=e,o=Math.max(n,0),l.map((e,s)=>l[(o+s)%l.length]));var l,o;1===a.length&&(r=r.filter(e=>e!==t));const i=r.find(e=>e.textValue.toLowerCase().startsWith(a.toLowerCase()));return i!==t?i:void 0}dt.displayName="SelectBubbleInput";var mt=Cs,pt=Ps,ft=Ts,vt=Is,gt=Bs,jt=Gs,yt=Ys,bt=et,wt=tt,Nt=nt,kt=lt,St=it;const Ct=ks,Rt=_s,_t=s.forwardRef(({className:e,children:s,...t},a)=>n.jsxs(mt,{ref:a,className:i("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...t,children:[s,n.jsx(pt,{asChild:!0,children:n.jsx(Me,{className:"h-4 w-4 opacity-50"})})]}));_t.displayName=mt.displayName;const Pt=s.forwardRef(({className:e,...s},t)=>n.jsx(Nt,{ref:t,className:i("flex cursor-default items-center justify-center py-1",e),...s,children:n.jsx(Oe,{className:"h-4 w-4"})}));Pt.displayName=Nt.displayName;const Tt=s.forwardRef(({className:e,...s},t)=>n.jsx(kt,{ref:t,className:i("flex cursor-default items-center justify-center py-1",e),...s,children:n.jsx(Me,{className:"h-4 w-4"})}));Tt.displayName=kt.displayName;const Et=s.forwardRef(({className:e,children:s,position:t="popper",...a},r)=>n.jsx(ft,{children:n.jsxs(vt,{ref:r,className:i("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===t&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:t,...a,children:[n.jsx(Pt,{}),n.jsx(gt,{className:i("p-1","popper"===t&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),n.jsx(Tt,{})]})}));Et.displayName=vt.displayName;s.forwardRef(({className:e,...s},t)=>n.jsx(jt,{ref:t,className:i("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...s})).displayName=jt.displayName;const It=s.forwardRef(({className:e,children:s,...t},a)=>n.jsxs(yt,{ref:a,className:i("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...t,children:[n.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n.jsx(wt,{children:n.jsx(y,{className:"h-4 w-4"})})}),n.jsx(bt,{children:s})]}));It.displayName=yt.displayName;s.forwardRef(({className:e,...s},t)=>n.jsx(St,{ref:t,className:i("-mx-1 my-1 h-px bg-muted",e),...s})).displayName=St.displayName;const Dt={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function Mt({open:e,onOpenChange:t,onAdded:a}){const[r,l]=s.useState([]),[o,i]=s.useState(!1),[c,d]=s.useState(null),[u,h]=s.useState(""),[x,m]=s.useState(""),[p,f]=s.useState(""),[v,g]=s.useState(""),[j,y]=s.useState(!1),[D,M]=s.useState(null);s.useEffect(()=>{e&&b().then(e=>l(e.available)).catch(()=>l([]))},[e]);const O=()=>{i(!1),d(null),h(""),m(""),f(""),g(""),y(!1),M(null)},A=r.length>0;return n.jsx(w,{open:e,onOpenChange:e=>{t(e),e||O()},children:n.jsxs(N,{className:"sm:max-w-md",children:[n.jsxs(k,{children:[n.jsxs(S,{className:"flex items-center gap-2",children:[n.jsx(Fe,{className:"h-5 w-5"}),"添加云盘账号"]}),n.jsx(C,{children:o?"手动填写 OAuth 凭据连接云盘":"选择云盘类型,点击后跳转登录授权"})]}),o?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"space-y-4 py-2",children:[n.jsxs("div",{className:"space-y-2",children:[n.jsx(_,{children:"云盘类型"}),n.jsxs(Ct,{value:u,onValueChange:h,children:[n.jsx(_t,{children:n.jsx(Rt,{placeholder:"选择云盘类型"})}),n.jsxs(Et,{children:[n.jsx(It,{value:"google-drive",children:"Google Drive"}),n.jsx(It,{value:"onedrive",children:"OneDrive"}),n.jsx(It,{value:"dropbox",children:"Dropbox"})]})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(_,{children:"显示名称"}),n.jsx(P,{placeholder:"例如:我的 Google Drive",value:x,onChange:e=>m(e.target.value)})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(_,{children:"Client ID"}),n.jsx(P,{placeholder:"OAuth Client ID",value:p,onChange:e=>f(e.target.value)})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(_,{children:"Client Secret"}),n.jsx(P,{type:"password",placeholder:"OAuth Client Secret",value:v,onChange:e=>g(e.target.value)})]}),D&&n.jsx("p",{className:"text-sm text-destructive",children:D})]}),n.jsxs(T,{children:[n.jsx(R,{variant:"outline",onClick:()=>{i(!1),M(null)},children:"返回"}),n.jsx(R,{onClick:async()=>{if(u&&x&&p&&v){y(!0),M(null);try{const{id:e}=await E({type:u,label:x,clientId:p,clientSecret:v}),{url:s}=await I(e);window.open(s,"_blank"),O(),t(!1),a()}catch(e){M(e instanceof Error?e.message:"添加失败")}finally{y(!1)}}else M("请填写所有字段")},disabled:j,children:j?"添加中...":"添加并授权"})]})]}):n.jsxs("div",{className:"space-y-3 py-2",children:[A?n.jsx(n.Fragment,{children:r.map(e=>n.jsx(R,{variant:"outline",className:"w-full justify-start gap-3 h-12 text-base",onClick:()=>{(async e=>{d(e),M(null);try{const{id:s}=await E({type:e,label:Dt[e]||e}),{url:n}=await I(s);window.open(n,"_blank"),O(),t(!1),a()}catch(s){M(s instanceof Error?s.message:"添加失败"),d(null)}})(e)},disabled:null!==c,children:c===e?"连接中...":`连接 ${Dt[e]||e}`},e))}):n.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"暂无内置 OAuth 凭据,请使用手动模式添加"}),D&&n.jsx("p",{className:"text-sm text-destructive",children:D}),n.jsx("div",{className:"pt-2 border-t border-border",children:n.jsxs("button",{onClick:()=>{i(!0),M(null)},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[n.jsx(Ue,{className:"h-3.5 w-3.5"}),"手动填写 OAuth 凭据"]})})]})]})})}const Ot={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function At({type:e}){switch(e){case"google-drive":return n.jsx($e,{className:"h-5 w-5 text-blue-500"});case"onedrive":return n.jsx(Fe,{className:"h-5 w-5 text-sky-500"});case"dropbox":return n.jsx($e,{className:"h-5 w-5 text-indigo-500"});default:return n.jsx(Fe,{className:"h-5 w-5"})}}function Ht({provider:e,onDelete:t,onReauth:a}){var r;const[l,o]=s.useState(!1),i=s.useRef(null);s.useEffect(()=>()=>{i.current&&clearTimeout(i.current)},[]);return n.jsxs(D,{children:[n.jsx(M,{className:"pb-3",children:n.jsxs("div",{className:"flex items-start justify-between",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(At,{type:e.type}),n.jsxs("div",{children:[n.jsx(O,{className:"text-base",children:e.label}),n.jsx("p",{className:"text-sm text-muted-foreground",children:Ot[e.type]||e.type})]})]}),n.jsx(A,{variant:e.authorized?"default":"destructive",className:e.authorized?"bg-green-600 hover:bg-green-700":"",children:e.authorized?"已授权":"未授权"})]})}),n.jsxs(H,{children:[e.authorized&&(null==(r=e.tokens)?void 0:r.expiry)&&n.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["授权到期:",new Date(e.tokens.expiry).toLocaleDateString("zh-CN")]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(R,{variant:"outline",size:"sm",onClick:()=>a(e.id),children:[n.jsx(L,{className:"h-3.5 w-3.5 mr-1"}),"重新授权"]}),n.jsxs(R,{variant:l?"destructive":"outline",size:"sm",onClick:()=>{l?(t(e.id),o(!1)):(o(!0),i.current=setTimeout(()=>o(!1),3e3))},children:[n.jsx(V,{className:"h-3.5 w-3.5 mr-1"}),l?"确认删除?":"删除"]})]})]})]})}const Lt={success:{label:"成功",icon:Ae,className:"bg-green-600 hover:bg-green-700"},failed:{label:"失败",icon:qe,className:"bg-red-600 hover:bg-red-700"},partial:{label:"部分完成",icon:Le,className:"bg-yellow-600 hover:bg-yellow-700"}};function Vt(e,s){const t=new Date(s).getTime()-new Date(e).getTime();if(t<1e3)return`${t}ms`;const a=Math.floor(t/1e3);if(a<60)return`${a}秒`;return`${Math.floor(a/60)}分${a%60}秒`}function zt({history:e}){const s=e.slice(0,20);return 0===s.length?n.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[n.jsx(ze,{className:"h-10 w-10 mb-3 opacity-50"}),n.jsx("p",{className:"text-sm",children:"暂无备份记录"})]}):n.jsx("div",{className:"overflow-x-auto",children:n.jsxs("table",{className:"w-full text-sm",children:[n.jsx("thead",{children:n.jsxs("tr",{className:"border-b",children:[n.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"时间"}),n.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"项目"}),n.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"云盘"}),n.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"状态"}),n.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"文件数"}),n.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"耗时"})]})}),n.jsx("tbody",{children:s.map(e=>{const s=Lt[e.status],t=s.icon;return n.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/50",children:[n.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:(a=e.startTime,new Date(a).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}))}),n.jsx("td",{className:"py-2.5 px-2",children:e.projectName}),n.jsx("td",{className:"py-2.5 px-2",children:e.providerLabel}),n.jsxs("td",{className:"py-2.5 px-2",children:[n.jsxs(A,{className:s.className,children:[n.jsx(t,{className:"h-3 w-3 mr-1"}),s.label]}),e.error&&n.jsx("p",{className:"text-xs text-destructive mt-1",children:e.error})]}),n.jsxs("td",{className:"py-2.5 px-2 whitespace-nowrap",children:[e.filesUploaded,"/",e.filesTotal]}),n.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:Vt(e.startTime,e.endTime)})]},e.id);var a})})]})})}function Ft(){const[e,t]=s.useState(null),[a,r]=s.useState(!0),[l,o]=s.useState(!1),[i,c]=s.useState(!1),[d,u]=s.useState(!1),[h,x]=s.useState(""),[m,p]=s.useState("");s.useEffect(()=>{let e=!1;return z().then(s=>{e||(t(s),p(s.defaultExcludes.join("\n")))}).catch(e=>F.error(`加载同步配置失败: ${e.message}`)).finally(()=>{e||r(!1)}),()=>{e=!0}},[]);const f=(e,s)=>{t(t=>t?{...t,[e]:s}:t)};return a||!e?n.jsx("div",{className:"text-sm text-muted-foreground",children:"加载中…"}):n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:"服务器配置"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(_,{htmlFor:"sync-host",children:"主机 (host)"}),n.jsx(P,{id:"sync-host",value:e.host,onChange:e=>f("host",e.target.value),placeholder:"example.com"})]}),n.jsxs("div",{children:[n.jsx(_,{htmlFor:"sync-port",children:"端口"}),n.jsx(P,{id:"sync-port",type:"number",value:e.port,onChange:e=>f("port",Number(e.target.value)||22)})]}),n.jsxs("div",{children:[n.jsx(_,{htmlFor:"sync-user",children:"用户名"}),n.jsx(P,{id:"sync-user",value:e.user,onChange:e=>f("user",e.target.value),placeholder:"tom"})]}),n.jsxs("div",{children:[n.jsx(_,{htmlFor:"sync-remote",children:"远端根路径"}),n.jsx(P,{id:"sync-remote",value:e.remoteRoot,onChange:e=>f("remoteRoot",e.target.value),placeholder:"/data/projects"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["每个项目会同步到 ",n.jsx("code",{children:"远端路径/项目文件夹"})]})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:"认证"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(_,{children:"方式"}),n.jsxs(Ct,{value:e.authMethod,onValueChange:e=>f("authMethod",e),children:[n.jsx(_t,{children:n.jsx(Rt,{})}),n.jsxs(Et,{children:[n.jsx(It,{value:"key",children:"SSH key"}),n.jsx(It,{value:"password",children:"密码"})]})]})]}),"key"===e.authMethod?n.jsxs("div",{children:[n.jsx(_,{htmlFor:"sync-key",children:"私钥路径"}),n.jsx(P,{id:"sync-key",value:e.keyPath??"",onChange:e=>f("keyPath",e.target.value),placeholder:"~/.ssh/id_rsa"})]}):n.jsxs("div",{children:[n.jsx(_,{htmlFor:"sync-pw",children:"密码"}),n.jsx(P,{id:"sync-pw",type:"password",value:h,onChange:e=>x(e.target.value),placeholder:e.passwordSet?"已设置,留空保持不变":"未设置"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["需要系统安装 ",n.jsx("code",{children:"sshpass"}),"(密码通过 SSHPASS env 传递,不会出现在 argv 里)"]})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:"同步策略"}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(_,{children:"方向"}),n.jsxs(Ct,{value:e.direction,onValueChange:e=>f("direction",e),children:[n.jsx(_t,{children:n.jsx(Rt,{})}),n.jsxs(Et,{children:[n.jsx(It,{value:"push",children:"单向:本地 → 远端(--delete)"}),n.jsx(It,{value:"pull",children:"单向:远端 → 本地"}),n.jsx(It,{value:"bidirectional",children:"双向(先 push 再 pull)"})]})]})]}),n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx(_,{htmlFor:"sync-cron",children:"定时 cron 表达式"}),n.jsx(P,{id:"sync-cron",value:e.schedule.cron,onChange:s=>f("schedule",{...e.schedule,cron:s.target.value}),placeholder:"0 3 * * *"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["5 段:分 时 日 月 周。例:",n.jsx("code",{children:"0 3 * * *"})," 每天 03:00"]})]}),n.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[n.jsx(ls,{checked:e.schedule.enabled,onCheckedChange:s=>f("schedule",{...e.schedule,enabled:s})}),n.jsx("span",{className:"text-xs text-muted-foreground",children:"启用"})]})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:"默认排除(每行一个 glob)"}),n.jsx("textarea",{value:m,onChange:e=>p(e.target.value),rows:6,className:"w-full font-mono text-xs p-2 rounded border border-input bg-background resize-y",placeholder:"node_modules/\n.git/objects/\n*.log"}),n.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["作为 ",n.jsx("code",{children:"rsync --exclude"})," 传入。项目级的额外排除暂通过 API 设置。"]})]}),n.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t",children:[n.jsxs(R,{onClick:()=>{(async()=>{if(e){o(!0);try{const s=m.split("\n").map(e=>e.trim()).filter(Boolean),a={host:e.host,port:e.port,user:e.user,authMethod:e.authMethod,keyPath:e.keyPath,remoteRoot:e.remoteRoot,direction:e.direction,defaultExcludes:s,schedule:e.schedule};h&&"__keep__"!==h&&(a.password=h);const n=await $(a);t(n),p(n.defaultExcludes.join("\n")),x(""),F.success("已保存")}catch(s){F.error(`保存失败: ${s.message}`)}finally{o(!1)}}})()},disabled:l,children:[l?n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Re,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]}),n.jsxs(R,{variant:"outline",onClick:()=>{(async()=>{c(!0);try{const e=await K();e.ok?F.success(e.message||"连接成功"):F.error(e.message||"连接失败")}catch(e){F.error(`测试失败: ${e.message}`)}finally{c(!1)}})()},disabled:i,children:[i?n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Ke,{className:"h-3.5 w-3.5 mr-1.5"}),"测试连接"]}),n.jsx("div",{className:"flex-1"}),n.jsxs(R,{variant:"outline",onClick:()=>{(async()=>{u(!0);try{const e=await U(),s=e.results.filter(e=>e.ok).length,t=e.results.filter(e=>e.skipped).length,a=e.total-s-t;F.success(`同步完成:${s} 成功 / ${t} 跳过 / ${a} 失败`)}catch(e){F.error(`同步失败: ${e.message}`)}finally{u(!1)}})()},disabled:d,title:"按当前方向同步所有项目",children:[d?n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(_e,{className:"h-3.5 w-3.5 mr-1.5"}),"立即同步全部"]})]}),n.jsxs("div",{className:"border-t pt-4 text-xs text-muted-foreground",children:["一次性 push/pull 工具:进入项目内部,点击 header 的 ",n.jsx(_e,{className:"inline h-3 w-3"})," / ",n.jsx(B,{className:"inline h-3 w-3"})," 按钮。 或通过 API 调用 ",n.jsx("code",{children:"POST /api/sync/project/:id"})," with body ",n.jsx("code",{children:'{ "direction": "push" }'}),"。"]})]})}function Wt(){const e=q(),[t,a]=s.useState(null),[r,l]=s.useState(!0),[o,i]=s.useState(""),[c,d]=s.useState(!1);s.useEffect(()=>{let e=!1;return G().then(s=>{e||a(s)}).catch(()=>{e||a({configured:!1,needsReset:!1})}).finally(()=>{e||l(!1)}),()=>{e=!0}},[]);return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-1",children:"CCWeb Hub 直接提交"}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:['配置你的 GitHub PAT 后,在 Quick Prompts / Agent Prompts 卡片右键选择"共享"时可一键直接提交 Issue 到 ',n.jsx("code",{children:"zbc0315/ccweb-hub"}),"。 ccweb 本身不自带 token —— 使用你自己的账号身份提交,归属清晰,互不影响。"]})]}),r?n.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[n.jsx(W,{className:"h-4 w-4 animate-spin"}),"加载中…"]}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"rounded-md border px-3 py-2.5 text-xs flex items-center gap-2",children:(null==t?void 0:t.configured)?n.jsxs(n.Fragment,{children:[n.jsx(Ae,{className:"h-4 w-4 text-green-500 shrink-0"}),n.jsx("span",{children:"已配置 token,可直接提交"}),n.jsx("div",{className:"flex-1"}),n.jsxs(R,{size:"sm",variant:"outline",onClick:()=>{(async()=>{if(await e({title:"清除 Hub Token",description:"清除后将无法直接提交到 ccweb-hub,需要重新配置 token。确认?",destructive:!0,confirmLabel:"清除"}))try{await Z(),a({configured:!1,needsReset:!1}),F.success("已清除")}catch(s){F.error(`清除失败: ${s.message}`)}})()},children:[n.jsx(V,{className:"h-3.5 w-3.5 mr-1"}),"清除"]})]}):(null==t?void 0:t.needsReset)?n.jsxs(n.Fragment,{children:[n.jsx(Le,{className:"h-4 w-4 text-amber-500 shrink-0"}),n.jsx("span",{children:"之前的 token 已失效(服务端密钥可能已轮换),请重新设置"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Le,{className:"h-4 w-4 text-muted-foreground shrink-0"}),n.jsx("span",{children:"尚未配置 token"})]})}),n.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2.5 text-xs space-y-2",children:[n.jsx("div",{className:"font-medium text-foreground",children:"如何获取 token"}),n.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-muted-foreground",children:[n.jsxs("li",{children:["打开"," ",n.jsxs("a",{href:"https://github.com/settings/personal-access-tokens/new",target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 hover:underline inline-flex items-center gap-0.5",children:["GitHub fine-grained PAT",n.jsx(We,{className:"h-3 w-3"})]})," ","创建页"]}),n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:"Repository access"}),':选 "Only select repositories",添加 ',n.jsx("code",{children:"zbc0315/ccweb-hub"})]}),n.jsxs("li",{children:[n.jsx("strong",{className:"text-foreground",children:"Repository permissions → Issues"}),':设置为 "Read and write"']}),n.jsx("li",{children:"其余权限保持默认(全部无访问)"}),n.jsx("li",{children:"生成后复制 token 粘贴到下方"})]})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsxs(_,{htmlFor:"hub-token",className:"text-xs",children:["GitHub Token ",(null==t?void 0:t.configured)&&n.jsx("span",{className:"text-muted-foreground",children:"(填写会覆盖现有 token)"})]}),n.jsx(P,{id:"hub-token",type:"password",placeholder:"github_pat_...",value:o,onChange:e=>i(e.target.value),autoComplete:"off",spellCheck:!1}),n.jsxs("p",{className:"text-xs text-muted-foreground",children:["Token 以 AES-256-GCM 加密存储于 ",n.jsx("code",{children:"~/.ccweb/hub-auth/"}),";per-user 独立,不会被其他用户读到。"]})]}),n.jsx("div",{className:"flex gap-2 pt-2 border-t",children:n.jsxs(R,{onClick:()=>{(async()=>{const e=o.trim();if(e){d(!0);try{const s=await X(e);a(s),i(""),F.success("已保存")}catch(s){F.error(`保存失败: ${s.message}`)}finally{d(!1)}}else F.error("请输入 token")})()},disabled:c||!o.trim(),children:[c?n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Re,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})})]})]})}const Bt=["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp",".venv","__pycache__",".env"],$t=[{value:"30",label:"30分钟"},{value:"60",label:"1小时"},{value:"360",label:"6小时"},{value:"720",label:"12小时"},{value:"1440",label:"24小时"}];function Kt(){const e=Q(),[t]=Y(),a=t.get("tab")||"providers",[r,l]=s.useState([]),[o,i]=s.useState(!0),[c,d]=s.useState(!1),[u,h]=s.useState({enabled:!1,intervalMinutes:60}),[x,m]=s.useState(!0),[p,f]=s.useState([]),[v,g]=s.useState(!0),[j,y]=s.useState(""),[b,w]=s.useState(!1),[N,k]=s.useState(!1),[S,C]=s.useState([]),[T,E]=s.useState(!0),[D,M]=s.useState(()=>J()),[O,A]=s.useState(!1),[H,V]=s.useState({webhookEnabled:!1}),[z,W]=s.useState(""),[B,$]=s.useState(!1),[K,U]=s.useState(()=>ee(se.usageMonitorTool,"claude")),q=async()=>{try{const e=await de();l(e)}catch{}finally{i(!1)}},G=async()=>{try{const e=await xe();C(e)}catch{}finally{E(!1)}};s.useEffect(()=>{q(),(async()=>{try{const e=await ue();h(e)}catch{}finally{m(!1)}})(),(async()=>{try{const e=await he();f(e.length>0?e:Bt)}catch{f(Bt)}finally{g(!1)}})(),G(),te().then(e=>{V(e),W(e.webhookUrl??"")}).catch(()=>{})},[]);const Z=(e,s)=>{const t=parseInt(s,10);isNaN(t)||t<1||(M(s=>({...s,[e]:t})),A(!0))},X=async e=>{try{await me(e),l(s=>s.filter(s=>s.id!==e))}catch{}},ge=async e=>{try{const{url:s}=await I(e);window.open(s,"_blank")}catch{}},je=()=>{const e=j.trim();e&&!p.includes(e)&&(f(s=>[...s,e]),y(""),w(!0))};return n.jsx("div",{className:"min-h-screen bg-background",children:n.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsxs(R,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[n.jsx(ae,{className:"h-4 w-4 mr-1"}),"返回"]}),n.jsx("h1",{className:"text-2xl font-bold",children:"设置"})]}),n.jsxs(Pe,{defaultValue:a,children:[n.jsxs(Te,{className:"mb-4",children:[n.jsxs(Ee,{value:"sync",children:[n.jsx(Ie,{className:"h-3.5 w-3.5 mr-1.5"}),"同步 (rsync)"]}),n.jsxs(Ee,{value:"hub",children:[n.jsx(Be,{className:"h-3.5 w-3.5 mr-1.5"}),"CCWeb Hub"]}),n.jsx(Ee,{value:"providers",children:"云盘账号"}),n.jsx(Ee,{value:"strategy",children:"备份策略"}),n.jsx(Ee,{value:"history",children:"备份记录"}),n.jsxs(Ee,{value:"notifications",children:[n.jsx(Ve,{className:"h-3.5 w-3.5 mr-1.5"}),"通知"]}),n.jsxs(Ee,{value:"pomodoro",children:[n.jsx(ne,{className:"h-3.5 w-3.5 mr-1.5"}),"番茄钟"]}),n.jsxs(Ee,{value:"usage",children:[n.jsx(He,{className:"h-3.5 w-3.5 mr-1.5"}),"用量监控"]})]}),n.jsx(De,{value:"sync",children:n.jsx(Ft,{})}),n.jsx(De,{value:"hub",children:n.jsx(Wt,{})}),n.jsxs(De,{value:"providers",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex justify-end",children:n.jsxs(R,{onClick:()=>d(!0),children:[n.jsx(re,{className:"h-4 w-4 mr-1"}),"添加云盘"]})}),o?n.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):0===r.length?n.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:"暂无云盘账号,点击上方按钮添加"}):n.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:r.map(e=>n.jsx(Ht,{provider:e,onDelete:X,onReauth:ge},e.id))})]}),n.jsx(Mt,{open:c,onOpenChange:d,onAdded:()=>{q()}})]}),n.jsx(De,{value:"strategy",children:n.jsxs("div",{className:"space-y-8",children:[n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-lg font-medium",children:"排除规则"}),n.jsx("p",{className:"text-sm text-muted-foreground",children:"匹配这些模式的文件和目录将不会被备份"}),v?n.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex flex-wrap gap-2",children:n.jsx(le,{children:p.map(e=>n.jsxs(oe.span,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2},className:"inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-sm",children:[e,n.jsx("button",{onClick:()=>(e=>{f(s=>s.filter(s=>s!==e)),w(!0)})(e),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",children:n.jsx(ie,{className:"h-3 w-3"})})]},e))})}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(P,{placeholder:"输入排除模式,例如 *.log",value:j,onChange:e=>y(e.target.value),onKeyDown:e=>{"Enter"===e.key&&je()},className:"max-w-xs"}),n.jsx(R,{variant:"outline",size:"sm",onClick:je,children:"添加"})]}),b&&n.jsxs(R,{onClick:async()=>{k(!0);try{await pe(p),w(!1)}catch{}finally{k(!1)}},disabled:N,children:[n.jsx(Re,{className:"h-4 w-4 mr-1"}),N?"保存中...":"保存"]})]})]}),n.jsxs("div",{className:"space-y-4",children:[n.jsx("h3",{className:"text-lg font-medium",children:"定时备份"}),x?n.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(ls,{checked:u.enabled,onCheckedChange:async e=>{const s=u;h({...u,enabled:e});try{await fe({enabled:e})}catch{h(s)}}}),n.jsx(_,{children:u.enabled?"已开启":"已关闭"})]}),n.jsxs("div",{className:"space-y-2",children:[n.jsx(_,{children:"备份间隔"}),n.jsxs(Ct,{value:String(u.intervalMinutes),onValueChange:async e=>{const s=parseInt(e,10),t=u;h({...u,intervalMinutes:s});try{await fe({intervalMinutes:s})}catch{h(t)}},children:[n.jsx(_t,{className:"w-48",children:n.jsx(Rt,{})}),n.jsx(Et,{children:$t.map(e=>n.jsx(It,{value:e.value,children:e.label},e.value))})]})]})]})]})]})}),n.jsx(De,{value:"history",children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex justify-end",children:n.jsxs(R,{variant:"outline",size:"sm",onClick:()=>{E(!0),G()},children:[n.jsx(L,{className:"h-4 w-4 mr-1"}),"刷新"]})}),T?n.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):n.jsx(zt,{history:S})]})}),n.jsx(De,{value:"notifications",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:"浏览器通知"}),n.jsx("p",{className:"text-xs text-muted-foreground",children:"当 Claude 完成任务时,浏览器将自动弹出通知。首次打开 Dashboard 时会请求通知权限。"})]}),n.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-3",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:"Webhook 通知"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Claude 完成任务时向指定 URL 发送 POST 请求(JSON: event, projectId, projectName, timestamp)"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{className:"text-xs",children:"Webhook URL"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(P,{placeholder:"https://hooks.slack.com/...",value:z,onChange:e=>W(e.target.value),className:"font-mono text-xs"}),n.jsx(R,{size:"sm",onClick:()=>{(async()=>{$(!0);try{const e=await ve({webhookEnabled:z.trim().length>0,webhookUrl:z.trim()||void 0});V(e),F.success("Webhook 配置已保存")}catch{F.error("保存失败")}finally{$(!1)}})()},disabled:B,children:B?"保存中…":"保存"})]}),H.webhookEnabled&&H.webhookUrl&&n.jsxs("p",{className:"text-xs text-green-500",children:["已启用 → ",H.webhookUrl]})]})]})]})}),n.jsx(De,{value:"pomodoro",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:"番茄钟时间设置"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"修改后重新启动番茄钟生效"})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-6 max-w-xs",children:[n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{className:"text-xs",children:"工作时长(分钟)"}),n.jsx(P,{type:"number",min:1,max:120,value:D.workMinutes,onChange:e=>Z("workMinutes",e.target.value),className:"w-full"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(_,{className:"text-xs",children:"休息时长(分钟)"}),n.jsx(P,{type:"number",min:1,max:60,value:D.breakMinutes,onChange:e=>Z("breakMinutes",e.target.value),className:"w-full"})]})]}),O&&n.jsxs(R,{size:"sm",onClick:()=>{ce(se.pomodoroConfig,D,!0),A(!1),F.success("番茄钟设置已保存")},children:[n.jsx(Re,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})]}),n.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:"使用说明"}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsxs("li",{children:["在项目页面 Header 点击 ",n.jsx(ne,{className:"h-3 w-3 inline-block mx-0.5"})," 图标启动番茄钟"]}),n.jsx("li",{children:"倒计时以大字体悬浮在屏幕上,不影响操作"}),n.jsx("li",{children:"工作阶段结束后自动切换为休息,并弹出通知"}),n.jsx("li",{children:"休息结束后自动切换回工作阶段"}),n.jsx("li",{children:"再次点击图标可停止并重置"})]})]})]})}),n.jsx(De,{value:"usage",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:"监控工具"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"选择要监控用量的 CLI 工具,首页和项目页会显示对应的实时用量"})]}),n.jsx("div",{className:"grid gap-3 max-w-md",children:[{key:"claude",label:"Claude Code",desc:"Anthropic API — 5h/7d 用量窗口"},{key:"codex",label:"Codex",desc:"OpenAI — 用量查询暂未实现"},{key:"opencode",label:"OpenCode",desc:"OpenCode — 用量查询暂未实现"},{key:"qwen",label:"Qwen Code",desc:"Qwen — 用量查询暂未实现"},{key:"gemini",label:"Gemini CLI",desc:"Google — 用量查询暂未实现"}].map(e=>n.jsxs("label",{className:"flex items-start gap-3 rounded-lg border p-3 cursor-pointer transition-colors "+(K===e.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[n.jsx("input",{type:"radio",name:"usageTool",value:e.key,checked:K===e.key,onChange:()=>{U(e.key),ce(se.usageMonitorTool,e.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),F.success(`用量监控已切换为 ${e.label}`)},className:"mt-0.5"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:e.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:e.desc})]})]},e.key))})]}),n.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:"说明"}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsx("li",{children:"用量数据显示在首页 Header 和项目页底部状态栏"}),n.jsx("li",{children:"Claude Code 通过 OAuth API 实时查询,每 5 分钟自动刷新"}),n.jsx("li",{children:"其他工具的用量查询将在后续版本中支持"}),n.jsx("li",{children:"切换后无需刷新页面,用量会自动更新"})]})]})]})})]})]})})}export{Kt as SettingsPage};