@bkm016/basalt 0.1.9 → 0.1.10

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 (132) hide show
  1. package/{chunk-0xd9mnc2.js → chunk-0mjb3sm3.js} +2 -2
  2. package/{chunk-66h5qpc6.js → chunk-3mqf9ped.js} +89 -89
  3. package/compiled.js +1 -1
  4. package/package.json +1 -1
  5. package/ui-test-worker.js +1 -1
  6. package/web/chunk-045d3b5d.js +1 -0
  7. package/web/{chunk-ff1pmd3g.js → chunk-0770q5e1.js} +1 -1
  8. package/web/{chunk-2x4g9t37.js → chunk-18neka5g.js} +2 -2
  9. package/web/{chunk-w3w18stt.js → chunk-1ev0n3n4.js} +1 -1
  10. package/web/chunk-1ex3wgms.js +2 -0
  11. package/web/{chunk-7qkav30b.js → chunk-1qh7f5kr.js} +1 -1
  12. package/web/{chunk-rayf24gy.js → chunk-26ecc2xh.js} +8 -8
  13. package/web/{chunk-me7dza1c.js → chunk-2cz7tx8q.js} +1 -1
  14. package/web/{chunk-mdfksj61.js → chunk-32ty2xfn.js} +1 -1
  15. package/web/{chunk-ts6jsfdk.js → chunk-3eexx7y5.js} +1 -1
  16. package/web/{chunk-2dvbeqt0.js → chunk-46jnkghq.js} +1 -1
  17. package/web/chunk-4am8j3k3.js +1 -0
  18. package/web/{chunk-qz6r9v1z.js → chunk-5qvmefq2.js} +1 -1
  19. package/web/{chunk-9ctg0f30.js → chunk-5svqfj4g.js} +1 -1
  20. package/web/{chunk-qsqtwf34.js → chunk-5v5q13hz.js} +1 -1
  21. package/web/chunk-7np1jp3x.js +8 -0
  22. package/web/chunk-87e8d1hv.js +1 -0
  23. package/web/{chunk-kcjz03h5.js → chunk-88wd49xe.js} +2 -2
  24. package/web/{chunk-0pghpg4y.js → chunk-8h2x89tw.js} +1 -1
  25. package/web/chunk-8y2526ve.js +1 -0
  26. package/web/{chunk-8jcvdd5d.js → chunk-905vw286.js} +1 -1
  27. package/web/{chunk-2hrswh3d.js → chunk-918e5t4x.js} +1 -1
  28. package/web/chunk-96m2m3e8.js +1 -0
  29. package/web/{chunk-43g4wd7a.js → chunk-9f4zzqbx.js} +1 -1
  30. package/web/{chunk-dnv8dx72.js → chunk-a1n4468c.js} +1 -1
  31. package/web/{chunk-s37beysw.js → chunk-b46ws7rf.js} +1 -1
  32. package/web/{chunk-24jhbz82.js → chunk-bc3ajvfg.js} +1 -1
  33. package/web/{chunk-ket6g0yd.js → chunk-d5gshd1a.js} +1 -1
  34. package/web/{chunk-c6yacwbc.js → chunk-de40q05r.js} +1 -1
  35. package/web/chunk-dp0k5vhd.js +1 -0
  36. package/web/{chunk-5dr4tkem.js → chunk-dv1berk6.js} +3 -3
  37. package/web/{chunk-dwjmr0zj.js → chunk-eh7wp62z.js} +1 -1
  38. package/web/{chunk-ctzkqx2g.js → chunk-ehtmb6sn.js} +1 -1
  39. package/web/chunk-et1hytyv.js +1 -0
  40. package/web/chunk-f9m9seam.js +1 -0
  41. package/web/{chunk-3pd0qt83.js → chunk-fmmrthpa.js} +2 -2
  42. package/web/chunk-g2erm7k0.js +1 -0
  43. package/web/chunk-g3kbn0t2.js +1 -0
  44. package/web/{chunk-t893141g.js → chunk-g7dc4hrd.js} +1 -1
  45. package/web/{chunk-p9hfcamx.js → chunk-g7kz8f7q.js} +1 -1
  46. package/web/chunk-ght0t49g.js +1 -0
  47. package/web/{chunk-xa43ndfj.js → chunk-ghwm7bdj.js} +2 -2
  48. package/web/{chunk-8z0r0wtk.js → chunk-grm2208k.js} +1 -1
  49. package/web/{chunk-0zwc2rvh.js → chunk-gsw1tv96.js} +1 -1
  50. package/web/{chunk-tftc5v89.js → chunk-gw8x1g61.js} +1 -1
  51. package/web/chunk-gx340asc.js +1 -0
  52. package/web/{chunk-935mjq1c.js → chunk-h2txs73e.js} +1 -1
  53. package/web/chunk-h3tkacc7.js +1 -0
  54. package/web/{chunk-ewx42c11.js → chunk-h5ckjk48.js} +1 -1
  55. package/web/{chunk-nnyc889n.js → chunk-j37p0b13.js} +1 -1
  56. package/web/{chunk-fjb3ksfd.js → chunk-j89s11x8.js} +1 -1
  57. package/web/chunk-je78j3vr.js +1 -0
  58. package/web/{chunk-fpb2dd2d.js → chunk-jke2ev6m.js} +1 -1
  59. package/web/{chunk-98y92vmh.js → chunk-js6kb05s.js} +1 -1
  60. package/web/{chunk-30b33r2w.js → chunk-k0cg4n2k.js} +2 -2
  61. package/web/{chunk-b5h52neg.js → chunk-knm82fw9.js} +1 -1
  62. package/web/{chunk-vqmj6peg.js → chunk-kxdtg9dt.js} +1 -1
  63. package/web/{chunk-db3twjvk.js → chunk-m4fxd5d9.js} +5 -5
  64. package/web/chunk-m9xzt9p7.js +1 -0
  65. package/web/{chunk-xx11yv61.js → chunk-n4yzs2q0.js} +1 -1
  66. package/web/{chunk-zdyys4ar.js → chunk-nawxgz87.js} +2 -2
  67. package/web/chunk-ngt1j8py.js +1139 -0
  68. package/web/{chunk-3ak5dg10.js → chunk-p55vhns6.js} +1 -1
  69. package/web/{chunk-nvpp0ghj.js → chunk-pgwf37s2.js} +1 -1
  70. package/web/{chunk-af9evdza.js → chunk-q4bst4an.js} +1 -1
  71. package/web/{chunk-9fnr00kv.js → chunk-qdzy124b.js} +2 -2
  72. package/web/chunk-qe0bgeda.js +1 -0
  73. package/web/{chunk-60axh4sa.js → chunk-qy1zx2yw.js} +2 -2
  74. package/web/{chunk-sk1wkgjw.js → chunk-rag65pfs.js} +1 -1
  75. package/web/{chunk-5jdrev9p.js → chunk-rbqnre6q.js} +3 -3
  76. package/web/{chunk-ddyyc20r.js → chunk-rh3xb76f.js} +1 -1
  77. package/web/{chunk-wzd2a4k5.js → chunk-rwfmccmh.js} +1 -1
  78. package/web/{chunk-zb2bkr7f.js → chunk-rxvm70w5.js} +1 -1
  79. package/web/{chunk-z05x9cbm.js → chunk-sat7zyva.js} +1 -1
  80. package/web/{chunk-rrpn5r5w.js → chunk-sc63488q.js} +1 -1
  81. package/web/{chunk-v1exk5wd.js → chunk-sd3xat3r.js} +6 -6
  82. package/web/{chunk-4a6gdrbs.js → chunk-se4h6wx0.js} +1 -1
  83. package/web/{chunk-a0ryzdnp.js → chunk-sjkg40ay.js} +1 -1
  84. package/web/chunk-sk0hpa80.js +1 -0
  85. package/web/{chunk-spbs56wz.js → chunk-t5nvgz7z.js} +1 -1
  86. package/web/{chunk-veam6vk4.js → chunk-tfqarvdx.js} +30 -30
  87. package/web/{chunk-5a4mj3qz.js → chunk-tqze6d6b.js} +1 -1
  88. package/web/{chunk-8w7fyb3v.js → chunk-tt93zbn4.js} +7 -7
  89. package/web/chunk-tvcxrx6h.js +1 -0
  90. package/web/chunk-tzpnh70q.js +1 -0
  91. package/web/{chunk-79e08rk1.js → chunk-vasppf6b.js} +1 -1
  92. package/web/chunk-vb7g4xg6.js +1 -0
  93. package/web/{chunk-dz7g1gnv.js → chunk-w3zgfhjb.js} +1 -1
  94. package/web/{chunk-gn8kyz76.js → chunk-wrevb4ew.js} +1 -1
  95. package/web/{chunk-3ecrkvr3.js → chunk-wtvch4ad.js} +1 -1
  96. package/web/chunk-wzfe6jtq.js +1 -0
  97. package/web/{chunk-eadfxfkw.js → chunk-x5g1yy12.js} +1 -1
  98. package/web/{chunk-m9q5nr8f.js → chunk-x850q01z.js} +1 -1
  99. package/web/{chunk-a61zrp66.js → chunk-xk904wqv.js} +1 -1
  100. package/web/{chunk-3hr3ew9w.js → chunk-xtn305fd.js} +1 -1
  101. package/web/{chunk-3txxt0a7.js → chunk-yekaz74b.js} +1 -1
  102. package/web/{chunk-rasjtvsb.js → chunk-yppgejg7.js} +2 -2
  103. package/web/{chunk-66wb0p6e.js → chunk-z4bp6p32.js} +1 -1
  104. package/web/{chunk-5v2c0aqk.js → chunk-z5qn0xev.js} +1 -1
  105. package/web/{chunk-5baeh8q7.js → chunk-zms6mrqk.js} +4 -4
  106. package/web/{chunk-601k823s.js → chunk-zse05v6j.js} +2 -2
  107. package/web/{chunk-vsjpnwsr.js → chunk-zz1qkaar.js} +1 -1
  108. package/web/index.html +1 -1
  109. package/web/chunk-08sq3cwm.js +0 -1
  110. package/web/chunk-24fjnnee.js +0 -1
  111. package/web/chunk-2j2atyjw.js +0 -1
  112. package/web/chunk-3h3g3ca3.js +0 -1
  113. package/web/chunk-3pcrxg6m.js +0 -1
  114. package/web/chunk-814kkkmq.js +0 -8
  115. package/web/chunk-8w8atrdh.js +0 -1
  116. package/web/chunk-942g3eqn.js +0 -1
  117. package/web/chunk-avxk6jpc.js +0 -2
  118. package/web/chunk-fmthkpff.js +0 -1
  119. package/web/chunk-gv99c8zv.js +0 -1
  120. package/web/chunk-h0767tjv.js +0 -1
  121. package/web/chunk-hqynf99g.js +0 -1
  122. package/web/chunk-mbwwj216.js +0 -1
  123. package/web/chunk-n0wazxgz.js +0 -1
  124. package/web/chunk-nvt9tkt4.js +0 -1139
  125. package/web/chunk-ph1dgffm.js +0 -1
  126. package/web/chunk-rad2s9ha.js +0 -1
  127. package/web/chunk-s60s09mb.js +0 -1
  128. package/web/chunk-tfvcs2xx.js +0 -1
  129. package/web/chunk-wdq2tp9e.js +0 -1
  130. package/web/chunk-wkf5xfyr.js +0 -1
  131. package/web/chunk-y1qty77a.js +0 -1
  132. package/web/chunk-zgavhnt8.js +0 -1
