@aalis/plugin-webui-client 0.9.0 → 0.9.1

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 (61) hide show
  1. package/dist/assets/{AuthorityPage-DQhXicev.js → AuthorityPage-jj192bfx.js} +1 -1
  2. package/dist/assets/{DynamicPage-CQhgQLoH.js → DynamicPage-BCvX1Tg2.js} +1 -1
  3. package/dist/assets/{FilesPage-s95cpGq1.js → FilesPage-BMbRlFyJ.js} +1 -1
  4. package/dist/assets/{MarketplacePage-DZLd-TYD.js → MarketplacePage-ClOWoNMz.js} +1 -1
  5. package/dist/assets/{PlatformPage-C-Lne53a.js → PlatformPage-BKcwv7lV.js} +1 -1
  6. package/dist/assets/{PluginConfigPage-tzDj2CUH.js → PluginConfigPage-BEBeoZAt.js} +1 -1
  7. package/dist/assets/SessionsPage-D0IEwawu.js +1 -0
  8. package/dist/assets/{arc-E3SUYR-u.js → arc-DgCAVqQG.js} +1 -1
  9. package/dist/assets/{architectureDiagram-3BPJPVTR-BPwBftao.js → architectureDiagram-3BPJPVTR-DUOdsOu6.js} +1 -1
  10. package/dist/assets/{blockDiagram-GPEHLZMM-CRzegDyu.js → blockDiagram-GPEHLZMM-CPiBvpQw.js} +1 -1
  11. package/dist/assets/{c4Diagram-AAUBKEIU-BfBT-clC.js → c4Diagram-AAUBKEIU-AGYD57MB.js} +1 -1
  12. package/dist/assets/channel-Bq_prj9O.js +1 -0
  13. package/dist/assets/{chunk-2J33WTMH-Cn4BhfAn.js → chunk-2J33WTMH-BBTl70Nc.js} +1 -1
  14. package/dist/assets/{chunk-4BX2VUAB-D9IUQXae.js → chunk-4BX2VUAB-v3JqMQa_.js} +1 -1
  15. package/dist/assets/{chunk-55IACEB6-pA_HewlL.js → chunk-55IACEB6-WyRWVyR6.js} +1 -1
  16. package/dist/assets/{chunk-727SXJPM-BxCusUen.js → chunk-727SXJPM-DF4uMHuP.js} +1 -1
  17. package/dist/assets/{chunk-AQP2D5EJ-B3YrTn0k.js → chunk-AQP2D5EJ-D7DNAmXA.js} +1 -1
  18. package/dist/assets/{chunk-FMBD7UC4-D2XDl42C.js → chunk-FMBD7UC4-X7y55wG9.js} +1 -1
  19. package/dist/assets/{chunk-ND2GUHAM-1BRTAJ05.js → chunk-ND2GUHAM-CNQXwR6Z.js} +1 -1
  20. package/dist/assets/{chunk-QZHKN3VN-DAE8DFJS.js → chunk-QZHKN3VN-Dsy2pHYy.js} +1 -1
  21. package/dist/assets/classDiagram-4FO5ZUOK-CP72yHy9.js +1 -0
  22. package/dist/assets/classDiagram-v2-Q7XG4LA2-CP72yHy9.js +1 -0
  23. package/dist/assets/{clock-DdSAVx11.js → clock-CexFGsrk.js} +1 -1
  24. package/dist/assets/{cose-bilkent-S5V4N54A-BhPl_8tA.js → cose-bilkent-S5V4N54A-CS9csD8f.js} +1 -1
  25. package/dist/assets/{dagre-BM42HDAG-CvtyZpDy.js → dagre-BM42HDAG-nXs84lFQ.js} +1 -1
  26. package/dist/assets/{diagram-2AECGRRQ-D2naUCFg.js → diagram-2AECGRRQ-Bf4JvWP3.js} +1 -1
  27. package/dist/assets/{diagram-5GNKFQAL-BiiNWy69.js → diagram-5GNKFQAL-BQxWQN2V.js} +1 -1
  28. package/dist/assets/{diagram-KO2AKTUF-DtrZr4zo.js → diagram-KO2AKTUF-ZoXRYwP-.js} +1 -1
  29. package/dist/assets/{diagram-LMA3HP47-DQdFCa_G.js → diagram-LMA3HP47-D2nzytQD.js} +1 -1
  30. package/dist/assets/{diagram-OG6HWLK6-DbeYvkds.js → diagram-OG6HWLK6-CgJOhe8X.js} +1 -1
  31. package/dist/assets/{erDiagram-TEJ5UH35-BXPkD3q1.js → erDiagram-TEJ5UH35-C0D4Nnw0.js} +1 -1
  32. package/dist/assets/{flowDiagram-I6XJVG4X-BzRYhT6I.js → flowDiagram-I6XJVG4X-C7ut3eEd.js} +1 -1
  33. package/dist/assets/{ganttDiagram-6RSMTGT7-CpB3LyFf.js → ganttDiagram-6RSMTGT7-BPEjzmiT.js} +1 -1
  34. package/dist/assets/{gitGraphDiagram-PVQCEYII-C-CCJXPo.js → gitGraphDiagram-PVQCEYII-DDbVQ4yz.js} +1 -1
  35. package/dist/assets/{globe-BVVhHqPk.js → globe-CBbp1Q3e.js} +1 -1
  36. package/dist/assets/{index-AyT_VNlb.js → index-BWwjYl1J.js} +3 -3
  37. package/dist/assets/{infoDiagram-5YYISTIA-BHAeniIX.js → infoDiagram-5YYISTIA-DX6o6Sjl.js} +1 -1
  38. package/dist/assets/{ishikawaDiagram-YF4QCWOH-cz97n_-J.js → ishikawaDiagram-YF4QCWOH-CR6ZrpjX.js} +1 -1
  39. package/dist/assets/{journeyDiagram-JHISSGLW-CaRFhQBN.js → journeyDiagram-JHISSGLW-BdXEYMYU.js} +1 -1
  40. package/dist/assets/{kanban-definition-UN3LZRKU-DQwyZscH.js → kanban-definition-UN3LZRKU-CeqFrbgR.js} +1 -1
  41. package/dist/assets/{linear-CiOR35Zp.js → linear-B8t65nmv.js} +1 -1
  42. package/dist/assets/{mermaid.core-1wU6KgsD.js → mermaid.core-DVy3DGpO.js} +4 -4
  43. package/dist/assets/{mindmap-definition-RKZ34NQL-DLceYK9b.js → mindmap-definition-RKZ34NQL-Bdabu17v.js} +1 -1
  44. package/dist/assets/{pieDiagram-4H26LBE5-CELFoEOt.js → pieDiagram-4H26LBE5-DPex3q00.js} +1 -1
  45. package/dist/assets/{quadrantDiagram-W4KKPZXB-DbGB-vqa.js → quadrantDiagram-W4KKPZXB-CR_GIvz-.js} +1 -1
  46. package/dist/assets/{requirementDiagram-4Y6WPE33-C7gHSEcg.js → requirementDiagram-4Y6WPE33-sFRdxxH-.js} +1 -1
  47. package/dist/assets/{sankeyDiagram-5OEKKPKP-BaIxfF14.js → sankeyDiagram-5OEKKPKP-OJ_uPF8c.js} +1 -1
  48. package/dist/assets/{sequenceDiagram-3UESZ5HK-B1yQQ6rC.js → sequenceDiagram-3UESZ5HK-erRyzaXX.js} +1 -1
  49. package/dist/assets/{stateDiagram-AJRCARHV-6qcnWQyf.js → stateDiagram-AJRCARHV-KRb4NAf8.js} +1 -1
  50. package/dist/assets/{stateDiagram-v2-BHNVJYJU-B1isekxA.js → stateDiagram-v2-BHNVJYJU-D6wFUac9.js} +1 -1
  51. package/dist/assets/{timeline-definition-PNZ67QCA-OvvI4eXF.js → timeline-definition-PNZ67QCA-Dy8PzD_z.js} +1 -1
  52. package/dist/assets/{vennDiagram-CIIHVFJN-VwnwcIqq.js → vennDiagram-CIIHVFJN-C3R-BuRH.js} +1 -1
  53. package/dist/assets/{wardley-L42UT6IY-B4LTGH2u.js → wardley-L42UT6IY-BfNNTOAt.js} +1 -1
  54. package/dist/assets/{wardleyDiagram-YWT4CUSO-C6z95am7.js → wardleyDiagram-YWT4CUSO-CgkF-vOW.js} +1 -1
  55. package/dist/assets/{xychartDiagram-2RQKCTM6-TXMj3rJL.js → xychartDiagram-2RQKCTM6-ZFy5dgDQ.js} +1 -1
  56. package/dist/index.html +1 -1
  57. package/package.json +1 -1
  58. package/dist/assets/SessionsPage-CM1jOqTy.js +0 -1
  59. package/dist/assets/channel-Djl_V3Hi.js +0 -1
  60. package/dist/assets/classDiagram-4FO5ZUOK-DZkp8t-T.js +0 -1
  61. package/dist/assets/classDiagram-v2-Q7XG4LA2-DZkp8t-T.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-1wU6KgsD.js","assets/react-vendor-BPQixOLZ.js","assets/PluginConfigPage-tzDj2CUH.js","assets/SchemaForm-YVQZ6Keg.js","assets/ConfirmDialog-DbV-E1Nd.js","assets/highlight-DJvvuuwd.js","assets/highlight-BPWJwfct.css","assets/katex-Bq6vt64r.js","assets/katex-CIHdCL6t.css","assets/markdown-BCywGHw2.js","assets/MarketplacePage-DZLd-TYD.js","assets/clock-DdSAVx11.js","assets/PlatformPage-C-Lne53a.js","assets/globe-BVVhHqPk.js","assets/AuthorityPage-DQhXicev.js","assets/LogPage-C_Z3RA5T.js","assets/SessionsPage-CM1jOqTy.js","assets/FilesPage-s95cpGq1.js","assets/DynamicPage-CQhgQLoH.js","assets/cytoscape.esm-LDYqcvCF.js","assets/cytoscape-fcose-DXAQNCkb.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DVy3DGpO.js","assets/react-vendor-BPQixOLZ.js","assets/PluginConfigPage-BEBeoZAt.js","assets/SchemaForm-YVQZ6Keg.js","assets/ConfirmDialog-DbV-E1Nd.js","assets/highlight-DJvvuuwd.js","assets/highlight-BPWJwfct.css","assets/katex-Bq6vt64r.js","assets/katex-CIHdCL6t.css","assets/markdown-BCywGHw2.js","assets/MarketplacePage-ClOWoNMz.js","assets/clock-CexFGsrk.js","assets/PlatformPage-BKcwv7lV.js","assets/globe-CBbp1Q3e.js","assets/AuthorityPage-jj192bfx.js","assets/LogPage-C_Z3RA5T.js","assets/SessionsPage-D0IEwawu.js","assets/FilesPage-BMbRlFyJ.js","assets/DynamicPage-BCvX1Tg2.js","assets/cytoscape.esm-LDYqcvCF.js","assets/cytoscape-fcose-DXAQNCkb.js"])))=>i.map(i=>d[i]);
2
2
  import{j as e,r as a,c as Hs}from"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import{r as Vs,b as Js,a as Gs,c as Ks,M as _e}from"./markdown-BCywGHw2.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const d of i)if(d.type==="childList")for(const u of d.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(i){const d={};return i.integrity&&(d.integrity=i.integrity),i.referrerPolicy&&(d.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?d.credentials="include":i.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function r(i){if(i.ep)return;i.ep=!0;const d=n(i);fetch(i.href,d)}})();const Us="modulepreload",Ys=function(t){return"/"+t},as={},he=function(s,n,r){let i=Promise.resolve();if(n&&n.length>0){let u=function(l){return Promise.all(l.map(p=>Promise.resolve(p).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),m=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));i=u(n.map(l=>{if(l=Ys(l),l in as)return;as[l]=!0;const p=l.endsWith(".css"),x=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${x}`))return;const g=document.createElement("link");if(g.rel=p?"stylesheet":Us,p||(g.as="script"),g.crossOrigin="",g.href=l,m&&g.setAttribute("nonce",m),document.head.appendChild(g),p)return new Promise((k,c)=>{g.addEventListener("load",k),g.addEventListener("error",()=>c(new Error(`Unable to preload CSS for ${l}`)))})}))}function d(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return i.then(u=>{for(const h of u||[])h.status==="rejected"&&d(h.reason);return s().catch(d)})},fs="aalis:activeSessionId";function Xs(){try{return window.localStorage.getItem(fs)||"__new_chat__"}catch{return"__new_chat__"}}let Ye=Xs();const Xe=new Set;function oe(){return Ye}function He(t){if(Ye!==t){Ye=t;try{window.localStorage.setItem(fs,t)}catch{}for(const s of Xe)s(t)}}function Zs(t){return Xe.add(t),()=>Xe.delete(t)}function ps(t){return t!==401?!1:(window.location.replace("/"),!0)}async function te(t,s){const n=await fetch(t,{headers:{"Content-Type":"application/json"},...s});if(ps(n.status))throw new Error("会话已失效,正在跳转登录");return n.json()}async function de(t,s,n={}){const r=await fetch(`/api/page-action/${encodeURIComponent(t)}/${encodeURIComponent(s)}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(ps(r.status))throw new Error("会话已失效,正在跳转登录");const i=await r.json();if(!r.ok)throw new Error(i.error||"请求失败");return i.data}function je(t){return t?t.startsWith("http://")||t.startsWith("https://")?`/api/proxy/image?url=${encodeURIComponent(t)}`:t:""}function Qs(){return e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]})}function et(){return e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"9",cy:"21",r:"1"}),e.jsx("circle",{cx:"20",cy:"21",r:"1"}),e.jsx("path",{d:"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"})]})}function st(){return e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function tt(){return e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14,2 14,8 20,8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),e.jsx("line",{x1:"10",y1:"9",x2:"8",y2:"9"})]})}function nt(){return e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",ry:"2"}),e.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),e.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"21"})]})}function at(){return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})})}function rt(){return e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})})}function ot(t){const s=a.useRef(t);s.current=t;const n=a.useRef(null),[r,i]=a.useState(!1),d=a.useRef(oe());a.useEffect(()=>{let m,l,p=!1;function x(){if(p)return;const g=location.protocol==="https:"?"wss:":"ws:";m=new WebSocket(`${g}//${location.host}/ws`),n.current=m,m.onopen=()=>{p||(i(!0),m.send(JSON.stringify({type:"subscribe_logs"})),m.send(JSON.stringify({type:"subscribe_session",sessionId:oe()})),d.current=oe())},m.onclose=()=>{p||(i(!1),l=setTimeout(x,3e3))},m.onmessage=k=>{var c,L,E,C,S,G,v,q,F,Y,Z,b,D;try{const f=JSON.parse(k.data),y=s.current;f.type==="stream"?(y.onStream(f.contentDelta,f.reasoningDelta,f.done,f.toolLimitReached),f.toolCallProgress&&((c=y.onToolCallProgress)==null||c.call(y,f.toolCallProgress)),f.done&&((L=y.onToolCallProgressClear)==null||L.call(y))):f.type==="message"&&(f.content||(E=f.attachments)!=null&&E.length)?y.onMessage(f.content??"",f.reasoningContent,f.segments,f.attachments,f.modelInfo):f.type==="tool_call"&&f.toolName?y.onToolCall(f.toolName,f.toolArgs??{},f.toolPhase,f.toolResult):f.type==="log"&&f.log?y.onLog(f.log):f.type==="state_changed"?(C=y.onStateChanged)==null||C.call(y):f.type==="restarting"?(S=y.onRestarting)==null||S.call(y):f.type==="reload"?(G=y.onReload)==null||G.call(y):f.type==="sessions_changed"?(v=y.onSessionsChanged)==null||v.call(y):f.type==="todo_updated"&&f.todoItems?(q=y.onTodoUpdated)==null||q.call(y,f.todoItems):f.type==="stream_resume"?(F=y.onStreamResume)==null||F.call(y,f.content??"",f.reasoningContent??"",f.segments??[],!!f.done,f.toolCallsProgress):f.type==="confirm"&&f.content?(Y=y.onConfirm)==null||Y.call(y,f.content):f.type==="token_usage"&&f.tokenUsage?(Z=y.onTokenUsage)==null||Z.call(y,f.tokenUsage):f.type==="compressing"&&f.sessionId?(b=y.onCompressing)==null||b.call(y,f.sessionId,f.content??"start"):f.type==="history_changed"&&f.sessionId?(D=y.onHistoryChanged)==null||D.call(y,f.sessionId):f.type==="page_refresh"&&window.dispatchEvent(new CustomEvent("aalis:page-refresh",{detail:{pluginName:f.pluginName}}))}catch{}}}return x(),()=>{p=!0,clearTimeout(l),m==null||m.close()}},[]),a.useEffect(()=>Zs(l=>{const p=n.current;(p==null?void 0:p.readyState)===WebSocket.OPEN&&(p.send(JSON.stringify({type:"unsubscribe_session",sessionId:d.current})),p.send(JSON.stringify({type:"subscribe_session",sessionId:l})),d.current=l)}),[]);const u=a.useCallback((m,l)=>{var p;if(((p=n.current)==null?void 0:p.readyState)===WebSocket.OPEN){const x={type:"message",content:m,sessionId:oe()};l&&l.length>0&&(x.attachments=l),n.current.send(JSON.stringify(x))}},[]),h=a.useCallback(m=>{var l;((l=n.current)==null?void 0:l.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(m))},[]);return{send:u,sendRaw:h,connected:r}}function it(){const t=new Date,s=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0"),r=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0");return`会话 ${s}-${n} ${r}:${i}`}function lt(t){const s=[];let n=t.replace(/\n?\[文件: ([^\n(]+?)\s*\(ID:[^)]+\)\]\n--- 文件内容 ---[\s\S]*?--- 文件内容结束 ---/g,(r,i)=>(s.push(i.trim()),""));return n=n.replace(/\n?\[文件: ([^\n(]+?)\s*\(ID:[^,\n)]+[,\n][\s\S]*?\)\]/g,(r,i)=>(s.push(i.trim()),"")),n=n.replace(/\n?\[文件: ([^\]-]+?) - [^\]]+\]/g,(r,i)=>(s.push(i.trim()),"")),n=n.replace(/\n?\[文件: ([^\]]+?)\s*(?:\(ID:[^)]+\))?\]/g,(r,i)=>(s.push(i.trim()),"")),{displayContent:n.trim(),fileNames:s}}function ct(t){var r,i,d,u;const s=[];let n=0;for(;n<t.length;){const h=t[n];if(h.role==="user"){const m=h.content??"",l=Array.isArray((r=h.metadata)==null?void 0:r.fileNames)?h.metadata.fileNames:null,{displayContent:p,fileNames:x}=lt(m),g=(l??x).filter(Boolean);s.push({role:"user",content:p,fileNames:g.length>0?g:void 0,timestamp:h.timestamp??0}),n++;continue}if(h.role==="system"){h.kind==="event-marker"&&s.push({role:"system",content:h.content??"",timestamp:h.timestamp??0}),n++;continue}if(h.role==="notice"){s.push({role:"system",content:h.content??"",timestamp:h.timestamp??0}),n++;continue}if(h.role==="assistant"){const m=[],l=[];let p=h.timestamp??0,x="",g=!1,k;for(;n<t.length&&(t[n].role==="assistant"||t[n].role==="tool");){const C=t[n];if(C.role==="assistant"){const S=(i=C.metadata)==null?void 0:i.modelInfo;S&&(k=S)}if(C.role==="assistant"&&C.segments&&C.segments.length>0){g=!0,m.length=0,l.length=0;for(const S of C.segments)m.push(S);p=C.timestamp??p,n++;continue}if(C.role==="assistant"&&C.toolCalls&&C.toolCalls.length>0){C.reasoningContent&&l.push({type:"reasoning_text",content:C.reasoningContent}),C.content&&m.push({type:"text",content:C.content});for(const S of C.toolCalls){let G={};try{G=JSON.parse(S.function.arguments)}catch{}m.push({type:"tool_call",name:S.function.name,args:G})}p=C.timestamp??p,n++}else if(C.role==="tool"&&C.toolCallId){for(let S=m.length-1;S>=0;S--){const G=m[S];if(G.type==="tool_call"&&G.result===void 0){G.result=C.content??"";break}}n++}else if(C.role==="assistant"){if(n===t.length-1||((d=t[n+1])==null?void 0:d.role)==="user"||((u=t[n+1])==null?void 0:u.role)==="system"){C.reasoningContent&&l.push({type:"reasoning_text",content:C.reasoningContent}),x=C.content??"",p=C.timestamp??p,n++;break}C.reasoningContent&&l.push({type:"reasoning_text",content:C.reasoningContent}),C.content&&m.push({type:"text",content:C.content}),p=C.timestamp??p,n++}else break}let c;g?c=m:(c=[...l,...m],x&&c.push({type:"text",content:x}));let L="",E="";for(const C of c)C.type==="reasoning_text"?L+=C.content:C.type==="text"&&(E+=C.content);s.push({role:"assistant",content:E||x||h.content||"",segments:c.length>0?c:void 0,reasoningContent:L||void 0,timestamp:p,modelInfo:k});continue}n++}return s}function dt(t){const[s,n]=a.useState([]),[r,i]=a.useState(oe()),[d,u]=a.useState([]),[h,m]=a.useState(!1),l=a.useRef(!1),p=a.useRef(new Map),x=a.useMemo(()=>{const b=t.find(D=>D.key==="sessions");return(b==null?void 0:b.plugin)??null},[t]),g=a.useRef(x);g.current=x;const k=a.useRef(r);k.current=r;const c=a.useRef(d);c.current=d;const L=a.useRef(s);L.current=s;const E=a.useMemo(()=>x?s.length===0||!s.some(b=>b.id===r):!1,[x,s,r]),C=a.useMemo(()=>{const b=s.find(D=>D.id===r);return(b==null?void 0:b.title)||(b==null?void 0:b.displayTitle)||(b==null?void 0:b.name)||""},[s,r]),S=a.useCallback(()=>{const b=g.current;b&&de(b,"listSessions").then(D=>{Array.isArray(D)&&n(D)}).catch(()=>{})},[]),G=a.useCallback(()=>{c.current.length>0&&p.current.set(k.current,c.current);const b="__new_chat__";i(b),He(b),u([]),m(!1),l.current=!1},[]),v=a.useCallback(async b=>{const D=g.current;if(!D)return null;const f=it();try{const y=await de(D,"createSession",{name:f,...b?{parentId:b}:{}});if(!(y!=null&&y.id))return null;const V=y.id;return n(J=>{if(J.some(_=>_.id===V))return J;const ae={id:V,name:y.name||f,title:y.title,displayTitle:y.title||y.name||f,status:"active",children:[],childCount:0,parentId:b,createdAt:Date.now()};return[...J,ae]}),b&&n(J=>J.map(ae=>ae.id===b?{...ae,children:[...ae.children,V],childCount:ae.childCount+1}:ae)),c.current.length>0&&p.current.set(k.current,c.current),i(V),He(V),u([]),m(!1),l.current=!1,de(D,"listSessions").then(J=>{Array.isArray(J)&&n(J)}).catch(()=>{}),V}catch{return null}},[]),q=a.useCallback(async()=>!g.current||L.current.some(f=>f.id===k.current)?k.current:await v()||k.current,[v]),F=a.useCallback((b,D)=>{de(D,"getSessionDetail",{id:b}).then(f=>{if(f!=null&&f.messages&&k.current===b){const y=ct(f.messages);if(l.current){for(;y.length>0&&y[y.length-1].role==="assistant";)y.pop();const V=c.current,J=V[V.length-1];J&&J.role==="assistant"&&y.push(J)}u(y),p.current.set(b,y)}}).catch(()=>{})},[]),Y=a.useCallback(b=>{const D=b===k.current;if(D&&c.current.length>0)return;!D&&c.current.length>0&&p.current.set(k.current,c.current),i(b),He(b),m(!1),l.current=!1;const f=g.current,y=p.current.get(b);u(y??[]),!y&&f&&F(b,f),S()},[F,S]),Z=a.useCallback(b=>{if(b!==k.current)return;const D=g.current;D&&(p.current.delete(b),F(b,D))},[F]);return a.useEffect(()=>{x&&de(x,"listSessions").then(b=>{if(!Array.isArray(b))return;n(b);const D=oe();D&&D!=="__new_chat__"&&b.some(f=>f.id===D)&&(i(D),F(D,x))}).catch(()=>{})},[x,F]),{pluginName:x,sessionList:s,activeSessionId:r,activeSessionTitle:C,isNewChat:E,messages:d,setMessages:u,refresh:S,startNewChat:G,createSession:v,ensureSession:q,switchSession:Y,handleHistoryChanged:Z,loading:h,setLoading:m,streamingRef:l}}/**
