@bkm016/basalt 0.1.9 → 0.1.11

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 (188) hide show
  1. package/{chunk-0xd9mnc2.js → chunk-jymx3a77.js} +165 -152
  2. package/{chunk-66h5qpc6.js → chunk-zq32mwxj.js} +134 -134
  3. package/compiled.js +1 -1
  4. package/package.json +1 -1
  5. package/ui-test-worker.js +1 -1
  6. package/web/{chunk-9yfftz38.js → chunk-05mvzx00.js} +1 -1
  7. package/web/chunk-086dshck.js +1 -0
  8. package/web/chunk-0fy590s0.js +1 -0
  9. package/web/{chunk-4a6gdrbs.js → chunk-0hvxb5d5.js} +1 -1
  10. package/web/chunk-0mdf1qja.js +1 -0
  11. package/web/{chunk-dz7g1gnv.js → chunk-0y971zgq.js} +2 -2
  12. package/web/{chunk-fjb3ksfd.js → chunk-1t38sgrk.js} +2 -2
  13. package/web/{chunk-66wb0p6e.js → chunk-1zfxaafq.js} +1 -1
  14. package/web/{chunk-p9hfcamx.js → chunk-27812gqr.js} +5 -5
  15. package/web/{chunk-sk1wkgjw.js → chunk-2ds0a2z1.js} +3 -3
  16. package/web/{chunk-ddyyc20r.js → chunk-2f2agfpj.js} +11 -11
  17. package/web/{chunk-3ecrkvr3.js → chunk-2tsxj613.js} +3 -3
  18. package/web/{chunk-y2rzeb4v.js → chunk-2weaa3gn.js} +2 -2
  19. package/web/{chunk-0pghpg4y.js → chunk-3020mmp1.js} +1 -1
  20. package/web/{chunk-mykrm8ba.js → chunk-30aeb767.js} +2 -2
  21. package/web/chunk-32zmk3f5.js +1 -0
  22. package/web/{chunk-zb2bkr7f.js → chunk-36dc7tcg.js} +2 -2
  23. package/web/{chunk-nnyc889n.js → chunk-3a57m7xm.js} +3 -3
  24. package/web/{chunk-8w7fyb3v.js → chunk-3b4wqmnh.js} +7 -7
  25. package/web/chunk-3d3wnh8a.js +2 -0
  26. package/web/{chunk-601k823s.js → chunk-3ftb27f3.js} +8 -8
  27. package/web/{chunk-c6yacwbc.js → chunk-47mbbmst.js} +3 -3
  28. package/web/chunk-48479gnx.js +1 -0
  29. package/web/{chunk-qsqtwf34.js → chunk-4gc663j0.js} +2 -2
  30. package/web/{chunk-kcjz03h5.js → chunk-4rwwtfnd.js} +2 -2
  31. package/web/{chunk-eqndhs21.js → chunk-4wwd3pfz.js} +2 -2
  32. package/web/{chunk-myd6sc76.js → chunk-57pyz29y.js} +2 -2
  33. package/web/{chunk-mdfksj61.js → chunk-59nk506k.js} +1 -1
  34. package/web/{chunk-db3twjvk.js → chunk-5ahx98zj.js} +9 -9
  35. package/web/chunk-6cjm2yr7.js +1 -0
  36. package/web/{chunk-frnh4zqf.js → chunk-6jb2zyp6.js} +2 -2
  37. package/web/{chunk-ts6jsfdk.js → chunk-793m5jjh.js} +1 -1
  38. package/web/{chunk-3ak5dg10.js → chunk-7dycbjxn.js} +4 -4
  39. package/web/chunk-7ycxz39p.js +1 -0
  40. package/web/{chunk-tftc5v89.js → chunk-8151c970.js} +1 -1
  41. package/web/{chunk-jccz14ye.js → chunk-885kpj14.js} +2 -2
  42. package/web/{chunk-79e08rk1.js → chunk-8csw0mvf.js} +2 -2
  43. package/web/{chunk-m9q5nr8f.js → chunk-8z7texmv.js} +1 -1
  44. package/web/{chunk-v1exk5wd.js → chunk-90fkdzx3.js} +8 -8
  45. package/web/chunk-94denx9h.js +39 -0
  46. package/web/{chunk-5baeh8q7.js → chunk-96xhmmqz.js} +6 -6
  47. package/web/chunk-9jy8nc4r.js +1 -0
  48. package/web/{chunk-5dr4tkem.js → chunk-9kkzmss7.js} +3 -3
  49. package/web/chunk-9wr33d0t.js +1 -0
  50. package/web/{chunk-3pd0qt83.js → chunk-a3pye9ag.js} +3 -3
  51. package/web/chunk-a4tdrxdh.js +1 -0
  52. package/web/chunk-a9fvsyc1.js +1 -0
  53. package/web/chunk-apvbvg4d.js +1 -0
  54. package/web/{chunk-gn8kyz76.js → chunk-b3j07x0n.js} +6 -6
  55. package/web/{chunk-ff1pmd3g.js → chunk-b6sqwmq7.js} +1 -1
  56. package/web/chunk-bkxcc7v5.js +1 -0
  57. package/web/chunk-bve354k7.js +1 -0
  58. package/web/{chunk-zdyys4ar.js → chunk-cbwvfedy.js} +8 -8
  59. package/web/{chunk-eadfxfkw.js → chunk-cpshsp24.js} +1 -1
  60. package/web/chunk-cwpxakby.js +1 -0
  61. package/web/chunk-d3f763n7.js +2 -0
  62. package/web/{chunk-8z0r0wtk.js → chunk-d4519smc.js} +14 -14
  63. package/web/chunk-de29pe57.js +1 -0
  64. package/web/chunk-dk0fnj87.js +1 -0
  65. package/web/{chunk-c57f714b.js → chunk-drchr3yn.js} +2 -2
  66. package/web/chunk-dsbyfvwz.js +1 -0
  67. package/web/{chunk-3hr3ew9w.js → chunk-dtrh40vr.js} +1 -1
  68. package/web/chunk-e68jw0bg.js +1 -0
  69. package/web/{chunk-veam6vk4.js → chunk-e763h2px.js} +67 -67
  70. package/web/{chunk-nvpp0ghj.js → chunk-enryqmj7.js} +5 -5
  71. package/web/{chunk-fpb2dd2d.js → chunk-f79ajymt.js} +2 -2
  72. package/web/{chunk-qq6m2my8.js → chunk-fj753yzt.js} +2 -2
  73. package/web/{chunk-9ctg0f30.js → chunk-g0rtcedn.js} +3 -3
  74. package/web/{chunk-2x4g9t37.js → chunk-g31dbnzm.js} +4 -4
  75. package/web/{chunk-w3w18stt.js → chunk-g4as4zzd.js} +4 -4
  76. package/web/{chunk-6e87m0nm.js → chunk-gten0rpx.js} +2 -2
  77. package/web/{chunk-a0ryzdnp.js → chunk-gyhr27dm.js} +1 -1
  78. package/web/{chunk-98y92vmh.js → chunk-hjyev38w.js} +6 -6
  79. package/web/{chunk-wzd2a4k5.js → chunk-hm8thq7c.js} +4 -4
  80. package/web/{chunk-07agqp8h.js → chunk-j4gvtszc.js} +2 -2
  81. package/web/chunk-jd7npyv9.js +8 -0
  82. package/web/chunk-jhpg2kcf.js +1 -0
  83. package/web/{chunk-9fnr00kv.js → chunk-jqqbkdtw.js} +2 -2
  84. package/web/chunk-jzz5htxp.js +1 -0
  85. package/web/chunk-ka3q31t1.js +1 -0
  86. package/web/chunk-kahab58k.js +1139 -0
  87. package/web/{chunk-af9evdza.js → chunk-kfbgvh0c.js} +1 -1
  88. package/web/chunk-krgvx75q.js +1 -0
  89. package/web/chunk-kxeaj44h.js +1 -0
  90. package/web/chunk-m1rdyvb5.js +1 -0
  91. package/web/{chunk-5v2c0aqk.js → chunk-m24yb8md.js} +2 -2
  92. package/web/chunk-m7k4wr3k.js +1 -0
  93. package/web/chunk-mdj3r75b.js +1 -0
  94. package/web/{chunk-ewx42c11.js → chunk-mpdeqzc9.js} +10 -10
  95. package/web/{chunk-b5h52neg.js → chunk-mykbcvqz.js} +1 -1
  96. package/web/{chunk-7qkav30b.js → chunk-n33753da.js} +1 -1
  97. package/web/{chunk-rasjtvsb.js → chunk-nafe18y9.js} +10 -10
  98. package/web/chunk-nbcpbqq4.js +1 -0
  99. package/web/{chunk-24jhbz82.js → chunk-nhx8pw7p.js} +1 -1
  100. package/web/chunk-nkpdd9hw.js +1 -0
  101. package/web/{chunk-dwjmr0zj.js → chunk-p1yc8hwn.js} +1 -1
  102. package/web/chunk-p29brxyt.js +1 -0
  103. package/web/chunk-p8fbes0t.js +1 -0
  104. package/web/chunk-pbp1p5ex.js +1 -0
  105. package/web/{chunk-xx11yv61.js → chunk-ppjw1mps.js} +4 -4
  106. package/web/{chunk-7tkgbbf9.js → chunk-pq56b3mq.js} +2 -2
  107. package/web/{chunk-vvvd3grf.js → chunk-pzg25qqe.js} +2 -2
  108. package/web/{chunk-spbs56wz.js → chunk-q65zxczs.js} +7 -7
  109. package/web/{chunk-t893141g.js → chunk-q8v5j963.js} +2 -2
  110. package/web/{chunk-vsjpnwsr.js → chunk-qykt7avq.js} +2 -2
  111. package/web/chunk-r6q1301x.js +1 -0
  112. package/web/chunk-r8kghrkb.js +1 -0
  113. package/web/chunk-rhxn7mxg.js +1 -0
  114. package/web/{chunk-2dvbeqt0.js → chunk-rqympya7.js} +2 -2
  115. package/web/{chunk-30b33r2w.js → chunk-s0xy00v5.js} +2 -2
  116. package/web/chunk-svqshmpg.js +1 -0
  117. package/web/chunk-swzxq7r3.css +1 -0
  118. package/web/{chunk-8jcvdd5d.js → chunk-t18tn37m.js} +2 -2
  119. package/web/chunk-tbsaseer.js +1 -0
  120. package/web/{chunk-5jdrev9p.js → chunk-tggja45g.js} +3 -3
  121. package/web/chunk-tgkdyxbn.js +1 -0
  122. package/web/{chunk-rrpn5r5w.js → chunk-tpdcrrf1.js} +1 -1
  123. package/web/chunk-v0zfnvc1.js +1 -0
  124. package/web/{chunk-5a4mj3qz.js → chunk-v3dn9bfw.js} +1 -1
  125. package/web/chunk-vj31fs16.js +1 -0
  126. package/web/chunk-vr79r8vh.js +1 -0
  127. package/web/chunk-wb9tax0m.js +1 -0
  128. package/web/{chunk-rayf24gy.js → chunk-wbwets5x.js} +23 -23
  129. package/web/chunk-x9eghjjd.js +1 -0
  130. package/web/{chunk-awkdw9rw.js → chunk-xbyrgyy0.js} +2 -2
  131. package/web/{chunk-60axh4sa.js → chunk-xjc5fmcr.js} +24 -24
  132. package/web/{chunk-qh62nkem.js → chunk-ydtrc1ay.js} +2 -2
  133. package/web/chunk-yrh86m0n.js +1 -0
  134. package/web/chunk-z3ky5ews.js +2 -0
  135. package/web/{chunk-ctzkqx2g.js → chunk-zdhyq3ch.js} +13 -13
  136. package/web/{chunk-0zwc2rvh.js → chunk-zv73g4qq.js} +2 -2
  137. package/web/index.html +1 -1
  138. package/web/chunk-08sq3cwm.js +0 -1
  139. package/web/chunk-12qf1r6m.js +0 -1
  140. package/web/chunk-24fjnnee.js +0 -1
  141. package/web/chunk-2hrswh3d.js +0 -2
  142. package/web/chunk-2j2atyjw.js +0 -1
  143. package/web/chunk-3h3g3ca3.js +0 -1
  144. package/web/chunk-3pcrxg6m.js +0 -1
  145. package/web/chunk-3txxt0a7.js +0 -1
  146. package/web/chunk-43g4wd7a.js +0 -1
  147. package/web/chunk-5z2n4z9x.css +0 -1
  148. package/web/chunk-6y55gk1n.js +0 -1
  149. package/web/chunk-7qq1ypvj.js +0 -1
  150. package/web/chunk-814kkkmq.js +0 -8
  151. package/web/chunk-8w8atrdh.js +0 -1
  152. package/web/chunk-935mjq1c.js +0 -39
  153. package/web/chunk-942g3eqn.js +0 -1
  154. package/web/chunk-a61zrp66.js +0 -1
  155. package/web/chunk-arnzrqnm.js +0 -1
  156. package/web/chunk-avxk6jpc.js +0 -2
  157. package/web/chunk-bwy3e58v.js +0 -1
  158. package/web/chunk-dnv8dx72.js +0 -1
  159. package/web/chunk-f7jpakwh.js +0 -1
  160. package/web/chunk-fmthkpff.js +0 -1
  161. package/web/chunk-gv99c8zv.js +0 -1
  162. package/web/chunk-h0767tjv.js +0 -1
  163. package/web/chunk-h0c42zy3.js +0 -1
  164. package/web/chunk-hqynf99g.js +0 -1
  165. package/web/chunk-ket6g0yd.js +0 -1
  166. package/web/chunk-mbwwj216.js +0 -1
  167. package/web/chunk-me7dza1c.js +0 -1
  168. package/web/chunk-mzzaet63.js +0 -1
  169. package/web/chunk-n0wazxgz.js +0 -1
  170. package/web/chunk-nvt9tkt4.js +0 -1139
  171. package/web/chunk-ph1dgffm.js +0 -1
  172. package/web/chunk-q34as3v6.js +0 -1
  173. package/web/chunk-qz6r9v1z.js +0 -1
  174. package/web/chunk-rad2s9ha.js +0 -1
  175. package/web/chunk-s37beysw.js +0 -1
  176. package/web/chunk-s60s09mb.js +0 -1
  177. package/web/chunk-tfvcs2xx.js +0 -1
  178. package/web/chunk-tj1fn8v2.js +0 -1
  179. package/web/chunk-vqmj6peg.js +0 -1
  180. package/web/chunk-wdq2tp9e.js +0 -1
  181. package/web/chunk-wkf5xfyr.js +0 -1
  182. package/web/chunk-xa43ndfj.js +0 -2
  183. package/web/chunk-xh4xn1az.js +0 -1
  184. package/web/chunk-xzwxcxb4.js +0 -1
  185. package/web/chunk-y1qty77a.js +0 -1
  186. package/web/chunk-ys2tns0p.js +0 -1
  187. package/web/chunk-z05x9cbm.js +0 -1
  188. package/web/chunk-zgavhnt8.js +0 -1
