chatlab-cli 0.25.1 → 0.26.0

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 (66) hide show
  1. package/dist/{chat-command-5XMRLXZM.mjs → chat-command-ZP4WJVWC.mjs} +144 -6
  2. package/dist/chat-command-ZP4WJVWC.mjs.map +1 -0
  3. package/dist/{chunk-YZYP5ST6.mjs → chunk-6G7AIF7I.mjs} +12 -11
  4. package/dist/chunk-6G7AIF7I.mjs.map +1 -0
  5. package/dist/{chunk-WYHGWTA4.mjs → chunk-ILGSSXOG.mjs} +92 -28
  6. package/dist/chunk-ILGSSXOG.mjs.map +1 -0
  7. package/dist/{chunk-JE3FOFF7.mjs → chunk-IRZRIHIT.mjs} +49 -12
  8. package/dist/chunk-IRZRIHIT.mjs.map +1 -0
  9. package/dist/{chunk-7VG6QGQ2.mjs → chunk-QY67NN65.mjs} +841 -79
  10. package/dist/chunk-QY67NN65.mjs.map +1 -0
  11. package/dist/{chunk-GTCTDD2Z.mjs → chunk-SJIOPSMM.mjs} +8 -8
  12. package/dist/{chunk-PDQFSQO6.mjs → chunk-TC74HESZ.mjs} +2 -2
  13. package/dist/{chunk-FDK6SPCG.mjs → chunk-UB4XBM4R.mjs} +2 -2
  14. package/dist/{chunk-CUCDRAY6.mjs → chunk-WXC6RZCX.mjs} +2 -2
  15. package/dist/cli.mjs +3 -3
  16. package/dist/{http-C3CGXUBU.mjs → http-J3IOFFIA.mjs} +8 -8
  17. package/dist/{import-VS7L5JDX.mjs → import-POYG5LOX.mjs} +4 -4
  18. package/dist/index.mjs +8 -8
  19. package/dist/{mcp-6VXDPUQK.mjs → mcp-7HH7UMXT.mjs} +4 -4
  20. package/dist/{stream-import-TFDBNVIW.mjs → stream-import-O3H3FGV2.mjs} +3 -3
  21. package/dist-web/assets/{DebugToolsPanel-vn-bnUxn.css → DebugToolsPanel-CrqULdXp.css} +1 -1
  22. package/dist-web/assets/DebugToolsPanel.vue_vue_type_script_setup_true_lang-BTJxEma5.js +182 -0
  23. package/dist-web/assets/{EChartWordcloud-CzhfrEF_.js → EChartWordcloud-B_YisOW5.js} +1 -1
  24. package/dist-web/assets/{MessageExportModal-B79pPBL9.js → MessageExportModal-C7NgEL8T.js} +1 -1
  25. package/dist-web/assets/{electron-DRkrjeIl.js → electron-B3DFm1cC.js} +1 -1
  26. package/dist-web/assets/electron-BMM4Nfty.js +1 -0
  27. package/dist-web/assets/{fetch-DfgdagMN.js → fetch-ArMjdMcy.js} +1 -1
  28. package/dist-web/assets/{fetch-BqLy63aj.js → fetch-BFtuJaa1.js} +1 -1
  29. package/dist-web/assets/{fetch-CDamdvtb.js → fetch-BGfaAqO9.js} +1 -1
  30. package/dist-web/assets/{fetch-Drk9dLaF.js → fetch-BaJDB31c.js} +1 -1
  31. package/dist-web/assets/{fetch-BmZIm6mS.js → fetch-BjDJgdN0.js} +1 -1
  32. package/dist-web/assets/{fetch-DWg-2kOp.js → fetch-C5CLcpQW.js} +1 -1
  33. package/dist-web/assets/{fetch-ph2_d79v.js → fetch-DQZvdHnG.js} +1 -1
  34. package/dist-web/assets/{fetch-Y-_WsCuk.js → fetch-Dhfbt1BQ.js} +3 -3
  35. package/dist-web/assets/{fetch-BstX-wd4.js → fetch-DnEP0uyF.js} +1 -1
  36. package/dist-web/assets/{fetch-Bvcxe5PI.js → fetch-SYrb-sZe.js} +1 -1
  37. package/dist-web/assets/index-CWfkrx37.js +173 -0
  38. package/dist-web/assets/index-D3N4NDFx.css +1 -0
  39. package/dist-web/assets/{index-DMWf5On7.js → index-D7_ch4zf.js} +1 -1
  40. package/dist-web/assets/{index-9urfJP1r.js → index-DK9LEEzT.js} +1 -1
  41. package/dist-web/assets/index-DqDa_on9.js +9 -0
  42. package/dist-web/assets/{index-D_hHm7bQ.js → index-DrN1G9bl.js} +2 -2
  43. package/dist-web/assets/{index-deYDOVUa.js → index-MdYeovYo.js} +4 -4
  44. package/dist-web/assets/{vendor-nuxt-ui-C_8CsH6e.js → vendor-nuxt-ui-Zy8txNdC.js} +1 -1
  45. package/dist-web/assets/{vendor-reka-ui-CIMXwvEp.js → vendor-reka-ui-mMvma1EP.js} +1 -1
  46. package/dist-web/assets/{web-XJV6Vj5t.js → web-zEXsvoZW.js} +1 -1
  47. package/dist-web/index.html +4 -4
  48. package/package.json +1 -1
  49. package/dist/chat-command-5XMRLXZM.mjs.map +0 -1
  50. package/dist/chunk-7VG6QGQ2.mjs.map +0 -1
  51. package/dist/chunk-JE3FOFF7.mjs.map +0 -1
  52. package/dist/chunk-WYHGWTA4.mjs.map +0 -1
  53. package/dist/chunk-YZYP5ST6.mjs.map +0 -1
  54. package/dist-web/assets/DebugToolsPanel.vue_vue_type_script_setup_true_lang-B1xZmp9r.js +0 -161
  55. package/dist-web/assets/electron-Dv8jdn_2.js +0 -1
  56. package/dist-web/assets/index-CfKjh0Jr.js +0 -9
  57. package/dist-web/assets/index-CprJOAB1.css +0 -1
  58. package/dist-web/assets/index-MCdpiX_O.js +0 -173
  59. /package/dist/{chunk-GTCTDD2Z.mjs.map → chunk-SJIOPSMM.mjs.map} +0 -0
  60. /package/dist/{chunk-PDQFSQO6.mjs.map → chunk-TC74HESZ.mjs.map} +0 -0
  61. /package/dist/{chunk-FDK6SPCG.mjs.map → chunk-UB4XBM4R.mjs.map} +0 -0
  62. /package/dist/{chunk-CUCDRAY6.mjs.map → chunk-WXC6RZCX.mjs.map} +0 -0
  63. /package/dist/{http-C3CGXUBU.mjs.map → http-J3IOFFIA.mjs.map} +0 -0
  64. /package/dist/{import-VS7L5JDX.mjs.map → import-POYG5LOX.mjs.map} +0 -0
  65. /package/dist/{mcp-6VXDPUQK.mjs.map → mcp-7HH7UMXT.mjs.map} +0 -0
  66. /package/dist/{stream-import-TFDBNVIW.mjs.map → stream-import-O3H3FGV2.mjs.map} +0 -0
