@tom2012/cc-web 2026.4.26-c → 2026.4.27-a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/backend/dist/approval-manager.d.ts.map +1 -1
- package/backend/dist/approval-manager.js +19 -1
- package/backend/dist/approval-manager.js.map +1 -1
- package/backend/dist/hooks-manager.d.ts.map +1 -1
- package/backend/dist/hooks-manager.js +10 -1
- package/backend/dist/hooks-manager.js.map +1 -1
- package/backend/dist/index.d.ts.map +1 -1
- package/backend/dist/index.js +76 -100
- package/backend/dist/index.js.map +1 -1
- package/backend/dist/notify-service.d.ts.map +1 -1
- package/backend/dist/notify-service.js +55 -18
- package/backend/dist/notify-service.js.map +1 -1
- package/backend/dist/plugin-manager.d.ts +3 -1
- package/backend/dist/plugin-manager.d.ts.map +1 -1
- package/backend/dist/plugin-manager.js +6 -1
- package/backend/dist/plugin-manager.js.map +1 -1
- package/backend/dist/routes/claude.d.ts.map +1 -1
- package/backend/dist/routes/claude.js +2 -1
- package/backend/dist/routes/claude.js.map +1 -1
- package/backend/dist/routes/filesystem.d.ts.map +1 -1
- package/backend/dist/routes/filesystem.js +15 -1
- package/backend/dist/routes/filesystem.js.map +1 -1
- package/backend/dist/routes/plugin-bridge.d.ts.map +1 -1
- package/backend/dist/routes/plugin-bridge.js +8 -1
- package/backend/dist/routes/plugin-bridge.js.map +1 -1
- package/backend/dist/routes/projects.d.ts.map +1 -1
- package/backend/dist/routes/projects.js +57 -0
- package/backend/dist/routes/projects.js.map +1 -1
- package/backend/dist/terminal-manager.d.ts +11 -0
- package/backend/dist/terminal-manager.d.ts.map +1 -1
- package/backend/dist/terminal-manager.js +45 -2
- package/backend/dist/terminal-manager.js.map +1 -1
- package/frontend/dist/assets/{AssistantMessageContent-C0ZaP9eO.js → AssistantMessageContent-BXMnfuLZ.js} +2 -2
- package/frontend/dist/assets/{GraphPreview-BaFsJMQN.js → GraphPreview-D2evmI4P.js} +2 -2
- package/frontend/dist/assets/MobilePage-DAAkzZKj.js +14 -0
- package/frontend/dist/assets/{OfficePreview-DhIp2aOs.js → OfficePreview-C0b0Chbt.js} +2 -2
- package/frontend/dist/assets/ProjectPage-DBbQ4-pC.js +26 -0
- package/frontend/dist/assets/SettingsPage-DYwXIx5X.js +13 -0
- package/frontend/dist/assets/{SkillHubPage-DmD53E8a.js → SkillHubPage-ta9T7RJ8.js} +3 -3
- package/frontend/dist/assets/{chevron-down-EqKf9tlu.js → chevron-down-cOrBs1BX.js} +1 -1
- package/frontend/dist/assets/{chevron-up-CWbUGBga.js → chevron-up-_GjIpav7.js} +1 -1
- package/frontend/dist/assets/index-BSqTv6c-.js +75 -0
- package/frontend/dist/assets/index-Be-Pukdu.js +13 -0
- package/frontend/dist/assets/index-CR3beFmz.css +1 -0
- package/frontend/dist/assets/{index-DeKR9qRA.js → index-DA9lMvOi.js} +1 -1
- package/frontend/dist/assets/{jszip.min-C6Lnkih6.js → jszip.min-CABtsVr3.js} +1 -1
- package/frontend/dist/assets/{search-BOlGnsRY.js → search-D_3ITgCa.js} +1 -1
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/MobilePage-BKYl9xD_.js +0 -14
- package/frontend/dist/assets/ProjectPage-B0giZHPu.js +0 -26
- package/frontend/dist/assets/SettingsPage-IqCwCOnP.js +0 -13
- package/frontend/dist/assets/index-BEiRWS1U.js +0 -75
- package/frontend/dist/assets/index-Big9FXD0.css +0 -1
- package/frontend/dist/assets/index-O5uIzaFm.js +0 -1
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{c as e,r as s,$ as t,b3 as n,j as a,a1 as r,a0 as l,W as o,d as i,U as c,b4 as d,aR as u,Z as h,b5 as m,V as p,a2 as x,a4 as f,a5 as g,a6 as v,a7 as j,x as b,aF as y,b6 as w,t as N,al as k,I as S,B as C,aK as _,X as R,D as P,b7 as E,b8 as I,b9 as T,ba as M,u as D,bb as A,T as H,bc as O,bd as L,be as V,bf as F,bg as B,aE as z,bh as W,bi as $,h as K,S as U,bj as q,aG as G,K as Z,s as X,bk as Q}from"./index-BEiRWS1U.js";import{k as Y,u as J,R as ee,d as se,f as te,A as ne,C as ae,j as re,h as le,S as oe,U as ie,i as ce,T as de,a as ue,b as he,c as me}from"./index-O5uIzaFm.js";import{C as pe}from"./chevron-down-EqKf9tlu.js";import{C as xe,a as fe}from"./chevron-up-CWbUGBga.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 ge=e("Activity",[["path",{d:"M22 12h-4l-3 9L9 3l-3 9H2",key:"d5dnw9"}]]),ve=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"}]]),je=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"}]]),be=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"}]]),ye=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"}]]),we=e("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]),Ne=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"}]]),ke=e("UploadCloud",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m16 16-4-4-4 4",key:"119tzi"}]]);
|
|
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 Se(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 Ce="Switch",[_e]=o(Ce),[Re,Pe]=_e(Ce),Ee=s.forwardRef((e,o)=>{const{__scopeSwitch:i,name:c,checked:d,defaultChecked:u,required:h,disabled:m,value:p="on",onCheckedChange:x,form:f,...g}=e,[v,j]=s.useState(null),b=t(o,e=>j(e)),y=s.useRef(!1),w=!v||(f||!!v.closest("form")),[N,k]=n({prop:d,defaultProp:u??!1,onChange:x,caller:Ce});return a.jsxs(Re,{scope:i,checked:N,disabled:m,children:[a.jsx(r.button,{type:"button",role:"switch","aria-checked":N,"aria-required":h,"data-state":De(N),"data-disabled":m?"":void 0,disabled:m,value:p,...g,ref:b,onClick:l(e.onClick,e=>{k(e=>!e),w&&(y.current=e.isPropagationStopped(),y.current||e.stopPropagation())})}),w&&a.jsx(Me,{control:v,bubbles:!y.current,name:c,value:p,checked:N,required:h,disabled:m,form:f,style:{transform:"translateX(-100%)"}})]})});Ee.displayName=Ce;var Ie="SwitchThumb",Te=s.forwardRef((e,s)=>{const{__scopeSwitch:t,...n}=e,l=Pe(Ie,t);return a.jsx(r.span,{"data-state":De(l.checked),"data-disabled":l.disabled?"":void 0,...n,ref:s})});Te.displayName=Ie;var Me=s.forwardRef(({__scopeSwitch:e,control:n,checked:r,bubbles:l=!0,...o},i)=>{const c=s.useRef(null),d=t(c,i),u=Se(r),h=Y(n);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]),a.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 De(e){return e?"checked":"unchecked"}Me.displayName="SwitchBubbleInput";var Ae=Ee,He=Te;const Oe=s.forwardRef(({className:e,...s},t)=>a.jsx(Ae,{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:a.jsx(He,{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 Le(e){const t=Ve(e),n=s.forwardRef((e,n)=>{const{children:r,...l}=e,o=s.Children.toArray(r),i=o.find(Be);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 a.jsx(t,{...l,ref:n,children:s.isValidElement(e)?s.cloneElement(e,void 0,r):null})}return a.jsx(t,{...l,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Ve(e){const t=s.forwardRef((e,t)=>{const{children:n,...a}=e;if(s.isValidElement(n)){const e=function(e){var s,t;let n=null==(s=Object.getOwnPropertyDescriptor(e.props,"ref"))?void 0:s.get,a=n&&"isReactWarning"in n&&n.isReactWarning;if(a)return e.ref;if(n=null==(t=Object.getOwnPropertyDescriptor(e,"ref"))?void 0:t.get,a=n&&"isReactWarning"in n&&n.isReactWarning,a)return e.props.ref;return e.props.ref||e.ref}(n),r=function(e,s){const t={...s};for(const n in s){const a=e[n],r=s[n];/^on[A-Z]/.test(n)?a&&r?t[n]=(...e)=>{const s=r(...e);return a(...e),s}:a&&(t[n]=a):"style"===n?t[n]={...a,...r}:"className"===n&&(t[n]=[a,r].filter(Boolean).join(" "))}return{...e,...t}}(a,n.props);return n.type!==s.Fragment&&(r.ref=t?c(t,e):e),s.cloneElement(n,r)}return s.Children.count(n)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}Oe.displayName=Ae.displayName;var Fe=Symbol("radix.slottable");function Be(e){return s.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===Fe}var ze=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)=>a.jsx(r.span,{...e,ref:s,style:{...ze,...e.style}})).displayName="VisuallyHidden";var We=[" ","Enter","ArrowUp","ArrowDown"],$e=[" ","Enter"],Ke="Select",[Ue,qe,Ge]=te(Ke),[Ze]=o(Ke,[Ge,se]),Xe=se(),[Qe,Ye]=Ze(Ke),[Je,es]=Ze(Ke),ss=e=>{const{__scopeSelect:t,children:r,open:l,defaultOpen:o,onOpenChange:i,value:c,defaultValue:u,onValueChange:h,dir:m,name:p,autoComplete:x,disabled:f,required:g,form:v}=e,j=Xe(t),[b,y]=s.useState(null),[w,N]=s.useState(null),[k,S]=s.useState(!1),C=J(m),[_,R]=n({prop:l,defaultProp:o??!1,onChange:i,caller:Ke}),[P,E]=n({prop:c,defaultProp:u,onChange:h,caller:Ke}),I=s.useRef(null),T=!b||(v||!!b.closest("form")),[M,D]=s.useState(new Set),A=Array.from(M).map(e=>e.props.value).join(";");return a.jsx(ee,{...j,children:a.jsxs(Qe,{required:g,scope:t,trigger:b,onTriggerChange:y,valueNode:w,onValueNodeChange:N,valueNodeHasChildren:k,onValueNodeHasChildrenChange:S,contentId:d(),value:P,onValueChange:E,open:_,onOpenChange:R,dir:C,triggerPointerDownPosRef:I,disabled:f,children:[a.jsx(Ue.Provider,{scope:t,children:a.jsx(Je,{scope:e.__scopeSelect,onNativeOptionAdd:s.useCallback(e=>{D(s=>new Set(s).add(e))},[]),onNativeOptionRemove:s.useCallback(e=>{D(s=>{const t=new Set(s);return t.delete(e),t})},[]),children:r})}),T?a.jsxs(Bs,{"aria-hidden":!0,required:g,tabIndex:-1,name:p,autoComplete:x,value:P,onChange:e=>E(e.target.value),disabled:f,form:v,children:[void 0===P?a.jsx("option",{value:""}):null,Array.from(M)]},A):null]})})};ss.displayName=Ke;var ts="SelectTrigger",ns=s.forwardRef((e,n)=>{const{__scopeSelect:o,disabled:i=!1,...c}=e,d=Xe(o),u=Ye(ts,o),h=u.disabled||i,m=t(n,u.onTriggerChange),p=qe(o),x=s.useRef("touch"),[f,g,v]=Ws(e=>{const s=p().filter(e=>!e.disabled),t=s.find(e=>e.value===u.value),n=$s(s,e,t);void 0!==n&&u.onValueChange(n.value)}),j=e=>{h||(u.onOpenChange(!0),v()),e&&(u.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return a.jsx(ne,{asChild:!0,...d,children:a.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":zs(u.value)?"":void 0,...c,ref:m,onClick:l(c.onClick,e=>{e.currentTarget.focus(),"mouse"!==x.current&&j(e)}),onPointerDown:l(c.onPointerDown,e=>{x.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||g(e.key),s&&" "===e.key||We.includes(e.key)&&(j(),e.preventDefault())})})})});ns.displayName=ts;var as="SelectValue",rs=s.forwardRef((e,s)=>{const{__scopeSelect:n,className:l,style:o,children:i,placeholder:c="",...d}=e,h=Ye(as,n),{onValueNodeHasChildrenChange:m}=h,p=void 0!==i,x=t(s,h.onValueNodeChange);return u(()=>{m(p)},[m,p]),a.jsx(r.span,{...d,ref:x,style:{pointerEvents:"none"},children:zs(h.value)?a.jsx(a.Fragment,{children:c}):i})});rs.displayName=as;var ls=s.forwardRef((e,s)=>{const{__scopeSelect:t,children:n,...l}=e;return a.jsx(r.span,{"aria-hidden":!0,...l,ref:s,children:n||"▼"})});ls.displayName="SelectIcon";var os=e=>a.jsx(h,{asChild:!0,...e});os.displayName="SelectPortal";var is="SelectContent",cs=s.forwardRef((e,t)=>{const n=Ye(is,e.__scopeSelect),[r,l]=s.useState();if(u(()=>{l(new DocumentFragment)},[]),!n.open){const s=r;return s?m.createPortal(a.jsx(us,{scope:e.__scopeSelect,children:a.jsx(Ue.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(ps,{...e,ref:t})});cs.displayName=is;var ds=10,[us,hs]=Ze(is),ms=Le("SelectContent.RemoveScroll"),ps=s.forwardRef((e,n)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:c,onPointerDownOutside:d,side:u,sideOffset:h,align:m,alignOffset:p,arrowPadding:b,collisionBoundary:y,collisionPadding:w,sticky:N,hideWhenDetached:k,avoidCollisions:S,...C}=e,_=Ye(is,r),[R,P]=s.useState(null),[E,I]=s.useState(null),T=t(n,e=>P(e)),[M,D]=s.useState(null),[A,H]=s.useState(null),O=qe(r),[L,V]=s.useState(!1),F=s.useRef(!1);s.useEffect(()=>{if(R)return x(R)},[R]),f();const B=s.useCallback(e=>{const[s,...t]=O().map(e=>e.ref.current),[n]=t.slice(-1),a=document.activeElement;for(const r of e){if(r===a)return;if(null==r||r.scrollIntoView({block:"nearest"}),r===s&&E&&(E.scrollTop=0),r===n&&E&&(E.scrollTop=E.scrollHeight),null==r||r.focus(),document.activeElement!==a)return}},[O,E]),z=s.useCallback(()=>B([M,R]),[B,M,R]);s.useEffect(()=>{L&&z()},[L,z]);const{onOpenChange:W,triggerPointerDownPosRef:$}=_;s.useEffect(()=>{if(R){let e={x:0,y:0};const s=s=>{var t,n;e={x:Math.abs(Math.round(s.pageX)-((null==(t=$.current)?void 0:t.x)??0)),y:Math.abs(Math.round(s.pageY)-((null==(n=$.current)?void 0:n.y)??0))}},t=t=>{e.x<=10&&e.y<=10?t.preventDefault():R.contains(t.target)||W(!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})}}},[R,W,$]),s.useEffect(()=>{const e=()=>W(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[W]);const[K,U]=Ws(e=>{const s=O().filter(e=>!e.disabled),t=s.find(e=>e.ref.current===document.activeElement),n=$s(s,e,t);n&&setTimeout(()=>n.ref.current.focus())}),q=s.useCallback((e,s,t)=>{const n=!F.current&&!t;(void 0!==_.value&&_.value===s||n)&&(D(e),n&&(F.current=!0))},[_.value]),G=s.useCallback(()=>null==R?void 0:R.focus(),[R]),Z=s.useCallback((e,s,t)=>{const n=!F.current&&!t;(void 0!==_.value&&_.value===s||n)&&H(e)},[_.value]),X="popper"===o?fs:xs,Q=X===fs?{side:u,sideOffset:h,align:m,alignOffset:p,arrowPadding:b,collisionBoundary:y,collisionPadding:w,sticky:N,hideWhenDetached:k,avoidCollisions:S}:{};return a.jsx(us,{scope:r,content:R,viewport:E,onViewportChange:I,itemRefCallback:q,selectedItem:M,onItemLeave:G,itemTextRefCallback:Z,focusSelectedItem:z,selectedItemText:A,position:o,isPositioned:L,searchRef:K,children:a.jsx(g,{as:ms,allowPinchZoom:!0,children:a.jsx(v,{asChild:!0,trapped:_.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:l(i,e=>{var s;null==(s=_.trigger)||s.focus({preventScroll:!0}),e.preventDefault()}),children:a.jsx(j,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:c,onPointerDownOutside:d,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>_.onOpenChange(!1),children:a.jsx(X,{role:"listbox",id:_.contentId,"data-state":_.open?"open":"closed",dir:_.dir,onContextMenu:e=>e.preventDefault(),...C,...Q,onPlaced:()=>V(!0),ref:T,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=O().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,n=s.indexOf(t);s=s.slice(n+1)}setTimeout(()=>B(s)),e.preventDefault()}})})})})})})});ps.displayName="SelectContentImpl";var xs=s.forwardRef((e,n)=>{const{__scopeSelect:l,onPlaced:o,...i}=e,c=Ye(is,l),d=hs(is,l),[h,m]=s.useState(null),[p,x]=s.useState(null),f=t(n,e=>x(e)),g=qe(l),v=s.useRef(!1),j=s.useRef(!0),{viewport:b,selectedItem:y,selectedItemText:w,focusSelectedItem:N}=d,k=s.useCallback(()=>{if(c.trigger&&c.valueNode&&h&&p&&b&&y&&w){const e=c.trigger.getBoundingClientRect(),s=p.getBoundingClientRect(),t=c.valueNode.getBoundingClientRect(),n=w.getBoundingClientRect();if("rtl"!==c.dir){const a=n.left-s.left,r=t.left-a,l=e.left-r,o=e.width+l,i=Math.max(o,s.width),c=window.innerWidth-ds,d=re(r,[ds,Math.max(ds,c-i)]);h.style.minWidth=o+"px",h.style.left=d+"px"}else{const a=s.right-n.right,r=window.innerWidth-t.right-a,l=window.innerWidth-e.right-r,o=e.width+l,i=Math.max(o,s.width),c=window.innerWidth-ds,d=re(r,[ds,Math.max(ds,c-i)]);h.style.minWidth=o+"px",h.style.right=d+"px"}const a=g(),r=window.innerHeight-2*ds,l=b.scrollHeight,i=window.getComputedStyle(p),d=parseInt(i.borderTopWidth,10),u=parseInt(i.paddingTop,10),m=parseInt(i.borderBottomWidth,10),x=d+u+l+parseInt(i.paddingBottom,10)+m,f=Math.min(5*y.offsetHeight,x),j=window.getComputedStyle(b),N=parseInt(j.paddingTop,10),k=parseInt(j.paddingBottom,10),S=e.top+e.height/2-ds,C=r-S,_=y.offsetHeight/2,R=d+u+(y.offsetTop+_),P=x-R;if(R<=S){const e=a.length>0&&y===a[a.length-1].ref.current;h.style.bottom="0px";const s=p.clientHeight-b.offsetTop-b.offsetHeight,t=R+Math.max(C,_+(e?k:0)+s+m);h.style.height=t+"px"}else{const e=a.length>0&&y===a[0].ref.current;h.style.top="0px";const s=Math.max(S,d+b.offsetTop+(e?N:0)+_)+P;h.style.height=s+"px",b.scrollTop=R-S+b.offsetTop}h.style.margin=`${ds}px 0`,h.style.minHeight=f+"px",h.style.maxHeight=r+"px",null==o||o(),requestAnimationFrame(()=>v.current=!0)}},[g,c.trigger,c.valueNode,h,p,b,y,w,c.dir,o]);u(()=>k(),[k]);const[S,C]=s.useState();u(()=>{p&&C(window.getComputedStyle(p).zIndex)},[p]);const _=s.useCallback(e=>{e&&!0===j.current&&(k(),null==N||N(),j.current=!1)},[k,N]);return a.jsx(gs,{scope:l,contentWrapper:h,shouldExpandOnScrollRef:v,onScrollButtonChange:_,children:a.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(r.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});xs.displayName="SelectItemAlignedPosition";var fs=s.forwardRef((e,s)=>{const{__scopeSelect:t,align:n="start",collisionPadding:r=ds,...l}=e,o=Xe(t);return a.jsx(ae,{...o,...l,ref:s,align:n,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)"}})});fs.displayName="SelectPopperPosition";var[gs,vs]=Ze(is,{}),js="SelectViewport",bs=s.forwardRef((e,n)=>{const{__scopeSelect:o,nonce:i,...c}=e,d=hs(js,o),u=vs(js,o),h=t(n,d.onViewportChange),m=s.useRef(0);return a.jsxs(a.Fragment,{children:[a.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}),a.jsx(Ue.Slot,{scope:o,children:a.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:n}=u;if((null==n?void 0:n.current)&&t){const e=Math.abs(m.current-s.scrollTop);if(e>0){const n=window.innerHeight-2*ds,a=parseFloat(t.style.minHeight),r=parseFloat(t.style.height),l=Math.max(a,r);if(l<n){const a=l+e,r=Math.min(n,a),o=a-r;t.style.height=r+"px","0px"===t.style.bottom&&(s.scrollTop=o>0?o:0,t.style.justifyContent="flex-end")}}}m.current=s.scrollTop})})})]})});bs.displayName=js;var ys="SelectGroup",[ws,Ns]=Ze(ys);s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e,l=d();return a.jsx(ws,{scope:t,id:l,children:a.jsx(r.div,{role:"group","aria-labelledby":l,...n,ref:s})})}).displayName=ys;var ks="SelectLabel",Ss=s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e,l=Ns(ks,t);return a.jsx(r.div,{id:l.id,...n,ref:s})});Ss.displayName=ks;var Cs="SelectItem",[_s,Rs]=Ze(Cs),Ps=s.forwardRef((e,n)=>{const{__scopeSelect:o,value:i,disabled:c=!1,textValue:u,...h}=e,m=Ye(Cs,o),p=hs(Cs,o),x=m.value===i,[f,g]=s.useState(u??""),[v,j]=s.useState(!1),b=t(n,e=>{var s;return null==(s=p.itemRefCallback)?void 0:s.call(p,e,i,c)}),y=d(),w=s.useRef("touch"),N=()=>{c||(m.onValueChange(i),m.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 a.jsx(_s,{scope:o,value:i,disabled:c,textId:y,isSelected:x,onItemTextChange:s.useCallback(e=>{g(s=>s||((null==e?void 0:e.textContent)??"").trim())},[]),children:a.jsx(Ue.ItemSlot,{scope:o,value:i,disabled:c,textValue:f,children:a.jsx(r.div,{role:"option","aria-labelledby":y,"data-highlighted":v?"":void 0,"aria-selected":x&&v,"data-state":x?"checked":"unchecked","aria-disabled":c||void 0,"data-disabled":c?"":void 0,tabIndex:c?void 0:-1,...h,ref:b,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=p.onItemLeave)||s.call(p):"mouse"===w.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:l(h.onPointerLeave,e=>{var s;e.currentTarget===document.activeElement&&(null==(s=p.onItemLeave)||s.call(p))}),onKeyDown:l(h.onKeyDown,e=>{var s;""!==(null==(s=p.searchRef)?void 0:s.current)&&" "===e.key||($e.includes(e.key)&&N()," "===e.key&&e.preventDefault())})})})})});Ps.displayName=Cs;var Es="SelectItemText",Is=s.forwardRef((e,n)=>{const{__scopeSelect:l,className:o,style:i,...c}=e,d=Ye(Es,l),h=hs(Es,l),p=Rs(Es,l),x=es(Es,l),[f,g]=s.useState(null),v=t(n,e=>g(e),p.onItemTextChange,e=>{var s;return null==(s=h.itemTextRefCallback)?void 0:s.call(h,e,p.value,p.disabled)}),j=null==f?void 0:f.textContent,b=s.useMemo(()=>a.jsx("option",{value:p.value,disabled:p.disabled,children:j},p.value),[p.disabled,p.value,j]),{onNativeOptionAdd:y,onNativeOptionRemove:w}=x;return u(()=>(y(b),()=>w(b)),[y,w,b]),a.jsxs(a.Fragment,{children:[a.jsx(r.span,{id:p.textId,...c,ref:v}),p.isSelected&&d.valueNode&&!d.valueNodeHasChildren?m.createPortal(c.children,d.valueNode):null]})});Is.displayName=Es;var Ts="SelectItemIndicator",Ms=s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e;return Rs(Ts,t).isSelected?a.jsx(r.span,{"aria-hidden":!0,...n,ref:s}):null});Ms.displayName=Ts;var Ds="SelectScrollUpButton",As=s.forwardRef((e,n)=>{const r=hs(Ds,e.__scopeSelect),l=vs(Ds,e.__scopeSelect),[o,i]=s.useState(!1),c=t(n,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?a.jsx(Ls,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:s}=r;e&&s&&(e.scrollTop=e.scrollTop-s.offsetHeight)}}):null});As.displayName=Ds;var Hs="SelectScrollDownButton",Os=s.forwardRef((e,n)=>{const r=hs(Hs,e.__scopeSelect),l=vs(Hs,e.__scopeSelect),[o,i]=s.useState(!1),c=t(n,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?a.jsx(Ls,{...e,ref:c,onAutoScroll:()=>{const{viewport:e,selectedItem:s}=r;e&&s&&(e.scrollTop=e.scrollTop+s.offsetHeight)}}):null});Os.displayName=Hs;var Ls=s.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...i}=e,c=hs("SelectScrollButton",n),d=s.useRef(null),h=qe(n),m=s.useCallback(()=>{null!==d.current&&(window.clearInterval(d.current),d.current=null)},[]);return s.useEffect(()=>()=>m(),[m]),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]),a.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,()=>{m()})})}),Vs=s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e;return a.jsx(r.div,{"aria-hidden":!0,...n,ref:s})});Vs.displayName="SelectSeparator";var Fs="SelectArrow";s.forwardRef((e,s)=>{const{__scopeSelect:t,...n}=e,r=Xe(t),l=Ye(Fs,t),o=hs(Fs,t);return l.open&&"popper"===o.position?a.jsx(le,{...r,...n,ref:s}):null}).displayName=Fs;var Bs=s.forwardRef(({__scopeSelect:e,value:n,...l},o)=>{const i=s.useRef(null),c=t(o,i),d=Se(n);return s.useEffect(()=>{const e=i.current;if(!e)return;const s=window.HTMLSelectElement.prototype,t=Object.getOwnPropertyDescriptor(s,"value").set;if(d!==n&&t){const s=new Event("change",{bubbles:!0});t.call(e,n),e.dispatchEvent(s)}},[d,n]),a.jsx(r.select,{...l,style:{...ze,...l.style},ref:c,defaultValue:n})});function zs(e){return""===e||void 0===e}function Ws(e){const t=p(e),n=s.useRef(""),a=s.useRef(0),r=s.useCallback(e=>{const s=n.current+e;t(s),function e(s){n.current=s,window.clearTimeout(a.current),""!==s&&(a.current=window.setTimeout(()=>e(""),1e3))}(s)},[t]),l=s.useCallback(()=>{n.current="",window.clearTimeout(a.current)},[]);return s.useEffect(()=>()=>window.clearTimeout(a.current),[]),[n,r,l]}function $s(e,s,t){const n=s.length>1&&Array.from(s).every(e=>e===s[0])?s[0]:s,a=t?e.indexOf(t):-1;let r=(l=e,o=Math.max(a,0),l.map((e,s)=>l[(o+s)%l.length]));var l,o;1===n.length&&(r=r.filter(e=>e!==t));const i=r.find(e=>e.textValue.toLowerCase().startsWith(n.toLowerCase()));return i!==t?i:void 0}Bs.displayName="SelectBubbleInput";var Ks=ns,Us=ls,qs=os,Gs=cs,Zs=bs,Xs=Ss,Qs=Ps,Ys=Is,Js=Ms,et=As,st=Os,tt=Vs;const nt=ss,at=rs,rt=s.forwardRef(({className:e,children:s,...t},n)=>a.jsxs(Ks,{ref:n,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,a.jsx(Us,{asChild:!0,children:a.jsx(pe,{className:"h-4 w-4 opacity-50"})})]}));rt.displayName=Ks.displayName;const lt=s.forwardRef(({className:e,...s},t)=>a.jsx(et,{ref:t,className:i("flex cursor-default items-center justify-center py-1",e),...s,children:a.jsx(xe,{className:"h-4 w-4"})}));lt.displayName=et.displayName;const ot=s.forwardRef(({className:e,...s},t)=>a.jsx(st,{ref:t,className:i("flex cursor-default items-center justify-center py-1",e),...s,children:a.jsx(pe,{className:"h-4 w-4"})}));ot.displayName=st.displayName;const it=s.forwardRef(({className:e,children:s,position:t="popper",...n},r)=>a.jsx(qs,{children:a.jsxs(Gs,{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,...n,children:[a.jsx(lt,{}),a.jsx(Zs,{className:i("p-1","popper"===t&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),a.jsx(ot,{})]})}));it.displayName=Gs.displayName;s.forwardRef(({className:e,...s},t)=>a.jsx(Xs,{ref:t,className:i("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...s})).displayName=Xs.displayName;const ct=s.forwardRef(({className:e,children:s,...t},n)=>a.jsxs(Qs,{ref:n,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:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Js,{children:a.jsx(b,{className:"h-4 w-4"})})}),a.jsx(Ys,{children:s})]}));ct.displayName=Qs.displayName;s.forwardRef(({className:e,...s},t)=>a.jsx(tt,{ref:t,className:i("-mx-1 my-1 h-px bg-muted",e),...s})).displayName=tt.displayName;function dt(){const[e,t]=s.useState(null),[n,r]=s.useState(!0),[l,o]=s.useState(!1),[i,c]=s.useState(!1),[d,u]=s.useState(!1),[h,m]=s.useState(!1),[p,x]=s.useState(null),[f,g]=s.useState(0),[v,j]=s.useState(""),[b,D]=s.useState("");y({onStart:e=>{x(e.projectId),g(0)},onProgress:e=>{x(e.projectId),g(e.filesTransferred)},onDone:()=>{x(null),g(0)}}),s.useEffect(()=>{let e=!1;return w().then(s=>{e||(t(s),D(s.defaultExcludes.join("\n")))}).catch(e=>N.error(`加载同步配置失败: ${e.message}`)).finally(()=>{e||r(!1)}),()=>{e=!0}},[]);const A=(e,s)=>{t(t=>t?{...t,[e]:s}:t)};return n||!e?a.jsx("div",{className:"text-sm text-muted-foreground",children:"加载中…"}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:"服务器配置"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-host",children:"主机 (host)"}),a.jsx(S,{id:"sync-host",value:e.host,onChange:e=>A("host",e.target.value),placeholder:"example.com"})]}),a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-port",children:"端口"}),a.jsx(S,{id:"sync-port",type:"number",value:e.port,onChange:e=>A("port",Number(e.target.value)||22)})]}),a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-user",children:"用户名"}),a.jsx(S,{id:"sync-user",value:e.user,onChange:e=>A("user",e.target.value),placeholder:"tom"})]}),a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-remote",children:"远端根路径"}),a.jsx(S,{id:"sync-remote",value:e.remoteRoot,onChange:e=>A("remoteRoot",e.target.value),placeholder:"/data/projects"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["每个项目会同步到 ",a.jsx("code",{children:"远端路径/项目文件夹"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:"认证"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(k,{children:"方式"}),a.jsxs(nt,{value:e.authMethod,onValueChange:e=>A("authMethod",e),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(it,{children:[a.jsx(ct,{value:"key",children:"SSH key"}),a.jsx(ct,{value:"password",children:"密码"})]})]})]}),"key"===e.authMethod?a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-key",children:"私钥路径"}),a.jsx(S,{id:"sync-key",value:e.keyPath??"",onChange:e=>A("keyPath",e.target.value),placeholder:"~/.ssh/id_rsa"})]}):a.jsxs("div",{children:[a.jsx(k,{htmlFor:"sync-pw",children:"密码"}),a.jsx(S,{id:"sync-pw",type:"password",value:v,onChange:e=>j(e.target.value),placeholder:e.passwordSet?"已设置,留空保持不变":"未设置"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["需要系统安装 ",a.jsx("code",{children:"sshpass"}),"(密码通过 SSHPASS env 传递,不会出现在 argv 里)"]})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:"同步策略"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(k,{children:"方向"}),a.jsxs(nt,{value:e.direction,onValueChange:e=>A("direction",e),children:[a.jsx(rt,{children:a.jsx(at,{})}),a.jsxs(it,{children:[a.jsx(ct,{value:"push",children:"单向:本地 → 远端(--delete)"}),a.jsx(ct,{value:"pull",children:"单向:远端 → 本地"}),a.jsx(ct,{value:"bidirectional",children:"双向(先 push 再 pull)"})]})]})]}),a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(k,{htmlFor:"sync-cron",children:"定时 cron 表达式"}),a.jsx(S,{id:"sync-cron",value:e.schedule.cron,onChange:s=>A("schedule",{...e.schedule,cron:s.target.value}),placeholder:"0 3 * * *"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["5 段:分 时 日 月 周。例:",a.jsx("code",{children:"0 3 * * *"})," 每天 03:00"]})]}),a.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[a.jsx(Oe,{checked:e.schedule.enabled,onCheckedChange:s=>A("schedule",{...e.schedule,enabled:s})}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"启用"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-3",children:"默认排除(每行一个 glob)"}),a.jsx("textarea",{value:b,onChange:e=>D(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"}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["作为 ",a.jsx("code",{children:"rsync --exclude"})," 传入。项目级的额外排除暂通过 API 设置。"]})]}),a.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t",children:[a.jsxs(C,{onClick:()=>{(async()=>{if(e){o(!0);try{const s=b.split("\n").map(e=>e.trim()).filter(Boolean),n={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};v&&"__keep__"!==v&&(n.password=v);const a=await E(n);t(a),D(a.defaultExcludes.join("\n")),j(""),N.success("已保存")}catch(s){N.error(`保存失败: ${s.message}`)}finally{o(!1)}}})()},disabled:l,children:[l?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(oe,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]}),a.jsxs(C,{variant:"outline",onClick:()=>{(async()=>{c(!0);try{const e=await I();e.ok?N.success(e.message||"连接成功"):N.error(e.message||"连接失败")}catch(e){N.error(`测试失败: ${e.message}`)}finally{c(!1)}})()},disabled:i,children:[i?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(Ne,{className:"h-3.5 w-3.5 mr-1.5"}),"测试连接"]}),a.jsx("div",{className:"flex-1"}),d&&p&&a.jsx("span",{className:"text-xs text-muted-foreground self-center mr-1 tabular-nums",children:f>0?`同步中: ${p} (${f} 文件)`:`同步中: ${p}`}),a.jsxs(C,{variant:"outline",onClick:()=>{(async()=>{u(!0);try{const e=await T(),s=e.results.filter(e=>e.ok).length,t=e.results.filter(e=>e.skipped).length,n=e.results.filter(e=>"cancelled"===e.reason).length,a=e.total-s-t-n;n>0?N.info(`已取消:${s} 成功 / ${t} 跳过 / ${n} 取消 / ${a} 失败`):N.success(`同步完成:${s} 成功 / ${t} 跳过 / ${a} 失败`)}catch(e){N.error(`同步失败: ${e.message}`)}finally{u(!1),m(!1),x(null),g(0)}})()},disabled:d,title:"按当前方向同步所有项目",children:[d?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(ie,{className:"h-3.5 w-3.5 mr-1.5"}),"立即同步全部"]}),d&&a.jsxs(C,{variant:"outline",onClick:()=>{(async()=>{if(d&&!h){m(!0);try{await M(),N.info("已请求取消")}catch(e){N.error(`取消失败: ${e.message}`),m(!1)}}})()},disabled:h,title:"取消批量同步:SIGTERM 当前 rsync 并停止后续项目",children:[h?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(R,{className:"h-3.5 w-3.5 mr-1.5"}),"取消"]})]}),a.jsxs("div",{className:"border-t pt-4 text-xs text-muted-foreground",children:["一次性 push/pull 工具:进入项目内部,点击 header 的 ",a.jsx(ie,{className:"inline h-3 w-3"})," / ",a.jsx(P,{className:"inline h-3 w-3"})," 按钮。 或通过 API 调用 ",a.jsx("code",{children:"POST /api/sync/project/:id"})," with body ",a.jsx("code",{children:'{ "direction": "push" }'}),"。"]})]})}function ut(){const e=D(),[t,n]=s.useState(null),[r,l]=s.useState(!0),[o,i]=s.useState(""),[c,d]=s.useState(!1);s.useEffect(()=>{let e=!1;return A().then(s=>{e||n(s)}).catch(()=>{e||n({configured:!1,needsReset:!1})}).finally(()=>{e||l(!1)}),()=>{e=!0}},[]);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold mb-1",children:"CCWeb Hub 直接提交"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:['配置你的 GitHub PAT 后,在 Quick Prompts / Agent Prompts 卡片右键选择"共享"时可一键直接提交 Issue 到 ',a.jsx("code",{children:"zbc0315/ccweb-hub"}),"。 ccweb 本身不自带 token —— 使用你自己的账号身份提交,归属清晰,互不影响。"]})]}),r?a.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[a.jsx(_,{className:"h-4 w-4 animate-spin"}),"加载中…"]}):a.jsxs(a.Fragment,{children:[a.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)?a.jsxs(a.Fragment,{children:[a.jsx(fe,{className:"h-4 w-4 text-green-500 shrink-0"}),a.jsx("span",{children:"已配置 token,可直接提交"}),a.jsx("div",{className:"flex-1"}),a.jsxs(C,{size:"sm",variant:"outline",onClick:()=>{(async()=>{if(await e({title:"清除 Hub Token",description:"清除后将无法直接提交到 ccweb-hub,需要重新配置 token。确认?",destructive:!0,confirmLabel:"清除"}))try{await O(),n({configured:!1,needsReset:!1}),N.success("已清除")}catch(s){N.error(`清除失败: ${s.message}`)}})()},children:[a.jsx(H,{className:"h-3.5 w-3.5 mr-1"}),"清除"]})]}):(null==t?void 0:t.needsReset)?a.jsxs(a.Fragment,{children:[a.jsx(ve,{className:"h-4 w-4 text-amber-500 shrink-0"}),a.jsx("span",{children:"之前的 token 已失效(服务端密钥可能已轮换),请重新设置"})]}):a.jsxs(a.Fragment,{children:[a.jsx(ve,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a.jsx("span",{children:"尚未配置 token"})]})}),a.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2.5 text-xs space-y-2",children:[a.jsx("div",{className:"font-medium text-foreground",children:"如何获取 token"}),a.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-muted-foreground",children:[a.jsxs("li",{children:["打开"," ",a.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",a.jsx(be,{className:"h-3 w-3"})]})," ","创建页"]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Repository access"}),':选 "Only select repositories",添加 ',a.jsx("code",{children:"zbc0315/ccweb-hub"})]}),a.jsxs("li",{children:[a.jsx("strong",{className:"text-foreground",children:"Repository permissions → Issues"}),':设置为 "Read and write"']}),a.jsx("li",{children:"其余权限保持默认(全部无访问)"}),a.jsx("li",{children:"生成后复制 token 粘贴到下方"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(k,{htmlFor:"hub-token",className:"text-xs",children:["GitHub Token ",(null==t?void 0:t.configured)&&a.jsx("span",{className:"text-muted-foreground",children:"(填写会覆盖现有 token)"})]}),a.jsx(S,{id:"hub-token",type:"password",placeholder:"github_pat_...",value:o,onChange:e=>i(e.target.value),autoComplete:"off",spellCheck:!1}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Token 以 AES-256-GCM 加密存储于 ",a.jsx("code",{children:"~/.ccweb/hub-auth/"}),";per-user 独立,不会被其他用户读到。"]})]}),a.jsx("div",{className:"flex gap-2 pt-2 border-t",children:a.jsxs(C,{onClick:()=>{(async()=>{const e=o.trim();if(e){d(!0);try{const s=await L(e);n(s),i(""),N.success("已保存")}catch(s){N.error(`保存失败: ${s.message}`)}finally{d(!1)}}else N.error("请输入 token")})()},disabled:c||!o.trim(),children:[c?a.jsx(_,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):a.jsx(oe,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})})]})]})}function ht(){const{t:e,i18n:s}=ce();return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(we,{className:"h-4 w-4 text-muted-foreground"}),a.jsxs(nt,{value:s.language,onValueChange:async t=>{if(V.includes(t)){try{localStorage.setItem(F,t)}catch{}await s.changeLanguage(t);try{await B(t)}catch{N.error(e("language.switch_failed"))}}},children:[a.jsx(rt,{className:"w-40",children:a.jsx(at,{})}),a.jsxs(it,{children:[a.jsx(ct,{value:"zh",children:e("language.zh")}),a.jsx(ct,{value:"en",children:e("language.en")})]})]})]})}function mt(){const{t:e}=ce(),t=z(),[n]=W(),r=n.get("tab")||"sync",[l,o]=s.useState(()=>$()),[i,c]=s.useState(!1),[d,u]=s.useState({webhookEnabled:!1}),[h,m]=s.useState(""),[p,x]=s.useState(!1),[f,g]=s.useState(()=>K(U.usageMonitorTool,"claude"));s.useEffect(()=>{q().then(e=>{u(e),m(e.webhookUrl??"")}).catch(()=>{})},[]);const v=(e,s)=>{const t=parseInt(s,10);isNaN(t)||t<1||(o(s=>({...s,[e]:t})),c(!0))};return a.jsx("div",{className:"min-h-screen bg-background",children:a.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[a.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[a.jsxs(C,{variant:"ghost",size:"sm",onClick:()=>t("/"),children:[a.jsx(G,{className:"h-4 w-4 mr-1"}),e("common.back")]}),a.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:e("settings.title")})]}),a.jsxs(de,{defaultValue:r,children:[a.jsxs(ue,{className:"mb-4",children:[a.jsxs(he,{value:"sync",children:[a.jsx(ke,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_sync")]}),a.jsxs(he,{value:"hub",children:[a.jsx(ye,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_hub")]}),a.jsxs(he,{value:"notifications",children:[a.jsx(je,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_notifications")]}),a.jsxs(he,{value:"pomodoro",children:[a.jsx(Z,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_pomodoro")]}),a.jsxs(he,{value:"usage",children:[a.jsx(ge,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_usage")]}),a.jsxs(he,{value:"language",children:[a.jsx(we,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_language")]})]}),a.jsx(me,{value:"sync",children:a.jsx(dt,{})}),a.jsx(me,{value:"hub",children:a.jsx(ut,{})}),a.jsx(me,{value:"notifications",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.browser_notify.title")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:e("settings.browser_notify.description")})]}),a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.webhook.title")}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.webhook.description")})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(k,{className:"text-xs",children:"Webhook URL"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(S,{placeholder:"https://hooks.slack.com/...",value:h,onChange:e=>m(e.target.value),className:"font-mono text-xs"}),a.jsx(C,{size:"sm",onClick:()=>{(async()=>{x(!0);try{const s=await Q({webhookEnabled:h.trim().length>0,webhookUrl:h.trim()||void 0});u(s),N.success(e("settings.webhook.saved"))}catch{N.error(e("settings.webhook.save_failed"))}finally{x(!1)}})()},disabled:p,children:e(p?"common.saving":"common.save")})]}),d.webhookEnabled&&d.webhookUrl&&a.jsxs("p",{className:"text-xs text-green-500",children:[e("settings.webhook.enabled_prefix")," ",d.webhookUrl]})]})]})]})}),a.jsx(me,{value:"pomodoro",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.section_title")}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.pomodoro.section_desc")})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-6 max-w-xs",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(k,{className:"text-xs",children:e("settings.pomodoro.work_minutes")}),a.jsx(S,{type:"number",min:1,max:120,value:l.workMinutes,onChange:e=>v("workMinutes",e.target.value),className:"w-full"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(k,{className:"text-xs",children:e("settings.pomodoro.break_minutes")}),a.jsx(S,{type:"number",min:1,max:60,value:l.breakMinutes,onChange:e=>v("breakMinutes",e.target.value),className:"w-full"})]})]}),i&&a.jsxs(C,{size:"sm",onClick:()=>{X(U.pomodoroConfig,l,!0),c(!1),N.success(e("settings.pomodoro.saved"))},children:[a.jsx(oe,{className:"h-3.5 w-3.5 mr-1.5"}),e("common.save")]})]}),a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.howto_title")}),a.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[a.jsxs("li",{children:[a.jsx(Z,{className:"h-3 w-3 inline-block mx-0.5"})," ",e("settings.pomodoro.howto_item_1")]}),a.jsx("li",{children:e("settings.pomodoro.howto_item_2")}),a.jsx("li",{children:e("settings.pomodoro.howto_item_3")}),a.jsx("li",{children:e("settings.pomodoro.howto_item_4")}),a.jsx("li",{children:e("settings.pomodoro.howto_item_5")})]})]})]})}),a.jsx(me,{value:"usage",children:a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.section_title")}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.usage.section_desc")})]}),a.jsx("div",{className:"grid gap-3 max-w-md",children:[{key:"claude",label:"Claude Code",desc:e("settings.usage.tool_claude_desc")},{key:"codex",label:"Codex",desc:e("settings.usage.tool_codex_desc")},{key:"opencode",label:"OpenCode",desc:e("settings.usage.tool_opencode_desc")},{key:"qwen",label:"Qwen Code",desc:e("settings.usage.tool_qwen_desc")},{key:"gemini",label:"Gemini CLI",desc:e("settings.usage.tool_gemini_desc")}].map(s=>a.jsxs("label",{className:"flex items-start gap-3 rounded-md border p-3 cursor-pointer transition-colors "+(f===s.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[a.jsx("input",{type:"radio",name:"usageTool",value:s.key,checked:f===s.key,onChange:()=>{g(s.key),X(U.usageMonitorTool,s.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),N.success(e("settings.usage.switched_toast",{tool:s.label}))},className:"mt-0.5"}),a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium",children:s.label}),a.jsx("div",{className:"text-xs text-muted-foreground",children:s.desc})]})]},s.key))})]}),a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[a.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.info_title")}),a.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[a.jsx("li",{children:e("settings.usage.info_item_1")}),a.jsx("li",{children:e("settings.usage.info_item_2")}),a.jsx("li",{children:e("settings.usage.info_item_3")}),a.jsx("li",{children:e("settings.usage.info_item_4")})]})]})]})}),a.jsx(me,{value:"language",children:a.jsx("div",{className:"space-y-6",children:a.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[a.jsx("div",{children:a.jsx("h3",{className:"text-sm font-medium",children:e("language.label")})}),a.jsx(ht,{})]})})})]})]})})}export{mt as SettingsPage};
|