@bkm016/basalt 0.1.8 → 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 (258) hide show
  1. package/{chunk-0039s4jt.js → chunk-02d3x4mj.js} +3 -3
  2. package/{chunk-ky55taar.js → chunk-0mjb3sm3.js} +327 -316
  3. package/{chunk-ckjw3b61.js → chunk-13gvs0ax.js} +2 -2
  4. package/{chunk-0d51ggzj.js → chunk-1n7dat03.js} +4 -4
  5. package/{chunk-ppxv5q7y.js → chunk-1zj3zvw5.js} +3 -3
  6. package/{chunk-2ek3wq4b.js → chunk-29qrxygd.js} +1 -1
  7. package/{chunk-7p6e2f5s.js → chunk-30rjf7my.js} +3 -3
  8. package/{chunk-v2srrqcv.js → chunk-38g3gctw.js} +2 -2
  9. package/chunk-3mqf9ped.js +479 -0
  10. package/{chunk-3j2kkgsc.js → chunk-4dw43syb.js} +1 -1
  11. package/{chunk-t66jqz12.js → chunk-4gtgqcct.js} +2 -2
  12. package/{chunk-qmdpgbg3.js → chunk-755sy11p.js} +1 -1
  13. package/{chunk-n015c8nx.js → chunk-7zkswxvk.js} +1 -1
  14. package/{chunk-91r5nvth.js → chunk-82v8jh1h.js} +2 -2
  15. package/{chunk-12trygzx.js → chunk-95964592.js} +16 -16
  16. package/{chunk-nmtk9xra.js → chunk-9as0p561.js} +2 -2
  17. package/{chunk-pn413hjw.js → chunk-a1352w87.js} +1 -1
  18. package/{chunk-rnt1ckk9.js → chunk-a1rb1a48.js} +5 -5
  19. package/{chunk-fzcmzbsq.js → chunk-a98wma9j.js} +1 -1
  20. package/{chunk-kgkrccr1.js → chunk-asyr3gnq.js} +2 -2
  21. package/{chunk-5gxj9560.js → chunk-ax04trym.js} +1 -1
  22. package/chunk-b2bxqeb4.js +2 -0
  23. package/{chunk-xjw78yey.js → chunk-bdjr0kfr.js} +4 -4
  24. package/{chunk-7kjr9gdx.js → chunk-bk4rpnm8.js} +2 -2
  25. package/{chunk-47vf66t6.js → chunk-c0zfefq8.js} +1 -1
  26. package/{chunk-kpvaqb7c.js → chunk-c6q04xrd.js} +2 -2
  27. package/chunk-c71173py.js +25 -0
  28. package/{chunk-adys4qq4.js → chunk-cmwdjes8.js} +5 -5
  29. package/{chunk-dcwdmpw2.js → chunk-d0a1jxk5.js} +1 -1
  30. package/{chunk-2nrkqq45.js → chunk-d5j74pcp.js} +7 -7
  31. package/{chunk-pkpj7s2k.js → chunk-dfh9m9n7.js} +1 -1
  32. package/{chunk-26cz8et8.js → chunk-dq01v5eq.js} +1 -1
  33. package/{chunk-fpxc6qjr.js → chunk-e1x629v0.js} +2 -2
  34. package/{chunk-86xhmz7k.js → chunk-en218k4y.js} +1 -1
  35. package/{chunk-3hg7yn1t.js → chunk-fgwda4m0.js} +1 -1
  36. package/chunk-gbjn6d81.js +2 -0
  37. package/{chunk-x496kg3v.js → chunk-gkf5jwvj.js} +1 -1
  38. package/{chunk-k3q5jqjj.js → chunk-hb4f2v34.js} +2 -2
  39. package/{chunk-mr807v9n.js → chunk-hbnmymaq.js} +1 -1
  40. package/{chunk-818nd6s1.js → chunk-jj4hqbrx.js} +2 -2
  41. package/{chunk-jyv9cae6.js → chunk-jn5pqy5v.js} +1 -1
  42. package/{chunk-yyy2yp6f.js → chunk-jtsve11b.js} +9 -9
  43. package/chunk-m1eam0s5.js +2 -0
  44. package/{chunk-6vnjg5x9.js → chunk-mbpb5c7w.js} +1 -1
  45. package/{chunk-t40fag3z.js → chunk-msm9hmk9.js} +1 -1
  46. package/{chunk-j781n7ca.js → chunk-n0ybj4h9.js} +2 -2
  47. package/{chunk-jp5afrwm.js → chunk-n2jcx65v.js} +2 -2
  48. package/{chunk-2ks2tnac.js → chunk-nrsd810j.js} +2 -2
  49. package/chunk-pnspvnyd.js +2 -0
  50. package/chunk-pz2afna8.js +2 -0
  51. package/{chunk-d37gemt2.js → chunk-q9f4xb0w.js} +3 -3
  52. package/{chunk-hd3x1w46.js → chunk-qaeyhe65.js} +1 -1
  53. package/chunk-qnkrrwmg.js +2 -0
  54. package/{chunk-e6c2mzxc.js → chunk-r4ttdkrz.js} +2 -2
  55. package/{chunk-r9aatvwm.js → chunk-stj493dn.js} +2 -2
  56. package/{chunk-g3ed130w.js → chunk-tevejprz.js} +4 -4
  57. package/{chunk-k3rmjrf1.js → chunk-v3ee9z3f.js} +1 -1
  58. package/{chunk-4n49ptbz.js → chunk-vtqr7dm8.js} +2 -2
  59. package/{chunk-z3ch1wg6.js → chunk-xh444pfn.js} +14 -14
  60. package/{chunk-pehyqj8k.js → chunk-zc9ar0r4.js} +1 -1
  61. package/{chunk-ef9yhnk3.js → chunk-zyyzk5ha.js} +1 -1
  62. package/compiled.js +9 -9
  63. package/package.json +1 -1
  64. package/ui-test-worker.js +8 -8
  65. package/web/chunk-045d3b5d.js +1 -0
  66. package/web/{chunk-r4ffr96e.js → chunk-0770q5e1.js} +1 -1
  67. package/web/chunk-12qf1r6m.js +1 -0
  68. package/web/{chunk-s7e93552.js → chunk-18neka5g.js} +4 -4
  69. package/web/{chunk-et8q775x.js → chunk-1ev0n3n4.js} +5 -5
  70. package/web/chunk-1ex3wgms.js +2 -0
  71. package/web/{chunk-svh2gkx8.js → chunk-1qh7f5kr.js} +1 -1
  72. package/web/{chunk-s38s9ff9.js → chunk-26ecc2xh.js} +30 -30
  73. package/web/chunk-2cz7tx8q.js +1 -0
  74. package/web/chunk-32ty2xfn.js +1 -0
  75. package/web/{chunk-q1xxs319.js → chunk-3eexx7y5.js} +4 -4
  76. package/web/{chunk-v14s4vgc.js → chunk-46jnkghq.js} +1 -1
  77. package/web/chunk-4am8j3k3.js +1 -0
  78. package/web/{chunk-85gdsmt4.js → chunk-5qvmefq2.js} +1 -1
  79. package/web/chunk-5svqfj4g.js +3 -0
  80. package/web/{chunk-f93pe4kb.js → chunk-5v5q13hz.js} +4 -4
  81. package/web/chunk-5z2n4z9x.css +1 -0
  82. package/web/{chunk-qcge7d6s.js → chunk-6e87m0nm.js} +2 -2
  83. package/web/chunk-6y55gk1n.js +1 -0
  84. package/web/chunk-7np1jp3x.js +8 -0
  85. package/web/chunk-87e8d1hv.js +1 -0
  86. package/web/{chunk-33w36n91.js → chunk-88wd49xe.js} +2 -2
  87. package/web/chunk-8h2x89tw.js +2 -0
  88. package/web/chunk-8y2526ve.js +1 -0
  89. package/web/chunk-905vw286.js +2 -0
  90. package/web/chunk-918e5t4x.js +2 -0
  91. package/web/chunk-96m2m3e8.js +1 -0
  92. package/web/chunk-9f4zzqbx.js +1 -0
  93. package/web/{chunk-fe31sv6t.js → chunk-9yfftz38.js} +1 -1
  94. package/web/{chunk-z0zrp8n8.js → chunk-a1n4468c.js} +1 -1
  95. package/web/chunk-arnzrqnm.js +1 -0
  96. package/web/{chunk-c01176kn.js → chunk-awkdw9rw.js} +2 -2
  97. package/web/{chunk-m5y2d4zv.js → chunk-b46ws7rf.js} +1 -1
  98. package/web/chunk-bc3ajvfg.js +24 -0
  99. package/web/chunk-bwy3e58v.js +1 -0
  100. package/web/{chunk-ja7w629n.js → chunk-c57f714b.js} +2 -2
  101. package/web/chunk-d5gshd1a.js +1 -0
  102. package/web/chunk-de40q05r.js +30 -0
  103. package/web/chunk-dp0k5vhd.js +1 -0
  104. package/web/{chunk-qq2v8h6d.js → chunk-dv1berk6.js} +5 -5
  105. package/web/{chunk-jzte2phh.js → chunk-eh7wp62z.js} +1 -1
  106. package/web/{chunk-823b7866.js → chunk-ehtmb6sn.js} +18 -18
  107. package/web/{chunk-d9wdsjkk.js → chunk-eqndhs21.js} +2 -2
  108. package/web/chunk-et1hytyv.js +1 -0
  109. package/web/chunk-f7jpakwh.js +1 -0
  110. package/web/chunk-f9m9seam.js +1 -0
  111. package/web/{chunk-7a4xk6j9.js → chunk-fmmrthpa.js} +5 -5
  112. package/web/{chunk-fv6vm14n.js → chunk-frnh4zqf.js} +2 -2
  113. package/web/chunk-g2erm7k0.js +1 -0
  114. package/web/chunk-g3kbn0t2.js +1 -0
  115. package/web/{chunk-h5cfg3vv.js → chunk-g7dc4hrd.js} +2 -2
  116. package/web/{chunk-dgwkqcz6.js → chunk-g7kz8f7q.js} +2 -2
  117. package/web/chunk-ght0t49g.js +1 -0
  118. package/web/{chunk-jjjtv2r1.js → chunk-ghwm7bdj.js} +2 -2
  119. package/web/{chunk-sda7cyrt.js → chunk-grm2208k.js} +21 -21
  120. package/web/{chunk-0zwc2rvh.js → chunk-gsw1tv96.js} +1 -1
  121. package/web/chunk-gw8x1g61.js +24 -0
  122. package/web/chunk-gx340asc.js +1 -0
  123. package/web/chunk-h2txs73e.js +39 -0
  124. package/web/chunk-h3tkacc7.js +1 -0
  125. package/web/{chunk-cyjnert7.js → chunk-h5ckjk48.js} +16 -16
  126. package/web/{chunk-1s8zg6fb.js → chunk-j37p0b13.js} +5 -5
  127. package/web/chunk-j89s11x8.js +78 -0
  128. package/web/{chunk-jam45rqg.js → chunk-jccz14ye.js} +2 -2
  129. package/web/chunk-je78j3vr.js +1 -0
  130. package/web/chunk-jke2ev6m.js +2 -0
  131. package/web/{chunk-1gx0zpmp.js → chunk-js6kb05s.js} +9 -9
  132. package/web/{chunk-30b33r2w.js → chunk-k0cg4n2k.js} +2 -2
  133. package/web/{chunk-tkp72r9b.js → chunk-knm82fw9.js} +1 -1
  134. package/web/{chunk-xb9m0092.js → chunk-kxdtg9dt.js} +1 -1
  135. package/web/{chunk-w37n09px.js → chunk-m4fxd5d9.js} +10 -10
  136. package/web/chunk-m9xzt9p7.js +1 -0
  137. package/web/{chunk-8773nwdc.js → chunk-myd6sc76.js} +1 -1
  138. package/web/{chunk-sf101c23.js → chunk-mykrm8ba.js} +2 -2
  139. package/web/chunk-mzzaet63.js +1 -0
  140. package/web/{chunk-2axwda8c.js → chunk-n4yzs2q0.js} +7 -7
  141. package/web/{chunk-wj3ymejj.js → chunk-nawxgz87.js} +4 -4
  142. package/web/chunk-ngt1j8py.js +1139 -0
  143. package/web/{chunk-hstbgb83.js → chunk-p55vhns6.js} +5 -5
  144. package/web/{chunk-xabcx3ry.js → chunk-pgwf37s2.js} +3 -3
  145. package/web/chunk-q34as3v6.js +1 -0
  146. package/web/{chunk-dtg5yhhs.js → chunk-q4bst4an.js} +1 -1
  147. package/web/chunk-qdzy124b.js +4 -0
  148. package/web/chunk-qe0bgeda.js +1 -0
  149. package/web/{chunk-sd3cdqcm.js → chunk-qh62nkem.js} +2 -2
  150. package/web/{chunk-j1bw5v1g.js → chunk-qq6m2my8.js} +2 -2
  151. package/web/{chunk-8dp7h6w8.js → chunk-qy1zx2yw.js} +16 -16
  152. package/web/chunk-rag65pfs.js +4 -0
  153. package/web/chunk-rbqnre6q.js +36 -0
  154. package/web/{chunk-hbkasy6c.js → chunk-rh3xb76f.js} +22 -22
  155. package/web/{chunk-fx4mackk.js → chunk-rwfmccmh.js} +4 -4
  156. package/web/{chunk-mf6xng5b.js → chunk-rxvm70w5.js} +2 -2
  157. package/web/chunk-sat7zyva.js +1 -0
  158. package/web/{chunk-cn0tmwjs.js → chunk-sc63488q.js} +2 -2
  159. package/web/{chunk-xsz1dfm2.js → chunk-sd3xat3r.js} +20 -20
  160. package/web/{chunk-nky3bqfg.js → chunk-se4h6wx0.js} +1 -1
  161. package/web/chunk-sjkg40ay.js +7 -0
  162. package/web/chunk-sk0hpa80.js +1 -0
  163. package/web/{chunk-xqyazzm7.js → chunk-t5nvgz7z.js} +5 -5
  164. package/web/{chunk-3q0v8w45.js → chunk-tfqarvdx.js} +80 -80
  165. package/web/{chunk-d0m0h0eb.js → chunk-tqze6d6b.js} +1 -1
  166. package/web/{chunk-rbdvc8x7.js → chunk-tt93zbn4.js} +7 -7
  167. package/web/chunk-tvcxrx6h.js +1 -0
  168. package/web/chunk-tzpnh70q.js +1 -0
  169. package/web/{chunk-8wg44w91.js → chunk-vasppf6b.js} +2 -2
  170. package/web/chunk-vb7g4xg6.js +1 -0
  171. package/web/chunk-w3zgfhjb.js +2 -0
  172. package/web/{chunk-0j9a7811.js → chunk-wrevb4ew.js} +6 -6
  173. package/web/chunk-wtvch4ad.js +106 -0
  174. package/web/chunk-wzfe6jtq.js +1 -0
  175. package/web/{chunk-cez1k71m.js → chunk-x5g1yy12.js} +1 -1
  176. package/web/chunk-x850q01z.js +1 -0
  177. package/web/chunk-xh4xn1az.js +1 -0
  178. package/web/chunk-xk904wqv.js +1 -0
  179. package/web/chunk-xtn305fd.js +1 -0
  180. package/web/chunk-xzwxcxb4.js +1 -0
  181. package/web/{chunk-4anjs6yp.js → chunk-y2rzeb4v.js} +2 -2
  182. package/web/chunk-yekaz74b.js +1 -0
  183. package/web/{chunk-8nv7q5ac.js → chunk-yppgejg7.js} +15 -15
  184. package/web/chunk-ys2tns0p.js +1 -0
  185. package/web/chunk-z4bp6p32.js +62 -0
  186. package/web/{chunk-p0cjvjdx.js → chunk-z5qn0xev.js} +1 -1
  187. package/web/{chunk-rkjkynm3.js → chunk-zms6mrqk.js} +12 -12
  188. package/web/{chunk-6e38yf3a.js → chunk-zse05v6j.js} +4 -4
  189. package/web/{chunk-cn1xpg3q.js → chunk-zz1qkaar.js} +2 -2
  190. package/web/index.html +1 -1
  191. package/worker.js +1 -1
  192. package/chunk-2gcp3xdc.js +0 -2
  193. package/chunk-320174qe.js +0 -2
  194. package/chunk-dvb5nd2x.js +0 -2
  195. package/chunk-frt9k18g.js +0 -480
  196. package/chunk-ndt6rjt9.js +0 -2
  197. package/chunk-xy2bxwq8.js +0 -2
  198. package/chunk-yzevjkms.js +0 -25
  199. package/chunk-zdyd8hbn.js +0 -2
  200. package/web/chunk-0jfda4jw.js +0 -2
  201. package/web/chunk-2p3fkhy8.js +0 -1
  202. package/web/chunk-3sz5qcwj.js +0 -1
  203. package/web/chunk-433c80pc.js +0 -1
  204. package/web/chunk-48cnmhvd.js +0 -106
  205. package/web/chunk-5r37rwq1.js +0 -4
  206. package/web/chunk-6bwgdvf6.js +0 -1
  207. package/web/chunk-7f1t7z72.js +0 -2
  208. package/web/chunk-7x35g67d.js +0 -78
  209. package/web/chunk-8pzg8qw4.js +0 -1
  210. package/web/chunk-8r0s8tx7.js +0 -1
  211. package/web/chunk-9p5dfvav.js +0 -1
  212. package/web/chunk-9q9w9pay.js +0 -1
  213. package/web/chunk-a3teqvz2.js +0 -39
  214. package/web/chunk-ahztazsg.js +0 -1
  215. package/web/chunk-bd8ftfxn.js +0 -3
  216. package/web/chunk-c03bt2pz.js +0 -1
  217. package/web/chunk-c1ha2xg6.js +0 -8
  218. package/web/chunk-cgng31df.js +0 -1
  219. package/web/chunk-cvd4f51j.js +0 -1
  220. package/web/chunk-cybvxssy.js +0 -1
  221. package/web/chunk-d22wq71s.js +0 -1
  222. package/web/chunk-dynajx8x.js +0 -2
  223. package/web/chunk-f3vv7n52.js +0 -1
  224. package/web/chunk-fmthkpff.js +0 -1
  225. package/web/chunk-fpa81dv7.js +0 -62
  226. package/web/chunk-g17n6asp.js +0 -1
  227. package/web/chunk-g9dzaw9e.js +0 -30
  228. package/web/chunk-gcwhx3av.js +0 -1139
  229. package/web/chunk-gf8vm6b5.js +0 -1
  230. package/web/chunk-gnmeyy4h.js +0 -1
  231. package/web/chunk-hn7mhsbg.js +0 -1
  232. package/web/chunk-jfvxxp5c.js +0 -1
  233. package/web/chunk-k8h8zx6r.js +0 -24
  234. package/web/chunk-m3ajw575.js +0 -1
  235. package/web/chunk-mbwwj216.js +0 -1
  236. package/web/chunk-mz9b5bsa.js +0 -1
  237. package/web/chunk-np33kmn4.js +0 -1
  238. package/web/chunk-nvk8mazs.js +0 -1
  239. package/web/chunk-nyw5ewgv.js +0 -1
  240. package/web/chunk-p56dcqpr.js +0 -1
  241. package/web/chunk-pdn4r8x4.js +0 -1
  242. package/web/chunk-qpt34d8d.js +0 -1
  243. package/web/chunk-qskt3tqa.js +0 -1
  244. package/web/chunk-qt3n897m.js +0 -4
  245. package/web/chunk-r1rt48h9.js +0 -1
  246. package/web/chunk-r7tgd2fm.js +0 -7
  247. package/web/chunk-rznszqmy.js +0 -1
  248. package/web/chunk-s1pefd34.js +0 -1
  249. package/web/chunk-sc29azev.js +0 -1
  250. package/web/chunk-t4jc4nac.js +0 -1
  251. package/web/chunk-t7g366a5.js +0 -24
  252. package/web/chunk-thbqwq6b.js +0 -1
  253. package/web/chunk-v94v68xg.js +0 -36
  254. package/web/chunk-wcphswcx.js +0 -2
  255. package/web/chunk-wwcnvyjh.css +0 -1
  256. package/web/chunk-xce8n339.js +0 -1
  257. package/web/chunk-xfd3b01q.js +0 -1
  258. package/web/chunk-xtss82z2.js +0 -1