@@ -1,10 +1,10 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/EChartWordcloud-CzhfrEF_.js","assets/vendor-echarts-wordcloud-B1kQMklB.js","assets/vendor-echarts-CITQeskI.js","assets/vendor-zrender-DFl4U2Oe.js","assets/vendor-reka-ui-CIMXwvEp.js","assets/MessageExportModal-B79pPBL9.js","assets/vendor-nuxt-ui-C_8CsH6e.js","assets/index-CfKjh0Jr.js","assets/vendor-snapdom-XnBoh1gd.js","assets/index-CprJOAB1.css","assets/DebugToolsPanel.vue_vue_type_script_setup_true_lang-B1xZmp9r.js","assets/index-DMWf5On7.js","assets/DebugToolsPanel-vn-bnUxn.css"])))=>i.map(i=>d[i]);
2
- import{_ as ze}from"./vendor-snapdom-XnBoh1gd.js";import{k as st,g as be,b as pe,m as at,a as $e,j as Fe,c as nt,e as Be,_ as Ue,n as ot,D as rt,u as it,d as lt}from"./vendor-nuxt-ui-C_8CsH6e.js";import{b as L,d as ke,F as De,p as q,G as i,P as I,Q as ee,a5 as a,Z as P,a3 as se,T as x,O as He,J as ct,H as N,a0 as xe,h as D,w as G,u as t,K as A,L as w,U as B,R as Q,bI as We,a9 as je,bJ as dt,au as Pe,bF as qe,n as Se,bD as Re,i as ut}from"./vendor-reka-ui-CIMXwvEp.js";import{p as mt,u as ae,k as Ne,T as de,j as Y,q as gt,r as Ye,_ as Le,t as pt,e as ht,b as vt,s as ft}from"./index-CfKjh0Jr.js";import{a as we}from"./index-DMWf5On7.js";import{_ as ne,a as K,g as Ge,b as yt,c as oe,d as ce,e as xt,f as Te,h as bt,i as Ae,j as kt,u as _t,k as wt,l as $t,m as It,n as Ct,o as St,p as Mt,q as Tt,r as Dt,s as Rt,t as Nt,P as Lt,v as Vt,w as At,x as Et,y as Ot,C as zt,z as Ft,A as Bt,D as Ut,B as Ht}from"./DebugToolsPanel.vue_vue_type_script_setup_true_lang-B1xZmp9r.js";import"./vendor-echarts-wordcloud-B1kQMklB.js";import{u as Je,i as Wt,j as Ke,k as jt,m as Qe,n as Xe,o as Pt,p as qt,q as Yt}from"./vendor-echarts-CITQeskI.js";import"./vendor-zrender-DFl4U2Oe.js";function Gt(l,s={}){const{threshold:e=300,containerSelector:o=".overflow-y-auto",scrollLockDuration:c=800}=s,u=L(l[0]?.id||"");let d=!1;const m=L(null);let p=null;function k(){if(d)return;const g=[];l.forEach(r=>{const h=document.getElementById(r.id);if(h){const f=h.getBoundingClientRect();g.push({id:r.id,top:Math.round(f.top)})}});let n=0;for(let r=0;r<g.length;r++){if(g[r].top>e){n=Math.max(0,r-1);break}n=r}u.value=l[n]?.id||""}function y(g){const n=document.getElementById(g);n&&(u.value=g,d=!0,n.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout(()=>{d=!1,k()},c))}return ke(()=>{p=m.value?.closest(o)||null,p&&(p.addEventListener("scroll",k,{passive:!0}),k())}),De(()=>{p&&p.removeEventListener("scroll",k)}),{contentRef:m,activeAnchor:u,scrollToAnchor:y,updateActiveAnchor:k}}const Jt={class:"sticky top-24 space-y-6"},Kt={class:"border-l border-gray-200 dark:border-gray-800"},Qt=["onClick"],Xt=q({__name:"PageAnchorsNav",props:{anchors:{},activeAnchor:{},width:{default:"w-44"},hideOnMobile:{type:Boolean,default:!0}},emits:["click"],setup(l,{emit:s}){const e=s;function o(c){e("click",c)}return(c,u)=>(i(),I("div",{class:ee([l.width,"shrink-0",l.hideOnMobile?"hidden lg:block":""])},[a("div",Jt,[a("nav",null,[a("div",Kt,[(i(!0),I(P,null,se(l.anchors,d=>(i(),I("button",{key:d.id,class:ee(["-ml-px block border-l-2 py-1.5 pl-4 text-left text-sm transition-colors",[l.activeAnchor===d.id?"border-pink-500 font-medium text-pink-600 dark:text-pink-400":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"]]),onClick:m=>o(d.id)},x(d.label),11,Qt))),128))])]),He(c.$slots,"default")])],2))}}),me=q({__name:"TopNSelect",props:{modelValue:{default:10},modelModifiers:{}},emits:["update:modelValue"],setup(l){const s=ct(l,"modelValue"),e=[{label:"Top 5",value:5},{label:"Top 10",value:10},{label:"Top 20",value:20},{label:"Top 30",value:30},{label:"Top 50",value:50},{label:"Top 100",value:100}];return(o,c)=>{const u=st;return i(),N(u,{modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),items:e,"value-key":"value",class:"w-25"},null,8,["modelValue"])}}}),fe=q({__name:"ScrollableChart",props:{contentHeight:{},maxHeightVh:{default:60},paddingClass:{default:"px-3 py-2"}},setup(l){const s=l,e=D(()=>typeof window>"u"?500:Math.round(window.innerHeight*s.maxHeightVh/100)),o=D(()=>s.contentHeight>e.value),c=D(()=>({maxHeight:`${s.maxHeightVh}vh`,overflowY:o.value?"auto":"hidden"}));return(u,d)=>(i(),I("div",{class:ee(l.paddingClass),style:xe(c.value)},[He(u.$slots,"default")],6))}}),Zt=q({__name:"EChartGraph",props:{data:{},height:{default:400},layout:{default:"circular"},directed:{type:Boolean,default:!1}},setup(l,{expose:s}){Je([Wt,Ke,jt,Qe]);const e=l,o=D(()=>typeof e.height=="number"?`${e.height}px`:e.height),c=mt(),u=L(null);let d=null;const m=["#ee4567","#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#9a60b4","#fc8452","#3ba272","#ea7ccc","#6e7074","#546570"],p=D(()=>{const b=new Set;return e.data.nodes.filter(_=>b.has(_.name)?!1:(b.add(_.name),!0))}),k=D(()=>{const b=new Map;return p.value.forEach((_,C)=>{b.set(_.name,m[C%m.length])}),b});function y(b,_){return _<=0?1:1+b/_*5}const g=D(()=>{const b=e.data.maxLinkValue||Math.max(...e.data.links.map(_=>_.value||1),1);return{tooltip:{trigger:"item",backgroundColor:c.value?"rgba(30, 30, 30, 0.9)":"rgba(255, 255, 255, 0.95)",borderColor:c.value?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.1)",textStyle:{color:c.value?"#e5e7eb":"#374151"},formatter:_=>_.dataType==="node"?`<b>${_.data.name}</b><br/>消息数: ${_.data.value||0}`:_.dataType==="edge"?`${_.data.source} → ${_.data.target}<br/>艾特次数: ${_.data.value||0}`:""},animationDuration:1e3,animationDurationUpdate:500,animationEasingUpdate:"quinticInOut",series:[{type:"graph",layout:e.layout,circular:e.layout==="circular"?{rotateLabel:!0}:void 0,force:e.layout==="force"?{repulsion:300,gravity:.1,edgeLength:[80,200],friction:.6}:void 0,roam:!0,scaleLimit:{min:.3,max:3},draggable:!0,label:{show:!0,position:"right",formatter:"{b}",color:c.value?"#e5e7eb":"#374151",fontSize:11,fontWeight:500},edgeSymbol:e.directed?["none","arrow"]:["none","none"],edgeSymbolSize:e.directed?[0,10]:[0,0],lineStyle:{curveness:.3,opacity:.5},emphasis:{focus:"adjacency",label:{show:!0,fontSize:13,fontWeight:600},lineStyle:{width:4,opacity:.9},itemStyle:{shadowBlur:15,shadowColor:"rgba(0, 0, 0, 0.3)"}},data:p.value.map(_=>{const C=k.value.get(_.name)||m[0];return{name:_.name,value:_.value,symbolSize:_.symbolSize||30,label:{show:e.layout==="circular"?!0:(_.symbolSize||30)>30},itemStyle:{color:C,borderColor:"#fff",borderWidth:2,shadowBlur:5,shadowColor:`${C}66`}}}),links:e.data.links.filter(_=>k.value.has(_.source)&&k.value.has(_.target)).map(_=>{const C=k.value.get(_.source)||m[0];return{source:_.source,target:_.target,value:_.value,lineStyle:{color:C,width:y(_.value||1,b)}}})}]}});function n(){u.value&&(d=Xe(u.value,c.value?"dark":void 0,{renderer:"canvas"}),d.setOption({backgroundColor:"transparent",...g.value}))}function r(){d&&d.setOption({backgroundColor:"transparent",...g.value},{notMerge:!0})}function h(){d?.resize()}function f(){d&&d.dispatchAction({type:"restore"})}return s({resetView:f}),G([()=>e.data,()=>e.layout,()=>e.directed,c],()=>{d?r():n()},{deep:!0}),ke(()=>{n(),window.addEventListener("resize",h)}),De(()=>{window.removeEventListener("resize",h),d?.dispose()}),(b,_)=>(i(),I("div",{ref_key:"chartRef",ref:u,style:xe({height:o.value,width:"100%"})},null,4))}}),es={class:"px-3 py-2"},Ie=q({__name:"EChartRank",props:{members:{},title:{},description:{},topN:{default:10},unit:{default:"条"},height:{default:"auto"},maxHeightVh:{default:60},bare:{type:Boolean,default:!1}},setup(l){const s=l,e=D(()=>s.members.slice(0,s.topN)),o=D(()=>{if(s.height!=="auto")return s.height;const m=e.value.length*36;return Math.max(m+30,180)}),c={type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:"#ee4567"},{offset:1,color:"#f7758c"}]};function u(m,p=8){return m.length<=p?m:m.slice(0,p)+"…"}const d=D(()=>{const m=[...e.value].reverse(),p=m.map(n=>u(n.name)),k=m.map(n=>n.value),y=Math.max(...k,1),g=m.map(n=>({value:n.value,itemStyle:{color:c,borderRadius:[0,4,4,0]}}));return{tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"rgba(0, 0, 0, 0.8)",borderColor:"transparent",textStyle:{color:"#fff"},formatter:n=>{const r=n[0];if(!r)return"";const h=e.value.length-1-r.dataIndex,f=e.value[h];return`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/EChartWordcloud-B_YisOW5.js","assets/vendor-echarts-wordcloud-B1kQMklB.js","assets/vendor-echarts-CITQeskI.js","assets/vendor-zrender-DFl4U2Oe.js","assets/vendor-reka-ui-mMvma1EP.js","assets/MessageExportModal-C7NgEL8T.js","assets/vendor-nuxt-ui-Zy8txNdC.js","assets/index-DqDa_on9.js","assets/vendor-snapdom-XnBoh1gd.js","assets/index-D3N4NDFx.css","assets/DebugToolsPanel.vue_vue_type_script_setup_true_lang-BTJxEma5.js","assets/index-D7_ch4zf.js","assets/DebugToolsPanel-CrqULdXp.css"])))=>i.map(i=>d[i]);
2
+ import{_ as ze}from"./vendor-snapdom-XnBoh1gd.js";import{k as st,g as be,b as pe,l as at,a as $e,j as Fe,c as nt,e as Be,_ as Ue,n as ot,D as rt,u as it,d as lt}from"./vendor-nuxt-ui-Zy8txNdC.js";import{b as L,d as ke,F as De,p as q,G as i,P as I,Q as ee,a5 as a,Z as P,a3 as se,T as x,O as He,J as ct,H as N,a0 as xe,h as D,w as G,u as t,K as A,L as w,U as B,R as Q,bI as We,a9 as je,bJ as dt,au as Pe,bF as qe,n as Se,bD as Re,i as ut}from"./vendor-reka-ui-mMvma1EP.js";import{p as mt,u as ae,k as Ne,T as de,j as Y,q as gt,r as Ye,_ as Le,t as pt,e as ht,b as vt,s as ft}from"./index-DqDa_on9.js";import{a as we}from"./index-D7_ch4zf.js";import{_ as ne,a as K,g as Ge,b as yt,c as oe,d as ce,e as xt,f as Te,h as bt,i as Ae,j as kt,u as _t,k as wt,l as $t,m as It,n as Ct,o as St,p as Mt,q as Tt,r as Dt,s as Rt,t as Nt,P as Lt,v as Vt,w as At,x as Et,y as Ot,C as zt,z as Ft,A as Bt,D as Ut,B as Ht}from"./DebugToolsPanel.vue_vue_type_script_setup_true_lang-BTJxEma5.js";import"./vendor-echarts-wordcloud-B1kQMklB.js";import{u as Je,i as Wt,j as Ke,k as jt,m as Qe,n as Xe,o as Pt,p as qt,q as Yt}from"./vendor-echarts-CITQeskI.js";import"./vendor-zrender-DFl4U2Oe.js";function Gt(l,s={}){const{threshold:e=300,containerSelector:o=".overflow-y-auto",scrollLockDuration:c=800}=s,u=L(l[0]?.id||"");let d=!1;const m=L(null);let p=null;function k(){if(d)return;const g=[];l.forEach(r=>{const h=document.getElementById(r.id);if(h){const f=h.getBoundingClientRect();g.push({id:r.id,top:Math.round(f.top)})}});let n=0;for(let r=0;r<g.length;r++){if(g[r].top>e){n=Math.max(0,r-1);break}n=r}u.value=l[n]?.id||""}function y(g){const n=document.getElementById(g);n&&(u.value=g,d=!0,n.scrollIntoView({behavior:"smooth",block:"start"}),setTimeout(()=>{d=!1,k()},c))}return ke(()=>{p=m.value?.closest(o)||null,p&&(p.addEventListener("scroll",k,{passive:!0}),k())}),De(()=>{p&&p.removeEventListener("scroll",k)}),{contentRef:m,activeAnchor:u,scrollToAnchor:y,updateActiveAnchor:k}}const Jt={class:"sticky top-24 space-y-6"},Kt={class:"border-l border-gray-200 dark:border-gray-800"},Qt=["onClick"],Xt=q({__name:"PageAnchorsNav",props:{anchors:{},activeAnchor:{},width:{default:"w-44"},hideOnMobile:{type:Boolean,default:!0}},emits:["click"],setup(l,{emit:s}){const e=s;function o(c){e("click",c)}return(c,u)=>(i(),I("div",{class:ee([l.width,"shrink-0",l.hideOnMobile?"hidden lg:block":""])},[a("div",Jt,[a("nav",null,[a("div",Kt,[(i(!0),I(P,null,se(l.anchors,d=>(i(),I("button",{key:d.id,class:ee(["-ml-px block border-l-2 py-1.5 pl-4 text-left text-sm transition-colors",[l.activeAnchor===d.id?"border-pink-500 font-medium text-pink-600 dark:text-pink-400":"border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300"]]),onClick:m=>o(d.id)},x(d.label),11,Qt))),128))])]),He(c.$slots,"default")])],2))}}),me=q({__name:"TopNSelect",props:{modelValue:{default:10},modelModifiers:{}},emits:["update:modelValue"],setup(l){const s=ct(l,"modelValue"),e=[{label:"Top 5",value:5},{label:"Top 10",value:10},{label:"Top 20",value:20},{label:"Top 30",value:30},{label:"Top 50",value:50},{label:"Top 100",value:100}];return(o,c)=>{const u=st;return i(),N(u,{modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),items:e,"value-key":"value",class:"w-25"},null,8,["modelValue"])}}}),fe=q({__name:"ScrollableChart",props:{contentHeight:{},maxHeightVh:{default:60},paddingClass:{default:"px-3 py-2"}},setup(l){const s=l,e=D(()=>typeof window>"u"?500:Math.round(window.innerHeight*s.maxHeightVh/100)),o=D(()=>s.contentHeight>e.value),c=D(()=>({maxHeight:`${s.maxHeightVh}vh`,overflowY:o.value?"auto":"hidden"}));return(u,d)=>(i(),I("div",{class:ee(l.paddingClass),style:xe(c.value)},[He(u.$slots,"default")],6))}}),Zt=q({__name:"EChartGraph",props:{data:{},height:{default:400},layout:{default:"circular"},directed:{type:Boolean,default:!1}},setup(l,{expose:s}){Je([Wt,Ke,jt,Qe]);const e=l,o=D(()=>typeof e.height=="number"?`${e.height}px`:e.height),c=mt(),u=L(null);let d=null;const m=["#ee4567","#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#9a60b4","#fc8452","#3ba272","#ea7ccc","#6e7074","#546570"],p=D(()=>{const b=new Set;return e.data.nodes.filter(_=>b.has(_.name)?!1:(b.add(_.name),!0))}),k=D(()=>{const b=new Map;return p.value.forEach((_,C)=>{b.set(_.name,m[C%m.length])}),b});function y(b,_){return _<=0?1:1+b/_*5}const g=D(()=>{const b=e.data.maxLinkValue||Math.max(...e.data.links.map(_=>_.value||1),1);return{tooltip:{trigger:"item",backgroundColor:c.value?"rgba(30, 30, 30, 0.9)":"rgba(255, 255, 255, 0.95)",borderColor:c.value?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.1)",textStyle:{color:c.value?"#e5e7eb":"#374151"},formatter:_=>_.dataType==="node"?`<b>${_.data.name}</b><br/>消息数: ${_.data.value||0}`:_.dataType==="edge"?`${_.data.source} → ${_.data.target}<br/>艾特次数: ${_.data.value||0}`:""},animationDuration:1e3,animationDurationUpdate:500,animationEasingUpdate:"quinticInOut",series:[{type:"graph",layout:e.layout,circular:e.layout==="circular"?{rotateLabel:!0}:void 0,force:e.layout==="force"?{repulsion:300,gravity:.1,edgeLength:[80,200],friction:.6}:void 0,roam:!0,scaleLimit:{min:.3,max:3},draggable:!0,label:{show:!0,position:"right",formatter:"{b}",color:c.value?"#e5e7eb":"#374151",fontSize:11,fontWeight:500},edgeSymbol:e.directed?["none","arrow"]:["none","none"],edgeSymbolSize:e.directed?[0,10]:[0,0],lineStyle:{curveness:.3,opacity:.5},emphasis:{focus:"adjacency",label:{show:!0,fontSize:13,fontWeight:600},lineStyle:{width:4,opacity:.9},itemStyle:{shadowBlur:15,shadowColor:"rgba(0, 0, 0, 0.3)"}},data:p.value.map(_=>{const C=k.value.get(_.name)||m[0];return{name:_.name,value:_.value,symbolSize:_.symbolSize||30,label:{show:e.layout==="circular"?!0:(_.symbolSize||30)>30},itemStyle:{color:C,borderColor:"#fff",borderWidth:2,shadowBlur:5,shadowColor:`${C}66`}}}),links:e.data.links.filter(_=>k.value.has(_.source)&&k.value.has(_.target)).map(_=>{const C=k.value.get(_.source)||m[0];return{source:_.source,target:_.target,value:_.value,lineStyle:{color:C,width:y(_.value||1,b)}}})}]}});function n(){u.value&&(d=Xe(u.value,c.value?"dark":void 0,{renderer:"canvas"}),d.setOption({backgroundColor:"transparent",...g.value}))}function r(){d&&d.setOption({backgroundColor:"transparent",...g.value},{notMerge:!0})}function h(){d?.resize()}function f(){d&&d.dispatchAction({type:"restore"})}return s({resetView:f}),G([()=>e.data,()=>e.layout,()=>e.directed,c],()=>{d?r():n()},{deep:!0}),ke(()=>{n(),window.addEventListener("resize",h)}),De(()=>{window.removeEventListener("resize",h),d?.dispose()}),(b,_)=>(i(),I("div",{ref_key:"chartRef",ref:u,style:xe({height:o.value,width:"100%"})},null,4))}}),es={class:"px-3 py-2"},Ie=q({__name:"EChartRank",props:{members:{},title:{},description:{},topN:{default:10},unit:{default:"条"},height:{default:"auto"},maxHeightVh:{default:60},bare:{type:Boolean,default:!1}},setup(l){const s=l,e=D(()=>s.members.slice(0,s.topN)),o=D(()=>{if(s.height!=="auto")return s.height;const m=e.value.length*36;return Math.max(m+30,180)}),c={type:"linear",x:0,y:0,x2:1,y2:0,colorStops:[{offset:0,color:"#ee4567"},{offset:1,color:"#f7758c"}]};function u(m,p=8){return m.length<=p?m:m.slice(0,p)+"…"}const d=D(()=>{const m=[...e.value].reverse(),p=m.map(n=>u(n.name)),k=m.map(n=>n.value),y=Math.max(...k,1),g=m.map(n=>({value:n.value,itemStyle:{color:c,borderRadius:[0,4,4,0]}}));return{tooltip:{trigger:"axis",axisPointer:{type:"shadow"},backgroundColor:"rgba(0, 0, 0, 0.8)",borderColor:"transparent",textStyle:{color:"#fff"},formatter:n=>{const r=n[0];if(!r)return"";const h=e.value.length-1-r.dataIndex,f=e.value[h];return`
3
3
  <div style="padding: 4px 8px;">
4
4
  <div style="font-weight: bold; margin-bottom: 4px;">${f.name}</div>
5
5
  <div>${f.value} ${s.unit} (${f.percentage}%)</div>
6
6
  </div>
7
- `}},grid:{left:110,right:70,top:15,bottom:15,containLabel:!1},xAxis:{type:"value",max:y*1.1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1}},yAxis:{type:"category",data:p,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:12,color:"#4b5563",margin:12,formatter:(n,r)=>{const f=e.value.length-1-r+1;return`${f===1?"🥇":f===2?"🥈":f===3?"🥉":`${f}.`} ${n}`}}},series:[{type:"bar",data:g,barWidth:18,barCategoryGap:"30%",label:{show:!0,position:"right",distance:8,formatter:n=>{const r=e.value.length-1-n.dataIndex;return`${e.value[r].value} ${s.unit}`},fontSize:11,fontWeight:500,color:"#6b7280"},emphasis:{itemStyle:{shadowBlur:6,shadowColor:"rgba(238, 69, 103, 0.3)"}}}]}});return(m,p)=>l.bare?(i(),N(t(fe),{key:0,"content-height":o.value,"max-height-vh":l.maxHeightVh},{default:A(()=>[w(ne,{option:d.value,height:o.value},null,8,["option","height"])]),_:1},8,["content-height","max-height-vh"])):(i(),N(t(K),{key:1,title:l.title,description:l.description,scrollable:"","max-height-vh":l.maxHeightVh},{default:A(()=>[a("div",es,[w(ne,{option:d.value,height:o.value},null,8,["option","height"])])]),_:1},8,["title","description","max-height-vh"]))}}),ts={class:"divide-y divide-gray-100 dark:divide-gray-800"},ss={key:0,class:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-linear-to-br from-pink-100 to-rose-100 text-sm font-medium text-pink-600 dark:from-pink-900/30 dark:to-rose-900/30 dark:text-pink-400"},as={class:"w-32 shrink-0"},ns={class:"wrap-break-word font-medium text-gray-900 dark:text-white"},os={class:"flex flex-1 items-center"},rs={class:"h-2 w-full overflow-hidden rounded-full bg-gray-100 dark:bg-gray-800"},is={class:"flex shrink-0 items-baseline gap-2 whitespace-nowrap"},ls={class:"text-lg font-bold text-gray-900 dark:text-white"},cs={class:"text-sm text-gray-500"},Ee=q({__name:"RankList",props:{members:{},showAvatar:{type:Boolean,default:!1},rankLimit:{default:0},unit:{}},setup(l){const{t:s}=ae(),e=l,o=D(()=>e.unit||s("views.charts.rankList.unit")),c=D(()=>e.rankLimit>0?e.members.slice(0,e.rankLimit):e.members);function u(d){if(c.value.length===0)return 0;const m=c.value[0].value;return m===0?0:Math.round(c.value[d].value/m*100)}return(d,m)=>(i(),I("div",ts,[(i(!0),I(P,null,se(c.value,(p,k)=>(i(),I("div",{key:p.id,class:"flex items-center gap-3 px-5 py-3 transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/50"},[a("div",{class:ee(["flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-bold",t(Ge)(k)])},x(k+1),3),l.showAvatar?(i(),I("div",ss,x(p.name.slice(0,1)),1)):B("",!0),a("div",as,[a("p",ns,x(p.name),1)]),a("div",os,[a("div",rs,[a("div",{class:ee(["h-full rounded-full bg-linear-to-r transition-all",t(yt)(k)]),style:xe({width:`${u(k)}%`})},null,6)])]),a("div",is,[a("span",ls,x(p.value),1),a("span",cs,x(o.value)+" ("+x(p.percentage)+"%)",1)])]))),128))]))}}),ds={class:"flex items-center justify-between border-b border-gray-200 px-5 py-3 dark:border-gray-800"},us={class:"font-semibold text-gray-900 whitespace-nowrap dark:text-white"},ms={key:0,class:"mt-1 text-sm text-gray-500 dark:text-gray-400"},gs={class:"no-capture flex items-center gap-1"},ps={class:"flex w-full items-center justify-between border-b border-gray-200 px-6 py-4 dark:border-gray-700"},hs={class:"flex items-center gap-2"},vs={class:"text-lg font-semibold text-gray-900 whitespace-nowrap dark:text-white"},fs={class:"text-sm text-gray-500"},ys={class:"max-h-[60vh] p-4 overflow-y-auto"},Oe=q({__name:"RankListPro",props:{members:{},title:{},description:{},topN:{default:10},unit:{}},setup(l){const{t:s}=ae(),e=l,o=L(!1),c=L(null),u=L(null),d=D(()=>e.members.slice(0,e.topN)),m=D(()=>e.members.length>e.topN);return(p,k)=>{const y=pe,g=be;return i(),I("div",{ref_key:"cardRef",ref:c,class:"rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900"},[a("div",ds,[a("div",null,[a("h3",us,x(l.title),1),l.description?(i(),I("p",ms,x(l.description),1)):B("",!0)]),a("div",gs,[w(we,{size:"xs",type:"element","target-element":c.value},null,8,["target-element"]),w(g,{open:o.value,"onUpdate:open":k[0]||(k[0]=n=>o.value=n),ui:{content:"md:w-full max-w-3xl"}},{content:A(()=>[a("div",{ref_key:"modalBodyRef",ref:u,class:"section-content flex flex-col"},[a("div",ps,[a("div",hs,[a("h3",vs,x(l.title),1),a("span",fs," ("+x(t(s)("views.charts.rankListPro.memberCount",{count:l.members.length}))+") ",1)]),w(we,{size:"xs",type:"element","target-element":u.value},null,8,["target-element"])]),a("div",ys,[w(Ee,{members:l.members,unit:l.unit},null,8,["members","unit"])])],512)]),default:A(()=>[m.value?(i(),N(y,{key:0,icon:"i-heroicons-list-bullet",variant:"ghost"},{default:A(()=>[Q(x(t(s)("views.charts.rankListPro.fullRanking")),1)]),_:1})):B("",!0)]),_:1},8,["open"])])]),w(Ee,{members:d.value,unit:l.unit},null,8,["members","unit"])],512)}}}),xs={class:"main-content mx-auto max-w-6xl py-6"},bs={class:"mb-4 flex items-center justify-end gap-4"},ks={class:"text-xs text-gray-500 dark:text-gray-400"},_s={key:0,class:"grid grid-cols-2 gap-6"},ws={class:"mb-3 text-center"},$s={class:"text-base font-semibold text-gray-900 dark:text-white"},Is={class:"flex flex-wrap gap-2"},Cs=["title","onClick"],Ss={class:"text-xs opacity-50"},Ms={key:1,class:"grid grid-cols-2 gap-6"},Ts={class:"mb-3 text-center"},Ds={class:"text-base font-semibold text-gray-900 dark:text-white"},Rs={class:"relative w-full",style:{"aspect-ratio":"4 / 3"}},Ns={class:"mt-4 text-center text-xs text-gray-500 dark:text-gray-400"},Ls=q({__name:"CatchphraseTab",props:{sessionId:{},timeFilter:{}},setup(l){const s=We(()=>ze(()=>import("./EChartWordcloud-CzhfrEF_.js"),__vite__mapDeps([0,1,2,3,4]))),{t:e}=ae(),o=Ne(),c=l,u=L(null),d=L(!1),m=L("list"),p=L(30),k=D(()=>[{label:e("quotes.catchphrase.viewMode.list"),value:"list"},{label:e("quotes.catchphrase.viewMode.wordcloud"),value:"wordcloud"}]),y=[{label:"10",value:10},{label:"30",value:30},{label:"50",value:50},{label:"100",value:100}],g=D(()=>u.value&&u.value.members.length>0),n=D(()=>{if(!u.value)return[];const v=p.value;return console.log("[CatchphraseTab] displayMembers recompute, topN:",v,"type:",typeof v),u.value.members.map($=>{const S=$.catchphrases.slice(0,v);return console.log("[CatchphraseTab]",$.name,"total:",$.catchphrases.length,"display:",S.length),{...$,catchphrases:S}})}),r=D(()=>n.value.map(v=>({name:v.name,data:{words:v.catchphrases.map($=>({word:$.content,count:$.count}))}}))),h=[{bg:"bg-amber-50 dark:bg-amber-900/20",text:"text-amber-700 dark:text-amber-400",badge:"bg-amber-100 dark:bg-amber-800/40 text-amber-600 dark:text-amber-300"},{bg:"bg-slate-50 dark:bg-slate-800/40",text:"text-slate-600 dark:text-slate-300",badge:"bg-slate-100 dark:bg-slate-700/60 text-slate-500 dark:text-slate-400"},{bg:"bg-orange-50 dark:bg-orange-900/15",text:"text-orange-600 dark:text-orange-400",badge:"bg-orange-100 dark:bg-orange-800/30 text-orange-500 dark:text-orange-300"}];function f(v){return v<h.length?h[v]:{bg:"bg-gray-50 dark:bg-gray-800/30",text:"text-gray-600 dark:text-gray-400",badge:"bg-gray-100 dark:bg-gray-700/40 text-gray-500 dark:text-gray-400"}}function b(v,$=20){return v.length<=$?v:v.slice(0,$)+"..."}async function _(){if(c.sessionId){d.value=!0;try{u.value=await Y().getCatchphraseAnalysis(c.sessionId,c.timeFilter),console.log("[CatchphraseTab] API result: members:",u.value?.members.length,"per-member catchphrases:",u.value?.members.map(v=>({name:v.name,count:v.catchphrases.length})))}catch(v){console.error("Failed to load catchphrase analysis:",v)}finally{d.value=!1}}}function C(v){o.openChatRecordDrawer({keywords:[v]})}return G(p,(v,$)=>{console.log("[CatchphraseTab] topN changed:",$,"->",v,"type:",typeof v)}),G(()=>[c.sessionId,c.timeFilter],()=>{_()},{immediate:!0,deep:!0}),(v,$)=>(i(),I("div",xs,[d.value?(i(),N(t(oe),{key:0,text:t(e)("quotes.catchphrase.loading")},null,8,["text"])):g.value?(i(),I(P,{key:2},[a("div",bs,[a("span",ks,x(t(e)("quotes.catchphrase.topN")),1),w(t(de),{modelValue:p.value,"onUpdate:modelValue":$[0]||($[0]=S=>p.value=S),size:"xs",items:y},null,8,["modelValue"]),$[2]||($[2]=a("div",{class:"h-4 w-px bg-gray-200 dark:bg-gray-700"},null,-1)),w(t(de),{modelValue:m.value,"onUpdate:modelValue":$[1]||($[1]=S=>m.value=S),size:"xs",items:k.value},null,8,["modelValue","items"])]),m.value==="list"?(i(),I("div",_s,[(i(!0),I(P,null,se(n.value,S=>(i(),I("div",{key:S.memberId},[a("div",ws,[a("span",$s,x(S.name),1)]),a("div",Is,[(i(!0),I(P,null,se(S.catchphrases,(M,T)=>(i(),I("div",{key:T,class:ee(["inline-flex cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 transition-opacity hover:opacity-75",f(T).bg]),title:M.content,onClick:V=>C(M.content)},[T<3?(i(),I("span",{key:0,class:ee(["flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-[10px] font-bold",f(T).badge])},x(T+1),3)):B("",!0),a("span",{class:ee(["text-sm font-medium",f(T).text])},x(b(M.content)),3),a("span",Ss,x(t(e)("quotes.catchphrase.times",{count:M.count})),1)],10,Cs))),128))])]))),128))])):(i(),I("div",Ms,[(i(!0),I(P,null,se(r.value,S=>(i(),I("div",{key:S.name},[a("div",Ts,[a("span",Ds,x(S.name),1)]),a("div",Rs,[S.data.words.length===0?(i(),N(t(ce),{key:0,text:t(e)("quotes.catchphrase.empty.title"),class:"h-full"},null,8,["text"])):(i(),N(t(s),{key:1,data:S.data,height:"100%","max-words":p.value,"color-scheme":"default","size-scale":1,loading:d.value,onWordClick:C},null,8,["data","max-words","loading"]))])]))),128))])),a("p",Ns,x(t(e)("quotes.catchphrase.stats.clickHint")),1)],64)):(i(),N(t(ce),{key:1,text:t(e)("quotes.catchphrase.empty.title")},null,8,["text"]))]))}});function ye(l){const s=[],e=[];return l?.startTs!=null&&(s.push("AND msg.ts >= ?"),e.push(l.startTs)),l?.endTs!=null&&(s.push("AND msg.ts <= ?"),e.push(l.endTs)),l?.memberId!=null&&(s.push("AND msg.sender_id = ?"),e.push(l.memberId)),{conditions:s.join(" "),params:e}}const ve="AND COALESCE(m.account_name, '') != '系统消息'";async function Vs(l,s){const{conditions:e,params:o}=ye(s),[c,u]=await Promise.all([Y().pluginQuery(l,`WITH daily_counts AS (
7
+ `}},grid:{left:110,right:70,top:15,bottom:15,containLabel:!1},xAxis:{type:"value",max:y*1.1,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{show:!1},splitLine:{show:!1}},yAxis:{type:"category",data:p,axisLine:{show:!1},axisTick:{show:!1},axisLabel:{fontSize:12,color:"#4b5563",margin:12,formatter:(n,r)=>{const f=e.value.length-1-r+1;return`${f===1?"🥇":f===2?"🥈":f===3?"🥉":`${f}.`} ${n}`}}},series:[{type:"bar",data:g,barWidth:18,barCategoryGap:"30%",label:{show:!0,position:"right",distance:8,formatter:n=>{const r=e.value.length-1-n.dataIndex;return`${e.value[r].value} ${s.unit}`},fontSize:11,fontWeight:500,color:"#6b7280"},emphasis:{itemStyle:{shadowBlur:6,shadowColor:"rgba(238, 69, 103, 0.3)"}}}]}});return(m,p)=>l.bare?(i(),N(t(fe),{key:0,"content-height":o.value,"max-height-vh":l.maxHeightVh},{default:A(()=>[w(ne,{option:d.value,height:o.value},null,8,["option","height"])]),_:1},8,["content-height","max-height-vh"])):(i(),N(t(K),{key:1,title:l.title,description:l.description,scrollable:"","max-height-vh":l.maxHeightVh},{default:A(()=>[a("div",es,[w(ne,{option:d.value,height:o.value},null,8,["option","height"])])]),_:1},8,["title","description","max-height-vh"]))}}),ts={class:"divide-y divide-gray-100 dark:divide-gray-800"},ss={key:0,class:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-linear-to-br from-pink-100 to-rose-100 text-sm font-medium text-pink-600 dark:from-pink-900/30 dark:to-rose-900/30 dark:text-pink-400"},as={class:"w-32 shrink-0"},ns={class:"wrap-break-word font-medium text-gray-900 dark:text-white"},os={class:"flex flex-1 items-center"},rs={class:"h-2 w-full overflow-hidden rounded-full bg-gray-100 dark:bg-gray-800"},is={class:"flex shrink-0 items-baseline gap-2 whitespace-nowrap"},ls={class:"text-lg font-bold text-gray-900 dark:text-white"},cs={class:"text-sm text-gray-500"},Ee=q({__name:"RankList",props:{members:{},showAvatar:{type:Boolean,default:!1},rankLimit:{default:0},unit:{}},setup(l){const{t:s}=ae(),e=l,o=D(()=>e.unit||s("views.charts.rankList.unit")),c=D(()=>e.rankLimit>0?e.members.slice(0,e.rankLimit):e.members);function u(d){if(c.value.length===0)return 0;const m=c.value[0].value;return m===0?0:Math.round(c.value[d].value/m*100)}return(d,m)=>(i(),I("div",ts,[(i(!0),I(P,null,se(c.value,(p,k)=>(i(),I("div",{key:p.id,class:"flex items-center gap-3 px-5 py-3 transition-colors hover:bg-gray-50 dark:hover:bg-gray-800/50"},[a("div",{class:ee(["flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-sm font-bold",t(Ge)(k)])},x(k+1),3),l.showAvatar?(i(),I("div",ss,x(p.name.slice(0,1)),1)):B("",!0),a("div",as,[a("p",ns,x(p.name),1)]),a("div",os,[a("div",rs,[a("div",{class:ee(["h-full rounded-full bg-linear-to-r transition-all",t(yt)(k)]),style:xe({width:`${u(k)}%`})},null,6)])]),a("div",is,[a("span",ls,x(p.value),1),a("span",cs,x(o.value)+" ("+x(p.percentage)+"%)",1)])]))),128))]))}}),ds={class:"flex items-center justify-between border-b border-gray-200 px-5 py-3 dark:border-gray-800"},us={class:"font-semibold text-gray-900 whitespace-nowrap dark:text-white"},ms={key:0,class:"mt-1 text-sm text-gray-500 dark:text-gray-400"},gs={class:"no-capture flex items-center gap-1"},ps={class:"flex w-full items-center justify-between border-b border-gray-200 px-6 py-4 dark:border-gray-700"},hs={class:"flex items-center gap-2"},vs={class:"text-lg font-semibold text-gray-900 whitespace-nowrap dark:text-white"},fs={class:"text-sm text-gray-500"},ys={class:"max-h-[60vh] p-4 overflow-y-auto"},Oe=q({__name:"RankListPro",props:{members:{},title:{},description:{},topN:{default:10},unit:{}},setup(l){const{t:s}=ae(),e=l,o=L(!1),c=L(null),u=L(null),d=D(()=>e.members.slice(0,e.topN)),m=D(()=>e.members.length>e.topN);return(p,k)=>{const y=pe,g=be;return i(),I("div",{ref_key:"cardRef",ref:c,class:"rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-800 dark:bg-gray-900"},[a("div",ds,[a("div",null,[a("h3",us,x(l.title),1),l.description?(i(),I("p",ms,x(l.description),1)):B("",!0)]),a("div",gs,[w(we,{size:"xs",type:"element","target-element":c.value},null,8,["target-element"]),w(g,{open:o.value,"onUpdate:open":k[0]||(k[0]=n=>o.value=n),ui:{content:"md:w-full max-w-3xl"}},{content:A(()=>[a("div",{ref_key:"modalBodyRef",ref:u,class:"section-content flex flex-col"},[a("div",ps,[a("div",hs,[a("h3",vs,x(l.title),1),a("span",fs," ("+x(t(s)("views.charts.rankListPro.memberCount",{count:l.members.length}))+") ",1)]),w(we,{size:"xs",type:"element","target-element":u.value},null,8,["target-element"])]),a("div",ys,[w(Ee,{members:l.members,unit:l.unit},null,8,["members","unit"])])],512)]),default:A(()=>[m.value?(i(),N(y,{key:0,icon:"i-heroicons-list-bullet",variant:"ghost"},{default:A(()=>[Q(x(t(s)("views.charts.rankListPro.fullRanking")),1)]),_:1})):B("",!0)]),_:1},8,["open"])])]),w(Ee,{members:d.value,unit:l.unit},null,8,["members","unit"])],512)}}}),xs={class:"main-content mx-auto max-w-6xl py-6"},bs={class:"mb-4 flex items-center justify-end gap-4"},ks={class:"text-xs text-gray-500 dark:text-gray-400"},_s={key:0,class:"grid grid-cols-2 gap-6"},ws={class:"mb-3 text-center"},$s={class:"text-base font-semibold text-gray-900 dark:text-white"},Is={class:"flex flex-wrap gap-2"},Cs=["title","onClick"],Ss={class:"text-xs opacity-50"},Ms={key:1,class:"grid grid-cols-2 gap-6"},Ts={class:"mb-3 text-center"},Ds={class:"text-base font-semibold text-gray-900 dark:text-white"},Rs={class:"relative w-full",style:{"aspect-ratio":"4 / 3"}},Ns={class:"mt-4 text-center text-xs text-gray-500 dark:text-gray-400"},Ls=q({__name:"CatchphraseTab",props:{sessionId:{},timeFilter:{}},setup(l){const s=We(()=>ze(()=>import("./EChartWordcloud-B_YisOW5.js"),__vite__mapDeps([0,1,2,3,4]))),{t:e}=ae(),o=Ne(),c=l,u=L(null),d=L(!1),m=L("list"),p=L(30),k=D(()=>[{label:e("quotes.catchphrase.viewMode.list"),value:"list"},{label:e("quotes.catchphrase.viewMode.wordcloud"),value:"wordcloud"}]),y=[{label:"10",value:10},{label:"30",value:30},{label:"50",value:50},{label:"100",value:100}],g=D(()=>u.value&&u.value.members.length>0),n=D(()=>{if(!u.value)return[];const v=p.value;return console.log("[CatchphraseTab] displayMembers recompute, topN:",v,"type:",typeof v),u.value.members.map($=>{const S=$.catchphrases.slice(0,v);return console.log("[CatchphraseTab]",$.name,"total:",$.catchphrases.length,"display:",S.length),{...$,catchphrases:S}})}),r=D(()=>n.value.map(v=>({name:v.name,data:{words:v.catchphrases.map($=>({word:$.content,count:$.count}))}}))),h=[{bg:"bg-amber-50 dark:bg-amber-900/20",text:"text-amber-700 dark:text-amber-400",badge:"bg-amber-100 dark:bg-amber-800/40 text-amber-600 dark:text-amber-300"},{bg:"bg-slate-50 dark:bg-slate-800/40",text:"text-slate-600 dark:text-slate-300",badge:"bg-slate-100 dark:bg-slate-700/60 text-slate-500 dark:text-slate-400"},{bg:"bg-orange-50 dark:bg-orange-900/15",text:"text-orange-600 dark:text-orange-400",badge:"bg-orange-100 dark:bg-orange-800/30 text-orange-500 dark:text-orange-300"}];function f(v){return v<h.length?h[v]:{bg:"bg-gray-50 dark:bg-gray-800/30",text:"text-gray-600 dark:text-gray-400",badge:"bg-gray-100 dark:bg-gray-700/40 text-gray-500 dark:text-gray-400"}}function b(v,$=20){return v.length<=$?v:v.slice(0,$)+"..."}async function _(){if(c.sessionId){d.value=!0;try{u.value=await Y().getCatchphraseAnalysis(c.sessionId,c.timeFilter),console.log("[CatchphraseTab] API result: members:",u.value?.members.length,"per-member catchphrases:",u.value?.members.map(v=>({name:v.name,count:v.catchphrases.length})))}catch(v){console.error("Failed to load catchphrase analysis:",v)}finally{d.value=!1}}}function C(v){o.openChatRecordDrawer({keywords:[v]})}return G(p,(v,$)=>{console.log("[CatchphraseTab] topN changed:",$,"->",v,"type:",typeof v)}),G(()=>[c.sessionId,c.timeFilter],()=>{_()},{immediate:!0,deep:!0}),(v,$)=>(i(),I("div",xs,[d.value?(i(),N(t(oe),{key:0,text:t(e)("quotes.catchphrase.loading")},null,8,["text"])):g.value?(i(),I(P,{key:2},[a("div",bs,[a("span",ks,x(t(e)("quotes.catchphrase.topN")),1),w(t(de),{modelValue:p.value,"onUpdate:modelValue":$[0]||($[0]=S=>p.value=S),size:"xs",items:y},null,8,["modelValue"]),$[2]||($[2]=a("div",{class:"h-4 w-px bg-gray-200 dark:bg-gray-700"},null,-1)),w(t(de),{modelValue:m.value,"onUpdate:modelValue":$[1]||($[1]=S=>m.value=S),size:"xs",items:k.value},null,8,["modelValue","items"])]),m.value==="list"?(i(),I("div",_s,[(i(!0),I(P,null,se(n.value,S=>(i(),I("div",{key:S.memberId},[a("div",ws,[a("span",$s,x(S.name),1)]),a("div",Is,[(i(!0),I(P,null,se(S.catchphrases,(M,T)=>(i(),I("div",{key:T,class:ee(["inline-flex cursor-pointer items-center gap-1.5 rounded-full px-3 py-1.5 transition-opacity hover:opacity-75",f(T).bg]),title:M.content,onClick:V=>C(M.content)},[T<3?(i(),I("span",{key:0,class:ee(["flex h-4 w-4 shrink-0 items-center justify-center rounded-full text-[10px] font-bold",f(T).badge])},x(T+1),3)):B("",!0),a("span",{class:ee(["text-sm font-medium",f(T).text])},x(b(M.content)),3),a("span",Ss,x(t(e)("quotes.catchphrase.times",{count:M.count})),1)],10,Cs))),128))])]))),128))])):(i(),I("div",Ms,[(i(!0),I(P,null,se(r.value,S=>(i(),I("div",{key:S.name},[a("div",Ts,[a("span",Ds,x(S.name),1)]),a("div",Rs,[S.data.words.length===0?(i(),N(t(ce),{key:0,text:t(e)("quotes.catchphrase.empty.title"),class:"h-full"},null,8,["text"])):(i(),N(t(s),{key:1,data:S.data,height:"100%","max-words":p.value,"color-scheme":"default","size-scale":1,loading:d.value,onWordClick:C},null,8,["data","max-words","loading"]))])]))),128))])),a("p",Ns,x(t(e)("quotes.catchphrase.stats.clickHint")),1)],64)):(i(),N(t(ce),{key:1,text:t(e)("quotes.catchphrase.empty.title")},null,8,["text"]))]))}});function ye(l){const s=[],e=[];return l?.startTs!=null&&(s.push("AND msg.ts >= ?"),e.push(l.startTs)),l?.endTs!=null&&(s.push("AND msg.ts <= ?"),e.push(l.endTs)),l?.memberId!=null&&(s.push("AND msg.sender_id = ?"),e.push(l.memberId)),{conditions:s.join(" "),params:e}}const ve="AND COALESCE(m.account_name, '') != '系统消息'";async function Vs(l,s){const{conditions:e,params:o}=ye(s),[c,u]=await Promise.all([Y().pluginQuery(l,`WITH daily_counts AS (
8
8
  SELECT
9
9
  strftime('%Y-%m-%d', msg.ts, 'unixepoch', 'localtime') as date,
10
10
  msg.sender_id,
@@ -160,4 +160,4 @@ import{_ as ze}from"./vendor-snapdom-XnBoh1gd.js";import{k as st,g as be,b as pe
160
160
  FROM message msg
161
161
  JOIN member m ON msg.sender_id = m.id
162
162
  WHERE 1=1 ${eo} ${e}
163
- ORDER BY msg.ts ASC, msg.id ASC`,o)}function no(l){const{members:s,messages:e,options:o}=l;function c(R,F){return R<F?`${R}-${F}`:`${F}-${R}`}function u(R){return Math.round(R*100)/100}const d={nodes:[],links:[],maxLinkValue:0,communities:[],stats:{totalMembers:0,totalMessages:0,involvedMembers:0,edgeCount:0,communityCount:0}};if(s.length<2)return{...d,stats:{...d.stats,totalMembers:s.length}};const m=new Map;for(const R of s)m.set(R.id,{name:R.name,platformId:R.platformId,messageCount:R.messageCount});if(e.length<2)return{...d,stats:{...d.stats,totalMembers:s.length,totalMessages:e.length}};const p=new Map;for(const R of e)p.set(R.senderId,(p.get(R.senderId)||0)+1);const k=e.length,y=new Map,g=new Map;for(let R=0;R<e.length-1;R++){const F=e[R],E=new Set;let W=0;for(let X=R+1;X<e.length&&W<o.lookAhead;X++){const te=e[X];if(te.senderId===F.senderId||E.has(te.senderId))continue;E.add(te.senderId),W++;const le=(te.ts-F.ts)/1e3,re=Math.exp(-le/o.decaySeconds),ue=1-(W-1)*.2,z=re*ue,O=c(F.senderId,te.senderId);y.set(O,(y.get(O)||0)+z),g.set(O,(g.get(O)||0)+1)}}const n=o.lookAhead*.8,r=[];for(const[R,F]of y){const[E,W]=R.split("-"),X=parseInt(E),te=parseInt(W),le=p.get(X)||0,re=p.get(te)||0,ue=le*re/k*n,z=ue>0?F/ue:0;r.push({sourceId:X,targetId:te,rawScore:F,expectedScore:ue,normalizedScore:z,coOccurrenceCount:g.get(R)||0})}const h=Math.max(...r.map(R=>R.rawScore),1),f=Math.max(...r.map(R=>R.normalizedScore),1),b=r.map(R=>{const F=.5*(R.rawScore/h)+.5*(R.normalizedScore/f);return{...R,rawScore:u(R.rawScore),expectedScore:u(R.expectedScore),normalizedScore:u(R.normalizedScore),hybridScore:u(F)}});b.sort((R,F)=>F.hybridScore-R.hybridScore);const _=b.slice(0,o.topEdges);if(_.length===0)return{...d,stats:{...d.stats,totalMembers:s.length,totalMessages:e.length}};const C=new Set;for(const R of _)C.add(R.sourceId),C.add(R.targetId);const v=new Map;for(const R of _)v.set(R.sourceId,(v.get(R.sourceId)||0)+R.hybridScore),v.set(R.targetId,(v.get(R.targetId)||0)+R.hybridScore);const $=Math.max(...v.values(),1),S=new Map;for(const R of C){const F=m.get(R)?.name||String(R);S.set(F,(S.get(F)||0)+1)}const M=new Map;for(const R of C){const F=m.get(R),E=F?.name||String(R);(S.get(E)||0)>1?M.set(R,`${E}#${(F?.platformId||String(R)).slice(-4)}`):M.set(R,E)}const T=Math.max(...[...C].map(R=>m.get(R)?.messageCount||0),1),V=[...C].map(R=>{const F=m.get(R),E=v.get(R)||0,W=E/$,X=F.messageCount/T,te=20+(.7*W+.3*X)*35;return{id:R,name:M.get(R),messageCount:F.messageCount,symbolSize:Math.round(te),degree:u(E),normalizedDegree:u(W)}});V.sort((R,F)=>F.degree-R.degree);const H=_.length>0?Math.max(..._.map(R=>R.hybridScore)):0,U=_.map(R=>({source:M.get(R.sourceId),target:M.get(R.targetId),value:R.hybridScore,rawScore:R.rawScore,expectedScore:R.expectedScore,coOccurrenceCount:R.coOccurrenceCount}));return{nodes:V,links:U,maxLinkValue:u(H),communities:[],stats:{totalMembers:s.length,totalMessages:e.length,involvedMembers:C.size,edgeCount:_.length,communityCount:0}}}async function oo(l,s,e){const o={nodes:[],links:[],maxLinkValue:0,communities:[],stats:{totalMembers:0,totalMessages:0,involvedMembers:0,edgeCount:0,communityCount:0}};try{const[c,u]=await Promise.all([so(l),ao(l,s)]);if(c.length<2||u.length<2)return{...o,stats:{...o.stats,totalMembers:c.length,totalMessages:u.length}};const d={...Zn,...e};return await Y().pluginCompute(no.toString(),{members:c,messages:u,options:d})}catch(c){return console.error("[chart-cluster] Failed to load cluster graph:",c),o}}const ro={class:"mx-auto max-w-[920px] p-4 h-full"},io={class:"flex h-full flex-col rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm overflow-hidden"},lo={class:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50"},co={class:"flex items-center gap-3"},uo={class:"flex items-center gap-3"},mo={class:"p-3 w-64"},go={class:"text-sm font-medium mb-3"},po={class:"space-y-3"},ho={class:"text-xs text-gray-500 mb-1 block"},vo={class:"text-xs text-gray-400 mt-1"},fo={class:"text-xs text-gray-500 mb-1 block"},yo={class:"text-xs text-gray-400 mt-1"},xo={class:"flex-1 min-h-0 overflow-hidden"},bo={key:0,class:"h-full flex items-center justify-center"},ko={key:1,class:"h-full flex items-center justify-center"},_o={class:"text-center text-gray-400"},wo={key:2,class:"h-full"},$o={key:3,class:"h-full flex overflow-hidden"},Io={class:"w-64 border-r border-gray-200 dark:border-gray-700 flex flex-col overflow-hidden"},Co={class:"px-4 py-3 border-b border-gray-200 dark:border-gray-700"},So={class:"text-sm font-medium flex items-center gap-2"},Mo={class:"flex-1 overflow-y-auto"},To=["onClick"],Do={class:"flex items-center justify-between"},Ro={class:"text-sm truncate"},No={class:"text-xs text-gray-400"},Lo={class:"flex-1 overflow-hidden flex flex-col"},Vo={key:0,class:"flex-1 flex items-center justify-center"},Ao={class:"text-center text-gray-400"},Eo={class:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center gap-3"},Oo={class:"w-10 h-10 rounded-full flex items-center justify-center text-white font-bold bg-primary-500"},zo={class:"font-medium"},Fo={class:"text-xs text-gray-400"},Bo={class:"px-4 py-3 border-b border-gray-200 dark:border-gray-700"},Uo={class:"text-sm font-medium flex items-center gap-2"},Ho={class:"flex-1 overflow-y-auto"},Wo={key:0,class:"p-4 text-center text-gray-400"},jo={class:"flex items-center gap-3"},Po={class:"flex-1 min-w-0"},qo={class:"text-sm font-medium truncate"},Yo={class:"flex items-center gap-3 mt-0.5 text-xs text-gray-400"},Go={class:"w-20 h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden"},Jo={key:4,class:"h-full flex flex-col overflow-hidden"},Ko={class:"px-4 py-3 border-b border-gray-200 dark:border-gray-700"},Qo={class:"text-sm font-medium flex items-center gap-2"},Xo={class:"flex-1 overflow-y-auto"},Zo={class:"flex items-center gap-3"},er={class:"flex-1 min-w-0"},tr={class:"flex items-center gap-2 text-sm"},sr={class:"font-medium truncate"},ar={class:"font-medium truncate"},nr={class:"flex items-center gap-3 mt-1 text-xs text-gray-400"},or={class:"w-24 h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden"},rr={key:0,class:"px-4 py-2 border-t border-gray-200 dark:border-gray-700 text-xs text-gray-400 flex items-center gap-4 bg-gray-50 dark:bg-gray-800/50"},ir=q({__name:"ClusterView",props:{sessionId:{},timeFilter:{}},setup(l){Je([Pt,Ke,qt,Yt,Qe]);const s=l,{t:e}=ae(),o=gt(),c=D(()=>o.value==="dark"),u=L(!0),d=L(null),m=L("matrix"),p=L(null),k=L({lookAhead:3,decaySeconds:120,topEdges:150}),y=L(null);let g=null;async function n(){if(s.sessionId){u.value=!0;try{d.value=await oo(s.sessionId,s.timeFilter,{lookAhead:k.value.lookAhead,decaySeconds:k.value.decaySeconds,topEdges:k.value.topEdges})}catch(M){console.error("[chart-cluster] 加载小团体关系数据失败:",M),d.value=null}finally{u.value=!1}}}const r=D(()=>{if(!d.value||d.value.nodes.length===0)return null;const{nodes:M,links:T,maxLinkValue:V}=d.value,U=[...M].sort((E,W)=>W.messageCount-E.messageCount).slice(0,20).map(E=>E.name),R=new Map;for(const E of T)R.set(`${E.source}-${E.target}`,E.value),R.set(`${E.target}-${E.source}`,E.value);const F=[];for(let E=0;E<U.length;E++)for(let W=0;W<U.length;W++)if(E===W)F.push([E,W,-1]);else{const X=R.get(`${U[E]}-${U[W]}`)||0;F.push([E,W,X])}return{names:U,data:F,maxValue:V}});function h(){if(!r.value)return{graphic:{type:"text",style:{text:e("views.cluster.noData"),fill:"#999"}}};const{names:M,data:T,maxValue:V}=r.value;return{tooltip:{position:"top",formatter:H=>{const[U,R,F]=H.data;return F<0?`${M[U]}`:F===0?`${M[U]} ↔ ${M[R]}<br/>暂无关系数据`:`${M[U]} ↔ ${M[R]}<br/>临近度: ${F.toFixed(2)}`}},grid:{left:120,right:40,top:40,bottom:120},xAxis:{type:"category",data:M,splitArea:{show:!0},axisLabel:{rotate:45,fontSize:10,color:c.value?"#ccc":"#333"}},yAxis:{type:"category",data:M,splitArea:{show:!0},axisLabel:{fontSize:10,color:c.value?"#ccc":"#333"}},visualMap:{min:0,max:V||1,calculable:!0,orient:"horizontal",left:"center",bottom:10,inRange:{color:c.value?["#1a1a2e","#16213e","#0f3460","#e94560"]:["#f7f7f7","#fce4ec","#f8bbd9","#ee4567"]},textStyle:{color:c.value?"#ccc":"#333"}},series:[{type:"heatmap",data:T.filter(H=>H[2]>=0),label:{show:!1},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}],backgroundColor:"transparent"}}const f=D(()=>d.value?[...d.value.nodes].sort((M,T)=>T.messageCount-M.messageCount):[]),b=D(()=>!d.value||p.value===null?null:d.value.nodes.find(M=>M.id===p.value)||null),_=D(()=>{if(!d.value||!b.value)return[];const M=b.value.name,T=[];for(const V of d.value.links)V.source===M?T.push({otherName:V.target,value:V.value,coOccurrenceCount:V.coOccurrenceCount}):V.target===M&&T.push({otherName:V.source,value:V.value,coOccurrenceCount:V.coOccurrenceCount});return T.sort((V,H)=>H.value-V.value),T}),C=D(()=>d.value?d.value.links.slice(0,50):[]);function v(){g&&m.value==="matrix"&&g.setOption(h(),{notMerge:!0})}function $(){y.value&&(g=Xe(y.value,c.value?"dark":void 0),v())}function S(){g?.resize()}return G(m,async(M,T)=>{T==="matrix"&&g&&(g.dispose(),g=null),M==="matrix"&&(await Se(),$())}),G([d,()=>c.value],()=>{m.value==="matrix"&&v()},{deep:!0}),G(u,async(M,T)=>{T&&!M&&m.value==="matrix"&&(g&&(g.dispose(),g=null),await Se(),$())}),G(()=>[s.sessionId,s.timeFilter],()=>n(),{immediate:!0,deep:!0}),ke(()=>{window.addEventListener("resize",S),m.value==="matrix"&&Se(()=>$())}),De(()=>{window.removeEventListener("resize",S),g?.dispose(),g=null}),(M,T)=>{const V=pe,H=qe("UButtonGroup"),U=Be,R=nt,F=$e;return i(),I("div",ro,[a("div",io,[a("div",lo,[a("div",co,[w(H,{size:"xs"},{default:A(()=>[w(V,{color:m.value==="matrix"?"primary":"neutral",variant:m.value==="matrix"?"solid":"ghost",onClick:T[0]||(T[0]=E=>m.value="matrix")},{default:A(()=>[Q(x(t(e)("views.cluster.matrixView")),1)]),_:1},8,["color","variant"]),w(V,{color:m.value==="member"?"primary":"neutral",variant:m.value==="member"?"solid":"ghost",onClick:T[1]||(T[1]=E=>m.value="member")},{default:A(()=>[Q(x(t(e)("views.cluster.memberView")),1)]),_:1},8,["color","variant"]),w(V,{color:m.value==="circle"?"primary":"neutral",variant:m.value==="circle"?"solid":"ghost",onClick:T[2]||(T[2]=E=>m.value="circle")},{default:A(()=>[Q(x(t(e)("views.cluster.rankingView")),1)]),_:1},8,["color","variant"])]),_:1})]),a("div",uo,[w(R,null,{content:A(()=>[a("div",mo,[a("h4",go,x(t(e)("views.cluster.modelSettings")),1),a("div",po,[a("div",null,[a("label",ho,x(t(e)("views.cluster.lookAhead")),1),w(U,{modelValue:k.value.lookAhead,"onUpdate:modelValue":T[3]||(T[3]=E=>k.value.lookAhead=E),modelModifiers:{number:!0},type:"number",min:1,max:10,size:"xs",placeholder:"1-10"},null,8,["modelValue"]),a("p",vo,x(t(e)("views.cluster.lookAheadDesc")),1)]),a("div",null,[a("label",fo,x(t(e)("views.cluster.decaySeconds")),1),w(U,{modelValue:k.value.decaySeconds,"onUpdate:modelValue":T[4]||(T[4]=E=>k.value.decaySeconds=E),modelModifiers:{number:!0},type:"number",min:30,max:3600,size:"xs",placeholder:"30-3600"},null,8,["modelValue"]),a("p",yo,x(t(e)("views.cluster.decaySecondsDesc")),1)]),w(V,{size:"xs",color:"primary",class:"w-full mt-2",onClick:n},{default:A(()=>[Q(x(t(e)("views.cluster.applySettings")),1)]),_:1})])])]),default:A(()=>[w(V,{variant:"ghost",size:"xs",icon:"i-heroicons-adjustments-horizontal"})]),_:1}),w(V,{variant:"ghost",size:"xs",icon:"i-heroicons-arrow-path",onClick:n})])]),a("div",xo,[u.value?(i(),I("div",bo,[w(F,{name:"i-heroicons-arrow-path",class:"w-6 h-6 animate-spin text-gray-400"})])):!d.value||d.value.nodes.length===0?(i(),I("div",ko,[a("div",_o,[w(F,{name:"i-heroicons-user-group",class:"w-12 h-12 mx-auto mb-2 opacity-50"}),a("p",null,x(t(e)("views.cluster.noData")),1)])])):m.value==="matrix"?(i(),I("div",wo,[a("div",{ref_key:"chartRef",ref:y,class:"w-full h-full"},null,512)])):m.value==="member"?(i(),I("div",$o,[a("div",Io,[a("div",Co,[a("h3",So,[w(F,{name:"i-heroicons-users",class:"w-4 h-4"}),Q(" "+x(t(e)("views.cluster.selectMember")),1)])]),a("div",Mo,[(i(!0),I(P,null,se(f.value,E=>(i(),I("div",{key:E.id,class:ee(["px-4 py-2 cursor-pointer border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",{"bg-primary-50 dark:bg-primary-900/30":p.value===E.id}]),onClick:W=>p.value=E.id},[a("div",Do,[a("span",Ro,x(E.name),1),a("span",No,x(E.messageCount),1)])],10,To))),128))])]),a("div",Lo,[b.value?(i(),I(P,{key:1},[a("div",Eo,[a("div",Oo,x(b.value.name.charAt(0)),1),a("div",null,[a("div",zo,x(b.value.name),1),a("div",Fo,x(t(e)("views.cluster.msgCount"))+": "+x(b.value.messageCount)+" | "+x(t(e)("views.cluster.relationCount"))+": "+x(_.value.length),1)])]),a("div",Bo,[a("h3",Uo,[w(F,{name:"i-heroicons-heart",class:"w-4 h-4 text-pink-500"}),Q(" "+x(t(e)("views.cluster.relationsByIntimacy")),1)])]),a("div",Ho,[_.value.length===0?(i(),I("div",Wo,x(t(e)("views.cluster.noRelations")),1)):B("",!0),(i(!0),I(P,null,se(_.value,(E,W)=>(i(),I("div",{key:E.otherName,class:"px-4 py-3 border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50"},[a("div",jo,[a("span",{class:ee(["w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold",W<3?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400":"bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400"])},x(W+1),3),a("div",Po,[a("div",qo,x(E.otherName),1),a("div",Yo,[a("span",null,x(t(e)("views.cluster.intimacy"))+": "+x((E.value*100).toFixed(0))+"%",1),a("span",null,x(t(e)("views.cluster.coOccurrence"))+": "+x(E.coOccurrenceCount)+x(t(e)("views.cluster.times")),1)])]),a("div",Go,[a("div",{class:"h-full bg-linear-to-r from-pink-400 to-pink-600",style:xe({width:`${_.value[0]?.value?E.value/_.value[0].value*100:0}%`})},null,4)])])]))),128))])],64)):(i(),I("div",Vo,[a("div",Ao,[w(F,{name:"i-heroicons-cursor-arrow-rays",class:"w-12 h-12 mx-auto mb-2 opacity-50"}),a("p",null,x(t(e)("views.cluster.selectMemberHint")),1)])]))])])):(i(),I("div",Jo,[a("div",Ko,[a("h3",Qo,[w(F,{name:"i-heroicons-trophy",class:"w-4 h-4 text-yellow-500"}),Q(" "+x(t(e)("views.cluster.interactionRanking")),1)])]),a("div",Xo,[(i(!0),I(P,null,se(C.value,(E,W)=>(i(),I("div",{key:W,class:"px-4 py-3 border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50"},[a("div",Zo,[a("span",{class:ee(["w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold",W<3?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400":"bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400"])},x(W+1),3),a("div",er,[a("div",tr,[a("span",sr,x(E.source),1),T[5]||(T[5]=a("span",{class:"text-gray-400"},"↔",-1)),a("span",ar,x(E.target),1)]),a("div",nr,[a("span",null,x(t(e)("views.cluster.score"))+": "+x(E.value.toFixed(2)),1),a("span",null,x(t(e)("views.cluster.coOccurrence"))+": "+x(E.coOccurrenceCount)+x(t(e)("views.cluster.times")),1)])]),a("div",or,[a("div",{class:"h-full bg-linear-to-r from-yellow-400 to-orange-500",style:xe({width:`${C.value[0]?.value?E.value/C.value[0].value*100:0}%`})},null,4)])])]))),128))])]))]),d.value?(i(),I("div",rr,[a("span",null,x(t(e)("views.cluster.totalMembers"))+": "+x(d.value.stats.totalMembers),1),a("span",null,x(t(e)("views.cluster.totalMessages"))+": "+x(d.value.stats.totalMessages.toLocaleString()),1),a("span",null,x(t(e)("views.cluster.involvedMembers"))+": "+x(d.value.stats.involvedMembers),1),a("span",null,x(t(e)("views.cluster.edgeCount"))+": "+x(d.value.stats.edgeCount),1)])):B("",!0)])])}}}),lr={class:"flex h-full flex-col"},cr={class:"min-h-0 flex-1 overflow-y-auto"},dr=q({__name:"GroupRelationships",props:{sessionId:{},timeFilter:{}},setup(l){const{t:s}=ae(),e=l,o=L("mention-graph"),c=D(()=>[{id:"mention-graph",label:s("analysis.subTabs.groupRelationships.mentionGraph"),icon:"i-heroicons-arrows-right-left"},{id:"mention-ranking",label:s("analysis.subTabs.groupRelationships.mentionRanking"),icon:"i-heroicons-heart"},{id:"proximity",label:s("analysis.subTabs.groupRelationships.proximity"),icon:"i-heroicons-user-group"}]);return(u,d)=>(i(),I("div",lr,[w(t(Ye),{modelValue:o.value,"onUpdate:modelValue":d[0]||(d[0]=m=>o.value=m),items:c.value,"persist-key":"groupRelationshipsTab",size:"sm"},null,8,["modelValue","items"]),a("div",cr,[w(Re,{name:"fade",mode:"out-in"},{default:A(()=>[o.value==="mention-graph"?(i(),N(vn,{key:0,"session-id":e.sessionId,"time-filter":e.timeFilter},null,8,["session-id","time-filter"])):o.value==="mention-ranking"?(i(),N(Xn,{key:1,"session-id":e.sessionId,"time-filter":e.timeFilter},null,8,["session-id","time-filter"])):o.value==="proximity"?(i(),N(ir,{key:2,"session-id":e.sessionId,"time-filter":e.timeFilter},null,8,["session-id","time-filter"])):B("",!0)]),_:1})])]))}}),ur=Le(dr,[["__scopeId","data-v-90e47115"]]),mr={class:"flex h-full flex-col"},gr={class:"flex-1 min-h-0 overflow-y-auto"},pr=q({__name:"ViewTab",props:{sessionId:{},sessionName:{},timeFilter:{}},setup(l){const{t:s,locale:e}=ae(),o=l,c=D(()=>{const p=[{id:"type-analysis",label:s("analysis.subTabs.view.typeAnalysis"),icon:"i-heroicons-chart-pie"},{id:"time-analysis",label:s("analysis.subTabs.view.timeAnalysis"),icon:"i-heroicons-clock"},{id:"topic",label:s("analysis.subTabs.view.topic"),icon:"i-heroicons-cloud"},{id:"group-relationships",label:s("analysis.subTabs.view.groupRelationships"),icon:"i-heroicons-heart"},{id:"hot-repeat",label:s("analysis.subTabs.quotes.hotRepeat"),icon:"i-heroicons-fire"},{id:"catchphrase",label:s("analysis.subTabs.quotes.catchphrase"),icon:"i-heroicons-chat-bubble-bottom-center-text"}];return pt("groupRanking",e.value)&&p.splice(2,0,{id:"ranking",label:s("analysis.subTabs.view.ranking"),icon:"i-heroicons-trophy"}),p}),u=L("type-analysis"),d=L(null),m=D(()=>({...o.timeFilter,memberId:d.value}));return(p,k)=>(i(),I("div",mr,[w(t(Ye),{modelValue:u.value,"onUpdate:modelValue":k[1]||(k[1]=y=>u.value=y),items:c.value,"persist-key":"groupViewTab"},{right:A(()=>[u.value!=="topic"?(i(),N(Ct,{key:0,modelValue:d.value,"onUpdate:modelValue":k[0]||(k[0]=y=>d.value=y),"session-id":o.sessionId},null,8,["modelValue","session-id"])):B("",!0)]),_:1},8,["modelValue","items"]),a("div",gr,[w(Re,{name:"fade",mode:"out-in"},{default:A(()=>[u.value==="type-analysis"?(i(),N(St,{key:0,"session-id":o.sessionId,"session-name":o.sessionName,"time-filter":m.value},null,8,["session-id","session-name","time-filter"])):u.value==="time-analysis"?(i(),N(Mt,{key:1,"session-id":o.sessionId,"session-name":o.sessionName,"time-filter":m.value},null,8,["session-id","session-name","time-filter"])):u.value==="topic"?(i(),N(t(Tt),{key:2,"session-id":o.sessionId,"time-filter":o.timeFilter},null,8,["session-id","time-filter"])):u.value==="group-relationships"?(i(),N(ur,{key:3,"session-id":o.sessionId,"time-filter":m.value},null,8,["session-id","time-filter"])):u.value==="ranking"?(i(),N(Ga,{key:4,"session-id":o.sessionId,"time-filter":m.value},null,8,["session-id","time-filter"])):u.value==="hot-repeat"?(i(),N(t(Js),{key:5,"session-id":o.sessionId,"time-filter":o.timeFilter},null,8,["session-id","time-filter"])):u.value==="catchphrase"?(i(),N(t(Ls),{key:6,"session-id":o.sessionId,"time-filter":o.timeFilter},null,8,["session-id","time-filter"])):B("",!0)]),_:1})])]))}}),hr=Le(pr,[["__scopeId","data-v-abeebf4d"]]),vr={key:0,class:"mb-6"},fr={class:"flex items-center gap-3"},yr={class:"text-xl font-bold text-gray-900 dark:text-white"},xr={class:"text-sm text-gray-500 dark:text-gray-400"},br={class:"mb-4 flex flex-wrap items-center justify-between gap-3"},kr={class:"flex items-center gap-2"},_r={class:"text-xs text-gray-500 dark:text-gray-400"},wr={key:0,class:"flex h-60 items-center justify-center"},$r={key:1,class:"flex h-60 flex-col items-center justify-center"},Ir={class:"text-gray-500 dark:text-gray-400"},Cr={key:2,class:"flex min-h-0 flex-1 flex-col"},Sr={class:"w-full"},Mr={class:"sticky top-0 bg-gray-50 dark:bg-gray-800"},Tr={class:"text-left text-xs font-medium uppercase text-gray-500 dark:text-gray-400"},Dr={class:"px-4 py-4"},Rr={class:"px-4 py-4"},Nr={class:"px-4 py-4"},Lr={class:"w-64 px-4 py-4"},Vr={class:"inline-flex items-center gap-1.5"},Ar={class:"px-4 py-4 text-right"},Er={class:"divide-y divide-gray-200 dark:divide-gray-700"},Or={class:"px-4 py-4"},zr={class:"px-4 py-4"},Fr={class:"flex items-center gap-2"},Br=["src","alt"],Ur={key:1,class:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-pink-400 to-pink-600 text-xs font-medium text-white"},Hr={class:"text-sm font-medium text-gray-900 dark:text-white"},Wr={class:"ml-1 text-sm text-gray-500 dark:text-gray-400"},jr={class:"px-4 py-4"},Pr={key:0,class:"text-sm font-medium text-gray-900 dark:text-white"},qr={key:1,class:"text-sm text-gray-400 dark:text-gray-500"},Yr={class:"px-4 py-4"},Gr={class:"text-sm font-semibold text-gray-900 dark:text-white"},Jr={class:"px-4 py-4"},Kr={class:"max-w-xs"},Qr={key:0,class:"absolute right-2 top-1/2 -translate-y-1/2"},Xr={class:"px-4 py-4 text-right"},Zr={key:0,class:"flex items-center justify-between border-t border-gray-200 px-6 py-4 dark:border-gray-700"},ei={class:"text-sm text-gray-500 dark:text-gray-400"},ti={class:"flex items-center gap-2"},si={class:"text-sm font-medium text-gray-600 dark:text-gray-300"},ai={class:"p-6 text-center"},ni={class:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30"},oi={class:"mb-2 text-lg font-semibold text-gray-900 dark:text-white"},ri={class:"mb-6 text-sm text-gray-500 dark:text-gray-400"},ii={class:"flex justify-center gap-3"},li={class:"p-6"},ci={class:"mb-4 flex items-center gap-3"},di={class:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-900/30"},ui={class:"text-lg font-semibold text-gray-900 dark:text-white"},mi={class:"mb-2 text-sm text-gray-600 dark:text-gray-400"},gi={class:"mb-6 text-xs text-amber-700 dark:text-amber-300"},pi={class:"flex justify-end gap-2"},Me=20,hi=q({__name:"MemberList",props:{sessionId:{},showHeader:{type:Boolean,default:!0}},emits:["data-changed"],setup(l,{emit:s}){const{t:e}=ae(),o=l,c=s,u=L([]),d=L([]),m=L(!1),p=L(""),k=L(null),y=L(!1),g=L(new Set),n=L(!1),r=L(!1),h=L(1),f=L(0),b=L(0),_=L("desc"),C=L(null);let v=null;function $(z){return z.groupNickname||z.accountName||z.platformId}function S(z){return $(z).slice(0,1)}const M=D(()=>d.value.filter(z=>g.value.has(z.id))),T=D(()=>M.value.length===2),V=D(()=>{if(M.value.length!==2)return null;const[z,O]=M.value;return O.messageCount>z.messageCount||O.messageCount===z.messageCount&&O.id<z.id?{primary:O,secondary:z}:{primary:z,secondary:O}});function H(){_.value=_.value==="desc"?"asc":"desc",h.value=1,U()}async function U(){if(o.sessionId){m.value=!0;try{const z=await Y().getMembersPaginated(o.sessionId,{page:h.value,pageSize:Me,search:p.value.trim(),sortOrder:_.value});u.value=z.items,f.value=z.total,b.value=z.totalPages}catch(z){console.error("加载成员列表失败:",z)}finally{m.value=!1}}}async function R(){if(o.sessionId)try{d.value=await Y().getMembers(o.sessionId)}catch(z){console.error("加载所有成员失败:",z)}}async function F(z,O){const Z=JSON.parse(JSON.stringify(O)),ge=JSON.stringify(z.aliases),ie=JSON.stringify(Z);if(ge!==ie){C.value=z.id;try{if(await Y().updateMemberAliases(o.sessionId,z.id,Z)){const j=u.value.findIndex(_e=>_e.id===z.id);j!==-1&&(u.value[j]={...u.value[j],aliases:Z})}}catch(he){console.error("保存别名失败:",he)}finally{C.value=null}}}function E(z){k.value=z}function W(){k.value=null}async function X(){if(k.value){y.value=!0;try{await Y().deleteMember(o.sessionId,k.value.id)&&(await U(),await R(),c("data-changed"))}catch(z){console.error("删除成员失败:",z)}finally{y.value=!1,k.value=null}}}function te(z){const O=new Set(g.value);O.has(z)?O.delete(z):O.add(z),g.value=O}function le(){T.value&&(n.value=!0)}function re(){g.value=new Set}async function ue(){if(V.value){r.value=!0;try{await Y().mergeMembers(o.sessionId,V.value.primary.id,V.value.secondary.id)&&(n.value=!1,re(),await U(),await R(),c("data-changed"))}catch(z){console.error("合并成员失败:",z)}finally{r.value=!1}}}return G(p,()=>{h.value=1,v&&clearTimeout(v),v=setTimeout(()=>{U()},300)}),G(h,()=>{U()}),G(()=>o.sessionId,()=>{p.value="",h.value=1,re(),U(),R()},{immediate:!0}),ke(()=>{U(),R()}),(z,O)=>{const Z=pe,ge=Be,ie=$e,he=Ue,j=ot,_e=rt,Ve=be;return i(),I("div",{class:ee(["main-content",o.showHeader?"max-w-5xl p-6":"flex h-full max-w-none flex-col overflow-hidden p-4"])},[o.showHeader?(i(),I("div",vr,[a("div",fr,[a("div",null,[a("h2",yr,x(t(e)("members.list.title")),1),a("p",xr,x(t(e)("members.list.description",{count:f.value})),1)])])])):B("",!0),w(Dt,{class:"mb-6","session-id":l.sessionId,members:d.value,"is-loading":m.value,"chat-type":"group"},null,8,["session-id","members","is-loading"]),a("div",br,[w(ge,{modelValue:p.value,"onUpdate:modelValue":O[1]||(O[1]=J=>p.value=J),placeholder:t(e)("members.list.searchPlaceholder"),icon:"i-heroicons-magnifying-glass",class:"w-full md:w-100"},Pe({_:2},[p.value?{name:"trailing",fn:A(()=>[w(Z,{icon:"i-heroicons-x-mark",variant:"link",color:"neutral",size:"xs",onClick:O[0]||(O[0]=J=>p.value="")})]),key:"0"}:void 0]),1032,["modelValue","placeholder"]),a("div",kr,[a("span",_r,x(t(e)("members.list.mergeSelectedCount",{count:g.value.size})),1),w(Z,{icon:"i-heroicons-link",size:"sm",color:"primary",disabled:!T.value,onClick:le},{default:A(()=>[Q(x(t(e)("members.list.mergeSelected")),1)]),_:1},8,["disabled"])])]),a("div",{class:ee(["rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-900",o.showHeader?"":"flex min-h-0 flex-1 flex-col"])},[m.value?(i(),I("div",wr,[w(ie,{name:"i-heroicons-arrow-path",class:"h-8 w-8 animate-spin text-pink-500"})])):u.value.length===0?(i(),I("div",$r,[w(ie,{name:"i-heroicons-user-group",class:"mb-3 h-12 w-12 text-gray-300 dark:text-gray-600"}),a("p",Ir,x(p.value?t(e)("members.list.noMatch"):t(e)("members.list.empty")),1)])):(i(),I("div",Cr,[a("div",{class:ee(["max-h-[500px] overflow-y-auto",o.showHeader?"":"max-h-none min-h-0 flex-1"])},[a("table",Sr,[a("thead",Mr,[a("tr",Tr,[O[7]||(O[7]=a("th",{class:"w-12 px-4 py-4"},null,-1)),a("th",Dr,x(t(e)("members.list.table.accountName")),1),a("th",Rr,x(t(e)("members.list.table.groupNickname")),1),a("th",Nr,[a("button",{class:"flex items-center gap-1.5 hover:text-gray-700 dark:hover:text-gray-200",onClick:H},[Q(x(t(e)("members.list.table.messageCount"))+" ",1),w(ie,{name:_.value==="desc"?"i-heroicons-arrow-down":"i-heroicons-arrow-up",class:"h-3.5 w-3.5"},null,8,["name"])])]),a("th",Lr,[a("div",Vr,[a("span",null,x(t(e)("members.list.table.customAlias")),1),w(he,{text:t(e)("members.list.tip"),popper:{placement:"top"}},{default:A(()=>[w(ie,{name:"i-heroicons-question-mark-circle",class:"h-4 w-4 text-gray-400 dark:text-gray-500"})]),_:1},8,["text"])])]),a("th",Ar,x(t(e)("members.list.table.actions")),1)])]),a("tbody",Er,[(i(!0),I(P,null,se(u.value,J=>(i(),I("tr",{key:J.id,class:"hover:bg-gray-50 dark:hover:bg-gray-800/50"},[a("td",Or,[w(j,{"model-value":g.value.has(J.id),onClick:je(Ce=>te(J.id),["stop"])},null,8,["model-value","onClick"])]),a("td",zr,[a("div",Fr,[J.avatar?(i(),I("img",{key:0,src:J.avatar,alt:$(J),class:"h-8 w-8 shrink-0 rounded-full object-cover"},null,8,Br)):(i(),I("div",Ur,x(S(J)),1)),a("div",null,[a("span",Hr,x(J.accountName||"-"),1),a("span",Wr,"("+x(J.platformId)+")",1)])])]),a("td",jr,[J.groupNickname?(i(),I("span",Pr,x(J.groupNickname),1)):(i(),I("span",qr,"-"))]),a("td",Yr,[a("span",Gr,x(J.messageCount.toLocaleString()),1)]),a("td",Jr,[a("div",Kr,[w(_e,{"model-value":J.aliases,placeholder:t(e)("members.list.aliasPlaceholder"),class:"w-80","onUpdate:modelValue":Ce=>F(J,Ce)},null,8,["model-value","placeholder","onUpdate:modelValue"]),C.value===J.id?(i(),I("div",Qr,[w(ie,{name:"i-heroicons-arrow-path",class:"h-4 w-4 animate-spin text-pink-500"})])):B("",!0)])]),a("td",Xr,[w(Z,{label:t(e)("members.list.delete"),size:"xs",onClick:Ce=>E(J)},null,8,["label","onClick"])])]))),128))])])],2),b.value>1?(i(),I("div",Zr,[a("p",ei,x(t(e)("members.list.pagination",{start:(h.value-1)*Me+1,end:Math.min(h.value*Me,f.value),total:f.value})),1),a("div",ti,[w(Z,{icon:"i-heroicons-chevron-left",variant:"outline",size:"sm",disabled:h.value===1||m.value,onClick:O[2]||(O[2]=J=>h.value--)},null,8,["disabled"]),a("span",si,x(h.value)+" / "+x(b.value),1),w(Z,{icon:"i-heroicons-chevron-right",variant:"outline",size:"sm",disabled:h.value>=b.value||m.value,onClick:O[3]||(O[3]=J=>h.value++)},null,8,["disabled"])])])):B("",!0)]))],2),w(Ve,{open:!!k.value,ui:{content:"max-w-sm"},"onUpdate:open":O[4]||(O[4]=J=>k.value=null)},{content:A(()=>[a("div",ai,[a("div",ni,[w(ie,{name:"i-heroicons-exclamation-triangle",class:"h-7 w-7 text-red-500"})]),a("h3",oi,x(t(e)("members.list.modal.title")),1),a("p",ri,x(t(e)("members.list.modal.content",{name:k.value?$(k.value):"",count:k.value?.messageCount.toLocaleString()})),1),a("div",ii,[w(Z,{variant:"outline",onClick:W},{default:A(()=>[Q(x(t(e)("members.list.modal.cancel")),1)]),_:1}),w(Z,{color:"error",loading:y.value,onClick:X},{default:A(()=>[Q(x(t(e)("members.list.modal.confirm")),1)]),_:1},8,["loading"])])])]),_:1},8,["open"]),w(Ve,{open:n.value,ui:{content:"max-w-md"},"onUpdate:open":O[6]||(O[6]=J=>n.value=J)},{content:A(()=>[a("div",li,[a("div",ci,[a("div",di,[w(ie,{name:"i-heroicons-link",class:"h-5 w-5 text-amber-600 dark:text-amber-400"})]),a("h3",ui,x(t(e)("members.list.mergeModal.title")),1)]),a("p",mi,x(t(e)("members.list.mergeModal.content",{source:V.value?$(V.value.secondary):"",sourceCount:V.value?V.value.secondary.messageCount.toLocaleString():"0",target:V.value?$(V.value.primary):"",targetCount:V.value?V.value.primary.messageCount.toLocaleString():"0"})),1),a("p",gi,x(t(e)("members.list.mergeModal.hint")),1),a("div",pi,[w(Z,{variant:"outline",disabled:r.value,onClick:O[5]||(O[5]=J=>n.value=!1)},{default:A(()=>[Q(x(t(e)("members.list.mergeModal.cancel")),1)]),_:1},8,["disabled"]),w(Z,{color:"primary",loading:r.value,onClick:ue},{default:A(()=>[Q(x(t(e)("members.list.mergeModal.confirm")),1)]),_:1},8,["loading"])])])]),_:1},8,["open"])],2)}}}),vi={class:"main-content max-w-5xl p-6"},fi={class:"mb-4 text-sm text-gray-500 dark:text-gray-400 no-capture"},yi={key:0,class:"divide-y divide-gray-100 dark:divide-gray-800"},xi={class:"w-32 shrink-0 pt-0.5 font-medium text-gray-900 dark:text-white"},bi={class:"flex flex-1 flex-wrap items-center gap-2"},ki={class:"flex items-center gap-1.5 rounded-lg bg-gray-50 px-3 py-1.5 dark:bg-gray-800"},_i={class:"text-xs text-gray-400"},wi={key:0,class:"text-gray-300 dark:text-gray-600"},$i=q({__name:"NicknameHistory",props:{sessionId:{}},setup(l){const{t:s}=ae(),e=l,o=L([]),c=L([]),u=L(!1);function d(k){return k.groupNickname||k.accountName||k.platformId}async function m(){if(e.sessionId)try{o.value=await Y().getMembers(e.sessionId)}catch(k){console.error("加载成员列表失败:",k)}}async function p(){if(!e.sessionId||o.value.length===0)return;u.value=!0;const k=[];try{const y=o.value.map(n=>Y().getMemberNameHistory(e.sessionId,n.id)),g=await Promise.all(y);o.value.forEach((n,r)=>{const h=g[r];h.length>2&&k.push({memberId:n.id,name:d(n),history:h})}),c.value=k}catch(y){console.error("加载昵称变更记录失败:",y)}finally{u.value=!1}}return G(()=>e.sessionId,async()=>{await m()},{immediate:!0}),G(()=>o.value.length,()=>{o.value.length>0&&p()}),ke(async()=>{o.value.length===0&&await m()}),(k,y)=>{const g=Fe;return i(),I("div",vi,[a("p",fi,x(t(s)("members.nicknameHistory.note")),1),w(t(K),{title:t(s)("members.nicknameHistory.title"),description:u.value?t(s)("members.nicknameHistory.loading"):c.value.length>0?t(s)("members.nicknameHistory.hasChanges",{count:c.value.length}):t(s)("members.nicknameHistory.noChanges")},{default:A(()=>[!u.value&&c.value.length>0?(i(),I("div",yi,[(i(!0),I(P,null,se(c.value,n=>(i(),I("div",{key:n.memberId,class:"flex items-start gap-3 px-5 py-3"},[a("div",xi,x(n.name),1),a("div",bi,[(i(!0),I(P,null,se(n.history,(r,h)=>(i(),I(P,{key:h},[a("div",ki,[a("span",{class:ee(["text-sm",r.endTs===null?"font-semibold text-pink-600":"text-gray-700 dark:text-gray-300"])},x(r.name),3),r.endTs===null?(i(),N(g,{key:0,color:"primary",variant:"soft",size:"xs"},{default:A(()=>[Q(x(t(s)("members.nicknameHistory.current")),1)]),_:1})):B("",!0),a("span",_i,"("+x(t(Rt)(r.startTs,r.endTs))+")",1)]),h<n.history.length-1?(i(),I("span",wi,"→")):B("",!0)],64))),128))])]))),128))])):u.value?(i(),N(t(oe),{key:2,text:t(s)("members.nicknameHistory.loadingText")},null,8,["text"])):(i(),N(t(ce),{key:1,text:t(s)("members.nicknameHistory.empty")},null,8,["text"]))]),_:1},8,["title","description"])])}}}),Ii={class:"flex h-full flex-col overflow-hidden bg-white dark:bg-gray-900"},Ci={class:"flex flex-none items-center justify-between border-b border-gray-200 px-5 py-3 dark:border-gray-700"},Si={class:"text-lg font-semibold text-gray-900 dark:text-white"},Mi={class:"flex-1 overflow-auto"},Ti=q({__name:"NicknameHistoryEntry",props:{sessionId:{}},setup(l){const{t:s}=ae(),e=l,o=L(!1);return(c,u)=>{const d=pe,m=be;return i(),I(P,null,[w(d,{variant:"ghost",icon:"i-heroicons-clock",size:"sm",onClick:u[0]||(u[0]=p=>o.value=!0)},{default:A(()=>[Q(x(t(s)("analysis.subTabs.member.nicknameHistory")),1)]),_:1}),e.sessionId?(i(),N(m,{key:0,open:o.value,"onUpdate:open":u[2]||(u[2]=p=>o.value=p),ui:{content:"max-w-6xl h-[85vh]"}},{content:A(()=>[a("div",Ii,[a("div",Ci,[a("h2",Si,x(t(s)("analysis.subTabs.member.nicknameHistory")),1),w(d,{variant:"ghost",icon:"i-heroicons-x-mark",size:"sm",onClick:u[1]||(u[1]=p=>o.value=!1)})]),a("div",Mi,[w($i,{"session-id":e.sessionId},null,8,["session-id"])])])]),_:1},8,["open"])):B("",!0)],64)}}}),Di={class:"flex h-full flex-col bg-white dark:bg-gray-900",style:{"padding-top":"var(--titlebar-area-height)"}},Ri={class:"mt-3 flex items-center justify-between gap-3"},Ni={class:"flex shrink-0 items-center gap-0.5 overflow-x-auto scrollbar-hide"},Li=["onClick"],Vi={class:"whitespace-nowrap"},Ai={class:"relative flex-1 overflow-y-auto"},Ei={class:"h-full"},Oi={key:2,class:"flex h-full items-center justify-center"},zi={class:"text-gray-500"},Fi={class:"flex h-full flex-col overflow-hidden bg-white dark:bg-gray-900"},Bi={class:"flex flex-none items-center justify-between border-b border-gray-200 px-5 py-3 dark:border-gray-700"},Ui={class:"text-lg font-semibold text-gray-900 dark:text-white"},Hi={class:"text-sm text-gray-500 dark:text-gray-400"},Wi={class:"flex items-center gap-2"},ji={class:"flex-1 overflow-hidden"},Pi=q({__name:"index",setup(l){const s=We(()=>ze(()=>import("./MessageExportModal-B79pPBL9.js"),__vite__mapDeps([5,6,4,7,8,9,10,11,1,2,3,12]))),{t:e}=ae(),o=it(),c=lt(),u=ht(),d=Ne(),m=vt(),{currentSessionId:p}=ft(u),k=L(!1),y=L(!1),g=L(!1),n=L(!1);function r(){d.openChatRecordDrawer({})}const h=[{id:"overview",labelKey:"analysis.tabs.overview",icon:"i-heroicons-chart-pie"},{id:"view",labelKey:"analysis.tabs.view",icon:"i-heroicons-presentation-chart-bar"},{id:"ai-chat",labelKey:"analysis.tabs.aiChat",icon:"i-heroicons-chat-bubble-left-ellipsis"},{id:"lab",labelKey:"analysis.tabs.lab",icon:"i-heroicons-beaker"}],f=D(()=>m.debugMode?[...h,{id:"debug",labelKey:"analysis.tabs.debug",icon:"i-heroicons-bug-ant"}]:h),b=D(()=>f.value.map(z=>z.id)),{activeTab:_,isLoading:C,isInitialLoad:v,session:$,memberActivity:S,hourlyActivity:M,dailyActivity:T,messageTypes:V,timeRangeValue:H,fullTimeRange:U,availableYears:R,timeFilter:F,selectedYearForOverview:E,initialTimeState:W,loadData:X}=Nt({route:o,router:c,currentSessionId:p,selectSession:u.selectSession,defaultTab:m.defaultSessionTab,validTabIds:b.value}),te=D(()=>S.value.slice(0,3)),le=D(()=>S.value.length<=1?[]:[...S.value].sort((z,O)=>z.messageCount-O.messageCount).slice(0,1)),re=D(()=>S.value.reduce((z,O)=>z+O.messageCount,0)),ue=D(()=>S.value.filter(z=>z.messageCount>0).length);return(z,O)=>{const Z=pe,ge=Ue,ie=$e,he=be;return i(),I("div",Di,[t(v)?(i(),N(oe,{key:0,variant:"page",text:t(e)("analysis.groupChat.loading")},null,8,["text"])):t($)?(i(),I(P,{key:1},[w(Lt,{title:t($).name,avatar:t($).groupAvatar,size:"compact",icon:"i-heroicons-chat-bubble-left-right","icon-class":"bg-primary-600 text-white dark:bg-primary-500 dark:text-white"},{actions:A(()=>[t(d).toolsPanelPosition==="header"?(i(),I(P,{key:0},[w(ge,{text:t(e)("analysis.tooltip.incrementalImport")},{default:A(()=>[w(Z,{icon:"i-heroicons-plus-circle",variant:"ghost",color:"gray",size:"sm",class:"hover:bg-gray-100 dark:hover:bg-gray-800",onClick:O[0]||(O[0]=j=>y.value=!0)})]),_:1},8,["text"]),w(ge,{text:t(e)("analysis.tooltip.memberManagement")},{default:A(()=>[w(Z,{icon:"i-heroicons-user-group",variant:"ghost",color:"gray",size:"sm",class:"hover:bg-gray-100 dark:hover:bg-gray-800",onClick:O[1]||(O[1]=j=>n.value=!0)})]),_:1},8,["text"]),w(ge,{text:t(e)("analysis.tooltip.viewChatRecord")},{default:A(()=>[w(Z,{icon:"i-heroicons-chat-bubble-bottom-center-text",variant:"ghost",color:"gray",size:"sm",class:"hover:bg-gray-100 dark:hover:bg-gray-800",onClick:r})]),_:1},8,["text"]),w(we,{color:"gray"}),w(ge,{text:t(e)("analysis.tooltip.more")},{default:A(()=>[w(Z,{icon:"i-heroicons-ellipsis-horizontal",variant:"ghost",color:"gray",size:"sm",class:"hover:bg-gray-100 dark:hover:bg-gray-800",onClick:O[2]||(O[2]=j=>t(d).toggleToolsPanelOpen())})]),_:1},8,["text"])],64)):(i(),N(we,{key:1,color:"gray"}))]),default:A(()=>[a("div",Ri,[a("div",Ni,[(i(!0),I(P,null,se(f.value,j=>(i(),I("button",{key:j.id,class:ee(["flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-sm font-medium transition-all",[t(_)===j.id?"bg-pink-500 text-white dark:bg-pink-900/30 dark:text-pink-300":"text-gray-600 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800"]]),onClick:_e=>_.value=j.id},[w(ie,{name:j.icon,class:"h-4 w-4"},null,8,["name"]),a("span",Vi,x(t(e)(j.labelKey)),1)],10,Li))),128))]),w(Ot,{modelValue:t(H),"onUpdate:modelValue":O[3]||(O[3]=j=>ut(H)?H.value=j:null),"session-id":t(p)??void 0,visible:t(_)!=="ai-chat"&&t(_)!=="memory"&&t(_)!=="lab"&&t(_)!=="debug","initial-state":t(W),"onUpdate:fullRange":O[4]||(O[4]=j=>U.value=j),"onUpdate:availableYears":O[5]||(O[5]=j=>R.value=j)},null,8,["modelValue","session-id","visible","initial-state"])])]),_:1},8,["title","avatar"]),a("div",Ai,[t(C)?(i(),N(oe,{key:0,variant:"overlay"})):B("",!0),a("div",Ei,[w(Re,{name:"tab-slide",mode:"out-in"},{default:A(()=>[t(_)==="overview"?(i(),N(ea,{key:"overview-"+t(p),session:t($),"member-activity":t(S),"top-members":te.value,"bottom-members":le.value,"message-types":t(V),"hourly-activity":t(M),"daily-activity":t(T),"time-range":t(U),"selected-year":t(E),"filtered-message-count":re.value,"filtered-member-count":ue.value,"time-filter":t(F)},null,8,["session","member-activity","top-members","bottom-members","message-types","hourly-activity","daily-activity","time-range","selected-year","filtered-message-count","filtered-member-count","time-filter"])):t(_)==="view"?(i(),N(hr,{key:"view-"+t(p),"session-id":t(p),"session-name":t($).name,"time-filter":t(F)},null,8,["session-id","session-name","time-filter"])):t(_)==="ai-chat"?(i(),N(t(zt),{key:"ai-chat-"+t(p),"session-id":t(p),"session-name":t($).name,"chat-type":"group"},null,8,["session-id","session-name"])):t(_)==="memory"?(i(),N(Ft,{key:"memory-"+t(p),"session-id":t(p),"session-name":t($).name},null,8,["session-id","session-name"])):t(_)==="lab"?(i(),N(Bt,{key:"lab-"+t(p),"session-id":t(p),"session-name":t($).name,"time-filter":t(F),"chat-type":"group",mode:"sql-only"},null,8,["session-id","session-name","time-filter"])):t(_)==="debug"?(i(),N(t(Ut),{key:"debug-"+t(p),"session-id":t(p)},null,8,["session-id"])):B("",!0)]),_:1})])]),w(Vt,{onOpenIncrementalImport:O[6]||(O[6]=j=>y.value=!0),onOpenSessionIndex:O[7]||(O[7]=j=>k.value=!0),onOpenMemberManagement:O[8]||(O[8]=j=>n.value=!0),onOpenChatRecord:r,onOpenMessageExport:O[9]||(O[9]=j=>g.value=!0)}),t(m).debugMode?(i(),N(Ht,{key:0})):B("",!0)],64)):(i(),I("div",Oi,[a("p",zi,x(t(e)("analysis.groupChat.loadError")),1)])),t(p)&&t($)&&t($).messageCount>0?(i(),N(At,{key:3,modelValue:k.value,"onUpdate:modelValue":O[10]||(O[10]=j=>k.value=j),"session-id":t(p),"message-count":t($).messageCount},null,8,["modelValue","session-id","message-count"])):B("",!0),t(p)&&t($)?(i(),N(Et,{key:4,modelValue:y.value,"onUpdate:modelValue":O[11]||(O[11]=j=>y.value=j),"session-id":t(p),"session-name":t($).name,onImported:O[12]||(O[12]=()=>{t(X)(),t(u).loadSessions()})},null,8,["modelValue","session-id","session-name"])):B("",!0),t(p)?(i(),N(t(s),{key:5,modelValue:g.value,"onUpdate:modelValue":O[13]||(O[13]=j=>g.value=j)},null,8,["modelValue"])):B("",!0),t(p)?(i(),N(he,{key:6,open:n.value,"onUpdate:open":O[15]||(O[15]=j=>n.value=j),ui:{content:"max-w-6xl h-[85vh]"}},{content:A(()=>[a("div",Fi,[a("div",Bi,[a("div",null,[a("h2",Ui,x(t(e)("analysis.tooltip.memberManagement")),1),a("p",Hi,x(t(e)("members.list.description",{count:t($)?.memberCount??0})),1)]),a("div",Wi,[w(Ti,{"session-id":t(p)},null,8,["session-id"]),w(Z,{variant:"ghost",icon:"i-heroicons-x-mark",size:"sm",onClick:O[14]||(O[14]=j=>n.value=!1)})])]),a("div",ji,[w(hi,{"session-id":t(p),"show-header":!1,onDataChanged:t(X)},null,8,["session-id","onDataChanged"])])])]),_:1},8,["open"])):B("",!0)])}}}),tl=Le(Pi,[["__scopeId","data-v-6ad95a6f"]]);export{tl as default};
163
+ ORDER BY msg.ts ASC, msg.id ASC`,o)}function no(l){const{members:s,messages:e,options:o}=l;function c(R,F){return R<F?`${R}-${F}`:`${F}-${R}`}function u(R){return Math.round(R*100)/100}const d={nodes:[],links:[],maxLinkValue:0,communities:[],stats:{totalMembers:0,totalMessages:0,involvedMembers:0,edgeCount:0,communityCount:0}};if(s.length<2)return{...d,stats:{...d.stats,totalMembers:s.length}};const m=new Map;for(const R of s)m.set(R.id,{name:R.name,platformId:R.platformId,messageCount:R.messageCount});if(e.length<2)return{...d,stats:{...d.stats,totalMembers:s.length,totalMessages:e.length}};const p=new Map;for(const R of e)p.set(R.senderId,(p.get(R.senderId)||0)+1);const k=e.length,y=new Map,g=new Map;for(let R=0;R<e.length-1;R++){const F=e[R],E=new Set;let W=0;for(let X=R+1;X<e.length&&W<o.lookAhead;X++){const te=e[X];if(te.senderId===F.senderId||E.has(te.senderId))continue;E.add(te.senderId),W++;const le=(te.ts-F.ts)/1e3,re=Math.exp(-le/o.decaySeconds),ue=1-(W-1)*.2,z=re*ue,O=c(F.senderId,te.senderId);y.set(O,(y.get(O)||0)+z),g.set(O,(g.get(O)||0)+1)}}const n=o.lookAhead*.8,r=[];for(const[R,F]of y){const[E,W]=R.split("-"),X=parseInt(E),te=parseInt(W),le=p.get(X)||0,re=p.get(te)||0,ue=le*re/k*n,z=ue>0?F/ue:0;r.push({sourceId:X,targetId:te,rawScore:F,expectedScore:ue,normalizedScore:z,coOccurrenceCount:g.get(R)||0})}const h=Math.max(...r.map(R=>R.rawScore),1),f=Math.max(...r.map(R=>R.normalizedScore),1),b=r.map(R=>{const F=.5*(R.rawScore/h)+.5*(R.normalizedScore/f);return{...R,rawScore:u(R.rawScore),expectedScore:u(R.expectedScore),normalizedScore:u(R.normalizedScore),hybridScore:u(F)}});b.sort((R,F)=>F.hybridScore-R.hybridScore);const _=b.slice(0,o.topEdges);if(_.length===0)return{...d,stats:{...d.stats,totalMembers:s.length,totalMessages:e.length}};const C=new Set;for(const R of _)C.add(R.sourceId),C.add(R.targetId);const v=new Map;for(const R of _)v.set(R.sourceId,(v.get(R.sourceId)||0)+R.hybridScore),v.set(R.targetId,(v.get(R.targetId)||0)+R.hybridScore);const $=Math.max(...v.values(),1),S=new Map;for(const R of C){const F=m.get(R)?.name||String(R);S.set(F,(S.get(F)||0)+1)}const M=new Map;for(const R of C){const F=m.get(R),E=F?.name||String(R);(S.get(E)||0)>1?M.set(R,`${E}#${(F?.platformId||String(R)).slice(-4)}`):M.set(R,E)}const T=Math.max(...[...C].map(R=>m.get(R)?.messageCount||0),1),V=[...C].map(R=>{const F=m.get(R),E=v.get(R)||0,W=E/$,X=F.messageCount/T,te=20+(.7*W+.3*X)*35;return{id:R,name:M.get(R),messageCount:F.messageCount,symbolSize:Math.round(te),degree:u(E),normalizedDegree:u(W)}});V.sort((R,F)=>F.degree-R.degree);const H=_.length>0?Math.max(..._.map(R=>R.hybridScore)):0,U=_.map(R=>({source:M.get(R.sourceId),target:M.get(R.targetId),value:R.hybridScore,rawScore:R.rawScore,expectedScore:R.expectedScore,coOccurrenceCount:R.coOccurrenceCount}));return{nodes:V,links:U,maxLinkValue:u(H),communities:[],stats:{totalMembers:s.length,totalMessages:e.length,involvedMembers:C.size,edgeCount:_.length,communityCount:0}}}async function oo(l,s,e){const o={nodes:[],links:[],maxLinkValue:0,communities:[],stats:{totalMembers:0,totalMessages:0,involvedMembers:0,edgeCount:0,communityCount:0}};try{const[c,u]=await Promise.all([so(l),ao(l,s)]);if(c.length<2||u.length<2)return{...o,stats:{...o.stats,totalMembers:c.length,totalMessages:u.length}};const d={...Zn,...e};return await Y().pluginCompute(no.toString(),{members:c,messages:u,options:d})}catch(c){return console.error("[chart-cluster] Failed to load cluster graph:",c),o}}const ro={class:"mx-auto max-w-[920px] p-4 h-full"},io={class:"flex h-full flex-col rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm overflow-hidden"},lo={class:"flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50"},co={class:"flex items-center gap-3"},uo={class:"flex items-center gap-3"},mo={class:"p-3 w-64"},go={class:"text-sm font-medium mb-3"},po={class:"space-y-3"},ho={class:"text-xs text-gray-500 mb-1 block"},vo={class:"text-xs text-gray-400 mt-1"},fo={class:"text-xs text-gray-500 mb-1 block"},yo={class:"text-xs text-gray-400 mt-1"},xo={class:"flex-1 min-h-0 overflow-hidden"},bo={key:0,class:"h-full flex items-center justify-center"},ko={key:1,class:"h-full flex items-center justify-center"},_o={class:"text-center text-gray-400"},wo={key:2,class:"h-full"},$o={key:3,class:"h-full flex overflow-hidden"},Io={class:"w-64 border-r border-gray-200 dark:border-gray-700 flex flex-col overflow-hidden"},Co={class:"px-4 py-3 border-b border-gray-200 dark:border-gray-700"},So={class:"text-sm font-medium flex items-center gap-2"},Mo={class:"flex-1 overflow-y-auto"},To=["onClick"],Do={class:"flex items-center justify-between"},Ro={class:"text-sm truncate"},No={class:"text-xs text-gray-400"},Lo={class:"flex-1 overflow-hidden flex flex-col"},Vo={key:0,class:"flex-1 flex items-center justify-center"},Ao={class:"text-center text-gray-400"},Eo={class:"px-4 py-3 border-b border-gray-200 dark:border-gray-700 flex items-center gap-3"},Oo={class:"w-10 h-10 rounded-full flex items-center justify-center text-white font-bold bg-primary-500"},zo={class:"font-medium"},Fo={class:"text-xs text-gray-400"},Bo={class:"px-4 py-3 border-b border-gray-200 dark:border-gray-700"},Uo={class:"text-sm font-medium flex items-center gap-2"},Ho={class:"flex-1 overflow-y-auto"},Wo={key:0,class:"p-4 text-center text-gray-400"},jo={class:"flex items-center gap-3"},Po={class:"flex-1 min-w-0"},qo={class:"text-sm font-medium truncate"},Yo={class:"flex items-center gap-3 mt-0.5 text-xs text-gray-400"},Go={class:"w-20 h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden"},Jo={key:4,class:"h-full flex flex-col overflow-hidden"},Ko={class:"px-4 py-3 border-b border-gray-200 dark:border-gray-700"},Qo={class:"text-sm font-medium flex items-center gap-2"},Xo={class:"flex-1 overflow-y-auto"},Zo={class:"flex items-center gap-3"},er={class:"flex-1 min-w-0"},tr={class:"flex items-center gap-2 text-sm"},sr={class:"font-medium truncate"},ar={class:"font-medium truncate"},nr={class:"flex items-center gap-3 mt-1 text-xs text-gray-400"},or={class:"w-24 h-2 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden"},rr={key:0,class:"px-4 py-2 border-t border-gray-200 dark:border-gray-700 text-xs text-gray-400 flex items-center gap-4 bg-gray-50 dark:bg-gray-800/50"},ir=q({__name:"ClusterView",props:{sessionId:{},timeFilter:{}},setup(l){Je([Pt,Ke,qt,Yt,Qe]);const s=l,{t:e}=ae(),o=gt(),c=D(()=>o.value==="dark"),u=L(!0),d=L(null),m=L("matrix"),p=L(null),k=L({lookAhead:3,decaySeconds:120,topEdges:150}),y=L(null);let g=null;async function n(){if(s.sessionId){u.value=!0;try{d.value=await oo(s.sessionId,s.timeFilter,{lookAhead:k.value.lookAhead,decaySeconds:k.value.decaySeconds,topEdges:k.value.topEdges})}catch(M){console.error("[chart-cluster] 加载小团体关系数据失败:",M),d.value=null}finally{u.value=!1}}}const r=D(()=>{if(!d.value||d.value.nodes.length===0)return null;const{nodes:M,links:T,maxLinkValue:V}=d.value,U=[...M].sort((E,W)=>W.messageCount-E.messageCount).slice(0,20).map(E=>E.name),R=new Map;for(const E of T)R.set(`${E.source}-${E.target}`,E.value),R.set(`${E.target}-${E.source}`,E.value);const F=[];for(let E=0;E<U.length;E++)for(let W=0;W<U.length;W++)if(E===W)F.push([E,W,-1]);else{const X=R.get(`${U[E]}-${U[W]}`)||0;F.push([E,W,X])}return{names:U,data:F,maxValue:V}});function h(){if(!r.value)return{graphic:{type:"text",style:{text:e("views.cluster.noData"),fill:"#999"}}};const{names:M,data:T,maxValue:V}=r.value;return{tooltip:{position:"top",formatter:H=>{const[U,R,F]=H.data;return F<0?`${M[U]}`:F===0?`${M[U]} ↔ ${M[R]}<br/>暂无关系数据`:`${M[U]} ↔ ${M[R]}<br/>临近度: ${F.toFixed(2)}`}},grid:{left:120,right:40,top:40,bottom:120},xAxis:{type:"category",data:M,splitArea:{show:!0},axisLabel:{rotate:45,fontSize:10,color:c.value?"#ccc":"#333"}},yAxis:{type:"category",data:M,splitArea:{show:!0},axisLabel:{fontSize:10,color:c.value?"#ccc":"#333"}},visualMap:{min:0,max:V||1,calculable:!0,orient:"horizontal",left:"center",bottom:10,inRange:{color:c.value?["#1a1a2e","#16213e","#0f3460","#e94560"]:["#f7f7f7","#fce4ec","#f8bbd9","#ee4567"]},textStyle:{color:c.value?"#ccc":"#333"}},series:[{type:"heatmap",data:T.filter(H=>H[2]>=0),label:{show:!1},emphasis:{itemStyle:{shadowBlur:10,shadowColor:"rgba(0, 0, 0, 0.5)"}}}],backgroundColor:"transparent"}}const f=D(()=>d.value?[...d.value.nodes].sort((M,T)=>T.messageCount-M.messageCount):[]),b=D(()=>!d.value||p.value===null?null:d.value.nodes.find(M=>M.id===p.value)||null),_=D(()=>{if(!d.value||!b.value)return[];const M=b.value.name,T=[];for(const V of d.value.links)V.source===M?T.push({otherName:V.target,value:V.value,coOccurrenceCount:V.coOccurrenceCount}):V.target===M&&T.push({otherName:V.source,value:V.value,coOccurrenceCount:V.coOccurrenceCount});return T.sort((V,H)=>H.value-V.value),T}),C=D(()=>d.value?d.value.links.slice(0,50):[]);function v(){g&&m.value==="matrix"&&g.setOption(h(),{notMerge:!0})}function $(){y.value&&(g=Xe(y.value,c.value?"dark":void 0),v())}function S(){g?.resize()}return G(m,async(M,T)=>{T==="matrix"&&g&&(g.dispose(),g=null),M==="matrix"&&(await Se(),$())}),G([d,()=>c.value],()=>{m.value==="matrix"&&v()},{deep:!0}),G(u,async(M,T)=>{T&&!M&&m.value==="matrix"&&(g&&(g.dispose(),g=null),await Se(),$())}),G(()=>[s.sessionId,s.timeFilter],()=>n(),{immediate:!0,deep:!0}),ke(()=>{window.addEventListener("resize",S),m.value==="matrix"&&Se(()=>$())}),De(()=>{window.removeEventListener("resize",S),g?.dispose(),g=null}),(M,T)=>{const V=pe,H=qe("UButtonGroup"),U=Be,R=nt,F=$e;return i(),I("div",ro,[a("div",io,[a("div",lo,[a("div",co,[w(H,{size:"xs"},{default:A(()=>[w(V,{color:m.value==="matrix"?"primary":"neutral",variant:m.value==="matrix"?"solid":"ghost",onClick:T[0]||(T[0]=E=>m.value="matrix")},{default:A(()=>[Q(x(t(e)("views.cluster.matrixView")),1)]),_:1},8,["color","variant"]),w(V,{color:m.value==="member"?"primary":"neutral",variant:m.value==="member"?"solid":"ghost",onClick:T[1]||(T[1]=E=>m.value="member")},{default:A(()=>[Q(x(t(e)("views.cluster.memberView")),1)]),_:1},8,["color","variant"]),w(V,{color:m.value==="circle"?"primary":"neutral",variant:m.value==="circle"?"solid":"ghost",onClick:T[2]||(T[2]=E=>m.value="circle")},{default:A(()=>[Q(x(t(e)("views.cluster.rankingView")),1)]),_:1},8,["color","variant"])]),_:1})]),a("div",uo,[w(R,null,{content:A(()=>[a("div",mo,[a("h4",go,x(t(e)("views.cluster.modelSettings")),1),a("div",po,[a("div",null,[a("label",ho,x(t(e)("views.cluster.lookAhead")),1),w(U,{modelValue:k.value.lookAhead,"onUpdate:modelValue":T[3]||(T[3]=E=>k.value.lookAhead=E),modelModifiers:{number:!0},type:"number",min:1,max:10,size:"xs",placeholder:"1-10"},null,8,["modelValue"]),a("p",vo,x(t(e)("views.cluster.lookAheadDesc")),1)]),a("div",null,[a("label",fo,x(t(e)("views.cluster.decaySeconds")),1),w(U,{modelValue:k.value.decaySeconds,"onUpdate:modelValue":T[4]||(T[4]=E=>k.value.decaySeconds=E),modelModifiers:{number:!0},type:"number",min:30,max:3600,size:"xs",placeholder:"30-3600"},null,8,["modelValue"]),a("p",yo,x(t(e)("views.cluster.decaySecondsDesc")),1)]),w(V,{size:"xs",color:"primary",class:"w-full mt-2",onClick:n},{default:A(()=>[Q(x(t(e)("views.cluster.applySettings")),1)]),_:1})])])]),default:A(()=>[w(V,{variant:"ghost",size:"xs",icon:"i-heroicons-adjustments-horizontal"})]),_:1}),w(V,{variant:"ghost",size:"xs",icon:"i-heroicons-arrow-path",onClick:n})])]),a("div",xo,[u.value?(i(),I("div",bo,[w(F,{name:"i-heroicons-arrow-path",class:"w-6 h-6 animate-spin text-gray-400"})])):!d.value||d.value.nodes.length===0?(i(),I("div",ko,[a("div",_o,[w(F,{name:"i-heroicons-user-group",class:"w-12 h-12 mx-auto mb-2 opacity-50"}),a("p",null,x(t(e)("views.cluster.noData")),1)])])):m.value==="matrix"?(i(),I("div",wo,[a("div",{ref_key:"chartRef",ref:y,class:"w-full h-full"},null,512)])):m.value==="member"?(i(),I("div",$o,[a("div",Io,[a("div",Co,[a("h3",So,[w(F,{name:"i-heroicons-users",class:"w-4 h-4"}),Q(" "+x(t(e)("views.cluster.selectMember")),1)])]),a("div",Mo,[(i(!0),I(P,null,se(f.value,E=>(i(),I("div",{key:E.id,class:ee(["px-4 py-2 cursor-pointer border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50",{"bg-primary-50 dark:bg-primary-900/30":p.value===E.id}]),onClick:W=>p.value=E.id},[a("div",Do,[a("span",Ro,x(E.name),1),a("span",No,x(E.messageCount),1)])],10,To))),128))])]),a("div",Lo,[b.value?(i(),I(P,{key:1},[a("div",Eo,[a("div",Oo,x(b.value.name.charAt(0)),1),a("div",null,[a("div",zo,x(b.value.name),1),a("div",Fo,x(t(e)("views.cluster.msgCount"))+": "+x(b.value.messageCount)+" | "+x(t(e)("views.cluster.relationCount"))+": "+x(_.value.length),1)])]),a("div",Bo,[a("h3",Uo,[w(F,{name:"i-heroicons-heart",class:"w-4 h-4 text-pink-500"}),Q(" "+x(t(e)("views.cluster.relationsByIntimacy")),1)])]),a("div",Ho,[_.value.length===0?(i(),I("div",Wo,x(t(e)("views.cluster.noRelations")),1)):B("",!0),(i(!0),I(P,null,se(_.value,(E,W)=>(i(),I("div",{key:E.otherName,class:"px-4 py-3 border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50"},[a("div",jo,[a("span",{class:ee(["w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold",W<3?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400":"bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400"])},x(W+1),3),a("div",Po,[a("div",qo,x(E.otherName),1),a("div",Yo,[a("span",null,x(t(e)("views.cluster.intimacy"))+": "+x((E.value*100).toFixed(0))+"%",1),a("span",null,x(t(e)("views.cluster.coOccurrence"))+": "+x(E.coOccurrenceCount)+x(t(e)("views.cluster.times")),1)])]),a("div",Go,[a("div",{class:"h-full bg-linear-to-r from-pink-400 to-pink-600",style:xe({width:`${_.value[0]?.value?E.value/_.value[0].value*100:0}%`})},null,4)])])]))),128))])],64)):(i(),I("div",Vo,[a("div",Ao,[w(F,{name:"i-heroicons-cursor-arrow-rays",class:"w-12 h-12 mx-auto mb-2 opacity-50"}),a("p",null,x(t(e)("views.cluster.selectMemberHint")),1)])]))])])):(i(),I("div",Jo,[a("div",Ko,[a("h3",Qo,[w(F,{name:"i-heroicons-trophy",class:"w-4 h-4 text-yellow-500"}),Q(" "+x(t(e)("views.cluster.interactionRanking")),1)])]),a("div",Xo,[(i(!0),I(P,null,se(C.value,(E,W)=>(i(),I("div",{key:W,class:"px-4 py-3 border-b border-gray-100 dark:border-gray-800 hover:bg-gray-50 dark:hover:bg-gray-800/50"},[a("div",Zo,[a("span",{class:ee(["w-8 h-8 rounded-full flex items-center justify-center text-sm font-bold",W<3?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400":"bg-gray-100 text-gray-500 dark:bg-gray-800 dark:text-gray-400"])},x(W+1),3),a("div",er,[a("div",tr,[a("span",sr,x(E.source),1),T[5]||(T[5]=a("span",{class:"text-gray-400"},"↔",-1)),a("span",ar,x(E.target),1)]),a("div",nr,[a("span",null,x(t(e)("views.cluster.score"))+": "+x(E.value.toFixed(2)),1),a("span",null,x(t(e)("views.cluster.coOccurrence"))+": "+x(E.coOccurrenceCount)+x(t(e)("views.cluster.times")),1)])]),a("div",or,[a("div",{class:"h-full bg-linear-to-r from-yellow-400 to-orange-500",style:xe({width:`${C.value[0]?.value?E.value/C.value[0].value*100:0}%`})},null,4)])])]))),128))])]))]),d.value?(i(),I("div",rr,[a("span",null,x(t(e)("views.cluster.totalMembers"))+": "+x(d.value.stats.totalMembers),1),a("span",null,x(t(e)("views.cluster.totalMessages"))+": "+x(d.value.stats.totalMessages.toLocaleString()),1),a("span",null,x(t(e)("views.cluster.involvedMembers"))+": "+x(d.value.stats.involvedMembers),1),a("span",null,x(t(e)("views.cluster.edgeCount"))+": "+x(d.value.stats.edgeCount),1)])):B("",!0)])])}}}),lr={class:"flex h-full flex-col"},cr={class:"min-h-0 flex-1 overflow-y-auto"},dr=q({__name:"GroupRelationships",props:{sessionId:{},timeFilter:{}},setup(l){const{t:s}=ae(),e=l,o=L("mention-graph"),c=D(()=>[{id:"mention-graph",label:s("analysis.subTabs.groupRelationships.mentionGraph"),icon:"i-heroicons-arrows-right-left"},{id:"mention-ranking",label:s("analysis.subTabs.groupRelationships.mentionRanking"),icon:"i-heroicons-heart"},{id:"proximity",label:s("analysis.subTabs.groupRelationships.proximity"),icon:"i-heroicons-user-group"}]);return(u,d)=>(i(),I("div",lr,[w(t(Ye),{modelValue:o.value,"onUpdate:modelValue":d[0]||(d[0]=m=>o.value=m),items:c.value,"persist-key":"groupRelationshipsTab",size:"sm"},null,8,["modelValue","items"]),a("div",cr,[w(Re,{name:"fade",mode:"out-in"},{default:A(()=>[o.value==="mention-graph"?(i(),N(vn,{key:0,"session-id":e.sessionId,"time-filter":e.timeFilter},null,8,["session-id","time-filter"])):o.value==="mention-ranking"?(i(),N(Xn,{key:1,"session-id":e.sessionId,"time-filter":e.timeFilter},null,8,["session-id","time-filter"])):o.value==="proximity"?(i(),N(ir,{key:2,"session-id":e.sessionId,"time-filter":e.timeFilter},null,8,["session-id","time-filter"])):B("",!0)]),_:1})])]))}}),ur=Le(dr,[["__scopeId","data-v-90e47115"]]),mr={class:"flex h-full flex-col"},gr={class:"flex-1 min-h-0 overflow-y-auto"},pr=q({__name:"ViewTab",props:{sessionId:{},sessionName:{},timeFilter:{}},setup(l){const{t:s,locale:e}=ae(),o=l,c=D(()=>{const p=[{id:"type-analysis",label:s("analysis.subTabs.view.typeAnalysis"),icon:"i-heroicons-chart-pie"},{id:"time-analysis",label:s("analysis.subTabs.view.timeAnalysis"),icon:"i-heroicons-clock"},{id:"topic",label:s("analysis.subTabs.view.topic"),icon:"i-heroicons-cloud"},{id:"group-relationships",label:s("analysis.subTabs.view.groupRelationships"),icon:"i-heroicons-heart"},{id:"hot-repeat",label:s("analysis.subTabs.quotes.hotRepeat"),icon:"i-heroicons-fire"},{id:"catchphrase",label:s("analysis.subTabs.quotes.catchphrase"),icon:"i-heroicons-chat-bubble-bottom-center-text"}];return pt("groupRanking",e.value)&&p.splice(2,0,{id:"ranking",label:s("analysis.subTabs.view.ranking"),icon:"i-heroicons-trophy"}),p}),u=L("type-analysis"),d=L(null),m=D(()=>({...o.timeFilter,memberId:d.value}));return(p,k)=>(i(),I("div",mr,[w(t(Ye),{modelValue:u.value,"onUpdate:modelValue":k[1]||(k[1]=y=>u.value=y),items:c.value,"persist-key":"groupViewTab"},{right:A(()=>[u.value!=="topic"?(i(),N(Ct,{key:0,modelValue:d.value,"onUpdate:modelValue":k[0]||(k[0]=y=>d.value=y),"session-id":o.sessionId},null,8,["modelValue","session-id"])):B("",!0)]),_:1},8,["modelValue","items"]),a("div",gr,[w(Re,{name:"fade",mode:"out-in"},{default:A(()=>[u.value==="type-analysis"?(i(),N(St,{key:0,"session-id":o.sessionId,"session-name":o.sessionName,"time-filter":m.value},null,8,["session-id","session-name","time-filter"])):u.value==="time-analysis"?(i(),N(Mt,{key:1,"session-id":o.sessionId,"session-name":o.sessionName,"time-filter":m.value},null,8,["session-id","session-name","time-filter"])):u.value==="topic"?(i(),N(t(Tt),{key:2,"session-id":o.sessionId,"time-filter":o.timeFilter},null,8,["session-id","time-filter"])):u.value==="group-relationships"?(i(),N(ur,{key:3,"session-id":o.sessionId,"time-filter":m.value},null,8,["session-id","time-filter"])):u.value==="ranking"?(i(),N(Ga,{key:4,"session-id":o.sessionId,"time-filter":m.value},null,8,["session-id","time-filter"])):u.value==="hot-repeat"?(i(),N(t(Js),{key:5,"session-id":o.sessionId,"time-filter":o.timeFilter},null,8,["session-id","time-filter"])):u.value==="catchphrase"?(i(),N(t(Ls),{key:6,"session-id":o.sessionId,"time-filter":o.timeFilter},null,8,["session-id","time-filter"])):B("",!0)]),_:1})])]))}}),hr=Le(pr,[["__scopeId","data-v-abeebf4d"]]),vr={key:0,class:"mb-6"},fr={class:"flex items-center gap-3"},yr={class:"text-xl font-bold text-gray-900 dark:text-white"},xr={class:"text-sm text-gray-500 dark:text-gray-400"},br={class:"mb-4 flex flex-wrap items-center justify-between gap-3"},kr={class:"flex items-center gap-2"},_r={class:"text-xs text-gray-500 dark:text-gray-400"},wr={key:0,class:"flex h-60 items-center justify-center"},$r={key:1,class:"flex h-60 flex-col items-center justify-center"},Ir={class:"text-gray-500 dark:text-gray-400"},Cr={key:2,class:"flex min-h-0 flex-1 flex-col"},Sr={class:"w-full"},Mr={class:"sticky top-0 bg-gray-50 dark:bg-gray-800"},Tr={class:"text-left text-xs font-medium uppercase text-gray-500 dark:text-gray-400"},Dr={class:"px-4 py-4"},Rr={class:"px-4 py-4"},Nr={class:"px-4 py-4"},Lr={class:"w-64 px-4 py-4"},Vr={class:"inline-flex items-center gap-1.5"},Ar={class:"px-4 py-4 text-right"},Er={class:"divide-y divide-gray-200 dark:divide-gray-700"},Or={class:"px-4 py-4"},zr={class:"px-4 py-4"},Fr={class:"flex items-center gap-2"},Br=["src","alt"],Ur={key:1,class:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-pink-400 to-pink-600 text-xs font-medium text-white"},Hr={class:"text-sm font-medium text-gray-900 dark:text-white"},Wr={class:"ml-1 text-sm text-gray-500 dark:text-gray-400"},jr={class:"px-4 py-4"},Pr={key:0,class:"text-sm font-medium text-gray-900 dark:text-white"},qr={key:1,class:"text-sm text-gray-400 dark:text-gray-500"},Yr={class:"px-4 py-4"},Gr={class:"text-sm font-semibold text-gray-900 dark:text-white"},Jr={class:"px-4 py-4"},Kr={class:"max-w-xs"},Qr={key:0,class:"absolute right-2 top-1/2 -translate-y-1/2"},Xr={class:"px-4 py-4 text-right"},Zr={key:0,class:"flex items-center justify-between border-t border-gray-200 px-6 py-4 dark:border-gray-700"},ei={class:"text-sm text-gray-500 dark:text-gray-400"},ti={class:"flex items-center gap-2"},si={class:"text-sm font-medium text-gray-600 dark:text-gray-300"},ai={class:"p-6 text-center"},ni={class:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30"},oi={class:"mb-2 text-lg font-semibold text-gray-900 dark:text-white"},ri={class:"mb-6 text-sm text-gray-500 dark:text-gray-400"},ii={class:"flex justify-center gap-3"},li={class:"p-6"},ci={class:"mb-4 flex items-center gap-3"},di={class:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-100 dark:bg-amber-900/30"},ui={class:"text-lg font-semibold text-gray-900 dark:text-white"},mi={class:"mb-2 text-sm text-gray-600 dark:text-gray-400"},gi={class:"mb-6 text-xs text-amber-700 dark:text-amber-300"},pi={class:"flex justify-end gap-2"},Me=20,hi=q({__name:"MemberList",props:{sessionId:{},showHeader:{type:Boolean,default:!0}},emits:["data-changed"],setup(l,{emit:s}){const{t:e}=ae(),o=l,c=s,u=L([]),d=L([]),m=L(!1),p=L(""),k=L(null),y=L(!1),g=L(new Set),n=L(!1),r=L(!1),h=L(1),f=L(0),b=L(0),_=L("desc"),C=L(null);let v=null;function $(z){return z.groupNickname||z.accountName||z.platformId}function S(z){return $(z).slice(0,1)}const M=D(()=>d.value.filter(z=>g.value.has(z.id))),T=D(()=>M.value.length===2),V=D(()=>{if(M.value.length!==2)return null;const[z,O]=M.value;return O.messageCount>z.messageCount||O.messageCount===z.messageCount&&O.id<z.id?{primary:O,secondary:z}:{primary:z,secondary:O}});function H(){_.value=_.value==="desc"?"asc":"desc",h.value=1,U()}async function U(){if(o.sessionId){m.value=!0;try{const z=await Y().getMembersPaginated(o.sessionId,{page:h.value,pageSize:Me,search:p.value.trim(),sortOrder:_.value});u.value=z.items,f.value=z.total,b.value=z.totalPages}catch(z){console.error("加载成员列表失败:",z)}finally{m.value=!1}}}async function R(){if(o.sessionId)try{d.value=await Y().getMembers(o.sessionId)}catch(z){console.error("加载所有成员失败:",z)}}async function F(z,O){const Z=JSON.parse(JSON.stringify(O)),ge=JSON.stringify(z.aliases),ie=JSON.stringify(Z);if(ge!==ie){C.value=z.id;try{if(await Y().updateMemberAliases(o.sessionId,z.id,Z)){const j=u.value.findIndex(_e=>_e.id===z.id);j!==-1&&(u.value[j]={...u.value[j],aliases:Z})}}catch(he){console.error("保存别名失败:",he)}finally{C.value=null}}}function E(z){k.value=z}function W(){k.value=null}async function X(){if(k.value){y.value=!0;try{await Y().deleteMember(o.sessionId,k.value.id)&&(await U(),await R(),c("data-changed"))}catch(z){console.error("删除成员失败:",z)}finally{y.value=!1,k.value=null}}}function te(z){const O=new Set(g.value);O.has(z)?O.delete(z):O.add(z),g.value=O}function le(){T.value&&(n.value=!0)}function re(){g.value=new Set}async function ue(){if(V.value){r.value=!0;try{await Y().mergeMembers(o.sessionId,V.value.primary.id,V.value.secondary.id)&&(n.value=!1,re(),await U(),await R(),c("data-changed"))}catch(z){console.error("合并成员失败:",z)}finally{r.value=!1}}}return G(p,()=>{h.value=1,v&&clearTimeout(v),v=setTimeout(()=>{U()},300)}),G(h,()=>{U()}),G(()=>o.sessionId,()=>{p.value="",h.value=1,re(),U(),R()},{immediate:!0}),ke(()=>{U(),R()}),(z,O)=>{const Z=pe,ge=Be,ie=$e,he=Ue,j=ot,_e=rt,Ve=be;return i(),I("div",{class:ee(["main-content",o.showHeader?"max-w-5xl p-6":"flex h-full max-w-none flex-col overflow-hidden p-4"])},[o.showHeader?(i(),I("div",vr,[a("div",fr,[a("div",null,[a("h2",yr,x(t(e)("members.list.title")),1),a("p",xr,x(t(e)("members.list.description",{count:f.value})),1)])])])):B("",!0),w(Dt,{class:"mb-6","session-id":l.sessionId,members:d.value,"is-loading":m.value,"chat-type":"group"},null,8,["session-id","members","is-loading"]),a("div",br,[w(ge,{modelValue:p.value,"onUpdate:modelValue":O[1]||(O[1]=J=>p.value=J),placeholder:t(e)("members.list.searchPlaceholder"),icon:"i-heroicons-magnifying-glass",class:"w-full md:w-100"},Pe({_:2},[p.value?{name:"trailing",fn:A(()=>[w(Z,{icon:"i-heroicons-x-mark",variant:"link",color:"neutral",size:"xs",onClick:O[0]||(O[0]=J=>p.value="")})]),key:"0"}:void 0]),1032,["modelValue","placeholder"]),a("div",kr,[a("span",_r,x(t(e)("members.list.mergeSelectedCount",{count:g.value.size})),1),w(Z,{icon:"i-heroicons-link",size:"sm",color:"primary",disabled:!T.value,onClick:le},{default:A(()=>[Q(x(t(e)("members.list.mergeSelected")),1)]),_:1},8,["disabled"])])]),a("div",{class:ee(["rounded-xl border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-900",o.showHeader?"":"flex min-h-0 flex-1 flex-col"])},[m.value?(i(),I("div",wr,[w(ie,{name:"i-heroicons-arrow-path",class:"h-8 w-8 animate-spin text-pink-500"})])):u.value.length===0?(i(),I("div",$r,[w(ie,{name:"i-heroicons-user-group",class:"mb-3 h-12 w-12 text-gray-300 dark:text-gray-600"}),a("p",Ir,x(p.value?t(e)("members.list.noMatch"):t(e)("members.list.empty")),1)])):(i(),I("div",Cr,[a("div",{class:ee(["max-h-[500px] overflow-y-auto",o.showHeader?"":"max-h-none min-h-0 flex-1"])},[a("table",Sr,[a("thead",Mr,[a("tr",Tr,[O[7]||(O[7]=a("th",{class:"w-12 px-4 py-4"},null,-1)),a("th",Dr,x(t(e)("members.list.table.accountName")),1),a("th",Rr,x(t(e)("members.list.table.groupNickname")),1),a("th",Nr,[a("button",{class:"flex items-center gap-1.5 hover:text-gray-700 dark:hover:text-gray-200",onClick:H},[Q(x(t(e)("members.list.table.messageCount"))+" ",1),w(ie,{name:_.value==="desc"?"i-heroicons-arrow-down":"i-heroicons-arrow-up",class:"h-3.5 w-3.5"},null,8,["name"])])]),a("th",Lr,[a("div",Vr,[a("span",null,x(t(e)("members.list.table.customAlias")),1),w(he,{text:t(e)("members.list.tip"),popper:{placement:"top"}},{default:A(()=>[w(ie,{name:"i-heroicons-question-mark-circle",class:"h-4 w-4 text-gray-400 dark:text-gray-500"})]),_:1},8,["text"])])]),a("th",Ar,x(t(e)("members.list.table.actions")),1)])]),a("tbody",Er,[(i(!0),I(P,null,se(u.value,J=>(i(),I("tr",{key:J.id,class:"hover:bg-gray-50 dark:hover:bg-gray-800/50"},[a("td",Or,[w(j,{"model-value":g.value.has(J.id),onClick:je(Ce=>te(J.id),["stop"])},null,8,["model-value","onClick"])]),a("td",zr,[a("div",Fr,[J.avatar?(i(),I("img",{key:0,src:J.avatar,alt:$(J),class:"h-8 w-8 shrink-0 rounded-full object-cover"},null,8,Br)):(i(),I("div",Ur,x(S(J)),1)),a("div",null,[a("span",Hr,x(J.accountName||"-"),1),a("span",Wr,"("+x(J.platformId)+")",1)])])]),a("td",jr,[J.groupNickname?(i(),I("span",Pr,x(J.groupNickname),1)):(i(),I("span",qr,"-"))]),a("td",Yr,[a("span",Gr,x(J.messageCount.toLocaleString()),1)]),a("td",Jr,[a("div",Kr,[w(_e,{"model-value":J.aliases,placeholder:t(e)("members.list.aliasPlaceholder"),class:"w-80","onUpdate:modelValue":Ce=>F(J,Ce)},null,8,["model-value","placeholder","onUpdate:modelValue"]),C.value===J.id?(i(),I("div",Qr,[w(ie,{name:"i-heroicons-arrow-path",class:"h-4 w-4 animate-spin text-pink-500"})])):B("",!0)])]),a("td",Xr,[w(Z,{label:t(e)("members.list.delete"),size:"xs",onClick:Ce=>E(J)},null,8,["label","onClick"])])]))),128))])])],2),b.value>1?(i(),I("div",Zr,[a("p",ei,x(t(e)("members.list.pagination",{start:(h.value-1)*Me+1,end:Math.min(h.value*Me,f.value),total:f.value})),1),a("div",ti,[w(Z,{icon:"i-heroicons-chevron-left",variant:"outline",size:"sm",disabled:h.value===1||m.value,onClick:O[2]||(O[2]=J=>h.value--)},null,8,["disabled"]),a("span",si,x(h.value)+" / "+x(b.value),1),w(Z,{icon:"i-heroicons-chevron-right",variant:"outline",size:"sm",disabled:h.value>=b.value||m.value,onClick:O[3]||(O[3]=J=>h.value++)},null,8,["disabled"])])])):B("",!0)]))],2),w(Ve,{open:!!k.value,ui:{content:"max-w-sm"},"onUpdate:open":O[4]||(O[4]=J=>k.value=null)},{content:A(()=>[a("div",ai,[a("div",ni,[w(ie,{name:"i-heroicons-exclamation-triangle",class:"h-7 w-7 text-red-500"})]),a("h3",oi,x(t(e)("members.list.modal.title")),1),a("p",ri,x(t(e)("members.list.modal.content",{name:k.value?$(k.value):"",count:k.value?.messageCount.toLocaleString()})),1),a("div",ii,[w(Z,{variant:"outline",onClick:W},{default:A(()=>[Q(x(t(e)("members.list.modal.cancel")),1)]),_:1}),w(Z,{color:"error",loading:y.value,onClick:X},{default:A(()=>[Q(x(t(e)("members.list.modal.confirm")),1)]),_:1},8,["loading"])])])]),_:1},8,["open"]),w(Ve,{open:n.value,ui:{content:"max-w-md"},"onUpdate:open":O[6]||(O[6]=J=>n.value=J)},{content:A(()=>[a("div",li,[a("div",ci,[a("div",di,[w(ie,{name:"i-heroicons-link",class:"h-5 w-5 text-amber-600 dark:text-amber-400"})]),a("h3",ui,x(t(e)("members.list.mergeModal.title")),1)]),a("p",mi,x(t(e)("members.list.mergeModal.content",{source:V.value?$(V.value.secondary):"",sourceCount:V.value?V.value.secondary.messageCount.toLocaleString():"0",target:V.value?$(V.value.primary):"",targetCount:V.value?V.value.primary.messageCount.toLocaleString():"0"})),1),a("p",gi,x(t(e)("members.list.mergeModal.hint")),1),a("div",pi,[w(Z,{variant:"outline",disabled:r.value,onClick:O[5]||(O[5]=J=>n.value=!1)},{default:A(()=>[Q(x(t(e)("members.list.mergeModal.cancel")),1)]),_:1},8,["disabled"]),w(Z,{color:"primary",loading:r.value,onClick:ue},{default:A(()=>[Q(x(t(e)("members.list.mergeModal.confirm")),1)]),_:1},8,["loading"])])])]),_:1},8,["open"])],2)}}}),vi={class:"main-content max-w-5xl p-6"},fi={class:"mb-4 text-sm text-gray-500 dark:text-gray-400 no-capture"},yi={key:0,class:"divide-y divide-gray-100 dark:divide-gray-800"},xi={class:"w-32 shrink-0 pt-0.5 font-medium text-gray-900 dark:text-white"},bi={class:"flex flex-1 flex-wrap items-center gap-2"},ki={class:"flex items-center gap-1.5 rounded-lg bg-gray-50 px-3 py-1.5 dark:bg-gray-800"},_i={class:"text-xs text-gray-400"},wi={key:0,class:"text-gray-300 dark:text-gray-600"},$i=q({__name:"NicknameHistory",props:{sessionId:{}},setup(l){const{t:s}=ae(),e=l,o=L([]),c=L([]),u=L(!1);function d(k){return k.groupNickname||k.accountName||k.platformId}async function m(){if(e.sessionId)try{o.value=await Y().getMembers(e.sessionId)}catch(k){console.error("加载成员列表失败:",k)}}async function p(){if(!e.sessionId||o.value.length===0)return;u.value=!0;const k=[];try{const y=o.value.map(n=>Y().getMemberNameHistory(e.sessionId,n.id)),g=await Promise.all(y);o.value.forEach((n,r)=>{const h=g[r];h.length>2&&k.push({memberId:n.id,name:d(n),history:h})}),c.value=k}catch(y){console.error("加载昵称变更记录失败:",y)}finally{u.value=!1}}return G(()=>e.sessionId,async()=>{await m()},{immediate:!0}),G(()=>o.value.length,()=>{o.value.length>0&&p()}),ke(async()=>{o.value.length===0&&await m()}),(k,y)=>{const g=Fe;return i(),I("div",vi,[a("p",fi,x(t(s)("members.nicknameHistory.note")),1),w(t(K),{title:t(s)("members.nicknameHistory.title"),description:u.value?t(s)("members.nicknameHistory.loading"):c.value.length>0?t(s)("members.nicknameHistory.hasChanges",{count:c.value.length}):t(s)("members.nicknameHistory.noChanges")},{default:A(()=>[!u.value&&c.value.length>0?(i(),I("div",yi,[(i(!0),I(P,null,se(c.value,n=>(i(),I("div",{key:n.memberId,class:"flex items-start gap-3 px-5 py-3"},[a("div",xi,x(n.name),1),a("div",bi,[(i(!0),I(P,null,se(n.history,(r,h)=>(i(),I(P,{key:h},[a("div",ki,[a("span",{class:ee(["text-sm",r.endTs===null?"font-semibold text-pink-600":"text-gray-700 dark:text-gray-300"])},x(r.name),3),r.endTs===null?(i(),N(g,{key:0,color:"primary",variant:"soft",size:"xs"},{default:A(()=>[Q(x(t(s)("members.nicknameHistory.current")),1)]),_:1})):B("",!0),a("span",_i,"("+x(t(Rt)(r.startTs,r.endTs))+")",1)]),h<n.history.length-1?(i(),I("span",wi,"→")):B("",!0)],64))),128))])]))),128))])):u.value?(i(),N(t(oe),{key:2,text:t(s)("members.nicknameHistory.loadingText")},null,8,["text"])):(i(),N(t(ce),{key:1,text:t(s)("members.nicknameHistory.empty")},null,8,["text"]))]),_:1},8,["title","description"])])}}}),Ii={class:"flex h-full flex-col overflow-hidden bg-white dark:bg-gray-900"},Ci={class:"flex flex-none items-center justify-between border-b border-gray-200 px-5 py-3 dark:border-gray-700"},Si={class:"text-lg font-semibold text-gray-900 dark:text-white"},Mi={class:"flex-1 overflow-auto"},Ti=q({__name:"NicknameHistoryEntry",props:{sessionId:{}},setup(l){const{t:s}=ae(),e=l,o=L(!1);return(c,u)=>{const d=pe,m=be;return i(),I(P,null,[w(d,{variant:"ghost",icon:"i-heroicons-clock",size:"sm",onClick:u[0]||(u[0]=p=>o.value=!0)},{default:A(()=>[Q(x(t(s)("analysis.subTabs.member.nicknameHistory")),1)]),_:1}),e.sessionId?(i(),N(m,{key:0,open:o.value,"onUpdate:open":u[2]||(u[2]=p=>o.value=p),ui:{content:"max-w-6xl h-[85vh]"}},{content:A(()=>[a("div",Ii,[a("div",Ci,[a("h2",Si,x(t(s)("analysis.subTabs.member.nicknameHistory")),1),w(d,{variant:"ghost",icon:"i-heroicons-x-mark",size:"sm",onClick:u[1]||(u[1]=p=>o.value=!1)})]),a("div",Mi,[w($i,{"session-id":e.sessionId},null,8,["session-id"])])])]),_:1},8,["open"])):B("",!0)],64)}}}),Di={class:"flex h-full flex-col bg-white dark:bg-gray-900",style:{"padding-top":"var(--titlebar-area-height)"}},Ri={class:"mt-3 flex items-center justify-between gap-3"},Ni={class:"flex shrink-0 items-center gap-0.5 overflow-x-auto scrollbar-hide"},Li=["onClick"],Vi={class:"whitespace-nowrap"},Ai={class:"relative flex-1 overflow-y-auto"},Ei={class:"h-full"},Oi={key:2,class:"flex h-full items-center justify-center"},zi={class:"text-gray-500"},Fi={class:"flex h-full flex-col overflow-hidden bg-white dark:bg-gray-900"},Bi={class:"flex flex-none items-center justify-between border-b border-gray-200 px-5 py-3 dark:border-gray-700"},Ui={class:"text-lg font-semibold text-gray-900 dark:text-white"},Hi={class:"text-sm text-gray-500 dark:text-gray-400"},Wi={class:"flex items-center gap-2"},ji={class:"flex-1 overflow-hidden"},Pi=q({__name:"index",setup(l){const s=We(()=>ze(()=>import("./MessageExportModal-C7NgEL8T.js"),__vite__mapDeps([5,6,4,7,8,9,10,11,1,2,3,12]))),{t:e}=ae(),o=it(),c=lt(),u=ht(),d=Ne(),m=vt(),{currentSessionId:p}=ft(u),k=L(!1),y=L(!1),g=L(!1),n=L(!1);function r(){d.openChatRecordDrawer({})}const h=[{id:"overview",labelKey:"analysis.tabs.overview",icon:"i-heroicons-chart-pie"},{id:"view",labelKey:"analysis.tabs.view",icon:"i-heroicons-presentation-chart-bar"},{id:"ai-chat",labelKey:"analysis.tabs.aiChat",icon:"i-heroicons-chat-bubble-left-ellipsis"},{id:"lab",labelKey:"analysis.tabs.lab",icon:"i-heroicons-beaker"}],f=D(()=>m.debugMode?[...h,{id:"debug",labelKey:"analysis.tabs.debug",icon:"i-heroicons-bug-ant"}]:h),b=D(()=>f.value.map(z=>z.id)),{activeTab:_,isLoading:C,isInitialLoad:v,session:$,memberActivity:S,hourlyActivity:M,dailyActivity:T,messageTypes:V,timeRangeValue:H,fullTimeRange:U,availableYears:R,timeFilter:F,selectedYearForOverview:E,initialTimeState:W,loadData:X}=Nt({route:o,router:c,currentSessionId:p,selectSession:u.selectSession,defaultTab:m.defaultSessionTab,validTabIds:b.value}),te=D(()=>S.value.slice(0,3)),le=D(()=>S.value.length<=1?[]:[...S.value].sort((z,O)=>z.messageCount-O.messageCount).slice(0,1)),re=D(()=>S.value.reduce((z,O)=>z+O.messageCount,0)),ue=D(()=>S.value.filter(z=>z.messageCount>0).length);return(z,O)=>{const Z=pe,ge=Ue,ie=$e,he=be;return i(),I("div",Di,[t(v)?(i(),N(oe,{key:0,variant:"page",text:t(e)("analysis.groupChat.loading")},null,8,["text"])):t($)?(i(),I(P,{key:1},[w(Lt,{title:t($).name,avatar:t($).groupAvatar,size:"compact",icon:"i-heroicons-chat-bubble-left-right","icon-class":"bg-primary-600 text-white dark:bg-primary-500 dark:text-white"},{actions:A(()=>[t(d).toolsPanelPosition==="header"?(i(),I(P,{key:0},[w(ge,{text:t(e)("analysis.tooltip.incrementalImport")},{default:A(()=>[w(Z,{icon:"i-heroicons-plus-circle",variant:"ghost",color:"gray",size:"sm",class:"hover:bg-gray-100 dark:hover:bg-gray-800",onClick:O[0]||(O[0]=j=>y.value=!0)})]),_:1},8,["text"]),w(ge,{text:t(e)("analysis.tooltip.memberManagement")},{default:A(()=>[w(Z,{icon:"i-heroicons-user-group",variant:"ghost",color:"gray",size:"sm",class:"hover:bg-gray-100 dark:hover:bg-gray-800",onClick:O[1]||(O[1]=j=>n.value=!0)})]),_:1},8,["text"]),w(ge,{text:t(e)("analysis.tooltip.viewChatRecord")},{default:A(()=>[w(Z,{icon:"i-heroicons-chat-bubble-bottom-center-text",variant:"ghost",color:"gray",size:"sm",class:"hover:bg-gray-100 dark:hover:bg-gray-800",onClick:r})]),_:1},8,["text"]),w(we,{color:"gray"}),w(ge,{text:t(e)("analysis.tooltip.more")},{default:A(()=>[w(Z,{icon:"i-heroicons-ellipsis-horizontal",variant:"ghost",color:"gray",size:"sm",class:"hover:bg-gray-100 dark:hover:bg-gray-800",onClick:O[2]||(O[2]=j=>t(d).toggleToolsPanelOpen())})]),_:1},8,["text"])],64)):(i(),N(we,{key:1,color:"gray"}))]),default:A(()=>[a("div",Ri,[a("div",Ni,[(i(!0),I(P,null,se(f.value,j=>(i(),I("button",{key:j.id,class:ee(["flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-sm font-medium transition-all",[t(_)===j.id?"bg-pink-500 text-white dark:bg-pink-900/30 dark:text-pink-300":"text-gray-600 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800"]]),onClick:_e=>_.value=j.id},[w(ie,{name:j.icon,class:"h-4 w-4"},null,8,["name"]),a("span",Vi,x(t(e)(j.labelKey)),1)],10,Li))),128))]),w(Ot,{modelValue:t(H),"onUpdate:modelValue":O[3]||(O[3]=j=>ut(H)?H.value=j:null),"session-id":t(p)??void 0,visible:t(_)!=="ai-chat"&&t(_)!=="memory"&&t(_)!=="lab"&&t(_)!=="debug","initial-state":t(W),"onUpdate:fullRange":O[4]||(O[4]=j=>U.value=j),"onUpdate:availableYears":O[5]||(O[5]=j=>R.value=j)},null,8,["modelValue","session-id","visible","initial-state"])])]),_:1},8,["title","avatar"]),a("div",Ai,[t(C)?(i(),N(oe,{key:0,variant:"overlay"})):B("",!0),a("div",Ei,[w(Re,{name:"tab-slide",mode:"out-in"},{default:A(()=>[t(_)==="overview"?(i(),N(ea,{key:"overview-"+t(p),session:t($),"member-activity":t(S),"top-members":te.value,"bottom-members":le.value,"message-types":t(V),"hourly-activity":t(M),"daily-activity":t(T),"time-range":t(U),"selected-year":t(E),"filtered-message-count":re.value,"filtered-member-count":ue.value,"time-filter":t(F)},null,8,["session","member-activity","top-members","bottom-members","message-types","hourly-activity","daily-activity","time-range","selected-year","filtered-message-count","filtered-member-count","time-filter"])):t(_)==="view"?(i(),N(hr,{key:"view-"+t(p),"session-id":t(p),"session-name":t($).name,"time-filter":t(F)},null,8,["session-id","session-name","time-filter"])):t(_)==="ai-chat"?(i(),N(t(zt),{key:"ai-chat-"+t(p),"session-id":t(p),"session-name":t($).name,"chat-type":"group"},null,8,["session-id","session-name"])):t(_)==="memory"?(i(),N(Ft,{key:"memory-"+t(p),"session-id":t(p),"session-name":t($).name},null,8,["session-id","session-name"])):t(_)==="lab"?(i(),N(Bt,{key:"lab-"+t(p),"session-id":t(p),"session-name":t($).name,"time-filter":t(F),"chat-type":"group",mode:"sql-only"},null,8,["session-id","session-name","time-filter"])):t(_)==="debug"?(i(),N(t(Ut),{key:"debug-"+t(p),"session-id":t(p)},null,8,["session-id"])):B("",!0)]),_:1})])]),w(Vt,{onOpenIncrementalImport:O[6]||(O[6]=j=>y.value=!0),onOpenSessionIndex:O[7]||(O[7]=j=>k.value=!0),onOpenMemberManagement:O[8]||(O[8]=j=>n.value=!0),onOpenChatRecord:r,onOpenMessageExport:O[9]||(O[9]=j=>g.value=!0)}),t(m).debugMode?(i(),N(Ht,{key:0})):B("",!0)],64)):(i(),I("div",Oi,[a("p",zi,x(t(e)("analysis.groupChat.loadError")),1)])),t(p)&&t($)&&t($).messageCount>0?(i(),N(At,{key:3,modelValue:k.value,"onUpdate:modelValue":O[10]||(O[10]=j=>k.value=j),"session-id":t(p),"message-count":t($).messageCount},null,8,["modelValue","session-id","message-count"])):B("",!0),t(p)&&t($)?(i(),N(Et,{key:4,modelValue:y.value,"onUpdate:modelValue":O[11]||(O[11]=j=>y.value=j),"session-id":t(p),"session-name":t($).name,onImported:O[12]||(O[12]=()=>{t(X)(),t(u).loadSessions()})},null,8,["modelValue","session-id","session-name"])):B("",!0),t(p)?(i(),N(t(s),{key:5,modelValue:g.value,"onUpdate:modelValue":O[13]||(O[13]=j=>g.value=j)},null,8,["modelValue"])):B("",!0),t(p)?(i(),N(he,{key:6,open:n.value,"onUpdate:open":O[15]||(O[15]=j=>n.value=j),ui:{content:"max-w-6xl h-[85vh]"}},{content:A(()=>[a("div",Fi,[a("div",Bi,[a("div",null,[a("h2",Ui,x(t(e)("analysis.tooltip.memberManagement")),1),a("p",Hi,x(t(e)("members.list.description",{count:t($)?.memberCount??0})),1)]),a("div",Wi,[w(Ti,{"session-id":t(p)},null,8,["session-id"]),w(Z,{variant:"ghost",icon:"i-heroicons-x-mark",size:"sm",onClick:O[14]||(O[14]=j=>n.value=!1)})])]),a("div",ji,[w(hi,{"session-id":t(p),"show-header":!1,onDataChanged:t(X)},null,8,["session-id","onDataChanged"])])])]),_:1},8,["open"])):B("",!0)])}}}),tl=Le(Pi,[["__scopeId","data-v-6ad95a6f"]]);export{tl as default};