@@ -1 +1 @@
1
- import{t}from"./chunk-veam6vk4.js";var c=1;function i(){if(typeof globalThis>"u")return;return globalThis}t(i,"getCaptureGlobal");function p(){return Boolean(i()?.mermaidCaptureSizes)}t(p,"shouldCaptureSizes");function u(){if(typeof location>"u")return"browser-dev";return`${location.pathname}${location.search}`}t(u,"capturedFromLocation");function d(n,r){let o=i();if(!o)return;let e=r.node(),s=((e&&"ownerSVGElement"in e?e.ownerSVGElement:null)??e)?.id??"(unknown)";o.mermaidCapturedSizes??=[];let a={svgId:s,sizes:n};o.mermaidCapturedSizes.push(a),o.mermaidLastCapturedSizes=a}t(d,"emitCapturedSizes");function m(n,r){let o=[];for(let e of r.nodes){if(e.isGroup)continue;o.push({id:e.id,width:e.width??0,height:e.height??0})}if(o.length===0)return;d({metadata:{captureVersion:c,capturedAt:new Date().toISOString(),capturedFrom:u()},nodes:o},n)}t(m,"captureNodeSizes");export{m as captureNodeSizes};
1
+ import{t}from"./chunk-tfqarvdx.js";var c=1;function i(){if(typeof globalThis>"u")return;return globalThis}t(i,"getCaptureGlobal");function p(){return Boolean(i()?.mermaidCaptureSizes)}t(p,"shouldCaptureSizes");function u(){if(typeof location>"u")return"browser-dev";return`${location.pathname}${location.search}`}t(u,"capturedFromLocation");function d(n,r){let o=i();if(!o)return;let e=r.node(),s=((e&&"ownerSVGElement"in e?e.ownerSVGElement:null)??e)?.id??"(unknown)";o.mermaidCapturedSizes??=[];let a={svgId:s,sizes:n};o.mermaidCapturedSizes.push(a),o.mermaidLastCapturedSizes=a}t(d,"emitCapturedSizes");function m(n,r){let o=[];for(let e of r.nodes){if(e.isGroup)continue;o.push({id:e.id,width:e.width??0,height:e.height??0})}if(o.length===0)return;d({metadata:{captureVersion:c,capturedAt:new Date().toISOString(),capturedFrom:u()},nodes:o},n)}t(m,"captureNodeSizes");export{m as captureNodeSizes};
@@ -1,4 +1,4 @@
1
- import{g,o,v,i,r,f,e,n,y,at}from"./chunk-nvt9tkt4.js";var V="__chat__";function M(t){if(!Number.isFinite(t)||t<=0)return"0";if(t<1000)return Math.round(t).toString();if(t<1e6)return`${(t/1000).toFixed(1)}K`;if(t<1e9)return`${(t/1e6).toFixed(2)}M`;return`${(t/1e9).toFixed(2)}B`}function L(t){let u=Number.isFinite(t)?Math.max(0,t):0;return Math.round(u).toLocaleString("en-US")}function P(t){if(!Number.isFinite(t)||t<=0)return"0s";if(t<1000)return"<1s";if(t<60000)return`${Math.floor(t/1000)}s`;if(t<3600000){let c=Math.floor(t/1000),a=Math.floor(c/60),d=c%60;return d>0?`${a}m ${d}s`:`${a}m`}if(t<259200000){let c=Math.floor(t/60000),a=Math.floor(c/60),d=c%60;return d>0?`${a}h ${d}m`:`${a}h`}let u=Math.floor(t/3600000),b=Math.floor(u/24),p=u%24;return p>0?`${b}d ${p}h`:`${b}d`}function ae(t){if(!Number.isFinite(t)||t<=0)return"0s";if(t<1000)return"<1s";if(t<60000)return`${Math.round(t/1000)}s`;if(t<3600000)return`${Math.round(t/60000)}m`;if(t<86400000){let p=t/3600000;return`${p>=10?Math.round(p).toString():p.toFixed(1).replace(/\.0$/,"")}h`}let u=t/86400000;return`${u>=10?Math.round(u).toString():u.toFixed(1).replace(/\.0$/,"")}d`}function B(t,u=1){if(!Number.isFinite(t)||t<=0)return"0%";let b=10**-u/100;if(t<b)return`<${(b*100).toFixed(u)}%`;return`${(t*100).toFixed(u)}%`}function Q(t){if(!Number.isFinite(t)||t<=0)return"0 B";if(t<1024)return`${Math.round(t)} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;if(t<1073741824)return`${(t/1048576).toFixed(2)} MB`;return`${(t/1073741824).toFixed(2)} GB`}function W(t){let u=t.split("-"),b=u[1],p=u[2];if(b!==void 0&&p!==void 0)return`${b}/${p}`;return t}function Z(t){let u=t.split("-"),b=u[0],p=u[1],c=u[2];if(b===void 0||p===void 0||c===void 0)return t;let a=Number(b),d=Number(p)-1,h=Number(c),w=new Date(Date.UTC(a,d,h)),C=["周日","周一","周二","周三","周四","周五","周六"],D=w.getUTCDay(),F=C[D]??"";return`${t} ${F}`}function se(t,u=Date.now()){if(t===null||t===void 0||!Number.isFinite(t)||t<=0)return"从未";let b=Math.max(0,u-t);if(b<60000)return"刚刚";if(b<3600000)return`${Math.max(1,Math.floor(b/60000))} 分钟前`;if(b<86400000)return`${Math.max(1,Math.floor(b/3600000))} 小时前`;if(b<2592000000)return`${Math.max(1,Math.floor(b/86400000))} 天前`;let p=new Date(t),c=p.getFullYear(),a=String(p.getMonth()+1).padStart(2,"0"),d=String(p.getDate()).padStart(2,"0");return`${c}-${a}-${d}`}function K(t){return e("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:e("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${t.percent}%`}})})}function Y(t){return e("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:t.children})}function G(t){return e("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:t.children})}function J(t){return n(G,{children:[n("span",{children:["输入 ",e("span",{className:"text-ink",children:M(t.stat.inputTokens)})]}),n("span",{children:["输出 ",e("span",{className:"text-ink",children:M(t.stat.outputTokens)})]}),n("span",{children:["缓存读 ",e("span",{className:"text-ink",children:M(t.stat.cacheReadTokens)}),t.cacheHitRate!==void 0&&n("span",{className:"text-faint",children:[" (",B(t.cacheHitRate),")"]})]})]})}function oe(t){let{projects:u,selectedProjectID:b,onSelectProject:p}=t,{style:c}=y();if(u.length===0)return e("div",{className:c("surface.empty"),children:"暂无项目统计数据"});return e("div",{className:"divide-y divide-line",children:u.map((a)=>{let d=a.projectID??V,h=b===d,w=Math.max(a.tokenShare>0?1:0,a.tokenShare*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e("span",{className:"font-medium text-sm text-ink truncate",children:a.name}),e("span",{className:c("control.badge","font-mono truncate max-w-[240px]"),title:a.directory||"未绑定项目目录",children:a.directory||"独立会话"}),e("button",{type:"button",onClick:()=>p(h?null:d),className:"rounded px-1.5 py-0.5 text-[11px] text-accent hover:bg-accent/10 transition-colors cursor-pointer shrink-0",children:h?"取消筛选":"筛选"})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[e("span",{className:"text-xs font-medium text-ink",title:L(a.totalTokens),children:M(a.totalTokens)}),n("span",{className:"text-[11px] text-faint",children:["(",B(a.tokenShare),")"]})]})]}),e(K,{percent:w}),n(Y,{children:[e(J,{stat:a,cacheHitRate:a.cacheHitRate}),n(G,{children:[n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(a.activeDurationMs)})]}),n("span",{children:[e("span",{className:"text-ink",children:a.sessionCount.toLocaleString()})," 会话"]}),n("span",{children:["工具 ",e("span",{className:"text-ink",children:a.toolCalls.toLocaleString()})," 次"]})]})]})]},d)})})}function re(t){let{models:u}=t,{ModelIcon:b,style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无模型调用数据"});return e("div",{className:"divide-y divide-line",children:u.map((c)=>{let a=Math.max(c.share>0?1:0,c.share*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e(b,{modelID:c.model,className:"size-4 shrink-0"}),e("span",{className:"font-mono text-sm font-medium text-ink truncate",children:c.shortName}),e("span",{className:p("control.badge","font-mono shrink-0"),children:c.provider})]}),n("div",{className:"flex items-baseline gap-2.5 font-mono tabular-nums shrink-0",children:[c.avgTps!==null&&n("span",{className:"text-[11px] text-dim",children:[c.avgTps.toFixed(1)," tok/s"]}),n("span",{className:"text-xs font-medium text-ink",title:L(c.totalTokens),children:[M(c.totalTokens)," ",n("span",{className:"text-[11px] font-normal text-faint",children:["(",B(c.share),")"]})]})]})]}),e(K,{percent:a}),n(Y,{children:[e(J,{stat:c,cacheHitRate:c.cacheHitRate}),n(G,{children:[n("span",{children:[e("span",{className:"text-ink",children:c.turns.toLocaleString()})," 轮",c.errors>0?n("span",{className:"text-danger",children:[" (",c.errors," 错)"]}):null]}),n("span",{children:["工具 ",e("span",{className:"text-ink",children:c.toolCalls.toLocaleString()})," 次"]}),c.generationMs>0&&n("span",{children:["推理 ",e("span",{className:"text-ink",children:ae(c.generationMs)})]})]})]})]},c.model)})})}function ie(t){let{tools:u}=t,{StatusChip:b,style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无工具调用数据"});return e("div",{className:"divide-y divide-line",children:u.map((c)=>{let a=Math.max(c.share>0?1:0,c.share*100),d=c.successRate>=0.95?"success":c.successRate>=0.8?"warning":"danger",h=Math.max(0,c.calls-c.errors),w=c.calls>0?Math.round(c.outputBytes/c.calls):0;return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e("span",{className:"font-mono text-sm font-medium text-ink truncate",children:c.name}),n(b,{tone:d,children:["成功率 ",B(c.successRate)]})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[n("span",{className:"text-xs font-medium text-ink",children:[c.calls.toLocaleString()," 次"]}),n("span",{className:"text-[11px] text-faint",children:["(",B(c.share),")"]})]})]}),e(K,{percent:a}),n(Y,{children:[n(G,{children:[n("span",{children:["成功 ",e("span",{className:"text-ink",children:h.toLocaleString()})," 次"]}),n("span",{children:["失败 ",e("span",{className:c.errors>0?"text-danger":"text-ink",children:c.errors.toLocaleString()})," 次"]})]}),n(G,{children:[n("span",{children:["累计输出 ",e("span",{className:"text-ink",children:Q(c.outputBytes)})]}),n("span",{children:["单次均值 ",e("span",{className:"text-ink",children:Q(w)})]})]})]})]},c.name)})})}function le(t){let{sessions:u,onOpenSession:b}=t,{style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无高消耗会话记录"});let c=Math.max(1,...u.map((a)=>a.totalTokens));return e("div",{className:"divide-y divide-line",children:u.map((a)=>{let d=c>0?Math.max(1,a.totalTokens/c*100):0,h=a.model.split("/").pop()??a.model;return n("button",{type:"button",onClick:()=>b(a.id),className:"group block w-full p-4 text-left space-y-2.5 hover:bg-raised/40 transition-colors cursor-pointer",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e("span",{className:"font-medium text-sm text-ink truncate group-hover:text-accent transition-colors",children:a.title.trim()||"新会话"}),e("span",{className:p("control.badge","font-mono truncate max-w-[140px] shrink-0"),title:a.projectName,children:a.projectName}),a.kind==="sub"&&e("span",{className:"rounded bg-accent/15 px-1.5 py-0.5 text-[10.5px] text-accent shrink-0",children:"子代理"}),a.archivedAt!==null&&e("span",{className:p("control.badge","shrink-0"),children:"已归档"})]}),n("div",{className:"flex items-center gap-1.5 font-mono tabular-nums shrink-0",children:[e("span",{className:"text-xs font-medium text-ink",title:L(a.totalTokens),children:M(a.totalTokens)}),e(at,{className:"size-3.5 text-faint group-hover:text-ink group-hover:translate-x-0.5 transition-all"})]})]}),e(K,{percent:d}),n(Y,{children:[e(J,{stat:a}),n(G,{children:[e("span",{className:"text-ink",children:h}),n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(a.activeDurationMs)})]}),n("span",{children:[e("span",{className:"text-ink",children:a.assistantTurns})," 轮"]}),e("span",{className:"text-faint",children:se(a.updated)})]})]})]},a.id)})})}var ce=[{value:"tokens",label:"Token 用量"},{value:"duration",label:"活跃耗时"},{value:"activity",label:"交互轮次"}];function ue(t){let{cn:u,Segmented:b,SettingGroup:p,style:c}=y(),{daily:a}=t,[d,h]=r("tokens"),[w,C]=r(null),D=v(()=>a.some((s)=>s.totalTokens>0||s.activeDurationMs>0||s.runs>0),[a]),F=v(()=>{if(a.length===0)return{totalText:"0",avgText:"0",peakDate:"—",peakValueText:"0"};if(d==="tokens"){let S=a.reduce((_,A)=>_+A.totalTokens,0),R=a.filter((_)=>_.totalTokens>0).length,N=a[0];for(let _ of a)if(!N||_.totalTokens>N.totalTokens)N=_;return{totalText:M(S),totalFullText:L(S),avgText:R>0?M(Math.round(S/R)):"0",peakDate:N&&N.totalTokens>0?W(N.date):"—",peakValueText:N&&N.totalTokens>0?M(N.totalTokens):"0"}}if(d==="duration"){let S=a.reduce((_,A)=>_+A.activeDurationMs,0),R=a.filter((_)=>_.activeDurationMs>0).length,N=a[0];for(let _ of a)if(!N||_.activeDurationMs>N.activeDurationMs)N=_;return{totalText:P(S),totalFullText:P(S),avgText:R>0?P(Math.round(S/R)):"0s",peakDate:N&&N.activeDurationMs>0?W(N.date):"—",peakValueText:N&&N.activeDurationMs>0?P(N.activeDurationMs):"0s"}}let s=a.reduce((S,R)=>S+R.assistantTurns,0),l=a.reduce((S,R)=>S+R.userMessages,0),x=s+l,T=a.filter((S)=>S.assistantTurns>0||S.userMessages>0).length,k=a[0];for(let S of a){let R=k?k.assistantTurns+k.userMessages:0;if(!k||S.assistantTurns+S.userMessages>R)k=S}let H=k?k.assistantTurns+k.userMessages:0;return{totalText:`${x.toLocaleString()} 轮`,totalFullText:`助手 ${s.toLocaleString()} 轮 · 用户 ${l.toLocaleString()} 问`,avgText:T>0?`${(x/T).toFixed(1)} 轮/天`:"0 轮/天",peakDate:k&&H>0?W(k.date):"—",peakValueText:k&&H>0?`${H.toLocaleString()} 轮`:"0 轮"}},[a,d]),j=v(()=>{if(w){let s=a.find((l)=>l.date===w);if(s)return s}for(let s=a.length-1;s>=0;s--){let l=a[s];if(l&&(l.totalTokens>0||l.activeDurationMs>0||l.runs>0))return l}return a[a.length-1]},[a,w]),z=v(()=>{if(d==="tokens")return Math.max(1,...a.map((s)=>s.totalTokens));if(d==="duration")return Math.max(1000,...a.map((s)=>s.activeDurationMs));return Math.max(1,...a.map((s)=>s.assistantTurns+s.userMessages))},[a,d]),m=v(()=>{if(a.length<=7)return a.map((x)=>x.date);let s=6,l=[];for(let x=0;x<s;x++){let T=Math.round(x*(a.length-1)/(s-1)),k=a[T];if(k)l.push(k.date)}return l},[a]);if(!D)return e(p,{title:"每日趋势",action:e(b,{value:d,onChange:(s)=>h(s),options:ce}),children:e("div",{className:c("surface.empty"),children:"当前时间范围内暂无活跃数据"})});return e(p,{title:"每日趋势",action:e(b,{value:d,onChange:(s)=>h(s),options:ce}),children:n("div",{className:"p-4 space-y-4",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 font-mono text-dim tabular-nums",children:[n("span",{children:["汇总 ",e("span",{className:"text-ink",children:F.totalText})]}),n("span",{children:["日均 ",e("span",{className:"text-ink",children:F.avgText})]}),n("span",{children:["峰值 ",e("span",{className:"text-ink",children:F.peakValueText}),F.peakDate!=="—"?n("span",{className:"text-faint",children:[" (",F.peakDate,")"]}):null]})]}),n("div",{className:"flex items-center gap-3 text-[11px] text-dim",children:[d==="tokens"&&n(f,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent/40"}),"缓存读"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"输入"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"输出"]})]}),d==="duration"&&n(f,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"工作调度"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"模型推理"]})]}),d==="activity"&&n(f,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"助手回复"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"用户提问"]})]})]})]}),n("div",{className:"relative h-44 w-full pt-1",children:[n("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none pb-5 text-[10px] text-faint/60",children:[e("div",{className:"border-b border-line/40 w-full"}),e("div",{className:"border-b border-line/30 w-full"}),e("div",{className:"border-b border-line/40 w-full"})]}),n("section",{"aria-label":"每日趋势柱状序列",className:"relative h-full flex flex-col justify-between",onMouseLeave:()=>C(null),children:[e("div",{className:"flex-1 flex items-end gap-1 sm:gap-1.5 pb-2",children:a.map((s)=>{let l=s.totalTokens;if(d==="duration")l=s.activeDurationMs;else if(d==="activity")l=s.assistantTurns+s.userMessages;let x=l<=0,T=x?0:Math.max(3,Math.min(100,l/z*100)),k=j?.date===s.date;return n("button",{type:"button","aria-label":`${s.date} 统计数据`,className:"flex-1 h-full flex flex-col justify-end items-center group cursor-pointer relative min-w-0 bg-transparent p-0 border-0 focus:outline-hidden",onMouseEnter:()=>C(s.date),onFocus:()=>C(s.date),onClick:()=>C(s.date),children:[e("div",{className:u("absolute inset-y-0 w-full rounded-xs transition-colors pointer-events-none",k?"bg-accent/10":"group-hover:bg-raised/60")}),x?e("div",{className:"h-1 w-full max-w-[24px] rounded-full bg-raised group-hover:bg-dim/30"}):n("div",{className:"w-full max-w-[24px] rounded-t-xs overflow-hidden flex flex-col justify-end transition-all duration-150",style:{height:`${T}%`},children:[d==="tokens"&&n(f,{children:[s.outputTokens>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${s.outputTokens/s.totalTokens*100}%`}}),s.inputTokens+s.cacheWriteTokens>0&&e("div",{className:"bg-accent transition-all duration-200",style:{height:`${(s.inputTokens+s.cacheWriteTokens)/s.totalTokens*100}%`}}),s.cacheReadTokens>0&&e("div",{className:"bg-accent/40 transition-all duration-200",style:{height:`${s.cacheReadTokens/s.totalTokens*100}%`}})]}),d==="duration"&&n(f,{children:[s.generationMs>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${Math.min(100,s.generationMs/Math.max(1,s.activeDurationMs)*100)}%`}}),e("div",{className:"bg-accent flex-1 transition-all duration-200"})]}),d==="activity"&&n(f,{children:[s.userMessages>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${s.userMessages/Math.max(1,s.assistantTurns+s.userMessages)*100}%`}}),e("div",{className:"bg-accent flex-1 transition-all duration-200"})]})]}),k&&e("div",{className:"absolute -bottom-1 size-1 rounded-full bg-accent"})]},s.date)})}),e("div",{className:u("flex items-center pt-1.5 text-[10px] text-faint font-mono tabular-nums",a.length<=7?"gap-1 sm:gap-1.5":"justify-between"),children:m.map((s)=>e("div",{className:u("whitespace-nowrap",a.length<=7&&"flex-1 text-center"),children:W(s)},s))})]})]}),e("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-line pt-3 font-mono text-xs tabular-nums",children:j?n(f,{children:[e("span",{className:"text-ink",children:Z(j.date)}),n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 text-dim",children:[n("span",{children:["Token ",e("span",{className:"text-ink",children:M(j.totalTokens)})]}),n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(j.activeDurationMs)})]}),n("span",{children:["交互 ",n("span",{className:"text-ink",children:[j.assistantTurns+j.userMessages," 轮"]})]}),n("span",{children:["工具 ",n("span",{className:"text-ink",children:[j.toolCalls," 次"]})]})]})]}):e("span",{className:"font-sans text-faint",children:"悬停柱状图查看单日明细"})})]})})}function pe(t){let{cn:u,SettingGroup:b}=y(),{daily:p,hourly:c}=t,[a,d]=r(null),h=v(()=>{let l=new Map;for(let T of c)l.set(T.hour,T);let x=[];for(let T=0;T<24;T++){let k=l.get(T);if(k)x.push(k);else x.push({hour:T,totalTokens:0,activeDurationMs:0,userMessages:0,assistantTurns:0,runs:0})}return x},[c]),w=v(()=>{let l=h[0];for(let x of h)if(!l||x.totalTokens>l.totalTokens)l=x;return l&&l.totalTokens>0?l:null},[h]),C=v(()=>h.reduce((l,x)=>l+x.totalTokens,0),[h]),D=v(()=>Math.max(1,...h.map((l)=>l.totalTokens)),[h]),F=v(()=>{if(C<=0)return 0;return h.filter((x)=>x.hour>=8&&x.hour<20).reduce((x,T)=>x+T.totalTokens,0)/C},[h,C]),j=v(()=>Math.max(1,...p.map((l)=>l.totalTokens)),[p]),z=v(()=>{let l=0,x=0;for(let T of p)if(T.totalTokens>0||T.activeDurationMs>0||T.runs>0){if(x++,x>l)l=x}else x=0;return l},[p]),m=v(()=>p.filter((l)=>l.totalTokens>0||l.activeDurationMs>0||l.runs>0).length,[p]),s=a!==null?h[a]:w;return n(b,{title:"活跃时段与热力",action:n("div",{className:"flex items-center gap-3 font-mono text-xs text-faint tabular-nums",children:[n("span",{children:["日间占比 ",B(F)]}),n("span",{children:["连续活跃 ",z," 天"]}),n("span",{children:["活跃 ",m,"/",p.length," 天"]})]}),children:[n("div",{className:"p-4 space-y-3",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[e("span",{className:"text-dim",children:"24 小时分布"}),s?n("div",{className:"flex items-center gap-3 font-mono text-dim tabular-nums",children:[n("span",{className:"text-ink",children:[a!==null?"时段 ":"高峰 ",String(s.hour).padStart(2,"0"),":00 -"," ",String((s.hour+1)%24).padStart(2,"0"),":00"]}),e("span",{className:"text-ink",children:M(s.totalTokens)}),s.activeDurationMs>0&&e("span",{children:P(s.activeDurationMs)})]}):e("span",{className:"text-faint",children:"暂无时段分布"})]}),n("section",{"aria-label":"24 小时活跃分布序列",className:"h-28 w-full flex flex-col justify-between pt-1",onMouseLeave:()=>d(null),children:[e("div",{className:"flex-1 flex items-end gap-1.5 pb-1.5",children:h.map((l)=>{let x=w?.hour===l.hour,T=a===l.hour,k=l.totalTokens>0?Math.max(6,l.totalTokens/D*100):0,H=`${String(l.hour).padStart(2,"0")}:00 - ${String((l.hour+1)%24).padStart(2,"0")}:00
1
+ import{g,o,v,i,r,f,e,n,y,it}from"./chunk-ngt1j8py.js";var V="__chat__";function M(t){if(!Number.isFinite(t)||t<=0)return"0";if(t<1000)return Math.round(t).toString();if(t<1e6)return`${(t/1000).toFixed(1)}K`;if(t<1e9)return`${(t/1e6).toFixed(2)}M`;return`${(t/1e9).toFixed(2)}B`}function L(t){let u=Number.isFinite(t)?Math.max(0,t):0;return Math.round(u).toLocaleString("en-US")}function P(t){if(!Number.isFinite(t)||t<=0)return"0s";if(t<1000)return"<1s";if(t<60000)return`${Math.floor(t/1000)}s`;if(t<3600000){let c=Math.floor(t/1000),a=Math.floor(c/60),d=c%60;return d>0?`${a}m ${d}s`:`${a}m`}if(t<259200000){let c=Math.floor(t/60000),a=Math.floor(c/60),d=c%60;return d>0?`${a}h ${d}m`:`${a}h`}let u=Math.floor(t/3600000),b=Math.floor(u/24),p=u%24;return p>0?`${b}d ${p}h`:`${b}d`}function ae(t){if(!Number.isFinite(t)||t<=0)return"0s";if(t<1000)return"<1s";if(t<60000)return`${Math.round(t/1000)}s`;if(t<3600000)return`${Math.round(t/60000)}m`;if(t<86400000){let p=t/3600000;return`${p>=10?Math.round(p).toString():p.toFixed(1).replace(/\.0$/,"")}h`}let u=t/86400000;return`${u>=10?Math.round(u).toString():u.toFixed(1).replace(/\.0$/,"")}d`}function B(t,u=1){if(!Number.isFinite(t)||t<=0)return"0%";let b=10**-u/100;if(t<b)return`<${(b*100).toFixed(u)}%`;return`${(t*100).toFixed(u)}%`}function Q(t){if(!Number.isFinite(t)||t<=0)return"0 B";if(t<1024)return`${Math.round(t)} B`;if(t<1048576)return`${(t/1024).toFixed(1)} KB`;if(t<1073741824)return`${(t/1048576).toFixed(2)} MB`;return`${(t/1073741824).toFixed(2)} GB`}function W(t){let u=t.split("-"),b=u[1],p=u[2];if(b!==void 0&&p!==void 0)return`${b}/${p}`;return t}function Z(t){let u=t.split("-"),b=u[0],p=u[1],c=u[2];if(b===void 0||p===void 0||c===void 0)return t;let a=Number(b),d=Number(p)-1,h=Number(c),w=new Date(Date.UTC(a,d,h)),C=["周日","周一","周二","周三","周四","周五","周六"],D=w.getUTCDay(),F=C[D]??"";return`${t} ${F}`}function se(t,u=Date.now()){if(t===null||t===void 0||!Number.isFinite(t)||t<=0)return"从未";let b=Math.max(0,u-t);if(b<60000)return"刚刚";if(b<3600000)return`${Math.max(1,Math.floor(b/60000))} 分钟前`;if(b<86400000)return`${Math.max(1,Math.floor(b/3600000))} 小时前`;if(b<2592000000)return`${Math.max(1,Math.floor(b/86400000))} 天前`;let p=new Date(t),c=p.getFullYear(),a=String(p.getMonth()+1).padStart(2,"0"),d=String(p.getDate()).padStart(2,"0");return`${c}-${a}-${d}`}function K(t){return e("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-raised",children:e("div",{className:"h-full rounded-full bg-accent transition-all duration-300",style:{width:`${t.percent}%`}})})}function Y(t){return e("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:t.children})}function G(t){return e("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:t.children})}function J(t){return n(G,{children:[n("span",{children:["输入 ",e("span",{className:"text-ink",children:M(t.stat.inputTokens)})]}),n("span",{children:["输出 ",e("span",{className:"text-ink",children:M(t.stat.outputTokens)})]}),n("span",{children:["缓存读 ",e("span",{className:"text-ink",children:M(t.stat.cacheReadTokens)}),t.cacheHitRate!==void 0&&n("span",{className:"text-faint",children:[" (",B(t.cacheHitRate),")"]})]})]})}function oe(t){let{projects:u,selectedProjectID:b,onSelectProject:p}=t,{style:c}=y();if(u.length===0)return e("div",{className:c("surface.empty"),children:"暂无项目统计数据"});return e("div",{className:"divide-y divide-line",children:u.map((a)=>{let d=a.projectID??V,h=b===d,w=Math.max(a.tokenShare>0?1:0,a.tokenShare*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e("span",{className:"font-medium text-sm text-ink truncate",children:a.name}),e("span",{className:c("control.badge","font-mono truncate max-w-[240px]"),title:a.directory||"未绑定项目目录",children:a.directory||"独立会话"}),e("button",{type:"button",onClick:()=>p(h?null:d),className:"rounded px-1.5 py-0.5 text-[11px] text-accent hover:bg-accent/10 transition-colors cursor-pointer shrink-0",children:h?"取消筛选":"筛选"})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[e("span",{className:"text-xs font-medium text-ink",title:L(a.totalTokens),children:M(a.totalTokens)}),n("span",{className:"text-[11px] text-faint",children:["(",B(a.tokenShare),")"]})]})]}),e(K,{percent:w}),n(Y,{children:[e(J,{stat:a,cacheHitRate:a.cacheHitRate}),n(G,{children:[n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(a.activeDurationMs)})]}),n("span",{children:[e("span",{className:"text-ink",children:a.sessionCount.toLocaleString()})," 会话"]}),n("span",{children:["工具 ",e("span",{className:"text-ink",children:a.toolCalls.toLocaleString()})," 次"]})]})]})]},d)})})}function re(t){let{models:u}=t,{ModelIcon:b,style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无模型调用数据"});return e("div",{className:"divide-y divide-line",children:u.map((c)=>{let a=Math.max(c.share>0?1:0,c.share*100);return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e(b,{modelID:c.model,className:"size-4 shrink-0"}),e("span",{className:"font-mono text-sm font-medium text-ink truncate",children:c.shortName}),e("span",{className:p("control.badge","font-mono shrink-0"),children:c.provider})]}),n("div",{className:"flex items-baseline gap-2.5 font-mono tabular-nums shrink-0",children:[c.avgTps!==null&&n("span",{className:"text-[11px] text-dim",children:[c.avgTps.toFixed(1)," tok/s"]}),n("span",{className:"text-xs font-medium text-ink",title:L(c.totalTokens),children:[M(c.totalTokens)," ",n("span",{className:"text-[11px] font-normal text-faint",children:["(",B(c.share),")"]})]})]})]}),e(K,{percent:a}),n(Y,{children:[e(J,{stat:c,cacheHitRate:c.cacheHitRate}),n(G,{children:[n("span",{children:[e("span",{className:"text-ink",children:c.turns.toLocaleString()})," 轮",c.errors>0?n("span",{className:"text-danger",children:[" (",c.errors," 错)"]}):null]}),n("span",{children:["工具 ",e("span",{className:"text-ink",children:c.toolCalls.toLocaleString()})," 次"]}),c.generationMs>0&&n("span",{children:["推理 ",e("span",{className:"text-ink",children:ae(c.generationMs)})]})]})]})]},c.model)})})}function ie(t){let{tools:u}=t,{StatusChip:b,style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无工具调用数据"});return e("div",{className:"divide-y divide-line",children:u.map((c)=>{let a=Math.max(c.share>0?1:0,c.share*100),d=c.successRate>=0.95?"success":c.successRate>=0.8?"warning":"danger",h=Math.max(0,c.calls-c.errors),w=c.calls>0?Math.round(c.outputBytes/c.calls):0;return n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 items-center gap-2",children:[e("span",{className:"font-mono text-sm font-medium text-ink truncate",children:c.name}),n(b,{tone:d,children:["成功率 ",B(c.successRate)]})]}),n("div",{className:"flex items-baseline gap-1.5 font-mono tabular-nums shrink-0",children:[n("span",{className:"text-xs font-medium text-ink",children:[c.calls.toLocaleString()," 次"]}),n("span",{className:"text-[11px] text-faint",children:["(",B(c.share),")"]})]})]}),e(K,{percent:a}),n(Y,{children:[n(G,{children:[n("span",{children:["成功 ",e("span",{className:"text-ink",children:h.toLocaleString()})," 次"]}),n("span",{children:["失败 ",e("span",{className:c.errors>0?"text-danger":"text-ink",children:c.errors.toLocaleString()})," 次"]})]}),n(G,{children:[n("span",{children:["累计输出 ",e("span",{className:"text-ink",children:Q(c.outputBytes)})]}),n("span",{children:["单次均值 ",e("span",{className:"text-ink",children:Q(w)})]})]})]})]},c.name)})})}function le(t){let{sessions:u,onOpenSession:b}=t,{style:p}=y();if(u.length===0)return e("div",{className:p("surface.empty"),children:"暂无高消耗会话记录"});let c=Math.max(1,...u.map((a)=>a.totalTokens));return e("div",{className:"divide-y divide-line",children:u.map((a)=>{let d=c>0?Math.max(1,a.totalTokens/c*100):0,h=a.model.split("/").pop()??a.model;return n("button",{type:"button",onClick:()=>b(a.id),className:"group block w-full p-4 text-left space-y-2.5 hover:bg-raised/40 transition-colors cursor-pointer",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e("span",{className:"font-medium text-sm text-ink truncate group-hover:text-accent transition-colors",children:a.title.trim()||"新会话"}),e("span",{className:p("control.badge","font-mono truncate max-w-[140px] shrink-0"),title:a.projectName,children:a.projectName}),a.kind==="sub"&&e("span",{className:"rounded bg-accent/15 px-1.5 py-0.5 text-[10.5px] text-accent shrink-0",children:"子代理"}),a.archivedAt!==null&&e("span",{className:p("control.badge","shrink-0"),children:"已归档"})]}),n("div",{className:"flex items-center gap-1.5 font-mono tabular-nums shrink-0",children:[e("span",{className:"text-xs font-medium text-ink",title:L(a.totalTokens),children:M(a.totalTokens)}),e(it,{className:"size-3.5 text-faint group-hover:text-ink group-hover:translate-x-0.5 transition-all"})]})]}),e(K,{percent:d}),n(Y,{children:[e(J,{stat:a}),n(G,{children:[e("span",{className:"text-ink",children:h}),n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(a.activeDurationMs)})]}),n("span",{children:[e("span",{className:"text-ink",children:a.assistantTurns})," 轮"]}),e("span",{className:"text-faint",children:se(a.updated)})]})]})]},a.id)})})}var ce=[{value:"tokens",label:"Token 用量"},{value:"duration",label:"活跃耗时"},{value:"activity",label:"交互轮次"}];function ue(t){let{cn:u,Segmented:b,SettingGroup:p,style:c}=y(),{daily:a}=t,[d,h]=r("tokens"),[w,C]=r(null),D=v(()=>a.some((s)=>s.totalTokens>0||s.activeDurationMs>0||s.runs>0),[a]),F=v(()=>{if(a.length===0)return{totalText:"0",avgText:"0",peakDate:"—",peakValueText:"0"};if(d==="tokens"){let S=a.reduce((_,A)=>_+A.totalTokens,0),R=a.filter((_)=>_.totalTokens>0).length,N=a[0];for(let _ of a)if(!N||_.totalTokens>N.totalTokens)N=_;return{totalText:M(S),totalFullText:L(S),avgText:R>0?M(Math.round(S/R)):"0",peakDate:N&&N.totalTokens>0?W(N.date):"—",peakValueText:N&&N.totalTokens>0?M(N.totalTokens):"0"}}if(d==="duration"){let S=a.reduce((_,A)=>_+A.activeDurationMs,0),R=a.filter((_)=>_.activeDurationMs>0).length,N=a[0];for(let _ of a)if(!N||_.activeDurationMs>N.activeDurationMs)N=_;return{totalText:P(S),totalFullText:P(S),avgText:R>0?P(Math.round(S/R)):"0s",peakDate:N&&N.activeDurationMs>0?W(N.date):"—",peakValueText:N&&N.activeDurationMs>0?P(N.activeDurationMs):"0s"}}let s=a.reduce((S,R)=>S+R.assistantTurns,0),l=a.reduce((S,R)=>S+R.userMessages,0),x=s+l,T=a.filter((S)=>S.assistantTurns>0||S.userMessages>0).length,k=a[0];for(let S of a){let R=k?k.assistantTurns+k.userMessages:0;if(!k||S.assistantTurns+S.userMessages>R)k=S}let H=k?k.assistantTurns+k.userMessages:0;return{totalText:`${x.toLocaleString()} 轮`,totalFullText:`助手 ${s.toLocaleString()} 轮 · 用户 ${l.toLocaleString()} 问`,avgText:T>0?`${(x/T).toFixed(1)} 轮/天`:"0 轮/天",peakDate:k&&H>0?W(k.date):"—",peakValueText:k&&H>0?`${H.toLocaleString()} 轮`:"0 轮"}},[a,d]),j=v(()=>{if(w){let s=a.find((l)=>l.date===w);if(s)return s}for(let s=a.length-1;s>=0;s--){let l=a[s];if(l&&(l.totalTokens>0||l.activeDurationMs>0||l.runs>0))return l}return a[a.length-1]},[a,w]),z=v(()=>{if(d==="tokens")return Math.max(1,...a.map((s)=>s.totalTokens));if(d==="duration")return Math.max(1000,...a.map((s)=>s.activeDurationMs));return Math.max(1,...a.map((s)=>s.assistantTurns+s.userMessages))},[a,d]),m=v(()=>{if(a.length<=7)return a.map((x)=>x.date);let s=6,l=[];for(let x=0;x<s;x++){let T=Math.round(x*(a.length-1)/(s-1)),k=a[T];if(k)l.push(k.date)}return l},[a]);if(!D)return e(p,{title:"每日趋势",action:e(b,{value:d,onChange:(s)=>h(s),options:ce}),children:e("div",{className:c("surface.empty"),children:"当前时间范围内暂无活跃数据"})});return e(p,{title:"每日趋势",action:e(b,{value:d,onChange:(s)=>h(s),options:ce}),children:n("div",{className:"p-4 space-y-4",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 font-mono text-dim tabular-nums",children:[n("span",{children:["汇总 ",e("span",{className:"text-ink",children:F.totalText})]}),n("span",{children:["日均 ",e("span",{className:"text-ink",children:F.avgText})]}),n("span",{children:["峰值 ",e("span",{className:"text-ink",children:F.peakValueText}),F.peakDate!=="—"?n("span",{className:"text-faint",children:[" (",F.peakDate,")"]}):null]})]}),n("div",{className:"flex items-center gap-3 text-[11px] text-dim",children:[d==="tokens"&&n(f,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent/40"}),"缓存读"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"输入"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"输出"]})]}),d==="duration"&&n(f,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"工作调度"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"模型推理"]})]}),d==="activity"&&n(f,{children:[n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-accent"}),"助手回复"]}),n("span",{className:"inline-flex items-center gap-1.5",children:[e("span",{className:"size-2 rounded-full bg-success"}),"用户提问"]})]})]})]}),n("div",{className:"relative h-44 w-full pt-1",children:[n("div",{className:"absolute inset-0 flex flex-col justify-between pointer-events-none pb-5 text-[10px] text-faint/60",children:[e("div",{className:"border-b border-line/40 w-full"}),e("div",{className:"border-b border-line/30 w-full"}),e("div",{className:"border-b border-line/40 w-full"})]}),n("section",{"aria-label":"每日趋势柱状序列",className:"relative h-full flex flex-col justify-between",onMouseLeave:()=>C(null),children:[e("div",{className:"flex-1 flex items-end gap-1 sm:gap-1.5 pb-2",children:a.map((s)=>{let l=s.totalTokens;if(d==="duration")l=s.activeDurationMs;else if(d==="activity")l=s.assistantTurns+s.userMessages;let x=l<=0,T=x?0:Math.max(3,Math.min(100,l/z*100)),k=j?.date===s.date;return n("button",{type:"button","aria-label":`${s.date} 统计数据`,className:"flex-1 h-full flex flex-col justify-end items-center group cursor-pointer relative min-w-0 bg-transparent p-0 border-0 focus:outline-hidden",onMouseEnter:()=>C(s.date),onFocus:()=>C(s.date),onClick:()=>C(s.date),children:[e("div",{className:u("absolute inset-y-0 w-full rounded-xs transition-colors pointer-events-none",k?"bg-accent/10":"group-hover:bg-raised/60")}),x?e("div",{className:"h-1 w-full max-w-[24px] rounded-full bg-raised group-hover:bg-dim/30"}):n("div",{className:"w-full max-w-[24px] rounded-t-xs overflow-hidden flex flex-col justify-end transition-all duration-150",style:{height:`${T}%`},children:[d==="tokens"&&n(f,{children:[s.outputTokens>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${s.outputTokens/s.totalTokens*100}%`}}),s.inputTokens+s.cacheWriteTokens>0&&e("div",{className:"bg-accent transition-all duration-200",style:{height:`${(s.inputTokens+s.cacheWriteTokens)/s.totalTokens*100}%`}}),s.cacheReadTokens>0&&e("div",{className:"bg-accent/40 transition-all duration-200",style:{height:`${s.cacheReadTokens/s.totalTokens*100}%`}})]}),d==="duration"&&n(f,{children:[s.generationMs>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${Math.min(100,s.generationMs/Math.max(1,s.activeDurationMs)*100)}%`}}),e("div",{className:"bg-accent flex-1 transition-all duration-200"})]}),d==="activity"&&n(f,{children:[s.userMessages>0&&e("div",{className:"bg-success transition-all duration-200",style:{height:`${s.userMessages/Math.max(1,s.assistantTurns+s.userMessages)*100}%`}}),e("div",{className:"bg-accent flex-1 transition-all duration-200"})]})]}),k&&e("div",{className:"absolute -bottom-1 size-1 rounded-full bg-accent"})]},s.date)})}),e("div",{className:u("flex items-center pt-1.5 text-[10px] text-faint font-mono tabular-nums",a.length<=7?"gap-1 sm:gap-1.5":"justify-between"),children:m.map((s)=>e("div",{className:u("whitespace-nowrap",a.length<=7&&"flex-1 text-center"),children:W(s)},s))})]})]}),e("div",{className:"flex flex-wrap items-center justify-between gap-2 border-t border-line pt-3 font-mono text-xs tabular-nums",children:j?n(f,{children:[e("span",{className:"text-ink",children:Z(j.date)}),n("div",{className:"flex flex-wrap items-center gap-x-3.5 gap-y-1 text-dim",children:[n("span",{children:["Token ",e("span",{className:"text-ink",children:M(j.totalTokens)})]}),n("span",{children:["耗时 ",e("span",{className:"text-ink",children:P(j.activeDurationMs)})]}),n("span",{children:["交互 ",n("span",{className:"text-ink",children:[j.assistantTurns+j.userMessages," 轮"]})]}),n("span",{children:["工具 ",n("span",{className:"text-ink",children:[j.toolCalls," 次"]})]})]})]}):e("span",{className:"font-sans text-faint",children:"悬停柱状图查看单日明细"})})]})})}function pe(t){let{cn:u,SettingGroup:b}=y(),{daily:p,hourly:c}=t,[a,d]=r(null),h=v(()=>{let l=new Map;for(let T of c)l.set(T.hour,T);let x=[];for(let T=0;T<24;T++){let k=l.get(T);if(k)x.push(k);else x.push({hour:T,totalTokens:0,activeDurationMs:0,userMessages:0,assistantTurns:0,runs:0})}return x},[c]),w=v(()=>{let l=h[0];for(let x of h)if(!l||x.totalTokens>l.totalTokens)l=x;return l&&l.totalTokens>0?l:null},[h]),C=v(()=>h.reduce((l,x)=>l+x.totalTokens,0),[h]),D=v(()=>Math.max(1,...h.map((l)=>l.totalTokens)),[h]),F=v(()=>{if(C<=0)return 0;return h.filter((x)=>x.hour>=8&&x.hour<20).reduce((x,T)=>x+T.totalTokens,0)/C},[h,C]),j=v(()=>Math.max(1,...p.map((l)=>l.totalTokens)),[p]),z=v(()=>{let l=0,x=0;for(let T of p)if(T.totalTokens>0||T.activeDurationMs>0||T.runs>0){if(x++,x>l)l=x}else x=0;return l},[p]),m=v(()=>p.filter((l)=>l.totalTokens>0||l.activeDurationMs>0||l.runs>0).length,[p]),s=a!==null?h[a]:w;return n(b,{title:"活跃时段与热力",action:n("div",{className:"flex items-center gap-3 font-mono text-xs text-faint tabular-nums",children:[n("span",{children:["日间占比 ",B(F)]}),n("span",{children:["连续活跃 ",z," 天"]}),n("span",{children:["活跃 ",m,"/",p.length," 天"]})]}),children:[n("div",{className:"p-4 space-y-3",children:[n("div",{className:"flex flex-wrap items-center justify-between gap-2 text-xs",children:[e("span",{className:"text-dim",children:"24 小时分布"}),s?n("div",{className:"flex items-center gap-3 font-mono text-dim tabular-nums",children:[n("span",{className:"text-ink",children:[a!==null?"时段 ":"高峰 ",String(s.hour).padStart(2,"0"),":00 -"," ",String((s.hour+1)%24).padStart(2,"0"),":00"]}),e("span",{className:"text-ink",children:M(s.totalTokens)}),s.activeDurationMs>0&&e("span",{children:P(s.activeDurationMs)})]}):e("span",{className:"text-faint",children:"暂无时段分布"})]}),n("section",{"aria-label":"24 小时活跃分布序列",className:"h-28 w-full flex flex-col justify-between pt-1",onMouseLeave:()=>d(null),children:[e("div",{className:"flex-1 flex items-end gap-1.5 pb-1.5",children:h.map((l)=>{let x=w?.hour===l.hour,T=a===l.hour,k=l.totalTokens>0?Math.max(6,l.totalTokens/D*100):0,H=`${String(l.hour).padStart(2,"0")}:00 - ${String((l.hour+1)%24).padStart(2,"0")}:00
2
2
  消耗: ${L(l.totalTokens)} Token
3
3
  耗时: ${P(l.activeDurationMs)}
4
4
  助手轮次: ${l.assistantTurns} 轮`;return e("button",{type:"button","aria-label":`${String(l.hour).padStart(2,"0")}:00 时段统计`,className:"flex-1 h-full flex flex-col justify-end items-center group relative cursor-pointer bg-transparent p-0 border-0 focus:outline-hidden",title:H,onMouseEnter:()=>d(l.hour),onFocus:()=>d(l.hour),onClick:()=>d(l.hour),children:k>0?e("div",{className:u("w-full max-w-[20px] rounded-t-xs transition-all duration-200",x||T?"bg-accent":"bg-accent/55 group-hover:bg-accent"),style:{height:`${k}%`}}):e("div",{className:"h-1 w-full max-w-[20px] rounded-full bg-raised group-hover:bg-dim/30"})},l.hour)})}),n("div",{className:"flex justify-between items-center text-[10px] text-faint font-mono pt-1.5 border-t border-line/40",children:[e("span",{children:"00:00"}),e("span",{children:"04:00"}),e("span",{children:"08:00"}),e("span",{children:"12:00"}),e("span",{children:"16:00"}),e("span",{children:"20:00"}),e("span",{children:"23:00"})]})]})]}),n("div",{className:"p-4 space-y-2.5",children:[n("div",{className:"text-xs text-dim",children:["自然日热力 (",p.length," 天)"]}),e("div",{className:"flex flex-wrap items-center gap-1.5",children:p.map((l)=>{let x="bg-raised";if(l.totalTokens>0){let k=l.totalTokens/j;if(k<=0.33)x="bg-accent/30";else if(k<=0.66)x="bg-accent/60";else x="bg-accent"}let T=`${Z(l.date)}
@@ -0,0 +1 @@
1
+ import"./chunk-tfqarvdx.js";import"./chunk-vasppf6b.js";import{Po}from"./chunk-rh3xb76f.js";import"./chunk-z5qn0xev.js";import"./chunk-1ex3wgms.js";import"./chunk-sc63488q.js";import"./chunk-1qh7f5kr.js";export{Po as diagram};
@@ -1,4 +1,4 @@
1
- import{t,K,br,u,d,N,x,F,C,S,E,T,A,L,R,p,V,U,m}from"./chunk-veam6vk4.js";var fe=(e,s)=>br(e,"a",-s),wt=fe;function It(e,s){let i=de(e),n=i.filter((c)=>he(c,e)),r=0,o=0,a=[];if(n.length>1){let c=Kt(n);for(let h=0;h<n.length;++h){let l=n[h];l.angle=Math.atan2(l.x-c.x,l.y-c.y)}n.sort((h,l)=>l.angle-h.angle);let g=n[n.length-1];for(let h=0;h<n.length;++h){let l=n[h];o+=(g.x+l.x)*(l.y-g.y);let I={x:(l.x+g.x)/2,y:(l.y+g.y)/2},b=null;for(let _=0;_<l.parentIndex.length;++_)if(g.parentIndex.includes(l.parentIndex[_])){let M=e[l.parentIndex[_]],j=Math.atan2(l.x-M.x,l.y-M.y),G=Math.atan2(g.x-M.x,g.y-M.y),B=G-j;if(B<0)B+=2*Math.PI;let P=G-B/2,v=at(I,{x:M.x+M.radius*Math.sin(P),y:M.y+M.radius*Math.cos(P)});if(v>M.radius*2)v=M.radius*2;if(b==null||b.width>v)b={circle:M,width:v,p1:l,p2:g,large:v>M.radius,sweep:!0}}if(b!=null)a.push(b),r+=Tt(b.circle.radius,b.width),g=l}}else{let c=e[0];for(let h=1;h<e.length;++h)if(e[h].radius<c.radius)c=e[h];let g=!1;for(let h=0;h<e.length;++h)if(at(e[h],c)>Math.abs(c.radius-e[h].radius)){g=!0;break}if(g)r=o=0;else r=c.radius*c.radius*Math.PI,a.push({circle:c,p1:{x:c.x,y:c.y+c.radius},p2:{x:c.x-0.0000000001,y:c.y+c.radius},width:c.radius*2,large:!0,sweep:!0})}if(o/=2,s)s.area=r+o,s.arcArea=r,s.polygonArea=o,s.arcs=a,s.innerPoints=n,s.intersectionPoints=i;return r+o}function he(e,s){return s.every((i)=>at(e,i)<i.radius+0.0000000001)}function de(e){let s=[];for(let i=0;i<e.length;++i)for(let n=i+1;n<e.length;++n){let r=Wt(e[i],e[n]);for(let o of r)o.parentIndex=[i,n],s.push(o)}return s}function Tt(e,s){return e*e*Math.acos(1-s/e)-(e-s)*Math.sqrt(s*(2*e-s))}function at(e,s){return Math.sqrt((e.x-s.x)*(e.x-s.x)+(e.y-s.y)*(e.y-s.y))}function Nt(e,s,i){if(i>=e+s)return 0;if(i<=Math.abs(e-s))return Math.PI*Math.min(e,s)*Math.min(e,s);let n=e-(i*i-s*s+e*e)/(2*i),r=s-(i*i-e*e+s*s)/(2*i);return Tt(e,n)+Tt(s,r)}function Wt(e,s){let i=at(e,s),n=e.radius,r=s.radius;if(i>=n+r||i<=Math.abs(n-r))return[];let o=(n*n-r*r+i*i)/(2*i),a=Math.sqrt(n*n-o*o),c=e.x+o*(s.x-e.x)/i,g=e.y+o*(s.y-e.y)/i,h=-(s.y-e.y)*(a/i),l=-(s.x-e.x)*(a/i);return[{x:c+h,y:g-l},{x:c-h,y:g+l}]}function Kt(e){let s={x:0,y:0};for(let i of e)s.x+=i.x,s.y+=i.y;return s.x/=e.length,s.y/=e.length,s}function ge(e,s,i,n){n=n||{};let r=n.maxIterations||100,o=n.tolerance||0.0000000001,a=e(s),c=e(i),g=i-s;if(a*c>0)throw"Initial bisect points must have opposite signs";if(a===0)return s;if(c===0)return i;for(let h=0;h<r;++h){g/=2;let l=s+g,I=e(l);if(I*a>=0)s=l;if(Math.abs(g)<o||I===0)return l}return s+g}function zt(e){let s=Array(e);for(let i=0;i<e;++i)s[i]=0;return s}function Ut(e,s){return zt(e).map(()=>zt(s))}function mt(e,s){let i=0;for(let n=0;n<e.length;++n)i+=e[n]*s[n];return i}function At(e){return Math.sqrt(mt(e,e))}function Ct(e,s,i){for(let n=0;n<s.length;++n)e[n]=s[n]*i}function xt(e,s,i,n,r){for(let o=0;o<e.length;++o)e[o]=s*i[o]+n*r[o]}function Ht(e,s,i){i=i||{};let n=i.maxIterations||s.length*200,r=i.nonZeroDelta||1.05,o=i.zeroDelta||0.001,a=i.minErrorDelta||0.000001,c=i.minErrorDelta||0.00001,g=i.rho!==void 0?i.rho:1,h=i.chi!==void 0?i.chi:2,l=i.psi!==void 0?i.psi:-0.5,I=i.sigma!==void 0?i.sigma:0.5,b,_=s.length,M=Array(_+1);M[0]=s,M[0].fx=e(s),M[0].id=0;for(let z=0;z<_;++z){let f=s.slice();f[z]=f[z]?f[z]*r:o,M[z+1]=f,M[z+1].fx=e(f),M[z+1].id=z+1}function j(z){for(let f=0;f<z.length;f++)M[_][f]=z[f];M[_].fx=z.fx}let G=(z,f)=>z.fx-f.fx,B=s.slice(),P=s.slice(),v=s.slice(),w=s.slice();for(let z=0;z<n;++z){if(M.sort(G),i.history){let k=M.map((y)=>{let Y=y.slice();return Y.fx=y.fx,Y.id=y.id,Y});k.sort((y,Y)=>y.id-Y.id),i.history.push({x:M[0].slice(),fx:M[0].fx,simplex:k})}b=0;for(let k=0;k<_;++k)b=Math.max(b,Math.abs(M[0][k]-M[1][k]));if(Math.abs(M[0].fx-M[_].fx)<a&&b<c)break;for(let k=0;k<_;++k){B[k]=0;for(let y=0;y<_;++y)B[k]+=M[y][k];B[k]/=_}let f=M[_];if(xt(P,1+g,B,-g,f),P.fx=e(P),P.fx<M[0].fx)if(xt(w,1+h,B,-h,f),w.fx=e(w),w.fx<P.fx)j(w);else j(P);else if(P.fx>=M[_-1].fx){let k=!1;if(P.fx>f.fx)if(xt(v,1+l,B,-l,f),v.fx=e(v),v.fx<f.fx)j(v);else k=!0;else if(xt(v,1-l*g,B,l*g,f),v.fx=e(v),v.fx<P.fx)j(v);else k=!0;if(k){if(I>=1)break;for(let y=1;y<M.length;++y)xt(M[y],1-I,M[0],I,M[y]),M[y].fx=e(M[y])}}else j(P)}return M.sort(G),{fx:M[0].fx,x:M[0]}}function xe(e,s,i,n,r,o,a){let c=i.fx,g=mt(i.fxprime,s),h=c,l=c,I=g,b=0;r=r||1,o=o||0.000001,a=a||0.1;function _(M,j,G){for(let B=0;B<16;++B)if(r=(M+j)/2,xt(n.x,1,i.x,r,s),h=n.fx=e(n.x,n.fxprime),I=mt(n.fxprime,s),h>c+o*r*g||h>=G)j=r;else{if(Math.abs(I)<=-a*g)return r;if(I*(j-M)>=0)j=M;M=r,G=h}return 0}for(let M=0;M<10;++M){if(xt(n.x,1,i.x,r,s),h=n.fx=e(n.x,n.fxprime),I=mt(n.fxprime,s),h>c+o*r*g||M&&h>=l)return _(b,r,l);if(Math.abs(I)<=-a*g)return r;if(I>=0)return _(r,b,h);l=h,b=r,r*=2}return r}function ye(e,s,i){let n={x:s.slice(),fx:0,fxprime:s.slice()},r={x:s.slice(),fx:0,fxprime:s.slice()},o=s.slice(),a,c,g=1,h;i=i||{},h=i.maxIterations||s.length*20,n.fx=e(n.x,n.fxprime),a=n.fxprime.slice(),Ct(a,n.fxprime,-1);for(let l=0;l<h;++l){if(g=xe(e,a,n,r,g),i.history)i.history.push({x:n.x.slice(),fx:n.fx,fxprime:n.fxprime.slice(),alpha:g});if(!g)Ct(a,n.fxprime,-1);else{xt(o,1,r.fxprime,-1,n.fxprime);let I=mt(n.fxprime,n.fxprime),b=Math.max(0,mt(o,r.fxprime)/I);xt(a,b,a,-1,r.fxprime),c=n,n=r,r=c}if(At(n.fxprime)<=0.00001)break}if(i.history)i.history.push({x:n.x.slice(),fx:n.fx,fxprime:n.fxprime.slice(),alpha:g});return n}function Yt(e,s={}){s.maxIterations=s.maxIterations||500;let i=s.initialLayout||ve,n=s.lossFunction||bt,r=pe(e,s),o=i(r,s),a=Object.keys(o),c=[];for(let l of a)c.push(o[l].x),c.push(o[l].y);let h=Ht((l)=>{let I={};for(let b=0;b<a.length;++b){let _=a[b];I[_]={x:l[2*b],y:l[2*b+1],radius:o[_].radius}}return n(I,r)},c,s).x;for(let l=0;l<a.length;++l){let I=a[l];o[I].x=h[2*l],o[I].y=h[2*l+1]}return o}var Xt=0.0000000001;function Dt(e,s,i){if(Math.min(e,s)*Math.min(e,s)*Math.PI<=i+Xt)return Math.abs(e-s);return ge((n)=>Nt(e,s,n)-i,0,e+s)}function pe(e,s={}){let i=s.distinct,n=e.map((c)=>Object.assign({},c));function r(c){return c.join(";")}if(i){let c=new Map;for(let g of n)for(let h=0;h<g.sets.length;h++){let l=String(g.sets[h]);c.set(l,g.size+(c.get(l)||0));for(let I=h+1;I<g.sets.length;I++){let b=String(g.sets[I]),_=`${l};${b}`,M=`${b};${l}`;c.set(_,g.size+(c.get(_)||0)),c.set(M,g.size+(c.get(M)||0))}}for(let g of n)if(g.sets.length<3)g.size=c.get(r(g.sets))}let o=[],a=new Set;for(let c of n)if(c.sets.length===1)o.push(c.sets[0]);else if(c.sets.length===2){let g=c.sets[0],h=c.sets[1];a.add(r(c.sets)),a.add(r([h,g]))}o.sort((c,g)=>c===g?0:c<g?-1:1);for(let c=0;c<o.length;++c){let g=o[c];for(let h=c+1;h<o.length;++h){let l=o[h];if(!a.has(r([g,l])))n.push({sets:[g,l],size:0})}}return n}function me(e,s,i){let n=Ut(s.length,s.length),r=Ut(s.length,s.length);return e.filter((o)=>o.sets.length===2).forEach((o)=>{let a=i[o.sets[0]],c=i[o.sets[1]],g=Math.sqrt(s[a].size/Math.PI),h=Math.sqrt(s[c].size/Math.PI),l=Dt(g,h,o.size);n[a][c]=n[c][a]=l;let I=0;if(o.size+0.0000000001>=Math.min(s[a].size,s[c].size))I=1;else if(o.size<=0.0000000001)I=-1;r[a][c]=r[c][a]=I}),{distances:n,constraints:r}}function be(e,s,i,n){for(let o=0;o<s.length;++o)s[o]=0;let r=0;for(let o=0;o<i.length;++o){let a=e[2*o],c=e[2*o+1];for(let g=o+1;g<i.length;++g){let h=e[2*g],l=e[2*g+1],I=i[o][g],b=n[o][g],_=(h-a)*(h-a)+(l-c)*(l-c),M=Math.sqrt(_),j=_-I*I;if(b>0&&M<=I||b<0&&M>=I)continue;r+=2*j*j,s[2*o]+=4*j*(a-h),s[2*o+1]+=4*j*(c-l),s[2*g]+=4*j*(h-a),s[2*g+1]+=4*j*(l-c)}}return r}function ve(e,s={}){let i=Ie(e,s),n=s.lossFunction||bt;if(e.length>=8){let r=ke(e,s),o=n(r,e),a=n(i,e);if(o+0.00000001<a)i=r}return i}function ke(e,s={}){let i=s.restarts||10,n=[],r={};for(let b of e)if(b.sets.length===1)r[b.sets[0]]=n.length,n.push(b);let{distances:o,constraints:a}=me(e,n,r),c=At(o.map(At))/o.length;o=o.map((b)=>b.map((_)=>_/c));let g=(b,_)=>be(b,_,o,a),h=null;for(let b=0;b<i;++b){let _=zt(o.length*2).map(Math.random),M=ye(g,_,s);if(!h||M.fx<h.fx)h=M}let l=h.x,I={};for(let b=0;b<n.length;++b){let _=n[b];I[_.sets[0]]={x:l[2*b]*c,y:l[2*b+1]*c,radius:Math.sqrt(_.size/Math.PI)}}if(s.history)for(let b of s.history)Ct(b.x,c);return I}function Ie(e,s){let i=s&&s.lossFunction?s.lossFunction:bt,n={},r={};for(let I of e)if(I.sets.length===1){let b=I.sets[0];n[b]={x:10000000000,y:10000000000,rowid:n.length,size:I.size,radius:Math.sqrt(I.size/Math.PI)},r[b]=[]}e=e.filter((I)=>I.sets.length===2);for(let I of e){let b=I.weight!=null?I.weight:1,_=I.sets[0],M=I.sets[1];if(I.size+Xt>=Math.min(n[_].size,n[M].size))b=0;r[_].push({set:M,size:I.size,weight:b}),r[M].push({set:_,size:I.size,weight:b})}let o=[];Object.keys(r).forEach((I)=>{let b=0;for(let _=0;_<r[I].length;++_)b+=r[I][_].size*r[I][_].weight;o.push({set:I,size:b})});function a(I,b){return b.size-I.size}o.sort(a);let c={};function g(I){return I.set in c}function h(I,b){n[b].x=I.x,n[b].y=I.y,c[b]=!0}h({x:0,y:0},o[0].set);for(let I=1;I<o.length;++I){let b=o[I].set,_=r[b].filter(g),M=n[b];if(_.sort(a),_.length===0)throw"ERROR: missing pairwise overlap information";let j=[];for(var l=0;l<_.length;++l){let P=n[_[l].set],v=Dt(M.radius,P.radius,_[l].size);j.push({x:P.x+v,y:P.y}),j.push({x:P.x-v,y:P.y}),j.push({y:P.y+v,x:P.x}),j.push({y:P.y-v,x:P.x});for(let w=l+1;w<_.length;++w){let z=n[_[w].set],f=Dt(M.radius,z.radius,_[w].size),k=Wt({x:P.x,y:P.y,radius:v},{x:z.x,y:z.y,radius:f});j.push(...k)}}let G=100000000000000000000000000000000000000000000000000,B=j[0];for(let P of j){n[b].x=P.x,n[b].y=P.y;let v=i(n,e);if(v<G)G=v,B=P}h(B,b)}return n}function bt(e,s){let i=0;for(let n of s){if(n.sets.length===1)continue;let r;if(n.sets.length===2){let a=e[n.sets[0]],c=e[n.sets[1]];r=Nt(a.radius,c.radius,at(a,c))}else r=It(n.sets.map((a)=>e[a]));let o=n.weight!=null?n.weight:1;i+=o*(r-n.size)*(r-n.size)}return i}function Zt(e,s){let i=0;for(let n of s){if(n.sets.length===1)continue;let r;if(n.sets.length===2){let c=e[n.sets[0]],g=e[n.sets[1]];r=Nt(c.radius,g.radius,at(c,g))}else r=It(n.sets.map((c)=>e[c]));let o=n.weight!=null?n.weight:1,a=Math.log((r+1)/(n.size+1));i+=o*a*a}return i}function Me(e,s,i){if(i==null)e.sort((r,o)=>o.radius-r.radius);else e.sort(i);if(e.length>0){let r=e[0].x,o=e[0].y;for(let a of e)a.x-=r,a.y-=o}if(e.length===2){if(at(e[0],e[1])<Math.abs(e[1].radius-e[0].radius))e[1].x=e[0].x+e[0].radius-e[1].radius-0.0000000001,e[1].y=e[0].y}if(e.length>1){let r=Math.atan2(e[1].x,e[1].y)-s,o=Math.cos(r),a=Math.sin(r);for(let c of e){let{x:g,y:h}=c;c.x=o*g-a*h,c.y=a*g+o*h}}if(e.length>2){let r=Math.atan2(e[2].x,e[2].y)-s;while(r<0)r+=2*Math.PI;while(r>2*Math.PI)r-=2*Math.PI;if(r>Math.PI){let o=e[1].y/(0.0000000001+e[1].x);for(let a of e){var n=(a.x+o*a.y)/(1+o*o);a.x=2*n-a.x,a.y=2*n*o-a.y}}}}function Se(e){e.forEach((r)=>{r.parent=r});function s(r){if(r.parent!==r)r.parent=s(r.parent);return r.parent}function i(r,o){let a=s(r),c=s(o);a.parent=c}for(let r=0;r<e.length;++r)for(let o=r+1;o<e.length;++o){let a=e[r].radius+e[o].radius;if(at(e[r],e[o])+0.0000000001<a)i(e[o],e[r])}let n=new Map;for(let r=0;r<e.length;++r){let o=s(e[r]).parent.setid;if(!n.has(o))n.set(o,[]);n.get(o).push(e[r])}return e.forEach((r)=>{delete r.parent}),Array.from(n.values())}function Rt(e){let s=(i)=>{let n=e.reduce((o,a)=>Math.max(o,a[i]+a.radius),Number.NEGATIVE_INFINITY),r=e.reduce((o,a)=>Math.min(o,a[i]-a.radius),Number.POSITIVE_INFINITY);return{max:n,min:r}};return{xRange:s("x"),yRange:s("y")}}function Jt(e,s,i){if(s==null)s=Math.PI/2;let n=te(e).map((h)=>Object.assign({},h)),r=Se(n);for(let h of r){Me(h,s,i);let l=Rt(h);h.size=(l.xRange.max-l.xRange.min)*(l.yRange.max-l.yRange.min),h.bounds=l}r.sort((h,l)=>l.size-h.size),n=r[0];let o=n.bounds,a=(o.xRange.max-o.xRange.min)/50;function c(h,l,I){if(!h)return;let b=h.bounds,_,M;if(l)_=o.xRange.max-b.xRange.min+a;else{_=o.xRange.max-b.xRange.max;let j=(b.xRange.max-b.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;if(j<0)_+=j}if(I)M=o.yRange.max-b.yRange.min+a;else{M=o.yRange.max-b.yRange.max;let j=(b.yRange.max-b.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;if(j<0)M+=j}for(let j of h)j.x+=_,j.y+=M,n.push(j)}let g=1;while(g<r.length)c(r[g],!0,!1),c(r[g+1],!1,!0),c(r[g+2],!0,!0),g+=3,o=Rt(n);return $t(n)}function Qt(e,s,i,n,r){let o=te(e);s-=2*n,i-=2*n;let{xRange:a,yRange:c}=Rt(o);if(a.max===a.min||c.max===c.min)return console.log("not scaling solution: zero size detected"),e;let g,h;if(r){let _=Math.sqrt(r/Math.PI)*2;g=s/_,h=i/_}else g=s/(a.max-a.min),h=i/(c.max-c.min);let l=Math.min(h,g),I=(s-(a.max-a.min)*l)/2,b=(i-(c.max-c.min)*l)/2;return $t(o.map((_)=>({radius:l*_.radius,x:n+I+(_.x-a.min)*l,y:n+b+(_.y-c.min)*l,setid:_.setid})))}function $t(e){let s={};for(let i of e)s[i.setid]=i;return s}function te(e){return Object.keys(e).map((i)=>Object.assign(e[i],{setid:i}))}function ee(e={}){let s=!1,i=600,n=350,r=15,o=1000,a=Math.PI/2,c=!0,g=null,h=!0,l=!0,I=null,b=null,_=!1,M=null,j=e&&e.symmetricalTextCentre?e.symmetricalTextCentre:!1,G={},B=e&&e.colourScheme?e.colourScheme:e&&e.colorScheme?e.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],P=0,v=function(k){if(k in G)return G[k];var y=G[k]=B[P];if(P+=1,P>=B.length)P=0;return y},w=Yt,z=bt;function f(k){let y=k.datum(),Y=new Set;y.forEach((D)=>{if(D.size==0&&D.sets.length==1)Y.add(D.sets[0])}),y=y.filter((D)=>!D.sets.some((Q)=>Y.has(Q)));let O={},X={};if(y.length>0){let D=w(y,{lossFunction:z,distinct:_});if(c)D=Jt(D,a,b);O=Qt(D,i,n,r,g),X=se(O,y,j)}let lt={};y.forEach((D)=>{if(D.label)lt[D.sets]=D.label});function st(D){if(D.sets in lt)return lt[D.sets];if(D.sets.length==1)return""+D.sets[0]}k.selectAll("svg").data([O]).enter().append("svg");let J=k.select("svg");if(s)J.attr("viewBox",`0 0 ${i} ${n}`);else J.attr("width",i).attr("height",n);let H={},Z=!1;J.selectAll(".venn-area path").each(function(D){let Q=this.getAttribute("d");if(D.sets.length==1&&Q&&!_)Z=!0,H[D.sets[0]]=Ee(Q)});function q(D){return(Q)=>{let pt=D.sets.map((gt)=>{let dt=H[gt],ot=O[gt];if(!dt)dt={x:i/2,y:n/2,radius:1};if(!ot)ot={x:i/2,y:n/2,radius:1};return{x:dt.x*(1-Q)+ot.x*Q,y:dt.y*(1-Q)+ot.y*Q,radius:dt.radius*(1-Q)+ot.radius*Q}});return Gt(pt,M)}}let tt=J.selectAll(".venn-area").data(y,(D)=>D.sets),it=tt.enter().append("g").attr("class",(D)=>`venn-area venn-${D.sets.length==1?"circle":"intersection"}${D.colour||D.color?" venn-coloured":""}`).attr("data-venn-sets",(D)=>D.sets.join("_")),et=it.append("path"),ct=it.append("text").attr("class","label").text((D)=>st(D)).attr("text-anchor","middle").attr("dy",".35em").attr("x",i/2).attr("y",n/2);if(l)et.style("fill-opacity","0").filter((D)=>D.sets.length==1).style("fill",(D)=>D.colour?D.colour:D.color?D.color:v(D.sets)).style("fill-opacity",".25"),ct.style("fill",(D)=>{if(D.colour||D.color)return"#FFF";if(e.textFill)return e.textFill;return D.sets.length==1?v(D.sets):"#444"});function rt(D){if(typeof D.transition==="function")return D.transition("venn").duration(o);return D}let nt=k;if(Z&&typeof nt.transition==="function")nt=rt(k),nt.selectAll("path").attrTween("d",q);else nt.selectAll("path").attr("d",(D)=>Gt(D.sets.map((Q)=>O[Q])),M);let W=nt.selectAll("text").filter((D)=>(D.sets in X)).text((D)=>st(D)).attr("x",(D)=>Math.floor(X[D.sets].x)).attr("y",(D)=>Math.floor(X[D.sets].y));if(h)if(Z)if("on"in W)W.on("end",_t(O,st));else W.each("end",_t(O,st));else W.each(_t(O,st));let ht=rt(tt.exit()).remove();if(typeof tt.transition==="function")ht.selectAll("path").attrTween("d",q);let ft=ht.selectAll("text").attr("x",i/2).attr("y",n/2);if(I!==null)ct.style("font-size","0px"),W.style("font-size",I),ft.style("font-size","0px");return{circles:O,textCentres:X,nodes:tt,enter:it,update:nt,exit:ht}}return f.wrap=function(k){if(!arguments.length)return h;return h=k,f},f.useViewBox=function(){return s=!0,f},f.width=function(k){if(!arguments.length)return i;return i=k,f},f.height=function(k){if(!arguments.length)return n;return n=k,f},f.padding=function(k){if(!arguments.length)return r;return r=k,f},f.distinct=function(k){if(!arguments.length)return _;return _=k,f},f.colours=function(k){if(!arguments.length)return v;return v=k,f},f.colors=function(k){if(!arguments.length)return v;return v=k,f},f.fontSize=function(k){if(!arguments.length)return I;return I=k,f},f.round=function(k){if(!arguments.length)return M;return M=k,f},f.duration=function(k){if(!arguments.length)return o;return o=k,f},f.layoutFunction=function(k){if(!arguments.length)return w;return w=k,f},f.normalize=function(k){if(!arguments.length)return c;return c=k,f},f.scaleToFit=function(k){if(!arguments.length)return g;return g=k,f},f.styled=function(k){if(!arguments.length)return l;return l=k,f},f.orientation=function(k){if(!arguments.length)return a;return a=k,f},f.orientationOrder=function(k){if(!arguments.length)return b;return b=k,f},f.lossFunction=function(k){if(!arguments.length)return z;return z=k==="default"?bt:k==="logRatio"?Zt:k,f},f}function _t(e,s){return function(i){let n=this,r=e[i.sets[0]].radius||50,o=s(i)||"",a=o.split(/\s+/).reverse(),c=3,g=(o.length+a.length)/3,h=a.pop(),l=[h],I=0,b=1.1;n.textContent=null;let _=[];function M(v){let w=n.ownerDocument.createElementNS(n.namespaceURI,"tspan");return w.textContent=v,_.push(w),n.append(w),w}let j=M(h);while(!0){if(h=a.pop(),!h)break;l.push(h);let v=l.join(" ");if(j.textContent=v,v.length>g&&j.getComputedTextLength()>r)l.pop(),j.textContent=l.join(" "),l=[h],j=M(h),I++}let G=0.35-I*b/2,B=n.getAttribute("x"),P=n.getAttribute("y");_.forEach((v,w)=>{v.setAttribute("x",B),v.setAttribute("y",P),v.setAttribute("dy",`${G+w*b}em`)})}}function Et(e,s,i){let n=s[0].radius-at(s[0],e);for(let r=1;r<s.length;++r){let o=s[r].radius-at(s[r],e);if(o<=n)n=o}for(let r=0;r<i.length;++r){let o=at(i[r],e)-i[r].radius;if(o<=n)n=o}return n}function ne(e,s,i){let n=[];for(let l of e)n.push({x:l.x,y:l.y}),n.push({x:l.x+l.radius/2,y:l.y}),n.push({x:l.x-l.radius/2,y:l.y}),n.push({x:l.x,y:l.y+l.radius/2}),n.push({x:l.x,y:l.y-l.radius/2});let r=n[0],o=Et(n[0],e,s);for(let l=1;l<n.length;++l){let I=Et(n[l],e,s);if(I>=o)r=n[l],o=I}let a=Ht((l)=>-1*Et({x:l[0],y:l[1]},e,s),[r.x,r.y],{maxIterations:500,minErrorDelta:0.0000000001}).x,c={x:i?0:a[0],y:a[1]},g=!0;for(let l of e)if(at(c,l)>l.radius){g=!1;break}for(let l of s)if(at(c,l)<l.radius){g=!1;break}if(g)return c;if(e.length==1)return{x:e[0].x,y:e[0].y};let h={};if(It(e,h),h.arcs.length===0)return{x:0,y:-1000,disjoint:!0};if(h.arcs.length==1)return{x:h.arcs[0].circle.x,y:h.arcs[0].circle.y};if(s.length)return ne(e,[]);return Kt(h.arcs.map((l)=>l.p1))}function we(e){let s={},i=Object.keys(e);for(let n of i)s[n]=[];for(let n=0;n<i.length;n++){let r=i[n],o=e[r];for(let a=n+1;a<i.length;++a){let c=i[a],g=e[c],h=at(o,g);if(h+g.radius<=o.radius+0.0000000001)s[c].push(r);else if(h+o.radius<=g.radius+0.0000000001)s[r].push(c)}}return s}function se(e,s,i){let n={},r=we(e);for(let o=0;o<s.length;++o){let a=s[o].sets,c={},g={};for(let b=0;b<a.length;++b){c[a[b]]=!0;let _=r[a[b]];for(let M=0;M<_.length;++M)g[_[M]]=!0}let h=[],l=[];for(let b in e)if(b in c)h.push(e[b]);else if(!(b in g))l.push(e[b]);let I=ne(h,l,i);if(n[a]=I,I.disjoint&&s[o].size>0)console.log("WARNING: area "+a+" not represented on screen")}return n}function _e(e,s,i){let n=[];return n.push(`
1
+ import{t,K,br,u,d,N,x,F,C,S,E,T,A,L,R,p,V,U,m}from"./chunk-tfqarvdx.js";var fe=(e,s)=>br(e,"a",-s),wt=fe;function It(e,s){let i=de(e),n=i.filter((c)=>he(c,e)),r=0,o=0,a=[];if(n.length>1){let c=Kt(n);for(let h=0;h<n.length;++h){let l=n[h];l.angle=Math.atan2(l.x-c.x,l.y-c.y)}n.sort((h,l)=>l.angle-h.angle);let g=n[n.length-1];for(let h=0;h<n.length;++h){let l=n[h];o+=(g.x+l.x)*(l.y-g.y);let I={x:(l.x+g.x)/2,y:(l.y+g.y)/2},b=null;for(let _=0;_<l.parentIndex.length;++_)if(g.parentIndex.includes(l.parentIndex[_])){let M=e[l.parentIndex[_]],j=Math.atan2(l.x-M.x,l.y-M.y),G=Math.atan2(g.x-M.x,g.y-M.y),B=G-j;if(B<0)B+=2*Math.PI;let P=G-B/2,v=at(I,{x:M.x+M.radius*Math.sin(P),y:M.y+M.radius*Math.cos(P)});if(v>M.radius*2)v=M.radius*2;if(b==null||b.width>v)b={circle:M,width:v,p1:l,p2:g,large:v>M.radius,sweep:!0}}if(b!=null)a.push(b),r+=Tt(b.circle.radius,b.width),g=l}}else{let c=e[0];for(let h=1;h<e.length;++h)if(e[h].radius<c.radius)c=e[h];let g=!1;for(let h=0;h<e.length;++h)if(at(e[h],c)>Math.abs(c.radius-e[h].radius)){g=!0;break}if(g)r=o=0;else r=c.radius*c.radius*Math.PI,a.push({circle:c,p1:{x:c.x,y:c.y+c.radius},p2:{x:c.x-0.0000000001,y:c.y+c.radius},width:c.radius*2,large:!0,sweep:!0})}if(o/=2,s)s.area=r+o,s.arcArea=r,s.polygonArea=o,s.arcs=a,s.innerPoints=n,s.intersectionPoints=i;return r+o}function he(e,s){return s.every((i)=>at(e,i)<i.radius+0.0000000001)}function de(e){let s=[];for(let i=0;i<e.length;++i)for(let n=i+1;n<e.length;++n){let r=Wt(e[i],e[n]);for(let o of r)o.parentIndex=[i,n],s.push(o)}return s}function Tt(e,s){return e*e*Math.acos(1-s/e)-(e-s)*Math.sqrt(s*(2*e-s))}function at(e,s){return Math.sqrt((e.x-s.x)*(e.x-s.x)+(e.y-s.y)*(e.y-s.y))}function Nt(e,s,i){if(i>=e+s)return 0;if(i<=Math.abs(e-s))return Math.PI*Math.min(e,s)*Math.min(e,s);let n=e-(i*i-s*s+e*e)/(2*i),r=s-(i*i-e*e+s*s)/(2*i);return Tt(e,n)+Tt(s,r)}function Wt(e,s){let i=at(e,s),n=e.radius,r=s.radius;if(i>=n+r||i<=Math.abs(n-r))return[];let o=(n*n-r*r+i*i)/(2*i),a=Math.sqrt(n*n-o*o),c=e.x+o*(s.x-e.x)/i,g=e.y+o*(s.y-e.y)/i,h=-(s.y-e.y)*(a/i),l=-(s.x-e.x)*(a/i);return[{x:c+h,y:g-l},{x:c-h,y:g+l}]}function Kt(e){let s={x:0,y:0};for(let i of e)s.x+=i.x,s.y+=i.y;return s.x/=e.length,s.y/=e.length,s}function ge(e,s,i,n){n=n||{};let r=n.maxIterations||100,o=n.tolerance||0.0000000001,a=e(s),c=e(i),g=i-s;if(a*c>0)throw"Initial bisect points must have opposite signs";if(a===0)return s;if(c===0)return i;for(let h=0;h<r;++h){g/=2;let l=s+g,I=e(l);if(I*a>=0)s=l;if(Math.abs(g)<o||I===0)return l}return s+g}function zt(e){let s=Array(e);for(let i=0;i<e;++i)s[i]=0;return s}function Ut(e,s){return zt(e).map(()=>zt(s))}function mt(e,s){let i=0;for(let n=0;n<e.length;++n)i+=e[n]*s[n];return i}function At(e){return Math.sqrt(mt(e,e))}function Ct(e,s,i){for(let n=0;n<s.length;++n)e[n]=s[n]*i}function xt(e,s,i,n,r){for(let o=0;o<e.length;++o)e[o]=s*i[o]+n*r[o]}function Ht(e,s,i){i=i||{};let n=i.maxIterations||s.length*200,r=i.nonZeroDelta||1.05,o=i.zeroDelta||0.001,a=i.minErrorDelta||0.000001,c=i.minErrorDelta||0.00001,g=i.rho!==void 0?i.rho:1,h=i.chi!==void 0?i.chi:2,l=i.psi!==void 0?i.psi:-0.5,I=i.sigma!==void 0?i.sigma:0.5,b,_=s.length,M=Array(_+1);M[0]=s,M[0].fx=e(s),M[0].id=0;for(let z=0;z<_;++z){let f=s.slice();f[z]=f[z]?f[z]*r:o,M[z+1]=f,M[z+1].fx=e(f),M[z+1].id=z+1}function j(z){for(let f=0;f<z.length;f++)M[_][f]=z[f];M[_].fx=z.fx}let G=(z,f)=>z.fx-f.fx,B=s.slice(),P=s.slice(),v=s.slice(),w=s.slice();for(let z=0;z<n;++z){if(M.sort(G),i.history){let k=M.map((y)=>{let Y=y.slice();return Y.fx=y.fx,Y.id=y.id,Y});k.sort((y,Y)=>y.id-Y.id),i.history.push({x:M[0].slice(),fx:M[0].fx,simplex:k})}b=0;for(let k=0;k<_;++k)b=Math.max(b,Math.abs(M[0][k]-M[1][k]));if(Math.abs(M[0].fx-M[_].fx)<a&&b<c)break;for(let k=0;k<_;++k){B[k]=0;for(let y=0;y<_;++y)B[k]+=M[y][k];B[k]/=_}let f=M[_];if(xt(P,1+g,B,-g,f),P.fx=e(P),P.fx<M[0].fx)if(xt(w,1+h,B,-h,f),w.fx=e(w),w.fx<P.fx)j(w);else j(P);else if(P.fx>=M[_-1].fx){let k=!1;if(P.fx>f.fx)if(xt(v,1+l,B,-l,f),v.fx=e(v),v.fx<f.fx)j(v);else k=!0;else if(xt(v,1-l*g,B,l*g,f),v.fx=e(v),v.fx<P.fx)j(v);else k=!0;if(k){if(I>=1)break;for(let y=1;y<M.length;++y)xt(M[y],1-I,M[0],I,M[y]),M[y].fx=e(M[y])}}else j(P)}return M.sort(G),{fx:M[0].fx,x:M[0]}}function xe(e,s,i,n,r,o,a){let c=i.fx,g=mt(i.fxprime,s),h=c,l=c,I=g,b=0;r=r||1,o=o||0.000001,a=a||0.1;function _(M,j,G){for(let B=0;B<16;++B)if(r=(M+j)/2,xt(n.x,1,i.x,r,s),h=n.fx=e(n.x,n.fxprime),I=mt(n.fxprime,s),h>c+o*r*g||h>=G)j=r;else{if(Math.abs(I)<=-a*g)return r;if(I*(j-M)>=0)j=M;M=r,G=h}return 0}for(let M=0;M<10;++M){if(xt(n.x,1,i.x,r,s),h=n.fx=e(n.x,n.fxprime),I=mt(n.fxprime,s),h>c+o*r*g||M&&h>=l)return _(b,r,l);if(Math.abs(I)<=-a*g)return r;if(I>=0)return _(r,b,h);l=h,b=r,r*=2}return r}function ye(e,s,i){let n={x:s.slice(),fx:0,fxprime:s.slice()},r={x:s.slice(),fx:0,fxprime:s.slice()},o=s.slice(),a,c,g=1,h;i=i||{},h=i.maxIterations||s.length*20,n.fx=e(n.x,n.fxprime),a=n.fxprime.slice(),Ct(a,n.fxprime,-1);for(let l=0;l<h;++l){if(g=xe(e,a,n,r,g),i.history)i.history.push({x:n.x.slice(),fx:n.fx,fxprime:n.fxprime.slice(),alpha:g});if(!g)Ct(a,n.fxprime,-1);else{xt(o,1,r.fxprime,-1,n.fxprime);let I=mt(n.fxprime,n.fxprime),b=Math.max(0,mt(o,r.fxprime)/I);xt(a,b,a,-1,r.fxprime),c=n,n=r,r=c}if(At(n.fxprime)<=0.00001)break}if(i.history)i.history.push({x:n.x.slice(),fx:n.fx,fxprime:n.fxprime.slice(),alpha:g});return n}function Yt(e,s={}){s.maxIterations=s.maxIterations||500;let i=s.initialLayout||ve,n=s.lossFunction||bt,r=pe(e,s),o=i(r,s),a=Object.keys(o),c=[];for(let l of a)c.push(o[l].x),c.push(o[l].y);let h=Ht((l)=>{let I={};for(let b=0;b<a.length;++b){let _=a[b];I[_]={x:l[2*b],y:l[2*b+1],radius:o[_].radius}}return n(I,r)},c,s).x;for(let l=0;l<a.length;++l){let I=a[l];o[I].x=h[2*l],o[I].y=h[2*l+1]}return o}var Xt=0.0000000001;function Dt(e,s,i){if(Math.min(e,s)*Math.min(e,s)*Math.PI<=i+Xt)return Math.abs(e-s);return ge((n)=>Nt(e,s,n)-i,0,e+s)}function pe(e,s={}){let i=s.distinct,n=e.map((c)=>Object.assign({},c));function r(c){return c.join(";")}if(i){let c=new Map;for(let g of n)for(let h=0;h<g.sets.length;h++){let l=String(g.sets[h]);c.set(l,g.size+(c.get(l)||0));for(let I=h+1;I<g.sets.length;I++){let b=String(g.sets[I]),_=`${l};${b}`,M=`${b};${l}`;c.set(_,g.size+(c.get(_)||0)),c.set(M,g.size+(c.get(M)||0))}}for(let g of n)if(g.sets.length<3)g.size=c.get(r(g.sets))}let o=[],a=new Set;for(let c of n)if(c.sets.length===1)o.push(c.sets[0]);else if(c.sets.length===2){let g=c.sets[0],h=c.sets[1];a.add(r(c.sets)),a.add(r([h,g]))}o.sort((c,g)=>c===g?0:c<g?-1:1);for(let c=0;c<o.length;++c){let g=o[c];for(let h=c+1;h<o.length;++h){let l=o[h];if(!a.has(r([g,l])))n.push({sets:[g,l],size:0})}}return n}function me(e,s,i){let n=Ut(s.length,s.length),r=Ut(s.length,s.length);return e.filter((o)=>o.sets.length===2).forEach((o)=>{let a=i[o.sets[0]],c=i[o.sets[1]],g=Math.sqrt(s[a].size/Math.PI),h=Math.sqrt(s[c].size/Math.PI),l=Dt(g,h,o.size);n[a][c]=n[c][a]=l;let I=0;if(o.size+0.0000000001>=Math.min(s[a].size,s[c].size))I=1;else if(o.size<=0.0000000001)I=-1;r[a][c]=r[c][a]=I}),{distances:n,constraints:r}}function be(e,s,i,n){for(let o=0;o<s.length;++o)s[o]=0;let r=0;for(let o=0;o<i.length;++o){let a=e[2*o],c=e[2*o+1];for(let g=o+1;g<i.length;++g){let h=e[2*g],l=e[2*g+1],I=i[o][g],b=n[o][g],_=(h-a)*(h-a)+(l-c)*(l-c),M=Math.sqrt(_),j=_-I*I;if(b>0&&M<=I||b<0&&M>=I)continue;r+=2*j*j,s[2*o]+=4*j*(a-h),s[2*o+1]+=4*j*(c-l),s[2*g]+=4*j*(h-a),s[2*g+1]+=4*j*(l-c)}}return r}function ve(e,s={}){let i=Ie(e,s),n=s.lossFunction||bt;if(e.length>=8){let r=ke(e,s),o=n(r,e),a=n(i,e);if(o+0.00000001<a)i=r}return i}function ke(e,s={}){let i=s.restarts||10,n=[],r={};for(let b of e)if(b.sets.length===1)r[b.sets[0]]=n.length,n.push(b);let{distances:o,constraints:a}=me(e,n,r),c=At(o.map(At))/o.length;o=o.map((b)=>b.map((_)=>_/c));let g=(b,_)=>be(b,_,o,a),h=null;for(let b=0;b<i;++b){let _=zt(o.length*2).map(Math.random),M=ye(g,_,s);if(!h||M.fx<h.fx)h=M}let l=h.x,I={};for(let b=0;b<n.length;++b){let _=n[b];I[_.sets[0]]={x:l[2*b]*c,y:l[2*b+1]*c,radius:Math.sqrt(_.size/Math.PI)}}if(s.history)for(let b of s.history)Ct(b.x,c);return I}function Ie(e,s){let i=s&&s.lossFunction?s.lossFunction:bt,n={},r={};for(let I of e)if(I.sets.length===1){let b=I.sets[0];n[b]={x:10000000000,y:10000000000,rowid:n.length,size:I.size,radius:Math.sqrt(I.size/Math.PI)},r[b]=[]}e=e.filter((I)=>I.sets.length===2);for(let I of e){let b=I.weight!=null?I.weight:1,_=I.sets[0],M=I.sets[1];if(I.size+Xt>=Math.min(n[_].size,n[M].size))b=0;r[_].push({set:M,size:I.size,weight:b}),r[M].push({set:_,size:I.size,weight:b})}let o=[];Object.keys(r).forEach((I)=>{let b=0;for(let _=0;_<r[I].length;++_)b+=r[I][_].size*r[I][_].weight;o.push({set:I,size:b})});function a(I,b){return b.size-I.size}o.sort(a);let c={};function g(I){return I.set in c}function h(I,b){n[b].x=I.x,n[b].y=I.y,c[b]=!0}h({x:0,y:0},o[0].set);for(let I=1;I<o.length;++I){let b=o[I].set,_=r[b].filter(g),M=n[b];if(_.sort(a),_.length===0)throw"ERROR: missing pairwise overlap information";let j=[];for(var l=0;l<_.length;++l){let P=n[_[l].set],v=Dt(M.radius,P.radius,_[l].size);j.push({x:P.x+v,y:P.y}),j.push({x:P.x-v,y:P.y}),j.push({y:P.y+v,x:P.x}),j.push({y:P.y-v,x:P.x});for(let w=l+1;w<_.length;++w){let z=n[_[w].set],f=Dt(M.radius,z.radius,_[w].size),k=Wt({x:P.x,y:P.y,radius:v},{x:z.x,y:z.y,radius:f});j.push(...k)}}let G=100000000000000000000000000000000000000000000000000,B=j[0];for(let P of j){n[b].x=P.x,n[b].y=P.y;let v=i(n,e);if(v<G)G=v,B=P}h(B,b)}return n}function bt(e,s){let i=0;for(let n of s){if(n.sets.length===1)continue;let r;if(n.sets.length===2){let a=e[n.sets[0]],c=e[n.sets[1]];r=Nt(a.radius,c.radius,at(a,c))}else r=It(n.sets.map((a)=>e[a]));let o=n.weight!=null?n.weight:1;i+=o*(r-n.size)*(r-n.size)}return i}function Zt(e,s){let i=0;for(let n of s){if(n.sets.length===1)continue;let r;if(n.sets.length===2){let c=e[n.sets[0]],g=e[n.sets[1]];r=Nt(c.radius,g.radius,at(c,g))}else r=It(n.sets.map((c)=>e[c]));let o=n.weight!=null?n.weight:1,a=Math.log((r+1)/(n.size+1));i+=o*a*a}return i}function Me(e,s,i){if(i==null)e.sort((r,o)=>o.radius-r.radius);else e.sort(i);if(e.length>0){let r=e[0].x,o=e[0].y;for(let a of e)a.x-=r,a.y-=o}if(e.length===2){if(at(e[0],e[1])<Math.abs(e[1].radius-e[0].radius))e[1].x=e[0].x+e[0].radius-e[1].radius-0.0000000001,e[1].y=e[0].y}if(e.length>1){let r=Math.atan2(e[1].x,e[1].y)-s,o=Math.cos(r),a=Math.sin(r);for(let c of e){let{x:g,y:h}=c;c.x=o*g-a*h,c.y=a*g+o*h}}if(e.length>2){let r=Math.atan2(e[2].x,e[2].y)-s;while(r<0)r+=2*Math.PI;while(r>2*Math.PI)r-=2*Math.PI;if(r>Math.PI){let o=e[1].y/(0.0000000001+e[1].x);for(let a of e){var n=(a.x+o*a.y)/(1+o*o);a.x=2*n-a.x,a.y=2*n*o-a.y}}}}function Se(e){e.forEach((r)=>{r.parent=r});function s(r){if(r.parent!==r)r.parent=s(r.parent);return r.parent}function i(r,o){let a=s(r),c=s(o);a.parent=c}for(let r=0;r<e.length;++r)for(let o=r+1;o<e.length;++o){let a=e[r].radius+e[o].radius;if(at(e[r],e[o])+0.0000000001<a)i(e[o],e[r])}let n=new Map;for(let r=0;r<e.length;++r){let o=s(e[r]).parent.setid;if(!n.has(o))n.set(o,[]);n.get(o).push(e[r])}return e.forEach((r)=>{delete r.parent}),Array.from(n.values())}function Rt(e){let s=(i)=>{let n=e.reduce((o,a)=>Math.max(o,a[i]+a.radius),Number.NEGATIVE_INFINITY),r=e.reduce((o,a)=>Math.min(o,a[i]-a.radius),Number.POSITIVE_INFINITY);return{max:n,min:r}};return{xRange:s("x"),yRange:s("y")}}function Jt(e,s,i){if(s==null)s=Math.PI/2;let n=te(e).map((h)=>Object.assign({},h)),r=Se(n);for(let h of r){Me(h,s,i);let l=Rt(h);h.size=(l.xRange.max-l.xRange.min)*(l.yRange.max-l.yRange.min),h.bounds=l}r.sort((h,l)=>l.size-h.size),n=r[0];let o=n.bounds,a=(o.xRange.max-o.xRange.min)/50;function c(h,l,I){if(!h)return;let b=h.bounds,_,M;if(l)_=o.xRange.max-b.xRange.min+a;else{_=o.xRange.max-b.xRange.max;let j=(b.xRange.max-b.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;if(j<0)_+=j}if(I)M=o.yRange.max-b.yRange.min+a;else{M=o.yRange.max-b.yRange.max;let j=(b.yRange.max-b.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;if(j<0)M+=j}for(let j of h)j.x+=_,j.y+=M,n.push(j)}let g=1;while(g<r.length)c(r[g],!0,!1),c(r[g+1],!1,!0),c(r[g+2],!0,!0),g+=3,o=Rt(n);return $t(n)}function Qt(e,s,i,n,r){let o=te(e);s-=2*n,i-=2*n;let{xRange:a,yRange:c}=Rt(o);if(a.max===a.min||c.max===c.min)return console.log("not scaling solution: zero size detected"),e;let g,h;if(r){let _=Math.sqrt(r/Math.PI)*2;g=s/_,h=i/_}else g=s/(a.max-a.min),h=i/(c.max-c.min);let l=Math.min(h,g),I=(s-(a.max-a.min)*l)/2,b=(i-(c.max-c.min)*l)/2;return $t(o.map((_)=>({radius:l*_.radius,x:n+I+(_.x-a.min)*l,y:n+b+(_.y-c.min)*l,setid:_.setid})))}function $t(e){let s={};for(let i of e)s[i.setid]=i;return s}function te(e){return Object.keys(e).map((i)=>Object.assign(e[i],{setid:i}))}function ee(e={}){let s=!1,i=600,n=350,r=15,o=1000,a=Math.PI/2,c=!0,g=null,h=!0,l=!0,I=null,b=null,_=!1,M=null,j=e&&e.symmetricalTextCentre?e.symmetricalTextCentre:!1,G={},B=e&&e.colourScheme?e.colourScheme:e&&e.colorScheme?e.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],P=0,v=function(k){if(k in G)return G[k];var y=G[k]=B[P];if(P+=1,P>=B.length)P=0;return y},w=Yt,z=bt;function f(k){let y=k.datum(),Y=new Set;y.forEach((D)=>{if(D.size==0&&D.sets.length==1)Y.add(D.sets[0])}),y=y.filter((D)=>!D.sets.some((Q)=>Y.has(Q)));let O={},X={};if(y.length>0){let D=w(y,{lossFunction:z,distinct:_});if(c)D=Jt(D,a,b);O=Qt(D,i,n,r,g),X=se(O,y,j)}let lt={};y.forEach((D)=>{if(D.label)lt[D.sets]=D.label});function st(D){if(D.sets in lt)return lt[D.sets];if(D.sets.length==1)return""+D.sets[0]}k.selectAll("svg").data([O]).enter().append("svg");let J=k.select("svg");if(s)J.attr("viewBox",`0 0 ${i} ${n}`);else J.attr("width",i).attr("height",n);let H={},Z=!1;J.selectAll(".venn-area path").each(function(D){let Q=this.getAttribute("d");if(D.sets.length==1&&Q&&!_)Z=!0,H[D.sets[0]]=Ee(Q)});function q(D){return(Q)=>{let pt=D.sets.map((gt)=>{let dt=H[gt],ot=O[gt];if(!dt)dt={x:i/2,y:n/2,radius:1};if(!ot)ot={x:i/2,y:n/2,radius:1};return{x:dt.x*(1-Q)+ot.x*Q,y:dt.y*(1-Q)+ot.y*Q,radius:dt.radius*(1-Q)+ot.radius*Q}});return Gt(pt,M)}}let tt=J.selectAll(".venn-area").data(y,(D)=>D.sets),it=tt.enter().append("g").attr("class",(D)=>`venn-area venn-${D.sets.length==1?"circle":"intersection"}${D.colour||D.color?" venn-coloured":""}`).attr("data-venn-sets",(D)=>D.sets.join("_")),et=it.append("path"),ct=it.append("text").attr("class","label").text((D)=>st(D)).attr("text-anchor","middle").attr("dy",".35em").attr("x",i/2).attr("y",n/2);if(l)et.style("fill-opacity","0").filter((D)=>D.sets.length==1).style("fill",(D)=>D.colour?D.colour:D.color?D.color:v(D.sets)).style("fill-opacity",".25"),ct.style("fill",(D)=>{if(D.colour||D.color)return"#FFF";if(e.textFill)return e.textFill;return D.sets.length==1?v(D.sets):"#444"});function rt(D){if(typeof D.transition==="function")return D.transition("venn").duration(o);return D}let nt=k;if(Z&&typeof nt.transition==="function")nt=rt(k),nt.selectAll("path").attrTween("d",q);else nt.selectAll("path").attr("d",(D)=>Gt(D.sets.map((Q)=>O[Q])),M);let W=nt.selectAll("text").filter((D)=>(D.sets in X)).text((D)=>st(D)).attr("x",(D)=>Math.floor(X[D.sets].x)).attr("y",(D)=>Math.floor(X[D.sets].y));if(h)if(Z)if("on"in W)W.on("end",_t(O,st));else W.each("end",_t(O,st));else W.each(_t(O,st));let ht=rt(tt.exit()).remove();if(typeof tt.transition==="function")ht.selectAll("path").attrTween("d",q);let ft=ht.selectAll("text").attr("x",i/2).attr("y",n/2);if(I!==null)ct.style("font-size","0px"),W.style("font-size",I),ft.style("font-size","0px");return{circles:O,textCentres:X,nodes:tt,enter:it,update:nt,exit:ht}}return f.wrap=function(k){if(!arguments.length)return h;return h=k,f},f.useViewBox=function(){return s=!0,f},f.width=function(k){if(!arguments.length)return i;return i=k,f},f.height=function(k){if(!arguments.length)return n;return n=k,f},f.padding=function(k){if(!arguments.length)return r;return r=k,f},f.distinct=function(k){if(!arguments.length)return _;return _=k,f},f.colours=function(k){if(!arguments.length)return v;return v=k,f},f.colors=function(k){if(!arguments.length)return v;return v=k,f},f.fontSize=function(k){if(!arguments.length)return I;return I=k,f},f.round=function(k){if(!arguments.length)return M;return M=k,f},f.duration=function(k){if(!arguments.length)return o;return o=k,f},f.layoutFunction=function(k){if(!arguments.length)return w;return w=k,f},f.normalize=function(k){if(!arguments.length)return c;return c=k,f},f.scaleToFit=function(k){if(!arguments.length)return g;return g=k,f},f.styled=function(k){if(!arguments.length)return l;return l=k,f},f.orientation=function(k){if(!arguments.length)return a;return a=k,f},f.orientationOrder=function(k){if(!arguments.length)return b;return b=k,f},f.lossFunction=function(k){if(!arguments.length)return z;return z=k==="default"?bt:k==="logRatio"?Zt:k,f},f}function _t(e,s){return function(i){let n=this,r=e[i.sets[0]].radius||50,o=s(i)||"",a=o.split(/\s+/).reverse(),c=3,g=(o.length+a.length)/3,h=a.pop(),l=[h],I=0,b=1.1;n.textContent=null;let _=[];function M(v){let w=n.ownerDocument.createElementNS(n.namespaceURI,"tspan");return w.textContent=v,_.push(w),n.append(w),w}let j=M(h);while(!0){if(h=a.pop(),!h)break;l.push(h);let v=l.join(" ");if(j.textContent=v,v.length>g&&j.getComputedTextLength()>r)l.pop(),j.textContent=l.join(" "),l=[h],j=M(h),I++}let G=0.35-I*b/2,B=n.getAttribute("x"),P=n.getAttribute("y");_.forEach((v,w)=>{v.setAttribute("x",B),v.setAttribute("y",P),v.setAttribute("dy",`${G+w*b}em`)})}}function Et(e,s,i){let n=s[0].radius-at(s[0],e);for(let r=1;r<s.length;++r){let o=s[r].radius-at(s[r],e);if(o<=n)n=o}for(let r=0;r<i.length;++r){let o=at(i[r],e)-i[r].radius;if(o<=n)n=o}return n}function ne(e,s,i){let n=[];for(let l of e)n.push({x:l.x,y:l.y}),n.push({x:l.x+l.radius/2,y:l.y}),n.push({x:l.x-l.radius/2,y:l.y}),n.push({x:l.x,y:l.y+l.radius/2}),n.push({x:l.x,y:l.y-l.radius/2});let r=n[0],o=Et(n[0],e,s);for(let l=1;l<n.length;++l){let I=Et(n[l],e,s);if(I>=o)r=n[l],o=I}let a=Ht((l)=>-1*Et({x:l[0],y:l[1]},e,s),[r.x,r.y],{maxIterations:500,minErrorDelta:0.0000000001}).x,c={x:i?0:a[0],y:a[1]},g=!0;for(let l of e)if(at(c,l)>l.radius){g=!1;break}for(let l of s)if(at(c,l)<l.radius){g=!1;break}if(g)return c;if(e.length==1)return{x:e[0].x,y:e[0].y};let h={};if(It(e,h),h.arcs.length===0)return{x:0,y:-1000,disjoint:!0};if(h.arcs.length==1)return{x:h.arcs[0].circle.x,y:h.arcs[0].circle.y};if(s.length)return ne(e,[]);return Kt(h.arcs.map((l)=>l.p1))}function we(e){let s={},i=Object.keys(e);for(let n of i)s[n]=[];for(let n=0;n<i.length;n++){let r=i[n],o=e[r];for(let a=n+1;a<i.length;++a){let c=i[a],g=e[c],h=at(o,g);if(h+g.radius<=o.radius+0.0000000001)s[c].push(r);else if(h+o.radius<=g.radius+0.0000000001)s[r].push(c)}}return s}function se(e,s,i){let n={},r=we(e);for(let o=0;o<s.length;++o){let a=s[o].sets,c={},g={};for(let b=0;b<a.length;++b){c[a[b]]=!0;let _=r[a[b]];for(let M=0;M<_.length;++M)g[_[M]]=!0}let h=[],l=[];for(let b in e)if(b in c)h.push(e[b]);else if(!(b in g))l.push(e[b]);let I=ne(h,l,i);if(n[a]=I,I.disjoint&&s[o].size>0)console.log("WARNING: area "+a+" not represented on screen")}return n}function _e(e,s,i){let n=[];return n.push(`
2
2
  M`,e,s),n.push(`
3
3
  m`,-i,0),n.push(`
4
4
  a`,i,i,0,1,0,i*2,0),n.push(`