@@ -1 +1 @@
1
- import{t}from"./chunk-3q0v8w45.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};
@@ -0,0 +1,7 @@
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
+ 消耗: ${L(l.totalTokens)} Token
3
+ 耗时: ${P(l.activeDurationMs)}
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)}
5
+ 消耗: ${L(l.totalTokens)} Token
6
+ 耗时: ${P(l.activeDurationMs)}
7
+ 助手轮次: ${l.assistantTurns} 轮`;return e("div",{className:u("size-3.5 rounded-xs transition-transform hover:scale-125 cursor-pointer",x),title:T},l.date)})})]})]})}var xe=[{value:"7d",label:"近 7 天"},{value:"30d",label:"近 30 天"},{value:"90d",label:"近 90 天"},{value:"all",label:"全部"}],q=new Map,me=[];function X(t,u){return`${t}:${u??"all"}`}function Le(t){let{connection:u,onOpen:b}=t,{Button:p,PageLayout:c,Segmented:a,SettingGroup:d,style:h}=y(),[w,C]=r("30d"),[D,F]=r(null),[j,z]=r("projects"),[m,s]=r(()=>q.get(X("30d",null))??null),[l,x]=r(()=>!q.has(X("30d",null))),[T,k]=r(null),[H,S]=r(()=>me),R=i(0),N=g(async()=>{let A=++R.current,O=X(w,D),ee=q.get(O);if(ee)s(ee);x(!0);try{let E=new URLSearchParams({range:w,tzOffset:String(new Date().getTimezoneOffset())});if(D)E.set("projectID",D);let U=await u.request(`/api/stats?${E.toString()}`);if(A!==R.current)return;if(q.set(O,U),s(U),k(null),U.projects)S((de)=>{let te=new Map(de.map((I)=>[I.id,I.name]));for(let I of U.projects)if(I.projectID)te.set(I.projectID,I.name);let ne=Array.from(te.entries()).map(([I,fe])=>({id:I,name:fe}));return me=ne,ne})}catch(E){if(A===R.current)k(E instanceof Error?E.message:"加载统计数据失败")}finally{if(A===R.current)x(!1)}},[u,w,D]);o(()=>(N(),()=>{R.current++}),[N]);let _=v(()=>{if(!D)return null;if(D===V)return"独立聊天";return(H.find((O)=>O.id===D)??m?.projects.find((O)=>O.projectID===D))?.name??"指定项目"},[D,H,m]);return n(c,{title:_?n(f,{children:["统计 ",n("span",{className:"text-dim",children:["· ",_]})]}):"统计",description:"按项目、模型与工具统计活跃耗时与 Token 消耗。",actions:n(f,{children:[D&&e(p,{size:"sm",variant:"ghost",onClick:()=>F(null),children:"返回全部"}),e(a,{value:w,onChange:C,options:xe})]}),children:[T&&n("div",{className:"mb-4 flex items-center justify-between rounded-lg bg-danger/10 px-3 py-2 text-xs text-danger",children:[e("span",{children:T}),e(p,{size:"sm",variant:"ghost",onClick:()=>{N()},className:"text-danger hover:text-danger",children:"重试"})]}),l&&!m?e("div",{className:"flex justify-center py-12 text-xs text-faint",children:"正在加载统计…"}):!m?e("div",{className:h("surface.card","p-12 text-center text-sm text-dim"),children:"暂无统计数据"}):n("div",{className:"space-y-8",children:[e(d,{title:"核心总览",unboxed:!0,children:n("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n("div",{className:h("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{children:"总 Token 消耗"}),n("span",{className:"font-mono tabular-nums",children:["缓存命中 ",B(m.overview.cacheHitRate)]})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",title:`${L(m.overview.totalTokens)} Token`,children:M(m.overview.totalTokens)}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:["输入 ",M(m.overview.inputTokens)]}),n("span",{children:["输出 ",M(m.overview.outputTokens)]}),n("span",{children:["缓存读 ",M(m.overview.cacheReadTokens)]})]})]}),n("div",{className:h("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{children:"活跃工作耗时"}),n("span",{className:"font-mono tabular-nums",children:["日均"," ",m.overview.activeDays>0?P(m.overview.activeDurationMs/m.overview.activeDays):"0s"]})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",children:P(m.overview.activeDurationMs)}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:["模型推理 ",P(m.overview.generationMs)]}),n("span",{children:["并发累计 ",P(m.overview.cumulativeRunDurationMs)]})]})]}),n("div",{className:h("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{children:"会话与工作流"}),n("span",{className:"font-mono tabular-nums",children:[m.overview.activeProjects,"/",m.overview.totalProjects," 活跃项目"]})]}),n("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",children:[m.overview.sessionCount.toLocaleString()," 个会话"]}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:[m.overview.mainSessionCount," 主会话 / ",m.overview.subSessionCount," 子代理"]}),n("span",{children:[m.overview.userMessages," 提问 / ",m.overview.assistantTurns," 回复"]})]})]}),n("div",{className:h("surface.card","p-4"),children:[n("div",{className:"flex items-center justify-between gap-2 text-xs text-faint",children:[e("span",{children:"吞吐效率与调用"}),n("span",{className:"font-mono tabular-nums",children:[m.overview.compactions," 次折叠"]})]}),e("div",{className:"mt-1.5 font-mono text-xl font-semibold tracking-tight text-ink tabular-nums",children:m.overview.avgTps!==null?`${m.overview.avgTps.toFixed(1)} tok/s`:`${m.overview.toolCalls.toLocaleString()} 次调用`}),n("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-[11px] text-dim tabular-nums",children:[n("span",{children:[m.overview.toolCalls.toLocaleString()," 次工具调用"]}),n("span",{children:[m.overview.runCount.toLocaleString()," 次运行"]})]})]})]})}),e(ue,{daily:m.daily}),e(pe,{daily:m.daily,hourly:m.hourly}),e(d,{title:"分类明细",action:e(a,{value:j,onChange:z,options:[{value:"projects",label:`项目消耗 (${m.projects.length})`},{value:"models",label:`模型分析 (${m.models.length})`},{value:"tools",label:`工具调用 (${m.tools.length})`},{value:"sessions",label:`高消耗会话 (${m.topSessions.length})`}]}),children:n("div",{className:"animate-fade",children:[j==="projects"&&e(oe,{projects:m.projects,selectedProjectID:D,onSelectProject:F,onOpenSession:b}),j==="models"&&e(re,{models:m.models}),j==="tools"&&e(ie,{tools:m.tools}),j==="sessions"&&e(le,{sessions:m.topSessions,onOpenSession:b})]},j)})]})]})}export{Le as StatsPage};
@@ -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,15 +1,15 @@
1
- import{t,X,br,u,d,D,x,B,C,S,E,T,A,L,R,p,V,U,m}from"./chunk-3q0v8w45.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),P=G-j;if(P<0)P+=2*Math.PI;let F=G-P/2,v=at(I,{x:M.x+M.radius*Math.sin(F),y:M.y+M.radius*Math.cos(F)});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,P=s.slice(),F=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 H=y.slice();return H.fx=y.fx,H.id=y.id,H});k.sort((y,H)=>y.id-H.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){P[k]=0;for(let y=0;y<_;++y)P[k]+=M[y][k];P[k]/=_}let f=M[_];if(xt(F,1+g,P,-g,f),F.fx=e(F),F.fx<M[0].fx)if(xt(w,1+h,P,-h,f),w.fx=e(w),w.fx<F.fx)j(w);else j(F);else if(F.fx>=M[_-1].fx){let k=!1;if(F.fx>f.fx)if(xt(v,1+l,P,-l,f),v.fx=e(v),v.fx<f.fx)j(v);else k=!0;else if(xt(v,1-l*g,P,l*g,f),v.fx=e(v),v.fx<F.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(F)}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 P=0;P<16;++P)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 F=n[_[l].set],v=Dt(M.radius,F.radius,_[l].size);j.push({x:F.x+v,y:F.y}),j.push({x:F.x-v,y:F.y}),j.push({y:F.y+v,x:F.x}),j.push({y:F.y-v,x:F.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:F.x,y:F.y,radius:v},{x:z.x,y:z.y,radius:f});j.push(...k)}}let G=100000000000000000000000000000000000000000000000000,P=j[0];for(let F of j){n[b].x=F.x,n[b].y=F.y;let v=i(n,e);if(v<G)G=v,P=F}h(P,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={},P=e&&e.colourScheme?e.colourScheme:e&&e.colorScheme?e.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],F=0,v=function(k){if(k in G)return G[k];var y=G[k]=P[F];if(F+=1,F>=P.length)F=0;return y},w=Yt,z=bt;function f(k){let y=k.datum(),H=new Set;y.forEach((N)=>{if(N.size==0&&N.sets.length==1)H.add(N.sets[0])}),y=y.filter((N)=>!N.sets.some((Q)=>H.has(Q)));let O={},Y={};if(y.length>0){let N=w(y,{lossFunction:z,distinct:_});if(c)N=Jt(N,a,b);O=Qt(N,i,n,r,g),Y=se(O,y,j)}let lt={};y.forEach((N)=>{if(N.label)lt[N.sets]=N.label});function st(N){if(N.sets in lt)return lt[N.sets];if(N.sets.length==1)return""+N.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 K={},Z=!1;J.selectAll(".venn-area path").each(function(N){let Q=this.getAttribute("d");if(N.sets.length==1&&Q&&!_)Z=!0,K[N.sets[0]]=Ee(Q)});function q(N){return(Q)=>{let pt=N.sets.map((gt)=>{let dt=K[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,(N)=>N.sets),it=tt.enter().append("g").attr("class",(N)=>`venn-area venn-${N.sets.length==1?"circle":"intersection"}${N.colour||N.color?" venn-coloured":""}`).attr("data-venn-sets",(N)=>N.sets.join("_")),et=it.append("path"),ct=it.append("text").attr("class","label").text((N)=>st(N)).attr("text-anchor","middle").attr("dy",".35em").attr("x",i/2).attr("y",n/2);if(l)et.style("fill-opacity","0").filter((N)=>N.sets.length==1).style("fill",(N)=>N.colour?N.colour:N.color?N.color:v(N.sets)).style("fill-opacity",".25"),ct.style("fill",(N)=>{if(N.colour||N.color)return"#FFF";if(e.textFill)return e.textFill;return N.sets.length==1?v(N.sets):"#444"});function rt(N){if(typeof N.transition==="function")return N.transition("venn").duration(o);return N}let nt=k;if(Z&&typeof nt.transition==="function")nt=rt(k),nt.selectAll("path").attrTween("d",q);else nt.selectAll("path").attr("d",(N)=>Gt(N.sets.map((Q)=>O[Q])),M);let W=nt.selectAll("text").filter((N)=>(N.sets in Y)).text((N)=>st(N)).attr("x",(N)=>Math.floor(Y[N.sets].x)).attr("y",(N)=>Math.floor(Y[N.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:Y,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,P=n.getAttribute("x"),F=n.getAttribute("y");_.forEach((v,w)=>{v.setAttribute("x",P),v.setAttribute("y",F),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(`
5
5
  a`,i,i,0,1,0,-i*2,0),n.join(" ")}function Ee(e){let s=e.split(" ");return{x:Number.parseFloat(s[1]),y:Number.parseFloat(s[2]),radius:-Number.parseFloat(s[4])}}function ie(e){if(e.length===0)return[];let s={};return It(e,s),s.arcs}function re(e,s){if(e.length===0)return"M 0 0";let i=Math.pow(10,s||0),n=s!=null?(o)=>Math.round(o*i)/i:(o)=>o;if(e.length==1){let o=e[0].circle;return _e(n(o.x),n(o.y),n(o.radius))}let r=[`