3
3
  * @license lucide-react v1.7.0 - ISC
4
4
  *
@@ -175,7 +175,7 @@ $$
175
175
  ${h}
176
176
  $$
177
177
 
178
- `}))),n)).join("")}function nn(t){if(!t||!Number.isFinite(t))return"";const s=new Date(t);if(Number.isNaN(s.getTime()))return"";const n=new Date,r=m=>m.toString().padStart(2,"0"),i=`${r(s.getHours())}:${r(s.getMinutes())}`,d=s.getFullYear()===n.getFullYear();if(d&&s.getMonth()===n.getMonth()&&s.getDate()===n.getDate())return i;const h=`${s.getMonth()+1}-${s.getDate()} ${i}`;return d?h:`${s.getFullYear()}-${h}`}let Ke=null;function an(){return Ke||(Ke=he(()=>import("./mermaid.core-1wU6KgsD.js").then(t=>t.bm),__vite__mapDeps([0,1])).then(t=>{var r;const s=t.default,n=typeof window<"u"&&((r=window.matchMedia)==null?void 0:r.call(window,"(prefers-color-scheme: dark)").matches);return s.initialize({startOnLoad:!1,theme:n?"dark":"default",securityLevel:"strict",fontFamily:"inherit"}),s})),Ke}function cs(t){if(!(typeof document>"u"))for(const s of[`#${t}`,`#d${t}`,`#${t}-temp`])document.querySelectorAll(s).forEach(n=>n.remove())}let rn=0;function on({chart:t}){const[s,n]=a.useState(null),[r,i]=a.useState(null),d=a.useRef(`mermaid-${++rn}`);return a.useEffect(()=>{let u=!1;const h=d.current,m=t.trim();if(!m){n(null),i(null);return}return an().then(async l=>(await l.parse(m),l.render(h,m))).then(({svg:l})=>{u||(n(l),i(null))}).catch(l=>{if(cs(h),u)return;const p=l instanceof Error?l.message:String(l);i(p),n(null)}),()=>{u=!0,cs(h)}},[t]),r?e.jsxs("div",{className:"mermaid-block mermaid-block-error",children:[e.jsxs("div",{className:"mermaid-error-banner",children:["⚠ Mermaid 渲染失败:",r]}),e.jsx("pre",{children:e.jsx("code",{className:"language-mermaid",children:t})})]}):s?e.jsx("div",{className:"mermaid-block",dangerouslySetInnerHTML:{__html:s}}):e.jsx("pre",{className:"mermaid-block mermaid-block-loading",children:e.jsx("code",{className:"language-mermaid",children:t})})}const ln=a.memo(on),Ie=[Gs,Ks],cn={strict:"ignore",throwOnError:!1,errorColor:"inherit",output:"htmlAndMathml"},Me=[Vs,[Js,cn]];function dn({className:t,children:s,...n}){const r=/language-(\w+)/.exec(t??"");if((r==null?void 0:r[1])==="mermaid"){const d=Array.isArray(s)?s.join(""):String(s??"");return e.jsx(ln,{chart:d.replace(/\n$/,"")})}return e.jsx("code",{className:t,...n,children:s})}const Te={code:dn};function un(t){if(t===0)return"—";const s=["B","KB","MB","GB"];let n=0,r=t;for(;r>=1024&&n<s.length-1;)r/=1024,n++;return`${r.toFixed(n===0?0:1)} ${s[n]}`}function hn(t){return new Date(t).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function mn({open:t,onClose:s,sessionId:n}){const[r,i]=a.useState([]),[d,u]=a.useState(!1),[h,m]=a.useState(null),[l,p]=a.useState(null),x=a.useCallback(async()=>{if(!n||n==="__new_chat__"){i([]);return}u(!0),m(null);try{const c=await te(`/api/uploaded-files?sessionId=${encodeURIComponent(n)}`);if(c.error)throw new Error(c.error);i(c.files||[])}catch(c){m(c instanceof Error?c.message:String(c)),i([])}finally{u(!1)}},[n]);a.useEffect(()=>{t&&x()},[t,x]);const g=a.useCallback(async c=>{if(window.confirm(`确定删除文件 "${c.name}"?删除后无法恢复。`)){p(c.id);try{const E=await fetch("/api/uploaded-files/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:c.sessionId,fileId:c.id})}),C=await E.json();if(!E.ok||C.error)throw new Error(C.error||`HTTP ${E.status}`);await x()}catch(E){window.alert(`删除失败:${E instanceof Error?E.message:String(E)}`)}finally{p(null)}}},[x]),k=a.useCallback(c=>{const L=`/api/uploaded-files/download?sessionId=${encodeURIComponent(c.sessionId)}&fileId=${encodeURIComponent(c.id)}`;window.open(L,"_blank")},[]);return t?e.jsxs("div",{className:"uploaded-files-drawer",children:[e.jsxs("div",{className:"uploaded-files-drawer-header",children:[e.jsx("span",{className:"uploaded-files-drawer-title",children:"已上传的文件"}),e.jsxs("div",{className:"uploaded-files-drawer-actions",children:[e.jsx("button",{type:"button",className:"uploaded-files-drawer-btn",onClick:x,title:"刷新",disabled:d,children:e.jsx(qt,{size:14,className:d?"spin":""})}),e.jsx("button",{type:"button",className:"uploaded-files-drawer-btn",onClick:s,title:"关闭",children:e.jsx(Ns,{size:14})})]})]}),e.jsxs("div",{className:"uploaded-files-drawer-body",children:[h&&e.jsxs("div",{className:"uploaded-files-drawer-error",children:["加载失败:",h]}),!h&&r.length===0&&!d&&e.jsx("div",{className:"uploaded-files-drawer-empty",children:"当前会话没有已上传的文件"}),r.map(c=>e.jsxs("div",{className:"uploaded-files-drawer-item",children:[e.jsx(Et,{size:16,className:"uploaded-files-drawer-icon"}),e.jsxs("div",{className:"uploaded-files-drawer-info",children:[e.jsx("div",{className:"uploaded-files-drawer-name",title:c.name,children:c.name}),e.jsxs("div",{className:"uploaded-files-drawer-meta",children:[un(c.size)," · ",c.mimeType," · ",hn(c.uploadedAt)]}),e.jsxs("div",{className:"uploaded-files-drawer-id",title:c.id,children:["ID: ",c.id]})]}),e.jsx("button",{type:"button",className:"uploaded-files-drawer-btn",onClick:()=>k(c),title:"下载",children:e.jsx(It,{size:14})}),e.jsx("button",{type:"button",className:"uploaded-files-drawer-btn danger",onClick:()=>g(c),disabled:l===c.id,title:"删除",children:e.jsx(Kt,{size:14})})]},c.id))]})]}):null}function ds(t){return new Promise((s,n)=>{const r=new FileReader;r.onload=()=>s(r.result),r.onerror=n,r.readAsDataURL(t)})}const fn=a.memo(a.forwardRef(function({loading:s,connected:n,canUpload:r,canUploadImage:i,canUploadFile:d,acceptAttr:u,onSend:h,onAbort:m},l){const[p,x]=a.useState(""),[g,k]=a.useState([]),[c,L]=a.useState([]),E=a.useRef([]),C=a.useRef(null),S=a.useRef(null),G=a.useCallback(()=>{const _=C.current;_&&(_.style.height="auto",_.style.height=`${_.scrollHeight}px`)},[]),v=a.useCallback(async _=>{const T=[],A=[],z=[];for(const U of Array.from(_))if(U.type.startsWith("image/")&&i){if(U.size>10*1024*1024)continue;const Q=await ds(U);T.push(Q),z.push("image")}else if(d){if(U.size>20*1024*1024)continue;const Q=await ds(U);A.push({name:U.name,data:Q,mimeType:U.type||void 0}),z.push("file")}T.length>0&&k(U=>[...U,...T]),A.length>0&&L(U=>[...U,...A]),z.length>0&&(E.current=[...E.current,...z])},[i,d]);a.useImperativeHandle(l,()=>({addFiles:v}),[v]);const q=a.useCallback(async()=>{await h(p,c,g,E.current),x(""),k([]),L([]),E.current=[],C.current&&(C.current.style.height="auto")},[p,c,g,h]),F=_=>{_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),q())},Y=async _=>{_.target.files&&await v(_.target.files),_.target.value=""},Z=async _=>{var z;if(!i)return;const T=(z=_.clipboardData)==null?void 0:z.items;if(!T)return;const A=[];for(const U of Array.from(T)){if(!U.type.startsWith("image/"))continue;const Q=U.getAsFile();Q&&A.push(Q)}A.length>0&&await v(A)},b=_=>{k(z=>z.filter((U,Q)=>Q!==_));const T=[...E.current];let A=0;for(let z=0;z<T.length;z++)if(T[z]==="image"){if(A===_){T.splice(z,1);break}A++}E.current=T},D=_=>{L(z=>z.filter((U,Q)=>Q!==_));const T=[...E.current];let A=0;for(let z=0;z<T.length;z++)if(T[z]==="file"){if(A===_){T.splice(z,1);break}A++}E.current=T},f=E.current,y=new Array(g.length),V=new Array(c.length);{let _=0,T=0;for(let A=0;A<f.length;A++)f[A]==="image"?(_<y.length&&(y[_]=A+1),_++):f[A]==="file"&&(T<V.length&&(V[T]=A+1),T++)}const J=!!(p.trim()||g.length>0||c.length>0),ae=s&&!J;return e.jsxs(e.Fragment,{children:[g.length>0&&e.jsx("div",{className:"pending-images",children:g.map((_,T)=>e.jsxs("div",{className:"pending-image-item",children:[e.jsx("img",{src:_,alt:`pending-${T}`}),e.jsx("button",{className:"pending-image-remove",onClick:()=>b(T),children:"×"}),y[T]>0&&e.jsxs("span",{className:"pending-order-badge",children:["#",y[T]]})]},T))}),c.length>0&&e.jsx("div",{className:"pending-files",children:c.map((_,T)=>e.jsxs("div",{className:"pending-file-item",children:[V[T]>0&&e.jsxs("span",{className:"pending-file-order",children:["#",V[T]]}),e.jsx("span",{className:"pending-file-icon",children:e.jsx(Ze,{size:14})}),e.jsx("span",{className:"pending-file-name",children:_.name}),e.jsx("button",{className:"pending-file-remove",onClick:()=>D(T),children:"×"})]},T))}),e.jsxs("div",{className:"input-area",children:[e.jsx("input",{ref:S,type:"file",accept:u,multiple:!0,style:{display:"none"},onChange:Y}),r&&e.jsx("button",{className:"upload-btn",onClick:()=>{var _;return(_=S.current)==null?void 0:_.click()},disabled:!n,title:i&&d?"上传图片或文件":i?"上传图片":"上传文件",children:e.jsx(ws,{size:18})}),e.jsx("textarea",{ref:C,value:p,onChange:_=>{x(_.target.value),G()},onKeyDown:F,onPaste:Z,placeholder:"输入消息... (Enter 发送, Shift+Enter 换行)",disabled:!n,rows:1}),ae?e.jsx("button",{className:"send-btn stop-mode",onClick:m,title:"停止生成",children:e.jsx(Jt,{size:16})}):e.jsx("button",{className:"send-btn",onClick:()=>{q()},disabled:!n||!J,children:"↑"})]})]})}));function pn({startTime:t,endTime:s}){const[n,r]=a.useState(Date.now());if(a.useEffect(()=>{if(s||!t)return;const d=setInterval(()=>r(Date.now()),100);return()=>clearInterval(d)},[t,s]),!t)return null;const i=((s||n)-t)/1e3;return e.jsxs("span",{className:"tool-call-timer",children:[i.toFixed(1),"s"]})}function us({startTime:t,endTime:s}){const[n,r]=a.useState(Date.now());a.useEffect(()=>{if(s)return;let d;const u=()=>{r(Date.now()),d=requestAnimationFrame(u)};return d=requestAnimationFrame(u),()=>cancelAnimationFrame(d)},[s]);const i=((s||n)-t)/1e3;return e.jsxs("span",{className:"compress-timer",children:[i.toFixed(1),"s"]})}function xn({seg:t,index:s}){return e.jsxs("details",{className:"tool-call-block",children:[e.jsxs("summary",{className:"tool-call-summary",children:[e.jsx(ss,{size:14})," ",t.name,t.result==null?" …":"",e.jsx(pn,{startTime:t.startTime,endTime:t.endTime})]}),e.jsxs("div",{className:"tool-call-content",children:[e.jsxs("div",{className:"tool-call-args",children:[e.jsx("strong",{children:"参数"}),e.jsx("pre",{children:JSON.stringify(t.args,null,2)})]}),t.result!=null&&e.jsxs("div",{className:"tool-call-result",children:[e.jsx("strong",{children:"结果"}),e.jsx("pre",{children:t.result})]})]})]},s)}const gn=[".txt",".md",".csv",".json",".xml",".html",".htm",".css",".js",".ts",".yaml",".yml",".ini",".cfg",".conf",".log",".sh",".py",".java",".c",".cpp",".h",".rs",".go",".rb",".php",".sql",".pdf",".docx"],jn=gn.join(",")+",text/*,application/pdf,application/vnd.openxmlformats-officedocument.wordprocessingml.document";function vn(t){const s=t.trim();if(!s.startsWith("{"))return null;try{const n=JSON.parse(s);return typeof n!="object"||n===null||Array.isArray(n)?null:n}catch{return null}}function yn(t){const s=t.trim();if(!s.startsWith("{"))return null;const n=[];let r=1;const i=()=>{for(;r<s.length&&/[\s,]/.test(s[r]);)r++};for(;r<s.length&&(i(),!(r>=s.length||s[r]==="}"||s[r]!=='"'));){r++;let d="",u=!1;for(;r<s.length;)if(s[r]==="\\"&&r+1<s.length)d+=s[r+1],r+=2;else if(s[r]==='"'){u=!0,r++;break}else d+=s[r],r++;if(!u){n.push({key:d,keyDone:!1,value:"",valueDone:!1,valueType:"unknown"});break}if(i(),r>=s.length||s[r]!==":"){n.push({key:d,keyDone:!0,value:"",valueDone:!1,valueType:"unknown"});break}if(r++,i(),r>=s.length){n.push({key:d,keyDone:!0,value:"",valueDone:!1,valueType:"unknown"});break}if(s[r]==='"'){r++;let h="",m=!1;for(;r<s.length;)if(s[r]==="\\"&&r+1<s.length){const l=s[r+1];h+=l==="n"?`
178
+ `}))),n)).join("")}function nn(t){if(!t||!Number.isFinite(t))return"";const s=new Date(t);if(Number.isNaN(s.getTime()))return"";const n=new Date,r=m=>m.toString().padStart(2,"0"),i=`${r(s.getHours())}:${r(s.getMinutes())}`,d=s.getFullYear()===n.getFullYear();if(d&&s.getMonth()===n.getMonth()&&s.getDate()===n.getDate())return i;const h=`${s.getMonth()+1}-${s.getDate()} ${i}`;return d?h:`${s.getFullYear()}-${h}`}let Ke=null;function an(){return Ke||(Ke=he(()=>import("./mermaid.core-DVy3DGpO.js").then(t=>t.bm),__vite__mapDeps([0,1])).then(t=>{var r;const s=t.default,n=typeof window<"u"&&((r=window.matchMedia)==null?void 0:r.call(window,"(prefers-color-scheme: dark)").matches);return s.initialize({startOnLoad:!1,theme:n?"dark":"default",securityLevel:"strict",fontFamily:"inherit"}),s})),Ke}function cs(t){if(!(typeof document>"u"))for(const s of[`#${t}`,`#d${t}`,`#${t}-temp`])document.querySelectorAll(s).forEach(n=>n.remove())}let rn=0;function on({chart:t}){const[s,n]=a.useState(null),[r,i]=a.useState(null),d=a.useRef(`mermaid-${++rn}`);return a.useEffect(()=>{let u=!1;const h=d.current,m=t.trim();if(!m){n(null),i(null);return}return an().then(async l=>(await l.parse(m),l.render(h,m))).then(({svg:l})=>{u||(n(l),i(null))}).catch(l=>{if(cs(h),u)return;const p=l instanceof Error?l.message:String(l);i(p),n(null)}),()=>{u=!0,cs(h)}},[t]),r?e.jsxs("div",{className:"mermaid-block mermaid-block-error",children:[e.jsxs("div",{className:"mermaid-error-banner",children:["⚠ Mermaid 渲染失败:",r]}),e.jsx("pre",{children:e.jsx("code",{className:"language-mermaid",children:t})})]}):s?e.jsx("div",{className:"mermaid-block",dangerouslySetInnerHTML:{__html:s}}):e.jsx("pre",{className:"mermaid-block mermaid-block-loading",children:e.jsx("code",{className:"language-mermaid",children:t})})}const ln=a.memo(on),Ie=[Gs,Ks],cn={strict:"ignore",throwOnError:!1,errorColor:"inherit",output:"htmlAndMathml"},Me=[Vs,[Js,cn]];function dn({className:t,children:s,...n}){const r=/language-(\w+)/.exec(t??"");if((r==null?void 0:r[1])==="mermaid"){const d=Array.isArray(s)?s.join(""):String(s??"");return e.jsx(ln,{chart:d.replace(/\n$/,"")})}return e.jsx("code",{className:t,...n,children:s})}const Te={code:dn};function un(t){if(t===0)return"—";const s=["B","KB","MB","GB"];let n=0,r=t;for(;r>=1024&&n<s.length-1;)r/=1024,n++;return`${r.toFixed(n===0?0:1)} ${s[n]}`}function hn(t){return new Date(t).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function mn({open:t,onClose:s,sessionId:n}){const[r,i]=a.useState([]),[d,u]=a.useState(!1),[h,m]=a.useState(null),[l,p]=a.useState(null),x=a.useCallback(async()=>{if(!n||n==="__new_chat__"){i([]);return}u(!0),m(null);try{const c=await te(`/api/uploaded-files?sessionId=${encodeURIComponent(n)}`);if(c.error)throw new Error(c.error);i(c.files||[])}catch(c){m(c instanceof Error?c.message:String(c)),i([])}finally{u(!1)}},[n]);a.useEffect(()=>{t&&x()},[t,x]);const g=a.useCallback(async c=>{if(window.confirm(`确定删除文件 "${c.name}"?删除后无法恢复。`)){p(c.id);try{const E=await fetch("/api/uploaded-files/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:c.sessionId,fileId:c.id})}),C=await E.json();if(!E.ok||C.error)throw new Error(C.error||`HTTP ${E.status}`);await x()}catch(E){window.alert(`删除失败:${E instanceof Error?E.message:String(E)}`)}finally{p(null)}}},[x]),k=a.useCallback(c=>{const L=`/api/uploaded-files/download?sessionId=${encodeURIComponent(c.sessionId)}&fileId=${encodeURIComponent(c.id)}`;window.open(L,"_blank")},[]);return t?e.jsxs("div",{className:"uploaded-files-drawer",children:[e.jsxs("div",{className:"uploaded-files-drawer-header",children:[e.jsx("span",{className:"uploaded-files-drawer-title",children:"已上传的文件"}),e.jsxs("div",{className:"uploaded-files-drawer-actions",children:[e.jsx("button",{type:"button",className:"uploaded-files-drawer-btn",onClick:x,title:"刷新",disabled:d,children:e.jsx(qt,{size:14,className:d?"spin":""})}),e.jsx("button",{type:"button",className:"uploaded-files-drawer-btn",onClick:s,title:"关闭",children:e.jsx(Ns,{size:14})})]})]}),e.jsxs("div",{className:"uploaded-files-drawer-body",children:[h&&e.jsxs("div",{className:"uploaded-files-drawer-error",children:["加载失败:",h]}),!h&&r.length===0&&!d&&e.jsx("div",{className:"uploaded-files-drawer-empty",children:"当前会话没有已上传的文件"}),r.map(c=>e.jsxs("div",{className:"uploaded-files-drawer-item",children:[e.jsx(Et,{size:16,className:"uploaded-files-drawer-icon"}),e.jsxs("div",{className:"uploaded-files-drawer-info",children:[e.jsx("div",{className:"uploaded-files-drawer-name",title:c.name,children:c.name}),e.jsxs("div",{className:"uploaded-files-drawer-meta",children:[un(c.size)," · ",c.mimeType," · ",hn(c.uploadedAt)]}),e.jsxs("div",{className:"uploaded-files-drawer-id",title:c.id,children:["ID: ",c.id]})]}),e.jsx("button",{type:"button",className:"uploaded-files-drawer-btn",onClick:()=>k(c),title:"下载",children:e.jsx(It,{size:14})}),e.jsx("button",{type:"button",className:"uploaded-files-drawer-btn danger",onClick:()=>g(c),disabled:l===c.id,title:"删除",children:e.jsx(Kt,{size:14})})]},c.id))]})]}):null}function ds(t){return new Promise((s,n)=>{const r=new FileReader;r.onload=()=>s(r.result),r.onerror=n,r.readAsDataURL(t)})}const fn=a.memo(a.forwardRef(function({loading:s,connected:n,canUpload:r,canUploadImage:i,canUploadFile:d,acceptAttr:u,onSend:h,onAbort:m},l){const[p,x]=a.useState(""),[g,k]=a.useState([]),[c,L]=a.useState([]),E=a.useRef([]),C=a.useRef(null),S=a.useRef(null),G=a.useCallback(()=>{const _=C.current;_&&(_.style.height="auto",_.style.height=`${_.scrollHeight}px`)},[]),v=a.useCallback(async _=>{const T=[],A=[],z=[];for(const U of Array.from(_))if(U.type.startsWith("image/")&&i){if(U.size>10*1024*1024)continue;const Q=await ds(U);T.push(Q),z.push("image")}else if(d){if(U.size>20*1024*1024)continue;const Q=await ds(U);A.push({name:U.name,data:Q,mimeType:U.type||void 0}),z.push("file")}T.length>0&&k(U=>[...U,...T]),A.length>0&&L(U=>[...U,...A]),z.length>0&&(E.current=[...E.current,...z])},[i,d]);a.useImperativeHandle(l,()=>({addFiles:v}),[v]);const q=a.useCallback(async()=>{await h(p,c,g,E.current),x(""),k([]),L([]),E.current=[],C.current&&(C.current.style.height="auto")},[p,c,g,h]),F=_=>{_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),q())},Y=async _=>{_.target.files&&await v(_.target.files),_.target.value=""},Z=async _=>{var z;if(!i)return;const T=(z=_.clipboardData)==null?void 0:z.items;if(!T)return;const A=[];for(const U of Array.from(T)){if(!U.type.startsWith("image/"))continue;const Q=U.getAsFile();Q&&A.push(Q)}A.length>0&&await v(A)},b=_=>{k(z=>z.filter((U,Q)=>Q!==_));const T=[...E.current];let A=0;for(let z=0;z<T.length;z++)if(T[z]==="image"){if(A===_){T.splice(z,1);break}A++}E.current=T},D=_=>{L(z=>z.filter((U,Q)=>Q!==_));const T=[...E.current];let A=0;for(let z=0;z<T.length;z++)if(T[z]==="file"){if(A===_){T.splice(z,1);break}A++}E.current=T},f=E.current,y=new Array(g.length),V=new Array(c.length);{let _=0,T=0;for(let A=0;A<f.length;A++)f[A]==="image"?(_<y.length&&(y[_]=A+1),_++):f[A]==="file"&&(T<V.length&&(V[T]=A+1),T++)}const J=!!(p.trim()||g.length>0||c.length>0),ae=s&&!J;return e.jsxs(e.Fragment,{children:[g.length>0&&e.jsx("div",{className:"pending-images",children:g.map((_,T)=>e.jsxs("div",{className:"pending-image-item",children:[e.jsx("img",{src:_,alt:`pending-${T}`}),e.jsx("button",{className:"pending-image-remove",onClick:()=>b(T),children:"×"}),y[T]>0&&e.jsxs("span",{className:"pending-order-badge",children:["#",y[T]]})]},T))}),c.length>0&&e.jsx("div",{className:"pending-files",children:c.map((_,T)=>e.jsxs("div",{className:"pending-file-item",children:[V[T]>0&&e.jsxs("span",{className:"pending-file-order",children:["#",V[T]]}),e.jsx("span",{className:"pending-file-icon",children:e.jsx(Ze,{size:14})}),e.jsx("span",{className:"pending-file-name",children:_.name}),e.jsx("button",{className:"pending-file-remove",onClick:()=>D(T),children:"×"})]},T))}),e.jsxs("div",{className:"input-area",children:[e.jsx("input",{ref:S,type:"file",accept:u,multiple:!0,style:{display:"none"},onChange:Y}),r&&e.jsx("button",{className:"upload-btn",onClick:()=>{var _;return(_=S.current)==null?void 0:_.click()},disabled:!n,title:i&&d?"上传图片或文件":i?"上传图片":"上传文件",children:e.jsx(ws,{size:18})}),e.jsx("textarea",{ref:C,value:p,onChange:_=>{x(_.target.value),G()},onKeyDown:F,onPaste:Z,placeholder:"输入消息... (Enter 发送, Shift+Enter 换行)",disabled:!n,rows:1}),ae?e.jsx("button",{className:"send-btn stop-mode",onClick:m,title:"停止生成",children:e.jsx(Jt,{size:16})}):e.jsx("button",{className:"send-btn",onClick:()=>{q()},disabled:!n||!J,children:"↑"})]})]})}));function pn({startTime:t,endTime:s}){const[n,r]=a.useState(Date.now());if(a.useEffect(()=>{if(s||!t)return;const d=setInterval(()=>r(Date.now()),100);return()=>clearInterval(d)},[t,s]),!t)return null;const i=((s||n)-t)/1e3;return e.jsxs("span",{className:"tool-call-timer",children:[i.toFixed(1),"s"]})}function us({startTime:t,endTime:s}){const[n,r]=a.useState(Date.now());a.useEffect(()=>{if(s)return;let d;const u=()=>{r(Date.now()),d=requestAnimationFrame(u)};return d=requestAnimationFrame(u),()=>cancelAnimationFrame(d)},[s]);const i=((s||n)-t)/1e3;return e.jsxs("span",{className:"compress-timer",children:[i.toFixed(1),"s"]})}function xn({seg:t,index:s}){return e.jsxs("details",{className:"tool-call-block",children:[e.jsxs("summary",{className:"tool-call-summary",children:[e.jsx(ss,{size:14})," ",t.name,t.result==null?" …":"",e.jsx(pn,{startTime:t.startTime,endTime:t.endTime})]}),e.jsxs("div",{className:"tool-call-content",children:[e.jsxs("div",{className:"tool-call-args",children:[e.jsx("strong",{children:"参数"}),e.jsx("pre",{children:JSON.stringify(t.args,null,2)})]}),t.result!=null&&e.jsxs("div",{className:"tool-call-result",children:[e.jsx("strong",{children:"结果"}),e.jsx("pre",{children:t.result})]})]})]},s)}const gn=[".txt",".md",".csv",".json",".xml",".html",".htm",".css",".js",".ts",".yaml",".yml",".ini",".cfg",".conf",".log",".sh",".py",".java",".c",".cpp",".h",".rs",".go",".rb",".php",".sql",".pdf",".docx"],jn=gn.join(",")+",text/*,application/pdf,application/vnd.openxmlformats-officedocument.wordprocessingml.document";function vn(t){const s=t.trim();if(!s.startsWith("{"))return null;try{const n=JSON.parse(s);return typeof n!="object"||n===null||Array.isArray(n)?null:n}catch{return null}}function yn(t){const s=t.trim();if(!s.startsWith("{"))return null;const n=[];let r=1;const i=()=>{for(;r<s.length&&/[\s,]/.test(s[r]);)r++};for(;r<s.length&&(i(),!(r>=s.length||s[r]==="}"||s[r]!=='"'));){r++;let d="",u=!1;for(;r<s.length;)if(s[r]==="\\"&&r+1<s.length)d+=s[r+1],r+=2;else if(s[r]==='"'){u=!0,r++;break}else d+=s[r],r++;if(!u){n.push({key:d,keyDone:!1,value:"",valueDone:!1,valueType:"unknown"});break}if(i(),r>=s.length||s[r]!==":"){n.push({key:d,keyDone:!0,value:"",valueDone:!1,valueType:"unknown"});break}if(r++,i(),r>=s.length){n.push({key:d,keyDone:!0,value:"",valueDone:!1,valueType:"unknown"});break}if(s[r]==='"'){r++;let h="",m=!1;for(;r<s.length;)if(s[r]==="\\"&&r+1<s.length){const l=s[r+1];h+=l==="n"?`
179
179
  `:l==="t"?" ":l==='"'?'"':l==="\\"?"\\":l,r+=2}else if(s[r]==='"'){m=!0,r++;break}else h+=s[r],r++;n.push({key:d,keyDone:!0,value:h,valueDone:m,valueType:"string"})}else if(s[r]==="{"||s[r]==="["){const h=s[r],m=h==="{"?"}":"]";let l=1;const p=r;r++;let x=!1;for(;r<s.length&&l>0;)x?s[r]==="\\"?r++:s[r]==='"'&&(x=!1):s[r]==='"'?x=!0:s[r]===h?l++:s[r]===m&&l--,r++;n.push({key:d,keyDone:!0,value:s.slice(p,r),valueDone:l===0,valueType:h==="{"?"object":"array"})}else{let h="";for(;r<s.length&&!/[,\s}]/.test(s[r]);)h+=s[r],r++;const m=r<s.length&&/[,}]/.test(s[r]),l=/^(true|false)$/.test(h)?"boolean":h==="null"?"null":"number";n.push({key:d,keyDone:!0,value:h,valueDone:m,valueType:l})}}return n.length>0?n:null}const bs={mood:"心情",state:"状态",desire:"发言欲望",current_action:"当前动作",think:"思考",message:"回复",response:"回复",reply:"回复",content:"内容",analysis:"分析",file_analysis:"文件分析",image_analysis:"图片分析"},Cs=new Set(["message","response","reply","content","answer","text","msg"]);function wn({label:t,data:s}){const[n,r]=a.useState(!0);return e.jsxs("div",{className:"json-field json-field-group",children:[e.jsxs("div",{className:"json-field-header json-field-toggle",onClick:()=>r(!n),children:[n?e.jsx(js,{size:14}):e.jsx(vs,{size:14}),e.jsx("span",{className:"json-field-label",children:t})]}),n&&e.jsx("div",{className:"json-field-children",children:Object.entries(s).map(([i,d])=>e.jsx(Ss,{fieldKey:i,value:d},i))})]})}function Ss({fieldKey:t,value:s}){const n=bs[t]||t;if(s==null||s==="")return null;if(typeof s=="object"&&!Array.isArray(s))return e.jsx(wn,{label:n,data:s});if(Array.isArray(s))return e.jsxs("div",{className:"json-field",children:[e.jsx("span",{className:"json-field-label",children:n}),e.jsx("span",{className:"json-field-value",children:s.map(String).join(", ")})]});const r=String(s),i=Cs.has(t);return e.jsxs("div",{className:`json-field${i?" json-field-reply":""}`,children:[e.jsx("span",{className:"json-field-label",children:n}),i?e.jsx("div",{className:"json-field-value json-field-value-md",children:e.jsx(_e,{remarkPlugins:Ie,rehypePlugins:Me,components:Te,children:$e(r)})}):e.jsx("span",{className:"json-field-value",children:r})]})}function Nn({data:t}){return e.jsx("div",{className:"json-message-view",children:Object.entries(t).map(([s,n])=>e.jsx(Ss,{fieldKey:s,value:n},s))})}function kn({fields:t}){return e.jsx("div",{className:"json-message-view",children:t.map((s,n)=>{const i=n===t.length-1&&(!s.valueDone||!s.keyDone),d=s.keyDone&&bs[s.key]||s.key,u=s.keyDone&&Cs.has(s.key);return e.jsxs("div",{className:`json-field${u?" json-field-reply":""}`,children:[e.jsxs("span",{className:`json-field-label${s.keyDone?"":" json-field-partial"}`,children:[d,!s.keyDone&&i&&e.jsx("span",{className:"streaming-cursor"})]}),s.keyDone&&(u&&s.value?e.jsxs("div",{className:"json-field-value json-field-value-md",children:[e.jsx(_e,{remarkPlugins:Ie,rehypePlugins:Me,components:Te,children:$e(s.value)}),i&&e.jsx("span",{className:"streaming-cursor"})]}):e.jsxs("span",{className:"json-field-value",children:[s.value,i&&e.jsx("span",{className:"streaming-cursor"})]}))]},n)})})}const Ue=a.memo(function({content:s}){const n=vn(s);if(n)return e.jsx(Nn,{data:n});if(s.trim().startsWith("{")){const i=yn(s);return i?e.jsx(kn,{fields:i}):null}return e.jsx(_e,{remarkPlugins:Ie,rehypePlugins:Me,components:Te,children:$e(s)})});function bn(t){if(!t)return"";const s=[];return t.image&&s.push("image/*"),t.file&&s.push(jn),s.push("audio/*"),s.push("video/*"),s.join(",")}function Cn({status:t}){switch(t){case"completed":return e.jsx(ys,{size:14,className:"todo-icon todo-icon-done"});case"in-progress":return e.jsx(Qe,{size:14,className:"todo-icon todo-icon-active"});default:return e.jsx(Ct,{size:14,className:"todo-icon todo-icon-pending"})}}function Sn({items:t,onClear:s,loading:n}){const[r,i]=a.useState(!0),d=t.filter(l=>l.status==="completed").length,u=t.length,h=d===u,m=!h&&n;return e.jsxs("div",{className:`todo-bar ${h?"todo-bar-done":""}`,children:[e.jsxs("div",{className:"todo-bar-header",onClick:()=>i(!r),children:[e.jsx(At,{size:15,className:"todo-bar-icon"}),e.jsx("span",{className:"todo-bar-title",children:"任务计划"}),e.jsxs("span",{className:"todo-bar-count",children:[d,"/",u]}),e.jsx("div",{className:"todo-bar-progress",children:e.jsx("div",{className:"todo-bar-progress-fill",style:{width:`${u>0?d/u*100:0}%`}})}),e.jsx("button",{className:"todo-bar-toggle",title:r?"收起":"展开",children:r?e.jsx(js,{size:14}):e.jsx(vs,{size:14})}),e.jsx("button",{className:"todo-bar-clear",onClick:l=>{l.stopPropagation(),m||s()},disabled:m,title:m?"任务执行中,无法清除":"清除计划",children:e.jsx(Ns,{size:14})})]}),r&&e.jsx("div",{className:"todo-bar-list",children:t.map(l=>e.jsxs("div",{className:`todo-item todo-item-${l.status}`,children:[e.jsx(Cn,{status:l.status}),e.jsx("span",{className:"todo-item-title",children:l.title})]},l.id))})]})}const es="aalis:open-lightbox";function hs(t){window.dispatchEvent(new CustomEvent(es,{detail:t}))}const _n=a.memo(function({msg:s,senderName:n,isLast:r,isGenerating:i,onAbort:d,checkpoint:u,rolledBack:h,onRollback:m,onRollbackWithChat:l,toolCallsProgress:p}){return s.role==="system"?e.jsxs("div",{className:"system-event-separator",children:[e.jsx("span",{className:"system-event-line"}),e.jsxs("span",{className:"system-event-text",children:[e.jsx(gs,{size:12})," ",s.content]}),e.jsx("span",{className:"system-event-line"})]}):e.jsxs("div",{className:`message-group ${s.role}`,children:[e.jsxs("div",{className:"message-sender",children:[e.jsx("span",{className:"message-sender-name",children:s.role==="user"?"You":n}),s.timestamp?e.jsx("span",{className:"message-time",title:new Date(s.timestamp).toLocaleString(),children:nn(s.timestamp)}):null,s.role==="assistant"&&s.modelInfo&&(s.modelInfo.model||s.modelInfo.completionTokens!=null)?e.jsxs("span",{className:"message-model-badge",title:[s.modelInfo.provider&&s.modelInfo.model?`${s.modelInfo.provider} / ${s.modelInfo.model}`:s.modelInfo.model,s.modelInfo.completionTokens!=null?`本次生成 ${s.modelInfo.completionTokens} tok`:null,s.modelInfo.promptTokens!=null?`上下文 ${s.modelInfo.promptTokens} tok`:null,s.modelInfo.elapsedMs!=null?`耗时 ${(s.modelInfo.elapsedMs/1e3).toFixed(1)}s`:null].filter(Boolean).join(" · "),children:[s.modelInfo.model??"",s.modelInfo.completionTokens!=null?` · ${(s.modelInfo.completionTokens/1e3).toFixed(1)}k`:"",s.modelInfo.elapsedMs!=null?` · ${(s.modelInfo.elapsedMs/1e3).toFixed(1)}s`:""]}):null]}),s.role==="user"&&s.images&&s.images.length>0&&e.jsx("div",{className:"message-images",children:s.images.map((x,g)=>e.jsx("div",{className:"message-image-wrap",children:e.jsx("img",{src:je(x),alt:`attached-${g}`,className:"message-image",onClick:()=>hs(je(x))})},g))}),s.role==="user"&&s.fileNames&&s.fileNames.length>0&&e.jsx("div",{className:"message-files",children:s.fileNames.map((x,g)=>e.jsxs("div",{className:"message-file-item",children:[e.jsx(Ze,{size:14})," ",x]},g))}),s.role==="assistant"&&s.attachments&&s.attachments.length>0&&e.jsx("div",{className:"message-images",children:s.attachments.map((x,g)=>x.kind==="image"?e.jsx("div",{className:"message-image-wrap",children:e.jsx("img",{src:je(x.data),alt:x.name??`attachment-${g}`,className:"message-image",onClick:()=>hs(je(x.data))})},`a-${g}`):x.kind==="video"?e.jsx("video",{controls:!0,src:je(x.data),className:"message-image"},`a-${g}`):x.kind==="audio"?e.jsx("audio",{controls:!0,src:je(x.data)},`a-${g}`):e.jsxs("div",{className:"message-file-item",children:[e.jsx(Ze,{size:14})," ",x.name??"attachment"]},`a-${g}`))}),s.role==="assistant"&&s.segments&&s.segments.length>0?e.jsx("div",{className:"message-bubble",children:(()=>{const x=[];let g=0;for(;g<s.segments.length;){const k=s.segments[g];if(k.type==="reasoning_text"){const c=[];for(;g<s.segments.length&&s.segments[g].type==="reasoning_text";)c.push(s.segments[g]),g++;const L=c.filter(E=>E.type==="reasoning_text").map(E=>E.content).join("");L&&x.push(e.jsxs("details",{className:"thinking-block",children:[e.jsxs("summary",{className:"thinking-summary",children:[e.jsx(os,{size:14})," 思考过程"]}),e.jsx("div",{className:"thinking-content",children:e.jsx(_e,{remarkPlugins:Ie,rehypePlugins:Me,components:Te,children:$e(L)})})]},`r-${g}`));continue}if(k.type==="text"){k.content&&x.push(e.jsx(Ue,{content:k.content},`t-${g}`)),g++;continue}x.push(e.jsx(xn,{seg:k,index:g},`tc-${g}`)),g++}return x})()}):s.role==="assistant"&&s.reasoningContent?e.jsxs(e.Fragment,{children:[e.jsxs("details",{className:"thinking-block",children:[e.jsxs("summary",{className:"thinking-summary",children:[e.jsx(os,{size:14})," 思考过程"]}),e.jsx("div",{className:"thinking-content",children:e.jsx(_e,{remarkPlugins:Ie,rehypePlugins:Me,components:Te,children:$e(s.reasoningContent)})})]}),e.jsx("div",{className:"message-bubble",children:e.jsx(Ue,{content:s.content})})]}):e.jsx("div",{className:"message-bubble",children:s.role==="assistant"?e.jsx(Ue,{content:s.content}):s.content}),s.role==="assistant"&&p&&p.size>0&&e.jsx("div",{className:"tool-call-progress-bubble",children:[...p.entries()].sort((x,g)=>x[0]-g[0]).map(([x,g])=>e.jsx(_s,{name:g.name,charsAccumulated:g.charsAccumulated,startedAt:g.startedAt},`pending-${x}`))}),r&&i&&s.role==="assistant"&&e.jsx("button",{className:"stop-generate-btn",onClick:d,title:"停止生成",children:"■ 停止生成"}),s.role==="assistant"&&u&&!i&&(h?e.jsxs("span",{className:"checkpoint-rolled-back",children:[e.jsx(Je,{size:12})," 此次修改已回滚"]}):e.jsxs("div",{className:"checkpoint-rollback-actions",children:[u.fileCount>0&&e.jsxs("button",{className:"checkpoint-rollback-btn",onClick:()=>m==null?void 0:m(u),title:`仅回滚本回合的 ${u.fileCount} 个文件改动(保留对话)${u.execUsed?`
180
180
  注意:本回合调用过 exec/shell,命令副作用无法回滚`:""}`,children:[e.jsx(Je,{size:12})," 回滚文件改动",u.execUsed&&e.jsxs("span",{className:"checkpoint-warn",children:[e.jsx(De,{size:11})," exec"]})]}),e.jsxs("button",{className:"checkpoint-rollback-btn",onClick:()=>l==null?void 0:l(u),title:`回滚本轮对话(含 ${u.fileCount} 处文件改动):删除本轮的用户提问、回复和工具调用记录,并恢复文件${u.execUsed?`
181
181
  注意:本回合调用过 exec/shell,命令副作用无法回滚`:""}`,children:[e.jsx(Je,{size:12})," 回滚本轮对话(含文件)",u.execUsed&&e.jsxs("span",{className:"checkpoint-warn",children:[e.jsx(De,{size:11})," exec"]})]})]}))]})});function _s({name:t,charsAccumulated:s,startedAt:n}){const[r,i]=a.useState(Date.now()-n);a.useEffect(()=>{const u=window.setInterval(()=>i(Date.now()-n),100);return()=>window.clearInterval(u)},[n]);const d=(r/1e3).toFixed(1);return e.jsx("div",{className:"tool-call-block tool-call-block-pending","aria-live":"polite",children:e.jsxs("div",{className:"tool-call-summary",children:[e.jsx("span",{className:"tool-call-progress-icon",children:e.jsx(ss,{size:14})}),e.jsx("span",{children:t||"正在生成…"}),e.jsxs("span",{className:"tool-call-progress-meta",children:[s," 字符 · ",d,"s"]})]})})}function $n({messages:t,loading:s,connected:n,status:r,onSend:i,onAbort:d,width:u,sessionTitle:h,onNewSession:m,todoItems:l,onClearTodos:p,toolLimitReached:x,onContinueTools:g,toolCallsProgress:k,tokenUsage:c,compressingStatus:L,onCompress:E}){const C=a.useRef(null),S=a.useRef(null),G=a.useRef(null),v=a.useRef(!1),[q,F]=a.useState([]),[Y,Z]=a.useState(new Set),b=a.useRef(s);a.useEffect(()=>{let j=!1;async function R(){try{const B=oe();if(!B||B==="__new_chat__"){j||F([]);return}const W=await de("@aalis/plugin-checkpoint","listTurns",{sessionId:B});!j&&Array.isArray(W)&&F(W)}catch{}}return b.current&&!s?R():t.length===0?F([]):R(),b.current=s,()=>{j=!0}},[s,h,t.length]);const D=a.useMemo(()=>j=>{for(const R of q){const B=R.startedAt-1e3,W=(R.endedAt??R.startedAt+6e4)+5e3;if(j>=B&&j<=W)return R}},[q]),f=a.useCallback(async j=>{const R=j.filesPreview.slice(0,3).join(`
