@tom2012/cc-web 2026.5.14-b → 2026.5.15-a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (236) hide show
  1. package/README.md +1 -1
  2. package/backend/dist/index.d.ts.map +1 -1
  3. package/backend/dist/index.js +51 -0
  4. package/backend/dist/index.js.map +1 -1
  5. package/backend/dist/routes/flows.d.ts.map +1 -1
  6. package/backend/dist/routes/flows.js +10 -0
  7. package/backend/dist/routes/flows.js.map +1 -1
  8. package/backend/dist/routes/global-tracks.d.ts +11 -0
  9. package/backend/dist/routes/global-tracks.d.ts.map +1 -0
  10. package/backend/dist/routes/global-tracks.js +86 -0
  11. package/backend/dist/routes/global-tracks.js.map +1 -0
  12. package/backend/dist/routes/tracks.d.ts +14 -0
  13. package/backend/dist/routes/tracks.d.ts.map +1 -0
  14. package/backend/dist/routes/tracks.js +184 -0
  15. package/backend/dist/routes/tracks.js.map +1 -0
  16. package/backend/dist/tracks/__tests__/verify-track-t1.d.ts +11 -0
  17. package/backend/dist/tracks/__tests__/verify-track-t1.d.ts.map +1 -0
  18. package/backend/dist/tracks/__tests__/verify-track-t1.js +293 -0
  19. package/backend/dist/tracks/__tests__/verify-track-t1.js.map +1 -0
  20. package/backend/dist/tracks/__tests__/verify-track.d.ts +20 -0
  21. package/backend/dist/tracks/__tests__/verify-track.d.ts.map +1 -0
  22. package/backend/dist/tracks/__tests__/verify-track.js +187 -0
  23. package/backend/dist/tracks/__tests__/verify-track.js.map +1 -0
  24. package/backend/dist/tracks/ask-user-bridge.d.ts +59 -0
  25. package/backend/dist/tracks/ask-user-bridge.d.ts.map +1 -0
  26. package/backend/dist/tracks/ask-user-bridge.js +186 -0
  27. package/backend/dist/tracks/ask-user-bridge.js.map +1 -0
  28. package/backend/dist/tracks/ccweb-train-adapter.d.ts +40 -0
  29. package/backend/dist/tracks/ccweb-train-adapter.d.ts.map +1 -0
  30. package/backend/dist/tracks/ccweb-train-adapter.js +111 -0
  31. package/backend/dist/tracks/ccweb-train-adapter.js.map +1 -0
  32. package/backend/dist/tracks/cross-lock.d.ts +30 -0
  33. package/backend/dist/tracks/cross-lock.d.ts.map +1 -0
  34. package/backend/dist/tracks/cross-lock.js +44 -0
  35. package/backend/dist/tracks/cross-lock.js.map +1 -0
  36. package/backend/dist/tracks/index.d.ts +20 -0
  37. package/backend/dist/tracks/index.d.ts.map +1 -0
  38. package/backend/dist/tracks/index.js +42 -0
  39. package/backend/dist/tracks/index.js.map +1 -0
  40. package/backend/dist/tracks/registry.d.ts +56 -0
  41. package/backend/dist/tracks/registry.d.ts.map +1 -0
  42. package/backend/dist/tracks/registry.js +161 -0
  43. package/backend/dist/tracks/registry.js.map +1 -0
  44. package/backend/dist/tracks/store.d.ts +37 -0
  45. package/backend/dist/tracks/store.d.ts.map +1 -0
  46. package/backend/dist/tracks/store.js +254 -0
  47. package/backend/dist/tracks/store.js.map +1 -0
  48. package/backend/dist/tracks/track-runner.d.ts +62 -0
  49. package/backend/dist/tracks/track-runner.d.ts.map +1 -0
  50. package/backend/dist/tracks/track-runner.js +134 -0
  51. package/backend/dist/tracks/track-runner.js.map +1 -0
  52. package/backend/dist/tracks/train-loader.d.ts +44 -0
  53. package/backend/dist/tracks/train-loader.d.ts.map +1 -0
  54. package/backend/dist/tracks/train-loader.js +32 -0
  55. package/backend/dist/tracks/train-loader.js.map +1 -0
  56. package/backend/dist/tracks/types-train.d.ts +12 -0
  57. package/backend/dist/tracks/types-train.d.ts.map +1 -0
  58. package/backend/dist/tracks/types-train.js +13 -0
  59. package/backend/dist/tracks/types-train.js.map +1 -0
  60. package/backend/dist/tracks/types.d.ts +66 -0
  61. package/backend/dist/tracks/types.d.ts.map +1 -0
  62. package/backend/dist/tracks/types.js +12 -0
  63. package/backend/dist/tracks/types.js.map +1 -0
  64. package/backend/dist/tracks/workflow-data-watcher.d.ts +47 -0
  65. package/backend/dist/tracks/workflow-data-watcher.d.ts.map +1 -0
  66. package/backend/dist/tracks/workflow-data-watcher.js +166 -0
  67. package/backend/dist/tracks/workflow-data-watcher.js.map +1 -0
  68. package/backend/package-lock.json +107 -0
  69. package/backend/package.json +6 -1
  70. package/backend/vendor/@train-lang/adapter-spec/dist/index.d.ts +164 -0
  71. package/backend/vendor/@train-lang/adapter-spec/dist/index.d.ts.map +1 -0
  72. package/backend/vendor/@train-lang/adapter-spec/dist/index.js +13 -0
  73. package/backend/vendor/@train-lang/adapter-spec/dist/index.js.map +1 -0
  74. package/backend/vendor/@train-lang/adapter-spec/package.json +15 -0
  75. package/backend/vendor/@train-lang/core/dist/ast-cache.d.ts +74 -0
  76. package/backend/vendor/@train-lang/core/dist/ast-cache.d.ts.map +1 -0
  77. package/backend/vendor/@train-lang/core/dist/ast-cache.js +157 -0
  78. package/backend/vendor/@train-lang/core/dist/ast-cache.js.map +1 -0
  79. package/backend/vendor/@train-lang/core/dist/ast.d.ts +350 -0
  80. package/backend/vendor/@train-lang/core/dist/ast.d.ts.map +1 -0
  81. package/backend/vendor/@train-lang/core/dist/ast.js +15 -0
  82. package/backend/vendor/@train-lang/core/dist/ast.js.map +1 -0
  83. package/backend/vendor/@train-lang/core/dist/builder.d.ts +21 -0
  84. package/backend/vendor/@train-lang/core/dist/builder.d.ts.map +1 -0
  85. package/backend/vendor/@train-lang/core/dist/builder.js +1221 -0
  86. package/backend/vendor/@train-lang/core/dist/builder.js.map +1 -0
  87. package/backend/vendor/@train-lang/core/dist/builtins.d.ts +17 -0
  88. package/backend/vendor/@train-lang/core/dist/builtins.d.ts.map +1 -0
  89. package/backend/vendor/@train-lang/core/dist/builtins.js +488 -0
  90. package/backend/vendor/@train-lang/core/dist/builtins.js.map +1 -0
  91. package/backend/vendor/@train-lang/core/dist/index.d.ts +54 -0
  92. package/backend/vendor/@train-lang/core/dist/index.d.ts.map +1 -0
  93. package/backend/vendor/@train-lang/core/dist/index.js +66 -0
  94. package/backend/vendor/@train-lang/core/dist/index.js.map +1 -0
  95. package/backend/vendor/@train-lang/core/dist/interpreter.d.ts +110 -0
  96. package/backend/vendor/@train-lang/core/dist/interpreter.d.ts.map +1 -0
  97. package/backend/vendor/@train-lang/core/dist/interpreter.js +894 -0
  98. package/backend/vendor/@train-lang/core/dist/interpreter.js.map +1 -0
  99. package/backend/vendor/@train-lang/core/dist/lexer.d.ts +88 -0
  100. package/backend/vendor/@train-lang/core/dist/lexer.d.ts.map +1 -0
  101. package/backend/vendor/@train-lang/core/dist/lexer.js +243 -0
  102. package/backend/vendor/@train-lang/core/dist/lexer.js.map +1 -0
  103. package/backend/vendor/@train-lang/core/dist/module-loader.d.ts +74 -0
  104. package/backend/vendor/@train-lang/core/dist/module-loader.d.ts.map +1 -0
  105. package/backend/vendor/@train-lang/core/dist/module-loader.js +134 -0
  106. package/backend/vendor/@train-lang/core/dist/module-loader.js.map +1 -0
  107. package/backend/vendor/@train-lang/core/dist/parser.d.ts +135 -0
  108. package/backend/vendor/@train-lang/core/dist/parser.d.ts.map +1 -0
  109. package/backend/vendor/@train-lang/core/dist/parser.js +838 -0
  110. package/backend/vendor/@train-lang/core/dist/parser.js.map +1 -0
  111. package/backend/vendor/@train-lang/core/dist/prompt-composer.d.ts +49 -0
  112. package/backend/vendor/@train-lang/core/dist/prompt-composer.d.ts.map +1 -0
  113. package/backend/vendor/@train-lang/core/dist/prompt-composer.js +159 -0
  114. package/backend/vendor/@train-lang/core/dist/prompt-composer.js.map +1 -0
  115. package/backend/vendor/@train-lang/core/dist/runtime.d.ts +146 -0
  116. package/backend/vendor/@train-lang/core/dist/runtime.d.ts.map +1 -0
  117. package/backend/vendor/@train-lang/core/dist/runtime.js +156 -0
  118. package/backend/vendor/@train-lang/core/dist/runtime.js.map +1 -0
  119. package/backend/vendor/@train-lang/core/dist/type-descriptor.d.ts +18 -0
  120. package/backend/vendor/@train-lang/core/dist/type-descriptor.d.ts.map +1 -0
  121. package/backend/vendor/@train-lang/core/dist/type-descriptor.js +94 -0
  122. package/backend/vendor/@train-lang/core/dist/type-descriptor.js.map +1 -0
  123. package/backend/vendor/@train-lang/core/dist/validation.d.ts +44 -0
  124. package/backend/vendor/@train-lang/core/dist/validation.d.ts.map +1 -0
  125. package/backend/vendor/@train-lang/core/dist/validation.js +271 -0
  126. package/backend/vendor/@train-lang/core/dist/validation.js.map +1 -0
  127. package/backend/vendor/@train-lang/core/package.json +35 -0
  128. package/frontend/dist/assets/{ChatOverlay-B4bHclb4.js → ChatOverlay-D0AFod2I.js} +1 -1
  129. package/frontend/dist/assets/{GraphPreview-CBR4uFHb.js → GraphPreview-BTnlkocf.js} +2 -2
  130. package/frontend/dist/assets/{MobilePage-B7u9HJ1Y.js → MobilePage-CnjdRqIt.js} +3 -3
  131. package/frontend/dist/assets/{OfficePreview-V-X3ON2u.js → OfficePreview-nTZKPD9R.js} +2 -2
  132. package/frontend/dist/assets/{PdfPreview-NktKOUdL.js → PdfPreview-DlB-s5M8.js} +1 -1
  133. package/frontend/dist/assets/{ProjectPage-DAU6cEkl.js → ProjectPage-C_3_sZbd.js} +5 -5
  134. package/frontend/dist/assets/{SettingsPage-CtBCvofK.js → SettingsPage-BYSCQKoh.js} +2 -2
  135. package/frontend/dist/assets/{SkillHubPage-CHvWwI8j.js → SkillHubPage-CUgZXyeE.js} +3 -3
  136. package/frontend/dist/assets/TrackEditor-R2lmPugZ.js +14 -0
  137. package/frontend/dist/assets/abap-LPLW346S.js +7 -0
  138. package/frontend/dist/assets/apex-Dk-jUCUV.js +7 -0
  139. package/frontend/dist/assets/azcli-DPUMmPlX.js +7 -0
  140. package/frontend/dist/assets/bat-C1Qbg1bV.js +7 -0
  141. package/frontend/dist/assets/bicep-D-e-VSJi.js +7 -0
  142. package/frontend/dist/assets/cameligo-CjUqTgqL.js +7 -0
  143. package/frontend/dist/assets/{chevron-down-COdWD3xd.js → chevron-down-Bc6Xpnnk.js} +1 -1
  144. package/frontend/dist/assets/clojure-BWsu6Kju.js +7 -0
  145. package/frontend/dist/assets/codicon-DCmgc-ay.ttf +0 -0
  146. package/frontend/dist/assets/coffee-DeC36AK3.js +7 -0
  147. package/frontend/dist/assets/cpp-DcZnmBWT.js +7 -0
  148. package/frontend/dist/assets/csharp-DqBXBMf0.js +7 -0
  149. package/frontend/dist/assets/csp-CkO7y8ul.js +7 -0
  150. package/frontend/dist/assets/css-OAcfVtED.js +7 -0
  151. package/frontend/dist/assets/cssMode-oT-78_Ke.js +7 -0
  152. package/frontend/dist/assets/cypher-40UGrUjD.js +7 -0
  153. package/frontend/dist/assets/dart-DmixyLor.js +7 -0
  154. package/frontend/dist/assets/dockerfile-CayO4nTA.js +7 -0
  155. package/frontend/dist/assets/ecl-DRrKCuVc.js +7 -0
  156. package/frontend/dist/assets/editor-B5EY1bb8.css +1 -0
  157. package/frontend/dist/assets/editor.main-CKHkO4rf.js +37 -0
  158. package/frontend/dist/assets/elixir-J3qpp9mX.js +7 -0
  159. package/frontend/dist/assets/flow9-DzW2c4Im.js +7 -0
  160. package/frontend/dist/assets/freemarker2-gLqtlSdW.js +7 -0
  161. package/frontend/dist/assets/fsharp-D00tn_6c.js +7 -0
  162. package/frontend/dist/assets/go-NnNmgWK_.js +7 -0
  163. package/frontend/dist/assets/graphql-C9_--VLF.js +7 -0
  164. package/frontend/dist/assets/handlebars-CMR-cKzv.js +7 -0
  165. package/frontend/dist/assets/hcl-BhbOULbp.js +7 -0
  166. package/frontend/dist/assets/html-er6LXl7Q.js +7 -0
  167. package/frontend/dist/assets/htmlMode-BY7CWp3G.js +7 -0
  168. package/frontend/dist/assets/index-BmPb0Wl1.css +1 -0
  169. package/frontend/dist/assets/{index-CRhUXLfj.js → index-C6JmYBh3.js} +1 -1
  170. package/frontend/dist/assets/{index-CZ4PAGPA.js → index-C7QaGdFu.js} +2 -2
  171. package/frontend/dist/assets/{index-CaO8S0F7.js → index-CuoDBJ4_.js} +1 -1
  172. package/frontend/dist/assets/index-LxjrLxfp.js +1 -0
  173. package/frontend/dist/assets/ini-zR-_X5iG.js +7 -0
  174. package/frontend/dist/assets/java-CSTjsyoZ.js +7 -0
  175. package/frontend/dist/assets/javascript-R0QZ7Rw2.js +7 -0
  176. package/frontend/dist/assets/jsonMode-dh6Js0Qv.js +7 -0
  177. package/frontend/dist/assets/{jszip.min-CP_BBUld.js → jszip.min-D7W3wEX7.js} +1 -1
  178. package/frontend/dist/assets/julia-DioMOKVu.js +7 -0
  179. package/frontend/dist/assets/kotlin-Dsb0PKmW.js +7 -0
  180. package/frontend/dist/assets/less-CZYLoAVD.js +7 -0
  181. package/frontend/dist/assets/lexon-d5JUiwNk.js +7 -0
  182. package/frontend/dist/assets/liquid-ggFR895M.js +7 -0
  183. package/frontend/dist/assets/lua-1Al72GG8.js +7 -0
  184. package/frontend/dist/assets/m3-hx1xCPC3.js +7 -0
  185. package/frontend/dist/assets/markdown-DPGrH1xZ.js +7 -0
  186. package/frontend/dist/assets/mdx-B4WBy0Yh.js +7 -0
  187. package/frontend/dist/assets/mips-CYbZjkIm.js +7 -0
  188. package/frontend/dist/assets/msdax-DAioKM5A.js +7 -0
  189. package/frontend/dist/assets/mysql-7e9GUebS.js +7 -0
  190. package/frontend/dist/assets/objective-c-BGf8QNjz.js +7 -0
  191. package/frontend/dist/assets/pascal-hEDRz3un.js +7 -0
  192. package/frontend/dist/assets/pascaligo-gqEhN6pG.js +7 -0
  193. package/frontend/dist/assets/perl-CN8Ht9Vk.js +7 -0
  194. package/frontend/dist/assets/pgsql-CRCqHQBx.js +7 -0
  195. package/frontend/dist/assets/php-DTZrlAwe.js +7 -0
  196. package/frontend/dist/assets/pla-CRmh4UcC.js +7 -0
  197. package/frontend/dist/assets/postiats-Car2G7g8.js +7 -0
  198. package/frontend/dist/assets/powerquery-BJKl8V3o.js +7 -0
  199. package/frontend/dist/assets/powershell-Du7a_J7r.js +7 -0
  200. package/frontend/dist/assets/protobuf-ChneWI0H.js +7 -0
  201. package/frontend/dist/assets/pug-BH6LSJaf.js +7 -0
  202. package/frontend/dist/assets/python-AIGmVleM.js +7 -0
  203. package/frontend/dist/assets/qsharp-CU-Hxpxi.js +7 -0
  204. package/frontend/dist/assets/r-Bw-W15zh.js +7 -0
  205. package/frontend/dist/assets/razor-BGAZW957.js +7 -0
  206. package/frontend/dist/assets/redis-bY-X9-ol.js +7 -0
  207. package/frontend/dist/assets/redshift-CMu3ubbS.js +7 -0
  208. package/frontend/dist/assets/restructuredtext-KNkiWGNN.js +7 -0
  209. package/frontend/dist/assets/ruby-dQWMhU86.js +7 -0
  210. package/frontend/dist/assets/rust-BAcHhnEU.js +7 -0
  211. package/frontend/dist/assets/sb-Bidr5w2z.js +7 -0
  212. package/frontend/dist/assets/scala-imTtxsGY.js +7 -0
  213. package/frontend/dist/assets/scheme-BY-WHKiB.js +7 -0
  214. package/frontend/dist/assets/scss-NDoRP52C.js +7 -0
  215. package/frontend/dist/assets/{select-Cf6Q2O8Z.js → select-B9gOzVx5.js} +1 -1
  216. package/frontend/dist/assets/shell-DrIjotnh.js +7 -0
  217. package/frontend/dist/assets/solidity-DTahNycF.js +7 -0
  218. package/frontend/dist/assets/sophia-DtyrjGkZ.js +7 -0
  219. package/frontend/dist/assets/sparql-CFuS5E3z.js +7 -0
  220. package/frontend/dist/assets/sql-BRxcnbRv.js +7 -0
  221. package/frontend/dist/assets/st-Dz4uh7MK.js +7 -0
  222. package/frontend/dist/assets/swift-Digsrw1G.js +11 -0
  223. package/frontend/dist/assets/systemverilog-7TDrkMau.js +7 -0
  224. package/frontend/dist/assets/tcl-BtaFcnDi.js +7 -0
  225. package/frontend/dist/assets/tsMode-UrEEwBkN.js +7 -0
  226. package/frontend/dist/assets/twig-Deid_oBs.js +7 -0
  227. package/frontend/dist/assets/typescript-BTfMCp5C.js +7 -0
  228. package/frontend/dist/assets/typespec-zUaxhbG8.js +7 -0
  229. package/frontend/dist/assets/{user-B4YUPhU8.js → user-BG-Xqf8M.js} +1 -1
  230. package/frontend/dist/assets/vb-DK0rKJzo.js +7 -0
  231. package/frontend/dist/assets/wgsl-B8fNVlOQ.js +7 -0
  232. package/frontend/dist/assets/xml-BCL5DPdB.js +7 -0
  233. package/frontend/dist/assets/yaml-B__nW1c2.js +7 -0
  234. package/frontend/dist/index.html +2 -2
  235. package/package.json +2 -1
  236. package/frontend/dist/assets/index-BkQ6KI1l.css +0 -1