6
6
  M`,n(e[0].p2.x),n(e[0].p2.y)];for(let o of e){let a=n(o.circle.radius);r.push(`
7
- A`,a,a,0,o.large?1:0,o.sweep?1:0,n(o.p1.x),n(o.p1.y))}return r.join(" ")}function Gt(e,s){return re(ie(e),s)}function oe(e,s={}){let{lossFunction:i,layoutFunction:n=Yt,normalize:r=!0,orientation:o=Math.PI/2,orientationOrder:a,width:c=600,height:g=350,padding:h=15,scaleToFit:l=!1,symmetricalTextCentre:I=!1,distinct:b,round:_=2}=s,M=n(e,{lossFunction:i==="default"||!i?bt:i==="logRatio"?Zt:i,distinct:b});if(r)M=Jt(M,o,a);let j=Qt(M,c,g,h,l),G=se(j,e,I),P=new Map(Object.keys(j).map((w)=>[w,{set:w,x:j[w].x,y:j[w].y,radius:j[w].radius}])),F=e.map((w)=>{let z=w.sets.map((y)=>P.get(y)),f=ie(z),k=re(f,_);return{circles:z,arcs:f,path:k,area:w,has:new Set(w.sets)}});function v(w){let z="";for(let f of F)if(f.has.size>w.length&&w.every((k)=>f.has.has(k)))z+=" "+f.path;return z}return F.map(({circles:w,arcs:z,path:f,area:k})=>({data:k,text:G[k.sets],circles:w,arcs:z,path:f,distinctPath:f+v(k.sets)}))}var Ot=function(){var e=t(function(F,v,w,z){for(w=w||{},z=F.length;z--;w[F[z]]=v);return w},"o"),s=[5,8],i=[7,8,11,12,17,19,22,24],n=[1,17],r=[1,18],o=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],a=[1,31],c=[1,39],g=[7,8,11,12,17,19,22,24,27],h=[1,57],l=[1,56],I=[1,58],b=[1,59],_=[1,60],M=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],j={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:t(function(v,w,z,f,k,y,H){var O=y.length-1;switch(k){case 1:return y[O-1];case 2:case 3:case 4:this.$=[];break;case 5:y[O-1].push(y[O]),this.$=y[O-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=y[O];break;case 8:f.setDiagramTitle(y[O].substr(6)),this.$=y[O].substr(6);break;case 9:if(f.addSubsetData([y[O]],void 0,void 0),f.setIndentMode)f.setIndentMode(!0);break;case 10:if(f.addSubsetData([y[O-1]],y[O],void 0),f.setIndentMode)f.setIndentMode(!0);break;case 11:if(f.addSubsetData([y[O-2]],void 0,parseFloat(y[O])),f.setIndentMode)f.setIndentMode(!0);break;case 12:if(f.addSubsetData([y[O-3]],y[O-2],parseFloat(y[O])),f.setIndentMode)f.setIndentMode(!0);break;case 13:if(y[O].length<2)throw Error("union requires multiple identifiers");if(f.validateUnionIdentifiers)f.validateUnionIdentifiers(y[O]);if(f.addSubsetData(y[O],void 0,void 0),f.setIndentMode)f.setIndentMode(!0);break;case 14:if(y[O-1].length<2)throw Error("union requires multiple identifiers");if(f.validateUnionIdentifiers)f.validateUnionIdentifiers(y[O-1]);if(f.addSubsetData(y[O-1],y[O],void 0),f.setIndentMode)f.setIndentMode(!0);break;case 15:if(y[O-2].length<2)throw Error("union requires multiple identifiers");if(f.validateUnionIdentifiers)f.validateUnionIdentifiers(y[O-2]);if(f.addSubsetData(y[O-2],void 0,parseFloat(y[O])),f.setIndentMode)f.setIndentMode(!0);break;case 16:if(y[O-3].length<2)throw Error("union requires multiple identifiers");if(f.validateUnionIdentifiers)f.validateUnionIdentifiers(y[O-3]);if(f.addSubsetData(y[O-3],y[O-2],parseFloat(y[O])),f.setIndentMode)f.setIndentMode(!0);break;case 17:case 18:case 19:f.addTextData(y[O-1],y[O],void 0);break;case 20:case 21:f.addTextData(y[O-2],y[O-1],y[O]);break;case 23:f.addStyleData(y[O-1],y[O]);break;case 24:case 25:case 26:var Y=f.getCurrentSets();if(!Y)throw Error("text requires set");f.addTextData(Y,y[O],void 0);break;case 27:case 28:var Y=f.getCurrentSets();if(!Y)throw Error("text requires set");f.addTextData(Y,y[O-1],y[O]);break;case 29:case 41:this.$=[y[O]];break;case 30:case 42:this.$=[...y[O-2],y[O]];break;case 31:this.$=[y[O-2],y[O]];break;case 33:this.$=y[O].join(" ");break;case 34:this.$=[y[O]];break;case 35:y[O-1].push(y[O]),this.$=y[O-1];break;case 43:case 44:this.$=y[O];break}},"anonymous"),table:[e(s,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},e(i,[2,4],{6:5}),e(s,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},e(i,[2,5]),e(i,[2,6]),e(i,[2,7]),e(i,[2,8]),{13:16,20:n,21:r},{13:20,18:19,20:n,21:r},{13:20,18:21,20:n,21:r},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:n,21:r},e(i,[2,9],{14:[1,27],15:[1,28]}),e(o,[2,43]),e(o,[2,44]),e(i,[2,13],{14:[1,29],15:[1,30],27:a}),e(o,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:a},e(i,[2,22]),e(i,[2,24],{14:[1,35]}),e(i,[2,25],{14:[1,36]}),e(i,[2,26]),{20:c,25:37,26:38,27:a},e(i,[2,10],{15:[1,40]}),{16:[1,41]},e(i,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:n,21:r},e(i,[2,17],{14:[1,45]}),e(i,[2,18],{14:[1,46]}),e(i,[2,19]),e(i,[2,27]),e(i,[2,28]),e(i,[2,23],{27:[1,47]}),e(g,[2,29]),{15:[1,48]},{16:[1,49]},e(i,[2,11]),{16:[1,50]},e(i,[2,15]),e(o,[2,42]),e(i,[2,20]),e(i,[2,21]),{20:c,26:51},{16:h,20:l,21:[1,53],28:52,29:54,30:55,31:I,32:b,33:_},e(i,[2,12]),e(i,[2,16]),e(g,[2,30]),e(g,[2,31]),e(g,[2,32]),e(g,[2,33],{30:61,16:h,20:l,31:I,32:b,33:_}),e(M,[2,34]),e(M,[2,36]),e(M,[2,37]),e(M,[2,38]),e(M,[2,39]),e(M,[2,40]),e(M,[2,35])],defaultActions:{6:[2,1]},parseError:t(function(v,w){if(w.recoverable)this.trace(v);else{var z=Error(v);throw z.hash=w,z}},"parseError"),parse:t(function(v){var w=this,z=[0],f=[],k=[null],y=[],H=this.table,O="",Y=0,lt=0,st=0,J=2,K=1,Z=y.slice.call(arguments,1),q=Object.create(this.lexer),tt={yy:{}};for(var it in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,it))tt.yy[it]=this.yy[it];if(q.setInput(v,tt.yy),tt.yy.lexer=q,tt.yy.parser=this,typeof q.yylloc>"u")q.yylloc={};var et=q.yylloc;y.push(et);var ct=q.options&&q.options.ranges;if(typeof tt.yy.parseError==="function")this.parseError=tt.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function rt(ut){z.length=z.length-2*ut,k.length=k.length-ut,y.length=y.length-ut}t(rt,"popStack");function nt(){var ut=f.pop()||q.lex()||K;if(typeof ut!=="number"){if(ut instanceof Array)f=ut,ut=f.pop();ut=w.symbols_[ut]||ut}return ut}t(nt,"lex");var W,ht,ft,N,Q,pt,gt={},dt,ot,qt,kt;while(!0){if(ft=z[z.length-1],this.defaultActions[ft])N=this.defaultActions[ft];else{if(W===null||typeof W>"u")W=nt();N=H[ft]&&H[ft][W]}if(typeof N>"u"||!N.length||!N[0]){var St="";kt=[];for(dt in H[ft])if(this.terminals_[dt]&&dt>J)kt.push("'"+this.terminals_[dt]+"'");if(q.showPosition)St="Parse error on line "+(Y+1)+`:
7
+ A`,a,a,0,o.large?1:0,o.sweep?1:0,n(o.p1.x),n(o.p1.y))}return r.join(" ")}function Gt(e,s){return re(ie(e),s)}function oe(e,s={}){let{lossFunction:i,layoutFunction:n=Yt,normalize:r=!0,orientation:o=Math.PI/2,orientationOrder:a,width:c=600,height:g=350,padding:h=15,scaleToFit:l=!1,symmetricalTextCentre:I=!1,distinct:b,round:_=2}=s,M=n(e,{lossFunction:i==="default"||!i?bt:i==="logRatio"?Zt:i,distinct:b});if(r)M=Jt(M,o,a);let j=Qt(M,c,g,h,l),G=se(j,e,I),B=new Map(Object.keys(j).map((w)=>[w,{set:w,x:j[w].x,y:j[w].y,radius:j[w].radius}])),P=e.map((w)=>{let z=w.sets.map((y)=>B.get(y)),f=ie(z),k=re(f,_);return{circles:z,arcs:f,path:k,area:w,has:new Set(w.sets)}});function v(w){let z="";for(let f of P)if(f.has.size>w.length&&w.every((k)=>f.has.has(k)))z+=" "+f.path;return z}return P.map(({circles:w,arcs:z,path:f,area:k})=>({data:k,text:G[k.sets],circles:w,arcs:z,path:f,distinctPath:f+v(k.sets)}))}var Ot=function(){var e=t(function(P,v,w,z){for(w=w||{},z=P.length;z--;w[P[z]]=v);return w},"o"),s=[5,8],i=[7,8,11,12,17,19,22,24],n=[1,17],r=[1,18],o=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],a=[1,31],c=[1,39],g=[7,8,11,12,17,19,22,24,27],h=[1,57],l=[1,56],I=[1,58],b=[1,59],_=[1,60],M=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],j={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:t(function(v,w,z,f,k,y,Y){var O=y.length-1;switch(k){case 1:return y[O-1];case 2:case 3:case 4:this.$=[];break;case 5:y[O-1].push(y[O]),this.$=y[O-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=y[O];break;case 8:f.setDiagramTitle(y[O].substr(6)),this.$=y[O].substr(6);break;case 9:if(f.addSubsetData([y[O]],void 0,void 0),f.setIndentMode)f.setIndentMode(!0);break;case 10:if(f.addSubsetData([y[O-1]],y[O],void 0),f.setIndentMode)f.setIndentMode(!0);break;case 11:if(f.addSubsetData([y[O-2]],void 0,parseFloat(y[O])),f.setIndentMode)f.setIndentMode(!0);break;case 12:if(f.addSubsetData([y[O-3]],y[O-2],parseFloat(y[O])),f.setIndentMode)f.setIndentMode(!0);break;case 13:if(y[O].length<2)throw Error("union requires multiple identifiers");if(f.validateUnionIdentifiers)f.validateUnionIdentifiers(y[O]);if(f.addSubsetData(y[O],void 0,void 0),f.setIndentMode)f.setIndentMode(!0);break;case 14:if(y[O-1].length<2)throw Error("union requires multiple identifiers");if(f.validateUnionIdentifiers)f.validateUnionIdentifiers(y[O-1]);if(f.addSubsetData(y[O-1],y[O],void 0),f.setIndentMode)f.setIndentMode(!0);break;case 15:if(y[O-2].length<2)throw Error("union requires multiple identifiers");if(f.validateUnionIdentifiers)f.validateUnionIdentifiers(y[O-2]);if(f.addSubsetData(y[O-2],void 0,parseFloat(y[O])),f.setIndentMode)f.setIndentMode(!0);break;case 16:if(y[O-3].length<2)throw Error("union requires multiple identifiers");if(f.validateUnionIdentifiers)f.validateUnionIdentifiers(y[O-3]);if(f.addSubsetData(y[O-3],y[O-2],parseFloat(y[O])),f.setIndentMode)f.setIndentMode(!0);break;case 17:case 18:case 19:f.addTextData(y[O-1],y[O],void 0);break;case 20:case 21:f.addTextData(y[O-2],y[O-1],y[O]);break;case 23:f.addStyleData(y[O-1],y[O]);break;case 24:case 25:case 26:var X=f.getCurrentSets();if(!X)throw Error("text requires set");f.addTextData(X,y[O],void 0);break;case 27:case 28:var X=f.getCurrentSets();if(!X)throw Error("text requires set");f.addTextData(X,y[O-1],y[O]);break;case 29:case 41:this.$=[y[O]];break;case 30:case 42:this.$=[...y[O-2],y[O]];break;case 31:this.$=[y[O-2],y[O]];break;case 33:this.$=y[O].join(" ");break;case 34:this.$=[y[O]];break;case 35:y[O-1].push(y[O]),this.$=y[O-1];break;case 43:case 44:this.$=y[O];break}},"anonymous"),table:[e(s,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},e(i,[2,4],{6:5}),e(s,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},e(i,[2,5]),e(i,[2,6]),e(i,[2,7]),e(i,[2,8]),{13:16,20:n,21:r},{13:20,18:19,20:n,21:r},{13:20,18:21,20:n,21:r},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:n,21:r},e(i,[2,9],{14:[1,27],15:[1,28]}),e(o,[2,43]),e(o,[2,44]),e(i,[2,13],{14:[1,29],15:[1,30],27:a}),e(o,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:a},e(i,[2,22]),e(i,[2,24],{14:[1,35]}),e(i,[2,25],{14:[1,36]}),e(i,[2,26]),{20:c,25:37,26:38,27:a},e(i,[2,10],{15:[1,40]}),{16:[1,41]},e(i,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:n,21:r},e(i,[2,17],{14:[1,45]}),e(i,[2,18],{14:[1,46]}),e(i,[2,19]),e(i,[2,27]),e(i,[2,28]),e(i,[2,23],{27:[1,47]}),e(g,[2,29]),{15:[1,48]},{16:[1,49]},e(i,[2,11]),{16:[1,50]},e(i,[2,15]),e(o,[2,42]),e(i,[2,20]),e(i,[2,21]),{20:c,26:51},{16:h,20:l,21:[1,53],28:52,29:54,30:55,31:I,32:b,33:_},e(i,[2,12]),e(i,[2,16]),e(g,[2,30]),e(g,[2,31]),e(g,[2,32]),e(g,[2,33],{30:61,16:h,20:l,31:I,32:b,33:_}),e(M,[2,34]),e(M,[2,36]),e(M,[2,37]),e(M,[2,38]),e(M,[2,39]),e(M,[2,40]),e(M,[2,35])],defaultActions:{6:[2,1]},parseError:t(function(v,w){if(w.recoverable)this.trace(v);else{var z=Error(v);throw z.hash=w,z}},"parseError"),parse:t(function(v){var w=this,z=[0],f=[],k=[null],y=[],Y=this.table,O="",X=0,lt=0,st=0,J=2,H=1,Z=y.slice.call(arguments,1),q=Object.create(this.lexer),tt={yy:{}};for(var it in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,it))tt.yy[it]=this.yy[it];if(q.setInput(v,tt.yy),tt.yy.lexer=q,tt.yy.parser=this,typeof q.yylloc>"u")q.yylloc={};var et=q.yylloc;y.push(et);var ct=q.options&&q.options.ranges;if(typeof tt.yy.parseError==="function")this.parseError=tt.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function rt(ut){z.length=z.length-2*ut,k.length=k.length-ut,y.length=y.length-ut}t(rt,"popStack");function nt(){var ut=f.pop()||q.lex()||H;if(typeof ut!=="number"){if(ut instanceof Array)f=ut,ut=f.pop();ut=w.symbols_[ut]||ut}return ut}t(nt,"lex");var W,ht,ft,D,Q,pt,gt={},dt,ot,qt,kt;while(!0){if(ft=z[z.length-1],this.defaultActions[ft])D=this.defaultActions[ft];else{if(W===null||typeof W>"u")W=nt();D=Y[ft]&&Y[ft][W]}if(typeof D>"u"||!D.length||!D[0]){var St="";kt=[];for(dt in Y[ft])if(this.terminals_[dt]&&dt>J)kt.push("'"+this.terminals_[dt]+"'");if(q.showPosition)St="Parse error on line "+(X+1)+`:
8
8
  `+q.showPosition()+`
