mirror of
https://github.com/SilenceLurker/ST-Amily2-Chat-Optimisation.git
synced 2026-06-06 14:45:51 +00:00
2 lines
8.9 KiB
JavaScript
2 lines
8.9 KiB
JavaScript
(function(_0x1e4dac,_0x531ea3){const _0x40c58c=_0x7e35,_0x985f54=_0x1e4dac();while(!![]){try{const _0x4d2ed5=parseInt(_0x40c58c(0x1d1))/0x1*(parseInt(_0x40c58c(0x1b4))/0x2)+parseInt(_0x40c58c(0x1ab))/0x3+-parseInt(_0x40c58c(0x18d))/0x4+parseInt(_0x40c58c(0x1c6))/0x5*(parseInt(_0x40c58c(0x18c))/0x6)+parseInt(_0x40c58c(0x18b))/0x7*(-parseInt(_0x40c58c(0x1b2))/0x8)+-parseInt(_0x40c58c(0x19b))/0x9*(-parseInt(_0x40c58c(0x1c9))/0xa)+parseInt(_0x40c58c(0x19f))/0xb*(parseInt(_0x40c58c(0x1a4))/0xc);if(_0x4d2ed5===_0x531ea3)break;else _0x985f54['push'](_0x985f54['shift']());}catch(_0x1229b9){_0x985f54['push'](_0x985f54['shift']());}}}(_0x64af,0xf055d));function _0x7e35(_0xfb573f,_0x38e15e){_0xfb573f=_0xfb573f-0x18b;const _0x64af85=_0x64af();let _0x7e3568=_0x64af85[_0xfb573f];return _0x7e3568;}import{getGraph,syncGraphFromTables}from'./manager.js';import{showHtmlModal}from'../../ui/page-window.js';let echartsLoaded=![];async function loadECharts(){const _0x1cfffb=_0x7e35;if(echartsLoaded)return;if(window[_0x1cfffb(0x1be)]){echartsLoaded=!![];return;}return new Promise((_0x1aa858,_0x21ed0c)=>{const _0x13d9ff=_0x1cfffb,_0x5ed70c=document[_0x13d9ff(0x1ac)](_0x13d9ff(0x1c4));_0x5ed70c[_0x13d9ff(0x1bc)]='https://cdn.jsdelivr.net/npm/echarts@5.4.3/dist/echarts.min.js',_0x5ed70c['onload']=()=>{echartsLoaded=!![],_0x1aa858();},_0x5ed70c['onerror']=_0x21ed0c,document[_0x13d9ff(0x19e)][_0x13d9ff(0x19d)](_0x5ed70c);});}export async function showGraphVisualization(){const _0x5a388a=_0x7e35;syncGraphFromTables();const _0x3804c3=_0x5a388a(0x1b7);showHtmlModal('人物关系图谱',_0x3804c3,{'wide':!![],'large':!![],'onShow':async _0x17eb2f=>{const _0x4a4d0d=_0x5a388a;try{await loadECharts();const _0x1ef260=_0x17eb2f[_0x4a4d0d(0x1b6)]('#amily2-graph-container')[0x0];_0x1ef260[_0x4a4d0d(0x197)]='';const _0x5472ee=echarts[_0x4a4d0d(0x1aa)](_0x1ef260);renderChart(_0x5472ee),_0x17eb2f[_0x4a4d0d(0x1b6)]('#amily2-refresh-graph-btn')['on'](_0x4a4d0d(0x18e),()=>{const _0x5a249b=_0x4a4d0d;syncGraphFromTables(),renderChart(_0x5472ee),toastr[_0x5a249b(0x1cb)](_0x5a249b(0x1a0));}),_0x17eb2f[_0x4a4d0d(0x1b6)](_0x4a4d0d(0x1c2))['on'](_0x4a4d0d(0x18e),()=>{const _0x5567f0=_0x4a4d0d;_0x5472ee[_0x5567f0(0x1ad)]({'series':[{'layout':_0x5567f0(0x1a1),'force':{'initLayout':null,'repulsion':0x12c+Math['random']()*0x32}}]});}),new ResizeObserver(()=>_0x5472ee['resize']())[_0x4a4d0d(0x1a3)](_0x1ef260);}catch(_0x9fc53e){console[_0x4a4d0d(0x190)]('ECharts\x20loading\x20failed',_0x9fc53e),_0x17eb2f[_0x4a4d0d(0x1b6)](_0x4a4d0d(0x1af))[_0x4a4d0d(0x1ae)](_0x4a4d0d(0x18f));}}});}function _0x64af(){const _0x2f4505=['\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20id=\x22amily2-graph-container\x22\x20style=\x22width:\x20100%;\x20height:\x20600px;\x20background:\x20rgba(0,0,0,0.2);\x20border-radius:\x208px;\x20overflow:\x20hidden;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22display:\x20flex;\x20justify-content:\x20center;\x20align-items:\x20center;\x20height:\x20100%;\x20color:\x20#aaa;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<i\x20class=\x22fas\x20fa-spinner\x20fa-spin\x22></i>\x20正在加载图谱可视化引擎...\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22margin-top:\x2010px;\x20display:\x20flex;\x20justify-content:\x20space-between;\x20align-items:\x20center;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22font-size:\x200.9em;\x20color:\x20#888;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<i\x20class=\x22fas\x20fa-mouse\x22></i>\x20滚轮缩放\x20/\x20拖拽平移\x20/\x20点击节点查看详情\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22display:\x20flex;\x20gap:\x2010px;\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20id=\x22amily2-reorganize-graph-btn\x22\x20class=\x22menu_button\x20secondary\x20small_button\x22\x20title=\x22重新布局\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<i\x20class=\x22fas\x20fa-random\x22></i>\x20抖动布局\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20id=\x22amily2-refresh-graph-btn\x22\x20class=\x22menu_button\x20menu_button_primary\x20small_button\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<i\x20class=\x22fas\x20fa-sync\x22></i>\x20刷新数据\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20','#888','item','right','node','src','暂无信息','echarts','relation','map','target','#amily2-reorganize-graph-btn','adjacency','script','data','1214995uqZlmA','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22font-weight:bold;\x20border-bottom:1px\x20solid\x20#aaa;\x20padding-bottom:5px;\x20margin-bottom:5px;\x22>','{b}','770rpaUkK','#9e8aff','success','</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22font-size:0.9em;\x20margin-top:5px;\x20color:#ccc;\x22>','#aaa','metadata','source','info','1NELEri','value','rgba(255,255,255,0.4)','329nqnegA','6DCnNBn','1378824BLZDsj','click','<p\x20style=\x22color:red;\x20text-align:center;\x20padding-top:200px;\x22>图谱引擎加载失败,请检查网络连接。</p>','error','nodes','type','center','rgba(50,50,50,0.9)','#fff','</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','innerHTML','#eee','clear','<br/>关系:\x20','102501oYbZgT','name','appendChild','head','4994ygwJMn','图谱数据已刷新','force','transparent','observe','26088tolGAs','#777','请确保已启用“角色”相关表格,并且表格中有数据。','length','graph','edges','init','1014348CdItfG','createElement','setOption','html','#amily2-graph-container','...','暂无数据','197488SzZApH','quinticInOut','88594zTDHaR','substring','find'];_0x64af=function(){return _0x2f4505;};return _0x64af();}function renderChart(_0x4d3e12){const _0xaa383e=_0x7e35,_0x43f277=getGraph();if(!_0x43f277[_0xaa383e(0x191)]||_0x43f277[_0xaa383e(0x191)][_0xaa383e(0x1a7)]===0x0){_0x4d3e12[_0xaa383e(0x199)](),_0x4d3e12['setOption']({'title':{'text':_0xaa383e(0x1b1),'subtext':_0xaa383e(0x1a6),'left':'center','top':_0xaa383e(0x193),'textStyle':{'color':_0xaa383e(0x1b8)}}});return;}const _0x2a0110=_0x43f277[_0xaa383e(0x191)][_0xaa383e(0x1c0)](_0x154c08=>({'id':_0x154c08['id'],'name':_0x154c08['label'],'symbolSize':_0x154c08[_0xaa383e(0x192)]==='user'?0x28:0x19,'itemStyle':{'color':_0x154c08[_0xaa383e(0x192)]==='user'?_0xaa383e(0x1ca):'#4caf50','shadowBlur':0xa,'shadowColor':'rgba(0,0,0,0.3)'},'label':{'show':!![],'position':_0xaa383e(0x1ba),'color':_0xaa383e(0x198),'formatter':_0xaa383e(0x1c8)},'data':_0x154c08})),_0x15e9ae=_0x43f277[_0xaa383e(0x1a9)][_0xaa383e(0x1c0)](_0x51ecd7=>({'source':_0x51ecd7[_0xaa383e(0x1cf)],'target':_0x51ecd7[_0xaa383e(0x1c1)],'value':_0x51ecd7[_0xaa383e(0x1bf)],'label':{'show':!![],'formatter':'{c}','color':_0xaa383e(0x1cd),'fontSize':0xa},'lineStyle':{'curveness':0.2,'color':_0xaa383e(0x1d3)}})),_0x4e06af={'backgroundColor':_0xaa383e(0x1a2),'tooltip':{'trigger':_0xaa383e(0x1b9),'backgroundColor':_0xaa383e(0x194),'borderColor':_0xaa383e(0x1a5),'textStyle':{'color':_0xaa383e(0x195)},'formatter':function(_0x2d7702){const _0x16676d=_0xaa383e;if(_0x2d7702['dataType']===_0x16676d(0x1bb)){const _0x1e2119=_0x2d7702['data'][_0x16676d(0x1c5)][_0x16676d(0x1ce)]||{};let _0x4ca502=_0x1e2119[_0x16676d(0x1d0)]||_0x16676d(0x1bd);if(_0x4ca502[_0x16676d(0x1a7)]>0x64)_0x4ca502=_0x4ca502[_0x16676d(0x1b5)](0x0,0x64)+_0x16676d(0x1b0);return _0x16676d(0x1c7)+_0x2d7702[_0x16676d(0x19c)]+'</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20style=\x22font-size:0.9em;\x22>类型:\x20'+_0x2d7702[_0x16676d(0x1c5)]['data']['type']+_0x16676d(0x1cc)+_0x4ca502+_0x16676d(0x196);}else return _0x2d7702[_0x16676d(0x1c5)][_0x16676d(0x1cf)]+'\x20->\x20'+_0x2d7702[_0x16676d(0x1c5)][_0x16676d(0x1c1)]+_0x16676d(0x19a)+_0x2d7702[_0x16676d(0x1c5)][_0x16676d(0x1d2)];}},'legend':{'show':![]},'animationDurationUpdate':0x5dc,'animationEasingUpdate':_0xaa383e(0x1b3),'series':[{'type':_0xaa383e(0x1a8),'layout':_0xaa383e(0x1a1),'data':_0x2a0110,'links':_0x15e9ae,'roam':!![],'draggable':!![],'label':{'position':_0xaa383e(0x1ba),'formatter':_0xaa383e(0x1c8)},'lineStyle':{'color':_0xaa383e(0x1cf),'curveness':0.3},'force':{'repulsion':0x190,'edgeLength':0x78,'gravity':0.1},'emphasis':{'focus':_0xaa383e(0x1c3),'itemStyle':{'shadowBlur':0x14,'shadowColor':_0xaa383e(0x195)},'lineStyle':{'width':0x4,'color':_0xaa383e(0x195)}}}]};_0x4d3e12[_0xaa383e(0x1ad)](_0x4e06af);}
|