@@ -204,4 +204,4 @@ ${R}${B}`:"";if(window.confirm(`将回滚本轮对话:
204
204
  此操作不可撤销。确定继续?`))try{const X=await de("@aalis/plugin-checkpoint","rollbackWithChat",{sessionId:oe(),turnId:j.turnId}),le=[];X.chatDeleted&&le.push(`删除 ${X.deletedMessages} 条消息`),j.fileCount>0&&le.push(`恢复 ${X.restored.length} 个文件,删除 ${X.deleted.length} 个新建文件`);const Oe=le.length>0?`回滚完成:${le.join(";")}`:"回滚完成";X.errors.length>0&&window.alert(`${Oe}
205
205
  失败 ${X.errors.length} 项:
206
206
  `+X.errors.map(ge=>`${ge.uri||"(memory)"}: ${ge.reason}`).join(`
207
- `)),Z(ge=>new Set([...ge,j.turnId]))}catch(X){window.alert(`回滚失败:${X.message}`)}},[]),V=a.useRef(null),J=a.useRef(!1),[ae,_]=a.useState(!1),T=a.useRef(0),[A,z]=a.useState(!1),[U,Q]=a.useState(!1),[xe,ue]=a.useState(null),ve=a.useRef(0),ye=a.useRef(0);a.useEffect(()=>{const j=B=>{const W=B.detail;typeof W=="string"&&ue(W)},R=B=>{B.key==="Escape"&&ue(null)};return window.addEventListener(es,j),window.addEventListener("keydown",R),()=>{window.removeEventListener(es,j),window.removeEventListener("keydown",R)}},[]);const re=r==null?void 0:r.uploadCapabilities,we=(re==null?void 0:re.image)??!1,Ne=(re==null?void 0:re.file)??!1,ke=we||Ne,Pe=bn(re);a.useEffect(()=>{L==="start"?(ve.current=Date.now(),ye.current=0):(L==="done"||L==="error")&&(ye.current=Date.now())},[L]),a.useEffect(()=>{const j=G.current;if(!j)return;const R=()=>{const{scrollTop:B,scrollHeight:W,clientHeight:me}=j;v.current=W-B-me>200,J.current=!0,V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{J.current=!1},300)};return j.addEventListener("scroll",R,{passive:!0}),()=>j.removeEventListener("scroll",R)},[]),a.useEffect(()=>{const j=G.current;if(!j)return;const R=new ResizeObserver(()=>{var B;!v.current&&!J.current&&((B=S.current)==null||B.scrollIntoView({behavior:s?"instant":"smooth"}))});return R.observe(j),()=>R.disconnect()},[t.length]),a.useEffect(()=>{var j;!v.current&&!J.current&&((j=S.current)==null||j.scrollIntoView({behavior:"smooth"}))},[t]);const Ae=a.useCallback((j,R,B,W)=>i(j,R,B,W),[i]),be=j=>{j.preventDefault(),j.stopPropagation(),T.current++,ke&&j.dataTransfer.types.includes("Files")&&_(!0)},Ce=j=>{j.preventDefault(),j.stopPropagation(),T.current--,T.current<=0&&(T.current=0,_(!1))},Ee=j=>{j.preventDefault(),j.stopPropagation()},ze=async j=>{var R;j.preventDefault(),j.stopPropagation(),T.current=0,_(!1),!(!ke||!j.dataTransfer.files.length)&&await((R=C.current)==null?void 0:R.addFiles(j.dataTransfer.files))},ie=t[t.length-1],Le=(ie==null?void 0:ie.role)==="assistant"&&s;return e.jsxs("div",{className:`chat-panel${ae?" drag-over":""}`,style:{width:u},onDragEnter:be,onDragLeave:Ce,onDragOver:Ee,onDrop:ze,children:[ae&&e.jsx("div",{className:"drag-overlay",children:e.jsxs("div",{className:"drag-overlay-content",children:[e.jsx(ws,{size:16})," 松开以上传文件"]})}),e.jsxs("div",{className:"chat-panel-header",children:[e.jsxs("span",{className:"chat-panel-title",children:[e.jsx(is,{size:16})," ",h||(r==null?void 0:r.name)||"Aalis"]}),e.jsxs("div",{className:"chat-panel-header-actions",children:[e.jsxs("div",{className:"token-usage-badge",onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),children:[e.jsx(ks,{size:12}),e.jsx("span",{className:`token-usage-number${c&&c.usageRatio>.85?" warn":c&&c.usageRatio>.7?" caution":""}`,children:c?c.used.toLocaleString():"--"}),A&&e.jsxs("div",{className:"token-usage-panel",children:[e.jsx("div",{className:"token-panel-title",children:"Token 使用情况"}),c?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"token-panel-bar",children:e.jsx("div",{className:`token-panel-bar-fill${c.usageRatio>.85?" warn":c.usageRatio>.7?" caution":""}`,style:{width:`${Math.min(100,c.usageRatio*100)}%`}})}),e.jsxs("div",{className:"token-panel-ratio",children:[(c.usageRatio*100).toFixed(1),"% 已使用"]}),e.jsxs("div",{className:"token-panel-rows",children:[e.jsxs("div",{className:"token-panel-row",children:[e.jsx("span",{children:"上下文窗口"}),e.jsx("span",{children:c.contextWindow.toLocaleString()})]}),e.jsxs("div",{className:"token-panel-section-header",children:["系统提示词 ",e.jsx("span",{className:"token-panel-section-total",children:c.breakdown.system.toLocaleString()})]}),e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"人设 / Persona"}),e.jsx("span",{children:c.breakdown.persona.toLocaleString()})]}),c.breakdown.memorySummary>0&&e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"对话摘要"}),e.jsx("span",{children:c.breakdown.memorySummary.toLocaleString()})]}),c.breakdown.memoryVector>0&&e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"向量记忆"}),e.jsx("span",{children:c.breakdown.memoryVector.toLocaleString()})]}),c.breakdown.skills>0&&e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"技能描述"}),e.jsx("span",{children:c.breakdown.skills.toLocaleString()})]}),c.breakdown.platform>0&&e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"平台提示"}),e.jsx("span",{children:c.breakdown.platform.toLocaleString()})]}),c.breakdown.subtask>0&&e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"子任务上下文"}),e.jsx("span",{children:c.breakdown.subtask.toLocaleString()})]}),c.breakdown.systemOther>0&&e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"其他系统提示"}),e.jsx("span",{children:c.breakdown.systemOther.toLocaleString()})]}),e.jsxs("div",{className:"token-panel-row",children:[e.jsx("span",{children:"历史消息"}),e.jsx("span",{children:c.breakdown.history.toLocaleString()})]}),e.jsxs("div",{className:"token-panel-row",children:[e.jsx("span",{children:"工具结果"}),e.jsx("span",{children:c.breakdown.toolResults.toLocaleString()})]}),e.jsxs("div",{className:"token-panel-row",children:[e.jsx("span",{children:"工具定义"}),e.jsx("span",{children:c.breakdown.toolDefs.toLocaleString()})]}),e.jsxs("div",{className:"token-panel-row",children:[e.jsx("span",{children:"回复保留量"}),e.jsx("span",{children:c.breakdown.reservedForReply.toLocaleString()})]})]}),E&&e.jsx("button",{className:"token-panel-compress-btn",onClick:j=>{j.stopPropagation(),E()},disabled:L==="start",children:L==="start"?e.jsxs(e.Fragment,{children:[e.jsx(Qe,{size:12,className:"compress-spinner"})," 压缩中…"]}):e.jsxs(e.Fragment,{children:[e.jsx(gs,{size:12})," 压缩对话"]})})]}):e.jsx("div",{className:"token-panel-empty",children:"发送消息后将显示 Token 用量统计"})]})]}),m&&e.jsx("button",{className:"chat-panel-new-btn",onClick:m,title:"新对话",children:"+"}),e.jsx("button",{className:"chat-panel-new-btn",onClick:()=>Q(j=>!j),title:"已上传的文件","aria-label":"已上传的文件",children:e.jsx(Rt,{size:14})})]})]}),e.jsx(mn,{open:U,onClose:()=>Q(!1),sessionId:oe()}),e.jsxs("div",{className:"messages",ref:G,children:[t.length===0&&e.jsxs("div",{className:"empty",children:[e.jsx("div",{className:"empty-icon",children:e.jsx(is,{size:40})}),"开始和 ",(r==null?void 0:r.name)??"Aalis"," 对话吧"]}),t.map((j,R)=>{const B=R===t.length-1;return e.jsx(_n,{msg:j,senderName:(r==null?void 0:r.name)??"Aalis",isLast:B,isGenerating:Le,onAbort:d,checkpoint:j.role==="assistant"?D(j.timestamp):void 0,rolledBack:j.role==="assistant"?(()=>{const W=D(j.timestamp);return W?Y.has(W.turnId):!1})():!1,onRollback:f,onRollbackWithChat:y,toolCallsProgress:B&&j.role==="assistant"&&Le?k:void 0},R)}),s&&(!ie||ie.role!=="assistant")&&e.jsxs("div",{className:"message-group assistant",children:[e.jsx("div",{className:"message-sender",children:(r==null?void 0:r.name)??"Aalis"}),e.jsx("div",{className:"message-bubble",children:k&&k.size>0?[...k.entries()].sort((j,R)=>j[0]-R[0]).map(([j,R])=>e.jsx(_s,{name:R.name,charsAccumulated:R.charsAccumulated,startedAt:R.startedAt},`pending-${j}`)):e.jsxs("div",{className:"typing-indicator",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]})}),e.jsx("button",{className:"stop-generate-btn",onClick:d,title:"停止生成",children:"■ 停止生成"})]}),x&&!s&&e.jsxs("div",{className:"tool-limit-bar",children:[e.jsx("span",{className:"tool-limit-text",children:"⚠ 工具调用次数已达上限"}),e.jsxs("div",{className:"tool-limit-actions",children:[g&&e.jsx("button",{className:"tool-limit-btn continue",onClick:g,children:"继续迭代"}),e.jsx("span",{className:"tool-limit-hint",children:"或输入新内容引导模型"})]})]}),L==="start"&&e.jsxs("div",{className:"system-event-separator compressing",children:[e.jsx("span",{className:"system-event-line"}),e.jsxs("span",{className:"system-event-text",children:[e.jsx(Qe,{size:12,className:"compress-spinner"})," 压缩对话中 ",e.jsx(us,{startTime:ve.current})]}),e.jsx("span",{className:"system-event-line"})]}),L==="done"&&e.jsxs("div",{className:"system-event-separator compress-done",children:[e.jsx("span",{className:"system-event-line"}),e.jsxs("span",{className:"system-event-text",children:[e.jsx(ys,{size:12})," 已压缩对话 ",e.jsx(us,{startTime:ve.current,endTime:ye.current})]}),e.jsx("span",{className:"system-event-line"})]}),L==="error"&&e.jsxs("div",{className:"system-event-separator compress-error",children:[e.jsx("span",{className:"system-event-line"}),e.jsxs("span",{className:"system-event-text",children:[e.jsx(De,{size:12})," 压缩失败"]}),e.jsx("span",{className:"system-event-line"})]}),e.jsx("div",{ref:S})]}),l&&l.length>0&&p&&e.jsx(Sn,{items:l,onClear:p,loading:s}),e.jsx(fn,{ref:C,loading:s,connected:n,canUpload:ke,canUploadImage:we,canUploadFile:Ne,acceptAttr:Pe,onSend:Ae,onAbort:d}),xe&&e.jsxs("div",{className:"image-lightbox",onClick:()=>ue(null),children:[e.jsx("img",{src:xe,alt:"预览",className:"image-lightbox-content",onClick:j=>j.stopPropagation()}),e.jsx("button",{type:"button",className:"image-lightbox-close",onClick:()=>ue(null),"aria-label":"关闭",children:"×"})]})]})}const In=a.lazy(()=>he(()=>import("./PluginConfigPage-tzDj2CUH.js"),__vite__mapDeps([2,1,3,4,5,6,7,8,9])).then(t=>({default:t.PluginConfigPage}))),Mn=a.lazy(()=>he(()=>import("./MarketplacePage-DZLd-TYD.js"),__vite__mapDeps([10,1,4,11,5,6,7,8,9])).then(t=>({default:t.MarketplacePage}))),Tn=a.lazy(()=>he(()=>import("./PlatformPage-C-Lne53a.js"),__vite__mapDeps([12,1,13,5,6,7,8,9])).then(t=>({default:t.PlatformPage}))),En=a.lazy(()=>he(()=>import("./AuthorityPage-DQhXicev.js"),__vite__mapDeps([14,1,11,5,6,7,8,9])).then(t=>({default:t.AuthorityPage}))),Ln=a.lazy(()=>he(()=>import("./LogPage-C_Z3RA5T.js"),__vite__mapDeps([15,1])).then(t=>({default:t.LogPage}))),Rn=a.lazy(()=>he(()=>import("./SessionsPage-CM1jOqTy.js"),__vite__mapDeps([16,1,9,7,8,5,6])).then(t=>({default:t.SessionsPage}))),Dn=a.lazy(()=>he(()=>import("./FilesPage-s95cpGq1.js"),__vite__mapDeps([17,1,5,6,7,8,9])).then(t=>({default:t.FilesPage}))),Pn=a.lazy(()=>he(()=>import("./DynamicPage-CQhgQLoH.js"),__vite__mapDeps([18,1,3,19,20,13,11,9,7,8,5,6])).then(t=>({default:t.DynamicPage}))),ms=2e3;function An(){var ns;const[t,s]=a.useState(()=>location.hash.replace("#","")||"dashboard"),[n,r]=a.useState(null),[i,d]=a.useState([]);a.useEffect(()=>{location.hash=t},[t]),a.useEffect(()=>{n&&!n.has(t)&&s("dashboard")},[n,t]);const[u,h]=a.useState([]),[m,l]=a.useState(null),[p,x]=a.useState(null),[g,k]=a.useState(null),[c,L]=a.useState([]),[E,C]=a.useState(null),S=dt(i),{messages:G,setMessages:v,loading:q,setLoading:F,streamingRef:Y}=S,Z=a.useRef({pending:[],raf:0}),[b,D]=a.useState(0),[f,y]=a.useState([]),[V,J]=a.useState(()=>{if(typeof window>"u")return 420;const o=Number(window.localStorage.getItem("aalis:chatWidth"));return Number.isFinite(o)&&o>=280?o:420});a.useEffect(()=>{try{window.localStorage.setItem("aalis:chatWidth",String(V))}catch{}},[V]),a.useEffect(()=>{const o=document.querySelector(".app-layout");if(!o||typeof ResizeObserver>"u")return;const w=360,N=240,M=()=>{var se;const $=o.clientWidth,O=((se=document.querySelector(".nav-rail"))==null?void 0:se.getBoundingClientRect().width)??56,P=Math.max(N,$-O-w);J(K=>Math.min(Math.max(K,N),P))},I=new ResizeObserver(M);return I.observe(o),()=>I.disconnect()},[]);const[ae,_]=a.useState(!1),[T,A]=a.useState(new Map),[z,U]=a.useState(!1),[Q,xe]=a.useState(!1),[ue,ve]=a.useState(!1),[ye,re]=a.useState("正在重启…"),[we,Ne]=a.useState(!1),[ke,Pe]=a.useState(null),[Ae,be]=a.useState(null),Ce=(o,w)=>{const N=o?[...o]:[],M=N[N.length-1];return w.type==="text"&&M&&M.type==="text"?N[N.length-1]={type:"text",content:M.content+w.content}:w.type==="reasoning_text"&&M&&M.type==="reasoning_text"?N[N.length-1]={type:"reasoning_text",content:M.content+w.content}:N.push(w),N},Ee=o=>{let w="",N="";for(const M of o??[])M.type==="text"?w+=M.content:M.type==="reasoning_text"&&(N+=M.content);return{content:w,reasoning:N}},ze=a.useCallback((o,w,N,M,I)=>{Z.current.raf&&(cancelAnimationFrame(Z.current.raf),Z.current.raf=0),Z.current.pending=[],v($=>{const O=$[$.length-1],P=N&&N.length>0?N:w?[{type:"reasoning_text",content:w},{type:"text",content:o}]:[{type:"text",content:o}];return O&&O.role==="assistant"&&Y.current?(Y.current=!1,[...$.slice(0,-1),{...O,content:o,reasoningContent:w??O.reasoningContent,segments:P,attachments:M??O.attachments,modelInfo:I??O.modelInfo}]):(Y.current=!1,[...$,{role:"assistant",content:o,reasoningContent:w,segments:P,attachments:M,modelInfo:I,timestamp:Date.now()}])}),F(!1)},[]),ie=a.useCallback(()=>{const o=Z.current;if(o.raf&&(cancelAnimationFrame(o.raf),o.raf=0),o.pending.length===0)return;const w=o.pending;o.pending=[],v(N=>{const M=N[N.length-1];if(M&&M.role==="assistant"&&Y.current){let P=M.segments??[];for(const ne of w)P=Ce(P,{type:ne.kind==="content"?"text":"reasoning_text",content:ne.text});const{content:se,reasoning:K}=Ee(P);return[...N.slice(0,-1),{...M,content:se,reasoningContent:K||void 0,segments:P}]}Y.current=!0;let I=[];for(const P of w)I=Ce(I,{type:P.kind==="content"?"text":"reasoning_text",content:P.text});const{content:$,reasoning:O}=Ee(I);return[...N,{role:"assistant",content:$,reasoningContent:O||void 0,segments:I,timestamp:Date.now()}]})},[v,Y]),Le=a.useCallback((o,w,N,M)=>{if(N){ie(),F(!1),_(!!M),A(new Map);return}(o||w)&&A($=>$.size===0?$:new Map);const I=Z.current;w&&I.pending.push({kind:"reasoning",text:w}),o&&I.pending.push({kind:"content",text:o}),!I.raf&&(I.raf=requestAnimationFrame(ie))},[ie,F]),j=a.useCallback(o=>{h(w=>{if(w.length>0&&w[w.length-1].seq>=o.seq&&w.some(M=>M.seq===o.seq))return w;const N=[...w,o];return N.length>ms?N.slice(-ms):N})},[]),R=a.useCallback(async()=>{const o=u[0];if(!o)return 0;try{const w=await te(`/api/logs/range?before=${o.seq}&limit=200`);return!w||w.length===0?0:(h(N=>{const M=new Set(N.map($=>$.seq));return[...w.filter($=>!M.has($.seq)),...N]}),w.length)}catch{return 0}},[u]),B=a.useCallback((o,w,N,M)=>{ie(),N==="start"&&A(I=>I.size===0?I:new Map),v(I=>{const $=I[I.length-1];if(N==="start"){const O=Date.now();if($&&$.role==="assistant"){const P=Ce($.segments,{type:"tool_call",name:o,args:w,startTime:O});return[...I.slice(0,-1),{...$,segments:P}]}return Y.current=!0,[...I,{role:"assistant",content:"",segments:[{type:"tool_call",name:o,args:w,startTime:O}],timestamp:Date.now()}]}if($&&$.role==="assistant"&&$.segments){const O=Date.now(),P=[...$.segments];for(let se=P.length-1;se>=0;se--){const K=P[se];if(K.type==="tool_call"&&K.name===o&&K.result==null)return P[se]={...K,result:M,endTime:O},[...I.slice(0,-1),{...$,segments:P}]}}return I})},[ie]),W=a.useCallback(()=>{te("/api/plugins").then(o=>L(o.plugins??[])).catch(()=>{})},[]),me=a.useCallback(()=>{te("/api/config").then(k).catch(()=>{})},[]),ee=a.useCallback(()=>{te("/api/services").then(o=>C(o.services??null)).catch(()=>{})},[]),X=a.useCallback(()=>{te("/api/pages").then(o=>{d(o),r(new Set(o.map(w=>w.key)))}).catch(()=>{})},[]),le=a.useCallback(()=>{W(),ee(),X(),S.refresh(),te("/api/status").then(l).catch(()=>{})},[W,ee,X,S.refresh]),Oe=a.useCallback(()=>{U(!0),xe(!1),re("正在重启…")},[]),ge=a.useCallback(()=>{ve(!0),re("正在切换前端,即将刷新…")},[]),$s=a.useCallback(()=>{S.refresh(),D(o=>o+1)},[S.refresh]),Is=a.useCallback(o=>{y(o)},[]),Ms=a.useCallback((o,w,N,M,I)=>{v($=>{let O=N&&N.length>0?N:[];O.length===0&&(w&&O.push({type:"reasoning_text",content:w}),o&&O.push({type:"text",content:o}));const P=$[$.length-1];return P&&P.role==="assistant"?[...$.slice(0,-1),{...P,content:o,reasoningContent:w||P.reasoningContent,segments:O}]:[...$,{role:"assistant",content:o,reasoningContent:w||void 0,segments:O,timestamp:Date.now()}]}),M||(Y.current=!0,F(!0)),I&&I.length>0?A(new Map(I.map($=>[$.index,{name:$.name,charsAccumulated:$.charsAccumulated,startedAt:$.startedAt}]))):A($=>$.size===0?$:new Map)},[]),Ts=a.useCallback(o=>{A(w=>{const N=new Map(w),M=N.get(o.index);return N.set(o.index,{name:o.name,charsAccumulated:o.charsAccumulated,startedAt:(M==null?void 0:M.startedAt)??Date.now()}),N})},[]),Es=a.useCallback(()=>{A(o=>o.size===0?o:new Map)},[]),Ls=a.useCallback(o=>{Ne(!0),v(w=>[...w,{role:"assistant",content:o,segments:[{type:"text",content:o}],timestamp:Date.now()}])},[]),Rs=a.useCallback(o=>{Pe(o)},[]),Ds=a.useCallback((o,w)=>{o===oe()&&(be(w),w==="done"?(v(N=>[...N,{role:"system",content:"对话已压缩",timestamp:Date.now()}]),setTimeout(()=>be(null),1500)):w==="error"&&setTimeout(()=>be(null),3e3))},[]),{send:Se,sendRaw:Re,connected:fe}=ot({onMessage:ze,onStream:Le,onLog:j,onToolCall:B,onStateChanged:le,onRestarting:Oe,onReload:ge,onSessionsChanged:$s,onTodoUpdated:Is,onStreamResume:Ms,onConfirm:Ls,onTokenUsage:Rs,onCompressing:Ds,onHistoryChanged:S.handleHistoryChanged,onToolCallProgress:Ts,onToolCallProgressClear:Es}),Ps=a.useCallback(()=>{Re({type:"compress",sessionId:oe()})},[Re]);a.useEffect(()=>{z&&!fe&&(xe(!0),re("等待服务器重启…"))},[z,fe]),a.useEffect(()=>{if(z&&Q&&fe){re("服务器已就绪,即将刷新…");const o=setTimeout(()=>window.location.reload(),800);return()=>clearTimeout(o)}},[z,Q,fe]),a.useEffect(()=>{if(ue){const o=setTimeout(()=>window.location.reload(),1500);return()=>clearTimeout(o)}},[ue]),a.useEffect(()=>{te("/api/status").then(l).catch(()=>{}),te("/api/auth/status").then(o=>x(o.authed&&o.identity?{identity:o.identity,isOwner:!0}:null)).catch(()=>{}),me(),W(),ee(),X(),S.refresh(),te("/api/logs/tail?limit=200").then(h).catch(()=>{})},[W,me,ee,X,S.refresh]),a.useEffect(()=>{const o=S.activeSessionId;if(!o||o==="__new_chat__"){y([]);return}de("@aalis/plugin-todo-list","getTodos",{sessionId:o}).then(w=>y(w??[])).catch(()=>y([]))},[S.activeSessionId]),a.useEffect(()=>{const o=setInterval(()=>{te("/api/status").then(l).catch(()=>{}),W(),ee(),X(),S.refresh()},3e4);return()=>clearInterval(o)},[W,ee,X,S.refresh]);const Fe=a.useCallback(()=>{Re({type:"abort",sessionId:oe()}),F(!1),_(!1),Y.current=!1},[Re]),As=a.useCallback(()=>{v(o=>[...o,{role:"user",content:"[请继续执行未完成的工具调用]",timestamp:Date.now()}]),Se("[请继续执行未完成的工具调用]"),_(!1),F(!0)},[Se]),zs=a.useCallback(()=>{const o=S.activeSessionId;!o||o==="__new_chat__"||(de("@aalis/plugin-todo-list","clearTodos",{sessionId:o}).catch(()=>{}),y([]))},[S.activeSessionId]),Os=a.useCallback(async(o,w,N,M)=>{const I=o.trim();if(we){if(!I)return;Ne(!1),v(K=>[...K,{role:"user",content:I,timestamp:Date.now()}]),Se(I);return}if(q&&Fe(),!I&&N.length===0&&w.length===0)return;await S.ensureSession();const $=N.length>0?[...N]:void 0,O=[];let P=0,se=0;if(M.length>0){for(const K of M)if(K==="image"&&P<N.length)O.push({kind:"image",data:N[P++]});else if(K==="file"&&se<w.length){const ne=w[se++],pe=ne.mimeType??"",Be=pe.startsWith("audio/")?"audio":pe.startsWith("video/")?"video":"file";O.push({kind:Be,data:ne.data,mimeType:pe,name:ne.name})}}for(;P<N.length;)O.push({kind:"image",data:N[P++]});for(;se<w.length;){const K=w[se++],ne=K.mimeType??"",pe=ne.startsWith("audio/")?"audio":ne.startsWith("video/")?"video":"file";O.push({kind:pe,data:K.data,mimeType:ne,name:K.name})}v(K=>[...K,{role:"user",content:I,images:$,fileNames:w.map(ne=>ne.name),timestamp:Date.now()}]),_(!1),F(!0),Se(I,O.length>0?O:void 0)},[we,q,Se,Fe,S]),We={dashboard:e.jsx(Qs,{}),marketplace:e.jsx(et,{}),"plugin-config":e.jsx(st,{}),platforms:e.jsx(nt,{}),authority:e.jsx(at,{}),files:e.jsx(rt,{}),logs:e.jsx(tt,{})},Fs=e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18M3 9h18"})]}),Ws=(o,w)=>We[o]?We[o]:w&&w.trimStart().startsWith("<svg")?e.jsx("span",{className:"nav-item-svg",dangerouslySetInnerHTML:{__html:w}}):Fs,ts=a.useMemo(()=>n?i.filter(o=>n.has(o.key)).map(o=>({key:o.key,label:o.label,pluginDisplayName:o.pluginDisplayName,icon:Ws(o.key,o.icon),order:o.order??99})).sort((o,w)=>o.order-w.order):Object.entries(We).map(([o,w],N)=>({key:o,label:o,icon:w,order:(N+1)*10})),[n,i]),qs=(o,w)=>{switch(o){case"dashboard":return e.jsx(Qt,{status:m,connected:fe,plugins:c,servicesData:E,onRefreshServices:ee});case"marketplace":return e.jsx(Mn,{plugins:c,onRefresh:W});case"plugin-config":return e.jsx(In,{plugins:c,config:g,onRefresh:W,onConfigSaved:me,onRestart:()=>{U(!0),xe(!1),re("正在重启…")}});case"platforms":return e.jsx(Tn,{});case"authority":return e.jsx(En,{});case"logs":return e.jsx(Ln,{logs:u,onLoadOlder:R});case"files":return e.jsx(Dn,{});case"sessions":return e.jsx(Rn,{pluginName:w,activeSessionId:S.activeSessionId,onSwitchSession:N=>{S.switchSession(N)},onStartNewChat:()=>S.startNewChat(),refreshSignal:b});default:return null}},ce=i.find(o=>o.key===t),qe=ce!=null&&ce.content?ce:void 0;return e.jsxs("div",{className:"app-layout",children:[e.jsxs("nav",{className:"nav-rail",children:[e.jsxs("div",{className:"nav-rail-top",children:[e.jsx("div",{className:"nav-logo",children:"A"}),ts.map(o=>e.jsxs("button",{className:`nav-item ${t===o.key?"active":""}`,onClick:()=>s(o.key),children:[e.jsx("span",{className:"nav-item-icon",children:o.icon}),e.jsx("span",{className:"nav-item-label",children:o.label})]},o.key))]}),e.jsx("div",{className:"nav-rail-bottom",children:e.jsx("div",{className:`nav-status ${fe?"online":"offline"}`,title:fe?"已连接":"离线"})})]}),e.jsxs("main",{className:"content-area",children:[e.jsxs("div",{className:"content-header",children:[e.jsx("span",{className:"content-title",children:(ns=ts.find(o=>o.key===t))==null?void 0:ns.label}),p&&e.jsxs("span",{className:"content-user",title:`${p.identity.platform}:${p.identity.userId}`,children:[e.jsxs("span",{style:{fontSize:12,opacity:.7},children:[p.identity.platform,":",p.identity.userId]}),p.isOwner&&e.jsx("span",{className:"content-user-level",children:"owner"}),e.jsx("button",{className:"btn-sm",onClick:async()=>{await fetch("/api/auth/logout",{method:"POST"}),window.location.reload()},children:"退出"})]})]}),e.jsx("div",{className:"content-body",children:e.jsxs(a.Suspense,{fallback:e.jsx("div",{className:"empty-hint",style:{padding:24},children:"加载中…"}),children:[qe&&e.jsx(Pn,{page:qe}),!qe&&(ce==null?void 0:ce.renderer)&&(qs(ce.renderer,ce.plugin)||e.jsxs("div",{className:"empty-hint",style:{padding:24},children:["此客户端不支持渲染器「",ce.renderer,"」"]}))]})})]}),e.jsx("div",{className:"resize-handle",onMouseDown:o=>{var pe;o.preventDefault();const w=o.clientX,N=V,M=((pe=document.querySelector(".app-layout"))==null?void 0:pe.clientWidth)??window.innerWidth,I=document.querySelector(".nav-rail"),$=(I==null?void 0:I.getBoundingClientRect().width)??56,O=360,P=280,se=Math.max(P,M-$-O);document.body.classList.add("is-dragging-chat");const K=Be=>{const Bs=N-(Be.clientX-w);J(Math.max(P,Math.min(se,Bs)))},ne=()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",ne),document.body.style.cursor="",document.body.style.userSelect="",document.body.classList.remove("is-dragging-chat")};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",K),document.addEventListener("mouseup",ne)}}),e.jsx("div",{className:"chat-column",style:{width:V},children:e.jsx($n,{messages:G,loading:q,connected:fe,status:m,onSend:Os,onAbort:Fe,width:V,sessionTitle:S.isNewChat?"新对话":S.activeSessionTitle,onNewSession:S.pluginName?()=>S.startNewChat():void 0,todoItems:f,onClearTodos:zs,toolLimitReached:ae,onContinueTools:As,toolCallsProgress:T,tokenUsage:ke,compressingStatus:Ae,onCompress:Ps})}),(z||ue)&&e.jsx("div",{className:"restart-overlay",children:e.jsxs("div",{className:"restart-dialog",children:[e.jsx("div",{className:"restart-spinner"}),e.jsx("h3",{children:ue?"切换前端":"正在重启…"}),e.jsx("p",{className:"restart-desc",children:ye})]})})]})}Hs.createRoot(document.getElementById("root")).render(e.jsx(An,{}));export{os as B,vs as C,It as D,Rt as F,Te as M,Me as R,Ht as S,De as T,ss as W,Ns as X,he as _,te as a,ct as b,H as c,Ie as d,$e as e,qt as f,Et as g,Kt as h,de as p};
207
+ `)),Z(ge=>new Set([...ge,j.turnId]))}catch(X){window.alert(`回滚失败:${X.message}`)}},[]),V=a.useRef(null),J=a.useRef(!1),[ae,_]=a.useState(!1),T=a.useRef(0),[A,z]=a.useState(!1),[U,Q]=a.useState(!1),[xe,ue]=a.useState(null),ve=a.useRef(0),ye=a.useRef(0);a.useEffect(()=>{const j=B=>{const W=B.detail;typeof W=="string"&&ue(W)},R=B=>{B.key==="Escape"&&ue(null)};return window.addEventListener(es,j),window.addEventListener("keydown",R),()=>{window.removeEventListener(es,j),window.removeEventListener("keydown",R)}},[]);const re=r==null?void 0:r.uploadCapabilities,we=(re==null?void 0:re.image)??!1,Ne=(re==null?void 0:re.file)??!1,ke=we||Ne,Pe=bn(re);a.useEffect(()=>{L==="start"?(ve.current=Date.now(),ye.current=0):(L==="done"||L==="error")&&(ye.current=Date.now())},[L]),a.useEffect(()=>{const j=G.current;if(!j)return;const R=()=>{const{scrollTop:B,scrollHeight:W,clientHeight:me}=j;v.current=W-B-me>200,J.current=!0,V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{J.current=!1},300)};return j.addEventListener("scroll",R,{passive:!0}),()=>j.removeEventListener("scroll",R)},[]),a.useEffect(()=>{const j=G.current;if(!j)return;const R=new ResizeObserver(()=>{var B;!v.current&&!J.current&&((B=S.current)==null||B.scrollIntoView({behavior:s?"instant":"smooth"}))});return R.observe(j),()=>R.disconnect()},[t.length]),a.useEffect(()=>{var j;!v.current&&!J.current&&((j=S.current)==null||j.scrollIntoView({behavior:"smooth"}))},[t]);const Ae=a.useCallback((j,R,B,W)=>i(j,R,B,W),[i]),be=j=>{j.preventDefault(),j.stopPropagation(),T.current++,ke&&j.dataTransfer.types.includes("Files")&&_(!0)},Ce=j=>{j.preventDefault(),j.stopPropagation(),T.current--,T.current<=0&&(T.current=0,_(!1))},Ee=j=>{j.preventDefault(),j.stopPropagation()},ze=async j=>{var R;j.preventDefault(),j.stopPropagation(),T.current=0,_(!1),!(!ke||!j.dataTransfer.files.length)&&await((R=C.current)==null?void 0:R.addFiles(j.dataTransfer.files))},ie=t[t.length-1],Le=(ie==null?void 0:ie.role)==="assistant"&&s;return e.jsxs("div",{className:`chat-panel${ae?" drag-over":""}`,style:{width:u},onDragEnter:be,onDragLeave:Ce,onDragOver:Ee,onDrop:ze,children:[ae&&e.jsx("div",{className:"drag-overlay",children:e.jsxs("div",{className:"drag-overlay-content",children:[e.jsx(ws,{size:16})," 松开以上传文件"]})}),e.jsxs("div",{className:"chat-panel-header",children:[e.jsxs("span",{className:"chat-panel-title",children:[e.jsx(is,{size:16})," ",h||(r==null?void 0:r.name)||"Aalis"]}),e.jsxs("div",{className:"chat-panel-header-actions",children:[e.jsxs("div",{className:"token-usage-badge",onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1),children:[e.jsx(ks,{size:12}),e.jsx("span",{className:`token-usage-number${c&&c.usageRatio>.85?" warn":c&&c.usageRatio>.7?" caution":""}`,children:c?c.used.toLocaleString():"--"}),A&&e.jsxs("div",{className:"token-usage-panel",children:[e.jsx("div",{className:"token-panel-title",children:"Token 使用情况"}),c?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"token-panel-bar",children:e.jsx("div",{className:`token-panel-bar-fill${c.usageRatio>.85?" warn":c.usageRatio>.7?" caution":""}`,style:{width:`${Math.min(100,c.usageRatio*100)}%`}})}),e.jsxs("div",{className:"token-panel-ratio",children:[(c.usageRatio*100).toFixed(1),"% 已使用"]}),e.jsxs("div",{className:"token-panel-rows",children:[e.jsxs("div",{className:"token-panel-row",children:[e.jsx("span",{children:"上下文窗口"}),e.jsx("span",{children:c.contextWindow.toLocaleString()})]}),e.jsxs("div",{className:"token-panel-section-header",children:["系统提示词 ",e.jsx("span",{className:"token-panel-section-total",children:c.breakdown.system.toLocaleString()})]}),e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"人设 / Persona"}),e.jsx("span",{children:c.breakdown.persona.toLocaleString()})]}),c.breakdown.memorySummary>0&&e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"对话摘要"}),e.jsx("span",{children:c.breakdown.memorySummary.toLocaleString()})]}),c.breakdown.memoryVector>0&&e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"向量记忆"}),e.jsx("span",{children:c.breakdown.memoryVector.toLocaleString()})]}),c.breakdown.skills>0&&e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"技能描述"}),e.jsx("span",{children:c.breakdown.skills.toLocaleString()})]}),c.breakdown.platform>0&&e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"平台提示"}),e.jsx("span",{children:c.breakdown.platform.toLocaleString()})]}),c.breakdown.subtask>0&&e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"子任务上下文"}),e.jsx("span",{children:c.breakdown.subtask.toLocaleString()})]}),c.breakdown.systemOther>0&&e.jsxs("div",{className:"token-panel-row sub",children:[e.jsx("span",{children:"其他系统提示"}),e.jsx("span",{children:c.breakdown.systemOther.toLocaleString()})]}),e.jsxs("div",{className:"token-panel-row",children:[e.jsx("span",{children:"历史消息"}),e.jsx("span",{children:c.breakdown.history.toLocaleString()})]}),e.jsxs("div",{className:"token-panel-row",children:[e.jsx("span",{children:"工具结果"}),e.jsx("span",{children:c.breakdown.toolResults.toLocaleString()})]}),e.jsxs("div",{className:"token-panel-row",children:[e.jsx("span",{children:"工具定义"}),e.jsx("span",{children:c.breakdown.toolDefs.toLocaleString()})]}),e.jsxs("div",{className:"token-panel-row",children:[e.jsx("span",{children:"回复保留量"}),e.jsx("span",{children:c.breakdown.reservedForReply.toLocaleString()})]})]}),E&&e.jsx("button",{className:"token-panel-compress-btn",onClick:j=>{j.stopPropagation(),E()},disabled:L==="start",children:L==="start"?e.jsxs(e.Fragment,{children:[e.jsx(Qe,{size:12,className:"compress-spinner"})," 压缩中…"]}):e.jsxs(e.Fragment,{children:[e.jsx(gs,{size:12})," 压缩对话"]})})]}):e.jsx("div",{className:"token-panel-empty",children:"发送消息后将显示 Token 用量统计"})]})]}),m&&e.jsx("button",{className:"chat-panel-new-btn",onClick:m,title:"新对话",children:"+"}),e.jsx("button",{className:"chat-panel-new-btn",onClick:()=>Q(j=>!j),title:"已上传的文件","aria-label":"已上传的文件",children:e.jsx(Rt,{size:14})})]})]}),e.jsx(mn,{open:U,onClose:()=>Q(!1),sessionId:oe()}),e.jsxs("div",{className:"messages",ref:G,children:[t.length===0&&e.jsxs("div",{className:"empty",children:[e.jsx("div",{className:"empty-icon",children:e.jsx(is,{size:40})}),"开始和 ",(r==null?void 0:r.name)??"Aalis"," 对话吧"]}),t.map((j,R)=>{const B=R===t.length-1;return e.jsx(_n,{msg:j,senderName:(r==null?void 0:r.name)??"Aalis",isLast:B,isGenerating:Le,onAbort:d,checkpoint:j.role==="assistant"?D(j.timestamp):void 0,rolledBack:j.role==="assistant"?(()=>{const W=D(j.timestamp);return W?Y.has(W.turnId):!1})():!1,onRollback:f,onRollbackWithChat:y,toolCallsProgress:B&&j.role==="assistant"&&Le?k:void 0},R)}),s&&(!ie||ie.role!=="assistant")&&e.jsxs("div",{className:"message-group assistant",children:[e.jsx("div",{className:"message-sender",children:(r==null?void 0:r.name)??"Aalis"}),e.jsx("div",{className:"message-bubble",children:k&&k.size>0?[...k.entries()].sort((j,R)=>j[0]-R[0]).map(([j,R])=>e.jsx(_s,{name:R.name,charsAccumulated:R.charsAccumulated,startedAt:R.startedAt},`pending-${j}`)):e.jsxs("div",{className:"typing-indicator",children:[e.jsx("span",{}),e.jsx("span",{}),e.jsx("span",{})]})}),e.jsx("button",{className:"stop-generate-btn",onClick:d,title:"停止生成",children:"■ 停止生成"})]}),x&&!s&&e.jsxs("div",{className:"tool-limit-bar",children:[e.jsx("span",{className:"tool-limit-text",children:"⚠ 工具调用次数已达上限"}),e.jsxs("div",{className:"tool-limit-actions",children:[g&&e.jsx("button",{className:"tool-limit-btn continue",onClick:g,children:"继续迭代"}),e.jsx("span",{className:"tool-limit-hint",children:"或输入新内容引导模型"})]})]}),L==="start"&&e.jsxs("div",{className:"system-event-separator compressing",children:[e.jsx("span",{className:"system-event-line"}),e.jsxs("span",{className:"system-event-text",children:[e.jsx(Qe,{size:12,className:"compress-spinner"})," 压缩对话中 ",e.jsx(us,{startTime:ve.current})]}),e.jsx("span",{className:"system-event-line"})]}),L==="done"&&e.jsxs("div",{className:"system-event-separator compress-done",children:[e.jsx("span",{className:"system-event-line"}),e.jsxs("span",{className:"system-event-text",children:[e.jsx(ys,{size:12})," 已压缩对话 ",e.jsx(us,{startTime:ve.current,endTime:ye.current})]}),e.jsx("span",{className:"system-event-line"})]}),L==="error"&&e.jsxs("div",{className:"system-event-separator compress-error",children:[e.jsx("span",{className:"system-event-line"}),e.jsxs("span",{className:"system-event-text",children:[e.jsx(De,{size:12})," 压缩失败"]}),e.jsx("span",{className:"system-event-line"})]}),e.jsx("div",{ref:S})]}),l&&l.length>0&&p&&e.jsx(Sn,{items:l,onClear:p,loading:s}),e.jsx(fn,{ref:C,loading:s,connected:n,canUpload:ke,canUploadImage:we,canUploadFile:Ne,acceptAttr:Pe,onSend:Ae,onAbort:d}),xe&&e.jsxs("div",{className:"image-lightbox",onClick:()=>ue(null),children:[e.jsx("img",{src:xe,alt:"预览",className:"image-lightbox-content",onClick:j=>j.stopPropagation()}),e.jsx("button",{type:"button",className:"image-lightbox-close",onClick:()=>ue(null),"aria-label":"关闭",children:"×"})]})]})}const In=a.lazy(()=>he(()=>import("./PluginConfigPage-BEBeoZAt.js"),__vite__mapDeps([2,1,3,4,5,6,7,8,9])).then(t=>({default:t.PluginConfigPage}))),Mn=a.lazy(()=>he(()=>import("./MarketplacePage-ClOWoNMz.js"),__vite__mapDeps([10,1,4,11,5,6,7,8,9])).then(t=>({default:t.MarketplacePage}))),Tn=a.lazy(()=>he(()=>import("./PlatformPage-BKcwv7lV.js"),__vite__mapDeps([12,1,13,5,6,7,8,9])).then(t=>({default:t.PlatformPage}))),En=a.lazy(()=>he(()=>import("./AuthorityPage-jj192bfx.js"),__vite__mapDeps([14,1,11,5,6,7,8,9])).then(t=>({default:t.AuthorityPage}))),Ln=a.lazy(()=>he(()=>import("./LogPage-C_Z3RA5T.js"),__vite__mapDeps([15,1])).then(t=>({default:t.LogPage}))),Rn=a.lazy(()=>he(()=>import("./SessionsPage-D0IEwawu.js"),__vite__mapDeps([16,1,9,7,8,5,6])).then(t=>({default:t.SessionsPage}))),Dn=a.lazy(()=>he(()=>import("./FilesPage-BMbRlFyJ.js"),__vite__mapDeps([17,1,5,6,7,8,9])).then(t=>({default:t.FilesPage}))),Pn=a.lazy(()=>he(()=>import("./DynamicPage-BCvX1Tg2.js"),__vite__mapDeps([18,1,3,19,20,13,11,9,7,8,5,6])).then(t=>({default:t.DynamicPage}))),ms=2e3;function An(){var ns;const[t,s]=a.useState(()=>location.hash.replace("#","")||"dashboard"),[n,r]=a.useState(null),[i,d]=a.useState([]);a.useEffect(()=>{location.hash=t},[t]),a.useEffect(()=>{n&&!n.has(t)&&s("dashboard")},[n,t]);const[u,h]=a.useState([]),[m,l]=a.useState(null),[p,x]=a.useState(null),[g,k]=a.useState(null),[c,L]=a.useState([]),[E,C]=a.useState(null),S=dt(i),{messages:G,setMessages:v,loading:q,setLoading:F,streamingRef:Y}=S,Z=a.useRef({pending:[],raf:0}),[b,D]=a.useState(0),[f,y]=a.useState([]),[V,J]=a.useState(()=>{if(typeof window>"u")return 420;const o=Number(window.localStorage.getItem("aalis:chatWidth"));return Number.isFinite(o)&&o>=280?o:420});a.useEffect(()=>{try{window.localStorage.setItem("aalis:chatWidth",String(V))}catch{}},[V]),a.useEffect(()=>{const o=document.querySelector(".app-layout");if(!o||typeof ResizeObserver>"u")return;const w=360,N=240,M=()=>{var se;const $=o.clientWidth,O=((se=document.querySelector(".nav-rail"))==null?void 0:se.getBoundingClientRect().width)??56,P=Math.max(N,$-O-w);J(K=>Math.min(Math.max(K,N),P))},I=new ResizeObserver(M);return I.observe(o),()=>I.disconnect()},[]);const[ae,_]=a.useState(!1),[T,A]=a.useState(new Map),[z,U]=a.useState(!1),[Q,xe]=a.useState(!1),[ue,ve]=a.useState(!1),[ye,re]=a.useState("正在重启…"),[we,Ne]=a.useState(!1),[ke,Pe]=a.useState(null),[Ae,be]=a.useState(null),Ce=(o,w)=>{const N=o?[...o]:[],M=N[N.length-1];return w.type==="text"&&M&&M.type==="text"?N[N.length-1]={type:"text",content:M.content+w.content}:w.type==="reasoning_text"&&M&&M.type==="reasoning_text"?N[N.length-1]={type:"reasoning_text",content:M.content+w.content}:N.push(w),N},Ee=o=>{let w="",N="";for(const M of o??[])M.type==="text"?w+=M.content:M.type==="reasoning_text"&&(N+=M.content);return{content:w,reasoning:N}},ze=a.useCallback((o,w,N,M,I)=>{Z.current.raf&&(cancelAnimationFrame(Z.current.raf),Z.current.raf=0),Z.current.pending=[],v($=>{const O=$[$.length-1],P=N&&N.length>0?N:w?[{type:"reasoning_text",content:w},{type:"text",content:o}]:[{type:"text",content:o}];return O&&O.role==="assistant"&&Y.current?(Y.current=!1,[...$.slice(0,-1),{...O,content:o,reasoningContent:w??O.reasoningContent,segments:P,attachments:M??O.attachments,modelInfo:I??O.modelInfo}]):(Y.current=!1,[...$,{role:"assistant",content:o,reasoningContent:w,segments:P,attachments:M,modelInfo:I,timestamp:Date.now()}])}),F(!1)},[]),ie=a.useCallback(()=>{const o=Z.current;if(o.raf&&(cancelAnimationFrame(o.raf),o.raf=0),o.pending.length===0)return;const w=o.pending;o.pending=[],v(N=>{const M=N[N.length-1];if(M&&M.role==="assistant"&&Y.current){let P=M.segments??[];for(const ne of w)P=Ce(P,{type:ne.kind==="content"?"text":"reasoning_text",content:ne.text});const{content:se,reasoning:K}=Ee(P);return[...N.slice(0,-1),{...M,content:se,reasoningContent:K||void 0,segments:P}]}Y.current=!0;let I=[];for(const P of w)I=Ce(I,{type:P.kind==="content"?"text":"reasoning_text",content:P.text});const{content:$,reasoning:O}=Ee(I);return[...N,{role:"assistant",content:$,reasoningContent:O||void 0,segments:I,timestamp:Date.now()}]})},[v,Y]),Le=a.useCallback((o,w,N,M)=>{if(N){ie(),F(!1),_(!!M),A(new Map);return}(o||w)&&A($=>$.size===0?$:new Map);const I=Z.current;w&&I.pending.push({kind:"reasoning",text:w}),o&&I.pending.push({kind:"content",text:o}),!I.raf&&(I.raf=requestAnimationFrame(ie))},[ie,F]),j=a.useCallback(o=>{h(w=>{if(w.length>0&&w[w.length-1].seq>=o.seq&&w.some(M=>M.seq===o.seq))return w;const N=[...w,o];return N.length>ms?N.slice(-ms):N})},[]),R=a.useCallback(async()=>{const o=u[0];if(!o)return 0;try{const w=await te(`/api/logs/range?before=${o.seq}&limit=200`);return!w||w.length===0?0:(h(N=>{const M=new Set(N.map($=>$.seq));return[...w.filter($=>!M.has($.seq)),...N]}),w.length)}catch{return 0}},[u]),B=a.useCallback((o,w,N,M)=>{ie(),N==="start"&&A(I=>I.size===0?I:new Map),v(I=>{const $=I[I.length-1];if(N==="start"){const O=Date.now();if($&&$.role==="assistant"){const P=Ce($.segments,{type:"tool_call",name:o,args:w,startTime:O});return[...I.slice(0,-1),{...$,segments:P}]}return Y.current=!0,[...I,{role:"assistant",content:"",segments:[{type:"tool_call",name:o,args:w,startTime:O}],timestamp:Date.now()}]}if($&&$.role==="assistant"&&$.segments){const O=Date.now(),P=[...$.segments];for(let se=P.length-1;se>=0;se--){const K=P[se];if(K.type==="tool_call"&&K.name===o&&K.result==null)return P[se]={...K,result:M,endTime:O},[...I.slice(0,-1),{...$,segments:P}]}}return I})},[ie]),W=a.useCallback(()=>{te("/api/plugins").then(o=>L(o.plugins??[])).catch(()=>{})},[]),me=a.useCallback(()=>{te("/api/config").then(k).catch(()=>{})},[]),ee=a.useCallback(()=>{te("/api/services").then(o=>C(o.services??null)).catch(()=>{})},[]),X=a.useCallback(()=>{te("/api/pages").then(o=>{d(o),r(new Set(o.map(w=>w.key)))}).catch(()=>{})},[]),le=a.useCallback(()=>{W(),ee(),X(),S.refresh(),te("/api/status").then(l).catch(()=>{})},[W,ee,X,S.refresh]),Oe=a.useCallback(()=>{U(!0),xe(!1),re("正在重启…")},[]),ge=a.useCallback(()=>{ve(!0),re("正在切换前端,即将刷新…")},[]),$s=a.useCallback(()=>{S.refresh(),D(o=>o+1)},[S.refresh]),Is=a.useCallback(o=>{y(o)},[]),Ms=a.useCallback((o,w,N,M,I)=>{v($=>{let O=N&&N.length>0?N:[];O.length===0&&(w&&O.push({type:"reasoning_text",content:w}),o&&O.push({type:"text",content:o}));const P=$[$.length-1];return P&&P.role==="assistant"?[...$.slice(0,-1),{...P,content:o,reasoningContent:w||P.reasoningContent,segments:O}]:[...$,{role:"assistant",content:o,reasoningContent:w||void 0,segments:O,timestamp:Date.now()}]}),M||(Y.current=!0,F(!0)),I&&I.length>0?A(new Map(I.map($=>[$.index,{name:$.name,charsAccumulated:$.charsAccumulated,startedAt:$.startedAt}]))):A($=>$.size===0?$:new Map)},[]),Ts=a.useCallback(o=>{A(w=>{const N=new Map(w),M=N.get(o.index);return N.set(o.index,{name:o.name,charsAccumulated:o.charsAccumulated,startedAt:(M==null?void 0:M.startedAt)??Date.now()}),N})},[]),Es=a.useCallback(()=>{A(o=>o.size===0?o:new Map)},[]),Ls=a.useCallback(o=>{Ne(!0),v(w=>[...w,{role:"assistant",content:o,segments:[{type:"text",content:o}],timestamp:Date.now()}])},[]),Rs=a.useCallback(o=>{Pe(o)},[]),Ds=a.useCallback((o,w)=>{o===oe()&&(be(w),w==="done"?(v(N=>[...N,{role:"system",content:"对话已压缩",timestamp:Date.now()}]),setTimeout(()=>be(null),1500)):w==="error"&&setTimeout(()=>be(null),3e3))},[]),{send:Se,sendRaw:Re,connected:fe}=ot({onMessage:ze,onStream:Le,onLog:j,onToolCall:B,onStateChanged:le,onRestarting:Oe,onReload:ge,onSessionsChanged:$s,onTodoUpdated:Is,onStreamResume:Ms,onConfirm:Ls,onTokenUsage:Rs,onCompressing:Ds,onHistoryChanged:S.handleHistoryChanged,onToolCallProgress:Ts,onToolCallProgressClear:Es}),Ps=a.useCallback(()=>{Re({type:"compress",sessionId:oe()})},[Re]);a.useEffect(()=>{z&&!fe&&(xe(!0),re("等待服务器重启…"))},[z,fe]),a.useEffect(()=>{if(z&&Q&&fe){re("服务器已就绪,即将刷新…");const o=setTimeout(()=>window.location.reload(),800);return()=>clearTimeout(o)}},[z,Q,fe]),a.useEffect(()=>{if(ue){const o=setTimeout(()=>window.location.reload(),1500);return()=>clearTimeout(o)}},[ue]),a.useEffect(()=>{te("/api/status").then(l).catch(()=>{}),te("/api/auth/status").then(o=>x(o.authed&&o.identity?{identity:o.identity,isOwner:!0}:null)).catch(()=>{}),me(),W(),ee(),X(),S.refresh(),te("/api/logs/tail?limit=200").then(h).catch(()=>{})},[W,me,ee,X,S.refresh]),a.useEffect(()=>{const o=S.activeSessionId;if(!o||o==="__new_chat__"){y([]);return}de("@aalis/plugin-todo-list","getTodos",{sessionId:o}).then(w=>y(w??[])).catch(()=>y([]))},[S.activeSessionId]),a.useEffect(()=>{const o=setInterval(()=>{te("/api/status").then(l).catch(()=>{}),W(),ee(),X(),S.refresh()},3e4);return()=>clearInterval(o)},[W,ee,X,S.refresh]);const Fe=a.useCallback(()=>{Re({type:"abort",sessionId:oe()}),F(!1),_(!1),Y.current=!1},[Re]),As=a.useCallback(()=>{v(o=>[...o,{role:"user",content:"[请继续执行未完成的工具调用]",timestamp:Date.now()}]),Se("[请继续执行未完成的工具调用]"),_(!1),F(!0)},[Se]),zs=a.useCallback(()=>{const o=S.activeSessionId;!o||o==="__new_chat__"||(de("@aalis/plugin-todo-list","clearTodos",{sessionId:o}).catch(()=>{}),y([]))},[S.activeSessionId]),Os=a.useCallback(async(o,w,N,M)=>{const I=o.trim();if(we){if(!I)return;Ne(!1),v(K=>[...K,{role:"user",content:I,timestamp:Date.now()}]),Se(I);return}if(q&&Fe(),!I&&N.length===0&&w.length===0)return;await S.ensureSession();const $=N.length>0?[...N]:void 0,O=[];let P=0,se=0;if(M.length>0){for(const K of M)if(K==="image"&&P<N.length)O.push({kind:"image",data:N[P++]});else if(K==="file"&&se<w.length){const ne=w[se++],pe=ne.mimeType??"",Be=pe.startsWith("audio/")?"audio":pe.startsWith("video/")?"video":"file";O.push({kind:Be,data:ne.data,mimeType:pe,name:ne.name})}}for(;P<N.length;)O.push({kind:"image",data:N[P++]});for(;se<w.length;){const K=w[se++],ne=K.mimeType??"",pe=ne.startsWith("audio/")?"audio":ne.startsWith("video/")?"video":"file";O.push({kind:pe,data:K.data,mimeType:ne,name:K.name})}v(K=>[...K,{role:"user",content:I,images:$,fileNames:w.map(ne=>ne.name),timestamp:Date.now()}]),_(!1),F(!0),Se(I,O.length>0?O:void 0)},[we,q,Se,Fe,S]),We={dashboard:e.jsx(Qs,{}),marketplace:e.jsx(et,{}),"plugin-config":e.jsx(st,{}),platforms:e.jsx(nt,{}),authority:e.jsx(at,{}),files:e.jsx(rt,{}),logs:e.jsx(tt,{})},Fs=e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18M3 9h18"})]}),Ws=(o,w)=>We[o]?We[o]:w&&w.trimStart().startsWith("<svg")?e.jsx("span",{className:"nav-item-svg",dangerouslySetInnerHTML:{__html:w}}):Fs,ts=a.useMemo(()=>n?i.filter(o=>n.has(o.key)).map(o=>({key:o.key,label:o.label,pluginDisplayName:o.pluginDisplayName,icon:Ws(o.key,o.icon),order:o.order??99})).sort((o,w)=>o.order-w.order):Object.entries(We).map(([o,w],N)=>({key:o,label:o,icon:w,order:(N+1)*10})),[n,i]),qs=(o,w)=>{switch(o){case"dashboard":return e.jsx(Qt,{status:m,connected:fe,plugins:c,servicesData:E,onRefreshServices:ee});case"marketplace":return e.jsx(Mn,{plugins:c,onRefresh:W});case"plugin-config":return e.jsx(In,{plugins:c,config:g,onRefresh:W,onConfigSaved:me,onRestart:()=>{U(!0),xe(!1),re("正在重启…")}});case"platforms":return e.jsx(Tn,{});case"authority":return e.jsx(En,{});case"logs":return e.jsx(Ln,{logs:u,onLoadOlder:R});case"files":return e.jsx(Dn,{});case"sessions":return e.jsx(Rn,{pluginName:w,activeSessionId:S.activeSessionId,onSwitchSession:N=>{S.switchSession(N)},onStartNewChat:()=>S.startNewChat(),refreshSignal:b});default:return null}},ce=i.find(o=>o.key===t),qe=ce!=null&&ce.content?ce:void 0;return e.jsxs("div",{className:"app-layout",children:[e.jsxs("nav",{className:"nav-rail",children:[e.jsxs("div",{className:"nav-rail-top",children:[e.jsx("div",{className:"nav-logo",children:"A"}),ts.map(o=>e.jsxs("button",{className:`nav-item ${t===o.key?"active":""}`,onClick:()=>s(o.key),children:[e.jsx("span",{className:"nav-item-icon",children:o.icon}),e.jsx("span",{className:"nav-item-label",children:o.label})]},o.key))]}),e.jsx("div",{className:"nav-rail-bottom",children:e.jsx("div",{className:`nav-status ${fe?"online":"offline"}`,title:fe?"已连接":"离线"})})]}),e.jsxs("main",{className:"content-area",children:[e.jsxs("div",{className:"content-header",children:[e.jsx("span",{className:"content-title",children:(ns=ts.find(o=>o.key===t))==null?void 0:ns.label}),p&&e.jsxs("span",{className:"content-user",title:`${p.identity.platform}:${p.identity.userId}`,children:[e.jsxs("span",{style:{fontSize:12,opacity:.7},children:[p.identity.platform,":",p.identity.userId]}),p.isOwner&&e.jsx("span",{className:"content-user-level",children:"owner"}),e.jsx("button",{className:"btn-sm",onClick:async()=>{await fetch("/api/auth/logout",{method:"POST"}),window.location.reload()},children:"退出"})]})]}),e.jsx("div",{className:"content-body",children:e.jsxs(a.Suspense,{fallback:e.jsx("div",{className:"empty-hint",style:{padding:24},children:"加载中…"}),children:[qe&&e.jsx(Pn,{page:qe}),!qe&&(ce==null?void 0:ce.renderer)&&(qs(ce.renderer,ce.plugin)||e.jsxs("div",{className:"empty-hint",style:{padding:24},children:["此客户端不支持渲染器「",ce.renderer,"」"]}))]})})]}),e.jsx("div",{className:"resize-handle",onMouseDown:o=>{var pe;o.preventDefault();const w=o.clientX,N=V,M=((pe=document.querySelector(".app-layout"))==null?void 0:pe.clientWidth)??window.innerWidth,I=document.querySelector(".nav-rail"),$=(I==null?void 0:I.getBoundingClientRect().width)??56,O=360,P=280,se=Math.max(P,M-$-O);document.body.classList.add("is-dragging-chat");const K=Be=>{const Bs=N-(Be.clientX-w);J(Math.max(P,Math.min(se,Bs)))},ne=()=>{document.removeEventListener("mousemove",K),document.removeEventListener("mouseup",ne),document.body.style.cursor="",document.body.style.userSelect="",document.body.classList.remove("is-dragging-chat")};document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",K),document.addEventListener("mouseup",ne)}}),e.jsx("div",{className:"chat-column",style:{width:V},children:e.jsx($n,{messages:G,loading:q,connected:fe,status:m,onSend:Os,onAbort:Fe,width:V,sessionTitle:S.isNewChat?"新对话":S.activeSessionTitle,onNewSession:S.pluginName?()=>S.startNewChat():void 0,todoItems:f,onClearTodos:zs,toolLimitReached:ae,onContinueTools:As,toolCallsProgress:T,tokenUsage:ke,compressingStatus:Ae,onCompress:Ps})}),(z||ue)&&e.jsx("div",{className:"restart-overlay",children:e.jsxs("div",{className:"restart-dialog",children:[e.jsx("div",{className:"restart-spinner"}),e.jsx("h3",{children:ue?"切换前端":"正在重启…"}),e.jsx("p",{className:"restart-desc",children:ye})]})})]})}Hs.createRoot(document.getElementById("root")).render(e.jsx(An,{}));export{os as B,vs as C,It as D,Rt as F,Te as M,Me as R,Ht as S,De as T,ss as W,Ns as X,he as _,te as a,ct as b,H as c,Ie as d,$e as e,qt as f,Et as g,Kt as h,de as p};
@@ -1,2 +1,2 @@
1
- import{_ as a,l as o,I as i,e as n}from"./mermaid.core-1wU6KgsD.js";import{p}from"./wardley-L42UT6IY-B4LTGH2u.js";import"./index-AyT_VNlb.js";import"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-BCywGHw2.js";var g={parse:a(async r=>{const e=await p("info",r);o.debug(e)},"parse")},m={version:"11.15.0"},v=a(()=>m.version,"getVersion"),d={getVersion:v},c=a((r,e,s)=>{o.debug(`rendering info diagram
1
+ import{_ as a,l as o,I as i,e as n}from"./mermaid.core-DVy3DGpO.js";import{p}from"./wardley-L42UT6IY-BfNNTOAt.js";import"./index-BWwjYl1J.js";import"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-BCywGHw2.js";var g={parse:a(async r=>{const e=await p("info",r);o.debug(e)},"parse")},m={version:"11.15.0"},v=a(()=>m.version,"getVersion"),d={getVersion:v},c=a((r,e,s)=>{o.debug(`rendering info diagram
2
2
  `+r);const t=i(e);n(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${s}`)},"draw"),l={draw:c},z={parser:g,db:d,renderer:l};export{z as diagram};