@@ -1,4 +1,4 @@
1
- import{c as e,r as s,a0 as t,aZ as a,j as n,a2 as c,a1 as l,Y as i,d as r,aF as o,aH as d,a_ as h,t as m,am as x,I as u,B as p,aN as g,X as j,D as b,a$ as y,b0 as f,b1 as _,b2 as v,u as k,b3 as N,T as w,b4 as C,b5 as S,b6 as M,b7 as E,b8 as T,aG as R,b9 as P,ba as H,i as I,S as F,bb as L,aJ as z,L as q,s as V,bc as A}from"./index-CZ4PAGPA.js";import{u as G,o as U,i as O,j as B,k as D,l as $,m as Q,S as W,U as Z,n as J,T as X,a as Y,b as K,c as ee}from"./select-Cf6Q2O8Z.js";import{C as se}from"./index-CRhUXLfj.js";import"./chevron-down-COdWD3xd.js";
1
+ import{c as e,r as s,a0 as t,aZ as a,j as n,a2 as c,a1 as l,Y as i,d as r,aG as o,aI as d,a_ as h,t as m,am as x,I as u,B as p,aE as g,X as j,D as b,a$ as y,b0 as f,b1 as _,b2 as v,u as k,b3 as N,T as w,b4 as C,b5 as S,b6 as M,b7 as E,b8 as T,aH as R,b9 as I,ba as P,i as H,S as F,bb as L,aK as z,K as q,s as V,bc as A}from"./index-C7QaGdFu.js";import{u as G,o as U,i as O,j as B,k as D,l as $,m as K,S as Q,U as W,n as Z,T as X,a as Y,b as J,c as ee}from"./select-B9gOzVx5.js";import{C as se}from"./index-C6JmYBh3.js";import"./chevron-down-Bc6Xpnnk.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
@@ -10,4 +10,4 @@ import{c as e,r as s,a0 as t,aZ as a,j as n,a2 as c,a1 as l,Y as i,d as r,aF as
10
10
  *
11
11
  * This source code is licensed under the ISC license.
12
12
  * See the LICENSE file in the root directory of this source tree.
13
- */var oe="Switch",[de]=i(oe),[he,me]=de(oe),xe=s.forwardRef((e,i)=>{const{__scopeSwitch:r,name:o,checked:d,defaultChecked:h,required:m,disabled:x,value:u="on",onCheckedChange:p,form:g,...j}=e,[b,y]=s.useState(null),f=t(i,e=>y(e)),_=s.useRef(!1),v=!b||(g||!!b.closest("form")),[k,N]=a({prop:d,defaultProp:h??!1,onChange:p,caller:oe});return n.jsxs(he,{scope:r,checked:k,disabled:x,children:[n.jsx(c.button,{type:"button",role:"switch","aria-checked":k,"aria-required":m,"data-state":je(k),"data-disabled":x?"":void 0,disabled:x,value:u,...j,ref:f,onClick:l(e.onClick,e=>{N(e=>!e),v&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})}),v&&n.jsx(ge,{control:b,bubbles:!_.current,name:o,value:u,checked:k,required:m,disabled:x,form:g,style:{transform:"translateX(-100%)"}})]})});xe.displayName=oe;var ue="SwitchThumb",pe=s.forwardRef((e,s)=>{const{__scopeSwitch:t,...a}=e,l=me(ue,t);return n.jsx(c.span,{"data-state":je(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:s})});pe.displayName=ue;var ge=s.forwardRef(({__scopeSwitch:e,control:a,checked:c,bubbles:l=!0,...i},r)=>{const o=s.useRef(null),d=t(o,r),h=G(c),m=U(a);return s.useEffect(()=>{const e=o.current;if(!e)return;const s=window.HTMLInputElement.prototype,t=Object.getOwnPropertyDescriptor(s,"checked").set;if(h!==c&&t){const s=new Event("click",{bubbles:l});t.call(e,c),e.dispatchEvent(s)}},[h,c,l]),n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:c,...i,tabIndex:-1,ref:d,style:{...i.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function je(e){return e?"checked":"unchecked"}ge.displayName="SwitchBubbleInput";var be=xe,ye=pe;const fe=s.forwardRef(({className:e,...s},t)=>n.jsx(be,{className:r("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(ye,{className:r("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")})}));fe.displayName=be.displayName;function _e(){const{t:e}=o(),[t,a]=s.useState(null),[c,l]=s.useState(!0),[i,r]=s.useState(!1),[k,N]=s.useState(!1),[w,C]=s.useState(!1),[S,M]=s.useState(!1),[E,T]=s.useState(null),[R,P]=s.useState(0),[H,I]=s.useState(""),[F,L]=s.useState("");d({onStart:e=>{T(e.projectId),P(0)},onProgress:e=>{T(e.projectId),P(e.filesTransferred)},onDone:()=>{T(null),P(0)}}),s.useEffect(()=>{let s=!1;return h().then(e=>{s||(a(e),L(e.defaultExcludes.join("\n")))}).catch(s=>m.error(e("sync_section.load_failed",{message:s.message}))).finally(()=>{s||l(!1)}),()=>{s=!0}},[e]);const z=(e,s)=>{a(t=>t?{...t,[e]:s}:t)};return c||!t?n.jsx("div",{className:"text-sm text-muted-foreground",children:e("sync_section.loading")}):n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.server_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-host",children:e("sync_section.host")}),n.jsx(u,{id:"sync-host",value:t.host,onChange:e=>z("host",e.target.value),placeholder:"example.com"})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-port",children:e("sync_section.port")}),n.jsx(u,{id:"sync-port",type:"number",value:t.port,onChange:e=>z("port",Number(e.target.value)||22)})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-user",children:e("sync_section.user")}),n.jsx(u,{id:"sync-user",value:t.user,onChange:e=>z("user",e.target.value),placeholder:"tom"})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-remote",children:e("sync_section.remote_root")}),n.jsx(u,{id:"sync-remote",value:t.remoteRoot,onChange:e=>z("remoteRoot",e.target.value),placeholder:"/data/projects"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.remote_root_hint")}})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.auth_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{children:e("sync_section.auth_method")}),n.jsxs(O,{value:t.authMethod,onValueChange:e=>z("authMethod",e),children:[n.jsx(B,{children:n.jsx(D,{})}),n.jsxs($,{children:[n.jsx(Q,{value:"key",children:"SSH key"}),n.jsx(Q,{value:"password",children:e("sync_section.auth_password")})]})]})]}),"key"===t.authMethod?n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-key",children:e("sync_section.key_path")}),n.jsx(u,{id:"sync-key",value:t.keyPath??"",onChange:e=>z("keyPath",e.target.value),placeholder:"~/.ssh/id_rsa"})]}):n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-pw",children:e("sync_section.password")}),n.jsx(u,{id:"sync-pw",type:"password",value:H,onChange:e=>I(e.target.value),placeholder:t.passwordSet?e("sync_section.password_set_placeholder"):e("sync_section.password_unset_placeholder")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.sshpass_hint")}})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.strategy_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{children:e("sync_section.direction")}),n.jsxs(O,{value:t.direction,onValueChange:e=>z("direction",e),children:[n.jsx(B,{children:n.jsx(D,{})}),n.jsxs($,{children:[n.jsx(Q,{value:"push",children:e("sync_section.push_label")}),n.jsx(Q,{value:"pull",children:e("sync_section.pull_label")}),n.jsx(Q,{value:"bidirectional",children:e("sync_section.bidirectional_label")})]})]})]}),n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx(x,{htmlFor:"sync-cron",children:e("sync_section.cron_label")}),n.jsx(u,{id:"sync-cron",value:t.schedule.cron,onChange:e=>z("schedule",{...t.schedule,cron:e.target.value}),placeholder:"0 3 * * *"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.cron_hint")}})]}),n.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[n.jsx(fe,{checked:t.schedule.enabled,onCheckedChange:e=>z("schedule",{...t.schedule,enabled:e})}),n.jsx("span",{className:"text-xs text-muted-foreground",children:e("sync_section.enable_label")})]})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.exclude_section")}),n.jsx("textarea",{value:F,onChange:e=>L(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.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.exclude_hint")}})]}),n.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t",children:[n.jsxs(p,{onClick:()=>{(async()=>{if(t){r(!0);try{const s=F.split("\n").map(e=>e.trim()).filter(Boolean),n={host:t.host,port:t.port,user:t.user,authMethod:t.authMethod,keyPath:t.keyPath,remoteRoot:t.remoteRoot,direction:t.direction,defaultExcludes:s,schedule:t.schedule};H&&"__keep__"!==H&&(n.password=H);const c=await y(n);a(c),L(c.defaultExcludes.join("\n")),I(""),m.success(e("sync_section.saved"))}catch(s){m.error(e("sync_section.save_failed",{message:s.message}))}finally{r(!1)}}})()},disabled:i,children:[i?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.save_button")]}),n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{N(!0);try{const s=await f();s.ok?m.success(s.message||e("sync_section.test_ok")):m.error(s.message||e("sync_section.test_failed"))}catch(s){m.error(e("sync_section.test_failed_with_reason",{message:s.message}))}finally{N(!1)}})()},disabled:k,children:[k?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(ie,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.test_button")]}),n.jsx("div",{className:"flex-1"}),w&&E&&n.jsx("span",{className:"text-xs text-muted-foreground self-center mr-1 tabular-nums",children:R>0?e("sync_section.syncing_with_files",{project:E,files:R}):e("sync_section.syncing_no_files",{project:E})}),n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{C(!0);try{const s=await _(),t=s.results.filter(e=>e.ok).length,a=s.results.filter(e=>e.skipped).length,n=s.results.filter(e=>"cancelled"===e.reason).length,c=s.total-t-a-n;n>0?m.info(e("sync_section.bulk_cancelled_toast",{ok:t,skipped:a,cancelled:n,failed:c})):m.success(e("sync_section.bulk_done_toast",{ok:t,skipped:a,failed:c}))}catch(s){m.error(e("sync_section.bulk_failed_toast",{message:s.message}))}finally{C(!1),M(!1),T(null),P(0)}})()},disabled:w,title:e("sync_section.sync_all_title"),children:[w?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Z,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.sync_all_button")]}),w&&n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{if(w&&!S){M(!0);try{await v(),m.info(e("sync_section.cancel_requested"))}catch(s){m.error(e("sync_section.cancel_failed",{message:s.message})),M(!1)}}})()},disabled:S,title:e("sync_section.cancel_button_title"),children:[S?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(j,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.cancel_button")]})]}),n.jsxs("div",{className:"border-t pt-4 text-xs text-muted-foreground",children:["Per-project push/pull: from inside a project, click the ",n.jsx(Z,{className:"inline h-3 w-3"})," / ",n.jsx(b,{className:"inline h-3 w-3"})," buttons in the header. Or call ",n.jsx("code",{children:"POST /api/sync/project/:id"})," with body ",n.jsx("code",{children:'{ "direction": "push" }'}),"."]})]})}function ve(){const e=k(),[t,a]=s.useState(null),[c,l]=s.useState(!0),[i,r]=s.useState(""),[o,d]=s.useState(!1);s.useEffect(()=>{let e=!1;return N().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 —— 使用你自己的账号身份提交,归属清晰,互不影响。"]})]}),c?n.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[n.jsx(g,{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(se,{className:"h-4 w-4 text-green-500 shrink-0"}),n.jsx("span",{children:"已配置 token,可直接提交"}),n.jsx("div",{className:"flex-1"}),n.jsxs(p,{size:"sm",variant:"outline",onClick:()=>{(async()=>{if(await e({title:"清除 Hub Token",description:"清除后将无法直接提交到 ccweb-hub,需要重新配置 token。确认?",destructive:!0,confirmLabel:"清除"}))try{await C(),a({configured:!1,needsReset:!1}),m.success("已清除")}catch(s){m.error(`清除失败: ${s.message}`)}})()},children:[n.jsx(w,{className:"h-3.5 w-3.5 mr-1"}),"清除"]})]}):(null==t?void 0:t.needsReset)?n.jsxs(n.Fragment,{children:[n.jsx(J,{className:"h-4 w-4 text-amber-500 shrink-0"}),n.jsx("span",{children:"之前的 token 已失效(服务端密钥可能已轮换),请重新设置"})]}):n.jsxs(n.Fragment,{children:[n.jsx(J,{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(ne,{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(x,{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(u,{id:"hub-token",type:"password",placeholder:"github_pat_...",value:i,onChange:e=>r(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(p,{onClick:()=>{(async()=>{const e=i.trim();if(e){d(!0);try{const s=await S(e);a(s),r(""),m.success("已保存")}catch(s){m.error(`保存失败: ${s.message}`)}finally{d(!1)}}else m.error("请输入 token")})()},disabled:o||!i.trim(),children:[o?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})})]})]})}function ke(){const{t:e,i18n:s}=o();return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs(O,{value:s.language,onValueChange:async t=>{if(M.includes(t)){try{localStorage.setItem(E,t)}catch{}await s.changeLanguage(t);try{await T(t)}catch{m.error(e("language.switch_failed"))}}},children:[n.jsx(B,{className:"w-40",children:n.jsx(D,{})}),n.jsxs($,{children:[n.jsx(Q,{value:"zh",children:e("language.zh")}),n.jsx(Q,{value:"en",children:e("language.en")})]})]})]})}function Ne(){const{t:e}=o(),t=R(),[a]=P(),c=a.get("tab")||"sync",[l,i]=s.useState(()=>H()),[r,d]=s.useState(!1),[h,g]=s.useState({webhookEnabled:!1}),[j,b]=s.useState(""),[y,f]=s.useState(!1),[_,v]=s.useState(()=>I(F.usageMonitorTool,"claude"));s.useEffect(()=>{L().then(e=>{g(e),b(e.webhookUrl??"")}).catch(()=>{})},[]);const k=(e,s)=>{const t=parseInt(s,10);isNaN(t)||t<1||(i(s=>({...s,[e]:t})),d(!0))};return n.jsx("div",{className:"min-h-screen bg-background",children:n.jsxs("div",{className:"max-w-3xl mx-auto p-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsxs(p,{variant:"ghost",size:"sm",onClick:()=>t("/"),children:[n.jsx(z,{className:"h-4 w-4 mr-1"}),e("common.back")]}),n.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:e("settings.title")})]}),n.jsxs(X,{defaultValue:c,children:[n.jsxs(Y,{className:"mb-4",children:[n.jsxs(K,{value:"sync",children:[n.jsx(re,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_sync")]}),n.jsxs(K,{value:"hub",children:[n.jsx(ce,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_hub")]}),n.jsxs(K,{value:"notifications",children:[n.jsx(ae,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_notifications")]}),n.jsxs(K,{value:"pomodoro",children:[n.jsx(q,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_pomodoro")]}),n.jsxs(K,{value:"usage",children:[n.jsx(te,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_usage")]}),n.jsxs(K,{value:"language",children:[n.jsx(le,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_language")]})]}),n.jsx(ee,{value:"sync",children:n.jsx(_e,{})}),n.jsx(ee,{value:"hub",children:n.jsx(ve,{})}),n.jsx(ee,{value:"notifications",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.browser_notify.title")}),n.jsx("p",{className:"text-xs text-muted-foreground",children:e("settings.browser_notify.description")})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.webhook.title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.webhook.description")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:"Webhook URL"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(u,{placeholder:"https://hooks.slack.com/...",value:j,onChange:e=>b(e.target.value),className:"font-mono text-xs"}),n.jsx(p,{size:"sm",onClick:()=>{(async()=>{f(!0);try{const s=await A({webhookEnabled:j.trim().length>0,webhookUrl:j.trim()||void 0});g(s),m.success(e("settings.webhook.saved"))}catch{m.error(e("settings.webhook.save_failed"))}finally{f(!1)}})()},disabled:y,children:e(y?"common.saving":"common.save")})]}),h.webhookEnabled&&h.webhookUrl&&n.jsxs("p",{className:"text-xs text-green-500",children:[e("settings.webhook.enabled_prefix")," ",h.webhookUrl]})]})]})]})}),n.jsx(ee,{value:"pomodoro",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.section_title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.pomodoro.section_desc")})]}),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(x,{className:"text-xs",children:e("settings.pomodoro.work_minutes")}),n.jsx(u,{type:"number",min:1,max:120,value:l.workMinutes,onChange:e=>k("workMinutes",e.target.value),className:"w-full"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:e("settings.pomodoro.break_minutes")}),n.jsx(u,{type:"number",min:1,max:60,value:l.breakMinutes,onChange:e=>k("breakMinutes",e.target.value),className:"w-full"})]})]}),r&&n.jsxs(p,{size:"sm",onClick:()=>{V(F.pomodoroConfig,l,!0),d(!1),m.success(e("settings.pomodoro.saved"))},children:[n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5"}),e("common.save")]})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.howto_title")}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsxs("li",{children:[n.jsx(q,{className:"h-3 w-3 inline-block mx-0.5"})," ",e("settings.pomodoro.howto_item_1")]}),n.jsx("li",{children:e("settings.pomodoro.howto_item_2")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_3")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_4")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_5")})]})]})]})}),n.jsx(ee,{value:"usage",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.section_title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.usage.section_desc")})]}),n.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=>n.jsxs("label",{className:"flex items-start gap-3 rounded-md border p-3 cursor-pointer transition-colors "+(_===s.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[n.jsx("input",{type:"radio",name:"usageTool",value:s.key,checked:_===s.key,onChange:()=>{v(s.key),V(F.usageMonitorTool,s.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),m.success(e("settings.usage.switched_toast",{tool:s.label}))},className:"mt-0.5"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:s.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:s.desc})]})]},s.key))})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.info_title")}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsx("li",{children:e("settings.usage.info_item_1")}),n.jsx("li",{children:e("settings.usage.info_item_2")}),n.jsx("li",{children:e("settings.usage.info_item_3")}),n.jsx("li",{children:e("settings.usage.info_item_4")})]})]})]})}),n.jsx(ee,{value:"language",children:n.jsx("div",{className:"space-y-6",children:n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[n.jsx("div",{children:n.jsx("h3",{className:"text-sm font-medium",children:e("language.label")})}),n.jsx(ke,{})]})})})]})]})})}export{Ne as SettingsPage};
13
+ */var oe="Switch",[de]=i(oe),[he,me]=de(oe),xe=s.forwardRef((e,i)=>{const{__scopeSwitch:r,name:o,checked:d,defaultChecked:h,required:m,disabled:x,value:u="on",onCheckedChange:p,form:g,...j}=e,[b,y]=s.useState(null),f=t(i,e=>y(e)),_=s.useRef(!1),v=!b||(g||!!b.closest("form")),[k,N]=a({prop:d,defaultProp:h??!1,onChange:p,caller:oe});return n.jsxs(he,{scope:r,checked:k,disabled:x,children:[n.jsx(c.button,{type:"button",role:"switch","aria-checked":k,"aria-required":m,"data-state":je(k),"data-disabled":x?"":void 0,disabled:x,value:u,...j,ref:f,onClick:l(e.onClick,e=>{N(e=>!e),v&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})}),v&&n.jsx(ge,{control:b,bubbles:!_.current,name:o,value:u,checked:k,required:m,disabled:x,form:g,style:{transform:"translateX(-100%)"}})]})});xe.displayName=oe;var ue="SwitchThumb",pe=s.forwardRef((e,s)=>{const{__scopeSwitch:t,...a}=e,l=me(ue,t);return n.jsx(c.span,{"data-state":je(l.checked),"data-disabled":l.disabled?"":void 0,...a,ref:s})});pe.displayName=ue;var ge=s.forwardRef(({__scopeSwitch:e,control:a,checked:c,bubbles:l=!0,...i},r)=>{const o=s.useRef(null),d=t(o,r),h=G(c),m=U(a);return s.useEffect(()=>{const e=o.current;if(!e)return;const s=window.HTMLInputElement.prototype,t=Object.getOwnPropertyDescriptor(s,"checked").set;if(h!==c&&t){const s=new Event("click",{bubbles:l});t.call(e,c),e.dispatchEvent(s)}},[h,c,l]),n.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:c,...i,tabIndex:-1,ref:d,style:{...i.style,...m,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function je(e){return e?"checked":"unchecked"}ge.displayName="SwitchBubbleInput";var be=xe,ye=pe;const fe=s.forwardRef(({className:e,...s},t)=>n.jsx(be,{className:r("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(ye,{className:r("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")})}));fe.displayName=be.displayName;function _e(){const{t:e}=o(),[t,a]=s.useState(null),[c,l]=s.useState(!0),[i,r]=s.useState(!1),[k,N]=s.useState(!1),[w,C]=s.useState(!1),[S,M]=s.useState(!1),[E,T]=s.useState(null),[R,I]=s.useState(0),[P,H]=s.useState(""),[F,L]=s.useState("");d({onStart:e=>{T(e.projectId),I(0)},onProgress:e=>{T(e.projectId),I(e.filesTransferred)},onDone:()=>{T(null),I(0)}}),s.useEffect(()=>{let s=!1;return h().then(e=>{s||(a(e),L(e.defaultExcludes.join("\n")))}).catch(s=>m.error(e("sync_section.load_failed",{message:s.message}))).finally(()=>{s||l(!1)}),()=>{s=!0}},[e]);const z=(e,s)=>{a(t=>t?{...t,[e]:s}:t)};return c||!t?n.jsx("div",{className:"text-sm text-muted-foreground",children:e("sync_section.loading")}):n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.server_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-host",children:e("sync_section.host")}),n.jsx(u,{id:"sync-host",value:t.host,onChange:e=>z("host",e.target.value),placeholder:"example.com"})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-port",children:e("sync_section.port")}),n.jsx(u,{id:"sync-port",type:"number",value:t.port,onChange:e=>z("port",Number(e.target.value)||22)})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-user",children:e("sync_section.user")}),n.jsx(u,{id:"sync-user",value:t.user,onChange:e=>z("user",e.target.value),placeholder:"tom"})]}),n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-remote",children:e("sync_section.remote_root")}),n.jsx(u,{id:"sync-remote",value:t.remoteRoot,onChange:e=>z("remoteRoot",e.target.value),placeholder:"/data/projects"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.remote_root_hint")}})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.auth_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{children:e("sync_section.auth_method")}),n.jsxs(O,{value:t.authMethod,onValueChange:e=>z("authMethod",e),children:[n.jsx(B,{children:n.jsx(D,{})}),n.jsxs($,{children:[n.jsx(K,{value:"key",children:"SSH key"}),n.jsx(K,{value:"password",children:e("sync_section.auth_password")})]})]})]}),"key"===t.authMethod?n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-key",children:e("sync_section.key_path")}),n.jsx(u,{id:"sync-key",value:t.keyPath??"",onChange:e=>z("keyPath",e.target.value),placeholder:"~/.ssh/id_rsa"})]}):n.jsxs("div",{children:[n.jsx(x,{htmlFor:"sync-pw",children:e("sync_section.password")}),n.jsx(u,{id:"sync-pw",type:"password",value:P,onChange:e=>H(e.target.value),placeholder:t.passwordSet?e("sync_section.password_set_placeholder"):e("sync_section.password_unset_placeholder")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.sshpass_hint")}})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.strategy_section")}),n.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[n.jsxs("div",{children:[n.jsx(x,{children:e("sync_section.direction")}),n.jsxs(O,{value:t.direction,onValueChange:e=>z("direction",e),children:[n.jsx(B,{children:n.jsx(D,{})}),n.jsxs($,{children:[n.jsx(K,{value:"push",children:e("sync_section.push_label")}),n.jsx(K,{value:"pull",children:e("sync_section.pull_label")}),n.jsx(K,{value:"bidirectional",children:e("sync_section.bidirectional_label")})]})]})]}),n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsxs("div",{className:"flex-1",children:[n.jsx(x,{htmlFor:"sync-cron",children:e("sync_section.cron_label")}),n.jsx(u,{id:"sync-cron",value:t.schedule.cron,onChange:e=>z("schedule",{...t.schedule,cron:e.target.value}),placeholder:"0 3 * * *"}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.cron_hint")}})]}),n.jsxs("div",{className:"flex items-center gap-2 pb-1.5",children:[n.jsx(fe,{checked:t.schedule.enabled,onCheckedChange:e=>z("schedule",{...t.schedule,enabled:e})}),n.jsx("span",{className:"text-xs text-muted-foreground",children:e("sync_section.enable_label")})]})]})]})]}),n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-semibold mb-3",children:e("sync_section.exclude_section")}),n.jsx("textarea",{value:F,onChange:e=>L(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.jsx("p",{className:"text-xs text-muted-foreground mt-1",dangerouslySetInnerHTML:{__html:e("sync_section.exclude_hint")}})]}),n.jsxs("div",{className:"flex flex-wrap gap-2 pt-2 border-t",children:[n.jsxs(p,{onClick:()=>{(async()=>{if(t){r(!0);try{const s=F.split("\n").map(e=>e.trim()).filter(Boolean),n={host:t.host,port:t.port,user:t.user,authMethod:t.authMethod,keyPath:t.keyPath,remoteRoot:t.remoteRoot,direction:t.direction,defaultExcludes:s,schedule:t.schedule};P&&"__keep__"!==P&&(n.password=P);const c=await y(n);a(c),L(c.defaultExcludes.join("\n")),H(""),m.success(e("sync_section.saved"))}catch(s){m.error(e("sync_section.save_failed",{message:s.message}))}finally{r(!1)}}})()},disabled:i,children:[i?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Q,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.save_button")]}),n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{N(!0);try{const s=await f();s.ok?m.success(s.message||e("sync_section.test_ok")):m.error(s.message||e("sync_section.test_failed"))}catch(s){m.error(e("sync_section.test_failed_with_reason",{message:s.message}))}finally{N(!1)}})()},disabled:k,children:[k?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(ie,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.test_button")]}),n.jsx("div",{className:"flex-1"}),w&&E&&n.jsx("span",{className:"text-xs text-muted-foreground self-center mr-1 tabular-nums",children:R>0?e("sync_section.syncing_with_files",{project:E,files:R}):e("sync_section.syncing_no_files",{project:E})}),n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{C(!0);try{const s=await _(),t=s.results.filter(e=>e.ok).length,a=s.results.filter(e=>e.skipped).length,n=s.results.filter(e=>"cancelled"===e.reason).length,c=s.total-t-a-n;n>0?m.info(e("sync_section.bulk_cancelled_toast",{ok:t,skipped:a,cancelled:n,failed:c})):m.success(e("sync_section.bulk_done_toast",{ok:t,skipped:a,failed:c}))}catch(s){m.error(e("sync_section.bulk_failed_toast",{message:s.message}))}finally{C(!1),M(!1),T(null),I(0)}})()},disabled:w,title:e("sync_section.sync_all_title"),children:[w?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(W,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.sync_all_button")]}),w&&n.jsxs(p,{variant:"outline",onClick:()=>{(async()=>{if(w&&!S){M(!0);try{await v(),m.info(e("sync_section.cancel_requested"))}catch(s){m.error(e("sync_section.cancel_failed",{message:s.message})),M(!1)}}})()},disabled:S,title:e("sync_section.cancel_button_title"),children:[S?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(j,{className:"h-3.5 w-3.5 mr-1.5"}),e("sync_section.cancel_button")]})]}),n.jsxs("div",{className:"border-t pt-4 text-xs text-muted-foreground",children:["Per-project push/pull: from inside a project, click the ",n.jsx(W,{className:"inline h-3 w-3"})," / ",n.jsx(b,{className:"inline h-3 w-3"})," buttons in the header. Or call ",n.jsx("code",{children:"POST /api/sync/project/:id"})," with body ",n.jsx("code",{children:'{ "direction": "push" }'}),"."]})]})}function ve(){const e=k(),[t,a]=s.useState(null),[c,l]=s.useState(!0),[i,r]=s.useState(""),[o,d]=s.useState(!1);s.useEffect(()=>{let e=!1;return N().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 —— 使用你自己的账号身份提交,归属清晰,互不影响。"]})]}),c?n.jsxs("div",{className:"text-sm text-muted-foreground flex items-center gap-2",children:[n.jsx(g,{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(se,{className:"h-4 w-4 text-green-500 shrink-0"}),n.jsx("span",{children:"已配置 token,可直接提交"}),n.jsx("div",{className:"flex-1"}),n.jsxs(p,{size:"sm",variant:"outline",onClick:()=>{(async()=>{if(await e({title:"清除 Hub Token",description:"清除后将无法直接提交到 ccweb-hub,需要重新配置 token。确认?",destructive:!0,confirmLabel:"清除"}))try{await C(),a({configured:!1,needsReset:!1}),m.success("已清除")}catch(s){m.error(`清除失败: ${s.message}`)}})()},children:[n.jsx(w,{className:"h-3.5 w-3.5 mr-1"}),"清除"]})]}):(null==t?void 0:t.needsReset)?n.jsxs(n.Fragment,{children:[n.jsx(Z,{className:"h-4 w-4 text-amber-500 shrink-0"}),n.jsx("span",{children:"之前的 token 已失效(服务端密钥可能已轮换),请重新设置"})]}):n.jsxs(n.Fragment,{children:[n.jsx(Z,{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(ne,{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(x,{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(u,{id:"hub-token",type:"password",placeholder:"github_pat_...",value:i,onChange:e=>r(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(p,{onClick:()=>{(async()=>{const e=i.trim();if(e){d(!0);try{const s=await S(e);a(s),r(""),m.success("已保存")}catch(s){m.error(`保存失败: ${s.message}`)}finally{d(!1)}}else m.error("请输入 token")})()},disabled:o||!i.trim(),children:[o?n.jsx(g,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):n.jsx(Q,{className:"h-3.5 w-3.5 mr-1.5"}),"保存"]})})]})]})}function ke(){const{t:e,i18n:s}=o();return n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(le,{className:"h-4 w-4 text-muted-foreground"}),n.jsxs(O,{value:s.language,onValueChange:async t=>{if(M.includes(t)){try{localStorage.setItem(E,t)}catch{}await s.changeLanguage(t);try{await T(t)}catch{m.error(e("language.switch_failed"))}}},children:[n.jsx(B,{className:"w-40",children:n.jsx(D,{})}),n.jsxs($,{children:[n.jsx(K,{value:"zh",children:e("language.zh")}),n.jsx(K,{value:"en",children:e("language.en")})]})]})]})}function Ne(){const{t:e}=o(),t=R(),[a]=I(),c=a.get("tab")||"sync",[l,i]=s.useState(()=>P()),[r,d]=s.useState(!1),[h,g]=s.useState({webhookEnabled:!1}),[j,b]=s.useState(""),[y,f]=s.useState(!1),[_,v]=s.useState(()=>H(F.usageMonitorTool,"claude"));s.useEffect(()=>{L().then(e=>{g(e),b(e.webhookUrl??"")}).catch(()=>{})},[]);const k=(e,s)=>{const t=parseInt(s,10);isNaN(t)||t<1||(i(s=>({...s,[e]:t})),d(!0))};return n.jsx("div",{className:"min-h-screen bg-background",children:n.jsxs("div",{className:"max-w-3xl mx-auto p-6",children:[n.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[n.jsxs(p,{variant:"ghost",size:"sm",onClick:()=>t("/"),children:[n.jsx(z,{className:"h-4 w-4 mr-1"}),e("common.back")]}),n.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:e("settings.title")})]}),n.jsxs(X,{defaultValue:c,children:[n.jsxs(Y,{className:"mb-4",children:[n.jsxs(J,{value:"sync",children:[n.jsx(re,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_sync")]}),n.jsxs(J,{value:"hub",children:[n.jsx(ce,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_hub")]}),n.jsxs(J,{value:"notifications",children:[n.jsx(ae,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_notifications")]}),n.jsxs(J,{value:"pomodoro",children:[n.jsx(q,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_pomodoro")]}),n.jsxs(J,{value:"usage",children:[n.jsx(te,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_usage")]}),n.jsxs(J,{value:"language",children:[n.jsx(le,{className:"h-3.5 w-3.5 mr-1.5"}),e("settings.tab_language")]})]}),n.jsx(ee,{value:"sync",children:n.jsx(_e,{})}),n.jsx(ee,{value:"hub",children:n.jsx(ve,{})}),n.jsx(ee,{value:"notifications",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.browser_notify.title")}),n.jsx("p",{className:"text-xs text-muted-foreground",children:e("settings.browser_notify.description")})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.webhook.title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.webhook.description")})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:"Webhook URL"}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(u,{placeholder:"https://hooks.slack.com/...",value:j,onChange:e=>b(e.target.value),className:"font-mono text-xs"}),n.jsx(p,{size:"sm",onClick:()=>{(async()=>{f(!0);try{const s=await A({webhookEnabled:j.trim().length>0,webhookUrl:j.trim()||void 0});g(s),m.success(e("settings.webhook.saved"))}catch{m.error(e("settings.webhook.save_failed"))}finally{f(!1)}})()},disabled:y,children:e(y?"common.saving":"common.save")})]}),h.webhookEnabled&&h.webhookUrl&&n.jsxs("p",{className:"text-xs text-green-500",children:[e("settings.webhook.enabled_prefix")," ",h.webhookUrl]})]})]})]})}),n.jsx(ee,{value:"pomodoro",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.section_title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.pomodoro.section_desc")})]}),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(x,{className:"text-xs",children:e("settings.pomodoro.work_minutes")}),n.jsx(u,{type:"number",min:1,max:120,value:l.workMinutes,onChange:e=>k("workMinutes",e.target.value),className:"w-full"})]}),n.jsxs("div",{className:"space-y-1.5",children:[n.jsx(x,{className:"text-xs",children:e("settings.pomodoro.break_minutes")}),n.jsx(u,{type:"number",min:1,max:60,value:l.breakMinutes,onChange:e=>k("breakMinutes",e.target.value),className:"w-full"})]})]}),r&&n.jsxs(p,{size:"sm",onClick:()=>{V(F.pomodoroConfig,l,!0),d(!1),m.success(e("settings.pomodoro.saved"))},children:[n.jsx(Q,{className:"h-3.5 w-3.5 mr-1.5"}),e("common.save")]})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.pomodoro.howto_title")}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsxs("li",{children:[n.jsx(q,{className:"h-3 w-3 inline-block mx-0.5"})," ",e("settings.pomodoro.howto_item_1")]}),n.jsx("li",{children:e("settings.pomodoro.howto_item_2")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_3")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_4")}),n.jsx("li",{children:e("settings.pomodoro.howto_item_5")})]})]})]})}),n.jsx(ee,{value:"usage",children:n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-4",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.section_title")}),n.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e("settings.usage.section_desc")})]}),n.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=>n.jsxs("label",{className:"flex items-start gap-3 rounded-md border p-3 cursor-pointer transition-colors "+(_===s.key?"border-blue-500/50 bg-blue-500/5":"border-border hover:bg-muted/30"),children:[n.jsx("input",{type:"radio",name:"usageTool",value:s.key,checked:_===s.key,onChange:()=>{v(s.key),V(F.usageMonitorTool,s.key),window.dispatchEvent(new Event("ccweb:usage-tool-change")),m.success(e("settings.usage.switched_toast",{tool:s.label}))},className:"mt-0.5"}),n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:s.label}),n.jsx("div",{className:"text-xs text-muted-foreground",children:s.desc})]})]},s.key))})]}),n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-2",children:[n.jsx("h3",{className:"text-sm font-medium",children:e("settings.usage.info_title")}),n.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1 list-disc list-inside",children:[n.jsx("li",{children:e("settings.usage.info_item_1")}),n.jsx("li",{children:e("settings.usage.info_item_2")}),n.jsx("li",{children:e("settings.usage.info_item_3")}),n.jsx("li",{children:e("settings.usage.info_item_4")})]})]})]})}),n.jsx(ee,{value:"language",children:n.jsx("div",{className:"space-y-6",children:n.jsxs("div",{className:"rounded-xl border border-border p-4 space-y-3",children:[n.jsx("div",{children:n.jsx("h3",{className:"text-sm font-medium",children:e("language.label")})}),n.jsx(ke,{})]})})})]})]})})}export{Ne as SettingsPage};
@@ -1,13 +1,13 @@
1
- import{c as e,aG as s,r as t,bg as a,bh as r,t as n,bi as l,bj as i,bk as c,ac as d,bl as o,j as m,B as x,aJ as u,d as p,I as h,T as g,q as f,D as j,aC as b,aD as N,A as y,ao as v,au as k}from"./index-CZ4PAGPA.js";import{S as w,U as C}from"./user-B4YUPhU8.js";import{C as S}from"./chevron-down-COdWD3xd.js";
1
+ import{c as e,aH as s,r as t,bg as a,bh as r,t as n,bi as l,bj as i,bk as c,ac as d,bl as o,j as m,B as x,aK as u,d as p,I as h,T as g,p as f,D as j,aC as b,aD as N,A as y,ao as v,au as k}from"./index-C7QaGdFu.js";import{S as w,U as C}from"./user-BG-Xqf8M.js";import{C as S}from"./chevron-down-Bc6Xpnnk.js";
2
2
  /**
3
3
  * @license lucide-react v0.309.0 - ISC
4
4
  *
5
5
  * This source code is licensed under the ISC license.
6
6
  * See the LICENSE file in the root directory of this source tree.
7
- */const P=e("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),q=e("Puzzle",[["path",{d:"M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z",key:"i0oyt7"}]]),E=e("Tag",[["path",{d:"M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z",key:"14b2ls"}],["path",{d:"M7 7h.01",key:"7u93v4"}]]);
7
+ */const P=e("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]),E=e("Puzzle",[["path",{d:"M19.439 7.85c-.049.322.059.648.289.878l1.568 1.568c.47.47.706 1.087.706 1.704s-.235 1.233-.706 1.704l-1.611 1.611a.98.98 0 0 1-.837.276c-.47-.07-.802-.48-.968-.925a2.501 2.501 0 1 0-3.214 3.214c.446.166.855.497.925.968a.979.979 0 0 1-.276.837l-1.61 1.61a2.404 2.404 0 0 1-1.705.707 2.402 2.402 0 0 1-1.704-.706l-1.568-1.568a1.026 1.026 0 0 0-.877-.29c-.493.074-.84.504-1.02.968a2.5 2.5 0 1 1-3.237-3.237c.464-.18.894-.527.967-1.02a1.026 1.026 0 0 0-.289-.877l-1.568-1.568A2.402 2.402 0 0 1 1.998 12c0-.617.236-1.234.706-1.704L4.23 8.77c.24-.24.581-.353.917-.303.515.077.877.528 1.073 1.01a2.5 2.5 0 1 0 3.259-3.259c-.482-.196-.933-.558-1.01-1.073-.05-.336.062-.676.303-.917l1.525-1.525A2.402 2.402 0 0 1 12 1.998c.617 0 1.234.236 1.704.706l1.568 1.568c.23.23.556.338.877.29.493-.074.84-.504 1.02-.968a2.5 2.5 0 1 1 3.237 3.237c-.464.18-.894.527-.967 1.02Z",key:"i0oyt7"}]]),q=e("Tag",[["path",{d:"M12 2H2v10l9.29 9.29c.94.94 2.48.94 3.42 0l6.58-6.58c.94-.94.94-2.48 0-3.42L12 2Z",key:"14b2ls"}],["path",{d:"M7 7h.01",key:"7u93v4"}]]);
8
8
  /**
9
9
  * @license lucide-react v0.309.0 - ISC
10
10
  *
11
11
  * This source code is licensed under the ISC license.
12
12
  * See the LICENSE file in the root directory of this source tree.
13
- */function z(){const e=s(),[z,M]=t.useState("prompts"),[H,_]=t.useState(""),[F,Q]=t.useState([]),[W,D]=t.useState([]),[I,O]=t.useState(!1),[T,U]=t.useState(null);t.useEffect(()=>{"plugins"===z&&(O(!0),Promise.all([a().catch(()=>[]),fetch("/api/skillhub/plugins").then(e=>e.ok?e.json():[]).catch(()=>[])]).then(([e,s])=>{Q(e),D(s)}).finally(()=>O(!1)))},[z]);const Z=t.useCallback(async e=>{if(!T){U(e.id);try{await r(e.downloadUrl),n.success(`已安装 ${e.name}`);const s=await a().catch(()=>[]);Q(s)}catch(s){n.error(s instanceof Error?s.message:"安装失败")}finally{U(null)}}},[T]),B=t.useCallback(async e=>{try{await l(e),Q(s=>s.filter(s=>s.id!==e)),n.success("已卸载")}catch(s){n.error(s instanceof Error?s.message:"卸载失败")}},[]),G=t.useCallback(async(e,s)=>{try{await i(e,s),Q(t=>t.map(t=>t.id===e?{...t,enabled:s}:t))}catch(t){n.error(t instanceof Error?t.message:"操作失败")}},[]),[J,$]=t.useState([]),[K,R]=t.useState(!0),[V,X]=t.useState(null),[Y,ee]=t.useState("all"),[se,te]=t.useState(null),[ae,re]=t.useState(null),[ne,le]=t.useState(new Set),[ie,ce]=t.useState(null);t.useEffect(()=>{Promise.all([c(),d().catch(()=>[]),o().catch(()=>[])]).then(([e,s,t])=>{$(e);const a=new Set;for(const r of e)"quick-prompt"===r.kind?s.some(e=>e.label===r.label&&e.command===r.body)&&a.add(r.id):t.some(e=>e.label===r.label&&e.command===r.body)&&a.add(r.id);le(a)}).catch(e=>X(e instanceof Error?e.message:"Failed to load CCWeb Hub")).finally(()=>R(!1))},[]);const de=t.useMemo(()=>{const e=new Set;return J.forEach(s=>{var t;return null==(t=s.tags)?void 0:t.forEach(s=>e.add(s))}),[...e].sort()},[J]),oe=t.useMemo(()=>{let e=J;"all"!==Y&&(e=e.filter(e=>e.kind===Y)),"__untagged__"===se?e=e.filter(e=>!e.tags||0===e.tags.length):se&&(e=e.filter(e=>{var s;return null==(s=e.tags)?void 0:s.includes(se)}));const s=H.trim().toLowerCase();return s&&(e=e.filter(e=>e.label.toLowerCase().includes(s)||e.body.toLowerCase().includes(s)||(e.description??"").toLowerCase().includes(s)||(e.author??"").toLowerCase().includes(s)||(e.tags??[]).some(e=>e.toLowerCase().includes(s)))),e},[J,Y,se,H]);return m.jsxs("div",{className:"min-h-screen bg-background",children:[m.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:m.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[m.jsxs(x,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[m.jsx(u,{className:"h-4 w-4 mr-1"}),"返回"]}),m.jsx("h1",{className:"font-semibold text-lg",children:"CCWeb Hub"}),m.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[m.jsx("button",{onClick:()=>M("prompts"),className:p("px-3 py-1 rounded-md text-sm transition-colors","prompts"===z?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:"Prompts"}),m.jsxs("button",{onClick:()=>M("plugins"),className:p("px-3 py-1 rounded-md text-sm transition-colors flex items-center gap-1","plugins"===z?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:[m.jsx(q,{className:"h-3.5 w-3.5"}),"插件"]})]}),m.jsx("div",{className:"flex-1"}),m.jsxs("div",{className:"relative w-64",children:[m.jsx(w,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),m.jsx(h,{placeholder:"prompts"===z?"搜索 prompt...":"搜索插件...",value:H,onChange:e=>_(e.target.value),className:"pl-8 h-9"})]})]})}),m.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:["plugins"===z&&m.jsxs("div",{children:[I&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),!I&&m.jsxs(m.Fragment,{children:[F.length>0&&m.jsxs("div",{className:"mb-8",children:[m.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:"已安装"}),m.jsx("div",{className:"space-y-2",children:F.map(e=>m.jsxs("div",{className:"rounded-xl border bg-card p-4 flex items-center gap-4",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"font-medium text-sm",children:e.name}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.version]}),m.jsx("span",{className:p("text-xs px-1.5 py-0.5 rounded",e.enabled?"bg-green-500/10 text-green-500":"bg-muted text-muted-foreground"),children:e.enabled?"启用":"禁用"})]}),m.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.permissions.length>0&&m.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:e.permissions.map(e=>m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:e},e))})]}),m.jsx(x,{size:"sm",variant:"ghost",onClick:()=>G(e.id,!e.enabled),title:e.enabled?"禁用":"启用",children:m.jsx(P,{className:p("h-4 w-4",e.enabled?"text-green-500":"text-muted-foreground")})}),m.jsx(x,{size:"sm",variant:"ghost",onClick:()=>B(e.id),title:"卸载",children:m.jsx(g,{className:"h-4 w-4 text-red-400"})})]},e.id))})]}),m.jsxs("div",{children:[m.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:F.length>0?"更多插件":"可用插件"}),0===W.length&&m.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[m.jsx(q,{className:"h-10 w-10 mx-auto mb-3 opacity-30"}),m.jsx("p",{className:"text-sm",children:"Hub 暂无可用插件"})]}),m.jsx("div",{className:"space-y-2",children:W.filter(e=>!F.some(s=>s.id===e.id)).map((e,s)=>{const t=T===e.id;return m.jsxs(f.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:.03*s},className:"rounded-xl border bg-card p-4 flex items-center gap-4",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"font-medium text-sm",children:e.name}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.version]}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["by ",e.author]})]}),m.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.description}),e.permissions.length>0&&m.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:e.permissions.map(e=>m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:e},e))})]}),m.jsxs(x,{size:"sm",disabled:t,onClick:()=>Z(e),children:[m.jsx(j,{className:"h-3.5 w-3.5 mr-1"}),t?"安装中...":"安装"]})]},e.id)})})]})]})]}),"prompts"===z&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[m.jsx(A,{active:"all"===Y,onClick:()=>ee("all"),children:"全部"}),m.jsxs(A,{active:"quick-prompt"===Y,onClick:()=>ee("quick-prompt"),children:[m.jsx(b,{className:"h-3 w-3"}),"Quick Prompts"]}),m.jsxs(A,{active:"agent-prompt"===Y,onClick:()=>ee("agent-prompt"),children:[m.jsx(N,{className:"h-3 w-3"}),"Agent Prompts"]})]}),de.length>0&&m.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[m.jsx(L,{active:null===se,onClick:()=>te(null),children:"全部标签"}),de.map(e=>m.jsx(L,{active:se===e,onClick:()=>te(se===e?null:e),children:e},e))]}),K&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),V&&m.jsx("div",{className:"text-center text-destructive py-20",children:V}),!K&&!V&&0===J.length&&m.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[m.jsx("p",{className:"text-lg mb-2",children:"CCWeb Hub 还没有 prompt"}),m.jsx("p",{className:"text-sm",children:'在 Quick Prompts 或 Agent Prompts 卡片上右键选择"共享"来提交第一个吧!'})]}),!K&&!V&&J.length>0&&0===oe.length&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的 prompt"}),m.jsx("div",{className:"space-y-3",children:oe.map((e,s)=>{var t;const a=ae===e.id,r=ne.has(e.id),l=ie===e.id;return m.jsxs(f.div,{layout:!0,initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:.03*s,ease:"easeOut"},className:"rounded-xl border bg-card p-4 cursor-pointer hover:border-muted-foreground/30 transition-colors",onClick:()=>re(a?null:e.id),children:[m.jsxs("div",{className:"flex items-start justify-between gap-4",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsxs("span",{className:p("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium","quick-prompt"===e.kind?"bg-blue-500/15 text-blue-400":"bg-green-500/15 text-green-500"),children:["quick-prompt"===e.kind?m.jsx(b,{className:"h-2.5 w-2.5"}):m.jsx(N,{className:"h-2.5 w-2.5"}),"quick-prompt"===e.kind?"Quick":"Agent"]}),m.jsx("h3",{className:"font-medium text-sm truncate",children:e.label}),null==(t=e.tags)?void 0:t.map(e=>m.jsxs("span",{className:"inline-flex items-center gap-0.5 px-2 py-0.5 rounded-full text-xs bg-muted text-muted-foreground",children:[m.jsx(E,{className:"h-2.5 w-2.5"}),e]},e))]}),e.description&&m.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:e.description}),m.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[e.author&&m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx(C,{className:"h-3 w-3"}),e.author]}),m.jsx("code",{className:"text-[10px] opacity-60",children:e.file})]})]}),m.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxs(x,{size:"sm",variant:r?"ghost":"outline",disabled:l||r,onClick:s=>{(async(e,s)=>{if(s.stopPropagation(),!ie&&!ne.has(e.id)){ce(e.id);try{"quick-prompt"===e.kind?(await v({label:e.label,command:e.body}),n.success("已导入到全局快捷 Prompts")):(await k({label:e.label,command:e.body}),n.success("已导入到全局 Agent Prompts")),le(s=>new Set(s).add(e.id))}catch(t){n.error(t instanceof Error?t.message:"导入失败")}finally{ce(null)}}})(e,s)},title:"quick-prompt"===e.kind?"导入到全局快捷 Prompts":"导入到全局 Agent Prompts",children:[m.jsx(j,{className:"h-3.5 w-3.5 mr-1"}),r?"已导入":l?"导入中...":"导入"]}),m.jsx(f.span,{animate:{rotate:a?180:0},transition:{duration:.2},children:m.jsx(S,{className:"h-4 w-4 text-muted-foreground"})})]})]}),m.jsx(y,{children:a&&m.jsx(f.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:m.jsx("div",{className:"mt-3 pt-3 border-t",children:m.jsx("pre",{className:"text-xs font-mono bg-muted rounded p-3 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:e.body})})})})]},e.id)})})]})]})]})}function A({active:e,onClick:s,children:t}){return m.jsx("button",{onClick:s,className:p("flex items-center gap-1 px-3 py-1 rounded-full text-xs font-medium transition-colors",e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),children:t})}function L({active:e,onClick:s,children:t}){return m.jsx("button",{onClick:s,className:p("px-3 py-1 rounded-full text-xs font-medium transition-colors",e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),children:t})}export{z as SkillHubPage};
13
+ */function z(){const e=s(),[z,M]=t.useState("prompts"),[H,_]=t.useState(""),[F,Q]=t.useState([]),[W,D]=t.useState([]),[I,O]=t.useState(!1),[T,U]=t.useState(null);t.useEffect(()=>{"plugins"===z&&(O(!0),Promise.all([a().catch(()=>[]),fetch("/api/skillhub/plugins").then(e=>e.ok?e.json():[]).catch(()=>[])]).then(([e,s])=>{Q(e),D(s)}).finally(()=>O(!1)))},[z]);const Z=t.useCallback(async e=>{if(!T){U(e.id);try{await r(e.downloadUrl),n.success(`已安装 ${e.name}`);const s=await a().catch(()=>[]);Q(s)}catch(s){n.error(s instanceof Error?s.message:"安装失败")}finally{U(null)}}},[T]),B=t.useCallback(async e=>{try{await l(e),Q(s=>s.filter(s=>s.id!==e)),n.success("已卸载")}catch(s){n.error(s instanceof Error?s.message:"卸载失败")}},[]),K=t.useCallback(async(e,s)=>{try{await i(e,s),Q(t=>t.map(t=>t.id===e?{...t,enabled:s}:t))}catch(t){n.error(t instanceof Error?t.message:"操作失败")}},[]),[$,G]=t.useState([]),[J,R]=t.useState(!0),[V,X]=t.useState(null),[Y,ee]=t.useState("all"),[se,te]=t.useState(null),[ae,re]=t.useState(null),[ne,le]=t.useState(new Set),[ie,ce]=t.useState(null);t.useEffect(()=>{Promise.all([c(),d().catch(()=>[]),o().catch(()=>[])]).then(([e,s,t])=>{G(e);const a=new Set;for(const r of e)"quick-prompt"===r.kind?s.some(e=>e.label===r.label&&e.command===r.body)&&a.add(r.id):t.some(e=>e.label===r.label&&e.command===r.body)&&a.add(r.id);le(a)}).catch(e=>X(e instanceof Error?e.message:"Failed to load CCWeb Hub")).finally(()=>R(!1))},[]);const de=t.useMemo(()=>{const e=new Set;return $.forEach(s=>{var t;return null==(t=s.tags)?void 0:t.forEach(s=>e.add(s))}),[...e].sort()},[$]),oe=t.useMemo(()=>{let e=$;"all"!==Y&&(e=e.filter(e=>e.kind===Y)),"__untagged__"===se?e=e.filter(e=>!e.tags||0===e.tags.length):se&&(e=e.filter(e=>{var s;return null==(s=e.tags)?void 0:s.includes(se)}));const s=H.trim().toLowerCase();return s&&(e=e.filter(e=>e.label.toLowerCase().includes(s)||e.body.toLowerCase().includes(s)||(e.description??"").toLowerCase().includes(s)||(e.author??"").toLowerCase().includes(s)||(e.tags??[]).some(e=>e.toLowerCase().includes(s)))),e},[$,Y,se,H]);return m.jsxs("div",{className:"min-h-screen bg-background",children:[m.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:m.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[m.jsxs(x,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[m.jsx(u,{className:"h-4 w-4 mr-1"}),"返回"]}),m.jsx("h1",{className:"font-semibold text-lg",children:"CCWeb Hub"}),m.jsxs("div",{className:"flex items-center gap-1 ml-4",children:[m.jsx("button",{onClick:()=>M("prompts"),className:p("px-3 py-1 rounded-md text-sm transition-colors","prompts"===z?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:"Prompts"}),m.jsxs("button",{onClick:()=>M("plugins"),className:p("px-3 py-1 rounded-md text-sm transition-colors flex items-center gap-1","plugins"===z?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent"),children:[m.jsx(E,{className:"h-3.5 w-3.5"}),"插件"]})]}),m.jsx("div",{className:"flex-1"}),m.jsxs("div",{className:"relative w-64",children:[m.jsx(w,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),m.jsx(h,{placeholder:"prompts"===z?"搜索 prompt...":"搜索插件...",value:H,onChange:e=>_(e.target.value),className:"pl-8 h-9"})]})]})}),m.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:["plugins"===z&&m.jsxs("div",{children:[I&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),!I&&m.jsxs(m.Fragment,{children:[F.length>0&&m.jsxs("div",{className:"mb-8",children:[m.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:"已安装"}),m.jsx("div",{className:"space-y-2",children:F.map(e=>m.jsxs("div",{className:"rounded-xl border bg-card p-4 flex items-center gap-4",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"font-medium text-sm",children:e.name}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.version]}),m.jsx("span",{className:p("text-xs px-1.5 py-0.5 rounded",e.enabled?"bg-green-500/10 text-green-500":"bg-muted text-muted-foreground"),children:e.enabled?"启用":"禁用"})]}),m.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.permissions.length>0&&m.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:e.permissions.map(e=>m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:e},e))})]}),m.jsx(x,{size:"sm",variant:"ghost",onClick:()=>K(e.id,!e.enabled),title:e.enabled?"禁用":"启用",children:m.jsx(P,{className:p("h-4 w-4",e.enabled?"text-green-500":"text-muted-foreground")})}),m.jsx(x,{size:"sm",variant:"ghost",onClick:()=>B(e.id),title:"卸载",children:m.jsx(g,{className:"h-4 w-4 text-red-400"})})]},e.id))})]}),m.jsxs("div",{children:[m.jsx("h2",{className:"text-sm font-medium text-muted-foreground mb-3",children:F.length>0?"更多插件":"可用插件"}),0===W.length&&m.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[m.jsx(E,{className:"h-10 w-10 mx-auto mb-3 opacity-30"}),m.jsx("p",{className:"text-sm",children:"Hub 暂无可用插件"})]}),m.jsx("div",{className:"space-y-2",children:W.filter(e=>!F.some(s=>s.id===e.id)).map((e,s)=>{const t=T===e.id;return m.jsxs(f.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:.03*s},className:"rounded-xl border bg-card p-4 flex items-center gap-4",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("span",{className:"font-medium text-sm",children:e.name}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",e.version]}),m.jsxs("span",{className:"text-xs text-muted-foreground",children:["by ",e.author]})]}),m.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.description}),e.permissions.length>0&&m.jsx("div",{className:"flex gap-1 mt-1 flex-wrap",children:e.permissions.map(e=>m.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-500/10 text-blue-400",children:e},e))})]}),m.jsxs(x,{size:"sm",disabled:t,onClick:()=>Z(e),children:[m.jsx(j,{className:"h-3.5 w-3.5 mr-1"}),t?"安装中...":"安装"]})]},e.id)})})]})]})]}),"prompts"===z&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[m.jsx(A,{active:"all"===Y,onClick:()=>ee("all"),children:"全部"}),m.jsxs(A,{active:"quick-prompt"===Y,onClick:()=>ee("quick-prompt"),children:[m.jsx(b,{className:"h-3 w-3"}),"Quick Prompts"]}),m.jsxs(A,{active:"agent-prompt"===Y,onClick:()=>ee("agent-prompt"),children:[m.jsx(N,{className:"h-3 w-3"}),"Agent Prompts"]})]}),de.length>0&&m.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[m.jsx(L,{active:null===se,onClick:()=>te(null),children:"全部标签"}),de.map(e=>m.jsx(L,{active:se===e,onClick:()=>te(se===e?null:e),children:e},e))]}),J&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),V&&m.jsx("div",{className:"text-center text-destructive py-20",children:V}),!J&&!V&&0===$.length&&m.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[m.jsx("p",{className:"text-lg mb-2",children:"CCWeb Hub 还没有 prompt"}),m.jsx("p",{className:"text-sm",children:'在 Quick Prompts 或 Agent Prompts 卡片上右键选择"共享"来提交第一个吧!'})]}),!J&&!V&&$.length>0&&0===oe.length&&m.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的 prompt"}),m.jsx("div",{className:"space-y-3",children:oe.map((e,s)=>{var t;const a=ae===e.id,r=ne.has(e.id),l=ie===e.id;return m.jsxs(f.div,{layout:!0,initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:.03*s,ease:"easeOut"},className:"rounded-xl border bg-card p-4 cursor-pointer hover:border-muted-foreground/30 transition-colors",onClick:()=>re(a?null:e.id),children:[m.jsxs("div",{className:"flex items-start justify-between gap-4",children:[m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[m.jsxs("span",{className:p("inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] font-medium","quick-prompt"===e.kind?"bg-blue-500/15 text-blue-400":"bg-green-500/15 text-green-500"),children:["quick-prompt"===e.kind?m.jsx(b,{className:"h-2.5 w-2.5"}):m.jsx(N,{className:"h-2.5 w-2.5"}),"quick-prompt"===e.kind?"Quick":"Agent"]}),m.jsx("h3",{className:"font-medium text-sm truncate",children:e.label}),null==(t=e.tags)?void 0:t.map(e=>m.jsxs("span",{className:"inline-flex items-center gap-0.5 px-2 py-0.5 rounded-full text-xs bg-muted text-muted-foreground",children:[m.jsx(q,{className:"h-2.5 w-2.5"}),e]},e))]}),e.description&&m.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:e.description}),m.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[e.author&&m.jsxs("span",{className:"flex items-center gap-1",children:[m.jsx(C,{className:"h-3 w-3"}),e.author]}),m.jsx("code",{className:"text-[10px] opacity-60",children:e.file})]})]}),m.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[m.jsxs(x,{size:"sm",variant:r?"ghost":"outline",disabled:l||r,onClick:s=>{(async(e,s)=>{if(s.stopPropagation(),!ie&&!ne.has(e.id)){ce(e.id);try{"quick-prompt"===e.kind?(await v({label:e.label,command:e.body}),n.success("已导入到全局快捷 Prompts")):(await k({label:e.label,command:e.body}),n.success("已导入到全局 Agent Prompts")),le(s=>new Set(s).add(e.id))}catch(t){n.error(t instanceof Error?t.message:"导入失败")}finally{ce(null)}}})(e,s)},title:"quick-prompt"===e.kind?"导入到全局快捷 Prompts":"导入到全局 Agent Prompts",children:[m.jsx(j,{className:"h-3.5 w-3.5 mr-1"}),r?"已导入":l?"导入中...":"导入"]}),m.jsx(f.span,{animate:{rotate:a?180:0},transition:{duration:.2},children:m.jsx(S,{className:"h-4 w-4 text-muted-foreground"})})]})]}),m.jsx(y,{children:a&&m.jsx(f.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:m.jsx("div",{className:"mt-3 pt-3 border-t",children:m.jsx("pre",{className:"text-xs font-mono bg-muted rounded p-3 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:e.body})})})})]},e.id)})})]})]})]})}function A({active:e,onClick:s,children:t}){return m.jsx("button",{onClick:s,className:p("flex items-center gap-1 px-3 py-1 rounded-full text-xs font-medium transition-colors",e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),children:t})}function L({active:e,onClick:s,children:t}){return m.jsx("button",{onClick:s,className:p("px-3 py-1 rounded-full text-xs font-medium transition-colors",e?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),children:t})}export{z as SkillHubPage};