agent-whiteboard 1.0.4 → 1.2.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 (202) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/README.md +61 -5
  3. package/dist/client/assets/abnfDiagram-VCTEODGH-Dj8sd_5g.js +1 -0
  4. package/dist/client/assets/{arc-4691b008.js → arc-Aq92EeUK.js} +1 -1
  5. package/dist/client/assets/architectureDiagram-5GKGNRK7-B1QyVL0F.js +36 -0
  6. package/dist/client/assets/blockDiagram-I7D4REHJ-CmU2SSFe.js +129 -0
  7. package/dist/client/assets/{bootstrap.min-21652813.js → bootstrap.min-UtnB-TxT.js} +1 -2
  8. package/dist/client/assets/c4Diagram-7LVT6UL2-DWmhp77c.js +38 -0
  9. package/dist/client/assets/channel-C9ni1Via.js +1 -0
  10. package/dist/client/assets/{chunk-QZHKN3VN-0f554985.js → chunk-2Q5K7J3B-CQLo8Sbv.js} +1 -1
  11. package/dist/client/assets/{chunk-FMBD7UC4-23d48b24.js → chunk-5VM5RSS4-fJTWmTTt.js} +1 -1
  12. package/dist/client/assets/{chunk-ND2GUHAM-1104c326.js → chunk-F27PBJKO-DqzEf5gi.js} +1 -1
  13. package/dist/client/assets/chunk-IMKFNOWR-CMamLTz3.js +231 -0
  14. package/dist/client/assets/{chunk-4BX2VUAB-3c93511d.js → chunk-JWPE2WC7-tyYPyD43.js} +1 -1
  15. package/dist/client/assets/chunk-POPQ4Y6H-XdY4rO_V.js +1 -0
  16. package/dist/client/assets/chunk-SVP7TREG-COvqzqaO.js +88 -0
  17. package/dist/client/assets/chunk-TICWLB2K-BsJSFuPC.js +206 -0
  18. package/dist/client/assets/{chunk-55IACEB6-0243aefd.js → chunk-XXDRQBXY-HfVrYBJb.js} +1 -1
  19. package/dist/client/assets/classDiagram-ZZMXUADV-DktNEiGC.js +1 -0
  20. package/dist/client/assets/classDiagram-v2-VYDZK3BY-DktNEiGC.js +1 -0
  21. package/dist/client/assets/cose-bilkent-JH36ORCC-UXGdwSjS.js +1 -0
  22. package/dist/client/assets/cynefin-OW5HDTMX-PWlPYnpn.js +178 -0
  23. package/dist/client/assets/cynefinDiagram-5FMLGOSQ-CYE5H1wR.js +62 -0
  24. package/dist/client/assets/cytoscape.esm-C5JX3QLV.js +331 -0
  25. package/dist/client/assets/dagre-GXQ25YYZ-DaknBOKq.js +4 -0
  26. package/dist/client/assets/diagram-S7CK7UJ4-Dz7rZHxF.js +30 -0
  27. package/dist/client/assets/diagram-UQ7AKVKN-DzCi6tiS.js +41 -0
  28. package/dist/client/assets/{diagram-KO2AKTUF-81f42eeb.js → diagram-VSXAHHWV-TlUzhXgv.js} +3 -3
  29. package/dist/client/assets/diagram-VX7I27RA-Ds7jdzK7.js +24 -0
  30. package/dist/client/assets/diagram-Z3DM3KII-C--JD7cf.js +24 -0
  31. package/dist/client/assets/ebnfDiagram-PWID7BFC-Dw5OM-dL.js +1 -0
  32. package/dist/client/assets/embed-DcNeILcO.js +211 -0
  33. package/dist/client/assets/erDiagram-RLTQ6QDP-DXalBHjA.js +99 -0
  34. package/dist/client/assets/flowDiagram-HODETNUW-DcI3UqyE.js +168 -0
  35. package/dist/client/assets/ganttDiagram-EL5Y4UJY-DyrkIo6c.js +292 -0
  36. package/dist/client/assets/gitGraphDiagram-WWUBYQGX-fJKfGRcg.js +106 -0
  37. package/dist/client/assets/index-CIhkXT_z.js +19 -0
  38. package/dist/client/assets/index-DEiH2AE7.css +1 -0
  39. package/dist/client/assets/infoDiagram-27XIBGKW-Cijiqswb.js +2 -0
  40. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-50b43d03.js → ishikawaDiagram-5VMMS53U-C1WqWU2l.js} +2 -2
  41. package/dist/client/assets/{journeyDiagram-JHISSGLW-dce41bdf.js → journeyDiagram-3NMN7TZE-7j05mbLR.js} +4 -4
  42. package/dist/client/assets/{kanban-definition-UN3LZRKU-92401a86.js → kanban-definition-UXKFOSKX-D5mGDfs_.js} +1 -1
  43. package/dist/client/assets/{katex-4c9ea27f.js → katex-BTI-AXqd.js} +3 -3
  44. package/dist/client/assets/{katex-0cba7652.js → katex-C5jXJg4s.js} +3 -3
  45. package/dist/client/assets/layout-KEin06-H.js +1 -0
  46. package/dist/client/assets/linear-D1EL1Azg.js +1 -0
  47. package/dist/client/assets/mermaid.core-CLvSDmrA.js +310 -0
  48. package/dist/client/assets/{mindmap-definition-RKZ34NQL-66fe4544.js → mindmap-definition-YA3MSWOX-BsCqKd_d.js} +12 -12
  49. package/dist/client/assets/{ordinal-db88ae6f.js → ordinal-BeghXfj9.js} +1 -1
  50. package/dist/client/assets/pegDiagram-XKGWAZYB-Du5lDU3W.js +1 -0
  51. package/dist/client/assets/pieDiagram-E7YTZNPT-hjv5Ao6B.js +39 -0
  52. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-f64a7ed7.js → quadrantDiagram-AXDQQJYC-DNon8LWK.js} +4 -4
  53. package/dist/client/assets/railroadDiagram-O6MQD6OU-yNZz2zxo.js +1 -0
  54. package/dist/client/assets/requirementDiagram-BXWQKSXE-CZiiEUHW.js +84 -0
  55. package/dist/client/assets/sankeyDiagram-P5KCCOFB-D-u8ZQUV.js +40 -0
  56. package/dist/client/assets/sequenceDiagram-WJ2MYXX4-BxjTf3q9.js +162 -0
  57. package/dist/client/assets/sizeCapture-INFHLROL-Dt4Wg8C5.js +1 -0
  58. package/dist/client/assets/stateDiagram-D77RDMKH-B8BM6dln.js +1 -0
  59. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-MJauX84T.js +1 -0
  60. package/dist/client/assets/step-BEQzeS8V.js +1 -0
  61. package/dist/client/assets/swimlanes-42K2YHIH-eGWrsWAA.js +1 -0
  62. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-BYFu8tyL.js +8 -0
  63. package/dist/client/assets/{time-043b3464.js → time-BaoZouO5.js} +1 -1
  64. package/dist/client/assets/{timeline-definition-PNZ67QCA-b0c81243.js → timeline-definition-24CTP7MA-CAM-3Qj9.js} +10 -10
  65. package/dist/client/assets/vennDiagram-4TSXK5OY-CuFEwwD0.js +34 -0
  66. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-8d4d7626.js → wardleyDiagram-VM6X3IG4-DI5yCVh0.js} +3 -3
  67. package/dist/client/assets/xychartDiagram-S5SC5T6Z-BI0Bn-OQ.js +7 -0
  68. package/dist/client/index.html +2 -3
  69. package/dist/server/app.js +28 -396
  70. package/dist/server/channel.js +5 -3
  71. package/dist/server/export-html.js +30 -60
  72. package/dist/server/export-zip.js +83 -0
  73. package/dist/server/import-zip.js +196 -0
  74. package/dist/server/index.js +2 -1
  75. package/dist/server/mcp.js +28 -13
  76. package/dist/server/port.js +18 -0
  77. package/dist/server/quiz-submission.js +116 -0
  78. package/dist/server/quiz.js +110 -0
  79. package/dist/server/render-core.js +8 -7
  80. package/dist/server/routes/export.js +95 -0
  81. package/dist/server/routes/import.js +24 -0
  82. package/dist/server/routes/quiz.js +12 -0
  83. package/dist/server/routes/render.js +184 -0
  84. package/dist/server/routes/slideshow.js +52 -0
  85. package/dist/server/routes/snapshots.js +119 -0
  86. package/dist/server/snapshot-reader.js +58 -20
  87. package/dist/server/snapshot-writer.js +18 -16
  88. package/dist/server/validate.js +14 -0
  89. package/dist/server/viewport-cache.js +97 -25
  90. package/package.json +13 -7
  91. package/dist/client/assets/architecture-7EHR7CIX-1221aa61.js +0 -1
  92. package/dist/client/assets/architectureDiagram-3BPJPVTR-1eef4d3c.js +0 -36
  93. package/dist/client/assets/blockDiagram-GPEHLZMM-313fb06c.js +0 -132
  94. package/dist/client/assets/c4Diagram-AAUBKEIU-92b023ad.js +0 -10
  95. package/dist/client/assets/channel-5ee4a8a7.js +0 -1
  96. package/dist/client/assets/chunk-2J33WTMH-fb021fdc.js +0 -1
  97. package/dist/client/assets/chunk-727SXJPM-8e0e0228.js +0 -206
  98. package/dist/client/assets/chunk-AQP2D5EJ-2ccc13c2.js +0 -231
  99. package/dist/client/assets/classDiagram-4FO5ZUOK-42ffecb6.js +0 -1
  100. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-42ffecb6.js +0 -1
  101. package/dist/client/assets/cose-bilkent-S5V4N54A-45ec2e52.js +0 -1
  102. package/dist/client/assets/cytoscape.esm-1491e259.js +0 -331
  103. package/dist/client/assets/dagre-BM42HDAG-ed748885.js +0 -4
  104. package/dist/client/assets/diagram-2AECGRRQ-ccc0ddec.js +0 -43
  105. package/dist/client/assets/diagram-5GNKFQAL-342efdea.js +0 -10
  106. package/dist/client/assets/diagram-LMA3HP47-39e66739.js +0 -24
  107. package/dist/client/assets/diagram-OG6HWLK6-b3e61903.js +0 -24
  108. package/dist/client/assets/embed-2b4adf34.js +0 -201
  109. package/dist/client/assets/erDiagram-TEJ5UH35-281f5cc7.js +0 -85
  110. package/dist/client/assets/eventmodeling-FCH6USID-6508120e.js +0 -1
  111. package/dist/client/assets/flowDiagram-I6XJVG4X-c3a4269e.js +0 -162
  112. package/dist/client/assets/ganttDiagram-6RSMTGT7-013b07ec.js +0 -292
  113. package/dist/client/assets/gitGraph-WXDBUCRP-02827359.js +0 -1
  114. package/dist/client/assets/gitGraphDiagram-PVQCEYII-de184acb.js +0 -106
  115. package/dist/client/assets/graph-f3dfaf53.js +0 -1
  116. package/dist/client/assets/index-d674a6a4.css +0 -1
  117. package/dist/client/assets/index-ffc5af4b.js +0 -5
  118. package/dist/client/assets/info-J43DQDTF-81e32294.js +0 -1
  119. package/dist/client/assets/infoDiagram-5YYISTIA-196101ee.js +0 -2
  120. package/dist/client/assets/layout-3a4eff80.js +0 -1
  121. package/dist/client/assets/linear-fed00341.js +0 -1
  122. package/dist/client/assets/mermaid-parser.core-52f9cd92.js +0 -173
  123. package/dist/client/assets/mermaid.core-7dfc221a.js +0 -306
  124. package/dist/client/assets/packet-YPE3B663-278a272a.js +0 -1
  125. package/dist/client/assets/pie-LRSECV5Y-2e55d9ae.js +0 -1
  126. package/dist/client/assets/pieDiagram-4H26LBE5-65b1bcbd.js +0 -30
  127. package/dist/client/assets/radar-GUYGQ44K-608e459f.js +0 -1
  128. package/dist/client/assets/requirementDiagram-4Y6WPE33-90ebf889.js +0 -84
  129. package/dist/client/assets/sankeyDiagram-5OEKKPKP-2d1a83b3.js +0 -40
  130. package/dist/client/assets/sequenceDiagram-3UESZ5HK-aece3633.js +0 -162
  131. package/dist/client/assets/stateDiagram-AJRCARHV-9bd5b5f4.js +0 -1
  132. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-7c16c251.js +0 -1
  133. package/dist/client/assets/step-171ad54a.js +0 -1
  134. package/dist/client/assets/treeView-BLDUP644-e54b9ddb.js +0 -1
  135. package/dist/client/assets/treemap-LRROVOQU-6a81775b.js +0 -1
  136. package/dist/client/assets/vennDiagram-CIIHVFJN-8eaf0464.js +0 -34
  137. package/dist/client/assets/wardley-L42UT6IY-7abd921f.js +0 -1
  138. package/dist/client/assets/xychartDiagram-2RQKCTM6-450f333c.js +0 -7
  139. /package/dist/client/assets/{KaTeX_AMS-Regular-0cdd387c.woff2 → KaTeX_AMS-Regular-BQhdFMY1.woff2} +0 -0
  140. /package/dist/client/assets/{KaTeX_AMS-Regular-30da91e8.woff → KaTeX_AMS-Regular-DMm9YOAa.woff} +0 -0
  141. /package/dist/client/assets/{KaTeX_AMS-Regular-68534840.ttf → KaTeX_AMS-Regular-DRggAlZN.ttf} +0 -0
  142. /package/dist/client/assets/{KaTeX_Caligraphic-Bold-07d8e303.ttf → KaTeX_Caligraphic-Bold-ATXxdsX0.ttf} +0 -0
  143. /package/dist/client/assets/{KaTeX_Caligraphic-Bold-1ae6bd74.woff → KaTeX_Caligraphic-Bold-BEiXGLvX.woff} +0 -0
  144. /package/dist/client/assets/{KaTeX_Caligraphic-Bold-de7701e4.woff2 → KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2} +0 -0
  145. /package/dist/client/assets/{KaTeX_Caligraphic-Regular-3398dd02.woff → KaTeX_Caligraphic-Regular-CTRA-rTL.woff} +0 -0
  146. /package/dist/client/assets/{KaTeX_Caligraphic-Regular-5d53e70a.woff2 → KaTeX_Caligraphic-Regular-Di6jR-x-.woff2} +0 -0
  147. /package/dist/client/assets/{KaTeX_Caligraphic-Regular-ed0b7437.ttf → KaTeX_Caligraphic-Regular-wX97UBjC.ttf} +0 -0
  148. /package/dist/client/assets/{KaTeX_Fraktur-Bold-9163df9c.ttf → KaTeX_Fraktur-Bold-BdnERNNW.ttf} +0 -0
  149. /package/dist/client/assets/{KaTeX_Fraktur-Bold-9be7ceb8.woff → KaTeX_Fraktur-Bold-BsDP51OF.woff} +0 -0
  150. /package/dist/client/assets/{KaTeX_Fraktur-Bold-74444efd.woff2 → KaTeX_Fraktur-Bold-CL6g_b3V.woff2} +0 -0
  151. /package/dist/client/assets/{KaTeX_Fraktur-Regular-1e6f9579.ttf → KaTeX_Fraktur-Regular-CB_wures.ttf} +0 -0
  152. /package/dist/client/assets/{KaTeX_Fraktur-Regular-51814d27.woff2 → KaTeX_Fraktur-Regular-CTYiF6lA.woff2} +0 -0
  153. /package/dist/client/assets/{KaTeX_Fraktur-Regular-5e28753b.woff → KaTeX_Fraktur-Regular-Dxdc4cR9.woff} +0 -0
  154. /package/dist/client/assets/{KaTeX_Main-Bold-0f60d1b8.woff2 → KaTeX_Main-Bold-Cx986IdX.woff2} +0 -0
  155. /package/dist/client/assets/{KaTeX_Main-Bold-c76c5d69.woff → KaTeX_Main-Bold-Jm3AIy58.woff} +0 -0
  156. /package/dist/client/assets/{KaTeX_Main-Bold-138ac28d.ttf → KaTeX_Main-Bold-waoOVXN0.ttf} +0 -0
  157. /package/dist/client/assets/{KaTeX_Main-BoldItalic-99cd42a3.woff2 → KaTeX_Main-BoldItalic-DxDJ3AOS.woff2} +0 -0
  158. /package/dist/client/assets/{KaTeX_Main-BoldItalic-70ee1f64.ttf → KaTeX_Main-BoldItalic-DzxPMmG6.ttf} +0 -0
  159. /package/dist/client/assets/{KaTeX_Main-BoldItalic-a6f7ec0d.woff → KaTeX_Main-BoldItalic-SpSLRI95.woff} +0 -0
  160. /package/dist/client/assets/{KaTeX_Main-Italic-0d85ae7c.ttf → KaTeX_Main-Italic-3WenGoN9.ttf} +0 -0
  161. /package/dist/client/assets/{KaTeX_Main-Italic-f1d6ef86.woff → KaTeX_Main-Italic-BMLOBm91.woff} +0 -0
  162. /package/dist/client/assets/{KaTeX_Main-Italic-97479ca6.woff2 → KaTeX_Main-Italic-NWA7e6Wa.woff2} +0 -0
  163. /package/dist/client/assets/{KaTeX_Main-Regular-c2342cd8.woff2 → KaTeX_Main-Regular-B22Nviop.woff2} +0 -0
  164. /package/dist/client/assets/{KaTeX_Main-Regular-c6368d87.woff → KaTeX_Main-Regular-Dr94JaBh.woff} +0 -0
  165. /package/dist/client/assets/{KaTeX_Main-Regular-d0332f52.ttf → KaTeX_Main-Regular-ypZvNtVU.ttf} +0 -0
  166. /package/dist/client/assets/{KaTeX_Math-BoldItalic-f9377ab0.ttf → KaTeX_Math-BoldItalic-B3XSjfu4.ttf} +0 -0
  167. /package/dist/client/assets/{KaTeX_Math-BoldItalic-dc47344d.woff2 → KaTeX_Math-BoldItalic-CZnvNsCZ.woff2} +0 -0
  168. /package/dist/client/assets/{KaTeX_Math-BoldItalic-850c0af5.woff → KaTeX_Math-BoldItalic-iY-2wyZ7.woff} +0 -0
  169. /package/dist/client/assets/{KaTeX_Math-Italic-8a8d2445.woff → KaTeX_Math-Italic-DA0__PXp.woff} +0 -0
  170. /package/dist/client/assets/{KaTeX_Math-Italic-08ce98e5.ttf → KaTeX_Math-Italic-flOr_0UB.ttf} +0 -0
  171. /package/dist/client/assets/{KaTeX_Math-Italic-7af58c5e.woff2 → KaTeX_Math-Italic-t53AETM-.woff2} +0 -0
  172. /package/dist/client/assets/{KaTeX_SansSerif-Bold-1ece03f7.ttf → KaTeX_SansSerif-Bold-CFMepnvq.ttf} +0 -0
  173. /package/dist/client/assets/{KaTeX_SansSerif-Bold-e99ae511.woff2 → KaTeX_SansSerif-Bold-D1sUS0GD.woff2} +0 -0
  174. /package/dist/client/assets/{KaTeX_SansSerif-Bold-ece03cfd.woff → KaTeX_SansSerif-Bold-DbIhKOiC.woff} +0 -0
  175. /package/dist/client/assets/{KaTeX_SansSerif-Italic-00b26ac8.woff2 → KaTeX_SansSerif-Italic-C3H0VqGB.woff2} +0 -0
  176. /package/dist/client/assets/{KaTeX_SansSerif-Italic-91ee6750.woff → KaTeX_SansSerif-Italic-DN2j7dab.woff} +0 -0
  177. /package/dist/client/assets/{KaTeX_SansSerif-Italic-3931dd81.ttf → KaTeX_SansSerif-Italic-YYjJ1zSn.ttf} +0 -0
  178. /package/dist/client/assets/{KaTeX_SansSerif-Regular-f36ea897.ttf → KaTeX_SansSerif-Regular-BNo7hRIc.ttf} +0 -0
  179. /package/dist/client/assets/{KaTeX_SansSerif-Regular-11e4dc8a.woff → KaTeX_SansSerif-Regular-CS6fqUqJ.woff} +0 -0
  180. /package/dist/client/assets/{KaTeX_SansSerif-Regular-68e8c73e.woff2 → KaTeX_SansSerif-Regular-DDBCnlJ7.woff2} +0 -0
  181. /package/dist/client/assets/{KaTeX_Script-Regular-1c67f068.ttf → KaTeX_Script-Regular-C5JkGWo-.ttf} +0 -0
  182. /package/dist/client/assets/{KaTeX_Script-Regular-036d4e95.woff2 → KaTeX_Script-Regular-D3wIWfF6.woff2} +0 -0
  183. /package/dist/client/assets/{KaTeX_Script-Regular-d96cdf2b.woff → KaTeX_Script-Regular-D5yQViql.woff} +0 -0
  184. /package/dist/client/assets/{KaTeX_Size1-Regular-c943cc98.woff → KaTeX_Size1-Regular-C195tn64.woff} +0 -0
  185. /package/dist/client/assets/{KaTeX_Size1-Regular-95b6d2f1.ttf → KaTeX_Size1-Regular-Dbsnue_I.ttf} +0 -0
  186. /package/dist/client/assets/{KaTeX_Size1-Regular-6b47c401.woff2 → KaTeX_Size1-Regular-mCD8mA8B.woff2} +0 -0
  187. /package/dist/client/assets/{KaTeX_Size2-Regular-a6b2099f.ttf → KaTeX_Size2-Regular-B7gKUWhC.ttf} +0 -0
  188. /package/dist/client/assets/{KaTeX_Size2-Regular-d04c5421.woff2 → KaTeX_Size2-Regular-Dy4dx90m.woff2} +0 -0
  189. /package/dist/client/assets/{KaTeX_Size2-Regular-2014c523.woff → KaTeX_Size2-Regular-oD1tc_U0.woff} +0 -0
  190. /package/dist/client/assets/{KaTeX_Size3-Regular-6ab6b62e.woff → KaTeX_Size3-Regular-CTq5MqoE.woff} +0 -0
  191. /package/dist/client/assets/{KaTeX_Size3-Regular-500e04d5.ttf → KaTeX_Size3-Regular-DgpXs0kz.ttf} +0 -0
  192. /package/dist/client/assets/{KaTeX_Size4-Regular-99f9c675.woff → KaTeX_Size4-Regular-BF-4gkZK.woff} +0 -0
  193. /package/dist/client/assets/{KaTeX_Size4-Regular-c647367d.ttf → KaTeX_Size4-Regular-DWFBv043.ttf} +0 -0
  194. /package/dist/client/assets/{KaTeX_Size4-Regular-a4af7d41.woff2 → KaTeX_Size4-Regular-Dl5lxZxV.woff2} +0 -0
  195. /package/dist/client/assets/{KaTeX_Typewriter-Regular-e14fed02.woff → KaTeX_Typewriter-Regular-C0xS9mPB.woff} +0 -0
  196. /package/dist/client/assets/{KaTeX_Typewriter-Regular-71d517d6.woff2 → KaTeX_Typewriter-Regular-CO6r4hn1.woff2} +0 -0
  197. /package/dist/client/assets/{KaTeX_Typewriter-Regular-f01f3e87.ttf → KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf} +0 -0
  198. /package/dist/client/assets/{colors-98f238a0.js → colors-Cc3OSVma.js} +0 -0
  199. /package/dist/client/assets/{defaultLocale-a8476f12.js → defaultLocale-CzDG__Ur.js} +0 -0
  200. /package/dist/client/assets/{index-a1656aec.js → index-Bi7T_FA4.js} +0 -0
  201. /package/dist/client/assets/{init-a5b10ee5.js → init-Dmth1JHB.js} +0 -0
  202. /package/dist/client/assets/{range-6bc2a9a0.js → range-OtVwhkKS.js} +0 -0
@@ -1,201 +0,0 @@
1
- var g5=Object.defineProperty;var p5=(e,t,n)=>t in e?g5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var L=(e,t,n)=>(p5(e,typeof t!="symbol"?t+"":t,n),n),sE=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var aE=(e,t,n)=>(sE(e,t,"read from private field"),n?n.call(e):t.get(e)),uE=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Qg=(e,t,n,i)=>(sE(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n);import{m as _m,a as Go,r as m5,q as y5,u as Om,i as b5,v as v5,w as x5,x as E5,y as vk,s as P1,z as xk,A as Ek,B as Zu,C as z1,D as Rm,E as wk,F as w5,G as S5,H as $5,c as lE,p as Sk,d as hf,e as A5,f as k5,g as $k,b as C5,I as F5,J as _5,K as O5,t as R5,L as M5}from"./time-043b3464.js";import{d as gl,n as D5,e as T5,i as Bl,f as N5,g as L5,h as I5,o as P5,j as rh,k as cE,m as Ua,p as B1,a as U1,q as fE,r as Wr,s as oh,b as j1,t as pl,u as z5,v as B5,w as U5,l as j5,x as Mm,y as q5,z as W5}from"./linear-fed00341.js";import{a as Dm,f as Ak,b as G5,c as H5}from"./defaultLocale-a8476f12.js";import{r as pn}from"./range-6bc2a9a0.js";import{R as kk,r as V5,o as X5,q as Y5,C as K5,$ as dE,a0 as hE,v as q1,a1 as Tm,u as On,a2 as J5,a3 as Q5,y as Z5,A as eL,a4 as tL,a5 as nL,B as iL,G as rL,F as oL,H as sL,T as aL,E as uL,D as lL,w as Ck,b as St,S as Fk,a6 as cL,a7 as fL,n as dL,l as _k,t as hL,d as gL,p as pL,c as mL,I as yL,J as bL,K as vL,N as xL,M as EL,L as wL,Q as SL,O as $L,P as AL,U as kL,W as CL,V as FL,X as _L,Y as OL,Z as RL,_ as ML,a8 as W1,a9 as zf}from"./step-171ad54a.js";import{i as xs,a as mo}from"./init-a5b10ee5.js";import{I as Bf,o as Ok,i as DL}from"./ordinal-db88ae6f.js";import{c as qi}from"./colors-98f238a0.js";import{d as TL}from"./arc-4691b008.js";import{o as gf,c as gE,a as NL,r as LL,b as sh,N as Rk,d as IL,e as G1,s as PL,p as zL,h as BL,t as UL,f as jL}from"./index-a1656aec.js";function qL(e,t){let n=0,i,r=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(i=s-r,r+=i/++n,o+=i*(s-r));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(i=a-r,r+=i/++n,o+=i*(a-r))}if(n>1)return o/(n-1)}function WL(e,t){const n=qL(e,t);return n&&Math.sqrt(n)}class qt{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let i=0;for(let r=0;r<this._n&&r<32;r++){const o=n[r],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(n[i++]=a),t=s}return n[i]=t,this._n=i+1,this}valueOf(){const t=this._partials;let n=this._n,i,r,o,s=0;if(n>0){for(s=t[--n];n>0&&(i=s,r=t[--n],s=i+r,o=r-(s-i),!o););n>0&&(o<0&&t[n-1]<0||o>0&&t[n-1]>0)&&(r=o*2,i=s+r,r==i-s&&(s=i))}return s}}function GL(e,t){return Array.from(t,n=>e[n])}function HL(e=gl){if(e===gl)return Mk;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const i=e(t,n);return i||i===0?i:(e(n,n)===0)-(e(t,t)===0)}}function Mk(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Dk(e,t,n=0,i=1/0,r){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),i=Math.floor(Math.min(e.length-1,i)),!(n<=t&&t<=i))return e;for(r=r===void 0?Mk:HL(r);i>n;){if(i-n>600){const u=i-n+1,l=t-n+1,c=Math.log(u),f=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*f*(u-f)/u)*(l-u/2<0?-1:1),h=Math.max(n,Math.floor(t-l*f/u+d)),g=Math.min(i,Math.floor(t+(u-l)*f/u+d));Dk(e,t,h,g,r)}const o=e[t];let s=n,a=i;for(fu(e,n,t),r(e[i],o)>0&&fu(e,n,i);s<a;){for(fu(e,s,a),++s,--a;r(e[s],o)<0;)++s;for(;r(e[a],o)>0;)--a}r(e[n],o)===0?fu(e,n,a):(++a,fu(e,a,i)),a<=t&&(n=a+1),t<=a&&(i=a-1)}return e}function fu(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function Nm(e,t,n){if(e=Float64Array.from(D5(e,n)),!(!(i=e.length)||isNaN(t=+t))){if(t<=0||i<2)return _m(e);if(t>=1)return Go(e);var i,r=(i-1)*t,o=Math.floor(r),s=Go(Dk(e,o).subarray(0,o+1)),a=_m(e.subarray(o+1));return s+(a-s)*(r-o)}}function Tk(e,t,n=T5){if(!(!(i=e.length)||isNaN(t=+t))){if(t<=0||i<2)return+n(e[0],0,e);if(t>=1)return+n(e[i-1],i-1,e);var i,r=(i-1)*t,o=Math.floor(r),s=+n(e[o],o,e),a=+n(e[o+1],o+1,e);return s+(a-s)*(r-o)}}function VL(e,t){let n=0,i=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&(++n,i+=r);else{let r=-1;for(let o of e)(o=t(o,++r,e))!=null&&(o=+o)>=o&&(++n,i+=o)}if(n)return i/n}function Nk(e,t){return Nm(e,.5,t)}function*XL(e){for(const t of e)yield*t}function Lk(e){return Array.from(XL(e))}function Ik(e,t){let n=0;if(t===void 0)for(let i of e)(i=+i)&&(n+=i);else{let i=-1;for(let r of e)(r=+t(r,++i,e))&&(n+=r)}return n}function YL(e,...t){e=new Bf(e),t=t.map(KL);e:for(const n of e)for(const i of t)if(!i.has(n)){e.delete(n);continue e}return e}function KL(e){return e instanceof Bf?e:new Bf(e)}function JL(...e){const t=new Bf;for(const n of e)for(const i of n)t.add(i);return t}var Pk=-.14861,H1=1.78277,V1=-.29227,ah=-.90649,ml=1.97294,pE=ml*ah,mE=ml*H1,yE=H1*V1-ah*Pk;function QL(e){if(e instanceof Ho)return new Ho(e.h,e.s,e.l,e.opacity);e instanceof kk||(e=V5(e));var t=e.r/255,n=e.g/255,i=e.b/255,r=(yE*i+pE*t-mE*n)/(yE+pE-mE),o=i-r,s=(ml*(n-r)-V1*o)/ah,a=Math.sqrt(s*s+o*o)/(ml*r*(1-r)),u=a?Math.atan2(s,o)*y5-120:NaN;return new Ho(u<0?u+360:u,a,r,e.opacity)}function Lm(e,t,n,i){return arguments.length===1?QL(e):new Ho(e,t,n,i??1)}function Ho(e,t,n,i){this.h=+e,this.s=+t,this.l=+n,this.opacity=+i}X5(Ho,Lm,Y5(K5,{brighter(e){return e=e==null?dE:Math.pow(dE,e),new Ho(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?hE:Math.pow(hE,e),new Ho(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*m5,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),i=Math.cos(e),r=Math.sin(e);return new kk(255*(t+n*(Pk*i+H1*r)),255*(t+n*(V1*i+ah*r)),255*(t+n*(ml*i)),this.opacity)}}));function ZL(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}function eI(e,t){var n=q1(+e,+t);return function(i){var r=n(i);return r-360*Math.floor(r/360)}}var tI=1e-12;function bE(e){return((e=Math.exp(e))+1/e)/2}function nI(e){return((e=Math.exp(e))-1/e)/2}function iI(e){return((e=Math.exp(2*e))-1)/(e+1)}const rI=function e(t,n,i){function r(o,s){var a=o[0],u=o[1],l=o[2],c=s[0],f=s[1],d=s[2],h=c-a,g=f-u,p=h*h+g*g,m,y;if(p<tI)y=Math.log(d/l)/t,m=function(E){return[a+E*h,u+E*g,l*Math.exp(t*E*y)]};else{var b=Math.sqrt(p),v=(d*d-l*l+i*p)/(2*l*n*b),x=(d*d-l*l-i*p)/(2*d*n*b),w=Math.log(Math.sqrt(v*v+1)-v),S=Math.log(Math.sqrt(x*x+1)-x);y=(S-w)/t,m=function(E){var $=E*y,A=bE(w),C=l/(n*b)*(A*iI(t*$+w)-nI(w));return[a+C*h,u+C*g,l*A/bE(t*$+w)]}}return m.duration=y*1e3*t/Math.SQRT2,m}return r.rho=function(o){var s=Math.max(.001,+o),a=s*s,u=a*a;return e(s,a,u)},r}(Math.SQRT2,2,4);function zk(e){return function(t,n){var i=e((t=Tm(t)).h,(n=Tm(n)).h),r=On(t.s,n.s),o=On(t.l,n.l),s=On(t.opacity,n.opacity);return function(a){return t.h=i(a),t.s=r(a),t.l=o(a),t.opacity=s(a),t+""}}}const oI=zk(q1);var sI=zk(On);function aI(e,t){var n=On((e=Om(e)).l,(t=Om(t)).l),i=On(e.a,t.a),r=On(e.b,t.b),o=On(e.opacity,t.opacity);return function(s){return e.l=n(s),e.a=i(s),e.b=r(s),e.opacity=o(s),e+""}}function Bk(e){return function t(n){n=+n;function i(r,o){var s=e((r=Lm(r)).h,(o=Lm(o)).h),a=On(r.s,o.s),u=On(r.l,o.l),l=On(r.opacity,o.opacity);return function(c){return r.h=s(c),r.s=a(c),r.l=u(Math.pow(c,n)),r.opacity=l(c),r+""}}return i.gamma=t,i}(1)}const uI=Bk(q1);var lI=Bk(On);function X1(e,t){t===void 0&&(t=e,e=Bl);for(var n=0,i=t.length-1,r=t[0],o=new Array(i<0?0:i);n<i;)o[n]=e(r,r=t[++n]);return function(s){var a=Math.max(0,Math.min(i-1,Math.floor(s*=i)));return o[a](s-a)}}function cI(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e(i/(t-1));return n}const fI=Object.freeze(Object.defineProperty({__proto__:null,interpolate:Bl,interpolateArray:N5,interpolateBasis:J5,interpolateBasisClosed:Q5,interpolateCubehelix:uI,interpolateCubehelixLong:lI,interpolateDate:L5,interpolateDiscrete:ZL,interpolateHcl:b5,interpolateHclLong:v5,interpolateHsl:oI,interpolateHslLong:sI,interpolateHue:eI,interpolateLab:aI,interpolateNumber:Z5,interpolateNumberArray:I5,interpolateObject:P5,interpolateRgb:eL,interpolateRgbBasis:tL,interpolateRgbBasisClosed:nL,interpolateRound:rh,interpolateString:iL,interpolateTransformCss:rL,interpolateTransformSvg:oL,interpolateZoom:rI,piecewise:X1,quantize:cI},Symbol.toStringTag,{value:"Module"}));function dI(e,t,n){var i=new aL,r=t;return t==null?(i.restart(e,t,n),i):(i._restart=i.restart,i.restart=function(o,s,a){s=+s,a=a==null?sL():+a,i._restart(function u(l){l+=r,i._restart(u,r+=s,a),o(l)},s,a)},i.restart(e,t,n),i)}const fr=11102230246251565e-32,Et=134217729,hI=(3+8*fr)*fr;function Zg(e,t,n,i,r){let o,s,a,u,l=t[0],c=i[0],f=0,d=0;c>l==c>-l?(o=l,l=t[++f]):(o=c,c=i[++d]);let h=0;if(f<e&&d<n)for(c>l==c>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=c+o,a=o-(s-c),c=i[++d]),o=s,a!==0&&(r[h++]=a);f<e&&d<n;)c>l==c>-l?(s=o+l,u=s-o,a=o-(s-u)+(l-u),l=t[++f]):(s=o+c,u=s-o,a=o-(s-u)+(c-u),c=i[++d]),o=s,a!==0&&(r[h++]=a);for(;f<e;)s=o+l,u=s-o,a=o-(s-u)+(l-u),l=t[++f],o=s,a!==0&&(r[h++]=a);for(;d<n;)s=o+c,u=s-o,a=o-(s-u)+(c-u),c=i[++d],o=s,a!==0&&(r[h++]=a);return(o!==0||h===0)&&(r[h++]=o),h}function gI(e,t){let n=t[0];for(let i=1;i<e;i++)n+=t[i];return n}function Ul(e){return new Float64Array(e)}const pI=(3+16*fr)*fr,mI=(2+12*fr)*fr,yI=(9+64*fr)*fr*fr,Is=Ul(4),vE=Ul(8),xE=Ul(12),EE=Ul(16),Mt=Ul(4);function bI(e,t,n,i,r,o,s){let a,u,l,c,f,d,h,g,p,m,y,b,v,x,w,S,E,$;const A=e-r,C=n-r,F=t-o,I=i-o;x=A*I,d=Et*A,h=d-(d-A),g=A-h,d=Et*I,p=d-(d-I),m=I-p,w=g*m-(x-h*p-g*p-h*m),S=F*C,d=Et*F,h=d-(d-F),g=F-h,d=Et*C,p=d-(d-C),m=C-p,E=g*m-(S-h*p-g*p-h*m),y=w-E,f=w-y,Is[0]=w-(y+f)+(f-E),b=x+y,f=b-x,v=x-(b-f)+(y-f),y=v-S,f=v-y,Is[1]=v-(y+f)+(f-S),$=b+y,f=$-b,Is[2]=b-($-f)+(y-f),Is[3]=$;let j=gI(4,Is),O=mI*s;if(j>=O||-j>=O||(f=e-A,a=e-(A+f)+(f-r),f=n-C,l=n-(C+f)+(f-r),f=t-F,u=t-(F+f)+(f-o),f=i-I,c=i-(I+f)+(f-o),a===0&&u===0&&l===0&&c===0)||(O=yI*s+hI*Math.abs(j),j+=A*c+I*a-(F*l+C*u),j>=O||-j>=O))return j;x=a*I,d=Et*a,h=d-(d-a),g=a-h,d=Et*I,p=d-(d-I),m=I-p,w=g*m-(x-h*p-g*p-h*m),S=u*C,d=Et*u,h=d-(d-u),g=u-h,d=Et*C,p=d-(d-C),m=C-p,E=g*m-(S-h*p-g*p-h*m),y=w-E,f=w-y,Mt[0]=w-(y+f)+(f-E),b=x+y,f=b-x,v=x-(b-f)+(y-f),y=v-S,f=v-y,Mt[1]=v-(y+f)+(f-S),$=b+y,f=$-b,Mt[2]=b-($-f)+(y-f),Mt[3]=$;const k=Zg(4,Is,4,Mt,vE);x=A*c,d=Et*A,h=d-(d-A),g=A-h,d=Et*c,p=d-(d-c),m=c-p,w=g*m-(x-h*p-g*p-h*m),S=F*l,d=Et*F,h=d-(d-F),g=F-h,d=Et*l,p=d-(d-l),m=l-p,E=g*m-(S-h*p-g*p-h*m),y=w-E,f=w-y,Mt[0]=w-(y+f)+(f-E),b=x+y,f=b-x,v=x-(b-f)+(y-f),y=v-S,f=v-y,Mt[1]=v-(y+f)+(f-S),$=b+y,f=$-b,Mt[2]=b-($-f)+(y-f),Mt[3]=$;const _=Zg(k,vE,4,Mt,xE);x=a*c,d=Et*a,h=d-(d-a),g=a-h,d=Et*c,p=d-(d-c),m=c-p,w=g*m-(x-h*p-g*p-h*m),S=u*l,d=Et*u,h=d-(d-u),g=u-h,d=Et*l,p=d-(d-l),m=l-p,E=g*m-(S-h*p-g*p-h*m),y=w-E,f=w-y,Mt[0]=w-(y+f)+(f-E),b=x+y,f=b-x,v=x-(b-f)+(y-f),y=v-S,f=v-y,Mt[1]=v-(y+f)+(f-S),$=b+y,f=$-b,Mt[2]=b-($-f)+(y-f),Mt[3]=$;const N=Zg(_,xE,4,Mt,EE);return EE[N-1]}function Oc(e,t,n,i,r,o){const s=(t-o)*(n-r),a=(e-r)*(i-o),u=s-a,l=Math.abs(s+a);return Math.abs(u)>=pI*l?u:-bI(e,t,n,i,r,o,l)}const wE=Math.pow(2,-52),Rc=new Uint32Array(512);class Uf{static from(t,n=SI,i=$I){const r=t.length,o=new Float64Array(r*2);for(let s=0;s<r;s++){const a=t[s];o[2*s]=n(a),o[2*s+1]=i(a)}return new Uf(o)}constructor(t){const n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const i=Math.max(2*n-5,0);this._triangles=new Uint32Array(i*3),this._halfedges=new Int32Array(i*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.trianglesLen=0,this._cx=0,this._cy=0,this._hullStart=0,this.hull=this._triangles,this.triangles=this._triangles,this.halfedges=this._halfedges,this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:i,_hullTri:r,_hullHash:o}=this,s=t.length>>1;let a=1/0,u=1/0,l=-1/0,c=-1/0;for(let A=0;A<s;A++){const C=t[2*A],F=t[2*A+1];C<a&&(a=C),F<u&&(u=F),C>l&&(l=C),F>c&&(c=F),this._ids[A]=A}const f=(a+l)/2,d=(u+c)/2;let h=0,g=0,p=0;for(let A=0,C=1/0;A<s;A++){const F=ep(f,d,t[2*A],t[2*A+1]);F<C&&(h=A,C=F)}const m=t[2*h],y=t[2*h+1];for(let A=0,C=1/0;A<s;A++){if(A===h)continue;const F=ep(m,y,t[2*A],t[2*A+1]);F<C&&F>0&&(g=A,C=F)}let b=t[2*g],v=t[2*g+1],x=1/0;for(let A=0;A<s;A++){if(A===h||A===g)continue;const C=EI(m,y,b,v,t[2*A],t[2*A+1]);C<x&&(p=A,x=C)}let w=t[2*p],S=t[2*p+1];if(x===1/0){for(let F=0;F<s;F++)this._dists[F]=t[2*F]-t[0]||t[2*F+1]-t[1];Ks(this._ids,this._dists,0,s-1);const A=new Uint32Array(s);let C=0;for(let F=0,I=-1/0;F<s;F++){const j=this._ids[F],O=this._dists[j];O>I&&(A[C++]=j,I=O)}this.hull=A.subarray(0,C),this.triangles=new Uint32Array(0),this.halfedges=new Int32Array(0);return}if(Oc(m,y,b,v,w,S)<0){const A=g,C=b,F=v;g=p,b=w,v=S,p=A,w=C,S=F}const E=wI(m,y,b,v,w,S);this._cx=E.x,this._cy=E.y;for(let A=0;A<s;A++)this._dists[A]=ep(t[2*A],t[2*A+1],E.x,E.y);Ks(this._ids,this._dists,0,s-1),this._hullStart=h;let $=3;i[h]=n[p]=g,i[g]=n[h]=p,i[p]=n[g]=h,r[h]=0,r[g]=1,r[p]=2,o.fill(-1),o[this._hashKey(m,y)]=h,o[this._hashKey(b,v)]=g,o[this._hashKey(w,S)]=p,this.trianglesLen=0,this._addTriangle(h,g,p,-1,-1,-1);for(let A=0,C=0,F=0;A<this._ids.length;A++){const I=this._ids[A],j=t[2*I],O=t[2*I+1];if(A>0&&Math.abs(j-C)<=wE&&Math.abs(O-F)<=wE||(C=j,F=O,I===h||I===g||I===p))continue;let k=0;for(let Q=0,le=this._hashKey(j,O);Q<this._hashSize&&(k=o[(le+Q)%this._hashSize],!(k!==-1&&k!==i[k]));Q++);k=n[k];let _=k,N;for(;N=i[_],Oc(j,O,t[2*_],t[2*_+1],t[2*N],t[2*N+1])>=0;)if(_=N,_===k){_=-1;break}if(_===-1)continue;let W=this._addTriangle(_,I,i[_],-1,-1,r[_]);r[I]=this._legalize(W+2),r[_]=W,$++;let P=i[_];for(;N=i[P],Oc(j,O,t[2*P],t[2*P+1],t[2*N],t[2*N+1])<0;)W=this._addTriangle(P,I,N,r[I],-1,r[P]),r[I]=this._legalize(W+2),i[P]=P,$--,P=N;if(_===k)for(;N=n[_],Oc(j,O,t[2*N],t[2*N+1],t[2*_],t[2*_+1])<0;)W=this._addTriangle(N,I,_,-1,r[_],r[N]),this._legalize(W+2),r[N]=W,i[_]=_,$--,_=N;this._hullStart=n[I]=_,i[_]=n[P]=I,i[I]=P,o[this._hashKey(j,O)]=I,o[this._hashKey(t[2*_],t[2*_+1])]=_}this.hull=new Uint32Array($);for(let A=0,C=this._hullStart;A<$;A++)this.hull[A]=C,C=i[C];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(vI(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:i,coords:r}=this;let o=0,s=0;for(;;){const a=i[t],u=t-t%3;if(s=u+(t+2)%3,a===-1){if(o===0)break;t=Rc[--o];continue}const l=a-a%3,c=u+(t+1)%3,f=l+(a+2)%3,d=n[s],h=n[t],g=n[c],p=n[f];if(xI(r[2*d],r[2*d+1],r[2*h],r[2*h+1],r[2*g],r[2*g+1],r[2*p],r[2*p+1])){n[t]=p,n[a]=d;const y=i[f];if(y===-1){let v=this._hullStart;do{if(this._hullTri[v]===f){this._hullTri[v]=t;break}v=this._hullPrev[v]}while(v!==this._hullStart)}this._link(t,y),this._link(a,i[s]),this._link(s,f);const b=l+(a+1)%3;o<Rc.length&&(Rc[o++]=b)}else{if(o===0)break;t=Rc[--o]}}return s}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,i,r,o,s){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=i,this._link(a,r),this._link(a+1,o),this._link(a+2,s),this.trianglesLen+=3,a}}function vI(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function ep(e,t,n,i){const r=e-n,o=t-i;return r*r+o*o}function xI(e,t,n,i,r,o,s,a){const u=e-s,l=t-a,c=n-s,f=i-a,d=r-s,h=o-a,g=u*u+l*l,p=c*c+f*f,m=d*d+h*h;return u*(f*m-p*h)-l*(c*m-p*d)+g*(c*h-f*d)<0}function EI(e,t,n,i,r,o){const s=n-e,a=i-t,u=r-e,l=o-t,c=s*s+a*a,f=u*u+l*l,d=.5/(s*l-a*u),h=(l*c-a*f)*d,g=(s*f-u*c)*d;return h*h+g*g}function wI(e,t,n,i,r,o){const s=n-e,a=i-t,u=r-e,l=o-t,c=s*s+a*a,f=u*u+l*l,d=.5/(s*l-a*u),h=e+(l*c-a*f)*d,g=t+(s*f-u*c)*d;return{x:h,y:g}}function Ks(e,t,n,i){if(i-n<=20)for(let r=n+1;r<=i;r++){const o=e[r],s=t[o];let a=r-1;for(;a>=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{const r=n+i>>1;let o=n+1,s=i;du(e,r,o),t[e[n]]>t[e[i]]&&du(e,n,i),t[e[o]]>t[e[i]]&&du(e,o,i),t[e[n]]>t[e[o]]&&du(e,n,o);const a=e[o],u=t[a];for(;;){do o++;while(t[e[o]]<u);do s--;while(t[e[s]]>u);if(s<o)break;du(e,o,s)}e[n+1]=e[s],e[s]=a,i-o+1>=s-n?(Ks(e,t,o,i),Ks(e,t,n,s-1)):(Ks(e,t,n,s-1),Ks(e,t,o,i))}}function du(e,t,n){const i=e[t];e[t]=e[n],e[n]=i}function SI(e){return e[0]}function $I(e){return e[1]}const SE=1e-6;class qo{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,i){t=+t,n=+n,i=+i;const r=t+i,o=n;if(i<0)throw new Error("negative radius");this._x1===null?this._+=`M${r},${o}`:(Math.abs(this._x1-r)>SE||Math.abs(this._y1-o)>SE)&&(this._+="L"+r+","+o),i&&(this._+=`A${i},${i},0,1,1,${t-i},${n}A${i},${i},0,1,1,${this._x1=r},${this._y1=o}`)}rect(t,n,i,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+i}v${+r}h${-i}Z`}value(){return this._||null}}class Im{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}let AI=class{constructor(t,[n,i,r,o]=[0,0,960,500]){if(!((r=+r)>=(n=+n))||!((o=+o)>=(i=+i)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=r,this.xmin=n,this.ymax=o,this.ymin=i,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:i},vectors:r}=this;let o,s;const a=this.circumcenters=this._circumcenters.subarray(0,i.length/3*2);for(let p=0,m=0,y=i.length,b,v;p<y;p+=3,m+=2){const x=i[p]*2,w=i[p+1]*2,S=i[p+2]*2,E=t[x],$=t[x+1],A=t[w],C=t[w+1],F=t[S],I=t[S+1],j=A-E,O=C-$,k=F-E,_=I-$,N=(j*_-O*k)*2;if(Math.abs(N)<1e-9){if(o===void 0){o=s=0;for(const P of n)o+=t[P*2],s+=t[P*2+1];o/=n.length,s/=n.length}const W=1e9*Math.sign((o-E)*_-(s-$)*k);b=(E+F)/2-W*_,v=($+I)/2+W*k}else{const W=1/N,P=j*j+O*O,Q=k*k+_*_;b=E+(_*P-O*Q)*W,v=$+(j*Q-k*P)*W}a[m]=b,a[m+1]=v}let u=n[n.length-1],l,c=u*4,f,d=t[2*u],h,g=t[2*u+1];r.fill(0);for(let p=0;p<n.length;++p)u=n[p],l=c,f=d,h=g,c=u*4,d=t[2*u],g=t[2*u+1],r[l+2]=r[c]=h-g,r[l+3]=r[c+1]=d-f}render(t){const n=t==null?t=new qo:void 0,{delaunay:{halfedges:i,inedges:r,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let c=0,f=i.length;c<f;++c){const d=i[c];if(d<c)continue;const h=Math.floor(c/3)*2,g=Math.floor(d/3)*2,p=s[h],m=s[h+1],y=s[g],b=s[g+1];this._renderSegment(p,m,y,b,t)}let u,l=o[o.length-1];for(let c=0;c<o.length;++c){u=l,l=o[c];const f=Math.floor(r[l]/3)*2,d=s[f],h=s[f+1],g=u*4,p=this._project(d,h,a[g+2],a[g+3]);p&&this._renderSegment(d,h,p[0],p[1],t)}return n&&n.value()}renderBounds(t){const n=t==null?t=new qo:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const i=n==null?n=new qo:void 0,r=this._clip(t);if(r===null||!r.length)return;n.moveTo(r[0],r[1]);let o=r.length;for(;r[0]===r[o-2]&&r[1]===r[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(r[s]!==r[s-2]||r[s+1]!==r[s-1])&&n.lineTo(r[s],r[s+1]);return n.closePath(),i&&i.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,i=t.length/2;n<i;++n){const r=this.cellPolygon(n);r&&(r.index=n,yield r)}}cellPolygon(t){const n=new Im;return this.renderCell(t,n),n.value()}_renderSegment(t,n,i,r,o){let s;const a=this._regioncode(t,n),u=this._regioncode(i,r);a===0&&u===0?(o.moveTo(t,n),o.lineTo(i,r)):(s=this._clipSegment(t,n,i,r,a,u))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,n,i){return n=+n,n!==n||(i=+i,i!==i)?!1:this.delaunay._step(t,n,i)===t}*neighbors(t){const n=this._clip(t);if(n)for(const i of this.delaunay.neighbors(t)){const r=this._clip(i);if(r){e:for(let o=0,s=n.length;o<s;o+=2)for(let a=0,u=r.length;a<u;a+=2)if(n[o]===r[a]&&n[o+1]===r[a+1]&&n[(o+2)%s]===r[(a+u-2)%u]&&n[(o+3)%s]===r[(a+u-1)%u]){yield i;break e}}}}_cell(t){const{circumcenters:n,delaunay:{inedges:i,halfedges:r,triangles:o}}=this,s=i[t];if(s===-1)return null;const a=[];let u=s;do{const l=Math.floor(u/3);if(a.push(n[l*2],n[l*2+1]),u=u%3===2?u-2:u+1,o[u]!==t)break;u=r[u]}while(u!==s&&u!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(n===null)return null;const{vectors:i}=this,r=t*4;return this._simplify(i[r]||i[r+1]?this._clipInfinite(t,n,i[r],i[r+1],i[r+2],i[r+3]):this._clipFinite(t,n))}_clipFinite(t,n){const i=n.length;let r=null,o,s,a=n[i-2],u=n[i-1],l,c=this._regioncode(a,u),f,d=0;for(let h=0;h<i;h+=2)if(o=a,s=u,a=n[h],u=n[h+1],l=c,c=this._regioncode(a,u),l===0&&c===0)f=d,d=0,r?r.push(a,u):r=[a,u];else{let g,p,m,y,b;if(l===0){if((g=this._clipSegment(o,s,a,u,l,c))===null)continue;[p,m,y,b]=g}else{if((g=this._clipSegment(a,u,o,s,c,l))===null)continue;[y,b,p,m]=g,f=d,d=this._edgecode(p,m),f&&d&&this._edge(t,f,d,r,r.length),r?r.push(p,m):r=[p,m]}f=d,d=this._edgecode(y,b),f&&d&&this._edge(t,f,d,r,r.length),r?r.push(y,b):r=[y,b]}if(r)f=d,d=this._edgecode(r[0],r[1]),f&&d&&this._edge(t,f,d,r,r.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return r}_clipSegment(t,n,i,r,o,s){const a=o<s;for(a&&([t,n,i,r,o,s]=[i,r,t,n,s,o]);;){if(o===0&&s===0)return a?[i,r,t,n]:[t,n,i,r];if(o&s)return null;let u,l,c=o||s;c&8?(u=t+(i-t)*(this.ymax-n)/(r-n),l=this.ymax):c&4?(u=t+(i-t)*(this.ymin-n)/(r-n),l=this.ymin):c&2?(l=n+(r-n)*(this.xmax-t)/(i-t),u=this.xmax):(l=n+(r-n)*(this.xmin-t)/(i-t),u=this.xmin),o?(t=u,n=l,o=this._regioncode(t,n)):(i=u,r=l,s=this._regioncode(i,r))}}_clipInfinite(t,n,i,r,o,s){let a=Array.from(n),u;if((u=this._project(a[0],a[1],i,r))&&a.unshift(u[0],u[1]),(u=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(u[0],u[1]),a=this._clipFinite(t,a))for(let l=0,c=a.length,f,d=this._edgecode(a[c-2],a[c-1]);l<c;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),c=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,n,i,r,o){for(;n!==i;){let s,a;switch(n){case 5:n=4;continue;case 4:n=6,s=this.xmax,a=this.ymin;break;case 6:n=2;continue;case 2:n=10,s=this.xmax,a=this.ymax;break;case 10:n=8;continue;case 8:n=9,s=this.xmin,a=this.ymax;break;case 9:n=1;continue;case 1:n=5,s=this.xmin,a=this.ymin;break}(r[o]!==s||r[o+1]!==a)&&this.contains(t,s,a)&&(r.splice(o,0,s,a),o+=2)}return o}_project(t,n,i,r){let o=1/0,s,a,u;if(r<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/r)<o&&(u=this.ymin,a=t+(o=s)*i)}else if(r>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/r)<o&&(u=this.ymax,a=t+(o=s)*i)}if(i>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/i)<o&&(a=this.xmax,u=n+(o=s)*r)}else if(i<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/i)<o&&(a=this.xmin,u=n+(o=s)*r)}return[a,u]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const i=(n+2)%t.length,r=(n+4)%t.length;(t[n]===t[i]&&t[i]===t[r]||t[n+1]===t[i+1]&&t[i+1]===t[r+1])&&(t.splice(i,2),n-=2)}t.length||(t=null)}return t}};const kI=2*Math.PI,Ps=Math.pow;function CI(e){return e[0]}function FI(e){return e[1]}function _I(e){const{triangles:t,coords:n}=e;for(let i=0;i<t.length;i+=3){const r=2*t[i],o=2*t[i+1],s=2*t[i+2];if((n[s]-n[r])*(n[o+1]-n[r+1])-(n[o]-n[r])*(n[s+1]-n[r+1])>1e-10)return!1}return!0}function OI(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class Y1{static from(t,n=CI,i=FI,r){return new Y1("length"in t?RI(t,n,i,r):Float64Array.from(MI(t,n,i,r)))}constructor(t){this._delaunator=new Uf(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&_I(t)){this.collinear=Int32Array.from({length:n.length/2},(d,h)=>h).sort((d,h)=>n[2*d]-n[2*h]||n[2*d+1]-n[2*h+1]);const u=this.collinear[0],l=this.collinear[this.collinear.length-1],c=[n[2*u],n[2*u+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(c[3]-c[1],c[2]-c[0]);for(let d=0,h=n.length/2;d<h;++d){const g=OI(n[2*d],n[2*d+1],f);n[2*d]=g[0],n[2*d+1]=g[1]}this._delaunator=new Uf(n)}else delete this.collinear;const i=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let u=0,l=i.length;u<l;++u){const c=o[u%3===2?u-2:u+1];(i[u]===-1||s[c]===-1)&&(s[c]=u)}for(let u=0,l=r.length;u<l;++u)a[r[u]]=u;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],s[r[0]]=1,r.length===2&&(s[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new AI(this,t)}*neighbors(t){const{inedges:n,hull:i,_hullIndex:r,halfedges:o,triangles:s,collinear:a}=this;if(a){const f=a.indexOf(t);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}const u=n[t];if(u===-1)return;let l=u,c=-1;do{if(yield c=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=o[l],l===-1){const f=i[(r[t]+1)%i.length];f!==c&&(yield f);return}}while(l!==u)}find(t,n,i=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;const r=i;let o;for(;(o=this._step(i,t,n))>=0&&o!==i&&o!==r;)i=o;return o}_step(t,n,i){const{inedges:r,hull:o,_hullIndex:s,halfedges:a,triangles:u,points:l}=this;if(r[t]===-1||!l.length)return(t+1)%(l.length>>1);let c=t,f=Ps(n-l[t*2],2)+Ps(i-l[t*2+1],2);const d=r[t];let h=d;do{let g=u[h];const p=Ps(n-l[g*2],2)+Ps(i-l[g*2+1],2);if(p<f&&(f=p,c=g),h=h%3===2?h-2:h+1,u[h]!==t)break;if(h=a[h],h===-1){if(h=o[(s[t]+1)%o.length],h!==g&&Ps(n-l[h*2],2)+Ps(i-l[h*2+1],2)<f)return h;break}}while(h!==d);return c}render(t){const n=t==null?t=new qo:void 0,{points:i,halfedges:r,triangles:o}=this;for(let s=0,a=r.length;s<a;++s){const u=r[s];if(u<s)continue;const l=o[s]*2,c=o[u]*2;t.moveTo(i[l],i[l+1]),t.lineTo(i[c],i[c+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;const i=t==null?t=new qo:void 0,{points:r}=this;for(let o=0,s=r.length;o<s;o+=2){const a=r[o],u=r[o+1];t.moveTo(a+n,u),t.arc(a,u,n,0,kI)}return i&&i.value()}renderHull(t){const n=t==null?t=new qo:void 0,{hull:i,points:r}=this,o=i[0]*2,s=i.length;t.moveTo(r[o],r[o+1]);for(let a=1;a<s;++a){const u=2*i[a];t.lineTo(r[u],r[u+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new Im;return this.renderHull(t),t.value()}renderTriangle(t,n){const i=n==null?n=new qo:void 0,{points:r,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,u=o[t+2]*2;return n.moveTo(r[s],r[s+1]),n.lineTo(r[a],r[a+1]),n.lineTo(r[u],r[u+1]),n.closePath(),i&&i.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,i=t.length/3;n<i;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new Im;return this.renderTriangle(t,n),n.value()}}function RI(e,t,n,i){const r=e.length,o=new Float64Array(r*2);for(let s=0;s<r;++s){const a=e[s];o[s*2]=t.call(i,a,s,e),o[s*2+1]=n.call(i,a,s,e)}return o}function*MI(e,t,n,i){let r=0;for(const o of e)yield t.call(i,o,r,e),yield n.call(i,o,r,e),++r}var $E={},tp={},np=34,hu=10,ip=13;function Uk(e){return new Function("d","return {"+e.map(function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'}).join(",")+"}")}function DI(e,t){var n=Uk(e);return function(i,r){return t(n(i),r,e)}}function AE(e){var t=Object.create(null),n=[];return e.forEach(function(i){for(var r in i)r in t||n.push(t[r]=r)}),n}function Kt(e,t){var n=e+"",i=n.length;return i<t?new Array(t-i+1).join(0)+n:n}function TI(e){return e<0?"-"+Kt(-e,6):e>9999?"+"+Kt(e,6):Kt(e,4)}function NI(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),i=e.getUTCSeconds(),r=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":TI(e.getUTCFullYear())+"-"+Kt(e.getUTCMonth()+1,2)+"-"+Kt(e.getUTCDate(),2)+(r?"T"+Kt(t,2)+":"+Kt(n,2)+":"+Kt(i,2)+"."+Kt(r,3)+"Z":i?"T"+Kt(t,2)+":"+Kt(n,2)+":"+Kt(i,2)+"Z":n||t?"T"+Kt(t,2)+":"+Kt(n,2)+"Z":"")}function LI(e){var t=new RegExp('["'+e+`
2
- \r]`),n=e.charCodeAt(0);function i(f,d){var h,g,p=r(f,function(m,y){if(h)return h(m,y-1);g=m,h=d?DI(m,d):Uk(m)});return p.columns=g||[],p}function r(f,d){var h=[],g=f.length,p=0,m=0,y,b=g<=0,v=!1;f.charCodeAt(g-1)===hu&&--g,f.charCodeAt(g-1)===ip&&--g;function x(){if(b)return tp;if(v)return v=!1,$E;var S,E=p,$;if(f.charCodeAt(E)===np){for(;p++<g&&f.charCodeAt(p)!==np||f.charCodeAt(++p)===np;);return(S=p)>=g?b=!0:($=f.charCodeAt(p++))===hu?v=!0:$===ip&&(v=!0,f.charCodeAt(p)===hu&&++p),f.slice(E+1,S-1).replace(/""/g,'"')}for(;p<g;){if(($=f.charCodeAt(S=p++))===hu)v=!0;else if($===ip)v=!0,f.charCodeAt(p)===hu&&++p;else if($!==n)continue;return f.slice(E,S)}return b=!0,f.slice(E,g)}for(;(y=x())!==tp;){for(var w=[];y!==$E&&y!==tp;)w.push(y),y=x();d&&(w=d(w,m++))==null||h.push(w)}return h}function o(f,d){return f.map(function(h){return d.map(function(g){return c(h[g])}).join(e)})}function s(f,d){return d==null&&(d=AE(f)),[d.map(c).join(e)].concat(o(f,d)).join(`
3
- `)}function a(f,d){return d==null&&(d=AE(f)),o(f,d).join(`
4
- `)}function u(f){return f.map(l).join(`
5
- `)}function l(f){return f.map(c).join(e)}function c(f){return f==null?"":f instanceof Date?NI(f):t.test(f+="")?'"'+f.replace(/"/g,'""')+'"':f}return{parse:i,parseRows:r,format:s,formatBody:a,formatRows:u,formatRow:l,formatValue:c}}function II(e,t){var n,i=1;e==null&&(e=0),t==null&&(t=0);function r(){var o,s=n.length,a,u=0,l=0;for(o=0;o<s;++o)a=n[o],u+=a.x,l+=a.y;for(u=(u/s-e)*i,l=(l/s-t)*i,o=0;o<s;++o)a=n[o],a.x-=u,a.y-=l}return r.initialize=function(o){n=o},r.x=function(o){return arguments.length?(e=+o,r):e},r.y=function(o){return arguments.length?(t=+o,r):t},r.strength=function(o){return arguments.length?(i=+o,r):i},r}function PI(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return jk(this.cover(t,n),t,n,e)}function jk(e,t,n,i){if(isNaN(t)||isNaN(n))return e;var r,o=e._root,s={data:i},a=e._x0,u=e._y0,l=e._x1,c=e._y1,f,d,h,g,p,m,y,b;if(!o)return e._root=s,e;for(;o.length;)if((p=t>=(f=(a+l)/2))?a=f:l=f,(m=n>=(d=(u+c)/2))?u=d:c=d,r=o,!(o=o[y=m<<1|p]))return r[y]=s,e;if(h=+e._x.call(null,o.data),g=+e._y.call(null,o.data),t===h&&n===g)return s.next=o,r?r[y]=s:e._root=s,e;do r=r?r[y]=new Array(4):e._root=new Array(4),(p=t>=(f=(a+l)/2))?a=f:l=f,(m=n>=(d=(u+c)/2))?u=d:c=d;while((y=m<<1|p)===(b=(g>=d)<<1|h>=f));return r[b]=o,r[y]=s,e}function zI(e){var t,n,i=e.length,r,o,s=new Array(i),a=new Array(i),u=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;n<i;++n)isNaN(r=+this._x.call(null,t=e[n]))||isNaN(o=+this._y.call(null,t))||(s[n]=r,a[n]=o,r<u&&(u=r),r>c&&(c=r),o<l&&(l=o),o>f&&(f=o));if(u>c||l>f)return this;for(this.cover(u,l).cover(c,f),n=0;n<i;++n)jk(this,s[n],a[n],e[n]);return this}function BI(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,i=this._y0,r=this._x1,o=this._y1;if(isNaN(n))r=(n=Math.floor(e))+1,o=(i=Math.floor(t))+1;else{for(var s=r-n||1,a=this._root,u,l;n>e||e>=r||i>t||t>=o;)switch(l=(t<i)<<1|e<n,u=new Array(4),u[l]=a,a=u,s*=2,l){case 0:r=n+s,o=i+s;break;case 1:n=r-s,o=i+s;break;case 2:r=n+s,i=o-s;break;case 3:n=r-s,i=o-s;break}this._root&&this._root.length&&(this._root=a)}return this._x0=n,this._y0=i,this._x1=r,this._y1=o,this}function UI(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function jI(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function zt(e,t,n,i,r){this.node=e,this.x0=t,this.y0=n,this.x1=i,this.y1=r}function qI(e,t,n){var i,r=this._x0,o=this._y0,s,a,u,l,c=this._x1,f=this._y1,d=[],h=this._root,g,p;for(h&&d.push(new zt(h,r,o,c,f)),n==null?n=1/0:(r=e-n,o=t-n,c=e+n,f=t+n,n*=n);g=d.pop();)if(!(!(h=g.node)||(s=g.x0)>c||(a=g.y0)>f||(u=g.x1)<r||(l=g.y1)<o))if(h.length){var m=(s+u)/2,y=(a+l)/2;d.push(new zt(h[3],m,y,u,l),new zt(h[2],s,y,m,l),new zt(h[1],m,a,u,y),new zt(h[0],s,a,m,y)),(p=(t>=y)<<1|e>=m)&&(g=d[d.length-1],d[d.length-1]=d[d.length-1-p],d[d.length-1-p]=g)}else{var b=e-+this._x.call(null,h.data),v=t-+this._y.call(null,h.data),x=b*b+v*v;if(x<n){var w=Math.sqrt(n=x);r=e-w,o=t-w,c=e+w,f=t+w,i=h.data}}return i}function WI(e){if(isNaN(c=+this._x.call(null,e))||isNaN(f=+this._y.call(null,e)))return this;var t,n=this._root,i,r,o,s=this._x0,a=this._y0,u=this._x1,l=this._y1,c,f,d,h,g,p,m,y;if(!n)return this;if(n.length)for(;;){if((g=c>=(d=(s+u)/2))?s=d:u=d,(p=f>=(h=(a+l)/2))?a=h:l=h,t=n,!(n=n[m=p<<1|g]))return this;if(!n.length)break;(t[m+1&3]||t[m+2&3]||t[m+3&3])&&(i=t,y=m)}for(;n.data!==e;)if(r=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,r?(o?r.next=o:delete r.next,this):t?(o?t[m]=o:delete t[m],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(i?i[y]=n:this._root=n),this):(this._root=o,this)}function GI(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function HI(){return this._root}function VI(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function XI(e){var t=[],n,i=this._root,r,o,s,a,u;for(i&&t.push(new zt(i,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(i=n.node,o=n.x0,s=n.y0,a=n.x1,u=n.y1)&&i.length){var l=(o+a)/2,c=(s+u)/2;(r=i[3])&&t.push(new zt(r,l,c,a,u)),(r=i[2])&&t.push(new zt(r,o,c,l,u)),(r=i[1])&&t.push(new zt(r,l,s,a,c)),(r=i[0])&&t.push(new zt(r,o,s,l,c))}return this}function YI(e){var t=[],n=[],i;for(this._root&&t.push(new zt(this._root,this._x0,this._y0,this._x1,this._y1));i=t.pop();){var r=i.node;if(r.length){var o,s=i.x0,a=i.y0,u=i.x1,l=i.y1,c=(s+u)/2,f=(a+l)/2;(o=r[0])&&t.push(new zt(o,s,a,c,f)),(o=r[1])&&t.push(new zt(o,c,a,u,f)),(o=r[2])&&t.push(new zt(o,s,f,c,l)),(o=r[3])&&t.push(new zt(o,c,f,u,l))}n.push(i)}for(;i=n.pop();)e(i.node,i.x0,i.y0,i.x1,i.y1);return this}function KI(e){return e[0]}function JI(e){return arguments.length?(this._x=e,this):this._x}function QI(e){return e[1]}function ZI(e){return arguments.length?(this._y=e,this):this._y}function K1(e,t,n){var i=new J1(t??KI,n??QI,NaN,NaN,NaN,NaN);return e==null?i:i.addAll(e)}function J1(e,t,n,i,r,o){this._x=e,this._y=t,this._x0=n,this._y0=i,this._x1=r,this._y1=o,this._root=void 0}function kE(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Xt=K1.prototype=J1.prototype;Xt.copy=function(){var e=new J1(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,i;if(!t)return e;if(!t.length)return e._root=kE(t),e;for(n=[{source:t,target:e._root=new Array(4)}];t=n.pop();)for(var r=0;r<4;++r)(i=t.source[r])&&(i.length?n.push({source:i,target:t.target[r]=new Array(4)}):t.target[r]=kE(i));return e};Xt.add=PI;Xt.addAll=zI;Xt.cover=BI;Xt.data=UI;Xt.extent=jI;Xt.find=qI;Xt.remove=WI;Xt.removeAll=GI;Xt.root=HI;Xt.size=VI;Xt.visit=XI;Xt.visitAfter=YI;Xt.x=JI;Xt.y=ZI;function Bt(e){return function(){return e}}function Gr(e){return(e()-.5)*1e-6}function eP(e){return e.x+e.vx}function tP(e){return e.y+e.vy}function nP(e){var t,n,i,r=1,o=1;typeof e!="function"&&(e=Bt(e==null?1:+e));function s(){for(var l,c=t.length,f,d,h,g,p,m,y=0;y<o;++y)for(f=K1(t,eP,tP).visitAfter(a),l=0;l<c;++l)d=t[l],p=n[d.index],m=p*p,h=d.x+d.vx,g=d.y+d.vy,f.visit(b);function b(v,x,w,S,E){var $=v.data,A=v.r,C=p+A;if($){if($.index>d.index){var F=h-$.x-$.vx,I=g-$.y-$.vy,j=F*F+I*I;j<C*C&&(F===0&&(F=Gr(i),j+=F*F),I===0&&(I=Gr(i),j+=I*I),j=(C-(j=Math.sqrt(j)))/j*r,d.vx+=(F*=j)*(C=(A*=A)/(m+A)),d.vy+=(I*=j)*C,$.vx-=F*(C=1-C),$.vy-=I*C)}return}return x>h+C||S<h-C||w>g+C||E<g-C}}function a(l){if(l.data)return l.r=n[l.data.index];for(var c=l.r=0;c<4;++c)l[c]&&l[c].r>l.r&&(l.r=l[c].r)}function u(){if(t){var l,c=t.length,f;for(n=new Array(c),l=0;l<c;++l)f=t[l],n[f.index]=+e(f,l,t)}}return s.initialize=function(l,c){t=l,i=c,u()},s.iterations=function(l){return arguments.length?(o=+l,s):o},s.strength=function(l){return arguments.length?(r=+l,s):r},s.radius=function(l){return arguments.length?(e=typeof l=="function"?l:Bt(+l),u(),s):e},s}function iP(e){return e.index}function CE(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}function rP(e){var t=iP,n=f,i,r=Bt(30),o,s,a,u,l,c=1;e==null&&(e=[]);function f(m){return 1/Math.min(a[m.source.index],a[m.target.index])}function d(m){for(var y=0,b=e.length;y<c;++y)for(var v=0,x,w,S,E,$,A,C;v<b;++v)x=e[v],w=x.source,S=x.target,E=S.x+S.vx-w.x-w.vx||Gr(l),$=S.y+S.vy-w.y-w.vy||Gr(l),A=Math.sqrt(E*E+$*$),A=(A-o[v])/A*m*i[v],E*=A,$*=A,S.vx-=E*(C=u[v]),S.vy-=$*C,w.vx+=E*(C=1-C),w.vy+=$*C}function h(){if(s){var m,y=s.length,b=e.length,v=new Map(s.map((w,S)=>[t(w,S,s),w])),x;for(m=0,a=new Array(y);m<b;++m)x=e[m],x.index=m,typeof x.source!="object"&&(x.source=CE(v,x.source)),typeof x.target!="object"&&(x.target=CE(v,x.target)),a[x.source.index]=(a[x.source.index]||0)+1,a[x.target.index]=(a[x.target.index]||0)+1;for(m=0,u=new Array(b);m<b;++m)x=e[m],u[m]=a[x.source.index]/(a[x.source.index]+a[x.target.index]);i=new Array(b),g(),o=new Array(b),p()}}function g(){if(s)for(var m=0,y=e.length;m<y;++m)i[m]=+n(e[m],m,e)}function p(){if(s)for(var m=0,y=e.length;m<y;++m)o[m]=+r(e[m],m,e)}return d.initialize=function(m,y){s=m,l=y,h()},d.links=function(m){return arguments.length?(e=m,h(),d):e},d.id=function(m){return arguments.length?(t=m,d):t},d.iterations=function(m){return arguments.length?(c=+m,d):c},d.strength=function(m){return arguments.length?(n=typeof m=="function"?m:Bt(+m),g(),d):n},d.distance=function(m){return arguments.length?(r=typeof m=="function"?m:Bt(+m),p(),d):r},d}const oP=1664525,sP=1013904223,FE=4294967296;function aP(){let e=1;return()=>(e=(oP*e+sP)%FE)/FE}function uP(e){return e.x}function lP(e){return e.y}var cP=10,fP=Math.PI*(3-Math.sqrt(5));function dP(e){var t,n=1,i=.001,r=1-Math.pow(i,1/300),o=0,s=.6,a=new Map,u=uL(f),l=lL("tick","end"),c=aP();e==null&&(e=[]);function f(){d(),l.call("tick",t),n<i&&(u.stop(),l.call("end",t))}function d(p){var m,y=e.length,b;p===void 0&&(p=1);for(var v=0;v<p;++v)for(n+=(o-n)*r,a.forEach(function(x){x(n)}),m=0;m<y;++m)b=e[m],b.fx==null?b.x+=b.vx*=s:(b.x=b.fx,b.vx=0),b.fy==null?b.y+=b.vy*=s:(b.y=b.fy,b.vy=0);return t}function h(){for(var p=0,m=e.length,y;p<m;++p){if(y=e[p],y.index=p,y.fx!=null&&(y.x=y.fx),y.fy!=null&&(y.y=y.fy),isNaN(y.x)||isNaN(y.y)){var b=cP*Math.sqrt(.5+p),v=p*fP;y.x=b*Math.cos(v),y.y=b*Math.sin(v)}(isNaN(y.vx)||isNaN(y.vy))&&(y.vx=y.vy=0)}}function g(p){return p.initialize&&p.initialize(e,c),p}return h(),t={tick:d,restart:function(){return u.restart(f),t},stop:function(){return u.stop(),t},nodes:function(p){return arguments.length?(e=p,h(),a.forEach(g),t):e},alpha:function(p){return arguments.length?(n=+p,t):n},alphaMin:function(p){return arguments.length?(i=+p,t):i},alphaDecay:function(p){return arguments.length?(r=+p,t):+r},alphaTarget:function(p){return arguments.length?(o=+p,t):o},velocityDecay:function(p){return arguments.length?(s=1-p,t):1-s},randomSource:function(p){return arguments.length?(c=p,a.forEach(g),t):c},force:function(p,m){return arguments.length>1?(m==null?a.delete(p):a.set(p,g(m)),t):a.get(p)},find:function(p,m,y){var b=0,v=e.length,x,w,S,E,$;for(y==null?y=1/0:y*=y,b=0;b<v;++b)E=e[b],x=p-E.x,w=m-E.y,S=x*x+w*w,S<y&&($=E,y=S);return $},on:function(p,m){return arguments.length>1?(l.on(p,m),t):l.on(p)}}}function hP(){var e,t,n,i,r=Bt(-30),o,s=1,a=1/0,u=.81;function l(h){var g,p=e.length,m=K1(e,uP,lP).visitAfter(f);for(i=h,g=0;g<p;++g)t=e[g],m.visit(d)}function c(){if(e){var h,g=e.length,p;for(o=new Array(g),h=0;h<g;++h)p=e[h],o[p.index]=+r(p,h,e)}}function f(h){var g=0,p,m,y=0,b,v,x;if(h.length){for(b=v=x=0;x<4;++x)(p=h[x])&&(m=Math.abs(p.value))&&(g+=p.value,y+=m,b+=m*p.x,v+=m*p.y);h.x=b/y,h.y=v/y}else{p=h,p.x=p.data.x,p.y=p.data.y;do g+=o[p.data.index];while(p=p.next)}h.value=g}function d(h,g,p,m){if(!h.value)return!0;var y=h.x-t.x,b=h.y-t.y,v=m-g,x=y*y+b*b;if(v*v/u<x)return x<a&&(y===0&&(y=Gr(n),x+=y*y),b===0&&(b=Gr(n),x+=b*b),x<s&&(x=Math.sqrt(s*x)),t.vx+=y*h.value*i/x,t.vy+=b*h.value*i/x),!0;if(h.length||x>=a)return;(h.data!==t||h.next)&&(y===0&&(y=Gr(n),x+=y*y),b===0&&(b=Gr(n),x+=b*b),x<s&&(x=Math.sqrt(s*x)));do h.data!==t&&(v=o[h.data.index]*i/x,t.vx+=y*v,t.vy+=b*v);while(h=h.next)}return l.initialize=function(h,g){e=h,n=g,c()},l.strength=function(h){return arguments.length?(r=typeof h=="function"?h:Bt(+h),c(),l):r},l.distanceMin=function(h){return arguments.length?(s=h*h,l):Math.sqrt(s)},l.distanceMax=function(h){return arguments.length?(a=h*h,l):Math.sqrt(a)},l.theta=function(h){return arguments.length?(u=h*h,l):Math.sqrt(u)},l}function gP(e){var t=Bt(.1),n,i,r;typeof e!="function"&&(e=Bt(e==null?0:+e));function o(a){for(var u=0,l=n.length,c;u<l;++u)c=n[u],c.vx+=(r[u]-c.x)*i[u]*a}function s(){if(n){var a,u=n.length;for(i=new Array(u),r=new Array(u),a=0;a<u;++a)i[a]=isNaN(r[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return o.initialize=function(a){n=a,s()},o.strength=function(a){return arguments.length?(t=typeof a=="function"?a:Bt(+a),s(),o):t},o.x=function(a){return arguments.length?(e=typeof a=="function"?a:Bt(+a),s(),o):e},o}function pP(e){var t=Bt(.1),n,i,r;typeof e!="function"&&(e=Bt(e==null?0:+e));function o(a){for(var u=0,l=n.length,c;u<l;++u)c=n[u],c.vy+=(r[u]-c.y)*i[u]*a}function s(){if(n){var a,u=n.length;for(i=new Array(u),r=new Array(u),a=0;a<u;++a)i[a]=isNaN(r[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return o.initialize=function(a){n=a,s()},o.strength=function(a){return arguments.length?(t=typeof a=="function"?a:Bt(+a),s(),o):t},o.y=function(a){return arguments.length?(e=typeof a=="function"?a:Bt(+a),s(),o):e},o}var re=1e-6,jf=1e-12,ge=Math.PI,We=ge/2,qf=ge/4,Gt=ge*2,Xe=180/ge,he=ge/180,ye=Math.abs,ja=Math.atan,Ln=Math.atan2,oe=Math.cos,Mc=Math.ceil,qk=Math.exp,Pm=Math.hypot,Wf=Math.log,rp=Math.pow,ie=Math.sin,Rn=Math.sign||function(e){return e>0?1:e<0?-1:0},Ht=Math.sqrt,Q1=Math.tan;function Wk(e){return e>1?0:e<-1?ge:Math.acos(e)}function tn(e){return e>1?We:e<-1?-We:Math.asin(e)}function mt(){}function Gf(e,t){e&&OE.hasOwnProperty(e.type)&&OE[e.type](e,t)}var _E={Feature:function(e,t){Gf(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,i=-1,r=n.length;++i<r;)Gf(n[i].geometry,t)}},OE={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)e=n[i],t.point(e[0],e[1],e[2])},LineString:function(e,t){zm(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)zm(n[i],t,0)},Polygon:function(e,t){RE(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,i=-1,r=n.length;++i<r;)RE(n[i],t)},GeometryCollection:function(e,t){for(var n=e.geometries,i=-1,r=n.length;++i<r;)Gf(n[i],t)}};function zm(e,t,n){var i=-1,r=e.length-n,o;for(t.lineStart();++i<r;)o=e[i],t.point(o[0],o[1],o[2]);t.lineEnd()}function RE(e,t){var n=-1,i=e.length;for(t.polygonStart();++n<i;)zm(e[n],t,1);t.polygonEnd()}function ur(e,t){e&&_E.hasOwnProperty(e.type)?_E[e.type](e,t):Gf(e,t)}var Hf=new qt,Vf=new qt,Gk,Hk,Bm,Um,jm,Li={point:mt,lineStart:mt,lineEnd:mt,polygonStart:function(){Hf=new qt,Li.lineStart=mP,Li.lineEnd=yP},polygonEnd:function(){var e=+Hf;Vf.add(e<0?Gt+e:e),this.lineStart=this.lineEnd=this.point=mt},sphere:function(){Vf.add(Gt)}};function mP(){Li.point=bP}function yP(){Vk(Gk,Hk)}function bP(e,t){Li.point=Vk,Gk=e,Hk=t,e*=he,t*=he,Bm=e,Um=oe(t=t/2+qf),jm=ie(t)}function Vk(e,t){e*=he,t*=he,t=t/2+qf;var n=e-Bm,i=n>=0?1:-1,r=i*n,o=oe(t),s=ie(t),a=jm*s,u=Um*o+a*oe(r),l=a*i*ie(r);Hf.add(Ln(l,u)),Bm=e,Um=o,jm=s}function vP(e){return Vf=new qt,ur(e,Li),Vf*2}function Xf(e){return[Ln(e[1],e[0]),tn(e[2])]}function es(e){var t=e[0],n=e[1],i=oe(n);return[i*oe(t),i*ie(t),ie(n)]}function Dc(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function da(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function op(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Tc(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Yf(e){var t=Ht(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Be,Qt,je,hn,Io,Xk,Yk,ia,el,Ir,yr,sr={point:qm,lineStart:ME,lineEnd:DE,polygonStart:function(){sr.point=Jk,sr.lineStart=xP,sr.lineEnd=EP,el=new qt,Li.polygonStart()},polygonEnd:function(){Li.polygonEnd(),sr.point=qm,sr.lineStart=ME,sr.lineEnd=DE,Hf<0?(Be=-(je=180),Qt=-(hn=90)):el>re?hn=90:el<-re&&(Qt=-90),yr[0]=Be,yr[1]=je},sphere:function(){Be=-(je=180),Qt=-(hn=90)}};function qm(e,t){Ir.push(yr=[Be=e,je=e]),t<Qt&&(Qt=t),t>hn&&(hn=t)}function Kk(e,t){var n=es([e*he,t*he]);if(ia){var i=da(ia,n),r=[i[1],-i[0],0],o=da(r,i);Yf(o),o=Xf(o);var s=e-Io,a=s>0?1:-1,u=o[0]*Xe*a,l,c=ye(s)>180;c^(a*Io<u&&u<a*e)?(l=o[1]*Xe,l>hn&&(hn=l)):(u=(u+360)%360-180,c^(a*Io<u&&u<a*e)?(l=-o[1]*Xe,l<Qt&&(Qt=l)):(t<Qt&&(Qt=t),t>hn&&(hn=t))),c?e<Io?dn(Be,e)>dn(Be,je)&&(je=e):dn(e,je)>dn(Be,je)&&(Be=e):je>=Be?(e<Be&&(Be=e),e>je&&(je=e)):e>Io?dn(Be,e)>dn(Be,je)&&(je=e):dn(e,je)>dn(Be,je)&&(Be=e)}else Ir.push(yr=[Be=e,je=e]);t<Qt&&(Qt=t),t>hn&&(hn=t),ia=n,Io=e}function ME(){sr.point=Kk}function DE(){yr[0]=Be,yr[1]=je,sr.point=qm,ia=null}function Jk(e,t){if(ia){var n=e-Io;el.add(ye(n)>180?n+(n>0?360:-360):n)}else Xk=e,Yk=t;Li.point(e,t),Kk(e,t)}function xP(){Li.lineStart()}function EP(){Jk(Xk,Yk),Li.lineEnd(),ye(el)>re&&(Be=-(je=180)),yr[0]=Be,yr[1]=je,ia=null}function dn(e,t){return(t-=e)<0?t+360:t}function wP(e,t){return e[0]-t[0]}function TE(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}function SP(e){var t,n,i,r,o,s,a;if(hn=je=-(Be=Qt=1/0),Ir=[],ur(e,sr),n=Ir.length){for(Ir.sort(wP),t=1,i=Ir[0],o=[i];t<n;++t)r=Ir[t],TE(i,r[0])||TE(i,r[1])?(dn(i[0],r[1])>dn(i[0],i[1])&&(i[1]=r[1]),dn(r[0],i[1])>dn(i[0],i[1])&&(i[0]=r[0])):o.push(i=r);for(s=-1/0,n=o.length-1,t=0,i=o[n];t<=n;i=r,++t)r=o[t],(a=dn(i[1],r[0]))>s&&(s=a,Be=r[0],je=i[1])}return Ir=yr=null,Be===1/0||Qt===1/0?[[NaN,NaN],[NaN,NaN]]:[[Be,Qt],[je,hn]]}var Mu,Kf,Jf,Qf,Zf,ed,td,nd,Wm,Gm,Hm,Qk,Zk,Lt,It,Pt,ei={sphere:mt,point:Z1,lineStart:NE,lineEnd:LE,polygonStart:function(){ei.lineStart=kP,ei.lineEnd=CP},polygonEnd:function(){ei.lineStart=NE,ei.lineEnd=LE}};function Z1(e,t){e*=he,t*=he;var n=oe(t);jl(n*oe(e),n*ie(e),ie(t))}function jl(e,t,n){++Mu,Jf+=(e-Jf)/Mu,Qf+=(t-Qf)/Mu,Zf+=(n-Zf)/Mu}function NE(){ei.point=$P}function $P(e,t){e*=he,t*=he;var n=oe(t);Lt=n*oe(e),It=n*ie(e),Pt=ie(t),ei.point=AP,jl(Lt,It,Pt)}function AP(e,t){e*=he,t*=he;var n=oe(t),i=n*oe(e),r=n*ie(e),o=ie(t),s=Ln(Ht((s=It*o-Pt*r)*s+(s=Pt*i-Lt*o)*s+(s=Lt*r-It*i)*s),Lt*i+It*r+Pt*o);Kf+=s,ed+=s*(Lt+(Lt=i)),td+=s*(It+(It=r)),nd+=s*(Pt+(Pt=o)),jl(Lt,It,Pt)}function LE(){ei.point=Z1}function kP(){ei.point=FP}function CP(){eC(Qk,Zk),ei.point=Z1}function FP(e,t){Qk=e,Zk=t,e*=he,t*=he,ei.point=eC;var n=oe(t);Lt=n*oe(e),It=n*ie(e),Pt=ie(t),jl(Lt,It,Pt)}function eC(e,t){e*=he,t*=he;var n=oe(t),i=n*oe(e),r=n*ie(e),o=ie(t),s=It*o-Pt*r,a=Pt*i-Lt*o,u=Lt*r-It*i,l=Pm(s,a,u),c=tn(l),f=l&&-c/l;Wm.add(f*s),Gm.add(f*a),Hm.add(f*u),Kf+=c,ed+=c*(Lt+(Lt=i)),td+=c*(It+(It=r)),nd+=c*(Pt+(Pt=o)),jl(Lt,It,Pt)}function _P(e){Mu=Kf=Jf=Qf=Zf=ed=td=nd=0,Wm=new qt,Gm=new qt,Hm=new qt,ur(e,ei);var t=+Wm,n=+Gm,i=+Hm,r=Pm(t,n,i);return r<jf&&(t=ed,n=td,i=nd,Kf<re&&(t=Jf,n=Qf,i=Zf),r=Pm(t,n,i),r<jf)?[NaN,NaN]:[Ln(n,t)*Xe,tn(i/r)*Xe]}function Vm(e,t){function n(i,r){return i=e(i,r),t(i[0],i[1])}return e.invert&&t.invert&&(n.invert=function(i,r){return i=t.invert(i,r),i&&e.invert(i[0],i[1])}),n}function Xm(e,t){return ye(e)>ge&&(e-=Math.round(e/Gt)*Gt),[e,t]}Xm.invert=Xm;function tC(e,t,n){return(e%=Gt)?t||n?Vm(PE(e),zE(t,n)):PE(e):t||n?zE(t,n):Xm}function IE(e){return function(t,n){return t+=e,ye(t)>ge&&(t-=Math.round(t/Gt)*Gt),[t,n]}}function PE(e){var t=IE(e);return t.invert=IE(-e),t}function zE(e,t){var n=oe(e),i=ie(e),r=oe(t),o=ie(t);function s(a,u){var l=oe(u),c=oe(a)*l,f=ie(a)*l,d=ie(u),h=d*n+c*i;return[Ln(f*r-h*o,c*n-d*i),tn(h*r+f*o)]}return s.invert=function(a,u){var l=oe(u),c=oe(a)*l,f=ie(a)*l,d=ie(u),h=d*r-f*o;return[Ln(f*r+d*o,c*n+h*i),tn(h*n-c*i)]},s}function OP(e){e=tC(e[0]*he,e[1]*he,e.length>2?e[2]*he:0);function t(n){return n=e(n[0]*he,n[1]*he),n[0]*=Xe,n[1]*=Xe,n}return t.invert=function(n){return n=e.invert(n[0]*he,n[1]*he),n[0]*=Xe,n[1]*=Xe,n},t}function RP(e,t,n,i,r,o){if(n){var s=oe(t),a=ie(t),u=i*n;r==null?(r=t+i*Gt,o=t-u/2):(r=BE(s,r),o=BE(s,o),(i>0?r<o:r>o)&&(r+=i*Gt));for(var l,c=r;i>0?c>o:c<o;c-=u)l=Xf([s,-a*oe(c),-a*ie(c)]),e.point(l[0],l[1])}}function BE(e,t){t=es(t),t[0]-=e,Yf(t);var n=Wk(-t[1]);return((-t[2]<0?-n:n)+Gt-re)%Gt}function nC(){var e=[],t;return{point:function(n,i,r){t.push([n,i,r])},lineStart:function(){e.push(t=[])},lineEnd:mt,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function pf(e,t){return ye(e[0]-t[0])<re&&ye(e[1]-t[1])<re}function Nc(e,t,n,i){this.x=e,this.z=t,this.o=n,this.e=i,this.v=!1,this.n=this.p=null}function iC(e,t,n,i,r){var o=[],s=[],a,u;if(e.forEach(function(g){if(!((p=g.length-1)<=0)){var p,m=g[0],y=g[p],b;if(pf(m,y)){if(!m[2]&&!y[2]){for(r.lineStart(),a=0;a<p;++a)r.point((m=g[a])[0],m[1]);r.lineEnd();return}y[0]+=2*re}o.push(b=new Nc(m,g,null,!0)),s.push(b.o=new Nc(m,null,b,!1)),o.push(b=new Nc(y,g,null,!1)),s.push(b.o=new Nc(y,null,b,!0))}}),!!o.length){for(s.sort(t),UE(o),UE(s),a=0,u=s.length;a<u;++a)s[a].e=n=!n;for(var l=o[0],c,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;c=d.z,r.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,u=c.length;a<u;++a)r.point((f=c[a])[0],f[1]);else i(d.x,d.n.x,1,r);d=d.n}else{if(h)for(c=d.p.z,a=c.length-1;a>=0;--a)r.point((f=c[a])[0],f[1]);else i(d.x,d.p.x,-1,r);d=d.p}d=d.o,c=d.z,h=!h}while(!d.v);r.lineEnd()}}}function UE(e){if(t=e.length){for(var t,n=0,i=e[0],r;++n<t;)i.n=r=e[n],r.p=i,i=r;i.n=r=e[0],r.p=i}}function sp(e){return ye(e[0])<=ge?e[0]:Rn(e[0])*((ye(e[0])+ge)%Gt-ge)}function MP(e,t){var n=sp(t),i=t[1],r=ie(i),o=[ie(n),-oe(n),0],s=0,a=0,u=new qt;r===1?i=We+re:r===-1&&(i=-We-re);for(var l=0,c=e.length;l<c;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],g=sp(h),p=h[1]/2+qf,m=ie(p),y=oe(p),b=0;b<d;++b,g=x,m=S,y=E,h=v){var v=f[b],x=sp(v),w=v[1]/2+qf,S=ie(w),E=oe(w),$=x-g,A=$>=0?1:-1,C=A*$,F=C>ge,I=m*S;if(u.add(Ln(I*A*ie(C),y*E+I*oe(C))),s+=F?$+A*Gt:$,F^g>=n^x>=n){var j=da(es(h),es(v));Yf(j);var O=da(o,j);Yf(O);var k=(F^$>=0?-1:1)*tn(O[2]);(i>k||i===k&&(j[0]||j[1]))&&(a+=F^$>=0?1:-1)}}return(s<-re||s<re&&u<-jf)^a&1}function rC(e,t,n,i){return function(r){var o=t(r),s=nC(),a=t(s),u=!1,l,c,f,d={point:h,lineStart:p,lineEnd:m,polygonStart:function(){d.point=y,d.lineStart=b,d.lineEnd=v,c=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=p,d.lineEnd=m,c=Lk(c);var x=MP(l,i);c.length?(u||(r.polygonStart(),u=!0),iC(c,TP,x,n,r)):x&&(u||(r.polygonStart(),u=!0),r.lineStart(),n(null,null,1,r),r.lineEnd()),u&&(r.polygonEnd(),u=!1),c=l=null},sphere:function(){r.polygonStart(),r.lineStart(),n(null,null,1,r),r.lineEnd(),r.polygonEnd()}};function h(x,w){e(x,w)&&r.point(x,w)}function g(x,w){o.point(x,w)}function p(){d.point=g,o.lineStart()}function m(){d.point=h,o.lineEnd()}function y(x,w){f.push([x,w]),a.point(x,w)}function b(){a.lineStart(),f=[]}function v(){y(f[0][0],f[0][1]),a.lineEnd();var x=a.clean(),w=s.result(),S,E=w.length,$,A,C;if(f.pop(),l.push(f),f=null,!!E){if(x&1){if(A=w[0],($=A.length-1)>0){for(u||(r.polygonStart(),u=!0),r.lineStart(),S=0;S<$;++S)r.point((C=A[S])[0],C[1]);r.lineEnd()}return}E>1&&x&2&&w.push(w.pop().concat(w.shift())),c.push(w.filter(DP))}}return d}}function DP(e){return e.length>1}function TP(e,t){return((e=e.x)[0]<0?e[1]-We-re:We-e[1])-((t=t.x)[0]<0?t[1]-We-re:We-t[1])}const jE=rC(function(){return!0},NP,IP,[-ge,-We]);function NP(e){var t=NaN,n=NaN,i=NaN,r;return{lineStart:function(){e.lineStart(),r=1},point:function(o,s){var a=o>0?ge:-ge,u=ye(o-t);ye(u-ge)<re?(e.point(t,n=(n+s)/2>0?We:-We),e.point(i,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),r=0):i!==a&&u>=ge&&(ye(t-i)<re&&(t-=i*re),ye(o-a)<re&&(o-=a*re),n=LP(t,n,o,s),e.point(i,n),e.lineEnd(),e.lineStart(),e.point(a,n),r=0),e.point(t=o,n=s),i=a},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-r}}}function LP(e,t,n,i){var r,o,s=ie(e-n);return ye(s)>re?ja((ie(t)*(o=oe(i))*ie(n)-ie(i)*(r=oe(t))*ie(e))/(r*o*s)):(t+i)/2}function IP(e,t,n,i){var r;if(e==null)r=n*We,i.point(-ge,r),i.point(0,r),i.point(ge,r),i.point(ge,0),i.point(ge,-r),i.point(0,-r),i.point(-ge,-r),i.point(-ge,0),i.point(-ge,r);else if(ye(e[0]-t[0])>re){var o=e[0]<t[0]?ge:-ge;r=n*o/2,i.point(-o,r),i.point(0,r),i.point(o,r)}else i.point(t[0],t[1])}function PP(e){var t=oe(e),n=2*he,i=t>0,r=ye(t)>re;function o(c,f,d,h){RP(h,e,n,d,c,f)}function s(c,f){return oe(c)*oe(f)>t}function a(c){var f,d,h,g,p;return{lineStart:function(){g=h=!1,p=1},point:function(m,y){var b=[m,y],v,x=s(m,y),w=i?x?0:l(m,y):x?l(m+(m<0?ge:-ge),y):0;if(!f&&(g=h=x)&&c.lineStart(),x!==h&&(v=u(f,b),(!v||pf(f,v)||pf(b,v))&&(b[2]=1)),x!==h)p=0,x?(c.lineStart(),v=u(b,f),c.point(v[0],v[1])):(v=u(f,b),c.point(v[0],v[1],2),c.lineEnd()),f=v;else if(r&&f&&i^x){var S;!(w&d)&&(S=u(b,f,!0))&&(p=0,i?(c.lineStart(),c.point(S[0][0],S[0][1]),c.point(S[1][0],S[1][1]),c.lineEnd()):(c.point(S[1][0],S[1][1]),c.lineEnd(),c.lineStart(),c.point(S[0][0],S[0][1],3)))}x&&(!f||!pf(f,b))&&c.point(b[0],b[1]),f=b,h=x,d=w},lineEnd:function(){h&&c.lineEnd(),f=null},clean:function(){return p|(g&&h)<<1}}}function u(c,f,d){var h=es(c),g=es(f),p=[1,0,0],m=da(h,g),y=Dc(m,m),b=m[0],v=y-b*b;if(!v)return!d&&c;var x=t*y/v,w=-t*b/v,S=da(p,m),E=Tc(p,x),$=Tc(m,w);op(E,$);var A=S,C=Dc(E,A),F=Dc(A,A),I=C*C-F*(Dc(E,E)-1);if(!(I<0)){var j=Ht(I),O=Tc(A,(-C-j)/F);if(op(O,E),O=Xf(O),!d)return O;var k=c[0],_=f[0],N=c[1],W=f[1],P;_<k&&(P=k,k=_,_=P);var Q=_-k,le=ye(Q-ge)<re,se=le||Q<re;if(!le&&W<N&&(P=N,N=W,W=P),se?le?N+W>0^O[1]<(ye(O[0]-k)<re?N:W):N<=O[1]&&O[1]<=W:Q>ge^(k<=O[0]&&O[0]<=_)){var me=Tc(A,(-C+j)/F);return op(me,E),[O,Xf(me)]}}}function l(c,f){var d=i?e:ge-e,h=0;return c<-d?h|=1:c>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return rC(s,a,o,i?[0,-e]:[-ge,e-ge])}function zP(e,t,n,i,r,o){var s=e[0],a=e[1],u=t[0],l=t[1],c=0,f=1,d=u-s,h=l-a,g;if(g=n-s,!(!d&&g>0)){if(g/=d,d<0){if(g<c)return;g<f&&(f=g)}else if(d>0){if(g>f)return;g>c&&(c=g)}if(g=r-s,!(!d&&g<0)){if(g/=d,d<0){if(g>f)return;g>c&&(c=g)}else if(d>0){if(g<c)return;g<f&&(f=g)}if(g=i-a,!(!h&&g>0)){if(g/=h,h<0){if(g<c)return;g<f&&(f=g)}else if(h>0){if(g>f)return;g>c&&(c=g)}if(g=o-a,!(!h&&g<0)){if(g/=h,h<0){if(g>f)return;g>c&&(c=g)}else if(h>0){if(g<c)return;g<f&&(f=g)}return c>0&&(e[0]=s+c*d,e[1]=a+c*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var Du=1e9,Lc=-Du;function oC(e,t,n,i){function r(l,c){return e<=l&&l<=n&&t<=c&&c<=i}function o(l,c,f,d){var h=0,g=0;if(l==null||(h=s(l,f))!==(g=s(c,f))||u(l,c)<0^f>0)do d.point(h===0||h===3?e:n,h>1?i:t);while((h=(h+f+4)%4)!==g);else d.point(c[0],c[1])}function s(l,c){return ye(l[0]-e)<re?c>0?0:3:ye(l[0]-n)<re?c>0?2:1:ye(l[1]-t)<re?c>0?1:0:c>0?3:2}function a(l,c){return u(l.x,c.x)}function u(l,c){var f=s(l,1),d=s(c,1);return f!==d?f-d:f===0?c[1]-l[1]:f===1?l[0]-c[0]:f===2?l[1]-c[1]:c[0]-l[0]}return function(l){var c=l,f=nC(),d,h,g,p,m,y,b,v,x,w,S,E={point:$,lineStart:I,lineEnd:j,polygonStart:C,polygonEnd:F};function $(k,_){r(k,_)&&c.point(k,_)}function A(){for(var k=0,_=0,N=h.length;_<N;++_)for(var W=h[_],P=1,Q=W.length,le=W[0],se,me,Ve=le[0],$e=le[1];P<Q;++P)se=Ve,me=$e,le=W[P],Ve=le[0],$e=le[1],me<=i?$e>i&&(Ve-se)*(i-me)>($e-me)*(e-se)&&++k:$e<=i&&(Ve-se)*(i-me)<($e-me)*(e-se)&&--k;return k}function C(){c=f,d=[],h=[],S=!0}function F(){var k=A(),_=S&&k,N=(d=Lk(d)).length;(_||N)&&(l.polygonStart(),_&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),N&&iC(d,a,k,o,l),l.polygonEnd()),c=l,d=h=g=null}function I(){E.point=O,h&&h.push(g=[]),w=!0,x=!1,b=v=NaN}function j(){d&&(O(p,m),y&&x&&f.rejoin(),d.push(f.result())),E.point=$,x&&c.lineEnd()}function O(k,_){var N=r(k,_);if(h&&g.push([k,_]),w)p=k,m=_,y=N,w=!1,N&&(c.lineStart(),c.point(k,_));else if(N&&x)c.point(k,_);else{var W=[b=Math.max(Lc,Math.min(Du,b)),v=Math.max(Lc,Math.min(Du,v))],P=[k=Math.max(Lc,Math.min(Du,k)),_=Math.max(Lc,Math.min(Du,_))];zP(W,P,e,t,n,i)?(x||(c.lineStart(),c.point(W[0],W[1])),c.point(P[0],P[1]),N||c.lineEnd(),S=!1):N&&(c.lineStart(),c.point(k,_),S=!1)}b=k,v=_,x=N}return E}}function qE(e,t,n){var i=pn(e,t-re,n).concat(t);return function(r){return i.map(function(o){return[r,o]})}}function WE(e,t,n){var i=pn(e,t-re,n).concat(t);return function(r){return i.map(function(o){return[o,r]})}}function BP(){var e,t,n,i,r,o,s,a,u=10,l=u,c=90,f=360,d,h,g,p,m=2.5;function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return pn(Mc(i/c)*c,n,c).map(g).concat(pn(Mc(a/f)*f,s,f).map(p)).concat(pn(Mc(t/u)*u,e,u).filter(function(v){return ye(v%c)>re}).map(d)).concat(pn(Mc(o/l)*l,r,l).filter(function(v){return ye(v%f)>re}).map(h))}return y.lines=function(){return b().map(function(v){return{type:"LineString",coordinates:v}})},y.outline=function(){return{type:"Polygon",coordinates:[g(i).concat(p(s).slice(1),g(n).reverse().slice(1),p(a).reverse().slice(1))]}},y.extent=function(v){return arguments.length?y.extentMajor(v).extentMinor(v):y.extentMinor()},y.extentMajor=function(v){return arguments.length?(i=+v[0][0],n=+v[1][0],a=+v[0][1],s=+v[1][1],i>n&&(v=i,i=n,n=v),a>s&&(v=a,a=s,s=v),y.precision(m)):[[i,a],[n,s]]},y.extentMinor=function(v){return arguments.length?(t=+v[0][0],e=+v[1][0],o=+v[0][1],r=+v[1][1],t>e&&(v=t,t=e,e=v),o>r&&(v=o,o=r,r=v),y.precision(m)):[[t,o],[e,r]]},y.step=function(v){return arguments.length?y.stepMajor(v).stepMinor(v):y.stepMinor()},y.stepMajor=function(v){return arguments.length?(c=+v[0],f=+v[1],y):[c,f]},y.stepMinor=function(v){return arguments.length?(u=+v[0],l=+v[1],y):[u,l]},y.precision=function(v){return arguments.length?(m=+v,d=qE(o,r,90),h=WE(t,e,m),g=qE(a,s,90),p=WE(i,n,m),y):m},y.extentMajor([[-180,-90+re],[180,90-re]]).extentMinor([[-180,-80-re],[180,80+re]])}const yl=e=>e;var ap=new qt,Ym=new qt,sC,aC,Km,Jm,jr={point:mt,lineStart:mt,lineEnd:mt,polygonStart:function(){jr.lineStart=UP,jr.lineEnd=qP},polygonEnd:function(){jr.lineStart=jr.lineEnd=jr.point=mt,ap.add(ye(Ym)),Ym=new qt},result:function(){var e=ap/2;return ap=new qt,e}};function UP(){jr.point=jP}function jP(e,t){jr.point=uC,sC=Km=e,aC=Jm=t}function uC(e,t){Ym.add(Jm*e-Km*t),Km=e,Jm=t}function qP(){uC(sC,aC)}const GE=jr;var ha=1/0,id=ha,bl=-ha,rd=bl,WP={point:GP,lineStart:mt,lineEnd:mt,polygonStart:mt,polygonEnd:mt,result:function(){var e=[[ha,id],[bl,rd]];return bl=rd=-(id=ha=1/0),e}};function GP(e,t){e<ha&&(ha=e),e>bl&&(bl=e),t<id&&(id=t),t>rd&&(rd=t)}const od=WP;var Qm=0,Zm=0,Tu=0,sd=0,ad=0,Js=0,e0=0,t0=0,Nu=0,lC,cC,Fi,_i,Qn={point:ts,lineStart:HE,lineEnd:VE,polygonStart:function(){Qn.lineStart=XP,Qn.lineEnd=YP},polygonEnd:function(){Qn.point=ts,Qn.lineStart=HE,Qn.lineEnd=VE},result:function(){var e=Nu?[e0/Nu,t0/Nu]:Js?[sd/Js,ad/Js]:Tu?[Qm/Tu,Zm/Tu]:[NaN,NaN];return Qm=Zm=Tu=sd=ad=Js=e0=t0=Nu=0,e}};function ts(e,t){Qm+=e,Zm+=t,++Tu}function HE(){Qn.point=HP}function HP(e,t){Qn.point=VP,ts(Fi=e,_i=t)}function VP(e,t){var n=e-Fi,i=t-_i,r=Ht(n*n+i*i);sd+=r*(Fi+e)/2,ad+=r*(_i+t)/2,Js+=r,ts(Fi=e,_i=t)}function VE(){Qn.point=ts}function XP(){Qn.point=KP}function YP(){fC(lC,cC)}function KP(e,t){Qn.point=fC,ts(lC=Fi=e,cC=_i=t)}function fC(e,t){var n=e-Fi,i=t-_i,r=Ht(n*n+i*i);sd+=r*(Fi+e)/2,ad+=r*(_i+t)/2,Js+=r,r=_i*e-Fi*t,e0+=r*(Fi+e),t0+=r*(_i+t),Nu+=r*3,ts(Fi=e,_i=t)}const XE=Qn;function dC(e){this._context=e}dC.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:{this._context.moveTo(e,t),this._point=1;break}case 1:{this._context.lineTo(e,t);break}default:{this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,Gt);break}}},result:mt};var n0=new qt,up,hC,gC,Lu,Iu,ud={point:mt,lineStart:function(){ud.point=JP},lineEnd:function(){up&&pC(hC,gC),ud.point=mt},polygonStart:function(){up=!0},polygonEnd:function(){up=null},result:function(){var e=+n0;return n0=new qt,e}};function JP(e,t){ud.point=pC,hC=Lu=e,gC=Iu=t}function pC(e,t){Lu-=e,Iu-=t,n0.add(Ht(Lu*Lu+Iu*Iu)),Lu=e,Iu=t}const YE=ud;let KE,ld,JE,QE;class ZE{constructor(t){this._append=t==null?mC:QP(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:{this._append`M${t},${n}`,this._point=1;break}case 1:{this._append`L${t},${n}`;break}default:{if(this._append`M${t},${n}`,this._radius!==JE||this._append!==ld){const i=this._radius,r=this._;this._="",this._append`m0,${i}a${i},${i} 0 1,1 0,${-2*i}a${i},${i} 0 1,1 0,${2*i}z`,JE=i,ld=this._append,QE=this._,this._=r}this._+=QE;break}}}result(){const t=this._;return this._="",t.length?t:null}}function mC(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function QP(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return mC;if(t!==KE){const n=10**t;KE=t,ld=function(r){let o=1;this._+=r[0];for(const s=r.length;o<s;++o)this._+=Math.round(arguments[o]*n)/n+r[o]}}return ld}function yC(e,t){let n=3,i=4.5,r,o;function s(a){return a&&(typeof i=="function"&&o.pointRadius(+i.apply(this,arguments)),ur(a,r(o))),o.result()}return s.area=function(a){return ur(a,r(GE)),GE.result()},s.measure=function(a){return ur(a,r(YE)),YE.result()},s.bounds=function(a){return ur(a,r(od)),od.result()},s.centroid=function(a){return ur(a,r(XE)),XE.result()},s.projection=function(a){return arguments.length?(r=a==null?(e=null,yl):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new ZE(n)):new dC(t=a),typeof i!="function"&&o.pointRadius(i),s):t},s.pointRadius=function(a){return arguments.length?(i=typeof a=="function"?a:(o.pointRadius(+a),+a),s):i},s.digits=function(a){if(!arguments.length)return n;if(a==null)n=null;else{const u=Math.floor(a);if(!(u>=0))throw new RangeError(`invalid digits: ${a}`);n=u}return t===null&&(o=new ZE(n)),s},s.projection(e).digits(n).context(t)}function uh(e){return function(t){var n=new i0;for(var i in e)n[i]=e[i];return n.stream=t,n}}function i0(){}i0.prototype={constructor:i0,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function ey(e,t,n){var i=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),i!=null&&e.clipExtent(null),ur(n,e.stream(od)),t(od.result()),i!=null&&e.clipExtent(i),e}function lh(e,t,n){return ey(e,function(i){var r=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(r/(i[1][0]-i[0][0]),o/(i[1][1]-i[0][1])),a=+t[0][0]+(r-s*(i[1][0]+i[0][0]))/2,u=+t[0][1]+(o-s*(i[1][1]+i[0][1]))/2;e.scale(150*s).translate([a,u])},n)}function ty(e,t,n){return lh(e,[[0,0],t],n)}function ny(e,t,n){return ey(e,function(i){var r=+t,o=r/(i[1][0]-i[0][0]),s=(r-o*(i[1][0]+i[0][0]))/2,a=-o*i[0][1];e.scale(150*o).translate([s,a])},n)}function iy(e,t,n){return ey(e,function(i){var r=+t,o=r/(i[1][1]-i[0][1]),s=-o*i[0][0],a=(r-o*(i[1][1]+i[0][1]))/2;e.scale(150*o).translate([s,a])},n)}var ew=16,ZP=oe(30*he);function tw(e,t){return+t?tz(e,t):ez(e)}function ez(e){return uh({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function tz(e,t){function n(i,r,o,s,a,u,l,c,f,d,h,g,p,m){var y=l-i,b=c-r,v=y*y+b*b;if(v>4*t&&p--){var x=s+d,w=a+h,S=u+g,E=Ht(x*x+w*w+S*S),$=tn(S/=E),A=ye(ye(S)-1)<re||ye(o-f)<re?(o+f)/2:Ln(w,x),C=e(A,$),F=C[0],I=C[1],j=F-i,O=I-r,k=b*j-y*O;(k*k/v>t||ye((y*j+b*O)/v-.5)>.3||s*d+a*h+u*g<ZP)&&(n(i,r,o,s,a,u,F,I,A,x/=E,w/=E,S,p,m),m.point(F,I),n(F,I,A,x,w,S,l,c,f,d,h,g,p,m))}}return function(i){var r,o,s,a,u,l,c,f,d,h,g,p,m={point:y,lineStart:b,lineEnd:x,polygonStart:function(){i.polygonStart(),m.lineStart=w},polygonEnd:function(){i.polygonEnd(),m.lineStart=b}};function y($,A){$=e($,A),i.point($[0],$[1])}function b(){f=NaN,m.point=v,i.lineStart()}function v($,A){var C=es([$,A]),F=e($,A);n(f,d,c,h,g,p,f=F[0],d=F[1],c=$,h=C[0],g=C[1],p=C[2],ew,i),i.point(f,d)}function x(){m.point=y,i.lineEnd()}function w(){b(),m.point=S,m.lineEnd=E}function S($,A){v(r=$,A),o=f,s=d,a=h,u=g,l=p,m.point=v}function E(){n(f,d,c,h,g,p,o,s,r,a,u,l,ew,i),m.lineEnd=x,x()}return m}}var nz=uh({point:function(e,t){this.stream.point(e*he,t*he)}});function iz(e){return uh({point:function(t,n){var i=e(t,n);return this.stream.point(i[0],i[1])}})}function rz(e,t,n,i,r){function o(s,a){return s*=i,a*=r,[t+e*s,n-e*a]}return o.invert=function(s,a){return[(s-t)/e*i,(n-a)/e*r]},o}function nw(e,t,n,i,r,o){if(!o)return rz(e,t,n,i,r);var s=oe(o),a=ie(o),u=s*e,l=a*e,c=s/e,f=a/e,d=(a*n-s*t)/e,h=(a*t+s*n)/e;function g(p,m){return p*=i,m*=r,[u*p-l*m+t,n-l*p-u*m]}return g.invert=function(p,m){return[i*(c*p-f*m+d),r*(h-f*p-c*m)]},g}function Wi(e){return bC(function(){return e})()}function bC(e){var t,n=150,i=480,r=250,o=0,s=0,a=0,u=0,l=0,c,f=0,d=1,h=1,g=null,p=jE,m=null,y,b,v,x=yl,w=.5,S,E,$,A,C;function F(k){return $(k[0]*he,k[1]*he)}function I(k){return k=$.invert(k[0],k[1]),k&&[k[0]*Xe,k[1]*Xe]}F.stream=function(k){return A&&C===k?A:A=nz(iz(c)(p(S(x(C=k)))))},F.preclip=function(k){return arguments.length?(p=k,g=void 0,O()):p},F.postclip=function(k){return arguments.length?(x=k,m=y=b=v=null,O()):x},F.clipAngle=function(k){return arguments.length?(p=+k?PP(g=k*he):(g=null,jE),O()):g*Xe},F.clipExtent=function(k){return arguments.length?(x=k==null?(m=y=b=v=null,yl):oC(m=+k[0][0],y=+k[0][1],b=+k[1][0],v=+k[1][1]),O()):m==null?null:[[m,y],[b,v]]},F.scale=function(k){return arguments.length?(n=+k,j()):n},F.translate=function(k){return arguments.length?(i=+k[0],r=+k[1],j()):[i,r]},F.center=function(k){return arguments.length?(o=k[0]%360*he,s=k[1]%360*he,j()):[o*Xe,s*Xe]},F.rotate=function(k){return arguments.length?(a=k[0]%360*he,u=k[1]%360*he,l=k.length>2?k[2]%360*he:0,j()):[a*Xe,u*Xe,l*Xe]},F.angle=function(k){return arguments.length?(f=k%360*he,j()):f*Xe},F.reflectX=function(k){return arguments.length?(d=k?-1:1,j()):d<0},F.reflectY=function(k){return arguments.length?(h=k?-1:1,j()):h<0},F.precision=function(k){return arguments.length?(S=tw(E,w=k*k),O()):Ht(w)},F.fitExtent=function(k,_){return lh(F,k,_)},F.fitSize=function(k,_){return ty(F,k,_)},F.fitWidth=function(k,_){return ny(F,k,_)},F.fitHeight=function(k,_){return iy(F,k,_)};function j(){var k=nw(n,0,0,d,h,f).apply(null,t(o,s)),_=nw(n,i-k[0],r-k[1],d,h,f);return c=tC(a,u,l),E=Vm(t,_),$=Vm(c,E),S=tw(E,w),O()}function O(){return A=C=null,F}return function(){return t=e.apply(this,arguments),F.invert=t.invert&&I,j()}}function ry(e){var t=0,n=ge/3,i=bC(e),r=i(t,n);return r.parallels=function(o){return arguments.length?i(t=o[0]*he,n=o[1]*he):[t*Xe,n*Xe]},r}function oz(e){var t=oe(e);function n(i,r){return[i*t,ie(r)/t]}return n.invert=function(i,r){return[i/t,tn(r*t)]},n}function sz(e,t){var n=ie(e),i=(n+ie(t))/2;if(ye(i)<re)return oz(e);var r=1+n*(2*i-n),o=Ht(r)/i;function s(a,u){var l=Ht(r-2*i*ie(u))/i;return[l*ie(a*=i),o-l*oe(a)]}return s.invert=function(a,u){var l=o-u,c=Ln(a,ye(l))*Rn(l);return l*i<0&&(c-=ge*Rn(a)*Rn(l)),[c/i,tn((r-(a*a+l*l)*i*i)/(2*i))]},s}function cd(){return ry(sz).scale(155.424).center([0,33.6442])}function vC(){return cd().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function az(e){var t=e.length;return{point:function(n,i){for(var r=-1;++r<t;)e[r].point(n,i)},sphere:function(){for(var n=-1;++n<t;)e[n].sphere()},lineStart:function(){for(var n=-1;++n<t;)e[n].lineStart()},lineEnd:function(){for(var n=-1;++n<t;)e[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<t;)e[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<t;)e[n].polygonEnd()}}}function uz(){var e,t,n=vC(),i,r=cd().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=cd().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,u,l={point:function(d,h){u=[d,h]}};function c(d){var h=d[0],g=d[1];return u=null,i.point(h,g),u||(o.point(h,g),u)||(a.point(h,g),u)}c.invert=function(d){var h=n.scale(),g=n.translate(),p=(d[0]-g[0])/h,m=(d[1]-g[1])/h;return(m>=.12&&m<.234&&p>=-.425&&p<-.214?r:m>=.166&&m<.234&&p>=-.214&&p<-.115?s:n).invert(d)},c.stream=function(d){return e&&t===d?e:e=az([n.stream(t=d),r.stream(d),s.stream(d)])},c.precision=function(d){return arguments.length?(n.precision(d),r.precision(d),s.precision(d),f()):n.precision()},c.scale=function(d){return arguments.length?(n.scale(d),r.scale(d*.35),s.scale(d),c.translate(n.translate())):n.scale()},c.translate=function(d){if(!arguments.length)return n.translate();var h=n.scale(),g=+d[0],p=+d[1];return i=n.translate(d).clipExtent([[g-.455*h,p-.238*h],[g+.455*h,p+.238*h]]).stream(l),o=r.translate([g-.307*h,p+.201*h]).clipExtent([[g-.425*h+re,p+.12*h+re],[g-.214*h-re,p+.234*h-re]]).stream(l),a=s.translate([g-.205*h,p+.212*h]).clipExtent([[g-.214*h+re,p+.166*h+re],[g-.115*h-re,p+.234*h-re]]).stream(l),f()},c.fitExtent=function(d,h){return lh(c,d,h)},c.fitSize=function(d,h){return ty(c,d,h)},c.fitWidth=function(d,h){return ny(c,d,h)},c.fitHeight=function(d,h){return iy(c,d,h)};function f(){return e=t=null,c}return c.scale(1070)}function xC(e){return function(t,n){var i=oe(t),r=oe(n),o=e(i*r);return o===1/0?[2,0]:[o*r*ie(t),o*ie(n)]}}function ql(e){return function(t,n){var i=Ht(t*t+n*n),r=e(i),o=ie(r),s=oe(r);return[Ln(t*o,i*s),tn(i&&n*o/i)]}}var EC=xC(function(e){return Ht(2/(1+e))});EC.invert=ql(function(e){return 2*tn(e/2)});function lz(){return Wi(EC).scale(124.75).clipAngle(180-.001)}var wC=xC(function(e){return(e=Wk(e))&&e/ie(e)});wC.invert=ql(function(e){return e});function cz(){return Wi(wC).scale(79.4188).clipAngle(180-.001)}function ch(e,t){return[e,Wf(Q1((We+t)/2))]}ch.invert=function(e,t){return[e,2*ja(qk(t))-We]};function fz(){return SC(ch).scale(961/Gt)}function SC(e){var t=Wi(e),n=t.center,i=t.scale,r=t.translate,o=t.clipExtent,s=null,a,u,l;t.scale=function(f){return arguments.length?(i(f),c()):i()},t.translate=function(f){return arguments.length?(r(f),c()):r()},t.center=function(f){return arguments.length?(n(f),c()):n()},t.clipExtent=function(f){return arguments.length?(f==null?s=a=u=l=null:(s=+f[0][0],a=+f[0][1],u=+f[1][0],l=+f[1][1]),c()):s==null?null:[[s,a],[u,l]]};function c(){var f=ge*i(),d=t(OP(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===ch?[[Math.max(d[0]-f,s),a],[Math.min(d[0]+f,u),l]]:[[s,Math.max(d[1]-f,a)],[u,Math.min(d[1]+f,l)]])}return c()}function Ic(e){return Q1((We+e)/2)}function dz(e,t){var n=oe(e),i=e===t?ie(e):Wf(n/oe(t))/Wf(Ic(t)/Ic(e)),r=n*rp(Ic(e),i)/i;if(!i)return ch;function o(s,a){r>0?a<-We+re&&(a=-We+re):a>We-re&&(a=We-re);var u=r/rp(Ic(a),i);return[u*ie(i*s),r-u*oe(i*s)]}return o.invert=function(s,a){var u=r-a,l=Rn(i)*Ht(s*s+u*u),c=Ln(s,ye(u))*Rn(u);return u*i<0&&(c-=ge*Rn(s)*Rn(u)),[c/i,2*ja(rp(r/l,1/i))-We]},o}function hz(){return ry(dz).scale(109.5).parallels([30,30])}function fd(e,t){return[e,t]}fd.invert=fd;function gz(){return Wi(fd).scale(152.63)}function pz(e,t){var n=oe(e),i=e===t?ie(e):(n-oe(t))/(t-e),r=n/i+e;if(ye(i)<re)return fd;function o(s,a){var u=r-a,l=i*s;return[u*ie(l),r-u*oe(l)]}return o.invert=function(s,a){var u=r-a,l=Ln(s,ye(u))*Rn(u);return u*i<0&&(l-=ge*Rn(s)*Rn(u)),[l/i,r-Rn(i)*Ht(s*s+u*u)]},o}function mz(){return ry(pz).scale(131.154).center([0,13.9389])}var tl=1.340264,nl=-.081106,il=893e-6,rl=.003796,dd=Ht(3)/2,yz=12;function $C(e,t){var n=tn(dd*ie(t)),i=n*n,r=i*i*i;return[e*oe(n)/(dd*(tl+3*nl*i+r*(7*il+9*rl*i))),n*(tl+nl*i+r*(il+rl*i))]}$C.invert=function(e,t){for(var n=t,i=n*n,r=i*i*i,o=0,s,a,u;o<yz&&(a=n*(tl+nl*i+r*(il+rl*i))-t,u=tl+3*nl*i+r*(7*il+9*rl*i),n-=s=a/u,i=n*n,r=i*i*i,!(ye(s)<jf));++o);return[dd*e*(tl+3*nl*i+r*(7*il+9*rl*i))/oe(n),tn(ie(n)/dd)]};function bz(){return Wi($C).scale(177.158)}function AC(e,t){var n=oe(t),i=oe(e)*n;return[n*ie(e)/i,ie(t)/i]}AC.invert=ql(ja);function vz(){return Wi(AC).scale(144.049).clipAngle(60)}function xz(){var e=1,t=0,n=0,i=1,r=1,o=0,s,a,u=null,l,c,f,d=1,h=1,g=uh({point:function(x,w){var S=v([x,w]);this.stream.point(S[0],S[1])}}),p=yl,m,y;function b(){return d=e*i,h=e*r,m=y=null,v}function v(x){var w=x[0]*d,S=x[1]*h;if(o){var E=S*s-w*a;w=w*s+S*a,S=E}return[w+t,S+n]}return v.invert=function(x){var w=x[0]-t,S=x[1]-n;if(o){var E=S*s+w*a;w=w*s-S*a,S=E}return[w/d,S/h]},v.stream=function(x){return m&&y===x?m:m=g(p(y=x))},v.postclip=function(x){return arguments.length?(p=x,u=l=c=f=null,b()):p},v.clipExtent=function(x){return arguments.length?(p=x==null?(u=l=c=f=null,yl):oC(u=+x[0][0],l=+x[0][1],c=+x[1][0],f=+x[1][1]),b()):u==null?null:[[u,l],[c,f]]},v.scale=function(x){return arguments.length?(e=+x,b()):e},v.translate=function(x){return arguments.length?(t=+x[0],n=+x[1],b()):[t,n]},v.angle=function(x){return arguments.length?(o=x%360*he,a=ie(o),s=oe(o),b()):o*Xe},v.reflectX=function(x){return arguments.length?(i=x?-1:1,b()):i<0},v.reflectY=function(x){return arguments.length?(r=x?-1:1,b()):r<0},v.fitExtent=function(x,w){return lh(v,x,w)},v.fitSize=function(x,w){return ty(v,x,w)},v.fitWidth=function(x,w){return ny(v,x,w)},v.fitHeight=function(x,w){return iy(v,x,w)},v}function kC(e,t){var n=t*t,i=n*n;return[e*(.8707-.131979*n+i*(-.013791+i*(.003971*n-.001529*i))),t*(1.007226+n*(.015085+i*(-.044475+.028874*n-.005916*i)))]}kC.invert=function(e,t){var n=t,i=25,r;do{var o=n*n,s=o*o;n-=r=(n*(1.007226+o*(.015085+s*(-.044475+.028874*o-.005916*s)))-t)/(1.007226+o*(.015085*3+s*(-.044475*7+.028874*9*o-.005916*11*s)))}while(ye(r)>re&&--i>0);return[e/(.8707+(o=n*n)*(-.131979+o*(-.013791+o*o*o*(.003971-.001529*o)))),n]};function Ez(){return Wi(kC).scale(175.295)}function CC(e,t){return[oe(t)*ie(e),ie(t)]}CC.invert=ql(tn);function wz(){return Wi(CC).scale(249.5).clipAngle(90+re)}function FC(e,t){var n=oe(t),i=1+oe(e)*n;return[n*ie(e)/i,ie(t)/i]}FC.invert=ql(function(e){return 2*ja(e)});function Sz(){return Wi(FC).scale(250).clipAngle(142)}function _C(e,t){return[Wf(Q1((We+t)/2)),-e]}_C.invert=function(e,t){return[-t,2*ja(qk(e))-We]};function $z(){var e=SC(_C),t=e.center,n=e.rotate;return e.center=function(i){return arguments.length?t([-i[1],i[0]]):(i=t(),[i[1],-i[0]])},e.rotate=function(i){return arguments.length?n([i[0],i[1],i.length>2?i[2]+90:90]):(i=n(),[i[0],i[1],i[2]-90])},n([0,0,90]).scale(159.155)}function Az(e,t){return e.parent===t.parent?1:2}function kz(e){return e.reduce(Cz,0)/e.length}function Cz(e,t){return e+t.x}function Fz(e){return 1+e.reduce(_z,0)}function _z(e,t){return Math.max(e,t.y)}function Oz(e){for(var t;t=e.children;)e=t[0];return e}function Rz(e){for(var t;t=e.children;)e=t[t.length-1];return e}function Mz(){var e=Az,t=1,n=1,i=!1;function r(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=kz(h),d.y=Fz(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var u=Oz(o),l=Rz(o),c=u.x-e(u,l)/2,f=l.x+e(l,u)/2;return o.eachAfter(i?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*n}:function(d){d.x=(d.x-c)/(f-c)*t,d.y=(1-(o.y?d.y/o.y:1))*n})}return r.separation=function(o){return arguments.length?(e=o,r):e},r.size=function(o){return arguments.length?(i=!1,t=+o[0],n=+o[1],r):i?null:[t,n]},r.nodeSize=function(o){return arguments.length?(i=!0,t=+o[0],n=+o[1],r):i?[t,n]:null},r}const Dz=1664525,Tz=1013904223,iw=4294967296;function Nz(){let e=1;return()=>(e=(Dz*e+Tz)%iw)/iw}function Lz(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Iz(e,t){let n=e.length,i,r;for(;n;)r=t()*n--|0,i=e[n],e[n]=e[r],e[r]=i;return e}function Pz(e,t){for(var n=0,i=(e=Iz(Array.from(e),t)).length,r=[],o,s;n<i;)o=e[n],s&&OC(s,o)?++n:(s=Bz(r=zz(r,o)),n=0);return s}function zz(e,t){var n,i;if(lp(t,e))return[t];for(n=0;n<e.length;++n)if(Pc(t,e[n])&&lp(Pu(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(i=n+1;i<e.length;++i)if(Pc(Pu(e[n],e[i]),t)&&Pc(Pu(e[n],t),e[i])&&Pc(Pu(e[i],t),e[n])&&lp(RC(e[n],e[i],t),e))return[e[n],e[i],t];throw new Error}function Pc(e,t){var n=e.r-t.r,i=t.x-e.x,r=t.y-e.y;return n<0||n*n<i*i+r*r}function OC(e,t){var n=e.r-t.r+Math.max(e.r,t.r,1)*1e-9,i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function lp(e,t){for(var n=0;n<t.length;++n)if(!OC(e,t[n]))return!1;return!0}function Bz(e){switch(e.length){case 1:return Uz(e[0]);case 2:return Pu(e[0],e[1]);case 3:return RC(e[0],e[1],e[2])}}function Uz(e){return{x:e.x,y:e.y,r:e.r}}function Pu(e,t){var n=e.x,i=e.y,r=e.r,o=t.x,s=t.y,a=t.r,u=o-n,l=s-i,c=a-r,f=Math.sqrt(u*u+l*l);return{x:(n+o+u/f*c)/2,y:(i+s+l/f*c)/2,r:(f+r+a)/2}}function RC(e,t,n){var i=e.x,r=e.y,o=e.r,s=t.x,a=t.y,u=t.r,l=n.x,c=n.y,f=n.r,d=i-s,h=i-l,g=r-a,p=r-c,m=u-o,y=f-o,b=i*i+r*r-o*o,v=b-s*s-a*a+u*u,x=b-l*l-c*c+f*f,w=h*g-d*p,S=(g*x-p*v)/(w*2)-i,E=(p*m-g*y)/w,$=(h*v-d*x)/(w*2)-r,A=(d*y-h*m)/w,C=E*E+A*A-1,F=2*(o+S*E+$*A),I=S*S+$*$-o*o,j=-(Math.abs(C)>1e-6?(F+Math.sqrt(F*F-4*C*I))/(2*C):I/F);return{x:i+S+E*j,y:r+$+A*j,r:j}}function rw(e,t,n){var i=e.x-t.x,r,o,s=e.y-t.y,a,u,l=i*i+s*s;l?(o=t.r+n.r,o*=o,u=e.r+n.r,u*=u,o>u?(r=(l+u-o)/(2*l),a=Math.sqrt(Math.max(0,u/l-r*r)),n.x=e.x-r*i-a*s,n.y=e.y-r*s+a*i):(r=(l+o-u)/(2*l),a=Math.sqrt(Math.max(0,o/l-r*r)),n.x=t.x+r*i-a*s,n.y=t.y+r*s+a*i)):(n.x=t.x+n.r,n.y=t.y)}function ow(e,t){var n=e.r+t.r-1e-6,i=t.x-e.x,r=t.y-e.y;return n>0&&n*n>i*i+r*r}function sw(e){var t=e._,n=e.next._,i=t.r+n.r,r=(t.x*n.r+n.x*t.r)/i,o=(t.y*n.r+n.y*t.r)/i;return r*r+o*o}function zc(e){this._=e,this.next=null,this.previous=null}function jz(e,t){if(!(o=(e=Lz(e)).length))return 0;var n,i,r,o,s,a,u,l,c,f,d;if(n=e[0],n.x=0,n.y=0,!(o>1))return n.r;if(i=e[1],n.x=-i.r,i.x=n.r,i.y=0,!(o>2))return n.r+i.r;rw(i,n,r=e[2]),n=new zc(n),i=new zc(i),r=new zc(r),n.next=r.previous=i,i.next=n.previous=r,r.next=i.previous=n;e:for(u=3;u<o;++u){rw(n._,i._,r=e[u]),r=new zc(r),l=i.next,c=n.previous,f=i._.r,d=n._.r;do if(f<=d){if(ow(l._,r._)){i=l,n.next=i,i.previous=n,--u;continue e}f+=l._.r,l=l.next}else{if(ow(c._,r._)){n=c,n.next=i,i.previous=n,--u;continue e}d+=c._.r,c=c.previous}while(l!==c.next);for(r.previous=n,r.next=i,n.next=i.previous=i=r,s=sw(n);(r=r.next)!==i;)(a=sw(r))<s&&(n=r,s=a);i=n.next}for(n=[i._],r=i;(r=r.next)!==i;)n.push(r._);for(r=Pz(n,t),u=0;u<o;++u)n=e[u],n.x-=r.x,n.y-=r.y;return r.r}function qz(e){return Math.sqrt(e.value)}function Wz(){var e=null,t=1,n=1,i=gE;function r(o){const s=Nz();return o.x=t/2,o.y=n/2,e?o.eachBefore(aw(e)).eachAfter(cp(i,.5,s)).eachBefore(uw(1)):o.eachBefore(aw(qz)).eachAfter(cp(gE,1,s)).eachAfter(cp(i,o.r/Math.min(t,n),s)).eachBefore(uw(Math.min(t,n)/(2*o.r))),o}return r.radius=function(o){return arguments.length?(e=gf(o),r):e},r.size=function(o){return arguments.length?(t=+o[0],n=+o[1],r):[t,n]},r.padding=function(o){return arguments.length?(i=typeof o=="function"?o:NL(+o),r):i},r}function aw(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function cp(e,t,n){return function(i){if(r=i.children){var r,o,s=r.length,a=e(i)*t||0,u;if(a)for(o=0;o<s;++o)r[o].r+=a;if(u=jz(r,n),a)for(o=0;o<s;++o)r[o].r-=a;i.r=u+a}}}function uw(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function Gz(){var e=1,t=1,n=0,i=!1;function r(s){var a=s.height+1;return s.x0=s.y0=n,s.x1=e,s.y1=t/a,s.eachBefore(o(t,a)),i&&s.eachBefore(LL),s}function o(s,a){return function(u){u.children&&sh(u,u.x0,s*(u.depth+1)/a,u.x1,s*(u.depth+2)/a);var l=u.x0,c=u.y0,f=u.x1-n,d=u.y1-n;f<l&&(l=f=(l+f)/2),d<c&&(c=d=(c+d)/2),u.x0=l,u.y0=c,u.x1=f,u.y1=d}}return r.round=function(s){return arguments.length?(i=!!s,r):i},r.size=function(s){return arguments.length?(e=+s[0],t=+s[1],r):[e,t]},r.padding=function(s){return arguments.length?(n=+s,r):n},r}var Hz={depth:-1},lw={},fp={};function Vz(e){return e.id}function Xz(e){return e.parentId}function cw(){var e=Vz,t=Xz,n;function i(r){var o=Array.from(r),s=e,a=t,u,l,c,f,d,h,g,p,m=new Map;if(n!=null){const y=o.map((x,w)=>Yz(n(x,w,r))),b=y.map(fw),v=new Set(y).add("");for(const x of b)v.has(x)||(v.add(x),y.push(x),b.push(fw(x)),o.push(fp));s=(x,w)=>y[w],a=(x,w)=>b[w]}for(c=0,u=o.length;c<u;++c)l=o[c],h=o[c]=new Rk(l),(g=s(l,c,r))!=null&&(g+="")&&(p=h.id=g,m.set(p,m.has(p)?lw:h)),(g=a(l,c,r))!=null&&(g+="")&&(h.parent=g);for(c=0;c<u;++c)if(h=o[c],g=h.parent){if(d=m.get(g),!d)throw new Error("missing: "+g);if(d===lw)throw new Error("ambiguous: "+g);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(n!=null){for(;f.data===fp&&f.children.length===1;)f=f.children[0],--u;for(let y=o.length-1;y>=0&&(h=o[y],h.data===fp);--y)h.data=null}if(f.parent=Hz,f.eachBefore(function(y){y.depth=y.parent.depth+1,--u}).eachBefore(IL),f.parent=null,u>0)throw new Error("cycle");return f}return i.id=function(r){return arguments.length?(e=gf(r),i):e},i.parentId=function(r){return arguments.length?(t=gf(r),i):t},i.path=function(r){return arguments.length?(n=gf(r),i):n},i}function Yz(e){e=`${e}`;let t=e.length;return r0(e,t-1)&&!r0(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function fw(e){let t=e.length;if(t<2)return"";for(;--t>1&&!r0(e,t););return e.slice(0,t)}function r0(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function Kz(e,t){return e.parent===t.parent?1:2}function dp(e){var t=e.children;return t?t[0]:e.t}function hp(e){var t=e.children;return t?t[t.length-1]:e.t}function Jz(e,t,n){var i=n/(t.i-e.i);t.c-=i,t.s+=n,e.c+=i,t.z+=n,t.m+=n}function Qz(e){for(var t=0,n=0,i=e.children,r=i.length,o;--r>=0;)o=i[r],o.z+=t,o.m+=t,t+=o.s+(n+=o.c)}function Zz(e,t,n){return e.a.parent===t.parent?e.a:n}function mf(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}mf.prototype=Object.create(Rk.prototype);function e6(e){for(var t=new mf(e,0),n,i=[t],r,o,s,a;n=i.pop();)if(o=n._.children)for(n.children=new Array(a=o.length),s=a-1;s>=0;--s)i.push(r=n.children[s]=new mf(o[s],s)),r.parent=n;return(t.parent=new mf(null,0)).children=[t],t}function t6(){var e=Kz,t=1,n=1,i=null;function r(l){var c=e6(l);if(c.eachAfter(o),c.parent.m=-c.z,c.eachBefore(s),i)l.eachBefore(u);else{var f=l,d=l,h=l;l.eachBefore(function(b){b.x<f.x&&(f=b),b.x>d.x&&(d=b),b.depth>h.depth&&(h=b)});var g=f===d?1:e(f,d)/2,p=g-f.x,m=t/(d.x+g+p),y=n/(h.depth||1);l.eachBefore(function(b){b.x=(b.x+p)*m,b.y=b.depth*y})}return l}function o(l){var c=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(c){Qz(l);var h=(c[0].z+c[c.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,c,f){if(c){for(var d=l,h=l,g=c,p=d.parent.children[0],m=d.m,y=h.m,b=g.m,v=p.m,x;g=hp(g),d=dp(d),g&&d;)p=dp(p),h=hp(h),h.a=l,x=g.z+b-d.z-m+e(g._,d._),x>0&&(Jz(Zz(g,l,f),l,x),m+=x,y+=x),b+=g.m,m+=d.m,v+=p.m,y+=h.m;g&&!hp(h)&&(h.t=g,h.m+=b-y),d&&!dp(p)&&(p.t=d,p.m+=m-v,f=l)}return f}function u(l){l.x*=t,l.y=l.depth*n}return r.separation=function(l){return arguments.length?(e=l,r):e},r.size=function(l){return arguments.length?(i=!1,t=+l[0],n=+l[1],r):i?null:[t,n]},r.nodeSize=function(l){return arguments.length?(i=!0,t=+l[0],n=+l[1],r):i?[t,n]:null},r}function n6(e,t,n,i,r){var o=e.children,s,a=o.length,u,l=new Array(a+1);for(l[0]=u=s=0;s<a;++s)l[s+1]=u+=o[s].value;c(0,a,e.value,t,n,i,r);function c(f,d,h,g,p,m,y){if(f>=d-1){var b=o[f];b.x0=g,b.y0=p,b.x1=m,b.y1=y;return}for(var v=l[f],x=h/2+v,w=f+1,S=d-1;w<S;){var E=w+S>>>1;l[E]<x?w=E+1:S=E}x-l[w-1]<l[w]-x&&f+1<w&&--w;var $=l[w]-v,A=h-$;if(m-g>y-p){var C=h?(g*A+m*$)/h:m;c(f,w,$,g,p,C,y),c(w,d,A,C,p,m,y)}else{var F=h?(p*A+y*$)/h:y;c(f,w,$,g,p,m,F),c(w,d,A,g,F,m,y)}}}function i6(e,t,n,i,r){(e.depth&1?G1:sh)(e,t,n,i,r)}const r6=function e(t){function n(i,r,o,s,a){if((u=i._squarify)&&u.ratio===t)for(var u,l,c,f,d=-1,h,g=u.length,p=i.value;++d<g;){for(l=u[d],c=l.children,f=l.value=0,h=c.length;f<h;++f)l.value+=c[f].value;l.dice?sh(l,r,o,s,p?o+=(a-o)*l.value/p:a):G1(l,r,o,p?r+=(s-r)*l.value/p:s,a),p-=l.value}else i._squarify=u=PL(t,i,r,o,s,a),u.ratio=t}return n.ratio=function(i){return e((i=+i)>1?i:1)},n}(zL);function MC(e){var t;function n(i){return i==null||isNaN(i=+i)?t:i}return n.invert=n,n.domain=n.range=function(i){return arguments.length?(e=Array.from(i,cE),n):e.slice()},n.unknown=function(i){return arguments.length?(t=i,n):t},n.copy=function(){return MC(e).unknown(t)},e=arguments.length?Array.from(e,cE):[0,1],Ua(n)}function dw(e){return Math.log(e)}function hw(e){return Math.exp(e)}function o6(e){return-Math.log(-e)}function s6(e){return-Math.exp(-e)}function a6(e){return isFinite(e)?+("1e"+e):e<0?0:e}function u6(e){return e===10?a6:e===Math.E?Math.exp:t=>Math.pow(e,t)}function l6(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function gw(e){return(t,n)=>-e(-t,n)}function oy(e){const t=e(dw,hw),n=t.domain;let i=10,r,o;function s(){return r=l6(i),o=u6(i),n()[0]<0?(r=gw(r),o=gw(o),e(o6,s6)):e(dw,hw),t}return t.base=function(a){return arguments.length?(i=+a,s()):i},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{const u=n();let l=u[0],c=u[u.length-1];const f=c<l;f&&([l,c]=[c,l]);let d=r(l),h=r(c),g,p;const m=a==null?10:+a;let y=[];if(!(i%1)&&h-d<m){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(g=1;g<i;++g)if(p=d<0?g/o(-d):g*o(d),!(p<l)){if(p>c)break;y.push(p)}}else for(;d<=h;++d)for(g=i-1;g>=1;--g)if(p=d>0?g/o(-d):g*o(d),!(p<l)){if(p>c)break;y.push(p)}y.length*2<m&&(y=fE(l,c,m))}else y=fE(d,h,Math.min(h-d,m)).map(o);return f?y.reverse():y},t.tickFormat=(a,u)=>{if(a==null&&(a=10),u==null&&(u=i===10?"s":","),typeof u!="function"&&(!(i%1)&&(u=Dm(u)).precision==null&&(u.trim=!0),u=Ak(u)),a===1/0)return u;const l=Math.max(1,i*a/t.ticks().length);return c=>{let f=c/o(Math.round(r(c)));return f*i<i-.5&&(f*=i),f<=l?u(c):""}},t.nice=()=>n(x5(n(),{floor:a=>o(Math.floor(r(a))),ceil:a=>o(Math.ceil(r(a)))})),t}function DC(){const e=oy(B1()).domain([1,10]);return e.copy=()=>U1(e,DC()).base(e.base()),xs.apply(e,arguments),e}function pw(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function mw(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function sy(e){var t=1,n=e(pw(t),mw(t));return n.constant=function(i){return arguments.length?e(pw(t=+i),mw(t)):t},Ua(n)}function TC(){var e=sy(B1());return e.copy=function(){return U1(e,TC()).constant(e.constant())},xs.apply(e,arguments)}function yw(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function c6(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function f6(e){return e<0?-e*e:e*e}function ay(e){var t=e(Wr,Wr),n=1;function i(){return n===1?e(Wr,Wr):n===.5?e(c6,f6):e(yw(n),yw(1/n))}return t.exponent=function(r){return arguments.length?(n=+r,i()):n},Ua(t)}function uy(){var e=ay(B1());return e.copy=function(){return U1(e,uy()).exponent(e.exponent())},xs.apply(e,arguments),e}function d6(){return uy.apply(null,arguments).exponent(.5)}function NC(){var e=[],t=[],n=[],i;function r(){var s=0,a=Math.max(1,t.length);for(n=new Array(a-1);++s<a;)n[s-1]=Tk(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?i:t[oh(n,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:e[0],a<n.length?n[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(gl),r()},o.range=function(s){return arguments.length?(t=Array.from(s),r()):t.slice()},o.unknown=function(s){return arguments.length?(i=s,o):i},o.quantiles=function(){return n.slice()},o.copy=function(){return NC().domain(e).range(t).unknown(i)},xs.apply(o,arguments)}function LC(){var e=0,t=1,n=1,i=[.5],r=[0,1],o;function s(u){return u!=null&&u<=u?r[oh(i,u,0,n)]:o}function a(){var u=-1;for(i=new Array(n);++u<n;)i[u]=((u+1)*t-(u-n)*e)/(n+1);return s}return s.domain=function(u){return arguments.length?([e,t]=u,e=+e,t=+t,a()):[e,t]},s.range=function(u){return arguments.length?(n=(r=Array.from(u)).length-1,a()):r.slice()},s.invertExtent=function(u){var l=r.indexOf(u);return l<0?[NaN,NaN]:l<1?[e,i[0]]:l>=n?[i[n-1],t]:[i[l-1],i[l]]},s.unknown=function(u){return arguments.length&&(o=u),s},s.thresholds=function(){return i.slice()},s.copy=function(){return LC().domain([e,t]).range(r).unknown(o)},xs.apply(Ua(s),arguments)}function IC(){var e=[.5],t=[0,1],n,i=1;function r(o){return o!=null&&o<=o?t[oh(e,o,0,i)]:n}return r.domain=function(o){return arguments.length?(e=Array.from(o),i=Math.min(e.length,t.length-1),r):e.slice()},r.range=function(o){return arguments.length?(t=Array.from(o),i=Math.min(e.length,t.length-1),r):t.slice()},r.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},r.unknown=function(o){return arguments.length?(n=o,r):n},r.copy=function(){return IC().domain(e).range(t).unknown(n)},xs.apply(r,arguments)}function h6(){return xs.apply(E5(S5,w5,wk,Rm,z1,Zu,Ek,xk,P1,vk).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function fh(){var e=0,t=1,n,i,r,o,s=Wr,a=!1,u;function l(f){return f==null||isNaN(f=+f)?u:s(r===0?.5:(f=(o(f)-n)*r,a?Math.max(0,Math.min(1,f)):f))}l.domain=function(f){return arguments.length?([e,t]=f,n=o(e=+e),i=o(t=+t),r=n===i?0:1/(i-n),l):[e,t]},l.clamp=function(f){return arguments.length?(a=!!f,l):a},l.interpolator=function(f){return arguments.length?(s=f,l):s};function c(f){return function(d){var h,g;return arguments.length?([h,g]=d,s=f(h,g),l):[s(0),s(1)]}}return l.range=c(Bl),l.rangeRound=c(rh),l.unknown=function(f){return arguments.length?(u=f,l):u},function(f){return o=f,n=f(e),i=f(t),r=n===i?0:1/(i-n),l}}function yo(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function ly(){var e=Ua(fh()(Wr));return e.copy=function(){return yo(e,ly())},mo.apply(e,arguments)}function PC(){var e=oy(fh()).domain([1,10]);return e.copy=function(){return yo(e,PC()).base(e.base())},mo.apply(e,arguments)}function zC(){var e=sy(fh());return e.copy=function(){return yo(e,zC()).constant(e.constant())},mo.apply(e,arguments)}function cy(){var e=ay(fh());return e.copy=function(){return yo(e,cy()).exponent(e.exponent())},mo.apply(e,arguments)}function g6(){return cy.apply(null,arguments).exponent(.5)}function dh(){var e=0,t=.5,n=1,i=1,r,o,s,a,u,l=Wr,c,f=!1,d;function h(p){return isNaN(p=+p)?d:(p=.5+((p=+c(p))-o)*(i*p<i*o?a:u),l(f?Math.max(0,Math.min(1,p)):p))}h.domain=function(p){return arguments.length?([e,t,n]=p,r=c(e=+e),o=c(t=+t),s=c(n=+n),a=r===o?0:.5/(o-r),u=o===s?0:.5/(s-o),i=o<r?-1:1,h):[e,t,n]},h.clamp=function(p){return arguments.length?(f=!!p,h):f},h.interpolator=function(p){return arguments.length?(l=p,h):l};function g(p){return function(m){var y,b,v;return arguments.length?([y,b,v]=m,l=X1(p,[y,b,v]),h):[l(0),l(.5),l(1)]}}return h.range=g(Bl),h.rangeRound=g(rh),h.unknown=function(p){return arguments.length?(d=p,h):d},function(p){return c=p,r=p(e),o=p(t),s=p(n),a=r===o?0:.5/(o-r),u=o===s?0:.5/(s-o),i=o<r?-1:1,h}}function BC(){var e=Ua(dh()(Wr));return e.copy=function(){return yo(e,BC())},mo.apply(e,arguments)}function UC(){var e=oy(dh()).domain([.1,1,10]);return e.copy=function(){return yo(e,UC()).base(e.base())},mo.apply(e,arguments)}function jC(){var e=sy(dh());return e.copy=function(){return yo(e,jC()).constant(e.constant())},mo.apply(e,arguments)}function fy(){var e=ay(dh());return e.copy=function(){return yo(e,fy()).exponent(e.exponent())},mo.apply(e,arguments)}function p6(){return fy.apply(null,arguments).exponent(.5)}const m6=qi("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),y6=qi("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),b6=qi("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),v6=qi("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),x6=qi("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),E6=qi("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),w6=qi("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),S6=qi("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),$6=qi("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),A6=qi("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function qC(e,t,n){var i=null,r=St(!0),o=null,s=Fk,a=null,u=Ck(l);e=typeof e=="function"?e:e===void 0?cL:St(+e),t=typeof t=="function"?t:t===void 0?St(0):St(+t),n=typeof n=="function"?n:n===void 0?fL:St(+n);function l(f){var d,h,g,p=(f=dL(f)).length,m,y=!1,b,v=new Array(p),x=new Array(p);for(o==null&&(a=s(b=u())),d=0;d<=p;++d){if(!(d<p&&r(m=f[d],d,f))===y)if(y=!y)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),g=d-1;g>=h;--g)a.point(v[g],x[g]);a.lineEnd(),a.areaEnd()}y&&(v[d]=+e(m,d,f),x[d]=+t(m,d,f),a.point(i?+i(m,d,f):v[d],n?+n(m,d,f):x[d]))}if(b)return a=null,b+""||null}function c(){return _k().defined(r).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:St(+f),i=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:St(+f),l):e},l.x1=function(f){return arguments.length?(i=f==null?null:typeof f=="function"?f:St(+f),l):i},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:St(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:St(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:St(+f),l):n},l.lineX0=l.lineY0=function(){return c().x(e).y(t)},l.lineY1=function(){return c().x(e).y(n)},l.lineX1=function(){return c().x(i).y(t)},l.defined=function(f){return arguments.length?(r=typeof f=="function"?f:St(!!f),l):r},l.curve=function(f){return arguments.length?(s=f,o!=null&&(a=s(o)),l):s},l.context=function(f){return arguments.length?(f==null?o=a=null:a=s(o=f),l):o},l}const k6={draw(e,t){const n=gL(t/pL);e.moveTo(n,0),e.arc(0,0,n,0,hL)}};function C6(e,t){let n=null,i=Ck(r);e=typeof e=="function"?e:St(e||k6),t=typeof t=="function"?t:St(t===void 0?64:+t);function r(){let o;if(n||(n=o=i()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),o)return n=null,o+""||null}return r.type=function(o){return arguments.length?(e=typeof o=="function"?o:St(o),r):e},r.size=function(o){return arguments.length?(t=typeof o=="function"?o:St(+o),r):t},r.context=function(o){return arguments.length?(n=o??null,r):n},r}const F6=/("(?:[^\\"]|\\.)*")|[:,]/g;function gp(e,t={}){const n=JSON.stringify([1],void 0,t.indent===void 0?2:t.indent).slice(2,-3),i=n===""?1/0:t.maxLength===void 0?80:t.maxLength;let{replacer:r}=t;return function o(s,a,u){s&&typeof s.toJSON=="function"&&(s=s.toJSON());const l=JSON.stringify(s,r);if(l===void 0)return l;const c=i-a.length-u;if(l.length<=c){const f=l.replace(F6,(d,h)=>h||`${d} `);if(f.length<=c)return f}if(r!=null&&(s=JSON.parse(l),r=void 0),typeof s=="object"&&s!==null){const f=a+n,d=[];let h=0,g,p;if(Array.isArray(s)){g="[",p="]";const{length:m}=s;for(;h<m;h++)d.push(o(s[h],f,h===m-1?0:1)||"null")}else{g="{",p="}";const m=Object.keys(s),{length:y}=m;for(;h<y;h++){const b=m[h],v=`${JSON.stringify(b)}: `,x=o(s[b],f,v.length+(h===y-1?0:1));x!==void 0&&d.push(v+x)}}if(d.length>0)return[g,n+d.join(`,
6
- ${f}`),p].join(`
7
- ${a}`)}return l}(e,"",0)}function ln(e,t,n){return Object.assign(e,{fields:t||[],fname:n})}function Ge(e){return e==null?null:e.fname}function Ct(e){return e==null?null:e.fields}function WC(e){return e.length===1?_6(e[0]):O6(e)}const _6=e=>function(t){return t[e]},O6=e=>{const t=e.length;return function(n){for(let i=0;i<t;++i)n=n[e[i]];return n}};function M(e){throw Error(e)}function Gi(e){const t=[],n=e.length;let i=null,r=0,o="",s,a,u;e=e+"";function l(){t.push(o+e.substring(s,a)),o="",s=a+1}for(s=a=0;a<n;++a)if(u=e[a],u==="\\")o+=e.substring(s,a++),s=a;else if(u===i)l(),i=null,r=-1;else{if(i)continue;s===r&&u==='"'||s===r&&u==="'"?(s=a+1,i=u):u==="."&&!r?a>s?l():s=a+1:u==="["?(a>s&&l(),r=s=a+1):u==="]"&&(r||M("Access path missing open bracket: "+e),r>0&&l(),r=0,s=a+1)}return r&&M("Access path missing closing bracket: "+e),i&&M("Access path missing closing quote: "+e),a>s&&(a++,l()),t}function In(e,t,n){const i=Gi(e),r=i.length===1?i[0]:e;return ln((n&&n.get||WC)(i),[r],t||r)}const Wl=In("id"),nn=ln(e=>e,[],"identity"),qr=ln(()=>0,[],"zero"),qa=ln(()=>1,[],"one"),Pn=ln(()=>!0,[],"true"),Tr=ln(()=>!1,[],"false"),dy=new Set([...Object.getOwnPropertyNames(Object.prototype).filter(e=>typeof Object.prototype[e]=="function"),"__proto__"]);function R6(e,t,n){const i=[t,...n];console[e](...i)}const GC=0,hy=1,gy=2,HC=3,VC=4;function hh(e,t,n=R6){let i=e||GC;return{level(r){return arguments.length?(i=+r,this):i},error(...r){return i>=hy&&n(t||"error","ERROR",r),this},warn(...r){return i>=gy&&n(t||"warn","WARN",r),this},info(...r){return i>=HC&&n(t||"log","INFO",r),this},debug(...r){return i>=VC&&n(t||"log","DEBUG",r),this}}}const T=Array.isArray;function X(e){return e===Object(e)}const bw=e=>e!=="__proto__"&&e!=="constructor"&&e!=="prototype";function Wa(...e){return e.reduce((t,n)=>{for(const i in n)if(i==="signals")t.signals=M6(t.signals,n.signals);else{const r=i==="legend"?{layout:1}:i==="style"?!0:null;Ga(t,i,n[i],r)}return t},{})}function Ga(e,t,n,i){if(!bw(t))return;let r,o;if(X(n)&&!T(n)){const s=n;o=X(e[t])?e[t]:e[t]={};for(r in s)i&&(i===!0||i[r])?Ga(o,r,s[r]):bw(r)&&(o[r]=s[r])}else e[t]=n}function M6(e,t){if(e==null)return t;if(t==null)return e;const n={},i=[];function r(o){n[o.name]||(n[o.name]=1,i.push(o))}return t.forEach(r),e.forEach(r),i}function be(e){return e[e.length-1]}function Ut(e){return e==null||e===""?null:+e}function XC(e){return e.length>0}const YC=e=>t=>e*Math.exp(t),KC=e=>t=>Math.log(e*t),JC=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),QC=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,hd=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e),ZC=e=>Ut(e)??0,eF=e=>e;function gh(e,t,n,i){XC(e)||M("Domain array must not be empty");const r=n(e[0]),o=n(be(e)),s=(o-r)*t;return[i(r-s),i(o-s)]}function tF(e,t){return gh(e,t,ZC,eF)}function nF(e,t){const n=Math.sign(e[0]);return gh(e,t,KC(n),YC(n))}function iF(e,t,n){return gh(e,t,hd(n),hd(1/n))}function rF(e,t,n){return gh(e,t,JC(n),QC(n))}function ph(e,t,n,i,r){XC(e)||M("Domain array must not be empty");const o=i(e[0]),s=i(be(e)),a=t!=null?i(t):(o+s)/2;return[r(a+(o-a)*n),r(a+(s-a)*n)]}function py(e,t,n){return ph(e,t,n,ZC,eF)}function my(e,t,n){const i=Math.sign(e[0]);return ph(e,t,n,KC(i),YC(i))}function gd(e,t,n,i){return ph(e,t,n,hd(i),hd(1/i))}function yy(e,t,n,i){return ph(e,t,n,JC(i),QC(i))}function oF(e){return 1+~~(new Date(e).getMonth()/3)}function sF(e){return 1+~~(new Date(e).getUTCMonth()/3)}function K(e){return e!=null?T(e)?e:[e]:[]}function aF(e,t,n){let i=e[0],r=e[1],o;return r<i&&(o=r,r=i,i=o),o=r-i,o>=n-t?[t,n]:[i=Math.min(Math.max(i,t),n-o),i+o]}function ce(e){return typeof e=="function"}const D6="descending";function by(e,t,n){const i=n||{},r=K(t)||[],o=[],s=[],a={},u=i.comparator||T6;return K(e).forEach((l,c)=>{if(l==null)return;o.push(r[c]===D6?-1:1);const f=ce(l)?l:In(l,void 0,i);s.push(f),(Ct(f)||[]).forEach(d=>a[d]=1)}),s.length===0?null:ln(u(s,o),Object.keys(a))}const Ha=(e,t)=>{let n=e,i=t;return(n<i||n==null)&&i!=null?-1:(n>i||i==null)&&n!=null?1:(i=i instanceof Date?+i:i,(n=n instanceof Date?+n:n)!==n&&i===i?-1:i!==i&&n===n?1:0)},T6=(e,t)=>e.length===1?N6(e[0],t[0]):L6(e,t,e.length),N6=(e,t)=>function(n,i){return Ha(e(n),e(i))*t},L6=(e,t,n)=>(t.push(0),function(i,r){let o,s=0,a=-1;for(;s===0&&++a<n;)o=e[a],s=Ha(o(i),o(r));return s*t[a]});function Rt(e){return ce(e)?e:()=>e}function vy(e,t){let n=null;return i=>{n&&clearTimeout(n),n=setTimeout(()=>(t(i),n=null),e)}}function fe(e,...t){for(const n of t)for(const i in n)e[i]=n[i];return e}function Ii(e,t){let n=0,i,r,o,s;if(e&&(i=e.length))if(t==null){for(r=e[n];n<i&&(r==null||r!==r);r=e[++n]);for(o=s=r;n<i;++n)r=e[n],r!=null&&(r<o&&(o=r),r>s&&(s=r))}else{for(r=t(e[n]);n<i&&(r==null||r!==r);r=t(e[++n]));for(o=s=r;n<i;++n)r=t(e[n]),r!=null&&(r<o&&(o=r),r>s&&(s=r))}return[o,s]}function uF(e,t){const n=e.length;let i=-1,r,o,s,a,u;if(t==null){for(;++i<n;)if(a=e[i],a!=null&&a>=a){s=u=a;break}if(i===n)return[-1,-1];for(r=o=i;++i<n;)a=e[i],a!=null&&(s>a&&(s=a,r=i),u<a&&(u=a,o=i))}else{for(;++i<n;)if(a=t(e[i],i,e),a!=null&&a>=a){s=u=a;break}if(i===n)return[-1,-1];for(r=o=i;++i<n;)a=t(e[i],i,e),a!=null&&(s>a&&(s=a,r=i),u<a&&(u=a,o=i))}return[r,o]}function J(e,t){return Object.hasOwn(e,t)}const Bc={};function Va(e){let t={},n;function i(o){return J(t,o)&&t[o]!==Bc}const r={size:0,empty:0,object:t,has:i,get(o){return i(o)?t[o]:void 0},set(o,s){return i(o)||(++r.size,t[o]===Bc&&--r.empty),t[o]=s,this},delete(o){return i(o)&&(--r.size,++r.empty,t[o]=Bc),this},clear(){r.size=r.empty=0,r.object=t={}},test(o){return arguments.length?(n=o,r):n},clean(){const o={};let s=0;for(const a in t){const u=t[a];u!==Bc&&(!n||!n(u))&&(o[a]=u,++s)}r.size=s,r.empty=0,r.object=t=o}};return e&&Object.keys(e).forEach(o=>{r.set(o,e[o])}),r}function lF(e,t,n,i,r,o){if(!n&&n!==0)return o;const s=+n;let a=e[0],u=be(e),l;if(u===void 0)return o;u<a&&(l=a,a=u,u=l),l=Math.abs(t-a);const c=Math.abs(u-t);return l<c&&l<=s?i:c<=s?r:o}function H(e,t,n){const i=e.prototype=Object.create(t.prototype);return Object.defineProperty(i,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),fe(i,n)}function Qs(e,t,n,i){let r=t[0],o=t[t.length-1],s;return r>o&&(s=r,r=o,o=s),n=n===void 0||n,i=i===void 0||i,(n?r<=e:r<e)&&(i?e<=o:e<o)}function Es(e){return typeof e=="boolean"}function eo(e){return Object.prototype.toString.call(e)==="[object Date]"}function cF(e){return e!=null&&ce(e[Symbol.iterator])}function Ee(e){return typeof e=="number"}function xy(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function Y(e){return typeof e=="string"}function Ey(e,t,n){const i=e?t?K(e).map(u=>u.replace(/\\(.)/g,"$1")):K(e):void 0,r=i==null?void 0:i.length,o=n&&n.get||WC,s=u=>o(t?[u]:Gi(u));let a;if(!r||!i)a=function(){return""};else if(r===1){const u=s(i[0]);a=function(l){return""+u(l)}}else{const u=i.map(s);a=function(l){let c=""+u[0](l),f=0;for(;++f<r;)c+="|"+u[f](l);return c}}return ln(a,i,"key")}function fF(e,t){const n=e[0],i=be(e),r=+t;return i===void 0?n:r?r===1?i:n+r*(i-n):n}const I6=1e4;function dF(e){e=+e||I6;let t,n,i;const r=()=>{t={},n={},i=0},o=(s,a)=>(++i>e&&(n=t,t={},i=1),t[s]=a);return r(),{clear:r,has:s=>J(t,s)||J(n,s),get:s=>J(t,s)?t[s]:J(n,s)?o(s,n[s]):void 0,set:(s,a)=>J(t,s)?t[s]=a:o(s,a)}}function P6(e){return e===Array||typeof e=="function"&&e.prototype&&ArrayBuffer.isView(e.prototype)}function hF(e,t,n,i){const r=t.length,o=n.length;if(!o)return t;if(!r)return n;const s=t.constructor,a=i||(P6(s)?new s(r+o):new Array(r+o));let u=0,l=0,c=0;for(;u<r&&l<o;++c)a[c]=e(t[u],n[l])>0?n[l++]:t[u++];for(;u<r;++u,++c)a[c]=t[u];for(;l<o;++l,++c)a[c]=n[l];return a}function zu(e,t){let n="";for(;--t>=0;)n+=e;return n}function gF(e,t,n,i){const r=n||" ",o=e+"",s=t-o.length;return s<=0?o:i==="left"?zu(r,s)+o:i==="center"?zu(r,~~(s/2))+o+zu(r,Math.ceil(s/2)):o+zu(r,s)}function Gl(e){return e&&be(e)-e[0]||0}function G(e){return T(e)?`[${e.map(t=>t===null?"null":G(t))}]`:X(e)||Y(e)?JSON.stringify(e).replaceAll("\u2028","\\u2028").replaceAll("\u2029","\\u2029"):e}function wy(e){return e==null||e===""?null:!e||e==="false"||e==="0"?!1:!!e}const z6=e=>Ee(e)||eo(e)?e:Date.parse(e);function Sy(e,t){return t=t||z6,e==null||e===""?null:t(e)}function $y(e){return e==null||e===""?null:e+""}function si(e){const t={},n=e.length;for(let i=0;i<n;++i)t[e[i]+""]=!0;return t}function pF(e,t,n,i){const r=i??"…",o=e+"",s=o.length,a=Math.max(0,t-r.length);return s<=t?o:n==="left"?r+o.slice(s-a):n==="center"?o.slice(0,Math.ceil(a/2))+r+o.slice(s-~~(a/2)):o.slice(0,a)+r}function Pr(e,t,n){if(e)if(t){const i=e.length;for(let r=0;r<i;++r){const o=t(e[r]);o&&n(o,r,e)}}else e.forEach(n)}function B6(e){return e}function U6(e){if(e==null)return B6;var t,n,i=e.scale[0],r=e.scale[1],o=e.translate[0],s=e.translate[1];return function(a,u){u||(t=n=0);var l=2,c=a.length,f=new Array(c);for(f[0]=(t+=a[0])*i+o,f[1]=(n+=a[1])*r+s;l<c;)f[l]=a[l],++l;return f}}function j6(e,t){for(var n,i=e.length,r=i-t;r<--i;)n=e[r],e[r++]=e[i],e[i]=n}function q6(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return vw(e,n)})}:vw(e,t)}function vw(e,t){var n=t.id,i=t.bbox,r=t.properties==null?{}:t.properties,o=mF(e,t);return n==null&&i==null?{type:"Feature",properties:r,geometry:o}:i==null?{type:"Feature",id:n,properties:r,geometry:o}:{type:"Feature",id:n,bbox:i,properties:r,geometry:o}}function mF(e,t){var n=U6(e.transform),i=e.arcs;function r(c,f){f.length&&f.pop();for(var d=i[c<0?~c:c],h=0,g=d.length;h<g;++h)f.push(n(d[h],h));c<0&&j6(f,g)}function o(c){return n(c)}function s(c){for(var f=[],d=0,h=c.length;d<h;++d)r(c[d],f);return f.length<2&&f.push(f[0]),f}function a(c){for(var f=s(c);f.length<4;)f.push(f[0]);return f}function u(c){return c.map(a)}function l(c){var f=c.type,d;switch(f){case"GeometryCollection":return{type:f,geometries:c.geometries.map(l)};case"Point":d=o(c.coordinates);break;case"MultiPoint":d=c.coordinates.map(o);break;case"LineString":d=s(c.arcs);break;case"MultiLineString":d=c.arcs.map(s);break;case"Polygon":d=u(c.arcs);break;case"MultiPolygon":d=c.arcs.map(u);break;default:return null}return{type:f,coordinates:d}}return l(t)}function W6(e,t){var n={},i={},r={},o=[],s=-1;t.forEach(function(l,c){var f=e.arcs[l<0?~l:l],d;f.length<3&&!f[1][0]&&!f[1][1]&&(d=t[++s],t[s]=l,t[c]=d)}),t.forEach(function(l){var c=a(l),f=c[0],d=c[1],h,g;if(h=r[f])if(delete r[h.end],h.push(l),h.end=d,g=i[d]){delete i[g.start];var p=g===h?h:h.concat(g);i[p.start=h.start]=r[p.end=g.end]=p}else i[h.start]=r[h.end]=h;else if(h=i[d])if(delete i[h.start],h.unshift(l),h.start=f,g=r[f]){delete r[g.end];var m=g===h?h:g.concat(h);i[m.start=g.start]=r[m.end=h.end]=m}else i[h.start]=r[h.end]=h;else h=[l],i[h.start=f]=r[h.end=d]=h});function a(l){var c=e.arcs[l<0?~l:l],f=c[0],d;return e.transform?(d=[0,0],c.forEach(function(h){d[0]+=h[0],d[1]+=h[1]})):d=c[c.length-1],l<0?[d,f]:[f,d]}function u(l,c){for(var f in l){var d=l[f];delete c[d.start],delete d.start,delete d.end,d.forEach(function(h){n[h<0?~h:h]=1}),o.push(d)}}return u(r,i),u(i,r),t.forEach(function(l){n[l<0?~l:l]||o.push([l])}),o}function G6(e){return mF(e,H6.apply(this,arguments))}function H6(e,t,n){var i,r,o;if(arguments.length>1)i=V6(e,t,n);else for(r=0,i=new Array(o=e.arcs.length);r<o;++r)i[r]=r;return{type:"MultiLineString",arcs:W6(e,i)}}function V6(e,t,n){var i=[],r=[],o;function s(f){var d=f<0?~f:f;(r[d]||(r[d]=[])).push({i:f,g:o})}function a(f){f.forEach(s)}function u(f){f.forEach(a)}function l(f){f.forEach(u)}function c(f){switch(o=f,f.type){case"GeometryCollection":f.geometries.forEach(c);break;case"LineString":a(f.arcs);break;case"MultiLineString":case"Polygon":u(f.arcs);break;case"MultiPolygon":l(f.arcs);break}}return c(t),r.forEach(n==null?function(f){i.push(f[0].i)}:function(f){n(f[0].g,f[f.length-1].g)&&i.push(f[0].i)}),i}const bt="year",rn="quarter",Ft="month",nt="week",on="date",At="day",Pi="dayofyear",Sn="hours",$n="minutes",zn="seconds",ai="milliseconds",Ay=[bt,rn,Ft,nt,on,At,Pi,Sn,$n,zn,ai],pp=Ay.reduce((e,t,n)=>(e[t]=1+n,e),{});function ky(e){const t=K(e).slice(),n={};return t.length||M("Missing time unit."),t.forEach(r=>{J(pp,r)?n[r]=1:M(`Invalid time unit: ${r}.`)}),(n[nt]||n[At]?1:0)+(n[rn]||n[Ft]||n[on]?1:0)+(n[Pi]?1:0)>1&&M(`Incompatible time units: ${e}`),t.sort((r,o)=>pp[r]-pp[o]),t}const X6={[bt]:"%Y ",[rn]:"Q%q ",[Ft]:"%b ",[on]:"%d ",[nt]:"W%U ",[At]:"%a ",[Pi]:"%j ",[Sn]:"%H:00",[$n]:"00:%M",[zn]:":%S",[ai]:".%L",[`${bt}-${Ft}`]:"%Y-%m ",[`${bt}-${Ft}-${on}`]:"%Y-%m-%d ",[`${Sn}-${$n}`]:"%H:%M"};function yF(e,t){const n=fe({},X6,t),i=ky(e),r=i.length;let o="",s=0,a,u;for(s=0;s<r;)for(a=i.length;a>s;--a)if(u=i.slice(s,a).join("-"),n[u]!=null){o+=n[u],s=a;break}return o.trim()}const zo=new Date;function Cy(e){return zo.setFullYear(e),zo.setMonth(0),zo.setDate(1),zo.setHours(0,0,0,0),zo}function bF(e){return xF(new Date(e))}function vF(e){return o0(new Date(e))}function xF(e){return hf.count(Cy(e.getFullYear())-1,e)}function o0(e){return Sk.count(Cy(e.getFullYear())-1,e)}function s0(e){return Cy(e).getDay()}function Y6(e,t,n,i,r,o,s){if(0<=e&&e<100){const a=new Date(-1,t,n,i,r,o,s);return a.setFullYear(e),a}return new Date(e,t,n,i,r,o,s)}function EF(e){return SF(new Date(e))}function wF(e){return a0(new Date(e))}function SF(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Zu.count(t-1,e)}function a0(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return z1.count(t-1,e)}function u0(e){return zo.setTime(Date.UTC(e,0,1)),zo.getUTCDay()}function K6(e,t,n,i,r,o,s){if(0<=e&&e<100){const a=new Date(Date.UTC(-1,t,n,i,r,o,s));return a.setUTCFullYear(n.y),a}return new Date(Date.UTC(e,t,n,i,r,o,s))}function $F(e,t,n,i,r){const o=t||1,s=be(e),a=(y,b,v)=>(v=v||y,J6(n[v],i[v],y===s&&o,b)),u=new Date,l=si(e),c=l[bt]?a(bt):Rt(2012),f=l[Ft]?a(Ft):l[rn]?a(rn):qr,d=l[nt]&&l[At]?a(At,1,nt+At):l[nt]?a(nt,1):l[At]?a(At,1):l[on]?a(on,1):l[Pi]?a(Pi,1):qa,h=l[Sn]?a(Sn):qr,g=l[$n]?a($n):qr,p=l[zn]?a(zn):qr,m=l[ai]?a(ai):qr;return function(y){u.setTime(+y);const b=c(u);return r(b,f(u),d(u,b),h(u),g(u),p(u),m(u))}}function J6(e,t,n,i){const r=n<=1?e:i?(o,s)=>i+n*Math.floor((e(o,s)-i)/n):(o,s)=>n*Math.floor(e(o,s)/n);return t?(o,s)=>t(r(o,s),s):r}function ga(e,t,n){return t+e*7-(n+6)%7}const Q6={[bt]:e=>e.getFullYear(),[rn]:e=>Math.floor(e.getMonth()/3),[Ft]:e=>e.getMonth(),[on]:e=>e.getDate(),[Sn]:e=>e.getHours(),[$n]:e=>e.getMinutes(),[zn]:e=>e.getSeconds(),[ai]:e=>e.getMilliseconds(),[Pi]:e=>xF(e),[nt]:e=>o0(e),[nt+At]:(e,t)=>ga(o0(e),e.getDay(),s0(t)),[At]:(e,t)=>ga(1,e.getDay(),s0(t))},Z6={[rn]:e=>3*e,[nt]:(e,t)=>ga(e,0,s0(t))};function AF(e,t){return $F(e,t||1,Q6,Z6,Y6)}const e4={[bt]:e=>e.getUTCFullYear(),[rn]:e=>Math.floor(e.getUTCMonth()/3),[Ft]:e=>e.getUTCMonth(),[on]:e=>e.getUTCDate(),[Sn]:e=>e.getUTCHours(),[$n]:e=>e.getUTCMinutes(),[zn]:e=>e.getUTCSeconds(),[ai]:e=>e.getUTCMilliseconds(),[Pi]:e=>SF(e),[nt]:e=>a0(e),[At]:(e,t)=>ga(1,e.getUTCDay(),u0(t)),[nt+At]:(e,t)=>ga(a0(e),e.getUTCDay(),u0(t))},t4={[rn]:e=>3*e,[nt]:(e,t)=>ga(e,0,u0(t))};function kF(e,t){return $F(e,t||1,e4,t4,K6)}const n4={[bt]:$5,[rn]:lE.every(3),[Ft]:lE,[nt]:Sk,[on]:hf,[At]:hf,[Pi]:hf,[Sn]:A5,[$n]:k5,[zn]:P1,[ai]:$k},i4={[bt]:wk,[rn]:Rm.every(3),[Ft]:Rm,[nt]:z1,[on]:Zu,[At]:Zu,[Pi]:Zu,[Sn]:Ek,[$n]:xk,[zn]:P1,[ai]:$k};function Xa(e){return n4[e]}function Ya(e){return i4[e]}function CF(e,t,n){return e?e.offset(t,n):void 0}function FF(e,t,n){return CF(Xa(e),t,n)}function _F(e,t,n){return CF(Ya(e),t,n)}function OF(e,t,n,i){return e?e.range(t,n,i):void 0}function RF(e,t,n,i){return OF(Xa(e),t,n,i)}function MF(e,t,n,i){return OF(Ya(e),t,n,i)}const Bu=1e3,Uu=Bu*60,ju=Uu*60,mh=ju*24,r4=mh*7,xw=mh*30,l0=mh*365,DF=[bt,Ft,on,Sn,$n,zn,ai],qu=DF.slice(0,-1),Wu=qu.slice(0,-1),Gu=Wu.slice(0,-1),o4=Gu.slice(0,-1),s4=[bt,nt],Ew=[bt,Ft],TF=[bt],gu=[[qu,1,Bu],[qu,5,5*Bu],[qu,15,15*Bu],[qu,30,30*Bu],[Wu,1,Uu],[Wu,5,5*Uu],[Wu,15,15*Uu],[Wu,30,30*Uu],[Gu,1,ju],[Gu,3,3*ju],[Gu,6,6*ju],[Gu,12,12*ju],[o4,1,mh],[s4,1,r4],[Ew,1,xw],[Ew,3,3*xw],[TF,1,l0]];function NF(e){const t=e.extent,n=e.maxbins||40,i=Math.abs(Gl(t))/n;let r=j1(a=>a[2]).right(gu,i),o,s;return r===gu.length?(o=TF,s=pl(t[0]/l0,t[1]/l0,n)):r?(r=gu[i/gu[r-1][2]<gu[r][2]/i?r-1:r],o=r[0],s=r[1]):(o=DF,s=Math.max(pl(t[0],t[1],n),1)),{units:o,step:s}}function Hu(e){const t={};return n=>t[n]||(t[n]=e(n))}function a4(e,t){return n=>{const i=e(n),r=i.indexOf(t);if(r<0)return i;let o=u4(i,r);const s=o<i.length?i.slice(o):"";for(;--o>r;)if(i[o]!=="0"){++o;break}return i.slice(0,o)+s}}function u4(e,t){let n=e.lastIndexOf("e"),i;if(n>0)return n;for(n=e.length;--n>t;)if(i=e.charCodeAt(n),i>=48&&i<=57)return n+1}function LF(e){const t=Hu(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(i){const r=Dm(i||",");if(r.precision==null){switch(r.precision=12,r.type){case"%":r.precision-=2;break;case"e":r.precision-=1;break}return a4(t(r),t(".1f")(1)[1])}else return t(r)},formatSpan(i,r,o,s){s=Dm(s??",f");const a=pl(i,r,o),u=Math.max(Math.abs(i),Math.abs(r));let l;if(s.precision==null)switch(s.type){case"s":return isNaN(l=U5(a,u))||(s.precision=l),n(s,u);case"":case"e":case"g":case"p":case"r":{isNaN(l=B5(a,u))||(s.precision=l-(s.type==="e"));break}case"f":case"%":{isNaN(l=z5(a))||(s.precision=l-(s.type==="%")*2);break}}return t(s)}}}let c0;IF();function IF(){return c0=LF({format:Ak,formatPrefix:G5})}function PF(e){return LF(H5(e))}function pd(e){return arguments.length?c0=PF(e):c0}function ww(e,t,n){n=n||{},X(n)||M(`Invalid time multi-format specifier: ${n}`);const i=t(zn),r=t($n),o=t(Sn),s=t(on),a=t(nt),u=t(Ft),l=t(rn),c=t(bt),f=e(n[ai]||".%L"),d=e(n[zn]||":%S"),h=e(n[$n]||"%I:%M"),g=e(n[Sn]||"%I %p"),p=e(n[on]||n[At]||"%a %d"),m=e(n[nt]||"%b %d"),y=e(n[Ft]||"%B"),b=e(n[rn]||"%B"),v=e(n[bt]||"%Y");return x=>(i(x)<x?f:r(x)<x?d:o(x)<x?h:s(x)<x?g:u(x)<x?a(x)<x?p:m:c(x)<x?l(x)<x?y:b:v)(x)}function zF(e){const t=Hu(e.format),n=Hu(e.utcFormat);return{timeFormat:i=>Y(i)?t(i):ww(t,Xa,i),utcFormat:i=>Y(i)?n(i):ww(n,Ya,i),timeParse:Hu(e.parse),utcParse:Hu(e.utcParse)}}let f0;BF();function BF(){return f0=zF({format:C5,parse:F5,utcFormat:vk,utcParse:_5})}function UF(e){return zF(O5(e))}function vl(e){return arguments.length?f0=UF(e):f0}const d0=(e,t)=>fe({},e,t);function jF(e,t){const n=e?PF(e):pd(),i=t?UF(t):vl();return d0(n,i)}function Fy(e,t){const n=arguments.length;return n&&n!==2&&M("defaultLocale expects either zero or two arguments."),n?d0(pd(e),vl(t)):d0(pd(),vl())}function l4(){return IF(),BF(),Fy()}const c4=/^(data:|([A-Za-z]+:)?\/\/)/,f4=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,d4=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,Sw="file://";function h4(e){return t=>({options:t||{},sanitize:p4,load:g4,fileAccess:!1,file:m4(),http:b4})}async function g4(e,t){const n=await this.sanitize(e,t),i=n.href;return n.localFile?this.file(i):this.http(i,t==null?void 0:t.http)}async function p4(e,t){t=fe({},this.options,t);const n=this.fileAccess,i={href:null};let r,o,s;const a=f4.test(e.replace(d4,""));(e==null||typeof e!="string"||!a)&&M("Sanitize failure, invalid URI: "+G(e));const u=c4.test(e);return(s=t.baseURL)&&!u&&(!e.startsWith("/")&&!s.endsWith("/")&&(e="/"+e),e=s+e),o=(r=e.startsWith(Sw))||t.mode==="file"||t.mode!=="http"&&!u&&n,r?e=e.slice(Sw.length):e.startsWith("//")&&(t.defaultProtocol==="file"?(e=e.slice(2),o=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(i,"localFile",{value:!!o}),i.href=e,t.target&&(i.target=t.target+""),t.rel&&(i.rel=t.rel+""),t.context==="image"&&t.crossOrigin&&(i.crossOrigin=t.crossOrigin+""),i}function m4(e){return y4}async function y4(){M("No file system access.")}async function b4(e,t){const n=fe({},this.options.http,t),i=t&&t.response,r=await fetch(e,n);return r.ok?ce(r[i])?r[i]():r.text():M(r.status+""+r.statusText)}const v4=e=>e!=null&&e===e,x4=e=>e==="true"||e==="false"||e===!0||e===!1,E4=e=>!Number.isNaN(Date.parse(e)),qF=e=>!Number.isNaN(+e)&&!(e instanceof Date),w4=e=>qF(e)&&Number.isInteger(+e),h0={boolean:wy,integer:Ut,number:Ut,date:Sy,string:$y,unknown:nn},Uc=[x4,w4,qF,E4],S4=["boolean","integer","number","date"];function WF(e,t){if(!e||!e.length)return"unknown";const n=e.length,i=Uc.length,r=Uc.map((o,s)=>s+1);for(let o=0,s=0,a,u;o<n;++o)for(u=t?e[o][t]:e[o],a=0;a<i;++a)if(r[a]&&v4(u)&&!Uc[a](u)&&(r[a]=0,++s,s===Uc.length))return"string";return S4[r.reduce((o,s)=>o===0?s:o,0)-1]}function GF(e,t){return t.reduce((n,i)=>(n[i]=WF(e,i),n),{})}function $w(e){const t=function(n,i){const r={delimiter:e};return _y(n,i?fe(i,r):r)};return t.responseType="text",t}function _y(e,t){return t.header&&(e=t.header.map(G).join(t.delimiter)+`
8
- `+e),LI(t.delimiter).parse(e+"")}_y.responseType="text";function $4(e){return typeof Buffer=="function"&&ce(Buffer.isBuffer)?Buffer.isBuffer(e):!1}function Oy(e,t){const n=t&&t.property?In(t.property):nn;return X(e)&&!$4(e)?A4(n(e),t):n(JSON.parse(e))}Oy.responseType="json";function A4(e,t){return!T(e)&&cF(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}const k4={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function HF(e,t){let n,i,r,o;return e=Oy(e,t),t&&t.feature?(n=q6,r=t.feature):t&&t.mesh?(n=G6,r=t.mesh,o=k4[t.filter]):M("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[r])?n(e,i,o):M("Invalid TopoJSON object: "+r),i&&i.features||[i]}HF.responseType="json";const yf={dsv:_y,csv:$w(","),tsv:$w(" "),json:Oy,topojson:HF};function Ry(e,t){return arguments.length>1?(yf[e]=t,this):J(yf,e)?yf[e]:null}function VF(e){const t=Ry(e);return t&&t.responseType||"text"}function XF(e,t,n,i){t=t||{};const r=Ry(t.type||"json");return r||M("Unknown data format type: "+t.type),e=r(e,t),t.parse&&C4(e,t.parse,n,i),J(e,"columns")&&delete e.columns,e}function C4(e,t,n,i){if(!e.length)return;const r=vl();n=n||r.timeParse,i=i||r.utcParse;let o=e.columns||Object.keys(e[0]),s,a,u,l,c,f;t==="auto"&&(t=GF(e,o)),o=Object.keys(t);const d=o.map(h=>{const g=t[h];let p,m;if(g&&(g.startsWith("date:")||g.startsWith("utc:")))return p=g.split(/:(.+)?/,2),m=p[1],(m[0]==="'"&&m[m.length-1]==="'"||m[0]==='"'&&m[m.length-1]==='"')&&(m=m.slice(1,-1)),(p[0]==="utc"?i:n)(m);if(!h0[g])throw Error("Illegal format pattern: "+h+":"+g);return h0[g]});for(u=0,c=e.length,f=o.length;u<c;++u)for(s=e[u],l=0;l<f;++l)a=o[l],s[a]=d[l](s[a])}const yh=h4();function bh(e){const t=e||nn,n=[],i={};return n.add=r=>{const o=t(r);return i[o]||(i[o]=1,n.push(r)),n},n.remove=r=>{const o=t(r);if(i[o]){i[o]=0;const s=n.indexOf(r);s>=0&&n.splice(s,1)}return n},n}async function bf(e,t){try{await t(e)}catch(n){e.error(n)}}const YF=Symbol("vega_id");let F4=1;function vh(e){return!!(e&&ne(e))}function ne(e){return e[YF]}function KF(e,t){return e[YF]=t,e}function Se(e){const t=e===Object(e)?e:{data:e};return ne(t)?t:KF(t,F4++)}function My(e){return xh(e,Se({}))}function xh(e,t){for(const n in e)t[n]=e[n];return t}function JF(e,t){return KF(t,ne(e))}function ws(e,t){return e?t?(n,i)=>e(n,i)||ne(t(n))-ne(t(i)):(n,i)=>e(n,i)||ne(n)-ne(i):null}function QF(e){return e&&e.constructor===Ss}function Ss(){const e=[],t=[],n=[],i=[],r=[];let o=null,s=!1;return{constructor:Ss,insert(a){const u=K(a),l=u.length;for(let c=0;c<l;++c)e.push(u[c]);return this},remove(a){const u=ce(a)?i:t,l=K(a),c=l.length;for(let f=0;f<c;++f)u.push(l[f]);return this},modify(a,u,l){const c={field:u,value:Rt(l)};return ce(a)?(c.filter=a,r.push(c)):(c.tuple=a,n.push(c)),this},encode(a,u){return ce(a)?r.push({filter:a,field:u}):n.push({tuple:a,field:u}),this},clean(a){return o=a,this},reflow(){return s=!0,this},pulse(a,u){const l={},c={};let f,d,h,g,p,m;for(f=0,d=u.length;f<d;++f)l[ne(u[f])]=1;for(f=0,d=t.length;f<d;++f)p=t[f],l[ne(p)]=-1;for(f=0,d=i.length;f<d;++f)g=i[f],u.forEach(b=>{g(b)&&(l[ne(b)]=-1)});for(f=0,d=e.length;f<d;++f)p=e[f],m=ne(p),l[m]?l[m]=1:a.add.push(Se(e[f]));for(f=0,d=u.length;f<d;++f)p=u[f],l[ne(p)]<0&&a.rem.push(p);function y(b,v,x){x?b[v]=x(b):a.encode=v,s||(c[ne(b)]=b)}for(f=0,d=n.length;f<d;++f)h=n[f],p=h.tuple,g=h.field,m=l[ne(p)],m>0&&(y(p,g,h.value),a.modifies(g));for(f=0,d=r.length;f<d;++f)h=r[f],g=h.filter,u.forEach(b=>{g(b)&&l[ne(b)]>0&&y(b,h.field,h.value)}),a.modifies(h.field);if(s)a.mod=t.length||i.length?u.filter(b=>l[ne(b)]>0):u.slice();else for(m in c)a.mod.push(c[m]);return(o||o==null&&(t.length||i.length))&&a.clean(!0),a}}}const vf="_:mod:_";function Eh(){Object.defineProperty(this,vf,{writable:!0,value:{}})}Eh.prototype={set(e,t,n,i){const r=this,o=r[e],s=r[vf];return t!=null&&t>=0?(o[t]!==n||i)&&(o[t]=n,s[t+":"+e]=-1,s[e]=-1):(o!==n||i)&&(r[e]=n,s[e]=T(n)?1+n.length:-1),r},modified(e,t){const n=this[vf];if(arguments.length){if(T(e)){for(let i=0;i<e.length;++i)if(n[e[i]])return!0;return!1}}else{for(const i in n)if(n[i])return!0;return!1}return t!=null&&t>=0?t+1<n[e]||!!n[t+":"+e]:!!n[e]},clear(){return this[vf]={},this}};let _4=0;const O4="pulse",R4=new Eh,M4=1,D4=2;function Re(e,t,n,i){this.id=++_4,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,i)}function Aw(e){return function(t){const n=this.flags;return arguments.length===0?!!(n&e):(this.flags=t?n|e:n&~e,this)}}Re.prototype={targets(){return this._targets||(this._targets=bh(Wl))},set(e){return this.value!==e?(this.value=e,1):0},skip:Aw(M4),modified:Aw(D4),parameters(e,t,n){t=t!==!1;const i=this._argval=this._argval||new Eh,r=this._argops=this._argops||[],o=[];let s,a,u,l;const c=(f,d,h)=>{h instanceof Re?(h!==this&&(t&&h.targets().add(this),o.push(h)),r.push({op:h,name:f,index:d})):i.set(f,d,h)};for(s in e)if(a=e[s],s===O4)K(a).forEach(f=>{f instanceof Re?f!==this&&(f.targets().add(this),o.push(f)):M("Pulse parameters must be operator instances.")}),this.source=a;else if(T(a))for(i.set(s,-1,Array(u=a.length)),l=0;l<u;++l)c(s,l,a[l]);else c(s,-1,a);return this.marshall().clear(),n&&(r.initonly=!0),o},marshall(e){const t=this._argval||R4,n=this._argops;let i,r,o,s;if(n){const a=n.length;for(r=0;r<a;++r)i=n[r],o=i.op,s=o.modified()&&o.stamp===e,t.set(i.name,i.index,o.value,s);if(n.initonly){for(r=0;r<a;++r)i=n[r],i.op.targets().remove(this);this._argops=null,this._update=null}}return t},detach(){const e=this._argops;let t,n,i,r;if(e)for(t=0,n=e.length;t<n;++t)i=e[t],r=i.op,r._targets&&r._targets.remove(this);this.pulse=null,this.source=null},evaluate(e){const t=this._update;if(t){const n=this.marshall(e.stamp),i=t.call(this,n,e);if(n.clear(),i!==this.value)this.value=i;else if(!this.modified())return e.StopPropagation}},run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?(this.skip(!1),t=0):t=this.evaluate(e),this.pulse=t||e}};function T4(e,t,n,i){let r=1,o;return e instanceof Re?o=e:e&&e.prototype instanceof Re?o=new e:ce(e)?o=new Re(null,e):(r=0,o=new Re(e,t)),this.rank(o),r&&(i=n,n=t),n&&this.connect(o,o.parameters(n,i)),this.touch(o),o}function N4(e,t){const n=e.rank,i=t.length;for(let r=0;r<i;++r)if(n<t[r].rank){this.rerank(e);return}}let L4=0;function wh(e,t,n){this.id=++L4,this.value=null,n&&(this.receive=n),e&&(this._filter=e),t&&(this._apply=t)}function Nr(e,t,n){return new wh(e,t,n)}wh.prototype={_filter:Pn,_apply:nn,targets(){return this._targets||(this._targets=bh(Wl))},consume(e){return arguments.length?(this._consume=!!e,this):!!this._consume},receive(e){if(this._filter(e)){const t=this.value=this._apply(e),n=this._targets,i=n?n.length:0;for(let r=0;r<i;++r)n[r].receive(t);this._consume&&(e.preventDefault(),e.stopPropagation())}},filter(e){const t=Nr(e);return this.targets().add(t),t},apply(e){const t=Nr(null,e);return this.targets().add(t),t},merge(){const e=Nr();this.targets().add(e);for(let t=0,n=arguments.length;t<n;++t)arguments[t].targets().add(e);return e},throttle(e){let t=-1;return this.filter(()=>{const n=Date.now();return n-t>e?(t=n,1):0})},debounce(e){const t=Nr();return this.targets().add(Nr(null,null,vy(e,n=>{const i=n.dataflow;t.receive(n),i&&i.run&&i.run()}))),t},between(e,t){let n=!1;return e.targets().add(Nr(null,null,()=>n=!0)),t.targets().add(Nr(null,null,()=>n=!1)),this.filter(()=>n)},detach(){this._filter=Pn,this._targets=null}};function I4(e,t,n,i){const r=this,o=Nr(n,i),s=function(l){l.dataflow=r;try{o.receive(l)}catch(c){r.error(c)}finally{r.run()}};let a;typeof e=="string"&&typeof document<"u"?a=document.querySelectorAll(e):a=K(e);const u=a.length;for(let l=0;l<u;++l)a[l].addEventListener(t,s);return o}function P4(e,t){const n=this.locale();return XF(e,t,n.timeParse,n.utcParse)}function z4(e,t,n){return t=this.parse(t,n),this.pulse(e,this.changeset().insert(t))}async function B4(e,t){const n=this;let i=0,r;try{r=await n.loader().load(e,{context:"dataflow",response:VF(t&&t.type)});try{r=n.parse(r,t)}catch(o){i=-2,n.warn("Data ingestion failed",e,o)}}catch(o){i=-1,n.warn("Loading failed",e,o)}return{data:r,status:i}}async function U4(e,t,n){const i=this,r=i._pending||j4(i);r.requests+=1;const o=await i.request(t,n);return i.pulse(e,i.changeset().remove(Pn).insert(o.data||[])),r.done(),o}function j4(e){let t;const n=new Promise(i=>t=i);return n.requests=0,n.done=()=>{--n.requests===0&&(e._pending=null,t(e))},e._pending=n}const q4={skip:!0};function W4(e,t,n,i,r){return(e instanceof Re?H4:G4)(this,e,t,n,i,r),this}function G4(e,t,n,i,r,o){const s=fe({},o,q4);let a,u;ce(n)||(n=Rt(n)),i===void 0?a=l=>e.touch(n(l)):ce(i)?(u=new Re(null,i,r,!1),a=l=>{u.evaluate(l);const c=n(l),f=u.value;QF(f)?e.pulse(c,f,o):e.update(c,f,s)}):a=l=>e.update(n(l),i,s),t.apply(a)}function H4(e,t,n,i,r,o){if(i===void 0)t.targets().add(n);else{const s=o||{},a=new Re(null,V4(n,i),r,!1);a.modified(s.force),a.rank=t.rank,t.targets().add(a),n&&(a.skip(!0),a.value=n.value,a.targets().add(n),e.connect(n,[a]))}}function V4(e,t){return t=ce(t)?t:Rt(t),e?function(n,i){const r=t(n,i);return e.skip()||(e.skip(r!==this.value).value=r),r}:t}function X4(e){e.rank=++this._rank}function Y4(e){const t=[e];let n,i,r;for(;t.length;)if(this.rank(n=t.pop()),i=n._targets)for(r=i.length;--r>=0;)t.push(n=i[r]),n===e&&M("Cycle detected in dataflow graph.")}const md={},Ai=1,zr=2,or=4,K4=Ai|zr,kw=Ai|or,zs=Ai|zr|or,Cw=8,pu=16,Fw=32,_w=64;function to(e,t,n){this.dataflow=e,this.stamp=t??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function mp(e,t){const n=[];return Pr(e,t,i=>n.push(i)),n}function Ow(e,t){const n={};return e.visit(t,i=>{n[ne(i)]=1}),i=>n[ne(i)]?null:i}function jc(e,t){return e?(n,i)=>e(n,i)&&t(n,i):t}to.prototype={StopPropagation:md,ADD:Ai,REM:zr,MOD:or,ADD_REM:K4,ADD_MOD:kw,ALL:zs,REFLOW:Cw,SOURCE:pu,NO_SOURCE:Fw,NO_FIELDS:_w,fork(e){return new to(this.dataflow).init(this,e)},clone(){const e=this.fork(zs);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(zs|pu)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new to(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){const n=this;return n.stamp=e.stamp,n.encode=e.encode,e.fields&&!(t&_w)&&(n.fields=e.fields),t&Ai?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),t&zr?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),t&or?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),t&Fw?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||zs;return t&Ai&&this.add.length||t&zr&&this.rem.length||t&or&&this.mod.length},reflow(e){if(e)return this.fork(zs).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(or,Ow(this,Ai))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return T(e)?e.forEach(n=>t[n]=!0):t[e]=!0,this},modified(e,t){const n=this.fields;return(t||this.mod.length)&&n?arguments.length?T(e)?e.some(i=>n[i]):n[e]:!!n:!1},filter(e,t){const n=this;return e&Ai&&(n.addF=jc(n.addF,t)),e&zr&&(n.remF=jc(n.remF,t)),e&or&&(n.modF=jc(n.modF,t)),e&pu&&(n.srcF=jc(n.srcF,t)),n},materialize(e){e=e||zs;const t=this;return e&Ai&&t.addF&&(t.add=mp(t.add,t.addF),t.addF=null),e&zr&&t.remF&&(t.rem=mp(t.rem,t.remF),t.remF=null),e&or&&t.modF&&(t.mod=mp(t.mod,t.modF),t.modF=null),e&pu&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,i=t;if(e&pu)return Pr(n.source,n.srcF,i),n;e&Ai&&Pr(n.add,n.addF,i),e&zr&&Pr(n.rem,n.remF,i),e&or&&Pr(n.mod,n.modF,i);const r=n.source;if(e&Cw&&r){const o=n.add.length+n.mod.length;o===r.length||(o?Pr(r,Ow(n,kw),i):Pr(r,n.srcF,i))}return n}};function Dy(e,t,n,i){const r=this;let o=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=i||null,this.pulses=n;for(const s of n)if(s.stamp===t){if(s.fields){const a=r.fields||(r.fields={});for(const u in s.fields)a[u]=1}s.changed(r.ADD)&&(o|=r.ADD),s.changed(r.REM)&&(o|=r.REM),s.changed(r.MOD)&&(o|=r.MOD)}this.changes=o}H(Dy,to,{fork(e){const t=new to(this.dataflow).init(this,e&this.NO_FIELDS);return e!==void 0&&(e&t.ADD&&this.visit(t.ADD,n=>t.add.push(n)),e&t.REM&&this.visit(t.REM,n=>t.rem.push(n)),e&t.MOD&&this.visit(t.MOD,n=>t.mod.push(n))),t},changed(e){return this.changes&e},modified(e){const t=this,n=t.fields;return n&&t.changes&t.MOD?T(e)?e.some(i=>n[i]):n[e]:0},filter(){M("MultiPulse does not support filtering.")},materialize(){M("MultiPulse does not support materialization.")},visit(e,t){const n=this,i=n.pulses,r=i.length;let o=0;if(e&n.SOURCE)for(;o<r;++o)i[o].visit(e,t);else for(;o<r;++o)i[o].stamp===n.stamp&&i[o].visit(e,t);return n}});async function J4(e,t,n){const i=this,r=[];if(i._pulse)return ZF(i);if(i._pending&&await i._pending,t&&await bf(i,t),!i._touched.length)return i.debug("Dataflow invoked, but nothing to do."),i;const o=++i._clock;i._pulse=new to(i,o,e),i._touched.forEach(c=>i._enqueue(c,!0)),i._touched=bh(Wl);let s=0,a,u,l;try{for(;i._heap.size()>0;){if(a=i._heap.pop(),a.rank!==a.qrank){i._enqueue(a,!0);continue}u=a.run(i._getPulse(a,e)),u.then?u=await u:u.async&&(r.push(u.async),u=md),u!==md&&a._targets&&a._targets.forEach(c=>i._enqueue(c)),++s}}catch(c){i._heap.clear(),l=c}if(i._input={},i._pulse=null,i.debug(`Pulse ${o}: ${s} operators`),l&&(i._postrun=[],i.error(l)),i._postrun.length){const c=i._postrun.sort((f,d)=>d.priority-f.priority);i._postrun=[];for(let f=0;f<c.length;++f)await bf(i,c[f].callback)}return n&&await bf(i,n),r.length&&Promise.all(r).then(c=>i.runAsync(null,()=>{c.forEach(f=>{try{f(i)}catch(d){i.error(d)}})})),i}async function Q4(e,t,n){for(;this._running;)await this._running;const i=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(i,i),this._running}function Z4(e,t,n){return this._pulse?ZF(this):(this.evaluate(e,t,n),this)}function e9(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(i){this.error(i)}}function ZF(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}function t9(e,t){const n=e.stamp<this._clock;n&&(e.stamp=this._clock),(n||t)&&(e.qrank=e.rank,this._heap.push(e))}function n9(e,t){const n=e.source,i=this._clock;return n&&T(n)?new Dy(this,i,n.map(r=>r.pulse),t):this._input[e.id]||i9(this._pulse,n&&n.pulse)}function i9(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==md&&(e.source=t.source),e)}const Ty={skip:!1,force:!1};function r9(e,t){const n=t||Ty;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this}function o9(e,t,n){const i=n||Ty;return(e.set(t)||i.force)&&this.touch(e,i),this}function s9(e,t,n){this.touch(e,n||Ty);const i=new to(this,this._clock+(this._pulse?0:1)),r=e.pulse&&e.pulse.source||[];return i.target=e,this._input[e.id]=t.pulse(i,r),this}function a9(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),e_(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let i;return t.length?(i=t[0],t[0]=n,u9(t,0,e)):i=n,i}}}function e_(e,t,n,i){let r,o;const s=e[n];for(;n>t;){if(o=n-1>>1,r=e[o],i(s,r)<0){e[n]=r,n=o;continue}break}return e[n]=s}function u9(e,t,n){const i=t,r=e.length,o=e[t];let s=(t<<1)+1,a;for(;s<r;)a=s+1,a<r&&n(e[s],e[a])>=0&&(s=a),e[t]=e[s],t=s,s=(t<<1)+1;return e[t]=o,e_(e,i,t,n)}function ra(){this.logger(hh()),this.logLevel(hy),this._clock=0,this._rank=0,this._locale=Fy();try{this._loader=yh()}catch{}this._touched=bh(Wl),this._input={},this._pulse=null,this._heap=a9((e,t)=>e.qrank-t.qrank),this._postrun=[]}function mu(e){return function(){return this._log[e].apply(this,arguments)}}ra.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:mu("error"),warn:mu("warn"),info:mu("info"),debug:mu("debug"),logLevel:mu("level"),cleanThreshold:1e4,add:T4,connect:N4,rank:X4,rerank:Y4,pulse:s9,touch:r9,update:o9,changeset:Ss,ingest:z4,parse:P4,preload:U4,request:B4,events:I4,on:W4,evaluate:J4,run:Z4,runAsync:Q4,runAfter:e9,_enqueue:t9,_getPulse:n9};function R(e,t){Re.call(this,e,null,t)}H(R,Re,{run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?this.skip(!1):t=this.evaluate(e),t=t||e,t.then?t=t.then(n=>this.pulse=n):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});const pa={};function t_(e){const t=n_(e);return t&&t.Definition||null}function n_(e){return e=e&&e.toLowerCase(),J(pa,e)?pa[e]:null}function*i_(e,t){if(t==null)for(let n of e)n!=null&&n!==""&&(n=+n)>=n&&(yield n);else{let n=-1;for(let i of e)i=t(i,++n,e),i!=null&&i!==""&&(i=+i)>=i&&(yield i)}}function Ny(e,t,n){const i=Float64Array.from(i_(e,n));return i.sort(gl),t.map(r=>Tk(i,r))}function Ly(e,t){return Ny(e,[.25,.5,.75],t)}function Iy(e,t){const n=e.length,i=WL(e,t),r=Ly(e,t),o=(r[2]-r[0])/1.34;return 1.06*(Math.min(i,o)||i||Math.abs(r[0])||1)*Math.pow(n,-.2)}function r_(e){const t=e.maxbins||20,n=e.base||10,i=Math.log(n),r=e.divide||[5,2];let o=e.extent[0],s=e.extent[1],a,u,l,c,f,d;const h=e.span||s-o||Math.abs(o)||1;if(e.step)a=e.step;else if(e.steps){for(c=h/t,f=0,d=e.steps.length;f<d&&e.steps[f]<c;++f);a=e.steps[Math.max(0,f-1)]}else{for(u=Math.ceil(Math.log(t)/i),l=e.minstep||0,a=Math.max(l,Math.pow(n,Math.round(Math.log(h)/i)-u));Math.ceil(h/a)>t;)a*=n;for(f=0,d=r.length;f<d;++f)c=a/r[f],c>=l&&h/c<=t&&(a=c)}c=Math.log(a);const g=c>=0?0:~~(-c/i)+1,p=Math.pow(n,-g-1);return(e.nice||e.nice===void 0)&&(c=Math.floor(o/a+p)*a,o=o<c?c-a:c,s=Math.ceil(s/a)*a),{start:o,stop:s===o?o+a:s,step:a}}var Bn=Math.random;function l9(e){Bn=e}function o_(e,t,n,i){if(!e.length)return[void 0,void 0];const r=Float64Array.from(i_(e,i)),o=r.length,s=t;let a,u,l,c;for(l=0,c=Array(s);l<s;++l){for(a=0,u=0;u<o;++u)a+=r[~~(Bn()*o)];c[l]=a/o}return c.sort(gl),[Nm(c,n/2),Nm(c,1-n/2)]}function s_(e,t,n,i){i=i||(d=>d);const r=e.length,o=new Float64Array(r);let s=0,a=1,u=i(e[0]),l=u,c=u+t,f;for(;a<r;++a){if(f=i(e[a]),f>=c){for(l=(u+l)/2;s<a;++s)o[s]=l;c=f+t,u=f}l=f}for(l=(u+l)/2;s<a;++s)o[s]=l;return n?c9(o,t+t/4):o}function c9(e,t){const n=e.length;let i=0,r=1,o,s;for(;e[i]===e[r];)++r;for(;r<n;){for(o=r+1;e[r]===e[o];)++o;if(e[r]-e[r-1]<t){for(s=r+(i+o-r-r>>1);s<r;)e[s++]=e[r];for(;s>r;)e[s--]=e[i]}i=r,r=o}return e}function f9(e){return function(){return e=(1103515245*e+12345)%2147483647,e/2147483647}}function d9(e,t){t==null&&(t=e,e=0);let n,i,r;const o={min(s){return arguments.length?(n=s||0,r=i-n,o):n},max(s){return arguments.length?(i=s||0,r=i-n,o):i},sample(){return n+Math.floor(r*Bn())},pdf(s){return s===Math.floor(s)&&s>=n&&s<i?1/r:0},cdf(s){const a=Math.floor(s);return a<n?0:a>=i?1:(a-n+1)/r},icdf(s){return s>=0&&s<=1?n-1+Math.floor(s*r):NaN}};return o.min(e).max(t)}const a_=Math.sqrt(2*Math.PI),h9=Math.SQRT2;let yu=NaN;function Sh(e,t){e=e||0,t=t??1;let n=0,i=0,r,o;if(yu===yu)n=yu,yu=NaN;else{do n=Bn()*2-1,i=Bn()*2-1,r=n*n+i*i;while(r===0||r>1);o=Math.sqrt(-2*Math.log(r)/r),n*=o,yu=i*o}return e+n*t}function Py(e,t,n){n=n??1;const i=(e-(t||0))/n;return Math.exp(-.5*i*i)/(n*a_)}function $h(e,t,n){t=t||0,n=n??1;const i=(e-t)/n,r=Math.abs(i);let o;if(r>37)o=0;else{const s=Math.exp(-r*r/2);let a;r<7.07106781186547?(a=.0352624965998911*r+.700383064443688,a=a*r+6.37396220353165,a=a*r+33.912866078383,a=a*r+112.079291497871,a=a*r+221.213596169931,a=a*r+220.206867912376,o=s*a,a=.0883883476483184*r+1.75566716318264,a=a*r+16.064177579207,a=a*r+86.7807322029461,a=a*r+296.564248779674,a=a*r+637.333633378831,a=a*r+793.826512519948,a=a*r+440.413735824752,o=o/a):(a=r+.65,a=r+4/a,a=r+3/a,a=r+2/a,a=r+1/a,o=s/a/2.506628274631)}return i>0?1-o:o}function Ah(e,t,n){return e<0||e>1?NaN:(t||0)+(n??1)*h9*g9(2*e-1)}function g9(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=10512122733215323e-25+n*t,n=-4112633980346984e-24+n*t,n=-29070369957882005e-24+n*t,n=42347877827932404e-23+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=22137376921775787e-25,n=9075656193888539e-23+n*t,n=-27517406297064545e-23+n*t,n=18239629214389228e-24+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=15076572693500548e-25+n*t,n=-3789465440126737e-24+n*t,n=761570120807834e-23+n*t,n=-1496002662714924e-23+n*t,n=2914795345090108e-23+n*t,n=-6771199775845234e-23+n*t,n=22900482228026655e-23+n*t,n=-99298272942317e-20+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}function zy(e,t){let n,i;const r={mean(o){return arguments.length?(n=o||0,r):n},stdev(o){return arguments.length?(i=o??1,r):i},sample:()=>Sh(n,i),pdf:o=>Py(o,n,i),cdf:o=>$h(o,n,i),icdf:o=>Ah(o,n,i)};return r.mean(e).stdev(t)}function By(e,t){const n=zy();let i=0;const r={data(o){return arguments.length?(e=o,i=o?o.length:0,r.bandwidth(t)):e},bandwidth(o){return arguments.length?(t=o,!t&&e&&(t=Iy(e)),r):t},sample(){return e[~~(Bn()*i)]+t*n.sample()},pdf(o){let s=0,a=0;for(;a<i;++a)s+=n.pdf((o-e[a])/t);return s/t/i},cdf(o){let s=0,a=0;for(;a<i;++a)s+=n.cdf((o-e[a])/t);return s/i},icdf(){throw Error("KDE icdf not supported.")}};return r.data(e)}function Uy(e,t){return e=e||0,t=t??1,Math.exp(e+Sh()*t)}function jy(e,t,n){if(e<=0)return 0;t=t||0,n=n??1;const i=(Math.log(e)-t)/n;return Math.exp(-.5*i*i)/(n*a_*e)}function qy(e,t,n){return $h(Math.log(e),t,n)}function Wy(e,t,n){return Math.exp(Ah(e,t,n))}function u_(e,t){let n,i;const r={mean(o){return arguments.length?(n=o||0,r):n},stdev(o){return arguments.length?(i=o??1,r):i},sample:()=>Uy(n,i),pdf:o=>jy(o,n,i),cdf:o=>qy(o,n,i),icdf:o=>Wy(o,n,i)};return r.mean(e).stdev(t)}function l_(e,t){let n=0,i;function r(s){const a=[];let u=0,l;for(l=0;l<n;++l)u+=a[l]=s[l]==null?1:+s[l];for(l=0;l<n;++l)a[l]/=u;return a}const o={weights(s){return arguments.length?(i=r(t=s||[]),o):t},distributions(s){return arguments.length?(s?(n=s.length,e=s):(n=0,e=[]),o.weights(t)):e},sample(){const s=Bn();let a=e[n-1],u=i[0],l=0;for(;l<n-1;u+=i[++l])if(s<u){a=e[l];break}return a.sample()},pdf(s){let a=0,u=0;for(;u<n;++u)a+=i[u]*e[u].pdf(s);return a},cdf(s){let a=0,u=0;for(;u<n;++u)a+=i[u]*e[u].cdf(s);return a},icdf(){throw Error("Mixture icdf not supported.")}};return o.distributions(e).weights(t)}function Gy(e,t){return t==null&&(t=e??1,e=0),e+(t-e)*Bn()}function Hy(e,t,n){return n==null&&(n=t??1,t=0),e>=t&&e<=n?1/(n-t):0}function Vy(e,t,n){return n==null&&(n=t??1,t=0),e<t?0:e>n?1:(e-t)/(n-t)}function Xy(e,t,n){return n==null&&(n=t??1,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function c_(e,t){let n,i;const r={min(o){return arguments.length?(n=o||0,r):n},max(o){return arguments.length?(i=o??1,r):i},sample:()=>Gy(n,i),pdf:o=>Hy(o,n,i),cdf:o=>Vy(o,n,i),icdf:o=>Xy(o,n,i)};return t==null&&(t=e??1,e=0),r.min(e).max(t)}function Yy(e,t,n){let i=0,r=0;for(const o of e){const s=n(o);t(o)==null||s==null||isNaN(s)||(i+=(s-i)/++r)}return{coef:[i],predict:()=>i,rSquared:0}}function Hl(e,t,n,i){const r=i-e*e,o=Math.abs(r)<1e-24?0:(n-e*t)/r;return[t-o*e,o]}function kh(e,t,n,i){e=e.filter(h=>{let g=t(h),p=n(h);return g!=null&&(g=+g)>=g&&p!=null&&(p=+p)>=p}),i&&e.sort((h,g)=>t(h)-t(g));const r=e.length,o=new Float64Array(r),s=new Float64Array(r);let a=0,u=0,l=0,c,f,d;for(d of e)o[a]=c=+t(d),s[a]=f=+n(d),++a,u+=(c-u)/a,l+=(f-l)/a;for(a=0;a<r;++a)o[a]-=u,s[a]-=l;return[o,s,u,l]}function Vl(e,t,n,i){let r=-1,o,s;for(const a of e)o=t(a),s=n(a),o!=null&&(o=+o)>=o&&s!=null&&(s=+s)>=s&&i(o,s,++r)}function Ka(e,t,n,i,r){let o=0,s=0;return Vl(e,t,n,(a,u)=>{const l=u-r(a),c=u-i;o+=l*l,s+=c*c}),1-o/s}function Ky(e,t,n){let i=0,r=0,o=0,s=0,a=0;Vl(e,t,n,(c,f)=>{++a,i+=(c-i)/a,r+=(f-r)/a,o+=(c*f-o)/a,s+=(c*c-s)/a});const u=Hl(i,r,o,s),l=c=>u[0]+u[1]*c;return{coef:u,predict:l,rSquared:Ka(e,t,n,r,l)}}function f_(e,t,n){let i=0,r=0,o=0,s=0,a=0;Vl(e,t,n,(c,f)=>{++a,c=Math.log(c),i+=(c-i)/a,r+=(f-r)/a,o+=(c*f-o)/a,s+=(c*c-s)/a});const u=Hl(i,r,o,s),l=c=>u[0]+u[1]*Math.log(c);return{coef:u,predict:l,rSquared:Ka(e,t,n,r,l)}}function d_(e,t,n){const[i,r,o,s]=kh(e,t,n);let a=0,u=0,l=0,c=0,f=0,d,h,g;Vl(e,t,n,(b,v)=>{d=i[f++],h=Math.log(v),g=d*v,a+=(v*h-a)/f,u+=(g-u)/f,l+=(g*h-l)/f,c+=(d*g-c)/f});const[p,m]=Hl(u/s,a/s,l/s,c/s),y=b=>Math.exp(p+m*(b-o));return{coef:[Math.exp(p-m*o),m],predict:y,rSquared:Ka(e,t,n,s,y)}}function h_(e,t,n){let i=0,r=0,o=0,s=0,a=0,u=0;Vl(e,t,n,(f,d)=>{const h=Math.log(f),g=Math.log(d);++u,i+=(h-i)/u,r+=(g-r)/u,o+=(h*g-o)/u,s+=(h*h-s)/u,a+=(d-a)/u});const l=Hl(i,r,o,s),c=f=>l[0]*Math.pow(f,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Ka(e,t,n,a,c)}}function Jy(e,t,n){const[i,r,o,s]=kh(e,t,n),a=i.length;let u=0,l=0,c=0,f=0,d=0,h,g,p,m;for(h=0;h<a;)g=i[h],p=r[h++],m=g*g,u+=(m-u)/h,l+=(m*g-l)/h,c+=(m*m-c)/h,f+=(g*p-f)/h,d+=(m*p-d)/h;const y=c-u*u,b=u*y-l*l,v=(d*u-f*l)/b,x=(f*y-d*l)/b,w=-v*u,S=E=>(E=E-o,v*E*E+x*E+w+s);return{coef:[w-x*o+v*o*o+s,x-2*v*o,v],predict:S,rSquared:Ka(e,t,n,s,S)}}function g_(e,t,n,i){if(i===0)return Yy(e,t,n);if(i===1)return Ky(e,t,n);if(i===2)return Jy(e,t,n);const[r,o,s,a]=kh(e,t,n),u=r.length,l=[],c=[],f=i+1;let d,h,g,p,m;for(d=0;d<f;++d){for(g=0,p=0;g<u;++g)p+=Math.pow(r[g],d)*o[g];for(l.push(p),m=new Float64Array(f),h=0;h<f;++h){for(g=0,p=0;g<u;++g)p+=Math.pow(r[g],d+h);m[h]=p}c.push(m)}c.push(l);const y=m9(c),b=v=>{v-=s;let x=a+y[0]+y[1]*v+y[2]*v*v;for(d=3;d<f;++d)x+=y[d]*Math.pow(v,d);return x};return{coef:p9(f,y,-s,a),predict:b,rSquared:Ka(e,t,n,a,b)}}function p9(e,t,n,i){const r=Array(e);let o,s,a,u;for(o=0;o<e;++o)r[o]=0;for(o=e-1;o>=0;--o)for(a=t[o],u=1,r[o]+=a,s=1;s<=o;++s)u*=(o+1-s)/s,r[o-s]+=a*Math.pow(n,s)*u;return r[0]+=i,r}function m9(e){const t=e.length-1,n=[];let i,r,o,s,a;for(i=0;i<t;++i){for(s=i,r=i+1;r<t;++r)Math.abs(e[i][r])>Math.abs(e[i][s])&&(s=r);for(o=i;o<t+1;++o)a=e[o][i],e[o][i]=e[o][s],e[o][s]=a;for(r=i+1;r<t;++r)for(o=t;o>=i;o--)e[o][r]-=e[o][i]*e[i][r]/e[i][i]}for(r=t-1;r>=0;--r){for(a=0,o=r+1;o<t;++o)a+=e[o][r]*n[o];n[r]=(e[t][r]-a)/e[r][r]}return n}const Rw=2,Mw=1e-12;function p_(e,t,n,i){const[r,o,s,a]=kh(e,t,n,!0),u=r.length,l=Math.max(2,~~(i*u)),c=new Float64Array(u),f=new Float64Array(u),d=new Float64Array(u).fill(1);for(let h=-1;++h<=Rw;){const g=[0,l-1];for(let m=0;m<u;++m){const y=r[m],b=g[0],v=g[1],x=y-r[b]>r[v]-y?b:v;let w=0,S=0,E=0,$=0,A=0;const C=1/Math.abs(r[x]-y||1);for(let j=b;j<=v;++j){const O=r[j],k=o[j],_=y9(Math.abs(y-O)*C)*d[j],N=O*_;w+=_,S+=N,E+=k*_,$+=k*N,A+=O*N}const[F,I]=Hl(S/w,E/w,$/w,A/w);c[m]=F+I*y,f[m]=Math.abs(o[m]-c[m]),b9(r,m+1,g)}if(h===Rw)break;const p=Nk(f);if(Math.abs(p)<Mw)break;for(let m=0,y,b;m<u;++m)y=f[m]/(6*p),d[m]=y>=1?Mw:(b=1-y*y)*b}return v9(r,c,s,a)}function y9(e){return(e=1-e*e*e)*e*e}function b9(e,t,n){const i=e[t];let r=n[0],o=n[1]+1;if(!(o>=e.length))for(;t>r&&e[o]-i<=i-e[r];)n[0]=++r,n[1]=o,++o}function v9(e,t,n,i){const r=e.length,o=[];let s=0,a=0,u=[],l;for(;s<r;++s)l=e[s]+n,u[0]===l?u[1]+=(t[s]-u[1])/++a:(a=0,u[1]+=i,u=[l,t[s]],o.push(u));return u[1]+=i,o}const x9=.5*Math.PI/180;function Ch(e,t,n,i){n=n||25,i=Math.max(n,i||200);const r=p=>[p,e(p)],o=t[0],s=t[1],a=s-o,u=a/i,l=[r(o)],c=[];if(n===i){for(let p=1;p<i;++p)l.push(r(o+p/n*a));return l.push(r(s)),l}else{c.push(r(s));for(let p=n;--p>0;)c.push(r(o+p/n*a))}let f=l[0],d=c[c.length-1];const h=1/a,g=E9(f[1],c);for(;d;){const p=r((f[0]+d[0])/2);p[0]-f[0]>=u&&w9(f,p,d,h,g)>x9?c.push(p):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l}function E9(e,t){let n=e,i=e;const r=t.length;for(let o=0;o<r;++o){const s=t[o][1];s<n&&(n=s),s>i&&(i=s)}return 1/(i-n)}function w9(e,t,n,i,r){const o=Math.atan2(r*(n[1]-e[1]),i*(n[0]-e[0])),s=Math.atan2(r*(t[1]-e[1]),i*(t[0]-e[0]));return Math.abs(o-s)}function S9(e){return t=>{const n=e.length;let i=1,r=String(e[0](t));for(;i<n;++i)r+="|"+e[i](t);return r}}function g0(e){return!e||!e.length?function(){return""}:e.length===1?e[0]:S9(e)}function m_(e,t,n){return n||e+(t?"_"+t:"")}const yp=()=>{},$9={init:yp,add:yp,rem:yp,idx:0},xl={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.valid?e.sum:void 0,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t<e.min||e.min===void 0)&&(e.min=t)},rem:(e,t)=>{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||e.max===void 0)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t<e.min&&(e.argmin=n)},rem:(e,t)=>{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:["exponential"],idx:1}},Xl=Object.keys(xl).filter(e=>e!=="__count__");function A9(e,t){return(n,i)=>fe({name:e,aggregate_param:i,out:n||e},$9,t)}[...Xl,"__count__"].forEach(e=>{xl[e]=A9(e,xl[e])});function y_(e,t,n){return xl[e](n,t)}function b_(e,t){return e.idx-t.idx}function k9(e){const t={};e.forEach(i=>t[i.name]=i);const n=i=>{i.req&&i.req.forEach(r=>{t[r]||n(t[r]=xl[r]())})};return e.forEach(n),Object.values(t).sort(b_)}function C9(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.aggregate_param==null?e.init(this):e.init(this,e.aggregate_param))}function F9(e,t){if(e==null||e===""){++this.missing;return}e===e&&(++this.valid,this._ops.forEach(n=>n.add(this,e,t)))}function _9(e,t){if(e==null||e===""){--this.missing;return}e===e&&(--this.valid,this._ops.forEach(n=>n.rem(this,e,t)))}function O9(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function v_(e,t){const n=t||nn,i=k9(e),r=e.slice().sort(b_);function o(s){this._ops=i,this._out=r,this.cell=s,this.init()}return o.prototype.init=C9,o.prototype.add=F9,o.prototype.rem=_9,o.prototype.set=O9,o.prototype.get=n,o.fields=e.map(s=>s.out),o}function Qy(e){this._key=e?In(e):ne,this.reset()}const xt=Qy.prototype;xt.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null};xt.add=function(e){this._add.push(e)};xt.rem=function(e){this._rem.push(e)};xt.values=function(){if(this._get=null,this._rem.length===0)return this._add;const e=this._add,t=this._rem,n=this._key,i=e.length,r=t.length,o=Array(i-r),s={};let a,u,l;for(a=0;a<r;++a)s[n(t[a])]=1;for(a=0,u=0;a<i;++a)s[n(l=e[a])]?s[n(l)]=0:o[u++]=l;return this._rem=[],this._add=o};xt.distinct=function(e){const t=this.values(),n={};let i=t.length,r=0,o;for(;--i>=0;)o=e(t[i])+"",J(n,o)||(n[o]=1,++r);return r};xt.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=uF(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext};xt.argmin=function(e){return this.extent(e)[0]||{}};xt.argmax=function(e){return this.extent(e)[1]||{}};xt.min=function(e){const t=this.extent(e)[0];return t!=null?e(t):void 0};xt.max=function(e){const t=this.extent(e)[1];return t!=null?e(t):void 0};xt.quartile=function(e){return(this._get!==e||!this._q)&&(this._q=Ly(this.values(),e),this._get=e),this._q};xt.q1=function(e){return this.quartile(e)[0]};xt.q2=function(e){return this.quartile(e)[1]};xt.q3=function(e){return this.quartile(e)[2]};xt.ci=function(e){return(this._get!==e||!this._ci)&&(this._ci=o_(this.values(),1e3,.05,e),this._get=e),this._ci};xt.ci0=function(e){return this.ci(e)[0]};xt.ci1=function(e){return this.ci(e)[1]};function oo(e){R.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}oo.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:Xl},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]};H(oo,R,{transform(e,t){const n=this,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.modified();return n.stamp=i.stamp,n.value&&(r||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=r?n.init(e):Object.create(null),t.visit(t.SOURCE,o=>n.add(o))):(n.value=n.value||n.init(e),t.visit(t.REM,o=>n.rem(o)),t.visit(t.ADD,o=>n.add(o))),i.modifies(n._outputs),n._drop=e.drop!==!1,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&i.clean(!0).runAfter(()=>this.clean()),n.changes(i)},cross(){const e=this,t=e.value,n=e._dnames,i=n.map(()=>({})),r=n.length;function o(a){let u,l,c,f;for(u in a)for(c=a[u].tuple,l=0;l<r;++l)i[l][f=c[n[l]]]=f}o(e._prev),o(t);function s(a,u,l){const c=n[l],f=i[l++];for(const d in f){const h=a?a+"|"+d:d;u[c]=f[d],l<r?s(h,u,l):t[h]||e.cell(h,u)}}s("",{},0)},init(e){const t=this._inputs=[],n=this._outputs=[],i={};function r(b){const v=K(Ct(b)),x=v.length;let w=0,S;for(;w<x;++w)i[S=v[w]]||(i[S]=1,t.push(S))}this._dims=K(e.groupby),this._dnames=this._dims.map(b=>{const v=Ge(b);return r(b),n.push(v),v}),this.cellkey=e.key?e.key:g0(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const o=e.fields||[null],s=e.ops||["count"],a=e.aggregate_params||[null],u=e.as||[],l=o.length,c={};let f,d,h,g,p,m,y;for(l!==s.length&&M("Unmatched number of fields and aggregate ops."),y=0;y<l;++y){if(f=o[y],d=s[y],h=a[y]||null,f==null&&d!=="count"&&M("Null aggregate field specified."),p=Ge(f),m=m_(d,p,u[y]),n.push(m),d==="count"){this._counts.push(m);continue}g=c[p],g||(r(f),g=c[p]=[],g.field=f,this._measures.push(g)),d!=="count"&&(this._countOnly=!1),g.push(y_(d,h,m))}return this._measures=this._measures.map(b=>v_(b,b.field)),Object.create(null)},cellkey:g0(),cell(e,t){let n=this.value[e];return n?n.num===0&&this._drop&&n.stamp<this.stamp?(n.stamp=this.stamp,this._adds[this._alen++]=n):n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n):(n=this.value[e]=this.newcell(e,t),this._adds[this._alen++]=n),n},newcell(e,t){const n={key:e,num:0,agg:null,tuple:this.newtuple(t,this._prev&&this._prev[e]),stamp:this.stamp,store:!1};if(!this._countOnly){const i=this._measures,r=i.length;n.agg=Array(r);for(let o=0;o<r;++o)n.agg[o]=new i[o](n)}return n.store&&(n.data=new Qy),n},newtuple(e,t){const n=this._dnames,i=this._dims,r=i.length,o={};for(let s=0;s<r;++s)o[n[s]]=i[s](e);return t?JF(t.tuple,o):Se(o)},clean(){const e=this.value;for(const t in e)e[t].num===0&&delete e[t]},add(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num+=1,this._countOnly)return;n.store&&n.data.add(e);const i=n.agg;for(let r=0,o=i.length;r<o;++r)i[r].add(i[r].get(e),e)},rem(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num-=1,this._countOnly)return;n.store&&n.data.rem(e);const i=n.agg;for(let r=0,o=i.length;r<o;++r)i[r].rem(i[r].get(e),e)},celltuple(e){const t=e.tuple,n=this._counts;e.store&&e.data.values();for(let i=0,r=n.length;i<r;++i)t[n[i]]=e.num;if(!this._countOnly){const i=e.agg;for(let r=0,o=i.length;r<o;++r)i[r].set(t)}return t},changes(e){const t=this._adds,n=this._mods,i=this._prev,r=this._drop,o=e.add,s=e.rem,a=e.mod;let u,l,c,f;if(i)for(l in i)u=i[l],(!r||u.num)&&s.push(u.tuple);for(c=0,f=this._alen;c<f;++c)o.push(this.celltuple(t[c])),t[c]=null;for(c=0,f=this._mlen;c<f;++c)u=n[c],(u.num===0&&r?s:a).push(this.celltuple(u)),n[c]=null;return this._alen=this._mlen=0,this._prev=null,e}});const R9=1e-14;function Zy(e){R.call(this,null,e)}Zy.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]};H(Zy,R,{transform(e,t){const n=e.interval!==!1,i=this._bins(e),r=i.start,o=i.step,s=e.as||["bin0","bin1"],a=s[0],u=s[1];let l;return e.modified()?(t=t.reflow(!0),l=t.SOURCE):l=t.modified(Ct(e.field))?t.ADD_MOD:t.ADD,t.visit(l,n?c=>{const f=i(c);c[a]=f,c[u]=f==null?null:r+o*(1+(f-r)/o)}:c=>c[a]=i(c)),t.modifies(n?s:a)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=r_(e),i=n.step;let r=n.start,o=r+Math.ceil((n.stop-r)/i)*i,s,a;(s=e.anchor)!=null&&(a=s-(r+i*Math.floor((s-r)/i)),r+=a,o+=a);const u=function(l){let c=Ut(t(l));return c==null?null:c<r?-1/0:c>o?1/0:(c=Math.max(r,Math.min(c,o-i)),r+i*Math.floor(R9+(c-r)/i))};return u.start=r,u.stop=n.stop,u.step=i,this.value=ln(u,Ct(t),e.name||"bin_"+Ge(t))}});function x_(e,t,n){const i=e;let r=t||[],o=n||[],s={},a=0;return{add:u=>o.push(u),remove:u=>s[i(u)]=++a,size:()=>r.length,data:(u,l)=>(a&&(r=r.filter(c=>!s[i(c)]),s={},a=0),l&&u&&r.sort(u),o.length&&(r=u?hF(u,r,o.sort(u)):r.concat(o),o=[]),r)}}function eb(e){R.call(this,[],e)}eb.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]};H(eb,R,{transform(e,t){const n=t.fork(t.ALL),i=x_(ne,this.value,n.materialize(n.ADD).add),r=e.sort,o=t.changed()||r&&(e.modified("sort")||t.modified(r.fields));return n.visit(n.REM,i.remove),this.modified(o),this.value=n.source=i.data(ws(r),o),t.source&&t.source.root&&(this.value.root=t.source.root),n}});function E_(e){Re.call(this,null,M9,e)}H(E_,Re);function M9(e){return this.value&&!e.modified()?this.value:by(e.fields,e.orders)}function tb(e){R.call(this,null,e)}tb.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};function D9(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase();break}return e.match(n)}H(tb,R,{transform(e,t){const n=f=>d=>{for(var h=D9(a(d),e.case,o)||[],g,p=0,m=h.length;p<m;++p)s.test(g=h[p])||f(g)},i=this._parameterCheck(e,t),r=this._counts,o=this._match,s=this._stop,a=e.field,u=e.as||["text","count"],l=n(f=>r[f]=1+(r[f]||0)),c=n(f=>r[f]-=1);return i?t.visit(t.SOURCE,l):(t.visit(t.ADD,l),t.visit(t.REM,c)),this._finish(t,u)},_parameterCheck(e,t){let n=!1;return(e.modified("stopwords")||!this._stop)&&(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),(e.modified("pattern")||!this._match)&&(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){const n=this._counts,i=this._tuples||(this._tuples={}),r=t[0],o=t[1],s=e.fork(e.NO_SOURCE|e.NO_FIELDS);let a,u,l;for(a in n)u=i[a],l=n[a]||0,!u&&l?(i[a]=u=Se({}),u[r]=a,u[o]=l,s.add.push(u)):l===0?(u&&s.rem.push(u),n[a]=null,i[a]=null):u[o]!==l&&(u[o]=l,s.mod.push(u));return s.modifies(t)}});function nb(e){R.call(this,null,e)}nb.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]};H(nb,R,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.as||["a","b"],r=i[0],o=i[1],s=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let a=this.value;return s?(a&&(n.rem=a),a=t.materialize(t.SOURCE).source,n.add=this.value=T9(a,r,o,e.filter||Pn)):n.mod=a,n.source=this.value,n.modifies(i)}});function T9(e,t,n,i){for(var r=[],o={},s=e.length,a=0,u,l;a<s;++a)for(o[t]=l=e[a],u=0;u<s;++u)o[n]=e[u],i(o)&&(r.push(Se(o)),o={},o[t]=l);return r}const Dw={kde:By,mixture:l_,normal:zy,lognormal:u_,uniform:c_},N9="distributions",Tw="function",L9="field";function w_(e,t){const n=e[Tw];J(Dw,n)||M("Unknown distribution function: "+n);const i=Dw[n]();for(const r in e)r===L9?i.data((e.from||t()).map(e[r])):r===N9?i[r](e[r].map(o=>w_(o,t))):typeof i[r]===Tw&&i[r](e[r]);return i}function ib(e){R.call(this,null,e)}const S_=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],I9={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:S_},{name:"weights",type:"number",array:!0}]};ib.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:S_.concat(I9)},{name:"as",type:"string",array:!0,default:["value","density"]}]};H(ib,R,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=w_(e.distribution,P9(t)),r=e.steps||e.minsteps||25,o=e.steps||e.maxsteps||200;let s=e.method||"pdf";s!=="pdf"&&s!=="cdf"&&M("Invalid density method: "+s),!e.extent&&!i.data&&M("Missing density extent parameter."),s=i[s];const a=e.as||["value","density"],u=e.extent||Ii(i.data()),l=Ch(s,u,r,o).map(c=>{const f={};return f[a[0]]=c[0],f[a[1]]=c[1],Se(f)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function P9(e){return()=>e.materialize(e.SOURCE).source}function $_(e,t){return e?e.map((n,i)=>t[i]||Ge(n)):null}function rb(e,t,n){const i=[],r=f=>f(u);let o,s,a,u,l,c;if(t==null)i.push(e.map(n));else for(o={},s=0,a=e.length;s<a;++s)u=e[s],l=t.map(r),c=o[l],c||(o[l]=c=[],c.dims=l,i.push(c)),c.push(n(u));return i}const A_="bin";function ob(e){R.call(this,null,e)}ob.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:A_}]};const z9=(e,t)=>Gl(Ii(e,t))/30;H(ob,R,{transform(e,t){if(this.value&&!(e.modified()||t.changed()))return t;const n=t.materialize(t.SOURCE).source,i=rb(t.source,e.groupby,nn),r=e.smooth||!1,o=e.field,s=e.step||z9(n,o),a=ws((g,p)=>o(g)-o(p)),u=e.as||A_,l=i.length;let c=1/0,f=-1/0,d=0,h;for(;d<l;++d){const g=i[d].sort(a);h=-1;for(const p of s_(g,s,r,o))p<c&&(c=p),p>f&&(f=p),g[++h][u]=p}return this.value={start:c,stop:f,step:s},t.reflow(!0).modifies(u)}});function k_(e){Re.call(this,null,B9,e),this.modified(!0)}H(k_,Re);function B9(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:ln(n=>t(n,e),Ct(t),Ge(t))}function sb(e){R.call(this,[void 0,void 0],e)}sb.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]};H(sb,R,{transform(e,t){const n=this.value,i=e.field,r=t.changed()||t.modified(i.fields)||e.modified("field");let o=n[0],s=n[1];if((r||o==null)&&(o=1/0,s=-1/0),t.visit(r?t.SOURCE:t.ADD,a=>{const u=Ut(i(a));u!=null&&(u<o&&(o=u),u>s&&(s=u))}),!Number.isFinite(o)||!Number.isFinite(s)){let a=Ge(i);a&&(a=` for field "${a}"`),t.dataflow.warn(`Infinite extent${a}: [${o}, ${s}]`),o=s=void 0}this.value=[o,s]}});function ab(e,t){Re.call(this,e),this.parent=t,this.count=0}H(ab,Re,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}});function Fh(e){R.call(this,{},e),this._keys=Va();const t=this._targets=[];t.active=0,t.forEach=n=>{for(let i=0,r=t.active;i<r;++i)n(t[i],i,t)}}H(Fh,R,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,i){const r=this.value;let o=J(r,e)&&r[e],s,a;return o?o.value.stamp<n.stamp&&(o.init(n),this.activate(o)):(a=i||(a=this._group[e])&&a.tuple,s=n.dataflow,o=new ab(n.fork(n.NO_SOURCE),this),s.add(o).connect(t(s,e,a)),r[e]=o,this.activate(o)),o},clean(){const e=this.value;let t=0;for(const n in e)if(e[n].count===0){const i=e[n].detachSubflow;i&&i(),delete e[n],++t}if(t){const n=this._targets.filter(i=>i&&i.count>0);this.initTargets(n)}},initTargets(e){const t=this._targets,n=t.length,i=e?e.length:0;let r=0;for(;r<i;++r)t[r]=e[r];for(;r<n&&t[r]!=null;++r)t[r]=null;t.active=i},transform(e,t){const n=t.dataflow,i=e.key,r=e.subflow,o=this._keys,s=e.modified("key"),a=u=>this.subflow(u,r,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,u=>{const l=ne(u),c=o.get(l);c!==void 0&&(o.delete(l),a(c).rem(u))}),t.visit(t.ADD,u=>{const l=i(u);o.set(ne(u),l),a(l).add(u)}),s||t.modified(i.fields)?t.visit(t.MOD,u=>{const l=ne(u),c=o.get(l),f=i(u);c===f?a(f).mod(u):(o.set(l,f),a(c).rem(u),a(f).add(u))}):t.changed(t.MOD)&&t.visit(t.MOD,u=>{a(o.get(ne(u))).mod(u)}),s&&t.visit(t.REFLOW,u=>{const l=ne(u),c=o.get(l),f=i(u);c!==f&&(o.set(l,f),a(c).rem(u),a(f).add(u))}),t.clean()?n.runAfter(()=>{this.clean(),o.clean()}):o.empty>n.cleanThreshold&&n.runAfter(o.clean),t}});function C_(e){Re.call(this,null,U9,e)}H(C_,Re);function U9(e){return this.value&&!e.modified()?this.value:T(e.name)?K(e.name).map(t=>In(t)):In(e.name,e.as)}function ub(e){R.call(this,Va(),e)}ub.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]};H(ub,R,{transform(e,t){const n=t.dataflow,i=this.value,r=t.fork(),o=r.add,s=r.rem,a=r.mod,u=e.expr;let l=!0;t.visit(t.REM,f=>{const d=ne(f);i.has(d)?i.delete(d):s.push(f)}),t.visit(t.ADD,f=>{u(f,e)?o.push(f):i.set(ne(f),1)});function c(f){const d=ne(f),h=u(f,e),g=i.get(d);h&&g?(i.delete(d),o.push(f)):!h&&!g?(i.set(d,1),s.push(f)):l&&h&&!g&&a.push(f)}return t.visit(t.MOD,c),e.modified()&&(l=!1,t.visit(t.REFLOW,c)),i.empty>n.cleanThreshold&&n.runAfter(i.clean),r}});function lb(e){R.call(this,[],e)}lb.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]};H(lb,R,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=$_(i,e.as||[]),o=e.index||null,s=r.length;return n.rem=this.value,t.visit(t.SOURCE,a=>{const u=i.map(g=>g(a)),l=u.reduce((g,p)=>Math.max(g,p.length),0);let c=0,f,d,h;for(;c<l;++c){for(d=My(a),f=0;f<s;++f)d[r[f]]=(h=u[f][c])==null?null:h;o&&(d[o]=c),n.add.push(d)}}),this.value=n.source=n.add,o&&n.modifies(o),n.modifies(r)}});function cb(e){R.call(this,[],e)}cb.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]};H(cb,R,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=i.map(Ge),o=e.as||["key","value"],s=o[0],a=o[1],u=i.length;return n.rem=this.value,t.visit(t.SOURCE,l=>{for(let c=0,f;c<u;++c)f=My(l),f[s]=r[c],f[a]=i[c](l),n.add.push(f)}),this.value=n.source=n.add,n.modifies(o)}});function fb(e){R.call(this,null,e)}fb.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]};H(fb,R,{transform(e,t){const n=e.expr,i=e.as,r=e.modified(),o=e.initonly?t.ADD:r?t.SOURCE:t.modified(n.fields)||t.modified(i)?t.ADD_MOD:t.ADD;return r&&(t=t.materialize().reflow(!0)),e.initonly||t.modifies(i),t.visit(o,s=>s[i]=n(s,e))}});function F_(e){R.call(this,[],e)}H(F_,R,{transform(e,t){const n=t.fork(t.ALL),i=e.generator;let r=this.value,o=e.size-r.length,s,a,u;if(o>0){for(s=[];--o>=0;)s.push(u=Se(i(e))),r.push(u);n.add=n.add.length?n.materialize(n.ADD).add.concat(s):s}else a=r.slice(0,-o),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(a):a,r=r.slice(-o);return n.source=this.value=r,n}});const qc={value:"value",median:Nk,mean:VL,min:_m,max:Go},j9=[];function db(e){R.call(this,[],e)}db.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]};function q9(e){var t=e.method||qc.value,n;if(qc[t]==null)M("Unrecognized imputation method: "+t);else return t===qc.value?(n=e.value!==void 0?e.value:0,()=>n):qc[t]}function W9(e){const t=e.field;return n=>n?t(n):NaN}H(db,R,{transform(e,t){var n=t.fork(t.ALL),i=q9(e),r=W9(e),o=Ge(e.field),s=Ge(e.key),a=(e.groupby||[]).map(Ge),u=G9(t.source,e.groupby,e.key,e.keyvals),l=[],c=this.value,f=u.domain.length,d,h,g,p,m,y,b,v,x,w;for(m=0,v=u.length;m<v;++m)for(d=u[m],g=d.values,h=NaN,b=0;b<f;++b)if(d[b]==null){for(p=u.domain[b],w={_impute:!0},y=0,x=g.length;y<x;++y)w[a[y]]=g[y];w[s]=p,w[o]=Number.isNaN(h)?h=i(d,r):h,l.push(Se(w))}return l.length&&(n.add=n.materialize(n.ADD).add.concat(l)),c.length&&(n.rem=n.materialize(n.REM).rem.concat(c)),this.value=l,n}});function G9(e,t,n,i){var r=y=>y(m),o=[],s=i?i.slice():[],a={},u={},l,c,f,d,h,g,p,m;for(s.forEach((y,b)=>a[y]=b+1),d=0,p=e.length;d<p;++d)m=e[d],g=n(m),h=a[g]||(a[g]=s.push(g)),c=(l=t?t.map(r):j9)+"",(f=u[c])||(f=u[c]=[],o.push(f),f.values=l),f[h-1]=m;return o.domain=s,o}function hb(e){oo.call(this,e)}hb.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:Xl},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]};H(hb,oo,{transform(e,t){const n=this,i=e.modified();let r;return n.value&&(i||t.modified(n._inputs,!0))?(r=n.value=i?n.init(e):{},t.visit(t.SOURCE,o=>n.add(o))):(r=n.value=n.value||this.init(e),t.visit(t.REM,o=>n.rem(o)),t.visit(t.ADD,o=>n.add(o))),n.changes(),t.visit(t.SOURCE,o=>{fe(o,r[n.cellkey(o)].tuple)}),t.reflow(i).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let n,i;for(n=0,i=this._alen;n<i;++n)this.celltuple(e[n]),e[n]=null;for(n=0,i=this._mlen;n<i;++n)this.celltuple(t[n]),t[n]=null;this._alen=this._mlen=0}});function gb(e){R.call(this,null,e)}gb.Definition={type:"KDE",metadata:{generates:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"cumulative",type:"boolean",default:!1},{name:"counts",type:"boolean",default:!1},{name:"bandwidth",type:"number",default:0},{name:"extent",type:"number",array:!0,length:2},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"as",type:"string",array:!0,default:["value","density"]}]};H(gb,R,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=t.materialize(t.SOURCE).source,r=rb(i,e.groupby,e.field),o=(e.groupby||[]).map(Ge),s=e.bandwidth,a=e.cumulative?"cdf":"pdf",u=e.as||["value","density"],l=[];let c=e.extent,f=e.steps||e.minsteps||25,d=e.steps||e.maxsteps||200;a!=="pdf"&&a!=="cdf"&&M("Invalid density method: "+a),e.resolve==="shared"&&(c||(c=Ii(i,e.field)),f=d=e.steps||d),r.forEach(h=>{const g=By(h,s)[a],p=e.counts?h.length:1,m=c||Ii(h);Ch(g,m,f,d).forEach(y=>{const b={};for(let v=0;v<o.length;++v)b[o[v]]=h.dims[v];b[u[0]]=y[0],b[u[1]]=y[1]*p,l.push(Se(b))})}),this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function __(e){Re.call(this,null,H9,e)}H(__,Re);function H9(e){return this.value&&!e.modified()?this.value:Ey(e.fields,e.flat)}function O_(e){R.call(this,[],e),this._pending=null}H(O_,R,{transform(e,t){const n=t.dataflow;return this._pending?bp(this,t,this._pending):V9(e)?t.StopPropagation:e.values?bp(this,t,n.parse(e.values,e.format)):e.async?{async:n.request(e.url,e.format).then(r=>(this._pending=K(r.data),o=>o.touch(this)))}:n.request(e.url,e.format).then(i=>bp(this,t,K(i.data)))}});function V9(e){return e.modified("async")&&!(e.modified("values")||e.modified("url")||e.modified("format"))}function bp(e,t,n){n.forEach(Se);const i=t.fork(t.NO_FIELDS&t.NO_SOURCE);return i.rem=e.value,e.value=i.source=i.add=n,e._pending=null,i.rem.length&&i.clean(!0),i}function pb(e){R.call(this,{},e)}pb.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]};H(pb,R,{transform(e,t){const n=e.fields,i=e.index,r=e.values,o=e.default==null?null:e.default,s=e.modified(),a=n.length;let u=s?t.SOURCE:t.ADD,l=t,c=e.as,f,d,h;return r?(d=r.length,a>1&&!c&&M('Multi-field lookup requires explicit "as" parameter.'),c&&c.length!==a*d&&M('The "as" parameter has too few output field names.'),c=c||r.map(Ge),f=function(g){for(var p=0,m=0,y,b;p<a;++p)if(b=i.get(n[p](g)),b==null)for(y=0;y<d;++y,++m)g[c[m]]=o;else for(y=0;y<d;++y,++m)g[c[m]]=r[y](b)}):(c||M("Missing output field names."),f=function(g){for(var p=0,m;p<a;++p)m=i.get(n[p](g)),g[c[p]]=m??o}),s?l=t.reflow(!0):(h=n.some(g=>t.modified(g.fields)),u|=h?t.MOD:0),t.visit(u,f),l.modifies(c)}});function R_(e){Re.call(this,null,X9,e)}H(R_,Re);function X9(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let i=1/0,r=-1/0,o,s;for(o=0;o<n;++o)s=t[o],s[0]<i&&(i=s[0]),s[1]>r&&(r=s[1]);return[i,r]}function M_(e){Re.call(this,null,Y9,e)}H(M_,Re);function Y9(e){return this.value&&!e.modified()?this.value:e.values.reduce((t,n)=>t.concat(n),[])}function D_(e){R.call(this,null,e)}H(D_,R,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function mb(e){oo.call(this,e)}mb.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:Xl,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]};H(mb,oo,{_transform:oo.prototype.transform,transform(e,t){return this._transform(K9(e,t),t)}});function K9(e,t){const n=e.field,i=e.value,r=(e.op==="count"?"__count__":e.op)||"sum",o=Ct(n).concat(Ct(i)),s=Q9(n,e.limit||0,t);return t.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:s.map(()=>r),fields:s.map(a=>J9(a,n,i,o)),as:s.map(a=>a+""),modified:e.modified.bind(e)}}function J9(e,t,n,i){return ln(r=>t(r)===e?n(r):NaN,i,e+"")}function Q9(e,t,n){const i={},r=[];return n.visit(n.SOURCE,o=>{const s=e(o);i[s]||(i[s]=1,r.push(s))}),r.sort(Ha),t?r.slice(0,t):r}function T_(e){Fh.call(this,e)}H(T_,Fh,{transform(e,t){const n=e.subflow,i=e.field,r=o=>this.subflow(ne(o),n,t,o);return(e.modified("field")||i&&t.modified(Ct(i)))&&M("PreFacet does not support field modification."),this.initTargets(),i?(t.visit(t.MOD,o=>{const s=r(o);i(o).forEach(a=>s.mod(a))}),t.visit(t.ADD,o=>{const s=r(o);i(o).forEach(a=>s.add(Se(a)))}),t.visit(t.REM,o=>{const s=r(o);i(o).forEach(a=>s.rem(a))})):(t.visit(t.MOD,o=>r(o).mod(o)),t.visit(t.ADD,o=>r(o).add(o)),t.visit(t.REM,o=>r(o).rem(o))),t.clean()&&t.runAfter(()=>this.clean()),t}});function yb(e){R.call(this,null,e)}yb.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]};H(yb,R,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.fields,r=$_(e.fields,e.as||[]),o=i?(a,u)=>Z9(a,u,i,r):xh;let s;return this.value?s=this.value:(t=t.addAll(),s=this.value={}),t.visit(t.REM,a=>{const u=ne(a);n.rem.push(s[u]),s[u]=null}),t.visit(t.ADD,a=>{const u=o(a,Se({}));s[ne(a)]=u,n.add.push(u)}),t.visit(t.MOD,a=>{n.mod.push(o(a,s[ne(a)]))}),n}});function Z9(e,t,n,i){for(let r=0,o=n.length;r<o;++r)t[i[r]]=n[r](e);return t}function N_(e){R.call(this,null,e)}H(N_,R,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});function bb(e){R.call(this,null,e)}bb.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]};const e8=1e-14;H(bb,R,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.as||["prob","value"];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;const r=t.materialize(t.SOURCE).source,o=rb(r,e.groupby,e.field),s=(e.groupby||[]).map(Ge),a=[],u=e.step||.01,l=e.probs||pn(u/2,1-e8,u),c=l.length;return o.forEach(f=>{const d=Ny(f,l);for(let h=0;h<c;++h){const g={};for(let p=0;p<s.length;++p)g[s[p]]=f.dims[p];g[i[0]]=l[h],g[i[1]]=d[h],a.push(Se(g))}}),this.value&&(n.rem=this.value),this.value=n.add=n.source=a,n}});function L_(e){R.call(this,null,e)}H(L_,R,{transform(e,t){let n,i;return this.value?i=this.value:(n=t=t.addAll(),i=this.value={}),e.derive&&(n=t.fork(t.NO_SOURCE),t.visit(t.REM,r=>{const o=ne(r);n.rem.push(i[o]),i[o]=null}),t.visit(t.ADD,r=>{const o=My(r);i[ne(r)]=o,n.add.push(o)}),t.visit(t.MOD,r=>{const o=i[ne(r)];for(const s in r)o[s]=r[s],n.modifies(s);n.mod.push(o)})),n}});function vb(e){R.call(this,[],e),this.count=0}vb.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]};H(vb,R,{transform(e,t){const n=t.fork(t.NO_SOURCE),i=e.modified("size"),r=e.size,o=this.value.reduce((c,f)=>(c[ne(f)]=1,c),{});let s=this.value,a=this.count,u=0;function l(c){let f,d;s.length<r?s.push(c):(d=~~((a+1)*Bn()),d<s.length&&d>=u&&(f=s[d],o[ne(f)]&&n.rem.push(f),s[d]=c)),++a}if(t.rem.length&&(t.visit(t.REM,c=>{const f=ne(c);o[f]&&(o[f]=-1,n.rem.push(c)),--a}),s=s.filter(c=>o[ne(c)]!==-1)),(t.rem.length||i)&&s.length<r&&t.source&&(u=a=s.length,t.visit(t.SOURCE,c=>{o[ne(c)]||l(c)}),u=-1),i&&s.length>r){const c=s.length-r;for(let f=0;f<c;++f)o[ne(s[f])]=-1,n.rem.push(s[f]);s=s.slice(c)}return t.mod.length&&t.visit(t.MOD,c=>{o[ne(c)]&&n.mod.push(c)}),t.add.length&&t.visit(t.ADD,l),(t.add.length||u<0)&&(n.add=s.filter(c=>!o[ne(c)])),this.count=a,this.value=n.source=s,n}});function xb(e){R.call(this,null,e)}xb.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]};H(xb,R,{transform(e,t){if(this.value&&!e.modified())return;const n=t.materialize().fork(t.MOD),i=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=pn(e.start,e.stop,e.step||1).map(r=>{const o={};return o[i]=r,Se(o)}),n.add=t.add.concat(this.value),n}});function I_(e){R.call(this,null,e),this.modified(!0)}H(I_,R,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});function Eb(e){R.call(this,null,e)}const P_=["unit0","unit1"];Eb.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:Ay,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:P_}]};H(Eb,R,{transform(e,t){const n=e.field,i=e.interval!==!1,r=e.timezone==="utc",o=this._floor(e,t),s=(r?Ya:Xa)(o.unit).offset,a=e.as||P_,u=a[0],l=a[1],c=o.step;let f=o.start||1/0,d=o.stop||-1/0,h=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(Ct(n)))&&(t=t.reflow(!0),h=t.SOURCE,f=1/0,d=-1/0),t.visit(h,g=>{const p=n(g);let m,y;p==null?(g[u]=null,i&&(g[l]=null)):(g[u]=m=y=o(p),i&&(g[l]=y=s(m,c)),m<f&&(f=m),y>d&&(d=y))}),o.start=f,o.stop=d,t.modifies(i?a:u)},_floor(e,t){const n=e.timezone==="utc",{units:i,step:r}=e.units?{units:e.units,step:e.step||1}:NF({extent:e.extent||Ii(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),o=ky(i),s=this.value||{},a=(n?kF:AF)(o,r);return a.unit=be(o),a.units=o,a.step=r,a.start=s.start,a.stop=s.stop,this.value=a}});function z_(e){R.call(this,Va(),e)}H(z_,R,{transform(e,t){const n=t.dataflow,i=e.field,r=this.value,o=a=>r.set(i(a),a);let s=!0;return e.modified("field")||t.modified(i.fields)?(r.clear(),t.visit(t.SOURCE,o)):t.changed()?(t.visit(t.REM,a=>r.delete(i(a))),t.visit(t.ADD,o)):s=!1,this.modified(s),r.empty>n.cleanThreshold&&n.runAfter(r.clean),t.fork()}});function B_(e){R.call(this,null,e)}H(B_,R,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(ws(e.sort)):t.source).map(e.field))}});function t8(e,t,n,i){const r=El[e](t,n);return{init:r.init||qr,update:function(o,s){s[i]=r.next(o)}}}const El={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,i=t.data;return n&&t.compare(i[n-1],i[n])?++e:e}}},percent_rank:function(){const e=El.rank(),t=e.next;return{init:e.init,next:n=>(t(n)-1)/(n.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const n=t.data,i=t.compare;let r=t.index;if(e<r){for(;r+1<n.length&&!i(n[r],n[r+1]);)++r;e=r}return(1+e)/n.length}}},ntile:function(e,t){t=+t,t>0||M("ntile num must be greater than zero.");const n=El.cume_dist(),i=n.next;return{init:n.init,next:r=>Math.ceil(t*i(r))}},lag:function(e,t){return t=+t||1,{next:n=>{const i=n.index-t;return i>=0?e(n.data[i]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{const i=n.index+t,r=n.data;return i<r.length?e(r[i]):null}}},first_value:function(e){return{next:t=>e(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return t=+t,t>0||M("nth_value nth must be greater than zero."),{next:n=>{const i=n.i0+(t-1);return i<n.i1?e(n.data[i]):null}}},prev_value:function(e){let t;return{init:()=>t=null,next:n=>{const i=e(n.data[n.index]);return i!=null?t=i:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:i=>{const r=i.data;return i.index<=n?t:(n=n8(e,r,i.index))<0?(n=r.length,t=null):t=e(r[n])}}}};function n8(e,t,n){for(let i=t.length;n<i;++n)if(e(t[n])!=null)return n;return-1}const i8=Object.keys(El);function U_(e){const t=K(e.ops),n=K(e.fields),i=K(e.params),r=K(e.aggregate_params),o=K(e.as),s=this.outputs=[],a=this.windows=[],u={},l={},c=[],f=[];let d=!0;function h(g){K(Ct(g)).forEach(p=>u[p]=1)}h(e.sort),t.forEach((g,p)=>{const m=n[p],y=i[p],b=r[p]||null,v=Ge(m),x=m_(g,v,o[p]);if(h(m),s.push(x),J(El,g))a.push(t8(g,m,y,x));else{if(m==null&&g!=="count"&&M("Null aggregate field specified."),g==="count"){c.push(x);return}d=!1;let w=l[v];w||(w=l[v]=[],w.field=m,f.push(w)),w.push(y_(g,b,x))}}),(c.length||f.length)&&(this.cell=r8(f,c,d)),this.inputs=Object.keys(u)}const j_=U_.prototype;j_.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()};j_.update=function(e,t){const n=this.cell,i=this.windows,r=e.data,o=i&&i.length;let s;if(n){for(s=e.p0;s<e.i0;++s)n.rem(r[s]);for(s=e.p1;s<e.i1;++s)n.add(r[s]);n.set(t)}for(s=0;s<o;++s)i[s].update(e,t)};function r8(e,t,n){e=e.map(u=>v_(u,u.field));const i={num:0,agg:null,store:!1,count:t};if(!n)for(var r=e.length,o=i.agg=Array(r),s=0;s<r;++s)o[s]=new e[s](i);if(i.store)var a=i.data=new Qy;return i.add=function(u){if(i.num+=1,!n){a&&a.add(u);for(let l=0;l<r;++l)o[l].add(o[l].get(u),u)}},i.rem=function(u){if(i.num-=1,!n){a&&a.rem(u);for(let l=0;l<r;++l)o[l].rem(o[l].get(u),u)}},i.set=function(u){let l,c;for(a&&a.values(),l=0,c=t.length;l<c;++l)u[t[l]]=i.num;if(!n)for(l=0,c=o.length;l<c;++l)o[l].set(u)},i.init=function(){i.num=0,a&&a.reset();for(let u=0;u<r;++u)o[u].init()},i}function wb(e){R.call(this,{},e),this._mlen=0,this._mods=[]}wb.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:i8.concat(Xl)},{name:"params",type:"number",null:!0,array:!0},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]};H(wb,R,{transform(e,t){this.stamp=t.stamp;const n=e.modified(),i=ws(e.sort),r=g0(e.groupby),o=a=>this.group(r(a));let s=this.state;(!s||n)&&(s=this.state=new U_(e)),n||t.modified(s.inputs)?(this.value={},t.visit(t.SOURCE,a=>o(a).add(a))):(t.visit(t.REM,a=>o(a).remove(a)),t.visit(t.ADD,a=>o(a).add(a)));for(let a=0,u=this._mlen;a<u;++a)o8(this._mods[a],s,i,e);return this._mlen=0,this._mods=[],t.reflow(n).modifies(s.outputs)},group(e){let t=this.value[e];return t||(t=this.value[e]=x_(ne),t.stamp=-1),t.stamp<this.stamp&&(t.stamp=this.stamp,this._mods[this._mlen++]=t),t}});function o8(e,t,n,i){const r=i.sort,o=r&&!i.ignorePeers,s=i.frame||[null,0],a=e.data(n),u=a.length,l=o?j1(r):null,c={i0:0,i1:0,p0:0,p1:0,index:0,data:a,compare:r||Rt(-1)};t.init();for(let f=0;f<u;++f)s8(c,s,f,u),o&&a8(c,l),t.update(c,a[f])}function s8(e,t,n,i){e.p0=e.i0,e.p1=e.i1,e.i0=t[0]==null?0:Math.max(0,n-Math.abs(t[0])),e.i1=t[1]==null?i:Math.min(i,n+Math.abs(t[1])+1),e.index=n}function a8(e,t){const n=e.i0,i=e.i1-1,r=e.compare,o=e.data,s=o.length-1;n>0&&!r(o[n],o[n-1])&&(e.i0=t.left(o,o[n])),i<s&&!r(o[i],o[i+1])&&(e.i1=t.right(o,o[i]))}const u8=Object.freeze(Object.defineProperty({__proto__:null,aggregate:oo,bin:Zy,collect:eb,compare:E_,countpattern:tb,cross:nb,density:ib,dotbin:ob,expression:k_,extent:sb,facet:Fh,field:C_,filter:ub,flatten:lb,fold:cb,formula:fb,generate:F_,impute:db,joinaggregate:hb,kde:gb,key:__,load:O_,lookup:pb,multiextent:R_,multivalues:M_,params:D_,pivot:mb,prefacet:T_,project:yb,proxy:N_,quantile:bb,relay:L_,sample:vb,sequence:xb,sieve:I_,subflow:ab,timeunit:Eb,tupleindex:z_,values:B_,window:wb},Symbol.toStringTag,{value:"Module"}));function no(e,t){if(typeof document<"u"&&document.createElement){const n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}const l8=()=>typeof Image<"u"?Image:null;function Sb(e,t,n){const i=e-t+n*2;return e?i>0?i:1:0}const c8="identity",ma="linear",br="log",Yl="pow",Kl="sqrt",_h="symlog",ns="time",is="utc",Mi="sequential",Ja="diverging",ya="quantile",Oh="quantize",Rh="threshold",$b="ordinal",p0="point",q_="band",Ab="bin-ordinal",st="continuous",Jl="discrete",Ql="discretizing",qn="interpolating",kb="temporal";function f8(e){return function(t){let n=t[0],i=t[1],r;return i<n&&(r=n,n=i,i=r),[e.invert(n),e.invert(i)]}}function d8(e){return function(t){const n=e.range();let i=t[0],r=t[1],o=-1,s,a,u,l;for(r<i&&(a=i,i=r,r=a),u=0,l=n.length;u<l;++u)n[u]>=i&&n[u]<=r&&(o<0&&(o=u),s=u);if(!(o<0))return i=e.invertExtent(n[o]),r=e.invertExtent(n[s]),[i[0]===void 0?i[1]:i[0],r[1]===void 0?r[0]:r[1]]}}function Cb(){const e=Ok().unknown(void 0),t=e.domain,n=e.range;let i=[0,1],r,o,s=!1,a=0,u=0,l=.5;delete e.unknown;function c(){const f=t().length,d=i[1]<i[0],h=i[1-d],g=Sb(f,a,u);let p=i[d-0];r=(h-p)/(g||1),s&&(r=Math.floor(r)),p+=(h-p-r*(f-a))*l,o=r*(1-a),s&&(p=Math.round(p),o=Math.round(o));const m=pn(f).map(y=>p+r*y);return n(d?m.reverse():m)}return e.domain=function(f){return arguments.length?(t(f),c()):t()},e.range=function(f){return arguments.length?(i=[+f[0],+f[1]],c()):i.slice()},e.rangeRound=function(f){return i=[+f[0],+f[1]],s=!0,c()},e.bandwidth=function(){return o},e.step=function(){return r},e.round=function(f){return arguments.length?(s=!!f,c()):s},e.padding=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),a=u,c()):a},e.paddingInner=function(f){return arguments.length?(a=Math.max(0,Math.min(1,f)),c()):a},e.paddingOuter=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),c()):u},e.align=function(f){return arguments.length?(l=Math.max(0,Math.min(1,f)),c()):l},e.invertRange=function(f){if(f[0]==null||f[1]==null)return;const d=i[1]<i[0],h=d?n().reverse():n(),g=h.length-1;let p=+f[0],m=+f[1],y,b,v;if(!(p!==p||m!==m)&&(m<p&&(v=p,p=m,m=v),!(m<h[0]||p>i[1-d])))return y=Math.max(0,Mm(h,p)-1),b=p===m?y:Mm(h,m)-1,p-h[y]>o+1e-10&&++y,d&&(v=y,y=g-b,b=g-v),y>b?void 0:t().slice(y,b+1)},e.invert=function(f){const d=e.invertRange([f,f]);return d&&d[0]},e.copy=function(){return Cb().domain(t()).range(i).round(s).paddingInner(a).paddingOuter(u).align(l)},c()}function W_(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return W_(t())},e}function h8(){return W_(Cb().paddingInner(1))}var g8=Array.prototype.map;function p8(e){return g8.call(e,Ut)}const m8=Array.prototype.slice;function G_(){let e=[],t=[];function n(i){return i==null||i!==i?void 0:t[(oh(e,i)-1)%t.length]}return n.domain=function(i){return arguments.length?(e=p8(i),n):e.slice()},n.range=function(i){return arguments.length?(t=m8.call(i),n):t.slice()},n.tickFormat=function(i,r){return q5(e[0],be(e),i??10,r)},n.copy=function(){return G_().domain(n.domain()).range(n.range())},n}const yd=new Map,H_=Symbol("vega_scale");function V_(e){return e[H_]=!0,e}function Nw(e){return e&&e[H_]===!0}function y8(e,t,n){const i=function(){const o=t();return o.invertRange||(o.invertRange=o.invert?f8(o):o.invertExtent?d8(o):void 0),o.type=e,V_(o)};return i.metadata=si(K(n)),i}function we(e,t,n){return arguments.length>1?(yd.set(e,y8(e,t,n)),this):X_(e)?yd.get(e):void 0}we(c8,MC);we(ma,j5,st);we(br,DC,[st,br]);we(Yl,uy,st);we(Kl,d6,st);we(_h,TC,st);we(ns,R5,[st,kb]);we(is,h6,[st,kb]);we(Mi,ly,[st,qn]);we(`${Mi}-${ma}`,ly,[st,qn]);we(`${Mi}-${br}`,PC,[st,qn,br]);we(`${Mi}-${Yl}`,cy,[st,qn]);we(`${Mi}-${Kl}`,g6,[st,qn]);we(`${Mi}-${_h}`,zC,[st,qn]);we(`${Ja}-${ma}`,BC,[st,qn]);we(`${Ja}-${br}`,UC,[st,qn,br]);we(`${Ja}-${Yl}`,fy,[st,qn]);we(`${Ja}-${Kl}`,p6,[st,qn]);we(`${Ja}-${_h}`,jC,[st,qn]);we(ya,NC,[Ql,ya]);we(Oh,LC,Ql);we(Rh,IC,Ql);we(Ab,G_,[Jl,Ql]);we($b,Ok,Jl);we(q_,Cb,Jl);we(p0,h8,Jl);function X_(e){return yd.has(e)}function $s(e,t){const n=yd.get(e);return n&&n.metadata[t]}function Fb(e){return $s(e,st)}function ba(e){return $s(e,Jl)}function m0(e){return $s(e,Ql)}function Y_(e){return $s(e,br)}function b8(e){return $s(e,kb)}function K_(e){return $s(e,qn)}function J_(e){return $s(e,ya)}const v8=["clamp","base","constant","exponent"];function Q_(e,t){const n=t[0],i=be(t)-n;return function(r){return e(n+r*i)}}function Mh(e,t,n){return X1(_b(t||"rgb",n),e)}function Z_(e,t){const n=new Array(t),i=t+1;for(let r=0;r<t;)n[r]=e(++r/i);return n}function eO(e,t,n){const i=n-t;let r,o,s;return!i||!Number.isFinite(i)?Rt(.5):(r=(o=e.type).indexOf("-"),o=r<0?o:o.slice(r+1),s=we(o)().domain([t,n]).range([0,1]),v8.forEach(a=>e[a]?s[a](e[a]()):0),s)}function _b(e,t){const n=fI[x8(e)];return t!=null&&n&&n.gamma?n.gamma(t):n}function x8(e){return"interpolate"+e.toLowerCase().split("-").map(t=>t[0].toUpperCase()+t.slice(1)).join("")}const E8={blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},w8={accent:y6,category10:m6,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:b6,observable10:v6,paired:x6,pastel1:E6,pastel2:w6,set1:S6,set2:$6,set3:A6,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"};function tO(e){if(T(e))return e;const t=e.length/6|0,n=new Array(t);for(let i=0;i<t;)n[i]="#"+e.slice(i*6,++i*6);return n}function nO(e,t){for(const n in e)Ob(n,t(e[n]))}const Lw={};nO(w8,tO);nO(E8,e=>Mh(tO(e)));function Ob(e,t){return e=e&&e.toLowerCase(),arguments.length>1?(Lw[e]=t,this):Lw[e]}const xf="symbol",S8="discrete",$8="gradient",A8=e=>T(e)?e.map(t=>String(t)):String(e),k8=(e,t)=>e[1]-t[1],C8=(e,t)=>t[1]-e[1];function Rb(e,t,n){let i;return Ee(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),n!=null&&(t=Math.min(t,Math.floor(Gl(e.domain())/n||1)+1))),X(t)&&(i=t.step,t=t.interval),Y(t)&&(t=e.type===ns?Xa(t):e.type==is?Ya(t):M("Only time and utc scales accept interval strings."),i&&(t=t.every(i))),t}function iO(e,t,n){let i=e.range(),r=i[0],o=be(i),s=k8;if(r>o&&(i=o,o=r,r=i,s=C8),r=Math.floor(r),o=Math.ceil(o),t=t.map(a=>[a,e(a)]).filter(a=>r<=a[1]&&a[1]<=o).sort(s).map(a=>a[0]),n>0&&t.length>1){const a=[t[0],be(t)];for(;t.length>n&&t.length>=3;)t=t.filter((u,l)=>!(l%2));t.length<3&&(t=a)}return t}function Mb(e,t){return e.bins?iO(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function rO(e,t,n,i,r,o){const s=t.type;let a=A8;if(s===ns||r===ns)a=e.timeFormat(i);else if(s===is||r===is)a=e.utcFormat(i);else if(Y_(s)){const u=e.formatFloat(i);if(o||t.bins)a=u;else{const l=oO(t,n,!1);a=c=>l(c)?u(c):""}}else if(t.tickFormat){const u=t.domain();a=e.formatSpan(u[0],u[u.length-1],n,i)}else i&&(a=e.format(i));return a}function oO(e,t,n){const i=Mb(e,t),r=e.base(),o=Math.log(r),s=Math.max(1,r*t/i.length),a=u=>{let l=u/Math.pow(r,Math.round(Math.log(u)/o));return l*r<r-.5&&(l*=r),l<=s};return n?i.filter(a):a}const y0={[ya]:"quantiles",[Oh]:"thresholds",[Rh]:"domain"},sO={[ya]:"quantiles",[Oh]:"domain"};function aO(e,t){return e.bins?O8(e.bins):e.type===br?oO(e,t,!0):y0[e.type]?_8(e[y0[e.type]]()):Mb(e,t)}function F8(e,t,n){const i=t[sO[t.type]](),r=i.length;let o=r>1?i[1]-i[0]:i[0],s;for(s=1;s<r;++s)o=Math.min(o,i[s]-i[s-1]);return e.formatSpan(0,o,3*10,n)}function _8(e){const t=[-1/0].concat(e);return t.max=1/0,t}function O8(e){const t=e.slice(0,-1);return t.max=be(e),t}const R8=e=>y0[e.type]||e.bins;function uO(e,t,n,i,r,o,s){const a=sO[t.type]&&o!==ns&&o!==is?F8(e,t,r):rO(e,t,n,r,o,s);return i===xf&&R8(t)?M8(a):i===S8?D8(a):T8(a)}const M8=e=>(t,n,i)=>{const r=Iw(i[n+1],Iw(i.max,1/0)),o=Pw(t,e),s=Pw(r,e);return o&&s?o+" – "+s:s?"< "+s:"≥ "+o},Iw=(e,t)=>e??t,D8=e=>(t,n)=>n?e(t):null,T8=e=>t=>e(t),Pw=(e,t)=>Number.isFinite(e)?t(e):null;function N8(e){const t=e.domain(),n=t.length-1;let i=+t[0],r=+be(t),o=r-i;if(e.type===Rh){const s=n?o/n:.1;i-=s,r+=s,o=r-i}return s=>(s-i)/o}function L8(e,t,n,i){const r=i||t.type;return Y(n)&&b8(r)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),!n&&r===ns?e.timeFormat("%A, %d %B %Y, %X"):!n&&r===is?e.utcFormat("%A, %d %B %Y, %X UTC"):uO(e,t,5,null,n,i,!0)}function lO(e,t,n){n=n||{};const i=Math.max(3,n.maxlen||7),r=L8(e,t,n.format,n.formatType);if(m0(t.type)){const o=aO(t).slice(1).map(r),s=o.length;return`${s} boundar${s===1?"y":"ies"}: ${o.join(", ")}`}else if(ba(t.type)){const o=t.domain(),s=o.length,a=s>i?o.slice(0,i-2).map(r).join(", ")+", ending with "+o.slice(-1).map(r):o.map(r).join(", ");return`${s} value${s===1?"":"s"}: ${a}`}else{const o=t.domain();return`values from ${r(o[0])} to ${r(be(o))}`}}let cO=0;function I8(){cO=0}const bd="p_";function Db(e){return e&&e.gradient}function fO(e,t,n){const i=e.gradient;let r=e.id,o=i==="radial"?bd:"";return r||(r=e.id="gradient_"+cO++,i==="radial"?(e.x1=wi(e.x1,.5),e.y1=wi(e.y1,.5),e.r1=wi(e.r1,0),e.x2=wi(e.x2,.5),e.y2=wi(e.y2,.5),e.r2=wi(e.r2,.5),o=bd):(e.x1=wi(e.x1,0),e.y1=wi(e.y1,0),e.x2=wi(e.x2,1),e.y2=wi(e.y2,0))),t[r]=e,"url("+(n||"")+"#"+o+r+")"}function wi(e,t){return e??t}function dO(e,t){var n=[],i;return i={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:n,stop:function(r,o){return n.push({offset:r,color:o}),i}}}const zw={basis:{curve:mL},"basis-closed":{curve:yL},"basis-open":{curve:bL},bundle:{curve:vL,tension:"beta",value:.85},cardinal:{curve:xL,tension:"tension",value:0},"cardinal-open":{curve:EL,tension:"tension",value:0},"cardinal-closed":{curve:wL,tension:"tension",value:0},"catmull-rom":{curve:SL,tension:"alpha",value:.5},"catmull-rom-closed":{curve:$L,tension:"alpha",value:.5},"catmull-rom-open":{curve:AL,tension:"alpha",value:.5},linear:{curve:Fk},"linear-closed":{curve:kL},monotone:{horizontal:CL,vertical:FL},natural:{curve:_L},step:{curve:OL},"step-after":{curve:RL},"step-before":{curve:ML}};function Tb(e,t,n){var i=J(zw,e)&&zw[e],r=null;return i&&(r=i.curve||i[t||"vertical"],i.tension&&n!=null&&(r=r[i.tension](n))),r}const P8={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},z8=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,B8=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,U8=/^((\s+,?\s*)|(,\s*))/,j8=/^[01]/;function va(e){const t=[];return(e.match(z8)||[]).forEach(i=>{let r=i[0];const o=r.toLowerCase(),s=P8[o],a=q8(o,s,i.slice(1).trim()),u=a.length;if(u<s||u&&u%s!==0)throw Error("Invalid SVG path, incorrect parameter count");if(t.push([r,...a.slice(0,s)]),u!==s){o==="m"&&(r=r==="M"?"L":"l");for(let l=s;l<u;l+=s)t.push([r,...a.slice(l,l+s)])}}),t}function q8(e,t,n){const i=[];for(let r=0;t&&r<n.length;)for(let o=0;o<t;++o){const s=e==="a"&&(o===3||o===4)?j8:B8,a=n.slice(r).match(s);if(a===null)throw Error("Invalid SVG path, incorrect parameter type");r+=a[0].length,i.push(+a[0]);const u=n.slice(r).match(U8);u!==null&&(r+=u[0].length)}return i}const so=Math.PI/180,W8=1e-14,Bo=Math.PI/2,Oi=Math.PI*2,Bs=Math.sqrt(3)/2;var vp={},xp={},hO=[].join;function G8(e,t,n,i,r,o,s,a,u){const l=hO.call(arguments);if(vp[l])return vp[l];const c=s*so,f=Math.sin(c),d=Math.cos(c);n=Math.abs(n),i=Math.abs(i);const h=d*(a-e)*.5+f*(u-t)*.5,g=d*(u-t)*.5-f*(a-e)*.5;let p=h*h/(n*n)+g*g/(i*i);p>1&&(p=Math.sqrt(p),n*=p,i*=p);const m=d/n,y=f/n,b=-f/i,v=d/i,x=m*a+y*u,w=b*a+v*u,S=m*e+y*t,E=b*e+v*t;let A=1/((S-x)*(S-x)+(E-w)*(E-w))-.25;A<0&&(A=0);let C=Math.sqrt(A);o==r&&(C=-C);const F=.5*(x+S)-C*(E-w),I=.5*(w+E)+C*(S-x),j=Math.atan2(w-I,x-F);let k=Math.atan2(E-I,S-F)-j;k<0&&o===1?k+=Oi:k>0&&o===0&&(k-=Oi);const _=Math.ceil(Math.abs(k/(Bo+.001))),N=[];for(let W=0;W<_;++W){const P=j+W*k/_,Q=j+(W+1)*k/_;N[W]=[F,I,P,Q,n,i,f,d]}return vp[l]=N}function H8(e){const t=hO.call(e);if(xp[t])return xp[t];var n=e[0],i=e[1],r=e[2],o=e[3],s=e[4],a=e[5],u=e[6],l=e[7];const c=l*s,f=-u*a,d=u*s,h=l*a,g=Math.cos(r),p=Math.sin(r),m=Math.cos(o),y=Math.sin(o),b=.5*(o-r),v=Math.sin(b*.5),x=8/3*v*v/Math.sin(b),w=n+g-x*p,S=i+p+x*g,E=n+m,$=i+y,A=E+x*y,C=$-x*m;return xp[t]=[c*w+f*S,d*w+h*S,c*A+f*C,d*A+h*C,c*E+f*$,d*E+h*$]}const Cn=["l",0,0,0,0,0,0,0];function V8(e,t,n){const i=Cn[0]=e[0];if(i==="a"||i==="A")Cn[1]=t*e[1],Cn[2]=n*e[2],Cn[3]=e[3],Cn[4]=e[4],Cn[5]=e[5],Cn[6]=t*e[6],Cn[7]=n*e[7];else if(i==="h"||i==="H")Cn[1]=t*e[1];else if(i==="v"||i==="V")Cn[1]=n*e[1];else for(var r=1,o=e.length;r<o;++r)Cn[r]=(r%2==1?t:n)*e[r];return Cn}function wl(e,t,n,i,r,o){var s,a=null,u=0,l=0,c=0,f=0,d,h,g,p,m=0,y=0;n==null&&(n=0),i==null&&(i=0),r==null&&(r=1),o==null&&(o=r),e.beginPath&&e.beginPath();for(var b=0,v=t.length;b<v;++b){switch(s=t[b],(r!==1||o!==1)&&(s=V8(s,r,o)),s[0]){case"l":u+=s[1],l+=s[2],e.lineTo(u+n,l+i);break;case"L":u=s[1],l=s[2],e.lineTo(u+n,l+i);break;case"h":u+=s[1],e.lineTo(u+n,l+i);break;case"H":u=s[1],e.lineTo(u+n,l+i);break;case"v":l+=s[1],e.lineTo(u+n,l+i);break;case"V":l=s[1],e.lineTo(u+n,l+i);break;case"m":u+=s[1],l+=s[2],m=u,y=l,e.moveTo(u+n,l+i);break;case"M":u=s[1],l=s[2],m=u,y=l,e.moveTo(u+n,l+i);break;case"c":d=u+s[5],h=l+s[6],c=u+s[3],f=l+s[4],e.bezierCurveTo(u+s[1]+n,l+s[2]+i,c+n,f+i,d+n,h+i),u=d,l=h;break;case"C":u=s[5],l=s[6],c=s[3],f=s[4],e.bezierCurveTo(s[1]+n,s[2]+i,c+n,f+i,u+n,l+i);break;case"s":d=u+s[3],h=l+s[4],c=2*u-c,f=2*l-f,e.bezierCurveTo(c+n,f+i,u+s[1]+n,l+s[2]+i,d+n,h+i),c=u+s[1],f=l+s[2],u=d,l=h;break;case"S":d=s[3],h=s[4],c=2*u-c,f=2*l-f,e.bezierCurveTo(c+n,f+i,s[1]+n,s[2]+i,d+n,h+i),u=d,l=h,c=s[1],f=s[2];break;case"q":d=u+s[3],h=l+s[4],c=u+s[1],f=l+s[2],e.quadraticCurveTo(c+n,f+i,d+n,h+i),u=d,l=h;break;case"Q":d=s[3],h=s[4],e.quadraticCurveTo(s[1]+n,s[2]+i,d+n,h+i),u=d,l=h,c=s[1],f=s[2];break;case"t":d=u+s[1],h=l+s[2],a[0].match(/[QqTt]/)===null?(c=u,f=l):a[0]==="t"?(c=2*u-g,f=2*l-p):a[0]==="q"&&(c=2*u-c,f=2*l-f),g=c,p=f,e.quadraticCurveTo(c+n,f+i,d+n,h+i),u=d,l=h,c=u+s[1],f=l+s[2];break;case"T":d=s[1],h=s[2],c=2*u-c,f=2*l-f,e.quadraticCurveTo(c+n,f+i,d+n,h+i),u=d,l=h;break;case"a":Bw(e,u+n,l+i,[s[1],s[2],s[3],s[4],s[5],s[6]+u+n,s[7]+l+i]),u+=s[6],l+=s[7];break;case"A":Bw(e,u+n,l+i,[s[1],s[2],s[3],s[4],s[5],s[6]+n,s[7]+i]),u=s[6],l=s[7];break;case"z":case"Z":u=m,l=y,e.closePath();break}a=s}}function Bw(e,t,n,i){const r=G8(i[5],i[6],i[0],i[1],i[3],i[4],i[2],t,n);for(let o=0;o<r.length;++o){const s=H8(r[o]);e.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])}}const Uw=.5773502691896257,jw={circle:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,Oi)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/2.5;e.moveTo(-n,-i),e.lineTo(-n,i),e.lineTo(-i,i),e.lineTo(-i,n),e.lineTo(i,n),e.lineTo(i,i),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(i,-i),e.lineTo(i,-n),e.lineTo(-i,-n),e.lineTo(-i,-i),e.closePath()}},diamond:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),i=-n/2;e.rect(i,i,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,i=n/7,r=n/2.5,o=n/8;e.moveTo(-i,n),e.lineTo(i,n),e.lineTo(i,-o),e.lineTo(r,-o),e.lineTo(0,-n),e.lineTo(-r,-o),e.lineTo(-i,-o),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,i=Bs*n,r=i-n*Uw,o=n/4;e.moveTo(0,-i-r),e.lineTo(-o,i-r),e.lineTo(o,i-r),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,i=Bs*n,r=i-n*Uw;e.moveTo(0,-i-r),e.lineTo(-n,i-r),e.lineTo(n,i-r),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Bs*n;e.moveTo(0,-i),e.lineTo(-n,i),e.lineTo(n,i),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Bs*n;e.moveTo(0,i),e.lineTo(-n,-i),e.lineTo(n,-i),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Bs*n;e.moveTo(i,0),e.lineTo(-i,-n),e.lineTo(-i,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,i=Bs*n;e.moveTo(-i,0),e.lineTo(i,-n),e.lineTo(i,n),e.closePath()}},stroke:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}};function gO(e){return J(jw,e)?jw[e]:X8(e)}var Ep={};function X8(e){if(!J(Ep,e)){const t=va(e);Ep[e]={draw:function(n,i){wl(n,t,0,0,Math.sqrt(i)/2)}}}return Ep[e]}const Dr=.448084975506;function Y8(e){return e.x}function K8(e){return e.y}function J8(e){return e.width}function Q8(e){return e.height}function tr(e){return typeof e=="function"?e:()=>+e}function Wc(e,t,n){return Math.max(t,Math.min(e,n))}function pO(){var e=Y8,t=K8,n=J8,i=Q8,r=tr(0),o=r,s=r,a=r,u=null;function l(c,f,d){var h,g=f??+e.call(this,c),p=d??+t.call(this,c),m=+n.call(this,c),y=+i.call(this,c),b=Math.min(m,y)/2,v=Wc(+r.call(this,c),0,b),x=Wc(+o.call(this,c),0,b),w=Wc(+s.call(this,c),0,b),S=Wc(+a.call(this,c),0,b);if(u||(u=h=W1()),v<=0&&x<=0&&w<=0&&S<=0)u.rect(g,p,m,y);else{var E=g+m,$=p+y;u.moveTo(g+v,p),u.lineTo(E-x,p),u.bezierCurveTo(E-Dr*x,p,E,p+Dr*x,E,p+x),u.lineTo(E,$-S),u.bezierCurveTo(E,$-Dr*S,E-Dr*S,$,E-S,$),u.lineTo(g+w,$),u.bezierCurveTo(g+Dr*w,$,g,$-Dr*w,g,$-w),u.lineTo(g,p+v),u.bezierCurveTo(g,p+Dr*v,g+Dr*v,p,g+v,p),u.closePath()}if(h)return u=null,h+""||null}return l.x=function(c){return arguments.length?(e=tr(c),l):e},l.y=function(c){return arguments.length?(t=tr(c),l):t},l.width=function(c){return arguments.length?(n=tr(c),l):n},l.height=function(c){return arguments.length?(i=tr(c),l):i},l.cornerRadius=function(c,f,d,h){return arguments.length?(r=tr(c),o=f!=null?tr(f):r,a=d!=null?tr(d):r,s=h!=null?tr(h):o,l):r},l.context=function(c){return arguments.length?(u=c??null,l):u},l}function mO(){var e,t,n,i,r=null,o,s,a,u;function l(f,d,h){const g=h/2;if(o){var p=a-d,m=f-s;if(p||m){var y=Math.hypot(p,m),b=(p/=y)*u,v=(m/=y)*u,x=Math.atan2(m,p);r.moveTo(s-b,a-v),r.lineTo(f-p*g,d-m*g),r.arc(f,d,g,x-Math.PI,x),r.lineTo(s+b,a+v),r.arc(s,a,u,x,x+Math.PI)}else r.arc(f,d,g,0,Oi);r.closePath()}else o=1;s=f,a=d,u=g}function c(f){var d,h=f.length,g,p=!1,m;for(r==null&&(r=m=W1()),d=0;d<=h;++d)!(d<h&&i(g=f[d],d,f))===p&&(p=!p)&&(o=0),p&&l(+e(g,d,f),+t(g,d,f),+n(g,d,f));if(m)return r=null,m+""||null}return c.x=function(f){return arguments.length?(e=f,c):e},c.y=function(f){return arguments.length?(t=f,c):t},c.size=function(f){return arguments.length?(n=f,c):n},c.defined=function(f){return arguments.length?(i=f,c):i},c.context=function(f){return arguments.length?(f==null?r=null:r=f,c):r},c}function Zl(e,t){return e??t}const ec=e=>e.x||0,tc=e=>e.y||0,Z8=e=>e.width||0,e7=e=>e.height||0,t7=e=>(e.x||0)+(e.width||0),n7=e=>(e.y||0)+(e.height||0),i7=e=>e.startAngle||0,r7=e=>e.endAngle||0,o7=e=>e.padAngle||0,s7=e=>e.innerRadius||0,a7=e=>e.outerRadius||0,u7=e=>e.cornerRadius||0,l7=e=>Zl(e.cornerRadiusTopLeft,e.cornerRadius)||0,c7=e=>Zl(e.cornerRadiusTopRight,e.cornerRadius)||0,f7=e=>Zl(e.cornerRadiusBottomRight,e.cornerRadius)||0,d7=e=>Zl(e.cornerRadiusBottomLeft,e.cornerRadius)||0,h7=e=>Zl(e.size,64),g7=e=>e.size||1,Dh=e=>e.defined!==!1,p7=e=>gO(e.shape||"circle"),m7=TL().startAngle(i7).endAngle(r7).padAngle(o7).innerRadius(s7).outerRadius(a7).cornerRadius(u7),y7=qC().x(ec).y1(tc).y0(n7).defined(Dh),b7=qC().y(tc).x1(ec).x0(t7).defined(Dh),v7=_k().x(ec).y(tc).defined(Dh),x7=pO().x(ec).y(tc).width(Z8).height(e7).cornerRadius(l7,c7,f7,d7),E7=C6().type(p7).size(h7),w7=mO().x(ec).y(tc).defined(Dh).size(g7);function Nb(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function S7(e,t){return m7.context(e)(t)}function $7(e,t){const n=t[0],i=n.interpolate||"linear";return(n.orient==="horizontal"?b7:y7).curve(Tb(i,n.orient,n.tension)).context(e)(t)}function A7(e,t){const n=t[0],i=n.interpolate||"linear";return v7.curve(Tb(i,n.orient,n.tension)).context(e)(t)}function Qa(e,t,n,i){return x7.context(e)(t,n,i)}function k7(e,t){return(t.mark.shape||t.shape).context(e)(t)}function C7(e,t){return E7.context(e)(t)}function F7(e,t){return w7.context(e)(t)}var yO=1;function _7(){yO=1}function Lb(e,t,n){var i=t.clip,r=e._defs,o=t.clip_id||(t.clip_id="clip"+yO++),s=r.clipping[o]||(r.clipping[o]={id:o});return ce(i)?s.path=i(null):Nb(n)?s.path=Qa(null,n,0,0):(s.width=n.width||0,s.height=n.height||0),"url(#"+o+")"}function Ze(e){this.clear(),e&&this.union(e)}Ze.prototype={clone(){return new Ze(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,i){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),i<t?(this.y2=t,this.y1=i):(this.y1=t,this.y2=i),this},add(e,t){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const i=this.rotatedPoints(e,t,n);return this.clear().add(i[0],i[1]).add(i[2],i[3]).add(i[4],i[5]).add(i[6],i[7])},rotatedPoints(e,t,n){var{x1:i,y1:r,x2:o,y2:s}=this,a=Math.cos(e),u=Math.sin(e),l=t-t*a+n*u,c=n-t*u-n*a;return[a*i-u*r+l,u*i+a*r+c,a*i-u*s+l,u*i+a*s+c,a*o-u*r+l,u*o+a*r+c,a*o-u*s+l,u*o+a*s+c]},union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this},encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)},contains(e,t){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}};function Th(e){this.mark=e,this.bounds=this.bounds||new Ze}function Nh(e){Th.call(this,e),this.items=this.items||[]}H(Nh,Th);class bO{constructor(t){this._pending=0,this._loader=t||yh()}pending(){return this._pending}sanitizeURL(t){const n=this;return qw(n),n._loader.sanitize(t,{context:"href"}).then(i=>(bu(n),i)).catch(()=>(bu(n),null))}loadImage(t){const n=this,i=l8();return qw(n),n._loader.sanitize(t,{context:"image"}).then(r=>{const o=r.href;if(!o||!i)throw{url:o};const s=new i,a=J(r,"crossOrigin")?r.crossOrigin:"anonymous";return a!=null&&(s.crossOrigin=a),s.onload=()=>bu(n),s.onerror=()=>bu(n),s.src=o,s}).catch(r=>(bu(n),{complete:!1,width:0,height:0,src:r&&r.url||""}))}ready(){const t=this;return new Promise(n=>{function i(r){t.pending()?setTimeout(()=>{i(!0)},10):n(r)}i(!1)})}}function qw(e){e._pending+=1}function bu(e){e._pending-=1}function $r(e,t,n){if(t.stroke&&t.opacity!==0&&t.strokeOpacity!==0){const i=t.strokeWidth!=null?+t.strokeWidth:1;e.expand(i+(n?O7(t,i):0))}return e}function O7(e,t){return e.strokeJoin&&e.strokeJoin!=="miter"?0:t}const R7=Oi-1e-8;let Lh,Ef,wf,Wo,b0,Sf,v0,x0;const Hr=(e,t)=>Lh.add(e,t),$f=(e,t)=>Hr(Ef=e,wf=t),Ww=e=>Hr(e,Lh.y1),Gw=e=>Hr(Lh.x1,e),Uo=(e,t)=>b0*e+v0*t,jo=(e,t)=>Sf*e+x0*t,wp=(e,t)=>Hr(Uo(e,t),jo(e,t)),Sp=(e,t)=>$f(Uo(e,t),jo(e,t));function nc(e,t){return Lh=e,t?(Wo=t*so,b0=x0=Math.cos(Wo),Sf=Math.sin(Wo),v0=-Sf):(b0=x0=1,Wo=Sf=v0=0),M7}const M7={beginPath(){},closePath(){},moveTo:Sp,lineTo:Sp,rect(e,t,n,i){Wo?(wp(e+n,t),wp(e+n,t+i),wp(e,t+i),Sp(e,t)):(Hr(e+n,t+i),$f(e,t))},quadraticCurveTo(e,t,n,i){const r=Uo(e,t),o=jo(e,t),s=Uo(n,i),a=jo(n,i);Hw(Ef,r,s,Ww),Hw(wf,o,a,Gw),$f(s,a)},bezierCurveTo(e,t,n,i,r,o){const s=Uo(e,t),a=jo(e,t),u=Uo(n,i),l=jo(n,i),c=Uo(r,o),f=jo(r,o);Vw(Ef,s,u,c,Ww),Vw(wf,a,l,f,Gw),$f(c,f)},arc(e,t,n,i,r,o){if(i+=Wo,r+=Wo,Ef=n*Math.cos(r)+e,wf=n*Math.sin(r)+t,Math.abs(r-i)>R7)Hr(e-n,t-n),Hr(e+n,t+n);else{const s=l=>Hr(n*Math.cos(l)+e,n*Math.sin(l)+t);let a,u;if(s(i),s(r),r!==i)if(i=i%Oi,i<0&&(i+=Oi),r=r%Oi,r<0&&(r+=Oi),r<i&&(o=!o,a=i,i=r,r=a),o)for(r-=Oi,a=i-i%Bo,u=0;u<4&&a>r;++u,a-=Bo)s(a);else for(a=i-i%Bo+Bo,u=0;u<4&&a<r;++u,a=a+Bo)s(a)}}};function Hw(e,t,n,i){const r=(e-t)/(e+n-2*t);0<r&&r<1&&i(e+(t-e)*r)}function Vw(e,t,n,i,r){const o=i-e+3*t-3*n,s=e+n-2*t,a=e-t;let u=0,l=0,c;Math.abs(o)>W8?(c=s*s+a*o,c>=0&&(c=Math.sqrt(c),u=(-s+c)/o,l=(-s-c)/o)):u=.5*a/s,0<u&&u<1&&r(Xw(u,e,t,n,i)),0<l&&l<1&&r(Xw(l,e,t,n,i))}function Xw(e,t,n,i,r){const o=1-e,s=o*o,a=e*e;return s*o*t+3*s*e*n+3*o*a*i+a*e*r}var io=(io=no(1,1))?io.getContext("2d"):null;const E0=new Ze;function Ib(e){return function(t,n){if(!io)return!0;e(io,t),E0.clear().union(t.bounds).intersect(n).round();const{x1:i,y1:r,x2:o,y2:s}=E0;for(let a=r;a<=s;++a)for(let u=i;u<=o;++u)if(io.isPointInPath(u,a))return!0;return!1}}function Pb(e,t){return t.contains(e.x||0,e.y||0)}function vO(e,t){const n=e.x||0,i=e.y||0,r=e.width||0,o=e.height||0;return t.intersects(E0.set(n,i,n+r,i+o))}function xO(e,t){const n=e.x||0,i=e.y||0,r=e.x2!=null?e.x2:n,o=e.y2!=null?e.y2:i;return Zs(t,n,i,r,o)}function Zs(e,t,n,i,r){const{x1:o,y1:s,x2:a,y2:u}=e,l=i-t,c=r-n;let f=0,d=1,h,g,p,m;for(m=0;m<4;++m){if(m===0&&(h=-l,g=-(o-t)),m===1&&(h=l,g=a-t),m===2&&(h=-c,g=-(s-n)),m===3&&(h=c,g=u-n),Math.abs(h)<1e-10&&g<0)return!1;if(p=g/h,h<0){if(p>d)return!1;p>f&&(f=p)}else if(h>0){if(p<f)return!1;p<d&&(d=p)}}return!0}function xa(e,t){e.globalCompositeOperation=t.blend||"source-over"}function Vn(e,t){return e??t}function Yw(e,t){const n=t.length;for(let i=0;i<n;++i)e.addColorStop(t[i].offset,t[i].color);return e}function D7(e,t,n){const i=n.width(),r=n.height();let o;if(t.gradient==="radial")o=e.createRadialGradient(n.x1+Vn(t.x1,.5)*i,n.y1+Vn(t.y1,.5)*r,Math.max(i,r)*Vn(t.r1,0),n.x1+Vn(t.x2,.5)*i,n.y1+Vn(t.y2,.5)*r,Math.max(i,r)*Vn(t.r2,.5));else{const s=Vn(t.x1,0),a=Vn(t.y1,0),u=Vn(t.x2,1),l=Vn(t.y2,0);if(s===u||a===l||i===r)o=e.createLinearGradient(n.x1+s*i,n.y1+a*r,n.x1+u*i,n.y1+l*r);else{const c=no(Math.ceil(i),Math.ceil(r)),f=c.getContext("2d");return f.scale(i,r),f.fillStyle=Yw(f.createLinearGradient(s,a,u,l),t.stops),f.fillRect(0,0,i,r),e.createPattern(c,"no-repeat")}}return Yw(o,t.stops)}function EO(e,t,n){return Db(n)?D7(e,n,t.bounds):n}function vd(e,t,n){return n*=t.fillOpacity==null?1:t.fillOpacity,n>0?(e.globalAlpha=n,e.fillStyle=EO(e,t,t.fill),!0):!1}var T7=[];function Ea(e,t,n){var i=(i=t.strokeWidth)!=null?i:1;return i<=0?!1:(n*=t.strokeOpacity==null?1:t.strokeOpacity,n>0?(e.globalAlpha=n,e.strokeStyle=EO(e,t,t.stroke),e.lineWidth=i,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||T7),e.lineDashOffset=t.strokeDashOffset||0),!0):!1)}function N7(e,t){return e.zindex-t.zindex||e.index-t.index}function zb(e){if(!e.zdirty)return e.zitems;var t=e.items,n=[],i,r,o;for(r=0,o=t.length;r<o;++r)i=t[r],i.index=r,i.zindex&&n.push(i);return e.zdirty=!1,e.zitems=n.sort(N7)}function ui(e,t){var n=e.items,i,r;if(!n||!n.length)return;const o=zb(e);if(o&&o.length){for(i=0,r=n.length;i<r;++i)n[i].zindex||t(n[i]);n=o}for(i=0,r=n.length;i<r;++i)t(n[i])}function xd(e,t){var n=e.items,i,r;if(!n||!n.length)return null;const o=zb(e);for(o&&o.length&&(n=o),r=n.length;--r>=0;)if(i=t(n[r]))return i;if(n===o){for(n=e.items,r=n.length;--r>=0;)if(!n[r].zindex&&(i=t(n[r])))return i}return null}function Bb(e){return function(t,n,i){ui(n,r=>{(!i||i.intersects(r.bounds))&&wO(e,t,r,r)})}}function L7(e){return function(t,n,i){n.items.length&&(!i||i.intersects(n.bounds))&&wO(e,t,n.items[0],n.items)}}function wO(e,t,n,i){var r=n.opacity==null?1:n.opacity;r!==0&&(e(t,i)||(xa(t,n),n.fill&&vd(t,n,r)&&t.fill(),n.stroke&&Ea(t,n,r)&&t.stroke()))}function Ih(e){return e=e||Pn,function(t,n,i,r,o,s){return i*=t.pixelRatio,r*=t.pixelRatio,xd(n,a=>{const u=a.bounds;if(!(u&&!u.contains(o,s)||!u)&&e(t,a,i,r,o,s))return a})}}function ic(e,t){return function(n,i,r,o){var s=Array.isArray(i)?i[0]:i,a=t??s.fill,u=s.stroke&&n.isPointInStroke,l,c;return u&&(l=s.strokeWidth,c=s.strokeCap,n.lineWidth=l??1,n.lineCap=c??"butt"),e(n,i)?!1:a&&n.isPointInPath(r,o)||u&&n.isPointInStroke(r,o)}}function Ub(e){return Ih(ic(e))}function Vo(e,t){return"translate("+e+","+t+")"}function jb(e){return"rotate("+e+")"}function I7(e,t){return"scale("+e+","+t+")"}function SO(e){return Vo(e.x||0,e.y||0)}function P7(e){return Vo(e.x||0,e.y||0)+(e.angle?" "+jb(e.angle):"")}function z7(e){return Vo(e.x||0,e.y||0)+(e.angle?" "+jb(e.angle):"")+(e.scaleX||e.scaleY?" "+I7(e.scaleX||1,e.scaleY||1):"")}function qb(e,t,n){function i(s,a){s("transform",P7(a)),s("d",t(null,a))}function r(s,a){return t(nc(s,a.angle),a),$r(s,a).translate(a.x||0,a.y||0)}function o(s,a){var u=a.x||0,l=a.y||0,c=a.angle||0;s.translate(u,l),c&&s.rotate(c*=so),s.beginPath(),t(s,a),c&&s.rotate(-c),s.translate(-u,-l)}return{type:e,tag:"path",nested:!1,attr:i,bound:r,draw:Bb(o),pick:Ub(o),isect:n||Ib(o)}}var B7=qb("arc",S7);function U7(e,t){for(var n=e[0].orient==="horizontal"?t[1]:t[0],i=e[0].orient==="horizontal"?"y":"x",r=e.length,o=1/0,s,a;--r>=0;)e[r].defined!==!1&&(a=Math.abs(e[r][i]-n),a<o&&(o=a,s=e[r]));return s}function j7(e,t){for(var n=Math.pow(e[0].strokeWidth||1,2),i=e.length,r,o,s;--i>=0;)if(e[i].defined!==!1&&(r=e[i].x-t[0],o=e[i].y-t[1],s=r*r+o*o,s<n))return e[i];return null}function q7(e,t){for(var n=e.length,i,r,o;--n>=0;)if(e[n].defined!==!1&&(i=e[n].x-t[0],r=e[n].y-t[1],o=i*i+r*r,i=e[n].size||1,o<i*i))return e[n];return null}function Wb(e,t,n){function i(u,l){var c=l.mark.items;c.length&&u("d",t(null,c))}function r(u,l){var c=l.items;return c.length===0?u:(t(nc(u),c),$r(u,c[0]))}function o(u,l){u.beginPath(),t(u,l)}const s=ic(o);function a(u,l,c,f,d,h){var g=l.items,p=l.bounds;return!g||!g.length||p&&!p.contains(d,h)?null:(c*=u.pixelRatio,f*=u.pixelRatio,s(u,g,c,f)?g[0]:null)}return{type:e,tag:"path",nested:!0,attr:i,bound:r,draw:L7(o),pick:a,isect:Pb,tip:n}}var W7=Wb("area",$7,U7);function G7(e,t){var n=t.clip;e.save(),ce(n)?(e.beginPath(),n(e),e.clip()):$O(e,t.group)}function $O(e,t){e.beginPath(),Nb(t)?Qa(e,t,0,0):e.rect(0,0,t.width||0,t.height||0),e.clip()}function AO(e){const t=Vn(e.strokeWidth,1);return e.strokeOffset!=null?e.strokeOffset:e.stroke&&t>.5&&t<1.5?.5-Math.abs(t-1):0}function H7(e,t){e("transform",SO(t))}function kO(e,t){const n=AO(t);e("d",Qa(null,t,n,n))}function V7(e,t){e("class","background"),e("aria-hidden",!0),kO(e,t)}function X7(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?kO(e,t):e("d","")}function Y7(e,t,n){const i=t.clip?Lb(n,t,t):null;e("clip-path",i)}function K7(e,t){if(!t.clip&&t.items){const n=t.items,i=n.length;for(let r=0;r<i;++r)e.union(n[r].bounds)}return(t.clip||t.width||t.height)&&!t.noBound&&e.add(0,0).add(t.width||0,t.height||0),$r(e,t),e.translate(t.x||0,t.y||0)}function Sl(e,t,n,i){const r=AO(t);e.beginPath(),Qa(e,t,(n||0)+r,(i||0)+r)}const J7=ic(Sl),Q7=ic(Sl,!1),Z7=ic(Sl,!0);function eB(e,t,n,i){ui(t,r=>{const o=r.x||0,s=r.y||0,a=r.strokeForeground,u=r.opacity==null?1:r.opacity;(r.stroke||r.fill)&&u&&(Sl(e,r,o,s),xa(e,r),r.fill&&vd(e,r,u)&&e.fill(),r.stroke&&!a&&Ea(e,r,u)&&e.stroke()),e.save(),e.translate(o,s),r.clip&&$O(e,r),n&&n.translate(-o,-s),ui(r,l=>{(l.marktype==="group"||i==null||i.includes(l.marktype))&&this.draw(e,l,n,i)}),n&&n.translate(o,s),e.restore(),a&&r.stroke&&u&&(Sl(e,r,o,s),xa(e,r),Ea(e,r,u)&&e.stroke())})}function tB(e,t,n,i,r,o){if(t.bounds&&!t.bounds.contains(r,o)||!t.items)return null;const s=n*e.pixelRatio,a=i*e.pixelRatio;return xd(t,u=>{let l,c,f;const d=u.bounds;if(d&&!d.contains(r,o))return;c=u.x||0,f=u.y||0;const h=c+(u.width||0),g=f+(u.height||0),p=u.clip;if(p&&(r<c||r>h||o<f||o>g))return;if(e.save(),e.translate(c,f),c=r-c,f=o-f,p&&Nb(u)&&!Z7(e,u,s,a))return e.restore(),null;const m=u.strokeForeground,y=t.interactive!==!1;return y&&m&&u.stroke&&Q7(e,u,s,a)?(e.restore(),u):(l=xd(u,b=>nB(b,c,f)?this.pick(b,n,i,c,f):null),!l&&y&&(u.fill||!m&&u.stroke)&&J7(e,u,s,a)&&(l=u),e.restore(),l||null)})}function nB(e,t,n){return(e.interactive!==!1||e.marktype==="group")&&e.bounds&&e.bounds.contains(t,n)}var iB={type:"group",tag:"g",nested:!1,attr:H7,bound:K7,draw:eB,pick:tB,isect:vO,content:Y7,background:V7,foreground:X7},$l={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function Gb(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then(i=>{e.image=i,e.image.url=e.url})),n}function Hb(e,t){return e.width!=null?e.width:!t||!t.width?0:e.aspect!==!1&&e.height?e.height*t.width/t.height:t.width}function Vb(e,t){return e.height!=null?e.height:!t||!t.height?0:e.aspect!==!1&&e.width?e.width*t.height/t.width:t.height}function Ph(e,t){return e==="center"?t/2:e==="right"?t:0}function zh(e,t){return e==="middle"?t/2:e==="bottom"?t:0}function rB(e,t,n){const i=Gb(t,n),r=Hb(t,i),o=Vb(t,i),s=(t.x||0)-Ph(t.align,r),a=(t.y||0)-zh(t.baseline,o),u=!i.src&&i.toDataURL?i.toDataURL():i.src||"";e("href",u,$l["xmlns:xlink"],"xlink:href"),e("transform",Vo(s,a)),e("width",r),e("height",o),e("preserveAspectRatio",t.aspect===!1?"none":"xMidYMid")}function oB(e,t){const n=t.image,i=Hb(t,n),r=Vb(t,n),o=(t.x||0)-Ph(t.align,i),s=(t.y||0)-zh(t.baseline,r);return e.set(o,s,o+i,s+r)}function sB(e,t,n){ui(t,i=>{if(n&&!n.intersects(i.bounds))return;const r=Gb(i,this);let o=Hb(i,r),s=Vb(i,r);if(o===0||s===0)return;let a=(i.x||0)-Ph(i.align,o),u=(i.y||0)-zh(i.baseline,s),l,c,f,d;i.aspect!==!1&&(c=r.width/r.height,f=i.width/i.height,c===c&&f===f&&c!==f&&(f<c?(d=o/c,u+=(s-d)/2,s=d):(d=s*c,a+=(o-d)/2,o=d))),(r.complete||r.toDataURL)&&(xa(e,i),e.globalAlpha=(l=i.opacity)!=null?l:1,e.imageSmoothingEnabled=i.smooth!==!1,e.drawImage(r,a,u,o,s))})}var aB={type:"image",tag:"image",nested:!1,attr:rB,bound:oB,draw:sB,pick:Ih(),isect:Pn,get:Gb,xOffset:Ph,yOffset:zh},uB=Wb("line",A7,j7);function lB(e,t){var n=t.scaleX||1,i=t.scaleY||1;(n!==1||i!==1)&&e("vector-effect","non-scaling-stroke"),e("transform",z7(t)),e("d",t.path)}function Af(e,t){var n=t.path;if(n==null)return!0;var i=t.x||0,r=t.y||0,o=t.scaleX||1,s=t.scaleY||1,a=(t.angle||0)*so,u=t.pathCache;(!u||u.path!==n)&&((t.pathCache=u=va(n)).path=n),a&&e.rotate&&e.translate?(e.translate(i,r),e.rotate(a),wl(e,u,0,0,o,s),e.rotate(-a),e.translate(-i,-r)):wl(e,u,i,r,o,s)}function cB(e,t){return Af(nc(e,t.angle),t)?e.set(0,0,0,0):$r(e,t,!0)}var fB={type:"path",tag:"path",nested:!1,attr:lB,bound:cB,draw:Bb(Af),pick:Ub(Af),isect:Ib(Af)};function dB(e,t){e("d",Qa(null,t))}function hB(e,t){var n,i;return $r(e.set(n=t.x||0,i=t.y||0,n+t.width||0,i+t.height||0),t)}function Kw(e,t){e.beginPath(),Qa(e,t)}var gB={type:"rect",tag:"path",nested:!1,attr:dB,bound:hB,draw:Bb(Kw),pick:Ub(Kw),isect:vO};function pB(e,t){e("transform",SO(t)),e("x2",t.x2!=null?t.x2-(t.x||0):0),e("y2",t.y2!=null?t.y2-(t.y||0):0)}function mB(e,t){var n,i;return $r(e.set(n=t.x||0,i=t.y||0,t.x2!=null?t.x2:n,t.y2!=null?t.y2:i),t)}function CO(e,t,n){var i,r,o,s;return t.stroke&&Ea(e,t,n)?(i=t.x||0,r=t.y||0,o=t.x2!=null?t.x2:i,s=t.y2!=null?t.y2:r,e.beginPath(),e.moveTo(i,r),e.lineTo(o,s),!0):!1}function yB(e,t,n){ui(t,i=>{if(!(n&&!n.intersects(i.bounds))){var r=i.opacity==null?1:i.opacity;r&&CO(e,i,r)&&(xa(e,i),e.stroke())}})}function bB(e,t,n,i){return e.isPointInStroke?CO(e,t,1)&&e.isPointInStroke(n,i):!1}var vB={type:"rule",tag:"line",nested:!1,attr:pB,bound:mB,draw:yB,pick:Ih(bB),isect:xO},xB=qb("shape",k7),EB=qb("symbol",C7,Pb);const Jw=dF();var vn={height:Hi,measureWidth:Xb,estimateWidth:Ed,width:Ed,canvas:FO};FO(!0);function FO(e){vn.width=e&&io?Xb:Ed}function Ed(e,t){return _O(uo(e,t),Hi(e))}function _O(e,t){return~~(.8*e.length*t)}function Xb(e,t){return Hi(e)<=0||!(t=uo(e,t))?0:OO(t,Bh(e))}function OO(e,t){const n=`(${t}) ${e}`;let i=Jw.get(n);return i===void 0&&(io.font=t,i=io.measureText(e).width,Jw.set(n,i)),i}function Hi(e){return e.fontSize!=null?+e.fontSize||0:11}function ao(e){return e.lineHeight!=null?e.lineHeight:Hi(e)+2}function wB(e){return T(e)?e.length>1?e:e[0]:e}function rc(e){return wB(e.lineBreak&&e.text&&!T(e.text)?e.text.split(e.lineBreak):e.text)}function Yb(e){const t=rc(e);return(T(t)?t.length-1:0)*ao(e)}function uo(e,t){const n=t==null?"":(t+"").trim();return e.limit>0&&n.length?$B(e,n):n}function SB(e){if(vn.width===Xb){const t=Bh(e);return n=>OO(n,t)}else if(vn.width===Ed){const t=Hi(e);return n=>_O(n,t)}else return t=>vn.width(e,t)}function $B(e,t){var n=+e.limit,i=SB(e);if(i(t)<n)return t;var r=e.ellipsis||"…",o=e.dir==="rtl",s=0,a=t.length,u;if(n-=i(r),o){for(;s<a;)u=s+a>>>1,i(t.slice(u))>n?s=u+1:a=u;return r+t.slice(s)}else{for(;s<a;)u=1+(s+a>>>1),i(t.slice(0,u))<n?s=u:a=u-1;return t.slice(0,s)+r}}function oc(e,t){var n=e.font;return(t&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function Bh(e,t){return(e.fontStyle?e.fontStyle+" ":"")+(e.fontVariant?e.fontVariant+" ":"")+(e.fontWeight?e.fontWeight+" ":"")+Hi(e)+"px "+oc(e,t)}function Kb(e){var t=e.baseline,n=Hi(e);return Math.round(t==="top"?.79*n:t==="middle"?.3*n:t==="bottom"?-.21*n:t==="line-top"?.29*n+.5*ao(e):t==="line-bottom"?.29*n-.5*ao(e):0)}const AB={left:"start",center:"middle",right:"end"},ol=new Ze;function Uh(e){var t=e.x||0,n=e.y||0,i=e.radius||0,r;return i&&(r=(e.theta||0)-Bo,t+=i*Math.cos(r),n+=i*Math.sin(r)),ol.x1=t,ol.y1=n,ol}function kB(e,t){var n=t.dx||0,i=(t.dy||0)+Kb(t),r=Uh(t),o=r.x1,s=r.y1,a=t.angle||0,u;e("text-anchor",AB[t.align]||"start"),a?(u=Vo(o,s)+" "+jb(a),(n||i)&&(u+=" "+Vo(n,i))):u=Vo(o+n,s+i),e("transform",u)}function Jb(e,t,n){var i=vn.height(t),r=t.align,o=Uh(t),s=o.x1,a=o.y1,u=t.dx||0,l=(t.dy||0)+Kb(t)-Math.round(.8*i),c=rc(t),f;if(T(c)?(i+=ao(t)*(c.length-1),f=c.reduce((d,h)=>Math.max(d,vn.width(t,h)),0)):f=vn.width(t,c),r==="center"?u-=f/2:r==="right"&&(u-=f),e.set(u+=s,l+=a,u+f,l+i),t.angle&&!n)e.rotate(t.angle*so,s,a);else if(n===2)return e.rotatedPoints(t.angle*so,s,a);return e}function CB(e,t,n){ui(t,i=>{var r=i.opacity==null?1:i.opacity,o,s,a,u,l,c,f;if(!(n&&!n.intersects(i.bounds)||r===0||i.fontSize<=0||i.text==null||i.text.length===0)){if(e.font=Bh(i),e.textAlign=i.align||"left",o=Uh(i),s=o.x1,a=o.y1,i.angle&&(e.save(),e.translate(s,a),e.rotate(i.angle*so),s=a=0),s+=i.dx||0,a+=(i.dy||0)+Kb(i),c=rc(i),xa(e,i),T(c))for(l=ao(i),u=0;u<c.length;++u)f=uo(i,c[u]),i.fill&&vd(e,i,r)&&e.fillText(f,s,a),i.stroke&&Ea(e,i,r)&&e.strokeText(f,s,a),a+=l;else f=uo(i,c),i.fill&&vd(e,i,r)&&e.fillText(f,s,a),i.stroke&&Ea(e,i,r)&&e.strokeText(f,s,a);i.angle&&e.restore()}})}function FB(e,t,n,i,r,o){if(t.fontSize<=0)return!1;if(!t.angle)return!0;var s=Uh(t),a=s.x1,u=s.y1,l=Jb(ol,t,1),c=-t.angle*so,f=Math.cos(c),d=Math.sin(c),h=f*r-d*o+(a-f*a+d*u),g=d*r+f*o+(u-d*a-f*u);return l.contains(h,g)}function _B(e,t){const n=Jb(ol,e,2);return Zs(t,n[0],n[1],n[2],n[3])||Zs(t,n[0],n[1],n[4],n[5])||Zs(t,n[4],n[5],n[6],n[7])||Zs(t,n[2],n[3],n[6],n[7])}var OB={type:"text",tag:"text",nested:!1,attr:kB,bound:Jb,draw:CB,pick:Ih(FB),isect:_B},RB=Wb("trail",F7,q7),An={arc:B7,area:W7,group:iB,image:aB,line:uB,path:fB,rect:gB,rule:vB,shape:xB,symbol:EB,text:OB,trail:RB};function w0(e,t,n){var i=An[e.mark.marktype],r=t||i.bound;return i.nested&&(e=e.mark),r(e.bounds||(e.bounds=new Ze),e,n)}var Qw={mark:null};function RO(e,t,n){var i=An[e.marktype],r=i.bound,o=e.items,s=o&&o.length,a,u,l,c;if(i.nested)return s?l=o[0]:(Qw.mark=e,l=Qw),c=w0(l,r,n),t=t&&t.union(c)||c,t;if(t=t||e.bounds&&e.bounds.clear()||new Ze,s)for(a=0,u=o.length;a<u;++a)t.union(w0(o[a],r,n));return e.bounds=t}const MB=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","blend","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","strokeForeground","strokeOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","interpolate","tension","orient","defined","url","aspect","smooth","path","scaleX","scaleY","x2","y2","size","shape","text","angle","theta","radius","dir","dx","dy","ellipsis","limit","lineBreak","lineHeight","font","fontSize","fontWeight","fontStyle","fontVariant","description","aria","ariaRole","ariaRoleDescription"];function MO(e,t){return JSON.stringify(e,MB,t)}function DO(e){const t=typeof e=="string"?JSON.parse(e):e;return TO(t)}function TO(e){var t=e.marktype,n=e.items,i,r,o;if(n)for(r=0,o=n.length;r<o;++r)i=t?"mark":"group",n[r][i]=e,n[r].zindex&&(n[r][i].zdirty=!0),(t||i)==="group"&&TO(n[r]);return t&&RO(e),e}class NO{constructor(t){arguments.length?this.root=DO(t):(this.root=Zw({marktype:"group",name:"root",role:"frame"}),this.root.items=[new Nh(this.root)])}toJSON(t){return MO(this.root,t||0)}mark(t,n,i){n=n||this.root.items[0];const r=Zw(t,n);return n.items[i]=r,r.zindex&&(r.group.zdirty=!0),r}}function Zw(e,t){const n={bounds:new Ze,clip:!!e.clip,group:t,interactive:e.interactive!==!1,items:[],marktype:e.marktype,name:e.name||void 0,role:e.role||void 0,zindex:e.zindex||0};return e.aria!=null&&(n.aria=e.aria),e.description&&(n.description=e.description),n}function Vr(e,t,n){return!e&&typeof document<"u"&&document.createElement&&(e=document),e?n?e.createElementNS(n,t):e.createElement(t):null}function Qb(e,t){t=t.toLowerCase();for(var n=e.childNodes,i=0,r=n.length;i<r;++i)if(n[i].tagName.toLowerCase()===t)return n[i]}function tt(e,t,n,i){var r=e.childNodes[t],o;return(!r||r.tagName.toLowerCase()!==n.toLowerCase())&&(o=r||null,r=Vr(e.ownerDocument,n,i),e.insertBefore(r,o)),r}function _n(e,t){for(var n=e.childNodes,i=n.length;i>t;)e.removeChild(n[--i]);return e}function LO(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function jh(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function DB(e,t,n,i){var r=e&&e.mark,o,s;if(r&&(o=An[r.marktype]).tip){for(s=jh(t,n),s[0]-=i[0],s[1]-=i[1];e=e.mark.group;)s[0]-=e.x||0,s[1]-=e.y||0;e=o.tip(r.items,s)}return e}let Zb=class{constructor(t,n){this._active=null,this._handlers={},this._loader=t||yh(),this._tooltip=n||TB}initialize(t,n,i){return this._el=t,this._obj=i||null,this.origin(n)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()}scene(t){return arguments.length?(this._scene=t,this):this._scene}on(){}off(){}_handlerIndex(t,n,i){for(let r=t?t.length:0;--r>=0;)if(t[r].type===n&&(!i||t[r].handler===i))return r;return-1}handlers(t){const n=this._handlers,i=[];if(t)i.push(...n[this.eventName(t)]);else for(const r in n)i.push(...n[r]);return i}eventName(t){const n=t.indexOf(".");return n<0?t:t.slice(0,n)}handleHref(t,n,i){this._loader.sanitize(i,{context:"href"}).then(r=>{const o=new MouseEvent(t.type,t),s=Vr(null,"a");for(const a in r)s.setAttribute(a,r[a]);s.dispatchEvent(o)}).catch(()=>{})}handleTooltip(t,n,i){if(n&&n.tooltip!=null){n=DB(n,t,this.canvas(),this._origin);const r=i&&n&&n.tooltip||null;this._tooltip.call(this._obj,this,t,n,r)}}getItemBoundingClientRect(t){const n=this.canvas();if(!n)return;const i=n.getBoundingClientRect(),r=this._origin,o=t.bounds,s=o.width(),a=o.height();let u=o.x1+r[0]+i.left,l=o.y1+r[1]+i.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,l+=t.y||0;return{x:u,y:l,width:s,height:a,left:u,top:l,right:u+s,bottom:l+a}}};function TB(e,t,n,i){e.element().setAttribute("title",i||"")}class sc{constructor(t){this._el=null,this._bgcolor=null,this._loader=new bO(t)}initialize(t,n,i,r,o){return this._el=t,this.resize(n,i,r,o)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(t){return arguments.length===0?this._bgcolor:(this._bgcolor=t,this)}resize(t,n,i,r){return this._width=t,this._height=n,this._origin=i||[0,0],this._scale=r||1,this}dirty(){}render(t,n){const i=this;return i._call=function(){i._render(t,n)},i._call(),i._call=null,i}_render(){}renderAsync(t,n){const i=this.render(t,n);return this._ready?this._ready.then(()=>i):Promise.resolve(i)}_load(t,n){var i=this,r=i._loader[t](n);if(!i._ready){const o=i._call;i._ready=i._loader.ready().then(s=>{s&&o(),i._ready=null})}return r}sanitizeURL(t){return this._load("sanitizeURL",t)}loadImage(t){return this._load("loadImage",t)}}const NB="keydown",LB="keypress",IB="keyup",IO="dragenter",kf="dragleave",PO="dragover",S0="pointerdown",PB="pointerup",wd="pointermove",Cf="pointerout",zO="pointerover",$0="mousedown",zB="mouseup",BO="mousemove",Sd="mouseout",UO="mouseover",$d="click",BB="dblclick",UB="wheel",jO="mousewheel",Ad="touchstart",kd="touchmove",Cd="touchend",jB=[NB,LB,IB,IO,kf,PO,S0,PB,wd,Cf,zO,$0,zB,BO,Sd,UO,$d,BB,UB,jO,Ad,kd,Cd],A0=wd,sl=Sd,k0=$d;class ac extends Zb{constructor(t,n){super(t,n),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=jB,this.pointermove=tS([wd,BO],[zO,UO],[Cf,Sd]),this.dragover=tS([PO],[IO],[kf]),this.pointerout=nS([Cf,Sd]),this.dragleave=nS([kf])}initialize(t,n,i){return this._canvas=t&&Qb(t,"canvas"),[$d,$0,S0,wd,Cf,kf].forEach(r=>eS(this,r)),super.initialize(t,n,i)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(t){this.fire(jO,t)}pointerdown(t){this._down=this._active,this.fire(S0,t)}mousedown(t){this._down=this._active,this.fire($0,t)}click(t){this._down===this._active&&(this.fire($d,t),this._down=null)}touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(Ad,t,!0)}touchmove(t){this.fire(kd,t,!0)}touchend(t){this.fire(Cd,t,!0),this._touch=null}fire(t,n,i){const r=i?this._touch:this._active,o=this._handlers[t];if(n.vegaType=t,t===k0&&r&&r.href?this.handleHref(n,r,r.href):(t===A0||t===sl)&&this.handleTooltip(n,r,t!==sl),o)for(let s=0,a=o.length;s<a;++s)o[s].handler.call(this._obj,n,r)}on(t,n){const i=this.eventName(t),r=this._handlers;return this._handlerIndex(r[i],t,n)<0&&(eS(this,t),(r[i]||(r[i]=[])).push({type:t,handler:n})),this}off(t,n){const i=this.eventName(t),r=this._handlers[i],o=this._handlerIndex(r,t,n);return o>=0&&r.splice(o,1),this}pickEvent(t){const n=jh(t,this._canvas),i=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-i[0],n[1]-i[1])}pick(t,n,i,r,o){const s=this.context();return An[t.marktype].pick.call(this,s,t,n,i,r,o)}}const qB=e=>e===Ad||e===kd||e===Cd?[Ad,kd,Cd]:[e];function eS(e,t){qB(t).forEach(n=>WB(e,n))}function WB(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?i=>e[t](i):i=>e.fire(t,i)))}function Vu(e,t,n){t.forEach(i=>e.fire(i,n))}function tS(e,t,n){return function(i){const r=this._active,o=this.pickEvent(i);o===r?Vu(this,e,i):((!r||!r.exit)&&Vu(this,n,i),this._active=o,Vu(this,t,i),Vu(this,e,i))}}function nS(e){return function(t){Vu(this,e,t),this._active=null}}function GB(){return typeof window<"u"&&window.devicePixelRatio||1}function HB(e,t,n,i,r,o){const s=typeof HTMLElement<"u"&&e instanceof HTMLElement&&e.parentNode!=null,a=e.getContext("2d"),u=s?GB():r;e.width=t*u,e.height=n*u;for(const l in o)a[l]=o[l];return s&&u!==1&&(e.style.width=t+"px",e.style.height=n+"px"),a.pixelRatio=u,a.setTransform(u,0,0,u,u*i[0],u*i[1]),e}class Fd extends sc{constructor(t){super(t),this._options={},this._redraw=!1,this._dirty=new Ze,this._tempb=new Ze}initialize(t,n,i,r,o,s){return this._options=s||{},this._canvas=this._options.externalContext?null:no(1,1,this._options.type),t&&this._canvas&&(_n(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(t,n,i,r,o)}resize(t,n,i,r){if(super.resize(t,n,i,r),this._canvas)HB(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const o=this._options.externalContext;o||M("CanvasRenderer is missing a valid canvas or context"),o.scale(this._scale,this._scale),o.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(t){const n=this._tempb.clear().union(t.bounds);let i=t.mark.group;for(;i;)n.translate(i.x||0,i.y||0),i=i.mark.group;this._dirty.union(n)}_render(t,n){const i=this.context(),r=this._origin,o=this._width,s=this._height,a=this._dirty,u=VB(r,o,s);i.save();const l=this._redraw||a.empty()?(this._redraw=!1,u.expand(1)):XB(i,u.intersect(a),r);return this.clear(-r[0],-r[1],o,s),this.draw(i,t,l,n),i.restore(),a.clear(),this}draw(t,n,i,r){if(n.marktype!=="group"&&r!=null&&!r.includes(n.marktype))return;const o=An[n.marktype];n.clip&&G7(t,n),o.draw.call(this,t,n,i,r),n.clip&&t.restore()}clear(t,n,i,r){const o=this._options,s=this.context();o.type!=="pdf"&&!o.externalContext&&s.clearRect(t,n,i,r),this._bgcolor!=null&&(s.fillStyle=this._bgcolor,s.fillRect(t,n,i,r))}}const VB=(e,t,n)=>new Ze().set(0,0,t,n).translate(-e[0],-e[1]);function XB(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-(n[0]%1),-(n[1]%1)),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}class qO extends Zb{constructor(t,n){super(t,n);const i=this;i._hrefHandler=$p(i,(r,o)=>{o&&o.href&&i.handleHref(r,o,o.href)}),i._tooltipHandler=$p(i,(r,o)=>{i.handleTooltip(r,o,r.type!==sl)})}initialize(t,n,i){let r=this._svg;return r&&(r.removeEventListener(k0,this._hrefHandler),r.removeEventListener(A0,this._tooltipHandler),r.removeEventListener(sl,this._tooltipHandler)),this._svg=r=t&&Qb(t,"svg"),r&&(r.addEventListener(k0,this._hrefHandler),r.addEventListener(A0,this._tooltipHandler),r.addEventListener(sl,this._tooltipHandler)),super.initialize(t,n,i)}canvas(){return this._svg}on(t,n){const i=this.eventName(t),r=this._handlers;if(this._handlerIndex(r[i],t,n)<0){const s={type:t,handler:n,listener:$p(this,n)};(r[i]||(r[i]=[])).push(s),this._svg&&this._svg.addEventListener(i,s.listener)}return this}off(t,n){const i=this.eventName(t),r=this._handlers[i],o=this._handlerIndex(r,t,n);return o>=0&&(this._svg&&this._svg.removeEventListener(i,r[o].listener),r.splice(o,1)),this}}const $p=(e,t)=>n=>{let i=n.target.__data__;i=Array.isArray(i)?i[0]:i,n.vegaType=n.type,t.call(e._obj,n,i)},WO="aria-hidden",ev="aria-label",tv="role",nv="aria-roledescription",GO="graphics-object",iv="graphics-symbol",HO=(e,t,n)=>({[tv]:e,[nv]:t,[ev]:n||void 0}),YB=si(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),iS={axis:{desc:"axis",caption:QB},legend:{desc:"legend",caption:ZB},"title-text":{desc:"title",caption:e=>`Title text '${oS(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${oS(e)}'`}},rS={ariaRole:tv,ariaRoleDescription:nv,description:ev};function VO(e,t){const n=t.aria===!1;if(e(WO,n||void 0),n||t.description==null)for(const i in rS)e(rS[i],void 0);else{const i=t.mark.marktype;e(ev,t.description),e(tv,t.ariaRole||(i==="group"?GO:iv)),e(nv,t.ariaRoleDescription||`${i} mark`)}}function XO(e){return e.aria===!1?{[WO]:!0}:YB[e.role]?null:iS[e.role]?JB(e,iS[e.role]):KB(e)}function KB(e){const t=e.marktype,n=t==="group"||t==="text"||e.items.some(i=>i.description!=null&&i.aria!==!1);return HO(n?GO:iv,`${t} mark container`,e.description)}function JB(e,t){try{const n=e.items[0],i=t.caption||(()=>"");return HO(t.role||iv,t.desc,n.description||i(n))}catch{return null}}function oS(e){return K(e.text).join(" ")}function QB(e){const t=e.datum,n=e.orient,i=t.title?YO(e):null,r=e.context,o=r.scales[t.scale].value,s=r.dataflow.locale(),a=o.type;return`${n==="left"||n==="right"?"Y":"X"}-axis`+(i?` titled '${i}'`:"")+` for a ${ba(a)?"discrete":a} scale with ${lO(s,o,e)}`}function ZB(e){const t=e.datum,n=t.title?YO(e):null,i=`${t.type||""} legend`.trim(),r=t.scales,o=Object.keys(r),s=e.context,a=s.scales[r[o[0]]].value,u=s.dataflow.locale();return tU(i)+(n?` titled '${n}'`:"")+` for ${eU(o)} with ${lO(u,a,e)}`}function YO(e){try{return K(be(e.items).items[0].text).join(" ")}catch{return null}}function eU(e){return e=e.map(t=>t+(t==="fill"||t==="stroke"?" color":"")),e.length<2?e[0]:e.slice(0,-1).join(", ")+" and "+be(e)}function tU(e){return e.length?e[0].toUpperCase()+e.slice(1):e}const KO=e=>(e+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),nU=e=>KO(e).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;");function rv(){let e="",t="",n="";const i=[],r=()=>t=n="",o=u=>{t&&(e+=`${t}>${n}`,r()),i.push(u)},s=(u,l)=>(l!=null&&(t+=` ${u}="${nU(l)}"`),a),a={open(u,...l){o(u),t="<"+u;for(const c of l)for(const f in c)s(f,c[f]);return a},close(){const u=i.pop();return t?e+=t+(n?`>${n}</${u}>`:"/>"):e+=`</${u}>`,r(),a},attr:s,text:u=>(n+=KO(u),a),toString:()=>e};return a}const JO=e=>QO(rv(),e)+"";function QO(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,i=n.length;for(let r=0;r<i;++r)e.attr(n[r].name,n[r].value)}if(t.hasChildNodes()){const n=t.childNodes;for(const i of n)i.nodeType===3?e.text(i.nodeValue):QO(e,i)}return e.close()}const _d={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},Od={blend:"mix-blend-mode"},ZO={fill:"none","stroke-miterlimit":10},vu=0,sS="http://www.w3.org/2000/xmlns/",et=$l.xmlns;class ov extends sc{constructor(t){super(t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(t,n,i,r,o){return this._defs={},this._clearDefs(),t&&(this._svg=tt(t,0,"svg",et),this._svg.setAttributeNS(sS,"xmlns",et),this._svg.setAttributeNS(sS,"xmlns:xlink",$l["xmlns:xlink"]),this._svg.setAttribute("version",$l.version),this._svg.setAttribute("class","marks"),_n(t,1),this._root=tt(this._svg,vu,"g",et),Xr(this._root,ZO),_n(this._svg,vu+1)),this.background(this._bgcolor),super.initialize(t,n,i,r,o)}background(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),super.background(...arguments)}resize(t,n,i,r){return super.resize(t,n,i,r),this._svg&&(Xr(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this}canvas(){return this._svg}svg(){const t=this._svg,n=this._bgcolor;if(!t)return null;let i;n&&(t.removeAttribute("style"),i=tt(t,vu,"rect",et),Xr(i,{width:this._width,height:this._height,fill:n}));const r=JO(t);return n&&(t.removeChild(i),this._svg.style.setProperty("background-color",n)),r}_render(t,n){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,t,void 0,n),_n(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this}dirty(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))}isDirty(t){return this._dirtyAll||!t._svg||!t._svg.ownerSVGElement||t.dirty===this._dirtyID}_dirtyCheck(){this._dirtyAll=!0;const t=this._dirty;if(!t.length||!this._dirtyID)return!0;const n=++this._dirtyID;let i,r,o,s,a,u,l;for(a=0,u=t.length;a<u;++a)if(i=t[a],r=i.mark,r.marktype!==o&&(o=r.marktype,s=An[o]),r.zdirty&&r.dirty!==n&&(this._dirtyAll=!1,aS(i,n),r.items.forEach(c=>{c.dirty=n})),!r.zdirty){if(i.exit){s.nested&&r.items.length?(l=r.items[0],l._svg&&this._update(s,l._svg,l)):i._svg&&(l=i._svg.parentNode,l&&l.removeChild(i._svg)),i._svg=null;continue}i=s.nested?r.items[0]:i,i._update!==n&&(!i._svg||!i._svg.ownerSVGElement?(this._dirtyAll=!1,aS(i,n)):this._update(s,i._svg,i),i._update=n)}return!this._dirtyAll}mark(t,n,i,r){if(!this.isDirty(n))return n._svg;const o=this._svg,s=n.marktype,a=An[s],u=n.interactive===!1?"none":null,l=a.tag==="g",c=uS(n,t,i,"g",o);if(s!=="group"&&r!=null&&!r.includes(s))return _n(c,0),n._svg;c.setAttribute("class",LO(n));const f=XO(n);for(const p in f)Tt(c,p,f[p]);l||Tt(c,"pointer-events",u),Tt(c,"clip-path",n.clip?Lb(this,n,n.group):null);let d=null,h=0;const g=p=>{const m=this.isDirty(p),y=uS(p,c,d,a.tag,o);m&&(this._update(a,y,p),l&&oU(this,y,p,r)),d=y,++h};return a.nested?n.items.length&&g(n.items[0]):ui(n,g),_n(c,h),c}_update(t,n,i){lr=n,$t=n.__values__,VO(al,i),t.attr(al,i,this);const r=aU[t.type];r&&r.call(this,t,n,i),lr&&this.style(lr,i)}style(t,n){if(n!=null){for(const i in _d){let r=i==="font"?oc(n):n[i];if(r===$t[i])continue;const o=_d[i];r==null?t.removeAttribute(o):(Db(r)&&(r=fO(r,this._defs.gradient,eR())),t.setAttribute(o,r+"")),$t[i]=r}for(const i in Od)Ff(t,Od[i],n[i])}}defs(){const t=this._svg,n=this._defs;let i=n.el,r=0;for(const o in n.gradient)i||(n.el=i=tt(t,vu+1,"defs",et)),r=iU(i,n.gradient[o],r);for(const o in n.clipping)i||(n.el=i=tt(t,vu+1,"defs",et)),r=rU(i,n.clipping[o],r);i&&(r===0?(t.removeChild(i),n.el=null):_n(i,r))}_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}}function aS(e,t){for(;e&&e.dirty!==t;e=e.mark.group)if(e.dirty=t,e.mark&&e.mark.dirty!==t)e.mark.dirty=t;else return}function iU(e,t,n){let i,r,o;if(t.gradient==="radial"){let s=tt(e,n++,"pattern",et);Xr(s,{id:bd+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),s=tt(s,0,"rect",et),Xr(s,{width:1,height:1,fill:`url(${eR()}#${t.id})`}),e=tt(e,n++,"radialGradient",et),Xr(e,{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else e=tt(e,n++,"linearGradient",et),Xr(e,{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(i=0,r=t.stops.length;i<r;++i)o=tt(e,i,"stop",et),o.setAttribute("offset",t.stops[i].offset),o.setAttribute("stop-color",t.stops[i].color);return _n(e,i),n}function rU(e,t,n){let i;return e=tt(e,n,"clipPath",et),e.setAttribute("id",t.id),t.path?(i=tt(e,0,"path",et),i.setAttribute("d",t.path)):(i=tt(e,0,"rect",et),Xr(i,{x:0,y:0,width:t.width,height:t.height})),_n(e,1),n+1}function oU(e,t,n,i){t=t.lastChild.previousSibling;let r,o=0;ui(n,s=>{r=e.mark(t,s,r,i),++o}),_n(t,1+o)}function uS(e,t,n,i,r){let o=e._svg,s;if(!o&&(s=t.ownerDocument,o=Vr(s,i,et),e._svg=o,e.mark&&(o.__data__=e,o.__values__={fill:"default"},i==="g"))){const a=Vr(s,"path",et);o.appendChild(a),a.__data__=e;const u=Vr(s,"g",et);o.appendChild(u),u.__data__=e;const l=Vr(s,"path",et);o.appendChild(l),l.__data__=e,l.__values__={fill:"default"}}return(o.ownerSVGElement!==r||sU(o,n))&&t.insertBefore(o,n?n.nextSibling:t.firstChild),o}function sU(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}let lr=null,$t=null;const aU={group(e,t,n){const i=lr=t.childNodes[2];$t=i.__values__,e.foreground(al,n,this),$t=t.__values__,lr=t.childNodes[1],e.content(al,n,this);const r=lr=t.childNodes[0];e.background(al,n,this);const o=n.mark.interactive===!1?"none":null;if(o!==$t.events&&(Tt(i,"pointer-events",o),Tt(r,"pointer-events",o),$t.events=o),n.strokeForeground&&n.stroke){const s=n.fill;Tt(i,"display",null),this.style(r,n),Tt(r,"stroke",null),s&&(n.fill=null),$t=i.__values__,this.style(i,n),s&&(n.fill=s),lr=null}else Tt(i,"display","none")},image(e,t,n){n.smooth===!1?(Ff(t,"image-rendering","optimizeSpeed"),Ff(t,"image-rendering","pixelated")):Ff(t,"image-rendering",null)},text(e,t,n){const i=rc(n);let r,o,s,a;T(i)?(o=i.map(u=>uo(n,u)),r=o.join(`
9
- `),r!==$t.text&&(_n(t,0),s=t.ownerDocument,a=ao(n),o.forEach((u,l)=>{const c=Vr(s,"tspan",et);c.__data__=n,c.textContent=u,l&&(c.setAttribute("x",0),c.setAttribute("dy",a)),t.appendChild(c)}),$t.text=r)):(o=uo(n,i),o!==$t.text&&(t.textContent=o,$t.text=o)),Tt(t,"font-family",oc(n)),Tt(t,"font-size",Hi(n)+"px"),Tt(t,"font-style",n.fontStyle),Tt(t,"font-variant",n.fontVariant),Tt(t,"font-weight",n.fontWeight)}};function al(e,t,n){t!==$t[e]&&(n?uU(lr,e,t,n):Tt(lr,e,t),$t[e]=t)}function Ff(e,t,n){n!==$t[t]&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n+""),$t[t]=n)}function Xr(e,t){for(const n in t)Tt(e,n,t[n])}function Tt(e,t,n){n!=null?e.setAttribute(t,n):e.removeAttribute(t)}function uU(e,t,n,i){n!=null?e.setAttributeNS(i,t,n):e.removeAttributeNS(i,t)}function eR(){let e;return typeof window>"u"?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}class tR extends sc{constructor(t){super(t),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(t){const n=rv();n.open("svg",fe({},$l,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const i=this._bgcolor;return i&&i!=="transparent"&&i!=="none"&&n.open("rect",{width:this._width,height:this._height,fill:i}).close(),n.open("g",ZO,{transform:"translate("+this._origin+")"}),this.mark(n,t),n.close(),this.defs(n),this._text=n.close()+"",this}mark(t,n){const i=An[n.marktype],r=i.tag,o=[VO,i.attr];t.open("g",{class:LO(n),"clip-path":n.clip?Lb(this,n,n.group):null},XO(n),{"pointer-events":r!=="g"&&n.interactive===!1?"none":null});const s=a=>{const u=this.href(a);if(u&&t.open("a",u),t.open(r,this.attr(n,a,o,r!=="g"?r:null)),r==="text"){const l=rc(a);if(T(l)){const c={x:0,dy:ao(a)};for(let f=0;f<l.length;++f)t.open("tspan",f?c:null).text(uo(a,l[f])).close()}else t.text(uo(a,l))}else if(r==="g"){const l=a.strokeForeground,c=a.fill,f=a.stroke;l&&f&&(a.stroke=null),t.open("path",this.attr(n,a,i.background,"bgrect")).close(),t.open("g",this.attr(n,a,i.content)),ui(a,d=>this.mark(t,d)),t.close(),l&&f?(c&&(a.fill=null),a.stroke=f,t.open("path",this.attr(n,a,i.foreground,"bgrect")).close(),c&&(a.fill=c)):t.open("path",this.attr(n,a,i.foreground,"bgfore")).close()}t.close(),u&&t.close()};return i.nested?n.items&&n.items.length&&s(n.items[0]):ui(n,s),t.close()}href(t){const n=t.href;let i;if(n){if(i=this._hrefs&&this._hrefs[n])return i;this.sanitizeURL(n).then(r=>{r["xlink:href"]=r.href,r.href=null,(this._hrefs||(this._hrefs={}))[n]=r})}return null}attr(t,n,i,r){const o={},s=(a,u,l,c)=>{o[c||a]=u};return Array.isArray(i)?i.forEach(a=>a(s,n,this)):i(s,n,this),r&&lU(o,n,t,r,this._defs),o}defs(t){const n=this._defs.gradient,i=this._defs.clipping;if(Object.keys(n).length+Object.keys(i).length!==0){t.open("defs");for(const o in n){const s=n[o],a=s.stops;s.gradient==="radial"?(t.open("pattern",{id:bd+o,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+o+")"}).close(),t.close(),t.open("radialGradient",{id:o,fx:s.x1,fy:s.y1,fr:s.r1,cx:s.x2,cy:s.y2,r:s.r2})):t.open("linearGradient",{id:o,x1:s.x1,x2:s.x2,y1:s.y1,y2:s.y2});for(let u=0;u<a.length;++u)t.open("stop",{offset:a[u].offset,"stop-color":a[u].color}).close();t.close()}for(const o in i){const s=i[o];t.open("clipPath",{id:o}),s.path?t.open("path",{d:s.path}).close():t.open("rect",{x:0,y:0,width:s.width,height:s.height}).close(),t.close()}t.close()}}}function lU(e,t,n,i,r){let o;if(t==null||(i==="bgrect"&&n.interactive===!1&&(e["pointer-events"]="none"),i==="bgfore"&&(n.interactive===!1&&(e["pointer-events"]="none"),e.display="none",t.fill!==null)))return e;i==="image"&&t.smooth===!1&&(o=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),i==="text"&&(e["font-family"]=oc(t),e["font-size"]=Hi(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const s in _d){let a=t[s];const u=_d[s];a==="transparent"&&(u==="fill"||u==="stroke")||a!=null&&(Db(a)&&(a=fO(a,r.gradient,"")),e[u]=a)}for(const s in Od){const a=t[s];a!=null&&(o=o||[],o.push(`${Od[s]}: ${a};`))}return o&&(e.style=o.join(" ")),e}const Yn={svgMarkTypes:["text"],svgOnTop:!0,debug:!1};function cU(e){Yn.svgMarkTypes=e.svgMarkTypes??["text"],Yn.svgOnTop=e.svgOnTop??!0,Yn.debug=e.debug??!1}class C0 extends sc{constructor(t){super(t),this._svgRenderer=new ov(t),this._canvasRenderer=new Fd(t)}initialize(t,n,i,r,o){this._root_el=tt(t,0,"div");const s=tt(this._root_el,0,"div"),a=tt(this._root_el,1,"div");return this._root_el.style.position="relative",Yn.debug||(s.style.height="100%",a.style.position="absolute",a.style.top="0",a.style.left="0",a.style.height="100%",a.style.width="100%"),this._svgEl=Yn.svgOnTop?a:s,this._canvasEl=Yn.svgOnTop?s:a,this._svgEl.style.pointerEvents="none",this._canvasRenderer.initialize(this._canvasEl,n,i,r,o),this._svgRenderer.initialize(this._svgEl,n,i,r,o),super.initialize(t,n,i,r,o)}dirty(t){return Yn.svgMarkTypes.includes(t.mark.marktype)?this._svgRenderer.dirty(t):this._canvasRenderer.dirty(t),this}_render(t,n){const r=(n??["arc","area","image","line","path","rect","rule","shape","symbol","text","trail"]).filter(o=>!Yn.svgMarkTypes.includes(o));this._svgRenderer.render(t,Yn.svgMarkTypes),this._canvasRenderer.render(t,r)}resize(t,n,i,r){return super.resize(t,n,i,r),this._svgRenderer.resize(t,n,i,r),this._canvasRenderer.resize(t,n,i,r),this}background(t){return Yn.svgOnTop?this._canvasRenderer.background(t):this._svgRenderer.background(t),this}}class nR extends ac{constructor(t,n){super(t,n)}initialize(t,n,i){const r=tt(tt(t,0,"div"),Yn.svgOnTop?0:1,"div");return super.initialize(r,n,i)}}const iR="canvas",rR="hybrid",oR="png",sR="svg",aR="none",Yr={Canvas:iR,PNG:oR,SVG:sR,Hybrid:rR,None:aR},rs={};rs[iR]=rs[oR]={renderer:Fd,headless:Fd,handler:ac};rs[sR]={renderer:ov,headless:tR,handler:qO};rs[rR]={renderer:C0,headless:C0,handler:nR};rs[aR]={};function qh(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(rs[e]=t,this):rs[e]}function uR(e,t,n){const i=[],r=new Ze().union(t),o=e.marktype;return o?lR(e,r,n,i):o==="group"?cR(e,r,n,i):M("Intersect scene must be mark node or group item.")}function lR(e,t,n,i){if(fU(e,t,n)){const r=e.items,o=e.marktype,s=r.length;let a=0;if(o==="group")for(;a<s;++a)cR(r[a],t,n,i);else for(const u=An[o].isect;a<s;++a){const l=r[a];fR(l,t,u)&&i.push(l)}}return i}function fU(e,t,n){return e.bounds&&t.intersects(e.bounds)&&(e.marktype==="group"||e.interactive!==!1&&(!n||n(e)))}function cR(e,t,n,i){n&&n(e.mark)&&fR(e,t,An.group.isect)&&i.push(e);const r=e.items,o=r&&r.length;if(o){const s=e.x||0,a=e.y||0;t.translate(-s,-a);for(let u=0;u<o;++u)lR(r[u],t,n,i);t.translate(s,a)}return i}function fR(e,t,n){const i=e.bounds;return t.encloses(i)||t.intersects(i)&&n(e,t)}const Ap=new Ze;function dR(e){const t=e.clip;if(ce(t))t(nc(Ap.clear()));else if(t)Ap.set(0,0,e.group.width,e.group.height);else return;e.bounds.intersect(Ap)}const dU=1e-9;function sv(e,t,n){return e===t?!0:n==="path"?hR(e,t):e instanceof Date&&t instanceof Date?+e==+t:Ee(e)&&Ee(t)?Math.abs(e-t)<=dU:!e||!t||!X(e)&&!X(t)?e==t:hU(e,t)}function hR(e,t){return sv(va(e),va(t))}function hU(e,t){var n=Object.keys(e),i=Object.keys(t),r,o;if(n.length!==i.length)return!1;for(n.sort(),i.sort(),o=n.length-1;o>=0;o--)if(n[o]!=i[o])return!1;for(o=n.length-1;o>=0;o--)if(r=n[o],!sv(e[r],t[r],r))return!1;return typeof e==typeof t}function gU(){_7(),I8()}const wa="top",Zn="left",ti="right",lo="bottom",pU="top-left",mU="top-right",yU="bottom-left",bU="bottom-right",av="start",F0="middle",Nt="end",vU="x",xU="y",Wh="group",uv="axis",lv="title",EU="frame",wU="scope",cv="legend",gR="row-header",pR="row-footer",mR="row-title",yR="column-header",bR="column-footer",vR="column-title",SU="padding",$U="symbol",xR="fit",ER="fit-x",wR="fit-y",AU="pad",fv="none",Gc="all",_0="each",dv="flush",Kr="column",Jr="row";function SR(e){R.call(this,null,e)}H(SR,R,{transform(e,t){const n=t.dataflow,i=e.mark,r=i.marktype,o=An[r],s=o.bound;let a=i.bounds,u;if(o.nested)i.items.length&&n.dirty(i.items[0]),a=Hc(i,s),i.items.forEach(l=>{l.bounds.clear().union(a)});else if(r===Wh||e.modified())switch(t.visit(t.MOD,l=>n.dirty(l)),a.clear(),i.items.forEach(l=>a.union(Hc(l,s))),i.role){case uv:case cv:case lv:t.reflow()}else u=t.changed(t.REM),t.visit(t.ADD,l=>{a.union(Hc(l,s))}),t.visit(t.MOD,l=>{u=u||a.alignsWith(l.bounds),n.dirty(l),a.union(Hc(l,s))}),u&&(a.clear(),i.items.forEach(l=>a.union(l.bounds)));return dR(i),t.modifies("bounds")}});function Hc(e,t,n){return t(e.bounds.clear(),e,n)}const lS=":vega_identifier:";function hv(e){R.call(this,0,e)}hv.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]};H(hv,R,{transform(e,t){const n=kU(t.dataflow),i=e.as;let r=n.value;return t.visit(t.ADD,o=>o[i]=o[i]||++r),n.set(this.value=r),t}});function kU(e){return e._signals[lS]||(e._signals[lS]=e.add(0))}function $R(e){R.call(this,null,e)}H($R,R,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,CU(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);const i=n.marktype===Wh?Nh:Th;return t.visit(t.ADD,r=>i.call(r,n)),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});function CU(e){const t=e.groups,n=e.parent;return t&&t.size===1?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}function AR(e){R.call(this,null,e)}const cS={parity:e=>e.filter((t,n)=>n%2?t.opacity=0:1),greedy:(e,t)=>{let n;return e.filter((i,r)=>!r||!kR(n.bounds,i.bounds,t)?(n=i,1):i.opacity=0)}},kR=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),fS=(e,t)=>{for(var n=1,i=e.length,r=e[0].bounds,o;n<i;r=o,++n)if(kR(r,o=e[n].bounds,t))return!0},FU=e=>{const t=e.bounds;return t.width()>1&&t.height()>1},_U=(e,t,n)=>{var i=e.range(),r=new Ze;return t===wa||t===lo?r.set(i[0],-1/0,i[1],1/0):r.set(-1/0,i[0],1/0,i[1]),r.expand(n||1),o=>r.encloses(o.bounds)},dS=e=>(e.forEach(t=>t.opacity=1),e),hS=(e,t)=>e.reflow(t.modified()).modifies("opacity");H(AR,R,{transform(e,t){const n=cS[e.method]||cS.parity,i=e.separation||0;let r=t.materialize(t.SOURCE).source,o,s;if(!r||!r.length)return;if(!e.method)return e.modified("method")&&(dS(r),t=hS(t,e)),t;if(r=r.filter(FU),!r.length)return;if(e.sort&&(r=r.slice().sort(e.sort)),o=dS(r),t=hS(t,e),o.length>=3&&fS(o,i)){do o=n(o,i);while(o.length>=3&&fS(o,i));o.length<3&&!be(r).opacity&&(o.length>1&&(be(o).opacity=0),be(r).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(s=_U(e.boundScale,e.boundOrient,+e.boundTolerance),r.forEach(u=>{s(u)||(u.opacity=0)}));const a=o[0].mark.bounds.clear();return r.forEach(u=>{u.opacity&&a.union(u.bounds)}),t}});function CR(e){R.call(this,null,e)}H(CR,R,{transform(e,t){const n=t.dataflow;if(t.visit(t.ALL,i=>n.dirty(i)),t.fields&&t.fields.zindex){const i=t.source&&t.source[0];i&&(i.mark.zdirty=!0)}}});const wt=new Ze;function ea(e,t,n){return e[t]===n?0:(e[t]=n,1)}function OU(e){var t=e.items[0].orient;return t===Zn||t===ti}function RU(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}function MU(e,t,n,i){var r=t.items[0],o=r.datum,s=r.translate!=null?r.translate:.5,a=r.orient,u=RU(o),l=r.range,c=r.offset,f=r.position,d=r.minExtent,h=r.maxExtent,g=o.title&&r.items[u[2]].items[0],p=r.titlePadding,m=r.bounds,y=g&&Yb(g),b=0,v=0,x,w;switch(wt.clear().union(m),m.clear(),(x=u[0])>-1&&m.union(r.items[x].bounds),(x=u[1])>-1&&m.union(r.items[x].bounds),a){case wa:b=f||0,v=-c,w=Math.max(d,Math.min(h,-m.y1)),m.add(0,-w).add(l,0),g&&Vc(e,g,w,p,y,0,-1,m);break;case Zn:b=-c,v=f||0,w=Math.max(d,Math.min(h,-m.x1)),m.add(-w,0).add(0,l),g&&Vc(e,g,w,p,y,1,-1,m);break;case ti:b=n+c,v=f||0,w=Math.max(d,Math.min(h,m.x2)),m.add(0,0).add(w,l),g&&Vc(e,g,w,p,y,1,1,m);break;case lo:b=f||0,v=i+c,w=Math.max(d,Math.min(h,m.y2)),m.add(0,0).add(l,w),g&&Vc(e,g,w,p,0,0,1,m);break;default:b=r.x,v=r.y}return $r(m.translate(b,v),r),ea(r,"x",b+s)|ea(r,"y",v+s)&&(r.bounds=wt,e.dirty(r),r.bounds=m,e.dirty(r)),r.mark.bounds.clear().union(m)}function Vc(e,t,n,i,r,o,s,a){const u=t.bounds;if(t.auto){const l=s*(n+r+i);let c=0,f=0;e.dirty(t),o?c=(t.x||0)-(t.x=l):f=(t.y||0)-(t.y=l),t.mark.bounds.clear().union(u.translate(-c,-f)),e.dirty(t)}a.union(u)}const gS=(e,t)=>Math.floor(Math.min(e,t)),pS=(e,t)=>Math.ceil(Math.max(e,t));function DU(e){var t=e.items,n=t.length,i=0,r,o;const s={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;i<n;++i)if(r=t[i],o=r.items,r.marktype===Wh)switch(r.role){case uv:case cv:case lv:break;case gR:s.rowheaders.push(...o);break;case pR:s.rowfooters.push(...o);break;case yR:s.colheaders.push(...o);break;case bR:s.colfooters.push(...o);break;case mR:s.rowtitle=o[0];break;case vR:s.coltitle=o[0];break;default:s.marks.push(...o)}return s}function TU(e){return new Ze().set(0,0,e.width||0,e.height||0)}function NU(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function Ie(e,t,n){const i=X(e)?e[t]:e;return i??(n!==void 0?n:0)}function mS(e){return e<0?Math.ceil(-e):0}function FR(e,t,n){var i=!n.nodirty,r=n.bounds===dv?TU:NU,o=wt.set(0,0,0,0),s=Ie(n.align,Kr),a=Ie(n.align,Jr),u=Ie(n.padding,Kr),l=Ie(n.padding,Jr),c=n.columns||t.length,f=c<=0?1:Math.ceil(t.length/c),d=t.length,h=Array(d),g=Array(c),p=0,m=Array(d),y=Array(f),b=0,v=Array(d),x=Array(d),w=Array(d),S,E,$,A,C,F,I,j,O,k,_;for(E=0;E<c;++E)g[E]=0;for(E=0;E<f;++E)y[E]=0;for(E=0;E<d;++E)F=t[E],C=w[E]=r(F),F.x=F.x||0,v[E]=0,F.y=F.y||0,x[E]=0,$=E%c,A=~~(E/c),p=Math.max(p,I=Math.ceil(C.x2)),b=Math.max(b,j=Math.ceil(C.y2)),g[$]=Math.max(g[$],I),y[A]=Math.max(y[A],j),h[E]=u+mS(C.x1),m[E]=l+mS(C.y1),i&&e.dirty(t[E]);for(E=0;E<d;++E)E%c===0&&(h[E]=0),E<c&&(m[E]=0);if(s===_0)for($=1;$<c;++$){for(_=0,E=$;E<d;E+=c)_<h[E]&&(_=h[E]);for(E=$;E<d;E+=c)h[E]=_+g[$-1]}else if(s===Gc){for(_=0,E=0;E<d;++E)E%c&&_<h[E]&&(_=h[E]);for(E=0;E<d;++E)E%c&&(h[E]=_+p)}else for(s=!1,$=1;$<c;++$)for(E=$;E<d;E+=c)h[E]+=g[$-1];if(a===_0)for(A=1;A<f;++A){for(_=0,E=A*c,S=E+c;E<S;++E)_<m[E]&&(_=m[E]);for(E=A*c;E<S;++E)m[E]=_+y[A-1]}else if(a===Gc){for(_=0,E=c;E<d;++E)_<m[E]&&(_=m[E]);for(E=c;E<d;++E)m[E]=_+b}else for(a=!1,A=1;A<f;++A)for(E=A*c,S=E+c;E<S;++E)m[E]+=y[A-1];for(O=0,E=0;E<d;++E)O=h[E]+(E%c?O:0),v[E]+=O-t[E].x;for($=0;$<c;++$)for(k=0,E=$;E<d;E+=c)k+=m[E],x[E]+=k-t[E].y;if(s&&Ie(n.center,Kr)&&f>1)for(E=0;E<d;++E)C=s===Gc?p:g[E%c],O=C-w[E].x2-t[E].x-v[E],O>0&&(v[E]+=O/2);if(a&&Ie(n.center,Jr)&&c!==1)for(E=0;E<d;++E)C=a===Gc?b:y[~~(E/c)],k=C-w[E].y2-t[E].y-x[E],k>0&&(x[E]+=k/2);for(E=0;E<d;++E)o.union(w[E].translate(v[E],x[E]));switch(O=Ie(n.anchor,vU),k=Ie(n.anchor,xU),Ie(n.anchor,Kr)){case Nt:O-=o.width();break;case F0:O-=o.width()/2}switch(Ie(n.anchor,Jr)){case Nt:k-=o.height();break;case F0:k-=o.height()/2}for(O=Math.round(O),k=Math.round(k),o.clear(),E=0;E<d;++E)t[E].mark.bounds.clear();for(E=0;E<d;++E)F=t[E],F.x+=v[E]+=O,F.y+=x[E]+=k,o.union(F.mark.bounds.union(F.bounds.translate(v[E],x[E]))),i&&e.dirty(F);return o}function LU(e,t,n){var i=DU(t),r=i.marks,o=n.bounds===dv?IU:PU,s=n.offset,a=n.columns||r.length,u=a<=0?1:Math.ceil(r.length/a),l=u*a,c,f,d,h,g,p,m;const y=FR(e,r,n);y.empty()&&y.set(0,0,0,0),i.rowheaders&&(p=Ie(n.headerBand,Jr,null),c=Xc(e,i.rowheaders,r,a,u,-Ie(s,"rowHeader"),gS,0,o,"x1",0,a,1,p)),i.colheaders&&(p=Ie(n.headerBand,Kr,null),f=Xc(e,i.colheaders,r,a,a,-Ie(s,"columnHeader"),gS,1,o,"y1",0,1,a,p)),i.rowfooters&&(p=Ie(n.footerBand,Jr,null),d=Xc(e,i.rowfooters,r,a,u,Ie(s,"rowFooter"),pS,0,o,"x2",a-1,a,1,p)),i.colfooters&&(p=Ie(n.footerBand,Kr,null),h=Xc(e,i.colfooters,r,a,a,Ie(s,"columnFooter"),pS,1,o,"y2",l-a,1,a,p)),i.rowtitle&&(g=Ie(n.titleAnchor,Jr),m=Ie(s,"rowTitle"),m=g===Nt?d+m:c-m,p=Ie(n.titleBand,Jr,.5),yS(e,i.rowtitle,m,0,y,p)),i.coltitle&&(g=Ie(n.titleAnchor,Kr),m=Ie(s,"columnTitle"),m=g===Nt?h+m:f-m,p=Ie(n.titleBand,Kr,.5),yS(e,i.coltitle,m,1,y,p))}function IU(e,t){return t==="x1"?e.x||0:t==="y1"?e.y||0:t==="x2"?(e.x||0)+(e.width||0):t==="y2"?(e.y||0)+(e.height||0):void 0}function PU(e,t){return e.bounds[t]}function Xc(e,t,n,i,r,o,s,a,u,l,c,f,d,h){var g=n.length,p=0,m=0,y,b,v,x,w,S,E,$,A;if(!g)return p;for(y=c;y<g;y+=f)n[y]&&(p=s(p,u(n[y],l)));if(!t.length)return p;for(t.length>r&&(e.warn("Grid headers exceed limit: "+r),t=t.slice(0,r)),p+=o,b=0,x=t.length;b<x;++b)e.dirty(t[b]),t[b].mark.bounds.clear();for(y=c,b=0,x=t.length;b<x;++b,y+=f){for(S=t[b],w=S.mark.bounds,v=y;v>=0&&(E=n[v])==null;v-=d);a?($=h==null?E.x:Math.round(E.bounds.x1+h*E.bounds.width()),A=p):($=p,A=h==null?E.y:Math.round(E.bounds.y1+h*E.bounds.height())),w.union(S.bounds.translate($-(S.x||0),A-(S.y||0))),S.x=$,S.y=A,e.dirty(S),m=s(m,w[l])}return m}function yS(e,t,n,i,r,o){if(t){e.dirty(t);var s=n,a=n;i?s=Math.round(r.x1+o*r.width()):a=Math.round(r.y1+o*r.height()),t.bounds.translate(s-(t.x||0),a-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=s,t.y=a,e.dirty(t)}}function zU(e,t){const n=e[t]||{};return(i,r)=>n[i]!=null?n[i]:e[i]!=null?e[i]:r}function BU(e,t){let n=-1/0;return e.forEach(i=>{i.offset!=null&&(n=Math.max(n,i.offset))}),n>-1/0?n:t}function UU(e,t,n,i,r,o,s){const a=zU(n,t),u=BU(e,a("offset",0)),l=a("anchor",av),c=l===Nt?1:l===F0?.5:0,f={align:_0,bounds:a("bounds",dv),columns:a("direction")==="vertical"?1:e.length,padding:a("margin",8),center:a("center"),nodirty:!0};switch(t){case Zn:f.anchor={x:Math.floor(i.x1)-u,column:Nt,y:c*(s||i.height()+2*i.y1),row:l};break;case ti:f.anchor={x:Math.ceil(i.x2)+u,y:c*(s||i.height()+2*i.y1),row:l};break;case wa:f.anchor={y:Math.floor(r.y1)-u,row:Nt,x:c*(o||r.width()+2*r.x1),column:l};break;case lo:f.anchor={y:Math.ceil(r.y2)+u,x:c*(o||r.width()+2*r.x1),column:l};break;case pU:f.anchor={x:u,y:u};break;case mU:f.anchor={x:o-u,y:u,column:Nt};break;case yU:f.anchor={x:u,y:s-u,row:Nt};break;case bU:f.anchor={x:o-u,y:s-u,column:Nt,row:Nt};break}return f}function jU(e,t){var n=t.items[0],i=n.datum,r=n.orient,o=n.bounds,s=n.x,a=n.y,u,l;return n._bounds?n._bounds.clear().union(o):n._bounds=o.clone(),o.clear(),WU(e,n,n.items[0].items[0]),o=qU(n,o),u=2*n.padding,l=2*n.padding,o.empty()||(u=Math.ceil(o.width()+u),l=Math.ceil(o.height()+l)),i.type===$U&&GU(n.items[0].items[0].items[0].items),r!==fv&&(n.x=s=0,n.y=a=0),n.width=u,n.height=l,$r(o.set(s,a,s+u,a+l),n),n.mark.bounds.clear().union(o),n}function qU(e,t){return e.items.forEach(n=>t.union(n.bounds)),t.x1=e.padding,t.y1=e.padding,t}function WU(e,t,n){var i=t.padding,r=i-n.x,o=i-n.y;if(!t.datum.title)(r||o)&&xu(e,n,r,o);else{var s=t.items[1].items[0],a=s.anchor,u=t.titlePadding||0,l=i-s.x,c=i-s.y;switch(s.orient){case Zn:r+=Math.ceil(s.bounds.width())+u;break;case ti:case lo:break;default:o+=s.bounds.height()+u}switch((r||o)&&xu(e,n,r,o),s.orient){case Zn:c+=Us(t,n,s,a,1,1);break;case ti:l+=Us(t,n,s,Nt,0,0)+u,c+=Us(t,n,s,a,1,1);break;case lo:l+=Us(t,n,s,a,0,0),c+=Us(t,n,s,Nt,-1,0,1)+u;break;default:l+=Us(t,n,s,a,0,0)}(l||c)&&xu(e,s,l,c),(l=Math.round(s.bounds.x1-i))<0&&(xu(e,n,-l,0),xu(e,s,-l,0))}}function Us(e,t,n,i,r,o,s){const a=e.datum.type!=="symbol",u=n.datum.vgrad,l=a&&(o||!u)&&!s?t.items[0]:t,c=l.bounds[r?"y2":"x2"]-e.padding,f=u&&o?c:0,d=u&&o?0:c,h=r<=0?0:Yb(n);return Math.round(i===av?f:i===Nt?d-h:.5*(c-h))}function xu(e,t,n,i){t.x+=n,t.y+=i,t.bounds.translate(n,i),t.mark.bounds.translate(n,i),e.dirty(t)}function GU(e){const t=e.reduce((n,i)=>(n[i.column]=Math.max(i.bounds.x2-i.x,n[i.column]||0),n),{});e.forEach(n=>{n.width=t[n.column],n.height=n.bounds.y2-n.y})}function HU(e,t,n,i,r){var o=t.items[0],s=o.frame,a=o.orient,u=o.anchor,l=o.offset,c=o.padding,f=o.items[0].items[0],d=o.items[1]&&o.items[1].items[0],h=a===Zn||a===ti?i:n,g=0,p=0,m=0,y=0,b=0,v;if(s!==Wh?a===Zn?(g=r.y2,h=r.y1):a===ti?(g=r.y1,h=r.y2):(g=r.x1,h=r.x2):a===Zn&&(g=i,h=0),v=u===av?g:u===Nt?h:(g+h)/2,d&&d.text){switch(a){case wa:case lo:b=f.bounds.height()+c;break;case Zn:y=f.bounds.width()+c;break;case ti:y=-f.bounds.width()-c;break}wt.clear().union(d.bounds),wt.translate(y-(d.x||0),b-(d.y||0)),ea(d,"x",y)|ea(d,"y",b)&&(e.dirty(d),d.bounds.clear().union(wt),d.mark.bounds.clear().union(wt),e.dirty(d)),wt.clear().union(d.bounds)}else wt.clear();switch(wt.union(f.bounds),a){case wa:p=v,m=r.y1-wt.height()-l;break;case Zn:p=r.x1-wt.width()-l,m=v;break;case ti:p=r.x2+wt.width()+l,m=v;break;case lo:p=v,m=r.y2+l;break;default:p=o.x,m=o.y}return ea(o,"x",p)|ea(o,"y",m)&&(wt.translate(p,m),e.dirty(o),o.bounds.clear().union(wt),t.bounds.clear().union(wt),e.dirty(o)),o.bounds}function _R(e){R.call(this,null,e)}H(_R,R,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach(i=>{e.layout&&LU(n,i,e.layout),XU(n,i,e)}),VU(e.mark.group)?t.reflow():t}});function VU(e){return e&&e.mark.role!=="legend-entry"}function XU(e,t,n){var i=t.items,r=Math.max(0,t.width||0),o=Math.max(0,t.height||0),s=new Ze().set(0,0,r,o),a=s.clone(),u=s.clone(),l=[],c,f,d,h,g,p;for(g=0,p=i.length;g<p;++g)switch(f=i[g],f.role){case uv:h=OU(f)?a:u,h.union(MU(e,f,r,o));break;case lv:c=f;break;case cv:l.push(jU(e,f));break;case EU:case wU:case gR:case pR:case mR:case yR:case bR:case vR:a.union(f.bounds),u.union(f.bounds);break;default:s.union(f.bounds)}if(l.length){const m={};l.forEach(y=>{d=y.orient||ti,d!==fv&&(m[d]||(m[d]=[])).push(y)});for(const y in m){const b=m[y];FR(e,b,UU(b,y,n.legends,a,u,r,o))}l.forEach(y=>{const b=y.bounds;if(b.equals(y._bounds)||(y.bounds=y._bounds,e.dirty(y),y.bounds=b,e.dirty(y)),n.autosize&&(n.autosize.type===xR||n.autosize.type===ER||n.autosize.type===wR))switch(y.orient){case Zn:case ti:s.add(b.x1,0).add(b.x2,0);break;case wa:case lo:s.add(0,b.y1).add(0,b.y2)}else s.union(b)})}s.union(a).union(u),c&&s.union(HU(e,c,r,o,s)),t.clip&&s.set(0,0,t.width||0,t.height||0),YU(e,t,s,n)}function YU(e,t,n,i){const r=i.autosize||{},o=r.type;if(e._autosize<1||!o)return;let s=e._width,a=e._height,u=Math.max(0,t.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,t.height||0),f=Math.max(0,Math.ceil(-n.y1));const d=Math.max(0,Math.ceil(n.x2-u)),h=Math.max(0,Math.ceil(n.y2-c));if(r.contains===SU){const g=e.padding();s-=g.left+g.right,a-=g.top+g.bottom}o===fv?(l=0,f=0,u=s,c=a):o===xR?(u=Math.max(0,s-l-d),c=Math.max(0,a-f-h)):o===ER?(u=Math.max(0,s-l-d),a=c+f+h):o===wR?(s=u+l+d,c=Math.max(0,a-f-h)):o===AU&&(s=u+l+d,a=c+f+h),e._resizeView(s,a,u,c,[l,f],r.resize)}const KU=Object.freeze(Object.defineProperty({__proto__:null,bound:SR,identifier:hv,mark:$R,overlap:AR,render:CR,viewlayout:_R},Symbol.toStringTag,{value:"Module"}));function OR(e){R.call(this,null,e)}H(OR,R,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,o=e.scale,s=e.count==null?e.values?e.values.length:10:e.count,a=Rb(o,s,e.minstep),u=e.format||rO(n,o,a,e.formatSpecifier,e.formatType,!!e.values),l=e.values?iO(o,e.values,a):Mb(o,a);return r&&(i.rem=r),r=l.map((c,f)=>Se({index:f/(l.length-1||1),value:c,label:u(c)})),e.extra&&r.length&&r.push(Se({index:-1,extra:{value:r[0].value},label:""})),i.source=r,i.add=r,this.value=r,i}});function RR(e){R.call(this,null,e)}function JU(){return Se({})}function QU(e){const t=Va().test(n=>n.exit);return t.lookup=n=>t.get(e(n)),t}H(RR,R,{transform(e,t){var n=t.dataflow,i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.item||JU,o=e.key||ne,s=this.value;return T(i.encode)&&(i.encode=null),s&&(e.modified("key")||t.modified(o))&&M("DataJoin does not support modified key function or fields."),s||(t=t.addAll(),this.value=s=QU(o)),t.visit(t.ADD,a=>{const u=o(a);let l=s.get(u);l?l.exit?(s.empty--,i.add.push(l)):i.mod.push(l):(l=r(a),s.set(u,l),i.add.push(l)),l.datum=a,l.exit=!1}),t.visit(t.MOD,a=>{const u=o(a),l=s.get(u);l&&(l.datum=a,i.mod.push(l))}),t.visit(t.REM,a=>{const u=o(a),l=s.get(u);a===l.datum&&!l.exit&&(i.rem.push(l),l.exit=!0,++s.empty)}),t.changed(t.ADD_MOD)&&i.modifies("datum"),(t.clean()||e.clean&&s.empty>n.cleanThreshold)&&n.runAfter(s.clean),i}});function MR(e){R.call(this,null,e)}H(MR,R,{transform(e,t){var n=t.fork(t.ADD_REM),i=e.mod||!1,r=e.encoders,o=t.encode;if(T(o))if(n.changed()||o.every(f=>r[f]))o=o[0],n.encode=null;else return t.StopPropagation;var s=o==="enter",a=r.update||Tr,u=r.enter||Tr,l=r.exit||Tr,c=(o&&!s?r[o]:a)||Tr;if(t.changed(t.ADD)&&(t.visit(t.ADD,f=>{u(f,e),a(f,e)}),n.modifies(u.output),n.modifies(a.output),c!==Tr&&c!==a&&(t.visit(t.ADD,f=>{c(f,e)}),n.modifies(c.output))),t.changed(t.REM)&&l!==Tr&&(t.visit(t.REM,f=>{l(f,e)}),n.modifies(l.output)),s||c!==Tr){const f=t.MOD|(e.modified()?t.REFLOW:0);s?(t.visit(f,d=>{const h=u(d,e)||i;(c(d,e)||h)&&n.mod.push(d)}),n.mod.length&&n.modifies(u.output)):t.visit(f,d=>{(c(d,e)||i)&&n.mod.push(d)}),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation}});function DR(e){R.call(this,[],e)}H(DR,R,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),i=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=this.value,o=e.type||xf,s=e.scale,a=+e.limit,u=Rb(s,e.count==null?5:e.count,e.minstep),l=!!e.values||o===xf,c=e.format||uO(n,s,u,o,e.formatSpecifier,e.formatType,l),f=e.values||aO(s,u),d,h,g,p,m;return r&&(i.rem=r),o===xf?(a&&f.length>a?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),r=f.slice(0,a-1),m=!0):r=f,ce(g=e.size)?(!e.values&&s(r[0])===0&&(r=r.slice(1)),p=r.reduce((y,b)=>Math.max(y,g(b,e)),0)):g=Rt(p=g||8),r=r.map((y,b)=>Se({index:b,label:c(y,b,r),value:y,offset:p,size:g(y,e)})),m&&(m=f[r.length],r.push(Se({index:r.length,label:`…${f.length-r.length} entries`,value:m,offset:p,size:g(m,e)})))):o===$8?(d=s.domain(),h=eO(s,d[0],be(d)),f.length<3&&!e.values&&d[0]!==be(d)&&(f=[d[0],be(d)]),r=f.map((y,b)=>Se({index:b,label:c(y,b,f),value:y,perc:h(y)}))):(g=f.length-1,h=N8(s),r=f.map((y,b)=>Se({index:b,label:c(y,b,f),value:y,perc:b?h(y):0,perc2:b===g?1:h(f[b+1])}))),i.source=r,i.add=r,this.value=r,i}});const ZU=e=>e.source.x,ej=e=>e.source.y,tj=e=>e.target.x,nj=e=>e.target.y;function gv(e){R.call(this,{},e)}gv.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]};H(gv,R,{transform(e,t){var n=e.sourceX||ZU,i=e.sourceY||ej,r=e.targetX||tj,o=e.targetY||nj,s=e.as||"path",a=e.orient||"vertical",u=e.shape||"line",l=bS.get(u+"-"+a)||bS.get(u);return l||M("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,c=>{c[s]=l(n(c),i(c),r(c),o(c))}),t.reflow(e.modified()).modifies(s)}});const TR=(e,t,n,i)=>"M"+e+","+t+"L"+n+","+i,ij=(e,t,n,i)=>TR(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),NR=(e,t,n,i)=>{var r=n-e,o=i-t,s=Math.hypot(r,o)/2,a=180*Math.atan2(o,r)/Math.PI;return"M"+e+","+t+"A"+s+","+s+" "+a+" 0 1 "+n+","+i},rj=(e,t,n,i)=>NR(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),LR=(e,t,n,i)=>{const r=n-e,o=i-t,s=.2*(r+o),a=.2*(o-r);return"M"+e+","+t+"C"+(e+s)+","+(t+a)+" "+(n+a)+","+(i-s)+" "+n+","+i},oj=(e,t,n,i)=>LR(t*Math.cos(e),t*Math.sin(e),i*Math.cos(n),i*Math.sin(n)),sj=(e,t,n,i)=>"M"+e+","+t+"V"+i+"H"+n,aj=(e,t,n,i)=>"M"+e+","+t+"H"+n+"V"+i,uj=(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),s=Math.cos(n),a=Math.sin(n),u=Math.abs(n-e)>Math.PI?n<=e:n>e;return"M"+t*r+","+t*o+"A"+t+","+t+" 0 0,"+(u?1:0)+" "+t*s+","+t*a+"L"+i*s+","+i*a},lj=(e,t,n,i)=>{const r=(e+n)/2;return"M"+e+","+t+"C"+r+","+t+" "+r+","+i+" "+n+","+i},cj=(e,t,n,i)=>{const r=(t+i)/2;return"M"+e+","+t+"C"+e+","+r+" "+n+","+r+" "+n+","+i},fj=(e,t,n,i)=>{const r=Math.cos(e),o=Math.sin(e),s=Math.cos(n),a=Math.sin(n),u=(t+i)/2;return"M"+t*r+","+t*o+"C"+u*r+","+u*o+" "+u*s+","+u*a+" "+i*s+","+i*a},bS=Va({line:TR,"line-radial":ij,arc:NR,"arc-radial":rj,curve:LR,"curve-radial":oj,"orthogonal-horizontal":sj,"orthogonal-vertical":aj,"orthogonal-radial":uj,"diagonal-horizontal":lj,"diagonal-vertical":cj,"diagonal-radial":fj});function pv(e){R.call(this,null,e)}pv.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]};H(pv,R,{transform(e,t){var n=e.as||["startAngle","endAngle"],i=n[0],r=n[1],o=e.field||qa,s=e.startAngle||0,a=e.endAngle!=null?e.endAngle:2*Math.PI,u=t.source,l=u.map(o),c=l.length,f=s,d=(a-s)/Ik(l),h=pn(c),g,p,m;for(e.sort&&h.sort((y,b)=>l[y]-l[b]),g=0;g<c;++g)m=l[h[g]],p=u[h[g]],p[i]=f,p[r]=f+=m*d;return this.value=l,t.reflow(e.modified()).modifies(n)}});const dj=5;function hj(e){const t=e.type;return!e.bins&&(t===ma||t===Yl||t===Kl)}function IR(e){return Fb(e)&&e!==Mi}const gj=si(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function PR(e){R.call(this,null,e),this.modified(!0)}H(PR,R,{transform(e,t){var n=t.dataflow,i=this.value,r=pj(e);(!i||r!==i.type)&&(this.value=i=we(r)());for(r in e)if(!gj[r]){if(r==="padding"&&IR(i.type))continue;ce(i[r])?i[r](e[r]):n.warn("Unsupported scale property: "+r)}return Ej(i,e,xj(i,e,yj(i,e,n))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function pj(e){var t=e.type,n="",i;return t===Mi?Mi+"-"+ma:(mj(e)&&(i=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(e.domainMid!=null):0,n=i===2?Mi+"-":i===3?Ja+"-":""),(n+t||ma).toLowerCase())}function mj(e){const t=e.type;return Fb(t)&&t!==ns&&t!==is&&(e.scheme||e.range&&e.range.length&&e.range.every(Y))}function yj(e,t,n){const i=bj(e,t.domainRaw,n);if(i>-1)return i;var r=t.domain,o=e.type,s=t.zero||t.zero===void 0&&hj(e),a,u;if(!r)return 0;if((s||t.domainMin!=null||t.domainMax!=null||t.domainMid!=null)&&(a=(r=r.slice()).length-1||1,s&&(r[0]>0&&(r[0]=0),r[a]<0&&(r[a]=0)),t.domainMin!=null&&(r[0]=t.domainMin),t.domainMax!=null&&(r[a]=t.domainMax),t.domainMid!=null)){u=t.domainMid;const l=u>r[a]?a+1:u<r[0]?0:a;l!==a&&n.warn("Scale domainMid exceeds domain min or max.",u),r.splice(l,0,u)}return IR(o)&&t.padding&&r[0]!==be(r)&&(r=vj(o,r,t.range,t.padding,t.exponent,t.constant)),e.domain(zR(o,r,n)),o===$b&&e.unknown(t.domainImplicit?DL:void 0),t.nice&&e.nice&&e.nice(t.nice!==!0&&Rb(e,t.nice)||null),r.length}function bj(e,t,n){return t?(e.domain(zR(e.type,t,n)),t.length):-1}function vj(e,t,n,i,r,o){var s=Math.abs(be(n)-n[0]),a=s/(s-2*i),u=e===br?my(t,null,a):e===Kl?gd(t,null,a,.5):e===Yl?gd(t,null,a,r||1):e===_h?yy(t,null,a,o||1):py(t,null,a);return t=t.slice(),t[0]=u[0],t[t.length-1]=u[1],t}function zR(e,t,n){if(Y_(e)){var i=Math.abs(t.reduce((r,o)=>r+(o<0?-1:o>0?1:0),0));i!==t.length&&n.warn("Log scale domain includes zero: "+G(t))}return t}function xj(e,t,n){let i=t.bins;if(i&&!T(i)){const r=e.domain(),o=r[0],s=be(r),a=i.step;let u=i.start==null?o:i.start,l=i.stop==null?s:i.stop;a||M("Scale bins parameter missing step property."),u<o&&(u=a*Math.ceil(o/a)),l>s&&(l=a*Math.floor(s/a)),i=pn(u,l+a/2,a)}return i?e.bins=i:e.bins&&delete e.bins,e.type===Ab&&(i?!t.domain&&!t.domainRaw&&(e.domain(i),n=i.length):e.bins=e.domain()),n}function Ej(e,t,n){var i=e.type,r=t.round||!1,o=t.range;if(t.rangeStep!=null)o=wj(i,t,n);else if(t.scheme&&(o=Sj(i,t,n),ce(o))){if(e.interpolator)return e.interpolator(o);M(`Scale type ${i} does not support interpolating color schemes.`)}if(o&&K_(i))return e.interpolator(Mh(O0(o,t.reverse),t.interpolate,t.interpolateGamma));o&&t.interpolate&&e.interpolate?e.interpolate(_b(t.interpolate,t.interpolateGamma)):ce(e.round)?e.round(r):ce(e.rangeRound)&&e.interpolate(r?rh:Bl),o&&e.range(O0(o,t.reverse))}function wj(e,t,n){e!==q_&&e!==p0&&M("Only band and point scales support rangeStep.");var i=(t.paddingOuter!=null?t.paddingOuter:t.padding)||0,r=e===p0?1:(t.paddingInner!=null?t.paddingInner:t.padding)||0;return[0,t.rangeStep*Sb(n,r,i)]}function Sj(e,t,n){var i=t.schemeExtent,r,o;return T(t.scheme)?o=Mh(t.scheme,t.interpolate,t.interpolateGamma):(r=t.scheme.toLowerCase(),o=Ob(r),o||M(`Unrecognized scheme name: ${t.scheme}`)),n=e===Rh?n+1:e===Ab?n-1:e===ya||e===Oh?+t.schemeCount||dj:n,K_(e)?vS(o,i,t.reverse):ce(o)?Z_(vS(o,i),n):e===$b?o:o.slice(0,n)}function vS(e,t,n){return ce(e)&&(t||n)?Q_(e,O0(t||[0,1],n)):e}function O0(e,t){return t?e.slice().reverse():e}function BR(e){R.call(this,null,e)}H(BR,R,{transform(e,t){const n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(ws(e.sort)),this.modified(n),t}});const xS="zero",UR="center",jR="normalize",qR=["y0","y1"];function mv(e){R.call(this,null,e)}mv.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:xS,values:[xS,UR,jR]},{name:"as",type:"string",array:!0,length:2,default:qR}]};H(mv,R,{transform(e,t){var n=e.as||qR,i=n[0],r=n[1],o=ws(e.sort),s=e.field||qa,a=e.offset===UR?$j:e.offset===jR?Aj:kj,u,l,c,f;for(u=Cj(t.source,e.groupby,o,s),l=0,c=u.length,f=u.max;l<c;++l)a(u[l],f,s,i,r);return t.reflow(e.modified()).modifies(n)}});function $j(e,t,n,i,r){for(var o=(t-e.sum)/2,s=e.length,a=0,u;a<s;++a)u=e[a],u[i]=o,u[r]=o+=Math.abs(n(u))}function Aj(e,t,n,i,r){for(var o=1/e.sum,s=0,a=e.length,u=0,l=0,c;u<a;++u)c=e[u],c[i]=s,c[r]=s=o*(l+=Math.abs(n(c)))}function kj(e,t,n,i,r){for(var o=0,s=0,a=e.length,u=0,l,c;u<a;++u)c=e[u],l=+n(c),l<0?(c[i]=s,c[r]=s+=l):(c[i]=o,c[r]=o+=l)}function Cj(e,t,n,i){var r=[],o=p=>p(c),s,a,u,l,c,f,d,h,g;if(t==null)r.push(e.slice());else for(s={},a=0,u=e.length;a<u;++a)c=e[a],f=t.map(o),d=s[f],d||(s[f]=d=[],r.push(d)),d.push(c);for(f=0,g=0,l=r.length;f<l;++f){for(d=r[f],a=0,h=0,u=d.length;a<u;++a)h+=Math.abs(i(d[a]));d.sum=h,h>g&&(g=h),n&&d.sort(n)}return r.max=g,r}const Fj=Object.freeze(Object.defineProperty({__proto__:null,axisticks:OR,datajoin:RR,encode:MR,legendentries:DR,linkpath:gv,pie:pv,scale:PR,sortitems:BR,stack:mv},Symbol.toStringTag,{value:"Module"}));var _j=Math.abs,R0=Math.cos,Rd=Math.sin,Oj=1e-6,WR=Math.PI,M0=WR/2,ES=Rj(2);function wS(e){return e>1?M0:e<-1?-M0:Math.asin(e)}function Rj(e){return e>0?Math.sqrt(e):0}function Mj(e,t){var n=e*Rd(t),i=30,r;do t-=r=(t+Rd(t)-n)/(1+R0(t));while(_j(r)>Oj&&--i>0);return t/2}function Dj(e,t,n){function i(r,o){return[e*r*R0(o=Mj(n,o)),t*Rd(o)]}return i.invert=function(r,o){return o=wS(o/t),[r/(e*R0(o)),wS((2*o+Rd(2*o))/n)]},i}var Tj=Dj(ES/M0,ES,WR);function Nj(){return Wi(Tj).scale(169.529)}const Lj=yC(),D0=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Ij(e,t){return function n(){const i=t();return i.type=e,i.path=yC().projection(i),i.copy=i.copy||function(){const r=n();return D0.forEach(o=>{i[o]&&r[o](i[o]())}),r.path.pointRadius(i.path.pointRadius()),r},V_(i)}}function yv(e,t){if(!e||typeof e!="string")throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(Md[e]=Ij(e,t),this):Md[e]||null}function GR(e){return e&&e.path||Lj}const Md={albers:vC,albersusa:uz,azimuthalequalarea:lz,azimuthalequidistant:cz,conicconformal:hz,conicequalarea:cd,conicequidistant:mz,equalEarth:bz,equirectangular:gz,gnomonic:vz,identity:xz,mercator:fz,mollweide:Nj,naturalEarth1:Ez,orthographic:wz,stereographic:Sz,transversemercator:$z};for(const e in Md)yv(e,Md[e]);function Pj(){}const nr=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function HR(){var e=1,t=1,n=a;function i(u,l){return l.map(c=>r(u,c))}function r(u,l){var c=[],f=[];return o(u,l,d=>{n(d,u,l),zj(d)>0?c.push([d]):f.push(d)}),f.forEach(d=>{for(var h=0,g=c.length,p;h<g;++h)if(Bj((p=c[h])[0],d)!==-1){p.push(d);return}}),{type:"MultiPolygon",value:l,coordinates:c}}function o(u,l,c){var f=[],d=[],h,g,p,m,y,b;for(h=g=-1,m=u[0]>=l,nr[m<<1].forEach(v);++h<e-1;)p=m,m=u[h+1]>=l,nr[p|m<<1].forEach(v);for(nr[m<<0].forEach(v);++g<t-1;){for(h=-1,m=u[g*e+e]>=l,y=u[g*e]>=l,nr[m<<1|y<<2].forEach(v);++h<e-1;)p=m,m=u[g*e+e+h+1]>=l,b=y,y=u[g*e+h+1]>=l,nr[p|m<<1|y<<2|b<<3].forEach(v);nr[m|y<<3].forEach(v)}for(h=-1,y=u[g*e]>=l,nr[y<<2].forEach(v);++h<e-1;)b=y,y=u[g*e+h+1]>=l,nr[y<<2|b<<3].forEach(v);nr[y<<3].forEach(v);function v(x){var w=[x[0][0]+h,x[0][1]+g],S=[x[1][0]+h,x[1][1]+g],E=s(w),$=s(S),A,C;(A=d[E])?(C=f[$])?(delete d[A.end],delete f[C.start],A===C?(A.ring.push(S),c(A.ring)):f[A.start]=d[C.end]={start:A.start,end:C.end,ring:A.ring.concat(C.ring)}):(delete d[A.end],A.ring.push(S),d[A.end=$]=A):(A=f[$])?(C=d[E])?(delete f[A.start],delete d[C.end],A===C?(A.ring.push(S),c(A.ring)):f[C.start]=d[A.end]={start:C.start,end:A.end,ring:C.ring.concat(A.ring)}):(delete f[A.start],A.ring.unshift(w),f[A.start=E]=A):f[E]=d[$]={start:E,end:$,ring:[w,S]}}}function s(u){return u[0]*2+u[1]*(e+1)*4}function a(u,l,c){u.forEach(f=>{var d=f[0],h=f[1],g=d|0,p=h|0,m,y=l[p*e+g];d>0&&d<e&&g===d&&(m=l[p*e+g-1],f[0]=d+(c-m)/(y-m)-.5),h>0&&h<t&&p===h&&(m=l[(p-1)*e+g],f[1]=h+(c-m)/(y-m)-.5)})}return i.contour=r,i.size=function(u){if(!arguments.length)return[e,t];var l=Math.floor(u[0]),c=Math.floor(u[1]);return l>=0&&c>=0||M("invalid size"),e=l,t=c,i},i.smooth=function(u){return arguments.length?(n=u?a:Pj,i):n===a},i}function zj(e){for(var t=0,n=e.length,i=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t<n;)i+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return i}function Bj(e,t){for(var n=-1,i=t.length,r;++n<i;)if(r=Uj(e,t[n]))return r;return 0}function Uj(e,t){for(var n=t[0],i=t[1],r=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var u=e[o],l=u[0],c=u[1],f=e[a],d=f[0],h=f[1];if(jj(u,f,t))return 0;c>i!=h>i&&n<(d-l)*(i-c)/(h-c)+l&&(r=-r)}return r}function jj(e,t,n){var i;return qj(e,t,n)&&Wj(e[i=+(e[0]===t[0])],n[i],t[i])}function qj(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function Wj(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function VR(e,t,n){return function(i){var r=Ii(i),o=n?Math.min(r[0],0):r[0],s=r[1],a=s-o,u=t?pl(o,s,e):a/(e+1);return pn(o+u,s,u)}}function bv(e){R.call(this,null,e)}bv.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]};H(bv,R,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,r=e.field||nn,o=HR().smooth(e.smooth!==!1),s=e.thresholds||Gj(i,r,e),a=e.as===null?null:e.as||"contour",u=[];return i.forEach(l=>{const c=r(l),f=o.size([c.width,c.height])(c.values,T(s)?s:s(c.values));Hj(f,c,l,e),f.forEach(d=>{u.push(xh(l,Se(a!=null?{[a]:d}:d)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}});function Gj(e,t,n){const i=VR(n.levels||10,n.nice,n.zero!==!1);return n.resolve!=="shared"?i:i(e.map(r=>Go(t(r).values)))}function Hj(e,t,n,i){let r=i.scale||t.scale,o=i.translate||t.translate;if(ce(r)&&(r=r(n,i)),ce(o)&&(o=o(n,i)),(r===1||r==null)&&!o)return;const s=(Ee(r)?r:r[0])||1,a=(Ee(r)?r:r[1])||1,u=o&&o[0]||0,l=o&&o[1]||0;e.forEach(XR(t,s,a,u,l))}function XR(e,t,n,i,r){const o=e.x1||0,s=e.y1||0,a=t*n<0;function u(f){f.forEach(l)}function l(f){a&&f.reverse(),f.forEach(c)}function c(f){f[0]=(f[0]-o)*t+i,f[1]=(f[1]-s)*n+r}return function(f){return f.coordinates.forEach(u),f}}function SS(e,t,n){const i=e>=0?e:Iy(t,n);return Math.round((Math.sqrt(4*i*i+1)-1)/2)}function kp(e){return ce(e)?e:Rt(+e)}function YR(){var e=u=>u[0],t=u=>u[1],n=qa,i=[-1,-1],r=960,o=500,s=2;function a(u,l){const c=SS(i[0],u,e)>>s,f=SS(i[1],u,t)>>s,d=c?c+2:0,h=f?f+2:0,g=2*d+(r>>s),p=2*h+(o>>s),m=new Float32Array(g*p),y=new Float32Array(g*p);let b=m;u.forEach(x=>{const w=d+(+e(x)>>s),S=h+(+t(x)>>s);w>=0&&w<g&&S>=0&&S<p&&(m[w+S*g]+=+n(x))}),c>0&&f>0?(js(g,p,m,y,c),qs(g,p,y,m,f),js(g,p,m,y,c),qs(g,p,y,m,f),js(g,p,m,y,c),qs(g,p,y,m,f)):c>0?(js(g,p,m,y,c),js(g,p,y,m,c),js(g,p,m,y,c),b=y):f>0&&(qs(g,p,m,y,f),qs(g,p,y,m,f),qs(g,p,m,y,f),b=y);const v=l?Math.pow(2,-2*s):1/Ik(b);for(let x=0,w=g*p;x<w;++x)b[x]*=v;return{values:b,scale:1<<s,width:g,height:p,x1:d,y1:h,x2:d+(r>>s),y2:h+(o>>s)}}return a.x=function(u){return arguments.length?(e=kp(u),a):e},a.y=function(u){return arguments.length?(t=kp(u),a):t},a.weight=function(u){return arguments.length?(n=kp(u),a):n},a.size=function(u){if(!arguments.length)return[r,o];var l=+u[0],c=+u[1];return l>=0&&c>=0||M("invalid size"),r=l,o=c,a},a.cellSize=function(u){return arguments.length?((u=+u)>=1||M("invalid cell size"),s=Math.floor(Math.log(u)/Math.LN2),a):1<<s},a.bandwidth=function(u){return arguments.length?(u=K(u),u.length===1&&(u=[+u[0],+u[0]]),u.length!==2&&M("invalid bandwidth"),i=u,a):i},a}function js(e,t,n,i,r){const o=(r<<1)+1;for(let s=0;s<t;++s)for(let a=0,u=0;a<e+r;++a)a<e&&(u+=n[a+s*e]),a>=r&&(a>=o&&(u-=n[a-o+s*e]),i[a-r+s*e]=u/Math.min(a+1,e-1+o-a,o))}function qs(e,t,n,i,r){const o=(r<<1)+1;for(let s=0;s<e;++s)for(let a=0,u=0;a<t+r;++a)a<t&&(u+=n[s+a*e]),a>=r&&(a>=o&&(u-=n[s+(a-o)*e]),i[s+(a-r)*e]=u/Math.min(a+1,t-1+o-a,o))}function vv(e){R.call(this,null,e)}vv.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const Vj=["x","y","weight","size","cellSize","bandwidth"];function KR(e,t){return Vj.forEach(n=>t[n]!=null?e[n](t[n]):0),e}H(vv,R,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=t.materialize(t.SOURCE).source,r=Xj(i,e.groupby),o=(e.groupby||[]).map(Ge),s=KR(YR(),e),a=e.as||"grid",u=[];function l(c,f){for(let d=0;d<o.length;++d)c[o[d]]=f[d];return c}return u=r.map(c=>Se(l({[a]:s(c,e.counts)},c.dims))),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}});function Xj(e,t){var n=[],i=c=>c(a),r,o,s,a,u,l;if(t==null)n.push(e);else for(r={},o=0,s=e.length;o<s;++o)a=e[o],u=t.map(i),l=r[u],l||(r[u]=l=[],l.dims=u,n.push(l)),l.push(a);return n}function xv(e){R.call(this,null,e)}xv.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0},{name:"smooth",type:"boolean",default:!0}]};H(xv,R,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=HR().smooth(e.smooth!==!1),r=e.values,o=e.thresholds||VR(e.count||10,e.nice,!!r),s=e.size,a,u;return r||(r=t.materialize(t.SOURCE).source,a=KR(YR(),e)(r,!0),u=XR(a,a.scale||1,a.scale||1,0,0),s=[a.width,a.height],r=a.values),o=T(o)?o:o(r),r=i.size(s)(r,o),u&&r.forEach(u),this.value&&(n.rem=this.value),this.value=n.source=n.add=(r||[]).map(Se),n}});const T0="Feature",Ev="FeatureCollection",Yj="MultiPoint";function wv(e){R.call(this,null,e)}wv.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]};H(wv,R,{transform(e,t){var n=this._features,i=this._points,r=e.fields,o=r&&r[0],s=r&&r[1],a=e.geojson||!r&&nn,u=t.ADD,l;l=e.modified()||t.changed(t.REM)||t.modified(Ct(a))||o&&t.modified(Ct(o))||s&&t.modified(Ct(s)),(!this.value||l)&&(u=t.SOURCE,this._features=n=[],this._points=i=[]),a&&t.visit(u,c=>n.push(a(c))),o&&s&&(t.visit(u,c=>{var f=o(c),d=s(c);f!=null&&d!=null&&(f=+f)===f&&(d=+d)===d&&i.push([f,d])}),n=n.concat({type:T0,geometry:{type:Yj,coordinates:i}})),this.value={type:Ev,features:n}}});function Sv(e){R.call(this,null,e)}Sv.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]};H(Sv,R,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.field||nn,o=e.as||"path",s=n.SOURCE;!i||e.modified()?(this.value=i=GR(e.projection),n.materialize().reflow()):s=r===nn||t.modified(r.fields)?n.ADD_MOD:n.ADD;const a=Kj(i,e.pointRadius);return n.visit(s,u=>u[o]=i(r(u))),i.pointRadius(a),n.modifies(o)}});function Kj(e,t){const n=e.pointRadius();return e.context(null),t!=null&&e.pointRadius(t),n}function $v(e){R.call(this,null,e)}$v.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]};H($v,R,{transform(e,t){var n=e.projection,i=e.fields[0],r=e.fields[1],o=e.as||["x","y"],s=o[0],a=o[1],u;function l(c){const f=n([i(c),r(c)]);f?(c[s]=f[0],c[a]=f[1]):(c[s]=void 0,c[a]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(u=t.modified(i.fields)||t.modified(r.fields),t.visit(u?t.ADD_MOD:t.ADD,l)),t.modifies(o)}});function Av(e){R.call(this,null,e)}Av.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]};H(Av,R,{transform(e,t){var n=t.fork(t.ALL),i=this.value,r=e.as||"shape",o=n.ADD;return(!i||e.modified())&&(this.value=i=Jj(GR(e.projection),e.field||In("datum"),e.pointRadius),n.materialize().reflow(),o=n.SOURCE),n.visit(o,s=>s[r]=i),n.modifies(r)}});function Jj(e,t,n){const i=n==null?r=>e(t(r)):r=>{var o=e.pointRadius(),s=e.pointRadius(n)(t(r));return e.pointRadius(o),s};return i.context=r=>(e.context(r),i),i}function kv(e){R.call(this,[],e),this.generator=BP()}kv.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]};H(kv,R,{transform(e,t){var n=this.value,i=this.generator,r;if(!n.length||e.modified())for(const o in e)ce(i[o])&&i[o](e[o]);return r=i(),n.length?t.mod.push(JF(n[0],r)):t.add.push(Se(r)),n[0]=r,t}});function Cv(e){R.call(this,null,e)}Cv.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]};H(Cv,R,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,i=e.resolve==="shared",r=e.field||nn,o=Zj(e.opacity,e),s=Qj(e.color,e),a=e.as||"image",u={$x:0,$y:0,$value:0,$max:i?Go(n.map(l=>Go(r(l).values))):0};return n.forEach(l=>{const c=r(l),f=fe({},l,u);i||(f.$max=Go(c.values||[])),l[a]=eq(c,f,s.dep?s:Rt(s(f)),o.dep?o:Rt(o(f)))}),t.reflow(!0).modifies(a)}});function Qj(e,t){let n;return ce(e)?(n=i=>zf(e(i,t)),n.dep=JR(e)):n=Rt(zf(e||"#888")),n}function Zj(e,t){let n;return ce(e)?(n=i=>e(i,t),n.dep=JR(e)):e?n=Rt(e):(n=i=>i.$value/i.$max||0,n.dep=!0),n}function JR(e){if(!ce(e))return!1;const t=si(Ct(e));return t.$x||t.$y||t.$value||t.$max}function eq(e,t,n,i){const r=e.width,o=e.height,s=e.x1||0,a=e.y1||0,u=e.x2||r,l=e.y2||o,c=e.values,f=c?m=>c[m]:qr,d=no(u-s,l-a),h=d.getContext("2d"),g=h.getImageData(0,0,u-s,l-a),p=g.data;for(let m=a,y=0;m<l;++m){t.$y=m-a;for(let b=s,v=m*r;b<u;++b,y+=4){t.$x=b-s,t.$value=f(b+v);const x=n(t);p[y+0]=x.r,p[y+1]=x.g,p[y+2]=x.b,p[y+3]=~~(255*i(t))}}return h.putImageData(g,0,0),d}function QR(e){R.call(this,null,e),this.modified(!0)}H(QR,R,{transform(e,t){let n=this.value;return!n||e.modified("type")?(this.value=n=nq(e.type),D0.forEach(i=>{e[i]!=null&&$S(n,i,e[i])})):D0.forEach(i=>{e.modified(i)&&$S(n,i,e[i])}),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&tq(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function tq(e,t){const n=iq(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}function nq(e){const t=yv((e||"mercator").toLowerCase());return t||M("Unrecognized projection type: "+e),t()}function $S(e,t,n){ce(e[t])&&e[t](n)}function iq(e){return e=K(e),e.length===1?e[0]:{type:Ev,features:e.reduce((t,n)=>t.concat(rq(n)),[])}}function rq(e){return e.type===Ev?e.features:K(e).filter(t=>t!=null).map(t=>t.type===T0?t:{type:T0,geometry:t})}const oq=Object.freeze(Object.defineProperty({__proto__:null,contour:xv,geojson:wv,geopath:Sv,geopoint:$v,geoshape:Av,graticule:kv,heatmap:Cv,isocontour:bv,kde2d:vv,projection:QR},Symbol.toStringTag,{value:"Module"})),AS={center:II,collide:nP,nbody:hP,link:rP,x:gP,y:pP},Xu="forces",N0=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],sq=["static","iterations"],ZR=["x","y","vx","vy"];function Fv(e){R.call(this,null,e)}Fv.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:ZR}]};H(Fv,R,{transform(e,t){var n=this.value,i=t.changed(t.ADD_REM),r=e.modified(N0),o=e.iterations||300;if(n?(i&&(t.modifies("index"),n.nodes(t.source)),(r||t.changed(t.MOD))&&eM(n,e,0,t)):(this.value=n=uq(t.source,e),n.on("tick",aq(t.dataflow,this)),e.static||(i=!0,n.tick()),t.modifies("index")),r||i||e.modified(sq)||t.changed()&&e.restart){if(n.alpha(Math.max(n.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(n.alphaMin(),1/o)),e.static)for(n.stop();--o>=0;)n.tick();else if(n.stopped()&&n.restart(),!i)return t.StopPropagation}return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let a=this._argops,u=0,l=a.length,c;u<l;++u)if(c=a[u],!(c.name!==Xu||c.op._argval.force!=="link")){for(var i=c.op._argops,r=0,o=i.length,s;r<o;++r)if(i[r].name==="links"&&(s=i[r].op.source)){n.pulse(s,n.changeset().reflow());break}}return t.reflow(e.modified()).modifies(ZR)}});function aq(e,t){return()=>e.touch(t).run()}function uq(e,t){const n=dP(e),i=n.stop,r=n.restart;let o=!1;return n.stopped=()=>o,n.restart=()=>(o=!1,r()),n.stop=()=>(o=!0,i()),eM(n,t,!0).on("end",()=>o=!0)}function eM(e,t,n,i){var r=K(t.forces),o,s,a,u;for(o=0,s=N0.length;o<s;++o)a=N0[o],a!==Xu&&t.modified(a)&&e[a](t[a]);for(o=0,s=r.length;o<s;++o)u=Xu+o,a=n||t.modified(Xu,o)?cq(r[o]):i&&lq(r[o],i)?e.force(u):null,a&&e.force(u,a);for(s=e.numForces||0;o<s;++o)e.force(Xu+o,null);return e.numForces=r.length,e}function lq(e,t){var n,i;for(n in e)if(ce(i=e[n])&&t.modified(Ct(i)))return 1;return 0}function cq(e){var t,n;J(AS,e.force)||M("Unrecognized force: "+e.force),t=AS[e.force]();for(n in e)ce(t[n])&&fq(t[n],e[n],e);return t}function fq(e,t,n){e(ce(t)?i=>t(i,n):t)}const dq=Object.freeze(Object.defineProperty({__proto__:null,force:Fv},Symbol.toStringTag,{value:"Module"}));function L0(e,t,n){const i={};return e.each(r=>{const o=r.data;n(o)&&(i[t(o)]=r)}),e.lookup=i,e}function _v(e){R.call(this,null,e)}_v.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const hq=e=>e.values;H(_v,R,{transform(e,t){t.source||M("Nest transform requires an upstream data source.");var n=e.generate,i=e.modified(),r=t.clone(),o=this.value;return(!o||i||t.changed())&&(o&&o.each(s=>{s.children&&vh(s.data)&&r.rem.push(s.data)}),this.value=o=BL({values:K(e.keys).reduce((s,a)=>(s.key(a),s),gq()).entries(r.source)},hq),n&&o.each(s=>{s.children&&(s=Se(s.data),r.add.push(s),r.source.push(s))}),L0(o,ne,ne)),r.source.root=o,r}});function gq(){const e=[],t={entries:r=>i(n(r,0),0),key:r=>(e.push(r),t)};function n(r,o){if(o>=e.length)return r;const s=r.length,a=e[o++],u={},l={};let c=-1,f,d,h;for(;++c<s;)f=a(d=r[c])+"",(h=u[f])?h.push(d):u[f]=[d];for(f in u)l[f]=n(u[f],o);return l}function i(r,o){if(++o>e.length)return r;const s=[];for(const a in r)s.push({key:a,values:i(r[a],o)});return s}return t}function Ar(e){R.call(this,null,e)}const pq=(e,t)=>e.parent===t.parent?1:2;H(Ar,R,{transform(e,t){(!t.source||!t.source.root)&&M(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),i=this.fields,r=t.source.root,o=e.as||i;e.field?r.sum(e.field):r.count(),e.sort&&r.sort(ws(e.sort,s=>s.data)),mq(n,this.params,e),n.separation&&n.separation(e.separation!==!1?pq:qa);try{this.value=n(r)}catch(s){M(s)}return r.each(s=>yq(s,i,o)),t.reflow(e.modified()).modifies(o).modifies("leaf")}});function mq(e,t,n){for(let i,r=0,o=t.length;r<o;++r)i=t[r],i in n&&e[i](n[i])}function yq(e,t,n){const i=e.data,r=t.length-1;for(let o=0;o<r;++o)i[n[o]]=e[t[o]];i[n[r]]=e.children?e.children.length:0}const I0=["x","y","r","depth","children"];function Ov(e){Ar.call(this,e)}Ov.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:I0.length,default:I0}]};H(Ov,Ar,{layout:Wz,params:["radius","size","padding"],fields:I0});const P0=["x0","y0","x1","y1","depth","children"];function Rv(e){Ar.call(this,e)}Rv.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:P0.length,default:P0}]};H(Rv,Ar,{layout:Gz,params:["size","round","padding"],fields:P0});function Mv(e){R.call(this,null,e)}Mv.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]};H(Mv,R,{transform(e,t){t.source||M("Stratify transform requires an upstream data source.");let n=this.value;const i=e.modified(),r=t.fork(t.ALL).materialize(t.SOURCE),o=!n||i||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return r.source=r.source.slice(),o&&(n=r.source.length?L0(cw().id(e.key).parentId(e.parentKey)(r.source),e.key,Pn):L0(cw()([{}]),e.key,e.key)),r.source.root=this.value=n,r}});const kS={tidy:t6,cluster:Mz},z0=["x","y","depth","children"];function Dv(e){Ar.call(this,e)}Dv.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:z0.length,default:z0}]};H(Dv,Ar,{layout(e){const t=e||"tidy";if(J(kS,t))return kS[t]();M("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:z0});function Tv(e){R.call(this,[],e)}Tv.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]};H(Tv,R,{transform(e,t){const n=this.value,i=t.source&&t.source.root,r=t.fork(t.NO_SOURCE),o={};return i||M("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(r.rem=n,t.visit(t.SOURCE,s=>o[ne(s)]=1),i.each(s=>{const a=s.data,u=s.parent&&s.parent.data;u&&o[ne(a)]&&o[ne(u)]&&r.add.push(Se({source:u,target:a}))}),this.value=r.add):t.changed(t.MOD)&&(t.visit(t.MOD,s=>o[ne(s)]=1),n.forEach(s=>{(o[ne(s.source)]||o[ne(s.target)])&&r.mod.push(s)})),r}});const CS={binary:n6,dice:sh,slice:G1,slicedice:i6,squarify:jL,resquarify:r6},B0=["x0","y0","x1","y1","depth","children"];function Nv(e){Ar.call(this,e)}Nv.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:B0.length,default:B0}]};H(Nv,Ar,{layout(){const e=UL();return e.ratio=t=>{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{J(CS,t)?e.tile(CS[t]):M("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:B0});const bq=Object.freeze(Object.defineProperty({__proto__:null,nest:_v,pack:Ov,partition:Rv,stratify:Mv,tree:Dv,treelinks:Tv,treemap:Nv},Symbol.toStringTag,{value:"Module"})),Cp=4278190080;function vq(e,t){const n=e.bitmap();return(t||[]).forEach(i=>n.set(e(i.boundary[0]),e(i.boundary[3]))),[n,void 0]}function xq(e,t,n,i,r){const o=e.width,s=e.height,a=i||r,u=no(o,s).getContext("2d"),l=no(o,s).getContext("2d"),c=a&&no(o,s).getContext("2d");n.forEach($=>_f(u,$,!1)),_f(l,t,!1),a&&_f(c,t,!0);const f=Fp(u,o,s),d=Fp(l,o,s),h=a&&Fp(c,o,s),g=e.bitmap(),p=a&&e.bitmap();let m,y,b,v,x,w,S,E;for(y=0;y<s;++y)for(m=0;m<o;++m)x=y*o+m,w=f[x]&Cp,E=d[x]&Cp,S=a&&h[x]&Cp,(w||S||E)&&(b=e(m),v=e(y),!r&&(w||E)&&g.set(b,v),a&&(w||S)&&p.set(b,v));return[g,p]}function Fp(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function _f(e,t,n){if(!t.length)return;const i=t[0].mark.marktype;i==="group"?t.forEach(r=>{r.items.forEach(o=>_f(e,o.items,n))}):An[i].draw(e,{items:n?t.map(Eq):t})}function Eq(e){const t=xh(e,{});return t.stroke&&t.strokeOpacity!==0||t.fill&&t.fillOpacity!==0?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const ir=5,Dt=31,Al=32,Br=new Uint32Array(Al+1),Jn=new Uint32Array(Al+1);Jn[0]=0;Br[0]=~Jn[0];for(let e=1;e<=Al;++e)Jn[e]=Jn[e-1]<<1|1,Br[e]=~Jn[e];function wq(e,t){const n=new Uint32Array(~~((e*t+Al)/Al));function i(o,s){n[o]|=s}function r(o,s){n[o]&=s}return{array:n,get:(o,s)=>{const a=s*e+o;return n[a>>>ir]&1<<(a&Dt)},set:(o,s)=>{const a=s*e+o;i(a>>>ir,1<<(a&Dt))},clear:(o,s)=>{const a=s*e+o;r(a>>>ir,~(1<<(a&Dt)))},getRange:(o,s,a,u)=>{let l=u,c,f,d,h;for(;l>=s;--l)if(c=l*e+o,f=l*e+a,d=c>>>ir,h=f>>>ir,d===h){if(n[d]&Br[c&Dt]&Jn[(f&Dt)+1])return!0}else{if(n[d]&Br[c&Dt]||n[h]&Jn[(f&Dt)+1])return!0;for(let g=d+1;g<h;++g)if(n[g])return!0}return!1},setRange:(o,s,a,u)=>{let l,c,f,d,h;for(;s<=u;++s)if(l=s*e+o,c=s*e+a,f=l>>>ir,d=c>>>ir,f===d)i(f,Br[l&Dt]&Jn[(c&Dt)+1]);else for(i(f,Br[l&Dt]),i(d,Jn[(c&Dt)+1]),h=f+1;h<d;++h)i(h,4294967295)},clearRange:(o,s,a,u)=>{let l,c,f,d,h;for(;s<=u;++s)if(l=s*e+o,c=s*e+a,f=l>>>ir,d=c>>>ir,f===d)r(f,Jn[l&Dt]|Br[(c&Dt)+1]);else for(r(f,Jn[l&Dt]),r(d,Br[(c&Dt)+1]),h=f+1;h<d;++h)r(h,0)},outOfBounds:(o,s,a,u)=>o<0||s<0||u>=t||a>=e}}function Sq(e,t,n){const i=Math.max(1,Math.sqrt(e*t/1e6)),r=~~((e+2*n+i)/i),o=~~((t+2*n+i)/i),s=a=>~~((a+n)/i);return s.invert=a=>a*i-n,s.bitmap=()=>wq(r,o),s.ratio=i,s.padding=n,s.width=e,s.height=t,s}function $q(e,t,n,i){const r=e.width,o=e.height;return function(s){const a=s.datum.datum.items[i].items,u=a.length,l=s.datum.fontSize,c=vn.width(s.datum,s.datum.text);let f=0,d,h,g,p,m,y,b;for(let v=0;v<u;++v)d=a[v].x,g=a[v].y,h=a[v].x2===void 0?d:a[v].x2,p=a[v].y2===void 0?g:a[v].y2,m=(d+h)/2,y=(g+p)/2,b=Math.abs(h-d+p-g),b>=f&&(f=b,s.x=m,s.y=y);return m=c/2,y=l/2,d=s.x-m,h=s.x+m,g=s.y-y,p=s.y+y,s.align="center",d<0&&h<=r?s.align="left":0<=d&&r<h&&(s.align="right"),s.baseline="middle",g<0&&p<=o?s.baseline="top":0<=g&&o<p&&(s.baseline="bottom"),!0}}function Dd(e,t,n,i,r,o){let s=n/2;return e-s<0||e+s>r||t-(s=i/2)<0||t+s>o}function Qr(e,t,n,i,r,o,s,a){const u=r*o/(i*2),l=e(t-u),c=e(t+u),f=e(n-(o=o/2)),d=e(n+o);return s.outOfBounds(l,f,c,d)||s.getRange(l,f,c,d)||a&&a.getRange(l,f,c,d)}function Aq(e,t,n,i){const r=e.width,o=e.height,s=t[0],a=t[1];function u(l,c,f,d,h){const g=e.invert(l),p=e.invert(c);let m=f,y=o,b;if(!Dd(g,p,d,h,r,o)&&!Qr(e,g,p,h,d,m,s,a)&&!Qr(e,g,p,h,d,h,s,null)){for(;y-m>=1;)b=(m+y)/2,Qr(e,g,p,h,d,b,s,a)?y=b:m=b;if(m>f)return[g,p,m,!0]}}return function(l){const c=l.datum.datum.items[i].items,f=c.length,d=l.datum.fontSize,h=vn.width(l.datum,l.datum.text);let g=n?d:0,p=!1,m=!1,y=0,b,v,x,w,S,E,$,A,C,F,I,j,O,k,_,N,W;for(let P=0;P<f;++P){for(b=c[P].x,x=c[P].y,v=c[P].x2===void 0?b:c[P].x2,w=c[P].y2===void 0?x:c[P].y2,b>v&&(W=b,b=v,v=W),x>w&&(W=x,x=w,w=W),C=e(b),I=e(v),F=~~((C+I)/2),j=e(x),k=e(w),O=~~((j+k)/2),$=F;$>=C;--$)for(A=O;A>=j;--A)N=u($,A,g,h,d),N&&([l.x,l.y,g,p]=N);for($=F;$<=I;++$)for(A=O;A<=k;++A)N=u($,A,g,h,d),N&&([l.x,l.y,g,p]=N);!p&&!n&&(_=Math.abs(v-b+w-x),S=(b+v)/2,E=(x+w)/2,_>=y&&!Dd(S,E,h,d,r,o)&&!Qr(e,S,E,d,h,d,s,null)&&(y=_,l.x=S,l.y=E,m=!0))}return p||m?(S=h/2,E=d/2,s.setRange(e(l.x-S),e(l.y-E),e(l.x+S),e(l.y+E)),l.align="center",l.baseline="middle",!0):!1}}const kq=[-1,-1,1,1],Cq=[-1,1,-1,1];function Fq(e,t,n,i){const r=e.width,o=e.height,s=t[0],a=t[1],u=e.bitmap();return function(l){const c=l.datum.datum.items[i].items,f=c.length,d=l.datum.fontSize,h=vn.width(l.datum,l.datum.text),g=[];let p=n?d:0,m=!1,y=!1,b=0,v,x,w,S,E,$,A,C,F,I,j,O;for(let k=0;k<f;++k){for(v=c[k].x,w=c[k].y,x=c[k].x2===void 0?v:c[k].x2,S=c[k].y2===void 0?w:c[k].y2,g.push([e((v+x)/2),e((w+S)/2)]);g.length;)if([A,C]=g.pop(),!(s.get(A,C)||a.get(A,C)||u.get(A,C))){u.set(A,C);for(let _=0;_<4;++_)E=A+kq[_],$=C+Cq[_],u.outOfBounds(E,$,E,$)||g.push([E,$]);if(E=e.invert(A),$=e.invert(C),F=p,I=o,!Dd(E,$,h,d,r,o)&&!Qr(e,E,$,d,h,F,s,a)&&!Qr(e,E,$,d,h,d,s,null)){for(;I-F>=1;)j=(F+I)/2,Qr(e,E,$,d,h,j,s,a)?I=j:F=j;F>p&&(l.x=E,l.y=$,p=F,m=!0)}}!m&&!n&&(O=Math.abs(x-v+S-w),E=(v+x)/2,$=(w+S)/2,O>=b&&!Dd(E,$,h,d,r,o)&&!Qr(e,E,$,d,h,d,s,null)&&(b=O,l.x=E,l.y=$,y=!0))}return m||y?(E=h/2,$=d/2,s.setRange(e(l.x-E),e(l.y-$),e(l.x+E),e(l.y+$)),l.align="center",l.baseline="middle",!0):!1}}const _q=["right","center","left"],Oq=["bottom","middle","top"];function Rq(e,t,n,i){const r=e.width,o=e.height,s=t[0],a=t[1],u=i.length;return function(l){const c=l.boundary,f=l.datum.fontSize;if(c[2]<0||c[5]<0||c[0]>r||c[3]>o)return!1;let d=l.textWidth??0,h,g,p,m,y,b,v,x,w,S,E,$,A,C,F;for(let I=0;I<u;++I){if(h=(n[I]&3)-1,g=(n[I]>>>2&3)-1,p=h===0&&g===0||i[I]<0,m=h&&g?Math.SQRT1_2:1,y=i[I]<0?-1:1,b=c[1+h]+i[I]*h*m,E=c[4+g]+y*f*g/2+i[I]*g*m,x=E-f/2,w=E+f/2,$=e(b),C=e(x),F=e(w),!d)if(FS($,$,C,F,s,a,b,b,x,w,c,p))d=vn.width(l.datum,l.datum.text);else continue;if(S=b+y*d*h/2,b=S-d/2,v=S+d/2,$=e(b),A=e(v),FS($,A,C,F,s,a,b,v,x,w,c,p))return l.x=h?h*y<0?v:b:S,l.y=g?g*y<0?w:x:E,l.align=_q[h*y+1],l.baseline=Oq[g*y+1],s.setRange($,C,A,F),!0}return!1}}function FS(e,t,n,i,r,o,s,a,u,l,c,f){return!(r.outOfBounds(e,n,t,i)||(f&&o||r).getRange(e,n,t,i))}const _p=0,Op=4,Rp=8,Mp=0,Dp=1,Tp=2,Mq={"top-left":_p+Mp,top:_p+Dp,"top-right":_p+Tp,left:Op+Mp,middle:Op+Dp,right:Op+Tp,"bottom-left":Rp+Mp,bottom:Rp+Dp,"bottom-right":Rp+Tp},Dq={naive:$q,"reduced-search":Aq,floodfill:Fq};function Tq(e,t,n,i,r,o,s,a,u,l,c){if(!e.length)return e;const f=Math.max(i.length,r.length),d=Nq(i,f),h=Lq(r,f),g=Iq(e[0].datum),p=g==="group"&&e[0].datum.items[u].marktype,m=p==="area",y=Pq(g,p,a,u),b=l===null||l===1/0,v=m&&c==="naive";let x=-1,w=-1;const S=e.map(C=>{const F=b?vn.width(C,C.text):void 0;return x=Math.max(x,F),w=Math.max(w,C.fontSize),{datum:C,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:y(C),textWidth:F}});l=l===null||l===1/0?Math.max(x,w)+Math.max(...i):l;const E=Sq(t[0],t[1],l);let $;if(!v){n&&S.sort((I,j)=>n(I.datum,j.datum));let C=!1;for(let I=0;I<h.length&&!C;++I)C=h[I]===5||d[I]<0;const F=(g&&s||m)&&e.map(I=>I.datum);$=o.length||F?xq(E,F||[],o,C,m):vq(E,s&&S)}const A=m?Dq[c](E,$,s,u):Rq(E,$,h,d);return S.forEach(C=>C.opacity=+A(C)),S}function Nq(e,t){const n=new Float64Array(t),i=e.length;for(let r=0;r<i;++r)n[r]=e[r]||0;for(let r=i;r<t;++r)n[r]=n[i-1];return n}function Lq(e,t){const n=new Int8Array(t),i=e.length;for(let r=0;r<i;++r)n[r]|=Mq[e[r]];for(let r=i;r<t;++r)n[r]=n[i-1];return n}function Iq(e){return e&&e.mark&&e.mark.marktype}function Pq(e,t,n,i){const r=o=>[o.x,o.x,o.x,o.y,o.y,o.y];return e?e==="line"||e==="area"?o=>r(o.datum):t==="line"?o=>{const s=o.datum.items[i].items;return r(s.length?s[n==="start"?0:s.length-1]:{x:NaN,y:NaN})}:o=>{const s=o.datum.bounds;return[s.x1,(s.x1+s.x2)/2,s.x2,s.y1,(s.y1+s.y2)/2,s.y2]}:r}const U0=["x","y","opacity","align","baseline"],tM=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function Lv(e){R.call(this,null,e)}Lv.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:tM},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:U0.length,default:U0}]};H(Lv,R,{transform(e,t){function n(o){const s=e[o];return ce(s)&&t.modified(s.fields)}const i=e.modified();if(!(i||t.changed(t.ADD_REM)||n("sort")))return;(!e.size||e.size.length!==2)&&M("Size parameter should be specified as a [width, height] array.");const r=e.as||U0;return Tq(t.materialize(t.SOURCE).source||[],e.size,e.sort,K(e.offset==null?1:e.offset),K(e.anchor||tM),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||"end",e.markIndex||0,e.padding===void 0?0:e.padding,e.method||"naive").forEach(o=>{const s=o.datum;s[r[0]]=o.x,s[r[1]]=o.y,s[r[2]]=o.opacity,s[r[3]]=o.align,s[r[4]]=o.baseline}),t.reflow(i).modifies(r)}});const zq=Object.freeze(Object.defineProperty({__proto__:null,label:Lv},Symbol.toStringTag,{value:"Module"}));function nM(e,t){var n=[],i=function(c){return c(a)},r,o,s,a,u,l;if(t==null)n.push(e);else for(r={},o=0,s=e.length;o<s;++o)a=e[o],u=t.map(i),l=r[u],l||(r[u]=l=[],l.dims=u,n.push(l)),l.push(a);return n}function Iv(e){R.call(this,null,e)}Iv.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]};H(Iv,R,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=t.materialize(t.SOURCE).source,r=nM(i,e.groupby),o=(e.groupby||[]).map(Ge),s=o.length,a=e.as||[Ge(e.x),Ge(e.y)],u=[];r.forEach(l=>{p_(l,e.x,e.y,e.bandwidth||.3).forEach(c=>{const f={};for(let d=0;d<s;++d)f[o[d]]=l.dims[d];f[a[0]]=c[0],f[a[1]]=c[1],u.push(Se(f))})}),this.value&&(n.rem=this.value),this.value=n.add=n.source=u}return n}});const j0={constant:Yy,linear:Ky,log:f_,exp:d_,pow:h_,quad:Jy,poly:g_},Bq=(e,t)=>e==="poly"?t:e==="quad"?2:1;function Pv(e){R.call(this,null,e)}Pv.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(j0)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]};H(Pv,R,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const i=t.materialize(t.SOURCE).source,r=nM(i,e.groupby),o=(e.groupby||[]).map(Ge),s=e.method||"linear",a=e.order==null?3:e.order,u=Bq(s,a),l=e.as||[Ge(e.x),Ge(e.y)],c=j0[s],f=[];let d=e.extent;J(j0,s)||M("Invalid regression method: "+s),d!=null&&s==="log"&&d[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),r.forEach(h=>{if(h.length<=u){t.dataflow.warn("Skipping regression with more parameters than data points.");return}const p=c(h,e.x,e.y,a);if(e.params){f.push(Se({keys:h.dims,coef:p.coef,rSquared:p.rSquared}));return}const m=d||Ii(h,e.x),y=b=>{const v={};for(let x=0;x<o.length;++x)v[o[x]]=h.dims[x];v[l[0]]=b[0],v[l[1]]=b[1],f.push(Se(v))};s==="linear"||s==="constant"?m.forEach(b=>y([b,p.predict(b)])):Ch(p.predict,m,25,200).forEach(y)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n}});const Uq=Object.freeze(Object.defineProperty({__proto__:null,loess:Iv,regression:Pv},Symbol.toStringTag,{value:"Module"}));function zv(e){R.call(this,null,e)}zv.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const jq=[-1e5,-1e5,1e5,1e5];H(zv,R,{transform(e,t){const n=e.as||"path",i=t.source;if(!i||!i.length)return t;let r=e.size;r=r?[0,0,r[0],r[1]]:(r=e.extent)?[r[0][0],r[0][1],r[1][0],r[1][1]]:jq;const o=this.value=Y1.from(i,e.x,e.y).voronoi(r);for(let s=0,a=i.length;s<a;++s){const u=o.cellPolygon(s);i[s][n]=u&&!Wq(u)?qq(u):null}return t.reflow(e.modified()).modifies(n)}});function qq(e){const t=e[0][0],n=e[0][1];let i=e.length-1;for(;e[i][0]===t&&e[i][1]===n;--i);return"M"+e.slice(0,i+1).join("L")+"Z"}function Wq(e){return e.length===2&&e[0][0]===e[1][0]&&e[0][1]===e[1][1]}const Gq=Object.freeze(Object.defineProperty({__proto__:null,voronoi:zv},Symbol.toStringTag,{value:"Module"}));var Np=Math.PI/180,Yu=64,Of=2048;function Hq(){var e=[256,256],t,n,i,r,o,s,a,u=iM,l=[],c=Math.random,f={};f.layout=function(){for(var g=d(no()),p=Qq((e[0]>>5)*e[1]),m=null,y=l.length,b=-1,v=[],x=l.map(S=>({text:t(S),font:n(S),style:r(S),weight:o(S),rotate:s(S),size:~~(i(S)+1e-14),padding:a(S),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:S})).sort((S,E)=>E.size-S.size);++b<y;){var w=x[b];w.x=e[0]*(c()+.5)>>1,w.y=e[1]*(c()+.5)>>1,Vq(g,w,x,b),w.hasText&&h(p,w,m)&&(v.push(w),m?Yq(m,w):m=[{x:w.x+w.x0,y:w.y+w.y0},{x:w.x+w.x1,y:w.y+w.y1}],w.x-=e[0]>>1,w.y-=e[1]>>1)}return v};function d(g){g.width=g.height=1;var p=Math.sqrt(g.getContext("2d").getImageData(0,0,1,1).data.length>>2);g.width=(Yu<<5)/p,g.height=Of/p;var m=g.getContext("2d");return m.fillStyle=m.strokeStyle="red",m.textAlign="center",{context:m,ratio:p}}function h(g,p,m){for(var y=p.x,b=p.y,v=Math.hypot(e[0],e[1]),x=u(e),w=c()<.5?1:-1,S=-w,E,$,A;(E=x(S+=w))&&($=~~E[0],A=~~E[1],!(Math.min(Math.abs($),Math.abs(A))>=v));)if(p.x=y+$,p.y=b+A,!(p.x+p.x0<0||p.y+p.y0<0||p.x+p.x1>e[0]||p.y+p.y1>e[1])&&(!m||!Xq(p,g,e[0]))&&(!m||Kq(p,m))){for(var C=p.sprite,F=p.width>>5,I=e[0]>>5,j=p.x-(F<<4),O=j&127,k=32-O,_=p.y1-p.y0,N=(p.y+p.y0)*I+(j>>5),W,P=0;P<_;P++){W=0;for(var Q=0;Q<=F;Q++)g[N+Q]|=W<<k|(Q<F?(W=C[P*F+Q])>>>O:0);N+=I}return p.sprite=null,!0}return!1}return f.words=function(g){return arguments.length?(l=g,f):l},f.size=function(g){return arguments.length?(e=[+g[0],+g[1]],f):e},f.font=function(g){return arguments.length?(n=Co(g),f):n},f.fontStyle=function(g){return arguments.length?(r=Co(g),f):r},f.fontWeight=function(g){return arguments.length?(o=Co(g),f):o},f.rotate=function(g){return arguments.length?(s=Co(g),f):s},f.text=function(g){return arguments.length?(t=Co(g),f):t},f.spiral=function(g){return arguments.length?(u=Zq[g]||g,f):u},f.fontSize=function(g){return arguments.length?(i=Co(g),f):i},f.padding=function(g){return arguments.length?(a=Co(g),f):a},f.random=function(g){return arguments.length?(c=g,f):c},f}function Vq(e,t,n,i){if(!t.sprite){var r=e.context,o=e.ratio;r.clearRect(0,0,(Yu<<5)/o,Of/o);var s=0,a=0,u=0,l=n.length,c,f,d,h,g;for(--i;++i<l;){if(t=n[i],r.save(),r.font=t.style+" "+t.weight+" "+~~((t.size+1)/o)+"px "+t.font,c=r.measureText(t.text+"m").width*o,d=t.size<<1,t.rotate){var p=Math.sin(t.rotate*Np),m=Math.cos(t.rotate*Np),y=c*m,b=c*p,v=d*m,x=d*p;c=Math.max(Math.abs(y+x),Math.abs(y-x))+31>>5<<5,d=~~Math.max(Math.abs(b+v),Math.abs(b-v))}else c=c+31>>5<<5;if(d>u&&(u=d),s+c>=Yu<<5&&(s=0,a+=u,u=0),a+d>=Of)break;r.translate((s+(c>>1))/o,(a+(d>>1))/o),t.rotate&&r.rotate(t.rotate*Np),r.fillText(t.text,0,0),t.padding&&(r.lineWidth=2*t.padding,r.strokeText(t.text,0,0)),r.restore(),t.width=c,t.height=d,t.xoff=s,t.yoff=a,t.x1=c>>1,t.y1=d>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,s+=c}for(var w=r.getImageData(0,0,(Yu<<5)/o,Of/o).data,S=[];--i>=0;)if(t=n[i],!!t.hasText){for(c=t.width,f=c>>5,d=t.y1-t.y0,h=0;h<d*f;h++)S[h]=0;if(s=t.xoff,s==null)return;a=t.yoff;var E=0,$=-1;for(g=0;g<d;g++){for(h=0;h<c;h++){var A=f*g+(h>>5),C=w[(a+g)*(Yu<<5)+(s+h)<<2]?1<<31-h%32:0;S[A]|=C,E|=C}E?$=g:(t.y0++,d--,g--,a++)}t.y1=t.y0+$,t.sprite=S.slice(0,(t.y1-t.y0)*f)}}}function Xq(e,t,n){n>>=5;for(var i=e.sprite,r=e.width>>5,o=e.x-(r<<4),s=o&127,a=32-s,u=e.y1-e.y0,l=(e.y+e.y0)*n+(o>>5),c,f=0;f<u;f++){c=0;for(var d=0;d<=r;d++)if((c<<a|(d<r?(c=i[f*r+d])>>>s:0))&t[l+d])return!0;l+=n}return!1}function Yq(e,t){var n=e[0],i=e[1];t.x+t.x0<n.x&&(n.x=t.x+t.x0),t.y+t.y0<n.y&&(n.y=t.y+t.y0),t.x+t.x1>i.x&&(i.x=t.x+t.x1),t.y+t.y1>i.y&&(i.y=t.y+t.y1)}function Kq(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0<t[1].x&&e.y+e.y1>t[0].y&&e.y+e.y0<t[1].y}function iM(e){var t=e[0]/e[1];return function(n){return[t*(n*=.1)*Math.cos(n),n*Math.sin(n)]}}function Jq(e){var t=4,n=t*e[0]/e[1],i=0,r=0;return function(o){var s=o<0?-1:1;switch(Math.sqrt(1+4*s*o)-s&3){case 0:i+=n;break;case 1:r+=t;break;case 2:i-=n;break;default:r-=t;break}return[i,r]}}function Qq(e){for(var t=[],n=-1;++n<e;)t[n]=0;return t}function Co(e){return typeof e=="function"?e:function(){return e}}var Zq={archimedean:iM,rectangular:Jq};const rM=["x","y","font","fontSize","fontStyle","fontWeight","angle"],eW=["text","font","rotate","fontSize","fontStyle","fontWeight"];function Bv(e){R.call(this,Hq(),e)}Bv.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:rM}]};H(Bv,R,{transform(e,t){e.size&&!(e.size[0]&&e.size[1])&&M("Wordcloud size dimensions must be non-zero.");function n(g){const p=e[g];return ce(p)&&t.modified(p.fields)}const i=e.modified();if(!(i||t.changed(t.ADD_REM)||eW.some(n)))return;const r=t.materialize(t.SOURCE).source,o=this.value,s=e.as||rM;let a=e.fontSize||14,u;if(ce(a)?u=e.fontSizeRange:a=Rt(a),u){const g=a,p=we("sqrt")().domain(Ii(r,g)).range(u);a=m=>p(g(m))}r.forEach(g=>{g[s[0]]=NaN,g[s[1]]=NaN,g[s[3]]=0});const l=o.words(r).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(a).random(Bn).layout(),c=o.size(),f=c[0]>>1,d=c[1]>>1,h=l.length;for(let g=0,p,m;g<h;++g)p=l[g],m=p.datum,m[s[0]]=p.x+f,m[s[1]]=p.y+d,m[s[2]]=p.font,m[s[3]]=p.size,m[s[4]]=p.style,m[s[5]]=p.weight,m[s[6]]=p.rotate;return t.reflow(i).modifies(s)}});const tW=Object.freeze(Object.defineProperty({__proto__:null,wordcloud:Bv},Symbol.toStringTag,{value:"Module"})),nW=e=>new Uint8Array(e),iW=e=>new Uint16Array(e),ul=e=>new Uint32Array(e);function rW(){let e=8,t=[],n=ul(0),i=Yc(0,e),r=Yc(0,e);return{data:()=>t,seen:()=>n=oW(n,t.length),add(o){for(let s=0,a=t.length,u=o.length,l;s<u;++s)l=o[s],l._index=a++,t.push(l)},remove(o,s){const a=t.length,u=Array(a-o),l=t;let c,f,d;for(f=0;!s[f]&&f<a;++f)u[f]=t[f],l[f]=f;for(d=f;f<a;++f)c=t[f],s[f]?l[f]=-1:(l[f]=d,i[d]=i[f],r[d]=r[f],u[d]=c,c._index=d++),i[f]=0;return t=u,l},size:()=>t.length,curr:()=>i,prev:()=>r,reset:o=>r[o]=i[o],all:()=>e<257?255:e<65537?65535:4294967295,set(o,s){i[o]|=s},clear(o,s){i[o]&=~s},resize(o,s){const a=i.length;(o>a||s>e)&&(e=Math.max(s,e),i=Yc(o,e,i),r=Yc(o,e))}}}function oW(e,t,n){return e.length>=t?e:(n=n||new e.constructor(t),n.set(e),n)}function Yc(e,t,n){const i=(t<257?nW:t<65537?iW:ul)(e);return n&&i.set(n),i}function _S(e,t,n){const i=1<<t;return{one:i,zero:~i,range:n.slice(),bisect:e.bisect,index:e.index,size:e.size,onAdd(r,o){const s=this,a=s.bisect(s.range,r.value),u=r.index,l=a[0],c=a[1],f=u.length;let d;for(d=0;d<l;++d)o[u[d]]|=i;for(d=c;d<f;++d)o[u[d]]|=i;return s}}}function OS(){let e=ul(0),t=[],n=0;function i(a,u,l){if(!u.length)return[];const c=n,f=u.length,d=ul(f);let h=Array(f),g,p,m;for(m=0;m<f;++m)h[m]=a(u[m]),d[m]=m;if(h=sW(h,d),c)g=t,p=e,t=Array(c+f),e=ul(c+f),aW(l,g,p,c,h,d,f,t,e);else{if(l>0)for(m=0;m<f;++m)d[m]+=l;t=h,e=d}return n=c+f,{index:d,value:h}}function r(a,u){const l=n;let c,f,d;for(f=0;!u[e[f]]&&f<l;++f);for(d=f;f<l;++f)u[c=e[f]]||(e[d]=c,t[d]=t[f],++d);n=l-a}function o(a){for(let u=0,l=n;u<l;++u)e[u]=a[e[u]]}function s(a,u){let l;return u?l=u.length:(u=t,l=n),[W5(u,a[0],0,l),Mm(u,a[1],0,l)]}return{insert:i,remove:r,bisect:s,reindex:o,index:()=>e,size:()=>n}}function sW(e,t){return e.sort.call(t,(n,i)=>{const r=e[n],o=e[i];return r<o?-1:r>o?1:0}),GL(e,t)}function aW(e,t,n,i,r,o,s,a,u){let l=0,c=0,f;for(f=0;l<i&&c<s;++f)t[l]<r[c]?(a[f]=t[l],u[f]=n[l++]):(a[f]=r[c],u[f]=o[c++]+e);for(;l<i;++l,++f)a[f]=t[l],u[f]=n[l];for(;c<s;++c,++f)a[f]=r[c],u[f]=o[c]+e}function Uv(e){R.call(this,rW(),e),this._indices=null,this._dims=null}Uv.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]};H(Uv,R,{transform(e,t){if(this._dims){var n=e.modified("fields")||e.fields.some(i=>t.modified(i.fields));return n?this.reinit(e,t):this.eval(e,t)}else return this.init(e,t)},init(e,t){const n=e.fields,i=e.query,r=this._indices={},o=this._dims=[],s=i.length;let a=0,u,l;for(;a<s;++a)u=n[a].fname,l=r[u]||(r[u]=OS()),o.push(_S(l,a,i[a]));return this.eval(e,t)},reinit(e,t){const n=t.materialize().fork(),i=e.fields,r=e.query,o=this._indices,s=this._dims,a=this.value,u=a.curr(),l=a.prev(),c=a.all(),f=n.rem=n.add,d=n.mod,h=r.length,g={};let p,m,y,b,v,x,w,S,E;if(l.set(u),t.rem.length&&(v=this.remove(e,t,n)),t.add.length&&a.add(t.add),t.mod.length)for(x={},b=t.mod,w=0,S=b.length;w<S;++w)x[b[w]._index]=1;for(w=0;w<h;++w)E=i[w],(!s[w]||e.modified("fields",w)||t.modified(E.fields))&&(y=E.fname,(p=g[y])||(o[y]=m=OS(),g[y]=p=m.insert(E,t.source,0)),s[w]=_S(m,w,r[w]).onAdd(p,u));for(w=0,S=a.data().length;w<S;++w)v[w]||(l[w]!==u[w]?f.push(w):x[w]&&u[w]!==c&&d.push(w));return a.mask=(1<<h)-1,n},eval(e,t){const n=t.materialize().fork(),i=this._dims.length;let r=0;return t.rem.length&&(this.remove(e,t,n),r|=(1<<i)-1),e.modified("query")&&!e.modified("fields")&&(r|=this.update(e,t,n)),t.add.length&&(this.insert(e,t,n),r|=(1<<i)-1),t.mod.length&&(this.modify(t,n),r|=(1<<i)-1),this.value.mask=r,n},insert(e,t,n){const i=t.add,r=this.value,o=this._dims,s=this._indices,a=e.fields,u={},l=n.add,c=r.size()+i.length,f=o.length;let d=r.size(),h,g,p;r.resize(c,f),r.add(i);const m=r.curr(),y=r.prev(),b=r.all();for(h=0;h<f;++h)g=a[h].fname,p=u[g]||(u[g]=s[g].insert(a[h],i,d)),o[h].onAdd(p,m);for(;d<c;++d)y[d]=b,m[d]!==b&&l.push(d)},modify(e,t){const n=t.mod,i=this.value,r=i.curr(),o=i.all(),s=e.mod;let a,u,l;for(a=0,u=s.length;a<u;++a)l=s[a]._index,r[l]!==o&&n.push(l)},remove(e,t,n){const i=this._indices,r=this.value,o=r.curr(),s=r.prev(),a=r.all(),u={},l=n.rem,c=t.rem;let f,d,h,g;for(f=0,d=c.length;f<d;++f)h=c[f]._index,u[h]=1,s[h]=g=o[h],o[h]=a,g!==a&&l.push(h);for(h in i)i[h].remove(d,u);return this.reindex(t,d,u),u},reindex(e,t,n){const i=this._indices,r=this.value;e.runAfter(()=>{const o=r.remove(t,n);for(const s in i)i[s].reindex(o)})},update(e,t,n){const i=this._dims,r=e.query,o=t.stamp,s=i.length;let a=0,u,l;for(n.filters=0,l=0;l<s;++l)e.modified("query",l)&&(u=l,++a);if(a===1)a=i[u].one,this.incrementOne(i[u],r[u],n.add,n.rem);else for(l=0,a=0;l<s;++l)e.modified("query",l)&&(a|=i[l].one,this.incrementAll(i[l],r[l],o,n.add),n.rem=n.add);return a},incrementAll(e,t,n,i){const r=this.value,o=r.seen(),s=r.curr(),a=r.prev(),u=e.index(),l=e.bisect(e.range),c=e.bisect(t),f=c[0],d=c[1],h=l[0],g=l[1],p=e.one;let m,y,b;if(f<h)for(m=f,y=Math.min(h,d);m<y;++m)b=u[m],o[b]!==n&&(a[b]=s[b],o[b]=n,i.push(b)),s[b]^=p;else if(f>h)for(m=h,y=Math.min(f,g);m<y;++m)b=u[m],o[b]!==n&&(a[b]=s[b],o[b]=n,i.push(b)),s[b]^=p;if(d>g)for(m=Math.max(f,g),y=d;m<y;++m)b=u[m],o[b]!==n&&(a[b]=s[b],o[b]=n,i.push(b)),s[b]^=p;else if(d<g)for(m=Math.max(h,d),y=g;m<y;++m)b=u[m],o[b]!==n&&(a[b]=s[b],o[b]=n,i.push(b)),s[b]^=p;e.range=t.slice()},incrementOne(e,t,n,i){const r=this.value,o=r.curr(),s=e.index(),a=e.bisect(e.range),u=e.bisect(t),l=u[0],c=u[1],f=a[0],d=a[1],h=e.one;let g,p,m;if(l<f)for(g=l,p=Math.min(f,c);g<p;++g)m=s[g],o[m]^=h,n.push(m);else if(l>f)for(g=f,p=Math.min(l,d);g<p;++g)m=s[g],o[m]^=h,i.push(m);if(c>d)for(g=Math.max(l,d),p=c;g<p;++g)m=s[g],o[m]^=h,n.push(m);else if(c<d)for(g=Math.max(f,c),p=d;g<p;++g)m=s[g],o[m]^=h,i.push(m);e.range=t.slice()}});function jv(e){R.call(this,null,e)}jv.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]};H(jv,R,{transform(e,t){const n=~(e.ignore||0),i=e.filter,r=i.mask;if(!(r&n))return t.StopPropagation;const o=t.fork(t.ALL),s=i.data(),a=i.curr(),u=i.prev(),l=c=>a[c]&n?null:s[c];return o.filter(o.MOD,l),r&r-1?(o.filter(o.ADD,c=>{const f=a[c]&n;return!f&&f^u[c]&n?s[c]:null}),o.filter(o.REM,c=>{const f=a[c]&n;return f&&!(f^(f^u[c]&n))?s[c]:null})):(o.filter(o.ADD,l),o.filter(o.REM,c=>(a[c]&n)===r?s[c]:null)),o.filter(o.SOURCE,c=>l(c._index))}});const uW=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:Uv,resolvefilter:jv},Symbol.toStringTag,{value:"Module"})),lW="RawCode",os="Literal",cW="Property",fW="Identifier",dW="ArrayExpression",hW="BinaryExpression",oM="CallExpression",gW="ConditionalExpression",pW="LogicalExpression",mW="MemberExpression",yW="ObjectExpression",bW="UnaryExpression";function hi(e){this.type=e}hi.prototype.visit=function(e){let t,n,i;if(e(this))return 1;for(t=vW(this),n=0,i=t.length;n<i;++n)if(t[n].visit(e))return 1};function vW(e){switch(e.type){case dW:return e.elements;case hW:case pW:return[e.left,e.right];case oM:return[e.callee].concat(e.arguments);case gW:return[e.test,e.consequent,e.alternate];case mW:return[e.object,e.property];case yW:return e.properties;case cW:return[e.key,e.value];case bW:return[e.argument];case fW:case os:case lW:default:return[]}}var Vi,Z,D,_t,Ce,Gh=1,uc=2,ss=3,bo=4,Hh=5,As=6,Jt=7,lc=8,xW=9;Vi={};Vi[Gh]="Boolean";Vi[uc]="<end>";Vi[ss]="Identifier";Vi[bo]="Keyword";Vi[Hh]="Null";Vi[As]="Numeric";Vi[Jt]="Punctuator";Vi[lc]="String";Vi[xW]="RegularExpression";var EW="ArrayExpression",wW="BinaryExpression",SW="CallExpression",$W="ConditionalExpression",sM="Identifier",AW="Literal",kW="LogicalExpression",CW="MemberExpression",FW="ObjectExpression",_W="Property",OW="UnaryExpression",ut="Unexpected token %0",RW="Unexpected number",MW="Unexpected string",DW="Unexpected identifier",TW="Unexpected reserved word",NW="Unexpected end of input",q0="Invalid regular expression",Lp="Invalid regular expression: missing /",aM="Octal literals are not allowed in strict mode.",LW="Duplicate data property in object literal not allowed in strict mode",yt="ILLEGAL",kl="Disabled.",IW=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),PW=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function Vh(e,t){if(!e)throw new Error("ASSERT: "+t)}function ar(e){return e>=48&&e<=57}function qv(e){return"0123456789abcdefABCDEF".includes(e)}function ll(e){return"01234567".includes(e)}function zW(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function Cl(e){return e===10||e===13||e===8232||e===8233}function cc(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&IW.test(String.fromCharCode(e))}function Td(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&PW.test(String.fromCharCode(e))}const BW={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function uM(){for(;D<_t;){const e=Z.charCodeAt(D);if(zW(e)||Cl(e))++D;else break}}function W0(e){var t,n,i,r=0;for(n=e==="u"?4:2,t=0;t<n;++t)D<_t&&qv(Z[D])?(i=Z[D++],r=r*16+"0123456789abcdef".indexOf(i.toLowerCase())):xe({},ut,yt);return String.fromCharCode(r)}function UW(){var e,t,n,i;for(e=Z[D],t=0,e==="}"&&xe({},ut,yt);D<_t&&(e=Z[D++],!!qv(e));)t=t*16+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||e!=="}")&&xe({},ut,yt),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,i=(t-65536&1023)+56320,String.fromCharCode(n,i))}function lM(){var e,t;for(e=Z.charCodeAt(D++),t=String.fromCharCode(e),e===92&&(Z.charCodeAt(D)!==117&&xe({},ut,yt),++D,e=W0("u"),(!e||e==="\\"||!cc(e.charCodeAt(0)))&&xe({},ut,yt),t=e);D<_t&&(e=Z.charCodeAt(D),!!Td(e));)++D,t+=String.fromCharCode(e),e===92&&(t=t.substr(0,t.length-1),Z.charCodeAt(D)!==117&&xe({},ut,yt),++D,e=W0("u"),(!e||e==="\\"||!Td(e.charCodeAt(0)))&&xe({},ut,yt),t+=e);return t}function jW(){var e,t;for(e=D++;D<_t;){if(t=Z.charCodeAt(D),t===92)return D=e,lM();if(Td(t))++D;else break}return Z.slice(e,D)}function qW(){var e,t,n;return e=D,t=Z.charCodeAt(D)===92?lM():jW(),t.length===1?n=ss:BW.hasOwnProperty(t)?n=bo:t==="null"?n=Hh:t==="true"||t==="false"?n=Gh:n=ss,{type:n,value:t,start:e,end:D}}function Ip(){var e=D,t=Z.charCodeAt(D),n,i=Z[D],r,o,s;switch(t){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++D,{type:Jt,value:String.fromCharCode(t),start:e,end:D};default:if(n=Z.charCodeAt(D+1),n===61)switch(t){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return D+=2,{type:Jt,value:String.fromCharCode(t)+String.fromCharCode(n),start:e,end:D};case 33:case 61:return D+=2,Z.charCodeAt(D)===61&&++D,{type:Jt,value:Z.slice(e,D),start:e,end:D}}}if(s=Z.substr(D,4),s===">>>=")return D+=4,{type:Jt,value:s,start:e,end:D};if(o=s.substr(0,3),o===">>>"||o==="<<="||o===">>=")return D+=3,{type:Jt,value:o,start:e,end:D};if(r=o.substr(0,2),i===r[1]&&"+-<>&|".includes(i)||r==="=>")return D+=2,{type:Jt,value:r,start:e,end:D};if(r==="//"&&xe({},ut,yt),"<>=!+-*%&|^/".includes(i))return++D,{type:Jt,value:i,start:e,end:D};xe({},ut,yt)}function WW(e){let t="";for(;D<_t&&qv(Z[D]);)t+=Z[D++];return t.length===0&&xe({},ut,yt),cc(Z.charCodeAt(D))&&xe({},ut,yt),{type:As,value:parseInt("0x"+t,16),start:e,end:D}}function GW(e){let t="0"+Z[D++];for(;D<_t&&ll(Z[D]);)t+=Z[D++];return(cc(Z.charCodeAt(D))||ar(Z.charCodeAt(D)))&&xe({},ut,yt),{type:As,value:parseInt(t,8),octal:!0,start:e,end:D}}function RS(){var e,t,n;if(n=Z[D],Vh(ar(n.charCodeAt(0))||n===".","Numeric literal must start with a decimal digit or a decimal point"),t=D,e="",n!=="."){if(e=Z[D++],n=Z[D],e==="0"){if(n==="x"||n==="X")return++D,WW(t);if(ll(n))return GW(t);n&&ar(n.charCodeAt(0))&&xe({},ut,yt)}for(;ar(Z.charCodeAt(D));)e+=Z[D++];n=Z[D]}if(n==="."){for(e+=Z[D++];ar(Z.charCodeAt(D));)e+=Z[D++];n=Z[D]}if(n==="e"||n==="E")if(e+=Z[D++],n=Z[D],(n==="+"||n==="-")&&(e+=Z[D++]),ar(Z.charCodeAt(D)))for(;ar(Z.charCodeAt(D));)e+=Z[D++];else xe({},ut,yt);return cc(Z.charCodeAt(D))&&xe({},ut,yt),{type:As,value:parseFloat(e),start:t,end:D}}function HW(){var e="",t,n,i,r,o=!1;for(t=Z[D],Vh(t==="'"||t==='"',"String literal must starts with a quote"),n=D,++D;D<_t;)if(i=Z[D++],i===t){t="";break}else if(i==="\\")if(i=Z[D++],!i||!Cl(i.charCodeAt(0)))switch(i){case"u":case"x":Z[D]==="{"?(++D,e+=UW()):e+=W0(i);break;case"n":e+=`
10
- `;break;case"r":e+="\r";break;case"t":e+=" ";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:ll(i)?(r="01234567".indexOf(i),r!==0&&(o=!0),D<_t&&ll(Z[D])&&(o=!0,r=r*8+"01234567".indexOf(Z[D++]),"0123".includes(i)&&D<_t&&ll(Z[D])&&(r=r*8+"01234567".indexOf(Z[D++]))),e+=String.fromCharCode(r)):e+=i;break}else i==="\r"&&Z[D]===`
11
- `&&++D;else{if(Cl(i.charCodeAt(0)))break;e+=i}return t!==""&&xe({},ut,yt),{type:lc,value:e,octal:o,start:n,end:D}}function VW(e,t){let n=e;t.includes("u")&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(i,r)=>{if(parseInt(r,16)<=1114111)return"x";xe({},q0)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch{xe({},q0)}try{return new RegExp(e,t)}catch{return null}}function XW(){var e,t,n,i,r;for(e=Z[D],Vh(e==="/","Regular expression literal must start with a slash"),t=Z[D++],n=!1,i=!1;D<_t;)if(e=Z[D++],t+=e,e==="\\")e=Z[D++],Cl(e.charCodeAt(0))&&xe({},Lp),t+=e;else if(Cl(e.charCodeAt(0)))xe({},Lp);else if(n)e==="]"&&(n=!1);else if(e==="/"){i=!0;break}else e==="["&&(n=!0);return i||xe({},Lp),r=t.substr(1,t.length-2),{value:r,literal:t}}function YW(){var e,t,n;for(t="",n="";D<_t&&(e=Z[D],!!Td(e.charCodeAt(0)));)++D,e==="\\"&&D<_t?xe({},ut,yt):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&xe({},q0,n),{value:n,literal:t}}function KW(){var e,t,n,i;return Ce=null,uM(),e=D,t=XW(),n=YW(),i=VW(t.value,n.value),{literal:t.literal+n.literal,value:i,regex:{pattern:t.value,flags:n.value},start:e,end:D}}function JW(e){return e.type===ss||e.type===bo||e.type===Gh||e.type===Hh}function cM(){if(uM(),D>=_t)return{type:uc,start:D,end:D};const e=Z.charCodeAt(D);return cc(e)?qW():e===40||e===41||e===59?Ip():e===39||e===34?HW():e===46?ar(Z.charCodeAt(D+1))?RS():Ip():ar(e)?RS():Ip()}function Zt(){const e=Ce;return D=e.end,Ce=cM(),D=e.end,e}function fM(){const e=D;Ce=cM(),D=e}function QW(e){const t=new hi(EW);return t.elements=e,t}function MS(e,t,n){const i=new hi(e==="||"||e==="&&"?kW:wW);return i.operator=e,i.left=t,i.right=n,i}function ZW(e,t){const n=new hi(SW);return n.callee=e,n.arguments=t,n}function eG(e,t,n){const i=new hi($W);return i.test=e,i.consequent=t,i.alternate=n,i}function Wv(e){const t=new hi(sM);return t.name=e,t}function Ku(e){const t=new hi(AW);return t.value=e.value,t.raw=Z.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function DS(e,t,n){const i=new hi(CW);return i.computed=e==="[",i.object=t,i.property=n,i.computed||(n.member=!0),i}function tG(e){const t=new hi(FW);return t.properties=e,t}function TS(e,t,n){const i=new hi(_W);return i.key=t,i.value=n,i.kind=e,i}function nG(e,t){const n=new hi(OW);return n.operator=e,n.argument=t,n.prefix=!0,n}function xe(e,t){var n,i=Array.prototype.slice.call(arguments,2),r=t.replace(/%(\d)/g,(o,s)=>(Vh(s<i.length,"Message reference must be in range"),i[s]));throw n=new Error(r),n.index=D,n.description=r,n}function Xh(e){e.type===uc&&xe(e,NW),e.type===As&&xe(e,RW),e.type===lc&&xe(e,MW),e.type===ss&&xe(e,DW),e.type===bo&&xe(e,TW),xe(e,ut,e.value)}function Ot(e){const t=Zt();(t.type!==Jt||t.value!==e)&&Xh(t)}function Te(e){return Ce.type===Jt&&Ce.value===e}function Pp(e){return Ce.type===bo&&Ce.value===e}function iG(){const e=[];for(D=Ce.start,Ot("[");!Te("]");)Te(",")?(Zt(),e.push(null)):(e.push(as()),Te("]")||Ot(","));return Zt(),QW(e)}function NS(){D=Ce.start;const e=Zt();return e.type===lc||e.type===As?(e.octal&&xe(e,aM),Ku(e)):Wv(e.value)}function rG(){var e,t,n,i;if(D=Ce.start,e=Ce,e.type===ss)return n=NS(),Ot(":"),i=as(),TS("init",n,i);if(e.type===uc||e.type===Jt)Xh(e);else return t=NS(),Ot(":"),i=as(),TS("init",t,i)}function oG(){var e=[],t,n,i,r={},o=String;for(D=Ce.start,Ot("{");!Te("}");)t=rG(),t.key.type===sM?n=t.key.name:n=o(t.key.value),i="$"+n,Object.prototype.hasOwnProperty.call(r,i)?xe({},LW):r[i]=!0,e.push(t),Te("}")||Ot(",");return Ot("}"),tG(e)}function sG(){Ot("(");const e=Gv();return Ot(")"),e}const aG={if:1};function uG(){var e,t,n;if(Te("("))return sG();if(Te("["))return iG();if(Te("{"))return oG();if(e=Ce.type,D=Ce.start,e===ss||aG[Ce.value])n=Wv(Zt().value);else if(e===lc||e===As)Ce.octal&&xe(Ce,aM),n=Ku(Zt());else{if(e===bo)throw new Error(kl);e===Gh?(t=Zt(),t.value=t.value==="true",n=Ku(t)):e===Hh?(t=Zt(),t.value=null,n=Ku(t)):Te("/")||Te("/=")?(n=Ku(KW()),fM()):Xh(Zt())}return n}function lG(){const e=[];if(Ot("("),!Te(")"))for(;D<_t&&(e.push(as()),!Te(")"));)Ot(",");return Ot(")"),e}function cG(){D=Ce.start;const e=Zt();return JW(e)||Xh(e),Wv(e.value)}function fG(){return Ot("."),cG()}function dG(){Ot("[");const e=Gv();return Ot("]"),e}function hG(){var e,t,n;for(e=uG();;)if(Te("."))n=fG(),e=DS(".",e,n);else if(Te("("))t=lG(),e=ZW(e,t);else if(Te("["))n=dG(),e=DS("[",e,n);else break;return e}function LS(){const e=hG();if(Ce.type===Jt&&(Te("++")||Te("--")))throw new Error(kl);return e}function Rf(){var e,t;if(Ce.type!==Jt&&Ce.type!==bo)t=LS();else{if(Te("++")||Te("--"))throw new Error(kl);if(Te("+")||Te("-")||Te("~")||Te("!"))e=Zt(),t=Rf(),t=nG(e.value,t);else{if(Pp("delete")||Pp("void")||Pp("typeof"))throw new Error(kl);t=LS()}}return t}function IS(e){let t=0;if(e.type!==Jt&&e.type!==bo)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11;break}return t}function gG(){var e,t,n,i,r,o,s,a,u,l;if(e=Ce,u=Rf(),i=Ce,r=IS(i),r===0)return u;for(i.prec=r,Zt(),t=[e,Ce],s=Rf(),o=[u,i,s];(r=IS(Ce))>0;){for(;o.length>2&&r<=o[o.length-2].prec;)s=o.pop(),a=o.pop().value,u=o.pop(),t.pop(),n=MS(a,u,s),o.push(n);i=Zt(),i.prec=r,o.push(i),t.push(Ce),n=Rf(),o.push(n)}for(l=o.length-1,n=o[l],t.pop();l>1;)t.pop(),n=MS(o[l-1].value,o[l-2],n),l-=2;return n}function as(){var e,t,n;return e=gG(),Te("?")&&(Zt(),t=as(),Ot(":"),n=as(),e=eG(e,t,n)),e}function Gv(){const e=as();if(Te(","))throw new Error(kl);return e}function Hv(e){Z=e,D=0,_t=Z.length,Ce=null,fM();const t=Gv();if(Ce.type!==uc)throw new Error("Unexpect token after expression.");return t}var dM={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function hM(e){function t(s,a,u,l){let c=e(a[0]);return u&&(c=u+"("+c+")",u.lastIndexOf("new ",0)===0&&(c="("+c+")")),c+"."+s+(l<0?"":l===0?"()":"("+a.slice(1).map(e).join(",")+")")}function n(s,a,u){return l=>t(s,l,a,u)}const i="new Date",r="String",o="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(s){s.length<3&&M("Missing arguments to clamp function."),s.length>3&&M("Too many arguments to clamp function.");const a=s.map(e);return"Math.max("+a[1]+", Math.min("+a[2]+","+a[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:i,date:n("getDate",i,0),day:n("getDay",i,0),year:n("getFullYear",i,0),month:n("getMonth",i,0),hours:n("getHours",i,0),minutes:n("getMinutes",i,0),seconds:n("getSeconds",i,0),milliseconds:n("getMilliseconds",i,0),time:n("getTime",i,0),timezoneoffset:n("getTimezoneOffset",i,0),utcdate:n("getUTCDate",i,0),utcday:n("getUTCDay",i,0),utcyear:n("getUTCFullYear",i,0),utcmonth:n("getUTCMonth",i,0),utchours:n("getUTCHours",i,0),utcminutes:n("getUTCMinutes",i,0),utcseconds:n("getUTCSeconds",i,0),utcmilliseconds:n("getUTCMilliseconds",i,0),length:n("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",r,0),lower:n("toLowerCase",r,0),substring:n("substring",r),split:n("split",r),trim:n("trim",r,0),btoa:"btoa",atob:"atob",regexp:o,test:n("test",o),if:function(s){s.length<3&&M("Missing arguments to if function."),s.length>3&&M("Too many arguments to if function.");const a=s.map(e);return"("+a[0]+"?"+a[1]+":"+a[2]+")"}}}function pG(e){const t=e&&e.length-1;return t&&(e[0]==='"'&&e[t]==='"'||e[0]==="'"&&e[t]==="'")?e.slice(1,-1):e}function gM(e){e=e||{};const t=e.allowed?si(e.allowed):{},n=e.forbidden?si(e.forbidden):{},i=e.constants||dM,r=(e.functions||hM)(f),o=e.globalvar,s=e.fieldvar,a=ce(o)?o:g=>`${o}["${g}"]`;[...Object.getOwnPropertyNames(Object.prototype).filter(g=>typeof Object.prototype[g]=="function")];let u={},l={},c=0;function f(g){if(Y(g))return g;const p=d[g.type];return p==null&&M("Unsupported type: "+g.type),p(g)}const d={Literal:g=>g.raw,Identifier:g=>{const p=g.name;return c>0?p:J(n,p)?M("Illegal identifier: "+p):J(i,p)?i[p]:J(t,p)?p:(u[p]=1,a(p))},MemberExpression:g=>{const p=!g.computed,m=f(g.object);p&&(c+=1);const y=f(g.property);return m===s&&(l[pG(y)]=1),p&&(c-=1),m+(p?"."+y:"["+y+"]")},CallExpression:g=>{g.callee.type!=="Identifier"&&M("Illegal callee type: "+g.callee.type);const p=g.callee.name,m=g.arguments,y=J(r,p)&&r[p];return y||M("Unrecognized function: "+p),ce(y)?y(m):y+"("+m.map(f).join(",")+")"},ArrayExpression:g=>"["+g.elements.map(f).join(",")+"]",BinaryExpression:g=>"("+f(g.left)+" "+g.operator+" "+f(g.right)+")",UnaryExpression:g=>"("+g.operator+f(g.argument)+")",ConditionalExpression:g=>"("+f(g.test)+"?"+f(g.consequent)+":"+f(g.alternate)+")",LogicalExpression:g=>"("+f(g.left)+g.operator+f(g.right)+")",ObjectExpression:g=>{for(const p of g.properties){const m=p.key.name;dy.has(m)&&M("Illegal property: "+m)}return"{"+g.properties.map(f).join(",")+"}"},Property:g=>{c+=1;const p=f(g.key);return c-=1,p+":"+f(g.value)}};function h(g){const p={code:f(g),globals:Object.keys(u),fields:Object.keys(l)};return u={},l={},p}return h.functions=r,h.constants=i,h}const PS=Symbol("vega_selection_getter");function pM(e){return(!e.getter||!e.getter[PS])&&(e.getter=In(e.field),e.getter[PS]=!0),e.getter}const Vv="intersect",zS="union",mG="vlMulti",yG="vlPoint",BS="or",bG="and",Ci="_vgsid_",Fl=In(Ci),vG="E",xG="R",EG="R-E",wG="R-LE",SG="R-RE",$G="E-LT",AG="E-LTE",kG="E-GT",CG="E-GTE",FG="E-VALID",_G="E-ONE",Nd="index:unit";function US(e,t){for(var n=t.fields,i=t.values,r=n.length,o=0,s,a;o<r;++o)if(a=n[o],s=pM(a)(e),eo(s)&&(s=Ut(s)),eo(i[o])&&(i[o]=Ut(i[o])),T(i[o])&&eo(i[o][0])&&(i[o]=i[o].map(Ut)),a.type===vG){if(T(i[o])?!i[o].includes(s):s!==i[o])return!1}else if(a.type===xG){if(!Qs(s,i[o]))return!1}else if(a.type===SG){if(!Qs(s,i[o],!0,!1))return!1}else if(a.type===EG){if(!Qs(s,i[o],!1,!1))return!1}else if(a.type===wG){if(!Qs(s,i[o],!1,!0))return!1}else if(a.type===$G){if(s>=i[o])return!1}else if(a.type===AG){if(s>i[o])return!1}else if(a.type===kG){if(s<=i[o])return!1}else if(a.type===CG){if(s<i[o])return!1}else if(a.type===FG){if(s===null||isNaN(s))return!1}else if(a.type===_G&&i[o].indexOf(s)===-1)return!1;return!0}function OG(e,t,n){for(var i=this.context.data[e],r=i?i.values.value:[],o=i?i[Nd]&&i[Nd].value:void 0,s=n===Vv,a=r.length,u=0,l,c,f,d,h;u<a;++u)if(l=r[u],o&&s){if(c=c||{},f=c[d=l.unit]||0,f===-1)continue;if(h=US(t,l),c[d]=h?-1:++f,h&&o.size===1)return!0;if(!h&&f===o.get(d).count)return!1}else if(h=US(t,l),s^h)return h;return a&&s}const mM=j1(Fl),RG=mM.left,MG=mM.right;function DG(e,t,n){const i=this.context.data[e],r=i?i.values.value:[],o=i?i[Nd]&&i[Nd].value:void 0,s=n===Vv,a=Fl(t),u=RG(r,a);if(u===r.length||Fl(r[u])!==a)return!1;if(o&&s){if(o.size===1)return!0;if(MG(r,a)-u<o.size)return!1}return!0}function TG(e,t){return T(e)||M("First argument to selectionTuples must be an array."),X(t)||M("Second argument to selectionTuples must be an object."),e.map(n=>fe(t.fields?{values:t.fields.map(i=>pM(i)(n.datum))}:{[Ci]:Fl(n.datum)},t))}function NG(e,t,n,i){for(var r=this.context.data[e],o=r?r.values.value:[],s={},a={},u={},l,c,f,d,h,g,p,m,y,b,v=o.length,x=0,w,S;x<v;++x)if(l=o[x],d=l.unit,c=l.fields,f=l.values,c&&f){for(w=0,S=c.length;w<S;++w)h=c[w],p=s[h.field]||(s[h.field]={}),m=p[d]||(p[d]=[]),u[h.field]=y=h.type.charAt(0),b=zp[`${y}_union`],p[d]=b(m,K(f[w]));n&&(m=a[d]||(a[d]=[]),m.push(K(f).reduce((E,$,A)=>(E[c[A].field]=$,E),{})))}else h=Ci,g=Fl(l),p=s[h]||(s[h]={}),m=p[d]||(p[d]=[]),m.push(g),n&&(m=a[d]||(a[d]=[]),m.push({[Ci]:g}));if(t=t||zS,s[Ci]?s[Ci]=zp[`${Ci}_${t}`](...Object.values(s[Ci])):Object.keys(s).forEach(E=>{s[E]=Object.keys(s[E]).map($=>s[E][$]).reduce(($,A)=>$===void 0?A:zp[`${u[E]}_${t}`]($,A))}),o=Object.keys(a),n&&o.length){const E=i?yG:mG;s[E]=t===zS?{[BS]:o.reduce(($,A)=>($.push(...a[A]),$),[])}:{[bG]:o.map($=>({[BS]:a[$]}))}}return s}var zp={[`${Ci}_union`]:JL,[`${Ci}_intersect`]:YL,E_union:function(e,t){if(!e.length)return t;for(var n=0,i=t.length;n<i;++n)e.includes(t[n])||e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter(n=>t.includes(n)):t},R_union:function(e,t){var n=Ut(t[0]),i=Ut(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]<i&&(e[1]=i),e):[n,i]},R_intersect:function(e,t){var n=Ut(t[0]),i=Ut(t[1]);return n>i&&(n=t[1],i=t[0]),e.length?i<e[0]||e[1]<n?[]:(e[0]<n&&(e[0]=n),e[1]>i&&(e[1]=i),e):[n,i]}};const LG=":",IG="@";function Xv(e,t,n,i){t[0].type!==os&&M("First argument to selection functions must be a string literal.");const r=t[0].value,o=t.length>=2&&be(t).value,s="unit",a=IG+s,u=LG+r;o===Vv&&!J(i,a)&&(i[a]=n.getData(r).indataRef(n,s)),J(i,u)||(i[u]=n.getData(r).tuplesRef())}function yM(e){const t=this.context.data[e];return t?t.values.value:[]}function PG(e,t,n){const i=this.context.data[e]["index:"+t],r=i?i.value.get(n):void 0;return r&&r.count}function zG(e,t){const n=this.context.dataflow,i=this.context.data[e],r=i.input;return n.pulse(r,n.changeset().remove(Pn).insert(t)),1}function BG(e,t,n){if(e){const i=this.context.dataflow,r=e.mark.source;i.pulse(r,i.changeset().encode(e,t))}return n!==void 0?n:e}const fc=e=>function(t,n){const i=this.context.dataflow.locale();return t===null?"null":i[e](n)(t)},UG=fc("format"),bM=fc("timeFormat"),jG=fc("utcFormat"),qG=fc("timeParse"),WG=fc("utcParse"),Kc=new Date(2e3,0,1);function Yh(e,t,n){return!Number.isInteger(e)||!Number.isInteger(t)?"":(Kc.setYear(2e3),Kc.setMonth(e),Kc.setDate(t),bM.call(this,Kc,n))}function GG(e){return Yh.call(this,e,1,"%B")}function HG(e){return Yh.call(this,e,1,"%b")}function VG(e){return Yh.call(this,0,2+e,"%A")}function XG(e){return Yh.call(this,0,2+e,"%a")}const YG=":",KG="@",G0="%",vM="$";function Yv(e,t,n,i){t[0].type!==os&&M("First argument to data functions must be a string literal.");const r=t[0].value,o=YG+r;if(!J(o,i))try{i[o]=n.getData(r).tuplesRef()}catch{}}function JG(e,t,n,i){t[0].type!==os&&M("First argument to indata must be a string literal."),t[1].type!==os&&M("Second argument to indata must be a string literal.");const r=t[0].value,o=t[1].value,s=KG+o;J(s,i)||(i[s]=n.getData(r).indataRef(n,o))}function Wt(e,t,n,i){if(t[0].type===os)jS(n,i,t[0].value);else for(e in n.scales)jS(n,i,e)}function jS(e,t,n){const i=G0+n;if(!J(t,i))try{t[i]=e.scaleRef(n)}catch{}}function Xi(e,t){if(Y(e)){const n=t.scales[e];return n&&Nw(n.value)?n.value:void 0}else if(ce(e))return Nw(e)?e:void 0}function QG(e,t,n){t.__bandwidth=r=>r&&r.bandwidth?r.bandwidth():0,n._bandwidth=Wt,n._range=Wt,n._scale=Wt;const i=r=>"_["+(r.type===os?G(G0+r.value):G(G0)+"+"+e(r))+"]";return{_bandwidth:r=>`this.__bandwidth(${i(r[0])})`,_range:r=>`${i(r[0])}.range()`,_scale:r=>`${i(r[0])}(${e(r[1])})`}}function Kv(e,t){return function(n,i,r){if(n){const o=Xi(n,(r||this).context);return o&&o.path[e](i)}else return t(i)}}const ZG=Kv("area",vP),eH=Kv("bounds",SP),tH=Kv("centroid",_P);function nH(e,t){const n=Xi(e,(t||this).context);return n&&n.scale()}function iH(e){const t=this.context.group;let n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n}function Jv(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(i){e.warn(i)}return n[n.length-1]}function rH(){return Jv(this.context.dataflow,"warn",arguments)}function oH(){return Jv(this.context.dataflow,"info",arguments)}function sH(){return Jv(this.context.dataflow,"debug",arguments)}function Bp(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function H0(e){const t=zf(e),n=Bp(t.r),i=Bp(t.g),r=Bp(t.b);return .2126*n+.7152*i+.0722*r}function aH(e,t){const n=H0(e),i=H0(t),r=Math.max(n,i),o=Math.min(n,i);return(r+.05)/(o+.05)}function uH(){const e=[].slice.call(arguments);return e.unshift({}),fe(...e)}function xM(e,t){return e===t||e!==e&&t!==t?!0:T(e)?T(t)&&e.length===t.length?lH(e,t):!1:X(e)&&X(t)?EM(e,t):!1}function lH(e,t){for(let n=0,i=e.length;n<i;++n)if(!xM(e[n],t[n]))return!1;return!0}function EM(e,t){for(const n in e)if(!xM(e[n],t[n]))return!1;return!0}function qS(e){return t=>EM(e,t)}function cH(e,t,n,i,r,o){const s=this.context.dataflow,a=this.context.data[e],u=a.input,l=s.stamp();let c=a.changes,f,d;if(s._trigger===!1||!(u.value.length||t||i))return 0;if((!c||c.stamp<l)&&(a.changes=c=s.changeset(),c.stamp=l,s.runAfter(()=>{a.modified=!0,s.pulse(u,c).run()},!0,1)),n&&(f=n===!0?Pn:T(n)||vh(n)?n:qS(n),c.remove(f)),t&&c.insert(t),i&&(f=qS(i),u.value.some(f)?c.remove(f):c.insert(i)),r){if(ce(r))throw Error("modify parameter must be a data tuple, not a function");for(d in o)c.modify(r,d,o[d])}return 1}function fH(e){const t=e.touches,n=t[0].clientX-t[1].clientX,i=t[0].clientY-t[1].clientY;return Math.hypot(n,i)}function dH(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)}const WS={};function hH(e,t){const n=WS[t]||(WS[t]=In(t));return T(e)?e.map(n):n(e)}function Kh(e){return T(e)||ArrayBuffer.isView(e)?e:null}function Qv(e){return Kh(e)||(Y(e)?e:null)}function gH(e,...t){return Kh(e).join(...t)}function pH(e,...t){return Qv(e).indexOf(...t)}function mH(e,...t){return Qv(e).lastIndexOf(...t)}function yH(e,...t){return Qv(e).slice(...t)}function bH(e,t,n){return ce(n)&&M("Function argument passed to replace."),!Y(t)&&!xy(t)&&M("Please pass a string or RegExp argument to replace."),String(e).replace(t,n)}function vH(e){return Kh(e).slice().reverse()}function xH(e){return Kh(e).slice().sort(Ha)}function EH(e,t,n){return Sb(e||0,t||0,n||0)}function wH(e,t){const n=Xi(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}function SH(e,t){const n=Xi(e,(t||this).context);return n?n.copy():void 0}function $H(e,t){const n=Xi(e,(t||this).context);return n?n.domain():[]}function AH(e,t,n){const i=Xi(e,(n||this).context);return i?T(t)?(i.invertRange||i.invert)(t):(i.invert||i.invertExtent)(t):void 0}function kH(e,t){const n=Xi(e,(t||this).context);return n&&n.range?n.range():[]}function CH(e,t,n){const i=Xi(e,(n||this).context);return i?i(t):void 0}function FH(e,t,n,i,r){e=Xi(e,(r||this).context);const o=dO(t,n);let s=e.domain(),a=s[0],u=be(s),l=nn;return u-a?l=eO(e,a,u):e=(e.interpolator?we("sequential")().interpolator(e.interpolator()):we("linear")().interpolate(e.interpolate()).range(e.range())).domain([a=0,u=1]),e.ticks&&(s=e.ticks(+i||15),a!==s[0]&&s.unshift(a),u!==be(s)&&s.push(u)),s.forEach(c=>o.stop(l(c),e(c))),o}function _H(e,t,n){const i=Xi(e,(n||this).context);return function(r){return i?i.path.context(r)(t):""}}function OH(e){let t=null;return function(n){return n?wl(n,t=t||va(e)):e}}const wM=e=>e.data;function SM(e,t){const n=yM.call(t,e);return n.root&&n.root.lookup||{}}function RH(e,t,n){const i=SM(e,this),r=i[t],o=i[n];return r&&o?r.path(o).map(wM):void 0}function MH(e,t){const n=SM(e,this)[t];return n?n.ancestors().map(wM):void 0}const $M=()=>typeof window<"u"&&window||null;function DH(){const e=$M();return e?e.screen:{}}function TH(){const e=$M();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]}function NH(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]}function AM(e,t,n){if(!e)return[];const[i,r]=e,o=new Ze().set(i[0],i[1],r[0],r[1]),s=n||this.context.dataflow.scenegraph().root;return uR(s,o,LH(t))}function LH(e){let t=null;if(e){const n=K(e.marktype),i=K(e.markname);t=r=>(!n.length||n.some(o=>r.marktype===o))&&(!i.length||i.some(o=>r.name===o))}return t}function IH(e,t,n,i=5){e=K(e);const r=e[e.length-1];return r===void 0||Math.hypot(r[0]-t,r[1]-n)>i?[...e,[t,n]]:e}function PH(e){return K(e).reduce((t,[n,i],r)=>t+=r==0?`M ${n},${i} `:r===e.length-1?" Z":`L ${n},${i} `,"")}function zH(e,t,n){const{x:i,y:r,mark:o}=n,s=new Ze().set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[u,l]of t)u<s.x1&&(s.x1=u),u>s.x2&&(s.x2=u),l<s.y1&&(s.y1=l),l>s.y2&&(s.y2=l);return s.translate(i,r),AM([[s.x1,s.y1],[s.x2,s.y2]],e,o).filter(u=>BH(u.x,u.y,t))}function BH(e,t,n){let i=0;for(let r=0,o=n.length-1;r<n.length;o=r++){const[s,a]=n[o],[u,l]=n[r];l>t!=a>t&&e<(s-u)*(t-l)/(a-l)+u&&i++}return i&1}const _l={random(){return Bn()},cumulativeNormal:$h,cumulativeLogNormal:qy,cumulativeUniform:Vy,densityNormal:Py,densityLogNormal:jy,densityUniform:Hy,quantileNormal:Ah,quantileLogNormal:Wy,quantileUniform:Xy,sampleNormal:Sh,sampleLogNormal:Uy,sampleUniform:Gy,isArray:T,isBoolean:Es,isDate:eo,isDefined(e){return e!==void 0},isNumber:Ee,isObject:X,isRegExp:xy,isString:Y,isTuple:vh,isValid(e){return e!=null&&e===e},toBoolean:wy,toDate(e){return Sy(e)},toNumber:Ut,toString:$y,indexof:pH,join:gH,lastindexof:mH,replace:bH,reverse:vH,sort:xH,slice:yH,flush:lF,lerp:fF,merge:uH,pad:gF,peek:be,pluck:hH,span:Gl,inrange:Qs,truncate:pF,rgb:zf,lab:Om,hcl:M5,hsl:Tm,luminance:H0,contrast:aH,sequence:pn,format:UG,utcFormat:jG,utcParse:WG,utcOffset:_F,utcSequence:MF,timeFormat:bM,timeParse:qG,timeOffset:FF,timeSequence:RF,timeUnitSpecifier:yF,monthFormat:GG,monthAbbrevFormat:HG,dayFormat:VG,dayAbbrevFormat:XG,quarter:oF,utcquarter:sF,week:vF,utcweek:wF,dayofyear:bF,utcdayofyear:EF,warn:rH,info:oH,debug:sH,extent(e){return Ii(e)},inScope:iH,intersect:AM,clampRange:aF,pinchDistance:fH,pinchAngle:dH,screen:DH,containerSize:NH,windowSize:TH,bandspace:EH,setdata:zG,pathShape:OH,panLinear:tF,panLog:nF,panPow:iF,panSymlog:rF,zoomLinear:py,zoomLog:my,zoomPow:gd,zoomSymlog:yy,encode:BG,modify:cH,lassoAppend:IH,lassoPath:PH,intersectLasso:zH},UH=["view","item","group","xy","x","y"],jH="event.vega.",kM="this.",Zv={},CM={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${G(vM+e)}]`,functions:qH,constants:dM,visitors:Zv},V0=gM(CM);function qH(e){const t=hM(e);UH.forEach(n=>t[n]=jH+n);for(const n in _l)t[n]=kM+n;return fe(t,QG(e,_l,Zv)),t}function Je(e,t,n){return arguments.length===1?_l[e]:(_l[e]=t,n&&(Zv[e]=n),V0&&(V0.functions[e]=kM+e),this)}Je("bandwidth",wH,Wt);Je("copy",SH,Wt);Je("domain",$H,Wt);Je("range",kH,Wt);Je("invert",AH,Wt);Je("scale",CH,Wt);Je("gradient",FH,Wt);Je("geoArea",ZG,Wt);Je("geoBounds",eH,Wt);Je("geoCentroid",tH,Wt);Je("geoShape",_H,Wt);Je("geoScale",nH,Wt);Je("indata",PG,JG);Je("data",yM,Yv);Je("treePath",RH,Yv);Je("treeAncestors",MH,Yv);Je("vlSelectionTest",OG,Xv);Je("vlSelectionIdTest",DG,Xv);Je("vlSelectionResolve",NG,Xv);Je("vlSelectionTuples",TG);function zi(e,t){const n={};let i;try{e=Y(e)?e:G(e)+"",i=Hv(e)}catch{M("Expression parse error: "+e)}i.visit(o=>{if(o.type!==oM)return;const s=o.callee.name,a=CM.visitors[s];a&&a(s,o.arguments,t,n)});const r=V0(i);return r.globals.forEach(o=>{const s=vM+o;!J(n,s)&&t.getSignal(o)&&(n[s]=t.signalRef(o))}),{$expr:fe({code:r.code},t.options.ast?{ast:i}:null),$fields:r.fields,$params:n}}function WH(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach(i=>t.parseOperator(i)),n.forEach(i=>t.parseOperatorParameters(i)),(e.streams||[]).forEach(i=>t.parseStream(i)),(e.updates||[]).forEach(i=>t.parseUpdate(i)),t.resolve()}const GH=si(["rule"]),GS=si(["group","image","rect"]);function HH(e,t){let n="";return GH[t]||(e.x2&&(e.x?(GS[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(GS[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}function ex(e){return(e+"").toLowerCase()}function VH(e){return ex(e)==="operator"}function XH(e){return ex(e)==="collect"}function Eu(e,t,n){n.endsWith(";")||(n="return("+n+");");const i=Function(...t.concat(n));return e&&e.functions?i.bind(e.functions):i}function YH(e,t,n,i){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n}
12
- : (u > v || v == null) && u != null ? ${i}
13
- : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}
14
- : v !== v && u === u ? ${i} : `}var KH={operator:(e,t)=>Eu(e,["_"],t.code),parameter:(e,t)=>Eu(e,["datum","_"],t.code),event:(e,t)=>Eu(e,["event"],t.code),handler:(e,t)=>{const n=`var datum=event.item&&event.item.datum;return ${t.code};`;return Eu(e,["_","event"],n)},encode:(e,t)=>{const{marktype:n,channels:i}=t;let r="var o=item,datum=o.datum,m=0,$;";for(const o in i){const s="o["+G(o)+"]";r+=`$=${i[o].code};if(${s}!==$)${s}=$,m=1;`}return r+=HH(i,n),r+="return m;",Eu(e,["item","_"],r)},codegen:{get(e){const t=`[${e.map(G).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n;const i=(o,s)=>{const a=t[s];let u,l;return o.path?(u=`a${o.path}`,l=`b${o.path}`):((n=n||{})["f"+s]=o,u=`this.f${s}(a)`,l=`this.f${s}(b)`),YH(u,l,-a,a)},r=Function("a","b","var u, v; return "+e.map(i).join("")+"0;");return n?r.bind(n):r}}};function JH(e){const t=this;VH(e.type)||!e.type?t.operator(e,e.update?t.operatorExpression(e.update):null):t.transform(e,e.type)}function QH(e){const t=this;if(e.params){const n=t.get(e.id);n||M("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}}function ZH(e,t){t=t||{};const n=this;for(const i in e){const r=e[i];t[i]=T(r)?r.map(o=>HS(o,n,t)):HS(r,n,t)}return t}function HS(e,t,n){if(!e||!X(e))return e;for(let i=0,r=VS.length,o;i<r;++i)if(o=VS[i],J(e,o.key))return o.parse(e,t,n);return e}var VS=[{key:"$ref",parse:eV},{key:"$key",parse:nV},{key:"$expr",parse:tV},{key:"$field",parse:iV},{key:"$encode",parse:oV},{key:"$compare",parse:rV},{key:"$context",parse:sV},{key:"$subflow",parse:aV},{key:"$tupleid",parse:uV}];function eV(e,t){return t.get(e.$ref)||M("Operator not defined: "+e.$ref)}function tV(e,t,n){e.$params&&t.parseParameters(e.$params,n);const i="e:"+e.$expr.code;return t.fn[i]||(t.fn[i]=ln(t.parameterExpression(e.$expr),e.$fields))}function nV(e,t){const n="k:"+e.$key+"_"+!!e.$flat;return t.fn[n]||(t.fn[n]=Ey(e.$key,e.$flat,t.expr.codegen))}function iV(e,t){if(!e.$field)return null;const n="f:"+e.$field+"_"+e.$name;return t.fn[n]||(t.fn[n]=In(e.$field,e.$name,t.expr.codegen))}function rV(e,t){const n="c:"+e.$compare+"_"+e.$order,i=K(e.$compare).map(r=>r&&r.$tupleid?ne:r);return t.fn[n]||(t.fn[n]=by(i,e.$order,t.expr.codegen))}function oV(e,t){const n=e.$encode,i={};for(const r in n){const o=n[r];i[r]=ln(t.encodeExpression(o.$expr),o.$fields),i[r].output=o.$output}return i}function sV(e,t){return t}function aV(e,t){const n=e.$subflow;return function(i,r,o){const s=t.fork().parse(n),a=s.get(n.operators[0].id),u=s.signals.parent;return u&&u.set(o),a.detachSubflow=()=>t.detach(s),a}}function uV(){return ne}function lV(e){var t=this,n=e.filter!=null?t.eventExpression(e.filter):void 0,i=e.stream!=null?t.get(e.stream):void 0,r;e.source?i=t.events(e.source,e.type,n):e.merge&&(r=e.merge.map(o=>t.get(o)),i=r[0].merge.apply(r[0],r.slice(1))),e.between&&(r=e.between.map(o=>t.get(o)),i=i.between(r[0],r[1])),e.filter&&(i=i.filter(n)),e.throttle!=null&&(i=i.throttle(+e.throttle)),e.debounce!=null&&(i=i.debounce(+e.debounce)),i==null&&M("Invalid stream definition: "+JSON.stringify(e)),e.consume&&i.consume(!0),t.stream(e,i)}function cV(e){var t=this,n=X(n=e.source)?n.$ref:n,i=t.get(n),r=null,o=e.update,s=void 0;i||M("Source not defined: "+e.source),r=e.target&&e.target.$expr?t.eventExpression(e.target.$expr):t.get(e.target),o&&o.$expr&&(o.$params&&(s=t.parseParameters(o.$params)),o=t.handlerExpression(o.$expr)),t.update(e,i,r,o,s)}const fV={skip:!0};function dV(e){var t=this,n={};if(e.signals){var i=n.signals={};Object.keys(t.signals).forEach(o=>{const s=t.signals[o];e.signals(o,s)&&(i[o]=s.value)})}if(e.data){var r=n.data={};Object.keys(t.data).forEach(o=>{const s=t.data[o];e.data(o,s)&&(r[o]=s.input.value)})}return t.subcontext&&e.recurse!==!1&&(n.subcontext=t.subcontext.map(o=>o.getState(e))),n}function hV(e){var t=this,n=t.dataflow,i=e.data,r=e.signals;Object.keys(r||{}).forEach(o=>{n.update(t.signals[o],r[o],fV)}),Object.keys(i||{}).forEach(o=>{n.pulse(t.data[o].input,n.changeset().remove(Pn).insert(i[o]))}),(e.subcontext||[]).forEach((o,s)=>{const a=t.subcontext[s];a&&a.setState(o)})}function FM(e,t,n,i){return new _M(e,t,n,i)}function _M(e,t,n,i){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=i||KH,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function XS(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}_M.prototype=XS.prototype={fork(){const e=new XS(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter(n=>n!==e);const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,i=n.dataflow,r=e.value;if(n.set(e.id,t),XH(e.type)&&r&&(r.$ingest?i.ingest(t,r.$ingest,r.$format):r.$request?i.preload(t,r.$request,r.$format):i.pulse(t,i.changeset().insert(r))),e.root&&(n.root=t),e.parent){let o=n.get(e.parent.$ref);o?(i.connect(o,[t]),t.targets().add(o)):(n.unresolved=n.unresolved||[]).push(()=>{o=n.get(e.parent.$ref),i.connect(o,[t]),t.targets().add(o)})}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const o in e.data){const s=n.data[o]||(n.data[o]={});e.data[o].forEach(a=>s[a]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[ex(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,i,r){this.dataflow.on(t,n,i,r,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:WH,parseOperator:JH,parseOperatorParameters:QH,parseParameters:ZH,parseStream:lV,parseUpdate:cV,getState:dV,setState:hV};function gV(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),OM(t,e.description()))}function OM(e,t){e&&(t==null?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}function pV(e){e.add(null,t=>(e._background=t.bg,e._resize=1,t.bg),{bg:e._signals.background})}const Up="default";function mV(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:Up,item:null}));e.on(e.events("view","pointermove"),t,(n,i)=>{const r=t.value,o=r?Y(r)?r:r.user:Up,s=i.item&&i.item.cursor||null;return r&&o===r.user&&s==r.item?r:{user:o,item:s}}),e.add(null,function(n){let i=n.cursor,r=this.value;return Y(i)||(r=i.item,i=i.user),X0(e,i&&i!==Up?i:r||i),r},{cursor:t})}function X0(e,t){const n=e.globalCursor()?typeof document<"u"&&document.body:e.container();if(n)return t==null?n.style.removeProperty("cursor"):n.style.cursor=t}function Ld(e,t){var n=e._runtime.data;return J(n,t)||M("Unrecognized data set: "+t),n[t]}function yV(e,t){return arguments.length<2?Ld(this,e).values.value:Jh.call(this,e,Ss().remove(Pn).insert(t))}function Jh(e,t){QF(t)||M("Second argument to changes must be a changeset.");const n=Ld(this,e);return n.modified=!0,this.pulse(n.input,t)}function bV(e,t){return Jh.call(this,e,Ss().insert(t))}function vV(e,t){return Jh.call(this,e,Ss().remove(t))}function RM(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function MM(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function Qh(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function xV(e){var t=Qh(e),n=RM(e),i=MM(e);e._renderer.background(e.background()),e._renderer.resize(n,i,t),e._handler.origin(t),e._resizeListeners.forEach(r=>{try{r(n,i)}catch(o){e.error(o)}})}function EV(e,t,n){var i=e._renderer,r=i&&i.canvas(),o,s,a;return r&&(a=Qh(e),s=t.changedTouches?t.changedTouches[0]:t,o=jh(s,r),o[0]-=a[0],o[1]-=a[1]),t.dataflow=e,t.item=n,t.vega=wV(e,n,o),t}function wV(e,t,n){const i=t?t.mark.marktype==="group"?t:t.mark.group:null;function r(s){var a=i,u;if(s){for(u=t;u;u=u.mark.group)if(u.mark.name===s){a=u;break}}return a&&a.mark&&a.mark.interactive?a:{}}function o(s){if(!s)return n;Y(s)&&(s=r(s));const a=n.slice();for(;s;)a[0]-=s.x||0,a[1]-=s.y||0,s=s.mark&&s.mark.group;return a}return{view:Rt(e),item:Rt(t||{}),group:r,xy:o,x:s=>o(s)[0],y:s=>o(s)[1]}}const YS="view",SV="timer",$V="window",AV={trap:!1};function kV(e){const t=fe({defaults:{}},e),n=(i,r)=>{r.forEach(o=>{T(i[o])&&(i[o]=si(i[o]))})};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}function DM(e,t,n,i){e._eventListeners.push({type:n,sources:K(t),handler:i})}function CV(e,t){var n=e._eventConfig.defaults,i=n.prevent,r=n.allow;return i===!1||r===!0?!1:i===!0||r===!1?!0:i?i[t]:r?!r[t]:e.preventDefault()}function Jc(e,t,n){const i=e._eventConfig&&e._eventConfig[t];return i===!1||X(i)&&!i[n]?(e.warn(`Blocked ${t} ${n} event listener.`),!1):!0}function FV(e,t,n){var i=this,r=new wh(n),o=function(l,c){i.runAsync(null,()=>{e===YS&&CV(i,t)&&l.preventDefault(),r.receive(EV(i,l,c))})},s;if(e===SV)Jc(i,"timer",t)&&i.timer(o,t);else if(e===YS)Jc(i,"view",t)&&i.addEventListener(t,o,AV);else if(e===$V?Jc(i,"window",t)&&typeof window<"u"&&(s=[window]):typeof document<"u"&&Jc(i,"selector",t)&&(s=Array.from(document.querySelectorAll(e))),!s)i.warn("Can not resolve event source: "+e);else{for(var a=0,u=s.length;a<u;++a)s[a].addEventListener(t,o);DM(i,s,t,o)}return r}function KS(e){return e.item}function JS(e){return e.item.mark.source}function QS(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function _V(e,t){return e=[e||"hover"],t=[t||"update",e[0]],this.on(this.events("view","pointerover",KS),JS,QS(e)),this.on(this.events("view","pointerout",KS),JS,QS(t)),this}function OV(){var e=this._tooltip,t=this._timers,n=this._handler.handlers(),i=this._eventListeners,r,o,s,a,u;for(r=t.length;--r>=0;)t[r].stop();for(r=i.length;--r>=0;)for(s=i[r],o=s.sources.length;--o>=0;)s.sources[o].removeEventListener(s.type,s.handler);for(e&&e.call(this,this._handler,null,null,null),r=n.length;--r>=0;)u=n[r].type,a=n[r].handler,this._handler.off(u,a);return this}function xn(e,t,n){const i=document.createElement(e);for(const r in t)i.setAttribute(r,t[r]);return n!=null&&(i.textContent=n),i}const RV="vega-bind",MV="vega-bind-name",DV="vega-bind-radio";function TV(e,t,n){if(!t)return;const i=n.param;let r=n.state;return r||(r=n.state={elements:null,active:!1,set:null,update:s=>{s!=e.signal(i.signal)&&e.runAsync(null,()=>{r.source=!0,e.signal(i.signal,s)})}},i.debounce&&(r.update=vy(i.debounce,r.update))),(i.input==null&&i.element?NV:IV)(r,t,i,e),r.active||(e.on(e._signals[i.signal],null,()=>{r.source?r.source=!1:r.set(e.signal(i.signal))}),r.active=!0),r}function NV(e,t,n,i){const r=n.event||"input",o=()=>e.update(t.value);i.signal(n.signal,t.value),t.addEventListener(r,o),DM(i,t,r,o),e.set=s=>{t.value=s,t.dispatchEvent(LV(r))}}function LV(e){return typeof Event<"u"?new Event(e):{type:e}}function IV(e,t,n,i){const r=i.signal(n.signal),o=xn("div",{class:RV}),s=n.input==="radio"?o:o.appendChild(xn("label"));s.appendChild(xn("span",{class:MV},n.name||n.signal)),t.appendChild(o);let a=PV;switch(n.input){case"checkbox":a=zV;break;case"select":a=BV;break;case"radio":a=UV;break;case"range":a=jV;break}a(e,s,n,r)}function PV(e,t,n,i){const r=xn("input");for(const o in n)o!=="signal"&&o!=="element"&&r.setAttribute(o==="input"?"type":o,n[o]);r.setAttribute("name",n.signal),r.value=i,t.appendChild(r),r.addEventListener("input",()=>e.update(r.value)),e.elements=[r],e.set=o=>r.value=o}function zV(e,t,n,i){const r={type:"checkbox",name:n.signal};i&&(r.checked=!0);const o=xn("input",r);t.appendChild(o),o.addEventListener("change",()=>e.update(o.checked)),e.elements=[o],e.set=s=>o.checked=!!s||null}function BV(e,t,n,i){const r=xn("select",{name:n.signal}),o=n.labels||[];n.options.forEach((s,a)=>{const u={value:s};Id(s,i)&&(u.selected=!0),r.appendChild(xn("option",u,(o[a]||s)+""))}),t.appendChild(r),r.addEventListener("change",()=>{e.update(n.options[r.selectedIndex])}),e.elements=[r],e.set=s=>{for(let a=0,u=n.options.length;a<u;++a)if(Id(n.options[a],s)){r.selectedIndex=a;return}}}function UV(e,t,n,i){const r=xn("span",{class:DV}),o=n.labels||[];t.appendChild(r),e.elements=n.options.map((s,a)=>{const u={type:"radio",name:n.signal,value:s};Id(s,i)&&(u.checked=!0);const l=xn("input",u);l.addEventListener("change",()=>e.update(s));const c=xn("label",{},(o[a]||s)+"");return c.prepend(l),r.appendChild(c),l}),e.set=s=>{const a=e.elements,u=a.length;for(let l=0;l<u;++l)Id(a[l].value,s)&&(a[l].checked=!0)}}function jV(e,t,n,i){i=i!==void 0?i:(+n.max+ +n.min)/2;const r=n.max!=null?n.max:Math.max(100,+i)||100,o=n.min||Math.min(0,r,+i)||0,s=n.step||pl(o,r,100),a=xn("input",{type:"range",name:n.signal,min:o,max:r,step:s});a.value=i;const u=xn("span",{},+i);t.appendChild(a),t.appendChild(u);const l=()=>{u.textContent=a.value,e.update(+a.value)};a.addEventListener("input",l),a.addEventListener("change",l),e.elements=[a],e.set=c=>{a.value=c,u.textContent=c}}function Id(e,t){return e===t||e+""==t+""}function TM(e,t,n,i,r,o){return t=t||new i(e.loader()),t.initialize(n,RM(e),MM(e),Qh(e),r,o).background(e.background())}function tx(e,t){return t?function(){try{t.apply(this,arguments)}catch(n){e.error(n)}}:null}function qV(e,t,n,i){const r=new i(e.loader(),tx(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,Qh(e),e);return t&&t.handlers().forEach(o=>{r.on(o.type,o.handler)}),r}function WV(e,t){const n=this,i=n._renderType,r=n._eventConfig.bind,o=qh(i);e=n._el=e?jp(n,e,!0):null,gV(n),o||n.error("Unrecognized renderer type: "+i);const s=o.handler||ac,a=e?o.renderer:o.headless;return n._renderer=a?TM(n,n._renderer,e,a):null,n._handler=qV(n,n._handler,e,s),n._redraw=!0,e&&r!=="none"&&(t=t?n._elBind=jp(n,t,!0):e.appendChild(xn("form",{class:"vega-bindings"})),n._bind.forEach(u=>{u.param.element&&r!=="container"&&(u.element=jp(n,u.param.element,!!u.param.input))}),n._bind.forEach(u=>{TV(n,u.element||t,u)})),n}function jp(e,t,n){if(typeof t=="string")if(typeof document<"u"){if(t=document.querySelector(t),!t)return e.error("Signal bind element not found: "+t),null}else return e.error("DOM document instance not found."),null;if(t&&n)try{t.textContent=""}catch(i){t=null,e.error(i)}return t}const wu=e=>+e||0,GV=e=>({top:e,bottom:e,left:e,right:e});function ZS(e){return X(e)?{top:wu(e.top),bottom:wu(e.bottom),left:wu(e.left),right:wu(e.right)}:GV(wu(e))}async function nx(e,t,n,i){const r=qh(t),o=r&&r.headless;return o||M("Unrecognized renderer type: "+t),await e.runAsync(),TM(e,null,null,o,n,i).renderAsync(e._scenegraph.root)}async function HV(e,t){e!==Yr.Canvas&&e!==Yr.SVG&&e!==Yr.PNG&&M("Unrecognized image type: "+e);const n=await nx(this,e,t);return e===Yr.SVG?VV(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")}function VV(e,t){const n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}async function XV(e,t){return(await nx(this,Yr.Canvas,e,t)).canvas()}async function YV(e){return(await nx(this,Yr.SVG,e)).svg()}function KV(e,t,n){return FM(e,pa,_l,n).parse(t)}function JV(e){var t=this._runtime.scales;return J(t,e)||M("Unrecognized scale or projection: "+e),t[e].value}var NM="width",LM="height",ix="padding",e$={skip:!0};function IM(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===ix?i.left+i.right:0)}function PM(e,t){var n=e.autosize(),i=e.padding();return t-(n&&n.contains===ix?i.top+i.bottom:0)}function QV(e){var t=e._signals,n=t[NM],i=t[LM],r=t[ix];function o(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,a=>{e._width=a.size,e._viewWidth=IM(e,a.size),o()},{size:n}),e._resizeHeight=e.add(null,a=>{e._height=a.size,e._viewHeight=PM(e,a.size),o()},{size:i});const s=e.add(null,o,{pad:r});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=i.rank+1,s.rank=r.rank+1}function ZV(e,t,n,i,r,o){this.runAfter(s=>{let a=0;s._autosize=0,s.width()!==n&&(a=1,s.signal(NM,n,e$),s._resizeWidth.skip(!0)),s.height()!==i&&(a=1,s.signal(LM,i,e$),s._resizeHeight.skip(!0)),s._viewWidth!==e&&(s._resize=1,s._viewWidth=e),s._viewHeight!==t&&(s._resize=1,s._viewHeight=t),(s._origin[0]!==r[0]||s._origin[1]!==r[1])&&(s._resize=1,s._origin=r),a&&s.run("enter"),o&&s.runAfter(u=>u.resize())},!1,1)}function eX(e){return this._runtime.getState(e||{data:tX,signals:nX,recurse:!0})}function tX(e,t){return t.modified&&T(t.input.value)&&!e.startsWith("_:vega:_")}function nX(e,t){return!(e==="parent"||t instanceof pa.proxy)}function iX(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},t=>{t._trigger=!0}),this}function rX(e,t){function n(i){e({timestamp:Date.now(),elapsed:i})}this._timers.push(dI(n,t))}function oX(e,t,n,i){const r=e.element();r&&r.setAttribute("title",sX(i))}function sX(e){return e==null?"":T(e)?zM(e):X(e)&&!eo(e)?aX(e):e+""}function aX(e){return Object.keys(e).map(t=>{const n=e[t];return t+": "+(T(n)?zM(n):BM(n))}).join(`
15
- `)}function zM(e){return"["+e.map(BM).join(", ")+"]"}function BM(e){return T(e)?"[…]":X(e)&&!eo(e)?"{…}":e}function uX(){if(this.renderer()==="canvas"&&this._renderer._canvas){let e=null;const t=()=>{e!=null&&e();const n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener("change",t),e=()=>{n.removeEventListener("change",t)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};t()}}function UM(e,t){const n=this;if(t=t||{},ra.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),t.logLevel!=null&&n.logLevel(t.logLevel),t.locale||e.locale){const o=fe({},e.locale,t.locale);n.locale(jF(o.number,o.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||Yr.Canvas,n._scenegraph=new NO;const i=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||oX,n._redraw=!0,n._handler=new ac().scene(i),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=kV(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const r=KV(n,e,t.expr);n._runtime=r,n._signals=r.signals,n._bind=(e.bindings||[]).map(o=>({state:null,param:fe({},o)})),r.root&&r.root.set(i),i.source=r.data.root.input,n.pulse(r.data.root.input,n.changeset().insert(i.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=IM(n,n._width),n._viewHeight=PM(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,QV(n),pV(n),mV(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function Qc(e,t){return J(e._signals,t)?e._signals[t]:M("Unrecognized signal name: "+G(t))}function jM(e,t){const n=(e._targets||[]).filter(i=>i._update&&i._update.handler===t);return n.length?n[0]:null}function t$(e,t,n,i){let r=jM(n,i);return r||(r=tx(e,()=>i(t,n.value)),r.handler=i,e.on(n,null,r)),e}function n$(e,t,n){const i=jM(t,n);return i&&t._targets.remove(i),e}H(UM,ra,{async evaluate(e,t,n){if(await ra.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,xV(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(i){this.error(i)}return n&&bf(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=e!=null?e+"":null;return t!==this._desc&&OM(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){const i=Qc(this,e);return arguments.length===1?i.value:this.update(i,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",ZS(e)):ZS(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(qh(e)||M("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(ra.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(Qc(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:ZV,addEventListener(e,t,n){let i=t;return n&&n.trap===!1||(i=tx(this,t),i.raw=t),this._handler.on(e,i),this},removeEventListener(e,t){for(var n=this._handler.handlers(e),i=n.length,r,o;--i>=0;)if(o=n[i].type,r=n[i].handler,e===o&&(t===r||t===r.raw)){this._handler.off(o,r);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.includes(e)||t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return t$(this,e,Qc(this,e),t)},removeSignalListener(e,t){return n$(this,Qc(this,e),t)},addDataListener(e,t){return t$(this,e,Ld(this,e).values,t)},removeDataListener(e,t){return n$(this,Ld(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=X0(this,null);this._globalCursor=!!e,t&&X0(this,t)}return this}else return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:rX,events:FV,finalize:OV,hover:_V,data:yV,change:Jh,insert:bV,remove:vV,scale:JV,initialize:WV,toImageURL:HV,toCanvas:XV,toSVG:YV,getState:eX,setState:iX,_watchPixelRatio:uX});const lX="view",Pd="[",zd="]",qM="{",WM="}",cX=":",GM=",",fX="@",dX=">",hX=/[[\]{}]/,gX={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let HM,VM;function vo(e,t,n){return HM=t||lX,VM=n||gX,XM(e.trim()).map(Y0)}function pX(e){return VM[e]}function cl(e,t,n,i,r){const o=e.length;let s=0,a;for(;t<o;++t){if(a=e[t],!s&&a===n)return t;r&&r.includes(a)?--s:i&&i.includes(a)&&++s}return t}function XM(e){const t=[],n=e.length;let i=0,r=0;for(;r<n;)r=cl(e,r,GM,Pd+qM,zd+WM),t.push(e.substring(i,r).trim()),i=++r;if(t.length===0)throw"Empty event selector: "+e;return t}function Y0(e){return e[0]==="["?mX(e):yX(e)}function mX(e){const t=e.length;let n=1,i;if(n=cl(e,n,zd,Pd,zd),n===t)throw"Empty between selector: "+e;if(i=XM(e.substring(1,n)),i.length!==2)throw"Between selector must have two elements: "+e;if(e=e.slice(n+1).trim(),e[0]!==dX)throw"Expected '>' after between selector: "+e;i=i.map(Y0);const r=Y0(e.slice(1).trim());return r.between?{between:i,stream:r}:(r.between=i,r)}function yX(e){const t={source:HM},n=[];let i=[0,0],r=0,o=0,s=e.length,a=0,u,l;if(e[s-1]===WM){if(a=e.lastIndexOf(qM),a>=0){try{i=bX(e.substring(a+1,s-1))}catch{throw"Invalid throttle specification: "+e}e=e.slice(0,a).trim(),s=e.length}else throw"Unmatched right brace: "+e;a=0}if(!s)throw e;if(e[0]===fX&&(r=++a),u=cl(e,a,cX),u<s&&(n.push(e.substring(o,u).trim()),o=a=++u),a=cl(e,a,Pd),a===s)n.push(e.substring(o,s).trim());else if(n.push(e.substring(o,a).trim()),l=[],o=++a,o===s)throw"Unmatched left bracket: "+e;for(;a<s;){if(a=cl(e,a,zd),a===s)throw"Unmatched left bracket: "+e;if(l.push(e.substring(o,a).trim()),a<s-1&&e[++a]!==Pd)throw"Expected left bracket: "+e;o=++a}if(!(s=n.length)||hX.test(n[s-1]))throw"Invalid event selector: "+e;return s>1?(t.type=n[1],r?t.markname=n[0].slice(1):pX(n[0])?t.marktype=n[0]:t.source=n[0]):t.type=n[0],t.type.slice(-1)==="!"&&(t.consume=!0,t.type=t.type.slice(0,-1)),l!=null&&(t.filter=l),i[0]&&(t.throttle=i[0]),i[1]&&(t.debounce=i[1]),t}function bX(e){const t=e.split(GM);if(!e.length||t.length>2)throw e;return t.map(n=>{const i=+n;if(i!==i)throw e;return i})}function vX(e){return X(e)?e:{type:e||"pad"}}const Su=e=>+e||0,xX=e=>({top:e,bottom:e,left:e,right:e});function EX(e){return X(e)?e.signal?e:{top:Su(e.top),bottom:Su(e.bottom),left:Su(e.left),right:Su(e.right)}:xX(Su(e))}const lt=e=>X(e)&&!T(e)?fe({},e):{value:e};function i$(e,t,n,i){return n!=null?(X(n)&&!T(n)||T(n)&&n.length&&X(n[0])?e.update[t]=n:e[i||"enter"][t]={value:n},1):0}function vt(e,t,n){for(const i in t)i$(e,i,t[i]);for(const i in n)i$(e,i,n[i],"update")}function Za(e,t,n){for(const i in t)n&&J(n,i)||(e[i]=fe(e[i]||{},t[i]));return e}function Xs(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const rx="mark",ox="frame",sx="scope",wX="axis",SX="axis-domain",$X="axis-grid",AX="axis-label",kX="axis-tick",CX="axis-title",FX="legend",_X="legend-band",OX="legend-entry",RX="legend-gradient",YM="legend-label",MX="legend-symbol",DX="legend-title",TX="title",NX="title-text",LX="title-subtitle";function IX(e,t,n,i,r){const o={},s={};let a,u,l,c;u="lineBreak",t==="text"&&r[u]!=null&&!Xs(u,e)&&qp(o,u,r[u]),(n=="legend"||String(n).startsWith("axis"))&&(n=null),c=n===ox?r.group:n===rx?fe({},r.mark,r[t]):null;for(u in c)l=Xs(u,e)||(u==="fill"||u==="stroke")&&(Xs("fill",e)||Xs("stroke",e)),l||qp(o,u,c[u]);K(i).forEach(f=>{const d=r.style&&r.style[f];for(const h in d)Xs(h,e)||qp(o,h,d[h])}),e=fe({},e);for(u in o)c=o[u],c.signal?(a=a||{})[u]=c:s[u]=c;return e.enter=fe(s,e.enter),a&&(e.update=fe(a,e.update)),e}function qp(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const KM=e=>Y(e)?G(e):e.signal?`(${e.signal})`:JM(e);function Zh(e){if(e.gradient!=null)return zX(e);let t=e.signal?`(${e.signal})`:e.color?PX(e.color):e.field!=null?JM(e.field):e.value!==void 0?G(e.value):void 0;return e.scale!=null&&(t=BX(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${Mf(e.exponent)})`),e.mult!=null&&(t+=`*${Mf(e.mult)}`),e.offset!=null&&(t+=`+${Mf(e.offset)}`),e.round&&(t=`round(${t})`),t}const Zc=(e,t,n,i)=>`(${e}(${[t,n,i].map(Zh).join(",")})+'')`;function PX(e){return e.c?Zc("hcl",e.h,e.c,e.l):e.h||e.s?Zc("hsl",e.h,e.s,e.l):e.l||e.a?Zc("lab",e.l,e.a,e.b):e.r||e.g||e.b?Zc("rgb",e.r,e.g,e.b):null}function zX(e){const t=[e.start,e.stop,e.count].map(n=>n==null?null:G(n));for(;t.length&&be(t)==null;)t.pop();return t.unshift(KM(e.gradient)),`gradient(${t.join(",")})`}function Mf(e){return X(e)?"("+Zh(e)+")":e}function JM(e){return QM(X(e)?e:{datum:e})}function QM(e){let t,n,i;if(e.signal)t="datum",i=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(i=e.parent,t+=".datum"):i=e.group}else e.datum?(t="datum",i=e.datum):M("Invalid field reference: "+G(e));return e.signal||(i=Y(i)?Gi(i).map(G).join("]["):QM(i)),t+"["+i+"]"}function BX(e,t){const n=KM(e.scale);return e.range!=null?t=`lerp(_range(${n}), ${+e.range})`:(t!==void 0&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(+e.band==1?"":"*"+Mf(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),t==null&&(t="0")),t}function UX(e){let t="";return e.forEach(n=>{const i=Zh(n);t+=n.test?`(${n.test})?${i}:`:i}),be(t)===":"&&(t+="null"),t}function ZM(e,t,n,i,r,o){const s={};o=o||{},o.encoders={$encode:s},e=IX(e,t,n,i,r.config);for(const a in e)s[a]=jX(e[a],t,o,r);return o}function jX(e,t,n,i){const r={},o={};for(const s in e)e[s]!=null&&(r[s]=WX(qX(e[s]),i,n,o));return{$expr:{marktype:t,channels:r},$fields:Object.keys(o),$output:Object.keys(e)}}function qX(e){return T(e)?UX(e):Zh(e)}function WX(e,t,n,i){const r=zi(e,t);return r.$fields.forEach(o=>i[o]=1),fe(n,r.$params),r.$expr}const GX="outer",HX=["value","update","init","react","bind"];function r$(e,t){M(e+' for "outer" push: '+G(t))}function eD(e,t){const n=e.name;if(e.push===GX)t.signals[n]||r$("No prior signal definition",n),HX.forEach(i=>{e[i]!==void 0&&r$("Invalid property ",i)});else{const i=t.addSignal(n,e.value);e.react===!1&&(i.react=!1),e.bind&&t.addBinding(n,e.bind)}}function K0(e,t,n,i){this.id=-1,this.type=e,this.value=t,this.params=n,i&&(this.parent=i)}function eg(e,t,n,i){return new K0(e,t,n,i)}function Bd(e,t){return eg("operator",e,t)}function te(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function Ol(e,t){return t?{$field:e,$name:t}:{$field:e}}const J0=Ol("key");function o$(e,t){return{$compare:e,$order:t}}function VX(e,t){const n={$key:e};return t&&(n.$flat=!0),n}const XX="ascending",YX="descending";function KX(e){return X(e)?(e.order===YX?"-":"+")+tg(e.op,e.field):""}function tg(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const ax="scope",Q0="view";function rt(e){return e&&e.signal}function JX(e){return e&&e.expr}function Df(e){if(rt(e))return!0;if(X(e)){for(const t in e)if(Df(e[t]))return!0}return!1}function Kn(e,t){return e??t}function Xo(e){return e&&e.signal||e}const s$="timer";function Rl(e,t){return(e.merge?ZX:e.stream?eY:e.type?tY:M("Invalid stream specification: "+G(e)))(e,t)}function QX(e){return e===ax?Q0:e||Q0}function ZX(e,t){const n=e.merge.map(r=>Rl(r,t)),i=ux({merge:n},e,t);return t.addStream(i).id}function eY(e,t){const n=Rl(e.stream,t),i=ux({stream:n},e,t);return t.addStream(i).id}function tY(e,t){let n;e.type===s$?(n=t.event(s$,e.throttle),e={between:e.between,filter:e.filter}):n=t.event(QX(e.source),e.type);const i=ux({stream:n},e,t);return Object.keys(i).length===1?n:t.addStream(i).id}function ux(e,t,n){let i=t.between;return i&&(i.length!==2&&M('Stream "between" parameter must have 2 entries: '+G(t)),e.between=[Rl(i[0],n),Rl(i[1],n)]),i=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&i.push(nY(t.marktype,t.markname,t.markrole)),t.source===ax&&i.push("inScope(event.item)"),i.length&&(e.filter=zi("("+i.join(")&&(")+")",n).$expr),(i=t.throttle)!=null&&(e.throttle=+i),(i=t.debounce)!=null&&(e.debounce=+i),t.consume&&(e.consume=!0),e}function nY(e,t,n){const i="event.item";return i+(e&&e!=="*"?"&&"+i+".mark.marktype==='"+e+"'":"")+(n?"&&"+i+".mark.role==='"+n+"'":"")+(t?"&&"+i+".mark.name==='"+t+"'":"")}const iY={code:"_.$value",ast:{type:"Identifier",value:"value"}};function rY(e,t,n){const i=e.encode,r={target:n};let o=e.events,s=e.update,a=[];o||M("Signal update missing events specification."),Y(o)&&(o=vo(o,t.isSubscope()?ax:Q0)),o=K(o).filter(u=>u.signal||u.scale?(a.push(u),0):1),a.length>1&&(a=[sY(a)]),o.length&&a.push(o.length>1?{merge:o}:o[0]),i!=null&&(s&&M("Signal encode and update are mutually exclusive."),s="encode(item(),"+G(i)+")"),r.update=Y(s)?zi(s,t):s.expr!=null?zi(s.expr,t):s.value!=null?s.value:s.signal!=null?{$expr:iY,$params:{$value:t.signalRef(s.signal)}}:M("Invalid signal update specification."),e.force&&(r.options={force:!0}),a.forEach(u=>t.addUpdate(fe(oY(u,t),r)))}function oY(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):Rl(e,t)}}function sY(e){return{signal:"["+e.map(t=>t.scale?'scale("'+t.scale+'")':t.signal)+"]"}}function aY(e,t){const n=t.getSignal(e.name);let i=e.update;e.init&&(i?M("Signals can not include both init and update expressions."):(i=e.init,n.initonly=!0)),i&&(i=zi(i,t),n.update=i.$expr,n.params=i.$params),e.on&&e.on.forEach(r=>rY(r,t,n.id))}const Oe=e=>(t,n,i)=>eg(e,n,t||void 0,i),tD=Oe("aggregate"),uY=Oe("axisticks"),nD=Oe("bound"),gi=Oe("collect"),a$=Oe("compare"),lY=Oe("datajoin"),iD=Oe("encode"),cY=Oe("expression"),fY=Oe("facet"),dY=Oe("field"),hY=Oe("key"),gY=Oe("legendentries"),pY=Oe("load"),mY=Oe("mark"),yY=Oe("multiextent"),bY=Oe("multivalues"),vY=Oe("overlap"),xY=Oe("params"),rD=Oe("prefacet"),EY=Oe("projection"),wY=Oe("proxy"),SY=Oe("relay"),oD=Oe("render"),$Y=Oe("scale"),ks=Oe("sieve"),AY=Oe("sortitems"),sD=Oe("viewlayout"),kY=Oe("values");let CY=0;const aD={min:"min",max:"max",count:"sum"};function FY(e,t){const n=e.type||"linear";X_(n)||M("Unrecognized scale type: "+G(n)),t.addScale(e.name,{type:n,domain:void 0})}function _Y(e,t){const n=t.getScale(e.name).params;let i;n.domain=uD(e.domain,e,t),e.range!=null&&(n.range=cD(e,t,n)),e.interpolate!=null&&zY(e.interpolate,n),e.nice!=null&&(n.nice=PY(e.nice,t)),e.bins!=null&&(n.bins=IY(e.bins,t));for(i in e)J(n,i)||i==="name"||(n[i]=Mn(e[i],t))}function Mn(e,t){return X(e)?e.signal?t.signalRef(e.signal):M("Unsupported object: "+G(e)):e}function Tf(e,t){return e.signal?t.signalRef(e.signal):e.map(n=>Mn(n,t))}function ng(e){M("Can not find data set: "+G(e))}function uD(e,t,n){if(!e){(t.domainMin!=null||t.domainMax!=null)&&M("No scale domain defined for domainMin/domainMax to override.");return}return e.signal?n.signalRef(e.signal):(T(e)?OY:e.fields?MY:RY)(e,t,n)}function OY(e,t,n){return e.map(i=>Mn(i,n))}function RY(e,t,n){const i=n.getData(e.data);return i||ng(e.data),ba(t.type)?i.valuesRef(n,e.field,lD(e.sort,!1)):J_(t.type)?i.domainRef(n,e.field):i.extentRef(n,e.field)}function MY(e,t,n){const i=e.data,r=e.fields.reduce((o,s)=>(s=Y(s)?{data:i,field:s}:T(s)||s.signal?DY(s,n):s,o.push(s),o),[]);return(ba(t.type)?TY:J_(t.type)?NY:LY)(e,n,r)}function DY(e,t){const n="_:vega:_"+CY++,i=gi({});if(T(e))i.value={$ingest:e};else if(e.signal){const r="setdata("+G(n)+","+e.signal+")";i.params.input=t.signalRef(r)}return t.addDataPipeline(n,[i,ks({})]),{data:n,field:"data"}}function TY(e,t,n){const i=lD(e.sort,!0);let r,o;const s=n.map(l=>{const c=t.getData(l.data);return c||ng(l.data),c.countsRef(t,l.field,i)}),a={groupby:J0,pulse:s};i&&(r=i.op||"count",o=i.field?tg(r,i.field):"count",a.ops=[aD[r]],a.fields=[t.fieldRef(o)],a.as=[o]),r=t.add(tD(a));const u=t.add(gi({pulse:te(r)}));return o=t.add(kY({field:J0,sort:t.sortRef(i),pulse:te(u)})),te(o)}function lD(e,t){return e&&(!e.field&&!e.op?X(e)?e.field="key":e={field:"key"}:!e.field&&e.op!=="count"?M("No field provided for sort aggregate op: "+e.op):t&&e.field&&e.op&&!aD[e.op]&&M("Multiple domain scales can not be sorted using "+e.op)),e}function NY(e,t,n){const i=n.map(r=>{const o=t.getData(r.data);return o||ng(r.data),o.domainRef(t,r.field)});return te(t.add(bY({values:i})))}function LY(e,t,n){const i=n.map(r=>{const o=t.getData(r.data);return o||ng(r.data),o.extentRef(t,r.field)});return te(t.add(yY({extents:i})))}function IY(e,t){return e.signal||T(e)?Tf(e,t):t.objectProperty(e)}function PY(e,t){return e.signal?t.signalRef(e.signal):X(e)?{interval:Mn(e.interval),step:Mn(e.step)}:Mn(e)}function zY(e,t){t.interpolate=Mn(e.type||e),e.gamma!=null&&(t.interpolateGamma=Mn(e.gamma))}function cD(e,t,n){const i=t.config.range;let r=e.range;if(r.signal)return t.signalRef(r.signal);if(Y(r)){if(i&&J(i,r))return e=fe({},e,{range:i[r]}),cD(e,t,n);r==="width"?r=[0,{signal:"width"}]:r==="height"?r=ba(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:M("Unrecognized scale range value: "+G(r))}else if(r.scheme){n.scheme=T(r.scheme)?Tf(r.scheme,t):Mn(r.scheme,t),r.extent&&(n.schemeExtent=Tf(r.extent,t)),r.count&&(n.schemeCount=Mn(r.count,t));return}else if(r.step){n.rangeStep=Mn(r.step,t);return}else{if(ba(e.type)&&!T(r))return uD(r,e,t);T(r)||M("Unsupported range type: "+G(r))}return r.map(o=>(T(o)?Tf:Mn)(o,t))}function BY(e,t){const n=t.config.projection||{},i={};for(const r in e)r!=="name"&&(i[r]=Z0(e[r],r,t));for(const r in n)i[r]==null&&(i[r]=Z0(n[r],r,t));t.addProjection(e.name,i)}function Z0(e,t,n){return T(e)?e.map(i=>Z0(i,t,n)):X(e)?e.signal?n.signalRef(e.signal):t==="fit"?e:M("Unsupported parameter object: "+G(e)):e}const pi="top",eu="left",tu="right",co="bottom",fD="center",UY="vertical",jY="start",qY="middle",WY="end",e1="index",lx="label",GY="offset",Sa="perc",HY="perc2",Tn="value",dc="guide-label",cx="guide-title",VY="group-title",XY="group-subtitle",u$="symbol",Nf="gradient",t1="discrete",n1="size",YY="shape",KY="fill",JY="stroke",QY="strokeWidth",ZY="strokeDash",eK="opacity",fx=[n1,YY,KY,JY,QY,ZY,eK],hc={name:1,style:1,interactive:1},ve={value:0},Nn={value:1},ig="group",dD="rect",dx="rule",tK="symbol",Cs="text";function Ml(e){return e.type=ig,e.interactive=e.interactive||!1,e}function cn(e,t){const n=(i,r)=>Kn(e[i],Kn(t[i],r));return n.isVertical=i=>UY===Kn(e.direction,t.direction||(i?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>Kn(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>Kn(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>Kn(e.columns,Kn(t.columns,+n.isVertical(!0))),n}function hD(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function nK(e,t,n){const i=t.config.style[n];return i&&i[e]}function rg(e,t,n){return`item.anchor === '${jY}' ? ${e} : item.anchor === '${WY}' ? ${t} : ${n}`}const hx=rg(G(eu),G(tu),G(fD));function iK(e){const t=e("tickBand");let n=e("tickOffset"),i,r;return t?t.signal?(i={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},r={signal:`(${t.signal}) === 'extent'`},X(n)||(n={signal:`(${t.signal}) === 'extent' ? 0 : ${n}`})):t==="extent"?(i=1,r=!0,n=0):(i=.5,r=!1):(i=e("bandPosition"),r=e("tickExtra")),{extra:r,band:i,offset:n}}function gD(e,t){return t?e?X(e)?Object.assign({},e,{offset:gD(e.offset,t)}):{value:e,offset:t}:t:e}function kn(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=Za(e.encode,t,hc)):e.interactive=!1,e}function rK(e,t,n,i){const r=cn(e,n),o=r.isVertical(),s=r.gradientThickness(),a=r.gradientLength();let u,l,c,f,d;o?(l=[0,1],c=[0,0],f=s,d=a):(l=[0,0],c=[1,0],f=a,d=s);const h={enter:u={opacity:ve,x:ve,y:ve,width:lt(f),height:lt(d)},update:fe({},u,{opacity:Nn,fill:{gradient:t,start:l,stop:c}}),exit:{opacity:ve}};return vt(h,{stroke:r("gradientStrokeColor"),strokeWidth:r("gradientStrokeWidth")},{opacity:r("gradientOpacity")}),kn({type:dD,role:RX,encode:h},i)}function oK(e,t,n,i,r){const o=cn(e,n),s=o.isVertical(),a=o.gradientThickness(),u=o.gradientLength();let l,c,f,d,h="";s?(l="y",f="y2",c="x",d="width",h="1-"):(l="x",f="x2",c="y",d="height");const g={opacity:ve,fill:{scale:t,field:Tn}};g[l]={signal:h+"datum."+Sa,mult:u},g[c]=ve,g[f]={signal:h+"datum."+HY,mult:u},g[d]=lt(a);const p={enter:g,update:fe({},g,{opacity:Nn}),exit:{opacity:ve}};return vt(p,{stroke:o("gradientStrokeColor"),strokeWidth:o("gradientStrokeWidth")},{opacity:o("gradientOpacity")}),kn({type:dD,role:_X,key:Tn,from:r,encode:p},i)}const sK=`datum.${Sa}<=0?"${eu}":datum.${Sa}>=1?"${tu}":"${fD}"`,aK=`datum.${Sa}<=0?"${co}":datum.${Sa}>=1?"${pi}":"${qY}"`;function l$(e,t,n,i){const r=cn(e,t),o=r.isVertical(),s=lt(r.gradientThickness()),a=r.gradientLength();let u=r("labelOverlap"),l,c,f,d,h="";const g={enter:l={opacity:ve},update:c={opacity:Nn,text:{field:lx}},exit:{opacity:ve}};return vt(g,{fill:r("labelColor"),fillOpacity:r("labelOpacity"),font:r("labelFont"),fontSize:r("labelFontSize"),fontStyle:r("labelFontStyle"),fontWeight:r("labelFontWeight"),limit:Kn(e.labelLimit,t.gradientLabelLimit)}),o?(l.align={value:"left"},l.baseline=c.baseline={signal:aK},f="y",d="x",h="1-"):(l.align=c.align={signal:sK},l.baseline={value:"top"},f="x",d="y"),l[f]=c[f]={signal:h+"datum."+Sa,mult:a},l[d]=c[d]=s,s.offset=Kn(e.labelOffset,t.gradientLabelOffset)||0,u=u?{separation:r("labelSeparation"),method:u,order:"datum."+e1}:void 0,kn({type:Cs,role:YM,style:dc,key:Tn,from:i,encode:g,overlap:u},n)}function uK(e,t,n,i,r){const o=cn(e,t),s=n.entries,a=!!(s&&s.interactive),u=s?s.name:void 0,l=o("clipHeight"),c=o("symbolOffset"),f={data:"value"},d=`(${r}) ? datum.${GY} : datum.${n1}`,h=l?lt(l):{field:n1},g=`datum.${e1}`,p=`max(1, ${r})`;let m,y,b,v,x;h.mult=.5,m={enter:y={opacity:ve,x:{signal:d,mult:.5,offset:c},y:h},update:b={opacity:Nn,x:y.x,y:y.y},exit:{opacity:ve}};let w=null,S=null;e.fill||(w=t.symbolBaseFillColor,S=t.symbolBaseStrokeColor),vt(m,{fill:o("symbolFillColor",w),shape:o("symbolType"),size:o("symbolSize"),stroke:o("symbolStrokeColor",S),strokeDash:o("symbolDash"),strokeDashOffset:o("symbolDashOffset"),strokeWidth:o("symbolStrokeWidth")},{opacity:o("symbolOpacity")}),fx.forEach(C=>{e[C]&&(b[C]=y[C]={scale:e[C],field:Tn})});const E=kn({type:tK,role:MX,key:Tn,from:f,clip:l?!0:void 0,encode:m},n.symbols),$=lt(c);$.offset=o("labelOffset"),m={enter:y={opacity:ve,x:{signal:d,offset:$},y:h},update:b={opacity:Nn,text:{field:lx},x:y.x,y:y.y},exit:{opacity:ve}},vt(m,{align:o("labelAlign"),baseline:o("labelBaseline"),fill:o("labelColor"),fillOpacity:o("labelOpacity"),font:o("labelFont"),fontSize:o("labelFontSize"),fontStyle:o("labelFontStyle"),fontWeight:o("labelFontWeight"),limit:o("labelLimit")});const A=kn({type:Cs,role:YM,style:dc,key:Tn,from:f,encode:m},n.labels);return m={enter:{noBound:{value:!l},width:ve,height:l?lt(l):ve,opacity:ve},exit:{opacity:ve},update:b={opacity:Nn,row:{signal:null},column:{signal:null}}},o.isVertical(!0)?(v=`ceil(item.mark.items.length / ${p})`,b.row.signal=`${g}%${v}`,b.column.signal=`floor(${g} / ${v})`,x={field:["row",g]}):(b.row.signal=`floor(${g} / ${p})`,b.column.signal=`${g} % ${p}`,x={field:g}),b.column.signal=`(${r})?${b.column.signal}:${g}`,i={facet:{data:i,name:"value",groupby:e1}},Ml({role:sx,from:i,encode:Za(m,s,hc),marks:[E,A],name:u,interactive:a,sort:x})}function lK(e,t){const n=cn(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}const gx='item.orient === "left"',px='item.orient === "right"',og=`(${gx} || ${px})`,cK=`datum.vgrad && ${og}`,fK=rg('"top"','"bottom"','"middle"'),dK=rg('"right"','"left"','"center"'),hK=`datum.vgrad && ${px} ? (${dK}) : (${og} && !(datum.vgrad && ${gx})) ? "left" : ${hx}`,gK=`item._anchor || (${og} ? "middle" : "start")`,pK=`${cK} ? (${gx} ? -90 : 90) : 0`,mK=`${og} ? (datum.vgrad ? (${px} ? "bottom" : "top") : ${fK}) : "top"`;function yK(e,t,n,i){const r=cn(e,t),o={enter:{opacity:ve},update:{opacity:Nn,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:ve}};return vt(o,{orient:r("titleOrient"),_anchor:r("titleAnchor"),anchor:{signal:gK},angle:{signal:pK},align:{signal:hK},baseline:{signal:mK},text:e.title,fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),baseline:r("titleBaseline")}),kn({type:Cs,role:DX,style:cx,from:i,encode:o},n)}function bK(e,t){let n;return X(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+c$(e.path)+")":e.sphere&&(n="geoShape("+c$(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function c$(e){return X(e)&&e.signal?e.signal:G(e)}function pD(e){const t=e.role||"";return t.startsWith("axis")||t.startsWith("legend")||t.startsWith("title")?t:e.type===ig?sx:t||rx}function vK(e){return{marktype:e.type,name:e.name||void 0,role:e.role||pD(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function xK(e,t){return e&&e.signal?t.signalRef(e.signal):e!==!1}function mx(e,t){const n=t_(e.type);n||M("Unrecognized transform type: "+G(e.type));const i=eg(n.type.toLowerCase(),null,mD(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(i)),i.metadata=n.metadata||{},i}function mD(e,t,n){const i={},r=e.params.length;for(let o=0;o<r;++o){const s=e.params[o];i[s.name]=EK(s,t,n)}return i}function EK(e,t,n){const i=e.type,r=t[e.name];if(i==="index")return wK(e,t,n);if(r===void 0){e.required&&M("Missing required "+G(t.type)+" parameter: "+G(e.name));return}else{if(i==="param")return SK(e,t,n);if(i==="projection")return n.projectionRef(t[e.name])}return e.array&&!rt(r)?r.map(o=>f$(e,o,n)):f$(e,r,n)}function f$(e,t,n){const i=e.type;if(rt(t))return h$(i)?M("Expression references can not be signals."):Wp(i)?n.fieldRef(t):g$(i)?n.compareRef(t):n.signalRef(t.signal);{const r=e.expr||Wp(i);return r&&$K(t)?n.exprRef(t.expr,t.as):r&&AK(t)?Ol(t.field,t.as):h$(i)?zi(t,n):kK(i)?te(n.getData(t).values):Wp(i)?Ol(t):g$(i)?n.compareRef(t):t}}function wK(e,t,n){return Y(t.from)||M('Lookup "from" parameter must be a string literal.'),n.getData(t.from).lookupRef(n,t.key)}function SK(e,t,n){const i=t[e.name];return e.array?(T(i)||M("Expected an array of sub-parameters. Instead: "+G(i)),i.map(r=>d$(e,r,n))):d$(e,i,n)}function d$(e,t,n){const i=e.params.length;let r;for(let s=0;s<i;++s){r=e.params[s];for(const a in r.key)if(r.key[a]!==t[a]){r=null;break}if(r)break}r||M("Unsupported parameter: "+G(t));const o=fe(mD(r,t,n),r.key);return te(n.add(xY(o)))}const $K=e=>e&&e.expr,AK=e=>e&&e.field,kK=e=>e==="data",h$=e=>e==="expr",Wp=e=>e==="field",g$=e=>e==="compare";function CK(e,t,n){let i,r,o,s,a;return e?(i=e.facet)&&(t||M("Only group marks can be faceted."),i.field!=null?s=a=Lf(i,n):(e.data?a=te(n.getData(e.data).aggregate):(o=mx(fe({type:"aggregate",groupby:K(i.groupby)},i.aggregate),n),o.params.key=n.keyRef(i.groupby),o.params.pulse=Lf(i,n),s=a=te(n.add(o))),r=n.keyRef(i.groupby,!0))):s=te(n.add(gi(null,[{}]))),s||(s=Lf(e,n)),{key:r,pulse:s,parent:a}}function Lf(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:te(t.getData(e.data).output)}function us(e,t,n,i,r){this.scope=e,this.input=t,this.output=n,this.values=i,this.aggregate=r,this.index={}}us.fromEntries=function(e,t){const n=t.length,i=t[n-1],r=t[n-2];let o=t[0],s=null,a=1;for(o&&o.type==="load"&&(o=t[1]),e.add(t[0]);a<n;++a)t[a].params.pulse=te(t[a-1]),e.add(t[a]),t[a].type==="aggregate"&&(s=t[a]);return new us(e,o,r,i,s)};function yD(e){return Y(e)?e:null}function p$(e,t,n){const i=tg(n.op,n.field);let r;if(t.ops){for(let o=0,s=t.as.length;o<s;++o)if(t.as[o]===i)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((r=n.op.signal)?e.signalRef(r):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(i))}function $u(e,t,n,i,r,o,s){const a=t[n]||(t[n]={}),u=KX(o);let l=yD(r),c,f;if(l!=null&&(e=t.scope,l=l+(u?"|"+u:""),c=a[l]),!c){const d=o?{field:J0,pulse:t.countsRef(e,r,o)}:{field:e.fieldRef(r),pulse:te(t.output)};u&&(d.sort=e.sortRef(o)),f=e.add(eg(i,void 0,d)),s&&(t.index[r]=f),c=te(f),l!=null&&(a[l]=c)}return c}us.prototype={countsRef(e,t,n){const i=this,r=i.counts||(i.counts={}),o=yD(t);let s,a,u;return o!=null&&(e=i.scope,s=r[o]),s?n&&n.field&&p$(e,s.agg.params,n):(u={groupby:e.fieldRef(t,"key"),pulse:te(i.output)},n&&n.field&&p$(e,u,n),a=e.add(tD(u)),s=e.add(gi({pulse:te(a)})),s={agg:a,ref:te(s)},o!=null&&(r[o]=s)),s.ref},tuplesRef(){return te(this.values)},extentRef(e,t){return $u(e,this,"extent","extent",t,!1)},domainRef(e,t){return $u(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return $u(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return $u(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return $u(e,this,"indata","tupleindex",t,!0,!0)}};function FK(e,t,n){const i=e.from.facet,r=i.name,o=Lf(i,t);let s;i.name||M("Facet must have a name: "+G(i)),i.data||M("Facet must reference a data set: "+G(i)),i.field?s=t.add(rD({field:t.fieldRef(i.field),pulse:o})):i.groupby?s=t.add(fY({key:t.keyRef(i.groupby),group:te(t.proxy(n.parent)),pulse:o})):M("Facet must specify groupby or field: "+G(i));const a=t.fork(),u=a.add(gi()),l=a.add(ks({pulse:te(u)}));a.addData(r,new us(a,u,u,l)),a.addSignal("parent",null),s.params.subflow={$subflow:a.parse(e).toRuntime()}}function _K(e,t,n){const i=t.add(rD({pulse:n.pulse})),r=t.fork();r.add(ks()),r.addSignal("parent",null),i.params.subflow={$subflow:r.parse(e).toRuntime()}}function bD(e,t,n){const i=e.remove,r=e.insert,o=e.toggle,s=e.modify,a=e.values,u=t.add(Bd()),l="if("+e.trigger+',modify("'+n+'",'+[r,i,o,s,a].map(f=>f??"null").join(",")+"),0)",c=zi(l,t);u.update=c.$expr,u.params=c.$params}function sg(e,t){const n=pD(e),i=e.type===ig,r=e.from&&e.from.facet,o=e.overlap;let s=e.layout||n===sx||n===ox,a,u,l,c,f,d,h;const g=n===rx||s||r,p=CK(e.from,i,t);u=t.add(lY({key:p.key||(e.key?Ol(e.key):void 0),pulse:p.pulse,clean:!i}));const m=te(u);u=l=t.add(gi({pulse:m})),u=t.add(mY({markdef:vK(e),interactive:xK(e.interactive,t),clip:bK(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:te(u)}));const y=te(u);u=c=t.add(iD(ZM(e.encode,e.type,n,e.style,t,{mod:!1,pulse:y}))),u.params.parent=t.encode(),e.transform&&e.transform.forEach(S=>{const E=mx(S,t),$=E.metadata;($.generates||$.changes)&&M("Mark transforms should not generate new data."),$.nomod||(c.params.mod=!0),E.params.pulse=te(u),t.add(u=E)}),e.sort&&(u=t.add(AY({sort:t.compareRef(e.sort),pulse:te(u)})));const b=te(u);(r||s)&&(s=t.add(sD({layout:t.objectProperty(e.layout),legends:t.legends,mark:y,pulse:b})),d=te(s));const v=t.add(nD({mark:y,pulse:d||b}));h=te(v),i&&(g&&(a=t.operators,a.pop(),s&&a.pop()),t.pushState(b,d||h,m),r?FK(e,t,p):g?_K(e,t,p):t.parse(e),t.popState(),g&&(s&&a.push(s),a.push(v))),o&&(h=OK(o,h,t));const x=t.add(oD({pulse:h})),w=t.add(ks({pulse:te(x)},void 0,t.parent()));e.name!=null&&(f=e.name,t.addData(f,new us(t,l,x,w)),e.on&&e.on.forEach(S=>{(S.insert||S.remove||S.toggle)&&M("Marks only support modify triggers."),bD(S,t,f)}))}function OK(e,t,n){const i=e.method,r=e.bound,o=e.separation,s={separation:rt(o)?n.signalRef(o.signal):o,method:rt(i)?n.signalRef(i.signal):i,pulse:t};if(e.order&&(s.sort=n.compareRef({field:e.order})),r){const a=r.tolerance;s.boundTolerance=rt(a)?n.signalRef(a.signal):+a,s.boundScale=n.scaleRef(r.scale),s.boundOrient=r.orient}return te(n.add(vY(s)))}function RK(e,t){const n=t.config.legend,i=e.encode||{},r=cn(e,n),o=i.legend||{},s=o.name||void 0,a=o.interactive,u=o.style,l={};let c=0,f,d,h;fx.forEach(v=>e[v]?(l[v]=e[v],c=c||e[v]):0),c||M("Missing valid scale for legend.");const g=MK(e,t.scaleType(c)),p={title:e.title!=null,scales:l,type:g,vgrad:g!=="symbol"&&r.isVertical()},m=te(t.add(gi(null,[p]))),y={enter:{x:{value:0},y:{value:0}}},b=te(t.add(gY(d={type:g,scale:t.scaleRef(c),count:t.objectProperty(r("tickCount")),limit:t.property(r("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return g===Nf?(h=[rK(e,c,n,i.gradient),l$(e,n,i.labels,b)],d.count=d.count||t.signalRef(`max(2,2*floor((${Xo(r.gradientLength())})/100))`)):g===t1?h=[oK(e,c,n,i.gradient,b),l$(e,n,i.labels,b)]:(f=lK(e,n),h=[uK(e,n,i,b,Xo(f.columns))],d.size=NK(e,t,h[0].marks)),h=[Ml({role:OX,from:m,encode:y,marks:h,layout:f,interactive:a})],p.title&&h.push(yK(e,n,i.title,m)),sg(Ml({role:FX,from:m,encode:Za(TK(r,e,n),o,hc),marks:h,aria:r("aria"),description:r("description"),zindex:r("zindex"),name:s,interactive:a,style:u}),t)}function MK(e,t){let n=e.type||u$;return!e.type&&DK(e)===1&&(e.fill||e.stroke)&&(n=Fb(t)?Nf:m0(t)?t1:u$),n!==Nf?n:m0(t)?t1:Nf}function DK(e){return fx.reduce((t,n)=>t+(e[n]?1:0),0)}function TK(e,t,n){const i={enter:{},update:{}};return vt(i,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),i}function NK(e,t,n){const i=Xo(m$("size",e,n)),r=Xo(m$("strokeWidth",e,n)),o=Xo(LK(n[1].encode,t,dc));return zi(`max(ceil(sqrt(${i})+${r}),${o})`,t)}function m$(e,t,n){return t[e]?`scale("${t[e]}",datum)`:hD(e,n[0].encode)}function LK(e,t,n){return hD("fontSize",e)||nK("fontSize",t,n)}const IK=`item.orient==="${eu}"?-90:item.orient==="${tu}"?90:0`;function PK(e,t){e=Y(e)?{text:e}:e;const n=cn(e,t.config.title),i=e.encode||{},r=i.group||{},o=r.name||void 0,s=r.interactive,a=r.style,u=[],l={},c=te(t.add(gi(null,[l])));return u.push(UK(e,n,zK(e),c)),e.subtitle&&u.push(jK(e,n,i.subtitle,c)),sg(Ml({role:TX,from:c,encode:BK(n,r),marks:u,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:o,interactive:s,style:a}),t)}function zK(e){const t=e.encode;return t&&t.title||fe({name:e.name,interactive:e.interactive,style:e.style},t)}function BK(e,t){const n={enter:{},update:{}};return vt(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:hx},angle:{signal:IK},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),Za(n,t,hc)}function UK(e,t,n,i){const r={value:0},o=e.text,s={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return vt(s,{text:o,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),kn({type:Cs,role:NX,style:VY,from:i,encode:s},n)}function jK(e,t,n,i){const r={value:0},o=e.subtitle,s={enter:{opacity:r},update:{opacity:{value:1}},exit:{opacity:r}};return vt(s,{text:o,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),kn({type:Cs,role:LX,style:XY,from:i,encode:s},n)}function qK(e,t){const n=[];e.transform&&e.transform.forEach(i=>{n.push(mx(i,t))}),e.on&&e.on.forEach(i=>{bD(i,t,e.name)}),t.addDataPipeline(e.name,WK(e,t,n))}function WK(e,t,n){const i=[];let r=null,o=!1,s=!1,a,u,l,c,f;for(e.values?rt(e.values)||Df(e.format)?(i.push(y$(t,e)),i.push(r=Fo())):i.push(r=Fo({$ingest:e.values,$format:e.format})):e.url?Df(e.url)||Df(e.format)?(i.push(y$(t,e)),i.push(r=Fo())):i.push(r=Fo({$request:e.url,$format:e.format})):e.source&&(r=a=K(e.source).map(d=>te(t.getData(d).output)),i.push(null)),u=0,l=n.length;u<l;++u)c=n[u],f=c.metadata,!r&&!f.source&&i.push(r=Fo()),i.push(c),f.generates&&(s=!0),f.modifies&&!s&&(o=!0),f.source?r=c:f.changes&&(r=null);return a&&(l=a.length-1,i[0]=SY({derive:o,pulse:l?a:a[0]}),(o||l)&&i.splice(1,0,Fo())),r||i.push(Fo()),i.push(ks({})),i}function Fo(e){const t=gi({},e);return t.metadata={source:!0},t}function y$(e,t){return pY({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}const vD=e=>e===co||e===pi,ag=(e,t,n)=>rt(e)?XK(e.signal,t,n):e===eu||e===pi?t:n,ct=(e,t,n)=>rt(e)?HK(e.signal,t,n):vD(e)?t:n,ri=(e,t,n)=>rt(e)?VK(e.signal,t,n):vD(e)?n:t,xD=(e,t,n)=>rt(e)?YK(e.signal,t,n):e===pi?{value:t}:{value:n},GK=(e,t,n)=>rt(e)?KK(e.signal,t,n):e===tu?{value:t}:{value:n},HK=(e,t,n)=>ED(`${e} === '${pi}' || ${e} === '${co}'`,t,n),VK=(e,t,n)=>ED(`${e} !== '${pi}' && ${e} !== '${co}'`,t,n),XK=(e,t,n)=>yx(`${e} === '${eu}' || ${e} === '${pi}'`,t,n),YK=(e,t,n)=>yx(`${e} === '${pi}'`,t,n),KK=(e,t,n)=>yx(`${e} === '${tu}'`,t,n),ED=(e,t,n)=>(t=t!=null?lt(t):t,n=n!=null?lt(n):n,b$(t)&&b$(n)?(t=t?t.signal||G(t.value):null,n=n?n.signal||G(n.value):null,{signal:`${e} ? (${t}) : (${n})`}):[fe({test:e},t)].concat(n||[])),b$=e=>e==null||Object.keys(e).length===1,yx=(e,t,n)=>({signal:`${e} ? (${ta(t)}) : (${ta(n)})`}),JK=(e,t,n,i,r)=>({signal:(i!=null?`${e} === '${eu}' ? (${ta(i)}) : `:"")+(n!=null?`${e} === '${co}' ? (${ta(n)}) : `:"")+(r!=null?`${e} === '${tu}' ? (${ta(r)}) : `:"")+(t!=null?`${e} === '${pi}' ? (${ta(t)}) : `:"")+"(null)"}),ta=e=>rt(e)?e.signal:e==null?null:G(e),QK=(e,t)=>t===0?0:rt(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},oa=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function Ws(e,t,n,i){let r;if(t&&J(t,e))return t[e];if(J(n,e))return n[e];if(e.startsWith("title")){switch(e){case"titleColor":r="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":r=e[5].toLowerCase()+e.slice(6)}return i[cx][r]}else if(e.startsWith("label")){switch(e){case"labelColor":r="fill";break;case"labelFont":case"labelFontSize":r=e[5].toLowerCase()+e.slice(6)}return i[dc][r]}return null}function v$(e){const t={};for(const n of e)if(n)for(const i in n)t[i]=1;return Object.keys(t)}function ZK(e,t){var n=t.config,i=n.style,r=n.axis,o=t.scaleType(e.scale)==="band"&&n.axisBand,s=e.orient,a,u,l;if(rt(s)){const f=v$([n.axisX,n.axisY]),d=v$([n.axisTop,n.axisBottom,n.axisLeft,n.axisRight]);a={};for(l of f)a[l]=ct(s,Ws(l,n.axisX,r,i),Ws(l,n.axisY,r,i));u={};for(l of d)u[l]=JK(s.signal,Ws(l,n.axisTop,r,i),Ws(l,n.axisBottom,r,i),Ws(l,n.axisLeft,r,i),Ws(l,n.axisRight,r,i))}else a=s===pi||s===co?n.axisX:n.axisY,u=n["axis"+s[0].toUpperCase()+s.slice(1)];return a||u||o?fe({},r,a,u,o):r}function eJ(e,t,n,i){const r=cn(e,t),o=e.orient;let s,a;const u={enter:s={opacity:ve},update:a={opacity:Nn},exit:{opacity:ve}};vt(u,{stroke:r("domainColor"),strokeCap:r("domainCap"),strokeDash:r("domainDash"),strokeDashOffset:r("domainDashOffset"),strokeWidth:r("domainWidth"),strokeOpacity:r("domainOpacity")});const l=x$(e,0),c=x$(e,1);return s.x=a.x=ct(o,l,ve),s.x2=a.x2=ct(o,c),s.y=a.y=ri(o,l,ve),s.y2=a.y2=ri(o,c),kn({type:dx,role:SX,from:i,encode:u},n)}function x$(e,t){return{scale:e.scale,range:t}}function tJ(e,t,n,i,r){const o=cn(e,t),s=e.orient,a=e.gridScale,u=ag(s,1,-1),l=nJ(e.offset,u);let c,f,d;const h={enter:c={opacity:ve},update:d={opacity:Nn},exit:f={opacity:ve}};vt(h,{stroke:o("gridColor"),strokeCap:o("gridCap"),strokeDash:o("gridDash"),strokeDashOffset:o("gridDashOffset"),strokeOpacity:o("gridOpacity"),strokeWidth:o("gridWidth")});const g={scale:e.scale,field:Tn,band:r.band,extra:r.extra,offset:r.offset,round:o("tickRound")},p=ct(s,{signal:"height"},{signal:"width"}),m=a?{scale:a,range:0,mult:u,offset:l}:{value:0,offset:l},y=a?{scale:a,range:1,mult:u,offset:l}:fe(p,{mult:u,offset:l});return c.x=d.x=ct(s,g,m),c.y=d.y=ri(s,g,m),c.x2=d.x2=ri(s,y),c.y2=d.y2=ct(s,y),f.x=ct(s,g),f.y=ri(s,g),kn({type:dx,role:$X,key:Tn,from:i,encode:h},n)}function nJ(e,t){if(t!==1)if(!X(e))e=rt(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);else{let n=e=fe({},e);for(;n.mult!=null;)if(X(n.mult))n=n.mult=fe({},n.mult);else return n.mult=rt(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n.mult=t}return e}function iJ(e,t,n,i,r,o){const s=cn(e,t),a=e.orient,u=ag(a,-1,1);let l,c,f;const d={enter:l={opacity:ve},update:f={opacity:Nn},exit:c={opacity:ve}};vt(d,{stroke:s("tickColor"),strokeCap:s("tickCap"),strokeDash:s("tickDash"),strokeDashOffset:s("tickDashOffset"),strokeOpacity:s("tickOpacity"),strokeWidth:s("tickWidth")});const h=lt(r);h.mult=u;const g={scale:e.scale,field:Tn,band:o.band,extra:o.extra,offset:o.offset,round:s("tickRound")};return f.y=l.y=ct(a,ve,g),f.y2=l.y2=ct(a,h),c.x=ct(a,g),f.x=l.x=ri(a,ve,g),f.x2=l.x2=ri(a,h),c.y=ri(a,g),kn({type:dx,role:kX,key:Tn,from:i,encode:d},n)}function Gp(e,t,n,i,r){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+i+","+r+")"}}function rJ(e,t,n,i,r,o){const s=cn(e,t),a=e.orient,u=e.scale,l=ag(a,-1,1),c=Xo(s("labelFlush")),f=Xo(s("labelFlushOffset")),d=s("labelAlign"),h=s("labelBaseline");let g=c===0||!!c,p;const m=lt(r);m.mult=l,m.offset=lt(s("labelPadding")||0),m.offset.mult=l;const y={scale:u,field:Tn,band:.5,offset:gD(o.offset,s("labelOffset"))},b=ct(a,g?Gp(u,c,'"left"','"right"','"center"'):{value:"center"},GK(a,"left","right")),v=ct(a,xD(a,"bottom","top"),g?Gp(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),x=Gp(u,c,`-(${f})`,f,0);g=g&&f;const w={opacity:ve,x:ct(a,y,m),y:ri(a,y,m)},S={enter:w,update:p={opacity:Nn,text:{field:lx},x:w.x,y:w.y,align:b,baseline:v},exit:{opacity:ve,x:w.x,y:w.y}};vt(S,{dx:!d&&g?ct(a,x):null,dy:!h&&g?ri(a,x):null}),vt(S,{angle:s("labelAngle"),fill:s("labelColor"),fillOpacity:s("labelOpacity"),font:s("labelFont"),fontSize:s("labelFontSize"),fontWeight:s("labelFontWeight"),fontStyle:s("labelFontStyle"),limit:s("labelLimit"),lineHeight:s("labelLineHeight")},{align:d,baseline:h});const E=s("labelBound");let $=s("labelOverlap");return $=$||E?{separation:s("labelSeparation"),method:$,order:"datum.index",bound:E?{scale:u,orient:a,tolerance:E}:null}:void 0,p.align!==b&&(p.align=oa(p.align,b)),p.baseline!==v&&(p.baseline=oa(p.baseline,v)),kn({type:Cs,role:AX,style:dc,key:Tn,from:i,encode:S,overlap:$},n)}function oJ(e,t,n,i){const r=cn(e,t),o=e.orient,s=ag(o,-1,1);let a,u;const l={enter:a={opacity:ve,anchor:lt(r("titleAnchor",null)),align:{signal:hx}},update:u=fe({},a,{opacity:Nn,text:lt(e.title)}),exit:{opacity:ve}},c={signal:`lerp(range("${e.scale}"), ${rg(0,1,.5)})`};return u.x=ct(o,c),u.y=ri(o,c),a.angle=ct(o,ve,QK(s,90)),a.baseline=ct(o,xD(o,co,pi),{value:co}),u.angle=a.angle,u.baseline=a.baseline,vt(l,{fill:r("titleColor"),fillOpacity:r("titleOpacity"),font:r("titleFont"),fontSize:r("titleFontSize"),fontStyle:r("titleFontStyle"),fontWeight:r("titleFontWeight"),limit:r("titleLimit"),lineHeight:r("titleLineHeight")},{align:r("titleAlign"),angle:r("titleAngle"),baseline:r("titleBaseline")}),sJ(r,o,l,n),l.update.align=oa(l.update.align,a.align),l.update.angle=oa(l.update.angle,a.angle),l.update.baseline=oa(l.update.baseline,a.baseline),kn({type:Cs,role:CX,style:cx,from:i,encode:l},n)}function sJ(e,t,n,i){const r=(a,u)=>a!=null?(n.update[u]=oa(lt(a),n.update[u]),!1):!Xs(u,i),o=r(e("titleX"),"x"),s=r(e("titleY"),"y");n.enter.auto=s===o?lt(s):ct(t,lt(s),lt(o))}function aJ(e,t){const n=ZK(e,t),i=e.encode||{},r=i.axis||{},o=r.name||void 0,s=r.interactive,a=r.style,u=cn(e,n),l=iK(u),c={scale:e.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:e.title!=null},f=te(t.add(gi({},[c]))),d=te(t.add(uY({scale:t.scaleRef(e.scale),extra:t.property(l.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),h=[];let g;return c.grid&&h.push(tJ(e,n,i.grid,d,l)),c.ticks&&(g=u("tickSize"),h.push(iJ(e,n,i.ticks,d,g,l))),c.labels&&(g=c.ticks?g:0,h.push(rJ(e,n,i.labels,d,g,l))),c.domain&&h.push(eJ(e,n,i.domain,f)),c.title&&h.push(oJ(e,n,i.title,f)),sg(Ml({role:wX,from:f,encode:Za(uJ(u,e),r,hc),marks:h,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:o,interactive:s,style:a}),t)}function uJ(e,t){const n={enter:{},update:{}};return vt(n,{orient:e("orient"),offset:e("offset")||0,position:Kn(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function wD(e,t,n){const i=K(e.signals),r=K(e.scales);return n||i.forEach(o=>eD(o,t)),K(e.projections).forEach(o=>BY(o,t)),r.forEach(o=>FY(o,t)),K(e.data).forEach(o=>qK(o,t)),r.forEach(o=>_Y(o,t)),(n||i).forEach(o=>aY(o,t)),K(e.axes).forEach(o=>aJ(o,t)),K(e.marks).forEach(o=>sg(o,t)),K(e.legends).forEach(o=>RK(o,t)),e.title&&PK(e.title,t),t.parseLambdas(),t}const lJ=e=>Za({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function cJ(e,t){const n=t.config,i=te(t.root=t.add(Bd())),r=fJ(e,n);r.forEach(l=>eD(l,t)),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;const o=t.add(gi()),s=t.add(iD(ZM(lJ(e.encode),ig,ox,e.style,t,{pulse:te(o)}))),a=t.add(sD({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:i,pulse:te(s)}));t.operators.pop(),t.pushState(te(s),te(a),null),wD(e,t,r),t.operators.push(a);let u=t.add(nD({mark:i,pulse:te(a)}));return u=t.add(oD({pulse:te(u)})),u=t.add(ks({pulse:te(u)})),t.addData("root",new us(t,o,o,u)),t}function Au(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function fJ(e,t){const n=s=>Kn(e[s],t[s]),i=[Au("background",n("background")),Au("autosize",vX(n("autosize"))),Au("padding",EX(n("padding"))),Au("width",n("width")||0),Au("height",n("height")||0)],r=i.reduce((s,a)=>(s[a.name]=a,s),{}),o={};return K(e.signals).forEach(s=>{J(r,s.name)?s=fe(r[s.name],s):i.push(s),o[s.name]=s}),K(t.signals).forEach(s=>{!J(o,s.name)&&!J(r,s.name)&&i.push(s)}),i}function SD(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function E$(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}SD.prototype=E$.prototype={parse(e){return wD(e,this)},fork(){return new E$(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach(t=>{t.$ref=e.id}),e.refs=null),e},proxy(e){const t=e instanceof K0?te(e):e;return this.add(wY({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;this.root&&(this.root.root=!0);for(e in this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(i,r,o){let s,a;i&&(s=i.data||(i.data={}),a=s[r]||(s[r]=[]),a.push(o))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const i in t.index)n(t.index[i],e,"index:"+i)}return this},pushState(e,t,n){this._encode.push(te(this.add(ks({pulse:e})))),this._parent.push(t),this._lookup.push(n?te(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return be(this._parent)},encode(){return be(this._encode)},lookup(){return be(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(Y(e))return Ol(e,t);e.signal||M("Unsupported field reference: "+G(e));const n=e.signal;let i=this.field[n];if(!i){const r={name:this.signalRef(n)};t&&(r.as=t),this.field[n]=i=te(this.add(dY(r)))}return i},compareRef(e){let t=!1;const n=o=>rt(o)?(t=!0,this.signalRef(o.signal)):JX(o)?(t=!0,this.exprRef(o.expr)):o,i=K(e.field).map(n),r=K(e.order).map(n);return t?te(this.add(a$({fields:i,orders:r}))):o$(i,r)},keyRef(e,t){let n=!1;const i=o=>rt(o)?(n=!0,te(r[o.signal])):o,r=this.signals;return e=K(e).map(i),n?te(this.add(hY({fields:e,flat:t}))):VX(e,t)},sortRef(e){if(!e)return e;const t=tg(e.op,e.field),n=e.order||XX;return n.signal?te(this.add(a$({fields:t,orders:this.signalRef(n.signal)}))):o$(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const i=this.id();this.streams.push({id:i,source:e,type:t}),this.events[n]=i}return this.events[n]},hasOwnSignal(e){return J(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&M("Duplicate signal name: "+G(e));const n=t instanceof K0?t:this.add(Bd(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||M("Unrecognized signal name: "+G(e)),this.signals[e]},signalRef(e){return this.signals[e]?te(this.signals[e]):(J(this.lambdas,e)||(this.lambdas[e]=this.add(Bd(null))),te(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;t<n;++t){const i=e[t],r=zi(i,this),o=this.lambdas[i];o.params=r.$params,o.update=r.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return!e||!X(e)?e:this.signalRef(e.signal||bx(e))},exprRef(e,t){const n={expr:zi(e,this)};return t&&(n.expr.$name=t),te(this.add(cY(n)))},addBinding(e,t){this.bindings||M("Nested signals do not support binding: "+G(e)),this.bindings.push(fe({signal:e},t))},addScaleProj(e,t){J(this.scales,e)&&M("Duplicate scale or projection name: "+G(e)),this.scales[e]=this.add(t)},addScale(e,t){this.addScaleProj(e,$Y(t))},addProjection(e,t){this.addScaleProj(e,EY(t))},getScale(e){return this.scales[e]||M("Unrecognized scale name: "+G(e)),this.scales[e]},scaleRef(e){return te(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,t){return J(this.data,e)&&M("Duplicate data set name: "+G(e)),this.data[e]=t},getData(e){return this.data[e]||M("Undefined data set name: "+G(e)),this.data[e]},addDataPipeline(e,t){return J(this.data,e)&&M("Duplicate data set name: "+G(e)),this.addData(e,us.fromEntries(this,t))}};function bx(e){return(T(e)?dJ:hJ)(e)}function dJ(e){const t=e.length;let n="[";for(let i=0;i<t;++i){const r=e[i];n+=(i>0?",":"")+(X(r)?r.signal||bx(r):G(r))}return n+"]"}function hJ(e){let t="{",n=0,i,r;for(i in e)r=e[i],t+=(++n>1?",":"")+G(i)+":"+(X(r)?r.signal||bx(r):G(r));return t+"}"}function gJ(){const e="sans-serif",i="#4c78a8",r="#000",o="#888",s="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:i},area:{fill:i},image:null,line:{stroke:i,strokeWidth:2},path:{stroke:i},rect:{fill:i},rule:{stroke:r},shape:{stroke:i},symbol:{fill:i,size:64},text:{fill:r,font:e,fontSize:11},trail:{fill:i,size:2},style:{"guide-label":{fill:r,font:e,fontSize:10},"guide-title":{fill:r,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:r,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:r,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:s},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:o,grid:!1,gridWidth:1,gridColor:s,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:o,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:s,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:o,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}function pJ(e,t,n){return X(e)||M("Input Vega specification must be an object."),t=Wa(gJ(),t,e.config),cJ(e,new SD(t,n)).toRuntime()}var mJ="6.2.0";fe(pa,u8,KU,Fj,oq,dq,zq,bq,Uq,Gq,tW,uW);const yJ=mJ,bJ=Object.freeze(Object.defineProperty({__proto__:null,Bounds:Ze,CanvasHandler:ac,CanvasRenderer:Fd,DATE:on,DAY:At,DAYOFYEAR:Pi,Dataflow:ra,Debug:VC,DisallowedObjectProperties:dy,Error:hy,EventStream:wh,Gradient:dO,GroupItem:Nh,HOURS:Sn,Handler:Zb,HybridHandler:nR,HybridRenderer:C0,Info:HC,Item:Th,MILLISECONDS:ai,MINUTES:$n,MONTH:Ft,Marks:An,MultiPulse:Dy,None:GC,Operator:Re,Parameters:Eh,Pulse:to,QUARTER:rn,RenderType:Yr,Renderer:sc,ResourceLoader:bO,SECONDS:zn,SVGHandler:qO,SVGRenderer:ov,SVGStringRenderer:tR,Scenegraph:NO,TIME_UNITS:Ay,Transform:R,View:UM,WEEK:nt,Warn:gy,YEAR:bt,accessor:ln,accessorFields:Ct,accessorName:Ge,array:K,ascending:Ha,bandwidthNRD:Iy,bin:r_,bootstrapCI:o_,boundClip:dR,boundContext:nc,boundItem:w0,boundMark:RO,boundStroke:$r,changeset:Ss,clampRange:aF,codegenExpression:gM,compare:by,constant:Rt,cumulativeLogNormal:qy,cumulativeNormal:$h,cumulativeUniform:Vy,dayofyear:bF,debounce:vy,defaultLocale:Fy,definition:t_,densityLogNormal:jy,densityNormal:Py,densityUniform:Hy,domChild:tt,domClear:_n,domCreate:Vr,domFind:Qb,dotbin:s_,error:M,expressionFunction:Je,extend:fe,extent:Ii,extentIndex:uF,falsy:Tr,fastmap:Va,field:In,flush:lF,font:Bh,fontFamily:oc,fontSize:Hi,format:yf,formatLocale:pd,formats:Ry,hasOwnProperty:J,id:Wl,identity:nn,inferType:WF,inferTypes:GF,ingest:Se,inherits:H,inrange:Qs,interpolate:_b,interpolateColors:Mh,interpolateRange:Q_,intersect:uR,intersectBoxLine:Zs,intersectPath:Ib,intersectPoint:Pb,intersectRule:xO,isArray:T,isBoolean:Es,isDate:eo,isFunction:ce,isIterable:cF,isNumber:Ee,isObject:X,isRegExp:xy,isString:Y,isTuple:vh,key:Ey,lerp:fF,lineHeight:ao,loader:yh,locale:jF,logger:hh,lruCache:dF,markup:rv,merge:hF,mergeConfig:Wa,multiLineOffset:Yb,one:qa,pad:gF,panLinear:tF,panLog:nF,panPow:iF,panSymlog:rF,parse:pJ,parseExpression:Hv,parseSelector:vo,path:W1,pathCurves:Tb,pathEqual:hR,pathParse:va,pathRectangle:pO,pathRender:wl,pathSymbols:gO,pathTrail:mO,peek:be,point:jh,projection:yv,quantileLogNormal:Wy,quantileNormal:Ah,quantileUniform:Xy,quantiles:Ny,quantizeInterpolator:Z_,quarter:oF,quartiles:Ly,get random(){return Bn},randomInteger:d9,randomKDE:By,randomLCG:f9,randomLogNormal:u_,randomMixture:l_,randomNormal:zy,randomUniform:c_,read:XF,regressionConstant:Yy,regressionExp:d_,regressionLinear:Ky,regressionLoess:p_,regressionLog:f_,regressionPoly:g_,regressionPow:h_,regressionQuad:Jy,renderModule:qh,repeat:zu,resetDefaultLocale:l4,resetSVGDefIds:gU,responseType:VF,runtimeContext:FM,sampleCurve:Ch,sampleLogNormal:Uy,sampleNormal:Sh,sampleUniform:Gy,scale:we,sceneEqual:sv,sceneFromJSON:DO,scenePickVisit:xd,sceneToJSON:MO,sceneVisit:ui,sceneZOrder:zb,scheme:Ob,serializeXML:JO,setHybridRendererOptions:cU,setRandom:l9,span:Gl,splitAccessPath:Gi,stringValue:G,textMetrics:vn,timeBin:NF,timeFloor:AF,timeFormatLocale:vl,timeInterval:Xa,timeOffset:FF,timeSequence:RF,timeUnitSpecifier:yF,timeUnits:ky,toBoolean:wy,toDate:Sy,toNumber:Ut,toSet:si,toString:$y,transform:n_,transforms:pa,truncate:pF,truthy:Pn,tupleid:ne,typeParsers:h0,utcFloor:kF,utcInterval:Ya,utcOffset:_F,utcSequence:MF,utcdayofyear:EF,utcquarter:sF,utcweek:wF,version:yJ,visitArray:Pr,week:vF,writeConfig:Ga,zero:qr,zoomLinear:py,zoomLog:my,zoomPow:gd,zoomSymlog:yy},Symbol.toStringTag,{value:"Module"}));function vJ(e,t,n){let i;t.x2&&(t.x?(n&&e.x>e.x2&&(i=e.x,e.x=e.x2,e.x2=i),e.width=e.x2-e.x):e.x=e.x2-(e.width||0)),t.xc&&(e.x=e.xc-(e.width||0)/2),t.y2&&(t.y?(n&&e.y>e.y2&&(i=e.y,e.y=e.y2,e.y2=i),e.height=e.y2-e.y):e.y=e.y2-(e.height||0)),t.yc&&(e.y=e.yc-(e.height||0)/2)}var xJ={NaN:NaN,E:Math.E,LN2:Math.LN2,LN10:Math.LN10,LOG2E:Math.LOG2E,LOG10E:Math.LOG10E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,MIN_VALUE:Number.MIN_VALUE,MAX_VALUE:Number.MAX_VALUE},EJ={"*":(e,t)=>e*t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,">":(e,t)=>e>t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,">=":(e,t)=>e>=t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,"===":(e,t)=>e===t,"!==":(e,t)=>e!==t,"&":(e,t)=>e&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"<<":(e,t)=>e<<t,">>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t},wJ={"+":e=>+e,"-":e=>-e,"~":e=>~e,"!":e=>!e};const SJ=Array.prototype.slice,_o=(e,t,n)=>{const i=n?n(t[0]):t[0];return i[e].apply(i,SJ.call(t,1))},$J=(e,t=0,n=1,i=0,r=0,o=0,s=0)=>Y(e)?new Date(e):new Date(e,t,n,i,r,o,s);var AJ={isNaN:Number.isNaN,isFinite:Number.isFinite,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,atan2:Math.atan2,ceil:Math.ceil,cos:Math.cos,exp:Math.exp,floor:Math.floor,log:Math.log,max:Math.max,min:Math.min,pow:Math.pow,random:Math.random,round:Math.round,sin:Math.sin,sqrt:Math.sqrt,tan:Math.tan,clamp:(e,t,n)=>Math.max(t,Math.min(n,e)),now:Date.now,utc:Date.UTC,datetime:$J,date:e=>new Date(e).getDate(),day:e=>new Date(e).getDay(),year:e=>new Date(e).getFullYear(),month:e=>new Date(e).getMonth(),hours:e=>new Date(e).getHours(),minutes:e=>new Date(e).getMinutes(),seconds:e=>new Date(e).getSeconds(),milliseconds:e=>new Date(e).getMilliseconds(),time:e=>new Date(e).getTime(),timezoneoffset:e=>new Date(e).getTimezoneOffset(),utcdate:e=>new Date(e).getUTCDate(),utcday:e=>new Date(e).getUTCDay(),utcyear:e=>new Date(e).getUTCFullYear(),utcmonth:e=>new Date(e).getUTCMonth(),utchours:e=>new Date(e).getUTCHours(),utcminutes:e=>new Date(e).getUTCMinutes(),utcseconds:e=>new Date(e).getUTCSeconds(),utcmilliseconds:e=>new Date(e).getUTCMilliseconds(),length:e=>e.length,join:function(){return _o("join",arguments)},indexof:function(){return _o("indexOf",arguments)},lastindexof:function(){return _o("lastIndexOf",arguments)},slice:function(){return _o("slice",arguments)},reverse:e=>e.slice().reverse(),sort:e=>e.slice().sort(Ha),parseFloat,parseInt,upper:e=>String(e).toUpperCase(),lower:e=>String(e).toLowerCase(),substring:function(){return _o("substring",arguments,String)},split:function(){return _o("split",arguments,String)},replace:function(){return _o("replace",arguments,String)},trim:e=>String(e).trim(),btoa:e=>btoa(e),atob:e=>atob(e),regexp:RegExp,test:(e,t)=>RegExp(e).test(t)};const kJ=["view","item","group","xy","x","y"],i1=new Set([Function,eval,setTimeout,setInterval]);typeof setImmediate=="function"&&i1.add(setImmediate);const CJ={Literal:(e,t)=>t.value,Identifier:(e,t)=>{const n=t.name;return e.memberDepth>0?n:n==="datum"?e.datum:n==="event"?e.event:n==="item"?e.item:xJ[n]||e.params["$"+n]},MemberExpression:(e,t)=>{const n=!t.computed,i=e(t.object);n&&(e.memberDepth+=1);const r=e(t.property);if(n&&(e.memberDepth-=1),i1.has(i[r])){console.error(`Prevented interpretation of member "${r}" which could lead to insecure code execution`);return}return i[r]},CallExpression:(e,t)=>{const n=t.arguments;let i=t.callee.name;return i.startsWith("_")&&(i=i.slice(1)),i==="if"?e(n[0])?e(n[1]):e(n[2]):(e.fn[i]||AJ[i]).apply(e.fn,n.map(e))},ArrayExpression:(e,t)=>t.elements.map(e),BinaryExpression:(e,t)=>EJ[t.operator](e(t.left),e(t.right)),UnaryExpression:(e,t)=>wJ[t.operator](e(t.argument)),ConditionalExpression:(e,t)=>e(t.test)?e(t.consequent):e(t.alternate),LogicalExpression:(e,t)=>t.operator==="&&"?e(t.left)&&e(t.right):e(t.left)||e(t.right),ObjectExpression:(e,t)=>t.properties.reduce((n,i)=>{e.memberDepth+=1;const r=e(i.key);e.memberDepth-=1;const o=e(i.value);return dy.has(r)?console.error(`Prevented interpretation of property "${r}" which could lead to insecure code execution`):i1.has(o)?console.error(`Prevented interpretation of method "${r}" which could lead to insecure code execution`):n[r]=o,n},{})};function ku(e,t,n,i,r,o){const s=a=>CJ[a.type](s,a);return s.memberDepth=0,s.fn=Object.create(t),s.params=n,s.datum=i,s.event=r,s.item=o,kJ.forEach(a=>s.fn[a]=(...u)=>r.vega[a](...u)),s(e)}var FJ={operator(e,t){const n=t.ast,i=e.functions;return r=>ku(n,i,r)},parameter(e,t){const n=t.ast,i=e.functions;return(r,o)=>ku(n,i,o,r)},event(e,t){const n=t.ast,i=e.functions;return r=>ku(n,i,void 0,void 0,r)},handler(e,t){const n=t.ast,i=e.functions;return(r,o)=>{const s=o.item&&o.item.datum;return ku(n,i,r,s,o)}},encode(e,t){const{marktype:n,channels:i}=t,r=e.functions,o=n==="group"||n==="image"||n==="rect";return(s,a)=>{const u=s.datum;let l=0,c;for(const f in i)c=ku(i[f].ast,r,a,u,void 0,s),s[f]!==c&&(s[f]=c,l=1);return n!=="rule"&&vJ(s,i,o),l}}},_J="6.4.3",OJ={version:_J};function vx(e){return U(e,"or")}function xx(e){return U(e,"and")}function Ex(e){return U(e,"not")}function If(e,t){if(Ex(e))If(e.not,t);else if(xx(e))for(const n of e.and)If(n,t);else if(vx(e))for(const n of e.or)If(n,t);else t(e)}function sa(e,t){return Ex(e)?{not:sa(e.not,t)}:xx(e)?{and:e.and.map(n=>sa(n,t))}:vx(e)?{or:e.or.map(n=>sa(n,t))}:t(e)}const ae=structuredClone;function $D(e){throw new Error(e)}function $a(e,t){const n={};for(const i of t)J(e,i)&&(n[i]=e[i]);return n}function En(e,t){const n={...e};for(const i of t)delete n[i];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>Fe(e)).join(",")})`};function de(e){if(Ee(e))return e;const t=Y(e)?e:Fe(e);if(t.length<250)return t;let n=0;for(let i=0;i<t.length;i++){const r=t.charCodeAt(i);n=(n<<5)-n+r,n=n&n}return n}function r1(e){return e===!1||e===null}function pe(e,t){return e.includes(t)}function Aa(e,t){let n=0;for(const[i,r]of e.entries())if(t(r,i,n++))return!0;return!1}function wx(e,t){let n=0;for(const[i,r]of e.entries())if(!t(r,i,n++))return!1;return!0}function AD(e,...t){for(const n of t)RJ(e,n??{});return e}function RJ(e,t){for(const n of z(t))Ga(e,n,t[n],!0)}function mn(e,t){const n=[],i={};let r;for(const o of e)r=t(o),!(r in i)&&(i[r]=1,n.push(o));return n}function MJ(e,t){const n=z(e),i=z(t);if(n.length!==i.length)return!1;for(const r of n)if(e[r]!==t[r])return!1;return!0}function kD(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Sx(e,t){for(const n of e)if(t.has(n))return!0;return!1}function o1(e){const t=new Set;for(const n of e){const r=Gi(n).map((s,a)=>a===0?s:`[${s}]`),o=r.map((s,a)=>r.slice(0,a+1).join(""));for(const s of o)t.add(s)}return t}function $x(e,t){return e===void 0||t===void 0?!0:Sx(o1(e),o1(t))}function Me(e){return z(e).length===0}const z=Object.keys,Qe=Object.values,fo=Object.entries;function ka(e){return e===!0||e===!1}function Ud(e){return Y(e)||Ee(e)||ka(e)}function ze(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function fl(e,t){return Ex(e)?`!(${fl(e.not,t)})`:xx(e)?`(${e.and.map(n=>fl(n,t)).join(") && (")})`:vx(e)?`(${e.or.map(n=>fl(n,t)).join(") || (")})`:t(e)}function jd(e,t){if(t.length===0)return!0;const n=t.shift();return n in e&&jd(e[n],t)&&delete e[n],Me(e)}function gc(e){return e.charAt(0).toUpperCase()+e.substr(1)}function Ax(e,t="datum"){const n=Gi(e),i=[];for(let r=1;r<=n.length;r++){const o=`[${n.slice(0,r).map(G).join("][")}]`;i.push(`${t}${o}`)}return i.join(" && ")}function CD(e,t="datum"){return`${t}[${G(Gi(e).join("."))}]`}function ke(e){return`datum['${e.replaceAll("'","\\'")}']`}function FD(e){return e.replaceAll("\\'","'").replaceAll("\\.",".")}function DJ(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function Un(e){return`${Gi(e).map(DJ).join("\\.")}`}function ls(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function nu(e){return`${Gi(e).join(".")}`}function Ca(e){return e?Gi(e).length:0}function Ye(...e){return e.find(t=>t!==void 0)}let _D=42;function OD(e){const t=++_D;return e?String(e)+t:t}function TJ(){_D=42}function RD(e){return MD(e)?e:`__${e}`}function MD(e){return e.startsWith("__")}function Dl(e){if(e!==void 0)return(e%360+360)%360}function ug(e){return Ee(e)?!0:!isNaN(e)&&!isNaN(parseFloat(e))}const w$=Object.getPrototypeOf(structuredClone({}));function yn(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor.name!==t.constructor.name)return!1;let n,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(i=n;i--!==0;)if(!yn(e[i],t[i]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const o of e.entries())if(!t.has(o[0]))return!1;for(const o of e.entries())if(!yn(o[1],t.get(o[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e.entries())if(!t.has(o[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(i=n;i--!==0;)if(e[i]!==t[i])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==w$.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==w$.toString)return e.toString()===t.toString();const r=Object.keys(e);if(n=r.length,n!==Object.keys(t).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(i=n;i--!==0;){const o=r[i];if(!yn(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function Fe(e){const t=[];return function n(i){if(i!=null&&i.toJSON&&typeof i.toJSON=="function"&&(i=i.toJSON()),i===void 0)return;if(typeof i=="number")return isFinite(i)?`${i}`:"null";if(typeof i!="object")return JSON.stringify(i);let r,o;if(Array.isArray(i)){for(o="[",r=0;r<i.length;r++)r&&(o+=","),o+=n(i[r])||"null";return`${o}]`}if(i===null)return"null";if(t.includes(i))throw new TypeError("Converting circular structure to JSON");const s=t.push(i)-1,a=Object.keys(i).sort();for(o="",r=0;r<a.length;r++){const u=a[r],l=n(i[u]);l&&(o&&(o+=","),o+=`${JSON.stringify(u)}:${l}`)}return t.splice(s,1),`{${o}}`}(e)}function U(e,t){return X(e)&&J(e,t)&&e[t]!==void 0}const dr="row",hr="column",lg="facet",Le="x",ot="y",mi="x2",Yi="y2",vr="xOffset",iu="yOffset",yi="radius",kr="radius2",Wn="theta",Cr="theta2",bi="latitude",vi="longitude",xi="latitude2",jn="longitude2",xo="time",sn="color",Ki="fill",Ji="stroke",an="shape",Fr="size",Fs="angle",_r="opacity",Eo="fillOpacity",wo="strokeOpacity",So="strokeWidth",$o="strokeDash",pc="text",Fa="order",mc="detail",cg="key",cs="tooltip",fg="href",dg="url",hg="description",NJ={x:1,y:1,x2:1,y2:1},DD={theta:1,theta2:1,radius:1,radius2:1};function TD(e){return J(DD,e)}const kx={longitude:1,longitude2:1,latitude:1,latitude2:1};function ND(e){switch(e){case bi:return"y";case xi:return"y2";case vi:return"x";case jn:return"x2"}}function LD(e){return J(kx,e)}const LJ=z(kx),Cx={...NJ,...DD,...kx,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,time:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1};function aa(e){return e===sn||e===Ki||e===Ji}const ID={row:1,column:1,facet:1},Dn=z(ID),Fx={...Cx,...ID},IJ=z(Fx),{order:fue,detail:due,tooltip:hue,...PJ}=Fx,{row:gue,column:pue,facet:mue,...zJ}=PJ;function BJ(e){return J(zJ,e)}function PD(e){return J(Fx,e)}const UJ=[mi,Yi,xi,jn,Cr,kr];function zD(e){return _s(e)!==e}function _s(e){switch(e){case mi:return Le;case Yi:return ot;case xi:return bi;case jn:return vi;case Cr:return Wn;case kr:return yi}return e}function ho(e){if(TD(e))switch(e){case Wn:return"startAngle";case Cr:return"endAngle";case yi:return"outerRadius";case kr:return"innerRadius"}return e}function Qi(e){switch(e){case Le:return mi;case ot:return Yi;case bi:return xi;case vi:return jn;case Wn:return Cr;case yi:return kr}}function un(e){switch(e){case Le:case mi:return"width";case ot:case Yi:return"height"}}function BD(e){switch(e){case Le:return"xOffset";case ot:return"yOffset";case mi:return"x2Offset";case Yi:return"y2Offset";case Wn:return"thetaOffset";case yi:return"radiusOffset";case Cr:return"theta2Offset";case kr:return"radius2Offset"}}function _x(e){switch(e){case Le:return"xOffset";case ot:return"yOffset"}}function jJ(e){switch(e){case"xOffset":return"x";case"yOffset":return"y"}}const qJ=z(Cx),{x:yue,y:bue,x2:vue,y2:xue,xOffset:Eue,yOffset:wue,latitude:Sue,longitude:$ue,latitude2:Aue,longitude2:kue,theta:Cue,theta2:Fue,radius:_ue,radius2:Oue,...Ox}=Cx,WJ=z(Ox),Rx={x:1,y:1},Or=z(Rx);function Ke(e){return J(Rx,e)}const Mx={theta:1,radius:1},GJ=z(Mx);function gg(e){return e==="width"?Le:ot}const UD={xOffset:1,yOffset:1};function yc(e){return J(UD,e)}const HJ={time:1};function Hp(e){return e in HJ}const{text:Rue,tooltip:Mue,href:Due,url:Tue,description:Nue,detail:Lue,key:Iue,order:Pue,...jD}=Ox,VJ=z(jD);function XJ(e){return J(Ox,e)}function YJ(e){switch(e){case sn:case Ki:case Ji:case Fr:case an:case _r:case So:case $o:return!0;case Eo:case wo:case Fs:case xo:return!1}}const qD={...Rx,...Mx,...UD,...jD},Dx=z(qD);function Zi(e){return J(qD,e)}function KJ(e,t){return QJ(e)[t]}const WD={arc:"always",area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},{geoshape:zue,...JJ}=WD;function QJ(e){switch(e){case sn:case Ki:case Ji:case hg:case mc:case cg:case cs:case fg:case Fa:case _r:case Eo:case wo:case So:case lg:case dr:case hr:return WD;case Le:case ot:case vr:case iu:case bi:case vi:case xo:return JJ;case mi:case Yi:case xi:case jn:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case Fr:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case $o:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case an:return{point:"always",geoshape:"always"};case pc:return{text:"always"};case Fs:return{point:"always",square:"always",text:"always"};case dg:return{image:"always"};case Wn:return{text:"always",arc:"always"};case yi:return{text:"always",arc:"always"};case Cr:case kr:return{arc:"always"}}}function Vp(e){switch(e){case Le:case ot:case Wn:case yi:case vr:case iu:case Fr:case Fs:case So:case _r:case Eo:case wo:case xo:case mi:case Yi:case Cr:case kr:return;case lg:case dr:case hr:case an:case $o:case pc:case cs:case fg:case dg:case hg:return"discrete";case sn:case Ki:case Ji:return"flexible";case bi:case vi:case xi:case jn:case mc:case cg:case Fa:return}}const ZJ={argmax:1,argmin:1,average:1,count:1,distinct:1,exponential:1,exponentialb:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},eQ={count:1,min:1,max:1};function xr(e){return U(e,"argmin")}function Ao(e){return U(e,"argmax")}function Tx(e){return Y(e)&&J(ZJ,e)}const tQ=new Set(["count","valid","missing","distinct"]);function pg(e){return Y(e)&&tQ.has(e)}function nQ(e){return Y(e)&&pe(["min","max"],e)}const iQ=new Set(["count","sum","distinct","valid","missing"]),rQ=new Set(["mean","average","median","q1","q3","min","max"]);function GD(e){return Es(e)&&(e=Cg(e,void 0)),`bin${z(e).map(t=>mg(e[t])?ze(`_${t}_${fo(e[t])}`):ze(`_${t}_${e[t]}`)).join("")}`}function De(e){return e===!0||Os(e)&&!e.binned}function dt(e){return e==="binned"||Os(e)&&e.binned===!0}function Os(e){return X(e)}function mg(e){return U(e,"param")}function S$(e){switch(e){case dr:case hr:case Fr:case sn:case Ki:case Ji:case So:case _r:case Eo:case wo:case an:return 6;case $o:return 4;default:return 10}}function bc(e){return U(e,"expr")}function ht(e,{level:t}={level:0}){const n=z(e||{}),i={};for(const r of n)i[r]=t===0?gn(e[r]):ht(e[r],{level:t-1});return i}function HD(e){const{anchor:t,frame:n,offset:i,orient:r,angle:o,limit:s,color:a,subtitleColor:u,subtitleFont:l,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:g,...p}=e,m={...p,...a?{fill:a}:{}},y={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{},...o!==void 0?{angle:o}:{},...s!==void 0?{limit:s}:{}},b={...u?{subtitleColor:u}:{},...l?{subtitleFont:l}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...g?{subtitlePadding:g}:{}},v=$a(e,["align","baseline","dx","dy","limit"]);return{titleMarkConfig:m,subtitleMarkConfig:v,nonMarkTitleProperties:y,subtitle:b}}function Ur(e){return Y(e)||T(e)&&Y(e[0])}function ee(e){return U(e,"signal")}function Rs(e){return U(e,"step")}function VD(e){return T(e)?!1:U(e,"fields")&&!U(e,"data")}function oQ(e){return T(e)?!1:U(e,"fields")&&U(e,"data")}function cr(e){return T(e)?!1:U(e,"field")&&U(e,"data")}const sQ={aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1},aQ=z(sQ),uQ={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},s1=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"],lQ=" – ";function XD(e){const t=T(e.condition)?e.condition.map($$):$$(e.condition);return{...gn(e),condition:t}}function gn(e){if(bc(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function $$(e){if(bc(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function Ne(e){if(bc(e)){const{expr:t,...n}=e;return{signal:t,...n}}return ee(e)?e:e!==void 0?{value:e}:void 0}function cQ(e){return ee(e)?e.signal:G(e)}function A$(e){return ee(e)?e.signal:G(e.value)}function ni(e){return ee(e)?e.signal:e==null?null:G(e)}function fQ(e,t,n){for(const i of n){const r=Bi(i,t.markDef,t.config);r!==void 0&&(e[i]=Ne(r))}return e}function YD(e){return[].concat(e.type,e.style??[])}function Ae(e,t,n,i={}){const{vgChannel:r,ignoreVgConfig:o}=i;return r&&U(t,r)?t[r]:t[e]!==void 0?t[e]:o&&(!r||r===e)?void 0:Bi(e,t,n,i)}function Bi(e,t,n,{vgChannel:i}={}){const r=a1(e,t,n.style);return Ye(i?r:void 0,r,i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function a1(e,t,n){return KD(e,YD(t),n)}function KD(e,t,n){t=K(t);let i;for(const r of t){const o=n[r];U(o,e)&&(i=o[e])}return i}function JD(e,t){return K(e).reduce((n,i)=>(n.field.push(V(i,t)),n.order.push(i.sort??"ascending"),n),{field:[],order:[]})}function QD(e,t){const n=[...e];return t.forEach(i=>{for(const r of n)if(yn(r,i))return;n.push(i)}),n}function ZD(e,t){return yn(e,t)||!t?e:e?[...K(e),...K(t)].join(", "):t}function eT(e,t){const n=e.value,i=t.value;if(n==null||i===null)return{explicit:e.explicit,value:null};if((Ur(n)||ee(n))&&(Ur(i)||ee(i)))return{explicit:e.explicit,value:ZD(n,i)};if(Ur(n)||ee(n))return{explicit:e.explicit,value:n};if(Ur(i)||ee(i))return{explicit:e.explicit,value:i};if(!Ur(n)&&!ee(n)&&!Ur(i)&&!ee(i))return{explicit:e.explicit,value:QD(n,i)};throw new Error("It should never reach here")}function Nx(e){return`Invalid specification ${Fe(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const dQ='Autosize "fit" only works for single views and layered views.';function k$(e){return`${e=="width"?"Width":"Height"} "container" only works for single views and layered views.`}function C$(e){const t=e=="width"?"Width":"Height",n=e=="width"?"x":"y";return`${t} "container" only works well with autosize "fit" or "fit-${n}".`}function F$(e){return e?`Dropping "fit-${e}" because spec has discrete ${un(e)}.`:'Dropping "fit" because spec has discrete size.'}function Lx(e){return`Unknown field for ${e}. Cannot calculate view size.`}function _$(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function hQ(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function gQ(e){return`The "nearest" transform is not supported for ${e} marks.`}function tT(e){return`Selection not supported for ${e} yet.`}function pQ(e){return`Cannot find a selection named "${e}".`}const mQ="Scale bindings are currently only supported for scales with unbinned, continuous domains.",yQ="Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc",bQ="Legend bindings are only supported for selections over an individual field or encoding channel.";function vQ(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}function xQ(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}const EQ="The same selection must be used to override scale domains in a layered view.",wQ='Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.';function SQ(e){return`Unknown repeated value "${e}".`}function O$(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const $Q="Multiple timer selections in one unit spec are not supported. Ignoring all but the first.",Ix="Animation involving facet, layer, or concat is currently unsupported.";function AQ(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${G(e)}.`}function kQ(e,t,n,i){return`${e.length?"Multiple ":"No "}matching ${G(t)} encoding found for selection ${G(n.param)}. Using "field": ${G(i)}.`}const CQ="Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).";function FQ(e){return`Unrecognized parse "${e}".`}function R$(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}const _Q="Attempt to add the same child twice.";function OQ(e){return`Ignoring an invalid transform: ${Fe(e)}.`}const RQ='If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.';function M$(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function MQ(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${Fe(t)} is overridden by a child projection ${Fe(n)}.`}const DQ="Arc marks uses theta channel rather than angle, replacing angle with theta.";function TQ(e){return`${e}Offset dropped because ${e} is continuous`}function NQ(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${Fe(n)}}.`}function nT(e){return`Invalid field type "${e}".`}function LQ(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function IQ(e){return`Invalid aggregation operator "${e}".`}function iT(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function PQ(e){return`Position range does not support relative band size for ${e}.`}function u1(e,t){return`Dropping ${Fe(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}const zQ="Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.";function yg(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function BQ(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function UQ(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function jQ(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function qQ(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`}function Xp(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t==="ordinal"?"order":"magnitude"}.`}function WQ(e){return`The ${e} for range marks cannot be an expression`}function GQ(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`}function HQ(e,t){return`Specified orient "${e}" overridden with "${t}".`}function VQ(e){return`Cannot use the scale property "${e}" with non-color channel.`}function XQ(e){return`Cannot use the relative band size with ${e} scale.`}function YQ(e){return`Using unaggregated domain with raw field has no effect (${Fe(e)}).`}function KQ(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function JQ(e){return`Unaggregated domain is currently unsupported for log scale (${Fe(e)}).`}function QQ(e){return`Cannot apply size to non-oriented mark "${e}".`}function ZQ(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function eZ(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function rT(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function oT(e){return`The step for "${e}" is dropped because the ${e==="width"?"x":"y"} is continuous.`}function tZ(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${Fe(n)} and ${Fe(i)}). Using ${Fe(n)}.`}function nZ(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${Fe(n)} and ${Fe(i)}). Using the union of the two domains.`}function iZ(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function rZ(e){return`Dropping sort property ${Fe(e)} as unioned domains only support boolean or op "count", "min", and "max".`}const D$="Domains that should be unioned has conflicting sort properties. Sort will be set to true.",oZ="Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.",sZ="Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.",aZ="Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.";function uZ(e,t){return`Unioning discrete legend values from ${e} and ${t}.`}function lZ(e){return`Cannot stack "${e}" if there is already "${e}2".`}function cZ(e){return`Stack is applied to a non-linear scale (${e}).`}function fZ(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function qd(e,t){return`Invalid ${e}: ${Fe(t)}.`}function dZ(e){return`Dropping day from datetime ${Fe(e)} as day cannot be combined with other units.`}function hZ(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}function gZ(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function pZ(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function T$(e){return`1D error band does not support ${e}.`}function sT(e){return`Channel ${e} is required for "binned" bin.`}function mZ(e){return`Channel ${e} should not be used with "binned" bin.`}function yZ(e){return`Domain for ${e} is required for threshold scale.`}const aT=hh(gy);let fs=aT;function bZ(e){return fs=e,fs}function vZ(){return fs=aT,fs}function Px(...e){fs.error(...e)}function q(...e){fs.warn(...e)}function xZ(...e){fs.debug(...e)}function Ms(e){if(e&&X(e)){for(const t of Bx)if(U(e,t))return!0}return!1}const uT=["january","february","march","april","may","june","july","august","september","october","november","december"],EZ=uT.map(e=>e.substr(0,3)),lT=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],wZ=lT.map(e=>e.substr(0,3));function SZ(e){if(ug(e)&&(e=+e),Ee(e))return e>4&&q(qd("quarter",e)),e-1;throw new Error(qd("quarter",e))}function $Z(e){if(ug(e)&&(e=+e),Ee(e))return e-1;{const t=e.toLowerCase(),n=uT.indexOf(t);if(n!==-1)return n;const i=t.substr(0,3),r=EZ.indexOf(i);if(r!==-1)return r;throw new Error(qd("month",e))}}function AZ(e){if(ug(e)&&(e=+e),Ee(e))return e%7;{const t=e.toLowerCase(),n=lT.indexOf(t);if(n!==-1)return n;const i=t.substr(0,3),r=wZ.indexOf(i);if(r!==-1)return r;throw new Error(qd("day",e))}}function zx(e,t){const n=[];if(t&&e.day!==void 0&&z(e).length>1&&(q(dZ(e)),e=ae(e),delete e.day),e.year!==void 0?n.push(e.year):n.push(2012),e.month!==void 0){const i=t?$Z(e.month):e.month;n.push(i)}else if(e.quarter!==void 0){const i=t?SZ(e.quarter):e.quarter;n.push(Ee(i)?i*3:`${i}*3`)}else n.push(0);if(e.date!==void 0)n.push(e.date);else if(e.day!==void 0){const i=t?AZ(e.day):e.day;n.push(Ee(i)?i+1:`${i}+1`)}else n.push(1);for(const i of["hours","minutes","seconds","milliseconds"]){const r=e[i];n.push(typeof r>"u"?0:r)}return n}function ds(e){const n=zx(e,!0).join(", ");return e.utc?`utc(${n})`:`datetime(${n})`}function kZ(e){const n=zx(e,!1).join(", ");return e.utc?`utc(${n})`:`datetime(${n})`}function CZ(e){const t=zx(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}const cT={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Bx=z(cT);function FZ(e){return J(cT,e)}function Ds(e){return X(e)?e.binned:fT(e)}function fT(e){return e==null?void 0:e.startsWith("binned")}function Ux(e){return e.startsWith("utc")}function _Z(e){return e.substring(3)}const OZ={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function bg(e){return Bx.filter(t=>hT(e,t))}function dT(e){const t=bg(e);return t[t.length-1]}function hT(e,t){const n=e.indexOf(t);return!(n<0||n>0&&t==="seconds"&&e.charAt(n-1)==="i"||e.length>n+3&&t==="day"&&e.charAt(n+3)==="o"||n>0&&t==="year"&&e.charAt(n-1)==="f")}function RZ(e,t,{end:n}={end:!1}){const i=Ax(t),r=Ux(e)?"utc":"";function o(u){return u==="quarter"?`(${r}quarter(${i})-1)`:`${r}${u}(${i})`}let s;const a={};for(const u of Bx)hT(e,u)&&(a[u]=o(u),s=u);return n&&(a[s]+="+1"),kZ(a)}function gT(e){if(!e)return;const t=bg(e);return`timeUnitSpecifier(${Fe(t)}, ${Fe(OZ)})`}function MZ(e,t,n){if(!e)return;const i=gT(e);return`${n||Ux(e)?"utc":"time"}Format(${t}, ${i})`}function ft(e){if(!e)return;let t;return Y(e)?fT(e)?t={unit:e.substring(6),binned:!0}:t={unit:e}:X(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),Ux(t.unit)&&(t.utc=!0,t.unit=_Z(t.unit)),t}function DZ(e){const{utc:t,...n}=ft(e);return n.unit?(t?"utc":"")+z(n).map(i=>ze(`${i==="unit"?"":`_${i}_`}${n[i]}`)).join(""):`${t?"utc":""}timeunit${z(n).map(i=>ze(`_${i}_${n[i]}`)).join("")}`}function pT(e,t=n=>n){const n=ft(e),i=dT(n.unit);if(i&&i!=="day"){const r={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:o,part:s}=mT(i,n.step),a={...r,[s]:+r[s]+o};return`${t(ds(a))} - ${t(ds(r))}`}}const TZ={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function NZ(e){return J(TZ,e)}function mT(e,t=1){if(NZ(e))return{part:e,step:t};switch(e){case"day":case"dayofyear":return{part:"date",step:t};case"quarter":return{part:"month",step:t*3};case"week":return{part:"date",step:t*7}}}function LZ(e){return U(e,"param")}function jx(e){return!!(e!=null&&e.field)&&e.equal!==void 0}function qx(e){return!!(e!=null&&e.field)&&e.lt!==void 0}function Wx(e){return!!(e!=null&&e.field)&&e.lte!==void 0}function Gx(e){return!!(e!=null&&e.field)&&e.gt!==void 0}function Hx(e){return!!(e!=null&&e.field)&&e.gte!==void 0}function Vx(e){if(e!=null&&e.field){if(T(e.range)&&e.range.length===2)return!0;if(ee(e.range))return!0}return!1}function Xx(e){return!!(e!=null&&e.field)&&(T(e.oneOf)||T(e.in))}function IZ(e){return!!(e!=null&&e.field)&&e.valid!==void 0}function yT(e){return Xx(e)||jx(e)||Vx(e)||qx(e)||Gx(e)||Wx(e)||Hx(e)}function Si(e,t){return Fg(e,{timeUnit:t,wrapTime:!0})}function PZ(e,t){return e.map(n=>Si(n,t))}function bT(e,t=!0){const{field:n}=e,i=ft(e.timeUnit),{unit:r,binned:o}=i||{},s=V(e,{expr:"datum"}),a=r?`time(${o?s:RZ(r,n)})`:s;if(jx(e))return`${a}===${Si(e.equal,r)}`;if(qx(e)){const u=e.lt;return`${a}<${Si(u,r)}`}else if(Gx(e)){const u=e.gt;return`${a}>${Si(u,r)}`}else if(Wx(e)){const u=e.lte;return`${a}<=${Si(u,r)}`}else if(Hx(e)){const u=e.gte;return`${a}>=${Si(u,r)}`}else{if(Xx(e))return`indexof([${PZ(e.oneOf,r).join(",")}], ${a}) !== -1`;if(IZ(e))return vg(a,e.valid);if(Vx(e)){const{range:u}=ht(e),l=ee(u)?{signal:`${u.signal}[0]`}:u[0],c=ee(u)?{signal:`${u.signal}[1]`}:u[1];if(l!==null&&c!==null&&t)return`inrange(${a}, [${Si(l,r)}, ${Si(c,r)}])`;const f=[];return l!==null&&f.push(`${a} >= ${Si(l,r)}`),c!==null&&f.push(`${a} <= ${Si(c,r)}`),f.length>0?f.join(" && "):"true"}}throw new Error(`Invalid field predicate: ${Fe(e)}`)}function vg(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function zZ(e){return yT(e)&&e.timeUnit?{...e,timeUnit:ft(e.timeUnit)}:e}const vc={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function BZ(e){return e==="quantitative"||e==="temporal"}function Yx(e){return e==="ordinal"||e==="nominal"}const hs=vc.quantitative,Kx=vc.ordinal,_a=vc.temporal,Jx=vc.nominal,ru=vc.geojson;function UZ(e){if(e)switch(e=e.toLowerCase(),e){case"q":case hs:return"quantitative";case"t":case _a:return"temporal";case"o":case Kx:return"ordinal";case"n":case Jx:return"nominal";case ru:return"geojson"}}const gt={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",TIME:"time",UTC:"utc",POINT:"point",BAND:"band"},l1={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function jZ(e,t){const n=l1[e],i=l1[t];return n===i||n==="ordinal-position"&&i==="time"||i==="ordinal-position"&&n==="time"}const qZ={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function N$(e){return qZ[e]}const vT=new Set(["linear","log","pow","sqrt","symlog"]),xT=new Set([...vT,"time","utc"]);function ET(e){return vT.has(e)}const wT=new Set(["quantile","quantize","threshold"]),WZ=new Set([...xT,...wT,"sequential","identity"]),GZ=new Set(["ordinal","bin-ordinal","point","band"]);function He(e){return GZ.has(e)}function li(e){return WZ.has(e)}function Ri(e){return xT.has(e)}function Oa(e){return wT.has(e)}const HZ={pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5};function VZ(e){return!Y(e)&&U(e,"name")}function ST(e){return U(e,"param")}function XZ(e){return U(e,"unionWith")}function YZ(e){return X(e)&&"field"in e}const KZ={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},{type:Bue,domain:Uue,range:jue,rangeMax:que,rangeMin:Wue,scheme:Gue,...JZ}=KZ,QZ=z(JZ);function c1(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return Ri(e)||e==="band"||e==="point";case"padding":case"rangeMin":case"rangeMax":return Ri(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return e==="band";case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return Ri(e);case"nice":return Ri(e)||e==="quantize"||e==="threshold";case"exponent":return e==="pow";case"base":return e==="log";case"constant":return e==="symlog";case"zero":return li(e)&&!pe(["log","time","utc","threshold","quantile"],e)}}function $T(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return aa(e)?void 0:VQ(t);case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}function ZZ(e,t){return pe([Kx,Jx],t)?e===void 0||He(e):t===_a?pe([gt.TIME,gt.UTC,void 0],e):t===hs?ET(e)||Oa(e)||e===void 0:!0}function eee(e,t,n=!1){if(!Zi(e))return!1;switch(e){case Le:case ot:case vr:case iu:case Wn:case yi:return Ri(t)||t==="band"?!0:t==="point"?!n:!1;case xo:return pe(["linear","band"],t);case Fr:case So:case _r:case Eo:case wo:case Fs:return Ri(t)||Oa(t)||pe(["band","point","ordinal"],t);case sn:case Ki:case Ji:return t!=="band";case $o:case an:return t==="ordinal"||Oa(t)}}function tee(e){return X(e)&&"value"in e}const Yt={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},AT=Yt.arc,xg=Yt.area,Eg=Yt.bar,nee=Yt.image,wg=Yt.line,Sg=Yt.point,iee=Yt.rect,Wd=Yt.rule,kT=Yt.text,Qx=Yt.tick,ree=Yt.trail,Zx=Yt.circle,e2=Yt.square,CT=Yt.geoshape;function ko(e){return["line","area","trail"].includes(e)}function Tl(e){return["rect","bar","image","arc","tick"].includes(e)}const oee=new Set(z(Yt));function Ui(e){return U(e,"type")}const see=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit"],aee=["fill","fillOpacity"],uee=[...see,...aee],lee={color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1},L$=z(lee),Yp=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],cee={area:["line","point"],bar:Yp,rect:Yp,line:["point"],tick:["bandSize","thickness",...Yp]},fee={color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},dee={mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1},FT=z(dee);function gs(e){return U(e,"band")}const hee={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},gee=5,t2={binSpacing:0,continuousBandSize:gee,minBandSize:.25,timeUnitBandPosition:.5},pee={...t2,binSpacing:1},mee={...t2,thickness:1};function yee(e){return Ui(e)?e.type:e}function _T(e,{isPath:t}){return e===void 0||e==="break-paths-show-path-domains"?t?"break-paths-show-domains":"filter":e===null?"show":e}function n2({markDef:e,config:t,scaleChannel:n,scaleType:i,isCountAggregate:r}){var a,u;if(!i||!li(i)||r)return"always-valid";const o=_T(Ae("invalid",e,t),{isPath:ko(e.type)});return((u=(a=t.scale)==null?void 0:a.invalid)==null?void 0:u[n])!==void 0?"show":o}function bee(e){return e==="break-paths-filter-domains"||e==="break-paths-show-domains"}function OT({scaleName:e,scale:t,mode:n}){const i=`domain('${e}')`;if(!t||!e)return;const r=`${i}[0]`,o=`peek(${i})`,s=t.domainHasZero();return s==="definitely"?{scale:e,value:0}:s==="maybe"?{signal:`scale('${e}', inrange(0, ${i}) ? 0 : ${n==="zeroOrMin"?r:o})`}:{signal:`scale('${e}', ${n==="zeroOrMin"?r:o})`}}function RT({scaleChannel:e,channelDef:t,scale:n,scaleName:i,markDef:r,config:o}){var c;const s=n==null?void 0:n.get("type"),a=fi(t),u=pg(a==null?void 0:a.aggregate),l=n2({scaleChannel:e,markDef:r,config:o,scaleType:s,isCountAggregate:u});if(a&&l==="show"){const f=((c=o.scale.invalid)==null?void 0:c[e])??"zero-or-min";return{test:vg(V(a,{expr:"datum"}),!1),...vee(f,n,i)}}}function vee(e,t,n){if(tee(e)){const{value:i}=e;return ee(i)?{signal:i.signal}:{value:i}}return OT({scale:t,scaleName:n,mode:"zeroOrMin"})}function i2(e){const{channel:t,channelDef:n,markDef:i,scale:r,scaleName:o,config:s}=e,a=_s(t),u=r2(e),l=RT({scaleChannel:a,channelDef:n,scale:r,scaleName:o,markDef:i,config:s});return l!==void 0?[l,u]:u}function xee(e){const{datum:t}=e;return Ms(t)?ds(t):`${Fe(t)}`}function Yo(e,t,n,i){const r={};if(t&&(r.scale=t),er(e)){const{datum:o}=e;Ms(o)?r.signal=ds(o):ee(o)?r.signal=o.signal:bc(o)?r.signal=o.expr:r.value=o}else r.field=V(e,n);if(i){const{offset:o,band:s}=i;o&&(r.offset=o),s&&(r.band=s)}return r}function Gd({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:i,startSuffix:r,endSuffix:o="end",bandPosition:s=.5}){const a=!ee(s)&&0<s&&s<1?"datum":void 0,u=V(t,{expr:a,suffix:r}),l=n!==void 0?V(n,{expr:a}):V(t,{suffix:o,expr:a}),c={};if(s===0||s===1){c.scale=e;const f=s===0?u:l;c.field=f}else{const f=ee(s)?`(1-${s.signal}) * ${u} + ${s.signal} * ${l}`:`${1-s} * ${u} + ${s} * ${l}`;c.signal=`scale("${e}", ${f})`}return i&&(c.offset=i),c}function Eee({scaleName:e,fieldDef:t}){const n=V(t,{expr:"datum"}),i=V(t,{expr:"datum",suffix:"end"});return`abs(scale("${e}", ${i}) - scale("${e}", ${n}))`}function r2({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:s,stack:a,offset:u,defaultRef:l,bandPosition:c}){if(t){if(ue(t)){const f=s==null?void 0:s.get("type");if(Vt(t)){c??(c=Er({fieldDef:t,fieldDef2:n,markDef:i,config:r}));const{bin:d,timeUnit:h,type:g}=t;if(De(d)||c&&h&&g===_a)return a!=null&&a.impute?Yo(t,o,{binSuffix:"mid"},{offset:u}):c&&!He(f)?Gd({scaleName:o,fieldOrDatumDef:t,bandPosition:c,offset:u}):Yo(t,o,$c(t,e)?{binSuffix:"range"}:{},{offset:u});if(dt(d)){if(B(n))return Gd({scaleName:o,fieldOrDatumDef:t,fieldOrDatumDef2:n,bandPosition:c,offset:u});q(sT(e===Le?mi:Yi))}}return Yo(t,o,He(f)?{binSuffix:"range"}:{},{offset:u,band:f==="band"?c??t.bandPosition??.5:void 0})}else if(ci(t)){const f=t.value,d=u?{offset:u}:{};return{...dl(e,f),...d}}}return ce(l)&&(l=l()),l&&{...l,...u?{offset:u}:{}}}function dl(e,t){return pe(["x","x2"],e)&&t==="width"?{field:{group:"width"}}:pe(["y","y2"],e)&&t==="height"?{field:{group:"height"}}:Ne(t)}function ps(e){return e&&e!=="number"&&e!=="time"}function MT(e,t,n){return`${e}(${t}${n?`, ${Fe(n)}`:""})`}function o2({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o}){var l;if(ps(n))return ii({fieldOrDatumDef:e,format:t,formatType:n,expr:i,config:o});const s=DT(e,i,r),a=Ra(e);if(t===void 0&&n===void 0&&o.customFormatTypes){if(a==="quantitative"){if(r&&o.normalizedNumberFormatType)return ii({fieldOrDatumDef:e,format:o.normalizedNumberFormat,formatType:o.normalizedNumberFormatType,expr:i,config:o});if(o.numberFormatType)return ii({fieldOrDatumDef:e,format:o.numberFormat,formatType:o.numberFormatType,expr:i,config:o})}if(a==="temporal"&&o.timeFormatType&&B(e)&&e.timeUnit===void 0)return ii({fieldOrDatumDef:e,format:o.timeFormat,formatType:o.timeFormatType,expr:i,config:o})}function u(c){return B(c)?ft(c.timeUnit)||{}:{unit:void 0,utc:void 0}}if(Ta(e)){const{unit:c,utc:f}=u(e),d=See({field:s,timeUnit:c,format:t,formatType:o.timeFormatType,rawTimeFormat:o.timeFormat,isUTCScale:f||Ts(e)&&((l=e.scale)==null?void 0:l.type)===gt.UTC});return d?{signal:d}:void 0}if(t=f1({type:a,specifiedFormat:t,config:o,normalizeStack:r}),B(e)&&De(e.bin)){const c=V(e,{expr:i,binSuffix:"end"});return{signal:xc(s,c,t,n,o)}}else return t||Ra(e)==="quantitative"?{signal:`${LT(s,t)}`}:{signal:`isValid(${s}) ? ${s} : ""+${s}`}}function DT(e,t,n){return B(e)?n?`${V(e,{expr:t,suffix:"end"})}-${V(e,{expr:t,suffix:"start"})}`:V(e,{expr:t}):xee(e)}function ii({fieldOrDatumDef:e,format:t,formatType:n,expr:i,normalizeStack:r,config:o,field:s}){if(s??(s=DT(e,i,r)),s!=="datum.value"&&B(e)&&De(e.bin)){const a=V(e,{expr:i,binSuffix:"end"});return{signal:xc(s,a,t,n,o)}}return{signal:MT(n,s,t)}}function TT(e,t,n,i,r,o){var s;if(!(Y(i)&&ps(i))&&!(n===void 0&&i===void 0&&r.customFormatTypes&&Ra(e)==="quantitative"&&(r.normalizedNumberFormatType&&Ma(e)&&e.stack==="normalize"||r.numberFormatType))){if(Ma(e)&&e.stack==="normalize"&&r.normalizedNumberFormat)return f1({type:"quantitative",config:r,normalizeStack:!0});if(Ta(e)){const a=B(e)?(s=ft(e.timeUnit))==null?void 0:s.unit:void 0;return a===void 0&&r.customFormatTypes&&r.timeFormatType?void 0:wee({specifiedFormat:n,timeUnit:a,config:r,omitTimeFormatConfig:o})}return f1({type:t,specifiedFormat:n,config:r})}}function NT(e,t,n){var i;if(e&&(ee(e)||e==="number"||e==="time"))return e;if(Ta(t)&&n!=="time"&&n!=="utc")return B(t)&&((i=ft(t==null?void 0:t.timeUnit))!=null&&i.utc)?"utc":"time"}function f1({type:e,specifiedFormat:t,config:n,normalizeStack:i}){if(Y(t))return t;if(e===hs)return i?n.normalizedNumberFormat:n.numberFormat}function wee({specifiedFormat:e,timeUnit:t,config:n,omitTimeFormatConfig:i}){return e||(t?{signal:gT(t)}:i?void 0:n.timeFormat)}function LT(e,t){return`format(${e}, "${t||""}")`}function I$(e,t,n,i){return ps(n)?MT(n,e,t):LT(e,(Y(t)?t:void 0)??i.numberFormat)}function xc(e,t,n,i,r){if(n===void 0&&i===void 0&&r.customFormatTypes&&r.numberFormatType)return xc(e,t,r.numberFormat,r.numberFormatType,r);const o=I$(e,n,i,r),s=I$(t,n,i,r);return`${vg(e,!1)} ? "null" : ${o} + "${lQ}" + ${s}`}function See({field:e,timeUnit:t,format:n,formatType:i,rawTimeFormat:r,isUTCScale:o}){return!t||n?!t&&i?`${i}(${e}, ${Fe(n)})`:(n=Y(n)?n:r,`${o?"utc":"time"}Format(${e}, ${Fe(n)})`):MZ(t,e,o)}const $g="min",$ee={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function P$(e){return J($ee,e)}function Aee(e){return U(e,"encoding")}function gr(e){return e&&(e.op==="count"||U(e,"field"))}function IT(e){return e&&T(e)}function Ec(e){return U(e,"row")||U(e,"column")}function s2(e){return U(e,"header")}function Ag(e){return U(e,"facet")}function kee(e){return U(e,"param")}function Cee(e){return!Y(e)&&U(e,"repeat")}function z$(e){const{field:t,timeUnit:n,bin:i,aggregate:r}=e;return{...n?{timeUnit:n}:{},...i?{bin:i}:{},...r?{aggregate:r}:{},field:t}}function a2(e){return U(e,"sort")}function Er({fieldDef:e,fieldDef2:t,markDef:n,config:i}){if(ue(e)&&e.bandPosition!==void 0)return e.bandPosition;if(B(e)){const{timeUnit:r,bin:o}=e;if(r&&!t)return Bi("timeUnitBandPosition",n,i);if(De(o))return .5}}function PT({channel:e,fieldDef:t,fieldDef2:n,markDef:i,config:r,scaleType:o,useVlSizeChannel:s}){var l,c,f;const a=un(e),u=Ae(s?"size":a,i,r,{vgChannel:a});if(u!==void 0)return u;if(B(t)){const{timeUnit:d,bin:h}=t;if(d&&!n)return{band:Bi("timeUnitBandSize",i,r)};if(De(h)&&!He(o))return{band:1}}if(Tl(i.type))return o?He(o)?((l=r[i.type])==null?void 0:l.discreteBandSize)||{band:1}:(c=r[i.type])==null?void 0:c.continuousBandSize:(f=r[i.type])==null?void 0:f.discreteBandSize}function zT(e,t,n,i){return De(e.bin)||e.timeUnit&&Vt(e)&&e.type==="temporal"?Er({fieldDef:e,fieldDef2:t,markDef:n,config:i})!==void 0:!1}function BT(e){return U(e,"sort")&&!U(e,"field")}function wc(e){return U(e,"condition")}function kg(e){const t=e==null?void 0:e.condition;return!!t&&!T(t)&&B(t)}function Sc(e){const t=e==null?void 0:e.condition;return!!t&&!T(t)&&ue(t)}function Fee(e){const t=e==null?void 0:e.condition;return!!t&&(T(t)||ci(t))}function B(e){return U(e,"field")||(e==null?void 0:e.aggregate)==="count"}function Ra(e){return e==null?void 0:e.type}function er(e){return U(e,"datum")}function Zr(e){return Vt(e)&&!Vd(e)||Hd(e)}function B$(e){return Vt(e)&&e.type==="quantitative"&&!e.bin||Hd(e)}function Hd(e){return er(e)&&Ee(e.datum)}function ue(e){return B(e)||er(e)}function Vt(e){return e&&(U(e,"field")||e.aggregate==="count")&&U(e,"type")}function ci(e){return U(e,"value")}function Ts(e){return U(e,"scale")||U(e,"sort")}function Ma(e){return U(e,"axis")||U(e,"stack")||U(e,"impute")}function UT(e){return U(e,"legend")}function jT(e){return U(e,"format")||U(e,"formatType")}function _ee(e){return En(e,["legend","axis","header","scale"])}function Oee(e){return U(e,"op")}function V(e,t={}){let n=e.field;const i=t.prefix;let r=t.suffix,o="";if(Mee(e))n=RD("count");else{let s;if(!t.nofn)if(Oee(e))s=e.op;else{const{bin:a,aggregate:u,timeUnit:l}=e;De(a)?(s=GD(a),r=(t.binSuffix??"")+(t.suffix??"")):u?Ao(u)?(o=`["${n}"]`,n=`argmax_${u.argmax}`):xr(u)?(o=`["${n}"]`,n=`argmin_${u.argmin}`):s=String(u):l&&!Ds(l)&&(s=DZ(l),r=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(t.suffix??""))}s&&(n=n?`${s}_${n}`:s)}return r&&(n=`${n}_${r}`),i&&(n=`${i}_${n}`),t.forAs?nu(n):t.expr?CD(n,t.expr)+o:Un(n)+o}function Vd(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return B(e)&&!!e.bin;case"temporal":return!1}throw new Error(nT(e.type))}function Ree(e){var t;return Ts(e)&&Oa((t=e.scale)==null?void 0:t.type)}function Mee(e){return e.aggregate==="count"}function Dee(e,t){var s;const{field:n,bin:i,timeUnit:r,aggregate:o}=e;if(o==="count")return t.countTitle;if(De(i))return`${n} (binned)`;if(r&&!Ds(r)){const a=(s=ft(r))==null?void 0:s.unit;if(a)return`${n} (${bg(a).join("-")})`}else if(o)return Ao(o)?`${n} for max ${o.argmax}`:xr(o)?`${n} for min ${o.argmin}`:`${gc(o)} of ${n}`;return n}function Tee(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(Ao(t))return`${r} for argmax(${t.argmax})`;if(xr(t))return`${r} for argmin(${t.argmin})`;const o=i&&!Ds(i)?ft(i):void 0,s=t||(o==null?void 0:o.unit)||(o==null?void 0:o.maxbins)&&"timeunit"||De(n)&&"bin";return s?`${s.toUpperCase()}(${r})`:r}const qT=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return Tee(e);default:return Dee(e,t)}};let WT=qT;function GT(e){WT=e}function Nee(){GT(qT)}function ua(e,t,{allowDisabling:n,includeDefault:i=!0}){var a;const r=(a=u2(e))==null?void 0:a.title;if(!B(e))return r??e.title;const o=e,s=i?l2(o,t):void 0;return n?Ye(r,o.title,s):r??o.title??s}function u2(e){if(Ma(e)&&e.axis)return e.axis;if(UT(e)&&e.legend)return e.legend;if(s2(e)&&e.header)return e.header}function l2(e,t){return WT(e,t)}function Da(e){if(jT(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}else{const t=u2(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function Lee(e,t){var o;switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(a2(e)&&T(e.sort))return"ordinal";const{aggregate:n,bin:i,timeUnit:r}=e;if(r)return"temporal";if(i||n&&!Ao(n)&&!xr(n))return"quantitative";if(Ts(e)&&((o=e.scale)!=null&&o.type))switch(l1[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}function fi(e){if(B(e))return e;if(kg(e))return e.condition}function it(e){if(ue(e))return e;if(Sc(e))return e.condition}function HT(e,t,n,i={}){if(Ud(e)){const r=Y(e)?"string":Ee(e)?"number":"boolean";return q(NQ(t,r,e)),{value:e}}return ue(e)?Xd(e,t,n,i):Sc(e)?{...e,condition:Xd(e.condition,t,n,i)}:e}function Xd(e,t,n,i){if(jT(e)){const{format:r,formatType:o,...s}=e;if(ps(o)&&!n.customFormatTypes)return q(M$(t)),Xd(s,t,n,i)}else{const r=Ma(e)?"axis":UT(e)?"legend":s2(e)?"header":null;if(r&&e[r]){const{format:o,formatType:s,...a}=e[r];if(ps(s)&&!n.customFormatTypes)return q(M$(t)),Xd({...e,[r]:a},t,n,i)}}return B(e)?c2(e,t,i):Iee(e)}function Iee(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=Ee(n)?"quantitative":Y(n)?"nominal":Ms(n)?"temporal":void 0,{...e,type:t}}function c2(e,t,{compositeMark:n=!1}={}){const{aggregate:i,timeUnit:r,bin:o,field:s}=e,a={...e};if(!n&&i&&!Tx(i)&&!Ao(i)&&!xr(i)&&(q(IQ(i)),delete a.aggregate),r&&(a.timeUnit=ft(r)),s&&(a.field=`${s}`),De(o)&&(a.bin=Cg(o,t)),dt(o)&&!Ke(t)&&q(mZ(t)),Vt(a)){const{type:u}=a,l=UZ(u);u!==l&&(a.type=l),u!=="quantitative"&&pg(i)&&(q(LQ(u,i)),a.type="quantitative")}else if(!zD(t)){const u=Lee(a,t);a.type=u}if(Vt(a)){const{compatible:u,warning:l}=Pee(a,t)||{};u===!1&&q(l)}if(a2(a)&&Y(a.sort)){const{sort:u}=a;if(P$(u))return{...a,sort:{encoding:u}};const l=u.substring(1);if(u.charAt(0)==="-"&&P$(l))return{...a,sort:{encoding:l,order:"descending"}}}if(s2(a)){const{header:u}=a;if(u){const{orient:l,...c}=u;if(l)return{...a,header:{...c,labelOrient:u.labelOrient||l,titleOrient:u.titleOrient||l}}}}return a}function Cg(e,t){return Es(e)?{maxbins:S$(t)}:e==="binned"?{binned:!0}:!e.maxbins&&!e.step?{...e,maxbins:S$(t)}:e}const Gs={compatible:!0};function Pee(e,t){const n=e.type;if(n==="geojson"&&t!=="shape")return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case dr:case hr:case lg:return Vd(e)?Gs:{compatible:!1,warning:UQ(t)};case Le:case ot:case vr:case iu:case sn:case Ki:case Ji:case pc:case mc:case cg:case cs:case fg:case dg:case Fs:case Wn:case yi:case hg:return Gs;case vi:case jn:case bi:case xi:return n!==hs?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:Gs;case _r:case Eo:case wo:case So:case Fr:case Cr:case kr:case mi:case Yi:case xo:return n==="nominal"&&!e.sort?{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`}:Gs;case an:case $o:return!Vd(e)&&!Ree(e)?{compatible:!1,warning:jQ(t)}:Gs;case Fa:return e.type==="nominal"&&!("sort"in e)?{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}:Gs}}function Ta(e){const{formatType:t}=Da(e);return t==="time"||!t&&zee(e)}function zee(e){return e&&(e.type==="temporal"||B(e)&&!!e.timeUnit)}function Fg(e,{timeUnit:t,type:n,wrapTime:i,undefinedIfExprNotRequired:r}){var u;const o=t&&((u=ft(t))==null?void 0:u.unit);let s=o||n==="temporal",a;return bc(e)?a=e.expr:ee(e)?a=e.signal:Ms(e)?(s=!0,a=ds(e)):(Y(e)||Ee(e))&&s&&(a=`datetime(${Fe(e)})`,FZ(o)&&(Ee(e)&&e<1e4||Y(e)&&isNaN(Date.parse(e)))&&(a=ds({[o]:e}))),a?i&&s?`time(${a})`:a:r?void 0:Fe(e)}function VT(e,t){const{type:n}=e;return t.map(i=>{const r=B(e)&&!Ds(e.timeUnit)?e.timeUnit:void 0,o=Fg(i,{timeUnit:r,type:n,undefinedIfExprNotRequired:!0});return o!==void 0?{signal:o}:i})}function $c(e,t){return De(e.bin)?Zi(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const U$={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function Ac(e){return e==null?void 0:e.condition}const XT=["domain","grid","labels","ticks","title"],Bee={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},YT={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},Uee={...YT,style:1,labelExpr:1,encoding:1};function j$(e){return J(Uee,e)}const jee={axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1},KT=z(jee);function Rr(e){return U(e,"mark")}class _g{constructor(t,n){L(this,"name");L(this,"run");this.name=t,this.run=n}hasMatchingType(t){return Rr(t)?yee(t.mark)===this.name:!1}}function Ko(e,t){const n=e==null?void 0:e[t];return n?T(n)?Aa(n,i=>!!i.field):B(n)||kg(n):!1}function JT(e,t){const n=e==null?void 0:e[t];return n?T(n)?Aa(n,i=>!!i.field):B(n)||er(n)||Sc(n):!1}function QT(e,t){if(Ke(t)){const n=e[t];if((B(n)||er(n))&&(Yx(n.type)||B(n)&&n.timeUnit)){const i=_x(t);return JT(e,i)}}return!1}function ZT(e){return Aa(IJ,t=>{if(Ko(e,t)){const n=e[t];if(T(n))return Aa(n,i=>!!i.aggregate);{const i=fi(n);return i&&!!i.aggregate}}return!1})}function eN(e,t){const n=[],i=[],r=[],o=[],s={};return f2(e,(a,u)=>{if(B(a)){const{field:l,aggregate:c,bin:f,timeUnit:d,...h}=a;if(c||d||f){const g=u2(a),p=g==null?void 0:g.title;let m=V(a,{forAs:!0});const y={...p?[]:{title:ua(a,t,{allowDisabling:!0})},...h,field:m};if(c){let b;if(Ao(c)?(b="argmax",m=V({op:"argmax",field:c.argmax},{forAs:!0}),y.field=`${m}.${l}`):xr(c)?(b="argmin",m=V({op:"argmin",field:c.argmin},{forAs:!0}),y.field=`${m}.${l}`):c!=="boxplot"&&c!=="errorbar"&&c!=="errorband"&&(b=c),b){const v={op:b,as:m};l&&(v.field=l),o.push(v)}}else if(n.push(m),Vt(a)&&De(f)){if(i.push({bin:f,field:l,as:m}),n.push(V(a,{binSuffix:"end"})),$c(a,u)&&n.push(V(a,{binSuffix:"range"})),Ke(u)){const b={field:`${m}_end`};s[`${u}2`]=b}y.bin="binned",zD(u)||(y.type=hs)}else if(d&&!Ds(d)){r.push({timeUnit:d,field:l,as:m});const b=Vt(a)&&a.type!==_a&&"time";b&&(u===pc||u===cs?y.formatType=b:XJ(u)?y.legend={formatType:b,...y.legend}:Ke(u)&&(y.axis={formatType:b,...y.axis}))}s[u]=y}else n.push(l),s[u]=e[u]}else s[u]=e[u]}),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:s}}function qee(e,t,n){const i=KJ(t,n);if(i){if(i==="binned"){const r=e[t===mi?Le:ot];return!!(B(r)&&B(e[t])&&dt(r.bin))}}else return!1;return!0}function Wee(e,t,n,i){const r={};for(const o of z(e))PD(o)||q(BQ(o));for(let o of qJ){if(!e[o])continue;const s=e[o];if(yc(o)){const a=jJ(o),u=r[a];if(B(u)&&BZ(u.type)&&B(s)&&!u.timeUnit){q(TQ(a));continue}}if(o==="angle"&&t==="arc"&&!e.theta&&(q(DQ),o=Wn),!qee(e,o,t)){q(yg(o,t));continue}if(o===Fr&&t==="line"){const a=fi(e[o]);if(a!=null&&a.aggregate){q(zQ);continue}}if(o===sn&&(n?"fill"in e:"stroke"in e)){q(iT("encoding",{fill:"fill"in e,stroke:"stroke"in e}));continue}if(o===mc||o===Fa&&!T(s)&&!ci(s)||o===cs&&T(s)){if(s){if(o===Fa){const a=e[o];if(BT(a)){r[o]=a;continue}}r[o]=K(s).reduce((a,u)=>(B(u)?a.push(c2(u,o)):q(u1(u,o)),a),[])}}else{if(o===cs&&s===null)r[o]=null;else if(!B(s)&&!er(s)&&!ci(s)&&!wc(s)&&!ee(s)){q(u1(s,o));continue}r[o]=HT(s,o,i)}}return r}function Og(e,t){const n={};for(const i of z(e)){const r=HT(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function Gee(e){const t=[];for(const n of z(e))if(Ko(e,n)){const i=e[n],r=K(i);for(const o of r)B(o)?t.push(o):kg(o)&&t.push(o.condition)}return t}function f2(e,t,n){if(e)for(const i of z(e)){const r=e[i];if(T(r))for(const o of r)t.call(n,o,i);else t.call(n,r,i)}}function Hee(e,t,n,i){return e?z(e).reduce((r,o)=>{const s=e[o];return T(s)?s.reduce((a,u)=>t.call(i,a,u,o),r):t.call(i,r,s,o)},n):n}function tN(e,t){return z(t).reduce((n,i)=>{switch(i){case Le:case ot:case fg:case hg:case dg:case mi:case Yi:return n;case vr:case iu:{if(e==="line"||e==="area"||e==="trail"){const r=t[i];if(B(r)){const s=t[i===vr?Le:ot];if(B(s)&&!s.aggregate&&!r.aggregate){const a=V(s,{}),u=V(r,{});a&&u&&a!==u&&n.push(a)}}}return n}case Wn:case Cr:case yi:case kr:case xo:case bi:case vi:case xi:case jn:case pc:case an:case Fs:case cs:return n;case Fa:if(e==="line"||e==="trail")return n;case mc:case cg:{const r=t[i];if(T(r)||B(r))for(const o of K(r))o.aggregate||n.push(V(o,{}));return n}case Fr:if(e==="trail")return n;case sn:case Ki:case Ji:case _r:case Eo:case wo:case $o:case So:{const r=fi(t[i]);return r&&!r.aggregate&&n.push(V(r,{})),n}}},[])}function Vee(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let i,r;if(T(t)){for(const o of t)o.aggregate?(i||(i=[]),i.push(o)):(r||(r=[]),r.push(o));i&&(n.tooltip=i)}else t.aggregate?n.tooltip=t:r=t;return T(r)&&r.length===1&&(r=r[0]),{customTooltipWithoutAggregatedField:r,filteredEncoding:n}}function d1(e,t,n,i=!0){if("tooltip"in n)return{tooltip:n.tooltip};const r=e.map(({fieldPrefix:s,titlePrefix:a})=>{const u=i?` of ${d2(t)}`:"";return{field:s+t.field,type:t.type,title:ee(a)?{signal:`${a}"${escape(u)}"`}:a+u}}),o=Gee(n).map(_ee);return{tooltip:[...r,...mn(o,de)]}}function d2(e){const{title:t,field:n}=e;return Ye(t,n)}function h2(e,t,n,i,r){const{scale:o,axis:s}=n;return({partName:a,mark:u,positionPrefix:l,endPositionPrefix:c=void 0,extraEncoding:f={}})=>{const d=d2(n);return nN(e,a,r,{mark:u,encoding:{[t]:{field:`${l}_${n.field}`,type:n.type,...d!==void 0?{title:d}:{},...o!==void 0?{scale:o}:{},...s!==void 0?{axis:s}:{}},...Y(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...i,...f}})}}function nN(e,t,n,i){const{clip:r,color:o,opacity:s}=e,a=e.type;return e[t]||e[t]===void 0&&n[t]?[{...i,mark:{...n[t],...r?{clip:r}:{},...o?{color:o}:{},...s?{opacity:s}:{},...Ui(i.mark)?i.mark:{type:i.mark},style:`${a}-${String(t)}`,...Es(e[t])?{}:e[t]}}]:[]}function iN(e,t,n){const{encoding:i}=e,r=t==="vertical"?"y":"x",o=i[r],s=i[`${r}2`],a=i[`${r}Error`],u=i[`${r}Error2`];return{continuousAxisChannelDef:ef(o,n),continuousAxisChannelDef2:ef(s,n),continuousAxisChannelDefError:ef(a,n),continuousAxisChannelDefError2:ef(u,n),continuousAxis:r}}function ef(e,t){if(e!=null&&e.aggregate){const{aggregate:n,...i}=e;return n!==t&&q(pZ(n,t)),i}else return e}function rN(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(Ui(n)&&n.orient)return n.orient;if(Zr(r)){if(Zr(o)){const s=B(r)&&r.aggregate,a=B(o)&&o.aggregate;if(!s&&a===t)return"vertical";if(!a&&s===t)return"horizontal";if(s===t&&a===t)throw new Error("Both x and y cannot have aggregate");return Ta(o)&&!Ta(r)?"horizontal":"vertical"}return"horizontal"}else{if(Zr(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}}const Yd="boxplot",Xee=["box","median","outliers","rule","ticks"],Yee=new _g(Yd,sN);function oN(e){return Ee(e)?"tukey":e}function sN(e,{config:t}){e={...e,encoding:Og(e.encoding,t)};const{mark:n,encoding:i,params:r,projection:o,...s}=e,a=Ui(n)?n:{type:n};r&&q(tT("boxplot"));const u=a.extent??t.boxplot.extent,l=Ae("size",a,t),c=a.invalid,f=oN(u),{bins:d,timeUnits:h,transform:g,continuousAxisChannelDef:p,continuousAxis:m,groupby:y,aggregate:b,encodingWithoutContinuousAxis:v,ticksOrient:x,boxOrient:w,customTooltipWithoutAggregatedField:S}=Kee(e,u,t),E=nu(p.field),{color:$,size:A,...C}=v,F=h5=>h2(a,m,p,h5,t.boxplot),I=F(C),j=F(v),O=(X(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||"#4c78a8",k=F({...C,...A?{size:A}:{},color:{condition:{test:`${ke(`lower_box_${p.field}`)} >= ${ke(`upper_box_${p.field}`)}`,...$||{value:O}}}}),_=d1([{fieldPrefix:f==="min-max"?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:f==="min-max"?"lower_whisker_":"min_",titlePrefix:"Min"}],p,v),N={type:"tick",color:"black",opacity:1,orient:x,invalid:c,aria:!1},W=f==="min-max"?_:d1([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],p,v),P=[...I({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:W}),...I({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:W}),...I({partName:"ticks",mark:N,positionPrefix:"lower_whisker",extraEncoding:W}),...I({partName:"ticks",mark:N,positionPrefix:"upper_whisker",extraEncoding:W})],Q=[...f!=="tukey"?P:[],...j({partName:"box",mark:{type:"bar",...l?{size:l}:{},orient:w,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:_}),...k({partName:"median",mark:{type:"tick",invalid:c,...X(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...l?{size:l}:{},orient:x,aria:!1},positionPrefix:"mid_box",extraEncoding:_})];if(f==="min-max")return{...s,transform:(s.transform??[]).concat(g),layer:Q};const le=ke(`lower_box_${p.field}`),se=ke(`upper_box_${p.field}`),me=`(${se} - ${le})`,Ve=`${le} - ${u} * ${me}`,$e=`${se} + ${u} * ${me}`,Ei=ke(p.field),f5={joinaggregate:aN(p.field),groupby:y},eE={transform:[{filter:`(${Ve} <= ${Ei}) && (${Ei} <= ${$e})`},{aggregate:[{op:"min",field:p.field,as:`lower_whisker_${E}`},{op:"max",field:p.field,as:`upper_whisker_${E}`},{op:"min",field:`lower_box_${p.field}`,as:`lower_box_${E}`},{op:"max",field:`upper_box_${p.field}`,as:`upper_box_${E}`},...b],groupby:y}],layer:P},{tooltip:Jae,...d5}=C,{scale:tE,axis:nE}=p,iE=d2(p),rE=nN(a,"outliers",t.boxplot,{transform:[{filter:`(${Ei} < ${Ve}) || (${Ei} > ${$e})`}],mark:"point",encoding:{[m]:{field:p.field,type:p.type,...iE!==void 0?{title:iE}:{},...tE!==void 0?{scale:tE}:{},...nE!==void 0?{axis:nE}:{}},...d5,...$?{color:$}:{},...S?{tooltip:S}:{}}})[0];let _c;const oE=[...d,...h,f5];return rE?_c={transform:oE,layer:[rE,eE]}:(_c=eE,_c.transform.unshift(...oE)),{...s,layer:[_c,{transform:g,layer:Q}]}}function aN(e){const t=nu(e);return[{op:"q1",field:e,as:`lower_box_${t}`},{op:"q3",field:e,as:`upper_box_${t}`}]}function Kee(e,t,n){const i=rN(e,Yd),{continuousAxisChannelDef:r,continuousAxis:o}=iN(e,i,Yd),s=r.field,a=nu(s),u=oN(t),l=[...aN(s),{op:"median",field:s,as:`mid_box_${a}`},{op:"min",field:s,as:(u==="min-max"?"lower_whisker_":"min_")+a},{op:"max",field:s,as:(u==="min-max"?"upper_whisker_":"max_")+a}],c=u==="min-max"||u==="tukey"?[]:[{calculate:`${ke(`upper_box_${a}`)} - ${ke(`lower_box_${a}`)}`,as:`iqr_${a}`},{calculate:`min(${ke(`upper_box_${a}`)} + ${ke(`iqr_${a}`)} * ${t}, ${ke(`max_${a}`)})`,as:`upper_whisker_${a}`},{calculate:`max(${ke(`lower_box_${a}`)} - ${ke(`iqr_${a}`)} * ${t}, ${ke(`min_${a}`)})`,as:`lower_whisker_${a}`}],{[o]:f,...d}=e.encoding,{customTooltipWithoutAggregatedField:h,filteredEncoding:g}=Vee(d),{bins:p,timeUnits:m,aggregate:y,groupby:b,encoding:v}=eN(g,n),x=i==="vertical"?"horizontal":"vertical",w=i,S=[...p,...m,{aggregate:[...y,...l],groupby:b},...c];return{bins:p,timeUnits:m,transform:S,groupby:b,aggregate:y,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:v,ticksOrient:x,boxOrient:w,customTooltipWithoutAggregatedField:h}}const g2="errorbar",Jee=["ticks","rule"],Qee=new _g(g2,uN);function uN(e,{config:t}){e={...e,encoding:Og(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,ticksOrient:s,markDef:a,outerSpec:u,tooltipEncoding:l}=lN(e,g2,t);delete o.size;const c=h2(a,r,i,o,t.errorbar),f=a.thickness,d=a.size,h={type:"tick",orient:s,aria:!1,...f!==void 0?{thickness:f}:{},...d!==void 0?{size:d}:{}},g=[...c({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...f!==void 0?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return{...u,transform:n,...g.length>1?{layer:g}:{...g[0]}}}function Zee(e,t){const{encoding:n}=e;if(ete(n))return{orient:rN(e,t),inputType:"raw"};const i=tte(n),r=nte(n),o=n.x,s=n.y;if(i){if(r)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const a=n.x2,u=n.y2;if(ue(a)&&ue(u))throw new Error(`${t} cannot have both x2 and y2`);if(ue(a)){if(Zr(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}else if(ue(u)){if(Zr(s))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}else{const a=n.xError,u=n.xError2,l=n.yError,c=n.yError2;if(ue(u)&&!ue(a))throw new Error(`${t} cannot have xError2 without xError`);if(ue(c)&&!ue(l))throw new Error(`${t} cannot have yError2 without yError`);if(ue(a)&&ue(l))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(ue(a)){if(Zr(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}else if(ue(l)){if(Zr(s))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function ete(e){return(ue(e.x)||ue(e.y))&&!ue(e.x2)&&!ue(e.y2)&&!ue(e.xError)&&!ue(e.xError2)&&!ue(e.yError)&&!ue(e.yError2)}function tte(e){return ue(e.x2)||ue(e.y2)}function nte(e){return ue(e.xError)||ue(e.xError2)||ue(e.yError)||ue(e.yError2)}function lN(e,t,n){const{mark:i,encoding:r,params:o,projection:s,...a}=e,u=Ui(i)?i:{type:i};o&&q(tT(t));const{orient:l,inputType:c}=Zee(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:g,continuousAxis:p}=iN(e,l,t),{errorBarSpecificAggregate:m,postAggregateCalculates:y,tooltipSummary:b,tooltipTitleWithFieldName:v}=ite(u,f,d,h,g,c,t,n),{[p]:x,[p==="x"?"x2":"y2"]:w,[p==="x"?"xError":"yError"]:S,[p==="x"?"xError2":"yError2"]:E,...$}=r,{bins:A,timeUnits:C,aggregate:F,groupby:I,encoding:j}=eN($,n),O=[...F,...m],k=c!=="raw"?[]:I,_=d1(b,f,j,v);return{transform:[...a.transform??[],...A,...C,...O.length===0?[]:[{aggregate:O,groupby:k}],...y],groupby:k,continuousAxisChannelDef:f,continuousAxis:p,encodingWithoutContinuousAxis:j,ticksOrient:l==="vertical"?"horizontal":"vertical",markDef:u,outerSpec:a,tooltipEncoding:_}}function ite(e,t,n,i,r,o,s,a){let u=[],l=[];const c=t.field;let f,d=!1;if(o==="raw"){const h=e.center?e.center:e.extent?e.extent==="iqr"?"median":"mean":a.errorbar.center,g=e.extent?e.extent:h==="mean"?"stderr":"iqr";if(h==="median"!=(g==="iqr")&&q(gZ(h,g,s)),g==="stderr"||g==="stdev")u=[{op:g,field:c,as:`extent_${c}`},{op:h,field:c,as:`center_${c}`}],l=[{calculate:`${ke(`center_${c}`)} + ${ke(`extent_${c}`)}`,as:`upper_${c}`},{calculate:`${ke(`center_${c}`)} - ${ke(`extent_${c}`)}`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:gc(h)},{fieldPrefix:"upper_",titlePrefix:q$(h,g,"+")},{fieldPrefix:"lower_",titlePrefix:q$(h,g,"-")}],d=!0;else{let p,m,y;g==="ci"?(p="mean",m="ci0",y="ci1"):(p="median",m="q1",y="q3"),u=[{op:m,field:c,as:`lower_${c}`},{op:y,field:c,as:`upper_${c}`},{op:p,field:c,as:`center_${c}`}],f=[{fieldPrefix:"upper_",titlePrefix:ua({field:c,aggregate:y,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:ua({field:c,aggregate:m,type:"quantitative"},a,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:ua({field:c,aggregate:p,type:"quantitative"},a,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&q(hZ(e.center,e.extent)),o==="aggregated-upper-lower"?(f=[],l=[{calculate:ke(n.field),as:`upper_${c}`},{calculate:ke(c),as:`lower_${c}`}]):o==="aggregated-error"&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`${ke(c)} + ${ke(i.field)}`,as:`upper_${c}`}],r?l.push({calculate:`${ke(c)} + ${ke(r.field)}`,as:`lower_${c}`}):l.push({calculate:`${ke(c)} - ${ke(i.field)}`,as:`lower_${c}`}));for(const h of l)f.push({fieldPrefix:h.as.substring(0,6),titlePrefix:ls(ls(h.calculate,"datum['",""),"']","")})}return{postAggregateCalculates:l,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}function q$(e,t,n){return`${gc(e)} ${n} ${t}`}const p2="errorband",rte=["band","borders"],ote=new _g(p2,cN);function cN(e,{config:t}){e={...e,encoding:Og(e.encoding,t)};const{transform:n,continuousAxisChannelDef:i,continuousAxis:r,encodingWithoutContinuousAxis:o,markDef:s,outerSpec:a,tooltipEncoding:u}=lN(e,p2,t),l=s,c=h2(l,r,i,o,t.errorband),f=e.encoding.x!==void 0&&e.encoding.y!==void 0;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const g={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return f?(d={...d,...g,ariaRoleDescription:"errorband"},h={...h,...g,aria:!1}):l.interpolate?q(T$("interpolate")):l.tension&&q(T$("tension")),{...a,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:u})]}}const fN={};function m2(e,t,n){const i=new _g(e,t);fN[e]={normalizer:i,parts:n}}function ste(){return z(fN)}m2(Yd,sN,Xee);m2(g2,uN,Jee);m2(p2,cN,rte);const ate=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],dN={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},hN={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},ute=z(dN),lte=z(hN),cte={header:1,headerRow:1,headerColumn:1,headerFacet:1},gN=z(cte),pN=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],fte={gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},dte={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},di="_vgsid_",hte={point:{on:"click",fields:[di],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function y2(e){return e==="legend"||!!(e!=null&&e.legend)}function Kp(e){return y2(e)&&X(e)}function b2(e){return!!(e!=null&&e.select)}function mN(e){const t=[];for(const n of e||[]){if(b2(n))continue;const{expr:i,bind:r,...o}=n;if(r&&i){const s={...o,bind:r,init:i};t.push(s)}else{const s={...o,...i?{update:i}:{},...r?{bind:r}:{}};t.push(s)}}return t}function gte(e){return Rg(e)||x2(e)||v2(e)}function v2(e){return U(e,"concat")}function Rg(e){return U(e,"vconcat")}function x2(e){return U(e,"hconcat")}function yN({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function ji(e){return U(e,"step")}function W$(e){return U(e,"view")||U(e,"width")||U(e,"height")}const G$=20,pte={align:1,bounds:1,center:1,columns:1,spacing:1},mte=z(pte);function yte(e,t,n){const i=n[t],r={},{spacing:o,columns:s}=i;o!==void 0&&(r.spacing=o),s!==void 0&&(Ag(e)&&!Ec(e.facet)||v2(e))&&(r.columns=s),Rg(e)&&(r.columns=1);for(const a of mte)if(e[a]!==void 0)if(a==="spacing"){const u=e[a];r[a]=Ee(u)?u:{row:u.row??o,column:u.column??o}}else r[a]=e[a];return r}function h1(e,t){return e[t]??e[t==="width"?"continuousWidth":"continuousHeight"]}function g1(e,t){const n=Kd(e,t);return ji(n)?n.step:bN}function Kd(e,t){const n=e[t]??e[t==="width"?"discreteWidth":"discreteHeight"];return Ye(n,{step:e.step})}const bN=20,bte={continuousWidth:300,continuousHeight:300,step:bN},vte={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:bte,mark:fee,arc:{},area:{},bar:pee,circle:{},geoshape:{},image:{},line:{},point:{},rect:t2,rule:{color:"black"},square:{},text:{color:"black"},tick:mee,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:HZ,projection:{},legend:fte,header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:hte,style:{},title:{},facet:{spacing:G$},concat:{spacing:G$},normalizedNumberFormat:".0%"},rr=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],H$={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},V$={blue:rr[0],orange:rr[1],red:rr[2],teal:rr[3],green:rr[4],yellow:rr[5],purple:rr[6],pink:rr[7],brown:rr[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function xte(e={}){return{signals:[{name:"color",value:X(e)?{...V$,...e}:V$}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}function Ete(e){return{signals:[{name:"fontSize",value:X(e)?{...H$,...e}:H$}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}function wte(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}function vN(e){const t=z(e||{}),n={};for(const i of t){const r=e[i];n[i]=Ac(r)?XD(r):gn(r)}return n}function Ste(e){const t=z(e),n={};for(const i of t)n[i]=vN(e[i]);return n}const $te=[...FT,...KT,...gN,"background","padding","legend","lineBreak","scale","style","title","view"];function xN(e={}){const{color:t,font:n,fontSize:i,selection:r,...o}=e,s=Wa({},ae(vte),n?wte(n):{},t?xte(t):{},i?Ete(i):{},o||{});r&&Ga(s,"selection",r,!0);const a=En(s,$te);for(const u of["background","lineBreak","padding"])s[u]&&(a[u]=gn(s[u]));for(const u of FT)s[u]&&(a[u]=ht(s[u]));for(const u of KT)s[u]&&(a[u]=vN(s[u]));for(const u of gN)s[u]&&(a[u]=ht(s[u]));if(s.legend&&(a.legend=ht(s.legend)),s.scale){const{invalid:u,...l}=s.scale,c=ht(u,{level:1});a.scale={...ht(l),...z(c).length>0?{invalid:c}:{}}}return s.style&&(a.style=Ste(s.style)),s.title&&(a.title=ht(s.title)),s.view&&(a.view=ht(s.view)),a}const Ate=new Set(["view",...oee]),kte=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],Cte={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...cee};function Fte(e){e=ae(e);for(const t of kte)delete e[t];if(e.axis)for(const t in e.axis)Ac(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of ate)delete e.legend[t];if(e.mark){for(const t of L$)delete e.mark[t];e.mark.tooltip&&X(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(mN(e.params)),delete e.params);for(const t of Ate){for(const i of L$)delete e[t][i];const n=Cte[t];if(n)for(const i of n)delete e[t][i];Ote(e,t)}for(const t of ste())delete e[t];_te(e);for(const t in e)X(e[t])&&Me(e[t])&&delete e[t];return Me(e)?void 0:e}function _te(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=HD(e.title);Me(t)||(e.style["group-title"]={...e.style["group-title"],...t}),Me(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n}),Me(i)?delete e.title:e.title=i}function Ote(e,t,n,i){const r=e[t];t==="view"&&(n="cell");const o={...r,...e.style[n??t]};Me(o)||(e.style[n??t]=o),delete e[t]}function Mg(e){return U(e,"layer")}function Rte(e){return U(e,"repeat")}function Mte(e){return!T(e.repeat)&&U(e.repeat,"layer")}class E2{map(t,n){return Ag(t)?this.mapFacet(t,n):Rte(t)?this.mapRepeat(t,n):x2(t)?this.mapHConcat(t,n):Rg(t)?this.mapVConcat(t,n):v2(t)?this.mapConcat(t,n):this.mapLayerOrUnit(t,n)}mapLayerOrUnit(t,n){if(Mg(t))return this.mapLayer(t,n);if(Rr(t))return this.mapUnit(t,n);throw new Error(Nx(t))}mapLayer(t,n){return{...t,layer:t.layer.map(i=>this.mapLayerOrUnit(i,n))}}mapHConcat(t,n){return{...t,hconcat:t.hconcat.map(i=>this.map(i,n))}}mapVConcat(t,n){return{...t,vconcat:t.vconcat.map(i=>this.map(i,n))}}mapConcat(t,n){const{concat:i,...r}=t;return{...r,concat:i.map(o=>this.map(o,n))}}mapFacet(t,n){return{...t,spec:this.map(t.spec,n)}}mapRepeat(t,n){return{...t,spec:this.map(t.spec,n)}}}const Dte={zero:1,center:1,normalize:1};function Tte(e){return J(Dte,e)}const Nte=new Set([AT,Eg,xg,Wd,Sg,Zx,e2,wg,kT,Qx]),Lte=new Set([Eg,xg,AT]);function Hs(e){return B(e)&&Ra(e)==="quantitative"&&!e.bin}function X$(e,t,{orient:n,type:i}){const r=t==="x"?"y":"radius",o=t==="x"&&["bar","area"].includes(i),s=e[t],a=e[r];if(B(s)&&B(a))if(Hs(s)&&Hs(a)){if(s.stack)return t;if(a.stack)return r;const u=B(s)&&!!s.aggregate,l=B(a)&&!!a.aggregate;if(u!==l)return u?t:r;if(o){if(n==="vertical")return r;if(n==="horizontal")return t}}else{if(Hs(s))return t;if(Hs(a))return r}else{if(Hs(s))return o&&n==="vertical"?void 0:t;if(Hs(a))return o&&n==="horizontal"?void 0:r}}function Ite(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}function EN(e,t){var p,m;const n=Ui(e)?e:{type:e},i=n.type;if(!Nte.has(i))return null;const r=X$(t,"x",n)||X$(t,"theta",n);if(!r)return null;const o=t[r],s=B(o)?V(o,{}):void 0,a=Ite(r),u=[],l=new Set;if(t[a]){const y=t[a],b=B(y)?V(y,{}):void 0;b&&b!==s&&(u.push(a),l.add(b))}const c=a==="x"?"xOffset":"yOffset",f=t[c],d=B(f)?V(f,{}):void 0;d&&d!==s&&(u.push(c),l.add(d));const h=WJ.reduce((y,b)=>{if(b!=="tooltip"&&Ko(t,b)){const v=t[b];for(const x of K(v)){const w=fi(x);if(w.aggregate)continue;const S=V(w,{});(!S||!l.has(S))&&y.push({channel:b,fieldDef:w})}}return y},[]);let g;return o.stack!==void 0?Es(o.stack)?g=o.stack?"zero":null:g=o.stack:Lte.has(i)&&(g="zero"),!g||!Tte(g)||ZT(t)&&h.length===0?null:((p=o==null?void 0:o.scale)!=null&&p.type&&((m=o==null?void 0:o.scale)==null?void 0:m.type)!==gt.LINEAR&&o!=null&&o.stack&&q(cZ(o.scale.type)),ue(t[Qi(r)])?(o.stack!==void 0&&q(lZ(r)),null):(B(o)&&o.aggregate&&!iQ.has(o.aggregate)&&q(fZ(o.aggregate)),{groupbyChannels:u,groupbyFields:l,fieldChannel:r,impute:o.impute===null?!1:ko(i),stackBy:h,offset:g}))}function wN(e,t,n){const i=ht(e),r=Ae("orient",i,n);if(i.orient=Ute(i.type,t,r),r!==void 0&&r!==i.orient&&q(HQ(i.orient,r)),i.type==="bar"&&i.orient){const u=Ae("cornerRadiusEnd",i,n);if(u!==void 0){const l=i.orient==="horizontal"&&t.x2||i.orient==="vertical"&&t.y2?["cornerRadius"]:hee[i.orient];for(const c of l)i[c]=u;i.cornerRadiusEnd!==void 0&&delete i.cornerRadiusEnd}}const o=Ae("opacity",i,n),s=Ae("fillOpacity",i,n);return o===void 0&&s===void 0&&(i.opacity=zte(i.type,t)),Ae("cursor",i,n)===void 0&&(i.cursor=Pte(i,t,n)),i}function Pte(e,t,n){return t.href||e.href||Ae("href",e,n)?"pointer":e.cursor}const SN=.7;function zte(e,t){if(pe([Sg,Qx,Zx,e2],e)&&!ZT(t))return SN}function Bte(e,t,{graticule:n}){if(n)return!1;const i=Bi("filled",e,t),r=e.type;return Ye(i,r!==Sg&&r!==wg&&r!==Wd)}function Ute(e,t,n){switch(e){case Sg:case Zx:case e2:case iee:case nee:return}const{x:i,y:r,x2:o,y2:s}=t;switch(e){case kT:case Eg:if(B(i)&&(dt(i.bin)||B(r)&&r.aggregate&&!i.aggregate))return"vertical";if(B(r)&&(dt(r.bin)||B(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(s||o){if(n)return n;if(!o)return(B(i)&&i.type===hs&&!De(i.bin)||Hd(i))&&B(r)&&dt(r.bin)?"horizontal":"vertical";if(!s)return(B(r)&&r.type===hs&&!De(r.bin)||Hd(r))&&B(i)&&dt(i.bin)?"vertical":"horizontal"}case Wd:if(o&&!(B(i)&&dt(i.bin))&&s&&!(B(r)&&dt(r.bin)))return;case xg:if(s)return B(r)&&dt(r.bin)?"horizontal":"vertical";if(o)return B(i)&&dt(i.bin)?"vertical":"horizontal";if(e===Wd){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case wg:case Qx:{const a=B$(i),u=B$(r);if(n)return n;if(a&&!u)return e!=="tick"?"horizontal":"vertical";if(!a&&u)return e!=="tick"?"vertical":"horizontal";if(a&&u)return"vertical";{const l=Vt(i)&&i.type===_a,c=Vt(r)&&r.type===_a;if(l&&!c)return"vertical";if(!l&&c)return"horizontal"}return}}return"vertical"}function jte(e){const{point:t,line:n,...i}=e;return z(i).length>1?i:i.type}function qte(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:En(e[t],["point","line"])});return e}function Jp(e,t={},n){return e.point==="transparent"?{opacity:0}:e.point?X(e.point)?e.point:{}:e.point!==void 0?null:t.point||n.shape?X(t.point)?t.point:{}:void 0}function Y$(e,t={}){return e.line?e.line===!0?{}:e.line:e.line!==void 0?null:t.line?t.line===!0?{}:t.line:void 0}class Wte{constructor(){L(this,"name","path-overlay")}hasMatchingType(t,n){if(Rr(t)){const{mark:i,encoding:r}=t,o=Ui(i)?i:{type:i};switch(o.type){case"line":case"rule":case"trail":return!!Jp(o,n[o.type],r);case"area":return!!Jp(o,n[o.type],r)||!!Y$(o,n[o.type])}}return!1}run(t,n,i){const{config:r}=n,{params:o,projection:s,mark:a,name:u,encoding:l,...c}=t,f=Og(l,r),d=Ui(a)?a:{type:a},h=Jp(d,r[d.type],f),g=d.type==="area"&&Y$(d,r[d.type]),p=[{name:u,...o?{params:o}:{},mark:jte({...d.type==="area"&&Ae("opacity",d,r)==null&&Ae("fillOpacity",d,r)==null?{opacity:SN}:{},...d}),encoding:En(f,["shape"])}],m=EN(wN(d,f,r),f);let y=f;if(m){const{fieldChannel:b,offset:v}=m;y={...f,[b]:{...f[b],...v?{stack:v}:{}}}}return y=En(y,["y2","x2"]),g&&p.push({...s?{projection:s}:{},mark:{type:"line",...$a(d,["clip","interpolate","tension","tooltip"]),...g},encoding:y}),h&&p.push({...s?{projection:s}:{},mark:{type:"point",opacity:1,filled:!0,...$a(d,["clip","tooltip"]),...h},encoding:y}),i({...c,layer:p},{...n,config:qte(r)})}}function Gte(e,t){return t?Ec(e)?AN(e,t):$N(e,t):e}function Qp(e,t){return t?AN(e,t):e}function p1(e,t,n){const i=t[e];if(Cee(i)){if(i.repeat in n)return{...t,[e]:n[i.repeat]};q(SQ(i.repeat));return}return t}function $N(e,t){if(e=p1("field",e,t),e!==void 0){if(e===null)return null;if(a2(e)&&gr(e.sort)){const n=p1("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function K$(e,t){if(B(e))return $N(e,t);{const n=p1("datum",e,t);return n!==e&&!n.type&&(n.type="nominal"),n}}function J$(e,t){if(ue(e)){const n=K$(e,t);if(n)return n;if(wc(e))return{condition:e.condition}}else{if(Sc(e)){const n=K$(e.condition,t);if(n)return{...e,condition:n};{const{condition:i,...r}=e;return r}}return e}}function AN(e,t){const n={};for(const i in e)if(U(e,i)){const r=e[i];if(T(r))n[i]=r.map(o=>J$(o,t)).filter(o=>o);else{const o=J$(r,t);o!==void 0&&(n[i]=o)}}return n}class Hte{constructor(){L(this,"name","RuleForRangedLine")}hasMatchingType(t){if(Rr(t)){const{encoding:n,mark:i}=t;if(i==="line"||Ui(i)&&i.type==="line")for(const r of UJ){const o=_s(r),s=n[o];if(n[r]&&(B(s)&&!dt(s.bin)||er(s)))return!0}}return!1}run(t,n,i){const{encoding:r,mark:o}=t;return q(GQ(!!r.x2,!!r.y2)),i({...t,mark:X(o)?{...o,type:"rule"}:"rule"},n)}}class Vte extends E2{constructor(){super(...arguments);L(this,"nonFacetUnitNormalizers",[Yee,Qee,ote,new Wte,new Hte])}map(n,i){if(Rr(n)){const r=Ko(n.encoding,dr),o=Ko(n.encoding,hr),s=Ko(n.encoding,lg);if(r||o||s)return this.mapFacetedUnit(n,i)}return super.map(n,i)}mapUnit(n,i){const{parentEncoding:r,parentProjection:o}=i,s=Qp(n.encoding,i.repeater),a={...n,...n.name?{name:[i.repeaterPrefix,n.name].filter(l=>l).join("_")}:{},...s?{encoding:s}:{}};if(r||o)return this.mapUnitWithParentEncodingOrProjection(a,i);const u=this.mapLayerOrUnit.bind(this);for(const l of this.nonFacetUnitNormalizers)if(l.hasMatchingType(a,i.config))return l.run(a,i,u);return a}mapRepeat(n,i){return Mte(n)?this.mapLayerRepeat(n,i):this.mapNonLayerRepeat(n,i)}mapLayerRepeat(n,i){const{repeat:r,spec:o,...s}=n,{row:a,column:u,layer:l}=r,{repeater:c={},repeaterPrefix:f=""}=i;return a||u?this.mapRepeat({...n,repeat:{...a?{row:a}:{},...u?{column:u}:{}},spec:{repeat:{layer:l},spec:o}},i):{...s,layer:l.map(d=>{const h={...c,layer:d},g=`${(o.name?`${o.name}_`:"")+f}child__layer_${ze(d)}`,p=this.mapLayerOrUnit(o,{...i,repeater:h,repeaterPrefix:g});return p.name=g,p})}}mapNonLayerRepeat(n,i){const{repeat:r,spec:o,data:s,...a}=n;!T(r)&&n.columns&&(n=En(n,["columns"]),q(O$("repeat")));const u=[],{repeater:l={},repeaterPrefix:c=""}=i,f=!T(r)&&r.row||[l?l.row:null],d=!T(r)&&r.column||[l?l.column:null],h=T(r)&&r||[l?l.repeat:null];for(const p of h)for(const m of f)for(const y of d){const b={repeat:p,row:m,column:y,layer:l.layer},v=`${(o.name?`${o.name}_`:"")+c}child__${T(r)?`${ze(p)}`:(r.row?`row_${ze(m)}`:"")+(r.column?`column_${ze(y)}`:"")}`,x=this.map(o,{...i,repeater:b,repeaterPrefix:v});x.name=v,u.push(En(x,["data"]))}const g=T(r)?n.columns:r.column?r.column.length:1;return{data:o.data??s,align:"all",...a,columns:g,concat:u}}mapFacet(n,i){const{facet:r}=n;return Ec(r)&&n.columns&&(n=En(n,["columns"]),q(O$("facet"))),super.mapFacet(n,i)}mapUnitWithParentEncodingOrProjection(n,i){const{encoding:r,projection:o}=n,{parentEncoding:s,parentProjection:a,config:u}=i,l=Z$({parentProjection:a,projection:o}),c=Q$({parentEncoding:s,encoding:Qp(r,i.repeater)});return this.mapUnit({...n,...l?{projection:l}:{},...c?{encoding:c}:{}},{config:u})}mapFacetedUnit(n,i){const{row:r,column:o,facet:s,...a}=n.encoding,{mark:u,width:l,projection:c,height:f,view:d,params:h,encoding:g,...p}=n,{facetMapping:m,layout:y}=this.getFacetMappingAndLayout({row:r,column:o,facet:s},i),b=Qp(a,i.repeater);return this.mapFacet({...p,...y,facet:m,spec:{...l?{width:l}:{},...f?{height:f}:{},...d?{view:d}:{},...c?{projection:c}:{},mark:u,encoding:b,...h?{params:h}:{}}},i)}getFacetMappingAndLayout(n,i){const{row:r,column:o,facet:s}=n;if(r||o){s&&q(qQ([...r?[dr]:[],...o?[hr]:[]]));const a={},u={};for(const l of[dr,hr]){const c=n[l];if(c){const{align:f,center:d,spacing:h,columns:g,...p}=c;a[l]=p;for(const m of["align","center","spacing"])c[m]!==void 0&&(u[m]??(u[m]={}),u[m][l]=c[m])}}return{facetMapping:a,layout:u}}else{const{align:a,center:u,spacing:l,columns:c,...f}=s;return{facetMapping:Gte(f,i.repeater),layout:{...a?{align:a}:{},...u?{center:u}:{},...l?{spacing:l}:{},...c?{columns:c}:{}}}}}mapLayer(n,{parentEncoding:i,parentProjection:r,...o}){const{encoding:s,projection:a,...u}=n,l={...o,parentEncoding:Q$({parentEncoding:i,encoding:s,layer:!0}),parentProjection:Z$({parentProjection:r,projection:a})};return super.mapLayer({...u,...n.name?{name:[l.repeaterPrefix,n.name].filter(c=>c).join("_")}:{}},l)}}function Q$({parentEncoding:e,encoding:t={},layer:n}){let i={};if(e){const r=new Set([...z(e),...z(t)]);for(const o of r){const s=t[o],a=e[o];if(ue(s)){const u={...a,...s};i[o]=u}else Sc(s)?i[o]={...s,condition:{...a,...s.condition}}:s||s===null?i[o]=s:(n||ci(a)||ee(a)||ue(a)||T(a))&&(i[o]=a)}}else i=t;return!i||Me(i)?void 0:i}function Z$(e){const{parentProjection:t,projection:n}=e;return t&&n&&q(MQ({parentProjection:t,projection:n})),n??t}function w2(e){return U(e,"filter")}function Xte(e){return U(e,"stop")}function kN(e){return U(e,"lookup")}function Yte(e){return U(e,"data")}function Kte(e){return U(e,"param")}function Jte(e){return U(e,"pivot")}function Qte(e){return U(e,"density")}function Zte(e){return U(e,"quantile")}function ene(e){return U(e,"regression")}function tne(e){return U(e,"loess")}function nne(e){return U(e,"sample")}function ine(e){return U(e,"window")}function rne(e){return U(e,"joinaggregate")}function one(e){return U(e,"flatten")}function sne(e){return U(e,"calculate")}function CN(e){return U(e,"bin")}function ane(e){return U(e,"impute")}function une(e){return U(e,"timeUnit")}function lne(e){return U(e,"aggregate")}function cne(e){return U(e,"stack")}function fne(e){return U(e,"fold")}function dne(e){return U(e,"extent")&&!U(e,"density")&&!U(e,"regression")}function hne(e){return e.map(t=>w2(t)?{filter:sa(t.filter,zZ)}:t)}class gne extends E2{map(t,n){return n.emptySelections??(n.emptySelections={}),n.selectionPredicates??(n.selectionPredicates={}),t=eA(t,n),super.map(t,n)}mapLayerOrUnit(t,n){if(t=eA(t,n),t.encoding){const i={};for(const[r,o]of fo(t.encoding))i[r]=FN(o,n);t={...t,encoding:i}}return super.mapLayerOrUnit(t,n)}mapUnit(t,n){const{selection:i,...r}=t;return i?{...r,params:fo(i).map(([o,s])=>{const{init:a,bind:u,empty:l,...c}=s;c.type==="single"?(c.type="point",c.toggle=!1):c.type==="multi"&&(c.type="point"),n.emptySelections[o]=l!=="none";for(const f of Qe(n.selectionPredicates[o]??{}))f.empty=l!=="none";return{name:o,value:a,select:c,bind:u}})}:t}}function eA(e,t){const{transform:n,...i}=e;if(n){const r=n.map(o=>{if(w2(o))return{filter:m1(o,t)};if(CN(o)&&Os(o.bin))return{...o,bin:_N(o.bin)};if(kN(o)){const{selection:s,...a}=o.from;return s?{...o,from:{param:s,...a}}:o}return o});return{...i,transform:r}}return e}function FN(e,t){var i,r;const n=ae(e);if(B(n)&&Os(n.bin)&&(n.bin=_N(n.bin)),Ts(n)&&((r=(i=n.scale)==null?void 0:i.domain)!=null&&r.selection)){const{selection:o,...s}=n.scale.domain;n.scale.domain={...s,...o?{param:o}:{}}}if(wc(n))if(T(n.condition))n.condition=n.condition.map(o=>{const{selection:s,param:a,test:u,...l}=o;return a?o:{...l,test:m1(o,t)}});else{const{selection:o,param:s,test:a,...u}=FN(n.condition,t);n.condition=s?n.condition:{...u,test:m1(n.condition,t)}}return n}function _N(e){const t=e.extent;if(t!=null&&t.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function m1(e,t){const n=i=>sa(i,r=>{var a;const o=t.emptySelections[r]??!0,s={param:r,empty:o};return(a=t.selectionPredicates)[r]??(a[r]=[]),t.selectionPredicates[r].push(s),s});return e.selection?n(e.selection):sa(e.test||e.filter,i=>i.selection?n(i.selection):i)}class y1 extends E2{map(t,n){const i=n.selections??[];if(t.params&&!Rr(t)){const r=[];for(const o of t.params)b2(o)?i.push(o):r.push(o);t.params=r}return n.selections=i,super.map(t,n)}mapUnit(t,n){const i=n.selections;if(!i||!i.length)return t;const r=(n.path??[]).concat(t.name),o=[];for(const s of i)if(!s.views||!s.views.length)o.push(s);else for(const a of s.views)(Y(a)&&(a===t.name||r.includes(a))||T(a)&&a.map(u=>r.indexOf(u)).every((u,l,c)=>u!==-1&&(l===0||u>c[l-1])))&&o.push(s);return o.length&&(t.params=o),t}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=y1.prototype[e];y1.prototype[e]=function(n,i){return t.call(this,n,pne(n,i))}}function pne(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function ON(e,t){t===void 0&&(t=xN(e.config));const n=vne(e,t),{width:i,height:r}=e,o=xne(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const mne=new Vte,yne=new gne,bne=new y1;function vne(e,t={}){const n={config:t};return bne.map(mne.map(yne.map(e,n),n),n)}function tA(e){return Y(e)?{type:e}:e??{}}function xne(e,t,n){let{width:i,height:r}=t;const o=Rr(e)||Mg(e),s={};o?i=="container"&&r=="container"?(s.type="fit",s.contains="padding"):i=="container"?(s.type="fit-x",s.contains="padding"):r=="container"&&(s.type="fit-y",s.contains="padding"):(i=="container"&&(q(k$("width")),i=void 0),r=="container"&&(q(k$("height")),r=void 0));const a={type:"pad",...s,...n?tA(n.autosize):{},...tA(e.autosize)};if(a.type==="fit"&&!o&&(q(dQ),a.type="pad"),i=="container"&&!(a.type=="fit"||a.type=="fit-x")&&q(C$("width")),r=="container"&&!(a.type=="fit"||a.type=="fit-y")&&q(C$("height")),!yn(a,{type:"pad"}))return a}function Ene(e){return["fit","fit-x","fit-y"].includes(e)}function wne(e){return e?`fit-${gg(e)}`:"fit"}const Sne=["background","padding"];function nA(e,t){const n={};for(const i of Sne)e&&e[i]!==void 0&&(n[i]=gn(e[i]));return t&&(n.params=e.params),n}class Mr{constructor(t={},n={}){L(this,"explicit");L(this,"implicit");this.explicit=t,this.implicit=n}clone(){return new Mr(ae(this.explicit),ae(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(t){return Ye(this.explicit[t],this.implicit[t])}getWithExplicit(t){return this.explicit[t]!==void 0?{explicit:!0,value:this.explicit[t]}:this.implicit[t]!==void 0?{explicit:!1,value:this.implicit[t]}:{explicit:!1,value:void 0}}setWithExplicit(t,{value:n,explicit:i}){n!==void 0&&this.set(t,n,i)}set(t,n,i){return delete this[i?"implicit":"explicit"][t],this[i?"explicit":"implicit"][t]=n,this}copyKeyFromSplit(t,{explicit:n,implicit:i}){n[t]!==void 0?this.set(t,n[t],!0):i[t]!==void 0&&this.set(t,i[t],!1)}copyKeyFromObject(t,n){n[t]!==void 0&&this.set(t,n[t],!0)}copyAll(t){for(const n of z(t.combine())){const i=t.getWithExplicit(n);this.setWithExplicit(n,i)}}}function ki(e){return{explicit:!0,value:e}}function fn(e){return{explicit:!1,value:e}}function RN(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:Dg(t,n,i,r)}}function Dg(e,t,n,i){return e.explicit&&t.explicit&&q(tZ(n,i,e.value,t.value)),e}function go(e,t,n,i,r=Dg){return e===void 0||e.value===void 0?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:yn(e.value,t.value)?e:r(e,t,n,i)}class $ne extends Mr{constructor(n={},i={},r=!1){super(n,i);L(this,"explicit");L(this,"implicit");L(this,"parseNothing");this.explicit=n,this.implicit=i,this.parseNothing=r}clone(){const n=super.clone();return n.parseNothing=this.parseNothing,n}}function Na(e){return U(e,"url")}function Nl(e){return U(e,"values")}function MN(e){return U(e,"name")&&!Na(e)&&!Nl(e)&&!ro(e)}function ro(e){return e&&(DN(e)||TN(e)||S2(e))}function DN(e){return U(e,"sequence")}function TN(e){return U(e,"sphere")}function S2(e){return U(e,"graticule")}var Ue;(function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup",e[e.PreFilterInvalid=5]="PreFilterInvalid",e[e.PostFilterInvalid=6]="PostFilterInvalid"})(Ue||(Ue={}));function NN({invalid:e,isPath:t}){switch(_T(e,{isPath:t})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}function Ane(e){const{marks:t,scales:n}=NN(e);return t===n?Ue.Main:n==="include-invalid-values"?Ue.PreFilterInvalid:Ue.PostFilterInvalid}class _e{constructor(t,n){L(this,"debugName");L(this,"_children",[]);L(this,"_parent",null);L(this,"_hash");this.debugName=n,t&&(this.parent=t)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(t){this._parent=t,t&&t.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(t,n){if(this._children.includes(t)){q(_Q);return}n!==void 0?this._children.splice(n,0,t):this._children.push(t)}removeChild(t){const n=this._children.indexOf(t);return this._children.splice(n,1),n}remove(){let t=this._parent.removeChild(this);for(const n of this._children)n._parent=this._parent,this._parent.addChild(n,t++)}insertAsParentOf(t){const n=t.parent;n.removeChild(this),this.parent=n,t.parent=this}swapWithParent(){const t=this._parent,n=t.parent;for(const r of this._children)r.parent=t;this._children=[],t.removeChild(this);const i=t.parent.removeChild(t);this._parent=n,n.addChild(this,i),t.parent=this}}class en extends _e{constructor(n,i,r,o){super(n,i);L(this,"type");L(this,"refCounts");L(this,"_source");L(this,"_name");this.type=r,this.refCounts=o,this._source=this._name=i,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}clone(){const n=new this.constructor;return n.debugName=`clone_${this.debugName}`,n._source=this._source,n._name=`clone_${this._name}`,n.type=this.type,n.refCounts=this.refCounts,n.refCounts[n._name]=0,n}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${OD()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(n){this._source=n}}function Zp(e){return e.as!==void 0}function iA(e){return`${e}_end`}class Di extends _e{constructor(n,i){super(n);L(this,"timeUnits");this.timeUnits=i}clone(){return new Di(null,ae(this.timeUnits))}static makeFromEncoding(n,i){const r=i.reduceFieldDef((o,s,a)=>{const{field:u,timeUnit:l}=s;if(l){let c;if(Ds(l)){if(Pe(i)){const{mark:f,markDef:d,config:h}=i,g=Er({fieldDef:s,markDef:d,config:h});(Tl(f)||g)&&(c={timeUnit:ft(l),field:u})}}else c={as:V(s,{forAs:!0}),field:u,timeUnit:l};if(Pe(i)){const{mark:f,markDef:d,config:h}=i,g=Er({fieldDef:s,markDef:d,config:h});Tl(f)&&Ke(a)&&g!==.5&&(c.rectBandPosition=g)}c&&(o[de(c)]=c)}return o},{});return Me(r)?null:new Di(n,r)}static makeFromTransform(n,i){const{timeUnit:r,...o}={...i},s=ft(r),a={...o,timeUnit:s};return new Di(n,{[de(a)]:a})}merge(n){this.timeUnits={...this.timeUnits};for(const i in n.timeUnits)this.timeUnits[i]||(this.timeUnits[i]=n.timeUnits[i]);for(const i of n.children)n.removeChild(i),i.parent=this;n.remove()}removeFormulas(n){const i={};for(const[r,o]of fo(this.timeUnits)){const s=Zp(o)?o.as:`${o.field}_end`;n.has(s)||(i[r]=o)}this.timeUnits=i}producedFields(){return new Set(Qe(this.timeUnits).map(n=>Zp(n)?n.as:iA(n.field)))}dependentFields(){return new Set(Qe(this.timeUnits).map(n=>n.field))}hash(){return`TimeUnit ${de(this.timeUnits)}`}assemble(){const n=[];for(const i of Qe(this.timeUnits)){const{rectBandPosition:r}=i,o=ft(i.timeUnit);if(Zp(i)){const{field:s,as:a}=i,{unit:u,utc:l,...c}=o,f=[a,`${a}_end`];n.push({field:Un(s),type:"timeunit",...u?{units:bg(u)}:{},...l?{timezone:"utc"}:{},...c,as:f}),n.push(...rA(f,r,o))}else if(i){const{field:s}=i,a=FD(s),u=LN({timeUnit:o,field:a}),l=iA(a);n.push({type:"formula",expr:u,as:l}),n.push(...rA([a,l],r,o))}}return n}}const Tg="offsetted_rect_start",Ng="offsetted_rect_end";function LN({timeUnit:e,field:t,reverse:n}){const{unit:i,utc:r}=e,o=dT(i),{part:s,step:a}=mT(o,e.step);return`${r?"utcOffset":"timeOffset"}('${s}', ${ke(t)}, ${n?-a:a})`}function rA([e,t],n,i){if(n!==void 0&&n!==.5){const r=ke(e),o=ke(t);return[{type:"formula",expr:oA([LN({timeUnit:i,field:e,reverse:!0}),r],n+.5),as:`${e}_${Tg}`},{type:"formula",expr:oA([r,o],n+.5),as:`${e}_${Ng}`}]}return[]}function oA([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const kc="_tuple_fields";class kne{constructor(...t){L(this,"hasChannel");L(this,"hasField");L(this,"hasSelectionId");L(this,"timeUnit");L(this,"items");this.items=t,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const Cne={defined:()=>!0,parse:(e,t,n)=>{const i=t.name,r=t.project??(t.project=new kne),o={},s={},a=new Set,u=(g,p)=>{const m=p==="visual"?g.channel:g.field;let y=ze(`${i}_${m}`);for(let b=1;a.has(y);b++)y=ze(`${i}_${m}_${b}`);return a.add(y),{[p]:y}},l=t.type,c=e.config.selection[l],f=n.value!==void 0?K(n.value):null;let{fields:d,encodings:h}=X(n.select)?n.select:{};if(!d&&!h&&f){for(const g of f)if(X(g))for(const p of z(g))BJ(p)?(h||(h=[])).push(p):l==="interval"?(q(wQ),h=c.encodings):(d??(d=[])).push(p)}!d&&!h&&(h=c.encodings,"fields"in c&&(d=c.fields));for(const g of h??[]){const p=e.fieldDef(g);if(p){let m=p.field;if(p.aggregate){q(hQ(g,p.aggregate));continue}else if(!m){q(_$(g));continue}if(p.timeUnit&&!Ds(p.timeUnit)){m=e.vgField(g);const y={timeUnit:p.timeUnit,as:m,field:p.field};s[de(y)]=y}if(!o[m]){const y=l==="interval"&&Zi(g)&&li(e.getScaleComponent(g).get("type"))?"R":p.bin?"R-RE":"E",b={field:m,channel:g,type:y,index:r.items.length};b.signals={...u(b,"data"),...u(b,"visual")},r.items.push(o[m]=b),r.hasField[m]=o[m],r.hasSelectionId=r.hasSelectionId||m===di,LD(g)?(b.geoChannel=g,b.channel=ND(g),r.hasChannel[b.channel]=o[m]):r.hasChannel[g]=o[m]}}else q(_$(g))}for(const g of d??[]){if(r.hasField[g])continue;const p={type:"E",field:g,index:r.items.length};p.signals={...u(p,"data")},r.items.push(p),r.hasField[g]=p,r.hasSelectionId=r.hasSelectionId||g===di}f&&(t.init=f.map(g=>r.items.map(p=>X(g)?g[p.geoChannel||p.channel]!==void 0?g[p.geoChannel||p.channel]:g[p.field]:g))),Me(s)||(r.timeUnit=new Di(null,s))},signals:(e,t,n)=>{const i=t.name+kc;return n.filter(o=>o.name===i).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(BN)})}},IN="_curr",Pf="anim_value",Ys="anim_clock",b1="eased_anim_clock",PN="min_extent",zN="max_range_extent",em="last_tick_at",tm="is_playing",Fne=1/60*1e3,_ne=(e,t)=>[{name:b1,update:Ys},{name:`${e}_domain`,init:`domain('${t}')`},{name:PN,init:`extent(${e}_domain)[0]`},{name:zN,init:`extent(range('${t}'))[1]`},{name:Pf,update:`invert('${t}', ${b1})`}],One={defined:e=>e.type==="point",topLevelSignals:(e,t,n)=>(Ti(t)&&(n=n.concat([{name:Ys,init:"0",on:[{events:{type:"timer",throttle:Fne},update:`${tm} ? (${Ys} + (now() - ${em}) > ${zN} ? 0 : ${Ys} + (now() - ${em})) : ${Ys}`}]},{name:em,init:"now()",on:[{events:[{signal:Ys},{signal:tm}],update:"now()"}]},{name:tm,init:"true"}])),n),signals:(e,t,n)=>{const i=t.name,r=i+kc,o=t.project,s="(item().isVoronoi ? datum.datum : datum)",a=Qe(e.component.selection??{}).reduce((c,f)=>f.type==="interval"?c.concat(f.name+la):c,[]).map(c=>`indexof(item().mark.name, '${c}') < 0`).join(" && "),u=`datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${a?` && ${a}`:""}`;let l=`unit: ${Jo(e)}, `;if(t.project.hasSelectionId)l+=`${di}: ${s}[${G(di)}]`;else if(Ti(t))l+=`fields: ${r}, values: [${Pf} ? ${Pf} : ${PN}]`;else{const c=o.items.map(f=>{const d=e.fieldDef(f.channel);return d!=null&&d.bin?`[${s}[${G(e.vgField(f.channel,{}))}], ${s}[${G(e.vgField(f.channel,{binSuffix:"end"}))}]]`:`${s}[${G(f.field)}]`}).join(", ");l+=`fields: ${r}, values: [${c}]`}if(Ti(t))return n.concat(_ne(t.name,e.scaleName(xo)),[{name:i+Sr,on:[{events:[{signal:b1},{signal:Pf}],update:`{${l}}`,force:!0}]}]);{const c=t.events;return n.concat([{name:i+Sr,on:c?[{events:c,update:`${u} ? {${l}} : null`,force:!0}]:[]}])}}};function BN(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=Un(r.field),r}function ms(e,t=!0,n=nn){if(T(e)){const i=e.map(r=>ms(r,t,n));return t?`[${i.join(", ")}]`:i}else if(Ms(e))return n(t?ds(e):CZ(e));return t?n(Fe(e)):e}function Rne(e,t){for(const n of Qe(e.component.selection??{})){const i=n.name;let r=`${i}${Sr}, ${n.resolve==="global"?"true":`{unit: ${Jo(e)}}`}`;for(const o of Lg)o.defined(n)&&(o.signals&&(t=o.signals(e,n,t)),o.modifyExpr&&(r=o.modifyExpr(e,n,r)));t.push({name:i+rie,on:[{events:{signal:n.name+Sr},update:`modify(${G(n.name+ys)}, ${r})`}]})}return $2(t)}function Mne(e,t){if(e.component.selection&&z(e.component.selection).length){const n=G(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:vo("pointermove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return $2(t)}function Dne(e,t){let n=!1;for(const i of Qe(e.component.selection??{})){const r=i.name,o=G(r+ys);if(t.filter(a=>a.name===r).length===0){const a=i.resolve==="global"?"union":i.resolve,u=i.type==="point"?", true, true)":")";t.push({name:i.name,update:`${r3}(${o}, ${G(a)}${u}`})}n=!0;for(const a of Lg)a.defined(i)&&a.topLevelSignals&&(t=a.topLevelSignals(e,i,t))}return n&&t.filter(r=>r.name==="unit").length===0&&t.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),$2(t)}function Tne(e,t){const n=[],i=[],r=Jo(e,{escape:!1});for(const o of Qe(e.component.selection??{})){const s={name:o.name+ys};if(o.project.hasSelectionId&&(s.transform=[{type:"collect",sort:{field:di}}]),o.init){const u=o.project.items.map(BN);s.values=o.project.hasSelectionId?o.init.map(l=>({unit:r,[di]:ms(l,!1)[0]})):o.init.map(l=>({unit:r,fields:u,values:ms(l,!1)}))}if([...n,...t].filter(u=>u.name===o.name+ys).length||n.push(s),Ti(o)&&t.length){const u=e.lookupDataSource(e.getDataName(Ue.Main)),l=t.find(f=>f.name===u),c=l.transform.find(f=>f.type==="filter"&&f.expr.includes("vlSelectionTest"));if(c){l.transform=l.transform.filter(d=>d!==c);const f={name:l.name+IN,source:l.name,transform:[c]};i.push(f)}}}return n.concat(t,i)}function UN(e,t){for(const n of Qe(e.component.selection??{}))for(const i of Lg)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function Nne(e,t){for(const n of e.children)Pe(n)&&(t=UN(n,t));return t}function Lne(e,t,n,i){const r=l3(e,t.param,t);return{signal:li(n.get("type"))&&T(i)&&i[0]>i[1]?`isValid(${r}) && reverse(${r})`:r}}function $2(e){return e.map(t=>(t.on&&!t.on.length&&delete t.on,t))}const pr={defined:e=>e.type==="interval"&&e.resolve==="global"&&e.bind&&e.bind==="scales",parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!Zi(r))continue;const o=e.getScaleComponent(r),s=o?o.get("type"):void 0;if(s=="sequential"&&q(yQ),!o||!li(s)){q(mQ);continue}o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)}},topLevelSignals:(e,t,n)=>{const i=t.scales.filter(s=>n.filter(a=>a.name===s.signals.data).length===0);if(!e.parent||x1(e)||i.length===0)return n;const r=n.find(s=>s.name===t.name);let o=r.update;if(o.includes(r3))r.update=`{${i.map(s=>`${G(Un(s.field))}: ${s.signals.data}`).join(", ")}}`;else{for(const s of i){const a=`${G(Un(s.field))}: ${s.signals.data}`;o.includes(a)||(o=`${o.substring(0,o.length-1)}, ${a}}`)}r.update=o}return n.concat(i.map(s=>({name:s.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!x1(e))for(const i of t.scales){const r=n.find(o=>o.name===i.signals.data);r.push="outer",delete r.value,delete r.update}return n}};function v1(e,t){return`domain(${G(e.scaleName(t))})`}function x1(e){return e.parent&&lu(e.parent)&&(!e.parent.parent||x1(e.parent.parent))}const la="_brush",jN="_scale_trigger",Cu="geo_interval_init_tick",qN="_init",Ine="_center",Pne={defined:e=>e.type==="interval",parse:(e,t,n)=>{var i;if(e.hasProjection){const r={...X(n.select)?n.select:{}};r.fields=[di],r.encodings||(r.encodings=n.value?z(n.value):[vi,bi]),n.select={type:"interval",...r}}if(t.translate&&!pr.defined(t)){const r=`!event.item || event.item.mark.name !== ${G(t.name+la)}`;for(const o of t.events){if(!o.between){q(`${o} is not an ordered event stream for interval selections.`);continue}const s=K((i=o.between[0]).filter??(i.filter=[]));s.includes(r)||s.push(r)}}},signals:(e,t,n)=>{const i=t.name,r=i+Sr,o=Qe(t.project.hasChannel).filter(a=>a.channel===Le||a.channel===ot),s=t.init?t.init[0]:null;if(n.push(...o.reduce((a,u)=>a.concat(zne(e,t,u,s==null?void 0:s[u.index])),[])),e.hasProjection){const a=G(e.projectionName()),u=e.projectionName()+Ine,{x:l,y:c}=t.project.hasChannel,f=l==null?void 0:l.signals.visual,d=c==null?void 0:c.signals.visual,h=l?s==null?void 0:s[l.index]:`${u}[0]`,g=c?s==null?void 0:s[c.index]:`${u}[1]`,p=w=>e.getSizeSignalRef(w).signal,m=`[[${f?`${f}[0]`:"0"}, ${d?`${d}[0]`:"0"}],[${f?`${f}[1]`:p("width")}, ${d?`${d}[1]`:p("height")}]]`;s&&(n.unshift({name:i+qN,init:`[scale(${a}, [${l?h[0]:h}, ${c?g[0]:g}]), scale(${a}, [${l?h[1]:h}, ${c?g[1]:g}])]`}),(!l||!c)&&(n.find(S=>S.name===u)||n.unshift({name:u,update:`invert(${a}, [${p("width")}/2, ${p("height")}/2])`})));const y=`intersect(${m}, {markname: ${G(e.getName("marks"))}}, unit.mark)`,b=`{unit: ${Jo(e)}}`,v=`vlSelectionTuples(${y}, ${b})`,x=o.map(w=>w.signals.visual);return n.concat({name:r,on:[{events:[...x.length?[{signal:x.join(" || ")}]:[],...s?[{signal:Cu}]:[]],update:v}]})}else{if(!pr.defined(t)){const l=i+jN,c=o.map(f=>{const d=f.channel,{data:h,visual:g}=f.signals,p=G(e.scaleName(d)),m=e.getScaleComponent(d).get("type"),y=li(m)?"+":"";return`(!isArray(${h}) || (${y}invert(${p}, ${g})[0] === ${y}${h}[0] && ${y}invert(${p}, ${g})[1] === ${y}${h}[1]))`});c.length&&n.push({name:l,value:{},on:[{events:o.map(f=>({scale:e.scaleName(f.channel)})),update:`${c.join(" && ")} ? ${l} : {}`}]})}const a=o.map(l=>l.signals.data),u=`unit: ${Jo(e)}, fields: ${i+kc}, values`;return n.concat({name:r,...s?{init:`{${u}: ${ms(s)}}`}:{},...a.length?{on:[{events:[{signal:a.join(" || ")}],update:`${a.join(" && ")} ? {${u}: [${a}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>(Pe(e)&&e.hasProjection&&t.init&&(n.filter(r=>r.name===Cu).length||n.unshift({name:Cu,value:null,on:[{events:"timer{1}",update:`${Cu} === null ? {} : ${Cu}`}]})),n),marks:(e,t,n)=>{const i=t.name,{x:r,y:o}=t.project.hasChannel,s=r==null?void 0:r.signals.visual,a=o==null?void 0:o.signals.visual,u=`data(${G(t.name+ys)})`;if(pr.defined(t)||!r&&!o)return n;const l={x:r!==void 0?{signal:`${s}[0]`}:{value:0},y:o!==void 0?{signal:`${a}[0]`}:{value:0},x2:r!==void 0?{signal:`${s}[1]`}:{field:{group:"width"}},y2:o!==void 0?{signal:`${a}[1]`}:{field:{group:"height"}}};if(t.resolve==="global")for(const m of z(l))l[m]=[{test:`${u}.length && ${u}[0].unit === ${Jo(e)}`,...l[m]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,g=z(h).reduce((m,y)=>(m[y]=[{test:[r!==void 0&&`${s}[0] !== ${s}[1]`,o!==void 0&&`${a}[0] !== ${a}[1]`].filter(b=>b).join(" && "),value:h[y]},{value:null}],m),{}),p=d??(t.translate?"move":null);return[{name:`${i+la}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:l}},...n,{name:i+la,type:"rect",clip:!0,encode:{enter:{...p?{cursor:{value:p}}:{},fill:{value:"transparent"}},update:{...l,...g}}}]}};function zne(e,t,n,i){const r=!e.hasProjection,o=n.channel,s=n.signals.visual,a=G(r?e.scaleName(o):e.projectionName()),u=d=>`scale(${a}, ${d})`,l=e.getSizeSignalRef(o===Le?"width":"height").signal,c=`${o}(unit)`,f=t.events.reduce((d,h)=>[...d,{events:h.between[0],update:`[${c}, ${c}]`},{events:h,update:`[${s}[0], clamp(${c}, 0, ${l})]`}],[]);if(r){const d=n.signals.data,h=pr.defined(t),g=e.getScaleComponent(o),p=g?g.get("type"):void 0,m=i?{init:ms(i,!0,u)}:{value:[]};return f.push({events:{signal:t.name+jN},update:li(p)?`[${u(`${d}[0]`)}, ${u(`${d}[1]`)}]`:"[0, 0]"}),h?[{name:d,on:[]}]:[{name:s,...m,on:f},{name:d,...i?{init:ms(i)}:{},on:[{events:{signal:s},update:`${s}[0] === ${s}[1] ? null : invert(${a}, ${s})`}]}]}else{const d=o===Le?0:1,h=t.name+qN,g=i?{init:`[${h}[0][${d}], ${h}[1][${d}]]`}:{value:[]};return[{name:s,...g,on:f}]}}function ou({model:e,channelDef:t,vgChannel:n,invalidValueRef:i,mainRefFn:r}){const o=wc(t)&&t.condition;let s=[];o&&(s=K(o).map(l=>{const c=r(l);if(kee(l)){const{param:f,empty:d}=l;return{test:u3(e,{param:f,empty:d}),...c}}else return{test:Zd(e,l.test),...c}})),i!==void 0&&s.push(i);const a=r(t);return a!==void 0&&s.push(a),s.length>1||s.length===1&&s[0].test?{[n]:s}:s.length===1?{[n]:s[0]}:{}}function A2(e,t="text"){const n=e.encoding[t];return ou({model:e,channelDef:n,vgChannel:t,mainRefFn:i=>k2(i,e.config),invalidValueRef:void 0})}function k2(e,t,n="datum"){if(e){if(ci(e))return Ne(e.value);if(ue(e)){const{format:i,formatType:r}=Da(e);return o2({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function WN(e,t={}){const{encoding:n,markDef:i,config:r,stack:o}=e,s=n.tooltip;if(T(s))return{tooltip:sA({tooltip:s},o,r,t)};{const a=t.reactiveGeom?"datum.datum":"datum";return ou({model:e,channelDef:s,vgChannel:"tooltip",mainRefFn:l=>{const c=HN(l,r,a);if(c)return c;if(l===null)return;let f=Ae("tooltip",i,r);if(f===!0&&(f={content:"encoding"}),Y(f))return{value:f};if(X(f))return ee(f)?f:f.content==="encoding"?sA(n,o,r,t):{signal:a}},invalidValueRef:void 0})}}function GN(e,t,n,{reactiveGeom:i}={}){const r={...n,...n.tooltipFormat},o=new Set,s=i?"datum.datum":"datum",a=[];function u(c,f){const d=_s(f),h=Vt(c)?c:{...c,type:e[d].type},g=h.title||l2(h,r),p=K(g).join(", ").replaceAll(/"/g,'\\"');let m;if(Ke(f)){const y=f==="x"?"x2":"y2",b=fi(e[y]);if(dt(h.bin)&&b){const v=V(h,{expr:s}),x=V(b,{expr:s}),{format:w,formatType:S}=Da(h);m=xc(v,x,w,S,r),o.add(y)}}if((Ke(f)||f===Wn||f===yi)&&t&&t.fieldChannel===f&&t.offset==="normalize"){const{format:y,formatType:b}=Da(h);m=o2({fieldOrDatumDef:h,format:y,formatType:b,expr:s,config:r,normalizeStack:!0}).signal}m??(m=HN(h,r,s).signal),a.push({channel:f,key:p,value:m})}f2(e,(c,f)=>{B(c)?u(c,f):kg(c)&&u(c.condition,f)});const l={};for(const{channel:c,key:f,value:d}of a)!o.has(c)&&!l[f]&&(l[f]=d);return l}function sA(e,t,n,{reactiveGeom:i}={}){const r=GN(e,t,n,{reactiveGeom:i}),o=fo(r).map(([s,a])=>`"${s}": ${a}`);return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function HN(e,t,n="datum"){if(B(e)&&Yx(e.type)&&!e.timeUnit&&!Da(e).format&&!Da(e).formatType){const i=`${n}["${e.field}"]`;return{signal:`isValid(${i}) ? isArray(${i}) ? join(${i}, '\\n') : ${i} : ""+${i}`}}return k2(e,t,n)}function Bne(e){const{markDef:t,config:n}=e,i=Ae("aria",t,n);return i===!1?{}:{...i?{aria:i}:{},...Une(e),...jne(e)}}function Une(e){const{mark:t,markDef:n,config:i}=e;if(i.aria===!1)return{};const r=Ae("ariaRoleDescription",n,i);return r!=null?{ariaRoleDescription:{value:r}}:J(uQ,t)?{}:{ariaRoleDescription:{value:t}}}function jne(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return ou({model:e,channelDef:o,vgChannel:"description",mainRefFn:u=>k2(u,e.config),invalidValueRef:void 0});const s=Ae("description",n,i);if(s!=null)return{description:Ne(s)};if(i.aria===!1)return{};const a=GN(t,r,i);if(!Me(a))return{description:{signal:fo(a).filter(([u])=>!u.startsWith("_")).map(([u,l])=>[u,l.replaceAll("\\n"," ")]).map(([u,l],c)=>`"${c>0?"; ":""}${u}: " + (${l})`).join(" + ")}}}function pt(e,t,n={}){const{markDef:i,encoding:r,config:o}=t,{vgChannel:s}=n;let{defaultRef:a,defaultValue:u}=n;const l=r[e];a===void 0&&(u??(u=Ae(e,i,o,{vgChannel:s,ignoreVgConfig:!wc(l)})),u!==void 0&&(a=Ne(u)));const c={markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},f=RT({...c,scaleChannel:e,channelDef:l});return ou({model:t,channelDef:l,vgChannel:s??e,invalidValueRef:f,mainRefFn:h=>r2({...c,channel:e,channelDef:h,stack:null,defaultRef:a})})}function VN(e,t={filled:void 0}){const{markDef:n,encoding:i,config:r}=e,{type:o}=n,s=t.filled??Ae("filled",n,r),a=pe(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,u=Ae(s===!0?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[s===!0&&"color"]??a,l=Ae(s===!1?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[s===!1&&"color"],c=s?"fill":"stroke",f={...u?{fill:Ne(u)}:{},...l?{stroke:Ne(l)}:{}};return n.color&&(s?n.fill:n.stroke)&&q(iT("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...pt("color",e,{vgChannel:c,defaultValue:s?u:l}),...pt("fill",e,{defaultValue:i.fill?u:void 0}),...pt("stroke",e,{defaultValue:i.stroke?l:void 0})}}function qne(e){const{encoding:t,mark:n}=e,i=t.order;return!ko(n)&&ci(i)?ou({model:e,channelDef:i,vgChannel:"zindex",mainRefFn:r=>Ne(r.value),invalidValueRef:void 0}):{}}function La({channel:e,markDef:t,encoding:n={},model:i,bandPosition:r}){const o=`${e}Offset`,s=t[o],a=n[o];if((o==="xOffset"||o==="yOffset")&&a)return{offsetType:"encoding",offset:r2({channel:o,channelDef:a,markDef:t,config:i==null?void 0:i.config,scaleName:i.scaleName(o),scale:i.getScaleComponent(o),stack:null,defaultRef:Ne(s),bandPosition:r})};const u=t[o];return u?{offsetType:"visual",offset:u}:{}}function jt(e,t,{defaultPos:n,vgChannel:i}){const{encoding:r,markDef:o,config:s,stack:a}=t,u=r[e],l=r[Qi(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=La({channel:e,markDef:o,encoding:r,model:t,bandPosition:.5}),g=C2({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),p=!u&&Ke(e)&&(r.latitude||r.longitude)?{field:t.getName(e)}:Wne({channel:e,channelDef:u,channel2Def:l,markDef:o,config:s,scaleName:c,scale:f,stack:a,offset:d,defaultRef:g,bandPosition:h==="encoding"?0:void 0});return p?{[i||e]:p}:void 0}function Wne(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o,markDef:s}=e;if(ue(n)&&r&&t===r.fieldChannel){if(B(n)){let a=n.bandPosition;if(a===void 0&&s.type==="text"&&(t==="radius"||t==="theta")&&(a=.5),a!==void 0)return Gd({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:a,offset:o})}return Yo(n,i,{suffix:"end"},{offset:o})}return i2(e)}function C2({model:e,defaultPos:t,channel:n,scaleName:i,scale:r}){const{markDef:o,config:s}=e;return()=>{const a=_s(n),u=ho(n),l=Ae(n,o,s,{vgChannel:u});if(l!==void 0)return dl(n,l);switch(t){case"zeroOrMin":return aA({scaleName:i,scale:r,mode:"zeroOrMin",mainChannel:a,config:s});case"zeroOrMax":return aA({scaleName:i,scale:r,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:a,config:s});case"mid":return{...e[un(n)],mult:.5}}}}function aA({mainChannel:e,config:t,...n}){const i=OT(n),{mode:r}=n;if(i)return i;switch(e){case"radius":{if(r==="zeroOrMin")return{value:0};const{widthSignal:o,heightSignal:s}=r.zeroOrMax;return{signal:`min(${o},${s})/2`}}case"theta":return r==="zeroOrMin"?{value:0}:{signal:"2*PI"};case"x":return r==="zeroOrMin"?{value:0}:{field:{group:"width"}};case"y":return r==="zeroOrMin"?{field:{group:"height"}}:{value:0}}}const Gne={left:"x",center:"xc",right:"x2"},Hne={top:"y",middle:"yc",bottom:"y2"};function XN(e,t,n,i="middle"){if(e==="radius"||e==="theta")return ho(e);const r=e==="x"?"align":"baseline",o=Ae(r,t,n);let s;return ee(o)?(q(WQ(r)),s=void 0):s=o,e==="x"?Gne[s||(i==="top"?"left":"center")]:Hne[s||i]}function Jd(e,t,{defaultPos:n,defaultPos2:i,range:r}){return r?YN(e,t,{defaultPos:n,defaultPos2:i}):jt(e,t,{defaultPos:n})}function YN(e,t,{defaultPos:n,defaultPos2:i}){const{markDef:r,config:o}=t,s=Qi(e),a=un(e),u=Vne(t,i,s),l=u[a]?XN(e,r,o):ho(e);return{...jt(e,t,{defaultPos:n,vgChannel:l}),...u}}function Vne(e,t,n){const{encoding:i,mark:r,markDef:o,stack:s,config:a}=e,u=_s(n),l=un(n),c=ho(n),f=i[u],d=e.scaleName(u),h=e.getScaleComponent(u),{offset:g}=n in i||n in o?La({channel:n,markDef:o,encoding:i,model:e}):La({channel:u,markDef:o,encoding:i,model:e});if(!f&&(n==="x2"||n==="y2")&&(i.latitude||i.longitude)){const m=un(n),y=e.markDef[m];return y!=null?{[m]:{value:y}}:{[c]:{field:e.getName(n)}}}const p=Xne({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:a,scaleName:d,scale:h,stack:s,offset:g,defaultRef:void 0});return p!==void 0?{[c]:p}:tf(n,o)||tf(n,{[n]:a1(n,o,a.style),[l]:a1(l,o,a.style)})||tf(n,a[r])||tf(n,a.mark)||{[c]:C2({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}function Xne({channel:e,channelDef:t,channel2Def:n,markDef:i,config:r,scaleName:o,scale:s,stack:a,offset:u,defaultRef:l}){return ue(t)&&a&&e.charAt(0)===a.fieldChannel.charAt(0)?Yo(t,o,{suffix:"start"},{offset:u}):i2({channel:e,channelDef:n,scaleName:o,scale:s,stack:a,markDef:i,config:r,offset:u,defaultRef:l})}function tf(e,t){const n=un(e),i=ho(e);if(t[i]!==void 0)return{[i]:dl(e,t[i])};if(t[e]!==void 0)return{[i]:dl(e,t[e])};if(t[n]){const r=t[n];if(gs(r))q(PQ(n));else return{[n]:dl(e,r)}}}function wr(e,t){const{config:n,encoding:i,markDef:r}=e,o=r.type,s=Qi(t),a=un(t),u=i[t],l=i[s],c=e.getScaleComponent(t),f=c?c.get("type"):void 0,d=r.orient,h=i[a]??i.size??Ae("size",r,n,{vgChannel:a}),g=BD(t),p=o==="bar"&&(t==="x"?d==="vertical":d==="horizontal")||o==="tick"&&(t==="y"?d==="vertical":d==="horizontal");return B(u)&&(De(u.bin)||dt(u.bin)||u.timeUnit&&!l)&&!(h&&!gs(h))&&!i[g]&&!He(f)?Jne({fieldDef:u,fieldDef2:l,channel:t,model:e}):(ue(u)&&He(f)||p)&&!l?Kne(u,t,e):YN(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function Yne(e,t,n,i,r,o,s){if(gs(r))if(n){const u=n.get("type");if(u==="band"){let l=`bandwidth('${t}')`;r.band!==1&&(l=`${r.band} * ${l}`);const c=Bi("minBandSize",{type:s},i);return{signal:c?`max(${ni(c)}, ${l})`:l}}else r.band!==1&&q(XQ(u))}else return{mult:r.band,field:{group:e}};else{if(ee(r))return r;if(r)return{value:r}}if(n){const u=n.get("range");if(Rs(u)&&Ee(u.step))return{value:u.step-2}}if(!o){const{bandPaddingInner:u,barBandPaddingInner:l,rectBandPaddingInner:c,tickBandPaddingInner:f}=i.scale,d=Ye(u,s==="tick"?f:s==="bar"?l:c);if(ee(d))return{signal:`(1 - (${d.signal})) * ${e}`};if(Ee(d))return{signal:`${1-d} * ${e}`}}return{value:g1(i.view,e)-2}}function Kne(e,t,n){var F,I;const{markDef:i,encoding:r,config:o,stack:s}=n,a=i.orient,u=n.scaleName(t),l=n.getScaleComponent(t),c=un(t),f=Qi(t),d=BD(t),h=n.scaleName(d),g=n.getScaleComponent(_x(t)),p=i.type==="tick"||a==="horizontal"&&t==="y"||a==="vertical"&&t==="x";let m;(r.size||i.size)&&(p?m=pt("size",n,{vgChannel:c,defaultRef:Ne(i.size)}):q(QQ(i.type)));const y=!!m,b=PT({channel:t,fieldDef:e,markDef:i,config:o,scaleType:(F=l||g)==null?void 0:F.get("type"),useVlSizeChannel:p});m=m||{[c]:Yne(c,h||u,g||l,o,b,!!e,i.type)};const v=((I=l||g)==null?void 0:I.get("type"))==="band"&&gs(b)&&!y?"top":"middle",x=XN(t,i,o,v),w=x==="xc"||x==="yc",{offset:S,offsetType:E}=La({channel:t,markDef:i,encoding:r,model:n,bandPosition:w?.5:0}),A=(w&&E!=="encoding"&&B(e)&&e.timeUnit&&!r[f]?Er({fieldDef:e,markDef:i,config:o}):void 0)??(w?E==="encoding"?0:.5:ee(b)?{signal:`(1-${b})/2`}:gs(b)?(1-b.band)/2:0),C=i2({channel:t,channelDef:e,markDef:i,config:o,scaleName:u,scale:l,stack:s,offset:S,defaultRef:C2({model:n,defaultPos:"mid",channel:t,scaleName:u,scale:l}),bandPosition:A});if(c)return{[x]:C,...m};{const j=ho(f),O=m[c],k=S?{...O,offset:S}:O;return{[x]:C,[j]:T(C)?[C[0],{...C[1],offset:k}]:{...C,offset:k}}}}function uA(e,t,n,i,r,o,s){if(TD(e))return 0;const a=e==="x"||e==="y2",u=a?-t/2:t/2;if(ee(n)||ee(r)||ee(i)||o){const l=ni(n),c=ni(r),f=ni(i),d=ni(o),g=o?`(${s} < ${d} ? ${a?"":"-"}0.5 * (${d} - (${s})) : ${u})`:u,p=f?`${f} + `:"",m=l?`(${l} ? -1 : 1) * `:"",y=c?`(${c} + ${g})`:g;return{signal:p+m+y}}else return r=r||0,i+(n?-r-u:+r+u)}function Jne({fieldDef:e,fieldDef2:t,channel:n,model:i}){var C;const{config:r,markDef:o,encoding:s}=i,a=i.getScaleComponent(n),u=i.scaleName(n),l=a?a.get("type"):void 0,c=a.get("reverse"),f=PT({channel:n,fieldDef:e,markDef:o,config:r,scaleType:l}),d=(C=i.component.axes[n])==null?void 0:C[0],h=(d==null?void 0:d.get("translate"))??.5,g=Ke(n)?Ae("binSpacing",o,r)??0:0,p=Qi(n),m=ho(n),y=ho(p),b=Bi("minBandSize",o,r),{offset:v}=La({channel:n,markDef:o,encoding:s,model:i,bandPosition:0}),{offset:x}=La({channel:p,markDef:o,encoding:s,model:i,bandPosition:0}),w=Eee({fieldDef:e,scaleName:u}),S=uA(n,g,c,h,v,b,w),E=uA(p,g,c,h,x??v,b,w),$=ee(f)?{signal:`(1-${f.signal})/2`}:gs(f)?(1-f.band)/2:.5,A=Er({fieldDef:e,fieldDef2:t,markDef:o,config:r});if(De(e.bin)||e.timeUnit){const F=e.timeUnit&&A!==.5;return{[y]:lA({fieldDef:e,scaleName:u,bandPosition:$,offset:E,useRectOffsetField:F}),[m]:lA({fieldDef:e,scaleName:u,bandPosition:ee($)?{signal:`1-${$.signal}`}:1-$,offset:S,useRectOffsetField:F})}}else if(dt(e.bin)){const F=Yo(e,u,{},{offset:E});if(B(t))return{[y]:F,[m]:Yo(t,u,{},{offset:S})};if(Os(e.bin)&&e.bin.step)return{[y]:F,[m]:{signal:`scale("${u}", ${V(e,{expr:"datum"})} + ${e.bin.step})`,offset:S}}}q(sT(p))}function lA({fieldDef:e,scaleName:t,bandPosition:n,offset:i,useRectOffsetField:r}){return Gd({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:i,...r?{startSuffix:Tg,endSuffix:Ng}:{}})}const Qne=new Set(["aria","width","height"]);function Gn(e,t){const{fill:n=void 0,stroke:i=void 0}=t.color==="include"?VN(e):{};return{...Zne(e.markDef,t),...cA("fill",n),...cA("stroke",i),...pt("opacity",e),...pt("fillOpacity",e),...pt("strokeOpacity",e),...pt("strokeWidth",e),...pt("strokeDash",e),...qne(e),...WN(e),...A2(e,"href"),...Bne(e)}}function cA(e,t){return t?{[e]:t}:{}}function Zne(e,t){return aQ.reduce((n,i)=>(!Qne.has(i)&&U(e,i)&&t[i]!=="ignore"&&(n[i]=Ne(e[i])),n),{})}function F2(e){const{config:t,markDef:n}=e,i=new Set;if(e.forEachFieldDef((r,o)=>{var l;let s;if(!Zi(o)||!(s=e.getScaleType(o)))return;const a=pg(r.aggregate),u=n2({scaleChannel:o,markDef:n,config:t,scaleType:s,isCountAggregate:a});if(bee(u)){const c=e.vgField(o,{expr:"datum",binSuffix:(l=e.stack)!=null&&l.impute?"mid":void 0});c&&i.add(c)}}),i.size>0)return{defined:{signal:[...i].map(o=>vg(o,!0)).join(" && ")}}}function fA(e,t){if(t!==void 0)return{[e]:Ne(t)}}const nm="voronoi",KN={defined:e=>e.type==="point"&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(nm)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(ko(o))return q(gQ(o)),n;const s={name:e.getName(nm),type:"path",interactive:!0,aria:!1,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...WN(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let a=0,u=!1;return n.forEach((l,c)=>{const f=l.name??"";f===e.component.mark[0].name?a=c:f.includes(nm)&&(u=!0)}),u||n.splice(a+1,0,s),n}},JN={defined:e=>e.type==="point"&&e.resolve==="global"&&e.bind&&e.bind!=="scales"&&!y2(e.bind),parse:(e,t,n)=>o3(t,n),topLevelSignals:(e,t,n)=>{var u;const i=t.name,r=t.project,o=t.bind,s=(u=t.init)==null?void 0:u[0],a=KN.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return r.items.forEach((l,c)=>{const f=ze(`${i}_${l.field}`);n.filter(h=>h.name===f).length||n.unshift({name:f,...s?{init:ms(s[c])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${a}[${G(l.field)}] : null`}]:[],bind:o[l.field]??o[l.channel]??o})}),n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find(l=>l.name===i+Sr),s=i+kc,a=r.items.map(l=>ze(`${i}_${l.field}`)),u=a.map(l=>`${l} !== null`).join(" && ");return a.length&&(o.update=`${u} ? {fields: ${s}, values: [${a.join(", ")}]} : null`),delete o.value,delete o.on,n}},Qd="_toggle",QN={defined:e=>e.type==="point"&&!Ti(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+Qd,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Sr,i=t.name+Qd;return`${i} ? null : ${n}, ${t.resolve==="global"?`${i} ? null : true, `:`${i} ? null : {unit: ${Jo(e)}}, `}${i} ? ${n} : null`}},eie={defined:e=>e.clear!==void 0&&e.clear!==!1&&!Ti(e),parse:(e,t)=>{t.clear&&(t.clear=Y(t.clear)?vo(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(JN.defined(t))for(const i of t.project.items){const r=n.findIndex(o=>o.name===ze(`${t.name}_${i.field}`));r!==-1&&n[r].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(r,o){r!==-1&&n[r].on&&n[r].on.push({events:t.clear,update:o})}if(t.type==="interval")for(const r of t.project.items){const o=n.findIndex(s=>s.name===r.signals.visual);if(i(o,"[0, 0]"),o===-1){const s=n.findIndex(a=>a.name===r.signals.data);i(s,"null")}}else{let r=n.findIndex(o=>o.name===t.name+Sr);i(r,"null"),QN.defined(t)&&(r=n.findIndex(o=>o.name===t.name+Qd),i(r,"false"))}return n}},ZN={defined:e=>{const t=e.resolve==="global"&&e.bind&&y2(e.bind),n=e.project.items.length===1&&e.project.items[0].field!==di;return t&&!n&&q(bQ),t&&n},parse:(e,t,n)=>{const i=ae(n);if(i.select=Y(i.select)?{type:i.select,toggle:t.toggle}:{...i.select,toggle:t.toggle},o3(t,i),X(n.select)&&(n.select.on||n.select.clear)){const s='event.item && indexof(event.item.mark.role, "legend") < 0';for(const a of t.events)a.filter=K(a.filter??[]),a.filter.includes(s)||a.filter.push(s)}const r=Kp(t.bind)?t.bind.legend:"click",o=Y(r)?vo(r,"view"):K(r);t.bind={legend:{merge:o}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=Kp(t.bind)&&t.bind.legend,o=s=>a=>{const u=ae(a);return u.markname=s,u};for(const s of t.project.items){if(!s.hasLegend)continue;const a=`${ze(s.field)}_legend`,u=`${i}_${a}`;if(n.filter(c=>c.name===u).length===0){const c=r.merge.map(o(`${a}_symbols`)).concat(r.merge.map(o(`${a}_labels`))).concat(r.merge.map(o(`${a}_entries`)));n.unshift({name:u,...t.init?{}:{value:null},on:[{events:c,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find(d=>d.name===i+Sr),s=i+kc,a=r.items.filter(d=>d.hasLegend).map(d=>ze(`${i}_${ze(d.field)}_legend`)),l=`${a.map(d=>`${d} !== null`).join(" && ")} ? {fields: ${s}, values: [${a.join(", ")}]} : null`;t.events&&a.length>0?o.on.push({events:a.map(d=>({signal:d})),update:l}):a.length>0&&(o.update=l,delete o.value,delete o.on);const c=n.find(d=>d.name===i+Qd),f=Kp(t.bind)&&t.bind.legend;return c&&(t.events?c.on.push({...c.on[0],events:f}):c.on[0].events=f),n}};function tie(e,t,n){var r;const i=(r=e.fieldDef(t))==null?void 0:r.field;for(const o of Qe(e.component.selection??{})){const s=o.project.hasField[i]??o.project.hasChannel[t];if(s&&ZN.defined(o)){const a=n.get("selections")??[];a.push(o.name),n.set("selections",a,!1),s.hasLegend=!0}}}const e3="_translate_anchor",t3="_translate_delta",nie={defined:e=>e.type==="interval"&&e.translate,signals:(e,t,n)=>{const i=t.name,r=pr.defined(t),o=i+e3,{x:s,y:a}=t.project.hasChannel;let u=vo(t.translate,"scope");return r||(u=u.map(l=>(l.between[0].markname=i+la,l))),n.push({name:o,value:{},on:[{events:u.map(l=>l.between[0]),update:`{x: x(unit), y: y(unit)${s!==void 0?`, extent_x: ${r?v1(e,Le):`slice(${s.signals.visual})`}`:""}${a!==void 0?`, extent_y: ${r?v1(e,ot):`slice(${a.signals.visual})`}`:""}}`}]},{name:i+t3,value:{},on:[{events:u,update:`{x: ${o}.x - x(unit), y: ${o}.y - y(unit)}`}]}),s!==void 0&&dA(e,t,s,"width",n),a!==void 0&&dA(e,t,a,"height",n),n}};function dA(e,t,n,i,r){const o=t.name,s=o+e3,a=o+t3,u=n.channel,l=pr.defined(t),c=r.find(w=>w.name===n.signals[l?"data":"visual"]),f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(u),h=d==null?void 0:d.get("type"),g=d==null?void 0:d.get("reverse"),p=l?u===Le?g?"":"-":g?"-":"":"",m=`${s}.extent_${u}`,y=`${p}${a}.${u} / ${l?`${f}`:`span(${m})`}`,b=!l||!d?"panLinear":h==="log"?"panLog":h==="symlog"?"panSymlog":h==="pow"?"panPow":"panLinear",v=l?h==="pow"?`, ${d.get("exponent")??1}`:h==="symlog"?`, ${d.get("constant")??1}`:"":"",x=`${b}(${m}, ${y}${v})`;c.on.push({events:{signal:a},update:l?x:`clampRange(${x}, 0, ${f})`})}const n3="_zoom_anchor",i3="_zoom_delta",iie={defined:e=>e.type==="interval"&&e.zoom,signals:(e,t,n)=>{const i=t.name,r=pr.defined(t),o=i+i3,{x:s,y:a}=t.project.hasChannel,u=G(e.scaleName(Le)),l=G(e.scaleName(ot));let c=vo(t.zoom,"scope");return r||(c=c.map(f=>(f.markname=i+la,f))),n.push({name:i+n3,on:[{events:c,update:r?`{${[u?`x: invert(${u}, x(unit))`:"",l?`y: invert(${l}, y(unit))`:""].filter(f=>f).join(", ")}}`:"{x: x(unit), y: y(unit)}"}]},{name:o,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),s!==void 0&&hA(e,t,s,"width",n),a!==void 0&&hA(e,t,a,"height",n),n}};function hA(e,t,n,i,r){const o=t.name,s=n.channel,a=pr.defined(t),u=r.find(b=>b.name===n.signals[a?"data":"visual"]),l=e.getSizeSignalRef(i).signal,c=e.getScaleComponent(s),f=c==null?void 0:c.get("type"),d=a?v1(e,s):u.name,h=o+i3,g=`${o}${n3}.${s}`,p=!a||!c?"zoomLinear":f==="log"?"zoomLog":f==="symlog"?"zoomSymlog":f==="pow"?"zoomPow":"zoomLinear",m=a?f==="pow"?`, ${c.get("exponent")??1}`:f==="symlog"?`, ${c.get("constant")??1}`:"":"",y=`${p}(${d}, ${g}, ${h}${m})`;u.on.push({events:{signal:h},update:a?y:`clampRange(${y}, 0, ${l})`})}const ys="_store",Sr="_tuple",rie="_modify",r3="vlSelectionResolve",Lg=[One,Pne,Cne,QN,JN,pr,ZN,eie,nie,iie,KN];function oie(e){let t=e.parent;for(;t&&!wn(t);)t=t.parent;return t}function Jo(e,{escape:t}={escape:!0}){let n=t?G(e.name):e.name;const i=oie(e);if(i){const{facet:r}=i;for(const o of Dn)r[o]&&(n+=` + '__facet_${o}_' + (facet[${G(i.vgField(o))}])`)}return n}function _2(e){return Qe(e.component.selection??{}).reduce((t,n)=>t||n.project.hasSelectionId,!1)}function o3(e,t){(Y(t.select)||!t.select.on)&&delete e.events,(Y(t.select)||!t.select.clear)&&delete e.clear,(Y(t.select)||!t.select.toggle)&&delete e.toggle}function Ti(e){var t;return(t=e.events)==null?void 0:t.find(n=>"type"in n&&n.type==="timer")}function E1(e){const t=[];return e.type==="Identifier"?[e.name]:e.type==="Literal"?[e.value]:(e.type==="MemberExpression"&&(t.push(...E1(e.object)),t.push(...E1(e.property))),t)}function s3(e){return e.object.type==="MemberExpression"?s3(e.object):e.object.name==="datum"}function a3(e){const t=Hv(e),n=new Set;return t.visit(i=>{i.type==="MemberExpression"&&s3(i)&&n.add(E1(i).slice(1).join("."))}),n}class su extends _e{constructor(n,i,r){super(n);L(this,"model");L(this,"filter");L(this,"expr");L(this,"_dependentFields");this.model=i,this.filter=r,this.expr=Zd(this.model,this.filter,this),this._dependentFields=a3(this.expr)}clone(){return new su(null,this.model,ae(this.filter))}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function sie(e,t){const n={},i=e.config.selection;if(!t||!t.length)return n;let r=0;for(const o of t){const s=ze(o.name),a=o.select,u=Y(a)?a:a.type,l=X(a)?ae(a):{type:u},c=i[u];for(const h in c)h==="fields"||h==="encodings"||(h==="mark"&&(l.mark={...c.mark,...l.mark}),(l[h]===void 0||l[h]===!0)&&(l[h]=ae(c[h]??l[h])));const f=n[s]={...l,name:s,type:u,init:o.value,bind:o.bind,events:Y(l.on)?vo(l.on,"scope"):K(ae(l.on))};if(Ti(f)&&(r++,r>1)){delete n[s];continue}const d=ae(o);for(const h of Lg)h.defined(f)&&h.parse&&h.parse(e,f,d)}return r>1&&q($Q),n}function u3(e,t,n,i="datum"){const r=Y(t)?t:t.param,o=ze(r),s=G(o+ys);let a;try{a=e.getSelectionComponent(o,r)}catch{return`!!${o}`}if(a.project.timeUnit){const d=n??e.component.data.raw,h=a.project.timeUnit.clone();d.parent?h.insertAsParentOf(d):d.parent=h}const u=a.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest(",l=a.resolve==="global"?")":`, ${G(a.resolve)})`,c=`${u}${s}, ${i}${l}`,f=`length(data(${s}))`;return t.empty===!1?`${f} && ${c}`:`!${f} || ${c}`}function l3(e,t,n){const i=ze(t),r=n.encoding;let o=n.field,s;try{s=e.getSelectionComponent(i,t)}catch{return i}if(!r&&!o)o=s.project.items[0].field,s.project.items.length>1&&q(AQ(o));else if(r&&!o){const a=s.project.items.filter(u=>u.channel===r);!a.length||a.length>1?(o=s.project.items[0].field,q(kQ(a,r,n,o))):o=a[0].field}return`${s.name}[${G(Un(o))}]`}function aie(e,t){for(const[n,i]of fo(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new en(new su(t,e,{param:n}),r,Ue.Lookup,e.component.data.outputNodeRefCounts)}}function Zd(e,t,n){return fl(t,i=>Y(i)?i:LZ(i)?u3(e,i,n):bT(i))}function uie(e,t){if(e)return T(e)&&!Ur(e)?e.map(n=>l2(n,t)).join(", "):e}function im(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update[n]=i}function Ju(e,t,n,i={header:!1}){var f,d;const{disable:r,orient:o,scale:s,labelExpr:a,title:u,zindex:l,...c}=e.combine();if(!r){for(const h in c){const g=h,p=Bee[g],m=c[g];if(p&&p!==t&&p!=="both")delete c[g];else if(Ac(m)){const{condition:y,...b}=m,v=K(y),x=U$[g];if(x){const{vgProp:w,part:S}=x,E=[...v.map($=>{const{test:A,...C}=$;return{test:Zd(null,A),...C}}),b];im(c,S,w,E),delete c[g]}else if(x===null){const w={signal:v.map(S=>{const{test:E,...$}=S;return`${Zd(null,E)} ? ${A$($)} : `}).join("")+A$(b)};c[g]=w}}else if(ee(m)){const y=U$[g];if(y){const{vgProp:b,part:v}=y;im(c,v,b,m),delete c[g]}}pe(["labelAlign","labelBaseline"],g)&&c[g]===null&&delete c[g]}if(t==="grid"){if(!c.grid)return;if(c.encode){const{grid:h}=c.encode;c.encode={...h?{grid:h}:{}},Me(c.encode)&&delete c.encode}return{scale:s,orient:o,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:Ye(l,0)}}else{if(!i.header&&e.mainExtracted)return;if(a!==void 0){let g=a;(d=(f=c.encode)==null?void 0:f.labels)!=null&&d.update&&ee(c.encode.labels.update.text)&&(g=ls(a,"datum.label",c.encode.labels.update.text.signal)),im(c,"labels","text",{signal:g})}if(c.labelAlign===null&&delete c.labelAlign,c.encode){for(const g of XT)e.hasAxisPart(g)||delete c.encode[g];Me(c.encode)&&delete c.encode}const h=uie(u,n);return{scale:s,orient:o,grid:!1,...h?{title:h}:{},...c,...n.aria===!1?{aria:!1}:{},zindex:Ye(l,0)}}}}function c3(e){const{axes:t}=e.component,n=[];for(const i of Or)if(t[i]){for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const o=i==="x"?"height":"width",s=e.getSizeSignalRef(o).signal;o!==s&&n.push({name:o,update:s})}}return n}function lie(e,t){const{x:n=[],y:i=[]}=e;return[...n.map(r=>Ju(r,"grid",t)),...i.map(r=>Ju(r,"grid",t)),...n.map(r=>Ju(r,"main",t)),...i.map(r=>Ju(r,"main",t))].filter(r=>r)}function gA(e,t,n,i){return Object.assign.apply(null,[{},...e.map(r=>{if(r==="axisOrient"){const o=n==="x"?"bottom":"left",s=t[n==="x"?"axisBottom":"axisLeft"]||{},a=t[n==="x"?"axisTop":"axisRight"]||{},u=new Set([...z(s),...z(a)]),l={};for(const c of u.values())l[c]={signal:`${i.signal} === "${o}" ? ${ni(s[c])} : ${ni(a[c])}`};return l}return t[r]})])}function cie(e,t,n,i){const r=t==="band"?["axisDiscrete","axisBand"]:t==="point"?["axisDiscrete","axisPoint"]:ET(t)?["axisQuantitative"]:t==="time"||t==="utc"?["axisTemporal"]:[],o=e==="x"?"axisX":"axisY",s=ee(n)?"axisOrient":`axis${gc(n)}`,a=[...r,...r.map(l=>o+l.substr(4))],u=["axis",s,o];return{vlOnlyAxisConfig:gA(a,i,e,n),vgAxisConfig:gA(u,i,e,n),axisConfigStyle:fie([...u,...a],i)}}function fie(e,t){var i;const n=[{}];for(const r of e){let o=(i=t[r])==null?void 0:i.style;if(o){o=K(o);for(const s of o)n.push(t.style[s])}}return Object.assign.apply(null,n)}function w1(e,t,n,i={}){var o;const r=KD(e,n,t);if(r!==void 0)return{configFrom:"style",configValue:r};for(const s of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(((o=i[s])==null?void 0:o[e])!==void 0)return{configFrom:s,configValue:i[s][e]};return{}}const pA={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??die(n,e),gridScale:({model:e,channel:t})=>hie(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelAlign||d3(t,n,i),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:i})=>e.labelBaseline||f3(t,n,i),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??pie(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??mie(t.type,n,B(t)&&!!t.timeUnit,B(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:i,scaleType:r})=>{const o=e==="x"?"width":e==="y"?"height":void 0,s=o?t.getSizeSignalRef(o):void 0;return n.tickCount??bie({fieldOrDatumDef:i,scaleType:r,size:s,values:n.values})},tickMinStep:({axis:e,format:t,fieldOrDatumDef:n})=>e.tickMinStep??vie({format:t,fieldOrDatumDef:n}),title:({axis:e,model:t,channel:n})=>{if(e.title!==void 0)return e.title;const i=h3(t,n);if(i!==void 0)return i;const r=t.typedFieldDef(n),o=n==="x"?"x2":"y2",s=t.fieldDef(o);return QD(r?[z$(r)]:[],B(s)?[z$(s)]:[])},values:({axis:e,fieldOrDatumDef:t})=>xie(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??Eie(n,t)};function die(e,t){return!He(e)&&B(t)&&!De(t==null?void 0:t.bin)&&!dt(t==null?void 0:t.bin)}function hie(e,t){const n=t==="x"?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}function gie(e,t,n,i,r){const o=t==null?void 0:t.labelAngle;if(o!==void 0)return ee(o)?o:Dl(o);{const{configValue:s}=w1("labelAngle",i,t==null?void 0:t.style,r);return s!==void 0?Dl(s):n===Le&&pe([Jx,Kx],e.type)&&!(B(e)&&e.timeUnit)?270:void 0}}function S1(e){return`(((${e.signal} % 360) + 360) % 360)`}function f3(e,t,n,i){if(e!==void 0)if(n==="x"){if(ee(e)){const r=S1(e),o=ee(t)?`(${t.signal} === "top")`:t==="top";return{signal:`(45 < ${r} && ${r} < 135) || (225 < ${r} && ${r} < 315) ? "middle" :(${r} <= 45 || 315 <= ${r}) === ${o} ? "bottom" : "top"`}}if(45<e&&e<135||225<e&&e<315)return"middle";if(ee(t)){const r=e<=45||315<=e?"===":"!==";return{signal:`${t.signal} ${r} "top" ? "bottom" : "top"`}}return(e<=45||315<=e)==(t==="top")?"bottom":"top"}else{if(ee(e)){const r=S1(e),o=ee(t)?`(${t.signal} === "left")`:t==="left";return{signal:`${r} <= 45 || 315 <= ${r} || (135 <= ${r} && ${r} <= 225) ? ${i?'"middle"':"null"} : (45 <= ${r} && ${r} <= 135) === ${o} ? "top" : "bottom"`}}if(e<=45||315<=e||135<=e&&e<=225)return i?"middle":null;if(ee(t)){const r=45<=e&&e<=135?"===":"!==";return{signal:`${t.signal} ${r} "left" ? "top" : "bottom"`}}return(45<=e&&e<=135)==(t==="left")?"top":"bottom"}}function d3(e,t,n){if(e===void 0)return;const i=n==="x",r=i?0:90,o=i?"bottom":"left";if(ee(e)){const s=S1(e),a=ee(t)?`(${t.signal} === "${o}")`:t===o;return{signal:`(${r?`(${s} + 90)`:s} % 180 === 0) ? ${i?null:'"center"'} :(${r} < ${s} && ${s} < ${180+r}) === ${a} ? "left" : "right"`}}if((e+r)%180===0)return i?null:"center";if(ee(t)){const s=r<e&&e<180+r?"===":"!==";return{signal:`${`${t.signal} ${s} "${o}"`} ? "left" : "right"`}}return(r<e&&e<180+r)==(t===o)?"left":"right"}function pie(e,t){if(t==="x"&&pe(["quantitative","temporal"],e))return!0}function mie(e,t,n,i){if(n&&!X(i)||e!=="nominal"&&e!=="ordinal")return t==="log"||t==="symlog"?"greedy":!0}function yie(e){return e==="x"?"bottom":"left"}function bie({fieldOrDatumDef:e,scaleType:t,size:n,values:i}){var r;if(!i&&!He(t)&&t!=="log"){if(B(e)){if(De(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&pe(["month","hours","day","quarter"],(r=ft(e.timeUnit))==null?void 0:r.unit))return}return{signal:`ceil(${n.signal}/40)`}}}function vie({format:e,fieldOrDatumDef:t}){if(e==="d")return 1;if(B(t)){const{timeUnit:n}=t;if(n){const i=pT(n);if(i)return{signal:i}}}}function h3(e,t){const n=t==="x"?"x2":"y2",i=e.fieldDef(t),r=e.fieldDef(n),o=i?i.title:void 0,s=r?r.title:void 0;if(o&&s)return ZD(o,s);if(o)return o;if(s)return s;if(o!==void 0)return o;if(s!==void 0)return s}function xie(e,t){const n=e.values;if(T(n))return VT(t,n);if(ee(n))return n}function Eie(e,t){return e==="rect"&&Vd(t)?1:0}class Ia extends _e{constructor(n,i){super(n);L(this,"transform");L(this,"_dependentFields");this.transform=i,this._dependentFields=a3(this.transform.calculate)}clone(){return new Ia(null,ae(this.transform))}static parseAllForSortIndex(n,i){return i.forEachFieldDef((r,o)=>{if(Ts(r)&&IT(r.sort)){const{field:s,timeUnit:a}=r,u=r.sort,l=u.map((c,f)=>`${bT({field:s,timeUnit:a,equal:c})} ? ${f} : `).join("")+u.length;n=new Ia(n,{calculate:l,as:Pa(r,o,{forAs:!0})})}}),n}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${de(this.transform)}`}}function Pa(e,t,n){return V(e,{prefix:t,suffix:"sort_index",...n})}function Ig(e,t){return pe(["top","bottom"],t)?"column":pe(["left","right"],t)||e==="row"?"row":"column"}function za(e,t,n,i){const r=i==="row"?n.headerRow:i==="column"?n.headerColumn:n.headerFacet;return Ye((t||{})[e],r[e],n.header[e])}function Pg(e,t,n,i){const r={};for(const o of e){const s=za(o,t||{},n,i);s!==void 0&&(r[o]=s)}return r}const O2=["row","column"],R2=["header","footer"];function wie(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:s,titleOrient:a}=Pg(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),u=Ig(t,a),l=Dl(s);return{name:`${t}-title`,type:"group",role:`${u}-title`,title:{text:n,...t==="row"?{orient:"left"}:{},style:"guide-title",...p3(l,u),...g3(u,l,o),...m3(i,r,t,ute,dN)}}}function g3(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const i=d3(t,e==="row"?"left":"top",e==="row"?"y":"x");return i?{align:i}:{}}function p3(e,t){const n=f3(e,t==="row"?"left":"top",t==="row"?"y":"x",!0);return n?{baseline:n}:{}}function Sie(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of R2)if(n[r])for(const o of n[r]){const s=Aie(e,t,r,n,o);s!=null&&i.push(s)}return i}function $ie(e,t){const{sort:n}=e;return gr(n)?{field:V(n,{expr:"datum"}),order:n.order??"ascending"}:T(n)?{field:Pa(e,t,{expr:"datum"}),order:"ascending"}:{field:V(e,{expr:"datum"}),order:n??"ascending"}}function $1(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:s,labelOrient:a,labelExpr:u}=Pg(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),l=o2({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,c=Ig(t,a);return{text:{signal:u?ls(ls(u,"datum.label",l),"datum.value",V(e,{expr:"parent"})):l},...t==="row"?{orient:"left"}:{},style:"guide-label",frame:"group",...p3(o,c),...g3(c,o,s),...m3(n,e,t,lte,hN)}}function Aie(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:s}=i,a=e.config?e.config:void 0;if(s&&r.labels){const{labelOrient:f}=Pg(["labelOrient"],s.header,a,t);(t==="row"&&!pe(["top","bottom"],f)||t==="column"&&!pe(["left","right"],f))&&(o=$1(s,t,a))}const u=wn(e)&&!Ec(e.facet),l=r.axes,c=(l==null?void 0:l.length)>0;if(o||c){const f=t==="row"?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:$ie(s,t)}:{},...c&&u?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[f]:r.sizeSignal}}}:{},...c?{axes:l}:{}}}}return null}const kie={column:{start:0,end:1},row:{start:1,end:0}};function Cie(e,t){return kie[t][e]}function Fie(e,t){const n={};for(const i of Dn){const r=e[i];if(r!=null&&r.facetFieldDef){const{titleAnchor:o,titleOrient:s}=Pg(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=Ig(i,s),u=Cie(o,a);u!==void 0&&(n[a]=u)}}return Me(n)?void 0:n}function m3(e,t,n,i,r){const o={};for(const s of i){if(!r[s])continue;const a=za(s,t==null?void 0:t.header,e,n);a!==void 0&&(o[r[s]]=a)}return o}function M2(e){return[...nf(e,"width"),...nf(e,"height"),...nf(e,"childWidth"),...nf(e,"childHeight")]}function nf(e,t){const n=t==="width"?"x":"y",i=e.component.layoutSize.get(t);if(i==null||i==="merged")return[];const r=e.getSizeSignalRef(t).signal;if(i==="step"){const o=e.getScaleComponent(n);if(o){const s=o.get("type"),a=o.get("range");if(He(s)&&Rs(a)){const u=e.scaleName(n);return wn(e.parent)&&e.parent.component.resolve.scale[n]==="independent"?[mA(u,a)]:[mA(u,a),{name:r,update:y3(u,o,`domain('${u}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}else if(i=="container"){const o=r.endsWith("width"),s=o?"containerSize()[0]":"containerSize()[1]",a=h1(e.config.view,o?"width":"height"),u=`isFinite(${s}) ? ${s} : ${a}`;return[{name:r,init:u,on:[{update:u,events:"window:resize"}]}]}else return[{name:r,value:i}]}function mA(e,t){const n=`${e}_step`;return ee(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function y3(e,t,n){const i=t.get("type"),r=t.get("padding"),o=Ye(t.get("paddingOuter"),r);let s=t.get("paddingInner");return s=i==="band"?s!==void 0?s:r:1,`bandspace(${n}, ${ni(s)}, ${ni(o)}) * ${e}_step`}function b3(e){return e==="childWidth"?"width":e==="childHeight"?"height":e}function v3(e,t){return z(e).reduce((n,i)=>({...n,...ou({model:t,channelDef:e[i],vgChannel:i,mainRefFn:r=>Ne(r.value),invalidValueRef:void 0})}),{})}function x3(e,t){if(wn(t))return e==="theta"?"independent":"shared";if(lu(t))return"shared";if(z2(t))return Ke(e)||e==="theta"||e==="radius"?"independent":"shared";throw new Error("invalid model type for resolve")}function D2(e,t){const n=e.scale[t],i=Ke(t)?"axis":"legend";return n==="independent"?(e[i][t]==="shared"&&q(iZ(t)),"independent"):e[i][t]||"shared"}const _ie={...dte,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},E3=z(_ie);class Oie extends Mr{}const yA={symbols:Rie,gradient:Mie,labels:Die,entries:Tie};function Rie(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r,legendType:o}){if(o!=="symbol")return;const{markDef:s,encoding:a,config:u,mark:l}=n,c=s.filled&&l!=="trail";let f={...fQ({},n,uee),...VN(n,{filled:c})};const d=r.get("symbolOpacity")??u.legend.symbolOpacity,h=r.get("symbolFillColor")??u.legend.symbolFillColor,g=r.get("symbolStrokeColor")??u.legend.symbolStrokeColor,p=d===void 0?w3(a.opacity)??s.opacity:void 0;if(f.fill){if(i==="fill"||c&&i===sn)delete f.fill;else if(U(f.fill,"field"))h?delete f.fill:(f.fill=Ne(u.legend.symbolBaseFillColor??"black"),f.fillOpacity=Ne(p??1));else if(T(f.fill)){const m=A1(a.fill??a.color)??s.fill??(c&&s.color);m&&(f.fill=Ne(m))}}if(f.stroke){if(i==="stroke"||!c&&i===sn)delete f.stroke;else if(U(f.stroke,"field")||g)delete f.stroke;else if(T(f.stroke)){const m=Ye(A1(a.stroke||a.color),s.stroke,c?s.color:void 0);m&&(f.stroke={value:m})}}if(i!==_r){const m=B(t)&&$3(n,r,t);m?f.opacity=[{test:m,...Ne(p??1)},Ne(u.legend.unselectedOpacity)]:p&&(f.opacity=Ne(p))}return f={...f,...e},Me(f)?void 0:f}function Mie(e,{model:t,legendType:n,legendCmpt:i}){if(n!=="gradient")return;const{config:r,markDef:o,encoding:s}=t;let a={};const l=(i.get("gradientOpacity")??r.legend.gradientOpacity)===void 0?w3(s.opacity)||o.opacity:void 0;return l&&(a.opacity=Ne(l)),a={...a,...e},Me(a)?void 0:a}function Die(e,{fieldOrDatumDef:t,model:n,channel:i,legendCmpt:r}){const o=n.legend(i)||{},s=n.config,a=B(t)?$3(n,r,t):void 0,u=a?[{test:a,value:1},{value:s.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=o;let f;ps(c)?f=ii({fieldOrDatumDef:t,field:"datum.value",format:l,formatType:c,config:s}):l===void 0&&c===void 0&&s.customFormatTypes&&(t.type==="quantitative"&&s.numberFormatType?f=ii({fieldOrDatumDef:t,field:"datum.value",format:s.numberFormat,formatType:s.numberFormatType,config:s}):t.type==="temporal"&&s.timeFormatType&&B(t)&&t.timeUnit===void 0&&(f=ii({fieldOrDatumDef:t,field:"datum.value",format:s.timeFormat,formatType:s.timeFormatType,config:s})));const d={...u?{opacity:u}:{},...f?{text:f}:{},...e};return Me(d)?void 0:d}function Tie(e,{legendCmpt:t}){const n=t.get("selections");return n!=null&&n.length?{...e,fill:{value:"transparent"}}:e}function w3(e){return S3(e,(t,n)=>Math.max(t,n.value))}function A1(e){return S3(e,(t,n)=>Ye(t,n.value))}function S3(e,t){if(Fee(e))return K(e.condition).reduce(t,e.value);if(ci(e))return e.value}function $3(e,t,n){const i=t.get("selections");if(!(i!=null&&i.length))return;const r=G(n.field);return i.map(o=>`(!length(data(${G(ze(o)+ys)})) || (${o}[${r}] && indexof(${o}[${r}], datum.value) >= 0))`).join(" || ")}const bA={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:i,formatType:r}=t;return TT(e,e.type,i,r,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:i}=e;return NT(i,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??Uie(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??jie(n),symbolType:({legend:e,markDef:t,channel:n,encoding:i})=>e.symbolType??Lie(t.type,n,i.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>ua(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(aa(n)&&Ri(t)){if(e==="gradient")return}else if(e==="symbol")return;return e},values:({fieldOrDatumDef:e,legend:t})=>Nie(t,e)};function Nie(e,t){const n=e.values;if(T(n))return VT(t,n);if(ee(n))return n}function Lie(e,t,n,i){if(t!=="shape"){const r=A1(n)??i;if(r)return r}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}function Iie(e){const{legend:t}=e;return Ye(t.type,Pie(e))}function Pie({channel:e,timeUnit:t,scaleType:n}){if(aa(e)){if(pe(["quarter","month","day"],t))return"symbol";if(Ri(n))return"gradient"}return"symbol"}function zie({legendConfig:e,legendType:t,orient:n,legend:i}){return i.direction??e[t?"gradientDirection":"symbolDirection"]??Bie(n,t)}function Bie(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return t==="gradient"?"horizontal":void 0}}function Uie({legendConfig:e,model:t,direction:n,orient:i,scaleType:r}){const{gradientHorizontalMaxLength:o,gradientHorizontalMinLength:s,gradientVerticalMaxLength:a,gradientVerticalMinLength:u}=e;if(Ri(r))return n==="horizontal"?i==="top"||i==="bottom"?vA(t,"width",s,o):s:vA(t,"height",u,a)}function vA(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function jie(e){if(pe(["quantile","threshold","log","symlog"],e))return"greedy"}function A3(e){const t=Pe(e)?qie(e):Vie(e);return e.component.legends=t,t}function qie(e){const{encoding:t}=e,n={};for(const i of[sn,...pN]){const r=it(t[i]);!r||!e.getScaleComponent(i)||i===an&&B(r)&&r.type===ru||(n[i]=Hie(e,i))}return n}function Wie(e,t){const n=e.scaleName(t);if(e.mark==="trail"){if(t==="color")return{stroke:n};if(t==="size")return{strokeWidth:n}}return t==="color"?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}function Gie(e,t,n,i){switch(t){case"disable":return n!==void 0;case"values":return!!(n!=null&&n.values);case"title":if(t==="title"&&e===(i==null?void 0:i.title))return!0}return e===(n||{})[t]}function Hie(e,t){var x;let n=e.legend(t);const{markDef:i,encoding:r,config:o}=e,s=o.legend,a=new Oie({},Wie(e,t));tie(e,t,a);const u=n!==void 0?!n:s.disable;if(a.set("disable",u,n!==void 0),u)return a;n=n||{};const l=e.getScaleComponent(t).get("type"),c=it(r[t]),f=B(c)?(x=ft(c.timeUnit))==null?void 0:x.unit:void 0,d=n.orient||o.legend.orient||"right",h=Iie({legend:n,channel:t,timeUnit:f,scaleType:l}),g=zie({legend:n,legendType:h,orient:d,legendConfig:s}),p={legend:n,channel:t,model:e,markDef:i,encoding:r,fieldOrDatumDef:c,legendConfig:s,config:o,scaleType:l,orient:d,legendType:h,direction:g};for(const w of E3){if(h==="gradient"&&w.startsWith("symbol")||h==="symbol"&&w.startsWith("gradient"))continue;const S=w in bA?bA[w](p):n[w];if(S!==void 0){const E=Gie(S,w,n,e.fieldDef(t));(E||o.legend[w]===void 0)&&a.set(w,S,E)}}const m=(n==null?void 0:n.encoding)??{},y=a.get("selections"),b={},v={fieldOrDatumDef:c,model:e,channel:t,legendCmpt:a,legendType:h};for(const w of["labels","legend","title","symbols","gradient","entries"]){const S=v3(m[w]??{},e),E=w in yA?yA[w](S,v):S;E!==void 0&&!Me(E)&&(b[w]={...y!=null&&y.length&&B(c)?{name:`${ze(c.field)}_legend_${w}`}:{},...y!=null&&y.length?{interactive:!0}:{},update:y!=null&&y.length?{...E,cursor:{value:"pointer"}}:E})}return Me(b)||a.set("encode",b,!!(n!=null&&n.encoding)),a}function Vie(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){A3(i);for(const r of z(i.component.legends))n.legend[r]=D2(e.component.resolve,r),n.legend[r]==="shared"&&(t[r]=k3(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of z(t))for(const r of e.children)r.component.legends[i]&&n.legend[i]==="shared"&&delete r.component.legends[i];return t}function k3(e,t){var o,s,a,u;if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let r=!1;for(const l of E3){const c=go(e.getWithExplicit(l),t.getWithExplicit(l),l,"legend",(f,d)=>{switch(l){case"symbolType":return Xie(f,d);case"title":return eT(f,d);case"type":return r=!0,fn("symbol")}return Dg(f,d,l,"legend")});e.setWithExplicit(l,c)}return r&&((s=(o=e.implicit)==null?void 0:o.encode)!=null&&s.gradient&&jd(e.implicit,["encode","gradient"]),(u=(a=e.explicit)==null?void 0:a.encode)!=null&&u.gradient&&jd(e.explicit,["encode","gradient"])),e}function Xie(e,t){return t.value==="circle"?t:e}function Yie(e,t,n,i){if($c(t,n)){const r=Pe(e)?e.axis(n)??e.legend(n)??{}:{},o=V(t,{expr:"datum"}),s=V(t,{expr:"datum",binSuffix:"end"});return{formulaAs:V(t,{binSuffix:"range",forAs:!0}),formula:xc(o,s,r.format,r.formatType,i)}}return{}}function C3(e,t){return`${GD(e)}_${t}`}function Kie(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}function T2(e,t,n){const i=Cg(n,void 0)??{},r=C3(i,t);return e.getName(`${r}_bins`)}function Jie(e){return"as"in e}function xA(e,t,n){let i,r;Jie(e)?i=Y(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:i=[V(e,{forAs:!0}),V(e,{binSuffix:"end",forAs:!0})];const o={...Cg(t,void 0)},s=C3(o,e.field),{signal:a,extentSignal:u}=Kie(n,s);if(mg(o.extent)){const c=o.extent;r=l3(n,c.param,c),delete o.extent}const l={bin:o,field:e.field,as:[i],...a?{signal:a}:{},...u?{extentSignal:u}:{},...r?{span:r}:{}};return{key:s,binComponent:l}}class Ni extends _e{constructor(n,i){super(n);L(this,"bins");this.bins=i}clone(){return new Ni(null,ae(this.bins))}static makeFromEncoding(n,i){const r=i.reduceFieldDef((o,s,a)=>{if(Vt(s)&&De(s.bin)){const{key:u,binComponent:l}=xA(s,s.bin,i);o[u]={...l,...o[u],...Yie(i,s,a,i.config)}}return o},{});return Me(r)?null:new Ni(n,r)}static makeFromTransform(n,i,r){const{key:o,binComponent:s}=xA(i,i.bin,r);return new Ni(n,{[o]:s})}merge(n,i){for(const r of z(n.bins))r in this.bins?(i(n.bins[r].signal,this.bins[r].signal),this.bins[r].as=mn([...this.bins[r].as,...n.bins[r].as],de)):this.bins[r]=n.bins[r];for(const r of n.children)n.removeChild(r),r.parent=this;n.remove()}producedFields(){return new Set(Qe(this.bins).map(n=>n.as).flat(2))}dependentFields(){return new Set(Qe(this.bins).map(n=>n.field))}hash(){return`Bin ${de(this.bins)}`}assemble(){return Qe(this.bins).flatMap(n=>{const i=[],[r,...o]=n.as,{extent:s,...a}=n.bin,u={type:"bin",field:Un(n.field),as:r,signal:n.signal,...mg(s)?{extent:null}:{extent:s},...n.span?{span:{signal:`span(${n.span})`}}:{},...a};!s&&n.extentSignal&&(i.push({type:"extent",field:Un(n.field),signal:n.extentSignal}),u.extent={signal:n.extentSignal}),i.push(u);for(const l of o)for(let c=0;c<2;c++)i.push({type:"formula",expr:V({field:r[c]},{expr:"datum"}),as:l[c]});return n.formula&&i.push({type:"formula",expr:n.formula,as:n.formulaAs}),i})}}function Qie(e,t,n,i){var o;const r=Pe(i)?i.encoding[Qi(t)]:void 0;if(Vt(n)&&Pe(i)&&zT(n,r,i.markDef,i.config)){e.add(V(n,{})),e.add(V(n,{suffix:"end"}));const{mark:s,markDef:a,config:u}=i,l=Er({fieldDef:n,markDef:a,config:u});Tl(s)&&l!==.5&&Ke(t)&&(e.add(V(n,{suffix:Tg})),e.add(V(n,{suffix:Ng}))),n.bin&&$c(n,t)&&e.add(V(n,{binSuffix:"range"}))}else if(LD(t)){const s=ND(t);e.add(i.getName(s))}else e.add(V(n));return Ts(n)&&YZ((o=n.scale)==null?void 0:o.range)&&e.add(n.scale.range.field),e}function Zie(e,t){for(const n of z(t)){const i=t[n];for(const r of z(i))n in e?e[n][r]=new Set([...e[n][r]??[],...i[r]]):e[n]={[r]:i[r]}}}class oi extends _e{constructor(n,i,r){super(n);L(this,"dimensions");L(this,"measures");this.dimensions=i,this.measures=r}clone(){return new oi(null,new Set(this.dimensions),ae(this.measures))}get groupBy(){return this.dimensions}static makeFromEncoding(n,i){let r=!1;i.forEachFieldDef(a=>{a.aggregate&&(r=!0)});const o={},s=new Set;return!r||(i.forEachFieldDef((a,u)=>{const{aggregate:l,field:c}=a;if(l)if(l==="count")o["*"]??(o["*"]={}),o["*"].count=new Set([V(a,{forAs:!0})]);else{if(xr(l)||Ao(l)){const f=xr(l)?"argmin":"argmax",d=l[f];o[d]??(o[d]={}),o[d][f]=new Set([V({op:f,field:d},{forAs:!0})])}else o[c]??(o[c]={}),o[c][l]=new Set([V(a,{forAs:!0})]);Zi(u)&&i.scaleDomain(u)==="unaggregated"&&(o[c]??(o[c]={}),o[c].min=new Set([V({field:c,aggregate:"min"},{forAs:!0})]),o[c].max=new Set([V({field:c,aggregate:"max"},{forAs:!0})]))}else Qie(s,u,a,i)}),s.size+z(o).length===0)?null:new oi(n,s,o)}static makeFromTransform(n,i){var s;const r=new Set,o={};for(const a of i.aggregate){const{op:u,field:l,as:c}=a;u&&(u==="count"?(o["*"]??(o["*"]={}),o["*"].count=new Set([c||V(a,{forAs:!0})])):(o[l]??(o[l]={}),(s=o[l])[u]??(s[u]=new Set),o[l][u].add(c||V(a,{forAs:!0}))))}for(const a of i.groupby??[])r.add(a);return r.size+z(o).length===0?null:new oi(n,r,o)}merge(n){return kD(this.dimensions,n.dimensions)?(Zie(this.measures,n.measures),!0):(xZ("different dimensions, cannot merge"),!1)}addDimensions(n){n.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...z(this.measures)])}producedFields(){const n=new Set;for(const i of z(this.measures))for(const r of z(this.measures[i])){const o=this.measures[i][r];o.size===0?n.add(`${r}_${i}`):o.forEach(n.add,n)}return n}hash(){return`Aggregate ${de({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const n=[],i=[],r=[];for(const s of z(this.measures))for(const a of z(this.measures[s]))for(const u of this.measures[s][a])r.push(u),n.push(a),i.push(s==="*"?null:Un(s));return{type:"aggregate",groupby:[...this.dimensions].map(Un),ops:n,fields:i,as:r}}}class au extends _e{constructor(n,i,r,o){super(n);L(this,"model");L(this,"name");L(this,"data");L(this,"column");L(this,"row");L(this,"facet");L(this,"childModel");this.model=i,this.name=r,this.data=o;for(const s of Dn){const a=i.facet[s];if(a){const{bin:u,sort:l}=a;this[s]={name:i.getName(`${s}_domain`),fields:[V(a),...De(u)?[V(a,{binSuffix:"end"})]:[]],...gr(l)?{sortField:l}:T(l)?{sortIndexField:Pa(a,s)}:{}}}}this.childModel=i.child}hash(){let n="Facet";for(const i of Dn)this[i]&&(n+=` ${i.charAt(0)}:${de(this[i])}`);return n}get fields(){var i;const n=[];for(const r of Dn)(i=this[r])!=null&&i.fields&&n.push(...this[r].fields);return n}dependentFields(){const n=new Set(this.fields);for(const i of Dn)this[i]&&(this[i].sortField&&n.add(this[i].sortField.field),this[i].sortIndexField&&n.add(this[i].sortIndexField));return n}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const n={};for(const i of Or){const r=this.childModel.component.scales[i];if(r&&!r.merged){const o=r.get("type"),s=r.get("range");if(He(o)&&Rs(s)){const a=vs(this.childModel,i),u=P2(a);u?n[i]=u:q(Lx(i))}}}return n}assembleRowColumnHeaderData(n,i,r){const o={row:"y",column:"x",facet:void 0}[n],s=[],a=[],u=[];o&&r&&r[o]&&(i?(s.push(`distinct_${r[o]}`),a.push("max")):(s.push(r[o]),a.push("distinct")),u.push(`distinct_${r[o]}`));const{sortField:l,sortIndexField:c}=this[n];if(l){const{op:f=$g,field:d}=l;s.push(d),a.push(f),u.push(V(l,{forAs:!0}))}else c&&(s.push(c),a.push("max"),u.push(c));return{name:this[n].name,source:i??this.data,transform:[{type:"aggregate",groupby:this[n].fields,...s.length?{fields:s,ops:a,as:u}:{}}]}}assembleFacetHeaderData(n){var l,c;const{columns:i}=this.model.layout,{layoutHeaders:r}=this.model.component,o=[],s={};for(const f of O2){for(const d of R2){const h=((l=r[f])==null?void 0:l[d])??[];for(const g of h)if(((c=g.axes)==null?void 0:c.length)>0){s[f]=!0;break}}if(s[f]){const d=`length(data("${this.facet.name}"))`,h=f==="row"?i?{signal:`ceil(${d} / ${i})`}:1:i?{signal:`min(${d}, ${i})`}:{signal:d};o.push({name:`${this.facet.name}_${f}`,transform:[{type:"sequence",start:0,stop:h}]})}}const{row:a,column:u}=s;return(a||u)&&o.unshift(this.assembleRowColumnHeaderData("facet",null,n)),o}assemble(){const n=[];let i=null;const r=this.getChildIndependentFieldsWithStep(),{column:o,row:s,facet:a}=this;if(o&&s&&(r.x||r.y)){i=`cross_${this.column.name}_${this.row.name}`;const u=[].concat(r.x??[],r.y??[]),l=u.map(()=>"distinct");n.push({name:i,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:u,ops:l}]})}for(const u of[hr,dr])this[u]&&n.push(this.assembleRowColumnHeaderData(u,i,r));if(a){const u=this.assembleFacetHeaderData(r);u&&n.push(...u)}return n}}function EA(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function ere(e,t){const n=Ax(e);if(t==="number")return`toNumber(${n})`;if(t==="boolean")return`toBoolean(${n})`;if(t==="string")return`toString(${n})`;if(t==="date")return`toDate(${n})`;if(t==="flatten")return n;if(t.startsWith("date:")){const i=EA(t.slice(5,t.length));return`timeParse(${n},'${i}')`}else if(t.startsWith("utc:")){const i=EA(t.slice(4,t.length));return`utcParse(${n},'${i}')`}else return q(FQ(t)),null}function tre(e){const t={};return If(e.filter,n=>{if(yT(n)){let i=null;jx(n)?i=gn(n.equal):Wx(n)?i=gn(n.lte):qx(n)?i=gn(n.lt):Gx(n)?i=gn(n.gt):Hx(n)?i=gn(n.gte):Vx(n)?i=n.range[0]:Xx(n)&&(i=(n.oneOf??n.in)[0]),i&&(Ms(i)?t[n.field]="date":Ee(i)?t[n.field]="number":Y(i)&&(t[n.field]="string")),n.timeUnit&&(t[n.field]="date")}}),t}function nre(e){const t={};function n(i){Ta(i)?t[i.field]="date":i.type==="quantitative"&&nQ(i.aggregate)?t[i.field]="number":Ca(i.field)>1?i.field in t||(t[i.field]="flatten"):Ts(i)&&gr(i.sort)&&Ca(i.sort.field)>1&&(i.sort.field in t||(t[i.sort.field]="flatten"))}if((Pe(e)||wn(e))&&e.forEachFieldDef((i,r)=>{if(Vt(i))n(i);else{const o=_s(r),s=e.fieldDef(o);n({...i,type:s.type})}}),Pe(e)){const{mark:i,markDef:r,encoding:o}=e;if(ko(i)&&!e.encoding.order){const s=r.orient==="horizontal"?"y":"x",a=o[s];B(a)&&a.type==="quantitative"&&!(a.field in t)&&(t[a.field]="number")}}return t}function ire(e){const t={};if(Pe(e)&&e.component.selection)for(const n of z(e.component.selection)){const i=e.component.selection[n];for(const r of i.project.items)!r.channel&&Ca(r.field)>1&&(t[r.field]="flatten")}return t}class kt extends _e{constructor(n,i){super(n);L(this,"_parse");this._parse=i}clone(){return new kt(null,ae(this._parse))}hash(){return`Parse ${de(this._parse)}`}static makeExplicit(n,i,r){var a;let o={};const s=i.data;return!ro(s)&&((a=s==null?void 0:s.format)!=null&&a.parse)&&(o=s.format.parse),this.makeWithAncestors(n,o,{},r)}static makeWithAncestors(n,i,r,o){for(const u of z(r)){const l=o.getWithExplicit(u);l.value!==void 0&&(l.explicit||l.value===r[u]||l.value==="derived"||r[u]==="flatten"?delete r[u]:q(R$(u,r[u],l.value)))}for(const u of z(i)){const l=o.get(u);l!==void 0&&(l===i[u]?delete i[u]:q(R$(u,i[u],l)))}const s=new Mr(i,r);o.copyAll(s);const a={};for(const u of z(s.combine())){const l=s.get(u);l!==null&&(a[u]=l)}return z(a).length===0||o.parseNothing?null:new kt(n,a)}get parse(){return this._parse}merge(n){this._parse={...this._parse,...n.parse},n.remove()}assembleFormatParse(){const n={};for(const i of z(this._parse)){const r=this._parse[i];Ca(i)===1&&(n[i]=r)}return n}producedFields(){return new Set(z(this._parse))}dependentFields(){return new Set(z(this._parse))}assembleTransforms(n=!1){return z(this._parse).filter(i=>n?Ca(i)>1:!0).map(i=>{const r=ere(i,this._parse[i]);return r?{type:"formula",expr:r,as:nu(i)}:null}).filter(i=>i!==null)}}class po extends _e{clone(){return new po(null)}constructor(t){super(t)}dependentFields(){return new Set}producedFields(){return new Set([di])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:di}}}class Cc extends _e{constructor(n,i){super(n);L(this,"params");this.params=i}clone(){return new Cc(null,this.params)}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${de(this.params)}`}assemble(){return{type:"graticule",...this.params===!0?{}:this.params}}}class Fc extends _e{constructor(n,i){super(n);L(this,"params");this.params=i}clone(){return new Fc(null,this.params)}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${de(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class bs extends _e{constructor(n){super(null);L(this,"_data");L(this,"_name");L(this,"_generator");n??(n={name:"source"});let i;if(ro(n)||(i=n.format?{...En(n.format,["parse"])}:{}),Nl(n))this._data={values:n.values};else if(Na(n)){if(this._data={url:n.url},!i.type){let r=/(?:\.([^.]+))?$/.exec(n.url)[1];pe(["json","csv","tsv","dsv","topojson"],r)||(r="json"),i.type=r}}else TN(n)?this._data={values:[{type:"Sphere"}]}:(MN(n)||ro(n))&&(this._data={});this._generator=ro(n),n.name&&(this._name=n.name),i&&!Me(i)&&(this._data.format=i)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(n){this._name=n}set parent(n){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}function N2(e){return e instanceof bs||e instanceof Cc||e instanceof Fc}var fa;class L2{constructor(){uE(this,fa,void 0);Qg(this,fa,!1)}setModified(){Qg(this,fa,!0)}get modifiedFlag(){return aE(this,fa)}}fa=new WeakMap;class Ns extends L2{getNodeDepths(t,n,i){i.set(t,n);for(const r of t.children)this.getNodeDepths(r,n+1,i);return i}optimize(t){const i=[...this.getNodeDepths(t,0,new Map).entries()].sort((r,o)=>o[1]-r[1]);for(const r of i)this.run(r[0]);return this.modifiedFlag}}class I2 extends L2{optimize(t){this.run(t);for(const n of t.children)this.optimize(n);return this.modifiedFlag}}class rre extends I2{mergeNodes(t,n){const i=n.shift();for(const r of n)t.removeChild(r),r.parent=i,r.remove()}run(t){const n=t.children.map(r=>r.hash()),i={};for(let r=0;r<n.length;r++)i[n[r]]===void 0?i[n[r]]=[t.children[r]]:i[n[r]].push(t.children[r]);for(const r of z(i))i[r].length>1&&(this.setModified(),this.mergeNodes(t,i[r]))}}class ore extends I2{constructor(n){super();L(this,"requiresSelectionId");this.requiresSelectionId=n&&_2(n)}run(n){n instanceof po&&(this.requiresSelectionId&&(N2(n.parent)||n.parent instanceof oi||n.parent instanceof kt)||(this.setModified(),n.remove()))}}class sre extends L2{optimize(t){return this.run(t,new Set),this.modifiedFlag}run(t,n){let i=new Set;t instanceof Di&&(i=t.producedFields(),Sx(i,n)&&(this.setModified(),t.removeFormulas(n),t.producedFields.length===0&&t.remove()));for(const r of t.children)this.run(r,new Set([...n,...i]))}}class are extends I2{constructor(){super()}run(t){t instanceof en&&!t.isRequired()&&(this.setModified(),t.remove())}}class ure extends Ns{run(t){if(!N2(t)&&!(t.numChildren()>1)){for(const n of t.children)if(n instanceof kt)if(t instanceof kt)this.setModified(),t.merge(n);else{if($x(t.producedFields(),n.dependentFields()))continue;this.setModified(),n.swapWithParent()}}}}class lre extends Ns{run(t){const n=[...t.children],i=t.children.filter(r=>r instanceof kt);if(t.numChildren()>1&&i.length>=1){const r={},o=new Set;for(const s of i){const a=s.parse;for(const u of z(a))u in r?r[u]!==a[u]&&o.add(u):r[u]=a[u]}for(const s of o)delete r[s];if(!Me(r)){this.setModified();const s=new kt(t,r);for(const a of n){if(a instanceof kt)for(const u of z(r))delete a.parse[u];t.removeChild(a),a.parent=s,a instanceof kt&&z(a.parse).length===0&&a.remove()}}}}}class cre extends Ns{run(t){t instanceof en||t.numChildren()>0||t instanceof au||t instanceof bs||(this.setModified(),t.remove())}}class fre extends Ns{run(t){const n=t.children.filter(r=>r instanceof Di),i=n.pop();for(const r of n)this.setModified(),i.merge(r)}}class dre extends Ns{run(t){const n=t.children.filter(r=>r instanceof oi),i={};for(const r of n){const o=de(r.groupBy);o in i||(i[o]=[]),i[o].push(r)}for(const r of z(i)){const o=i[r];if(o.length>1){const s=o.pop();for(const a of o)s.merge(a)&&(t.removeChild(a),a.parent=s,a.remove(),this.setModified())}}}}class hre extends Ns{constructor(n){super();L(this,"model");this.model=n}run(n){const i=!(N2(n)||n instanceof su||n instanceof kt||n instanceof po),r=[],o=[];for(const s of n.children)s instanceof Ni&&(i&&!$x(n.producedFields(),s.dependentFields())?r.push(s):o.push(s));if(r.length>0){const s=r.pop();for(const a of r)s.merge(a,this.model.renameSignal.bind(this.model));this.setModified(),n instanceof Ni?n.merge(s,this.model.renameSignal.bind(this.model)):s.swapWithParent()}if(o.length>1){const s=o.pop();for(const a of o)s.merge(a,this.model.renameSignal.bind(this.model));this.setModified()}}}class gre extends Ns{run(t){const n=[...t.children];if(!Aa(n,s=>s instanceof en)||t.numChildren()<=1)return;const r=[];let o;for(const s of n)if(s instanceof en){let a=s;for(;a.numChildren()===1;){const[u]=a.children;if(u instanceof en)a=u;else break}r.push(...a.children),o?(t.removeChild(s),s.parent=o.parent,o.parent.removeChild(o),o.parent=a,this.setModified()):o=a}else r.push(s);if(r.length){this.setModified();for(const s of r)s.parent.removeChild(s),s.parent=o}}}class Ls extends _e{constructor(n,i){super(n);L(this,"transform");this.transform=i}clone(){return new Ls(null,ae(this.transform))}addDimensions(n){this.transform.groupby=mn(this.transform.groupby.concat(n),i=>i)}dependentFields(){const n=new Set;return this.transform.groupby&&this.transform.groupby.forEach(n.add,n),this.transform.joinaggregate.map(i=>i.field).filter(i=>i!==void 0).forEach(n.add,n),n}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(n){return n.as??V(n)}hash(){return`JoinAggregateTransform ${de(this.transform)}`}assemble(){const n=[],i=[],r=[];for(const s of this.transform.joinaggregate)i.push(s.op),r.push(this.getDefaultName(s)),n.push(s.field===void 0?null:s.field);const o=this.transform.groupby;return{type:"joinaggregate",as:r,ops:i,fields:n,...o!==void 0?{groupby:o}:{}}}}class Ba extends _e{constructor(n,i){super(n);L(this,"filter");this.filter=i}clone(){return new Ba(null,{...this.filter})}static make(n,i,r){const{config:o,markDef:s}=i,{marks:a,scales:u}=r;if(a==="include-invalid-values"&&u==="include-invalid-values")return null;const l=i.reduceFieldDef((c,f,d)=>{const h=Zi(d)&&i.getScaleComponent(d);if(h){const g=h.get("type"),{aggregate:p}=f,m=n2({scaleChannel:d,markDef:s,config:o,scaleType:g,isCountAggregate:pg(p)});m!=="show"&&m!=="always-valid"&&(c[f.field]=f)}return c},{});return z(l).length?new Ba(n,l):null}dependentFields(){return new Set(z(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${de(this.filter)}`}assemble(){const n=z(this.filter).reduce((i,r)=>{const o=this.filter[r],s=V(o,{expr:"datum"});return o!==null&&(o.type==="temporal"?i.push(`(isDate(${s}) || (${k1(s)}))`):o.type==="quantitative"&&i.push(k1(s))),i},[]);return n.length>0?{type:"filter",expr:n.join(" && ")}:null}}function k1(e){return`isValid(${e}) && isFinite(+${e})`}function pre(e){return e.stack.stackBy.reduce((t,n)=>{const i=n.fieldDef,r=V(i);return r&&t.push(r),t},[])}function mre(e){return T(e)&&e.every(t=>Y(t))&&e.length>1}class mr extends _e{constructor(n,i){super(n);L(this,"_stack");this._stack=i}clone(){return new mr(null,ae(this._stack))}static makeFromTransform(n,i){const{stack:r,groupby:o,as:s,offset:a="zero"}=i,u=[],l=[];if(i.sort!==void 0)for(const d of i.sort)u.push(d.field),l.push(Ye(d.order,"ascending"));const c={field:u,order:l};let f;return mre(s)?f=s:Y(s)?f=[s,`${s}_end`]:f=[`${i.stack}_start`,`${i.stack}_end`],new mr(n,{dimensionFieldDefs:[],stackField:r,groupby:o,offset:a,sort:c,facetby:[],as:f})}static makeFromEncoding(n,i){const r=i.stack,{encoding:o}=i;if(!r)return null;const{groupbyChannels:s,fieldChannel:a,offset:u,impute:l}=r,c=s.map(g=>{const p=o[g];return fi(p)}).filter(g=>!!g),f=pre(i),d=i.encoding.order;let h;if(T(d)||B(d))h=JD(d);else{const g=BT(d)?d.sort:a==="y"?"descending":"ascending";h=f.reduce((p,m)=>(p.field.includes(m)||(p.field.push(m),p.order.push(g)),p),{field:[],order:[]})}return new mr(n,{dimensionFieldDefs:c,stackField:i.vgField(a),facetby:[],stackby:f,sort:h,offset:u,impute:l,as:[i.vgField(a,{suffix:"start",forAs:!0}),i.vgField(a,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(n){this._stack.facetby.push(...n)}dependentFields(){const n=new Set;return n.add(this._stack.stackField),this.getGroupbyFields().forEach(n.add,n),this._stack.facetby.forEach(n.add,n),this._stack.sort.field.forEach(n.add,n),n}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${de(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:n,impute:i,groupby:r}=this._stack;return n.length>0?n.map(o=>o.bin?i?[V(o,{binSuffix:"mid"})]:[V(o,{}),V(o,{binSuffix:"end"})]:[V(o)]).flat():r??[]}assemble(){const n=[],{facetby:i,dimensionFieldDefs:r,stackField:o,stackby:s,sort:a,offset:u,impute:l,as:c}=this._stack;if(l)for(const f of r){const{bandPosition:d=.5,bin:h}=f;if(h){const g=V(f,{expr:"datum"}),p=V(f,{expr:"datum",binSuffix:"end"});n.push({type:"formula",expr:`${k1(g)} ? ${d}*${g}+${1-d}*${p} : ${g}`,as:V(f,{binSuffix:"mid",forAs:!0})})}n.push({type:"impute",field:o,groupby:[...s,...i],key:V(f,{binSuffix:"mid"}),method:"value",value:0})}return n.push({type:"stack",groupby:[...this.getGroupbyFields(),...i],field:o,sort:a,as:c,offset:u}),n}}class uu extends _e{constructor(n,i){super(n);L(this,"transform");this.transform=i}clone(){return new uu(null,ae(this.transform))}addDimensions(n){this.transform.groupby=mn(this.transform.groupby.concat(n),i=>i)}dependentFields(){const n=new Set;return(this.transform.groupby??[]).forEach(n.add,n),(this.transform.sort??[]).forEach(i=>n.add(i.field)),this.transform.window.map(i=>i.field).filter(i=>i!==void 0).forEach(n.add,n),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(n){return n.as??V(n)}hash(){return`WindowTransform ${de(this.transform)}`}assemble(){const n=[],i=[],r=[],o=[];for(const d of this.transform.window)i.push(d.op),r.push(this.getDefaultName(d)),o.push(d.param===void 0?null:d.param),n.push(d.field===void 0?null:d.field);const s=this.transform.frame,a=this.transform.groupby;if(s&&s[0]===null&&s[1]===null&&i.every(d=>Tx(d)))return{type:"joinaggregate",as:r,ops:i,fields:n,...a!==void 0?{groupby:a}:{}};const u=[],l=[];if(this.transform.sort!==void 0)for(const d of this.transform.sort)u.push(d.field),l.push(d.order??"ascending");const c={field:u,order:l},f=this.transform.ignorePeers;return{type:"window",params:o,as:r,ops:i,fields:n,sort:c,...f!==void 0?{ignorePeers:f}:{},...a!==void 0?{groupby:a}:{},...s!==void 0?{frame:s}:{}}}}function yre(e){function t(n){if(!(n instanceof au)){const i=n.clone();if(i instanceof en){const r=F1+i.getSource();i.setSource(r),e.model.component.data.outputNodes[r]=i}else(i instanceof oi||i instanceof mr||i instanceof uu||i instanceof Ls)&&i.addDimensions(e.fields);for(const r of n.children.flatMap(t))r.parent=i;return[i]}return n.children.flatMap(t)}return t}function C1(e){if(e instanceof au)if(e.numChildren()===1&&!(e.children[0]instanceof en)){const t=e.children[0];(t instanceof oi||t instanceof mr||t instanceof uu||t instanceof Ls)&&t.addDimensions(e.fields),t.swapWithParent(),C1(e)}else{const t=e.model.component.data.main;F3(t);const n=yre(e),i=e.children.map(n).flat();for(const r of i)r.parent=t}else e.children.map(C1)}function F3(e){if(e instanceof en&&e.type===Ue.Main&&e.numChildren()===1){const t=e.children[0];t instanceof au||(t.swapWithParent(),F3(e))}}const F1="scale_",rf=5;function _1(e){for(const t of e){for(const n of t.children)if(n.parent!==t)return!1;if(!_1(t.children))return!1}return!0}function Hn(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function wA(e,t,n){let i=e.sources,r=!1;return r=Hn(new are,i)||r,r=Hn(new ore(t),i)||r,i=i.filter(o=>o.numChildren()>0),r=Hn(new cre,i)||r,i=i.filter(o=>o.numChildren()>0),n||(r=Hn(new ure,i)||r,r=Hn(new hre(t),i)||r,r=Hn(new sre,i)||r,r=Hn(new lre,i)||r,r=Hn(new dre,i)||r,r=Hn(new fre,i)||r,r=Hn(new rre,i)||r,r=Hn(new gre,i)||r),e.sources=i,r}function bre(e,t){_1(e.sources);let n=0,i=0;for(let r=0;r<rf&&wA(e,t,!0);r++)n++;e.sources.map(C1);for(let r=0;r<rf&&wA(e,t,!1);r++)i++;_1(e.sources),Math.max(n,i)===rf&&q(`Maximum optimization runs(${rf}) reached.`)}class at{constructor(t){L(this,"signal");Object.defineProperty(this,"signal",{enumerable:!0,get:t})}static fromName(t,n){return new at(()=>t(n))}}function _3(e){Pe(e)?vre(e):xre(e)}function vre(e){const t=e.component.scales;for(const n of z(t)){const i=wre(e,n);if(t[n].setWithExplicit("domains",i),$re(e,n),e.component.data.isFaceted){let o=e;for(;!wn(o)&&o.parent;)o=o.parent;if(o.component.resolve.scale[n]==="shared")for(const a of i.value)cr(a)&&(a.data=F1+a.data.replace(F1,""))}}}function xre(e){for(const n of e.children)_3(n);const t=e.component.scales;for(const n of z(t)){let i,r=null;for(const o of e.children){const s=o.component.scales[n];if(s){i===void 0?i=s.getWithExplicit("domains"):i=go(i,s.getWithExplicit("domains"),"domains","scale",O1);const a=s.get("selectionExtent");r&&a&&r.param!==a.param&&q(EQ),r=a}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}function Ere(e,t,n,i){if(e==="unaggregated"){const{valid:r,reason:o}=SA(t,n);if(!r){q(o);return}}else if(e===void 0&&i.useUnaggregatedDomain){const{valid:r}=SA(t,n);if(r)return"unaggregated"}return e}function wre(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=Ere(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:r}),t==="x"&&it(i.x2)?it(i.x)?go(Lr(n,r,e,"x"),Lr(n,r,e,"x2"),"domain","scale",O1):Lr(n,r,e,"x2"):t==="y"&&it(i.y2)?it(i.y)?go(Lr(n,r,e,"y"),Lr(n,r,e,"y2"),"domain","scale",O1):Lr(n,r,e,"y2"):Lr(n,r,e,t)}function Sre(e,t,n){return e.map(i=>({signal:`{data: ${Fg(i,{timeUnit:n,type:t})}}`}))}function rm(e,t,n){var r;const i=(r=ft(n))==null?void 0:r.unit;return t==="temporal"||i?Sre(e,t,i):[e]}function Lr(e,t,n,i){const{encoding:r,markDef:o,mark:s,config:a,stack:u}=n,l=it(r[i]),{type:c}=l,f=l.timeUnit,d=Ane({invalid:Bi("invalid",o,a),isPath:ko(s)});if(XZ(t)){const p=Lr(e,void 0,n,i),m=rm(t.unionWith,c,f);return ki([...m,...p.value])}else{if(ee(t))return ki([t]);if(t&&t!=="unaggregated"&&!ST(t))return ki(rm(t,c,f))}if(u&&i===u.fieldChannel){if(u.offset==="normalize")return fn([[0,1]]);const p=n.requestDataName(d);return fn([{data:p,field:n.vgField(i,{suffix:"start"})},{data:p,field:n.vgField(i,{suffix:"end"})}])}const h=Zi(i)&&B(l)?Are(n,i,e):void 0;if(er(l)){const p=rm([l.datum],c,f);return fn(p)}const g=l;if(t==="unaggregated"){const{field:p}=l;return fn([{data:n.requestDataName(d),field:V({field:p,aggregate:"min"})},{data:n.requestDataName(d),field:V({field:p,aggregate:"max"})}])}else if(De(g.bin)){if(He(e))return fn(e==="bin-ordinal"?[]:[{data:ka(h)?n.requestDataName(d):n.requestDataName(Ue.Raw),field:n.vgField(i,$c(g,i)?{binSuffix:"range"}:{}),sort:h===!0||!X(h)?{field:n.vgField(i,{}),op:"min"}:h}]);{const{bin:p}=g;if(De(p)){const m=T2(n,g.field,p);return fn([new at(()=>{const y=n.getSignalName(m);return`[${y}.start, ${y}.stop]`})])}else return fn([{data:n.requestDataName(d),field:n.vgField(i,{})}])}}else if(g.timeUnit&&pe(["time","utc"],e)){const p=r[Qi(i)];if(zT(g,p,o,a)){const m=n.requestDataName(d),y=Er({fieldDef:g,fieldDef2:p,markDef:o,config:a}),b=Tl(s)&&y!==.5&&Ke(i);return fn([{data:m,field:n.vgField(i,b?{suffix:Tg}:{})},{data:m,field:n.vgField(i,{suffix:b?Ng:"end"})}])}}return fn(h?[{data:ka(h)?n.requestDataName(d):n.requestDataName(Ue.Raw),field:n.vgField(i),sort:h}]:[{data:n.requestDataName(d),field:n.vgField(i)}])}function om(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":$g),...i?{field:Un(i)}:{},...r?{order:r}:{}}}function $re(e,t){var a;const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=(a=e.fieldDef(t))==null?void 0:a.bin,o=ST(i)?i:void 0,s=Os(r)&&mg(r.extent)?r.extent:void 0;(o||s)&&n.set("selectionExtent",o??s,!0)}function Are(e,t,n){if(!He(n))return;const i=e.fieldDef(t),r=i.sort;if(IT(r))return{op:"min",field:Pa(i,t),order:"ascending"};const{stack:o}=e,s=o?new Set([...o.groupbyFields,...o.stackBy.map(a=>a.fieldDef.field)]):void 0;if(gr(r)){const a=o&&!s.has(r.field);return om(r,a)}else if(Aee(r)){const{encoding:a,order:u}=r,l=e.fieldDef(a),{aggregate:c,field:f}=l,d=o&&!s.has(f);if(xr(c)||Ao(c))return om({field:V(l),order:u},d);if(Tx(c)||!c)return om({op:c,field:f,order:u},d)}else{if(r==="descending")return{op:"min",field:e.vgField(t),order:"descending"};if(pe(["ascending",void 0],r))return!0}}function SA(e,t){const{aggregate:n,type:i}=e;return n?Y(n)&&!rQ.has(n)?{valid:!1,reason:KQ(n)}:i==="quantitative"&&t==="log"?{valid:!1,reason:JQ(e)}:{valid:!0}:{valid:!1,reason:YQ(e)}}function O1(e,t,n,i){return e.explicit&&t.explicit&&q(nZ(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function kre(e){const t=mn(e.map(s=>{if(cr(s)){const{sort:a,...u}=s;return u}return s}),de),n=mn(e.map(s=>{if(cr(s)){const a=s.sort;return a!==void 0&&!ka(a)&&("op"in a&&a.op==="count"&&delete a.field,a.order==="ascending"&&delete a.order),a}}).filter(s=>s!==void 0),de);if(t.length===0)return;if(t.length===1){const s=e[0];if(cr(s)&&n.length>0){let a=n[0];if(n.length>1){q(D$);const u=n.filter(l=>X(l)&&"op"in l&&l.op!=="min");n.every(l=>X(l)&&"op"in l)&&u.length===1?a=u[0]:a=!0}else if(X(a)&&"field"in a){const u=a.field;s.field===u&&(a=a.order?{order:a.order}:!0)}return{...s,sort:a}}return s}const i=mn(n.map(s=>ka(s)||!("op"in s)||Y(s.op)&&J(eQ,s.op)?s:(q(rZ(s)),!0)),de);let r;i.length===1?r=i[0]:i.length>1&&(q(D$),r=!0);const o=mn(e.map(s=>cr(s)?s.data:null),s=>s);return o.length===1&&o[0]!==null?{data:o[0],fields:t.map(a=>a.field),...r?{sort:r}:{}}:{fields:t,...r?{sort:r}:{}}}function P2(e){if(cr(e)&&Y(e.field))return e.field;if(VD(e)){let t;for(const n of e.fields)if(cr(n)&&Y(n.field)){if(!t)t=n.field;else if(t!==n.field)return q(oZ),t}return q(sZ),t}else if(oQ(e)){q(aZ);const t=e.fields[0];return Y(t)?t:void 0}}function vs(e,t){const i=e.component.scales[t].get("domains").map(r=>(cr(r)&&(r.data=e.lookupDataSource(r.data)),r));return kre(i)}function Cre(e,t,n,i){var r,o;e.encode??(e.encode={}),(r=e.encode)[t]??(r[t]={}),(o=e.encode[t]).update??(o.update={}),e.encode[t].update[n]=i}function O3(e,t){if(Pe(e)){const i=e.fieldDef(t);if(i!=null&&i.field)return i.field}const n=(e.children??[]).map(i=>O3(i,t)).filter(i=>!!i);if(n.length>0){const i=mn(n,de);return i.length===1?i[0]:void 0}}function Fre(e,t,n){if(t===n)return!0;const i=e.getScaleType(t),r=e.getScaleType(n);if(!i||!r)return!1;const o=He(i),s=He(r);return o===s}function _re(e,t){return e?`field:${e}`:`channel:${String(t)}`}function Ore(e){if(T(e)){const t=e.filter(Ud);return t.length>0?t:null}if(VD(e)){const t=[];if(t.push(...e.fields.flatMap(n=>T(n)?n.filter(Ud):[])),t.length>0)return mn(t,de)}return null}function R1(e,t){try{const n=vs(e,t);return Ore(n)}catch{return null}}function Rre(e,t,n){const i=R1(e,t),r=R1(e,n);return i&&r?mn([...i,...r],de):null}function $A(e,t,n){if(t&&t.length>0){const i=e.getWithExplicit("values");i!=null&&i.explicit||(n&&q(n),e.set("values",t,!1))}}function Mre(e,t,n){const i=e.getScaleComponent(t),r=e.getScaleComponent(n);if(!i||!r)return!1;const o=i.getWithExplicit("domains"),s=r.getWithExplicit("domains");if(!(o!=null&&o.explicit&&(s!=null&&s.explicit)))return!1;const a=vs(e,t),u=vs(e,n);return de(a)===de(u)}function R3(e){const t=e.component.legends,n={};for(const r of z(t)){const o=O3(e,r),s=_re(o,r);if(!n[s]){n[s]=[{channel:r,cmpt:t[r].clone()}];continue}let a=!1;for(const u of n[s]){if(!Fre(e,u.channel,r))continue;if(k3(u.cmpt,t[r])){const c=e.getScaleType(u.channel),f=e.getScaleType(r);c&&f&&He(c)&&He(f)&&(Mre(e,u.channel,r)?$A(u.cmpt,R1(e,u.channel)):$A(u.cmpt,Rre(e,u.channel,r),uZ(u.channel,r))),a=!0;break}}a||n[s].push({channel:r,cmpt:t[r].clone()})}return Qe(n).flat().map(r=>Dre(r.cmpt,e.config)).filter(r=>r!==void 0)}function Dre(e,t){var s,a,u;const{disable:n,labelExpr:i,selections:r,...o}=e.combine();if(!n){if(t.aria===!1&&o.aria==null&&(o.aria=!1),(s=o.encode)!=null&&s.symbols){const l=o.encode.symbols.update;l.fill&&l.fill.value!=="transparent"&&!l.stroke&&!o.stroke&&(l.stroke={value:"transparent"});for(const c of pN)o[c]&&delete l[c]}if(o.title||delete o.title,i!==void 0){let l=i;(u=(a=o.encode)==null?void 0:a.labels)!=null&&u.update&&ee(o.encode.labels.update.text)&&(l=ls(i,"datum.label",o.encode.labels.update.text.signal)),Cre(o,"labels","text",{signal:l})}return o}}function Tre(e){return lu(e)||z2(e)?Nre(e):M3(e)}function Nre(e){return e.children.reduce((t,n)=>t.concat(n.assembleProjections()),M3(e))}function M3(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map(s=>s.signal).join(", ")}]`},o=t.data.reduce((s,a)=>{const u=ee(a)?a.signal:`data('${e.lookupDataSource(a)}')`;return pe(s,u)||s.push(u),s},[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...n}]}else return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const Lre=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class D3 extends Mr{constructor(n,i,r,o){super({...i},{name:n});L(this,"specifiedProjection");L(this,"size");L(this,"data");L(this,"merged",!1);this.specifiedProjection=i,this.size=r,this.data=o}get isFit(){return!!this.data}}function T3(e){e.component.projection=Pe(e)?Ire(e):Bre(e)}function Ire(e){if(e.hasProjection){const t=ht(e.specifiedProjection),n=!(t&&(t.scale!=null||t.translate!=null)),i=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=n?Pre(e):void 0,o=new D3(e.projectionName(!0),{...ht(e.config.projection),...t},i,r);return o.get("type")||o.set("type","equalEarth",!1),o}}function Pre(e){const t=[],{encoding:n}=e;for(const i of[[vi,bi],[jn,xi]])(it(n[i[0]])||it(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(an)&&e.typedFieldDef(an).type===ru&&t.push({signal:e.getName(`geojson_${t.length}`)}),t.length===0&&t.push(e.requestDataName(Ue.Main)),t}function zre(e,t){const n=wx(Lre,r=>!!(!J(e.explicit,r)&&!J(t.explicit,r)||J(e.explicit,r)&&J(t.explicit,r)&&yn(e.get(r),t.get(r))));if(yn(e.size,t.size)){if(n)return e;if(yn(e.explicit,{}))return t;if(yn(t.explicit,{}))return e}return null}function Bre(e){if(e.children.length===0)return;let t;for(const i of e.children)T3(i);const n=wx(e.children,i=>{const r=i.component.projection;if(r)if(t){const o=zre(t,r);return o&&(t=o),!!o}else return t=r,!0;else return!0});if(t&&n){const i=e.projectionName(!0),r=new D3(i,t.specifiedProjection,t.size,ae(t.data));for(const o of e.children){const s=o.component.projection;s&&(s.isFit&&r.data.push(...o.component.projection.data),o.renameProjection(s.get("name"),i),s.merged=!0)}return r}}function N3(e){return lu(e)||z2(e)?e.children.reduce((t,n)=>t.concat(N3(n)),AA(e)):AA(e)}function AA(e){return z(e.component.scales).reduce((t,n)=>{const i=e.component.scales[n];if(i.merged)return t;const r=i.combine(),{name:o,type:s,selectionExtent:a,domains:u,range:l,reverse:c,...f}=r,d=Ure(r.range,o,n,e),h=vs(e,n),g=a?Lne(e,a,i,h):null;return t.push({name:o,type:s,...h?{domain:h}:{},...g?{domainRaw:g}:{},range:d,...c!==void 0?{reverse:c}:{},...f}),t},[])}function Ure(e,t,n,i){if(Ke(n)){if(Rs(e))return{step:{signal:`${t}_step`}}}else if(X(e)&&cr(e))return{...e,data:i.lookupDataSource(e.data)};return e}class L3 extends Mr{constructor(n,i){super({},{name:n});L(this,"merged",!1);this.setWithExplicit("type",i)}domainHasZero(){const n=this.get("type");if(pe([gt.LOG,gt.TIME,gt.UTC],n))return"definitely-not";const i=this.get("zero");if(i===!0||i===void 0&&pe([gt.LINEAR,gt.SQRT,gt.POW],n))return"definitely";const r=this.get("domains");if(r.length>0){let o=!1,s=!1,a=!1;for(const u of r){if(T(u)){const l=u[0],c=u[u.length-1];if(Ee(l)&&Ee(c))if(l<=0&&c>=0){o=!0;continue}else{s=!0;continue}}a=!0}if(o)return"definitely";if(s&&!a)return"definitely-not"}return"maybe"}}const jre=["range","scheme"];function qre(e){const t=e.component.scales;for(const n of Dx){const i=t[n];if(!i)continue;const r=Wre(n,e);i.setWithExplicit("range",r)}}function kA(e,t){const n=e.fieldDef(t);if(n!=null&&n.bin){const{bin:i,field:r}=n,o=un(t),s=e.getName(o);if(X(i)&&i.binned&&i.step!==void 0)return new at(()=>{const a=e.scaleName(t),u=`(domain("${a}")[1] - domain("${a}")[0]) / ${i.step}`;return`${e.getSignalName(s)} / (${u})`});if(De(i)){const a=T2(e,r,i);return new at(()=>{const u=e.getSignalName(a),l=`(${u}.stop - ${u}.start) / ${u}.step`;return`${e.getSignalName(s)} / (${l})`})}}}function Wre(e,t){const n=t.specifiedScales[e],{size:i}=t,o=t.getScaleComponent(e).get("type");for(const f of jre)if(n[f]!==void 0){const d=c1(o,f),h=$T(e,f);if(!d)q(rT(o,f,e));else if(h)q(h);else switch(f){case"range":{const g=n.range;if(T(g)){if(Ke(e))return ki(g.map(p=>{if(p==="width"||p==="height"){const m=t.getName(p),y=t.getSignalName.bind(t);return at.fromName(y,m)}return p}))}else if(X(g))return ki({data:t.requestDataName(Ue.Main),field:g.field,sort:{op:"min",field:t.vgField(e)}});return ki(g)}case"scheme":return ki(Gre(n[f]))}}const s=e===Le||e==="xOffset"?"width":"height",a=i[s];if(ji(a)){if(Ke(e))if(He(o)){const f=P3(a,t,e);if(f)return ki({step:f})}else q(oT(s));else if(yc(e)){const f=e===vr?"x":"y";if(t.getScaleComponent(f).get("type")==="band"){const g=z3(a,o);if(g)return ki(g)}}}const{rangeMin:u,rangeMax:l}=n,c=Hre(e,t);return(u!==void 0||l!==void 0)&&c1(o,"rangeMin")&&T(c)&&c.length===2?ki([u??c[0],l??c[1]]):fn(c)}function Gre(e){return VZ(e)?{scheme:e.name,...En(e,["name"])}:{scheme:e}}function I3(e,t,n,{center:i}={}){const r=un(e),o=t.getName(r),s=t.getSignalName.bind(t);return e===ot&&li(n)?i?[at.fromName(a=>`${s(a)}/2`,o),at.fromName(a=>`-${s(a)}/2`,o)]:[at.fromName(s,o),0]:i?[at.fromName(a=>`-${s(a)}/2`,o),at.fromName(a=>`${s(a)}/2`,o)]:[0,at.fromName(s,o)]}function Hre(e,t){const{size:n,config:i,mark:r,encoding:o}=t,{type:s}=it(o[e]),u=t.getScaleComponent(e).get("type"),{domain:l,domainMid:c}=t.specifiedScales[e];switch(e){case Le:case ot:{if(pe(["point","band"],u)){const f=B3(e,n,i.view);if(ji(f))return{step:P3(f,t,e)}}return I3(e,t,u)}case vr:case iu:return Vre(e,t,u);case Fr:{const f=Kre(r,i),d=Jre(r,n,t,i);return Oa(u)?Yre(f,d,Xre(u,i,l,e)):[f,d]}case Wn:return[0,Math.PI*2];case Fs:return[0,360];case yi:return[0,new at(()=>{const f=t.getSignalName(wn(t.parent)?"child_width":"width"),d=t.getSignalName(wn(t.parent)?"child_height":"height");return`min(${f},${d})/2`})];case xo:return{step:1e3/i.scale.framesPerSecond};case So:return[i.scale.minStrokeWidth,i.scale.maxStrokeWidth];case $o:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case an:return"symbol";case sn:case Ki:case Ji:return u==="ordinal"?s==="nominal"?"category":"ordinal":c!==void 0?"diverging":r==="rect"||r==="geoshape"?"heatmap":"ramp";case _r:case Eo:case wo:return[i.scale.minOpacity,i.scale.maxOpacity]}}function P3(e,t,n){const{encoding:i}=t,r=t.getScaleComponent(n),o=_x(n),s=i[o];if(yN({step:e,offsetIsDiscrete:ue(s)&&Yx(s.type)})==="offset"&&JT(i,o)){const u=t.getScaleComponent(o);let c=`domain('${t.scaleName(o)}').length`;if(u.get("type")==="band"){const d=u.get("paddingInner")??u.get("padding")??0,h=u.get("paddingOuter")??u.get("padding")??0;c=`bandspace(${c}, ${d}, ${h})`}const f=r.get("paddingInner")??r.get("padding");return{signal:`${e.step} * ${c} / (1-${cQ(f)})`}}else return e.step}function z3(e,t){if(yN({step:e,offsetIsDiscrete:He(t)})==="offset")return{step:e.step}}function Vre(e,t,n){const i=e===vr?"x":"y",r=t.getScaleComponent(i);if(!r)return I3(i,t,n,{center:!0});const o=r.get("type"),s=t.scaleName(i),{markDef:a,config:u}=t;if(o==="band"){const l=B3(i,t.size,t.config.view);if(ji(l)){const c=z3(l,n);if(c)return c}return[0,{signal:`bandwidth('${s}')`}]}else{const l=t.encoding[i];if(B(l)&&l.timeUnit){const c=pT(l.timeUnit,g=>`scale('${s}', ${g})`),f=t.config.scale.bandWithNestedOffsetPaddingInner,d=Er({fieldDef:l,markDef:a,config:u})-.5,h=d!==0?` + ${d}`:"";if(f){const g=ee(f)?`${f.signal}/2${h}`:`${f/2+d}`,p=ee(f)?`(1 - ${f.signal}/2)${h}`:`${1-f/2+d}`;return[{signal:`${g} * (${c})`},{signal:`${p} * (${c})`}]}return[0,{signal:c}]}return $D(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}function B3(e,t,n){const i=e===Le?"width":"height",r=t[i];return r!==void 0?r:Kd(n,i)}function Xre(e,t,n,i){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return n!==void 0&&T(n)?n.length+1:(q(yZ(i)),3)}}function Yre(e,t,n){const i=()=>{const r=ni(t),o=ni(e),s=`(${r} - ${o}) / (${n} - 1)`;return`sequence(${o}, ${r} + ${s}, ${s})`};return ee(t)?new at(i):{signal:i()}}function Kre(e,t){switch(e){case"bar":case"tick":return t.scale.minBandSize;case"line":case"trail":case"rule":return t.scale.minStrokeWidth;case"text":return t.scale.minFontSize;case"point":case"square":case"circle":return t.scale.minSize}throw new Error(yg("size",e))}const CA=.95;function Jre(e,t,n,i){const r={x:kA(n,"x"),y:kA(n,"y")};switch(e){case"bar":case"tick":{if(i.scale.maxBandSize!==void 0)return i.scale.maxBandSize;const o=FA(t,r,i.view);return Ee(o)?o-1:new at(()=>`${o.signal} - 1`)}case"line":case"trail":case"rule":return i.scale.maxStrokeWidth;case"text":return i.scale.maxFontSize;case"point":case"square":case"circle":{if(i.scale.maxSize)return i.scale.maxSize;const o=FA(t,r,i.view);return Ee(o)?Math.pow(CA*o,2):new at(()=>`pow(${CA} * ${o.signal}, 2)`)}}throw new Error(yg("size",e))}function FA(e,t,n){const i=ji(e.width)?e.width.step:g1(n,"width"),r=ji(e.height)?e.height.step:g1(n,"height");return t.x||t.y?new at(()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`):Math.min(i,r)}function U3(e,t){Pe(e)?Qre(e,t):q3(e,t)}function Qre(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:s}=e;for(const a of z(n)){const u=s[a],l=n[a],c=e.getScaleComponent(a),f=it(r[a]),d=u[t],h=c.get("type"),g=c.get("padding"),p=c.get("paddingInner"),m=c1(h,t),y=$T(a,t);if(d!==void 0&&(m?y&&q(y):q(rT(h,t,a))),m&&y===void 0)if(d!==void 0){const b=f.timeUnit,v=f.type;switch(t){case"domainMax":case"domainMin":Ms(u[t])||v==="temporal"||b?l.set(t,{signal:Fg(u[t],{type:v,timeUnit:b})},!0):l.set(t,u[t],!0);break;default:l.copyKeyFromObject(t,u)}}else{const b=U(_A,t)?_A[t]({model:e,channel:a,fieldOrDatumDef:f,scaleType:h,scalePadding:g,scalePaddingInner:p,domain:u.domain,domainMin:u.domainMin,domainMax:u.domainMax,markDef:o,config:i,hasNestedOffsetScale:QT(r,a),hasSecondaryRangeChannel:!!r[Qi(a)]}):i.scale[t];b!==void 0&&l.set(t,b,!1)}}}const _A={bins:({model:e,fieldOrDatumDef:t})=>B(t)?Zre(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>eoe(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:i,domainMax:r,fieldOrDatumDef:o})=>toe(e,t,n,i,r,o),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:i,config:r})=>noe(e,t,r.scale,n,i,r.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:i,config:r,hasNestedOffsetScale:o})=>ioe(e,t,n.type,i,r.scale,o),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:i,config:r,hasNestedOffsetScale:o})=>roe(e,t,n,i,r.scale,o),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:i})=>{const r=B(e)?e.sort:void 0;return ooe(t,r,n,i.scale)},zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:i,scaleType:r,config:o,hasSecondaryRangeChannel:s})=>soe(e,t,n,i,r,o.scale,s)};function j3(e){Pe(e)?qre(e):q3(e,"range")}function q3(e,t){const n=e.component.scales;for(const i of e.children)t==="range"?j3(i):U3(i,t);for(const i of z(n)){let r;for(const o of e.children){const s=o.component.scales[i];if(s){const a=s.getWithExplicit(t);r=go(r,a,t,"scale",RN((u,l)=>{switch(t){case"range":return u.step&&l.step?u.step-l.step:0}return 0}))}}n[i].setWithExplicit(t,r)}}function Zre(e,t){const n=t.bin;if(De(n)){const i=T2(e,t.field,n);return new at(()=>e.getSignalName(i))}else if(dt(n)&&Os(n)&&n.step!==void 0)return{step:n.step}}function eoe(e,t){if(pe([sn,Ki,Ji],e)&&t!=="nominal")return"hcl"}function toe(e,t,n,i,r,o){var s;if(!((s=fi(o))!=null&&s.bin||T(n)||r!=null||i!=null||pe([gt.TIME,gt.UTC],e)))return Ke(t)?!0:void 0}function noe(e,t,n,i,r,o){if(Ke(e)){if(Ri(t)){if(n.continuousPadding!==void 0)return n.continuousPadding;const{type:s,orient:a}=r;if(s==="bar"&&!(B(i)&&(i.bin||i.timeUnit))&&(a==="vertical"&&e==="x"||a==="horizontal"&&e==="y"))return o.continuousBandSize}if(t===gt.POINT)return n.pointPadding}}function ioe(e,t,n,i,r,o=!1){if(e===void 0){if(Ke(t)){const{bandPaddingInner:s,barBandPaddingInner:a,rectBandPaddingInner:u,tickBandPaddingInner:l,bandWithNestedOffsetPaddingInner:c}=r;return o?c:Ye(s,n==="bar"?a:n==="tick"?l:u)}else if(yc(t)&&i===gt.BAND)return r.offsetBandPaddingInner}}function roe(e,t,n,i,r,o=!1){if(e===void 0){if(Ke(t)){const{bandPaddingOuter:s,bandWithNestedOffsetPaddingOuter:a}=r;if(o)return a;if(n===gt.BAND)return Ye(s,ee(i)?{signal:`${i.signal}/2`}:i/2)}else if(yc(t)){if(n===gt.POINT)return .5;if(n===gt.BAND)return r.offsetBandPaddingOuter}}}function ooe(e,t,n,i){if(n==="x"&&i.xReverse!==void 0)return li(e)&&t==="descending"?ee(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse;if(li(e)&&t==="descending")return!0}function soe(e,t,n,i,r,o,s){if(!!n&&n!=="unaggregated"&&li(r)){if(T(n)){const u=n[0],l=n[n.length-1];if(Ee(u)&&u<=0&&Ee(l)&&l>=0)return!0}return!1}if(e==="size"&&t.type==="quantitative"&&!Oa(r))return!0;if(!(B(t)&&t.bin)&&pe([...Or,...GJ],e)){const{orient:u,type:l}=i;return pe(["bar","area","line","trail"],l)&&(u==="horizontal"&&e==="y"||u==="vertical"&&e==="x")?!1:pe(["bar","area"],l)&&!s?!0:o==null?void 0:o.zero}return!1}function aoe(e,t,n,i,r=!1){const o=uoe(t,n,i,r),{type:s}=e;return Zi(t)?s!==void 0?eee(t,s)?B(n)&&!ZZ(s,n.type)?(q(eZ(s,o)),o):s:(q(ZQ(t,s,o)),o):o:null}function uoe(e,t,n,i){var r;switch(t.type){case"nominal":case"ordinal":{if(aa(e)||Vp(e)==="discrete")return e==="shape"&&t.type==="ordinal"&&q(Xp(e,"ordinal")),"ordinal";if(Hp(e))return"band";if(Ke(e)||yc(e)){if(pe(["rect","bar","image","rule","tick"],n.type)||i)return"band"}else if(n.type==="arc"&&e in Mx)return"band";const o=n[un(e)];return gs(o)||Ma(t)&&((r=t.axis)!=null&&r.tickBand)?"band":"point"}case"temporal":return aa(e)?"time":Vp(e)==="discrete"?(q(Xp(e,"temporal")),"ordinal"):B(t)&&t.timeUnit&&ft(t.timeUnit).utc?"utc":Hp(e)?"band":"time";case"quantitative":return aa(e)?B(t)&&De(t.bin)?"bin-ordinal":"linear":Vp(e)==="discrete"?(q(Xp(e,"quantitative")),"ordinal"):Hp(e)?"band":"linear";case"geojson":return}throw new Error(nT(t.type))}function loe(e,{ignoreRange:t}={}){W3(e),_3(e);for(const n of QZ)U3(e,n);t||j3(e)}function W3(e){Pe(e)?e.component.scales=coe(e):e.component.scales=doe(e)}function coe(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of Dx){const s=it(t[o]);if(s&&n===CT&&o===an&&s.type===ru)continue;let a=s&&s.scale;if(s&&a!==null&&a!==!1){a??(a={});const u=QT(t,o),l=aoe(a,o,s,i,u);r[o]=new L3(e.scaleName(`${o}`,!0),{value:l,explicit:a.type===l})}}return r}const foe=RN((e,t)=>N$(e)-N$(t));function doe(e){var r;const t=e.component.scales={},n={},i=e.component.resolve;for(const o of e.children){W3(o);for(const s of z(o.component.scales))if((r=i.scale)[s]??(r[s]=x3(s,e)),i.scale[s]==="shared"){const a=n[s],u=o.component.scales[s].getWithExplicit("type");a?jZ(a.value,u.value)?n[s]=go(a,u,"type","scale",foe):(i.scale[s]="independent",delete n[s]):n[s]=u}}for(const o of z(n)){const s=e.scaleName(o,!0),a=n[o];t[o]=new L3(s,a);for(const u of e.children){const l=u.component.scales[o];l&&(u.renameScale(l.get("name"),s),l.merged=!0)}}return t}class sm{constructor(){L(this,"nameMap");this.nameMap={}}rename(t,n){this.nameMap[t]=n}has(t){return this.nameMap[t]!==void 0}get(t){for(;this.nameMap[t]&&t!==this.nameMap[t];)t=this.nameMap[t];return t}}function Pe(e){return(e==null?void 0:e.type)==="unit"}function wn(e){return(e==null?void 0:e.type)==="facet"}function z2(e){return(e==null?void 0:e.type)==="concat"}function lu(e){return(e==null?void 0:e.type)==="layer"}class B2{constructor(t,n,i,r,o,s,a){L(this,"type");L(this,"parent");L(this,"config");L(this,"name");L(this,"size");L(this,"title");L(this,"description");L(this,"data");L(this,"transforms");L(this,"layout");L(this,"scaleNameMap");L(this,"projectionNameMap");L(this,"signalNameMap");L(this,"component");L(this,"view");this.type=n,this.parent=i,this.config=o,this.parent=i,this.config=o,this.view=ht(a),this.name=t.name??r,this.title=Ur(t.title)?{text:t.title}:t.title?ht(t.title):void 0,this.scaleNameMap=i?i.scaleNameMap:new sm,this.projectionNameMap=i?i.projectionNameMap:new sm,this.signalNameMap=i?i.signalNameMap:new sm,this.data=t.data,this.description=t.description,this.transforms=hne(t.transform??[]),this.layout=n==="layer"||n==="unit"?{}:yte(t,n,o),this.component={data:{sources:i?i.component.data.sources:[],outputNodes:i?i.component.data.outputNodes:{},outputNodeRefCounts:i?i.component.data.outputNodeRefCounts:{},isFaceted:Ag(t)||(i==null?void 0:i.component.data.isFaceted)&&t.data===void 0},layoutSize:new Mr,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...s?ae(s):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){loe(this)}parseProjection(){T3(this)}renameTopLevelLayoutSizeSignal(){this.getName("width")!=="width"&&this.renameSignal(this.getName("width"),"width"),this.getName("height")!=="height"&&this.renameSignal(this.getName("height"),"height")}parseLegends(){A3(this)}assembleEncodeFromView(t){const{style:n,...i}=t,r={};for(const o of z(i)){const s=i[o];s!==void 0&&(r[o]=Ne(s))}return r}assembleGroupEncodeEntry(t){let n={};return this.view&&(n=this.assembleEncodeFromView(this.view)),!t&&(this.description&&(n.description=Ne(this.description)),this.type==="unit"||this.type==="layer")?{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...n}:Me(n)?void 0:n}assembleLayout(){if(!this.layout)return;const{spacing:t,...n}=this.layout,{component:i,config:r}=this,o=Fie(i.layoutHeaders,r);return{padding:t,...this.assembleDefaultLayout(),...n,...o?{titleBand:o}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:t}=this.component;let n=[];for(const i of Dn)t[i].title&&n.push(wie(this,i));for(const i of O2)n=n.concat(Sie(this,i));return n}assembleAxes(){return lie(this.component.axes,this.config)}assembleLegends(){return R3(this)}assembleProjections(){return Tre(this)}assembleTitle(){const{encoding:t,...n}=this.title??{},i={...HD(this.config.title).nonMarkTitleProperties,...n,...t?{encode:{update:t}}:{}};if(i.text)return pe(["unit","layer"],this.type)?pe(["middle",void 0],i.anchor)&&(i.frame??(i.frame="group")):i.anchor??(i.anchor="start"),Me(i)?void 0:i}assembleGroup(t=[]){const n={};t=t.concat(this.assembleSignals()),t.length>0&&(n.signals=t);const i=this.assembleLayout();i&&(n.layout=i),n.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const r=!this.parent||wn(this.parent)?N3(this):[];r.length>0&&(n.scales=r);const o=this.assembleAxes();o.length>0&&(n.axes=o);const s=this.assembleLegends();return s.length>0&&(n.legends=s),n}getName(t){return ze((this.name?`${this.name}_`:"")+t)}getDataName(t){return this.getName(Ue[t].toLowerCase())}requestDataName(t){const n=this.getDataName(t),i=this.component.data.outputNodeRefCounts;return i[n]=(i[n]||0)+1,n}getSizeSignalRef(t){if(wn(this.parent)){const n=b3(t),i=gg(n),r=this.component.scales[i];if(r&&!r.merged){const o=r.get("type"),s=r.get("range");if(He(o)&&Rs(s)){const a=r.get("name"),u=vs(this,i),l=P2(u);if(l){const c=V({aggregate:"distinct",field:l},{expr:"datum"});return{signal:y3(a,r,c)}}else return q(Lx(i)),null}}}return{signal:this.signalNameMap.get(this.getName(t))}}lookupDataSource(t){const n=this.component.data.outputNodes[t];return n?n.getSource():t}getSignalName(t){return this.signalNameMap.get(t)}renameSignal(t,n){this.signalNameMap.rename(t,n)}renameScale(t,n){this.scaleNameMap.rename(t,n)}renameProjection(t,n){this.projectionNameMap.rename(t,n)}scaleName(t,n){if(n)return this.getName(t);if(PD(t)&&Zi(t)&&this.component.scales[t]||this.scaleNameMap.has(this.getName(t)))return this.scaleNameMap.get(this.getName(t))}projectionName(t){if(t)return this.getName("projection");if(this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection")))return this.projectionNameMap.get(this.getName("projection"))}getScaleComponent(t){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const n=this.component.scales[t];return n&&!n.merged?n:this.parent?this.parent.getScaleComponent(t):void 0}getScaleType(t){const n=this.getScaleComponent(t);return n?n.get("type"):void 0}getSelectionComponent(t,n){let i=this.component.selection[t];if(!i&&this.parent&&(i=this.parent.getSelectionComponent(t,n)),!i)throw new Error(pQ(n));return i}hasAxisOrientSignalRef(){var t,n;return((t=this.component.axes.x)==null?void 0:t.some(i=>i.hasOrientSignalRef()))||((n=this.component.axes.y)==null?void 0:n.some(i=>i.hasOrientSignalRef()))}}class G3 extends B2{vgField(t,n={}){const i=this.fieldDef(t);if(i)return V(i,n)}reduceFieldDef(t,n){return Hee(this.getMapping(),(i,r,o)=>{const s=fi(r);return s?t(i,s,o):i},n)}forEachFieldDef(t,n){f2(this.getMapping(),(i,r)=>{const o=fi(i);o&&t(o,r)},n)}}class zg extends _e{constructor(n,i){super(n);L(this,"transform");this.transform=i,this.transform=ae(i);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??"value",r[1]??"density"];const o=this.transform.resolve??"shared";this.transform.resolve=o}clone(){return new zg(null,ae(this.transform))}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${de(this.transform)}`}assemble(){const{density:n,...i}=this.transform,r={type:"kde",field:n,...i};return r.resolve=this.transform.resolve,r}}class Bg extends _e{constructor(n,i){super(n);L(this,"transform");this.transform=i,this.transform=ae(i)}clone(){return new Bg(null,ae(this.transform))}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${de(this.transform)}`}assemble(){const{extent:n,param:i}=this.transform;return{type:"extent",field:n,signal:i}}}class Ug extends _e{constructor(n,i){super(n);L(this,"transform");this.transform=i,this.transform=ae(i);const{flatten:r,as:o=[]}=this.transform;this.transform.as=r.map((s,a)=>o[a]??s)}clone(){return new Ug(this.parent,ae(this.transform))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${de(this.transform)}`}assemble(){const{flatten:n,as:i}=this.transform;return{type:"flatten",fields:n,as:i}}}class jg extends _e{constructor(n,i){super(n);L(this,"transform");this.transform=i,this.transform=ae(i);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??"key",r[1]??"value"]}clone(){return new jg(null,ae(this.transform))}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${de(this.transform)}`}assemble(){const{fold:n,as:i}=this.transform;return{type:"fold",fields:n,as:i}}}class ca extends _e{constructor(n,i,r,o){super(n);L(this,"fields");L(this,"geojson");L(this,"signal");this.fields=i,this.geojson=r,this.signal=o}clone(){return new ca(null,ae(this.fields),this.geojson,this.signal)}static parseAll(n,i){if(i.component.projection&&!i.component.projection.isFit)return n;let r=0;for(const o of[[vi,bi],[jn,xi]]){const s=o.map(a=>{const u=it(i.encoding[a]);return B(u)?u.field:er(u)?{expr:`${u.datum}`}:ci(u)?{expr:`${u.value}`}:void 0});(s[0]||s[1])&&(n=new ca(n,s,null,i.getName(`geojson_${r++}`)))}if(i.channelHasField(an)){const o=i.typedFieldDef(an);o.type===ru&&(n=new ca(n,null,o.field,i.getName(`geojson_${r}`)))}return n}dependentFields(){const n=(this.fields??[]).filter(Y);return new Set([...this.geojson?[this.geojson]:[],...n])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${de(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class Ll extends _e{constructor(n,i,r,o){super(n);L(this,"projection");L(this,"fields");L(this,"as");this.projection=i,this.fields=r,this.as=o}clone(){return new Ll(null,this.projection,ae(this.fields),ae(this.as))}static parseAll(n,i){if(!i.projectionName())return n;for(const r of[[vi,bi],[jn,xi]]){const o=r.map(a=>{const u=it(i.encoding[a]);return B(u)?u.field:er(u)?{expr:`${u.datum}`}:ci(u)?{expr:`${u.value}`}:void 0}),s=r[0]===jn?"2":"";(o[0]||o[1])&&(n=new Ll(n,i.projectionName(),o,[i.getName(`x${s}`),i.getName(`y${s}`)]))}return n}dependentFields(){return new Set(this.fields.filter(Y))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${de(this.fields)} ${de(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Qo extends _e{constructor(n,i){super(n);L(this,"transform");this.transform=i}clone(){return new Qo(null,ae(this.transform))}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(n){const{start:i=0,stop:r,step:o}=n;return{signal:`sequence(${[i,r,...o?[o]:[]].join(",")})`}}static makeFromTransform(n,i){return new Qo(n,i)}static makeFromEncoding(n,i){const r=i.encoding,o=r.x,s=r.y;if(B(o)&&B(s)){const a=o.impute?o:s.impute?s:void 0;if(a===void 0)return;const u=o.impute?s:s.impute?o:void 0,{method:l,value:c,frame:f,keyvals:d}=a.impute,h=tN(i.mark,r);return new Qo(n,{impute:a.field,key:u.field,...l?{method:l}:{},...c!==void 0?{value:c}:{},...f?{frame:f}:{},...d!==void 0?{keyvals:d}:{},...h.length?{groupby:h}:{}})}return null}hash(){return`Impute ${de(this.transform)}`}assemble(){const{impute:n,key:i,keyvals:r,method:o,groupby:s,value:a,frame:u=[null,null]}=this.transform,l={type:"impute",field:n,key:i,...r?{keyvals:Xte(r)?this.processSequence(r):r}:{},method:"value",...s?{groupby:s}:{},value:!o||o==="value"?a:null};if(o&&o!=="value"){const c={type:"window",as:[`imputed_${n}_value`],ops:[o],fields:[n],frame:u,ignorePeers:!1,...s?{groupby:s}:{}},f={type:"formula",expr:`datum.${n} === null ? datum.imputed_${n}_value : datum.${n}`,as:n};return[l,c,f]}else return[l]}}class qg extends _e{constructor(n,i){super(n);L(this,"transform");this.transform=i,this.transform=ae(i);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??i.on,r[1]??i.loess]}clone(){return new qg(null,ae(this.transform))}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${de(this.transform)}`}assemble(){const{loess:n,on:i,...r}=this.transform;return{type:"loess",x:i,y:n,...r}}}class Il extends _e{constructor(n,i,r){super(n);L(this,"transform");L(this,"secondary");this.transform=i,this.secondary=r}clone(){return new Il(null,ae(this.transform),this.secondary)}static make(n,i,r,o){const s=i.component.data.sources,{from:a}=r;let u=null;if(Yte(a)){let l=X3(a.data,s);l||(l=new bs(a.data),s.push(l));const c=i.getName(`lookup_${o}`);u=new en(l,c,Ue.Lookup,i.component.data.outputNodeRefCounts),i.component.data.outputNodes[c]=u}else if(Kte(a)){const l=a.param;r={as:l,...r};let c;try{c=i.getSelectionComponent(ze(l),l)}catch{throw new Error(vQ(l))}if(u=c.materialized,!u)throw new Error(xQ(l))}return new Il(n,r,u.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?K(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${de({transform:this.transform,secondary:this.secondary})}`}assemble(){let n;if(this.transform.from.fields)n={values:this.transform.from.fields,...this.transform.as?{as:K(this.transform.as)}:{}};else{let i=this.transform.as;Y(i)||(q(RQ),i="_lookup"),n={as:[i]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...n,...this.transform.default?{default:this.transform.default}:{}}}}class Wg extends _e{constructor(n,i){super(n);L(this,"transform");this.transform=i,this.transform=ae(i);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??"prob",r[1]??"value"]}clone(){return new Wg(null,ae(this.transform))}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${de(this.transform)}`}assemble(){const{quantile:n,...i}=this.transform;return{type:"quantile",field:n,...i}}}class Gg extends _e{constructor(n,i){super(n);L(this,"transform");this.transform=i,this.transform=ae(i);const r=this.transform.as??[void 0,void 0];this.transform.as=[r[0]??i.on,r[1]??i.regression]}clone(){return new Gg(null,ae(this.transform))}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${de(this.transform)}`}assemble(){const{regression:n,on:i,...r}=this.transform;return{type:"regression",x:i,y:n,...r}}}class Hg extends _e{constructor(n,i){super(n);L(this,"transform");this.transform=i}clone(){return new Hg(null,ae(this.transform))}addDimensions(n){this.transform.groupby=mn((this.transform.groupby??[]).concat(n),i=>i)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${de(this.transform)}`}assemble(){const{pivot:n,value:i,groupby:r,limit:o,op:s}=this.transform;return{type:"pivot",field:n,value:i,...o!==void 0?{limit:o}:{},...s!==void 0?{op:s}:{},...r!==void 0?{groupby:r}:{}}}}class Vg extends _e{constructor(n,i){super(n);L(this,"transform");this.transform=i}clone(){return new Vg(null,ae(this.transform))}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${de(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function H3(e){let t=0;function n(i,r){if(i instanceof bs&&!i.isGenerator&&!Na(i.data)&&(e.push(r),r={name:null,source:r.name,transform:[]}),i instanceof kt&&(i.parent instanceof bs&&!r.source?(r.format={...r.format,parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof au){r.name||(r.name=`data_${t++}`),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,e.push(...i.assemble());return}switch((i instanceof Cc||i instanceof Fc||i instanceof Ba||i instanceof su||i instanceof Ia||i instanceof Ll||i instanceof oi||i instanceof Il||i instanceof uu||i instanceof Ls||i instanceof jg||i instanceof Ug||i instanceof zg||i instanceof qg||i instanceof Wg||i instanceof Gg||i instanceof po||i instanceof Vg||i instanceof Hg||i instanceof Bg)&&r.transform.push(i.assemble()),(i instanceof Ni||i instanceof Di||i instanceof Qo||i instanceof mr||i instanceof ca)&&r.transform.push(...i.assemble()),i instanceof en&&(r.source&&r.transform.length===0?i.setSource(r.source):i.parent instanceof en?i.setSource(r.name):(r.name||(r.name=`data_${t++}`),i.setSource(r.name),i.numChildren()===1&&(e.push(r),r={name:null,source:r.name,transform:[]}))),i.numChildren()){case 0:i instanceof en&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name=`data_${t++}`);let o=r.name;!r.source||r.transform.length>0?e.push(r):o=r.source;for(const s of i.children)n(s,{name:null,source:o,transform:[]});break}}}return n}function hoe(e){const t=[],n=H3(t);for(const i of e.children)n(i,{source:e.name,name:null,transform:[]});return t}function goe(e,t){const n=[],i=H3(n);let r=0;for(const s of e.sources){s.hasName()||(s.dataName=`source_${r++}`);const a=s.assemble();i(s,a)}for(const s of n)s.transform.length===0&&delete s.transform;let o=0;for(const[s,a]of n.entries())(a.transform??[]).length===0&&!a.source&&n.splice(o++,0,n.splice(s,1)[0]);for(const s of n)for(const a of s.transform??[])a.type==="lookup"&&(a.from=e.outputNodes[a.from].getSource());for(const s of n)s.name in t&&(s.values=t[s.name]);return n}function poe(e){return e==="top"||e==="left"||ee(e)?"header":"footer"}function moe(e){for(const t of Dn)yoe(e,t);OA(e,"x"),OA(e,"y")}function yoe(e,t){var s;const{facet:n,config:i,child:r,component:o}=e;if(e.channelHasField(t)){const a=n[t],u=za("title",null,i,t);let l=ua(a,i,{allowDisabling:!0,includeDefault:u===void 0||!!u});r.component.layoutHeaders[t].title&&(l=T(l)?l.join(", "):l,l+=` / ${r.component.layoutHeaders[t].title}`,r.component.layoutHeaders[t].title=null);const c=za("labelOrient",a.header,i,t),f=a.header!==null?Ye((s=a.header)==null?void 0:s.labels,i.header.labels,!0):!1,d=pe(["bottom","right"],c)?"footer":"header";o.layoutHeaders[t]={title:a.header!==null?l:null,facetFieldDef:a,[d]:t==="facet"?[]:[V3(e,t,f)]}}}function V3(e,t,n){const i=t==="row"?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function OA(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:i,resolve:r}=e.component;if(r.axis[t]=D2(r,t),r.axis[t]==="shared"){const o=t==="x"?"column":"row",s=i[o];for(const a of n.component.axes[t]){const u=poe(a.get("orient"));s[u]??(s[u]=[V3(e,o,!1)]);const l=Ju(a,"main",e.config,{header:!0});l&&s[u][0].axes.push(l),a.mainExtracted=!0}}}}function boe(e){U2(e),eh(e,"width"),eh(e,"height")}function voe(e){U2(e);const t=e.layout.columns===1?"width":"childWidth",n=e.layout.columns===void 0?"height":"childHeight";eh(e,t),eh(e,n)}function U2(e){for(const t of e.children)t.parseLayoutSize()}function eh(e,t){const n=b3(t),i=gg(n),r=e.component.resolve,o=e.component.layoutSize;let s;for(const a of e.children){const u=a.component.layoutSize.getWithExplicit(n),l=r.scale[i]??x3(i,e);if(l==="independent"&&u.value==="step"){s=void 0;break}if(s){if(l==="independent"&&s.value!==u.value){s=void 0;break}s=go(s,u,n,"")}else s=u}if(s){for(const a of e.children)e.renameSignal(a.getName(n),e.getName(t)),a.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,s)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function xoe(e){const{size:t,component:n}=e;for(const i of Or){const r=un(i);if(t[r]!=null&&t[r]!=null){const o=t[r];n.layoutSize.set(r,ji(o)?"step":o,!0)}else{const o=Eoe(e,r);n.layoutSize.set(r,o,!1)}}}function Eoe(e,t){const n=t==="width"?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const o=r.get("type"),s=r.get("range");if(He(o)){const a=Kd(i.view,t);return Rs(s)||ji(a)?"step":a}else return h1(i.view,t)}else{if(e.hasProjection||e.mark==="arc")return h1(i.view,t);{const o=Kd(i.view,t);return ji(o)?o.step:o}}}function M1(e,t,n){return V(t,{suffix:`by_${V(e)}`,...n})}class hl extends G3{constructor(n,i,r,o){super(n,"facet",i,r,o,n.resolve);L(this,"facet");L(this,"child");L(this,"children");this.child=H2(n.spec,this,this.getName("child"),void 0,o),this.children=[this.child],this.facet=this.initFacet(n.facet)}initFacet(n){if(!Ec(n))return{facet:this.initFacetFieldDef(n,"facet")};const i=z(n),r={};for(const o of i){if(![dr,hr].includes(o)){q(yg(o,"facet"));break}const s=n[o];if(s.field===void 0){q(u1(s,o));break}r[o]=this.initFacetFieldDef(s,o)}return r}initFacetFieldDef(n,i){const r=c2(n,i);return r.header?r.header=ht(r.header):r.header===null&&(r.header=null),r}channelHasField(n){return U(this.facet,n)}fieldDef(n){return this.facet[n]}parseData(){this.component.data=Xg(this),this.child.parseData()}parseLayoutSize(){U2(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,Qe(this.component.selection).some(n=>Ti(n))&&Px(Ix)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),moe(this)}assembleSelectionTopLevelSignals(n){return this.child.assembleSelectionTopLevelSignals(n)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(n){return this.child.assembleSelectionData(n)}getHeaderLayoutMixins(){const n={};for(const i of Dn)for(const r of R2){const o=this.component.layoutHeaders[i],s=o[r],{facetFieldDef:a}=o;if(a){const u=za("titleOrient",a.header,this.config,i);if(["right","bottom"].includes(u)){const l=Ig(i,u);n.titleAnchor??(n.titleAnchor={}),n.titleAnchor[l]="end"}}if(s!=null&&s[0]){const u=i==="row"?"height":"width",l=r==="header"?"headerBand":"footerBand";i!=="facet"&&!this.child.component.layoutSize.get(u)&&(n[l]??(n[l]={}),n[l][i]=.5),o.title&&(n.offset??(n.offset={}),n.offset[i==="row"?"rowTitle":"columnTitle"]=10)}}return n}assembleDefaultLayout(){const{column:n,row:i}=this.facet,r=n?this.columnDistinctSignal():i?1:void 0;let o="all";return(!i&&this.component.resolve.scale.x==="independent"||!n&&this.component.resolve.scale.y==="independent")&&(o="none"),{...this.getHeaderLayoutMixins(),...r?{columns:r}:{},bounds:"full",align:o}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof hl))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(n){return this.parent&&this.parent instanceof hl?{...this.channelHasField("column")?{encode:{update:{columns:{field:V(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(n)}:super.assembleGroup(n)}getCardinalityAggregateForChild(){const n=[],i=[],r=[];if(this.child instanceof hl){if(this.child.channelHasField("column")){const o=V(this.child.facet.column);n.push(o),i.push("distinct"),r.push(`distinct_${o}`)}}else for(const o of Or){const s=this.child.component.scales[o];if(s&&!s.merged){const a=s.get("type"),u=s.get("range");if(He(a)&&Rs(u)){const l=vs(this.child,o),c=P2(l);c?(n.push(c),i.push("distinct"),r.push(`distinct_${c}`)):q(Lx(o))}}}return{fields:n,ops:i,as:r}}assembleFacet(){const{name:n,data:i}=this.component.data.facetRoot,{row:r,column:o}=this.facet,{fields:s,ops:a,as:u}=this.getCardinalityAggregateForChild(),l=[];for(const f of Dn){const d=this.facet[f];if(d){l.push(V(d));const{bin:h,sort:g}=d;if(De(h)&&l.push(V(d,{binSuffix:"end"})),gr(g)){const{field:p,op:m=$g}=g,y=M1(d,g);r&&o?(s.push(y),a.push("max"),u.push(y)):(s.push(p),a.push(m),u.push(y))}else if(T(g)){const p=Pa(d,f);s.push(p),a.push("max"),u.push(p)}}}const c=!!r&&!!o;return{name:n,data:i,groupby:l,...c||s.length>0?{aggregate:{...c?{cross:c}:{},...s.length?{fields:s,ops:a,as:u}:{}}}:{}}}facetSortFields(n){const{facet:i}=this,r=i[n];return r?gr(r.sort)?[M1(r,r.sort,{expr:"datum"})]:T(r.sort)?[Pa(r,n,{expr:"datum"})]:[V(r,{expr:"datum"})]:[]}facetSortOrder(n){const{facet:i}=this,r=i[n];if(r){const{sort:o}=r;return[(gr(o)?o.order:!T(o)&&o)||"ascending"]}return[]}assembleLabelTitle(){var o;const{facet:n,config:i}=this;if(n.facet)return $1(n.facet,"facet",i);const r={row:["top","bottom"],column:["left","right"]};for(const s of O2)if(n[s]){const a=za("labelOrient",(o=n[s])==null?void 0:o.header,i,s);if(r[s].includes(a))return $1(n[s],s,i)}}assembleMarks(){const{child:n}=this,i=this.component.data.facetRoot,r=hoe(i),o=n.assembleGroupEncodeEntry(!1),s=this.assembleLabelTitle()||n.assembleTitle(),a=n.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...s?{title:s}:{},...a?{style:a}:{},from:{facet:this.assembleFacet()},sort:{field:Dn.map(l=>this.facetSortFields(l)).flat(),order:Dn.map(l=>this.facetSortOrder(l)).flat()},...r.length>0?{data:r}:{},...o?{encode:{update:o}}:{},...n.assembleGroup(Mne(this,[]))}]}getMapping(){return this.facet}}function woe(e,t){const{row:n,column:i}=t;if(n&&i){let r=null;for(const o of[n,i])if(gr(o.sort)){const{field:s,op:a=$g}=o.sort;e=r=new Ls(e,{joinaggregate:[{op:a,field:s,as:M1(o,o.sort,{forAs:!0})}],groupby:[V(o)]})}return r}return null}function X3(e,t){var n,i,r,o;for(const s of t){const a=s.data;if(e.name&&s.hasName()&&e.name!==s.dataName)continue;const u=(n=e.format)==null?void 0:n.mesh,l=(i=a.format)==null?void 0:i.feature;if(u&&l)continue;const c=(r=e.format)==null?void 0:r.feature;if((c||l)&&c!==l)continue;const f=(o=a.format)==null?void 0:o.mesh;if(!((u||f)&&u!==f)){if(Nl(e)&&Nl(a)){if(yn(e.values,a.values))return s}else if(Na(e)&&Na(a)){if(e.url===a.url)return s}else if(MN(e)&&e.name===s.dataName)return s}}return null}function Soe(e,t){if(e.data||!e.parent){if(e.data===null){const i=new bs({values:[]});return t.push(i),i}const n=X3(e.data,t);if(n)return ro(e.data)||(n.data.format=AD({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const i=new bs(e.data);return t.push(i),i}}else return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function $oe(e,t,n){let i=0;for(const r of t.transforms){let o,s;if(sne(r))s=e=new Ia(e,r),o="derived";else if(w2(r)){const a=tre(r);s=e=kt.makeWithAncestors(e,{},a,n)??e,e=new su(e,t,r.filter)}else if(CN(r))s=e=Ni.makeFromTransform(e,r,t),o="number";else if(une(r))o="date",n.getWithExplicit(r.field).value===void 0&&(e=new kt(e,{[r.field]:o}),n.set(r.field,o,!1)),s=e=Di.makeFromTransform(e,r);else if(lne(r))s=e=oi.makeFromTransform(e,r),o="number",_2(t)&&(e=new po(e));else if(kN(r))s=e=Il.make(e,t,r,i++),o="derived";else if(ine(r))s=e=new uu(e,r),o="number";else if(rne(r))s=e=new Ls(e,r),o="number";else if(cne(r))s=e=mr.makeFromTransform(e,r),o="derived";else if(fne(r))s=e=new jg(e,r),o="derived";else if(dne(r))s=e=new Bg(e,r),o="derived";else if(one(r))s=e=new Ug(e,r),o="derived";else if(Jte(r))s=e=new Hg(e,r),o="derived";else if(nne(r))e=new Vg(e,r);else if(ane(r))s=e=Qo.makeFromTransform(e,r),o="derived";else if(Qte(r))s=e=new zg(e,r),o="derived";else if(Zte(r))s=e=new Wg(e,r),o="derived";else if(ene(r))s=e=new Gg(e,r),o="derived";else if(tne(r))s=e=new qg(e,r),o="derived";else{q(OQ(r));continue}if(s&&o!==void 0)for(const a of s.producedFields()??[])n.set(a,o,!1)}return e}function Xg(e){var m;let t=Soe(e,e.component.data.sources);const{outputNodes:n,outputNodeRefCounts:i}=e.component.data,r=e.data,s=!(r&&(ro(r)||Na(r)||Nl(r)))&&e.parent?e.parent.component.data.ancestorParse.clone():new $ne;ro(r)?(DN(r)?t=new Fc(t,r.sequence):S2(r)&&(t=new Cc(t,r.graticule)),s.parseNothing=!0):((m=r==null?void 0:r.format)==null?void 0:m.parse)===null&&(s.parseNothing=!0),t=kt.makeExplicit(t,e,s)??t,t=new po(t);const a=e.parent&&lu(e.parent);(Pe(e)||wn(e))&&a&&(t=Ni.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=$oe(t,e,s));const u=ire(e),l=nre(e);t=kt.makeWithAncestors(t,{},{...u,...l},s)??t,Pe(e)&&(t=ca.parseAll(t,e),t=Ll.parseAll(t,e)),(Pe(e)||wn(e))&&(a||(t=Ni.makeFromEncoding(t,e)??t),t=Di.makeFromEncoding(t,e)??t,t=Ia.parseAllForSortIndex(t,e));const c=t=of(Ue.Raw,e,t);if(Pe(e)){const y=oi.makeFromEncoding(t,e);y&&(t=y,_2(e)&&(t=new po(t))),t=Qo.makeFromEncoding(t,e)??t,t=mr.makeFromEncoding(t,e)??t}let f,d;if(Pe(e)){const{markDef:y,mark:b,config:v}=e,x=Ae("invalid",y,v),{marks:w,scales:S}=d=NN({invalid:x,isPath:ko(b)});w!==S&&S==="include-invalid-values"&&(f=t=of(Ue.PreFilterInvalid,e,t)),w==="exclude-invalid-values"&&(t=Ba.make(t,e,d)??t)}const h=t=of(Ue.Main,e,t);let g;if(Pe(e)&&d){const{marks:y,scales:b}=d;y==="include-invalid-values"&&b==="exclude-invalid-values"&&(t=Ba.make(t,e,d)??t,g=t=of(Ue.PostFilterInvalid,e,t))}Pe(e)&&aie(e,h);let p=null;if(wn(e)){const y=e.getName("facet");t=woe(t,e.facet)??t,p=new au(t,e,y,h.getSource()),n[y]=p}return{...e.component.data,outputNodes:n,outputNodeRefCounts:i,raw:c,main:h,facetRoot:p,ancestorParse:s,preFilterInvalid:f,postFilterInvalid:g}}function of(e,t,n){const{outputNodes:i,outputNodeRefCounts:r}=t.component.data,o=t.getDataName(e),s=new en(n,o,e,r);return i[o]=s,s}class Aoe extends B2{constructor(n,i,r,o){var s,a,u,l;super(n,"concat",i,r,o,n.resolve);L(this,"children");(((a=(s=n.resolve)==null?void 0:s.axis)==null?void 0:a.x)==="shared"||((l=(u=n.resolve)==null?void 0:u.axis)==null?void 0:l.y)==="shared")&&q(CQ),this.children=this.getChildren(n).map((c,f)=>H2(c,this,this.getName(`concat_${f}`),void 0,o))}parseData(){this.component.data=Xg(this);for(const n of this.children)n.parseData()}parseSelections(){this.component.selection={};for(const n of this.children){n.parseSelections();for(const i of z(n.component.selection))this.component.selection[i]=n.component.selection[i]}Qe(this.component.selection).some(n=>Ti(n))&&Px(Ix)}parseMarkGroup(){for(const n of this.children)n.parseMarkGroup()}parseAxesAndHeaders(){for(const n of this.children)n.parseAxesAndHeaders()}getChildren(n){return Rg(n)?n.vconcat:x2(n)?n.hconcat:n.concat}parseLayoutSize(){voe(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(n){return this.children.reduce((i,r)=>r.assembleSelectionTopLevelSignals(i),n)}assembleSignals(){return this.children.forEach(n=>n.assembleSignals()),[]}assembleLayoutSignals(){const n=M2(this);for(const i of this.children)n.push(...i.assembleLayoutSignals());return n}assembleSelectionData(n){return this.children.reduce((i,r)=>r.assembleSelectionData(i),n)}assembleMarks(){return this.children.map(n=>{const i=n.assembleTitle(),r=n.assembleGroupStyle(),o=n.assembleGroupEncodeEntry(!1);return{type:"group",name:n.getName("group"),...i?{title:i}:{},...r?{style:r}:{},...o?{encode:{update:o}}:{},...n.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){const n=this.layout.columns;return{...n!=null?{columns:n}:{},bounds:"full",align:"each"}}}function koe(e){return e===!1||e===null}const Coe={disable:1,gridScale:1,scale:1,...YT,labelExpr:1,encode:1},Y3=z(Coe);class j2 extends Mr{constructor(n={},i={},r=!1){super();L(this,"explicit");L(this,"implicit");L(this,"mainExtracted");this.explicit=n,this.implicit=i,this.mainExtracted=r}clone(){return new j2(ae(this.explicit),ae(this.implicit),this.mainExtracted)}hasAxisPart(n){return n==="axis"?!0:n==="grid"||n==="title"?!!this.get(n):!koe(this.get(n))}hasOrientSignalRef(){return ee(this.explicit.orient)}}function Foe(e,t,n){const{encoding:i,config:r}=e,o=it(i[t])??it(i[Qi(t)]),s=e.axis(t)||{},{format:a,formatType:u}=s;if(ps(u))return{text:ii({fieldOrDatumDef:o,field:"datum.value",format:a,formatType:u,config:r}),...n};if(a===void 0&&u===void 0&&r.customFormatTypes){if(Ra(o)==="quantitative"){if(Ma(o)&&o.stack==="normalize"&&r.normalizedNumberFormatType)return{text:ii({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:ii({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if(Ra(o)==="temporal"&&r.timeFormatType&&B(o)&&!o.timeUnit)return{text:ii({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}function _oe(e){return Or.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[Loe(n,e)]),t),{})}const Ooe={bottom:"top",top:"bottom",left:"right",right:"left"};function Roe(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const r of e.children){r.parseAxesAndHeaders();for(const o of z(r.component.axes))n.axis[o]=D2(e.component.resolve,o),n.axis[o]==="shared"&&(t[o]=Moe(t[o],r.component.axes[o]),t[o]||(n.axis[o]="independent",delete t[o]))}for(const r of Or){for(const o of e.children)if(o.component.axes[r]){if(n.axis[r]==="independent"){t[r]=(t[r]??[]).concat(o.component.axes[r]);for(const s of o.component.axes[r]){const{value:a,explicit:u}=s.getWithExplicit("orient");if(!ee(a)){if(i[a]>0&&!u){const l=Ooe[a];i[a]>i[l]&&s.set("orient",l,!1)}i[a]++}}}delete o.component.axes[r]}if(n.axis[r]==="independent"&&t[r]&&t[r].length>1)for(const[o,s]of(t[r]||[]).entries())o>0&&s.get("grid")&&!s.explicit.grid&&(s.implicit.grid=!1)}}function Moe(e,t){if(e){if(e.length!==t.length)return;const n=e.length;for(let i=0;i<n;i++){const r=e[i],o=t[i];if(!!r!=!!o)return;if(r&&o){const s=r.getWithExplicit("orient"),a=o.getWithExplicit("orient");if(s.explicit&&a.explicit&&s.value!==a.value)return;e[i]=Doe(r,o)}}}else return t.map(n=>n.clone());return e}function Doe(e,t){for(const n of Y3){const i=go(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",(r,o)=>{switch(n){case"title":return eT(r,o);case"gridScale":return{explicit:r.explicit,value:Ye(r.value,o.value)}}return Dg(r,o,n,"axis")});e.setWithExplicit(n,i)}return e}function Toe(e,t,n,i,r){if(t==="disable")return n!==void 0;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(ee(n.labelAngle)?n.labelAngle:Dl(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===h3(i,r))return!0}return e===n[t]}const Noe=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function Loe(e,t){var y,b;let n=t.axis(e);const i=new j2,r=it(t.encoding[e]),{mark:o,config:s}=t,a=(n==null?void 0:n.orient)||((y=s[e==="x"?"axisX":"axisY"])==null?void 0:y.orient)||((b=s.axis)==null?void 0:b.orient)||yie(e),u=t.getScaleComponent(e).get("type"),l=cie(e,u,a,t.config),c=n!==void 0?!n:w1("disable",s.style,n==null?void 0:n.style,l).configValue;if(i.set("disable",c,n!==void 0),c)return i;n=n||{};const f=gie(r,n,e,s.style,l),d=NT(n.formatType,r,u),h=TT(r,r.type,n.format,n.formatType,s,!0),g={fieldOrDatumDef:r,axis:n,channel:e,model:t,scaleType:u,orient:a,labelAngle:f,format:h,formatType:d,mark:o,config:s};for(const v of Y3){const x=v in pA?pA[v](g):j$(v)?n[v]:void 0,w=x!==void 0,S=Toe(x,v,n,t,e);if(w&&S)i.set(v,x,S);else{const{configValue:E=void 0,configFrom:$=void 0}=j$(v)&&v!=="values"?w1(v,s.style,n.style,l):{},A=E!==void 0;w&&!A?i.set(v,x,S):($!=="vgAxisConfig"||Noe.has(v)&&A||Ac(E)||ee(E))&&i.set(v,E,!1)}}const p=n.encoding??{},m=XT.reduce((v,x)=>{if(!i.hasAxisPart(x))return v;const w=v3(p[x]??{},t),S=x==="labels"?Foe(t,e,w):w;return S!==void 0&&!Me(S)&&(v[x]={update:S}),v},{});return Me(m)||i.set("encode",m,!!n.encoding||n.labelAngle!==void 0),i}function Ioe({encoding:e,size:t}){for(const n of Or){const i=un(n);ji(t[i])&&Zr(e[n])&&(delete t[i],q(oT(i)))}return t}const Poe={vgMark:"arc",encodeEntry:e=>({...Gn(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...jt("x",e,{defaultPos:"mid"}),...jt("y",e,{defaultPos:"mid"}),...wr(e,"radius"),...wr(e,"theta")})},zoe={vgMark:"area",encodeEntry:e=>({...Gn(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...Jd("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="horizontal"}),...Jd("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="vertical"}),...F2(e)})},Boe={vgMark:"rect",encodeEntry:e=>({...Gn(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...wr(e,"x"),...wr(e,"y")})},Uoe={vgMark:"shape",encodeEntry:e=>({...Gn(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&B(n)&&n.type===ru?{field:V(n,{expr:"datum"})}:{}}]}},joe={vgMark:"image",encodeEntry:e=>({...Gn(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...wr(e,"x"),...wr(e,"y"),...A2(e,"url")})},qoe={vgMark:"line",encodeEntry:e=>({...Gn(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...jt("x",e,{defaultPos:"mid"}),...jt("y",e,{defaultPos:"mid"}),...pt("size",e,{vgChannel:"strokeWidth"}),...F2(e)})},Woe={vgMark:"trail",encodeEntry:e=>({...Gn(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...jt("x",e,{defaultPos:"mid"}),...jt("y",e,{defaultPos:"mid"}),...pt("size",e),...F2(e)})};function q2(e,t){const{config:n}=e;return{...Gn(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...jt("x",e,{defaultPos:"mid"}),...jt("y",e,{defaultPos:"mid"}),...pt("size",e),...pt("angle",e),...Goe(e,n,t)}}function Goe(e,t,n){return n?{shape:{value:n}}:pt("shape",e)}const Hoe={vgMark:"symbol",encodeEntry:e=>q2(e)},Voe={vgMark:"symbol",encodeEntry:e=>q2(e,"circle")},Xoe={vgMark:"symbol",encodeEntry:e=>q2(e,"square")},Yoe={vgMark:"rect",encodeEntry:e=>({...Gn(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...wr(e,"x"),...wr(e,"y")})},Koe={vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return!e.encoding.x&&!e.encoding.y&&!e.encoding.latitude&&!e.encoding.longitude?{}:{...Gn(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Jd("x",e,{defaultPos:n==="horizontal"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:n!=="vertical"}),...Jd("y",e,{defaultPos:n==="vertical"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:n!=="horizontal"}),...pt("size",e,{vgChannel:"strokeWidth"})}}},Joe={vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...Gn(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...jt("x",e,{defaultPos:"mid"}),...jt("y",e,{defaultPos:"mid"}),...A2(e),...pt("size",e,{vgChannel:"fontSize"}),...pt("angle",e),...fA("align",Qoe(e.markDef,n,t)),...fA("baseline",Zoe(e.markDef,n,t)),...jt("radius",e,{defaultPos:null}),...jt("theta",e,{defaultPos:null})}}};function Qoe(e,t,n){if(Ae("align",e,n)===void 0)return"center"}function Zoe(e,t,n){if(Ae("baseline",e,n)===void 0)return"middle"}const ese={vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r=i==="horizontal"?"x":"y",o=i==="horizontal"?"y":"x",s=i==="horizontal"?"height":"width";return{...Gn(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...wr(e,r),...jt(o,e,{defaultPos:"mid",vgChannel:o==="y"?"yc":"xc"}),[s]:Ne(Ae("thickness",n,t))}}},sf={arc:Poe,area:zoe,bar:Boe,circle:Voe,geoshape:Uoe,image:joe,line:qoe,point:Hoe,rect:Yoe,rule:Koe,square:Xoe,text:Joe,tick:ese,trail:Woe};function tse(e){if(pe([wg,xg,ree],e.mark)){const t=tN(e.mark,e.encoding);if(t.length>0)return nse(e,t)}else if(e.mark===Eg){const t=s1.some(n=>Ae(n,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&t)return ise(e)}return W2(e)}const RA="faceted_path_";function nse(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:RA+e.requestDataName(Ue.Main),data:e.requestDataName(Ue.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:W2(e,{fromPrefix:RA})}]}const MA="stack_group_";function ise(e){var l;const[t]=W2(e,{fromPrefix:MA}),n=e.scaleName(e.stack.fieldChannel),i=(c={})=>e.vgField(e.stack.fieldChannel,c),r=(c,f)=>{const d=[i({prefix:"min",suffix:"start",expr:f}),i({prefix:"max",suffix:"start",expr:f}),i({prefix:"min",suffix:"end",expr:f}),i({prefix:"max",suffix:"end",expr:f})];return`${c}(${d.map(h=>`scale('${n}',${h})`).join(",")})`};let o,s;e.stack.fieldChannel==="x"?(o={...$a(t.encode.update,["y","yc","y2","height",...s1]),x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}},s={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...En(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...$a(t.encode.update,["x","xc","x2","width"]),y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}},s={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...En(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const c of s1){const f=Bi(c,e.markDef,e.config);t.encode.update[c]?(o[c]=t.encode.update[c],delete t.encode.update[c]):f&&(o[c]=Ne(f)),f&&(t.encode.update[c]={value:0})}const a=[];if(((l=e.stack.groupbyChannels)==null?void 0:l.length)>0)for(const c of e.stack.groupbyChannels){const f=e.fieldDef(c),d=V(f);d&&a.push(d),(f!=null&&f.bin||f!=null&&f.timeUnit)&&a.push(V(f,{binSuffix:"end"}))}return o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((c,f)=>{if(t.encode.update[f])return{...c,[f]:t.encode.update[f]};{const d=Bi(f,e.markDef,e.config);return d!==void 0?{...c,[f]:Ne(d)}:c}},o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(Ue.Main),name:MA+e.requestDataName(Ue.Main),groupby:a,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:s},marks:[t]}]}]}function rse(e){const{encoding:t,stack:n,mark:i,markDef:r,config:o}=e,s=t.order;if(!(!T(s)&&ci(s)&&r1(s.value)||!s&&r1(Ae("order",r,o)))){if((T(s)||B(s))&&!n)return JD(s,{expr:"datum"});if(ko(i)){const a=r.orient==="horizontal"?"y":"x",u=t[a];if(B(u))return{field:a}}}}function W2(e,t={fromPrefix:""}){var h;const{mark:n,markDef:i,encoding:r,config:o}=e,s=Ye(i.clip,ose(e),sse(e)),a=YD(i),u=r.key,l=rse(e),c=ase(e);c&&Object.values(e.component.selection).some(g=>g.type==="point"&&!g.bind&&g.on!=="pointerover")&&((h=e.markDef).cursor??(h.cursor="pointer"));const f=Ae("aria",i,o),d=sf[n].postEncodingTransform?sf[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:sf[n].vgMark,...s?{clip:s}:{},...a?{style:a}:{},...u?{key:u.field}:{},...l?{sort:l}:{},...c||{},...f===!1?{aria:f}:{},from:{data:t.fromPrefix+e.requestDataName(Ue.Main)},encode:{update:sf[n].encodeEntry(e)},...d?{transform:d}:{}}]}function ose(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return t!=null&&t.get("selectionExtent")||n!=null&&n.get("selectionExtent")?!0:void 0}function sse(e){const t=e.component.projection;return t&&!t.isFit?!0:void 0}function ase(e){if(!e.component.selection)return null;const t=z(e.component.selection).length;let n=t,i=e.parent;for(;i&&n===0;)n=z(i.component.selection).length,i=i.parent;return n?{interactive:t>0||e.mark==="geoshape"||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}class K3 extends G3{constructor(n,i,r,o={},s){super(n,"unit",i,r,s,void 0,W$(n)?n.view:void 0);L(this,"markDef");L(this,"encoding");L(this,"specifiedScales",{});L(this,"stack");L(this,"specifiedAxes",{});L(this,"specifiedLegends",{});L(this,"specifiedProjection",{});L(this,"selection",[]);L(this,"children",[]);L(this,"correctDataNames",n=>{var i,r,o;return(i=n.from)!=null&&i.data&&(n.from.data=this.lookupDataSource(n.from.data),"time"in this.encoding&&(n.from.data=n.from.data+IN)),(o=(r=n.from)==null?void 0:r.facet)!=null&&o.data&&(n.from.facet.data=this.lookupDataSource(n.from.facet.data)),n});const a=Ui(n.mark)?{...n.mark}:{type:n.mark},u=a.type;a.filled===void 0&&(a.filled=Bte(a,s,{graticule:n.data&&S2(n.data)}));const l=this.encoding=Wee(n.encoding||{},u,a.filled,s);this.markDef=wN(a,l,s),this.size=Ioe({encoding:l,size:W$(n)?{...o,...n.width!==void 0?{width:n.width}:{},...n.height!==void 0?{height:n.height}:{}}:o}),this.stack=EN(this.markDef,l),this.specifiedScales=this.initScales(u,l),this.specifiedAxes=this.initAxes(l),this.specifiedLegends=this.initLegends(l),this.specifiedProjection=n.projection,this.selection=(n.params??[]).filter(c=>b2(c)),this.alignStackOrderWithColorDomain()}get hasProjection(){const{encoding:n}=this,i=this.mark===CT,r=n&&LJ.some(o=>ue(n[o]));return i||r}scaleDomain(n){const i=this.specifiedScales[n];return i?i.domain:void 0}axis(n){return this.specifiedAxes[n]}legend(n){return this.specifiedLegends[n]}initScales(n,i){return Dx.reduce((r,o)=>{const s=it(i[o]);return s&&(r[o]=this.initScale(s.scale??{})),r},{})}initScale(n){const{domain:i,range:r}=n,o=ht(n);return T(i)&&(o.domain=i.map(gn)),T(r)&&(o.range=r.map(gn)),o}initAxes(n){return Or.reduce((i,r)=>{const o=n[r];if(ue(o)||r===Le&&ue(n.x2)||r===ot&&ue(n.y2)){const s=ue(o)?o.axis:void 0;i[r]=s&&this.initAxis({...s})}return i},{})}initAxis(n){const i=z(n),r={};for(const o of i){const s=n[o];r[o]=Ac(s)?XD(s):gn(s)}return r}initLegends(n){return VJ.reduce((i,r)=>{const o=it(n[r]);if(o&&YJ(r)){const s=o.legend;i[r]=s&&ht(s)}return i},{})}alignStackOrderWithColorDomain(){var m;const{color:n,fill:i,order:r,xOffset:o,yOffset:s}=this.encoding,a=i||n,u=B(a)?a:void 0,l=u==null?void 0:u.field,c=u==null?void 0:u.scale,f=u==null?void 0:u.type,d=c==null?void 0:c.domain,h=o||s,g=B(h)?h:void 0,p=`_${l}_sort_index`;if(!r&&Array.isArray(d)&&typeof l=="string"&&f==="nominal")if(g&&!g.sort)g.sort=d;else{if(!this.stack)return;const y=`indexof(${G(d)}, datum['${l}'])`,b=((m=this.markDef)==null?void 0:m.orient)==="horizontal"?"ascending":"descending";this.transforms.push({calculate:y,as:p}),this.encoding.order={field:p,type:"quantitative",sort:b}}}parseData(){this.component.data=Xg(this)}parseLayoutSize(){xoe(this)}parseSelections(){this.component.selection=sie(this,this.selection)}parseMarkGroup(){this.component.mark=tse(this)}parseAxesAndHeaders(){this.component.axes=_oe(this)}assembleSelectionTopLevelSignals(n){return Dne(this,n)}assembleSignals(){return[...c3(this),...Rne(this,[])]}assembleSelectionData(n){return Tne(this,n)}assembleLayout(){return null}assembleLayoutSignals(){return M2(this)}assembleMarks(){let n=this.component.mark??[];return(!this.parent||!lu(this.parent))&&(n=UN(this,n)),n.map(this.correctDataNames)}assembleGroupStyle(){const{style:n}=this.view||{};return n!==void 0?n:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(n){return Ko(this.encoding,n)}fieldDef(n){const i=this.encoding[n];return fi(i)}typedFieldDef(n){const i=this.fieldDef(n);return Vt(i)?i:null}}class G2 extends B2{constructor(n,i,r,o,s){super(n,"layer",i,r,s,n.resolve,n.view);L(this,"children");const a={...o,...n.width?{width:n.width}:{},...n.height?{height:n.height}:{}};this.children=n.layer.map((u,l)=>{if(Mg(u))return new G2(u,this,this.getName(`layer_${l}`),a,s);if(Rr(u))return new K3(u,this,this.getName(`layer_${l}`),a,s);throw new Error(Nx(u))})}parseData(){this.component.data=Xg(this);for(const n of this.children)n.parseData()}parseLayoutSize(){boe(this)}parseSelections(){this.component.selection={};for(const n of this.children){n.parseSelections();for(const i of z(n.component.selection))this.component.selection[i]=n.component.selection[i]}Qe(this.component.selection).some(n=>Ti(n))&&Px(Ix)}parseMarkGroup(){for(const n of this.children)n.parseMarkGroup()}parseAxesAndHeaders(){Roe(this)}assembleSelectionTopLevelSignals(n){return this.children.reduce((i,r)=>r.assembleSelectionTopLevelSignals(i),n)}assembleSignals(){return this.children.reduce((n,i)=>n.concat(i.assembleSignals()),c3(this))}assembleLayoutSignals(){return this.children.reduce((n,i)=>n.concat(i.assembleLayoutSignals()),M2(this))}assembleSelectionData(n){return this.children.reduce((i,r)=>r.assembleSelectionData(i),n)}assembleGroupStyle(){const n=new Set;for(const r of this.children)for(const o of K(r.assembleGroupStyle()))n.add(o);const i=Array.from(n);return i.length>1?i:i.length===1?i[0]:void 0}assembleTitle(){let n=super.assembleTitle();if(n)return n;for(const i of this.children)if(n=i.assembleTitle(),n)return n}assembleLayout(){return null}assembleMarks(){return Nne(this,this.children.flatMap(n=>n.assembleMarks()))}assembleLegends(){return this.children.reduce((n,i)=>n.concat(i.assembleLegends()),R3(this))}}function H2(e,t,n,i,r){if(Ag(e))return new hl(e,t,n,r);if(Mg(e))return new G2(e,t,n,i,r);if(Rr(e))return new K3(e,t,n,i,r);if(gte(e))return new Aoe(e,t,n,r);throw new Error(Nx(e))}function use(e,t={}){t.logger&&bZ(t.logger),t.fieldTitle&&GT(t.fieldTitle);try{const n=xN(Wa(t.config,e.config)),i=ON(e,n),r=H2(i,null,"",void 0,n);return r.parse(),bre(r.component.data,r),{spec:cse(r,lse(e,i.autosize,n,r),e.datasets,e.usermeta),normalized:i}}finally{t.logger&&vZ(),t.fieldTitle&&Nee()}}function lse(e,t,n,i){const r=i.component.layoutSize.get("width"),o=i.component.layoutSize.get("height");if(t===void 0?(t={type:"pad"},i.hasAxisOrientSignalRef()&&(t.resize=!0)):Y(t)&&(t={type:t}),r&&o&&Ene(t.type)){if(r==="step"&&o==="step")q(F$()),t.type="pad";else if(r==="step"||o==="step"){const s=r==="step"?"width":"height";q(F$(gg(s)));const a=s==="width"?"height":"width";t.type=wne(a)}}return{...z(t).length===1&&t.type?t.type==="pad"?{}:{autosize:t.type}:{autosize:t},...nA(n,!1),...nA(e,!0)}}function cse(e,t,n={},i){const r=e.config?Fte(e.config):void 0,o=goe(e.component.data,n),s=e.assembleSelectionData(o),a=e.assembleProjections(),u=e.assembleTitle(),l=e.assembleGroupStyle(),c=e.assembleGroupEncodeEntry(!0);let f=e.assembleLayoutSignals();f=f.filter(g=>(g.name==="width"||g.name==="height")&&g.value!==void 0?(t[g.name]=+g.value,!1):!0);const{params:d,...h}=t;return{$schema:"https://vega.github.io/schema/vega/v6.json",...e.description?{description:e.description}:{},...h,...u?{title:u}:{},...l?{style:l}:{},...c?{encode:{update:c}}:{},data:s,...a.length>0?{projections:a}:{},...e.assembleGroup([...f,...e.assembleSelectionTopLevelSignals([]),...mN(d)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}const fse=OJ.version,dse=Object.freeze(Object.defineProperty({__proto__:null,accessPathDepth:Ca,accessPathWithDatum:Ax,accessWithDatumToUnescapedPath:ke,compile:use,contains:pe,deepEqual:yn,deleteNestedProperty:jd,duplicate:ae,entries:fo,every:wx,fieldIntersection:$x,flatAccessWithDatum:CD,getFirstDefined:Ye,hasIntersection:Sx,hasProperty:U,hash:de,internalField:RD,isBoolean:ka,isEmpty:Me,isEqual:MJ,isInternalField:MD,isNullOrFalse:r1,isNumeric:ug,isPrimitive:Ud,keys:z,logicalExpr:fl,mergeDeep:AD,never:$D,normalize:ON,normalizeAngle:Dl,omit:En,pick:$a,prefixGenerator:o1,removePathFromField:nu,replaceAll:ls,replacePathInField:Un,resetIdCounter:TJ,setEqual:kD,some:Aa,stringify:Fe,titleCase:gc,unescapeSingleQuoteAndPathDot:FD,unique:mn,uniqueId:OD,vals:Qe,varName:ze,version:fse},Symbol.toStringTag,{value:"Module"}));function J3(e){const[t,n]=/schema\/([\w-]+)\/([\w\.\-]+)\.json$/g.exec(e).slice(1,3);return{library:t,version:n}}var hse="3.0.0",gse={version:hse};const Vs="#fff",DA="#888",pse={background:"#333",view:{stroke:DA},title:{color:Vs,subtitleColor:Vs},style:{"guide-label":{fill:Vs},"guide-title":{fill:Vs}},axis:{domainColor:Vs,gridColor:DA,tickColor:Vs}},Oo="#4572a7",mse={background:"#fff",arc:{fill:Oo},area:{fill:Oo},line:{stroke:Oo,strokeWidth:2},path:{stroke:Oo},rect:{fill:Oo},shape:{stroke:Oo},symbol:{fill:Oo,strokeWidth:1.5,size:50},axis:{bandPosition:.5,grid:!0,gridColor:"#000000",gridOpacity:1,gridWidth:.5,labelPadding:10,tickSize:5,tickWidth:.5},axisBand:{grid:!1,tickExtra:!0},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:50,symbolType:"square"},range:{category:["#4572a7","#aa4643","#8aa453","#71598e","#4598ae","#d98445","#94aace","#d09393","#b9cc98","#a99cbc"]}},Ro="#30a2da",am="#cbcbcb",yse="#999",bse="#333",TA="#f0f0f0",NA="#333",vse={arc:{fill:Ro},area:{fill:Ro},axis:{domainColor:am,grid:!0,gridColor:am,gridWidth:1,labelColor:yse,labelFontSize:10,titleColor:bse,tickColor:am,tickSize:10,titleFontSize:14,titlePadding:10,labelPadding:4},axisBand:{grid:!1},background:TA,group:{fill:TA},legend:{labelColor:NA,labelFontSize:11,padding:1,symbolSize:30,symbolType:"square",titleColor:NA,titleFontSize:14,titlePadding:10},line:{stroke:Ro,strokeWidth:2},path:{stroke:Ro,strokeWidth:.5},rect:{fill:Ro},range:{category:["#30a2da","#fc4f30","#e5ae38","#6d904f","#8b8b8b","#b96db8","#ff9e27","#56cc60","#52d2ca","#52689e","#545454","#9fe4f8"],diverging:["#cc0020","#e77866","#f6e7e1","#d6e8ed","#91bfd9","#1d78b5"],heatmap:["#d6e8ed","#cee0e5","#91bfd9","#549cc6","#1d78b5"]},point:{filled:!0,shape:"circle"},shape:{stroke:Ro},bar:{binSpacing:2,fill:Ro,stroke:null},title:{anchor:"start",fontSize:24,fontWeight:600,offset:20}},Mo="#000",xse={group:{fill:"#e5e5e5"},arc:{fill:Mo},area:{fill:Mo},line:{stroke:Mo},path:{stroke:Mo},rect:{fill:Mo},shape:{stroke:Mo},symbol:{fill:Mo,size:40},axis:{domain:!1,grid:!0,gridColor:"#FFFFFF",gridOpacity:1,labelColor:"#7F7F7F",labelPadding:4,tickColor:"#7F7F7F",tickSize:5.67,titleFontSize:16,titleFontWeight:"normal"},legend:{labelBaseline:"middle",labelFontSize:11,symbolSize:40},range:{category:["#000000","#7F7F7F","#1A1A1A","#999999","#333333","#B0B0B0","#4D4D4D","#C9C9C9","#666666","#DCDCDC"]}},Ese=22,wse="normal",LA="Benton Gothic, sans-serif",IA=11.5,Sse="normal",Do="#82c6df",um="Benton Gothic Bold, sans-serif",PA="normal",zA=13,Fu={"category-6":["#ec8431","#829eb1","#c89d29","#3580b1","#adc839","#ab7fb4"],"fire-7":["#fbf2c7","#f9e39c","#f8d36e","#f4bb6a","#e68a4f","#d15a40","#ab4232"],"fireandice-6":["#e68a4f","#f4bb6a","#f9e39c","#dadfe2","#a6b7c6","#849eae"]},$se={background:"#ffffff",title:{anchor:"start",color:"#000000",font:um,fontSize:Ese,fontWeight:wse},arc:{fill:Do},area:{fill:Do},line:{stroke:Do,strokeWidth:2},path:{stroke:Do},rect:{fill:Do},shape:{stroke:Do},symbol:{fill:Do,size:30},axis:{labelFont:LA,labelFontSize:IA,labelFontWeight:Sse,titleFont:um,titleFontSize:zA,titleFontWeight:PA},axisX:{labelAngle:0,labelPadding:4,tickSize:3},axisY:{labelBaseline:"middle",maxExtent:45,minExtent:45,tickSize:2,titleAlign:"left",titleAngle:0,titleX:-45,titleY:-11},legend:{labelFont:LA,labelFontSize:IA,symbolType:"square",titleFont:um,titleFontSize:zA,titleFontWeight:PA},range:{category:Fu["category-6"],diverging:Fu["fireandice-6"],heatmap:Fu["fire-7"],ordinal:Fu["fire-7"],ramp:Fu["fire-7"]}},To="#ab5787",af="#979797",Ase={background:"#f9f9f9",arc:{fill:To},area:{fill:To},line:{stroke:To},path:{stroke:To},rect:{fill:To},shape:{stroke:To},symbol:{fill:To,size:30},axis:{domainColor:af,domainWidth:.5,gridWidth:.2,labelColor:af,tickColor:af,tickWidth:.2,titleColor:af},axisBand:{grid:!1},axisX:{grid:!0,tickSize:10},axisY:{domain:!1,grid:!0,tickSize:0},legend:{labelFontSize:11,padding:1,symbolSize:30,symbolType:"square"},range:{category:["#ab5787","#51b2e5","#703c5c","#168dd9","#d190b6","#00609f","#d365ba","#154866","#666666","#c4c4c4"]}},No="#3e5c69",kse={background:"#fff",arc:{fill:No},area:{fill:No},line:{stroke:No},path:{stroke:No},rect:{fill:No},shape:{stroke:No},symbol:{fill:No},axis:{domainWidth:.5,grid:!0,labelPadding:2,tickSize:5,tickWidth:.5,titleFontWeight:"normal"},axisBand:{grid:!1},axisX:{gridWidth:.2},axisY:{gridDash:[3],gridWidth:.4},legend:{labelFontSize:11,padding:1,symbolType:"square"},range:{category:["#3e5c69","#6793a6","#182429","#0570b0","#3690c0","#74a9cf","#a6bddb","#e2ddf2"]}},Fn="#1696d2",BA="#000000",Cse="#FFFFFF",uf="Lato",lm="Lato",Fse="Lato",_se="#DEDDDD",Ose=18,_u={"shades-blue":["#CFE8F3","#A2D4EC","#73BFE2","#46ABDB","#1696D2","#12719E","#0A4C6A","#062635"],"six-groups-cat-1":["#1696d2","#ec008b","#fdbf11","#000000","#d2d2d2","#55b748"],"six-groups-seq":["#cfe8f3","#a2d4ec","#73bfe2","#46abdb","#1696d2","#12719e"],"diverging-colors":["#ca5800","#fdbf11","#fdd870","#fff2cf","#cfe8f3","#73bfe2","#1696d2","#0a4c6a"]},Rse={background:Cse,title:{anchor:"start",fontSize:Ose,font:uf},axisX:{domain:!0,domainColor:BA,domainWidth:1,grid:!1,labelFontSize:12,labelFont:lm,labelAngle:0,tickColor:BA,tickSize:5,titleFontSize:12,titlePadding:10,titleFont:uf},axisY:{domain:!1,domainWidth:1,grid:!0,gridColor:_se,gridWidth:1,labelFontSize:12,labelFont:lm,labelPadding:8,ticks:!1,titleFontSize:12,titlePadding:10,titleFont:uf,titleAngle:0,titleY:-10,titleX:18},legend:{labelFontSize:12,labelFont:lm,symbolSize:100,titleFontSize:12,titlePadding:10,titleFont:uf,orient:"right",offset:10},view:{stroke:"transparent"},range:{category:_u["six-groups-cat-1"],diverging:_u["diverging-colors"],heatmap:_u["diverging-colors"],ordinal:_u["six-groups-seq"],ramp:_u["shades-blue"]},area:{fill:Fn},rect:{fill:Fn},line:{color:Fn,stroke:Fn,strokeWidth:5},trail:{color:Fn,stroke:Fn,strokeWidth:0,size:1},path:{stroke:Fn,strokeWidth:.5},point:{filled:!0},text:{font:Fse,color:Fn,fontSize:11,align:"center",fontWeight:400,size:11},style:{bar:{fill:Fn,stroke:null}},arc:{fill:Fn},shape:{stroke:Fn},symbol:{fill:Fn,size:30}},Lo="#3366CC",UA="#ccc",lf="Arial, sans-serif",Mse={arc:{fill:Lo},area:{fill:Lo},path:{stroke:Lo},rect:{fill:Lo},shape:{stroke:Lo},symbol:{stroke:Lo},circle:{fill:Lo},background:"#fff",padding:{top:10,right:10,bottom:10,left:10},style:{"guide-label":{font:lf,fontSize:12},"guide-title":{font:lf,fontSize:12},"group-title":{font:lf,fontSize:12}},title:{font:lf,fontSize:14,fontWeight:"bold",dy:-3,anchor:"start"},axis:{gridColor:UA,tickColor:UA,domain:!1,grid:!0},range:{category:["#4285F4","#DB4437","#F4B400","#0F9D58","#AB47BC","#00ACC1","#FF7043","#9E9D24","#5C6BC0","#F06292","#00796B","#C2185B"],heatmap:["#c6dafc","#5e97f6","#2a56c6"]}},V2=e=>e*(1/3+1),jA=V2(9),qA=V2(10),WA=V2(12),Ou="Segoe UI",GA="wf_standard-font, helvetica, arial, sans-serif",HA="#252423",Ru="#605E5C",VA="transparent",Dse="#C8C6C4",Xn="#118DFF",Tse="#12239E",Nse="#E66C37",Lse="#6B007B",Ise="#E044A7",Pse="#744EC2",zse="#D9B300",Bse="#D64550",Q3=Xn,Z3="#DEEFFF",XA=[Z3,Q3],Use=[Z3,"#c7e4ff","#b0d9ff","#9aceff","#83c3ff","#6cb9ff","#55aeff","#3fa3ff","#2898ff",Q3],jse={view:{stroke:VA},background:VA,font:Ou,header:{titleFont:GA,titleFontSize:WA,titleColor:HA,labelFont:Ou,labelFontSize:qA,labelColor:Ru},axis:{ticks:!1,grid:!1,domain:!1,labelColor:Ru,labelFontSize:jA,titleFont:GA,titleColor:HA,titleFontSize:WA,titleFontWeight:"normal"},axisQuantitative:{tickCount:3,grid:!0,gridColor:Dse,gridDash:[1,5],labelFlush:!1},axisBand:{tickExtra:!0},axisX:{labelPadding:5},axisY:{labelPadding:10},bar:{fill:Xn},line:{stroke:Xn,strokeWidth:3,strokeCap:"round",strokeJoin:"round"},text:{font:Ou,fontSize:jA,fill:Ru},arc:{fill:Xn},area:{fill:Xn,line:!0,opacity:.6},path:{stroke:Xn},rect:{fill:Xn},point:{fill:Xn,filled:!0,size:75},shape:{stroke:Xn},symbol:{fill:Xn,strokeWidth:1.5,size:50},legend:{titleFont:Ou,titleFontWeight:"bold",titleColor:Ru,labelFont:Ou,labelFontSize:qA,labelColor:Ru,symbolType:"circle",symbolSize:75},range:{category:[Xn,Tse,Nse,Lse,Ise,Pse,zse,Bse],diverging:XA,heatmap:XA,ordinal:Use}},cm='IBM Plex Sans,system-ui,-apple-system,BlinkMacSystemFont,".sfnstext-regular",sans-serif',qse='IBM Plex Sans Condensed, system-ui, -apple-system, BlinkMacSystemFont, ".SFNSText-Regular", sans-serif',fm=400,cf={textPrimary:{g90:"#f4f4f4",g100:"#f4f4f4",white:"#161616",g10:"#161616"},textSecondary:{g90:"#c6c6c6",g100:"#c6c6c6",white:"#525252",g10:"#525252"},layerAccent01:{white:"#e0e0e0",g10:"#e0e0e0",g90:"#525252",g100:"#393939"},gridBg:{white:"#ffffff",g10:"#ffffff",g90:"#161616",g100:"#161616"}},Wse=["#8a3ffc","#33b1ff","#007d79","#ff7eb6","#fa4d56","#fff1f1","#6fdc8c","#4589ff","#d12771","#d2a106","#08bdba","#bae6ff","#ba4e00","#d4bbff"],Gse=["#6929c4","#1192e8","#005d5d","#9f1853","#fa4d56","#570408","#198038","#002d9c","#ee538b","#b28600","#009d9a","#012749","#8a3800","#a56eff"];function Yg({theme:e,background:t}){const n=["white","g10"].includes(e)?"light":"dark",i=cf.gridBg[e],r=cf.textPrimary[e],o=cf.textSecondary[e],s=n==="dark"?Wse:Gse,a=n==="dark"?"#d4bbff":"#6929c4";return{background:t,arc:{fill:a},area:{fill:a},path:{stroke:a},rect:{fill:a},shape:{stroke:a},symbol:{stroke:a},circle:{fill:a},view:{fill:i,stroke:i},group:{fill:i},title:{color:r,anchor:"start",dy:-15,fontSize:16,font:cm,fontWeight:600},axis:{labelColor:o,labelFontSize:12,labelFont:qse,labelFontWeight:fm,titleColor:r,titleFontWeight:600,titleFontSize:12,grid:!0,gridColor:cf.layerAccent01[e],labelAngle:0},axisX:{titlePadding:10},axisY:{titlePadding:2.5},style:{"guide-label":{font:cm,fill:o,fontWeight:fm},"guide-title":{font:cm,fill:o,fontWeight:fm}},range:{category:s,diverging:["#750e13","#a2191f","#da1e28","#fa4d56","#ff8389","#ffb3b8","#ffd7d9","#fff1f1","#e5f6ff","#bae6ff","#82cfff","#33b1ff","#1192e8","#0072c3","#00539a","#003a6d"],heatmap:["#f6f2ff","#e8daff","#d4bbff","#be95ff","#a56eff","#8a3ffc","#6929c4","#491d8b","#31135e","#1c0f30"]}}}const Hse=Yg({theme:"white",background:"#ffffff"}),Vse=Yg({theme:"g10",background:"#f4f4f4"}),Xse=Yg({theme:"g90",background:"#262626"}),Yse=Yg({theme:"g100",background:"#161616"}),Kse=gse.version,Jse=Object.freeze(Object.defineProperty({__proto__:null,carbong10:Vse,carbong100:Yse,carbong90:Xse,carbonwhite:Hse,dark:pse,excel:mse,fivethirtyeight:vse,ggplot2:xse,googlecharts:Mse,latimes:$se,powerbi:jse,quartz:Ase,urbaninstitute:Rse,version:Kse,vox:kse},Symbol.toStringTag,{value:"Module"}));function Qse(e,t,n,i){if(T(e))return`[${e.map(r=>t(Y(r)?r:YA(r,n))).join(", ")}]`;if(X(e)){let r="";const{title:o,image:s,...a}=e;o&&(r+=`<h2>${t(o)}</h2>`),s&&(r+=`<img src="${new URL(t(s),i||location.href).href}">`);const u=Object.keys(a);if(u.length>0){r+="<table>";for(const l of u){let c=a[l];c!==void 0&&(X(c)&&(c=YA(c,n)),r+=`<tr><td class="key">${t(l)}</td><td class="value">${t(c)}</td></tr>`)}r+="</table>"}return r||"{}"}return t(e)}function Zse(e){const t=[];return function(n,i){if(typeof i!="object"||i===null)return i;const r=t.indexOf(this)+1;return t.length=r,t.length>e?"[Object]":t.indexOf(i)>=0?"[Circular]":(t.push(i),i)}}function YA(e,t){return JSON.stringify(e,Zse(t))}var eae=`#vg-tooltip-element {
16
- visibility: hidden;
17
- padding: 8px;
18
- position: fixed;
19
- z-index: 1000;
20
- font-family: sans-serif;
21
- font-size: 11px;
22
- border-radius: 3px;
23
- box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
24
- /* The default theme is the light theme. */
25
- background-color: rgba(255, 255, 255, 0.95);
26
- border: 1px solid #d9d9d9;
27
- color: black;
28
- }
29
- #vg-tooltip-element.visible {
30
- visibility: visible;
31
- }
32
- #vg-tooltip-element h2 {
33
- margin-top: 0;
34
- margin-bottom: 10px;
35
- font-size: 13px;
36
- }
37
- #vg-tooltip-element table {
38
- border-spacing: 0;
39
- }
40
- #vg-tooltip-element table tr {
41
- border: none;
42
- }
43
- #vg-tooltip-element table tr td {
44
- overflow: hidden;
45
- text-overflow: ellipsis;
46
- padding-top: 2px;
47
- padding-bottom: 2px;
48
- }
49
- #vg-tooltip-element table tr td.key {
50
- color: #808080;
51
- max-width: 150px;
52
- text-align: right;
53
- padding-right: 4px;
54
- }
55
- #vg-tooltip-element table tr td.value {
56
- display: block;
57
- max-width: 300px;
58
- max-height: 7em;
59
- text-align: left;
60
- }
61
- #vg-tooltip-element.dark-theme {
62
- background-color: rgba(32, 32, 32, 0.9);
63
- border: 1px solid #f5f5f5;
64
- color: white;
65
- }
66
- #vg-tooltip-element.dark-theme td.key {
67
- color: #bfbfbf;
68
- }
69
- `;const e5="vg-tooltip-element",tae={offsetX:10,offsetY:10,id:e5,styleId:"vega-tooltip-style",theme:"light",disableDefaultStyle:!1,sanitize:nae,maxDepth:2,formatTooltip:Qse,baseURL:"",anchor:"cursor",position:["top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"]};function nae(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;")}function iae(e){if(!/^[A-Za-z]+[-:.\w]*$/.test(e))throw new Error("Invalid HTML ID");return eae.toString().replaceAll(e5,e)}function t5(e,t,{offsetX:n,offsetY:i}){const r=n5({x1:e.clientX,x2:e.clientX,y1:e.clientY,y2:e.clientY},t,n,i),o=["bottom-right","bottom-left","top-right","top-left"];for(const s of o)if(i5(r[s],t))return r[s];return r["top-left"]}function rae(e,t,n,i,r){const{position:o,offsetX:s,offsetY:a}=r,u=e._el.getBoundingClientRect(),l=e._origin,c=oae(u,l,n),f=n5(c,i,s,a),d=Array.isArray(o)?o:[o];for(const h of d)if(i5(f[h],i)&&!sae(t,f[h],i))return f[h];return t5(t,i,r)}function oae(e,t,n){const i=n.isVoronoi?n.datum.bounds:n.bounds;let r=e.left+t[0]+i.x1,o=e.top+t[1]+i.y1,s=n;for(;s.mark.group;)s=s.mark.group,r+=s.x??0,o+=s.y??0;const a=i.x2-i.x1,u=i.y2-i.y1;return{x1:r,x2:r+a,y1:o,y2:o+u}}function n5(e,t,n,i){const r=(e.x1+e.x2)/2,o=(e.y1+e.y2)/2,s=e.x1-t.width-n,a=r-t.width/2,u=e.x2+n,l=e.y1-t.height-i,c=o-t.height/2,f=e.y2+i;return{top:{x:a,y:l},bottom:{x:a,y:f},left:{x:s,y:c},right:{x:u,y:c},"top-left":{x:s,y:l},"top-right":{x:u,y:l},"bottom-left":{x:s,y:f},"bottom-right":{x:u,y:f}}}function i5(e,t){return e.x>=0&&e.y>=0&&e.x+t.width<=window.innerWidth&&e.y+t.height<=window.innerHeight}function sae(e,t,n){return e.clientX>=t.x&&e.clientX<=t.x+n.width&&e.clientY>=t.y&&e.clientY<=t.y+n.height}class aae{constructor(t){L(this,"call");L(this,"options");L(this,"el");this.options={...tae,...t};const n=this.options.id;if(this.el=null,this.call=this.tooltipHandler.bind(this),!this.options.disableDefaultStyle&&!document.getElementById(this.options.styleId)){const i=document.createElement("style");i.setAttribute("id",this.options.styleId),i.innerHTML=iae(n);const r=document.head;r.childNodes.length>0?r.insertBefore(i,r.childNodes[0]):r.appendChild(i)}}tooltipHandler(t,n,i,r){if(this.el=document.getElementById(this.options.id),this.el||(this.el=document.createElement("div"),this.el.setAttribute("id",this.options.id),this.el.classList.add("vg-tooltip"),(document.fullscreenElement??document.body).appendChild(this.el)),r==null||r===""){this.el.classList.remove("visible",`${this.options.theme}-theme`);return}this.el.innerHTML=this.options.formatTooltip(r,this.options.sanitize,this.options.maxDepth,this.options.baseURL),this.el.classList.add("visible",`${this.options.theme}-theme`);const{x:o,y:s}=this.options.anchor==="mark"?rae(t,n,i,this.el.getBoundingClientRect(),this.options):t5(n,this.el.getBoundingClientRect(),this.options);this.el.style.top=`${s}px`,this.el.style.left=`${o}px`}}/*!
70
- * https://github.com/Starcounter-Jack/JSON-Patch
71
- * (c) 2017-2022 Joachim Wester
72
- * MIT licensed
73
- */var uae=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var o in r)r.hasOwnProperty(o)&&(i[o]=r[o])},e(t,n)};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),lae=Object.prototype.hasOwnProperty;function D1(e,t){return lae.call(e,t)}function T1(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n<t.length;n++)t[n]=""+n;return t}if(Object.keys)return Object.keys(e);var i=[];for(var r in e)D1(e,r)&&i.push(r);return i}function bn(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function N1(e){for(var t=0,n=e.length,i;t<n;){if(i=e.charCodeAt(t),i>=48&&i<=57){t++;continue}return!1}return!0}function Po(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function r5(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function L1(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,n=e.length;t<n;t++)if(L1(e[t]))return!0}else if(typeof e=="object"){for(var i=T1(e),r=i.length,o=0;o<r;o++)if(L1(e[i[o]]))return!0}}return!1}function KA(e,t){var n=[e];for(var i in t){var r=typeof t[i]=="object"?JSON.stringify(t[i],null,2):t[i];typeof r<"u"&&n.push(i+": "+r)}return n.join(`
74
- `)}var o5=function(e){uae(t,e);function t(n,i,r,o,s){var a=this.constructor,u=e.call(this,KA(n,{name:i,index:r,operation:o,tree:s}))||this;return u.name=i,u.index=r,u.operation=o,u.tree=s,Object.setPrototypeOf(u,a.prototype),u.message=KA(n,{name:i,index:r,operation:o,tree:s}),u}return t}(Error),qe=o5,cae=bn,na={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var i=e[t];return delete e[t],{newDocument:n,removed:i}},replace:function(e,t,n){var i=e[t];return e[t]=this.value,{newDocument:n,removed:i}},move:function(e,t,n){var i=th(n,this.path);i&&(i=bn(i));var r=Zo(n,{op:"remove",path:this.from}).removed;return Zo(n,{op:"add",path:this.path,value:r}),{newDocument:n,removed:i}},copy:function(e,t,n){var i=th(n,this.from);return Zo(n,{op:"add",path:this.path,value:bn(i)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:Pl(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},fae={add:function(e,t,n){return N1(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){var i=e.splice(t,1);return{newDocument:n,removed:i[0]}},replace:function(e,t,n){var i=e[t];return e[t]=this.value,{newDocument:n,removed:i}},move:na.move,copy:na.copy,test:na.test,_get:na._get};function th(e,t){if(t=="")return e;var n={op:"_get",path:t};return Zo(e,n),n.value}function Zo(e,t,n,i,r,o){if(n===void 0&&(n=!1),i===void 0&&(i=!0),r===void 0&&(r=!0),o===void 0&&(o=0),n&&(typeof n=="function"?n(t,0,e,t.path):nh(t,0)),t.path===""){var s={newDocument:e};if(t.op==="add")return s.newDocument=t.value,s;if(t.op==="replace")return s.newDocument=t.value,s.removed=e,s;if(t.op==="move"||t.op==="copy")return s.newDocument=th(e,t.from),t.op==="move"&&(s.removed=e),s;if(t.op==="test"){if(s.test=Pl(e,t.value),s.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s.newDocument=e,s}else{if(t.op==="remove")return s.removed=e,s.newDocument=null,s;if(t.op==="_get")return t.value=e,s;if(n)throw new qe("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,t,e);return s}}else{i||(e=bn(e));var a=t.path||"",u=a.split("/"),l=e,c=1,f=u.length,d=void 0,h=void 0,g=void 0;for(typeof n=="function"?g=n:g=nh;;){if(h=u[c],h&&h.indexOf("~")!=-1&&(h=r5(h)),r&&(h=="__proto__"||h=="prototype"&&c>0&&u[c-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&d===void 0&&(l[h]===void 0?d=u.slice(0,c).join("/"):c==f-1&&(d=t.path),d!==void 0&&g(t,0,e,d)),c++,Array.isArray(l)){if(h==="-")h=l.length;else{if(n&&!N1(h))throw new qe("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",o,t,e);N1(h)&&(h=~~h)}if(c>=f){if(n&&t.op==="add"&&h>l.length)throw new qe("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);var s=fae[t.op].call(t,l,h,e);if(s.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s}}else if(c>=f){var s=na[t.op].call(t,l,h,e);if(s.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return s}if(l=l[h],n&&c<f&&(!l||typeof l!="object"))throw new qe("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,t,e)}}}function Kg(e,t,n,i,r){if(i===void 0&&(i=!0),r===void 0&&(r=!0),n&&!Array.isArray(t))throw new qe("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");i||(e=bn(e));for(var o=new Array(t.length),s=0,a=t.length;s<a;s++)o[s]=Zo(e,t[s],n,!0,r,s),e=o[s].newDocument;return o.newDocument=e,o}function dae(e,t,n){var i=Zo(e,t);if(i.test===!1)throw new qe("Test operation failed","TEST_OPERATION_FAILED",n,t,e);return i.newDocument}function nh(e,t,n,i){if(typeof e!="object"||e===null||Array.isArray(e))throw new qe("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(na[e.op]){if(typeof e.path!="string")throw new qe("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new qe('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new qe("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new qe("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if((e.op==="add"||e.op==="replace"||e.op==="test")&&L1(e.value))throw new qe("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n){if(e.op=="add"){var r=e.path.split("/").length,o=i.split("/").length;if(r!==o+1&&r!==o)throw new qe("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==i)throw new qe("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if(e.op==="move"||e.op==="copy"){var s={op:"_get",path:e.from,value:void 0},a=s5([s],n);if(a&&a.name==="OPERATION_PATH_UNRESOLVABLE")throw new qe("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}}else throw new qe("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n)}function s5(e,t,n){try{if(!Array.isArray(e))throw new qe("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Kg(bn(t),bn(e),n||!0);else{n=n||nh;for(var i=0;i<e.length;i++)n(e[i],i,t,void 0)}}catch(r){if(r instanceof qe)return r;throw r}}function Pl(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var n=Array.isArray(e),i=Array.isArray(t),r,o,s;if(n&&i){if(o=e.length,o!=t.length)return!1;for(r=o;r--!==0;)if(!Pl(e[r],t[r]))return!1;return!0}if(n!=i)return!1;var a=Object.keys(e);if(o=a.length,o!==Object.keys(t).length)return!1;for(r=o;r--!==0;)if(!t.hasOwnProperty(a[r]))return!1;for(r=o;r--!==0;)if(s=a[r],!Pl(e[s],t[s]))return!1;return!0}return e!==e&&t!==t}var hae=Object.freeze({__proto__:null,JsonPatchError:qe,_areEquals:Pl,applyOperation:Zo,applyPatch:Kg,applyReducer:dae,deepClone:cae,getValueByPointer:th,validate:s5,validator:nh});/*!
75
- * https://github.com/Starcounter-Jack/JSON-Patch
76
- * (c) 2017-2021 Joachim Wester
77
- * MIT license
78
- */var X2=new WeakMap,gae=function(){function e(t){this.observers=new Map,this.obj=t}return e}(),pae=function(){function e(t,n){this.callback=t,this.observer=n}return e}();function mae(e){return X2.get(e)}function yae(e,t){return e.observers.get(t)}function bae(e,t){e.observers.delete(t.callback)}function vae(e,t){t.unobserve()}function xae(e,t){var n=[],i,r=mae(e);if(!r)r=new gae(e),X2.set(e,r);else{var o=yae(r,t);i=o&&o.observer}if(i)return i;if(i={},r.value=bn(e),t){i.callback=t,i.next=null;var s=function(){I1(i)},a=function(){clearTimeout(i.next),i.next=setTimeout(s)};typeof window<"u"&&(window.addEventListener("mouseup",a),window.addEventListener("keyup",a),window.addEventListener("mousedown",a),window.addEventListener("keydown",a),window.addEventListener("change",a))}return i.patches=n,i.object=e,i.unobserve=function(){I1(i),clearTimeout(i.next),bae(r,i),typeof window<"u"&&(window.removeEventListener("mouseup",a),window.removeEventListener("keyup",a),window.removeEventListener("mousedown",a),window.removeEventListener("keydown",a),window.removeEventListener("change",a))},r.observers.set(t,new pae(t,i)),i}function I1(e,t){t===void 0&&(t=!1);var n=X2.get(e.object);Y2(n.value,e.object,e.patches,"",t),e.patches.length&&Kg(n.value,e.patches);var i=e.patches;return i.length>0&&(e.patches=[],e.callback&&e.callback(i)),i}function Y2(e,t,n,i,r){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var o=T1(t),s=T1(e),a=!1,u=s.length-1;u>=0;u--){var l=s[u],c=e[l];if(D1(t,l)&&!(t[l]===void 0&&c!==void 0&&Array.isArray(t)===!1)){var f=t[l];typeof c=="object"&&c!=null&&typeof f=="object"&&f!=null&&Array.isArray(c)===Array.isArray(f)?Y2(c,f,n,i+"/"+Po(l),r):c!==f&&(r&&n.push({op:"test",path:i+"/"+Po(l),value:bn(c)}),n.push({op:"replace",path:i+"/"+Po(l),value:bn(f)}))}else Array.isArray(e)===Array.isArray(t)?(r&&n.push({op:"test",path:i+"/"+Po(l),value:bn(c)}),n.push({op:"remove",path:i+"/"+Po(l)}),a=!0):(r&&n.push({op:"test",path:i,value:e}),n.push({op:"replace",path:i,value:t}))}if(!(!a&&o.length==s.length))for(var u=0;u<o.length;u++){var l=o[u];!D1(e,l)&&t[l]!==void 0&&n.push({op:"add",path:i+"/"+Po(l),value:bn(t[l])})}}}function Eae(e,t,n){n===void 0&&(n=!1);var i=[];return Y2(e,t,i,"",n),i}var wae=Object.freeze({__proto__:null,compare:Eae,generate:I1,observe:xae,unobserve:vae});Object.assign({},hae,wae,{JsonPatchError:o5,deepClone:bn,escapePathComponent:Po,unescapePathComponent:r5});function Sae(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dm,JA;function $ae(){if(JA)return dm;JA=1;class e{constructor(){this.max=1e3,this.map=new Map}get(n){const i=this.map.get(n);if(i!==void 0)return this.map.delete(n),this.map.set(n,i),i}delete(n){return this.map.delete(n)}set(n,i){if(!this.delete(n)&&i!==void 0){if(this.map.size>=this.max){const o=this.map.keys().next().value;this.delete(o)}this.map.set(n,i)}return this}}return dm=e,dm}var hm,QA;function K2(){if(QA)return hm;QA=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return hm=i=>i?typeof i!="object"?e:i:t,hm}var ff={exports:{}},gm,ZA;function J2(){if(ZA)return gm;ZA=1;const e="2.0.0",t=256,n=Number.MAX_SAFE_INTEGER||9007199254740991,i=16,r=t-6;return gm={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:i,MAX_SAFE_BUILD_LENGTH:r,MAX_SAFE_INTEGER:n,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},gm}var pm,ek;function Jg(){return ek||(ek=1,pm=typeof process=="object"&&process.env&&{}.NODE_DEBUG&&/\bsemver\b/i.test({}.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{}),pm}var tk;function Q2(){return tk||(tk=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:r}=J2(),o=Jg();t=e.exports={};const s=t.re=[],a=t.safeRe=[],u=t.src=[],l=t.safeSrc=[],c=t.t={};let f=0;const d="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",r],[d,i]],g=m=>{for(const[y,b]of h)m=m.split(`${y}*`).join(`${y}{0,${b}}`).split(`${y}+`).join(`${y}{1,${b}}`);return m},p=(m,y,b)=>{const v=g(y),x=f++;o(m,x,y),c[m]=x,u[x]=y,l[x]=v,s[x]=new RegExp(y,b?"g":void 0),a[x]=new RegExp(v,b?"g":void 0)};p("NUMERICIDENTIFIER","0|[1-9]\\d*"),p("NUMERICIDENTIFIERLOOSE","\\d+"),p("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),p("MAINVERSION",`(${u[c.NUMERICIDENTIFIER]})\\.(${u[c.NUMERICIDENTIFIER]})\\.(${u[c.NUMERICIDENTIFIER]})`),p("MAINVERSIONLOOSE",`(${u[c.NUMERICIDENTIFIERLOOSE]})\\.(${u[c.NUMERICIDENTIFIERLOOSE]})\\.(${u[c.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASEIDENTIFIER",`(?:${u[c.NONNUMERICIDENTIFIER]}|${u[c.NUMERICIDENTIFIER]})`),p("PRERELEASEIDENTIFIERLOOSE",`(?:${u[c.NONNUMERICIDENTIFIER]}|${u[c.NUMERICIDENTIFIERLOOSE]})`),p("PRERELEASE",`(?:-(${u[c.PRERELEASEIDENTIFIER]}(?:\\.${u[c.PRERELEASEIDENTIFIER]})*))`),p("PRERELEASELOOSE",`(?:-?(${u[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[c.PRERELEASEIDENTIFIERLOOSE]})*))`),p("BUILDIDENTIFIER",`${d}+`),p("BUILD",`(?:\\+(${u[c.BUILDIDENTIFIER]}(?:\\.${u[c.BUILDIDENTIFIER]})*))`),p("FULLPLAIN",`v?${u[c.MAINVERSION]}${u[c.PRERELEASE]}?${u[c.BUILD]}?`),p("FULL",`^${u[c.FULLPLAIN]}$`),p("LOOSEPLAIN",`[v=\\s]*${u[c.MAINVERSIONLOOSE]}${u[c.PRERELEASELOOSE]}?${u[c.BUILD]}?`),p("LOOSE",`^${u[c.LOOSEPLAIN]}$`),p("GTLT","((?:<|>)?=?)"),p("XRANGEIDENTIFIERLOOSE",`${u[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),p("XRANGEIDENTIFIER",`${u[c.NUMERICIDENTIFIER]}|x|X|\\*`),p("XRANGEPLAIN",`[v=\\s]*(${u[c.XRANGEIDENTIFIER]})(?:\\.(${u[c.XRANGEIDENTIFIER]})(?:\\.(${u[c.XRANGEIDENTIFIER]})(?:${u[c.PRERELEASE]})?${u[c.BUILD]}?)?)?`),p("XRANGEPLAINLOOSE",`[v=\\s]*(${u[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[c.XRANGEIDENTIFIERLOOSE]})(?:${u[c.PRERELEASELOOSE]})?${u[c.BUILD]}?)?)?`),p("XRANGE",`^${u[c.GTLT]}\\s*${u[c.XRANGEPLAIN]}$`),p("XRANGELOOSE",`^${u[c.GTLT]}\\s*${u[c.XRANGEPLAINLOOSE]}$`),p("COERCEPLAIN",`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),p("COERCE",`${u[c.COERCEPLAIN]}(?:$|[^\\d])`),p("COERCEFULL",u[c.COERCEPLAIN]+`(?:${u[c.PRERELEASE]})?(?:${u[c.BUILD]})?(?:$|[^\\d])`),p("COERCERTL",u[c.COERCE],!0),p("COERCERTLFULL",u[c.COERCEFULL],!0),p("LONETILDE","(?:~>?)"),p("TILDETRIM",`(\\s*)${u[c.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",p("TILDE",`^${u[c.LONETILDE]}${u[c.XRANGEPLAIN]}$`),p("TILDELOOSE",`^${u[c.LONETILDE]}${u[c.XRANGEPLAINLOOSE]}$`),p("LONECARET","(?:\\^)"),p("CARETTRIM",`(\\s*)${u[c.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",p("CARET",`^${u[c.LONECARET]}${u[c.XRANGEPLAIN]}$`),p("CARETLOOSE",`^${u[c.LONECARET]}${u[c.XRANGEPLAINLOOSE]}$`),p("COMPARATORLOOSE",`^${u[c.GTLT]}\\s*(${u[c.LOOSEPLAIN]})$|^$`),p("COMPARATOR",`^${u[c.GTLT]}\\s*(${u[c.FULLPLAIN]})$|^$`),p("COMPARATORTRIM",`(\\s*)${u[c.GTLT]}\\s*(${u[c.LOOSEPLAIN]}|${u[c.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",p("HYPHENRANGE",`^\\s*(${u[c.XRANGEPLAIN]})\\s+-\\s+(${u[c.XRANGEPLAIN]})\\s*$`),p("HYPHENRANGELOOSE",`^\\s*(${u[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[c.XRANGEPLAINLOOSE]})\\s*$`),p("STAR","(<|>)?=?\\s*\\*"),p("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),p("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(ff,ff.exports)),ff.exports}var mm,nk;function Aae(){if(nk)return mm;nk=1;const e=/^[0-9]+$/,t=(i,r)=>{const o=e.test(i),s=e.test(r);return o&&s&&(i=+i,r=+r),i===r?0:o&&!s?-1:s&&!o?1:i<r?-1:1};return mm={compareIdentifiers:t,rcompareIdentifiers:(i,r)=>t(r,i)},mm}var ym,ik;function Z2(){if(ik)return ym;ik=1;const e=Jg(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:n}=J2(),{safeRe:i,t:r}=Q2(),o=K2(),{compareIdentifiers:s}=Aae();class a{constructor(l,c){if(c=o(c),l instanceof a){if(l.loose===!!c.loose&&l.includePrerelease===!!c.includePrerelease)return l;l=l.version}else if(typeof l!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof l}".`);if(l.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",l,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;const f=l.trim().match(c.loose?i[r.LOOSE]:i[r.FULL]);if(!f)throw new TypeError(`Invalid Version: ${l}`);if(this.raw=l,this.major=+f[1],this.minor=+f[2],this.patch=+f[3],this.major>n||this.major<0)throw new TypeError("Invalid major version");if(this.minor>n||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>n||this.patch<0)throw new TypeError("Invalid patch version");f[4]?this.prerelease=f[4].split(".").map(d=>{if(/^[0-9]+$/.test(d)){const h=+d;if(h>=0&&h<n)return h}return d}):this.prerelease=[],this.build=f[5]?f[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(l){if(e("SemVer.compare",this.version,this.options,l),!(l instanceof a)){if(typeof l=="string"&&l===this.version)return 0;l=new a(l,this.options)}return l.version===this.version?0:this.compareMain(l)||this.comparePre(l)}compareMain(l){return l instanceof a||(l=new a(l,this.options)),s(this.major,l.major)||s(this.minor,l.minor)||s(this.patch,l.patch)}comparePre(l){if(l instanceof a||(l=new a(l,this.options)),this.prerelease.length&&!l.prerelease.length)return-1;if(!this.prerelease.length&&l.prerelease.length)return 1;if(!this.prerelease.length&&!l.prerelease.length)return 0;let c=0;do{const f=this.prerelease[c],d=l.prerelease[c];if(e("prerelease compare",c,f,d),f===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(f===void 0)return-1;if(f===d)continue;return s(f,d)}while(++c)}compareBuild(l){l instanceof a||(l=new a(l,this.options));let c=0;do{const f=this.build[c],d=l.build[c];if(e("build compare",c,f,d),f===void 0&&d===void 0)return 0;if(d===void 0)return 1;if(f===void 0)return-1;if(f===d)continue;return s(f,d)}while(++c)}inc(l,c,f){if(l.startsWith("pre")){if(!c&&f===!1)throw new Error("invalid increment argument: identifier is empty");if(c){const d=`-${c}`.match(this.options.loose?i[r.PRERELEASELOOSE]:i[r.PRERELEASE]);if(!d||d[1]!==c)throw new Error(`invalid identifier: ${c}`)}}switch(l){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",c,f);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",c,f);break;case"prepatch":this.prerelease.length=0,this.inc("patch",c,f),this.inc("pre",c,f);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",c,f),this.inc("pre",c,f);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const d=Number(f)?1:0;if(this.prerelease.length===0)this.prerelease=[d];else{let h=this.prerelease.length;for(;--h>=0;)typeof this.prerelease[h]=="number"&&(this.prerelease[h]++,h=-2);if(h===-1){if(c===this.prerelease.join(".")&&f===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(d)}}if(c){let h=[c,d];f===!1&&(h=[c]),s(this.prerelease[0],c)===0?isNaN(this.prerelease[1])&&(this.prerelease=h):this.prerelease=h}break}default:throw new Error(`invalid increment argument: ${l}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return ym=a,ym}var bm,rk;function cu(){if(rk)return bm;rk=1;const e=Z2();return bm=(n,i,r)=>new e(n,r).compare(new e(i,r)),bm}var vm,ok;function kae(){if(ok)return vm;ok=1;const e=cu();return vm=(n,i,r)=>e(n,i,r)===0,vm}var xm,sk;function Cae(){if(sk)return xm;sk=1;const e=cu();return xm=(n,i,r)=>e(n,i,r)!==0,xm}var Em,ak;function Fae(){if(ak)return Em;ak=1;const e=cu();return Em=(n,i,r)=>e(n,i,r)>0,Em}var wm,uk;function _ae(){if(uk)return wm;uk=1;const e=cu();return wm=(n,i,r)=>e(n,i,r)>=0,wm}var Sm,lk;function Oae(){if(lk)return Sm;lk=1;const e=cu();return Sm=(n,i,r)=>e(n,i,r)<0,Sm}var $m,ck;function Rae(){if(ck)return $m;ck=1;const e=cu();return $m=(n,i,r)=>e(n,i,r)<=0,$m}var Am,fk;function Mae(){if(fk)return Am;fk=1;const e=kae(),t=Cae(),n=Fae(),i=_ae(),r=Oae(),o=Rae();return Am=(a,u,l,c)=>{switch(u){case"===":return typeof a=="object"&&(a=a.version),typeof l=="object"&&(l=l.version),a===l;case"!==":return typeof a=="object"&&(a=a.version),typeof l=="object"&&(l=l.version),a!==l;case"":case"=":case"==":return e(a,l,c);case"!=":return t(a,l,c);case">":return n(a,l,c);case">=":return i(a,l,c);case"<":return r(a,l,c);case"<=":return o(a,l,c);default:throw new TypeError(`Invalid operator: ${u}`)}},Am}var km,dk;function Dae(){if(dk)return km;dk=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(c,f){if(f=n(f),c instanceof t){if(c.loose===!!f.loose)return c;c=c.value}c=c.trim().split(/\s+/).join(" "),s("comparator",c,f),this.options=f,this.loose=!!f.loose,this.parse(c),this.semver===e?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(c){const f=this.options.loose?i[r.COMPARATORLOOSE]:i[r.COMPARATOR],d=c.match(f);if(!d)throw new TypeError(`Invalid comparator: ${c}`);this.operator=d[1]!==void 0?d[1]:"",this.operator==="="&&(this.operator=""),d[2]?this.semver=new a(d[2],this.options.loose):this.semver=e}toString(){return this.value}test(c){if(s("Comparator.test",c,this.options.loose),this.semver===e||c===e)return!0;if(typeof c=="string")try{c=new a(c,this.options)}catch{return!1}return o(c,this.operator,this.semver,this.options)}intersects(c,f){if(!(c instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new u(c.value,f).test(this.value):c.operator===""?c.value===""?!0:new u(this.value,f).test(c.semver):(f=n(f),f.includePrerelease&&(this.value==="<0.0.0-0"||c.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||c.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&c.operator.startsWith(">")||this.operator.startsWith("<")&&c.operator.startsWith("<")||this.semver.version===c.semver.version&&this.operator.includes("=")&&c.operator.includes("=")||o(this.semver,"<",c.semver,f)&&this.operator.startsWith(">")&&c.operator.startsWith("<")||o(this.semver,">",c.semver,f)&&this.operator.startsWith("<")&&c.operator.startsWith(">")))}}km=t;const n=K2(),{safeRe:i,t:r}=Q2(),o=Mae(),s=Jg(),a=Z2(),u=a5();return km}var Cm,hk;function a5(){if(hk)return Cm;hk=1;const e=/\s+/g;class t{constructor(k,_){if(_=r(_),k instanceof t)return k.loose===!!_.loose&&k.includePrerelease===!!_.includePrerelease?k:new t(k.raw,_);if(k instanceof o)return this.raw=k.value,this.set=[[k]],this.formatted=void 0,this;if(this.options=_,this.loose=!!_.loose,this.includePrerelease=!!_.includePrerelease,this.raw=k.trim().replace(e," "),this.set=this.raw.split("||").map(N=>this.parseRange(N.trim())).filter(N=>N.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const N=this.set[0];if(this.set=this.set.filter(W=>!p(W[0])),this.set.length===0)this.set=[N];else if(this.set.length>1){for(const W of this.set)if(W.length===1&&m(W[0])){this.set=[W];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let k=0;k<this.set.length;k++){k>0&&(this.formatted+="||");const _=this.set[k];for(let N=0;N<_.length;N++)N>0&&(this.formatted+=" "),this.formatted+=_[N].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(k){const N=((this.options.includePrerelease&&h)|(this.options.loose&&g))+":"+k,W=i.get(N);if(W)return W;const P=this.options.loose,Q=P?u[l.HYPHENRANGELOOSE]:u[l.HYPHENRANGE];k=k.replace(Q,I(this.options.includePrerelease)),s("hyphen replace",k),k=k.replace(u[l.COMPARATORTRIM],c),s("comparator trim",k),k=k.replace(u[l.TILDETRIM],f),s("tilde trim",k),k=k.replace(u[l.CARETTRIM],d),s("caret trim",k);let le=k.split(" ").map($e=>b($e,this.options)).join(" ").split(/\s+/).map($e=>F($e,this.options));P&&(le=le.filter($e=>(s("loose invalid filter",$e,this.options),!!$e.match(u[l.COMPARATORLOOSE])))),s("range list",le);const se=new Map,me=le.map($e=>new o($e,this.options));for(const $e of me){if(p($e))return[$e];se.set($e.value,$e)}se.size>1&&se.has("")&&se.delete("");const Ve=[...se.values()];return i.set(N,Ve),Ve}intersects(k,_){if(!(k instanceof t))throw new TypeError("a Range is required");return this.set.some(N=>y(N,_)&&k.set.some(W=>y(W,_)&&N.every(P=>W.every(Q=>P.intersects(Q,_)))))}test(k){if(!k)return!1;if(typeof k=="string")try{k=new a(k,this.options)}catch{return!1}for(let _=0;_<this.set.length;_++)if(j(this.set[_],k,this.options))return!0;return!1}}Cm=t;const n=$ae(),i=new n,r=K2(),o=Dae(),s=Jg(),a=Z2(),{safeRe:u,t:l,comparatorTrimReplace:c,tildeTrimReplace:f,caretTrimReplace:d}=Q2(),{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:g}=J2(),p=O=>O.value==="<0.0.0-0",m=O=>O.value==="",y=(O,k)=>{let _=!0;const N=O.slice();let W=N.pop();for(;_&&N.length;)_=N.every(P=>W.intersects(P,k)),W=N.pop();return _},b=(O,k)=>(s("comp",O,k),O=S(O,k),s("caret",O),O=x(O,k),s("tildes",O),O=$(O,k),s("xrange",O),O=C(O,k),s("stars",O),O),v=O=>!O||O.toLowerCase()==="x"||O==="*",x=(O,k)=>O.trim().split(/\s+/).map(_=>w(_,k)).join(" "),w=(O,k)=>{const _=k.loose?u[l.TILDELOOSE]:u[l.TILDE];return O.replace(_,(N,W,P,Q,le)=>{s("tilde",O,N,W,P,Q,le);let se;return v(W)?se="":v(P)?se=`>=${W}.0.0 <${+W+1}.0.0-0`:v(Q)?se=`>=${W}.${P}.0 <${W}.${+P+1}.0-0`:le?(s("replaceTilde pr",le),se=`>=${W}.${P}.${Q}-${le} <${W}.${+P+1}.0-0`):se=`>=${W}.${P}.${Q} <${W}.${+P+1}.0-0`,s("tilde return",se),se})},S=(O,k)=>O.trim().split(/\s+/).map(_=>E(_,k)).join(" "),E=(O,k)=>{s("caret",O,k);const _=k.loose?u[l.CARETLOOSE]:u[l.CARET],N=k.includePrerelease?"-0":"";return O.replace(_,(W,P,Q,le,se)=>{s("caret",O,W,P,Q,le,se);let me;return v(P)?me="":v(Q)?me=`>=${P}.0.0${N} <${+P+1}.0.0-0`:v(le)?P==="0"?me=`>=${P}.${Q}.0${N} <${P}.${+Q+1}.0-0`:me=`>=${P}.${Q}.0${N} <${+P+1}.0.0-0`:se?(s("replaceCaret pr",se),P==="0"?Q==="0"?me=`>=${P}.${Q}.${le}-${se} <${P}.${Q}.${+le+1}-0`:me=`>=${P}.${Q}.${le}-${se} <${P}.${+Q+1}.0-0`:me=`>=${P}.${Q}.${le}-${se} <${+P+1}.0.0-0`):(s("no pr"),P==="0"?Q==="0"?me=`>=${P}.${Q}.${le}${N} <${P}.${Q}.${+le+1}-0`:me=`>=${P}.${Q}.${le}${N} <${P}.${+Q+1}.0-0`:me=`>=${P}.${Q}.${le} <${+P+1}.0.0-0`),s("caret return",me),me})},$=(O,k)=>(s("replaceXRanges",O,k),O.split(/\s+/).map(_=>A(_,k)).join(" ")),A=(O,k)=>{O=O.trim();const _=k.loose?u[l.XRANGELOOSE]:u[l.XRANGE];return O.replace(_,(N,W,P,Q,le,se)=>{s("xRange",O,N,W,P,Q,le,se);const me=v(P),Ve=me||v(Q),$e=Ve||v(le),Ei=$e;return W==="="&&Ei&&(W=""),se=k.includePrerelease?"-0":"",me?W===">"||W==="<"?N="<0.0.0-0":N="*":W&&Ei?(Ve&&(Q=0),le=0,W===">"?(W=">=",Ve?(P=+P+1,Q=0,le=0):(Q=+Q+1,le=0)):W==="<="&&(W="<",Ve?P=+P+1:Q=+Q+1),W==="<"&&(se="-0"),N=`${W+P}.${Q}.${le}${se}`):Ve?N=`>=${P}.0.0${se} <${+P+1}.0.0-0`:$e&&(N=`>=${P}.${Q}.0${se} <${P}.${+Q+1}.0-0`),s("xRange return",N),N})},C=(O,k)=>(s("replaceStars",O,k),O.trim().replace(u[l.STAR],"")),F=(O,k)=>(s("replaceGTE0",O,k),O.trim().replace(u[k.includePrerelease?l.GTE0PRE:l.GTE0],"")),I=O=>(k,_,N,W,P,Q,le,se,me,Ve,$e,Ei)=>(v(N)?_="":v(W)?_=`>=${N}.0.0${O?"-0":""}`:v(P)?_=`>=${N}.${W}.0${O?"-0":""}`:Q?_=`>=${_}`:_=`>=${_}${O?"-0":""}`,v(me)?se="":v(Ve)?se=`<${+me+1}.0.0-0`:v($e)?se=`<${me}.${+Ve+1}.0-0`:Ei?se=`<=${me}.${Ve}.${$e}-${Ei}`:O?se=`<${me}.${Ve}.${+$e+1}-0`:se=`<=${se}`,`${_} ${se}`.trim()),j=(O,k,_)=>{for(let N=0;N<O.length;N++)if(!O[N].test(k))return!1;if(k.prerelease.length&&!_.includePrerelease){for(let N=0;N<O.length;N++)if(s(O[N].semver),O[N].semver!==o.ANY&&O[N].semver.prerelease.length>0){const W=O[N].semver;if(W.major===k.major&&W.minor===k.minor&&W.patch===k.patch)return!0}return!1}return!0};return Cm}var Fm,gk;function Tae(){if(gk)return Fm;gk=1;const e=a5();return Fm=(n,i,r)=>{try{i=new e(i,r)}catch{return!1}return i.test(n)},Fm}var Nae=Tae(),u5=Sae(Nae);function Lae(e,t,n){const i=e.open(t),r=250,{origin:o}=new URL(t);let s=40;function a(l){l.source===i&&(s=0,e.removeEventListener("message",a,!1))}e.addEventListener("message",a,!1);function u(){s<=0||(i.postMessage(n,o),setTimeout(u,r),s-=1)}setTimeout(u,r)}var Iae=`.vega-embed {
79
- position: relative;
80
- display: inline-block;
81
- box-sizing: border-box;
82
- }
83
- .vega-embed.has-actions {
84
- padding-right: 38px;
85
- }
86
- .vega-embed details:not([open]) > :not(summary) {
87
- display: none !important;
88
- }
89
- .vega-embed summary {
90
- list-style: none;
91
- position: absolute;
92
- top: 0;
93
- right: 0;
94
- padding: 6px;
95
- z-index: 1000;
96
- background: white;
97
- box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
98
- color: #1b1e23;
99
- border: 1px solid #aaa;
100
- border-radius: 999px;
101
- opacity: 0.2;
102
- transition: opacity 0.4s ease-in;
103
- cursor: pointer;
104
- line-height: 0px;
105
- }
106
- .vega-embed summary::-webkit-details-marker {
107
- display: none;
108
- }
109
- .vega-embed summary:active {
110
- box-shadow: #aaa 0px 0px 0px 1px inset;
111
- }
112
- .vega-embed summary svg {
113
- width: 14px;
114
- height: 14px;
115
- }
116
- .vega-embed details[open] summary {
117
- opacity: 0.7;
118
- }
119
- .vega-embed:hover summary, .vega-embed:focus-within summary {
120
- opacity: 1 !important;
121
- transition: opacity 0.2s ease;
122
- }
123
- .vega-embed .vega-actions {
124
- position: absolute;
125
- z-index: 1001;
126
- top: 35px;
127
- right: -9px;
128
- display: flex;
129
- flex-direction: column;
130
- padding-bottom: 8px;
131
- padding-top: 8px;
132
- border-radius: 4px;
133
- box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.2);
134
- border: 1px solid #d9d9d9;
135
- background: white;
136
- animation-duration: 0.15s;
137
- animation-name: scale-in;
138
- animation-timing-function: cubic-bezier(0.2, 0, 0.13, 1.5);
139
- text-align: left;
140
- }
141
- .vega-embed .vega-actions a {
142
- padding: 8px 16px;
143
- font-family: sans-serif;
144
- font-size: 14px;
145
- font-weight: 600;
146
- white-space: nowrap;
147
- color: #434a56;
148
- text-decoration: none;
149
- }
150
- .vega-embed .vega-actions a:hover, .vega-embed .vega-actions a:focus {
151
- background-color: #f7f7f9;
152
- color: black;
153
- }
154
- .vega-embed .vega-actions::before, .vega-embed .vega-actions::after {
155
- content: "";
156
- display: inline-block;
157
- position: absolute;
158
- }
159
- .vega-embed .vega-actions::before {
160
- left: auto;
161
- right: 14px;
162
- top: -16px;
163
- border: 8px solid rgba(0, 0, 0, 0);
164
- border-bottom-color: #d9d9d9;
165
- }
166
- .vega-embed .vega-actions::after {
167
- left: auto;
168
- right: 15px;
169
- top: -14px;
170
- border: 7px solid rgba(0, 0, 0, 0);
171
- border-bottom-color: #fff;
172
- }
173
- .vega-embed .chart-wrapper.fit-x {
174
- width: 100%;
175
- }
176
- .vega-embed .chart-wrapper.fit-y {
177
- height: 100%;
178
- }
179
-
180
- .vega-embed-wrapper {
181
- max-width: 100%;
182
- overflow: auto;
183
- padding-right: 14px;
184
- }
185
-
186
- @keyframes scale-in {
187
- from {
188
- opacity: 0;
189
- transform: scale(0.6);
190
- }
191
- to {
192
- opacity: 1;
193
- transform: scale(1);
194
- }
195
- }
196
- `;function l5(e,...t){for(const n of t)Pae(e,n);return e}function Pae(e,t){for(const n of Object.keys(t))Ga(e,n,t[n],!0)}var zae="7.1.0",Bae={version:zae};const Hue=Bae.version,$i=bJ;let zl=dse;const df=typeof window<"u"?window:void 0;var bk;zl===void 0&&((bk=df==null?void 0:df.vl)!=null&&bk.compile)&&(zl=df.vl);const Uae={export:{svg:!0,png:!0},source:!0,compiled:!0,editor:!0},jae={CLICK_TO_VIEW_ACTIONS:"Click to view actions",COMPILED_ACTION:"View Compiled Vega",EDITOR_ACTION:"Open in Vega Editor",PNG_ACTION:"Save as PNG",SOURCE_ACTION:"View Source",SVG_ACTION:"Save as SVG"},Qu={vega:"Vega","vega-lite":"Vega-Lite"},ih={vega:$i.version,"vega-lite":zl?zl.version:"not available"},qae={vega:e=>e,"vega-lite":(e,t,n)=>zl.compile(e,{config:n,logger:t}).spec},Wae=`
197
- <svg viewBox="0 0 16 16" fill="currentColor" stroke="none" stroke-width="1" stroke-linecap="round" stroke-linejoin="round">
198
- <circle r="2" cy="8" cx="2"></circle>
199
- <circle r="2" cy="8" cx="8"></circle>
200
- <circle r="2" cy="8" cx="14"></circle>
201
- </svg>`,Gae="chart-wrapper";function Hae(e){return typeof e=="function"}function pk(e,t,n,i){const r=`<html><head>${t}</head><body><pre><code class="json">`,o=`</code></pre>${n}</body></html>`,s=window.open("");s.document.write(r+e+o),s.document.title=`${Qu[i]} JSON Source`}function Vae(e,t,n){if(e.$schema){const i=J3(e.$schema);n&&n!==i.library&&t.warn(`The given visualization spec is written in ${Qu[i.library]}, but mode argument sets ${Qu[n]??n}.`);const r=i.library;return u5(ih[r],`^${i.version.slice(1)}`)||t.warn(`The input spec uses ${Qu[r]} ${i.version}, but the current version of ${Qu[r]} is v${ih[r]}.`),r}return"mark"in e||"encoding"in e||"layer"in e||"hconcat"in e||"vconcat"in e||"facet"in e||"repeat"in e?"vega-lite":"marks"in e||"signals"in e||"scales"in e||"axes"in e?"vega":n??"vega"}function c5(e){return!!(e&&"load"in e)}function mk(e){return c5(e)?e:$i.loader(e)}function Xae(e){var n;const t=((n=e.usermeta)==null?void 0:n.embedOptions)??{};return Y(t.defaultStyle)&&(t.defaultStyle=!1),t}async function Vue(e,t,n={}){let i,r;Y(t)?(r=mk(n.loader),i=JSON.parse(await r.load(t))):i=t;const o=Xae(i),s=o.loader;(!r||s)&&(r=mk(n.loader??s));const a=await yk(o,r),u=await yk(n,r),l={...l5(u,a),config:Wa(u.config??{},a.config??{})};return await Kae(e,i,l,r)}async function yk(e,t){const n=Y(e.config)?JSON.parse(await t.load(e.config)):e.config??{},i=Y(e.patch)?JSON.parse(await t.load(e.patch)):e.patch;return{...e,...i?{patch:i}:{},...n?{config:n}:{}}}function Yae(e){const t=e.getRootNode?e.getRootNode():document;return t instanceof ShadowRoot?{root:t,rootContainer:t}:{root:document,rootContainer:document.head??document.body}}async function Kae(e,t,n={},i){const r=n.theme?Wa(Jse[n.theme],n.config??{}):n.config,o=Es(n.actions)?n.actions:l5({},Uae,n.actions??{}),s={...jae,...n.i18n},a=n.renderer??"svg",u=n.logger??hh($i.Warn);n.logLevel!==void 0&&u.level(n.logLevel);const l=n.downloadFileName??"visualization",c=typeof e=="string"?document.querySelector(e):e;if(!c)throw new Error(`${e} does not exist`);if(n.defaultStyle!==!1){const w="vega-embed-style",{root:S,rootContainer:E}=Yae(c);if(!S.getElementById(w)){const $=document.createElement("style");$.id=w,$.innerHTML=n.defaultStyle===void 0||n.defaultStyle===!0?Iae.toString():n.defaultStyle,E.appendChild($)}}const f=Vae(t,u,n.mode);let d=qae[f](t,u,r);if(f==="vega-lite"&&d.$schema){const w=J3(d.$schema);u5(ih.vega,`^${w.version.slice(1)}`)||u.warn(`The compiled spec uses Vega ${w.version}, but current version is v${ih.vega}.`)}c.classList.add("vega-embed"),o&&c.classList.add("has-actions"),c.innerHTML="";let h=c;if(o){const w=document.createElement("div");w.classList.add(Gae),c.appendChild(w),h=w}const g=n.patch;if(g&&(d=g instanceof Function?g(d):Kg(d,g,!0,!1).newDocument),n.formatLocale&&$i.formatLocale(n.formatLocale),n.timeFormatLocale&&$i.timeFormatLocale(n.timeFormatLocale),n.expressionFunctions)for(const w in n.expressionFunctions){const S=n.expressionFunctions[w];"fn"in S?$i.expressionFunction(w,S.fn,S.visitor):S instanceof Function&&$i.expressionFunction(w,S)}const{ast:p}=n,m=$i.parse(d,f==="vega-lite"?{}:r,{ast:p}),y=new(n.viewClass||$i.View)(m,{loader:i,logger:u,renderer:a,...p?{expr:$i.expressionInterpreter??n.expr??FJ}:{}});if(y.addSignalListener("autosize",(w,S)=>{const{type:E}=S;E=="fit-x"?(h.classList.add("fit-x"),h.classList.remove("fit-y")):E=="fit-y"?(h.classList.remove("fit-x"),h.classList.add("fit-y")):E=="fit"?h.classList.add("fit-x","fit-y"):h.classList.remove("fit-x","fit-y")}),n.tooltip!==!1){const{loader:w,tooltip:S}=n,E=w&&!c5(w)?w==null?void 0:w.baseURL:void 0,$=Hae(S)?S:new aae({baseURL:E,...S===!0?{}:S}).call;y.tooltip($)}let{hover:b}=n;if(b===void 0&&(b=f==="vega"),b){const{hoverSet:w,updateSet:S}=typeof b=="boolean"?{}:b;y.hover(w,S)}n&&(n.width!=null&&y.width(n.width),n.height!=null&&y.height(n.height),n.padding!=null&&y.padding(n.padding)),await y.initialize(h,n.bind).runAsync();let v;if(o!==!1){let w=c;if(n.defaultStyle!==!1||n.forceActionsMenu){const E=document.createElement("details");E.title=s.CLICK_TO_VIEW_ACTIONS,c.append(E),w=E;const $=document.createElement("summary");$.innerHTML=Wae,E.append($),v=A=>{E.contains(A.target)||E.removeAttribute("open")},document.addEventListener("click",v)}const S=document.createElement("div");if(w.append(S),S.classList.add("vega-actions"),o===!0||o.export!==!1){for(const E of["svg","png"])if(o===!0||o.export===!0||o.export[E]){const $=s[`${E.toUpperCase()}_ACTION`],A=document.createElement("a"),C=X(n.scaleFactor)?n.scaleFactor[E]:n.scaleFactor;A.text=$,A.href="#",A.target="_blank",A.download=`${l}.${E}`,A.addEventListener("mousedown",async function(F){F.preventDefault();const I=await y.toImageURL(E,C);this.href=I}),S.append(A)}}if(o===!0||o.source!==!1){const E=document.createElement("a");E.text=s.SOURCE_ACTION,E.href="#",E.addEventListener("click",function($){pk(gp(t),n.sourceHeader??"",n.sourceFooter??"",f),$.preventDefault()}),S.append(E)}if(f==="vega-lite"&&(o===!0||o.compiled!==!1)){const E=document.createElement("a");E.text=s.COMPILED_ACTION,E.href="#",E.addEventListener("click",function($){pk(gp(d),n.sourceHeader??"",n.sourceFooter??"","vega"),$.preventDefault()}),S.append(E)}if(o===!0||o.editor!==!1){const E=n.editorUrl??"https://vega.github.io/editor/",$=document.createElement("a");$.text=s.EDITOR_ACTION,$.href="#",$.addEventListener("click",function(A){Lae(window,E,{config:r,mode:g?"vega":f,renderer:a,spec:gp(g?d:t)}),A.preventDefault()}),S.append($)}}function x(){v&&document.removeEventListener("click",v),y.finalize()}return{view:y,spec:t,vgSpec:d,finalize:x,embedOptions:n}}export{Uae as DEFAULT_ACTIONS,Vue as default,Vae as guessMode,$i as vega,zl as vegaLite,Hue as version};