@@ -1,4 +1,4 @@
1
- import{_ as o,c as ot,N as ut,I as dt,ap as yt,z as pt,k as ft,p as it,a as gt,b as kt,g as mt,s as wt,q as _t,e as bt}from"./mermaid.core-1wU6KgsD.js";import"./index-AyT_VNlb.js";import"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-BCywGHw2.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],p=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],B={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,f,n,v){var w=n.length-1;switch(f){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:p,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:p,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],f=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(C.yy[z]=this.yy[z]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function F(N){i.length=i.length-2*N,f.length=f.length-N,n.length=n.length-N}o(F,"popStack");function j(){var N;return N=u.pop()||b.lex()||E,typeof N!="number"&&(N instanceof Array&&(u=N,N=u.pop()),N=s.symbols_[N]||N),N}o(j,"lex");for(var A,W,P,K,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?P=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=j()),P=v[W]&&v[W][A]),typeof P>"u"||!P.length||!P[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`:
1
+ import{_ as o,c as ot,N as ut,I as dt,ap as yt,z as pt,k as ft,p as it,a as gt,b as kt,g as mt,s as wt,q as _t,e as bt}from"./mermaid.core-DVy3DGpO.js";import"./index-BWwjYl1J.js";import"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-BCywGHw2.js";var tt=(function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],p=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],B={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,f,n,v){var w=n.length-1;switch(f){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:p,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:p,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],f=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(C.yy[z]=this.yy[z]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function F(N){i.length=i.length-2*N,f.length=f.length-N,n.length=n.length-N}o(F,"popStack");function j(){var N;return N=u.pop()||b.lex()||E,typeof N!="number"&&(N instanceof Array&&(u=N,N=u.pop()),N=s.symbols_[N]||N),N}o(j,"lex");for(var A,W,P,K,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?P=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=j()),P=v[W]&&v[W][A]),typeof P>"u"||!P.length||!P[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`:
2
2
  `+b.showPosition()+`
3
3
  Expecting `+Y.join(", ")+", got '"+(this.terminals_[A]||A)+"'":Q="Parse error on line "+(I+1)+": Unexpected "+(A==E?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(Q,{text:b.match,token:this.terminals_[A]||A,line:b.yylineno,loc:T,expected:Y})}if(P[0]instanceof Array&&P.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(P[0]){case 1:i.push(A),f.push(b.yytext),n.push(b.yylloc),i.push(P[1]),A=null,S=b.yyleng,w=b.yytext,I=b.yylineno,T=b.yylloc;break;case 2:if(V=this.productions_[P[1]][1],H.$=f[f.length-V],H._$={first_line:n[n.length-(V||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(V||1)].first_column,last_column:n[n.length-1].last_column},D&&(H._$.range=[n[n.length-(V||1)].range[0],n[n.length-1].range[1]]),K=this.performAction.apply(H,[w,S,I,C.yy,P[1],f,n].concat(R)),typeof K<"u")return K;V&&(i=i.slice(0,-1*V*2),f=f.slice(0,-1*V),n=n.slice(0,-1*V)),i.push(this.productions_[P[1]][0]),f.push(H.$),n.push(H._$),et=v[i[i.length-2]][i[i.length-1]],i.push(et);break;case 3:return!0}}return!0},"parse")},O=(function(){var M={EOF:1,parseError:o(function(s,i){if(this.yy.parser)this.yy.parser.parseError(s,i);else throw new Error(s)},"parseError"),setInput:o(function(t,s){return this.yy=s||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var s=t.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:o(function(t){var s=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var f=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===u.length?this.yylloc.first_column:0)+u[u.length-i.length].length-i[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[f[0],f[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(t){this.unput(this.match.slice(t))},"less"),pastInput:o(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var t=this.pastInput(),s=new Array(t.length+1).join("-");return t+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{g as gt}from"./chunk-FMBD7UC4-D2XDl42C.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-ND2GUHAM-1BRTAJ05.js";import{g as _t,s as vt,a as bt,b as wt,q as Tt,p as St,_ as s,c as R,d as X,e as $t,z as Mt}from"./mermaid.core-1wU6KgsD.js";import{d as it}from"./arc-E3SUYR-u.js";import"./index-AyT_VNlb.js";import"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-BCywGHw2.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`:
1
+ import{g as gt}from"./chunk-FMBD7UC4-X7y55wG9.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-ND2GUHAM-CNQXwR6Z.js";import{g as _t,s as vt,a as bt,b as wt,q as Tt,p as St,_ as s,c as R,d as X,e as $t,z as Mt}from"./mermaid.core-DVy3DGpO.js";import{d as it}from"./arc-DgCAVqQG.js";import"./index-BWwjYl1J.js";import"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-BCywGHw2.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`:
2
2
  `+_.showPosition()+`
3
3
  Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{_ as c,l as te,c as W,I as fe,af as ye,ag as be,ah as me,Y as _e,G as K,i as F,t as ke,J as Ee,V as Se,W as le,X as ce}from"./mermaid.core-1wU6KgsD.js";import{g as Ne}from"./chunk-FMBD7UC4-D2XDl42C.js";import"./index-AyT_VNlb.js";import"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-BCywGHw2.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],M=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],U=[1,35],j=[1,36],A=[1,6,7,11,13,16,17,20,23],H=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:M}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:U,11:j}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:M}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:H}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:U,11:j}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:H}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,G={},X,I,oe,Y;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";Y=[];for(X in B[R])this.terminals_[X]&&X>ue&&Y.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`:
1
+ import{_ as c,l as te,c as W,I as fe,af as ye,ag as be,ah as me,Y as _e,G as K,i as F,t as ke,J as Ee,V as Se,W as le,X as ce}from"./mermaid.core-DVy3DGpO.js";import{g as Ne}from"./chunk-FMBD7UC4-X7y55wG9.js";import"./index-BWwjYl1J.js";import"./react-vendor-BPQixOLZ.js";import"./highlight-DJvvuuwd.js";import"./katex-Bq6vt64r.js";import"./markdown-BCywGHw2.js";var $=(function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],M=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],U=[1,35],j=[1,36],A=[1,6,7,11,13,16,17,20,23],H=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:M}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:U,11:j}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:M}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:H}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:U,11:j}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:H}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,G={},X,I,oe,Y;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";Y=[];for(X in B[R])this.terminals_[X]&&X>ue&&Y.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`:
2
2
  `+m.showPosition()+`
3
3
  Expecting `+Y.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Z="Parse error on line "+(z+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Z,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:q,expected:Y})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+E);switch(v[0]){case 1:a.push(E),u.push(m.yytext),e.push(m.yylloc),a.push(v[1]),E=null,ie=m.yyleng,l=m.yytext,z=m.yylineno,q=m.yylloc;break;case 2:if(I=this.productions_[v[1]][1],G.$=u[u.length-I],G._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(G._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),Q=this.performAction.apply(G,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof Q<"u")return Q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(G.$),e.push(G._$),oe=B[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},y=(function(){var _={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
@@ -1 +1 @@
1
- import{b7 as j,b8 as p,b9 as w,ba as k,bb as q}from"./mermaid.core-1wU6KgsD.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:n<r?-1:n>r?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:r<n?-1:r>n?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<0?i=l+1:h=l}while(i<h)}return i}function f(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<=0?i=l+1:h=l}while(i<h)}return i}function a(o,c,i=0,h=o.length){const l=u(o,c,i,h-1);return l>i&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/i<n&&++o,c/i>r&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*i<n&&++o,c*i>r&&--c),c<o&&.5<=t&&t<2?v(n,r,t*2):[o,c,i]}function E(n,r,t){if(r=+r,n=+n,t=+t,!(t>0))return[];if(n===r)return[n];const e=r<n,[u,f,a]=e?v(r,n,t):v(n,r,t);if(!(f>=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;i<o;++i)c[i]=(f-i)/-a;else for(let i=0;i<o;++i)c[i]=(f-i)*a;else if(a<0)for(let i=0;i<o;++i)c[i]=(u+i)/-a;else for(let i=0;i<o;++i)c[i]=(u+i)*a;return c}function y(n,r,t){return r=+r,n=+n,t=+t,v(n,r,t)[2]}function G(n,r,t){r=+r,n=+n,t=+t;const e=r<n,u=e?y(r,n,t):y(n,r,t);return(e?-1:1)*(u<0?1/-u:u)}function H(n,r){r||(r=[]);var t=n?Math.min(r.length,n.length):0,e=r.slice(),u;return function(f){for(u=0;u<t;++u)e[u]=n[u]*(1-f)+r[u]*f;return e}}function J(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function K(n,r){var t=r?r.length:0,e=n?Math.min(t,n.length):0,u=new Array(e),f=new Array(t),a;for(a=0;a<e;++a)u[a]=d(n[a],r[a]);for(;a<t;++a)f[a]=r[a];return function(o){for(a=0;a<e;++a)f[a]=u[a](o);return f}}function L(n,r){var t=new Date;return n=+n,r=+r,function(e){return t.setTime(n*(1-e)+r*e),t}}function Q(n,r){var t={},e={},u;(n===null||typeof n!="object")&&(n={}),(r===null||typeof r!="object")&&(r={});for(u in r)u in n?t[u]=d(n[u],r[u]):e[u]=r[u];return function(f){for(u in t)e[u]=t[u](f);return e}}function d(n,r){var t=typeof r,e;return r==null||t==="boolean"?j(r):(t==="number"?p:t==="string"?(e=w(r))?(r=e,k):q:r instanceof w?k:r instanceof Date?L:J(r)?H:Array.isArray(r)?K:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?Q:p)(n,r)}function U(n,r){return n=+n,r=+r,function(t){return Math.round(n*(1-t)+r*t)}}function W(n){return Math.max(0,-g(Math.abs(n)))}function X(n,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(g(r)/3)))*3-g(Math.abs(n)))}function Y(n,r){return n=Math.abs(n),r=Math.abs(r)-n,Math.max(0,g(r)-g(n))+1}function Z(n){return function(){return n}}function _(n){return+n}var A=[0,1];function m(n){return n}function N(n,r){return(r-=n=+n)?function(t){return(t-n)/r}:Z(isNaN(r)?NaN:.5)}function b(n,r){var t;return n>r&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u<e?(e=N(u,e),f=t(a,f)):(e=N(e,u),f=t(f,a)),function(o){return f(e(o))}}function rn(n,r,t){var e=Math.min(n.length,r.length)-1,u=new Array(e),f=new Array(e),a=-1;for(n[e]<n[0]&&(n=n.slice().reverse(),r=r.slice().reverse());++a<e;)u[a]=N(n[a],n[a+1]),f[a]=t(r[a],r[a+1]);return function(o){var c=x(n,o,1,e)-1;return f[c](u[c](o))}}function en(n,r){return r.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function tn(){var n=A,r=A,t=d,e,u,f,a=m,o,c,i;function h(){var s=Math.min(n.length,r.length);return a!==m&&(a=b(n[0],n[s-1])),o=s>2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o<a&&(i=a,a=o,o=i,i=u,u=f,f=i);h-- >0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t};
1
+ import{b7 as j,b8 as p,b9 as w,ba as k,bb as q}from"./mermaid.core-DVy3DGpO.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:n<r?-1:n>r?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:r<n?-1:r>n?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<0?i=l+1:h=l}while(i<h)}return i}function f(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<=0?i=l+1:h=l}while(i<h)}return i}function a(o,c,i=0,h=o.length){const l=u(o,c,i,h-1);return l>i&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/i<n&&++o,c/i>r&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*i<n&&++o,c*i>r&&--c),c<o&&.5<=t&&t<2?v(n,r,t*2):[o,c,i]}function E(n,r,t){if(r=+r,n=+n,t=+t,!(t>0))return[];if(n===r)return[n];const e=r<n,[u,f,a]=e?v(r,n,t):v(n,r,t);if(!(f>=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;i<o;++i)c[i]=(f-i)/-a;else for(let i=0;i<o;++i)c[i]=(f-i)*a;else if(a<0)for(let i=0;i<o;++i)c[i]=(u+i)/-a;else for(let i=0;i<o;++i)c[i]=(u+i)*a;return c}function y(n,r,t){return r=+r,n=+n,t=+t,v(n,r,t)[2]}function G(n,r,t){r=+r,n=+n,t=+t;const e=r<n,u=e?y(r,n,t):y(n,r,t);return(e?-1:1)*(u<0?1/-u:u)}function H(n,r){r||(r=[]);var t=n?Math.min(r.length,n.length):0,e=r.slice(),u;return function(f){for(u=0;u<t;++u)e[u]=n[u]*(1-f)+r[u]*f;return e}}function J(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function K(n,r){var t=r?r.length:0,e=n?Math.min(t,n.length):0,u=new Array(e),f=new Array(t),a;for(a=0;a<e;++a)u[a]=d(n[a],r[a]);for(;a<t;++a)f[a]=r[a];return function(o){for(a=0;a<e;++a)f[a]=u[a](o);return f}}function L(n,r){var t=new Date;return n=+n,r=+r,function(e){return t.setTime(n*(1-e)+r*e),t}}function Q(n,r){var t={},e={},u;(n===null||typeof n!="object")&&(n={}),(r===null||typeof r!="object")&&(r={});for(u in r)u in n?t[u]=d(n[u],r[u]):e[u]=r[u];return function(f){for(u in t)e[u]=t[u](f);return e}}function d(n,r){var t=typeof r,e;return r==null||t==="boolean"?j(r):(t==="number"?p:t==="string"?(e=w(r))?(r=e,k):q:r instanceof w?k:r instanceof Date?L:J(r)?H:Array.isArray(r)?K:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?Q:p)(n,r)}function U(n,r){return n=+n,r=+r,function(t){return Math.round(n*(1-t)+r*t)}}function W(n){return Math.max(0,-g(Math.abs(n)))}function X(n,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(g(r)/3)))*3-g(Math.abs(n)))}function Y(n,r){return n=Math.abs(n),r=Math.abs(r)-n,Math.max(0,g(r)-g(n))+1}function Z(n){return function(){return n}}function _(n){return+n}var A=[0,1];function m(n){return n}function N(n,r){return(r-=n=+n)?function(t){return(t-n)/r}:Z(isNaN(r)?NaN:.5)}function b(n,r){var t;return n>r&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u<e?(e=N(u,e),f=t(a,f)):(e=N(e,u),f=t(f,a)),function(o){return f(e(o))}}function rn(n,r,t){var e=Math.min(n.length,r.length)-1,u=new Array(e),f=new Array(e),a=-1;for(n[e]<n[0]&&(n=n.slice().reverse(),r=r.slice().reverse());++a<e;)u[a]=N(n[a],n[a+1]),f[a]=t(r[a],r[a+1]);return function(o){var c=x(n,o,1,e)-1;return f[c](u[c](o))}}function en(n,r){return r.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function tn(){var n=A,r=A,t=d,e,u,f,a=m,o,c,i;function h(){var s=Math.min(n.length,r.length);return a!==m&&(a=b(n[0],n[s-1])),o=s>2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o<a&&(i=a,a=o,o=i,i=u,u=f,f=i);h-- >0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t};