filecat 7.7.1 → 7.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/build/dist/1045.0e4bdc838c37771a7f50.js +1 -0
  2. package/build/dist/1075.493acb74297c1e753de2.js +1 -0
  3. package/build/dist/1128.b80776fbdbdda36034c3.js +1 -0
  4. package/build/dist/1388.1dcf844b452e3aae3dc0.js +1 -0
  5. package/build/dist/1671.fb137d27b5763953487e.js +1 -0
  6. package/build/dist/{6887.93191dae462af3692775.js → 1738.b8ab2bd79df131e60051.js} +1 -1
  7. package/build/dist/1802.e43e833638f6ba8e22d7.js +1 -0
  8. package/build/dist/1964.bd3d684b50aa5191b413.js +1 -0
  9. package/build/dist/200.bb7f6ce5543bd7ff6d97.js +1 -0
  10. package/build/dist/2105.e4ba1c1d506b3fe14e8e.js +1 -0
  11. package/build/dist/2122.bc10dcdbbfc38e0ef883.js +1 -0
  12. package/build/dist/{3457.18b45379d8bcf7f5f3b5.js → 2180.df641ebaead77c4ada71.js} +1 -1
  13. package/build/dist/2300.9e1baa1c0368abe53d96.js +2 -0
  14. package/build/dist/2479.15722ac55b05c521f4f7.js +1 -0
  15. package/build/dist/2572.8fdddfebb4da2f29dbd8.js +1 -0
  16. package/build/dist/259.81bb9e049e5ef587a96f.js +1 -0
  17. package/build/dist/2674.0c822a9c458f923a4eff.js +1 -0
  18. package/build/dist/{1001.44a1a25c7d6d3f294bf3.js → 2822.9417e764a14f8f5f57dc.js} +1 -1
  19. package/build/dist/2994.c492be0d907fa468a9be.js +1 -0
  20. package/build/dist/{3140.b078ec311f99170b7f4c.js → 3140.794a212da633caf38b3a.js} +2 -2
  21. package/build/dist/3230.7798ab546facfa058b34.js +1 -0
  22. package/build/dist/3233.fb6bffd5e097e4ac9423.js +1 -0
  23. package/build/dist/3283.9386fc7f67aef46604fb.js +1 -0
  24. package/build/dist/3299.d01f5a742d80f4e6e25b.js +1 -0
  25. package/build/dist/3300.b8a3bc571293a6280ed8.js +1 -0
  26. package/build/dist/{3402.d412940350051a52d7ac.js → 3402.b6dc28d2f9bace7cde85.js} +1 -1
  27. package/build/dist/3509.cbcb309fbf49db53229f.js +1 -0
  28. package/build/dist/{3727.b8d9cbae9de47bf8d49b.js → 3510.b975b8bfdee5e8518215.js} +1 -1
  29. package/build/dist/{587.c75ed69a8373139346f9.js → 3566.ba323afadcf41fad2fa7.js} +1 -1
  30. package/build/dist/3608.aff9429024b740ac5cd0.js +1 -0
  31. package/build/dist/3990.5e16453f57b90b01d539.js +1 -0
  32. package/build/dist/4004.de90f1192487a24a0a9a.js +1 -0
  33. package/build/dist/4061.c0eb5824eeb6a59fa827.js +1 -0
  34. package/build/dist/4220.b65b40382726a69ba0bc.js +1 -0
  35. package/build/dist/{3883.70d42c3a335d6833f07e.js → 4376.b022a792fb34fbe50398.js} +1 -1
  36. package/build/dist/4437.4d5a0965043471411a00.js +1 -0
  37. package/build/dist/4469.536491f90535e831ce3e.js +1 -0
  38. package/build/dist/453.8877eb10f13258c290bc.js +1 -0
  39. package/build/dist/4560.8ef2e4b60cc86d019dd6.js +1 -0
  40. package/build/dist/4735.838cd0f656bbf7d99ff6.js +1 -0
  41. package/build/dist/4772.9b95c402a4def0f576e3.js +1 -0
  42. package/build/dist/4985.44cb7d829ca477e368b8.js +1 -0
  43. package/build/dist/5516.645e4a900df9bdc1806c.js +1 -0
  44. package/build/dist/5526.6b4867751becda056ed8.js +1 -0
  45. package/build/dist/5614.fb6bffd5e097e4ac9423.js +1 -0
  46. package/build/dist/5617.8efc3b1d218f80df9b39.js +1 -0
  47. package/build/dist/5744.e9f1efb88a617b05b709.js +1 -0
  48. package/build/dist/583.cef46d6b21c6fa6454cf.js +1 -0
  49. package/build/dist/6089.6d5d19a327284ff3b11c.js +1 -0
  50. package/build/dist/6164.7dae9989dd129479f952.js +1 -0
  51. package/build/dist/6284.10deb80685728f50aa45.js +1 -0
  52. package/build/dist/629.b75b024aacc43e0d69cf.js +1 -0
  53. package/build/dist/6344.291e5dadc74e62739774.js +1 -0
  54. package/build/dist/6492.3ee4060598de873d8e8f.js +1 -0
  55. package/build/dist/6571.b381c44055704e3ba649.js +1 -0
  56. package/build/dist/6731.6763296ce5ae210bc0fe.js +1 -0
  57. package/build/dist/6759.f88b50c41207cb8345d1.js +1 -0
  58. package/build/dist/{4951.88718d978aea2dd40006.js → 6789.34921a30c8a81f0a6407.js} +1 -1
  59. package/build/dist/6800.ee99fd0a88b6acbaaf2c.js +1 -0
  60. package/build/dist/6803.fe4297b1e51c3bfc7f50.js +1 -0
  61. package/build/dist/{313.d51fc773856f078487ad.js → 6806.9ebf089eba60f3b8e946.js} +1 -1
  62. package/build/dist/7038.4e4fc8e405c56d3080e2.js +1 -0
  63. package/build/dist/7310.bf944d03f24fcf109680.js +1 -0
  64. package/build/dist/{359.1b95bd6368196ccaa731.js → 7430.25bf8437ad8f7c1fd36f.js} +1 -1
  65. package/build/dist/7483.5e26ada69b33418c31a8.js +1 -0
  66. package/build/dist/{4087.4796ff56340985c35542.js → 7486.fe0b5f867c08b40a3360.js} +1 -1
  67. package/build/dist/7567.09e1b34ad9bd3e463eb4.js +1 -0
  68. package/build/dist/7834.7a593dcb80ca09f58586.js +1 -0
  69. package/build/dist/784.48a3b71205680f427109.js +1 -0
  70. package/build/dist/7943.54c702542d55f576a576.js +1 -0
  71. package/build/dist/7954.6ce241a8ed27cb26efc6.js +1 -0
  72. package/build/dist/8079.f6f2be43e5d933ae1f6f.js +1 -0
  73. package/build/dist/8677.860320b7f36947e57d11.js +1 -0
  74. package/build/dist/8727.3628c746061aed7a4077.js +1 -0
  75. package/build/dist/9299.ed4de6cd4f4bfa0a966a.js +1 -0
  76. package/build/dist/9324.ef229da9b943484298ba.js +1 -0
  77. package/build/dist/9364.d2570d78afc50fe1b23e.js +1 -0
  78. package/build/dist/9463.2629a7daf4c2865b9b96.js +1 -0
  79. package/build/dist/index.html +1 -1
  80. package/build/dist/main.98bb29605335d9b2219f.js +2 -0
  81. package/build/main.js +1 -1
  82. package/build/threads.work.filecat.js +1 -1
  83. package/package.json +4 -5
  84. package/shell/config/webpack.web.config.js +2 -2
  85. package/build/dist/1075.3ef2e1902e9f7e9e37b1.js +0 -1
  86. package/build/dist/1312.199a506fb836a2412255.js +0 -1
  87. package/build/dist/136.e3bb3c50051edb17454d.js +0 -1
  88. package/build/dist/1478.c58a43bb24820a13eaed.js +0 -1
  89. package/build/dist/1491.901cce0168c42ad319fa.js +0 -1
  90. package/build/dist/1566.4f405afd26063b55129c.js +0 -1
  91. package/build/dist/161.98f6c2a50bf3824a6efb.js +0 -1
  92. package/build/dist/1654.a21a099e2749ef167ea9.js +0 -1
  93. package/build/dist/1875.46dd3a6cc071d45a32f1.js +0 -1
  94. package/build/dist/1883.14c90bbe93fe206906f0.js +0 -1
  95. package/build/dist/1924.c7bd2a2aa0e9bc78c9ba.js +0 -1
  96. package/build/dist/2000.f55ddba9e6313243f028.js +0 -1
  97. package/build/dist/2101.d4efa6a2c1e9169d9225.js +0 -1
  98. package/build/dist/2180.60fe32ab12c2fa1570a4.js +0 -1
  99. package/build/dist/2191.4c4f2fd5127168a81877.js +0 -1
  100. package/build/dist/2213.ceffb8fd7be66b35d079.js +0 -1
  101. package/build/dist/2463.6e530d1e9b5c58dba166.js +0 -1
  102. package/build/dist/2623.8b1e5e391dd4e05fc119.js +0 -1
  103. package/build/dist/2674.3713c09449bdd57b1066.js +0 -1
  104. package/build/dist/2894.8395ec5e280cc6b6c4dc.js +0 -1
  105. package/build/dist/3042.f490cfa4208208262398.js +0 -1
  106. package/build/dist/3096.d0b2c77a23418c545c01.js +0 -1
  107. package/build/dist/311.da79ace98b69a635c41c.js +0 -1
  108. package/build/dist/3166.088cf4a0356c3a6e30a0.js +0 -1
  109. package/build/dist/3233.80bcbba8a50c0f85ceee.js +0 -1
  110. package/build/dist/3357.4f1bf81ecc3c11a3f813.js +0 -1
  111. package/build/dist/3475.d10d21b637761d7d886d.js +0 -1
  112. package/build/dist/3708.04401b24d95214d641e5.js +0 -1
  113. package/build/dist/3752.01fc1f14b29f340e41fd.js +0 -1
  114. package/build/dist/3871.7a387a9dc21883d08423.js +0 -1
  115. package/build/dist/3994.19fb81947d65fc81b0a2.js +0 -1
  116. package/build/dist/4012.b516fdc981e55be2ebb2.js +0 -1
  117. package/build/dist/4122.9ea6b5dd8dc9d2265825.js +0 -1
  118. package/build/dist/4141.06960673a6a484e7b88d.js +0 -1
  119. package/build/dist/4190.ff72264b4f07f6542d33.js +0 -1
  120. package/build/dist/4239.1b49d7c26192fb637d57.js +0 -1
  121. package/build/dist/4288.8dc8f5d962720e084952.js +0 -1
  122. package/build/dist/434.04cdc2a05316f92d1d38.js +0 -1
  123. package/build/dist/4376.f3c60897f70dd4e33d2f.js +0 -1
  124. package/build/dist/4472.38816dfb835d527175d6.js +0 -1
  125. package/build/dist/4473.b42b37616f13be64199b.js +0 -1
  126. package/build/dist/449.3fd75e05da22fe1c5ecc.js +0 -1
  127. package/build/dist/452.4974390f4f4d991216e5.js +0 -1
  128. package/build/dist/4547.36b5848220c04c47bc80.js +0 -1
  129. package/build/dist/4605.ef0f4204b3bf3a18efa6.js +0 -1
  130. package/build/dist/4804.fbd0ffcf57d9dffc15b7.js +0 -1
  131. package/build/dist/482.0c7512372a1fbf61d704.js +0 -1
  132. package/build/dist/4963.22d7db9b376a42d3f00b.js +0 -1
  133. package/build/dist/5097.a0de16bf7b90a8b1157d.js +0 -1
  134. package/build/dist/5123.d9ed79af478b5cc4f1b2.js +0 -1
  135. package/build/dist/5332.8b6e85d8764e907a01d5.js +0 -1
  136. package/build/dist/536.660d866952b46ba53180.js +0 -1
  137. package/build/dist/548.d3d912d0c0c7e835e1dc.js +0 -1
  138. package/build/dist/5516.cc92dfbf06ddcd133dbc.js +0 -1
  139. package/build/dist/5590.585778da623ec71f7722.js +0 -1
  140. package/build/dist/5614.80bcbba8a50c0f85ceee.js +0 -1
  141. package/build/dist/5616.14df0fe505c4dadf4042.js +0 -1
  142. package/build/dist/5695.95dc69f3b02812eb9e93.js +0 -1
  143. package/build/dist/5697.6ac62f99ca19a979f1eb.js +0 -1
  144. package/build/dist/5741.237d817efc942de875e5.js +0 -1
  145. package/build/dist/5849.d26365d4b19533db6fd6.js +0 -1
  146. package/build/dist/5902.3969a79465383ff4bbb4.js +0 -1
  147. package/build/dist/5937.c3f14ccc441bfd06e13d.js +0 -1
  148. package/build/dist/5942.981e03467a3b2c653ab8.js +0 -1
  149. package/build/dist/6029.63e4beb66df7afc65a90.js +0 -1
  150. package/build/dist/6054.f91307b52046172fc5f8.js +0 -1
  151. package/build/dist/6089.0863a6a09be2b97e84e1.js +0 -1
  152. package/build/dist/6095.d845e356a4db8a241cdb.js +0 -1
  153. package/build/dist/6114.ca67e88c701691b3bb1e.js +0 -1
  154. package/build/dist/612.74d77e32957a5c6eb197.js +0 -1
  155. package/build/dist/625.d9e531476b3306e0b837.js +0 -1
  156. package/build/dist/6318.66541f9cef18d14ea3ea.js +0 -1
  157. package/build/dist/6455.5c950f6eb61015409eb6.js +0 -1
  158. package/build/dist/6527.436d2d5d81376e6a54ae.js +0 -1
  159. package/build/dist/6530.2f1b283a902603262048.js +0 -1
  160. package/build/dist/6610.b92f337fcc1b347350fb.js +0 -1
  161. package/build/dist/6926.2786af754adcdabfbede.js +0 -1
  162. package/build/dist/697.62f8b1ec6d2cd40ed316.js +0 -1
  163. package/build/dist/70.be2f9130c93c4175d12f.js +0 -1
  164. package/build/dist/7081.9e1e196fecfcccb4bfb9.js +0 -1
  165. package/build/dist/7128.3573ab2a5f28b79ba89e.js +0 -1
  166. package/build/dist/7163.ad09accaa87e565b8dc0.js +0 -1
  167. package/build/dist/72.a1d87dabb7f0615b3a21.js +0 -1
  168. package/build/dist/7229.50a1700104d1e4732735.js +0 -1
  169. package/build/dist/7332.d024ae75a3da2f7674a1.js +0 -1
  170. package/build/dist/7509.370c49d7ff43e289190c.js +0 -1
  171. package/build/dist/7514.dbf525bade6ffbd70af6.js +0 -2
  172. package/build/dist/7557.7d62939c56391a647067.js +0 -1
  173. package/build/dist/7588.2d840229f62de92b22e5.js +0 -1
  174. package/build/dist/7632.5660653552f755580adc.js +0 -1
  175. package/build/dist/7639.b3c6382de2fde652a40b.js +0 -1
  176. package/build/dist/779.91614fabf5c9eb3aafa0.js +0 -1
  177. package/build/dist/7810.979796e8a3aad6d4d72f.js +0 -1
  178. package/build/dist/7897.8b8070d6abe5c2327168.js +0 -1
  179. package/build/dist/7941.dbef0b0f412899800b13.js +0 -1
  180. package/build/dist/7953.5cd280effe2e967ea490.js +0 -1
  181. package/build/dist/7954.efecc100b407af204add.js +0 -1
  182. package/build/dist/7959.e31a21f28ff463d9d5e9.js +0 -1
  183. package/build/dist/8034.301f1099c4a7ce6c2829.js +0 -1
  184. package/build/dist/8080.e1c9af30bdd818b08c6e.js +0 -1
  185. package/build/dist/8087.6452b67614a0855535a4.js +0 -1
  186. package/build/dist/8140.bbccc589b007f9d410d1.js +0 -1
  187. package/build/dist/8162.e47cccbe327b26a2ea6f.js +0 -1
  188. package/build/dist/8177.d669c6337f8814781f49.js +0 -1
  189. package/build/dist/8322.56c8f4b4ad93b1a866c8.js +0 -1
  190. package/build/dist/8376.01a9f23ba06a78922364.js +0 -1
  191. package/build/dist/8433.e54d57e2cc9408e5e411.js +0 -1
  192. package/build/dist/8460.25f0859cb2266f764113.js +0 -1
  193. package/build/dist/8524.7945bff0063dc5c5903d.js +0 -1
  194. package/build/dist/8782.a5498372f1eb6bab41b7.js +0 -1
  195. package/build/dist/8953.23fe6fe13b28168428d3.js +0 -1
  196. package/build/dist/8964.bdf168262ab40956654a.js +0 -1
  197. package/build/dist/9003.69a0d15e722e1ed455b0.js +0 -1
  198. package/build/dist/9299.c2699815e5339e4045f8.js +0 -1
  199. package/build/dist/9385.2b1afe7b55d4c16f97ad.js +0 -1
  200. package/build/dist/9428.3176bab8f5780f060d51.js +0 -1
  201. package/build/dist/9456.506d55e351dec4f45566.js +0 -1
  202. package/build/dist/9465.8ff5871fb708cf7c1021.js +0 -1
  203. package/build/dist/9500.95d19d78b580734ec35e.js +0 -1
  204. package/build/dist/9512.03215278f26dc63c056d.js +0 -1
  205. package/build/dist/9614.cfdbe03d8e2960b0a53a.js +0 -1
  206. package/build/dist/9651.6bf3e34362f10c1aa35d.js +0 -1
  207. package/build/dist/9788.4a1c2f3626e532d3b44c.js +0 -1
  208. package/build/dist/9943.b62436bd9d0730c715a9.js +0 -1
  209. package/build/dist/9967.216bc8d26440bcbaf785.js +0 -1
  210. package/build/dist/9970.aa60aa700a790ba226f0.js +0 -1
  211. package/build/dist/main.401995af1fd441fa9164.js +0 -2
  212. /package/build/dist/{7514.dbf525bade6ffbd70af6.js.LICENSE.txt → 2300.9e1baa1c0368abe53d96.js.LICENSE.txt} +0 -0
  213. /package/build/dist/{3140.b078ec311f99170b7f4c.js.LICENSE.txt → 3140.794a212da633caf38b3a.js.LICENSE.txt} +0 -0
  214. /package/build/dist/{main.401995af1fd441fa9164.js.LICENSE.txt → main.98bb29605335d9b2219f.js.LICENSE.txt} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[3990],{33990(t,e,n){n.d(e,{diagram:()=>Et});var s=n(5637),i=n(12505),r=n(86535),o=(n(31293),n(86827)),a=n(51444),l=n(5097),c=n(95635);const h=(t,e)=>(0,c.A)(t,"a",-e);var u=n(78041),f=n(75263);const d=1e-10;function y(t,e){const n=function(t){const e=[];for(let n=0;n<t.length;++n)for(let s=n+1;s<t.length;++s){const i=m(t[n],t[s]);for(const t of i)t.parentIndex=[n,s],e.push(t)}return e}(t),s=n.filter(e=>function(t,e){return e.every(e=>x(t,e)<e.radius+d)}(e,t));let i=0,r=0;const o=[];if(s.length>1){const e=b(s);for(let t=0;t<s.length;++t){const n=s[t];n.angle=Math.atan2(n.x-e.x,n.y-e.y)}s.sort((t,e)=>e.angle-t.angle);let n=s[s.length-1];for(let e=0;e<s.length;++e){const a=s[e];r+=(n.x+a.x)*(a.y-n.y);const l={x:(a.x+n.x)/2,y:(a.y+n.y)/2};let c=null;for(let e=0;e<a.parentIndex.length;++e)if(n.parentIndex.includes(a.parentIndex[e])){const s=t[a.parentIndex[e]],i=Math.atan2(a.x-s.x,a.y-s.y),r=Math.atan2(n.x-s.x,n.y-s.y);let o=r-i;o<0&&(o+=2*Math.PI);const h=r-o/2;let u=x(l,{x:s.x+s.radius*Math.sin(h),y:s.y+s.radius*Math.cos(h)});u>2*s.radius&&(u=2*s.radius),(null==c||c.width>u)&&(c={circle:s,width:u,p1:a,p2:n,large:u>s.radius,sweep:!0})}null!=c&&(o.push(c),i+=g(c.circle.radius,c.width),n=a)}}else{let e=t[0];for(let n=1;n<t.length;++n)t[n].radius<e.radius&&(e=t[n]);let n=!1;for(let s=0;s<t.length;++s)if(x(t[s],e)>Math.abs(e.radius-t[s].radius)){n=!0;break}n?i=r=0:(i=e.radius*e.radius*Math.PI,o.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-d,y:e.y+e.radius},width:2*e.radius,large:!0,sweep:!0}))}return r/=2,e&&(e.area=i+r,e.arcArea=i,e.polygonArea=r,e.arcs=o,e.innerPoints=s,e.intersectionPoints=n),i+r}function g(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function x(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}function p(t,e,n){if(n>=t+e)return 0;if(n<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(n*n-t*t+e*e)/(2*n);return g(t,t-(n*n-e*e+t*t)/(2*n))+g(e,s)}function m(t,e){const n=x(t,e),s=t.radius,i=e.radius;if(n>=s+i||n<=Math.abs(s-i))return[];const r=(s*s-i*i+n*n)/(2*n),o=Math.sqrt(s*s-r*r),a=t.x+r*(e.x-t.x)/n,l=t.y+r*(e.y-t.y)/n,c=-(e.y-t.y)*(o/n),h=-(e.x-t.x)*(o/n);return[{x:a+c,y:l-h},{x:a-c,y:l+h}]}function b(t){const e={x:0,y:0};for(const n of t)e.x+=n.x,e.y+=n.y;return e.x/=t.length,e.y/=t.length,e}function v(t){const e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function I(t,e){return v(t).map(()=>v(e))}function M(t,e){let n=0;for(let s=0;s<t.length;++s)n+=t[s]*e[s];return n}function k(t){return Math.sqrt(M(t,t))}function w(t,e,n){for(let s=0;s<e.length;++s)t[s]=e[s]*n}function _(t,e,n,s,i){for(let r=0;r<t.length;++r)t[r]=e*n[r]+s*i[r]}function S(t,e,n){const s=(n=n||{}).maxIterations||200*e.length,i=n.nonZeroDelta||1.05,r=n.zeroDelta||.001,o=n.minErrorDelta||1e-6,a=n.minErrorDelta||1e-5,l=void 0!==n.rho?n.rho:1,c=void 0!==n.chi?n.chi:2,h=void 0!==n.psi?n.psi:-.5,u=void 0!==n.sigma?n.sigma:.5;let f;const d=e.length,y=new Array(d+1);y[0]=e,y[0].fx=t(e),y[0].id=0;for(let n=0;n<d;++n){const s=e.slice();s[n]=s[n]?s[n]*i:r,y[n+1]=s,y[n+1].fx=t(s),y[n+1].id=n+1}function g(t){for(let e=0;e<t.length;e++)y[d][e]=t[e];y[d].fx=t.fx}const x=(t,e)=>t.fx-e.fx,p=e.slice(),m=e.slice(),b=e.slice(),v=e.slice();for(let e=0;e<s;++e){if(y.sort(x),n.history){const t=y.map(t=>{const e=t.slice();return e.fx=t.fx,e.id=t.id,e});t.sort((t,e)=>t.id-e.id),n.history.push({x:y[0].slice(),fx:y[0].fx,simplex:t})}f=0;for(let t=0;t<d;++t)f=Math.max(f,Math.abs(y[0][t]-y[1][t]));if(Math.abs(y[0].fx-y[d].fx)<o&&f<a)break;for(let t=0;t<d;++t){p[t]=0;for(let e=0;e<d;++e)p[t]+=y[e][t];p[t]/=d}const e=y[d];if(_(m,1+l,p,-l,e),m.fx=t(m),m.fx<y[0].fx)_(v,1+c,p,-c,e),v.fx=t(v),v.fx<m.fx?g(v):g(m);else if(m.fx>=y[d-1].fx){let n=!1;if(m.fx>e.fx?(_(b,1+h,p,-h,e),b.fx=t(b),b.fx<e.fx?g(b):n=!0):(_(b,1-h*l,p,h*l,e),b.fx=t(b),b.fx<m.fx?g(b):n=!0),n){if(u>=1)break;for(let e=1;e<y.length;++e)_(y[e],1-u,y[0],u,y[e]),y[e].fx=t(y[e])}}else g(m)}return y.sort(x),{fx:y[0].fx,x:y[0]}}function E(t,e,n,s,i,r,o){const a=n.fx,l=M(n.fxprime,e);let c=a,h=a,u=l,f=0;function d(h,f,d){for(let y=0;y<16;++y)if(i=(h+f)/2,_(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=M(s.fxprime,e),c>a+r*i*l||c>=d)f=i;else{if(Math.abs(u)<=-o*l)return i;u*(f-h)>=0&&(f=h),h=i,d=c}return 0}i=i||1,r=r||1e-6,o=o||.1;for(let y=0;y<10;++y){if(_(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=M(s.fxprime,e),c>a+r*i*l||y&&c>=h)return d(f,i,h);if(Math.abs(u)<=-o*l)return i;if(u>=0)return d(i,f,c);h=c,f=i,i*=2}return i}function T(t,e,n){let s={x:e.slice(),fx:0,fxprime:e.slice()},i={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let o,a,l,c=1;l=(n=n||{}).maxIterations||20*e.length,s.fx=t(s.x,s.fxprime),o=s.fxprime.slice(),w(o,s.fxprime,-1);for(let e=0;e<l;++e){if(c=E(t,o,s,i,c),n.history&&n.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:c}),c){_(r,1,i.fxprime,-1,s.fxprime);const t=M(s.fxprime,s.fxprime);_(o,Math.max(0,M(r,i.fxprime)/t),o,-1,i.fxprime),a=s,s=i,i=a}else w(o,s.fxprime,-1);if(k(s.fxprime)<=1e-5)break}return n.history&&n.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:c}),s}function z(t,e={}){e.maxIterations=e.maxIterations||500;const n=e.initialLayout||K,s=e.lossFunction||N,i=function(t,e={}){const n=e.distinct,s=t.map(t=>Object.assign({},t));function i(t){return t.join(";")}if(n){const t=new Map;for(const e of s)for(let n=0;n<e.sets.length;n++){const s=String(e.sets[n]);t.set(s,e.size+(t.get(s)||0));for(let i=n+1;i<e.sets.length;i++){const n=String(e.sets[i]),r=`${s};${n}`,o=`${n};${s}`;t.set(r,e.size+(t.get(r)||0)),t.set(o,e.size+(t.get(o)||0))}}for(const e of s)e.sets.length<3&&(e.size=t.get(i(e.sets)))}const r=[],o=new Set;for(const t of s)if(1===t.sets.length)r.push(t.sets[0]);else if(2===t.sets.length){const e=t.sets[0],n=t.sets[1];o.add(i(t.sets)),o.add(i([n,e]))}r.sort((t,e)=>t===e?0:t<e?-1:1);for(let t=0;t<r.length;++t){const e=r[t];for(let n=t+1;n<r.length;++n){const t=r[n];o.has(i([e,t]))||s.push({sets:[e,t],size:0})}}return s}(t,e),r=n(i,e),o=Object.keys(r),a=[];for(const t of o)a.push(r[t].x),a.push(r[t].y);const l=S(t=>{const e={};for(let n=0;n<o.length;++n){const s=o[n];e[s]={x:t[2*n],y:t[2*n+1],radius:r[s].radius}}return s(e,i)},a,e).x;for(let t=0;t<o.length;++t){const e=o[t];r[e].x=l[2*t],r[e].y=l[2*t+1]}return r}const A=1e-10;function R(t,e,n){return Math.min(t,e)*Math.min(t,e)*Math.PI<=n+1e-10?Math.abs(t-e):function(t,e,n,s){const i=(s=s||{}).maxIterations||100,r=s.tolerance||1e-10,o=t(e),a=t(n);let l=n-e;if(o*a>0)throw"Initial bisect points must have opposite signs";if(0===o)return e;if(0===a)return n;for(let n=0;n<i;++n){l/=2;const n=e+l,s=t(n);if(s*o>=0&&(e=n),Math.abs(l)<r||0===s)return n}return e+l}(s=>p(t,e,s)-n,0,t+e)}function K(t,e={}){let n=function(t,e){const n=e&&e.lossFunction?e.lossFunction:N,s={},i={};for(const e of t)if(1===e.sets.length){const t=e.sets[0];s[t]={x:1e10,y:1e10,rowid:s.length,size:e.size,radius:Math.sqrt(e.size/Math.PI)},i[t]=[]}t=t.filter(t=>2===t.sets.length);for(const e of t){let t=null!=e.weight?e.weight:1;const n=e.sets[0],r=e.sets[1];e.size+A>=Math.min(s[n].size,s[r].size)&&(t=0),i[n].push({set:r,size:e.size,weight:t}),i[r].push({set:n,size:e.size,weight:t})}const r=[];function o(t,e){return e.size-t.size}Object.keys(i).forEach(t=>{let e=0;for(let n=0;n<i[t].length;++n)e+=i[t][n].size*i[t][n].weight;r.push({set:t,size:e})}),r.sort(o);const a={};function l(t){return t.set in a}function c(t,e){s[e].x=t.x,s[e].y=t.y,a[e]=!0}c({x:0,y:0},r[0].set);for(let e=1;e<r.length;++e){const a=r[e].set,u=i[a].filter(l),f=s[a];if(u.sort(o),0===u.length)throw"ERROR: missing pairwise overlap information";const d=[];for(var h=0;h<u.length;++h){const t=s[u[h].set],e=R(f.radius,t.radius,u[h].size);d.push({x:t.x+e,y:t.y}),d.push({x:t.x-e,y:t.y}),d.push({y:t.y+e,x:t.x}),d.push({y:t.y-e,x:t.x});for(let n=h+1;n<u.length;++n){const i=s[u[n].set],r=R(f.radius,i.radius,u[n].size),o=m({x:t.x,y:t.y,radius:e},{x:i.x,y:i.y,radius:r});d.push(...o)}}let y=1e50,g=d[0];for(const e of d){s[a].x=e.x,s[a].y=e.y;const i=n(s,t);i<y&&(y=i,g=e)}c(g,a)}return s}(t,e);const s=e.lossFunction||N;if(t.length>=8){const i=function(t,e={}){const n=e.restarts||10,s=[],i={};for(const e of t)1===e.sets.length&&(i[e.sets[0]]=s.length,s.push(e));let{distances:r,constraints:o}=function(t,e,n){const s=I(e.length,e.length),i=I(e.length,e.length);return t.filter(t=>2===t.sets.length).forEach(t=>{const r=n[t.sets[0]],o=n[t.sets[1]],a=R(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[o].size/Math.PI),t.size);s[r][o]=s[o][r]=a;let l=0;t.size+1e-10>=Math.min(e[r].size,e[o].size)?l=1:t.size<=1e-10&&(l=-1),i[r][o]=i[o][r]=l}),{distances:s,constraints:i}}(t,s,i);const a=k(r.map(k))/r.length;r=r.map(t=>t.map(t=>t/a));const l=(t,e)=>function(t,e,n,s){for(let t=0;t<e.length;++t)e[t]=0;let i=0;for(let r=0;r<n.length;++r){const o=t[2*r],a=t[2*r+1];for(let l=r+1;l<n.length;++l){const c=t[2*l],h=t[2*l+1],u=n[r][l],f=s[r][l],d=(c-o)*(c-o)+(h-a)*(h-a),y=Math.sqrt(d),g=d-u*u;f>0&&y<=u||f<0&&y>=u||(i+=2*g*g,e[2*r]+=4*g*(o-c),e[2*r+1]+=4*g*(a-h),e[2*l]+=4*g*(c-o),e[2*l+1]+=4*g*(h-a))}}return i}(t,e,r,o);let c=null;for(let t=0;t<n;++t){const t=T(l,v(2*r.length).map(Math.random),e);(!c||t.fx<c.fx)&&(c=t)}const h=c.x,u={};for(let t=0;t<s.length;++t){const e=s[t];u[e.sets[0]]={x:h[2*t]*a,y:h[2*t+1]*a,radius:Math.sqrt(e.size/Math.PI)}}if(e.history)for(const t of e.history)w(t.x,a);return u}(t,e);s(i,t)+1e-8<s(n,t)&&(n=i)}return n}function N(t,e){let n=0;for(const s of e){if(1===s.sets.length)continue;let e;if(2===s.sets.length){const n=t[s.sets[0]],i=t[s.sets[1]];e=p(n.radius,i.radius,x(n,i))}else e=y(s.sets.map(e=>t[e]));n+=(null!=s.weight?s.weight:1)*(e-s.size)*(e-s.size)}return n}function D(t,e){let n=0;for(const s of e){if(1===s.sets.length)continue;let e;if(2===s.sets.length){const n=t[s.sets[0]],i=t[s.sets[1]];e=p(n.radius,i.radius,x(n,i))}else e=y(s.sets.map(e=>t[e]));const i=null!=s.weight?s.weight:1,r=Math.log((e+1)/(s.size+1));n+=i*r*r}return n}function O(t,e,n){if(null==n?t.sort((t,e)=>e.radius-t.radius):t.sort(n),t.length>0){const e=t[0].x,n=t[0].y;for(const s of t)s.x-=e,s.y-=n}if(2===t.length){x(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y)}if(t.length>1){const n=Math.atan2(t[1].x,t[1].y)-e,s=Math.cos(n),i=Math.sin(n);for(const e of t){const t=e.x,n=e.y;e.x=s*t-i*n,e.y=i*t+s*n}}if(t.length>2){let n=Math.atan2(t[2].x,t[2].y)-e;for(;n<0;)n+=2*Math.PI;for(;n>2*Math.PI;)n-=2*Math.PI;if(n>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(const n of t){var s=(n.x+e*n.y)/(1+e*e);n.x=2*s-n.x,n.y=2*s*e-n.y}}}}function C(t){const e=e=>({max:t.reduce((t,n)=>Math.max(t,n[e]+n.radius),Number.NEGATIVE_INFINITY),min:t.reduce((t,n)=>Math.min(t,n[e]-n.radius),Number.POSITIVE_INFINITY)});return{xRange:e("x"),yRange:e("y")}}function F(t,e,n){null==e&&(e=Math.PI/2);let s=L(t).map(t=>Object.assign({},t));const i=function(t){function e(t){return t.parent!==t&&(t.parent=e(t.parent)),t.parent}function n(t,n){const s=e(t),i=e(n);s.parent=i}t.forEach(t=>{t.parent=t});for(let e=0;e<t.length;++e)for(let s=e+1;s<t.length;++s){const i=t[e].radius+t[s].radius;x(t[e],t[s])+1e-10<i&&n(t[s],t[e])}const s=new Map;for(let n=0;n<t.length;++n){const i=e(t[n]).parent.setid;s.has(i)||s.set(i,[]),s.get(i).push(t[n])}return t.forEach(t=>{delete t.parent}),Array.from(s.values())}(s);for(const t of i){O(t,e,n);const s=C(t);t.size=(s.xRange.max-s.xRange.min)*(s.yRange.max-s.yRange.min),t.bounds=s}i.sort((t,e)=>e.size-t.size),s=i[0];let r=s.bounds;const o=(r.xRange.max-r.xRange.min)/50;function a(t,e,n){if(!t)return;const i=t.bounds;let a,l;if(e)a=r.xRange.max-i.xRange.min+o;else{a=r.xRange.max-i.xRange.max;const t=(i.xRange.max-i.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;t<0&&(a+=t)}if(n)l=r.yRange.max-i.yRange.min+o;else{l=r.yRange.max-i.yRange.max;const t=(i.yRange.max-i.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;t<0&&(l+=t)}for(const e of t)e.x+=a,e.y+=l,s.push(e)}let l=1;for(;l<i.length;)a(i[l],!0,!1),a(i[l+1],!1,!0),a(i[l+2],!0,!0),l+=3,r=C(s);return j(s)}function $(t,e,n,s,i){const r=L(t);e-=2*s,n-=2*s;const{xRange:o,yRange:a}=C(r);if(o.max===o.min||a.max===a.min)return console.log("not scaling solution: zero size detected"),t;let l,c;if(i){const t=2*Math.sqrt(i/Math.PI);l=e/t,c=n/t}else l=e/(o.max-o.min),c=n/(a.max-a.min);const h=Math.min(c,l),u=(e-(o.max-o.min)*h)/2,f=(n-(a.max-a.min)*h)/2;return j(r.map(t=>({radius:h*t.radius,x:s+u+(t.x-o.min)*h,y:s+f+(t.y-a.min)*h,setid:t.setid})))}function j(t){const e={};for(const n of t)e[n.setid]=n;return e}function L(t){return Object.keys(t).map(e=>Object.assign(t[e],{setid:e}))}function P(t={}){let e=!1,n=600,s=350,i=15,r=1e3,o=Math.PI/2,a=!0,l=null,c=!0,h=!0,u=null,f=null,d=!1,y=null,g=!(!t||!t.symmetricalTextCentre)&&t.symmetricalTextCentre,x={},p=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],m=0,b=function(t){if(t in x)return x[t];var e=x[t]=p[m];return m+=1,m>=p.length&&(m=0),e},v=z,I=N;function M(x){let p=x.datum();const m=new Set;p.forEach(t=>{0==t.size&&1==t.sets.length&&m.add(t.sets[0])}),p=p.filter(t=>!t.sets.some(t=>m.has(t)));let M={},k={};if(p.length>0){let t=v(p,{lossFunction:I,distinct:d});a&&(t=F(t,o,f)),M=$(t,n,s,i,l),k=V(M,p,g)}const w={};function _(t){return t.sets in w?w[t.sets]:1==t.sets.length?""+t.sets[0]:void 0}p.forEach(t=>{t.label&&(w[t.sets]=t.label)}),x.selectAll("svg").data([M]).enter().append("svg");const S=x.select("svg");e?S.attr("viewBox",`0 0 ${n} ${s}`):S.attr("width",n).attr("height",s);const E={};let T=!1;function z(t){return e=>Y(t.sets.map(t=>{let i=E[t],r=M[t];return i||(i={x:n/2,y:s/2,radius:1}),r||(r={x:n/2,y:s/2,radius:1}),{x:i.x*(1-e)+r.x*e,y:i.y*(1-e)+r.y*e,radius:i.radius*(1-e)+r.radius*e}}),y)}S.selectAll(".venn-area path").each(function(t){const e=this.getAttribute("d");1==t.sets.length&&e&&!d&&(T=!0,E[t.sets[0]]=function(t){const e=t.split(" ");return{x:Number.parseFloat(e[1]),y:Number.parseFloat(e[2]),radius:-Number.parseFloat(e[4])}}(e))});const A=S.selectAll(".venn-area").data(p,t=>t.sets),R=A.enter().append("g").attr("class",t=>`venn-area venn-${1==t.sets.length?"circle":"intersection"}${t.colour||t.color?" venn-coloured":""}`).attr("data-venn-sets",t=>t.sets.join("_")),K=R.append("path"),N=R.append("text").attr("class","label").text(t=>_(t)).attr("text-anchor","middle").attr("dy",".35em").attr("x",n/2).attr("y",s/2);function D(t){return"function"==typeof t.transition?t.transition("venn").duration(r):t}h&&(K.style("fill-opacity","0").filter(t=>1==t.sets.length).style("fill",t=>t.colour?t.colour:t.color?t.color:b(t.sets)).style("fill-opacity",".25"),N.style("fill",e=>e.colour||e.color?"#FFF":t.textFill?t.textFill:1==e.sets.length?b(e.sets):"#444"));let O=x;T&&"function"==typeof O.transition?(O=D(x),O.selectAll("path").attrTween("d",z)):O.selectAll("path").attr("d",t=>Y(t.sets.map(t=>M[t])),y);const C=O.selectAll("text").filter(t=>t.sets in k).text(t=>_(t)).attr("x",t=>Math.floor(k[t.sets].x)).attr("y",t=>Math.floor(k[t.sets].y));c&&(T?"on"in C?C.on("end",U(M,_)):C.each("end",U(M,_)):C.each(U(M,_)));const j=D(A.exit()).remove();"function"==typeof A.transition&&j.selectAll("path").attrTween("d",z);const L=j.selectAll("text").attr("x",n/2).attr("y",s/2);return null!==u&&(N.style("font-size","0px"),C.style("font-size",u),L.style("font-size","0px")),{circles:M,textCentres:k,nodes:A,enter:R,update:O,exit:j}}return M.wrap=function(t){return arguments.length?(c=t,M):c},M.useViewBox=function(){return e=!0,M},M.width=function(t){return arguments.length?(n=t,M):n},M.height=function(t){return arguments.length?(s=t,M):s},M.padding=function(t){return arguments.length?(i=t,M):i},M.distinct=function(t){return arguments.length?(d=t,M):d},M.colours=function(t){return arguments.length?(b=t,M):b},M.colors=function(t){return arguments.length?(b=t,M):b},M.fontSize=function(t){return arguments.length?(u=t,M):u},M.round=function(t){return arguments.length?(y=t,M):y},M.duration=function(t){return arguments.length?(r=t,M):r},M.layoutFunction=function(t){return arguments.length?(v=t,M):v},M.normalize=function(t){return arguments.length?(a=t,M):a},M.scaleToFit=function(t){return arguments.length?(l=t,M):l},M.styled=function(t){return arguments.length?(h=t,M):h},M.orientation=function(t){return arguments.length?(o=t,M):o},M.orientationOrder=function(t){return arguments.length?(f=t,M):f},M.lossFunction=function(t){return arguments.length?(I="default"===t?N:"logRatio"===t?D:t,M):I},M}function U(t,e){return function(n){const s=this,i=t[n.sets[0]].radius||50,r=e(n)||"",o=r.split(/\s+/).reverse(),a=(r.length+o.length)/3;let l=o.pop(),c=[l],h=0;s.textContent=null;const u=[];function f(t){const e=s.ownerDocument.createElementNS(s.namespaceURI,"tspan");return e.textContent=t,u.push(e),s.append(e),e}let d=f(l);for(;l=o.pop(),l;){c.push(l);const t=c.join(" ");d.textContent=t,t.length>a&&d.getComputedTextLength()>i&&(c.pop(),d.textContent=c.join(" "),c=[l],d=f(l),h++)}const y=.35-1.1*h/2,g=s.getAttribute("x"),x=s.getAttribute("y");u.forEach((t,e)=>{t.setAttribute("x",g),t.setAttribute("y",x),t.setAttribute("dy",`${y+1.1*e}em`)})}}function q(t,e,n){let s=e[0].radius-x(e[0],t);for(let n=1;n<e.length;++n){const i=e[n].radius-x(e[n],t);i<=s&&(s=i)}for(let e=0;e<n.length;++e){const i=x(n[e],t)-n[e].radius;i<=s&&(s=i)}return s}function B(t,e,n){const s=[];for(const e of t)s.push({x:e.x,y:e.y}),s.push({x:e.x+e.radius/2,y:e.y}),s.push({x:e.x-e.radius/2,y:e.y}),s.push({x:e.x,y:e.y+e.radius/2}),s.push({x:e.x,y:e.y-e.radius/2});let i=s[0],r=q(s[0],t,e);for(let n=1;n<s.length;++n){const o=q(s[n],t,e);o>=r&&(i=s[n],r=o)}const o=S(n=>-1*q({x:n[0],y:n[1]},t,e),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,a={x:n?0:o[0],y:o[1]};let l=!0;for(const e of t)if(x(a,e)>e.radius){l=!1;break}for(const t of e)if(x(a,t)<t.radius){l=!1;break}if(l)return a;if(1==t.length)return{x:t[0].x,y:t[0].y};const c={};return y(t,c),0===c.arcs.length?{x:0,y:-1e3,disjoint:!0}:1==c.arcs.length?{x:c.arcs[0].circle.x,y:c.arcs[0].circle.y}:e.length?B(t,[]):b(c.arcs.map(t=>t.p1))}function G(t){const e={},n=Object.keys(t);for(const t of n)e[t]=[];for(let s=0;s<n.length;s++){const i=n[s],r=t[i];for(let o=s+1;o<n.length;++o){const s=n[o],a=t[s],l=x(r,a);l+a.radius<=r.radius+1e-10?e[s].push(i):l+r.radius<=a.radius+1e-10&&e[i].push(s)}}return e}function V(t,e,n){const s={},i=G(t);for(let r=0;r<e.length;++r){const o=e[r].sets,a={},l={};for(let t=0;t<o.length;++t){a[o[t]]=!0;const e=i[o[t]];for(let t=0;t<e.length;++t)l[e[t]]=!0}const c=[],h=[];for(let e in t)e in a?c.push(t[e]):e in l||h.push(t[e]);const u=B(c,h,n);s[o]=u,u.disjoint&&e[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return s}function W(t){if(0===t.length)return[];const e={};return y(t,e),e.arcs}function X(t,e){if(0===t.length)return"M 0 0";const n=Math.pow(10,e||0),s=null!=e?t=>Math.round(t*n)/n:t=>t;if(1==t.length){const e=t[0].circle;return function(t,e,n){const s=[];return s.push("\nM",t,e),s.push("\nm",-n,0),s.push("\na",n,n,0,1,0,2*n,0),s.push("\na",n,n,0,1,0,2*-n,0),s.join(" ")}(s(e.x),s(e.y),s(e.radius))}const i=["\nM",s(t[0].p2.x),s(t[0].p2.y)];for(const e of t){const t=s(e.circle.radius);i.push("\nA",t,t,0,e.large?1:0,e.sweep?1:0,s(e.p1.x),s(e.p1.y))}return i.join(" ")}function Y(t,e){return X(W(t),e)}var Z=n(61057),H=function(){var t=(0,o.K)(function(t,e,n,s){for(n=n||{},s=t.length;s--;n[t[s]]=e);return n},"o"),e=[5,8],n=[7,8,11,12,17,19,22,24],s=[1,17],i=[1,18],r=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],a=[1,31],l=[1,39],c=[7,8,11,12,17,19,22,24,27],h=[1,57],u=[1,56],f=[1,58],d=[1,59],y=[1,60],g=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],x={trace:(0,o.K)(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:(0,o.K)(function(t,e,n,s,i,r,o){var a=r.length-1;switch(i){case 1:return r[a-1];case 2:case 3:case 4:case 6:this.$=[];break;case 5:case 35:r[a-1].push(r[a]),this.$=r[a-1];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:case 43:case 44:this.$=r[a];break;case 8:s.setDiagramTitle(r[a].substr(6)),this.$=r[a].substr(6);break;case 9:s.addSubsetData([r[a]],void 0,void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 10:s.addSubsetData([r[a-1]],r[a],void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 11:s.addSubsetData([r[a-2]],void 0,parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 12:s.addSubsetData([r[a-3]],r[a-2],parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 13:if(r[a].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a]),s.addSubsetData(r[a],void 0,void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 14:if(r[a-1].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-1]),s.addSubsetData(r[a-1],r[a],void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 15:if(r[a-2].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-2]),s.addSubsetData(r[a-2],void 0,parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 16:if(r[a-3].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-3]),s.addSubsetData(r[a-3],r[a-2],parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 17:case 18:case 19:s.addTextData(r[a-1],r[a],void 0);break;case 20:case 21:s.addTextData(r[a-2],r[a-1],r[a]);break;case 23:s.addStyleData(r[a-1],r[a]);break;case 24:case 25:case 26:if(!(l=s.getCurrentSets()))throw new Error("text requires set");s.addTextData(l,r[a],void 0);break;case 27:case 28:var l;if(!(l=s.getCurrentSets()))throw new Error("text requires set");s.addTextData(l,r[a-1],r[a]);break;case 29:case 41:case 34:this.$=[r[a]];break;case 30:case 42:this.$=[...r[a-2],r[a]];break;case 31:this.$=[r[a-2],r[a]];break;case 33:this.$=r[a].join(" ")}},"anonymous"),table:[t(e,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(n,[2,4],{6:5}),t(e,[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]},t(n,[2,5]),t(n,[2,6]),t(n,[2,7]),t(n,[2,8]),{13:16,20:s,21:i},{13:20,18:19,20:s,21:i},{13:20,18:21,20:s,21:i},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:s,21:i},t(n,[2,9],{14:[1,27],15:[1,28]}),t(r,[2,43]),t(r,[2,44]),t(n,[2,13],{14:[1,29],15:[1,30],27:a}),t(r,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:a},t(n,[2,22]),t(n,[2,24],{14:[1,35]}),t(n,[2,25],{14:[1,36]}),t(n,[2,26]),{20:l,25:37,26:38,27:a},t(n,[2,10],{15:[1,40]}),{16:[1,41]},t(n,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:s,21:i},t(n,[2,17],{14:[1,45]}),t(n,[2,18],{14:[1,46]}),t(n,[2,19]),t(n,[2,27]),t(n,[2,28]),t(n,[2,23],{27:[1,47]}),t(c,[2,29]),{15:[1,48]},{16:[1,49]},t(n,[2,11]),{16:[1,50]},t(n,[2,15]),t(r,[2,42]),t(n,[2,20]),t(n,[2,21]),{20:l,26:51},{16:h,20:u,21:[1,53],28:52,29:54,30:55,31:f,32:d,33:y},t(n,[2,12]),t(n,[2,16]),t(c,[2,30]),t(c,[2,31]),t(c,[2,32]),t(c,[2,33],{30:61,16:h,20:u,31:f,32:d,33:y}),t(g,[2,34]),t(g,[2,36]),t(g,[2,37]),t(g,[2,38]),t(g,[2,39]),t(g,[2,40]),t(g,[2,35])],defaultActions:{6:[2,1]},parseError:(0,o.K)(function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},"parseError"),parse:(0,o.K)(function(t){var e=this,n=[0],s=[],i=[null],r=[],a=this.table,l="",c=0,h=0,u=0,f=r.slice.call(arguments,1),d=Object.create(this.lexer),y={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(y.yy[g]=this.yy[g]);d.setInput(t,y.yy),y.yy.lexer=d,y.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var x=d.yylloc;r.push(x);var p=d.options&&d.options.ranges;function m(){var t;return"number"!=typeof(t=s.pop()||d.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,(0,o.K)(function(t){n.length=n.length-2*t,i.length=i.length-t,r.length=r.length-t},"popStack"),(0,o.K)(m,"lex");for(var b,v,I,M,k,w,_,S,E,T={};;){if(I=n[n.length-1],this.defaultActions[I]?M=this.defaultActions[I]:(null==b&&(b=m()),M=a[I]&&a[I][b]),void 0===M||!M.length||!M[0]){var z="";for(w in E=[],a[I])this.terminals_[w]&&w>2&&E.push("'"+this.terminals_[w]+"'");z=d.showPosition?"Parse error on line "+(c+1)+":\n"+d.showPosition()+"\nExpecting "+E.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==b?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(z,{text:d.match,token:this.terminals_[b]||b,line:d.yylineno,loc:x,expected:E})}if(M[0]instanceof Array&&M.length>1)throw new Error("Parse Error: multiple actions possible at state: "+I+", token: "+b);switch(M[0]){case 1:n.push(b),i.push(d.yytext),r.push(d.yylloc),n.push(M[1]),b=null,v?(b=v,v=null):(h=d.yyleng,l=d.yytext,c=d.yylineno,x=d.yylloc,u>0&&u--);break;case 2:if(_=this.productions_[M[1]][1],T.$=i[i.length-_],T._$={first_line:r[r.length-(_||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(_||1)].first_column,last_column:r[r.length-1].last_column},p&&(T._$.range=[r[r.length-(_||1)].range[0],r[r.length-1].range[1]]),void 0!==(k=this.performAction.apply(T,[l,h,c,y.yy,M[1],i,r].concat(f))))return k;_&&(n=n.slice(0,-1*_*2),i=i.slice(0,-1*_),r=r.slice(0,-1*_)),n.push(this.productions_[M[1]][0]),i.push(T.$),r.push(T._$),S=a[n[n.length-2]][n[n.length-1]],n.push(S);break;case 3:return!0}}return!0},"parse")},p=function(){return{EOF:1,parseError:(0,o.K)(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:(0,o.K)(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:(0,o.K)(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:(0,o.K)(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===s.length?this.yylloc.first_column:0)+s[s.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:(0,o.K)(function(){return this._more=!0,this},"more"),reject:(0,o.K)(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:(0,o.K)(function(t){this.unput(this.match.slice(t))},"less"),pastInput:(0,o.K)(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:(0,o.K)(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:(0,o.K)(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:(0,o.K)(function(t,e){var n,s,i;if(this.options.backtrack_lexer&&(i={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&&(i.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in i)this[r]=i[r];return!1}return!1},"test_match"),next:(0,o.K)(function(){if(this.done)return this.EOF;var t,e,n,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),r=0;r<i.length;r++)if((n=this._input.match(this.rules[i[r]]))&&(!e||n[0].length>e[0].length)){if(e=n,s=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:(0,o.K)(function(){var t=this.next();return t||this.lex()},"lex"),begin:(0,o.K)(function(t){this.conditionStack.push(t)},"begin"),popState:(0,o.K)(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:(0,o.K)(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:(0,o.K)(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:(0,o.K)(function(t){this.begin(t)},"pushState"),stateStackSize:(0,o.K)(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:(0,o.K)(function(t,e,n,s){switch(n){case 0:case 1:case 2:case 4:case 7:case 8:break;case 3:if(t.getIndentMode&&t.getIndentMode())return t.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 5:t.setIndentMode&&t.setIndentMode(!1),this.begin("INITIAL"),this.unput(e.yytext);break;case 6:return this.begin("bol"),8;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(!t.consumeIndentText)return 19;t.consumeIndentText=!1;break;case 15:return 24;case 16:return e.yytext=e.yytext.slice(2,-2),14;case 17:return e.yytext=e.yytext.slice(1,-1).trim(),14;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}}}}();function m(){this.yy={}}return x.lexer=p,(0,o.K)(m,"Parser"),m.prototype=x,x.Parser=m,new m}();H.parser=H;var J,Q=H,tt=[],et=[],nt=[],st=new Set,it=!1,rt=(0,o.K)((t,e,n)=>{const s=ft(t).sort(),i=n??10/Math.pow(t.length,2);J=s,1===s.length&&st.add(s[0]),tt.push({sets:s,size:i,label:e?at(e):void 0})},"addSubsetData"),ot=(0,o.K)(()=>tt,"getSubsetData"),at=(0,o.K)(t=>{const e=t.trim();return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e},"normalizeText"),lt=(0,o.K)(t=>t?at(t):t,"normalizeStyleValue"),ct=(0,o.K)((t,e,n)=>{const s=at(e);et.push({sets:ft(t).sort(),id:s,label:n?at(n):void 0})},"addTextData"),ht=(0,o.K)((t,e)=>{const n=ft(t).sort(),s={};for(const[t,n]of e)s[t]=lt(n)??n;nt.push({targets:n,styles:s})},"addStyleData"),ut=(0,o.K)(()=>nt,"getStyleData"),ft=(0,o.K)(t=>t.map(t=>at(t)),"normalizeIdentifierList"),dt=(0,o.K)(t=>{const e=ft(t).filter(t=>!st.has(t));if(e.length>0)throw new Error(`unknown set identifier: ${e.join(", ")}`)},"validateUnionIdentifiers"),yt=(0,o.K)(()=>et,"getTextData"),gt=(0,o.K)(()=>J,"getCurrentSets"),xt=(0,o.K)(()=>it,"getIndentMode"),pt=(0,o.K)(t=>{it=t},"setIndentMode"),mt=r.UI.venn;function bt(){return(0,i.$t)(mt,(0,r.zj)().venn)}(0,o.K)(bt,"getConfig");var vt={getConfig:bt,clear:(0,o.K)(()=>{(0,r.IU)(),tt.length=0,et.length=0,nt.length=0,st.clear(),J=void 0,it=!1},"customClear"),setAccTitle:r.SV,getAccTitle:r.iN,setDiagramTitle:r.ke,getDiagramTitle:r.ab,getAccDescription:r.m7,setAccDescription:r.EI,addSubsetData:rt,getSubsetData:ot,addTextData:ct,addStyleData:ht,validateUnionIdentifiers:dt,getTextData:yt,getStyleData:ut,getCurrentSets:gt,getIndentMode:xt,setIndentMode:pt},It=(0,o.K)(t=>`\n .venn-title {\n font-size: 32px;\n fill: ${t.vennTitleTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-circle text {\n font-size: 48px;\n font-family: ${t.fontFamily};\n }\n\n .venn-intersection text {\n font-size: 48px;\n fill: ${t.vennSetTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-text-node {\n font-family: ${t.fontFamily};\n color: ${t.vennSetTextColor};\n }\n`,"getStyles");function Mt(t){const e=new Map;for(const n of t){const t=n.targets.join("|"),s=e.get(t);s?Object.assign(s,n.styles):e.set(t,{...n.styles})}return e}(0,o.K)(Mt,"buildStyleByKey");var kt=(0,o.K)((t,e,n,i)=>{const o=i.db,c=o.getConfig?.(),{themeVariables:d,look:y,handDrawnSeed:g}=(0,r.zj)(),x="handDrawn"===y,p=[d.venn1,d.venn2,d.venn3,d.venn4,d.venn5,d.venn6,d.venn7,d.venn8].filter(Boolean),m=o.getDiagramTitle?.(),b=o.getSubsetData(),v=o.getTextData(),I=Mt(o.getStyleData()),M=St(b),k=c?.width??800,w=c?.height??450,_=k/1600,S=m?48*_:0,E=d.primaryTextColor??d.textColor,T=(0,s.D)(e);T.attr("viewBox",`0 0 ${k} ${w}`),m&&T.append("text").text(m).attr("class","venn-title").attr("font-size",32*_+"px").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*_).style("fill",d.vennTitleTextColor||d.titleColor);const A=(0,a.Ltv)(document.createElement("div")),R=P().width(k).height(w-S);A.datum(M).call(R);const K=x?Z.A.svg(A.select("svg").node()):void 0,O=function(t,e={}){const{lossFunction:n,layoutFunction:s=z,normalize:i=!0,orientation:r=Math.PI/2,orientationOrder:o,width:a=600,height:l=350,padding:c=15,scaleToFit:h=!1,symmetricalTextCentre:u=!1,distinct:f,round:d=2}=e;let y=s(t,{lossFunction:"default"!==n&&n?"logRatio"===n?D:n:N,distinct:f});i&&(y=F(y,r,o));const g=$(y,a,l,c,h),x=V(g,t,u),p=new Map(Object.keys(g).map(t=>[t,{set:t,x:g[t].x,y:g[t].y,radius:g[t].radius}])),m=t.map(t=>{const e=t.sets.map(t=>p.get(t)),n=W(e);return{circles:e,arcs:n,path:X(n,d),area:t,has:new Set(t.sets)}});function b(t){let e="";for(const n of m)n.has.size>t.length&&t.every(t=>n.has.has(t))&&(e+=" "+n.path);return e}return m.map(({circles:t,arcs:e,path:n,area:s})=>({data:s,text:x[s.sets],circles:t,arcs:e,path:n,distinctPath:n+b(s.sets)}))}(M,{width:k,height:w-S,padding:c?.padding??15}),C=new Map;for(const t of O){const e=wt([...t.data.sets].sort());C.set(e,t)}v.length>0&&_t(c,C,A,v,_,I);const j=(0,l.A)(d.background||"#f4f4f4");A.selectAll(".venn-circle").each(function(t,e){const n=(0,a.Ltv)(this),s=wt([...t.sets].sort()),i=I.get(s),r=i?.fill||p[e%p.length]||d.primaryColor;n.classed("venn-set-"+e%8,!0);const o=i?.["fill-opacity"]??.1,l=i?.stroke||r,c=i?.["stroke-width"]||""+5*_;if(x&&K){const t=C.get(s);if(t&&t.circles.length>0){const s=t.circles[0],i=K.circle(s.x,s.y,2*s.radius,{roughness:.7,seed:g,fill:h(r,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:60*e-41,stroke:l,strokeWidth:parseFloat(String(c))});n.select("path").remove(),n.node()?.insertBefore(i,n.select("text").node())}}else n.select("path").style("fill",r).style("fill-opacity",o).style("stroke",l).style("stroke-width",c).style("stroke-opacity",.95);const y=i?.color||(j?(0,u.A)(r,30):(0,f.A)(r,30));n.select("text").style("font-size",48*_+"px").style("fill",y)}),x&&K?A.selectAll(".venn-intersection").each(function(t){const e=(0,a.Ltv)(this),n=wt([...t.sets].sort()),s=I.get(n),i=s?.fill;if(i){const t=e.select("path"),n=t.attr("d");if(n){const e=K.path(n,{roughness:.7,seed:g,fill:h(i,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),s=t.node();s?.parentNode?.insertBefore(e,s),t.remove()}}else e.select("path").style("fill-opacity",0);e.select("text").style("font-size",48*_+"px").style("fill",s?.color??d.vennSetTextColor??E)}):(A.selectAll(".venn-intersection text").style("font-size",48*_+"px").style("fill",t=>{const e=wt([...t.sets].sort());return I.get(e)?.color??d.vennSetTextColor??E}),A.selectAll(".venn-intersection path").style("fill-opacity",t=>{const e=wt([...t.sets].sort());return I.get(e)?.fill?1:0}).style("fill",t=>{const e=wt([...t.sets].sort());return I.get(e)?.fill??"transparent"}));const L=T.append("g").attr("transform",`translate(0, ${S})`),U=A.select("svg").node();if(U&&"childNodes"in U)for(const t of[...U.childNodes])L.node()?.appendChild(t);(0,r.a$)(T,w,k,c?.useMaxWidth??!0)},"draw");function wt(t){return t.join("|")}function _t(t,e,n,s,i,r){const o=t?.useDebugLayout??!1,a=n.select("svg").append("g").attr("class","venn-text-nodes"),l=new Map;for(const t of s){const e=wt(t.sets),n=l.get(e);n?n.push(t):l.set(e,[t])}for(const[t,n]of l.entries()){const s=e.get(t);if(!s?.text)continue;const l=s.text.x,c=s.text.y,h=Math.min(...s.circles.map(t=>t.radius)),u=Math.min(...s.circles.map(t=>t.radius-Math.hypot(l-t.x,c-t.y)));let f=Number.isFinite(u)?Math.max(0,u):0;0===f&&Number.isFinite(h)&&(f=.6*h);const d=a.append("g").attr("class","venn-text-area").attr("font-size",40*i+"px");o&&d.append("circle").attr("class","venn-text-debug-circle").attr("cx",l).attr("cy",c).attr("r",f).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);const y=Math.max(80*i,2*f*.95),g=Math.max(60*i,2*f*.95),x=(s.data.label&&s.data.label.length>0?Math.min(32*i,.25*f):0)+(n.length<=2?30*i:0),p=l-y/2,m=c-g/2+x,b=Math.max(1,Math.ceil(Math.sqrt(n.length))),v=y/b,I=g/Math.max(1,Math.ceil(n.length/b));for(const[t,e]of n.entries()){const n=t%b,s=Math.floor(t/b),a=p+v*(n+.5),l=m+I*(s+.5);o&&d.append("rect").attr("class","venn-text-debug-cell").attr("x",p+v*n).attr("y",m+I*s).attr("width",v).attr("height",I).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);const c=.9*v,h=.9*I,u=d.append("foreignObject").attr("class","venn-text-node-fo").attr("width",c).attr("height",h).attr("x",a-c/2).attr("y",l-h/2).attr("overflow","visible"),f=r.get(e.id)?.color,y=u.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(e.label??e.id);f&&y.style("color",f)}}}function St(t){const e=new Set(t.map(t=>[...t.sets].sort().join("|"))),n=new Map(t.filter(t=>1===t.sets.length&&void 0!==t.size).map(t=>[t.sets[0],t.size])),s=[];for(const i of t){if(i.sets.length<3)continue;const t=[...i.sets].sort();for(let i=0;i<t.length-1;i++)for(let r=i+1;r<t.length;r++){const o=[t[i],t[r]],a=o.join("|");if(!e.has(a)){e.add(a);const t=n.get(o[0]),i=n.get(o[1]),r=void 0!==t&&void 0!==i?Math.min(t,i)/4:2.5;s.push({sets:o,size:r,label:""})}}}return s.length>0?[...t,...s]:t}(0,o.K)(wt,"stableSetsKey"),(0,o.K)(_t,"renderTextNodes"),(0,o.K)(St,"ensurePairwiseSubsets");var Et={parser:Q,db:vt,renderer:{draw:kt},styles:It}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4004,6010],{83277(e,s,t){t.d(s,{$j:()=>o,CP:()=>a,Lv:()=>n,cL:()=>i});class n{token;open=!1;note;index;url;model;request_type;json_params;sys_prompt;dotenv="";tool_mode=!1;show_options;static get_label_by_v(e,s){if(!e||!s?.length)return e;for(const t of s)if(t.value===e)return t.label;return e}static have_label_by_v(e,s){if(!e||!s?.length)return!1;for(const t of s)if(t.value===e)return!0;return!1}}const a='\n\n\n\n# 聊天循环最大次数\ntool_call_max=500\n# 是否允许AI直接执行命令而不需要用户确认,默认为false,需要用户手动确认,如果使用 workflow 这里等价于为 true\nallow_exec_cmd_directly=false\n\n# 可选的代理 url,如果指定了所有访问大模型的请求将会走代理\n#proxy_url=\n\n# 可选的多个url 以数组分割\n# options_agent_url_list=[{"value":"http://..","label":"openai"}]\n\n# 可选的多个 key\n# options_agent_key_list=[{"value":"sh-aaa","label":"option1"}]\n\n# 可选的多个 model\n# options_agent_model_list=[{"value":"gpt-5.5","label":"gpt"}]\n\n# 存放本地的 prompt 文件 用于每次聊天的时候自动读取并加载\n# options_local_file_path_prompt_list=["/prompt/a.txt"]\n\n# 开启切换模型 ,开启以后,你可以自己写 prompt 提供多个模型让 ai 自己根据每次聊天切换下一步调用其他模型的次数\n# open_pick_model=false\n\n# 压缩后仍然完整保留的最近消息数\nmax_recent_messages=12\n# 当单个会话累计消息条数超过该值时,触发历史消息裁剪\ncompress_message_count=16\n# 历史消息中 tool 输出的最大字符数,只保留调用形式让 AI 知道调用了就行\nmax_tool_content_chars=200\n\n# ===== 模型类型(request_type)=====\n# 必填项,不同类型的 model 接口格式不同,默认 completions。\n# 可选值:\n# completions 标准对话/聊天补全 (chat/completions)\n# images 图片生成 (images/generations)\n# audio_speech 文本转语音 (audio/speech)\n# audio_transcription 语音转文字 (audio/transcriptions)\n# audio_translation 语音翻译 (audio/translations)\n# embeddings 向量嵌入 (embeddings)\n#request_type=completions\n\n# ===== 成为 tool(tool_mode)=====\n# 开启后该模型会作为一个工具被加载,可实现不同模型担任不同角色/能力,供 AI agent 在对话中动态调用。\n# 注意:不能与「是否开启」(open) 同时为 true。\n#tool_mode=false\n\n# ===== 是否支持图片(support_image)=====\n# 开启后:1) 注册 read_image 工具,让 AI 能读取本地图片;\n# 2) 工具读到的图片会以 OpenAI 多模态格式 image_url 随消息发给模型,模型就能真正"看图"。\n# 关闭后:AI 看不到图片,read_image 只会返回一句文字说明。\n# 主流模型(gpt-4o、豆包、qwen-vl、deepseek-vl 等)都支持,默认开启。\nsupport_image=true\n';const i=JSON.stringify({stream:!0,thinking:{type:"disabled"}});function o(e){return"string"==typeof e?e:Array.isArray(e)?e.map(e=>"text"===e.type?e.text:"[图片]").join("\n"):""}},95733(e,s,t){t.r(s),t.d(s,{default:()=>ne});var n=t(96540),a=t(34843),i=t(22022),o=t(52671),c=t(92275),r=t(14284),l=t(7463),d=t(64694),u=t(78247),m=t(40505),h=t(62042),g=t(45907),p=t(53459),_=t(72693),x=t(82893),f=t(61443),j=t(83277);function v(e){return null==e||e<0?"0":e.toLocaleString()}function b(e){const s=[];if(e.attachments?.length&&s.push(e.attachments.map(e=>`[附件] ${e.name}`).join("\n")),e.content_list?.length)for(const t of e.content_list){const e=(0,j.$j)(t.content);if(e&&s.push(e),t.tool_call_ends?.length){const e=t.tool_call_ends.map(e=>{const s=e.tool_display_name||e.tool_name;return e.success?`[工具] ${s} 成功`:`[工具] ${s} 失败`});s.push(e.join("\n"))}}return e.text&&!s.length&&s.push(e.text),e.images?.length&&s.push(`[生成图片 ${e.images.length} 张]`),e.audio&&s.push("[音频]"),s.join("\n\n")}function w(e){const s=(0,j.$j)(e.content);if(s)return s;const t=e.content_list??[];return t.length?t.map(e=>(0,j.$j)(e.content)).filter(Boolean).join("\n\n"):""}function y(e=[]){return e.filter(e=>"user"===e.role||"assistant"===e.role).map((e,s)=>({id:Date.now()+s,sender:"assistant"===e.role?"bot":"user",text:w(e),attachments:e.attachments??[],content_list:e.content_list,images:e.images,audio:e.audio,embeddings:e.embeddings,elapsed_ms:e.elapsed_ms}))}const S=/\.(md|txt|json|js|jsx|ts|tsx|css|html?|xml|ya?ml|py|java|go|rs|c|cpp|h|hpp|sh|bat|cmd|ini|toml|csv|log|sql|env|gitignore|dockerfile)$/i;function N(e){return e.type?.startsWith("image/")?"image":e.type?.startsWith("text/")||S.test(e.name)?"text":"binary"}function k(e){return e.text()}function C(e){return new Promise((s,t)=>{const n=new FileReader;n.onload=()=>s(n.result),n.onerror=t,n.readAsDataURL(e)})}async function A(e){const s=[];for(const t of e){const e=N(t);let n="";if("text"===e)try{const e=await k(t),s=12e4;n=e.length>s?`${e.slice(0,s)}\n\n[内容已截断,原始长度 ${e.length} 字符]`:e}catch{n="[文本读取失败]"}else if("image"===e)try{n=await C(t)}catch{n=`[图片文件: ${t.name}]`}else n=`[二进制文件: ${t.name}]`;s.push({name:t.name,mime_type:t.type,size:t.size,kind:e,content:n})}return s}var $=t(14944);var I=t(85997),M=t(34299),R=t(74848);function D(e){const s=e.attachments&&e.attachments.length>0?(0,R.jsx)("div",{className:"chat-message-attachments",children:e.attachments.map((e,s)=>(0,R.jsxs)("div",{className:"chat-message-attachment",children:[(0,R.jsx)(I.In,{icon:"attach_file"}),(0,R.jsx)("span",{children:e.name}),(0,R.jsxs)("small",{children:[e.size," B"]})]},`${e.name}_${s}`))}):null,t=[];e.images&&"bot"===e.sender&&t.push((0,R.jsx)(n.Fragment,{children:(0,R.jsx)(V,{images:e.images,text:e.text})},"images")),e.audio&&"bot"===e.sender&&t.push((0,R.jsx)(n.Fragment,{children:(0,R.jsx)(K,{audio:e.audio,text:e.text})},"audio")),e.embeddings&&"bot"===e.sender&&t.push((0,R.jsx)(n.Fragment,{children:(0,R.jsx)(B,{embeddings:e.embeddings,text:e.text})},"embeddings"));const a=function(e){if("bot"!==e.sender||!e.content_list?.length)return e.text?(0,R.jsx)(M.default,{context:e.text}):null;return(0,R.jsxs)(R.Fragment,{children:[e.content_list.map((e,s)=>{const t=[],a=(0,j.$j)(e.content);return a&&t.push((0,R.jsx)(n.Fragment,{children:(0,R.jsx)(M.default,{context:a})},`content-${s}`)),e.tool_call_ends?.length&&t.push((0,R.jsx)(n.Fragment,{children:(0,R.jsx)(H,{callList:e.tool_call_ends})},`tool-${s}`)),(0,R.jsx)(n.Fragment,{children:t},`part-${s}`)}),!e.content_list.some(e=>e.content)&&e.text?(0,R.jsx)(M.default,{context:e.text}):null]})}(e);return 0===t.length?(0,R.jsxs)(R.Fragment,{children:[s,a]}):(0,R.jsxs)(R.Fragment,{children:[t,s,a]})}function H({callList:e}){const[s,t]=n.useState(!1);if(!e?.length)return null;e.filter(e=>e.success).length;const a=e.filter(e=>!e.success).length;return(0,R.jsxs)("div",{className:"chat-message-call-list",children:[(0,R.jsxs)("div",{className:"call-list-header",onClick:()=>t(!s),children:[(0,R.jsx)(I.In,{icon:s?"expand_less":"expand_more"}),(0,R.jsxs)("span",{className:"call-list-summary",children:["工具调用 (",e.length,")",a>0&&(0,R.jsx)("span",{className:"call-list-fail",children:" 失败 "})]})]}),s&&(0,R.jsx)("div",{className:"call-list-body",children:e.map((e,s)=>(0,R.jsxs)("div",{className:"call-list-item "+(e.success?"call-success":"call-fail"),children:[(0,R.jsxs)("div",{className:"call-list-item-header",children:[(0,R.jsx)(I.In,{icon:e.success?"check_circle":"error"}),(0,R.jsx)("span",{className:"call-list-tool-name",children:e.tool_display_name||e.tool_name}),(0,R.jsxs)("span",{className:"call-list-duration",children:[e.duration_ms,"ms"]})]}),e.tool_args&&(0,R.jsxs)("details",{className:"call-list-details",children:[(0,R.jsx)("summary",{children:"参数"}),(0,R.jsx)("pre",{className:"call-list-pre",children:JSON.stringify(e.tool_args,null,2)})]}),!e.success&&e.error&&(0,R.jsxs)("details",{className:"call-list-details",children:[(0,R.jsx)("summary",{children:"错误"}),(0,R.jsx)("pre",{className:"call-list-pre call-list-error-text",children:e.error})]}),e.success&&e.tool_result&&(0,R.jsxs)("details",{className:"call-list-details",children:[(0,R.jsx)("summary",{children:"结果"}),(0,R.jsx)("pre",{className:"call-list-pre",children:e.tool_result.length>500?e.tool_result.slice(0,500)+"...":e.tool_result})]})]},s))})]})}function V({images:e,text:s}){let t=e||[];if(!t.length&&s)try{t=JSON.parse(s).data||[]}catch{}return t.length?(0,R.jsxs)("div",{className:"image-generation-result",children:[t.map((e,s)=>(0,R.jsxs)("div",{className:"image-generation-item",children:[e.url&&(0,R.jsx)("div",{className:"image-generation-image-wrapper",children:(0,R.jsx)("img",{src:e.url,alt:e.revised_prompt||`生成的图片 ${s+1}`,loading:"lazy"})}),e.b64_json&&(0,R.jsx)("div",{className:"image-generation-image-wrapper",children:(0,R.jsx)("img",{src:`data:image/png;base64,${e.b64_json}`,alt:`生成的图片 ${s+1}`})}),e.revised_prompt&&(0,R.jsx)("p",{className:"image-generation-prompt",children:(0,R.jsx)("small",{children:e.revised_prompt})})]},s)),s&&!e&&(0,R.jsx)(M.default,{context:s})]}):(0,R.jsx)(M.default,{context:s||""})}function K({audio:e,text:s}){if(e){if(e.url)return(0,R.jsx)("div",{className:"audio-result",children:(0,R.jsx)("audio",{controls:!0,src:e.url,children:"您的浏览器不支持音频播放"})});if(e.data){const s=e.mime_type||"audio/mpeg";return(0,R.jsx)("div",{className:"audio-result",children:(0,R.jsx)("audio",{controls:!0,src:`data:${s};base64,${e.data}`,children:"您的浏览器不支持音频播放"})})}}const t=s||"";if(t.startsWith("http://")||t.startsWith("https://"))return(0,R.jsx)("div",{className:"audio-result",children:(0,R.jsx)("audio",{controls:!0,src:t,children:"您的浏览器不支持音频播放"})});try{const e=JSON.parse(t);if(e?.data||e?.audio_data){const s=e.data||e.audio_data;return(0,R.jsx)("div",{className:"audio-result",children:(0,R.jsx)("audio",{controls:!0,src:`data:audio/mpeg;base64,${s}`,children:"您的浏览器不支持音频播放"})})}}catch{}return(0,R.jsx)(M.default,{context:t})}function T({content:e,label:s}){const[t,a]=n.useState(!1);return(0,R.jsxs)("button",{className:"embeddings-copy-btn",onClick:()=>{(0,m.lW)(e),a(!0),setTimeout(()=>a(!1),1500)},children:[(0,R.jsx)(I.In,{icon:t?"check":"content_copy"}),t?"已复制":s||"复制"]})}function B({embeddings:e,text:s}){let t=e||null;if(!t&&s)try{t=JSON.parse(s)}catch{return(0,R.jsx)(M.default,{context:s})}if(!t)return(0,R.jsx)(M.default,{context:s||""});const n=t?.data||[],a=t?.usage,i=JSON.stringify(t,null,2);return(0,R.jsxs)("div",{className:"embeddings-result",children:[(0,R.jsxs)("div",{className:"embeddings-summary",children:[(0,R.jsx)("strong",{children:"向量嵌入结果"}),(0,R.jsxs)("span",{children:["维度: ",n[0]?.embedding?.length??"N/A"]}),(0,R.jsxs)("span",{children:["数量: ",n.length]}),a&&(0,R.jsxs)("span",{children:["使用 tokens: ",a.total_tokens??"N/A"]})]}),(0,R.jsxs)("div",{className:"embeddings-toolbar",children:[(0,R.jsx)(T,{content:i,label:"复制全部结果"}),n.length>0&&n[0]?.embedding&&(0,R.jsx)(T,{content:JSON.stringify(n[0].embedding,null,2),label:"复制第一条向量"}),n.length>0&&(0,R.jsx)(T,{content:JSON.stringify(n.map(e=>e.embedding),null,2),label:"复制所有向量数据"})]}),n.length>0&&n[0]?.embedding&&(0,R.jsx)("div",{className:"embeddings-preview",children:(0,R.jsxs)("span",{children:["向量预览: [",n[0].embedding.slice(0,5).join(", "),n[0].embedding.length>5?", ...":"","]"]})}),n.length>0&&(0,R.jsxs)("details",{children:[(0,R.jsx)("summary",{children:"查看详细数据"}),(0,R.jsx)("pre",{className:"embeddings-raw",children:i})]})]})}async function E(e,s,t,n){try{switch(e){case"images":{const e=await async function(e,s){const t={prompt:e,session_id:s},n=await r.jV.post("images/generations",t);if(0!==n.code)throw new Error(n.message||"图片生成失败");const a=n.data||{},i=(a.data||[]).map(e=>({url:e.url,b64_json:e.b64_json,revised_prompt:e.revised_prompt})),o=i.map((e,s)=>`![生成图片${s+1}](${e.url||`data:image/png;base64,${e.b64_json}`})${e.revised_prompt?`\n> ${e.revised_prompt}`:""}`).join("\n\n");return{session_id:a.session_id||s,images:i,text:o||`生成了 ${i.length} 张图片`}}(s,t);return e&&n(e.text,{images:e.images}),!0}case"audio_speech":{const e=await async function(e,s){const t={input:e,session_id:s};try{const e=localStorage.getItem("ai_audio_extra_params");if(e){const s=JSON.parse(e);s.voice&&(t.voice=s.voice),s.speed&&(t.speed=parseFloat(s.speed))}}catch{}const n=localStorage.getItem("token")||"",a=await fetch("/api/ai_agent/audio/speech",{method:"POST",headers:{"Content-Type":"application/json",Authorization:n},body:JSON.stringify(t)});if(!a.ok)throw new Error(`语音合成失败: ${a.statusText}`);const i=a.headers.get("X-Session-Id")||s,o=await a.arrayBuffer();return{session_id:i,audio:{data:btoa(String.fromCharCode(...Array.from(new Uint8Array(o)))),mime_type:a.headers.get("content-type")||"audio/mpeg"},text:`[音频文件: ${e.slice(0,50)}...]`}}(s,t);return e&&n(e.text,{audio:e.audio}),!0}case"embeddings":{const e=await async function(e,s){const t=await r.jV.post("embeddings",{input:e,session_id:s});if(0!==t.code)throw new Error(t.message||"Embeddings 请求失败");const n=t.data||{},a=n?.data??[],i=`向量维度: ${a[0]?.embedding?.length??0}, 数量: ${a.length}`;return{session_id:n.session_id||s,embeddings:n,text:`✅ Embeddings 结果 - ${i}\n\`\`\`json\n${JSON.stringify(n,null,2).slice(0,2e3)}\n\`\`\``}}(s,t);return e&&n(e.text,{embeddings:e.embeddings}),!0}default:return!1}}catch(e){return n(`请求失败: ${e?.message||JSON.stringify(e)}`),!0}}var z=t(4412),P=t(23430),F=t(87361),L=t(80389),O=t(7523),q=t(23496);const G=({currentModelName:e,setCurrentModelName:s,modelGroups:t,onModelChanged:c,sysPromptList:l,batchMode:d,selectedMsgCount:m,sessionVisible:g,onToggleSessionPanel:_,onCreateSession:j,onToggleBatchMode:v,onBatchDeleteMessages:b,bgProcessVisible:w,bgProcessCount:y,onToggleBgProcess:S,selectedSysPromptId:N,setSelectedSysPromptId:k,inline:C})=>{const{t:A}=(0,i.Bd)(),$=(0,o.Zp)(),{check_user_auth:M}=(0,u.MH)(),[,D]=(0,a.fp)(x.AG.ai_session_collapsed),{open:H}=function(){const{t:e}=(0,i.Bd)(),[,s]=(0,a.fp)(x.AG.prompt_card),[t,o]=(0,a.fp)(x.AG.ai_chat_zoom),{initUserInfo:c}=(0,n.useContext)(O.F);return{open:()=>{const n=t,a=()=>s({open:!1});s({open:!0,title:e("缩放调整"),context_div:(0,R.jsx)(L.p,{defaultValue:t,onChange:o,min:30,max:200}),cancel:()=>{o(n),a()},confirm:async()=>{let s=100;o(e=>(s=e<30||e>200?100:e,s)),await r.wm.post(q.s.user_save_private_attr,{is_ai_chat_zoom:!0,ai_chat_zoom:s}),(0,h.SK)(e("缩放调整成功")),c(),a()}})}}}(),V=M(P.oV.ai_model_switch)||M(P.oV.ai_agent_setting),K=[];for(const e of t)for(const s of e.models)K.push({title:s.label||s.value,value:`${e.index}::${s.value}`,group:e.note});const T=t.find(e=>e.active),B=T?`${T.index}::${e}`:"",E=(0,R.jsxs)(n.Fragment,{children:[(0,R.jsx)(I.rA,{icon:"menu",title:A("会话"),onClick:_,selected:g}),(0,R.jsx)(I.rA,{icon:"add",title:A("新会话"),onClick:()=>j()}),l.length>0&&(0,R.jsx)(f.l6,{value:N,options:[{title:A("选择系统提示词"),value:""},...l.map(e=>({title:e.note||e.prompt.slice(0,30),value:String(e.index)}))],onChange:e=>{k(e)},no_border:!0,width:"auto"}),V&&K.length>0&&(0,R.jsx)(f.l6,{value:B,options:[{title:A("选择模型"),value:""},...K],margin:"0 0 0 1em",onChange:e=>{const t=String(e??"");if(!t.includes("::"))return;const[n,...a]=t.split("::"),i=a.join("::");i&&(s(i),r.jV.post("set_active_model",{index:Number(n),model_name:i}).then(e=>{e?.code===p.m.Success?((0,h.SK)("success"),c()):(0,h.zN)(e?.message||"fail")}).catch(console.error))},no_border:!0,width:"auto"}),d&&m>0&&(0,R.jsx)(I.rA,{icon:"delete",title:A("删除选中消息"),onClick:b}),(0,R.jsx)(I.rA,{icon:"zoom_in",title:A("缩放调整"),onClick:H}),(0,R.jsx)(I.rA,{icon:"terminal",title:A("后台进程"),onClick:S,selected:w,tip:y||null}),M(P.oV.ai_agent_setting)&&(0,R.jsx)(I.rA,{icon:"smart_toy",title:"机器人配置",onClick:()=>{$(F.o.ai_rebot_setting_page)}}),M(P.oV.ai_agent_setting)&&(0,R.jsx)(I.rA,{icon:"settings",title:"ai setting",onClick:()=>{$(F.o.ai_agent_setting_page)}})]});return C?(0,R.jsx)("div",{className:"chat-inline-header",children:E}):(0,R.jsx)(z.aZ,{position:"right",children:E})};var J=t(83529);function W({sessions:e,activeSessionId:s,onSelectSession:t,onReorderSessions:a,onRenameSession:o,onDeleteSession:c,onToggleCmdAuto:r,onShowUsageStats:l,onShowSessionSetting:d,batchMode:u,selectedSessionIds:m,onToggleSessionSelect:h,onToggleBatchMode:g,onBatchDeleteSessions:p,onClearAllSessions:_}){const{t:x}=(0,i.Bd)(),[f,j]=(0,n.useState)(""),[v,b]=(0,n.useState)(null),[w,y]=(0,n.useState)(null),S=f.trim()?e.filter(e=>(e.title||"").toLowerCase().includes(f.toLowerCase())||(e.summary||"").toLowerCase().includes(f.toLowerCase())||(e.long_term_memory||"").toLowerCase().includes(f.toLowerCase())):e;return(0,R.jsxs)("aside",{className:"chat-session-list",children:[(0,R.jsx)("div",{className:"chat-session-search",children:(0,R.jsx)("input",{type:"text",className:"chat-session-search-input",placeholder:x("搜索会话"),value:f,onChange:e=>j(e.target.value)})}),(0,R.jsx)("div",{className:"chat-session-items-wrap",children:S.map((e,n)=>{return(0,R.jsx)("div",{children:(0,R.jsxs)("button",{className:`chat-session-item ${s===e.id?"active":""} ${u?"batch-mode":""} ${e.running?"is-running":""} ${v===n?"row-dragging":""} ${w===n&&null!==v&&v!==n?"row-drop-target":""}`,draggable:!!a,onDragStart:()=>b(n),onDragOver:e=>{null!==v&&(e.preventDefault(),w!==n&&y(n))},onDragEnd:()=>{b(null),y(null)},onDrop:e=>{e.preventDefault(),(e=>{const s=v;if(b(null),y(null),null===s||s===e||!a)return;const t=S[s]?.id,n=S[e]?.id;t&&n&&a(t,n)})(n)},onClick:()=>{u&&h?h(e.id):t(e.id)},title:e.summary||e.long_term_memory||e.title,children:[u&&(0,R.jsx)("input",{type:"checkbox",className:"chat-session-checkbox",checked:m?.has(e.id)??!1,onChange:()=>h?.(e.id),onClick:e=>e.stopPropagation()}),(0,R.jsx)("span",{children:(i=e.title,i||"新会话")}),e.running&&(0,R.jsx)("span",{className:"chat-session-running",title:x("正在执行中")}),(0,R.jsx)("small",{children:e.message_count}),"web"!==e.source&&(0,R.jsx)("em",{className:"chat-session-source",children:e.source}),!u&&(0,R.jsx)(J.MenuSelect,{list:[{name:x("重命名"),click:()=>o(e.id,e.title)},{name:x("移动到最上"),click:()=>{const s=S[0];s&&s.id!==e.id&&a?.(e.id,s.id)}},{name:x("移动到最下"),click:()=>{const s=S[S.length-1];s&&s.id!==e.id&&a?.(e.id,s.id)}},{name:e.cmd_auto_allow?x("命令检测关闭"):x("命令检测开启"),click:()=>r?.(e.id,!e.cmd_auto_allow)},{name:x("字符消耗统计"),click:()=>l(e.id)},{name:x("设置"),click:()=>d?.(e.id)},{name:x("删除"),click:()=>c(e.id)}],children:(0,R.jsx)(I.In,{icon:"more_horiz"})})]})},e.id);var i})}),(0,R.jsxs)("div",{className:"chat-session-actions",children:[(0,R.jsx)(I.rA,{icon:u?"check_circle":"checklist",title:x(u?"取消批量选择":"批量选择"),onClick:g}),u&&(m?.size??0)>0&&(0,R.jsx)(I.rA,{icon:"delete",title:x("删除选中会话"),onClick:p}),!u&&(0,R.jsx)(I.rA,{icon:"delete_sweep",title:x("删除全部会话"),onClick:_})]})]})}var U=t(21499);function Q(e){const s=(e.text||"").split("\n").map(e=>e.trim()).find(Boolean)||"";return s.length>80?s.slice(0,80)+"…":s}const X=({messages:e,batchMode:s,selectedMsgIds:t,sending:a,chatContainerRef:i,messagesEndRef:o,onToggleMsgSelect:c,onDelete:r,onCopy:l,onCopyAll:d,onToggleBatchMode:u,onBatchCopy:m,onBatchDelete:h,showBatchBar:g,t:p})=>{const[_,x]=(0,n.useState)(new Set),f=(0,n.useMemo)(()=>e.filter(e=>!e.is_loading).map(e=>e.id),[e]),j=e=>{x(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},v=()=>{x(e=>e.size>0&&f.every(s=>e.has(s))?new Set:new Set(f))};return(0,R.jsxs)("div",{className:"chat-messages",ref:i,"data-sending":a?"true":"false",children:[g&&(0,R.jsxs)("div",{className:"chat-message-batch-bar",children:[(0,R.jsxs)("span",{className:"batch-bar-count",children:[p("已选")," ",t.size]}),(0,R.jsx)("button",{onClick:m,children:p("复制所选")}),(0,R.jsx)("button",{onClick:h,className:"danger",children:p("删除所选")}),(0,R.jsx)("button",{onClick:u,children:p("取消")})]}),e.map(e=>{const n=_.has(e.id);return(0,R.jsxs)("div",{className:`chat-message ${e.sender} ${s?"batch-mode":""} ${e.is_loading?"is-loading":""} ${n?"collapsed":""}`,children:[s&&(0,R.jsx)("input",{type:"checkbox",className:"chat-message-checkbox",checked:t.has(e.id),onChange:()=>c(e.id)}),e.is_loading?(0,R.jsxs)("div",{className:"ai-loading-bubble",children:[(0,R.jsxs)("div",{className:"ai-loading-dots",children:[(0,R.jsx)("span",{className:"ai-loading-dot"}),(0,R.jsx)("span",{className:"ai-loading-dot"}),(0,R.jsx)("span",{className:"ai-loading-dot"})]}),(0,R.jsx)("span",{className:"ai-loading-text",children:e.text})]}):(0,R.jsxs)(R.Fragment,{children:[n?(0,R.jsxs)("div",{className:"chat-message-summary",title:e.text,onClick:()=>j(e.id),children:[(0,R.jsx)("span",{className:"chat-message-summary-icon",children:"▸"}),(0,R.jsx)("span",{className:"chat-message-summary-text",children:Q(e)||p("(无内容)")})]}):(0,R.jsx)("div",{className:"chat-message-body",children:D(e)}),(0,R.jsxs)("div",{className:"message-collapse-bar",children:[(0,R.jsx)("button",{onClick:()=>j(e.id),children:p(n?"展开":"折叠")}),(0,R.jsx)("button",{onClick:v,children:p("全部折叠")}),"bot"===e.sender&&null!=e.elapsed_ms&&(0,R.jsx)("span",{className:"message-elapsed",children:(0,U.kf)(e.elapsed_ms)})]}),(0,R.jsx)("div",{className:"message-actions",children:s?(0,R.jsx)("button",{onClick:()=>c(e.id),children:t.has(e.id)?p("取消选择"):p("选择")}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)("button",{onClick:()=>r(e.id),children:p("删除")}),(0,R.jsx)("button",{onClick:()=>l(e),children:p("复制")}),(0,R.jsx)("button",{onClick:d,children:p("全部复制")}),(0,R.jsx)("button",{onClick:u,children:p("多选")})]})})]})]},e.id)}),(0,R.jsx)("div",{ref:o})]})},Z=(0,n.forwardRef)(function({placeholder:e="",disabled:s=!1,className:t,style:a,onEnter:i,onPaste:o,onChange:c},r){const l=(0,n.useRef)(null),[d,u]=(0,n.useState)(!0),[m,h]=(0,n.useState)(!1),g=(0,n.useCallback)(()=>{const e=l.current;return e?(e.textContent??"").replace(/\u00A0/g," ").trimEnd():""},[]);(0,n.useImperativeHandle)(r,()=>({getValue:()=>g(),setValue:e=>{const s=l.current;if(!s)return;s.textContent=e,u(!e);const t=document.createRange();t.selectNodeContents(s),t.collapse(!1);const n=window.getSelection();n?.removeAllRanges(),n?.addRange(t)},clear:()=>{const e=l.current;e&&(e.textContent="",u(!0))},focus:()=>l.current?.focus()})),(0,n.useEffect)(()=>{const e=l.current;if(!e)return;const s=()=>u(!e.textContent);return e.addEventListener("input",s),()=>e.removeEventListener("input",s)},[]);return(0,R.jsx)("div",{ref:l,contentEditable:!s,suppressContentEditableWarning:!0,className:"rich-textarea"+(t?" "+t:""),style:a,onKeyDown:e=>{m||"Enter"!==e.key||e.shiftKey||e.ctrlKey||e.metaKey||e.altKey||(e.preventDefault(),i?.())},onPaste:o,onInput:()=>c?.(g()),onCompositionStart:()=>h(!0),onCompositionEnd:()=>h(!1),"data-placeholder":d?e:void 0})});var Y=t(84369);function ee({pendingAttachments:e,onRemove:s}){return 0===e.length?null:(0,R.jsx)("div",{className:"chat-attachment-strip",children:e.map((e,t)=>(0,R.jsxs)("div",{className:"chat-attachment-chip",children:[(0,R.jsx)(I.In,{icon:"attach_file"}),(0,R.jsx)("span",{title:e.name,children:e.name}),(0,R.jsx)("button",{type:"button",onClick:()=>s(t),children:(0,R.jsx)(I.In,{icon:"close"})})]},`${e.name}_${t}`))})}const se=(0,n.forwardRef)(({onSend:e,sending:s,onAbort:t,pendingAttachments:o,onRemoveAttachment:c,onOpenFilePicker:r,onAddFiles:l,onDrop:d,onDragOver:u,fileInputRef:m},h)=>{const{t:g}=(0,i.Bd)(),p=(0,n.useRef)(null),_=(0,n.useRef)(null),[f,j]=(0,a.fp)(x.AG.ai_chat_input_height);(0,n.useImperativeHandle)(h,()=>({getValue:()=>p.current?.getValue()??"",setValue:e=>p.current?.setValue(e),clear:()=>p.current?.clear()}));const{dragging:v,on_pointer_down:b,on_pointer_up:w}=(0,Y.y)({direction:"vertical",get_start_size:()=>f,px_to_unit:e=>e/(()=>{const e=_.current;return e&&parseFloat(getComputedStyle(e).fontSize)||16})(),min:2,on_change:e=>j(e)}),y={minHeight:`${f}em`,maxHeight:`${f}em`};return(0,R.jsxs)("div",{ref:_,className:"chat-input-area",onDrop:d,onDragOver:u,children:[(0,R.jsx)("div",{className:"chat-input-resize-handle"+(v?" dragging":""),onPointerDown:b}),(0,R.jsx)("input",{ref:m,type:"file",multiple:!0,style:{display:"none"},onChange:e=>{e.target.files?.length&&(l(e.target.files),e.currentTarget.value="")}}),(0,R.jsxs)("div",{className:"chat-input-shell",children:[(0,R.jsx)(ee,{pendingAttachments:o,onRemove:c}),(0,R.jsx)(Z,{ref:p,placeholder:g("输入消息"),onEnter:()=>e(),onPaste:e=>{const s=e.clipboardData?.files;s&&s.length>0&&(e.preventDefault(),l(s))},className:"chat-input",style:y})]}),(0,R.jsx)(I.rA,{title:g("添加文件"),icon:"attach_file",onClick:r}),s?(0,R.jsx)(I.Vi,{color:"var( --icon-red)",text:g("暂停"),clickFun:t}):(0,R.jsx)(I.Vi,{text:g("发送"),clickFun:e}),v&&(0,R.jsx)("div",{className:"chat-input-overlay",onPointerUp:w})]})}),te=function(e){const{t:s}=(0,i.Bd)(),[t,o]=(0,n.useState)([]),[r,l]=(0,n.useState)(!1),[d,u]=(0,n.useState)(null),[m,g]=(0,n.useState)(null),[p,_]=(0,n.useState)(!1),[f,j]=(0,a.fp)(x.AG.ai_bg_expanded),[,v]=(0,a.fp)(x.AG.ai_session_collapsed),b=()=>{j(!1)},w=(0,n.useCallback)(async()=>{l(!0);try{const s=new c.hf(c.HK.ai_bg_process_list_req);s.context={};const t=await $.ws.send(s);t?.context?.processes&&(o(t.context.processes),e.panelRef?.current?.onCountChange?.(t.context.processes.length))}catch(e){console.error("获取后台进程列表失败",e)}finally{l(!1)}},[]);e.panelRef&&(e.panelRef.current.refresh=w);const y=(0,n.useCallback)(async e=>{_(!0),u(e);try{const s=new c.hf(c.HK.ai_bg_process_output_req);s.context={pid:e};const t=await $.ws.send(s);g(t.context)}catch(e){console.error("获取进程输出失败",e),(0,h.zN)("获取进程输出失败")}finally{_(!1)}},[]),S=(0,n.useCallback)(async e=>{try{const s=new c.hf(c.HK.ai_bg_process_kill_req);s.context={pid:e};const t=await $.ws.send(s);t?.context?.success?((0,h.SK)("进程已终止"),w(),d===e&&(u(null),g(null))):(0,h.zN)(t?.context?.message||"终止失败")}catch(e){console.error("终止进程失败",e),(0,h.zN)("终止进程失败")}},[w,d]);(0,n.useEffect)(()=>{w();const e=setInterval(w,5e3);return()=>clearInterval(e)},[w]);const N=t.filter(e=>e.running),k=t.filter(e=>!e.running);return(0,R.jsxs)(R.Fragment,{children:[f&&(0,R.jsx)("div",{className:"chat-session-overlay",onClick:b}),(0,R.jsxs)("aside",{className:"chat-bg-process-panel "+(f?"expanded":""),children:[(0,R.jsxs)("div",{className:"chat-bg-process-header",children:[(0,R.jsx)("span",{className:"chat-bg-process-title",children:s("后台进程")}),(0,R.jsx)(I.rA,{icon:"close",title:s("关闭"),onClick:b})]}),(0,R.jsxs)("div",{className:"chat-bg-process-toolbar",children:[(0,R.jsx)(I.rA,{icon:"refresh",title:s("刷新"),onClick:w}),(0,R.jsxs)("span",{className:"chat-bg-process-count",children:[N.length," ",s("个运行中"),k.length>0&&` / ${k.length} ${s("个已退出")}`]})]}),(0,R.jsxs)("div",{className:"chat-bg-process-list",children:[r&&0===t.length&&(0,R.jsx)("div",{className:"chat-bg-process-empty",children:s("加载中...")}),!r&&0===t.length&&(0,R.jsx)("div",{className:"chat-bg-process-empty",children:s("暂无后台进程")}),N.map(e=>(0,R.jsxs)("div",{className:`chat-bg-process-item ${d===e.pid?"active":""} running`,children:[(0,R.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>y(e.pid),children:[(0,R.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",e.pid]}),(0,R.jsx)("span",{className:"chat-bg-process-cmd",title:e.cmd,children:e.cmd.length>40?e.cmd.slice(0,40)+"...":e.cmd}),(0,R.jsx)("span",{className:"chat-bg-process-time",children:new Date(e.start_time).toLocaleTimeString()}),(0,R.jsx)("span",{className:"chat-bg-process-status running-dot",title:s("运行中"),children:"●"})]}),(0,R.jsxs)("div",{className:"chat-bg-process-item-actions",children:[(0,R.jsx)(I.rA,{icon:"terminal",title:s("查看输出"),onClick:()=>y(e.pid)}),(0,R.jsx)(I.rA,{icon:"stop",title:s("终止进程"),onClick:()=>S(e.pid)})]})]},e.pid)),k.map(e=>(0,R.jsx)("div",{className:`chat-bg-process-item ${d===e.pid?"active":""} finished`,children:(0,R.jsxs)("div",{className:"chat-bg-process-item-main",onClick:()=>y(e.pid),children:[(0,R.jsxs)("span",{className:"chat-bg-process-pid",children:["PID: ",e.pid]}),(0,R.jsx)("span",{className:"chat-bg-process-cmd",title:e.cmd,children:e.cmd.length>30?e.cmd.slice(0,30)+"...":e.cmd}),(0,R.jsx)("span",{className:"chat-bg-process-time",children:new Date(e.start_time).toLocaleTimeString()}),(0,R.jsxs)("span",{className:"chat-bg-process-exit-code",children:["exit: ",e.exit_code]})]})},e.pid))]}),null!==d&&(0,R.jsxs)("div",{className:"chat-bg-process-output",children:[(0,R.jsxs)("div",{className:"chat-bg-process-output-header",children:[(0,R.jsxs)("span",{children:["PID: ",d," ",s("输出")]}),(0,R.jsx)(I.rA,{icon:"close",title:s("关闭"),onClick:()=>{u(null),g(null)}})]}),(0,R.jsx)("div",{className:"chat-bg-process-output-content",children:p?(0,R.jsx)("div",{className:"chat-bg-process-empty",children:s("加载中...")}):m?(0,R.jsx)("pre",{className:"chat-bg-process-output-pre",children:m.output||s("(无输出)")}):null})]})]})]})};function ne(e={}){const{inline_header:s=!1,session_id:t,file_cwd_path:j,sync_url:w=!0,on_session_change:S}=e,{t:N}=(0,i.Bd)(),[k,C]=(0,o.ok)(),I=w&&k.get("session")||"",M=e=>{w&&C(s=>{const t=new URLSearchParams(s);return e?t.set("session",e):t.delete("session"),t},{replace:!0})},D=(0,g.y)(),{check_user_auth:H}=(0,u.MH)();(0,_.w)();const[V,K]=(0,n.useState)([]),[T,B]=(0,n.useState)([]),[z,P]=(0,n.useState)(""),[F,L]=(0,n.useState)(null),[O,q]=(0,n.useState)(!1),J=(0,n.useRef)(null),[U,Q]=(0,n.useState)([]),[Z,Y]=(0,a.fp)(x.AG.ai_session_collapsed),[ee,ne]=(0,a.fp)(x.AG.ai_bg_expanded),[ae,ie]=(0,a.fp)(x.AG.prompt_card),[oe]=(0,a.fp)(x.AG.ai_chat_zoom),[ce,re]=(0,n.useState)(!1),[le,de]=(0,n.useState)(new Set),[ue,me]=(0,n.useState)(new Set),[he,ge]=(0,n.useState)(""),pe=(0,n.useRef)(null),_e=(0,n.useRef)(null),xe=(0,n.useRef)(null),fe=(0,n.useRef)(!0),je=(0,n.useRef)(null),ve=(0,n.useRef)(0),be=(0,n.useRef)(null),we=(0,n.useRef)({}),ye=(0,n.useRef)(z),Se=(0,n.useRef)(F);(0,n.useEffect)(()=>{ye.current=z},[z]),(0,n.useEffect)(()=>{Se.current=F},[F]);const Ne=(0,n.useRef)({}),[ke,Ce]=(0,n.useState)([]),[Ae,$e]=(0,n.useState)(""),[Ie,Me]=(0,n.useState)([]),Re=async()=>{try{const e=await r.jV.get("public_models");e.code===p.m.Success&&Me(e.data?.groups??[])}catch{Me([])}},De=e=>{$e(e?.ai_config?.model??"")},[He,Ve]=(0,n.useState)(0),Ke=(0,n.useRef)((0,l.sg)(e=>{K(e),fe.current&&Te(!1)},50)).current,Te=(e=!1)=>{const s=xe.current;s&&s.scrollTo({top:s.scrollHeight,behavior:e?"smooth":"auto"})},Be=async()=>{const e=await r.jV.get("sessions");e.code===p.m.Success&&B(e.data??[])},Ee=function(e){const{getMessages:s,setMessages:t,setMessagesDebounced:a,setSending:i,getActiveSessionId:o,setActiveSessionId:r,refreshSessions:l,scrollToBottom:d,buildRequestMessages:u,getSelectedSysPromptId:m}=e,h=(0,n.useRef)([]),g=(0,n.useRef)(null),p=(e,n,r)=>{const h=[...s(),n];t(h),i(e),g.current={abort:()=>{}};const p={id:n.id+1,sender:"bot",text:"AI思考中...",is_loading:!0};h.push(p),t([...h]);const _=new Map;let x=!0,f=p;const j=s=>{const t=s.context||{};if(t.session_id!==e)return;const n=t.text||"",i=t.tool_call_ends,c=t.chunk_index??0;if("[DONE]"!==n)if(x)x=!1,f.text=n,i&&(f.content_list=[{tool_call_ends:i,content:f.text,role:"assistant"}]),f.is_loading=!1,f.chunk_index=c,_.set(c,f),o()===e&&a([...h]);else{const s=_.get(c);if(s)s.text+=n,i&&(s.content_list=[{tool_call_ends:i,content:s.text,role:"assistant"}]),o()===e&&a([...h]);else{const s={id:Date.now()+Math.random(),sender:"bot",text:n,chunk_index:c};i&&(s.content_list=[{tool_call_ends:i,content:s.text,role:"assistant"}]),h.push(s),_.set(c,s),o()===e&&a([...h])}}},v=s=>{const n=s.context||{};if(n.session_id===e){if(w(),g.current=null,i(s=>s===e?null:s),f.is_loading=!1,o()===e)if(n.once_messages_list?.length){const e=y(n.once_messages_list);t(s=>{const t=s[s.length-1];return"bot"===t?.sender?[...s.slice(0,-1),...e]:[...s,...e]})}else t([...h]);l(),d(!0),r()}},b=s=>{const n=s.context||{};n.session_id===e&&(w(),g.current=null,i(s=>s===e?null:s),f.text="AI请求出错: "+(n.message||"未知错误"),f.is_loading=!1,o()===e&&t([...h]),r())},w=()=>{$.ws.off_message(`message_${c.HK.ai_chat_msg}`,j),$.ws.off_message(`message_${c.HK.ai_chat_end}`,v),$.ws.off_message(`message_${c.HK.ai_chat_error}`,b)};$.ws.addMsg(c.HK.ai_chat_msg,j),$.ws.addMsg(c.HK.ai_chat_end,v),$.ws.addMsg(c.HK.ai_chat_error,b),$.ws.sendData(c.HK.ai_chat_req,{messages:u(n),session_id:e,sys_prompt_id:m()})},_=()=>{const e=h.current;if(0===e.length)return;const s=e.shift();if(!s)return;t(e=>e.map(e=>"user"===e.sender&&e.text.includes("⏳(排队中...)")?{...e,text:e.text.replace(" ⏳(排队中...)","")}:e));const n={id:Date.now(),sender:"user",text:s.text,attachments:s.attachments};p(o(),n,_)};return{startChatStream:p,processPendingQueue:_,enqueueMessage:(e,s)=>{h.current.push({text:e,attachments:s})},getQueueLength:()=>h.current.length,abort:()=>{const e=o();e&&($.ws.sendData(c.HK.ai_chat_abort,{session_id:e}),g.current&&(g.current=null,i(s=>s===e?null:s)))}}}({getMessages:()=>V,setMessages:K,setMessagesDebounced:Ke,setSending:L,getActiveSessionId:()=>ye.current,setActiveSessionId:P,refreshSessions:Be,scrollToBottom:Te,buildRequestMessages:e=>{const s=(e.attachments??[]).filter(e=>"image"===e.kind);if(s.length>0){const t=[];e.text&&t.push({type:"text",text:e.text});for(const e of s)t.push({type:"image_url",image_url:{url:e.content}});return[{content:t,role:"user",attachments:e.attachments??[]}]}return[{content:e.text,role:"bot"===e.sender?"assistant":"user",attachments:e.attachments??[]}]},getSelectedSysPromptId:()=>he}),ze=async e=>{const s=await r.jV.get("sessions");if(s.code!==p.m.Success)return!1;const t=s.data??[];B(t);const n=null===e?t[0]?.id??"":e||z||t[0]?.id||"";return n?await Pe(n):(K([]),P(""),M(null),!1)},Pe=async(e,s=!1)=>{const t=await r.jV.post("session/get",{session_id:e});if(t.code!==p.m.Success||!t.data)return!1;const n=t.data;P(n.id),w&&I!==n.id&&M(n.id),S?.(n.id),q(!!n.running),be.current&&be.current!==n.id&&$.ws.sendData(c.HK.ai_chat_subscribe,{session_id:be.current,subscribe:!1}),be.current=n.running?n.id:null,be.current&&$.ws.sendData(c.HK.ai_chat_subscribe,{session_id:be.current,subscribe:!0});const a=y(n.messages);return n.running&&n.live_messages?.length?K([...a,...y(n.live_messages)]):K(a),ge(n.sys_prompt_id??""),s&&Y(!1),we.current.refresh?.(),requestAnimationFrame(()=>Te(!1)),!0},Fe=e=>{const s=Array.from(e??[]).filter(Boolean);s.length&&Q(e=>[...e,...s])},Le=()=>{ce&&(de(new Set),me(new Set)),re(e=>!e)},Oe=()=>{0!==le.size&&D({sub_title:N("cf_msgs"),confirm_fun:async()=>{const e=[];V.forEach((s,t)=>{le.has(s.id)&&e.push(t)}),K(V.filter(e=>!le.has(e.id))),de(new Set),re(!1),z&&e.length>0&&r.jV.post("session/message/delete",{session_id:z,indices:e}).catch(console.error)}})},qe=async()=>{const e=await r.XO.get("ai_agent_setting/env");if(e.code===p.m.Success&&(Ne.current=e.data,De(e.data)),await Re(),j){const e=await(async e=>{if(!e)return null;const s=await r.jV.get("sessions");if(s.code!==p.m.Success)return null;const t=(s.data??[]).find(s=>s.file_cwd_path===e);if(t)return t.id;const n=await r.jV.post("session",{title:"新会话",file_cwd_path:e});return n.code!==p.m.Success?null:n.data.id})(j);!!e&&await ze(e)||await ze()}else if(t){await ze(t)||await ze()}else if(I){await ze(I)||await ze()}else await ze();const s=await r.jV.get("system_prompts");s.code===p.m.Success&&Ce(s.data??[])};(0,n.useEffect)(()=>{qe(),requestAnimationFrame(()=>Te(!1)),we.current.onCountChange=Ve,we.current.refresh?.();const e=e=>{const s=e?.context?.count;"number"==typeof s&&Ve(s)};return $.ws.addMsg(c.HK.ai_bg_process_count_notify,e),()=>{$.ws.off_message(`message_${c.HK.ai_bg_process_count_notify}`,e)}},[]),(0,n.useEffect)(()=>{const e=xe.current;if(!e)return;const s=()=>{fe.current=((e,s=120)=>{const{scrollTop:t,scrollHeight:n,clientHeight:a}=e;return n-(t+a)<s})(e)};return e.addEventListener("scroll",s),()=>e.removeEventListener("scroll",s)},[]),(0,n.useEffect)(()=>{const e=()=>ye.current,s=()=>Se.current,t=(t,n)=>{if(e()&&e()===t){if(je.current=null,q(!1),be.current===t&&($.ws.sendData(c.HK.ai_chat_subscribe,{session_id:t,subscribe:!1}),be.current=null),s()===t)return;n?.length?K(e=>{const s=y(n),t=e[e.length-1];return"bot"===t?.sender?[...e.slice(0,-1),...s]:[...e,...s]}):Pe(t).catch(()=>{}),Be()}},n=t=>{const n=t?.context||{};if(!n.session_id)return;var a,i,o;a=n.session_id,i=n.text||"",o=n.tool_call_ends,e()&&e()===a&&s()!==a&&K(e=>{const s=e[e.length-1];if(s&&"bot"===s.sender){const t=[...e],n={...s};return n.text+=i,o&&(n.content_list=[{tool_call_ends:o,content:n.text,role:"assistant"}]),t[t.length-1]=n,je.current=n.id,fe.current&&requestAnimationFrame(()=>Te(!1)),t}const t={id:Date.now()+Math.random(),sender:"bot",text:i};return o&&(t.content_list=[{tool_call_ends:o,content:i,role:"assistant"}]),je.current=t.id,fe.current&&requestAnimationFrame(()=>Te(!1)),[...e,t]});const c=Date.now();c-ve.current>1500&&(ve.current=c,Be())},a=e=>{const s=e?.context||{};s.session_id&&t(s.session_id,s.once_messages_list)},i=e=>{const s=e?.context||{};s.session_id&&t(s.session_id)};return $.ws.addMsg(c.HK.ai_chat_msg,n),$.ws.addMsg(c.HK.ai_chat_end,a),$.ws.addMsg(c.HK.ai_chat_error,i),()=>{$.ws.off_message(`message_${c.HK.ai_chat_msg}`,n),$.ws.off_message(`message_${c.HK.ai_chat_end}`,a),$.ws.off_message(`message_${c.HK.ai_chat_error}`,i),be.current&&($.ws.sendData(c.HK.ai_chat_subscribe,{session_id:be.current,subscribe:!1}),be.current=null)}},[]),(0,n.useLayoutEffect)(()=>{fe.current&&Te(!1)},[V]);return(0,R.jsxs)(n.Fragment,{children:[(0,R.jsx)(G,{inline:s,currentModelName:Ae,setCurrentModelName:$e,modelGroups:Ie,onModelChanged:async()=>{await Re();const e=await r.XO.get("ai_agent_setting/env");e.code===p.m.Success&&(Ne.current=e.data,De(e.data))},sysPromptList:ke,batchMode:ce,selectedMsgCount:le.size,sessionVisible:!Z,onToggleSessionPanel:()=>{Y(e=>!e)},onCreateSession:async e=>{const s=e??"",t=await r.jV.post("session",{title:"新会话",sys_prompt_id:s||void 0,file_cwd_path:j||void 0});if(t.code!==p.m.Success)return;const n=t.data;P(n.id),K([]),ge(n.sys_prompt_id??""),Y(!1),await ze(n.id),requestAnimationFrame(()=>{const e=document.querySelector(".chat-input");e&&(e.style.height="auto",e.style.height=Math.min(e.scrollHeight,200)+"px")})},onBatchDeleteMessages:Oe,bgProcessVisible:ee,bgProcessCount:He,onToggleBgProcess:()=>ne(e=>!e),selectedSysPromptId:he,setSelectedSysPromptId:e=>{ge(e),z&&r.jV.post("session/sys_prompt",{session_id:z,sys_prompt_id:e||void 0}).catch(console.error)}}),(0,R.jsxs)("div",{className:"chat-page"+(s?" chat-page--embedded":" chat-page-with-sessions"),style:{"--ai-chat-zoom":oe},children:[!Z&&(0,R.jsx)(W,{sessions:T,activeSessionId:z,onSelectSession:e=>Pe(e,!1),onReorderSessions:(e,s)=>{const t=T.findIndex(s=>s.id===e),n=T.findIndex(e=>e.id===s);if(t<0||n<0||t===n)return;const a=(0,d.TI)(T,t,n);B(a),r.jV.post("sessions/update/sort",{session_ids:a.map(e=>e.id)}).catch(()=>{})},onRenameSession:(e,s)=>{let t=s;D({confirm_fun:async()=>{await r.jV.post("sessions/update/meta",{id:e,title:t}),await ze(z)},context_div:(0,R.jsx)("div",{className:"card-content",children:(0,R.jsx)(f.Sm,{value:t,handleInputChange:e=>{t=e}})})})},onDeleteSession:e=>{D({sub_title:"确认删除这个会话吗?",confirm_fun:async()=>{await r.jV.post("session/delete",{session_id:e}),z===e?(P(""),await ze(null)):await ze(z)}})},onToggleCmdAuto:async(e,s)=>{await r.jV.post("session/cmd_auto_allow",{session_id:e,allow:s}),(0,h.SK)(N(s?"命令检测已开启":"命令检测已关闭")),await ze(z)},onShowUsageStats:async e=>{ie({open:!0,title:N("Token消耗统计"),context_div:(0,R.jsx)("div",{className:"usage-stats-loading",children:N("加载中...")}),cancel:()=>ie({open:!1})});try{const s=await r.jV.post("session/usage_stats",{session_id:e});if(s.code===p.m.Success&&s.data){const e=s.data;ie({open:!0,title:N("Token消耗统计"),context_div:(0,R.jsxs)("div",{className:"usage-stats-panel",children:[[{l:N("对话轮次"),v:(e.turns??0).toString()},{l:N("AI输入Token"),v:v(e.input_tokens)},{l:N("AI输出Token"),v:v(e.output_tokens)},{l:N("AI输入Token(最近一轮)"),v:v(e.recent_input_tokens)},{l:N("AI输出Token(最近一轮)"),v:v(e.recent_output_tokens)}].map((e,s)=>(0,R.jsxs)("div",{className:"usage-stats-row",children:[(0,R.jsx)("span",{className:"usage-stats-label",children:e.l}),(0,R.jsx)("span",{className:"usage-stats-value",children:e.v})]},s)),(0,R.jsxs)("div",{className:"usage-stats-row usage-stats-total",children:[(0,R.jsx)("span",{className:"usage-stats-label",children:N("AI Token总计消耗")}),(0,R.jsx)("span",{className:"usage-stats-value",children:v((e.input_tokens||0)+(e.output_tokens||0))})]})]}),cancel:()=>ie({open:!1})})}else ie({open:!0,title:N("Token消耗统计"),context_div:(0,R.jsx)("div",{className:"usage-stats-empty",children:N("暂无统计数据")}),cancel:()=>ie({open:!1})})}catch{ie({open:!0,title:N("Token消耗统计"),context_div:(0,R.jsx)("div",{className:"usage-stats-empty",children:N("暂无统计数据")}),cancel:()=>ie({open:!1})})}},onShowSessionSetting:e=>{let s=T.find(s=>s.id===e)?.file_cwd_path??"";ie({open:!0,title:N("会话设置"),context_div:(0,R.jsxs)("div",{className:"session-setting",children:[(0,R.jsx)("div",{className:"session-setting__label",children:N("服务器工作目录")}),(0,R.jsx)(f.Sm,{value:s,placeholder:N("服务器工作目录提示"),handleInputChange:e=>{s=e}})]}),confirm:async()=>{try{(await r.jV.post("session/setting",{session_id:e,file_cwd_path:s.trim()})).code===p.m.Success&&(0,h.SK)(N("保存成功"))}catch{}ie({open:!1}),await ze(z)},cancel:()=>ie({open:!1})})},batchMode:ce,selectedSessionIds:ue,onToggleSessionSelect:e=>{me(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},onToggleBatchMode:Le,onBatchDeleteSessions:()=>{0!==ue.size&&D({sub_title:N("cf_ses"),confirm_fun:async()=>{for(const e of ue)await r.jV.post("session/delete",{session_id:e});me(new Set),re(!1),ue.has(z)?(P(""),await ze(null)):await ze(z)}})},onClearAllSessions:()=>{D({sub_title:N("cf_all"),confirm_fun:async()=>{await r.jV.post("sessions/clear",{}),P(""),K([]),await ze(null)}})}}),(0,R.jsx)(te,{panelRef:we}),(0,R.jsxs)("section",{className:"chat-main",children:[0===V?.length&&(0,R.jsx)("div",{className:"chat-header",children:(0,R.jsx)("div",{children:N("ai_ask")})}),(0,R.jsx)(X,{messages:V,batchMode:ce,selectedMsgIds:le,sending:F===z||O,chatContainerRef:xe,messagesEndRef:_e,onToggleMsgSelect:e=>{de(s=>{const t=new Set(s);return t.has(e)?t.delete(e):t.add(e),t})},onDelete:e=>{D({sub_title:N("cf_one"),confirm_fun:async()=>{const s=V.findIndex(s=>s.id===e);if(s<0)return;const t=V.filter(s=>s.id!==e);K(t),z&&r.jV.post("session/message/delete",{session_id:z,indices:[s]}).catch(console.error)}})},onCopy:async e=>{(0,m.lW)(b(e)),(0,h.SK)("复制成功")},onCopyAll:async()=>{if(!T.length)return void(0,h.SK)("暂无聊天记录");const e=[];for(const s of T){const t=await r.jV.post("session/get",{session_id:s.id});if(t.code!==p.m.Success||!t.data)continue;const n=t.data,a=y([...n.messages??[],...n.live_messages??[]]).map(b).filter(Boolean).join("\n\n\n");a&&e.push(a)}e.length?((0,m.lW)(e.join("\n\n\n")),(0,h.SK)("复制成功")):(0,h.SK)("暂无聊天记录")},onToggleBatchMode:Le,onBatchCopy:()=>{const e=V.filter(e=>le.has(e.id)).map(b).filter(Boolean).join("\n\n\n");e?((0,m.lW)(e),(0,h.SK)("复制成功")):(0,h.SK)("暂无内容")},onBatchDelete:Oe,showBatchBar:ce&&le.size>0&&0===ue.size,t:N}),(0,R.jsx)(se,{ref:J,onSend:async()=>{const e=(J.current?.getValue()??"").trim();if(!e&&0===U.length)return;if(F===z){const s=await A(U);Ee.enqueueMessage(e,s),J.current?.clear(),Q([]);const t={id:Date.now(),sender:"user",text:e+(Ee.getQueueLength()>1?" ⏳(排队中...)":""),attachments:s};return void K(e=>[...e,t])}let s=z;if(!s){const t=await r.jV.post("session",{title:(e||U[0]?.name||"新会话").slice(0,28),sys_prompt_id:void 0,file_cwd_path:j||void 0});if(t.code!==p.m.Success)return;s=t.data.id,P(s),S?.(s),await ze(s)}const t=await A(U),n={id:Date.now(),sender:"user",text:e,attachments:t};J.current?.clear(),Q([]);const a=Ne?.current?.ai_config?.request_type||"completions";if("completions"!==a){const t={id:n.id+1,sender:"bot",text:"处理中...",is_loading:!0},i=[...V,n,t];K(i),L(s);return void(await E(a,e,s,async(e,s)=>{t.text=e,t.is_loading=!1,s?.images&&(t.images=s.images),s?.audio&&(t.audio=s.audio),s?.embeddings&&(t.embeddings=s.embeddings),K([...i]),L(null),Be(),Te(!0),Ee.processPendingQueue()})||(t.text=`请求类型 "${a}" 的专用处理器尚未实现,请使用 completions 类型。`,t.is_loading=!1,K([...i]),L(null),Ee.processPendingQueue()))}Ee.startChatStream(s,n,()=>Ee.processPendingQueue())},sending:F===z||O,onAbort:Ee.abort,pendingAttachments:U,onRemoveAttachment:e=>{Q(s=>s.filter((s,t)=>t!==e))},onOpenFilePicker:()=>{pe.current?.click()},onAddFiles:Fe,onDrop:e=>{const s=e.dataTransfer?.files;s&&s.length>0&&(e.preventDefault(),Fe(s))},onDragOver:e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},fileInputRef:pe})]})]})]})}},72693(e,s,t){t.d(s,{w:()=>h});var n=t(96540),a=t(22022),i=t(14944),o=t(92275),c=t(34843),r=t(82893),l=t(85997),d=t(14284),u=t(74848);function m(e){const{t:s}=(0,a.Bd)(),[t,i]=(0,n.useState)(!1),o=!!e.sessionId;return(0,u.jsxs)("div",{children:[(0,u.jsx)("div",{style:{maxHeight:"60vh",overflow:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",background:"var(--surfaceSecondary)",padding:"0.75em",borderRadius:"0.5em",marginBottom:"0.75em",fontFamily:"monospace",fontSize:"0.9em",lineHeight:"1.5"},children:e.cmd}),o&&(0,u.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5em",marginBottom:"0.75em",color:t?"var(--icon-blue)":"var(--textSecondary)"},children:[(0,u.jsx)(l.Ay,{checked:t,onChange:s=>{i(s),s&&e.onAutoAllow()},title:s("此会话不再询问")}),(0,u.jsx)("span",{children:s("此会话不再询问")})]}),(0,u.jsxs)("div",{style:{display:"flex",gap:"0.5em",justifyContent:"flex-end"},children:[(0,u.jsx)(l.$n,{text:s("拒绝"),color:"var(--red)",clickFun:e.onDeny}),(0,u.jsx)(l.$n,{text:s("允许"),clickFun:e.onAllow})]})]})}function h(){const[e,s]=(0,c.fp)(r.AG.prompt_card),{t}=(0,a.Bd)(),l=(0,n.useRef)([]),h=(0,n.useRef)(!1),g=(0,n.useRef)(null),p=(0,n.useRef)(void 0),_=(0,n.useRef)(()=>{}),x=(0,n.useCallback)(e=>{s({open:!1}),h.current=!1,g.current&&(i.ws.sendData(o.HK.ai_confirm_cmd,{askId:g.current,approved:e}),g.current=null),_.current()},[s]),f=(0,n.useCallback)(()=>{if(h.current)return;if(0===l.current.length)return h.current=!1,void s({open:!1});h.current=!0;const e=l.current.shift();e?(g.current=e.askId,p.current=e.session_id,s({open:!0,title:t("命令确认"),cancel:()=>x(!1),context_div:(0,u.jsx)(m,{cmd:e.cmd,sessionId:e.session_id,onDeny:()=>x(!1),onAllow:()=>x(!0),onAutoAllow:async()=>{if(p.current)try{await d.jV.post("session/cmd_auto_allow",{session_id:p.current,allow:!0})}catch(e){console.error("设置会话命令免确认失败",e)}x(!0)}})})):h.current=!1},[t,x,s]);_.current=f;const j=(0,n.useCallback)(e=>{l.current.push(e),f()},[f]);(0,n.useEffect)(()=>{const e=e=>{const t=e.context||{};if(t.dismiss&&t.askId)return l.current=l.current.filter(e=>e.askId!==t.askId),void(h.current&&g.current===t.askId&&(g.current=null,h.current=!1,s({open:!1}),f()));t.askId&&t.cmd&&j({askId:t.askId,cmd:t.cmd,session_id:t.session_id})};return i.ws.addMsg(o.HK.ai_confirm_cmd,e),()=>{i.ws.off_message(`message_${o.HK.ai_confirm_cmd}`,e)}},[j]),(0,n.useEffect)(()=>()=>{l.current=[],h.current=!1,g.current=null},[])}},34299(e,s,t){t.r(s),t.d(s,{default:()=>b});var n=t(96540),a=t(23802),i=t(53995),o=t(18569),c=t(77979),r=t(8263),l=t(69428),d=t.n(l),u=(t(3775),t(21499)),m=t(99214),h=t(89117),g=t(89334),p=t(41105),_=t(52388),x=t(19878),f=(t(72411),t(74848));const j=new a.A({html:!0,highlight:function(e,s){if(s&&x.A.getLanguage(s))try{return`<pre class="hljs code-block-with-copy"><code class="hljs language-${s}">${x.A.highlight(e,{language:s}).value}</code></pre>`}catch(e){}try{return`<pre class="hljs code-block-with-copy"><code class="hljs">${x.A.highlightAuto(e).value}</code></pre>`}catch(e){}return`<pre class="hljs code-block-with-copy"><code>${j.utils.escapeHtml(e)}</code></pre>`}});function v(e){const s=e.className.match(/language-([\w-]+)/);return s?s[1]:""}function b(e){const s=(0,n.useRef)(null);return(0,m.VD)(),(0,n.useEffect)(()=>{s.current&&(!async function(e){const s=e.querySelectorAll("pre > code[class*='language-']");for(const e of Array.from(s)){const s=v(e);if(!(0,h.Hm)(s))continue;const t=e.closest(".code-block-with-copy")??e.parentElement;if(!t)continue;const n=e.textContent??"",a=document.createElement("div");a.className="md-graph md-graph--loading",a.textContent=_.A.t("rendering"),t.replaceWith(a);const i=await(0,h.U6)(s,n);a.isConnected&&(i.error?(a.className="md-graph md-graph--error",a.textContent=i.error):(a.className="md-graph",a.innerHTML=i.svg))}}(s.current),(0,g.rg)(s.current))},[e.context]),(0,f.jsx)("div",{ref:s,dangerouslySetInnerHTML:{__html:j.render(e.context)}})}j.use(i.A).use(o.A).use(c.A).use(r.A).use(d()).use(e=>{e.renderer.rules.fence;e.renderer.rules.fence=(s,t,n,a,i)=>{const o=s[t],c=o.content.trim(),r=o.info.trim();let l="";if(r&&x.A.getLanguage(r))try{l=x.A.highlight(c,{language:r}).value}catch(s){l=e.utils.escapeHtml(c)}else try{l=x.A.highlightAuto(c).value}catch(s){l=e.utils.escapeHtml(c)}return`\n <div class="code-block-with-copy">\n <div class="code-header">\n <span class="code-language">${r||"code"}</span>\n <button class="copy-btn" data-code="${e.utils.escapeHtml(c)}">复制</button>\n </div>\n <pre><code class="hljs ${r?`language-${r}`:""}">${l}</code></pre>\n </div>`}}).use(e=>{const s=e.renderer.rules.link_open||function(e,s,t,n,a){return a.renderToken(e,s,t)};e.renderer.rules.link_open=(e,t,n,a,i)=>{const o=e[t],c=o.attrIndex("href");if(c>=0){const e=o.attrs[c][1];o.attrs[c][1]=(0,u.bi)(window.location.href,e)}return s(e,t,n,a,i)}}),(0,g.Rh)(j,p.pC)},84369(e,s,t){t.d(s,{y:()=>o});var n=t(96540),a=t(2543);function i(e){if(void 0!==e)return"function"==typeof e?e():e}function o(e){const{direction:s="vertical",target_ref:t,get_start_size:o,px_to_unit:c,min:r,max:l,throttle:d,on_change:u,on_drag_end:m}=e,[h,g]=(0,n.useState)(!1),p=(0,n.useRef)(null),_=(0,n.useRef)(u);_.current=u;const x=e=>"vertical"===s?e.clientY:e.clientX,f=(0,n.useRef)({direction:s,get_start_size:o,px_to_unit:c,min:r,max:l,get_pos:x});f.current={direction:s,get_start_size:o,px_to_unit:c,min:r,max:l,get_pos:x};const j=(0,n.useCallback)(e=>{const s=p.current;if(!s)return;const{px_to_unit:t,min:n,max:a,get_pos:o}=f.current,c=s.pos-o(e);let r=s.size+t(c);const l=i(n),d=i(a);void 0!==l&&(r=Math.max(l,r)),void 0!==d&&(r=Math.min(d,r)),_.current(r)},[]),v=n.useMemo(()=>void 0===d?j:a.throttle(e=>j(e),d),[d,j]),b=(0,n.useCallback)(()=>{p.current=null,g(!1);const e=v;"function"==typeof e.cancel&&e.cancel(),m?.()},[v,m]),w=(0,n.useCallback)(e=>{const{get_start_size:s,get_pos:t}=f.current;p.current={pos:t(e),size:s()},g(!0)},[]);return(0,n.useEffect)(()=>{if(!h)return;const e=t?.current??window;return e.addEventListener("pointermove",v),e.addEventListener("pointerup",b),()=>{e.removeEventListener("pointermove",v),e.removeEventListener("pointerup",b)}},[h,v,b,t]),(0,n.useEffect)(()=>{const e=v;return()=>{"function"==typeof e.cancel&&e.cancel()}},[v]),{dragging:h,on_pointer_down:w,on_pointer_up:b}}},60840(e){e.exports="data:image/svg+xml,<svg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27 version=%271.1%27 aria-hidden=%27true%27><path fill-rule=%27evenodd%27 d=%27M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z%27></path></svg>"}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4061],{34061(t,i,e){e.d(i,{diagram:()=>nt});var s=e(5637),a=e(69793),n=(e(43287),e(12505)),h=e(86535),o=e(31293),r=e(86827),l=e(51444),c=function(){var t=(0,r.K)(function(t,i,e,s){for(e=e||{},s=t.length;s--;e[t[s]]=i);return e},"o"),i=[1,10,12,14,16,18,19,21,23],e=[2,6],s=[1,3],a=[1,5],n=[1,6],h=[1,7],o=[1,5,10,12,14,16,18,19,21,23,36,37,38],l=[1,25],c=[1,26],g=[1,28],u=[1,29],x=[1,30],d=[1,31],p=[1,32],f=[1,33],m=[1,34],y=[1,35],b=[1,36],w=[1,37],S=[1,43],A=[1,42],C=[1,47],k=[1,50],R=[1,10,12,14,16,18,19,21,23,36,37,38],_=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],T=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],D=[1,65],L=[26,28],P={trace:(0,r.K)(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:(0,r.K)(function(t,i,e,s,a,n,h){var o=n.length-1;switch(a){case 5:s.setOrientation(n[o]);break;case 9:s.setDiagramTitle(n[o].text.trim());break;case 12:s.setLineData({text:"",type:"text"},n[o]);break;case 13:s.setLineData(n[o-1],n[o]);break;case 14:s.setBarData({text:"",type:"text"},n[o]);break;case 15:s.setBarData(n[o-1],n[o]);break;case 16:this.$=n[o].trim(),s.setAccTitle(this.$);break;case 17:case 18:this.$=n[o].trim(),s.setAccDescription(this.$);break;case 19:case 29:this.$=n[o-1];break;case 20:case 30:this.$=[n[o-2],...n[o]];break;case 21:case 31:this.$=[n[o]];break;case 22:this.$={value:Number(n[o-1]),label:n[o]};break;case 23:this.$={value:Number(n[o]),label:""};break;case 24:s.setXAxisTitle(n[o]);break;case 25:s.setXAxisTitle(n[o-1]);break;case 26:s.setXAxisTitle({type:"text",text:""});break;case 27:s.setXAxisBand(n[o]);break;case 28:s.setXAxisRangeData(Number(n[o-2]),Number(n[o]));break;case 32:s.setYAxisTitle(n[o]);break;case 33:s.setYAxisTitle(n[o-1]);break;case 34:s.setYAxisTitle({type:"text",text:""});break;case 35:s.setYAxisRangeData(Number(n[o-2]),Number(n[o]));break;case 39:case 40:this.$={text:n[o],type:"text"};break;case 41:this.$={text:n[o],type:"markdown"};break;case 42:this.$=n[o];break;case 43:this.$=n[o-1]+""+n[o]}},"anonymous"),table:[t(i,e,{3:1,4:2,7:4,5:s,36:a,37:n,38:h}),{1:[3]},t(i,e,{4:2,7:4,3:8,5:s,36:a,37:n,38:h}),t(i,e,{4:2,7:4,6:9,3:10,5:s,8:[1,11],36:a,37:n,38:h}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},t(o,[2,36]),t(o,[2,37]),t(o,[2,38]),{1:[2,1]},t(i,e,{4:2,7:4,3:21,5:s,36:a,37:n,38:h}),{1:[2,3]},t(o,[2,5]),t(i,[2,7],{4:22,36:a,37:n,38:h}),{11:23,30:l,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},{11:39,13:38,24:S,29:A,30:l,31:40,32:41,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},{11:45,15:44,29:C,30:l,35:46,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},{11:49,17:48,24:k,30:l,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},{11:52,17:51,24:k,30:l,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},{20:[1,53]},{22:[1,54]},t(R,[2,18]),{1:[2,2]},t(R,[2,8]),t(R,[2,9]),t(_,[2,39],{41:55,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w}),t(_,[2,40]),t(_,[2,41]),t(T,[2,42]),t(T,[2,44]),t(T,[2,45]),t(T,[2,46]),t(T,[2,47]),t(T,[2,48]),t(T,[2,49]),t(T,[2,50]),t(T,[2,51]),t(T,[2,52]),t(T,[2,53]),t(R,[2,10]),t(R,[2,24],{32:41,31:56,24:S,29:A}),t(R,[2,26]),t(R,[2,27]),{33:[1,57]},{11:59,30:l,34:58,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},t(R,[2,11]),t(R,[2,32],{35:60,29:C}),t(R,[2,34]),{33:[1,61]},t(R,[2,12]),{17:62,24:k},{25:63,27:64,29:D},t(R,[2,14]),{17:66,24:k},t(R,[2,16]),t(R,[2,17]),t(T,[2,43]),t(R,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},t(R,[2,33]),{29:[1,70]},t(R,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},t(L,[2,23],{30:[1,73]}),t(R,[2,15]),t(R,[2,28]),t(R,[2,29]),{11:59,30:l,34:74,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},t(R,[2,35]),t(R,[2,19]),{25:75,27:64,29:D},t(L,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:(0,r.K)(function(t,i){if(!i.recoverable){var e=new Error(t);throw e.hash=i,e}this.trace(t)},"parseError"),parse:(0,r.K)(function(t){var i=this,e=[0],s=[],a=[null],n=[],h=this.table,o="",l=0,c=0,g=0,u=n.slice.call(arguments,1),x=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);x.setInput(t,d.yy),d.yy.lexer=x,d.yy.parser=this,void 0===x.yylloc&&(x.yylloc={});var f=x.yylloc;n.push(f);var m=x.options&&x.options.ranges;function y(){var t;return"number"!=typeof(t=s.pop()||x.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=i.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,(0,r.K)(function(t){e.length=e.length-2*t,a.length=a.length-t,n.length=n.length-t},"popStack"),(0,r.K)(y,"lex");for(var b,w,S,A,C,k,R,_,T,D={};;){if(S=e[e.length-1],this.defaultActions[S]?A=this.defaultActions[S]:(null==b&&(b=y()),A=h[S]&&h[S][b]),void 0===A||!A.length||!A[0]){var L="";for(k in T=[],h[S])this.terminals_[k]&&k>2&&T.push("'"+this.terminals_[k]+"'");L=x.showPosition?"Parse error on line "+(l+1)+":\n"+x.showPosition()+"\nExpecting "+T.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==b?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(L,{text:x.match,token:this.terminals_[b]||b,line:x.yylineno,loc:f,expected:T})}if(A[0]instanceof Array&&A.length>1)throw new Error("Parse Error: multiple actions possible at state: "+S+", token: "+b);switch(A[0]){case 1:e.push(b),a.push(x.yytext),n.push(x.yylloc),e.push(A[1]),b=null,w?(b=w,w=null):(c=x.yyleng,o=x.yytext,l=x.yylineno,f=x.yylloc,g>0&&g--);break;case 2:if(R=this.productions_[A[1]][1],D.$=a[a.length-R],D._$={first_line:n[n.length-(R||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(R||1)].first_column,last_column:n[n.length-1].last_column},m&&(D._$.range=[n[n.length-(R||1)].range[0],n[n.length-1].range[1]]),void 0!==(C=this.performAction.apply(D,[o,c,l,d.yy,A[1],a,n].concat(u))))return C;R&&(e=e.slice(0,-1*R*2),a=a.slice(0,-1*R),n=n.slice(0,-1*R)),e.push(this.productions_[A[1]][0]),a.push(D.$),n.push(D._$),_=h[e[e.length-2]][e[e.length-1]],e.push(_);break;case 3:return!0}}return!0},"parse")},v=function(){return{EOF:1,parseError:(0,r.K)(function(t,i){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,i)},"parseError"),setInput:(0,r.K)(function(t,i){return this.yy=i||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:(0,r.K)(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:(0,r.K)(function(t){var i=t.length,e=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),e.length-1&&(this.yylineno-=e.length-1);var a=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:e?(e.length===s.length?this.yylloc.first_column:0)+s[s.length-e.length].length-e[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[a[0],a[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:(0,r.K)(function(){return this._more=!0,this},"more"),reject:(0,r.K)(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:(0,r.K)(function(t){this.unput(this.match.slice(t))},"less"),pastInput:(0,r.K)(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:(0,r.K)(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:(0,r.K)(function(){var t=this.pastInput(),i=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+i+"^"},"showPosition"),test_match:(0,r.K)(function(t,i){var e,s,a;if(this.options.backtrack_lexer&&(a={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&&(a.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,i,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e)return e;if(this._backtrack){for(var n in a)this[n]=a[n];return!1}return!1},"test_match"),next:(0,r.K)(function(){if(this.done)return this.EOF;var t,i,e,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var a=this._currentRules(),n=0;n<a.length;n++)if((e=this._input.match(this.rules[a[n]]))&&(!i||e[0].length>i[0].length)){if(i=e,s=n,this.options.backtrack_lexer){if(!1!==(t=this.test_match(e,a[n])))return t;if(this._backtrack){i=!1;continue}return!1}if(!this.options.flex)break}return i?!1!==(t=this.test_match(i,a[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:(0,r.K)(function(){var t=this.next();return t||this.lex()},"lex"),begin:(0,r.K)(function(t){this.conditionStack.push(t)},"begin"),popState:(0,r.K)(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:(0,r.K)(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:(0,r.K)(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:(0,r.K)(function(t){this.begin(t)},"pushState"),stateStackSize:(0,r.K)(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:(0,r.K)(function(t,i,e,s){switch(e){case 0:case 1:case 5:case 44:break;case 2:case 3:return this.popState(),36;case 4:return 36;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:case 26:case 28:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";case 18:return this.pushState("axis_data"),"Y_AXIS";case 19:return this.pushState("axis_band_data"),24;case 20:return 33;case 21:return this.pushState("data"),16;case 22:return this.pushState("data"),18;case 23:return this.pushState("data_inner"),24;case 24:return 29;case 25:return this.popState(),26;case 27:this.pushState("string");break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 44;case 33:return"COLON";case 34:return 45;case 35:return 28;case 36:return 46;case 37:return 47;case 38:return 49;case 39:return 51;case 40:return 48;case 41:return 42;case 42:return 50;case 43:return 43;case 45:return 37;case 46:return 38}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}}}();function E(){this.yy={}}return P.lexer=v,(0,r.K)(E,"Parser"),E.prototype=P,P.Parser=E,new E}();c.parser=c;var g=c;function u(t){return"bar"===t.type}function x(t){return"band"===t.type}function d(t){return"linear"===t.type}(0,r.K)(u,"isBarPlot"),(0,r.K)(x,"isBandAxisData"),(0,r.K)(d,"isLinearAxisData");var p=class{constructor(t){this.parentGroup=t}static{(0,r.K)(this,"TextDimensionCalculatorWithFont")}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce((t,i)=>Math.max(i.length,t),0)*i,height:i};const e={width:0,height:0},s=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(const n of t){const t=(0,a.W6)(s,1,n),h=t?t.width:n.length*i,o=t?t.height:i;e.width=Math.max(e.width,h),e.height=Math.max(e.height,o)}return s.remove(),e}},f=class{constructor(t,i,e,s){this.axisConfig=t,this.title=i,this.textDimensionCalculator=e,this.axisThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.normalizedLabelRotationInRad=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.normalizedLabelRotationInRad=this.axisConfig.labelRotation>=-90&&this.axisConfig.labelRotation<=90?this.axisConfig.labelRotation*Math.PI/180:0}static{(0,r.K)(this,"BaseAxis")}setRange(t){this.range=t,"left"===this.axisPosition||"right"===this.axisPosition?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){const t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){.7*this.getTickDistance()>2*this.outerPadding&&(this.outerPadding=Math.floor(.7*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const e=this.getLabelDimension(),s=.2*t.width;this.outerPadding=Math.min(e.width/2,s);let a=e.height;"bottom"===this.axisPosition&&0!==this.normalizedLabelRotationInRad&&(a=Math.max(a,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*e.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*e.height))),a+=2*this.axisConfig.labelPadding,this.labelTextHeight=e.height,a<=i&&(i-=a,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const t=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),e=t.height+2*this.axisConfig.titlePadding;this.titleTextHeight=t.height,e<=i&&(i-=e,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const e=this.getLabelDimension(),s=.2*t.height;this.outerPadding=Math.min(e.height/2,s);const a=e.width+2*this.axisConfig.labelPadding;a<=i&&(i-=a,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const t=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),e=t.height+2*this.axisConfig.titlePadding;this.titleTextHeight=t.height,e<=i&&(i-=e,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return"left"===this.axisPosition||"right"===this.axisPosition?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateOffsetByRotation(t){const i=this.normalizedLabelRotationInRad;return 0===i?0:Math.sin(i)*this.getLabelDimension()[t]/2}getDrawableElementsForLeftAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(t),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){const i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(t=>({path:`M ${i},${this.getScaleValue(t)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(t)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.getScaleValue(t)+this.calculateOffsetByRotation("height"),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0)+Math.abs(this.calculateOffsetByRotation("width")),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:180*this.normalizedLabelRotationInRad/Math.PI,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(t=>({path:`M ${this.getScaleValue(t)},${i} L ${this.getScaleValue(t)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.getScaleValue(t),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+2*this.axisConfig.titlePadding:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(t=>({path:`M ${this.getScaleValue(t)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(t)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if("left"===this.axisPosition)return this.getDrawableElementsForLeftAxis();if("right"===this.axisPosition)throw Error("Drawing of right axis is not implemented");return"bottom"===this.axisPosition?this.getDrawableElementsForBottomAxis():"top"===this.axisPosition?this.getDrawableElementsForTopAxis():[]}},m=class extends f{static{(0,r.K)(this,"BandAxis")}constructor(t,i,e,s,a){super(t,s,a,i),this.categories=e,this.scale=(0,l.WH)().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=(0,l.WH)().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),o.R.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},y=class extends f{static{(0,r.K)(this,"LinearAxis")}constructor(t,i,e,s,a){super(t,s,a,i),this.domain=e,this.scale=(0,l.m4Y)().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){const t=[...this.domain];"left"===this.axisPosition&&t.reverse(),this.scale=(0,l.m4Y)().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}};function b(t,i,e,s){const a=new p(s);return x(t)?new m(i,e,t.categories,t.title,a):new y(i,e,[t.min,t.max],t.title,a)}(0,r.K)(b,"getAxis");var w=class{constructor(t,i,e,s){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=e,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{(0,r.K)(this,"ChartTitle")}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){const i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),e=Math.max(i.width,t.width),s=i.height+2*this.chartConfig.titlePadding;return i.width<=e&&i.height<=s&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=e,this.boundingRect.height=s,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){const t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}};function S(t,i,e,s){const a=new p(s);return new w(a,t,i,e)}(0,r.K)(S,"getChartTitleComponent");function A(t){return{fontSize:t,markerSize:.75*t,markerSpacing:.35*t,itemSpacing:.5*t}}(0,r.K)(A,"getLegendLayout");var C=class{constructor(t,i,e,s){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=e,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.visiblePlots=[]}static{(0,r.K)(this,"ChartLegend")}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){if(this.visiblePlots=this.chartConfig.showLegend?this.chartData.plots.filter(t=>t.title):[],0===this.visiblePlots.length)return this.boundingRect.width=0,this.boundingRect.height=0,{width:0,height:0};const{fontSize:i,markerSize:e,markerSpacing:s,itemSpacing:a}=A(this.chartConfig.legendFontSize),n=this.textDimensionCalculator.getMaxDimension(this.visiblePlots.map(t=>t.title),i),h=2*this.chartConfig.legendPadding+e+s+n.width,o=2*this.chartConfig.legendPadding+this.visiblePlots.length*i+(this.visiblePlots.length-1)*a;return h<=t.width&&o<=t.height?(this.boundingRect.width=h,this.boundingRect.height=o):(this.visiblePlots=[],this.boundingRect.width=0,this.boundingRect.height=0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(0===this.visiblePlots.length)return[];const{fontSize:t,markerSize:i,markerSpacing:e,itemSpacing:s}=A(this.chartConfig.legendFontSize),a=t+s,n=this.boundingRect.x+this.chartConfig.legendPadding,h=this.boundingRect.y+this.chartConfig.legendPadding,o=[],r=[];for(const[t,e]of this.visiblePlots.entries())if(u(e))o.push({x:n,y:h+t*a,width:i,height:i,fill:e.fill,strokeFill:e.fill,strokeWidth:0});else{const s=h+t*a+i/2;r.push({path:`M ${n},${s} L ${n+i},${s}`,strokeFill:e.strokeFill,strokeWidth:e.strokeWidth})}return[{groupTexts:["legend","markers"],type:"rect",data:o},{groupTexts:["legend","markers"],type:"path",data:r},{groupTexts:["legend","label"],type:"text",data:this.visiblePlots.map((s,o)=>({text:s.title,x:n+i+e,y:h+o*a+i/2,fill:this.chartThemeConfig.legendTextColor,fontSize:t,rotation:0,verticalPos:"middle",horizontalPos:"left"}))}]}};function k(t,i,e,s){const a=new p(s);return new C(a,t,i,e)}(0,r.K)(k,"getChartLegendComponent");var R=class{constructor(t,i,e,s,a){this.plotData=t,this.xAxis=i,this.yAxis=e,this.orientation=s,this.plotIndex=a}static{(0,r.K)(this,"LinePlot")}getDrawableElement(){const t=this.plotData.data.map(t=>[this.xAxis.getScaleValue(t[0]),this.yAxis.getScaleValue(t[1])]);let i;if(i="horizontal"===this.orientation?(0,l.n8j)().y(t=>t[0]).x(t=>t[1])(t):(0,l.n8j)().x(t=>t[0]).y(t=>t[1])(t),!i)return[];const e=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){const i=10,s=12,a=[];for(const[e,[n,h]]of t.entries()){const t=this.plotData.pointLabels[e];t&&("horizontal"===this.orientation?a.push({x:h+i,y:n,text:t,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:s,rotation:0}):a.push({x:n,y:h-i,text:t,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:s,rotation:0}))}a.length>0&&e.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:a})}return e}},_=class{constructor(t,i,e,s,a,n){this.barData=t,this.boundingRect=i,this.xAxis=e,this.yAxis=s,this.orientation=a,this.plotIndex=n}static{(0,r.K)(this,"BarPlot")}getDrawableElement(){const t=this.barData.data.map(t=>[this.xAxis.getScaleValue(t[0]),this.yAxis.getScaleValue(t[1])]),i=.95*Math.min(2*this.xAxis.getAxisOuterPadding(),this.xAxis.getTickDistance()),e=i/2;return"horizontal"===this.orientation?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(t=>({x:this.boundingRect.x,y:t[0]-e,height:i,width:t[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(t=>({x:t[0]-e,y:t[1],width:i,height:this.boundingRect.y+this.boundingRect.height-t[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},T=class{constructor(t,i,e){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=e,this.boundingRect={x:0,y:0,width:0,height:0}}static{(0,r.K)(this,"BasePlot")}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!this.xAxis||!this.yAxis)throw Error("Axes must be passed to render Plots");const t=[];for(const[i,e]of this.chartData.plots.entries())switch(e.type){case"line":{const s=new R(e,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...s.getDrawableElement())}break;case"bar":{const s=new _(e,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...s.getDrawableElement())}}return t}};function D(t,i,e){return new T(t,i,e)}(0,r.K)(D,"getPlotComponent");var L,P=class{constructor(t,i,e,s){this.chartConfig=t,this.chartData=i,this.componentStore={title:S(t,i,e,s),plot:D(t,i,e),legend:k(t,i,e,s),xAxis:b(i.xAxis,t.xAxis,{titleColor:e.xAxisTitleColor,labelColor:e.xAxisLabelColor,tickColor:e.xAxisTickColor,axisLineColor:e.xAxisLineColor},s),yAxis:b(i.yAxis,t.yAxis,{titleColor:e.yAxisTitleColor,labelColor:e.yAxisLabelColor,tickColor:e.yAxisTickColor,axisLineColor:e.yAxisLineColor},s)}}static{(0,r.K)(this,"Orchestrator")}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,s=0,a={width:0,height:0},n=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),h=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),o=this.componentStore.plot.calculateSpace({width:n,height:h});t-=o.width,i-=o.height,o=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=o.height,i-=o.height,this.componentStore.xAxis.setAxisPosition("bottom"),o=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=o.height,this.componentStore.yAxis.setAxisPosition("left"),o=this.componentStore.yAxis.calculateSpace({width:t,height:i}),e=o.width,t-=o.width,a=this.componentStore.legend.calculateSpace({width:t,height:h}),t-=a.width,t>0&&(n+=t,t=0),i>0&&(h+=i,i=0),this.componentStore.plot.calculateSpace({width:n,height:h}),this.componentStore.plot.setBoundingBoxXY({x:e,y:s}),this.componentStore.legend.setBoundingBoxXY({x:e+n,y:s+Math.max((h-a.height)/2,0)}),this.componentStore.xAxis.setRange([e,e+n]),this.componentStore.xAxis.setBoundingBoxXY({x:e,y:s+h}),this.componentStore.yAxis.setRange([s,s+h]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:s}),this.chartData.plots.some(t=>u(t))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,s=0,a=0,n={width:0,height:0},h=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),o=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),r=this.componentStore.plot.calculateSpace({width:h,height:o});t-=r.width,i-=r.height,r=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),e=r.height,i-=r.height,this.componentStore.xAxis.setAxisPosition("left"),r=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=r.width,s=r.width,this.componentStore.yAxis.setAxisPosition("top"),r=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=r.height,a=e+r.height,n=this.componentStore.legend.calculateSpace({width:t,height:o}),t-=n.width,t>0&&(h+=t,t=0),i>0&&(o+=i,i=0),this.componentStore.plot.calculateSpace({width:h,height:o}),this.componentStore.plot.setBoundingBoxXY({x:s,y:a}),this.componentStore.legend.setBoundingBoxXY({x:s+h,y:a+Math.max((o-n.height)/2,0)}),this.componentStore.yAxis.setRange([s,s+h]),this.componentStore.yAxis.setBoundingBoxXY({x:s,y:e}),this.componentStore.xAxis.setRange([a,a+o]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:a}),this.chartData.plots.some(t=>u(t))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){"horizontal"===this.chartConfig.chartOrientation?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();const t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(const i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}},v=class{static{(0,r.K)(this,"XYChartBuilder")}static build(t,i,e,s){return new P(t,i,e,s).getDrawableElement()}},E=0,K=F(),z=W(),I=O(),M=z.plotColorPalette.split(",").map(t=>t.trim()),$=!1,B=!1;function W(){const t=(0,h.P$)(),i=(0,h.zj)();return(0,n.$t)(t.xyChart,i.themeVariables.xyChart)}function F(){const t=(0,h.zj)();return(0,n.$t)(h.UI.xyChart,t.xyChart)}function O(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function X(t){const i=(0,h.zj)();return(0,h.jZ)(t.trim(),i)}function N(t){L=t}function Y(t){K.chartOrientation="horizontal"===t?"horizontal":"vertical"}function V(t){I.xAxis.title=X(t.text)}function H(t,i){I.xAxis={type:"linear",title:I.xAxis.title,min:t,max:i},$=!0}function U(t){I.xAxis={type:"band",title:I.xAxis.title,categories:t.map(t=>X(t.text))},$=!0}function j(t){I.yAxis.title=X(t.text)}function G(t,i){I.yAxis={type:"linear",title:I.yAxis.title,min:t,max:i},B=!0}function Q(t){const i=Math.min(...t),e=Math.max(...t),s=d(I.yAxis)?I.yAxis.min:1/0,a=d(I.yAxis)?I.yAxis.max:-1/0;I.yAxis={type:"linear",title:I.yAxis.title,min:Math.min(s,i),max:Math.max(a,e)}}function Z(t){let i=[];if(0===t.length)return i;if(!$){const i=d(I.xAxis)?I.xAxis.min:1/0,e=d(I.xAxis)?I.xAxis.max:-1/0;H(Math.min(i,1),Math.max(e,t.length))}if(x(I.xAxis)&&t.length>I.xAxis.categories.length&&(t=t.slice(0,I.xAxis.categories.length)),B||Q(t),x(I.xAxis)&&(i=I.xAxis.categories.map((i,e)=>[i,t[e]])),d(I.xAxis)){const e=I.xAxis.min,s=I.xAxis.max;if(1===t.length)i=[[`${e}`,t[0]]];else{const a=(s-e)/(t.length-1);i=t.map((t,i)=>[`${e+i*a}`,t])}}return i}function q(t){return M[0===t?0:t%M.length]}function J(t,i){const e=i.map(t=>t.value),s=i.map(t=>t.label?X(t.label):""),a=Z(e),n=s.some(t=>""!==t);I.plots.push({type:"line",title:X(t.text),strokeFill:q(E),strokeWidth:2,data:a,...n?{pointLabels:s}:{}}),E++}function tt(t,i){const e=Z(i.map(t=>t.value));I.plots.push({type:"bar",title:X(t.text),fill:q(E),data:e}),E++}function it(){if(0===I.plots.length)throw Error("No Plot to render, please provide a plot with some data");return I.title=(0,h.ab)(),v.build(K,I,z,L)}function et(){return z}function st(){return K}function at(){return I}(0,r.K)(W,"getChartDefaultThemeConfig"),(0,r.K)(F,"getChartDefaultConfig"),(0,r.K)(O,"getChartDefaultData"),(0,r.K)(X,"textSanitizer"),(0,r.K)(N,"setTmpSVGG"),(0,r.K)(Y,"setOrientation"),(0,r.K)(V,"setXAxisTitle"),(0,r.K)(H,"setXAxisRangeData"),(0,r.K)(U,"setXAxisBand"),(0,r.K)(j,"setYAxisTitle"),(0,r.K)(G,"setYAxisRangeData"),(0,r.K)(Q,"setYAxisRangeFromPlotData"),(0,r.K)(Z,"transformDataWithoutCategory"),(0,r.K)(q,"getPlotColorFromPalette"),(0,r.K)(J,"setLineData"),(0,r.K)(tt,"setBarData"),(0,r.K)(it,"getDrawableElem"),(0,r.K)(et,"getChartThemeConfig"),(0,r.K)(st,"getChartConfig"),(0,r.K)(at,"getXYChartData");var nt={parser:g,db:{getDrawableElem:it,clear:(0,r.K)(function(){(0,h.IU)(),E=0,K=F(),I={yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]},z=W(),M=z.plotColorPalette.split(",").map(t=>t.trim()),$=!1,B=!1},"clear"),setAccTitle:h.SV,getAccTitle:h.iN,setDiagramTitle:h.ke,getDiagramTitle:h.ab,getAccDescription:h.m7,setAccDescription:h.EI,setOrientation:Y,setXAxisTitle:V,setXAxisRangeData:H,setXAxisBand:U,setYAxisTitle:j,setYAxisRangeData:G,setLineData:J,setBarData:tt,setTmpSVGG:N,getChartThemeConfig:et,getChartConfig:st,getXYChartData:at},renderer:{draw:(0,r.K)((t,i,e,a)=>{const n=a.db,l=n.getChartThemeConfig(),c=n.getChartConfig(),g=n.getXYChartData().plots[0].data.map(t=>t[1]);function u(t){return"top"===t?"text-before-edge":"middle"}function x(t){return"left"===t?"start":"right"===t?"end":"middle"}function d(t){return`translate(${t.x}, ${t.y}) rotate(${t.rotation||0})`}(0,r.K)(u,"getDominantBaseLine"),(0,r.K)(x,"getTextAnchor"),(0,r.K)(d,"getTextTransformation"),o.R.debug("Rendering xychart chart\n"+t);const p=(0,s.D)(i),f=p.append("g").attr("class","main"),m=f.append("rect").attr("width",c.width).attr("height",c.height).attr("class","background");(0,h.a$)(p,c.height,c.width,!0),p.attr("viewBox",`0 0 ${c.width} ${c.height}`),m.attr("fill",l.backgroundColor),n.setTmpSVGG(p.append("g").attr("class","mermaid-tmp-group"));const y=n.getDrawableElem(),b={};function w(t){let i=f,e="";for(const[s]of t.entries()){let a=f;s>0&&b[e]&&(a=b[e]),e+=t[s],i=b[e],i||(i=b[e]=a.append("g").attr("class",t[s]))}return i}(0,r.K)(w,"getGroup");for(const t of y){if(0===t.data.length)continue;const i=w(t.groupTexts);switch(t.type){case"rect":if(i.selectAll("rect").data(t.data).enter().append("rect").attr("x",t=>t.x).attr("y",t=>t.y).attr("width",t=>t.width).attr("height",t=>t.height).attr("fill",t=>t.fill).attr("stroke",t=>t.strokeFill).attr("stroke-width",t=>t.strokeWidth),c.showDataLabel){const e=c.showDataLabelOutsideBar;if("horizontal"===c.chartOrientation){let s=function(t,i){const{data:e,label:s}=t;return i*s.length*a<=e.width-n};(0,r.K)(s,"fitsHorizontally");const a=.7,n=10,h=t.data.map((t,i)=>({data:t,label:g[i].toString()})).filter(t=>t.data.width>0&&t.data.height>0),o=h.map(t=>{const{data:i}=t;let e=.7*i.height;for(;!s(t,e)&&e>0;)e-=1;return e}),c=Math.floor(Math.min(...o)),u=(0,r.K)(t=>e?t.data.x+t.data.width+n:t.data.x+t.data.width-n,"determineLabelXPosition");i.selectAll("text").data(h).enter().append("text").attr("x",u).attr("y",t=>t.data.y+t.data.height/2).attr("text-anchor",e?"start":"end").attr("dominant-baseline","middle").attr("fill",l.dataLabelColor).attr("font-size",`${c}px`).text(t=>t.label)}else{let s=function(t,i,e){const{data:s,label:a}=t,n=i*a.length*.7,h=s.x+s.width/2,o=h+n/2,r=h-n/2>=s.x&&o<=s.x+s.width,l=s.y+e+i<=s.y+s.height;return r&&l};(0,r.K)(s,"fitsInBar");const a=10,n=t.data.map((t,i)=>({data:t,label:g[i].toString()})).filter(t=>t.data.width>0&&t.data.height>0),h=n.map(t=>{const{data:i,label:e}=t;let n=i.width/(.7*e.length);for(;!s(t,n,a)&&n>0;)n-=1;return n}),o=Math.floor(Math.min(...h)),c=(0,r.K)(t=>e?t.data.y-a:t.data.y+a,"determineLabelYPosition");i.selectAll("text").data(n).enter().append("text").attr("x",t=>t.data.x+t.data.width/2).attr("y",c).attr("text-anchor","middle").attr("dominant-baseline",e?"auto":"hanging").attr("fill",l.dataLabelColor).attr("font-size",`${o}px`).text(t=>t.label)}}break;case"text":i.selectAll("text").data(t.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",t=>t.fill).attr("font-size",t=>t.fontSize).attr("dominant-baseline",t=>u(t.verticalPos)).attr("text-anchor",t=>x(t.horizontalPos)).attr("transform",t=>d(t)).text(t=>t.text);break;case"path":i.selectAll("path").data(t.data).enter().append("path").attr("d",t=>t.path).attr("fill",t=>t.fill?t.fill:"none").attr("stroke",t=>t.strokeFill).attr("stroke-width",t=>t.strokeWidth)}}},"draw")}}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[4220],{94220(t,e,a){a.d(e,{diagram:()=>z});var i,n=a(13230),r=(a(96755),a(1672),a(10561),a(338),a(24980),a(27838),a(96865),a(48159),a(44505),a(69793),a(43287),a(12505)),d=a(86535),s=a(31293),o=a(86827),g=a(51444),p=a(84193),h=a(697),c=(0,o.K)(t=>t.append("circle").attr("class","start-state").attr("r",(0,d.D7)().state.sizeUnit).attr("cx",(0,d.D7)().state.padding+(0,d.D7)().state.sizeUnit).attr("cy",(0,d.D7)().state.padding+(0,d.D7)().state.sizeUnit),"drawStartState"),l=(0,o.K)(t=>t.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",(0,d.D7)().state.textHeight).attr("class","divider").attr("x2",2*(0,d.D7)().state.textHeight).attr("y1",0).attr("y2",0),"drawDivider"),x=(0,o.K)((t,e)=>{const a=t.append("text").attr("x",2*(0,d.D7)().state.padding).attr("y",(0,d.D7)().state.textHeight+2*(0,d.D7)().state.padding).attr("font-size",(0,d.D7)().state.fontSize).attr("class","state-title").text(e.id),i=a.node().getBBox();return t.insert("rect",":first-child").attr("x",(0,d.D7)().state.padding).attr("y",(0,d.D7)().state.padding).attr("width",i.width+2*(0,d.D7)().state.padding).attr("height",i.height+2*(0,d.D7)().state.padding).attr("rx",(0,d.D7)().state.radius),a},"drawSimpleState"),D=(0,o.K)((t,e)=>{const a=(0,o.K)(function(t,e,a){const i=t.append("tspan").attr("x",2*(0,d.D7)().state.padding).text(e);a||i.attr("dy",(0,d.D7)().state.textHeight)},"addTspan"),i=t.append("text").attr("x",2*(0,d.D7)().state.padding).attr("y",(0,d.D7)().state.textHeight+1.3*(0,d.D7)().state.padding).attr("font-size",(0,d.D7)().state.fontSize).attr("class","state-title").text(e.descriptions[0]).node().getBBox(),n=i.height,r=t.append("text").attr("x",(0,d.D7)().state.padding).attr("y",n+.4*(0,d.D7)().state.padding+(0,d.D7)().state.dividerMargin+(0,d.D7)().state.textHeight).attr("class","state-description");let s=!0,g=!0;e.descriptions.forEach(function(t){s||(a(r,t,g),g=!1),s=!1});const p=t.append("line").attr("x1",(0,d.D7)().state.padding).attr("y1",(0,d.D7)().state.padding+n+(0,d.D7)().state.dividerMargin/2).attr("y2",(0,d.D7)().state.padding+n+(0,d.D7)().state.dividerMargin/2).attr("class","descr-divider"),h=r.node().getBBox(),c=Math.max(h.width,i.width);return p.attr("x2",c+3*(0,d.D7)().state.padding),t.insert("rect",":first-child").attr("x",(0,d.D7)().state.padding).attr("y",(0,d.D7)().state.padding).attr("width",c+2*(0,d.D7)().state.padding).attr("height",h.height+n+2*(0,d.D7)().state.padding).attr("rx",(0,d.D7)().state.radius),t},"drawDescrState"),u=(0,o.K)((t,e,a)=>{const i=(0,d.D7)().state.padding,n=2*(0,d.D7)().state.padding,r=t.node().getBBox(),s=r.width,o=r.x,g=t.append("text").attr("x",0).attr("y",(0,d.D7)().state.titleShift).attr("font-size",(0,d.D7)().state.fontSize).attr("class","state-title").text(e.id),p=g.node().getBBox().width+n;let h,c=Math.max(p,s);c===s&&(c+=n);const l=t.node().getBBox();e.doc,h=o-i,p>s&&(h=(s-c)/2+i),Math.abs(o-l.x)<i&&p>s&&(h=o-(p-s)/2);const x=1-(0,d.D7)().state.textHeight;return t.insert("rect",":first-child").attr("x",h).attr("y",x).attr("class",a?"alt-composit":"composit").attr("width",c).attr("height",l.height+(0,d.D7)().state.textHeight+(0,d.D7)().state.titleShift+1).attr("rx","0"),g.attr("x",h+i),p<=s&&g.attr("x",o+(c-n)/2-p/2+i),t.insert("rect",":first-child").attr("x",h).attr("y",(0,d.D7)().state.titleShift-(0,d.D7)().state.textHeight-(0,d.D7)().state.padding).attr("width",c).attr("height",3*(0,d.D7)().state.textHeight).attr("rx",(0,d.D7)().state.radius),t.insert("rect",":first-child").attr("x",h).attr("y",(0,d.D7)().state.titleShift-(0,d.D7)().state.textHeight-(0,d.D7)().state.padding).attr("width",c).attr("height",l.height+3+2*(0,d.D7)().state.textHeight).attr("rx",(0,d.D7)().state.radius),t},"addTitleAndBox"),f=(0,o.K)(t=>(t.append("circle").attr("class","end-state-outer").attr("r",(0,d.D7)().state.sizeUnit+(0,d.D7)().state.miniPadding).attr("cx",(0,d.D7)().state.padding+(0,d.D7)().state.sizeUnit+(0,d.D7)().state.miniPadding).attr("cy",(0,d.D7)().state.padding+(0,d.D7)().state.sizeUnit+(0,d.D7)().state.miniPadding),t.append("circle").attr("class","end-state-inner").attr("r",(0,d.D7)().state.sizeUnit).attr("cx",(0,d.D7)().state.padding+(0,d.D7)().state.sizeUnit+2).attr("cy",(0,d.D7)().state.padding+(0,d.D7)().state.sizeUnit+2)),"drawEndState"),y=(0,o.K)((t,e)=>{let a=(0,d.D7)().state.forkWidth,i=(0,d.D7)().state.forkHeight;if(e.parentId){let t=a;a=i,i=t}return t.append("rect").style("stroke","black").style("fill","black").attr("width",a).attr("height",i).attr("x",(0,d.D7)().state.padding).attr("y",(0,d.D7)().state.padding)},"drawForkJoinState"),w=(0,o.K)((t,e,a,i)=>{let n=0;const r=i.append("text");r.style("text-anchor","start"),r.attr("class","noteText");let s=t.replace(/\r\n/g,"<br/>");s=s.replace(/\n/g,"<br/>");const o=s.split(d.Y2.lineBreakRegex);let g=1.25*(0,d.D7)().state.noteMargin;for(const t of o){const i=t.trim();if(i.length>0){const t=r.append("tspan");if(t.text(i),0===g){g+=t.node().getBBox().height}n+=g,t.attr("x",e+(0,d.D7)().state.noteMargin),t.attr("y",a+n+1.25*(0,d.D7)().state.noteMargin)}}return{textWidth:r.node().getBBox().width,textHeight:n}},"_drawLongText"),b=(0,o.K)((t,e)=>{e.attr("class","state-note");const a=e.append("rect").attr("x",0).attr("y",(0,d.D7)().state.padding),i=e.append("g"),{textWidth:n,textHeight:r}=w(t,0,0,i);return a.attr("height",r+2*(0,d.D7)().state.noteMargin),a.attr("width",n+2*(0,d.D7)().state.noteMargin),a},"drawNote"),B=(0,o.K)(function(t,e){const a=e.id,i={id:a,label:e.id,width:0,height:0},n=t.append("g").attr("id",a).attr("class","stateGroup");"start"===e.type&&c(n),"end"===e.type&&f(n),"fork"!==e.type&&"join"!==e.type||y(n,e),"note"===e.type&&b(e.note.text,n),"divider"===e.type&&l(n),"default"===e.type&&0===e.descriptions.length&&x(n,e),"default"===e.type&&e.descriptions.length>0&&D(n,e);const r=n.node().getBBox();return i.width=r.width+2*(0,d.D7)().state.padding,i.height=r.height+2*(0,d.D7)().state.padding,i},"drawState"),m=0,k=(0,o.K)(function(t,e,a){const i=(0,o.K)(function(t){switch(t){case n.u4.relationType.AGGREGATION:return"aggregation";case n.u4.relationType.EXTENSION:return"extension";case n.u4.relationType.COMPOSITION:return"composition";case n.u4.relationType.DEPENDENCY:return"dependency"}},"getRelationType");e.points=e.points.filter(t=>!Number.isNaN(t.y));const p=e.points,h=(0,g.n8j)().x(function(t){return t.x}).y(function(t){return t.y}).curve(g.qrM),c=t.append("path").attr("d",h(p)).attr("id","edge"+m).attr("class","transition");let l="";if((0,d.D7)().state.arrowMarkerAbsolute&&(l=(0,d.ID)(!0)),c.attr("marker-end","url("+l+"#"+i(n.u4.relationType.DEPENDENCY)+"End)"),void 0!==a.title){const i=t.append("g").attr("class","stateLabel"),{x:n,y:o}=r._K.calcLabelPosition(e.points),g=d.Y2.getRows(a.title);let p=0;const h=[];let c=0,l=0;for(let t=0;t<=g.length;t++){const e=i.append("text").attr("text-anchor","middle").text(g[t]).attr("x",n).attr("y",o+p),a=e.node().getBBox();if(c=Math.max(c,a.width),l=Math.min(l,a.x),s.R.info(a.x,n,o+p),0===p){const t=e.node().getBBox();p=t.height,s.R.info("Title height",p,o)}h.push(e)}let x=p*g.length;if(g.length>1){const t=(g.length-1)*p*.5;h.forEach((e,a)=>e.attr("y",o+a*p-t)),x=p*g.length}const D=i.node().getBBox();i.insert("rect",":first-child").attr("class","box").attr("x",n-c/2-(0,d.D7)().state.padding/2).attr("y",o-x/2-(0,d.D7)().state.padding/2-3.5).attr("width",c+(0,d.D7)().state.padding).attr("height",x+(0,d.D7)().state.padding),s.R.info(D)}m++},"drawEdge"),S={},N=(0,o.K)(function(){},"setConf"),E=(0,o.K)(function(t){t.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),M=(0,o.K)(function(t,e,a,n){i=(0,d.D7)().state;const r=(0,d.D7)().securityLevel;let o;"sandbox"===r&&(o=(0,g.Ltv)("#i"+e));const p="sandbox"===r?(0,g.Ltv)(o.nodes()[0].contentDocument.body):(0,g.Ltv)("body"),h="sandbox"===r?o.nodes()[0].contentDocument:document;s.R.debug("Rendering diagram "+t);const c=p.select(`[id='${e}']`);E(c);const l=n.db.getRootDoc(),x=c.append("g").attr("id",e+"-root");K(l,x,void 0,!1,p,h,n);const D=i.padding,u=c.node().getBBox(),f=u.width+2*D,y=u.height+2*D,w=1.75*f;(0,d.a$)(c,y,w,i.useMaxWidth),c.attr("viewBox",`${u.x-i.padding} ${u.y-i.padding} `+f+" "+y)},"draw"),v=(0,o.K)(t=>t?t.length*i.fontSizeFactor:1,"getLabelWidth"),K=(0,o.K)((t,e,a,n,r,o,g)=>{const c=new h.T({compound:!0,multigraph:!0});let l,x=!0;for(l=0;l<t.length;l++)if("relation"===t[l].stmt){x=!1;break}a?c.setGraph({rankdir:"LR",multigraph:!0,compound:!0,ranker:"tight-tree",ranksep:x?1:i.edgeLengthFactor,nodeSep:x?1:50,isMultiGraph:!0}):c.setGraph({rankdir:"TB",multigraph:!0,compound:!0,ranksep:x?1:i.edgeLengthFactor,nodeSep:x?1:50,ranker:"tight-tree",isMultiGraph:!0}),c.setDefaultEdgeLabel(function(){return{}});const D=g.db.getStates(),f=g.db.getRelations(),y=Object.keys(D);for(const t of y){const d=D[t];let s;if(a&&(d.parentId=a),d.doc){let t=e.append("g").attr("id",d.id).attr("class","stateGroup");s=K(d.doc,t,d.id,!n,r,o,g);{t=u(t,d,n);let e=t.node().getBBox();s.width=e.width,s.height=e.height+i.padding/2,S[d.id]={y:i.compositTitleSize}}}else s=B(e,d,c);if(d.note){const t={descriptions:[],id:d.id+"-note",note:d.note,type:"note"},a=B(e,t,c);"left of"===d.note.position?(c.setNode(s.id+"-note",a),c.setNode(s.id,s)):(c.setNode(s.id,s),c.setNode(s.id+"-note",a)),c.setParent(s.id,s.id+"-group"),c.setParent(s.id+"-note",s.id+"-group")}else c.setNode(s.id,s)}s.R.debug("Count=",c.nodeCount(),c);let w=0;f.forEach(function(t){w++,s.R.debug("Setting edge",t),c.setEdge(t.id1,t.id2,{relation:t,width:v(t.title),height:i.labelHeight*d.Y2.getRows(t.title).length,labelpos:"c"},"id"+w)}),(0,p.Zp)(c),s.R.debug("Graph after layout",c.nodes());const b=e.node();c.nodes().forEach(function(t){if(void 0!==t&&void 0!==c.node(t)){s.R.warn("Node "+t+": "+JSON.stringify(c.node(t))),r.select("#"+b.id+" #"+t).attr("transform","translate("+(c.node(t).x-c.node(t).width/2)+","+(c.node(t).y+(S[t]?S[t].y:0)-c.node(t).height/2)+" )"),r.select("#"+b.id+" #"+t).attr("data-x-shift",c.node(t).x-c.node(t).width/2);o.querySelectorAll("#"+b.id+" #"+t+" .divider").forEach(t=>{const e=t.parentElement;let a=0,i=0;e&&(e.parentElement&&(a=e.parentElement.getBBox().width),i=parseInt(e.getAttribute("data-x-shift"),10),Number.isNaN(i)&&(i=0)),t.setAttribute("x1",0-i+8),t.setAttribute("x2",a-i-8)})}else s.R.debug("No Node "+t+": "+JSON.stringify(c.node(t)))});let m=b.getBBox();c.edges().forEach(function(t){void 0!==t&&void 0!==c.edge(t)&&(s.R.debug("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(c.edge(t))),k(e,c.edge(t),c.edge(t).relation))}),m=b.getBBox();const N={id:a||"root",label:a||"root",width:0,height:0};return N.width=m.width+2*i.padding,N.height=m.height+2*i.padding,s.R.debug("Doc rendered",N,c),N},"renderDoc"),R={setConf:N,draw:M},z={parser:n.Zk,get db(){return new n.u4(1)},renderer:R,styles:n.tM,init:(0,o.K)(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")}}}]);