@@ -0,0 +1 @@
1
+ import{o,Y,i,r,f,e,n,y,te,ne}from"./chunk-kahab58k.js";import{ea}from"./chunk-d3f763n7.js";var T=[{id:"exa",name:"Exa",description:"免密钥 · 综合搜索"},{id:"tavily",name:"Tavily",description:"免密钥 · 支持域名筛选"},{id:"parallel",name:"Parallel",description:"免密钥 · 网页搜索"},{id:"firecrawl",name:"Firecrawl",description:"免密钥 · 网页内容"},{id:"tinyfish",name:"TinyFish",description:"免密钥 · 搜索摘要"},{id:"searxng",name:"SearXNG",description:"免密钥 · 需自建服务"},{id:"brave",name:"Brave",description:"需密钥 · 独立搜索引擎"}];function D(t){return{enabled:t.search.provider!=="off",provider:t.search.provider==="off"?"auto":t.search.provider,searxngUrl:t.search.searxngUrl??"",proxy:t.proxy??"",acceptLanguage:t.acceptLanguage??""}}function G(t,c){return{search:{provider:t.enabled?t.provider:"off",searxngUrl:t.searxngUrl},keys:{...c},proxy:t.proxy,acceptLanguage:t.acceptLanguage}}function A(t,c,u){let p=D(t);if(c.enabled!==p.enabled)return!0;if(c.enabled&&c.provider!==p.provider)return!0;return c.searxngUrl!==p.searxngUrl||c.proxy!==p.proxy||c.acceptLanguage!==p.acceptLanguage||Object.keys(u).length>0}function z({notice:t}){let{cn:c}=y();if(!t)return null;let u=t.type==="success"?ea:te;return n("div",{role:t.type==="error"?"alert":"status",className:c("flex items-start gap-2 text-xs",t.type==="success"?"text-success":"text-danger"),children:[e(u,{className:"mt-0.5 size-4 shrink-0","aria-hidden":"true"}),e("span",{className:"min-w-0 break-words",children:t.text})]})}function I(t){let{Button:c,Input:u,Switch:p,Select:x,StatusChip:S,SettingActions:R,SettingGroup:P,SettingRow:C,cn:w}=y(),m=Y(),l=t.busy!==void 0;return n("form",{id:`${m}-form`,className:"min-w-0 space-y-5",onSubmit:async(s)=>{s.preventDefault(),await t.onSave()},children:[n(P,{title:"联网搜索",children:[e(C,{title:"启用搜索",description:"查询会发送至所选搜索服务",children:e(p,{label:"启用联网搜索",disabled:l,checked:t.draft.enabled,onCheckedChange:(s)=>t.onDraft({...t.draft,enabled:s})})}),e(C,{title:"搜索渠道",description:"自动:Exa → Tavily → Parallel → Firecrawl → TinyFish",children:e("div",{className:"w-48",children:e(x,{id:`${m}-provider`,value:t.draft.provider,disabled:l||!t.draft.enabled,className:"min-w-0",groups:[{options:[{value:"auto",label:"自动",description:"失败时依次切换渠道"},...T.map((s)=>({value:s.id,label:s.name}))]}],onValueChange:(s)=>{let a=s==="auto"?s:T.find((k)=>k.id===s)?.id;if(a)t.onDraft({...t.draft,provider:a})}})})}),(t.draft.provider==="searxng"||t.draft.searxngUrl)&&e(C,{vertical:!0,title:"自建 SearXNG 地址",children:e(u,{id:`${m}-searxng`,"aria-label":"自建 SearXNG 地址",type:"url",maxLength:2000,disabled:l||!t.draft.enabled,value:t.draft.searxngUrl,placeholder:"https://search.example.com",onChange:(s)=>t.onDraft({...t.draft,searxngUrl:s.target.value})})})]}),e(P,{title:"渠道与密钥",description:"检测使用已保存的配置",action:n(c,{type:"button",size:"sm",variant:"ghost",disabled:l,className:"text-dim",onClick:async()=>await t.onCheck("all"),children:[e(ne,{className:w("size-3.5",t.checking==="all"&&"animate-spin"),"aria-hidden":"true"}),t.checking==="all"?"正在检测…":"全部检测"]}),children:T.map((s)=>{let a=s.id,k=a==="searxng"?void 0:t.saved.keys[a],K=k?.source==="environment",W=a==="searxng"?void 0:t.keys[a],h=W==="",v=t.checks[a],L=t.checking==="all"||t.checking===a,b=k?.configured?"已配置密钥":"未配置";if(a==="searxng")b=t.saved.search.searxngUrl?"已配置地址":"未配置地址";if(K)b="来自环境变量";if(h)b="待移除";if(W)b="待保存密钥";let E=v&&!v.ok&&!L?v.error??(v.kind==="search"?v.meta?.failed[0]?.error:v.meta?.error)??"检测失败,请检查配置。":void 0;return n("div",{className:"min-w-0",children:[n(C,{title:s.name,description:n(f,{children:[s.description,K&&" · 请在服务端环境变量中更换或移除",E&&e("span",{role:"status",className:"block break-words text-danger",children:E})]}),children:[L?e(S,{tone:"neutral",pulse:!0,children:"检测中"}):v?e(S,{tone:v.ok?"success":"danger",children:v.ok?`可用 ${v.elapsedMs} ms`:"不可用"}):e("span",{className:w("text-xs",W!==void 0?"text-warning":"text-faint"),children:b}),a!=="searxng"&&!K&&n(f,{children:[e(c,{type:"button",size:"sm",variant:"ghost",disabled:l,"aria-label":`${k?.configured?"更换":"设置"} ${s.name} 密钥`,"aria-expanded":t.editingKey===a,"aria-controls":`${m}-${a}-key-editor`,onClick:()=>t.onEditKey(t.editingKey===a?void 0:a),children:k?.configured?"更换":"设置密钥"}),k?.configured&&!h&&e(c,{type:"button",size:"sm",variant:"ghost",disabled:l,"aria-label":`移除 ${s.name} 密钥`,onClick:()=>{t.onKeys({...t.keys,[a]:""}),t.onEditKey(void 0)},children:"移除"})]}),e(c,{type:"button",size:"sm",variant:"ghost",disabled:l,"aria-label":`检测 ${s.name}`,onClick:async()=>await t.onCheck(a),children:"检测"})]}),a!=="searxng"&&t.editingKey===a&&n("div",{id:`${m}-${a}-key-editor`,className:"flex items-center gap-2 pb-3",children:[e(u,{id:`${m}-${a}-key`,"aria-label":`${s.name} API 密钥`,type:"password",autoComplete:"new-password",maxLength:4000,disabled:l,value:t.keys[a]??"",placeholder:"输入新密钥,保存后生效;只写入,不回显",onChange:(N)=>{let d={...t.keys};if(N.target.value.trim())d[a]=N.target.value;else delete d[a];t.onKeys(d)}}),e(c,{type:"button",size:"sm",variant:"ghost",disabled:l,onClick:()=>{let N={...t.keys};delete N[a],t.onKeys(N),t.onEditKey(void 0)},children:"取消"})]})]},a)})}),n(P,{title:"网络",children:[e(C,{vertical:!0,title:"代理 URL",description:"留空使用服务端环境代理",children:e(u,{id:`${m}-proxy`,"aria-label":"代理 URL",type:"url",maxLength:2000,disabled:l,value:t.draft.proxy,placeholder:"http://127.0.0.1:7890",onChange:(s)=>t.onDraft({...t.draft,proxy:s.target.value})})}),e(C,{vertical:!0,title:"Accept-Language",children:e(u,{id:`${m}-language`,"aria-label":"Accept-Language",maxLength:200,disabled:l,value:t.draft.acceptLanguage,placeholder:"en-US,en;q=0.9",onChange:(s)=>t.onDraft({...t.draft,acceptLanguage:s.target.value})})})]}),n(R,{children:[e("div",{className:"mr-auto min-w-0",children:e(z,{notice:t.notice})}),t.dirty&&e(c,{type:"button",size:"sm",variant:"ghost",disabled:l,onClick:t.onRestore,children:"撤销更改"}),e(c,{form:`${m}-form`,type:"submit",size:"sm",variant:"primary",disabled:l||!t.dirty,children:t.busy==="save"?"保存中…":"保存"})]})]})}function M({connection:t}){let{Button:c}=y(),[u,p]=r(),[x,S]=r(),[R,P]=r({}),[C,w]=r(),[m,l]=r("load"),[s,a]=r(),[k,K]=r({}),[W,h]=r(),[v,L]=r(0),b=i(void 0);o(()=>{let d=new AbortController;return b.current=d,l("load"),h(void 0),p(void 0),S(void 0),P({}),w(void 0),K({}),t.request("/api/plugins/webfetch/settings",{signal:d.signal,cache:v>0?"reload":"default"}).then((g)=>{if(d.signal.aborted)return;p(g),S(D(g))}).catch((g)=>{if(!d.signal.aborted)h({type:"error",text:g instanceof Error?g.message:"加载设置失败,请重试。"})}).finally(()=>{if(!d.signal.aborted)b.current=void 0,l(void 0)}),()=>{d.abort(),b.current?.abort(),b.current=void 0}},[t,v]);async function E(){if(b.current||!u||!x||!A(u,x,R))return;let d=new AbortController;b.current=d,l("save"),h(void 0);try{let g=await t.request("/api/plugins/webfetch/settings",{method:"PATCH",signal:d.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify(G(x,R))});if(d.signal.aborted)return;p(g),S(D(g)),P({}),w(void 0),K({}),h({type:"success",text:"设置已保存。"})}catch(g){if(!d.signal.aborted)h({type:"error",text:g instanceof Error?g.message:"保存失败,请重试。"})}finally{if(!d.signal.aborted)b.current=void 0,l(void 0)}}async function N(d){if(b.current||!u)return;let g=new AbortController;b.current=g,l("test"),a(d),h(void 0);try{let U=await t.request(`/api/plugins/webfetch/test?provider=${d}`,{method:"POST",signal:g.signal});if(g.signal.aborted)return;K((q)=>{let F={...q};for(let B of U.checks)if(B.kind==="search"&&B.provider)F[B.provider]=B;return F})}catch(U){if(!g.signal.aborted)h({type:"error",text:U instanceof Error?U.message:"检测失败,请重试。"})}finally{if(!g.signal.aborted)b.current=void 0,l(void 0),a(void 0)}}if(!u||!x)return n("div",{className:"min-w-0 space-y-3",children:[m==="load"&&e("p",{role:"status",className:"text-sm text-dim",children:"正在加载设置…"}),e(z,{notice:W}),m!=="load"&&e(c,{type:"button",size:"sm",variant:"ghost",onClick:()=>L(v+1),children:"重新加载"})]});return e(I,{saved:u,draft:x,keys:R,editingKey:C,dirty:A(u,x,R),busy:m==="load"?void 0:m,checking:s,checks:k,notice:W,onDraft:(d)=>{S(d),h(void 0)},onKeys:(d)=>{P(d),h(void 0)},onEditKey:w,onSave:E,onCheck:N,onRestore:()=>{S(D(u)),P({}),w(void 0),h(void 0)}})}export{M as default};
@@ -1 +1 @@
1
- import{o,i,r,vt,f,e,n,y,s,Z,rt,ie,tr,X}from"./chunk-nvt9tkt4.js";var pe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],A=s("at-sign",pe);var ue=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],te=s("file-code-2",ue);var xe=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],ne=s("maximize-2",xe);var fe=[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]],J=s("notebook-pen",fe);var be=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],se=s("user",be);var C={approve:{label:"通过",text:"text-success",ring:"ring-success/80",soft:"bg-success/12 text-success"},reject:{label:"反对",text:"text-danger",ring:"ring-danger/80",soft:"bg-danger/12 text-danger"},abstain:{label:"弃权",text:"text-dim",ring:"ring-line-strong",soft:"bg-raised text-dim"},pending:{label:"未表态",text:"text-faint",ring:"ring-line",soft:"bg-raised text-faint"}},ge={thinking:"思考中",reading:"查阅中",speaking:"发言中",idle:"等待中",error:"出错",aborted:"已中止"},U={success:"text-success",warning:"text-warning",danger:"text-danger",neutral:"text-faint"},G={success:"bg-success",warning:"bg-warning",danger:"bg-danger",neutral:"bg-faint"};function q(t){return t==="thinking"||t==="reading"||t==="speaking"}function F(t){let d=q(t.status);return{busy:d,text:d&&t.activeTool?t.activeTool:ge[t.status]}}function Q(t){let d=t.members.filter((v)=>v.verdict==="approve").length,u=t.members.filter((v)=>v.verdict==="reject").length;if(t.state==="running"){if(t.phase==="research")return{tone:"warning",label:"调研中"};if(t.phase==="opening")return{tone:"warning",label:"开场表态"};return{tone:"warning",label:"群聊交流"}}if(t.state==="consensus"){if(d===t.members.length)return{tone:"success",label:"全票通过"};if(u===t.members.length)return{tone:"danger",label:"全票反对"};if(u>d)return{tone:"danger",label:"共识:反对"};return{tone:"success",label:"共识:通过"}}if(t.state==="diverged")return{tone:"warning",label:"存在分歧"};if(t.state==="error")return{tone:"danger",label:"失败"};return{tone:"neutral",label:"已中止"}}function V(t){let d=Math.max(1,Math.round(t/1000));if(d<60)return`${d}s`;return`${Math.floor(d/60)}m ${String(d%60).padStart(2,"0")}s`}var ve={research:"调研",opening:"开场表态",discussion:"群聊交流"};function K(t){let{cn:d}=y(),{room:u}=t,v=Q(u),x=u.state==="running",b=u.research?["research","opening","discussion"]:["opening","discussion"],a=x?b.indexOf(u.phase==="closed"?"discussion":u.phase??"discussion"):-1,c=[...b.map((p,m)=>({key:p,label:ve[p],done:!x||m<a,active:m===a})),{key:"closed",label:x?"结论":v.label,done:!x,active:!1}];return e("ol",{className:d("flex min-w-0 gap-1",t.className),children:c.map((p,m)=>{let N=m===c.length-1&&!x;return n("li",{className:"min-w-0 flex-1",children:[e("span",{className:d("block h-[3px] rounded-full transition-colors duration-300",N?G[v.tone]:p.active?"bg-accent animate-pulse":p.done?"bg-line-strong":"bg-line/60")}),e("span",{className:d("mt-1.5 block truncate text-[11px]",N?d("font-medium",U[v.tone]):p.active?"font-medium text-ink":p.done?"text-dim":"text-faint"),children:p.label})]},p.key)})})}function oe(t){let{Collapsible:d,CollapsibleContent:u,Composer:v,Markdown:x,cn:b,confirm:a}=y(),{room:c,onClose:p}=t,[m,N]=r(!1),[w,M]=r(""),[g,L]=r(!1),[I,O]=r(),[S,H]=r(!1),[E,D]=r(!0),[B,h]=r(),z=i(!1);z.current=B!==void 0;let R=i(null),T=i(null),P=c.state==="running",j=Q(c),re=new Map(c.members.map((l)=>[l.id,l]));o(()=>{let l=(ee)=>{if(ee.key==="Escape"&&!ee.defaultPrevented&&!z.current)N(!0)},k=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l),document.body.style.overflow=k}},[]);let Y=c.messages.length;o(()=>{let l=T.current;if(!l||!E||Y===0)return;l.scrollTo({top:l.scrollHeight,behavior:"smooth"})},[Y,E]);let le=async(l)=>{await t.onPost(l),D(!0)},ce=async()=>{if(g)return;if(!await a({title:"中止理事会?",description:"所有成员会立即停止,已有发言保留。",action:"中止",danger:!0}))return;L(!0),O(void 0);try{await t.onAbort()}catch(k){O(k instanceof Error?k.message:"中止理事会失败")}finally{L(!1)}},W=(l)=>{M((k)=>k.includes(`@${l}`)?k:`${k?`${k.trimEnd()} `:""}@${l} `),R.current?.focus()},me=c.members.filter((l)=>l.verdict==="approve").length,de=c.members.filter((l)=>l.verdict==="reject").length,_=c.members.find((l)=>l.id===B);return vt(n("div",{role:"dialog","aria-modal":"true","aria-label":`理事会:${c.topic}`,onAnimationEnd:(l)=>{if(m&&l.target===l.currentTarget)p()},className:b("fixed inset-0 z-50 flex flex-col bg-bg pt-[env(safe-area-inset-top)] text-ink",m?"pointer-events-none animate-dialog-out":"animate-dialog-in"),children:[n(d,{open:S,onOpenChange:H,className:"shrink-0 border-b border-line px-4 pt-3 pb-3 sm:px-6",children:[n("div",{className:"flex items-start gap-3",children:[n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex items-center gap-3 text-[11px] text-faint",children:[e("span",{className:"font-medium tracking-[0.2em] text-dim",children:"COUNCIL"}),e("span",{className:"tabular-nums",children:V(t.elapsedMs)}),n("span",{className:"tabular-nums",children:[c.messages.length," 条发言"]})]}),n("button",{type:"button","aria-expanded":S,onClick:()=>H((l)=>!l),className:"mt-0.5 flex max-w-full cursor-pointer items-start gap-1.5 text-left md:items-center",children:[e("h2",{className:"line-clamp-2 text-[15px] leading-snug font-semibold md:truncate md:text-lg",children:c.topic}),e(ie,{className:b("mt-0.5 size-4 shrink-0 text-faint transition-transform duration-300 ease-out-quint md:mt-0",!S&&"-rotate-90")})]})]}),n("div",{className:"flex shrink-0 items-center gap-1",children:[n("span",{className:b("inline-flex items-center gap-1.5 rounded-full border border-line px-2.5 py-1 text-xs font-medium",U[j.tone]),children:[e("span",{className:b("size-1.5 rounded-full",G[j.tone],P&&"animate-pulse")}),j.label]}),e("button",{type:"button","aria-label":"关闭理事会页面",title:"关闭(Esc)",onClick:()=>N(!0),className:"ml-1 inline-flex size-10 -mr-2 cursor-pointer items-center justify-center rounded-full text-faint transition-colors hover:bg-raised hover:text-ink md:size-8 md:mr-0",children:e(X,{className:"size-4"})})]})]}),e(u,{children:e("div",{className:"mt-2 max-h-[40dvh] overflow-y-auto overscroll-contain rounded-xl bg-panel px-3.5 py-2.5 text-[13px] leading-relaxed text-dim md:max-h-48",children:e(x,{text:c.brief})})}),e(K,{room:c,className:"mt-3"})]}),n("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row",children:[e("div",{className:"flex shrink-0 gap-2 overflow-x-auto overscroll-x-contain border-b border-line px-4 py-2.5 [scrollbar-width:none] md:hidden",children:c.members.map((l)=>e(he,{member:l,onSelect:()=>h(l.id)},l.id))}),n("aside",{className:"hidden w-72 shrink-0 flex-col gap-2 overflow-y-auto border-r border-line p-4 md:flex",children:[n("div",{className:"flex items-center justify-between text-[11px] text-faint",children:[e("span",{className:"font-medium tracking-wide",children:"席位"}),n("span",{className:"tabular-nums",children:[e("span",{className:"text-success",children:me})," / ",e("span",{className:"text-danger",children:de})," /"," ",c.members.length]})]}),c.members.map((l)=>e(ye,{member:l,onMention:()=>W(l.name),onOpen:()=>t.onOpenMember(l.childSessionID)},l.id))]}),n("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e("div",{ref:T,onScroll:(l)=>{let k=l.currentTarget;D(k.scrollHeight-k.scrollTop-k.clientHeight<80)},className:"min-h-0 flex-1 overflow-y-auto",children:n("div",{className:"mx-auto w-full max-w-3xl px-4 py-4 sm:px-6 md:py-5",children:[c.messages.length===0?n("div",{className:"flex flex-col items-center justify-center gap-3 py-24 text-center text-faint",children:[P?e(Z,{className:"size-5 animate-spin"}):null,e("p",{className:"text-sm",children:P?c.phase==="research"?"成员正在各自调研,笔记不会进入群聊":"成员正在独立准备开场观点,彼此不可见":"这场理事会没有产生发言"})]}):e("ol",{className:"space-y-5",children:c.messages.map((l)=>e(ke,{message:l,membersByID:re,onMention:()=>W(l.senderName)},l.floor))}),c.summary&&!P&&n("section",{className:"mt-8 rounded-2xl border border-line bg-panel px-4 py-3",children:[n("h3",{className:b("text-xs font-semibold",U[j.tone]),children:["结论:",j.label]}),e("div",{className:"mt-1.5 text-[13px] leading-relaxed text-dim",children:e(x,{text:c.summary})})]})]})}),e("div",{className:"shrink-0 px-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:px-6 md:pb-4",children:n("div",{className:"mx-auto w-full max-w-3xl",children:[I&&e("p",{role:"status",className:"px-1 pb-2 text-[13px] text-danger",children:I}),e(v,{draftKey:`council:${c.roomID}`,placeholder:P?"插话,@ 某位成员会点名要求其回应":"理事会已结束,插话会重新唤醒成员",busy:P,allowAttachments:!1,text:w,onTextChange:M,inputRef:R,onSend:le,onAbort:()=>void ce()})]})})]})]}),_&&e(Ne,{member:_,onClose:()=>h(void 0),onMention:()=>{h(void 0),W(_.name)},onOpen:()=>t.onOpenMember(_.childSessionID)})]}),document.body)}function he(t){let{ModelIcon:d,cn:u}=y(),{member:v}=t,x=C[v.verdict]??C.pending,{busy:b}=F(v);return n("button",{type:"button",onClick:t.onSelect,"aria-label":`${v.name},${x.label},查看详情`,className:"flex h-11 max-w-[11rem] shrink-0 cursor-pointer items-center gap-2 rounded-full border border-line bg-panel/60 pr-3.5 pl-1.5 active:bg-raised",children:[n("span",{className:u("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",x.ring),children:[e(d,{modelID:v.model,className:"size-4",size:16}),b&&e(Z,{className:"absolute -right-1 -bottom-1 size-3.5 animate-spin rounded-full bg-bg text-accent"})]}),n("span",{className:"min-w-0 text-left leading-tight",children:[e("span",{className:"block truncate text-[13px] font-medium",children:v.name}),e("span",{className:u("block text-[11px]",x.text),children:x.label})]})]})}function Ne(t){let{Button:d,Dialog:u,Markdown:v,ModelIcon:x,cn:b}=y(),{member:a}=t,c=C[a.verdict]??C.pending,p=F(a);return e(u,{open:!0,onOpenChange:(m)=>!m&&t.onClose(),title:n("span",{className:"flex min-w-0 items-center gap-2.5",children:[e("span",{className:b("flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",c.ring),children:e(x,{modelID:a.model,className:"size-4",size:16})}),e("span",{className:"min-w-0 truncate",children:a.name}),e("span",{className:b("shrink-0 rounded px-1.5 py-px text-[11px] font-medium",c.soft),children:c.label})]}),description:a.model,footer:n(f,{children:[n(d,{variant:"secondary",onClick:t.onMention,children:[e(A,{className:"size-4"}),"点名"]}),n(d,{variant:"secondary",onClick:t.onOpen,children:[e(rt,{className:"size-4"}),"查看推理"]})]}),children:n("div",{className:"space-y-3 pb-1",children:[n("div",{className:"flex items-center gap-3 text-[13px]",children:[n("span",{className:b("flex min-w-0 flex-1 items-center gap-1.5",p.busy?"text-accent":"text-dim"),children:[p.busy&&e(Z,{className:"size-3.5 shrink-0 animate-spin"}),e("span",{className:"truncate",children:p.text})]}),n("span",{className:"shrink-0 text-faint tabular-nums",children:["发言 ",a.turns??0," 次"]})]}),a.notes?n("section",{children:[n("h3",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-faint",children:[e(J,{className:"size-3.5"}),"调研笔记"]}),e("div",{className:"rounded-xl bg-bg/60 px-3.5 py-2.5 text-[13px] leading-relaxed text-dim",children:e(v,{text:a.notes})})]}):e("p",{className:"text-[13px] text-faint",children:"没有调研笔记"})]})})}function ye(t){let{Collapsible:d,CollapsibleContent:u,Markdown:v,ModelIcon:x,cn:b}=y(),{member:a}=t,[c,p]=r(!1),m=C[a.verdict]??C.pending,{busy:N,text:w}=F(a);return n(d,{open:c,onOpenChange:p,className:"shrink-0 rounded-xl border border-line bg-panel/60 p-2.5",children:[n("div",{className:"flex items-center gap-2.5",children:[e("span",{className:b("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",m.ring),children:e(x,{modelID:a.model,className:"size-4",size:16})}),n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex items-center gap-1.5",children:[e("span",{className:"truncate text-[13px] font-medium",title:a.model,children:a.name}),e("span",{className:b("shrink-0 rounded px-1 text-[10.5px] font-medium",m.soft),children:m.label})]}),n("div",{className:b("flex min-w-0 items-center gap-1 text-[11px]",N?"text-accent":"text-faint"),children:[N&&e(Z,{className:"size-3 shrink-0 animate-spin"}),e("span",{className:"truncate",children:w})]})]})]}),n("div",{className:"mt-2 flex items-center gap-1 text-[11px] text-faint",children:[n("span",{className:"tabular-nums",children:["发言 ",a.turns??0," 次"]}),e("span",{className:"ml-auto"}),a.notes&&n("button",{type:"button","aria-expanded":c,onClick:()=>p((M)=>!M),className:b("inline-flex cursor-pointer items-center gap-1 rounded px-1.5 py-0.5 hover:bg-raised hover:text-ink",c&&"text-ink"),children:[e(J,{className:"size-3"}),"笔记"]}),e("button",{type:"button","aria-label":`@ ${a.name}`,title:`@ ${a.name}`,onClick:t.onMention,className:"inline-flex cursor-pointer items-center rounded p-1 hover:bg-raised hover:text-ink",children:e(A,{className:"size-3"})}),e("button",{type:"button","aria-label":`查看 ${a.name} 的推理过程`,title:"查看推理与工具调用",onClick:t.onOpen,className:"inline-flex cursor-pointer items-center rounded p-1 hover:bg-raised hover:text-ink",children:e(rt,{className:"size-3"})})]}),a.notes&&e(u,{children:e("div",{className:"mt-2 max-h-56 overflow-y-auto rounded-lg bg-bg/60 px-2.5 py-2 text-xs leading-relaxed text-dim",children:e(v,{text:a.notes})})})]})}function ke(t){let{Code:d,Collapsible:u,CollapsibleContent:v,Markdown:x,cn:b}=y(),{message:a}=t,[c,p]=r(!1),m=a.senderID==="user"||a.senderID==="host",N=a.verdict&&a.verdict!=="pending"?C[a.verdict]:void 0,w=a.evidences??[],M=(a.mentions??[]).map((g)=>t.membersByID.get(g)).filter((g)=>g!==void 0);return n("li",{id:`council-floor-${a.floor}`,className:"group flex gap-3 animate-fade",children:[e(ae,{message:a,isHuman:m,className:"mt-0.5 hidden size-8 md:flex"}),n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs",children:[e(ae,{message:a,isHuman:m,className:"flex size-6 md:hidden"}),e("span",{className:"font-semibold text-ink",title:a.senderModel,children:a.senderName}),n("a",{href:`#council-floor-${a.floor}`,className:"font-mono text-[11px] text-faint hover:text-dim",onClick:(g)=>g.preventDefault(),children:["#",a.floor]}),N&&e("span",{className:b("rounded px-1.5 py-px text-[10.5px] font-medium",N.soft),children:N.label}),!m&&n("button",{type:"button",onClick:t.onMention,className:"ml-auto inline-flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-[11px] text-faint transition-opacity hover:bg-raised hover:text-ink focus-visible:opacity-100 md:px-1.5 md:py-0.5 md:opacity-0 md:group-hover:opacity-100",children:[e(A,{className:"size-3"}),"回复"]})]}),(a.replyToFloor||M.length>0)&&n("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-faint",children:[a.replyToFloor&&n("button",{type:"button",onClick:()=>document.getElementById(`council-floor-${a.replyToFloor}`)?.scrollIntoView({block:"center",behavior:"smooth"}),className:"inline-flex min-w-0 max-w-full cursor-pointer items-center gap-1 rounded-md bg-raised/70 px-1.5 py-0.5 hover:text-ink",children:[e(tr,{className:"size-3 shrink-0"}),n("span",{className:"shrink-0 text-dim",children:["#",a.replyToFloor," ",a.replyToName]}),a.replyToPreview&&e("span",{className:"truncate",children:a.replyToPreview})]}),M.map((g)=>n("span",{className:"inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-accent",children:[e(A,{className:"size-3"}),g.name]},g.id))]}),e("div",{className:"mt-1.5 break-words text-[14px] leading-relaxed text-ink/90 md:text-[13.5px] [&_p]:my-1.5 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:e(x,{text:a.text})}),w.length>0&&n(u,{open:c,onOpenChange:p,className:"mt-2",children:[n("button",{type:"button","aria-expanded":c,onClick:()=>p((g)=>!g),className:"inline-flex max-w-full cursor-pointer items-center gap-1 text-[11px] text-faint hover:text-ink",children:[e(te,{className:"size-3 shrink-0"}),n("span",{className:"shrink-0",children:["查阅 ",w.length," 处"]}),!c&&e("span",{className:"truncate font-mono",children:w.map((g)=>g.label).join(",")}),e(ie,{className:b("size-3 shrink-0 transition-transform duration-300 ease-out-quint",!c&&"-rotate-90")})]}),e(v,{children:e("div",{className:"mt-1.5 space-y-1.5",children:w.map((g)=>n("div",{className:"overflow-hidden rounded-lg border border-line bg-panel text-xs",children:[e("div",{className:"truncate border-b border-line/70 px-2.5 py-1 font-mono text-[11px] text-dim",children:g.label}),g.snippet&&e(d,{code:g.snippet,lang:g.lang||"ts",className:"max-h-40 overflow-auto px-2.5 py-1.5 text-[11.5px]"})]},`${g.tool}:${g.label}:${g.snippet?.slice(0,32)??""}`))})})]})]})]})}function ae(t){let{ModelIcon:d,cn:u}=y();return e("span",{className:u("shrink-0 items-center justify-center rounded-full",t.isHuman?"bg-accent/12 text-accent":"bg-raised",t.className),children:t.message.senderModel?e(d,{modelID:t.message.senderModel,className:"size-4",size:16}):e(se,{className:"size-4"})})}function Je(t){let{ModelIcon:d,cn:u,useTheme:v}=y();v();let{connection:x,sessionID:b,payload:a,onOpen:c}=t,p=a,[m,N]=r(p),[w,M]=r(!1),[g,L]=r(Date.now);o(()=>{N(p)},[p]);let I=m.state==="running",O=`/api/sessions/${encodeURIComponent(b)}/council/${encodeURIComponent(m.roomID)}`;o(()=>{if(!I)return;let h=!1,R=setInterval(()=>{if(x.request(O).then((T)=>{if(!h&&T&&typeof T==="object"&&"roomID"in T)N(T)}).catch(()=>{}),!h)L(Date.now())},1200);return()=>{h=!0,clearInterval(R)}},[x,O,I]);let S=async(h)=>{let z=await x.request(`${O}/post`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:h})});N(z)},H=async()=>{let h=await x.request(`${O}/kill`,{method:"POST"});N(h)},E=(I?g:m.updatedAt)-m.createdAt,D=m.messages.at(-1),B=m.members.filter((h)=>q(h.status)).length;return n(f,{children:[n("button",{type:"button","aria-label":`进入理事会:${m.topic}`,onClick:()=>M(!0),className:"group relative my-2 block w-full cursor-pointer overflow-hidden rounded-2xl border border-line bg-panel text-left transition-colors hover:border-line-strong animate-fade",children:[n("div",{className:"px-4 pt-3.5",children:[n("div",{className:"flex items-center gap-1.5 text-[11px] text-faint",children:[e("span",{className:"font-medium text-dim",children:"理事会"}),e("span",{"aria-hidden":!0,children:"·"}),e("span",{className:"tabular-nums",children:V(E)}),n("span",{className:"ml-auto tabular-nums",children:[m.members.length," 位成员"]})]}),e("h4",{className:"mt-1 line-clamp-2 text-sm font-semibold text-ink md:truncate",title:m.topic,children:m.topic})]}),e(K,{room:m,className:"mt-3 px-4"}),e("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 px-4",children:m.members.map((h)=>{let z=C[h.verdict]??C.pending,R=q(h.status);return n("span",{className:"flex min-w-0 items-center gap-1.5 text-xs",title:h.model,children:[n("span",{className:u("relative flex size-6 shrink-0 items-center justify-center rounded-full bg-raised ring-2",z.ring),children:[e(d,{modelID:h.model,className:"size-3.5",size:14}),R&&e(Z,{className:"absolute -right-1 -bottom-1 size-3 animate-spin rounded-full bg-panel text-accent"})]}),e("span",{className:"truncate text-dim",children:h.name}),e("span",{className:u("shrink-0 text-[11px]",z.text),children:z.label})]},h.id)})}),n("div",{className:"mt-3 flex items-center gap-2 border-t border-line/70 px-4 py-2.5 text-xs",children:[D?n(f,{children:[e("span",{className:"shrink-0 font-medium text-dim",children:D.senderName}),e("span",{className:"min-w-0 flex-1 truncate text-faint",children:D.text.replace(/\s+/g," ")})]}):e("span",{className:"min-w-0 flex-1 truncate text-faint",children:I?`${B} 位成员正在${m.phase==="research"?"调研":"思考"}…`:"没有发言"}),n("span",{className:"inline-flex shrink-0 items-center gap-1 text-faint transition-colors group-hover:text-ink",children:[m.messages.length>0&&n("span",{className:"tabular-nums",children:[m.messages.length," 条"]}),e(ne,{className:"size-3.5"})]})]})]}),w&&e(oe,{room:m,elapsedMs:E,onClose:()=>M(!1),onOpenMember:c,onPost:S,onAbort:H})]})}export{Je as CouncilCard};
1
+ import{o,i,r,at,f,e,n,y,s,Z,it,ie,Jn,X}from"./chunk-kahab58k.js";var pe=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]],A=s("at-sign",pe);var ue=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],te=s("file-code-2",ue);var xe=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],ne=s("maximize-2",xe);var fe=[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]],J=s("notebook-pen",fe);var be=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],se=s("user",be);var C={approve:{label:"通过",text:"text-success",ring:"ring-success/80",soft:"bg-success/12 text-success"},reject:{label:"反对",text:"text-danger",ring:"ring-danger/80",soft:"bg-danger/12 text-danger"},abstain:{label:"弃权",text:"text-dim",ring:"ring-line-strong",soft:"bg-raised text-dim"},pending:{label:"未表态",text:"text-faint",ring:"ring-line",soft:"bg-raised text-faint"}},ge={thinking:"思考中",reading:"查阅中",speaking:"发言中",idle:"等待中",error:"出错",aborted:"已中止"},U={success:"text-success",warning:"text-warning",danger:"text-danger",neutral:"text-faint"},G={success:"bg-success",warning:"bg-warning",danger:"bg-danger",neutral:"bg-faint"};function q(t){return t==="thinking"||t==="reading"||t==="speaking"}function F(t){let d=q(t.status);return{busy:d,text:d&&t.activeTool?t.activeTool:ge[t.status]}}function Q(t){let d=t.members.filter((v)=>v.verdict==="approve").length,u=t.members.filter((v)=>v.verdict==="reject").length;if(t.state==="running"){if(t.phase==="research")return{tone:"warning",label:"调研中"};if(t.phase==="opening")return{tone:"warning",label:"开场表态"};return{tone:"warning",label:"群聊交流"}}if(t.state==="consensus"){if(d===t.members.length)return{tone:"success",label:"全票通过"};if(u===t.members.length)return{tone:"danger",label:"全票反对"};if(u>d)return{tone:"danger",label:"共识:反对"};return{tone:"success",label:"共识:通过"}}if(t.state==="diverged")return{tone:"warning",label:"存在分歧"};if(t.state==="error")return{tone:"danger",label:"失败"};return{tone:"neutral",label:"已中止"}}function V(t){let d=Math.max(1,Math.round(t/1000));if(d<60)return`${d}s`;return`${Math.floor(d/60)}m ${String(d%60).padStart(2,"0")}s`}var ve={research:"调研",opening:"开场表态",discussion:"群聊交流"};function K(t){let{cn:d}=y(),{room:u}=t,v=Q(u),x=u.state==="running",b=u.research?["research","opening","discussion"]:["opening","discussion"],a=x?b.indexOf(u.phase==="closed"?"discussion":u.phase??"discussion"):-1,c=[...b.map((p,m)=>({key:p,label:ve[p],done:!x||m<a,active:m===a})),{key:"closed",label:x?"结论":v.label,done:!x,active:!1}];return e("ol",{className:d("flex min-w-0 gap-1",t.className),children:c.map((p,m)=>{let N=m===c.length-1&&!x;return n("li",{className:"min-w-0 flex-1",children:[e("span",{className:d("block h-[3px] rounded-full transition-colors duration-300",N?G[v.tone]:p.active?"bg-accent animate-pulse":p.done?"bg-line-strong":"bg-line/60")}),e("span",{className:d("mt-1.5 block truncate text-[11px]",N?d("font-medium",U[v.tone]):p.active?"font-medium text-ink":p.done?"text-dim":"text-faint"),children:p.label})]},p.key)})})}function oe(t){let{Collapsible:d,CollapsibleContent:u,Composer:v,Markdown:x,cn:b,confirm:a}=y(),{room:c,onClose:p}=t,[m,N]=r(!1),[w,M]=r(""),[g,L]=r(!1),[I,O]=r(),[S,H]=r(!1),[E,D]=r(!0),[B,h]=r(),z=i(!1);z.current=B!==void 0;let R=i(null),T=i(null),P=c.state==="running",j=Q(c),re=new Map(c.members.map((l)=>[l.id,l]));o(()=>{let l=(ee)=>{if(ee.key==="Escape"&&!ee.defaultPrevented&&!z.current)N(!0)},k=document.body.style.overflow;return document.body.style.overflow="hidden",window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l),document.body.style.overflow=k}},[]);let Y=c.messages.length;o(()=>{let l=T.current;if(!l||!E||Y===0)return;l.scrollTo({top:l.scrollHeight,behavior:"smooth"})},[Y,E]);let le=async(l)=>{await t.onPost(l),D(!0)},ce=async()=>{if(g)return;if(!await a({title:"中止理事会?",description:"所有成员会立即停止,已有发言保留。",action:"中止",danger:!0}))return;L(!0),O(void 0);try{await t.onAbort()}catch(k){O(k instanceof Error?k.message:"中止理事会失败")}finally{L(!1)}},W=(l)=>{M((k)=>k.includes(`@${l}`)?k:`${k?`${k.trimEnd()} `:""}@${l} `),R.current?.focus()},me=c.members.filter((l)=>l.verdict==="approve").length,de=c.members.filter((l)=>l.verdict==="reject").length,_=c.members.find((l)=>l.id===B);return at(n("div",{role:"dialog","aria-modal":"true","aria-label":`理事会:${c.topic}`,onAnimationEnd:(l)=>{if(m&&l.target===l.currentTarget)p()},className:b("fixed inset-0 z-50 flex flex-col bg-bg pt-[env(safe-area-inset-top)] text-ink",m?"pointer-events-none animate-dialog-out":"animate-dialog-in"),children:[n(d,{open:S,onOpenChange:H,className:"shrink-0 border-b border-line px-4 pt-3 pb-3 sm:px-6",children:[n("div",{className:"flex items-start gap-3",children:[n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex items-center gap-3 text-[11px] text-faint",children:[e("span",{className:"font-medium tracking-[0.2em] text-dim",children:"COUNCIL"}),e("span",{className:"tabular-nums",children:V(t.elapsedMs)}),n("span",{className:"tabular-nums",children:[c.messages.length," 条发言"]})]}),n("button",{type:"button","aria-expanded":S,onClick:()=>H((l)=>!l),className:"mt-0.5 flex max-w-full cursor-pointer items-start gap-1.5 text-left md:items-center",children:[e("h2",{className:"line-clamp-2 text-[15px] leading-snug font-semibold md:truncate md:text-lg",children:c.topic}),e(ie,{className:b("mt-0.5 size-4 shrink-0 text-faint transition-transform duration-300 ease-out-quint md:mt-0",!S&&"-rotate-90")})]})]}),n("div",{className:"flex shrink-0 items-center gap-1",children:[n("span",{className:b("inline-flex items-center gap-1.5 rounded-full border border-line px-2.5 py-1 text-xs font-medium",U[j.tone]),children:[e("span",{className:b("size-1.5 rounded-full",G[j.tone],P&&"animate-pulse")}),j.label]}),e("button",{type:"button","aria-label":"关闭理事会页面",title:"关闭(Esc)",onClick:()=>N(!0),className:"ml-1 inline-flex size-10 -mr-2 cursor-pointer items-center justify-center rounded-full text-faint transition-colors hover:bg-raised hover:text-ink md:size-8 md:mr-0",children:e(X,{className:"size-4"})})]})]}),e(u,{children:e("div",{className:"mt-2 max-h-[40dvh] overflow-y-auto overscroll-contain rounded-xl bg-panel px-3.5 py-2.5 text-[13px] leading-relaxed text-dim md:max-h-48",children:e(x,{text:c.brief})})}),e(K,{room:c,className:"mt-3"})]}),n("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row",children:[e("div",{className:"flex shrink-0 gap-2 overflow-x-auto overscroll-x-contain border-b border-line px-4 py-2.5 [scrollbar-width:none] md:hidden",children:c.members.map((l)=>e(he,{member:l,onSelect:()=>h(l.id)},l.id))}),n("aside",{className:"hidden w-72 shrink-0 flex-col gap-2 overflow-y-auto border-r border-line p-4 md:flex",children:[n("div",{className:"flex items-center justify-between text-[11px] text-faint",children:[e("span",{className:"font-medium tracking-wide",children:"席位"}),n("span",{className:"tabular-nums",children:[e("span",{className:"text-success",children:me})," / ",e("span",{className:"text-danger",children:de})," /"," ",c.members.length]})]}),c.members.map((l)=>e(ye,{member:l,onMention:()=>W(l.name),onOpen:()=>t.onOpenMember(l.childSessionID)},l.id))]}),n("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e("div",{ref:T,onScroll:(l)=>{let k=l.currentTarget;D(k.scrollHeight-k.scrollTop-k.clientHeight<80)},className:"min-h-0 flex-1 overflow-y-auto",children:n("div",{className:"mx-auto w-full max-w-3xl px-4 py-4 sm:px-6 md:py-5",children:[c.messages.length===0?n("div",{className:"flex flex-col items-center justify-center gap-3 py-24 text-center text-faint",children:[P?e(Z,{className:"size-5 animate-spin"}):null,e("p",{className:"text-sm",children:P?c.phase==="research"?"成员正在各自调研,笔记不会进入群聊":"成员正在独立准备开场观点,彼此不可见":"这场理事会没有产生发言"})]}):e("ol",{className:"space-y-5",children:c.messages.map((l)=>e(ke,{message:l,membersByID:re,onMention:()=>W(l.senderName)},l.floor))}),c.summary&&!P&&n("section",{className:"mt-8 rounded-2xl border border-line bg-panel px-4 py-3",children:[n("h3",{className:b("text-xs font-semibold",U[j.tone]),children:["结论:",j.label]}),e("div",{className:"mt-1.5 text-[13px] leading-relaxed text-dim",children:e(x,{text:c.summary})})]})]})}),e("div",{className:"shrink-0 px-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:px-6 md:pb-4",children:n("div",{className:"mx-auto w-full max-w-3xl",children:[I&&e("p",{role:"status",className:"px-1 pb-2 text-[13px] text-danger",children:I}),e(v,{draftKey:`council:${c.roomID}`,placeholder:P?"插话,@ 某位成员会点名要求其回应":"理事会已结束,插话会重新唤醒成员",busy:P,allowAttachments:!1,text:w,onTextChange:M,inputRef:R,onSend:le,onAbort:()=>void ce()})]})})]})]}),_&&e(Ne,{member:_,onClose:()=>h(void 0),onMention:()=>{h(void 0),W(_.name)},onOpen:()=>t.onOpenMember(_.childSessionID)})]}),document.body)}function he(t){let{ModelIcon:d,cn:u}=y(),{member:v}=t,x=C[v.verdict]??C.pending,{busy:b}=F(v);return n("button",{type:"button",onClick:t.onSelect,"aria-label":`${v.name},${x.label},查看详情`,className:"flex h-11 max-w-[11rem] shrink-0 cursor-pointer items-center gap-2 rounded-full border border-line bg-panel/60 pr-3.5 pl-1.5 active:bg-raised",children:[n("span",{className:u("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",x.ring),children:[e(d,{modelID:v.model,className:"size-4",size:16}),b&&e(Z,{className:"absolute -right-1 -bottom-1 size-3.5 animate-spin rounded-full bg-bg text-accent"})]}),n("span",{className:"min-w-0 text-left leading-tight",children:[e("span",{className:"block truncate text-[13px] font-medium",children:v.name}),e("span",{className:u("block text-[11px]",x.text),children:x.label})]})]})}function Ne(t){let{Button:d,Dialog:u,Markdown:v,ModelIcon:x,cn:b}=y(),{member:a}=t,c=C[a.verdict]??C.pending,p=F(a);return e(u,{open:!0,onOpenChange:(m)=>!m&&t.onClose(),title:n("span",{className:"flex min-w-0 items-center gap-2.5",children:[e("span",{className:b("flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",c.ring),children:e(x,{modelID:a.model,className:"size-4",size:16})}),e("span",{className:"min-w-0 truncate",children:a.name}),e("span",{className:b("shrink-0 rounded px-1.5 py-px text-[11px] font-medium",c.soft),children:c.label})]}),description:a.model,footer:n(f,{children:[n(d,{variant:"secondary",onClick:t.onMention,children:[e(A,{className:"size-4"}),"点名"]}),n(d,{variant:"secondary",onClick:t.onOpen,children:[e(it,{className:"size-4"}),"查看推理"]})]}),children:n("div",{className:"space-y-3 pb-1",children:[n("div",{className:"flex items-center gap-3 text-[13px]",children:[n("span",{className:b("flex min-w-0 flex-1 items-center gap-1.5",p.busy?"text-accent":"text-dim"),children:[p.busy&&e(Z,{className:"size-3.5 shrink-0 animate-spin"}),e("span",{className:"truncate",children:p.text})]}),n("span",{className:"shrink-0 text-faint tabular-nums",children:["发言 ",a.turns??0," 次"]})]}),a.notes?n("section",{children:[n("h3",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-medium text-faint",children:[e(J,{className:"size-3.5"}),"调研笔记"]}),e("div",{className:"rounded-xl bg-bg/60 px-3.5 py-2.5 text-[13px] leading-relaxed text-dim",children:e(v,{text:a.notes})})]}):e("p",{className:"text-[13px] text-faint",children:"没有调研笔记"})]})})}function ye(t){let{Collapsible:d,CollapsibleContent:u,Markdown:v,ModelIcon:x,cn:b}=y(),{member:a}=t,[c,p]=r(!1),m=C[a.verdict]??C.pending,{busy:N,text:w}=F(a);return n(d,{open:c,onOpenChange:p,className:"shrink-0 rounded-xl border border-line bg-panel/60 p-2.5",children:[n("div",{className:"flex items-center gap-2.5",children:[e("span",{className:b("relative flex size-8 shrink-0 items-center justify-center rounded-full bg-raised ring-2",m.ring),children:e(x,{modelID:a.model,className:"size-4",size:16})}),n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex items-center gap-1.5",children:[e("span",{className:"truncate text-[13px] font-medium",title:a.model,children:a.name}),e("span",{className:b("shrink-0 rounded px-1 text-[10.5px] font-medium",m.soft),children:m.label})]}),n("div",{className:b("flex min-w-0 items-center gap-1 text-[11px]",N?"text-accent":"text-faint"),children:[N&&e(Z,{className:"size-3 shrink-0 animate-spin"}),e("span",{className:"truncate",children:w})]})]})]}),n("div",{className:"mt-2 flex items-center gap-1 text-[11px] text-faint",children:[n("span",{className:"tabular-nums",children:["发言 ",a.turns??0," 次"]}),e("span",{className:"ml-auto"}),a.notes&&n("button",{type:"button","aria-expanded":c,onClick:()=>p((M)=>!M),className:b("inline-flex cursor-pointer items-center gap-1 rounded px-1.5 py-0.5 hover:bg-raised hover:text-ink",c&&"text-ink"),children:[e(J,{className:"size-3"}),"笔记"]}),e("button",{type:"button","aria-label":`@ ${a.name}`,title:`@ ${a.name}`,onClick:t.onMention,className:"inline-flex cursor-pointer items-center rounded p-1 hover:bg-raised hover:text-ink",children:e(A,{className:"size-3"})}),e("button",{type:"button","aria-label":`查看 ${a.name} 的推理过程`,title:"查看推理与工具调用",onClick:t.onOpen,className:"inline-flex cursor-pointer items-center rounded p-1 hover:bg-raised hover:text-ink",children:e(it,{className:"size-3"})})]}),a.notes&&e(u,{children:e("div",{className:"mt-2 max-h-56 overflow-y-auto rounded-lg bg-bg/60 px-2.5 py-2 text-xs leading-relaxed text-dim",children:e(v,{text:a.notes})})})]})}function ke(t){let{Code:d,Collapsible:u,CollapsibleContent:v,Markdown:x,cn:b}=y(),{message:a}=t,[c,p]=r(!1),m=a.senderID==="user"||a.senderID==="host",N=a.verdict&&a.verdict!=="pending"?C[a.verdict]:void 0,w=a.evidences??[],M=(a.mentions??[]).map((g)=>t.membersByID.get(g)).filter((g)=>g!==void 0);return n("li",{id:`council-floor-${a.floor}`,className:"group flex gap-3 animate-fade",children:[e(ae,{message:a,isHuman:m,className:"mt-0.5 hidden size-8 md:flex"}),n("div",{className:"min-w-0 flex-1",children:[n("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs",children:[e(ae,{message:a,isHuman:m,className:"flex size-6 md:hidden"}),e("span",{className:"font-semibold text-ink",title:a.senderModel,children:a.senderName}),n("a",{href:`#council-floor-${a.floor}`,className:"font-mono text-[11px] text-faint hover:text-dim",onClick:(g)=>g.preventDefault(),children:["#",a.floor]}),N&&e("span",{className:b("rounded px-1.5 py-px text-[10.5px] font-medium",N.soft),children:N.label}),!m&&n("button",{type:"button",onClick:t.onMention,className:"ml-auto inline-flex cursor-pointer items-center gap-1 rounded-md px-2 py-1 text-[11px] text-faint transition-opacity hover:bg-raised hover:text-ink focus-visible:opacity-100 md:px-1.5 md:py-0.5 md:opacity-0 md:group-hover:opacity-100",children:[e(A,{className:"size-3"}),"回复"]})]}),(a.replyToFloor||M.length>0)&&n("div",{className:"mt-1 flex flex-wrap items-center gap-1.5 text-[11px] text-faint",children:[a.replyToFloor&&n("button",{type:"button",onClick:()=>document.getElementById(`council-floor-${a.replyToFloor}`)?.scrollIntoView({block:"center",behavior:"smooth"}),className:"inline-flex min-w-0 max-w-full cursor-pointer items-center gap-1 rounded-md bg-raised/70 px-1.5 py-0.5 hover:text-ink",children:[e(Jn,{className:"size-3 shrink-0"}),n("span",{className:"shrink-0 text-dim",children:["#",a.replyToFloor," ",a.replyToName]}),a.replyToPreview&&e("span",{className:"truncate",children:a.replyToPreview})]}),M.map((g)=>n("span",{className:"inline-flex items-center gap-1 rounded-md bg-accent/10 px-1.5 py-0.5 text-accent",children:[e(A,{className:"size-3"}),g.name]},g.id))]}),e("div",{className:"mt-1.5 break-words text-[14px] leading-relaxed text-ink/90 md:text-[13.5px] [&_p]:my-1.5 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:e(x,{text:a.text})}),w.length>0&&n(u,{open:c,onOpenChange:p,className:"mt-2",children:[n("button",{type:"button","aria-expanded":c,onClick:()=>p((g)=>!g),className:"inline-flex max-w-full cursor-pointer items-center gap-1 text-[11px] text-faint hover:text-ink",children:[e(te,{className:"size-3 shrink-0"}),n("span",{className:"shrink-0",children:["查阅 ",w.length," 处"]}),!c&&e("span",{className:"truncate font-mono",children:w.map((g)=>g.label).join(",")}),e(ie,{className:b("size-3 shrink-0 transition-transform duration-300 ease-out-quint",!c&&"-rotate-90")})]}),e(v,{children:e("div",{className:"mt-1.5 space-y-1.5",children:w.map((g)=>n("div",{className:"overflow-hidden rounded-lg border border-line bg-panel text-xs",children:[e("div",{className:"truncate border-b border-line/70 px-2.5 py-1 font-mono text-[11px] text-dim",children:g.label}),g.snippet&&e(d,{code:g.snippet,lang:g.lang||"ts",className:"max-h-40 overflow-auto px-2.5 py-1.5 text-[11.5px]"})]},`${g.tool}:${g.label}:${g.snippet?.slice(0,32)??""}`))})})]})]})]})}function ae(t){let{ModelIcon:d,cn:u}=y();return e("span",{className:u("shrink-0 items-center justify-center rounded-full",t.isHuman?"bg-accent/12 text-accent":"bg-raised",t.className),children:t.message.senderModel?e(d,{modelID:t.message.senderModel,className:"size-4",size:16}):e(se,{className:"size-4"})})}function Je(t){let{ModelIcon:d,cn:u,useTheme:v}=y();v();let{connection:x,sessionID:b,payload:a,onOpen:c}=t,p=a,[m,N]=r(p),[w,M]=r(!1),[g,L]=r(Date.now);o(()=>{N(p)},[p]);let I=m.state==="running",O=`/api/sessions/${encodeURIComponent(b)}/council/${encodeURIComponent(m.roomID)}`;o(()=>{if(!I)return;let h=!1,R=setInterval(()=>{if(x.request(O).then((T)=>{if(!h&&T&&typeof T==="object"&&"roomID"in T)N(T)}).catch(()=>{}),!h)L(Date.now())},1200);return()=>{h=!0,clearInterval(R)}},[x,O,I]);let S=async(h)=>{let z=await x.request(`${O}/post`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({text:h})});N(z)},H=async()=>{let h=await x.request(`${O}/kill`,{method:"POST"});N(h)},E=(I?g:m.updatedAt)-m.createdAt,D=m.messages.at(-1),B=m.members.filter((h)=>q(h.status)).length;return n(f,{children:[n("button",{type:"button","aria-label":`进入理事会:${m.topic}`,onClick:()=>M(!0),className:"group relative my-2 block w-full cursor-pointer overflow-hidden rounded-2xl border border-line bg-panel text-left transition-colors hover:border-line-strong animate-fade",children:[n("div",{className:"px-4 pt-3.5",children:[n("div",{className:"flex items-center gap-1.5 text-[11px] text-faint",children:[e("span",{className:"font-medium text-dim",children:"理事会"}),e("span",{"aria-hidden":!0,children:"·"}),e("span",{className:"tabular-nums",children:V(E)}),n("span",{className:"ml-auto tabular-nums",children:[m.members.length," 位成员"]})]}),e("h4",{className:"mt-1 line-clamp-2 text-sm font-semibold text-ink md:truncate",title:m.topic,children:m.topic})]}),e(K,{room:m,className:"mt-3 px-4"}),e("div",{className:"mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 px-4",children:m.members.map((h)=>{let z=C[h.verdict]??C.pending,R=q(h.status);return n("span",{className:"flex min-w-0 items-center gap-1.5 text-xs",title:h.model,children:[n("span",{className:u("relative flex size-6 shrink-0 items-center justify-center rounded-full bg-raised ring-2",z.ring),children:[e(d,{modelID:h.model,className:"size-3.5",size:14}),R&&e(Z,{className:"absolute -right-1 -bottom-1 size-3 animate-spin rounded-full bg-panel text-accent"})]}),e("span",{className:"truncate text-dim",children:h.name}),e("span",{className:u("shrink-0 text-[11px]",z.text),children:z.label})]},h.id)})}),n("div",{className:"mt-3 flex items-center gap-2 border-t border-line/70 px-4 py-2.5 text-xs",children:[D?n(f,{children:[e("span",{className:"shrink-0 font-medium text-dim",children:D.senderName}),e("span",{className:"min-w-0 flex-1 truncate text-faint",children:D.text.replace(/\s+/g," ")})]}):e("span",{className:"min-w-0 flex-1 truncate text-faint",children:I?`${B} 位成员正在${m.phase==="research"?"调研":"思考"}…`:"没有发言"}),n("span",{className:"inline-flex shrink-0 items-center gap-1 text-faint transition-colors group-hover:text-ink",children:[m.messages.length>0&&n("span",{className:"tabular-nums",children:[m.messages.length," 条"]}),e(ne,{className:"size-3.5"})]})]})]}),w&&e(oe,{room:m,elapsedMs:E,onClose:()=>M(!1),onOpenMember:c,onPost:S,onAbort:H})]})}export{Je as CouncilCard};
@@ -0,0 +1 @@
1
+ import{_i}from"./chunk-gten0rpx.js";export{_i as default};