9
- Expecting `+kt.join(", ")+", got '"+(this.terminals_[W]||W)+"'";else St="Parse error on line "+(Y+1)+": Unexpected "+(W==K?"end of input":"'"+(this.terminals_[W]||W)+"'");this.parseError(St,{text:q.match,token:this.terminals_[W]||W,line:q.yylineno,loc:et,expected:kt})}if(N[0]instanceof Array&&N.length>1)throw Error("Parse Error: multiple actions possible at state: "+ft+", token: "+W);switch(N[0]){case 1:if(z.push(W),k.push(q.yytext),y.push(q.yylloc),z.push(N[1]),W=null,!ht){if(lt=q.yyleng,O=q.yytext,Y=q.yylineno,et=q.yylloc,st>0)st--}else W=ht,ht=null;break;case 2:if(ot=this.productions_[N[1]][1],gt.$=k[k.length-ot],gt._$={first_line:y[y.length-(ot||1)].first_line,last_line:y[y.length-1].last_line,first_column:y[y.length-(ot||1)].first_column,last_column:y[y.length-1].last_column},ct)gt._$.range=[y[y.length-(ot||1)].range[0],y[y.length-1].range[1]];if(pt=this.performAction.apply(gt,[O,lt,Y,tt.yy,N[1],k,y].concat(Z)),typeof pt<"u")return pt;if(ot)z=z.slice(0,-1*ot*2),k=k.slice(0,-1*ot),y=y.slice(0,-1*ot);z.push(this.productions_[N[1]][0]),k.push(gt.$),y.push(gt._$),qt=H[z[z.length-2]][z[z.length-1]],z.push(qt);break;case 3:return!0}}return!0},"parse")},G=function(){var F={EOF:1,parseError:t(function(w,z){if(this.yy.parser)this.yy.parser.parseError(w,z);else throw Error(w)},"parseError"),setInput:t(function(v,w){if(this.yy=w||this.yy||{},this._input=v,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];return this.offset=0,this},"setInput"),input:t(function(){var v=this._input[0];this.yytext+=v,this.yyleng++,this.offset++,this.match+=v,this.matched+=v;var w=v.match(/(?:\r\n?|\n).*/g);if(w)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),v},"input"),unput:t(function(v){var w=v.length,z=v.split(/(?:\r\n?|\n)/g);this._input=v+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-w),this.offset-=w;var f=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),z.length-1)this.yylineno-=z.length-1;var k=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:z?(z.length===f.length?this.yylloc.first_column:0)+f[f.length-z.length].length-z[0].length:this.yylloc.first_column-w},this.options.ranges)this.yylloc.range=[k[0],k[0]+this.yyleng-w];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(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).
9
+ Expecting `+kt.join(", ")+", got '"+(this.terminals_[W]||W)+"'";else St="Parse error on line "+(X+1)+": Unexpected "+(W==H?"end of input":"'"+(this.terminals_[W]||W)+"'");this.parseError(St,{text:q.match,token:this.terminals_[W]||W,line:q.yylineno,loc:et,expected:kt})}if(D[0]instanceof Array&&D.length>1)throw Error("Parse Error: multiple actions possible at state: "+ft+", token: "+W);switch(D[0]){case 1:if(z.push(W),k.push(q.yytext),y.push(q.yylloc),z.push(D[1]),W=null,!ht){if(lt=q.yyleng,O=q.yytext,X=q.yylineno,et=q.yylloc,st>0)st--}else W=ht,ht=null;break;case 2:if(ot=this.productions_[D[1]][1],gt.$=k[k.length-ot],gt._$={first_line:y[y.length-(ot||1)].first_line,last_line:y[y.length-1].last_line,first_column:y[y.length-(ot||1)].first_column,last_column:y[y.length-1].last_column},ct)gt._$.range=[y[y.length-(ot||1)].range[0],y[y.length-1].range[1]];if(pt=this.performAction.apply(gt,[O,lt,X,tt.yy,D[1],k,y].concat(Z)),typeof pt<"u")return pt;if(ot)z=z.slice(0,-1*ot*2),k=k.slice(0,-1*ot),y=y.slice(0,-1*ot);z.push(this.productions_[D[1]][0]),k.push(gt.$),y.push(gt._$),qt=Y[z[z.length-2]][z[z.length-1]],z.push(qt);break;case 3:return!0}}return!0},"parse")},G=function(){var P={EOF:1,parseError:t(function(w,z){if(this.yy.parser)this.yy.parser.parseError(w,z);else throw Error(w)},"parseError"),setInput:t(function(v,w){if(this.yy=w||this.yy||{},this._input=v,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];return this.offset=0,this},"setInput"),input:t(function(){var v=this._input[0];this.yytext+=v,this.yyleng++,this.offset++,this.match+=v,this.matched+=v;var w=v.match(/(?:\r\n?|\n).*/g);if(w)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),v},"input"),unput:t(function(v){var w=v.length,z=v.split(/(?:\r\n?|\n)/g);this._input=v+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-w),this.offset-=w;var f=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),z.length-1)this.yylineno-=z.length-1;var k=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:z?(z.length===f.length?this.yylloc.first_column:0)+f[f.length-z.length].length-z[0].length:this.yylloc.first_column-w},this.options.ranges)this.yylloc.range=[k[0],k[0]+this.yyleng-w];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(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).
10
10
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:t(function(v){this.unput(this.match.slice(v))},"less"),pastInput:t(function(){var v=this.matched.substr(0,this.matched.length-this.match.length);return(v.length>20?"...":"")+v.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var v=this.match;if(v.length<20)v+=this._input.substr(0,20-v.length);return(v.substr(0,20)+(v.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var v=this.pastInput(),w=Array(v.length+1).join("-");return v+this.upcomingInput()+`
11
11
  `+w+"^"},"showPosition"),test_match:t(function(v,w){var z,f,k;if(this.options.backtrack_lexer){if(k={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges)k.yylloc.range=this.yylloc.range.slice(0)}if(f=v[0].match(/(?:\r\n?|\n).*/g),f)this.yylineno+=f.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-f[f.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+v[0].length},this.yytext+=v[0],this.match+=v[0],this.matches=v,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(v[0].length),this.matched+=v[0],z=this.performAction.call(this,this.yy,this,w,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(z)return z;else if(this._backtrack){for(var y in k)this[y]=k[y];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var v,w,z,f;if(!this._more)this.yytext="",this.match="";var k=this._currentRules();for(var y=0;y<k.length;y++)if(z=this._input.match(this.rules[k[y]]),z&&(!w||z[0].length>w[0].length)){if(w=z,f=y,this.options.backtrack_lexer)if(v=this.test_match(z,k[y]),v!==!1)return v;else if(this._backtrack){w=!1;continue}else return!1;else if(!this.options.flex)break}if(w){if(v=this.test_match(w,k[f]),v!==!1)return v;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
12
- `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var w=this.next();if(w)return w;else return this.lex()},"lex"),begin:t(function(w){this.conditionStack.push(w)},"begin"),popState:t(function(){var w=this.conditionStack.length-1;if(w>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(w){if(w=this.conditionStack.length-1-Math.abs(w||0),w>=0)return this.conditionStack[w];else return"INITIAL"},"topState"),pushState:t(function(w){this.begin(w)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(w,z,f,k){var y=k;switch(f){case 0:break;case 1:break;case 2:break;case 3:if(w.getIndentMode&&w.getIndentMode())return w.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:if(w.setIndentMode)w.setIndentMode(!1);this.begin("INITIAL"),this.unput(z.yytext);break;case 6:return this.begin("bol"),8;break;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(w.consumeIndentText)w.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return z.yytext=z.yytext.slice(2,-2),14;break;case 17:return z.yytext=z.yytext.slice(1,-1).trim(),14;break;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};return F}();j.lexer=G;function P(){this.yy={}}return t(P,"Parser"),P.prototype=j,j.Parser=P,new P}();Ot.parser=Ot;var ze=Ot,Lt=[],jt=[],Ft=[],Pt=new Set,Vt,Bt=!1,Ae=t((e,s,i)=>{let n=Mt(e).sort(),r=i??10/Math.pow(e.length,2);if(Vt=n,n.length===1)Pt.add(n[0]);Lt.push({sets:n,size:r,label:s?vt(s):void 0})},"addSubsetData"),Ce=t(()=>Lt,"getSubsetData"),vt=t((e)=>{let s=e.trim();if(s.length>=2&&s.startsWith('"')&&s.endsWith('"'))return s.slice(1,-1);return s},"normalizeText"),De=t((e)=>e?vt(e):e,"normalizeStyleValue"),Re=t((e,s,i)=>{let n=vt(s);jt.push({sets:Mt(e).sort(),id:n,label:i?vt(i):void 0})},"addTextData"),Ne=t((e,s)=>{let i=Mt(e).sort(),n={};for(let[r,o]of s)n[r]=De(o)??o;Ft.push({targets:i,styles:n})},"addStyleData"),Oe=t(()=>Ft,"getStyleData"),Mt=t((e)=>e.map((s)=>vt(s)),"normalizeIdentifierList"),Le=t((e)=>{let i=Mt(e).filter((n)=>!Pt.has(n));if(i.length>0)throw Error(`unknown set identifier: ${i.join(", ")}`)},"validateUnionIdentifiers"),je=t(()=>jt,"getTextData"),Fe=t(()=>Vt,"getCurrentSets"),Pe=t(()=>Bt,"getIndentMode"),Ve=t((e)=>{Bt=e},"setIndentMode"),Be=D.venn;function ae(){return U(Be,x().venn)}t(ae,"getConfig");var qe=t(()=>{C(),Lt.length=0,jt.length=0,Ft.length=0,Pt.clear(),Vt=void 0,Bt=!1},"customClear"),Ue={getConfig:ae,clear:qe,setAccTitle:S,getAccTitle:E,setDiagramTitle:L,getDiagramTitle:R,getAccDescription:A,setAccDescription:T,addSubsetData:Ae,getSubsetData:Ce,addTextData:Re,addStyleData:Ne,validateUnionIdentifiers:Le,getTextData:je,getStyleData:Oe,getCurrentSets:Fe,getIndentMode:Pe,setIndentMode:Ve},Ge=t((e)=>`
12
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var w=this.next();if(w)return w;else return this.lex()},"lex"),begin:t(function(w){this.conditionStack.push(w)},"begin"),popState:t(function(){var w=this.conditionStack.length-1;if(w>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(w){if(w=this.conditionStack.length-1-Math.abs(w||0),w>=0)return this.conditionStack[w];else return"INITIAL"},"topState"),pushState:t(function(w){this.begin(w)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(w,z,f,k){var y=k;switch(f){case 0:break;case 1:break;case 2:break;case 3:if(w.getIndentMode&&w.getIndentMode())return w.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:if(w.setIndentMode)w.setIndentMode(!1);this.begin("INITIAL"),this.unput(z.yytext);break;case 6:return this.begin("bol"),8;break;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(w.consumeIndentText)w.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return z.yytext=z.yytext.slice(2,-2),14;break;case 17:return z.yytext=z.yytext.slice(1,-1).trim(),14;break;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};return P}();j.lexer=G;function B(){this.yy={}}return t(B,"Parser"),B.prototype=j,j.Parser=B,new B}();Ot.parser=Ot;var ze=Ot,Lt=[],jt=[],Ft=[],Pt=new Set,Vt,Bt=!1,Ae=t((e,s,i)=>{let n=Mt(e).sort(),r=i??10/Math.pow(e.length,2);if(Vt=n,n.length===1)Pt.add(n[0]);Lt.push({sets:n,size:r,label:s?vt(s):void 0})},"addSubsetData"),Ce=t(()=>Lt,"getSubsetData"),vt=t((e)=>{let s=e.trim();if(s.length>=2&&s.startsWith('"')&&s.endsWith('"'))return s.slice(1,-1);return s},"normalizeText"),De=t((e)=>e?vt(e):e,"normalizeStyleValue"),Re=t((e,s,i)=>{let n=vt(s);jt.push({sets:Mt(e).sort(),id:n,label:i?vt(i):void 0})},"addTextData"),Ne=t((e,s)=>{let i=Mt(e).sort(),n={};for(let[r,o]of s)n[r]=De(o)??o;Ft.push({targets:i,styles:n})},"addStyleData"),Oe=t(()=>Ft,"getStyleData"),Mt=t((e)=>e.map((s)=>vt(s)),"normalizeIdentifierList"),Le=t((e)=>{let i=Mt(e).filter((n)=>!Pt.has(n));if(i.length>0)throw Error(`unknown set identifier: ${i.join(", ")}`)},"validateUnionIdentifiers"),je=t(()=>jt,"getTextData"),Fe=t(()=>Vt,"getCurrentSets"),Pe=t(()=>Bt,"getIndentMode"),Ve=t((e)=>{Bt=e},"setIndentMode"),Be=N.venn;function ae(){return U(Be,x().venn)}t(ae,"getConfig");var qe=t(()=>{C(),Lt.length=0,jt.length=0,Ft.length=0,Pt.clear(),Vt=void 0,Bt=!1},"customClear"),Ue={getConfig:ae,clear:qe,setAccTitle:S,getAccTitle:E,setDiagramTitle:L,getDiagramTitle:R,getAccDescription:A,setAccDescription:T,addSubsetData:Ae,getSubsetData:Ce,addTextData:Re,addStyleData:Ne,validateUnionIdentifiers:Le,getTextData:je,getStyleData:Oe,getCurrentSets:Fe,getIndentMode:Pe,setIndentMode:Ve},Ge=t((e)=>`
13
13
  .venn-title {
14
14
  font-size: 32px;
15
15
  fill: ${e.vennTitleTextColor};
@@ -31,4 +31,4 @@ Expecting `+kt.join(", ")+", got '"+(this.terminals_[W]||W)+"'";else St="Parse e
31
31
  font-family: ${e.fontFamily};
32
32
  color: ${e.vennSetTextColor};
33
33
  }
34
- `,"getStyles"),We=Ge;function le(e){let s=new Map;for(let i of e){let n=i.targets.join("|"),r=s.get(n);if(r)Object.assign(r,i.styles);else s.set(n,{...i.styles})}return s}t(le,"buildStyleByKey");var Ke=t((e,s,i,n)=>{let r=n.db,o=r.getConfig?.(),{themeVariables:a,look:c,handDrawnSeed:g}=x(),h=c==="handDrawn",l=[a.venn1,a.venn2,a.venn3,a.venn4,a.venn5,a.venn6,a.venn7,a.venn8].filter(Boolean),I=r.getDiagramTitle?.(),b=r.getSubsetData(),_=r.getTextData(),M=le(r.getStyleData()),j=ue(b),G=o?.width??800,P=o?.height??450,F=1600,v=G/1600,w=I?48*v:0,z=a.primaryTextColor??a.textColor,f=V(s);if(f.attr("viewBox",`0 0 ${G} ${P}`),I)f.append("text").text(I).attr("class","venn-title").attr("font-size",`${32*v}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*v).style("fill",a.vennTitleTextColor||a.titleColor);let k=p(document.createElement("div")),y=ee().width(G).height(P-w);k.datum(j).call(y);let H=h?m.svg(k.select("svg").node()):void 0,O=oe(j,{width:G,height:P-w,padding:o?.padding??15}),Y=new Map;for(let K of O){let Z=yt([...K.data.sets].sort());Y.set(Z,K)}if(_.length>0)ce(o,Y,k,_,v,M);let lt=X(a.background||"#f4f4f4");if(k.selectAll(".venn-circle").each(function(K,Z){let q=p(this),it=yt([...K.sets].sort()),et=M.get(it),ct=l.length>0?l[Z%l.length]:void 0,rt=et?.fill||ct||a.primaryColor;q.classed(`venn-set-${Z%8}`,!0);let nt=et?.["fill-opacity"]??0.1,W=et?.stroke||rt,ht=et?.["stroke-width"]||`${5*v}`;if(h&&H){let N=Y.get(it);if(N&&N.circles.length>0){let Q=N.circles[0],pt=H.circle(Q.x,Q.y,Q.radius*2,{roughness:0.7,seed:g,fill:wt(rt,0.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+Z*60,stroke:W,strokeWidth:parseFloat(String(ht))});q.select("path").remove(),q.node()?.insertBefore(pt,q.select("text").node())}}else q.select("path").style("fill",rt).style("fill-opacity",nt).style("stroke",W).style("stroke-width",ht).style("stroke-opacity",0.95);let ft=et?.color||(lt?u(rt,30):d(rt,30));q.select("text").style("font-size",`${48*v}px`).style("fill",ft)}),h&&H)k.selectAll(".venn-intersection").each(function(K){let Z=p(this),tt=yt([...K.sets].sort()),it=M.get(tt),et=it?.fill;if(et){let ct=Z.select("path"),rt=ct.attr("d");if(rt){let nt=H.path(rt,{roughness:0.7,seed:g,fill:wt(et,0.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),W=ct.node();W?.parentNode?.insertBefore(nt,W),ct.remove()}}else Z.select("path").style("fill-opacity",0);Z.select("text").style("font-size",`${48*v}px`).style("fill",it?.color??a.vennSetTextColor??z)});else k.selectAll(".venn-intersection text").style("font-size",`${48*v}px`).style("fill",(K)=>{let q=yt([...K.sets].sort());return M.get(q)?.color??a.vennSetTextColor??z}),k.selectAll(".venn-intersection path").style("fill-opacity",(K)=>{let q=yt([...K.sets].sort());return M.get(q)?.fill?1:0}).style("fill",(K)=>{let q=yt([...K.sets].sort());return M.get(q)?.fill??"transparent"});let st=f.append("g").attr("transform",`translate(0, ${w})`),J=k.select("svg").node();if(J&&"childNodes"in J)for(let K of[...J.childNodes])st.node()?.appendChild(K);B(f,P,G,o?.useMaxWidth??!0)},"draw");function yt(e){return e.join("|")}t(yt,"stableSetsKey");function ce(e,s,i,n,r,o){let a=e?.useDebugLayout??!1,g=i.select("svg").append("g").attr("class","venn-text-nodes"),h=new Map;for(let l of n){let I=yt(l.sets),b=h.get(I);if(b)b.push(l);else h.set(I,[l])}for(let[l,I]of h.entries()){let b=s.get(l);if(!b?.text)continue;let _=b.text.x,M=b.text.y,j=Math.min(...b.circles.map((J)=>J.radius)),G=Math.min(...b.circles.map((J)=>J.radius-Math.hypot(_-J.x,M-J.y))),P=Number.isFinite(G)?Math.max(0,G):0;if(P===0&&Number.isFinite(j))P=j*0.6;let F=g.append("g").attr("class","venn-text-area").attr("font-size",`${40*r}px`);if(a)F.append("circle").attr("class","venn-text-debug-circle").attr("cx",_).attr("cy",M).attr("r",P).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*r).attr("stroke-dasharray",`${6*r} ${4*r}`);let v=Math.max(80*r,P*2*0.95),w=Math.max(60*r,P*2*0.95),k=(b.data.label&&b.data.label.length>0?Math.min(32*r,P*0.25):0)+(I.length<=2?30*r:0),y=_-v/2,H=M-w/2+k,O=Math.max(1,Math.ceil(Math.sqrt(I.length))),Y=Math.max(1,Math.ceil(I.length/O)),lt=v/O,st=w/Y;for(let[J,K]of I.entries()){let Z=J%O,q=Math.floor(J/O),tt=y+lt*(Z+0.5),it=H+st*(q+0.5);if(a)F.append("rect").attr("class","venn-text-debug-cell").attr("x",y+lt*Z).attr("y",H+st*q).attr("width",lt).attr("height",st).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*r).attr("stroke-dasharray",`${4*r} ${3*r}`);let et=lt*0.9,ct=st*0.9,rt=F.append("foreignObject").attr("class","venn-text-node-fo").attr("width",et).attr("height",ct).attr("x",tt-et/2).attr("y",it-ct/2).attr("overflow","visible"),nt=o.get(K.id)?.color,W=rt.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(K.label??K.id);if(nt)W.style("color",nt)}}}t(ce,"renderTextNodes");function ue(e){let s=new Set(e.map((r)=>[...r.sets].sort().join("|"))),i=new Map(e.filter((r)=>r.sets.length===1&&r.size!==void 0).map((r)=>[r.sets[0],r.size])),n=[];for(let r of e){if(r.sets.length<3)continue;let o=[...r.sets].sort();for(let a=0;a<o.length-1;a++)for(let c=a+1;c<o.length;c++){let g=[o[a],o[c]],h=g.join("|");if(!s.has(h)){s.add(h);let l=i.get(g[0]),I=i.get(g[1]),b=l!==void 0&&I!==void 0?Math.min(l,I)/4:2.5;n.push({sets:g,size:b,label:""})}}}return n.length>0?[...e,...n]:e}t(ue,"ensurePairwiseSubsets");var He={draw:Ke},rn={parser:ze,db:Ue,renderer:He,styles:We};export{rn as diagram};
34
+ `,"getStyles"),We=Ge;function le(e){let s=new Map;for(let i of e){let n=i.targets.join("|"),r=s.get(n);if(r)Object.assign(r,i.styles);else s.set(n,{...i.styles})}return s}t(le,"buildStyleByKey");var Ke=t((e,s,i,n)=>{let r=n.db,o=r.getConfig?.(),{themeVariables:a,look:c,handDrawnSeed:g}=x(),h=c==="handDrawn",l=[a.venn1,a.venn2,a.venn3,a.venn4,a.venn5,a.venn6,a.venn7,a.venn8].filter(Boolean),I=r.getDiagramTitle?.(),b=r.getSubsetData(),_=r.getTextData(),M=le(r.getStyleData()),j=ue(b),G=o?.width??800,B=o?.height??450,P=1600,v=G/1600,w=I?48*v:0,z=a.primaryTextColor??a.textColor,f=V(s);if(f.attr("viewBox",`0 0 ${G} ${B}`),I)f.append("text").text(I).attr("class","venn-title").attr("font-size",`${32*v}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*v).style("fill",a.vennTitleTextColor||a.titleColor);let k=p(document.createElement("div")),y=ee().width(G).height(B-w);k.datum(j).call(y);let Y=h?m.svg(k.select("svg").node()):void 0,O=oe(j,{width:G,height:B-w,padding:o?.padding??15}),X=new Map;for(let H of O){let Z=yt([...H.data.sets].sort());X.set(Z,H)}if(_.length>0)ce(o,X,k,_,v,M);let lt=K(a.background||"#f4f4f4");if(k.selectAll(".venn-circle").each(function(H,Z){let q=p(this),it=yt([...H.sets].sort()),et=M.get(it),ct=l.length>0?l[Z%l.length]:void 0,rt=et?.fill||ct||a.primaryColor;q.classed(`venn-set-${Z%8}`,!0);let nt=et?.["fill-opacity"]??0.1,W=et?.stroke||rt,ht=et?.["stroke-width"]||`${5*v}`;if(h&&Y){let D=X.get(it);if(D&&D.circles.length>0){let Q=D.circles[0],pt=Y.circle(Q.x,Q.y,Q.radius*2,{roughness:0.7,seed:g,fill:wt(rt,0.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+Z*60,stroke:W,strokeWidth:parseFloat(String(ht))});q.select("path").remove(),q.node()?.insertBefore(pt,q.select("text").node())}}else q.select("path").style("fill",rt).style("fill-opacity",nt).style("stroke",W).style("stroke-width",ht).style("stroke-opacity",0.95);let ft=et?.color||(lt?u(rt,30):d(rt,30));q.select("text").style("font-size",`${48*v}px`).style("fill",ft)}),h&&Y)k.selectAll(".venn-intersection").each(function(H){let Z=p(this),tt=yt([...H.sets].sort()),it=M.get(tt),et=it?.fill;if(et){let ct=Z.select("path"),rt=ct.attr("d");if(rt){let nt=Y.path(rt,{roughness:0.7,seed:g,fill:wt(et,0.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),W=ct.node();W?.parentNode?.insertBefore(nt,W),ct.remove()}}else Z.select("path").style("fill-opacity",0);Z.select("text").style("font-size",`${48*v}px`).style("fill",it?.color??a.vennSetTextColor??z)});else k.selectAll(".venn-intersection text").style("font-size",`${48*v}px`).style("fill",(H)=>{let q=yt([...H.sets].sort());return M.get(q)?.color??a.vennSetTextColor??z}),k.selectAll(".venn-intersection path").style("fill-opacity",(H)=>{let q=yt([...H.sets].sort());return M.get(q)?.fill?1:0}).style("fill",(H)=>{let q=yt([...H.sets].sort());return M.get(q)?.fill??"transparent"});let st=f.append("g").attr("transform",`translate(0, ${w})`),J=k.select("svg").node();if(J&&"childNodes"in J)for(let H of[...J.childNodes])st.node()?.appendChild(H);F(f,B,G,o?.useMaxWidth??!0)},"draw");function yt(e){return e.join("|")}t(yt,"stableSetsKey");function ce(e,s,i,n,r,o){let a=e?.useDebugLayout??!1,g=i.select("svg").append("g").attr("class","venn-text-nodes"),h=new Map;for(let l of n){let I=yt(l.sets),b=h.get(I);if(b)b.push(l);else h.set(I,[l])}for(let[l,I]of h.entries()){let b=s.get(l);if(!b?.text)continue;let _=b.text.x,M=b.text.y,j=Math.min(...b.circles.map((J)=>J.radius)),G=Math.min(...b.circles.map((J)=>J.radius-Math.hypot(_-J.x,M-J.y))),B=Number.isFinite(G)?Math.max(0,G):0;if(B===0&&Number.isFinite(j))B=j*0.6;let P=g.append("g").attr("class","venn-text-area").attr("font-size",`${40*r}px`);if(a)P.append("circle").attr("class","venn-text-debug-circle").attr("cx",_).attr("cy",M).attr("r",B).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*r).attr("stroke-dasharray",`${6*r} ${4*r}`);let v=Math.max(80*r,B*2*0.95),w=Math.max(60*r,B*2*0.95),k=(b.data.label&&b.data.label.length>0?Math.min(32*r,B*0.25):0)+(I.length<=2?30*r:0),y=_-v/2,Y=M-w/2+k,O=Math.max(1,Math.ceil(Math.sqrt(I.length))),X=Math.max(1,Math.ceil(I.length/O)),lt=v/O,st=w/X;for(let[J,H]of I.entries()){let Z=J%O,q=Math.floor(J/O),tt=y+lt*(Z+0.5),it=Y+st*(q+0.5);if(a)P.append("rect").attr("class","venn-text-debug-cell").attr("x",y+lt*Z).attr("y",Y+st*q).attr("width",lt).attr("height",st).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*r).attr("stroke-dasharray",`${4*r} ${3*r}`);let et=lt*0.9,ct=st*0.9,rt=P.append("foreignObject").attr("class","venn-text-node-fo").attr("width",et).attr("height",ct).attr("x",tt-et/2).attr("y",it-ct/2).attr("overflow","visible"),nt=o.get(H.id)?.color,W=rt.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(H.label??H.id);if(nt)W.style("color",nt)}}}t(ce,"renderTextNodes");function ue(e){let s=new Set(e.map((r)=>[...r.sets].sort().join("|"))),i=new Map(e.filter((r)=>r.sets.length===1&&r.size!==void 0).map((r)=>[r.sets[0],r.size])),n=[];for(let r of e){if(r.sets.length<3)continue;let o=[...r.sets].sort();for(let a=0;a<o.length-1;a++)for(let c=a+1;c<o.length;c++){let g=[o[a],o[c]],h=g.join("|");if(!s.has(h)){s.add(h);let l=i.get(g[0]),I=i.get(g[1]),b=l!==void 0&&I!==void 0?Math.min(l,I)/4:2.5;n.push({sets:g,size:b,label:""})}}}return n.length>0?[...e,...n]:e}t(ue,"ensurePairwiseSubsets");var He={draw:Ke},rn={parser:ze,db:Ue,renderer:He,styles:We};export{rn as diagram};